phonton-cli 0.16.2 → 0.19.0
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.
- package/README.md +125 -436
- package/npm/bin/phonton.js +2 -48
- package/npm/install.js +0 -15
- package/npm/test-wrapper.js +13 -108
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,515 +1,204 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="assets/readme/phonton-cli-logo.png" width="
|
|
2
|
+
<img src="assets/readme/phonton-cli-logo.png" width="128" alt="Phonton CLI logo">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
<h1 align="center">Phonton CLI
|
|
5
|
+
<h1 align="center">Phonton CLI — v0.19.0</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<strong>
|
|
9
|
-
|
|
8
|
+
<strong>Your keys. Your code. The autonomous coding agent that never phones home.</strong><br>
|
|
9
|
+
Phonton is a local-first agentic development environment (ADE) built around the loop: <code>goal ➔ plan ➔ edit ➔ verify ➔ review ➔ remember</code>.
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">
|
|
13
|
-
<a href="https://github.com/phonton-dev/phonton-cli/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/phonton-dev/phonton-cli/actions/workflows/ci.yml/badge.svg"></a>
|
|
14
|
-
<a href="https://github.com/phonton-dev/phonton-cli/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/phonton-dev/phonton-cli?style=flat&label=stars"></a>
|
|
15
|
-
<img alt="release" src="https://img.shields.io/badge/release-v0.
|
|
13
|
+
<a href="https://github.com/phonton-dev/phonton-cli/actions/workflows/ci.yml"><img alt="CI Status" src="https://github.com/phonton-dev/phonton-cli/actions/workflows/ci.yml/badge.svg"></a>
|
|
14
|
+
<a href="https://github.com/phonton-dev/phonton-cli/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/phonton-dev/phonton-cli?style=flat&label=stars&color=ff69b4"></a>
|
|
15
|
+
<img alt="release" src="https://img.shields.io/badge/release-v0.19.0-6c63ff">
|
|
16
16
|
<img alt="license" src="https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue">
|
|
17
|
-
<img alt="status" src="https://img.shields.io/badge/status-public_alpha-f97316">
|
|
18
17
|
</p>
|
|
19
18
|
|
|
20
19
|
---
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
## 💡 What is Phonton?
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
Every AI coding assistant makes you trade privacy for autonomy. To get an agentic experience, you either hand your code to a SaaS vendor's proxy servers, or settle for inline autocompletion.
|
|
24
|
+
|
|
25
|
+
**Phonton is the first tool to deliver both: fully agentic development and absolute, uncompromising privacy.**
|
|
26
|
+
|
|
27
|
+
Phonton runs as a local-first, headless-ready terminal tool. Your code never leaves your machine. Your API keys go straight to Anthropic, OpenAI, Gemini, or Ollama. No intermediate proxy, no telemetry hooks, and no subscription required.
|
|
25
28
|
|
|
26
29
|
<p align="center">
|
|
27
|
-
<img src="assets/readme/phonton-cli-hero.png" alt="Phonton CLI hero with terminal UI preview">
|
|
30
|
+
<img src="assets/readme/phonton-cli-hero.png" alt="Phonton CLI hero with terminal UI preview" width="800">
|
|
28
31
|
</p>
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Most coding agents start with chat. Phonton starts with the engineering loop:
|
|
33
|
+
---
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
flowchart LR
|
|
36
|
-
A["Goal"] --> B["Plan preview"]
|
|
37
|
-
B --> C["Repo-aware worker"]
|
|
38
|
-
C --> D["Verification gate"]
|
|
39
|
-
D --> E["Reviewable diff"]
|
|
40
|
-
E --> F["Memory and history"]
|
|
41
|
-
F --> B
|
|
42
|
-
```
|
|
35
|
+
## 🌟 Core Differentiators
|
|
43
36
|
|
|
44
|
-
|
|
37
|
+
### 1. Zero-Telemetry BYOK (Bring Your Own Key)
|
|
38
|
+
Phonton is proxy-free. Requests go directly to `api.anthropic.com`, `api.openai.com`, `generativelanguage.googleapis.com`, or your local `ollama` daemon. Phonton never intercepts your keys and never touches your code in transit. You can packet-capture the network to verify.
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
### 2. The Strict 4-Layer Verification Gate
|
|
41
|
+
Unlike other tools that silently write code and let LLM hallucinations ship, Phonton enforces a strict verification gate. Every diff must pass through **four layers** before it is marked as review-ready:
|
|
42
|
+
1. **Tree-Sitter Syntax check**
|
|
43
|
+
2. **Crate check (`cargo check`)**
|
|
44
|
+
3. **Workspace Check (Lints & Format)**
|
|
45
|
+
4. **Automated Test suite execution**
|
|
46
|
+
5. **Interactive Browser rendering check** (Playwright checks + Screenshots in `v0.19.0`)
|
|
51
47
|
|
|
52
|
-
|
|
48
|
+
On failure, verifier diagnostics are surgically fed back to the worker for recursive repair loops.
|
|
53
49
|
|
|
54
|
-
|
|
50
|
+
### 3. Multi-Model Intelligence Routing
|
|
51
|
+
Phonton routes subtasks by complexity using tiered model mapping (`Local ➔ Cheap ➔ Standard ➔ Frontier`). It automatically escalates to a more powerful model only on verify failure. You pay pennies for boilerplate and invoke frontier intelligence only when a task demands it.
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
goal
|
|
58
|
-
```
|
|
53
|
+
### 4. Semantic Memory Across Sessions
|
|
54
|
+
Phonton maintains a persistent SQLite store of architectural decisions, rejected approaches, and task history. The planner consults this memory on every goal decomposition, ensuring it never re-attempts approaches that failed before and builds upon approved design patterns.
|
|
59
55
|
|
|
60
|
-
|
|
56
|
+
---
|
|
61
57
|
|
|
62
|
-
|
|
63
|
-
phonton demo trust-loop
|
|
64
|
-
phonton demo trust-loop --json
|
|
65
|
-
```
|
|
58
|
+
## ⚡ Quick Install
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## What Works Today
|
|
70
|
-
|
|
71
|
-
- Interactive Ratatui TUI with goal, task, ask, settings, git, and flight-log surfaces.
|
|
72
|
-
- v0.16.2 hardens headless benchmark runs: `phonton goal --prompt-file <path> --json --yes` captures bounded baseline test evidence when prompts ask to run tests first, extracts prompt-mentioned files/APIs into the GoalContract, avoids parent-repo checkpoint escapes in nested work folders, and keeps mixed local-template/provider runs out of token-claim eligibility.
|
|
73
|
-
- v0.16.1 adds `phonton goal --prompt-file <path>` for CI and benchmark runs that need the same goal execution spine without clipboard, paste, or PTY automation.
|
|
74
|
-
- v0.16.1 adds `phonton extensions install <source>` for installing audited `.phonton` packs from GitHub or local paths, plus built-in open-source MCP catalog ids such as `context7`, `github`, `chrome-devtools`, `playwright`, `firecrawl`, `supabase`, `mongodb`, and `figma`.
|
|
75
|
-
- v0.16.1 adds `phonton extensions catalog`, `phonton extensions new <path> [skill|steering|mcp-server|profile]`, and `phonton extensions validate` so extension discovery, scaffolding, and validation feel closer to Gemini CLI while preserving Phonton's local trust and approval model.
|
|
76
|
-
- v0.16.1 hardens the local ADE spine: memory retrieval now uses light stemming, engineering-term synonyms, stopword filtering, and IDF-weighted overlap; cargo verification uses file-backed locks under `target/.phonton-locks`; Windows sandbox job-object fallback is reported explicitly.
|
|
77
|
-
- v0.16.0 adds typed `@...` context mentions for files, directories, symbols, MCP servers, and MCP tools, with resolved/missing/approval-gated rows visible in `/context` and the Context focus surface.
|
|
78
|
-
- v0.16.0 separates local prompt token estimates from provider-reported billing usage in `phonton why-tokens --by-source`; local-only runs now render as `no provider call`, and prompt manifests carry resolved `@...` mention rows plus attribution-only token totals instead of double-counting attachments or MCP/tool context.
|
|
79
|
-
- v0.16.0 tightens extension and MCP diagnostics so `phonton extensions doctor` warns on networked or mutating MCP trust even when a server has not listed explicit permissions.
|
|
80
|
-
- Unified slash commands in the TUI: `/settings`, `/config`, `/status`, `/context`, `/compact`, `/compact-context`, `/compress`, `/problems`, `/diagnostics`, `/retry`, `/repair`, `/why-tokens`, `/ask`, `/plan`, `/approve`, `/goals`, `/switch`, `/focus`, `/diff`, `/code`, `/copy`, `/rerun`, `/stats`, `/stop`, `/review`, `/memory`, `/permissions`, `/trust`, `/model`, `/commands`, `/run`, and `!` all route through the same command registry and prompt drawer.
|
|
81
|
-
- Static syntax verification now covers Rust, Python, JavaScript, TypeScript, JSON, TOML, YAML, HTML, and CSS changed files before review-ready status. Generated code that cannot parse stays failed/unverified instead of becoming a receipt.
|
|
82
|
-
- Failed goals default to a Problems focus view with grouped verifier/provider/quality diagnostics, compact repair hints, and `Alt+P` / `Alt+R` keyboard shortcuts for inspection and repair.
|
|
83
|
-
- `/why-tokens` and `phonton why-tokens --by-source` explain the latest prompt manifest in plain language, including first-attempt, repair-attempt, context/artifact, system, goal, memory, attachment, repo-code, MCP/tool, `@...` mention attribution, retry, compaction, dedupe, and cached-token buckets.
|
|
84
|
-
- v0.15.5 fixes TUI prompt typing and Ask readability: bare `f`, `d`, `p`, and `r` now type normally, focus shortcuts moved to `Alt+F/D/P/R`, the prompt bar shows a static caret rectangle, and Ask answers style inline markdown such as `**bold**`, `*italic*`, and `` `code` ``.
|
|
85
|
-
- v0.15.4 fixes the existing Vite chess quality gate: the zero-token App shell now renders an accessible named-piece legend for king, queen, rook, bishop, knight, and pawn, and the seeded App test asserts that evidence.
|
|
86
|
-
- v0.15.3 fixes stale existing Vite App tests during the zero-token chess UI seed: old placeholder heading assertions in `src/App.test.*` are replaced with a local Vitest server-render test for the generated chess shell.
|
|
87
|
-
- v0.15.2 fixes the existing Vite chess UI hot path: `src/App.tsx`, `src/App.css`, and `src/vite-env.d.ts` seed locally with a playable app shell, repeated UI slices become zero-token no-ops, and the TUI no longer shows a blinking native cursor over the prompt or compact header.
|
|
88
|
-
- v0.15.1 fixes the v0.15.0 hot path: generated Vite chess rules seeds declare a real Vitest suite, the compact header gradient animates while work is active, the Receipt focus shortcut row no longer wraps `d diff` onto a stranded line, and Flight Log PgUp/mouse scrolling works from tail mode.
|
|
89
|
-
- v0.15.0 adds a summary-first proof layer: deterministic Plan, Work, Verification, Failure, Token, Context, and Handoff summaries are derived from typed facts and exported through proof/review surfaces.
|
|
90
|
-
- v0.15.0 expands the Active panel focus surfaces to Plan, Receipt, Problems, Code, Commands, Context, Tokens, and Log so broad work can be inspected without opening the Flight Log.
|
|
91
|
-
- `/plan <goal>` now previews the GoalContract and verification/run plan in the TUI without starting workers; `/approve` starts the selected preview after review.
|
|
92
|
-
- OutcomeLedger proof records now carry persisted context buckets, selected index slices, MCP permission evidence, command-run evidence, and summary bundles for history, review JSON, proof export, and benchmark export.
|
|
93
|
-
- Generated web/runtime verification plans that do not produce runtime proof are surfaced as known gaps and verification findings, not treated as proof of correctness.
|
|
94
|
-
- v0.11 context planning builds a compact repo map, selects only the highest-value code slices under a target budget, exposes omitted code tokens, and labels target-exceeded prompts honestly when one required slice must go over budget.
|
|
95
|
-
- v0.12 enforces lower spend before the provider call: generated app/game goals dispatch as acceptance-slice subtasks, simple/docs/test prompts use small task-class budgets, generated repairs use a sub-1k context target, semantic retrieval top-k and repo maps shrink by task class, MCP result context is capped, and provider output ceilings are lower.
|
|
96
|
-
- v0.14.1 fixes generated-web failure diagnostics: Problems focus now jumps to the changed file named by the verifier, and `src/App.tsx:1:1` diagnostics are normalized for retry policy.
|
|
97
|
-
- v0.14.0 hardens Node verification so stock Vite/Vitest/Jest test scripts run in non-interactive CI mode instead of hanging in watch mode.
|
|
98
|
-
- v0.13.5 seeds the existing Vite/React chess rules/test boundary with a locally verified template before provider UI slices, including recovery from partial invalid `src/chessRules.ts` artifacts without another provider call.
|
|
99
|
-
- v0.13.4 detects existing Vite/React workspaces for chess benchmark prompts that say "use the existing project stack," then starts on source/test slices instead of fragile `package.json` or `index.html` scaffold edits.
|
|
100
|
-
- v0.13.1 hardens generated web-app token behavior: Vite/React chess prompts stay on compact acceptance slices even in partial workspaces, and first-attempt TSX/HTML syntax failures stop before automatic repair.
|
|
101
|
-
- v0.13.0 makes Ask workspace-aware under a bounded context budget and carries forward verified diff export: `phonton diff`, `--stat`, `--name-only`, `/diff`, `/code`, and `d`.
|
|
102
|
-
- v0.12.6 hardens provider contracts further: DeepSeek V4/reasoner routes disable provider thinking for diff-only worker calls, stale v0.12.5 canary cache entries are invalidated, reasoning-only replies fail clearly, and provider tests time out quickly instead of hanging.
|
|
103
|
-
- v0.12.5 blocks bad provider/model routes before goal dispatch: provider readiness now uses a parseable unified-diff canary, empty OpenAI-compatible responses fail immediately, OpenCode/OpenCode Go routes work through `OPENCODE_API_KEY`, and `phonton providers` can list/sync the Models.dev catalog.
|
|
104
|
-
- v0.12.4 cuts wasted repair tokens in generated-app failures: workers stop after repeated verifier/parser diagnostics, redispatch prompts start with prior verifier evidence, stale hunk repairs get explicit guidance, and the Flight Log shows compact `repair` events before bounded retries.
|
|
105
|
-
- v0.12.3 fixes stale generated-test hunks during the chess benchmark: rules/test slices now carry paired current artifacts, and repair attempts include the exact current file named in verifier diagnostics instead of retrying blind.
|
|
106
|
-
- v0.12.2 fixes early generated Vite/React chess slices so Vitest does not fail before test files exist: scaffold slices now request a starter rules module and smoke test, and npm verification waits to run Vitest/Jest discovery scripts until a test file exists.
|
|
107
|
-
- v0.12.1 fixes the playable chess benchmark path: explicit Vite/TypeScript/React prompts now scaffold an npm app contract, use chess.js-backed rules/test slices, carry current artifact snapshots between slices, use compact slice labels instead of repeating the full pasted prompt, and run npm install/test/build verification before review-ready status.
|
|
108
|
-
- `phonton proof export --latest --format json` exports the latest proof bundle from the OutcomeLedger, and `phonton context eval|diff` evaluates deterministic context-selection fixtures before benchmark runs.
|
|
109
|
-
- Ask mode supports `/ask <question>`, scrollable answers, lightweight markdown-style rendering, and bounded read-only workspace context with visible `ctx:` token/file summaries. `phonton ask --no-workspace` keeps the old stateless behavior.
|
|
110
|
-
- Faster multi-goal navigation: the sidebar shows stable goal indexes, `Alt+Up` / `Alt+Down` switches goals even while drafting text, `Alt+1` through `Alt+9` jumps directly, and `/goals` opens a searchable switcher.
|
|
111
|
-
- Review-ready goals now default to a Receipt focus view, with Plan, Problems, Code, Commands, Context, Tokens, and Log tabs in the Active panel plus `p` / `r` / `f` / `d` / `[` / `]` keyboard navigation.
|
|
112
|
-
- Command run receipts stay collapsed by default; the Commands focus view shows status, exit code, duration, and short stdout/stderr previews. `/rerun` repeats the latest command through the same sandbox path and `/copy` copies the current focus view to the Windows clipboard.
|
|
113
|
-
- Saved workspace sessions: use `phonton -r` or `phonton --resume` to reopen the last saved TUI conversation for the current repo.
|
|
114
|
-
- Prompt bar paste artifacts: long or multiline pasted text collapses into a compact colored chip while the full content stays attached to the submitted goal; credential-looking pasted blocks are blocked before they can reach the model.
|
|
115
|
-
- Image path paste/drop artifacts: pasted image file paths collapse into `[image: name.png]` chips and flow into the submitted prompt as image artifacts.
|
|
116
|
-
- Active review/code output is scrollable with the mouse wheel, `PgUp` / `PgDn`, and `Home` / `End`, so large generated diffs do not trap the user at the top of the receipt.
|
|
117
|
-
- Windows clipboard import in the TUI with `Ctrl+V`, including content selected from Windows clipboard history (`Win+V`) when the terminal does not emit bracketed paste directly.
|
|
118
|
-
- Lower-noise worker prompts: first attempts omit bulky diff examples, duplicate repo context slices are deduped, and Flight Log prompt manifests show repo-code, compaction, dedupe, and budget buckets.
|
|
119
|
-
- Resumed sessions keep recent prompt history, and the History view supports in-place filtering and row selection for inspecting previous task receipts.
|
|
120
|
-
- Workspace trust is saved as structured per-workspace records, mirrored into the local store, visible with `/trust current` or `/trust list`, and revocable with `/trust revoke-current`.
|
|
121
|
-
- Sandboxed command runs from the prompt bar with `/run <cmd>` or `!<cmd>`, plus command status, output previews, context meters, and permission mode controls in the TUI and Flight Log.
|
|
122
|
-
- `phonton doctor` setup diagnostics for config, provider key, store, trust, git, cargo, and Nexus config.
|
|
123
|
-
- `phonton plan` preview for task DAGs and the visible GoalContract before edits happen.
|
|
124
|
-
- `phonton review` surfaces for verified diff review payloads, approvals, rejections, rollback, and Markdown receipt export. `phonton diff` exports the verified unified diff or compact file/stat views without opening the TUI. Failed runs can still export a failed/unverified Markdown receipt with diagnostics.
|
|
125
|
-
- `phonton run latest` executes the latest receipt-suggested run command through the sandbox.
|
|
126
|
-
- TUI goal prompts can mention workspace files and images with `@path`; text files become bounded context and image metadata/payloads flow to compatible providers.
|
|
127
|
-
- Review-ready runs now show a handoff receipt in the TUI and persist a minimal outcome ledger for history/review evidence.
|
|
128
|
-
- `phonton memory` commands for inspecting, editing, deleting, pinning, and unpinning local decision memory.
|
|
129
|
-
- `phonton extensions` commands for inspecting resolved skills, steering, MCP servers, profiles, conflicts, and diagnostics.
|
|
130
|
-
- `phonton mcp` commands for listing configured servers and lazily approving tool discovery or tool calls.
|
|
131
|
-
- BYOK provider adapters for Anthropic, OpenAI, OpenRouter, OpenCode, OpenCode Go, Gemini/Google, Cloudflare Workers AI, AgentRouter, DeepSeek, xAI/Grok, Groq, Together, Ollama, and custom OpenAI-compatible endpoints. `phonton doctor --provider` verifies your configured provider with a tiny parseable-diff canary through the same adapter used for runs.
|
|
132
|
-
- `phonton providers list|sync|doctor|import-opencode` exposes Models.dev provider metadata, verifies the configured provider/model route, and can read OpenCode auth on demand without copying or printing secrets.
|
|
133
|
-
- Local store, memory, planner, worker, diff, sandbox, verification, and orchestration crates.
|
|
134
|
-
- Prompt-section token manifests in the Flight Log so system, goal, memory, attachment, MCP, and retry-context costs are inspectable.
|
|
135
|
-
- `phonton demo trust-loop` prints a compact proof-oriented walkthrough of the GoalContract -> verification -> receipt -> memory loop for first-run demos, with `--json` for reproducible demos.
|
|
136
|
-
- Semantic indexing behind the CLI stack for repo-aware workflows.
|
|
137
|
-
|
|
138
|
-
## What Is Still Early
|
|
139
|
-
|
|
140
|
-
Phonton is not yet as polished as Codex, Claude Code, Cursor, or Windsurf. It has fewer integrations, less onboarding polish, narrower public documentation, and no mature hosted/team workflow yet.
|
|
141
|
-
|
|
142
|
-
The current release target is a public alpha for real Rust repo tasks. Phonton can ask configured models to write app-sized changes, but quality is only claimed after plan review, sandboxed edits, verification, and human review. Use it if you are comfortable running a Rust binary, reading diagnostics, and filing sharp bug reports.
|
|
143
|
-
|
|
144
|
-
## Install
|
|
145
|
-
|
|
146
|
-
The easiest install path is npm. This downloads a prebuilt GitHub Release binary when the package installs.
|
|
60
|
+
The easiest path to install is via npm. The wrapper automatically downloads the prebuilt binary for your platform.
|
|
147
61
|
|
|
148
62
|
```bash
|
|
63
|
+
# Install globally
|
|
149
64
|
npm install -g phonton-cli
|
|
150
|
-
phonton
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Run without installing:
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
npx phonton-cli
|
|
157
|
-
```
|
|
158
65
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
macOS/Linux:
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
curl -fsSL https://raw.githubusercontent.com/phonton-dev/phonton-cli/main/scripts/install.sh | sh
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Windows PowerShell:
|
|
168
|
-
|
|
169
|
-
```powershell
|
|
170
|
-
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/phonton-dev/phonton-cli/main/scripts/install.ps1)))
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
Direct Cargo install:
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
cargo install --git https://github.com/phonton-dev/phonton-cli --tag v0.16.2 phonton-cli --locked --force
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
Check the install:
|
|
180
|
-
|
|
181
|
-
```bash
|
|
66
|
+
# Verify your installation
|
|
182
67
|
phonton version
|
|
183
68
|
phonton doctor
|
|
184
69
|
```
|
|
185
70
|
|
|
186
|
-
|
|
71
|
+
### Alternative Installers
|
|
187
72
|
|
|
188
|
-
|
|
73
|
+
* **Shell Script (macOS/Linux)**:
|
|
74
|
+
```bash
|
|
75
|
+
curl -fsSL https://raw.githubusercontent.com/phonton-dev/phonton-cli/main/scripts/install.sh | sh
|
|
76
|
+
```
|
|
77
|
+
* **PowerShell (Windows)**:
|
|
78
|
+
```powershell
|
|
79
|
+
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/phonton-dev/phonton-cli/main/scripts/install.ps1)))
|
|
80
|
+
```
|
|
81
|
+
* **Cargo (From Source)**:
|
|
82
|
+
```bash
|
|
83
|
+
cargo install --git https://github.com/phonton-dev/phonton-cli --tag v0.19.0 phonton-cli --locked --force
|
|
84
|
+
```
|
|
189
85
|
|
|
190
|
-
|
|
191
|
-
|---|---|---|
|
|
192
|
-
| Stable | `cargo install --git https://github.com/phonton-dev/phonton-cli --tag v0.16.2 phonton-cli --locked --force` | You want the best validated public alpha |
|
|
193
|
-
| Dev | `cargo install --git https://github.com/phonton-dev/phonton-cli --branch dev phonton-cli --locked --force` | You want next-release integration changes |
|
|
194
|
-
| Nightly | `cargo install --git https://github.com/phonton-dev/phonton-cli --branch nightly phonton-cli --locked --force` | You want daily snapshots and can tolerate breakage |
|
|
195
|
-
| Main | `cargo install --git https://github.com/phonton-dev/phonton-cli --branch main phonton-cli --locked --force` | You want the current release branch tip |
|
|
86
|
+
---
|
|
196
87
|
|
|
197
|
-
|
|
88
|
+
## ⚖️ How We Compare
|
|
198
89
|
|
|
199
|
-
|
|
90
|
+
| Feature | Phonton CLI | Claude Code | Cursor | Aider |
|
|
91
|
+
|---|---|---|---|---|
|
|
92
|
+
| **Privacy Model** | **100% Direct (No Proxy)** | Anthropic Proxy | Cursor Proxy | Direct (No Proxy) |
|
|
93
|
+
| **Telemetry** | **Zero** | Opt-out | Opt-out | Optional |
|
|
94
|
+
| **Multi-Model Support** | **All (BYOK & Local)** | Anthropic Only | Pre-selected | Many |
|
|
95
|
+
| **Subscription Fee** | **$0 (Open Source)** | Usage-based | $20/month | $0 (Open Source) |
|
|
96
|
+
| **Execution Loop** | **Full Plan/Edit/Verify** | Interactive Chat | Interactive Chat | Interactive Chat |
|
|
97
|
+
| **Verification Gates** | **Mandatory 4-Layer** | Manual/Run Command | Manual | Optional |
|
|
98
|
+
| **Memory Spine** | **Semantic SQLite** | None | Simple Context | None |
|
|
200
99
|
|
|
201
|
-
|
|
202
|
-
git clone https://github.com/phonton-dev/phonton-cli.git
|
|
203
|
-
cd phonton-cli
|
|
204
|
-
cargo build --release -p phonton-cli
|
|
205
|
-
```
|
|
100
|
+
---
|
|
206
101
|
|
|
207
|
-
|
|
102
|
+
## 🔄 The Autonomous ADE Loop
|
|
208
103
|
|
|
209
|
-
```
|
|
210
|
-
|
|
104
|
+
```mermaid
|
|
105
|
+
flowchart TD
|
|
106
|
+
Goal["Goal (User Request)"] --> Plan["1. Goal Decomposition (Planner)"]
|
|
107
|
+
Plan --> Graph["2. PlanGraph & Conflict Groups Staged"]
|
|
108
|
+
Graph --> Dispatch["3. Concurrent / Serialized Worker Dispatch"]
|
|
109
|
+
Dispatch --> Edit["4. Bounded Code Modifications (Diff-Only)"]
|
|
110
|
+
Edit --> Verify{"5. Strict Verification Gate"}
|
|
111
|
+
Verify -- FAIL: Surgical Repair Prompt --> Edit
|
|
112
|
+
Verify -- PASS --> Review["6. Reviewable Handoff (HandoffPacket)"]
|
|
113
|
+
Review --> Remember["7. SQLite Memory & Session Snapshot Saved"]
|
|
211
114
|
```
|
|
212
115
|
|
|
213
|
-
|
|
116
|
+
---
|
|
214
117
|
|
|
215
|
-
|
|
216
|
-
.\target\release\phonton.exe
|
|
217
|
-
```
|
|
118
|
+
## 🚀 New in v0.19.0: Swarm Planning & Pluggable Indices
|
|
218
119
|
|
|
219
|
-
|
|
120
|
+
* **Conflict-Aware Swarm Scheduling (`PlanGraph`)**: Broad goals are decomposed into collaborative swarms. Overlapping touch scopes are isolated into Conflict Groups and serialized, while independent subtasks run concurrently to optimize execution time.
|
|
121
|
+
* **Pluggable Code Indexing**: Upgraded `phonton-index` with a pluggable `CodeRetriever` trait. Supports default high-performance `local-hnsw` search and external `qdrant` HTTP vector storage for larger enterprise repositories.
|
|
122
|
+
* **Dynamic MCP Capability Discovery**: Run `phonton mcp capabilities <server-id> [--yes]` to preview server info, exposed tools, and sandbox permission proposals safely before initiating any tool execution.
|
|
123
|
+
* **Robust Browser Verification**: Dynamically injected `NODE_PATH` resolution guarantees Playwright DOM and interaction tests run flawlessly on isolated temp directories and production workspaces alike.
|
|
220
124
|
|
|
221
|
-
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## ⚙️ Configuration
|
|
222
128
|
|
|
223
|
-
|
|
129
|
+
Configure your direct providers and indexing backend in `~/.phonton/config.toml`:
|
|
224
130
|
|
|
225
131
|
```toml
|
|
226
132
|
[provider]
|
|
227
|
-
name = "
|
|
228
|
-
model = "
|
|
229
|
-
|
|
230
|
-
[budget]
|
|
231
|
-
max_tokens = 120000
|
|
232
|
-
max_usd_cents = 200
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
Environment-variable setup examples:
|
|
236
|
-
|
|
237
|
-
```bash
|
|
238
|
-
export ANTHROPIC_API_KEY="..."
|
|
239
|
-
export OPENAI_API_KEY="..."
|
|
240
|
-
export GEMINI_API_KEY="..."
|
|
241
|
-
export OPENROUTER_API_KEY="..."
|
|
242
|
-
export CLOUDFLARE_API_TOKEN="..."
|
|
243
|
-
export CLOUDFLARE_ACCOUNT_ID="..."
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
Windows PowerShell:
|
|
247
|
-
|
|
248
|
-
```powershell
|
|
249
|
-
$env:GEMINI_API_KEY = "..."
|
|
250
|
-
$env:CLOUDFLARE_API_TOKEN = "..."
|
|
251
|
-
$env:CLOUDFLARE_ACCOUNT_ID = "..."
|
|
252
|
-
```
|
|
133
|
+
name = "deepseek"
|
|
134
|
+
model = "deepseek-v4-flash"
|
|
253
135
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
`https://api.cloudflare.com/client/v4/accounts/<id>/ai/v1` base URL override.
|
|
136
|
+
[provider.keys]
|
|
137
|
+
deepseek = "sk-deepseek-api-key-here"
|
|
138
|
+
anthropic = "sk-ant-api-key-here"
|
|
139
|
+
openai = "sk-proj-openai-key-here"
|
|
259
140
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
phonton doctor
|
|
264
|
-
phonton doctor --provider
|
|
141
|
+
[index]
|
|
142
|
+
backend = "local-hnsw"
|
|
265
143
|
```
|
|
266
144
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
## CLI Commands
|
|
270
|
-
|
|
271
|
-
```text
|
|
272
|
-
phonton Launch the interactive TUI
|
|
273
|
-
phonton -r Resume the saved TUI session for this workspace
|
|
274
|
-
phonton init Create ~/.phonton/config.toml if it is missing
|
|
275
|
-
phonton ask [flags] <q> Workspace-aware Q&A using the configured provider
|
|
276
|
-
phonton goal [flags] <p> Execute one goal without launching the TUI
|
|
277
|
-
phonton demo trust-loop Print the evidence-trail demo loop
|
|
278
|
-
phonton doctor Check config, store, trust, git, cargo, and Nexus
|
|
279
|
-
phonton plan <goal> Preview the task DAG and GoalContract without changing files
|
|
280
|
-
phonton review Show verified diff review payloads
|
|
281
|
-
phonton diff Print verified unified diffs from review-ready tasks
|
|
282
|
-
phonton run latest Run the latest receipt-suggested command
|
|
283
|
-
phonton memory list Inspect local decision memory
|
|
284
|
-
phonton extensions Install and inspect skills, steering, MCP servers, and profiles
|
|
285
|
-
phonton mcp list Show configured MCP servers without starting them
|
|
286
|
-
phonton config path Print the resolved config file path
|
|
287
|
-
phonton config show Dump resolved config as TOML
|
|
288
|
-
phonton version Print version
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
Inside the TUI prompt bar:
|
|
292
|
-
|
|
293
|
-
```text
|
|
294
|
-
/settings, /config Open provider/model/budget settings
|
|
295
|
-
/status Show version, provider, model, workspace, and token state
|
|
296
|
-
/review Show review receipt guidance for the selected goal
|
|
297
|
-
/ask <question> Ask a bounded workspace question without queueing a goal
|
|
298
|
-
/plan <goal> Preview a GoalContract and plan without execution
|
|
299
|
-
/approve Execute the selected plan preview
|
|
300
|
-
/diff, /code, d Jump to verified Code/Diff focus
|
|
301
|
-
/memory Inspect local decision memory
|
|
302
|
-
/permissions Show sandbox, trust, and approval status
|
|
303
|
-
/trust Show or revoke workspace trust records
|
|
304
|
-
/model set <name> Save a model preference
|
|
305
|
-
/commands Show slash-command and keyboard help
|
|
306
|
-
/run <cmd> Run a sandboxed command
|
|
307
|
-
!<cmd> Shorthand for a sandboxed command
|
|
308
|
-
Ctrl+V Paste from the Windows clipboard
|
|
309
|
-
Ctrl+U / Ctrl+K Clear before / after cursor
|
|
310
|
-
PgUp / PgDn Scroll the Active receipt/code surface
|
|
311
|
-
Mouse wheel Scroll the visible Active, Ask, or Flight Log surface
|
|
312
|
-
Tab Complete slash commands
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
Plan preview:
|
|
316
|
-
|
|
317
|
-
```bash
|
|
318
|
-
phonton plan --json "add input validation to config loading"
|
|
319
|
-
```
|
|
145
|
+
To enable the external **Qdrant** backend:
|
|
320
146
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
```bash
|
|
327
|
-
phonton goal --prompt-file prompt.md --yes --permission-mode full-access --timeout-seconds 900 --json
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
The headless command runs the same planner, worker, verifier, review receipt,
|
|
331
|
-
memory, extension, MCP, and OutcomeLedger path used by the TUI. `--yes`
|
|
332
|
-
records workspace trust for the current run, and `--permission-mode` keeps the
|
|
333
|
-
automation posture explicit.
|
|
334
|
-
|
|
335
|
-
Review latest completed task:
|
|
336
|
-
|
|
337
|
-
```bash
|
|
338
|
-
phonton review latest
|
|
339
|
-
phonton review latest --markdown
|
|
340
|
-
phonton review approve latest
|
|
341
|
-
phonton review reject latest
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
Run the latest suggested command from a review receipt:
|
|
345
|
-
|
|
346
|
-
```bash
|
|
347
|
-
phonton run latest
|
|
348
|
-
phonton run latest --index 2
|
|
147
|
+
```toml
|
|
148
|
+
[index]
|
|
149
|
+
backend = "qdrant"
|
|
150
|
+
qdrant_url = "http://127.0.0.1:6333"
|
|
151
|
+
qdrant_collection = "phonton-code"
|
|
349
152
|
```
|
|
350
153
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
phonton memory list --json
|
|
355
|
-
phonton memory edit <id> "updated rationale"
|
|
356
|
-
phonton memory pin <id>
|
|
357
|
-
phonton memory delete <id>
|
|
358
|
-
```
|
|
154
|
+
---
|
|
359
155
|
|
|
360
|
-
|
|
156
|
+
## 🛠️ Commands Reference
|
|
361
157
|
|
|
362
158
|
```bash
|
|
363
|
-
|
|
364
|
-
phonton
|
|
365
|
-
phonton extensions install https://github.com/phonton-dev/phonton-review-gate-extension
|
|
366
|
-
phonton extensions new ./my-extension skill
|
|
367
|
-
phonton extensions list --json
|
|
368
|
-
phonton extensions doctor --json
|
|
369
|
-
phonton extensions validate --json
|
|
370
|
-
phonton skills list --json
|
|
371
|
-
phonton steering list --json
|
|
372
|
-
phonton mcp list --json
|
|
373
|
-
```
|
|
374
|
-
|
|
375
|
-
## How Phonton Handles Context
|
|
376
|
-
|
|
377
|
-
<p align="center">
|
|
378
|
-
<img src="assets/readme/context-efficiency.png" alt="Diagram contrasting whole repo context with compact context packs and verified diffs">
|
|
379
|
-
</p>
|
|
380
|
-
|
|
381
|
-
Phonton is built around a simple rule: do not blindly dump the whole repo into the model.
|
|
382
|
-
|
|
383
|
-
```mermaid
|
|
384
|
-
flowchart TD
|
|
385
|
-
Repo["Local repo"] --> Index["Source index"]
|
|
386
|
-
Index --> Planner["Planner"]
|
|
387
|
-
Planner --> Pack["Task-specific context"]
|
|
388
|
-
Pack --> Worker["Worker"]
|
|
389
|
-
Worker --> Verify["Verify"]
|
|
390
|
-
Verify --> Review["Review"]
|
|
391
|
-
Review --> Store["Memory and event store"]
|
|
392
|
-
Store --> Planner
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
The intended result is lower context waste and better reviewability. The honest way to prove that is with benchmarks, so this repo includes a benchmark harness instead of hard-coded marketing numbers.
|
|
396
|
-
|
|
397
|
-
## Benchmarks
|
|
398
|
-
|
|
399
|
-
Run the plan benchmark harness:
|
|
159
|
+
# Launch the interactive Ratatui TUI
|
|
160
|
+
phonton
|
|
400
161
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
```
|
|
162
|
+
# Run a goal non-interactively through the full plan/edit/verify pipeline
|
|
163
|
+
phonton goal "add input validation to config loading" --yes
|
|
404
164
|
|
|
405
|
-
|
|
165
|
+
# Preview the subtask graph and Conflict Groups without editing files
|
|
166
|
+
phonton plan "refactor auth layer"
|
|
406
167
|
|
|
407
|
-
|
|
168
|
+
# Audit configuration, API keys, database, and vector index connectivity
|
|
169
|
+
phonton doctor --provider
|
|
408
170
|
|
|
409
|
-
|
|
171
|
+
# Export benchmark telemetry from the latest run
|
|
410
172
|
phonton benchmark export --latest --format json
|
|
411
|
-
phonton proof export --latest --format json
|
|
412
|
-
phonton context eval fixtures/context.json --format json
|
|
413
|
-
phonton context diff --indexed --non-indexed fixtures/context.json --format json
|
|
414
|
-
phonton why-tokens --by-source
|
|
415
|
-
```
|
|
416
|
-
|
|
417
|
-
Benchmark exports label token comparability explicitly: `token_usage_source`, `execution_mode`, `provider_call_count`, `token_claim_eligible`, and `benchmark_warnings`. Only verified provider runs with `token_claim_eligible: true` are valid for public token-efficiency claims. Estimated, local-template, mixed, unavailable, and failed runs remain useful product evidence, but they must stay out of headline token comparisons.
|
|
418
|
-
|
|
419
|
-
Read the methodology in [docs/BENCHMARKS.md](docs/BENCHMARKS.md).
|
|
420
|
-
|
|
421
|
-
Important: benchmark output is evidence, not a slogan. Do not claim "X percent savings" publicly until you can reproduce it on multiple real tasks and include the raw report.
|
|
422
|
-
|
|
423
|
-
## Architecture
|
|
424
|
-
|
|
425
|
-
```mermaid
|
|
426
|
-
flowchart TB
|
|
427
|
-
CLI["phonton-cli"] --> Planner["phonton-planner"]
|
|
428
|
-
CLI --> Orchestrator["phonton-orchestrator"]
|
|
429
|
-
Orchestrator --> Worker["phonton-worker"]
|
|
430
|
-
Orchestrator --> Verify["phonton-verify"]
|
|
431
|
-
Worker --> Providers["phonton-providers"]
|
|
432
|
-
Worker --> Context["phonton-context"]
|
|
433
|
-
Context --> Index["phonton-index"]
|
|
434
|
-
Verify --> Diff["phonton-diff"]
|
|
435
|
-
Verify --> Sandbox["phonton-sandbox"]
|
|
436
|
-
Planner --> Memory["phonton-memory"]
|
|
437
|
-
Memory --> Store["phonton-store"]
|
|
438
|
-
Types["phonton-types"] --> CLI
|
|
439
|
-
Types --> Orchestrator
|
|
440
|
-
Types --> Worker
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
Repository layout:
|
|
444
|
-
|
|
445
|
-
- `phonton-cli` - terminal UI and user-facing command surface.
|
|
446
|
-
- `phonton-planner` - goal decomposition and plan preview.
|
|
447
|
-
- `phonton-orchestrator` - task state, dependencies, retries, and event flow.
|
|
448
|
-
- `phonton-worker` - model-call loop, tool policy, and patch generation.
|
|
449
|
-
- `phonton-verify` - syntax/type/test/decision checks before review.
|
|
450
|
-
- `phonton-index` - local source indexing and semantic retrieval.
|
|
451
|
-
- `phonton-context` - task-specific context compilation.
|
|
452
|
-
- `phonton-diff` - diff application and rollback support.
|
|
453
|
-
- `phonton-memory` / `phonton-store` - local persistence and decision memory.
|
|
454
|
-
- `phonton-providers` - BYOK provider adapters.
|
|
455
|
-
- `phonton-sandbox` - command execution policy.
|
|
456
|
-
- `phonton-types` - shared domain contracts.
|
|
457
|
-
|
|
458
|
-
## Release Checks
|
|
459
|
-
|
|
460
|
-
Before cutting a release:
|
|
461
|
-
|
|
462
|
-
```powershell
|
|
463
|
-
.\scripts\release-check.ps1
|
|
464
173
|
```
|
|
465
174
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
Manual checks worth doing before a public release:
|
|
469
|
-
|
|
470
|
-
- Fresh clone install on Windows, macOS, and Linux.
|
|
471
|
-
- `phonton doctor --provider` with at least one hosted provider, confirming both model discovery and a completion call.
|
|
472
|
-
- One real repo task from goal to reviewable verified diff.
|
|
473
|
-
- Benchmark report committed or attached to the release notes.
|
|
474
|
-
- No secrets printed in logs, screenshots, or benchmark output.
|
|
175
|
+
---
|
|
475
176
|
|
|
476
|
-
##
|
|
177
|
+
## 🗺️ Crate Architecture
|
|
477
178
|
|
|
478
|
-
Phonton is
|
|
179
|
+
Phonton is written entirely in Rust for performance, correctness, and low memory overhead:
|
|
180
|
+
* `phonton-cli`: Interactive TUI, headless runner, benchmark, and CLI commands.
|
|
181
|
+
* `phonton-planner`: Multi-model goal decomposition and `PlanGraph` sidecar staging.
|
|
182
|
+
* `phonton-orchestrator`: Swarm scheduler, Conflict Group serialization, and verifier pipeline execution.
|
|
183
|
+
* `phonton-worker`: Highly optimized context assembler and diff-only code modifier.
|
|
184
|
+
* `phonton-index`: Local HNSW symbol index and Qdrant integration.
|
|
185
|
+
* `phonton-verify`: Four-layer static checkers (Tree-Sitter, Cargo, Playwright Browser/Screenshot).
|
|
186
|
+
* `phonton-mcp`: Lazy initialization client, permission gates, and capabilities descriptor.
|
|
479
187
|
|
|
480
|
-
|
|
481
|
-
|---|---|---|
|
|
482
|
-
| Codex | Mature agent workflow, cloud/editor/CLI integration | Local-first ADE kernel, BYOK, explicit verification and review surfaces |
|
|
483
|
-
| Claude Code | Excellent terminal-native coding agent | Less chat-first, more plan/verify/review oriented |
|
|
484
|
-
| Cursor | Polished AI editor experience | Less editor polish, more auditable repo workflow |
|
|
485
|
-
| Windsurf | Agentic IDE workflow | Narrower release scope, explicit local-first positioning |
|
|
486
|
-
| Phonton CLI | Verified local ADE loop for serious repo tasks | Early product, smaller ecosystem, benchmark claims still being built |
|
|
188
|
+
---
|
|
487
189
|
|
|
488
|
-
##
|
|
190
|
+
## 💖 Star History
|
|
489
191
|
|
|
490
|
-
|
|
491
|
-
cargo fmt --all -- --check
|
|
492
|
-
cargo clippy --locked --workspace --all-targets -- -D warnings
|
|
493
|
-
cargo test --locked --workspace
|
|
494
|
-
cargo build --locked --release -p phonton-cli
|
|
495
|
-
```
|
|
192
|
+
If you support a privacy-first, fully autonomous developer experience, please leave us a star!
|
|
496
193
|
|
|
497
|
-
|
|
194
|
+
[](https://www.star-history.com/?repos=phonton-dev%2Fphonton-cli&type=date&legend=top-left)
|
|
498
195
|
|
|
499
|
-
|
|
500
|
-
cargo run -p phonton-cli -- doctor
|
|
501
|
-
cargo run -p phonton-cli -- plan "add input validation to config loading"
|
|
502
|
-
```
|
|
196
|
+
---
|
|
503
197
|
|
|
504
|
-
## License
|
|
198
|
+
## 📄 License
|
|
505
199
|
|
|
506
200
|
Licensed under either of:
|
|
201
|
+
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
|
|
202
|
+
* MIT License ([LICENSE-MIT](LICENSE-MIT))
|
|
507
203
|
|
|
508
|
-
|
|
509
|
-
- MIT License
|
|
510
|
-
|
|
511
|
-
at your option.
|
|
512
|
-
|
|
513
|
-
## Star History
|
|
514
|
-
|
|
515
|
-
[](https://www.star-history.com/?repos=phonton-dev%2Fphonton-cli&type=date&legend=top-left)
|
|
204
|
+
At your option.
|
package/npm/bin/phonton.js
CHANGED
|
@@ -4,18 +4,14 @@ const fs = require("fs");
|
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const { spawn, spawnSync } = require("child_process");
|
|
6
6
|
|
|
7
|
-
const packageJson = require("../../package.json");
|
|
8
7
|
const binaryName = process.platform === "win32" ? "phonton.exe" : "phonton";
|
|
9
8
|
const configuredBinary = process.env.PHONTON_BINARY || process.env.PHONTON_CLI_BINARY;
|
|
10
9
|
const binaryPath = configuredBinary
|
|
11
10
|
? path.resolve(configuredBinary)
|
|
12
11
|
: path.join(__dirname, "..", "vendor", binaryName);
|
|
13
|
-
const vendorDir = path.join(__dirname, "..", "vendor");
|
|
14
|
-
const markerPath = path.join(vendorDir, "version.json");
|
|
15
12
|
|
|
16
13
|
function ensureBinary() {
|
|
17
|
-
if (
|
|
18
|
-
assertBinaryVersion(binaryPath);
|
|
14
|
+
if (fs.existsSync(binaryPath)) {
|
|
19
15
|
return;
|
|
20
16
|
}
|
|
21
17
|
|
|
@@ -24,53 +20,11 @@ function ensureBinary() {
|
|
|
24
20
|
process.exit(1);
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
fs.rmSync(vendorDir, { recursive: true, force: true });
|
|
32
|
-
|
|
33
|
-
const installScript = process.env.PHONTON_INSTALL_SCRIPT || path.join(__dirname, "..", "install.js");
|
|
23
|
+
const installScript = path.join(__dirname, "..", "install.js");
|
|
34
24
|
const result = spawnSync(process.execPath, [installScript], { stdio: "inherit" });
|
|
35
25
|
if (result.status !== 0 || !fs.existsSync(binaryPath)) {
|
|
36
26
|
process.exit(result.status || 1);
|
|
37
27
|
}
|
|
38
|
-
assertBinaryVersion(binaryPath);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function vendorMatchesPackage() {
|
|
42
|
-
try {
|
|
43
|
-
const marker = JSON.parse(fs.readFileSync(markerPath, "utf8"));
|
|
44
|
-
return (
|
|
45
|
-
marker.version === packageJson.version &&
|
|
46
|
-
marker.platform === process.platform &&
|
|
47
|
-
marker.arch === process.arch
|
|
48
|
-
);
|
|
49
|
-
} catch (_error) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function assertBinaryVersion(candidate) {
|
|
55
|
-
const check = binaryVersionMatches(candidate);
|
|
56
|
-
if (!check.ok) {
|
|
57
|
-
console.error(`Installed Phonton binary is stale or invalid: expected ${check.expected}, got ${check.output}`);
|
|
58
|
-
if (!configuredBinary) {
|
|
59
|
-
fs.rmSync(vendorDir, { recursive: true, force: true });
|
|
60
|
-
}
|
|
61
|
-
process.exit(1);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function binaryVersionMatches(candidate) {
|
|
66
|
-
const result = spawnSync(candidate, ["version"], { encoding: "utf8" });
|
|
67
|
-
const output = `${result.stdout || ""}${result.stderr || ""}`.trim() || "no output";
|
|
68
|
-
const expected = `phonton ${packageJson.version}`;
|
|
69
|
-
return {
|
|
70
|
-
ok: result.status === 0 && output.includes(expected),
|
|
71
|
-
expected,
|
|
72
|
-
output,
|
|
73
|
-
};
|
|
74
28
|
}
|
|
75
29
|
|
|
76
30
|
ensureBinary();
|
package/npm/install.js
CHANGED
|
@@ -12,7 +12,6 @@ const repo = "phonton-dev/phonton-cli";
|
|
|
12
12
|
const version = packageJson.version;
|
|
13
13
|
const tag = process.env.PHONTON_RELEASE_TAG || (version.includes("nightly") ? "nightly" : `v${version}`);
|
|
14
14
|
const vendorDir = path.join(__dirname, "vendor");
|
|
15
|
-
const markerPath = path.join(vendorDir, "version.json");
|
|
16
15
|
|
|
17
16
|
const targets = {
|
|
18
17
|
"linux-x64": {
|
|
@@ -56,20 +55,6 @@ download(url, archivePath)
|
|
|
56
55
|
if (process.platform !== "win32") {
|
|
57
56
|
fs.chmodSync(binaryPath, 0o755);
|
|
58
57
|
}
|
|
59
|
-
fs.writeFileSync(
|
|
60
|
-
markerPath,
|
|
61
|
-
`${JSON.stringify(
|
|
62
|
-
{
|
|
63
|
-
version,
|
|
64
|
-
tag,
|
|
65
|
-
asset: target.asset,
|
|
66
|
-
platform: process.platform,
|
|
67
|
-
arch: process.arch,
|
|
68
|
-
},
|
|
69
|
-
null,
|
|
70
|
-
2,
|
|
71
|
-
)}\n`,
|
|
72
|
-
);
|
|
73
58
|
console.log(`Installed Phonton CLI ${tag} for ${process.platform}-${process.arch}`);
|
|
74
59
|
})
|
|
75
60
|
.catch((error) => {
|
package/npm/test-wrapper.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const fs = require("fs");
|
|
4
|
-
const os = require("os");
|
|
5
4
|
const path = require("path");
|
|
6
5
|
const { spawnSync } = require("child_process");
|
|
7
6
|
|
|
@@ -19,118 +18,24 @@ if (!binary) {
|
|
|
19
18
|
process.exit(1);
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
env
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
});
|
|
21
|
+
const result = spawnSync(process.execPath, [path.join(root, "npm", "bin", "phonton.js"), "version"], {
|
|
22
|
+
cwd: root,
|
|
23
|
+
encoding: "utf8",
|
|
24
|
+
env: {
|
|
25
|
+
...process.env,
|
|
26
|
+
PHONTON_BINARY: binary,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
process.stdout.write(result.stdout || "");
|
|
31
|
+
process.stderr.write(result.stderr || "");
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return result.stdout;
|
|
33
|
+
if (result.status !== 0) {
|
|
34
|
+
process.exit(result.status || 1);
|
|
40
35
|
}
|
|
41
36
|
|
|
42
|
-
const versionOutput = runWrapper(["version"]);
|
|
43
|
-
|
|
44
37
|
const expected = `phonton ${packageJson.version}`;
|
|
45
|
-
if (!
|
|
38
|
+
if (!result.stdout.includes(expected)) {
|
|
46
39
|
console.error(`Expected npm wrapper to report ${expected}.`);
|
|
47
40
|
process.exit(1);
|
|
48
41
|
}
|
|
49
|
-
|
|
50
|
-
testStaleVendorReinstall();
|
|
51
|
-
|
|
52
|
-
const goal = "add input validation to config loading";
|
|
53
|
-
const planOutput = runWrapper(["plan", "--json", "--no-memory", goal]);
|
|
54
|
-
let planJson;
|
|
55
|
-
try {
|
|
56
|
-
planJson = JSON.parse(planOutput);
|
|
57
|
-
} catch (error) {
|
|
58
|
-
console.error(`Expected plan --json to emit parseable JSON: ${error.message}`);
|
|
59
|
-
process.exit(1);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (!planJson.goal_contract) {
|
|
63
|
-
console.error("Expected plan --json to expose goal_contract at the top level.");
|
|
64
|
-
process.exit(1);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (planJson.goal_contract.goal !== goal) {
|
|
68
|
-
console.error("Expected plan --json goal_contract.goal to match the requested goal.");
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function testStaleVendorReinstall() {
|
|
73
|
-
const vendorDir = path.join(root, "npm", "vendor");
|
|
74
|
-
const vendorBinary = path.join(vendorDir, binaryName);
|
|
75
|
-
const markerPath = path.join(vendorDir, "version.json");
|
|
76
|
-
const installScript = path.join(os.tmpdir(), `phonton-test-install-${process.pid}.js`);
|
|
77
|
-
|
|
78
|
-
fs.rmSync(vendorDir, { recursive: true, force: true });
|
|
79
|
-
fs.mkdirSync(vendorDir, { recursive: true });
|
|
80
|
-
fs.copyFileSync(binary, vendorBinary);
|
|
81
|
-
if (process.platform !== "win32") {
|
|
82
|
-
fs.chmodSync(vendorBinary, 0o755);
|
|
83
|
-
}
|
|
84
|
-
fs.writeFileSync(
|
|
85
|
-
markerPath,
|
|
86
|
-
JSON.stringify({
|
|
87
|
-
version: "0.0.0-stale",
|
|
88
|
-
platform: process.platform,
|
|
89
|
-
arch: process.arch,
|
|
90
|
-
}),
|
|
91
|
-
);
|
|
92
|
-
|
|
93
|
-
fs.writeFileSync(
|
|
94
|
-
installScript,
|
|
95
|
-
`
|
|
96
|
-
const fs = require("fs");
|
|
97
|
-
const path = require("path");
|
|
98
|
-
const vendorDir = ${JSON.stringify(vendorDir)};
|
|
99
|
-
const binary = ${JSON.stringify(binary)};
|
|
100
|
-
const binaryName = ${JSON.stringify(binaryName)};
|
|
101
|
-
const version = ${JSON.stringify(packageJson.version)};
|
|
102
|
-
fs.mkdirSync(vendorDir, { recursive: true });
|
|
103
|
-
fs.copyFileSync(binary, path.join(vendorDir, binaryName));
|
|
104
|
-
if (process.platform !== "win32") fs.chmodSync(path.join(vendorDir, binaryName), 0o755);
|
|
105
|
-
fs.writeFileSync(path.join(vendorDir, "version.json"), JSON.stringify({
|
|
106
|
-
version,
|
|
107
|
-
platform: process.platform,
|
|
108
|
-
arch: process.arch,
|
|
109
|
-
}, null, 2));
|
|
110
|
-
`,
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
try {
|
|
114
|
-
const result = spawnSync(process.execPath, [path.join(root, "npm", "bin", "phonton.js"), "version"], {
|
|
115
|
-
cwd: root,
|
|
116
|
-
encoding: "utf8",
|
|
117
|
-
env: {
|
|
118
|
-
...process.env,
|
|
119
|
-
PHONTON_INSTALL_SCRIPT: installScript,
|
|
120
|
-
PHONTON_BINARY: "",
|
|
121
|
-
PHONTON_CLI_BINARY: "",
|
|
122
|
-
},
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
process.stdout.write(result.stdout || "");
|
|
126
|
-
process.stderr.write(result.stderr || "");
|
|
127
|
-
|
|
128
|
-
if (result.status !== 0 || !result.stdout.includes(expected)) {
|
|
129
|
-
console.error("Expected npm wrapper to refresh stale vendor binary metadata.");
|
|
130
|
-
process.exit(result.status || 1);
|
|
131
|
-
}
|
|
132
|
-
} finally {
|
|
133
|
-
fs.rmSync(installScript, { force: true });
|
|
134
|
-
fs.rmSync(vendorDir, { recursive: true, force: true });
|
|
135
|
-
}
|
|
136
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phonton-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Local-first agentic development terminal with context packs, source handles, and verification gates.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/phonton-dev/phonton-cli#readme",
|
|
@@ -41,5 +41,9 @@
|
|
|
41
41
|
],
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=18"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@playwright/test": "^1.60.0",
|
|
47
|
+
"playwright": "^1.60.0"
|
|
44
48
|
}
|
|
45
49
|
}
|