@microsoft/inshellisense 0.0.1-rc.8 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +111 -12
- package/SECURITY.md +41 -41
- package/bin.js +30 -0
- package/package.json +18 -66
- package/build/commands/complete.js +0 -15
- package/build/commands/root.js +0 -32
- package/build/commands/uninstall.js +0 -11
- package/build/index.js +0 -28
- package/build/isterm/commandManager.js +0 -220
- package/build/isterm/index.js +0 -4
- package/build/isterm/pty.js +0 -257
- package/build/runtime/generator.js +0 -53
- package/build/runtime/model.js +0 -3
- package/build/runtime/parser.js +0 -63
- package/build/runtime/runtime.js +0 -241
- package/build/runtime/suggestion.js +0 -204
- package/build/runtime/template.js +0 -41
- package/build/runtime/utils.js +0 -52
- package/build/ui/suggestionManager.js +0 -151
- package/build/ui/ui-root.js +0 -137
- package/build/ui/ui-uninstall.js +0 -9
- package/build/ui/utils.js +0 -41
- package/build/utils/ansi.js +0 -33
- package/build/utils/config.js +0 -68
- package/build/utils/log.js +0 -30
- package/build/utils/shell.js +0 -93
- package/build/utils/version.js +0 -13
- package/shell/bash-preexec.sh +0 -380
- package/shell/shellIntegration-env.zsh +0 -9
- package/shell/shellIntegration-login.zsh +0 -4
- package/shell/shellIntegration-profile.zsh +0 -4
- package/shell/shellIntegration-rc.zsh +0 -58
- package/shell/shellIntegration.bash +0 -68
- package/shell/shellIntegration.fish +0 -19
- package/shell/shellIntegration.ps1 +0 -24
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
package/README.md
CHANGED
|
@@ -6,32 +6,72 @@
|
|
|
6
6
|
|
|
7
7
|
## Getting Started
|
|
8
8
|
|
|
9
|
-
### Requirements
|
|
10
|
-
|
|
11
|
-
- `21 < node >= 16.x`
|
|
12
|
-
- node-gyp dependencies installed for your platform (see [node-gyp](https://github.com/nodejs/node-gyp) for more details)
|
|
13
|
-
|
|
14
9
|
### Installation
|
|
15
10
|
|
|
11
|
+
**npm (recommended)**
|
|
16
12
|
```shell
|
|
17
13
|
npm install -g @microsoft/inshellisense
|
|
14
|
+
is init
|
|
15
|
+
```
|
|
16
|
+
**homebrew (macOS/linux)**
|
|
17
|
+
```shell
|
|
18
|
+
brew tap microsoft/inshellisense https://github.com/microsoft/inshellisense
|
|
19
|
+
brew install inshellisense
|
|
20
|
+
is init
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Updating
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
npm install -g @microsoft/inshellisense # OR brew upgrade inshellisense
|
|
27
|
+
is reinit
|
|
18
28
|
```
|
|
19
29
|
|
|
20
30
|
### Quickstart
|
|
21
31
|
|
|
22
|
-
After completing the installation,
|
|
32
|
+
After completing the installation, run `is doctor` to verify your installation was successful. You can run `is` to start the autocomplete session for your desired shell. Additionally, inshellisense is also aliased under `inshellisense` after installation.
|
|
33
|
+
|
|
34
|
+
### Shell Plugin
|
|
35
|
+
|
|
36
|
+
If you'd like to automatically start inshellisense when you open your shell, run the respective command for your shell. After running the command, inshellisense will automatically open when you start any new shell session:
|
|
37
|
+
|
|
38
|
+
```shell
|
|
39
|
+
# bash
|
|
40
|
+
is init bash >> ~/.bashrc
|
|
41
|
+
|
|
42
|
+
# zsh
|
|
43
|
+
is init zsh >> ~/.zshrc
|
|
44
|
+
|
|
45
|
+
# fish
|
|
46
|
+
is init fish >> ~/.config/fish/config.fish
|
|
47
|
+
|
|
48
|
+
# pwsh
|
|
49
|
+
is init pwsh | Add-Content $profile
|
|
50
|
+
|
|
51
|
+
# powershell
|
|
52
|
+
is init powershell | Add-Content $profile
|
|
53
|
+
|
|
54
|
+
# xonsh
|
|
55
|
+
is init xonsh >> ~/.xonshrc
|
|
56
|
+
|
|
57
|
+
# nushell
|
|
58
|
+
is init nu | save $nu.env-path --append
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> [!NOTE]
|
|
62
|
+
> When updating your shell configuration in the future, make sure the inshellisense plugin is the last command in the file. Including commands after it may break the configuration (ex. initializing your shell plugin manager after the inshellisense plugin)
|
|
23
63
|
|
|
24
64
|
### Usage
|
|
25
65
|
|
|
26
|
-
| Action | Command |
|
|
27
|
-
| ------------------------------------- | ------- |
|
|
28
|
-
| Start | `is` |
|
|
29
|
-
| Stop | `exit` |
|
|
30
|
-
| Check If Inside Inshellisense Session | `is -c` |
|
|
66
|
+
| Action | Command | Description |
|
|
67
|
+
| ------------------------------------- | ------- | ------------------------------------------------ |
|
|
68
|
+
| Start | `is` | Start inshellisense session on the current shell |
|
|
69
|
+
| Stop | `exit` | Stop inshellisense session on the current shell |
|
|
70
|
+
| Check If Inside Inshellisense Session | `is -c` | Check if shell inside inshellisense session |
|
|
31
71
|
|
|
32
72
|
#### Keybindings
|
|
33
73
|
|
|
34
|
-
All other keys are passed through to the shell. The keybindings below are only captured when the inshellisense suggestions are visible, otherwise they are passed through to the shell as well.
|
|
74
|
+
All other keys are passed through to the shell. The keybindings below are only captured when the inshellisense suggestions are visible, otherwise they are passed through to the shell as well. These can be customized in the [config](#configuration).
|
|
35
75
|
|
|
36
76
|
| Action | Keybinding |
|
|
37
77
|
| ------------------------- | -------------- |
|
|
@@ -50,6 +90,65 @@ inshellisense supports the following shells:
|
|
|
50
90
|
- [pwsh](https://github.com/PowerShell/PowerShell)
|
|
51
91
|
- [powershell](https://learn.microsoft.com/en-us/powershell/scripting/windows-powershell/starting-windows-powershell) (Windows Powershell)
|
|
52
92
|
- [cmd](https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmd) _(experimental)_
|
|
93
|
+
- [xonsh](https://xon.sh/)
|
|
94
|
+
- [nushell](https://www.nushell.sh/)
|
|
95
|
+
|
|
96
|
+
## Configuration
|
|
97
|
+
|
|
98
|
+
All configuration is done through a [toml](https://toml.io/) file. You can create this file at `~/.inshellisenserc` or, for XDG compliance, at `~/.config/inshellisense/rc.toml`. The [JSON schema](https://json-schema.org/) for the configuration file can be found [here](https://github.com/microsoft/inshellisense/blob/main/src/utils/config.ts).
|
|
99
|
+
|
|
100
|
+
### Keybindings
|
|
101
|
+
|
|
102
|
+
You can customize the keybindings for inshellisense by adding a `bindings` section to your config file. The following is the default configuration for the [keybindings](#keybindings):
|
|
103
|
+
|
|
104
|
+
```toml
|
|
105
|
+
[bindings.acceptSuggestion]
|
|
106
|
+
key = "tab"
|
|
107
|
+
# shift and ctrl are optional and default to false
|
|
108
|
+
shift = false
|
|
109
|
+
ctrl = false
|
|
110
|
+
|
|
111
|
+
[bindings.nextSuggestion]
|
|
112
|
+
key = "down"
|
|
113
|
+
|
|
114
|
+
[bindings.previousSuggestion]
|
|
115
|
+
key = "up"
|
|
116
|
+
|
|
117
|
+
[bindings.dismissSuggestions]
|
|
118
|
+
key = "escape"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Key names are matched against the Node.js [keypress](https://nodejs.org/api/readline.html#readlineemitkeypresseventsstream-interface) events.
|
|
122
|
+
|
|
123
|
+
### Alias Expansion
|
|
124
|
+
|
|
125
|
+
Inshellisense supports expanding aliases for bash/zsh shells. You can enable alias expansion in your config file:
|
|
126
|
+
|
|
127
|
+
```toml
|
|
128
|
+
useAliases = true
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### NerdFonts
|
|
132
|
+
|
|
133
|
+
If you are using a [NerdFont](https://www.nerdfonts.com/) patched font, you can enable the NerdFonts support in your config file:
|
|
134
|
+
|
|
135
|
+
```toml
|
|
136
|
+
useNerdFont = true
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Max Suggestions
|
|
140
|
+
|
|
141
|
+
You can change the maximum number of suggestions displayed in the autocomplete list at one time in your config file:
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
```toml
|
|
145
|
+
maxSuggestions = 10
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
## Unsupported Specs
|
|
150
|
+
|
|
151
|
+
Specs for the `az`, `gcloud`, & `aws` CLIs are not supported in inshellisense due to their large size.
|
|
53
152
|
|
|
54
153
|
## Contributing
|
|
55
154
|
|
package/SECURITY.md
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
|
|
2
|
-
|
|
3
|
-
## Security
|
|
4
|
-
|
|
5
|
-
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
|
|
6
|
-
|
|
7
|
-
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
|
|
8
|
-
|
|
9
|
-
## Reporting Security Issues
|
|
10
|
-
|
|
11
|
-
**Please do not report security vulnerabilities through public GitHub issues.**
|
|
12
|
-
|
|
13
|
-
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
|
|
14
|
-
|
|
15
|
-
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
|
|
16
|
-
|
|
17
|
-
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
|
18
|
-
|
|
19
|
-
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
|
20
|
-
|
|
21
|
-
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
|
22
|
-
* Full paths of source file(s) related to the manifestation of the issue
|
|
23
|
-
* The location of the affected source code (tag/branch/commit or direct URL)
|
|
24
|
-
* Any special configuration required to reproduce the issue
|
|
25
|
-
* Step-by-step instructions to reproduce the issue
|
|
26
|
-
* Proof-of-concept or exploit code (if possible)
|
|
27
|
-
* Impact of the issue, including how an attacker might exploit the issue
|
|
28
|
-
|
|
29
|
-
This information will help us triage your report more quickly.
|
|
30
|
-
|
|
31
|
-
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
|
|
32
|
-
|
|
33
|
-
## Preferred Languages
|
|
34
|
-
|
|
35
|
-
We prefer all communications to be in English.
|
|
36
|
-
|
|
37
|
-
## Policy
|
|
38
|
-
|
|
39
|
-
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
|
|
40
|
-
|
|
41
|
-
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
|
1
|
+
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.9 BLOCK -->
|
|
2
|
+
|
|
3
|
+
## Security
|
|
4
|
+
|
|
5
|
+
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet) and [Xamarin](https://github.com/xamarin).
|
|
6
|
+
|
|
7
|
+
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/security.md/definition), please report it to us as described below.
|
|
8
|
+
|
|
9
|
+
## Reporting Security Issues
|
|
10
|
+
|
|
11
|
+
**Please do not report security vulnerabilities through public GitHub issues.**
|
|
12
|
+
|
|
13
|
+
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/security.md/msrc/create-report).
|
|
14
|
+
|
|
15
|
+
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/security.md/msrc/pgp).
|
|
16
|
+
|
|
17
|
+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc).
|
|
18
|
+
|
|
19
|
+
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
|
20
|
+
|
|
21
|
+
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
|
22
|
+
* Full paths of source file(s) related to the manifestation of the issue
|
|
23
|
+
* The location of the affected source code (tag/branch/commit or direct URL)
|
|
24
|
+
* Any special configuration required to reproduce the issue
|
|
25
|
+
* Step-by-step instructions to reproduce the issue
|
|
26
|
+
* Proof-of-concept or exploit code (if possible)
|
|
27
|
+
* Impact of the issue, including how an attacker might exploit the issue
|
|
28
|
+
|
|
29
|
+
This information will help us triage your report more quickly.
|
|
30
|
+
|
|
31
|
+
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/security.md/msrc/bounty) page for more details about our active programs.
|
|
32
|
+
|
|
33
|
+
## Preferred Languages
|
|
34
|
+
|
|
35
|
+
We prefer all communications to be in English.
|
|
36
|
+
|
|
37
|
+
## Policy
|
|
38
|
+
|
|
39
|
+
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/security.md/cvd).
|
|
40
|
+
|
|
41
|
+
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
package/bin.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
const { spawnSync } = require("child_process");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
|
|
8
|
+
const platform = process.platform;
|
|
9
|
+
const arch = process.arch;
|
|
10
|
+
|
|
11
|
+
const platformArch = `${platform}-${arch}`;
|
|
12
|
+
const packageName = `@microsoft/inshellisense-${platformArch}`;
|
|
13
|
+
const binaryName = platform === "win32" ? `inshellisense-${platformArch}.exe` : `inshellisense-${platformArch}`;
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const platformPkgPath = require.resolve(`${packageName}/package.json`);
|
|
17
|
+
const platformPkgDir = path.dirname(platformPkgPath);
|
|
18
|
+
const binaryPath = path.join(platformPkgDir, binaryName);
|
|
19
|
+
|
|
20
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
21
|
+
stdio: "inherit",
|
|
22
|
+
shell: false,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
process.exit(result.status ?? 1);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
console.error(`inshellisense: Platform ${platformArch} is not supported.`);
|
|
28
|
+
console.error(err.message);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/inshellisense",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "IDE style command line auto complete",
|
|
5
|
-
"
|
|
6
|
-
"engines": {
|
|
7
|
-
"node": ">=16.6.0 <21.0.0"
|
|
8
|
-
},
|
|
9
|
-
"bin": {
|
|
10
|
-
"inshellisense": "./build/index.js",
|
|
11
|
-
"is": "./build/index.js"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"build/**",
|
|
15
|
-
"shell/**",
|
|
16
|
-
"*.md",
|
|
17
|
-
"LICENSE"
|
|
18
|
-
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "tsc",
|
|
21
|
-
"dev": "node --loader ts-node/esm src/index.ts -V",
|
|
22
|
-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
23
|
-
"test:e2e": "tui-test",
|
|
24
|
-
"lint": "eslint src/ --ext .ts,.tsx && prettier src/ --check",
|
|
25
|
-
"lint:fix": "eslint src/ --ext .ts,.tsx --fix && prettier src/ --write",
|
|
26
|
-
"debug": "node --inspect --loader ts-node/esm src/index.ts -V",
|
|
27
|
-
"pre-commit": "lint-staged"
|
|
28
|
-
},
|
|
5
|
+
"license": "MIT",
|
|
29
6
|
"repository": {
|
|
30
7
|
"type": "git",
|
|
31
8
|
"url": "git+https://github.com/microsoft/inshellisense.git"
|
|
@@ -33,49 +10,24 @@
|
|
|
33
10
|
"author": {
|
|
34
11
|
"name": "Microsoft Corporation"
|
|
35
12
|
},
|
|
36
|
-
"license": "MIT",
|
|
37
13
|
"bugs": {
|
|
38
14
|
"url": "https://github.com/microsoft/inshellisense/issues"
|
|
39
15
|
},
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
"@microsoft/tui-test": "^0.0.1-rc.3",
|
|
44
|
-
"@withfig/autocomplete": "2.651.0",
|
|
45
|
-
"ajv": "^8.12.0",
|
|
46
|
-
"ansi-escapes": "^6.2.0",
|
|
47
|
-
"ansi-styles": "^6.2.1",
|
|
48
|
-
"chalk": "^5.3.0",
|
|
49
|
-
"commander": "^11.0.0",
|
|
50
|
-
"find-process": "^1.4.7",
|
|
51
|
-
"which": "^4.0.0",
|
|
52
|
-
"wrap-ansi": "^8.1.0",
|
|
53
|
-
"xterm-headless": "^5.3.0"
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@tsconfig/node18": "^18.2.2",
|
|
57
|
-
"@types/jest": "^29.5.5",
|
|
58
|
-
"@types/react": "^18.2.24",
|
|
59
|
-
"@types/which": "^3.0.3",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
61
|
-
"@typescript-eslint/parser": "^6.7.4",
|
|
62
|
-
"@withfig/autocomplete-types": "^1.28.0",
|
|
63
|
-
"eslint": "^8.51.0",
|
|
64
|
-
"eslint-config-prettier": "^9.0.0",
|
|
65
|
-
"eslint-plugin-header": "^3.1.1",
|
|
66
|
-
"eslint-plugin-react": "^7.33.2",
|
|
67
|
-
"husky": "^9.0.11",
|
|
68
|
-
"jest": "^29.7.0",
|
|
69
|
-
"lint-staged": "^15.2.2",
|
|
70
|
-
"prettier": "3.0.3",
|
|
71
|
-
"ts-jest": "^29.1.1",
|
|
72
|
-
"ts-node": "^10.9.2",
|
|
73
|
-
"typescript": "^5.2.2"
|
|
16
|
+
"bin": {
|
|
17
|
+
"is": "bin.js",
|
|
18
|
+
"inshellisense": "bin.js"
|
|
74
19
|
},
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
20
|
+
"files": [
|
|
21
|
+
"*.md",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"bin.js"
|
|
24
|
+
],
|
|
25
|
+
"optionalDependencies": {
|
|
26
|
+
"@microsoft/inshellisense-darwin-x64": "0.0.1",
|
|
27
|
+
"@microsoft/inshellisense-darwin-arm64": "0.0.1",
|
|
28
|
+
"@microsoft/inshellisense-linux-x64": "0.0.1",
|
|
29
|
+
"@microsoft/inshellisense-linux-arm64": "0.0.1",
|
|
30
|
+
"@microsoft/inshellisense-win32-x64": "0.0.1",
|
|
31
|
+
"@microsoft/inshellisense-win32-arm64": "0.0.1"
|
|
80
32
|
}
|
|
81
|
-
}
|
|
33
|
+
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
import { Command } from "commander";
|
|
5
|
-
import { getSuggestions } from "../runtime/runtime.js";
|
|
6
|
-
import { Shell } from "../utils/shell.js";
|
|
7
|
-
const action = async (input) => {
|
|
8
|
-
const suggestions = await getSuggestions(input, process.cwd(), os.platform() === "win32" ? Shell.Cmd : Shell.Bash);
|
|
9
|
-
process.stdout.write(JSON.stringify(suggestions));
|
|
10
|
-
};
|
|
11
|
-
const cmd = new Command("complete");
|
|
12
|
-
cmd.description(`generates a completion for the provided input`);
|
|
13
|
-
cmd.argument("<input>");
|
|
14
|
-
cmd.action(action);
|
|
15
|
-
export default cmd;
|
package/build/commands/root.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { render, renderConfirmation } from "../ui/ui-root.js";
|
|
4
|
-
import { Shell, supportedShells as shells, setupZshDotfiles, setupBashPreExec } from "../utils/shell.js";
|
|
5
|
-
import { inferShell } from "../utils/shell.js";
|
|
6
|
-
import { loadConfig } from "../utils/config.js";
|
|
7
|
-
import log from "../utils/log.js";
|
|
8
|
-
export const supportedShells = shells.join(", ");
|
|
9
|
-
export const action = (program) => async (options) => {
|
|
10
|
-
const inISTerm = process.env.ISTERM === "1";
|
|
11
|
-
if (options.check || inISTerm) {
|
|
12
|
-
process.stdout.write(renderConfirmation(inISTerm));
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (options.verbose)
|
|
16
|
-
await log.enable();
|
|
17
|
-
await loadConfig(program);
|
|
18
|
-
const shell = options.shell ?? (await inferShell());
|
|
19
|
-
if (shell == null) {
|
|
20
|
-
program.error(`Unable to identify shell, use the -s/--shell option to provide your shell`, { exitCode: 1 });
|
|
21
|
-
}
|
|
22
|
-
if (!shells.map((s) => s.valueOf()).includes(shell)) {
|
|
23
|
-
program.error(`Unsupported shell: '${shell}', supported shells: ${supportedShells}`, { exitCode: 1 });
|
|
24
|
-
}
|
|
25
|
-
if (shell == Shell.Zsh) {
|
|
26
|
-
await setupZshDotfiles();
|
|
27
|
-
}
|
|
28
|
-
else if (shell == Shell.Bash) {
|
|
29
|
-
await setupBashPreExec();
|
|
30
|
-
}
|
|
31
|
-
await render(shell, options.test ?? false);
|
|
32
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT License.
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { render } from "../ui/ui-uninstall.js";
|
|
5
|
-
const action = async () => {
|
|
6
|
-
await render();
|
|
7
|
-
};
|
|
8
|
-
const cmd = new Command("uninstall");
|
|
9
|
-
cmd.description(`removes all configuration for inshellisense`);
|
|
10
|
-
cmd.action(action);
|
|
11
|
-
export default cmd;
|
package/build/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT License.
|
|
4
|
-
/* eslint-disable header/header */
|
|
5
|
-
import { Command, Option } from "commander";
|
|
6
|
-
import complete from "./commands/complete.js";
|
|
7
|
-
import uninstall from "./commands/uninstall.js";
|
|
8
|
-
import { action, supportedShells } from "./commands/root.js";
|
|
9
|
-
import { getVersion } from "./utils/version.js";
|
|
10
|
-
const program = new Command();
|
|
11
|
-
const hiddenOption = (flags, description) => {
|
|
12
|
-
const option = new Option(flags, description);
|
|
13
|
-
option.hidden = true;
|
|
14
|
-
return option;
|
|
15
|
-
};
|
|
16
|
-
program
|
|
17
|
-
.name("inshellisense")
|
|
18
|
-
.description("IDE style command line auto complete")
|
|
19
|
-
.version(await getVersion(), "-v, --version", "output the current version")
|
|
20
|
-
.action(action(program))
|
|
21
|
-
.option("-s, --shell <shell>", `shell to use for command execution, supported shells: ${supportedShells}`)
|
|
22
|
-
.option("-c, --check", `check if shell is in an inshellisense session`)
|
|
23
|
-
.addOption(hiddenOption("-T, --test", "used to make e2e tests reproducible across machines"))
|
|
24
|
-
.option("-V, --verbose", `enable verbose logging`)
|
|
25
|
-
.showHelpAfterError("(add --help for additional information)");
|
|
26
|
-
program.addCommand(complete);
|
|
27
|
-
program.addCommand(uninstall);
|
|
28
|
-
program.parse();
|