@bonesofspring/ai-rules 0.2.51 → 0.2.52
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 +68 -0
- package/bin/cli.js +14 -1
- package/bin/lib/ai-local-drift.js +55 -14
- package/bin/lib/seed-ai-local-team.js +18 -7
- package/bin/mavis-install.js +2 -0
- package/bin/opencode-install.js +2 -0
- package/docs/LOCAL-OVERLAY.md +1 -1
- package/docs/PRESET-CONTRIBUTION.md +11 -9
- package/package.json +5 -1
- package/presets/_shared/ai-local/scripts/manifest.mjs +13 -3
- package/presets/_shared/ai-local/scripts/rule-improver.mjs +428 -91
- package/presets/_shared/ai-local/scripts/run.mjs +22 -4
- package/presets/_shared/ai-local/scripts/signals.mjs +4 -1
- package/presets/_shared/core/meta/preset-pr-checklist.md +1 -1
- package/presets/_shared/core/quality/interactive-questions.md +8 -8
- package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/android-kotlin/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/go/agents/code-reviewer.md +1 -0
- package/presets/claude/go/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/go/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/ios-swift/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/post-change-build.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/java/agents/code-reviewer.md +1 -0
- package/presets/claude/java/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/java/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/mcp-ts/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/mcp-ts/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/next/MCP.md +7 -0
- package/presets/claude/next/README.md +1 -1
- package/presets/claude/next/REPO_AGENTS.md +1 -1
- package/presets/claude/next/agents/README.md +3 -3
- package/presets/claude/next/agents/build-verifier.md +9 -3
- package/presets/claude/next/agents/code-reviewer.md +2 -1
- package/presets/claude/next/agents/codebase-analyzer.md +1 -1
- package/presets/claude/next/agents/feature-developer.md +18 -8
- package/presets/claude/next/agents/openspec-author.md +1 -1
- package/presets/claude/next/agents/playwright-test-generator.md +22 -68
- package/presets/claude/next/agents/playwright-test-healer.md +27 -54
- package/presets/claude/next/agents/playwright-test-planner.md +18 -51
- package/presets/claude/next/agents/task-analyst.md +25 -9
- package/presets/claude/next/agents/task-router.md +1 -1
- package/presets/claude/next/agents/tech-writer.md +1 -1
- package/presets/claude/next/mcp.json +3 -3
- package/presets/claude/next/rules/anti-hallucination/react-next-anti-hallucination.md +1 -1
- package/presets/claude/next/rules/architecture/layer-barrel-exports.md +1 -1
- package/presets/claude/next/rules/architecture/reference-features.md +1 -1
- package/presets/claude/next/rules/stack/navigation-router-ui.md +1 -1
- package/presets/claude/next/rules/stack/navigation-router.md +14 -0
- package/presets/claude/next/rules/stack/next-app-core.md +19 -17
- package/presets/claude/next/rules/stack/next-app-router.md +5 -17
- package/presets/claude/next/rules/stack/next-static-export.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/next/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/post-change-lint.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/preset-token-budget.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/security-next.md +28 -3
- package/presets/claude/next/rules/ui-and-accessibility/css-property-order.md +1 -1
- package/presets/claude/next/rules/ui-and-accessibility/design-tokens-binding.md +4 -4
- package/presets/claude/next/rules/ui-and-accessibility/forms-validation.md +2 -2
- package/presets/claude/next/team/README.md +11 -0
- package/presets/claude/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/claude/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/claude/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/claude/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/claude/nuxt/agents/code-reviewer.md +1 -0
- package/presets/claude/nuxt/rules/architecture/layer-barrel-exports.md +1 -1
- package/presets/claude/nuxt/rules/stack/navigation-router-ui.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/nuxt/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/post-change-lint.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/php-hexagonal/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/php-laravel/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/claude/svelte/agents/code-reviewer.md +1 -0
- package/presets/claude/svelte/rules/architecture/layer-barrel-exports.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/interactive-questions.md +8 -8
- package/presets/claude/svelte/rules/tooling-and-review/language-policy.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/post-change-lint.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/preset-pr-checklist.md +1 -1
- package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/cursor/android-kotlin/rules/README.md +1 -0
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +3 -3
- package/presets/cursor/android-kotlin/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/android-kotlin/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/go/agents/code-reviewer.md +1 -0
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/go/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/go/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/cursor/ios-swift/rules/README.md +1 -0
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +3 -3
- package/presets/cursor/ios-swift/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/ios-swift/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/java/agents/code-reviewer.md +1 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/java/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/java/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/mcp-ts/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/mcp-ts/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/next/MCP.md +7 -0
- package/presets/cursor/next/REPO_AGENTS.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +1 -0
- package/presets/cursor/next/agents/playwright-test-healer.md +1 -0
- package/presets/cursor/next/ai-local/rules-library/router-pages.md +5 -5
- package/presets/cursor/next/mcp.json +3 -3
- package/presets/cursor/next/rules/README.md +1 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/rules/css-property-order-stylelint.mdc +1 -1
- package/presets/cursor/next/rules/design-tokens-binding.mdc +4 -4
- package/presets/cursor/next/rules/forms-validation.mdc +2 -2
- package/presets/cursor/next/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/next/rules/navigation-router-stack.mdc +14 -1
- package/presets/cursor/next/rules/next-app-core.mdc +19 -17
- package/presets/cursor/next/rules/next-app-router.mdc +5 -17
- package/presets/cursor/next/rules/next-static-export.mdc +1 -1
- package/presets/cursor/next/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/next/rules/preset-token-budget.mdc +1 -1
- package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +1 -1
- package/presets/cursor/next/rules/reference-features.mdc +1 -1
- package/presets/cursor/next/rules/security-next.mdc +28 -3
- package/presets/cursor/next/team/README.md +11 -0
- package/presets/cursor/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/cursor/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/cursor/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/cursor/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/cursor/nuxt/agents/code-reviewer.md +1 -0
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/nuxt/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/nuxt/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/php-hexagonal/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/php-hexagonal/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +2 -2
- package/presets/cursor/php-laravel/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/php-laravel/rules/preset-pr-checklist.mdc +1 -1
- package/presets/cursor/svelte/agents/code-reviewer.md +1 -0
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/rules/interactive-questions.mdc +8 -8
- package/presets/cursor/svelte/rules/preset-pr-checklist.mdc +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/mavis/android-kotlin/rules/interactive-questions.md +8 -8
- package/presets/mavis/android-kotlin/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/agents/code-reviewer.md +1 -0
- package/presets/mavis/go/rules/interactive-questions.md +8 -8
- package/presets/mavis/go/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/mavis/ios-swift/rules/interactive-questions.md +8 -8
- package/presets/mavis/ios-swift/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/agents/code-reviewer.md +1 -0
- package/presets/mavis/java/rules/interactive-questions.md +8 -8
- package/presets/mavis/java/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/rules/interactive-questions.md +8 -8
- package/presets/mavis/mcp-ts/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/next/MCP.md +7 -0
- package/presets/mavis/next/REPO_AGENTS.md +1 -1
- package/presets/mavis/next/adapter-map.json +1 -1
- package/presets/mavis/next/agents/code-reviewer.md +1 -0
- package/presets/mavis/next/agents/playwright-test-healer.md +1 -0
- package/presets/mavis/next/ai-local/rules-library/router-pages.md +5 -5
- package/presets/mavis/next/mcp.json +3 -3
- package/presets/mavis/next/rules/css-property-order-stylelint.md +1 -1
- package/presets/mavis/next/rules/design-tokens-binding.md +4 -4
- package/presets/mavis/next/rules/forms-validation.md +2 -2
- package/presets/mavis/next/rules/interactive-questions.md +8 -8
- package/presets/mavis/next/rules/navigation-router-stack.md +12 -0
- package/presets/mavis/next/rules/next-app-core.md +18 -17
- package/presets/mavis/next/rules/next-app-router.md +4 -17
- package/presets/mavis/next/rules/next-static-export.md +1 -1
- package/presets/mavis/next/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/next/rules/react-next-anti-hallucination.md +1 -1
- package/presets/mavis/next/rules/reference-features.md +1 -1
- package/presets/mavis/next/rules/security-next.md +24 -3
- package/presets/mavis/next/team/README.md +11 -0
- package/presets/mavis/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/mavis/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/mavis/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/mavis/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/code-reviewer.md +1 -0
- package/presets/mavis/nuxt/rules/interactive-questions.md +8 -8
- package/presets/mavis/nuxt/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/mavis/php-hexagonal/rules/interactive-questions.md +8 -8
- package/presets/mavis/php-hexagonal/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/mavis/php-laravel/rules/interactive-questions.md +8 -8
- package/presets/mavis/php-laravel/rules/preset-pr-checklist.md +1 -1
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/code-reviewer.md +1 -0
- package/presets/mavis/svelte/rules/interactive-questions.md +8 -8
- package/presets/mavis/svelte/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -0
- package/presets/opencode/android-kotlin/rules/interactive-questions.md +8 -8
- package/presets/opencode/android-kotlin/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/code-reviewer.md +1 -0
- package/presets/opencode/go/rules/interactive-questions.md +8 -8
- package/presets/opencode/go/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -0
- package/presets/opencode/ios-swift/rules/interactive-questions.md +8 -8
- package/presets/opencode/ios-swift/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/code-reviewer.md +1 -0
- package/presets/opencode/java/rules/interactive-questions.md +8 -8
- package/presets/opencode/java/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/rules/interactive-questions.md +8 -8
- package/presets/opencode/mcp-ts/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/next/MCP.md +7 -0
- package/presets/opencode/next/REPO_AGENTS.md +1 -1
- package/presets/opencode/next/adapter-map.json +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +1 -0
- package/presets/opencode/next/agents/playwright-test-healer.md +1 -0
- package/presets/opencode/next/ai-local/rules-library/router-pages.md +5 -5
- package/presets/opencode/next/opencode.json +3 -3
- package/presets/opencode/next/rules/css-property-order-stylelint.md +1 -1
- package/presets/opencode/next/rules/design-tokens-binding.md +4 -4
- package/presets/opencode/next/rules/forms-validation.md +2 -2
- package/presets/opencode/next/rules/interactive-questions.md +8 -8
- package/presets/opencode/next/rules/navigation-router-stack.md +12 -0
- package/presets/opencode/next/rules/next-app-core.md +18 -17
- package/presets/opencode/next/rules/next-app-router.md +4 -17
- package/presets/opencode/next/rules/next-static-export.md +1 -1
- package/presets/opencode/next/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/next/rules/react-next-anti-hallucination.md +1 -1
- package/presets/opencode/next/rules/reference-features.md +1 -1
- package/presets/opencode/next/rules/security-next.md +24 -3
- package/presets/opencode/next/team/README.md +11 -0
- package/presets/opencode/next/team/fixtures/feature-with-figma-url.json +10 -0
- package/presets/opencode/next/team/fixtures/feature-with-ux-no-figma.json +10 -0
- package/presets/opencode/next/team/fixtures/mockup-review-standalone.json +9 -0
- package/presets/opencode/next/team/fixtures/ux-design-standalone.json +9 -0
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +1 -0
- package/presets/opencode/nuxt/rules/interactive-questions.md +8 -8
- package/presets/opencode/nuxt/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -0
- package/presets/opencode/php-hexagonal/rules/interactive-questions.md +8 -8
- package/presets/opencode/php-hexagonal/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -0
- package/presets/opencode/php-laravel/rules/interactive-questions.md +8 -8
- package/presets/opencode/php-laravel/rules/preset-pr-checklist.md +1 -1
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +1 -0
- package/presets/opencode/svelte/rules/interactive-questions.md +8 -8
- package/presets/opencode/svelte/rules/preset-pr-checklist.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.52
|
|
4
|
+
|
|
5
|
+
### The `next` preset catches up with Next 16 and its own gates
|
|
6
|
+
|
|
7
|
+
- **`proxy.ts` and lowercase auth/session files.** `security-next` attaches on `**/auth*.{ts,tsx}`, `**/session*.{ts,tsx}`, `app/**/proxy.ts`, and `app/src/**/proxy*.{ts,tsx}`; its prose states that a token refresh may live in `middleware` / `proxy`, that neither is an authorisation boundary, and that a layout-only check is not one either. `next-static-export` and both anti-hallucination banlists list `proxy.ts`.
|
|
8
|
+
- **Pages Router work loads the routing rule.** `navigation-router-stack` attaches on `app/src/pages/**/*`; the `router-pages` seed now points at `app/src/pages`, `app/src/ui/pages`, and `app/src/app`.
|
|
9
|
+
- **Correct env advice.** `next-app-core` states that `NEXT_PUBLIC_*` in `.env*` is inlined at build, that `next.config.*` `env` is optional, and that Server Components may read server-only env while Client Components never read `process.env`. The rule is compressed to keep the attached-budget headroom; the per-layer detail stays in `architecture-boundaries`.
|
|
10
|
+
- **Metadata is server-only.** `next-app-router` states that `export const metadata` cannot live in a `'use client'` file and belongs in a server `layout.tsx` / `page.tsx` or a wrapper; the example no longer contradicts the prose.
|
|
11
|
+
- **Claude agent parity is a gate.** The six `next` Claude agents (`playwright-test-healer`, `playwright-test-generator`, `playwright-test-planner`, `feature-developer`, `build-verifier`, `task-analyst`) are refreshed from their Cursor bodies; `test.fixme()` is gone, the blanket "do not ask" becomes the `interactive-questions` policy, Playwright output follows `app/__tests__/e2e/**` + `*.cases.md`, and the implementation rail, preset DoD, and decomposition template sections are back. `check-claude-agent-parity.mjs` ratchets every agent pair against `scripts/_lib/claude-agent-parity-baseline.json`; `task-router` and the other unrefreshed pairs are recorded at their current divergence.
|
|
12
|
+
- **Claude `model` aliases.** The six cheap agents pin `haiku`; the agent README documents per-invocation `model` → frontmatter → `CLAUDE_CODE_SUBAGENT_MODEL` → parent.
|
|
13
|
+
- **Generated Claude output is consumer-correct.** The Claude generator rewrites `.cursor/` globs, mapped `.mdc` references in descriptions and bodies, and the narrow `.cursor/rules` / `.cursor/team` body tokens; `check-consumer-links.mjs` fails when committed Claude rules or agents carry a `.cursor/` path or a resolvable `.mdc` reference, with a line-hash allowlist for the two legitimate lines.
|
|
14
|
+
- **MCP pins.** `@upstash/context7-mcp`, `@playwright/mcp`, and `chrome-devtools-mcp` are refreshed from the registry; `MCP.md` documents the pin policy.
|
|
15
|
+
- **Eval coverage.** `eval/next/manifest.json` registers `next-app-core`, `next-app-router`, and `navigation-router-stack`, with Incorrect/Correct pairs for the env, proxy/metadata, Pages-vs-App, and proxy surfaces.
|
|
16
|
+
- **Docs.** Both session-start lists name all four stems, `check-rule-eval` is described as a hard gate inside `check:preset-structure`, `reference-features` drops the source-only links, and the stack notes in `forms-validation`, `design-tokens-binding`, and `css-property-order-stylelint` are conditional on the repo stack.
|
|
17
|
+
- **Fixtures.** The team `pipeline.json` example and four fixtures carry `profile` + `routingDecision`.
|
|
18
|
+
|
|
19
|
+
### The self-learning cap holds across runs
|
|
20
|
+
|
|
21
|
+
- **One auto-apply per task slug.** A later run reads `conventions-added` rows and will not auto-apply another signature for a slug that already spent its apply. Rollback frees the slug. Unload does not.
|
|
22
|
+
- **High severity without a path stays visible.** The lesson gate still refuses a conventions bullet and a seed. A high-severity pending lesson appends `action: "pending-lesson"` to `rule-changes.jsonl`. A low-severity pending lesson stays in the report only.
|
|
23
|
+
- **A crashed write is not an applied row.** The file is renamed before the ledger line. A kill between them leaves an `.intent` sidecar; the next run finishes the ledger row or drops the intent. `*.intent` is in the seeded `.ai.local/.gitignore`, and an existing ignore file gains any missing required line.
|
|
24
|
+
- **Nested overlay targets use one root.** Ledger paths and lesson paths resolve against the same root: the git root when `.git` is found, otherwise the overlay parent.
|
|
25
|
+
|
|
26
|
+
### A nested overlay keeps its own project root
|
|
27
|
+
|
|
28
|
+
- **Two roots, one job each.** The **project root** (the directory that holds `.ai.local/`) owns lesson paths, script names and file I/O. The **repo root** (git) owns the ledger's `target`, which is stored repo-relative so the committed file carries no machine path. A nested overlay (`packages/foo/.ai.local/`) resolves `app/src` against `packages/foo/`, not against the git root — the previous single root made the lesson gate fail there and the loop never auto-applied.
|
|
29
|
+
- **A legacy row rolls back the file it wrote.** A ledger row written before the split carries a project-relative `target`; it now resolves against the project root when that is where the file lives, instead of writing to a path outside the overlay.
|
|
30
|
+
- **A spent slug is not freed by a later row.** Every `conventions-added` row for a signature contributes its slugs; a later row for the same signature cannot hand back a slug an earlier row spent. A `rollback` frees exactly the slugs it names.
|
|
31
|
+
- **`run.mjs --status` never throws.** An unreadable rule degrades the envelope to `unreadable` and the report still prints; the engine keeps failing closed.
|
|
32
|
+
- **`rollbackInverse` reconciles a pending commit.** A leftover `.intent` sidecar from a killed run is finished or dropped before the rollback writes, instead of being overwritten.
|
|
33
|
+
- **`yarn test:ai-local` runs on every runtime.** A small runner enumerates `.ai.local/scripts/*.test.mjs` and hands an explicit file list to `node --test`; `node --test <dir>` is a glob on Node 22+ and fails with `MODULE_NOT_FOUND`, and a shell glob needs a POSIX shell. CI calls the same runner.
|
|
34
|
+
|
|
35
|
+
### Gates that fail on the case they were written for
|
|
36
|
+
|
|
37
|
+
- **Twin drift detects a one-sided rewrite after a mirrored change.** The ratchet compares the twins' difference, not two absolute snapshots, so a mirrored edit no longer makes the detector blind to the next one-sided edit. A baseline without its hash rows is a failure, not a silent downgrade.
|
|
38
|
+
- **`--update` cannot widen the twin-drift baseline by accident.** Raising an allowance needs `--update --widen`; dropping an orphan row needs `--update --prune`. A plain `--update` refuses both and leaves the file untouched. The ratchet now records the **divergence** between the twins, not two absolute snapshots, so a one-sided rewrite is caught even after a mirrored change.
|
|
39
|
+
- **The self-review tail is bounded by the section, not the paragraph.** Prose moved one blank line down is still caught; a tail in a later `## ` section is out of scope by design.
|
|
40
|
+
- **Release consistency compares semver.** `1.0.0-rc.10` above `1.0.0-rc.2` and `alpha-2` above `alpha-1` are valid changelogs and pass; a heading that looks like a version but is not one is reported.
|
|
41
|
+
- **The attached-budget caps bind.** The four new fixtures are calibrated to the measured totals plus the script's own headroom margin instead of a flat 400.
|
|
42
|
+
- **The Cursor family is checked for the shared contract.** Every adapter of a shared stem must carry the stem's required sentences — a platform whose adapter is not a byte-embed of the core cannot be covered by a body diff, so the normative fragments are pinned separately. A Cursor adapter can no longer silently lose shared-core prose.
|
|
43
|
+
- **The owning-agent roster cannot shrink silently.** A prompt that still carries the receipt-binding callout while its agent left the roster is a failure.
|
|
44
|
+
|
|
45
|
+
### Drift classification
|
|
46
|
+
|
|
47
|
+
- **`--check` prints rels and writes nothing.** `init` and `update` accept it. `clean --merge-ai-local` and `clean --check` exit 1.
|
|
48
|
+
- **A recreated file is not "edited locally".** When another tool's init creates a file that was missing, the record takes that tool as the owner. `team/**` stays on the previous owner because the seed refreshes it every run.
|
|
49
|
+
- **A corrupt template record is not an empty base.** Unreadable `.template-base.json` skips the merge and warns, instead of resetting the base.
|
|
50
|
+
|
|
51
|
+
### Upgrade
|
|
52
|
+
|
|
53
|
+
- Run `npx @bonesofspring/ai-rules update`. The installed `next` rules, Claude agents, team fixtures, generated Mavis/OpenCode trees, and MCP config are managed and refresh from the preset; `update` keeps each tool's recorded preset.
|
|
54
|
+
- MCP pins move to `@upstash/context7-mcp@4.5.0`, `@playwright/mcp@0.0.84`, and `chrome-devtools-mcp@1.12.0`. The merge keeps extra local servers; user-level MCP is untouched.
|
|
55
|
+
- The `router-pages` seed stays staged-inactive in `.ai.local/rules-library/`. If it is already active in `.ai.local/rules/router-pages.md`, update that consumer-owned copy manually — `init` / `update` do not overwrite `.ai.local/rules/**`.
|
|
56
|
+
- No `.ai.local` migration and no task-artifact change: `init` / `update` still never overwrite `tasks/<slug>/`. The new `check-claude-agent-parity` and `check-consumer-links` gates are preset-maintenance checks; consumer installs do not run them.
|
|
57
|
+
|
|
3
58
|
## 0.2.51
|
|
4
59
|
|
|
5
60
|
### A shared `.ai.local/` rel is counted once
|
|
@@ -50,6 +105,19 @@
|
|
|
50
105
|
- The hook side (`<platform>/hooks/chain-team-phases.sh`) is managed, so `update` replaces it; an entry whose `status` was written as a receipt outcome now stalls with the rewrite command instead of a generic missing receipt.
|
|
51
106
|
- `update --merge-ai-local` fast-forwards a file whose recorded base still matches. It does not refresh a pre-record engine script; delete that script to take the seeded copy.
|
|
52
107
|
|
|
108
|
+
### A fresh install ignores the template record
|
|
109
|
+
|
|
110
|
+
- **`.template-base.json`.** The seeded `.ai.local/.gitignore` lists it, so the install record does not show up as an untracked file on every release.
|
|
111
|
+
|
|
112
|
+
### Interactive questions follow the host schema
|
|
113
|
+
|
|
114
|
+
- **No shared numeric limits.** Header length, option-label length, and option count are whatever the host schema allows. The shared rule no longer states OpenCode's 30 characters / 2–5 options, which Claude Code rejects (`header` ≤12, options 2–4).
|
|
115
|
+
- **Free-form is the host's channel.** When the host already accepts typed text, do not add an option labeled "Other": a plain option returns its label. A host with no free-form channel still needs an explicit "Other" that opens a text prompt, or prose.
|
|
116
|
+
|
|
117
|
+
### Cursor resume of an interrupted producer
|
|
118
|
+
|
|
119
|
+
- **Same sentence as the other hosts.** Each Cursor `agent-team-orchestrator` adapter now says an interrupted producer is resumed, not restarted, and that a host which writes no `status.json` resumes from `artifact-manifest.json` plus `.memlog.md`.
|
|
120
|
+
|
|
53
121
|
## 0.2.50
|
|
54
122
|
|
|
55
123
|
`0.2.49` was never published (no tag, no npm version) — its notes ship as `0.2.50`.
|
package/bin/cli.js
CHANGED
|
@@ -86,13 +86,14 @@ function printHelp() {
|
|
|
86
86
|
Usage:
|
|
87
87
|
ai-rules init <cursor|claude|mavis|opencode|multi> [--preset <name>]
|
|
88
88
|
ai-rules init <cursor|claude|mavis|opencode|multi> <preset-name>
|
|
89
|
-
ai-rules update [--merge-ai-local] [--cwd <dir>]
|
|
89
|
+
ai-rules update [--merge-ai-local | --check] [--cwd <dir>]
|
|
90
90
|
ai-rules clean <cursor|claude|mavis|opencode> [--cwd <dir>]
|
|
91
91
|
|
|
92
92
|
Options:
|
|
93
93
|
--preset <name> Preset name (default: ${DEFAULT_PRESET})
|
|
94
94
|
--cwd <dir> Target project directory (default: current working directory)
|
|
95
95
|
--merge-ai-local Fast-forward .ai.local/ files whose recorded base still matches
|
|
96
|
+
--check Print each .ai.local/ drift rel and write nothing
|
|
96
97
|
the preset template; a file you edited is kept and its diff is
|
|
97
98
|
written to .ai.local/.rollback/template-drift/
|
|
98
99
|
|
|
@@ -218,6 +219,10 @@ function parseArgs(argv) {
|
|
|
218
219
|
args.mergeAiLocal = true;
|
|
219
220
|
continue;
|
|
220
221
|
}
|
|
222
|
+
if (a === '--check') {
|
|
223
|
+
args.checkAiLocal = true;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
221
226
|
if (a.startsWith('-') && a !== '-') {
|
|
222
227
|
args.unknownOption = a;
|
|
223
228
|
continue;
|
|
@@ -807,6 +812,7 @@ function cmdUpdate(cwdOption, opts) {
|
|
|
807
812
|
|
|
808
813
|
function cmdInit(tool, preset, cwdOption, opts) {
|
|
809
814
|
const mergeAiLocal = Boolean(opts && opts.mergeAiLocal);
|
|
815
|
+
const checkAiLocal = Boolean(opts && opts.checkAiLocal);
|
|
810
816
|
const deferSummary = Boolean(opts && opts.deferAiLocalSummary);
|
|
811
817
|
if (tool === 'mavis') {
|
|
812
818
|
cmdInitMavis({
|
|
@@ -820,6 +826,7 @@ function cmdInit(tool, preset, cwdOption, opts) {
|
|
|
820
826
|
installMcpJson,
|
|
821
827
|
getPackageRoot,
|
|
822
828
|
mergeAiLocal,
|
|
829
|
+
checkAiLocal,
|
|
823
830
|
},
|
|
824
831
|
});
|
|
825
832
|
if (!deferSummary) flushAiLocalDriftSummary(resolveTargetCwd(cwdOption));
|
|
@@ -836,6 +843,7 @@ function cmdInit(tool, preset, cwdOption, opts) {
|
|
|
836
843
|
seedAiLocalTeam,
|
|
837
844
|
getPackageRoot,
|
|
838
845
|
mergeAiLocal,
|
|
846
|
+
checkAiLocal,
|
|
839
847
|
},
|
|
840
848
|
});
|
|
841
849
|
if (!deferSummary) flushAiLocalDriftSummary(resolveTargetCwd(cwdOption));
|
|
@@ -936,6 +944,7 @@ function cmdInit(tool, preset, cwdOption, opts) {
|
|
|
936
944
|
source: `${tool}/${presetName}`,
|
|
937
945
|
packageVersion: getPackageVersion(packageRoot),
|
|
938
946
|
mergeAiLocal,
|
|
947
|
+
checkAiLocal,
|
|
939
948
|
writeFile: (dest, content, label) => tx.writeFile(dest, content, label),
|
|
940
949
|
trackFile: (dest, label) => tx.track(dest, label),
|
|
941
950
|
});
|
|
@@ -1178,6 +1187,10 @@ function main() {
|
|
|
1178
1187
|
return;
|
|
1179
1188
|
}
|
|
1180
1189
|
if (command === 'clean') {
|
|
1190
|
+
if (parsed.mergeAiLocal || parsed.checkAiLocal) {
|
|
1191
|
+
console.error('--merge-ai-local and --check apply to init and update.');
|
|
1192
|
+
process.exit(1);
|
|
1193
|
+
}
|
|
1181
1194
|
if (tool === 'multi') {
|
|
1182
1195
|
console.error('clean multi is not supported. Clean each tool: cursor, claude, mavis, opencode.');
|
|
1183
1196
|
process.exit(1);
|
|
@@ -127,11 +127,18 @@ function decide({ consumer, base, template, source }) {
|
|
|
127
127
|
* detected instead of silently rewritten as v1.
|
|
128
128
|
*/
|
|
129
129
|
function readRecord(recordPath) {
|
|
130
|
+
let raw;
|
|
131
|
+
try {
|
|
132
|
+
raw = fs.readFileSync(recordPath, 'utf8');
|
|
133
|
+
} catch (error) {
|
|
134
|
+
if (error && error.code === 'ENOENT') return null;
|
|
135
|
+
return { unreadable: true, error: error && error.message ? error.message : 'unreadable' };
|
|
136
|
+
}
|
|
130
137
|
let parsed;
|
|
131
138
|
try {
|
|
132
|
-
parsed = JSON.parse(
|
|
133
|
-
} catch {
|
|
134
|
-
return
|
|
139
|
+
parsed = JSON.parse(raw);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
return { unreadable: true, error: error && error.message ? error.message : 'invalid JSON' };
|
|
135
142
|
}
|
|
136
143
|
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
137
144
|
return null;
|
|
@@ -167,9 +174,9 @@ function sortKeys(object) {
|
|
|
167
174
|
}
|
|
168
175
|
|
|
169
176
|
/**
|
|
170
|
-
* Merge the rels the seed just wrote into the previous record.
|
|
171
|
-
*
|
|
172
|
-
*
|
|
177
|
+
* Merge the rels the seed just wrote into the previous record. Attribution
|
|
178
|
+
* follows the first tool that wrote the file. A later tool's bytes do not
|
|
179
|
+
* replace that base: `source` and the stored digests stay put.
|
|
173
180
|
*
|
|
174
181
|
* @param {{ previous?: { files: Record<string, BaseEntry> } | null, packageVersion: string, source: string, written: Array<{ rel: string } & Digest> }} input
|
|
175
182
|
*/
|
|
@@ -181,6 +188,17 @@ function buildRecord({ previous, packageVersion, source, written }) {
|
|
|
181
188
|
}
|
|
182
189
|
for (const item of written) {
|
|
183
190
|
const prior = files[item.rel];
|
|
191
|
+
// A second tool may re-seed a missing file. Those bytes stay off this
|
|
192
|
+
// record so they cannot become the owning tool's base without a drift row.
|
|
193
|
+
if (prior && prior.source !== source) {
|
|
194
|
+
// team/** is refreshed every run. Everything else in `written` was
|
|
195
|
+
// created because the destination was absent, so these bytes belong
|
|
196
|
+
// to this tool. Leaving the old source would call that recreate an edit.
|
|
197
|
+
if (!item.rel.startsWith('.ai.local/team/')) {
|
|
198
|
+
files[item.rel] = { sha256: item.sha256, normSha256: item.normSha256, source };
|
|
199
|
+
}
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
184
202
|
files[item.rel] = {
|
|
185
203
|
sha256: item.sha256,
|
|
186
204
|
normSha256: item.normSha256,
|
|
@@ -223,8 +241,16 @@ function collectOutcomes({ cwd, record, templates, source }) {
|
|
|
223
241
|
return rows;
|
|
224
242
|
}
|
|
225
243
|
|
|
226
|
-
/**
|
|
244
|
+
/**
|
|
245
|
+
* Injective sink name. `/` becomes `__` and `_` becomes `_u`, so `a/b` and
|
|
246
|
+
* `a__b` do not share a file. Callers append `.diff` / `.template-new`.
|
|
247
|
+
*/
|
|
227
248
|
function sinkEntryName(rel) {
|
|
249
|
+
return rel.replace(/[_/]/g, (char) => (char === '/' ? '__' : '_u'));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Name written before the encoding distinguished `_` from `/`. */
|
|
253
|
+
function legacySinkEntryName(rel) {
|
|
228
254
|
return rel.replace(/\//g, '__');
|
|
229
255
|
}
|
|
230
256
|
|
|
@@ -394,12 +420,16 @@ function actionableOutcomes(cwd, outcomes) {
|
|
|
394
420
|
*/
|
|
395
421
|
function clearSink(cwd, rels, trackFile) {
|
|
396
422
|
for (const rel of rels) {
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
423
|
+
const names = [sinkEntryName(rel)];
|
|
424
|
+
const legacy = legacySinkEntryName(rel);
|
|
425
|
+
if (legacy !== names[0]) names.push(legacy);
|
|
426
|
+
for (const name of names) {
|
|
427
|
+
for (const suffix of ['.diff', '.template-new']) {
|
|
428
|
+
const dest = path.join(cwd, SINK_REL, `${name}${suffix}`);
|
|
429
|
+
if (!fs.existsSync(dest)) continue;
|
|
430
|
+
if (trackFile) trackFile(dest, path.join(SINK_REL, `${name}${suffix}`));
|
|
431
|
+
fs.rmSync(dest, { force: true });
|
|
432
|
+
}
|
|
403
433
|
}
|
|
404
434
|
}
|
|
405
435
|
}
|
|
@@ -574,7 +604,7 @@ function flushAllAiLocalDriftSummaries() {
|
|
|
574
604
|
* record write goes through the caller's transaction writer, so a later failure
|
|
575
605
|
* removes it again.
|
|
576
606
|
*/
|
|
577
|
-
function runTemplateDrift({ cwd, written, templates, source, packageVersion, mergeAiLocal, writeFile, trackFile }) {
|
|
607
|
+
function runTemplateDrift({ cwd, written, templates, source, packageVersion, mergeAiLocal, checkAiLocal, writeFile, trackFile }) {
|
|
578
608
|
if (!writeFile || !source || !templates) {
|
|
579
609
|
return;
|
|
580
610
|
}
|
|
@@ -591,6 +621,10 @@ function runTemplateDrift({ cwd, written, templates, source, packageVersion, mer
|
|
|
591
621
|
}
|
|
592
622
|
|
|
593
623
|
const previous = readRecord(recordPath);
|
|
624
|
+
if (previous && previous.unreadable) {
|
|
625
|
+
warn(`${RECORD_REL} is unreadable (${previous.error}); skipped .ai.local template record and merge`);
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
594
628
|
if (previous && previous.schemaVersion > RECORD_SCHEMA_VERSION) {
|
|
595
629
|
warn(
|
|
596
630
|
`${RECORD_REL} declares schemaVersion ${previous.schemaVersion}, newer than this CLI `
|
|
@@ -608,6 +642,13 @@ function runTemplateDrift({ cwd, written, templates, source, packageVersion, mer
|
|
|
608
642
|
const record = buildRecord({ previous, packageVersion, source, written: seedWritten });
|
|
609
643
|
|
|
610
644
|
const outcomes = collectOutcomes({ cwd, record, templates: templateMap, source });
|
|
645
|
+
if (checkAiLocal) {
|
|
646
|
+
for (const row of outcomes) {
|
|
647
|
+
if (row.outcome === 'noop') continue;
|
|
648
|
+
console.log(`check ${row.outcome} ${row.rel}`);
|
|
649
|
+
}
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
611
652
|
// One rel, one count, one proposal. A later pass adopts the rel when its
|
|
612
653
|
// template already matches, and does not add the file again.
|
|
613
654
|
const { rows: actionable, adoptUpgrades } = actionableOutcomes(cwd, outcomes);
|
|
@@ -21,6 +21,8 @@ const AI_LOCAL_GITIGNORE = [
|
|
|
21
21
|
'*.lock',
|
|
22
22
|
'*.tmp',
|
|
23
23
|
'.rollback/',
|
|
24
|
+
'.template-base.json',
|
|
25
|
+
'*.intent',
|
|
24
26
|
'',
|
|
25
27
|
].join('\n');
|
|
26
28
|
const POINTER_README = `# Agent team artifacts moved
|
|
@@ -232,15 +234,23 @@ function ensureRollbackIgnored(rollbackRoot) {
|
|
|
232
234
|
* scripts (`*.lock`, `*.tmp`) and the migration backups (`.rollback/`). A
|
|
233
235
|
* `.gitignore` inside `.ai.local/` is used instead of appending to the
|
|
234
236
|
* consumer's root `.gitignore`: the CLI never edits that file, and this works
|
|
235
|
-
* even in a repo that has no `.gitignore` at all.
|
|
237
|
+
* even in a repo that has no `.gitignore` at all. An existing file keeps its
|
|
238
|
+
* own lines; missing required lines are appended.
|
|
236
239
|
*/
|
|
237
240
|
function ensureAiLocalIgnored(aiLocalRoot) {
|
|
238
241
|
const ignoreFile = path.join(aiLocalRoot, '.gitignore');
|
|
239
|
-
if (fs.existsSync(ignoreFile)) {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
242
|
fs.mkdirSync(aiLocalRoot, { recursive: true });
|
|
243
|
-
|
|
243
|
+
const required = AI_LOCAL_GITIGNORE.split('\n').filter((line) => line !== '' && !line.startsWith('#'));
|
|
244
|
+
if (!fs.existsSync(ignoreFile)) {
|
|
245
|
+
fs.writeFileSync(ignoreFile, AI_LOCAL_GITIGNORE);
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
const current = fs.readFileSync(ignoreFile, 'utf8');
|
|
249
|
+
const present = new Set(current.split('\n').map((line) => line.trim()).filter(Boolean));
|
|
250
|
+
const missing = required.filter((line) => !present.has(line));
|
|
251
|
+
if (missing.length === 0) return false;
|
|
252
|
+
const suffix = current.endsWith('\n') || current.length === 0 ? '' : '\n';
|
|
253
|
+
fs.writeFileSync(ignoreFile, `${current}${suffix}${missing.join('\n')}\n`);
|
|
244
254
|
return true;
|
|
245
255
|
}
|
|
246
256
|
|
|
@@ -670,7 +680,7 @@ function templateEntries(presetTeamSrc) {
|
|
|
670
680
|
* already existed, never a consumer-modified file).
|
|
671
681
|
* @returns {{ created: boolean, createdPaths: string[], migrated: boolean, refreshed: boolean, conventionsSeeded: boolean, rulesLibrarySeeded: boolean, engineSeeded: boolean }}
|
|
672
682
|
*/
|
|
673
|
-
function seedAiLocalTeam({ cwd, presetTeamSrc, source, packageVersion, mergeAiLocal, writeFile, trackFile }) {
|
|
683
|
+
function seedAiLocalTeam({ cwd, presetTeamSrc, source, packageVersion, mergeAiLocal, checkAiLocal, writeFile, trackFile }) {
|
|
674
684
|
const dest = destTeamRoot(cwd);
|
|
675
685
|
const aiLocalRoot = path.join(cwd, '.ai.local');
|
|
676
686
|
const empty = {
|
|
@@ -745,6 +755,7 @@ function seedAiLocalTeam({ cwd, presetTeamSrc, source, packageVersion, mergeAiLo
|
|
|
745
755
|
source,
|
|
746
756
|
packageVersion,
|
|
747
757
|
mergeAiLocal,
|
|
758
|
+
checkAiLocal,
|
|
748
759
|
writeFile,
|
|
749
760
|
trackFile,
|
|
750
761
|
});
|
|
@@ -794,4 +805,4 @@ function seedAiLocalTeam({ cwd, presetTeamSrc, source, packageVersion, mergeAiLo
|
|
|
794
805
|
};
|
|
795
806
|
}
|
|
796
807
|
|
|
797
|
-
module.exports = { seedAiLocalTeam, destTeamRoot };
|
|
808
|
+
module.exports = { seedAiLocalTeam, destTeamRoot, ensureAiLocalIgnored };
|
package/bin/mavis-install.js
CHANGED
|
@@ -161,6 +161,7 @@ function cmdInitMavis({ preset, cwdOption, helpers }) {
|
|
|
161
161
|
installMcpJson,
|
|
162
162
|
getPackageRoot,
|
|
163
163
|
mergeAiLocal,
|
|
164
|
+
checkAiLocal,
|
|
164
165
|
} = helpers;
|
|
165
166
|
const packageRoot = getPackageRoot();
|
|
166
167
|
const cwd = resolveTargetCwd(cwdOption);
|
|
@@ -254,6 +255,7 @@ function cmdInitMavis({ preset, cwdOption, helpers }) {
|
|
|
254
255
|
source: `mavis/${stack}`,
|
|
255
256
|
packageVersion: packageVersion(packageRoot),
|
|
256
257
|
mergeAiLocal: Boolean(mergeAiLocal),
|
|
258
|
+
checkAiLocal: Boolean(checkAiLocal),
|
|
257
259
|
writeFile: (dest, content, label) => tx.writeFile(dest, content, label),
|
|
258
260
|
trackFile: (dest, label) => tx.track(dest, label),
|
|
259
261
|
});
|
package/bin/opencode-install.js
CHANGED
|
@@ -344,6 +344,7 @@ function cmdInitOpencode({ preset, cwdOption, helpers }) {
|
|
|
344
344
|
seedAiLocalTeam,
|
|
345
345
|
getPackageRoot,
|
|
346
346
|
mergeAiLocal,
|
|
347
|
+
checkAiLocal,
|
|
347
348
|
} = helpers;
|
|
348
349
|
const packageRoot = getPackageRoot();
|
|
349
350
|
const cwd = resolveTargetCwd(cwdOption);
|
|
@@ -433,6 +434,7 @@ function cmdInitOpencode({ preset, cwdOption, helpers }) {
|
|
|
433
434
|
source: `opencode/${stack}`,
|
|
434
435
|
packageVersion: packageVersion(packageRoot),
|
|
435
436
|
mergeAiLocal: Boolean(mergeAiLocal),
|
|
437
|
+
checkAiLocal: Boolean(checkAiLocal),
|
|
436
438
|
writeFile: (dest, content, label) => tx.writeFile(dest, content, label),
|
|
437
439
|
trackFile: (dest, label) => tx.track(dest, label),
|
|
438
440
|
});
|
package/docs/LOCAL-OVERLAY.md
CHANGED
|
@@ -111,7 +111,7 @@ Recording is deliberately conservative: a file whose bytes differ from the curre
|
|
|
111
111
|
- **Both sides changed.** The sink shows the diff; resolution is yours.
|
|
112
112
|
- **`override: kill` and `i18n-keep` disagreements.** A fast-forward copies the preset file whole, so it can neither move nor duplicate a marker — and a disagreement is reported rather than resolved.
|
|
113
113
|
- **`.ai.local/team/**`, `.ai.local/requirements/**`, `.ai.local/adr/**`, engine runtime state.** Out of scope by allowlist. `team/README.md` and `team/fixtures/**` are refreshed by the seed on every run before any comparison, so edit them and your edit is gone — they are seed-owned, not drift-tracked, and never reported.
|
|
114
|
-
- **A file you deleted
|
|
114
|
+
- **A file you deleted.** The next `init` or `update` copies it again when the destination is absent: `conventions.md`, a file under `rules/`, and a file under `rules-library/`. `team/tasks/**` is not re-seeded. A rel the owning preset no longer ships loses its record entry and its proposal on the next flagged run, so the record does not accumulate dead keys.
|
|
115
115
|
- **A record written by a newer CLI.** A `schemaVersion` above this CLI's own makes it skip the record and the merge with a warning rather than rewrite the file as v1.
|
|
116
116
|
- **An activated seed** (`rules-library/X.md` → `rules/X.md`). Activation stays a judgement call; the pair is not auto-merged.
|
|
117
117
|
- **Three-way merge.** Not implemented: without a stored copy of the old preset bytes a line merge would invent conflicts inside files that load on every turn.
|
|
@@ -19,7 +19,7 @@ Every preset artifact belongs to one of these layers. Do not mix semantics acros
|
|
|
19
19
|
| Layer | Path | What belongs here |
|
|
20
20
|
|-------|------|-------------------|
|
|
21
21
|
| **Core** | `presets/_shared/core/**` | Stack-agnostic prose and checklists. No Cursor/Claude frontmatter. No stack paths (`app/src/**`, `Features/**`, Playwright, `xcodebuild`). |
|
|
22
|
-
| **Stack** | `presets/{cursor\|claude}/<stack>/` | Domain rules, stack always-on
|
|
22
|
+
| **Stack** | `presets/{cursor\|claude}/<stack>/` | Domain rules, stack always-on set, stack tooling, stack examples in a delimited `## Stack notes` section. |
|
|
23
23
|
| **Platform** | Same stack tree | Adapter packaging: Cursor `.mdc` (`alwaysApply` / `globs`) vs Claude `.md` (`paths:`). Platform-only files (`BUGBOT.md`, `AGENTS.md`, `CLAUDE.md`, `hooks.json`). |
|
|
24
24
|
|
|
25
25
|
```text
|
|
@@ -169,7 +169,7 @@ Summary:
|
|
|
169
169
|
- [ ] Embed drift: `scripts/check-shared-core-drift.sh` after core/embed edits
|
|
170
170
|
- [ ] Anti-hallucination: `check-anti-hallucination-coverage.mjs` passes. New skill families are registered in `SKILL_CONTRACT_CLASS` (`writer` loads the stack floor; `reader` loads the contract only). `code-review` is `writer`.
|
|
171
171
|
- [ ] Structure gates: `yarn check:preset-structure` (or `bash scripts/check-preset-structure.sh`) passes
|
|
172
|
-
- [ ] Twin drift: after editing a Claude `commands/**` or `skills/**` file, `node scripts/check-preset-twin-drift.mjs` passes — mirror the change in the Cursor twin (delta unchanged) or record a deliberate divergence with `--update`
|
|
172
|
+
- [ ] Twin drift: after editing a Claude `commands/**` or `skills/**` file, `node scripts/check-preset-twin-drift.mjs` passes — mirror the change in the Cursor twin (delta and divergence unchanged) or record a deliberate divergence with `--update`. A deliberate divergence that **raises** an allowance needs `--update --widen`; dropping a baseline row needs `--update --prune`. A plain `--update` refuses both.
|
|
173
173
|
- [ ] Generated trees regenerated (`generate-mavis.mjs` + `generate-opencode.mjs`) and CLI goldens recaptured (`capture-cli-golden.mjs`) after any preset-installed file changes
|
|
174
174
|
|
|
175
175
|
Validation: `yarn check:preset-structure` + the `preset-pr-checklist` rule; CI workflow `preset-structure.yml` (`check`, `hooks`, `ai-local-engine-tests`).
|
|
@@ -271,7 +271,7 @@ Distinct CLI ids; neither renames nor replaces the other. Comparison prose in st
|
|
|
271
271
|
Recent additions: **`android-kotlin`** (scaffolded from `ios-swift` agent-team + `java` CA/Gradle patterns; instrumentation-test trio; vendor-neutral placeholders); **`php-hexagonal`** (scaffolded from `java`, Composer/PHPUnit gates; dogfood `dogfood/php-hexagonal`); **`php-laravel`** (scaffolded from `php-hexagonal`, Laravel-first rules; dogfood `dogfood/php-laravel` — full `laravel/framework`).
|
|
272
272
|
|
|
273
273
|
1. **Copy structure** from the closest existing stack (flat Cursor `rules/*.mdc`, Claude topic folders). For PHP/Go backends, start from `java` or `go` skeleton and rewrite Stack notes / tooling.
|
|
274
|
-
2. **Define always-on set** (Cursor/Claude 3–10 — extra slots reserved for `ai-local-overlay`) — stack-specific cores plus `ai-local-overlay` on Cursor. Embed shared quality from `_shared/core` where applicable. `go` uses `go-app-core`, `architecture-boundaries`, `code-quality-and-refactoring`, `ai-local-overlay`.
|
|
274
|
+
2. **Define always-on set** (Cursor/Claude 3–10 — extra slots reserved for `ai-local-overlay`) — stack-specific cores plus `ai-local-overlay` on both Cursor and Claude. Embed shared quality from `_shared/core` where applicable. `go` uses `go-app-core`, `architecture-boundaries`, `code-quality-and-refactoring`, `ai-local-overlay`.
|
|
275
275
|
3. **Stack-specific rules** — domain, tooling, post-change gate, agents/skills with stack-appropriate names (no Playwright stems on iOS/go, no XCUITest stems on Next/go, no xcodebuild/ESLint as required handoffs on go, etc.).
|
|
276
276
|
4. **Embed core** — add `<!-- shared-core: … -->` adapters for shared stems; fill `## Stack notes` with stack examples only in adapters (Go: hexagonal layers; Android: Activity/Compose paths).
|
|
277
277
|
5. **Claude twin** — create topic `.md` files + **Cursor→Claude mapping table** in `claude/<stack>/rules/README.md`. `go` ships `ui-and-accessibility/README.md` as N/A stub only.
|
|
@@ -309,7 +309,7 @@ impact: HIGH # CRITICAL | HIGH | MEDIUM | LOW
|
|
|
309
309
|
- Claude twins: **mirror the same `impact:` key/value** in YAML frontmatter (with `paths:`).
|
|
310
310
|
- **Do not** use a body `## Impact` block — frontmatter only.
|
|
311
311
|
- **Forbidden** in `_shared/core/**` (core has no frontmatter).
|
|
312
|
-
- Structure scripts ignore unknown YAML keys; `check:preset-structure` does **not** require `impact`.
|
|
312
|
+
- Structure scripts ignore unknown YAML keys; `check:preset-structure` does **not** require `impact`. `yarn check:rule-eval` requires it for registered golden stems.
|
|
313
313
|
|
|
314
314
|
---
|
|
315
315
|
|
|
@@ -396,20 +396,22 @@ Load these when editing files under `packages/ai-rules/presets/**`, `.cursor/**`
|
|
|
396
396
|
|--------------|---------|
|
|
397
397
|
| `yarn fix:generated` | Regenerate every released generated platform and recapture all required CLI goldens. Run after changing Cursor SoT, before fail-only checks. Dogfood sync remains separate. |
|
|
398
398
|
| `scripts/sync-dogfood-cursor.sh` | Copy `presets/cursor/<preset>/` → root `.cursor/` (`AI_RULES_DOGFOOD_PRESET`, default `next`). Also copies `REPO_AGENTS.md` → repo-root `AGENTS.md`. Seeds `.ai.local/team` templates; preserves `.ai.local/team/tasks/`. |
|
|
399
|
-
| `scripts/check-shared-core-drift.sh` / `yarn check:shared-core-drift` | Check embed-mode adapters vs core; lists lineage consumers. **Always hard:** every `_shared/core/**` file must be classified `embed | lineage | internal` in `_lib/embed-stems.json` (unclassified → exit 1). Drift is soft by default; set `AI_RULES_DRIFT_FAIL=1` (or use `check:preset-structure`) to exit non-zero. |
|
|
399
|
+
| `scripts/check-shared-core-drift.sh` / `yarn check:shared-core-drift` | Check embed-mode adapters vs core; lists lineage consumers. **Always hard:** every `_shared/core/**` file must be classified `embed | lineage | internal` in `_lib/embed-stems.json` (unclassified → exit 1). Drift is soft by default; set `AI_RULES_DRIFT_FAIL=1` (or use `check:preset-structure`) to exit non-zero. A stem listed in `requiredSentences` is checked in the core **and in every adapter of that stem, whatever the lineage class** — the body comparison cannot cover a platform whose adapter is not a byte-embed of the core (the Cursor family reorders, omits and adds sections), so the normative fragments of that stem are pinned separately. |
|
|
400
400
|
| `scripts/check-preset-twin-map.sh` / `yarn check:preset-twin-map` | **FAIL** if Cursor `.mdc` missing from Claude mapping table, twin file missing, or orphan topic `.md` (excl. `**/README.md`). Stacks: `next`, `nuxt`, `svelte`, `ios-swift`, `android-kotlin`, `go`, `java`, `mcp-ts`, `php-hexagonal`, `php-laravel`. **Rules only** — commands and skills are guarded by `check-preset-twin-drift.mjs`. |
|
|
401
|
-
| `scripts/check-preset-twin-drift.mjs` / `yarn check:preset-twin-drift` | **FAIL** when a hand-maintained Claude twin (`presets/claude/<stack>/{commands,skills}/**/*.md`) drifts further from its Cursor source than `scripts/_lib/claude-twin-drift-baseline.json` records, when a command/skill has no twin on the other side,
|
|
401
|
+
| `scripts/check-preset-twin-drift.mjs` / `yarn check:preset-twin-drift` | **FAIL** when a hand-maintained Claude twin (`presets/claude/<stack>/{commands,skills}/**/*.md`) drifts further from its Cursor source than `scripts/_lib/claude-twin-drift-baseline.json` records, when the recorded divergence between the twins changes while the line delta does not, when a command/skill has no twin on the other side, when a new pair has no baseline row, when a baseline row has no live pair, or when the baseline itself is missing its hash rows. Full parity is not required: mirror a change in both twins (delta and divergence unchanged) or record a deliberate divergence with `--update`. Raising an allowance needs `--update --widen`; dropping a row needs `--update --prune`. Fixture `test-preset-twin-drift.mjs`. |
|
|
402
|
+
| `scripts/check-claude-agent-parity.mjs` / `yarn check:claude-agent-parity` | **FAIL** when a hand-maintained Claude `agents/*.md` twin drifts from its Cursor source beyond `scripts/_lib/claude-agent-parity-baseline.json`: a grown or shrunk normalized line delta, a one-sided rewrite at an unchanged delta, a changed divergence hash, a missing twin, an unrecorded pair, an orphan row, or a pair in the static `parity` allowlist that is not at delta 0. Normalization masks packaging only — YAML frontmatter, the `## Rules to load (subagent context)` block, `<!-- shared-core -->` markers, the two anti-hallucination load lines, the `.cursor/` / `.claude/` root, and `.mdc` → `.md` — and reuses the twin-drift diff helpers. `--update` re-records deltas and hashes; `--widen` / `--prune` gate a raised allowance or a dropped row; `parity` is never edited by `--update`. Fixture `test-claude-agent-parity.mjs` proves one-sided Claude FAIL, one-sided Cursor FAIL and mirrored PASS. Wired into `check-preset-structure.sh` next to `claude-agent-blocks`. |
|
|
403
|
+
| `scripts/check-consumer-links.mjs` / `yarn check:consumer-links` | **FAIL** when a generated Claude rule or agent carries a source-only `.cursor/` path or a `.mdc` reference whose stem resolves through `claude/<stack>/rules/README.md`; `README.md` and `preset-*.md` are exempt by class. `scripts/_lib/claude-consumer-link-allowlist.json` records the legitimate lines one hash at a time; a stale row fails, and a planted line in an allowlisted file still fails unless it matches the recorded hash. `--update` re-hashes recorded rows only and refuses to add one. Scans `next` by default; `--stack` opts another stack in. Fixture `test-consumer-links.mjs`. Wired into `check-preset-structure.sh` next to `generated-drift`. |
|
|
402
404
|
| `scripts/check-preset-token-budget.sh` / `yarn check:preset-token-budget` | **FAIL** if Cursor `alwaysApply: true` or Claude no-`paths:` (excl. README) count is outside **3–10**, `preset-*` always-on, or intended body sum > **4000**. Stacks include `nuxt`, `svelte`. |
|
|
403
405
|
| `scripts/check-preset-leakage.sh` / `yarn check:preset-leakage` | **FAIL** on forbidden stems in `hooks/**/*.sh` (recursive), wrong-stack agent filenames, or **positive** (non-negation) agent body mentions; **FAIL** if chain scripts are byte-identical across stacks. Explicit **negation** of forbidden stems in agent bodies is **suppressed** (INFO summary count only — not a merge blocker). Non-negation mentions in `build-verifier` → **WARN only**. |
|
|
404
406
|
| `scripts/check-preset-prompt-persistence.sh` / `yarn check:preset-structure` | **FAIL** if the prompt-persistence contract (`prompt.md` + the append-only `prompt-log.md` ledger, both on the `routing` entry) is missing from any platform × stack command (`task.md` + `task-continue.md`), orchestrator, or intake body, from the **always-on** root `REPO_AGENTS.md` entry (check **E** — reachability without `/task`), or a core `agent-artifact-contracts` anchor (`## Prompt artifact` / `## Prompt log`) is gone; **refuses vacuous PASS** when the iteration set is empty. Wired into `check-preset-structure.sh` next to `goal-contract`; fixture `test-preset-prompt-persistence-fixtures.mjs`. |
|
|
405
407
|
| `scripts/check-preset-reachability.sh` / `yarn check:preset-reachability` | **FAIL** if a non-`preset-*` OpenCode/Mavis rule is reachable by neither a direct reference (entry / agent / command / skill) nor the transitive closure of rule→rule references from the `root-entry` rules. `preset-*` meta rules are exempt as preset-authoring-only. **Refuses vacuous PASS** on an empty iteration set. Wired into `check-preset-structure.sh` next to `prompt-persistence`. |
|
|
406
408
|
| `scripts/check-preset-language-policy.sh` / `yarn check:preset-structure` | **FAIL** if the native-language policy is absent: the core `_shared/core/agent-team/language-policy.md` tokens, the `language-policy` consumer + `<!-- shared-core -->` marker, the Cursor `globs:`/`alwaysApply: false` + Claude `paths:` shape, the `## Language` setting home (with a BCP-47 marker) in `ai-local/conventions.md`, the always-on anchors (`ai-local-overlay` + `<app-core>` + `REPO_AGENTS.md` must contain `native language` and `every user message`), or the `language:` persistence token in `commands/task.md`; **refuses vacuous PASS** when the iteration set is empty. Wired into `check-preset-structure.sh` next to `goal-contract` / `prompt-persistence`; fixture `test-preset-language-policy-fixtures.mjs`. |
|
|
407
|
-
| `scripts/check-preset-self-review-contract.sh` / `yarn check:preset-structure` | **FAIL** if the producer-side self-review / context-hygiene contract is absent: the core `_shared/core/quality/self-review-and-context-hygiene.md` tokens (G0 non-vacuous guard), the `<!-- shared-core: quality/self-review-and-context-hygiene.md -->` marker on `task-analyst` / `feature-developer` / `build-verifier` (×10) and on `debugger` / `code-reviewer` where present (skip-if-absent → `mcp-ts`), the `Self-review` + `re-anchor` tokens on every orchestrator rule, `Self-review` in `team/README.md` + `commands/task.md`, and leakage-free core + docs; **refuses vacuous PASS** when the iteration set is empty. Also holds two prose contracts: the canonical self-learning-loop sentence must not be followed by unsanctioned prose (an allowlist — a
|
|
409
|
+
| `scripts/check-preset-self-review-contract.sh` / `yarn check:preset-structure` | **FAIL** if the producer-side self-review / context-hygiene contract is absent: the core `_shared/core/quality/self-review-and-context-hygiene.md` tokens (G0 non-vacuous guard), the `<!-- shared-core: quality/self-review-and-context-hygiene.md -->` marker on `task-analyst` / `feature-developer` / `build-verifier` (×10) and on `debugger` / `code-reviewer` where present (skip-if-absent → `mcp-ts`), the `Self-review` + `re-anchor` tokens on every orchestrator rule, `Self-review` in `team/README.md` + `commands/task.md`, and leakage-free core + docs; **refuses vacuous PASS** when the iteration set is empty. Also holds two prose contracts: the canonical self-learning-loop sentence must not be followed by unsanctioned prose (an allowlist of sanctioned clauses; the tail is bounded by the carrier's **section**, not by a blank line, so prose moved one paragraph down still fails — a tail in a later `## ` section is out of scope), and every retro carrier (command, skill, rule) must state `finding_category`. Wired into `check-preset-structure.sh` next to `goal-contract`; fixture `test-preset-self-review-contract-fixtures.mjs`. |
|
|
408
410
|
| `scripts/check-anti-hallucination-coverage.mjs` | **FAIL** when the shared contract, a Cursor load-line embed, a writer stack floor, or a generated Rules-to-load stem is missing. Writer roles are `implementer`, `unit-test`, `e2e`, `qa`, and `reviewer` (`code-reviewer` loads `STACK_FLOOR_STEMS` plus the contract). `/task` and the orchestrator must not name a floor stem. Does not scan consumer `app/**` and does not call Context7. Fixture `test-anti-hallucination-coverage.mjs` deletes `anti-hallucination-contract` from `next.reviewer` in memory and expects FAIL mentioning `next` and `reviewer`. Wired into `check-preset-structure.sh` immediately after `check-claude-agent-blocks.mjs`. |
|
|
409
|
-
| `scripts/check-preset-structure.sh` / `yarn check:preset-structure` | Orchestrator: twin-map + token-budget + leakage + shared-core drift + anti-hallucination coverage (**all hard**; drift via `AI_RULES_DRIFT_FAIL=1`).
|
|
411
|
+
| `scripts/check-preset-structure.sh` / `yarn check:preset-structure` | Orchestrator: twin-map + token-budget + leakage + shared-core drift + anti-hallucination coverage + rule-eval (**all hard**; drift via `AI_RULES_DRIFT_FAIL=1`). |
|
|
410
412
|
| `scripts/check-product-specs.sh` / `yarn check:product-specs` | Opt-in consumer tree check: frontmatter v1 keys + required body headings on `docs/specs/**` (bash; does **not** run JSON Schema). Ships in the npm package `files` (`scripts/`). **WARN** by default; **`--strict`** exits non-zero. |
|
|
411
413
|
| `yarn check:product-specs:dogfood` | Same script against monorepo `dogfood/mcp-ts-sample`. Soft WARN inside `check:preset-structure` + CI step (`continue-on-error`); not a hard consumer CI gate. |
|
|
412
|
-
| `scripts/check-rule-eval.mjs` / `yarn check:rule-eval` |
|
|
414
|
+
| `scripts/check-rule-eval.mjs` / `yarn check:rule-eval` | **Hard gate** inside `check-preset-structure.sh`: validates Incorrect/Correct pairs + `impact:` on **next-only** golden stems (`eval/next/manifest.json`). Backend / ios / php-hexagonal / php-laravel stems are out of scope until a stack adds `eval/<stack>/`. |
|
|
413
415
|
| `scripts/check-release-consistency.mjs` / `yarn check:release-consistency` | **FAIL** when `packages/ai-rules/package.json` version and the newest `## <version>` heading in `CHANGELOG.md` disagree — a tag must not ship the previous release's notes. Wired into `check-preset-structure.sh`; fixture `test-release-consistency.mjs`. |
|
|
414
416
|
|
|
415
417
|
Run from `packages/ai-rules/`:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonesofspring/ai-rules",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.52",
|
|
4
4
|
"description": "Presets of Cursor, Claude, Mavis, and OpenCode rules/commands for Revy Ross personal use",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Revy Ross",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"check:step-graph-contract": "bash scripts/check-step-graph-contract.sh",
|
|
41
41
|
"test:parallel-plan-fixtures": "node scripts/test-parallel-plan-fixtures.mjs",
|
|
42
42
|
"check:claude-agent-blocks": "node scripts/check-claude-agent-blocks.mjs",
|
|
43
|
+
"check:claude-agent-parity": "node scripts/check-claude-agent-parity.mjs",
|
|
44
|
+
"test:claude-agent-parity": "node scripts/test-claude-agent-parity.mjs",
|
|
45
|
+
"check:consumer-links": "node scripts/check-consumer-links.mjs",
|
|
46
|
+
"test:consumer-links": "node scripts/test-consumer-links.mjs",
|
|
43
47
|
"check:preset-twin-map": "bash scripts/check-preset-twin-map.sh",
|
|
44
48
|
"check:preset-twin-drift": "node scripts/check-preset-twin-drift.mjs",
|
|
45
49
|
"test:twin-drift-fixtures": "node scripts/test-preset-twin-drift.mjs",
|
|
@@ -173,8 +173,17 @@ export function readManifest(slug, teamRoot = DEFAULT_TEAM_ROOT) {
|
|
|
173
173
|
/** Atomic whole-file write: temp file in the same directory, then rename. */
|
|
174
174
|
export function writeManifestSync(filePath, manifest) {
|
|
175
175
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
176
|
-
const temporary = `${filePath}.${process.pid}.tmp`;
|
|
177
|
-
fs.
|
|
176
|
+
const temporary = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
177
|
+
const fd = fs.openSync(temporary, 'w');
|
|
178
|
+
try {
|
|
179
|
+
fs.writeSync(fd, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
180
|
+
try { fs.fsyncSync(fd); } catch { /* a platform without fsync still renames the complete write */ }
|
|
181
|
+
} finally {
|
|
182
|
+
try { fs.closeSync(fd); } catch (error) {
|
|
183
|
+
try { fs.unlinkSync(temporary); } catch { /* the close error is the one to surface */ }
|
|
184
|
+
throw error;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
178
187
|
fs.renameSync(temporary, filePath);
|
|
179
188
|
}
|
|
180
189
|
|
|
@@ -288,8 +297,9 @@ export function validateManifest(manifest, slug) {
|
|
|
288
297
|
// A receipt outcome was written into `status`. Name the repair command:
|
|
289
298
|
// the writer cannot fix a foreign entry, so the owner must.
|
|
290
299
|
const expected = OUTCOME_STATUS[entry.status];
|
|
300
|
+
const producer = typeof entry.producer === 'string' && entry.producer !== '' ? entry.producer : '<missing>';
|
|
291
301
|
problems.push(
|
|
292
|
-
`${at}.status "${entry.status}" is a receipt outcome, not an artifact status. Rewrite the entry: "manifest.mjs upsert --slug ${slug} --id ${entry.id} --producer ${
|
|
302
|
+
`${at}.status "${entry.status}" is a receipt outcome, not an artifact status. Rewrite the entry: "manifest.mjs upsert --slug ${slug} --id ${entry.id} --producer ${producer} --status ${expected} --outcome ${entry.status} --paths <path>"`,
|
|
293
303
|
);
|
|
294
304
|
} else {
|
|
295
305
|
problems.push(`${at}.status must be one of ${ARTIFACT_STATUSES.join(' | ')}`);
|