aicli 0.2.8 → 0.2.9
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.
- checksums.yaml +4 -4
- data/README.md +23 -28
- data/lib/aicli/cli.rb +1 -1
- data/lib/aicli/commands/chat.rb +2 -2
- data/lib/aicli/helpers/completion.rb +2 -2
- data/lib/aicli/helpers/constants.rb +1 -1
- data/lib/aicli/helpers/error.rb +1 -1
- data/lib/aicli/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f0ecf3b2378a31b6986dd9758fa346b3bd1aeef95547e60f57a16ae990358c3b
|
|
4
|
+
data.tar.gz: baaf14692eaba18db2ecf54dd77912f5d138153d4698500e519b62496f1455bb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 49266f502dca2be1094fcaa23cf084b8863e2cecfcfe1e45c281b0e1935c86f0ed597ecfe461deee228a7c97036a5d141ec0505bfa245249f987908318b98779
|
|
7
|
+
data.tar.gz: fc2e6d276064e9ac15a4cb44e708556a21cb1a6d02f4ac8be6d14fa81b29d81b0d6b45ba5dddac10d51f9a8e0708612c0c975ba45893d6228331b6068ac3090b
|
data/README.md
CHANGED
|
@@ -4,11 +4,13 @@ Natural language to live shell commands — OpenAI & Anthropic.
|
|
|
4
4
|
|
|
5
5
|
Chat with the model and run suggested commands in your shell in one seamless flow.
|
|
6
6
|
|
|
7
|
+
The gem is named **aicli**; the shell command is **`ai`** (also available as `aicli`).
|
|
8
|
+
|
|
7
9
|
## Setup
|
|
8
10
|
|
|
9
11
|
> Requires Ruby 3.0+
|
|
10
12
|
|
|
11
|
-
1. Install
|
|
13
|
+
1. Install the gem:
|
|
12
14
|
|
|
13
15
|
```sh
|
|
14
16
|
gem install aicli
|
|
@@ -28,18 +30,18 @@ Chat with the model and run suggested commands in your shell in one seamless flo
|
|
|
28
30
|
**OpenAI** (default) — key from [OpenAI](https://platform.openai.com/account/api-keys):
|
|
29
31
|
|
|
30
32
|
```sh
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
ai config set PROVIDER=openai
|
|
34
|
+
ai config set OPENAI_KEY=<your token>
|
|
33
35
|
```
|
|
34
36
|
|
|
35
37
|
**Anthropic** — key from [Anthropic](https://console.anthropic.com/settings/keys):
|
|
36
38
|
|
|
37
39
|
```sh
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
ai config set PROVIDER=anthropic
|
|
41
|
+
ai config set ANTHROPIC_KEY=<your token>
|
|
40
42
|
```
|
|
41
43
|
|
|
42
|
-
Or use the interactive UI (`
|
|
44
|
+
Or use the interactive UI (`ai config`) to pick provider, key, and model.
|
|
43
45
|
Model lists come from the [RubyLLM](https://rubyllm.com/models/) registry.
|
|
44
46
|
|
|
45
47
|
Config lives in `~/.aicli/config`. Chat/prompt history is stored in `~/.aicli/context` (last 40 messages) and reloaded on the next run.
|
|
@@ -47,31 +49,29 @@ Chat with the model and run suggested commands in your shell in one seamless flo
|
|
|
47
49
|
## Usage
|
|
48
50
|
|
|
49
51
|
```bash
|
|
50
|
-
|
|
52
|
+
ai <prompt>
|
|
51
53
|
```
|
|
52
54
|
|
|
53
55
|
For example:
|
|
54
56
|
|
|
55
57
|
```bash
|
|
56
|
-
|
|
58
|
+
ai list all log files
|
|
57
59
|
```
|
|
58
60
|
|
|
59
61
|
Then you will get an output where you can choose to run the suggested command, revise it via a prompt, edit it, copy it, or cancel.
|
|
60
62
|
|
|
61
|
-
The short alias `ai` is also available.
|
|
62
|
-
|
|
63
63
|
### Special characters
|
|
64
64
|
|
|
65
65
|
Some shells handle characters like `?` or `*` specially. Wrap the prompt in quotes if needed:
|
|
66
66
|
|
|
67
67
|
```bash
|
|
68
|
-
|
|
68
|
+
ai 'what is my ip address'
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
### Chat mode
|
|
72
72
|
|
|
73
73
|
```bash
|
|
74
|
-
|
|
74
|
+
ai chat
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
Ask for shell commands in a multi-turn conversation. When the assistant suggests a command in a code fence, you are asked whether to run it; after it runs (or you decline), chat continues. Press `Ctrl+d` to quit.
|
|
@@ -79,20 +79,20 @@ Ask for shell commands in a multi-turn conversation. When the assistant suggests
|
|
|
79
79
|
### Silent mode (skip explanations)
|
|
80
80
|
|
|
81
81
|
```bash
|
|
82
|
-
|
|
82
|
+
ai -s list all log files
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
Or save the preference:
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
|
|
88
|
+
ai config set SILENT_MODE=true
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
### Provider and model
|
|
92
92
|
|
|
93
93
|
```sh
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
ai config set PROVIDER=openai # or anthropic
|
|
95
|
+
ai config set MODEL=gpt-4o-mini # provider-specific model id
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
Defaults: `gpt-4o-mini` (OpenAI), `claude-sonnet-4-6` (Anthropic).
|
|
@@ -104,7 +104,7 @@ LLM calls go through [RubyLLM](https://rubyllm.com/), so chat streaming and mode
|
|
|
104
104
|
Useful for OpenAI-compatible proxies (ignored for Anthropic):
|
|
105
105
|
|
|
106
106
|
```sh
|
|
107
|
-
|
|
107
|
+
ai config set OPENAI_API_ENDPOINT=<your proxy endpoint>
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
Default: `https://api.openai.com/v1`
|
|
@@ -131,26 +131,21 @@ Default: `https://api.openai.com/v1`
|
|
|
131
131
|
| Italian | it |
|
|
132
132
|
|
|
133
133
|
```sh
|
|
134
|
-
|
|
134
|
+
ai config set LANGUAGE=zh-Hans
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
### Config UI
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
|
-
|
|
140
|
+
ai config
|
|
141
141
|
```
|
|
142
142
|
|
|
143
143
|
### Upgrading
|
|
144
144
|
|
|
145
145
|
```bash
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Or:
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
aicli update
|
|
146
|
+
ai --version
|
|
147
|
+
ai update
|
|
148
|
+
# or: gem update aicli
|
|
154
149
|
```
|
|
155
150
|
|
|
156
151
|
## Development
|
|
@@ -166,7 +161,7 @@ bundle exec bin/ai chat
|
|
|
166
161
|
bundle exec bin/ai list all log files
|
|
167
162
|
```
|
|
168
163
|
|
|
169
|
-
`
|
|
164
|
+
`bundle exec` loads dependencies from the Gemfile and code from `lib/`. `bin/aicli` is an alias of `bin/ai`.
|
|
170
165
|
|
|
171
166
|
Example config for local testing:
|
|
172
167
|
|
data/lib/aicli/cli.rb
CHANGED
data/lib/aicli/commands/chat.rb
CHANGED
|
@@ -51,7 +51,7 @@ module AiCli
|
|
|
51
51
|
user_prompt,
|
|
52
52
|
writer: lambda { |chunk|
|
|
53
53
|
unless started
|
|
54
|
-
spinner.success(pastel.green('
|
|
54
|
+
spinner.success(pastel.green('ai:'))
|
|
55
55
|
puts ''
|
|
56
56
|
started = true
|
|
57
57
|
end
|
|
@@ -60,7 +60,7 @@ module AiCli
|
|
|
60
60
|
)
|
|
61
61
|
|
|
62
62
|
unless started
|
|
63
|
-
spinner.success(pastel.green('
|
|
63
|
+
spinner.success(pastel.green('ai:'))
|
|
64
64
|
puts ''
|
|
65
65
|
end
|
|
66
66
|
puts ''
|
|
@@ -40,7 +40,7 @@ module AiCli
|
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
# Multi-turn chat helper used by `
|
|
43
|
+
# Multi-turn chat helper used by `ai chat`.
|
|
44
44
|
def start_chat(config)
|
|
45
45
|
chat = Llm.build_chat(config)
|
|
46
46
|
chat.with_instructions(chat_system_prompt)
|
|
@@ -49,7 +49,7 @@ module AiCli
|
|
|
49
49
|
|
|
50
50
|
def chat_system_prompt
|
|
51
51
|
<<~PROMPT
|
|
52
|
-
You are
|
|
52
|
+
You are ai, a terminal assistant. The user is asking for shell commands.
|
|
53
53
|
|
|
54
54
|
Target OS: #{OsDetect.operating_system_name}
|
|
55
55
|
Target shell: #{OsDetect.detect_shell}
|
data/lib/aicli/helpers/error.rb
CHANGED
|
@@ -19,7 +19,7 @@ module AiCli
|
|
|
19
19
|
puts pastel.dim(error.backtrace.join("\n"))
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
puts "\n#{indent}#{pastel.dim("
|
|
22
|
+
puts "\n#{indent}#{pastel.dim("ai v#{AiCli::VERSION}")}"
|
|
23
23
|
puts "\n#{indent}#{I18n.t('Please open a Bug report with the information above')}:"
|
|
24
24
|
puts "#{indent}https://github.com/magnum/aicli/issues/new"
|
|
25
25
|
end
|
data/lib/aicli/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aicli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Antonio Molinari
|
|
@@ -93,9 +93,9 @@ dependencies:
|
|
|
93
93
|
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
95
|
version: '0.9'
|
|
96
|
-
description:
|
|
97
|
-
|
|
98
|
-
in one seamless flow.
|
|
96
|
+
description: ai turns natural language into runnable shell commands using OpenAI or
|
|
97
|
+
Anthropic. Chat with the model and execute suggested commands live in your shell
|
|
98
|
+
in one seamless flow. Install the aicli gem, then run the ai command.
|
|
99
99
|
email:
|
|
100
100
|
- antoniomolinari@me.com
|
|
101
101
|
executables:
|