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,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: raga-artifacts
|
|
3
|
+
description: Make shareable slides and documents for developers and clients, with Mermaid diagrams rendered by Pele, exported as a self-contained HTML file and a PDF. Use when the user asks for a deck, slides, a report, a proposal, a one-pager, or another polished document to share.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Raga artifacts
|
|
7
|
+
|
|
8
|
+
You make slides and documents the user can send to developers and clients. You write one static HTML source file. The builder renders its Mermaid diagrams to SVG with Pele, highlights code, inlines local images, and prints a PDF with headless Chrome. The results are `dist/<name>.html`, which works offline, and `dist/<name>.pdf`.
|
|
9
|
+
|
|
10
|
+
## Load the helper
|
|
11
|
+
|
|
12
|
+
Work in the Python tool:
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
exec(await read("<directory of this SKILL.md>/artifact_tool.py"), globals())
|
|
16
|
+
artifact_setup("<directory of this SKILL.md>")
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Steps
|
|
20
|
+
|
|
21
|
+
1. **Ask what to make.** Ask the user, then wait for the answer:
|
|
22
|
+
- Slides or a document?
|
|
23
|
+
- Who reads it: developers, clients, or both?
|
|
24
|
+
- What should the reader know or decide at the end?
|
|
25
|
+
- Which material should it use: files, notes, or this conversation?
|
|
26
|
+
- Is there a theme or brand color?
|
|
27
|
+
|
|
28
|
+
If the user already answered these, do not ask again.
|
|
29
|
+
2. **Outline.** Propose an outline: one line per slide, or one line per section. Wait for approval before you write the full artifact. Keep decks to 6 to 12 slides unless the user asks for more.
|
|
30
|
+
3. **Start from a template.** Run `artifact_new("slides", "artifacts/<name>/<name>.html")` or `artifact_new("doc", ...)`. The default folder is `artifacts/` in the project. Use the template's markup and classes.
|
|
31
|
+
4. **Write the content.** Edit the source file with the edit or write tools.
|
|
32
|
+
5. **Build and look.** Run `result = await artifact_build(path, preview=True)`. If `result["ok"]` is false, fix every item in `problems` and build again. Fix every item in `layout`: each one is a slide or block that does not fit its page. Read every item in `warnings`. If your tools can show you images, open `result["preview"]` and fix crowded slides, unreadable diagrams, and awkward empty space. The Python REPL's `read` returns raw bytes for images, so in a REPL session rely on `layout` and ask the user to look at the PDF.
|
|
33
|
+
6. **Hand it over.** Give the user the PDF path and the HTML path. Report the slide or page count and any warning you did not fix. Then offer the sharing options below.
|
|
34
|
+
|
|
35
|
+
## Writing rules
|
|
36
|
+
|
|
37
|
+
- Each slide makes one point, and its title states that point as a sentence. Use at most five bullets.
|
|
38
|
+
- For clients, lead with the outcome and the decision you need. For developers, show the design, the trade-offs, and the code.
|
|
39
|
+
- Prefer a diagram, a table, or one large number over a paragraph.
|
|
40
|
+
- Do not invent numbers, quotes, logos, or customer names. Use only what the user or the project provides, and mark estimates as estimates.
|
|
41
|
+
|
|
42
|
+
## Markup
|
|
43
|
+
|
|
44
|
+
The templates define these pieces. Combine them instead of writing new CSS:
|
|
45
|
+
|
|
46
|
+
| Markup | Use |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `<section class="slide">` | One slide. Add `title`, `section`, or `statement` for those layouts. |
|
|
49
|
+
| `<div class="kicker">` | Small label above a title |
|
|
50
|
+
| `<div class="cols" style="--cols: 3">` | Columns. The default is 2. |
|
|
51
|
+
| `<div class="card">` | A boxed group |
|
|
52
|
+
| `<div class="stat"><div class="value">42%</div><div class="label">...</div></div>` | A large number |
|
|
53
|
+
| `<div class="callout good">` | A highlighted note. Variants are `good`, `warn`, and `bad`. |
|
|
54
|
+
| `<span class="tag">` | A small label |
|
|
55
|
+
| `<pre class="mermaid">...</pre>` | A diagram in Mermaid syntax. Escape `<`, `>`, and `&` as `<`, `>`, and `&`. |
|
|
56
|
+
| `<pre><code class="language-ts">...</code></pre>` | Code, highlighted at build time |
|
|
57
|
+
| `<img src="images/x.png">` | A local image, inlined at build time |
|
|
58
|
+
| `<div class="footer">` | Slide footer |
|
|
59
|
+
| `<div class="page-break">` | Start a new page in a document |
|
|
60
|
+
|
|
61
|
+
Set the theme with `data-theme` on `<html>`. The values are `light`, `dark`, and `ink`. To use a brand color, change `--accent` and `--accent-soft` in the `:root` block. Diagrams take their colors from the same variables.
|
|
62
|
+
|
|
63
|
+
## Diagrams
|
|
64
|
+
|
|
65
|
+
Pele renders these 32 diagram types. Pick the type that fits the point, not always a flowchart. Before you write a type for the first time in a session, read its example in [diagrams.md](diagrams.md). Always do this for keywords that end in `-beta` and for `eventmodeling`, because their syntax is new.
|
|
66
|
+
|
|
67
|
+
| Type | Keyword | Use for | Audience |
|
|
68
|
+
|---|---|---|---|
|
|
69
|
+
| Flowchart | `flowchart LR` | Processes, decisions, pipelines | both |
|
|
70
|
+
| Sequence | `sequenceDiagram` | Requests between services or people over time | developers |
|
|
71
|
+
| Class | `classDiagram` | Types, interfaces, and their relations | developers |
|
|
72
|
+
| State | `stateDiagram-v2` | Lifecycles and state machines | developers |
|
|
73
|
+
| Entity relationship | `erDiagram` | Database tables and relations | developers |
|
|
74
|
+
| C4 | `C4Context` | System context, containers, components | both |
|
|
75
|
+
| Architecture | `architecture-beta` | Cloud and service topology with groups and icons | both |
|
|
76
|
+
| Block | `block` | Layered or grid layouts of components | developers |
|
|
77
|
+
| Packet | `packet` | Bit and byte layouts of protocols or file formats | developers |
|
|
78
|
+
| Git graph | `gitGraph` | Branching and release strategy | developers |
|
|
79
|
+
| Agentflow | `agentflow-beta` | AI agent and tool-call workflows | developers |
|
|
80
|
+
| Railroad | `railroad-ebnf-beta` | Grammar and syntax rules | developers |
|
|
81
|
+
| Event modeling | `eventmodeling` | Commands, events, and views of an event-driven system | developers |
|
|
82
|
+
| Requirement | `requirementDiagram` | Requirements and what satisfies or verifies them | both |
|
|
83
|
+
| Gantt | `gantt` | Schedules with tasks and dependencies | clients |
|
|
84
|
+
| Timeline | `timeline` | Milestones and history | clients |
|
|
85
|
+
| Kanban | `kanban` | Work status by column | clients |
|
|
86
|
+
| User journey | `journey` | Steps a user takes, with satisfaction scores | clients |
|
|
87
|
+
| Mindmap | `mindmap` | Topics and ideas branching from one center | clients |
|
|
88
|
+
| Use case | `usecase-beta` | Actors and what they can do | both |
|
|
89
|
+
| Swimlane | `swimlane-beta` | A process split by team or role | clients |
|
|
90
|
+
| Tree view | `treeView-beta` | File trees and hierarchies | developers |
|
|
91
|
+
| Pie | `pie` | Parts of a whole, at most six slices | clients |
|
|
92
|
+
| XY chart | `xychart` | Bar and line charts over a series | clients |
|
|
93
|
+
| Quadrant chart | `quadrantChart` | Two-axis prioritization, such as effort against impact | clients |
|
|
94
|
+
| Sankey | `sankey` | Flows of volume, money, or traffic between stages | clients |
|
|
95
|
+
| Treemap | `treemap-beta` | Sizes of nested parts, such as cost or code by module | both |
|
|
96
|
+
| Radar | `radar-beta` | Comparing options across several criteria | clients |
|
|
97
|
+
| Venn | `venn-beta` | Overlap between groups | clients |
|
|
98
|
+
| Ishikawa | `ishikawa-beta` | Root causes of a problem, fishbone style | both |
|
|
99
|
+
| Cynefin | `cynefin-beta` | Sorting problems by how predictable they are | clients |
|
|
100
|
+
| Wardley map | `wardley-beta` | Strategy: components by visibility and maturity | clients |
|
|
101
|
+
|
|
102
|
+
Keep a slide diagram to about 15 nodes. If a diagram fails to build, the problem names the diagram number. Compare it with the example and fix the syntax.
|
|
103
|
+
|
|
104
|
+
## Limits the builder enforces
|
|
105
|
+
|
|
106
|
+
- No `<script>`, `<iframe>`, `<object>`, or `<embed>`. Artifacts are static so they print and share safely.
|
|
107
|
+
- No remote images, stylesheets, or fonts. Download images next to the source. Fonts come from the reader's system: the theme lists Inter first and falls back to system fonts.
|
|
108
|
+
- A slide whose content overflows its 1600 by 900 frame adds a PDF page. The builder warns when the page count differs from the slide count.
|
|
109
|
+
|
|
110
|
+
## Sharing
|
|
111
|
+
|
|
112
|
+
The PDF is the default deliverable. It opens everywhere and looks the same for every reader. The HTML file is a second copy for screens.
|
|
113
|
+
|
|
114
|
+
Offer these only when the user asks for a link, and run any of them only after the user agrees, because each one publishes the file:
|
|
115
|
+
|
|
116
|
+
- A secret GitHub gist: `gh gist create dist/<name>.html`. Anyone with the link can read it. GitHub shows HTML in a gist as source code, so readers must download the file to view it.
|
|
117
|
+
- A static host the user already uses, such as GitHub Pages.
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Build a self-contained artifact from an HTML source: render Mermaid blocks to SVG with Pele,
|
|
4
|
+
* highlight code, inline local images, check the layout, then print to PDF with headless Chrome.
|
|
5
|
+
*
|
|
6
|
+
* node artifact.mjs build <source.html> [--out <dir>] [--no-pdf] [--preview]
|
|
7
|
+
*
|
|
8
|
+
* Prints one JSON object. Exit 1 lists every problem instead of producing a partial artifact.
|
|
9
|
+
*/
|
|
10
|
+
import { spawn } from "node:child_process";
|
|
11
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
12
|
+
import { createRequire } from "node:module";
|
|
13
|
+
import { tmpdir } from "node:os";
|
|
14
|
+
import { basename, delimiter, dirname, extname, join, resolve } from "node:path";
|
|
15
|
+
import { pathToFileURL } from "node:url";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Pele and highlight.js are pinned dependencies of raga. Resolve them from this file first, which works
|
|
19
|
+
* for the bundled copy inside the raga package, then from the installed raga executable, which works
|
|
20
|
+
* for a copy in an instance revision.
|
|
21
|
+
*/
|
|
22
|
+
function packageRequires() {
|
|
23
|
+
const roots = [import.meta.url];
|
|
24
|
+
if (process.env.RAGA_PACKAGE_DIR) roots.push(pathToFileURL(join(process.env.RAGA_PACKAGE_DIR, "package.json")).href);
|
|
25
|
+
for (const directory of (process.env.PATH ?? "").split(delimiter)) {
|
|
26
|
+
const raga = join(directory, "raga");
|
|
27
|
+
if (!existsSync(raga)) continue;
|
|
28
|
+
roots.push(pathToFileURL(realpathSync(raga)).href);
|
|
29
|
+
}
|
|
30
|
+
return roots.map((root) => createRequire(root));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function resolveDependency(name) {
|
|
34
|
+
for (const require of packageRequires()) {
|
|
35
|
+
try {
|
|
36
|
+
return require.resolve(name);
|
|
37
|
+
} catch {}
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Cannot find ${name}. Run the skill from a raga installation, or set RAGA_PACKAGE_DIR to the raga package directory.`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const MIME = { ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg", ".gif": "image/gif", ".svg": "image/svg+xml", ".webp": "image/webp" };
|
|
43
|
+
const ENTITIES = { "<": "<", ">": ">", """: '"', "'": "'", "'": "'", " ": " ", "&": "&" };
|
|
44
|
+
const decode = (text) => text.replace(/&(?:lt|gt|quot|#39|apos|nbsp|amp);/g, (entity) => ENTITIES[entity]);
|
|
45
|
+
|
|
46
|
+
function chromePath() {
|
|
47
|
+
const candidates = [
|
|
48
|
+
process.env.CHROME_PATH,
|
|
49
|
+
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
|
50
|
+
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
|
51
|
+
"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge",
|
|
52
|
+
"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser",
|
|
53
|
+
];
|
|
54
|
+
for (const directory of (process.env.PATH ?? "").split(delimiter)) {
|
|
55
|
+
for (const name of ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser", "microsoft-edge"]) {
|
|
56
|
+
candidates.push(join(directory, name));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return candidates.find((path) => path && existsSync(path));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Run headless Chrome on a local file with a throwaway profile, so it never touches the user's browser. */
|
|
63
|
+
function runChrome(chrome, htmlPath, outputPath, extraArgs) {
|
|
64
|
+
return chromeProcess(chrome, htmlPath, extraArgs).then(() => {
|
|
65
|
+
if (!existsSync(outputPath)) throw new Error(`Chrome did not write ${outputPath}`);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Run headless Chrome and return its standard output. */
|
|
70
|
+
function runChromeOutput(chrome, htmlPath, extraArgs) {
|
|
71
|
+
return chromeProcess(chrome, htmlPath, extraArgs);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function chromeProcess(chrome, htmlPath, extraArgs) {
|
|
75
|
+
const profile = mkdtempSync(join(tmpdir(), "raga-artifact-chrome-"));
|
|
76
|
+
const args = [
|
|
77
|
+
"--headless=new",
|
|
78
|
+
"--disable-gpu",
|
|
79
|
+
"--no-first-run",
|
|
80
|
+
"--no-default-browser-check",
|
|
81
|
+
"--disable-extensions",
|
|
82
|
+
`--user-data-dir=${profile}`,
|
|
83
|
+
"--virtual-time-budget=5000",
|
|
84
|
+
...extraArgs,
|
|
85
|
+
pathToFileURL(htmlPath).href,
|
|
86
|
+
];
|
|
87
|
+
const { promise, resolve: done, reject } = Promise.withResolvers();
|
|
88
|
+
const child = spawn(chrome, args, { stdio: ["ignore", "pipe", "pipe"] });
|
|
89
|
+
let stdout = "";
|
|
90
|
+
let stderr = "";
|
|
91
|
+
child.stdout.on("data", (chunk) => {
|
|
92
|
+
if (stdout.length < 20_000_000) stdout += chunk;
|
|
93
|
+
});
|
|
94
|
+
child.stderr.on("data", (chunk) => {
|
|
95
|
+
if (stderr.length < 20000) stderr += chunk;
|
|
96
|
+
});
|
|
97
|
+
const timer = setTimeout(() => child.kill("SIGKILL"), 120000);
|
|
98
|
+
child.once("error", reject);
|
|
99
|
+
child.once("close", (code) => {
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
rmSync(profile, { recursive: true, force: true });
|
|
102
|
+
if (code === 0) done(stdout);
|
|
103
|
+
else reject(new Error(`Chrome failed (exit ${code}). ${stderr.trim().slice(-2000)}`));
|
|
104
|
+
});
|
|
105
|
+
return promise;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Measure layout in Chrome: a slide whose content leaves its frame, or a wide block in a document. */
|
|
109
|
+
async function checkLayout(chrome, htmlPath) {
|
|
110
|
+
const probe = `<script>addEventListener("load", () => {
|
|
111
|
+
const issues = [];
|
|
112
|
+
document.querySelectorAll("section.slide").forEach((slide, index) => {
|
|
113
|
+
const frame = slide.getBoundingClientRect();
|
|
114
|
+
let bottom = 0, right = 0;
|
|
115
|
+
for (const el of slide.querySelectorAll("*")) {
|
|
116
|
+
if (el.closest(".footer")) continue;
|
|
117
|
+
const rect = el.getBoundingClientRect();
|
|
118
|
+
if (!rect.width || !rect.height) continue;
|
|
119
|
+
bottom = Math.max(bottom, rect.bottom - frame.top);
|
|
120
|
+
right = Math.max(right, rect.right - frame.left);
|
|
121
|
+
}
|
|
122
|
+
const over = Math.round(Math.max(bottom - frame.height, right - frame.width, slide.scrollHeight - slide.clientHeight));
|
|
123
|
+
if (over > 1) issues.push("Slide " + (index + 1) + " overflows its frame by " + over + "px. Cut content or split the slide.");
|
|
124
|
+
});
|
|
125
|
+
document.querySelectorAll("main pre, main table, main figure, main img").forEach((el) => {
|
|
126
|
+
const over = el.scrollWidth - el.clientWidth;
|
|
127
|
+
if (over > 1) issues.push("A " + el.tagName.toLowerCase() + " is " + over + "px wider than the page. Shorten lines or narrow it.");
|
|
128
|
+
});
|
|
129
|
+
const out = document.createElement("pre");
|
|
130
|
+
out.id = "raga-layout";
|
|
131
|
+
out.textContent = JSON.stringify(issues);
|
|
132
|
+
document.body.append(out);
|
|
133
|
+
});</script>`;
|
|
134
|
+
const directory = mkdtempSync(join(tmpdir(), "raga-artifact-layout-"));
|
|
135
|
+
try {
|
|
136
|
+
const probePath = join(directory, "probe.html");
|
|
137
|
+
writeFileSync(probePath, readFileSync(htmlPath, "utf8").replace(/<\/body>/i, `${probe}</body>`));
|
|
138
|
+
const dom = await runChromeOutput(chrome, probePath, ["--window-size=1680,1000", "--dump-dom"]);
|
|
139
|
+
const match = /<pre id="raga-layout">([\s\S]*?)<\/pre>/.exec(dom);
|
|
140
|
+
return match ? JSON.parse(decode(match[1])) : ["The layout check did not finish."];
|
|
141
|
+
} finally {
|
|
142
|
+
rmSync(directory, { recursive: true, force: true });
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** Page count from the PDF's page tree. Chrome writes it uncompressed. */
|
|
147
|
+
function pdfPages(pdfPath) {
|
|
148
|
+
const text = readFileSync(pdfPath).toString("latin1");
|
|
149
|
+
const counts = [...text.matchAll(/\/Type\s*\/Pages\b[^>]*?\/Count\s+(\d+)/g)].map((match) => Number(match[1]));
|
|
150
|
+
return counts.length ? Math.max(...counts) : undefined;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async function build(sourcePath, options) {
|
|
154
|
+
const source = readFileSync(sourcePath, "utf8");
|
|
155
|
+
const directory = dirname(sourcePath);
|
|
156
|
+
const problems = [];
|
|
157
|
+
const warnings = [];
|
|
158
|
+
if (/<script\b/i.test(source)) problems.push("Remove <script> elements. Artifacts are static so they print and share safely.");
|
|
159
|
+
if (/<(?:iframe|object|embed)\b/i.test(source)) problems.push("Remove <iframe>, <object>, and <embed> elements.");
|
|
160
|
+
if (/<link\b[^>]*href\s*=\s*["']https?:/i.test(source) || /url\(\s*["']?https?:/i.test(source))
|
|
161
|
+
problems.push("Remove remote stylesheets, fonts, and background images. The artifact must work offline.");
|
|
162
|
+
|
|
163
|
+
const { render, PeleError } = await import(pathToFileURL(resolveDependency("pele")).href);
|
|
164
|
+
const hljs = createRequire(import.meta.url)(resolveDependency("highlight.js"));
|
|
165
|
+
const font = /--font-sans\s*:\s*([^;]+);/.exec(source)?.[1]?.trim() ?? "sans-serif";
|
|
166
|
+
|
|
167
|
+
let diagrams = 0;
|
|
168
|
+
let html = source.replace(/<pre\b([^>]*\bclass\s*=\s*["'][^"']*\bmermaid\b[^"']*["'][^>]*)>([\s\S]*?)<\/pre>/gi, (_whole, _attrs, body) => {
|
|
169
|
+
diagrams++;
|
|
170
|
+
try {
|
|
171
|
+
return `<figure class="diagram">${render(decode(body).trim(), { fontFamily: font }).svg}</figure>`;
|
|
172
|
+
} catch (error) {
|
|
173
|
+
if (!(error instanceof PeleError)) throw error;
|
|
174
|
+
problems.push(`Diagram ${diagrams}: ${error.message}`);
|
|
175
|
+
return "";
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
let codeBlocks = 0;
|
|
180
|
+
html = html.replace(/<pre>\s*<code\b[^>]*\bclass\s*=\s*["'][^"']*\blanguage-([\w+-]+)[^"']*["'][^>]*>([\s\S]*?)<\/code>\s*<\/pre>/gi, (whole, language, body) => {
|
|
181
|
+
if (!hljs.getLanguage(language)) {
|
|
182
|
+
warnings.push(`Code block language "${language}" is unknown; left unhighlighted.`);
|
|
183
|
+
return whole;
|
|
184
|
+
}
|
|
185
|
+
codeBlocks++;
|
|
186
|
+
return `<pre class="code"><code class="hljs language-${language}">${hljs.highlight(decode(body), { language, ignoreIllegals: true }).value}</code></pre>`;
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
let images = 0;
|
|
190
|
+
html = html.replace(/(<img\b[^>]*\bsrc\s*=\s*)(["'])([^"']+)\2/gi, (whole, prefix, quote, src) => {
|
|
191
|
+
if (src.startsWith("data:")) return whole;
|
|
192
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(src)) {
|
|
193
|
+
problems.push(`Image ${src} is remote. Download it next to the source and use a relative path.`);
|
|
194
|
+
return whole;
|
|
195
|
+
}
|
|
196
|
+
const file = resolve(directory, decode(src));
|
|
197
|
+
const mime = MIME[extname(file).toLowerCase()];
|
|
198
|
+
if (!mime || !existsSync(file) || !statSync(file).isFile()) {
|
|
199
|
+
problems.push(`Image ${src} is missing or not a PNG, JPEG, GIF, SVG, or WebP file.`);
|
|
200
|
+
return whole;
|
|
201
|
+
}
|
|
202
|
+
images++;
|
|
203
|
+
return `${prefix}${quote}data:${mime};base64,${readFileSync(file).toString("base64")}${quote}`;
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
const slides = (html.match(/<section\b[^>]*\bclass\s*=\s*["'][^"']*\bslide\b/gi) ?? []).length;
|
|
207
|
+
if (problems.length) return { ok: false, problems, warnings };
|
|
208
|
+
|
|
209
|
+
const outDir = resolve(options.out ?? join(directory, "dist"));
|
|
210
|
+
mkdirSync(outDir, { recursive: true });
|
|
211
|
+
const name = basename(sourcePath).replace(/\.html?$/i, "");
|
|
212
|
+
const htmlPath = join(outDir, `${name}.html`);
|
|
213
|
+
writeFileSync(htmlPath, html);
|
|
214
|
+
const result = { ok: true, html: htmlPath, diagrams, codeBlocks, images, slides, warnings };
|
|
215
|
+
if (!options.pdf && !options.preview) return result;
|
|
216
|
+
const chrome = chromePath();
|
|
217
|
+
if (!chrome) return { ...result, ok: false, problems: ["No Chrome, Chromium, Edge, or Brave found. Install one or set CHROME_PATH."] };
|
|
218
|
+
result.layout = await checkLayout(chrome, htmlPath);
|
|
219
|
+
if (options.preview) {
|
|
220
|
+
// Screen layout: slides stack 900px frames with 40px gaps inside 40px padding; a document gets its first pages.
|
|
221
|
+
const size = slides ? `1680,${slides * 940 + 80}` : "900,3600";
|
|
222
|
+
const previewPath = join(outDir, `${name}.png`);
|
|
223
|
+
rmSync(previewPath, { force: true });
|
|
224
|
+
await runChrome(chrome, htmlPath, previewPath, ["--hide-scrollbars", `--window-size=${size}`, `--screenshot=${previewPath}`]);
|
|
225
|
+
result.preview = previewPath;
|
|
226
|
+
}
|
|
227
|
+
if (!options.pdf) return result;
|
|
228
|
+
const pdfPath = join(outDir, `${name}.pdf`);
|
|
229
|
+
rmSync(pdfPath, { force: true });
|
|
230
|
+
await runChrome(chrome, htmlPath, pdfPath, ["--no-pdf-header-footer", "--print-to-pdf-no-header", `--print-to-pdf=${pdfPath}`]);
|
|
231
|
+
const pages = pdfPages(pdfPath);
|
|
232
|
+
if (slides && pages !== undefined && pages !== slides)
|
|
233
|
+
warnings.push(`The PDF has ${pages} pages for ${slides} slides. A slide overflows its page; shorten it or split it.`);
|
|
234
|
+
return { ...result, pdf: pdfPath, pages };
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const [command, sourceArg, ...rest] = process.argv.slice(2);
|
|
238
|
+
if (command !== "build" || !sourceArg) {
|
|
239
|
+
console.error("Usage: node artifact.mjs build <source.html> [--out <dir>] [--no-pdf] [--preview]");
|
|
240
|
+
process.exit(2);
|
|
241
|
+
}
|
|
242
|
+
const outIndex = rest.indexOf("--out");
|
|
243
|
+
try {
|
|
244
|
+
const result = await build(resolve(sourceArg), {
|
|
245
|
+
out: outIndex >= 0 ? rest[outIndex + 1] : undefined,
|
|
246
|
+
pdf: !rest.includes("--no-pdf"),
|
|
247
|
+
preview: rest.includes("--preview"),
|
|
248
|
+
});
|
|
249
|
+
console.log(JSON.stringify(result, null, 2));
|
|
250
|
+
process.exit(result.ok ? 0 : 1);
|
|
251
|
+
} catch (error) {
|
|
252
|
+
console.log(JSON.stringify({ ok: false, problems: [error instanceof Error ? error.message : String(error)], warnings: [] }, null, 2));
|
|
253
|
+
process.exit(1);
|
|
254
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""Artifact helpers for the raga Python REPL. Load with exec(await read(path), globals()), then call artifact_setup."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import shlex
|
|
6
|
+
import shutil
|
|
7
|
+
|
|
8
|
+
ARTIFACT_SKILL_DIR = None
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def artifact_setup(skill_dir):
|
|
12
|
+
"""Remember where this skill lives so the other helpers find the builder and templates."""
|
|
13
|
+
global ARTIFACT_SKILL_DIR
|
|
14
|
+
ARTIFACT_SKILL_DIR = os.path.abspath(skill_dir)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _skill(path):
|
|
18
|
+
if ARTIFACT_SKILL_DIR is None:
|
|
19
|
+
raise RuntimeError("Call artifact_setup(<directory of the raga-artifacts SKILL.md>) first")
|
|
20
|
+
return os.path.join(ARTIFACT_SKILL_DIR, path)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def artifact_new(kind, path):
|
|
24
|
+
"""Copy the slides or doc template to path. Refuses to overwrite an existing file."""
|
|
25
|
+
if kind not in ("slides", "doc"):
|
|
26
|
+
raise ValueError('kind must be "slides" or "doc"')
|
|
27
|
+
path = os.path.abspath(path)
|
|
28
|
+
if os.path.exists(path):
|
|
29
|
+
raise FileExistsError(path + " exists. Edit it, or choose another path")
|
|
30
|
+
os.makedirs(os.path.dirname(path), exist_ok=True)
|
|
31
|
+
shutil.copyfile(_skill(os.path.join("templates", kind + ".html")), path)
|
|
32
|
+
return path
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
async def artifact_build(source, pdf=True, preview=False, out=None):
|
|
36
|
+
"""Build source into dist/<name>.html and, by default, dist/<name>.pdf. Returns the builder's JSON.
|
|
37
|
+
|
|
38
|
+
ok is False with a problems list when a diagram fails, the source has scripts or remote assets,
|
|
39
|
+
or no browser is found. preview=True also writes dist/<name>.png for a visual check.
|
|
40
|
+
"""
|
|
41
|
+
command = "node " + shlex.quote(_skill("artifact.mjs")) + " build " + shlex.quote(os.path.abspath(source))
|
|
42
|
+
if out:
|
|
43
|
+
command += " --out " + shlex.quote(os.path.abspath(out))
|
|
44
|
+
if not pdf:
|
|
45
|
+
command += " --no-pdf"
|
|
46
|
+
if preview:
|
|
47
|
+
command += " --preview"
|
|
48
|
+
runner = globals().get("bash")
|
|
49
|
+
if runner is None:
|
|
50
|
+
raise RuntimeError("artifact_build runs in the raga Python REPL, where bash is available")
|
|
51
|
+
output = await runner(command + " 2>&1; true", timeout=300)
|
|
52
|
+
start = output.find("{")
|
|
53
|
+
if start < 0:
|
|
54
|
+
return {"ok": False, "problems": [output.strip()], "warnings": []}
|
|
55
|
+
return json.loads(output[start:])
|