@cleocode/cleo 2026.10.2 → 2026.10.4
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/bin/cleo.js +11 -1
- package/dist/cli/adapter-LVXHFBC4.js +158 -0
- package/dist/cli/add-WUAV7LDT.js +443 -0
- package/dist/cli/add-batch-U2DLKAQC.js +163 -0
- package/dist/cli/admin-I7BQYVZD.js +340 -0
- package/dist/cli/adr-K2THMQBS.js +171 -0
- package/dist/cli/agent-WQ6XY2DW.js +2366 -0
- package/dist/cli/agent-outputs-BJIYLVTU.js +84 -0
- package/dist/cli/analyze-PGQZWGOC.js +48 -0
- package/dist/cli/archive-5LZPF7C3.js +64 -0
- package/dist/cli/archive-stats-U6CYC6JM.js +100 -0
- package/dist/cli/attention-SOURWCNI.js +167 -0
- package/dist/cli/audit-FO2Y4LH2.js +122 -0
- package/dist/cli/auth-ED7TAIXI.js +491 -0
- package/dist/cli/backfill-32TRAYRD.js +156 -0
- package/dist/cli/backup-LEJMZJKL.js +587 -0
- package/dist/cli/backup-inspect-6HPLUEI2.js +26 -0
- package/dist/cli/backup-recover-2BTYBZU2.js +29 -0
- package/dist/cli/blockers-5JULUJTV.js +54 -0
- package/dist/cli/brain-273N3FW4.js +400 -0
- package/dist/cli/briefing-7H6OLECX.js +212 -0
- package/dist/cli/caamp-MFQVN6VU.js +181 -0
- package/dist/cli/cancel-SCMJTXZB.js +84 -0
- package/dist/cli/canon-NPF5RODM.js +142 -0
- package/dist/cli/canon-docs-2GTOLF7Y.js +26 -0
- package/dist/cli/cant-46XCUP4P.js +239 -0
- package/dist/cli/changeset-32NMBGG2.js +248 -0
- package/dist/cli/check-RWJLBCI2.js +907 -0
- package/dist/cli/checkpoint-37HMMKD7.js +128 -0
- package/dist/cli/chunk-2JIJD2I7.js +108 -0
- package/dist/cli/chunk-37NU2XDP.js +171 -0
- package/dist/cli/chunk-3IOQVUO7.js +17308 -0
- package/dist/cli/chunk-3PGH67MT.js +175 -0
- package/dist/cli/chunk-3ZO3M37V.js +1002 -0
- package/dist/cli/chunk-47JYZAMS.js +30 -0
- package/dist/cli/chunk-5J2VH3BC.js +66 -0
- package/dist/cli/chunk-5ZFFUFH7.js +92 -0
- package/dist/cli/chunk-6JSJNYH2.js +114 -0
- package/dist/cli/chunk-7INMKEAD.js +85 -0
- package/dist/cli/chunk-A2IUEIM5.js +278 -0
- package/dist/cli/chunk-AWCQH2W5.js +35 -0
- package/dist/cli/chunk-AYA6F4ZT.js +56 -0
- package/dist/cli/chunk-BCEXRFA2.js +76 -0
- package/dist/cli/chunk-BPEVD37G.js +124 -0
- package/dist/cli/chunk-C3B7C43W.js +16 -0
- package/dist/cli/chunk-DVTPIZJM.js +72 -0
- package/dist/cli/chunk-DYABOIHB.js +96 -0
- package/dist/cli/chunk-EBRZ76HS.js +51 -0
- package/dist/cli/chunk-EGOTK2HA.js +57 -0
- package/dist/cli/chunk-EOPQFCSR.js +148 -0
- package/dist/cli/chunk-FORFDPP5.js +288 -0
- package/dist/cli/chunk-GFGLLDXX.js +110 -0
- package/dist/cli/chunk-GH37QXW5.js +280 -0
- package/dist/cli/chunk-GZFVDR44.js +320 -0
- package/dist/cli/chunk-I3CRQQAD.js +225 -0
- package/dist/cli/chunk-J3ZFM3UQ.js +754 -0
- package/dist/cli/chunk-JNZJPIPJ.js +90 -0
- package/dist/cli/chunk-KHB52JNB.js +209 -0
- package/dist/cli/chunk-KJDWWQFY.js +46 -0
- package/dist/cli/chunk-LKNUA3SB.js +83 -0
- package/dist/cli/chunk-LVGIFMCV.js +163 -0
- package/dist/cli/chunk-LWQBJQSE.js +67 -0
- package/dist/cli/chunk-MNJRLSEQ.js +107 -0
- package/dist/cli/chunk-NRKWJLMS.js +91 -0
- package/dist/cli/chunk-NSHV2JNM.js +48 -0
- package/dist/cli/chunk-NWTATTEQ.js +210 -0
- package/dist/cli/chunk-OAPN46TC.js +89 -0
- package/dist/cli/chunk-OGV57L4J.js +59 -0
- package/dist/cli/chunk-OILHT47L.js +252 -0
- package/dist/cli/chunk-OPTEQKBB.js +258 -0
- package/dist/cli/chunk-PKKZPOOP.js +352 -0
- package/dist/cli/chunk-QA6T2LQ5.js +71 -0
- package/dist/cli/chunk-QFFQSKRC.js +4497 -0
- package/dist/cli/chunk-QPUY2HQZ.js +74 -0
- package/dist/cli/chunk-REUTEW3O.js +258 -0
- package/dist/cli/chunk-S24YI723.js +88 -0
- package/dist/cli/chunk-SXXOC6KZ.js +209 -0
- package/dist/cli/chunk-ULN4OKQQ.js +259 -0
- package/dist/cli/chunk-V5GBGOGM.js +46 -0
- package/dist/cli/chunk-VLEYOOPH.js +31 -0
- package/dist/cli/chunk-W33Q3FBH.js +66 -0
- package/dist/cli/chunk-W3JLYKKY.js +140 -0
- package/dist/cli/chunk-XRAX6XFP.js +48 -0
- package/dist/cli/chunk-YGKEECTI.js +78 -0
- package/dist/cli/chunk-YUZJI67I.js +108 -0
- package/dist/cli/chunk-YY66LFZF.js +29 -0
- package/dist/cli/chunk-ZBISIPCK.js +78 -0
- package/dist/cli/chunk-ZZTHTMQP.js +77 -0
- package/dist/cli/claim-KPENYHIQ.js +96 -0
- package/dist/cli/classify-DRVMCFQU.js +117 -0
- package/dist/cli/cli-T3CR7J57.js +48 -0
- package/dist/cli/cloud-PPQ4O5TX.js +565 -0
- package/dist/cli/cockpit-RZKLGYPN.js +790 -0
- package/dist/cli/code-Z5CTMVTD.js +178 -0
- package/dist/cli/complete-UBOCOBRB.js +34 -0
- package/dist/cli/complexity-BV2AGQRZ.js +56 -0
- package/dist/cli/compliance-32PD5Y47.js +276 -0
- package/dist/cli/conduit-VDKCH33F.js +307 -0
- package/dist/cli/config-I72JAXK4.js +516 -0
- package/dist/cli/consensus-LFILLSTK.js +121 -0
- package/dist/cli/context-XUUVFVTP.js +141 -0
- package/dist/cli/contribution-37NQ4N5R.js +111 -0
- package/dist/cli/curator-TFDXU2EX.js +139 -0
- package/dist/cli/current-C4SN5BWV.js +42 -0
- package/dist/cli/daemon-DV25JQ62.js +451 -0
- package/dist/cli/dash-TFU4RLQW.js +70 -0
- package/dist/cli/decide-5VPMNTSI.js +419 -0
- package/dist/cli/decompose-KOYEZNJL.js +77 -0
- package/dist/cli/decomposition-7OHUFIQN.js +121 -0
- package/dist/cli/delete-Q7YCAFY5.js +68 -0
- package/dist/cli/deps-6UZKLDGJ.js +463 -0
- package/dist/cli/detect-FERY35UL.js +45 -0
- package/dist/cli/detect-drift-UL2JTPUK.js +408 -0
- package/dist/cli/diagnostics-TI5QAZXR.js +132 -0
- package/dist/cli/docs-QI2PRN3T.js +3095 -0
- package/dist/cli/doctor-AX5TICQO.js +1253 -0
- package/dist/cli/doctor-ac-bindings-YPMYHU2G.js +26 -0
- package/dist/cli/doctor-acceptance-drift-PYNFGMKB.js +26 -0
- package/dist/cli/doctor-credentials-UZRIADKM.js +26 -0
- package/dist/cli/doctor-db-substrate-Q2TOYM2S.js +27 -0
- package/dist/cli/doctor-dep-cycles-GCVYZY6F.js +26 -0
- package/dist/cli/doctor-exodus-RO5SUTC2.js +26 -0
- package/dist/cli/doctor-exodus-residue-EM2AWQXP.js +26 -0
- package/dist/cli/doctor-fk-check-Q3FOLECE.js +26 -0
- package/dist/cli/doctor-global-delivery-TNOAQ3NP.js +26 -0
- package/dist/cli/doctor-heavy-command-hook-IO3QAQLG.js +26 -0
- package/dist/cli/doctor-legacy-backups-O2YH5VLS.js +26 -0
- package/dist/cli/doctor-legacy-reaper-VSEJEIFA.js +26 -0
- package/dist/cli/doctor-malformed-ids-LQ766V5K.js +26 -0
- package/dist/cli/doctor-manifest-rows-6FQDNHLH.js +26 -0
- package/dist/cli/doctor-memory-guard-J4PSEKB5.js +26 -0
- package/dist/cli/doctor-migrations-ONOH56YM.js +26 -0
- package/dist/cli/doctor-nexus-residency-FUQAX7PV.js +26 -0
- package/dist/cli/doctor-project-identity-GUDK3HYX.js +26 -0
- package/dist/cli/doctor-projects-7L3BNL4O.js +30 -0
- package/dist/cli/doctor-projects-registry-TEAVHFQU.js +26 -0
- package/dist/cli/doctor-release-readiness-IEGHX6SL.js +26 -0
- package/dist/cli/doctor-repair-NBONOSZU.js +26 -0
- package/dist/cli/doctor-skill-fixtures-7Y6L34A3.js +26 -0
- package/dist/cli/doctor-split-brain-TUKIGVHF.js +26 -0
- package/dist/cli/doctor-superseded-store-BHZY2B2L.js +26 -0
- package/dist/cli/doctor-tool-locks-REQMIVYK.js +26 -0
- package/dist/cli/doctor-twin-collapse-222GOSPE.js +26 -0
- package/dist/cli/doctor-worktree-stores-J7TCRVJ3.js +26 -0
- package/dist/cli/done-V3AOO65B.js +195 -0
- package/dist/cli/dynamic-RR4HB7BB.js +29 -0
- package/dist/cli/event-EGNPGE5A.js +372 -0
- package/dist/cli/exists-H4SDCBPL.js +65 -0
- package/dist/cli/exodus-KALO3B3X.js +401 -0
- package/dist/cli/export-ROFOCG4M.js +92 -0
- package/dist/cli/export-tasks-US3WBIEQ.js +96 -0
- package/dist/cli/federation-SUIB5QWT.js +145 -0
- package/dist/cli/find-YICG4BG6.js +177 -0
- package/dist/cli/focus-TKCZPKOM.js +55 -0
- package/dist/cli/gateway-H4HFDC3E.js +77 -0
- package/dist/cli/gateway-auto-start-EDK7XI6E.js +36 -0
- package/dist/cli/gc-5R2TUY5T.js +291 -0
- package/dist/cli/go-PRQFK5YG.js +206 -0
- package/dist/cli/goal-7CZRMLHC.js +212 -0
- package/dist/cli/grade-PY2YRPUS.js +56 -0
- package/dist/cli/graph-XIXMCFKG.js +878 -0
- package/dist/cli/history-EIXADPAD.js +137 -0
- package/dist/cli/hook-UF7J7R6D.js +57 -0
- package/dist/cli/hook-entry.js +244 -19
- package/dist/cli/hygiene-3QZ2NI7P.js +55 -0
- package/dist/cli/import-R73SO444.js +88 -0
- package/dist/cli/import-tasks-O22FZJ4U.js +108 -0
- package/dist/cli/index.js +419 -94607
- package/dist/cli/init-IHEJDQWU.js +40 -0
- package/dist/cli/inject-LSRVWNCP.js +82 -0
- package/dist/cli/install-global-4AZUCH6U.js +95 -0
- package/dist/cli/intelligence-2OSFOGD2.js +181 -0
- package/dist/cli/issue-IIWEDNFC.js +158 -0
- package/dist/cli/janitor-GPMC7VOR.js +111 -0
- package/dist/cli/labels-5NPOIQXN.js +87 -0
- package/dist/cli/lifecycle-4FFS2K2T.js +272 -0
- package/dist/cli/list-47KEUGPQ.js +108 -0
- package/dist/cli/llm-G5B3I6GD.js +703 -0
- package/dist/cli/llm-cost-S7RS6BVA.js +25 -0
- package/dist/cli/llm-stream-24A45NTS.js +27 -0
- package/dist/cli/log-XF6H2XSD.js +75 -0
- package/dist/cli/login-LBPLGHYG.js +43 -0
- package/dist/cli/logout-SX4JSJIV.js +74 -0
- package/dist/cli/manifest-NMCW4PIW.js +353 -0
- package/dist/cli/map-BU72KMGF.js +52 -0
- package/dist/cli/memory-UHYIVGVM.js +1956 -0
- package/dist/cli/migrate-agents-v2-OO7OILZK.js +33 -0
- package/dist/cli/migrate-claude-mem-EDNYUY3K.js +201 -0
- package/dist/cli/next-RZFRG5X7.js +56 -0
- package/dist/cli/nexus-4S4Z5EVU.js +2923 -0
- package/dist/cli/ops-KR7AWCG3.js +51 -0
- package/dist/cli/orchestrate-HOYZY3VX.js +948 -0
- package/dist/cli/otel-U7IIRBCT.js +188 -0
- package/dist/cli/phase-NYZFHUE5.js +220 -0
- package/dist/cli/pivot-FF2CVUZL.js +87 -0
- package/dist/cli/plan-3SL2NTRV.js +48 -0
- package/dist/cli/playbook-2FCBV7N3.js +229 -0
- package/dist/cli/project-WDX2TGMC.js +330 -0
- package/dist/cli/promote-YINYFBZY.js +52 -0
- package/dist/cli/provenance-C7AYD7WG.js +128 -0
- package/dist/cli/provider-QLJEDQBR.js +212 -0
- package/dist/cli/reason-JF5BHBM5.js +137 -0
- package/dist/cli/reconcile-NMISHDGX.js +127 -0
- package/dist/cli/refresh-memory-EY5YNICV.js +45 -0
- package/dist/cli/relates-R3ZPICAY.js +259 -0
- package/dist/cli/release-4ZJTMUUT.js +524 -0
- package/dist/cli/remote-QSONJDIK.js +279 -0
- package/dist/cli/renderers-64OR3IWX.js +37 -0
- package/dist/cli/reorder-J3DOE7ST.js +86 -0
- package/dist/cli/reparent-2OUMKEZX.js +58 -0
- package/dist/cli/req-TZB7OFKO.js +129 -0
- package/dist/cli/research-MTD7EX45.js +365 -0
- package/dist/cli/restore-VEUOX7NF.js +423 -0
- package/dist/cli/revert-3YF2IL5G.js +240 -0
- package/dist/cli/roadmap-7OOQLXKG.js +61 -0
- package/dist/cli/run-2U5NZV5Z.js +211 -0
- package/dist/cli/safestop-VR4VK56D.js +88 -0
- package/dist/cli/saga-SEWPIOX2.js +285 -0
- package/dist/cli/schema-C52WZ35V.js +195 -0
- package/dist/cli/self-update-GQIGUDPS.js +504 -0
- package/dist/cli/selfimprove-3Y5L4ECT.js +88 -0
- package/dist/cli/sentient-M4YMAVGV.js +1088 -0
- package/dist/cli/sequence-6UBMA4IF.js +93 -0
- package/dist/cli/service-5R7SILZ7.js +155 -0
- package/dist/cli/session-3C6AAC4Y.js +707 -0
- package/dist/cli/setup-BTUBW5PU.js +323 -0
- package/dist/cli/show-MXT2V7TF.js +122 -0
- package/dist/cli/skill-GFUZOU2C.js +84 -0
- package/dist/cli/skills-EDWLKAF3.js +928 -0
- package/dist/cli/smoke-provider-SKUFMZXU.js +218 -0
- package/dist/cli/snapshot-GUWMURCM.js +119 -0
- package/dist/cli/src-66GAKPXR.js +80 -0
- package/dist/cli/start-QFG56RGN.js +67 -0
- package/dist/cli/stats-GW55P7RR.js +95 -0
- package/dist/cli/status-46HTKNRR.js +157 -0
- package/dist/cli/sticky-2DUZOUGI.js +338 -0
- package/dist/cli/stop-J2QEUKHX.js +42 -0
- package/dist/cli/sync-GJP2QYT5.js +154 -0
- package/dist/cli/tasks-BNXTM7PB.js +174 -0
- package/dist/cli/telemetry-55Z2XJWL.js +120 -0
- package/dist/cli/templates-7O77TKPV.js +611 -0
- package/dist/cli/testing-37YTBNKP.js +146 -0
- package/dist/cli/token-UAVJMNUI.js +220 -0
- package/dist/cli/transcript-LORQTV5Z.js +440 -0
- package/dist/cli/tui-BPUFHYKK.js +51 -0
- package/dist/cli/update-NVCYV2FT.js +476 -0
- package/dist/cli/upgrade-OXJXOGEF.js +243 -0
- package/dist/cli/verify-LYLDHPT2.js +190 -0
- package/dist/cli/web-QP2RP266.js +275 -0
- package/dist/cli/workgraph-FXBSZDQE.js +232 -0
- package/dist/cli/worktree-6RXAJIST.js +370 -0
- package/package.json +13 -13
- package/studio-dist/client/_app/immutable/chunks/{Buaay_Q8.js → Btgeq_wq.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{BJp57kf2.js → CgBjxmu6.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/{CLP4JZvZ.js → DgEKqO6r.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/t81h7afa.js +1 -0
- package/studio-dist/client/_app/immutable/entry/{app.CczVILch.js → app.a02HWaRB.js} +2 -2
- package/studio-dist/client/_app/immutable/entry/start.BreMSngo.js +1 -0
- package/studio-dist/client/_app/immutable/nodes/{0.Zy2IsLEl.js → 0.nTXyRfc-.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{1.DJN1QI3l.js → 1.4zrWeHtl.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{15.B4rwqbHV.js → 15.D9mk4JyY.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{16.jn-5BG_L.js → 16._-wt-sQf.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{17.DnWGC4t9.js → 17.CUu6LQDj.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{18.0zddLZOY.js → 18.Dz4QRTkX.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{20.DEKHq9Tc.js → 20.CJ2_EB0U.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{24.CQB9KP-p.js → 24.Igj2FS7k.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{25.BaqToZD-.js → 25.BnATjVGN.js} +2 -2
- package/studio-dist/client/_app/immutable/nodes/{26.BiE1i4iE.js → 26.6iPyjT44.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{3.BObAOu_-.js → 3.AA5GwNgP.js} +1 -1
- package/studio-dist/client/_app/version.json +1 -1
- package/studio-dist/server/chunks/{0-BmUoS2yd.js → 0-DGmsoBYm.js} +3 -3
- package/studio-dist/server/chunks/1-8PfxPvlK.js +9 -0
- package/studio-dist/server/chunks/{15-Dt4kqUxW.js → 15-Bg6YTndh.js} +3 -3
- package/studio-dist/server/chunks/{16-kgTLJvbO.js → 16-BObLwgyD.js} +3 -3
- package/studio-dist/server/chunks/{17-mRYB5141.js → 17-BNXGyAHX.js} +3 -3
- package/studio-dist/server/chunks/{18-BjZ325q5.js → 18-UqQFRIID.js} +3 -3
- package/studio-dist/server/chunks/{20-DQ2Vrujq.js → 20-CMn8a_yP.js} +3 -3
- package/studio-dist/server/chunks/{24-DAeuAfXN.js → 24-BuOTDzib.js} +3 -3
- package/studio-dist/server/chunks/{25-DGCNmzAS.js → 25-CIMSmjVx.js} +4 -4
- package/studio-dist/server/chunks/{26-CiN6bbmR.js → 26-DWGObn2T.js} +3 -3
- package/studio-dist/server/chunks/{3-BS2FXYjP.js → 3-CyiffdJZ.js} +3 -3
- package/studio-dist/server/chunks/{_layout.svelte-DJ_UWmGp.js → _layout.svelte-DYtClaIk.js} +4 -4
- package/studio-dist/server/chunks/{_page.svelte-WR6jUiQE.js → _page.svelte-1h9E6s_f.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-BUq8_eQH.js → _page.svelte-BNNF62Nm.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-CRnYa4cW.js → _page.svelte-BT1EUadj.js} +5 -5
- package/studio-dist/server/chunks/{_page.svelte-Dk0znswQ.js → _page.svelte-Bip079LT.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-CcP_KW3Y.js → _page.svelte-CEATWp_5.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-Ca7x-ZvH.js → _page.svelte-CV3xiD1y.js} +4 -4
- package/studio-dist/server/chunks/{_page.svelte-Cfv9tDBA.js → _page.svelte-Cv_KVJDV.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-J4HjPhfO.js → _page.svelte-DSSy6LuK.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-D8dLEr7O.js → _page.svelte-TF795TAS.js} +3 -3
- package/studio-dist/server/chunks/{_server.ts-Bih2-_5O.js → _server.ts-BlhRFLY3.js} +2 -2
- package/studio-dist/server/chunks/{_server.ts-Cr57EKWf.js → _server.ts-C4w6UdU0.js} +3 -3
- package/studio-dist/server/chunks/{_server.ts-P4wVVksg.js → _server.ts-CzrwbhkQ.js} +3 -3
- package/studio-dist/server/chunks/{_server.ts-2BazvYRP.js → _server.ts-DWt8Dziu.js} +3 -3
- package/studio-dist/server/chunks/{_server.ts-C0evMKCk.js → _server.ts-Db6mEile.js} +3 -3
- package/studio-dist/server/chunks/{client-Cl295FWH.js → client-D8f2k-H_.js} +2 -2
- package/studio-dist/server/chunks/{dist-CdoCt9zT.js → dist-B8xbIrdB.js} +3 -1
- package/studio-dist/server/chunks/{error.svelte-ajn1HNOb.js → error.svelte-DbbOwIme.js} +3 -3
- package/studio-dist/server/chunks/{http-BiQjEmVU.js → http-1ftNGTs5.js} +2 -2
- package/studio-dist/server/chunks/{internal-D9MtKHIF.js → internal-CTULuLPB.js} +2 -2
- package/studio-dist/server/chunks/{stores-BlknvZ80.js → stores-CS5XOReX.js} +2 -2
- package/studio-dist/server/index.js +1 -1
- package/studio-dist/server/manifest.js +17 -17
- package/studio-dist/client/_app/immutable/chunks/C3l-lTkq.js +0 -1
- package/studio-dist/client/_app/immutable/entry/start.D7gHmBNS.js +0 -1
- package/studio-dist/server/chunks/1-CTjj2MYz.js +0 -9
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const _installed = Symbol.for('cleocode.cli.sqliteWarningFilter');
|
|
3
|
+
if (globalThis[_installed]) return;
|
|
4
|
+
globalThis[_installed] = true;
|
|
5
|
+
const _origEmitWarning = process.emitWarning;
|
|
6
|
+
process.emitWarning = function(warning, type, code, ctor) {
|
|
7
|
+
if (typeof warning === 'object' && warning.name === 'ExperimentalWarning' && typeof warning.message === 'string' && /SQLite is an experimental feature/i.test(warning.message)) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (typeof warning === 'string' && /SQLite is an experimental feature/i.test(warning)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
return _origEmitWarning.call(process, warning, type, code, ctor);
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
|
|
17
|
+
// packages/cleo/src/cli/web-subsystem.ts
|
|
18
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
19
|
+
import { existsSync, statSync } from "node:fs";
|
|
20
|
+
import { mkdir, open, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
21
|
+
import { dirname, join, resolve } from "node:path";
|
|
22
|
+
import { fileURLToPath } from "node:url";
|
|
23
|
+
import { ExitCode } from "@cleocode/contracts";
|
|
24
|
+
import { CleoError, getCleoHome } from "@cleocode/core";
|
|
25
|
+
import { defineSubsystem } from "@cleocode/runtime/daemon";
|
|
26
|
+
var WEB_DEFAULT_PORT = 3456;
|
|
27
|
+
var WEB_DEFAULT_HOST = "127.0.0.1";
|
|
28
|
+
var WEB_SUBSYSTEM_NAME = "cleo-web";
|
|
29
|
+
var SIGTERM_GRACE_ITERATIONS = 60;
|
|
30
|
+
var STARTUP_POLL_ITERATIONS = 30;
|
|
31
|
+
function resolveStudioCheckout(moduleUrl) {
|
|
32
|
+
try {
|
|
33
|
+
const packageRoot = resolve(dirname(fileURLToPath(moduleUrl)), "..", "..");
|
|
34
|
+
const checkout = resolve(packageRoot, "..", "..");
|
|
35
|
+
if (packageRoot !== join(checkout, "packages", "cleo")) return void 0;
|
|
36
|
+
const markers = [
|
|
37
|
+
join(packageRoot, "src", "cli", "web-subsystem.ts"),
|
|
38
|
+
join(checkout, "pnpm-workspace.yaml"),
|
|
39
|
+
join(checkout, "build.mjs"),
|
|
40
|
+
join(checkout, "packages", "studio", "package.json"),
|
|
41
|
+
join(checkout, "packages", "studio", "src", "app.html")
|
|
42
|
+
];
|
|
43
|
+
return markers.every((path) => statSync(path).isFile()) ? checkout : void 0;
|
|
44
|
+
} catch {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function resolveStudioDir(moduleUrl = import.meta.url) {
|
|
49
|
+
const envOverride = process.env["CLEO_STUDIO_DIR"];
|
|
50
|
+
if (envOverride !== void 0 && envOverride.length > 0 && existsSync(join(envOverride, "index.js"))) {
|
|
51
|
+
return envOverride;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
const pkgRoot = resolve(dirname(fileURLToPath(moduleUrl)), "..", "..");
|
|
55
|
+
const bundled = join(pkgRoot, "studio-dist");
|
|
56
|
+
if (existsSync(join(bundled, "index.js"))) {
|
|
57
|
+
return bundled;
|
|
58
|
+
}
|
|
59
|
+
} catch {
|
|
60
|
+
}
|
|
61
|
+
const checkout = resolveStudioCheckout(moduleUrl);
|
|
62
|
+
if (checkout) {
|
|
63
|
+
const devPath = join(checkout, "packages", "studio", "build");
|
|
64
|
+
if (existsSync(join(devPath, "index.js"))) return devPath;
|
|
65
|
+
}
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
function resolveStudioStaticDir() {
|
|
69
|
+
const buildDir = resolveStudioDir();
|
|
70
|
+
if (buildDir === void 0) return void 0;
|
|
71
|
+
const clientDir = join(buildDir, "client");
|
|
72
|
+
return existsSync(clientDir) ? clientDir : void 0;
|
|
73
|
+
}
|
|
74
|
+
function getWebPaths() {
|
|
75
|
+
const cleoHome = getCleoHome();
|
|
76
|
+
return {
|
|
77
|
+
pidFile: join(cleoHome, "web-server.pid"),
|
|
78
|
+
configFile: join(cleoHome, "web-server.json"),
|
|
79
|
+
logDir: join(cleoHome, "logs"),
|
|
80
|
+
logFile: join(cleoHome, "logs", "web-server.log")
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function isWebProcessRunning(pid) {
|
|
84
|
+
try {
|
|
85
|
+
process.kill(pid, 0);
|
|
86
|
+
return true;
|
|
87
|
+
} catch {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function getWebStatus() {
|
|
92
|
+
const { pidFile, configFile } = getWebPaths();
|
|
93
|
+
try {
|
|
94
|
+
const pidStr = (await readFile(pidFile, "utf-8")).trim();
|
|
95
|
+
const pid = Number.parseInt(pidStr, 10);
|
|
96
|
+
if (Number.isNaN(pid) || !isWebProcessRunning(pid)) {
|
|
97
|
+
return { running: false, pid: null, port: null, host: null, url: null };
|
|
98
|
+
}
|
|
99
|
+
let port = WEB_DEFAULT_PORT;
|
|
100
|
+
let host = WEB_DEFAULT_HOST;
|
|
101
|
+
try {
|
|
102
|
+
const config = JSON.parse(await readFile(configFile, "utf-8"));
|
|
103
|
+
port = config.port ?? WEB_DEFAULT_PORT;
|
|
104
|
+
host = config.host ?? WEB_DEFAULT_HOST;
|
|
105
|
+
} catch {
|
|
106
|
+
}
|
|
107
|
+
return { running: true, pid, port, host, url: `http://${host}:${port}` };
|
|
108
|
+
} catch {
|
|
109
|
+
return { running: false, pid: null, port: null, host: null, url: null };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function createWebSubsystem(opts = {}, moduleUrl = import.meta.url) {
|
|
113
|
+
const port = opts.port ?? WEB_DEFAULT_PORT;
|
|
114
|
+
const host = opts.host ?? WEB_DEFAULT_HOST;
|
|
115
|
+
let live;
|
|
116
|
+
return defineSubsystem({
|
|
117
|
+
name: WEB_SUBSYSTEM_NAME,
|
|
118
|
+
async start() {
|
|
119
|
+
const { pidFile, configFile, logFile, logDir } = getWebPaths();
|
|
120
|
+
const existing = await getWebStatus();
|
|
121
|
+
if (existing.running && existing.pid !== null) {
|
|
122
|
+
const ctx2 = {
|
|
123
|
+
pid: existing.pid,
|
|
124
|
+
pidFile,
|
|
125
|
+
logFile,
|
|
126
|
+
port: existing.port ?? port,
|
|
127
|
+
host: existing.host ?? host
|
|
128
|
+
};
|
|
129
|
+
live = ctx2;
|
|
130
|
+
return ctx2;
|
|
131
|
+
}
|
|
132
|
+
const resolvedStudioDir = resolveStudioDir(moduleUrl);
|
|
133
|
+
const checkout = resolveStudioCheckout(moduleUrl);
|
|
134
|
+
const studioDir = resolvedStudioDir ?? (checkout ? join(checkout, "packages", "studio", "build") : void 0);
|
|
135
|
+
if (!studioDir) {
|
|
136
|
+
throw new CleoError(
|
|
137
|
+
ExitCode.NOT_FOUND,
|
|
138
|
+
"Packaged Studio bundle is missing its index.js entry. Reinstall a complete CLEO package or set CLEO_STUDIO_DIR to a built Studio bundle."
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
const webIndexPath = join(studioDir, "index.js");
|
|
142
|
+
await mkdir(logDir, { recursive: true });
|
|
143
|
+
await writeFile(
|
|
144
|
+
configFile,
|
|
145
|
+
JSON.stringify({ port, host, startedAt: (/* @__PURE__ */ new Date()).toISOString() })
|
|
146
|
+
);
|
|
147
|
+
try {
|
|
148
|
+
await stat(webIndexPath);
|
|
149
|
+
} catch {
|
|
150
|
+
if (!checkout || studioDir !== join(checkout, "packages", "studio", "build")) {
|
|
151
|
+
throw new CleoError(ExitCode.NOT_FOUND, `Studio entry is missing: ${webIndexPath}`);
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
execFileSync("pnpm", ["--filter", "@cleocode/studio", "run", "build"], {
|
|
155
|
+
cwd: checkout,
|
|
156
|
+
stdio: "ignore",
|
|
157
|
+
timeout: 12e4
|
|
158
|
+
});
|
|
159
|
+
} catch {
|
|
160
|
+
throw new Error(
|
|
161
|
+
`Studio build failed. Run: pnpm --filter @cleocode/studio run build
|
|
162
|
+
Logs: ${logFile}`
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
await stat(webIndexPath);
|
|
166
|
+
}
|
|
167
|
+
const logFileHandle = await open(logFile, "a");
|
|
168
|
+
const serverProcess = spawn("node", [webIndexPath], {
|
|
169
|
+
cwd: studioDir,
|
|
170
|
+
env: {
|
|
171
|
+
...process.env,
|
|
172
|
+
HOST: host,
|
|
173
|
+
PORT: String(port),
|
|
174
|
+
CLEO_ROOT: process.env["CLEO_ROOT"] ?? process.cwd()
|
|
175
|
+
},
|
|
176
|
+
detached: true,
|
|
177
|
+
stdio: ["ignore", logFileHandle.fd, logFileHandle.fd]
|
|
178
|
+
});
|
|
179
|
+
serverProcess.unref();
|
|
180
|
+
const pidFileTmp = `${pidFile}.tmp`;
|
|
181
|
+
await writeFile(pidFileTmp, String(serverProcess.pid));
|
|
182
|
+
await rm(pidFile, { force: true });
|
|
183
|
+
await writeFile(pidFile, String(serverProcess.pid));
|
|
184
|
+
await rm(pidFileTmp, { force: true });
|
|
185
|
+
await logFileHandle.close();
|
|
186
|
+
let started = false;
|
|
187
|
+
for (let i = 0; i < STARTUP_POLL_ITERATIONS; i++) {
|
|
188
|
+
try {
|
|
189
|
+
const response = await fetch(`http://${host}:${port}/api/health`);
|
|
190
|
+
if (response.ok) {
|
|
191
|
+
started = true;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
} catch {
|
|
195
|
+
}
|
|
196
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
197
|
+
}
|
|
198
|
+
if (!started) {
|
|
199
|
+
try {
|
|
200
|
+
process.kill(serverProcess.pid, "SIGTERM");
|
|
201
|
+
} catch {
|
|
202
|
+
}
|
|
203
|
+
await rm(pidFile, { force: true });
|
|
204
|
+
throw new Error("Studio web server failed to start within 15 seconds");
|
|
205
|
+
}
|
|
206
|
+
const ctx = {
|
|
207
|
+
pid: serverProcess.pid,
|
|
208
|
+
pidFile,
|
|
209
|
+
logFile,
|
|
210
|
+
port,
|
|
211
|
+
host
|
|
212
|
+
};
|
|
213
|
+
live = ctx;
|
|
214
|
+
return ctx;
|
|
215
|
+
},
|
|
216
|
+
healthProbe() {
|
|
217
|
+
if (live === void 0) {
|
|
218
|
+
const stopped = "stopped";
|
|
219
|
+
return {
|
|
220
|
+
child_id: WEB_SUBSYSTEM_NAME,
|
|
221
|
+
pid: 0,
|
|
222
|
+
state: stopped,
|
|
223
|
+
restart_count: 0,
|
|
224
|
+
detail: "not started"
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
const alive = isWebProcessRunning(live.pid);
|
|
228
|
+
const state = alive ? "running" : "stopped";
|
|
229
|
+
return {
|
|
230
|
+
child_id: WEB_SUBSYSTEM_NAME,
|
|
231
|
+
pid: alive ? live.pid : 0,
|
|
232
|
+
state,
|
|
233
|
+
restart_count: 0,
|
|
234
|
+
detail: alive ? `url=http://${live.host}:${live.port} pid=${live.pid}` : `pid=${live.pid} exited`
|
|
235
|
+
};
|
|
236
|
+
},
|
|
237
|
+
async shutdown(context) {
|
|
238
|
+
const { pidFile } = context;
|
|
239
|
+
if (!isWebProcessRunning(context.pid)) {
|
|
240
|
+
await rm(pidFile, { force: true });
|
|
241
|
+
live = void 0;
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
try {
|
|
245
|
+
if (process.platform === "win32") {
|
|
246
|
+
spawn("taskkill", ["/PID", String(context.pid), "/T"], { stdio: "ignore" });
|
|
247
|
+
} else {
|
|
248
|
+
process.kill(context.pid, "SIGTERM");
|
|
249
|
+
}
|
|
250
|
+
} catch {
|
|
251
|
+
}
|
|
252
|
+
for (let i = 0; i < SIGTERM_GRACE_ITERATIONS; i++) {
|
|
253
|
+
if (!isWebProcessRunning(context.pid)) break;
|
|
254
|
+
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
255
|
+
}
|
|
256
|
+
if (isWebProcessRunning(context.pid)) {
|
|
257
|
+
try {
|
|
258
|
+
if (process.platform === "win32") {
|
|
259
|
+
spawn("taskkill", ["/PID", String(context.pid), "/F", "/T"], { stdio: "ignore" });
|
|
260
|
+
} else {
|
|
261
|
+
process.kill(context.pid, "SIGKILL");
|
|
262
|
+
}
|
|
263
|
+
} catch {
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
await rm(pidFile, { force: true });
|
|
267
|
+
live = void 0;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export {
|
|
273
|
+
WEB_DEFAULT_PORT,
|
|
274
|
+
WEB_DEFAULT_HOST,
|
|
275
|
+
resolveStudioStaticDir,
|
|
276
|
+
getWebPaths,
|
|
277
|
+
getWebStatus,
|
|
278
|
+
createWebSubsystem
|
|
279
|
+
};
|
|
280
|
+
//# sourceMappingURL=chunk-GH37QXW5.js.map
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const _installed = Symbol.for('cleocode.cli.sqliteWarningFilter');
|
|
3
|
+
if (globalThis[_installed]) return;
|
|
4
|
+
globalThis[_installed] = true;
|
|
5
|
+
const _origEmitWarning = process.emitWarning;
|
|
6
|
+
process.emitWarning = function(warning, type, code, ctor) {
|
|
7
|
+
if (typeof warning === 'object' && warning.name === 'ExperimentalWarning' && typeof warning.message === 'string' && /SQLite is an experimental feature/i.test(warning.message)) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (typeof warning === 'string' && /SQLite is an experimental feature/i.test(warning)) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
return _origEmitWarning.call(process, warning, type, code, ctor);
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
|
|
17
|
+
// packages/cleo/src/cli/lib/readline-wizard-io.ts
|
|
18
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
19
|
+
import * as readline from "node:readline/promises";
|
|
20
|
+
import { Writable } from "node:stream";
|
|
21
|
+
import { WizardFatalError, WizardInterruptError } from "@cleocode/core/setup";
|
|
22
|
+
function stripBracketedPaste(raw) {
|
|
23
|
+
return raw.replace(/\x1b\[200~/g, "").replace(/\x1b\[201~/g, "").trim();
|
|
24
|
+
}
|
|
25
|
+
var SETUP_STDIN_CLOSED_CODE = "E_SETUP_STDIN_CLOSED";
|
|
26
|
+
var StdinClosedError = class _StdinClosedError extends WizardFatalError {
|
|
27
|
+
codeName = SETUP_STDIN_CLOSED_CODE;
|
|
28
|
+
constructor() {
|
|
29
|
+
super("stdin closed before section completed");
|
|
30
|
+
this.name = "StdinClosedError";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Type-guard so callers can identify this error without `instanceof`.
|
|
34
|
+
*
|
|
35
|
+
* @param err - Value caught from a `catch` block.
|
|
36
|
+
*/
|
|
37
|
+
static is(err) {
|
|
38
|
+
return err instanceof _StdinClosedError;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var SECRET_ECHO_REFUSED_MESSAGE = 'Refusing to read a secret: stdin is a terminal but terminal mode is off, so the key would be echoed. Pipe it instead: printf %s "$KEY" | cleo decide config --provider layahost --key-stdin (or cleo llm add <provider> --api-key-stdin).';
|
|
42
|
+
var SECRET_MASK_CHAR = "\u2022";
|
|
43
|
+
function streamIsTTY(stream) {
|
|
44
|
+
return "isTTY" in stream && stream.isTTY === true;
|
|
45
|
+
}
|
|
46
|
+
var MutableOutput = class extends Writable {
|
|
47
|
+
/** @param target - Stream that receives writes while unmuted. */
|
|
48
|
+
constructor(target) {
|
|
49
|
+
super();
|
|
50
|
+
this.target = target;
|
|
51
|
+
this.isTTY = "isTTY" in target && target.isTTY === true;
|
|
52
|
+
}
|
|
53
|
+
target;
|
|
54
|
+
/** When true, writes are dropped. */
|
|
55
|
+
muted = false;
|
|
56
|
+
/** Mirrors the wrapped stream: readline enables terminal mode (and echo) from it. */
|
|
57
|
+
isTTY;
|
|
58
|
+
/** Terminal width of the wrapped stream, when it reports one. */
|
|
59
|
+
get columns() {
|
|
60
|
+
return "columns" in this.target && typeof this.target.columns === "number" ? this.target.columns : void 0;
|
|
61
|
+
}
|
|
62
|
+
/** Forward a chunk unless muted. */
|
|
63
|
+
_write(chunk, encoding, callback) {
|
|
64
|
+
if (this.muted) {
|
|
65
|
+
callback();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const done = () => callback();
|
|
69
|
+
if (typeof chunk === "string") this.target.write(chunk, encoding, done);
|
|
70
|
+
else this.target.write(chunk, done);
|
|
71
|
+
}
|
|
72
|
+
/** Write straight to the wrapped stream, bypassing the mute. */
|
|
73
|
+
writeUnmuted(text) {
|
|
74
|
+
this.target.write(text);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var ReadlineWizardIO = class {
|
|
78
|
+
/**
|
|
79
|
+
* Underlying readline interface.
|
|
80
|
+
*
|
|
81
|
+
* Exposed as `protected` (not `private`) so tests can emit `'SIGINT'` on it
|
|
82
|
+
* to simulate Ctrl-C without requiring a real TTY. Production code MUST NOT
|
|
83
|
+
* access this field directly.
|
|
84
|
+
*
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
rl;
|
|
88
|
+
/** The stream readline echoes into; muted while a secret is typed. */
|
|
89
|
+
output;
|
|
90
|
+
/** Whether the input stream is a TTY (the terminal echoes unless readline owns it). */
|
|
91
|
+
inputIsTTY;
|
|
92
|
+
/** The input stream (its keypress events drive the secret mask). */
|
|
93
|
+
inStream;
|
|
94
|
+
/** AbortController aborted when stdin closes — surfaced as {@link StdinClosedError}. */
|
|
95
|
+
eofController;
|
|
96
|
+
/**
|
|
97
|
+
* Whether a SIGINT was received. Set before throwing so `rethrowEof` does
|
|
98
|
+
* not mistakenly wrap the AbortError as a `StdinClosedError`.
|
|
99
|
+
*/
|
|
100
|
+
sigintReceived = false;
|
|
101
|
+
/**
|
|
102
|
+
* Construct a readline interface bound to the supplied streams.
|
|
103
|
+
*
|
|
104
|
+
* The defaults (`process.stdin` / `process.stdout`) are correct for
|
|
105
|
+
* production use; tests inject in-memory streams.
|
|
106
|
+
*
|
|
107
|
+
* @param inStream - Input stream; defaults to `process.stdin`.
|
|
108
|
+
* @param outStream - Output stream passed to readline for terminal-echo
|
|
109
|
+
* purposes only; informational output goes to stderr. CLI commands pass
|
|
110
|
+
* `process.stderr` so prompts never reach a redirected stdout.
|
|
111
|
+
* @param options - See {@link ReadlineWizardIOOptions}; terminal mode
|
|
112
|
+
* defaults to the input stream's `isTTY`.
|
|
113
|
+
*/
|
|
114
|
+
constructor(inStream = input, outStream = output, options = {}) {
|
|
115
|
+
this.eofController = new AbortController();
|
|
116
|
+
this.output = new MutableOutput(outStream);
|
|
117
|
+
this.inStream = inStream;
|
|
118
|
+
this.inputIsTTY = streamIsTTY(inStream);
|
|
119
|
+
this.rl = readline.createInterface({
|
|
120
|
+
input: inStream,
|
|
121
|
+
output: this.output,
|
|
122
|
+
terminal: options.terminal ?? this.inputIsTTY,
|
|
123
|
+
// No history: a secret must never be recallable with Up-arrow.
|
|
124
|
+
historySize: 0
|
|
125
|
+
});
|
|
126
|
+
this.rl.on("close", () => {
|
|
127
|
+
if (!this.eofController.signal.aborted) {
|
|
128
|
+
this.eofController.abort(new StdinClosedError());
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
this.rl.on("SIGINT", () => {
|
|
132
|
+
this.sigintReceived = true;
|
|
133
|
+
if (!this.eofController.signal.aborted) {
|
|
134
|
+
this.eofController.abort(new WizardInterruptError("interrupted by user"));
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Release the underlying readline interface.
|
|
140
|
+
*
|
|
141
|
+
* Safe to call multiple times — `readline.Interface.close()` is
|
|
142
|
+
* idempotent.
|
|
143
|
+
*/
|
|
144
|
+
close() {
|
|
145
|
+
this.rl.close();
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Wrap an AbortError thrown by `rl.question()` into the appropriate
|
|
149
|
+
* typed error.
|
|
150
|
+
*
|
|
151
|
+
* - SIGINT received → throw {@link WizardInterruptError}
|
|
152
|
+
* - Stdin EOF → throw {@link StdinClosedError}
|
|
153
|
+
* - Any other error → re-throw as-is.
|
|
154
|
+
*
|
|
155
|
+
* @internal
|
|
156
|
+
*/
|
|
157
|
+
rethrowEof(err) {
|
|
158
|
+
if (err instanceof Error && (err.name === "AbortError" || err.name === "AbortSignal") && this.eofController.signal.aborted) {
|
|
159
|
+
if (this.sigintReceived) {
|
|
160
|
+
throw new WizardInterruptError("interrupted by user");
|
|
161
|
+
}
|
|
162
|
+
throw new StdinClosedError();
|
|
163
|
+
}
|
|
164
|
+
throw err;
|
|
165
|
+
}
|
|
166
|
+
async prompt(question) {
|
|
167
|
+
try {
|
|
168
|
+
const raw = await this.rl.question(`${question} `, {
|
|
169
|
+
signal: this.eofController.signal
|
|
170
|
+
});
|
|
171
|
+
return stripBracketedPaste(raw);
|
|
172
|
+
} catch (err) {
|
|
173
|
+
this.rethrowEof(err);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Ask for a secret without echoing it: the question is written, then the
|
|
178
|
+
* output stream is muted until the answer is submitted. Bracketed-paste
|
|
179
|
+
* markers are stripped like {@link prompt}. The answer is removed from
|
|
180
|
+
* readline's history afterwards.
|
|
181
|
+
*
|
|
182
|
+
* @param question - The question, e.g. `API key:`.
|
|
183
|
+
* @returns The trimmed answer; `''` when none was given.
|
|
184
|
+
* @throws Error with {@link SECRET_ECHO_REFUSED_MESSAGE} when stdin is a
|
|
185
|
+
* terminal but terminal mode is off (the terminal would echo the key).
|
|
186
|
+
* @task T12714
|
|
187
|
+
*/
|
|
188
|
+
async secret(question) {
|
|
189
|
+
if (this.inputIsTTY && !this.rl.terminal) throw new Error(SECRET_ECHO_REFUSED_MESSAGE);
|
|
190
|
+
this.output.writeUnmuted(`${question} `);
|
|
191
|
+
this.output.muted = true;
|
|
192
|
+
const stopMask = this.echoMask();
|
|
193
|
+
let raw;
|
|
194
|
+
try {
|
|
195
|
+
raw = await this.rl.question("", { signal: this.eofController.signal });
|
|
196
|
+
return stripBracketedPaste(raw);
|
|
197
|
+
} catch (err) {
|
|
198
|
+
return this.rethrowEof(err);
|
|
199
|
+
} finally {
|
|
200
|
+
stopMask();
|
|
201
|
+
this.output.muted = false;
|
|
202
|
+
this.output.writeUnmuted("\n");
|
|
203
|
+
if (raw !== void 0) this.scrubHistory(raw);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* While a secret is typed (readline's echo muted), echo one
|
|
208
|
+
* {@link SECRET_MASK_CHAR} per character in the line and erase one per
|
|
209
|
+
* deleted character. Runs after readline's own keypress handler (registered
|
|
210
|
+
* first), so `rl.line` is already updated; only its LENGTH is read. The
|
|
211
|
+
* submitting key (Enter) is ignored, since readline clears the line then.
|
|
212
|
+
*
|
|
213
|
+
* @returns A function that stops the echo.
|
|
214
|
+
*/
|
|
215
|
+
echoMask() {
|
|
216
|
+
if (!this.rl.terminal) return () => {
|
|
217
|
+
};
|
|
218
|
+
let shown = 0;
|
|
219
|
+
const onKeypress = (_str, key) => {
|
|
220
|
+
if (key?.name === "return" || key?.name === "enter") return;
|
|
221
|
+
const length = this.rl.line.length;
|
|
222
|
+
if (length > shown) this.output.writeUnmuted(SECRET_MASK_CHAR.repeat(length - shown));
|
|
223
|
+
else if (length < shown) this.output.writeUnmuted("\b \b".repeat(shown - length));
|
|
224
|
+
shown = length;
|
|
225
|
+
};
|
|
226
|
+
this.inStream.on("keypress", onKeypress);
|
|
227
|
+
return () => {
|
|
228
|
+
this.inStream.off("keypress", onKeypress);
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Remove every history entry equal to `line`. `history` is a runtime field
|
|
233
|
+
* of `readline.Interface` that `@types/node` does not declare, so it is
|
|
234
|
+
* read reflectively and checked before use.
|
|
235
|
+
*
|
|
236
|
+
* @param line - The exact line readline recorded.
|
|
237
|
+
*/
|
|
238
|
+
scrubHistory(line) {
|
|
239
|
+
const history = Reflect.get(this.rl, "history");
|
|
240
|
+
if (!Array.isArray(history)) return;
|
|
241
|
+
for (let i = history.length - 1; i >= 0; i--) {
|
|
242
|
+
if (history[i] === line) history.splice(i, 1);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
async confirm(question, defaultValue) {
|
|
246
|
+
const hint = defaultValue === void 0 ? "[y/n]" : defaultValue ? "[Y/n]" : "[y/N]";
|
|
247
|
+
let raw;
|
|
248
|
+
try {
|
|
249
|
+
raw = stripBracketedPaste(
|
|
250
|
+
await this.rl.question(`${question} ${hint} `, { signal: this.eofController.signal })
|
|
251
|
+
).toLowerCase();
|
|
252
|
+
} catch (err) {
|
|
253
|
+
this.rethrowEof(err);
|
|
254
|
+
}
|
|
255
|
+
if (raw === "") {
|
|
256
|
+
if (defaultValue === void 0) {
|
|
257
|
+
return this.confirm(question, defaultValue);
|
|
258
|
+
}
|
|
259
|
+
return defaultValue;
|
|
260
|
+
}
|
|
261
|
+
if (raw === "y" || raw === "yes") return true;
|
|
262
|
+
if (raw === "n" || raw === "no") return false;
|
|
263
|
+
return this.confirm(question, defaultValue);
|
|
264
|
+
}
|
|
265
|
+
async select(question, options) {
|
|
266
|
+
if (options.length === 0) {
|
|
267
|
+
throw new Error(`ReadlineWizardIO.select: option list is empty for '${question}'`);
|
|
268
|
+
}
|
|
269
|
+
process.stderr.write(`${question}
|
|
270
|
+
`);
|
|
271
|
+
options.forEach((opt, idx) => {
|
|
272
|
+
process.stderr.write(` ${idx + 1}) ${opt}
|
|
273
|
+
`);
|
|
274
|
+
});
|
|
275
|
+
const MAX_RETRIES = 10;
|
|
276
|
+
for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
|
|
277
|
+
let raw;
|
|
278
|
+
try {
|
|
279
|
+
raw = stripBracketedPaste(
|
|
280
|
+
await this.rl.question(`Choose [1-${options.length}]: `, {
|
|
281
|
+
signal: this.eofController.signal
|
|
282
|
+
})
|
|
283
|
+
);
|
|
284
|
+
} catch (err) {
|
|
285
|
+
this.rethrowEof(err);
|
|
286
|
+
}
|
|
287
|
+
if (/^\d+$/.test(raw)) {
|
|
288
|
+
const idx = Number.parseInt(raw, 10) - 1;
|
|
289
|
+
if (idx >= 0 && idx < options.length) return options[idx];
|
|
290
|
+
}
|
|
291
|
+
if (options.includes(raw)) return raw;
|
|
292
|
+
process.stderr.write(`Invalid choice '${raw}'. Try again.
|
|
293
|
+
`);
|
|
294
|
+
}
|
|
295
|
+
throw new Error(
|
|
296
|
+
`ReadlineWizardIO.select: gave up after ${MAX_RETRIES} invalid responses for '${question}'`
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
/** Informational message — goes to stderr, never stdout. */
|
|
300
|
+
info(message) {
|
|
301
|
+
process.stderr.write(`${message}
|
|
302
|
+
`);
|
|
303
|
+
}
|
|
304
|
+
/** Non-fatal warning — goes to stderr. */
|
|
305
|
+
warn(message) {
|
|
306
|
+
process.stderr.write(`${message}
|
|
307
|
+
`);
|
|
308
|
+
}
|
|
309
|
+
/** Error message — goes to stderr. */
|
|
310
|
+
error(message) {
|
|
311
|
+
process.stderr.write(`${message}
|
|
312
|
+
`);
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export {
|
|
317
|
+
StdinClosedError,
|
|
318
|
+
ReadlineWizardIO
|
|
319
|
+
};
|
|
320
|
+
//# sourceMappingURL=chunk-GZFVDR44.js.map
|