argo-shell-assistant 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.
Files changed (35) hide show
  1. argo_shell_assistant-0.1.0/.gitignore +37 -0
  2. argo_shell_assistant-0.1.0/LICENSE +21 -0
  3. argo_shell_assistant-0.1.0/PKG-INFO +197 -0
  4. argo_shell_assistant-0.1.0/README.md +167 -0
  5. argo_shell_assistant-0.1.0/install.sh +31 -0
  6. argo_shell_assistant-0.1.0/pyproject.toml +48 -0
  7. argo_shell_assistant-0.1.0/requirements.txt +10 -0
  8. argo_shell_assistant-0.1.0/run.sh +4 -0
  9. argo_shell_assistant-0.1.0/src/argo/__init__.py +3 -0
  10. argo_shell_assistant-0.1.0/src/argo/actions.py +323 -0
  11. argo_shell_assistant-0.1.0/src/argo/cli.py +315 -0
  12. argo_shell_assistant-0.1.0/src/argo/commands/__init__.py +1 -0
  13. argo_shell_assistant-0.1.0/src/argo/commands/check_cmd.py +158 -0
  14. argo_shell_assistant-0.1.0/src/argo/commands/config_cmd.py +83 -0
  15. argo_shell_assistant-0.1.0/src/argo/commands/learn_cmd.py +170 -0
  16. argo_shell_assistant-0.1.0/src/argo/commands/risk_cmd.py +139 -0
  17. argo_shell_assistant-0.1.0/src/argo/config/__init__.py +35 -0
  18. argo_shell_assistant-0.1.0/src/argo/config/loader.py +127 -0
  19. argo_shell_assistant-0.1.0/src/argo/config/paths.py +30 -0
  20. argo_shell_assistant-0.1.0/src/argo/i18n.py +221 -0
  21. argo_shell_assistant-0.1.0/src/argo/knowledge/__init__.py +29 -0
  22. argo_shell_assistant-0.1.0/src/argo/knowledge/history.py +45 -0
  23. argo_shell_assistant-0.1.0/src/argo/knowledge/store.py +131 -0
  24. argo_shell_assistant-0.1.0/src/argo/llm/__init__.py +5 -0
  25. argo_shell_assistant-0.1.0/src/argo/llm/ollama_client.py +209 -0
  26. argo_shell_assistant-0.1.0/src/argo/llm/remote_client.py +163 -0
  27. argo_shell_assistant-0.1.0/src/argo/llm/router.py +94 -0
  28. argo_shell_assistant-0.1.0/src/argo/output.py +57 -0
  29. argo_shell_assistant-0.1.0/src/argo/parser.py +88 -0
  30. argo_shell_assistant-0.1.0/src/argo/risk/__init__.py +7 -0
  31. argo_shell_assistant-0.1.0/src/argo/risk/classifier.py +191 -0
  32. argo_shell_assistant-0.1.0/src/argo/risk/llm_eval.py +54 -0
  33. argo_shell_assistant-0.1.0/src/argo/risk/rules.py +95 -0
  34. argo_shell_assistant-0.1.0/src/argo/ui/__init__.py +5 -0
  35. argo_shell_assistant-0.1.0/src/argo/ui/selector.py +166 -0
