@cbartens/bkit 0.0.0-stage → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.bkit/README.md +417 -0
- package/.bkit/core/.agents/context.md +95 -0
- package/.bkit/core/.agents/docs.md +62 -0
- package/.bkit/core/.agents/rules.md +147 -0
- package/.bkit/core/.agents/skills.md +43 -0
- package/.bkit/core/.bkit/LICENSE.md +151 -0
- package/.bkit/core/.bkit/README.md +417 -0
- package/.bkit/core/.bkit/cloud.md +493 -0
- package/.bkit/core/.bkit/comparison.md +321 -0
- package/.bkit/core/.bkit/install.md +401 -0
- package/.bkit/core/.bkit/jsonl.md +497 -0
- package/.bkit/core/.bkit/prompts.md +474 -0
- package/.bkit/core/.bkit/providers.md +598 -0
- package/.bkit/core/.bkit/templates.md +470 -0
- package/.bkit/core/.bkit/trackers.md +95 -0
- package/.bkit/core/.bkit/workflows.md +1550 -0
- package/.bkit/core/.claude/hooks/bkit-gateguard.cjs +82 -0
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +93 -0
- package/.bkit/core/.claude/hooks/bkit-preflight.sh +74 -0
- package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +115 -0
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +135 -0
- package/.bkit/core/.cursor/hooks/bkit-gateguard.cjs +111 -0
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +169 -0
- package/.bkit/core/.cursor/hooks/bkit-preflight.sh +63 -0
- package/.bkit/core/.opencode/plugin/bkit-gateguard.js +225 -0
- package/.bkit/core/AGENTS.md +77 -0
- package/.bkit/core/LICENSE.md +149 -0
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +272 -0
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +223 -0
- package/.bkit/core/docs/templates/bkit-audit-agents.md +230 -0
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +227 -0
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +266 -0
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +230 -0
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +270 -0
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +254 -0
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +221 -0
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +241 -0
- package/.bkit/core/docs/templates/bkit-audit-config.md +230 -0
- package/.bkit/core/docs/templates/bkit-audit-cost.md +218 -0
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +221 -0
- package/.bkit/core/docs/templates/bkit-audit-database.md +229 -0
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +251 -0
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +283 -0
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +268 -0
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +280 -0
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +253 -0
- package/.bkit/core/docs/templates/bkit-audit-failures.md +259 -0
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +237 -0
- package/.bkit/core/docs/templates/bkit-audit-gates.md +250 -0
- package/.bkit/core/docs/templates/bkit-audit-issues.md +273 -0
- package/.bkit/core/docs/templates/bkit-audit-llm.md +239 -0
- package/.bkit/core/docs/templates/bkit-audit-logs.md +266 -0
- package/.bkit/core/docs/templates/bkit-audit-models.md +210 -0
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +211 -0
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +216 -0
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +220 -0
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +222 -0
- package/.bkit/core/docs/templates/bkit-audit-repo.md +224 -0
- package/.bkit/core/docs/templates/bkit-audit-security.md +274 -0
- package/.bkit/core/docs/templates/bkit-audit-slop.md +200 -0
- package/.bkit/core/docs/templates/bkit-audit-testing.md +270 -0
- package/.bkit/core/docs/templates/bkit-audit-usability.md +237 -0
- package/.bkit/core/docs/templates/bkit-plan.md +476 -0
- package/.bkit/core/engine/checks/after/auth.ts +149 -0
- package/.bkit/core/engine/checks/after/ci-yml.ts +701 -0
- package/.bkit/core/engine/checks/after/github.ts +424 -0
- package/.bkit/core/engine/checks/after/index.ts +530 -0
- package/.bkit/core/engine/checks/after/managed.ts +217 -0
- package/.bkit/core/engine/checks/after/suppression.ts +53 -0
- package/.bkit/core/engine/checks/after/tools.ts +427 -0
- package/.bkit/core/engine/checks/before/context-fetch.ts +429 -0
- package/.bkit/core/engine/checks/before/env.ts +187 -0
- package/.bkit/core/engine/checks/before/files.ts +204 -0
- package/.bkit/core/engine/checks/before/index.ts +206 -0
- package/.bkit/core/engine/checks/before/mcp.ts +127 -0
- package/.bkit/core/engine/checks/before/repo.ts +77 -0
- package/.bkit/core/engine/checks/before/version.ts +67 -0
- package/.bkit/core/engine/checks/status-holes.ts +479 -0
- package/.bkit/core/engine/cli.ts +867 -0
- package/.bkit/core/engine/commands/analysis.ts +550 -0
- package/.bkit/core/engine/commands/ci/ci.ts +483 -0
- package/.bkit/core/engine/commands/comply.ts +415 -0
- package/.bkit/core/engine/commands/harvest.ts +459 -0
- package/.bkit/core/engine/commands/install/check.ts +70 -0
- package/.bkit/core/engine/commands/install/doctor.ts +254 -0
- package/.bkit/core/engine/commands/install/install.ts +550 -0
- package/.bkit/core/engine/commands/install/uninstall.ts +995 -0
- package/.bkit/core/engine/commands/install/upgrade.ts +1037 -0
- package/.bkit/core/engine/commands/launch.ts +139 -0
- package/.bkit/core/engine/commands/lib.ts +495 -0
- package/.bkit/core/engine/commands/registry.ts +53 -0
- package/.bkit/core/engine/commands/setup/setup.ts +184 -0
- package/.bkit/core/engine/commands/telemetry.ts +32 -0
- package/.bkit/core/engine/commands/workflow/branches.ts +1514 -0
- package/.bkit/core/engine/commands/workflow/context.ts +961 -0
- package/.bkit/core/engine/commands/workflow/counters.ts +268 -0
- package/.bkit/core/engine/commands/workflow/fids.ts +243 -0
- package/.bkit/core/engine/commands/workflow/issues.ts +675 -0
- package/.bkit/core/engine/commands/workflow/ledgers.ts +575 -0
- package/.bkit/core/engine/commands/workflow/locks.ts +478 -0
- package/.bkit/core/engine/commands/workflow/prs.ts +1087 -0
- package/.bkit/core/engine/commands/workflow/repo.ts +220 -0
- package/.bkit/core/engine/commands/workflow/roadmap.ts +576 -0
- package/.bkit/core/engine/commands/workflow/runs.ts +2140 -0
- package/.bkit/core/engine/commands/workflow/runtime.ts +300 -0
- package/.bkit/core/engine/commands/workflow/skills.ts +118 -0
- package/.bkit/core/engine/commands/workflow/status.ts +455 -0
- package/.bkit/core/engine/commands/workflow/steps.ts +1300 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +161 -0
- package/.bkit/core/engine/commands/workflow/workflows.ts +1573 -0
- package/.bkit/core/engine/commands/workflow/workstreams.ts +164 -0
- package/.bkit/core/engine/commands/workflow/worktrees.ts +534 -0
- package/.bkit/core/engine/install/cloud-env.ts +924 -0
- package/.bkit/core/engine/install/managed-block.ts +212 -0
- package/.bkit/core/engine/install/manifest.ts +448 -0
- package/.bkit/core/engine/install/modules/claude.ts +362 -0
- package/.bkit/core/engine/install/modules/cloud.ts +173 -0
- package/.bkit/core/engine/install/modules/codex.ts +219 -0
- package/.bkit/core/engine/install/modules/core.ts +620 -0
- package/.bkit/core/engine/install/modules/cursor.ts +231 -0
- package/.bkit/core/engine/install/modules/index.ts +242 -0
- package/.bkit/core/engine/install/modules/opencode.ts +573 -0
- package/.bkit/core/engine/install/payload-links.ts +150 -0
- package/.bkit/core/engine/install/placeholders.ts +108 -0
- package/.bkit/core/engine/install/template-copies.ts +119 -0
- package/.bkit/core/engine/install/version-file.ts +284 -0
- package/.bkit/core/engine/install/write.ts +467 -0
- package/.bkit/core/engine/ledgers/clamp-log.ts +32 -0
- package/.bkit/core/engine/ledgers/status.ts +213 -0
- package/.bkit/core/engine/ledgers/telemetry.ts +1143 -0
- package/.bkit/core/engine/render/hosts.ts +372 -0
- package/.bkit/core/engine/render/models.ts +323 -0
- package/.bkit/core/engine/render/parts.ts +38 -0
- package/.bkit/core/engine/render/trackers.ts +170 -0
- package/.bkit/core/engine/shared/egress.ts +345 -0
- package/.bkit/core/engine/shared/json.ts +16 -0
- package/.bkit/core/engine/shared/log-prefix.ts +9 -0
- package/.bkit/core/engine/shared/package-json.ts +29 -0
- package/.bkit/core/engine/shared/package-manager.ts +38 -0
- package/.bkit/core/engine/shared/package-roots.ts +163 -0
- package/.bkit/core/engine/shared/protected-paths.ts +164 -0
- package/.bkit/core/engine/shared/settings.ts +72 -0
- package/.bkit/core/engine/shared/timeouts.ts +20 -0
- package/.bkit/core/engine/tools/wording.ts +748 -0
- package/.bkit/core/hooks/gateguard-edit-payload.js +18 -0
- package/.bkit/core/hooks/gateguard-engine.js +193 -0
- package/.bkit/core/hooks/guardrails-shell.js +154 -0
- package/.bkit/core/hooks/guardrails-tiers.js +68 -0
- package/.bkit/core/hooks/preflight-linear.sh +73 -0
- package/.bkit/core/prompts/bkit-audit-generate.md +66 -0
- package/.bkit/core/prompts/bkit-build-challenge-1.md +79 -0
- package/.bkit/core/prompts/bkit-build-challenge-2.md +81 -0
- package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +68 -0
- package/.bkit/core/prompts/bkit-build-challenge-remediate.md +70 -0
- package/.bkit/core/prompts/bkit-build-challenge-tests.md +73 -0
- package/.bkit/core/prompts/bkit-build-install-skills.md +67 -0
- package/.bkit/core/prompts/bkit-build-plan-current.md +75 -0
- package/.bkit/core/prompts/bkit-build-plan-execute.md +72 -0
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +73 -0
- package/.bkit/core/prompts/bkit-build-plan-verify.md +88 -0
- package/.bkit/core/prompts/bkit-build-summary.md +93 -0
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +90 -0
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +151 -0
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +78 -0
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +73 -0
- package/.bkit/core/prompts/bkit-debug-summary.md +95 -0
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +72 -0
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +72 -0
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +75 -0
- package/.bkit/core/prompts/bkit-design-generate.md +110 -0
- package/.bkit/core/prompts/bkit-design-organise.md +85 -0
- package/.bkit/core/prompts/bkit-design-review-1.md +121 -0
- package/.bkit/core/prompts/bkit-design-review-2.md +111 -0
- package/.bkit/core/prompts/bkit-design-spike.md +97 -0
- package/.bkit/core/prompts/bkit-design-summary.md +106 -0
- package/.bkit/core/prompts/bkit-design-update.md +66 -0
- package/.bkit/core/prompts/bkit-plan-complexity-check.md +66 -0
- package/.bkit/core/prompts/bkit-plan-complexity-split.md +87 -0
- package/.bkit/core/prompts/bkit-plan-generate.md +74 -0
- package/.bkit/core/prompts/bkit-plan-review-1.md +90 -0
- package/.bkit/core/prompts/bkit-plan-review-2.md +80 -0
- package/.bkit/core/prompts/bkit-plan-review-3.md +92 -0
- package/.bkit/core/prompts/bkit-plan-scope-check-1.md +84 -0
- package/.bkit/core/prompts/bkit-plan-scope-check-2.md +84 -0
- package/.bkit/core/prompts/bkit-plan-summary.md +106 -0
- package/.bkit/core/prompts/bkit-plan-update.md +68 -0
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +90 -0
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +94 -0
- package/.bkit/core/prompts/bkit-ship-summary.md +77 -0
- package/.bkit/core/prompts/bkit-ship-update-docs.md +71 -0
- package/.bkit/core/prompts/bkit-utility-compress-markdown.md +91 -0
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +75 -0
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +76 -0
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +61 -0
- package/.bkit/core/prompts/bkit-utility-update-failures.md +76 -0
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +75 -0
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +82 -0
- package/.bkit/core/workflows/bkit-auto.md +121 -0
- package/.bkit/core/workflows/bkit-build.md +802 -0
- package/.bkit/core/workflows/bkit-debug.md +649 -0
- package/.bkit/core/workflows/bkit-design.md +495 -0
- package/.bkit/core/workflows/bkit-plan.md +510 -0
- package/.bkit/core/workflows/bkit-ship.md +650 -0
- package/.bkit/shared/.bkit/.env.example +86 -0
- package/.bkit/shared/.claude/bkit-cloud.md +117 -0
- package/.bkit/shared/.claude/settings.json +88 -0
- package/.bkit/shared/.codex/hooks.json +26 -0
- package/.bkit/shared/.cursor/bkit-cloud.md +84 -0
- package/.bkit/shared/.cursor/hooks.json +26 -0
- package/.bkit/shared/.cursor/mcp.json +15 -0
- package/.bkit/shared/.cursor/rules/bkit-rules.mdc +12 -0
- package/.bkit/shared/.gitattributes +37 -0
- package/.bkit/shared/.mcp.json +16 -0
- package/.bkit/shared/.opencode/opencode.json +62 -0
- package/.bkit/shared/CLAUDE.md +11 -0
- package/.bkit/shared/LICENSE.md +22 -0
- package/.bkit/shared/docs/architecture.md +19 -0
- package/.bkit/shared/docs/data-schema.md +19 -0
- package/.bkit/shared/docs/deployments.md +433 -0
- package/.bkit/shared/docs/design.md +39 -0
- package/.bkit/shared/docs/noise.md +19 -0
- package/.bkit/shared/docs/observability.md +25 -0
- package/.bkit/shared/docs/security.md +42 -0
- package/.bkit/shared/docs/setup.md +30 -0
- package/.bkit/shared/docs/technology.md +18 -0
- package/.bkit/shared/docs/testing.md +413 -0
- package/.bkit/shared/gitignore +97 -0
- package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +187 -0
- package/.bkit/templates/.cursor/Dockerfile +68 -0
- package/.bkit/templates/.cursor/environment.json +6 -0
- package/.bkit/templates/.cursor/settings.json +11 -0
- package/.bkit/templates/.envrc +7 -0
- package/.bkit/templates/.github/dependabot.yml +52 -0
- package/.bkit/templates/.github/renovate.json5 +224 -0
- package/.bkit/templates/.github/workflows/bkit-ci.yml +1062 -0
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +564 -0
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +102 -0
- package/.bkit/templates/.graphifyignore +108 -0
- package/.bkit/templates/.husky/pre-commit +16 -0
- package/.bkit/templates/.husky/pre-push +91 -0
- package/.bkit/templates/.lintstagedrc.json +3 -0
- package/.bkit/templates/.prettierignore +41 -0
- package/.bkit/templates/.serena/project.yml +243 -0
- package/.bkit/templates/.vale/styles/House/Filler.yml +11 -0
- package/.bkit/templates/.vale/styles/House/Hedging.yml +12 -0
- package/.bkit/templates/.vale/styles/House/LLMSlop.yml +13 -0
- package/.bkit/templates/.vale/styles/House/Verbose.yml +12 -0
- package/.bkit/templates/.vale.ini +67 -0
- package/.bkit/templates/LICENSE.md +22 -0
- package/.bkit/templates/context/bkit-cloudrun.md +84 -0
- package/.bkit/templates/context/bkit-expo.md +186 -0
- package/.bkit/templates/context/bkit-github.md +79 -0
- package/.bkit/templates/context/bkit-inngest.md +45 -0
- package/.bkit/templates/context/bkit-maestro.md +76 -0
- package/.bkit/templates/context/bkit-playwright.md +62 -0
- package/.bkit/templates/context/bkit-resend.md +36 -0
- package/.bkit/templates/context/bkit-sentry.md +65 -0
- package/.bkit/templates/context/bkit-serena.md +33 -0
- package/.bkit/templates/context/bkit-stripe.md +36 -0
- package/.bkit/templates/context/bkit-supabase.md +59 -0
- package/.bkit/templates/context/bkit-tavily.md +49 -0
- package/.bkit/templates/context/bkit-vercel.md +64 -0
- package/.bkit/templates/docs/capabilities.md +72 -0
- package/.bkit/templates/scripts/ci/accepted-divergences.json +21 -0
- package/.bkit/templates/scripts/ci/check-accepted-divergences.mjs +152 -0
- package/.bkit/templates/scripts/ci/check-accepted-divergences.test.mjs +130 -0
- package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +98 -0
- package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +86 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-drift-rules.json +23 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-drift.py +208 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-eager-rules.json +35 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +236 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-external-rules.json +17 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +290 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +19 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +120 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-surface.py +232 -0
- package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +36 -0
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +927 -0
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +351 -0
- package/.bkit/templates/scripts/launchd/ai.bkit.launchd.plist +26 -0
- package/.bkit/templates/scripts/launchd/bkit-launchd-env.sh +53 -0
- package/.bkit/templates/scripts/launchd/launchd.env.example +13 -0
- package/.bkit/templates/scripts/prettier/bkit-insert-ignore.mjs +275 -0
- package/.bkit/templates/scripts/secrets/bkit-secrets.config.mjs +66 -0
- package/.bkit/templates/scripts/secrets/bkit-secrets.mjs +785 -0
- package/.bkit/templates/scripts/serena/bkit-serena-mcp.sh +30 -0
- package/.bkit/templates/scripts/serena/bkit-serena.mcp.json +9 -0
- package/.bkit/templates/scripts/slop/bkit-slop-type-suppression.mjs +286 -0
- package/.bkit/templates/slop-scan.config.json +120 -0
- package/CHANGELOG.md +1503 -0
- package/LICENSE.md +161 -0
- package/README.md +184 -2
- package/dist/checks/after/auth.js +140 -0
- package/dist/checks/after/ci-yml.js +681 -0
- package/dist/checks/after/github.js +400 -0
- package/dist/checks/after/index.js +431 -0
- package/dist/checks/after/managed.js +187 -0
- package/dist/checks/after/suppression.js +39 -0
- package/dist/checks/after/tools.js +351 -0
- package/dist/checks/before/context-fetch.js +426 -0
- package/dist/checks/before/env.js +163 -0
- package/dist/checks/before/files.js +187 -0
- package/dist/checks/before/index.js +162 -0
- package/dist/checks/before/mcp.js +111 -0
- package/dist/checks/before/repo.js +71 -0
- package/dist/checks/before/version.js +60 -0
- package/dist/checks/status-holes.js +393 -0
- package/dist/cli.js +688 -0
- package/dist/commands/analysis.js +325 -0
- package/dist/commands/ci/ci.js +438 -0
- package/dist/commands/comply.js +310 -0
- package/dist/commands/harvest.js +354 -0
- package/dist/commands/install/check.js +61 -0
- package/dist/commands/install/doctor.js +209 -0
- package/dist/commands/install/install.js +475 -0
- package/dist/commands/install/uninstall.js +839 -0
- package/dist/commands/install/upgrade.js +782 -0
- package/dist/commands/launch.js +118 -0
- package/dist/commands/lib.js +363 -0
- package/dist/commands/registry.js +50 -0
- package/dist/commands/setup/setup.js +158 -0
- package/dist/commands/telemetry.js +29 -0
- package/dist/commands/workflow/branches.js +1265 -0
- package/dist/commands/workflow/context.js +846 -0
- package/dist/commands/workflow/counters.js +227 -0
- package/dist/commands/workflow/fids.js +224 -0
- package/dist/commands/workflow/issues.js +585 -0
- package/dist/commands/workflow/ledgers.js +472 -0
- package/dist/commands/workflow/locks.js +364 -0
- package/dist/commands/workflow/prs.js +904 -0
- package/dist/commands/workflow/repo.js +199 -0
- package/dist/commands/workflow/roadmap.js +495 -0
- package/dist/commands/workflow/runs.js +1717 -0
- package/dist/commands/workflow/runtime.js +257 -0
- package/dist/commands/workflow/skills.js +110 -0
- package/dist/commands/workflow/status.js +392 -0
- package/dist/commands/workflow/steps.js +1093 -0
- package/dist/commands/workflow/tests.js +144 -0
- package/dist/commands/workflow/workflows.js +1342 -0
- package/dist/commands/workflow/workstreams.js +141 -0
- package/dist/commands/workflow/worktrees.js +473 -0
- package/dist/install/cloud-env.js +818 -0
- package/dist/install/managed-block.js +182 -0
- package/dist/install/manifest.js +376 -0
- package/dist/install/modules/claude.js +288 -0
- package/dist/install/modules/cloud.js +151 -0
- package/dist/install/modules/codex.js +193 -0
- package/dist/install/modules/core.js +531 -0
- package/dist/install/modules/cursor.js +186 -0
- package/dist/install/modules/index.js +152 -0
- package/dist/install/modules/opencode.js +504 -0
- package/dist/install/payload-links.js +119 -0
- package/dist/install/placeholders.js +87 -0
- package/dist/install/template-copies.js +106 -0
- package/dist/install/version-file.js +204 -0
- package/dist/install/write.js +342 -0
- package/dist/ledgers/clamp-log.js +27 -0
- package/dist/ledgers/status.js +156 -0
- package/dist/ledgers/telemetry.js +637 -0
- package/dist/render/hosts.js +339 -0
- package/dist/render/models.js +288 -0
- package/dist/render/parts.js +33 -0
- package/dist/render/trackers.js +135 -0
- package/dist/shared/egress.js +299 -0
- package/dist/shared/json.js +16 -0
- package/dist/shared/log-prefix.js +7 -0
- package/dist/shared/package-json.js +22 -0
- package/dist/shared/package-manager.js +32 -0
- package/dist/shared/package-roots.js +145 -0
- package/dist/shared/protected-paths.js +153 -0
- package/dist/shared/settings.js +44 -0
- package/dist/shared/timeouts.js +19 -0
- package/dist/tools/wording.js +680 -0
- package/package.json +101 -4
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
// install/managed-block.ts — the `bkit:start` / `bkit:end` managed-block parser.
|
|
2
|
+
//
|
|
3
|
+
// One implementation for every caller that finds, reads, replaces, or strips the
|
|
4
|
+
// part of a shared file bkit owns: install, upgrade, uninstall, preflight, and the
|
|
5
|
+
// wording sync. Pure string functions only — file IO and logging stay with the
|
|
6
|
+
// caller, so each caller keeps its own log context.
|
|
7
|
+
|
|
8
|
+
import * as fs from "node:fs";
|
|
9
|
+
import { LOG_PREFIX } from "../shared/log-prefix.js";
|
|
10
|
+
|
|
11
|
+
const START_MARKER = "<!-- bkit:start -->";
|
|
12
|
+
const END_MARKER = "<!-- bkit:end -->";
|
|
13
|
+
const SLASH_START_MARKER = "// bkit:start";
|
|
14
|
+
const SLASH_END_MARKER = "// bkit:end";
|
|
15
|
+
|
|
16
|
+
// Marker style selector: html-comment (default; markdown, and shell / `.gitignore` behind a
|
|
17
|
+
// `# ` prefix) or slash-comment (JS/TS ES modules, where HTML comments are a syntax error).
|
|
18
|
+
export type MarkerStyle = "html-comment" | "slash-comment";
|
|
19
|
+
|
|
20
|
+
// Select marker pair based on markerStyle.
|
|
21
|
+
export function selectMarkers(markerStyle: MarkerStyle): [string, string] {
|
|
22
|
+
return markerStyle === "slash-comment"
|
|
23
|
+
? [SLASH_START_MARKER, SLASH_END_MARKER]
|
|
24
|
+
: [START_MARKER, END_MARKER];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Recognised line-comment prefixes — bare, shell (#), JS/TS (//).
|
|
28
|
+
const ALLOWED_PREFIXES = ["", "# ", "// "];
|
|
29
|
+
|
|
30
|
+
// Find line-anchored marker positions. A marker is line-anchored when:
|
|
31
|
+
// - The line before the marker is empty, "# ", or "// " (comment prefixes).
|
|
32
|
+
// - The character after the marker is end-of-line or end-of-file.
|
|
33
|
+
// Backtick-quoted prose mentions are ignored.
|
|
34
|
+
export function findLineAnchoredMarkers(content: string, marker: string): number[] {
|
|
35
|
+
const positions: number[] = [];
|
|
36
|
+
const len = marker.length;
|
|
37
|
+
let pos = 0;
|
|
38
|
+
while (true) {
|
|
39
|
+
const idx = content.indexOf(marker, pos);
|
|
40
|
+
if (idx === -1) break;
|
|
41
|
+
let lineStart = idx;
|
|
42
|
+
while (lineStart > 0 && content[lineStart - 1] !== "\n") lineStart--;
|
|
43
|
+
const beforeMarker = content.slice(lineStart, idx);
|
|
44
|
+
const after = idx + len >= content.length ? "\n" : content[idx + len];
|
|
45
|
+
const isLineEnd = after === "\n" || after === undefined;
|
|
46
|
+
if (ALLOWED_PREFIXES.includes(beforeMarker) && isLineEnd) positions.push(idx);
|
|
47
|
+
pos = idx + len;
|
|
48
|
+
}
|
|
49
|
+
return positions;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Find the start of the line containing a position.
|
|
53
|
+
function lineStartOf(content: string, idx: number): number {
|
|
54
|
+
let i = idx;
|
|
55
|
+
while (i > 0 && content[i - 1] !== "\n") i--;
|
|
56
|
+
return i;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Why a managed block could not be located: no markers, more than one pair, or end before start. */
|
|
60
|
+
export type ManagedBlockProblem = "absent" | "multiple" | "inverted";
|
|
61
|
+
|
|
62
|
+
export type ReplaceManagedBlockResult =
|
|
63
|
+
{ ok: true; content: string } | { ok: false; problem: ManagedBlockProblem };
|
|
64
|
+
|
|
65
|
+
// Replace the content between the single marker pair. Markers may be bare (markdown) or
|
|
66
|
+
// comment-prefixed (`# ` shell, `// ` JS/TS) — prefixes are preserved. Refuses (with the
|
|
67
|
+
// reason) when markers are absent, duplicated, or inverted.
|
|
68
|
+
export function replaceManagedBlock(
|
|
69
|
+
existing: string,
|
|
70
|
+
newContent: string,
|
|
71
|
+
markerStyle: MarkerStyle = "html-comment",
|
|
72
|
+
): ReplaceManagedBlockResult {
|
|
73
|
+
const [startMarker, endMarker] = selectMarkers(markerStyle);
|
|
74
|
+
const starts = findLineAnchoredMarkers(existing, startMarker);
|
|
75
|
+
const ends = findLineAnchoredMarkers(existing, endMarker);
|
|
76
|
+
if (starts.length === 0 || ends.length === 0) return { ok: false, problem: "absent" };
|
|
77
|
+
if (starts.length > 1 || ends.length > 1) return { ok: false, problem: "multiple" };
|
|
78
|
+
const startIdx = starts[0]!;
|
|
79
|
+
const endIdx = ends[0]!;
|
|
80
|
+
if (startIdx >= endIdx) return { ok: false, problem: "inverted" };
|
|
81
|
+
// Slice on line boundaries so any comment prefix on the marker lines is preserved.
|
|
82
|
+
const startLineEnd = existing.indexOf("\n", startIdx + startMarker.length);
|
|
83
|
+
const beforeBlock =
|
|
84
|
+
startLineEnd === -1
|
|
85
|
+
? existing.slice(0, startIdx + startMarker.length)
|
|
86
|
+
: existing.slice(0, startLineEnd);
|
|
87
|
+
const afterBlock = existing.slice(lineStartOf(existing, endIdx));
|
|
88
|
+
const normalisedContent = newContent.replace(/^\n+/, "").replace(/\n+$/, "");
|
|
89
|
+
return { ok: true, content: beforeBlock + "\n\n" + normalisedContent + "\n\n" + afterBlock };
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Extract the bkit-managed block content from a file, stripping surrounding newlines.
|
|
93
|
+
// markerStyle defaults to "html-comment".
|
|
94
|
+
// Markers may be bare or comment-prefixed. Returns null if markers absent, duplicated, or inverted.
|
|
95
|
+
export function extractManagedBlock(
|
|
96
|
+
content: string,
|
|
97
|
+
markerStyle: MarkerStyle = "html-comment",
|
|
98
|
+
): string | null {
|
|
99
|
+
const [startMarker, endMarker] = selectMarkers(markerStyle);
|
|
100
|
+
const starts = findLineAnchoredMarkers(content, startMarker);
|
|
101
|
+
const ends = findLineAnchoredMarkers(content, endMarker);
|
|
102
|
+
if (starts.length !== 1 || ends.length !== 1) return null;
|
|
103
|
+
if (starts[0]! >= ends[0]!) return null;
|
|
104
|
+
const startLineEnd = content.indexOf("\n", starts[0]! + startMarker.length);
|
|
105
|
+
const inner =
|
|
106
|
+
startLineEnd === -1 ? "" : content.slice(startLineEnd + 1, lineStartOf(content, ends[0]!));
|
|
107
|
+
return inner.replace(/^\n+/, "").replace(/\n+$/, "");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Extract the FULL bkit-managed block INCLUDING marker lines from a file.
|
|
111
|
+
// markerStyle defaults to "html-comment".
|
|
112
|
+
// Used to append a fresh block to a destination that has none. Markers may be
|
|
113
|
+
// bare or comment-prefixed. Returns null if markers absent, duplicated, or inverted.
|
|
114
|
+
export function extractFullManagedBlock(
|
|
115
|
+
content: string,
|
|
116
|
+
markerStyle: MarkerStyle = "html-comment",
|
|
117
|
+
): string | null {
|
|
118
|
+
const [startMarker, endMarker] = selectMarkers(markerStyle);
|
|
119
|
+
const starts = findLineAnchoredMarkers(content, startMarker);
|
|
120
|
+
const ends = findLineAnchoredMarkers(content, endMarker);
|
|
121
|
+
if (starts.length !== 1 || ends.length !== 1) return null;
|
|
122
|
+
if (starts[0]! >= ends[0]!) return null;
|
|
123
|
+
const startLineStart = lineStartOf(content, starts[0]!);
|
|
124
|
+
const endLineEnd = content.indexOf("\n", ends[0]! + endMarker.length);
|
|
125
|
+
return endLineEnd === -1
|
|
126
|
+
? content.slice(startLineStart)
|
|
127
|
+
: content.slice(startLineStart, endLineEnd + 1);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Detect which marker style a file's managed block uses, or null when it has none.
|
|
131
|
+
// Uses the same line-anchored finder as stripManagedBlock, so a detected style is
|
|
132
|
+
// always one stripManagedBlock acts on: a marker alone on its line, bare or behind
|
|
133
|
+
// a `# ` / `// ` prefix. Labelled, indented, or prose-quoted markers do not count.
|
|
134
|
+
export function detectMarkerStyle(content: string): MarkerStyle | null {
|
|
135
|
+
for (const style of ["html-comment", "slash-comment"] as const) {
|
|
136
|
+
const [startMarker] = selectMarkers(style);
|
|
137
|
+
if (findLineAnchoredMarkers(content, startMarker).length > 0) return style;
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Remove the bkit-managed block (including marker lines) from a string,
|
|
143
|
+
// preserving all consumer-owned content outside the block.
|
|
144
|
+
//
|
|
145
|
+
// Semantics:
|
|
146
|
+
// - Markers absent → returns content unchanged (idempotent, safe for re-run)
|
|
147
|
+
// - Duplicated/inverted markers → returns content unchanged (error-safe)
|
|
148
|
+
// - Marker lines and surrounding blank lines are removed along with the block
|
|
149
|
+
//
|
|
150
|
+
// Uses the line-anchored marker detection (KN-8 lesson: greedy whitespace
|
|
151
|
+
// regexes are unsafe — use the anchored parser instead).
|
|
152
|
+
export function stripManagedBlock(
|
|
153
|
+
content: string,
|
|
154
|
+
markerStyle: MarkerStyle = "html-comment",
|
|
155
|
+
): string {
|
|
156
|
+
const [startMarker, endMarker] = selectMarkers(markerStyle);
|
|
157
|
+
|
|
158
|
+
const starts = findLineAnchoredMarkers(content, startMarker);
|
|
159
|
+
const ends = findLineAnchoredMarkers(content, endMarker);
|
|
160
|
+
|
|
161
|
+
// Safety guards: absent, duplicated, or inverted → no-op
|
|
162
|
+
if (starts.length === 0 || ends.length === 0) return content;
|
|
163
|
+
if (starts.length > 1 || ends.length > 1) return content;
|
|
164
|
+
const startIdx = starts[0]!;
|
|
165
|
+
const endIdx = ends[0]!;
|
|
166
|
+
if (startIdx >= endIdx) return content;
|
|
167
|
+
|
|
168
|
+
// Find start-of-line for the start marker
|
|
169
|
+
let startLineStart = startIdx;
|
|
170
|
+
while (startLineStart > 0 && content[startLineStart - 1] !== "\n") startLineStart--;
|
|
171
|
+
|
|
172
|
+
// Find end-of-line for the end marker (include trailing newline)
|
|
173
|
+
const endMarkerEnd = endIdx + endMarker.length;
|
|
174
|
+
let blockEnd = endMarkerEnd;
|
|
175
|
+
if (blockEnd < content.length && content[blockEnd] === "\n") blockEnd++;
|
|
176
|
+
|
|
177
|
+
const before = content.slice(0, startLineStart);
|
|
178
|
+
const after = content.slice(blockEnd);
|
|
179
|
+
|
|
180
|
+
// Trim one leading blank line from `after` to avoid double-blank after strip
|
|
181
|
+
const afterTrimmed = after.replace(/^\n/, "");
|
|
182
|
+
|
|
183
|
+
// Trim one trailing blank line from `before` to avoid double-blank before strip
|
|
184
|
+
const beforeTrimmed = before.replace(/\n\n$/, "\n");
|
|
185
|
+
|
|
186
|
+
return beforeTrimmed + afterTrimmed;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Managed-block writer: update content between markers in a file on disk.
|
|
190
|
+
// No-op (warn + skip) when markers absent, duplicated, or inverted.
|
|
191
|
+
export function updateManagedBlock(
|
|
192
|
+
filePath: string,
|
|
193
|
+
newContent: string,
|
|
194
|
+
dryRun = false,
|
|
195
|
+
markerStyle: MarkerStyle = "html-comment",
|
|
196
|
+
): boolean {
|
|
197
|
+
if (!fs.existsSync(filePath)) return false;
|
|
198
|
+
const existing = fs.readFileSync(filePath, "utf-8");
|
|
199
|
+
const result = replaceManagedBlock(existing, newContent, markerStyle);
|
|
200
|
+
if (!result.ok) {
|
|
201
|
+
const reason = {
|
|
202
|
+
absent: `Managed block markers absent in ${filePath} — skipping`,
|
|
203
|
+
multiple: `Multiple managed-block markers in ${filePath} — skipping (expected exactly one of each)`,
|
|
204
|
+
inverted: `Inverted managed-block markers in ${filePath} (end before start) — skipping`,
|
|
205
|
+
}[result.problem];
|
|
206
|
+
console.warn(`${LOG_PREFIX} ${reason}`);
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
if (result.content === existing) return false;
|
|
210
|
+
if (!dryRun) fs.writeFileSync(filePath, result.content, "utf-8");
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
// install/manifest.ts — Per-module install-write manifest.
|
|
2
|
+
// Each module declares the set of files it writes; consumed by commands/install/uninstall.ts
|
|
3
|
+
// and the upgrade walk.
|
|
4
|
+
//
|
|
5
|
+
// Design: pure data — no fs access, no side effects. Re-exported as a public
|
|
6
|
+
// contract consumed by uninstall and upgrade.
|
|
7
|
+
|
|
8
|
+
import type { ModuleFlag } from "../cli.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Opt-in modules: never installed implicitly; each requires an explicit flag
|
|
12
|
+
* (`--auto=`, `--opencode=`). A bare/full `uninstall` DOES remove them (zero footprint).
|
|
13
|
+
* Dependency-updater files are not modules — bkit never writes or removes them.
|
|
14
|
+
*/
|
|
15
|
+
export const OPTIN_MODULES = new Set<ModuleFlag>(["cloud", "opencode", "codex"]);
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Types
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
export interface ManifestEntry {
|
|
22
|
+
/** Destination path relative to consumer repo root (as written by install). */
|
|
23
|
+
path: string;
|
|
24
|
+
/**
|
|
25
|
+
* Format classification — determines the scope-extraction mechanism used by
|
|
26
|
+
* install/check/uninstall dispatch:
|
|
27
|
+
* "json" = deep-containment (writeTier2JsonContained / deepContains / stripTier2JsonScope);
|
|
28
|
+
* `.mcp.json` / `.cursor/mcp.json` instead own only `mcpServers.<tracker>`
|
|
29
|
+
* (reconcileMcpJson / stripMcpTrackerEntries)
|
|
30
|
+
* "markered-text" = marker block extraction + byte-equal (insert-or-replace / strip)
|
|
31
|
+
* "byte-equal-text" = whole-file byte-equal (overwrite / hash-or-byte-equal delete)
|
|
32
|
+
*/
|
|
33
|
+
format: "json" | "markered-text" | "byte-equal-text";
|
|
34
|
+
/**
|
|
35
|
+
* Module that owns this file.
|
|
36
|
+
*/
|
|
37
|
+
module: ModuleName;
|
|
38
|
+
/**
|
|
39
|
+
* `byte-equal-text` only. bkit-GENERATED artefact: no file under `.bkit/templates/`
|
|
40
|
+
* backs it (install computes the bytes from consumer config). Its install-time hash
|
|
41
|
+
* lands in `canonicalHashes` like every owned file's, so uninstall deletes it while
|
|
42
|
+
* it is unchanged.
|
|
43
|
+
*/
|
|
44
|
+
generated?: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type ModuleName = "core" | "claude" | "cursor" | "opencode" | "codex" | "cloud";
|
|
48
|
+
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
// Issue tracker
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Issue-tracker providers supported by `bkit install --tracker=<name>`.
|
|
55
|
+
* - `github` — GitHub Issues + Projects v2 (default).
|
|
56
|
+
* - `linear` — Linear (opt-in).
|
|
57
|
+
* - `none` — no tracker wired; workflows skip tracker calls with one-line log.
|
|
58
|
+
*
|
|
59
|
+
* Add a new value here when adding a provider section to `.bkit/trackers.md`.
|
|
60
|
+
* See `.bkit/trackers.md` § "Adding a tracker (Jira, etc.)" in the Rules block.
|
|
61
|
+
*/
|
|
62
|
+
export const ISSUE_TRACKERS = ["github", "linear", "none"] as const;
|
|
63
|
+
export type IssueTracker = (typeof ISSUE_TRACKERS)[number];
|
|
64
|
+
|
|
65
|
+
/** Default tracker when consumer manifest has no `bkit.issueTracker` field. */
|
|
66
|
+
export const DEFAULT_ISSUE_TRACKER: IssueTracker = "none";
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Narrow an unknown string to `IssueTracker` or return `null` if invalid.
|
|
70
|
+
* Used by CLI flag parsing and consumer-manifest reads.
|
|
71
|
+
*/
|
|
72
|
+
export function parseIssueTracker(value: unknown): IssueTracker | null {
|
|
73
|
+
return typeof value === "string" && (ISSUE_TRACKERS as readonly string[]).includes(value)
|
|
74
|
+
? (value as IssueTracker)
|
|
75
|
+
: null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ---------------------------------------------------------------------------
|
|
79
|
+
// Cloud agents — post-CI auto-routing
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Cloud-agent automation chosen by the consumer (opt-in).
|
|
84
|
+
* - `claude` — `bkit install --auto=claude` writes no file; the consumer copies the
|
|
85
|
+
* `.github/workflows/bkit-cloud.yml` and `.claude/hooks/bkit-cloud-bootstrap.sh`
|
|
86
|
+
* templates. Requires `tracker=github`.
|
|
87
|
+
* - `cursor` — `bkit install --auto=cursor` writes no file; the consumer copies the
|
|
88
|
+
* `.cursor/Dockerfile` + `.cursor/environment.json` templates. Requires `tracker=linear`.
|
|
89
|
+
* - `opencode` — `bkit install --auto=opencode` writes no file; the consumer copies the same
|
|
90
|
+
* `bkit-cloud.yml` template as claude (both jobs coexist, runtime-gated by secret
|
|
91
|
+
* presence). Requires `tracker=github` + local opencode host (`bkit install --opencode=<provider>`).
|
|
92
|
+
* - `none` — explicit opt-out; silences the post-install nudge advisory.
|
|
93
|
+
*
|
|
94
|
+
* Recorded in `package.json` `bkit.cloudAgents`. Presence of the adopted copy
|
|
95
|
+
* (`bkit-cloud.yml` for github-host variants; `.cursor/Dockerfile` for cursor) is the authoritative
|
|
96
|
+
* "active" signal; the package.json field only distinguishes an opt-out from
|
|
97
|
+
* an undecided install.
|
|
98
|
+
*
|
|
99
|
+
* Single self-describing field (mirrors `bkit.issueTracker`).
|
|
100
|
+
*/
|
|
101
|
+
export const CLOUD_MODES = ["claude", "cursor", "opencode", "none"] as const;
|
|
102
|
+
export type CloudAgents = (typeof CLOUD_MODES)[number];
|
|
103
|
+
|
|
104
|
+
/** Default when consumer manifest has no `bkit.cloudAgents` field (undecided). */
|
|
105
|
+
export const DEFAULT_CLOUD_AGENTS: CloudAgents = "none";
|
|
106
|
+
|
|
107
|
+
/** Narrow an unknown string to `CloudAgents` or return `null` if invalid. */
|
|
108
|
+
export function parseCloudAgents(value: unknown): CloudAgents | null {
|
|
109
|
+
return typeof value === "string" && (CLOUD_MODES as readonly string[]).includes(value)
|
|
110
|
+
? (value as CloudAgents)
|
|
111
|
+
: null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
// Per-module manifests
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
|
|
118
|
+
const CORE_MANIFEST: ManifestEntry[] = [
|
|
119
|
+
{ path: "AGENTS.md", format: "markered-text", module: "core" },
|
|
120
|
+
// CLAUDE.md is in CLAUDE_MANIFEST: it is a Claude-Code-only redirect. AGENTS.md
|
|
121
|
+
// (the cross-host dispatch router) is core.
|
|
122
|
+
{ path: ".gitignore", format: "markered-text", module: "core" },
|
|
123
|
+
// Append-only ledger union-merge rules live in a managed block; consumers may add
|
|
124
|
+
// their own attributes outside the block, so this is markered-text (not whole-file).
|
|
125
|
+
{ path: ".gitattributes", format: "markered-text", module: "core" },
|
|
126
|
+
{ path: ".bkit/version", format: "byte-equal-text", module: "core" },
|
|
127
|
+
// Canonical bkit-authored reference docs. They live package-side under
|
|
128
|
+
// `.bkit/core/.bkit/` and are read from there at runtime (getBkitDocsRoot); these
|
|
129
|
+
// consumer copies are force-overwritten mirrors (writeTier1) so a consumer can read
|
|
130
|
+
// them in-repo. Whole file is bkit-owned → byte-equal-text (refreshed every install).
|
|
131
|
+
{ path: ".bkit/cloud.md", format: "byte-equal-text", module: "core" },
|
|
132
|
+
{ path: ".bkit/comparison.md", format: "byte-equal-text", module: "core" },
|
|
133
|
+
{ path: ".bkit/install.md", format: "byte-equal-text", module: "core" },
|
|
134
|
+
{ path: ".bkit/jsonl.md", format: "byte-equal-text", module: "core" },
|
|
135
|
+
// The PolyForm notice that travels with every file bkit writes (the managed-version
|
|
136
|
+
// marker names the licence and its URL; this file carries both full texts and the
|
|
137
|
+
// Required Notice). Sourced from `.bkit/core/.bkit/LICENSE.md`.
|
|
138
|
+
{ path: ".bkit/LICENSE.md", format: "byte-equal-text", module: "core" },
|
|
139
|
+
{ path: ".bkit/providers.md", format: "byte-equal-text", module: "core" },
|
|
140
|
+
{ path: ".bkit/prompts.md", format: "markered-text", module: "core" },
|
|
141
|
+
{ path: ".bkit/templates.md", format: "byte-equal-text", module: "core" },
|
|
142
|
+
{ path: ".bkit/trackers.md", format: "byte-equal-text", module: "core" },
|
|
143
|
+
{ path: ".bkit/workflows.md", format: "byte-equal-text", module: "core" },
|
|
144
|
+
{ path: ".bkit/README.md", format: "byte-equal-text", module: "core" },
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
const CLAUDE_MANIFEST: ManifestEntry[] = [
|
|
148
|
+
// Root CLAUDE.md — Claude-Code redirect to .agents/rules.md, owned by the claude module:
|
|
149
|
+
// `uninstall --claude` removes it; a non-claude install/uninstall leaves it.
|
|
150
|
+
// Emitted by runClaudeModule (a root file, outside the .claude/ dir walk).
|
|
151
|
+
{ path: "CLAUDE.md", format: "markered-text", module: "claude" },
|
|
152
|
+
{ path: ".claude/settings.json", format: "json", module: "claude" },
|
|
153
|
+
{ path: ".claude/hooks/bkit-preflight.sh", format: "markered-text", module: "claude" },
|
|
154
|
+
// GateGuard advisory PreToolUse hook — markered-text (slash-comment): bkit owns
|
|
155
|
+
// only the advisory engine between `// bkit:start` / `// bkit:end`; the stdin/
|
|
156
|
+
// stdout driver outside the block is consumer-owned from first install onward, so
|
|
157
|
+
// a consumer can add their own advisories without losing them on upgrade. Wired
|
|
158
|
+
// in .claude/settings.json.
|
|
159
|
+
{
|
|
160
|
+
path: ".claude/hooks/bkit-gateguard.cjs",
|
|
161
|
+
format: "markered-text",
|
|
162
|
+
module: "claude",
|
|
163
|
+
},
|
|
164
|
+
// bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor/Codex hooks.
|
|
165
|
+
// PreToolUse matcher `Bash`. ADVISORY ONLY: covers URL hosts and shell-as-edit-channel;
|
|
166
|
+
// never denies or asks.
|
|
167
|
+
{
|
|
168
|
+
path: ".claude/hooks/bkit-guardrails.cjs",
|
|
169
|
+
format: "markered-text",
|
|
170
|
+
module: "claude",
|
|
171
|
+
},
|
|
172
|
+
// .claude/hooks/bkit-cloud-bootstrap.sh ships as a copy-and-own template.
|
|
173
|
+
// The SessionStart hook entry in .claude/settings.json is guarded (`test -f … || true`),
|
|
174
|
+
// so a consumer who has not adopted the script no-ops.
|
|
175
|
+
// bkit owns only its tracker entry under `mcpServers` (reconcileMcpJson); every other
|
|
176
|
+
// key is the consumer's.
|
|
177
|
+
{ path: ".mcp.json", format: "json", module: "claude" },
|
|
178
|
+
// Owned (writeTier1): consumer edits are overwritten. Real values go in `.bkit/.env`.
|
|
179
|
+
{ path: ".bkit/.env.example", format: "byte-equal-text", module: "claude" },
|
|
180
|
+
// Mirrors from .agents/ — managed dynamically, not listed individually here (the set
|
|
181
|
+
// depends on the bkit-prefix prompt/workflow files at install time). The uninstall
|
|
182
|
+
// logic handles these via the BKIT_PREFIX filter.
|
|
183
|
+
];
|
|
184
|
+
|
|
185
|
+
// ---------------------------------------------------------------------------
|
|
186
|
+
// bkit:gate:* — the local gate workflows, prompts and hooks run
|
|
187
|
+
//
|
|
188
|
+
// ONE CHAIN. Each gate is the previous gate plus its own tier; the NAME and the
|
|
189
|
+
// VALUE describe the same sequence. Tier vocabulary is the `bkit-ci.yml` job ids
|
|
190
|
+
// (bkit-tests-static / -unit / -integration / -e2e / -live). Where a step is not a
|
|
191
|
+
// tier (`format`, the ship gate) the name spells out the actual steps.
|
|
192
|
+
//
|
|
193
|
+
// The consumer owns every value: a turbo monorepo writes `turbo run … --filter`,
|
|
194
|
+
// a Python repo writes `ruff check && pytest`. bkit never reads a value — only
|
|
195
|
+
// whether a name is declared.
|
|
196
|
+
//
|
|
197
|
+
// Seeded by core on every install and upgrade (seedCorePackageJsonScripts,
|
|
198
|
+
// install/modules/index.ts): add-if-missing, so a name already present is never touched,
|
|
199
|
+
// and uninstall leaves every name in place. The tool scripts the defaults chain
|
|
200
|
+
// (typecheck, lint, format:check, lint:prose, slop:delta, lint-staged) are the
|
|
201
|
+
// consumer's to add — `.bkit/templates.md` lists them; the
|
|
202
|
+
// `gate-missing-called-scripts` advisory names any that are missing.
|
|
203
|
+
//
|
|
204
|
+
// The SAME names are what the git hook templates run (`.husky/pre-commit`,
|
|
205
|
+
// `.husky/pre-push`). `bkit-ci.yml` does NOT call the gates; it calls the scripts directly.
|
|
206
|
+
//
|
|
207
|
+
// `lint:slop` is in no gate: `slop-scan scan` is report-only and never fails. The gate
|
|
208
|
+
// that fails on new findings is `slop:delta`.
|
|
209
|
+
//
|
|
210
|
+
// NOT SEEDED: the three deeper gates (…-integration, …-integration-e2e,
|
|
211
|
+
// …-integration-e2e-live) are absent unless the consumer writes them. Each is one line
|
|
212
|
+
// chaining its parent, e.g.
|
|
213
|
+
// "bkit:gate:static-unit-integration": "pnpm bkit:gate:static-unit && pnpm test:integration"
|
|
214
|
+
// `/bkit-build` and `/bkit-debug` run the DEEPEST gate that exists and record its name.
|
|
215
|
+
export const BKIT_GATE_SCRIPTS: Readonly<Record<string, string>> = {
|
|
216
|
+
// `.husky/pre-commit`: prettier --write over staged files, and nothing else —
|
|
217
|
+
// seconds, not minutes. Prose is a whole-repo scan, so it gates at pre-push.
|
|
218
|
+
"bkit:gate:format": "pnpm lint-staged",
|
|
219
|
+
// Everything that needs no test runner. Mirrors the bkit-tests-static CI job.
|
|
220
|
+
// Callers: build's plan-execute loop between tasks, and the `.husky/pre-push` revert
|
|
221
|
+
// path.
|
|
222
|
+
"bkit:gate:static":
|
|
223
|
+
"pnpm typecheck && pnpm lint && pnpm format:check && pnpm lint:prose && pnpm slop:delta",
|
|
224
|
+
// The default local gate: `.husky/pre-push`, build Step 14, the remediates.
|
|
225
|
+
"bkit:gate:static-unit": "pnpm bkit:gate:static && pnpm test",
|
|
226
|
+
// Ship's conflict-resolve, the only caller whose dependency graph may have just
|
|
227
|
+
// been hand-merged (lockfile conflict) and whose tree no one has ever compiled.
|
|
228
|
+
// `install --frozen-lockfile` proves the merged lockfile still matches the
|
|
229
|
+
// manifest; `build` proves the resolution compiles. Both are named here and
|
|
230
|
+
// nowhere else.
|
|
231
|
+
"bkit:gate:install-static-unit-build":
|
|
232
|
+
"pnpm install --frozen-lockfile && pnpm bkit:gate:static-unit && pnpm build",
|
|
233
|
+
// --- dependency inspection ---------------------------------------------
|
|
234
|
+
// Read-only, not gates: agents run these while diagnosing a version-shaped
|
|
235
|
+
// hypothesis or auditing deps. Named so the prompts stop hardcoding `pnpm
|
|
236
|
+
// outdated` / `pnpm audit`, which a cargo, go or uv consumer cannot run.
|
|
237
|
+
"bkit:deps:outdated": "pnpm outdated",
|
|
238
|
+
"bkit:deps:audit": "pnpm audit",
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The deeper gates, in DESCENDING order — `/bkit-debug` runs the first one the
|
|
243
|
+
* consumer declares. Never seeded (see BKIT_GATE_SCRIPTS); listed here so the
|
|
244
|
+
* workflow, the docs and the audit test share one ordering.
|
|
245
|
+
*
|
|
246
|
+
* The `:live` suffix is load-bearing: `/bkit-debug` greps the recorded scope for
|
|
247
|
+
* the word `live` to decide `testsLiveSkipped`, and `:` is not a word character.
|
|
248
|
+
*/
|
|
249
|
+
export const BKIT_DEBUG_GATES: readonly string[] = [
|
|
250
|
+
"bkit:gate:static-unit-integration-e2e-live",
|
|
251
|
+
"bkit:gate:static-unit-integration-e2e",
|
|
252
|
+
"bkit:gate:static-unit",
|
|
253
|
+
];
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* What `/bkit-build` Step 14 will run, in DESCENDING order — first one declared wins.
|
|
257
|
+
*
|
|
258
|
+
* Build stops at integration; E2E and live are not in this list.
|
|
259
|
+
*
|
|
260
|
+
* Neither entry is seeded: declaring `bkit:gate:static-unit-integration` opts the build
|
|
261
|
+
* loop into the integration tier.
|
|
262
|
+
*/
|
|
263
|
+
export const BKIT_BUILD_GATES: readonly string[] = [
|
|
264
|
+
"bkit:gate:static-unit-integration",
|
|
265
|
+
"bkit:gate:static-unit",
|
|
266
|
+
];
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The deeper gates, shallowest first, with what declaring each one costs.
|
|
270
|
+
*
|
|
271
|
+
* Never seeded. The probe's rule is "declared = run it". `declaredBy` is how install
|
|
272
|
+
* detects a repo that HAS a tier but declares no gate for it, and advises — see
|
|
273
|
+
* detectGateAdvisories.
|
|
274
|
+
*/
|
|
275
|
+
export const BKIT_OPTIONAL_GATES: ReadonlyArray<{
|
|
276
|
+
gate: string;
|
|
277
|
+
parent: string;
|
|
278
|
+
declaredBy: readonly string[];
|
|
279
|
+
}> = [
|
|
280
|
+
{
|
|
281
|
+
gate: "bkit:gate:static-unit-integration",
|
|
282
|
+
parent: "bkit:gate:static-unit",
|
|
283
|
+
declaredBy: ["test:integration"],
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
gate: "bkit:gate:static-unit-integration-e2e",
|
|
287
|
+
parent: "bkit:gate:static-unit-integration",
|
|
288
|
+
declaredBy: ["test:e2e"],
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
gate: "bkit:gate:static-unit-integration-e2e-live",
|
|
292
|
+
parent: "bkit:gate:static-unit-integration-e2e",
|
|
293
|
+
declaredBy: ["test:live", "test:integration:live", "test:e2e:live"],
|
|
294
|
+
},
|
|
295
|
+
];
|
|
296
|
+
|
|
297
|
+
const CURSOR_MANIFEST: ManifestEntry[] = [
|
|
298
|
+
{ path: ".cursor/hooks.json", format: "json", module: "cursor" },
|
|
299
|
+
{ path: ".cursor/hooks/bkit-preflight.sh", format: "markered-text", module: "cursor" },
|
|
300
|
+
// Destructive-op + secret-exposure gates (parity with Claude permissions / OpenCode
|
|
301
|
+
// permission map) — markered-text (slash-comment), same ownership split as the two
|
|
302
|
+
// GateGuard hooks: bkit owns only the decision engine between the markers, the
|
|
303
|
+
// stdin/stdout driver outside them is consumer-owned from first install onward, so a
|
|
304
|
+
// consumer can add their own gates without losing them on upgrade.
|
|
305
|
+
{
|
|
306
|
+
path: ".cursor/hooks/bkit-guardrails.cjs",
|
|
307
|
+
format: "markered-text",
|
|
308
|
+
module: "cursor",
|
|
309
|
+
},
|
|
310
|
+
// GateGuard advisory PreToolUse hook for Cursor — same ownership split and the
|
|
311
|
+
// same managed block as the Claude twin (byte-identical between the markers,
|
|
312
|
+
// asserted by a parity test). Wired in .cursor/hooks.json → preToolUse
|
|
313
|
+
// (matcher "Write"), without failClosed.
|
|
314
|
+
{
|
|
315
|
+
path: ".cursor/hooks/bkit-gateguard.cjs",
|
|
316
|
+
format: "markered-text",
|
|
317
|
+
module: "cursor",
|
|
318
|
+
},
|
|
319
|
+
// Curl/wget host allowlist read at runtime by bkit-guardrails.cjs. No template backs it —
|
|
320
|
+
// `writeNetworkAllowlistArtifact` (install/cloud-env.ts) computes the domain set from the
|
|
321
|
+
// consumer's own config, so it is `generated` and its hash is in `canonicalHashes`.
|
|
322
|
+
{ path: ".cursor/allowlist.json", format: "byte-equal-text", module: "cursor", generated: true },
|
|
323
|
+
// Cursor CLI / cloud-agent MCP allows — `writeCursorCliPermissionsArtifact`
|
|
324
|
+
// (install/cloud-env.ts) renders it from the consumer's `mcp-servers` block; same contract.
|
|
325
|
+
{ path: ".cursor/cli.json", format: "byte-equal-text", module: "cursor", generated: true },
|
|
326
|
+
{ path: ".cursor/rules/bkit-rules.mdc", format: "markered-text", module: "cursor" },
|
|
327
|
+
// Same per-entry ownership as `.mcp.json` (reconcileMcpJson).
|
|
328
|
+
{ path: ".cursor/mcp.json", format: "json", module: "cursor" },
|
|
329
|
+
// Mirrors from .agents/ — managed dynamically; not listed individually.
|
|
330
|
+
];
|
|
331
|
+
|
|
332
|
+
// opencode is opt-in via `bkit install --opencode=<provider>` — additive alongside
|
|
333
|
+
// always-on claude/cursor. Agent and command mirrors are managed dynamically (like
|
|
334
|
+
// claude/cursor); listed entries cover the static config + plugin files.
|
|
335
|
+
//
|
|
336
|
+
// opencode.json is Tier-2 deep-contained (writeTier2JsonContained) — it is
|
|
337
|
+
// ownership-mixed: consumers add their own provider keys, model lists, and mcp entries,
|
|
338
|
+
// so bkit must reconverge only the bkit-managed keys on upgrade (KN-17).
|
|
339
|
+
//
|
|
340
|
+
// bkit-gateguard.js is markered-text (slash-comment) — bkit owns only the advisory engine
|
|
341
|
+
// between the markers; the exported plugin driver outside the block is consumer-owned
|
|
342
|
+
// from first install onward, same split as .claude/hooks/bkit-gateguard.cjs.
|
|
343
|
+
//
|
|
344
|
+
// Dir names: .opencode/agents/ and .opencode/commands/ (plural) per opencode.ai/docs.
|
|
345
|
+
// Spike initially observed singular; official docs are plural — plural is correct.
|
|
346
|
+
export const OPENCODE_MANIFEST: ManifestEntry[] = [
|
|
347
|
+
// opencode.json — Tier-2 json (deep-contained, ownership-mixed, reconverged on upgrade).
|
|
348
|
+
// writeTier2JsonContained throws on malformed destination (KN-19 guard).
|
|
349
|
+
{ path: ".opencode/opencode.json", format: "json", module: "opencode" },
|
|
350
|
+
// bkit-gateguard.js — Tier-2 markered-text (slash-comment); see comment above.
|
|
351
|
+
{
|
|
352
|
+
path: ".opencode/plugin/bkit-gateguard.js",
|
|
353
|
+
format: "markered-text",
|
|
354
|
+
module: "opencode",
|
|
355
|
+
},
|
|
356
|
+
// Agent and command mirrors are managed dynamically (not listed individually here —
|
|
357
|
+
// the exact set depends on the bkit-prefix prompt/workflow files at install time).
|
|
358
|
+
// Uninstall uses the BKIT_PREFIX filter for .opencode/agents/ and .opencode/commands/.
|
|
359
|
+
];
|
|
360
|
+
|
|
361
|
+
// --codex: Codex CLI host. NOTE there is no `.codex/config.toml` here — `openai` is a
|
|
362
|
+
// RESERVED built-in provider id in Codex (alongside `ollama` and `lmstudio`); re-stating it
|
|
363
|
+
// under `[model_providers.openai]` is rejected.
|
|
364
|
+
// Codex reads project config from `.codex/`, and hooks load only once that layer is TRUSTED.
|
|
365
|
+
export const CODEX_MANIFEST: ManifestEntry[] = [
|
|
366
|
+
// hooks.json — Tier-2 json (deep-contained): bkit owns the PreToolUse GateGuard entry,
|
|
367
|
+
// consumers may add their own event groups alongside it.
|
|
368
|
+
{ path: ".codex/hooks.json", format: "json", module: "codex" },
|
|
369
|
+
// bkit-gateguard.cjs — Tier-2 markered-text, twin of the Claude hook (same stdin/stdout
|
|
370
|
+
// contract); differs only in tool name (apply_patch) and V4A patch-envelope parsing.
|
|
371
|
+
{
|
|
372
|
+
path: ".codex/hooks/bkit-gateguard.cjs",
|
|
373
|
+
format: "markered-text",
|
|
374
|
+
module: "codex",
|
|
375
|
+
},
|
|
376
|
+
// bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor hook (same decision
|
|
377
|
+
// engine). Registered on matcher `Bash`, Codex's shell tool name. Codex parses but
|
|
378
|
+
// does not implement `permissionDecision: "ask"`, so the deny tier blocks for real
|
|
379
|
+
// and the ask tier is emitted as advisory `additionalContext` — the documented
|
|
380
|
+
// divergence asserted in install/modules/index.integration.test.ts.
|
|
381
|
+
{
|
|
382
|
+
path: ".codex/hooks/bkit-guardrails.cjs",
|
|
383
|
+
format: "markered-text",
|
|
384
|
+
module: "codex",
|
|
385
|
+
},
|
|
386
|
+
// Agent mirrors (.codex/agents/*.toml) and workflow skills (.agents/skills/bkit-*/) are
|
|
387
|
+
// managed dynamically — the set follows the bkit-prefix prompt/workflow files at install.
|
|
388
|
+
];
|
|
389
|
+
|
|
390
|
+
// Cloud agent integration is opt-in — NOT in a default install, so a default install
|
|
391
|
+
// ships ZERO cloud footprint. Every variant writes no files: the cloud workflow
|
|
392
|
+
// (bkit-cloud.yml), bkit-cloud-bootstrap.sh and the Cursor Background Agent files
|
|
393
|
+
// (.cursor/Dockerfile, .cursor/environment.json) ship as templates
|
|
394
|
+
// (`.bkit/templates.md`); the consumer copies and owns them. Each variant only
|
|
395
|
+
// records `bkit.cloudAgents` and prints its setup advisories.
|
|
396
|
+
export const CLOUD_MANIFEST_CLAUDE: ManifestEntry[] = [];
|
|
397
|
+
|
|
398
|
+
export const CLOUD_MANIFEST_OPENCODE: ManifestEntry[] = [];
|
|
399
|
+
|
|
400
|
+
export const CLOUD_MANIFEST_CURSOR: ManifestEntry[] = [];
|
|
401
|
+
|
|
402
|
+
// Combined manifest used by MODULE_MANIFESTS.cloud (install dispatch + uninstall).
|
|
403
|
+
// Uninstall removes the union (zero-footprint): each variant's files are physically
|
|
404
|
+
// absent on an install of another variant, so removing absent files is a no-op.
|
|
405
|
+
const CLOUD_MANIFEST: ManifestEntry[] = [
|
|
406
|
+
...CLOUD_MANIFEST_CLAUDE,
|
|
407
|
+
...CLOUD_MANIFEST_OPENCODE,
|
|
408
|
+
...CLOUD_MANIFEST_CURSOR,
|
|
409
|
+
];
|
|
410
|
+
|
|
411
|
+
// ---------------------------------------------------------------------------
|
|
412
|
+
// Module registry
|
|
413
|
+
// ---------------------------------------------------------------------------
|
|
414
|
+
|
|
415
|
+
const MODULE_MANIFESTS: Record<ModuleName, ManifestEntry[]> = {
|
|
416
|
+
core: CORE_MANIFEST,
|
|
417
|
+
claude: CLAUDE_MANIFEST,
|
|
418
|
+
cursor: CURSOR_MANIFEST,
|
|
419
|
+
opencode: OPENCODE_MANIFEST,
|
|
420
|
+
codex: CODEX_MANIFEST,
|
|
421
|
+
cloud: CLOUD_MANIFEST,
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
// ---------------------------------------------------------------------------
|
|
425
|
+
// Public API
|
|
426
|
+
// ---------------------------------------------------------------------------
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Return a flat array of all ManifestEntry records for the given module names.
|
|
430
|
+
* When `modules` is empty, returns entries for all modules.
|
|
431
|
+
*/
|
|
432
|
+
export function getInstallManifest(modules: ModuleName[] | Set<string> = []): ManifestEntry[] {
|
|
433
|
+
const keys =
|
|
434
|
+
modules instanceof Set
|
|
435
|
+
? ([...modules].filter((m) => m in MODULE_MANIFESTS) as ModuleName[])
|
|
436
|
+
: modules.length === 0
|
|
437
|
+
? (Object.keys(MODULE_MANIFESTS) as ModuleName[])
|
|
438
|
+
: modules;
|
|
439
|
+
|
|
440
|
+
return keys.flatMap((m) => MODULE_MANIFESTS[m] ?? []);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Return ALL manifest entries for a single module.
|
|
445
|
+
*/
|
|
446
|
+
export function getModuleManifest(module: ModuleName): ManifestEntry[] {
|
|
447
|
+
return MODULE_MANIFESTS[module] ?? [];
|
|
448
|
+
}
|