eva-cli 3.0.0__py3-none-any.whl
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.
- eva/__init__.py +3 -0
- eva/budget.py +31 -0
- eva/cache/__init__.py +17 -0
- eva/cache/cache.py +40 -0
- eva/cache.py +19 -0
- eva/chat_session.py +5 -0
- eva/cli/__init__.py +3 -0
- eva/cli/app.py +851 -0
- eva/cli.py +5 -0
- eva/config/__init__.py +33 -0
- eva/config/config.py +129 -0
- eva/config.py +35 -0
- eva/context/__init__.py +19 -0
- eva/context/finder.py +5 -0
- eva/context/gitignore.py +5 -0
- eva/context/io.py +5 -0
- eva/context/tokenizer.py +5 -0
- eva/context/tree.py +5 -0
- eva/diagnostics.py +9 -0
- eva/git_ops.py +15 -0
- eva/indexing/__init__.py +18 -0
- eva/indexing/finder.py +42 -0
- eva/indexing/io.py +35 -0
- eva/indexing/repo_index.py +240 -0
- eva/indexing/tokenizer.py +37 -0
- eva/indexing/tree.py +60 -0
- eva/plugins/__init__.py +3 -0
- eva/prompts/__init__.py +36 -0
- eva/providers/__init__.py +150 -0
- eva/providers/gemini_provider.py +72 -0
- eva/providers/groq_provider.py +37 -0
- eva/providers/llamacpp_provider.py +69 -0
- eva/providers/ollama_provider.py +70 -0
- eva/providers/openai_compat.py +57 -0
- eva/providers/opencode_zen_provider.py +53 -0
- eva/providers/openrouter_provider.py +55 -0
- eva/replay/__init__.py +11 -0
- eva/replay/player.py +91 -0
- eva/replay/recorder.py +67 -0
- eva/router/__init__.py +25 -0
- eva/router/gemini_provider.py +5 -0
- eva/router/groq_provider.py +5 -0
- eva/router/openai_compat.py +5 -0
- eva/router/opencode_zen_provider.py +5 -0
- eva/router/openrouter_provider.py +5 -0
- eva/security/__init__.py +32 -0
- eva/security/audit.py +126 -0
- eva/security/redaction.py +80 -0
- eva/security/sandbox.py +55 -0
- eva/security/work_safety.py +85 -0
- eva/shell/__init__.py +3 -0
- eva/shell/runner.py +6 -0
- eva/telemetry/__init__.py +10 -0
- eva/telemetry/diagnostics.py +43 -0
- eva/telemetry/metrics.py +68 -0
- eva/ui/formatter.py +46 -0
- eva/ui/streaming.py +21 -0
- eva/work_safety.py +21 -0
- eva/workflows/__init__.py +39 -0
- eva/workflows/budget.py +139 -0
- eva/workflows/builtins/dependency_audit.yaml +12 -0
- eva/workflows/builtins/repo_health.yaml +16 -0
- eva/workflows/builtins/security_scan.yaml +12 -0
- eva/workflows/chat_session.py +54 -0
- eva/workflows/engine.py +267 -0
- eva/workspace/__init__.py +39 -0
- eva/workspace/git_ops.py +202 -0
- eva/workspace/gitignore.py +47 -0
- eva/workspace/session.py +184 -0
- eva_cli-3.0.0.dist-info/METADATA +344 -0
- eva_cli-3.0.0.dist-info/RECORD +74 -0
- eva_cli-3.0.0.dist-info/WHEEL +4 -0
- eva_cli-3.0.0.dist-info/entry_points.txt +2 -0
- eva_cli-3.0.0.dist-info/licenses/LICENSE +21 -0
eva/workspace/session.py
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import logging
|
|
3
|
+
import re
|
|
4
|
+
from dataclasses import dataclass, field
|
|
5
|
+
from datetime import datetime, timezone
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from eva.config import get_config_dir
|
|
10
|
+
|
|
11
|
+
logger = logging.getLogger(__name__)
|
|
12
|
+
|
|
13
|
+
from eva.security.redaction import redact_secrets
|
|
14
|
+
|
|
15
|
+
__all_redact__ = ["redact_secrets"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class WorkspaceSession:
|
|
20
|
+
name: str
|
|
21
|
+
created_at: str = field(default_factory=lambda: datetime.now(timezone.utc).isoformat())
|
|
22
|
+
notes: list[str] = field(default_factory=list)
|
|
23
|
+
bookmarks: list[str] = field(default_factory=list)
|
|
24
|
+
history: list[dict[str, Any]] = field(default_factory=list)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_workspaces_root() -> Path:
|
|
28
|
+
d = get_config_dir() / "workspaces"
|
|
29
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
30
|
+
return d
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def get_active_workspace_file() -> Path:
|
|
34
|
+
return get_config_dir() / "active_workspace"
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def get_active_workspace() -> str:
|
|
38
|
+
f = get_active_workspace_file()
|
|
39
|
+
if f.exists():
|
|
40
|
+
try:
|
|
41
|
+
name = f.read_text(encoding="utf-8").strip()
|
|
42
|
+
if name:
|
|
43
|
+
return name
|
|
44
|
+
except OSError as exc:
|
|
45
|
+
logger.debug("Failed to read active workspace marker: %s", exc)
|
|
46
|
+
return "default"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def set_active_workspace(name: str):
|
|
50
|
+
safe_name = sanitize_workspace_name(name)
|
|
51
|
+
# Ensure workspace exists
|
|
52
|
+
get_workspace(safe_name)
|
|
53
|
+
f = get_active_workspace_file()
|
|
54
|
+
f.write_text(safe_name, encoding="utf-8")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def sanitize_workspace_name(name: str) -> str:
|
|
58
|
+
cleaned = re.sub(r"[^A-Za-z0-9_.-]+", "_", name.strip()).strip("._")
|
|
59
|
+
return cleaned or "default"
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def get_workspace_dir(name: str) -> Path:
|
|
63
|
+
safe_name = sanitize_workspace_name(name)
|
|
64
|
+
d = get_workspaces_root() / safe_name
|
|
65
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
66
|
+
return d
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def create_workspace(name: str) -> WorkspaceSession:
|
|
70
|
+
safe_name = sanitize_workspace_name(name)
|
|
71
|
+
wdir = get_workspace_dir(safe_name)
|
|
72
|
+
|
|
73
|
+
meta_file = wdir / "meta.json"
|
|
74
|
+
if not meta_file.exists():
|
|
75
|
+
ws = WorkspaceSession(name=safe_name)
|
|
76
|
+
meta_file.write_text(json.dumps({"name": ws.name, "created_at": ws.created_at}, indent=2), encoding="utf-8")
|
|
77
|
+
else:
|
|
78
|
+
ws = get_workspace(safe_name)
|
|
79
|
+
|
|
80
|
+
return ws
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def get_workspace(name: str) -> WorkspaceSession:
|
|
84
|
+
safe_name = sanitize_workspace_name(name)
|
|
85
|
+
wdir = get_workspace_dir(safe_name)
|
|
86
|
+
|
|
87
|
+
meta_file = wdir / "meta.json"
|
|
88
|
+
created_at = datetime.now(timezone.utc).isoformat()
|
|
89
|
+
if meta_file.exists():
|
|
90
|
+
try:
|
|
91
|
+
meta = json.loads(meta_file.read_text(encoding="utf-8"))
|
|
92
|
+
created_at = meta.get("created_at", created_at)
|
|
93
|
+
except (OSError, ValueError) as exc:
|
|
94
|
+
logger.debug("Failed to read workspace metadata %s: %s", meta_file, exc)
|
|
95
|
+
else:
|
|
96
|
+
meta_file.write_text(json.dumps({"name": safe_name, "created_at": created_at}, indent=2), encoding="utf-8")
|
|
97
|
+
|
|
98
|
+
# Load notes
|
|
99
|
+
notes = []
|
|
100
|
+
notes_file = wdir / "notes.md"
|
|
101
|
+
if notes_file.exists():
|
|
102
|
+
content = notes_file.read_text(encoding="utf-8", errors="replace")
|
|
103
|
+
notes = [n.strip() for n in content.split("\n--- Note ---\n") if n.strip()]
|
|
104
|
+
|
|
105
|
+
# Load bookmarks
|
|
106
|
+
bookmarks = []
|
|
107
|
+
bm_file = wdir / "bookmarks.json"
|
|
108
|
+
if bm_file.exists():
|
|
109
|
+
try:
|
|
110
|
+
bookmarks = json.loads(bm_file.read_text(encoding="utf-8"))
|
|
111
|
+
except (OSError, ValueError) as exc:
|
|
112
|
+
logger.debug("Failed to read bookmarks %s: %s", bm_file, exc)
|
|
113
|
+
|
|
114
|
+
# Load history
|
|
115
|
+
history = []
|
|
116
|
+
hist_file = wdir / "history.jsonl"
|
|
117
|
+
if hist_file.exists():
|
|
118
|
+
try:
|
|
119
|
+
with open(hist_file, "r", encoding="utf-8") as f:
|
|
120
|
+
for line in f:
|
|
121
|
+
if line.strip():
|
|
122
|
+
history.append(json.loads(line))
|
|
123
|
+
except (OSError, ValueError) as exc:
|
|
124
|
+
logger.debug("Failed to read workspace history %s: %s", hist_file, exc)
|
|
125
|
+
|
|
126
|
+
return WorkspaceSession(
|
|
127
|
+
name=safe_name,
|
|
128
|
+
created_at=created_at,
|
|
129
|
+
notes=notes,
|
|
130
|
+
bookmarks=bookmarks,
|
|
131
|
+
history=history,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def list_workspaces() -> list[str]:
|
|
136
|
+
root = get_workspaces_root()
|
|
137
|
+
names = []
|
|
138
|
+
for p in root.iterdir():
|
|
139
|
+
if p.is_dir() and (p / "meta.json").exists():
|
|
140
|
+
names.append(p.name)
|
|
141
|
+
if not names:
|
|
142
|
+
create_workspace("default")
|
|
143
|
+
return ["default"]
|
|
144
|
+
return sorted(names)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def add_note(name: str, note_text: str):
|
|
148
|
+
wdir = get_workspace_dir(name)
|
|
149
|
+
redacted_note = redact_secrets(note_text)
|
|
150
|
+
notes_file = wdir / "notes.md"
|
|
151
|
+
|
|
152
|
+
entry = f"\n--- Note ---\n{redacted_note.strip()}\n"
|
|
153
|
+
with open(notes_file, "a", encoding="utf-8") as f:
|
|
154
|
+
f.write(entry)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def add_bookmark(name: str, path_str: str):
|
|
158
|
+
wdir = get_workspace_dir(name)
|
|
159
|
+
bm_file = wdir / "bookmarks.json"
|
|
160
|
+
bookmarks = []
|
|
161
|
+
if bm_file.exists():
|
|
162
|
+
try:
|
|
163
|
+
bookmarks = json.loads(bm_file.read_text(encoding="utf-8"))
|
|
164
|
+
except (OSError, ValueError) as exc:
|
|
165
|
+
logger.debug("Failed to read bookmarks %s: %s", bm_file, exc)
|
|
166
|
+
|
|
167
|
+
clean_path = redact_secrets(path_str.strip())
|
|
168
|
+
if clean_path not in bookmarks:
|
|
169
|
+
bookmarks.append(clean_path)
|
|
170
|
+
bm_file.write_text(json.dumps(bookmarks, indent=2), encoding="utf-8")
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def add_history(name: str, entry_type: str, content: str):
|
|
174
|
+
wdir = get_workspace_dir(name)
|
|
175
|
+
hist_file = wdir / "history.jsonl"
|
|
176
|
+
|
|
177
|
+
record = {
|
|
178
|
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
179
|
+
"type": entry_type,
|
|
180
|
+
"content": redact_secrets(content),
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
with open(hist_file, "a", encoding="utf-8") as f:
|
|
184
|
+
f.write(json.dumps(record) + "\n")
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: eva-cli
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: Command Line Intelligence
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Requires-Dist: diskcache<6.0.0,>=5.6.0
|
|
8
|
+
Requires-Dist: google-genai<2.0.0,>=0.1.0
|
|
9
|
+
Requires-Dist: httpx<1.0.0,>=0.27.0
|
|
10
|
+
Requires-Dist: keyring<26.0.0,>=25.0.0
|
|
11
|
+
Requires-Dist: openai<3.0.0,>=1.40.0
|
|
12
|
+
Requires-Dist: pathspec<1.0.0,>=0.12.0
|
|
13
|
+
Requires-Dist: platformdirs<5.0.0,>=4.0.0
|
|
14
|
+
Requires-Dist: pydantic-settings<3.0.0,>=2.0.0
|
|
15
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
|
16
|
+
Requires-Dist: pyyaml<7.0.0,>=6.0.0
|
|
17
|
+
Requires-Dist: rich<15.0.0,>=13.0.0
|
|
18
|
+
Requires-Dist: tenacity<10.0.0,>=9.0.0
|
|
19
|
+
Requires-Dist: tiktoken<1.0.0,>=0.7.0
|
|
20
|
+
Requires-Dist: tomli-w<2.0.0,>=1.0.0
|
|
21
|
+
Requires-Dist: tomli<3.0.0,>=2.0.0
|
|
22
|
+
Requires-Dist: typer<1.0.0,>=0.12.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: hypothesis<7.0.0,>=6.0.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-cov<8.0.0,>=5.0.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest<10.0.0,>=8.0.0; extra == 'dev'
|
|
27
|
+
Requires-Dist: respx<1.0.0,>=0.21.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: ruff<1.0.0,>=0.5.0; extra == 'dev'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
[Uploading README.md…]()
|
|
32
|
+
# Eva CLI
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.10+-3776AB?style=for-the-badge&logo=python&logoColor=white"></a>
|
|
37
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/rootagi/eva?style=for-the-badge"></a>
|
|
38
|
+
<a href="https://github.com/rootagi/eva/actions"><img src="https://img.shields.io/github/actions/workflow/status/rootagi/eva/ci.yaml?style=for-the-badge&label=Build"></a>
|
|
39
|
+
<a href="#usage"><img src="https://img.shields.io/badge/CLI-Terminal-111827?style=for-the-badge&logo=gnubash&logoColor=white"></a>
|
|
40
|
+
<a href="https://docs.astral.sh/ruff/"><img src="https://img.shields.io/badge/Code%20Style-Ruff-D7FF64?style=for-the-badge&logo=ruff&logoColor=black"></a>
|
|
41
|
+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/Status-Active%20Development-F59E0B?style=for-the-badge"></a>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
<img src="assets/logo.png" alt="Eva Logo" align="left" width="160" />
|
|
45
|
+
|
|
46
|
+
Eva is a command line intelligence assistant. It uses deterministic local tools for file discovery, tree generation, search, configuration, caching, and quota tracking, while reserving LLM calls for natural-language reasoning, summarization, code review, command generation, and patch generation.
|
|
47
|
+
|
|
48
|
+
The design goal is practical: keep routine terminal work fast and local, "Can't remember the right command... Don't leave CLI just for a single command and simple work insted ask eva directly from your CLI"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
<br clear="left"/>
|
|
52
|
+
|
|
53
|
+
<h2 align="center">Quick Demo</h2>
|
|
54
|
+
|
|
55
|
+
<p align="center">
|
|
56
|
+
<img src="assets/demo.gif" alt="Eva CLI Demo" width="900">
|
|
57
|
+
</a>
|
|
58
|
+
</p>
|
|
59
|
+
<h3 align="center">"Forgot a command?". Ask eva </h3>
|
|
60
|
+
<p align="center">
|
|
61
|
+
<img src="assets/demo2.gif" alt="Eva CLI Demo" width="900">
|
|
62
|
+
</a>
|
|
63
|
+
</p>
|
|
64
|
+
<h3 align="center">"Need help understanding any command output?". Ask eva </h3>
|
|
65
|
+
<p align="center">
|
|
66
|
+
<img src="assets/demo3.gif" alt="Eva CLI Demo" width="900">
|
|
67
|
+
</a>
|
|
68
|
+
</p>
|
|
69
|
+
<h3 align="center">"Want to patch a script?". Ask eva </h3>
|
|
70
|
+
<p align="center">
|
|
71
|
+
<img src="assets/demo4.gif" alt="Eva CLI Demo" width="900">
|
|
72
|
+
</a>
|
|
73
|
+
</p>
|
|
74
|
+
<h3 align="center">"Need a chatbot?". Just eva </h3>
|
|
75
|
+
<p align="center">
|
|
76
|
+
<img src="assets/demo5.gif" alt="Eva CLI Demo" width="900">
|
|
77
|
+
</a>
|
|
78
|
+
</p>
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## Highlights
|
|
82
|
+
|
|
83
|
+
- Provider abstraction with fallback routing across OpenRouter, Groq, Gemini, and OpenCode Zen.
|
|
84
|
+
- Streaming responses with disk-backed caching.
|
|
85
|
+
- Local RPM/RPD budget tracking to avoid unexpectedly exhausting free-tier provider quotas.
|
|
86
|
+
- `.gitignore`-aware context collection with common heavy directories pruned automatically.
|
|
87
|
+
- Safe file-context reads with missing-file, binary-file, large-file, and invalid-UTF-8 handling.
|
|
88
|
+
- Hardened command generation via `eva work`: strict parsing, risk checks, no `shell=True`, dry-run mode, and audit logging.
|
|
89
|
+
- Git-aware workflows for explaining diffs and generating commit messages.
|
|
90
|
+
- Reviewable patch generation with `eva edit`.
|
|
91
|
+
- Health checks through `eva config doctor`.
|
|
92
|
+
- Persistent chat sessions with `eva chat --session`.
|
|
93
|
+
|
|
94
|
+
## Installation
|
|
95
|
+
|
|
96
|
+
Eva requires Python 3.10 or newer.
|
|
97
|
+
|
|
98
|
+
**Quick install:**
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
curl -fsSL https://raw.githubusercontent.com/rootagi/eva/main/install.sh | sh
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Or with a package manager, once published to PyPI:**
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
uv tool install eva-cli # or: pipx install eva-cli / pip install --user eva-cli
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Or with Docker (no Python required):**
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
docker run --rm -it -v "$(pwd):/workspace" -e EVA_OPENAI_API_KEY="$OPENAI_API_KEY" \
|
|
114
|
+
ghcr.io/rootagi/eva chat
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**From a local checkout (for contributing):**
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
python -m pip install -e .
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
For development:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
python -m pip install -e ".[dev]"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
Set the default provider:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
eva use groq
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Store an API key using the OS keyring:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
eva config set-key groq
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Headless environments such as containers, CI runners, and SSH-only servers may not have a usable OS keyring backend. In that case, use provider-specific environment variables:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
export EVA_GROQ_API_KEY="..."
|
|
147
|
+
export EVA_OPENROUTER_API_KEY="..."
|
|
148
|
+
export EVA_GEMINI_API_KEY="..."
|
|
149
|
+
export EVA_OPENCODE_ZEN_API_KEY="..."
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Check the local setup:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
eva config doctor
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Usage
|
|
159
|
+
|
|
160
|
+
Ask a one-shot question:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
eva ask "Explain the difference between a process and a thread"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Include a file as context:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
eva ask "What does this module do?" --file src/eva/cli.py
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Include a directory tree as context:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
eva ask "Where should I add a new provider?" --dir src/eva
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Explain a file or directory:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
eva explain src/eva/router
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Analyze piped output:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
pytest -q | eva analyse "Summarize the failures"
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Start an interactive chat session:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
eva chat --session refactor-router
|
|
194
|
+
eva chat --session refactor-router --resume
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Generate a safe command from natural language:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
eva work "list the largest files in this repository" --dry-run
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Explain current git changes:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
eva changes
|
|
207
|
+
eva changes --staged
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Generate a commit message:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
eva commit-message
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Generate a reviewable patch:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
eva edit "add validation for empty provider names" --file src/eva/cli.py
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Apply the generated patch after confirmation:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
eva edit "add validation for empty provider names" --file src/eva/cli.py --apply
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Local utility commands do not use LLM quota:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
eva find "*.py"
|
|
232
|
+
eva tree src/eva
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Command reference
|
|
237
|
+
|
|
238
|
+
| Command | Purpose |
|
|
239
|
+
| --- | --- |
|
|
240
|
+
| `eva ask` | Ask a one-shot question, optionally with file or directory context. |
|
|
241
|
+
| `eva explain` | Explain a file, concept, or repository (with stack detection & module dependency graph). |
|
|
242
|
+
| `eva analyse` / `eva analyze` | Analyze piped terminal output. |
|
|
243
|
+
| `eva chat` | Run an interactive chat session, optionally saved and resumed. |
|
|
244
|
+
| `eva work` | Generate and optionally execute a single safe local command. |
|
|
245
|
+
| `eva edit` | Generate a unified diff for one or more files. |
|
|
246
|
+
| `eva workflow run` | Walk through a declarative multi-step YAML workflow with human approval gates. |
|
|
247
|
+
| `eva workflow list` | List available built-in and user-defined workflows. |
|
|
248
|
+
| `eva workflow show` | Display workflow steps and commands without executing them. |
|
|
249
|
+
| `eva workspace` | Manage isolated session workspaces, notes, and bookmarks. |
|
|
250
|
+
| `eva workspace create` | Create a new named session workspace. |
|
|
251
|
+
| `eva workspace switch` | Switch to a named session workspace. |
|
|
252
|
+
| `eva workspace list` | List all session workspaces. |
|
|
253
|
+
| `eva workspace note` | Add a note to the active workspace (secrets redacted automatically). |
|
|
254
|
+
| `eva workspace bookmark` | Bookmark a file path or URL in the active workspace. |
|
|
255
|
+
| `eva workspace show` | Display notes, bookmarks, and activity history for a workspace. |
|
|
256
|
+
| `eva replay` | Replay recorded terminal execution sessions (`eva replay <session>` or `eva replay --list`). |
|
|
257
|
+
| `eva changes` | Explain unstaged or staged git changes. |
|
|
258
|
+
| `eva commit-message` | Generate a concise commit message from a git diff. |
|
|
259
|
+
| `eva find` | Find files locally without AI usage. |
|
|
260
|
+
| `eva tree` | Print a `.gitignore`-aware directory tree. |
|
|
261
|
+
| `eva usage` | Show normalized local provider usage counters. |
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
| `eva config set-key <provider>` | Store an API key in the OS keyring. |
|
|
265
|
+
| `eva config remove-key <provider>` | Delete a stored API key from the OS keyring. |
|
|
266
|
+
| `eva config set-model <provider> <model>` | Set active model for a provider. |
|
|
267
|
+
| `eva config` | Manage provider, model, and API-key configuration. |
|
|
268
|
+
| `eva cache clear` | Clear cached AI responses. |
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
Global options:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
eva --version
|
|
275
|
+
eva --verbose ask "Why did this fail?"
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Verbose mode writes diagnostics to stderr and to Eva’s log file.
|
|
279
|
+
|
|
280
|
+
## Safety model & Production Hardening
|
|
281
|
+
|
|
282
|
+
`eva work` and `eva workflow` are intentionally conservative:
|
|
283
|
+
|
|
284
|
+
- model output must resolve to exactly one command line;
|
|
285
|
+
- malformed Markdown fences and trailing explanations are rejected;
|
|
286
|
+
- shell operators such as pipes, redirects, command substitution, and chained commands are rejected;
|
|
287
|
+
- high-risk patterns such as `sudo`, `rm -rf`, `curl | bash`, `dd`, `mkfs`, recursive ownership changes, and system-path redirects are blocked;
|
|
288
|
+
- secrets, API keys, tokens, and high-entropy strings are redacted before any network request and before writing to local disk;
|
|
289
|
+
- every generated, blocked, declined, or executed command is recorded in a **cryptographic hash-chained audit log** with SHA-256 tamper verification;
|
|
290
|
+
- optional **sandboxed execution** (`sandbox_risky_commands = true` in config) runs commands in a stripped subprocess environment with environment variable isolation and strict timeouts.
|
|
291
|
+
|
|
292
|
+
See [`SECURITY.md`](SECURITY.md) for full security documentation.
|
|
293
|
+
|
|
294
|
+
## Opt-in Telemetry
|
|
295
|
+
|
|
296
|
+
Eva collects **zero** data by default (`telemetry_enabled = false`). When explicitly opted-in via configuration, Eva records only anonymized provider response latency, error types, and success status. Prompt text, code snippets, file contents, and terminal commands are **never** collected. An optional self-hosted export endpoint is supported via `telemetry_export_endpoint`.
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
## Provider behavior
|
|
300
|
+
|
|
301
|
+
Eva tries the configured default provider first. If fallback is enabled, it then tries providers in the configured fallback order. Provider failures are logged instead of being silently discarded, and final provider failure messages include a concise summary of what failed.
|
|
302
|
+
|
|
303
|
+
Configured providers:
|
|
304
|
+
|
|
305
|
+
- OpenRouter
|
|
306
|
+
- Groq
|
|
307
|
+
- Gemini
|
|
308
|
+
- OpenCode Zen
|
|
309
|
+
- Ollama (offline local backend)
|
|
310
|
+
- llama.cpp (offline GGUF backend)
|
|
311
|
+
|
|
312
|
+
## Development
|
|
313
|
+
|
|
314
|
+
Install development dependencies:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
python -m pip install -e ".[dev]"
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Run tests:
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
pytest
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Run linting:
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
ruff check .
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Run the same checks in CI by pushing to a branch or opening a pull request. See [`.github/workflows/ci.yml`](.github/workflows/ci.yml).
|
|
333
|
+
|
|
334
|
+
## Project files
|
|
335
|
+
|
|
336
|
+
- [`pyproject.toml`](pyproject.toml) — package metadata, dependencies, and tooling.
|
|
337
|
+
- [`CHANGELOG.md`](CHANGELOG.md) — release history.
|
|
338
|
+
- [`LICENSE`](LICENSE) — MIT license.
|
|
339
|
+
- [`src/eva`](src/eva) — CLI implementation.
|
|
340
|
+
- [`tests`](tests) — regression tests.
|
|
341
|
+
|
|
342
|
+
## License
|
|
343
|
+
|
|
344
|
+
Eva CLI is released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
eva/__init__.py,sha256=VThO4HNjeNF99bzuhyNzD7_5dzJYbtSZDdxUg9wqTM4,46
|
|
2
|
+
eva/budget.py,sha256=OU32LiZhy_t7H59aCcOeM3HM35auKmwcnX8p-L4o6E4,638
|
|
3
|
+
eva/cache.py,sha256=rGwznvBDRklP1yw97dlhDaLLu2GXflBk1rp8bJ_R1rs,352
|
|
4
|
+
eva/chat_session.py,sha256=cYnBf88xJX_IYCl7xP8I4wp3OAl84yYODUraDnYfCrs,138
|
|
5
|
+
eva/cli.py,sha256=VKW8V-npNPWsTZ-lD9oRH5-XzEsVeX72k7Uy-l00g0w,114
|
|
6
|
+
eva/config.py,sha256=V6_IFSahBKSVyYWbbLhDsW6ZZlywH8zXAOxyH8u3KnI,683
|
|
7
|
+
eva/diagnostics.py,sha256=7y6PGxySfANrci-m8BYjkxyWK5l9HYxmyM4JsDeRWfE,201
|
|
8
|
+
eva/git_ops.py,sha256=k4urN3yIOHHoyWX4W7FNB0qCoilZPgZw-ayLd7mNu00,296
|
|
9
|
+
eva/work_safety.py,sha256=kGM0wmPnH24qr7t_HBodeTF8E1pOzPh75wPsL4uX6AQ,471
|
|
10
|
+
eva/cache/__init__.py,sha256=owSkAEM_QVg02BFJXP9nNzh7Vfs3GFAQNPrb-2hmu68,309
|
|
11
|
+
eva/cache/cache.py,sha256=TMLB6sHuMsmoVtA0DKMpaGxB9dpnNGAGWZyUESRjXE4,996
|
|
12
|
+
eva/cli/__init__.py,sha256=Qyy14rv-qXAjt259OFd_NmCbcM7O0YYhEaxVjBmokF0,73
|
|
13
|
+
eva/cli/app.py,sha256=vY8ojzHTHvrl1UYhOzi7BAdtmuKKtjd_NknNwzwNCbk,29079
|
|
14
|
+
eva/config/__init__.py,sha256=xS5_xWBuYdK6sGUrT0Uca4dgJgmxFRk61c9pNXGzhSE,639
|
|
15
|
+
eva/config/config.py,sha256=KJ0arLCP0AXK1AP9lgRWytn9-C82gqieq-R0w7mArm0,4054
|
|
16
|
+
eva/context/__init__.py,sha256=QLYblAobSFgAxKIbQcYwV1SNxVYKxkBUbb72LanUnT0,582
|
|
17
|
+
eva/context/finder.py,sha256=tp6WRKk4ExJ0eq0T-fZLOzX8mAlTPOtg_ZgdNWDExH0,143
|
|
18
|
+
eva/context/gitignore.py,sha256=TrEUCX3T34-2atpGqbsoYsQ9ug31aqF8FI0Ly64-mSQ,214
|
|
19
|
+
eva/context/io.py,sha256=c0sNdMTFYb-h54RqGEBo3ZAnWrrkOD_ugt7LusN6vP0,233
|
|
20
|
+
eva/context/tokenizer.py,sha256=0BfIkC5MAv7NPL_f_O5Rn6m9IhZdk27x0gkvJRKG8FQ,161
|
|
21
|
+
eva/context/tree.py,sha256=hvUk7Oomg69JkOMAbobQNfHtpWvLdiaacXve7KWKhmM,145
|
|
22
|
+
eva/indexing/__init__.py,sha256=9qFudVd1wdOxQ1PGULGCG-bXGNdVfvuWc0Ca077bhoM,543
|
|
23
|
+
eva/indexing/finder.py,sha256=6PUG7Voc9birIhz-nuzyDO5r86eXdDNWA2h49IWC21A,1216
|
|
24
|
+
eva/indexing/io.py,sha256=B8rbBRyxY-3YKPx9nngH5bX5KQK9RuZ2AO7qxz_EJsA,1126
|
|
25
|
+
eva/indexing/repo_index.py,sha256=8U09MlLycubrf1WQnOxAWUroSWp-gY4etOkbqvAceGc,8898
|
|
26
|
+
eva/indexing/tokenizer.py,sha256=mKw0eIjvYnwzVfDVokESObbx5RoB3udwh8hpeHvnP7Y,1359
|
|
27
|
+
eva/indexing/tree.py,sha256=jLUB-UPnqO-RTFPIUE1FkWX-NnUb-CCGrgKDxeZJTdM,1639
|
|
28
|
+
eva/plugins/__init__.py,sha256=g5baosMgR3QQKbrnOBMir35lzWLIRz67bYqFouESybU,57
|
|
29
|
+
eva/prompts/__init__.py,sha256=UpAaM3KFj5gc8XUP6ddsCoiOHE0LYCn1Be5J9CEQ3JY,1852
|
|
30
|
+
eva/providers/__init__.py,sha256=thMBh5rKYEPY6UP5vaa0PCR-g8QbufGLFJJAI0MLHMA,5224
|
|
31
|
+
eva/providers/gemini_provider.py,sha256=Q8G4X0RXAcUonNTfOsUHCSVQw8rVb7FvBnz0F8UfLUw,2395
|
|
32
|
+
eva/providers/groq_provider.py,sha256=9G22Zd1SX24qMD5CeytVMK4zOh6BjUh03wR5g7GevgE,1059
|
|
33
|
+
eva/providers/llamacpp_provider.py,sha256=MQjwiz_6KbAMsrtR5nXARwchTivP8fIIgr-t1XHxbfQ,2708
|
|
34
|
+
eva/providers/ollama_provider.py,sha256=ytoOGa8sfz9wNOBj3kStT-hgQmlPBS4h1c2EUziKUrs,2801
|
|
35
|
+
eva/providers/openai_compat.py,sha256=6gwdAh__zm5uK6OeUWvxhM7DRAE8uSOT3WDIcN67CvU,2233
|
|
36
|
+
eva/providers/opencode_zen_provider.py,sha256=U3VauuHosy8DroGD57HfujK7dfB-4AdiE3f8zOdef48,1757
|
|
37
|
+
eva/providers/openrouter_provider.py,sha256=hVeHOTgEr8vn7OOw7tOO_b5ntuUbcywMJJtezo_wA_k,1797
|
|
38
|
+
eva/replay/__init__.py,sha256=TGAWU1CeNPtARrwBrCHs0FeVtBmgLdv31J1GwyAUtT0,355
|
|
39
|
+
eva/replay/player.py,sha256=-7sxW4mHRvVy-bwy0uj1JDRW8mSnt1C_HT3cTvRIHPg,3463
|
|
40
|
+
eva/replay/recorder.py,sha256=TkPOfySBCrkliTqDS7Mhdqq4MsG_fTkzCJ3EaRbE3sc,1876
|
|
41
|
+
eva/router/__init__.py,sha256=ZGOCmvNjVXEG5aW6biOVsJqb2ozMjzfEZIZkUysIacs,437
|
|
42
|
+
eva/router/gemini_provider.py,sha256=g8Npezn6TQEAUMs5-VSkT-tA8FJ3GA_0YEMGvm2FzoI,165
|
|
43
|
+
eva/router/groq_provider.py,sha256=9eFwm6CIbguN-_WYFGuCEkayQ1ZGDn-WRJnKvAMih6E,157
|
|
44
|
+
eva/router/openai_compat.py,sha256=of5x_abwPt4adkmt_7zgmAcqbR-YQSobjPL-BbM1syY,155
|
|
45
|
+
eva/router/opencode_zen_provider.py,sha256=McfYRdcv3CaHKjXDXnsVSzA2rh37Z8vf9pq_K0uVyrY,197
|
|
46
|
+
eva/router/openrouter_provider.py,sha256=nz0gfdusJn2d5Dpv2kHmwjx6V0Rcae7CTKH_AYcF6BA,191
|
|
47
|
+
eva/security/__init__.py,sha256=43vRp3MUZXs5AB5eW5pqyjM7EHP4bTG-NTTC_B_g_1Y,797
|
|
48
|
+
eva/security/audit.py,sha256=tLkYilDwGWrlUbyYHw6Lx1Ra5ym7sQ2r7SoLecZ0AFs,4282
|
|
49
|
+
eva/security/redaction.py,sha256=05ZyH0WlehlkIJScgZV2X-tbA7sLFtL9Bhj9tAuDGW8,3056
|
|
50
|
+
eva/security/sandbox.py,sha256=b1UNEuRqrIn-WFQbtBi7vjuRg39ZyWP9uqd7TN05vOU,1678
|
|
51
|
+
eva/security/work_safety.py,sha256=OlZUK1dRNF2KM_BQxJw6E34u3_xu4l6j1sm_kyJznk4,2876
|
|
52
|
+
eva/shell/__init__.py,sha256=ExcCGhKeR_bzcrNaEBRcCgq2pE_Aor0fYBa59KSJcEQ,88
|
|
53
|
+
eva/shell/runner.py,sha256=nLTCjzxbavOaZs4jGsswN6sfA5iTseyAgUYkLezOUI8,231
|
|
54
|
+
eva/telemetry/__init__.py,sha256=wwxs6NpK-o6lMoz9E0E3hALBMnSDc51IAK1_t5XR1w8,283
|
|
55
|
+
eva/telemetry/diagnostics.py,sha256=7IuhMlcHXdaStNe6TlTWVrJfDj_h_mcTaBvi3jySbrg,1417
|
|
56
|
+
eva/telemetry/metrics.py,sha256=6VLwguQhAQtdjAjcf97ZgOhJBIcZrh44xylovypturQ,2026
|
|
57
|
+
eva/ui/formatter.py,sha256=K6dusG4dTrXV3koA2yUke_eyrzzjia8XeJaQrDm7BBU,1131
|
|
58
|
+
eva/ui/streaming.py,sha256=ghdtDNiwSPAnkR0jQAT3ElgITbkyDkmanD6PDy3xdhM,678
|
|
59
|
+
eva/workflows/__init__.py,sha256=lyFacTdcREt9ELv1jONDB5eTGm3NDoBObTblMuSxios,803
|
|
60
|
+
eva/workflows/budget.py,sha256=6ddZVydTaMRrwIqOn8_u63AfloSaIezs0GGJGainPNw,3722
|
|
61
|
+
eva/workflows/chat_session.py,sha256=H9zP_jYqqjNuzcNpCrSjU4juuBrIVNST3zG_uHihk2o,1940
|
|
62
|
+
eva/workflows/engine.py,sha256=3LvD0mNta4Fr9bknyfoD-Zi8ioUnGB-Gdxggp_vooR0,9219
|
|
63
|
+
eva/workflows/builtins/dependency_audit.yaml,sha256=QyDKCnNC_JkkgwvSkSJSQsnLo4_WAfM5q4Y7gdsPKa4,460
|
|
64
|
+
eva/workflows/builtins/repo_health.yaml,sha256=vWARm6LMl1Ugi8GOELSiosWzDhOzv62aBgEGoYKQK5U,581
|
|
65
|
+
eva/workflows/builtins/security_scan.yaml,sha256=b8wFed5y3idvD3o2aB9fEKBaWBipVwg7NVM1h724JQE,539
|
|
66
|
+
eva/workspace/__init__.py,sha256=8BQvUZU6XCN5jNeZhP7XQymxDMo1I3i9uecI4jDwu6A,878
|
|
67
|
+
eva/workspace/git_ops.py,sha256=xy7svA1GR284FEtk-9uYwytYpAuvlEetjy2d_Z6Yr9k,6755
|
|
68
|
+
eva/workspace/gitignore.py,sha256=2km5FWnAtHlMWITPflplUziJ44-nfRaOeMMaCxq8J6o,1078
|
|
69
|
+
eva/workspace/session.py,sha256=A7z5e2v9z9iyqcOmYeiC7ArvPbOwqX9M2sgR17sNjJA,5582
|
|
70
|
+
eva_cli-3.0.0.dist-info/METADATA,sha256=Oa12pw80HH6LNFPtKo9pdglX7tI3b45ZnpIqbCAxVKY,11301
|
|
71
|
+
eva_cli-3.0.0.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
72
|
+
eva_cli-3.0.0.dist-info/entry_points.txt,sha256=tq4EUvqyg-i4vSapY-_BK4xFxxZ-GjwsGcP_OPgHOeg,36
|
|
73
|
+
eva_cli-3.0.0.dist-info/licenses/LICENSE,sha256=I5pvmXgPs7eicOwjGgz5QXOgqZn7-2gjHiDu9FAUyJ0,1073
|
|
74
|
+
eva_cli-3.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Eva 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.
|