@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// bkit roadmap fold|feature|mirror — rewrite the generated region of
|
|
2
2
|
// docs/roadmap.md from .bkit/issues.jsonl, its SOLE input; append a feature's
|
|
3
|
-
// row; and copy a build / debug close's row to dev
|
|
3
|
+
// row; and copy a build / debug close's row to dev through a throwaway checkout.
|
|
4
4
|
//
|
|
5
5
|
// The status block is a pure projection of the ledger, re-rendered in full, so
|
|
6
6
|
// a close never parses the board back. The two `## Notes` blocks and the
|
|
@@ -18,8 +18,8 @@ import * as fs from "node:fs";
|
|
|
18
18
|
import * as path from "node:path";
|
|
19
19
|
import { compareTs, parse, resolveRepoSlug, validate } from "../../ledgers/telemetry.js";
|
|
20
20
|
import { readBkitVersion } from "../../install/version-file.js";
|
|
21
|
-
import { CommandError, EXIT, git, parseJson, repoRoot, runGit, } from "../lib.js";
|
|
22
|
-
import {
|
|
21
|
+
import { CommandError, DEV, EXIT, git, parseJson, repoRoot, runGit, } from "../lib.js";
|
|
22
|
+
import { landDir, pushToDev } from "../land.js";
|
|
23
23
|
import { str } from "./status.js";
|
|
24
24
|
/** Roadmap status each workflow's close moves the feature to. */
|
|
25
25
|
export const FEATURE_STATUS = {
|
|
@@ -334,15 +334,13 @@ function feature(ctx) {
|
|
|
334
334
|
ctx.emit({ ...r });
|
|
335
335
|
return ctx.flags.strict === true && !r.appended ? EXIT.NO : EXIT.OK;
|
|
336
336
|
}
|
|
337
|
-
/** Seconds the mirror waits for a busy dev lock before skipping. */
|
|
338
|
-
export const MIRROR_DEV_LOCK_DEADLINE_S = 60;
|
|
339
337
|
const ROADMAP_FILES = [".bkit/issues.jsonl", "docs/roadmap.md"];
|
|
340
338
|
/**
|
|
341
|
-
* Build / debug close: append the feature row in the worktree, then
|
|
342
|
-
* SAME row
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
339
|
+
* Build / debug close: append the feature row in the worktree, then land the
|
|
340
|
+
* SAME row on `dev` through a throwaway origin/dev checkout (`pushToDev`). The
|
|
341
|
+
* main checkout is never touched. Skipped when the run's own checkout is on dev
|
|
342
|
+
* (the row rides that branch's commit). Fail-open throughout: the feat-side row
|
|
343
|
+
* is already written and reaches dev with ship's merge.
|
|
346
344
|
*/
|
|
347
345
|
async function mirror(ctx) {
|
|
348
346
|
const workflow = String(ctx.flags.workflow);
|
|
@@ -356,51 +354,46 @@ async function mirror(ctx) {
|
|
|
356
354
|
ctx.emit({ row: feat.row, appended: feat.appended, mirrored, skipped });
|
|
357
355
|
return EXIT.OK;
|
|
358
356
|
};
|
|
359
|
-
if (
|
|
360
|
-
return done(false, "
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
runGit(root, ["checkout", prior]);
|
|
400
|
-
return done(pushed, pushed ? null : "dev push failed");
|
|
401
|
-
}
|
|
402
|
-
finally {
|
|
403
|
-
releaseLock(lock.path, { workflow, fid, token: lock.token });
|
|
357
|
+
if (git(wt, ["branch", "--show-current"]) === DEV)
|
|
358
|
+
return done(false, "on dev");
|
|
359
|
+
// A build that commits nothing pushes origin/dev back to itself, which git
|
|
360
|
+
// reports as success — so a landing counts only when this attempt committed.
|
|
361
|
+
let committed = "";
|
|
362
|
+
const res = await pushToDev({
|
|
363
|
+
root,
|
|
364
|
+
dir: landDir(root, fid),
|
|
365
|
+
build: (dir) => {
|
|
366
|
+
committed = "";
|
|
367
|
+
if (!appendFeature(dir, { row: JSON.stringify(feat.row) }, ctx.log).appended) {
|
|
368
|
+
committed = "row not appended on dev";
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
runGit(dir, ["add", "--", ...ROADMAP_FILES]);
|
|
372
|
+
const made = runGit(dir, [
|
|
373
|
+
"commit",
|
|
374
|
+
"-m",
|
|
375
|
+
`docs(${fid}): ${workflow} roadmap update bkit [skip ci]`,
|
|
376
|
+
"--",
|
|
377
|
+
...ROADMAP_FILES,
|
|
378
|
+
]);
|
|
379
|
+
if (!made.ok)
|
|
380
|
+
committed = `roadmap commit failed: ${made.stderr || made.stdout}`;
|
|
381
|
+
},
|
|
382
|
+
log: ctx.log,
|
|
383
|
+
});
|
|
384
|
+
switch (res.kind) {
|
|
385
|
+
case "landed":
|
|
386
|
+
return committed ? done(false, committed) : done(true, null);
|
|
387
|
+
case "refused":
|
|
388
|
+
return done(false, `dev push refused: ${res.stderr}`);
|
|
389
|
+
case "push-failed":
|
|
390
|
+
return done(false, `dev push failed: ${res.stderr}`);
|
|
391
|
+
case "exhausted":
|
|
392
|
+
return done(false, `dev moved before each of ${res.attempts} pushes`);
|
|
393
|
+
case "fetch-failed":
|
|
394
|
+
return done(false, `fetch of dev failed: ${res.stderr}`);
|
|
395
|
+
case "setup-failed":
|
|
396
|
+
return done(false, `throwaway checkout failed: ${res.stderr}`);
|
|
404
397
|
}
|
|
405
398
|
}
|
|
406
399
|
function writeBoard(md, board) {
|
|
@@ -478,7 +471,7 @@ export const roadmapCommand = {
|
|
|
478
471
|
run: (ctx) => feature(ctx),
|
|
479
472
|
},
|
|
480
473
|
mirror: {
|
|
481
|
-
summary: "Build / debug close: append the feature row in the worktree, then the same row on dev
|
|
474
|
+
summary: "Build / debug close: append the feature row in the worktree, then land the same row on dev through a throwaway origin/dev checkout (fail-open).",
|
|
482
475
|
flags: [
|
|
483
476
|
{ name: "workflow", type: "string", required: true, help: "build | debug" },
|
|
484
477
|
{ name: "fid", type: "string", required: true, help: "feature id (the row's key)" },
|
|
@@ -487,7 +480,7 @@ export const roadmapCommand = {
|
|
|
487
480
|
row: "the row appended (worktree and dev)",
|
|
488
481
|
appended: "false when the worktree ledger could not be written",
|
|
489
482
|
mirrored: "the row was committed and pushed on dev",
|
|
490
|
-
skipped: "why the dev side was skipped:
|
|
483
|
+
skipped: "why the dev side was skipped: on dev | row not appended on dev | dev push refused | dev moved before each push | fetch of dev failed | throwaway checkout failed (null when mirrored)",
|
|
491
484
|
},
|
|
492
485
|
run: (ctx) => mirror(ctx),
|
|
493
486
|
},
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
import * as fs from "node:fs";
|
|
23
23
|
import * as path from "node:path";
|
|
24
24
|
import { statusTimestamp } from "../../ledgers/status.js";
|
|
25
|
-
import { bodySkipToken, commitMessage, CommandError, EXIT, git, parseJson, runGh, runGit, SKIP_CI_TOKEN, } from "../lib.js";
|
|
25
|
+
import { bodySkipToken, commitMessage, CommandError, DEV, EXIT, git, isSharedBranch, parseJson, runGh, runGit, SKIP_CI_TOKEN, } from "../lib.js";
|
|
26
26
|
import { readBkitConfig } from "../../shared/settings.js";
|
|
27
27
|
import { TIMEOUTS } from "../../shared/timeouts.js";
|
|
28
28
|
import { FID_PATTERNS, fromBranch, fromMarker, issueIdOf, readIssueTracker } from "./fids.js";
|
|
@@ -171,7 +171,7 @@ function currentPr(cwd, gh) {
|
|
|
171
171
|
const branch = git(cwd, ["branch", "--show-current"]);
|
|
172
172
|
if (!branch)
|
|
173
173
|
return { pr: null, missing: false };
|
|
174
|
-
const res = gh(["pr", "list", "--head", branch, "--base",
|
|
174
|
+
const res = gh(["pr", "list", "--head", branch, "--base", DEV, "--json", "number"]);
|
|
175
175
|
if (res.missing)
|
|
176
176
|
return { pr: null, missing: true };
|
|
177
177
|
const n = obj(arr(res.ok ? jsonOrUndefined(res.stdout) : undefined)[0]).number;
|
|
@@ -184,7 +184,7 @@ function pushCurrentBranch(cwd) {
|
|
|
184
184
|
if (!branch)
|
|
185
185
|
return false;
|
|
186
186
|
// Shared branches never force; a feature branch is rewritten only by this run.
|
|
187
|
-
const args = branch
|
|
187
|
+
const args = isSharedBranch(branch)
|
|
188
188
|
? ["push", "origin", branch]
|
|
189
189
|
: ["push", "--force-with-lease", "origin", branch];
|
|
190
190
|
return runGit(cwd, args).ok;
|
|
@@ -1324,7 +1324,7 @@ async function runContext(ctx) {
|
|
|
1324
1324
|
mode: "CI_DEV",
|
|
1325
1325
|
fid: arg,
|
|
1326
1326
|
issueId: tracker === "none" ? null : issueIdOf(arg, "any"),
|
|
1327
|
-
branch:
|
|
1327
|
+
branch: DEV,
|
|
1328
1328
|
headSha: git(ctx.cwd, ["rev-parse", "origin/dev"]) ?? "",
|
|
1329
1329
|
});
|
|
1330
1330
|
return EXIT.OK;
|
|
@@ -1395,7 +1395,7 @@ async function runContext(ctx) {
|
|
|
1395
1395
|
async function runMirror(ctx) {
|
|
1396
1396
|
const f = ctx.flags;
|
|
1397
1397
|
const head = String(f.head);
|
|
1398
|
-
const branch = str(f.branch) ??
|
|
1398
|
+
const branch = str(f.branch) ?? DEV;
|
|
1399
1399
|
if (!branch)
|
|
1400
1400
|
throw new CommandError(EXIT.USAGE, "--branch must not be empty");
|
|
1401
1401
|
const o = {
|
|
@@ -81,8 +81,9 @@ export function classify(env, root, log) {
|
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Default capabilities per runtime. CLOUD_CURSOR matches GITHUB_ACTION on
|
|
84
|
-
* purpose (isolated VM, real git, mints and pushes its own branch)
|
|
85
|
-
* session
|
|
84
|
+
* purpose (isolated VM, real git, mints and pushes its own branch). A claude.ai
|
|
85
|
+
* session gets neither: whether it may push dev can't be tested without making
|
|
86
|
+
* that push, and a wrong guess strands the session on a dev checkout.
|
|
86
87
|
*/
|
|
87
88
|
const capable = (runtime) => runtime === "LOCAL" || runtime === "GITHUB_ACTION" || runtime === "CLOUD_CURSOR";
|
|
88
89
|
/** No human can reply into the session: a GitHub Actions run. */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { activeDoneSteps, appendLine, fold, lastDoneStepAllRuns, lastRun, nextStrategy, runOrStepField, statusTimestamp, } from "../../ledgers/status.js";
|
|
5
|
-
import { CommandError, EXIT, parseJson, statusLocation, } from "../lib.js";
|
|
5
|
+
import { CommandError, EXIT, git, parseJson, statusLocation, } from "../lib.js";
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
7
|
// Shared with counters / steps
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
@@ -31,22 +31,46 @@ export const SUB_PLAN_FLAG = {
|
|
|
31
31
|
};
|
|
32
32
|
/** Exit code: status.jsonl missing, unreadable, or not valid NDJSON. */
|
|
33
33
|
export const EXIT_NO_STATUS = 3;
|
|
34
|
-
/** Parse every line of `status.jsonl`. Missing, unreadable or malformed is an error, never "no rows". */
|
|
35
34
|
/** Every row of status.jsonl, whatever its type; exit 3 when the file is missing or a line is not JSON. */
|
|
36
35
|
export function readStatusRows(file) {
|
|
37
36
|
if (!fs.existsSync(file))
|
|
38
37
|
throw new CommandError(EXIT_NO_STATUS, `${file} does not exist`);
|
|
39
|
-
return fs
|
|
40
|
-
|
|
38
|
+
return parseStatusRows(fs.readFileSync(file, "utf-8"), file);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The rows of status.jsonl as committed on `ref`, not as on disk: exit 3 when
|
|
42
|
+
* the ref does not carry the file. `file` need not exist; the repo is the one
|
|
43
|
+
* holding its nearest existing parent directory.
|
|
44
|
+
*/
|
|
45
|
+
export function readStatusRowsAt(file, ref) {
|
|
46
|
+
let dir = path.dirname(file);
|
|
47
|
+
while (!fs.existsSync(dir) && path.dirname(dir) !== dir)
|
|
48
|
+
dir = path.dirname(dir);
|
|
49
|
+
const top = git(dir, ["rev-parse", "--show-toplevel"]);
|
|
50
|
+
if (top === null)
|
|
51
|
+
throw new CommandError(EXIT_NO_STATUS, `${file} is not inside a git repo`);
|
|
52
|
+
const rel = path
|
|
53
|
+
.relative(fs.realpathSync(top), path.join(fs.realpathSync(dir), path.relative(dir, file)))
|
|
54
|
+
.split(path.sep)
|
|
55
|
+
.join("/");
|
|
56
|
+
const spec = `${ref}:${rel}`;
|
|
57
|
+
const text = git(top, ["show", spec]);
|
|
58
|
+
if (text === null)
|
|
59
|
+
throw new CommandError(EXIT_NO_STATUS, `${spec} does not exist`);
|
|
60
|
+
return parseStatusRows(text, spec);
|
|
61
|
+
}
|
|
62
|
+
/** Parse NDJSON status text; `label` names it in errors. Malformed is an error, never "no rows". */
|
|
63
|
+
function parseStatusRows(text, label) {
|
|
64
|
+
return text
|
|
41
65
|
.split("\n")
|
|
42
66
|
.map((l) => l.trim())
|
|
43
67
|
.filter((l) => l !== "")
|
|
44
68
|
.map((l, i) => {
|
|
45
69
|
const parsed = parseJson(l);
|
|
46
70
|
if (!parsed.ok)
|
|
47
|
-
throw new CommandError(EXIT_NO_STATUS, `${
|
|
71
|
+
throw new CommandError(EXIT_NO_STATUS, `${label} line ${i + 1} is not JSON`);
|
|
48
72
|
if (typeof parsed.value !== "object" || parsed.value === null) {
|
|
49
|
-
throw new CommandError(EXIT_NO_STATUS, `${
|
|
73
|
+
throw new CommandError(EXIT_NO_STATUS, `${label} line ${i + 1} is not a JSON object`);
|
|
50
74
|
}
|
|
51
75
|
return parsed.value;
|
|
52
76
|
});
|
|
@@ -54,6 +78,8 @@ export function readStatusRows(file) {
|
|
|
54
78
|
/** The rows as the fold reads them; the fold skips types it does not model. */
|
|
55
79
|
export const readStatusEvents = (file) => readStatusRows(file);
|
|
56
80
|
export const readRuns = (file) => fold(readStatusEvents(file));
|
|
81
|
+
/** The runs as committed on `ref` (see readStatusRowsAt). */
|
|
82
|
+
export const readRunsAt = (file, ref) => fold(readStatusRowsAt(file, ref));
|
|
57
83
|
/** `--file`, resolved against the command's working directory. */
|
|
58
84
|
export const statusFile = (ctx) => path.resolve(ctx.cwd, String(ctx.flags.file));
|
|
59
85
|
/** `--field key=value`: value parsed as JSON when it parses, else kept as a string. */
|
|
@@ -197,11 +223,6 @@ export const statusCommand = {
|
|
|
197
223
|
WORKFLOW_FLAG,
|
|
198
224
|
{ name: "fid", type: "string", required: true, help: "feature id" },
|
|
199
225
|
{ name: "month", type: "string", required: true, help: "month bucket, YYYYMM" },
|
|
200
|
-
{
|
|
201
|
-
name: "dev-pushes",
|
|
202
|
-
type: "boolean",
|
|
203
|
-
help: "ship only: this runtime pushes to dev (RUNTIME_DEVPUSHES=true)",
|
|
204
|
-
},
|
|
205
226
|
],
|
|
206
227
|
output: {
|
|
207
228
|
path: "absolute path to status.jsonl",
|
|
@@ -217,7 +238,6 @@ export const statusCommand = {
|
|
|
217
238
|
workflow: String(ctx.flags.workflow),
|
|
218
239
|
fid: String(ctx.flags.fid),
|
|
219
240
|
month,
|
|
220
|
-
devPushes: ctx.flags.devPushes === true,
|
|
221
241
|
});
|
|
222
242
|
ctx.emit({ ...loc, exists: fs.existsSync(loc.path) });
|
|
223
243
|
return EXIT.OK;
|
|
@@ -18,8 +18,8 @@ import { getPromptsRoot } from "../../shared/package-roots.js";
|
|
|
18
18
|
import { CommandError, EXIT, repoRoot, runGit, } from "../lib.js";
|
|
19
19
|
import { FID_PATTERNS, readIssueTracker } from "./fids.js";
|
|
20
20
|
import { buildComment } from "./issues.js";
|
|
21
|
-
import {
|
|
22
|
-
import { EXIT_NO_STATUS, FILE_FLAG, STEP_FLAG, SUB_PLAN_FLAG, WORKFLOW_FLAG, extraField, nonNegativeInt, positiveInt, readRuns, statusFile, str, } from "./status.js";
|
|
21
|
+
import { readHolder, resolveMonth, workflowLockPath } from "./locks.js";
|
|
22
|
+
import { EXIT_NO_STATUS, FILE_FLAG, STEP_FLAG, SUB_PLAN_FLAG, WORKFLOW_FLAG, extraField, nonNegativeInt, positiveInt, readRuns, readRunsAt, statusFile, str, } from "./status.js";
|
|
23
23
|
const VERDICT_END = "<!-- verdict:end -->";
|
|
24
24
|
const DEFAULT_VERDICTS = ["PASS", "CONCERNS", "FAIL"];
|
|
25
25
|
const STRATEGIES = ["STANDARD", "PIVOT", "FINAL"];
|
|
@@ -242,6 +242,7 @@ export const ROW_FIELDS = {
|
|
|
242
242
|
"build/build-summary": ["attempt"],
|
|
243
243
|
"debug/debug-run-tests": ["attempt", "scope"],
|
|
244
244
|
"debug/context-fetch": ["attempt"],
|
|
245
|
+
"debug/debug-failure-reproduce": ["attempt"],
|
|
245
246
|
"debug/debug-failure-diagnose": ["attempt", "strategy"],
|
|
246
247
|
"debug/debug-failure-remediate": ["attempt", "strategy"],
|
|
247
248
|
"debug/debug-failure-soak": ["attempt"],
|
|
@@ -328,7 +329,8 @@ function gateChecks(cwd, o) {
|
|
|
328
329
|
? undefined
|
|
329
330
|
: `does not match the ${tracker} shape ${FID_PATTERNS[tracker].source}`, `${tracker} shape`);
|
|
330
331
|
if (o.token !== undefined) {
|
|
331
|
-
const
|
|
332
|
+
const root = repoRoot(cwd);
|
|
333
|
+
const lock = workflowLockPath(root, resolveMonth(root, o.fid, o.month), o.fid);
|
|
332
334
|
const holder = readHolder(lock);
|
|
333
335
|
add("workflow lock", holder === undefined
|
|
334
336
|
? `no lock at ${lock}`
|
|
@@ -364,7 +366,8 @@ function gateChecks(cwd, o) {
|
|
|
364
366
|
}
|
|
365
367
|
if (o.file === undefined)
|
|
366
368
|
return checks;
|
|
367
|
-
const
|
|
369
|
+
const runs = o.ref === undefined ? readRuns(o.file) : readRunsAt(o.file, o.ref);
|
|
370
|
+
const rows = activeDoneSteps(runs, o.workflow, { step: o.step, subPlan: o.subPlan });
|
|
368
371
|
const row = rows.filter((r) => o.attempt === undefined || r.attempt === o.attempt).at(-1);
|
|
369
372
|
const rowProblems = [];
|
|
370
373
|
if (!row) {
|
|
@@ -980,6 +983,11 @@ export const stepsCommand = {
|
|
|
980
983
|
required: false,
|
|
981
984
|
help: "path to status.jsonl; without it the status row is not checked (Step 1)",
|
|
982
985
|
},
|
|
986
|
+
{
|
|
987
|
+
name: "ref",
|
|
988
|
+
type: "string",
|
|
989
|
+
help: "read --file as committed on this ref (e.g. origin/dev), not from disk",
|
|
990
|
+
},
|
|
983
991
|
WORKFLOW_FLAG,
|
|
984
992
|
STEP_FLAG,
|
|
985
993
|
SUB_PLAN_FLAG,
|
|
@@ -1018,15 +1026,10 @@ export const stepsCommand = {
|
|
|
1018
1026
|
type: "string",
|
|
1019
1027
|
help: "the workflow lock must be held with this token (needs --fid)",
|
|
1020
1028
|
},
|
|
1021
|
-
{
|
|
1022
|
-
name: "dev-pushes",
|
|
1023
|
-
type: "boolean",
|
|
1024
|
-
help: "ship only: the lock lives in the main checkout",
|
|
1025
|
-
},
|
|
1026
1029
|
],
|
|
1027
1030
|
output: { pass: "true when every check passed", checks: "[{check, ok, detail}] per check" },
|
|
1028
1031
|
exitCodes: {
|
|
1029
|
-
[EXIT_NO_STATUS]: "status.jsonl missing, unreadable, or not valid NDJSON",
|
|
1032
|
+
[EXIT_NO_STATUS]: "status.jsonl missing (on disk, or on --ref), unreadable, or not valid NDJSON",
|
|
1030
1033
|
},
|
|
1031
1034
|
run: (ctx) => {
|
|
1032
1035
|
const f = ctx.flags;
|
|
@@ -1037,11 +1040,17 @@ export const stepsCommand = {
|
|
|
1037
1040
|
throw new CommandError(EXIT.USAGE, "give --attempt or --attempt-of, not both");
|
|
1038
1041
|
if (f.attemptOf !== undefined && file === undefined)
|
|
1039
1042
|
throw new CommandError(EXIT.USAGE, "--attempt-of needs --file");
|
|
1043
|
+
const ref = str(f.ref);
|
|
1044
|
+
if (ref !== undefined && file === undefined)
|
|
1045
|
+
throw new CommandError(EXIT.USAGE, "--ref needs --file");
|
|
1046
|
+
if (ref !== undefined && f.attemptOf !== undefined)
|
|
1047
|
+
throw new CommandError(EXIT.USAGE, "--attempt-of reads the file on disk; give --attempt with --ref");
|
|
1040
1048
|
const attempt = f.attemptOf !== undefined
|
|
1041
1049
|
? derivedCounter(file, workflow, String(f.attemptOf), subPlan, undefined)
|
|
1042
1050
|
: nonNegativeInt(f.attempt, "attempt");
|
|
1043
1051
|
const checks = gateChecks(ctx.cwd, {
|
|
1044
1052
|
file,
|
|
1053
|
+
ref,
|
|
1045
1054
|
workflow,
|
|
1046
1055
|
step: String(f.step),
|
|
1047
1056
|
subPlan,
|
|
@@ -1052,7 +1061,6 @@ export const stepsCommand = {
|
|
|
1052
1061
|
fid: str(f.fid),
|
|
1053
1062
|
month: str(f.month),
|
|
1054
1063
|
token: str(f.token),
|
|
1055
|
-
devPushes: f.devPushes === true,
|
|
1056
1064
|
placeholders: list(f.placeholder),
|
|
1057
1065
|
});
|
|
1058
1066
|
const pass = checks.every((c) => c.ok);
|
|
@@ -491,6 +491,11 @@ export const testsCommand = {
|
|
|
491
491
|
repeatable: true,
|
|
492
492
|
help: "candidate plan file; the first that exists is audited",
|
|
493
493
|
},
|
|
494
|
+
{
|
|
495
|
+
name: "brief",
|
|
496
|
+
type: "string",
|
|
497
|
+
help: "the build input, audited when no plan file exists and it carries `**Task N:**` lines with `Test first:`",
|
|
498
|
+
},
|
|
494
499
|
{
|
|
495
500
|
name: "log",
|
|
496
501
|
type: "string",
|
|
@@ -501,7 +506,7 @@ export const testsCommand = {
|
|
|
501
506
|
output: {
|
|
502
507
|
enforced: "false when there is nothing to audit (reason says why)",
|
|
503
508
|
reason: "why test-first is not enforced",
|
|
504
|
-
plan: "the plan file audited",
|
|
509
|
+
plan: "the plan file audited (the brief when no plan file exists and it carries Test first lines)",
|
|
505
510
|
gaps: "[{task, kind, detail}]: no-test-first | test-first-malformed | no-red | red-mismatch | red-evidence-missing | test-changed | not-green",
|
|
506
511
|
log: "where the report was written (as given)",
|
|
507
512
|
},
|
|
@@ -516,14 +521,22 @@ export const testsCommand = {
|
|
|
516
521
|
throw new CommandError(EXIT.USAGE, "--log must be non-empty");
|
|
517
522
|
const log = path.resolve(ctx.cwd, logArg);
|
|
518
523
|
const top = toplevel(ctx.cwd);
|
|
519
|
-
const
|
|
524
|
+
const exists = (p) => fs.existsSync(path.resolve(ctx.cwd, p));
|
|
525
|
+
const planFile = ctx.flags.plan.find(exists);
|
|
526
|
+
const briefArg = str(ctx.flags.brief);
|
|
527
|
+
const brief = planFile === undefined && briefArg !== undefined && exists(briefArg)
|
|
528
|
+
? briefArg
|
|
529
|
+
: undefined;
|
|
530
|
+
const plan = planFile ?? brief;
|
|
520
531
|
const specs = plan
|
|
521
532
|
? readTestFirst(fs.readFileSync(path.resolve(ctx.cwd, plan), "utf-8"))
|
|
522
533
|
: [];
|
|
523
534
|
const reason = plan === undefined
|
|
524
535
|
? "no plan file — the build runs from its brief"
|
|
525
536
|
: !specs.some((s) => s.kind !== "missing")
|
|
526
|
-
?
|
|
537
|
+
? brief !== undefined
|
|
538
|
+
? "no plan file, and the brief has no `**Task N:**` lines with `Test first:`"
|
|
539
|
+
: "the plan has no `Test first:` lines"
|
|
527
540
|
: resolveGate(top, [BKIT_TEST_FILE_SCRIPT]) === null
|
|
528
541
|
? `\`${BKIT_TEST_FILE_SCRIPT}\` is not declared in package.json`
|
|
529
542
|
: undefined;
|