@fmdzc/cli-ai 3.0.3 → 3.1.0
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 +15 -15
- package/README.md +183 -169
- package/dist/cli.js +13 -13
- package/dist/index.js +37 -24
- package/package.json +15 -9
- package/scripts/tag.js +120 -0
- package/scripts/uninstall.js +332 -332
- package/scripts/version.js +52 -0
package/LICENSE
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
ISC License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 fmdz387
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
-
copyright notice and this permission notice appear in all copies.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 fmdz387
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,169 +1,183 @@
|
|
|
1
|
-
# CLI AI
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@fmdzc/cli-ai)
|
|
4
|
-
[](https://opensource.org/licenses/ISC)
|
|
5
|
-
[](https://nodejs.org/)
|
|
6
|
-
|
|
7
|
-
**Natural language to shell commands.
|
|
8
|
-
|
|
9
|
-
Describe what you want in plain English. Get the right command. Review, execute, or copy.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- **
|
|
18
|
-
- **
|
|
19
|
-
- **
|
|
20
|
-
- **
|
|
21
|
-
- **
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
#
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
|
63
|
-
|
|
64
|
-
|
|
|
65
|
-
| `
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
**
|
|
70
|
-
| Key
|
|
71
|
-
|
|
72
|
-
|
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
|
81
|
-
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
|
127
|
-
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
1
|
+
# CLI AI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@fmdzc/cli-ai)
|
|
4
|
+
[](https://opensource.org/licenses/ISC)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
|
|
7
|
+
**Natural language to shell commands. Multi-provider AI support.**
|
|
8
|
+
|
|
9
|
+
Describe what you want in plain English. Get the right command. Review, execute, or copy.
|
|
10
|
+
|
|
11
|
+
Supports **Anthropic**, **OpenAI**, and **OpenRouter** providers.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **Multi-provider** - Anthropic, OpenAI, OpenRouter with any model support
|
|
18
|
+
- **Natural language** - Just describe what you want to do
|
|
19
|
+
- **Cross-platform** - Windows (PowerShell, CMD, Git Bash), macOS, Linux
|
|
20
|
+
- **Shell-aware** - Commands tailored to your detected shell
|
|
21
|
+
- **Interactive** - Execute, copy, edit, or request alternatives
|
|
22
|
+
- **Context-aware** - Remembers your conversation history for smarter suggestions
|
|
23
|
+
- **Secure** - API keys stored in system keyring, never in plain text
|
|
24
|
+
- **Risk assessment** - Color-coded safety levels for every command
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Install globally
|
|
30
|
+
npm install -g @fmdzc/cli-ai
|
|
31
|
+
|
|
32
|
+
# Run
|
|
33
|
+
s
|
|
34
|
+
# or
|
|
35
|
+
cli-ai
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
On first run, you'll be prompted for an API key. Get one from:
|
|
39
|
+
- [Anthropic](https://console.anthropic.com/settings/keys)
|
|
40
|
+
- [OpenAI](https://platform.openai.com/api-keys)
|
|
41
|
+
- [OpenRouter](https://openrouter.ai/keys)
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
Type what you want in natural language:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
> find files larger than 100MB
|
|
49
|
+
|
|
50
|
+
$ find . -size +100M -type f
|
|
51
|
+
Risk: low
|
|
52
|
+
|
|
53
|
+
[1] Execute [2] Copy [3] Edit [4] Alternatives [5] Cancel
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Slash Commands
|
|
57
|
+
|
|
58
|
+
Type `/` to access commands:
|
|
59
|
+
|
|
60
|
+
| Command | Description |
|
|
61
|
+
| --------- | ----------------------- |
|
|
62
|
+
| `/config` | Open settings panel |
|
|
63
|
+
| `/help` | Show help and shortcuts |
|
|
64
|
+
| `/clear` | Clear command history |
|
|
65
|
+
| `/exit` | Exit application |
|
|
66
|
+
|
|
67
|
+
### Keyboard Shortcuts
|
|
68
|
+
|
|
69
|
+
**Input Mode**
|
|
70
|
+
| Key | Action |
|
|
71
|
+
| -------- | ----------------------- |
|
|
72
|
+
| `/` | Open command palette |
|
|
73
|
+
| `Enter` | Submit query |
|
|
74
|
+
| `O` | Toggle output expansion |
|
|
75
|
+
| `Ctrl+D` | Exit (when empty) |
|
|
76
|
+
|
|
77
|
+
**Command Proposal**
|
|
78
|
+
| Key | Action |
|
|
79
|
+
| ------------- | ----------------- |
|
|
80
|
+
| `1` / `Enter` | Execute command |
|
|
81
|
+
| `2` | Copy to clipboard |
|
|
82
|
+
| `3` | Edit command |
|
|
83
|
+
| `4` | Show alternatives |
|
|
84
|
+
| `5` / `Esc` | Cancel |
|
|
85
|
+
| `?` | Explain command |
|
|
86
|
+
|
|
87
|
+
**Settings Panel**
|
|
88
|
+
| Key | Action |
|
|
89
|
+
| --------- | -------------- |
|
|
90
|
+
| `Tab` | Next section |
|
|
91
|
+
| `Up/Down` | Navigate items |
|
|
92
|
+
| `Enter` | Toggle/Select |
|
|
93
|
+
| `Esc` | Close |
|
|
94
|
+
|
|
95
|
+
## Settings
|
|
96
|
+
|
|
97
|
+
Access settings with `/config`:
|
|
98
|
+
|
|
99
|
+
### Provider & Model
|
|
100
|
+
|
|
101
|
+
Supported AI providers:
|
|
102
|
+
- **Anthropic** - Claude models
|
|
103
|
+
- **OpenAI** - GPT models
|
|
104
|
+
- **OpenRouter** - 100+ models from various providers
|
|
105
|
+
|
|
106
|
+
Any model from your selected provider is supported. Use the built-in presets or enter a custom model ID.
|
|
107
|
+
|
|
108
|
+
### API Keys
|
|
109
|
+
|
|
110
|
+
Manage API keys for each provider separately:
|
|
111
|
+
- View key status (✓ Configured / ✗ Not set)
|
|
112
|
+
- Add or change keys for any provider
|
|
113
|
+
- Keys are stored securely per provider
|
|
114
|
+
|
|
115
|
+
### Options
|
|
116
|
+
| Setting | Description |
|
|
117
|
+
| ------------------- | ------------------------------------------------------- |
|
|
118
|
+
| Context | Pass conversation history to AI for smarter suggestions |
|
|
119
|
+
| Show explanations | Display command explanations |
|
|
120
|
+
| Syntax highlighting | Colorize command output |
|
|
121
|
+
| Simple mode | Minimal UI mode |
|
|
122
|
+
|
|
123
|
+
## Risk Assessment
|
|
124
|
+
|
|
125
|
+
| Level | Color | Meaning |
|
|
126
|
+
| ------ | ------ | ------------------------------ |
|
|
127
|
+
| Low | Green | Safe, read-only commands |
|
|
128
|
+
| Medium | Yellow | Modifies files or system state |
|
|
129
|
+
| High | Red | Potentially destructive |
|
|
130
|
+
|
|
131
|
+
## Security
|
|
132
|
+
|
|
133
|
+
### API Key Storage
|
|
134
|
+
|
|
135
|
+
Your API keys are stored securely using industry-standard methods. Each provider's key is stored separately.
|
|
136
|
+
|
|
137
|
+
**Primary: System Keyring**
|
|
138
|
+
|
|
139
|
+
| Platform | Storage Backend |
|
|
140
|
+
| -------- | ------------------------------------------- |
|
|
141
|
+
| macOS | Keychain |
|
|
142
|
+
| Windows | Credential Manager |
|
|
143
|
+
| Linux | Secret Service API (GNOME Keyring, KWallet) |
|
|
144
|
+
|
|
145
|
+
The system keyring provides OS-level encryption and access control. API keys are never stored in plain text or environment variables.
|
|
146
|
+
|
|
147
|
+
**Fallback: Encrypted File**
|
|
148
|
+
|
|
149
|
+
If the system keyring is unavailable, keys are stored in an encrypted file at `~/.cli_ai_assistant/`. The encryption key is derived from your machine's unique identifiers (hostname + username), making the encrypted file non-portable and machine-specific.
|
|
150
|
+
|
|
151
|
+
### Key Management
|
|
152
|
+
|
|
153
|
+
- **View**: See masked keys and storage method per provider in `/config`
|
|
154
|
+
- **Add**: Configure API keys for Anthropic, OpenAI, or OpenRouter
|
|
155
|
+
- **Change**: Update any API key anytime through settings
|
|
156
|
+
- **Status**: Green ✓ indicates configured, red ✗ indicates not set
|
|
157
|
+
|
|
158
|
+
## Requirements
|
|
159
|
+
|
|
160
|
+
- **Node.js 20+**
|
|
161
|
+
- **Build tools** for native modules:
|
|
162
|
+
|
|
163
|
+
| Platform | Command |
|
|
164
|
+
| ------------- | -------------------------------------------------- |
|
|
165
|
+
| Windows | `npm install -g windows-build-tools` (Admin) |
|
|
166
|
+
| macOS | `xcode-select --install` |
|
|
167
|
+
| Ubuntu/Debian | `sudo apt install build-essential libsecret-1-dev` |
|
|
168
|
+
| Fedora | `sudo dnf install gcc-c++ libsecret-devel` |
|
|
169
|
+
| Arch | `sudo pacman -S base-devel libsecret` |
|
|
170
|
+
|
|
171
|
+
## Development
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
git clone https://github.com/fmdz387/cli-ai.git
|
|
175
|
+
cd cli-ai
|
|
176
|
+
pnpm install
|
|
177
|
+
pnpm dev # Watch mode
|
|
178
|
+
pnpm build # Production build
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
ISC
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// Suppress experimental warnings for JSON imports from dependencies
|
|
4
|
-
const originalEmit = process.emit;
|
|
5
|
-
process.emit = function (name, data) {
|
|
6
|
-
if (name === 'warning' && data && data.name === 'ExperimentalWarning') {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
return originalEmit.apply(process, arguments);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// Import and run the main module
|
|
13
|
-
import('./index.js');
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Suppress experimental warnings for JSON imports from dependencies
|
|
4
|
+
const originalEmit = process.emit;
|
|
5
|
+
process.emit = function (name, data) {
|
|
6
|
+
if (name === 'warning' && data && data.name === 'ExperimentalWarning') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
return originalEmit.apply(process, arguments);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// Import and run the main module
|
|
13
|
+
import('./index.js');
|