diff --git a/README.md b/README.md index 174ecb0..f6ad443 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,24 @@ -# clac +# sa -clac provides IDE style autocomplete aka `inshellisense` in every shell +`sa` provides IDE style autocomplete, `inshellisense`, for shells. It's a terminal native runtime of for [autocomplete](https://github.com/withfig/autocomplete) which has support for 600+ command line tools. `sa` supports Windows, Linux, & MacOS. -

demo of clac working

- -clac is a terminal native implementation of fig's [autocomplete specs](https://github.com/withfig/autocomplete) which -provide support for 600+ command line tools. - -## Supported Integrations - -| Shells | IDEs | OS | -| ------------------ | ------------------ | ------- | -| bash | Visual Studio Code | Mac | -| Windows Powershell | | Windows | -| pwsh (Powershell) | | Linux | +

demo of sa working

## Getting Started ### Installation -#### MacOS, Linux, & Windows - ```shell -go install github.com/microsoft/clac@latest +npm install -g @microsoft/sa ``` ### Quickstart -After completing the installation, bind `clac` to the terminal you'd like to use -it with via the `clac bind [shell]` command. This will create a custom keybinding -for `CTRL+a` to trigger the autocomplete session & execution. +After completing the installation, you can already run `sa --shell ` to start the autocomplete session for your desired shell. Additionally, you can bind `sa` to a keybinding of `CTRL+a` by running the below command. This brings the added advantages of automatically starting the autocomplete session with your current shell and injecting any accepted command into your shell's history. -### AI Autocomplete - -Some generators use Open AI's api to generate intelligent solutions to your commands. -To use this feature, you'll need to set the `CLAC_AI_TOKEN` environment variable to your Open AI api key. +```shell +sa bind +``` ## Contributing diff --git a/package-lock.json b/package-lock.json index 7c4829b..66559af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@microsoft/clac", + "name": "@microsoft/sa", "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "@microsoft/clac", + "name": "@microsoft/sa", "version": "0.0.0", "license": "MIT", "dependencies": { @@ -17,7 +17,7 @@ "wrap-ansi": "^8.1.0" }, "bin": { - "clac": "build/index.js" + "sa": "build/index.js" }, "devDependencies": { "@tsconfig/node18": "^18.2.2", @@ -9509,4 +9509,4 @@ "integrity": "sha512-N+d4UJSJbt/R3wqY7Coqs5pcV0aUj2j9IaQ3rNj9bVCLld8tTGKRa2USARjnvZJWVx1NDmQev8EknoczaOQDOA==" } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 55b1a2a..6d7ee85 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "@microsoft/clac", + "name": "@microsoft/sa", "version": "0.0.0", "description": "IDE style command line auto complete", "type": "module", "bin": { - "clac": "./build/index.js" + "sa": "./build/index.js" }, "files": [ "build/**", @@ -18,16 +18,16 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/microsoft/clac.git" + "url": "git+https://github.com/microsoft/sa.git" }, "author": { "name": "Microsoft Corporation" }, "license": "MIT", "bugs": { - "url": "https://github.com/microsoft/clac/issues" + "url": "https://github.com/microsoft/sa/issues" }, - "homepage": "https://github.com/microsoft/clac#readme", + "homepage": "https://github.com/microsoft/sa#readme", "dependencies": { "@withfig/autocomplete": "^2.633.0", "chalk": "^5.3.0", diff --git a/shell/key-bindings-powershell.ps1 b/shell/key-bindings-powershell.ps1 index d425454..4ae3443 100644 --- a/shell/key-bindings-powershell.ps1 +++ b/shell/key-bindings-powershell.ps1 @@ -3,7 +3,7 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$command, [ref]$null) $oldPrompt = $function:prompt - function prompt {"`r"} + function prompt { "`r" } [Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt() $prompt = $oldPrompt @@ -11,14 +11,15 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::BeginningOfLine() [Microsoft.PowerShell.PSConsoleReadLine]::KillLine() - $clac = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\clac\build\index.js" + $sa = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\sa\build\index.js" if ($command) { - Start-Process -NoNewWindow -Wait "node" "$clac -c $command -s powershell" - } else { - Start-Process -NoNewWindow -Wait "node" "$clac -s powershell" + Start-Process -NoNewWindow -Wait "node" "$sa -c $command -s powershell" + } + else { + Start-Process -NoNewWindow -Wait "node" "$sa -s powershell" } - $executedCommand = node $clac --history + $executedCommand = node $sa --history if ($executedCommand) { [Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($executedCommand) } diff --git a/shell/key-bindings-pwsh.ps1 b/shell/key-bindings-pwsh.ps1 index 5000dd3..8e37ba8 100644 --- a/shell/key-bindings-pwsh.ps1 +++ b/shell/key-bindings-pwsh.ps1 @@ -3,7 +3,7 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::GetBufferState([ref]$command, [ref]$null) $oldPrompt = $function:prompt - function prompt {"`r"} + function prompt { "`r" } [Microsoft.PowerShell.PSConsoleReadLine]::InvokePrompt() $prompt = $oldPrompt @@ -11,14 +11,15 @@ Set-PSReadLineKeyHandler -Chord 'Ctrl+a' -ScriptBlock { [Microsoft.PowerShell.PSConsoleReadLine]::BeginningOfLine() [Microsoft.PowerShell.PSConsoleReadLine]::KillLine() - $clac = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\clac\build\index.js" + $sa = "$env:USERPROFILE\AppData\Roaming\npm\node_modules\@microsoft\sa\build\index.js" if ($command) { - Start-Process -NoNewWindow -Wait "node" "$clac -c $command -s pwsh" - } else { - Start-Process -NoNewWindow -Wait "node" "$clac -s pwsh" + Start-Process -NoNewWindow -Wait "node" "$sa -c $command -s pwsh" + } + else { + Start-Process -NoNewWindow -Wait "node" "$sa -s pwsh" } - $executedCommand = node $clac --history + $executedCommand = node $sa --history if ($executedCommand) { [Microsoft.PowerShell.PSConsoleReadLine]::AddToHistory($executedCommand) } diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index a1b9cfd..4ff68da 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -1,6 +1,6 @@ -__clac__() { - clac -c "$READLINE_LINE" -s bash - history -s $(clac --history) +__sa__() { + sa -c "$READLINE_LINE" -s bash + history -s $(sa --history) } -bind -x '"\C-a": __clac__' \ No newline at end of file +bind -x '"\C-a": __sa__' \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 6a9b034..674e950 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,7 +8,7 @@ import { action, supportedShells } from "./commands/root.js"; const program = new Command(); program - .name("clac") + .name("sa") .description("IDE style command line auto complete") .version("0.0.0", "-v, --version", "output the current version") .option("-s, --shell ", `shell to use for command execution, supported shells: ${supportedShells}`) diff --git a/src/utils/cache.ts b/src/utils/cache.ts index 2cb88f8..d86061c 100644 --- a/src/utils/cache.ts +++ b/src/utils/cache.ts @@ -3,8 +3,8 @@ import path from "node:path"; import fsAsync from "node:fs/promises"; import fs from "node:fs"; -const folderPath = path.join(os.homedir(), ".clac"); -const cachePath = path.join(os.homedir(), ".clac", "clac.cache"); +const folderPath = path.join(os.homedir(), ".sa"); +const cachePath = path.join(os.homedir(), ".sa", "sa.cache"); export const saveCommand = async (command: string) => { if (!fs.existsSync(folderPath)) {