codebyplan 1.13.65 → 1.13.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -75
- package/dist/__tests__/helpers.d.ts +22 -0
- package/dist/__tests__/helpers.d.ts.map +1 -0
- package/dist/ci-public.d.ts +20 -0
- package/dist/ci-public.d.ts.map +1 -0
- package/dist/ci.js +11 -2
- package/dist/cli/arch-map.d.ts +33 -0
- package/dist/cli/arch-map.d.ts.map +1 -0
- package/dist/cli/branch.d.ts +10 -0
- package/dist/cli/branch.d.ts.map +1 -0
- package/dist/cli/bump.d.ts +12 -0
- package/dist/cli/bump.d.ts.map +1 -0
- package/dist/cli/cd.d.ts +20 -0
- package/dist/cli/cd.d.ts.map +1 -0
- package/dist/cli/check.d.ts +30 -0
- package/dist/cli/check.d.ts.map +1 -0
- package/dist/cli/checkpoint.d.ts +17 -0
- package/dist/cli/checkpoint.d.ts.map +1 -0
- package/dist/cli/ci.d.ts +31 -0
- package/dist/cli/ci.d.ts.map +1 -0
- package/dist/cli/claude/__test-helpers__/expect-manifest.d.ts +7 -0
- package/dist/cli/claude/__test-helpers__/expect-manifest.d.ts.map +1 -0
- package/dist/cli/claude/__test-helpers__/tmp-fixture.d.ts +64 -0
- package/dist/cli/claude/__test-helpers__/tmp-fixture.d.ts.map +1 -0
- package/dist/cli/claude/audit-mode.d.ts +16 -0
- package/dist/cli/claude/audit-mode.d.ts.map +1 -0
- package/dist/cli/claude/generate.d.ts +23 -0
- package/dist/cli/claude/generate.d.ts.map +1 -0
- package/dist/cli/claude/install.d.ts +55 -0
- package/dist/cli/claude/install.d.ts.map +1 -0
- package/dist/cli/claude/migrate-memory.d.ts +117 -0
- package/dist/cli/claude/migrate-memory.d.ts.map +1 -0
- package/dist/cli/claude/readme.d.ts +28 -0
- package/dist/cli/claude/readme.d.ts.map +1 -0
- package/dist/cli/claude/status.d.ts +41 -0
- package/dist/cli/claude/status.d.ts.map +1 -0
- package/dist/cli/claude/uninstall.d.ts +21 -0
- package/dist/cli/claude/uninstall.d.ts.map +1 -0
- package/dist/cli/claude/update.d.ts +25 -0
- package/dist/cli/claude/update.d.ts.map +1 -0
- package/dist/cli/claude/verify-parity.d.ts +25 -0
- package/dist/cli/claude/verify-parity.d.ts.map +1 -0
- package/dist/cli/cleanup-plan-folders.d.ts +21 -0
- package/dist/cli/cleanup-plan-folders.d.ts.map +1 -0
- package/dist/cli/commit.d.ts +25 -0
- package/dist/cli/commit.d.ts.map +1 -0
- package/dist/cli/config.d.ts +50 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/confirm.d.ts +9 -0
- package/dist/cli/confirm.d.ts.map +1 -0
- package/dist/cli/create-org.d.ts +9 -0
- package/dist/cli/create-org.d.ts.map +1 -0
- package/dist/cli/create-project.d.ts +10 -0
- package/dist/cli/create-project.d.ts.map +1 -0
- package/dist/cli/create-repo.d.ts +14 -0
- package/dist/cli/create-repo.d.ts.map +1 -0
- package/dist/cli/docs.d.ts +41 -0
- package/dist/cli/docs.d.ts.map +1 -0
- package/dist/cli/doctor.d.ts +17 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/e2e/verify-round.d.ts +46 -0
- package/dist/cli/e2e/verify-round.d.ts.map +1 -0
- package/dist/cli/e2e.d.ts +11 -0
- package/dist/cli/e2e.d.ts.map +1 -0
- package/dist/cli/eslint.d.ts +20 -0
- package/dist/cli/eslint.d.ts.map +1 -0
- package/dist/cli/export-writer.d.ts +99 -0
- package/dist/cli/export-writer.d.ts.map +1 -0
- package/dist/cli/handoff.d.ts +13 -0
- package/dist/cli/handoff.d.ts.map +1 -0
- package/dist/cli/login.d.ts +10 -0
- package/dist/cli/login.d.ts.map +1 -0
- package/dist/cli/logout.d.ts +2 -0
- package/dist/cli/logout.d.ts.map +1 -0
- package/dist/cli/lsp.d.ts +16 -0
- package/dist/cli/lsp.d.ts.map +1 -0
- package/dist/cli/migration-collisions.d.ts +10 -0
- package/dist/cli/migration-collisions.d.ts.map +1 -0
- package/dist/cli/ports.d.ts +29 -0
- package/dist/cli/ports.d.ts.map +1 -0
- package/dist/cli/process-exit-signal.d.ts +24 -0
- package/dist/cli/process-exit-signal.d.ts.map +1 -0
- package/dist/cli/round.d.ts +79 -0
- package/dist/cli/round.d.ts.map +1 -0
- package/dist/cli/scaffold-publish-workflow.d.ts +16 -0
- package/dist/cli/scaffold-publish-workflow.d.ts.map +1 -0
- package/dist/cli/session/freshness-gate.d.ts +21 -0
- package/dist/cli/session/freshness-gate.d.ts.map +1 -0
- package/dist/cli/session/home-ff.d.ts +16 -0
- package/dist/cli/session/home-ff.d.ts.map +1 -0
- package/dist/cli/session/infra-files.d.ts +21 -0
- package/dist/cli/session/infra-files.d.ts.map +1 -0
- package/dist/cli/session/start.d.ts +70 -0
- package/dist/cli/session/start.d.ts.map +1 -0
- package/dist/cli/session.d.ts +17 -0
- package/dist/cli/session.d.ts.map +1 -0
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/ship.d.ts +16 -0
- package/dist/cli/ship.d.ts.map +1 -0
- package/dist/cli/slug.d.ts +10 -0
- package/dist/cli/slug.d.ts.map +1 -0
- package/dist/cli/standalone-task.d.ts +31 -0
- package/dist/cli/standalone-task.d.ts.map +1 -0
- package/dist/cli/statusline.d.ts +10 -0
- package/dist/cli/statusline.d.ts.map +1 -0
- package/dist/cli/supabase/new-migration.d.ts +24 -0
- package/dist/cli/supabase/new-migration.d.ts.map +1 -0
- package/dist/cli/supabase/preview-check.d.ts +30 -0
- package/dist/cli/supabase/preview-check.d.ts.map +1 -0
- package/dist/cli/supabase/resolve-preview.d.ts +19 -0
- package/dist/cli/supabase/resolve-preview.d.ts.map +1 -0
- package/dist/cli/supabase/teardown-preview.d.ts +22 -0
- package/dist/cli/supabase/teardown-preview.d.ts.map +1 -0
- package/dist/cli/sync.d.ts +13 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/task.d.ts +17 -0
- package/dist/cli/task.d.ts.map +1 -0
- package/dist/cli/tech-stack.d.ts +11 -0
- package/dist/cli/tech-stack.d.ts.map +1 -0
- package/dist/cli/upgrade-auth.d.ts +2 -0
- package/dist/cli/upgrade-auth.d.ts.map +1 -0
- package/dist/cli/upload-e2e-images.d.ts +18 -0
- package/dist/cli/upload-e2e-images.d.ts.map +1 -0
- package/dist/cli/validate-waves.d.ts +22 -0
- package/dist/cli/validate-waves.d.ts.map +1 -0
- package/dist/cli/version-status.d.ts +42 -0
- package/dist/cli/version-status.d.ts.map +1 -0
- package/dist/cli/watch.d.ts +18 -0
- package/dist/cli/watch.d.ts.map +1 -0
- package/dist/cli/whoami.d.ts +5 -0
- package/dist/cli/whoami.d.ts.map +1 -0
- package/dist/cli/worktree/add.d.ts +81 -0
- package/dist/cli/worktree/add.d.ts.map +1 -0
- package/dist/cli/worktree/create.d.ts +46 -0
- package/dist/cli/worktree/create.d.ts.map +1 -0
- package/dist/cli/worktree/path.d.ts +19 -0
- package/dist/cli/worktree/path.d.ts.map +1 -0
- package/dist/cli/worktree/remove.d.ts +60 -0
- package/dist/cli/worktree/remove.d.ts.map +1 -0
- package/dist/cli/worktree.d.ts +15 -0
- package/dist/cli/worktree.d.ts.map +1 -0
- package/dist/cli.js +5613 -5328
- package/dist/dispatch.d.ts +64 -0
- package/dist/dispatch.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/agents-generator.d.ts +42 -0
- package/dist/lib/agents-generator.d.ts.map +1 -0
- package/dist/lib/api.d.ts +54 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/atomic-write.d.ts +27 -0
- package/dist/lib/atomic-write.d.ts.map +1 -0
- package/dist/lib/branch-checkout.d.ts +47 -0
- package/dist/lib/branch-checkout.d.ts.map +1 -0
- package/dist/lib/branch-port-resolver.d.ts +58 -0
- package/dist/lib/branch-port-resolver.d.ts.map +1 -0
- package/dist/lib/bump.d.ts +97 -0
- package/dist/lib/bump.d.ts.map +1 -0
- package/dist/lib/cd-init.d.ts +86 -0
- package/dist/lib/cd-init.d.ts.map +1 -0
- package/dist/lib/check-baseline.d.ts +91 -0
- package/dist/lib/check-baseline.d.ts.map +1 -0
- package/dist/lib/check.d.ts +178 -0
- package/dist/lib/check.d.ts.map +1 -0
- package/dist/lib/ci-init.d.ts +106 -0
- package/dist/lib/ci-init.d.ts.map +1 -0
- package/dist/lib/ci-resolve.d.ts +60 -0
- package/dist/lib/ci-resolve.d.ts.map +1 -0
- package/dist/lib/claude-mode-audit.d.ts +41 -0
- package/dist/lib/claude-mode-audit.d.ts.map +1 -0
- package/dist/lib/claude-plan.d.ts +34 -0
- package/dist/lib/claude-plan.d.ts.map +1 -0
- package/dist/lib/commit-scope.d.ts +21 -0
- package/dist/lib/commit-scope.d.ts.map +1 -0
- package/dist/lib/e2e.d.ts +157 -0
- package/dist/lib/e2e.d.ts.map +1 -0
- package/dist/lib/eslint-generator.d.ts +86 -0
- package/dist/lib/eslint-generator.d.ts.map +1 -0
- package/dist/lib/file-lock.d.ts +44 -0
- package/dist/lib/file-lock.d.ts.map +1 -0
- package/dist/lib/flags.d.ts +115 -0
- package/dist/lib/flags.d.ts.map +1 -0
- package/dist/lib/gh-required-checks.d.ts +76 -0
- package/dist/lib/gh-required-checks.d.ts.map +1 -0
- package/dist/lib/git-utils.d.ts +46 -0
- package/dist/lib/git-utils.d.ts.map +1 -0
- package/dist/lib/gitignore-block.d.ts +32 -0
- package/dist/lib/gitignore-block.d.ts.map +1 -0
- package/dist/lib/gitignore-detect.d.ts +117 -0
- package/dist/lib/gitignore-detect.d.ts.map +1 -0
- package/dist/lib/handoff-file.d.ts +63 -0
- package/dist/lib/handoff-file.d.ts.map +1 -0
- package/dist/lib/hash.d.ts +9 -0
- package/dist/lib/hash.d.ts.map +1 -0
- package/dist/lib/lsp-detect.d.ts +42 -0
- package/dist/lib/lsp-detect.d.ts.map +1 -0
- package/dist/lib/manifest.d.ts +88 -0
- package/dist/lib/manifest.d.ts.map +1 -0
- package/dist/lib/mcp-client.d.ts +39 -0
- package/dist/lib/mcp-client.d.ts.map +1 -0
- package/dist/lib/migrate-branch-model.d.ts +34 -0
- package/dist/lib/migrate-branch-model.d.ts.map +1 -0
- package/dist/lib/migrate-local-config.d.ts +39 -0
- package/dist/lib/migrate-local-config.d.ts.map +1 -0
- package/dist/lib/migration-collisions.d.ts +61 -0
- package/dist/lib/migration-collisions.d.ts.map +1 -0
- package/dist/lib/port-verify.d.ts +73 -0
- package/dist/lib/port-verify.d.ts.map +1 -0
- package/dist/lib/prompt.d.ts +41 -0
- package/dist/lib/prompt.d.ts.map +1 -0
- package/dist/lib/readme-generator.d.ts +108 -0
- package/dist/lib/readme-generator.d.ts.map +1 -0
- package/dist/lib/repo-reader.d.ts +59 -0
- package/dist/lib/repo-reader.d.ts.map +1 -0
- package/dist/lib/scaffold-cd-workflow.d.ts +48 -0
- package/dist/lib/scaffold-cd-workflow.d.ts.map +1 -0
- package/dist/lib/scaffold-ci-workflow.d.ts +83 -0
- package/dist/lib/scaffold-ci-workflow.d.ts.map +1 -0
- package/dist/lib/scaffold-publish-workflow.d.ts +48 -0
- package/dist/lib/scaffold-publish-workflow.d.ts.map +1 -0
- package/dist/lib/server-detect.d.ts +20 -0
- package/dist/lib/server-detect.d.ts.map +1 -0
- package/dist/lib/session.d.ts +371 -0
- package/dist/lib/session.d.ts.map +1 -0
- package/dist/lib/settings-merge.d.ts +268 -0
- package/dist/lib/settings-merge.d.ts.map +1 -0
- package/dist/lib/ship.d.ts +84 -0
- package/dist/lib/ship.d.ts.map +1 -0
- package/dist/lib/slug.d.ts +26 -0
- package/dist/lib/slug.d.ts.map +1 -0
- package/dist/lib/spawn.d.ts +12 -0
- package/dist/lib/spawn.d.ts.map +1 -0
- package/dist/lib/state-client.d.ts +54 -0
- package/dist/lib/state-client.d.ts.map +1 -0
- package/dist/lib/state-store.d.ts +153 -0
- package/dist/lib/state-store.d.ts.map +1 -0
- package/dist/lib/state-sync.d.ts +101 -0
- package/dist/lib/state-sync.d.ts.map +1 -0
- package/dist/lib/statusline-config.d.ts +55 -0
- package/dist/lib/statusline-config.d.ts.map +1 -0
- package/dist/lib/structure-generator.d.ts +63 -0
- package/dist/lib/structure-generator.d.ts.map +1 -0
- package/dist/lib/supabase.d.ts +87 -0
- package/dist/lib/supabase.d.ts.map +1 -0
- package/dist/lib/sync-approvals.d.ts +108 -0
- package/dist/lib/sync-approvals.d.ts.map +1 -0
- package/dist/lib/tech-detect.d.ts +77 -0
- package/dist/lib/tech-detect.d.ts.map +1 -0
- package/dist/lib/template-walker.d.ts +26 -0
- package/dist/lib/template-walker.d.ts.map +1 -0
- package/dist/lib/templates-dir.d.ts +25 -0
- package/dist/lib/templates-dir.d.ts.map +1 -0
- package/dist/lib/types.d.ts +843 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/validate-waves.d.ts +38 -0
- package/dist/lib/validate-waves.d.ts.map +1 -0
- package/dist/lib/verify-parity.d.ts +154 -0
- package/dist/lib/verify-parity.d.ts.map +1 -0
- package/dist/lib/version.d.ts +3 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/watch-daemon.d.ts +114 -0
- package/dist/lib/watch-daemon.d.ts.map +1 -0
- package/dist/lib/worktree.d.ts +56 -0
- package/dist/lib/worktree.d.ts.map +1 -0
- package/dist/oauth/browser.d.ts +8 -0
- package/dist/oauth/browser.d.ts.map +1 -0
- package/dist/oauth/client-registration.d.ts +16 -0
- package/dist/oauth/client-registration.d.ts.map +1 -0
- package/dist/oauth/device-flow.d.ts +40 -0
- package/dist/oauth/device-flow.d.ts.map +1 -0
- package/dist/oauth/jwt-decode.d.ts +10 -0
- package/dist/oauth/jwt-decode.d.ts.map +1 -0
- package/dist/oauth/keychain.d.ts +17 -0
- package/dist/oauth/keychain.d.ts.map +1 -0
- package/dist/oauth/token-refresh.d.ts +7 -0
- package/dist/oauth/token-refresh.d.ts.map +1 -0
- package/dist/oauth/types.d.ts +28 -0
- package/dist/oauth/types.d.ts.map +1 -0
- package/dist/oauth/urls.d.ts +16 -0
- package/dist/oauth/urls.d.ts.map +1 -0
- package/package.json +5 -6
- package/templates/agents/cbp-security-agent.md +0 -1
- package/templates/agents/cbp-stripe-agent.md +0 -1
- package/templates/agents/cbp-testing-qa-agent.md +0 -1
- package/templates/hooks/cbp-skill-context-guard.sh +0 -1
- package/templates/hooks/validate-structure-lib.sh +36 -9
- package/templates/skills/cbp-checkpoint-check/SKILL.md +0 -1
- package/templates/skills/cbp-clear-continue/SKILL.md +0 -1
- package/templates/skills/cbp-clear-prep/SKILL.md +0 -1
- package/templates/skills/cbp-setup-cd/SKILL.md +0 -1
- package/templates/skills/cbp-setup-ci/SKILL.md +0 -1
- package/templates/skills/cbp-stripe/SKILL.md +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library for `codebyplan cd scaffold-workflow`.
|
|
3
|
+
*
|
|
4
|
+
* Reads CD workflow templates from this package's `templates/github-workflows/`
|
|
5
|
+
* directory and writes them to `{projectDir}/.github/workflows/`. Two workflow
|
|
6
|
+
* files are scaffolded:
|
|
7
|
+
* - publish.yml (npm publish — from templates/github-workflows/publish.yml)
|
|
8
|
+
* - release-desktop.yml (Tauri desktop release — from templates/github-workflows/release-desktop.yml)
|
|
9
|
+
*
|
|
10
|
+
* Idempotent:
|
|
11
|
+
* - If the target file is byte-identical to the template → returns `skipped`.
|
|
12
|
+
* - If the target exists but differs and `force` is false → throws an error.
|
|
13
|
+
* - If `dryRun` is true → returns `dry_run` without writing.
|
|
14
|
+
*
|
|
15
|
+
* Reuses ScaffoldOptions + ScaffoldResult types from scaffold-publish-workflow.ts
|
|
16
|
+
* and resolveTemplatesDir from templates-dir.ts (same resolution logic as the
|
|
17
|
+
* CI scaffolder).
|
|
18
|
+
*/
|
|
19
|
+
import type { ScaffoldOptions, ScaffoldResult } from "./scaffold-publish-workflow.js";
|
|
20
|
+
export interface ScaffoldCdWorkflowOptions extends ScaffoldOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Which workflow(s) to scaffold. Defaults to ["publish", "release-desktop"]
|
|
23
|
+
* which scaffolds both. Callers may pass a subset for targeted operations.
|
|
24
|
+
*/
|
|
25
|
+
workflows?: ("publish" | "release-desktop")[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Aggregated result for a single `cd scaffold-workflow` invocation that may
|
|
29
|
+
* scaffold multiple workflow files.
|
|
30
|
+
*/
|
|
31
|
+
export interface ScaffoldCdWorkflowResult {
|
|
32
|
+
/** One result entry per template scaffolded. */
|
|
33
|
+
results: Array<ScaffoldResult & {
|
|
34
|
+
workflow: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Scaffold CD GitHub Actions workflow(s) into the target project.
|
|
39
|
+
*
|
|
40
|
+
* By default scaffolds both publish.yml and release-desktop.yml. Callers may
|
|
41
|
+
* limit the set via `opts.workflows`.
|
|
42
|
+
*
|
|
43
|
+
* @throws {Error} If any template file is missing.
|
|
44
|
+
* @throws {Error} If any target file exists, differs from its template, and
|
|
45
|
+
* `force` is false.
|
|
46
|
+
*/
|
|
47
|
+
export declare function runScaffoldCdWorkflow(opts?: ScaffoldCdWorkflowOptions): Promise<ScaffoldCdWorkflowResult>;
|
|
48
|
+
//# sourceMappingURL=scaffold-cd-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold-cd-workflow.d.ts","sourceRoot":"","sources":["../../src/lib/scaffold-cd-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACf,MAAM,gCAAgC,CAAC;AAMxC,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,SAAS,GAAG,iBAAiB,CAAC,EAAE,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,gDAAgD;IAChD,OAAO,EAAE,KAAK,CAAC,cAAc,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvD;AAiGD;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,CAAC,EAAE,yBAAyB,GAC/B,OAAO,CAAC,wBAAwB,CAAC,CA4BnC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library for `codebyplan ci scaffold-workflow`.
|
|
3
|
+
*
|
|
4
|
+
* Reads `templates/github-workflows/ci.yml` from this package's templates
|
|
5
|
+
* directory, substitutes {{PNPM_VERSION}} and {{NODE_VERSION}} tokens, and
|
|
6
|
+
* writes the result to `{projectDir}/.github/workflows/ci.yml`.
|
|
7
|
+
*
|
|
8
|
+
* The emitted workflow has TWO jobs:
|
|
9
|
+
* - `ci` SOFT tier — the baseline-tolerant lint/typecheck/test/build
|
|
10
|
+
* inner loop; the authoritative required check.
|
|
11
|
+
* - `ci-strict` HARDCORE tier (report-only) — whole-repo ABSOLUTE GREEN via
|
|
12
|
+
* `codebyplan check --scope merged --no-baseline`, run with
|
|
13
|
+
* `continue-on-error: true` so it is non-blocking until the
|
|
14
|
+
* repo baseline is burned down and it is promoted to required.
|
|
15
|
+
* The job bodies live in the template; this module only substitutes tokens.
|
|
16
|
+
*
|
|
17
|
+
* Idempotent:
|
|
18
|
+
* - If the target file is byte-identical to the rendered template → returns `skipped`.
|
|
19
|
+
* - If the target exists but differs and `force` is false → throws an error.
|
|
20
|
+
* - If `dryRun` is true → returns `dry_run` without writing.
|
|
21
|
+
*
|
|
22
|
+
* Mirrors `scaffold-publish-workflow.ts` (same ScaffoldOptions/ScaffoldResult types +
|
|
23
|
+
* skip-if-identical / error-on-diff-without-force / --force / --dry-run / returns
|
|
24
|
+
* {status,path} logic). Token substitution uses simple String.replace with /g regex.
|
|
25
|
+
*
|
|
26
|
+
* Project-content reads (package.json, .codebyplan/ci.json) are reader-driven via
|
|
27
|
+
* RepoReader. Template-asset resolution stays import.meta.url-based via
|
|
28
|
+
* resolveTemplatesDir (not routed through the reader).
|
|
29
|
+
*/
|
|
30
|
+
import type { ScaffoldOptions, ScaffoldResult } from "./scaffold-publish-workflow.js";
|
|
31
|
+
import { type RepoReader } from "./repo-reader.js";
|
|
32
|
+
export interface ScaffoldCiWorkflowOptions extends ScaffoldOptions {
|
|
33
|
+
/**
|
|
34
|
+
* pnpm version to substitute for the {{PNPM_VERSION}} token.
|
|
35
|
+
* When omitted, the version is auto-detected from the target project's
|
|
36
|
+
* package.json `packageManager` field, falling back to "10".
|
|
37
|
+
*/
|
|
38
|
+
pnpmVersion?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Node.js version to substitute for the {{NODE_VERSION}} token.
|
|
41
|
+
* Defaults to "22".
|
|
42
|
+
*/
|
|
43
|
+
nodeVersion?: string;
|
|
44
|
+
/**
|
|
45
|
+
* When true, the hardcore `ci-strict` job is emitted as an enforced gate
|
|
46
|
+
* (`continue-on-error: false`, job name without the " (report-only)" suffix)
|
|
47
|
+
* so it can be wired as a required branch-protection check. When omitted, the
|
|
48
|
+
* value is read from the target project's `.codebyplan/ci.json`
|
|
49
|
+
* `workflow.strict_check_enforced` field, defaulting to `false` (report-only).
|
|
50
|
+
*/
|
|
51
|
+
strictEnforced?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Optional reader for project-content reads. When omitted, a LocalFsReader
|
|
54
|
+
* constructed with `projectDir` is used. Inject an InMemoryRepoReader in
|
|
55
|
+
* tests to avoid disk I/O.
|
|
56
|
+
*/
|
|
57
|
+
reader?: RepoReader;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Render the CI workflow YAML string by reading the package template and
|
|
61
|
+
* substituting tokens. Returns the rendered content WITHOUT writing to disk.
|
|
62
|
+
*
|
|
63
|
+
* This is the single rendering path — `runScaffoldCiWorkflow` calls this and
|
|
64
|
+
* then writes the returned string to disk. Non-fs callers (e.g. the GitHub-App
|
|
65
|
+
* auto-provisioner in apps/web) call this directly to obtain the YAML for a
|
|
66
|
+
* GitHub API blob upload.
|
|
67
|
+
*
|
|
68
|
+
* @throws {Error} If the template file is missing.
|
|
69
|
+
*/
|
|
70
|
+
export declare function renderCiWorkflowContent(opts?: ScaffoldCiWorkflowOptions): Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Scaffold the CI GitHub Actions workflow into the target project.
|
|
73
|
+
*
|
|
74
|
+
* Delegates rendering to `renderCiWorkflowContent` (the single rendering path)
|
|
75
|
+
* and then handles the disk-write lifecycle (dry-run, skip-if-identical,
|
|
76
|
+
* error-on-diff-without-force, atomic tmp+rename write).
|
|
77
|
+
*
|
|
78
|
+
* @throws {Error} If the template file is missing.
|
|
79
|
+
* @throws {Error} If the target file exists, differs from the rendered template,
|
|
80
|
+
* and `force` is false.
|
|
81
|
+
*/
|
|
82
|
+
export declare function runScaffoldCiWorkflow(opts?: ScaffoldCiWorkflowOptions): Promise<ScaffoldResult>;
|
|
83
|
+
//# sourceMappingURL=scaffold-ci-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold-ci-workflow.d.ts","sourceRoot":"","sources":["../../src/lib/scaffold-ci-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACf,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,KAAK,UAAU,EAAiB,MAAM,kBAAkB,CAAC;AAMlE,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAkFD;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,CAAC,EAAE,yBAAyB,GAC/B,OAAO,CAAC,MAAM,CAAC,CAgDjB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,CAAC,EAAE,yBAAyB,GAC/B,OAAO,CAAC,cAAc,CAAC,CAsDzB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Library for `codebyplan scaffold-publish-workflow`.
|
|
3
|
+
*
|
|
4
|
+
* Reads `templates/github-workflows/publish.yml` from this package's templates
|
|
5
|
+
* directory and writes it to `{projectDir}/.github/workflows/publish.yml`.
|
|
6
|
+
*
|
|
7
|
+
* Idempotent:
|
|
8
|
+
* - If the target file is byte-identical to the template → returns `skipped`.
|
|
9
|
+
* - If the target exists but differs and `force` is false → throws an error.
|
|
10
|
+
* - If `dryRun` is true → returns `dry_run` without writing.
|
|
11
|
+
*/
|
|
12
|
+
export interface ScaffoldOptions {
|
|
13
|
+
/** If true, compute the operation but do NOT write any files. */
|
|
14
|
+
dryRun?: boolean;
|
|
15
|
+
/** If true, overwrite an existing file that differs from the template. */
|
|
16
|
+
force?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Override the templates directory (used in tests to inject a fixture).
|
|
19
|
+
* When omitted, resolveTemplatesDir() is used.
|
|
20
|
+
*/
|
|
21
|
+
templatesDir?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Override the project root directory (used in tests, or when the CLI is
|
|
24
|
+
* run from a different directory than the target project).
|
|
25
|
+
* When omitted, process.cwd() is used.
|
|
26
|
+
*/
|
|
27
|
+
projectDir?: string;
|
|
28
|
+
}
|
|
29
|
+
export type ScaffoldResult = {
|
|
30
|
+
status: "written";
|
|
31
|
+
path: string;
|
|
32
|
+
} | {
|
|
33
|
+
status: "skipped";
|
|
34
|
+
path: string;
|
|
35
|
+
reason: string;
|
|
36
|
+
} | {
|
|
37
|
+
status: "dry_run";
|
|
38
|
+
path: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Scaffold the publish-on-main GitHub Actions workflow into the target project.
|
|
42
|
+
*
|
|
43
|
+
* @throws {Error} If the template file is missing.
|
|
44
|
+
* @throws {Error} If the target file exists, differs from the template, and
|
|
45
|
+
* `force` is false.
|
|
46
|
+
*/
|
|
47
|
+
export declare function runScaffoldPublishWorkflow(opts?: ScaffoldOptions): Promise<ScaffoldResult>;
|
|
48
|
+
//# sourceMappingURL=scaffold-publish-workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffold-publish-workflow.d.ts","sourceRoot":"","sources":["../../src/lib/scaffold-publish-workflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACnD;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAMxC;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,CAAC,EAAE,eAAe,GACrB,OAAO,CAAC,cAAc,CAAC,CAkEzB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface DetectedServer {
|
|
2
|
+
label: string;
|
|
3
|
+
port: number | null;
|
|
4
|
+
command: string;
|
|
5
|
+
server_type: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DetectionResult {
|
|
8
|
+
name: string;
|
|
9
|
+
isMonorepo: boolean;
|
|
10
|
+
packageManager: string;
|
|
11
|
+
servers: DetectedServer[];
|
|
12
|
+
}
|
|
13
|
+
export declare function detectFramework(pkg: Record<string, unknown>): string;
|
|
14
|
+
export declare function detectPortFromScripts(pkg: Record<string, unknown>): number | null;
|
|
15
|
+
/**
|
|
16
|
+
* Detect dev servers for a project by scanning package.json files.
|
|
17
|
+
* Mirrors the Rust `scan_repo` logic from the desktop app.
|
|
18
|
+
*/
|
|
19
|
+
export declare function detectServers(projectPath: string): Promise<DetectionResult>;
|
|
20
|
+
//# sourceMappingURL=server-detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-detect.d.ts","sourceRoot":"","sources":["../../src/lib/server-detect.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAmBD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAYpE;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC3B,MAAM,GAAG,IAAI,CAef;AASD;;;GAGG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC,CA4E1B"}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure lib for session lifecycle helpers.
|
|
3
|
+
*
|
|
4
|
+
* Replicates the deterministic parts of cbp-session-start / cbp-session-end
|
|
5
|
+
* into the CLI so the behaviour is testable, versionable, and available in
|
|
6
|
+
* every consumer repo via the codebyplan npm package.
|
|
7
|
+
*
|
|
8
|
+
* All public functions accept injectable deps so tests never hit the real
|
|
9
|
+
* filesystem, git, or npm registry. No top-level side effects.
|
|
10
|
+
*/
|
|
11
|
+
export type HomeFfResult = {
|
|
12
|
+
result: "skipped";
|
|
13
|
+
reason: string;
|
|
14
|
+
} | {
|
|
15
|
+
result: "warn";
|
|
16
|
+
warn: string;
|
|
17
|
+
} | {
|
|
18
|
+
result: "fast_forwarded";
|
|
19
|
+
};
|
|
20
|
+
export interface HomeFfOpts {
|
|
21
|
+
cwd?: string;
|
|
22
|
+
/** Override git runner. Signature: (cmd, args, cwd?) => stdout */
|
|
23
|
+
run?: (cmd: string, args: string[], cwd?: string) => string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Fast-forward the home branch to origin/<production>.
|
|
27
|
+
*
|
|
28
|
+
* Replicates cbp-session-start Step 1.4 / cbp-session-end equivalent.
|
|
29
|
+
*
|
|
30
|
+
* - Reads production branch via readGitConfig (imported from ./supabase).
|
|
31
|
+
* - FOLDER = basename of git rev-parse --show-toplevel.
|
|
32
|
+
* - CURRENT = git rev-parse --abbrev-ref HEAD.
|
|
33
|
+
* - CURRENT !== FOLDER → skipped (no fetch attempted).
|
|
34
|
+
* - CURRENT === FOLDER → git fetch origin <production>, then git merge --ff-only.
|
|
35
|
+
*
|
|
36
|
+
* NEVER rebases, resets, or stashes.
|
|
37
|
+
*/
|
|
38
|
+
export declare function homeFf(opts?: HomeFfOpts): HomeFfResult;
|
|
39
|
+
/**
|
|
40
|
+
* Shape returned by probing the version-status command.
|
|
41
|
+
* Mirrors the JSON output of `codebyplan version-status`.
|
|
42
|
+
*/
|
|
43
|
+
export interface VersionStatusProbe {
|
|
44
|
+
installed: string;
|
|
45
|
+
latest: string | null;
|
|
46
|
+
newer: boolean;
|
|
47
|
+
packageManager: string;
|
|
48
|
+
installCommand: string;
|
|
49
|
+
guarded: boolean;
|
|
50
|
+
guardReason: string | null;
|
|
51
|
+
}
|
|
52
|
+
export type FreshnessGateResult = {
|
|
53
|
+
result: "skipped";
|
|
54
|
+
reason: string;
|
|
55
|
+
} | {
|
|
56
|
+
result: "guarded";
|
|
57
|
+
} | {
|
|
58
|
+
result: "up_to_date";
|
|
59
|
+
} | {
|
|
60
|
+
result: "updated";
|
|
61
|
+
latest: string;
|
|
62
|
+
changed_files: string[];
|
|
63
|
+
halt: boolean;
|
|
64
|
+
} | {
|
|
65
|
+
result: "error";
|
|
66
|
+
reason: string;
|
|
67
|
+
};
|
|
68
|
+
export interface FreshnessGateOpts {
|
|
69
|
+
cwd?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Probe the version status. Defaults to running the current CLI's
|
|
72
|
+
* version-status logic via the imported helpers. Injected in tests.
|
|
73
|
+
*/
|
|
74
|
+
probeVersionStatus?: (cwd: string) => VersionStatusProbe | null;
|
|
75
|
+
/**
|
|
76
|
+
* Run the package-manager install command (e.g. "pnpm add codebyplan@latest").
|
|
77
|
+
* Injected in tests.
|
|
78
|
+
*/
|
|
79
|
+
runInstall?: (installCommand: string, cwd: string) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Run `npx codebyplan claude update --yes` equivalent.
|
|
82
|
+
* Injected in tests.
|
|
83
|
+
*/
|
|
84
|
+
runClaudeUpdate?: (cwd: string) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Run git status --porcelain to list changed files.
|
|
87
|
+
* Injected in tests.
|
|
88
|
+
*/
|
|
89
|
+
runGitStatus?: (cwd: string) => string;
|
|
90
|
+
/**
|
|
91
|
+
* When true, the output includes `halt: true` so the calling skill knows
|
|
92
|
+
* to stop the session after an update (session-start behaviour).
|
|
93
|
+
* When false (default — session-end behaviour), `halt` is false.
|
|
94
|
+
*/
|
|
95
|
+
haltOnUpdate?: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Spawn `npx codebyplan version-status` and parse its JSON output.
|
|
99
|
+
* Returns null when the command fails or emits non-JSON.
|
|
100
|
+
*/
|
|
101
|
+
export declare function spawnVersionStatus(cwd: string): VersionStatusProbe | null;
|
|
102
|
+
/**
|
|
103
|
+
* Gate that checks if codebyplan has a newer version and auto-updates when safe.
|
|
104
|
+
*
|
|
105
|
+
* Replicates cbp-session-start Step 1.6.
|
|
106
|
+
*/
|
|
107
|
+
export declare function freshnessGate(opts?: FreshnessGateOpts): Promise<FreshnessGateResult>;
|
|
108
|
+
export interface InfraFilesResult {
|
|
109
|
+
infra_files: string[];
|
|
110
|
+
task_files: string[];
|
|
111
|
+
note?: string;
|
|
112
|
+
}
|
|
113
|
+
export interface InfraFilesOpts {
|
|
114
|
+
cwd?: string;
|
|
115
|
+
/** Injectable git status runner — returns raw `git status --porcelain` output. */
|
|
116
|
+
run?: (cmd: string, args: string[], cwd?: string) => string;
|
|
117
|
+
/**
|
|
118
|
+
* Async resolver for the active-task round's files.
|
|
119
|
+
* Default returns [] (caller/skill passes --task-files instead).
|
|
120
|
+
*/
|
|
121
|
+
getTaskFiles?: () => Promise<string[]>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Compute infra_files = changed_files − task_files.
|
|
125
|
+
*
|
|
126
|
+
* Replicates cbp-session-start Step 5.7 set math.
|
|
127
|
+
*
|
|
128
|
+
* Algorithm:
|
|
129
|
+
* 1. git status --porcelain → changed_files; if empty → clean tree.
|
|
130
|
+
* 2. task_files = await getTaskFiles().
|
|
131
|
+
* 3. RE-RUN git status --porcelain (second run is authoritative —
|
|
132
|
+
* MCP round-trip race workaround; the first run races with any
|
|
133
|
+
* background MCP fetch; the second run is the stable read).
|
|
134
|
+
* 4. infra_files = fresh changed − task_files set.
|
|
135
|
+
*/
|
|
136
|
+
export declare function infraFiles(opts?: InfraFilesOpts): Promise<InfraFilesResult>;
|
|
137
|
+
export interface ResolveUserJsonResult {
|
|
138
|
+
user_id: string | null;
|
|
139
|
+
error_kind: string | null;
|
|
140
|
+
}
|
|
141
|
+
export interface ResolveUserJsonOpts {
|
|
142
|
+
cwd?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Injectable runner: (cmd, args, cwd?) => stdout.
|
|
145
|
+
* Injected in tests so no real subprocess is spawned.
|
|
146
|
+
*/
|
|
147
|
+
run?: (cmd: string, args: string[], cwd?: string) => string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Run `codebyplan whoami --json` and parse the structured output.
|
|
151
|
+
*
|
|
152
|
+
* CHK-225 retired worktree identity — concurrency is now USER-level via
|
|
153
|
+
* `assigned_user_id`. Caller identity comes from `codebyplan whoami --json`
|
|
154
|
+
* (`{ user_id, email }`); the removed `resolve-worktree` verb no longer exists.
|
|
155
|
+
*
|
|
156
|
+
* Returns `{ user_id: string|null, error_kind: string|null }`.
|
|
157
|
+
* Empty / `"null"` output (signed out) → `{ user_id: null, error_kind: 'tuple_miss' }`.
|
|
158
|
+
* On any internal error returns `{ user_id: null, error_kind: 'unhandled' }`
|
|
159
|
+
* and writes a one-line note to stderr.
|
|
160
|
+
*
|
|
161
|
+
* NEVER throws.
|
|
162
|
+
*/
|
|
163
|
+
export declare function resolveUserJson(opts?: ResolveUserJsonOpts): ResolveUserJsonResult;
|
|
164
|
+
export interface InfraDriftNudgeOpts {
|
|
165
|
+
cwd?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Injectable runner: (cmd, args, cwd?) => stdout.
|
|
168
|
+
* Injected in tests.
|
|
169
|
+
*/
|
|
170
|
+
run?: (cmd: string, args: string[], cwd?: string) => string;
|
|
171
|
+
/**
|
|
172
|
+
* Injectable fs-existence check for the monorepo marker files.
|
|
173
|
+
* Injected in tests to avoid real stat calls.
|
|
174
|
+
*/
|
|
175
|
+
existsSync?: (filePath: string) => boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Monorepo-only infra-drift nudge (Step 1.5 of cbp-session-start).
|
|
179
|
+
*
|
|
180
|
+
* Runs only when BOTH `scripts/infra-drift.mjs` and `packages/codebyplan-package/templates/`
|
|
181
|
+
* exist in the repo root. Best-effort: fetches origin/<production> then runs the drift script.
|
|
182
|
+
*
|
|
183
|
+
* Returns a single-line nudge string when drift is found, or `null` when clean/unavailable.
|
|
184
|
+
* NEVER throws.
|
|
185
|
+
*/
|
|
186
|
+
export declare function infraDriftNudge(opts?: InfraDriftNudgeOpts): string | null;
|
|
187
|
+
export interface ArchMapDriftNudgeOpts {
|
|
188
|
+
cwd?: string;
|
|
189
|
+
/**
|
|
190
|
+
* Injectable runner: (cmd, args, cwd?) => stdout.
|
|
191
|
+
* Injected in tests.
|
|
192
|
+
*/
|
|
193
|
+
run?: (cmd: string, args: string[], cwd?: string) => string;
|
|
194
|
+
/**
|
|
195
|
+
* Injectable fs-existence check for architecture.json.
|
|
196
|
+
* Injected in tests.
|
|
197
|
+
*/
|
|
198
|
+
existsSync?: (filePath: string) => boolean;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Architecture-map drift nudge (Step 1.55 of cbp-session-start).
|
|
202
|
+
*
|
|
203
|
+
* Returns a nudge string when N>0 drifted modules detected,
|
|
204
|
+
* or `null` when clean, absent manifest, or any error.
|
|
205
|
+
* NEVER throws.
|
|
206
|
+
*/
|
|
207
|
+
export declare function archMapDriftNudge(opts?: ArchMapDriftNudgeOpts): string | null;
|
|
208
|
+
export interface LspNudgeOpts {
|
|
209
|
+
cwd?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Injectable runner: (cmd, args, cwd?) => stdout.
|
|
212
|
+
* Injected in tests.
|
|
213
|
+
*/
|
|
214
|
+
run?: (cmd: string, args: string[], cwd?: string) => string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* LSP binary nudge (Step 1.7 of cbp-session-start).
|
|
218
|
+
*
|
|
219
|
+
* Runs `codebyplan lsp --check` and returns an array of non-empty output lines
|
|
220
|
+
* (one install hint per missing binary), or `[]` when clean.
|
|
221
|
+
* NEVER throws.
|
|
222
|
+
*/
|
|
223
|
+
export declare function lspNudge(opts?: LspNudgeOpts): string[];
|
|
224
|
+
export interface HandoffContext {
|
|
225
|
+
checkpoint_id?: string;
|
|
226
|
+
task_id?: string;
|
|
227
|
+
round_id?: string;
|
|
228
|
+
[key: string]: unknown;
|
|
229
|
+
}
|
|
230
|
+
export interface HandoffPayload {
|
|
231
|
+
command: string;
|
|
232
|
+
captured_at?: string;
|
|
233
|
+
context?: HandoffContext;
|
|
234
|
+
state?: unknown;
|
|
235
|
+
}
|
|
236
|
+
export interface SessionLogRow {
|
|
237
|
+
id?: string;
|
|
238
|
+
closed_at?: string | null;
|
|
239
|
+
content?: unknown;
|
|
240
|
+
updated_at?: string;
|
|
241
|
+
[key: string]: unknown;
|
|
242
|
+
}
|
|
243
|
+
export interface CheckpointRow {
|
|
244
|
+
id?: string;
|
|
245
|
+
assigned_user_id?: string | null;
|
|
246
|
+
updated_at?: string;
|
|
247
|
+
[key: string]: unknown;
|
|
248
|
+
}
|
|
249
|
+
export interface EntityRow {
|
|
250
|
+
updated_at?: string;
|
|
251
|
+
assigned_user_id?: string | null;
|
|
252
|
+
[key: string]: unknown;
|
|
253
|
+
}
|
|
254
|
+
export interface ProbeHandoffOpts {
|
|
255
|
+
repoRoot: string;
|
|
256
|
+
userId: string | null;
|
|
257
|
+
previousSessionRow: SessionLogRow | null;
|
|
258
|
+
freshnessWindowHours?: number;
|
|
259
|
+
/**
|
|
260
|
+
* Injectable entity-file reader — takes a file path and returns parsed JSON or null.
|
|
261
|
+
* Injected in tests to avoid real fs access.
|
|
262
|
+
*/
|
|
263
|
+
readEntity?: (filePath: string) => Promise<EntityRow | null>;
|
|
264
|
+
}
|
|
265
|
+
export type ProbeHandoffResult = {
|
|
266
|
+
fresh: true;
|
|
267
|
+
command: string;
|
|
268
|
+
context: HandoffContext;
|
|
269
|
+
state: unknown;
|
|
270
|
+
} | {
|
|
271
|
+
fresh: false;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Step 4.5 handoff freshness probe.
|
|
275
|
+
*
|
|
276
|
+
* Returns `{ fresh:true, command, context, state }` when the previous session's
|
|
277
|
+
* handoff payload is valid and fresh, or `{ fresh:false }` on any defensive gate
|
|
278
|
+
* or stale condition.
|
|
279
|
+
*
|
|
280
|
+
* NEVER throws — all failure paths return `{ fresh:false }`.
|
|
281
|
+
*/
|
|
282
|
+
export declare function probeHandoff(opts: ProbeHandoffOpts): Promise<ProbeHandoffResult>;
|
|
283
|
+
export interface CheckpointSummary {
|
|
284
|
+
id: string;
|
|
285
|
+
title: string;
|
|
286
|
+
}
|
|
287
|
+
export interface OwnershipPartition {
|
|
288
|
+
owned: CheckpointSummary[];
|
|
289
|
+
cross: CheckpointSummary[];
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* PURE. Partition checkpoint rows into owned-by-you vs other-users.
|
|
293
|
+
*
|
|
294
|
+
* owned = chk.assigned_user_id is null (open) OR chk.assigned_user_id === userId.
|
|
295
|
+
* cross = chk.assigned_user_id is non-null AND !== userId.
|
|
296
|
+
*
|
|
297
|
+
* @param checkpoints Array of checkpoint-like objects with id, title, assigned_user_id.
|
|
298
|
+
* @param userId The caller's user ID (may be null when signed out).
|
|
299
|
+
*/
|
|
300
|
+
export declare function partitionOwnership(checkpoints: Array<{
|
|
301
|
+
id?: string;
|
|
302
|
+
title?: string;
|
|
303
|
+
number?: number;
|
|
304
|
+
assigned_user_id?: string | null;
|
|
305
|
+
[key: string]: unknown;
|
|
306
|
+
}>, userId: string | null): OwnershipPartition;
|
|
307
|
+
export type NextAction = "mcp_update_halt" | "resume_handoff" | "commit_then_todo" | "trigger_todo" | "stop";
|
|
308
|
+
export interface ComputeNextActionInput {
|
|
309
|
+
status: string;
|
|
310
|
+
owned_count: number;
|
|
311
|
+
total_count: number;
|
|
312
|
+
handoff_fresh: boolean;
|
|
313
|
+
infra_files_count: number;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* PURE. Compute the session's next action from the envelope status and ownership data.
|
|
317
|
+
*
|
|
318
|
+
* Priority order:
|
|
319
|
+
* 1. update_halt → mcp_update_halt
|
|
320
|
+
* 2. handoff_fresh → resume_handoff
|
|
321
|
+
* 3. infra_files_count > 0 && owned_count >= 1 → commit_then_todo
|
|
322
|
+
* 4. owned_count >= 1 → trigger_todo
|
|
323
|
+
* 5. total_count >= 1 && owned_count === 0 → stop
|
|
324
|
+
* 6. total_count === 0 → trigger_todo
|
|
325
|
+
*/
|
|
326
|
+
export declare function computeNextAction(input: ComputeNextActionInput): NextAction;
|
|
327
|
+
export interface SessionStartEnvelope {
|
|
328
|
+
status: "ok" | "update_halt";
|
|
329
|
+
session_log_id: string | null;
|
|
330
|
+
user_id: string | null;
|
|
331
|
+
user_error_kind: string | null;
|
|
332
|
+
infra_drift_nudge: string | null;
|
|
333
|
+
arch_map_nudge: string | null;
|
|
334
|
+
lsp_nudges: string[];
|
|
335
|
+
handoff: {
|
|
336
|
+
fresh: boolean;
|
|
337
|
+
command?: string;
|
|
338
|
+
context?: HandoffContext;
|
|
339
|
+
state?: unknown;
|
|
340
|
+
};
|
|
341
|
+
infra_files_to_commit: string[];
|
|
342
|
+
owned_checkpoints: CheckpointSummary[];
|
|
343
|
+
cross_checkpoints: CheckpointSummary[];
|
|
344
|
+
owned_count: number;
|
|
345
|
+
total_count: number;
|
|
346
|
+
next_action: NextAction;
|
|
347
|
+
rendered_block: string;
|
|
348
|
+
previous_session: {
|
|
349
|
+
title?: string;
|
|
350
|
+
summary?: string;
|
|
351
|
+
pending?: string;
|
|
352
|
+
} | null;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* PURE. Produce the Step 6 output text block from a SessionStartEnvelope.
|
|
356
|
+
*
|
|
357
|
+
* Mirrors the Step 6 template in the SKILL.md exactly:
|
|
358
|
+
* Session active | User: [user_id or "not signed in"]
|
|
359
|
+
* [whoami distress line — only when error_kind non-null && != tuple_miss]
|
|
360
|
+
* [infra drift nudge]
|
|
361
|
+
* [arch map nudge]
|
|
362
|
+
* Previous session: [title or "none"]
|
|
363
|
+
* Pending: [pending or "—"]
|
|
364
|
+
* Ownership: N active CHK(s), M owned by you
|
|
365
|
+
* [Owned: ... — only when owned_count > 0]
|
|
366
|
+
* [Other users: ... — only when cross > 0]
|
|
367
|
+
* [LSP: <hint> — one per line]
|
|
368
|
+
* [⚠ Not signed in ... — only when user_id null and no distress shown]
|
|
369
|
+
*/
|
|
370
|
+
export declare function renderBlock(envelope: SessionStartEnvelope): string;
|
|
371
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/lib/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA+BH,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAEjC,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,IAAI,GAAE,UAAe,GAAG,YAAY,CAwD1D;AAMD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,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