@cbartens/bkit 0.0.0-stage → 5.0.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/.bkit/README.md +421 -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 +421 -0
- package/.bkit/core/.bkit/cloud.md +502 -0
- package/.bkit/core/.bkit/comparison.md +318 -0
- package/.bkit/core/.bkit/install.md +496 -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 +471 -0
- package/.bkit/core/.bkit/trackers.md +95 -0
- package/.bkit/core/.bkit/workflows.md +1546 -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 +247 -0
- package/.bkit/core/engine/checks/after/ci-yml.ts +739 -0
- package/.bkit/core/engine/checks/after/github.ts +424 -0
- package/.bkit/core/engine/checks/after/index.ts +556 -0
- package/.bkit/core/engine/checks/after/managed.ts +217 -0
- package/.bkit/core/engine/checks/after/tools.ts +427 -0
- package/.bkit/core/engine/checks/after/vercel.ts +101 -0
- package/.bkit/core/engine/checks/before/context-fetch.ts +429 -0
- package/.bkit/core/engine/checks/before/env.ts +201 -0
- package/.bkit/core/engine/checks/before/files.ts +202 -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 +871 -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 +247 -0
- package/.bkit/core/engine/commands/install/install.ts +528 -0
- package/.bkit/core/engine/commands/install/uninstall.ts +972 -0
- package/.bkit/core/engine/commands/install/upgrade.ts +1026 -0
- package/.bkit/core/engine/commands/launch.ts +139 -0
- package/.bkit/core/engine/commands/lib.ts +494 -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 +925 -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 +174 -0
- package/.bkit/core/engine/install/modules/codex.ts +219 -0
- package/.bkit/core/engine/install/modules/core.ts +600 -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/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 +642 -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 +108 -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 +438 -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 +92 -0
- package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +192 -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 +239 -0
- package/.bkit/templates/.github/workflows/bkit-ci.yml +1082 -0
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +566 -0
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +107 -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 +1486 -0
- package/LICENSE.md +161 -0
- package/README.md +185 -2
- package/dist/checks/after/auth.js +232 -0
- package/dist/checks/after/ci-yml.js +718 -0
- package/dist/checks/after/github.js +400 -0
- package/dist/checks/after/index.js +447 -0
- package/dist/checks/after/managed.js +187 -0
- package/dist/checks/after/tools.js +351 -0
- package/dist/checks/after/vercel.js +102 -0
- package/dist/checks/before/context-fetch.js +426 -0
- package/dist/checks/before/env.js +173 -0
- package/dist/checks/before/files.js +185 -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 +692 -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 +207 -0
- package/dist/commands/install/install.js +461 -0
- package/dist/commands/install/uninstall.js +815 -0
- package/dist/commands/install/upgrade.js +771 -0
- package/dist/commands/launch.js +118 -0
- package/dist/commands/lib.js +362 -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 +819 -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 +152 -0
- package/dist/install/modules/codex.js +193 -0
- package/dist/install/modules/core.js +511 -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/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,38 @@
|
|
|
1
|
+
// render/parts.ts — splice the shared hook parts into each host's hook template.
|
|
2
|
+
//
|
|
3
|
+
// A host hook template (`.bkit/core/.claude/hooks/bkit-gateguard.cjs`, …) carries only
|
|
4
|
+
// what differs per host: its module syntax, its payload adapter, its output envelope.
|
|
5
|
+
// The code every host shares lives once in `.bkit/core/hooks/` and is spliced
|
|
6
|
+
// in wherever a template line reads `// {{BKIT_PART <file>}}` (JS) or
|
|
7
|
+
// `# {{BKIT_PART <file>}}` (shell). The generated hook is plain JS / bash with no runtime
|
|
8
|
+
// dependency on bkit, so it works before and without `node_modules`.
|
|
9
|
+
//
|
|
10
|
+
// Every template read on the install path goes through `readTemplate`, so install,
|
|
11
|
+
// upgrade, `bkit check` drift and uninstall all see the generated file.
|
|
12
|
+
|
|
13
|
+
import * as fs from "node:fs";
|
|
14
|
+
import * as path from "node:path";
|
|
15
|
+
|
|
16
|
+
import { getHooksRoot } from "../shared/package-roots.js";
|
|
17
|
+
|
|
18
|
+
/** A whole line naming one part: `// {{BKIT_PART name}}` or `# {{BKIT_PART name}}`. */
|
|
19
|
+
const PART_LINE = /^[ \t]*(?:\/\/|#)[ \t]*\{\{BKIT_PART[ \t]+([A-Za-z0-9._-]+)\}\}[ \t]*$/gm;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `content` with every part line replaced by that part's text. A part never names
|
|
23
|
+
* another part. A missing part is a corrupt package: it throws.
|
|
24
|
+
*/
|
|
25
|
+
export function renderParts(content: string, partsDir: string = getHooksRoot()): string {
|
|
26
|
+
return content.replace(PART_LINE, (_line, name: string) => {
|
|
27
|
+
const file = path.join(partsDir, name);
|
|
28
|
+
if (!fs.existsSync(file)) {
|
|
29
|
+
throw new Error(`[bkit-render] hook part not found: ${file}`);
|
|
30
|
+
}
|
|
31
|
+
return fs.readFileSync(file, "utf-8").replace(/\n$/, "");
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** A template file's content as install writes it, before token substitution. */
|
|
36
|
+
export function readTemplate(srcPath: string): string {
|
|
37
|
+
return renderParts(fs.readFileSync(srcPath, "utf-8"));
|
|
38
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// render/trackers.ts — resolve tracker-specific blocks in workflow and prompt source
|
|
2
|
+
// files at install time. Consumed by install/modules/index.ts when the host-pass mirrors
|
|
3
|
+
// `.bkit/workflows/bkit-*.md` to host commands and `.bkit/prompts/bkit-*.md` to
|
|
4
|
+
// host agents.
|
|
5
|
+
//
|
|
6
|
+
// Inline model (no trackers.md substitution): every tracker call site carries the
|
|
7
|
+
// `github` and `linear` variants inline as a consecutive pair. The installer keeps
|
|
8
|
+
// the block matching the chosen tracker and drops the other. Two boolean
|
|
9
|
+
// conditional dialects gate tracker-agnostic content:
|
|
10
|
+
//
|
|
11
|
+
// <!-- bkit:tracker true start/end --> kept when a tracker IS connected; removed under none
|
|
12
|
+
// <!-- bkit:tracker false start/end --> kept ONLY under none; removed when wired
|
|
13
|
+
//
|
|
14
|
+
// Under `none` a pair collapses to its trailing `false` block if present (the
|
|
15
|
+
// substantive no-tracker behaviour — e.g. `issue-id-extraction`, `fid-format`,
|
|
16
|
+
// `pr-body-marker`), otherwise to one generic skip message. There is no separate
|
|
17
|
+
// `none` marker — no-tracker content is always `false`.
|
|
18
|
+
//
|
|
19
|
+
// See `.bkit/trackers.md` for the marker contract.
|
|
20
|
+
|
|
21
|
+
import type { IssueTracker } from "../install/manifest.js";
|
|
22
|
+
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Types
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
export interface SubstituteResult {
|
|
28
|
+
/** Workflow content with tracker blocks resolved for the chosen tracker. */
|
|
29
|
+
output: string;
|
|
30
|
+
/** Number of github/linear pairs resolved (to a body or the none stub). */
|
|
31
|
+
pairs: number;
|
|
32
|
+
/** Number of `true`/`false` conditional blocks resolved (kept or removed). */
|
|
33
|
+
conditionals: number;
|
|
34
|
+
/** Orphan markers left after resolution (malformed/incomplete blocks). */
|
|
35
|
+
orphans: string[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// Markers
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
/** Generic message rendered in place of a github/linear pair when no tracker is wired. */
|
|
43
|
+
const NONE_STUB = "_No tracker connected, skip step._";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Marker regex source. An optional `# ` prefix belongs to the marker: inside YAML
|
|
47
|
+
* frontmatter a marker line is written as a YAML comment
|
|
48
|
+
* (` # <!-- bkit:tracker github start -->`) so the raw source stays valid YAML
|
|
49
|
+
* for tools that parse it unresolved (vale). The prefix is consumed with the marker.
|
|
50
|
+
*/
|
|
51
|
+
function marker(name: string, edge: string): string {
|
|
52
|
+
return `(?:#[ \\t]*)?<!--\\s*bkit:tracker\\s+${name}\\s+${edge}\\s*-->`;
|
|
53
|
+
}
|
|
54
|
+
/** `start` marker, captured body, `end` marker. */
|
|
55
|
+
function block(name: string): string {
|
|
56
|
+
return `${marker(name, "start")}([\\s\\S]*?)${marker(name, "end")}`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Per-tracker group: a consecutive `github` → `linear` pair, each
|
|
61
|
+
* `<!-- bkit:tracker {name} start -->` … `<!-- bkit:tracker {name} end -->`,
|
|
62
|
+
* with an OPTIONAL trailing `false` block. The whitespace BEFORE the optional
|
|
63
|
+
* `false` block lives INSIDE the optional group (`(?:\s*<false>)?`), so when no
|
|
64
|
+
* `false` follows the pair, the trailing newline + indent are left untouched —
|
|
65
|
+
* otherwise content immediately after the pair would jam onto the kept body. A
|
|
66
|
+
* list-number prefix (`3. `) precedes the first marker and is left untouched, so
|
|
67
|
+
* the kept body / none stub attaches to it cleanly.
|
|
68
|
+
*
|
|
69
|
+
* `none` resolution: if a trailing `false` block is present (substantive
|
|
70
|
+
* no-tracker behaviour — e.g. `issue-id-extraction`, `fid-format`,
|
|
71
|
+
* `pr-body-marker`), use its body; otherwise emit the generic skip message.
|
|
72
|
+
* (Standalone `false` blocks not attached to a pair are handled in pass 2.)
|
|
73
|
+
*/
|
|
74
|
+
const PAIR_RE = new RegExp(
|
|
75
|
+
block("github") + "\\s*" + block("linear") + "(?:\\s*" + block("false") + ")?",
|
|
76
|
+
"g",
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
/** Conditional-keep block, KEEP form (markers stripped, content trimmed in place). */
|
|
80
|
+
function condKeepRe(name: "true" | "false"): RegExp {
|
|
81
|
+
return new RegExp(block(name), "g");
|
|
82
|
+
}
|
|
83
|
+
/** Conditional-keep block, REMOVE form (consumes the leading newline + indent). */
|
|
84
|
+
function condDropRe(name: "true" | "false"): RegExp {
|
|
85
|
+
return new RegExp(`\\n?[ \\t]*${block(name)}`, "g");
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Any tracker marker surviving resolution is an orphan (lone github/linear, or
|
|
89
|
+
// unbalanced true/false).
|
|
90
|
+
const ORPHAN_RE = new RegExp(marker("(github|linear|true|false)", "(?:start|end)"), "g");
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* When keeping in-place content, drop the newline (and its indentation)
|
|
94
|
+
* immediately after `start -->` and immediately before the `end` marker, so the
|
|
95
|
+
* kept content attaches to the pre-marker indentation cleanly instead of gaining
|
|
96
|
+
* a blank line / double indent. Author markers at the same indent as their
|
|
97
|
+
* content for aligned output.
|
|
98
|
+
*/
|
|
99
|
+
function trimKeptContent(s: string): string {
|
|
100
|
+
return s.replace(/^\r?\n[ \t]*/, "").replace(/\r?\n[ \t]*$/, "");
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
// Resolution
|
|
105
|
+
// ---------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Resolve tracker blocks in a workflow source file for the chosen tracker.
|
|
109
|
+
*
|
|
110
|
+
* Pass 1 collapses each github/linear pair to the chosen tracker's body, or — for
|
|
111
|
+
* `none` — to the generic skip message. Pass 2 resolves the `true`/`false`
|
|
112
|
+
* conditional blocks (kept when their condition matches the chosen tracker,
|
|
113
|
+
* removed otherwise) — run AFTER pass 1 so pairs nested inside a kept conditional
|
|
114
|
+
* are resolved first. Mirror output is clean — no markers remain.
|
|
115
|
+
*
|
|
116
|
+
* Always operates on workflow SOURCE (which has markers). Mirror output is
|
|
117
|
+
* regenerated from source each install.
|
|
118
|
+
*/
|
|
119
|
+
export function substituteWorkflow(
|
|
120
|
+
workflowContent: string,
|
|
121
|
+
tracker: IssueTracker,
|
|
122
|
+
): SubstituteResult {
|
|
123
|
+
const wired = tracker !== "none";
|
|
124
|
+
|
|
125
|
+
// Pass 1: github/linear pairs → chosen tracker's body; none → the pair's
|
|
126
|
+
// trailing `false` block if present, else the generic skip message.
|
|
127
|
+
let pairs = 0;
|
|
128
|
+
let output = workflowContent.replace(
|
|
129
|
+
PAIR_RE,
|
|
130
|
+
(_match, gh: string, ln: string, falseBody: string | undefined) => {
|
|
131
|
+
pairs++;
|
|
132
|
+
if (tracker === "github") return trimKeptContent(gh);
|
|
133
|
+
if (tracker === "linear") return trimKeptContent(ln);
|
|
134
|
+
return falseBody !== undefined ? trimKeptContent(falseBody) : NONE_STUB;
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
// Pass 2: standalone conditional `true`/`false` blocks (any `false` attached to
|
|
139
|
+
// a pair was already consumed in pass 1).
|
|
140
|
+
let conditionals = 0;
|
|
141
|
+
for (const name of ["true", "false"] as const) {
|
|
142
|
+
const active = name === "true" ? wired : !wired;
|
|
143
|
+
if (active) {
|
|
144
|
+
output = output.replace(condKeepRe(name), (_m, content: string) => {
|
|
145
|
+
conditionals++;
|
|
146
|
+
return trimKeptContent(content);
|
|
147
|
+
});
|
|
148
|
+
} else {
|
|
149
|
+
output = output.replace(condDropRe(name), () => {
|
|
150
|
+
conditionals++;
|
|
151
|
+
return "";
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return { output, pairs, conditionals, orphans: findOrphanMarkers(output) };
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Find tracker markers that didn't participate in a successful resolution — a
|
|
161
|
+
* lone github/linear block (not part of a complete pair) or an unbalanced
|
|
162
|
+
* true/false pair.
|
|
163
|
+
*/
|
|
164
|
+
function findOrphanMarkers(content: string): string[] {
|
|
165
|
+
const orphans: string[] = [];
|
|
166
|
+
ORPHAN_RE.lastIndex = 0;
|
|
167
|
+
let m: RegExpExecArray | null;
|
|
168
|
+
while ((m = ORPHAN_RE.exec(content)) !== null) orphans.push(m[1]);
|
|
169
|
+
return orphans;
|
|
170
|
+
}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
// Egress registry leaf. Pure data: zero imports, zero control flow. All branching lives
|
|
2
|
+
// in install/cloud-env.ts.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Providers bkit supports for the opencode host. `--opencode=<provider>` accepts
|
|
6
|
+
* ONLY these — anything else is rejected (no generic/arbitrary-endpoint fallback).
|
|
7
|
+
* Keep in sync with OPENCODE_PROVIDER_DEFAULTS (below) and
|
|
8
|
+
* GATEWAY_COLUMN (render/models.ts § Models lookup).
|
|
9
|
+
*/
|
|
10
|
+
export const OPENCODE_PROVIDERS = [
|
|
11
|
+
// OpenAI-compatible npm driver — endpoint + key per provider.
|
|
12
|
+
"openrouter",
|
|
13
|
+
"ollama",
|
|
14
|
+
// opencode-native gateways — two DISTINCT models.dev providers with separate catalogs.
|
|
15
|
+
// CLI: opencode-zen / opencode-go. Agent model pins: opencode/<id> (Zen built-in id) and
|
|
16
|
+
// opencode-go/<id>. Both auth via BKIT_OPENCODE_API_KEY. See providers.md § Models.
|
|
17
|
+
"opencode-zen",
|
|
18
|
+
"opencode-go",
|
|
19
|
+
] as const;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* One egress source: a bkit-shipped surface that an agent session reaches over the
|
|
23
|
+
* network. `hosts` are the exact hostnames contacted. `bases` are the registrable
|
|
24
|
+
* domains those hosts collapse to, written as a LIST because one source can span
|
|
25
|
+
* sibling domains. `reason` is required when `bases` is empty, and whenever a row
|
|
26
|
+
* overrides the default its kind would otherwise derive.
|
|
27
|
+
*
|
|
28
|
+
* `kind` carries no behaviour. Only `opencode-provider` rows are tied back to a
|
|
29
|
+
* provider baseURL; the test suite asserts that tie.
|
|
30
|
+
*/
|
|
31
|
+
export interface EgressSource {
|
|
32
|
+
id: string;
|
|
33
|
+
kind:
|
|
34
|
+
| "opencode-provider"
|
|
35
|
+
| "tracker-mcp"
|
|
36
|
+
| "agent-host"
|
|
37
|
+
| "package-registry"
|
|
38
|
+
| "skills"
|
|
39
|
+
| "tooling-api"
|
|
40
|
+
| "audit-standard";
|
|
41
|
+
hosts: readonly string[];
|
|
42
|
+
bases: readonly string[];
|
|
43
|
+
reason?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Per-provider provider key name + base URL + env var suggestions.
|
|
47
|
+
// These are sane defaults; consumers tune after install.
|
|
48
|
+
// npmPackage: set for custom OpenAI-compatible providers that use npm-based AI SDK driver.
|
|
49
|
+
export const OPENCODE_PROVIDER_DEFAULTS: Record<
|
|
50
|
+
string,
|
|
51
|
+
{
|
|
52
|
+
envVar: string;
|
|
53
|
+
baseURL: string;
|
|
54
|
+
apiPlaceholder: string;
|
|
55
|
+
npmPackage?: string;
|
|
56
|
+
displayName?: string;
|
|
57
|
+
// builtin: opencode-native provider that opencode resolves from models.dev — no npm
|
|
58
|
+
// driver and no baseURL. Per-model routing (openai-compatible vs anthropic /messages)
|
|
59
|
+
// stays correct; a forced npm+baseURL causes wrong-URL errors on Qwen/MiniMax.
|
|
60
|
+
builtin?: boolean;
|
|
61
|
+
// providerId: the opencode-side provider id (defaults to the bkit key; model ids are providerId/<model>).
|
|
62
|
+
providerId?: string;
|
|
63
|
+
}
|
|
64
|
+
> = {
|
|
65
|
+
// Aggregator — one key, every model (incl :free variants). A named, pinned provider
|
|
66
|
+
// (NOT an any-endpoint fallback).
|
|
67
|
+
// opencode custom providers use the npm driver (NOT an "api" field, which is invalid
|
|
68
|
+
// and makes opencode reject the whole config) and read keys via {env:VAR} — never
|
|
69
|
+
// shell ${VAR}. See https://opencode.ai/docs/config + /docs/providers.
|
|
70
|
+
openrouter: {
|
|
71
|
+
envVar: "BKIT_OPENROUTER_API_KEY",
|
|
72
|
+
baseURL: "https://openrouter.ai/api/v1",
|
|
73
|
+
apiPlaceholder: "{env:BKIT_OPENROUTER_API_KEY}",
|
|
74
|
+
npmPackage: "@ai-sdk/openai-compatible",
|
|
75
|
+
displayName: "OpenRouter",
|
|
76
|
+
},
|
|
77
|
+
// Cloud-hosted Ollama (ollama.com). Matches opencode's own naming where built-in
|
|
78
|
+
// `ollama` = the cloud service.
|
|
79
|
+
ollama: {
|
|
80
|
+
envVar: "BKIT_OLLAMA_API_KEY",
|
|
81
|
+
baseURL: "https://ollama.com/v1",
|
|
82
|
+
apiPlaceholder: "{env:BKIT_OLLAMA_API_KEY}",
|
|
83
|
+
npmPackage: "@ai-sdk/openai-compatible",
|
|
84
|
+
displayName: "Ollama",
|
|
85
|
+
},
|
|
86
|
+
// opencode-native gateways — two DISTINCT models.dev providers, both auth'd via
|
|
87
|
+
// BKIT_OPENCODE_API_KEY. Built-in (apiKey only): OpenCode resolves endpoints + per-model SDK
|
|
88
|
+
// from models.dev. CLI keys are opencode-zen / opencode-go; Zen's models.dev id is
|
|
89
|
+
// `opencode` (agent pins opencode/<id>), Go's id is `opencode-go` (opencode-go/<id>).
|
|
90
|
+
"opencode-zen": {
|
|
91
|
+
envVar: "BKIT_OPENCODE_API_KEY",
|
|
92
|
+
baseURL: "",
|
|
93
|
+
apiPlaceholder: "{env:BKIT_OPENCODE_API_KEY}",
|
|
94
|
+
builtin: true,
|
|
95
|
+
providerId: "opencode",
|
|
96
|
+
displayName: "OpenCode Zen",
|
|
97
|
+
},
|
|
98
|
+
"opencode-go": {
|
|
99
|
+
envVar: "BKIT_OPENCODE_API_KEY",
|
|
100
|
+
baseURL: "",
|
|
101
|
+
apiPlaceholder: "{env:BKIT_OPENCODE_API_KEY}",
|
|
102
|
+
builtin: true,
|
|
103
|
+
providerId: "opencode-go",
|
|
104
|
+
displayName: "OpenCode Go",
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The shipped egress sources. `hosts` and `bases` are literal arrays: the leaf parses
|
|
110
|
+
* no URL. For `opencode-provider` rows the literals are gate-checked against the
|
|
111
|
+
* provider baseURL by the suffix-invariant test.
|
|
112
|
+
*
|
|
113
|
+
* Not listed:
|
|
114
|
+
* - Dependency-updater hosts (Renovate, Dependabot): egress on the updater's runner,
|
|
115
|
+
* never inside an agent session.
|
|
116
|
+
* - The literal "none" member of `ISSUE_TRACKERS`: a sentinel. The completeness test
|
|
117
|
+
* skips exactly "none" and asserts it was the only skip.
|
|
118
|
+
* - `json.schemastore.org`: fetched by the editor JSON language server, never by an
|
|
119
|
+
* agent tool call.
|
|
120
|
+
* - `kimi.com`: outside the four-provider opencode allowlist
|
|
121
|
+
* (`opencode-provider-allowlist-cut-to-four`).
|
|
122
|
+
*/
|
|
123
|
+
export const BKIT_EGRESS_SOURCES: readonly EgressSource[] = [
|
|
124
|
+
{
|
|
125
|
+
id: "openrouter",
|
|
126
|
+
kind: "opencode-provider",
|
|
127
|
+
hosts: ["openrouter.ai"],
|
|
128
|
+
bases: ["openrouter.ai"],
|
|
129
|
+
},
|
|
130
|
+
{ id: "ollama", kind: "opencode-provider", hosts: ["ollama.com"], bases: ["ollama.com"] },
|
|
131
|
+
{
|
|
132
|
+
id: "opencode-zen",
|
|
133
|
+
kind: "opencode-provider",
|
|
134
|
+
hosts: ["opencode.ai", "models.dev"],
|
|
135
|
+
bases: ["opencode.ai", "models.dev"],
|
|
136
|
+
reason: "baseURL is empty (builtin); endpoints resolved via models.dev",
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: "opencode-go",
|
|
140
|
+
kind: "opencode-provider",
|
|
141
|
+
hosts: ["opencode.ai", "models.dev"],
|
|
142
|
+
bases: ["opencode.ai", "models.dev"],
|
|
143
|
+
reason: "baseURL is empty (builtin); a distinct registry key, so a distinct row",
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "mcp-github",
|
|
147
|
+
kind: "tracker-mcp",
|
|
148
|
+
hosts: ["api.githubcopilot.com"],
|
|
149
|
+
bases: ["githubcopilot.com"],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "mcp-linear",
|
|
153
|
+
kind: "tracker-mcp",
|
|
154
|
+
hosts: ["mcp.linear.app", "api.linear.app"],
|
|
155
|
+
bases: ["linear.app"],
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "agent-claude",
|
|
159
|
+
kind: "agent-host",
|
|
160
|
+
hosts: ["console.anthropic.com"],
|
|
161
|
+
bases: ["anthropic.com", "claude.com"],
|
|
162
|
+
},
|
|
163
|
+
{ id: "agent-cursor", kind: "agent-host", hosts: ["api.cursor.com"], bases: ["cursor.com"] },
|
|
164
|
+
{ id: "agent-opencode", kind: "agent-host", hosts: ["opencode.ai"], bases: ["opencode.ai"] },
|
|
165
|
+
{
|
|
166
|
+
id: "pkg-npm",
|
|
167
|
+
kind: "package-registry",
|
|
168
|
+
hosts: ["registry.npmjs.org"],
|
|
169
|
+
bases: ["npmjs.com", "npmjs.org"],
|
|
170
|
+
reason:
|
|
171
|
+
"the registry API host sits on a sibling TLD its .com base cannot cover on a label boundary",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
id: "pkg-github",
|
|
175
|
+
kind: "package-registry",
|
|
176
|
+
hosts: ["npm.pkg.github.com", "raw.githubusercontent.com"],
|
|
177
|
+
bases: ["github.com", "githubusercontent.com"],
|
|
178
|
+
},
|
|
179
|
+
{ id: "skills-sh", kind: "skills", hosts: ["skills.sh"], bases: ["skills.sh"] },
|
|
180
|
+
{ id: "tooling-tavily", kind: "tooling-api", hosts: ["api.tavily.com"], bases: ["tavily.com"] },
|
|
181
|
+
// Audit anchor standards. Every consumer gets the `docs/templates/bkit-audit-*.md` set,
|
|
182
|
+
// and each template's Standards step reads its anchors over WebFetch. Only standards
|
|
183
|
+
// bodies, specs and model makers' prompting guides belong here: a vendor or platform a
|
|
184
|
+
// template names as an example (Sentry, Supabase, Apple, Google Play, web.dev) is
|
|
185
|
+
// stack-specific, so a consumer that uses it declares it in its own block.
|
|
186
|
+
{
|
|
187
|
+
id: "audit-security-ai",
|
|
188
|
+
kind: "audit-standard",
|
|
189
|
+
hosts: [
|
|
190
|
+
"owasp.org",
|
|
191
|
+
"genai.owasp.org",
|
|
192
|
+
"mas.owasp.org",
|
|
193
|
+
"atlas.mitre.org",
|
|
194
|
+
"www.nist.gov",
|
|
195
|
+
"airc.nist.gov",
|
|
196
|
+
"nvlpubs.nist.gov",
|
|
197
|
+
"openssf.org",
|
|
198
|
+
"best.openssf.org",
|
|
199
|
+
"baseline.openssf.org",
|
|
200
|
+
"slsa.dev",
|
|
201
|
+
"modelcontextprotocol.io",
|
|
202
|
+
],
|
|
203
|
+
bases: [
|
|
204
|
+
"owasp.org",
|
|
205
|
+
"mitre.org",
|
|
206
|
+
"nist.gov",
|
|
207
|
+
"openssf.org",
|
|
208
|
+
"slsa.dev",
|
|
209
|
+
"modelcontextprotocol.io",
|
|
210
|
+
],
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: "audit-prompting-guides",
|
|
214
|
+
kind: "audit-standard",
|
|
215
|
+
hosts: [
|
|
216
|
+
"docs.claude.com",
|
|
217
|
+
"platform.claude.com",
|
|
218
|
+
"www.anthropic.com",
|
|
219
|
+
"platform.openai.com",
|
|
220
|
+
"cookbook.openai.com",
|
|
221
|
+
"developers.openai.com",
|
|
222
|
+
"ai.google.dev",
|
|
223
|
+
],
|
|
224
|
+
bases: ["claude.com", "anthropic.com", "openai.com", "google.dev"],
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: "audit-law-and-specs",
|
|
228
|
+
kind: "audit-standard",
|
|
229
|
+
hosts: [
|
|
230
|
+
"www.w3.org",
|
|
231
|
+
"www.iso.org",
|
|
232
|
+
"www.etsi.org",
|
|
233
|
+
"eur-lex.europa.eu",
|
|
234
|
+
"digital-strategy.ec.europa.eu",
|
|
235
|
+
"ec.europa.eu",
|
|
236
|
+
"www.edpb.europa.eu",
|
|
237
|
+
"ico.org.uk",
|
|
238
|
+
"www.rfc-editor.org",
|
|
239
|
+
"datatracker.ietf.org",
|
|
240
|
+
"cabforum.org",
|
|
241
|
+
"schema.org",
|
|
242
|
+
"spdx.org",
|
|
243
|
+
"opentelemetry.io",
|
|
244
|
+
],
|
|
245
|
+
bases: [
|
|
246
|
+
"w3.org",
|
|
247
|
+
"iso.org",
|
|
248
|
+
"etsi.org",
|
|
249
|
+
"europa.eu",
|
|
250
|
+
"ico.org.uk",
|
|
251
|
+
"rfc-editor.org",
|
|
252
|
+
"ietf.org",
|
|
253
|
+
"cabforum.org",
|
|
254
|
+
"schema.org",
|
|
255
|
+
"spdx.org",
|
|
256
|
+
"opentelemetry.io",
|
|
257
|
+
],
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: "audit-engineering-practice",
|
|
261
|
+
kind: "audit-standard",
|
|
262
|
+
hosts: [
|
|
263
|
+
"sre.google",
|
|
264
|
+
"dora.dev",
|
|
265
|
+
"12factor.net",
|
|
266
|
+
"www.finops.org",
|
|
267
|
+
"focus.finops.org",
|
|
268
|
+
"c4model.com",
|
|
269
|
+
"diataxis.fr",
|
|
270
|
+
"www.nngroup.com",
|
|
271
|
+
"scrumguides.org",
|
|
272
|
+
"kanbanguides.org",
|
|
273
|
+
"endoflife.date",
|
|
274
|
+
"bugzilla.mozilla.org",
|
|
275
|
+
"wiki.mozilla.org",
|
|
276
|
+
],
|
|
277
|
+
bases: [
|
|
278
|
+
"sre.google",
|
|
279
|
+
"dora.dev",
|
|
280
|
+
"12factor.net",
|
|
281
|
+
"finops.org",
|
|
282
|
+
"c4model.com",
|
|
283
|
+
"diataxis.fr",
|
|
284
|
+
"nngroup.com",
|
|
285
|
+
"scrumguides.org",
|
|
286
|
+
"kanbanguides.org",
|
|
287
|
+
"endoflife.date",
|
|
288
|
+
"mozilla.org",
|
|
289
|
+
],
|
|
290
|
+
},
|
|
291
|
+
];
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Public-suffix shortlist. A naive last-two-labels collapse turns `app.example.co.uk`
|
|
295
|
+
* into `co.uk`, allowing an entire national namespace, so a host whose final two labels
|
|
296
|
+
* match one of these takes three labels instead.
|
|
297
|
+
*/
|
|
298
|
+
export const MULTI_LABEL_SUFFIXES: readonly string[] = [
|
|
299
|
+
"co.uk",
|
|
300
|
+
"org.uk",
|
|
301
|
+
"ac.uk",
|
|
302
|
+
"gov.uk",
|
|
303
|
+
"co.jp",
|
|
304
|
+
"or.jp",
|
|
305
|
+
"ne.jp",
|
|
306
|
+
"com.au",
|
|
307
|
+
"net.au",
|
|
308
|
+
"org.au",
|
|
309
|
+
"com.br",
|
|
310
|
+
"com.cn",
|
|
311
|
+
"net.cn",
|
|
312
|
+
"org.cn",
|
|
313
|
+
"com.mx",
|
|
314
|
+
"com.tr",
|
|
315
|
+
"co.nz",
|
|
316
|
+
"co.za",
|
|
317
|
+
"co.in",
|
|
318
|
+
"com.sg",
|
|
319
|
+
"com.hk",
|
|
320
|
+
];
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Shared-tenant apexes: a base collapse to one of these grants every tenant on the
|
|
324
|
+
* platform. The gate is a DENY, never a rewriter; an apex absent from this list passes.
|
|
325
|
+
*/
|
|
326
|
+
export const MULTI_TENANT_APEXES: readonly string[] = [
|
|
327
|
+
"amazonaws.com",
|
|
328
|
+
"googleapis.com",
|
|
329
|
+
"azure.com",
|
|
330
|
+
"azurewebsites.net",
|
|
331
|
+
"cloudfront.net",
|
|
332
|
+
"workers.dev",
|
|
333
|
+
"vercel.app",
|
|
334
|
+
"netlify.app",
|
|
335
|
+
"pages.dev",
|
|
336
|
+
"hf.space",
|
|
337
|
+
"run.app",
|
|
338
|
+
"appspot.com",
|
|
339
|
+
"herokuapp.com",
|
|
340
|
+
"fly.dev",
|
|
341
|
+
"onrender.com",
|
|
342
|
+
"supabase.co",
|
|
343
|
+
"github.io",
|
|
344
|
+
"gitlab.io",
|
|
345
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// shared/json.ts — `JSON.parse` without the throw, for consumer-authored input.
|
|
2
|
+
//
|
|
3
|
+
// Every read of a file bkit does not own (package.json, .mcp.json, settings JSON,
|
|
4
|
+
// .bkit/version) must fail open into a result the caller reports in its own terms,
|
|
5
|
+
// never abort install, upgrade or `bkit check`. One shape, one catch — so the
|
|
6
|
+
// defensive-slop gate reads a single documented fallback instead of one per caller.
|
|
7
|
+
|
|
8
|
+
/** `JSON.parse(raw)` as a result: `{ ok: true, value }`, or `{ ok: false }` when not JSON. */
|
|
9
|
+
export function parseJson(raw: string): { ok: true; value: unknown } | { ok: false } {
|
|
10
|
+
try {
|
|
11
|
+
return { ok: true, value: JSON.parse(raw) as unknown };
|
|
12
|
+
} catch {
|
|
13
|
+
// Not JSON: the result says so, and the caller reports it in its own terms.
|
|
14
|
+
return { ok: false };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// shared/log-prefix.ts — the log prefix every install-side message carries.
|
|
2
|
+
|
|
3
|
+
// The running verb sets it (setLogPrefix: "[bkit-check]" for `bkit check`, …) so log
|
|
4
|
+
// scanners can tell which verb actually ran.
|
|
5
|
+
export let LOG_PREFIX = "[bkit-install]";
|
|
6
|
+
|
|
7
|
+
export function setLogPrefix(prefix: string): void {
|
|
8
|
+
LOG_PREFIX = prefix;
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// shared/package-json.ts — read a checkout's `package.json`, saying why when it cannot.
|
|
2
|
+
//
|
|
3
|
+
// Commands that look up a script or a `bkit` setting need to tell "no file" and
|
|
4
|
+
// "file is not JSON" apart from "key absent", so a broken manifest is named in the
|
|
5
|
+
// message instead of reading as an empty one.
|
|
6
|
+
|
|
7
|
+
import * as fs from "node:fs";
|
|
8
|
+
import * as path from "node:path";
|
|
9
|
+
|
|
10
|
+
import { parseJson } from "./json.js";
|
|
11
|
+
|
|
12
|
+
export type PackageJsonRead =
|
|
13
|
+
{ ok: true; pkg: Record<string, unknown> } | { ok: false; reason: "missing" | "unparseable" };
|
|
14
|
+
|
|
15
|
+
/** `dir/package.json` as an object, or why it could not be read as one. */
|
|
16
|
+
export function readPackageJson(dir: string): PackageJsonRead {
|
|
17
|
+
const file = path.join(dir, "package.json");
|
|
18
|
+
if (!fs.existsSync(file)) return { ok: false, reason: "missing" };
|
|
19
|
+
const parsed = parseJson(fs.readFileSync(file, "utf-8"));
|
|
20
|
+
if (
|
|
21
|
+
!parsed.ok ||
|
|
22
|
+
typeof parsed.value !== "object" ||
|
|
23
|
+
parsed.value === null ||
|
|
24
|
+
Array.isArray(parsed.value)
|
|
25
|
+
) {
|
|
26
|
+
return { ok: false, reason: "unparseable" };
|
|
27
|
+
}
|
|
28
|
+
return { ok: true, pkg: parsed.value as Record<string, unknown> };
|
|
29
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// shared/package-manager.ts — the one place that names the package manager.
|
|
2
|
+
//
|
|
3
|
+
// bkit installs and upgrades itself with pnpm, so a consumer repo is a pnpm repo.
|
|
4
|
+
// Every command that runs a package script or an install builds the command here,
|
|
5
|
+
// so changing that decision is a change to this file only.
|
|
6
|
+
|
|
7
|
+
/** The package manager that runs `package.json` scripts and installs. */
|
|
8
|
+
export const PACKAGE_RUNNER = "pnpm";
|
|
9
|
+
|
|
10
|
+
/** argv for running one `package.json` script, e.g. `bkit:gate:static-unit`. */
|
|
11
|
+
export const scriptCommand = (script: string): string[] => [PACKAGE_RUNNER, script];
|
|
12
|
+
|
|
13
|
+
/** argv for installing dependencies; `frozen` refuses to change the lockfile. */
|
|
14
|
+
export const installCommand = (opts: { frozen: boolean }): string[] =>
|
|
15
|
+
opts.frozen ? [PACKAGE_RUNNER, "install", "--frozen-lockfile"] : [PACKAGE_RUNNER, "install"];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* argv that regenerates a lockfile from its manifest, keyed by lockfile name.
|
|
19
|
+
* Covers lockfiles from other ecosystems too: a rebase conflict in `Cargo.lock` is
|
|
20
|
+
* resolved the same way as one in
|
|
21
|
+
* `pnpm-lock.yaml`. A lockfile with no entry is left for a human.
|
|
22
|
+
*/
|
|
23
|
+
export const LOCKFILE_REGENERATE: Readonly<Record<string, readonly string[]>> = {
|
|
24
|
+
"pnpm-lock.yaml": [PACKAGE_RUNNER, "install", "--lockfile-only"],
|
|
25
|
+
"package-lock.json": ["npm", "install", "--package-lock-only"],
|
|
26
|
+
"yarn.lock": ["yarn", "install", "--mode=update-lockfile"],
|
|
27
|
+
"bun.lock": ["bun", "install", "--lockfile-only"],
|
|
28
|
+
"Cargo.lock": ["cargo", "generate-lockfile"],
|
|
29
|
+
"go.sum": ["go", "mod", "tidy"],
|
|
30
|
+
"uv.lock": ["uv", "lock"],
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Exit codes a shell gives when the command itself could not run: 126 = found but
|
|
35
|
+
* not executable, 127 = not found. A gate that exits with one of these never ran,
|
|
36
|
+
* so it must not be recorded as a failing test.
|
|
37
|
+
*/
|
|
38
|
+
export const COULD_NOT_RUN_EXIT_CODES: ReadonlySet<number> = new Set([126, 127]);
|