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,436 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "bun:test";
|
|
2
|
-
import {
|
|
3
|
-
ChecksUnavailable,
|
|
4
|
-
WatcherQueryError,
|
|
5
|
-
buildReviewThreads,
|
|
6
|
-
mapRollupNode,
|
|
7
|
-
orderStack,
|
|
8
|
-
parseFastCheck,
|
|
9
|
-
parsePullRequest,
|
|
10
|
-
parseReviewThreadPage,
|
|
11
|
-
resolveChecks,
|
|
12
|
-
resolveContext,
|
|
13
|
-
resolveReviewThreads,
|
|
14
|
-
} from "./github.ts";
|
|
15
|
-
import {
|
|
16
|
-
fakeReader,
|
|
17
|
-
failedCheck,
|
|
18
|
-
passingCheck,
|
|
19
|
-
pendingCheck,
|
|
20
|
-
} from "./fakes.test-helper.ts";
|
|
21
|
-
import { parsePrNumber } from "./types.ts";
|
|
22
|
-
|
|
23
|
-
const context = {
|
|
24
|
-
owner: "owner",
|
|
25
|
-
repo: "repo",
|
|
26
|
-
number: parsePrNumber(42),
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
describe("checks fallback chain", () => {
|
|
30
|
-
it("uses a non-empty fast-path result without a rollup query", async () => {
|
|
31
|
-
const reader = fakeReader({
|
|
32
|
-
fastPath: { kind: "checks", checks: [passingCheck("fast")] },
|
|
33
|
-
});
|
|
34
|
-
const read = await resolveChecks(reader, context);
|
|
35
|
-
expect(read.source).toBe("gh-pr-checks");
|
|
36
|
-
expect(read.checks.map((check) => check.name)).toEqual(["fast"]);
|
|
37
|
-
expect(reader.calls).toEqual(["checksFastPath"]);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("paginates GraphQL when the fast path is unusable", async () => {
|
|
41
|
-
const reader = fakeReader({
|
|
42
|
-
fastPath: { kind: "unusable", exitCode: 8, stderr: "" },
|
|
43
|
-
rollupPages: [
|
|
44
|
-
{ checks: [passingCheck("first")], endCursor: "next" },
|
|
45
|
-
{ checks: [failedCheck("second")], endCursor: null },
|
|
46
|
-
],
|
|
47
|
-
});
|
|
48
|
-
const read = await resolveChecks(reader, context);
|
|
49
|
-
expect(read.source).toBe("graphql-rollup");
|
|
50
|
-
expect(read.checks.map((check) => check.name)).toEqual(["first", "second"]);
|
|
51
|
-
expect(reader.calls).toEqual([
|
|
52
|
-
"checksFastPath",
|
|
53
|
-
"checkRollupPage:null",
|
|
54
|
-
"checkRollupPage:next",
|
|
55
|
-
]);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it("falls back when valid fast-path JSON represented an empty list", async () => {
|
|
59
|
-
const reader = fakeReader({
|
|
60
|
-
fastPath: { kind: "checks", checks: [] },
|
|
61
|
-
rollupPages: [{ checks: [pendingCheck("fallback")], endCursor: null }],
|
|
62
|
-
});
|
|
63
|
-
expect((await resolveChecks(reader, context)).checks[0].name).toBe(
|
|
64
|
-
"fallback"
|
|
65
|
-
);
|
|
66
|
-
expect(reader.calls).toEqual(["checksFastPath", "checkRollupPage:null"]);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it("fails closed when both paths are empty", async () => {
|
|
70
|
-
const reader = fakeReader({
|
|
71
|
-
fastPath: {
|
|
72
|
-
kind: "unusable",
|
|
73
|
-
exitCode: 8,
|
|
74
|
-
stderr: "credential cannot read checks",
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
await expect(resolveChecks(reader, context)).rejects.toBeInstanceOf(
|
|
78
|
-
ChecksUnavailable
|
|
79
|
-
);
|
|
80
|
-
expect(reader.calls).toEqual(["checksFastPath", "checkRollupPage:null"]);
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
describe("rollup node mapping", () => {
|
|
85
|
-
it("maps terminal and non-terminal CheckRun states fail closed", () => {
|
|
86
|
-
const cases = [
|
|
87
|
-
["IN_PROGRESS", null, "pending", "PENDING"],
|
|
88
|
-
["COMPLETED", "SUCCESS", "passed", "SUCCESS"],
|
|
89
|
-
["COMPLETED", "NEUTRAL", "skipped", "NEUTRAL"],
|
|
90
|
-
["COMPLETED", "SKIPPED", "skipped", "SKIPPED"],
|
|
91
|
-
["COMPLETED", "ACTION_REQUIRED", "failed", "ACTION_REQUIRED"],
|
|
92
|
-
["COMPLETED", "TIMED_OUT", "failed", "FAILURE"],
|
|
93
|
-
["COMPLETED", "FUTURE_VALUE", "failed", "FAILURE"],
|
|
94
|
-
] as const;
|
|
95
|
-
for (const [status, conclusion, kind, reportedState] of cases) {
|
|
96
|
-
expect(
|
|
97
|
-
mapRollupNode({
|
|
98
|
-
__typename: "CheckRun",
|
|
99
|
-
name: "ci",
|
|
100
|
-
status,
|
|
101
|
-
conclusion,
|
|
102
|
-
})
|
|
103
|
-
).toMatchObject({ kind, reportedState });
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it("classifies an in-progress Code Review Gate from the rollup as the gate", () => {
|
|
108
|
-
expect(
|
|
109
|
-
mapRollupNode({
|
|
110
|
-
__typename: "CheckRun",
|
|
111
|
-
name: "Code Review Gate",
|
|
112
|
-
status: "IN_PROGRESS",
|
|
113
|
-
conclusion: null,
|
|
114
|
-
})
|
|
115
|
-
).toMatchObject({ kind: "code-review-gate" });
|
|
116
|
-
expect(
|
|
117
|
-
mapRollupNode({
|
|
118
|
-
__typename: "StatusContext",
|
|
119
|
-
context: "Code Review Gate",
|
|
120
|
-
state: "PENDING",
|
|
121
|
-
})
|
|
122
|
-
).toMatchObject({ kind: "code-review-gate" });
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it("classifies a Code Review Gate waiting on an owner approval as the gate", () => {
|
|
126
|
-
expect(
|
|
127
|
-
mapRollupNode({
|
|
128
|
-
__typename: "CheckRun",
|
|
129
|
-
name: "Code Review Gate",
|
|
130
|
-
status: "COMPLETED",
|
|
131
|
-
conclusion: "ACTION_REQUIRED",
|
|
132
|
-
description: "1 of 2 policies",
|
|
133
|
-
})
|
|
134
|
-
).toMatchObject({
|
|
135
|
-
kind: "code-review-gate",
|
|
136
|
-
reportedState: "ACTION_REQUIRED",
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it("classifies a fast-path Code Review Gate waiting on an owner approval as the gate", () => {
|
|
141
|
-
expect(
|
|
142
|
-
parseFastCheck({
|
|
143
|
-
name: "Code Review Gate",
|
|
144
|
-
state: "ACTION_REQUIRED",
|
|
145
|
-
bucket: "fail",
|
|
146
|
-
})
|
|
147
|
-
).toMatchObject({
|
|
148
|
-
kind: "code-review-gate",
|
|
149
|
-
reportedState: "ACTION_REQUIRED",
|
|
150
|
-
});
|
|
151
|
-
expect(
|
|
152
|
-
parseFastCheck({ name: "ci", state: "ACTION_REQUIRED", bucket: "fail" })
|
|
153
|
-
).toMatchObject({ kind: "failed", reportedState: "ACTION_REQUIRED" });
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("maps StatusContext states and drops unknown typenames", () => {
|
|
157
|
-
expect(
|
|
158
|
-
mapRollupNode({
|
|
159
|
-
__typename: "StatusContext",
|
|
160
|
-
context: "ci",
|
|
161
|
-
state: "EXPECTED",
|
|
162
|
-
})
|
|
163
|
-
).toMatchObject({ kind: "pending", reportedState: "PENDING" });
|
|
164
|
-
expect(
|
|
165
|
-
mapRollupNode({
|
|
166
|
-
__typename: "StatusContext",
|
|
167
|
-
context: "ci",
|
|
168
|
-
state: "FUTURE_VALUE",
|
|
169
|
-
})
|
|
170
|
-
).toMatchObject({ kind: "failed", reportedState: "FUTURE_VALUE" });
|
|
171
|
-
expect(mapRollupNode({ __typename: "FutureNode" })).toBeNull();
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
describe("closed enum parsing", () => {
|
|
176
|
-
const rawPullRequest = {
|
|
177
|
-
mergeable: "MERGEABLE",
|
|
178
|
-
mergeStateStatus: "CLEAN",
|
|
179
|
-
reviewDecision: "APPROVED",
|
|
180
|
-
headRefOid: "head",
|
|
181
|
-
headRefName: "feature",
|
|
182
|
-
baseRefName: "main",
|
|
183
|
-
state: "OPEN",
|
|
184
|
-
mergedAt: null,
|
|
185
|
-
isDraft: false,
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
it("accepts mergeStateStatus CONFLICTING", () => {
|
|
189
|
-
expect(
|
|
190
|
-
parsePullRequest(
|
|
191
|
-
{ ...rawPullRequest, mergeStateStatus: "CONFLICTING" },
|
|
192
|
-
context
|
|
193
|
-
).mergeStateStatus
|
|
194
|
-
).toBe("CONFLICTING");
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
it("reads gh's empty reviewDecision as no decision rather than a parse failure", () => {
|
|
198
|
-
expect(
|
|
199
|
-
parsePullRequest({ ...rawPullRequest, reviewDecision: "" }, context)
|
|
200
|
-
.reviewDecision
|
|
201
|
-
).toBeNull();
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
it("still rejects an unknown reviewDecision", () => {
|
|
205
|
-
expect(() =>
|
|
206
|
-
parsePullRequest({ ...rawPullRequest, reviewDecision: "MAYBE" }, context)
|
|
207
|
-
).toThrow(WatcherQueryError);
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it("rejects unknown enum values as retryable errors carrying the raw value", () => {
|
|
211
|
-
try {
|
|
212
|
-
parsePullRequest(
|
|
213
|
-
{ ...rawPullRequest, mergeStateStatus: "FUTURE_STATE" },
|
|
214
|
-
context
|
|
215
|
-
);
|
|
216
|
-
throw new Error("expected parser to throw");
|
|
217
|
-
} catch (error) {
|
|
218
|
-
expect(error).toBeInstanceOf(WatcherQueryError);
|
|
219
|
-
if (!(error instanceof WatcherQueryError)) throw error;
|
|
220
|
-
expect(error.failure).toMatchObject({
|
|
221
|
-
kind: "missing-key",
|
|
222
|
-
retryable: true,
|
|
223
|
-
rawValue: '"FUTURE_STATE"',
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
it("annotates Bugbot threads with distinct review-pass counts", () => {
|
|
230
|
-
const response = {
|
|
231
|
-
data: {
|
|
232
|
-
repository: {
|
|
233
|
-
pullRequest: {
|
|
234
|
-
reviewThreads: {
|
|
235
|
-
pageInfo: { hasNextPage: false, endCursor: null },
|
|
236
|
-
nodes: [
|
|
237
|
-
{
|
|
238
|
-
id: "one",
|
|
239
|
-
isResolved: false,
|
|
240
|
-
comments: {
|
|
241
|
-
nodes: [
|
|
242
|
-
{
|
|
243
|
-
body: "RUN_ID: run-1",
|
|
244
|
-
createdAt: "now",
|
|
245
|
-
path: "a.ts",
|
|
246
|
-
line: 1,
|
|
247
|
-
author: { login: "bugbot" },
|
|
248
|
-
},
|
|
249
|
-
],
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
id: "two",
|
|
254
|
-
isResolved: false,
|
|
255
|
-
comments: {
|
|
256
|
-
nodes: [
|
|
257
|
-
{
|
|
258
|
-
body: "CURSOR_AUTOMATION_ID: run-2 severity high",
|
|
259
|
-
createdAt: "now",
|
|
260
|
-
path: null,
|
|
261
|
-
line: null,
|
|
262
|
-
author: { login: "cursor" },
|
|
263
|
-
},
|
|
264
|
-
],
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
id: "resolved",
|
|
269
|
-
isResolved: true,
|
|
270
|
-
comments: {
|
|
271
|
-
nodes: [
|
|
272
|
-
{
|
|
273
|
-
body: "RUN_ID: run-3",
|
|
274
|
-
createdAt: "now",
|
|
275
|
-
path: null,
|
|
276
|
-
line: null,
|
|
277
|
-
author: { login: "bugbot" },
|
|
278
|
-
},
|
|
279
|
-
],
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
],
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
},
|
|
286
|
-
},
|
|
287
|
-
};
|
|
288
|
-
const threads = buildReviewThreads(parseReviewThreadPage(response).threads);
|
|
289
|
-
expect(threads).toHaveLength(2);
|
|
290
|
-
expect(threads.map((thread) => thread.isBugbot)).toEqual([true, true]);
|
|
291
|
-
expect(threads.map((thread) => thread.bugbotReviewPasses)).toEqual([3, 3]);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
describe("review thread pagination", () => {
|
|
295
|
-
const thread = (id: string, resolved = false) => ({
|
|
296
|
-
id,
|
|
297
|
-
firstComment: {
|
|
298
|
-
authorLogin: "someone",
|
|
299
|
-
body: "please fix",
|
|
300
|
-
path: "a.ts",
|
|
301
|
-
line: 1,
|
|
302
|
-
createdAt: "now",
|
|
303
|
-
},
|
|
304
|
-
resolved,
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
it("keeps walking pages until the cursor is exhausted", async () => {
|
|
308
|
-
const reader = fakeReader({
|
|
309
|
-
threadPages: [
|
|
310
|
-
{ threads: [thread("one")], endCursor: "next" },
|
|
311
|
-
{ threads: [thread("two")], endCursor: "last" },
|
|
312
|
-
{ threads: [thread("three")], endCursor: null },
|
|
313
|
-
],
|
|
314
|
-
});
|
|
315
|
-
const threads = await resolveReviewThreads(reader, context);
|
|
316
|
-
expect(threads.map((item) => item.id)).toEqual(["one", "two", "three"]);
|
|
317
|
-
expect(reader.calls).toEqual([
|
|
318
|
-
"reviewThreadPage:null",
|
|
319
|
-
"reviewThreadPage:next",
|
|
320
|
-
"reviewThreadPage:last",
|
|
321
|
-
]);
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
it("sees an unresolved thread that sits past the first page", async () => {
|
|
325
|
-
const reader = fakeReader({
|
|
326
|
-
threadPages: [
|
|
327
|
-
{ threads: [thread("early", true)], endCursor: "next" },
|
|
328
|
-
{ threads: [thread("late")], endCursor: null },
|
|
329
|
-
],
|
|
330
|
-
});
|
|
331
|
-
const threads = await resolveReviewThreads(reader, context);
|
|
332
|
-
expect(threads.map((item) => item.id)).toEqual(["late"]);
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
it("stops after a single page when the cursor is exhausted", async () => {
|
|
336
|
-
const reader = fakeReader({
|
|
337
|
-
threadPages: [{ threads: [thread("only")], endCursor: null }],
|
|
338
|
-
});
|
|
339
|
-
expect((await resolveReviewThreads(reader, context)).length).toBe(1);
|
|
340
|
-
expect(reader.calls).toEqual(["reviewThreadPage:null"]);
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
it("counts Bugbot review passes across every page", async () => {
|
|
344
|
-
const bugbot = (id: string, runId: string) => ({
|
|
345
|
-
id,
|
|
346
|
-
firstComment: {
|
|
347
|
-
authorLogin: "bugbot",
|
|
348
|
-
body: `RUN_ID: ${runId}`,
|
|
349
|
-
path: "a.ts",
|
|
350
|
-
line: 1,
|
|
351
|
-
createdAt: "now",
|
|
352
|
-
},
|
|
353
|
-
resolved: false,
|
|
354
|
-
});
|
|
355
|
-
const reader = fakeReader({
|
|
356
|
-
threadPages: [
|
|
357
|
-
{ threads: [bugbot("one", "run-1")], endCursor: "next" },
|
|
358
|
-
{ threads: [bugbot("two", "run-2")], endCursor: null },
|
|
359
|
-
],
|
|
360
|
-
});
|
|
361
|
-
const threads = await resolveReviewThreads(reader, context);
|
|
362
|
-
expect(threads.map((item) => item.bugbotReviewPasses)).toEqual([2, 2]);
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
it("drops resolved threads from later pages too", async () => {
|
|
366
|
-
const reader = fakeReader({
|
|
367
|
-
threadPages: [
|
|
368
|
-
{ threads: [thread("one")], endCursor: "next" },
|
|
369
|
-
{ threads: [thread("two", true)], endCursor: null },
|
|
370
|
-
],
|
|
371
|
-
});
|
|
372
|
-
expect(
|
|
373
|
-
(await resolveReviewThreads(reader, context)).map((item) => item.id)
|
|
374
|
-
).toEqual(["one"]);
|
|
375
|
-
});
|
|
376
|
-
|
|
377
|
-
it("rejects a page that omits pageInfo instead of assuming one page", async () => {
|
|
378
|
-
const response = {
|
|
379
|
-
data: {
|
|
380
|
-
repository: {
|
|
381
|
-
pullRequest: { reviewThreads: { nodes: [] } },
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
};
|
|
385
|
-
expect(() => parseReviewThreadPage(response)).toThrow(WatcherQueryError);
|
|
386
|
-
});
|
|
387
|
-
});
|
|
388
|
-
|
|
389
|
-
describe("context and stack discovery", () => {
|
|
390
|
-
it("returns a fully explicit context without any reader call", async () => {
|
|
391
|
-
const reader = fakeReader();
|
|
392
|
-
expect(
|
|
393
|
-
await resolveContext({
|
|
394
|
-
reader,
|
|
395
|
-
owner: "explicit",
|
|
396
|
-
repo: "repo",
|
|
397
|
-
pr: context.number,
|
|
398
|
-
})
|
|
399
|
-
).toEqual({ owner: "explicit", repo: "repo", number: context.number });
|
|
400
|
-
expect(reader.calls).toEqual([]);
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
it("uses the local origin before currentPr for an explicit number", async () => {
|
|
404
|
-
const reader = fakeReader({ origin: { owner: "local", repo: "checkout" } });
|
|
405
|
-
expect(
|
|
406
|
-
await resolveContext({
|
|
407
|
-
reader,
|
|
408
|
-
owner: null,
|
|
409
|
-
repo: null,
|
|
410
|
-
pr: context.number,
|
|
411
|
-
})
|
|
412
|
-
).toEqual({ owner: "local", repo: "checkout", number: context.number });
|
|
413
|
-
expect(reader.calls).toEqual(["originRepo"]);
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
it("orders the connected stack bottom-to-top", () => {
|
|
417
|
-
const ordered = orderStack(context, [
|
|
418
|
-
{
|
|
419
|
-
number: parsePrNumber(41),
|
|
420
|
-
headRefName: "base-feature",
|
|
421
|
-
baseRefName: "main",
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
number: context.number,
|
|
425
|
-
headRefName: "feature",
|
|
426
|
-
baseRefName: "base-feature",
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
number: parsePrNumber(43),
|
|
430
|
-
headRefName: "upstack",
|
|
431
|
-
baseRefName: "feature",
|
|
432
|
-
},
|
|
433
|
-
]);
|
|
434
|
-
expect(ordered.map((item) => Number(item.number))).toEqual([41, 42, 43]);
|
|
435
|
-
});
|
|
436
|
-
});
|