codepilot-cli-app 0.9.6__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.
- cli/__init__.py +1 -0
- cli/__main__.py +21 -0
- cli/agent.yaml +60 -0
- cli/app.py +1991 -0
- cli/modals.py +6 -0
- cli/sessions.py +65 -0
- cli/theme.py +121 -0
- codepilot_cli_app-0.9.6.dist-info/METADATA +33 -0
- codepilot_cli_app-0.9.6.dist-info/RECORD +12 -0
- codepilot_cli_app-0.9.6.dist-info/WHEEL +5 -0
- codepilot_cli_app-0.9.6.dist-info/entry_points.txt +2 -0
- codepilot_cli_app-0.9.6.dist-info/top_level.txt +1 -0
cli/modals.py
ADDED
cli/sessions.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""
|
|
2
|
+
cli/sessions.py – Session file helpers
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
from typing import NamedTuple
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Sessions are stored relative to the user's config dir when installed via pipx,
|
|
14
|
+
# falling back to a local ./sessions directory for development.
|
|
15
|
+
def _session_dir() -> Path:
|
|
16
|
+
import os
|
|
17
|
+
xdg = os.environ.get("XDG_DATA_HOME", "")
|
|
18
|
+
if xdg:
|
|
19
|
+
d = Path(xdg) / "codepilot" / "sessions"
|
|
20
|
+
else:
|
|
21
|
+
d = Path.home() / ".local" / "share" / "codepilot" / "sessions"
|
|
22
|
+
d.mkdir(parents=True, exist_ok=True)
|
|
23
|
+
return d
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
SESSION_DIR = _session_dir()
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class SessionInfo(NamedTuple):
|
|
30
|
+
session_id: str
|
|
31
|
+
path: Path
|
|
32
|
+
updated_at: str
|
|
33
|
+
message_count: int
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def list_sessions() -> list[SessionInfo]:
|
|
37
|
+
"""Return all saved sessions sorted by most-recently-modified."""
|
|
38
|
+
SESSION_DIR.mkdir(parents=True, exist_ok=True)
|
|
39
|
+
sessions: list[SessionInfo] = []
|
|
40
|
+
for f in SESSION_DIR.glob("*.json"):
|
|
41
|
+
try:
|
|
42
|
+
data = json.loads(f.read_text())
|
|
43
|
+
messages = data.get("messages", [])
|
|
44
|
+
mtime = datetime.fromtimestamp(f.stat().st_mtime)
|
|
45
|
+
sessions.append(SessionInfo(
|
|
46
|
+
session_id=f.stem,
|
|
47
|
+
path=f,
|
|
48
|
+
updated_at=mtime.strftime("%Y-%m-%d %H:%M"),
|
|
49
|
+
message_count=len(messages),
|
|
50
|
+
))
|
|
51
|
+
except Exception:
|
|
52
|
+
continue
|
|
53
|
+
return sorted(sessions, key=lambda s: s.path.stat().st_mtime, reverse=True)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def next_session_id() -> str:
|
|
57
|
+
"""Generate the next sequential devtool<N> id."""
|
|
58
|
+
existing = list_sessions()
|
|
59
|
+
nums = []
|
|
60
|
+
for s in existing:
|
|
61
|
+
sid = s.session_id
|
|
62
|
+
if sid.startswith("devtool") and sid[7:].isdigit():
|
|
63
|
+
nums.append(int(sid[7:]))
|
|
64
|
+
next_n = (max(nums) + 1) if nums else 100
|
|
65
|
+
return f"devtool{next_n}"
|
cli/theme.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""
|
|
2
|
+
cli/theme.py – CodePilot visual constants
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
# ── App identity ───────────────────────────────────────────────────────────────
|
|
8
|
+
APP_NAME = "CodePilot"
|
|
9
|
+
APP_VERSION = "v0.9.3"
|
|
10
|
+
|
|
11
|
+
# ── Orange gradient stops (dark → bright) ─────────────────────────────────────
|
|
12
|
+
GRADIENT = [
|
|
13
|
+
"#C94400",
|
|
14
|
+
"#D95000",
|
|
15
|
+
"#E86000",
|
|
16
|
+
"#F47120",
|
|
17
|
+
"#FF8533",
|
|
18
|
+
"#FF9A50",
|
|
19
|
+
"#FFAE70",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
# ── Providers and their models ─────────────────────────────────────────────────
|
|
23
|
+
PROVIDERS: dict[str, list[str]] = {
|
|
24
|
+
"OpenAI": [
|
|
25
|
+
"gpt-5.4-mini",
|
|
26
|
+
"gpt-5-mini",
|
|
27
|
+
"gpt-5.3-codex",
|
|
28
|
+
"gpt-5.4",
|
|
29
|
+
"gpt-5.5",
|
|
30
|
+
],
|
|
31
|
+
"Anthropic": [
|
|
32
|
+
"claude-haiku-4-5",
|
|
33
|
+
"claude-sonnet-4-6",
|
|
34
|
+
"claude-opus-4-8",
|
|
35
|
+
],
|
|
36
|
+
"Deepseek": [
|
|
37
|
+
"deepseek-v4-pro",
|
|
38
|
+
"deepseek-v4-flash",
|
|
39
|
+
],
|
|
40
|
+
"Alibaba": [
|
|
41
|
+
"qwen3-coder-plus",
|
|
42
|
+
"qwen3-coder-next",
|
|
43
|
+
"qwen3-coder-flash",
|
|
44
|
+
"qwen3.6-plus",
|
|
45
|
+
],
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# provider name keyed by model name for quick lookup
|
|
49
|
+
MODEL_TO_PROVIDER: dict[str, str] = {
|
|
50
|
+
model: provider
|
|
51
|
+
for provider, models in PROVIDERS.items()
|
|
52
|
+
for model in models
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# flat list for iteration
|
|
56
|
+
ALL_MODELS: list[str] = [m for models in PROVIDERS.values() for m in models]
|
|
57
|
+
|
|
58
|
+
DEFAULT_MODEL = "deepseek-v4-flash"
|
|
59
|
+
DEFAULT_PROVIDER = "Deepseek"
|
|
60
|
+
|
|
61
|
+
# ── Provider → yaml provider string ───────────────────────────────────────────
|
|
62
|
+
PROVIDER_YAML_NAME: dict[str, str] = {
|
|
63
|
+
"OpenAI": "openai",
|
|
64
|
+
"Anthropic": "anthropic",
|
|
65
|
+
"Deepseek": "deepseek",
|
|
66
|
+
"Alibaba": "alibaba",
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# ── Model context window sizes (tokens) ───────────────────────────────────────
|
|
70
|
+
# Used by /context command to render fill bars.
|
|
71
|
+
MODEL_CONTEXT_WINDOWS: dict[str, int] = {
|
|
72
|
+
# OpenAI
|
|
73
|
+
"gpt-5.4-mini": 128_000,
|
|
74
|
+
"gpt-5-mini": 128_000,
|
|
75
|
+
"gpt-5.3-codex": 200_000,
|
|
76
|
+
"gpt-5.4": 128_000,
|
|
77
|
+
"gpt-5.5": 200_000,
|
|
78
|
+
# Anthropic
|
|
79
|
+
"claude-haiku-4-5": 200_000,
|
|
80
|
+
"claude-sonnet-4-6": 200_000,
|
|
81
|
+
"claude-opus-4-8": 200_000,
|
|
82
|
+
# Deepseek
|
|
83
|
+
"deepseek-v4-pro": 64_000,
|
|
84
|
+
"deepseek-v4-flash": 64_000,
|
|
85
|
+
# Alibaba
|
|
86
|
+
"qwen3-coder-plus": 131_072,
|
|
87
|
+
"qwen3-coder-next": 131_072,
|
|
88
|
+
"qwen3-coder-flash": 131_072,
|
|
89
|
+
"qwen3.6-plus": 131_072,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
DEFAULT_CONTEXT_WINDOW = 128_000 # fallback for unknown models
|
|
93
|
+
|
|
94
|
+
# ── Slash commands ─────────────────────────────────────────────────────────────
|
|
95
|
+
SLASH_COMMANDS: dict[str, str] = {
|
|
96
|
+
"/status": "Show runtime & system status",
|
|
97
|
+
"/context": "Visual context window usage breakdown",
|
|
98
|
+
"/export": "Export full session to JSON",
|
|
99
|
+
"/stat": "Model token usage statistics",
|
|
100
|
+
"/models": "List & switch models",
|
|
101
|
+
"/config": "Edit configuration (agent.yaml)",
|
|
102
|
+
"/session": "Show session metadata",
|
|
103
|
+
"/sessions": "Browse & resume sessions",
|
|
104
|
+
"/reset": "Clear current session",
|
|
105
|
+
"/bash": "Start an interactive bash sub-shell",
|
|
106
|
+
"/shell": "Start an interactive bash sub-shell",
|
|
107
|
+
"/help": "Show all commands",
|
|
108
|
+
"/exit": "Quit CodePilot",
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def gradient_text(text: str) -> str:
|
|
113
|
+
"""Return Rich markup string with per-char orange gradient colouring."""
|
|
114
|
+
stops = GRADIENT
|
|
115
|
+
n = len(stops)
|
|
116
|
+
chars = list(text)
|
|
117
|
+
out = []
|
|
118
|
+
for i, ch in enumerate(chars):
|
|
119
|
+
colour = stops[int(i / max(len(chars) - 1, 1) * (n - 1))]
|
|
120
|
+
out.append(f"[bold {colour}]{ch}[/bold {colour}]")
|
|
121
|
+
return "".join(out)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codepilot-cli-app
|
|
3
|
+
Version: 0.9.6
|
|
4
|
+
Summary: CodePilot – agentic engineering CLI
|
|
5
|
+
Project-URL: Homepage, https://github.com/your-org/codepilot
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: rich>=13.7.0
|
|
9
|
+
Requires-Dist: prompt_toolkit>=3.0.43
|
|
10
|
+
Requires-Dist: pyyaml>=6.0
|
|
11
|
+
Requires-Dist: codepilot-ai>=0.9.6
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: build; extra == "dev"
|
|
14
|
+
Requires-Dist: twine; extra == "dev"
|
|
15
|
+
|
|
16
|
+
# CodePilot CLI
|
|
17
|
+
|
|
18
|
+
CodePilot CLI is a cross-platform command-line interface for the `codepilot-ai`
|
|
19
|
+
runtime.
|
|
20
|
+
|
|
21
|
+
## Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pipx install codepilot-cli
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
After installation, run it from any directory:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
codepilot
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The CLI uses the current working directory as the agent workspace.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
cli/__init__.py,sha256=gKPr4C1NYhAPgASmPOoW6l1fxP2WMIKsEVCQ2JikUwg,13
|
|
2
|
+
cli/__main__.py,sha256=TPcp_iucUvFuG7ecLRpfAB4coKfyTgrQwouAjBuwWqk,388
|
|
3
|
+
cli/agent.yaml,sha256=8ZgXmYZ9_oW0vQk_a_1QG9wvoopNCzSBnCljrvfv_wE,1630
|
|
4
|
+
cli/app.py,sha256=KwRKZDfh7FBB3RTd56OZ3CEkn1-RNkV_Eybc_YaxA7I,77335
|
|
5
|
+
cli/modals.py,sha256=U1yQKmdrLcDy0bHLuEN_SxbE5H2-YLkNJCOEfz1xXdY,211
|
|
6
|
+
cli/sessions.py,sha256=56hjBqPW2V1Umt7iVRJDxQBYi3TZw4kLGcQBWzV9FrY,1872
|
|
7
|
+
cli/theme.py,sha256=qUAlx6tPYyQvofU7e3mUuA-SRlQzu30877ruG9BTOkY,4075
|
|
8
|
+
codepilot_cli_app-0.9.6.dist-info/METADATA,sha256=AwFfI-g6h3H9pxEHQdFOlHK2TUth16cw_3vGoZzaPhk,753
|
|
9
|
+
codepilot_cli_app-0.9.6.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
10
|
+
codepilot_cli_app-0.9.6.dist-info/entry_points.txt,sha256=w7yq27EPa0RusUyogPQC9879AizqUtdhhg7Aoxyh8C4,48
|
|
11
|
+
codepilot_cli_app-0.9.6.dist-info/top_level.txt,sha256=2ImG917oaVHlm0nP9oJE-Qrgs-fq_fGWgba2H1f8fpE,4
|
|
12
|
+
codepilot_cli_app-0.9.6.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cli
|