@shadowob/cloud 1.1.6-dev.311
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/README.md +509 -0
- package/dist/agent-browser-CERTMCDL.js +117 -0
- package/dist/agent-browser-CIRZRIY4.js +118 -0
- package/dist/agent-pack-LF3O5TR4.js +1236 -0
- package/dist/agent-pack-RQT27V7R.js +1235 -0
- package/dist/airtable-BG2Q75G2.js +82 -0
- package/dist/airtable-JCQXFM5D.js +83 -0
- package/dist/alipay-MZX2XCDB.js +52 -0
- package/dist/alipay-TZQI34RB.js +51 -0
- package/dist/amap-5RQB3VGC.js +45 -0
- package/dist/amap-KPCLZYYL.js +44 -0
- package/dist/atlassian-LGOEWYC7.js +54 -0
- package/dist/atlassian-TVS2A4IU.js +55 -0
- package/dist/baidu-appbuilder-6UMESXHW.js +41 -0
- package/dist/baidu-appbuilder-QRRL3ETM.js +42 -0
- package/dist/baidu-maps-HEPMVP5D.js +44 -0
- package/dist/baidu-maps-HXC4FBVP.js +45 -0
- package/dist/baidu-netdisk-G5Q6B5NH.js +45 -0
- package/dist/baidu-netdisk-RS2K5W2M.js +44 -0
- package/dist/baidu-smartprogram-EWTK5WKK.js +41 -0
- package/dist/baidu-smartprogram-JHD3XWF6.js +40 -0
- package/dist/browserbase-IUIYVYI7.js +67 -0
- package/dist/browserbase-JFO2PCIA.js +68 -0
- package/dist/canva-3YOFL7JS.js +62 -0
- package/dist/canva-FMYN65SM.js +61 -0
- package/dist/chunk-6P2K6QZR.js +529 -0
- package/dist/chunk-7VMRQ7MG.js +90 -0
- package/dist/chunk-AD3JTIU3.js +17 -0
- package/dist/chunk-BF6CV2Y4.js +64 -0
- package/dist/chunk-CTNUKOQE.js +439 -0
- package/dist/chunk-EEFMJYKB.js +97 -0
- package/dist/chunk-EJKFQ35I.js +739 -0
- package/dist/chunk-HUICDC56.js +62 -0
- package/dist/chunk-JUPAE5IA.js +527 -0
- package/dist/chunk-JY2HTT7Q.js +437 -0
- package/dist/chunk-KEPTCLUO.js +121 -0
- package/dist/chunk-KKK5H7YX.js +3622 -0
- package/dist/chunk-POSVEKIY.js +210 -0
- package/dist/chunk-QET4LT4J.js +5769 -0
- package/dist/chunk-QV4XWO3P.js +30 -0
- package/dist/chunk-R52J3PH2.js +120 -0
- package/dist/chunk-R5U7XKVJ.js +16 -0
- package/dist/chunk-RECNVWMT.js +212 -0
- package/dist/chunk-RTPBU5HF.js +92 -0
- package/dist/chunk-SUZ2ATT6.js +5774 -0
- package/dist/chunk-SVMXSIMG.js +98 -0
- package/dist/chunk-TV3CBM7R.js +28 -0
- package/dist/chunk-V2LU736V.js +3495 -0
- package/dist/chunk-ZUYL3W53.js +741 -0
- package/dist/claude-plugin-577TAQVS.js +1463 -0
- package/dist/claude-plugin-L3MXJJ6J.js +1464 -0
- package/dist/cli.js +7021 -0
- package/dist/cloudflare-HBBABPK6.js +114 -0
- package/dist/cloudflare-RDFPKMM5.js +115 -0
- package/dist/cnb-FLP3QX46.js +44 -0
- package/dist/cnb-YAVVEYFB.js +45 -0
- package/dist/console/index.html +12 -0
- package/dist/console/logo.png +0 -0
- package/dist/console/static/css/5079.f9e0918d.css +1 -0
- package/dist/console/static/css/index.7f91f806.css +1 -0
- package/dist/console/static/font/codicon.5b7d6fac.ttf +0 -0
- package/dist/console/static/js/5079.72a51ca2.js +699 -0
- package/dist/console/static/js/5079.72a51ca2.js.LICENSE.txt +35 -0
- package/dist/console/static/js/7426.f8d483ea.js +1 -0
- package/dist/console/static/js/async/1008.4df521b7.js +1 -0
- package/dist/console/static/js/async/102.1d473ec7.js +1 -0
- package/dist/console/static/js/async/1134.3f9fd9e7.js +1 -0
- package/dist/console/static/js/async/1318.4b8e48e7.js +1 -0
- package/dist/console/static/js/async/1360.5606da88.js +7 -0
- package/dist/console/static/js/async/1546.045f484f.js +1 -0
- package/dist/console/static/js/async/1562.187de2a8.js +1 -0
- package/dist/console/static/js/async/168.456d4813.js +1 -0
- package/dist/console/static/js/async/1750.e6dc2664.js +1 -0
- package/dist/console/static/js/async/1994.3fc86066.js +1 -0
- package/dist/console/static/js/async/2348.613ae3d9.js +1 -0
- package/dist/console/static/js/async/2390.1b890b9d.js +1 -0
- package/dist/console/static/js/async/2414.9d040212.js +1 -0
- package/dist/console/static/js/async/2454.4c1784ab.js +1 -0
- package/dist/console/static/js/async/2498.f5f92030.js +1 -0
- package/dist/console/static/js/async/2924.b823cd1a.js +1 -0
- package/dist/console/static/js/async/3062.63fddea6.js +1 -0
- package/dist/console/static/js/async/3078.dd712008.js +1 -0
- package/dist/console/static/js/async/3198.1f307065.js +1 -0
- package/dist/console/static/js/async/3246.3d5a899f.js +1 -0
- package/dist/console/static/js/async/3286.871676eb.js +1 -0
- package/dist/console/static/js/async/342.10bf3b90.js +1 -0
- package/dist/console/static/js/async/3446.9681a4d7.js +1 -0
- package/dist/console/static/js/async/3698.ccfaabec.js +1 -0
- package/dist/console/static/js/async/3790.2a1106a6.js +1 -0
- package/dist/console/static/js/async/4231.b29784d4.js +1 -0
- package/dist/console/static/js/async/4551.515bd41d.js +1 -0
- package/dist/console/static/js/async/4596.40f6e71b.js +1 -0
- package/dist/console/static/js/async/4600.4aaebe6d.js +1 -0
- package/dist/console/static/js/async/4718.1aae022f.js +1 -0
- package/dist/console/static/js/async/4846.a347c020.js +1 -0
- package/dist/console/static/js/async/4860.83dadf89.js +1 -0
- package/dist/console/static/js/async/500.fcfa37cb.js +1 -0
- package/dist/console/static/js/async/5096.b360203d.js +1 -0
- package/dist/console/static/js/async/5222.043274fe.js +1 -0
- package/dist/console/static/js/async/5362.f498001c.js +1 -0
- package/dist/console/static/js/async/54.c94f0755.js +1 -0
- package/dist/console/static/js/async/5478.50dd9ef0.js +2 -0
- package/dist/console/static/js/async/5478.50dd9ef0.js.LICENSE.txt +3 -0
- package/dist/console/static/js/async/5507.a6a1f793.js +1 -0
- package/dist/console/static/js/async/5638.bc6b102d.js +1 -0
- package/dist/console/static/js/async/5722.e0029049.js +1 -0
- package/dist/console/static/js/async/5942.74635c6b.js +1 -0
- package/dist/console/static/js/async/5994.1c5629c1.js +1 -0
- package/dist/console/static/js/async/6054.6bddf720.js +1 -0
- package/dist/console/static/js/async/6118.45e754e5.js +1 -0
- package/dist/console/static/js/async/6127.adcbcbb6.js +1 -0
- package/dist/console/static/js/async/614.3f434c20.js +1 -0
- package/dist/console/static/js/async/6234.ba3b002d.js +1 -0
- package/dist/console/static/js/async/6310.6546a9ba.js +1 -0
- package/dist/console/static/js/async/6378.9f805419.js +1 -0
- package/dist/console/static/js/async/6380.e4433c49.js +1 -0
- package/dist/console/static/js/async/6418.f23bcfda.js +1 -0
- package/dist/console/static/js/async/6428.77c86114.js +1 -0
- package/dist/console/static/js/async/6443.83318a6c.js +1 -0
- package/dist/console/static/js/async/6508.2b445d62.js +3 -0
- package/dist/console/static/js/async/6542.e82a26c8.js +1 -0
- package/dist/console/static/js/async/6544.62111ecb.js +1 -0
- package/dist/console/static/js/async/6612.a0c9fcf4.js +1 -0
- package/dist/console/static/js/async/6740.695aebf0.js +1 -0
- package/dist/console/static/js/async/6822.dbbb32bc.js +1 -0
- package/dist/console/static/js/async/6824.ad3540ab.js +1 -0
- package/dist/console/static/js/async/6930.585dab94.js +1 -0
- package/dist/console/static/js/async/6982.c81b95e6.js +1 -0
- package/dist/console/static/js/async/7046.ab2378c1.js +1 -0
- package/dist/console/static/js/async/7110.a603277f.js +1 -0
- package/dist/console/static/js/async/7142.4a21366f.js +1 -0
- package/dist/console/static/js/async/7348.15cc6148.js +1373 -0
- package/dist/console/static/js/async/7348.15cc6148.js.LICENSE.txt +14 -0
- package/dist/console/static/js/async/7374.b1ac5c44.js +1 -0
- package/dist/console/static/js/async/742.847f17ca.js +1 -0
- package/dist/console/static/js/async/7446.743954d8.js +1 -0
- package/dist/console/static/js/async/7673.59bbbaac.js +1 -0
- package/dist/console/static/js/async/7684.c5760c8c.js +1 -0
- package/dist/console/static/js/async/7714.c30d0f94.js +1 -0
- package/dist/console/static/js/async/8118.36d5a3bf.js +298 -0
- package/dist/console/static/js/async/8145.4bcf043a.js +1 -0
- package/dist/console/static/js/async/8246.408de938.js +1 -0
- package/dist/console/static/js/async/8390.bdae1f7d.js +1 -0
- package/dist/console/static/js/async/8422.fd94dbe1.js +1 -0
- package/dist/console/static/js/async/8434.94a0e2ae.js +1 -0
- package/dist/console/static/js/async/8518.3158de13.js +1 -0
- package/dist/console/static/js/async/8564.fc2eb841.js +1 -0
- package/dist/console/static/js/async/8678.73af4c9b.js +1 -0
- package/dist/console/static/js/async/8694.79747168.js +1 -0
- package/dist/console/static/js/async/8756.1de37b83.js +1 -0
- package/dist/console/static/js/async/8804.7fe6bdf9.js +3 -0
- package/dist/console/static/js/async/8883.e717ee94.js +1 -0
- package/dist/console/static/js/async/8886.fe6e876c.js +1 -0
- package/dist/console/static/js/async/9030.fc1ae402.js +1 -0
- package/dist/console/static/js/async/9094.5598d084.js +1 -0
- package/dist/console/static/js/async/9218.ee7b84b7.js +1 -0
- package/dist/console/static/js/async/94.9b80bc35.js +1 -0
- package/dist/console/static/js/async/9526.92aba34c.js +1 -0
- package/dist/console/static/js/async/9762.f83bc4f3.js +1 -0
- package/dist/console/static/js/async/984.e11c113a.js +1 -0
- package/dist/console/static/js/async/9846.246653cd.js +1 -0
- package/dist/console/static/js/index.4487e1ff.js +1 -0
- package/dist/console/static/js/lib-react.15d7ca9a.js +2 -0
- package/dist/console/static/js/lib-react.15d7ca9a.js.LICENSE.txt +49 -0
- package/dist/coze-C6PMDPBI.js +49 -0
- package/dist/coze-E6VGRNLV.js +48 -0
- package/dist/dashboard.command-J7XOZNXU.js +8 -0
- package/dist/dashboard.command-RV2NHDKW.js +7 -0
- package/dist/dingtalk-JNRNRN7E.js +77 -0
- package/dist/dingtalk-WZGGIAHJ.js +76 -0
- package/dist/douyin-miniprogram-AIJPPIZH.js +41 -0
- package/dist/douyin-miniprogram-HCYZ5NBW.js +42 -0
- package/dist/figma-2YYNSCDX.js +103 -0
- package/dist/figma-RYOBMENP.js +102 -0
- package/dist/firebase-2IJDDBXX.js +112 -0
- package/dist/firebase-OYSY6HPT.js +111 -0
- package/dist/firecrawl-2T3SBUW7.js +66 -0
- package/dist/firecrawl-IYYXLAZM.js +65 -0
- package/dist/flyai-7FJ4TRAG.js +81 -0
- package/dist/flyai-QS5Q6FJR.js +82 -0
- package/dist/gitagent-MWI75OIX.js +725 -0
- package/dist/gitagent-YBMWY7NZ.js +726 -0
- package/dist/gitee-3N7OFOM7.js +53 -0
- package/dist/gitee-KVNK6KLZ.js +54 -0
- package/dist/github-LUEC2LID.js +143 -0
- package/dist/github-XRO5Z3GC.js +142 -0
- package/dist/google-ads-A3QAJI4D.js +88 -0
- package/dist/google-ads-VPKWTX67.js +89 -0
- package/dist/google-analytics-C4UR5ZR2.js +50 -0
- package/dist/google-analytics-XDYZA2B7.js +49 -0
- package/dist/google-workspace-LL3EWVHH.js +320 -0
- package/dist/google-workspace-YX35SHHX.js +321 -0
- package/dist/huawei-xiaoyi-6BSMGJHR.js +40 -0
- package/dist/huawei-xiaoyi-KPWLTSHB.js +41 -0
- package/dist/hubspot-DIUHGEDI.js +45 -0
- package/dist/hubspot-FTIEMNZO.js +44 -0
- package/dist/huggingface-MJCOXA7E.js +116 -0
- package/dist/huggingface-UUXK2RHK.js +117 -0
- package/dist/index.d.ts +3013 -0
- package/dist/index.js +15649 -0
- package/dist/inference-ai-image-generation-CMI6R5T3.js +106 -0
- package/dist/inference-ai-image-generation-PXV6IG4U.js +107 -0
- package/dist/inference-sh-7AZOLEFI.js +94 -0
- package/dist/inference-sh-ABQOD3YF.js +95 -0
- package/dist/init.command-6E24K4H3.js +9 -0
- package/dist/init.command-O4HG4HKR.js +10 -0
- package/dist/klaviyo-6K5YEFNH.js +45 -0
- package/dist/klaviyo-LDPBWBSS.js +44 -0
- package/dist/kuaidi100-HGFM5VK2.js +42 -0
- package/dist/kuaidi100-UHPFCVXP.js +41 -0
- package/dist/lark-6LNA3LUQ.js +103 -0
- package/dist/lark-URVBZNS4.js +102 -0
- package/dist/linear-7QFSFPOD.js +57 -0
- package/dist/linear-T4ORUP7N.js +56 -0
- package/dist/lovart-PDUXRUHJ.js +99 -0
- package/dist/lovart-QO3SK55T.js +100 -0
- package/dist/meta-ads-SCNFI45S.js +42 -0
- package/dist/meta-ads-V6XPZWX3.js +41 -0
- package/dist/miclaw-5CNTW7VV.js +36 -0
- package/dist/miclaw-TPPPS2WN.js +35 -0
- package/dist/model-provider-AVSFJSZP.js +393 -0
- package/dist/model-provider-KFB76XV5.js +392 -0
- package/dist/notion-FZK76MN2.js +69 -0
- package/dist/notion-WFA7KGZZ.js +70 -0
- package/dist/oceanengine-3JZUS3PP.js +43 -0
- package/dist/oceanengine-5BRIJVJE.js +42 -0
- package/dist/opencli-PFXHGCS2.js +81 -0
- package/dist/opencli-VIGRJTGH.js +80 -0
- package/dist/paypal-33UADIPR.js +54 -0
- package/dist/paypal-Z5JYHIWD.js +55 -0
- package/dist/playwright-MG5WHK47.js +58 -0
- package/dist/playwright-SQAQ3DZG.js +59 -0
- package/dist/plugins-HZBWK3WQ.js +120 -0
- package/dist/plugins-I4GD5SZX.js +121 -0
- package/dist/posthog-MU5MAJOQ.js +79 -0
- package/dist/posthog-RJRRKDWB.js +80 -0
- package/dist/salesforce-34FVIJTG.js +82 -0
- package/dist/salesforce-3QZ6OFVO.js +83 -0
- package/dist/sentry-MCIRMACU.js +111 -0
- package/dist/sentry-PIWW46VA.js +110 -0
- package/dist/seo-suite-4SQ3I67Q.js +54 -0
- package/dist/seo-suite-WJXMA3S4.js +55 -0
- package/dist/serve.command-5FMIPQRY.js +10 -0
- package/dist/serve.command-DNE6GPMK.js +9 -0
- package/dist/shadowob-JELOWHWX.js +1068 -0
- package/dist/shadowob-PRSMI5MW.js +1069 -0
- package/dist/sherlock-2PKY2E2Y.js +66 -0
- package/dist/sherlock-C5ZWPPVT.js +67 -0
- package/dist/shopify-GL3NFVGE.js +94 -0
- package/dist/shopify-R4G3UXM6.js +93 -0
- package/dist/skill-discovery-7INAUP4D.js +77 -0
- package/dist/skill-discovery-YPXXV622.js +78 -0
- package/dist/state-7MCZBTR5.js +17 -0
- package/dist/state-FGOFLFBE.js +18 -0
- package/dist/stripe-C22RR4ZS.js +83 -0
- package/dist/stripe-LJNPQ3CQ.js +82 -0
- package/dist/supabase-IRNQ54FJ.js +98 -0
- package/dist/supabase-N4ONFJNQ.js +97 -0
- package/dist/taobao-aipaas-LRR4GMO3.js +45 -0
- package/dist/taobao-aipaas-RVKORSF4.js +46 -0
- package/dist/tapd-3JPVJ7XH.js +46 -0
- package/dist/tapd-TMQRSMFG.js +47 -0
- package/dist/tencent-ads-IGD33LO7.js +42 -0
- package/dist/tencent-ads-UHC6OPBV.js +43 -0
- package/dist/tencent-docs-C3A4J3CJ.js +47 -0
- package/dist/tencent-docs-O2SC4FHL.js +48 -0
- package/dist/tencent-maps-HMMWMNF4.js +37 -0
- package/dist/tencent-maps-OQOKHVW2.js +36 -0
- package/dist/vercel-KOXDDTHX.js +73 -0
- package/dist/vercel-OLNVDWMG.js +74 -0
- package/dist/webflow-FULU5Q2I.js +114 -0
- package/dist/webflow-OMJKZM54.js +115 -0
- package/dist/wechat-miniprogram-skyline-KYCDMQNW.js +74 -0
- package/dist/wechat-miniprogram-skyline-VR4FVIQL.js +75 -0
- package/dist/wechat-pay-BCMAJ6UW.js +50 -0
- package/dist/wechat-pay-YQQKXVUI.js +51 -0
- package/dist/wonda-NGWIORYN.js +81 -0
- package/dist/wonda-RBABXFNM.js +82 -0
- package/dist/wordpress-woocommerce-RDIUTHYT.js +57 -0
- package/dist/wordpress-woocommerce-RNA5HB3N.js +58 -0
- package/dist/wps-DAEFQHDE.js +47 -0
- package/dist/wps-LUWHMZQQ.js +48 -0
- package/dist/yuque-HCHTJWNI.js +72 -0
- package/dist/yuque-KRH5O74J.js +71 -0
- package/images/RUNNERS.md +270 -0
- package/images/cc-connect-runner/entrypoint.mjs +311 -0
- package/images/claude-runner/Dockerfile +88 -0
- package/images/claude-runner/RUNNER.md +222 -0
- package/images/claude-runner/entrypoint.mjs +2 -0
- package/images/codex-runner/Dockerfile +87 -0
- package/images/codex-runner/RUNNER.md +226 -0
- package/images/codex-runner/entrypoint.mjs +2 -0
- package/images/gemini-runner/Dockerfile +87 -0
- package/images/gemini-runner/RUNNER.md +218 -0
- package/images/gemini-runner/entrypoint.mjs +2 -0
- package/images/hermes-runner/Dockerfile +74 -0
- package/images/hermes-runner/RUNNER.md +243 -0
- package/images/hermes-runner/entrypoint.mjs +283 -0
- package/images/openclaw-runner/Dockerfile +212 -0
- package/images/openclaw-runner/RUNNER.md +170 -0
- package/images/openclaw-runner/entrypoint.mjs +1113 -0
- package/images/openclaw-runner/warm-runtime-deps.mjs +95 -0
- package/images/opencode-runner/Dockerfile +87 -0
- package/images/opencode-runner/RUNNER.md +202 -0
- package/images/opencode-runner/entrypoint.mjs +2 -0
- package/package.json +121 -0
- package/templates/agent-marketplace-buddy.template.json +131 -0
- package/templates/ai-werewolf.template.json +92 -0
- package/templates/bmad-method-buddy.template.json +123 -0
- package/templates/brain-fix.template.json +92 -0
- package/templates/claude-ads-buddy.template.json +123 -0
- package/templates/claude-financial-services-buddy.template.json +111 -0
- package/templates/claude-seo-buddy.template.json +123 -0
- package/templates/code-arena.template.json +92 -0
- package/templates/daily-brief.template.json +92 -0
- package/templates/e-wife.template.json +92 -0
- package/templates/everything-claude-code-buddy.template.json +125 -0
- package/templates/financial-freedom.template.json +92 -0
- package/templates/gitstory.template.json +92 -0
- package/templates/google-workspace-buddy.template.json +88 -0
- package/templates/gsd-buddy.template.json +119 -0
- package/templates/gstack-buddy.template.json +143 -0
- package/templates/gstack.template.json +92 -0
- package/templates/little-match-girl.template.json +114 -0
- package/templates/lovart-buddy.template.json +110 -0
- package/templates/marketingskills-buddy.template.json +102 -0
- package/templates/retire-buddy.template.json +92 -0
- package/templates/scientific-skills-buddy.template.json +119 -0
- package/templates/seomachine-buddy.template.json +113 -0
- package/templates/shadow-server-app-demo.template.json +105 -0
- package/templates/slavingia-skills-buddy.template.json +102 -0
- package/templates/superclaude-buddy.template.json +146 -0
- package/templates/superpowers-buddy.template.json +108 -0
- package/templates/world-pulse.template.json +92 -0
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
// src/plugins/helpers.ts
|
|
2
|
+
function loadManifest(raw) {
|
|
3
|
+
if (typeof raw.id !== "string" || typeof raw.name !== "string" || typeof raw.description !== "string" || typeof raw.version !== "string" || typeof raw.category !== "string" || typeof raw.icon !== "string" || typeof raw.auth !== "object" || raw.auth === null || !Array.isArray(raw.capabilities) || !Array.isArray(raw.tags)) {
|
|
4
|
+
const id = typeof raw.id === "string" ? raw.id : "unknown";
|
|
5
|
+
throw new Error(`Invalid plugin manifest for "${id}": missing required fields`);
|
|
6
|
+
}
|
|
7
|
+
return raw;
|
|
8
|
+
}
|
|
9
|
+
function makeHooks() {
|
|
10
|
+
return {
|
|
11
|
+
resolveAgent: [],
|
|
12
|
+
buildConfig: [],
|
|
13
|
+
buildPrompt: [],
|
|
14
|
+
buildEnv: [],
|
|
15
|
+
buildRuntime: [],
|
|
16
|
+
buildResources: [],
|
|
17
|
+
validate: [],
|
|
18
|
+
provision: [],
|
|
19
|
+
healthCheck: []
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function makeAPI(hooks, collected) {
|
|
23
|
+
const mergeRuntime = (fragment) => {
|
|
24
|
+
collected.runtime = mergeCollectedRuntime(collected.runtime ?? {}, fragment);
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
addSkills: (s) => {
|
|
28
|
+
collected.skills = s;
|
|
29
|
+
},
|
|
30
|
+
addCLI: (tools) => {
|
|
31
|
+
collected.cli = [...collected.cli ?? [], ...tools];
|
|
32
|
+
},
|
|
33
|
+
addMCP: (server) => {
|
|
34
|
+
collected.mcp = [...collected.mcp ?? [], server];
|
|
35
|
+
mergeRuntime({ mcpServers: [server] });
|
|
36
|
+
},
|
|
37
|
+
addRuntimeDependencies: (deps) => {
|
|
38
|
+
mergeRuntime({ runtimeDependencies: deps });
|
|
39
|
+
},
|
|
40
|
+
addSkillSources: (sources) => {
|
|
41
|
+
mergeRuntime({ skillSources: sources });
|
|
42
|
+
},
|
|
43
|
+
addSubagentSources: (sources) => {
|
|
44
|
+
mergeRuntime({ subagentSources: sources });
|
|
45
|
+
},
|
|
46
|
+
addRuntimeArtifacts: (artifacts) => {
|
|
47
|
+
mergeRuntime({ artifacts });
|
|
48
|
+
},
|
|
49
|
+
addCredentialFiles: (files) => {
|
|
50
|
+
mergeRuntime({ credentialFiles: files });
|
|
51
|
+
},
|
|
52
|
+
addVerificationChecks: (checks) => {
|
|
53
|
+
mergeRuntime({ verificationChecks: checks });
|
|
54
|
+
},
|
|
55
|
+
addProviderCatalog: (catalog) => {
|
|
56
|
+
collected.providerCatalogs = [...collected.providerCatalogs ?? [], catalog];
|
|
57
|
+
},
|
|
58
|
+
addSecretFields: (fields) => {
|
|
59
|
+
collected.secretFields = [...collected.secretFields ?? [], ...fields];
|
|
60
|
+
},
|
|
61
|
+
ignoreEnvRefs: (keys) => {
|
|
62
|
+
collected.ignoredEnvRefs = [.../* @__PURE__ */ new Set([...collected.ignoredEnvRefs ?? [], ...keys])];
|
|
63
|
+
},
|
|
64
|
+
onResolveAgent: (fn) => hooks.resolveAgent.push(fn),
|
|
65
|
+
onBuildConfig: (fn) => hooks.buildConfig.push(fn),
|
|
66
|
+
onBuildPrompt: (fn) => hooks.buildPrompt.push(fn),
|
|
67
|
+
onBuildEnv: (fn) => hooks.buildEnv.push(fn),
|
|
68
|
+
onBuildRuntime: (fn) => hooks.buildRuntime.push(fn),
|
|
69
|
+
onBuildResources: (fn) => hooks.buildResources.push(fn),
|
|
70
|
+
onValidate: (fn) => hooks.validate.push(fn),
|
|
71
|
+
onProvision: (fn) => hooks.provision.push(fn),
|
|
72
|
+
onHealthCheck: (fn) => hooks.healthCheck.push(fn)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function mergeByKey(items, keyOf) {
|
|
76
|
+
const map = /* @__PURE__ */ new Map();
|
|
77
|
+
for (const item of items) {
|
|
78
|
+
map.set(keyOf(item), item);
|
|
79
|
+
}
|
|
80
|
+
return [...map.values()];
|
|
81
|
+
}
|
|
82
|
+
function mcpServerKey(server) {
|
|
83
|
+
return server.id ?? `${server.transport}:${server.url ?? server.command ?? ""}:${server.args?.join(" ") ?? ""}`;
|
|
84
|
+
}
|
|
85
|
+
function mergeCollectedRuntime(current, fragment) {
|
|
86
|
+
const manifestPatches = [
|
|
87
|
+
...current.openclaw?.manifestPatches ?? [],
|
|
88
|
+
...fragment.openclaw?.manifestPatches ?? []
|
|
89
|
+
];
|
|
90
|
+
const shadowob = mergeShadowobRuntime(current.shadowob, fragment.shadowob);
|
|
91
|
+
return {
|
|
92
|
+
...manifestPatches.length > 0 ? { openclaw: { manifestPatches } } : {},
|
|
93
|
+
...shadowob ? { shadowob } : {},
|
|
94
|
+
...current.artifacts?.length || fragment.artifacts?.length ? {
|
|
95
|
+
artifacts: mergeByKey(
|
|
96
|
+
[...current.artifacts ?? [], ...fragment.artifacts ?? []],
|
|
97
|
+
(artifact) => artifact.kind
|
|
98
|
+
)
|
|
99
|
+
} : {},
|
|
100
|
+
...current.runtimeDependencies?.length || fragment.runtimeDependencies?.length ? {
|
|
101
|
+
runtimeDependencies: mergeByKey(
|
|
102
|
+
[...current.runtimeDependencies ?? [], ...fragment.runtimeDependencies ?? []],
|
|
103
|
+
(dep) => dep.id
|
|
104
|
+
)
|
|
105
|
+
} : {},
|
|
106
|
+
...current.skillSources?.length || fragment.skillSources?.length ? {
|
|
107
|
+
skillSources: mergeByKey(
|
|
108
|
+
[...current.skillSources ?? [], ...fragment.skillSources ?? []],
|
|
109
|
+
(source) => source.id
|
|
110
|
+
)
|
|
111
|
+
} : {},
|
|
112
|
+
...current.subagentSources?.length || fragment.subagentSources?.length ? {
|
|
113
|
+
subagentSources: mergeByKey(
|
|
114
|
+
[...current.subagentSources ?? [], ...fragment.subagentSources ?? []],
|
|
115
|
+
(source) => source.id
|
|
116
|
+
)
|
|
117
|
+
} : {},
|
|
118
|
+
...current.mcpServers?.length || fragment.mcpServers?.length ? {
|
|
119
|
+
mcpServers: mergeByKey(
|
|
120
|
+
[...current.mcpServers ?? [], ...fragment.mcpServers ?? []],
|
|
121
|
+
mcpServerKey
|
|
122
|
+
)
|
|
123
|
+
} : {},
|
|
124
|
+
...current.credentialFiles?.length || fragment.credentialFiles?.length ? {
|
|
125
|
+
credentialFiles: mergeByKey(
|
|
126
|
+
[...current.credentialFiles ?? [], ...fragment.credentialFiles ?? []],
|
|
127
|
+
(file) => `${file.envKey}:${file.path}`
|
|
128
|
+
)
|
|
129
|
+
} : {},
|
|
130
|
+
...current.verificationChecks?.length || fragment.verificationChecks?.length ? {
|
|
131
|
+
verificationChecks: mergeByKey(
|
|
132
|
+
[...current.verificationChecks ?? [], ...fragment.verificationChecks ?? []],
|
|
133
|
+
(check) => check.id
|
|
134
|
+
)
|
|
135
|
+
} : {}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function mergeShadowobRuntime(current, fragment) {
|
|
139
|
+
if (!current) return fragment;
|
|
140
|
+
if (!fragment) return current;
|
|
141
|
+
const accounts = new Map(current.accounts.map((account) => [account.buddyId, account]));
|
|
142
|
+
for (const account of fragment.accounts) {
|
|
143
|
+
accounts.set(account.buddyId, { ...accounts.get(account.buddyId), ...account });
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
...current,
|
|
147
|
+
...fragment,
|
|
148
|
+
capabilities: {
|
|
149
|
+
...current.capabilities ?? {},
|
|
150
|
+
...fragment.capabilities ?? {}
|
|
151
|
+
},
|
|
152
|
+
accounts: [...accounts.values()]
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function definePlugin(manifest, setup) {
|
|
156
|
+
const hooks = makeHooks();
|
|
157
|
+
const collected = {};
|
|
158
|
+
const api = makeAPI(hooks, collected);
|
|
159
|
+
setup(api);
|
|
160
|
+
if (collected.runtime) {
|
|
161
|
+
hooks.buildRuntime.unshift(() => collected.runtime);
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
manifest,
|
|
165
|
+
skills: collected.skills,
|
|
166
|
+
cli: collected.cli,
|
|
167
|
+
mcp: collected.mcp,
|
|
168
|
+
runtime: collected.runtime,
|
|
169
|
+
providerCatalogs: collected.providerCatalogs,
|
|
170
|
+
secretFields: collected.secretFields,
|
|
171
|
+
ignoredEnvRefs: collected.ignoredEnvRefs,
|
|
172
|
+
_hooks: hooks,
|
|
173
|
+
_buildConfig: hooks.buildConfig,
|
|
174
|
+
_buildEnv: hooks.buildEnv,
|
|
175
|
+
_validate: hooks.validate
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function defaultEnvVars(manifest, context) {
|
|
179
|
+
const envVars = {};
|
|
180
|
+
for (const field of manifest.auth.fields) {
|
|
181
|
+
const value = context.secrets[field.key];
|
|
182
|
+
if (value) envVars[field.key] = value;
|
|
183
|
+
}
|
|
184
|
+
return envVars;
|
|
185
|
+
}
|
|
186
|
+
function defaultValidation(manifest, context) {
|
|
187
|
+
const errors = [];
|
|
188
|
+
for (const field of manifest.auth.fields) {
|
|
189
|
+
if (field.required && !context.secrets[field.key]) {
|
|
190
|
+
errors.push({
|
|
191
|
+
path: `secrets.${field.key}`,
|
|
192
|
+
message: `${field.label} is required`,
|
|
193
|
+
severity: "error"
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return { valid: errors.filter((e) => e.severity === "error").length === 0, errors };
|
|
198
|
+
}
|
|
199
|
+
function openClawEnvRef(key) {
|
|
200
|
+
return ["$", "{env:", key, "}"].join("");
|
|
201
|
+
}
|
|
202
|
+
function defaultConnectorSkills(manifest) {
|
|
203
|
+
const env = Object.fromEntries(
|
|
204
|
+
manifest.auth.fields.map((field) => [field.key, openClawEnvRef(field.key)])
|
|
205
|
+
);
|
|
206
|
+
return {
|
|
207
|
+
entries: [
|
|
208
|
+
{
|
|
209
|
+
id: manifest.id,
|
|
210
|
+
name: manifest.name,
|
|
211
|
+
description: manifest.description,
|
|
212
|
+
...Object.keys(env).length > 0 ? { env } : {}
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function defineSkillPlugin(manifest, options, extraSetup) {
|
|
218
|
+
return definePlugin(manifest, (api) => {
|
|
219
|
+
if (options.skills) api.addSkills(options.skills);
|
|
220
|
+
if (options.cli?.length) api.addCLI(options.cli);
|
|
221
|
+
if (options.mcp) {
|
|
222
|
+
const mcps = Array.isArray(options.mcp) ? options.mcp : [options.mcp];
|
|
223
|
+
for (const s of mcps) api.addMCP(s);
|
|
224
|
+
}
|
|
225
|
+
api.onBuildConfig((_ctx) => {
|
|
226
|
+
const fragment = {};
|
|
227
|
+
if (options.skills) {
|
|
228
|
+
const sc = {};
|
|
229
|
+
if (options.skills.bundled?.length) sc.allowBundled = options.skills.bundled;
|
|
230
|
+
if (options.skills.entries?.length) {
|
|
231
|
+
const entries = {};
|
|
232
|
+
for (const skill of options.skills.entries) {
|
|
233
|
+
entries[skill.id] = {
|
|
234
|
+
enabled: true,
|
|
235
|
+
...skill.apiKey ? { apiKey: skill.apiKey } : {},
|
|
236
|
+
...skill.env ? { env: skill.env } : {}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
sc.entries = entries;
|
|
240
|
+
}
|
|
241
|
+
fragment.skills = sc;
|
|
242
|
+
}
|
|
243
|
+
return fragment;
|
|
244
|
+
});
|
|
245
|
+
api.onBuildEnv((ctx) => defaultEnvVars(manifest, ctx));
|
|
246
|
+
api.onValidate((ctx) => defaultValidation(manifest, ctx));
|
|
247
|
+
extraSetup?.(api);
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function defineConnectorPlugin(manifest, options, extraSetup) {
|
|
251
|
+
const mcpServers = options.mcp ? Array.isArray(options.mcp) ? options.mcp : [options.mcp] : [];
|
|
252
|
+
const skills = options.skills ?? defaultConnectorSkills(manifest);
|
|
253
|
+
return definePlugin(manifest, (api) => {
|
|
254
|
+
api.addSkills(skills);
|
|
255
|
+
if (options.cli?.length) api.addCLI(options.cli);
|
|
256
|
+
for (const server of mcpServers) api.addMCP(server);
|
|
257
|
+
if (options.runtimeDependencies?.length) api.addRuntimeDependencies(options.runtimeDependencies);
|
|
258
|
+
if (options.skillSources?.length) api.addSkillSources(options.skillSources);
|
|
259
|
+
if (options.subagentSources?.length) api.addSubagentSources(options.subagentSources);
|
|
260
|
+
if (options.credentialFiles?.length) api.addCredentialFiles(options.credentialFiles);
|
|
261
|
+
if (options.verificationChecks?.length) api.addVerificationChecks(options.verificationChecks);
|
|
262
|
+
api.addSecretFields(
|
|
263
|
+
manifest.auth.fields.map((field) => ({
|
|
264
|
+
key: field.key,
|
|
265
|
+
label: field.label,
|
|
266
|
+
description: field.description,
|
|
267
|
+
required: field.required,
|
|
268
|
+
sensitive: field.sensitive,
|
|
269
|
+
placeholder: field.placeholder,
|
|
270
|
+
helpUrl: field.helpUrl
|
|
271
|
+
}))
|
|
272
|
+
);
|
|
273
|
+
api.onBuildConfig((_ctx) => {
|
|
274
|
+
const fragment = {};
|
|
275
|
+
if (skills) {
|
|
276
|
+
const skillConfig = {};
|
|
277
|
+
const extraDirs = [
|
|
278
|
+
...new Set(
|
|
279
|
+
(options.skillSources ?? []).map((source) => source.targetPath).filter((path) => Boolean(path))
|
|
280
|
+
)
|
|
281
|
+
];
|
|
282
|
+
if (extraDirs.length > 0) skillConfig.load = { extraDirs };
|
|
283
|
+
if (skills.bundled?.length) skillConfig.allowBundled = skills.bundled;
|
|
284
|
+
if (skills.entries?.length) {
|
|
285
|
+
const entries = {};
|
|
286
|
+
for (const skill of skills.entries) {
|
|
287
|
+
entries[skill.id] = {
|
|
288
|
+
enabled: true,
|
|
289
|
+
...skill.apiKey ? { apiKey: skill.apiKey } : {},
|
|
290
|
+
...skill.env ? { env: skill.env } : {}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
skillConfig.entries = entries;
|
|
294
|
+
}
|
|
295
|
+
fragment.skills = skillConfig;
|
|
296
|
+
}
|
|
297
|
+
return fragment;
|
|
298
|
+
});
|
|
299
|
+
if (options.config) api.onBuildConfig(options.config);
|
|
300
|
+
api.onBuildEnv((ctx) => ({
|
|
301
|
+
...defaultEnvVars(manifest, ctx),
|
|
302
|
+
...options.env?.(ctx) ?? {}
|
|
303
|
+
}));
|
|
304
|
+
api.onValidate((ctx) => options.validate?.(ctx) ?? defaultValidation(manifest, ctx));
|
|
305
|
+
if (options.prompt) {
|
|
306
|
+
api.onBuildPrompt(
|
|
307
|
+
(ctx) => typeof options.prompt === "function" ? options.prompt(ctx) : options.prompt
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
extraSetup?.(api);
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function defineChannelPlugin(manifest, channelBuilder, extraSetup) {
|
|
314
|
+
return definePlugin(manifest, (api) => {
|
|
315
|
+
api.onBuildConfig(channelBuilder);
|
|
316
|
+
api.onBuildEnv((ctx) => defaultEnvVars(manifest, ctx));
|
|
317
|
+
api.onValidate((ctx) => defaultValidation(manifest, ctx));
|
|
318
|
+
extraSetup?.(api);
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
function defineProviderPlugin(manifest, options, extraSetup) {
|
|
322
|
+
return definePlugin(manifest, (api) => {
|
|
323
|
+
const apiKeyField = manifest.auth.fields.find((f) => f.required && f.sensitive) ?? manifest.auth.fields.find((f) => f.sensitive);
|
|
324
|
+
const envKey = options.provider.envKey ?? apiKeyField?.key;
|
|
325
|
+
if (envKey) {
|
|
326
|
+
api.addProviderCatalog({
|
|
327
|
+
id: options.provider.id,
|
|
328
|
+
api: mapProviderApi(options.provider.api),
|
|
329
|
+
baseUrl: options.provider.baseUrl,
|
|
330
|
+
envKey,
|
|
331
|
+
envKeyAliases: options.provider.envKeyAliases,
|
|
332
|
+
baseUrlEnvKey: options.provider.baseUrlEnvKey,
|
|
333
|
+
modelEnvKey: options.provider.modelEnvKey,
|
|
334
|
+
priority: options.provider.priority,
|
|
335
|
+
models: options.provider.models ?? []
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
api.addSecretFields(
|
|
339
|
+
manifest.auth.fields.map((field) => ({
|
|
340
|
+
key: field.key,
|
|
341
|
+
label: field.label,
|
|
342
|
+
description: field.description,
|
|
343
|
+
required: field.required,
|
|
344
|
+
sensitive: field.sensitive,
|
|
345
|
+
placeholder: field.placeholder
|
|
346
|
+
}))
|
|
347
|
+
);
|
|
348
|
+
api.onBuildConfig((ctx) => {
|
|
349
|
+
const { agentConfig } = ctx;
|
|
350
|
+
const resolvedEnvKey = resolveProviderEnvKey(options.provider.envKey ?? apiKeyField?.key, {
|
|
351
|
+
aliases: options.provider.envKeyAliases,
|
|
352
|
+
secrets: ctx.secrets
|
|
353
|
+
});
|
|
354
|
+
const providerEntry = {
|
|
355
|
+
...resolvedEnvKey ? { apiKey: `\${env:${resolvedEnvKey}}` } : {},
|
|
356
|
+
models: options.provider.models?.map((m) => ({
|
|
357
|
+
id: m.id,
|
|
358
|
+
name: m.name ?? m.id,
|
|
359
|
+
...m.contextWindow != null ? { contextWindow: m.contextWindow } : {},
|
|
360
|
+
...m.maxTokens != null ? { maxTokens: m.maxTokens } : {}
|
|
361
|
+
})) ?? [],
|
|
362
|
+
request: { allowPrivateNetwork: true }
|
|
363
|
+
};
|
|
364
|
+
if (agentConfig.baseUrl || options.provider.baseUrl) {
|
|
365
|
+
providerEntry.baseUrl = agentConfig.baseUrl ?? options.provider.baseUrl;
|
|
366
|
+
}
|
|
367
|
+
if (agentConfig.models) providerEntry.models = agentConfig.models;
|
|
368
|
+
if (options.provider.api) {
|
|
369
|
+
providerEntry.api = mapProviderApi(options.provider.api);
|
|
370
|
+
}
|
|
371
|
+
return { models: { mode: "merge", providers: { [options.provider.id]: providerEntry } } };
|
|
372
|
+
});
|
|
373
|
+
api.onBuildEnv((ctx) => {
|
|
374
|
+
const out = defaultEnvVars(manifest, ctx);
|
|
375
|
+
for (const key of providerEnvKeys(options.provider)) {
|
|
376
|
+
const value = ctx.secrets[key] ?? process.env[key];
|
|
377
|
+
if (value) out[key] = value;
|
|
378
|
+
}
|
|
379
|
+
return out;
|
|
380
|
+
});
|
|
381
|
+
api.onValidate((ctx) => {
|
|
382
|
+
const result = defaultValidation(manifest, ctx);
|
|
383
|
+
if (apiKeyField && hasProviderEnvValue(options.provider.envKey ?? apiKeyField.key, {
|
|
384
|
+
aliases: options.provider.envKeyAliases,
|
|
385
|
+
secrets: ctx.secrets
|
|
386
|
+
})) {
|
|
387
|
+
result.errors = result.errors.filter((error) => error.path !== `secrets.${apiKeyField.key}`);
|
|
388
|
+
result.valid = result.errors.filter((error) => error.severity === "error").length === 0;
|
|
389
|
+
}
|
|
390
|
+
return result;
|
|
391
|
+
});
|
|
392
|
+
extraSetup?.(api);
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function mapProviderApi(api) {
|
|
396
|
+
const MAP = {
|
|
397
|
+
anthropic: "anthropic-messages",
|
|
398
|
+
openai: "openai-completions",
|
|
399
|
+
"openai-chat": "openai-completions",
|
|
400
|
+
google: "google-generative-ai",
|
|
401
|
+
gemini: "google-generative-ai",
|
|
402
|
+
bedrock: "bedrock-converse-stream",
|
|
403
|
+
azure: "azure-openai-responses",
|
|
404
|
+
"azure-openai": "azure-openai-responses"
|
|
405
|
+
};
|
|
406
|
+
return MAP[api] ?? api;
|
|
407
|
+
}
|
|
408
|
+
function resolveProviderEnvKey(envKey, options) {
|
|
409
|
+
if (!envKey) return void 0;
|
|
410
|
+
for (const key of [envKey, ...options.aliases ?? []]) {
|
|
411
|
+
if (options.secrets[key] ?? process.env[key]) return key;
|
|
412
|
+
}
|
|
413
|
+
return envKey;
|
|
414
|
+
}
|
|
415
|
+
function hasProviderEnvValue(envKey, options) {
|
|
416
|
+
if (!envKey) return false;
|
|
417
|
+
return [envKey, ...options.aliases ?? []].some(
|
|
418
|
+
(key) => Boolean(options.secrets[key] ?? process.env[key])
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
function providerEnvKeys(provider) {
|
|
422
|
+
return [
|
|
423
|
+
provider.envKey,
|
|
424
|
+
...provider.envKeyAliases ?? [],
|
|
425
|
+
provider.baseUrlEnvKey,
|
|
426
|
+
provider.modelEnvKey
|
|
427
|
+
].filter((key) => Boolean(key));
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export {
|
|
431
|
+
loadManifest,
|
|
432
|
+
definePlugin,
|
|
433
|
+
defineSkillPlugin,
|
|
434
|
+
defineConnectorPlugin,
|
|
435
|
+
defineChannelPlugin,
|
|
436
|
+
defineProviderPlugin
|
|
437
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
collectRuntimeEnvRequirements
|
|
4
|
+
} from "./chunk-QET4LT4J.js";
|
|
5
|
+
|
|
6
|
+
// src/interfaces/cli/init.command.ts
|
|
7
|
+
import { cp, stat, writeFile } from "fs/promises";
|
|
8
|
+
import { resolve } from "path";
|
|
9
|
+
import { Command } from "commander";
|
|
10
|
+
async function fileExists(path) {
|
|
11
|
+
try {
|
|
12
|
+
await stat(path);
|
|
13
|
+
return true;
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function createInitCommand(container) {
|
|
19
|
+
return new Command("init").description("Generate an shadowob-cloud.json config template").option("-o, --output <path>", "Output file path", "shadowob-cloud.json").option("-t, --template <name>", "Template name (use --list to see all)", "gstack-buddy").option("-l, --list", "List all available templates and exit").option("--force", "Overwrite existing file").option("--quick", "Quick init: read .env, pick default template, no prompts").action(
|
|
20
|
+
async (options) => {
|
|
21
|
+
const templates = await container.template.discover();
|
|
22
|
+
if (options.list) {
|
|
23
|
+
console.log("\nAvailable templates:\n");
|
|
24
|
+
const maxName = Math.max(...templates.map((t) => t.name.length), 6);
|
|
25
|
+
const maxTitle = Math.min(Math.max(...templates.map((t) => t.title.length), 5), 32);
|
|
26
|
+
const header = ` ${"TEMPLATE".padEnd(maxName)} ${"TITLE".padEnd(maxTitle)} AGENTS DESCRIPTION`;
|
|
27
|
+
console.log(header);
|
|
28
|
+
console.log(` ${"-".repeat(maxName)} ${"-".repeat(maxTitle)} ------ -----------`);
|
|
29
|
+
for (const t of templates) {
|
|
30
|
+
const nameStr = t.name.padEnd(maxName);
|
|
31
|
+
const title = t.title.length > maxTitle ? `${t.title.slice(0, maxTitle - 1)}\u2026` : t.title;
|
|
32
|
+
const titleStr = title.padEnd(maxTitle);
|
|
33
|
+
const agentStr = String(t.agentCount).padStart(6);
|
|
34
|
+
const desc = t.description.length > 60 ? `${t.description.slice(0, 57)}...` : t.description;
|
|
35
|
+
console.log(` ${nameStr} ${titleStr} ${agentStr} ${desc}`);
|
|
36
|
+
}
|
|
37
|
+
console.log();
|
|
38
|
+
console.log(" Use: shadowob-cloud init --template <name> [-o output.json]");
|
|
39
|
+
console.log();
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (options.quick) {
|
|
43
|
+
const outputPath2 = resolve(options.output);
|
|
44
|
+
if (await fileExists(outputPath2) && !options.force) {
|
|
45
|
+
container.logger.error(`File already exists: ${outputPath2}`);
|
|
46
|
+
container.logger.dim("Use --force to overwrite");
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
const templateName2 = templates.find((template) => template.name === "gstack-buddy")?.name ?? templates[0]?.name ?? "gstack-buddy";
|
|
50
|
+
const content = await container.template.getTemplate(templateName2) ?? {
|
|
51
|
+
version: "1.0.0",
|
|
52
|
+
environment: "production",
|
|
53
|
+
plugins: { shadowob: { servers: [], buddies: [], bindings: [] } },
|
|
54
|
+
registry: { providers: [], configurations: [] },
|
|
55
|
+
deployments: { namespace: "shadowob-cloud", agents: [] }
|
|
56
|
+
};
|
|
57
|
+
const envKeys = await collectRuntimeEnvRequirements(content);
|
|
58
|
+
const detected = envKeys.filter((key) => process.env[key]);
|
|
59
|
+
if (detected.length > 0) {
|
|
60
|
+
container.logger.info(
|
|
61
|
+
`Detected ${detected.length} provider env var(s) \u2014 config will reference them via \${env:...}`
|
|
62
|
+
);
|
|
63
|
+
for (const key of detected) container.logger.dim(` ${key}`);
|
|
64
|
+
} else {
|
|
65
|
+
container.logger.warn("No API keys found in environment. Add them to .env and re-run.");
|
|
66
|
+
}
|
|
67
|
+
await writeFile(outputPath2, `${JSON.stringify(content, null, 2)}
|
|
68
|
+
`, "utf-8");
|
|
69
|
+
container.logger.success(`Quick init from "${templateName2}": ${outputPath2}`);
|
|
70
|
+
container.logger.dim(
|
|
71
|
+
`Edit the file and run: shadowob-cloud validate -f ${options.output}`
|
|
72
|
+
);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const outputPath = resolve(options.output);
|
|
76
|
+
if (await fileExists(outputPath) && !options.force) {
|
|
77
|
+
container.logger.error(`File already exists: ${outputPath}`);
|
|
78
|
+
container.logger.dim("Use --force to overwrite");
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
const templateName = options.template;
|
|
82
|
+
const meta = templates.find((t) => t.name === templateName);
|
|
83
|
+
if (!meta && templates.length > 0) {
|
|
84
|
+
container.logger.error(`Unknown template: ${templateName}`);
|
|
85
|
+
container.logger.dim(`Available: ${templates.map((t) => t.name).join(", ")}`);
|
|
86
|
+
container.logger.dim("Run: shadowob-cloud init --list");
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
const templateFilePath = meta ? await container.template.getTemplatePath(meta.name) : null;
|
|
90
|
+
if (!templateFilePath || !await fileExists(templateFilePath)) {
|
|
91
|
+
await writeFile(
|
|
92
|
+
outputPath,
|
|
93
|
+
`${JSON.stringify(
|
|
94
|
+
{
|
|
95
|
+
version: "1.0.0",
|
|
96
|
+
environment: "production",
|
|
97
|
+
plugins: { shadowob: { servers: [], buddies: [], bindings: [] } },
|
|
98
|
+
registry: { providers: [], configurations: [] },
|
|
99
|
+
deployments: { namespace: "shadowob-cloud", agents: [] }
|
|
100
|
+
},
|
|
101
|
+
null,
|
|
102
|
+
2
|
|
103
|
+
)}
|
|
104
|
+
`,
|
|
105
|
+
"utf-8"
|
|
106
|
+
);
|
|
107
|
+
container.logger.success(`Created: ${outputPath}`);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
await cp(templateFilePath, outputPath);
|
|
111
|
+
container.logger.success(`Created config from "${templateName}" template: ${outputPath}`);
|
|
112
|
+
container.logger.dim(
|
|
113
|
+
`Edit the file, then run: shadowob-cloud validate -f ${options.output}`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export {
|
|
120
|
+
createInitCommand
|
|
121
|
+
};
|