gennady 0.6.1 → 0.7.0
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/README.md +2 -15
- package/ai/agents/agent-resolve-conflicts.xml +6 -0
- package/ai/agents/agent-review-verifier.xml +6 -0
- package/ai/directives/architecture/README.md +21 -0
- package/ai/directives/coding/README.md +23 -0
- package/ai/directives/coding/result-conventions.xml +55 -0
- package/ai/directives/coding/svelte5-runes.xml +248 -0
- package/ai/directives/coding/sveltekit-rules.xml +247 -0
- package/ai/directives/coding/typescript-rules.xml +589 -0
- package/ai/directives/coding/uikit-component-storybook.xml +347 -0
- package/ai/directives/coding/uikit-component-svelte.xml +344 -0
- package/ai/directives/coding/uikit-spec-drafting.xml +243 -0
- package/ai/directives/dbc-audit.directive.xml +131 -0
- package/ai/directives/dev-review.directive.xml +148 -0
- package/ai/directives/infra/README.md +11 -0
- package/ai/directives/infra/eslint-setup.xml +467 -0
- package/ai/directives/infra/git-setup.xml +261 -0
- package/ai/directives/infra/nodejs-npm-setup.xml +354 -0
- package/ai/directives/infra/storybook-setup.xml +153 -0
- package/ai/directives/knowledge.xml +206 -0
- package/ai/directives/perf-auditor/perf-auditor.directive.xml +75 -0
- package/ai/directives/perf-auditor/rules/async-latency.xml +101 -0
- package/ai/directives/perf-auditor/rules/data-structures.xml +103 -0
- package/ai/directives/perf-auditor/rules/iteration-fusion.xml +96 -0
- package/ai/directives/perf-auditor/rules/memory-gc.xml +102 -0
- package/ai/directives/sdd/README.md +49 -0
- package/ai/directives/sdd/audit.directive.xml +543 -0
- package/ai/directives/sdd/discovery.directive.xml +824 -0
- package/ai/directives/sdd/fix.directive.xml +249 -0
- package/ai/directives/sdd/module-decomposition.directive.xml +666 -0
- package/ai/directives/sdd/phase-execution-protocol.xml +339 -0
- package/ai/directives/sdd/scaffold.directive.xml +717 -0
- package/ai/directives/sdd/setup.directive.xml +213 -0
- package/ai/directives/sdd/svelte-ui-discovery.directive.xml +263 -0
- package/ai/directives/semantic-change-extractor.directive.xml +99 -0
- package/ai/directives/testing/README.md +25 -0
- package/ai/directives/testing/common.xml +234 -0
- package/ai/directives/testing/node-test.xml +288 -0
- package/ai/directives/testing/playwright-cli.xml +199 -0
- package/ai/directives/testing/playwright-e2e.xml +292 -0
- package/ai/directives/testing/storybook-usage.xml +173 -0
- package/ai/directives/testing/svelte-testing.xml +237 -0
- package/ai/directives/testing/vitest-rules.xml +326 -0
- package/ai/docs/README.md +17 -0
- package/ai/docs/ai-icl.md +538 -0
- package/ai/docs/ai-priming.md +548 -0
- package/ai/docs/ai-prompt-formats.md +406 -0
- package/ai/docs/ai-promting.md +572 -0
- package/ai/drafts/DRAFT.md +120 -0
- package/ai/drafts/agent-devgen-class-from-description.rules.xml +123 -0
- package/ai/drafts/agent-typescript-devgen.v1.xml +303 -0
- package/ai/drafts/d.md +65 -0
- package/ai/drafts/music-posts.md +105 -0
- package/ai/fw/v1/architecture/blueprint-factory.xml +77 -0
- package/ai/fw/v1/core/mental-model.xml +50 -0
- package/ai/fw/v1/discovery/intent-reactor.xml +92 -0
- package/ai/fw/v1/production/swarm-protocol.xml +122 -0
- package/ai/fw/v1/review/quality-pipeline.xml +102 -0
- package/ai/fw/v2/arch-universal.xml +73 -0
- package/ai/fw-draft/README.md +79 -0
- package/ai/fw-draft/bin/discovery.sh +116 -0
- package/ai/fw-draft/gennady.xml +58 -0
- package/ai/fw-draft/provider/claude.xml +16 -0
- package/ai/fw-draft/provider/cursor.xml +23 -0
- package/ai/fw-draft/provider/default.xml +12 -0
- package/ai/fw-draft/roles/developer.xml +18 -0
- package/ai/fw-draft/router.xml +39 -0
- package/ai/fw-draft/routes/development.xml +32 -0
- package/ai/fw-draft/routes/universal.xml +58 -0
- package/ai/fw-draft/rules/dev/base/file-structure-rules.xml +89 -0
- package/ai/fw-draft/rules/dev/typescript/contacts.xml +194 -0
- package/dist/ai/agents/agent-resolve-conflicts.xml +6 -0
- package/dist/ai/agents/agent-review-verifier.xml +6 -0
- package/dist/ai/directives/architecture/README.md +21 -0
- package/dist/ai/directives/coding/README.md +23 -0
- package/dist/ai/directives/coding/result-conventions.xml +55 -0
- package/dist/ai/directives/coding/svelte5-runes.xml +248 -0
- package/dist/ai/directives/coding/sveltekit-rules.xml +247 -0
- package/dist/ai/directives/coding/typescript-rules.xml +589 -0
- package/dist/ai/directives/coding/uikit-component-storybook.xml +347 -0
- package/dist/ai/directives/coding/uikit-component-svelte.xml +344 -0
- package/dist/ai/directives/coding/uikit-spec-drafting.xml +243 -0
- package/dist/ai/directives/dbc-audit.directive.xml +131 -0
- package/dist/ai/directives/dev-review.directive.xml +148 -0
- package/dist/ai/directives/infra/README.md +11 -0
- package/dist/ai/directives/infra/eslint-setup.xml +467 -0
- package/dist/ai/directives/infra/git-setup.xml +261 -0
- package/dist/ai/directives/infra/nodejs-npm-setup.xml +354 -0
- package/dist/ai/directives/infra/storybook-setup.xml +153 -0
- package/dist/ai/directives/knowledge.xml +206 -0
- package/dist/ai/directives/perf-auditor/perf-auditor.directive.xml +75 -0
- package/dist/ai/directives/perf-auditor/rules/async-latency.xml +101 -0
- package/dist/ai/directives/perf-auditor/rules/data-structures.xml +103 -0
- package/dist/ai/directives/perf-auditor/rules/iteration-fusion.xml +96 -0
- package/dist/ai/directives/perf-auditor/rules/memory-gc.xml +102 -0
- package/dist/ai/directives/sdd/README.md +49 -0
- package/dist/ai/directives/sdd/audit.directive.xml +543 -0
- package/dist/ai/directives/sdd/discovery.directive.xml +824 -0
- package/dist/ai/directives/sdd/fix.directive.xml +249 -0
- package/dist/ai/directives/sdd/module-decomposition.directive.xml +666 -0
- package/dist/ai/directives/sdd/phase-execution-protocol.xml +339 -0
- package/dist/ai/directives/sdd/scaffold.directive.xml +717 -0
- package/dist/ai/directives/sdd/setup.directive.xml +213 -0
- package/dist/ai/directives/sdd/svelte-ui-discovery.directive.xml +263 -0
- package/dist/ai/directives/semantic-change-extractor.directive.xml +99 -0
- package/dist/ai/directives/testing/README.md +25 -0
- package/dist/ai/directives/testing/common.xml +234 -0
- package/dist/ai/directives/testing/node-test.xml +288 -0
- package/dist/ai/directives/testing/playwright-cli.xml +199 -0
- package/dist/ai/directives/testing/playwright-e2e.xml +292 -0
- package/dist/ai/directives/testing/storybook-usage.xml +173 -0
- package/dist/ai/directives/testing/svelte-testing.xml +237 -0
- package/dist/ai/directives/testing/vitest-rules.xml +326 -0
- package/dist/ai/docs/README.md +17 -0
- package/dist/ai/docs/ai-icl.md +538 -0
- package/dist/ai/docs/ai-priming.md +548 -0
- package/dist/ai/docs/ai-prompt-formats.md +406 -0
- package/dist/ai/docs/ai-promting.md +572 -0
- package/dist/ai/drafts/DRAFT.md +120 -0
- package/dist/ai/drafts/agent-devgen-class-from-description.rules.xml +123 -0
- package/dist/ai/drafts/agent-typescript-devgen.v1.xml +303 -0
- package/dist/ai/drafts/d.md +65 -0
- package/dist/ai/drafts/music-posts.md +105 -0
- package/dist/ai/fw/v1/architecture/blueprint-factory.xml +77 -0
- package/dist/ai/fw/v1/core/mental-model.xml +50 -0
- package/dist/ai/fw/v1/discovery/intent-reactor.xml +92 -0
- package/dist/ai/fw/v1/production/swarm-protocol.xml +122 -0
- package/dist/ai/fw/v1/review/quality-pipeline.xml +102 -0
- package/dist/ai/fw/v2/arch-universal.xml +73 -0
- package/dist/ai/fw-draft/README.md +79 -0
- package/dist/ai/fw-draft/bin/discovery.sh +116 -0
- package/dist/ai/fw-draft/gennady.xml +58 -0
- package/dist/ai/fw-draft/provider/claude.xml +16 -0
- package/dist/ai/fw-draft/provider/cursor.xml +23 -0
- package/dist/ai/fw-draft/provider/default.xml +12 -0
- package/dist/ai/fw-draft/roles/developer.xml +18 -0
- package/dist/ai/fw-draft/router.xml +39 -0
- package/dist/ai/fw-draft/routes/development.xml +32 -0
- package/dist/ai/fw-draft/routes/universal.xml +58 -0
- package/dist/ai/fw-draft/rules/dev/base/file-structure-rules.xml +89 -0
- package/dist/ai/fw-draft/rules/dev/typescript/contacts.xml +194 -0
- package/dist/chunks/devtools-B-7ugZhF.js +79 -0
- package/dist/chunks/{help.cmd-CWasx25o.js → help.cmd-B_G7EWzF.js} +9 -2
- package/dist/chunks/{index-Gy1n7hRU.js → index-BeL1Zcbg.js} +1 -1
- package/dist/chunks/index-CVR66voe.js +26963 -0
- package/dist/chunks/index-CXuhZzS3.js +16979 -0
- package/dist/chunks/{index-Bh0p7rJg.js → index-CaahtXiM.js} +33 -9
- package/dist/chunks/{index-BrobNwbS.js → index-CiEM-8nJ.js} +35 -19
- package/dist/chunks/{index-D1Hurfwu.js → index-D1qsi0Uc.js} +57 -33
- package/dist/chunks/index-D9ceRUyB.js +443 -0
- package/dist/chunks/index-DJpVmyp2.js +176 -0
- package/dist/chunks/{index-B3r-YFvt.js → index-DU6jD7SS.js} +1 -1
- package/dist/chunks/index-KxSZKmZn.js +540 -0
- package/dist/chunks/{index-DgAmONSz.js → index-UbHoePfr.js} +12 -12
- package/dist/chunks/{index-Bx_P7mlL.js → index-g1LXlp77.js} +2 -2
- package/dist/chunks/index-zBnnuvLA.js +3788 -0
- package/dist/chunks/{run-review-command.logic-BQDGxh0f.js → run-review-command.logic-DpkRoEi8.js} +2 -2
- package/dist/chunks/services-CaLOhuLV.js +2889 -0
- package/dist/chunks/shared-Bjy30TeM.js +665 -0
- package/dist/cli/cmd/_shared/prompt/io/load-agent-template.io.d.ts +3 -3
- package/dist/cli/cmd/_shared/prompt/logic/build-ai-first-knowledge-block.logic.d.ts +3 -3
- package/dist/cli/cmd/_shared/prompt/logic/build-ai-verify-placeholders.logic.d.ts +7 -4
- package/dist/cli/cmd/_shared/prompt/logic/verify-commands/resolve-verify-commands.logic.d.ts +5 -0
- package/dist/cli/cmd/_shared/update-check-worker.d.ts +1 -0
- package/dist/cli/cmd/_shared/update-check.d.ts +38 -0
- package/dist/cli/cmd/agent-mon/cmd/create-providers.d.ts +15 -0
- package/dist/cli/cmd/agent-mon/cmd/index.d.ts +1 -0
- package/dist/cli/cmd/agent-mon/cmd/run.d.ts +12 -0
- package/dist/cli/cmd/agent-mon/state/create-state-manager.d.ts +32 -0
- package/dist/cli/cmd/agent-mon/state/group-by-provider.d.ts +14 -0
- package/dist/cli/cmd/agent-mon/state/index.d.ts +5 -0
- package/dist/cli/cmd/agent-mon/state/is-waiting.d.ts +9 -0
- package/dist/cli/cmd/agent-mon/state/view-model.type.d.ts +74 -0
- package/dist/cli/cmd/agent-mon/ui/app.d.ts +16 -0
- package/dist/cli/cmd/agent-mon/ui/column-view.d.ts +14 -0
- package/dist/cli/cmd/agent-mon/ui/index.d.ts +10 -0
- package/dist/cli/cmd/agent-mon/ui/provider-column.d.ts +14 -0
- package/dist/cli/cmd/agent-mon/ui/session-card.d.ts +12 -0
- package/dist/cli/cmd/agent-mon/ui/status-badge.d.ts +10 -0
- package/dist/cli/cmd/alt-opinion/alt-opinion-parser.d.ts +18 -0
- package/dist/cli/cmd/alt-opinion/alt-opinion-runner.d.ts +32 -0
- package/dist/cli/cmd/alt-opinion/alt-opinion.cmd.d.ts +34 -0
- package/dist/cli/cmd/alt-opinion/alt-opinion.types.d.ts +88 -0
- package/dist/cli/cmd/alt-opinion/index.d.ts +1 -0
- package/dist/cli/cmd/cat/cat-url.fn.d.ts +19 -0
- package/dist/cli/cmd/lint/checks/anchor.check.d.ts +11 -0
- package/dist/cli/cmd/lint/checks/dbc-contract.check.d.ts +16 -0
- package/dist/cli/cmd/lint/checks/disables.check.d.ts +12 -0
- package/dist/cli/cmd/lint/checks/file-header.check.d.ts +10 -0
- package/dist/cli/cmd/lint/checks/language.check.d.ts +11 -0
- package/dist/cli/cmd/lint/index.d.ts +1 -0
- package/dist/cli/cmd/lint/lint.cmd.d.ts +18 -0
- package/dist/cli/cmd/lint/lint.types.d.ts +72 -0
- package/dist/cli/cmd/lint/utils/resolve-references.fn.d.ts +32 -0
- package/dist/cli/cmd/remote-console/index.d.ts +2 -0
- package/dist/cli/cmd/remote-console/remote-console.cmd.d.ts +55 -0
- package/dist/cli/cmd/resolve-conflicts/_core/io/resolve-conflicts-template-load.io.d.ts +2 -2
- package/dist/cli/cmd/resolve-conflicts/_core/logic/resolve-conflicts-command-args-parse.logic.d.ts +3 -3
- package/dist/cli/cmd/resolve-conflicts/_core/logic/resolve-conflicts-command-run.logic.d.ts +3 -3
- package/dist/cli/cmd/resolve-conflicts/_core/logic/resolve-conflicts-context-git-build.logic.d.ts +4 -4
- package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-artifact.type.d.ts +3 -1
- package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-command-args.type.d.ts +3 -1
- package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-command-result.type.d.ts +5 -1
- package/dist/cli/cmd/resolve-conflicts/_core/types/resolve-conflicts-context-git.type.d.ts +18 -2
- package/dist/cli/cmd/resolve-conflicts/_core/xml/resolve-conflicts-artifact-build.xml.d.ts +6 -6
- package/dist/cli/cmd/resolve-conflicts/_core/xml/resolve-conflicts-render.xml.d.ts +4 -4
- package/dist/cli/cmd/review/_core/io/load-review-verify-template.io.d.ts +2 -2
- package/dist/cli/cmd/review/_core/logic/build-review-context-git.logic.d.ts +3 -3
- package/dist/cli/cmd/review/_core/logic/build-review-context-vcs.logic.d.ts +2 -2
- package/dist/cli/cmd/review/_core/logic/load-review-context-mr.logic.d.ts +5 -5
- package/dist/cli/cmd/review/_core/logic/parse-review-command-args.logic.d.ts +3 -3
- package/dist/cli/cmd/review/_core/logic/resolve-review-intent.logic.d.ts +3 -3
- package/dist/cli/cmd/review/_core/logic/run-review-command.logic.d.ts +3 -3
- package/dist/cli/cmd/review/_core/types/review-artifact.type.d.ts +4 -1
- package/dist/cli/cmd/review/_core/types/review-command-args.type.d.ts +7 -1
- package/dist/cli/cmd/review/_core/types/review-command-mode.type.d.ts +1 -1
- package/dist/cli/cmd/review/_core/types/review-command-options.type.d.ts +3 -1
- package/dist/cli/cmd/review/_core/types/review-command-result.type.d.ts +5 -1
- package/dist/cli/cmd/review/_core/types/review-context-git.type.d.ts +3 -1
- package/dist/cli/cmd/review/_core/types/review-context-mr.type.d.ts +22 -3
- package/dist/cli/cmd/review/_core/types/review-context-vcs.type.d.ts +4 -1
- package/dist/cli/cmd/review/_core/types/review-intent.type.d.ts +1 -1
- package/dist/cli/cmd/review/_core/xml/build-review-artifact.xml.d.ts +10 -10
- package/dist/cli/cmd/review/_core/xml/render-review-issues.xml.d.ts +3 -3
- package/dist/cli/cmd/review/_core/xml/render-review-verify.xml.d.ts +4 -4
- package/dist/cli/cmd/sync/index.d.ts +1 -0
- package/dist/cli/cmd/sync/sync-core.d.ts +65 -0
- package/dist/cli/cmd/sync/sync-formatter.d.ts +12 -0
- package/dist/cli/cmd/sync/sync.cmd.d.ts +33 -0
- package/dist/cli/cmd/sync/sync.types.d.ts +50 -0
- package/dist/cli/cmd/vcs-reply/vcs-reply.cmd.d.ts +4 -4
- package/dist/cli/utils/ai-legacy/ai-legacy-agent.d.ts +12 -11
- package/dist/cli/utils/ai-legacy/ai-legacy-core.d.ts +33 -17
- package/dist/cli/utils/ai-legacy/ai-legacy-model.d.ts +42 -23
- package/dist/cli/utils/cat-gen/cat-gen.d.ts +19 -8
- package/dist/cli/utils/commit-gen/commit-gen.d.ts +39 -15
- package/dist/cli/utils/prompts/index.d.ts +6 -6
- package/dist/cli/utils/review-gen/review-gen.d.ts +33 -9
- package/dist/gennady.js +30 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +44 -23
- package/dist/services/agent-mon/diff/diff.d.ts +9 -0
- package/dist/services/agent-mon/diff/index.d.ts +1 -0
- package/dist/services/agent-mon/index.d.ts +10 -0
- package/dist/services/agent-mon/model/agent-provider.type.d.ts +20 -0
- package/dist/services/agent-mon/model/agent-session.type.d.ts +49 -0
- package/dist/services/agent-mon/model/errors.d.ts +20 -0
- package/dist/services/agent-mon/model/index.d.ts +7 -0
- package/dist/services/agent-mon/model/observe-opts.type.d.ts +7 -0
- package/dist/services/agent-mon/model/scan-opts.type.d.ts +7 -0
- package/dist/services/agent-mon/model/session-changes.type.d.ts +10 -0
- package/dist/services/agent-mon/monitor/agent-monitor.d.ts +44 -0
- package/dist/services/agent-mon/monitor/create-monitor.d.ts +6 -0
- package/dist/services/agent-mon/monitor/index.d.ts +2 -0
- package/dist/services/agent-mon/observe/index.d.ts +1 -0
- package/dist/services/agent-mon/observe/observe.d.ts +12 -0
- package/dist/services/agent-mon/providers/claude/claude-provider.d.ts +50 -0
- package/dist/services/agent-mon/providers/claude/index.d.ts +5 -0
- package/dist/services/agent-mon/providers/claude/ps.d.ts +36 -0
- package/dist/services/agent-mon/providers/claude/session-json.d.ts +37 -0
- package/dist/services/agent-mon/providers/opencode/db.d.ts +41 -0
- package/dist/services/agent-mon/providers/opencode/index.d.ts +3 -0
- package/dist/services/agent-mon/providers/opencode/model-parser.d.ts +6 -0
- package/dist/services/agent-mon/providers/opencode/opencode-provider.d.ts +45 -0
- package/dist/services/ai-client/providers/ai-model.type.d.ts +14 -0
- package/dist/services/ai-client/providers/open-router/open-router-model.type.d.ts +1 -4
- package/dist/services/ai-client/providers/open-router/open-router-provider.d.ts +17 -0
- package/dist/services/ai-client/providers/openai-like-provider.d.ts +1 -0
- package/dist/services/data-ore/telegram/telegram-data-ore.d.ts +17 -0
- package/dist/services/data-ore/telegram/telegram-data-ore.types.d.ts +4 -0
- package/dist/services/data-ore/telegram/telegram-demo-music-helper.d.ts +1 -0
- package/dist/services/data-ore/telegram/telegram-demo.d.ts +1 -0
- package/dist/services/dbc/linter/dbc-ast-adapter.types.d.ts +82 -0
- package/dist/services/dbc/linter/dbc-linter.types.d.ts +95 -0
- package/dist/services/dbc/linter/implementations/ts/dbc-ts-ast-adapter.d.ts +183 -0
- package/dist/services/dbc/linter/implementations/ts/dbc-ts-linter.d.ts +152 -0
- package/dist/services/dbc/parser/dbc-parser.types.d.ts +16 -16
- package/dist/services/dbc/parser/implementations/jsdoc/dbc-jsdoc-parser.d.ts +14 -4
- package/dist/services/logger/logger.d.ts +26 -6
- package/dist/services/remote-console/client/remote-console-client-serializer.d.ts +7 -0
- package/dist/services/remote-console/client/remote-console-client.d.ts +20 -0
- package/dist/services/remote-console/client/remote-console-client.types.d.ts +88 -0
- package/dist/services/remote-console/remote-console.d.ts +6 -0
- package/dist/services/remote-console/server/remote-console-server.d.ts +10 -0
- package/dist/services/remote-console/server/remote-console-server.types.d.ts +44 -0
- package/dist/services/remote-console/server/remote-console-stdout-writer.d.ts +26 -0
- package/dist/services/vcs-client/abstract/vcs-client-merge-discussions.d.ts +22 -14
- package/dist/services/vcs-client/abstract/vcs-client-merge-requests.d.ts +31 -14
- package/dist/services/vcs-client/abstract/vcs-client-repository-files.d.ts +16 -0
- package/dist/services/vcs-client/abstract/vcs-client.d.ts +9 -5
- package/dist/services/vcs-client/entities/vcs-file-content.type.d.ts +24 -0
- package/dist/services/vcs-client/entities/vcs-merge-request-changes.type.d.ts +32 -0
- package/dist/services/vcs-client/entities/vcs-url.type.d.ts +14 -0
- package/dist/services/vcs-client/entities/vcs-user.type.d.ts +3 -0
- package/dist/services/vcs-client/github/vcs-github-client.d.ts +31 -0
- package/dist/services/vcs-client/github/vcs-github-merge-requests.d.ts +40 -0
- package/dist/services/vcs-client/github/vcs-github-repository-files.d.ts +27 -0
- package/dist/services/vcs-client/gitlab/vcs-gitlab-client.d.ts +13 -4
- package/dist/services/vcs-client/gitlab/vcs-gitlab-merge-discussions.d.ts +16 -5
- package/dist/services/vcs-client/gitlab/vcs-gitlab-merge-requests.d.ts +24 -5
- package/dist/services/vcs-client/gitlab/vcs-gitlab-repository-files.d.ts +27 -0
- package/dist/services/vcs-client/parse-vcs-url.d.ts +3 -0
- package/dist/shared/backend/git/git-core.d.ts +24 -22
- package/dist/shared/backend/git/git-diff.d.ts +16 -5
- package/dist/shared/backend/rc/rc-config.d.ts +27 -15
- package/dist/shared/common/exec.d.ts +4 -6
- package/dist/shared/common/files.d.ts +1 -3
- package/dist/shared/common/language.d.ts +3 -6
- package/dist/shared/common/parse-args.d.ts +1 -4
- package/dist/shared/common/style.d.ts +3 -3
- package/dist/shared/common/think.d.ts +1 -5
- package/dist/shared/common/tokens.d.ts +1 -5
- package/dist/shared/common/unguard.d.ts +4 -8
- package/dist/shared/common/xml.d.ts +16 -12
- package/package.json +20 -4
- package/dist/.ai/agents/agent-resolve-conflicts.xml +0 -148
- package/dist/.ai/agents/agent-review-verifier.xml +0 -181
- package/dist/chunks/index-C4jt5WBP.js +0 -3548
- package/dist/chunks/services-Sb7TwLxt.js +0 -122
- package/dist/chunks/shared-D0kSJB49.js +0 -601
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
<GitSetup keywords="git, vcs, gitignore, branches, commits, hooks, history, tags, secrets, repo-bootstrap" type="infra-rules" ver="2.0">
|
|
2
|
+
<Mission>
|
|
3
|
+
Foundational git policy for every project: gitignore baseline, branch strategy, commit convention, history hygiene, tag/release semantics, hooks integration, secrets discipline, repo bootstrap.
|
|
4
|
+
|
|
5
|
+
Goal: a repo that is reproducible, auditable, safe — no accidental secret leaks, no platform-specific binaries committed, no fabricated «green» status hiding broken history. The repo is the project's canonical record; every commit is part of the audit trail.
|
|
6
|
+
|
|
7
|
+
Scope is git itself. Tool choice for hooks runner (lefthook / husky / simple-git-hooks) is the `git-hooks` category in the infrastructure scope discovery session. CI provider is the `ci` category. Both distinct from this rule.
|
|
8
|
+
</Mission>
|
|
9
|
+
|
|
10
|
+
<Belief_State>
|
|
11
|
+
<Axiom id="AX_GITIGNORE_BASELINE">
|
|
12
|
+
`.gitignore` covers three layers.
|
|
13
|
+
|
|
14
|
+
**Mandatory** (every project):
|
|
15
|
+
- `.claude/settings.local.json` (personal Claude Code overrides; team-shared `.claude/settings.json` IS tracked).
|
|
16
|
+
- `.env`, `.env.local`, `.env.*.local` (secrets; only `.env.example` with placeholders is tracked).
|
|
17
|
+
- OS artifacts: `.DS_Store`, `Thumbs.db`, `desktop.ini`.
|
|
18
|
+
- Editor caches: `.idea/`, `*.swp`, `.vscode/` (or selectively).
|
|
19
|
+
- Coverage: `coverage/`, `*.lcov`, `.nyc_output/`.
|
|
20
|
+
- Logs: `*.log`, `npm-debug.log*`, `yarn-error.log`, etc.
|
|
21
|
+
|
|
22
|
+
**Tool-derived** (per chosen stack from infrastructure scope discovery):
|
|
23
|
+
- Node: `node_modules/`, `dist/`, `.next/`, `.nuxt/`, `.cache/`.
|
|
24
|
+
- Python: `__pycache__/`, `*.pyc`, `.venv/`, `.pytest_cache/`, `.ruff_cache/`.
|
|
25
|
+
- Go: `vendor/` (if not committed by policy), build artifacts.
|
|
26
|
+
- Rust: `target/`.
|
|
27
|
+
|
|
28
|
+
**Environment-specific:** developer-team decision (e.g., `scripts/local/`).
|
|
29
|
+
|
|
30
|
+
Wrong here = secrets in repo, multi-GB bloat, platform-specific native binaries breaking CI.
|
|
31
|
+
</Axiom>
|
|
32
|
+
|
|
33
|
+
<Axiom id="AX_BRANCH_STRATEGY">
|
|
34
|
+
Pick one strategy at project init, document in README, enforce via remote branch protection.
|
|
35
|
+
|
|
36
|
+
| Strategy | When |
|
|
37
|
+
|---|---|
|
|
38
|
+
| `trunk-based` (recommended default) | small teams + strong CI; short-lived branches off `main`, merged within a day |
|
|
39
|
+
| `github-flow` | long-lived feature branches, PR-driven, no `develop` |
|
|
40
|
+
| `git-flow` | planned release cadences; `main` + `develop` + `release/*` + `hotfix/*` |
|
|
41
|
+
|
|
42
|
+
Default branch name: `main` (not `master`) — both locally and on remote.
|
|
43
|
+
|
|
44
|
+
Branch naming: `<type>/<short-description>`, where `type ∈ {feature, fix, chore, docs, refactor, test, perf}`. Lowercase, kebab-case.
|
|
45
|
+
|
|
46
|
+
Mixing strategies within one team multiplies merge confusion.
|
|
47
|
+
</Axiom>
|
|
48
|
+
|
|
49
|
+
<Axiom id="AX_COMMIT_CONVENTION">
|
|
50
|
+
Default: Conventional Commits format `<type>(<scope>): <subject>`. Alternatives acceptable with documented rationale.
|
|
51
|
+
|
|
52
|
+
Conventional Commits:
|
|
53
|
+
- Types: `feat`, `fix`, `docs`, `chore`, `refactor`, `test`, `perf`, `build`, `ci`, `style`, `revert`.
|
|
54
|
+
- Subject: imperative mood, ≤72 chars, no trailing period.
|
|
55
|
+
- Body (optional): wraps at 100 chars, blank line between subject and body.
|
|
56
|
+
- Footer: `BREAKING CHANGE: …`, issue refs, sign-off.
|
|
57
|
+
|
|
58
|
+
Example: `feat(auth): add OAuth2 PKCE flow for native clients`.
|
|
59
|
+
|
|
60
|
+
Acceptable alternatives (Decision Log entry required):
|
|
61
|
+
- **plain** — no type prefix, just imperative subject.
|
|
62
|
+
- **DCO sign-off** — `Signed-off-by: Name <email>` mandatory for licensing/legal; compatible with conventional commits.
|
|
63
|
+
|
|
64
|
+
Conventional Commits enables auto-changelog, semantic-release, machine-readable history.
|
|
65
|
+
</Axiom>
|
|
66
|
+
|
|
67
|
+
<Axiom id="AX_HISTORY_POLICY">
|
|
68
|
+
Linear history via rebase or squash-merge for PRs. Force-push forbidden on shared branches.
|
|
69
|
+
|
|
70
|
+
- **Shared** (force-push FORBIDDEN): `main`, `develop`, `release/*`, any branch with active PRs from others.
|
|
71
|
+
- **Personal** (force-push allowed): your own `feature/*`, `fix/*` until merged.
|
|
72
|
+
|
|
73
|
+
Merge strategies:
|
|
74
|
+
- `squash-merge` — feature branch becomes single commit on main. Simple history; loses commit granularity.
|
|
75
|
+
- `rebase-and-merge` — feature commits rebased onto main, no merge commit. Preserves granularity; requires clean local history.
|
|
76
|
+
- `merge commit` — discouraged unless branch shape must be preserved (e.g., release branches).
|
|
77
|
+
|
|
78
|
+
Hooks bypass: `--no-verify` is FORBIDDEN unless operator explicitly authorizes; if used, the bypass MUST be documented in commit body.
|
|
79
|
+
|
|
80
|
+
Shared-branch force-push silently rewrites history collaborators have already pulled. Recovery is manual and error-prone.
|
|
81
|
+
</Axiom>
|
|
82
|
+
|
|
83
|
+
<Axiom id="AX_DESTRUCTIVE_COMMANDS_REQUIRE_AUTH">
|
|
84
|
+
Destructive git commands risk silent data loss. NOT blanket-forbidden — they're tools — but each invocation requires explicit operator authorization recorded in the Execution Log.
|
|
85
|
+
|
|
86
|
+
**Requires explicit auth** (status `[!] BLOCKED` until operator confirms):
|
|
87
|
+
- `git reset --hard <ref>` — discards working tree + index changes since `<ref>`.
|
|
88
|
+
- `git restore .` (without specific path) — discards all uncommitted changes in working tree.
|
|
89
|
+
- `git restore --staged --worktree <path>` with broad path — same risk.
|
|
90
|
+
- `git clean -fd` / `-fdx` — deletes untracked files (and ignored-files with `-x`).
|
|
91
|
+
- `git checkout -- <path>` (or `git checkout HEAD -- <path>`) with broad path — discards uncommitted changes.
|
|
92
|
+
- `git push --force` / `--force-with-lease` on shared branches.
|
|
93
|
+
- `git branch -D <branch>` (force-delete unmerged) — distinct from `-d` (safe delete).
|
|
94
|
+
- `git rebase -i` — interactive history rewrite.
|
|
95
|
+
- `git reflog expire` / `git gc --prune=now` — drops recoverable history.
|
|
96
|
+
- `git filter-repo` / `git filter-branch` — bulk history rewrite.
|
|
97
|
+
|
|
98
|
+
**Protocol per invocation:**
|
|
99
|
+
1. State intent in Execution Log: «Need to <reason>; proposing <command>.»
|
|
100
|
+
2. Set status `[!] BLOCKED` per `AX_BLOCKER_ESCALATION` (in `task-execution`).
|
|
101
|
+
3. Wait for operator's explicit confirmation.
|
|
102
|
+
4. Only then run.
|
|
103
|
+
|
|
104
|
+
**Recovery first, destruction second.** Reflex «let me reset --hard and start over» is the failure mode this axiom prevents. Recovery options:
|
|
105
|
+
- `git reflog` — find lost commit/state.
|
|
106
|
+
- `git stash` — park uncommitted changes safely.
|
|
107
|
+
- `git revert` — inverse commit (preserves history).
|
|
108
|
+
- `git checkout <sha> -- <path>` — restore one file from a known-good commit.
|
|
109
|
+
|
|
110
|
+
Forbidden as habit: «let me just reset --hard and try again»; `git clean -fdx` to «free disk» without listing what will be deleted; `--force-with-lease` on `main` because it «sounds safer than --force» (both destructive on shared branches).
|
|
111
|
+
</Axiom>
|
|
112
|
+
|
|
113
|
+
<Axiom id="AX_TAG_RELEASE">
|
|
114
|
+
Semver tags: `vMAJOR.MINOR.PATCH`. Annotated tags only.
|
|
115
|
+
|
|
116
|
+
Format:
|
|
117
|
+
- Stable: `v1.2.3`.
|
|
118
|
+
- Pre-release: `v1.2.3-alpha.1`, `v1.2.3-beta.2`, `v1.2.3-rc.1`.
|
|
119
|
+
- Build metadata (optional, discouraged): `v1.2.3+20260507`.
|
|
120
|
+
|
|
121
|
+
Always annotated:
|
|
122
|
+
```
|
|
123
|
+
git tag -a v1.2.3 -m "Release 1.2.3 — <one-line summary>"
|
|
124
|
+
```
|
|
125
|
+
Lightweight tags (`git tag v1.2.3` without `-a`) are FORBIDDEN — no metadata, look identical to branch refs.
|
|
126
|
+
|
|
127
|
+
Push explicitly: `git push origin v1.2.3` (or `--tags` after release).
|
|
128
|
+
</Axiom>
|
|
129
|
+
|
|
130
|
+
<Axiom id="AX_HOOKS_INTEGRATION">
|
|
131
|
+
Hooks fire on every commit/push. Required hooks: `pre-commit` (lint + typecheck on staged, <5s), `commit-msg` (conventional-commits validator), `pre-push` (full test suite). Optional: `prepare-commit-msg` (prepend issue ID), `post-merge` (reinstall if lock changed). Hook config committed to repo; one onboarding command registers them (e.g. `lefthook install`).
|
|
132
|
+
</Axiom>
|
|
133
|
+
|
|
134
|
+
<Axiom id="AX_LFS_SUBMODULES">
|
|
135
|
+
LFS for large binaries. Submodules discouraged.
|
|
136
|
+
|
|
137
|
+
**Git LFS** — required when tracking binary files >100MB (GitHub hard limit; other hosts vary). Configure `.gitattributes`: `*.psd filter=lfs diff=lfs merge=lfs -text`. LFS adds infrastructure cost (storage, bandwidth quota) — use only when binaries are necessary.
|
|
138
|
+
|
|
139
|
+
**Submodules** — discouraged in favor of monorepo or package dependencies. If unavoidable: pin to specific commit (not branch); document in README why; expect fragile workflow (`git submodule update --init --recursive` after every checkout).
|
|
140
|
+
</Axiom>
|
|
141
|
+
|
|
142
|
+
<Axiom id="AX_SECRETS_DISCIPLINE">
|
|
143
|
+
Secrets never committed. On leak: rotate first, rewrite history second.
|
|
144
|
+
|
|
145
|
+
**Prevention:**
|
|
146
|
+
- `.env`, `.env.local`, `.env.*.local` always gitignored (`AX_GITIGNORE_BASELINE`).
|
|
147
|
+
- `.env.example` tracked with placeholder values to document required keys.
|
|
148
|
+
- Pre-commit hook scans staged files for secret patterns (recommended: `gitleaks`, `detect-secrets`, `trufflehog`).
|
|
149
|
+
- Code review checks for hardcoded credentials in any file extension.
|
|
150
|
+
|
|
151
|
+
**On leak detection:**
|
|
152
|
+
1. **Rotate the leaked credential immediately** (revoke + reissue). The credential is compromised the moment it hits a remote, regardless of subsequent rewrite.
|
|
153
|
+
2. Document incident: what leaked, when, who rotated, what notifications went out.
|
|
154
|
+
3. Optional: `git filter-repo` or BFG to scrub history, then force-push (coordinate with team).
|
|
155
|
+
|
|
156
|
+
Git history is forever. Once a secret reaches the remote, assume it's harvested by scanners within minutes. Rotation is mandatory; history rewrite is hygiene, not security.
|
|
157
|
+
</Axiom>
|
|
158
|
+
</Belief_State>
|
|
159
|
+
|
|
160
|
+
<Setup_Steps>
|
|
161
|
+
<!-- Ordered actions for initial git repository configuration.
|
|
162
|
+
Axioms in Belief_State define the WHY and invariants; these steps define the HOW and sequence. -->
|
|
163
|
+
<Step id="STEP_1_INIT_REPO">
|
|
164
|
+
Run `git init -b main` (or `git init` + `git branch -m main`). Default branch is `main`, never `master`.
|
|
165
|
+
</Step>
|
|
166
|
+
<Step id="STEP_2_CREATE_GITIGNORE">
|
|
167
|
+
Author `.gitignore` **before staging any other file** — first push is the riskiest moment for leaks. Mandatory entries: `.claude/settings.local.json`, `.env`/`.env.local`/`.env.*.local`, `.DS_Store`, `Thumbs.db`, `.idea/`, `*.swp`, `coverage/`, `*.log`. Add tool-derived entries per chosen stack (see AX_GITIGNORE_BASELINE for full reference).
|
|
168
|
+
</Step>
|
|
169
|
+
<Step id="STEP_3_CHOOSE_BRANCH_STRATEGY">
|
|
170
|
+
Choose one strategy — trunk-based (default for small teams with strong CI), github-flow (PR-driven), or git-flow (planned release cadences). Document in README. Immutable after first collaborator push.
|
|
171
|
+
</Step>
|
|
172
|
+
<Step id="STEP_4_FIRST_COMMIT">
|
|
173
|
+
Stage and commit foundational files only: `LICENSE`, `README.md`, `.gitignore`. Message: `chore: initial commit`. Never include `.env`, generated artifacts, `node_modules/`, or credentials in this or any commit.
|
|
174
|
+
</Step>
|
|
175
|
+
<Step id="STEP_5_CONFIGURE_REMOTE_AND_PROTECTION">
|
|
176
|
+
Add remote and push only after `.gitignore` is committed and verified. Before first feature work, configure branch protection on `main`: require PR before merge, require CI status checks, disallow force-push.
|
|
177
|
+
</Step>
|
|
178
|
+
<Step id="STEP_6_INSTALL_HOOKS">
|
|
179
|
+
Install hooks runner per infrastructure scope decision (lefthook / husky / simple-git-hooks). Commit config file (e.g. `lefthook.yml`). Register with one onboarding command. Configure: `pre-commit` (lint + typecheck on staged, target <5s), `commit-msg` (conventional commits), `pre-push` (full test suite).
|
|
180
|
+
</Step>
|
|
181
|
+
<Step id="STEP_7_VERIFY">
|
|
182
|
+
Confirm: `git status` clean; `.gitignore` covers all tool-generated paths; hooks fire on test commit; remote branch protection active.
|
|
183
|
+
</Step>
|
|
184
|
+
</Setup_Steps>
|
|
185
|
+
|
|
186
|
+
<Anti_Patterns>
|
|
187
|
+
<Anti_Pattern id="AP_NODE_MODULES_COMMITTED">
|
|
188
|
+
<Bad>`git add node_modules/` or `node_modules/` not in `.gitignore`</Bad>
|
|
189
|
+
<Why_Bad>10–500 MB bloat; macOS-compiled native binaries fail on Linux CI; PR diffs become unreadable. Lock file already encodes the dep tree deterministically.</Why_Bad>
|
|
190
|
+
<Good>`node_modules/` in `.gitignore`. `npm ci` / `pnpm install --frozen-lockfile` restores from lock file.</Good>
|
|
191
|
+
</Anti_Pattern>
|
|
192
|
+
|
|
193
|
+
<Anti_Pattern id="AP_FORCE_PUSH_TO_MAIN">
|
|
194
|
+
<Bad>`git push --force origin main`</Bad>
|
|
195
|
+
<Why_Bad>Silently rewrites history collaborators already pulled. Recovery requires every team member to reset their local branch — error-prone, sometimes impossible if uncommitted work is on top.</Why_Bad>
|
|
196
|
+
<Good>Force-push only on personal branches. Shared-branch issues fixed via revert commits.</Good>
|
|
197
|
+
</Anti_Pattern>
|
|
198
|
+
|
|
199
|
+
<Anti_Pattern id="AP_SECRET_IN_HISTORY">
|
|
200
|
+
<Bad>Committed `.env` with real API key, then `git rm` in next commit.</Bad>
|
|
201
|
+
<Why_Bad>The secret is in history. Anyone can `git log -p` and recover it. Public repos expose to scanners within seconds.</Why_Bad>
|
|
202
|
+
<Good>Rotate the credential immediately. Then rewrite history with `git filter-repo` and force-push (coordinate with team). Add `.env` to `.gitignore` BEFORE first push.</Good>
|
|
203
|
+
</Anti_Pattern>
|
|
204
|
+
|
|
205
|
+
<Anti_Pattern id="AP_NO_VERIFY_AS_HABIT">
|
|
206
|
+
<Bad>`git commit --no-verify` because pre-commit hook is «too slow».</Bad>
|
|
207
|
+
<Why_Bad>Hooks exist to catch mistakes locally. Routinely bypassing shifts mistakes into CI (slower, more expensive) or main (worse). Slow hook = fix the hook, don't skip it.</Why_Bad>
|
|
208
|
+
<Good>Diagnose hook slowness (lint scope too wide? full test suite in pre-commit instead of pre-push?). Optimize. `--no-verify` only with explicit operator authorization, documented in commit body.</Good>
|
|
209
|
+
</Anti_Pattern>
|
|
210
|
+
|
|
211
|
+
<Anti_Pattern id="AP_LIGHTWEIGHT_TAG">
|
|
212
|
+
<Bad>`git tag v1.2.3` (no `-a`).</Bad>
|
|
213
|
+
<Why_Bad>No tagger / date / message metadata. Looks identical to a branch ref in some tools. Release lineage unrecoverable.</Why_Bad>
|
|
214
|
+
<Good>`git tag -a v1.2.3 -m "Release 1.2.3 — <summary>"`. Always annotated for release tags.</Good>
|
|
215
|
+
</Anti_Pattern>
|
|
216
|
+
</Anti_Patterns>
|
|
217
|
+
|
|
218
|
+
<Verification_Hooks>
|
|
219
|
+
<Hook id="HOOK_GITIGNORE_PRESENT">
|
|
220
|
+
<Purpose>Verify `.gitignore` exists and is non-empty.</Purpose>
|
|
221
|
+
<Command>test -s .gitignore && echo "OK"</Command>
|
|
222
|
+
<Expected>Prints `OK`; exit 0.</Expected>
|
|
223
|
+
</Hook>
|
|
224
|
+
<Hook id="HOOK_NO_ENV_TRACKED">
|
|
225
|
+
<Purpose>Verify no `.env*` (except `.env.example`) is tracked.</Purpose>
|
|
226
|
+
<Command>git ls-files | grep -E '^\.env($|\.)' | grep -v '^\.env\.example$' | head -1 | grep -q . && echo "FAIL: .env tracked" || echo "OK"</Command>
|
|
227
|
+
<Expected>Prints `OK`; exit 0.</Expected>
|
|
228
|
+
</Hook>
|
|
229
|
+
<Hook id="HOOK_NO_NODE_MODULES_TRACKED">
|
|
230
|
+
<Purpose>Verify `node_modules/` is not tracked.</Purpose>
|
|
231
|
+
<Command>git ls-files node_modules 2>/dev/null | head -1 | grep -q . && echo "FAIL: node_modules tracked" || echo "OK"</Command>
|
|
232
|
+
<Expected>Prints `OK`; exit 0.</Expected>
|
|
233
|
+
</Hook>
|
|
234
|
+
<Hook id="HOOK_DEFAULT_BRANCH_MAIN">
|
|
235
|
+
<Purpose>Verify default branch is `main`.</Purpose>
|
|
236
|
+
<Command>git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | grep -q 'main$' && echo "OK" || echo "FAIL: default branch not main"</Command>
|
|
237
|
+
<Expected>Prints `OK`; exit 0.</Expected>
|
|
238
|
+
</Hook>
|
|
239
|
+
<Hook id="HOOK_TAG_ANNOTATED">
|
|
240
|
+
<Purpose>Verify all release tags are annotated (object type = tag, not commit).</Purpose>
|
|
241
|
+
<Command>for t in $(git tag); do test "$(git cat-file -t $t)" = "tag" || echo "FAIL: $t is lightweight"; done; echo "OK"</Command>
|
|
242
|
+
<Expected>Prints only `OK`; exit 0.</Expected>
|
|
243
|
+
</Hook>
|
|
244
|
+
</Verification_Hooks>
|
|
245
|
+
|
|
246
|
+
<Reward_Criteria>
|
|
247
|
+
✅ `.gitignore` covers mandatory + tool-derived layers; first commit only after `.gitignore` in place.
|
|
248
|
+
✅ Default branch is `main`; remote branch protection prevents direct push, requires PR + green checks.
|
|
249
|
+
✅ Commits follow chosen convention; subjects ≤72 chars, imperative mood.
|
|
250
|
+
✅ Shared-branch history is linear; release tags annotated, semver format.
|
|
251
|
+
✅ Hooks runner installed via single onboarding command; `--no-verify` only with operator auth.
|
|
252
|
+
✅ No `.env*` (except `.env.example`) tracked; pre-commit secret scanner in place.
|
|
253
|
+
✅ Destructive commands preceded by explicit operator authorization in Execution Log; recovery preferred over destruction.
|
|
254
|
+
|
|
255
|
+
❌ Secrets in history; `node_modules/` (or equivalent) committed.
|
|
256
|
+
❌ Force-push to shared branches; lightweight release tags.
|
|
257
|
+
❌ `--no-verify` as habit; default branch named `master` in new project.
|
|
258
|
+
❌ Destructive command run as «let me just reset --hard» reflex without operator authorization.
|
|
259
|
+
❌ `.claude/settings.local.json` tracked.
|
|
260
|
+
</Reward_Criteria>
|
|
261
|
+
</GitSetup>
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
<NodeJSNpmSetup keywords="nodejs, npm, package-manager, nvmrc, engines, module-system, esm, commonjs, node-builtins, lock-file, sandbox-registry, corp-registry" type="infra-rules" ver="2.0">
|
|
2
|
+
<Mission>
|
|
3
|
+
Canonical rules for the Node.js runtime environment: package manager discipline, version alignment, module system, project layout.
|
|
4
|
+
|
|
5
|
+
Goal: every Node.js project has a reproducible, explicit runtime setup — correct version pinning, one package manager, one module system. Same `npm ci` on the same `.nvmrc` produces the same environment everywhere.
|
|
6
|
+
|
|
7
|
+
Scope is the Node.js runtime layer ONLY. Language tooling (TypeScript, linters, formatters) and application architecture live in separate directives layered on top.
|
|
8
|
+
|
|
9
|
+
**Base axiom:** one package manager, one module system, one Node version per project. All three committed as files, not assumed.
|
|
10
|
+
</Mission>
|
|
11
|
+
|
|
12
|
+
<Belief_State>
|
|
13
|
+
<Axiom id="AX_SINGLE_PACKAGE_MANAGER">
|
|
14
|
+
One package manager per project: **npm only**. Forbidden alongside npm: yarn, pnpm, bun. `package-lock.json` is the lock; all other lock files must be absent and gitignored.
|
|
15
|
+
|
|
16
|
+
Multiple managers produce conflicting lock files and non-deterministic installs. If `yarn.lock`, `pnpm-lock.yaml`, or `bun.lockb` exist in the repo → remove them; add to `.gitignore`.
|
|
17
|
+
</Axiom>
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<Axiom id="AX_LOCK_FILE_DISCIPLINE">
|
|
21
|
+
`package-lock.json` always committed. `node_modules/` never committed.
|
|
22
|
+
|
|
23
|
+
`.nvmrc` + `package.json` + `package-lock.json` is the **reproducibility triad**. Without lock file, transitive deps re-resolve on every `npm install` → environment drift.
|
|
24
|
+
|
|
25
|
+
Usage split: `npm install` locally (may update lock when `package.json` changes); `npm ci` in any automated context (reads lock as law, never updates).
|
|
26
|
+
|
|
27
|
+
`.gitignore` MUST contain: `node_modules/`, `dist/`.
|
|
28
|
+
</Axiom>
|
|
29
|
+
|
|
30
|
+
<Axiom id="AX_EXACT_PINNING_FOR_TOOLING">
|
|
31
|
+
Dev-tool packages MUST be pinned to exact versions. `npm install --save-exact` for packages affecting the build pipeline.
|
|
32
|
+
|
|
33
|
+
A patch update to a build tool can silently change output. Exact pins guarantee the same tool version runs everywhere.
|
|
34
|
+
|
|
35
|
+
Rule: runtime deps (published with the package) may use ranges. Dev deps affecting build output MUST be exact.
|
|
36
|
+
|
|
37
|
+
Pattern: `"devDependencies": { "vite": "5.2.11" }`, not `"^5.2.0"` or `"~5.2"`.
|
|
38
|
+
</Axiom>
|
|
39
|
+
|
|
40
|
+
<Axiom id="AX_MODULE_SYSTEM_EXPLICIT">
|
|
41
|
+
Module system declared once and never mixed. Mixing `import` and `require` in the same project causes non-deterministic resolution and conditional-exports mismatches. Choose at init; set `"type": "module"` (ESM) or omit/`"commonjs"` (CJS) in `package.json`. Do NOT add `.mjs`/`.cjs` files without an explicit dual-package strategy.
|
|
42
|
+
</Axiom>
|
|
43
|
+
|
|
44
|
+
<Axiom id="AX_NODE_BUILTINS_PREFIX">
|
|
45
|
+
All Node.js built-in module imports use the `node:` prefix.
|
|
46
|
+
|
|
47
|
+
`node:` prefix is unambiguous — cannot be shadowed by an npm package with the same name. Also signals intent: «this is a Node built-in, not a third-party dependency».
|
|
48
|
+
|
|
49
|
+
Pattern: `import { readFile } from 'node:fs/promises'`, not `from 'fs/promises'`.
|
|
50
|
+
|
|
51
|
+
Applies to all built-ins: `fs`, `path`, `http`, `crypto`, `events`, `stream`, `url`, `util`, `os`, `child_process`, `worker_threads`, `perf_hooks`, etc.
|
|
52
|
+
</Axiom>
|
|
53
|
+
|
|
54
|
+
<Axiom id="AX_NPM_AGENT_SANDBOX_REGISTRY">
|
|
55
|
+
**Sandboxed agents force npm to use the public registry via inline POSIX env-prefix on every invocation. This bypasses any corporate `~/.npmrc` config that the sandbox cannot reach.**
|
|
56
|
+
|
|
57
|
+
The problem: operator's `~/.npmrc` typically points at a corporate registry/proxy reachable only from inside corp network. A sandboxed agent doesn't have access → `npm install` hangs on `ENOTFOUND` / `EAI_AGAIN` or fails.
|
|
58
|
+
|
|
59
|
+
**Solution — force public registry per command:**
|
|
60
|
+
```bash
|
|
61
|
+
npm_config_registry=https://registry.npmjs.org/ npm install
|
|
62
|
+
npm_config_registry=https://registry.npmjs.org/ npm view <pkg>
|
|
63
|
+
npm_config_registry=https://registry.npmjs.org/ npm ci
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Why inline prefix:
|
|
67
|
+
- Bypasses corp `~/.npmrc` without modifying it (operator's local setup intact).
|
|
68
|
+
- No persistent state in shell env — nothing leaks between commands.
|
|
69
|
+
- Self-documenting in logs — operator sees exactly which registry was used.
|
|
70
|
+
- Sandbox-friendly — no dependency on inherited env from launch context.
|
|
71
|
+
|
|
72
|
+
Mechanism: npm config priority — CLI flags > `npm_config_*` env vars > project `.npmrc` > `~/.npmrc` > `/etc/npmrc` > defaults. POSIX `VAR=value command` makes the variable visible to the spawned process only.
|
|
73
|
+
|
|
74
|
+
**When corp registry IS required** (project legitimately depends on private corp packages):
|
|
75
|
+
- Explicit deviation, declared at infrastructure scope discovery time, recorded in Decision Log.
|
|
76
|
+
- Agent halts with `[!] BLOCKED` per `AX_BLOCKER_ESCALATION`; operator handles install in their full-network shell, OR explicit network-access grant for the sandbox.
|
|
77
|
+
- Auth for corp registry is out of scope — environment concern, not agent's responsibility.
|
|
78
|
+
|
|
79
|
+
**Forbidden:** `npm install` without env-prefix in sandbox (routes through corp `~/.npmrc`, hangs); modifying operator's `~/.npmrc` (breaks operator's other work); committing project `.npmrc` with corp registry URL; silent failure / partial install when registry unreachable (operator must see explicit error).
|
|
80
|
+
</Axiom>
|
|
81
|
+
|
|
82
|
+
<Axiom id="AX_PROJECT_LAYOUT">
|
|
83
|
+
Standard layout:
|
|
84
|
+
- `src/` — source files (JS or TS).
|
|
85
|
+
- `dist/` — build output; generated, not committed.
|
|
86
|
+
- `cli/` — CLI entry points if project exposes a CLI.
|
|
87
|
+
- `scripts/` — internal dev/build scripts, not shipped.
|
|
88
|
+
- `tests/` or co-located `*.test.*` — test files.
|
|
89
|
+
|
|
90
|
+
Predictable layout reduces onboarding cost and enables tooling to infer build steps without configuration. Different layout allowed only when documented explicitly with stated reason.
|
|
91
|
+
</Axiom>
|
|
92
|
+
|
|
93
|
+
<Axiom id="AX_AI_FIRST_SCRIPTS_ONE_SHOT">
|
|
94
|
+
**Every primary npm script MUST be one-shot — returns control deterministically. Watch / persistent / REPL modes live in separate `:watch` / `:dev` scripts.**
|
|
95
|
+
|
|
96
|
+
AI agents (and CI runners) invoke scripts and wait for exit. A script defaulting to watch (e.g., `vitest`, `tsc --watch`, `next dev`) hangs the session — output streams forever, no exit code, no continuation. Agent has no way to distinguish «still working» from «ready, waiting for changes». Most common cause of stuck infra-setup tasks.
|
|
97
|
+
|
|
98
|
+
| Script | Behavior | Used by |
|
|
99
|
+
|---|---|---|
|
|
100
|
+
| `test` | one-shot, exits | agents, CI, smoke tests |
|
|
101
|
+
| `test:watch` | watch mode, persistent | human dev |
|
|
102
|
+
| `lint` | one-shot, exits | agents, CI, pre-commit |
|
|
103
|
+
| `lint:watch` | watch (rare) | human dev |
|
|
104
|
+
| `build` | one-shot, exits | agents, CI |
|
|
105
|
+
| `dev` | long-running dev server | human dev only |
|
|
106
|
+
| `start` | long-running prod server | deployment runtime |
|
|
107
|
+
| `start:check` | boot, smoke-ping, exit | agents (smoke-test deployment) |
|
|
108
|
+
|
|
109
|
+
**Forbidden in `package.json` scripts:**
|
|
110
|
+
- `"test": "vitest"` (defaults to watch in TTY) — must be `"vitest run"`.
|
|
111
|
+
- `"test": "jest --watch"` — watch by default; must be `"jest"`.
|
|
112
|
+
- `"test": "node --test --watch"` — must be `"node --test"`.
|
|
113
|
+
- Any primary script that doesn't terminate without manual interrupt.
|
|
114
|
+
|
|
115
|
+
For `dev`/`start`: inherently long-running; agents MUST NOT invoke directly during task-execution. Need server smoke-test → declare separate `:check` script that boots, pings, exits within timeout.
|
|
116
|
+
|
|
117
|
+
Verification: before declaring infra-setup DONE, run each primary script and confirm exit (any code) within reasonable time. Hang >2 minutes without progress = violation.
|
|
118
|
+
</Axiom>
|
|
119
|
+
|
|
120
|
+
<Axiom id="AX_DEPENDENCY_ADDITION_CHECKLIST">
|
|
121
|
+
Before adding any dependency, verify three things:
|
|
122
|
+
1. **Node compatibility:** `npm view <pkg> engines` — supports version in `.nvmrc`?
|
|
123
|
+
2. **Module system compatibility:** package ESM-only / CJS-only / dual? Matches project's `"type"`?
|
|
124
|
+
3. **Pinning discipline:** dev tool → `--save-exact`; runtime dep → range acceptable.
|
|
125
|
+
|
|
126
|
+
Skipping these introduces incompatibilities that surface as cryptic runtime errors, not install errors.
|
|
127
|
+
</Axiom>
|
|
128
|
+
</Belief_State>
|
|
129
|
+
|
|
130
|
+
<Setup_Steps>
|
|
131
|
+
<!-- Ordered actions for initial Node.js/npm project configuration.
|
|
132
|
+
Axioms in Belief_State define the WHY and invariants; these steps define the HOW and sequence. -->
|
|
133
|
+
<Step id="STEP_1_CREATE_NVMRC">
|
|
134
|
+
Create `.nvmrc`. **One line, exact semver** — e.g. `22.14.0`. Not `22`, `22.x`, or `lts/iron`. Ranges and aliases produce unpredictable resolution across machines and time. Content must match `/^\d+\.\d+\.\d+$/`. Commit this file.
|
|
135
|
+
</Step>
|
|
136
|
+
<Step id="STEP_2_INIT_PACKAGE_JSON">
|
|
137
|
+
Create or update `package.json`. Required fields:
|
|
138
|
+
- `"type"`: `"module"` (ESM) or `"commonjs"` — choose one explicitly, never mix `import`/`require` within the project.
|
|
139
|
+
- `"engines": { "node": ">=X.0.0 <Y.0.0" }` — aligned with `.nvmrc` major. E.g. `.nvmrc=22.14.0` → `">=22.0.0 <23.0.0"`. Misalignment is the primary cause of «works locally, fails in CI».
|
|
140
|
+
</Step>
|
|
141
|
+
<Step id="STEP_3_CREATE_NPMRC">
|
|
142
|
+
Create `.npmrc`. **Required**: `registry=https://registry.npmjs.org/` (or operator-supplied registry URL — never infer silently; source from operator interactively if non-default). Commit this file. Auth tokens MUST NOT be committed — use environment variables or per-user `~/.npmrc`.
|
|
143
|
+
</Step>
|
|
144
|
+
<Step id="STEP_4_GITIGNORE_ENTRIES">
|
|
145
|
+
Ensure `.gitignore` contains: `node_modules/` and `dist/`. Without this `package-lock.json` becomes the only lock-file guarantee — `node_modules/` committed bloats the repo with platform binaries.
|
|
146
|
+
</Step>
|
|
147
|
+
<Step id="STEP_5_INSTALL_DEPENDENCIES">
|
|
148
|
+
Install dependencies. In a sandboxed agent environment prefix every `npm` invocation with inline env-prefix: `npm_config_registry=https://registry.npmjs.org/ npm install`. Dev tools that affect build output: `--save-exact`. Runtime deps: range acceptable. See AX_NPM_AGENT_SANDBOX_REGISTRY for full sandboxing rationale.
|
|
149
|
+
</Step>
|
|
150
|
+
<Step id="STEP_6_DECLARE_NPM_SCRIPTS">
|
|
151
|
+
Add primary scripts to `package.json`. Rules: (a) only add a script if the tool is in `devDependencies`; (b) every primary script MUST be one-shot — exits with code, no watch mode (see AX_AI_FIRST_SCRIPTS_ONE_SHOT). Watch variants live in separate `:watch`/`:dev` scripts. Conventional names: `build`, `test`, `lint`, `format`, `type-check`, `clean`.
|
|
152
|
+
</Step>
|
|
153
|
+
<Step id="STEP_7_COMPOSE_CHECK_SCRIPT">
|
|
154
|
+
Add `check` script to `package.json` — the single quality entry point called by all task tickets. Compose it from the `<CheckPhase>` values of every active rule in this scope, ordered by `CheckPhaseOrder` from `ai/directives/knowledge.xml` (typecheck → test → lint → format). Include only phases with at least one active rule. All sub-commands must be one-shot. Declare `check-command → npm run check` in infra-spec §Verification Commands.
|
|
155
|
+
</Step>
|
|
156
|
+
<Step id="STEP_8_VERIFY_REPRODUCIBILITY_TRIAD">
|
|
157
|
+
Confirm three files committed: `.nvmrc`, `package.json`, `package-lock.json` (`npm ci` reads all three). Run HOOK_NVMRC_EXACT and HOOK_NPMRC_REGISTRY. Run each primary script — must exit within 2 minutes; hang = watch-mode violation.
|
|
158
|
+
</Step>
|
|
159
|
+
</Setup_Steps>
|
|
160
|
+
|
|
161
|
+
<Definitions>
|
|
162
|
+
<Definition id="DEF_REPRODUCIBILITY_TRIAD">Three committed files guaranteeing reproducible Node.js environment: `.nvmrc` (Node version), `package.json` (declared deps), `package-lock.json` (resolved dep tree). `npm ci` reads all three.</Definition>
|
|
163
|
+
<Definition id="DEF_EXACT_PIN">A version string with no range operator: `5.2.11`, not `^5.2.0`, `~5.2`, or `5.x`.</Definition>
|
|
164
|
+
<Definition id="DEF_ESM">ECMAScript Modules. Activated by `"type": "module"`. Syntax: `import`/`export`. Local imports require explicit extensions.</Definition>
|
|
165
|
+
<Definition id="DEF_CJS">CommonJS. Default when `"type"` is absent or `"commonjs"`. Syntax: `require`/`module.exports`. Synchronous resolution.</Definition>
|
|
166
|
+
</Definitions>
|
|
167
|
+
|
|
168
|
+
<Code_Patterns>
|
|
169
|
+
<Pattern id="PT_MINIMAL_PACKAGE_JSON">
|
|
170
|
+
<Intent>Minimal valid `package.json`: explicit module system, engines aligned, exact dev-tool pins.</Intent>
|
|
171
|
+
<Snippet language="json">
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"name": "my-project",
|
|
175
|
+
"version": "1.0.0",
|
|
176
|
+
"type": "module",
|
|
177
|
+
"engines": { "node": ">=22.0.0 <23.0.0" },
|
|
178
|
+
"scripts": {
|
|
179
|
+
"build": "vite build",
|
|
180
|
+
"test": "node --test"
|
|
181
|
+
},
|
|
182
|
+
"dependencies": { "some-lib": "^3.1.0" },
|
|
183
|
+
"devDependencies": { "vite": "5.2.11" }
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
</Snippet>
|
|
187
|
+
<Why>`"type": "module"` makes ESM explicit. `engines` bounds Node version. `vite` exact-pinned (build tool); `some-lib` uses range (runtime dep).</Why>
|
|
188
|
+
</Pattern>
|
|
189
|
+
|
|
190
|
+
<Pattern id="PT_NVMRC">
|
|
191
|
+
<Intent>Correct `.nvmrc`: one line, exact semver.</Intent>
|
|
192
|
+
<Snippet language="plaintext">22.14.0</Snippet>
|
|
193
|
+
<Why>Single exact version. `nvm use` resolves unambiguously. No range, no alias, no comments.</Why>
|
|
194
|
+
</Pattern>
|
|
195
|
+
|
|
196
|
+
<Pattern id="PT_NPMRC">
|
|
197
|
+
<Intent>`.npmrc` with explicit registry; credentials excluded.</Intent>
|
|
198
|
+
<Snippet language="plaintext">
|
|
199
|
+
registry=https://registry.npmjs.org/
|
|
200
|
+
audit=true
|
|
201
|
+
legacy-peer-deps=false
|
|
202
|
+
</Snippet>
|
|
203
|
+
<Why>Registry explicit. Audit on by default. No auth tokens — those go in env vars or per-user `~/.npmrc`.</Why>
|
|
204
|
+
</Pattern>
|
|
205
|
+
|
|
206
|
+
<Pattern id="PT_ESM_BUILTINS">
|
|
207
|
+
<Intent>ESM imports of Node built-ins with `node:` prefix and explicit local extensions.</Intent>
|
|
208
|
+
<Snippet language="javascript">
|
|
209
|
+
```js
|
|
210
|
+
import { readFile } from 'node:fs/promises';
|
|
211
|
+
import { createServer } from 'node:http';
|
|
212
|
+
import { resolve } from 'node:path';
|
|
213
|
+
|
|
214
|
+
import { parseConfig } from './config.js'; // explicit .js extension
|
|
215
|
+
```
|
|
216
|
+
</Snippet>
|
|
217
|
+
<Why>`node:` prefix prevents shadowing. Explicit `.js` extensions required in ESM for Node to resolve local files correctly.</Why>
|
|
218
|
+
</Pattern>
|
|
219
|
+
|
|
220
|
+
<Pattern id="PT_DEPENDENCY_ADDITION">
|
|
221
|
+
<Intent>Correct workflow for adding a new package.</Intent>
|
|
222
|
+
<Snippet language="bash">
|
|
223
|
+
```bash
|
|
224
|
+
# 1 — Node compatibility
|
|
225
|
+
npm view express engines
|
|
226
|
+
|
|
227
|
+
# 2 — module system (look for "exports", "type")
|
|
228
|
+
npm view express main exports
|
|
229
|
+
|
|
230
|
+
# 3 — install with correct pinning
|
|
231
|
+
npm install express # runtime dep — range ok
|
|
232
|
+
npm install --save-exact --save-dev vite # build tool — exact pin
|
|
233
|
+
|
|
234
|
+
# 4 — commit both files
|
|
235
|
+
git add package.json package-lock.json
|
|
236
|
+
```
|
|
237
|
+
</Snippet>
|
|
238
|
+
<Why>Verification before install prevents silent incompatibilities. Committing lock with package.json closes the reproducibility triad.</Why>
|
|
239
|
+
</Pattern>
|
|
240
|
+
</Code_Patterns>
|
|
241
|
+
|
|
242
|
+
<Anti_Patterns>
|
|
243
|
+
<Anti_Pattern id="AP_MULTIPLE_LOCK_FILES">
|
|
244
|
+
<Bad>Repo has both `package-lock.json` AND `yarn.lock` AND/OR `pnpm-lock.yaml`.</Bad>
|
|
245
|
+
<Why_Bad>Each manager resolves transitive deps differently. `npm ci` reads `package-lock.json`; developer running `yarn` writes `yarn.lock` with different versions. Builds diverge silently.</Why_Bad>
|
|
246
|
+
<Good>Only `package-lock.json` tracked. Foreign locks deleted + added to `.gitignore`.</Good>
|
|
247
|
+
</Anti_Pattern>
|
|
248
|
+
|
|
249
|
+
<Anti_Pattern id="AP_NVMRC_ENGINES_MISMATCH">
|
|
250
|
+
<Bad>`.nvmrc=22.14.0` + `"engines": { "node": ">=18.0.0 <20.0.0" }`.</Bad>
|
|
251
|
+
<Why_Bad>`.nvmrc` installs Node 22; `engines` rejects Node 22. npm warns; CI may enforce constraint and fail. Local dev and CI run on different Node versions.</Why_Bad>
|
|
252
|
+
<Good>`.nvmrc=22.14.0` + `"engines": { "node": ">=22.0.0 <23.0.0" }`.</Good>
|
|
253
|
+
</Anti_Pattern>
|
|
254
|
+
|
|
255
|
+
<Anti_Pattern id="AP_NVMRC_RANGE">
|
|
256
|
+
<Bad>`.nvmrc` contains `22` (range) or `lts/iron` (alias).</Bad>
|
|
257
|
+
<Why_Bad>`nvm use 22` resolves to whatever the latest 22.x is at install time — different on different machines and at different moments.</Why_Bad>
|
|
258
|
+
<Good>`.nvmrc` contains `22.14.0` exact.</Good>
|
|
259
|
+
</Anti_Pattern>
|
|
260
|
+
|
|
261
|
+
<Anti_Pattern id="AP_NODE_MODULES_COMMITTED">
|
|
262
|
+
<Bad>`git ls-files | grep '^node_modules/'` returns hits.</Bad>
|
|
263
|
+
<Why_Bad>10–500 MB bloat. Platform-specific native binaries compiled on macOS won't run on Linux CI. PR diffs become unreadable.</Why_Bad>
|
|
264
|
+
<Good>`.gitignore` includes `node_modules/`, `dist/`. `npm ci` restores from `package-lock.json` deterministically.</Good>
|
|
265
|
+
</Anti_Pattern>
|
|
266
|
+
|
|
267
|
+
<Anti_Pattern id="AP_MIXED_MODULE_SYSTEM">
|
|
268
|
+
<Bad>`package.json` has `"type": "module"`, but `src/loader.js` uses `const fs = require('fs'); module.exports = …`.</Bad>
|
|
269
|
+
<Why_Bad>`"type": "module"` makes all `.js` files ESM. Using `require` in ESM file throws `ReferenceError: require is not defined` at runtime.</Why_Bad>
|
|
270
|
+
<Good>ESM project: `import { readFile } from 'node:fs/promises'; export { load };`.</Good>
|
|
271
|
+
</Anti_Pattern>
|
|
272
|
+
|
|
273
|
+
<Anti_Pattern id="AP_BUILTIN_WITHOUT_PREFIX">
|
|
274
|
+
<Bad>`import { readFile } from 'fs/promises';` / `import { join } from 'path';`.</Bad>
|
|
275
|
+
<Why_Bad>A third-party package named `fs` or `path` would shadow the built-in silently. Intent ambiguous: built-in or dependency?</Why_Bad>
|
|
276
|
+
<Good>`import { readFile } from 'node:fs/promises';` / `import { join } from 'node:path';`.</Good>
|
|
277
|
+
</Anti_Pattern>
|
|
278
|
+
|
|
279
|
+
<Anti_Pattern id="AP_TOOL_RANGE_PIN">
|
|
280
|
+
<Bad>`"devDependencies": { "vite": "^5.2.0", "prettier": "3.x" }`.</Bad>
|
|
281
|
+
<Why_Bad>Semver-compatible update can silently change build output. CI installs 5.2.11 today, 5.2.12 next week — builds diverge.</Why_Bad>
|
|
282
|
+
<Good>`"devDependencies": { "vite": "5.2.11", "prettier": "3.2.5" }`.</Good>
|
|
283
|
+
</Anti_Pattern>
|
|
284
|
+
|
|
285
|
+
<Anti_Pattern id="AP_NPMRC_ABSENT">
|
|
286
|
+
<Bad>No `.npmrc` in the repository.</Bad>
|
|
287
|
+
<Why_Bad>Each developer and CI runner resolves from whatever registry their global `~/.npmrc` points to. Private-registry users silently fall back to public or fail with 404.</Why_Bad>
|
|
288
|
+
<Good>Committed `.npmrc` with `registry=https://registry.npmjs.org/`.</Good>
|
|
289
|
+
</Anti_Pattern>
|
|
290
|
+
</Anti_Patterns>
|
|
291
|
+
|
|
292
|
+
<Verification_Hooks>
|
|
293
|
+
<Hook id="HOOK_NVMRC_EXACT">
|
|
294
|
+
<Purpose>`.nvmrc` exists, one line, semver-exact.</Purpose>
|
|
295
|
+
<Command>test -f .nvmrc && [ "$(wc -l < .nvmrc)" -eq 1 ] && grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$' .nvmrc && echo "OK"</Command>
|
|
296
|
+
<Expected>Prints `OK`; exit 0.</Expected>
|
|
297
|
+
</Hook>
|
|
298
|
+
<Hook id="HOOK_ENGINES_PRESENT">
|
|
299
|
+
<Purpose>`package.json` contains `engines.node`.</Purpose>
|
|
300
|
+
<Command>node -e "const p=require('./package.json'); if(!p.engines?.node) process.exit(1); console.log('engines.node:', p.engines.node)"</Command>
|
|
301
|
+
<Expected>Prints `engines.node: <range>`; exit 0.</Expected>
|
|
302
|
+
</Hook>
|
|
303
|
+
<Hook id="HOOK_LOCK_FILE_EXISTS">
|
|
304
|
+
<Purpose>`package-lock.json` present.</Purpose>
|
|
305
|
+
<Command>test -f package-lock.json && echo "OK"</Command>
|
|
306
|
+
<Expected>Prints `OK`; exit 0.</Expected>
|
|
307
|
+
</Hook>
|
|
308
|
+
<Hook id="HOOK_NO_NODE_MODULES_TRACKED">
|
|
309
|
+
<Purpose>`node_modules/` not tracked by git.</Purpose>
|
|
310
|
+
<Command>git ls-files node_modules | head -1 | grep -q . && echo "FAIL: node_modules tracked" || echo "OK"</Command>
|
|
311
|
+
<Expected>Prints `OK`; exit 0.</Expected>
|
|
312
|
+
</Hook>
|
|
313
|
+
<Hook id="HOOK_NO_FOREIGN_LOCK_FILES">
|
|
314
|
+
<Purpose>No foreign lock files exist.</Purpose>
|
|
315
|
+
<Command>for f in yarn.lock pnpm-lock.yaml bun.lockb; do test -f "$f" && echo "FAIL: $f present"; done; echo "OK"</Command>
|
|
316
|
+
<Expected>Prints only `OK`; exit 0.</Expected>
|
|
317
|
+
</Hook>
|
|
318
|
+
<Hook id="HOOK_NPMRC_REGISTRY">
|
|
319
|
+
<Purpose>`.npmrc` exists and declares registry.</Purpose>
|
|
320
|
+
<Command>test -f .npmrc && grep -q 'registry=' .npmrc && echo "OK"</Command>
|
|
321
|
+
<Expected>Prints `OK`; exit 0.</Expected>
|
|
322
|
+
</Hook>
|
|
323
|
+
<Hook id="HOOK_MODULE_SYSTEM_DECLARED">
|
|
324
|
+
<Purpose>Report declared module system.</Purpose>
|
|
325
|
+
<Command>node -e "const p=require('./package.json'); console.log('module system:', p.type || 'commonjs (default)')"</Command>
|
|
326
|
+
<Expected>Prints `module system: module` or `module system: commonjs (default)`.</Expected>
|
|
327
|
+
</Hook>
|
|
328
|
+
</Verification_Hooks>
|
|
329
|
+
|
|
330
|
+
<Reward_Criteria>
|
|
331
|
+
✅ `.nvmrc` exists, one line, exact semver. `package.json#engines.node` accepts the version in `.nvmrc`.
|
|
332
|
+
✅ Only `npm` used; `package-lock.json` committed; no foreign lock files. `node_modules/` gitignored.
|
|
333
|
+
✅ Module system declared once; not mixed. All Node built-in imports use `node:` prefix.
|
|
334
|
+
✅ Dev-tool packages exact-pinned. `.npmrc` committed with explicit `registry=` line.
|
|
335
|
+
✅ npm scripts call only tools in `devDependencies`. Primary scripts (`test`, `lint`, `build`, `type-check`) one-shot.
|
|
336
|
+
✅ `check` script exists in `package.json`. Composed of all active rule phases in `CheckPhaseOrder` (typecheck → test → lint → format). `check-command` declared in infra-spec §Verification Commands.
|
|
337
|
+
✅ Before adding a package: `engines` and module-system compatibility verified.
|
|
338
|
+
✅ Sandboxed agent forces public registry via inline env-prefix on every npm invocation.
|
|
339
|
+
✅ Corp registry required → agent halts `[!] BLOCKED`, defers to operator's full-network shell.
|
|
340
|
+
|
|
341
|
+
❌ `.nvmrc` missing / contains range / alias / multiple lines.
|
|
342
|
+
❌ `package.json#engines` absent or incompatible with `.nvmrc`.
|
|
343
|
+
❌ Foreign lock files present; `package-lock.json` missing or not committed.
|
|
344
|
+
❌ `node_modules/` committed or not in `.gitignore`.
|
|
345
|
+
❌ Module system mixed (`import` and `require` coexist in `.js`).
|
|
346
|
+
❌ Node built-in imported without `node:` prefix.
|
|
347
|
+
❌ Dev-tool pinned to range; `.npmrc` absent or no `registry=` line.
|
|
348
|
+
❌ npm script calls a tool not in `devDependencies`.
|
|
349
|
+
❌ `check` script missing from `package.json` when coding or testing rules are active in scope.
|
|
350
|
+
❌ `check` script omits a phase covered by an active rule (e.g., lint active but not in `check`).
|
|
351
|
+
❌ Any phase sub-command in `check` defaults to watch / persistent mode — agent invocations hang indefinitely.
|
|
352
|
+
❌ `npm install` without env-prefix in sandbox; modifying operator's `~/.npmrc`; committing project `.npmrc` with corp registry URL.
|
|
353
|
+
</Reward_Criteria>
|
|
354
|
+
</NodeJSNpmSetup>
|