nitm-ai-dev-toolkit 5.0.0 → 5.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/CHANGELOG.md +46 -0
- package/README.md +27 -7
- package/bin/cli.js +598 -88
- package/package.json +1 -1
- package/src/monorepo/.agents/skills/factory/SKILL.md +77 -27
- package/src/monorepo/.claude/commands/assign-tasks.md +1 -0
- package/src/monorepo/.claude/commands/factory.md +1 -1
- package/src/monorepo/.claude/commands/ponytail-review.md +1 -1
- package/src/monorepo/.claude/prompt-snippets/assign-tasks.md +13 -3
- package/src/monorepo/.claude/prompt-snippets/bootstrap-patch.md +31 -24
- package/src/monorepo/.claude/prompt-snippets/bootstrap-upgrade.md +12 -13
- package/src/monorepo/.claude/prompt-snippets/bootstrap.md +11 -11
- package/src/monorepo/.claude/prompt-snippets/factory.md +4 -4
- package/src/monorepo/.claude/prompt-snippets/implement-feature.md +3 -1
- package/src/monorepo/.claude/rules-snippets/subagent-workflow.md +2 -2
- package/src/monorepo/.cursor/commands/factory.md +1 -1
- package/src/monorepo/.github/prompts/factory.prompt.md +1 -1
- package/src/monorepo/.opencode/agents/admin-portal.md +1 -1
- package/src/monorepo/.opencode/agents/api-specialist.md +1 -1
- package/src/monorepo/.opencode/agents/backend-architect.md +1 -1
- package/src/monorepo/.opencode/agents/documenter.md +1 -1
- package/src/monorepo/.opencode/agents/factory-approver.md +1 -1
- package/src/monorepo/.opencode/agents/factory-builder.md +1 -1
- package/src/monorepo/.opencode/agents/factory-reviewer-code.md +1 -1
- package/src/monorepo/.opencode/agents/factory-reviewer-security.md +1 -1
- package/src/monorepo/.opencode/agents/factory-reviewer-ui.md +1 -1
- package/src/monorepo/.opencode/agents/factory-reviewer-ux.md +1 -1
- package/src/monorepo/.opencode/agents/factory-spec-writer.md +1 -1
- package/src/monorepo/.opencode/agents/feature-builder.md +1 -1
- package/src/monorepo/.opencode/agents/frontend-developer.md +1 -1
- package/src/monorepo/.opencode/agents/green.md +1 -1
- package/src/monorepo/.opencode/agents/implementer.md +1 -1
- package/src/monorepo/.opencode/agents/planner.md +1 -1
- package/src/monorepo/.opencode/agents/red.md +1 -1
- package/src/monorepo/.opencode/agents/refactor.md +1 -1
- package/src/monorepo/.opencode/agents/researcher.md +1 -1
- package/src/monorepo/.opencode/agents/reviewer.md +1 -1
- package/src/monorepo/.opencode/agents/tdd.md +1 -1
- package/src/monorepo/.opencode/commands/assign-tasks.md +1 -1
- package/src/monorepo/.opencode/commands/bootstrap-patch.md +1 -1
- package/src/monorepo/.opencode/commands/bootstrap-upgrade.md +1 -1
- package/src/monorepo/.opencode/commands/bootstrap.md +1 -1
- package/src/monorepo/.opencode/commands/commit-push.md +1 -1
- package/src/monorepo/.opencode/commands/constitution.md +1 -1
- package/src/monorepo/.opencode/commands/create-skill.md +1 -1
- package/src/monorepo/.opencode/commands/factory.md +1 -1
- package/src/monorepo/.opencode/commands/implement-feature.md +1 -1
- package/src/monorepo/.opencode/commands/implement-fixes.md +1 -1
- package/src/monorepo/.opencode/commands/implement.md +1 -1
- package/src/monorepo/.opencode/commands/plan.md +1 -1
- package/src/monorepo/.opencode/commands/playwright-test.md +1 -1
- package/src/monorepo/.opencode/commands/ponytail-audit.md +1 -1
- package/src/monorepo/.opencode/commands/ponytail-debt.md +1 -1
- package/src/monorepo/.opencode/commands/ponytail-gain.md +1 -1
- package/src/monorepo/.opencode/commands/ponytail-help.md +1 -1
- package/src/monorepo/.opencode/commands/ponytail-review.md +1 -1
- package/src/monorepo/.opencode/commands/ponytail.md +1 -1
- package/src/monorepo/.opencode/commands/release-notes.md +1 -1
- package/src/monorepo/.opencode/commands/review-pr.md +1 -1
- package/src/monorepo/.opencode/commands/review.md +1 -1
- package/src/monorepo/.opencode/commands/specify.md +1 -1
- package/src/monorepo/.opencode/commands/tasks.md +1 -1
- package/src/monorepo/.opencode/opencode.jsonc +1 -2
- package/src/monorepo/.opencode/rules/agent-conduct.md +1 -1
- package/src/monorepo/.opencode/rules/api-server.md +1 -1
- package/src/monorepo/.opencode/rules/coding-standards.md +1 -1
- package/src/monorepo/.opencode/rules/component-structure.md +1 -1
- package/src/monorepo/.opencode/rules/core-libraries.md +1 -1
- package/src/monorepo/.opencode/rules/environment-tooling.md +1 -1
- package/src/monorepo/.opencode/rules/logging-comments.md +1 -1
- package/src/monorepo/.opencode/rules/logging.md +1 -1
- package/src/monorepo/.opencode/rules/prisma-migrations.md +1 -1
- package/src/monorepo/.opencode/rules/project-context.md +1 -1
- package/src/monorepo/.opencode/rules/server-client-separation.md +1 -1
- package/src/monorepo/.opencode/rules/subagent-workflow.md +1 -1
- package/src/monorepo/.opencode/rules/testing-quality.md +1 -1
- package/src/monorepo/.opencode/rules/ui-accessibility.md +1 -1
- package/src/monorepo/.opencode/rules/version-control.md +1 -1
- package/src/monorepo/.opencode/rules/what-to-avoid.md +1 -1
- package/src/monorepo/AGENTS.md +3 -3
- package/src/monorepo/README.md +4 -4
- package/src/monorepo/factory/README.md +40 -15
- package/src/monorepo/factory/worktree-bootstrap.md +32 -0
- package/src/repo/.agents/skills/factory/SKILL.md +76 -26
- package/src/repo/.claude/commands/assign-tasks.md +1 -0
- package/src/repo/.claude/commands/factory.md +1 -1
- package/src/repo/.claude/commands/ponytail-review.md +1 -1
- package/src/repo/.claude/prompt-snippets/assign-tasks.md +13 -3
- package/src/repo/.claude/prompt-snippets/bootstrap-patch.md +31 -24
- package/src/repo/.claude/prompt-snippets/bootstrap-upgrade.md +16 -16
- package/src/repo/.claude/prompt-snippets/bootstrap.md +11 -11
- package/src/repo/.claude/prompt-snippets/factory.md +4 -4
- package/src/repo/.claude/prompt-snippets/implement-feature.md +3 -1
- package/src/repo/.claude/rules-snippets/subagent-workflow.md +2 -2
- package/src/repo/.cursor/commands/factory.md +1 -1
- package/src/repo/.github/prompts/factory.prompt.md +1 -1
- package/src/repo/.opencode/agents/admin-portal.md +1 -1
- package/src/repo/.opencode/agents/api-specialist.md +1 -1
- package/src/repo/.opencode/agents/backend-architect.md +1 -1
- package/src/repo/.opencode/agents/documenter.md +1 -1
- package/src/repo/.opencode/agents/factory-approver.md +1 -1
- package/src/repo/.opencode/agents/factory-builder.md +1 -1
- package/src/repo/.opencode/agents/factory-reviewer-code.md +1 -1
- package/src/repo/.opencode/agents/factory-reviewer-security.md +1 -1
- package/src/repo/.opencode/agents/factory-reviewer-ui.md +1 -1
- package/src/repo/.opencode/agents/factory-reviewer-ux.md +1 -1
- package/src/repo/.opencode/agents/factory-spec-writer.md +1 -1
- package/src/repo/.opencode/agents/feature-builder.md +1 -1
- package/src/repo/.opencode/agents/frontend-developer.md +1 -1
- package/src/repo/.opencode/agents/green.md +1 -1
- package/src/repo/.opencode/agents/implementer.md +1 -1
- package/src/repo/.opencode/agents/planner.md +1 -1
- package/src/repo/.opencode/agents/red.md +1 -1
- package/src/repo/.opencode/agents/refactor.md +1 -1
- package/src/repo/.opencode/agents/researcher.md +1 -1
- package/src/repo/.opencode/agents/reviewer.md +1 -1
- package/src/repo/.opencode/agents/tdd.md +1 -1
- package/src/repo/.opencode/commands/assign-tasks.md +1 -1
- package/src/repo/.opencode/commands/bootstrap-patch.md +1 -1
- package/src/repo/.opencode/commands/bootstrap-upgrade.md +1 -1
- package/src/repo/.opencode/commands/bootstrap.md +1 -1
- package/src/repo/.opencode/commands/commit-push.md +1 -1
- package/src/repo/.opencode/commands/constitution.md +1 -1
- package/src/repo/.opencode/commands/create-skill.md +1 -1
- package/src/repo/.opencode/commands/factory.md +1 -1
- package/src/repo/.opencode/commands/implement-feature.md +1 -1
- package/src/repo/.opencode/commands/implement-fixes.md +1 -1
- package/src/repo/.opencode/commands/implement.md +1 -1
- package/src/repo/.opencode/commands/plan.md +1 -1
- package/src/repo/.opencode/commands/playwright-test.md +1 -1
- package/src/repo/.opencode/commands/ponytail-audit.md +1 -1
- package/src/repo/.opencode/commands/ponytail-debt.md +1 -1
- package/src/repo/.opencode/commands/ponytail-gain.md +1 -1
- package/src/repo/.opencode/commands/ponytail-help.md +1 -1
- package/src/repo/.opencode/commands/ponytail-review.md +1 -1
- package/src/repo/.opencode/commands/ponytail.md +1 -1
- package/src/repo/.opencode/commands/release-notes.md +1 -1
- package/src/repo/.opencode/commands/review-pr.md +1 -1
- package/src/repo/.opencode/commands/review.md +1 -1
- package/src/repo/.opencode/commands/specify.md +1 -1
- package/src/repo/.opencode/commands/tasks.md +1 -1
- package/src/repo/.opencode/opencode.jsonc +1 -2
- package/src/repo/.opencode/rules/agent-conduct.md +1 -1
- package/src/repo/.opencode/rules/api-server.md +1 -1
- package/src/repo/.opencode/rules/coding-standards.md +1 -1
- package/src/repo/.opencode/rules/component-structure.md +1 -1
- package/src/repo/.opencode/rules/core-libraries.md +1 -1
- package/src/repo/.opencode/rules/environment-tooling.md +1 -1
- package/src/repo/.opencode/rules/logging-comments.md +1 -1
- package/src/repo/.opencode/rules/logging.md +1 -1
- package/src/repo/.opencode/rules/prisma-migrations.md +1 -1
- package/src/repo/.opencode/rules/project-context.md +1 -1
- package/src/repo/.opencode/rules/server-client-separation.md +1 -1
- package/src/repo/.opencode/rules/subagent-workflow.md +1 -1
- package/src/repo/.opencode/rules/testing-quality.md +1 -1
- package/src/repo/.opencode/rules/ui-accessibility.md +1 -1
- package/src/repo/.opencode/rules/version-control.md +1 -1
- package/src/repo/.opencode/rules/what-to-avoid.md +1 -1
- package/src/repo/AGENTS.md +3 -3
- package/src/repo/README.md +4 -4
- package/src/repo/factory/README.md +33 -14
- package/src/repo/factory/worktree-bootstrap.md +32 -0
package/src/monorepo/AGENTS.md
CHANGED
|
@@ -119,11 +119,11 @@ Each app has its own `AGENTS.md` with detailed patterns:
|
|
|
119
119
|
|
|
120
120
|
## OpenCode V2 Context
|
|
121
121
|
|
|
122
|
-
OpenCode use with toolkit
|
|
122
|
+
OpenCode use with toolkit 4.0.0 and later requires native V2; Slim >=3.0.0 requires OpenCode >=2.0.7. Read [native setup](README.md#native-opencode-v2) before migration. All bootstrap flows run `opencode --version` before changes for confirmed OpenCode use: V1 must stop and upgrade OpenCode or remain on toolkit 3.x; missing/unparseable versions block OpenCode steps and marking the installed toolkit version (4.0.0 or later). Directory presence is not harness proof; other-harness-only setup is unaffected.
|
|
123
123
|
|
|
124
|
-
Use `agents`/`system`, `request.body.temperature`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`), `commands`, `plugins`, directory-based `skills`, and `mcp.servers`. Preserve user models/providers/plugins and Slim's separate strict schema; do not host-migrate its `prompt`/`permission`/`variant` fields or silently upgrade the separate external starter.
|
|
124
|
+
Use `agents`/`system`, `request.body.temperature`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`), `commands`, `plugins`, directory-based `skills`, and `mcp.servers`. Preserve user models/providers/plugins and Slim's separate strict schema; do not host-migrate its `prompt`/`permission`/`variant` fields or silently upgrade the separate external starter. The OpenCode Ponytail plugin (`@dietrichgebert/ponytail`) is installed globally by the operator; the toolkit does not register it. Bootstrap may check for it and tell the operator to install it globally, but must never add it to project config. `opentmux` stays commented as V1-only. Remove only known obsolete toolkit Ponytail `.js`/`.mjs`/`.ts` copies after backup and approval, and preserve unrelated local plugins. No local API port or bridge is used; plugin/runtime integration is untested. The Claude Code hooks in `hooks/*.json` use `${CLAUDE_PLUGIN_ROOT}` and are plugin-only: they fire only when installed through the Ponytail plugin, not from project settings.
|
|
125
125
|
|
|
126
|
-
Ambient root/nested `AGENTS.md` works
|
|
126
|
+
Ambient root/nested `AGENTS.md` works. Config `instructions` entries load only when the runtime injects them (OpenChamber does; other hosts may not), so do not rely on them: write explicit "Read and follow" wrappers regardless. `@refs` are ordinary text: explicitly read linked snippets. `request.body.temperature` remains in config, but the current runner does not send it. Preserve `lsp: true`; use workspace lint/typecheck/compiler commands, not unavailable V2 LSP diagnostics. Back up V1 before native conversion; converted files are incompatible with V1. Activate on the next run/restart.
|
|
127
127
|
|
|
128
128
|
## Detailed Instructions
|
|
129
129
|
|
package/src/monorepo/README.md
CHANGED
|
@@ -58,17 +58,17 @@ This is a monorepo managed with {{BUILD_SYSTEM}}.
|
|
|
58
58
|
|
|
59
59
|
### Native OpenCode V2
|
|
60
60
|
|
|
61
|
-
Toolkit
|
|
61
|
+
Toolkit 4.0.0 and later require **OpenCode V2 (major >=2)** for OpenCode use; oh-my-opencode-slim >=3.0.0 requires OpenCode >=2.0.7. Bootstrap, patch, and upgrade run `opencode --version` before changes (optional leading `v` accepted). V1 must stop before OpenCode customization/migration or marking toolkit 4.0.0: upgrade OpenCode or remain on toolkit 3.x. A missing CLI or unparseable version stops OpenCode steps and version marking until confirmed/installed. Confirm harness use from runtime evidence or ask, not scaffold directories; other-harness-only setup is unaffected.
|
|
62
62
|
|
|
63
|
-
The template's local `plugins` array registers
|
|
63
|
+
The template's local `plugins` array registers `opencode-mem` and `@tarquinen/opencode-dcp@latest`; `opentmux` remains commented as V1-only. The OpenCode Ponytail plugin (`@dietrichgebert/ponytail`) is installed globally by the operator and is not registered by the toolkit. Bootstrap may check for it and tell the operator to install it globally, but never adds it to project config. The obsolete local Ponytail plugin is no longer bundled; no local API port or bridge is used. For existing projects, back up and obtain approval before removing only known toolkit `.opencode/plugins/ponytail.js`, `.mjs`, or `.ts` copies; preserve unrelated local plugins and global plugins. Native local plugins are discovered automatically. The Claude Code hooks in `hooks/*.json` use `${CLAUDE_PLUGIN_ROOT}` and are plugin-only: they fire only when installed through the Ponytail plugin, not from project settings.
|
|
64
64
|
|
|
65
65
|
With approval, merge `"plugins": ["oh-my-opencode-slim@3.0.0"]` locally without replacing other registrations. Slim's separate strict schema retains `prompt`, `permission`, and `variant`; do not host-migrate it. The external starter is a separate package, not automatically upgraded. Plugin/runtime integration has not been tested.
|
|
66
66
|
|
|
67
67
|
Use native `agents`/`system`, `request.body.temperature`, ordered `permissions` (`action`/`resource`/`effect`, `shell`/`subagent`), `commands`/`subagent`, `plugins` with `{ "package": "…", "options": {} }`, skill-directory arrays, and `mcp.servers` with inverse `disabled` and `timeout.catalog`/`timeout.execution`. Follow the [V2 migration guide](https://opencode.ai/v2/docs/migrate-v1) and [plugin guide](https://opencode.ai/v2/docs/build/plugins); the published schema may describe V1 and is not V2 validation authority.
|
|
68
68
|
|
|
69
|
-
Ambient root/nested `AGENTS.md` works
|
|
69
|
+
Ambient root/nested `AGENTS.md` works. Config `instructions` entries load only when the runtime injects them (OpenChamber does; other hosts may not), so do not rely on them: write explicit "Read and follow" wrappers regardless. `@refs` are ordinary text: read linked snippets explicitly. `request.body.temperature` remains in config, but the current runner does not send it. Preserve `lsp: true`; use workspace lint/typecheck/compiler commands (no V2 LSP tools/diagnostics currently).
|
|
70
70
|
|
|
71
|
-
`--env opencode` supplies minimal shared references without activating other harnesses. Back up V1, merge rather than clobber models/providers/plugins, and activate on the next run/restart. Native-converted files are incompatible with V1. Verify with installed V2; `doctor` is not runtime validation.
|
|
71
|
+
`--env opencode` supplies minimal shared references without activating other harnesses. Back up V1, merge rather than clobber models/providers/plugins, and activate on the next run/restart. Native-converted files are incompatible with V1. Verify with installed V2; `doctor` is not runtime validation.
|
|
72
72
|
|
|
73
73
|
### Native Codex
|
|
74
74
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Factory (opt-in)
|
|
2
2
|
|
|
3
|
-
A file-driven pipeline for feature-sized work. One orchestrator session runs a feature through intake → spec → plan → build → review → approve → merge. Agents get their context only from files, and each agent writes only its own file. Feature docs live in
|
|
3
|
+
A file-driven pipeline for feature-sized work. One orchestrator session runs a feature through intake → spec → plan → build → review → approve → merge. Agents get their context only from files, and each agent writes only its own file. Feature docs live in feature folders (see Feature folders), and job state lives here in `factory/jobs/`.
|
|
4
4
|
|
|
5
5
|
The factory is **opt-in**. It sits alongside Feature Builder and TDD and changes nothing they do. Nothing runs until you invoke `/factory`. Quick fixes stay direct.
|
|
6
6
|
|
|
@@ -9,9 +9,9 @@ Orchestrator: [.agents/skills/factory/SKILL.md](../.agents/skills/factory/SKILL.
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
11
11
|
1. **Install it.** The toolkit installer copies this folder into your project root as `factory/`.
|
|
12
|
-
2. **Document your commands in `AGENTS.md`.** Agents read setup, dev, test, lint, and build commands from there, and the dev command must document how to pass a port (a flag or an env var). In a monorepo, document the root commands and the filtered form for each app and package, for example `--filter=<app>`. Without them the factory stops and asks you.
|
|
12
|
+
2. **Document your commands in `AGENTS.md`.** Agents read setup, dev, test, lint, and build commands from there, and the dev command must document how to pass a port (a flag or an env var). In a monorepo, document the root commands and the filtered form for each app and package, for example `--filter=<app>`. Without them the factory stops and asks you. Edit `factory/worktree-bootstrap.md` for the setup each new worktree needs (see Build location).
|
|
13
13
|
3. **Replace the placeholders** below in `.agents/skills/factory/SKILL.md` and `.claude/agents-snippets/factory-*.md`. Bootstrap does this when it runs.
|
|
14
|
-
4. **Commit** `factory/README.md`, `factory/.gitignore`, and the factory agents and skill. Runtime state is ignored (see Layout). Feature docs in
|
|
14
|
+
4. **Commit** `factory/README.md`, `factory/.gitignore`, and the factory agents and skill. Runtime state is ignored (see Layout). Feature docs in the feature folders are committed with the code.
|
|
15
15
|
5. **Run it** from your harness: `/factory <feature request>` to start from a request, or `/factory start <KEY | slug | job-id>` to pick up an existing feature. See [Harnesses](#harnesses) for each entry point.
|
|
16
16
|
|
|
17
17
|
## Placeholders
|
|
@@ -22,6 +22,8 @@ Orchestrator: [.agents/skills/factory/SKILL.md](../.agents/skills/factory/SKILL.
|
|
|
22
22
|
| FACTORY_PORT_BASE | Base dev-server port. Job `n` uses builder `base + 10n`, ux `+1`, ui `+2` | `5100` |
|
|
23
23
|
| APPROVAL_MODE | `human`: stop at `awaiting-human` for `/factory approve`. `auto`: merge on `APPROVE` | `human` |
|
|
24
24
|
| FACTORY_REVIEW_LENSES | Comma list from `code, security, ux, ui` | `code, security` |
|
|
25
|
+
| FACTORY_FEATURE_PATHS | Feature-folder roots, comma list, relative to the repo root. `*` matches one folder name. Search covers every root. New folders go to the first root without `*`, or to a `*` root when the request's code sits in one app | monorepo: `apps/*/docs/features, docs/features`; repo: `docs/features` |
|
|
26
|
+
| MERGE_MODE | `local`: `--no-ff` merge here, never pushed. `push-mr`: push and open a merge or pull request (see Merge modes). Any other value is `local` | `local` |
|
|
25
27
|
|
|
26
28
|
`ux` and `ui` need browser tooling to verify anything. Without it they report every check as `Not verified`, and the job goes straight to `needs-human`. Enable them only when your agents can drive a browser.
|
|
27
29
|
|
|
@@ -31,13 +33,13 @@ Orchestrator: [.agents/skills/factory/SKILL.md](../.agents/skills/factory/SKILL.
|
|
|
31
33
|
| --- | --- |
|
|
32
34
|
| `/factory <request>` | Intake: the orchestrator reads the project and the features it touches, asks only the glaring questions, then asks you to continue or change the answers. Nothing is created before that |
|
|
33
35
|
| `/factory start <request \| KEY \| slug \| job-id>` | Find or create the feature folder, then start a job, or resume the open job for it (for example one waiting at a gate) |
|
|
34
|
-
| `/factory approve <job-id>` | Merge a job in `awaiting-human` or `needs-human
|
|
36
|
+
| `/factory approve <job-id>` | Merge a job in `awaiting-human` or `needs-human` (`local`), or open its merge request (`push-mr`; approve again once the forge has merged it, to finish). On a `merged` job, moves its tickets to Done |
|
|
35
37
|
| `/factory rework <job-id> <note>` | Start a fresh builder with your note and a fresh retry budget |
|
|
36
38
|
| `/factory abandon <job-id>` | Close a job that will not continue. Nothing is merged. Removes its worktree and branch only when the branch has no unmerged commits. Tickets stay as they are |
|
|
37
39
|
| `/factory status [--all]` | Summarize open jobs from their `job.json` files. Closed jobs are hidden unless `--all` |
|
|
38
40
|
| `/factory watch [--all]` | Show the status table, then print the command for the live view to run in a terminal (read-only). Closed jobs are hidden unless `--all` |
|
|
39
41
|
| `/factory archive [--all] [--dry-run]` | Move closed jobs to `factory/archive/`. Open jobs never move. See [Archive](#archive) |
|
|
40
|
-
| `/factory prune [--all] [--abandoned] [--dry-run]` | Permanently delete closed jobs from `factory/jobs/` and `factory/archive/`, after one confirmation. Open jobs and
|
|
42
|
+
| `/factory prune [--all] [--abandoned] [--dry-run]` | Permanently delete closed jobs from `factory/jobs/` and `factory/archive/`, after one confirmation. Open jobs and feature folders are never touched. See [Prune](#prune) |
|
|
41
43
|
|
|
42
44
|
`--in-place` can follow either form (`/factory --in-place <request>`, `/factory start --in-place <...>`). It builds in the main checkout instead of a worktree. See [In-place builds](#in-place-builds).
|
|
43
45
|
|
|
@@ -57,12 +59,18 @@ The orchestrator and agents are the same in every harness. Each harness has its
|
|
|
57
59
|
|
|
58
60
|
## Feature folders and sizing
|
|
59
61
|
|
|
60
|
-
Each job belongs to a feature folder
|
|
62
|
+
Each job belongs to a feature folder: `docs/features/<KEY>-<slug>/` at the repository root, or `apps/<app>/docs/features/<KEY>-<slug>/` for work in one app (`<slug>` in place of `<KEY>-<slug>` before a ticket exists). The roots come from `FACTORY_FEATURE_PATHS`. The spec writer puts `spec.md` there. Then the plan step adds `plan.md`, which carries the size, and, for large work, a slim `tasks.md`, one line per task:
|
|
61
63
|
|
|
62
64
|
```
|
|
63
65
|
- [ ] T1 <one-line task> [P] — PROJ-1235
|
|
64
66
|
```
|
|
65
67
|
|
|
68
|
+
Where a new folder goes:
|
|
69
|
+
|
|
70
|
+
- Code in one app: `apps/<app>/docs/features/`. The per-app docs rules still cover the app's own docs.
|
|
71
|
+
- Code in several apps, or none: the root `docs/features/`.
|
|
72
|
+
- An existing folder stays where it is. Every root in `FACTORY_FEATURE_PATHS` is searched.
|
|
73
|
+
|
|
66
74
|
Sizing is decided in `plan.md`:
|
|
67
75
|
|
|
68
76
|
- **Small** (one or two steps): `spec.md` and `plan.md` only, no tickets.
|
|
@@ -89,16 +97,31 @@ Any value other than exactly `auto` is treated as `human`.
|
|
|
89
97
|
|
|
90
98
|
By default each job builds in its own git worktree on branch `factory/<id>`, so the main checkout stays free. A job's `job.json` records this in `worktree` (`true`) and the worktree path in `worktree_path`.
|
|
91
99
|
|
|
100
|
+
### Worktree bootstrap
|
|
101
|
+
|
|
102
|
+
Before the builder starts in a new worktree, the factory runs the steps listed in `factory/worktree-bootstrap.md`: one shell command per line, in order, from the worktree root. Typical steps install dependencies or vendored packages, copy `.env` from the main checkout, and create or migrate a database for the job. The file ships with no active steps, so edit it for your project. Each step receives `FACTORY_JOB_ID`, `FACTORY_PORT_BUILDER`, `FACTORY_WORKTREE`, and `FACTORY_MAIN_CHECKOUT`.
|
|
103
|
+
|
|
104
|
+
Steps must be safe to run again, because rework reruns them. A failing step stops the build and writes `bootstrap.md` in the job folder. Fix the cause, then run `/factory rework <job-id>`. In-place builds skip the bootstrap.
|
|
105
|
+
|
|
92
106
|
### In-place builds
|
|
93
107
|
|
|
94
108
|
Ask for an in-place build with `--in-place`, or by saying so at intake or at the plan gate. The build then runs in the main checkout, on branch `factory/<id>`.
|
|
95
109
|
|
|
96
|
-
- The job starts only when the main checkout is on the default branch with no tracked changes outside
|
|
110
|
+
- The job starts only when the main checkout is on the default branch with no tracked changes outside the feature folders, no other in-place job is open, and no worktree job holds its build location. Otherwise the job waits at the plan gate and says why.
|
|
97
111
|
- While the job is open, the main checkout stays on `factory/<id>`. Do not switch it until the job is merged or abandoned.
|
|
98
112
|
- The feature docs are committed on the branch when the build starts, so the main checkout has no tracked feature-doc changes to block a merge.
|
|
99
113
|
- The merge switches the main checkout back to the default branch and removes only the branch, not a worktree.
|
|
100
114
|
- A worktree job cannot merge while an in-place job holds its build location, and an in-place job cannot start while a worktree job holds one. Each refusal names the job in the way.
|
|
101
115
|
|
|
116
|
+
## Merge modes
|
|
117
|
+
|
|
118
|
+
Set `MERGE_MODE`. The approval gates are the same in both modes.
|
|
119
|
+
|
|
120
|
+
- **`local`** (default). The merge runs in the main checkout: `--no-ff`, the test commands, then the worktree and branch are removed. Nothing is pushed. Use it for a solo repo with no forge review.
|
|
121
|
+
- **`push-mr`**. Approve pushes `factory/<id>` after a local test run, then opens a merge request (GitLab, `glab mr create`) or a pull request (GitHub, `gh pr create`). The job waits in `awaiting-human` with the request's URL. Review and merge it on the forge, then run `/factory approve <job-id>` again. That run removes the worktree and branch and moves tickets to Done. It needs the matching CLI, authenticated.
|
|
122
|
+
|
|
123
|
+
`push-mr` suits forge-reviewed setups, where required reviews or CI gates sit on the forge after your approval. It never force-pushes and never merges locally. Under `auto`, approve opens the request without a pause, but the forge merge and the second `/factory approve` stay yours.
|
|
124
|
+
|
|
102
125
|
## Suggested checks (`qa.md`)
|
|
103
126
|
|
|
104
127
|
The builder writes `qa.md` in the feature folder, on the job's branch. It has how to run the feature (dev server, port, seed data, flags), numbered manual checks tied to acceptance criteria, and what the automated tests do not cover. When a job waits for you, the orchestrator prints it with the reviewers' `Not verified` items under the line `Suggested checks before /factory approve — not a gate`. It is a checklist. It never affects a verdict, and a missing `qa.md` is only noted.
|
|
@@ -111,7 +134,7 @@ When a job is tracked, its tickets follow it:
|
|
|
111
134
|
| --- | --- |
|
|
112
135
|
| Build starts | In Progress |
|
|
113
136
|
| Review starts | In Review |
|
|
114
|
-
|
|
|
137
|
+
| The merge completes: the local merge, or a `push-mr` request merged and finished with approve | Done |
|
|
115
138
|
| Job abandoned | Left as they are |
|
|
116
139
|
|
|
117
140
|
The parent and every sub-task move together. The orchestrator uses the project's status names, and asks once for them if it does not know them. A failed ticket update is recorded in the job and reported. It never blocks the pipeline.
|
|
@@ -123,18 +146,18 @@ The parent and every sub-task move together. The orchestrator uses the project's
|
|
|
123
146
|
3. **Spec gate.** You confirm the spec, or request changes.
|
|
124
147
|
4. **Plan.** `factory-spec-writer` in plan mode writes `plan.md` (with the size) and `tasks.md` for large work.
|
|
125
148
|
5. **Plan gate.** You confirm the plan, or request changes. Nothing is ticketed or built before you confirm.
|
|
126
|
-
6. **Tickets and build location.** If tracked, the parent and sub-tasks are created and their keys are written into `tasks.md`. The folder is renamed to carry the key. Then a builder gets its own git worktree on branch `factory/<id
|
|
149
|
+
6. **Tickets and build location.** If tracked, the parent and sub-tasks are created and their keys are written into `tasks.md`. The folder is renamed to carry the key. Then a builder gets its own git worktree on branch `factory/<id>` (bootstrapped first, see Build location), or the in-place branch. The job's feature docs are committed on that branch.
|
|
127
150
|
7. **Build.** The builder follows TDD, ticks `tasks.md` as it completes tasks, writes `build.md`, and writes `qa.md`.
|
|
128
151
|
8. **Review.** Every configured lens reviews the branch, writing `round-N/review-<lens>.md` with `VERDICT: PASS` or `VERDICT: CHANGES`.
|
|
129
152
|
9. **Repair.** Any `CHANGES` sends the builder back to fix it. Two repairs at most, so three review rounds. Then the job escalates to you.
|
|
130
153
|
10. **Approve.** `factory-approver` writes `decision.md` with `APPROVE` or `ESCALATE`.
|
|
131
|
-
11. **Merge.**
|
|
154
|
+
11. **Merge.** `local` mode: local only, never pushed. `push-mr` mode: push and open the request, then finish on the second approve (see Merge modes). `--no-ff` merge, the test commands for the affected apps and packages, then the worktree (if any) and branch are removed. Feature docs in the main checkout are set aside first (copies in `main-copies/`), so the merge brings in the branch's committed copies.
|
|
132
155
|
|
|
133
156
|
Jobs that escalate (`needs-human`) keep their branch and worktree so you can inspect them. Use `/factory rework` or `/factory approve` to continue.
|
|
134
157
|
|
|
135
158
|
## Abandon
|
|
136
159
|
|
|
137
|
-
`/factory abandon <job-id>` closes a job that will not continue. It merges nothing. The worktree and branch are removed only when the branch has no unmerged commits. Every job that reached its build keeps its branch and worktree, because its feature-docs commit is unmerged; review them and remove the branch yourself when you are done. Tickets stay where they are, and the report lists their keys. An abandoned job cannot be resumed: `/factory start <slug or KEY>` starts a new one.
|
|
160
|
+
`/factory abandon <job-id>` closes a job that will not continue. It merges nothing. The worktree and branch are removed only when the branch has no unmerged commits. Every job that reached its build keeps its branch and worktree, because its feature-docs commit is unmerged; review them and remove the branch yourself when you are done. Tickets stay where they are, and the report lists their keys. A `push-mr` request stays open on the forge; the report gives its URL for the operator to close. An abandoned job cannot be resumed: `/factory start <slug or KEY>` starts a new one.
|
|
138
161
|
|
|
139
162
|
## Archive
|
|
140
163
|
|
|
@@ -147,14 +170,14 @@ Jobs that escalate (`needs-human`) keep their branch and worktree so you can ins
|
|
|
147
170
|
|
|
148
171
|
## Prune
|
|
149
172
|
|
|
150
|
-
`/factory prune [--all] [--abandoned] [--dry-run]` permanently deletes closed jobs from `factory/jobs/` and `factory/archive/`. By default only `merged` jobs are deleted; `--abandoned` also deletes `abandoned` jobs. The age rule is the same as archive: jobs last updated more than 7 days ago, and `--all` drops the age limit. The list comes first, and nothing is deleted until you confirm once in chat. A pruned job cannot be recovered. Open jobs and
|
|
173
|
+
`/factory prune [--all] [--abandoned] [--dry-run]` permanently deletes closed jobs from `factory/jobs/` and `factory/archive/`. By default only `merged` jobs are deleted; `--abandoned` also deletes `abandoned` jobs. The age rule is the same as archive: jobs last updated more than 7 days ago, and `--all` drops the age limit. The list comes first, and nothing is deleted until you confirm once in chat. A pruned job cannot be recovered. Open jobs and feature folders are never touched.
|
|
151
174
|
|
|
152
175
|
Without `--abandoned`, abandoned jobs are kept and counted, and the flow offers to rerun with it. When abandoned jobs are pruned, each one whose branch still exists gets the same per-branch question as archive. Merged branches are only listed. `npx nitm-ai-dev-toolkit factory prune` lists by default; add `--yes` to delete (and `--abandoned` to include abandoned jobs).
|
|
153
176
|
|
|
154
177
|
## Layout
|
|
155
178
|
|
|
156
179
|
```
|
|
157
|
-
|
|
180
|
+
<feature root>/ tracked by the project (roots: FACTORY_FEATURE_PATHS)
|
|
158
181
|
<KEY>-<slug>/
|
|
159
182
|
spec.md
|
|
160
183
|
plan.md
|
|
@@ -163,9 +186,10 @@ docs/features/ tracked by the project
|
|
|
163
186
|
factory/
|
|
164
187
|
README.md this file
|
|
165
188
|
.gitignore ignores jobs/ and archive/
|
|
189
|
+
worktree-bootstrap.md setup steps run in each new worktree (edit for your project)
|
|
166
190
|
jobs/ runtime state (ignored by git)
|
|
167
191
|
<NNN-slug>/
|
|
168
|
-
job.json stage, round, reviews, size, tracking, worktree, failed_stage, approval mode
|
|
192
|
+
job.json stage, round, reviews, size, tracking, worktree, mr, failed_stage, approval mode
|
|
169
193
|
intake.md intake questions and answers (only when asked)
|
|
170
194
|
spec-<k>.md after a change request at the spec gate
|
|
171
195
|
plan-<k>.md after a change request at the plan gate
|
|
@@ -173,6 +197,7 @@ factory/
|
|
|
173
197
|
round-<N>/review-<lens>.md
|
|
174
198
|
decision.md
|
|
175
199
|
merge-conflict.md after a merge conflict; blocks approve
|
|
200
|
+
bootstrap.md after a failed worktree bootstrap step; blocks the build
|
|
176
201
|
rework-<k>.md
|
|
177
202
|
main-copies/ feature docs moved aside at merge
|
|
178
203
|
archive/ closed jobs moved by /factory archive (ignored by git)
|
|
@@ -187,7 +212,7 @@ Stages, in order: `spec`, `awaiting-spec`, `plan`, `awaiting-plan`, `build`, `re
|
|
|
187
212
|
|
|
188
213
|
- **Write boundaries are conventions.** Each agent is told which files it writes, but nothing enforces that. The real gates are the spec and plan gates, the reviewer verdicts, the approver's checks, and the merge preconditions and test run.
|
|
189
214
|
- **Harness behavior varies.** Parallel review and builder resume depend on the harness. If dispatch is background-only, the orchestrator polls for each file until a 15-minute default timeout (the request can set another). A timed-out agent is never re-dispatched: the job stops at `needs-human`. See Harness notes in [SKILL.md](../.agents/skills/factory/SKILL.md).
|
|
190
|
-
- **Local merge
|
|
215
|
+
- **Local merge by default.** `local` never pushes. `push-mr` pushes only on approve, and only the `factory/<id>` branch. Force-push is never used.
|
|
191
216
|
- **One job at a time per checkout** is the tested path. An in-place job also holds the main checkout until it merges or is abandoned.
|
|
192
217
|
- **UI lenses need a browser.** Without one they cannot verify anything and the job escalates.
|
|
193
218
|
- **Tickets are best-effort.** Creation failures stop at the plan gate. Transition failures are recorded and reported.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Worktree bootstrap (factory)
|
|
2
|
+
|
|
3
|
+
The factory runs the steps below in each new job worktree, in order, before the builder starts. Edit this file for your project; it is yours after install and `upgrade` never overwrites it without `--force`.
|
|
4
|
+
|
|
5
|
+
Rules:
|
|
6
|
+
|
|
7
|
+
- One shell command per line. Lines starting with `#` are notes. Blank lines are skipped.
|
|
8
|
+
- Each command runs from the worktree root with `sh -c`. It stops the build at the first failure.
|
|
9
|
+
- Each command gets these variables:
|
|
10
|
+
- `FACTORY_JOB_ID`: the job id, such as `001-onboarding-bootstrap`. Use it to name per-job resources, such as a database.
|
|
11
|
+
- `FACTORY_PORT_BUILDER`: the builder's dev-server port. Pass it with the flag or env var that `AGENTS.md` documents.
|
|
12
|
+
- `FACTORY_WORKTREE`: the worktree path (also the current directory).
|
|
13
|
+
- `FACTORY_MAIN_CHECKOUT`: the main checkout, where ignored local files such as `.env` live.
|
|
14
|
+
- Steps must be safe to run again. Rework reruns the whole list.
|
|
15
|
+
- Keep secrets out of this file. Copy them from `FACTORY_MAIN_CHECKOUT` instead.
|
|
16
|
+
|
|
17
|
+
The list ships with no active steps. Uncomment the ones your project needs, or replace them. Examples:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
# Dependencies: pick the one AGENTS.md documents.
|
|
21
|
+
# npm ci
|
|
22
|
+
# pnpm install --frozen-lockfile
|
|
23
|
+
# composer install --no-interaction
|
|
24
|
+
# bundle install --path vendor/bundle
|
|
25
|
+
# go mod vendor
|
|
26
|
+
|
|
27
|
+
# Local env file, copied only when the main checkout has one and this worktree does not.
|
|
28
|
+
# [ -f "$FACTORY_MAIN_CHECKOUT/.env" ] && [ ! -f .env ] && cp "$FACTORY_MAIN_CHECKOUT/.env" .env
|
|
29
|
+
|
|
30
|
+
# Database for this job only. Replace with your own create and migrate commands.
|
|
31
|
+
# createdb "app_${FACTORY_JOB_ID}" && DATABASE_URL="postgres:///app_${FACTORY_JOB_ID}" npm run db:migrate
|
|
32
|
+
```
|