@felixdotgo/aidlc-kit 0.0.1
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 +31 -0
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/assets/.agents/aidlc/conventions.md +68 -0
- package/dist/assets/.agents/aidlc/orchestrator.md +73 -0
- package/dist/assets/.agents/aidlc/phase-build.md +23 -0
- package/dist/assets/.agents/aidlc/phase-clarify.md +22 -0
- package/dist/assets/.agents/aidlc/phase-index.md +14 -0
- package/dist/assets/.agents/aidlc/phase-plan.md +21 -0
- package/dist/assets/.agents/aidlc/phase-wrap.md +16 -0
- package/dist/assets/.agents/aidlc/profiles/generic/profile.json +9 -0
- package/dist/assets/.agents/aidlc/profiles/git-submodules/profile.json +9 -0
- package/dist/assets/.agents/aidlc/profiles/single/profile.json +9 -0
- package/dist/assets/.agents/aidlc/profiles/workspace/profile.json +12 -0
- package/dist/assets/.agents/aidlc/rules/gate-check.md +16 -0
- package/dist/assets/.agents/aidlc/rules/stack-runtime.md +3 -0
- package/dist/assets/.agents/aidlc/schemas/adapter.schema.json +13 -0
- package/dist/assets/.agents/aidlc/schemas/config.schema.json +26 -0
- package/dist/assets/.agents/aidlc/schemas/manifest.schema.json +12 -0
- package/dist/assets/.agents/aidlc/schemas/profile.schema.json +12 -0
- package/dist/assets/.agents/aidlc/schemas/state.schema.json +108 -0
- package/dist/assets/.agents/aidlc/scripts/context.mjs +15 -0
- package/dist/assets/.agents/aidlc/scripts/gate-check.mjs +16 -0
- package/dist/assets/.agents/aidlc/scripts/gate-view.mjs +16 -0
- package/dist/assets/.agents/aidlc/scripts/lib/context-runtime.mjs +238 -0
- package/dist/assets/.agents/aidlc/scripts/lib/runtime.mjs +2 -0
- package/dist/assets/.agents/aidlc/scripts/lib/store.mjs +341 -0
- package/dist/assets/.agents/aidlc/scripts/render.mjs +24 -0
- package/dist/assets/.agents/aidlc/scripts/state.mjs +222 -0
- package/dist/assets/.agents/aidlc/scripts/task-next.mjs +27 -0
- package/dist/assets/.agents/aidlc/templates/design.md +15 -0
- package/dist/assets/.agents/aidlc/templates/intent.md +17 -0
- package/dist/assets/.agents/aidlc/templates/lesson.md +28 -0
- package/dist/assets/.agents/aidlc/templates/model-contract.md +41 -0
- package/dist/assets/.agents/aidlc/templates/workplan.md +9 -0
- package/dist/assets/.agents/skills/aidlc-build/SKILL.md +19 -0
- package/dist/assets/.agents/skills/aidlc-clarify/SKILL.md +17 -0
- package/dist/assets/.agents/skills/aidlc-index/SKILL.md +17 -0
- package/dist/assets/.agents/skills/aidlc-plan/SKILL.md +17 -0
- package/dist/assets/.agents/skills/aidlc-wrap/SKILL.md +17 -0
- package/dist/services/aidlc-coordination/Dockerfile +10 -0
- package/dist/services/aidlc-coordination/compose.yaml +25 -0
- package/dist/services/aidlc-coordination/package-lock.json +1154 -0
- package/dist/services/aidlc-coordination/package.json +20 -0
- package/dist/services/aidlc-coordination/src/coordination.mjs +68 -0
- package/dist/services/aidlc-coordination/src/lifecycle-core.mjs +341 -0
- package/dist/services/aidlc-coordination/src/providers.mjs +23 -0
- package/dist/services/aidlc-coordination/src/repository.mjs +203 -0
- package/dist/services/aidlc-coordination/src/server.mjs +49 -0
- package/dist/services/aidlc-coordination/test/repository.test.mjs +211 -0
- package/dist/src/adapters.d.ts +7 -0
- package/dist/src/adapters.js +86 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +192 -0
- package/dist/src/context.d.ts +14 -0
- package/dist/src/context.js +90 -0
- package/dist/src/gate.d.ts +40 -0
- package/dist/src/gate.js +176 -0
- package/dist/src/installer.d.ts +11 -0
- package/dist/src/installer.js +173 -0
- package/dist/src/ledger.d.ts +22 -0
- package/dist/src/ledger.js +119 -0
- package/dist/src/legacy.d.ts +2 -0
- package/dist/src/legacy.js +37 -0
- package/dist/src/managed-content.d.ts +3 -0
- package/dist/src/managed-content.js +16 -0
- package/dist/src/mcp-setup.d.ts +20 -0
- package/dist/src/mcp-setup.js +31 -0
- package/dist/src/model.d.ts +249 -0
- package/dist/src/model.js +1 -0
- package/dist/src/profiles.d.ts +28 -0
- package/dist/src/profiles.js +216 -0
- package/dist/src/project-migration.d.ts +2 -0
- package/dist/src/project-migration.js +144 -0
- package/dist/src/project-path.d.ts +2 -0
- package/dist/src/project-path.js +20 -0
- package/dist/src/state.d.ts +110 -0
- package/dist/src/state.js +764 -0
- package/dist/src/tracker.d.ts +29 -0
- package/dist/src/tracker.js +41 -0
- package/dist/src/upgrade.d.ts +11 -0
- package/dist/src/upgrade.js +270 -0
- package/dist/src/workflow.d.ts +7 -0
- package/dist/src/workflow.js +46 -0
- package/docs/README.md +31 -0
- package/docs/architecture.md +72 -0
- package/docs/command-reference.md +110 -0
- package/docs/configuration.md +72 -0
- package/docs/coordination-service.md +42 -0
- package/docs/development.md +106 -0
- package/docs/operating-workflow.md +87 -0
- package/docs/testing-and-release.md +113 -0
- package/package.json +53 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
Each installed project owns its workflow configuration at `.agents/config.json`. It selects topology profiles, specification roots, safe verification commands, and local rules without changing the package-managed kernel. The package supports only Codex and Claude Code.
|
|
4
|
+
|
|
5
|
+
## Minimal configuration
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"schemaVersion": 2,
|
|
10
|
+
"extends": ["topology/single"],
|
|
11
|
+
"specs": { "roots": ["docs/specs"] },
|
|
12
|
+
"commands": {
|
|
13
|
+
"test": { "command": "npm", "args": ["test"] },
|
|
14
|
+
"lint": { "command": "npm", "args": ["run", "lint"] }
|
|
15
|
+
},
|
|
16
|
+
"rules": { "include": [".agents/project/rules/*.md"] },
|
|
17
|
+
"risk": { "default": "normal" },
|
|
18
|
+
"context": { "maxChars": 16000 },
|
|
19
|
+
"agentState": {}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Commands are stored as executable and argument arrays. Do not replace them with shell strings: this keeps execution inspectable and avoids accidental shell interpretation.
|
|
24
|
+
|
|
25
|
+
G0, G1, and G2 always require explicit human approval. Configuration cannot auto-pass a gate.
|
|
26
|
+
|
|
27
|
+
## Configuration layers
|
|
28
|
+
|
|
29
|
+
Values resolve in this order, with the later applicable layer taking precedence:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
kernel → built-in topology → local profile parents/child → project config/rules → approved task decisions
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Built-in topology profiles are:
|
|
36
|
+
|
|
37
|
+
- `topology/generic`
|
|
38
|
+
- `topology/single`
|
|
39
|
+
- `topology/workspace`
|
|
40
|
+
- `topology/git-submodules`
|
|
41
|
+
|
|
42
|
+
Arrays are stable-deduplicated. Command keys are last-wins, so a project can replace a profile command intentionally. Validate the resolved profile chain with:
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow profile validate .
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This command uses the npm package at version `0.0.1`. To run from a source checkout instead, see the [development guide](./development.md).
|
|
49
|
+
|
|
50
|
+
## Rules, project data, and managed assets
|
|
51
|
+
|
|
52
|
+
| Location | Ownership | Use it for |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| `.agents/aidlc/` | Package managed | Kernel contracts, phases, schemas, and dependency-free runtime scripts. |
|
|
55
|
+
| `.agents/data/` | Project owned | Lifecycle state, task artifacts, indexes, memory, and evidence. |
|
|
56
|
+
| `.agents/project/` | Project owned | Profiles, rules, and project-specific evaluation material. |
|
|
57
|
+
|
|
58
|
+
Keep business/domain rules in `.agents/project/rules/`. Do not edit managed kernel files to customise a project; a later installation or human-run upgrade may report conflicts for modified managed content.
|
|
59
|
+
|
|
60
|
+
## Agent permissions
|
|
61
|
+
|
|
62
|
+
The Codex adapter installs `.codex/config.toml` with `approval_policy = "on-request"` and `sandbox_mode = "workspace-write"`, plus `.codex/rules/aidlc.rules`. The execpolicy allowlists only the six lifecycle entry points under `node .agents/aidlc/scripts/`, allowing AI-DLC state transitions without granting general command approval. Each allowed lifecycle command must be run as its own exec invocation: joining commands with `&`, `&&`, `;`, or `|` creates shell command segments that are not covered by a single prefix rule. Codex loads this project config only after the user trusts the project; network access stays disabled unless the project separately enables it. Claude Code installs `.claude/settings.local.json` and phase skills that allow only `node .agents/aidlc/scripts/*`, so lifecycle state updates do not require repeated confirmation while general Bash commands remain unapproved.
|
|
63
|
+
|
|
64
|
+
## Context and risk
|
|
65
|
+
|
|
66
|
+
`context.maxChars` bounds a phase packet. The runtime preserves lifecycle instructions, approved decisions, and mandatory invariants; it fails clearly rather than silently truncating required contract content.
|
|
67
|
+
|
|
68
|
+
Set the default risk level deliberately. Planning, migrations, cross-service contracts, and security-sensitive changes deserve a stronger reviewer or an explicit human decision even when the configuration default is normal.
|
|
69
|
+
|
|
70
|
+
## Optional AI-DLC Coordination
|
|
71
|
+
|
|
72
|
+
`mcp` is absent (or `{ "enabled": false }`) by default. An enabled configuration requires an HTTP(S) `endpoint` and non-empty `workspace`; it may also name a token environment variable, polling interval from 1,000 to 3,600,000 ms, and the enabled Jira/Trello/GitHub Issues preflight providers. See [AI-DLC Coordination service](./coordination-service.md) for the remote-authority and deployment contract.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# AI-DLC Coordination service
|
|
2
|
+
|
|
3
|
+
The optional AI-DLC Coordination service is a separate Docker-deployable authority for a workflow workspace. It is disabled by default: without an enabled `mcp` block, installed lifecycle scripts remain local and make no network calls.
|
|
4
|
+
|
|
5
|
+
## Safe setup
|
|
6
|
+
|
|
7
|
+
Preview a configuration first. Outside an interactive terminal, provide all four selection flags.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx --package @felixdotgo/aidlc-kit@0.0.1 aidlc-workflow mcp setup . --dry-run \
|
|
11
|
+
--deployment docker --storage sqlite --bind localhost --workspace engineering
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This command uses the npm package at version `0.0.1`. To run from a source checkout instead, see the [development guide](./development.md).
|
|
15
|
+
|
|
16
|
+
Remove `--dry-run` and confirm to create `.agents/aidlc-coordination/` and update `.agents/config.json`. Setup does not start Docker. Copy `.env.example` to a secret-managed `.env`, review it, then start explicitly:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
docker compose --env-file .agents/aidlc-coordination/.env -f .agents/aidlc-coordination/compose.yaml up -d
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Use SQLite only on the local Docker volume. Use PostgreSQL for multiple hosts. A network bind requires `MCP_STATE_AUTH_TOKEN` and TLS/reverse-proxy termination; never commit either the `.env` file or provider credentials.
|
|
23
|
+
|
|
24
|
+
## State and synchronization contract
|
|
25
|
+
|
|
26
|
+
When enabled, the remote workspace is canonical. Import/export is an explicit recovery or migration action; there is no background dual-write or local fallback during an outage. Clients pull a revision or poll `state_events_since`; the service provides neither realtime subscriptions nor push notifications.
|
|
27
|
+
|
|
28
|
+
## Shared coordination board
|
|
29
|
+
|
|
30
|
+
The opt-in service also provides a small workspace-scoped Kanban board that is separate from lifecycle state. Board tasks may link to an AI-DLC task ID or artifact, but board writes, comments, and claims cannot mutate lifecycle state, approve a gate, or rewrite project files.
|
|
31
|
+
|
|
32
|
+
`board_get`, `board_apply`, `task_thread_get`, `task_comment_add`, `task_claim`, and `coordination_events_since` are bounded MCP tools. Tasks use `backlog`, `ready`, `in_progress`, `blocked`, `done`, or `cancelled`, plus priority, labels, assignees, and renewable one-minute-to-one-hour claims. Mutations require an expected board revision, idempotency key, actor ID, and role. A conflicting live claim is rejected.
|
|
33
|
+
|
|
34
|
+
Threads are short append-only comments with author type, optional mentions, and `question`, `status`, `handoff`, or `decision` intent. They never carry credentials, hidden reasoning, general chat, or gate approvals. Clients poll compact cursor events, coalesce and debounce them, then read details only for assignment, mention, watched-task, explicit-user, or claim-expiry activity. A notice always requires a fresh revision check before action.
|
|
35
|
+
|
|
36
|
+
Every `state_apply` write needs an `expectedRevision`, an `idempotencyKey`, and an absolute `clientProjectRoot`. The root is used only to format portable `nextActions` with absolute script paths and an explicit `--root`; it does not grant the server filesystem access or authority over that path. A stale revision returns the current projection for pull/rebase, and a retry with the same idempotency key returns the original committed result. Successful responses include `nextActions` for touched tasks so remote callers follow the same item loop and stop classifications as the local CLI.
|
|
37
|
+
|
|
38
|
+
The service checks lifecycle invariants across the whole before/after snapshot, not only touched task IDs. Existing evidence is append-only: the prior evidence array must remain an exact structural prefix (compared field-wise, so re-serialization key order does not matter, while record order still does). A validated `blocked_on_user` wait cannot be deleted, and while a task waits its readiness-bearing state (items, decisions, artifacts, and every other non-evidence field) is frozen; only evidence may be appended. Leaving a wait requires, in the same mutation, one of: a passing approval for that exact gate, gate-bound cancellation diagnostic evidence with a non-empty source, or a sourced closure/handoff record (`closed`/`superseded` with closure metadata, or `paused` with handoff metadata). The one compatibility recovery mirrors the local CLI: an invalid wait at the gateless wrap phase may return to `active` with no appended evidence; it is not a human approval. A snapshot that requests or holds `blocked_on_user` while shared lifecycle predicates still require planning, items, verification, review, or an unexhausted repair bound is rejected. The `legacyG2Wait` repair-bound exemption marker is migration-owned: the service stamps it only when upgrading a stored pre-v4 row, and rejects any client mutation that creates or changes it. SQLite uses an immediate transaction and busy timeout; PostgreSQL locks the workspace row in a transaction.
|
|
39
|
+
|
|
40
|
+
These guards keep remote history tamper-evident, but they do not authenticate approvals. The `source` on an approval record is provenance supplied by the client, not an authenticator: any client holding the shared token can append a well-formed approval and leave a wait. The service never runs the local `checkGate` against client artifacts (it has no access to `clientProjectRoot`), so gate predicates are enforced structurally at wait entry and through the parked-state freeze, not re-verified from artifacts at exit. Treat MCP approval records exactly like the local `gate approve --source` honor system, behind a token you protect.
|
|
41
|
+
|
|
42
|
+
`work_item_request` is intentionally only a credential-free preflight for Jira, Trello, or GitHub Issues. It reports the required environment variable names and never returns a reusable token, Authorization header, or token-bearing URL. External updates remain opt-in and must be made outside the lifecycle transaction.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Development guide
|
|
2
|
+
|
|
3
|
+
This guide is for contributors to `@felixdotgo/aidlc-kit`. It covers local setup, source ownership, and the rules that keep the package runtime and installed workflow behaviour aligned.
|
|
4
|
+
|
|
5
|
+
## Requirements and dependencies
|
|
6
|
+
|
|
7
|
+
- Node.js 20.17 or newer is required by the package runtime.
|
|
8
|
+
- npm installs the repository development dependencies.
|
|
9
|
+
- `@inquirer/prompts` is the runtime dependency for interactive CLI prompts; installed lifecycle scripts remain dependency-free.
|
|
10
|
+
- Development uses TypeScript and `@types/node` as declared in `package.json`.
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Codex or Claude Code are optional for manually exercising real evaluator drivers. Ordinary build, lint, and unit-test work does not need external model credentials.
|
|
17
|
+
|
|
18
|
+
## Repository layout
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
assets/aidlc/ Source workflow contracts, schemas, and installed scripts
|
|
22
|
+
skills/ Source thin phase adapters
|
|
23
|
+
src/ TypeScript package CLI, installer, lifecycle, profiles, and migrations
|
|
24
|
+
dev/evaluator/ Development-only evaluator harness and runners
|
|
25
|
+
scripts/build-assets.mjs Bundles workflow assets for package distribution
|
|
26
|
+
test/unit/ Unit and installed-runtime parity tests
|
|
27
|
+
docs/ User, operator, and contributor documentation
|
|
28
|
+
dist/ Generated TypeScript and bundled assets; do not hand-edit
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The asset build copies `assets/aidlc/` and `skills/` into `dist/assets/.agents/`. At install time, the package writes the workflow to a consumer project's `.agents/aidlc/` and `.agents/skills/` locations. Always state which of these three layouts—source, bundle, or installed project—you mean in code or documentation.
|
|
32
|
+
|
|
33
|
+
## Local commands
|
|
34
|
+
|
|
35
|
+
| Command | Purpose |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| `npm run build` | Rebuild bundled workflow assets and compile TypeScript into `dist/`. |
|
|
38
|
+
| `npm run lint` | Type-check without emitting files. |
|
|
39
|
+
| `npm test` | Build, then run every compiled unit test with Node's test runner. |
|
|
40
|
+
| `node --test dist/test/unit/<file>.test.js` | Run a focused compiled test after building. |
|
|
41
|
+
| `npm run release:check` | Run the repository release-evidence policy check. |
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
## Local build and registry-free installation
|
|
46
|
+
|
|
47
|
+
Use this fast smoke test to install workflow assets from the current checkout into a disposable consumer project. It invokes the freshly compiled CLI directly, so the consumer installation does not use `npm install`, `npx`, a published package, or an npm registry. Repository bootstrap and build still use npm and the dependencies already installed in this checkout.
|
|
48
|
+
|
|
49
|
+
Run the following POSIX shell commands from the repository root:
|
|
50
|
+
|
|
51
|
+
```sh
|
|
52
|
+
AIDLC_REPO="$(pwd)"
|
|
53
|
+
AIDLC_LOCAL_PROJECT="$(mktemp -d "${TMPDIR:-/tmp}/aidlc-local-project.XXXXXX")"
|
|
54
|
+
|
|
55
|
+
npm run build
|
|
56
|
+
node "$AIDLC_REPO/dist/src/cli.js" init "$AIDLC_LOCAL_PROJECT" --agent codex --dry-run
|
|
57
|
+
node "$AIDLC_REPO/dist/src/cli.js" init "$AIDLC_LOCAL_PROJECT" --agent codex --yes
|
|
58
|
+
node "$AIDLC_REPO/dist/src/cli.js" status "$AIDLC_LOCAL_PROJECT"
|
|
59
|
+
node "$AIDLC_REPO/dist/src/cli.js" doctor "$AIDLC_LOCAL_PROJECT" --strict
|
|
60
|
+
node "$AIDLC_LOCAL_PROJECT/.agents/aidlc/scripts/state.mjs" task list --root "$AIDLC_LOCAL_PROJECT"
|
|
61
|
+
|
|
62
|
+
printf 'Local test project: %s\n' "$AIDLC_LOCAL_PROJECT"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The dry run previews the managed writes before `--yes` applies them. `status` describes the installed version and adapters, `doctor --strict` is the integrity check, and the final command confirms that the copied dependency-free lifecycle runtime can read its canonical state without the package CLI.
|
|
66
|
+
|
|
67
|
+
Always use a new empty directory and inspect the printed path before removing it manually. Do not point this recipe at a real project unless its managed files and workflow state are intentional test targets. Reusing a fixture across package versions triggers the human-only upgrade protection by design. On Windows, use WSL or Git Bash for the snippet, or create a temporary directory in PowerShell and pass its absolute path to the same Node commands.
|
|
68
|
+
|
|
69
|
+
This direct-`dist` smoke verifies the compiled checkout, but it does not verify the published file allowlist, package bin metadata, or tarball exclusions. Before release, also run the separate [package smoke test](./testing-and-release.md#package-smoke-test), which packs and extracts a local tarball without installing or fetching the package from a registry.
|
|
70
|
+
|
|
71
|
+
## Run `npx` from a local package archive
|
|
72
|
+
|
|
73
|
+
To test the package before release, create its `.tgz` archive and run the local archive with `npx`:
|
|
74
|
+
|
|
75
|
+
```sh
|
|
76
|
+
npm pack
|
|
77
|
+
npx --package felixdotgo-aidlc-kit-0.0.1.tgz -- aidlc-workflow init .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
`npx` runs the archive without publishing it. Run the command from the directory containing the archive. Use a disposable project instead of `.` if you do not want the command to write workflow files into the current directory.
|
|
81
|
+
|
|
82
|
+
## Ownership boundaries
|
|
83
|
+
|
|
84
|
+
The package has three ownership layers:
|
|
85
|
+
|
|
86
|
+
1. Package-managed kernel assets installed under `.agents/aidlc/`.
|
|
87
|
+
2. Project-owned configuration, profiles, rules, and evaluation material under `.agents/project/`.
|
|
88
|
+
3. Project-owned task state and derived data under `.agents/data/`.
|
|
89
|
+
|
|
90
|
+
Do not introduce a second lifecycle board or hand-edit canonical state. The installed lifecycle scripts are dependency-free so consumer projects do not need this package to operate after installation.
|
|
91
|
+
|
|
92
|
+
## Mirrored runtime behaviour
|
|
93
|
+
|
|
94
|
+
The TypeScript implementation powers the package CLI. Installed projects use a dependency-free mirror under `assets/aidlc/scripts/`. Changes to shared lifecycle, state, gate, profile, or context behaviour must preserve parity between these paths and add coverage for both package and installed-runtime execution.
|
|
95
|
+
|
|
96
|
+
Likewise, a public configuration or schema change must update its validator, JSON schema, installed assets, package inventory, documentation, and tests together.
|
|
97
|
+
|
|
98
|
+
## Safe implementation rules
|
|
99
|
+
|
|
100
|
+
- Resolve all project-relative paths through the shared path helpers; reject traversal and symlink escape.
|
|
101
|
+
- Keep installation, migration, and upgrade plans deterministic and conflict-first.
|
|
102
|
+
- Preserve project-owned configuration and state when changing managed assets.
|
|
103
|
+
- Do not add remote profile discovery, runtime asset downloads, executable plugin hooks, registry checks, or shell-string command execution.
|
|
104
|
+
- Treat human-gated lifecycle transitions as atomic, auditable state operations.
|
|
105
|
+
|
|
106
|
+
Read [Architecture](./architecture.md) before changing a module boundary, migration, installed script, or bundle layout.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Operating the workflow
|
|
2
|
+
|
|
3
|
+
`aidlc-kit` gives an agent a repeatable delivery lifecycle. It separates intent, design, implementation, and final review so a human explicitly approves the points where scope or risk changes.
|
|
4
|
+
|
|
5
|
+
## Lifecycle at a glance
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
request → clarify → G0 → plan → G1 → build and verify → G2 → wrap → done
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Stage | Result | Human action |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| Clarify | Intent, scope, assumptions, and open questions | Approve G0. |
|
|
14
|
+
| Plan | Design, decisions, work items, and verification plan | Resolve decisions and approve G1. |
|
|
15
|
+
| Build | Approved change, verification, and adversarial review | Review the completed change at G2. |
|
|
16
|
+
| Wrap | Delivery notes, lessons, and residual risk | Runs only after G2 approval. |
|
|
17
|
+
|
|
18
|
+
An agent continues after each non-terminal transition and after every item or evidence mutation. Completing one work item is a progress update, not a turn boundary: the agent consumes the returned `nextAction` and continues through the remaining items, verification, and review. It stops only for a gate that is ready for human action, a durable blocker, a terminal non-success outcome, or successful completion.
|
|
19
|
+
|
|
20
|
+
## Parallel workstreams
|
|
21
|
+
|
|
22
|
+
At any phase, the lead agent may use the orchestration contract to delegate independent, bounded workstreams when the host has spare worker capacity. The lead keeps one slot, assigns explicit ownership and completion criteria, and integrates returned work before relying on it. It remains the only writer for task state, evidence, review artifacts, and gates. In build, a batch may contain only items with non-overlapping file/area ownership; shared surfaces, integration, task-wide verification, and adversarial review remain lead-owned. Parallel work never changes the approval or lifecycle requirements described below.
|
|
23
|
+
|
|
24
|
+
## Starting work
|
|
25
|
+
|
|
26
|
+
After installation, make a normal change request to the selected coding agent. For example:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
Add rate limiting to the login endpoint using the AI-DLC workflow.
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The adapter creates a task, writes an intent brief, and presents G0. Do not treat a partial implementation as approved work before G1, and do not treat a passing test as approval at G2.
|
|
33
|
+
|
|
34
|
+
## State and review artifacts
|
|
35
|
+
|
|
36
|
+
Each installed project owns its data under `.agents/data/`. Package-managed workflow instructions live under `.agents/aidlc/`; project configuration, local rules, and evidence are project-owned. The package supports Codex and Claude Code only. Do not hand-edit lifecycle state: use the installed scripts instead.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
node .agents/aidlc/scripts/state.mjs task list --limit 20
|
|
40
|
+
node .agents/aidlc/scripts/state.mjs task find --query "rate limiting" --include-archive
|
|
41
|
+
node .agents/aidlc/scripts/state.mjs task show <task-id>
|
|
42
|
+
node .agents/aidlc/scripts/state.mjs task next <task-id>
|
|
43
|
+
node .agents/aidlc/scripts/gate-view.mjs <task-id>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
`task next` is the authoritative instruction for what happens next. `gate-view` renders the review packet consistently for G0, G1, and G2.
|
|
47
|
+
|
|
48
|
+
Lifecycle options support both `--name value` and `--name=value` in any order. Invalid options and command shapes fail before lock or state access. From a project subdirectory, an omitted `--root` selects the nearest ancestor containing `.agents/aidlc/`; outside an installed project the command fails without creating `.agents`. Use explicit `--root` to select a different installed project.
|
|
49
|
+
|
|
50
|
+
Every `state.mjs` and `task-next.mjs` command returns one JSON envelope `{ok, result, nextAction?}`. Rendering, gate-check, and context commands may produce Markdown or plain text. All failures use one-line `{ok: false, error}` records on stderr with typed exit codes (`1` expected, `2` continuation guard, `3` crash). During build, the action identifies the next `in_progress` or `todo` item; after all items are terminal it still returns `run_phase` until verification, adversarial review, and G2 preparation finish. Before any final response, the agent runs `task-next.mjs <task-id> --require-stop` and parses its machine-readable `continuation` object; exit code `2` (`continuation.code = CONTINUATION_REQUIRED`) means it must execute `continuation.command` instead of replying. This guard is detection, not hard prevention: no package-owned hook can intercept a message the model host has already emitted, so the residual risk is a premature final response that the host must recover from by running `task next <task-id>` in its very next turn and executing the returned command — never by re-approving a gate. Creating a new task while another is actionable is likewise fail-closed at the local CLI: `task create` rejects it until the agent passes the returned `--switch-from` acknowledgement with explicit user direction, which stamps a resume-marker diagnostic on the acknowledged task instead of mutating it. The optional AI-DLC Coordination service does not enforce this switch guard; remote `upsertTask`/`replaceState` can still add tasks alongside actionable work, so MCP-backed hosts rely on the adapter protocol for switch discipline.
|
|
51
|
+
|
|
52
|
+
## Gates and approvals
|
|
53
|
+
|
|
54
|
+
Approval is an explicit human action. When the agent receives an approval, it records the approval and advances the lifecycle atomically:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
node .agents/aidlc/scripts/state.mjs gate approve <task-id> --gate <gate-name> --source "<explicit approval>"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Do not invent approvals or approve unresolved design decisions. Approval evidence can be created only by `gate approve`; generic evidence recording cannot manufacture it. A passing G1 approval starts a build boundary. Verification, adversarial review, and G2 approval used to enter wrap must all belong to the current boundary.
|
|
61
|
+
|
|
62
|
+
`--source` records provenance; it is not authentication or proof of consent. The local CLI enforces lifecycle structure, while the host agent must call `gate approve` only in a later user turn that explicitly assents to the gate currently shown.
|
|
63
|
+
|
|
64
|
+
A reopened plan invalidates the prior G1 and G2 approvals, resets every non-deferred build item to `todo`, and requires current-build verification and review. Evidence is append-only, so the runtime identifies the current boundary by evidence order instead of trusting timestamps. For each affected area, at least one `test` or `lint` result is required and the latest result of every verification kind present must pass; one kind cannot hide a failure in the other.
|
|
65
|
+
|
|
66
|
+
Terminal archiving commits the immutable record before the compact catalog. A retry may recover the narrow interrupted-write window only when the catalog still proves the same task is active and the unreferenced record has the same stable identity. Other archive conflicts require investigation rather than overwrite. Rendered workplans are derived views and are replaced atomically under the same state lock when rendered by the standalone command.
|
|
67
|
+
|
|
68
|
+
## Blocked work and successors
|
|
69
|
+
|
|
70
|
+
`blocked_on_user` means a valid human gate is ready; wrap has no human gate and rejects it. The status command validates gate prerequisites before persisting it, and `gate-view` refuses to present an active or unready task. Ordinary exits from a validated human-gate wait require audited reason and source metadata plus diagnostic evidence; sourced closure and handoff records provide the corresponding terminal trail. The two compatibility paths are migration-stamped legacy G2 waits and recovery of an invalid `wrap`/`none` wait; neither is a human approval. The `legacyG2Wait` marker is written only by state-schema migration (`state.mjs state migrate` or a human-run installer upgrade), only exempts a still-ready pre-existing wait from the repair bound, and is cleared by every route out of the wait. Repair bounds are machine-enforced: three failed verify records per area or two failed review records in the current build flip `nextAction` to `blocked` and close G2 with `REPAIR_BOUND` until a durable handoff is recorded. It does not mean a failed change is waiting for a rubber stamp. When verification or review cannot pass, the workflow records a durable handoff and offers structured options.
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
node .agents/aidlc/scripts/state.mjs task handoff <task-id> --kind <kind> --reason "<reason>" --source "<evidence>"
|
|
74
|
+
node .agents/aidlc/scripts/state.mjs task reopen <task-id> --to plan --reason "<reason>" --source "<explicit request>"
|
|
75
|
+
node .agents/aidlc/scripts/state.mjs task close <task-id> --reason "<reason>" --source "<explicit request>"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
If work continues in a fresh task, create that task at G0 and link it as a successor. `closed` and `superseded` are terminal non-success outcomes; they do not transfer approvals or imply a completed delivery.
|
|
79
|
+
|
|
80
|
+
## Operational rules
|
|
81
|
+
|
|
82
|
+
- The installed workflow never downloads runtime assets or checks a registry.
|
|
83
|
+
- Only a human may initiate or apply workflow upgrades.
|
|
84
|
+
- Keep task artifacts and verification evidence honest; a status label never substitutes for test or review evidence.
|
|
85
|
+
- Put project-specific behaviour in project configuration or local rules, not in the package-managed workflow kernel.
|
|
86
|
+
|
|
87
|
+
See [Configuration](./configuration.md) for project customisation and [Command reference](./command-reference.md) for package commands.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Testing and release
|
|
2
|
+
|
|
3
|
+
Use the smallest relevant verification while developing, then complete the repository checks before a release review.
|
|
4
|
+
|
|
5
|
+
## Standard verification
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm run build
|
|
9
|
+
npm run lint
|
|
10
|
+
npm test
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`npm test` rebuilds the package before running compiled unit tests. The tests cover CLI and installer behaviour, state and gate transitions, migration safety, managed content, profiles/context, evaluator logic, and installed-runtime parity.
|
|
14
|
+
|
|
15
|
+
If a test depends on child processes and a sandbox returns `EPERM`, rerun it in an appropriate local environment before deciding that the product failed.
|
|
16
|
+
|
|
17
|
+
## Focused tests
|
|
18
|
+
|
|
19
|
+
Build first, then invoke a compiled test file directly:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npm run build
|
|
23
|
+
node --test dist/test/unit/installer.test.js
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Choose the test closest to the changed boundary. For example, use installer tests for package inventory or documentation assertions, upgrade tests for migration semantics, and lifecycle-runtime tests when touching installed scripts. Continuation changes must also run `continuation-guard`, multi-item lifecycle runtime, context, and local/MCP lifecycle conformance coverage.
|
|
27
|
+
|
|
28
|
+
## Package smoke test
|
|
29
|
+
|
|
30
|
+
Release verification must exercise the tarball rather than the source tree. From the repository root, build and pack locally, extract the archive, then run the extracted CLI against a clean temporary consumer project.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
AIDLC_PACK_DIR="$(mktemp -d /tmp/aidlc-pack.XXXXXX)"
|
|
34
|
+
AIDLC_EXTRACT_DIR="$(mktemp -d /tmp/aidlc-extract.XXXXXX)"
|
|
35
|
+
AIDLC_TEST_PROJECT="$(mktemp -d /tmp/aidlc-project.XXXXXX)"
|
|
36
|
+
|
|
37
|
+
npm run build
|
|
38
|
+
npm pack --pack-destination "$AIDLC_PACK_DIR"
|
|
39
|
+
tar -xzf "$AIDLC_PACK_DIR/felixdotgo-aidlc-kit-0.0.1.tgz" -C "$AIDLC_EXTRACT_DIR"
|
|
40
|
+
node "$AIDLC_EXTRACT_DIR/package/dist/src/cli.js" init "$AIDLC_TEST_PROJECT" --agent codex --dry-run
|
|
41
|
+
node "$AIDLC_EXTRACT_DIR/package/dist/src/cli.js" init "$AIDLC_TEST_PROJECT" --agent codex --yes
|
|
42
|
+
node "$AIDLC_EXTRACT_DIR/package/dist/src/cli.js" status "$AIDLC_TEST_PROJECT"
|
|
43
|
+
node "$AIDLC_EXTRACT_DIR/package/dist/src/cli.js" doctor "$AIDLC_TEST_PROJECT" --strict
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Keep the printed temporary paths until inspection is complete. Remove them manually afterwards. Do not reuse a smoke-test project for a different package version; the installer intentionally refuses implicit upgrades.
|
|
47
|
+
|
|
48
|
+
Check that the tarball contains the public CLI, bundled assets, and documentation, but not `dist/dev/`, evaluator runners, evaluator schemas, or evaluator configuration.
|
|
49
|
+
|
|
50
|
+
## Development-only evaluator
|
|
51
|
+
|
|
52
|
+
The evaluator under `dev/evaluator/` is repository and CI infrastructure. It is compiled for tests but excluded from the published package.
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
npm run build
|
|
56
|
+
node dist/dev/evaluator/cli.js list
|
|
57
|
+
node dist/dev/evaluator/cli.js run --runner local-simulated
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Runners exchange JSON, and reports capture transport, transcript, normalised events, usage, and diagnostics. Real Codex or Claude runs can consume credentials and model budget; they are not required for ordinary development verification.
|
|
61
|
+
|
|
62
|
+
The release-eligible suite includes `build-multi-item-continuation`, which starts with three canonical build items and requires one agent run to complete all of them, record verification/review evidence, and stop only at a ready G2. This complements unit guards by exercising the model-facing continuation contract.
|
|
63
|
+
|
|
64
|
+
The release checker validates required evidence according to the configured adapter policy. This repository's script uses the Codex-only policy:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
npm run release:check
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
It reads local evaluation evidence from `.agents/project/release-eval.json` and fails closed if required evidence or integrity thresholds are missing.
|
|
71
|
+
|
|
72
|
+
## Release readiness
|
|
73
|
+
|
|
74
|
+
Before an authorised release, complete:
|
|
75
|
+
|
|
76
|
+
1. `npm test`
|
|
77
|
+
2. `npm run lint`
|
|
78
|
+
3. The local tarball smoke test
|
|
79
|
+
4. `npm run release:check`
|
|
80
|
+
5. A review of the generated package contents and documentation links
|
|
81
|
+
|
|
82
|
+
Publishing, tagging, committing, and pushing are separate human-authorised actions. A passing verification run is not delivery authority.
|
|
83
|
+
|
|
84
|
+
## First npm publication
|
|
85
|
+
|
|
86
|
+
The first release is `@felixdotgo/aidlc-kit@0.0.1`, with public access and the `latest` dist-tag. Complete the release checks and the project's human review gates before publishing.
|
|
87
|
+
|
|
88
|
+
From the repository root, sign in to an npm account with permission to publish to the `@felixdotgo` scope and confirm the active account:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
npm login --registry https://registry.npmjs.org
|
|
92
|
+
npm whoami --registry https://registry.npmjs.org
|
|
93
|
+
npm view @felixdotgo/aidlc-kit@0.0.1 version --registry https://registry.npmjs.org
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
An unpublished package normally returns `404` from `npm view`; that response does not establish scope ownership or publish permission. If `0.0.1` already exists, stop: npm versions cannot be overwritten. If `npm whoami` returns `401`, sign in again before publishing.
|
|
97
|
+
|
|
98
|
+
After inspecting the local tarball and documentation, publish from the repository root:
|
|
99
|
+
|
|
100
|
+
```sh
|
|
101
|
+
npm publish --access public --tag latest --registry https://registry.npmjs.org
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
`prepublishOnly` runs the unit tests, lint, and evaluator release check before this command publishes. Complete any authentication or two-factor prompt from npm. The initial publication of a scoped package needs `--access public`; see the [npm scope documentation](https://docs.npmjs.com/cli/v11/using-npm/scope).
|
|
105
|
+
|
|
106
|
+
Confirm the published version, dist-tag and artifact metadata:
|
|
107
|
+
|
|
108
|
+
```sh
|
|
109
|
+
npm view @felixdotgo/aidlc-kit@0.0.1 version dist.tarball dist.integrity --json --registry https://registry.npmjs.org
|
|
110
|
+
npm view @felixdotgo/aidlc-kit dist-tags --json --registry https://registry.npmjs.org
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Expect version `0.0.1`, a tarball URL and integrity value, and `latest` pointing to `0.0.1`. Git tags, GitHub releases, commits, and pushes require their own delivery authorisation.
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@felixdotgo/aidlc-kit",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Install a local, agent-adapted AI-DLC workflow into a project.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai-dlc",
|
|
7
|
+
"ai-agent",
|
|
8
|
+
"workflow",
|
|
9
|
+
"claude-code",
|
|
10
|
+
"codex",
|
|
11
|
+
"developer-tools"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/felixdotgo/aidlc-kit#readme",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/felixdotgo/aidlc-kit.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/felixdotgo/aidlc-kit/issues"
|
|
20
|
+
},
|
|
21
|
+
"author": "felixdotgo <nguyenthanhdat.js@gmail.com>",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"type": "module",
|
|
24
|
+
"bin": {
|
|
25
|
+
"aidlc-workflow": "dist/src/cli.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist/src",
|
|
29
|
+
"dist/assets",
|
|
30
|
+
"dist/services",
|
|
31
|
+
"README.md",
|
|
32
|
+
"DEVELOPMENT.md",
|
|
33
|
+
"docs",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "node scripts/build-assets.mjs && tsc -p tsconfig.json",
|
|
38
|
+
"test": "npm run build && node --test dist/test/unit/*.test.js",
|
|
39
|
+
"lint": "tsc --noEmit -p tsconfig.json",
|
|
40
|
+
"release:check": "node dist/dev/evaluator/release-check.js .agents/project/release-eval.json --adapters codex",
|
|
41
|
+
"prepublishOnly": "npm test && npm run lint && npm run release:check"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=20.17"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@inquirer/prompts": "^8.5.2"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^24.0.0",
|
|
51
|
+
"typescript": "^5.8.0"
|
|
52
|
+
}
|
|
53
|
+
}
|