aicli 0.2.7 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c38b286746d1ffdef26b15f61a628e2a5ef9dcc774f5fc7b3b925d2b76df1a45
4
- data.tar.gz: 2c0a48abc6fbe2f279ca644d69f3de61e4df895d9950b209268996f4f66fc7b5
3
+ metadata.gz: f0ecf3b2378a31b6986dd9758fa346b3bd1aeef95547e60f57a16ae990358c3b
4
+ data.tar.gz: baaf14692eaba18db2ecf54dd77912f5d138153d4698500e519b62496f1455bb
5
5
  SHA512:
6
- metadata.gz: dc70046850d2544dd0f3c4c4af1827bc40c1fe04a5b24e88b36e873115f7f9adcc1e89c5565e79f9d6205bd65effb3ad3e0365a003cfcac99566f58d5395b50a
7
- data.tar.gz: 274a2632ce615915704e9aec158a82fcddbdc2ee589a3d2fbb194a39fc053f376e10f5cbed4375c019ce784461b534d9d357c735a4cd2b856a8ae78485ce5ff0
6
+ metadata.gz: 49266f502dca2be1094fcaa23cf084b8863e2cecfcfe1e45c281b0e1935c86f0ed597ecfe461deee228a7c97036a5d141ec0505bfa245249f987908318b98779
7
+ data.tar.gz: fc2e6d276064e9ac15a4cb44e708556a21cb1a6d02f4ac8be6d14fa81b29d81b0d6b45ba5dddac10d51f9a8e0708612c0c975ba45893d6228331b6068ac3090b
data/README.md CHANGED
@@ -1,29 +1,16 @@
1
- <h2 align="center">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fb5b9997cec2c4fffb3e5c5e9bb4fed7d">
4
- <img width="300" alt="aicli logo" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fb7f9d2d9911a4199a9d26f8ba210b3f8">
5
- </picture>
6
- </h2>
7
-
8
- <h4 align="center">
9
- Natural language to live shell commands — OpenAI &amp; Anthropic.
10
- </h4>
1
+ # aicli
11
2
 
12
- <p align="center">
13
- Chat with the model and run suggested commands in your shell in one seamless flow.
14
- </p>
3
+ Natural language to live shell commands — OpenAI & Anthropic.
15
4
 
16
- <br>
5
+ Chat with the model and run suggested commands in your shell in one seamless flow.
17
6
 
