@cbartens/bkit 5.2.4 → 5.4.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 +27 -11
- package/.bkit/core/.agents/context.md +1 -1
- package/.bkit/core/.agents/docs.md +1 -1
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +1 -1
- package/.bkit/core/.agents/rules.md +18 -1
- package/.bkit/core/.bkit/README.md +26 -10
- package/.bkit/core/.bkit/cloud.md +40 -39
- package/.bkit/core/.bkit/comparison.md +68 -345
- package/.bkit/core/.bkit/install.md +16 -9
- package/.bkit/core/.bkit/lite.md +73 -0
- package/.bkit/core/.bkit/pipeline.md +346 -0
- package/.bkit/core/.bkit/prompts.md +90 -74
- package/.bkit/core/.bkit/providers.md +42 -23
- package/.bkit/core/.bkit/templates.md +138 -19
- package/.bkit/core/.bkit/trackers.md +49 -4
- package/.bkit/core/.bkit/workflows.md +144 -123
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +1 -1
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +7 -4
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +8 -5
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-agents.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +4 -2
- package/.bkit/core/docs/templates/bkit-audit-config.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-cost.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-database.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +5 -5
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +26 -21
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-failures.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-gates.md +5 -2
- package/.bkit/core/docs/templates/bkit-audit-issues.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-llm.md +22 -15
- package/.bkit/core/docs/templates/bkit-audit-logs.md +10 -6
- package/.bkit/core/docs/templates/bkit-audit-models.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +7 -7
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +12 -9
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-repo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-security.md +14 -12
- package/.bkit/core/docs/templates/bkit-audit-slop.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-testing.md +10 -8
- package/.bkit/core/docs/templates/bkit-audit-usability.md +1 -1
- package/.bkit/core/docs/templates/bkit-plan.md +8 -6
- package/.bkit/core/engine/checks/after/auth.ts +9 -9
- package/.bkit/core/engine/checks/after/ci-yml.ts +14 -12
- package/.bkit/core/engine/checks/after/github.ts +29 -120
- package/.bkit/core/engine/checks/after/index.ts +2 -2
- package/.bkit/core/engine/checks/after/managed.ts +8 -28
- package/.bkit/core/engine/checks/after/tools.ts +3 -15
- package/.bkit/core/engine/checks/before/context-fetch.ts +1 -21
- package/.bkit/core/engine/checks/before/index.ts +7 -43
- package/.bkit/core/engine/checks/before/mcp.ts +17 -8
- package/.bkit/core/engine/checks/before/repo.ts +9 -12
- package/.bkit/core/engine/checks/status-holes.ts +4 -6
- package/.bkit/core/engine/checks/tips/catalogue.ts +76 -24
- package/.bkit/core/engine/checks/tips/detect.ts +45 -2
- package/.bkit/core/engine/checks/tips/index.ts +77 -26
- package/.bkit/core/engine/cli.ts +57 -27
- package/.bkit/core/engine/commands/analysis.ts +36 -26
- package/.bkit/core/engine/commands/comply.ts +42 -32
- package/.bkit/core/engine/commands/harvest.ts +12 -12
- package/.bkit/core/engine/commands/install/doctor.ts +57 -28
- package/.bkit/core/engine/commands/install/install.ts +73 -130
- package/.bkit/core/engine/commands/install/uninstall.ts +191 -33
- package/.bkit/core/engine/commands/install/upgrade.ts +49 -43
- package/.bkit/core/engine/commands/land.ts +156 -0
- package/.bkit/core/engine/commands/lib.ts +45 -18
- package/.bkit/core/engine/commands/registry.ts +2 -0
- package/.bkit/core/engine/commands/tips.ts +12 -5
- package/.bkit/core/engine/commands/workflow/branches.ts +386 -286
- package/.bkit/core/engine/commands/workflow/counters.ts +21 -12
- package/.bkit/core/engine/commands/workflow/disk.ts +556 -0
- package/.bkit/core/engine/commands/workflow/fids.ts +46 -0
- package/.bkit/core/engine/commands/workflow/issues.ts +73 -28
- package/.bkit/core/engine/commands/workflow/ledgers.ts +3 -1
- package/.bkit/core/engine/commands/workflow/locks.ts +38 -152
- package/.bkit/core/engine/commands/workflow/prs.ts +15 -4
- package/.bkit/core/engine/commands/workflow/repo.ts +2 -2
- package/.bkit/core/engine/commands/workflow/roadmap.ts +49 -53
- package/.bkit/core/engine/commands/workflow/runs.ts +8 -7
- package/.bkit/core/engine/commands/workflow/runtime.ts +3 -2
- package/.bkit/core/engine/commands/workflow/status.ts +33 -11
- package/.bkit/core/engine/commands/workflow/steps.ts +25 -15
- package/.bkit/core/engine/commands/workflow/tests.ts +17 -5
- package/.bkit/core/engine/commands/workflow/workflows.ts +436 -267
- package/.bkit/core/engine/commands/workflow/workstreams.ts +4 -2
- package/.bkit/core/engine/commands/workflow/worktrees.ts +24 -6
- package/.bkit/core/engine/install/cloud-env.ts +10 -31
- package/.bkit/core/engine/install/manifest.ts +14 -7
- package/.bkit/core/engine/install/modules/antigravity.ts +15 -26
- package/.bkit/core/engine/install/modules/claude.ts +20 -28
- package/.bkit/core/engine/install/modules/cloud.ts +5 -2
- package/.bkit/core/engine/install/modules/codex.ts +15 -29
- package/.bkit/core/engine/install/modules/core.ts +106 -70
- package/.bkit/core/engine/install/modules/cursor.ts +6 -20
- package/.bkit/core/engine/install/modules/index.ts +7 -1
- package/.bkit/core/engine/install/modules/opencode.ts +48 -70
- package/.bkit/core/engine/install/network-allowlist.ts +73 -0
- package/.bkit/core/engine/install/placeholders.ts +16 -35
- package/.bkit/core/engine/install/write.ts +59 -12
- package/.bkit/core/engine/ledgers/telemetry.ts +6 -4
- package/.bkit/core/engine/render/hosts.ts +47 -67
- package/.bkit/core/engine/render/models.ts +29 -11
- package/.bkit/core/engine/shared/branches.ts +13 -0
- package/.bkit/core/engine/shared/egress.ts +3 -3
- package/.bkit/core/engine/shared/json.ts +18 -1
- package/.bkit/core/engine/shared/package-json.ts +63 -0
- package/.bkit/core/engine/shared/package-roots.ts +0 -10
- package/.bkit/core/engine/shared/protected-paths.ts +5 -130
- package/.bkit/core/engine/shared/settings.ts +44 -0
- package/.bkit/core/engine/shared/timeouts.ts +8 -7
- package/.bkit/core/hooks/antigravity-hook.js +1 -0
- package/.bkit/core/hooks/guardrails-shell.js +186 -40
- package/.bkit/core/hooks/guardrails-tiers.js +5 -78
- package/.bkit/core/prompts/bkit-audit-generate.md +103 -7
- package/.bkit/core/prompts/bkit-build-challenge-1.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-2.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-remediate.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-tests.md +1 -1
- package/.bkit/core/prompts/bkit-build-install-skills.md +1 -1
- package/.bkit/core/prompts/bkit-build-plan-current.md +1 -1
- package/.bkit/core/prompts/bkit-build-plan-execute.md +4 -4
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +1 -1
- package/.bkit/core/prompts/bkit-build-plan-verify.md +2 -2
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +1 -1
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +1 -1
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +1 -1
- package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +78 -0
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +1 -1
- package/.bkit/core/prompts/bkit-debug-summary.md +3 -3
- package/.bkit/core/prompts/bkit-design-spike.md +1 -1
- package/.bkit/core/prompts/bkit-design-summary.md +2 -2
- package/.bkit/core/prompts/bkit-design-update.md +1 -1
- package/.bkit/core/prompts/bkit-plan-complexity-check.md +1 -1
- package/.bkit/core/prompts/bkit-plan-generate.md +1 -1
- package/.bkit/core/prompts/bkit-plan-scope-check-1.md +1 -1
- package/.bkit/core/prompts/bkit-plan-scope-check-2.md +1 -1
- package/.bkit/core/prompts/bkit-plan-summary.md +1 -1
- package/.bkit/core/prompts/bkit-plan-update.md +1 -1
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +1 -1
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +1 -1
- package/.bkit/core/prompts/bkit-ship-update-docs.md +1 -1
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +2 -1
- package/.bkit/core/prompts/bkit-utility-update-failures.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +11 -4
- package/.bkit/core/workflows/bkit-auto.md +2 -2
- package/.bkit/core/workflows/bkit-build.md +10 -10
- package/.bkit/core/workflows/bkit-debug.md +80 -44
- package/.bkit/core/workflows/bkit-design.md +22 -13
- package/.bkit/core/workflows/bkit-plan.md +33 -16
- package/.bkit/core/workflows/bkit-ship.md +87 -98
- package/.bkit/shared/.claude/bkit-cloud.md +58 -25
- package/.bkit/shared/.claude/settings.json +19 -0
- package/.bkit/shared/.cursor/mcp.json +2 -1
- package/.bkit/shared/.opencode/opencode.json +19 -1
- package/.bkit/shared/docs/deployments.md +49 -29
- package/.bkit/shared/docs/security.md +8 -6
- package/.bkit/shared/docs/testing.md +9 -5
- package/.bkit/shared/gitignore +1 -2
- package/.bkit/templates/.cursor/Dockerfile +30 -16
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-bug.yml +78 -0
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +91 -0
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +56 -0
- package/.bkit/templates/.github/renovate.json5 +91 -12
- package/.bkit/templates/.github/workflows/bkit-ci.yml +73 -55
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +3 -1
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +8 -1
- package/.bkit/templates/.github/workflows/bkit-trivy.yml +67 -0
- package/.bkit/templates/.husky/pre-commit +6 -0
- package/.bkit/templates/.husky/pre-push +15 -3
- package/.bkit/templates/.lintstagedrc.json +5 -1
- package/.bkit/templates/.oxlintrc.json +21 -0
- package/.bkit/templates/docs/capabilities.md +1 -1
- package/.bkit/templates/scripts/ci/check-capstone.mjs +176 -0
- package/.bkit/templates/scripts/ci/check-capstone.test.mjs +311 -0
- package/.bkit/templates/scripts/cleanup/bkit-disk-prune.machine.mjs +197 -0
- package/.bkit/templates/scripts/cleanup/bkit-disk-prune.mjs +164 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +2 -2
- package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +43 -20
- package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +33 -11
- package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +3 -2
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +5 -5
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +79 -19
- package/CHANGELOG.md +98 -3
- package/README.md +252 -122
- package/dist/checks/after/auth.js +10 -11
- package/dist/checks/after/ci-yml.js +11 -14
- package/dist/checks/after/github.js +32 -125
- package/dist/checks/after/index.js +3 -2
- package/dist/checks/after/managed.js +8 -24
- package/dist/checks/after/tools.js +3 -16
- package/dist/checks/before/context-fetch.js +1 -21
- package/dist/checks/before/index.js +6 -42
- package/dist/checks/before/mcp.js +14 -9
- package/dist/checks/before/repo.js +8 -11
- package/dist/checks/status-holes.js +5 -7
- package/dist/checks/tips/catalogue.js +65 -18
- package/dist/checks/tips/detect.js +41 -2
- package/dist/checks/tips/index.js +61 -25
- package/dist/cli.js +52 -26
- package/dist/commands/analysis.js +21 -5
- package/dist/commands/comply.js +40 -31
- package/dist/commands/harvest.js +12 -13
- package/dist/commands/install/doctor.js +55 -23
- package/dist/commands/install/install.js +72 -122
- package/dist/commands/install/uninstall.js +165 -31
- package/dist/commands/install/upgrade.js +46 -39
- package/dist/commands/land.js +129 -0
- package/dist/commands/lib.js +41 -16
- package/dist/commands/registry.js +2 -0
- package/dist/commands/tips.js +10 -3
- package/dist/commands/workflow/branches.js +303 -248
- package/dist/commands/workflow/counters.js +17 -7
- package/dist/commands/workflow/disk.js +452 -0
- package/dist/commands/workflow/fids.js +39 -0
- package/dist/commands/workflow/issues.js +63 -27
- package/dist/commands/workflow/ledgers.js +3 -1
- package/dist/commands/workflow/locks.js +35 -130
- package/dist/commands/workflow/prs.js +8 -5
- package/dist/commands/workflow/repo.js +2 -2
- package/dist/commands/workflow/roadmap.js +50 -57
- package/dist/commands/workflow/runs.js +5 -5
- package/dist/commands/workflow/runtime.js +3 -2
- package/dist/commands/workflow/status.js +32 -12
- package/dist/commands/workflow/steps.js +19 -11
- package/dist/commands/workflow/tests.js +16 -3
- package/dist/commands/workflow/workflows.js +390 -249
- package/dist/commands/workflow/workstreams.js +4 -2
- package/dist/commands/workflow/worktrees.js +15 -6
- package/dist/install/cloud-env.js +10 -23
- package/dist/install/manifest.js +14 -7
- package/dist/install/modules/antigravity.js +15 -26
- package/dist/install/modules/claude.js +17 -21
- package/dist/install/modules/cloud.js +6 -2
- package/dist/install/modules/codex.js +15 -29
- package/dist/install/modules/core.js +95 -63
- package/dist/install/modules/cursor.js +6 -9
- package/dist/install/modules/index.js +6 -1
- package/dist/install/modules/opencode.js +41 -72
- package/dist/install/network-allowlist.js +62 -0
- package/dist/install/placeholders.js +16 -35
- package/dist/install/write.js +55 -15
- package/dist/ledgers/telemetry.js +5 -4
- package/dist/render/hosts.js +30 -55
- package/dist/render/models.js +20 -9
- package/dist/shared/branches.js +11 -0
- package/dist/shared/egress.js +0 -2
- package/dist/shared/json.js +14 -0
- package/dist/shared/package-json.js +61 -0
- package/dist/shared/package-roots.js +0 -8
- package/dist/shared/protected-paths.js +5 -122
- package/dist/shared/settings.js +23 -1
- package/dist/shared/timeouts.js +8 -7
- package/package.json +21 -17
- package/.bkit/core/.agents/shortcuts.md +0 -73
|
@@ -84,18 +84,20 @@ export function parseWorkstreams(md: string): Workstream[] {
|
|
|
84
84
|
/** `[]` or `[WS-1, WS-2]`. */
|
|
85
85
|
export const requiresList = (w: Workstream) => `[${w.requires.join(", ")}]`;
|
|
86
86
|
|
|
87
|
-
/** The Step 11 comment: one line per workstream, then the design doc link. */
|
|
87
|
+
/** The Step 11 comment: one line per workstream, the issue-body line, then the design doc link. */
|
|
88
88
|
export function commentBody(
|
|
89
89
|
ws: Workstream[],
|
|
90
90
|
opts: { ownerRepo: string; month: string; fid: string },
|
|
91
91
|
): string {
|
|
92
92
|
const doc = `docs/plans/${opts.month}/${opts.fid}-design.md`;
|
|
93
|
+
const url = `https://github.com/${opts.ownerRepo}/blob/dev/${doc}`;
|
|
93
94
|
return [
|
|
94
95
|
"###### bkit:generated",
|
|
95
96
|
"### Step 11 — Suggested Workstreams",
|
|
96
97
|
"Advisory only. NEVER auto-trigger.",
|
|
97
98
|
...ws.map((w) => `- ${w.id}: ${w.name}. Requires: ${requiresList(w)}`),
|
|
98
|
-
`[${
|
|
99
|
+
`Filing one issue per workstream: put \`**Parent design:** [${opts.fid}-design.md](${url})\` in its body, and list the issues it requires in a blocked-by block (.bkit/trackers.md § Issue shapes).`,
|
|
100
|
+
`[${doc}](${url})`,
|
|
99
101
|
].join("\n");
|
|
100
102
|
}
|
|
101
103
|
|
|
@@ -17,12 +17,21 @@ import * as path from "node:path";
|
|
|
17
17
|
import { gitEnv } from "../../ledgers/telemetry.js";
|
|
18
18
|
import { readBkitConfig } from "../../shared/settings.js";
|
|
19
19
|
import { COULD_NOT_RUN_EXIT_CODES, installCommand } from "../../shared/package-manager.js";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
CommandError,
|
|
22
|
+
DEV,
|
|
23
|
+
EXIT,
|
|
24
|
+
git,
|
|
25
|
+
isSharedBranch,
|
|
26
|
+
repoRoot,
|
|
27
|
+
runGit,
|
|
28
|
+
type CommandSpec,
|
|
29
|
+
} from "../lib.js";
|
|
30
|
+
import { ensureDiskSpace } from "./disk.js";
|
|
21
31
|
import { detect } from "./runtime.js";
|
|
22
32
|
import { WORKFLOW_FLAG } from "./status.js";
|
|
23
33
|
|
|
24
34
|
const WORKFLOWS = ["design", "plan", "build", "debug", "ship"];
|
|
25
|
-
const DEV = "dev";
|
|
26
35
|
const ORIGIN_DEV = `origin/${DEV}`;
|
|
27
36
|
|
|
28
37
|
export const EXIT_REBASE_CONFLICT = 3;
|
|
@@ -34,6 +43,7 @@ export const EXIT_WORKTREE_ADD = 8;
|
|
|
34
43
|
export const EXIT_REBASE_NOT_STARTED = 9;
|
|
35
44
|
export const EXIT_NOT_A_WORKTREE = 10;
|
|
36
45
|
export const EXIT_REMOVE = 11;
|
|
46
|
+
export const EXIT_DISK_FULL = 12;
|
|
37
47
|
|
|
38
48
|
const FID_FLAG = { name: "fid", type: "string", required: true, help: "feature id" } as const;
|
|
39
49
|
|
|
@@ -103,7 +113,7 @@ function shipBranch(root: string, fid: string, named: string | undefined, sessio
|
|
|
103
113
|
if (named) return named;
|
|
104
114
|
const feat = `feat/${fid}`;
|
|
105
115
|
if (hasLocal(root, feat) || remoteHas(root, feat) === "yes") return feat;
|
|
106
|
-
return session
|
|
116
|
+
return isSharedBranch(session) || session === "" ? feat : session;
|
|
107
117
|
}
|
|
108
118
|
|
|
109
119
|
/**
|
|
@@ -249,7 +259,7 @@ export function removeWorktree(
|
|
|
249
259
|
branch: string | undefined,
|
|
250
260
|
log: (m: string) => void,
|
|
251
261
|
): RemoveResult {
|
|
252
|
-
if (branch !== undefined && (branch
|
|
262
|
+
if (branch !== undefined && isSharedBranch(branch)) {
|
|
253
263
|
throw new CommandError(EXIT.USAGE, `refusing to delete branch ${branch}`);
|
|
254
264
|
}
|
|
255
265
|
const root = repoRoot(cwd);
|
|
@@ -340,8 +350,10 @@ export const worktreesCommand: CommandSpec = {
|
|
|
340
350
|
[EXIT_WORKTREE_ADD]: "git worktree add failed",
|
|
341
351
|
[EXIT_REBASE_NOT_STARTED]: "resume rebase could not start (e.g. uncommitted changes)",
|
|
342
352
|
[EXIT_NOT_A_WORKTREE]: ".worktrees/{fid} exists but is not a registered git worktree",
|
|
353
|
+
[EXIT_DISK_FULL]:
|
|
354
|
+
"free disk under bkit.disk.minFreeGb even after your max cleanup steps (`bkit disk prune`); nothing created",
|
|
343
355
|
},
|
|
344
|
-
run: (ctx) => {
|
|
356
|
+
run: async (ctx) => {
|
|
345
357
|
const f = ctx.flags;
|
|
346
358
|
const workflow = String(f.workflow);
|
|
347
359
|
if (!WORKFLOWS.includes(workflow)) {
|
|
@@ -368,7 +380,7 @@ export const worktreesCommand: CommandSpec = {
|
|
|
368
380
|
);
|
|
369
381
|
}
|
|
370
382
|
const target = workflow === "ship" ? shipBranch(root, fid, named, session) : `feat/${fid}`;
|
|
371
|
-
if (target
|
|
383
|
+
if (isSharedBranch(target)) {
|
|
372
384
|
throw new CommandError(EXIT_REFUSED, `refusing to ship ${target} as a feature branch`);
|
|
373
385
|
}
|
|
374
386
|
|
|
@@ -384,6 +396,12 @@ export const worktreesCommand: CommandSpec = {
|
|
|
384
396
|
const wtDir = worktreeDir(root, fid);
|
|
385
397
|
let mode: "created" | "resumed" | "adopted" = "adopted";
|
|
386
398
|
if (mint) {
|
|
399
|
+
const full = await ensureDiskSpace({
|
|
400
|
+
cwd: root,
|
|
401
|
+
minFreeGb: config.diskMinFreeGb,
|
|
402
|
+
log: ctx.log,
|
|
403
|
+
});
|
|
404
|
+
if (full !== null) throw new CommandError(EXIT_DISK_FULL, full);
|
|
387
405
|
runGit(root, ["worktree", "prune"]);
|
|
388
406
|
if (fs.existsSync(wtDir)) {
|
|
389
407
|
// A plain directory there would resolve to the main checkout's repo,
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import * as fs from "node:fs";
|
|
15
15
|
import * as path from "node:path";
|
|
16
16
|
import type { IssueTracker } from "./manifest.js";
|
|
17
|
+
import { readJsonFile } from "../shared/json.js";
|
|
17
18
|
import { getSharedRoot } from "../shared/package-roots.js";
|
|
18
19
|
import { applyTokens, type TokenMap } from "./placeholders.js";
|
|
19
20
|
import { BKIT_EGRESS_SOURCES, type EgressSource } from "../shared/egress.js";
|
|
@@ -246,7 +247,8 @@ export function renderCloudEnvNotes(res: CloudEnvResolution): string {
|
|
|
246
247
|
if (!res.hasEnvrc) {
|
|
247
248
|
return (
|
|
248
249
|
"_No `.envrc` found — the block above lists only the bkit baseline token names as " +
|
|
249
|
-
"placeholders.
|
|
250
|
+
"placeholders. Copy `.bkit/templates/.envrc` to the repo root, fill the files it sources, " +
|
|
251
|
+
"and re-run to inline real values._"
|
|
250
252
|
);
|
|
251
253
|
}
|
|
252
254
|
const bullets: string[] = [];
|
|
@@ -276,17 +278,12 @@ export function renderCloudEnvNotes(res: CloudEnvResolution): string {
|
|
|
276
278
|
|
|
277
279
|
/** Parse the pnpm `X.Y.Z` from `package.json` `packageManager` ("" if absent/non-pnpm). */
|
|
278
280
|
export function resolveConsumerPnpm(cwd: string): string {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const m = pm.match(/^pnpm@(\d+\.\d+\.\d+)/);
|
|
286
|
-
return m?.[1] ?? "";
|
|
287
|
-
} catch {
|
|
288
|
-
return "";
|
|
289
|
-
}
|
|
281
|
+
const read = readJsonFile(path.join(cwd, "package.json"));
|
|
282
|
+
if (!read.ok || typeof read.value !== "object" || read.value === null) return "";
|
|
283
|
+
const pkg = read.value as Record<string, unknown>;
|
|
284
|
+
const pm = typeof pkg["packageManager"] === "string" ? pkg["packageManager"] : "";
|
|
285
|
+
const m = pm.match(/^pnpm@(\d+\.\d+\.\d+)/);
|
|
286
|
+
return m?.[1] ?? "";
|
|
290
287
|
}
|
|
291
288
|
|
|
292
289
|
/**
|
|
@@ -568,31 +565,13 @@ export function resolveClaudeDerivedAllows(cwd: string): string[] {
|
|
|
568
565
|
];
|
|
569
566
|
}
|
|
570
567
|
|
|
571
|
-
/** Cursor-relative path of the install-written curl/wget allowlist (guardrails). */
|
|
572
|
-
export const NETWORK_ALLOWLIST_RELPATH = path.join(".cursor", "allowlist.json");
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* Write `.cursor/allowlist.json` for Cursor `bkit-guardrails.cjs` (runtime curl/wget host
|
|
576
|
-
* checks). Claude/OpenCode bake the same domain set into their own configs at
|
|
577
|
-
* install/upgrade — they do not read this file. Call only when the cursor module
|
|
578
|
-
* is installed (do not create `.cursor/` for claude-only consumers).
|
|
579
|
-
*/
|
|
580
|
-
export function writeNetworkAllowlistArtifact(
|
|
581
|
-
cwd: string,
|
|
582
|
-
dryRun: boolean,
|
|
583
|
-
): { path: string; domains: string[]; wrote: boolean } {
|
|
584
|
-
const domains = resolveNetworkAllowlist(cwd);
|
|
585
|
-
const rel = NETWORK_ALLOWLIST_RELPATH;
|
|
586
|
-
return { path: rel, domains, wrote: writeGeneratedJson(cwd, rel, { domains }, dryRun) };
|
|
587
|
-
}
|
|
588
|
-
|
|
589
568
|
/** Cursor-relative path of the install-written Cursor CLI permissions (MCP allows). */
|
|
590
569
|
export const CURSOR_CLI_PERMISSIONS_RELPATH = path.join(".cursor", "cli.json");
|
|
591
570
|
|
|
592
571
|
/**
|
|
593
572
|
* Write `.cursor/cli.json` — the project-level Cursor CLI / cloud-agent permissions —
|
|
594
573
|
* with one `Mcp(<server>:*)` allow per {@link extractMcpServers} entry. bkit-owned and
|
|
595
|
-
* regenerated whole, like `.
|
|
574
|
+
* regenerated whole, like `.bkit/allowlist.json`: hand edits do not survive, the
|
|
596
575
|
* `mcp-servers` block is the source. Call only when the cursor module is installed.
|
|
597
576
|
*/
|
|
598
577
|
export function writeCursorCliPermissionsArtifact(
|
|
@@ -125,10 +125,17 @@ const CORE_MANIFEST: ManifestEntry[] = [
|
|
|
125
125
|
// their own attributes outside the block, so this is markered-text (not whole-file).
|
|
126
126
|
{ path: ".gitattributes", format: "markered-text", module: "core" },
|
|
127
127
|
{ path: ".bkit/version", format: "byte-equal-text", module: "core" },
|
|
128
|
+
// Curl/wget host allowlist read at runtime by every host's bkit-guardrails.cjs (Claude,
|
|
129
|
+
// Cursor, Codex, Antigravity). No template backs it — `writeNetworkAllowlist`
|
|
130
|
+
// (install/network-allowlist.ts) computes the domain set from the consumer's own config,
|
|
131
|
+
// so it is `generated` and its hash is in `canonicalHashes`. Core-owned: it stays until
|
|
132
|
+
// the last host goes (full/core uninstall).
|
|
133
|
+
{ path: ".bkit/allowlist.json", format: "byte-equal-text", module: "core", generated: true },
|
|
128
134
|
// Canonical bkit-authored reference docs. They live package-side under
|
|
129
135
|
// `.bkit/core/.bkit/` and are read from there at runtime (getBkitDocsRoot); these
|
|
130
136
|
// consumer copies are force-overwritten mirrors (writeTier1) so a consumer can read
|
|
131
|
-
// them in-repo. Whole file is bkit-owned → byte-equal-text (refreshed every install)
|
|
137
|
+
// them in-repo. Whole file is bkit-owned → byte-equal-text (refreshed every install);
|
|
138
|
+
// prompts.md and lite.md are markered-text, keeping the consumer section below `bkit:end`.
|
|
132
139
|
{ path: ".bkit/cloud.md", format: "byte-equal-text", module: "core" },
|
|
133
140
|
{ path: ".bkit/comparison.md", format: "byte-equal-text", module: "core" },
|
|
134
141
|
{ path: ".bkit/install.md", format: "byte-equal-text", module: "core" },
|
|
@@ -136,6 +143,8 @@ const CORE_MANIFEST: ManifestEntry[] = [
|
|
|
136
143
|
// The MIT notice that travels with the files bkit writes: the full text and copyright
|
|
137
144
|
// notice. Sourced from `.bkit/core/.bkit/LICENSE.md`.
|
|
138
145
|
{ path: ".bkit/LICENSE.md", format: "byte-equal-text", module: "core" },
|
|
146
|
+
{ path: ".bkit/lite.md", format: "markered-text", module: "core" },
|
|
147
|
+
{ path: ".bkit/pipeline.md", format: "byte-equal-text", module: "core" },
|
|
139
148
|
{ path: ".bkit/providers.md", format: "byte-equal-text", module: "core" },
|
|
140
149
|
{ path: ".bkit/prompts.md", format: "markered-text", module: "core" },
|
|
141
150
|
{ path: ".bkit/templates.md", format: "byte-equal-text", module: "core" },
|
|
@@ -209,7 +218,8 @@ const CLAUDE_MANIFEST: ManifestEntry[] = [
|
|
|
209
218
|
// `gate-missing-called-scripts` advisory names any that are missing.
|
|
210
219
|
//
|
|
211
220
|
// The SAME names are what the git hook templates run (`.husky/pre-commit`,
|
|
212
|
-
// `.husky/pre-push`). `bkit-ci.yml` does NOT call the gates; it calls the scripts
|
|
221
|
+
// `.husky/pre-push`). `bkit-ci.yml` does NOT call the gates; it calls the same scripts
|
|
222
|
+
// directly, one step each.
|
|
213
223
|
//
|
|
214
224
|
// `lint:slop` is in no gate: `slop-scan scan` is report-only and never fails. The gate
|
|
215
225
|
// that fails on new findings is `slop:delta`.
|
|
@@ -223,7 +233,8 @@ export const BKIT_GATE_SCRIPTS: Readonly<Record<string, string>> = {
|
|
|
223
233
|
// `.husky/pre-commit`: prettier --write over staged files, and nothing else —
|
|
224
234
|
// seconds, not minutes. Prose is a whole-repo scan, so it gates at pre-push.
|
|
225
235
|
"bkit:gate:format": "pnpm lint-staged",
|
|
226
|
-
// Everything that needs no test runner.
|
|
236
|
+
// Everything that needs no test runner. Every part has a matching step in the
|
|
237
|
+
// bkit-tests-static CI job; audits/templates/template-ci-yml.test.ts fails when one is missing.
|
|
227
238
|
// Callers: build's plan-execute loop between tasks, and the `.husky/pre-push` revert
|
|
228
239
|
// path.
|
|
229
240
|
"bkit:gate:static":
|
|
@@ -339,10 +350,6 @@ const CURSOR_MANIFEST: ManifestEntry[] = [
|
|
|
339
350
|
format: "markered-text",
|
|
340
351
|
module: "cursor",
|
|
341
352
|
},
|
|
342
|
-
// Curl/wget host allowlist read at runtime by bkit-guardrails.cjs. No template backs it —
|
|
343
|
-
// `writeNetworkAllowlistArtifact` (install/cloud-env.ts) computes the domain set from the
|
|
344
|
-
// consumer's own config, so it is `generated` and its hash is in `canonicalHashes`.
|
|
345
|
-
{ path: ".cursor/allowlist.json", format: "byte-equal-text", module: "cursor", generated: true },
|
|
346
353
|
// Cursor CLI / cloud-agent MCP allows — `writeCursorCliPermissionsArtifact`
|
|
347
354
|
// (install/cloud-env.ts) renders it from the consumer's `mcp-servers` block; same contract.
|
|
348
355
|
{ path: ".cursor/cli.json", format: "byte-equal-text", module: "cursor", generated: true },
|
|
@@ -19,14 +19,9 @@ import {
|
|
|
19
19
|
} from "../../shared/package-roots.js";
|
|
20
20
|
import { type IssueTracker, DEFAULT_ISSUE_TRACKER } from "../manifest.js";
|
|
21
21
|
import { substituteWorkflow } from "../../render/trackers.js";
|
|
22
|
+
import { readInstallingVersion } from "../../shared/package-json.js";
|
|
22
23
|
import type { ModuleContext } from "./index.js";
|
|
23
|
-
import {
|
|
24
|
-
BKIT_PREFIX,
|
|
25
|
-
installFile,
|
|
26
|
-
listMdFiles,
|
|
27
|
-
readInstallingVersion,
|
|
28
|
-
trackMirrorWrite,
|
|
29
|
-
} from "./core.js";
|
|
24
|
+
import { BKIT_PREFIX, installFile, listMdFiles, removeOrphans, trackMirrorWrite } from "./core.js";
|
|
30
25
|
|
|
31
26
|
// ---------------------------------------------------------------------------
|
|
32
27
|
// runAntigravityModule — Google Antigravity IDE host (opt-in via --antigravity)
|
|
@@ -115,16 +110,12 @@ export function renderAntigravityAgentsSkills(ctx: ModuleContext): string[] {
|
|
|
115
110
|
}
|
|
116
111
|
}
|
|
117
112
|
|
|
118
|
-
// Orphan sweep is bkit-prefix scoped — the plugin's agents/ is bkit-owned
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
if (!dryRun) fs.rmSync(rel, { force: true });
|
|
125
|
-
console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
|
|
126
|
-
trackMirrorWrite(ctx, rel, written);
|
|
127
|
-
}
|
|
113
|
+
// Orphan sweep is bkit-prefix scoped — the plugin's agents/ is bkit-owned, so every
|
|
114
|
+
// bkit-* entry counts, whatever its extension.
|
|
115
|
+
for (const f of removeOrphans(dest, sourceSet, dryRun, BKIT_PREFIX, { extension: "" })) {
|
|
116
|
+
const rel = path.join(dest, f);
|
|
117
|
+
console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
|
|
118
|
+
trackMirrorWrite(ctx, rel, written);
|
|
128
119
|
}
|
|
129
120
|
}
|
|
130
121
|
|
|
@@ -148,15 +139,13 @@ export function renderAntigravityAgentsSkills(ctx: ModuleContext): string[] {
|
|
|
148
139
|
}
|
|
149
140
|
|
|
150
141
|
// Prefix-scoped sweep inside the bkit plugin's skills/.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
trackMirrorWrite(ctx, rel, written);
|
|
159
|
-
}
|
|
142
|
+
const orphans = removeOrphans(ANTIGRAVITY_SKILLS_DIR, sourceStems, dryRun, BKIT_PREFIX, {
|
|
143
|
+
wholeFolders: true,
|
|
144
|
+
});
|
|
145
|
+
for (const d of orphans) {
|
|
146
|
+
const rel = path.join(ANTIGRAVITY_SKILLS_DIR, d);
|
|
147
|
+
console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
|
|
148
|
+
trackMirrorWrite(ctx, rel, written);
|
|
160
149
|
}
|
|
161
150
|
}
|
|
162
151
|
|
|
@@ -8,10 +8,13 @@ import {
|
|
|
8
8
|
writeTier2,
|
|
9
9
|
writeTier2JsonContained,
|
|
10
10
|
ensureDir,
|
|
11
|
+
mergeTrackerEntry,
|
|
12
|
+
trackerEntryInSync,
|
|
11
13
|
type WriteSet,
|
|
12
14
|
type JsonValue,
|
|
13
15
|
} from "../write.js";
|
|
14
16
|
import { readBkitVersion, stampManagedVersion } from "../version-file.js";
|
|
17
|
+
import { readJsonFile } from "../../shared/json.js";
|
|
15
18
|
import { applyEffortRemap } from "../../render/hosts.js";
|
|
16
19
|
import type { PreflightFinding } from "../../checks/before/index.js";
|
|
17
20
|
import {
|
|
@@ -23,15 +26,9 @@ import {
|
|
|
23
26
|
import { type IssueTracker, DEFAULT_ISSUE_TRACKER } from "../manifest.js";
|
|
24
27
|
import { substituteWorkflow } from "../../render/trackers.js";
|
|
25
28
|
import { writeClaudeCloudDoc, resolveClaudeDerivedAllows } from "../cloud-env.js";
|
|
29
|
+
import { readInstallingVersion } from "../../shared/package-json.js";
|
|
26
30
|
import type { ModuleContext } from "./index.js";
|
|
27
|
-
import {
|
|
28
|
-
BKIT_PREFIX,
|
|
29
|
-
installFile,
|
|
30
|
-
listMdFiles,
|
|
31
|
-
readInstallingVersion,
|
|
32
|
-
removeOrphans,
|
|
33
|
-
trackMirrorWrite,
|
|
34
|
-
} from "./core.js";
|
|
31
|
+
import { BKIT_PREFIX, installFile, listMdFiles, removeOrphans, trackMirrorWrite } from "./core.js";
|
|
35
32
|
|
|
36
33
|
export function renderClaudeAgentsCommands(ctx: ModuleContext): string[] {
|
|
37
34
|
const { dryRun, logPrefix, effortMap } = ctx;
|
|
@@ -247,14 +244,11 @@ export function enrichClaudeSettingsAllows(
|
|
|
247
244
|
advisories?: PreflightFinding[],
|
|
248
245
|
): readonly string[] | null {
|
|
249
246
|
if (!fs.existsSync(settingsDst)) return null;
|
|
250
|
-
|
|
247
|
+
const settings = readJsonFile(settingsDst);
|
|
248
|
+
if (!settings.ok) return null;
|
|
249
|
+
const doc = settings.value as {
|
|
251
250
|
permissions?: { allow?: string[] };
|
|
252
251
|
};
|
|
253
|
-
try {
|
|
254
|
-
doc = JSON.parse(fs.readFileSync(settingsDst, "utf-8")) as typeof doc;
|
|
255
|
-
} catch {
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
252
|
const allow = doc.permissions?.allow;
|
|
259
253
|
if (!Array.isArray(allow)) return null;
|
|
260
254
|
|
|
@@ -310,12 +304,14 @@ export function buildMcpJson(templatePath: string, tracker: IssueTracker): strin
|
|
|
310
304
|
|
|
311
305
|
/**
|
|
312
306
|
* Reconcile bkit's tracker entry into a consumer's `.mcp.json` / `.cursor/mcp.json`. bkit
|
|
313
|
-
* owns exactly one key, `mcpServers[<tracker>]`, and
|
|
307
|
+
* owns exactly one key, `mcpServers[<tracker>]`, and within it only what the template sets
|
|
308
|
+
* (`mergeTrackerEntry`: extra keys, headers and toolsets stay the consumer's); every
|
|
314
309
|
* other key and the existing key order stay the consumer's. Absent file → write the
|
|
315
310
|
* `buildMcpJson` render. Malformed JSON → throw (refuse to merge; the consumer fixes it).
|
|
316
311
|
* Tracker `none` owns no entry, so a present file is left alone. Writes only on change, so
|
|
317
|
-
* dry-run and live compute the identical WriteSet. Another tracker's entry
|
|
318
|
-
*
|
|
312
|
+
* dry-run and live compute the identical WriteSet. Another tracker's entry is not touched
|
|
313
|
+
* here: a `--tracker` switch removes an unedited one first (`removeUnusedTrackerMcpEntries`),
|
|
314
|
+
* and `detectExtraMcpServers` advises on an edited one.
|
|
319
315
|
*/
|
|
320
316
|
export function reconcileMcpJson(
|
|
321
317
|
templatePath: string,
|
|
@@ -334,13 +330,8 @@ export function reconcileMcpJson(
|
|
|
334
330
|
return;
|
|
335
331
|
}
|
|
336
332
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
try {
|
|
340
|
-
existing = JSON.parse(fs.readFileSync(relDst, "utf-8")) as JsonValue;
|
|
341
|
-
} catch {
|
|
342
|
-
existing = null;
|
|
343
|
-
}
|
|
333
|
+
const read = readJsonFile(relDst);
|
|
334
|
+
const existing = read.ok ? (read.value as JsonValue) : null;
|
|
344
335
|
if (existing === null || typeof existing !== "object" || Array.isArray(existing)) {
|
|
345
336
|
throw new Error(
|
|
346
337
|
`[bkit] ${relDst} is malformed JSON — fix manually before running bkit install`,
|
|
@@ -351,12 +342,13 @@ export function reconcileMcpJson(
|
|
|
351
342
|
const servers = existing.mcpServers;
|
|
352
343
|
const serversObj =
|
|
353
344
|
servers !== null && typeof servers === "object" && !Array.isArray(servers) ? servers : {};
|
|
354
|
-
const inSync = Object.entries(owned).every(
|
|
355
|
-
([k, v]) => JSON.stringify(serversObj[k]) === JSON.stringify(v),
|
|
356
|
-
);
|
|
345
|
+
const inSync = Object.entries(owned).every(([k, v]) => trackerEntryInSync(serversObj[k], v));
|
|
357
346
|
if (inSync) return;
|
|
358
347
|
|
|
359
|
-
const
|
|
348
|
+
const merged = Object.fromEntries(
|
|
349
|
+
Object.entries(owned).map(([k, v]) => [k, mergeTrackerEntry(serversObj[k], v)]),
|
|
350
|
+
);
|
|
351
|
+
const next = { ...existing, mcpServers: { ...serversObj, ...merged } };
|
|
360
352
|
if (!dryRun) fs.writeFileSync(relDst, JSON.stringify(next, null, 2) + "\n", "utf-8");
|
|
361
353
|
ws.writes.push({ path: relDst, action: "update" });
|
|
362
354
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import * as fs from "node:fs";
|
|
7
7
|
import * as path from "node:path";
|
|
8
|
+
import { parseJson } from "../../shared/json.js";
|
|
8
9
|
import type { CloudAgents } from "../manifest.js";
|
|
9
10
|
import type { ModuleContext } from "./index.js";
|
|
10
11
|
|
|
@@ -26,7 +27,9 @@ function setConsumerBkitField(field: string, value: string, dryRun: boolean): vo
|
|
|
26
27
|
if (!fs.existsSync(pkgPath)) return;
|
|
27
28
|
try {
|
|
28
29
|
const raw = fs.readFileSync(pkgPath, "utf-8");
|
|
29
|
-
const
|
|
30
|
+
const parsed = parseJson(raw);
|
|
31
|
+
if (!parsed.ok) return;
|
|
32
|
+
const pkg = parsed.value as Record<string, unknown>;
|
|
30
33
|
const bkit = (pkg.bkit ?? {}) as Record<string, unknown>;
|
|
31
34
|
if (bkit[field] === value) return; // already set — avoid a no-op rewrite
|
|
32
35
|
bkit[field] = value;
|
|
@@ -101,7 +104,7 @@ export function runCloudModule(ctx: ModuleContext): void {
|
|
|
101
104
|
" - Adopt `.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh` as `.claude/hooks/bkit-cloud-bootstrap.sh` and edit it freely — the baseline runs `pnpm install` / `vale sync` and the gh login on each cloud session; add your own repo-specific steps (Supabase start, turbo prebuild, etc. — examples inlined). The `.claude/settings.json` SessionStart entry runs it only when present (`test -f … || true`).\n\n" +
|
|
102
105
|
"IN CLAUDE APP (claude.ai/code → environment selector → + Add environment):\n" +
|
|
103
106
|
" - Name: the repo name (e.g. `acme-web`) — one environment per repo, since secrets are per-repo.\n" +
|
|
104
|
-
" - Setup script: paste from bkit's `cloud.md` § Setup script (installs vale + gh + corepack-pinned pnpm — exact versions live in cloud.md, not duplicated here).\n" +
|
|
107
|
+
" - Setup script: paste from bkit's `cloud.md` § Setup script (installs Node 24 + vale + gh + jq + corepack-pinned pnpm — exact versions live in cloud.md, not duplicated here).\n" +
|
|
105
108
|
" - Environment variables: `BKIT_GH_TOKEN` (fine-grained for one owner, classic across owners — GitHub MCP).\n" +
|
|
106
109
|
" - Tracker env vars (GitHub): `BKIT_GH_TOKEN` above is the only tracker credential — the GitHub MCP server sends it on every call, and the bootstrap hook signs `gh` in with it.\n" +
|
|
107
110
|
" - Network access: `Trusted` (default). One environment per repo (secrets differ per repo); the setup script + variable *names* are identical across repos, only the values change. See cloud.md § Sharing across repos → Claude.",
|
|
@@ -13,14 +13,9 @@ import {
|
|
|
13
13
|
} from "../../shared/package-roots.js";
|
|
14
14
|
import { type IssueTracker, DEFAULT_ISSUE_TRACKER } from "../manifest.js";
|
|
15
15
|
import { substituteWorkflow } from "../../render/trackers.js";
|
|
16
|
+
import { readInstallingVersion } from "../../shared/package-json.js";
|
|
16
17
|
import type { ModuleContext } from "./index.js";
|
|
17
|
-
import {
|
|
18
|
-
BKIT_PREFIX,
|
|
19
|
-
installFile,
|
|
20
|
-
listMdFiles,
|
|
21
|
-
readInstallingVersion,
|
|
22
|
-
trackMirrorWrite,
|
|
23
|
-
} from "./core.js";
|
|
18
|
+
import { BKIT_PREFIX, installFile, listMdFiles, removeOrphans, trackMirrorWrite } from "./core.js";
|
|
24
19
|
|
|
25
20
|
/**
|
|
26
21
|
* Convert a workflow orchestrator (`.bkit/core/workflows/*.md`) into a Codex SKILL.md.
|
|
@@ -93,8 +88,8 @@ export function renderCodexAgentsSkills(ctx: ModuleContext): string[] {
|
|
|
93
88
|
const dest = ".codex/agents";
|
|
94
89
|
if (!dryRun) ensureDir(dest);
|
|
95
90
|
const files = listMdFiles(src, BKIT_PREFIX);
|
|
96
|
-
// Destination basenames are .toml, so the orphan sweep
|
|
97
|
-
const
|
|
91
|
+
// Destination basenames are .toml, so the orphan sweep compares on the .toml names.
|
|
92
|
+
const sourceNames = new Set(files.map((f) => f.replace(/\.md$/, ".toml")));
|
|
98
93
|
|
|
99
94
|
for (const f of files) {
|
|
100
95
|
const stem = f.replace(/\.md$/, "");
|
|
@@ -108,17 +103,10 @@ export function renderCodexAgentsSkills(ctx: ModuleContext): string[] {
|
|
|
108
103
|
}
|
|
109
104
|
}
|
|
110
105
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (!sourceStems.has(f.replace(/\.toml$/, ""))) {
|
|
116
|
-
const rel = path.join(dest, f);
|
|
117
|
-
if (!dryRun) fs.rmSync(path.join(dest, f));
|
|
118
|
-
console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
|
|
119
|
-
trackMirrorWrite(ctx, rel, written);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
106
|
+
for (const f of removeOrphans(dest, sourceNames, dryRun, BKIT_PREFIX, { extension: ".toml" })) {
|
|
107
|
+
const rel = path.join(dest, f);
|
|
108
|
+
console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
|
|
109
|
+
trackMirrorWrite(ctx, rel, written);
|
|
122
110
|
}
|
|
123
111
|
}
|
|
124
112
|
|
|
@@ -146,15 +134,13 @@ export function renderCodexAgentsSkills(ctx: ModuleContext): string[] {
|
|
|
146
134
|
|
|
147
135
|
// Orphan sweep is bkit-prefix scoped: `.agents/skills/` is SHARED with third-party
|
|
148
136
|
// skills installed via skills.sh, so anything not named bkit-* is off limits here.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
trackMirrorWrite(ctx, rel, written);
|
|
157
|
-
}
|
|
137
|
+
const orphans = removeOrphans(CODEX_SKILLS_DIR, sourceStems, dryRun, BKIT_PREFIX, {
|
|
138
|
+
wholeFolders: true,
|
|
139
|
+
});
|
|
140
|
+
for (const d of orphans) {
|
|
141
|
+
const rel = path.join(CODEX_SKILLS_DIR, d);
|
|
142
|
+
console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
|
|
143
|
+
trackMirrorWrite(ctx, rel, written);
|
|
158
144
|
}
|
|
159
145
|
}
|
|
160
146
|
|