@loomwright/cli 0.0.0-stage → 1.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,231 @@
1
+ # Changelog
2
+
3
+ All notable changes per release. `loomwright update` applies them to an installed workspace (see [docs/cli.md](docs/cli.md#update)).
4
+
5
+ ## 1.0.0
6
+
7
+ ### Major Changes
8
+
9
+ - d537614: The package and binary are renamed to `@loomwright/cli` and `loomwright`. `ai-factory` keeps working as a deprecated alias, so existing scripts and installs continue to run.
10
+
11
+ The on-disk names (`factory.config.jsonc`, `factory.lock.json`, `.factory/`) and the `AI_FACTORY_*` environment variables are unchanged.
12
+
13
+ ### Patch Changes
14
+
15
+ - b7a5208: Commands spawn fewer git processes. Managed files record their merge base as a git blob written
16
+ in-process (one `rev-parse` per sync instead of one `git hash-object` per file), the check-only
17
+ gate guard takes one `status --porcelain=v2 --branch` snapshot instead of a `status` plus a
18
+ `rev-parse HEAD` on both sides of every gate, and workspace discovery asks `rev-parse` once per
19
+ level. `bun run test` now runs test files in parallel (`bun run test:serial` keeps the old single
20
+ process; `bun run test:fast` skips the integration-heavy files), and the fixtures build their
21
+ workspaces once per process instead of once per test.
22
+
23
+ ## 0.12.0
24
+
25
+ ### Minor Changes
26
+
27
+ - 416017a: Reviewers and contract reviewers are now told to set `file` to the change's spec path when the correct fix is a wording change, instead of the code file where the mismatch shows. If a `review-fix` task still blocks with a reason naming `openspec`, the factory moves its finding into `specFindings`, drops the impossible task and pauses with the `reword`/`reapprove` reason instead of failing the change. Findings are kept on the fix task so the fallback moves the exact finding, not just the blocked task's free-text reason.
28
+
29
+ ## 0.11.1
30
+
31
+ ### Patch Changes
32
+
33
+ - Keep generated lockfiles in scope. Implementers and testers may keep `Cargo.lock` and other package-manager lockfiles even when a task's `touches` omits them, and a gate that only refreshes a stale lockfile now passes instead of failing as "not check-only"; task worktrees keep the regenerated file, while full-suite gates still require a clean checkout. The Rust and Tauri standards and the architect prompt now say that a task changing a dependency manifest lists its lockfile in `touches`.
34
+
35
+ ## 0.11.0
36
+
37
+ ### Minor Changes
38
+
39
+ - 6217ff9: Add `workflow.reviewRounds` (1–10, default 1). Above 1, every touched repo is re-reviewed after a fix round until a pass finds no `must`/`should` code findings or the cap is reached; the last fix round still runs and remaining findings stay in the report. The tester still runs once per repo. Fix task ids are now round-scoped so later passes cannot collide with earlier ones.
40
+ - 6217ff9: Spec findings no longer dead-end at the implementer. Review findings that point at `openspec/changes/<id>/` are recorded and pause the change; `ai-factory reword <id>` lets the architect apply them (wording and clarity only, task DAG unchanged) and `ai-factory reapprove <id>` accepts a hand edit. Both commit `docs(spec): reword <id>` and re-stamp the approval hash without reloading task progress, and a failed attempt restores the spec.
41
+
42
+ ## 0.10.2
43
+
44
+ ### Patch Changes
45
+
46
+ - c761329: Show each completion candidate with its description in zsh, in Homebrew's `value -- description` style, instead of replacing the candidate with its description.
47
+
48
+ ## 0.10.1
49
+
50
+ ### Patch Changes
51
+
52
+ - 90e9c5c: Fix zsh and bash completion passing the whole command line as a single word, which broke flag and file completion after a command name. Pressing Tab on an empty word after a command now also offers its flags (but not after `--`).
53
+
54
+ ## 0.10.0
55
+
56
+ ### Minor Changes
57
+
58
+ - 909ed35: Add `ai-factory adopt` for OpenSpec workspaces that already have pending changes when the factory is installed. It registers changes in `.factory/runs/`, validates them, and leaves all git state and model calls alone. `approve` creates the change branch lazily; `--normalize` lets the architect add the factory's per-task `repo`/`deps`/`touches` metadata without changing intent; `--preserve-progress` keeps already checked tasks merged for partially implemented changes. `init` and `doctor` point at pending changes that are not adopted yet.
59
+
60
+ ## 0.9.0
61
+
62
+ ### Minor Changes
63
+
64
+ - 607f4f9: Use the credentials stored by `opencode auth login` in the factory's private opencode server. At startup the runtime exports the user's stored credentials, keeps only the configured providers and imports them into the private database; rotated API keys, `auth logout` and `auth switch` propagate on the next run. `doctor` imports the same credentials into its model check and reports how many it found. The private `.factory/opencode` database is now treated as a secret file, and `OPENCODE_DB` is scrubbed from agent shells.
65
+
66
+ ## 0.8.0
67
+
68
+ ### Minor Changes
69
+
70
+ - 7b6bdef: **Breaking:** `ai-factory run --interactive` was removed. Use `ai-factory refine "<request>"` and `ai-factory run --request <file>` for a pre-run interview.
71
+
72
+ `run` now asks the questions the intake orchestrator and architect raise in their handoffs when stdin is a terminal, sends the answers back to the same session, and records the Q&A in `openspec/changes/<id>/questions.md` and `.factory/clarifications/<id>.md`. `workflow.clarifyRounds` (default 2) caps the rounds per phase; questions beyond the cap are recorded unanswered. `--no-interactive`, or no TTY, records the questions without asking and continues.
73
+
74
+ ## 0.7.0
75
+
76
+ ### Minor Changes
77
+
78
+ - 23422bb: Add opt-in committed change records. `"artifacts": { "mode": "git" }` snapshots a finished change's final report, approval and usage ledger into `factory-records/`, so a clone or another machine keeps them. `close`, `land` and `quick` record automatically; `ai-factory artifacts sync <id>|--all` backfills and retries. `usage` and `doctor` read both the local ledger and the committed snapshot. Config schema v4 adds the block with `"mode": "local"`, which keeps today's behaviour.
79
+ - 23d5d6b: Print `next: ai-factory land <id>` when `approve` or `resume` finishes a change; `land` hints at `artifacts sync <id>` when the records stay local.
80
+
81
+ ## 0.6.0
82
+
83
+ ### Minor Changes
84
+
85
+ - 824ef91: Add `ai-factory land <change-id>`: merge a finished change into its local base branches, update submodule pointers, delete change and task branches, and remove worktrees, drafts, context, approvals and run state while keeping reports, usage and logs.
86
+
87
+ ## 0.5.0
88
+
89
+ ### Minor Changes
90
+
91
+ - 94f34f1: Add bash, zsh and fish shell completion for commands, optional flags and workspace values, and add `ai-factory usage` for repo-wide AI token and cost reporting across changes and quick tasks.
92
+
93
+ ## 0.4.2
94
+
95
+ ### Patch Changes
96
+
97
+ - e336261: Fix the factory-side issues found in the Clarion run:
98
+ - add a `websearch` config (default `{ "provider": "random" }`) and render it into opencode, so a headless run no longer waits a minute on the interactive web search provider prompt and then reports `Web search cancelled`
99
+ - let implementers edit the repository's test files even when a task's `touches` omits them, and tell the architect to include test files in `touches`
100
+ - add `runtime.turnTimeoutMinutes` (default 60, up from 30) and pass it to the opencode runtime
101
+ - allow read-only Homebrew queries such as `brew --prefix` and recursive searches over OS-managed trees (`/Applications`, `/System`, `/Library`, `/usr`, `/opt`)
102
+
103
+ ## 0.4.1
104
+
105
+ ### Patch Changes
106
+
107
+ - eabad62: Detect Swift projects that are not SwiftPM packages. `Package.swift`, XcodeGen's `project.yml` and any `*.xcodeproj` bundle are now detected as Swift, and their gates fall back to `xcodegen generate` plus `xcodebuild build`/`test` (the scheme defaults to the project name). `testAffected` therefore resolves for Xcode projects instead of failing as a missing gate. Workspace scans also skip `.build`.
108
+
109
+ ## 0.4.0
110
+
111
+ ### Minor Changes
112
+
113
+ - 82c202a: Show what the factory is doing during implementation. Every agent call now prints its task, agent, model, attempt, duration and tokens; the scheduler prints retries, merge conflicts, requeues, infrastructure errors and interrupts; gates and dependency installs print when they start and finish; and a 30-second heartbeat lists running sessions and gates with elapsed time and the current tool. `--verbose` streams every tool call and gate start, while `--quiet` keeps only phase banners, merges, failures and the summary. `ai-factory status --watch [--interval <s>]` reprints the change in a second terminal.
114
+
115
+ ## 0.3.2
116
+
117
+ ### Patch Changes
118
+
119
+ - 864f387: Allow read-only web search/fetch for every built-in agent except the orchestrator, so explorers, architects, implementers and testers can research external APIs and documentation. Reviewers already had it; custom agents keep the `web` opt-in.
120
+ - ac5a965: Support opencode 2.2.0. The supported range is now `>=2.1.2 <2.3.0`; 2.2.0 is tested alongside 2.1.2, and `update` refreshes the lock's tested pin.
121
+
122
+ opencode 2.2.0 now exposes MCP/plugin tools directly when `execute` is denied (which every factory agent does). Each tool's own permission still applies, so `mcp.roles` works as documented, but a global `allow` for an MCP action can expose a tool the role did not list.
123
+
124
+ ## 0.3.1
125
+
126
+ ### Patch Changes
127
+
128
+ - 4ba83db: Keep polling opencode's `/wait` in 60 s slices so an agent turn longer than 5 minutes no longer fails with "opencode server unreachable" (Node's `fetch` headers timeout), and report client-side timeouts as such instead.
129
+
130
+ ## 0.3.0
131
+
132
+ ### Minor Changes
133
+
134
+ - 7d6bb18: Add config schema v3: project instructions, skills and MCP permissions, custom agents with path routing, per-repo and per-agent models, conditional/generated gates, generated/CRD/IPC/custom contracts, Swift, `refine`/`run --interactive`, `quick`, gitmoji commits, legacy setup archiving and release/CI detection. Existing v2 configs keep working and `update` migrates them to v3.
135
+
136
+ ### Patch Changes
137
+
138
+ - c0937d5: Ship `dist/package.json` with the CLI bundle so Node 20 parses `dist/cli.js` as ESM instead of failing with `Cannot use import statement outside a module`.
139
+
140
+ ## 0.2.0
141
+
142
+ ### Breaking (handled by `update`)
143
+
144
+ - Config `schemaVersion` 2. Migration `001-graph-exclude-defaults` replaces the default `graph.exclude` list with the wider v2 default (adds `vendor`, `build`, `coverage`, `.next`, `__pycache__`). A customised list is kept as is. Commands refuse a v1 config until you run `ai-factory update`.
145
+
146
+ ### Added
147
+
148
+ - `ai-factory update [--dry-run] [--tools] [--restore] [--force]`: config migrations, three-way merge of edited managed files, a backup per update and one `chore(factory): update to vX.Y.Z` commit.
149
+ - `ai-factory rollback`: restores the latest update backup, including the previous lock.
150
+ - Approving a change snapshots its agent definitions and gate tables, so a forced update never changes a running change.
151
+ - `docs/fleet-update.sh`: an example for updating many workspaces.
152
+ - Tauri v2 language profile (`tauri`). It is detected from `tauri.conf.json`/`Tauri.toml` next to a `tauri` 2.x dependency. It runs the cargo gates in `src-tauri/` instead of the Rust profile (which also validates capabilities and the config), creates a missing `frontendDist` directory before compiling, and comes with its own standard. Existing workspaces get `.opencode/standards/tauri.md` on `update`; run `detect --apply` to add `tauri` to a repo.
153
+ - `ai-factory doctor`: checks tool versions and lock drift, the install, submodules, clean trees, hooks, the resolved gate table with toolchain lookup, cache sizes, model availability, graph freshness and stale locks.
154
+ - `README.md`, `ARCHITECTURE.md`, and E2E transcripts per layout in `docs/e2e/`, recorded with real opencode and a scripted model (`scripts/e2e-transcript.ts`).
155
+
156
+ ### Distribution
157
+
158
+ - The npm package is now `@supporterino/ai-factory`. The unscoped `ai-factory` on npm is an unrelated project. Run it with `npx @supporterino/ai-factory@0.2.0 init`; the command is still `ai-factory`.
159
+ - MIT LICENSE added.
160
+ - `prepack` builds the bundle, and the package ships only the bundle, docs and licences.
161
+ - GitHub Actions CI runs the full suite on Ubuntu and macOS; releases publish from `main` with provenance and create a GitHub Release.
162
+ - `init`, `update` and `detect --apply` refuse to downgrade a workspace a newer version installed (`--allow-downgrade` to override).
163
+
164
+ ### Security
165
+
166
+ - **Second hardening batch (S11, S14–S17, S19).**
167
+ - Secret files can no longer be read through globs, `git show <rev>:.env`, recursive `grep -r`/`rg --hidden`, inline code or the grep/glob tools; on macOS agent shells cannot read workspace secrets at all (gates still can). The two secret lists agree and cover `~/.kube/*.yaml`.
168
+ - `npm run`/`pnpm`/`yarn`/`bun run` scripts and `make` recipes are checked like the commands they run; concatenated strings in other languages are joined before scanning.
169
+ - Implementers and testers cannot edit `openspec/`. Patches the plugin cannot read are refused.
170
+ - Redaction covers auth headers, bearer tokens, `-u user:pass` and URL tokens, runs before JSON escaping, applies to gate output, and `logs.redact: false` no longer turns off credential redaction.
171
+ - Untrusted text is fenced so it cannot close its fence; edit and patch contents are not logged.
172
+
173
+ - **Shell-policy and git hardening.** Fixes all enforcement bypasses from the 2026-10-26 audit (S1–S10, S12):
174
+ - shell keywords and `cd` are parsed and tracked;
175
+ - xargs, interpreter, awk/sed and runner evasions are closed;
176
+ - git env, `-c` keys and exec options are restricted; `fetch` refspecs and agent commits are blocked;
177
+ - writes are judged on real paths (symlinks), more writers are covered, and protected paths match case-insensitively.
178
+ - **Every shell spawn is guarded.** opencode's `shell create.before` hook only spawns approved commands and scrubs the server password, model keys and forge tokens. Non-factory agents and opencode's REST shell are refused.
179
+ - **OS sandbox (macOS `sandbox-exec`).**
180
+ - Covers agent shells and gates.
181
+ - Writes are limited to the session's own directories; run state, factory files and `.git` stay read-only.
182
+ - Credential files and git credential helpers are off-limits, and ssh (port 22) is blocked.
183
+ - New config key `security.sandbox` (`"auto"` | `"off"`).
184
+ - **Gates and installs.** Both run without credentials and with pushes blocked. A task may not change the scripts or targets its gates run.
185
+
186
+ ### Changed: language standards
187
+
188
+ - Every standard (TypeScript, React, Python, Go, Rust, Helm, Tauri) is rewritten from its primary docs, e.g. Effective Go and Go Code Review Comments, the TypeScript Handbook's Do's and Don'ts, react.dev's Rules of React, PEP 8/257 and the typing best practices, the Rust API Guidelines, Helm's chart best practices and the Pod Security Standards, and the v2.tauri.app security and IPC guides.
189
+ - Each standard lists its sources in an HTML comment, cites them per section, and marks factory-specific rules (such as Rust unit tests in a sibling `tests.rs`, which keeps them within the tester's edit scope). Comments are stripped from agent prompts.
190
+ - Corrections: Tauri app commands need no capability unless they are listed in `AppManifest::commands`; Tauri state uses `std::sync::Mutex` by default, with no `Arc`.
191
+
192
+ ### Fixed
193
+
194
+ - **Retries.** Every retry gets the full gate output; repeated failures no longer arrive as an empty note (audit P1).
195
+ - **Abort.** `abort` stops a change in every phase, interrupts running agents, frees the workspace when the driver stops, and `resume` continues the change (P2).
196
+ - **Branching.** If branching fails after intake, the next run branches first; the spec is only ever committed on `change/<id>` (P3).
197
+ - **Merges.** A task whose conflict was resolved while another task merged now catches up instead of failing (P4).
198
+ - **Server crashes.** A crashed opencode server is restarted. Server failures never spend retry budget, and the change pauses after three in a row (P5).
199
+ - **OpenSpec files.** OpenSpec's opencode commands and skills are managed files: `init` and `update --tools` no longer overwrite your edits (P19).
200
+ - **Approval.** A spec edited after approval is caught on entry to every later phase, not only at activation; the error shows how to restore the approved spec (P9).
201
+ - **Reviews.** A reviewer or contract reviewer that returns no result pauses the change instead of counting as a clean review (P13).
202
+ - **Close.** Closing records each step, so a resume after a crash finishes the close instead of failing (P6).
203
+ - **Concurrent drivers.** Every phase after approval takes the driver lock, so two `resume`s cannot run a review or close twice; `approve` re-checks the phase under the run lock (P14).
204
+ - **Corrupt state files.** A corrupt run file, `active.lock` or `queue.json` gives a clear error with a fix; `status` and `doctor` list it instead of crashing (P15). A corrupt usage ledger is set aside and a new one started; unreadable graph metadata is ignored.
205
+ - **Budget.** Ctrl-C during a merge or a conflict resolution spends nothing and keeps the branch (P7). After a crash, tasks that already passed their gates go straight to the merge (P8). A provider that stays rate-limited, and a failed dependency install, pause the change instead of spending budget; installs are retried, also in kept worktrees (P12, P16).
206
+ - **Serial mode.** Work a failed task left in the shared checkout is stashed under its name, not reverted and charged to the next task (P10).
207
+ - **Queue.** A queued change resumed by hand leaves the queue, so it is not started a second time and the next change still auto-starts (P11).
208
+ - **Snapshots.** Agent and gate definitions are fixed at `approve`, not at activation (P18). `update` never commits onto a `change/*` branch, even with `--force`, so a running change keeps its agents in every session (P17, G7). `gate <id>` uses the change's snapshot (G9).
209
+ - **Smaller gaps (P20).** Context packs and the spec in review/test prompts are capped at a whole line; one failing explorer no longer sinks the design; graph updates take a workspace lock; a submodule branches from the newer of its local and fetched base branch.
210
+ - **`init`** keeps an existing `openspec/config.yaml` and lists it as unmanaged (G2). **`detect --apply`** merges edited implementer agents and never leaves a half-applied config (G3).
211
+ - **`update --restore`** repairs tampered or deleted vendored Ponytail files (G5). `--tools` also rebuilds a graph built by another Graphify release; a plain `update` warns about it (G6). `--dry-run --json` lists paths, not file contents (G9).
212
+ - **Helm** types gate fails when `helm template` fails (G8). Monorepo packages' languages bring their standards and test globs (G9). Design validation requires consumer tasks to depend on contract changes, and rejects invalid `touches` globs (G9).
213
+ - **Handoffs.** A reply without any JSON is reported as a missing block, not a parse error.
214
+
215
+ - The architect and tester agents get edit permissions for their own paths (change and context folders, test globs). Before, opencode's permission layer denied their writes.
216
+ - Closing a change removes its agent snapshot and empty worktree folders, and `status` no longer lists the snapshot as a worktree.
217
+ - Full-suite gate results are written to the change's log.
218
+
219
+ ### Changed
220
+
221
+ - `bench ponytail` has two cases (a new function and a fix in existing code), `--case` and `--levels` options, medians of quality metrics over finished runs only, and saves results after every run (G1). It has still not been run on real models.
222
+ - `status` shows full-suite results, contract results and provisional pointers; reports list usage per task and step (G4).
223
+ - `doctor` warns about a non-strict `tsconfig.json`, a graph built by another Graphify release, and proxy variables, and checks Graphify's safety env.
224
+ - ADR-0028 records the default models, time limits and rate-limit parameters.
225
+
226
+ - Implementer agents: a rule for merge-conflict tasks (change only the conflicted files, keep both intents).
227
+ - `AGENTS.md` block: query the workspace graph before reading files.
228
+
229
+ ## 0.1.0
230
+
231
+ First release: `init`, `detect`, `gate`, `repoint`, `run`, `approve`, `resume`, `status`, `retry`, `abort`, `graph` and `bench`. Includes the OpenSpec workflow, the Graphify workspace graph, the opencode agents and plugin guard, the contract gate and the Ponytail add-on.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Lars Roth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,278 @@
1
- # Temporary Holding Version
1
+ <p align="center">
2
+ <img src="brand/icons/mark-on-light-512.png" alt="Loomwright mark" width="128" height="128">
3
+ </p>
2
4
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
5
+ # Loomwright
6
+
7
+ **Spec in. Woven software out.**
8
+
9
+ Renamed from ai-factory. The package is `@loomwright/cli` and the binary is `loomwright`; the
10
+ old `ai-factory` binary still works as a deprecated alias. See [brand/BRAND.md](brand/BRAND.md)
11
+ for the mark, colour and voice.
12
+
13
+ [![CI](https://github.com/supporterino/ai-factory/actions/workflows/ci.yml/badge.svg)](https://github.com/supporterino/ai-factory/actions/workflows/ci.yml)
14
+
15
+ Loomwright is a repo-local AI software factory. You describe a change; the factory writes an [OpenSpec](https://github.com/Fission-AI/OpenSpec) spec, waits for your approval, then has [opencode](https://opencode.ai) agents implement, test and review it across your repos, guided by one [Graphify](https://pypi.org/project/graphifyy/) knowledge graph of the workspace.
16
+ - **One human gate:** the spec approval. Everything after it runs on its own, and pauses with a report when it cannot finish.
17
+ - **Local commits only.** Nothing is pushed and no merge request is opened. You review the `change/<id>` branches and push them yourself. When a change is done, `loomwright land <id>` merges it into the local base branches and cleans up.
18
+ - **Two layouts:** a single repo, or an "AI repo" that holds your code repos as git submodules.
19
+ - **Language profiles** (stackable per repo): TypeScript/JavaScript, React, Python, Go, Rust, Swift, Helm, Tauri v2.
20
+
21
+ How it works inside: [ARCHITECTURE.md](ARCHITECTURE.md). Every command: [docs/cli.md](docs/cli.md). Design decisions: [docs/decisions/](docs/decisions/). Changes per version: [CHANGELOG.md](CHANGELOG.md).
22
+
23
+ ## Install
24
+
25
+ Requirements: macOS or Linux, Node ≥ 20 or Bun ≥ 1.3, and these tools on `PATH`:
26
+
27
+ | Tool | Version | Install |
28
+ | -------- | ----------------------------------- | -------------------------------------------------- |
29
+ | git | ≥ 2.31 | Xcode CLT or your package manager |
30
+ | opencode | 2.1.x–2.2.x (≥ 2.1.2; tested 2.2.0) | `npm install --global @opencode/cli@2.2.0` |
31
+ | OpenSpec | 1.x (≥ 1.10) | `npm install --global @fission-ai/openspec@1.14.3` |
32
+ | Graphify | 0.9.x (≥ 0.9.93) | `uv tool install graphifyy==0.9.93` |
33
+
34
+ Plus credentials for the model providers you configure, either exported (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, …) or stored with `opencode auth login`. The factory copies the configured providers' stored credentials into its private runtime database at startup, so they never enter your config or git.
35
+
36
+ Run the CLI without installing it:
37
+
38
+ ```bash
39
+ bunx @loomwright/cli init
40
+ ```
41
+
42
+ `npx @loomwright/cli init` works too. The package is `@loomwright/cli`; its command is `loomwright`, so after `npm install --global @loomwright/cli` you run `loomwright init`. The old `ai-factory` binary still works as a deprecated alias. Note: the unscoped npm package `ai-factory` is an unrelated project. To run it from a checkout of this repository instead, build it with `bun install && bun run build`, then run `node dist/cli.js` (or `npm link` it).
43
+
44
+ `init` is idempotent. It detects the layout, languages, contracts and existing `opencode.json` instructions, and writes `factory.config.jsonc` from what it found, so edit that file afterwards. It also renders the agents, plugin, standards, skills and OpenSpec's commands into `.opencode/`, installs the `pre-push` hooks, builds the graph, writes `factory.lock.json`, and commits it all as `chore(factory): init vX.Y.Z`. On a first install it archives replaced custom agents, commands and skills under `.factory/legacy/<timestamp>/`; `init --plan` shows that plan without writing. Then check the setup:
45
+
46
+ ```bash
47
+ loomwright doctor
48
+ ```
49
+
50
+ `doctor` prints the resolved gate command per repo and flags anything a run would trip over: a missing toolchain, a model your credentials can't reach, a missing hook, an uninitialised submodule.
51
+
52
+ ### Shell completion
53
+
54
+ `loomwright` completes commands, flags and values (change and task ids, repos, agents, models, files and bench levels) in bash, zsh and fish:
55
+
56
+ ```bash
57
+ loomwright completion zsh # print the script
58
+ loomwright completion zsh --install # add an idempotent block to ~/.zshrc
59
+ loomwright completion --install # detect the shell from $SHELL
60
+ ```
61
+
62
+ ### Adopting an existing OpenSpec workspace
63
+
64
+ `init` never touches the changes in `openspec/changes/`. If your team already has pending OpenSpec changes, `init` leaves them alone and prints a note. Take one over when you want the factory to finish it:
65
+
66
+ ```bash
67
+ loomwright adopt --all # register every pending change
68
+ loomwright adopt add-search # or name them
69
+ loomwright adopt add-search --dry-run # show what would happen
70
+ ```
71
+
72
+ Adoption registers the change in `.factory/runs/` and validates it, but writes no git state and starts no model. `approve` then creates the change branch lazily. A change whose tasks are all checked is left alone: archive it with `openspec archive <id>`.
73
+
74
+ Vanilla OpenSpec changes often lack the factory's per-task `repo`/`deps`/`touches` metadata. Add it by hand, or let the architect do it:
75
+
76
+ ```bash
77
+ loomwright adopt add-search --normalize
78
+ ```
79
+
80
+ `--normalize` runs one architect session against the existing change, preserving its intent, task ids and checked state. It requires a clean AI repo, committed change files, the base branch and no active change, and it spends tokens. A partially implemented change needs `--preserve-progress`; commit that work on the base branch first, and the factory keeps the checked tasks merged and continues with the rest.
81
+
82
+ ## Layouts
83
+
84
+ **Single repo.** The factory lives in the repo itself (`repos: [{ "path": "." }]`). Agents may never edit the factory's own files (`.opencode/`, `.factory/`, `factory-records/`, `openspec/specs/`, the config, the lock, `AGENTS.md`), even though they sit in the same tree.
85
+
86
+ **AI repo with submodules.** A repo that holds the factory and your code repos as submodules:
87
+
88
+ ```
89
+ ai-repo/
90
+ ├── factory.config.jsonc, factory.lock.json, AGENTS.md
91
+ ├── .opencode/ agents (one implementer per repo), plugin, standards
92
+ ├── openspec/ specs and changes
93
+ └── repos/
94
+ ├── backend/ submodule (go, OpenAPI provider)
95
+ ├── frontend/ submodule (typescript + react, consumer)
96
+ └── deploy/ submodule (helm)
97
+ ```
98
+
99
+ The same `change/<id>` branch is created in the AI repo and in every submodule the change touches. Task worktrees are created from each submodule's own git dir. At close, the AI repo gets a provisional pointer bump; `repoint` replaces it once your merge requests are merged upstream. Contracts between repos (OpenAPI, JSON Schema, Helm `values.schema.json`, proto) are checked by a deterministic gate plus one cross-repo review.
100
+
101
+ ## The flow
102
+
103
+ ```bash
104
+ loomwright run "Add full-text search to the product list"
105
+ ```
106
+
107
+ 1. **Intake and design.** The orchestrator names the change. Explorers map the affected repos using the graph. The architect writes `openspec/changes/<id>/` (proposal, design, specs and `tasks.md`, with per-task `repo`/`deps`/`touches`). The CLI validates it and has the architect repair problems. `run` stops here.
108
+ 2. **Approve.** Read the spec, edit it if you like, then:
109
+
110
+ ```bash
111
+ loomwright approve <id>
112
+ ```
113
+
114
+ This commits the spec (`docs(spec): <id>`) and records its hash. Any later edit to the spec, other than a task checkbox, voids the approval; accept an intended edit with `loomwright reapprove <id>`, or let the architect apply review findings with `loomwright reword <id>`. If another change is active, this one queues and starts automatically when the other one closes. Use `--no-continue` to only record the approval.
115
+ 3. **Implement.** Tasks run in parallel in their own worktrees, at most `maxAgents` at a time. Tasks in one repo whose `touches` overlap run one after the other. Each task gets an affected-test gate. Merges go through a per-repo queue: rebase, gates again, fast-forward. A failing task gets three retries, then the change pauses with a report. The terminal shows each task starting (title, agent, model, attempt), its gates, retries and merges, plus a 30-second heartbeat with the elapsed time and current tool while agents and gates run. `--verbose` streams every tool call; `--quiet` keeps only merges, failures and the summary.
116
+ 4. **Review, contracts, full suite.** Each touched repo gets one reviewer and one tester pass. Findings and failures become fix tasks. With `workflow.reviewRounds` above 1, every touched repo is reviewed again after a fix round until a pass is clean or the cap is reached (the tester still runs once). Then come the contract gate and contract review, and finally every touched repo's full suite. A finding that points at the change's spec cannot be fixed by an implementer: the change pauses and `loomwright reword <id>` lets the architect apply it (or `reapprove` accepts a hand edit). Reviewers set `file` to the spec path for a wording fix; if a `review-fix` task still blocks with a reason naming `openspec`, the factory routes its finding to the spec findings rather than failing the change.
117
+ 5. **Close.** The CLI mirrors the checkboxes, bumps the pointers, archives the spec and writes the report to `.factory/reports/<id>.md`. It makes local commits only.
118
+
119
+ While it runs, or after it stops:
120
+
121
+ | Situation | Command |
122
+ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
123
+ | See what is happening: phase, task DAG, worktrees, gate results, token usage | `loomwright status [<id>] [--json]` |
124
+ | See AI usage across every change and quick task in the workspace | `loomwright usage [--json]` |
125
+ | Watch it from a second terminal (refreshes every 2 s until Ctrl-C) | `loomwright status <id> --watch` |
126
+ | It paused because a task failed three times: fix it in the task's worktree (path in the report), then | `loomwright retry <id> --task <n>` |
127
+ | It paused, was aborted, or the process died: continue from the last consistent state | `loomwright resume <id>` |
128
+ | A review finding concerns the spec itself: let the architect apply it | `loomwright reword <id> [--finding <n,...>] [--dry-run]` |
129
+ | You edited the spec after approval: accept the edit without reloading the tasks | `loomwright reapprove <id> [--dry-run]` |
130
+ | Stop it safely (branches and worktrees stay, the lock is released) | `loomwright abort <id>` |
131
+ | Run the gates by hand | `loomwright gate <id> [--task <n>] [--repo <name>] [--full]` |
132
+ | Your submodule MRs were merged upstream: replace the provisional pointers | `loomwright repoint <id>` |
133
+ | The change is reviewed: merge it locally into the base branches and clean up | `loomwright land <id> [--dry-run]` |
134
+ | Commit a change's report, approval and usage (`artifacts.mode: "git"`), or backfill past changes | `loomwright artifacts sync <id>` / `--all` |
135
+
136
+ Exit codes: 0 ok, 3 config invalid, 4 precondition, 5 gate failed, 6 paused/aborted, 10 detection drift ([full table](docs/cli.md#exit-codes)).
137
+
138
+ ### Refinement and quick tasks
139
+
140
+ ```bash
141
+ loomwright refine "make the imports faster" # ask scope/verification questions, write .factory/requests/<slug>.md
142
+ loomwright run --request .factory/requests/make-the-imports-faster.md
143
+ loomwright run "make the imports faster" # agents may ask questions during intake/design
144
+ loomwright quick "fix the login typo" --repo frontend # add --agent <id> for a custom implementer
145
+ ```
146
+
147
+ `refine` asks a few questions before any model work starts. During `run`, the intake orchestrator and architect may raise questions; the CLI asks them in the terminal and records the Q&A in the change. Pass `--no-interactive` to record without asking. Spec approval is still the only hard gate. `quick` is the no-OpenSpec path: it creates a `task/<slug>` branch, implements, runs the gates, runs one review pass, and makes one local commit. It never pushes.
148
+
149
+ ## Configuration reference
150
+
151
+ `factory.config.jsonc` (JSONC, validated on every command; the editor schema is `.opencode/schemas/factory.config.schema.json`):
152
+
153
+ | Key | Default | Meaning |
154
+ | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
155
+ | `$schema` | `./.opencode/schemas/factory.config.schema.json` | JSON Schema for editor completion and checks; the factory keeps it current. |
156
+ | `schemaVersion` | `4` | Config format. `loomwright update` migrates older ones; v2/v3 stay readable until you update. |
157
+ | `layout` | detected | `"single"` or `"submodules"`. |
158
+ | `repos[]` | detected | `{ name, path, role: "code" \| "orchestration", languages[], defaultBranch?, subPaths?[] }`.`languages` stacks profiles (`typescript`, `react`, `python`, `go`, `rust`, `swift`, `helm`, `tauri`). A Tauri v2 app is detected as `typescript` (plus `react`) for the frontend and `rust` + `tauri` for `src-tauri/`, where the `tauri` profile runs the cargo gates. `subPaths` overrides languages for monorepo packages. In the submodule layout, the AI repo is the one `orchestration` repo at `"."`. |
159
+ | `models.{orchestrator, architect, reviewer, contractReviewer?, implementer, tester, explorer}` | Opus for architect/reviewer, Sonnet for orchestrator/implementer/tester, Haiku for explorer | opencode ids `"provider/model[#variant]"`.`contractReviewer` falls back to `reviewer`.`models.roles`, `models.repos.<repo>` and `models.agents.<id>` override the flat entries; `fallback[]` lists alternates. |
160
+ | `instructions.{workspace, repos.<repo>}` | `[]`, `{}` | Project docs (security bars, language bars, API contracts) injected into opencode sessions. The reviewer/tester prompts also name them. |
161
+ | `skills.{sources, roles, repos}` | `[".opencode/skills"]`, `{}`, `{}` | Skill ids each role loads first; the skill tool is enabled for those roles. `sources` is where `doctor` looks for `SKILL.md`. |
162
+ | `mcp.roles.<role>` | `{}` | MCP tool action patterns a role may call (e.g. `["mantine_*"]`). Without an entry MCP tools stay on `ask`, which headless runs reject. |
163
+ | `agents[]`, `routing[]` | `[]`, `[]` | Optional specialist agents (`id`, `phase`, `prompt` or `promptFile`, `model`, `skills`, `edits`, `shell`, `web`, `mcp`) and path-to-agent routing for implementation tasks. |
164
+ | `gates.maxRetries` | `3` | Retries per task after the first attempt. |
165
+ | `gates.scripts` | `format:check`, `lint`, `typecheck`, `test`, `test:affected` | Script or target names looked up in `package.json`, `Makefile`, `justfile` and `Taskfile.yml`. |
166
+ | `gates.overrides.<repo>.<gate>` | `{}` | A literal command, which wins over scripts and profile defaults. `"skip"` turns that gate off. Placeholders: `{files}`, `{testFiles}`, `{packages}`, `{crates}`, `{charts}`, `{base}`. |
167
+ | `gates.extra[]` | `[]` | Conditional gates: `name`, `type`, `phases`, `when.changed`, `command`, `env`, `setup`, `outputs`, `checkOnly`, `timeoutMs`.`outputs` makes it a generated-artifact drift gate. |
168
+ | `contracts[]` | detected | `{ kind: openapi \| proto \| json-schema \| helm-values \| generated \| crd \| ipc \| custom, provider, path, consumers[], command?, outputs?, allowBreaking?, validate?{<consumer>: cmd} }`.`generated`/`crd`/`ipc` contracts run their command and fail on output drift. In `validate` commands, `{contract}` is the absolute path of the provider's new contract. |
169
+ | `commits.{style, scopes}` | `"conventional"`, `false` | `"gitmoji"` keeps the Conventional prefix and adds the emoji; `scopes` adds the repo name to task commits. |
170
+ | `workflow.{refine, clarifyRounds, reviewRounds, quick}` | `true`, `2`, `1`, `{enabled: true, branchPrefix: "task/"}` | Enables `workflow.refine` and caps clarification rounds; `reviewRounds` re-reviews after fix rounds (1 = a single pass, max 10); `quick` enables `loomwright quick`. |
171
+ | `release.detect` | `true` | Detects release-please, goreleaser, changesets and forge CI, and reports them in `doctor`; no workflow is edited. |
172
+ | `parallel.maxAgents` | `4` | Concurrent agent sessions. |
173
+ | `parallel.maxGateProcesses` | `2` | Concurrent gate processes. |
174
+ | `parallel.withinRepo` | `"worktrees"` | `"serial"` runs one task per repo at a time. |
175
+ | `runtime.turnTimeoutMinutes` | `60` | Per agent turn wall-clock limit. A timed-out turn is interrupted and retried; raise this for very long builds or slow models. |
176
+ | `tokens.contextPackMaxTokens` | `8000` | Cap on each task's context pack. |
177
+ | `tokens.gateOutputMaxLines` | `80` | Compacted gate output fed back to agents. |
178
+ | `tokens.mode` | `"report"` | Usage is reported, never enforced. |
179
+ | `addons.ponytail.{enabled, ref, roles, level, shortcutComments}` | `true`, pinned ref, `["implementer","reviewer"]`, `"full"`, `"report"` | See [Ponytail](#ponytail). |
180
+ | `logs.retentionDays` | `14` | How long logs are kept. |
181
+ | `logs.redact` | `true` | Redacts secrets from the logs. |
182
+ | `artifacts.{mode, reports, approvals, usage}` | `"local"`, `true`, `true`, `true` | `"git"` commits each finished change's final report, approval and usage ledger under `factory-records/` (see [ADR-0035](docs/decisions/0035-tracked-artifacts.md)). Logs, paused reports and run state always stay local. |
183
+ | `graph.exclude` | node_modules, vendor, target, dist, build, coverage, .next, `__pycache__`, .venv, .factory, factory-records, graphify-out | Paths the graph skips. |
184
+ | `security.sandbox` | `"auto"` | Run agent shells and gates in an OS sandbox: macOS `sandbox-exec` when present. It blocks writes outside the session's worktree, edits to rc and git files, reads of credential files, git credential helpers and ssh. `"off"` disables it. Other platforms have no sandbox yet; `doctor` warns. |
185
+ | `websearch` | `{"provider":"random"}` | opencode's web search provider for agents: a provider id, `"random"` to reuse an available provider until it is rate limited, or `false` to remove the tool. A provider must be selected; otherwise opencode asks interactively and a headless run cancels the search after a minute. |
186
+ | `unmanaged[]` | `[]` | Managed files you want to own completely: `update` never touches them. |
187
+
188
+ `workflow.refine` enables the agent-raised questions described under [Refinement and quick tasks](#refinement-and-quick-tasks); `workflow.clarifyRounds` (default 2) caps the rounds per phase. `workflow.reviewRounds` (default 1, max 10) sets the reviewer passes: above 1, every touched repo is reviewed again after a fix round until a pass finds no `must`/`should` code findings, or the cap is reached; the last fix round still runs and remaining findings stay in the report. Each extra round costs one reviewer session per touched repo. `run --interactive` was removed in favour of `refine` + `run --request`.
189
+
190
+ You can edit the agents in `.opencode/agents/` and the standards in `.opencode/standards/`. `update` merges your edits with new templates. `detect` shows drift between the workspace and the config, and `detect --apply` adds new repos' implementers, scopes and hooks. Built-in agents other than the orchestrator may use read-only web search/fetch; custom agents need `web: true`.
191
+
192
+ ## Updating
193
+
194
+ ```bash
195
+ bunx @loomwright/cli@<new> update --dry-run # print the plan
196
+ bunx @loomwright/cli@<new> update # one commit: chore(factory): update to vX.Y.Z
197
+ bunx @loomwright/cli@<new> rollback # undo it
198
+ ```
199
+
200
+ `update` migrates the config while keeping your comments. It replaces managed files you didn't touch, merges three-way the ones you edited (a conflict leaves markers and commits nothing), and keeps deleted files deleted unless `--restore`. `--tools` also refreshes OpenSpec's files and rebuilds the graph if its format changed. It refuses while a change is in progress unless `--force`; a running change keeps the agent and gate definitions it was approved with. For many workspaces, see [docs/fleet-update.sh](docs/fleet-update.sh).
201
+
202
+ ## Ponytail
203
+
204
+ [Ponytail](https://github.com/DietrichGebert/ponytail) (minimal-code guidance) is vendored at `v5.3.2@16352ac2`, verified by content hash, and injected only into implementer and reviewer prompts. The factory's rules and your standards take precedence over it. `shortcutComments: "report"` collects `shortcut:` comments into the report, and `"forbid"` fails the gate on them.
205
+
206
+ **Default.** `enabled: true` is provisional. `loomwright bench ponytail` compares runs with and without it on your models: tokens, diff size, first-attempt pass rate, retries, coverage and review findings. It writes the result to `docs/bench/`. The bench makes real model calls, so it prints a cost estimate and asks first. It has not been run for this release yet, and the default will be set from its result.
207
+
208
+ ## Troubleshooting
209
+
210
+ | Symptom | Fix |
211
+ | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
212
+ | `uses config schemaVersion 1; this factory needs 4` | `loomwright update` (it migrates v1 → v4 and keeps comments). |
213
+ | `doctor`: `model … is not available to opencode` | Run `opencode auth login <provider>` (imported on the next run) or export the key (e.g. `ANTHROPIC_API_KEY`), or change the model. `doctor` lists the stored credentials without their values. |
214
+ | `doctor` / `gate`: `no format gate` or `not found: golangci-lint` | Install the tool, add a script under the name in `gates.scripts`, or set `gates.overrides.<repo>.<gate>` (`"skip"` to turn it off). |
215
+ | `gate is not check-only` | Your format or lint script writes files. Point the gate at the check variant (e.g. `prettier --check`, `biome check`). |
216
+ | The change paused | Read `.factory/reports/<id>.md`. Fix the code in the named worktree, then run `retry <id> --task <n>`; or run `resume <id>` after a transient failure. |
217
+ | `the spec changed after approval` | Something other than a checkbox changed in `openspec/changes/<id>/`. Review it, then run `approve <id>` again. |
218
+ | `<id> is the active change` after a crash | `loomwright resume <id>` takes over the stale lock (or `abort <id>`). `doctor` shows locks that nothing is driving. |
219
+ | `update` stopped with conflicts | Resolve the `<<<<<<< yours` markers in the listed files and commit, or `loomwright rollback`. |
220
+ | `Ponytail add-on files were modified` | `loomwright update --restore`, or set `addons.ponytail.enabled` to `false`. |
221
+ | A push is rejected by the `ai-factory` pre-push hook | It blocks pushes from agents while a change is active. Push from your own shell, where `AI_FACTORY_AGENT` is not set. |
222
+ | Tauri: `cargo check` fails on a permission "not found" | A capability in `src-tauri/capabilities/` names a permission the app doesn't have. Add the plugin (`tauri add <plugin>`) or fix the identifier. |
223
+ | Tauri gates fail on Linux with missing `webkit2gtk`/`pkg-config` libraries | Install Tauri's Linux prerequisites on the machine that runs the gates. |
224
+ | An agent's command fails with `Operation not permitted` | The macOS sandbox stopped a write outside the session's worktree, or a read of a credential file. Agents work inside their worktree. If a repo truly needs more, set `security.sandbox` to `"off"` (weaker guarantees; see ADR-0026). |
225
+ | A task fails with "you changed how your work is checked" | It edited a script or target the gates run (e.g. `scripts.lint` in package.json). Change gate definitions yourself, outside a factory change. |
226
+ | A submodule is missing or empty | `loomwright doctor` offers `git submodule update --init`. |
227
+ | Commits fail with a signing error | The factory commits with your git config. Unlock your signing agent (e.g. 1Password) and run `resume`, or rerun the command. |
228
+ | Agents re-read the same files a lot | `status` shows wasted re-reads. Build the graph (`loomwright graph`) so agents can query it instead. |
229
+
230
+ Logs: `.factory/logs/<id>/` (redacted tool calls and gate results). Run state: `.factory/runs/<id>.json`.
231
+
232
+ ## Adding a language profile
233
+
234
+ A profile is the language's prose standard plus a machine-readable part: test globs, markers, gate commands and install steps.
235
+ 1. Add the id to `LANGUAGES` in `src/config/schema.ts`. Enum additions need no config migration, and the editor JSON schema is generated from it.
236
+ 2. Add detection in `src/detect/languages.ts`: the manifest or marker files that imply it.
237
+ 3. Write `templates/standards/<id>.md` from the language's primary docs:
238
+ - a `<!-- Sources: [key] Title — URL -->` block under the title;
239
+ - a `## Summary` of standalone bullets (they go into `AGENTS.md`);
240
+ - under each section, a `<!-- [key] … -->` comment naming what grounds it, and `<!-- factory -->` after rules that come from the factory rather than a source.
241
+
242
+ A test enforces the citations. The comments are stripped from agent prompts.
243
+ 4. Add the profile to `PROFILES` in `src/profiles/index.ts`:
244
+ - `testGlobs`: what the tester may edit;
245
+ - `markers` and `targets`: where gates run;
246
+ - `extensions` and `binDirs`;
247
+ - `gates`: per gate type, candidates in preference order, with optional `when` requirements and `scoped` per-task variants;
248
+ - `install`: lockfile → command;
249
+ - `supersedes` (optional): profiles whose target in the same directory this one replaces. The Tauri profile replaces Rust in `src-tauri/`, for example.
250
+ 5. If its package manager has a cache, add it to `cacheEnv` in `src/gates/install.ts`.
251
+ 6. Add tests: detection (`test/detect-units.test.ts`) and gate resolution (`test/gates-resolve.test.ts`).
252
+ 7. Add a changeset with `bun run changeset` (a user-facing change needs a release note). Workspaces pick up the new standard and their regenerated implementers with `loomwright update`, then `loomwright detect --apply` adds the language to the repos that use it.
253
+
254
+ ## Development
255
+
256
+ ```bash
257
+ bun install
258
+ bun run check # biome + tsc + bun test
259
+ bun run build # dist/cli.js and the bundled plugin
260
+ bun run changeset # record a release note for this PR
261
+ AI_FACTORY_E2E=1 bun test test/opencode-runtime.e2e.test.ts # real opencode, stub model server
262
+ bun scripts/e2e-transcript.ts single # re-record docs/e2e/single.md (also: submodules)
263
+ ```
264
+
265
+ The test suite builds fixture workspaces in temp dirs: a single TS repo, and an AI repo with Go, React and Helm submodules. It stubs the LLM with scripted handoffs. The manual end-to-end runs in [docs/e2e/](docs/e2e/) drive the real opencode server, git, OpenSpec, Graphify and gate toolchains, with a scripted role-aware model, so they cost nothing and can be reproduced. See ADR-0023 for what they cover and what they don't.
266
+
267
+ CI runs the full suite on Ubuntu and macOS, then smoke-tests the npm tarball and the built bundle on Node 20.3, 22 and 24. The manual `E2E` workflow runs the real-opencode runtime test against each supported opencode version (2.1.2 and 2.2.0).
268
+
269
+ ### Releasing
270
+
271
+ Changesets owns the version and the changelog. Release tooling runs on Node 24; the published CLI still supports Node >=20.3.
272
+ 1. Create `release/vX.Y.Z` from `main`.
273
+ 2. Run `bun run release:version`. It applies the pending changesets, writes `CHANGELOG.md`, syncs `src/version.ts` and regenerates the install snapshot.
274
+ 3. Review the changelog and the version files, then run `bun run check`.
275
+ 4. Commit, push and open a normal PR. CI runs on it.
276
+ 5. Merge the PR. The release workflow re-runs the checks, publishes the new version to npm with provenance, and creates the `X.Y.Z` GitHub Release and tag with the tarball attached.
277
+
278
+ The `npm` environment should require a reviewer. Merging a version PR is the release action; branch protection and tag protection are part of the process. Publishing is disabled until the repository variable `RELEASE_ENABLED` is `true`. The first publish is manual because npm trusted publishing requires an existing package; set the variable after publishing 0.2.0 and configuring the trusted publisher. On npm, configure workflow `release.yml`, environment `npm`, and allow direct `npm publish` (not stage-only). `package.json`'s `repository.url` must match the GitHub repository exactly. See ADR-0029.