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,588 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
NotFoundError,
|
|
5
|
+
UsageError,
|
|
6
|
+
openStore,
|
|
7
|
+
parseVerdict,
|
|
8
|
+
type Counts,
|
|
9
|
+
type Forge,
|
|
10
|
+
type Frontier,
|
|
11
|
+
type InboxPointer,
|
|
12
|
+
type OpenGate,
|
|
13
|
+
type StandingLine,
|
|
14
|
+
type StatusReport,
|
|
15
|
+
type Store,
|
|
16
|
+
type Unit,
|
|
17
|
+
type Verdict,
|
|
18
|
+
} from "./store.ts";
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
Command as CommanderCommand,
|
|
22
|
+
CommanderError,
|
|
23
|
+
InvalidArgumentError,
|
|
24
|
+
Option,
|
|
25
|
+
} from "../vendor/commander/esm.mjs";
|
|
26
|
+
type Command = InstanceType<typeof CommanderCommand>;
|
|
27
|
+
|
|
28
|
+
const DISPLAY_LIMIT = 4;
|
|
29
|
+
|
|
30
|
+
interface Io {
|
|
31
|
+
readonly stdout: (value: string) => void;
|
|
32
|
+
readonly stderr: (value: string) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface GlobalOptions {
|
|
36
|
+
readonly store?: string;
|
|
37
|
+
readonly json: boolean;
|
|
38
|
+
readonly force: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface UnitAddOptions {
|
|
42
|
+
readonly track: string;
|
|
43
|
+
readonly brief?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface UnitSetOptions {
|
|
47
|
+
readonly state: string;
|
|
48
|
+
readonly branch?: string;
|
|
49
|
+
readonly pr?: number;
|
|
50
|
+
readonly sha?: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface UnitListOptions {
|
|
54
|
+
readonly state?: string;
|
|
55
|
+
readonly track?: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface LedgerRecordOptions {
|
|
59
|
+
readonly evidence: string;
|
|
60
|
+
readonly verifier?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface InboxPushOptions {
|
|
64
|
+
readonly report?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface InboxDrainOptions {
|
|
68
|
+
readonly peek: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface GateParkOptions {
|
|
72
|
+
readonly question: string;
|
|
73
|
+
readonly options: string;
|
|
74
|
+
readonly default: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
interface GateResolveOptions {
|
|
78
|
+
readonly answer: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
interface FrontierSetOptions {
|
|
82
|
+
readonly repo?: string;
|
|
83
|
+
readonly forge: Forge;
|
|
84
|
+
readonly prs?: readonly number[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function message(error: unknown): string {
|
|
88
|
+
return error instanceof Error ? error.message : String(error);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function positiveInteger(value: string): number {
|
|
92
|
+
const parsed = Number(value);
|
|
93
|
+
if (!/^[1-9]\d*$/.test(value) || !Number.isSafeInteger(parsed)) {
|
|
94
|
+
throw new InvalidArgumentError("must be a positive integer");
|
|
95
|
+
}
|
|
96
|
+
return parsed;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function prList(value: string): readonly number[] {
|
|
100
|
+
const parts = value.split(",");
|
|
101
|
+
if (parts.some((part) => part.length === 0)) {
|
|
102
|
+
throw new InvalidArgumentError("requires a comma-separated PR list");
|
|
103
|
+
}
|
|
104
|
+
return parts.map(positiveInteger);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function countLine(value: Counts): string {
|
|
108
|
+
const entries = Object.entries(value);
|
|
109
|
+
return entries.length === 0
|
|
110
|
+
? "none"
|
|
111
|
+
: entries.map(([name, count]) => `${name}=${count}`).join(", ");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function unitLine(unit: Unit): string {
|
|
115
|
+
return [
|
|
116
|
+
unit.id,
|
|
117
|
+
unit.track,
|
|
118
|
+
unit.state,
|
|
119
|
+
unit.branch,
|
|
120
|
+
unit.pr,
|
|
121
|
+
unit.sha,
|
|
122
|
+
unit.brief,
|
|
123
|
+
].join("\t");
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function pointerLine(pointer: InboxPointer): string {
|
|
127
|
+
return [
|
|
128
|
+
pointer.ts,
|
|
129
|
+
pointer.agent,
|
|
130
|
+
pointer.unit,
|
|
131
|
+
pointer.status,
|
|
132
|
+
pointer.report,
|
|
133
|
+
].join("\t");
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function gateLine(gate: OpenGate): string {
|
|
137
|
+
return [
|
|
138
|
+
gate.id,
|
|
139
|
+
gate.question,
|
|
140
|
+
gate.options,
|
|
141
|
+
gate.defaultAnswer,
|
|
142
|
+
].join("\t");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function compactRows<T>(
|
|
146
|
+
rows: readonly T[],
|
|
147
|
+
format: (row: T) => string,
|
|
148
|
+
empty: string,
|
|
149
|
+
limit: number | null = DISPLAY_LIMIT
|
|
150
|
+
): string {
|
|
151
|
+
if (rows.length === 0) {
|
|
152
|
+
return empty;
|
|
153
|
+
}
|
|
154
|
+
const visible = limit === null ? rows : rows.slice(0, limit);
|
|
155
|
+
const lines = visible.map(format);
|
|
156
|
+
if (limit !== null && rows.length > limit) {
|
|
157
|
+
lines.push(`... ${rows.length - limit} more; use --json`);
|
|
158
|
+
}
|
|
159
|
+
return lines.join("\n");
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function frontierLine(value: Frontier): string {
|
|
163
|
+
const prs =
|
|
164
|
+
value.prs.length === 0
|
|
165
|
+
? "none"
|
|
166
|
+
: value.prs
|
|
167
|
+
.map(
|
|
168
|
+
(row) =>
|
|
169
|
+
`${row.branches}#${row.pr}@${row.sha}:${row.state}`
|
|
170
|
+
)
|
|
171
|
+
.join(",");
|
|
172
|
+
return `generation=${value.generation} prs=${prs} lowest-unmerged=${value.lowestUnmerged ?? "none"}`;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function statusLines(report: StatusReport): string {
|
|
176
|
+
const visible = report.summary.openGateIds.slice(0, DISPLAY_LIMIT);
|
|
177
|
+
const more =
|
|
178
|
+
report.summary.openGateIds.length > DISPLAY_LIMIT
|
|
179
|
+
? `,+${report.summary.openGateIds.length - DISPLAY_LIMIT} more`
|
|
180
|
+
: "";
|
|
181
|
+
return [
|
|
182
|
+
`counts: units=${report.units.length}; states=${countLine(report.summary.unitStates)}; ledger=${countLine(report.summary.ledgerVerdicts)}`,
|
|
183
|
+
`changed: ${report.changed}`,
|
|
184
|
+
`gates open: ${report.summary.openGateIds.length}${
|
|
185
|
+
visible.length > 0 ? `; ids=${visible.join(",")}${more}` : ""
|
|
186
|
+
}`,
|
|
187
|
+
].join("\n");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function emit<T>(
|
|
191
|
+
io: Io,
|
|
192
|
+
json: boolean,
|
|
193
|
+
value: T,
|
|
194
|
+
compact: (result: T) => string,
|
|
195
|
+
jsonValue: (result: T) => unknown = (result) => result
|
|
196
|
+
): void {
|
|
197
|
+
const rendered = json
|
|
198
|
+
? JSON.stringify(jsonValue(value), null, 2)
|
|
199
|
+
: compact(value);
|
|
200
|
+
io.stdout(rendered.endsWith("\n") ? rendered : `${rendered}\n`);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function storeDirectory(program: Command): string {
|
|
204
|
+
const value = program.opts<GlobalOptions>().store;
|
|
205
|
+
if (value === undefined || value.trim().length === 0) {
|
|
206
|
+
throw new UsageError("set --store <dir> or ORCH_STORE");
|
|
207
|
+
}
|
|
208
|
+
return value;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function frontierRepo(options: FrontierSetOptions): string {
|
|
212
|
+
const value = options.repo;
|
|
213
|
+
if (value === undefined || value.trim().length === 0) {
|
|
214
|
+
throw new UsageError("set --repo <dir> or ORCH_REPO");
|
|
215
|
+
}
|
|
216
|
+
return value;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
async function runStore<T>(
|
|
220
|
+
program: Command,
|
|
221
|
+
io: Io,
|
|
222
|
+
operation: (store: Store) => Promise<T>,
|
|
223
|
+
compact: (result: T) => string,
|
|
224
|
+
jsonValue?: (result: T) => unknown
|
|
225
|
+
): Promise<void> {
|
|
226
|
+
const options = program.opts<GlobalOptions>();
|
|
227
|
+
const store = openStore(storeDirectory(program), {
|
|
228
|
+
force: options.force,
|
|
229
|
+
onLockStolen: (holder) =>
|
|
230
|
+
io.stderr(`stealing store lock held by pid ${holder}\n`),
|
|
231
|
+
onStaleLock: (holder) =>
|
|
232
|
+
io.stderr(`replacing stale store lock (pid ${holder} is dead)\n`),
|
|
233
|
+
});
|
|
234
|
+
try {
|
|
235
|
+
const result = await operation(store);
|
|
236
|
+
emit(io, options.json, result, compact, jsonValue);
|
|
237
|
+
} finally {
|
|
238
|
+
await store.close();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function leaf(parent: Command, name: string, description: string): Command {
|
|
243
|
+
return parent
|
|
244
|
+
.command(name)
|
|
245
|
+
.description(description)
|
|
246
|
+
.allowExcessArguments(false);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function requireSubcommand(program: Command): never {
|
|
250
|
+
storeDirectory(program);
|
|
251
|
+
throw new UsageError("a valid command is required");
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function createProgram(io: Io): Command {
|
|
255
|
+
const program = new CommanderCommand("orch")
|
|
256
|
+
.description("Plain-file orchestrate bookkeeping")
|
|
257
|
+
.usage("[--store <dir>] [--json] [--force] <command>")
|
|
258
|
+
.configureOutput({ writeOut: io.stdout, writeErr: io.stderr })
|
|
259
|
+
.exitOverride()
|
|
260
|
+
.showHelpAfterError()
|
|
261
|
+
.allowExcessArguments(false)
|
|
262
|
+
.addOption(
|
|
263
|
+
new Option("--store <dir>", "store directory (or ORCH_STORE)").env(
|
|
264
|
+
"ORCH_STORE"
|
|
265
|
+
)
|
|
266
|
+
)
|
|
267
|
+
.option("--json", "print complete rows as JSON", false)
|
|
268
|
+
.option("--force", "steal an existing store lock", false);
|
|
269
|
+
|
|
270
|
+
leaf(program, "init", "initialize the store").action(() =>
|
|
271
|
+
runStore(
|
|
272
|
+
program,
|
|
273
|
+
io,
|
|
274
|
+
(store) => store.init(),
|
|
275
|
+
(result) => `initialized ${result.store}`
|
|
276
|
+
)
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
const unit = program
|
|
280
|
+
.command("unit")
|
|
281
|
+
.description("manage work units")
|
|
282
|
+
.action(() => requireSubcommand(program));
|
|
283
|
+
leaf(unit, "add <id>", "add a unit")
|
|
284
|
+
.requiredOption("--track <track>", "unit track")
|
|
285
|
+
.option("--brief <path>", "brief path")
|
|
286
|
+
.action((id: string, options: UnitAddOptions) =>
|
|
287
|
+
runStore(
|
|
288
|
+
program,
|
|
289
|
+
io,
|
|
290
|
+
(store) =>
|
|
291
|
+
store.units.add({
|
|
292
|
+
id,
|
|
293
|
+
track: options.track,
|
|
294
|
+
brief: options.brief,
|
|
295
|
+
}),
|
|
296
|
+
unitLine
|
|
297
|
+
)
|
|
298
|
+
);
|
|
299
|
+
leaf(unit, "set <id>", "update a unit")
|
|
300
|
+
.requiredOption("--state <state>", "unit state")
|
|
301
|
+
.option("--branch <branch>", "branch name")
|
|
302
|
+
.option("--pr <number>", "pull request number", positiveInteger)
|
|
303
|
+
.option("--sha <sha>", "commit SHA")
|
|
304
|
+
.action((id: string, options: UnitSetOptions) =>
|
|
305
|
+
runStore(
|
|
306
|
+
program,
|
|
307
|
+
io,
|
|
308
|
+
(store) =>
|
|
309
|
+
store.units.set({
|
|
310
|
+
id,
|
|
311
|
+
state: options.state,
|
|
312
|
+
branch: options.branch,
|
|
313
|
+
pr: options.pr,
|
|
314
|
+
sha: options.sha,
|
|
315
|
+
}),
|
|
316
|
+
unitLine
|
|
317
|
+
)
|
|
318
|
+
);
|
|
319
|
+
leaf(unit, "get <id>", "get a unit").action((id: string) =>
|
|
320
|
+
runStore(program, io, (store) => store.units.get(id), unitLine)
|
|
321
|
+
);
|
|
322
|
+
leaf(unit, "list", "list units")
|
|
323
|
+
.option("--state <state>", "filter by state")
|
|
324
|
+
.option("--track <track>", "filter by track")
|
|
325
|
+
.action((options: UnitListOptions) =>
|
|
326
|
+
runStore(
|
|
327
|
+
program,
|
|
328
|
+
io,
|
|
329
|
+
(store) => store.units.list(options),
|
|
330
|
+
(rows) => compactRows(rows, unitLine, "(no units)")
|
|
331
|
+
)
|
|
332
|
+
);
|
|
333
|
+
leaf(unit, "counts", "count units by state").action(() =>
|
|
334
|
+
runStore(program, io, (store) => store.units.counts(), countLine)
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
const ledger = program
|
|
338
|
+
.command("ledger")
|
|
339
|
+
.description("manage verification records")
|
|
340
|
+
.action(() => requireSubcommand(program));
|
|
341
|
+
leaf(ledger, "record", "record a verification verdict")
|
|
342
|
+
.argument("<pr>", "pull request number", positiveInteger)
|
|
343
|
+
.argument("<sha>", "commit SHA")
|
|
344
|
+
.argument("<verdict>", "verification verdict", parseVerdict)
|
|
345
|
+
.requiredOption("--evidence <path>", "evidence path")
|
|
346
|
+
.option("--verifier <name>", "verifier name")
|
|
347
|
+
.action(
|
|
348
|
+
(
|
|
349
|
+
pr: number,
|
|
350
|
+
sha: string,
|
|
351
|
+
verdict: Verdict,
|
|
352
|
+
options: LedgerRecordOptions
|
|
353
|
+
) =>
|
|
354
|
+
runStore(
|
|
355
|
+
program,
|
|
356
|
+
io,
|
|
357
|
+
(store) =>
|
|
358
|
+
store.ledger.record({
|
|
359
|
+
pr,
|
|
360
|
+
sha,
|
|
361
|
+
verdict,
|
|
362
|
+
evidence: options.evidence,
|
|
363
|
+
verifier: options.verifier,
|
|
364
|
+
}),
|
|
365
|
+
(row) => `${row.pr}\t${row.sha}\t${row.verdict}`
|
|
366
|
+
)
|
|
367
|
+
);
|
|
368
|
+
leaf(ledger, "check", "check a verification verdict")
|
|
369
|
+
.argument("<pr>", "pull request number", positiveInteger)
|
|
370
|
+
.argument("<sha>", "commit SHA")
|
|
371
|
+
.action((pr: number, sha: string) =>
|
|
372
|
+
runStore(
|
|
373
|
+
program,
|
|
374
|
+
io,
|
|
375
|
+
(store) => store.ledger.check({ pr, sha }),
|
|
376
|
+
(row) => row.verdict
|
|
377
|
+
)
|
|
378
|
+
);
|
|
379
|
+
leaf(ledger, "summary", "count verification verdicts").action(() =>
|
|
380
|
+
runStore(program, io, (store) => store.ledger.summary(), countLine)
|
|
381
|
+
);
|
|
382
|
+
|
|
383
|
+
const inbox = program
|
|
384
|
+
.command("inbox")
|
|
385
|
+
.description("manage agent pointers")
|
|
386
|
+
.action(() => requireSubcommand(program));
|
|
387
|
+
leaf(inbox, "push <agent> <unit> <status>", "push an inbox pointer")
|
|
388
|
+
.option("--report <path>", "report path")
|
|
389
|
+
.action(
|
|
390
|
+
(
|
|
391
|
+
agent: string,
|
|
392
|
+
unitId: string,
|
|
393
|
+
status: string,
|
|
394
|
+
options: InboxPushOptions
|
|
395
|
+
) =>
|
|
396
|
+
runStore(
|
|
397
|
+
program,
|
|
398
|
+
io,
|
|
399
|
+
(store) =>
|
|
400
|
+
store.inbox.push({
|
|
401
|
+
agent,
|
|
402
|
+
unit: unitId,
|
|
403
|
+
status,
|
|
404
|
+
report: options.report,
|
|
405
|
+
}),
|
|
406
|
+
(result) =>
|
|
407
|
+
`${result.pointer.unit}\t${result.pointer.status}\t${result.filename}`,
|
|
408
|
+
(result) => result.pointer
|
|
409
|
+
)
|
|
410
|
+
);
|
|
411
|
+
leaf(inbox, "drain", "drain inbox pointers")
|
|
412
|
+
.option("--peek", "read without draining", false)
|
|
413
|
+
.action((options: InboxDrainOptions) =>
|
|
414
|
+
runStore(
|
|
415
|
+
program,
|
|
416
|
+
io,
|
|
417
|
+
(store) =>
|
|
418
|
+
options.peek ? store.inbox.peek() : store.inbox.drain(),
|
|
419
|
+
(rows) => compactRows(rows, pointerLine, "(empty)", null)
|
|
420
|
+
)
|
|
421
|
+
);
|
|
422
|
+
leaf(inbox, "count", "count inbox pointers").action(() =>
|
|
423
|
+
runStore(
|
|
424
|
+
program,
|
|
425
|
+
io,
|
|
426
|
+
(store) => store.inbox.count(),
|
|
427
|
+
String,
|
|
428
|
+
(count) => ({ count })
|
|
429
|
+
)
|
|
430
|
+
);
|
|
431
|
+
|
|
432
|
+
const gate = program
|
|
433
|
+
.command("gate")
|
|
434
|
+
.description("manage decision gates")
|
|
435
|
+
.action(() => requireSubcommand(program));
|
|
436
|
+
leaf(gate, "park <id>", "park a decision gate")
|
|
437
|
+
.requiredOption("--question <question>", "gate question")
|
|
438
|
+
.requiredOption("--options <options>", "gate options")
|
|
439
|
+
.requiredOption("--default <answer>", "default answer")
|
|
440
|
+
.action((id: string, options: GateParkOptions) =>
|
|
441
|
+
runStore(
|
|
442
|
+
program,
|
|
443
|
+
io,
|
|
444
|
+
(store) =>
|
|
445
|
+
store.gates.park({
|
|
446
|
+
id,
|
|
447
|
+
question: options.question,
|
|
448
|
+
options: options.options,
|
|
449
|
+
defaultAnswer: options.default,
|
|
450
|
+
}),
|
|
451
|
+
(result) => `${result.id}\topen`
|
|
452
|
+
)
|
|
453
|
+
);
|
|
454
|
+
leaf(gate, "list", "list open decision gates").action(() =>
|
|
455
|
+
runStore(
|
|
456
|
+
program,
|
|
457
|
+
io,
|
|
458
|
+
(store) => store.gates.list(),
|
|
459
|
+
(rows) => compactRows(rows, gateLine, "(no open gates)")
|
|
460
|
+
)
|
|
461
|
+
);
|
|
462
|
+
leaf(gate, "resolve <id>", "resolve a decision gate")
|
|
463
|
+
.requiredOption("--answer <answer>", "chosen answer")
|
|
464
|
+
.action((id: string, options: GateResolveOptions) =>
|
|
465
|
+
runStore(
|
|
466
|
+
program,
|
|
467
|
+
io,
|
|
468
|
+
(store) => store.gates.resolve({ id, answer: options.answer }),
|
|
469
|
+
(result) => `${result.id}\tresolved\t${result.answer}`
|
|
470
|
+
)
|
|
471
|
+
);
|
|
472
|
+
|
|
473
|
+
const frontier = program
|
|
474
|
+
.command("frontier")
|
|
475
|
+
.description("manage the stack frontier")
|
|
476
|
+
.action(() => requireSubcommand(program));
|
|
477
|
+
leaf(
|
|
478
|
+
frontier,
|
|
479
|
+
"set",
|
|
480
|
+
"resolve the pull request base chain and set the frontier"
|
|
481
|
+
)
|
|
482
|
+
.addOption(
|
|
483
|
+
new Option(
|
|
484
|
+
"--repo <dir>",
|
|
485
|
+
"repository directory (or ORCH_REPO)"
|
|
486
|
+
).env("ORCH_REPO")
|
|
487
|
+
)
|
|
488
|
+
.addOption(
|
|
489
|
+
new Option("--forge <forge>", "pull request forge")
|
|
490
|
+
.choices(["gh", "origin"])
|
|
491
|
+
.default("gh")
|
|
492
|
+
)
|
|
493
|
+
.option(
|
|
494
|
+
"--prs <n,...>",
|
|
495
|
+
"optional expected pull request order pin",
|
|
496
|
+
prList
|
|
497
|
+
)
|
|
498
|
+
.action((options: FrontierSetOptions) =>
|
|
499
|
+
runStore(
|
|
500
|
+
program,
|
|
501
|
+
io,
|
|
502
|
+
(store) =>
|
|
503
|
+
store.frontier.set({
|
|
504
|
+
repo: frontierRepo(options),
|
|
505
|
+
forge: options.forge,
|
|
506
|
+
prs: options.prs,
|
|
507
|
+
}),
|
|
508
|
+
frontierLine
|
|
509
|
+
)
|
|
510
|
+
);
|
|
511
|
+
leaf(frontier, "show", "show the frontier").action(() =>
|
|
512
|
+
runStore(program, io, (store) => store.frontier.show(), frontierLine)
|
|
513
|
+
);
|
|
514
|
+
|
|
515
|
+
leaf(program, "status", "render status.md and print a summary").action(() =>
|
|
516
|
+
runStore(program, io, (store) => store.status.render(), statusLines)
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
const standing = program
|
|
520
|
+
.command("standing")
|
|
521
|
+
.description("manage standing orders")
|
|
522
|
+
.action(() => requireSubcommand(program));
|
|
523
|
+
leaf(standing, "show", "show standing orders").action(() =>
|
|
524
|
+
runStore(
|
|
525
|
+
program,
|
|
526
|
+
io,
|
|
527
|
+
(store) => store.standing.show(),
|
|
528
|
+
(rows) =>
|
|
529
|
+
compactRows(
|
|
530
|
+
rows,
|
|
531
|
+
(item: StandingLine) => `${item.number}. ${item.line}`,
|
|
532
|
+
"(no standing orders)"
|
|
533
|
+
)
|
|
534
|
+
)
|
|
535
|
+
);
|
|
536
|
+
leaf(standing, "add <line>", "add a standing order").action((line: string) =>
|
|
537
|
+
runStore(
|
|
538
|
+
program,
|
|
539
|
+
io,
|
|
540
|
+
(store) => store.standing.add({ line }),
|
|
541
|
+
(item) => `${item.number}. ${item.line}`
|
|
542
|
+
)
|
|
543
|
+
);
|
|
544
|
+
|
|
545
|
+
program.action(() => requireSubcommand(program));
|
|
546
|
+
return program;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
function handleError(error: unknown, program: Command, io: Io): number {
|
|
550
|
+
if (error instanceof CommanderError) {
|
|
551
|
+
return error.exitCode === 0 ? 0 : 1;
|
|
552
|
+
}
|
|
553
|
+
const json = program.opts<GlobalOptions>().json;
|
|
554
|
+
if (error instanceof NotFoundError) {
|
|
555
|
+
const output = error.output;
|
|
556
|
+
if (output === undefined) {
|
|
557
|
+
io.stderr(`error: ${error.message}\n`);
|
|
558
|
+
} else {
|
|
559
|
+
emit(io, json, output.json, () => output.compact);
|
|
560
|
+
}
|
|
561
|
+
return 2;
|
|
562
|
+
}
|
|
563
|
+
io.stderr(`error: ${message(error)}\n`);
|
|
564
|
+
if (error instanceof UsageError) {
|
|
565
|
+
io.stderr(program.helpInformation());
|
|
566
|
+
}
|
|
567
|
+
return 1;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export async function main(
|
|
571
|
+
argv: readonly string[],
|
|
572
|
+
io: Io = {
|
|
573
|
+
stdout: (value) => process.stdout.write(value),
|
|
574
|
+
stderr: (value) => process.stderr.write(value),
|
|
575
|
+
}
|
|
576
|
+
): Promise<number> {
|
|
577
|
+
const program = createProgram(io);
|
|
578
|
+
try {
|
|
579
|
+
await program.parseAsync(argv, { from: "user" });
|
|
580
|
+
return 0;
|
|
581
|
+
} catch (error) {
|
|
582
|
+
return handleError(error, program, io);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (import.meta.main) {
|
|
587
|
+
process.exitCode = await main(process.argv.slice(2));
|
|
588
|
+
}
|