@fmdzc/cli-ai 3.0.2 → 3.0.4

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 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,171 @@
1
- # CLI AI
2
-
3
- [![npm version](https://img.shields.io/npm/v/@fmdzc/cli-ai)](https://www.npmjs.com/package/@fmdzc/cli-ai)
4
- [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
5
- [![Node.js](https://img.shields.io/badge/Node.js-20+-green.svg)](https://nodejs.org/)
6
-
7
- **Natural language to shell commands. Powered by Claude AI.**
8
-
9
- Describe what you want in plain English. Get the right command. Review, execute, or copy.
10
-
11
- ![CLI AI Demo](assets/cli-ai.png)
12
-
13
- ## Features
14
-
15
- - **Natural language** - Just describe what you want to do
16
- - **Cross-platform** - Windows (PowerShell, CMD, Git Bash), macOS, Linux
17
- - **Shell-aware** - Commands tailored to your detected shell
18
- - **Interactive** - Execute, copy, edit, or request alternatives
19
- - **Context-aware** - Remembers your conversation history for smarter suggestions
20
- - **Secure** - API keys stored in system keyring, never in plain text
21
- - **Risk assessment** - Color-coded safety levels for every command
22
-
23
- ## Quick Start
24
-
25
- ```bash
26
- # Install globally
27
- npm install -g @fmdzc/cli-ai
28
-
29
- # Run
30
- s
31
- ```
32
-
33
- On first run, you'll be prompted for your [Anthropic API key](https://console.anthropic.com/settings/keys).
34
-
35
- ## Usage
36
-
37
- Type what you want in natural language:
38
-
39
- ```
40
- > find files larger than 100MB
41
-
42
- $ find . -size +100M -type f
43
- Risk: low
44
-
45
- [1] Execute [2] Copy [3] Edit [4] Alternatives [5] Cancel
46
- ```
47
-
48
- ### Slash Commands
49
-
50
- Type `/` to access commands:
51
-
52
- | Command | Description |
53
- |---------|-------------|
54
- | `/config` | Open settings panel |
55
- | `/help` | Show help and shortcuts |
56
- | `/clear` | Clear command history |
57
- | `/exit` | Exit application |
58
-
59
- ### Keyboard Shortcuts
60
-
61
- **Input Mode**
62
- | Key | Action |
63
- |-----|--------|
64
- | `/` | Open command palette |
65
- | `Enter` | Submit query |
66
- | `O` | Toggle output expansion |
67
- | `Ctrl+D` | Exit (when empty) |
68
-
69
- **Command Proposal**
70
- | Key | Action |
71
- |-----|--------|
72
- | `1` / `Enter` | Execute command |
73
- | `2` | Copy to clipboard |
74
- | `3` | Edit command |
75
- | `4` | Show alternatives |
76
- | `5` / `Esc` | Cancel |
77
- | `?` | Explain command |
78
-
79
- **Settings Panel**
80
- | Key | Action |
81
- |-----|--------|
82
- | `Tab` | Next section |
83
- | `Up/Down` | Navigate items |
84
- | `Enter` | Toggle/Select |
85
- | `Esc` | Close |
86
-
87
- ## Settings
88
-
89
- Access settings with `/config`:
90
-
91
- ### API Key
92
- - View masked key and storage method
93
- - Change or remove API key
94
-
95
- ### Model Selection
96
- | Model | Description |
97
- |-------|-------------|
98
- | Claude Sonnet 4.5 | Fast and capable (default) |
99
- | Claude Opus 4.5 | Most capable |
100
- | Claude Haiku 4.5 | Fastest |
101
-
102
- ### Options
103
- | Setting | Description |
104
- |---------|-------------|
105
- | Context | Pass conversation history to AI for smarter suggestions |
106
- | Show explanations | Display command explanations |
107
- | Syntax highlighting | Colorize command output |
108
- | Simple mode | Minimal UI mode |
109
-
110
- ## Risk Assessment
111
-
112
- | Level | Color | Meaning |
113
- |-------|-------|---------|
114
- | Low | Green | Safe, read-only commands |
115
- | Medium | Yellow | Modifies files or system state |
116
- | High | Red | Potentially destructive |
117
-
118
- ## Security
119
-
120
- ### API Key Storage
121
-
122
- Your Anthropic API key is stored securely using industry-standard methods:
123
-
124
- **Primary: System Keyring**
125
-
126
- | Platform | Storage Backend |
127
- |----------|-----------------|
128
- | macOS | Keychain |
129
- | Windows | Credential Manager |
130
- | Linux | Secret Service API (GNOME Keyring, KWallet) |
131
-
132
- The system keyring provides OS-level encryption and access control. Your API key is never stored in plain text or environment variables.
133
-
134
- **Fallback: Encrypted File**
135
-
136
- If the system keyring is unavailable, the key is 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.
137
-
138
- ### Key Management
139
-
140
- - **View**: See masked key (`sk-ant-***...****`) and storage method in `/config`
141
- - **Change**: Update your API key anytime through settings
142
- - **Remove**: Delete your stored key completely
143
-
144
- ## Requirements
145
-
146
- - **Node.js 20+**
147
- - **Build tools** for native modules:
148
-
149
- | Platform | Command |
150
- |----------|---------|
151
- | Windows | `npm install -g windows-build-tools` (Admin) |
152
- | macOS | `xcode-select --install` |
153
- | Ubuntu/Debian | `sudo apt install build-essential libsecret-1-dev` |
154
- | Fedora | `sudo dnf install gcc-c++ libsecret-devel` |
155
- | Arch | `sudo pacman -S base-devel libsecret` |
156
-
157
- ## Development
158
-
159
- ```bash
160
- git clone https://github.com/fmdz387/cli-ai.git
161
- cd cli-ai
162
- pnpm install
163
- pnpm dev # Watch mode
164
- pnpm build # Production build
165
- ```
166
-
167
- ## License
168
-
169
- ISC
1
+ # CLI AI
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@fmdzc/cli-ai)](https://www.npmjs.com/package/@fmdzc/cli-ai)
4
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
5
+ [![Node.js](https://img.shields.io/badge/Node.js-20+-green.svg)](https://nodejs.org/)
6
+
7
+ **Natural language to shell commands. Powered by Claude AI.**
8
+
9
+ Describe what you want in plain English. Get the right command. Review, execute, or copy.
10
+
11
+ ![CLI AI Demo](assets/cli-ai.png)
12
+
13
+ ## Features
14
+
15
+ - **Natural language** - Just describe what you want to do
16
+ - **Cross-platform** - Windows (PowerShell, CMD, Git Bash), macOS, Linux
17
+ - **Shell-aware** - Commands tailored to your detected shell
18
+ - **Interactive** - Execute, copy, edit, or request alternatives
19
+ - **Context-aware** - Remembers your conversation history for smarter suggestions
20
+ - **Secure** - API keys stored in system keyring, never in plain text
21
+ - **Risk assessment** - Color-coded safety levels for every command
22
+
23
+ ## Quick Start
24
+
25
+ ```bash
26
+ # Install globally
27
+ npm install -g @fmdzc/cli-ai
28
+
29
+ # Run
30
+ s
31
+ # or
32
+ cli-ai
33
+ ```
34
+
35
+ On first run, you'll be prompted for your [Anthropic API key](https://console.anthropic.com/settings/keys).
36
+
37
+ ## Usage
38
+
39
+ Type what you want in natural language:
40
+
41
+ ```
42
+ > find files larger than 100MB
43
+
44
+ $ find . -size +100M -type f
45
+ Risk: low
46
+
47
+ [1] Execute [2] Copy [3] Edit [4] Alternatives [5] Cancel
48
+ ```
49
+
50
+ ### Slash Commands
51
+
52
+ Type `/` to access commands:
53
+
54
+ | Command | Description |
55
+ |---------|-------------|
56
+ | `/config` | Open settings panel |
57
+ | `/help` | Show help and shortcuts |
58
+ | `/clear` | Clear command history |
59
+ | `/exit` | Exit application |
60
+
61
+ ### Keyboard Shortcuts
62
+
63
+ **Input Mode**
64
+ | Key | Action |
65
+ |-----|--------|
66
+ | `/` | Open command palette |
67
+ | `Enter` | Submit query |
68
+ | `O` | Toggle output expansion |
69
+ | `Ctrl+D` | Exit (when empty) |
70
+
71
+ **Command Proposal**
72
+ | Key | Action |
73
+ |-----|--------|
74
+ | `1` / `Enter` | Execute command |
75
+ | `2` | Copy to clipboard |
76
+ | `3` | Edit command |
77
+ | `4` | Show alternatives |
78
+ | `5` / `Esc` | Cancel |
79
+ | `?` | Explain command |
80
+
81
+ **Settings Panel**
82
+ | Key | Action |
83
+ |-----|--------|
84
+ | `Tab` | Next section |
85
+ | `Up/Down` | Navigate items |
86
+ | `Enter` | Toggle/Select |
87
+ | `Esc` | Close |
88
+
89
+ ## Settings
90
+
91
+ Access settings with `/config`:
92
+
93
+ ### API Key
94
+ - View masked key and storage method
95
+ - Change or remove API key
96
+
97
+ ### Model Selection
98
+ | Model | Description |
99
+ |-------|-------------|
100
+ | Claude Sonnet 4.5 | Fast and capable (default) |
101
+ | Claude Opus 4.5 | Most capable |
102
+ | Claude Haiku 4.5 | Fastest |
103
+
104
+ ### Options
105
+ | Setting | Description |
106
+ |---------|-------------|
107
+ | Context | Pass conversation history to AI for smarter suggestions |
108
+ | Show explanations | Display command explanations |
109
+ | Syntax highlighting | Colorize command output |
110
+ | Simple mode | Minimal UI mode |
111
+
112
+ ## Risk Assessment
113
+
114
+ | Level | Color | Meaning |
115
+ |-------|-------|---------|
116
+ | Low | Green | Safe, read-only commands |
117
+ | Medium | Yellow | Modifies files or system state |
118
+ | High | Red | Potentially destructive |
119
+
120
+ ## Security
121
+
122
+ ### API Key Storage
123
+
124
+ Your Anthropic API key is stored securely using industry-standard methods:
125
+
126
+ **Primary: System Keyring**
127
+
128
+ | Platform | Storage Backend |
129
+ |----------|-----------------|
130
+ | macOS | Keychain |
131
+ | Windows | Credential Manager |
132
+ | Linux | Secret Service API (GNOME Keyring, KWallet) |
133
+
134
+ The system keyring provides OS-level encryption and access control. Your API key is never stored in plain text or environment variables.
135
+
136
+ **Fallback: Encrypted File**
137
+
138
+ If the system keyring is unavailable, the key is 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.
139
+
140
+ ### Key Management
141
+
142
+ - **View**: See masked key (`sk-ant-***...****`) and storage method in `/config`
143
+ - **Change**: Update your API key anytime through settings
144
+ - **Remove**: Delete your stored key completely
145
+
146
+ ## Requirements
147
+
148
+ - **Node.js 20+**
149
+ - **Build tools** for native modules:
150
+
151
+ | Platform | Command |
152
+ |----------|---------|
153
+ | Windows | `npm install -g windows-build-tools` (Admin) |
154
+ | macOS | `xcode-select --install` |
155
+ | Ubuntu/Debian | `sudo apt install build-essential libsecret-1-dev` |
156
+ | Fedora | `sudo dnf install gcc-c++ libsecret-devel` |
157
+ | Arch | `sudo pacman -S base-devel libsecret` |
158
+
159
+ ## Development
160
+
161
+ ```bash
162
+ git clone https://github.com/fmdz387/cli-ai.git
163
+ cd cli-ai
164
+ pnpm install
165
+ pnpm dev # Watch mode
166
+ pnpm build # Production build
167
+ ```
168
+
169
+ ## License
170
+
171
+ 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');