cliara 0.2.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.
- cliara-0.2.0/PKG-INFO +182 -0
- cliara-0.2.0/README.md +141 -0
- cliara-0.2.0/cliara/__init__.py +18 -0
- cliara-0.2.0/cliara/agents/__init__.py +46 -0
- cliara-0.2.0/cliara/agents/commit_and_deploy.py +12 -0
- cliara-0.2.0/cliara/agents/copilot_explain.py +8 -0
- cliara-0.2.0/cliara/agents/explain.py +8 -0
- cliara-0.2.0/cliara/agents/fix.py +8 -0
- cliara-0.2.0/cliara/agents/history_search.py +8 -0
- cliara-0.2.0/cliara/agents/history_summary.py +8 -0
- cliara-0.2.0/cliara/agents/nl_to_commands.py +8 -0
- cliara-0.2.0/cliara/config.py +306 -0
- cliara-0.2.0/cliara/console.py +21 -0
- cliara-0.2.0/cliara/copilot_gate.py +729 -0
- cliara-0.2.0/cliara/cross_platform.py +1191 -0
- cliara-0.2.0/cliara/deploy_detector.py +368 -0
- cliara-0.2.0/cliara/deploy_store.py +134 -0
- cliara-0.2.0/cliara/diff_preview.py +533 -0
- cliara-0.2.0/cliara/execution_graph.py +118 -0
- cliara-0.2.0/cliara/highlighting.py +336 -0
- cliara-0.2.0/cliara/macros.py +233 -0
- cliara-0.2.0/cliara/main.py +104 -0
- cliara-0.2.0/cliara/nl_handler.py +1276 -0
- cliara-0.2.0/cliara/regression.py +263 -0
- cliara-0.2.0/cliara/safety.py +218 -0
- cliara-0.2.0/cliara/semantic_history.py +185 -0
- cliara-0.2.0/cliara/session_store.py +327 -0
- cliara-0.2.0/cliara/setup_ollama.py +338 -0
- cliara-0.2.0/cliara/shell.py +4742 -0
- cliara-0.2.0/cliara/storage/__init__.py +110 -0
- cliara-0.2.0/cliara/storage/factory.py +47 -0
- cliara-0.2.0/cliara/storage/json_backend.py +95 -0
- cliara-0.2.0/cliara/storage/postgres_backend.py +387 -0
- cliara-0.2.0/cliara/tools/__init__.py +0 -0
- cliara-0.2.0/cliara/tools/migrate.py +170 -0
- cliara-0.2.0/cliara.egg-info/PKG-INFO +182 -0
- cliara-0.2.0/cliara.egg-info/SOURCES.txt +43 -0
- cliara-0.2.0/cliara.egg-info/dependency_links.txt +1 -0
- cliara-0.2.0/cliara.egg-info/entry_points.txt +2 -0
- cliara-0.2.0/cliara.egg-info/requires.txt +20 -0
- cliara-0.2.0/cliara.egg-info/top_level.txt +2 -0
- cliara-0.2.0/pyproject.toml +67 -0
- cliara-0.2.0/setup.cfg +4 -0
- cliara-0.2.0/tests/test_basic.py +123 -0
- cliara-0.2.0/tests/test_copilot_gate.py +311 -0
cliara-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cliara
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: An AI-powered shell that understands natural language and macros
|
|
5
|
+
Author: Cliara Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/yourusername/cliara
|
|
8
|
+
Project-URL: Documentation, https://github.com/yourusername/cliara#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/yourusername/cliara
|
|
10
|
+
Project-URL: Issues, https://github.com/yourusername/cliara/issues
|
|
11
|
+
Keywords: cli,shell,ai,natural-language,macros,automation
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: System :: Shells
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: prompt-toolkit>=3.0.0
|
|
26
|
+
Requires-Dist: pygments>=2.0.0
|
|
27
|
+
Requires-Dist: thefuzz>=0.20.0
|
|
28
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
29
|
+
Requires-Dist: rich>=13.0.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
34
|
+
Provides-Extra: ai
|
|
35
|
+
Requires-Dist: openai>=1.0.0; extra == "ai"
|
|
36
|
+
Requires-Dist: anthropic>=0.8.0; extra == "ai"
|
|
37
|
+
Provides-Extra: postgres
|
|
38
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Requires-Dist: cliara[ai,postgres]; extra == "all"
|
|
41
|
+
|
|
42
|
+
# Cliara - AI-Powered Shell
|
|
43
|
+
|
|
44
|
+
An intelligent shell wrapper that understands natural language and macros.
|
|
45
|
+
|
|
46
|
+
## Quick Start
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Install
|
|
50
|
+
pip install -e .
|
|
51
|
+
|
|
52
|
+
# Setup environment
|
|
53
|
+
cp .env.example .env
|
|
54
|
+
# Edit .env and add your OPENAI_API_KEY
|
|
55
|
+
|
|
56
|
+
# Run
|
|
57
|
+
cliara
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Documentation
|
|
61
|
+
|
|
62
|
+
- **[Complete Guide](docs/README.md)** - Full documentation
|
|
63
|
+
- **[Quick Start](docs/QUICKSTART.md)** - Get started in 5 minutes
|
|
64
|
+
|
|
65
|
+
## What is Cliara?
|
|
66
|
+
|
|
67
|
+
Cliara wraps your existing shell and adds:
|
|
68
|
+
- 🗣️ Natural language commands with `?` prefix (Phase 2)
|
|
69
|
+
- 📦 Powerful macro system (create, edit, delete, run)
|
|
70
|
+
- 🔍 Semantic history search: `? find when I fixed the login` or `? what did I run to deploy`
|
|
71
|
+
- 🛡️ Safety checks for dangerous operations
|
|
72
|
+
- 💾 Save last command as macro instantly
|
|
73
|
+
- 🔄 Persistent command history with arrow-key recall across sessions
|
|
74
|
+
- ✏️ Rename macros without recreating them
|
|
75
|
+
- 📂 Proper `cd` handling (changes Cliara's own working directory)
|
|
76
|
+
- 🚀 Normal commands work unchanged
|
|
77
|
+
|
|
78
|
+
## Installation
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 1. Clone the repo
|
|
82
|
+
git clone https://github.com/yourusername/cliara.git
|
|
83
|
+
cd cliara
|
|
84
|
+
|
|
85
|
+
# 2. Install dependencies
|
|
86
|
+
pip install -e .
|
|
87
|
+
|
|
88
|
+
# 3. Setup environment
|
|
89
|
+
cp .env.example .env
|
|
90
|
+
# Edit .env and add your OPENAI_API_KEY
|
|
91
|
+
|
|
92
|
+
# 4. Run
|
|
93
|
+
cliara
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Usage
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Start Cliara
|
|
100
|
+
cliara
|
|
101
|
+
|
|
102
|
+
# Normal commands work
|
|
103
|
+
cliara:proj > ls -la
|
|
104
|
+
cliara:proj > git status
|
|
105
|
+
|
|
106
|
+
# Natural language (requires OPENAI_API_KEY)
|
|
107
|
+
cliara:proj > ? kill process on port 3000
|
|
108
|
+
|
|
109
|
+
# Create a macro
|
|
110
|
+
cliara:proj > macro add test
|
|
111
|
+
> echo Step 1
|
|
112
|
+
> echo Step 2
|
|
113
|
+
>
|
|
114
|
+
|
|
115
|
+
# Edit an existing macro
|
|
116
|
+
cliara:proj > macro edit test
|
|
117
|
+
> echo Updated Step 1
|
|
118
|
+
> echo Updated Step 2
|
|
119
|
+
>
|
|
120
|
+
|
|
121
|
+
# Run it
|
|
122
|
+
cliara:proj > test
|
|
123
|
+
|
|
124
|
+
# Rename a macro
|
|
125
|
+
cliara:proj > macro rename old-name new-name
|
|
126
|
+
|
|
127
|
+
# Save last command
|
|
128
|
+
cliara:proj > echo "hello"
|
|
129
|
+
cliara:proj > macro save last as hello
|
|
130
|
+
|
|
131
|
+
# cd works correctly (changes Cliara's own directory)
|
|
132
|
+
cliara:proj > cd src
|
|
133
|
+
cliara:src >
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Features
|
|
137
|
+
|
|
138
|
+
### Phase 1 ✅ (Complete)
|
|
139
|
+
- Shell wrapper with pass-through
|
|
140
|
+
- Interactive macro system (add, edit, delete, rename, show, run, search)
|
|
141
|
+
- Save last command as macro
|
|
142
|
+
- Persistent command history (`~/.cliara/history.txt`) with arrow-key recall
|
|
143
|
+
- Multi-tier safety checks
|
|
144
|
+
- Auto-configuration
|
|
145
|
+
|
|
146
|
+
### Phase 2 ✅ (Complete)
|
|
147
|
+
- LLM integration (OpenAI)
|
|
148
|
+
- Natural language → commands
|
|
149
|
+
- Context-aware suggestions
|
|
150
|
+
- **Semantic history search**: `? find ...` / `? when did I ...` / `? what did I run ...` — search past commands by intent (stored in `~/.cliara/semantic_history.json`)
|
|
151
|
+
|
|
152
|
+
### Storage Backends
|
|
153
|
+
- **JSON** (default) - Simple file-based storage
|
|
154
|
+
- **PostgreSQL** - Scalable database backend for millions of macros
|
|
155
|
+
- See [PostgreSQL Setup Guide](docs/POSTGRES_SETUP.md)
|
|
156
|
+
|
|
157
|
+
## Requirements
|
|
158
|
+
|
|
159
|
+
- Python 3.8+
|
|
160
|
+
- Windows, macOS, or Linux
|
|
161
|
+
|
|
162
|
+
### Windows Users
|
|
163
|
+
After installation, you may need to add Python Scripts to your PATH:
|
|
164
|
+
```
|
|
165
|
+
C:\Users\<YourName>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts
|
|
166
|
+
```
|
|
167
|
+
Or restart your computer for PATH changes to take effect.
|
|
168
|
+
|
|
169
|
+
## Version
|
|
170
|
+
|
|
171
|
+
**v0.2.0** - Phase 2 Complete
|
|
172
|
+
- ✅ Natural language support
|
|
173
|
+
- ✅ Windows compatibility fixes
|
|
174
|
+
- ✅ PostgreSQL backend support
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
**See [docs/README.md](docs/README.md) for complete documentation.**
|
cliara-0.2.0/README.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Cliara - AI-Powered Shell
|
|
2
|
+
|
|
3
|
+
An intelligent shell wrapper that understands natural language and macros.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install
|
|
9
|
+
pip install -e .
|
|
10
|
+
|
|
11
|
+
# Setup environment
|
|
12
|
+
cp .env.example .env
|
|
13
|
+
# Edit .env and add your OPENAI_API_KEY
|
|
14
|
+
|
|
15
|
+
# Run
|
|
16
|
+
cliara
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Documentation
|
|
20
|
+
|
|
21
|
+
- **[Complete Guide](docs/README.md)** - Full documentation
|
|
22
|
+
- **[Quick Start](docs/QUICKSTART.md)** - Get started in 5 minutes
|
|
23
|
+
|
|
24
|
+
## What is Cliara?
|
|
25
|
+
|
|
26
|
+
Cliara wraps your existing shell and adds:
|
|
27
|
+
- 🗣️ Natural language commands with `?` prefix (Phase 2)
|
|
28
|
+
- 📦 Powerful macro system (create, edit, delete, run)
|
|
29
|
+
- 🔍 Semantic history search: `? find when I fixed the login` or `? what did I run to deploy`
|
|
30
|
+
- 🛡️ Safety checks for dangerous operations
|
|
31
|
+
- 💾 Save last command as macro instantly
|
|
32
|
+
- 🔄 Persistent command history with arrow-key recall across sessions
|
|
33
|
+
- ✏️ Rename macros without recreating them
|
|
34
|
+
- 📂 Proper `cd` handling (changes Cliara's own working directory)
|
|
35
|
+
- 🚀 Normal commands work unchanged
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# 1. Clone the repo
|
|
41
|
+
git clone https://github.com/yourusername/cliara.git
|
|
42
|
+
cd cliara
|
|
43
|
+
|
|
44
|
+
# 2. Install dependencies
|
|
45
|
+
pip install -e .
|
|
46
|
+
|
|
47
|
+
# 3. Setup environment
|
|
48
|
+
cp .env.example .env
|
|
49
|
+
# Edit .env and add your OPENAI_API_KEY
|
|
50
|
+
|
|
51
|
+
# 4. Run
|
|
52
|
+
cliara
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Start Cliara
|
|
59
|
+
cliara
|
|
60
|
+
|
|
61
|
+
# Normal commands work
|
|
62
|
+
cliara:proj > ls -la
|
|
63
|
+
cliara:proj > git status
|
|
64
|
+
|
|
65
|
+
# Natural language (requires OPENAI_API_KEY)
|
|
66
|
+
cliara:proj > ? kill process on port 3000
|
|
67
|
+
|
|
68
|
+
# Create a macro
|
|
69
|
+
cliara:proj > macro add test
|
|
70
|
+
> echo Step 1
|
|
71
|
+
> echo Step 2
|
|
72
|
+
>
|
|
73
|
+
|
|
74
|
+
# Edit an existing macro
|
|
75
|
+
cliara:proj > macro edit test
|
|
76
|
+
> echo Updated Step 1
|
|
77
|
+
> echo Updated Step 2
|
|
78
|
+
>
|
|
79
|
+
|
|
80
|
+
# Run it
|
|
81
|
+
cliara:proj > test
|
|
82
|
+
|
|
83
|
+
# Rename a macro
|
|
84
|
+
cliara:proj > macro rename old-name new-name
|
|
85
|
+
|
|
86
|
+
# Save last command
|
|
87
|
+
cliara:proj > echo "hello"
|
|
88
|
+
cliara:proj > macro save last as hello
|
|
89
|
+
|
|
90
|
+
# cd works correctly (changes Cliara's own directory)
|
|
91
|
+
cliara:proj > cd src
|
|
92
|
+
cliara:src >
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Features
|
|
96
|
+
|
|
97
|
+
### Phase 1 ✅ (Complete)
|
|
98
|
+
- Shell wrapper with pass-through
|
|
99
|
+
- Interactive macro system (add, edit, delete, rename, show, run, search)
|
|
100
|
+
- Save last command as macro
|
|
101
|
+
- Persistent command history (`~/.cliara/history.txt`) with arrow-key recall
|
|
102
|
+
- Multi-tier safety checks
|
|
103
|
+
- Auto-configuration
|
|
104
|
+
|
|
105
|
+
### Phase 2 ✅ (Complete)
|
|
106
|
+
- LLM integration (OpenAI)
|
|
107
|
+
- Natural language → commands
|
|
108
|
+
- Context-aware suggestions
|
|
109
|
+
- **Semantic history search**: `? find ...` / `? when did I ...` / `? what did I run ...` — search past commands by intent (stored in `~/.cliara/semantic_history.json`)
|
|
110
|
+
|
|
111
|
+
### Storage Backends
|
|
112
|
+
- **JSON** (default) - Simple file-based storage
|
|
113
|
+
- **PostgreSQL** - Scalable database backend for millions of macros
|
|
114
|
+
- See [PostgreSQL Setup Guide](docs/POSTGRES_SETUP.md)
|
|
115
|
+
|
|
116
|
+
## Requirements
|
|
117
|
+
|
|
118
|
+
- Python 3.8+
|
|
119
|
+
- Windows, macOS, or Linux
|
|
120
|
+
|
|
121
|
+
### Windows Users
|
|
122
|
+
After installation, you may need to add Python Scripts to your PATH:
|
|
123
|
+
```
|
|
124
|
+
C:\Users\<YourName>\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts
|
|
125
|
+
```
|
|
126
|
+
Or restart your computer for PATH changes to take effect.
|
|
127
|
+
|
|
128
|
+
## Version
|
|
129
|
+
|
|
130
|
+
**v0.2.0** - Phase 2 Complete
|
|
131
|
+
- ✅ Natural language support
|
|
132
|
+
- ✅ Windows compatibility fixes
|
|
133
|
+
- ✅ PostgreSQL backend support
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
MIT
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
**See [docs/README.md](docs/README.md) for complete documentation.**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Cliara - An AI-powered shell that understands natural language and macros.
|
|
3
|
+
|
|
4
|
+
A shell wrapper that lets you:
|
|
5
|
+
- Run normal terminal commands (pass-through)
|
|
6
|
+
- Use natural language with ? prefix
|
|
7
|
+
- Create and run macros
|
|
8
|
+
- Save command history as macros
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
__version__ = "0.2.0"
|
|
12
|
+
__author__ = "Cliara Contributors"
|
|
13
|
+
|
|
14
|
+
from cliara.shell import CliaraShell
|
|
15
|
+
from cliara.macros import MacroManager
|
|
16
|
+
from cliara.safety import SafetyChecker
|
|
17
|
+
|
|
18
|
+
__all__ = ["CliaraShell", "MacroManager", "SafetyChecker"]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent registry: builds AGENT_REGISTRY from agent modules and prompts.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any, Dict
|
|
7
|
+
|
|
8
|
+
from cliara.agents import nl_to_commands as _nl
|
|
9
|
+
from cliara.agents import fix as _fix
|
|
10
|
+
from cliara.agents import explain as _explain
|
|
11
|
+
from cliara.agents import history_summary as _history_summary
|
|
12
|
+
from cliara.agents import history_search as _history_search
|
|
13
|
+
from cliara.agents import commit_and_deploy as _commit_deploy
|
|
14
|
+
from cliara.agents import copilot_explain as _copilot_explain
|
|
15
|
+
|
|
16
|
+
_PROMPTS_DIR = Path(__file__).resolve().parent / "prompts"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _load_prompt(name: str) -> str:
|
|
20
|
+
path = _PROMPTS_DIR / f"{name}.txt"
|
|
21
|
+
return path.read_text(encoding="utf-8").strip()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _build_registry() -> Dict[str, Dict[str, Any]]:
|
|
25
|
+
registry: Dict[str, Dict[str, Any]] = {}
|
|
26
|
+
all_agents = (
|
|
27
|
+
_nl.AGENTS
|
|
28
|
+
| _fix.AGENTS
|
|
29
|
+
| _explain.AGENTS
|
|
30
|
+
| _history_summary.AGENTS
|
|
31
|
+
| _history_search.AGENTS
|
|
32
|
+
| _commit_deploy.AGENTS
|
|
33
|
+
| _copilot_explain.AGENTS
|
|
34
|
+
)
|
|
35
|
+
for name, cfg in all_agents.items():
|
|
36
|
+
registry[name] = {
|
|
37
|
+
"system": _load_prompt(name),
|
|
38
|
+
"temperature": cfg["temperature"],
|
|
39
|
+
"max_tokens": cfg["max_tokens"],
|
|
40
|
+
}
|
|
41
|
+
return registry
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
AGENT_REGISTRY: Dict[str, Dict[str, Any]] = _build_registry()
|
|
45
|
+
|
|
46
|
+
__all__ = ["AGENT_REGISTRY"]
|