nitm-ai-dev-toolkit 5.1.1 → 5.1.3
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 +42 -0
- package/README.md +91 -58
- package/bin/cli.js +175 -43
- package/bin/relevance.js +306 -0
- package/package.json +1 -1
- package/src/monorepo/.agents/skills/factory/SKILL.md +2 -1
- package/src/monorepo/.agents/skills/using-git-worktrees/SKILL.md +8 -11
- package/src/monorepo/.claude/prompt-snippets/bootstrap-patch.md +30 -14
- package/src/monorepo/.claude/prompt-snippets/bootstrap-upgrade.md +9 -4
- package/src/monorepo/.claude/prompt-snippets/bootstrap.md +50 -25
- package/src/monorepo/.claude/skills/README.md +7 -7
- package/src/monorepo/.cursor/skills/README.md +8 -8
- package/src/monorepo/.github/skills/README.md +4 -4
- package/src/monorepo/.opencode/commands/review-staged.md +4 -0
- package/src/monorepo/factory/README.md +2 -0
- package/src/repo/.agents/skills/factory/SKILL.md +2 -1
- package/src/repo/.agents/skills/using-git-worktrees/SKILL.md +8 -11
- package/src/repo/.claude/prompt-snippets/bootstrap-patch.md +30 -14
- package/src/repo/.claude/prompt-snippets/bootstrap-upgrade.md +9 -6
- package/src/repo/.claude/prompt-snippets/bootstrap.md +52 -29
- package/src/repo/.claude/skills/README.md +7 -7
- package/src/repo/.cursor/skills/README.md +8 -8
- package/src/repo/.github/skills/README.md +4 -4
- package/src/repo/.opencode/commands/review-staged.md +4 -0
- package/src/repo/factory/README.md +2 -0
|
@@ -20,6 +20,28 @@ You are helping to bootstrap AI instructions for this monorepo by analyzing the
|
|
|
20
20
|
- Codex MCP uses native `[mcp_servers.name]` TOML, not `.mcp.json`. Treat other harness MCP templates as references only; do not activate servers, copy credentials, or install hooks automatically.
|
|
21
21
|
- Update and audit only confirmed harness targets. For Codex-only setup, the native targets are root/nested `AGENTS.md`, `.agents/skills/`, and `.codex/config.toml`. `--env codex` also includes `.github/instructions/` and `.claude/rules-snippets/` solely as AGENTS-linked standards and their wrapper sources, not automatically loaded rules or evidence of Copilot/Claude use; other harness command, agent, and config directories are excluded. Tool-specific steps below are conditional.
|
|
22
22
|
|
|
23
|
+
## Thin Wrapper Policy
|
|
24
|
+
|
|
25
|
+
Canonical policy lives only in `.claude/rules-snippets/`, `.claude/prompt-snippets/`, and `.claude/agents-snippets/`. Every harness wrapper (`.claude/{rules,commands,agents}/`, `.cursor/{rules,commands,agents}/`, `.github/{instructions,prompts,agents}/`, `.opencode/{rules,commands,agents}/`, and Codex and Copilot entry files) is a thin link to its snippet: frontmatter, a title, the link line, at most five key points, and optionally one short summary line. Its agent-dispatch table is activation metadata and may stay.
|
|
26
|
+
|
|
27
|
+
- **Create or change policy in the snippet first, then the wrapper.** Never write a wrapper with a copy of the policy, and never let a wrapper diverge from its snippet.
|
|
28
|
+
- **Skills that restate a snippet's policy point to the snippet** (or, where the skill is the source, the snippet points to the skill). Keep one source of policy text.
|
|
29
|
+
- **Existing wrappers that inline policy or diverge from their snippet** are reported (`npx nitm-ai-dev-toolkit doctor` lists them). Propose moving the content into the snippet and reducing the wrapper to a link. Change nothing without the operator's approval.
|
|
30
|
+
|
|
31
|
+
## Relevance and Retirement
|
|
32
|
+
|
|
33
|
+
The template ships files for every stack, tracker and test tool. Decide what applies to this monorepo and each app; do not copy the whole template.
|
|
34
|
+
|
|
35
|
+
- **Relevance comes from the project:** the tracker (git origin host, or `"trackers"` in `.nitm/retired.json`), Playwright, Prisma, the UI framework (read from the root and `apps/*`, `packages/*` package manifests), and whether MCP servers are configured. `npx nitm-ai-dev-toolkit patch --dry-run` prints each template file's classification with its reason (add, update, needs review, not relevant, retired). Use that plan; do not copy template files by hand.
|
|
36
|
+
- **Retire what does not apply** by recording it in `.nitm/retired.json` after the operator agrees, with a reason and date:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{ "retired": [{ "path": ".agents/skills/linear-cli", "reason": "GitHub Issues is the tracker", "date": "2026-10-27" }] }
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
A directory path retires every file under it. Patch and upgrade never re-add retired paths, and doctor reports them as retired, not missing. Never delete files to retire them.
|
|
43
|
+
- **Override tracker detection** with `"trackers": ["github"]` (or `[]` for none) when the git origin does not name the tracker.
|
|
44
|
+
|
|
23
45
|
## Your Task
|
|
24
46
|
|
|
25
47
|
1. **Analyze the Monorepo**:
|
|
@@ -333,11 +355,16 @@ Present the replacements and confirm before applying.
|
|
|
333
355
|
|
|
334
356
|
10. **Recommend and Install AI Agent Skills**:
|
|
335
357
|
|
|
336
|
-
|
|
358
|
+
Recommend skills from [skills.sh](https://skills.sh/) and [agentskills.io](https://agentskills.io/) only for needs this monorepo or app has: its tracker, framework, language, and test tooling. Never install a whole repository with `--skill '*'`. The toolkit already ships the core workflow skills (TDD, debugging, planning, review) in `.agents/skills/`, so do not recommend them again.
|
|
359
|
+
|
|
360
|
+
**Rules for every recommendation:**
|
|
361
|
+
- One named skill per install (`--skill <name>`). Confirm the name exists in its source repository first. If you cannot confirm it, leave that install out and say so.
|
|
362
|
+
- List the detected need next to each skill. Recommend nothing without a need.
|
|
363
|
+
- Install nothing before the operator approves that skill. Approving one skill does not approve the others.
|
|
337
364
|
|
|
338
365
|
**Important:** Use the detected agent flags from step 9 in all `npx skills add` commands. This prevents creating unnecessary configurations for agents the user doesn't have installed.
|
|
339
366
|
|
|
340
|
-
**
|
|
367
|
+
**Generic workflow skills (optional; the toolkit already ships equivalents):**
|
|
341
368
|
|
|
342
369
|
| Skill Repository | Purpose |
|
|
343
370
|
| -------------------------- | -------------------------------------------------- |
|
|
@@ -348,8 +375,7 @@ Based on detected ecosystem and frameworks, recommend relevant skills from [skil
|
|
|
348
375
|
**Example commands** (replace `{{AGENT_FLAGS}}` with confirmed harness flags from step 9, e.g., `-a codex`):
|
|
349
376
|
|
|
350
377
|
```bash
|
|
351
|
-
npx -y skills add {{AGENT_FLAGS}}
|
|
352
|
-
npx -y skills add {{AGENT_FLAGS}} trailofbits/skills --skill '*'
|
|
378
|
+
npx -y skills add {{AGENT_FLAGS}} <owner/repo> --skill <confirmed name> # one line per approved skill
|
|
353
379
|
```
|
|
354
380
|
|
|
355
381
|
**Issue Tracker Skills Health Check (if {{ISSUE_TRACKER}} is configured):**
|
|
@@ -373,10 +399,10 @@ This template bundles issue tracker skills in `.agents/skills/`. Verify the corr
|
|
|
373
399
|
- Configured tracker: Linear
|
|
374
400
|
- Found skill: acli (not matching)
|
|
375
401
|
- Expected skill: linear-cli
|
|
376
|
-
|
|
402
|
+
Retire acli and keep linear-cli? (Y/n)
|
|
377
403
|
```
|
|
378
|
-
4. **
|
|
379
|
-
5. **If missing:** Warn that the expected CLI skill is not present
|
|
404
|
+
4. **Retire mismatched CLI skills:** On confirmation, record each in `.nitm/retired.json` (reason and date) and update the AGENTS.md Skills table. Delete a directory only with separate approval and a backup
|
|
405
|
+
5. **If missing:** Warn that the expected CLI skill is not present; add it only when `patch --dry-run` shows it applies and the operator approves
|
|
380
406
|
|
|
381
407
|
**Framework-Specific Skills:**
|
|
382
408
|
|
|
@@ -411,13 +437,13 @@ When recommending framework-specific skills, include the detected agent flags. E
|
|
|
411
437
|
| React | `vercel-labs/agent-skills` | `npx -y skills add {{AGENT_FLAGS}} vercel-labs/agent-skills --skill "vercel-react-best-practices"` |
|
|
412
438
|
| Vue | `onmax/nuxt-skills` (vue) | `npx -y skills add {{AGENT_FLAGS}} onmax/nuxt-skills --skill "vue"` |
|
|
413
439
|
| Nuxt | `onmax/nuxt-skills` (nuxt) | `npx -y skills add {{AGENT_FLAGS}} onmax/nuxt-skills --skill "nuxt"` |
|
|
414
|
-
| Expo | `expo/skills` | `npx -y skills add {{AGENT_FLAGS}} expo/skills --skill
|
|
415
|
-
| TypeScript | `pproenca/dot-skills` (typescript) | `npx -y skills add {{AGENT_FLAGS}} pproenca/dot-skills --skill
|
|
416
|
-
| Advanced Types | `wshobson/agents` (ts-advanced-types) | `npx -y skills add {{AGENT_FLAGS}} wshobson/agents --skill
|
|
440
|
+
| Expo | `expo/skills` | `npx -y skills add {{AGENT_FLAGS}} expo/skills --skill <name confirmed in the repository>` |
|
|
441
|
+
| TypeScript | `pproenca/dot-skills` (typescript) | `npx -y skills add {{AGENT_FLAGS}} pproenca/dot-skills --skill "typescript"` |
|
|
442
|
+
| Advanced Types | `wshobson/agents` (ts-advanced-types) | `npx -y skills add {{AGENT_FLAGS}} wshobson/agents --skill "ts-advanced-types"` |
|
|
417
443
|
|
|
418
444
|
**Skill Creation for Unsupported Frameworks:**
|
|
419
445
|
|
|
420
|
-
|
|
446
|
+
To create a custom skill for an unsupported framework, install only `skill-creator` from `anthropics/skills`: `npx -y skills add {{AGENT_FLAGS}} anthropics/skills --skill "skill-creator"`.
|
|
421
447
|
|
|
422
448
|
**Monorepo-Specific Considerations:**
|
|
423
449
|
|
|
@@ -438,28 +464,26 @@ Using flags: {{AGENT_FLAGS}}
|
|
|
438
464
|
|
|
439
465
|
Based on your monorepo ({{BUILD_SYSTEM}}/{{LANGUAGE}}):
|
|
440
466
|
|
|
441
|
-
|
|
442
|
-
npx -y skills add {{AGENT_FLAGS}}
|
|
443
|
-
npx -y skills add {{AGENT_FLAGS}} trailofbits/skills --skill '*'
|
|
444
|
-
npx -y skills add {{AGENT_FLAGS}} softaworks/agent-toolkit --skill '*'
|
|
467
|
+
Approved installs (none until the operator approves each one):
|
|
468
|
+
npx -y skills add {{AGENT_FLAGS}} <owner/repo> --skill <confirmed name> # one line per approved skill
|
|
445
469
|
|
|
446
470
|
Issue Tracker Skills (bundled — {{ISSUE_TRACKER}}):
|
|
447
471
|
✅ .agents/skills/issue-tracker/SKILL.md (shared strategy)
|
|
448
472
|
✅ Matching CLI reference: .agents/skills/acli/SKILL.md, .agents/skills/gh-cli/SKILL.md, or .agents/skills/linear-cli/SKILL.md
|
|
449
|
-
⚠️
|
|
473
|
+
⚠️ Retire any issue-tracker CLI skills that do not match {{ISSUE_TRACKER}} (if any; record them in .nitm/retired.json)
|
|
450
474
|
|
|
451
|
-
Framework-Specific Skills:
|
|
452
|
-
- web (Next.js): npx -y skills add {{AGENT_FLAGS}} vercel-labs/agent-skills --skill
|
|
453
|
-
- api (Hono): npx -y skills add {{AGENT_FLAGS}} elysiajs/skills --skill
|
|
475
|
+
Framework-Specific Skills (one named skill each, after confirming its name):
|
|
476
|
+
- web (Next.js): npx -y skills add {{AGENT_FLAGS}} vercel-labs/agent-skills --skill <confirmed name>
|
|
477
|
+
- api (Hono): npx -y skills add {{AGENT_FLAGS}} elysiajs/skills --skill <confirmed name>
|
|
454
478
|
|
|
455
|
-
|
|
479
|
+
Approve each skill by name (or none). Nothing is installed without approval.
|
|
456
480
|
```
|
|
457
481
|
|
|
458
482
|
**Example with detected agents:**
|
|
459
483
|
|
|
460
484
|
- If Cursor and Copilot are confirmed: `AGENT_FLAGS="-a cursor -a github-copilot"`
|
|
461
485
|
- If only Codex is confirmed: `AGENT_FLAGS="-a codex"`
|
|
462
|
-
- Codex-only command: `npx -y skills add -a codex
|
|
486
|
+
- Codex-only command: `npx -y skills add -a codex <owner/repo> --skill <confirmed name>`
|
|
463
487
|
|
|
464
488
|
**On Confirmation:**
|
|
465
489
|
|
|
@@ -530,11 +554,12 @@ Next Steps:
|
|
|
530
554
|
| django-expert | Django patterns | No Django apps detected |
|
|
531
555
|
| php | PHP patterns | JavaScript/TypeScript monorepo |
|
|
532
556
|
|
|
533
|
-
|
|
557
|
+
Retire flagged skills? (Y/n)
|
|
534
558
|
```
|
|
535
559
|
|
|
536
560
|
**On Confirmation:**
|
|
537
|
-
-
|
|
561
|
+
- Record each approved skill in `.nitm/retired.json` (reason and date) so `patch` leaves it out; this removes nothing from the template
|
|
562
|
+
- Delete a skill directory only with separate approval and a backup
|
|
538
563
|
- Update root AGENTS.md to remove references
|
|
539
564
|
- Report cleanup results
|
|
540
565
|
|
|
@@ -566,8 +591,8 @@ Next Steps:
|
|
|
566
591
|
```
|
|
567
592
|
|
|
568
593
|
**On Confirmation (only if Copilot is confirmed in use):**
|
|
569
|
-
-
|
|
570
|
-
- Include app-specific scoping (applyTo paths)
|
|
594
|
+
- Write the policy of each missing Copilot instruction into `.claude/rules-snippets/<name>.md` first, then create `.github/instructions/<name>.instructions.md` as a thin wrapper (frontmatter with `applyTo`, a title, a link to the snippet, at most five key points); skip creation for a Codex-only audit even when shared reference standards are present
|
|
595
|
+
- Include app-specific scoping (applyTo paths) in the wrapper frontmatter only
|
|
571
596
|
- Include framework-specific patterns from skills
|
|
572
597
|
- Report created files
|
|
573
598
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Claude Code Skills
|
|
2
2
|
|
|
3
|
-
This folder is for skills installed via `npx -y skills add -a claude-code <owner/repo> --skill
|
|
3
|
+
This folder is for skills installed via `npx -y skills add -a claude-code <owner/repo> --skill <confirmed name>`.
|
|
4
4
|
|
|
5
5
|
## About Skills
|
|
6
6
|
|
|
@@ -12,10 +12,10 @@ Install skills from [skills.sh](https://skills.sh/) using the `-a claude-code` f
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
# For Claude Code only
|
|
15
|
-
npx -y skills add -a claude-code <owner/repo> --skill
|
|
15
|
+
npx -y skills add -a claude-code <owner/repo> --skill <confirmed name>
|
|
16
16
|
|
|
17
17
|
# For multiple agents (e.g., Claude Code + GitHub Copilot)
|
|
18
|
-
npx -y skills add -a claude-code -a github-copilot <owner/repo> --skill
|
|
18
|
+
npx -y skills add -a claude-code -a github-copilot <owner/repo> --skill <confirmed name>
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
**Tip:** The skills CLI automatically detects installed agents. If you omit `-a claude-code`, you'll be prompted to choose from detected agents.
|
|
@@ -37,14 +37,14 @@ Universal workflow skills are pre-installed in `.agents/skills/`. These include:
|
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
39
|
# Frontend skills
|
|
40
|
-
npx -y skills add -a claude-code onmax/nuxt-skills --skill
|
|
41
|
-
npx -y skills add -a claude-code vercel-labs/agent-skills --skill
|
|
40
|
+
npx -y skills add -a claude-code onmax/nuxt-skills --skill vue
|
|
41
|
+
npx -y skills add -a claude-code vercel-labs/agent-skills --skill vercel-react-best-practices
|
|
42
42
|
|
|
43
43
|
# Security skills
|
|
44
|
-
npx -y skills add -a claude-code trailofbits/skills --skill
|
|
44
|
+
npx -y skills add -a claude-code trailofbits/skills --skill <confirmed name>
|
|
45
45
|
|
|
46
46
|
# Framework-specific
|
|
47
|
-
npx -y skills add -a claude-code better-auth/skills --skill
|
|
47
|
+
npx -y skills add -a claude-code better-auth/skills --skill <confirmed name>
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
See the main README.md for a full list of recommended skills.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Cursor Skills
|
|
2
2
|
|
|
3
|
-
This folder is for skills installed via `npx -y skills add <owner/repo> --skill
|
|
3
|
+
This folder is for skills installed via `npx -y skills add <owner/repo> --skill <confirmed name> --agent github-copilot cursor`.
|
|
4
4
|
|
|
5
5
|
## About Skills
|
|
6
6
|
|
|
@@ -12,13 +12,13 @@ Install skills from [skills.sh](https://skills.sh/) using the `-a cursor` flag:
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
# For Cursor only
|
|
15
|
-
npx -y skills add -a cursor <owner/repo> --skill
|
|
15
|
+
npx -y skills add -a cursor <owner/repo> --skill <confirmed name> --agent github-copilot cursor
|
|
16
16
|
|
|
17
17
|
# For multiple agents (e.g., Cursor + GitHub Copilot)
|
|
18
|
-
npx -y skills add -a cursor -a github-copilot <owner/repo> --skill
|
|
18
|
+
npx -y skills add -a cursor -a github-copilot <owner/repo> --skill <confirmed name> --agent github-copilot cursor
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
**Tip:** The skills CLI automatically detects installed agents. If you omit `-a cursor`, you'll be prompted to choose from detected agents. Use `--skill
|
|
21
|
+
**Tip:** The skills CLI automatically detects installed agents. If you omit `-a cursor`, you'll be prompted to choose from detected agents. Use `--skill <confirmed name> --agent github-copilot cursor` when installing one named skill from a repo.
|
|
22
22
|
|
|
23
23
|
**Important:** Always use `-a cursor` to install only for Cursor (or add multiple `-a` flags if you use multiple agents). This prevents creating unnecessary configuration files for other agents.
|
|
24
24
|
|
|
@@ -37,14 +37,14 @@ Universal workflow skills are pre-installed in `.agents/skills/`. These include:
|
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
39
|
# Frontend skills
|
|
40
|
-
npx -y skills add -a cursor onmax/nuxt-skills --skill
|
|
41
|
-
npx -y skills add -a cursor vercel-labs/agent-skills --skill
|
|
40
|
+
npx -y skills add -a cursor onmax/nuxt-skills --skill vue --agent github-copilot cursor
|
|
41
|
+
npx -y skills add -a cursor vercel-labs/agent-skills --skill vercel-react-best-practices --agent github-copilot cursor
|
|
42
42
|
|
|
43
43
|
# Security skills
|
|
44
|
-
npx -y skills add -a cursor trailofbits/skills --skill
|
|
44
|
+
npx -y skills add -a cursor trailofbits/skills --skill <confirmed name> --agent github-copilot cursor
|
|
45
45
|
|
|
46
46
|
# Framework-specific
|
|
47
|
-
npx -y skills add -a cursor better-auth/skills --skill
|
|
47
|
+
npx -y skills add -a cursor better-auth/skills --skill <confirmed name> --agent github-copilot cursor
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
See the main README.md for a full list of recommended skills.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GitHub Copilot Skills
|
|
2
2
|
|
|
3
|
-
This folder is for skills installed via `npx -y skills add <owner/repo> --skill
|
|
3
|
+
This folder is for skills installed via `npx -y skills add <owner/repo> --skill <confirmed name> --agent github-copilot cursor` when using GitHub Copilot.
|
|
4
4
|
|
|
5
5
|
## About Skills
|
|
6
6
|
|
|
@@ -12,13 +12,13 @@ Install skills from [skills.sh](https://skills.sh/) using the `-a github-copilot
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
# For GitHub Copilot only
|
|
15
|
-
npx -y skills add -a github-copilot <owner/repo> --skill
|
|
15
|
+
npx -y skills add -a github-copilot <owner/repo> --skill <confirmed name> --agent github-copilot cursor
|
|
16
16
|
|
|
17
17
|
# For multiple agents (e.g., Copilot + Cursor)
|
|
18
|
-
npx -y skills add -a github-copilot -a cursor <owner/repo> --skill
|
|
18
|
+
npx -y skills add -a github-copilot -a cursor <owner/repo> --skill <confirmed name> --agent github-copilot cursor
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
**Tip:** The skills CLI automatically detects installed agents. If you omit `-a github-copilot`, you'll be prompted to choose from detected agents. Use `--skill
|
|
21
|
+
**Tip:** The skills CLI automatically detects installed agents. If you omit `-a github-copilot`, you'll be prompted to choose from detected agents. Use `--skill <confirmed name> --agent github-copilot cursor` when installing one named skill from a repo.
|
|
22
22
|
|
|
23
23
|
**Important:** Always use `-a github-copilot` to install only for GitHub Copilot (or add multiple `-a` flags if you use multiple agents). This prevents creating unnecessary configuration files for other agents.
|
|
24
24
|
|
|
@@ -9,3 +9,7 @@ description: "Review currently staged files before committing"
|
|
|
9
9
|
|-------|-------------|
|
|
10
10
|
| `reviewer` | Standard pre-commit review — correctness, style, patterns |
|
|
11
11
|
| `oracle` | Complex staged change — trade-offs, security, scalability |
|
|
12
|
+
|
|
13
|
+
Read and follow `.claude/prompt-snippets/review-staged.md` before executing this command.
|
|
14
|
+
|
|
15
|
+
$ARGUMENTS
|
|
@@ -99,6 +99,8 @@ Any value other than exactly `auto` is treated as `human`.
|
|
|
99
99
|
|
|
100
100
|
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`. Worktrees live in `.worktrees/<id>/` at the git root; the factory adds `.worktrees/` to `.gitignore` if it is missing.
|
|
101
101
|
|
|
102
|
+
Tools that do not honor `.gitignore` (Jest/Vitest test discovery, ESLint, `tsc`, workspace globs) should exclude `.worktrees/`. The local merge runs tests in the main checkout while other job worktrees may still exist.
|
|
103
|
+
|
|
102
104
|
### Worktree bootstrap
|
|
103
105
|
|
|
104
106
|
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`.
|
|
@@ -294,7 +294,8 @@ If a ticket cannot be created, stop at `awaiting-plan`. Report the lines that ha
|
|
|
294
294
|
The default build location. Follow the [using-git-worktrees](../using-git-worktrees/SKILL.md) skill. Factory always takes its project-local `.worktrees/` default and never the global `~/.worktrees` option, without asking.
|
|
295
295
|
|
|
296
296
|
- Branch `factory/<id>` from `{{DEFAULT_BRANCH}}`.
|
|
297
|
-
- Path `.worktrees/<id>/` at the root of the main checkout (inside the repo folder). Record its absolute path in `worktree_path`.
|
|
297
|
+
- Path `.worktrees/<id>/` at the root of the main checkout (inside the repo folder). The folder is named by the job id, never by the branch: branch `factory/<id>` must not produce `.worktrees/factory/<id>`. Record its absolute path in `worktree_path`.
|
|
298
|
+
- `factory/worktree-bootstrap.md` replaces the worktree skill's project-setup and baseline-test steps. Factory does not run those.
|
|
298
299
|
- Before the first worktree, run that skill's `.gitignore` check. If it had to add `.worktrees/`, commit that on `{{DEFAULT_BRANCH}}` or tell the operator to.
|
|
299
300
|
- Create it at the start of the build stage, after the plan gate and tracking. Reuse it if it exists (rework and repair).
|
|
300
301
|
- Copy the job's `spec.md`, `plan.md`, and `tasks.md` (if any) from the main checkout's feature folder into the same relative path in the worktree. The builder ticks `tasks.md` there. Then run the bootstrap (next subsection) and make the feature docs commit.
|
|
@@ -37,11 +37,10 @@ Follow this priority order:
|
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
39
|
# Check in priority order
|
|
40
|
-
ls -d .worktrees 2>/dev/null
|
|
41
|
-
ls -d worktrees 2>/dev/null # Alternative
|
|
40
|
+
ls -d .worktrees 2>/dev/null
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
**If found:** Use that directory.
|
|
43
|
+
**If found:** Use that directory.
|
|
45
44
|
|
|
46
45
|
### 2. Check Project Configuration
|
|
47
46
|
|
|
@@ -67,21 +66,21 @@ Which would you prefer?
|
|
|
67
66
|
|
|
68
67
|
## Safety Verification
|
|
69
68
|
|
|
70
|
-
### For Project-Local Directories (.worktrees
|
|
69
|
+
### For Project-Local Directories (.worktrees)
|
|
71
70
|
|
|
72
71
|
**MUST verify directory is ignored before creating worktree:**
|
|
73
72
|
|
|
74
73
|
```bash
|
|
75
74
|
# Check if directory is ignored (respects local, global, and system gitignore)
|
|
76
|
-
git check-ignore -q .worktrees 2>/dev/null
|
|
75
|
+
git check-ignore -q .worktrees 2>/dev/null
|
|
77
76
|
```
|
|
78
77
|
|
|
79
78
|
**If NOT ignored:**
|
|
80
79
|
|
|
81
80
|
Fix immediately before proceeding:
|
|
82
81
|
|
|
83
|
-
1. Add
|
|
84
|
-
2. Commit the change
|
|
82
|
+
1. Add `.worktrees/` to .gitignore
|
|
83
|
+
2. Commit the change on the default branch
|
|
85
84
|
3. Proceed with worktree creation
|
|
86
85
|
|
|
87
86
|
**Why critical:** Prevents accidentally committing worktree contents to repository.
|
|
@@ -103,11 +102,11 @@ project=$(basename "$(git rev-parse --show-toplevel)")
|
|
|
103
102
|
```bash
|
|
104
103
|
# Determine full path
|
|
105
104
|
case $LOCATION in
|
|
106
|
-
.worktrees
|
|
105
|
+
.worktrees)
|
|
107
106
|
path="$LOCATION/$BRANCH_NAME"
|
|
108
107
|
;;
|
|
109
108
|
~/.worktrees/*)
|
|
110
|
-
path="
|
|
109
|
+
path="$HOME/.worktrees/$project/$BRANCH_NAME"
|
|
111
110
|
;;
|
|
112
111
|
esac
|
|
113
112
|
|
|
@@ -164,8 +163,6 @@ Ready to implement <feature-name>
|
|
|
164
163
|
| Situation | Action |
|
|
165
164
|
| -------------------------- | ------------------------------- |
|
|
166
165
|
| `.worktrees/` exists | Use it (verify ignored) |
|
|
167
|
-
| `worktrees/` exists | Use it (verify ignored) |
|
|
168
|
-
| Both exist | Use `.worktrees/` |
|
|
169
166
|
| Neither exists | Check project config → Ask user |
|
|
170
167
|
| Directory not ignored | Add to .gitignore + commit |
|
|
171
168
|
| Tests fail during baseline | Report failures + ask |
|
|
@@ -117,11 +117,13 @@ The CLI runs the same patch flow without an AI session: `npx nitm-ai-dev-toolkit
|
|
|
117
117
|
|
|
118
118
|
For each category, compare template files against project files:
|
|
119
119
|
|
|
120
|
-
a. **Classify each file
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
120
|
+
a. **Classify each file** (relevance-aware; never a wholesale copy). `npx nitm-ai-dev-toolkit patch --dry-run` makes this classification and prints each reason. Read that plan before deciding anything, and see Relevance and Retirement in `bootstrap.md`:
|
|
121
|
+
- **add**: missing, and it applies to this project (tracker, Playwright, Prisma, UI, and MCP relevance)
|
|
122
|
+
- **update**: the toolkit wrote it and the project has not changed it since; the new template replaces it
|
|
123
|
+
- **current**: identical to the template; no action
|
|
124
|
+
- **needs review**: differs from the template (locally changed), or missing while relevance is undecided; never overwritten, and never added without a decision
|
|
125
|
+
- **not relevant**: does not apply to this project; never added. A present copy is a retirement candidate
|
|
126
|
+
- **retired**: listed in `.nitm/retired.json`; never added, updated or overwritten
|
|
125
127
|
- **⚠️ Missing in Template**: Exists in project but not in template → project-specific, keep as-is except the approved obsolete toolkit Ponytail removal above
|
|
126
128
|
|
|
127
129
|
b. **For updated files, generate a structured diff**:
|
|
@@ -132,7 +134,7 @@ The CLI runs the same patch flow without an AI session: `npx nitm-ai-dev-toolkit
|
|
|
132
134
|
|
|
133
135
|
c. **Smart Merge Rules**:
|
|
134
136
|
- **Never overwrite** project-specific values that replaced `{{PLACEHOLDER}}`
|
|
135
|
-
- **
|
|
137
|
+
- **Add only** files classified *add*. Never add a not-relevant or retired file, and never add a file whose relevance is undecided without the operator's decision
|
|
136
138
|
- **Merge structural additions** into existing customized files
|
|
137
139
|
- **Flag for review** any removals from files that have been customized
|
|
138
140
|
- **Preserve custom agents/skills** that were added by the project
|
|
@@ -146,13 +148,13 @@ The CLI runs the same patch flow without an AI session: `npx nitm-ai-dev-toolkit
|
|
|
146
148
|
**Project Type**: repo | monorepo
|
|
147
149
|
**Categories Scanned**: [list]
|
|
148
150
|
|
|
149
|
-
### 🆕
|
|
151
|
+
### 🆕 Add (X files; apply to this project)
|
|
150
152
|
|
|
151
153
|
| File | Category | Description |
|
|
152
154
|
| ---------------------------- | -------- | ------------------------ |
|
|
153
155
|
| `.cursor/rules/new-rule.mdc` | Rules | New coding standard rule |
|
|
154
156
|
|
|
155
|
-
### 📝
|
|
157
|
+
### 📝 Update (X files; unchanged since the toolkit wrote them)
|
|
156
158
|
|
|
157
159
|
| File | Changes | Risk |
|
|
158
160
|
| ------------------------------- | ----------------------------- | -------------- |
|
|
@@ -162,16 +164,30 @@ The CLI runs the same patch flow without an AI session: `npx nitm-ai-dev-toolkit
|
|
|
162
164
|
|
|
163
165
|
[No action needed]
|
|
164
166
|
|
|
165
|
-
### 🔧
|
|
167
|
+
### 🔧 Needs Review (X files; locally changed or undecided; not written)
|
|
166
168
|
|
|
167
169
|
| File | Template Changes | Project Customizations | Merge Strategy |
|
|
168
170
|
| ----------- | ----------------- | ---------------------------- | -------------- |
|
|
169
171
|
| `AGENTS.md` | New section added | Has project-specific content | Manual merge |
|
|
170
172
|
|
|
173
|
+
### 🚫 Not Relevant or Retired (X files; not written)
|
|
174
|
+
|
|
175
|
+
| File | Reason | Action |
|
|
176
|
+
| -------------------------------------- | ----------------------------------- | ----------------------------------- |
|
|
177
|
+
| `.claude/commands/playwright-test.md` | No Playwright setup detected | Keep out; retire if present (approval) |
|
|
178
|
+
| `.agents/skills/linear-cli/SKILL.md` | Project tracker is GitHub | Retire in `.nitm/retired.json` |
|
|
179
|
+
|
|
180
|
+
### 🩹 Harness Wrappers to Review (X files; proposals only)
|
|
181
|
+
|
|
182
|
+
| Wrapper | Finding | Proposal |
|
|
183
|
+
| --------------------------- | ------------------------------------ | ----------------------------------------- |
|
|
184
|
+
| `.claude/rules/api-server.md` | Policy text outside the snippet link | Move the text into its snippet; keep a thin link |
|
|
185
|
+
|
|
171
186
|
### Summary
|
|
172
187
|
|
|
173
|
-
- **Auto-apply**: X
|
|
174
|
-
- **Review needed**: Z
|
|
188
|
+
- **Auto-apply**: X add + Y update entries, as printed by `patch`
|
|
189
|
+
- **Review needed**: Z needs-review files and W wrapper proposals
|
|
190
|
+
- **Not written**: N not-relevant or retired entries
|
|
175
191
|
- **No action**: W files already current
|
|
176
192
|
```
|
|
177
193
|
|
|
@@ -179,9 +195,9 @@ The CLI runs the same patch flow without an AI session: `npx nitm-ai-dev-toolkit
|
|
|
179
195
|
- If `--dry-run` flag: Output the report without making changes
|
|
180
196
|
- Otherwise: Present the report and ask the user to confirm with (Y/n)
|
|
181
197
|
- On confirmation:
|
|
182
|
-
a. **
|
|
183
|
-
b. **
|
|
184
|
-
c. **
|
|
198
|
+
a. **Add and update**: run `npx nitm-ai-dev-toolkit patch`. It writes only the add and update entries it printed; do not copy template files by hand
|
|
199
|
+
b. **Retirements**: after approval, record each path in `.nitm/retired.json` with a reason and date. Do not delete files to retire them
|
|
200
|
+
c. **Needs review**: propose a merge per file (structural additions, preserved project values) and apply it only after the operator approves that file. Wrappers that inline policy: propose moving the content into the snippet and reducing the wrapper to a thin link (see Thin Wrapper Policy in `bootstrap.md`)
|
|
185
201
|
d. **OpenCode plugins**: Apply only the approved obsolete Ponytail cleanup above after backing up the known obsolete toolkit copies and local config; preserve all unrelated local/global plugins. Never add Ponytail to project config.
|
|
186
202
|
e. **Toolkit version**: Keep the `.toolkit-version` value the CLI writes for the verified target version (the installed package version, 4.0.0 or later; never hard-coded) only after the approved migration and OpenCode preflight pass (or OpenCode is confirmed out of scope).
|
|
187
203
|
f. **Git commit**: Stage and commit all changes with message:
|
|
@@ -104,7 +104,7 @@ For each file: read → extract body after frontmatter → write to snippet dest
|
|
|
104
104
|
|
|
105
105
|
**Parallelizable**: Process rules, commands, and agents independently.
|
|
106
106
|
|
|
107
|
-
Replace each file's body with a wrapper that preserves frontmatter and references the snippet:
|
|
107
|
+
Replace each file's body with a thin wrapper (see Thin Wrapper Policy in `bootstrap.md`) that preserves frontmatter and references the snippet. Move any policy text into the snippet first; the wrapper keeps only the link, a title and at most five key points:
|
|
108
108
|
|
|
109
109
|
| File Type | Frontmatter to Keep | Reference Line |
|
|
110
110
|
| --------------------------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
@@ -188,7 +188,7 @@ For the v3 route, merge only relevant native OpenCode host fields; preserve exis
|
|
|
188
188
|
- Back up the local config and known obsolete toolkit-owned `.opencode/plugins/ponytail.js`, `.opencode/plugins/ponytail.mjs`, and `.opencode/plugins/ponytail.ts` copies; obtain approval before removing only those copies. Preserve unrelated local plugins.
|
|
189
189
|
- The OpenCode Ponytail plugin (`@dietrichgebert/ponytail`) is installed globally by the operator. Never add or pin it in the local `plugins` array. Check whether it is installed globally; if not, tell the operator to install it globally. Do not edit global config or overwrite global plugins. Keep `opentmux` commented as V1-only; do not copy local Ponytail source, port APIs, or introduce bridges. Runtime integration remains untested.
|
|
190
190
|
|
|
191
|
-
3. **Create wrappers with explicit snippet-read instructions** — one file per snippet:
|
|
191
|
+
3. **Create wrappers with explicit snippet-read instructions** — only for entries the patch plan classifies *add* (never retired or not-relevant snippets), each one thin (see Thin Wrapper Policy in `bootstrap.md`), one file per snippet:
|
|
192
192
|
|
|
193
193
|
| Directory | Source Snippets | Wrapper Body |
|
|
194
194
|
| ------------------------- | -------------------------- | ------------------------------------ |
|
|
@@ -210,12 +210,13 @@ For the v3 route, merge only relevant native OpenCode host fields; preserve exis
|
|
|
210
210
|
|
|
211
211
|
### 8. Install Pre-Commit Hook
|
|
212
212
|
|
|
213
|
-
Install the CHANGELOG/secrets enforcement hook
|
|
213
|
+
Install the CHANGELOG/secrets enforcement hook before every commit, only with the operator's approval, only in a git repository, and never over an existing `.git/hooks/pre-commit`. If one exists, show the difference and propose chaining or merging instead:
|
|
214
214
|
|
|
215
215
|
1. Copy `scripts/pre-commit-check.sh` from the template to the target project's `scripts/` directory
|
|
216
216
|
2. Install as a git hook:
|
|
217
217
|
|
|
218
218
|
```bash
|
|
219
|
+
# only when .git/hooks/pre-commit does not exist yet
|
|
219
220
|
cp scripts/pre-commit-check.sh .git/hooks/pre-commit
|
|
220
221
|
chmod +x .git/hooks/pre-commit
|
|
221
222
|
```
|
|
@@ -228,10 +229,12 @@ This enforces:
|
|
|
228
229
|
|
|
229
230
|
Use `git commit --no-verify` to bypass.
|
|
230
231
|
|
|
231
|
-
### 9. Install Project Hooks
|
|
232
|
+
### 9. Install Project Hooks (only with approval)
|
|
232
233
|
|
|
233
|
-
|
|
234
|
-
|
|
234
|
+
The `hooks/` files are Claude Code plugin hooks (`${CLAUDE_PLUGIN_ROOT}`) and the Ponytail runtime. They fire only when installed through the Ponytail plugin, not from project settings. Copy only the files the operator approves for a project that uses that plugin, and never overwrite an existing hook file.
|
|
235
|
+
|
|
236
|
+
1. Create `hooks/` in the target project when copying
|
|
237
|
+
2. Copy the approved files from the template's `hooks/*` directory (preserve sub-structure); skip any file that already exists
|
|
235
238
|
3. Make `.js` files executable on Unix: `chmod +x hooks/*.js`
|
|
236
239
|
|
|
237
240
|
### 10. Clean Up Duplicate Skills
|