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,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@cursor-skill/poteto-mode-tools",
|
|
3
|
-
"private": true,
|
|
4
|
-
"type": "module",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "bun test orch watch-pr check-plan.test.ts",
|
|
7
|
-
"typecheck": "tsc --project watch-pr/tsconfig.json --noEmit --strict"
|
|
8
|
-
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"commander": "14.0.0"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"bun-types": "latest",
|
|
14
|
-
"typescript": "latest"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "bun:test";
|
|
2
|
-
import { type CliRuntime, main, parseArgs } from "./cli.ts";
|
|
3
|
-
import { fakeReader, passingCheck } from "./fakes.test-helper.ts";
|
|
4
|
-
import { renderJson, renderPretty } from "./render.ts";
|
|
5
|
-
import type { GitHubReader, WatcherVerdict } from "./types.ts";
|
|
6
|
-
import { parsePrNumber } from "./types.ts";
|
|
7
|
-
|
|
8
|
-
const silentIo = { stdout: () => {}, stderr: () => {} };
|
|
9
|
-
|
|
10
|
-
function testRuntime(reader: GitHubReader): {
|
|
11
|
-
readonly runtime: CliRuntime;
|
|
12
|
-
readonly stdout: string[];
|
|
13
|
-
readonly stderr: string[];
|
|
14
|
-
} {
|
|
15
|
-
const stdout: string[] = [];
|
|
16
|
-
const stderr: string[] = [];
|
|
17
|
-
return {
|
|
18
|
-
stdout,
|
|
19
|
-
stderr,
|
|
20
|
-
runtime: {
|
|
21
|
-
reader,
|
|
22
|
-
clock: {
|
|
23
|
-
now: () => 0,
|
|
24
|
-
observedAt: () => "2026-07-26T00:00:00.000Z",
|
|
25
|
-
async sleep() {
|
|
26
|
-
throw new Error("test unexpectedly slept");
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
stdout: (value) => stdout.push(value),
|
|
30
|
-
stderr: (value) => stderr.push(value),
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
describe("parseArgs", () => {
|
|
36
|
-
it("uses the specified defaults", () => {
|
|
37
|
-
expect(parseArgs([], silentIo)).toMatchObject({
|
|
38
|
-
owner: null,
|
|
39
|
-
repo: null,
|
|
40
|
-
pr: null,
|
|
41
|
-
mode: "single",
|
|
42
|
-
stackPrs: [],
|
|
43
|
-
statusOnly: false,
|
|
44
|
-
pretty: false,
|
|
45
|
-
polling: {
|
|
46
|
-
interval: 60,
|
|
47
|
-
sweepInterval: 300,
|
|
48
|
-
timeout: 0,
|
|
49
|
-
maxQueryErrors: 5,
|
|
50
|
-
allowDraft: false,
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("parses a frozen queued stack bottom-to-top", () => {
|
|
56
|
-
const parsed = parseArgs(
|
|
57
|
-
[
|
|
58
|
-
"--queued-stack",
|
|
59
|
-
"--stack-prs",
|
|
60
|
-
"#10, 11,#12",
|
|
61
|
-
"--interval",
|
|
62
|
-
"2.5",
|
|
63
|
-
"--sweep-interval",
|
|
64
|
-
"30",
|
|
65
|
-
"--timeout",
|
|
66
|
-
"0",
|
|
67
|
-
"--max-query-errors",
|
|
68
|
-
"3",
|
|
69
|
-
"--allow-draft",
|
|
70
|
-
"--pretty",
|
|
71
|
-
],
|
|
72
|
-
silentIo
|
|
73
|
-
);
|
|
74
|
-
expect(parsed.mode).toBe("queued-stack");
|
|
75
|
-
expect(parsed.stackPrs.map(Number)).toEqual([10, 11, 12]);
|
|
76
|
-
expect(parsed.polling).toEqual({
|
|
77
|
-
interval: 2.5,
|
|
78
|
-
sweepInterval: 30,
|
|
79
|
-
timeout: 0,
|
|
80
|
-
maxQueryErrors: 3,
|
|
81
|
-
allowDraft: true,
|
|
82
|
-
});
|
|
83
|
-
expect(parsed.pretty).toBe(true);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("rejects every invalid mode and numeric shape as usage", async () => {
|
|
87
|
-
const invalid = [
|
|
88
|
-
["--unknown"],
|
|
89
|
-
["--interval", "0"],
|
|
90
|
-
["--sweep-interval", "-1"],
|
|
91
|
-
["--timeout", "-1"],
|
|
92
|
-
["--max-query-errors", "1.5"],
|
|
93
|
-
["--stack", "--queued-stack"],
|
|
94
|
-
["--stack-prs", "1,2"],
|
|
95
|
-
["--queued-stack", "--stack-prs", "1,1"],
|
|
96
|
-
];
|
|
97
|
-
for (const argv of invalid) {
|
|
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
|
-
|
|
106
|
-
describe("rendering", () => {
|
|
107
|
-
const context = {
|
|
108
|
-
owner: "owner",
|
|
109
|
-
repo: "repo",
|
|
110
|
-
number: parsePrNumber(1),
|
|
111
|
-
};
|
|
112
|
-
const status = {
|
|
113
|
-
schemaVersion: 1,
|
|
114
|
-
sequence: 1,
|
|
115
|
-
observedAt: "2026-07-26T00:00:00.000Z",
|
|
116
|
-
mode: "single",
|
|
117
|
-
kind: "STATUS",
|
|
118
|
-
terminal: true,
|
|
119
|
-
exitCode: 0,
|
|
120
|
-
reason: "status-only",
|
|
121
|
-
rows: [
|
|
122
|
-
{
|
|
123
|
-
kind: "merged",
|
|
124
|
-
context,
|
|
125
|
-
facts: {
|
|
126
|
-
context,
|
|
127
|
-
mergeable: "MERGEABLE",
|
|
128
|
-
mergeStateStatus: "CLEAN",
|
|
129
|
-
reviewDecision: "APPROVED",
|
|
130
|
-
headRefOid: "head",
|
|
131
|
-
headRefName: "feature",
|
|
132
|
-
baseRefName: "main",
|
|
133
|
-
state: "MERGED",
|
|
134
|
-
mergedAt: "now",
|
|
135
|
-
isDraft: false,
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
} satisfies WatcherVerdict;
|
|
140
|
-
|
|
141
|
-
it("emits compact valid JSON by default", () => {
|
|
142
|
-
const rendered = renderJson(status);
|
|
143
|
-
expect(rendered.endsWith("\n")).toBe(true);
|
|
144
|
-
expect(JSON.parse(rendered)).toEqual(status);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it("renders the Markdown table from the same verdict only", () => {
|
|
148
|
-
const rendered = renderPretty(status);
|
|
149
|
-
expect(rendered).toContain("| PR | CI | Review | Merge |");
|
|
150
|
-
expect(rendered).toContain(
|
|
151
|
-
"| [#1](https://github.com/owner/repo/pull/1) | \u2014 | \u2014 | ✅ merged |"
|
|
152
|
-
);
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
describe("main", () => {
|
|
157
|
-
it("returns EX_USAGE 64 and writes usage errors only to stderr", async () => {
|
|
158
|
-
const harness = testRuntime(fakeReader());
|
|
159
|
-
expect(await main(["--interval", "0"], harness.runtime)).toBe(64);
|
|
160
|
-
expect(harness.stdout).toEqual([]);
|
|
161
|
-
expect(harness.stderr.join("")).toContain(
|
|
162
|
-
"option '--interval <seconds>' argument '0' is invalid"
|
|
163
|
-
);
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it("bypasses the queue machine for queued-stack status-only", async () => {
|
|
167
|
-
const reader = fakeReader();
|
|
168
|
-
const harness = testRuntime(reader);
|
|
169
|
-
const code = await main(
|
|
170
|
-
[
|
|
171
|
-
"--owner",
|
|
172
|
-
"owner",
|
|
173
|
-
"--repo",
|
|
174
|
-
"repo",
|
|
175
|
-
"--queued-stack",
|
|
176
|
-
"--stack-prs",
|
|
177
|
-
"1",
|
|
178
|
-
"--status-only",
|
|
179
|
-
],
|
|
180
|
-
harness.runtime
|
|
181
|
-
);
|
|
182
|
-
expect(code).toBe(0);
|
|
183
|
-
expect(harness.stdout).toHaveLength(1);
|
|
184
|
-
const verdict: unknown = JSON.parse(harness.stdout[0]);
|
|
185
|
-
expect(verdict).toMatchObject({
|
|
186
|
-
kind: "STATUS",
|
|
187
|
-
terminal: true,
|
|
188
|
-
exitCode: 0,
|
|
189
|
-
mode: "queued-stack",
|
|
190
|
-
});
|
|
191
|
-
expect(harness.stdout[0]).not.toContain('"kind":"QUEUE"');
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it("returns exit 4 for a hidden GitHub-side CI refusal", async () => {
|
|
195
|
-
const reader = fakeReader({
|
|
196
|
-
facts: { mergeStateStatus: "BLOCKED" },
|
|
197
|
-
fastPath: { kind: "checks", checks: [passingCheck()] },
|
|
198
|
-
commitRollups: [{ oid: "head", state: "FAILURE" }],
|
|
199
|
-
});
|
|
200
|
-
const harness = testRuntime(reader);
|
|
201
|
-
const code = await main(
|
|
202
|
-
["--owner", "owner", "--repo", "repo", "--pr", "1"],
|
|
203
|
-
harness.runtime
|
|
204
|
-
);
|
|
205
|
-
expect(code).toBe(4);
|
|
206
|
-
expect(harness.stdout).toHaveLength(1);
|
|
207
|
-
expect(JSON.parse(harness.stdout[0])).toMatchObject({
|
|
208
|
-
kind: "BLOCKER",
|
|
209
|
-
exitCode: 4,
|
|
210
|
-
blocker: {
|
|
211
|
-
kind: "failing-checks",
|
|
212
|
-
ci: { kind: "ci-github-rejected" },
|
|
213
|
-
},
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it("shows help without touching the reader", async () => {
|
|
218
|
-
const reader = fakeReader();
|
|
219
|
-
const harness = testRuntime(reader);
|
|
220
|
-
expect(await main(["--help"], harness.runtime)).toBe(0);
|
|
221
|
-
expect(harness.stdout.join("")).toContain("JSON (NDJSON while polling)");
|
|
222
|
-
expect(reader.calls).toEqual([]);
|
|
223
|
-
});
|
|
224
|
-
});
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { setTimeout as delay } from "node:timers/promises";
|
|
2
|
-
import {
|
|
3
|
-
Command,
|
|
4
|
-
CommanderError,
|
|
5
|
-
InvalidArgumentError,
|
|
6
|
-
Option,
|
|
7
|
-
} from "commander";
|
|
8
|
-
import {
|
|
9
|
-
GhGitHubReader,
|
|
10
|
-
WatcherQueryError,
|
|
11
|
-
discoverStack,
|
|
12
|
-
resolveContext,
|
|
13
|
-
} from "./github.ts";
|
|
14
|
-
import {
|
|
15
|
-
runQueued,
|
|
16
|
-
runSimple,
|
|
17
|
-
statusQueryVerdict,
|
|
18
|
-
verdictFactory,
|
|
19
|
-
type WatchClock,
|
|
20
|
-
} from "./policy.ts";
|
|
21
|
-
import { renderJson, renderPretty } from "./render.ts";
|
|
22
|
-
import type * as T from "./types.ts";
|
|
23
|
-
import { nonEmpty, parsePrNumber } from "./types.ts";
|
|
24
|
-
export interface CliOptions {
|
|
25
|
-
readonly owner: string | null;
|
|
26
|
-
readonly repo: string | null;
|
|
27
|
-
readonly pr: T.PrNumber | null;
|
|
28
|
-
readonly mode: T.WatchMode;
|
|
29
|
-
readonly stackPrs: readonly T.PrNumber[];
|
|
30
|
-
readonly statusOnly: boolean;
|
|
31
|
-
readonly pretty: boolean;
|
|
32
|
-
readonly polling: T.PollingOptions;
|
|
33
|
-
}
|
|
34
|
-
function positiveNumber(value: string): number {
|
|
35
|
-
const parsed = Number(value);
|
|
36
|
-
if (!Number.isFinite(parsed) || parsed <= 0)
|
|
37
|
-
throw new InvalidArgumentError("must be greater than zero");
|
|
38
|
-
return parsed;
|
|
39
|
-
}
|
|
40
|
-
function nonNegativeNumber(value: string): number {
|
|
41
|
-
const parsed = Number(value);
|
|
42
|
-
if (!Number.isFinite(parsed) || parsed < 0)
|
|
43
|
-
throw new InvalidArgumentError("must be zero or greater");
|
|
44
|
-
return parsed;
|
|
45
|
-
}
|
|
46
|
-
function positiveInteger(value: string): number {
|
|
47
|
-
const parsed = Number(value);
|
|
48
|
-
if (!Number.isInteger(parsed) || parsed <= 0)
|
|
49
|
-
throw new InvalidArgumentError("must be a positive integer");
|
|
50
|
-
return parsed;
|
|
51
|
-
}
|
|
52
|
-
function prNumber(value: string): T.PrNumber {
|
|
53
|
-
try {
|
|
54
|
-
return parsePrNumber(Number(value.replace(/^#/, "")));
|
|
55
|
-
} catch {
|
|
56
|
-
throw new InvalidArgumentError("must be a positive integer");
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function stackPrList(value: string): T.NonEmpty<T.PrNumber> {
|
|
60
|
-
const numbers = value.split(",").map((part) => prNumber(part.trim()));
|
|
61
|
-
if (new Set(numbers).size !== numbers.length)
|
|
62
|
-
throw new InvalidArgumentError("contains a duplicate PR");
|
|
63
|
-
const parsed = nonEmpty(numbers);
|
|
64
|
-
if (parsed === null) throw new InvalidArgumentError("cannot be empty");
|
|
65
|
-
return parsed;
|
|
66
|
-
}
|
|
67
|
-
interface RawOptions {
|
|
68
|
-
readonly owner?: string;
|
|
69
|
-
readonly repo?: string;
|
|
70
|
-
readonly pr?: T.PrNumber;
|
|
71
|
-
readonly stack: boolean;
|
|
72
|
-
readonly queuedStack: boolean;
|
|
73
|
-
readonly stackPrs?: T.NonEmpty<T.PrNumber>;
|
|
74
|
-
readonly interval: number;
|
|
75
|
-
readonly sweepInterval: number;
|
|
76
|
-
readonly timeout: number;
|
|
77
|
-
readonly maxQueryErrors: number;
|
|
78
|
-
readonly statusOnly: boolean;
|
|
79
|
-
readonly allowDraft: boolean;
|
|
80
|
-
readonly pretty: boolean;
|
|
81
|
-
}
|
|
82
|
-
export function parseArgs(
|
|
83
|
-
argv: readonly string[],
|
|
84
|
-
io: Pick<CliRuntime, "stdout" | "stderr">
|
|
85
|
-
): CliOptions {
|
|
86
|
-
const program = new Command("watch-pr")
|
|
87
|
-
.description(
|
|
88
|
-
"Watch one pull request, a connected stack, or an immutable queued stack.\nJSON (NDJSON while polling) is the default; --pretty renders human text."
|
|
89
|
-
)
|
|
90
|
-
.configureOutput({ writeOut: io.stdout, writeErr: io.stderr })
|
|
91
|
-
.exitOverride()
|
|
92
|
-
.option("--owner <owner>", "GitHub repository owner")
|
|
93
|
-
.option("--repo <repo>", "GitHub repository name")
|
|
94
|
-
.option("--pr <number>", "pull request number", prNumber)
|
|
95
|
-
.addOption(
|
|
96
|
-
new Option("--stack", "watch the connected open stack")
|
|
97
|
-
.default(false)
|
|
98
|
-
.conflicts("queuedStack")
|
|
99
|
-
)
|
|
100
|
-
.option(
|
|
101
|
-
"--queued-stack",
|
|
102
|
-
"watch the captured stack until all PRs merge",
|
|
103
|
-
false
|
|
104
|
-
)
|
|
105
|
-
.option(
|
|
106
|
-
"--stack-prs <n,...>",
|
|
107
|
-
"frozen bottom-to-top queue (queued mode only)",
|
|
108
|
-
stackPrList
|
|
109
|
-
)
|
|
110
|
-
.option("--interval <seconds>", "poll interval", positiveNumber, 60)
|
|
111
|
-
.option(
|
|
112
|
-
"--sweep-interval <seconds>",
|
|
113
|
-
"whole-stack sweep interval",
|
|
114
|
-
positiveNumber,
|
|
115
|
-
300
|
|
116
|
-
)
|
|
117
|
-
.option(
|
|
118
|
-
"--timeout <seconds>",
|
|
119
|
-
"deadline; 0 disables it",
|
|
120
|
-
nonNegativeNumber,
|
|
121
|
-
0
|
|
122
|
-
)
|
|
123
|
-
.option(
|
|
124
|
-
"--max-query-errors <count>",
|
|
125
|
-
"consecutive query-error budget",
|
|
126
|
-
positiveInteger,
|
|
127
|
-
5
|
|
128
|
-
)
|
|
129
|
-
.option("--status-only", "print one status table and exit 0", false)
|
|
130
|
-
.option("--allow-draft", "do not treat a draft as a merge gate", false)
|
|
131
|
-
.option("--pretty", "render human text instead of JSON", false);
|
|
132
|
-
program.parse(argv, { from: "user" });
|
|
133
|
-
const raw = program.opts<RawOptions>();
|
|
134
|
-
if (raw.stackPrs !== undefined && !raw.queuedStack)
|
|
135
|
-
program.error("error: --stack-prs requires --queued-stack");
|
|
136
|
-
return {
|
|
137
|
-
owner: raw.owner ?? null,
|
|
138
|
-
repo: raw.repo ?? null,
|
|
139
|
-
pr: raw.pr ?? null,
|
|
140
|
-
mode: raw.queuedStack ? "queued-stack" : raw.stack ? "stack" : "single",
|
|
141
|
-
stackPrs: raw.stackPrs ?? [],
|
|
142
|
-
statusOnly: raw.statusOnly,
|
|
143
|
-
pretty: raw.pretty,
|
|
144
|
-
polling: {
|
|
145
|
-
interval: raw.interval,
|
|
146
|
-
sweepInterval: raw.sweepInterval,
|
|
147
|
-
timeout: raw.timeout,
|
|
148
|
-
maxQueryErrors: raw.maxQueryErrors,
|
|
149
|
-
allowDraft: raw.allowDraft,
|
|
150
|
-
},
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
export interface CliRuntime {
|
|
154
|
-
readonly reader: T.GitHubReader;
|
|
155
|
-
readonly clock: WatchClock;
|
|
156
|
-
readonly stdout: (value: string) => void;
|
|
157
|
-
readonly stderr: (value: string) => void;
|
|
158
|
-
}
|
|
159
|
-
function realRuntime(): CliRuntime {
|
|
160
|
-
return {
|
|
161
|
-
reader: new GhGitHubReader(),
|
|
162
|
-
clock: {
|
|
163
|
-
now: () => performance.now() / 1_000,
|
|
164
|
-
observedAt: () => new Date().toISOString(),
|
|
165
|
-
sleep: async (seconds) => {
|
|
166
|
-
await delay(seconds * 1_000);
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
stdout: (value) => process.stdout.write(value),
|
|
170
|
-
stderr: (value) => process.stderr.write(value),
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
export async function main(
|
|
174
|
-
argv: readonly string[],
|
|
175
|
-
runtime: CliRuntime = realRuntime()
|
|
176
|
-
): Promise<number> {
|
|
177
|
-
let options: CliOptions;
|
|
178
|
-
try {
|
|
179
|
-
options = parseArgs(argv, runtime);
|
|
180
|
-
} catch (error) {
|
|
181
|
-
if (!(error instanceof CommanderError)) throw error;
|
|
182
|
-
return error.exitCode === 0 ? 0 : 64;
|
|
183
|
-
}
|
|
184
|
-
const render = options.pretty ? renderPretty : renderJson;
|
|
185
|
-
const emit = (verdict: T.ProgressVerdict): void =>
|
|
186
|
-
runtime.stdout(render(verdict));
|
|
187
|
-
let contexts: T.NonEmpty<T.PrContext>;
|
|
188
|
-
try {
|
|
189
|
-
const seed = await resolveContext({
|
|
190
|
-
reader: runtime.reader,
|
|
191
|
-
owner: options.owner,
|
|
192
|
-
repo: options.repo,
|
|
193
|
-
pr: options.pr ?? options.stackPrs[0] ?? null,
|
|
194
|
-
});
|
|
195
|
-
contexts =
|
|
196
|
-
nonEmpty(options.stackPrs.map((number) => ({ ...seed, number }))) ??
|
|
197
|
-
(options.mode === "single"
|
|
198
|
-
? [seed]
|
|
199
|
-
: await discoverStack(runtime.reader, seed));
|
|
200
|
-
} catch (error) {
|
|
201
|
-
if (!(error instanceof WatcherQueryError)) throw error;
|
|
202
|
-
const verdict = statusQueryVerdict(
|
|
203
|
-
verdictFactory(runtime.clock, options.mode),
|
|
204
|
-
1,
|
|
205
|
-
error.failure
|
|
206
|
-
);
|
|
207
|
-
runtime.stdout(render(verdict));
|
|
208
|
-
return verdict.exitCode;
|
|
209
|
-
}
|
|
210
|
-
const dependencies = { reader: runtime.reader, clock: runtime.clock, emit };
|
|
211
|
-
const verdict =
|
|
212
|
-
options.mode === "queued-stack" && !options.statusOnly
|
|
213
|
-
? await runQueued({ dependencies, contexts, options: options.polling })
|
|
214
|
-
: await runSimple({
|
|
215
|
-
dependencies,
|
|
216
|
-
contexts,
|
|
217
|
-
mode: options.mode,
|
|
218
|
-
statusOnly: options.statusOnly,
|
|
219
|
-
options: options.polling,
|
|
220
|
-
});
|
|
221
|
-
runtime.stdout(render(verdict));
|
|
222
|
-
return verdict.exitCode;
|
|
223
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
Check,
|
|
3
|
-
ChecksFastPath,
|
|
4
|
-
CommitRollup,
|
|
5
|
-
GitHubReader,
|
|
6
|
-
OpenPullRequest,
|
|
7
|
-
PrContext,
|
|
8
|
-
PullRequestFacts,
|
|
9
|
-
Repository,
|
|
10
|
-
RawReviewThread,
|
|
11
|
-
ReviewThread,
|
|
12
|
-
ReviewThreadPage,
|
|
13
|
-
RollupPage,
|
|
14
|
-
} from "./types.ts";
|
|
15
|
-
import { parsePrNumber } from "./types.ts";
|
|
16
|
-
|
|
17
|
-
export interface FakeReaderOptions {
|
|
18
|
-
readonly facts?: Partial<Omit<PullRequestFacts, "context">>;
|
|
19
|
-
readonly fastPath?: ChecksFastPath;
|
|
20
|
-
readonly rollupPages?: readonly RollupPage[];
|
|
21
|
-
readonly threads?: readonly ReviewThread[];
|
|
22
|
-
readonly threadPages?: readonly ReviewThreadPage[];
|
|
23
|
-
readonly commitRollups?: readonly CommitRollup[];
|
|
24
|
-
readonly openPullRequests?: readonly OpenPullRequest[];
|
|
25
|
-
readonly origin?: Repository | null;
|
|
26
|
-
readonly current?: PrContext;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function toRawThread(thread: ReviewThread): RawReviewThread {
|
|
30
|
-
return { id: thread.id, firstComment: thread.firstComment, resolved: false };
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function passingCheck(name = "ci"): Check {
|
|
34
|
-
return {
|
|
35
|
-
kind: "passed",
|
|
36
|
-
name,
|
|
37
|
-
reportedState: "SUCCESS",
|
|
38
|
-
description: "",
|
|
39
|
-
link: "",
|
|
40
|
-
workflow: "",
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function pendingCheck(name = "ci"): Check {
|
|
45
|
-
return {
|
|
46
|
-
kind: "pending",
|
|
47
|
-
name,
|
|
48
|
-
reportedState: "PENDING",
|
|
49
|
-
description: "",
|
|
50
|
-
link: "",
|
|
51
|
-
workflow: "",
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function failedCheck(name = "ci"): Check {
|
|
56
|
-
return {
|
|
57
|
-
kind: "failed",
|
|
58
|
-
name,
|
|
59
|
-
reportedState: "FAILURE",
|
|
60
|
-
description: "",
|
|
61
|
-
link: "",
|
|
62
|
-
workflow: "",
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function fakeReader(
|
|
67
|
-
options: FakeReaderOptions = {}
|
|
68
|
-
): GitHubReader & { readonly calls: readonly string[] } {
|
|
69
|
-
const calls: string[] = [];
|
|
70
|
-
const context = options.current ?? {
|
|
71
|
-
owner: "owner",
|
|
72
|
-
repo: "repo",
|
|
73
|
-
number: parsePrNumber(1),
|
|
74
|
-
};
|
|
75
|
-
const defaults: PullRequestFacts = {
|
|
76
|
-
context,
|
|
77
|
-
mergeable: "MERGEABLE",
|
|
78
|
-
mergeStateStatus: "CLEAN",
|
|
79
|
-
reviewDecision: "APPROVED",
|
|
80
|
-
headRefOid: "head",
|
|
81
|
-
headRefName: "feature",
|
|
82
|
-
baseRefName: "main",
|
|
83
|
-
state: "OPEN",
|
|
84
|
-
mergedAt: null,
|
|
85
|
-
isDraft: false,
|
|
86
|
-
};
|
|
87
|
-
let page = 0;
|
|
88
|
-
let threadPage = 0;
|
|
89
|
-
return {
|
|
90
|
-
calls,
|
|
91
|
-
async originRepo() {
|
|
92
|
-
calls.push("originRepo");
|
|
93
|
-
return options.origin === undefined
|
|
94
|
-
? { owner: "owner", repo: "repo" }
|
|
95
|
-
: options.origin;
|
|
96
|
-
},
|
|
97
|
-
async currentPr(pr) {
|
|
98
|
-
calls.push("currentPr");
|
|
99
|
-
return { ...context, number: pr ?? context.number };
|
|
100
|
-
},
|
|
101
|
-
async pullRequest(requested) {
|
|
102
|
-
calls.push("pullRequest");
|
|
103
|
-
return { ...defaults, ...options.facts, context: requested };
|
|
104
|
-
},
|
|
105
|
-
async openPullRequests() {
|
|
106
|
-
calls.push("openPullRequests");
|
|
107
|
-
return options.openPullRequests ?? [];
|
|
108
|
-
},
|
|
109
|
-
async checksFastPath() {
|
|
110
|
-
calls.push("checksFastPath");
|
|
111
|
-
return options.fastPath ?? { kind: "checks", checks: [passingCheck()] };
|
|
112
|
-
},
|
|
113
|
-
async checkRollupPage(_requested, after) {
|
|
114
|
-
calls.push(`checkRollupPage:${after ?? "null"}`);
|
|
115
|
-
return options.rollupPages?.[page++] ?? { checks: [], endCursor: null };
|
|
116
|
-
},
|
|
117
|
-
async reviewThreadPage(_requested, after) {
|
|
118
|
-
calls.push(`reviewThreadPage:${after ?? "null"}`);
|
|
119
|
-
return options.threadPages?.[threadPage++] ?? {
|
|
120
|
-
threads: (options.threads ?? []).map(toRawThread),
|
|
121
|
-
endCursor: null,
|
|
122
|
-
};
|
|
123
|
-
},
|
|
124
|
-
async commitRollups() {
|
|
125
|
-
calls.push("commitRollups");
|
|
126
|
-
return options.commitRollups ?? [{ oid: "head", state: "SUCCESS" }];
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
}
|