dsh-pstack 0.1.0 → 0.2.0-beta.3
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/LICENSE +2 -3
- package/README.md +174 -148
- package/README.zh.md +185 -0
- package/assets/logo.png +0 -0
- package/cordis.patch.yml +103 -14
- package/dist/host-contract-CUPSpeNk.d.mts +22 -0
- package/dist/index.d.mts +87 -14
- package/dist/index.mjs +370 -143
- package/dist/models.d.mts +44 -0
- package/dist/models.mjs +201 -0
- package/dist/paths-BT77khwm.mjs +48 -0
- package/dist/{LICENSE → pstack/LICENSE} +1 -2
- package/dist/pstack/README.md +291 -0
- package/{assets → dist/pstack}/agents/comment-sicko.md +1 -1
- package/dist/pstack/agents/poteto-agent.md +9 -0
- package/{assets → dist/pstack}/docs/guide/01-setup.md +11 -9
- package/dist/{assets → pstack}/docs/guide/02-poteto-mode.md +2 -2
- package/{assets → dist/pstack}/docs/guide/04-design.md +4 -4
- package/dist/{assets → pstack}/docs/guide/05-build-and-clean.md +3 -3
- package/dist/{assets → pstack}/docs/guide/06-verify-and-ship.md +11 -1
- package/{assets → dist/pstack}/docs/guide/07-overnight.md +10 -10
- package/dist/{assets → pstack}/docs/guide/09-make-it-yours.md +4 -4
- package/{assets → dist/pstack}/docs/guide/10-recipes-and-pitfalls.md +6 -4
- package/dist/pstack/docs/guide/images/design.jpg +0 -0
- package/dist/pstack/docs/guide/images/overnight.jpg +0 -0
- package/dist/pstack/docs/guide/images/recipes.jpg +0 -0
- package/dist/pstack/docs/guide/images/router.jpg +0 -0
- package/dist/pstack/docs/guide/images/understanding.jpg +0 -0
- package/dist/pstack/docs/guide/images/verification.jpg +0 -0
- package/dist/pstack/docs/harness/dsh.md +98 -0
- package/{assets → dist/pstack}/skills/architect/SKILL.md +5 -5
- package/dist/pstack/skills/arena/SKILL.md +50 -0
- package/{assets → dist/pstack}/skills/automate-me/SKILL.md +14 -13
- package/dist/{assets → pstack}/skills/benchmark-checklist/SKILL.md +1 -3
- package/dist/{assets → pstack}/skills/blast-radius/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/bro/SKILL.md +0 -2
- package/dist/{assets → pstack}/skills/correct/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/create-formal-verification-skill/SKILL.md +5 -3
- package/{assets → dist/pstack}/skills/create-verification-skill/SKILL.md +6 -6
- package/{assets → dist/pstack}/skills/figure-it-out/SKILL.md +4 -4
- package/dist/{assets → pstack}/skills/how/SKILL.md +4 -4
- package/{assets → dist/pstack}/skills/how/references/explainer-prompt.md +1 -1
- package/dist/pstack/skills/in-your-own-words/SKILL.md +7 -0
- package/dist/pstack/skills/interrogate/SKILL.md +33 -0
- package/{assets → dist/pstack}/skills/ketchup/SKILL.md +1 -3
- package/dist/pstack/skills/ketchup-video/SKILL.md +29 -0
- package/{assets → dist/pstack}/skills/maintain-formal-verification-skill/SKILL.md +2 -2
- package/dist/{assets → pstack}/skills/maintain-verification-skill/SKILL.md +3 -3
- package/dist/pstack/skills/make-bot-ui/SKILL.md +117 -0
- package/{assets → dist/pstack}/skills/no-comments/SKILL.md +4 -4
- package/{assets → dist/pstack}/skills/poteto-help/SKILL.md +21 -17
- package/dist/{assets → pstack}/skills/poteto-help/references/prompting.md +1 -1
- package/dist/{assets → pstack}/skills/poteto-help/references/recipes.md +3 -3
- package/{assets → dist/pstack}/skills/poteto-mode/SKILL.md +20 -21
- package/dist/{assets → pstack}/skills/poteto-mode/playbooks/authoring-a-skill.md +1 -1
- package/dist/{assets → pstack}/skills/poteto-mode/playbooks/autonomous-run.md +2 -2
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/autopilot-full.md +7 -7
- package/dist/pstack/skills/poteto-mode/playbooks/autopilot-stack.md +8 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/babysit.md +3 -3
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/bug-fix.md +3 -3
- package/dist/{assets → pstack}/skills/poteto-mode/playbooks/eval.md +1 -1
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/feature.md +1 -1
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/hillclimb.md +1 -1
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/multi-phase-plan.md +13 -13
- package/dist/{assets → pstack}/skills/poteto-mode/playbooks/opening-a-pr.md +3 -3
- package/dist/pstack/skills/poteto-mode/playbooks/orchestrate.md +25 -0
- package/dist/{assets → pstack}/skills/poteto-mode/playbooks/perf-issue.md +2 -2
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/prototype.md +1 -1
- package/dist/{assets → pstack}/skills/poteto-mode/playbooks/refactoring.md +2 -2
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/runtime-forensics.md +1 -1
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/session-pickup.md +1 -1
- package/dist/{assets → pstack}/skills/poteto-mode/playbooks/shipping.md +2 -2
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/visual-parity.md +1 -1
- package/dist/{assets → pstack}/skills/poteto-mode/playbooks/worktree-cleanup.md +2 -2
- package/{assets → dist/pstack}/skills/poteto-mode/scripts/check-plan.mjs +83 -70
- package/dist/{assets/skills/poteto-mode/scripts/check-plan.test.ts → pstack/skills/poteto-mode/scripts/check-plan.test.mjs} +53 -21
- package/dist/pstack/skills/poteto-mode/scripts/expect.mjs +254 -0
- package/dist/pstack/skills/poteto-mode/scripts/support.mjs +93 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.mjs +123 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +217 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.mjs +119 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.mjs +626 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.test.mjs +521 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.mjs +657 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +523 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/render.mjs +106 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/types.mjs +9 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +5 -0
- package/dist/pstack/skills/poteto-mode/scripts/worktree-audit.mjs +668 -0
- package/dist/pstack/skills/poteto-mode/scripts/worktree-audit.test.mjs +134 -0
- package/{assets → dist/pstack}/skills/principle-attack-the-premise/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-boundary-discipline/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-build-the-lever/SKILL.md +0 -3
- package/dist/pstack/skills/principle-encode-lessons-in-structure/SKILL.md +11 -0
- package/dist/pstack/skills/principle-exhaust-the-design-space/SKILL.md +9 -0
- package/{assets → dist/pstack}/skills/principle-experience-first/SKILL.md +1 -3
- package/dist/{assets → pstack}/skills/principle-explain-the-number/SKILL.md +3 -4
- package/dist/{assets → pstack}/skills/principle-fix-root-causes/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-foundational-thinking/SKILL.md +0 -2
- package/dist/{assets → pstack}/skills/principle-guard-the-context-window/SKILL.md +0 -2
- package/dist/{assets → pstack}/skills/principle-laziness-protocol/SKILL.md +1 -3
- package/dist/{assets → pstack}/skills/principle-make-operations-idempotent/SKILL.md +1 -3
- package/dist/{assets → pstack}/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-minimize-reader-load/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-model-the-domain/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-never-block-on-the-human/SKILL.md +1 -3
- package/dist/{assets → pstack}/skills/principle-outcome-oriented-execution/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-prove-it-works/SKILL.md +3 -3
- package/dist/{assets → pstack}/skills/principle-redesign-from-first-principles/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-separate-before-serializing-shared-state/SKILL.md +1 -3
- package/dist/{assets → pstack}/skills/principle-sequence-verifiable-units/SKILL.md +1 -3
- package/dist/{assets → pstack}/skills/principle-subtract-before-you-add/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-test-behavior-not-implementation/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/principle-type-system-discipline/SKILL.md +1 -3
- package/dist/{assets → pstack}/skills/recall/SKILL.md +4 -4
- package/dist/pstack/skills/reflect/SKILL.md +71 -0
- package/{assets → dist/pstack}/skills/reflect/references/divergent-reviewer.md +1 -1
- package/{assets → dist/pstack}/skills/reflect/references/judgment-reviewer.md +1 -1
- package/{assets → dist/pstack}/skills/reflect/references/synthesizer.md +3 -3
- package/dist/{assets → pstack}/skills/reflect/references/tooling-reviewer.md +1 -1
- package/dist/pstack/skills/setup-pstack/SKILL.md +80 -0
- package/{assets → dist/pstack}/skills/sharpen/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/show-me-your-work/SKILL.md +3 -3
- package/dist/pstack/skills/show-me-your-work/scripts/log.mjs +106 -0
- package/dist/pstack/skills/show-me-your-work/scripts/log.test.mjs +56 -0
- package/dist/pstack/skills/statechart/SKILL.md +82 -0
- package/dist/pstack/skills/statechart/references/render.md +93 -0
- package/dist/pstack/skills/statechart/scripts/backends/cfg.mjs +31 -0
- package/dist/pstack/skills/statechart/scripts/backends/mermaid.mjs +186 -0
- package/dist/pstack/skills/statechart/scripts/backends/plain-text.mjs +62 -0
- package/dist/pstack/skills/statechart/scripts/backends/report.mjs +84 -0
- package/dist/pstack/skills/statechart/scripts/frontends/config.mjs +268 -0
- package/dist/pstack/skills/statechart/scripts/frontends/dot.mjs +67 -0
- package/dist/pstack/skills/statechart/scripts/frontends/marks.mjs +94 -0
- package/dist/pstack/skills/statechart/scripts/frontends/messages.mjs +48 -0
- package/dist/pstack/skills/statechart/scripts/frontends/spec.mjs +101 -0
- package/dist/pstack/skills/statechart/scripts/frontends/trace.mjs +39 -0
- package/dist/pstack/skills/statechart/scripts/frontends/value.mjs +180 -0
- package/dist/pstack/skills/statechart/scripts/frontends/verdict.mjs +40 -0
- package/dist/pstack/skills/statechart/scripts/frontends/view.mjs +99 -0
- package/dist/pstack/skills/statechart/scripts/ir.mjs +277 -0
- package/dist/pstack/skills/statechart/scripts/passes/annotate.mjs +92 -0
- package/dist/pstack/skills/statechart/scripts/passes/label.mjs +210 -0
- package/dist/pstack/skills/statechart/scripts/passes/lift.mjs +84 -0
- package/dist/pstack/skills/statechart/scripts/passes/loop-check.mjs +47 -0
- package/dist/pstack/skills/statechart/scripts/passes/paths.mjs +72 -0
- package/dist/pstack/skills/statechart/scripts/passes/reach.mjs +135 -0
- package/dist/pstack/skills/statechart/scripts/passes/region-check.mjs +82 -0
- package/dist/pstack/skills/statechart/scripts/passes/regions.mjs +268 -0
- package/dist/pstack/skills/statechart/scripts/pipeline.mjs +72 -0
- package/dist/pstack/skills/statechart/scripts/run.mjs +440 -0
- package/dist/pstack/skills/statechart/scripts/statechart.mjs +155 -0
- package/dist/pstack/skills/statechart/scripts/statechart.test.mjs +198 -0
- package/dist/pstack/skills/statechart/scripts/worker.mjs +31 -0
- package/dist/pstack/skills/swarm/SKILL.md +43 -0
- package/{assets → dist/pstack}/skills/tdd/SKILL.md +1 -3
- package/{assets → dist/pstack}/skills/teach/SKILL.md +3 -3
- package/{assets → dist/pstack}/skills/technical-writing/SKILL.md +2 -2
- package/{assets → dist/pstack}/skills/typescript-best-practices/SKILL.md +1 -2
- package/{assets → dist/pstack}/skills/unslop/SKILL.md +0 -2
- package/dist/{assets → pstack}/skills/why/SKILL.md +9 -9
- package/dist/script.d.mts +91 -0
- package/dist/script.mjs +485 -0
- package/dist/skill.d.mts +38 -0
- package/dist/skill.mjs +183 -0
- package/dist/skills/authored/decision-audit/SKILL.md +99 -0
- package/dist/skills/authored/decision-audit/SKILL.zh.md +99 -0
- package/dist/skills/authored/decision-audit/references/recover-commit.md +17 -0
- package/dist/skills/authored/decision-audit/references/recover-commit.zh.md +17 -0
- package/dist/skills/authored/decision-write/SKILL.md +131 -0
- package/dist/skills/authored/decision-write/SKILL.zh.md +131 -0
- package/dist/skills/authored/decision-write/references/land.md +48 -0
- package/dist/skills/authored/decision-write/references/land.zh.md +48 -0
- package/dist/skills/authored/setup-project-docs/SKILL.md +58 -0
- package/dist/skills/authored/setup-project-docs/SKILL.zh.md +58 -0
- package/dist/skills/authored/setup-project-docs/references/decision-conventions.md +11 -0
- package/dist/skills/authored/setup-project-docs/references/decision-conventions.zh.md +11 -0
- package/dist/skills/vendored/retro/SKILL.md +44 -0
- package/dist/skills/vendored/retro/agents/openai.yaml +5 -0
- package/dist/skills/vendored/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/dist/skills/vendored/writing-for-agents/SKILL.md +81 -0
- package/dist/skills/vendored/writing-for-agents/agents/openai.yaml +3 -0
- package/dist/subagent.d.mts +175 -106
- package/dist/subagent.mjs +1012 -344
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +61 -50
- package/assets/agents/poteto-agent.md +0 -8
- package/assets/docs/guide/02-poteto-mode.md +0 -139
- package/assets/docs/guide/05-build-and-clean.md +0 -83
- package/assets/docs/guide/06-verify-and-ship.md +0 -152
- package/assets/docs/guide/09-make-it-yours.md +0 -100
- package/assets/docs/harness/dsh.md +0 -65
- package/assets/docs/pstack-models.example.md +0 -23
- package/assets/skills/arena/SKILL.md +0 -50
- package/assets/skills/benchmark-checklist/SKILL.md +0 -41
- package/assets/skills/blast-radius/SKILL.md +0 -52
- package/assets/skills/correct/SKILL.md +0 -34
- package/assets/skills/how/SKILL.md +0 -38
- package/assets/skills/in-your-own-words/SKILL.md +0 -9
- package/assets/skills/interrogate/SKILL.md +0 -69
- package/assets/skills/interrogate/references/code-quality-review.md +0 -47
- package/assets/skills/interrogate/references/lead-judgment.md +0 -39
- package/assets/skills/interrogate/references/reviewer-prompt.md +0 -62
- package/assets/skills/interrogate/references/rubric.md +0 -77
- package/assets/skills/maintain-verification-skill/SKILL.md +0 -41
- package/assets/skills/poteto-help/references/prompting.md +0 -51
- package/assets/skills/poteto-help/references/recipes.md +0 -51
- package/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +0 -12
- package/assets/skills/poteto-mode/playbooks/autonomous-run.md +0 -13
- package/assets/skills/poteto-mode/playbooks/autopilot-stack.md +0 -12
- package/assets/skills/poteto-mode/playbooks/eval.md +0 -25
- package/assets/skills/poteto-mode/playbooks/opening-a-pr.md +0 -34
- package/assets/skills/poteto-mode/playbooks/orchestrate.md +0 -112
- package/assets/skills/poteto-mode/playbooks/perf-issue.md +0 -25
- package/assets/skills/poteto-mode/playbooks/refactoring.md +0 -16
- package/assets/skills/poteto-mode/playbooks/shipping.md +0 -12
- package/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +0 -12
- package/assets/skills/poteto-mode/scripts/bootstrap.ts +0 -62
- package/assets/skills/poteto-mode/scripts/bun.lock +0 -67
- package/assets/skills/poteto-mode/scripts/check-plan.test.ts +0 -96
- package/assets/skills/poteto-mode/scripts/orch/orch.test.ts +0 -761
- package/assets/skills/poteto-mode/scripts/orch/orch.ts +0 -590
- package/assets/skills/poteto-mode/scripts/orch/store.ts +0 -1677
- package/assets/skills/poteto-mode/scripts/package.json +0 -16
- package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.ts +0 -224
- package/assets/skills/poteto-mode/scripts/watch-pr/cli.ts +0 -223
- package/assets/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +0 -129
- package/assets/skills/poteto-mode/scripts/watch-pr/github.test.ts +0 -436
- package/assets/skills/poteto-mode/scripts/watch-pr/github.ts +0 -718
- package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.ts +0 -420
- package/assets/skills/poteto-mode/scripts/watch-pr/policy.ts +0 -836
- package/assets/skills/poteto-mode/scripts/watch-pr/render.ts +0 -169
- package/assets/skills/poteto-mode/scripts/watch-pr/tsconfig.json +0 -13
- package/assets/skills/poteto-mode/scripts/watch-pr/types.compile.ts +0 -93
- package/assets/skills/poteto-mode/scripts/watch-pr/types.ts +0 -413
- package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr +0 -6
- package/assets/skills/poteto-mode/scripts/worktree-audit.sh +0 -127
- package/assets/skills/principle-encode-lessons-in-structure/SKILL.md +0 -13
- package/assets/skills/principle-exhaust-the-design-space/SKILL.md +0 -11
- package/assets/skills/principle-explain-the-number/SKILL.md +0 -19
- package/assets/skills/principle-fix-root-causes/SKILL.md +0 -23
- package/assets/skills/principle-guard-the-context-window/SKILL.md +0 -14
- package/assets/skills/principle-laziness-protocol/SKILL.md +0 -12
- package/assets/skills/principle-make-operations-idempotent/SKILL.md +0 -24
- package/assets/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +0 -16
- package/assets/skills/principle-outcome-oriented-execution/SKILL.md +0 -23
- package/assets/skills/principle-redesign-from-first-principles/SKILL.md +0 -18
- package/assets/skills/principle-sequence-verifiable-units/SKILL.md +0 -19
- package/assets/skills/principle-subtract-before-you-add/SKILL.md +0 -20
- package/assets/skills/recall/SKILL.md +0 -37
- package/assets/skills/reflect/SKILL.md +0 -70
- package/assets/skills/reflect/references/tooling-reviewer.md +0 -48
- package/assets/skills/setup-pstack/SKILL.md +0 -76
- package/assets/skills/show-me-your-work/scripts/log.sh +0 -42
- package/assets/skills/swarm/SKILL.md +0 -41
- package/assets/skills/why/SKILL.md +0 -100
- package/dist/README.md +0 -159
- package/dist/assets/agents/comment-sicko.md +0 -32
- package/dist/assets/agents/poteto-agent.md +0 -8
- package/dist/assets/docs/guide/01-setup.md +0 -64
- package/dist/assets/docs/guide/03-understand.md +0 -79
- package/dist/assets/docs/guide/04-design.md +0 -133
- package/dist/assets/docs/guide/07-overnight.md +0 -122
- package/dist/assets/docs/guide/08-principles.md +0 -72
- package/dist/assets/docs/guide/10-recipes-and-pitfalls.md +0 -180
- package/dist/assets/docs/guide/README.md +0 -38
- package/dist/assets/docs/harness/dsh.md +0 -65
- package/dist/assets/docs/pstack-models.example.md +0 -23
- package/dist/assets/skills/architect/SKILL.md +0 -81
- package/dist/assets/skills/architect/references/design-red-flags.md +0 -57
- package/dist/assets/skills/architect/references/rationale-template.md +0 -35
- package/dist/assets/skills/architect/references/runner-prompt.md +0 -20
- package/dist/assets/skills/arena/SKILL.md +0 -50
- package/dist/assets/skills/automate-me/SKILL.md +0 -105
- package/dist/assets/skills/bro/SKILL.md +0 -9
- package/dist/assets/skills/create-formal-verification-skill/SKILL.md +0 -43
- package/dist/assets/skills/create-verification-skill/SKILL.md +0 -46
- package/dist/assets/skills/create-verification-skill/references/feature-map-example/README.md +0 -47
- package/dist/assets/skills/create-verification-skill/references/feature-map-example/create-note.md +0 -39
- package/dist/assets/skills/create-verification-skill/references/feature-map-example/search.md +0 -45
- package/dist/assets/skills/figure-it-out/SKILL.md +0 -54
- package/dist/assets/skills/how/references/explainer-prompt.md +0 -55
- package/dist/assets/skills/how/references/explorer-prompt.md +0 -35
- package/dist/assets/skills/in-your-own-words/SKILL.md +0 -9
- package/dist/assets/skills/interrogate/SKILL.md +0 -69
- package/dist/assets/skills/interrogate/references/code-quality-review.md +0 -47
- package/dist/assets/skills/interrogate/references/lead-judgment.md +0 -39
- package/dist/assets/skills/interrogate/references/reviewer-prompt.md +0 -62
- package/dist/assets/skills/interrogate/references/rubric.md +0 -77
- package/dist/assets/skills/ketchup/SKILL.md +0 -45
- package/dist/assets/skills/maintain-formal-verification-skill/SKILL.md +0 -60
- package/dist/assets/skills/no-comments/SKILL.md +0 -26
- package/dist/assets/skills/poteto-help/SKILL.md +0 -161
- package/dist/assets/skills/poteto-mode/SKILL.md +0 -153
- package/dist/assets/skills/poteto-mode/playbooks/autopilot-full.md +0 -25
- package/dist/assets/skills/poteto-mode/playbooks/autopilot-stack.md +0 -12
- package/dist/assets/skills/poteto-mode/playbooks/babysit.md +0 -23
- package/dist/assets/skills/poteto-mode/playbooks/bug-fix.md +0 -15
- package/dist/assets/skills/poteto-mode/playbooks/feature.md +0 -21
- package/dist/assets/skills/poteto-mode/playbooks/hillclimb.md +0 -21
- package/dist/assets/skills/poteto-mode/playbooks/investigation.md +0 -14
- package/dist/assets/skills/poteto-mode/playbooks/multi-phase-plan.md +0 -155
- package/dist/assets/skills/poteto-mode/playbooks/orchestrate.md +0 -112
- package/dist/assets/skills/poteto-mode/playbooks/pause-safely.md +0 -10
- package/dist/assets/skills/poteto-mode/playbooks/prototype.md +0 -14
- package/dist/assets/skills/poteto-mode/playbooks/runtime-forensics.md +0 -11
- package/dist/assets/skills/poteto-mode/playbooks/session-pickup.md +0 -11
- package/dist/assets/skills/poteto-mode/playbooks/trace-forensics.md +0 -14
- package/dist/assets/skills/poteto-mode/playbooks/visual-parity.md +0 -11
- package/dist/assets/skills/poteto-mode/references/bugbot-triage.md +0 -142
- package/dist/assets/skills/poteto-mode/scripts/bootstrap.ts +0 -62
- package/dist/assets/skills/poteto-mode/scripts/bun.lock +0 -67
- package/dist/assets/skills/poteto-mode/scripts/check-plan.mjs +0 -205
- package/dist/assets/skills/poteto-mode/scripts/orch/orch.test.ts +0 -761
- package/dist/assets/skills/poteto-mode/scripts/orch/orch.ts +0 -590
- package/dist/assets/skills/poteto-mode/scripts/orch/store.ts +0 -1677
- package/dist/assets/skills/poteto-mode/scripts/package.json +0 -16
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/cli.test.ts +0 -224
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/cli.ts +0 -223
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +0 -129
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/github.test.ts +0 -436
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/github.ts +0 -718
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/policy.test.ts +0 -420
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/policy.ts +0 -836
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/render.ts +0 -169
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/tsconfig.json +0 -13
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/types.compile.ts +0 -93
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/types.ts +0 -413
- package/dist/assets/skills/poteto-mode/scripts/watch-pr/watch-pr +0 -6
- package/dist/assets/skills/poteto-mode/scripts/worktree-audit.sh +0 -127
- package/dist/assets/skills/principle-attack-the-premise/SKILL.md +0 -23
- package/dist/assets/skills/principle-boundary-discipline/SKILL.md +0 -36
- package/dist/assets/skills/principle-build-the-lever/SKILL.md +0 -26
- package/dist/assets/skills/principle-encode-lessons-in-structure/SKILL.md +0 -13
- package/dist/assets/skills/principle-exhaust-the-design-space/SKILL.md +0 -11
- package/dist/assets/skills/principle-experience-first/SKILL.md +0 -21
- package/dist/assets/skills/principle-foundational-thinking/SKILL.md +0 -23
- package/dist/assets/skills/principle-minimize-reader-load/SKILL.md +0 -20
- package/dist/assets/skills/principle-model-the-domain/SKILL.md +0 -26
- package/dist/assets/skills/principle-never-block-on-the-human/SKILL.md +0 -17
- package/dist/assets/skills/principle-prove-it-works/SKILL.md +0 -24
- package/dist/assets/skills/principle-separate-before-serializing-shared-state/SKILL.md +0 -18
- package/dist/assets/skills/principle-test-behavior-not-implementation/SKILL.md +0 -22
- package/dist/assets/skills/principle-type-system-discipline/SKILL.md +0 -15
- package/dist/assets/skills/reflect/SKILL.md +0 -70
- package/dist/assets/skills/reflect/references/divergent-reviewer.md +0 -38
- package/dist/assets/skills/reflect/references/judgment-reviewer.md +0 -37
- package/dist/assets/skills/reflect/references/synthesizer.md +0 -56
- package/dist/assets/skills/setup-pstack/SKILL.md +0 -76
- package/dist/assets/skills/sharpen/SKILL.md +0 -18
- package/dist/assets/skills/show-me-your-work/SKILL.md +0 -84
- package/dist/assets/skills/show-me-your-work/references/decision-log-template.tsv +0 -1
- package/dist/assets/skills/show-me-your-work/scripts/log.sh +0 -42
- package/dist/assets/skills/swarm/SKILL.md +0 -41
- package/dist/assets/skills/tdd/SKILL.md +0 -44
- package/dist/assets/skills/teach/SKILL.md +0 -23
- package/dist/assets/skills/technical-writing/SKILL.md +0 -108
- package/dist/assets/skills/typescript-best-practices/SKILL.md +0 -32
- package/dist/assets/skills/typescript-best-practices/references/patterns.md +0 -328
- package/dist/assets/skills/unslop/SKILL.md +0 -64
- package/dist/assets/skills/why/references/epistemics.md +0 -71
- package/dist/assets/skills/why/references/investigator-prompt.md +0 -84
- package/dist/assets/skills/why/references/source-playbook.md +0 -17
- package/dist/assets/skills/why/references/sources/code-archaeology.md +0 -51
- package/dist/assets/skills/why/references/sources/databricks.md +0 -70
- package/dist/assets/skills/why/references/sources/datadog.md +0 -97
- package/dist/assets/skills/why/references/sources/incident-postmortem.md +0 -5
- package/dist/assets/skills/why/references/sources/linear.md +0 -48
- package/dist/assets/skills/why/references/sources/notion.md +0 -55
- package/dist/assets/skills/why/references/sources/sentry.md +0 -66
- package/dist/assets/skills/why/references/sources/slack.md +0 -17
- package/dist/assets/skills/why/references/synthesizer-prompt.md +0 -129
- package/dist/cordis.patch.yml +0 -20
- package/dist/index.mjs.map +0 -1
- package/dist/paths-Bbai4CaT.mjs +0 -16
- package/dist/paths-Bbai4CaT.mjs.map +0 -1
- package/dist/subagent.mjs.map +0 -1
- /package/{assets → dist/pstack}/docs/guide/03-understand.md +0 -0
- /package/{assets → dist/pstack}/docs/guide/08-principles.md +0 -0
- /package/{assets → dist/pstack}/docs/guide/README.md +0 -0
- /package/{assets → dist/pstack}/skills/architect/references/design-red-flags.md +0 -0
- /package/{assets → dist/pstack}/skills/architect/references/rationale-template.md +0 -0
- /package/{assets → dist/pstack}/skills/architect/references/runner-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/README.md +0 -0
- /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/create-note.md +0 -0
- /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/search.md +0 -0
- /package/{assets → dist/pstack}/skills/how/references/explorer-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/poteto-mode/playbooks/investigation.md +0 -0
- /package/{assets → dist/pstack}/skills/poteto-mode/playbooks/pause-safely.md +0 -0
- /package/{assets → dist/pstack}/skills/poteto-mode/playbooks/trace-forensics.md +0 -0
- /package/{assets → dist/pstack}/skills/poteto-mode/references/bugbot-triage.md +0 -0
- /package/{assets → dist/pstack}/skills/show-me-your-work/references/decision-log-template.tsv +0 -0
- /package/{assets → dist/pstack}/skills/typescript-best-practices/references/patterns.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/epistemics.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/investigator-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/source-playbook.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/code-archaeology.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/databricks.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/datadog.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/incident-postmortem.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/linear.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/notion.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/sentry.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/slack.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/synthesizer-prompt.md +0 -0
|
@@ -1,761 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it } from "bun:test";
|
|
2
|
-
import {
|
|
3
|
-
chmod,
|
|
4
|
-
mkdir,
|
|
5
|
-
mkdtemp,
|
|
6
|
-
readFile,
|
|
7
|
-
readdir,
|
|
8
|
-
rm,
|
|
9
|
-
writeFile,
|
|
10
|
-
} from "node:fs/promises";
|
|
11
|
-
import { realpathSync } from "node:fs";
|
|
12
|
-
import { tmpdir } from "node:os";
|
|
13
|
-
import { join } from "node:path";
|
|
14
|
-
import {
|
|
15
|
-
NotFoundError,
|
|
16
|
-
UserError,
|
|
17
|
-
openStore,
|
|
18
|
-
parseVerdict,
|
|
19
|
-
type Forge,
|
|
20
|
-
type OpenStoreOptions,
|
|
21
|
-
type Store,
|
|
22
|
-
} from "./store.ts";
|
|
23
|
-
|
|
24
|
-
const SCRIPT = join(import.meta.dir, "orch.ts");
|
|
25
|
-
const directories: string[] = [];
|
|
26
|
-
const handles: Store[] = [];
|
|
27
|
-
|
|
28
|
-
interface RunResult {
|
|
29
|
-
readonly code: number;
|
|
30
|
-
readonly stdout: string;
|
|
31
|
-
readonly stderr: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async function makeDirectory(): Promise<string> {
|
|
35
|
-
const directory = await mkdtemp(join(tmpdir(), "orch-test-"));
|
|
36
|
-
directories.push(directory);
|
|
37
|
-
return directory;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function useStore(
|
|
41
|
-
directory: string,
|
|
42
|
-
options?: OpenStoreOptions
|
|
43
|
-
): Store {
|
|
44
|
-
const store = openStore(directory, options);
|
|
45
|
-
handles.push(store);
|
|
46
|
-
return store;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function initializedStore(): Promise<{
|
|
50
|
-
readonly directory: string;
|
|
51
|
-
readonly store: Store;
|
|
52
|
-
}> {
|
|
53
|
-
const directory = await makeDirectory();
|
|
54
|
-
const store = useStore(directory);
|
|
55
|
-
await store.init();
|
|
56
|
-
return { directory, store };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function git({
|
|
60
|
-
args,
|
|
61
|
-
repo,
|
|
62
|
-
}: {
|
|
63
|
-
args: readonly string[];
|
|
64
|
-
repo: string;
|
|
65
|
-
}): string {
|
|
66
|
-
const result = Bun.spawnSync(["git", "-C", repo, ...args]);
|
|
67
|
-
if (result.exitCode !== 0) {
|
|
68
|
-
throw new Error(
|
|
69
|
-
`git ${args.join(" ")} failed: ${result.stderr.toString()}`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
return result.stdout.toString().trim();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async function makeGitStack(directory: string): Promise<{
|
|
76
|
-
readonly repo: string;
|
|
77
|
-
readonly mergedSha: string;
|
|
78
|
-
readonly closedSha: string;
|
|
79
|
-
readonly openSha: string;
|
|
80
|
-
readonly draftSha: string;
|
|
81
|
-
}> {
|
|
82
|
-
const repo = join(directory, "repo");
|
|
83
|
-
await mkdir(repo);
|
|
84
|
-
git({ repo, args: ["init", "--initial-branch=main"] });
|
|
85
|
-
git({ repo, args: ["config", "user.name", "Orch Test"] });
|
|
86
|
-
git({ repo, args: ["config", "user.email", "orch@example.com"] });
|
|
87
|
-
await writeFile(join(repo, "main.txt"), "main\n");
|
|
88
|
-
git({ repo, args: ["add", "."] });
|
|
89
|
-
git({ repo, args: ["commit", "-m", "main"] });
|
|
90
|
-
|
|
91
|
-
const branches = [
|
|
92
|
-
"stack/merged",
|
|
93
|
-
"stack/closed",
|
|
94
|
-
"stack/open",
|
|
95
|
-
"stack/draft",
|
|
96
|
-
];
|
|
97
|
-
for (const [index, branch] of branches.entries()) {
|
|
98
|
-
git({ repo, args: ["checkout", "-b", branch] });
|
|
99
|
-
await writeFile(join(repo, `stack-${index}.txt`), `${branch}\n`);
|
|
100
|
-
git({ repo, args: ["add", "."] });
|
|
101
|
-
git({ repo, args: ["commit", "-m", branch] });
|
|
102
|
-
}
|
|
103
|
-
git({ repo, args: ["checkout", "stack/open"] });
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
repo,
|
|
107
|
-
mergedSha: git({ repo, args: ["rev-parse", "stack/merged"] }),
|
|
108
|
-
closedSha: git({ repo, args: ["rev-parse", "stack/closed"] }),
|
|
109
|
-
openSha: git({ repo, args: ["rev-parse", "stack/open"] }),
|
|
110
|
-
draftSha: git({ repo, args: ["rev-parse", "stack/draft"] }),
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
type FixtureState = "open" | "draft" | "merged" | "closed";
|
|
115
|
-
|
|
116
|
-
const FORGE_FIXTURES: Readonly<
|
|
117
|
-
Record<
|
|
118
|
-
Forge,
|
|
119
|
-
{
|
|
120
|
-
readonly fields: string;
|
|
121
|
-
readonly row: (pr: {
|
|
122
|
-
number: number;
|
|
123
|
-
state: FixtureState;
|
|
124
|
-
head: string;
|
|
125
|
-
base: string;
|
|
126
|
-
}) => Record<string, unknown>;
|
|
127
|
-
}
|
|
128
|
-
>
|
|
129
|
-
> = {
|
|
130
|
-
gh: {
|
|
131
|
-
fields: "number,state,headRefName,baseRefName",
|
|
132
|
-
row: ({ number, state, head, base }) => ({
|
|
133
|
-
number,
|
|
134
|
-
state: state === "draft" ? "OPEN" : state.toUpperCase(),
|
|
135
|
-
headRefName: head,
|
|
136
|
-
baseRefName: base,
|
|
137
|
-
}),
|
|
138
|
-
},
|
|
139
|
-
origin: {
|
|
140
|
-
fields: "number,status,headRef,baseRef",
|
|
141
|
-
row: ({ number, state, head, base }) => ({
|
|
142
|
-
number,
|
|
143
|
-
status: state,
|
|
144
|
-
headRef: head,
|
|
145
|
-
baseRef: base,
|
|
146
|
-
}),
|
|
147
|
-
},
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
function forgeRows(
|
|
151
|
-
forge: Forge,
|
|
152
|
-
prs: readonly {
|
|
153
|
-
number: number;
|
|
154
|
-
state: FixtureState;
|
|
155
|
-
head: string;
|
|
156
|
-
base: string;
|
|
157
|
-
}[]
|
|
158
|
-
): string {
|
|
159
|
-
return JSON.stringify(prs.map((pr) => FORGE_FIXTURES[forge].row(pr)));
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async function withFakeForge<T>({
|
|
163
|
-
directory,
|
|
164
|
-
forge,
|
|
165
|
-
operation,
|
|
166
|
-
currentRows,
|
|
167
|
-
}: {
|
|
168
|
-
directory: string;
|
|
169
|
-
forge: Forge;
|
|
170
|
-
operation: () => Promise<T>;
|
|
171
|
-
currentRows?: string;
|
|
172
|
-
}): Promise<T> {
|
|
173
|
-
const bin = join(directory, "bin");
|
|
174
|
-
const outputPath = join(directory, "forge-output.txt");
|
|
175
|
-
await mkdir(bin, { recursive: true });
|
|
176
|
-
await writeFile(
|
|
177
|
-
outputPath,
|
|
178
|
-
`${
|
|
179
|
-
currentRows ??
|
|
180
|
-
forgeRows(forge, [
|
|
181
|
-
{
|
|
182
|
-
number: 11,
|
|
183
|
-
state: "open",
|
|
184
|
-
head: "stack/open",
|
|
185
|
-
base: "stack/closed",
|
|
186
|
-
},
|
|
187
|
-
])
|
|
188
|
-
}\n`
|
|
189
|
-
);
|
|
190
|
-
const { fields } = FORGE_FIXTURES[forge];
|
|
191
|
-
const list = (filter: string, branch: string): string =>
|
|
192
|
-
`pr list ${filter} ${branch} --state all --json ${fields}`;
|
|
193
|
-
const fake = join(bin, forge);
|
|
194
|
-
await writeFile(
|
|
195
|
-
fake,
|
|
196
|
-
`#!/usr/bin/env bash
|
|
197
|
-
set -euo pipefail
|
|
198
|
-
if [ "$(pwd -P)" != "${realpathSync(join(directory, "repo"))}" ]; then
|
|
199
|
-
printf '${forge} ran outside the fixture repo: %s\\n' "$(pwd -P)" >&2
|
|
200
|
-
exit 2
|
|
201
|
-
fi
|
|
202
|
-
case "$*" in
|
|
203
|
-
"${list("--head", "stack/open")}")
|
|
204
|
-
cat "${outputPath}"
|
|
205
|
-
;;
|
|
206
|
-
"${list("--head", "stack/closed")}")
|
|
207
|
-
printf '%s\\n' '${forgeRows(forge, [{ number: 13, state: "closed", head: "stack/closed", base: "stack/merged" }])}'
|
|
208
|
-
;;
|
|
209
|
-
"${list("--head", "stack/merged")}")
|
|
210
|
-
printf '%s\\n' '${forgeRows(forge, [{ number: 10, state: "merged", head: "stack/merged", base: "main" }])}'
|
|
211
|
-
;;
|
|
212
|
-
"${list("--base", "stack/open")}")
|
|
213
|
-
printf '%s\\n' '${forgeRows(forge, [
|
|
214
|
-
{ number: 14, state: "draft", head: "stack/draft", base: "stack/open" },
|
|
215
|
-
{
|
|
216
|
-
number: 15,
|
|
217
|
-
state: "closed",
|
|
218
|
-
head: "stack/abandoned",
|
|
219
|
-
base: "stack/open",
|
|
220
|
-
},
|
|
221
|
-
])}'
|
|
222
|
-
;;
|
|
223
|
-
"${list("--base", "stack/draft")}")
|
|
224
|
-
printf '[]\\n'
|
|
225
|
-
;;
|
|
226
|
-
*)
|
|
227
|
-
printf 'unexpected ${forge} arguments: %s\\n' "$*" >&2
|
|
228
|
-
exit 2
|
|
229
|
-
;;
|
|
230
|
-
esac
|
|
231
|
-
`
|
|
232
|
-
);
|
|
233
|
-
await chmod(fake, 0o755);
|
|
234
|
-
|
|
235
|
-
const originalPath = process.env.PATH;
|
|
236
|
-
process.env.PATH = `${bin}:${originalPath ?? ""}`;
|
|
237
|
-
try {
|
|
238
|
-
return await operation();
|
|
239
|
-
} finally {
|
|
240
|
-
if (originalPath === undefined) {
|
|
241
|
-
delete process.env.PATH;
|
|
242
|
-
} else {
|
|
243
|
-
process.env.PATH = originalPath;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
function runCli(
|
|
249
|
-
args: readonly string[],
|
|
250
|
-
env: Readonly<Record<string, string | undefined>> = process.env
|
|
251
|
-
): RunResult {
|
|
252
|
-
const result = Bun.spawnSync([process.execPath, SCRIPT, ...args], { env });
|
|
253
|
-
return {
|
|
254
|
-
code: result.exitCode,
|
|
255
|
-
stdout: result.stdout.toString(),
|
|
256
|
-
stderr: result.stderr.toString(),
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
afterEach(async () => {
|
|
261
|
-
for (const store of handles.splice(0).reverse()) {
|
|
262
|
-
await store.close();
|
|
263
|
-
}
|
|
264
|
-
for (const directory of directories.splice(0)) {
|
|
265
|
-
await rm(directory, { recursive: true, force: true });
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
describe("Store", () => {
|
|
270
|
-
it("initializes an idempotent plain-file store and releases its lock", async () => {
|
|
271
|
-
const directory = await makeDirectory();
|
|
272
|
-
const store = useStore(directory);
|
|
273
|
-
|
|
274
|
-
expect(await store.init()).toEqual({ store: directory });
|
|
275
|
-
const firstUnits = await readFile(join(directory, "units.tsv"), "utf8");
|
|
276
|
-
const firstLedger = await readFile(
|
|
277
|
-
join(directory, "ledger.tsv"),
|
|
278
|
-
"utf8"
|
|
279
|
-
);
|
|
280
|
-
|
|
281
|
-
expect(await store.init()).toEqual({ store: directory });
|
|
282
|
-
expect(await readFile(join(directory, "units.tsv"), "utf8")).toBe(
|
|
283
|
-
firstUnits
|
|
284
|
-
);
|
|
285
|
-
expect(await readFile(join(directory, "ledger.tsv"), "utf8")).toBe(
|
|
286
|
-
firstLedger
|
|
287
|
-
);
|
|
288
|
-
expect((await readdir(directory)).sort()).toEqual([
|
|
289
|
-
".orch.lock",
|
|
290
|
-
"frontier.json",
|
|
291
|
-
"gates.md",
|
|
292
|
-
"inbox",
|
|
293
|
-
"ledger.tsv",
|
|
294
|
-
"preferences.md",
|
|
295
|
-
"units.tsv",
|
|
296
|
-
]);
|
|
297
|
-
|
|
298
|
-
await store.close();
|
|
299
|
-
expect(await readdir(directory)).not.toContain(".orch.lock");
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
it("composes unit add, set, get, list, and counts", async () => {
|
|
303
|
-
const { store } = await initializedStore();
|
|
304
|
-
|
|
305
|
-
expect(
|
|
306
|
-
await store.units.add({
|
|
307
|
-
id: "u1",
|
|
308
|
-
track: "build",
|
|
309
|
-
brief: "briefs/u1.md",
|
|
310
|
-
})
|
|
311
|
-
).toMatchObject({ id: "u1", state: "pending" });
|
|
312
|
-
expect(
|
|
313
|
-
await store.units.add({ id: "=SUM(A1)", track: "+build" })
|
|
314
|
-
).toMatchObject({ id: "'=SUM(A1)", track: "'+build" });
|
|
315
|
-
|
|
316
|
-
const updated = await store.units.set({
|
|
317
|
-
id: "u1",
|
|
318
|
-
state: "done",
|
|
319
|
-
branch: "poteto/u1",
|
|
320
|
-
pr: 184530,
|
|
321
|
-
sha: "abc123",
|
|
322
|
-
});
|
|
323
|
-
expect(updated).toEqual({
|
|
324
|
-
id: "u1",
|
|
325
|
-
track: "build",
|
|
326
|
-
state: "done",
|
|
327
|
-
branch: "poteto/u1",
|
|
328
|
-
pr: "184530",
|
|
329
|
-
sha: "abc123",
|
|
330
|
-
brief: "briefs/u1.md",
|
|
331
|
-
});
|
|
332
|
-
expect(await store.units.get("u1")).toEqual(updated);
|
|
333
|
-
expect(
|
|
334
|
-
await store.units.list({ state: "done", track: "build" })
|
|
335
|
-
).toEqual([updated]);
|
|
336
|
-
expect(await store.units.counts()).toEqual({ done: 1, pending: 1 });
|
|
337
|
-
await expect(
|
|
338
|
-
store.units.add({ id: "u1", track: "build" })
|
|
339
|
-
).rejects.toThrow("unit u1 already exists");
|
|
340
|
-
await expect(
|
|
341
|
-
store.units.set({ id: "missing", state: "done" })
|
|
342
|
-
).rejects.toBeInstanceOf(NotFoundError);
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
it("records, replaces, checks, and summarizes typed ledger verdicts", async () => {
|
|
346
|
-
const { store } = await initializedStore();
|
|
347
|
-
|
|
348
|
-
try {
|
|
349
|
-
await store.ledger.check({ pr: 184530, sha: "abc123" });
|
|
350
|
-
throw new Error("expected ledger check to fail");
|
|
351
|
-
} catch (error) {
|
|
352
|
-
expect(error).toBeInstanceOf(NotFoundError);
|
|
353
|
-
if (error instanceof NotFoundError) {
|
|
354
|
-
expect(error.output).toEqual({
|
|
355
|
-
compact: "NOT-VERIFIED",
|
|
356
|
-
json: {
|
|
357
|
-
pr: "184530",
|
|
358
|
-
sha: "abc123",
|
|
359
|
-
verdict: "NOT-VERIFIED",
|
|
360
|
-
},
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
expect(() => parseVerdict("looks-good")).toThrow("verdict must be");
|
|
365
|
-
|
|
366
|
-
const recorded = await store.ledger.record({
|
|
367
|
-
pr: 184530,
|
|
368
|
-
sha: "abc123",
|
|
369
|
-
verdict: "unit-test-verified",
|
|
370
|
-
evidence: "reports/verify.md",
|
|
371
|
-
verifier: "opus",
|
|
372
|
-
});
|
|
373
|
-
expect(await store.ledger.check({ pr: 184530, sha: "abc123" })).toEqual(
|
|
374
|
-
recorded
|
|
375
|
-
);
|
|
376
|
-
expect(await store.ledger.summary()).toEqual({
|
|
377
|
-
"unit-test-verified": 1,
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
await store.ledger.record({
|
|
381
|
-
pr: 184530,
|
|
382
|
-
sha: "abc123",
|
|
383
|
-
verdict: "live-ui-verified",
|
|
384
|
-
evidence: "reports/live.md",
|
|
385
|
-
});
|
|
386
|
-
expect(await store.ledger.summary()).toEqual({
|
|
387
|
-
"live-ui-verified": 1,
|
|
388
|
-
});
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
it("pushes, peeks, and atomically drains inbox pointers", async () => {
|
|
392
|
-
const { directory, store } = await initializedStore();
|
|
393
|
-
|
|
394
|
-
const first = await store.inbox.push({
|
|
395
|
-
agent: "worker-1",
|
|
396
|
-
unit: "u1",
|
|
397
|
-
status: "done",
|
|
398
|
-
report: "reports/u1.md",
|
|
399
|
-
});
|
|
400
|
-
expect(first.pointer).toMatchObject({ unit: "u1", status: "done" });
|
|
401
|
-
expect(first.filename).toEndWith(".tsv");
|
|
402
|
-
await store.inbox.push({
|
|
403
|
-
agent: "worker-2",
|
|
404
|
-
unit: "u2",
|
|
405
|
-
status: "failed",
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
expect(await store.inbox.count()).toBe(2);
|
|
409
|
-
expect(await store.inbox.peek()).toHaveLength(2);
|
|
410
|
-
expect(await store.inbox.count()).toBe(2);
|
|
411
|
-
expect(await store.inbox.drain()).toHaveLength(2);
|
|
412
|
-
expect(await store.inbox.count()).toBe(0);
|
|
413
|
-
expect(await readdir(join(directory, "inbox"))).toEqual([]);
|
|
414
|
-
expect(
|
|
415
|
-
(await readdir(directory)).filter((name) =>
|
|
416
|
-
name.startsWith(".inbox-drain-")
|
|
417
|
-
)
|
|
418
|
-
).toEqual([]);
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
it("replaces a stale lock whose holder pid is dead", async () => {
|
|
422
|
-
const { directory } = await initializedStore();
|
|
423
|
-
const exited = Bun.spawn(["true"]);
|
|
424
|
-
await exited.exited;
|
|
425
|
-
await writeFile(join(directory, ".orch.lock"), `${exited.pid}\n`);
|
|
426
|
-
|
|
427
|
-
const stale: string[] = [];
|
|
428
|
-
const recovered = useStore(directory, {
|
|
429
|
-
onStaleLock: (holder) => stale.push(holder),
|
|
430
|
-
});
|
|
431
|
-
expect(
|
|
432
|
-
await recovered.units.add({ id: "u1", track: "build" })
|
|
433
|
-
).toMatchObject({ id: "u1" });
|
|
434
|
-
expect(stale).toEqual([String(exited.pid)]);
|
|
435
|
-
await recovered.close();
|
|
436
|
-
expect(await readdir(directory)).not.toContain(".orch.lock");
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
it("blocks a writer and steals the pid lock only with force", async () => {
|
|
440
|
-
const { directory, store } = await initializedStore();
|
|
441
|
-
await store.close();
|
|
442
|
-
await writeFile(join(directory, ".orch.lock"), `${process.pid}\n`);
|
|
443
|
-
|
|
444
|
-
const blocked = useStore(directory);
|
|
445
|
-
await expect(
|
|
446
|
-
blocked.units.add({ id: "u1", track: "build" })
|
|
447
|
-
).rejects.toThrow(`store lock held by pid ${process.pid}`);
|
|
448
|
-
|
|
449
|
-
const stolen: string[] = [];
|
|
450
|
-
const forced = useStore(directory, {
|
|
451
|
-
force: true,
|
|
452
|
-
onLockStolen: (holder) => stolen.push(holder),
|
|
453
|
-
});
|
|
454
|
-
expect(
|
|
455
|
-
await forced.units.add({ id: "u1", track: "build" })
|
|
456
|
-
).toMatchObject({ id: "u1" });
|
|
457
|
-
expect(stolen).toEqual([String(process.pid)]);
|
|
458
|
-
await forced.close();
|
|
459
|
-
expect(await readdir(directory)).not.toContain(".orch.lock");
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
it("parks gates, stores standing orders, and renders status", async () => {
|
|
463
|
-
const { directory, store } = await initializedStore();
|
|
464
|
-
await store.units.add({ id: "u1", track: "build" });
|
|
465
|
-
expect(
|
|
466
|
-
await store.gates.park({
|
|
467
|
-
id: "release",
|
|
468
|
-
question: "Ship now?",
|
|
469
|
-
options: "ship,wait",
|
|
470
|
-
defaultAnswer: "wait",
|
|
471
|
-
})
|
|
472
|
-
).toMatchObject({ kind: "open", id: "release" });
|
|
473
|
-
expect(
|
|
474
|
-
await store.standing.add({ line: "Never force push." })
|
|
475
|
-
).toEqual({ number: 1, line: "Never force push." });
|
|
476
|
-
|
|
477
|
-
const first = await store.status.render();
|
|
478
|
-
expect(first.changed).toBe("first render");
|
|
479
|
-
expect(first.summary.openGateIds).toEqual(["release"]);
|
|
480
|
-
expect(await readFile(join(directory, "status.md"), "utf8")).toContain(
|
|
481
|
-
"| release | open | Ship now? |"
|
|
482
|
-
);
|
|
483
|
-
expect((await store.status.render()).changed).toBe("no derived changes");
|
|
484
|
-
|
|
485
|
-
expect(
|
|
486
|
-
await store.gates.resolve({ id: "release", answer: "ship" })
|
|
487
|
-
).toMatchObject({ kind: "resolved", answer: "ship" });
|
|
488
|
-
expect((await store.status.render()).changed).toBe("open gates 1->0");
|
|
489
|
-
expect(await store.gates.list()).toEqual([]);
|
|
490
|
-
expect(await store.standing.show()).toEqual([
|
|
491
|
-
{ number: 1, line: "Never force push." },
|
|
492
|
-
]);
|
|
493
|
-
});
|
|
494
|
-
|
|
495
|
-
for (const forge of ["gh", "origin"] as const) {
|
|
496
|
-
it(`resolves the ordered frontier from the ${forge} base chain and validates an optional pin`, async () => {
|
|
497
|
-
const { directory, store } = await initializedStore();
|
|
498
|
-
const stack = await makeGitStack(directory);
|
|
499
|
-
const forgeParams = forge === "gh" ? {} : { forge };
|
|
500
|
-
|
|
501
|
-
await withFakeForge({
|
|
502
|
-
directory,
|
|
503
|
-
forge,
|
|
504
|
-
operation: async () => {
|
|
505
|
-
expect(
|
|
506
|
-
await store.frontier.set({ repo: stack.repo, ...forgeParams })
|
|
507
|
-
).toEqual({
|
|
508
|
-
generation: 1,
|
|
509
|
-
prs: [
|
|
510
|
-
{
|
|
511
|
-
pr: 10,
|
|
512
|
-
branches: "stack/merged",
|
|
513
|
-
sha: stack.mergedSha,
|
|
514
|
-
state: "MERGED",
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
pr: 13,
|
|
518
|
-
branches: "stack/closed",
|
|
519
|
-
sha: stack.closedSha,
|
|
520
|
-
state: "CLOSED",
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
pr: 11,
|
|
524
|
-
branches: "stack/open",
|
|
525
|
-
sha: stack.openSha,
|
|
526
|
-
state: "OPEN",
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
pr: 14,
|
|
530
|
-
branches: "stack/draft",
|
|
531
|
-
sha: stack.draftSha,
|
|
532
|
-
state: "OPEN",
|
|
533
|
-
},
|
|
534
|
-
],
|
|
535
|
-
lowestUnmerged: 11,
|
|
536
|
-
});
|
|
537
|
-
expect(
|
|
538
|
-
(
|
|
539
|
-
await store.frontier.set({
|
|
540
|
-
repo: stack.repo,
|
|
541
|
-
...forgeParams,
|
|
542
|
-
prs: [10, 13, 11, 14],
|
|
543
|
-
})
|
|
544
|
-
).generation
|
|
545
|
-
).toBe(2);
|
|
546
|
-
expect((await store.frontier.show()).generation).toBe(2);
|
|
547
|
-
await expect(
|
|
548
|
-
store.frontier.set({
|
|
549
|
-
repo: stack.repo,
|
|
550
|
-
...forgeParams,
|
|
551
|
-
prs: [10, 11, 12],
|
|
552
|
-
})
|
|
553
|
-
).rejects.toThrow(
|
|
554
|
-
"frontier pin mismatch: missing from resolved chain: 12; extra in resolved chain: 13,14"
|
|
555
|
-
);
|
|
556
|
-
await expect(
|
|
557
|
-
store.frontier.set({
|
|
558
|
-
repo: stack.repo,
|
|
559
|
-
...forgeParams,
|
|
560
|
-
prs: [13, 10, 11, 14],
|
|
561
|
-
})
|
|
562
|
-
).rejects.toThrow(
|
|
563
|
-
"frontier pin mismatch: order differs: expected 13,10,11,14; resolved 10,13,11,14"
|
|
564
|
-
);
|
|
565
|
-
await expect(
|
|
566
|
-
store.frontier.set({
|
|
567
|
-
repo: stack.repo,
|
|
568
|
-
...forgeParams,
|
|
569
|
-
prs: [10, 10],
|
|
570
|
-
})
|
|
571
|
-
).rejects.toThrow("--prs must not contain duplicates");
|
|
572
|
-
},
|
|
573
|
-
});
|
|
574
|
-
});
|
|
575
|
-
|
|
576
|
-
it(`rejects unparseable ${forge} output loudly`, async () => {
|
|
577
|
-
const { directory, store } = await initializedStore();
|
|
578
|
-
const stack = await makeGitStack(directory);
|
|
579
|
-
|
|
580
|
-
await withFakeForge({
|
|
581
|
-
directory,
|
|
582
|
-
forge,
|
|
583
|
-
currentRows: "this line is not forge output",
|
|
584
|
-
operation: async () => {
|
|
585
|
-
await expect(
|
|
586
|
-
store.frontier.set({ repo: stack.repo, forge })
|
|
587
|
-
).rejects.toThrow(
|
|
588
|
-
`${forge} pr list --head stack/open output is not valid JSON`
|
|
589
|
-
);
|
|
590
|
-
},
|
|
591
|
-
});
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
it("names the missing pull request when a chain branch has none", async () => {
|
|
596
|
-
const { directory, store } = await initializedStore();
|
|
597
|
-
const stack = await makeGitStack(directory);
|
|
598
|
-
|
|
599
|
-
await withFakeForge({
|
|
600
|
-
directory,
|
|
601
|
-
forge: "gh",
|
|
602
|
-
currentRows: "[]",
|
|
603
|
-
operation: async () => {
|
|
604
|
-
await expect(store.frontier.set({ repo: stack.repo })).rejects.toThrow(
|
|
605
|
-
"branch stack/open has no pull request; open one with gh pr create"
|
|
606
|
-
);
|
|
607
|
-
},
|
|
608
|
-
});
|
|
609
|
-
});
|
|
610
|
-
|
|
611
|
-
it("rejects malformed TSV, verdict, frontier, and inbox data", async () => {
|
|
612
|
-
const { directory, store } = await initializedStore();
|
|
613
|
-
|
|
614
|
-
await writeFile(join(directory, "units.tsv"), "wrong\n");
|
|
615
|
-
await expect(store.units.list()).rejects.toThrow(
|
|
616
|
-
"units.tsv has an invalid header"
|
|
617
|
-
);
|
|
618
|
-
await writeFile(
|
|
619
|
-
join(directory, "units.tsv"),
|
|
620
|
-
"id\ttrack\tstate\tbranch\tpr\tsha\tbrief\nshort\trow\n"
|
|
621
|
-
);
|
|
622
|
-
await expect(store.units.list()).rejects.toThrow(
|
|
623
|
-
"units.tsv has a malformed row"
|
|
624
|
-
);
|
|
625
|
-
|
|
626
|
-
await writeFile(
|
|
627
|
-
join(directory, "ledger.tsv"),
|
|
628
|
-
"pr\tsha\tverdict\tevidence\tverifier\tts\n1\tsha\tinvalid\treport\tme\tnow\n"
|
|
629
|
-
);
|
|
630
|
-
await expect(store.ledger.summary()).rejects.toThrow(
|
|
631
|
-
"ledger.tsv has invalid verdict invalid"
|
|
632
|
-
);
|
|
633
|
-
|
|
634
|
-
await writeFile(join(directory, "frontier.json"), '{"generation":"1"}\n');
|
|
635
|
-
await expect(store.frontier.show()).rejects.toThrow(
|
|
636
|
-
"frontier.json has an invalid shape"
|
|
637
|
-
);
|
|
638
|
-
|
|
639
|
-
await writeFile(join(directory, "inbox", "bad.tsv"), "too\tshort\n");
|
|
640
|
-
await expect(store.inbox.peek()).rejects.toThrow(
|
|
641
|
-
"inbox pointer bad.tsv is malformed"
|
|
642
|
-
);
|
|
643
|
-
});
|
|
644
|
-
|
|
645
|
-
it("rejects operations after close", async () => {
|
|
646
|
-
const { store } = await initializedStore();
|
|
647
|
-
await store.close();
|
|
648
|
-
await expect(store.units.list()).rejects.toThrow("store is closed");
|
|
649
|
-
await expect(store.status.render()).rejects.toBeInstanceOf(UserError);
|
|
650
|
-
});
|
|
651
|
-
});
|
|
652
|
-
|
|
653
|
-
describe("orch CLI", () => {
|
|
654
|
-
it("prints commander help and rejects invalid parsing with exit 1", async () => {
|
|
655
|
-
const help = runCli(["--help"]);
|
|
656
|
-
expect(help.code).toBe(0);
|
|
657
|
-
expect(help.stdout).toContain("Commands:");
|
|
658
|
-
expect(help.stdout).toContain("unit");
|
|
659
|
-
expect(help.stdout).toContain("ledger");
|
|
660
|
-
|
|
661
|
-
const frontierHelp = runCli(["frontier", "set", "--help"]);
|
|
662
|
-
expect(frontierHelp.code).toBe(0);
|
|
663
|
-
expect(frontierHelp.stdout).toContain("--repo <dir>");
|
|
664
|
-
expect(frontierHelp.stdout).toContain("--forge <forge>");
|
|
665
|
-
expect(frontierHelp.stdout).toContain("--prs <n,...>");
|
|
666
|
-
|
|
667
|
-
const directory = await makeDirectory();
|
|
668
|
-
const invalid = runCli(["--store", directory, "unit", "add", "u1"]);
|
|
669
|
-
expect(invalid.code).toBe(1);
|
|
670
|
-
expect(invalid.stderr).toContain("required option '--track <track>'");
|
|
671
|
-
|
|
672
|
-
const badForge = runCli([
|
|
673
|
-
"--store",
|
|
674
|
-
directory,
|
|
675
|
-
"frontier",
|
|
676
|
-
"set",
|
|
677
|
-
"--repo",
|
|
678
|
-
directory,
|
|
679
|
-
"--forge",
|
|
680
|
-
"gt",
|
|
681
|
-
]);
|
|
682
|
-
expect(badForge.code).toBe(1);
|
|
683
|
-
expect(badForge.stderr).toContain("Allowed choices are gh, origin");
|
|
684
|
-
});
|
|
685
|
-
|
|
686
|
-
it("accepts ORCH_STORE and emits complete JSON", async () => {
|
|
687
|
-
const directory = await makeDirectory();
|
|
688
|
-
const env = { ...process.env, ORCH_STORE: directory };
|
|
689
|
-
expect(runCli(["init"], env).code).toBe(0);
|
|
690
|
-
|
|
691
|
-
const added = runCli(
|
|
692
|
-
["unit", "add", "u1", "--track", "build", "--json"],
|
|
693
|
-
env
|
|
694
|
-
);
|
|
695
|
-
expect(added.code).toBe(0);
|
|
696
|
-
expect(JSON.parse(added.stdout)).toEqual({
|
|
697
|
-
id: "u1",
|
|
698
|
-
track: "build",
|
|
699
|
-
state: "pending",
|
|
700
|
-
branch: "",
|
|
701
|
-
pr: "",
|
|
702
|
-
sha: "",
|
|
703
|
-
brief: "",
|
|
704
|
-
});
|
|
705
|
-
});
|
|
706
|
-
|
|
707
|
-
it("maps user and not-found outcomes to the preserved exit codes", async () => {
|
|
708
|
-
const directory = await makeDirectory();
|
|
709
|
-
expect(runCli(["--store", directory, "init"]).code).toBe(0);
|
|
710
|
-
|
|
711
|
-
const missingRepo = runCli([
|
|
712
|
-
"--store",
|
|
713
|
-
directory,
|
|
714
|
-
"frontier",
|
|
715
|
-
"set",
|
|
716
|
-
]);
|
|
717
|
-
expect(missingRepo.code).toBe(1);
|
|
718
|
-
expect(missingRepo.stderr).toContain(
|
|
719
|
-
"set --repo <dir> or ORCH_REPO"
|
|
720
|
-
);
|
|
721
|
-
|
|
722
|
-
const userError = runCli([
|
|
723
|
-
"--store",
|
|
724
|
-
directory,
|
|
725
|
-
"unit",
|
|
726
|
-
"add",
|
|
727
|
-
"",
|
|
728
|
-
"--track",
|
|
729
|
-
"build",
|
|
730
|
-
]);
|
|
731
|
-
expect(userError.code).toBe(1);
|
|
732
|
-
expect(userError.stderr).toContain("unit id must not be empty");
|
|
733
|
-
|
|
734
|
-
const missingUnit = runCli([
|
|
735
|
-
"--store",
|
|
736
|
-
directory,
|
|
737
|
-
"unit",
|
|
738
|
-
"get",
|
|
739
|
-
"missing",
|
|
740
|
-
]);
|
|
741
|
-
expect(missingUnit.code).toBe(2);
|
|
742
|
-
expect(missingUnit.stderr).toContain("unit missing not found");
|
|
743
|
-
|
|
744
|
-
const missingLedger = runCli([
|
|
745
|
-
"--store",
|
|
746
|
-
directory,
|
|
747
|
-
"--json",
|
|
748
|
-
"ledger",
|
|
749
|
-
"check",
|
|
750
|
-
"184530",
|
|
751
|
-
"abc123",
|
|
752
|
-
]);
|
|
753
|
-
expect(missingLedger.code).toBe(2);
|
|
754
|
-
expect(JSON.parse(missingLedger.stdout)).toEqual({
|
|
755
|
-
pr: "184530",
|
|
756
|
-
sha: "abc123",
|
|
757
|
-
verdict: "NOT-VERIFIED",
|
|
758
|
-
});
|
|
759
|
-
expect(missingLedger.stderr).toBe("");
|
|
760
|
-
});
|
|
761
|
-
});
|