@bonesofspring/ai-rules 0.2.37 → 0.2.39
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 +282 -1
- package/README.md +23 -2
- package/bin/cli.js +106 -1
- package/bin/lib/engine-scripts.js +22 -0
- package/bin/lib/fs-utils.js +78 -11
- package/bin/lib/merged-config.js +30 -16
- package/bin/lib/seed-ai-local-team.js +160 -12
- package/bin/opencode-install.js +37 -52
- package/docs/OPENCODE.md +4 -4
- package/docs/specs/INDEX.md +5 -2
- package/package.json +4 -1
- package/presets/_shared/ai-local/scripts/derive-gate-signals.mjs +171 -0
- package/presets/_shared/ai-local/scripts/efficacy-oracle.mjs +581 -0
- package/presets/_shared/ai-local/scripts/lock.mjs +146 -0
- package/presets/_shared/ai-local/scripts/rule-improver.mjs +795 -0
- package/presets/_shared/ai-local/scripts/run.mjs +318 -0
- package/presets/_shared/ai-local/scripts/signals.mjs +286 -0
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +1 -1
- package/presets/_shared/core/quality/self-review-and-context-hygiene.md +8 -7
- package/presets/_shared/hooks/README.md +5 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +111 -23
- package/presets/_shared/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/android-kotlin/CLAUDE.md +1 -1
- package/presets/claude/android-kotlin/REPO_AGENTS.md +14 -0
- package/presets/claude/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/claude/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/claude/android-kotlin/agents/debugger.md +1 -1
- package/presets/claude/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/commands/README.md +1 -0
- package/presets/claude/android-kotlin/commands/task-continue.md +9 -0
- package/presets/claude/android-kotlin/commands/technical-retro.md +8 -0
- package/presets/claude/android-kotlin/commands/update.md +39 -0
- package/presets/claude/android-kotlin/hooks/README.md +1 -0
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/android-kotlin/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/android-kotlin/hooks/examples/README.md +1 -1
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/android-kotlin/settings.json +14 -1
- package/presets/claude/android-kotlin/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/go/CLAUDE.md +1 -1
- package/presets/claude/go/REPO_AGENTS.md +14 -0
- package/presets/claude/go/agents/build-verifier.md +1 -1
- package/presets/claude/go/agents/code-reviewer.md +1 -1
- package/presets/claude/go/agents/debugger.md +1 -1
- package/presets/claude/go/agents/feature-developer.md +1 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/commands/README.md +1 -0
- package/presets/claude/go/commands/task-continue.md +9 -0
- package/presets/claude/go/commands/technical-retro.md +8 -0
- package/presets/claude/go/commands/update.md +39 -0
- package/presets/claude/go/hooks/README.md +1 -0
- package/presets/claude/go/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/go/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/go/hooks/examples/README.md +1 -1
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/go/settings.json +14 -1
- package/presets/claude/go/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/ios-swift/CLAUDE.md +1 -1
- package/presets/claude/ios-swift/REPO_AGENTS.md +14 -0
- package/presets/claude/ios-swift/agents/build-verifier.md +1 -1
- package/presets/claude/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/claude/ios-swift/agents/debugger.md +1 -1
- package/presets/claude/ios-swift/agents/feature-developer.md +1 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/commands/README.md +1 -0
- package/presets/claude/ios-swift/commands/task-continue.md +9 -0
- package/presets/claude/ios-swift/commands/technical-retro.md +8 -0
- package/presets/claude/ios-swift/commands/update.md +39 -0
- package/presets/claude/ios-swift/hooks/README.md +1 -0
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/ios-swift/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/ios-swift/hooks/examples/README.md +1 -1
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/ios-swift/settings.json +14 -1
- package/presets/claude/ios-swift/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/java/CLAUDE.md +2 -2
- package/presets/claude/java/REPO_AGENTS.md +14 -0
- package/presets/claude/java/agents/build-verifier.md +1 -1
- package/presets/claude/java/agents/code-reviewer.md +1 -1
- package/presets/claude/java/agents/debugger.md +1 -1
- package/presets/claude/java/agents/feature-developer.md +1 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/commands/README.md +1 -0
- package/presets/claude/java/commands/task-continue.md +9 -0
- package/presets/claude/java/commands/technical-retro.md +8 -0
- package/presets/claude/java/commands/update.md +39 -0
- package/presets/claude/java/hooks/README.md +1 -0
- package/presets/claude/java/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/java/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/java/hooks/examples/README.md +1 -1
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/java/settings.json +14 -1
- package/presets/claude/java/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/mcp-ts/CLAUDE.md +1 -1
- package/presets/claude/mcp-ts/REPO_AGENTS.md +14 -0
- package/presets/claude/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/claude/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/commands/README.md +1 -0
- package/presets/claude/mcp-ts/commands/task-continue.md +9 -0
- package/presets/claude/mcp-ts/commands/technical-retro.md +8 -0
- package/presets/claude/mcp-ts/commands/update.md +39 -0
- package/presets/claude/mcp-ts/hooks/README.md +1 -0
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/mcp-ts/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/mcp-ts/settings.json +14 -1
- package/presets/claude/next/CLAUDE.md +2 -1
- package/presets/claude/next/REPO_AGENTS.md +15 -1
- package/presets/claude/next/agents/build-verifier.md +1 -1
- package/presets/claude/next/agents/code-reviewer.md +1 -1
- package/presets/claude/next/agents/debugger.md +1 -1
- package/presets/claude/next/agents/feature-developer.md +1 -1
- package/presets/claude/next/agents/task-analyst.md +1 -1
- package/presets/claude/next/agents/task-router.md +1 -1
- package/presets/claude/next/commands/README.md +1 -0
- package/presets/claude/next/commands/task-continue.md +9 -0
- package/presets/claude/next/commands/technical-retro.md +8 -0
- package/presets/claude/next/commands/update.md +39 -0
- package/presets/claude/next/hooks/README.md +1 -0
- package/presets/claude/next/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/next/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/next/hooks/examples/README.md +1 -1
- package/presets/claude/next/rules/anti-hallucination/react-next-anti-hallucination.md +21 -18
- package/presets/claude/next/rules/stack/next-app-router.md +27 -0
- package/presets/claude/next/rules/stack/next-static-export.md +16 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/next/rules/tooling-and-review/security-next.md +16 -2
- package/presets/claude/next/rules/ui-and-accessibility/component-catalog-gate.md +13 -0
- package/presets/claude/next/rules/ui-and-accessibility/forms-validation.md +12 -0
- package/presets/claude/next/settings.json +13 -0
- package/presets/claude/next/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/next/team/fixtures/feature-light.json +2 -1
- package/presets/claude/next/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/claude/nuxt/CLAUDE.md +2 -1
- package/presets/claude/nuxt/REPO_AGENTS.md +14 -0
- package/presets/claude/nuxt/agents/build-verifier.md +1 -1
- package/presets/claude/nuxt/agents/code-reviewer.md +1 -1
- package/presets/claude/nuxt/agents/debugger.md +1 -1
- package/presets/claude/nuxt/agents/feature-developer.md +1 -1
- package/presets/claude/nuxt/agents/task-analyst.md +1 -1
- package/presets/claude/nuxt/commands/README.md +1 -0
- package/presets/claude/nuxt/commands/task-continue.md +9 -0
- package/presets/claude/nuxt/commands/technical-retro.md +8 -0
- package/presets/claude/nuxt/commands/update.md +39 -0
- package/presets/claude/nuxt/hooks/README.md +1 -0
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/nuxt/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/nuxt/hooks/examples/README.md +1 -1
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/nuxt/settings.json +13 -0
- package/presets/claude/nuxt/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/php-hexagonal/CLAUDE.md +2 -2
- package/presets/claude/php-hexagonal/REPO_AGENTS.md +14 -0
- package/presets/claude/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/claude/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/claude/php-hexagonal/agents/debugger.md +1 -1
- package/presets/claude/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/commands/README.md +1 -0
- package/presets/claude/php-hexagonal/commands/task-continue.md +9 -0
- package/presets/claude/php-hexagonal/commands/technical-retro.md +8 -0
- package/presets/claude/php-hexagonal/commands/update.md +39 -0
- package/presets/claude/php-hexagonal/hooks/README.md +1 -0
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/php-hexagonal/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/php-hexagonal/hooks/examples/README.md +1 -1
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/php-hexagonal/settings.json +14 -1
- package/presets/claude/php-hexagonal/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/php-laravel/CLAUDE.md +1 -1
- package/presets/claude/php-laravel/REPO_AGENTS.md +14 -0
- package/presets/claude/php-laravel/agents/build-verifier.md +1 -1
- package/presets/claude/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/claude/php-laravel/agents/debugger.md +1 -1
- package/presets/claude/php-laravel/agents/feature-developer.md +1 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/commands/README.md +1 -0
- package/presets/claude/php-laravel/commands/task-continue.md +9 -0
- package/presets/claude/php-laravel/commands/technical-retro.md +8 -0
- package/presets/claude/php-laravel/commands/update.md +39 -0
- package/presets/claude/php-laravel/hooks/README.md +1 -0
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/php-laravel/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/php-laravel/hooks/examples/README.md +1 -1
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/php-laravel/settings.json +14 -1
- package/presets/claude/php-laravel/skills/technical-retro/SKILL.md +2 -0
- package/presets/claude/svelte/CLAUDE.md +2 -1
- package/presets/claude/svelte/REPO_AGENTS.md +14 -0
- package/presets/claude/svelte/agents/build-verifier.md +1 -1
- package/presets/claude/svelte/agents/code-reviewer.md +1 -1
- package/presets/claude/svelte/agents/debugger.md +1 -1
- package/presets/claude/svelte/agents/feature-developer.md +1 -1
- package/presets/claude/svelte/agents/task-analyst.md +1 -1
- package/presets/claude/svelte/commands/README.md +1 -0
- package/presets/claude/svelte/commands/task-continue.md +9 -0
- package/presets/claude/svelte/commands/technical-retro.md +8 -0
- package/presets/claude/svelte/commands/update.md +39 -0
- package/presets/claude/svelte/hooks/README.md +1 -0
- package/presets/claude/svelte/hooks/chain-team-phases.sh +111 -23
- package/presets/claude/svelte/hooks/check-preset-update.mjs +227 -0
- package/presets/claude/svelte/hooks/examples/README.md +1 -1
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +1 -1
- package/presets/claude/svelte/settings.json +13 -0
- package/presets/claude/svelte/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/android-kotlin/AGENTS.md +1 -0
- package/presets/cursor/android-kotlin/REPO_AGENTS.md +14 -0
- package/presets/cursor/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/cursor/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/cursor/android-kotlin/agents/debugger.md +1 -1
- package/presets/cursor/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/cursor/android-kotlin/commands/README.md +1 -0
- package/presets/cursor/android-kotlin/commands/task-continue.md +9 -0
- package/presets/cursor/android-kotlin/commands/technical-retro.md +8 -0
- package/presets/cursor/android-kotlin/commands/update.md +39 -0
- package/presets/cursor/android-kotlin/hooks/README.md +5 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/android-kotlin/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/android-kotlin/hooks/examples/README.md +1 -1
- package/presets/cursor/android-kotlin/hooks.json +6 -0
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/android-kotlin/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/go/REPO_AGENTS.md +14 -0
- package/presets/cursor/go/agents/build-verifier.md +1 -1
- package/presets/cursor/go/agents/code-reviewer.md +1 -1
- package/presets/cursor/go/agents/debugger.md +1 -1
- package/presets/cursor/go/agents/feature-developer.md +1 -1
- package/presets/cursor/go/agents/task-analyst.md +1 -1
- package/presets/cursor/go/commands/README.md +1 -0
- package/presets/cursor/go/commands/task-continue.md +9 -0
- package/presets/cursor/go/commands/technical-retro.md +8 -0
- package/presets/cursor/go/commands/update.md +39 -0
- package/presets/cursor/go/hooks/README.md +5 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/go/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/go/hooks/examples/README.md +1 -1
- package/presets/cursor/go/hooks.json +6 -0
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/ios-swift/AGENTS.md +1 -0
- package/presets/cursor/ios-swift/REPO_AGENTS.md +14 -0
- package/presets/cursor/ios-swift/agents/build-verifier.md +1 -1
- package/presets/cursor/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/cursor/ios-swift/agents/debugger.md +1 -1
- package/presets/cursor/ios-swift/agents/feature-developer.md +1 -1
- package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
- package/presets/cursor/ios-swift/commands/README.md +1 -0
- package/presets/cursor/ios-swift/commands/task-continue.md +9 -0
- package/presets/cursor/ios-swift/commands/technical-retro.md +8 -0
- package/presets/cursor/ios-swift/commands/update.md +39 -0
- package/presets/cursor/ios-swift/hooks/README.md +5 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/ios-swift/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/ios-swift/hooks/examples/README.md +1 -1
- package/presets/cursor/ios-swift/hooks.json +6 -0
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/java/AGENTS.md +1 -1
- package/presets/cursor/java/REPO_AGENTS.md +14 -0
- package/presets/cursor/java/agents/build-verifier.md +1 -1
- package/presets/cursor/java/agents/code-reviewer.md +1 -1
- package/presets/cursor/java/agents/debugger.md +1 -1
- package/presets/cursor/java/agents/feature-developer.md +1 -1
- package/presets/cursor/java/agents/task-analyst.md +1 -1
- package/presets/cursor/java/commands/README.md +1 -0
- package/presets/cursor/java/commands/task-continue.md +9 -0
- package/presets/cursor/java/commands/technical-retro.md +8 -0
- package/presets/cursor/java/commands/update.md +39 -0
- package/presets/cursor/java/hooks/README.md +5 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/java/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/java/hooks/examples/README.md +1 -1
- package/presets/cursor/java/hooks.json +6 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/java/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/mcp-ts/REPO_AGENTS.md +14 -0
- package/presets/cursor/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/cursor/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/cursor/mcp-ts/commands/README.md +1 -0
- package/presets/cursor/mcp-ts/commands/task-continue.md +9 -0
- package/presets/cursor/mcp-ts/commands/technical-retro.md +8 -0
- package/presets/cursor/mcp-ts/commands/update.md +39 -0
- package/presets/cursor/mcp-ts/hooks/README.md +5 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/mcp-ts/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/mcp-ts/hooks.json +6 -0
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/AGENTS.md +1 -0
- package/presets/cursor/next/REPO_AGENTS.md +15 -1
- package/presets/cursor/next/agents/build-verifier.md +1 -1
- package/presets/cursor/next/agents/code-reviewer.md +1 -1
- package/presets/cursor/next/agents/debugger.md +1 -1
- package/presets/cursor/next/agents/feature-developer.md +1 -1
- package/presets/cursor/next/agents/task-analyst.md +1 -1
- package/presets/cursor/next/agents/task-router.md +1 -1
- package/presets/cursor/next/commands/README.md +1 -0
- package/presets/cursor/next/commands/task-continue.md +9 -0
- package/presets/cursor/next/commands/technical-retro.md +8 -0
- package/presets/cursor/next/commands/update.md +39 -0
- package/presets/cursor/next/hooks/README.md +6 -0
- package/presets/cursor/next/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/next/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/next/hooks/examples/README.md +1 -1
- package/presets/cursor/next/hooks.json +6 -0
- package/presets/cursor/next/rules/README.md +3 -1
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/rules/component-catalog-gate.mdc +13 -0
- package/presets/cursor/next/rules/forms-validation.mdc +12 -0
- package/presets/cursor/next/rules/next-app-router.mdc +27 -0
- package/presets/cursor/next/rules/next-static-export.mdc +16 -0
- package/presets/cursor/next/rules/react-next-anti-hallucination.mdc +21 -18
- package/presets/cursor/next/rules/security-next.mdc +16 -2
- package/presets/cursor/next/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/next/team/fixtures/feature-light.json +2 -1
- package/presets/cursor/next/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/cursor/nuxt/AGENTS.md +1 -0
- package/presets/cursor/nuxt/REPO_AGENTS.md +14 -0
- package/presets/cursor/nuxt/agents/build-verifier.md +1 -1
- package/presets/cursor/nuxt/agents/code-reviewer.md +1 -1
- package/presets/cursor/nuxt/agents/debugger.md +1 -1
- package/presets/cursor/nuxt/agents/feature-developer.md +1 -1
- package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
- package/presets/cursor/nuxt/commands/README.md +1 -0
- package/presets/cursor/nuxt/commands/task-continue.md +9 -0
- package/presets/cursor/nuxt/commands/technical-retro.md +8 -0
- package/presets/cursor/nuxt/commands/update.md +39 -0
- package/presets/cursor/nuxt/hooks/README.md +4 -0
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/nuxt/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/nuxt/hooks/examples/README.md +1 -1
- package/presets/cursor/nuxt/hooks.json +6 -0
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/nuxt/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/php-hexagonal/AGENTS.md +1 -1
- package/presets/cursor/php-hexagonal/REPO_AGENTS.md +14 -0
- package/presets/cursor/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/cursor/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/cursor/php-hexagonal/agents/debugger.md +1 -1
- package/presets/cursor/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/cursor/php-hexagonal/commands/README.md +1 -0
- package/presets/cursor/php-hexagonal/commands/task-continue.md +9 -0
- package/presets/cursor/php-hexagonal/commands/technical-retro.md +8 -0
- package/presets/cursor/php-hexagonal/commands/update.md +39 -0
- package/presets/cursor/php-hexagonal/hooks/README.md +5 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/php-hexagonal/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/php-hexagonal/hooks/examples/README.md +1 -1
- package/presets/cursor/php-hexagonal/hooks.json +6 -0
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-hexagonal/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/php-laravel/AGENTS.md +1 -1
- package/presets/cursor/php-laravel/REPO_AGENTS.md +14 -0
- package/presets/cursor/php-laravel/agents/build-verifier.md +1 -1
- package/presets/cursor/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/cursor/php-laravel/agents/debugger.md +1 -1
- package/presets/cursor/php-laravel/agents/feature-developer.md +1 -1
- package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
- package/presets/cursor/php-laravel/commands/README.md +1 -0
- package/presets/cursor/php-laravel/commands/task-continue.md +9 -0
- package/presets/cursor/php-laravel/commands/technical-retro.md +8 -0
- package/presets/cursor/php-laravel/commands/update.md +39 -0
- package/presets/cursor/php-laravel/hooks/README.md +5 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/php-laravel/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/php-laravel/hooks/examples/README.md +1 -1
- package/presets/cursor/php-laravel/hooks.json +6 -0
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-laravel/skills/technical-retro/SKILL.md +2 -0
- package/presets/cursor/svelte/AGENTS.md +1 -0
- package/presets/cursor/svelte/REPO_AGENTS.md +14 -0
- package/presets/cursor/svelte/agents/build-verifier.md +1 -1
- package/presets/cursor/svelte/agents/code-reviewer.md +1 -1
- package/presets/cursor/svelte/agents/debugger.md +1 -1
- package/presets/cursor/svelte/agents/feature-developer.md +1 -1
- package/presets/cursor/svelte/agents/task-analyst.md +1 -1
- package/presets/cursor/svelte/commands/README.md +1 -0
- package/presets/cursor/svelte/commands/task-continue.md +9 -0
- package/presets/cursor/svelte/commands/technical-retro.md +8 -0
- package/presets/cursor/svelte/commands/update.md +39 -0
- package/presets/cursor/svelte/hooks/README.md +4 -0
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +111 -23
- package/presets/cursor/svelte/hooks/check-preset-update.mjs +227 -0
- package/presets/cursor/svelte/hooks/examples/README.md +1 -1
- package/presets/cursor/svelte/hooks.json +6 -0
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/android-kotlin/MAVIS.md +1 -0
- package/presets/mavis/android-kotlin/REPO_AGENTS.md +14 -0
- package/presets/mavis/android-kotlin/adapter-map.json +17 -1
- package/presets/mavis/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/mavis/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/mavis/android-kotlin/agents/debugger.md +1 -1
- package/presets/mavis/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/mavis/android-kotlin/commands/README.md +1 -0
- package/presets/mavis/android-kotlin/commands/task-continue.md +9 -0
- package/presets/mavis/android-kotlin/commands/technical-retro.md +8 -0
- package/presets/mavis/android-kotlin/commands/update.md +34 -0
- package/presets/mavis/android-kotlin/hooks/README.md +3 -0
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/android-kotlin/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/android-kotlin/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/go/REPO_AGENTS.md +14 -0
- package/presets/mavis/go/adapter-map.json +17 -1
- package/presets/mavis/go/agents/build-verifier.md +1 -1
- package/presets/mavis/go/agents/code-reviewer.md +1 -1
- package/presets/mavis/go/agents/debugger.md +1 -1
- package/presets/mavis/go/agents/feature-developer.md +1 -1
- package/presets/mavis/go/agents/task-analyst.md +1 -1
- package/presets/mavis/go/commands/README.md +1 -0
- package/presets/mavis/go/commands/task-continue.md +9 -0
- package/presets/mavis/go/commands/technical-retro.md +8 -0
- package/presets/mavis/go/commands/update.md +34 -0
- package/presets/mavis/go/hooks/README.md +3 -0
- package/presets/mavis/go/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/go/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/go/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/ios-swift/MAVIS.md +1 -0
- package/presets/mavis/ios-swift/REPO_AGENTS.md +14 -0
- package/presets/mavis/ios-swift/adapter-map.json +17 -1
- package/presets/mavis/ios-swift/agents/build-verifier.md +1 -1
- package/presets/mavis/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/mavis/ios-swift/agents/debugger.md +1 -1
- package/presets/mavis/ios-swift/agents/feature-developer.md +1 -1
- package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
- package/presets/mavis/ios-swift/commands/README.md +1 -0
- package/presets/mavis/ios-swift/commands/task-continue.md +9 -0
- package/presets/mavis/ios-swift/commands/technical-retro.md +8 -0
- package/presets/mavis/ios-swift/commands/update.md +34 -0
- package/presets/mavis/ios-swift/hooks/README.md +3 -0
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/ios-swift/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/ios-swift/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/java/REPO_AGENTS.md +14 -0
- package/presets/mavis/java/adapter-map.json +17 -1
- package/presets/mavis/java/agents/build-verifier.md +1 -1
- package/presets/mavis/java/agents/code-reviewer.md +1 -1
- package/presets/mavis/java/agents/debugger.md +1 -1
- package/presets/mavis/java/agents/feature-developer.md +1 -1
- package/presets/mavis/java/agents/task-analyst.md +1 -1
- package/presets/mavis/java/commands/README.md +1 -0
- package/presets/mavis/java/commands/task-continue.md +9 -0
- package/presets/mavis/java/commands/technical-retro.md +8 -0
- package/presets/mavis/java/commands/update.md +34 -0
- package/presets/mavis/java/hooks/README.md +3 -0
- package/presets/mavis/java/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/java/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/java/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/mcp-ts/REPO_AGENTS.md +14 -0
- package/presets/mavis/mcp-ts/adapter-map.json +17 -1
- package/presets/mavis/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/mavis/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/mavis/mcp-ts/commands/README.md +1 -0
- package/presets/mavis/mcp-ts/commands/task-continue.md +9 -0
- package/presets/mavis/mcp-ts/commands/technical-retro.md +8 -0
- package/presets/mavis/mcp-ts/commands/update.md +34 -0
- package/presets/mavis/mcp-ts/hooks/README.md +3 -0
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/mcp-ts/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/next/MAVIS.md +1 -0
- package/presets/mavis/next/REPO_AGENTS.md +15 -1
- package/presets/mavis/next/adapter-map.json +25 -1
- package/presets/mavis/next/agents/build-verifier.md +1 -1
- package/presets/mavis/next/agents/code-reviewer.md +1 -1
- package/presets/mavis/next/agents/debugger.md +1 -1
- package/presets/mavis/next/agents/feature-developer.md +1 -1
- package/presets/mavis/next/agents/task-analyst.md +1 -1
- package/presets/mavis/next/agents/task-router.md +1 -1
- package/presets/mavis/next/commands/README.md +1 -0
- package/presets/mavis/next/commands/task-continue.md +9 -0
- package/presets/mavis/next/commands/technical-retro.md +8 -0
- package/presets/mavis/next/commands/update.md +34 -0
- package/presets/mavis/next/hooks/README.md +3 -0
- package/presets/mavis/next/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/next/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/next/rules/component-catalog-gate.md +13 -0
- package/presets/mavis/next/rules/forms-validation.md +12 -0
- package/presets/mavis/next/rules/next-app-router.md +27 -0
- package/presets/mavis/next/rules/next-static-export.md +16 -0
- package/presets/mavis/next/rules/react-next-anti-hallucination.md +20 -18
- package/presets/mavis/next/rules/security-next.md +13 -0
- package/presets/mavis/next/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/next/team/fixtures/feature-light.json +2 -1
- package/presets/mavis/next/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/mavis/nuxt/MAVIS.md +1 -0
- package/presets/mavis/nuxt/REPO_AGENTS.md +14 -0
- package/presets/mavis/nuxt/adapter-map.json +17 -1
- package/presets/mavis/nuxt/agents/build-verifier.md +1 -1
- package/presets/mavis/nuxt/agents/code-reviewer.md +1 -1
- package/presets/mavis/nuxt/agents/debugger.md +1 -1
- package/presets/mavis/nuxt/agents/feature-developer.md +1 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
- package/presets/mavis/nuxt/commands/README.md +1 -0
- package/presets/mavis/nuxt/commands/task-continue.md +9 -0
- package/presets/mavis/nuxt/commands/technical-retro.md +8 -0
- package/presets/mavis/nuxt/commands/update.md +34 -0
- package/presets/mavis/nuxt/hooks/README.md +3 -0
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/nuxt/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/nuxt/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/php-hexagonal/REPO_AGENTS.md +14 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +17 -1
- package/presets/mavis/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/mavis/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/mavis/php-hexagonal/agents/debugger.md +1 -1
- package/presets/mavis/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/mavis/php-hexagonal/commands/README.md +1 -0
- package/presets/mavis/php-hexagonal/commands/task-continue.md +9 -0
- package/presets/mavis/php-hexagonal/commands/technical-retro.md +8 -0
- package/presets/mavis/php-hexagonal/commands/update.md +34 -0
- package/presets/mavis/php-hexagonal/hooks/README.md +3 -0
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/php-hexagonal/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-hexagonal/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/php-laravel/REPO_AGENTS.md +14 -0
- package/presets/mavis/php-laravel/adapter-map.json +17 -1
- package/presets/mavis/php-laravel/agents/build-verifier.md +1 -1
- package/presets/mavis/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/mavis/php-laravel/agents/debugger.md +1 -1
- package/presets/mavis/php-laravel/agents/feature-developer.md +1 -1
- package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
- package/presets/mavis/php-laravel/commands/README.md +1 -0
- package/presets/mavis/php-laravel/commands/task-continue.md +9 -0
- package/presets/mavis/php-laravel/commands/technical-retro.md +8 -0
- package/presets/mavis/php-laravel/commands/update.md +34 -0
- package/presets/mavis/php-laravel/hooks/README.md +3 -0
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/php-laravel/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/php-laravel/skills/technical-retro/SKILL.md +2 -0
- package/presets/mavis/svelte/MAVIS.md +1 -0
- package/presets/mavis/svelte/REPO_AGENTS.md +14 -0
- package/presets/mavis/svelte/adapter-map.json +17 -1
- package/presets/mavis/svelte/agents/build-verifier.md +1 -1
- package/presets/mavis/svelte/agents/code-reviewer.md +1 -1
- package/presets/mavis/svelte/agents/debugger.md +1 -1
- package/presets/mavis/svelte/agents/feature-developer.md +1 -1
- package/presets/mavis/svelte/agents/task-analyst.md +1 -1
- package/presets/mavis/svelte/commands/README.md +1 -0
- package/presets/mavis/svelte/commands/task-continue.md +9 -0
- package/presets/mavis/svelte/commands/technical-retro.md +8 -0
- package/presets/mavis/svelte/commands/update.md +34 -0
- package/presets/mavis/svelte/hooks/README.md +3 -0
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +111 -23
- package/presets/mavis/svelte/hooks/check-preset-update.mjs +227 -0
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/mavis/svelte/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/android-kotlin/OPENCODE.md +15 -6
- package/presets/opencode/android-kotlin/REPO_AGENTS.md +14 -0
- package/presets/opencode/android-kotlin/adapter-map.json +17 -1
- package/presets/opencode/android-kotlin/agents/build-verifier.md +1 -1
- package/presets/opencode/android-kotlin/agents/code-reviewer.md +1 -1
- package/presets/opencode/android-kotlin/agents/debugger.md +1 -1
- package/presets/opencode/android-kotlin/agents/feature-developer.md +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/commands/README.md +1 -0
- package/presets/opencode/android-kotlin/commands/task-continue.md +9 -0
- package/presets/opencode/android-kotlin/commands/technical-retro.md +8 -0
- package/presets/opencode/android-kotlin/commands/update.md +42 -0
- package/presets/opencode/android-kotlin/hooks/README.md +3 -0
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/android-kotlin/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/android-kotlin/opencode.json +2 -12
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/android-kotlin/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/go/OPENCODE.md +14 -6
- package/presets/opencode/go/REPO_AGENTS.md +14 -0
- package/presets/opencode/go/adapter-map.json +17 -1
- package/presets/opencode/go/agents/build-verifier.md +1 -1
- package/presets/opencode/go/agents/code-reviewer.md +1 -1
- package/presets/opencode/go/agents/debugger.md +1 -1
- package/presets/opencode/go/agents/feature-developer.md +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/commands/README.md +1 -0
- package/presets/opencode/go/commands/task-continue.md +9 -0
- package/presets/opencode/go/commands/technical-retro.md +8 -0
- package/presets/opencode/go/commands/update.md +42 -0
- package/presets/opencode/go/hooks/README.md +3 -0
- package/presets/opencode/go/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/go/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/go/opencode.json +2 -12
- package/presets/opencode/go/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/go/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/ios-swift/OPENCODE.md +15 -6
- package/presets/opencode/ios-swift/REPO_AGENTS.md +14 -0
- package/presets/opencode/ios-swift/adapter-map.json +17 -1
- package/presets/opencode/ios-swift/agents/build-verifier.md +1 -1
- package/presets/opencode/ios-swift/agents/code-reviewer.md +1 -1
- package/presets/opencode/ios-swift/agents/debugger.md +1 -1
- package/presets/opencode/ios-swift/agents/feature-developer.md +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/commands/README.md +1 -0
- package/presets/opencode/ios-swift/commands/task-continue.md +9 -0
- package/presets/opencode/ios-swift/commands/technical-retro.md +8 -0
- package/presets/opencode/ios-swift/commands/update.md +42 -0
- package/presets/opencode/ios-swift/hooks/README.md +3 -0
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/ios-swift/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/ios-swift/opencode.json +2 -12
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/ios-swift/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/java/OPENCODE.md +14 -6
- package/presets/opencode/java/REPO_AGENTS.md +14 -0
- package/presets/opencode/java/adapter-map.json +17 -1
- package/presets/opencode/java/agents/build-verifier.md +1 -1
- package/presets/opencode/java/agents/code-reviewer.md +1 -1
- package/presets/opencode/java/agents/debugger.md +1 -1
- package/presets/opencode/java/agents/feature-developer.md +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/commands/README.md +1 -0
- package/presets/opencode/java/commands/task-continue.md +9 -0
- package/presets/opencode/java/commands/technical-retro.md +8 -0
- package/presets/opencode/java/commands/update.md +42 -0
- package/presets/opencode/java/hooks/README.md +3 -0
- package/presets/opencode/java/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/java/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/java/opencode.json +2 -12
- package/presets/opencode/java/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/java/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/mcp-ts/OPENCODE.md +14 -6
- package/presets/opencode/mcp-ts/REPO_AGENTS.md +14 -0
- package/presets/opencode/mcp-ts/adapter-map.json +17 -1
- package/presets/opencode/mcp-ts/agents/build-verifier.md +1 -1
- package/presets/opencode/mcp-ts/agents/feature-developer.md +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/commands/README.md +1 -0
- package/presets/opencode/mcp-ts/commands/task-continue.md +9 -0
- package/presets/opencode/mcp-ts/commands/technical-retro.md +8 -0
- package/presets/opencode/mcp-ts/commands/update.md +42 -0
- package/presets/opencode/mcp-ts/hooks/README.md +3 -0
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/mcp-ts/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/mcp-ts/opencode.json +2 -12
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/next/OPENCODE.md +15 -6
- package/presets/opencode/next/REPO_AGENTS.md +15 -1
- package/presets/opencode/next/adapter-map.json +25 -1
- package/presets/opencode/next/agents/build-verifier.md +1 -1
- package/presets/opencode/next/agents/code-reviewer.md +1 -1
- package/presets/opencode/next/agents/debugger.md +1 -1
- package/presets/opencode/next/agents/feature-developer.md +1 -1
- package/presets/opencode/next/agents/task-analyst.md +1 -1
- package/presets/opencode/next/agents/task-router.md +1 -1
- package/presets/opencode/next/commands/README.md +1 -0
- package/presets/opencode/next/commands/task-continue.md +9 -0
- package/presets/opencode/next/commands/technical-retro.md +8 -0
- package/presets/opencode/next/commands/update.md +42 -0
- package/presets/opencode/next/hooks/README.md +3 -0
- package/presets/opencode/next/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/next/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/next/opencode.json +2 -12
- package/presets/opencode/next/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/next/rules/component-catalog-gate.md +13 -0
- package/presets/opencode/next/rules/forms-validation.md +12 -0
- package/presets/opencode/next/rules/next-app-router.md +27 -0
- package/presets/opencode/next/rules/next-static-export.md +16 -0
- package/presets/opencode/next/rules/react-next-anti-hallucination.md +20 -18
- package/presets/opencode/next/rules/security-next.md +13 -0
- package/presets/opencode/next/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/next/team/fixtures/feature-light.json +2 -1
- package/presets/opencode/next/team/fixtures/feature-ui-standard.json +24 -0
- package/presets/opencode/nuxt/OPENCODE.md +15 -6
- package/presets/opencode/nuxt/REPO_AGENTS.md +14 -0
- package/presets/opencode/nuxt/adapter-map.json +17 -1
- package/presets/opencode/nuxt/agents/build-verifier.md +1 -1
- package/presets/opencode/nuxt/agents/code-reviewer.md +1 -1
- package/presets/opencode/nuxt/agents/debugger.md +1 -1
- package/presets/opencode/nuxt/agents/feature-developer.md +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/commands/README.md +1 -0
- package/presets/opencode/nuxt/commands/task-continue.md +9 -0
- package/presets/opencode/nuxt/commands/technical-retro.md +8 -0
- package/presets/opencode/nuxt/commands/update.md +42 -0
- package/presets/opencode/nuxt/hooks/README.md +3 -0
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/nuxt/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/nuxt/opencode.json +2 -12
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/nuxt/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/php-hexagonal/OPENCODE.md +14 -6
- package/presets/opencode/php-hexagonal/REPO_AGENTS.md +14 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +17 -1
- package/presets/opencode/php-hexagonal/agents/build-verifier.md +1 -1
- package/presets/opencode/php-hexagonal/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/debugger.md +1 -1
- package/presets/opencode/php-hexagonal/agents/feature-developer.md +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/commands/README.md +1 -0
- package/presets/opencode/php-hexagonal/commands/task-continue.md +9 -0
- package/presets/opencode/php-hexagonal/commands/technical-retro.md +8 -0
- package/presets/opencode/php-hexagonal/commands/update.md +42 -0
- package/presets/opencode/php-hexagonal/hooks/README.md +3 -0
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/php-hexagonal/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/php-hexagonal/opencode.json +2 -12
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-hexagonal/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/php-laravel/OPENCODE.md +14 -6
- package/presets/opencode/php-laravel/REPO_AGENTS.md +14 -0
- package/presets/opencode/php-laravel/adapter-map.json +17 -1
- package/presets/opencode/php-laravel/agents/build-verifier.md +1 -1
- package/presets/opencode/php-laravel/agents/code-reviewer.md +1 -1
- package/presets/opencode/php-laravel/agents/debugger.md +1 -1
- package/presets/opencode/php-laravel/agents/feature-developer.md +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/commands/README.md +1 -0
- package/presets/opencode/php-laravel/commands/task-continue.md +9 -0
- package/presets/opencode/php-laravel/commands/technical-retro.md +8 -0
- package/presets/opencode/php-laravel/commands/update.md +42 -0
- package/presets/opencode/php-laravel/hooks/README.md +3 -0
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/php-laravel/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/php-laravel/opencode.json +2 -12
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/php-laravel/skills/technical-retro/SKILL.md +2 -0
- package/presets/opencode/svelte/OPENCODE.md +15 -6
- package/presets/opencode/svelte/REPO_AGENTS.md +14 -0
- package/presets/opencode/svelte/adapter-map.json +17 -1
- package/presets/opencode/svelte/agents/build-verifier.md +1 -1
- package/presets/opencode/svelte/agents/code-reviewer.md +1 -1
- package/presets/opencode/svelte/agents/debugger.md +1 -1
- package/presets/opencode/svelte/agents/feature-developer.md +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/commands/README.md +1 -0
- package/presets/opencode/svelte/commands/task-continue.md +9 -0
- package/presets/opencode/svelte/commands/technical-retro.md +8 -0
- package/presets/opencode/svelte/commands/update.md +42 -0
- package/presets/opencode/svelte/hooks/README.md +3 -0
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +111 -23
- package/presets/opencode/svelte/hooks/check-preset-update.mjs +227 -0
- package/presets/opencode/svelte/opencode.json +2 -12
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +1 -1
- package/presets/opencode/svelte/skills/technical-retro/SKILL.md +2 -0
- package/scripts/check-product-specs.sh +115 -9
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Self-learning rule improver — the engine of the in-task rule-improvement
|
|
3
|
+
* loop (architecture.md §3 Authoring shell, §4 Engine, §5 Safety guards).
|
|
4
|
+
*
|
|
5
|
+
* Deterministic pipeline: read `signals.jsonl`, group by `signature` (reusing
|
|
6
|
+
* `groupSignatures` from signals.mjs for the Rule-of-Three counts), re-derive
|
|
7
|
+
* the rule text from the validated signature via a canonical template (never
|
|
8
|
+
* from task/spec prose), validate the authoring envelope + denylist + two-band
|
|
9
|
+
* autonomy, then apply or stage under the shared exclusive lock.
|
|
10
|
+
*
|
|
11
|
+
* Writes are scoped to `.ai.local/**` only. The loop never edits this module
|
|
12
|
+
* or its denylist (self-reference guard, §5.2).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import fs from 'node:fs';
|
|
16
|
+
import path from 'node:path';
|
|
17
|
+
import { pathToFileURL } from 'node:url';
|
|
18
|
+
|
|
19
|
+
import { SIGNATURE_RE, ISSUE_BODY_RE, groupSignatures, validateSignal, markSignalsApplied } from './signals.mjs';
|
|
20
|
+
import { acquireLock, releaseLock } from './lock.mjs';
|
|
21
|
+
|
|
22
|
+
// --- Envelope caps (architecture.md §3) -------------------------------------
|
|
23
|
+
export const MAX_ACTIVE_RULES = 5;
|
|
24
|
+
export const MAX_TOTAL_LINES = 200;
|
|
25
|
+
|
|
26
|
+
// --- Denylist (architecture.md §5.3) ----------------------------------------
|
|
27
|
+
export const DENYLIST = [
|
|
28
|
+
'skip security',
|
|
29
|
+
'ignore review',
|
|
30
|
+
'disable gate',
|
|
31
|
+
'bypass',
|
|
32
|
+
'never run lint',
|
|
33
|
+
'no human gate',
|
|
34
|
+
'remove override',
|
|
35
|
+
'do not validate',
|
|
36
|
+
'trust without',
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
// Compliance surfaces — always staged + compliance-reviewed (§5.3).
|
|
40
|
+
const COMPLIANCE_RE =
|
|
41
|
+
/\b(pd|pii|personal[ -]data|medical|analytics|third[ -]party|cookie|ssr[ -]cookie|gdpr|hipaa)\b/i;
|
|
42
|
+
|
|
43
|
+
// `stem` is untrusted input from the signal; enforce kebab-case before any
|
|
44
|
+
// path is derived from it (path-traversal defense, §5 + slug-1 review note).
|
|
45
|
+
// Shares the issue-body shape with `SIGNATURE_RE` so a valid signature can
|
|
46
|
+
// never yield a stem that fails validation (S2).
|
|
47
|
+
export const STEM_RE = ISSUE_BODY_RE;
|
|
48
|
+
|
|
49
|
+
const KINDS = ['correction', 'retry', 'waste', 'reversal', 'dead-end'];
|
|
50
|
+
const SEVERITY_RANK = { low: 0, med: 1, high: 2 };
|
|
51
|
+
|
|
52
|
+
const KIND_VERB = {
|
|
53
|
+
correction: 'Fix',
|
|
54
|
+
retry: 'Do not retry',
|
|
55
|
+
waste: 'Eliminate',
|
|
56
|
+
reversal: 'Do not revert to',
|
|
57
|
+
'dead-end': 'Resolve',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Convention section per wrong-turn kind: fragility → Gotchas, preferred
|
|
61
|
+
// approach → Patterns (minor, documented interpretation — §5.6 gotcha|pattern).
|
|
62
|
+
const KIND_SECTION = {
|
|
63
|
+
correction: 'Patterns',
|
|
64
|
+
retry: 'Patterns',
|
|
65
|
+
reversal: 'Patterns',
|
|
66
|
+
waste: 'Gotchas',
|
|
67
|
+
'dead-end': 'Gotchas',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// Issue bodies that already read as a directive ("prefer-…", "use-…") are
|
|
71
|
+
// capitalized verbatim; anything else gets a kind-verb prefix.
|
|
72
|
+
const DIRECTIVE_PREFIXES = new Set([
|
|
73
|
+
'prefer', 'use', 'avoid', 'always', 'never', 'do', 'dont', 'ensure',
|
|
74
|
+
'require', 'remove', 'add', 'keep', 'check', 'validate', 'enforce',
|
|
75
|
+
]);
|
|
76
|
+
|
|
77
|
+
function capitalize(value) {
|
|
78
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function countNonEmptyLines(content) {
|
|
82
|
+
return content.split('\n').filter((line) => line.trim() !== '').length;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function readExisting(filePath) {
|
|
86
|
+
try {
|
|
87
|
+
return fs.readFileSync(filePath, 'utf8');
|
|
88
|
+
} catch (error) {
|
|
89
|
+
if (error && error.code === 'ENOENT') return null;
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function writeFileAtomic(target, content) {
|
|
95
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
96
|
+
const temporary = `${target}.${process.pid}.${Date.now()}.tmp`;
|
|
97
|
+
const fd = fs.openSync(temporary, 'w');
|
|
98
|
+
try {
|
|
99
|
+
fs.writeSync(fd, content);
|
|
100
|
+
try { fs.fsyncSync(fd); } catch {}
|
|
101
|
+
} finally {
|
|
102
|
+
try { fs.closeSync(fd); } catch {}
|
|
103
|
+
}
|
|
104
|
+
fs.renameSync(temporary, target);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function appendLedgerLine(ledgerPath, entry) {
|
|
108
|
+
const existing = readExisting(ledgerPath) ?? '';
|
|
109
|
+
const temporary = `${ledgerPath}.${process.pid}.${Date.now()}.tmp`;
|
|
110
|
+
const fd = fs.openSync(temporary, 'w');
|
|
111
|
+
try {
|
|
112
|
+
fs.writeSync(fd, existing + `${JSON.stringify(entry)}\n`);
|
|
113
|
+
try { fs.fsyncSync(fd); } catch {}
|
|
114
|
+
} finally {
|
|
115
|
+
try { fs.closeSync(fd); } catch {}
|
|
116
|
+
}
|
|
117
|
+
fs.renameSync(temporary, ledgerPath);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function restoreText(target, previous) {
|
|
121
|
+
if (previous === null) {
|
|
122
|
+
try { fs.unlinkSync(target); } catch (error) {
|
|
123
|
+
if (!error || error.code !== 'ENOENT') throw error;
|
|
124
|
+
}
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
writeFileAtomic(target, previous);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Ledger intent lands before the file rename so a crash cannot leave a rule with no `before`.
|
|
131
|
+
function commitWrite({ ledgerPath, target, content, entry }) {
|
|
132
|
+
const previousLedger = readExisting(ledgerPath);
|
|
133
|
+
appendLedgerLine(ledgerPath, entry);
|
|
134
|
+
try {
|
|
135
|
+
writeFileAtomic(target, content);
|
|
136
|
+
} catch (error) {
|
|
137
|
+
try { restoreText(ledgerPath, previousLedger); } catch (compensateError) {
|
|
138
|
+
error.cause = compensateError;
|
|
139
|
+
}
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// --- Signature parsing + template re-derivation ------------------------------
|
|
145
|
+
|
|
146
|
+
export function parseSignature(signature) {
|
|
147
|
+
if (!SIGNATURE_RE.test(signature)) {
|
|
148
|
+
throw new Error(`invalid signature "${signature}"`);
|
|
149
|
+
}
|
|
150
|
+
const idx = signature.indexOf(':');
|
|
151
|
+
return { kind: signature.slice(0, idx), issue: signature.slice(idx + 1) };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function humanize(issue) {
|
|
155
|
+
return issue.replace(/-/g, ' ');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function validateStem(stem) {
|
|
159
|
+
if (typeof stem !== 'string' || stem.length === 0) {
|
|
160
|
+
throw new Error('stem must be a non-empty string');
|
|
161
|
+
}
|
|
162
|
+
if (!STEM_RE.test(stem)) {
|
|
163
|
+
throw new Error('stem must be kebab-case (lowercase alnum, single hyphens)');
|
|
164
|
+
}
|
|
165
|
+
if (stem.includes('..') || stem.includes('/') || stem.includes('\\') || stem.includes('\0')) {
|
|
166
|
+
throw new Error('stem must not contain path separators or traversal');
|
|
167
|
+
}
|
|
168
|
+
if (path.isAbsolute(stem)) {
|
|
169
|
+
throw new Error('stem must not be an absolute path');
|
|
170
|
+
}
|
|
171
|
+
return stem;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function imperativeSentence(kind, phrase) {
|
|
175
|
+
const first = phrase.split(' ')[0];
|
|
176
|
+
if (DIRECTIVE_PREFIXES.has(first)) return `${capitalize(phrase)}.`;
|
|
177
|
+
return `${KIND_VERB[kind] ?? 'Fix'} ${phrase}.`;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Re-derive the rule text from the signature via the canonical template
|
|
182
|
+
* (architecture.md §3). The only free-form input is the already-validated
|
|
183
|
+
* kebab-case `issue` and `stem`; `kind` comes from the fixed vocabulary, so
|
|
184
|
+
* no task/spec prose can reach the rule body.
|
|
185
|
+
*/
|
|
186
|
+
export function deriveRuleText({ stem, kind, issue, overrideKill = null }) {
|
|
187
|
+
validateStem(stem);
|
|
188
|
+
if (!KINDS.includes(kind)) throw new Error(`unknown kind "${kind}"`);
|
|
189
|
+
const phrase = humanize(issue);
|
|
190
|
+
const sentence = imperativeSentence(kind, phrase);
|
|
191
|
+
const lines = [`# ${stem}`, ''];
|
|
192
|
+
if (overrideKill !== null) {
|
|
193
|
+
if (typeof overrideKill !== 'string' || !STEM_RE.test(overrideKill)) {
|
|
194
|
+
throw new Error('override: kill target must be kebab-case');
|
|
195
|
+
}
|
|
196
|
+
lines.push(`override: kill ${overrideKill}`, '');
|
|
197
|
+
}
|
|
198
|
+
lines.push(sentence, '');
|
|
199
|
+
lines.push('| When | Do |', '|------|----|');
|
|
200
|
+
lines.push(`| ${phrase} is observed | ${sentence.replace(/\.$/, '').toLowerCase()} |`);
|
|
201
|
+
return `${lines.join('\n')}\n`;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function deriveSeedText({ stem, kind, issue }) {
|
|
205
|
+
return `glob: always\n\n## Body\n\n${deriveRuleText({ stem, kind, issue })}`;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// --- Guards ------------------------------------------------------------------
|
|
209
|
+
|
|
210
|
+
function textTokens(text) {
|
|
211
|
+
return text.toLowerCase().split(/[^a-z0-9]+/).filter((token) => token.length > 0);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// "do not" / "dont" is the same guard negation as "never"; gap words stay allowed.
|
|
215
|
+
function withNeverAlias(tokens) {
|
|
216
|
+
const aliased = [];
|
|
217
|
+
for (let i = 0; i < tokens.length; i += 1) {
|
|
218
|
+
if (tokens[i] === 'dont') {
|
|
219
|
+
aliased.push('never');
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
if (tokens[i] === 'do' && tokens[i + 1] === 'not') {
|
|
223
|
+
aliased.push('never');
|
|
224
|
+
i += 1;
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
aliased.push(tokens[i]);
|
|
228
|
+
}
|
|
229
|
+
return aliased;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function containsTokenSequence(haystack, needles) {
|
|
233
|
+
let from = 0;
|
|
234
|
+
for (const needle of needles) {
|
|
235
|
+
const idx = haystack.indexOf(needle, from);
|
|
236
|
+
if (idx === -1) return false;
|
|
237
|
+
from = idx + 1;
|
|
238
|
+
}
|
|
239
|
+
return needles.length > 0;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function isDenied(text) {
|
|
243
|
+
if (typeof text !== 'string') return false;
|
|
244
|
+
const haystack = textTokens(text);
|
|
245
|
+
const aliased = withNeverAlias(haystack);
|
|
246
|
+
return DENYLIST.some((phrase) => {
|
|
247
|
+
const needles = textTokens(phrase);
|
|
248
|
+
return containsTokenSequence(haystack, needles) || containsTokenSequence(aliased, needles);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function complianceReason(text) {
|
|
253
|
+
if (typeof text !== 'string') return null;
|
|
254
|
+
const match = text.match(COMPLIANCE_RE);
|
|
255
|
+
return match ? `compliance: ${match[0].toLowerCase()}` : null;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Two-band autonomy (architecture.md OD-1 + §7): auto-apply only additive,
|
|
260
|
+
* low-risk, reversible changes; everything durable/wide/guarded is staged.
|
|
261
|
+
*/
|
|
262
|
+
export function classifyBand({ denied, compliance, overrideKill, decision, severity, editsExisting }) {
|
|
263
|
+
if (denied) return { verdict: 'reject', reason: 'denylist' };
|
|
264
|
+
if (compliance) return { verdict: 'stage', reason: 'compliance' };
|
|
265
|
+
if (overrideKill) return { verdict: 'stage', reason: 'override: kill' };
|
|
266
|
+
if (decision) return { verdict: 'stage', reason: 'decision' };
|
|
267
|
+
if (severity === 'high') return { verdict: 'stage', reason: 'high severity' };
|
|
268
|
+
if (editsExisting) return { verdict: 'stage', reason: 'edit existing rule' };
|
|
269
|
+
return { verdict: 'auto', reason: 'low-risk additive' };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// --- Rule of Three threshold -------------------------------------------------
|
|
273
|
+
|
|
274
|
+
export function thresholdAction(distinctSlugCount) {
|
|
275
|
+
if (distinctSlugCount >= 3) return { tier: 3, action: 'create' };
|
|
276
|
+
if (distinctSlugCount >= 2) return { tier: 2, action: 'edit' };
|
|
277
|
+
return { tier: 1, action: 'none' };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// --- Authoring envelope ------------------------------------------------------
|
|
281
|
+
|
|
282
|
+
export function evaluateEnvelope({ ruleCount, lineCount, newRuleCount = 0, newLineCount = 0 }) {
|
|
283
|
+
const nextRules = ruleCount + newRuleCount;
|
|
284
|
+
const nextLines = lineCount + newLineCount;
|
|
285
|
+
if (nextRules > MAX_ACTIVE_RULES) {
|
|
286
|
+
return { ok: false, reason: `rule cap: ${nextRules} active rules would exceed ${MAX_ACTIVE_RULES}` };
|
|
287
|
+
}
|
|
288
|
+
if (nextLines > MAX_TOTAL_LINES) {
|
|
289
|
+
return { ok: false, reason: `line cap: ${nextLines} nonempty lines would exceed ${MAX_TOTAL_LINES}` };
|
|
290
|
+
}
|
|
291
|
+
return { ok: true, reason: 'within envelope' };
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export function countRulesAndLines({ rulesDir, conventionsPath }) {
|
|
295
|
+
let ruleCount = 0;
|
|
296
|
+
let lineCount = 0;
|
|
297
|
+
let names = [];
|
|
298
|
+
try { names = fs.readdirSync(rulesDir); } catch (error) {
|
|
299
|
+
if (!error || error.code !== 'ENOENT') throw error;
|
|
300
|
+
}
|
|
301
|
+
for (const name of names) {
|
|
302
|
+
if (!name.endsWith('.md')) continue;
|
|
303
|
+
ruleCount += 1;
|
|
304
|
+
try { lineCount += countNonEmptyLines(fs.readFileSync(path.join(rulesDir, name), 'utf8')); } catch {}
|
|
305
|
+
}
|
|
306
|
+
if (conventionsPath) {
|
|
307
|
+
try { lineCount += countNonEmptyLines(fs.readFileSync(conventionsPath, 'utf8')); } catch {}
|
|
308
|
+
}
|
|
309
|
+
return { ruleCount, lineCount };
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// --- Conventions edit --------------------------------------------------------
|
|
313
|
+
|
|
314
|
+
// Normalize a line for dedup-by-signature: collapse whitespace + lowercase so
|
|
315
|
+
// `- Use barrel imports.` and `- use barrel imports.` compare equal (§5.2).
|
|
316
|
+
function normalizeEntryLine(line) {
|
|
317
|
+
return line.trim().replace(/\s+/g, ' ').toLowerCase();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// A convention entry is a no-op when an identical line already exists (§5.2
|
|
321
|
+
// "a rule can only be edited, never duplicated"). Comparison is normalized.
|
|
322
|
+
function conventionsEntryExists(content, entry) {
|
|
323
|
+
const needle = normalizeEntryLine(`- ${entry}`);
|
|
324
|
+
return content.split('\n').some((line) => normalizeEntryLine(line) === needle);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export function addConventionsEntry(content, section, entry) {
|
|
328
|
+
const marker = `## ${section}`;
|
|
329
|
+
const idx = content.indexOf(marker);
|
|
330
|
+
if (idx === -1) throw new Error(`conventions.md has no "${section}" section`);
|
|
331
|
+
const headerEnd = idx + marker.length;
|
|
332
|
+
const next = content.indexOf('\n## ', headerEnd);
|
|
333
|
+
const sectionEnd = next === -1 ? content.length : next;
|
|
334
|
+
const body = content.slice(idx, sectionEnd);
|
|
335
|
+
const placeholder = body.match(/^-\s*$/m);
|
|
336
|
+
if (placeholder) {
|
|
337
|
+
return content.slice(0, idx) + body.replace(/^-\s*$/m, `- ${entry}`) + content.slice(sectionEnd);
|
|
338
|
+
}
|
|
339
|
+
return `${content.slice(0, headerEnd)}\n\n- ${entry}${content.slice(headerEnd)}`;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// --- Rollback inverse --------------------------------------------------------
|
|
343
|
+
|
|
344
|
+
export function rollbackInverse(entry, options = {}) {
|
|
345
|
+
if (!entry || typeof entry.target !== 'string' || entry.target.length === 0) {
|
|
346
|
+
throw new Error('rollback entry requires a target');
|
|
347
|
+
}
|
|
348
|
+
const { ledgerPath, lockPath } = options;
|
|
349
|
+
if (typeof ledgerPath !== 'string' || typeof lockPath !== 'string') {
|
|
350
|
+
throw new Error('rollbackInverse requires ledgerPath and lockPath');
|
|
351
|
+
}
|
|
352
|
+
const now = options.now ?? (() => new Date().toISOString());
|
|
353
|
+
const inverse = {
|
|
354
|
+
...entry,
|
|
355
|
+
action: 'rollback',
|
|
356
|
+
before: entry.after,
|
|
357
|
+
after: entry.before,
|
|
358
|
+
at: now(),
|
|
359
|
+
};
|
|
360
|
+
const token = acquireLock(lockPath);
|
|
361
|
+
try {
|
|
362
|
+
if (inverse.after == null) {
|
|
363
|
+
try { fs.unlinkSync(entry.target); } catch (error) {
|
|
364
|
+
if (!error || error.code !== 'ENOENT') throw error;
|
|
365
|
+
}
|
|
366
|
+
} else {
|
|
367
|
+
writeFileAtomic(entry.target, inverse.after);
|
|
368
|
+
}
|
|
369
|
+
appendLedgerLine(ledgerPath, inverse);
|
|
370
|
+
return inverse;
|
|
371
|
+
} finally {
|
|
372
|
+
releaseLock(lockPath, token);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// --- Engine ------------------------------------------------------------------
|
|
377
|
+
|
|
378
|
+
function enrichGroups(groups, signalsPath) {
|
|
379
|
+
const bySignature = new Map();
|
|
380
|
+
let raw = '';
|
|
381
|
+
try { raw = fs.readFileSync(signalsPath, 'utf8'); } catch (error) {
|
|
382
|
+
if (error && error.code === 'ENOENT') raw = '';
|
|
383
|
+
else throw error;
|
|
384
|
+
}
|
|
385
|
+
for (const line of raw.split('\n')) {
|
|
386
|
+
const trimmed = line.trim();
|
|
387
|
+
if (trimmed === '') continue;
|
|
388
|
+
let signal;
|
|
389
|
+
try { signal = JSON.parse(trimmed); validateSignal(signal); } catch { continue; }
|
|
390
|
+
if (signal.status === 'rejected' || signal.status === 'rolled_back') continue;
|
|
391
|
+
const entry = bySignature.get(signal.signature) ?? {
|
|
392
|
+
severity: 'low', severityRank: 0, stem: null, stems: [], target: null, targets: [], agent: null,
|
|
393
|
+
};
|
|
394
|
+
const rank = SEVERITY_RANK[signal.severity] ?? 0;
|
|
395
|
+
if (rank > entry.severityRank) { entry.severity = signal.severity; entry.severityRank = rank; }
|
|
396
|
+
if (signal.stem) {
|
|
397
|
+
entry.stem = signal.stem;
|
|
398
|
+
entry.stems.push(signal.stem);
|
|
399
|
+
}
|
|
400
|
+
if (signal.target) {
|
|
401
|
+
entry.target = signal.target;
|
|
402
|
+
entry.targets.push(signal.target);
|
|
403
|
+
}
|
|
404
|
+
if (!entry.agent) entry.agent = signal.agent;
|
|
405
|
+
bySignature.set(signal.signature, entry);
|
|
406
|
+
}
|
|
407
|
+
return groups.map((group) => {
|
|
408
|
+
const entry = bySignature.get(group.signature);
|
|
409
|
+
return {
|
|
410
|
+
signature: group.signature,
|
|
411
|
+
distinctSlugCount: group.distinctSlugCount,
|
|
412
|
+
slugs: group.slugs,
|
|
413
|
+
count: group.count,
|
|
414
|
+
severity: entry?.severity ?? 'low',
|
|
415
|
+
stem: entry?.stem ?? null,
|
|
416
|
+
stems: entry?.stems ?? [],
|
|
417
|
+
target: entry?.target ?? null,
|
|
418
|
+
targets: entry?.targets ?? [],
|
|
419
|
+
agent: entry?.agent ?? 'rule-improver',
|
|
420
|
+
};
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function guardSurfaces(group, phrase, ruleText) {
|
|
425
|
+
return [group.signature, phrase, ruleText, ...(group.targets ?? []), ...(group.stems ?? [])];
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function decide(group) {
|
|
429
|
+
const { kind, issue } = parseSignature(group.signature);
|
|
430
|
+
const phrase = humanize(issue);
|
|
431
|
+
const stem = validateStem(group.stem ?? issue);
|
|
432
|
+
const ruleText = deriveRuleText({ stem, kind, issue });
|
|
433
|
+
const surfaces = guardSurfaces(group, phrase, ruleText);
|
|
434
|
+
const denied = surfaces.some((text) => isDenied(text));
|
|
435
|
+
let compliance = null;
|
|
436
|
+
for (const text of surfaces) {
|
|
437
|
+
compliance = complianceReason(text);
|
|
438
|
+
if (compliance) break;
|
|
439
|
+
}
|
|
440
|
+
const tier = thresholdAction(group.distinctSlugCount);
|
|
441
|
+
return {
|
|
442
|
+
signature: group.signature,
|
|
443
|
+
kind,
|
|
444
|
+
issue,
|
|
445
|
+
phrase,
|
|
446
|
+
stem,
|
|
447
|
+
tier,
|
|
448
|
+
denied,
|
|
449
|
+
compliance,
|
|
450
|
+
ruleText,
|
|
451
|
+
seedText: deriveSeedText({ stem, kind, issue }),
|
|
452
|
+
severity: group.severity,
|
|
453
|
+
agent: group.agent,
|
|
454
|
+
slug: group.slugs[0] ?? group.signature,
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function planConventions(ctx, decision) {
|
|
459
|
+
const target = ctx.conventionsPath;
|
|
460
|
+
const section = KIND_SECTION[decision.kind] ?? 'Patterns';
|
|
461
|
+
const entry = imperativeSentence(decision.kind, decision.phrase);
|
|
462
|
+
const before = readExisting(target) ?? '';
|
|
463
|
+
if (conventionsEntryExists(before, entry)) {
|
|
464
|
+
return { type: 'skipped', reason: 'dedup: identical entry already present', target };
|
|
465
|
+
}
|
|
466
|
+
const addedLines = countNonEmptyLines(addConventionsEntry(before, section, entry)) - countNonEmptyLines(before);
|
|
467
|
+
const envelope = evaluateEnvelope({
|
|
468
|
+
ruleCount: ctx.envelope.ruleCount,
|
|
469
|
+
lineCount: ctx.envelope.lineCount,
|
|
470
|
+
newLineCount: addedLines,
|
|
471
|
+
});
|
|
472
|
+
if (!envelope.ok) return { type: 'blocked', reason: envelope.reason, action: 'conventions-added' };
|
|
473
|
+
return { type: 'conventions', target, action: 'conventions-added', section, entry };
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function planSeed(ctx, decision) {
|
|
477
|
+
return {
|
|
478
|
+
type: 'seed',
|
|
479
|
+
target: path.join(ctx.libraryDir, `${decision.stem}.md`),
|
|
480
|
+
action: 'seed-staged',
|
|
481
|
+
content: decision.seedText,
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function ledgerEntry(decision, action, target, before, after, now) {
|
|
486
|
+
return {
|
|
487
|
+
signature: decision.signature,
|
|
488
|
+
action,
|
|
489
|
+
target,
|
|
490
|
+
before,
|
|
491
|
+
after,
|
|
492
|
+
at: now(),
|
|
493
|
+
agent: decision.agent,
|
|
494
|
+
slug: decision.slug,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
function parseLedger(raw) {
|
|
499
|
+
if (!raw) return [];
|
|
500
|
+
const entries = [];
|
|
501
|
+
for (const line of raw.split('\n')) {
|
|
502
|
+
const trimmed = line.trim();
|
|
503
|
+
if (trimmed === '') continue;
|
|
504
|
+
try { entries.push(JSON.parse(trimmed)); } catch { /* a bad line is the oracle's insufficient-data case */ }
|
|
505
|
+
}
|
|
506
|
+
return entries;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
function hasOpenStage(entries, signature) {
|
|
510
|
+
let open = false;
|
|
511
|
+
for (const entry of entries) {
|
|
512
|
+
if (!entry || entry.signature !== signature) continue;
|
|
513
|
+
if (entry.action === 'staged' || entry.action === 'seed-staged') open = true;
|
|
514
|
+
else if (
|
|
515
|
+
entry.action === 'rollback'
|
|
516
|
+
|| entry.action === 'conventions-added'
|
|
517
|
+
|| entry.action === 'rule-created'
|
|
518
|
+
|| entry.action === 'applied'
|
|
519
|
+
|| entry.action === 'rejected'
|
|
520
|
+
) open = false;
|
|
521
|
+
}
|
|
522
|
+
return open;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function proposedConventions(ctx, decision) {
|
|
526
|
+
const before = readExisting(ctx.conventionsPath);
|
|
527
|
+
if (before === null) return { before, after: null };
|
|
528
|
+
const section = KIND_SECTION[decision.kind] ?? 'Patterns';
|
|
529
|
+
const bullet = imperativeSentence(decision.kind, decision.phrase);
|
|
530
|
+
try {
|
|
531
|
+
return { before, after: addConventionsEntry(before, section, bullet) };
|
|
532
|
+
} catch {
|
|
533
|
+
return { before, after: before };
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function appendStage({ prior, ledgerPath, decision, action, target, before, after, now, staged, reason }) {
|
|
538
|
+
staged.push({ signature: decision.signature, target, reason });
|
|
539
|
+
if (hasOpenStage(prior, decision.signature)) return;
|
|
540
|
+
const entry = ledgerEntry(decision, action, target, before, after, now);
|
|
541
|
+
appendLedgerLine(ledgerPath, entry);
|
|
542
|
+
prior.push(entry);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function stageNewRule({ decision, ctx, prior, ledgerPath, now, staged, rulesDir }) {
|
|
546
|
+
const rulePath = path.join(rulesDir, `${decision.stem}.md`);
|
|
547
|
+
const editsExisting = fs.existsSync(rulePath);
|
|
548
|
+
const band = classifyBand({
|
|
549
|
+
denied: false,
|
|
550
|
+
compliance: Boolean(decision.compliance),
|
|
551
|
+
overrideKill: false,
|
|
552
|
+
decision: false,
|
|
553
|
+
severity: decision.severity,
|
|
554
|
+
editsExisting,
|
|
555
|
+
});
|
|
556
|
+
if (editsExisting) {
|
|
557
|
+
appendStage({
|
|
558
|
+
prior,
|
|
559
|
+
ledgerPath,
|
|
560
|
+
decision,
|
|
561
|
+
action: 'staged',
|
|
562
|
+
target: rulePath,
|
|
563
|
+
before: readExisting(rulePath),
|
|
564
|
+
after: decision.ruleText,
|
|
565
|
+
now,
|
|
566
|
+
staged,
|
|
567
|
+
reason: band.reason,
|
|
568
|
+
});
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
const seed = planSeed(ctx, decision);
|
|
572
|
+
const existing = readExisting(seed.target);
|
|
573
|
+
if (existing !== null) {
|
|
574
|
+
appendStage({
|
|
575
|
+
prior,
|
|
576
|
+
ledgerPath,
|
|
577
|
+
decision,
|
|
578
|
+
action: 'seed-staged',
|
|
579
|
+
target: seed.target,
|
|
580
|
+
before: existing,
|
|
581
|
+
after: existing,
|
|
582
|
+
now,
|
|
583
|
+
staged,
|
|
584
|
+
reason: 'seed already staged',
|
|
585
|
+
});
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
const reason = decision.compliance ?? (band.verdict === 'stage' ? band.reason : 'new rule staged for human promote');
|
|
589
|
+
const entry = ledgerEntry(decision, 'seed-staged', seed.target, null, seed.content, now);
|
|
590
|
+
commitWrite({ ledgerPath, target: seed.target, content: seed.content, entry });
|
|
591
|
+
prior.push(entry);
|
|
592
|
+
staged.push({ signature: decision.signature, target: seed.target, reason });
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Cap count, one-apply-per-run, and every write share one lock. The envelope
|
|
597
|
+
* and the ledger are read again here — not from the pre-lock snapshot.
|
|
598
|
+
*/
|
|
599
|
+
function applyDecisionsUnderLock({ decisions, rulesDir, libraryDir, conventionsPath, ledgerPath, lockPath, now }) {
|
|
600
|
+
const token = acquireLock(lockPath);
|
|
601
|
+
try {
|
|
602
|
+
let envelope = countRulesAndLines({ rulesDir, conventionsPath });
|
|
603
|
+
const prior = parseLedger(readExisting(ledgerPath) ?? '');
|
|
604
|
+
const ctx = { rulesDir, libraryDir, conventionsPath, envelope };
|
|
605
|
+
const applied = [];
|
|
606
|
+
const staged = [];
|
|
607
|
+
const skipped = [];
|
|
608
|
+
let appliedThisRun = 0;
|
|
609
|
+
|
|
610
|
+
for (const decision of decisions) {
|
|
611
|
+
if (decision.tier.action === 'create') {
|
|
612
|
+
stageNewRule({ decision, ctx, prior, ledgerPath, now, staged, rulesDir });
|
|
613
|
+
envelope = countRulesAndLines({ rulesDir, conventionsPath });
|
|
614
|
+
ctx.envelope = envelope;
|
|
615
|
+
continue;
|
|
616
|
+
}
|
|
617
|
+
if (decision.tier.action !== 'edit') continue;
|
|
618
|
+
|
|
619
|
+
const band = classifyBand({
|
|
620
|
+
denied: false,
|
|
621
|
+
compliance: Boolean(decision.compliance),
|
|
622
|
+
overrideKill: false,
|
|
623
|
+
decision: false,
|
|
624
|
+
severity: decision.severity,
|
|
625
|
+
editsExisting: false,
|
|
626
|
+
});
|
|
627
|
+
if (band.verdict === 'stage') {
|
|
628
|
+
const proposed = proposedConventions(ctx, decision);
|
|
629
|
+
appendStage({
|
|
630
|
+
prior,
|
|
631
|
+
ledgerPath,
|
|
632
|
+
decision,
|
|
633
|
+
action: 'staged',
|
|
634
|
+
target: conventionsPath,
|
|
635
|
+
before: proposed.before,
|
|
636
|
+
after: proposed.after,
|
|
637
|
+
now,
|
|
638
|
+
staged,
|
|
639
|
+
reason: decision.compliance ?? band.reason,
|
|
640
|
+
});
|
|
641
|
+
continue;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
const plan = planConventions(ctx, decision);
|
|
645
|
+
if (plan.type === 'skipped') {
|
|
646
|
+
skipped.push({ signature: decision.signature, target: plan.target, reason: plan.reason });
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
if (plan.type === 'blocked') {
|
|
650
|
+
const proposed = proposedConventions(ctx, decision);
|
|
651
|
+
appendStage({
|
|
652
|
+
prior,
|
|
653
|
+
ledgerPath,
|
|
654
|
+
decision,
|
|
655
|
+
action: 'staged',
|
|
656
|
+
target: plan.target,
|
|
657
|
+
before: proposed.before,
|
|
658
|
+
after: proposed.after,
|
|
659
|
+
now,
|
|
660
|
+
staged,
|
|
661
|
+
reason: plan.reason,
|
|
662
|
+
});
|
|
663
|
+
continue;
|
|
664
|
+
}
|
|
665
|
+
if (appliedThisRun >= 1) {
|
|
666
|
+
const proposed = proposedConventions(ctx, decision);
|
|
667
|
+
appendStage({
|
|
668
|
+
prior,
|
|
669
|
+
ledgerPath,
|
|
670
|
+
decision,
|
|
671
|
+
action: 'staged',
|
|
672
|
+
target: plan.target,
|
|
673
|
+
before: proposed.before,
|
|
674
|
+
after: proposed.after,
|
|
675
|
+
now,
|
|
676
|
+
staged,
|
|
677
|
+
reason: 'rate limit: ≤1 applied rule per task',
|
|
678
|
+
});
|
|
679
|
+
continue;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
const before = readExisting(plan.target);
|
|
683
|
+
const after = addConventionsEntry(before ?? '', plan.section, plan.entry);
|
|
684
|
+
const entry = ledgerEntry(decision, plan.action, plan.target, before, after, now);
|
|
685
|
+
commitWrite({ ledgerPath, target: plan.target, content: after, entry });
|
|
686
|
+
prior.push(entry);
|
|
687
|
+
appliedThisRun += 1;
|
|
688
|
+
applied.push({ signature: decision.signature, target: plan.target });
|
|
689
|
+
envelope = countRulesAndLines({ rulesDir, conventionsPath });
|
|
690
|
+
ctx.envelope = envelope;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
return { applied, staged, skipped, envelope };
|
|
694
|
+
} finally {
|
|
695
|
+
releaseLock(lockPath, token);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Run the improver. Guard decisions are read-only; the cap, the one-apply
|
|
701
|
+
* check, and the writes run together under the lock.
|
|
702
|
+
*/
|
|
703
|
+
export function runImprover(options = {}) {
|
|
704
|
+
const baseDir = options.baseDir ?? path.join(process.cwd(), '.ai.local');
|
|
705
|
+
const signalsPath = options.signalsPath ?? path.join(baseDir, 'signals.jsonl');
|
|
706
|
+
const rulesDir = options.rulesDir ?? path.join(baseDir, 'rules');
|
|
707
|
+
const libraryDir = options.libraryDir ?? path.join(baseDir, 'rules-library');
|
|
708
|
+
const conventionsPath = options.conventionsPath ?? path.join(baseDir, 'conventions.md');
|
|
709
|
+
const ledgerPath = options.ledgerPath ?? path.join(baseDir, 'rule-changes.jsonl');
|
|
710
|
+
const lockPath = options.lockPath ?? path.join(baseDir, '.rules.lock');
|
|
711
|
+
const now = options.now ?? (() => new Date().toISOString());
|
|
712
|
+
|
|
713
|
+
const { groups, errors } = groupSignatures({ signalsPath });
|
|
714
|
+
const rejected = [];
|
|
715
|
+
const decisions = [];
|
|
716
|
+
|
|
717
|
+
for (const group of enrichGroups(groups, signalsPath)) {
|
|
718
|
+
if (group.distinctSlugCount < 2) continue;
|
|
719
|
+
let decision;
|
|
720
|
+
try {
|
|
721
|
+
decision = decide(group);
|
|
722
|
+
} catch (error) {
|
|
723
|
+
// A malformed/inconsistent signal (e.g. signature↔stem mismatch) must be
|
|
724
|
+
// skipped + reported, never abort the whole loop (§5.2 robustness).
|
|
725
|
+
errors.push({
|
|
726
|
+
signature: group.signature,
|
|
727
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
728
|
+
});
|
|
729
|
+
continue;
|
|
730
|
+
}
|
|
731
|
+
if (decision.denied) {
|
|
732
|
+
rejected.push({ signature: decision.signature, reason: 'denylist' });
|
|
733
|
+
continue;
|
|
734
|
+
}
|
|
735
|
+
decisions.push(decision);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
let applied = [];
|
|
739
|
+
let staged = [];
|
|
740
|
+
let skipped = [];
|
|
741
|
+
let envelope;
|
|
742
|
+
if (decisions.length === 0) {
|
|
743
|
+
envelope = countRulesAndLines({ rulesDir, conventionsPath });
|
|
744
|
+
} else {
|
|
745
|
+
({ applied, staged, skipped, envelope } = applyDecisionsUnderLock({
|
|
746
|
+
decisions, rulesDir, libraryDir, conventionsPath, ledgerPath, lockPath, now,
|
|
747
|
+
}));
|
|
748
|
+
// Mark the signals that actually wrote a change as `applied` so a later
|
|
749
|
+
// rejection/rollback can flip them to a non-qualifying status (W4).
|
|
750
|
+
for (const item of applied) {
|
|
751
|
+
markSignalsApplied(item.signature, { signalsPath });
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
return {
|
|
756
|
+
applied,
|
|
757
|
+
staged,
|
|
758
|
+
skipped,
|
|
759
|
+
rejected,
|
|
760
|
+
errors,
|
|
761
|
+
envelope,
|
|
762
|
+
report: renderReport({ applied, staged, skipped, rejected, errors, envelope }),
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
function renderReport({ applied, staged, skipped, rejected, errors, envelope }) {
|
|
767
|
+
const lines = [
|
|
768
|
+
'Self-learning rule improver',
|
|
769
|
+
`envelope: ${envelope.ruleCount}/${MAX_ACTIVE_RULES} rules, ${envelope.lineCount}/${MAX_TOTAL_LINES} lines`,
|
|
770
|
+
'',
|
|
771
|
+
`applied (${applied.length}) — auto, low-risk, reversible`,
|
|
772
|
+
];
|
|
773
|
+
for (const item of applied) lines.push(` - ${item.signature} → ${item.target}`);
|
|
774
|
+
lines.push('', `staged (${staged.length}) — human promote`);
|
|
775
|
+
for (const item of staged) lines.push(` - ${item.signature} → ${item.target} (${item.reason})`);
|
|
776
|
+
if (skipped.length > 0) {
|
|
777
|
+
lines.push('', `skipped (${skipped.length}) — dedup no-op`);
|
|
778
|
+
for (const item of skipped) lines.push(` - ${item.signature} (${item.reason})`);
|
|
779
|
+
}
|
|
780
|
+
lines.push('', `rejected (${rejected.length}) — denylist`);
|
|
781
|
+
for (const item of rejected) lines.push(` - ${item.signature} (${item.reason})`);
|
|
782
|
+
if (errors.length > 0) {
|
|
783
|
+
lines.push('', `errors (${errors.length})`);
|
|
784
|
+
for (const error of errors) {
|
|
785
|
+
const where = error.line != null ? `line ${error.line}` : (error.signature ?? 'unknown');
|
|
786
|
+
lines.push(` - ${where}: ${error.reason}`);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
return `${lines.join('\n')}\n`;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// CLI entry: run directly (node rule-improver.mjs) and print the report.
|
|
793
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
794
|
+
process.stdout.write(runImprover().report);
|
|
795
|
+
}
|