@voltro/cli 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1801 -0
- package/bin/nodeEnvironment.d.mts +30 -0
- package/bin/nodeEnvironment.mjs +158 -0
- package/bin/voltro.mjs +69 -5
- package/dist/addCommand-BNeoeSxe.js +124 -0
- package/dist/addCommand-aXSQveak.js +2 -0
- package/dist/agentsMd-BTchIZku.js +2 -0
- package/dist/agentsMd-mhQMF1bx.js +254 -0
- package/dist/apiBuild-BICVGnEC.js +2 -0
- package/dist/{apiBuild-h9VHtnlw.js → apiBuild-DZF_f0_I.js} +46 -46
- package/dist/appPort-B_HpJ_ck.js +48 -0
- package/dist/baselineCommand-C2ClWZN3.js +2 -0
- package/dist/baselineCommand-DIttzO8A.js +227 -0
- package/dist/bin.js +71 -28
- package/dist/build-CE7Ca9gm.js +711 -0
- package/dist/cacheCommand-DA4OH9xt.js +42 -0
- package/dist/capabilitiesCommand-nq_pz5xd.js +123 -0
- package/dist/checkCommand-Dv8r9tGO.js +231 -0
- package/dist/checkCommand-YZDmkAGd.js +2 -0
- package/dist/{cliArgs-qdZSElM3.js → cliArgs-D4p8n7EE.js} +12 -1
- package/dist/cliError-BmdYnghb.js +10 -0
- package/dist/cliOutput-D1tSBoRM.js +15 -0
- package/dist/{cliRuntime-Oh517vCV.js → cliRuntime-Dh7UDinH.js} +20 -20
- package/dist/cloudClient-DWL-Hw_T.js +67 -0
- package/dist/cloudCmd-Cvv5HGaZ.js +364 -0
- package/dist/clusterCmd-CNXKlcvD.js +54 -0
- package/dist/codegen-CYM3Zqrf.js +605 -0
- package/dist/codegen-ChBi_hVa.js +2 -0
- package/dist/codegenCommand-DC6w2tNZ.js +30 -0
- package/dist/codemodRunner-DRRqXR74.js +5243 -0
- package/dist/commandRunner-BLAEFLjp.js +47 -0
- package/dist/commands-gutsz-Ac.js +808 -0
- package/dist/connectionConfig-UFlIEiys.js +66 -0
- package/dist/dashboardCommand-3YG8p-UA.js +25 -0
- package/dist/dataCommand-qL0r7fPO.js +535 -0
- package/dist/dataProfile-dW-PsfLB.js +15 -0
- package/dist/{dbCommand-DTLKAfbA.js → dbCommand-B6X0FZbq.js} +551 -401
- package/dist/dbCommand-CpdKLeQq.js +2 -0
- package/dist/{dev-C_P8FLSx.js → dev-CerMd0mW.js} +3122 -3129
- package/dist/dev-CoG-ZPx8.js +3 -0
- package/dist/devActivity-Dx_3nnGv.js +100 -0
- package/dist/devActivity.js +1 -1
- package/dist/dialectDriver-CgXnDfec.js +39 -0
- package/dist/discover-C9XKJDco.js +25 -0
- package/dist/doctorCommand-BvqGBwNG.js +2 -0
- package/dist/{checkCommand-xGhRFFg2.js → doctorCommand-CnDXQxfa.js} +520 -1278
- package/dist/dormancyCommand-Dszo57d6.js +69 -0
- package/dist/e2eCmd-BRabZww-.js +147 -0
- package/dist/embeddingsCommand-C0sKVRo1.js +73 -0
- package/dist/envCommand-DPgdV1Bq.js +60 -0
- package/dist/evalCommand-6RUfPen4.js +118 -0
- package/dist/evolveCommand-DHpkgjgH.js +281 -0
- package/dist/fileTaxonomy-CJfgOllU.js +457 -0
- package/dist/frameworkTableAssembly-BGHmck-x.js +2 -0
- package/dist/{frameworkTableAssembly-BwIrO5nv.js → frameworkTableAssembly-DkkP6BgC.js} +184 -148
- package/dist/generateCommand-oibemh97.js +147 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +4 -3
- package/dist/infoCommand-BJw9nLUR.js +60 -0
- package/dist/{inspect-BUUjt773.js → inspect-CBqFtAKA.js} +82 -40
- package/dist/inspect-C_T_WGvl.js +2 -0
- package/dist/inspectCmd-Bppy-GGw.js +224 -0
- package/dist/inspectFetch-Cm8_wVvp.js +151 -0
- package/dist/inspectMetrics-CfdKLh6t.js +72 -0
- package/dist/loadEnv-D9nEOClM.js +44 -0
- package/dist/logFileSink-C_D2wRN1.js +105 -0
- package/dist/logsCmd-CCca3KRZ.js +260 -0
- package/dist/manifestBuild-ChsKAhmn.js +2 -0
- package/dist/{manifestBuild-BLrVuSlM.js → manifestBuild-sxpwdKY1.js} +1 -1
- package/dist/metaCommands-7MJfZ5cf.js +196 -0
- package/dist/migrate-CBwOt_iV.js +83 -0
- package/dist/mssqlClusterPatch-_4cE_nun.js +44 -0
- package/dist/newCommand-COWOJ1_E.js +156 -0
- package/dist/nodeEnvironment-cGFAj1J8.js +28 -0
- package/dist/packageCommand-Cug_3Ogl.js +271 -0
- package/dist/pageConvention-cEiRxdab.js +5 -0
- package/dist/privacyCommand-C-Df56U_.js +146 -0
- package/dist/projectScaffold-DmzEKHib.js +2 -0
- package/dist/projectScaffold-LMMtaavR.js +814 -0
- package/dist/renderModeScan-D7J1B7Kw.js +105 -0
- package/dist/renderProfile-1OWWAAtx.js +81 -0
- package/dist/runtimeRegistry-DMeKfTHP.js +81 -0
- package/dist/runtimeTrace-CRxalXTs.js +91 -0
- package/dist/scheduleCmd--jksTrf6.js +69 -0
- package/dist/scheduleManifestCmd-D2x0CTTY.js +249 -0
- package/dist/schemaIr-UJybUUZW.js +103 -0
- package/dist/{sdkgen-C81QIkiL.js → sdkgen-CYJscZC7.js} +111 -209
- package/dist/seedRunner-TFHHiToI.js +329 -0
- package/dist/serveCommand-B_isw7q4.js +1647 -0
- package/dist/serveCommand-DOvbgRnQ.js +2 -0
- package/dist/serveEntry.js +5 -5
- package/dist/serverlessCommand-CfJZy6dS.js +482 -0
- package/dist/start-9LiUOfES.js +1087 -0
- package/dist/start-B-9Nsp-S.js +3 -0
- package/dist/startEntry.js +2 -2
- package/dist/staticCommand-Dr2M6tpU.js +304 -0
- package/dist/storageCommand-Co6NfLqN.js +42 -0
- package/dist/templates-De8IR5-c.js +102 -0
- package/dist/test-CI6iDsYc.js +115 -0
- package/dist/tracesCmd-CkEZQrtt.js +232 -0
- package/dist/tsconfigPaths-BWXBWgcl.js +107 -0
- package/dist/tsxLoader-EuXmSJ1K.js +51 -0
- package/dist/typecheckCommand-BlsWiCNq.js +61 -0
- package/dist/updateCommand-Bkptutss.js +585 -0
- package/dist/updateCommand-us1_hdIC.js +2 -0
- package/dist/{inspectMetrics-1xzTKAFx.js → webDev-CBYvPqQr.js} +975 -1559
- package/dist/webDev-Cg-fFiyd2.js +2 -0
- package/dist/webhookDiscovery-CrGAfhIG.js +2 -0
- package/dist/webhookDiscovery-D7VaeMlz.js +51 -0
- package/dist/webhooksCommand-CID96Rga.js +267 -0
- package/dist/workflowsCmd-D1VTmLMY.js +608 -0
- package/package.json +179 -17
- package/templates/AGENTS.core.md +58 -3
- package/templates/AGENTS.md +64 -7
- package/templates/agent-docs/_index.md +6 -4
- package/templates/agent-docs/_manifest.json +22 -5
- package/templates/agent-docs/ai.md +370 -0
- package/templates/agent-docs/authentication.md +265 -31
- package/templates/agent-docs/caching.md +6 -0
- package/templates/agent-docs/cli.md +794 -50
- package/templates/agent-docs/data.md +550 -11
- package/templates/agent-docs/database/migrations.md +174 -25
- package/templates/agent-docs/database/misc.md +156 -40
- package/templates/agent-docs/database/querying.md +19 -1
- package/templates/agent-docs/database/scaling.md +60 -0
- package/templates/agent-docs/database/schema.md +1 -0
- package/templates/agent-docs/database/seedsdialects.md +208 -19
- package/templates/agent-docs/database/transactions.md +68 -0
- package/templates/agent-docs/deployment.md +69 -3
- package/templates/agent-docs/introduction.md +87 -16
- package/templates/agent-docs/local-first-mobile.md +79 -4
- package/templates/agent-docs/multi-tenancy.md +95 -20
- package/templates/agent-docs/observability.md +58 -3
- package/templates/agent-docs/plugins/ai-flows.md +161 -2
- package/templates/agent-docs/plugins/analytics-postgres.md +1 -1
- package/templates/agent-docs/plugins/audit.md +37 -1
- package/templates/agent-docs/plugins/auth-social.md +143 -0
- package/templates/agent-docs/plugins/auth-workos.md +4 -2
- package/templates/agent-docs/plugins/auth.md +131 -6
- package/templates/agent-docs/plugins/billing.md +132 -15
- package/templates/agent-docs/plugins/cdc-out.md +46 -7
- package/templates/agent-docs/plugins/clickhouse.md +1 -1
- package/templates/agent-docs/plugins/duckdb.md +1 -1
- package/templates/agent-docs/plugins/flags.md +132 -0
- package/templates/agent-docs/plugins/governance.md +105 -7
- package/templates/agent-docs/plugins/multitenancy.md +9 -4
- package/templates/agent-docs/plugins/presence.md +13 -2
- package/templates/agent-docs/plugins/ratelimit.md +9 -0
- package/templates/agent-docs/plugins/search.md +157 -6
- package/templates/agent-docs/plugins/sso-saml.md +47 -8
- package/templates/agent-docs/plugins/webhooks.md +105 -0
- package/templates/agent-docs/plugins.md +150 -18
- package/templates/agent-docs/reference.md +60 -3
- package/templates/agent-docs/releases.md +1117 -0
- package/templates/agent-docs/routing.md +43 -25
- package/templates/agent-docs/scheduling.md +10 -0
- package/templates/agent-docs/schema-driven-ui.md +92 -12
- package/templates/agent-docs/security.md +426 -0
- package/templates/agent-docs/templates/apibackends.md +87 -18
- package/templates/agent-docs/templates/appshells.md +32 -14
- package/templates/agent-docs/templates/overview.md +13 -8
- package/templates/agent-docs/testing.md +211 -14
- package/templates/agent-docs/whats-new.md +1700 -104
- package/templates/agent-docs/workflows.md +130 -14
- package/templates/apps/api-ai/actions/summarize.action.ts +11 -0
- package/templates/apps/api-ai/package.json +8 -7
- package/templates/apps/api-auth/actions/me.action.ts +13 -0
- package/templates/apps/api-auth/package.json +9 -8
- package/templates/apps/api-backend/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend/package.json +12 -8
- package/templates/apps/api-backend/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-deactivation/actions/users.get.action.ts +14 -0
- package/templates/apps/api-backend-deactivation/mutations/users.create.mutation.ts +8 -0
- package/templates/apps/api-backend-deactivation/mutations/users.deactivate.mutation.ts +10 -0
- package/templates/apps/api-backend-deactivation/package.json +8 -7
- package/templates/apps/api-backend-mail/actions/sendWelcome.action.ts +17 -0
- package/templates/apps/api-backend-mail/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-mail/package.json +9 -8
- package/templates/apps/api-backend-mail/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-mariadb/.env.example +14 -0
- package/templates/apps/api-backend-mariadb/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-mariadb/package.json +10 -9
- package/templates/apps/api-backend-mariadb/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-sqlite/.env.example +14 -0
- package/templates/apps/api-backend-sqlite/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-sqlite/package.json +9 -8
- package/templates/apps/api-backend-sqlite/queries/notes.query.ts +30 -8
- package/templates/apps/api-backend-storage/actions/uploadAvatar.action.ts +13 -0
- package/templates/apps/api-backend-storage/actions/uploadDocument.action.ts +12 -0
- package/templates/apps/api-backend-storage/mutations/notes.create.mutation.ts +9 -0
- package/templates/apps/api-backend-storage/package.json +9 -8
- package/templates/apps/api-backend-storage/queries/notes.query.ts +30 -8
- package/templates/apps/api-cms/actions/content.get.action.ts +7 -0
- package/templates/apps/api-cms/actions/content.types.action.ts +6 -0
- package/templates/apps/api-cms/actions/me.action.ts +13 -0
- package/templates/apps/api-cms/app.config.ts +19 -0
- package/templates/apps/api-cms/authz.ts +63 -0
- package/templates/apps/api-cms/mutations/content.publish.mutation.ts +10 -0
- package/templates/apps/api-cms/mutations/content.saveDraft.mutation.ts +10 -0
- package/templates/apps/api-cms/mutations/content.unpublish.mutation.ts +5 -0
- package/templates/apps/api-cms/package.json +11 -10
- package/templates/apps/api-cms/queries/content.list.query.ts +23 -7
- package/templates/apps/api-cms/tests/accessDecisions.test.ts +121 -0
- package/templates/apps/api-cms/tests/content.descriptors.test.ts +8 -4
- package/templates/apps/api-collab/mutations/documents.create.mutation.ts +8 -0
- package/templates/apps/api-collab/mutations/documents.setBody.mutation.ts +13 -0
- package/templates/apps/api-collab/package.json +9 -8
- package/templates/apps/api-collab/queries/documents.query.ts +19 -7
- package/templates/apps/api-data-advanced/package.json +9 -8
- package/templates/apps/api-data-advanced/queries/authors.withBooks.query.ts +12 -0
- package/templates/apps/api-data-advanced/queries/books.search.query.ts +9 -0
- package/templates/apps/api-durable/mutations/orders.approve.mutation.ts +17 -0
- package/templates/apps/api-durable/mutations/orders.place.mutation.ts +9 -0
- package/templates/apps/api-durable/package.json +9 -8
- package/templates/apps/api-feature-flags/actions/notes.export.action.ts +16 -0
- package/templates/apps/api-feature-flags/mutations/notes.create.mutation.ts +12 -0
- package/templates/apps/api-feature-flags/package.json +10 -9
- package/templates/apps/api-governance/README.md +30 -8
- package/templates/apps/api-governance/actions/profiles.get.action.server.ts +17 -1
- package/templates/apps/api-governance/actions/profiles.get.action.ts +29 -4
- package/templates/apps/api-governance/database/schema.ts +16 -4
- package/templates/apps/api-governance/mutations/profiles.create.mutation.ts +12 -0
- package/templates/apps/api-governance/package.json +9 -8
- package/templates/apps/api-kv/actions/sync.pull.action.ts +15 -0
- package/templates/apps/api-kv/actions/sync.reset.action.ts +13 -0
- package/templates/apps/api-kv/actions/sync.status.action.ts +7 -0
- package/templates/apps/api-kv/package.json +9 -8
- package/templates/apps/api-kv/queries/events.list.query.ts +19 -8
- package/templates/apps/api-moderation/mutations/comments.create.mutation.ts +11 -0
- package/templates/apps/api-moderation/mutations/posts.create.mutation.ts +13 -0
- package/templates/apps/api-moderation/package.json +9 -8
- package/templates/apps/api-observability/mutations/notes.create.mutation.ts +8 -0
- package/templates/apps/api-observability/package.json +9 -8
- package/templates/apps/api-observability/queries/notes.list.query.ts +13 -0
- package/templates/apps/api-ratelimit/mutations/notes.create.mutation.ts +14 -0
- package/templates/apps/api-ratelimit/package.json +9 -8
- package/templates/apps/api-rbac/package.json +9 -8
- package/templates/apps/api-rest/package.json +8 -7
- package/templates/apps/api-saas/mutations/projects.create.mutation.ts +13 -0
- package/templates/apps/api-saas/package.json +12 -11
- package/templates/apps/api-saas/queries/projects.list.query.ts +11 -0
- package/templates/apps/api-saas-starter/actions/me.action.ts +13 -0
- package/templates/apps/api-saas-starter/app.config.ts +19 -0
- package/templates/apps/api-saas-starter/authz.ts +75 -0
- package/templates/apps/api-saas-starter/mutations/invites.create.mutation.ts +10 -0
- package/templates/apps/api-saas-starter/mutations/projects.create.mutation.ts +9 -0
- package/templates/apps/api-saas-starter/package.json +15 -11
- package/templates/apps/api-saas-starter/queries/invites.list.query.ts +19 -8
- package/templates/apps/api-saas-starter/queries/projects.list.query.ts +18 -7
- package/templates/apps/api-saas-starter/tests/accessDecisions.test.ts +135 -0
- package/templates/apps/api-search/mutations/articles.create.mutation.ts +14 -0
- package/templates/apps/api-search/package.json +9 -8
- package/templates/apps/api-search/queries/articles.list.query.ts +21 -8
- package/templates/apps/api-status/README.md +10 -3
- package/templates/apps/api-status/app.config.ts +8 -3
- package/templates/apps/api-status/authz.ts +5 -3
- package/templates/apps/api-status/package.json +9 -8
- package/templates/apps/api-status/queries/components.list.query.ts +14 -6
- package/templates/apps/api-status/queries/incidents.live.query.ts +23 -10
- package/templates/apps/api-status/queries/updates.list.query.ts +16 -9
- package/templates/apps/api-status/tests/status.test.ts +9 -1
- package/templates/apps/api-versioning/actions/documents.asOf.action.ts +12 -0
- package/templates/apps/api-versioning/actions/documents.history.action.ts +13 -0
- package/templates/apps/api-versioning/mutations/documents.create.mutation.ts +9 -0
- package/templates/apps/api-versioning/mutations/documents.update.mutation.ts +12 -0
- package/templates/apps/api-versioning/package.json +9 -8
- package/templates/apps/api-webhooks/mutations/orders.fulfill.mutation.ts +16 -0
- package/templates/apps/api-webhooks/package.json +10 -9
- package/templates/apps/api-webhooks/queries/orders.list.query.ts +10 -0
- package/templates/apps/changelog/package.json +8 -6
- package/templates/apps/edge-functions/package.json +2 -2
- package/templates/apps/frontend-admin/package.json +10 -8
- package/templates/apps/frontend-admin/src/lib/admin.ts +20 -9
- package/templates/apps/frontend-admin/src/locales/de.ts +11 -1
- package/templates/apps/frontend-admin/src/locales/en.ts +13 -1
- package/templates/apps/frontend-admin/src/pages/admin/[entity]/page.tsx +65 -22
- package/templates/apps/frontend-admin/src/pages/admin/entity.test.tsx +130 -23
- package/templates/apps/frontend-admin/src/pages/admin/layout.tsx +3 -2
- package/templates/apps/frontend-admin/src/pages/admin/page.test.tsx +19 -2
- package/templates/apps/frontend-admin/src/pages/admin/page.tsx +9 -4
- package/templates/apps/frontend-app/app.config.ts +4 -3
- package/templates/apps/frontend-app/package.json +11 -8
- package/templates/apps/frontend-app/src/lib/api.ts +25 -0
- package/templates/apps/frontend-app/src/pages/page.test.tsx +130 -82
- package/templates/apps/frontend-app/src/pages/page.tsx +14 -18
- package/templates/apps/frontend-auth/package.json +10 -8
- package/templates/apps/frontend-blank/package.json +9 -7
- package/templates/apps/frontend-cms/package.json +11 -9
- package/templates/apps/frontend-collab/package.json +12 -9
- package/templates/apps/frontend-collab/src/pages/page.test.tsx +122 -78
- package/templates/apps/frontend-contact/package.json +9 -7
- package/templates/apps/frontend-dashboard/package.json +9 -7
- package/templates/apps/frontend-docs/package.json +9 -7
- package/templates/apps/frontend-i18n/package.json +8 -6
- package/templates/apps/frontend-landing/package.json +9 -7
- package/templates/apps/frontend-portal/package.json +10 -8
- package/templates/apps/frontend-saas/app.config.ts +10 -6
- package/templates/apps/frontend-saas/package.json +10 -8
- package/templates/apps/frontend-saas/src/lib/api.ts +27 -32
- package/templates/apps/frontend-saas/src/pages/dashboard/billing/page.tsx +7 -8
- package/templates/apps/frontend-saas/src/pages/dashboard/page.test.tsx +27 -3
- package/templates/apps/frontend-saas/src/pages/dashboard/page.tsx +4 -4
- package/templates/apps/frontend-saas/src/pages/dashboard/team/page.tsx +3 -4
- package/templates/apps/frontend-spa/package.json +9 -7
- package/templates/apps/frontend-ssr/package.json +9 -7
- package/templates/apps/frontend-ssr-api/package.json +10 -8
- package/templates/apps/frontend-static-blog/package.json +8 -6
- package/templates/apps/frontend-status/package.json +10 -8
- package/templates/apps/mobile-app/README.md +1 -0
- package/templates/apps/mobile-app/package.json +4 -2
- package/templates/apps/mobile-app/src/app/index.tsx +22 -12
- package/templates/apps/mobile-app/src/app/orders/[id].tsx +1 -1
- package/templates/apps/mobile-app/src/lib/api.ts +34 -0
- package/templates/apps/mobile-app/voltro.mobile.ts +4 -2
- package/templates/baselines/bare/.env.example +14 -0
- package/templates/baselines/bare/baseline.json +4 -4
- package/templates/baselines/compose/.env.example +14 -0
- package/templates/baselines/compose/README.md +1 -1
- package/templates/baselines/compose/baseline.json +5 -5
- package/templates/baselines/compose-mariadb/.env.example +14 -0
- package/templates/baselines/compose-mariadb/README.md +1 -1
- package/templates/baselines/compose-mariadb/baseline.json +5 -5
- package/templates/baselines/helm/.env.example +14 -0
- package/templates/baselines/helm/baseline.json +4 -4
- package/dist/apiBuild-C-x9YacA.js +0 -2
- package/dist/checkCommand-DRovTKza.js +0 -2
- package/dist/commands-CJfepbm4.js +0 -11541
- package/dist/dbCommand-b1gum4td.js +0 -2
- package/dist/dev-iiMtlkfs.js +0 -3
- package/dist/devActivity-BhIu6ncs.js +0 -159
- package/dist/frameworkTableAssembly-D-EebUQX.js +0 -2
- package/dist/inspect-mmBuRXmy.js +0 -2
- package/dist/manifestBuild-Dj8Jjoto.js +0 -2
- package/dist/seedRunner-Bqxgp7HZ.js +0 -230
- package/dist/serveCommand-DdaM4Hup.js +0 -1608
- package/dist/start-C0koT0UO.js +0 -1084
- /package/templates/apps/api-ai/actions/{summarize.action.server.tsx → summarize.action.server.ts} +0 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { a as e, t } from "./cliArgs-D4p8n7EE.js";
|
|
2
|
+
import { a as n, i as r, n as i, r as a, t as o } from "./cloudClient-DWL-Hw_T.js";
|
|
3
|
+
import { n as s } from "./cliOutput-D1tSBoRM.js";
|
|
4
|
+
import { d as c, f as l, o as u } from "./projectScaffold-LMMtaavR.js";
|
|
5
|
+
import { basename as d, join as f, resolve as p } from "node:path";
|
|
6
|
+
import { promises as m } from "node:fs";
|
|
7
|
+
import { ansi as h } from "@voltro/logger";
|
|
8
|
+
import { randomBytes as g } from "node:crypto";
|
|
9
|
+
import { execFile as _ } from "node:child_process";
|
|
10
|
+
import { createServer as v } from "node:http";
|
|
11
|
+
import { promisify as y } from "node:util";
|
|
12
|
+
//#region src/cloudCmd.ts
|
|
13
|
+
var b = y(_), x = async (e) => {
|
|
14
|
+
try {
|
|
15
|
+
return await b("git", [
|
|
16
|
+
"check-ignore",
|
|
17
|
+
"-q",
|
|
18
|
+
e
|
|
19
|
+
], { cwd: process.cwd() }), !0;
|
|
20
|
+
} catch {
|
|
21
|
+
return !1;
|
|
22
|
+
}
|
|
23
|
+
}, S = (e) => new Promise((t) => setTimeout(t, e)), C = () => {
|
|
24
|
+
console.log("voltro cloud — control-plane client (base url from VOLTRO_CLOUD_URL)"), console.log(""), console.log("Usage:"), console.log(" voltro cloud login [--token <t>] browser login via WorkOS (--token = headless)"), console.log(" voltro cloud whoami [--format json] current account"), console.log(" voltro cloud projects [--format json] list projects"), console.log(" voltro cloud project create <slug> [--name N] register a project (self-hosted; Free = 2)"), console.log(" voltro cloud project link <cloudSlug> bind this monorepo to an existing cloud project"), console.log(" voltro cloud env list [--project P] list project env vars"), console.log(" voltro cloud env set <KEY> <VALUE> [--project P]"), console.log(" voltro cloud env pull [--project P] write .env.cloud from project env"), console.log(" voltro cloud import scaffold voltro.cloud.toml from app.config.ts"), console.log(" voltro cloud deploy [--project P] [--app A] [--commit SHA]"), console.log(" deploy the project's production env (coming soon)"), console.log(" voltro cloud scan [--project P] [--dir D] push the repo's primitive inventory (metadata only)"), console.log(" voltro cloud rollback --app A [--project P] roll an app back to its previous deployment (coming soon)"), console.log(" voltro cloud register [--format json] fetch this org's signed license → .env.license");
|
|
25
|
+
}, w = async () => {
|
|
26
|
+
let e = await r();
|
|
27
|
+
return e === null ? (console.error("voltro cloud: not logged in — run `voltro cloud login` first"), null) : e.token;
|
|
28
|
+
}, T = e, E = [
|
|
29
|
+
"--token",
|
|
30
|
+
"--project",
|
|
31
|
+
"--app",
|
|
32
|
+
"--commit",
|
|
33
|
+
"--dir"
|
|
34
|
+
], D = (e) => {
|
|
35
|
+
let t = [], n = !1;
|
|
36
|
+
for (let r = 0; r < e.length; r++) {
|
|
37
|
+
if (e[r] === "--format") {
|
|
38
|
+
n = e[++r] === "json";
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (e[r] === "--json" || e[r] === "--format=json") {
|
|
42
|
+
n = !0;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
t.push(e[r]);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
json: n,
|
|
49
|
+
rest: t
|
|
50
|
+
};
|
|
51
|
+
}, O = (e, t) => {
|
|
52
|
+
s(t, { pretty: !e });
|
|
53
|
+
}, k = (e) => {
|
|
54
|
+
console.error(`${h.red("plan limit reached")} ${e}`), console.error(" → upgrade your plan in the Voltro Cloud dashboard to raise this limit, then retry.");
|
|
55
|
+
}, A = (e, t) => {
|
|
56
|
+
let n;
|
|
57
|
+
try {
|
|
58
|
+
n = new URL(e, "http://127.0.0.1");
|
|
59
|
+
} catch {
|
|
60
|
+
return {
|
|
61
|
+
ok: !1,
|
|
62
|
+
error: "malformed callback url"
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (n.pathname !== "/callback") return {
|
|
66
|
+
ok: !1,
|
|
67
|
+
error: `unexpected path ${n.pathname}`
|
|
68
|
+
};
|
|
69
|
+
let r = n.searchParams.get("error");
|
|
70
|
+
if (r !== null && r.length > 0) return {
|
|
71
|
+
ok: !1,
|
|
72
|
+
error: r
|
|
73
|
+
};
|
|
74
|
+
if (n.searchParams.get("state") !== t) return {
|
|
75
|
+
ok: !1,
|
|
76
|
+
error: "state mismatch (possible CSRF)"
|
|
77
|
+
};
|
|
78
|
+
let i = n.searchParams.get("token");
|
|
79
|
+
return i === null || i.length === 0 ? {
|
|
80
|
+
ok: !1,
|
|
81
|
+
error: "no token returned"
|
|
82
|
+
} : {
|
|
83
|
+
ok: !0,
|
|
84
|
+
token: i
|
|
85
|
+
};
|
|
86
|
+
}, j = (e) => {
|
|
87
|
+
let t = process.platform, n = t === "darwin" ? "open" : t === "win32" ? "cmd" : "xdg-open", r = t === "win32" ? [
|
|
88
|
+
"/c",
|
|
89
|
+
"start",
|
|
90
|
+
"",
|
|
91
|
+
e
|
|
92
|
+
] : [e];
|
|
93
|
+
try {
|
|
94
|
+
_(n, r, () => {});
|
|
95
|
+
} catch {}
|
|
96
|
+
}, M = "<!doctype html><meta charset=\"utf-8\"><title>Voltro — signed in</title><body style=\"font:16px/1.5 system-ui;margin:3rem;color:#111\"><h1>✓ Signed in</h1><p>You can close this tab and return to the CLI.</p></body>", N = "<!doctype html><meta charset=\"utf-8\"><title>Voltro — login failed</title><body style=\"font:16px/1.5 system-ui;margin:3rem;color:#111\"><h1>Login failed</h1><p>Return to the CLI for details.</p></body>", P = async (e = j) => {
|
|
97
|
+
let t = g(16).toString("hex"), r = v(), i = await new Promise((n) => {
|
|
98
|
+
let i = !1, a = (e) => {
|
|
99
|
+
i || (i = !0, n(e));
|
|
100
|
+
};
|
|
101
|
+
r.on("request", (e, n) => {
|
|
102
|
+
if ((e.url ?? "/").split("?")[0] !== "/callback") {
|
|
103
|
+
n.statusCode = 404, n.end("not found");
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
let r = A(e.url ?? "/", t);
|
|
107
|
+
n.statusCode = r.ok ? 200 : 400, n.setHeader("content-type", "text/html; charset=utf-8"), n.end(r.ok ? M : N), a(r);
|
|
108
|
+
}), r.on("error", (e) => a({
|
|
109
|
+
ok: !1,
|
|
110
|
+
error: e.message
|
|
111
|
+
})), r.listen(0, "127.0.0.1", () => {
|
|
112
|
+
let n = r.address(), i = `http://127.0.0.1:${typeof n == "object" && n ? n.port : 0}/callback`, a = `${o()}/auth/cli/login?redirect_uri=${encodeURIComponent(i)}&state=${t}`;
|
|
113
|
+
console.log("opening your browser to sign in via WorkOS…"), console.log(` if it does not open, visit:\n ${a}`), e(a);
|
|
114
|
+
});
|
|
115
|
+
let s = setTimeout(() => a({
|
|
116
|
+
ok: !1,
|
|
117
|
+
error: "timed out waiting for the browser login (5 min)"
|
|
118
|
+
}), 5 * 6e4);
|
|
119
|
+
typeof s.unref == "function" && s.unref();
|
|
120
|
+
});
|
|
121
|
+
return r.close(), r.closeAllConnections?.(), i.ok ? (await n({
|
|
122
|
+
token: i.token,
|
|
123
|
+
url: o(),
|
|
124
|
+
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
125
|
+
}), console.log(`${h.green("ok")} logged in — token saved to ${a()} (${o()})`), 0) : (console.error(`voltro cloud login: ${i.error}`), 1);
|
|
126
|
+
}, F = async (e) => {
|
|
127
|
+
let { value: t } = T(e, "--token"), r = t ?? process.env.VOLTRO_CLOUD_TOKEN;
|
|
128
|
+
return r !== void 0 && r.length > 0 ? (await n({
|
|
129
|
+
token: r,
|
|
130
|
+
url: o(),
|
|
131
|
+
savedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
132
|
+
}), console.log(`${h.green("ok")} token saved to ${a()} (${o()})`), 0) : P();
|
|
133
|
+
}, I = async (e) => {
|
|
134
|
+
let { json: t } = D(e), n = await w();
|
|
135
|
+
if (n === null) return 1;
|
|
136
|
+
let r = await i("/me", { token: n });
|
|
137
|
+
return r.kind === "err" ? (console.error(`voltro cloud whoami: ${r.error}`), 1) : (O(t, r.data), 0);
|
|
138
|
+
}, L = async (e) => {
|
|
139
|
+
let { json: t } = D(e), n = await w();
|
|
140
|
+
if (n === null) return 1;
|
|
141
|
+
let r = await i("/projects", { token: n });
|
|
142
|
+
return r.kind === "err" ? (console.error(`voltro cloud projects: ${r.error}`), 1) : (O(t, r.data), 0);
|
|
143
|
+
}, R = async (e) => {
|
|
144
|
+
let [t, ...n] = e, { json: r, rest: a } = D(n), o = await w();
|
|
145
|
+
if (o === null) return 1;
|
|
146
|
+
if (t === "create") {
|
|
147
|
+
let e = a[0];
|
|
148
|
+
if (e === void 0) return console.error("voltro cloud project create: usage `project create <slug> [--name N]`"), 2;
|
|
149
|
+
let { value: t } = T(a.slice(1), "--name"), n = await i("/projects", {
|
|
150
|
+
method: "POST",
|
|
151
|
+
token: o,
|
|
152
|
+
body: {
|
|
153
|
+
slug: e,
|
|
154
|
+
...t === void 0 ? {} : { name: t }
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
if (n.kind === "err") return n.status === 402 ? (k(n.error), 1) : (console.error(`voltro cloud project create: ${n.error}`), 1);
|
|
158
|
+
if (r) return O(!0, n.data), 0;
|
|
159
|
+
let s = n.data;
|
|
160
|
+
return console.log(`${h.green("registered")} project ${s.slug ?? e} (${s.id ?? "?"})`), 0;
|
|
161
|
+
}
|
|
162
|
+
if (t === "link") {
|
|
163
|
+
let e = a[0];
|
|
164
|
+
if (e === void 0) return console.error("voltro cloud project link: usage `project link <cloudSlug>`"), 2;
|
|
165
|
+
let t = await i("/projects", { token: o });
|
|
166
|
+
if (t.kind === "err") return console.error(`voltro cloud project link: ${t.error}`), 1;
|
|
167
|
+
let n = t.data, r = (Array.isArray(n) ? n : typeof n == "object" && n && Array.isArray(n.projects) ? n.projects : []).find((t) => t.slug === e);
|
|
168
|
+
if (r === void 0) return console.error(`voltro cloud project link: no cloud project '${e}' in this org — create it first (dashboard or \`project create ${e}\`)`), 1;
|
|
169
|
+
let s = await u(e, r.id === void 0 ? void 0 : { projectId: r.id });
|
|
170
|
+
if (!s.ok) return console.error(`voltro cloud project link: ${s.error}`), 1;
|
|
171
|
+
console.log(`${h.green("linked")} local project '${s.projectName}' → cloud project '${e}'`);
|
|
172
|
+
let l = await c(s.projectDir, e);
|
|
173
|
+
return console.log(` ${l.kind === "registered" ? "✓" : "⚠"} ${l.message}`), 0;
|
|
174
|
+
}
|
|
175
|
+
if (t === "list" || t === void 0) {
|
|
176
|
+
let e = await i("/projects", { token: o });
|
|
177
|
+
return e.kind === "err" ? (console.error(`voltro cloud project list: ${e.error}`), 1) : (O(r, e.data), 0);
|
|
178
|
+
}
|
|
179
|
+
return console.error(`voltro cloud project: unknown verb '${t}' (create | list | link)`), 2;
|
|
180
|
+
}, z = (e) => {
|
|
181
|
+
let { value: t, rest: n } = T(e, "--project");
|
|
182
|
+
return {
|
|
183
|
+
project: t ?? d(process.cwd()),
|
|
184
|
+
rest: n
|
|
185
|
+
};
|
|
186
|
+
}, B = async (e) => {
|
|
187
|
+
let [t, ...n] = e, { json: r, rest: a } = D(n), { project: o, rest: s } = z(a), c = await w();
|
|
188
|
+
if (c === null) return 1;
|
|
189
|
+
if (t === "list" || t === void 0) {
|
|
190
|
+
let e = await i(`/projects/${encodeURIComponent(o)}/env`, { token: c });
|
|
191
|
+
return e.kind === "err" ? (console.error(`voltro cloud env list: ${e.error}`), 1) : (O(r, e.data), 0);
|
|
192
|
+
}
|
|
193
|
+
if (t === "set") {
|
|
194
|
+
let e = s[0], t = s[1];
|
|
195
|
+
if (e === void 0 || t === void 0) return console.error("voltro cloud env set: usage `env set <KEY> <VALUE>`"), 2;
|
|
196
|
+
let n = await i(`/projects/${encodeURIComponent(o)}/env/${encodeURIComponent(e)}`, {
|
|
197
|
+
method: "PUT",
|
|
198
|
+
token: c,
|
|
199
|
+
body: { value: t }
|
|
200
|
+
});
|
|
201
|
+
return n.kind === "err" ? (console.error(`voltro cloud env set: ${n.error}`), 1) : (console.log(`${h.green("ok")} set ${e} on ${o}`), 0);
|
|
202
|
+
}
|
|
203
|
+
if (t === "pull") {
|
|
204
|
+
let e = await i(`/projects/${encodeURIComponent(o)}/env`, { token: c });
|
|
205
|
+
if (e.kind === "err") return console.error(`voltro cloud env pull: ${e.error}`), 1;
|
|
206
|
+
let t = e.data?.env ?? e.data ?? {}, n = Object.entries(t).filter(([, e]) => typeof e == "string").map(([e, t]) => `${e}=${String(t)}`), r = f(process.cwd(), ".env.cloud");
|
|
207
|
+
return await m.writeFile(r, n.join("\n") + (n.length > 0 ? "\n" : ""), {
|
|
208
|
+
encoding: "utf8",
|
|
209
|
+
mode: 384
|
|
210
|
+
}), await m.chmod(r, 384).catch(() => {}), console.log(`${h.green("ok")} wrote ${n.length} vars to ${r}`), await x(r) || console.error(`${h.red("warning")} .env.cloud is NOT gitignored — it contains production secrets. Add it to .gitignore before committing.`), 0;
|
|
211
|
+
}
|
|
212
|
+
return console.error(`voltro cloud env: unknown verb '${t}' (list | set | pull)`), 2;
|
|
213
|
+
}, V = async (e) => {
|
|
214
|
+
let n = p(t(e, E) ?? process.cwd()), r = f(n, "app.config.ts"), i = d(n), a = "api";
|
|
215
|
+
try {
|
|
216
|
+
let e = await m.readFile(r, "utf8"), t = e.match(/name\s*:\s*['"]([^'"]+)['"]/), n = e.match(/type\s*:\s*['"]([^'"]+)['"]/);
|
|
217
|
+
t?.[1] && (i = t[1]), n?.[1] && (a = n[1]);
|
|
218
|
+
} catch {
|
|
219
|
+
console.error(`voltro cloud import: no app.config.ts at ${r} — using directory defaults`);
|
|
220
|
+
}
|
|
221
|
+
let o = f(n, "voltro.cloud.toml");
|
|
222
|
+
try {
|
|
223
|
+
return await m.access(o), console.error(`voltro cloud import: ${o} already exists — refusing to overwrite`), 1;
|
|
224
|
+
} catch {}
|
|
225
|
+
let s = `# voltro.cloud.toml — generated by \`voltro cloud import\`.
|
|
226
|
+
# Describes how this app deploys to the framework cloud control-plane.
|
|
227
|
+
|
|
228
|
+
[project]
|
|
229
|
+
name = "${i}"
|
|
230
|
+
type = "${a}"
|
|
231
|
+
|
|
232
|
+
[deploy]
|
|
233
|
+
# Target region + replica count. Tune before \`voltro cloud deploy\`.
|
|
234
|
+
region = "auto"
|
|
235
|
+
replicas = 1
|
|
236
|
+
|
|
237
|
+
[env]
|
|
238
|
+
# Project env-var names resolved from the control-plane at deploy time.
|
|
239
|
+
# Use \`voltro cloud env set <KEY> <VALUE>\` to populate them.
|
|
240
|
+
`;
|
|
241
|
+
return await m.writeFile(o, s, "utf8"), console.log(`${h.green("ok")} wrote ${o} (project '${i}', type '${a}')`), 0;
|
|
242
|
+
}, H = async () => {
|
|
243
|
+
try {
|
|
244
|
+
let { stdout: e } = await b("git", ["rev-parse", "HEAD"]), t = e.trim();
|
|
245
|
+
return /^[0-9a-f]{40}$/.test(t) ? t : null;
|
|
246
|
+
} catch {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
}, U = /* @__PURE__ */ new Set([
|
|
250
|
+
"ready",
|
|
251
|
+
"failed",
|
|
252
|
+
"superseded",
|
|
253
|
+
"rolled_back"
|
|
254
|
+
]), W = "control-plane deploy pipeline pending — not yet available", G = () => process.env.VOLTRO_CLOUD_DEPLOY_ENABLED === "1", K = async (e) => {
|
|
255
|
+
if (!G()) return console.error(W), 1;
|
|
256
|
+
let { json: t, rest: n } = D(e), { project: r, rest: a } = z(n), { value: o, rest: s } = T(a, "--app"), { value: c } = T(s, "--commit"), l = await w();
|
|
257
|
+
if (l === null) return 1;
|
|
258
|
+
let u = c ?? await H();
|
|
259
|
+
if (u === null) return console.error("voltro cloud deploy: no commit — run inside a git repo or pass --commit <sha>"), 1;
|
|
260
|
+
let d = await i(`/projects/${encodeURIComponent(r)}/deploy`, {
|
|
261
|
+
method: "POST",
|
|
262
|
+
token: l,
|
|
263
|
+
body: {
|
|
264
|
+
commitSha: u,
|
|
265
|
+
...o === void 0 ? {} : { appId: o }
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
if (d.kind === "err") return console.error(`voltro cloud deploy: ${d.error}`), 1;
|
|
269
|
+
let f = d.data.deploymentId;
|
|
270
|
+
if (typeof f != "string") return console.error("voltro cloud deploy: unexpected response from the control plane"), 1;
|
|
271
|
+
console.log(`${h.green("queued")} ${f} · ${r} @ ${u.slice(0, 8)}`);
|
|
272
|
+
let p = Date.now() + 15 * 6e4, m = "";
|
|
273
|
+
for (; Date.now() < p;) {
|
|
274
|
+
await S(3e3);
|
|
275
|
+
let e = await i(`/deployments/${encodeURIComponent(f)}`, { token: l });
|
|
276
|
+
if (e.kind === "err") return console.error(`voltro cloud deploy: status check failed: ${e.error}`), 1;
|
|
277
|
+
let n = e.data.status, r = typeof n == "string" ? n : "unknown";
|
|
278
|
+
if (r !== m && (console.log(` ${r}`), m = r), U.has(r)) {
|
|
279
|
+
t && O(!0, e.data);
|
|
280
|
+
let n = r === "ready" || r === "superseded";
|
|
281
|
+
return console.log(n ? `${h.green("done")} ${r}` : `${h.red("failed")} ${r}`), +!n;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return console.error("voltro cloud deploy: timed out waiting for the deployment to finish"), 1;
|
|
285
|
+
}, q = async (e) => {
|
|
286
|
+
let { json: t, rest: n } = D(e), { value: r, rest: a } = T(n, "--dir"), { project: o } = z(a), s = await w();
|
|
287
|
+
if (s === null) return 1;
|
|
288
|
+
let c = p(r ?? process.cwd()), u = await l(c, await H());
|
|
289
|
+
if (u.apps.length === 0) return console.error(`voltro cloud scan: no apps (no app.config.ts found under ${c})`), 1;
|
|
290
|
+
let d = JSON.stringify(u);
|
|
291
|
+
if (/\bimport\s|\bexport\s|=>|function\s/.test(d)) return console.error("voltro cloud scan: refusing to send — payload looks like it contains source, not metadata"), 1;
|
|
292
|
+
let f = await i(`/projects/${encodeURIComponent(o)}/inventory`, {
|
|
293
|
+
method: "POST",
|
|
294
|
+
token: s,
|
|
295
|
+
body: u
|
|
296
|
+
});
|
|
297
|
+
if (f.kind === "err") return console.error(`voltro cloud scan: ${f.error}`), 1;
|
|
298
|
+
if (t) return O(!0, f.data), 0;
|
|
299
|
+
let m = f.data;
|
|
300
|
+
for (let e of u.apps) {
|
|
301
|
+
let t = m.apps?.find((t) => t.slug === e.slug), n = t?.created ? h.green("registered") : h.green("updated");
|
|
302
|
+
console.log(` ${n} ${e.slug} (${e.kind}) · ${t?.primitiveCount ?? 0} primitives · voltro ${e.voltroVersion ?? "unknown"}`);
|
|
303
|
+
}
|
|
304
|
+
return console.log(`${h.green("ok")} scanned ${u.apps.length} app(s) into ${o}`), 0;
|
|
305
|
+
}, J = async (e) => {
|
|
306
|
+
if (!G()) return console.error(W), 1;
|
|
307
|
+
let { json: t, rest: n } = D(e), { project: r, rest: a } = z(n), { value: o } = T(a, "--app");
|
|
308
|
+
if (o === void 0) return console.error("voltro cloud rollback: --app <appId> is required (the app to roll back)"), 2;
|
|
309
|
+
let s = await w();
|
|
310
|
+
if (s === null) return 1;
|
|
311
|
+
let c = await i(`/projects/${encodeURIComponent(r)}/rollback`, {
|
|
312
|
+
method: "POST",
|
|
313
|
+
token: s,
|
|
314
|
+
body: { appId: o }
|
|
315
|
+
});
|
|
316
|
+
if (c.kind === "err") return console.error(`voltro cloud rollback: ${c.error}`), 1;
|
|
317
|
+
let l = c.data.deploymentId, u = c.data.rolledBackTo;
|
|
318
|
+
if (typeof l != "string") return console.error("voltro cloud rollback: unexpected response from the control plane"), 1;
|
|
319
|
+
console.log(`${h.green("queued")} ${l} · rollback ${o} → ${String(u).slice(0, 12)}`);
|
|
320
|
+
let d = Date.now() + 15 * 6e4, f = "";
|
|
321
|
+
for (; Date.now() < d;) {
|
|
322
|
+
await S(3e3);
|
|
323
|
+
let e = await i(`/deployments/${encodeURIComponent(l)}`, { token: s });
|
|
324
|
+
if (e.kind === "err") return console.error(`voltro cloud rollback: status check failed: ${e.error}`), 1;
|
|
325
|
+
let n = typeof e.data.status == "string" ? e.data.status : "unknown";
|
|
326
|
+
if (n !== f && (console.log(` ${n}`), f = n), U.has(n)) {
|
|
327
|
+
t && O(!0, e.data);
|
|
328
|
+
let r = n === "ready" || n === "superseded";
|
|
329
|
+
return console.log(r ? `${h.green("done")} ${n}` : `${h.red("failed")} ${n}`), +!r;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return console.error("voltro cloud rollback: timed out waiting for the rollback to finish"), 1;
|
|
333
|
+
}, Y = async (e) => {
|
|
334
|
+
let { json: t } = D(e), n = await w();
|
|
335
|
+
if (n === null) return 1;
|
|
336
|
+
let r = await i("/licenses", { token: n });
|
|
337
|
+
if (r.kind === "err") {
|
|
338
|
+
let e = r.status === 404 ? " (no active license for this org — issue one first)" : "";
|
|
339
|
+
return console.error(`voltro cloud register: ${r.error}${e}`), 1;
|
|
340
|
+
}
|
|
341
|
+
let a = r.data, o = a?.token;
|
|
342
|
+
if (typeof o != "string" || o.length === 0) return console.error("voltro cloud register: response carried no license token"), 1;
|
|
343
|
+
if (t) return O(!0, a), 0;
|
|
344
|
+
let s = f(process.cwd(), ".env.license");
|
|
345
|
+
return await m.writeFile(s, `VOLTRO_LICENSE_KEY=${o}\n`, "utf8"), console.log(`${h.green("ok")} license (${a?.edition ?? "?"}, exp ${a?.expiresAt ?? "?"}) → ${s}`), console.log(" load VOLTRO_LICENSE_KEY from it, plus VOLTRO_LICENSE_PUBLIC_KEY (the verify key), in your app env"), 0;
|
|
346
|
+
}, X = async (e) => {
|
|
347
|
+
let [t, ...n] = e;
|
|
348
|
+
if (t === void 0 || t === "--help" || t === "-h" || t === "help") return C(), 0;
|
|
349
|
+
switch (t) {
|
|
350
|
+
case "login": return F(n);
|
|
351
|
+
case "whoami": return I(n);
|
|
352
|
+
case "projects": return L(n);
|
|
353
|
+
case "project": return R(n);
|
|
354
|
+
case "env": return B(n);
|
|
355
|
+
case "import": return V(n);
|
|
356
|
+
case "deploy": return K(n);
|
|
357
|
+
case "rollback": return J(n);
|
|
358
|
+
case "scan": return q(n);
|
|
359
|
+
case "register": return Y(n);
|
|
360
|
+
default: return console.error(`voltro cloud: unknown subcommand '${t}'`), C(), 2;
|
|
361
|
+
}
|
|
362
|
+
};
|
|
363
|
+
//#endregion
|
|
364
|
+
export { X as runCloudCommand };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { n as e } from "./cliOutput-D1tSBoRM.js";
|
|
2
|
+
import { n as t, o as n, r, t as i } from "./inspectFetch-Cm8_wVvp.js";
|
|
3
|
+
import { ansi as a } from "@voltro/logger";
|
|
4
|
+
//#region src/clusterCmd.ts
|
|
5
|
+
var o = () => {
|
|
6
|
+
console.log("voltro cluster — clustering snapshot of every running api"), console.log(""), console.log("Usage:"), console.log(" voltro cluster status [--process NAME] [--format pretty|json]"), console.log(""), console.log("Examples:"), console.log(" voltro cluster status"), console.log(" voltro cluster status --format json | jq '.instances[]'");
|
|
7
|
+
}, s = async (t, r, a) => {
|
|
8
|
+
let o = await n(t, a);
|
|
9
|
+
if (o.length === 0) return console.error(t === void 0 ? "voltro cluster: no live api processes found (start one with `voltro dev`)" : `voltro cluster: no live api named '${t}'`), 1;
|
|
10
|
+
let s = await Promise.all(o.map((e) => i(e, "/_voltro/inspect/cluster"))), l = [], u = [];
|
|
11
|
+
for (let e of s) e.kind === "ok" ? l.push({
|
|
12
|
+
...e.data,
|
|
13
|
+
process: e.name
|
|
14
|
+
}) : u.push({
|
|
15
|
+
name: e.name,
|
|
16
|
+
error: e.error
|
|
17
|
+
});
|
|
18
|
+
return r === "json" ? (e(u.length > 0 ? {
|
|
19
|
+
instances: l,
|
|
20
|
+
fetchErrors: u
|
|
21
|
+
} : { instances: l }, { pretty: !1 }), +!!s.every((e) => e.kind === "err")) : c(l, u, s);
|
|
22
|
+
}, c = (e, t, n) => {
|
|
23
|
+
if (e.length > 0) {
|
|
24
|
+
console.log(a.bold("cluster instances")), console.log("");
|
|
25
|
+
for (let t of e) {
|
|
26
|
+
let e = t.instance, n = e.runnerStorage === "none" ? a.dim("—") : `${e.runnerHost}:${e.runnerPort}`, r = e.tier === "full" ? a.green(e.tier) : e.tier === "inline-only" ? a.yellow(e.tier) : a.dim(e.tier);
|
|
27
|
+
console.log(` ${a.bold(e.replicaId)} ${a.dim(`@${t.process}`)}`), console.log(` dialect ${e.dialect} (${r})`);
|
|
28
|
+
let i = e.shardLock === "row" ? a.green(e.shardLock) : a.dim(e.shardLock);
|
|
29
|
+
console.log(` runner ${n} ${a.dim(`storage=${e.runnerStorage}`)} ${a.dim("shard-lock=")}${i}`), console.log(` coordination ${e.coordination}`), console.log(` cdc ${e.cdc.enabled ? a.green("on") : a.dim("off")} ${a.dim(e.cdc.flavor)}`), e.serverId !== void 0 && console.log(` server_id ${e.serverId}`), e.localhostRisk && console.log(` ${a.red("⚠ localhost runner")} ${a.red("SQL cluster storage on a loopback host — cross-pod workflow resume will silently break. Inject POD_IP / set VOLTRO_WORKFLOW_RUNNER_HOST.")}`), console.log("");
|
|
30
|
+
}
|
|
31
|
+
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map(), r = 0, i = 0, o;
|
|
32
|
+
for (let a of e) {
|
|
33
|
+
let e = a.coordinationState;
|
|
34
|
+
for (let n of e.recentReplicaIds) t.add(n);
|
|
35
|
+
for (let t of e.scheduleClaims) n.set(t.claimKey, {
|
|
36
|
+
replicaId: t.replicaId,
|
|
37
|
+
claimedAt: t.claimedAt
|
|
38
|
+
});
|
|
39
|
+
r = Math.max(r, e.runningScheduleRuns), i = Math.max(i, e.runningWorkflowRuns), e.runners !== void 0 && (o = e.runners);
|
|
40
|
+
}
|
|
41
|
+
console.log(a.bold("shared coordination state")), console.log(` active replicas (recent runs) ${t.size > 0 ? [...t].join(", ") : a.dim("none")}`), console.log(` schedule claims ${n.size}`), console.log(` running schedule runs ${r}`), console.log(` running workflow runs ${i}`), o !== void 0 && console.log(` cluster runners (fleet) ${o.length > 0 ? o.map((e) => e.address).join(", ") : a.dim("none")}`);
|
|
42
|
+
}
|
|
43
|
+
for (let e of t) console.error(a.dim(`# fetch failed: ${e.name}: ${e.error}`));
|
|
44
|
+
return +!!n.every((e) => e.kind === "err");
|
|
45
|
+
}, l = async (e) => {
|
|
46
|
+
let [n, ...i] = e;
|
|
47
|
+
if (n === void 0 || n === "--help" || n === "-h" || n === "help") return o(), 0;
|
|
48
|
+
let a = t(i);
|
|
49
|
+
if ("error" in a) return console.error(`voltro cluster: ${a.error}`), 2;
|
|
50
|
+
let { process: c, target: l, rest: u } = r(a.rest), d = a.format;
|
|
51
|
+
return n === "status" ? u.length > 0 ? (console.error(`voltro cluster status: unexpected argument '${u[0]}'`), 2) : s(c, d, l) : (console.error(`voltro cluster: unknown subcommand '${n}'`), o(), 2);
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { l as runClusterCommand };
|