raga-cli 0.0.0-stage → 0.9.0
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/CHANGELOG.md +118 -0
- package/LICENSE +21 -0
- package/README.md +162 -2
- package/bundled-skills/AGENTS.md +5 -0
- package/bundled-skills/README.md +25 -0
- package/bundled-skills/agents/comment-sicko.json +9 -0
- package/bundled-skills/agents/comment-sicko.md +28 -0
- package/bundled-skills/agents/model-roles.json +41 -0
- package/bundled-skills/agents/poteto-agent.json +9 -0
- package/bundled-skills/agents/poteto-agent.md +4 -0
- package/bundled-skills/agents/worker.json +8 -0
- package/bundled-skills/agents/worker.md +1 -0
- package/bundled-skills/bundle.json +1514 -0
- package/bundled-skills/dependencies.json +40 -0
- package/bundled-skills/docs/guide/01-setup.md +3 -0
- package/bundled-skills/docs/guide/02-peak.md +135 -0
- package/bundled-skills/docs/guide/03-understand.md +79 -0
- package/bundled-skills/docs/guide/04-design.md +133 -0
- package/bundled-skills/docs/guide/05-build-and-clean.md +83 -0
- package/bundled-skills/docs/guide/06-verify-and-ship.md +166 -0
- package/bundled-skills/docs/guide/07-overnight.md +118 -0
- package/bundled-skills/docs/guide/08-principles.md +72 -0
- package/bundled-skills/docs/guide/09-make-it-yours.md +96 -0
- package/bundled-skills/docs/guide/10-recipes-and-pitfalls.md +180 -0
- package/bundled-skills/docs/guide/README.md +38 -0
- package/bundled-skills/docs/guide/images/design.jpg +0 -0
- package/bundled-skills/docs/guide/images/overnight.jpg +0 -0
- package/bundled-skills/docs/guide/images/recipes.jpg +0 -0
- package/bundled-skills/docs/guide/images/router.jpg +0 -0
- package/bundled-skills/docs/guide/images/understanding.jpg +0 -0
- package/bundled-skills/docs/guide/images/verification.jpg +0 -0
- package/bundled-skills/licenses/commander +22 -0
- package/bundled-skills/licenses/cursor-team-kit +21 -0
- package/bundled-skills/licenses/no-mistakes +21 -0
- package/bundled-skills/licenses/pstack +21 -0
- package/bundled-skills/skills/bend/SKILL.md +58 -0
- package/bundled-skills/skills/bend/bend_tool.py +144 -0
- package/bundled-skills/skills/peak/SKILL.md +184 -0
- package/bundled-skills/skills/peak/playbooks/authoring-a-skill.md +12 -0
- package/bundled-skills/skills/peak/playbooks/autonomous-run.md +13 -0
- package/bundled-skills/skills/peak/playbooks/autopilot-full.md +25 -0
- package/bundled-skills/skills/peak/playbooks/autopilot-stack.md +12 -0
- package/bundled-skills/skills/peak/playbooks/babysit.md +18 -0
- package/bundled-skills/skills/peak/playbooks/bug-fix.md +15 -0
- package/bundled-skills/skills/peak/playbooks/eval.md +25 -0
- package/bundled-skills/skills/peak/playbooks/feature.md +21 -0
- package/bundled-skills/skills/peak/playbooks/hillclimb.md +21 -0
- package/bundled-skills/skills/peak/playbooks/investigation.md +14 -0
- package/bundled-skills/skills/peak/playbooks/multi-phase-plan.md +155 -0
- package/bundled-skills/skills/peak/playbooks/opening-a-pr.md +34 -0
- package/bundled-skills/skills/peak/playbooks/orchestrate.md +112 -0
- package/bundled-skills/skills/peak/playbooks/pause-safely.md +10 -0
- package/bundled-skills/skills/peak/playbooks/perf-issue.md +25 -0
- package/bundled-skills/skills/peak/playbooks/prototype.md +14 -0
- package/bundled-skills/skills/peak/playbooks/refactoring.md +16 -0
- package/bundled-skills/skills/peak/playbooks/runtime-forensics.md +11 -0
- package/bundled-skills/skills/peak/playbooks/session-pickup.md +11 -0
- package/bundled-skills/skills/peak/playbooks/shipping.md +12 -0
- package/bundled-skills/skills/peak/playbooks/trace-forensics.md +14 -0
- package/bundled-skills/skills/peak/playbooks/visual-parity.md +11 -0
- package/bundled-skills/skills/peak/playbooks/worktree-cleanup.md +6 -0
- package/bundled-skills/skills/peak/references/architect/SKILL.md +81 -0
- package/bundled-skills/skills/peak/references/architect/references/design-red-flags.md +57 -0
- package/bundled-skills/skills/peak/references/architect/references/rationale-template.md +35 -0
- package/bundled-skills/skills/peak/references/architect/references/runner-prompt.md +20 -0
- package/bundled-skills/skills/peak/references/arena/SKILL.md +50 -0
- package/bundled-skills/skills/peak/references/automate-me/SKILL.md +106 -0
- package/bundled-skills/skills/peak/references/benchmark-checklist/SKILL.md +41 -0
- package/bundled-skills/skills/peak/references/blast-radius/SKILL.md +52 -0
- package/bundled-skills/skills/peak/references/bro/SKILL.md +9 -0
- package/bundled-skills/skills/peak/references/control-cli/SKILL.md +111 -0
- package/bundled-skills/skills/peak/references/control-ui/SKILL.md +111 -0
- package/bundled-skills/skills/peak/references/correct/SKILL.md +34 -0
- package/bundled-skills/skills/peak/references/create-formal-verification-skill/SKILL.md +43 -0
- package/bundled-skills/skills/peak/references/create-skill/SKILL.md +14 -0
- package/bundled-skills/skills/peak/references/create-verification-skill/SKILL.md +46 -0
- package/bundled-skills/skills/peak/references/create-verification-skill/references/feature-map-example/README.md +47 -0
- package/bundled-skills/skills/peak/references/create-verification-skill/references/feature-map-example/create-note.md +39 -0
- package/bundled-skills/skills/peak/references/create-verification-skill/references/feature-map-example/search.md +45 -0
- package/bundled-skills/skills/peak/references/deslop/SKILL.md +24 -0
- package/bundled-skills/skills/peak/references/figure-it-out/SKILL.md +54 -0
- package/bundled-skills/skills/peak/references/how/SKILL.md +38 -0
- package/bundled-skills/skills/peak/references/how/references/explainer-prompt.md +55 -0
- package/bundled-skills/skills/peak/references/how/references/explorer-prompt.md +35 -0
- package/bundled-skills/skills/peak/references/in-your-own-words/SKILL.md +9 -0
- package/bundled-skills/skills/peak/references/interrogate/SKILL.md +76 -0
- package/bundled-skills/skills/peak/references/interrogate/references/code-quality-review.md +47 -0
- package/bundled-skills/skills/peak/references/interrogate/references/lead-judgment.md +39 -0
- package/bundled-skills/skills/peak/references/interrogate/references/reviewer-prompt.md +62 -0
- package/bundled-skills/skills/peak/references/interrogate/references/rubric.md +77 -0
- package/bundled-skills/skills/peak/references/ketchup/SKILL.md +45 -0
- package/bundled-skills/skills/peak/references/maintain-formal-verification-skill/SKILL.md +60 -0
- package/bundled-skills/skills/peak/references/maintain-verification-skill/SKILL.md +41 -0
- package/bundled-skills/skills/peak/references/no-comments/SKILL.md +26 -0
- package/bundled-skills/skills/peak/references/no-mistakes/SKILL.md +20 -0
- package/bundled-skills/skills/peak/references/no-mistakes/upstream/SKILL.md +394 -0
- package/bundled-skills/skills/peak/references/peak-setup/SKILL.md +18 -0
- package/bundled-skills/skills/peak/references/poteto-help/SKILL.md +16 -0
- package/bundled-skills/skills/peak/references/poteto-help/references/prompting.md +51 -0
- package/bundled-skills/skills/peak/references/poteto-help/references/recipes.md +51 -0
- package/bundled-skills/skills/peak/references/principle-attack-the-premise/SKILL.md +23 -0
- package/bundled-skills/skills/peak/references/principle-boundary-discipline/SKILL.md +36 -0
- package/bundled-skills/skills/peak/references/principle-build-the-lever/SKILL.md +25 -0
- package/bundled-skills/skills/peak/references/principle-encode-lessons-in-structure/SKILL.md +13 -0
- package/bundled-skills/skills/peak/references/principle-exhaust-the-design-space/SKILL.md +11 -0
- package/bundled-skills/skills/peak/references/principle-experience-first/SKILL.md +21 -0
- package/bundled-skills/skills/peak/references/principle-explain-the-number/SKILL.md +19 -0
- package/bundled-skills/skills/peak/references/principle-fix-root-causes/SKILL.md +23 -0
- package/bundled-skills/skills/peak/references/principle-foundational-thinking/SKILL.md +23 -0
- package/bundled-skills/skills/peak/references/principle-guard-the-context-window/SKILL.md +14 -0
- package/bundled-skills/skills/peak/references/principle-laziness-protocol/SKILL.md +12 -0
- package/bundled-skills/skills/peak/references/principle-make-operations-idempotent/SKILL.md +24 -0
- package/bundled-skills/skills/peak/references/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +16 -0
- package/bundled-skills/skills/peak/references/principle-minimize-reader-load/SKILL.md +20 -0
- package/bundled-skills/skills/peak/references/principle-model-the-domain/SKILL.md +26 -0
- package/bundled-skills/skills/peak/references/principle-never-block-on-the-human/SKILL.md +17 -0
- package/bundled-skills/skills/peak/references/principle-outcome-oriented-execution/SKILL.md +23 -0
- package/bundled-skills/skills/peak/references/principle-prove-it-works/SKILL.md +24 -0
- package/bundled-skills/skills/peak/references/principle-redesign-from-first-principles/SKILL.md +18 -0
- package/bundled-skills/skills/peak/references/principle-separate-before-serializing-shared-state/SKILL.md +18 -0
- package/bundled-skills/skills/peak/references/principle-sequence-verifiable-units/SKILL.md +19 -0
- package/bundled-skills/skills/peak/references/principle-subtract-before-you-add/SKILL.md +20 -0
- package/bundled-skills/skills/peak/references/principle-test-behavior-not-implementation/SKILL.md +22 -0
- package/bundled-skills/skills/peak/references/principle-type-system-discipline/SKILL.md +15 -0
- package/bundled-skills/skills/peak/references/raga-runtime/SKILL.md +51 -0
- package/bundled-skills/skills/peak/references/raga-runtime/managed-tools.mjs +34 -0
- package/bundled-skills/skills/peak/references/raga-runtime/raga_runtime.py +55 -0
- package/bundled-skills/skills/peak/references/recall/SKILL.md +37 -0
- package/bundled-skills/skills/peak/references/reflect/SKILL.md +63 -0
- package/bundled-skills/skills/peak/references/reflect/references/divergent-reviewer.md +38 -0
- package/bundled-skills/skills/peak/references/reflect/references/judgment-reviewer.md +37 -0
- package/bundled-skills/skills/peak/references/reflect/references/synthesizer.md +56 -0
- package/bundled-skills/skills/peak/references/reflect/references/tooling-reviewer.md +48 -0
- package/bundled-skills/skills/peak/references/reviewer-triage.md +142 -0
- package/bundled-skills/skills/peak/references/sharpen/SKILL.md +18 -0
- package/bundled-skills/skills/peak/references/show-me-your-work/SKILL.md +84 -0
- package/bundled-skills/skills/peak/references/show-me-your-work/references/decision-log-template.tsv +1 -0
- package/bundled-skills/skills/peak/references/show-me-your-work/scripts/log.sh +42 -0
- package/bundled-skills/skills/peak/references/statechart/SKILL.md +38 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/chart-to-tla.mjs +236 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/compare-charts.mjs +104 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/lib.mjs +725 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/model/OutputFolder.cfg +6 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/model/OutputFolder.map.mjs +106 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/model/OutputFolder.tla +176 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/statechart.mjs +749 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/test/statechart.test.mjs +2790 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/test/sync.mmd +19 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/test/upload.mmd +16 -0
- package/bundled-skills/skills/peak/references/statechart/scripts/tlc-to-chart.mjs +1347 -0
- package/bundled-skills/skills/peak/references/swarm/SKILL.md +43 -0
- package/bundled-skills/skills/peak/references/tdd/SKILL.md +44 -0
- package/bundled-skills/skills/peak/references/teach/SKILL.md +23 -0
- package/bundled-skills/skills/peak/references/technical-writing/SKILL.md +108 -0
- package/bundled-skills/skills/peak/references/typescript-best-practices/SKILL.md +33 -0
- package/bundled-skills/skills/peak/references/typescript-best-practices/references/patterns.md +328 -0
- package/bundled-skills/skills/peak/references/unslop/SKILL.md +64 -0
- package/bundled-skills/skills/peak/references/verify-this/SKILL.md +76 -0
- package/bundled-skills/skills/peak/references/why/SKILL.md +100 -0
- package/bundled-skills/skills/peak/references/why/references/epistemics.md +71 -0
- package/bundled-skills/skills/peak/references/why/references/investigator-prompt.md +84 -0
- package/bundled-skills/skills/peak/references/why/references/source-playbook.md +17 -0
- package/bundled-skills/skills/peak/references/why/references/sources/code-archaeology.md +51 -0
- package/bundled-skills/skills/peak/references/why/references/sources/databricks.md +70 -0
- package/bundled-skills/skills/peak/references/why/references/sources/datadog.md +97 -0
- package/bundled-skills/skills/peak/references/why/references/sources/incident-postmortem.md +5 -0
- package/bundled-skills/skills/peak/references/why/references/sources/linear.md +48 -0
- package/bundled-skills/skills/peak/references/why/references/sources/notion.md +55 -0
- package/bundled-skills/skills/peak/references/why/references/sources/sentry.md +66 -0
- package/bundled-skills/skills/peak/references/why/references/sources/slack.md +17 -0
- package/bundled-skills/skills/peak/references/why/references/synthesizer-prompt.md +129 -0
- package/bundled-skills/skills/peak/scripts/check-plan.mjs +205 -0
- package/bundled-skills/skills/peak/scripts/check-plan.test.ts +96 -0
- package/bundled-skills/skills/peak/scripts/orch/orch.test.ts +761 -0
- package/bundled-skills/skills/peak/scripts/orch/orch.ts +588 -0
- package/bundled-skills/skills/peak/scripts/orch/store.ts +1676 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/LICENSE +22 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/esm.mjs +16 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/index.js +24 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/lib/argument.js +149 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/lib/command.js +2778 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/lib/error.js +39 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/lib/help.js +747 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/lib/option.js +379 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/lib/suggestSimilar.js +101 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/package.json +1 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/typings/esm.d.mts +3 -0
- package/bundled-skills/skills/peak/scripts/vendor/commander/typings/index.d.ts +1113 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/cli.test.ts +224 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/cli.ts +223 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/fakes.test-helper.ts +129 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/github.test.ts +436 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/github.ts +718 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/policy.test.ts +420 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/policy.ts +836 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/render.ts +169 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/tsconfig.json +13 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/types.compile.ts +93 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/types.ts +413 -0
- package/bundled-skills/skills/peak/scripts/watch-pr/watch-pr +4 -0
- package/bundled-skills/skills/peak/scripts/worktree-audit.sh +4 -0
- package/bundled-skills/skills/raga-artifacts/SKILL.md +117 -0
- package/bundled-skills/skills/raga-artifacts/artifact.mjs +254 -0
- package/bundled-skills/skills/raga-artifacts/artifact_tool.py +55 -0
- package/bundled-skills/skills/raga-artifacts/diagrams.md +641 -0
- package/bundled-skills/skills/raga-artifacts/templates/doc.html +124 -0
- package/bundled-skills/skills/raga-artifacts/templates/slides.html +138 -0
- package/dist/bundle/chunks/anthropic-messages-BMDYDGHW.js +6 -0
- package/dist/bundle/chunks/anthropic.js +68 -0
- package/dist/bundle/chunks/azure-openai-responses-Q7EZTEHK.js +2 -0
- package/dist/bundle/chunks/bedrock-converse-stream.js +86 -0
- package/dist/bundle/chunks/chunk-3MNXTBQ3.js +2 -0
- package/dist/bundle/chunks/chunk-3V45WARH.js +7 -0
- package/dist/bundle/chunks/chunk-5AGIVGSV.js +6 -0
- package/dist/bundle/chunks/chunk-6QGV3IWD.js +6 -0
- package/dist/bundle/chunks/chunk-7CBJINYJ.js +20 -0
- package/dist/bundle/chunks/chunk-7DDKXS2Q.js +2 -0
- package/dist/bundle/chunks/chunk-7ZC4UXSL.js +2 -0
- package/dist/bundle/chunks/chunk-CF5GWZHW.js +31 -0
- package/dist/bundle/chunks/chunk-ENUUAC3O.js +131 -0
- package/dist/bundle/chunks/chunk-F7LFZTHT.js +1591 -0
- package/dist/bundle/chunks/chunk-G54UBZTF.js +44 -0
- package/dist/bundle/chunks/chunk-H76KZMOI.js +2 -0
- package/dist/bundle/chunks/chunk-IXDQLPKS.js +11 -0
- package/dist/bundle/chunks/chunk-JLV25LHE.js +2 -0
- package/dist/bundle/chunks/chunk-JQDZ4Z7L.js +2 -0
- package/dist/bundle/chunks/chunk-JXWJOIH4.js +2 -0
- package/dist/bundle/chunks/chunk-KNY3PXQI.js +2 -0
- package/dist/bundle/chunks/chunk-L2ZPNLYD.js +2 -0
- package/dist/bundle/chunks/chunk-LPXNMA2W.js +2 -0
- package/dist/bundle/chunks/chunk-LVVZS2NO.js +12 -0
- package/dist/bundle/chunks/chunk-LX24DVQ5.js +2 -0
- package/dist/bundle/chunks/chunk-NP6TH6UT.js +64 -0
- package/dist/bundle/chunks/chunk-OPPYO2IE.js +2 -0
- package/dist/bundle/chunks/chunk-P2QCWBFM.js +9 -0
- package/dist/bundle/chunks/chunk-P7FPUEYA.js +2 -0
- package/dist/bundle/chunks/chunk-PGXDEOVV.js +2 -0
- package/dist/bundle/chunks/chunk-PJACZCIR.js +2 -0
- package/dist/bundle/chunks/chunk-PMRZO46Y.js +2 -0
- package/dist/bundle/chunks/chunk-PRRNXB7S.js +2 -0
- package/dist/bundle/chunks/chunk-Q4U25BSY.js +2 -0
- package/dist/bundle/chunks/chunk-RDZVAGPR.js +2 -0
- package/dist/bundle/chunks/chunk-RFPFZTK2.js +7 -0
- package/dist/bundle/chunks/chunk-RP2WKNT7.js +4 -0
- package/dist/bundle/chunks/chunk-S5J3UB5O.js +75 -0
- package/dist/bundle/chunks/chunk-TEPMHNKQ.js +2 -0
- package/dist/bundle/chunks/chunk-TMTOQ7H7.js +2 -0
- package/dist/bundle/chunks/chunk-UKVNB6C4.js +2 -0
- package/dist/bundle/chunks/chunk-USJZMAIR.js +2 -0
- package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
- package/dist/bundle/chunks/chunk-WJGLPWUE.js +16 -0
- package/dist/bundle/chunks/cli-QLDCDYOR.js +51 -0
- package/dist/bundle/chunks/cloudflare-workers-ai-system-one-S6CT2FXS.js +2 -0
- package/dist/bundle/chunks/codemode-worker.js +478 -0
- package/dist/bundle/chunks/easter-egg-3d-NPDBBPPF.js +2 -0
- package/dist/bundle/chunks/execute-WPTMS4XG.js +505 -0
- package/dist/bundle/chunks/github-copilot.js +2 -0
- package/dist/bundle/chunks/google-generative-ai-35NZKG6S.js +2 -0
- package/dist/bundle/chunks/google-vertex-P33AHYYX.js +2 -0
- package/dist/bundle/chunks/https-proxy-agent-LVOO5TPL.js +13 -0
- package/dist/bundle/chunks/image-resize-worker.js +2 -0
- package/dist/bundle/chunks/jiti-loader-GL4HJFAD.js +21 -0
- package/dist/bundle/chunks/jiti-static-loader-2RCDI6B4.js +2 -0
- package/dist/bundle/chunks/kimi-coding.js +2 -0
- package/dist/bundle/chunks/lib-4AVRLBHM.js +9 -0
- package/dist/bundle/chunks/llama-cpp-classify-U4EH6TAM.js +22 -0
- package/dist/bundle/chunks/meta.js +2 -0
- package/dist/bundle/chunks/mistral-conversations-J62DPS2P.js +5 -0
- package/dist/bundle/chunks/multipart-parser-FMGQ7342.js +3 -0
- package/dist/bundle/chunks/node-AUOGOBCN.js +2 -0
- package/dist/bundle/chunks/node-KCMANYC2.js +16 -0
- package/dist/bundle/chunks/openai-chatgpt.js +68 -0
- package/dist/bundle/chunks/openai-codex-responses-4HXATL2M.js +10 -0
- package/dist/bundle/chunks/openai-codex.js +68 -0
- package/dist/bundle/chunks/openai-completions-75YYY35N.js +7 -0
- package/dist/bundle/chunks/openai-decisions-HEBEVGA2.js +5 -0
- package/dist/bundle/chunks/openai-responses-UWNAKTBV.js +4 -0
- package/dist/bundle/chunks/openrouter-images-HVOPXKHS.js +2 -0
- package/dist/bundle/chunks/openrouter.js +68 -0
- package/dist/bundle/chunks/pi-messages-DG7CALOV.js +8 -0
- package/dist/bundle/chunks/radius.js +68 -0
- package/dist/bundle/chunks/runtime-N5MUH2WA.js +2 -0
- package/dist/bundle/chunks/src-QKGKDFSU.js +4 -0
- package/dist/bundle/chunks/typesafe-system-one-24HEGHNN.js +2 -0
- package/dist/bundle/chunks/virtual-modules-4I6Y6DPQ.js +2 -0
- package/dist/bundle/chunks/xai.js +2 -0
- package/dist/bundle/cli-runtime.js +3 -0
- package/dist/bundle/cli.js +5 -0
- package/dist/bundle/index.js +2 -0
- package/dist/bundle/raga-runtime.js +3 -0
- package/dist/bundle/raga.js +5 -0
- package/dist/bundle/rpc-entry.js +3 -0
- package/dist/core/export-html/template.css +1085 -0
- package/dist/core/export-html/template.html +56 -0
- package/dist/core/export-html/template.js +2044 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked-cjk-friendly.min.js +6 -0
- package/dist/core/export-html/vendor/marked.min.js +79 -0
- package/dist/modes/interactive/assets/clankolas.png +0 -0
- package/dist/modes/interactive/theme/dark.json +78 -0
- package/dist/modes/interactive/theme/light.json +78 -0
- package/docs/cli-integration.md +106 -0
- package/docs/cli.md +343 -0
- package/docs/codemode.md +230 -0
- package/docs/compaction.md +489 -0
- package/docs/configuration.md +62 -0
- package/docs/containerization.md +183 -0
- package/docs/custom-provider.md +227 -0
- package/docs/docs.json +220 -0
- package/docs/environment-variables.md +101 -0
- package/docs/extensions.md +400 -0
- package/docs/how-pi-works.md +49 -0
- package/docs/images/doom-extension.png +0 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +39 -0
- package/docs/json.md +226 -0
- package/docs/keybindings.md +195 -0
- package/docs/llama-cpp.md +121 -0
- package/docs/mcp.md +272 -0
- package/docs/message-types.md +279 -0
- package/docs/models-configuration.md +196 -0
- package/docs/models.md +225 -0
- package/docs/nvidia-rtx-llama-cpp.md +96 -0
- package/docs/packages.md +129 -0
- package/docs/prompt-templates.md +59 -0
- package/docs/providers.md +247 -0
- package/docs/quickstart.md +136 -0
- package/docs/rpc-commands.md +860 -0
- package/docs/rpc-extension-ui.md +200 -0
- package/docs/rpc.md +193 -0
- package/docs/sdk.md +149 -0
- package/docs/security.md +99 -0
- package/docs/session-format.md +293 -0
- package/docs/sessions.md +66 -0
- package/docs/settings.md +185 -0
- package/docs/shell-aliases.md +93 -0
- package/docs/skills.md +93 -0
- package/docs/slash-commands.md +61 -0
- package/docs/terminal-setup.md +233 -0
- package/docs/termux.md +117 -0
- package/docs/themes.md +138 -0
- package/docs/tmux.md +55 -0
- package/docs/tui.md +195 -0
- package/docs/usage.md +94 -0
- package/docs/virtual-models.md +114 -0
- package/docs/windows.md +81 -0
- package/examples/README.md +36 -0
- package/examples/extensions/README.md +214 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +150 -0
- package/examples/extensions/built-in-tool-renderer.ts +225 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +117 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +617 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +405 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/debug-provider.ts +90 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +132 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +55 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +81 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/entry-renderer.ts +41 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +175 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +190 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/jev-router.ts +113 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +353 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +57 -0
- package/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/examples/extensions/overlay-test.ts +153 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +66 -0
- package/examples/extensions/plan-mode/index.ts +394 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +436 -0
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +49 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +118 -0
- package/examples/extensions/question.ts +286 -0
- package/examples/extensions/questionnaire.ts +448 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +326 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +177 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +157 -0
- package/examples/extensions/subagent/index.ts +1038 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +199 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/rpc-client.ts +35 -0
- package/examples/rpc-extension-ui.ts +661 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +49 -0
- package/examples/sdk/03-custom-prompt.ts +75 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +99 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +34 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +74 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/14-codemode-mcp.ts +61 -0
- package/examples/sdk/README.md +141 -0
- package/package.json +21 -5
- package/python/raga_rlm/__init__.py +352 -0
- package/python/raga_rlm/mlx_models.py +265 -0
- package/python/raga_rlm/repl.py +920 -0
- package/schemas/keybindings.schema.json +441 -0
- package/schemas/models.schema.json +1211 -0
- package/schemas/settings.schema.json +829 -0
- package/schemas/theme.schema.json +365 -0
|
@@ -0,0 +1,761 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from "bun:test";
|
|
2
|
+
import {
|
|
3
|
+
chmod,
|
|
4
|
+
mkdir,
|
|
5
|
+
mkdtemp,
|
|
6
|
+
readFile,
|
|
7
|
+
readdir,
|
|
8
|
+
rm,
|
|
9
|
+
writeFile,
|
|
10
|
+
} from "node:fs/promises";
|
|
11
|
+
import { realpathSync } from "node:fs";
|
|
12
|
+
import { tmpdir } from "node:os";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
import {
|
|
15
|
+
NotFoundError,
|
|
16
|
+
UserError,
|
|
17
|
+
openStore,
|
|
18
|
+
parseVerdict,
|
|
19
|
+
type Forge,
|
|
20
|
+
type OpenStoreOptions,
|
|
21
|
+
type Store,
|
|
22
|
+
} from "./store.ts";
|
|
23
|
+
|
|
24
|
+
const SCRIPT = join(import.meta.dir, "orch.ts");
|
|
25
|
+
const directories: string[] = [];
|
|
26
|
+
const handles: Store[] = [];
|
|
27
|
+
|
|
28
|
+
interface RunResult {
|
|
29
|
+
readonly code: number;
|
|
30
|
+
readonly stdout: string;
|
|
31
|
+
readonly stderr: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async function makeDirectory(): Promise<string> {
|
|
35
|
+
const directory = await mkdtemp(join(tmpdir(), "orch-test-"));
|
|
36
|
+
directories.push(directory);
|
|
37
|
+
return directory;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function useStore(
|
|
41
|
+
directory: string,
|
|
42
|
+
options?: OpenStoreOptions
|
|
43
|
+
): Store {
|
|
44
|
+
const store = openStore(directory, options);
|
|
45
|
+
handles.push(store);
|
|
46
|
+
return store;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function initializedStore(): Promise<{
|
|
50
|
+
readonly directory: string;
|
|
51
|
+
readonly store: Store;
|
|
52
|
+
}> {
|
|
53
|
+
const directory = await makeDirectory();
|
|
54
|
+
const store = useStore(directory);
|
|
55
|
+
await store.init();
|
|
56
|
+
return { directory, store };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function git({
|
|
60
|
+
args,
|
|
61
|
+
repo,
|
|
62
|
+
}: {
|
|
63
|
+
args: readonly string[];
|
|
64
|
+
repo: string;
|
|
65
|
+
}): string {
|
|
66
|
+
const result = Bun.spawnSync(["git", "-C", repo, ...args]);
|
|
67
|
+
if (result.exitCode !== 0) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`git ${args.join(" ")} failed: ${result.stderr.toString()}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return result.stdout.toString().trim();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function makeGitStack(directory: string): Promise<{
|
|
76
|
+
readonly repo: string;
|
|
77
|
+
readonly mergedSha: string;
|
|
78
|
+
readonly closedSha: string;
|
|
79
|
+
readonly openSha: string;
|
|
80
|
+
readonly draftSha: string;
|
|
81
|
+
}> {
|
|
82
|
+
const repo = join(directory, "repo");
|
|
83
|
+
await mkdir(repo);
|
|
84
|
+
git({ repo, args: ["init", "--initial-branch=main"] });
|
|
85
|
+
git({ repo, args: ["config", "user.name", "Orch Test"] });
|
|
86
|
+
git({ repo, args: ["config", "user.email", "orch@example.com"] });
|
|
87
|
+
await writeFile(join(repo, "main.txt"), "main\n");
|
|
88
|
+
git({ repo, args: ["add", "."] });
|
|
89
|
+
git({ repo, args: ["commit", "-m", "main"] });
|
|
90
|
+
|
|
91
|
+
const branches = [
|
|
92
|
+
"stack/merged",
|
|
93
|
+
"stack/closed",
|
|
94
|
+
"stack/open",
|
|
95
|
+
"stack/draft",
|
|
96
|
+
];
|
|
97
|
+
for (const [index, branch] of branches.entries()) {
|
|
98
|
+
git({ repo, args: ["checkout", "-b", branch] });
|
|
99
|
+
await writeFile(join(repo, `stack-${index}.txt`), `${branch}\n`);
|
|
100
|
+
git({ repo, args: ["add", "."] });
|
|
101
|
+
git({ repo, args: ["commit", "-m", branch] });
|
|
102
|
+
}
|
|
103
|
+
git({ repo, args: ["checkout", "stack/open"] });
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
repo,
|
|
107
|
+
mergedSha: git({ repo, args: ["rev-parse", "stack/merged"] }),
|
|
108
|
+
closedSha: git({ repo, args: ["rev-parse", "stack/closed"] }),
|
|
109
|
+
openSha: git({ repo, args: ["rev-parse", "stack/open"] }),
|
|
110
|
+
draftSha: git({ repo, args: ["rev-parse", "stack/draft"] }),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
type FixtureState = "open" | "draft" | "merged" | "closed";
|
|
115
|
+
|
|
116
|
+
const FORGE_FIXTURES: Readonly<
|
|
117
|
+
Record<
|
|
118
|
+
Forge,
|
|
119
|
+
{
|
|
120
|
+
readonly fields: string;
|
|
121
|
+
readonly row: (pr: {
|
|
122
|
+
number: number;
|
|
123
|
+
state: FixtureState;
|
|
124
|
+
head: string;
|
|
125
|
+
base: string;
|
|
126
|
+
}) => Record<string, unknown>;
|
|
127
|
+
}
|
|
128
|
+
>
|
|
129
|
+
> = {
|
|
130
|
+
gh: {
|
|
131
|
+
fields: "number,state,headRefName,baseRefName",
|
|
132
|
+
row: ({ number, state, head, base }) => ({
|
|
133
|
+
number,
|
|
134
|
+
state: state === "draft" ? "OPEN" : state.toUpperCase(),
|
|
135
|
+
headRefName: head,
|
|
136
|
+
baseRefName: base,
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
origin: {
|
|
140
|
+
fields: "number,status,headRef,baseRef",
|
|
141
|
+
row: ({ number, state, head, base }) => ({
|
|
142
|
+
number,
|
|
143
|
+
status: state,
|
|
144
|
+
headRef: head,
|
|
145
|
+
baseRef: base,
|
|
146
|
+
}),
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
function forgeRows(
|
|
151
|
+
forge: Forge,
|
|
152
|
+
prs: readonly {
|
|
153
|
+
number: number;
|
|
154
|
+
state: FixtureState;
|
|
155
|
+
head: string;
|
|
156
|
+
base: string;
|
|
157
|
+
}[]
|
|
158
|
+
): string {
|
|
159
|
+
return JSON.stringify(prs.map((pr) => FORGE_FIXTURES[forge].row(pr)));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function withFakeForge<T>({
|
|
163
|
+
directory,
|
|
164
|
+
forge,
|
|
165
|
+
operation,
|
|
166
|
+
currentRows,
|
|
167
|
+
}: {
|
|
168
|
+
directory: string;
|
|
169
|
+
forge: Forge;
|
|
170
|
+
operation: () => Promise<T>;
|
|
171
|
+
currentRows?: string;
|
|
172
|
+
}): Promise<T> {
|
|
173
|
+
const bin = join(directory, "bin");
|
|
174
|
+
const outputPath = join(directory, "forge-output.txt");
|
|
175
|
+
await mkdir(bin, { recursive: true });
|
|
176
|
+
await writeFile(
|
|
177
|
+
outputPath,
|
|
178
|
+
`${
|
|
179
|
+
currentRows ??
|
|
180
|
+
forgeRows(forge, [
|
|
181
|
+
{
|
|
182
|
+
number: 11,
|
|
183
|
+
state: "open",
|
|
184
|
+
head: "stack/open",
|
|
185
|
+
base: "stack/closed",
|
|
186
|
+
},
|
|
187
|
+
])
|
|
188
|
+
}\n`
|
|
189
|
+
);
|
|
190
|
+
const { fields } = FORGE_FIXTURES[forge];
|
|
191
|
+
const list = (filter: string, branch: string): string =>
|
|
192
|
+
`pr list ${filter} ${branch} --state all --json ${fields}`;
|
|
193
|
+
const fake = join(bin, forge);
|
|
194
|
+
await writeFile(
|
|
195
|
+
fake,
|
|
196
|
+
`#!/usr/bin/env bash
|
|
197
|
+
set -euo pipefail
|
|
198
|
+
if [ "$(pwd -P)" != "${realpathSync(join(directory, "repo"))}" ]; then
|
|
199
|
+
printf '${forge} ran outside the fixture repo: %s\\n' "$(pwd -P)" >&2
|
|
200
|
+
exit 2
|
|
201
|
+
fi
|
|
202
|
+
case "$*" in
|
|
203
|
+
"${list("--head", "stack/open")}")
|
|
204
|
+
cat "${outputPath}"
|
|
205
|
+
;;
|
|
206
|
+
"${list("--head", "stack/closed")}")
|
|
207
|
+
printf '%s\\n' '${forgeRows(forge, [{ number: 13, state: "closed", head: "stack/closed", base: "stack/merged" }])}'
|
|
208
|
+
;;
|
|
209
|
+
"${list("--head", "stack/merged")}")
|
|
210
|
+
printf '%s\\n' '${forgeRows(forge, [{ number: 10, state: "merged", head: "stack/merged", base: "main" }])}'
|
|
211
|
+
;;
|
|
212
|
+
"${list("--base", "stack/open")}")
|
|
213
|
+
printf '%s\\n' '${forgeRows(forge, [
|
|
214
|
+
{ number: 14, state: "draft", head: "stack/draft", base: "stack/open" },
|
|
215
|
+
{
|
|
216
|
+
number: 15,
|
|
217
|
+
state: "closed",
|
|
218
|
+
head: "stack/abandoned",
|
|
219
|
+
base: "stack/open",
|
|
220
|
+
},
|
|
221
|
+
])}'
|
|
222
|
+
;;
|
|
223
|
+
"${list("--base", "stack/draft")}")
|
|
224
|
+
printf '[]\\n'
|
|
225
|
+
;;
|
|
226
|
+
*)
|
|
227
|
+
printf 'unexpected ${forge} arguments: %s\\n' "$*" >&2
|
|
228
|
+
exit 2
|
|
229
|
+
;;
|
|
230
|
+
esac
|
|
231
|
+
`
|
|
232
|
+
);
|
|
233
|
+
await chmod(fake, 0o755);
|
|
234
|
+
|
|
235
|
+
const originalPath = process.env.PATH;
|
|
236
|
+
process.env.PATH = `${bin}:${originalPath ?? ""}`;
|
|
237
|
+
try {
|
|
238
|
+
return await operation();
|
|
239
|
+
} finally {
|
|
240
|
+
if (originalPath === undefined) {
|
|
241
|
+
delete process.env.PATH;
|
|
242
|
+
} else {
|
|
243
|
+
process.env.PATH = originalPath;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function runCli(
|
|
249
|
+
args: readonly string[],
|
|
250
|
+
env: Readonly<Record<string, string | undefined>> = process.env
|
|
251
|
+
): RunResult {
|
|
252
|
+
const result = Bun.spawnSync([process.execPath, SCRIPT, ...args], { env });
|
|
253
|
+
return {
|
|
254
|
+
code: result.exitCode,
|
|
255
|
+
stdout: result.stdout.toString(),
|
|
256
|
+
stderr: result.stderr.toString(),
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
afterEach(async () => {
|
|
261
|
+
for (const store of handles.splice(0).reverse()) {
|
|
262
|
+
await store.close();
|
|
263
|
+
}
|
|
264
|
+
for (const directory of directories.splice(0)) {
|
|
265
|
+
await rm(directory, { recursive: true, force: true });
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
describe("Store", () => {
|
|
270
|
+
it("initializes an idempotent plain-file store and releases its lock", async () => {
|
|
271
|
+
const directory = await makeDirectory();
|
|
272
|
+
const store = useStore(directory);
|
|
273
|
+
|
|
274
|
+
expect(await store.init()).toEqual({ store: directory });
|
|
275
|
+
const firstUnits = await readFile(join(directory, "units.tsv"), "utf8");
|
|
276
|
+
const firstLedger = await readFile(
|
|
277
|
+
join(directory, "ledger.tsv"),
|
|
278
|
+
"utf8"
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
expect(await store.init()).toEqual({ store: directory });
|
|
282
|
+
expect(await readFile(join(directory, "units.tsv"), "utf8")).toBe(
|
|
283
|
+
firstUnits
|
|
284
|
+
);
|
|
285
|
+
expect(await readFile(join(directory, "ledger.tsv"), "utf8")).toBe(
|
|
286
|
+
firstLedger
|
|
287
|
+
);
|
|
288
|
+
expect((await readdir(directory)).sort()).toEqual([
|
|
289
|
+
".orch.lock",
|
|
290
|
+
"frontier.json",
|
|
291
|
+
"gates.md",
|
|
292
|
+
"inbox",
|
|
293
|
+
"ledger.tsv",
|
|
294
|
+
"preferences.md",
|
|
295
|
+
"units.tsv",
|
|
296
|
+
]);
|
|
297
|
+
|
|
298
|
+
await store.close();
|
|
299
|
+
expect(await readdir(directory)).not.toContain(".orch.lock");
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
it("composes unit add, set, get, list, and counts", async () => {
|
|
303
|
+
const { store } = await initializedStore();
|
|
304
|
+
|
|
305
|
+
expect(
|
|
306
|
+
await store.units.add({
|
|
307
|
+
id: "u1",
|
|
308
|
+
track: "build",
|
|
309
|
+
brief: "briefs/u1.md",
|
|
310
|
+
})
|
|
311
|
+
).toMatchObject({ id: "u1", state: "pending" });
|
|
312
|
+
expect(
|
|
313
|
+
await store.units.add({ id: "=SUM(A1)", track: "+build" })
|
|
314
|
+
).toMatchObject({ id: "'=SUM(A1)", track: "'+build" });
|
|
315
|
+
|
|
316
|
+
const updated = await store.units.set({
|
|
317
|
+
id: "u1",
|
|
318
|
+
state: "done",
|
|
319
|
+
branch: "poteto/u1",
|
|
320
|
+
pr: 184530,
|
|
321
|
+
sha: "abc123",
|
|
322
|
+
});
|
|
323
|
+
expect(updated).toEqual({
|
|
324
|
+
id: "u1",
|
|
325
|
+
track: "build",
|
|
326
|
+
state: "done",
|
|
327
|
+
branch: "poteto/u1",
|
|
328
|
+
pr: "184530",
|
|
329
|
+
sha: "abc123",
|
|
330
|
+
brief: "briefs/u1.md",
|
|
331
|
+
});
|
|
332
|
+
expect(await store.units.get("u1")).toEqual(updated);
|
|
333
|
+
expect(
|
|
334
|
+
await store.units.list({ state: "done", track: "build" })
|
|
335
|
+
).toEqual([updated]);
|
|
336
|
+
expect(await store.units.counts()).toEqual({ done: 1, pending: 1 });
|
|
337
|
+
await expect(
|
|
338
|
+
store.units.add({ id: "u1", track: "build" })
|
|
339
|
+
).rejects.toThrow("unit u1 already exists");
|
|
340
|
+
await expect(
|
|
341
|
+
store.units.set({ id: "missing", state: "done" })
|
|
342
|
+
).rejects.toBeInstanceOf(NotFoundError);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it("records, replaces, checks, and summarizes typed ledger verdicts", async () => {
|
|
346
|
+
const { store } = await initializedStore();
|
|
347
|
+
|
|
348
|
+
try {
|
|
349
|
+
await store.ledger.check({ pr: 184530, sha: "abc123" });
|
|
350
|
+
throw new Error("expected ledger check to fail");
|
|
351
|
+
} catch (error) {
|
|
352
|
+
expect(error).toBeInstanceOf(NotFoundError);
|
|
353
|
+
if (error instanceof NotFoundError) {
|
|
354
|
+
expect(error.output).toEqual({
|
|
355
|
+
compact: "NOT-VERIFIED",
|
|
356
|
+
json: {
|
|
357
|
+
pr: "184530",
|
|
358
|
+
sha: "abc123",
|
|
359
|
+
verdict: "NOT-VERIFIED",
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
expect(() => parseVerdict("looks-good")).toThrow("verdict must be");
|
|
365
|
+
|
|
366
|
+
const recorded = await store.ledger.record({
|
|
367
|
+
pr: 184530,
|
|
368
|
+
sha: "abc123",
|
|
369
|
+
verdict: "unit-test-verified",
|
|
370
|
+
evidence: "reports/verify.md",
|
|
371
|
+
verifier: "opus",
|
|
372
|
+
});
|
|
373
|
+
expect(await store.ledger.check({ pr: 184530, sha: "abc123" })).toEqual(
|
|
374
|
+
recorded
|
|
375
|
+
);
|
|
376
|
+
expect(await store.ledger.summary()).toEqual({
|
|
377
|
+
"unit-test-verified": 1,
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
await store.ledger.record({
|
|
381
|
+
pr: 184530,
|
|
382
|
+
sha: "abc123",
|
|
383
|
+
verdict: "live-ui-verified",
|
|
384
|
+
evidence: "reports/live.md",
|
|
385
|
+
});
|
|
386
|
+
expect(await store.ledger.summary()).toEqual({
|
|
387
|
+
"live-ui-verified": 1,
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
it("pushes, peeks, and atomically drains inbox pointers", async () => {
|
|
392
|
+
const { directory, store } = await initializedStore();
|
|
393
|
+
|
|
394
|
+
const first = await store.inbox.push({
|
|
395
|
+
agent: "worker-1",
|
|
396
|
+
unit: "u1",
|
|
397
|
+
status: "done",
|
|
398
|
+
report: "reports/u1.md",
|
|
399
|
+
});
|
|
400
|
+
expect(first.pointer).toMatchObject({ unit: "u1", status: "done" });
|
|
401
|
+
expect(first.filename).toEndWith(".tsv");
|
|
402
|
+
await store.inbox.push({
|
|
403
|
+
agent: "worker-2",
|
|
404
|
+
unit: "u2",
|
|
405
|
+
status: "failed",
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
expect(await store.inbox.count()).toBe(2);
|
|
409
|
+
expect(await store.inbox.peek()).toHaveLength(2);
|
|
410
|
+
expect(await store.inbox.count()).toBe(2);
|
|
411
|
+
expect(await store.inbox.drain()).toHaveLength(2);
|
|
412
|
+
expect(await store.inbox.count()).toBe(0);
|
|
413
|
+
expect(await readdir(join(directory, "inbox"))).toEqual([]);
|
|
414
|
+
expect(
|
|
415
|
+
(await readdir(directory)).filter((name) =>
|
|
416
|
+
name.startsWith(".inbox-drain-")
|
|
417
|
+
)
|
|
418
|
+
).toEqual([]);
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
it("replaces a stale lock whose holder pid is dead", async () => {
|
|
422
|
+
const { directory } = await initializedStore();
|
|
423
|
+
const exited = Bun.spawn(["true"]);
|
|
424
|
+
await exited.exited;
|
|
425
|
+
await writeFile(join(directory, ".orch.lock"), `${exited.pid}\n`);
|
|
426
|
+
|
|
427
|
+
const stale: string[] = [];
|
|
428
|
+
const recovered = useStore(directory, {
|
|
429
|
+
onStaleLock: (holder) => stale.push(holder),
|
|
430
|
+
});
|
|
431
|
+
expect(
|
|
432
|
+
await recovered.units.add({ id: "u1", track: "build" })
|
|
433
|
+
).toMatchObject({ id: "u1" });
|
|
434
|
+
expect(stale).toEqual([String(exited.pid)]);
|
|
435
|
+
await recovered.close();
|
|
436
|
+
expect(await readdir(directory)).not.toContain(".orch.lock");
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
it("blocks a writer and steals the pid lock only with force", async () => {
|
|
440
|
+
const { directory, store } = await initializedStore();
|
|
441
|
+
await store.close();
|
|
442
|
+
await writeFile(join(directory, ".orch.lock"), `${process.pid}\n`);
|
|
443
|
+
|
|
444
|
+
const blocked = useStore(directory);
|
|
445
|
+
await expect(
|
|
446
|
+
blocked.units.add({ id: "u1", track: "build" })
|
|
447
|
+
).rejects.toThrow(`store lock held by pid ${process.pid}`);
|
|
448
|
+
|
|
449
|
+
const stolen: string[] = [];
|
|
450
|
+
const forced = useStore(directory, {
|
|
451
|
+
force: true,
|
|
452
|
+
onLockStolen: (holder) => stolen.push(holder),
|
|
453
|
+
});
|
|
454
|
+
expect(
|
|
455
|
+
await forced.units.add({ id: "u1", track: "build" })
|
|
456
|
+
).toMatchObject({ id: "u1" });
|
|
457
|
+
expect(stolen).toEqual([String(process.pid)]);
|
|
458
|
+
await forced.close();
|
|
459
|
+
expect(await readdir(directory)).not.toContain(".orch.lock");
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
it("parks gates, stores standing orders, and renders status", async () => {
|
|
463
|
+
const { directory, store } = await initializedStore();
|
|
464
|
+
await store.units.add({ id: "u1", track: "build" });
|
|
465
|
+
expect(
|
|
466
|
+
await store.gates.park({
|
|
467
|
+
id: "release",
|
|
468
|
+
question: "Ship now?",
|
|
469
|
+
options: "ship,wait",
|
|
470
|
+
defaultAnswer: "wait",
|
|
471
|
+
})
|
|
472
|
+
).toMatchObject({ kind: "open", id: "release" });
|
|
473
|
+
expect(
|
|
474
|
+
await store.standing.add({ line: "Never force push." })
|
|
475
|
+
).toEqual({ number: 1, line: "Never force push." });
|
|
476
|
+
|
|
477
|
+
const first = await store.status.render();
|
|
478
|
+
expect(first.changed).toBe("first render");
|
|
479
|
+
expect(first.summary.openGateIds).toEqual(["release"]);
|
|
480
|
+
expect(await readFile(join(directory, "status.md"), "utf8")).toContain(
|
|
481
|
+
"| release | open | Ship now? |"
|
|
482
|
+
);
|
|
483
|
+
expect((await store.status.render()).changed).toBe("no derived changes");
|
|
484
|
+
|
|
485
|
+
expect(
|
|
486
|
+
await store.gates.resolve({ id: "release", answer: "ship" })
|
|
487
|
+
).toMatchObject({ kind: "resolved", answer: "ship" });
|
|
488
|
+
expect((await store.status.render()).changed).toBe("open gates 1->0");
|
|
489
|
+
expect(await store.gates.list()).toEqual([]);
|
|
490
|
+
expect(await store.standing.show()).toEqual([
|
|
491
|
+
{ number: 1, line: "Never force push." },
|
|
492
|
+
]);
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
for (const forge of ["gh", "origin"] as const) {
|
|
496
|
+
it(`resolves the ordered frontier from the ${forge} base chain and validates an optional pin`, async () => {
|
|
497
|
+
const { directory, store } = await initializedStore();
|
|
498
|
+
const stack = await makeGitStack(directory);
|
|
499
|
+
const forgeParams = forge === "gh" ? {} : { forge };
|
|
500
|
+
|
|
501
|
+
await withFakeForge({
|
|
502
|
+
directory,
|
|
503
|
+
forge,
|
|
504
|
+
operation: async () => {
|
|
505
|
+
expect(
|
|
506
|
+
await store.frontier.set({ repo: stack.repo, ...forgeParams })
|
|
507
|
+
).toEqual({
|
|
508
|
+
generation: 1,
|
|
509
|
+
prs: [
|
|
510
|
+
{
|
|
511
|
+
pr: 10,
|
|
512
|
+
branches: "stack/merged",
|
|
513
|
+
sha: stack.mergedSha,
|
|
514
|
+
state: "MERGED",
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
pr: 13,
|
|
518
|
+
branches: "stack/closed",
|
|
519
|
+
sha: stack.closedSha,
|
|
520
|
+
state: "CLOSED",
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
pr: 11,
|
|
524
|
+
branches: "stack/open",
|
|
525
|
+
sha: stack.openSha,
|
|
526
|
+
state: "OPEN",
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
pr: 14,
|
|
530
|
+
branches: "stack/draft",
|
|
531
|
+
sha: stack.draftSha,
|
|
532
|
+
state: "OPEN",
|
|
533
|
+
},
|
|
534
|
+
],
|
|
535
|
+
lowestUnmerged: 11,
|
|
536
|
+
});
|
|
537
|
+
expect(
|
|
538
|
+
(
|
|
539
|
+
await store.frontier.set({
|
|
540
|
+
repo: stack.repo,
|
|
541
|
+
...forgeParams,
|
|
542
|
+
prs: [10, 13, 11, 14],
|
|
543
|
+
})
|
|
544
|
+
).generation
|
|
545
|
+
).toBe(2);
|
|
546
|
+
expect((await store.frontier.show()).generation).toBe(2);
|
|
547
|
+
await expect(
|
|
548
|
+
store.frontier.set({
|
|
549
|
+
repo: stack.repo,
|
|
550
|
+
...forgeParams,
|
|
551
|
+
prs: [10, 11, 12],
|
|
552
|
+
})
|
|
553
|
+
).rejects.toThrow(
|
|
554
|
+
"frontier pin mismatch: missing from resolved chain: 12; extra in resolved chain: 13,14"
|
|
555
|
+
);
|
|
556
|
+
await expect(
|
|
557
|
+
store.frontier.set({
|
|
558
|
+
repo: stack.repo,
|
|
559
|
+
...forgeParams,
|
|
560
|
+
prs: [13, 10, 11, 14],
|
|
561
|
+
})
|
|
562
|
+
).rejects.toThrow(
|
|
563
|
+
"frontier pin mismatch: order differs: expected 13,10,11,14; resolved 10,13,11,14"
|
|
564
|
+
);
|
|
565
|
+
await expect(
|
|
566
|
+
store.frontier.set({
|
|
567
|
+
repo: stack.repo,
|
|
568
|
+
...forgeParams,
|
|
569
|
+
prs: [10, 10],
|
|
570
|
+
})
|
|
571
|
+
).rejects.toThrow("--prs must not contain duplicates");
|
|
572
|
+
},
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
it(`rejects unparseable ${forge} output loudly`, async () => {
|
|
577
|
+
const { directory, store } = await initializedStore();
|
|
578
|
+
const stack = await makeGitStack(directory);
|
|
579
|
+
|
|
580
|
+
await withFakeForge({
|
|
581
|
+
directory,
|
|
582
|
+
forge,
|
|
583
|
+
currentRows: "this line is not forge output",
|
|
584
|
+
operation: async () => {
|
|
585
|
+
await expect(
|
|
586
|
+
store.frontier.set({ repo: stack.repo, forge })
|
|
587
|
+
).rejects.toThrow(
|
|
588
|
+
`${forge} pr list --head stack/open output is not valid JSON`
|
|
589
|
+
);
|
|
590
|
+
},
|
|
591
|
+
});
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
it("names the missing pull request when a chain branch has none", async () => {
|
|
596
|
+
const { directory, store } = await initializedStore();
|
|
597
|
+
const stack = await makeGitStack(directory);
|
|
598
|
+
|
|
599
|
+
await withFakeForge({
|
|
600
|
+
directory,
|
|
601
|
+
forge: "gh",
|
|
602
|
+
currentRows: "[]",
|
|
603
|
+
operation: async () => {
|
|
604
|
+
await expect(store.frontier.set({ repo: stack.repo })).rejects.toThrow(
|
|
605
|
+
"branch stack/open has no pull request; open one with gh pr create"
|
|
606
|
+
);
|
|
607
|
+
},
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
it("rejects malformed TSV, verdict, frontier, and inbox data", async () => {
|
|
612
|
+
const { directory, store } = await initializedStore();
|
|
613
|
+
|
|
614
|
+
await writeFile(join(directory, "units.tsv"), "wrong\n");
|
|
615
|
+
await expect(store.units.list()).rejects.toThrow(
|
|
616
|
+
"units.tsv has an invalid header"
|
|
617
|
+
);
|
|
618
|
+
await writeFile(
|
|
619
|
+
join(directory, "units.tsv"),
|
|
620
|
+
"id\ttrack\tstate\tbranch\tpr\tsha\tbrief\nshort\trow\n"
|
|
621
|
+
);
|
|
622
|
+
await expect(store.units.list()).rejects.toThrow(
|
|
623
|
+
"units.tsv has a malformed row"
|
|
624
|
+
);
|
|
625
|
+
|
|
626
|
+
await writeFile(
|
|
627
|
+
join(directory, "ledger.tsv"),
|
|
628
|
+
"pr\tsha\tverdict\tevidence\tverifier\tts\n1\tsha\tinvalid\treport\tme\tnow\n"
|
|
629
|
+
);
|
|
630
|
+
await expect(store.ledger.summary()).rejects.toThrow(
|
|
631
|
+
"ledger.tsv has invalid verdict invalid"
|
|
632
|
+
);
|
|
633
|
+
|
|
634
|
+
await writeFile(join(directory, "frontier.json"), '{"generation":"1"}\n');
|
|
635
|
+
await expect(store.frontier.show()).rejects.toThrow(
|
|
636
|
+
"frontier.json has an invalid shape"
|
|
637
|
+
);
|
|
638
|
+
|
|
639
|
+
await writeFile(join(directory, "inbox", "bad.tsv"), "too\tshort\n");
|
|
640
|
+
await expect(store.inbox.peek()).rejects.toThrow(
|
|
641
|
+
"inbox pointer bad.tsv is malformed"
|
|
642
|
+
);
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
it("rejects operations after close", async () => {
|
|
646
|
+
const { store } = await initializedStore();
|
|
647
|
+
await store.close();
|
|
648
|
+
await expect(store.units.list()).rejects.toThrow("store is closed");
|
|
649
|
+
await expect(store.status.render()).rejects.toBeInstanceOf(UserError);
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
describe("orch CLI", () => {
|
|
654
|
+
it("prints commander help and rejects invalid parsing with exit 1", async () => {
|
|
655
|
+
const help = runCli(["--help"]);
|
|
656
|
+
expect(help.code).toBe(0);
|
|
657
|
+
expect(help.stdout).toContain("Commands:");
|
|
658
|
+
expect(help.stdout).toContain("unit");
|
|
659
|
+
expect(help.stdout).toContain("ledger");
|
|
660
|
+
|
|
661
|
+
const frontierHelp = runCli(["frontier", "set", "--help"]);
|
|
662
|
+
expect(frontierHelp.code).toBe(0);
|
|
663
|
+
expect(frontierHelp.stdout).toContain("--repo <dir>");
|
|
664
|
+
expect(frontierHelp.stdout).toContain("--forge <forge>");
|
|
665
|
+
expect(frontierHelp.stdout).toContain("--prs <n,...>");
|
|
666
|
+
|
|
667
|
+
const directory = await makeDirectory();
|
|
668
|
+
const invalid = runCli(["--store", directory, "unit", "add", "u1"]);
|
|
669
|
+
expect(invalid.code).toBe(1);
|
|
670
|
+
expect(invalid.stderr).toContain("required option '--track <track>'");
|
|
671
|
+
|
|
672
|
+
const badForge = runCli([
|
|
673
|
+
"--store",
|
|
674
|
+
directory,
|
|
675
|
+
"frontier",
|
|
676
|
+
"set",
|
|
677
|
+
"--repo",
|
|
678
|
+
directory,
|
|
679
|
+
"--forge",
|
|
680
|
+
"gt",
|
|
681
|
+
]);
|
|
682
|
+
expect(badForge.code).toBe(1);
|
|
683
|
+
expect(badForge.stderr).toContain("Allowed choices are gh, origin");
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
it("accepts ORCH_STORE and emits complete JSON", async () => {
|
|
687
|
+
const directory = await makeDirectory();
|
|
688
|
+
const env = { ...process.env, ORCH_STORE: directory };
|
|
689
|
+
expect(runCli(["init"], env).code).toBe(0);
|
|
690
|
+
|
|
691
|
+
const added = runCli(
|
|
692
|
+
["unit", "add", "u1", "--track", "build", "--json"],
|
|
693
|
+
env
|
|
694
|
+
);
|
|
695
|
+
expect(added.code).toBe(0);
|
|
696
|
+
expect(JSON.parse(added.stdout)).toEqual({
|
|
697
|
+
id: "u1",
|
|
698
|
+
track: "build",
|
|
699
|
+
state: "pending",
|
|
700
|
+
branch: "",
|
|
701
|
+
pr: "",
|
|
702
|
+
sha: "",
|
|
703
|
+
brief: "",
|
|
704
|
+
});
|
|
705
|
+
});
|
|
706
|
+
|
|
707
|
+
it("maps user and not-found outcomes to the preserved exit codes", async () => {
|
|
708
|
+
const directory = await makeDirectory();
|
|
709
|
+
expect(runCli(["--store", directory, "init"]).code).toBe(0);
|
|
710
|
+
|
|
711
|
+
const missingRepo = runCli([
|
|
712
|
+
"--store",
|
|
713
|
+
directory,
|
|
714
|
+
"frontier",
|
|
715
|
+
"set",
|
|
716
|
+
]);
|
|
717
|
+
expect(missingRepo.code).toBe(1);
|
|
718
|
+
expect(missingRepo.stderr).toContain(
|
|
719
|
+
"set --repo <dir> or ORCH_REPO"
|
|
720
|
+
);
|
|
721
|
+
|
|
722
|
+
const userError = runCli([
|
|
723
|
+
"--store",
|
|
724
|
+
directory,
|
|
725
|
+
"unit",
|
|
726
|
+
"add",
|
|
727
|
+
"",
|
|
728
|
+
"--track",
|
|
729
|
+
"build",
|
|
730
|
+
]);
|
|
731
|
+
expect(userError.code).toBe(1);
|
|
732
|
+
expect(userError.stderr).toContain("unit id must not be empty");
|
|
733
|
+
|
|
734
|
+
const missingUnit = runCli([
|
|
735
|
+
"--store",
|
|
736
|
+
directory,
|
|
737
|
+
"unit",
|
|
738
|
+
"get",
|
|
739
|
+
"missing",
|
|
740
|
+
]);
|
|
741
|
+
expect(missingUnit.code).toBe(2);
|
|
742
|
+
expect(missingUnit.stderr).toContain("unit missing not found");
|
|
743
|
+
|
|
744
|
+
const missingLedger = runCli([
|
|
745
|
+
"--store",
|
|
746
|
+
directory,
|
|
747
|
+
"--json",
|
|
748
|
+
"ledger",
|
|
749
|
+
"check",
|
|
750
|
+
"184530",
|
|
751
|
+
"abc123",
|
|
752
|
+
]);
|
|
753
|
+
expect(missingLedger.code).toBe(2);
|
|
754
|
+
expect(JSON.parse(missingLedger.stdout)).toEqual({
|
|
755
|
+
pr: "184530",
|
|
756
|
+
sha: "abc123",
|
|
757
|
+
verdict: "NOT-VERIFIED",
|
|
758
|
+
});
|
|
759
|
+
expect(missingLedger.stderr).toBe("");
|
|
760
|
+
});
|
|
761
|
+
});
|