@felixdotgo/aidlc-kit 0.2.0 → 0.3.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/DEVELOPMENT.md +13 -26
- package/README.md +35 -39
- package/dist/assets/.agents/aidlc/orchestrator.md +1 -1
- package/dist/assets/.agents/aidlc/schemas/state.schema.json +2 -0
- package/dist/assets/.agents/aidlc/scripts/lib/assignment-store.mjs +94 -48
- package/dist/assets/.agents/aidlc/scripts/lib/context-runtime.mjs +5 -4
- package/dist/assets/.agents/aidlc/scripts/lib/loop-authority.mjs +21 -5
- package/dist/assets/.agents/aidlc/scripts/lib/loop-daemon.mjs +52 -78
- package/dist/assets/.agents/aidlc/scripts/lib/loop-drivers.mjs +88 -14
- package/dist/assets/.agents/aidlc/scripts/lib/loop-env.mjs +279 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-cli.mjs +20 -5
- package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-remote.mjs +10 -1
- package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet-supervisor.mjs +2 -1
- package/dist/assets/.agents/aidlc/scripts/lib/loop-fleet.mjs +3 -2
- package/dist/assets/.agents/aidlc/scripts/lib/loop-git.mjs +9 -3
- package/dist/assets/.agents/aidlc/scripts/lib/loop-holder.mjs +376 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-intake.mjs +11 -3
- package/dist/assets/.agents/aidlc/scripts/lib/loop-lease.mjs +67 -61
- package/dist/assets/.agents/aidlc/scripts/lib/loop-leases.mjs +268 -0
- package/dist/assets/.agents/aidlc/scripts/lib/loop-local-workers.mjs +78 -17
- package/dist/assets/.agents/aidlc/scripts/lib/loop-runtime.mjs +42 -10
- package/dist/assets/.agents/aidlc/scripts/lib/loop-stream.mjs +66 -9
- package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor-local.mjs +16 -56
- package/dist/assets/.agents/aidlc/scripts/lib/loop-supervisor-run-local.mjs +12 -6
- package/dist/assets/.agents/aidlc/scripts/lib/loop-worker-docker.mjs +14 -2
- package/dist/assets/.agents/aidlc/scripts/lib/loop-worker-log.mjs +158 -0
- package/dist/assets/.agents/aidlc/scripts/lib/repo-head.mjs +22 -0
- package/dist/assets/.agents/aidlc/scripts/lib/store.mjs +11 -0
- package/dist/assets/.agents/aidlc/scripts/lib/task-runtime-migrate.mjs +75 -0
- package/dist/assets/.agents/aidlc/scripts/lib/task-runtime.mjs +97 -0
- package/dist/assets/.agents/aidlc/scripts/loop-entry.mjs +87 -4
- package/dist/assets/.agents/aidlc/scripts/loop.cmd +101 -0
- package/dist/assets/.agents/aidlc/scripts/loop.sh +71 -0
- package/dist/assets/.agents/aidlc/scripts/remote-state.mjs +10 -4
- package/dist/assets/.agents/aidlc/scripts/state.mjs +16 -8
- package/dist/assets/ui/changes.js +83 -0
- package/dist/assets/ui/common.js +664 -0
- package/dist/assets/ui/dashboard.css +281 -59
- package/dist/assets/ui/dashboard.js +77 -0
- package/dist/assets/ui/detail.js +159 -0
- package/dist/assets/ui/live-log.js +332 -0
- package/dist/services/aidlc-coordination/package.json +1 -1
- package/dist/services/aidlc-coordination/src/lifecycle-core.mjs +11 -0
- package/dist/src/cli/argv.js +10 -4
- package/dist/src/cli/commands.js +52 -22
- package/dist/src/cli/loop-launcher.d.ts +47 -0
- package/dist/src/cli/loop-launcher.js +322 -0
- package/dist/src/cli.js +3 -0
- package/dist/src/installer.js +4 -2
- package/dist/src/model/records.d.ts +4 -0
- package/dist/src/state/validate.js +5 -0
- package/dist/src/task-ui.d.ts +31 -52
- package/dist/src/task-ui.js +25 -1562
- package/dist/src/ui/assets.d.ts +14 -0
- package/dist/src/ui/assets.js +45 -0
- package/dist/src/ui/changes.d.ts +83 -0
- package/dist/src/ui/changes.js +498 -0
- package/dist/src/ui/containers.d.ts +71 -0
- package/dist/src/ui/containers.js +214 -0
- package/dist/src/ui/daemon.d.ts +75 -0
- package/dist/src/ui/daemon.js +232 -0
- package/dist/src/ui/data.d.ts +42 -0
- package/dist/src/ui/data.js +89 -0
- package/dist/src/ui/docs.d.ts +13 -0
- package/dist/src/ui/docs.js +39 -0
- package/dist/src/ui/files.d.ts +3 -0
- package/dist/src/ui/files.js +20 -0
- package/dist/src/ui/http.d.ts +14 -0
- package/dist/src/ui/http.js +80 -0
- package/dist/src/ui/live.d.ts +5 -0
- package/dist/src/ui/live.js +43 -0
- package/dist/src/ui/markdown.d.ts +2 -0
- package/dist/src/ui/markdown.js +127 -0
- package/dist/src/ui/options.d.ts +48 -0
- package/dist/src/ui/options.js +81 -0
- package/dist/src/ui/security.d.ts +34 -0
- package/dist/src/ui/security.js +38 -0
- package/dist/src/ui/server.d.ts +39 -0
- package/dist/src/ui/server.js +347 -0
- package/dist/src/ui/sse.d.ts +14 -0
- package/dist/src/ui/sse.js +281 -0
- package/dist/src/ui/views/board.d.ts +7 -0
- package/dist/src/ui/views/board.js +131 -0
- package/dist/src/ui/views/changes.d.ts +19 -0
- package/dist/src/ui/views/changes.js +154 -0
- package/dist/src/ui/views/components.d.ts +56 -0
- package/dist/src/ui/views/components.js +113 -0
- package/dist/src/ui/views/docs.d.ts +15 -0
- package/dist/src/ui/views/docs.js +64 -0
- package/dist/src/ui/views/layout.d.ts +44 -0
- package/dist/src/ui/views/layout.js +233 -0
- package/dist/src/ui/views/task.d.ts +25 -0
- package/dist/src/ui/views/task.js +320 -0
- package/dist/src/upgrade.js +5 -2
- package/dist/src/workflow.d.ts +4 -0
- package/dist/src/workflow.js +33 -1
- package/docs/README.md +48 -33
- package/docs/architecture.md +101 -38
- package/docs/command-reference.md +269 -93
- package/docs/configuration.md +62 -42
- package/docs/coordination-service.md +85 -36
- package/docs/design-decisions.md +35 -31
- package/docs/development.md +111 -61
- package/docs/loop-local-run.md +135 -402
- package/docs/loop-runbook.md +84 -105
- package/docs/operating-workflow.md +55 -42
- package/docs/testing-and-release.md +70 -51
- package/docs/troubleshooting.md +165 -69
- package/package.json +1 -1
package/docs/development.md
CHANGED
|
@@ -1,37 +1,32 @@
|
|
|
1
1
|
# Development guide
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Local setup, dogfooding, source ownership, and the rules that keep package runtime and installed workflow aligned. To use the workflow in your own project, start at the [documentation index](./README.md).
|
|
4
4
|
|
|
5
5
|
## Requirements and dependencies
|
|
6
6
|
|
|
7
|
-
- Node.js 20.17 or newer
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- Development uses TypeScript and `@types/node` as declared in `package.json`.
|
|
7
|
+
- Node.js 20.17 or newer; npm installs the dev dependencies (TypeScript, `@types/node`).
|
|
8
|
+
- `@inquirer/prompts` is the only runtime dependency; installed lifecycle scripts are dependency-free.
|
|
9
|
+
- Codex, Claude Code, or OpenCode: only for real evaluator drivers; OpenCode also needs `AIDLC_OPENCODE_MODEL` (`provider/model[#variant]`).
|
|
11
10
|
|
|
12
11
|
```sh
|
|
13
12
|
npm install
|
|
14
13
|
```
|
|
15
14
|
|
|
16
|
-
Codex, Claude Code, or OpenCode are optional for manually exercising real evaluator drivers. Ordinary build, lint, and unit-test work does not need external model credentials. OpenCode driver runs also need `AIDLC_OPENCODE_MODEL` set to a `provider/model[#variant]` value.
|
|
17
|
-
|
|
18
15
|
## Platform support
|
|
19
16
|
|
|
20
|
-
Node.js 20.17 or newer is required on every platform. Linux and macOS are fully supported and tested. Windows is best-effort: win32 path separators are handled in `src/state/guards.ts`, `src/profiles.ts`, and the installed `assets/aidlc/scripts/lib/store.mjs`/`context-runtime.mjs`, and the state lock uses `process.kill(pid, 0)` for liveness; the lock and path handling are not exercised on Windows in CI. Loop and fleet features require Docker and a POSIX shell (`loop-local-workers.mjs` rejects non-Linux hosts).
|
|
21
|
-
|
|
22
17
|
| Platform | Status | Notes |
|
|
23
18
|
| --- | --- | --- |
|
|
24
19
|
| Linux | Supported | Full CI coverage; Docker worker isolation available. |
|
|
25
20
|
| macOS | Supported | Full test coverage; POSIX shell recipes apply. |
|
|
26
|
-
| Windows | Best-effort | Use WSL or Git Bash for
|
|
27
|
-
| Loop / fleet | Linux only |
|
|
21
|
+
| Windows | Best-effort | Use WSL or Git Bash for shell recipes. win32 separators handled in `src/state/guards.ts`, `src/profiles.ts`, installed `lib/store.mjs` and `context-runtime.mjs`; state lock liveness via `process.kill(pid, 0)`. Not in CI. |
|
|
22
|
+
| Loop / fleet | Linux only | Needs Docker and a POSIX shell; `loop-local-workers.mjs` rejects other hosts. E2e tests need `AIDLC_TEST_WORKER_IMAGE` and `AIDLC_WORKER_DOCKER_IMAGE`. |
|
|
28
23
|
|
|
29
24
|
## Repository layout
|
|
30
25
|
|
|
31
26
|
```text
|
|
32
27
|
assets/aidlc/ Source workflow contracts, schemas, and installed scripts
|
|
33
28
|
skills/ Source thin phase adapters
|
|
34
|
-
src/
|
|
29
|
+
src/ Package CLI (src/cli/), installer, shared planning core, lifecycle domain (src/model/, src/state/), profiles, migrations
|
|
35
30
|
dev/evaluator/ Development-only evaluator harness and runners
|
|
36
31
|
scripts/build-assets.mjs Bundles workflow assets for package distribution
|
|
37
32
|
test/unit/ Unit and installed-runtime parity tests
|
|
@@ -39,26 +34,22 @@ docs/ User, operator, and contributor documentation
|
|
|
39
34
|
dist/ Generated TypeScript and bundled assets; do not hand-edit
|
|
40
35
|
```
|
|
41
36
|
|
|
42
|
-
|
|
37
|
+
Three layouts: source (`assets/aidlc/`, `skills/`), bundle (`dist/assets/.agents/`), installed (consumer `.agents/aidlc/` and `.agents/skills/`). Say which you mean.
|
|
43
38
|
|
|
44
39
|
## Local commands
|
|
45
40
|
|
|
46
41
|
| Command | Purpose |
|
|
47
42
|
| --- | --- |
|
|
48
|
-
| `npm run build` |
|
|
43
|
+
| `npm run build` | Bundle workflow assets and compile TypeScript into `dist/`. |
|
|
49
44
|
| `npm run sync-core` | Copy `assets/aidlc/scripts/lib/store.mjs` to `services/aidlc-coordination/src/lifecycle-core.mjs` byte-identically. |
|
|
50
45
|
| `npm run lint` | Type-check without emitting files. |
|
|
51
|
-
| `npm test` | Build, then run
|
|
52
|
-
| `node --test dist/test/unit/<file>.test.js` | Run
|
|
53
|
-
| `npm run release:check` |
|
|
54
|
-
|
|
55
|
-
Run the narrowest relevant test while iterating, then run `npm test` and `npm run lint` before handing off a non-trivial change. See [Testing and release](./testing-and-release.md) for the package smoke test and evaluator.
|
|
46
|
+
| `npm test` | Build, then run all compiled unit tests (Node test runner). |
|
|
47
|
+
| `node --test dist/test/unit/<file>.test.js` | Run one compiled test after building. |
|
|
48
|
+
| `npm run release:check` | Release-evidence policy check. |
|
|
56
49
|
|
|
57
50
|
## Local build and registry-free installation
|
|
58
51
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Run the following POSIX shell commands from the repository root:
|
|
52
|
+
Install the checkout's assets into a disposable consumer project via the compiled CLI (no `npm install`, `npx`, or registry). From the repository root:
|
|
62
53
|
|
|
63
54
|
```sh
|
|
64
55
|
AIDLC_REPO="$(pwd)"
|
|
@@ -74,72 +65,131 @@ node "$AIDLC_LOCAL_PROJECT/.agents/aidlc/scripts/state.mjs" task list --root "$A
|
|
|
74
65
|
printf 'Local test project: %s\n' "$AIDLC_LOCAL_PROJECT"
|
|
75
66
|
```
|
|
76
67
|
|
|
77
|
-
|
|
68
|
+
- Use a new empty directory each time (reuse across versions triggers the human-only upgrade protection); remove it manually. On Windows, create it in PowerShell and pass the absolute path.
|
|
69
|
+
- Do not target a real project unless its managed files and state are intentional test targets.
|
|
70
|
+
- This checks the compiled checkout only, not the published allowlist, bin metadata, or tarball exclusions; run the [package smoke test](./testing-and-release.md#package-smoke-test) before release.
|
|
71
|
+
|
|
72
|
+
## Run `npx` from a local package archive
|
|
78
73
|
|
|
79
|
-
|
|
74
|
+
```sh
|
|
75
|
+
npm pack
|
|
76
|
+
npx --package felixdotgo-aidlc-kit-0.3.0.tgz -- aidlc-kit init .
|
|
77
|
+
```
|
|
80
78
|
|
|
81
|
-
|
|
79
|
+
Run from the archive's directory; pass a disposable project instead of `.` to avoid writing into the current directory.
|
|
82
80
|
|
|
83
|
-
##
|
|
81
|
+
## Dogfooding this repository
|
|
84
82
|
|
|
85
|
-
|
|
83
|
+
`.agents/` is gitignored; each contributor installs the repository's own workflow from the checkout.
|
|
84
|
+
|
|
85
|
+
### Install the workflow from source
|
|
86
86
|
|
|
87
87
|
```sh
|
|
88
|
-
npm
|
|
89
|
-
|
|
88
|
+
npm install
|
|
89
|
+
npm run build
|
|
90
|
+
node dist/src/cli.js init . --agent <codex|claude|opencode> --loop-mode off --yes
|
|
90
91
|
```
|
|
91
92
|
|
|
92
|
-
|
|
93
|
+
Edit `.agents/config.json` as below (`commands` as executable-and-argument arrays; your adapter id → `"scripted"` in `agentState`), then `node dist/src/cli.js profile validate .`.
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"commands": {
|
|
98
|
+
"build": { "command": "npm", "args": ["run", "build"] },
|
|
99
|
+
"test": { "command": "npm", "args": ["test"] },
|
|
100
|
+
"lint": { "command": "npm", "args": ["run", "lint"] }
|
|
101
|
+
},
|
|
102
|
+
"agentState": { "opencode": "scripted" }
|
|
103
|
+
}
|
|
104
|
+
```
|
|
93
105
|
|
|
94
|
-
|
|
106
|
+
### Check for drift and re-sync
|
|
95
107
|
|
|
96
|
-
|
|
108
|
+
After changing `assets/aidlc/`, check for a stale install (any output means stale; symptom: `loop: Isolated local worker dispatcher is not integrated; loop execution is unavailable`):
|
|
97
109
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
```sh
|
|
111
|
+
diff -rq assets/aidlc/scripts .agents/aidlc/scripts
|
|
112
|
+
```
|
|
101
113
|
|
|
102
|
-
|
|
114
|
+
Re-sync is a human-only upgrade (TTY required); stop the loop daemon first (`node dist/src/cli.js loop down --root .` or `loop stop`), then re-run `diff -rq`:
|
|
103
115
|
|
|
104
|
-
|
|
116
|
+
```sh
|
|
117
|
+
npm run build
|
|
118
|
+
node dist/src/cli.js upgrade . --dry-run # preview the plan
|
|
119
|
+
node dist/src/cli.js upgrade . # type the package version when prompted
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Run the loop from a source checkout
|
|
123
|
+
|
|
124
|
+
> [!WARNING]
|
|
125
|
+
> Experimental, pre-1.0. See [Status and stability](./loop-runbook.md#status-and-stability).
|
|
126
|
+
|
|
127
|
+
In place of `npx --package @felixdotgo/aidlc-kit@<version> aidlc-kit …`, run the compiled CLI after `npm run build`:
|
|
128
|
+
|
|
129
|
+
| Task | Command |
|
|
130
|
+
| --- | --- |
|
|
131
|
+
| Start the daemon and dashboard | `node dist/src/cli.js loop up --root .` |
|
|
132
|
+
| Check daemon and task status | `node dist/src/cli.js loop status --root . [--task-id <task-id>]` |
|
|
133
|
+
| Serve only the dashboard | `node dist/src/cli.js ui .` |
|
|
134
|
+
|
|
135
|
+
See [Local loop walkthrough](./loop-local-run.md) and [Command reference](./command-reference.md#loop).
|
|
105
136
|
|
|
106
|
-
|
|
137
|
+
## Ownership boundaries
|
|
138
|
+
|
|
139
|
+
- `.agents/aidlc/`: package-managed kernel assets.
|
|
140
|
+
- `.agents/project/`: project-owned config, profiles, rules, and evaluation material.
|
|
141
|
+
- `.agents/data/`: project-owned task state and derived data; never add a second lifecycle board or hand-edit it.
|
|
107
142
|
|
|
108
|
-
|
|
143
|
+
## Mirrored runtime behaviour
|
|
109
144
|
|
|
110
|
-
|
|
145
|
+
- TypeScript powers the package CLI; installed projects use the dependency-free mirror in `assets/aidlc/scripts/`. Lifecycle, state, gate, profile, or context changes keep parity and add coverage for both.
|
|
146
|
+
- A public configuration or schema change updates validator, JSON schema, installed assets, package inventory, docs, and tests together.
|
|
147
|
+
- Dual-core sync rule: after editing `assets/aidlc/scripts/lib/store.mjs`, run `npm run sync-core` so `services/aidlc-coordination/src/lifecycle-core.mjs` stays byte-identical.
|
|
111
148
|
|
|
112
149
|
## Code style and conventions
|
|
113
150
|
|
|
114
|
-
|
|
151
|
+
Baseline (decision `D1-convention-standard`, task `refactor-source-readability`):
|
|
115
152
|
|
|
116
|
-
- **Strict TypeScript
|
|
117
|
-
- **
|
|
118
|
-
- **
|
|
119
|
-
- **Naming.**
|
|
120
|
-
- **
|
|
121
|
-
- **Dependencies.** Pass
|
|
122
|
-
- **Public API.**
|
|
123
|
-
- **Behavior preservation.** Refactors
|
|
124
|
-
- **Verification.**
|
|
153
|
+
- **Strict TypeScript.** Keep `strict`; enforce via `npm run lint` (`tsc --noEmit`). No ESLint/Prettier or other tooling deps.
|
|
154
|
+
- **Size.** ≤250 lines per file, ≤60 per function; split by responsibility.
|
|
155
|
+
- **Modules.** One responsibility each; a facade may re-export a public API (e.g. `src/state.ts`).
|
|
156
|
+
- **Naming.** camelCase functions/variables, `PascalCase` types, `SCREAMING_SNAKE_CASE` constants; file name matches primary export.
|
|
157
|
+
- **Errors.** Typed one-line errors; never swallow; validate inputs before I/O.
|
|
158
|
+
- **Dependencies.** Pass fetch, clock, environment explicitly; no module-level mutable state.
|
|
159
|
+
- **Public API.** JSDoc exported symbols with non-obvious contracts.
|
|
160
|
+
- **Behavior preservation.** Refactors never change CLI output, state schema, file layout, or installed assets; run parity tests.
|
|
161
|
+
- **Verification.** Narrowest test while iterating; `npm test` + `npm run lint` before handoff.
|
|
125
162
|
|
|
126
163
|
## Safe implementation rules
|
|
127
164
|
|
|
128
|
-
- Resolve
|
|
129
|
-
- Keep
|
|
165
|
+
- Resolve project-relative paths through the shared path helpers; reject traversal and symlink escape.
|
|
166
|
+
- Keep install, migration, and upgrade plans deterministic and conflict-first.
|
|
130
167
|
- Preserve project-owned configuration and state when changing managed assets.
|
|
131
|
-
-
|
|
132
|
-
-
|
|
133
|
-
|
|
134
|
-
Read [Architecture](./architecture.md) before changing a module boundary, migration, installed script, or bundle layout.
|
|
168
|
+
- Never add remote profile discovery, runtime asset downloads, executable plugin hooks, registry checks, or shell-string execution.
|
|
169
|
+
- Human-gated lifecycle transitions are atomic, auditable state operations.
|
|
170
|
+
- Read [Architecture](./architecture.md) before changing a module boundary, migration, installed script, or bundle layout.
|
|
135
171
|
|
|
136
172
|
## Contributing to prompt assets
|
|
137
173
|
|
|
138
|
-
Prompt assets are the
|
|
174
|
+
Prompt assets are the contracts under `assets/aidlc/` (`orchestrator.md`, `phase-*.md`) that `context.mjs` turns into phase packets.
|
|
139
175
|
|
|
140
|
-
- Keep them compact:
|
|
141
|
-
-
|
|
176
|
+
- Keep them compact: default packet budget is 16,000 characters (`config.context.maxChars`); optional rules and diagnostics drop first.
|
|
177
|
+
- Never truncated (generation fails instead): next-action contract, phase contract, approved decisions, safety/spec anchors, task state, latest applicable evidence.
|
|
178
|
+
- Heading invariants enforced by `gate-check.mjs`:
|
|
142
179
|
- Intent (`G0_confirm`): `## 📋 Problem`, `## 🗺️ Affected areas`, `## 💭 Assumptions`, `## ❓ Open questions`, `## 🎯 Scope`.
|
|
143
180
|
- Design (`G1_review`): `## 🧩 Solution per affected area`, `## 📌 Spec traceability`, `## 🔗 Cross-service contracts`, `## ⚠️ Risks / edge cases`.
|
|
144
|
-
-
|
|
145
|
-
|
|
181
|
+
- After changing contracts, run `npm run release:check` (`--adapters opencode`) and the evaluator suite; update docs and tests in the same change. Rationale: [Design decisions](./design-decisions.md) D6.
|
|
182
|
+
|
|
183
|
+
## Documentation conventions
|
|
184
|
+
|
|
185
|
+
Follow [Adding or changing a page](./README.md#adding-or-changing-a-page). In addition:
|
|
186
|
+
|
|
187
|
+
- A public contract change (command, config field, schema, installed asset) updates its guide and the asserting test in the same change.
|
|
188
|
+
- Never duplicate canonical agent instructions from `assets/aidlc/`; link to the installed asset.
|
|
189
|
+
|
|
190
|
+
## Related
|
|
191
|
+
|
|
192
|
+
- [Testing and release](./testing-and-release.md)
|
|
193
|
+
- [Architecture](./architecture.md)
|
|
194
|
+
- [Design decisions](./design-decisions.md)
|
|
195
|
+
- [Configuration](./configuration.md)
|