icommand-cli 0.1.0__tar.gz
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.
- icommand_cli-0.1.0/LICENSE +21 -0
- icommand_cli-0.1.0/PKG-INFO +261 -0
- icommand_cli-0.1.0/README.md +243 -0
- icommand_cli-0.1.0/icommand/__init__.py +1 -0
- icommand_cli-0.1.0/icommand/capture.py +30 -0
- icommand_cli-0.1.0/icommand/cli.py +538 -0
- icommand_cli-0.1.0/icommand/config.py +86 -0
- icommand_cli-0.1.0/icommand/db.py +584 -0
- icommand_cli-0.1.0/icommand/embeddings.py +232 -0
- icommand_cli-0.1.0/icommand/hook.sh +107 -0
- icommand_cli-0.1.0/icommand/llm.py +76 -0
- icommand_cli-0.1.0/icommand/maintenance.py +217 -0
- icommand_cli-0.1.0/icommand/search.py +517 -0
- icommand_cli-0.1.0/icommand/tui.py +893 -0
- icommand_cli-0.1.0/icommand/vector_index.py +354 -0
- icommand_cli-0.1.0/icommand_cli.egg-info/PKG-INFO +261 -0
- icommand_cli-0.1.0/icommand_cli.egg-info/SOURCES.txt +22 -0
- icommand_cli-0.1.0/icommand_cli.egg-info/dependency_links.txt +1 -0
- icommand_cli-0.1.0/icommand_cli.egg-info/entry_points.txt +2 -0
- icommand_cli-0.1.0/icommand_cli.egg-info/requires.txt +9 -0
- icommand_cli-0.1.0/icommand_cli.egg-info/top_level.txt +1 -0
- icommand_cli-0.1.0/pyproject.toml +30 -0
- icommand_cli-0.1.0/setup.cfg +4 -0
- icommand_cli-0.1.0/tests/test_uninstall.py +64 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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.
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: icommand-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: AI-powered terminal command history search
|
|
5
|
+
Requires-Python: >=3.9
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: click>=8.0
|
|
9
|
+
Requires-Dist: toml>=0.10
|
|
10
|
+
Requires-Dist: numpy>=1.24
|
|
11
|
+
Requires-Dist: onnxruntime>=1.16
|
|
12
|
+
Requires-Dist: tokenizers>=0.15
|
|
13
|
+
Requires-Dist: huggingface-hub>=0.20
|
|
14
|
+
Requires-Dist: textual>=0.50
|
|
15
|
+
Requires-Dist: pyperclip>=1.8
|
|
16
|
+
Requires-Dist: faiss-cpu>=1.7.4
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# iCommand
|
|
20
|
+
|
|
21
|
+
`iCommand` is a local-first command history search tool for people who spend a lot of time in the terminal and want better recall than shell history alone.
|
|
22
|
+
|
|
23
|
+
It captures commands from your shell, stores them locally, and lets you search them through a full-screen TUI or a quick CLI command. Literal keyword lookups are supported, and recent history can also be searched semantically using local embeddings.
|
|
24
|
+
|
|
25
|
+
## Why It Exists
|
|
26
|
+
|
|
27
|
+
Traditional shell history is fast, but it is not great at answering questions like:
|
|
28
|
+
|
|
29
|
+
- "What was that `pipx` command I ran last week?"
|
|
30
|
+
- "How did I activate that virtualenv?"
|
|
31
|
+
- "What did I use to reinstall this tool?"
|
|
32
|
+
|
|
33
|
+
`iCommand` is built to make those lookups easier without turning your history into a cloud product.
|
|
34
|
+
|
|
35
|
+
## Current Status
|
|
36
|
+
|
|
37
|
+
This project is usable today, but it is still early.
|
|
38
|
+
|
|
39
|
+
- Local embeddings are implemented with Snowflake Arctic Embed XS via ONNX.
|
|
40
|
+
- The TUI and CLI search flows are implemented.
|
|
41
|
+
- Keyword search is backed by SQLite FTS.
|
|
42
|
+
- Local storage is bounded so the app does not grow forever.
|
|
43
|
+
- `ask` / conversational search is not implemented yet.
|
|
44
|
+
- Only the `local` embedding provider is implemented right now. `openai`, `anthropic`, and `ollama` are present as future placeholders.
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- Full-screen terminal UI for browsing and searching command history
|
|
49
|
+
- CLI search for quick one-off lookups
|
|
50
|
+
- Exact and prefix keyword matching for literal shell queries
|
|
51
|
+
- Semantic search for recent history using local embeddings
|
|
52
|
+
- Shell history import for existing Bash and Zsh users
|
|
53
|
+
- Automatic local storage limits with pruning of oldest history
|
|
54
|
+
- Semantic indexing limited to a recent hot window to keep disk usage bounded
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
### Prerequisites
|
|
59
|
+
|
|
60
|
+
- Python `3.9+`
|
|
61
|
+
- `pipx`
|
|
62
|
+
- Bash or Zsh
|
|
63
|
+
- Internet access on first semantic-search use to download the ONNX embedding model from Hugging Face
|
|
64
|
+
|
|
65
|
+
### Install From GitHub
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pipx install 'git+https://github.com/carnifex-cmd/iCommand.git'
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Initialize the app and install the shell hook:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
icommand init
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Then open a new terminal, or reload your shell config.
|
|
78
|
+
|
|
79
|
+
## Quick Start
|
|
80
|
+
|
|
81
|
+
Open the TUI:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
ic
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Run a quick CLI search:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
icommand search "reinstall"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Import recent shell history:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
icommand import-history
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Inspect current settings:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
icommand config
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Uninstall the app:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
icommand uninstall
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Commands
|
|
112
|
+
|
|
113
|
+
### `icommand init`
|
|
114
|
+
|
|
115
|
+
Initializes the local database, writes a default config file, appends the shell hook to `~/.bashrc` and `~/.zshrc`, and performs an initial sync so search works immediately.
|
|
116
|
+
|
|
117
|
+
### `icommand tui`
|
|
118
|
+
|
|
119
|
+
Launches the full-screen Textual TUI.
|
|
120
|
+
|
|
121
|
+
The shell hook also defines:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
alias ic='icommand tui'
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### `icommand search "<query>"`
|
|
128
|
+
|
|
129
|
+
Runs a CLI search against your local history.
|
|
130
|
+
|
|
131
|
+
### `icommand import-history`
|
|
132
|
+
|
|
133
|
+
Imports commands from `~/.zsh_history` or `~/.bash_history`.
|
|
134
|
+
|
|
135
|
+
Useful options:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
icommand import-history --limit 5000
|
|
139
|
+
icommand import-history --file ~/.zsh_history
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### `icommand config`
|
|
143
|
+
|
|
144
|
+
Shows or updates config values.
|
|
145
|
+
|
|
146
|
+
Examples:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
icommand config
|
|
150
|
+
icommand config max_results 10
|
|
151
|
+
icommand config tui_max_results 5
|
|
152
|
+
icommand config storage_soft_limit_mb 1024
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### `icommand uninstall`
|
|
156
|
+
|
|
157
|
+
Removes local app data, shell hook lines, and attempts to uninstall the binary.
|
|
158
|
+
|
|
159
|
+
## How It Works
|
|
160
|
+
|
|
161
|
+
1. A shell hook captures commands from Bash or Zsh.
|
|
162
|
+
2. Commands are stored in a local SQLite database under `~/.icommand/history.db`.
|
|
163
|
+
3. SQLite FTS is used for keyword search.
|
|
164
|
+
4. Recent commands can also be embedded locally and indexed in FAISS for semantic search.
|
|
165
|
+
5. A storage maintenance pass keeps disk growth bounded by pruning the oldest history and limiting semantic indexing to a recent hot window.
|
|
166
|
+
|
|
167
|
+
## Configuration
|
|
168
|
+
|
|
169
|
+
Default config lives at `~/.icommand/config.toml`.
|
|
170
|
+
|
|
171
|
+
Important settings:
|
|
172
|
+
|
|
173
|
+
```toml
|
|
174
|
+
provider = "local"
|
|
175
|
+
max_results = 10
|
|
176
|
+
tui_max_results = 5
|
|
177
|
+
storage_soft_limit_mb = 1024
|
|
178
|
+
storage_hard_limit_mb = 2048
|
|
179
|
+
live_command_limit = 1000000
|
|
180
|
+
semantic_command_limit = 250000
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
What they mean:
|
|
184
|
+
|
|
185
|
+
- `provider`: embedding backend. Only `local` works today.
|
|
186
|
+
- `max_results`: maximum results returned by CLI search.
|
|
187
|
+
- `tui_max_results`: maximum visible results in the TUI.
|
|
188
|
+
- `storage_soft_limit_mb`: target cap for local app data under `~/.icommand`.
|
|
189
|
+
- `storage_hard_limit_mb`: emergency cap after which new embedding work pauses until storage is reduced.
|
|
190
|
+
- `live_command_limit`: total retained commands kept locally.
|
|
191
|
+
- `semantic_command_limit`: number of newest commands eligible for semantic indexing.
|
|
192
|
+
|
|
193
|
+
## Privacy and Local Data
|
|
194
|
+
|
|
195
|
+
By default, `iCommand` is local-first.
|
|
196
|
+
|
|
197
|
+
It stores:
|
|
198
|
+
|
|
199
|
+
- command text
|
|
200
|
+
- working directory
|
|
201
|
+
- timestamp
|
|
202
|
+
- exit code when available
|
|
203
|
+
- local embeddings for semantically indexed commands
|
|
204
|
+
- a local FAISS index and metadata
|
|
205
|
+
|
|
206
|
+
Primary storage locations:
|
|
207
|
+
|
|
208
|
+
- `~/.icommand/history.db`
|
|
209
|
+
- `~/.icommand/vectors.faiss`
|
|
210
|
+
- `~/.icommand/vectors_metadata.pkl`
|
|
211
|
+
|
|
212
|
+
The local embedding model is downloaded and cached separately by Hugging Face tooling, typically under:
|
|
213
|
+
|
|
214
|
+
- `~/.cache/huggingface/hub`
|
|
215
|
+
|
|
216
|
+
## Development
|
|
217
|
+
|
|
218
|
+
Clone the repo and install it locally with `pipx`:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
git clone https://github.com/carnifex-cmd/iCommand.git
|
|
222
|
+
cd iCommand
|
|
223
|
+
pipx install --force --editable .
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Useful local commands:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
icommand init
|
|
230
|
+
icommand config
|
|
231
|
+
ic
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
If you are working from source and want the installed binary to use your local edits, prefer the editable `pipx` install above instead of reinstalling directly from the GitHub URL.
|
|
235
|
+
|
|
236
|
+
## Contributing
|
|
237
|
+
|
|
238
|
+
Issues and pull requests are welcome.
|
|
239
|
+
|
|
240
|
+
When contributing:
|
|
241
|
+
|
|
242
|
+
- keep behavior local-first
|
|
243
|
+
- avoid unbounded disk or memory growth
|
|
244
|
+
- preserve fast literal shell lookup behavior
|
|
245
|
+
- document user-visible limitations honestly
|
|
246
|
+
|
|
247
|
+
## Roadmap
|
|
248
|
+
|
|
249
|
+
Likely next areas of work:
|
|
250
|
+
|
|
251
|
+
- better live-search freshness while the TUI stays open
|
|
252
|
+
- finishing additional embedding providers
|
|
253
|
+
- conversational command recall
|
|
254
|
+
- stronger uninstall cleanup
|
|
255
|
+
- tests and release automation
|
|
256
|
+
|
|
257
|
+
## License
|
|
258
|
+
|
|
259
|
+
Intended license: `MIT`.
|
|
260
|
+
|
|
261
|
+
If you publish this repository, add a matching `LICENSE` file so the legal terms are explicit in the repo itself.
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# iCommand
|
|
2
|
+
|
|
3
|
+
`iCommand` is a local-first command history search tool for people who spend a lot of time in the terminal and want better recall than shell history alone.
|
|
4
|
+
|
|
5
|
+
It captures commands from your shell, stores them locally, and lets you search them through a full-screen TUI or a quick CLI command. Literal keyword lookups are supported, and recent history can also be searched semantically using local embeddings.
|
|
6
|
+
|
|
7
|
+
## Why It Exists
|
|
8
|
+
|
|
9
|
+
Traditional shell history is fast, but it is not great at answering questions like:
|
|
10
|
+
|
|
11
|
+
- "What was that `pipx` command I ran last week?"
|
|
12
|
+
- "How did I activate that virtualenv?"
|
|
13
|
+
- "What did I use to reinstall this tool?"
|
|
14
|
+
|
|
15
|
+
`iCommand` is built to make those lookups easier without turning your history into a cloud product.
|
|
16
|
+
|
|
17
|
+
## Current Status
|
|
18
|
+
|
|
19
|
+
This project is usable today, but it is still early.
|
|
20
|
+
|
|
21
|
+
- Local embeddings are implemented with Snowflake Arctic Embed XS via ONNX.
|
|
22
|
+
- The TUI and CLI search flows are implemented.
|
|
23
|
+
- Keyword search is backed by SQLite FTS.
|
|
24
|
+
- Local storage is bounded so the app does not grow forever.
|
|
25
|
+
- `ask` / conversational search is not implemented yet.
|
|
26
|
+
- Only the `local` embedding provider is implemented right now. `openai`, `anthropic`, and `ollama` are present as future placeholders.
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- Full-screen terminal UI for browsing and searching command history
|
|
31
|
+
- CLI search for quick one-off lookups
|
|
32
|
+
- Exact and prefix keyword matching for literal shell queries
|
|
33
|
+
- Semantic search for recent history using local embeddings
|
|
34
|
+
- Shell history import for existing Bash and Zsh users
|
|
35
|
+
- Automatic local storage limits with pruning of oldest history
|
|
36
|
+
- Semantic indexing limited to a recent hot window to keep disk usage bounded
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
### Prerequisites
|
|
41
|
+
|
|
42
|
+
- Python `3.9+`
|
|
43
|
+
- `pipx`
|
|
44
|
+
- Bash or Zsh
|
|
45
|
+
- Internet access on first semantic-search use to download the ONNX embedding model from Hugging Face
|
|
46
|
+
|
|
47
|
+
### Install From GitHub
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pipx install 'git+https://github.com/carnifex-cmd/iCommand.git'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Initialize the app and install the shell hook:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
icommand init
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Then open a new terminal, or reload your shell config.
|
|
60
|
+
|
|
61
|
+
## Quick Start
|
|
62
|
+
|
|
63
|
+
Open the TUI:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
ic
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Run a quick CLI search:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
icommand search "reinstall"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Import recent shell history:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
icommand import-history
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Inspect current settings:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
icommand config
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Uninstall the app:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
icommand uninstall
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Commands
|
|
94
|
+
|
|
95
|
+
### `icommand init`
|
|
96
|
+
|
|
97
|
+
Initializes the local database, writes a default config file, appends the shell hook to `~/.bashrc` and `~/.zshrc`, and performs an initial sync so search works immediately.
|
|
98
|
+
|
|
99
|
+
### `icommand tui`
|
|
100
|
+
|
|
101
|
+
Launches the full-screen Textual TUI.
|
|
102
|
+
|
|
103
|
+
The shell hook also defines:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
alias ic='icommand tui'
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### `icommand search "<query>"`
|
|
110
|
+
|
|
111
|
+
Runs a CLI search against your local history.
|
|
112
|
+
|
|
113
|
+
### `icommand import-history`
|
|
114
|
+
|
|
115
|
+
Imports commands from `~/.zsh_history` or `~/.bash_history`.
|
|
116
|
+
|
|
117
|
+
Useful options:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
icommand import-history --limit 5000
|
|
121
|
+
icommand import-history --file ~/.zsh_history
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### `icommand config`
|
|
125
|
+
|
|
126
|
+
Shows or updates config values.
|
|
127
|
+
|
|
128
|
+
Examples:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
icommand config
|
|
132
|
+
icommand config max_results 10
|
|
133
|
+
icommand config tui_max_results 5
|
|
134
|
+
icommand config storage_soft_limit_mb 1024
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### `icommand uninstall`
|
|
138
|
+
|
|
139
|
+
Removes local app data, shell hook lines, and attempts to uninstall the binary.
|
|
140
|
+
|
|
141
|
+
## How It Works
|
|
142
|
+
|
|
143
|
+
1. A shell hook captures commands from Bash or Zsh.
|
|
144
|
+
2. Commands are stored in a local SQLite database under `~/.icommand/history.db`.
|
|
145
|
+
3. SQLite FTS is used for keyword search.
|
|
146
|
+
4. Recent commands can also be embedded locally and indexed in FAISS for semantic search.
|
|
147
|
+
5. A storage maintenance pass keeps disk growth bounded by pruning the oldest history and limiting semantic indexing to a recent hot window.
|
|
148
|
+
|
|
149
|
+
## Configuration
|
|
150
|
+
|
|
151
|
+
Default config lives at `~/.icommand/config.toml`.
|
|
152
|
+
|
|
153
|
+
Important settings:
|
|
154
|
+
|
|
155
|
+
```toml
|
|
156
|
+
provider = "local"
|
|
157
|
+
max_results = 10
|
|
158
|
+
tui_max_results = 5
|
|
159
|
+
storage_soft_limit_mb = 1024
|
|
160
|
+
storage_hard_limit_mb = 2048
|
|
161
|
+
live_command_limit = 1000000
|
|
162
|
+
semantic_command_limit = 250000
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
What they mean:
|
|
166
|
+
|
|
167
|
+
- `provider`: embedding backend. Only `local` works today.
|
|
168
|
+
- `max_results`: maximum results returned by CLI search.
|
|
169
|
+
- `tui_max_results`: maximum visible results in the TUI.
|
|
170
|
+
- `storage_soft_limit_mb`: target cap for local app data under `~/.icommand`.
|
|
171
|
+
- `storage_hard_limit_mb`: emergency cap after which new embedding work pauses until storage is reduced.
|
|
172
|
+
- `live_command_limit`: total retained commands kept locally.
|
|
173
|
+
- `semantic_command_limit`: number of newest commands eligible for semantic indexing.
|
|
174
|
+
|
|
175
|
+
## Privacy and Local Data
|
|
176
|
+
|
|
177
|
+
By default, `iCommand` is local-first.
|
|
178
|
+
|
|
179
|
+
It stores:
|
|
180
|
+
|
|
181
|
+
- command text
|
|
182
|
+
- working directory
|
|
183
|
+
- timestamp
|
|
184
|
+
- exit code when available
|
|
185
|
+
- local embeddings for semantically indexed commands
|
|
186
|
+
- a local FAISS index and metadata
|
|
187
|
+
|
|
188
|
+
Primary storage locations:
|
|
189
|
+
|
|
190
|
+
- `~/.icommand/history.db`
|
|
191
|
+
- `~/.icommand/vectors.faiss`
|
|
192
|
+
- `~/.icommand/vectors_metadata.pkl`
|
|
193
|
+
|
|
194
|
+
The local embedding model is downloaded and cached separately by Hugging Face tooling, typically under:
|
|
195
|
+
|
|
196
|
+
- `~/.cache/huggingface/hub`
|
|
197
|
+
|
|
198
|
+
## Development
|
|
199
|
+
|
|
200
|
+
Clone the repo and install it locally with `pipx`:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
git clone https://github.com/carnifex-cmd/iCommand.git
|
|
204
|
+
cd iCommand
|
|
205
|
+
pipx install --force --editable .
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Useful local commands:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
icommand init
|
|
212
|
+
icommand config
|
|
213
|
+
ic
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
If you are working from source and want the installed binary to use your local edits, prefer the editable `pipx` install above instead of reinstalling directly from the GitHub URL.
|
|
217
|
+
|
|
218
|
+
## Contributing
|
|
219
|
+
|
|
220
|
+
Issues and pull requests are welcome.
|
|
221
|
+
|
|
222
|
+
When contributing:
|
|
223
|
+
|
|
224
|
+
- keep behavior local-first
|
|
225
|
+
- avoid unbounded disk or memory growth
|
|
226
|
+
- preserve fast literal shell lookup behavior
|
|
227
|
+
- document user-visible limitations honestly
|
|
228
|
+
|
|
229
|
+
## Roadmap
|
|
230
|
+
|
|
231
|
+
Likely next areas of work:
|
|
232
|
+
|
|
233
|
+
- better live-search freshness while the TUI stays open
|
|
234
|
+
- finishing additional embedding providers
|
|
235
|
+
- conversational command recall
|
|
236
|
+
- stronger uninstall cleanup
|
|
237
|
+
- tests and release automation
|
|
238
|
+
|
|
239
|
+
## License
|
|
240
|
+
|
|
241
|
+
Intended license: `MIT`.
|
|
242
|
+
|
|
243
|
+
If you publish this repository, add a matching `LICENSE` file so the legal terms are explicit in the repo itself.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# icommand — AI-powered terminal command history search
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Command capture for icommand.
|
|
2
|
+
|
|
3
|
+
Thin wrapper around db.insert_command() for use by the shell hook.
|
|
4
|
+
Can be invoked directly: python -m icommand.capture <command> <directory>
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import sys
|
|
8
|
+
from typing import Optional
|
|
9
|
+
|
|
10
|
+
from icommand.db import init_db, insert_command
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def capture_command(command: str, directory: str, exit_code: Optional[int] = None) -> None:
|
|
14
|
+
"""Capture a single command and store it in the database.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
command: The shell command that was executed.
|
|
18
|
+
directory: The working directory when the command was run.
|
|
19
|
+
exit_code: The exit code of the command (optional).
|
|
20
|
+
"""
|
|
21
|
+
init_db()
|
|
22
|
+
insert_command(command, directory, exit_code)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if __name__ == "__main__":
|
|
26
|
+
if len(sys.argv) != 3:
|
|
27
|
+
print("Usage: python -m icommand.capture <command> <directory>", file=sys.stderr)
|
|
28
|
+
sys.exit(1)
|
|
29
|
+
|
|
30
|
+
capture_command(sys.argv[1], sys.argv[2])
|