superacli 1.0.1 → 1.1.2
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/.beads/.br_history/issues.20260308_200823_636718328.jsonl +20 -0
- package/.beads/.br_history/issues.20260308_200823_636718328.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_200827_033159453.jsonl +21 -0
- package/.beads/.br_history/issues.20260308_200827_033159453.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_200829_595900053.jsonl +22 -0
- package/.beads/.br_history/issues.20260308_200829_595900053.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_200834_079930100.jsonl +23 -0
- package/.beads/.br_history/issues.20260308_200834_079930100.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_200858_370924996.jsonl +24 -0
- package/.beads/.br_history/issues.20260308_200858_370924996.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201031_019730855.jsonl +24 -0
- package/.beads/.br_history/issues.20260308_201031_019730855.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201031_578974884.jsonl +24 -0
- package/.beads/.br_history/issues.20260308_201031_578974884.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201054_780345548.jsonl +24 -0
- package/.beads/.br_history/issues.20260308_201054_780345548.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201054_896980019.jsonl +24 -0
- package/.beads/.br_history/issues.20260308_201054_896980019.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201128_599819688.jsonl +24 -0
- package/.beads/.br_history/issues.20260308_201128_599819688.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201128_710221699.jsonl +24 -0
- package/.beads/.br_history/issues.20260308_201128_710221699.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201204_745649213.jsonl +24 -0
- package/.beads/.br_history/issues.20260308_201204_745649213.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201338_908436144.jsonl +24 -0
- package/.beads/.br_history/issues.20260308_201338_908436144.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201344_734860714.jsonl +25 -0
- package/.beads/.br_history/issues.20260308_201344_734860714.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_201630_819282295.jsonl +25 -0
- package/.beads/.br_history/issues.20260308_201630_819282295.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_203538_054279699.jsonl +25 -0
- package/.beads/.br_history/issues.20260308_203538_054279699.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_203547_597113070.jsonl +26 -0
- package/.beads/.br_history/issues.20260308_203547_597113070.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_203547_775139216.jsonl +27 -0
- package/.beads/.br_history/issues.20260308_203547_775139216.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_203547_950724773.jsonl +28 -0
- package/.beads/.br_history/issues.20260308_203547_950724773.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_203548_107684523.jsonl +29 -0
- package/.beads/.br_history/issues.20260308_203548_107684523.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_203548_310389993.jsonl +30 -0
- package/.beads/.br_history/issues.20260308_203548_310389993.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_203825_953337320.jsonl +31 -0
- package/.beads/.br_history/issues.20260308_203825_953337320.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_204056_071377736.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_204056_071377736.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205141_517616844.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205141_517616844.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205141_648994024.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205141_648994024.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205141_867598036.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205141_867598036.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205142_094157355.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205142_094157355.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205142_327315677.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205142_327315677.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205142_545563822.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205142_545563822.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205213_061989333.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205213_061989333.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205213_181103364.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205213_181103364.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205213_408872234.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205213_408872234.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205213_616681652.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205213_616681652.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205213_821507069.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205213_821507069.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205214_026661112.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205214_026661112.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205454_955250554.jsonl +32 -0
- package/.beads/.br_history/issues.20260308_205454_955250554.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205556_337800392.jsonl +33 -0
- package/.beads/.br_history/issues.20260308_205556_337800392.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_205824_274686694.jsonl +33 -0
- package/.beads/.br_history/issues.20260308_205824_274686694.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_210240_583768328.jsonl +34 -0
- package/.beads/.br_history/issues.20260308_210240_583768328.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212223_641541494.jsonl +34 -0
- package/.beads/.br_history/issues.20260308_212223_641541494.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212227_735550996.jsonl +35 -0
- package/.beads/.br_history/issues.20260308_212227_735550996.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212232_547298548.jsonl +36 -0
- package/.beads/.br_history/issues.20260308_212232_547298548.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212528_843628125.jsonl +37 -0
- package/.beads/.br_history/issues.20260308_212528_843628125.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212529_094530502.jsonl +38 -0
- package/.beads/.br_history/issues.20260308_212529_094530502.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212529_331000853.jsonl +39 -0
- package/.beads/.br_history/issues.20260308_212529_331000853.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212529_587925652.jsonl +40 -0
- package/.beads/.br_history/issues.20260308_212529_587925652.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212804_927764103.jsonl +41 -0
- package/.beads/.br_history/issues.20260308_212804_927764103.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212805_153673453.jsonl +42 -0
- package/.beads/.br_history/issues.20260308_212805_153673453.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212805_415982363.jsonl +43 -0
- package/.beads/.br_history/issues.20260308_212805_415982363.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212805_657497741.jsonl +44 -0
- package/.beads/.br_history/issues.20260308_212805_657497741.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212805_952838724.jsonl +45 -0
- package/.beads/.br_history/issues.20260308_212805_952838724.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212806_325433779.jsonl +46 -0
- package/.beads/.br_history/issues.20260308_212806_325433779.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212806_584685598.jsonl +47 -0
- package/.beads/.br_history/issues.20260308_212806_584685598.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212806_827817208.jsonl +48 -0
- package/.beads/.br_history/issues.20260308_212806_827817208.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212807_111320451.jsonl +49 -0
- package/.beads/.br_history/issues.20260308_212807_111320451.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212807_409545536.jsonl +50 -0
- package/.beads/.br_history/issues.20260308_212807_409545536.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212807_625063294.jsonl +51 -0
- package/.beads/.br_history/issues.20260308_212807_625063294.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212807_843906551.jsonl +52 -0
- package/.beads/.br_history/issues.20260308_212807_843906551.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212808_100304073.jsonl +53 -0
- package/.beads/.br_history/issues.20260308_212808_100304073.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212808_324723976.jsonl +54 -0
- package/.beads/.br_history/issues.20260308_212808_324723976.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212808_557513104.jsonl +55 -0
- package/.beads/.br_history/issues.20260308_212808_557513104.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_212808_788048322.jsonl +56 -0
- package/.beads/.br_history/issues.20260308_212808_788048322.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_213702_613249728.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_213702_613249728.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_213715_115792063.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_213715_115792063.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_213715_462220666.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_213715_462220666.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_213727_191258923.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_213727_191258923.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_213727_684383652.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_213727_684383652.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_213735_751882991.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_213735_751882991.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_222052_279844960.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_222052_279844960.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_222056_873282114.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_222056_873282114.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_222103_402410761.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_222103_402410761.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_235202_180577215.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_235202_180577215.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_235202_387414163.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_235202_387414163.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_235202_564422794.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_235202_564422794.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_235202_742600597.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_235202_742600597.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_235208_133360069.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_235208_133360069.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_235505_473406307.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_235505_473406307.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_235505_662360489.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_235505_662360489.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_235505_843935624.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_235505_843935624.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260308_235506_044530221.jsonl +57 -0
- package/.beads/.br_history/issues.20260308_235506_044530221.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_002618_115728731.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_002618_115728731.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_003748_878174586.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_003748_878174586.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_004057_868755623.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_004057_868755623.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_004058_512842163.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_004058_512842163.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_004058_994445226.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_004058_994445226.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_004059_475988596.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_004059_475988596.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_161902_566857851.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_161902_566857851.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_170512_277017739.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_170512_277017739.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_170512_477876921.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_170512_477876921.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_170512_664382701.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_170512_664382701.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_170512_859400333.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_170512_859400333.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_212326_082771164.jsonl +57 -0
- package/.beads/.br_history/issues.20260309_212326_082771164.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_212326_245619716.jsonl +58 -0
- package/.beads/.br_history/issues.20260309_212326_245619716.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_212326_403198317.jsonl +59 -0
- package/.beads/.br_history/issues.20260309_212326_403198317.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_212332_539197678.jsonl +60 -0
- package/.beads/.br_history/issues.20260309_212332_539197678.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_212332_731373599.jsonl +60 -0
- package/.beads/.br_history/issues.20260309_212332_731373599.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_212332_928710953.jsonl +60 -0
- package/.beads/.br_history/issues.20260309_212332_928710953.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_213021_341505240.jsonl +60 -0
- package/.beads/.br_history/issues.20260309_213021_341505240.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_213022_023136934.jsonl +60 -0
- package/.beads/.br_history/issues.20260309_213022_023136934.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260309_213022_400050719.jsonl +60 -0
- package/.beads/.br_history/issues.20260309_213022_400050719.jsonl.meta.json +1 -0
- package/.beads/config.yaml +4 -0
- package/.beads/issues.jsonl +60 -0
- package/.beads/metadata.json +4 -0
- package/README.md +226 -43
- package/__tests__/adapter-schema.test.js +119 -0
- package/__tests__/ask.test.js +327 -0
- package/__tests__/aws-plugin.test.js +84 -0
- package/__tests__/az-plugin.test.js +84 -0
- package/__tests__/builtin-adapter.test.js +29 -0
- package/__tests__/cline-plugin.test.js +109 -0
- package/__tests__/cline-skill.test.js +49 -0
- package/__tests__/config.test.js +297 -0
- package/__tests__/docker-plugin.test.js +95 -0
- package/__tests__/executor.test.js +303 -0
- package/__tests__/eza-plugin.test.js +81 -0
- package/__tests__/gcloud-plugin.test.js +86 -0
- package/__tests__/gh-plugin.test.js +86 -0
- package/__tests__/helm-plugin.test.js +81 -0
- package/__tests__/help-json.test.js +19 -0
- package/__tests__/http-adapter.test.js +118 -0
- package/__tests__/just-plugin.test.js +82 -0
- package/__tests__/kubectl-plugin.test.js +83 -0
- package/__tests__/linear-plugin.test.js +81 -0
- package/__tests__/mcp-adapter.test.js +187 -0
- package/__tests__/mcp-local.test.js +105 -0
- package/__tests__/namespace-passthrough.test.js +69 -0
- package/__tests__/nextest-plugin.test.js +82 -0
- package/__tests__/npm-plugin.test.js +81 -0
- package/__tests__/nullclaw-plugin.test.js +157 -0
- package/__tests__/openapi-adapter.test.js +199 -0
- package/__tests__/plan-runtime.test.js +43 -0
- package/__tests__/planner.test.js +47 -0
- package/__tests__/plugin-agency-agents.test.js +62 -0
- package/__tests__/plugin-nullclaw.test.js +78 -0
- package/__tests__/plugin-visual-explainer.test.js +62 -0
- package/__tests__/plugins-command.test.js +220 -0
- package/__tests__/plugins-manager.test.js +353 -0
- package/__tests__/plugins-registry.test.js +114 -0
- package/__tests__/plugins-store.test.js +115 -0
- package/__tests__/pnpm-plugin.test.js +81 -0
- package/__tests__/poetry-plugin.test.js +83 -0
- package/__tests__/process-adapter.test.js +143 -0
- package/__tests__/pulumi-plugin.test.js +81 -0
- package/__tests__/railway-plugin.test.js +84 -0
- package/__tests__/server-app.test.js +67 -0
- package/__tests__/server-config-service.test.js +79 -0
- package/__tests__/server-routes-ask.test.js +89 -0
- package/__tests__/server-routes-commands.test.js +55 -0
- package/__tests__/server-routes-config.test.js +87 -0
- package/__tests__/server-routes-jobs.test.js +53 -0
- package/__tests__/server-routes-misc.test.js +112 -0
- package/__tests__/server-storage-adapter.test.js +40 -0
- package/__tests__/server-storage-file.test.js +73 -0
- package/__tests__/server-storage-mongo.test.js +74 -0
- package/__tests__/shell-adapter.test.js +90 -0
- package/__tests__/skills-catalog.test.js +98 -0
- package/__tests__/skills.test.js +442 -0
- package/__tests__/stripe-plugin.test.js +81 -0
- package/__tests__/supabase-plugin.test.js +86 -0
- package/__tests__/terraform-plugin.test.js +83 -0
- package/__tests__/uv-plugin.test.js +81 -0
- package/__tests__/vercel-plugin.test.js +81 -0
- package/__tests__/watchexec-plugin.test.js +80 -0
- package/cli/adapter-schema.js +108 -0
- package/cli/adapters/builtin.js +43 -0
- package/cli/adapters/process.js +262 -0
- package/cli/adapters/shell.js +82 -0
- package/cli/config.js +12 -9
- package/cli/executor.js +6 -1
- package/cli/help-json.js +3 -1
- package/cli/namespace-passthrough.js +38 -0
- package/cli/plugin-install-guidance.js +320 -0
- package/cli/plugins-command.js +138 -0
- package/cli/plugins-manager.js +552 -0
- package/cli/plugins-registry.js +80 -0
- package/cli/plugins-store.js +56 -0
- package/cli/skills-catalog.js +237 -0
- package/cli/skills.js +180 -6
- package/cli/supercli.js +150 -58
- package/docs/docs.html +224 -0
- package/docs/feature-gaps.md +16 -0
- package/docs/index.html +164 -0
- package/docs/plugin-examples.md +397 -0
- package/docs/plugin-harness-guide.md +452 -0
- package/docs/plugins.md +44 -0
- package/docs/skills/cline-non-interactive/SKILL.md +59 -0
- package/docs/skills-catalog.md +81 -0
- package/docs/supported-harnesses.md +277 -0
- package/docs/visual-overview.md +21 -0
- package/jest.config.js +25 -0
- package/package.json +9 -3
- package/plugins/agency-agents/plugin.json +15 -0
- package/plugins/agency-agents/scripts/post-install.js +122 -0
- package/plugins/aws/README.md +46 -0
- package/plugins/aws/plugin.json +42 -0
- package/plugins/az/README.md +46 -0
- package/plugins/az/plugin.json +42 -0
- package/plugins/beads/plugin.json +202 -0
- package/plugins/clickup/plugin.json +38 -0
- package/plugins/clickup/scripts/post-install.js +107 -0
- package/plugins/clickup/scripts/post-uninstall.js +30 -0
- package/plugins/cline/README.md +48 -0
- package/plugins/cline/plugin.json +92 -0
- package/plugins/commiat/plugin.json +36 -0
- package/plugins/docker/MANIFEST.md +39 -0
- package/plugins/docker/README.md +35 -0
- package/plugins/docker/examples/build-image.sh +7 -0
- package/plugins/docker/examples/inspect-container.sh +6 -0
- package/plugins/docker/examples/list-containers.sh +4 -0
- package/plugins/docker/examples/multi-step-workflow.sh +10 -0
- package/plugins/docker/examples/run-container.sh +7 -0
- package/plugins/docker/plugin.json +266 -0
- package/plugins/eza/README.md +40 -0
- package/plugins/eza/plugin.json +42 -0
- package/plugins/gcloud/README.md +46 -0
- package/plugins/gcloud/plugin.json +42 -0
- package/plugins/gh/README.md +46 -0
- package/plugins/gh/plugin.json +43 -0
- package/plugins/gwc/plugin.json +35 -0
- package/plugins/helm/README.md +42 -0
- package/plugins/helm/plugin.json +42 -0
- package/plugins/just/README.md +42 -0
- package/plugins/just/plugin.json +42 -0
- package/plugins/kubectl/README.md +46 -0
- package/plugins/kubectl/plugin.json +42 -0
- package/plugins/linear/README.md +60 -0
- package/plugins/linear/plugin.json +42 -0
- package/plugins/nextest/README.md +42 -0
- package/plugins/nextest/plugin.json +42 -0
- package/plugins/npm/README.md +46 -0
- package/plugins/npm/plugin.json +42 -0
- package/plugins/nullclaw/README.md +45 -0
- package/plugins/nullclaw/plugin.json +64 -0
- package/plugins/nullclaw/scripts/post-install.js +189 -0
- package/plugins/nullclaw/scripts/post-uninstall.js +25 -0
- package/plugins/openfang/plugin.json +37 -0
- package/plugins/openfang/scripts/post-install.js +163 -0
- package/plugins/openfang/scripts/post-uninstall.js +30 -0
- package/plugins/plugins.json +295 -0
- package/plugins/pnpm/README.md +46 -0
- package/plugins/pnpm/plugin.json +42 -0
- package/plugins/poetry/README.md +46 -0
- package/plugins/poetry/plugin.json +42 -0
- package/plugins/pulumi/README.md +46 -0
- package/plugins/pulumi/plugin.json +42 -0
- package/plugins/railway/README.md +58 -0
- package/plugins/railway/plugin.json +43 -0
- package/plugins/stripe/README.md +49 -0
- package/plugins/stripe/plugin.json +52 -0
- package/plugins/supabase/README.md +55 -0
- package/plugins/supabase/plugin.json +42 -0
- package/plugins/superpowers/plugin.json +22 -0
- package/plugins/superpowers/scripts/post-install.js +124 -0
- package/plugins/superpowers/scripts/post-uninstall.js +30 -0
- package/plugins/terraform/README.md +46 -0
- package/plugins/terraform/plugin.json +42 -0
- package/plugins/uv/README.md +46 -0
- package/plugins/uv/plugin.json +42 -0
- package/plugins/vercel/README.md +47 -0
- package/plugins/vercel/plugin.json +42 -0
- package/plugins/visual-explainer/plugin.json +15 -0
- package/plugins/visual-explainer/scripts/post-install.js +111 -0
- package/plugins/watchexec/README.md +40 -0
- package/plugins/watchexec/plugin.json +42 -0
- package/tests/test-aws-smoke.sh +56 -0
- package/tests/test-az-smoke.sh +56 -0
- package/tests/test-cli.js +116 -2
- package/tests/test-cline-smoke.sh +37 -0
- package/tests/test-eza-smoke.sh +33 -0
- package/tests/test-gcloud-smoke.sh +56 -0
- package/tests/test-gh-smoke.sh +56 -0
- package/tests/test-helm-smoke.sh +33 -0
- package/tests/test-just-smoke.sh +40 -0
- package/tests/test-kubectl-smoke.sh +37 -0
- package/tests/test-linear-smoke.sh +97 -0
- package/tests/test-nextest-smoke.sh +33 -0
- package/tests/test-npm-smoke.sh +32 -0
- package/tests/test-nullclaw-smoke.sh +51 -0
- package/tests/test-plugins-registry.js +212 -0
- package/tests/test-pnpm-smoke.sh +33 -0
- package/tests/test-poetry-smoke.sh +33 -0
- package/tests/test-pulumi-smoke.sh +33 -0
- package/tests/test-railway-smoke.sh +95 -0
- package/tests/test-stripe-smoke.sh +55 -0
- package/tests/test-supabase-smoke.sh +95 -0
- package/tests/test-terraform-smoke.sh +33 -0
- package/tests/test-uv-smoke.sh +33 -0
- package/tests/test-vercel-smoke.sh +55 -0
- package/tests/test-watchexec-smoke.sh +33 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const {
|
|
2
|
+
getCLIConfig,
|
|
3
|
+
bumpVersion,
|
|
4
|
+
getNamespaces,
|
|
5
|
+
getResources,
|
|
6
|
+
getActions,
|
|
7
|
+
getCommand
|
|
8
|
+
} = require("../server/services/configService")
|
|
9
|
+
const { getStorage } = require("../server/storage/adapter")
|
|
10
|
+
|
|
11
|
+
jest.mock("../server/storage/adapter")
|
|
12
|
+
|
|
13
|
+
describe("configService", () => {
|
|
14
|
+
let mockStorage
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
jest.clearAllMocks()
|
|
18
|
+
mockStorage = {
|
|
19
|
+
listKeys: jest.fn(),
|
|
20
|
+
get: jest.fn(),
|
|
21
|
+
set: jest.fn()
|
|
22
|
+
}
|
|
23
|
+
getStorage.mockReturnValue(mockStorage)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test("getCLIConfig returns full structured config", async () => {
|
|
27
|
+
mockStorage.listKeys.mockImplementation((prefix) => {
|
|
28
|
+
if (prefix === "command:") return ["command:n.r.a"]
|
|
29
|
+
if (prefix === "mcp:") return ["mcp:s1"]
|
|
30
|
+
if (prefix === "spec:") return ["spec:sp1"]
|
|
31
|
+
return []
|
|
32
|
+
})
|
|
33
|
+
mockStorage.get.mockImplementation((key) => {
|
|
34
|
+
if (key === "command:n.r.a") return { namespace: "n", resource: "r", action: "a", adapter: "builtin" }
|
|
35
|
+
if (key === "mcp:s1") return { name: "s1", url: "u1" }
|
|
36
|
+
if (key === "spec:sp1") return { name: "sp1", url: "u2", auth: "none" }
|
|
37
|
+
if (key === "settings:config_version") return "10"
|
|
38
|
+
return null
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
const config = await getCLIConfig()
|
|
42
|
+
expect(config.version).toBe("10")
|
|
43
|
+
expect(config.commands).toHaveLength(1)
|
|
44
|
+
expect(config.mcp_servers).toHaveLength(1)
|
|
45
|
+
expect(config.specs).toHaveLength(1)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test("bumpVersion increments and saves", async () => {
|
|
49
|
+
mockStorage.get.mockResolvedValue("5")
|
|
50
|
+
const next = await bumpVersion()
|
|
51
|
+
expect(next).toBe("6")
|
|
52
|
+
expect(mockStorage.set).toHaveBeenCalledWith("settings:config_version", "6")
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test("getNamespaces extracts unique prefixes", async () => {
|
|
56
|
+
mockStorage.listKeys.mockResolvedValue(["command:n1.r.a", "command:n1.r.b", "command:n2.r.a"])
|
|
57
|
+
const ns = await getNamespaces()
|
|
58
|
+
expect(ns.sort()).toEqual(["n1", "n2"])
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
test("getResources extracts second part", async () => {
|
|
62
|
+
mockStorage.listKeys.mockResolvedValue(["command:n.r1.a", "command:n.r2.a"])
|
|
63
|
+
const res = await getResources("n")
|
|
64
|
+
expect(res.sort()).toEqual(["r1", "r2"])
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test("getActions extracts third part", async () => {
|
|
68
|
+
mockStorage.listKeys.mockResolvedValue(["command:n.r.a1", "command:n.r.a2"])
|
|
69
|
+
const act = await getActions("n", "r")
|
|
70
|
+
expect(act.sort()).toEqual(["a1", "a2"])
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
test("getCommand fetches by key", async () => {
|
|
74
|
+
mockStorage.get.mockResolvedValue({ id: "cmd" })
|
|
75
|
+
const cmd = await getCommand("n", "r", "a")
|
|
76
|
+
expect(cmd).toEqual({ id: "cmd" })
|
|
77
|
+
expect(mockStorage.get).toHaveBeenCalledWith("command:n.r.a")
|
|
78
|
+
})
|
|
79
|
+
})
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const askRouter = require("../server/routes/ask")
|
|
2
|
+
const configService = require("../server/services/configService")
|
|
3
|
+
|
|
4
|
+
jest.mock("../server/services/configService")
|
|
5
|
+
|
|
6
|
+
function getHandler(router, method, path) {
|
|
7
|
+
const route = router.stack.find(s => s.route && s.route.path === path && s.route.methods[method])
|
|
8
|
+
return route ? route.route.stack[0].handle : null
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe("server routes - ask", () => {
|
|
12
|
+
let req, res
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks()
|
|
16
|
+
res = {
|
|
17
|
+
json: jest.fn().mockReturnThis(),
|
|
18
|
+
status: jest.fn().mockReturnThis()
|
|
19
|
+
}
|
|
20
|
+
global.fetch = jest.fn()
|
|
21
|
+
process.env.OPENAI_BASE_URL = "http://openai"
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
delete process.env.OPENAI_BASE_URL
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test("POST / returns 400 if query missing", async () => {
|
|
29
|
+
const handler = getHandler(askRouter, "post", "/")
|
|
30
|
+
await handler({ body: {} }, res)
|
|
31
|
+
expect(res.status).toHaveBeenCalledWith(400)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test("POST / returns 501 if OPENAI_BASE_URL missing", async () => {
|
|
35
|
+
delete process.env.OPENAI_BASE_URL
|
|
36
|
+
const handler = getHandler(askRouter, "post", "/")
|
|
37
|
+
await handler({ body: { query: "hi" } }, res)
|
|
38
|
+
expect(res.status).toHaveBeenCalledWith(501)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test("POST / successfully calls LLM and returns steps", async () => {
|
|
42
|
+
const handler = getHandler(askRouter, "post", "/")
|
|
43
|
+
configService.getNamespaces.mockResolvedValue(["n"])
|
|
44
|
+
configService.getResources.mockResolvedValue(["r"])
|
|
45
|
+
configService.getActions.mockResolvedValue(["a"])
|
|
46
|
+
configService.getCommand.mockResolvedValue({ description: "desc", args: [{ name: "f", required: true }] })
|
|
47
|
+
|
|
48
|
+
global.fetch.mockResolvedValue({
|
|
49
|
+
ok: true,
|
|
50
|
+
json: () => Promise.resolve({
|
|
51
|
+
choices: [{ message: { content: '[{"command": "n.r.a"}]' } }]
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
await handler({ body: { query: "help" } }, res)
|
|
56
|
+
|
|
57
|
+
expect(res.json).toHaveBeenCalledWith({ steps: [{ command: "n.r.a" }] })
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
test("POST / handles markdown-wrapped JSON from LLM", async () => {
|
|
61
|
+
const handler = getHandler(askRouter, "post", "/")
|
|
62
|
+
configService.getNamespaces.mockResolvedValue([])
|
|
63
|
+
|
|
64
|
+
global.fetch.mockResolvedValue({
|
|
65
|
+
ok: true,
|
|
66
|
+
json: () => Promise.resolve({
|
|
67
|
+
choices: [{ message: { content: '```json\n[{"ok":true}]\n```' } }]
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
await handler({ body: { query: "help" } }, res)
|
|
72
|
+
expect(res.json).toHaveBeenCalledWith({ steps: [{ ok: true }] })
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
test("POST / handles LLM error", async () => {
|
|
76
|
+
const handler = getHandler(askRouter, "post", "/")
|
|
77
|
+
configService.getNamespaces.mockResolvedValue([])
|
|
78
|
+
|
|
79
|
+
global.fetch.mockResolvedValue({
|
|
80
|
+
ok: false,
|
|
81
|
+
status: 401,
|
|
82
|
+
text: () => Promise.resolve("unauthorized")
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
await handler({ body: { query: "help" } }, res)
|
|
86
|
+
expect(res.status).toHaveBeenCalledWith(500)
|
|
87
|
+
expect(res.json).toHaveBeenCalledWith({ error: expect.stringContaining("LLM Error 401") })
|
|
88
|
+
})
|
|
89
|
+
})
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const commandsRouter = require("../server/routes/commands")
|
|
2
|
+
const { getStorage } = require("../server/storage/adapter")
|
|
3
|
+
const { bumpVersion } = require("../server/services/configService")
|
|
4
|
+
|
|
5
|
+
jest.mock("../server/storage/adapter")
|
|
6
|
+
jest.mock("../server/services/configService")
|
|
7
|
+
|
|
8
|
+
function getHandler(router, method, path) {
|
|
9
|
+
const route = router.stack.find(s => s.route && s.route.path === path && s.route.methods[method])
|
|
10
|
+
return route ? route.route.stack[0].handle : null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
describe("server routes - commands", () => {
|
|
14
|
+
let res, mockStorage
|
|
15
|
+
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
jest.clearAllMocks()
|
|
18
|
+
mockStorage = {
|
|
19
|
+
listKeys: jest.fn().mockResolvedValue([]),
|
|
20
|
+
get: jest.fn(),
|
|
21
|
+
set: jest.fn(),
|
|
22
|
+
delete: jest.fn()
|
|
23
|
+
}
|
|
24
|
+
getStorage.mockReturnValue(mockStorage)
|
|
25
|
+
res = {
|
|
26
|
+
json: jest.fn().mockReturnThis(),
|
|
27
|
+
status: jest.fn().mockReturnThis(),
|
|
28
|
+
render: jest.fn().mockReturnThis(),
|
|
29
|
+
redirect: jest.fn().mockReturnThis(),
|
|
30
|
+
send: jest.fn().mockReturnThis()
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test("GET / success", async () => {
|
|
35
|
+
mockStorage.listKeys.mockResolvedValue(["command:a"])
|
|
36
|
+
mockStorage.get.mockResolvedValue({ _id: "command:a" })
|
|
37
|
+
await getHandler(commandsRouter, "get", "/")({ query: { format: "json" }, headers: {} }, res)
|
|
38
|
+
expect(res.json).toHaveBeenCalled()
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test("POST / success", async () => {
|
|
42
|
+
await getHandler(commandsRouter, "post", "/")({ body: { namespace: "n", resource: "r", action: "a" }, headers: {} }, res)
|
|
43
|
+
expect(res.status).toHaveBeenCalledWith(201)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test("PUT / success", async () => {
|
|
47
|
+
await getHandler(commandsRouter, "put", "/:id")({ params: { id: "old" }, body: { namespace: "n", resource: "r", action: "a" } }, res)
|
|
48
|
+
expect(res.json).toHaveBeenCalledWith({ ok: true })
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
test("DELETE / success", async () => {
|
|
52
|
+
await getHandler(commandsRouter, "delete", "/:id")({ params: { id: "1" } }, res)
|
|
53
|
+
expect(res.json).toHaveBeenCalledWith({ ok: true })
|
|
54
|
+
})
|
|
55
|
+
})
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const configRouter = require("../server/routes/config")
|
|
2
|
+
const configService = require("../server/services/configService")
|
|
3
|
+
|
|
4
|
+
jest.mock("../server/services/configService")
|
|
5
|
+
|
|
6
|
+
function getHandler(router, method, path) {
|
|
7
|
+
const route = router.stack.find(s => s.route && s.route.path === path && s.route.methods[method])
|
|
8
|
+
return route ? route.route.stack[0].handle : null
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe("server routes - config", () => {
|
|
12
|
+
let req, res
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks()
|
|
16
|
+
res = {
|
|
17
|
+
json: jest.fn().mockReturnThis(),
|
|
18
|
+
status: jest.fn().mockReturnThis()
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test("GET / aggregates full config", async () => {
|
|
23
|
+
const handler = getHandler(configRouter, "get", "/")
|
|
24
|
+
configService.getCLIConfig.mockResolvedValue({ version: "1" })
|
|
25
|
+
|
|
26
|
+
await handler({}, res)
|
|
27
|
+
|
|
28
|
+
expect(res.json).toHaveBeenCalledWith(expect.objectContaining({ version: "1" }))
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
test("GET / handles error", async () => {
|
|
32
|
+
const handler = getHandler(configRouter, "get", "/")
|
|
33
|
+
configService.getCLIConfig.mockRejectedValue(new Error("fail"))
|
|
34
|
+
|
|
35
|
+
await handler({}, res)
|
|
36
|
+
|
|
37
|
+
expect(res.status).toHaveBeenCalledWith(500)
|
|
38
|
+
expect(res.json).toHaveBeenCalledWith({ error: "fail" })
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test("GET /tree returns namespaces", async () => {
|
|
42
|
+
const handler = getHandler(configRouter, "get", "/tree")
|
|
43
|
+
configService.getNamespaces.mockResolvedValue(["ns1"])
|
|
44
|
+
|
|
45
|
+
await handler({}, res)
|
|
46
|
+
|
|
47
|
+
expect(res.json).toHaveBeenCalledWith({ namespaces: ["ns1"] })
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
test("GET /tree/:ns returns resources", async () => {
|
|
51
|
+
const handler = getHandler(configRouter, "get", "/tree/:ns")
|
|
52
|
+
configService.getResources.mockResolvedValue(["r1"])
|
|
53
|
+
|
|
54
|
+
await handler({ params: { ns: "n" } }, res)
|
|
55
|
+
|
|
56
|
+
expect(configService.getResources).toHaveBeenCalledWith("n")
|
|
57
|
+
expect(res.json).toHaveBeenCalledWith({ resources: ["r1"] })
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
test("GET /tree/:ns/:res returns actions", async () => {
|
|
61
|
+
const handler = getHandler(configRouter, "get", "/tree/:ns/:res")
|
|
62
|
+
configService.getActions.mockResolvedValue(["a1"])
|
|
63
|
+
|
|
64
|
+
await handler({ params: { ns: "n", res: "r" } }, res)
|
|
65
|
+
|
|
66
|
+
expect(configService.getActions).toHaveBeenCalledWith("n", "r")
|
|
67
|
+
expect(res.json).toHaveBeenCalledWith({ actions: ["a1"] })
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
test("GET /command/:ns/:res/:act returns command", async () => {
|
|
71
|
+
const handler = getHandler(configRouter, "get", "/command/:ns/:res/:act")
|
|
72
|
+
configService.getCommand.mockResolvedValue({ id: "c1" })
|
|
73
|
+
|
|
74
|
+
await handler({ params: { ns: "n", res: "r", act: "a" } }, res)
|
|
75
|
+
|
|
76
|
+
expect(res.json).toHaveBeenCalledWith({ id: "c1" })
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test("GET /command/:ns/:res/:act returns 404 if missing", async () => {
|
|
80
|
+
const handler = getHandler(configRouter, "get", "/command/:ns/:res/:act")
|
|
81
|
+
configService.getCommand.mockResolvedValue(null)
|
|
82
|
+
|
|
83
|
+
await handler({ params: { ns: "n", res: "r", act: "a" } }, res)
|
|
84
|
+
|
|
85
|
+
expect(res.status).toHaveBeenCalledWith(404)
|
|
86
|
+
})
|
|
87
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const jobsRouter = require("../server/routes/jobs")
|
|
2
|
+
const { getStorage } = require("../server/storage/adapter")
|
|
3
|
+
|
|
4
|
+
jest.mock("../server/storage/adapter")
|
|
5
|
+
|
|
6
|
+
function getHandler(router, method, path) {
|
|
7
|
+
const route = router.stack.find(s => s.route && s.route.path === path && s.route.methods[method])
|
|
8
|
+
return route ? route.route.stack[0].handle : null
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
describe("server routes - jobs", () => {
|
|
12
|
+
let res, mockStorage
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks()
|
|
16
|
+
mockStorage = {
|
|
17
|
+
listKeys: jest.fn().mockResolvedValue([]),
|
|
18
|
+
get: jest.fn(),
|
|
19
|
+
set: jest.fn()
|
|
20
|
+
}
|
|
21
|
+
getStorage.mockReturnValue(mockStorage)
|
|
22
|
+
res = {
|
|
23
|
+
json: jest.fn().mockReturnThis(),
|
|
24
|
+
status: jest.fn().mockReturnThis(),
|
|
25
|
+
render: jest.fn().mockReturnThis()
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test("POST / success", async () => {
|
|
30
|
+
await getHandler(jobsRouter, "post", "/")({ body: { command: "test" } }, res)
|
|
31
|
+
expect(res.status).toHaveBeenCalledWith(201)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test("GET / success", async () => {
|
|
35
|
+
mockStorage.listKeys.mockResolvedValue(["job:1"])
|
|
36
|
+
mockStorage.get.mockResolvedValue({ command: "c1", timestamp: "2024-01-01" })
|
|
37
|
+
await getHandler(jobsRouter, "get", "/")({ query: { format: "json" }, headers: {} }, res)
|
|
38
|
+
expect(res.json).toHaveBeenCalled()
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
test("GET /stats success", async () => {
|
|
42
|
+
mockStorage.listKeys.mockResolvedValue(["job:1"])
|
|
43
|
+
mockStorage.get.mockResolvedValue({ command: "c1", status: "success", duration_ms: 10 })
|
|
44
|
+
await getHandler(jobsRouter, "get", "/stats")({}, res)
|
|
45
|
+
expect(res.json).toHaveBeenCalledWith(expect.objectContaining({ total: 1 }))
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test("GET /:id success", async () => {
|
|
49
|
+
mockStorage.get.mockResolvedValue({ id: "job:1" })
|
|
50
|
+
await getHandler(jobsRouter, "get", "/:id")({ params: { id: "1" } }, res)
|
|
51
|
+
expect(res.json).toHaveBeenCalled()
|
|
52
|
+
})
|
|
53
|
+
})
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
const mcpRouter = require("../server/routes/mcp")
|
|
2
|
+
const specsRouter = require("../server/routes/specs")
|
|
3
|
+
const plansRouter = require("../server/routes/plans")
|
|
4
|
+
const { getStorage } = require("../server/storage/adapter")
|
|
5
|
+
const planner = require("../cli/planner")
|
|
6
|
+
const executor = require("../cli/executor")
|
|
7
|
+
|
|
8
|
+
jest.mock("../server/storage/adapter")
|
|
9
|
+
jest.mock("../cli/planner")
|
|
10
|
+
jest.mock("../cli/executor")
|
|
11
|
+
|
|
12
|
+
function getHandler(router, method, path) {
|
|
13
|
+
const route = router.stack.find(s => s.route && s.route.path === path && s.route.methods[method])
|
|
14
|
+
return route ? route.route.stack[0].handle : null
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe("server routes - misc", () => {
|
|
18
|
+
let res, mockStorage
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.clearAllMocks()
|
|
22
|
+
mockStorage = {
|
|
23
|
+
listKeys: jest.fn().mockResolvedValue([]),
|
|
24
|
+
get: jest.fn(),
|
|
25
|
+
set: jest.fn(),
|
|
26
|
+
delete: jest.fn()
|
|
27
|
+
}
|
|
28
|
+
getStorage.mockReturnValue(mockStorage)
|
|
29
|
+
res = {
|
|
30
|
+
json: jest.fn().mockReturnThis(),
|
|
31
|
+
status: jest.fn().mockReturnThis(),
|
|
32
|
+
render: jest.fn().mockReturnThis(),
|
|
33
|
+
redirect: jest.fn().mockReturnThis()
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe("mcp routes", () => {
|
|
38
|
+
test("GET / success", async () => {
|
|
39
|
+
mockStorage.listKeys.mockResolvedValue(["mcp:a"])
|
|
40
|
+
mockStorage.get.mockResolvedValue({ name: "a" })
|
|
41
|
+
await getHandler(mcpRouter, "get", "/")({ query: { format: "json" }, headers: {} }, res)
|
|
42
|
+
expect(res.json).toHaveBeenCalled()
|
|
43
|
+
})
|
|
44
|
+
test("POST / success", async () => {
|
|
45
|
+
await getHandler(mcpRouter, "post", "/")({ body: { name: "a", url: "u" }, headers: {} }, res)
|
|
46
|
+
expect(res.status).toHaveBeenCalledWith(201)
|
|
47
|
+
})
|
|
48
|
+
test("PUT / success", async () => {
|
|
49
|
+
await getHandler(mcpRouter, "put", "/:id")({ params: { id: "mcp:a" }, body: { name: "a", url: "u" } }, res)
|
|
50
|
+
expect(res.json).toHaveBeenCalledWith({ ok: true })
|
|
51
|
+
})
|
|
52
|
+
test("DELETE / success", async () => {
|
|
53
|
+
await getHandler(mcpRouter, "delete", "/:id")({ params: { id: "mcp:a" } }, res)
|
|
54
|
+
expect(res.json).toHaveBeenCalledWith({ ok: true })
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
describe("specs routes", () => {
|
|
59
|
+
test("GET / success", async () => {
|
|
60
|
+
mockStorage.listKeys.mockResolvedValue(["spec:a"])
|
|
61
|
+
mockStorage.get.mockResolvedValue({ name: "a" })
|
|
62
|
+
await getHandler(specsRouter, "get", "/")({ query: { format: "json" }, headers: {} }, res)
|
|
63
|
+
expect(res.json).toHaveBeenCalled()
|
|
64
|
+
})
|
|
65
|
+
test("POST / success", async () => {
|
|
66
|
+
await getHandler(specsRouter, "post", "/")({ body: { name: "a", url: "u" }, headers: {} }, res)
|
|
67
|
+
expect(res.status).toHaveBeenCalledWith(201)
|
|
68
|
+
})
|
|
69
|
+
test("PUT / success", async () => {
|
|
70
|
+
await getHandler(specsRouter, "put", "/:id")({ params: { id: "spec:a" }, body: { name: "a", url: "u" } }, res)
|
|
71
|
+
expect(res.json).toHaveBeenCalledWith({ ok: true })
|
|
72
|
+
})
|
|
73
|
+
test("DELETE / success", async () => {
|
|
74
|
+
await getHandler(specsRouter, "delete", "/:id")({ params: { id: "spec:a" } }, res)
|
|
75
|
+
expect(res.json).toHaveBeenCalledWith({ ok: true })
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
describe("plans routes", () => {
|
|
80
|
+
test("POST / success", async () => {
|
|
81
|
+
mockStorage.get.mockResolvedValue({ id: "cmd" })
|
|
82
|
+
planner.createPlan.mockReturnValue({ plan_id: "p1" })
|
|
83
|
+
await getHandler(plansRouter, "post", "/")({ body: { command: "n.r.a" } }, res)
|
|
84
|
+
expect(res.status).toHaveBeenCalledWith(201)
|
|
85
|
+
})
|
|
86
|
+
test("GET / success", async () => {
|
|
87
|
+
mockStorage.listKeys.mockResolvedValue(["plan:p1"])
|
|
88
|
+
mockStorage.get.mockResolvedValue({ created_at: "2024-01-01" })
|
|
89
|
+
await getHandler(plansRouter, "get", "/")({}, res)
|
|
90
|
+
expect(res.json).toHaveBeenCalled()
|
|
91
|
+
})
|
|
92
|
+
test("GET /:id success", async () => {
|
|
93
|
+
mockStorage.get.mockResolvedValue({ id: "p1" })
|
|
94
|
+
await getHandler(plansRouter, "get", "/:id")({ params: { id: "p1" } }, res)
|
|
95
|
+
expect(res.json).toHaveBeenCalledWith({ id: "p1" })
|
|
96
|
+
})
|
|
97
|
+
test("POST /:id/execute success", async () => {
|
|
98
|
+
mockStorage.get.mockImplementation((k) => {
|
|
99
|
+
if (k === "plan:p1") return { status: "planned", command: "n.r.a", plan_id: "p1" }
|
|
100
|
+
if (k === "command:n.r.a") return { adapter: "builtin" }
|
|
101
|
+
return null
|
|
102
|
+
})
|
|
103
|
+
executor.execute.mockResolvedValue({ ok: true })
|
|
104
|
+
await getHandler(plansRouter, "post", "/:id/execute")({ params: { id: "p1" } }, res)
|
|
105
|
+
expect(res.json).toHaveBeenCalledWith(expect.objectContaining({ status: "success" }))
|
|
106
|
+
})
|
|
107
|
+
test("DELETE /:id success", async () => {
|
|
108
|
+
await getHandler(plansRouter, "delete", "/:id")({ params: { id: "p1" } }, res)
|
|
109
|
+
expect(res.json).toHaveBeenCalledWith({ ok: true })
|
|
110
|
+
})
|
|
111
|
+
})
|
|
112
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const { getStorage } = require("../server/storage/adapter")
|
|
2
|
+
const MongoAdapter = require("../server/storage/mongo")
|
|
3
|
+
const FileAdapter = require("../server/storage/file")
|
|
4
|
+
|
|
5
|
+
jest.mock("../server/storage/mongo")
|
|
6
|
+
jest.mock("../server/storage/file")
|
|
7
|
+
|
|
8
|
+
describe("storage adapter factory", () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
jest.clearAllMocks()
|
|
11
|
+
delete process.env.SUPERCLI_USE_MONGO
|
|
12
|
+
// We can't easily reset the singleton without resetModules,
|
|
13
|
+
// so we'll just test the logic via fresh requires if needed.
|
|
14
|
+
jest.resetModules()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
test("returns FileAdapter by default", () => {
|
|
18
|
+
const FileAdapterMock = require("../server/storage/file")
|
|
19
|
+
const { getStorage } = require("../server/storage/adapter")
|
|
20
|
+
const storage = getStorage()
|
|
21
|
+
expect(FileAdapterMock).toHaveBeenCalled()
|
|
22
|
+
expect(storage).toBeInstanceOf(FileAdapterMock)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test("returns MongoAdapter if SUPERCLI_USE_MONGO=true", () => {
|
|
26
|
+
process.env.SUPERCLI_USE_MONGO = "true"
|
|
27
|
+
const MongoAdapterMock = require("../server/storage/mongo")
|
|
28
|
+
const { getStorage } = require("../server/storage/adapter")
|
|
29
|
+
const storage = getStorage()
|
|
30
|
+
expect(MongoAdapterMock).toHaveBeenCalled()
|
|
31
|
+
expect(storage).toBeInstanceOf(MongoAdapterMock)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test("singleton behavior", () => {
|
|
35
|
+
const { getStorage } = require("../server/storage/adapter")
|
|
36
|
+
const s1 = getStorage()
|
|
37
|
+
const s2 = getStorage()
|
|
38
|
+
expect(s1).toBe(s2)
|
|
39
|
+
})
|
|
40
|
+
})
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
const fs = require("fs").promises
|
|
2
|
+
const path = require("path")
|
|
3
|
+
const FileAdapter = require("../server/storage/file")
|
|
4
|
+
|
|
5
|
+
jest.mock("fs", () => ({
|
|
6
|
+
promises: {
|
|
7
|
+
readFile: jest.fn(),
|
|
8
|
+
writeFile: jest.fn(),
|
|
9
|
+
unlink: jest.fn(),
|
|
10
|
+
readdir: jest.fn(),
|
|
11
|
+
mkdir: jest.fn()
|
|
12
|
+
},
|
|
13
|
+
existsSync: jest.fn()
|
|
14
|
+
}))
|
|
15
|
+
const fsMock = require("fs")
|
|
16
|
+
|
|
17
|
+
describe("FileAdapter", () => {
|
|
18
|
+
const baseDir = "/tmp/storage"
|
|
19
|
+
let adapter
|
|
20
|
+
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
jest.clearAllMocks()
|
|
23
|
+
adapter = new FileAdapter(baseDir)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test("get returns parsed JSON", async () => {
|
|
27
|
+
fs.readFile.mockResolvedValue('{"a": 1}')
|
|
28
|
+
const result = await adapter.get("mykey")
|
|
29
|
+
expect(result).toEqual({ a: 1 })
|
|
30
|
+
expect(fs.readFile).toHaveBeenCalledWith(expect.stringContaining("mykey.json"), "utf-8")
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test("get returns null on ENOENT", async () => {
|
|
34
|
+
fs.readFile.mockRejectedValue({ code: "ENOENT" })
|
|
35
|
+
expect(await adapter.get("missing")).toBeNull()
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test("get throws other errors", async () => {
|
|
39
|
+
fs.readFile.mockRejectedValue(new Error("crash"))
|
|
40
|
+
await expect(adapter.get("err")).rejects.toThrow("crash")
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
test("set creates dir and writes file", async () => {
|
|
44
|
+
await adapter.set("key", { x: 1 })
|
|
45
|
+
expect(fs.mkdir).toHaveBeenCalledWith(baseDir, { recursive: true })
|
|
46
|
+
expect(fs.writeFile).toHaveBeenCalledWith(
|
|
47
|
+
expect.stringContaining("key.json"),
|
|
48
|
+
expect.stringContaining('"x": 1'),
|
|
49
|
+
"utf-8"
|
|
50
|
+
)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test("delete unlinks file", async () => {
|
|
54
|
+
await adapter.delete("key")
|
|
55
|
+
expect(fs.unlink).toHaveBeenCalled()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test("delete ignores ENOENT", async () => {
|
|
59
|
+
fs.unlink.mockRejectedValue({ code: "ENOENT" })
|
|
60
|
+
await expect(adapter.delete("key")).resolves.not.toThrow()
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test("listKeys filters and maps files", async () => {
|
|
64
|
+
fs.readdir.mockResolvedValue(["abc_1.json", "abc_2.json", "other.json", "abc_3.txt"])
|
|
65
|
+
const keys = await adapter.listKeys("abc")
|
|
66
|
+
expect(keys).toEqual(["abc_1", "abc_2"])
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test("listKeys returns empty on ENOENT", async () => {
|
|
70
|
+
fs.readdir.mockRejectedValue({ code: "ENOENT" })
|
|
71
|
+
expect(await adapter.listKeys()).toEqual([])
|
|
72
|
+
})
|
|
73
|
+
})
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const MongoAdapter = require("../server/storage/mongo")
|
|
2
|
+
const { MongoClient } = require("mongodb")
|
|
3
|
+
|
|
4
|
+
jest.mock("mongodb")
|
|
5
|
+
|
|
6
|
+
describe("MongoAdapter", () => {
|
|
7
|
+
let adapter
|
|
8
|
+
let mockCollection
|
|
9
|
+
let mockDb
|
|
10
|
+
let mockClient
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
jest.clearAllMocks()
|
|
14
|
+
mockCollection = {
|
|
15
|
+
findOne: jest.fn(),
|
|
16
|
+
updateOne: jest.fn(),
|
|
17
|
+
deleteOne: jest.fn(),
|
|
18
|
+
find: jest.fn().mockReturnThis(),
|
|
19
|
+
toArray: jest.fn()
|
|
20
|
+
}
|
|
21
|
+
mockDb = {
|
|
22
|
+
collection: jest.fn().mockReturnValue(mockCollection)
|
|
23
|
+
}
|
|
24
|
+
mockClient = {
|
|
25
|
+
connect: jest.fn().mockResolvedValue({}),
|
|
26
|
+
db: jest.fn().mockReturnValue(mockDb)
|
|
27
|
+
}
|
|
28
|
+
MongoClient.mockImplementation(() => mockClient)
|
|
29
|
+
|
|
30
|
+
adapter = new MongoAdapter("mongodb://uri")
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test("get returns value field", async () => {
|
|
34
|
+
mockCollection.findOne.mockResolvedValue({ _id: "k", value: { x: 1 } })
|
|
35
|
+
const result = await adapter.get("k")
|
|
36
|
+
expect(result).toEqual({ x: 1 })
|
|
37
|
+
expect(mockCollection.findOne).toHaveBeenCalledWith({ _id: "k" })
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
test("get returns null if doc missing", async () => {
|
|
41
|
+
mockCollection.findOne.mockResolvedValue(null)
|
|
42
|
+
expect(await adapter.get("k")).toBeNull()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test("set updates with upsert", async () => {
|
|
46
|
+
await adapter.set("k", { y: 2 })
|
|
47
|
+
expect(mockCollection.updateOne).toHaveBeenCalledWith(
|
|
48
|
+
{ _id: "k" },
|
|
49
|
+
{ $set: { value: { y: 2 } } },
|
|
50
|
+
{ upsert: true }
|
|
51
|
+
)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test("delete removes by _id", async () => {
|
|
55
|
+
await adapter.delete("k")
|
|
56
|
+
expect(mockCollection.deleteOne).toHaveBeenCalledWith({ _id: "k" })
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
test("listKeys uses regex and maps ids", async () => {
|
|
60
|
+
mockCollection.toArray.mockResolvedValue([{ _id: "pre:1" }, { _id: "pre:2" }])
|
|
61
|
+
const keys = await adapter.listKeys("pre:")
|
|
62
|
+
expect(keys).toEqual(["pre:1", "pre:2"])
|
|
63
|
+
expect(mockCollection.find).toHaveBeenCalledWith(
|
|
64
|
+
{ _id: { $regex: "^pre:" } },
|
|
65
|
+
{ projection: { _id: 1 } }
|
|
66
|
+
)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test("listKeys without prefix", async () => {
|
|
70
|
+
mockCollection.toArray.mockResolvedValue([])
|
|
71
|
+
await adapter.listKeys()
|
|
72
|
+
expect(mockCollection.find).toHaveBeenCalledWith({}, expect.anything())
|
|
73
|
+
})
|
|
74
|
+
})
|