@@ -0,0 +1,37 @@
1
+ hidden/*
2
+
3
+ # PyPI token (never commit)
4
+ .pypirc
5
+
6
+ # Python
7
+ __pycache__/
8
+ *.py[cod]
9
+ *.pyo
10
+ *.egg-info/
11
+ *.egg
12
+ dist/
13
+ build/
14
+ .eggs/
15
+
16
+ # Virtual environment
17
+ .venv/
18
+ venv/
19
+ env/
20
+
21
+ # IDE / editor
22
+ .idea/
23
+ .vscode/
24
+ *.swp
25
+ *.swo
26
+
27
+ # Testing / coverage
28
+ .pytest_cache/
29
+ .coverage
30
+ htmlcov/
31
+
32
+ # Local config (se dentro il progetto)
33
+ config.json
34
+ knowledge.json
35
+ history.json
36
+ perf.json
37
+ risk-rules.json
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Argo contributors
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,197 @@
1
+ Metadata-Version: 2.4
2
+ Name: argo-shell-assistant
3
+ Version: 0.1.0
4
+ Summary: Natural language assistant for the Linux shell
5
+ Project-URL: Homepage, https://gitlab.com/gianfrasoft/argo
6
+ Project-URL: Documentation, https://gitlab.com/gianfrasoft/argo/-/blob/main/README.md
7
+ Project-URL: Repository, https://gitlab.com/gianfrasoft/argo
8
+ Project-URL: Issues, https://gitlab.com/gianfrasoft/argo/-/issues
9
+ Author: Argo contributors
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: cli,llm,natural-language,ollama,openai,shell
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Operating System :: Microsoft :: Windows
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Classifier: Topic :: System :: Shells
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: ollama>=0.3.0
27
+ Requires-Dist: openai>=1.0.0
28
+ Requires-Dist: prompt-toolkit>=3.0.0
29
+ Description-Content-Type: text/markdown
30
+
31
+ # Argo
32
+
33
+ Terminal assistant that translates natural language requests into Linux commands.
34
+
35
+ ## What it is
36
+
37
+ Argo is a CLI tool that:
38
+
39
+ - interprets natural language requests (Italian, English, etc.)
40
+ - generates appropriate shell commands via LLM (Ollama)
41
+ - classifies commands by risk level (🟢 read-only, 🟡 write, 🔴 destructive)
42
+ - allows preview, edit, explain and execution time estimation before running
43
+ - learns from your choices and improves suggestions over time
44
+
45
+ ## Installation
46
+
47
+ ```bash
48
+ # Quick install script
49
+ ./install.sh
50
+ # or without sudo (installs to ~/.local)
51
+ ./install.sh --user
52
+
53
+ # Manual
54
+ pip install -e .
55
+ # or run from source without installing
56
+ ./run.sh --version
57
+ ```
58
+
59
+ ## Requirements
60
+
61
+ - Python 3.10+
62
+ - [Ollama](https://ollama.com) running
63
+ - `ollama serve` — start the server
64
+ - `ollama pull llama3.2` — download a model
65
+
66
+ ## Basic usage
67
+
68
+ ```bash
69
+ # Interactive mode (REPL)
70
+ argo
71
+
72
+ # Single query
73
+ argo find files larger than 1gb
74
+ argo find files modified today
75
+ argo search for "error" in logs
76
+ ```
77
+
78
+ After generation you'll see a list of commands: use arrow keys to select, **Enter** to run. Keys: **p** preview, **e** edit, **t** estimate, **x** explain, **q** exit.
79
+
80
+ ## Examples
81
+
82
+ ### Single commands
83
+
84
+ ```bash
85
+ # Preview (what the command would do)
86
+ argo preview "rm *.log"
87
+
88
+ # Step-by-step explanation
89
+ argo explain "grep -r error logs/"
90
+
91
+ # Execution time estimate
92
+ argo estimate ls -la
93
+ argo estimate find . -name "*.log"
94
+ ```
95
+
96
+ ### Learning and memory
97
+
98
+ ```bash
99
+ # Save a preferred command
100
+ argo learn grep -r error logs/
101
+
102
+ # List learned commands
103
+ argo memory
104
+
105
+ # Remove one
106
+ argo forget 1
107
+
108
+ # Optimize knowledge (deduplicate, learn from history)
109
+ argo optimize
110
+ argo optimize --dry-run
111
+ ```
112
+
113
+ ### Configuration
114
+
115
+ ```bash
116
+ argo config set llm.model llama3.2
117
+ argo config set language.output it
118
+ argo config get language.output
119
+ argo config list
120
+
121
+ # Verify environment
122
+ argo check
123
+ argo check --fix # create missing config files
124
+ ```
125
+
126
+ ### Custom risk rules
127
+
128
+ ```bash
129
+ argo risk add command mytool danger
130
+ argo risk add pattern "curl.*\|.*sh" critical
131
+ argo risk protect /etc
132
+ argo risk list
133
+ argo risk remove command mytool
134
+ ```
135
+
136
+ ### Auto-execute
137
+
138
+ ```bash
139
+ argo -y find .log files # auto if read-only
140
+ argo -y2 copy files to backup/ # auto if read-only or write
141
+ argo -y3 any command # use with caution!
142
+ ```
143
+
144
+ ### Session options
145
+
146
+ ```bash
147
+ argo --lang it # session in Italian
148
+ argo --auto # same as -y for REPL
149
+ argo --no-color # disable colors
150
+ ```
151
+
152
+ ## Remote LLM (OpenAI, OpenRouter, etc.)
153
+
154
+ Argo can use remote APIs instead of local Ollama. API keys are read from environment variables (never stored in config).
155
+
156
+ **OpenAI / compatible APIs:**
157
+
158
+ ```bash
159
+ # Set your API key (never commit this!)
160
+ export OPENAI_API_KEY="sk-..."
161
+
162
+ # Enable remote in config
163
+ argo config set llm.remote.enabled true
164
+ argo config set llm.remote.model gpt-4
165
+ ```
166
+
167
+ **OpenRouter** (access to many models with one key):
168
+
169
+ ```bash
170
+ export OPENAI_API_KEY="sk-or-..."
171
+ argo config set llm.remote.enabled true
172
+ argo config set llm.remote.base_url "https://openrouter.ai/api/v1"
173
+ argo config set llm.remote.model "anthropic/claude-3-haiku"
174
+ ```
175
+
176
+ **Custom env var name:**
177
+
178
+ ```bash
179
+ export MY_API_KEY="sk-..."
180
+ argo config set llm.remote.api_key_env MY_API_KEY
181
+ ```
182
+
183
+ If remote fails or the `openai` package is missing, Argo falls back to local Ollama.
184
+
185
+ ## Configuration
186
+
187
+ Files in `~/.config/argo/`:
188
+
189
+ - `config.json` — LLM, language, colors
190
+ - `knowledge.json` — learned commands
191
+ - `history.json` — choice history
192
+ - `risk-rules.json` — custom risk rules
193
+ - `perf.json` — performance estimate cache
194
+
195
+ ## License
196
+
197
+ MIT — see [LICENSE](LICENSE)
@@ -0,0 +1,167 @@
1
+ # Argo
2
+
3
+ Terminal assistant that translates natural language requests into Linux commands.
4
+
5
+ ## What it is
6
+
7
+ Argo is a CLI tool that:
8
+
9
+ - interprets natural language requests (Italian, English, etc.)
10
+ - generates appropriate shell commands via LLM (Ollama)
11
+ - classifies commands by risk level (🟢 read-only, 🟡 write, 🔴 destructive)
12
+ - allows preview, edit, explain and execution time estimation before running
13
+ - learns from your choices and improves suggestions over time
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ # Quick install script
19
+ ./install.sh
20
+ # or without sudo (installs to ~/.local)
21
+ ./install.sh --user
22
+
23
+ # Manual
24
+ pip install -e .
25
+ # or run from source without installing
26
+ ./run.sh --version
27
+ ```
28
+
29
+ ## Requirements
30
+
31
+ - Python 3.10+
32
+ - [Ollama](https://ollama.com) running
33
+ - `ollama serve` — start the server
34
+ - `ollama pull llama3.2` — download a model
35
+
36
+ ## Basic usage
37
+
38
+ ```bash
39
+ # Interactive mode (REPL)
40
+ argo
41
+
42
+ # Single query
43
+ argo find files larger than 1gb
44
+ argo find files modified today
45
+ argo search for "error" in logs
46
+ ```
47
+
48
+ After generation you'll see a list of commands: use arrow keys to select, **Enter** to run. Keys: **p** preview, **e** edit, **t** estimate, **x** explain, **q** exit.
49
+
50
+ ## Examples
51
+
52
+ ### Single commands
53
+
54
+ ```bash
55
+ # Preview (what the command would do)
56
+ argo preview "rm *.log"
57
+
58
+ # Step-by-step explanation
59
+ argo explain "grep -r error logs/"
60
+
61
+ # Execution time estimate
62
+ argo estimate ls -la
63
+ argo estimate find . -name "*.log"
64
+ ```
65
+
66
+ ### Learning and memory
67
+
68
+ ```bash
69
+ # Save a preferred command
70
+ argo learn grep -r error logs/
71
+
72
+ # List learned commands
73
+ argo memory
74
+
75
+ # Remove one
76
+ argo forget 1
77
+
78
+ # Optimize knowledge (deduplicate, learn from history)
79
+ argo optimize
80
+ argo optimize --dry-run
81
+ ```
82
+
83
+ ### Configuration
84
+
85
+ ```bash
86
+ argo config set llm.model llama3.2
87
+ argo config set language.output it
88
+ argo config get language.output
89
+ argo config list
90
+
91
+ # Verify environment
92
+ argo check
93
+ argo check --fix # create missing config files
94
+ ```
95
+
96
+ ### Custom risk rules
97
+
98
+ ```bash
99
+ argo risk add command mytool danger
100
+ argo risk add pattern "curl.*\|.*sh" critical
101
+ argo risk protect /etc
102
+ argo risk list
103
+ argo risk remove command mytool
104
+ ```
105
+
106
+ ### Auto-execute
107
+
108
+ ```bash
109
+ argo -y find .log files # auto if read-only
110
+ argo -y2 copy files to backup/ # auto if read-only or write
111
+ argo -y3 any command # use with caution!
112
+ ```
113
+
114
+ ### Session options
115
+
116
+ ```bash
117
+ argo --lang it # session in Italian
118
+ argo --auto # same as -y for REPL
119
+ argo --no-color # disable colors
120
+ ```
121
+
122
+ ## Remote LLM (OpenAI, OpenRouter, etc.)
123
+
124
+ Argo can use remote APIs instead of local Ollama. API keys are read from environment variables (never stored in config).
125
+
126
+ **OpenAI / compatible APIs:**
127
+
128
+ ```bash
129
+ # Set your API key (never commit this!)
130
+ export OPENAI_API_KEY="sk-..."
131
+
132
+ # Enable remote in config
133
+ argo config set llm.remote.enabled true
134
+ argo config set llm.remote.model gpt-4
135
+ ```
136
+
137
+ **OpenRouter** (access to many models with one key):
138
+
139
+ ```bash
140
+ export OPENAI_API_KEY="sk-or-..."
141
+ argo config set llm.remote.enabled true
142
+ argo config set llm.remote.base_url "https://openrouter.ai/api/v1"
143
+ argo config set llm.remote.model "anthropic/claude-3-haiku"
144
+ ```
145
+
146
+ **Custom env var name:**
147
+
148
+ ```bash
149
+ export MY_API_KEY="sk-..."
150
+ argo config set llm.remote.api_key_env MY_API_KEY
151
+ ```
152
+
153
+ If remote fails or the `openai` package is missing, Argo falls back to local Ollama.
154
+
155
+ ## Configuration
156
+
157
+ Files in `~/.config/argo/`:
158
+
159
+ - `config.json` — LLM, language, colors
160
+ - `knowledge.json` — learned commands
161
+ - `history.json` — choice history
162
+ - `risk-rules.json` — custom risk rules
163
+ - `perf.json` — performance estimate cache
164
+
165
+ ## License
166
+
167
+ MIT — see [LICENSE](LICENSE)
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+ # Argo — installazione rapida
3
+ # Uso: ./install.sh [--user]
4
+ # --user installa in ~/.local (non richiede sudo)
5
+
6
+ set -e
7
+ cd "$(dirname "$0")"
8
+
9
+ OPTS=""
10
+ if [ "$1" = "--user" ]; then
11
+ OPTS="--user"
12
+ fi
13
+
14
+ echo "Installing Argo..."
15
+ python3 -m pip install $OPTS -e . 2>/dev/null || pip install $OPTS -e .
16
+
17
+ if command -v argo &>/dev/null; then
18
+ echo ""
19
+ echo "Argo installato. Prova:"
20
+ echo " argo --version"
21
+ echo " argo help"
22
+ echo " argo trova file più grandi di 1gb"
23
+ echo ""
24
+ echo "Assicurati che Ollama sia in esecuzione: ollama serve"
25
+ echo "E che un modello sia disponibile: ollama pull llama3.2"
26
+ else
27
+ echo ""
28
+ echo "Installazione completata. Se 'argo' non è nel PATH:"
29
+ echo " python3 -m argo.cli --version"
30
+ echo " oppure aggiungi ~/.local/bin al PATH"
31
+ fi
@@ -0,0 +1,48 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.26"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "argo-shell-assistant"
7
+ version = "0.1.0"
8
+ description = "Natural language assistant for the Linux shell"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ authors = [
14
+ { name = "Argo contributors" }
15
+ ]
16
+ keywords = ["cli", "shell", "llm", "natural-language", "ollama", "openai"]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Environment :: Console",
20
+ "Intended Audience :: Developers",
21
+ "License :: OSI Approved :: MIT License",
22
+ "Operating System :: POSIX :: Linux",
23
+ "Operating System :: Microsoft :: Windows",
24
+ "Operating System :: MacOS",
25
+ "Programming Language :: Python :: 3",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Topic :: System :: Shells",
30
+ ]
31
+
32
+ dependencies = [
33
+ "ollama>=0.3.0",
34
+ "openai>=1.0.0",
35
+ "prompt_toolkit>=3.0.0",
36
+ ]
37
+
38
+ [project.urls]
39
+ Homepage = "https://gitlab.com/gianfrasoft/argo"
40
+ Documentation = "https://gitlab.com/gianfrasoft/argo/-/blob/main/README.md"
41
+ Repository = "https://gitlab.com/gianfrasoft/argo"
42
+ Issues = "https://gitlab.com/gianfrasoft/argo/-/issues"
43
+
44
+ [project.scripts]
45
+ argo = "argo.cli:main"
46
+
47
+ [tool.hatch.build.targets.wheel]
48
+ packages = ["src/argo"]
@@ -0,0 +1,10 @@
1
+ # Argo CLI — dipendenze
2
+ # Python 3.10+
3
+
4
+ # Fase 1 (LLM)
5
+ ollama>=0.3.0
6
+
7
+ # Fase 3 (UI interattiva)
8
+ prompt_toolkit>=3.0.0
9
+
10
+ # Nessuna dipendenza esterna per Fase 0
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ # Esegue Argo in sviluppo senza installazione
3
+ cd "$(dirname "$0")"
4
+ PYTHONPATH=src python3 -m argo.cli "$@"
@@ -0,0 +1,3 @@
1
+ """Argo — natural language assistant for the Linux shell."""
2
+
3
+ __version__ = "0.1.0"