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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { expect } from "./expect.mjs";
|
|
2
|
+
import { spawn as spawn$1, spawnSync as spawnSync$1 } from "node:child_process";
|
|
3
|
+
// runtime/skills/poteto-mode/scripts/support.ts
|
|
4
|
+
/**
|
|
5
|
+
* The one support module the ported upstream tests import.
|
|
6
|
+
*
|
|
7
|
+
* The five upstream test files were written for `bun:test` and use exactly two
|
|
8
|
+
* Bun facilities: its `expect`, and `Bun.spawnSync` / `Bun.spawn` for running git
|
|
9
|
+
* and short-lived processes. Rather than rewrite every call site, this module
|
|
10
|
+
* supplies those two shapes and the test patch only replaces the import line. The
|
|
11
|
+
* bodies below stay byte-for-byte the upstream text, so a future upstream change
|
|
12
|
+
* is still readable against this tree.
|
|
13
|
+
*
|
|
14
|
+
* `Bun.spawnSync` returns `{ exitCode, stdout, stderr, success }` with Buffer
|
|
15
|
+
* output and never throws on a nonzero exit; `node:child_process.spawnSync`
|
|
16
|
+
* returns `{ status, stdout, stderr }`. The adapter is the mapping between them,
|
|
17
|
+
* not a second implementation.
|
|
18
|
+
*
|
|
19
|
+
* `Bun.spawn` returns `{ pid, exited: Promise<number> }`. The adapter runs the
|
|
20
|
+
* child to completion and resolves `exited` with the exit status, which is what
|
|
21
|
+
* the one call site awaits.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Run a command to completion, Bun-shaped.
|
|
25
|
+
*
|
|
26
|
+
* A signal-terminated child reports `exitCode: 1` rather than `null`, so a test
|
|
27
|
+
* that formats the code never prints `undefined` for a killed process.
|
|
28
|
+
*/
|
|
29
|
+
function spawnSync(argv, options = {}) {
|
|
30
|
+
const [command, ...args] = argv;
|
|
31
|
+
if (command === void 0) throw new TypeError("spawnSync needs a command");
|
|
32
|
+
const result = spawnSync$1(command, args, {
|
|
33
|
+
cwd: options.cwd,
|
|
34
|
+
env: options.env,
|
|
35
|
+
stdio: [
|
|
36
|
+
options.stdin === "inherit" ? "inherit" : "pipe",
|
|
37
|
+
options.stdout === "inherit" ? "inherit" : "pipe",
|
|
38
|
+
options.stderr === "inherit" ? "inherit" : "pipe"
|
|
39
|
+
],
|
|
40
|
+
encoding: "buffer"
|
|
41
|
+
});
|
|
42
|
+
const exitCode = result.status ?? 1;
|
|
43
|
+
return {
|
|
44
|
+
exitCode,
|
|
45
|
+
stdout: Buffer.isBuffer(result.stdout) ? result.stdout : Buffer.alloc(0),
|
|
46
|
+
stderr: Buffer.isBuffer(result.stderr) ? result.stderr : Buffer.alloc(0),
|
|
47
|
+
success: exitCode === 0
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A child that exits immediately, as a real process.
|
|
52
|
+
*
|
|
53
|
+
* The current interpreter running an empty program is a process like any other: its
|
|
54
|
+
* `pid` is real and its exit status is 0.
|
|
55
|
+
*/
|
|
56
|
+
function immediateExit() {
|
|
57
|
+
return spawn$1(process.execPath, ["-e", ""], { stdio: "ignore" });
|
|
58
|
+
}
|
|
59
|
+
/** Whether `command` starts at all, checked without a shell. */
|
|
60
|
+
function resolves(command) {
|
|
61
|
+
return spawnSync$1(command, ["--version"], { stdio: "ignore" }).error === void 0;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Start a command and expose Bun's `{ pid, exited }` shape.
|
|
65
|
+
*
|
|
66
|
+
* The one upstream call is `spawn(["true"])`, used to obtain a pid that has already
|
|
67
|
+
* exited so the test can plant a stale lock. It reads `pid` *before* awaiting
|
|
68
|
+
* `exited`, so the pid must be real and already dead when this returns.
|
|
69
|
+
*
|
|
70
|
+
* That rules out "spawn it and fall back on failure": the failure is asynchronous, so
|
|
71
|
+
* the caller would read `-1`. The probe is synchronous instead, which lets this
|
|
72
|
+
* function choose the right child before returning. `true` is used when it exists and
|
|
73
|
+
* the current interpreter otherwise — a `PATH` without the usual Unix utilities is
|
|
74
|
+
* exactly the environment this release has to work in.
|
|
75
|
+
*/
|
|
76
|
+
function spawn(argv) {
|
|
77
|
+
const [command, ...args] = argv;
|
|
78
|
+
if (command === void 0) throw new TypeError("spawn needs a command");
|
|
79
|
+
const child = resolves(command) ? spawn$1(command, args, { stdio: "ignore" }) : immediateExit();
|
|
80
|
+
return {
|
|
81
|
+
pid: child.pid ?? -1,
|
|
82
|
+
exited: new Promise((resolve) => {
|
|
83
|
+
child.once("close", (code) => resolve(code ?? 1));
|
|
84
|
+
child.once("error", () => resolve(1));
|
|
85
|
+
})
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** The `Bun` global the upstream tests reference, limited to what they call. */
|
|
89
|
+
const Bun = {
|
|
90
|
+
spawnSync,
|
|
91
|
+
spawn
|
|
92
|
+
};
|
|
93
|
+
export { Bun, expect, spawn, spawnSync };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { nonEmpty, parsePrNumber } from "./types.mjs";
|
|
2
|
+
import { GhGitHubReader, WatcherQueryError, discoverStack, resolveContext } from "./github.mjs";
|
|
3
|
+
import { runQueued, runSimple, statusQueryVerdict, verdictFactory } from "./policy.mjs";
|
|
4
|
+
import { renderJson, renderPretty } from "./render.mjs";
|
|
5
|
+
import { setTimeout } from "node:timers/promises";
|
|
6
|
+
import { Command, CommanderError, InvalidArgumentError, Option } from "commander";
|
|
7
|
+
// runtime/skills/poteto-mode/scripts/watch-pr/cli.ts
|
|
8
|
+
function positiveNumber(value) {
|
|
9
|
+
const parsed = Number(value);
|
|
10
|
+
if (!Number.isFinite(parsed) || parsed <= 0) throw new InvalidArgumentError("must be greater than zero");
|
|
11
|
+
return parsed;
|
|
12
|
+
}
|
|
13
|
+
function nonNegativeNumber(value) {
|
|
14
|
+
const parsed = Number(value);
|
|
15
|
+
if (!Number.isFinite(parsed) || parsed < 0) throw new InvalidArgumentError("must be zero or greater");
|
|
16
|
+
return parsed;
|
|
17
|
+
}
|
|
18
|
+
function positiveInteger(value) {
|
|
19
|
+
const parsed = Number(value);
|
|
20
|
+
if (!Number.isInteger(parsed) || parsed <= 0) throw new InvalidArgumentError("must be a positive integer");
|
|
21
|
+
return parsed;
|
|
22
|
+
}
|
|
23
|
+
function prNumber(value) {
|
|
24
|
+
try {
|
|
25
|
+
return parsePrNumber(Number(value.replace(/^#/, "")));
|
|
26
|
+
} catch {
|
|
27
|
+
throw new InvalidArgumentError("must be a positive integer");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function stackPrList(value) {
|
|
31
|
+
const numbers = value.split(",").map((part) => prNumber(part.trim()));
|
|
32
|
+
if (new Set(numbers).size !== numbers.length) throw new InvalidArgumentError("contains a duplicate PR");
|
|
33
|
+
const parsed = nonEmpty(numbers);
|
|
34
|
+
if (parsed === null) throw new InvalidArgumentError("cannot be empty");
|
|
35
|
+
return parsed;
|
|
36
|
+
}
|
|
37
|
+
function parseArgs(argv, io) {
|
|
38
|
+
const program = new Command("watch-pr").description("Watch one pull request, a connected stack, or an immutable queued stack.\nJSON (NDJSON while polling) is the default; --pretty renders human text.").configureOutput({
|
|
39
|
+
writeOut: io.stdout,
|
|
40
|
+
writeErr: io.stderr
|
|
41
|
+
}).exitOverride().option("--owner <owner>", "GitHub repository owner").option("--repo <repo>", "GitHub repository name").option("--pr <number>", "pull request number", prNumber).addOption(new Option("--stack", "watch the connected open stack").default(false).conflicts("queuedStack")).option("--queued-stack", "watch the captured stack until all PRs merge", false).option("--stack-prs <n,...>", "frozen bottom-to-top queue (queued mode only)", stackPrList).option("--interval <seconds>", "poll interval", positiveNumber, 60).option("--sweep-interval <seconds>", "whole-stack sweep interval", positiveNumber, 300).option("--timeout <seconds>", "deadline; 0 disables it", nonNegativeNumber, 0).option("--max-query-errors <count>", "consecutive query-error budget", positiveInteger, 5).option("--status-only", "print one status table and exit 0", false).option("--allow-draft", "do not treat a draft as a merge gate", false).option("--pretty", "render human text instead of JSON", false);
|
|
42
|
+
program.parse(argv, { from: "user" });
|
|
43
|
+
const raw = program.opts();
|
|
44
|
+
if (raw.stackPrs !== void 0 && !raw.queuedStack) program.error("error: --stack-prs requires --queued-stack");
|
|
45
|
+
return {
|
|
46
|
+
owner: raw.owner ?? null,
|
|
47
|
+
repo: raw.repo ?? null,
|
|
48
|
+
pr: raw.pr ?? null,
|
|
49
|
+
mode: raw.queuedStack ? "queued-stack" : raw.stack ? "stack" : "single",
|
|
50
|
+
stackPrs: raw.stackPrs ?? [],
|
|
51
|
+
statusOnly: raw.statusOnly,
|
|
52
|
+
pretty: raw.pretty,
|
|
53
|
+
polling: {
|
|
54
|
+
interval: raw.interval,
|
|
55
|
+
sweepInterval: raw.sweepInterval,
|
|
56
|
+
timeout: raw.timeout,
|
|
57
|
+
maxQueryErrors: raw.maxQueryErrors,
|
|
58
|
+
allowDraft: raw.allowDraft
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function realRuntime() {
|
|
63
|
+
return {
|
|
64
|
+
reader: new GhGitHubReader(),
|
|
65
|
+
clock: {
|
|
66
|
+
now: () => performance.now() / 1e3,
|
|
67
|
+
observedAt: () => (/* @__PURE__ */ new Date()).toISOString(),
|
|
68
|
+
sleep: async (seconds) => {
|
|
69
|
+
await setTimeout(seconds * 1e3);
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
stdout: (value) => process.stdout.write(value),
|
|
73
|
+
stderr: (value) => process.stderr.write(value)
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async function main(argv, runtime = realRuntime()) {
|
|
77
|
+
let options;
|
|
78
|
+
try {
|
|
79
|
+
options = parseArgs(argv, runtime);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
if (!(error instanceof CommanderError)) throw error;
|
|
82
|
+
return error.exitCode === 0 ? 0 : 64;
|
|
83
|
+
}
|
|
84
|
+
const render = options.pretty ? renderPretty : renderJson;
|
|
85
|
+
const emit = (verdict) => runtime.stdout(render(verdict));
|
|
86
|
+
let contexts;
|
|
87
|
+
try {
|
|
88
|
+
const seed = await resolveContext({
|
|
89
|
+
reader: runtime.reader,
|
|
90
|
+
owner: options.owner,
|
|
91
|
+
repo: options.repo,
|
|
92
|
+
pr: options.pr ?? options.stackPrs[0] ?? null
|
|
93
|
+
});
|
|
94
|
+
contexts = nonEmpty(options.stackPrs.map((number) => ({
|
|
95
|
+
...seed,
|
|
96
|
+
number
|
|
97
|
+
}))) ?? (options.mode === "single" ? [seed] : await discoverStack(runtime.reader, seed));
|
|
98
|
+
} catch (error) {
|
|
99
|
+
if (!(error instanceof WatcherQueryError)) throw error;
|
|
100
|
+
const verdict = statusQueryVerdict(verdictFactory(runtime.clock, options.mode), 1, error.failure);
|
|
101
|
+
runtime.stdout(render(verdict));
|
|
102
|
+
return verdict.exitCode;
|
|
103
|
+
}
|
|
104
|
+
const dependencies = {
|
|
105
|
+
reader: runtime.reader,
|
|
106
|
+
clock: runtime.clock,
|
|
107
|
+
emit
|
|
108
|
+
};
|
|
109
|
+
const verdict = options.mode === "queued-stack" && !options.statusOnly ? await runQueued({
|
|
110
|
+
dependencies,
|
|
111
|
+
contexts,
|
|
112
|
+
options: options.polling
|
|
113
|
+
}) : await runSimple({
|
|
114
|
+
dependencies,
|
|
115
|
+
contexts,
|
|
116
|
+
mode: options.mode,
|
|
117
|
+
statusOnly: options.statusOnly,
|
|
118
|
+
options: options.polling
|
|
119
|
+
});
|
|
120
|
+
runtime.stdout(render(verdict));
|
|
121
|
+
return verdict.exitCode;
|
|
122
|
+
}
|
|
123
|
+
export { main, parseArgs };
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { expect } from "../expect.mjs";
|
|
2
|
+
import "../support.mjs";
|
|
3
|
+
import { parsePrNumber } from "./types.mjs";
|
|
4
|
+
import { renderJson, renderPretty } from "./render.mjs";
|
|
5
|
+
import { main, parseArgs } from "./cli.mjs";
|
|
6
|
+
import { fakeReader, passingCheck } from "./fakes.test-helper.mjs";
|
|
7
|
+
import { describe, it } from "node:test";
|
|
8
|
+
// runtime/skills/poteto-mode/scripts/watch-pr/cli.test.ts
|
|
9
|
+
const silentIo = {
|
|
10
|
+
stdout: () => {},
|
|
11
|
+
stderr: () => {}
|
|
12
|
+
};
|
|
13
|
+
function testRuntime(reader) {
|
|
14
|
+
const stdout = [];
|
|
15
|
+
const stderr = [];
|
|
16
|
+
return {
|
|
17
|
+
stdout,
|
|
18
|
+
stderr,
|
|
19
|
+
runtime: {
|
|
20
|
+
reader,
|
|
21
|
+
clock: {
|
|
22
|
+
now: () => 0,
|
|
23
|
+
observedAt: () => "2026-07-26T00:00:00.000Z",
|
|
24
|
+
async sleep() {
|
|
25
|
+
throw new Error("test unexpectedly slept");
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
stdout: (value) => stdout.push(value),
|
|
29
|
+
stderr: (value) => stderr.push(value)
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
describe("parseArgs", () => {
|
|
34
|
+
it("uses the specified defaults", () => {
|
|
35
|
+
expect(parseArgs([], silentIo)).toMatchObject({
|
|
36
|
+
owner: null,
|
|
37
|
+
repo: null,
|
|
38
|
+
pr: null,
|
|
39
|
+
mode: "single",
|
|
40
|
+
stackPrs: [],
|
|
41
|
+
statusOnly: false,
|
|
42
|
+
pretty: false,
|
|
43
|
+
polling: {
|
|
44
|
+
interval: 60,
|
|
45
|
+
sweepInterval: 300,
|
|
46
|
+
timeout: 0,
|
|
47
|
+
maxQueryErrors: 5,
|
|
48
|
+
allowDraft: false
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
it("parses a frozen queued stack bottom-to-top", () => {
|
|
53
|
+
const parsed = parseArgs([
|
|
54
|
+
"--queued-stack",
|
|
55
|
+
"--stack-prs",
|
|
56
|
+
"#10, 11,#12",
|
|
57
|
+
"--interval",
|
|
58
|
+
"2.5",
|
|
59
|
+
"--sweep-interval",
|
|
60
|
+
"30",
|
|
61
|
+
"--timeout",
|
|
62
|
+
"0",
|
|
63
|
+
"--max-query-errors",
|
|
64
|
+
"3",
|
|
65
|
+
"--allow-draft",
|
|
66
|
+
"--pretty"
|
|
67
|
+
], silentIo);
|
|
68
|
+
expect(parsed.mode).toBe("queued-stack");
|
|
69
|
+
expect(parsed.stackPrs.map(Number)).toEqual([
|
|
70
|
+
10,
|
|
71
|
+
11,
|
|
72
|
+
12
|
|
73
|
+
]);
|
|
74
|
+
expect(parsed.polling).toEqual({
|
|
75
|
+
interval: 2.5,
|
|
76
|
+
sweepInterval: 30,
|
|
77
|
+
timeout: 0,
|
|
78
|
+
maxQueryErrors: 3,
|
|
79
|
+
allowDraft: true
|
|
80
|
+
});
|
|
81
|
+
expect(parsed.pretty).toBe(true);
|
|
82
|
+
});
|
|
83
|
+
it("rejects every invalid mode and numeric shape as usage", async () => {
|
|
84
|
+
for (const argv of [
|
|
85
|
+
["--unknown"],
|
|
86
|
+
["--interval", "0"],
|
|
87
|
+
["--sweep-interval", "-1"],
|
|
88
|
+
["--timeout", "-1"],
|
|
89
|
+
["--max-query-errors", "1.5"],
|
|
90
|
+
["--stack", "--queued-stack"],
|
|
91
|
+
["--stack-prs", "1,2"],
|
|
92
|
+
[
|
|
93
|
+
"--queued-stack",
|
|
94
|
+
"--stack-prs",
|
|
95
|
+
"1,1"
|
|
96
|
+
]
|
|
97
|
+
]) {
|
|
98
|
+
const harness = testRuntime(fakeReader());
|
|
99
|
+
expect(await main(argv, harness.runtime)).toBe(64);
|
|
100
|
+
expect(harness.stdout).toEqual([]);
|
|
101
|
+
expect(harness.stderr.join("")).toContain("error:");
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe("rendering", () => {
|
|
106
|
+
const context = {
|
|
107
|
+
owner: "owner",
|
|
108
|
+
repo: "repo",
|
|
109
|
+
number: parsePrNumber(1)
|
|
110
|
+
};
|
|
111
|
+
const status = {
|
|
112
|
+
schemaVersion: 1,
|
|
113
|
+
sequence: 1,
|
|
114
|
+
observedAt: "2026-07-26T00:00:00.000Z",
|
|
115
|
+
mode: "single",
|
|
116
|
+
kind: "STATUS",
|
|
117
|
+
terminal: true,
|
|
118
|
+
exitCode: 0,
|
|
119
|
+
reason: "status-only",
|
|
120
|
+
rows: [{
|
|
121
|
+
kind: "merged",
|
|
122
|
+
context,
|
|
123
|
+
facts: {
|
|
124
|
+
context,
|
|
125
|
+
mergeable: "MERGEABLE",
|
|
126
|
+
mergeStateStatus: "CLEAN",
|
|
127
|
+
reviewDecision: "APPROVED",
|
|
128
|
+
headRefOid: "head",
|
|
129
|
+
headRefName: "feature",
|
|
130
|
+
baseRefName: "main",
|
|
131
|
+
state: "MERGED",
|
|
132
|
+
mergedAt: "now",
|
|
133
|
+
isDraft: false
|
|
134
|
+
}
|
|
135
|
+
}]
|
|
136
|
+
};
|
|
137
|
+
it("emits compact valid JSON by default", () => {
|
|
138
|
+
const rendered = renderJson(status);
|
|
139
|
+
expect(rendered.endsWith("\n")).toBe(true);
|
|
140
|
+
expect(JSON.parse(rendered)).toEqual(status);
|
|
141
|
+
});
|
|
142
|
+
it("renders the Markdown table from the same verdict only", () => {
|
|
143
|
+
const rendered = renderPretty(status);
|
|
144
|
+
expect(rendered).toContain("| PR | CI | Review | Merge |");
|
|
145
|
+
expect(rendered).toContain("| [#1](https://github.com/owner/repo/pull/1) | — | — | ✅ merged |");
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
describe("main", () => {
|
|
149
|
+
it("returns EX_USAGE 64 and writes usage errors only to stderr", async () => {
|
|
150
|
+
const harness = testRuntime(fakeReader());
|
|
151
|
+
expect(await main(["--interval", "0"], harness.runtime)).toBe(64);
|
|
152
|
+
expect(harness.stdout).toEqual([]);
|
|
153
|
+
expect(harness.stderr.join("")).toContain("option '--interval <seconds>' argument '0' is invalid");
|
|
154
|
+
});
|
|
155
|
+
it("bypasses the queue machine for queued-stack status-only", async () => {
|
|
156
|
+
const harness = testRuntime(fakeReader());
|
|
157
|
+
const code = await main([
|
|
158
|
+
"--owner",
|
|
159
|
+
"owner",
|
|
160
|
+
"--repo",
|
|
161
|
+
"repo",
|
|
162
|
+
"--queued-stack",
|
|
163
|
+
"--stack-prs",
|
|
164
|
+
"1",
|
|
165
|
+
"--status-only"
|
|
166
|
+
], harness.runtime);
|
|
167
|
+
expect(code).toBe(0);
|
|
168
|
+
expect(harness.stdout).toHaveLength(1);
|
|
169
|
+
const verdict = JSON.parse(harness.stdout[0]);
|
|
170
|
+
expect(verdict).toMatchObject({
|
|
171
|
+
kind: "STATUS",
|
|
172
|
+
terminal: true,
|
|
173
|
+
exitCode: 0,
|
|
174
|
+
mode: "queued-stack"
|
|
175
|
+
});
|
|
176
|
+
expect(harness.stdout[0]).not.toContain("\"kind\":\"QUEUE\"");
|
|
177
|
+
});
|
|
178
|
+
it("returns exit 4 for a hidden GitHub-side CI refusal", async () => {
|
|
179
|
+
const harness = testRuntime(fakeReader({
|
|
180
|
+
facts: { mergeStateStatus: "BLOCKED" },
|
|
181
|
+
fastPath: {
|
|
182
|
+
kind: "checks",
|
|
183
|
+
checks: [passingCheck()]
|
|
184
|
+
},
|
|
185
|
+
commitRollups: [{
|
|
186
|
+
oid: "head",
|
|
187
|
+
state: "FAILURE"
|
|
188
|
+
}]
|
|
189
|
+
}));
|
|
190
|
+
const code = await main([
|
|
191
|
+
"--owner",
|
|
192
|
+
"owner",
|
|
193
|
+
"--repo",
|
|
194
|
+
"repo",
|
|
195
|
+
"--pr",
|
|
196
|
+
"1"
|
|
197
|
+
], harness.runtime);
|
|
198
|
+
expect(code).toBe(4);
|
|
199
|
+
expect(harness.stdout).toHaveLength(1);
|
|
200
|
+
expect(JSON.parse(harness.stdout[0])).toMatchObject({
|
|
201
|
+
kind: "BLOCKER",
|
|
202
|
+
exitCode: 4,
|
|
203
|
+
blocker: {
|
|
204
|
+
kind: "failing-checks",
|
|
205
|
+
ci: { kind: "ci-github-rejected" }
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
it("shows help without touching the reader", async () => {
|
|
210
|
+
const reader = fakeReader();
|
|
211
|
+
const harness = testRuntime(reader);
|
|
212
|
+
expect(await main(["--help"], harness.runtime)).toBe(0);
|
|
213
|
+
expect(harness.stdout.join("")).toContain("JSON (NDJSON while polling)");
|
|
214
|
+
expect(reader.calls).toEqual([]);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
export {};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { parsePrNumber } from "./types.mjs";
|
|
2
|
+
// runtime/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts
|
|
3
|
+
function toRawThread(thread) {
|
|
4
|
+
return {
|
|
5
|
+
id: thread.id,
|
|
6
|
+
firstComment: thread.firstComment,
|
|
7
|
+
resolved: false
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function passingCheck(name = "ci") {
|
|
11
|
+
return {
|
|
12
|
+
kind: "passed",
|
|
13
|
+
name,
|
|
14
|
+
reportedState: "SUCCESS",
|
|
15
|
+
description: "",
|
|
16
|
+
link: "",
|
|
17
|
+
workflow: ""
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function pendingCheck(name = "ci") {
|
|
21
|
+
return {
|
|
22
|
+
kind: "pending",
|
|
23
|
+
name,
|
|
24
|
+
reportedState: "PENDING",
|
|
25
|
+
description: "",
|
|
26
|
+
link: "",
|
|
27
|
+
workflow: ""
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function failedCheck(name = "ci") {
|
|
31
|
+
return {
|
|
32
|
+
kind: "failed",
|
|
33
|
+
name,
|
|
34
|
+
reportedState: "FAILURE",
|
|
35
|
+
description: "",
|
|
36
|
+
link: "",
|
|
37
|
+
workflow: ""
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function fakeReader(options = {}) {
|
|
41
|
+
const calls = [];
|
|
42
|
+
const context = options.current ?? {
|
|
43
|
+
owner: "owner",
|
|
44
|
+
repo: "repo",
|
|
45
|
+
number: parsePrNumber(1)
|
|
46
|
+
};
|
|
47
|
+
const defaults = {
|
|
48
|
+
context,
|
|
49
|
+
mergeable: "MERGEABLE",
|
|
50
|
+
mergeStateStatus: "CLEAN",
|
|
51
|
+
reviewDecision: "APPROVED",
|
|
52
|
+
headRefOid: "head",
|
|
53
|
+
headRefName: "feature",
|
|
54
|
+
baseRefName: "main",
|
|
55
|
+
state: "OPEN",
|
|
56
|
+
mergedAt: null,
|
|
57
|
+
isDraft: false
|
|
58
|
+
};
|
|
59
|
+
let page = 0;
|
|
60
|
+
let threadPage = 0;
|
|
61
|
+
return {
|
|
62
|
+
calls,
|
|
63
|
+
async originRepo() {
|
|
64
|
+
calls.push("originRepo");
|
|
65
|
+
return options.origin === void 0 ? {
|
|
66
|
+
owner: "owner",
|
|
67
|
+
repo: "repo"
|
|
68
|
+
} : options.origin;
|
|
69
|
+
},
|
|
70
|
+
async currentPr(pr) {
|
|
71
|
+
calls.push("currentPr");
|
|
72
|
+
return {
|
|
73
|
+
...context,
|
|
74
|
+
number: pr ?? context.number
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
async pullRequest(requested) {
|
|
78
|
+
calls.push("pullRequest");
|
|
79
|
+
return {
|
|
80
|
+
...defaults,
|
|
81
|
+
...options.facts,
|
|
82
|
+
context: requested
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
async openPullRequests() {
|
|
86
|
+
calls.push("openPullRequests");
|
|
87
|
+
return options.openPullRequests ?? [];
|
|
88
|
+
},
|
|
89
|
+
async checksFastPath() {
|
|
90
|
+
calls.push("checksFastPath");
|
|
91
|
+
return options.fastPath ?? {
|
|
92
|
+
kind: "checks",
|
|
93
|
+
checks: [passingCheck()]
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
async checkRollupPage(_requested, after) {
|
|
97
|
+
calls.push(`checkRollupPage:${after ?? "null"}`);
|
|
98
|
+
return options.rollupPages?.[page++] ?? {
|
|
99
|
+
checks: [],
|
|
100
|
+
endCursor: null
|
|
101
|
+
};
|
|
102
|
+
},
|
|
103
|
+
async reviewThreadPage(_requested, after) {
|
|
104
|
+
calls.push(`reviewThreadPage:${after ?? "null"}`);
|
|
105
|
+
return options.threadPages?.[threadPage++] ?? {
|
|
106
|
+
threads: (options.threads ?? []).map(toRawThread),
|
|
107
|
+
endCursor: null
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
async commitRollups() {
|
|
111
|
+
calls.push("commitRollups");
|
|
112
|
+
return options.commitRollups ?? [{
|
|
113
|
+
oid: "head",
|
|
114
|
+
state: "SUCCESS"
|
|
115
|
+
}];
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export { failedCheck, fakeReader, passingCheck, pendingCheck };
|