18
- # aicli
19
-
20
- CLI by [Antonio Molinari](https://github.com/magnum). Converts prompts into shell commands, with optional chat mode that can execute them live.
7
+ The gem is named **aicli**; the shell command is **`ai`** (also available as `aicli`).
21
8
 
22
9
  ## Setup
23
10
 
24
11
  > Requires Ruby 3.0+
25
12
 
26
- 1. Install _aicli_:
13
+ 1. Install the gem:
27
14
 
28
15
  ```sh
29
16
  gem install aicli
@@ -43,18 +30,18 @@ CLI by [Antonio Molinari](https://github.com/magnum). Converts prompts into shel
43
30
  **OpenAI** (default) — key from [OpenAI](https://platform.openai.com/account/api-keys):
44
31
 
45
32
  ```sh
46
- aicli config set PROVIDER=openai
47
- aicli config set OPENAI_KEY=<your token>
33
+ ai config set PROVIDER=openai
34
+ ai config set OPENAI_KEY=<your token>
48
35
  ```
49
36
 
50
37
  **Anthropic** — key from [Anthropic](https://console.anthropic.com/settings/keys):
51
38
 
52
39
  ```sh
53
- aicli config set PROVIDER=anthropic
54
- aicli config set ANTHROPIC_KEY=<your token>
40
+ ai config set PROVIDER=anthropic
41
+ ai config set ANTHROPIC_KEY=<your token>
55
42
  ```
56
43
 
57
- Or use the interactive UI (`aicli config`) to pick provider, key, and model.
44
+ Or use the interactive UI (`ai config`) to pick provider, key, and model.
58
45
  Model lists come from the [RubyLLM](https://rubyllm.com/models/) registry.
59
46
 
60
47
  Config lives in `~/.aicli/config`. Chat/prompt history is stored in `~/.aicli/context` (last 40 messages) and reloaded on the next run.
@@ -62,31 +49,29 @@ CLI by [Antonio Molinari](https://github.com/magnum). Converts prompts into shel
62
49
  ## Usage
63
50
 
64
51
  ```bash
65
- aicli <prompt>
52
+ ai <prompt>
66
53
  ```
67
54
 
68
55
  For example:
69
56
 
70
57
  ```bash
71
- aicli list all log files
58
+ ai list all log files
72
59
  ```
73
60
 
74
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.
75
62
 
76
- The short alias `ai` is also available.
77
-
78
63
  ### Special characters
79
64
 
80
65
  Some shells handle characters like `?` or `*` specially. Wrap the prompt in quotes if needed:
81
66
 
82
67
  ```bash
83
- aicli 'what is my ip address'
68
+ ai 'what is my ip address'
84
69
  ```
85
70
 
86
71
  ### Chat mode
87
72
 
88
73
  ```bash
89
- aicli chat
74
+ ai chat
90
75
  ```
91
76
 
92
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.
@@ -94,20 +79,20 @@ Ask for shell commands in a multi-turn conversation. When the assistant suggests
94
79
  ### Silent mode (skip explanations)
95
80
 
96
81
  ```bash
97
- aicli -s list all log files
82
+ ai -s list all log files
98
83
  ```
99
84
 
100
85
  Or save the preference:
101
86
 
102
87
  ```bash
103
- aicli config set SILENT_MODE=true
88
+ ai config set SILENT_MODE=true
104
89
  ```
105
90
 
106
91
  ### Provider and model
107
92
 
108
93
  ```sh
109
- aicli config set PROVIDER=openai # or anthropic
110
- aicli config set MODEL=gpt-4o-mini # provider-specific model id
94
+ ai config set PROVIDER=openai # or anthropic
95
+ ai config set MODEL=gpt-4o-mini # provider-specific model id
111
96
  ```
112
97
 
113
98
  Defaults: `gpt-4o-mini` (OpenAI), `claude-sonnet-4-6` (Anthropic).
@@ -119,7 +104,7 @@ LLM calls go through [RubyLLM](https://rubyllm.com/), so chat streaming and mode
119
104
  Useful for OpenAI-compatible proxies (ignored for Anthropic):
120
105
 
121
106
  ```sh
122
- aicli config set OPENAI_API_ENDPOINT=<your proxy endpoint>
107
+ ai config set OPENAI_API_ENDPOINT=<your proxy endpoint>
123
108
  ```
124
109
 
125
110
  Default: `https://api.openai.com/v1`
@@ -146,26 +131,21 @@ Default: `https://api.openai.com/v1`
146
131
  | Italian | it |
147
132
 
148
133
  ```sh
149
- aicli config set LANGUAGE=zh-Hans
134
+ ai config set LANGUAGE=zh-Hans
150
135
  ```
151
136
 
152
137
  ### Config UI
153
138
 
154
139
  ```bash
155
- aicli config
140
+ ai config
156
141
  ```
157
142
 
158
143
  ### Upgrading
159
144
 
160
145
  ```bash
161
- aicli --version
162
- gem update aicli
163
- ```
164
-
165
- Or:
166
-
167
- ```bash
168
- aicli update
146
+ ai --version
147
+ ai update
148
+ # or: gem update aicli
169
149
  ```
170
150
 
171
151
  ## Development
@@ -181,7 +161,7 @@ bundle exec bin/ai chat
181
161
  bundle exec bin/ai list all log files
182
162
  ```
183
163
 
184
- `bin/aicli` is equivalent to `bin/ai`. `bundle exec` loads dependencies from the Gemfile and code from `lib/`.
164
+ `bundle exec` loads dependencies from the Gemfile and code from `lib/`. `bin/aicli` is an alias of `bin/ai`.
185
165
 
186
166
  Example config for local testing:
187
167
 
@@ -203,4 +183,4 @@ I am not a bash wizard, and am dying for access to the copilot CLI, and got impa
203
183
 
204
184
  ## Credit
205
185
 
206
- - [Antonio Molinari](https://github.com/magnum)
186
+ Started from [BuilderIO/ai-shell](https://github.com/BuilderIO/ai-shell) (MIT; copyright Builder.io 2023).
data/lib/aicli/cli.rb CHANGED
@@ -80,7 +80,7 @@ module AiCli
80
80
  Commands::Chat.run
81
81
  end
82
82
 
83
- desc 'update', 'Update aicli to the latest version'
83
+ desc 'update', 'Update the aicli gem to the latest version'
84
84
  def update
85
85
  init_i18n
86
86
  Commands::Update.run
@@ -51,7 +51,7 @@ module AiCli
51
51
  user_prompt,
52
52
  writer: lambda { |chunk|
53
53
  unless started
54
- spinner.success(pastel.green('aicli:'))
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('aicli:'))
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 `aicli chat`.
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 aicli, a terminal assistant. The user is asking for shell commands.
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}
@@ -3,7 +3,7 @@
3
3
  module AiCli
4
4
  module Helpers
5
5
  module Constants
6
- COMMAND_NAME = 'aicli'
6
+ COMMAND_NAME = 'ai'
7
7
  PROJECT_NAME = 'aicli'
8
8
  REPO_URL = 'https://github.com/magnum/aicli'
9
9
  end
@@ -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("aicli v#{AiCli::VERSION}")}"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AiCli
4
- VERSION = '0.2.7'
4
+ VERSION = '0.2.9'
5
5
  end
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.7
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: aicli turns natural language into runnable shell commands using OpenAI
97
- or Anthropic. Chat with the model and execute suggested commands live in your shell
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: