@xcompiler/cli 0.2.3 → 0.2.4
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.CN.md +137 -202
- package/README.md +138 -205
- package/config.example.yaml +64 -32
- package/debug-wiki/README.md +12 -0
- package/debug-wiki/wiki/agent/calibration-fixtures.md +33 -0
- package/debug-wiki/wiki/agent/calibration-network-api.md +36 -0
- package/debug-wiki/wiki/agent/calibration-python-imports.md +33 -0
- package/debug-wiki/wiki/system/debug-issue-flow.md +29 -0
- package/debug-wiki/wiki/system/no-poisoning.md +29 -0
- package/dist/acp/index.d.ts +17 -2
- package/dist/acp/index.js +2403 -432
- package/dist/acp/index.js.map +1 -1
- package/dist/cli/xcompiler.js +2507 -523
- package/dist/cli/xcompiler.js.map +1 -1
- package/dist/cli/xcompiler_build.js +730 -248
- package/dist/cli/xcompiler_build.js.map +1 -1
- package/dist/cli/xcompiler_run.js +2185 -359
- package/dist/cli/xcompiler_run.js.map +1 -1
- package/dist/plugins/index.d.ts +16 -3
- package/dist/plugins/index.js +27 -17
- package/dist/plugins/index.js.map +1 -1
- package/dist/runtime/runtime.d.ts +38 -13
- package/dist/runtime/runtime.js +2495 -515
- package/dist/runtime/runtime.js.map +1 -1
- package/docs/XCompiler_design.md +542 -0
- package/docs/acp.md +4 -4
- package/docs/assets/iterative-v-model-pipeline.svg +169 -0
- package/docs/assets/system-architecture.svg +134 -0
- package/docs/assets/xcompiler-icon.png +0 -0
- package/docs/deploy.md +381 -0
- package/docs/openrouter.md +10 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,289 +1,222 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/xcompiler-icon.png" alt="XCompiler logo" width="128" height="128" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
>
|
|
4
|
-
> Turn one paragraph of natural-language requirements into a runnable, tested, deliverable Python or TypeScript project
|
|
5
|
-
> Apache License 2.0
|
|
5
|
+
<h1 align="center">XCompiler</h1>
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>AI Software Factory Runtime</strong>
|
|
9
|
+
</p>
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
> Turn natural-language requirements into runnable, tested Python or TypeScript projects through an iterative V-model workflow.
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://www.npmjs.com/package/@xcompiler/cli"><img src="https://img.shields.io/npm/v/@xcompiler/cli.svg" alt="npm package" /></a>
|
|
15
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="Apache-2.0 license" /></a>
|
|
16
|
+
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D24-brightgreen.svg" alt="Node.js >= 24" /></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
Languages: **EN** (default) · [简体中文](README.CN.md)
|
|
11
20
|
|
|
12
21
|
---
|
|
13
22
|
|
|
14
|
-
## What
|
|
23
|
+
## What XCompiler Does
|
|
15
24
|
|
|
16
|
-
XCompiler
|
|
25
|
+
XCompiler is a reusable AI software factory runtime. It compiles a product request into an executable engineering plan, then runs that plan with sandboxed agents, guarded tools, tests, debug loops, audit logs, and resumable project state.
|
|
17
26
|
|
|
18
27
|
| Command | Role | Input | Output |
|
|
19
28
|
|---|---|---|---|
|
|
20
|
-
|
|
|
21
|
-
|
|
|
29
|
+
| `xcompiler build` | Compile requirements into a `phasePlan.json` plus the current phase plan, such as `plan.P1.json` | Requirement text (`-i req.md`, `-t topic.md`, or interactive input) | `topic.md`, `phasePlan.json`, `plan.P1.json`, `plan.md`, `<name>.xc` |
|
|
30
|
+
| `xcompiler run` | Execute the current phase through the V-model workflow | `phasePlan.json` or legacy `plan.json` | Runnable project, tests, docs, audit trail, updated progress |
|
|
31
|
+
| `xcompiler load` | Resume from a project file | `<name>.xc` | Continue the saved phase/task state |
|
|
32
|
+
| `xcompiler append` / `xcompiler evolve` | Add new requirements to an existing project | Existing workspace/project file plus new requirement | Incremental plan and implementation |
|
|
33
|
+
| `xcompiler acp` | Run as an ACP code-agent adapter | stdio JSON-RPC from an IDE/editor | Runtime-backed code-agent events and results |
|
|
22
34
|
|
|
23
|
-
|
|
24
|
-
> Difference: XCompiler's "instructions" are V-model phases (REQUIREMENT / ARCH / CODE / TEST / REFACTOR / DELIVERY), and each "execution unit" is a sandbox-constrained multi-Agent loop.
|
|
25
|
-
|
|
26
|
-
Every Step gets a git snapshot and an audit-log entry; failures automatically enter a DEBUG retry loop (≤ 3 rounds).
|
|
35
|
+
The current architecture treats **Runtime as the only business entry point**. CLI and ACP are adapters: they parse input, load config, render output, and listen to Runtime events, while Runtime owns build/run/workflow/agent/tool/plugin/memory behavior.
|
|
27
36
|
|
|
28
37
|
---
|
|
29
38
|
|
|
30
|
-
##
|
|
31
|
-
|
|
32
|
-
XCompiler encodes the **V-model** of software engineering directly as the decomposition skeleton of `xcompiler build` and the execution scheduler of `xcompiler run`. Each phase has mandatory artefacts, a tool whitelist, and a quality gate:
|
|
39
|
+
## Iterative V-Model Pipeline
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
┌────────── xcompiler build (AI Compiler) ──────────┐
|
|
36
|
-
│ │
|
|
37
|
-
Requirement ──► Intake ──► Clarify ──► PhasePlan ──► plan.P1.json
|
|
38
|
-
(NL) │ │
|
|
39
|
-
└─ Gate 1 ───┘ Gate 2 (two human confirmation gates)
|
|
41
|
+
XCompiler combines a phase iteration model with the V-model. The planner first creates a high-level `phasePlan.json`, then expands only the active phase into a concrete `plan.P<N>.json`. Each current phase runs a full V-model cycle; future phases stay as goals until they become active.
|
|
40
42
|
|
|
43
|
+
<p align="center">
|
|
44
|
+
<img src="docs/assets/iterative-v-model-pipeline.svg" alt="Iterative V-Model Pipeline" />
|
|
45
|
+
</p>
|
|
41
46
|
|
|
42
|
-
|
|
43
|
-
│ topology executes V-model left → right │
|
|
47
|
+
V-model behavior:
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
CODE ◄────── test gate ──────────► TEST
|
|
52
|
-
│ ▲
|
|
53
|
-
└─────────────► DEBUG (≤3 retries) ──────┘
|
|
54
|
-
(auto failure loop)
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
| Phase | Lead Agent / Skill | Mandatory Artefact | Quality Gate |
|
|
58
|
-
|---|---|---|---|
|
|
59
|
-
| REQUIREMENT | Planner | `topic.md` | Gate 1 human confirmation |
|
|
60
|
-
| ARCH | Architect | `architecture.md`;TypeScript 同步维护 `package.json` | plan lint |
|
|
61
|
-
| CODE | Coder (`patcher` / `author`) | `src/**.{py,ts}` | EditGuard line cap |
|
|
62
|
-
| TEST | Tester (`tester`) | `tests/**.{py,ts}` | **tests exit=0** |
|
|
63
|
-
| DEBUG | Debugger (`debugger`) | fix patch | ≤ `max_debug_retries` |
|
|
64
|
-
| REFACTOR | Refactorer | optimised `src/` | tests do not regress |
|
|
65
|
-
| DELIVERY | Author | `docs/05-delivery.md` | All Steps DONE + entry `--help` =0 |
|
|
49
|
+
- `REQUIREMENT_ANALYSIS`, `HIGH_LEVEL_DESIGN`, `DETAILED_DESIGN`, and `CODE` generate their paired downstream test expectations.
|
|
50
|
+
- `HIGH_LEVEL_DESIGN` defines system-level interfaces, external APIs, third-party libraries, and dependencies.
|
|
51
|
+
- `DETAILED_DESIGN` defines internal module structure and implementation details.
|
|
52
|
+
- Test failures are first recorded as issues, then routed back to the matching upstream stage for Debugger repair.
|
|
53
|
+
- Completed-phase debug must provide a real patch/rewrite or successful verification evidence.
|
|
54
|
+
- Network/API failures are treated as real gates: if the project API fails, the run must repair or switch API instead of hiding the failure.
|
|
66
55
|
|
|
67
56
|
---
|
|
68
57
|
|
|
69
|
-
## System
|
|
70
|
-
|
|
71
|
-
```text
|
|
72
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
73
|
-
│ CLI layer │
|
|
74
|
-
│ xcompiler ─┬─ xcompiler build (= xcompiler_build) AI Compiler │
|
|
75
|
-
│ └─ xcompiler run (= xcompiler_run) AI Executor │
|
|
76
|
-
│ + xcompiler ls / show │
|
|
77
|
-
└──────────────────┬───────────────────────────────┬──────────────┘
|
|
78
|
-
│ │
|
|
79
|
-
▼ ▼
|
|
80
|
-
┌────────────────────┐ ┌──────────────────────┐
|
|
81
|
-
│ Planner (compile) │ │ PhaseEngine (run) │
|
|
82
|
-
│ - intake/clarify │ │ - topology sched. │
|
|
83
|
-
│ - decompose (V) │ │ - DEBUG loop │
|
|
84
|
-
│ - plan lint │ │ - resumable │
|
|
85
|
-
└─────────┬──────────┘ └──────────┬───────────┘
|
|
86
|
-
│ │
|
|
87
|
-
▼ ▼
|
|
88
|
-
┌──────────────────────────────────────────────┐
|
|
89
|
-
│ Agent / Skill layer │
|
|
90
|
-
│ Architect · Coder · Tester · Debugger · │
|
|
91
|
-
│ Refactorer · Author │
|
|
92
|
-
│ Skills: patcher / author / tester / │
|
|
93
|
-
│ dep_resolver / debugger / refactor │
|
|
94
|
-
└──────────────────┬───────────────────────────┘
|
|
95
|
-
│
|
|
96
|
-
▼
|
|
97
|
-
┌─────────────────────────────────────────────────────┐
|
|
98
|
-
│ Tool layer (whitelist + EditGuard) │
|
|
99
|
-
│ read_file · write_file · append_file · │
|
|
100
|
-
│ replace_in_file · run_program · run_tests · git_* │
|
|
101
|
-
└──────────────────┬──────────────────────────────────┘
|
|
102
|
-
│
|
|
103
|
-
┌──────────────┼──────────────────┐
|
|
104
|
-
▼ ▼ ▼
|
|
105
|
-
┌──────────────┐ ┌──────────────┐ ┌──────────────────┐
|
|
106
|
-
│ LLM Router │ │ Sandbox │ │ Workspace │
|
|
107
|
-
│ chain + │ │ subprocess │ │ git + audit │
|
|
108
|
-
│ fallback │ │ / docker │ │ + .xcompiler/ │
|
|
109
|
-
│ (ollama, │ │ venv iso. │ │ phasePlan/plan.Px │
|
|
110
|
-
│ openai) │ │ │ │ │
|
|
111
|
-
└──────────────┘ └──────────────┘ └──────────────────┘
|
|
112
|
-
```
|
|
58
|
+
## System Architecture
|
|
113
59
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
60
|
+
<p align="center">
|
|
61
|
+
<img src="docs/assets/system-architecture.svg" alt="XCompiler System Architecture" />
|
|
62
|
+
</p>
|
|
117
63
|
|
|
118
64
|
Layer responsibilities:
|
|
119
65
|
|
|
120
|
-
- **
|
|
121
|
-
- **
|
|
122
|
-
- **
|
|
123
|
-
- **
|
|
124
|
-
- **
|
|
125
|
-
- **
|
|
126
|
-
- **Workspace**:
|
|
66
|
+
- **Adapters**: argument/protocol parsing, config loading, user interaction, output rendering, exit codes.
|
|
67
|
+
- **Runtime**: Runtime API, Build Service, Run Service, Event Stream, and Permission Broker; the only business entry point.
|
|
68
|
+
- **Workflow and planning**: phase iteration, V-model scheduling, rollback/debug routing, iteration gates, resume.
|
|
69
|
+
- **Agents / Skills**: role-specific prompts plus allowed tools for each stage.
|
|
70
|
+
- **Tools**: guarded file edits, program/test execution, API fetches, dependency edits, git snapshots.
|
|
71
|
+
- **LLM Router**: role chains, provider scores, cluster fallbacks, OpenAI-compatible/Ollama clients, audit.
|
|
72
|
+
- **Workspace**: `phasePlan.json`, `plan.P<N>.json`, `<name>.xc`, `.xcompiler/audit.jsonl`, debug cache, project memory.
|
|
127
73
|
|
|
128
74
|
---
|
|
129
75
|
|
|
130
|
-
##
|
|
76
|
+
## Install From npm
|
|
131
77
|
|
|
132
78
|
```bash
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
cp .
|
|
136
|
-
cp
|
|
79
|
+
npm install -g @xcompiler/cli
|
|
80
|
+
mkdir xcompiler-demo && cd xcompiler-demo
|
|
81
|
+
cp "$(npm root -g)/@xcompiler/cli/config.example.yaml" config.yaml
|
|
82
|
+
cp "$(npm root -g)/@xcompiler/cli/.env.example" .env
|
|
83
|
+
# Edit .env and set OPENROUTER_API_KEY
|
|
84
|
+
xcompiler doctor
|
|
85
|
+
```
|
|
137
86
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
87
|
+
The default template uses OpenRouter Free mode through a `type: openai` OpenAI-compatible provider:
|
|
88
|
+
|
|
89
|
+
```yaml
|
|
90
|
+
model: openrouter/free
|
|
91
|
+
base_url: https://openrouter.ai/api/v1
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`config.yaml`, `llm_scores.yaml`, and `llm_scores_user.yaml` are local files and are intentionally not committed. The npm package ships `config.example.yaml` and `.env.example` as templates. `llm_scores.yaml` is XCompiler-maintained runtime state; create `llm_scores_user.yaml` only when you want fixed local score overrides such as `provider: 0` to disable one provider.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Quick Start
|
|
142
99
|
|
|
143
|
-
|
|
100
|
+
```bash
|
|
144
101
|
echo "Parse a DBC file into an Excel report" > req.md
|
|
145
102
|
xcompiler build -i req.md --yes
|
|
146
|
-
|
|
147
|
-
# 4. Execute the plan
|
|
148
103
|
xcompiler run /tmp/xcompiler-<timestamp>/phasePlan.json
|
|
149
|
-
|
|
150
|
-
# 5. Resume later from the generated project file
|
|
151
104
|
xcompiler load /tmp/xcompiler-<timestamp>/xcompiler-<timestamp>.xc
|
|
152
105
|
```
|
|
153
106
|
|
|
154
|
-
|
|
107
|
+
Source checkout development:
|
|
155
108
|
|
|
156
109
|
```bash
|
|
157
|
-
npm
|
|
158
|
-
cp
|
|
159
|
-
cp
|
|
160
|
-
|
|
110
|
+
npm ci
|
|
111
|
+
cp .env.example .env
|
|
112
|
+
cp config.example.yaml config.yaml
|
|
113
|
+
npm run build
|
|
114
|
+
npm link
|
|
115
|
+
xcompiler --help
|
|
161
116
|
```
|
|
162
117
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Dev mode (no build step):
|
|
118
|
+
Dev mode without linking:
|
|
166
119
|
|
|
167
120
|
```bash
|
|
168
|
-
npm run dev -- build
|
|
121
|
+
npm run dev -- build -i req.md --yes
|
|
169
122
|
npm run dev -- run path/to/phasePlan.json
|
|
170
123
|
```
|
|
171
124
|
|
|
172
|
-
Incremental
|
|
125
|
+
Incremental development:
|
|
173
126
|
|
|
174
127
|
```bash
|
|
175
|
-
# add a feature against the current project baseline
|
|
176
128
|
xcompiler build -w path/to/workspace -i feature_req.md --intent feature --yes
|
|
177
|
-
|
|
178
|
-
# or compile + execute in one go
|
|
179
129
|
xcompiler evolve -w path/to/workspace -i refactor_req.md --intent refactor --yes
|
|
180
|
-
|
|
181
|
-
# append a new requirement through clarification + V-model on the same project
|
|
182
130
|
xcompiler append path/to/workspace/<name>.xc -i feature_req.md --yes
|
|
183
|
-
|
|
184
|
-
# let stable XCompiler build and qualify its next generation in an isolated worktree
|
|
185
|
-
xcompiler bootstrap -r path/to/XCompiler -i self_req.md --yes
|
|
186
131
|
```
|
|
187
132
|
|
|
188
|
-
|
|
133
|
+
Self-bootstrap:
|
|
189
134
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
| `xcompiler build` | `-t <file>` | Reuse a previously clarified `topic.md` and skip Gate 1 |
|
|
194
|
-
| `xcompiler build` | `--intent <greenfield\|feature\|refactor\|self>` | Choose greenfield, incremental, or isolated self-bootstrap planning |
|
|
195
|
-
| `xcompiler build` | `--baseline-plan <file>` | Point incremental planning at an explicit existing `phasePlan.json` or legacy `plan.json` |
|
|
196
|
-
| `xcompiler build` / `xcompiler run` | `--project-file <file>` | Create/update a specific `XXX.xc` project file |
|
|
197
|
-
| `xcompiler build` | `--force` | Override the workspace lock and regenerate the plan |
|
|
198
|
-
| `xcompiler evolve` | `...` | Compile an incremental plan, then immediately execute it in the same workspace |
|
|
199
|
-
| `xcompiler load <XXX.xc>` | — | Load project config/progress and continue the current plan |
|
|
200
|
-
| `xcompiler append <XXX.xc>` | `-i <file>` | Clarify and execute a new incremental requirement on the existing project |
|
|
201
|
-
| `xcompiler bootstrap` | `--promote` | Explicitly fast-forward a qualified candidate; the default only creates a candidate and report |
|
|
202
|
-
| `xcompiler bootstrap` | `--docker-qualification` | Opt into the experimental Docker qualification runner; subprocess is the default |
|
|
203
|
-
| `xcompiler run` | `--reset` | Reset all Steps to PENDING |
|
|
204
|
-
| `xcompiler run` | `--force` | Equivalent to `--reset` + override lock |
|
|
205
|
-
| `xcompiler run` | `--from <stepId>` / `--phase <phase>` | Resume / run only one phase |
|
|
206
|
-
| `xcompiler run` | `--dry-run` | Print topology only |
|
|
207
|
-
| `xcompiler ls` | — | Scan workspace and list every phase plan's status |
|
|
208
|
-
| `xcompiler show <stepId>` | — | Inspect a single Step (definition / outputs / recent audit) |
|
|
135
|
+
```bash
|
|
136
|
+
xcompiler bootstrap -r path/to/XCompiler -i self_req.md --yes
|
|
137
|
+
```
|
|
209
138
|
|
|
210
139
|
---
|
|
211
140
|
|
|
212
|
-
##
|
|
141
|
+
## Common Commands
|
|
213
142
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
143
|
+
| Command | Purpose |
|
|
144
|
+
|---|---|
|
|
145
|
+
| `xcompiler build -i <file>` | Build a phase plan from a requirement file |
|
|
146
|
+
| `xcompiler build -t <topic.md>` | Reuse a clarified topic and skip Gate 1 |
|
|
147
|
+
| `xcompiler run <phasePlan.json>` | Execute the active phase plan |
|
|
148
|
+
| `xcompiler run --from <stepId>` | Resume from a specific step |
|
|
149
|
+
| `xcompiler run --phase <phase>` | Run only one phase/stage |
|
|
150
|
+
| `xcompiler run --debug-wiki-path <dir>` | Reuse and update a shared layered debug wiki path |
|
|
151
|
+
| `xcompiler load <name.xc>` | Load project config/progress and continue |
|
|
152
|
+
| `xcompiler append <name.xc> -i <file>` | Add a new requirement to an existing project |
|
|
153
|
+
| `xcompiler evolve -w <workspace> -i <file>` | Build and run an incremental change |
|
|
154
|
+
| `xcompiler acp` | Start the ACP code-agent stdio adapter |
|
|
155
|
+
| `xcompiler doctor` | Check config, LLM providers, sandbox, and skills |
|
|
156
|
+
| `xcompiler ls` / `xcompiler show <stepId>` | Inspect plans and recent audit entries |
|
|
157
|
+
| `npm run release:local -- vX.Y.Z` | Prepare a local release commit and tag without pushing |
|
|
224
158
|
|
|
225
159
|
---
|
|
226
160
|
|
|
227
|
-
##
|
|
161
|
+
## Runtime Defaults
|
|
228
162
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
| [docs/versioning.md](docs/versioning.md) | Core and Plugin API version sources, sync commands and release checks |
|
|
237
|
-
| [docs/self_bootstrap.md](docs/self_bootstrap.md) | Generational bootstrap, worktree isolation, qualification gates and promotion protocol |
|
|
238
|
-
| [docs/dev_audit_log.md](docs/dev_audit_log.md) | XCompiler's own delivery log (every requirement / decision / artefact / verification) |
|
|
239
|
-
|
|
240
|
-
> Doc layering:
|
|
241
|
-
> - `docs/` is the single documentation root; design documents use semantic names while V-model run artefacts use the `01-` through `05-` phase prefixes.
|
|
242
|
-
> - `docs/dev_audit_log.md` documents "how we built XCompiler" and is itself a XCompiler deliverable.
|
|
243
|
-
> - `<workspace>/docs/process_log.md` is auto-generated by the runtime `AuditLogger`, recording every interaction of "the user building a Python project with XCompiler" as that product's delivery summary.
|
|
163
|
+
- **LLM**: OpenRouter Free mode by default. Missing/invalid keys produce provider/model/base URL/status/body diagnostics and an explicit `OPENROUTER_API_KEY` hint.
|
|
164
|
+
- **LLM routing**: role-specific provider chains, XCompiler-maintained dynamic scores, user overrides from `llm_scores_user.yaml`, and `tags: [cluster]` fallback score bands for aggregated routes such as `openrouter/free`.
|
|
165
|
+
- **Languages**: Python and TypeScript project generation, testing, execution, and entry checks.
|
|
166
|
+
- **Sandbox**: `subprocess` by default; optional `docker` mode for bind-mount isolation and network/resource limits.
|
|
167
|
+
- **Audit**: every run writes `.xcompiler/audit.jsonl`, LLM stream traces, `docs/process_log.md`, debug cache, debug wiki feedback, and project memory.
|
|
168
|
+
- **Debug wiki**: Debugger issue repairs retrieve LLM-wiki style prior fixes by compact `DebugBrief`. The wiki is a layered Markdown knowledge base: bundled `wiki/system` policy pages, bundled `wiki/agent` calibration pages, and local `wiki/external` issue-resolution pages. Runtime regenerates `index.md` for review, `index.json` for retrieval, and `log.md` for append-only operations. By default it is copied to the XCompiler path (`$XC_PATH/.xcompiler/debug-wiki` when `XC_PATH` is set, otherwise the package/repo root); use `--debug-wiki-path <dir>` to share a different root. Successful issue repairs persist the LLM's `issueResolutionPlan` in `external`; failed reused fixes are marked `needs_review` through feedback overlays and later successful repairs create/correct external entries.
|
|
169
|
+
- **Security gates**: project file access is guarded, write tools are scoped to declared outputs, and sensitive actions can be surfaced as permission events in adapter scenarios.
|
|
244
170
|
|
|
245
171
|
---
|
|
246
172
|
|
|
247
|
-
## Runtime
|
|
173
|
+
## Runtime Tuning
|
|
248
174
|
|
|
249
|
-
LLM routing is configured under `config.yaml
|
|
175
|
+
LLM routing is configured under `config.yaml -> llm.*`.
|
|
250
176
|
|
|
251
177
|
| Field | Default | Effect |
|
|
252
178
|
|---|---|---|
|
|
253
|
-
| `
|
|
254
|
-
| `
|
|
255
|
-
| `
|
|
256
|
-
| `
|
|
257
|
-
| `
|
|
258
|
-
| `
|
|
179
|
+
| `roles.<Role>` | role dependent | Ordered/scored provider chain for Planner, Architect, Coder, Tester, Debugger |
|
|
180
|
+
| `scores.<provider>` | `1.0` | Backward-compatible initial score; prefer `llm_scores_user.yaml` for manual overrides |
|
|
181
|
+
| `llm_scores_user.yaml` | absent | Local user score overrides; `0` disables, `0.1..1` fixes effective priority |
|
|
182
|
+
| `cluster_score_min/max` | `0.2..0.5` | Dynamic score band for providers tagged `cluster`; user overrides may still use `0.1..1` |
|
|
183
|
+
| `agent.sandboxes.python.mode` | `subprocess` | Python project sandbox backend: local subprocess or Docker |
|
|
184
|
+
| `agent.sandboxes.typescript.mode` | `subprocess` | TypeScript project sandbox backend: local subprocess or Docker |
|
|
185
|
+
| `max_rounds_per_step` | `6` | LLM dialogue limit within a normal step |
|
|
186
|
+
| `max_debug_rounds_per_step` | `max(8, 2 * max_rounds_per_step)` | Debugger round cap |
|
|
187
|
+
| `max_debug_retries` | `3` | Debug retry attempts |
|
|
188
|
+
| `--debug-wiki-path <dir>` | XCompiler path `.xcompiler/debug-wiki` | Shared layered debug wiki root |
|
|
189
|
+
| `max_edit_lines_per_step` | `auto` | Adaptive EditGuard cumulative write-line budget |
|
|
190
|
+
| `max_write_chunk_bytes` | `auto` | Adaptive per-call write chunk budget |
|
|
191
|
+
| `agent.sandboxes.<language>.<local\|docker>.limits.network` | `download-only` | Outbound allowed, no inbound ports; `off` disables network |
|
|
259
192
|
|
|
260
193
|
---
|
|
261
194
|
|
|
262
|
-
##
|
|
195
|
+
## Documentation
|
|
263
196
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
197
|
+
| Path | Content |
|
|
198
|
+
|---|---|
|
|
199
|
+
| [docs/openrouter.md](docs/openrouter.md) | OpenRouter Free-mode setup and OpenAI-compatible provider notes |
|
|
200
|
+
| [docs/acp.md](docs/acp.md) | ACP code-agent adapter protocol notes |
|
|
201
|
+
| [docs/XCompiler_design.md](docs/XCompiler_design.md) | Core design and V-model concepts |
|
|
202
|
+
| [docs/plugin_api.md](docs/plugin_api.md) | Plugin API, lifecycle hooks, tools, skills |
|
|
203
|
+
| [docs/versioning.md](docs/versioning.md) | Version sources, release script, tag policy |
|
|
204
|
+
| [docs/self_bootstrap.md](docs/self_bootstrap.md) | Self-bootstrap and qualification gates |
|
|
205
|
+
| [docs/deploy.md](docs/deploy.md) | Local, Docker, and native package deployment |
|
|
269
206
|
|
|
270
207
|
---
|
|
271
208
|
|
|
272
|
-
##
|
|
273
|
-
|
|
274
|
-
Full steps in [docs/deploy.md](docs/deploy.md):
|
|
209
|
+
## Tests
|
|
275
210
|
|
|
276
211
|
```bash
|
|
277
|
-
|
|
278
|
-
npm
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
docker build -t xcompiler:latest .
|
|
283
|
-
docker compose run --rm xcompiler --help
|
|
212
|
+
npm run version:check
|
|
213
|
+
npm run typecheck
|
|
214
|
+
npm run lint
|
|
215
|
+
npm test
|
|
216
|
+
npm run build
|
|
284
217
|
```
|
|
285
218
|
|
|
286
|
-
|
|
219
|
+
Recent local release gate: 49 test files / 473 tests passed.
|
|
287
220
|
|
|
288
221
|
---
|
|
289
222
|
|
package/config.example.yaml
CHANGED
|
@@ -42,7 +42,7 @@ llm:
|
|
|
42
42
|
# think: false
|
|
43
43
|
|
|
44
44
|
# 角色 → provider 数组(兼容单字符串)。
|
|
45
|
-
# 数组里的 provider 按 ScoreStore
|
|
45
|
+
# 数组里的 provider 按 ScoreStore 有效评分降序使用;有效评分为用户覆盖优先,否则使用动态评分。
|
|
46
46
|
# 默认只启用 OpenRouter;如需本地备选,取消 providers 中对应块注释并加入各角色数组。
|
|
47
47
|
roles:
|
|
48
48
|
Planner: [openrouter_free]
|
|
@@ -51,10 +51,12 @@ llm:
|
|
|
51
51
|
Tester: [openrouter_free]
|
|
52
52
|
Debugger: [openrouter_free]
|
|
53
53
|
|
|
54
|
-
#
|
|
55
|
-
#
|
|
54
|
+
# 动态评分快照由 XCompiler 自动维护,落盘到同目录的 llm_scores.yaml,请勿手工编辑。
|
|
55
|
+
# 用户手动指定 provider 分数时,请在 config.yaml 同目录创建 llm_scores_user.yaml;
|
|
56
|
+
# 用户文件取值范围:0 表示禁用,0.1~1 表示固定覆盖动态优先级。
|
|
57
|
+
# 这里仅保留为兼容初始值;旧配置里显式写 0 仍表示用户禁用。
|
|
56
58
|
# tags: [cluster] 的聚合/路由 provider 默认动态评分范围为 0.2~0.5;
|
|
57
|
-
#
|
|
59
|
+
# 可按需调整动态上下限(min 最低 0.1,max 最高 1.0)。用户覆盖文件不受 cluster 动态上限限制。
|
|
58
60
|
cluster_score_min: 0.2
|
|
59
61
|
cluster_score_max: 0.5
|
|
60
62
|
scores: {}
|
|
@@ -64,8 +66,6 @@ llm:
|
|
|
64
66
|
role_fallbacks: {}
|
|
65
67
|
|
|
66
68
|
agent:
|
|
67
|
-
# python | typescript
|
|
68
|
-
language: python
|
|
69
69
|
max_steps: 50
|
|
70
70
|
max_debug_retries: 3
|
|
71
71
|
# Debugger 滑动窗口的硬上限:LLM 持续健康输出时窗口可扩到该值;
|
|
@@ -78,29 +78,61 @@ agent:
|
|
|
78
78
|
# write_file / append_file 单次 content 字节预算。auto 会按 phase/tools/outputs/context 自适应;
|
|
79
79
|
# 大型工程仍应拆成模块/函数/类边界增量写入,而不是单次写巨型文件。
|
|
80
80
|
# max_write_chunk_bytes: auto
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
81
|
+
# 目标工程语言由 topic / 现有工程基线判定:明确写 Python/TS 时自动选择;
|
|
82
|
+
# 无法判断时在澄清阶段询问;非交互或 topic 模式仍无法判断则默认 Python。
|
|
83
|
+
sandboxes:
|
|
84
|
+
python:
|
|
85
|
+
# subprocess | docker
|
|
86
|
+
mode: subprocess
|
|
87
|
+
local:
|
|
88
|
+
sandbox_dir: .sandbox/python
|
|
89
|
+
python_bin: python3
|
|
90
|
+
inherit_env: true
|
|
91
|
+
limits:
|
|
92
|
+
cpu: 1
|
|
93
|
+
memory_mb: 1024
|
|
94
|
+
wall_seconds: 60
|
|
95
|
+
# off | download-only (default) | full
|
|
96
|
+
# download-only — outbound HTTP/HTTPS allowed, no inbound port publishing
|
|
97
|
+
# pypi-only — legacy value, rejected because Docker cannot enforce a domain allowlist
|
|
98
|
+
# full — also publishes expose_ports to 127.0.0.1 for host-side tests
|
|
99
|
+
network: download-only
|
|
100
|
+
# expose_ports: [8000]
|
|
101
|
+
docker:
|
|
102
|
+
image: python:3.11-slim
|
|
103
|
+
workdir: /workspace
|
|
104
|
+
pull: false
|
|
105
|
+
docker_bin: docker
|
|
106
|
+
extra_run_args: []
|
|
107
|
+
sandbox_dir: .sandbox/python
|
|
108
|
+
limits:
|
|
109
|
+
cpu: 1
|
|
110
|
+
memory_mb: 1024
|
|
111
|
+
wall_seconds: 60
|
|
112
|
+
network: download-only
|
|
113
|
+
# expose_ports: [8000]
|
|
114
|
+
|
|
115
|
+
typescript:
|
|
116
|
+
mode: subprocess
|
|
117
|
+
local:
|
|
118
|
+
sandbox_dir: .sandbox/typescript
|
|
119
|
+
inherit_env: true
|
|
120
|
+
limits:
|
|
121
|
+
cpu: 1
|
|
122
|
+
memory_mb: 1024
|
|
123
|
+
wall_seconds: 60
|
|
124
|
+
network: download-only
|
|
125
|
+
# expose_ports: [3000]
|
|
126
|
+
docker:
|
|
127
|
+
image: node:24-slim
|
|
128
|
+
workdir: /workspace
|
|
129
|
+
pull: false
|
|
130
|
+
docker_bin: docker
|
|
131
|
+
extra_run_args: []
|
|
132
|
+
sandbox_dir: .sandbox/typescript
|
|
133
|
+
limits:
|
|
134
|
+
cpu: 1
|
|
135
|
+
memory_mb: 1024
|
|
136
|
+
wall_seconds: 60
|
|
137
|
+
network: download-only
|
|
138
|
+
# expose_ports: [3000]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# XCompiler Debug Wiki
|
|
2
|
+
|
|
3
|
+
This directory is a bundled LLM-wiki style knowledge base for Debugger repair.
|
|
4
|
+
|
|
5
|
+
- `wiki/system/` contains system-level debug policies and safety rules.
|
|
6
|
+
- `wiki/agent/` contains agent-level calibration knowledge derived from recurring LLM failure patterns.
|
|
7
|
+
- `wiki/external/` is created in the runtime copy and stores real project issue resolutions and feedback.
|
|
8
|
+
- `index.md` is regenerated in the runtime copy as a human-readable catalog.
|
|
9
|
+
- `index.json` is regenerated in the runtime copy as a machine-readable retrieval index.
|
|
10
|
+
- `log.md` is an append-only runtime operation log for retrieval, failed reuse, and confirmed repairs.
|
|
11
|
+
|
|
12
|
+
At runtime XCompiler copies `system` and `agent` pages into the configured debug-wiki root, builds `index.md` and `index.json`, and appends only real project feedback to the `external` layer.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: agent.calibration.fixtures
|
|
3
|
+
layer: agent
|
|
4
|
+
createdAt: "2026-07-18T00:00:00.000Z"
|
|
5
|
+
updatedAt: "2026-07-18T00:00:00.000Z"
|
|
6
|
+
status: active
|
|
7
|
+
category: test_failure
|
|
8
|
+
summary: "Fixture failures require valid samples, not repeated invented data"
|
|
9
|
+
primaryError: "Missing or malformed test fixture"
|
|
10
|
+
debugDemand: "Prefer user/workspace samples, official examples, or tmp_path for simple text; stop inventing complex domain fixtures after failures."
|
|
11
|
+
fingerprints:
|
|
12
|
+
- "cat:test_failure"
|
|
13
|
+
- "err:filenotfounderror"
|
|
14
|
+
- "fixture:malformed"
|
|
15
|
+
symptoms:
|
|
16
|
+
- "FileNotFoundError in tests"
|
|
17
|
+
- "Invalid syntax while parsing fixture"
|
|
18
|
+
- "malformed sample data"
|
|
19
|
+
resolutionPlan: "Read the test and fixture, identify whether the fixture is missing or malformed, then use a real user/workspace/official sample or a minimal tmp_path sample only for simple formats."
|
|
20
|
+
solution: "Tests must create every referenced fixture. For third-party or industry formats, use a real reference sample from user files, workspace files, official docs, upstream tests, or public standards. Do not repeatedly fabricate complex fixtures that the parser rejects."
|
|
21
|
+
evidence:
|
|
22
|
+
- "Derived from calibration rules FileNotFoundError-test-fixture and fixture-content-malformed"
|
|
23
|
+
language: python
|
|
24
|
+
stats:
|
|
25
|
+
uses: 0
|
|
26
|
+
successes: 1
|
|
27
|
+
failures: 0
|
|
28
|
+
feedback: []
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
# Fixture debug calibration
|
|
32
|
+
|
|
33
|
+
Missing and malformed fixtures are test artifact issues. The Debugger should repair the fixture source of truth before changing implementation.
|