@voltro/cli 0.33.0 → 0.35.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 +1968 -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-B8aoJvuw.js +2 -0
- package/dist/{apiBuild-h9VHtnlw.js → apiBuild-DYD_ONLD.js} +46 -46
- package/dist/{appGraph-gQ_6GkQQ.js → appGraph-KGDPTuTy.js} +1 -1
- package/dist/appGraph-zuMGKVYX.js +2 -0
- 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-CD8K4XOr.js +711 -0
- package/dist/cacheCommand-DA4OH9xt.js +42 -0
- package/dist/capabilitiesCommand-nq_pz5xd.js +123 -0
- package/dist/checkCommand-Ct9xkTrS.js +232 -0
- package/dist/checkCommand-DKpDLlqu.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-D5wsCmA_.js +54 -0
- package/dist/codegen-CYM3Zqrf.js +605 -0
- package/dist/codegen-ChBi_hVa.js +2 -0
- package/dist/codegenCommand-C4YoQIc2.js +30 -0
- package/dist/codemodRunner-BnFq3Fgu.js +5384 -0
- package/dist/commandRunner-BLAEFLjp.js +47 -0
- package/dist/commands-BE8E7zF3.js +816 -0
- package/dist/connectionConfig-UFlIEiys.js +66 -0
- package/dist/dashboardCommand-D7SgZGaN.js +25 -0
- package/dist/dataCommand-BhYwDgg-.js +537 -0
- package/dist/dataProfile-dW-PsfLB.js +15 -0
- package/dist/dbCommand-DS4b97Is.js +2 -0
- package/dist/{dbCommand-DTLKAfbA.js → dbCommand-O8HA63s2.js} +552 -402
- package/dist/{dev-C_P8FLSx.js → dev-C7sFZq3m.js} +3670 -3169
- package/dist/dev-D2BikO7a.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-CM4Ch9C7.js +2 -0
- package/dist/{checkCommand-xGhRFFg2.js → doctorCommand-DnimF5IM.js} +523 -1278
- package/dist/dormancyCommand-QewYug_s.js +69 -0
- package/dist/e2eCmd-BRabZww-.js +147 -0
- package/dist/embeddingsCommand-BfiLS_QI.js +73 -0
- package/dist/envCommand-CCGPRQY1.js +60 -0
- package/dist/evalCommand-6RUfPen4.js +118 -0
- package/dist/evolveCommand-CHsLCtDf.js +281 -0
- package/dist/fileTaxonomy-CJfgOllU.js +457 -0
- package/dist/frameworkTableAssembly-YyVe32Cb.js +2 -0
- package/dist/frameworkTableAssembly-oMPBKqlE.js +511 -0
- package/dist/generateCommand-DbgcUpGw.js +147 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +4 -3
- package/dist/infoCommand-DwOgK1t6.js +60 -0
- package/dist/{inspect-BUUjt773.js → inspect-CjTYzAs_.js} +113 -41
- package/dist/inspect-P4pxoMaV.js +2 -0
- package/dist/inspectCmd-EHFZ9yYu.js +224 -0
- package/dist/inspectFetch-EMuhTG_9.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-D36xK7Zu.js +260 -0
- package/dist/manifestBuild-COkJoyAr.js +2 -0
- package/dist/{manifestBuild-BLrVuSlM.js → manifestBuild-hpPLaGxV.js} +1 -1
- package/dist/metaCommands-7MJfZ5cf.js +196 -0
- package/dist/migrate-BV7I-ZHZ.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/probeCommand-CZfaaUOZ.js +122 -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-CH3eUiMw.js +91 -0
- package/dist/scheduleCmd-DQRu6BZC.js +149 -0
- package/dist/scheduleManifestCmd-D2x0CTTY.js +249 -0
- package/dist/schemaIr-UJybUUZW.js +103 -0
- package/dist/{sdkgen-C81QIkiL.js → sdkgen-BLkvGRfX.js} +111 -209
- package/dist/seedRunner-ZmLSqNe2.js +333 -0
- package/dist/serveCommand-CbDHU6l-.js +2 -0
- package/dist/serveCommand-iwlUBNS1.js +1766 -0
- package/dist/serveEntry.js +5 -5
- package/dist/serverlessCommand-CfJZy6dS.js +482 -0
- package/dist/start-BgN62boB.js +3 -0
- package/dist/start-T4VesWiM.js +1087 -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-DStmCJPi.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-BlMZhWgO.js +2 -0
- package/dist/updateCommand-x0pI_x-B.js +585 -0
- package/dist/webDev-BcykISYQ2.js +2 -0
- package/dist/{inspectMetrics-1xzTKAFx.js → webDev-Dybxew86.js} +988 -1560
- package/dist/webhookDiscovery-CrGAfhIG.js +2 -0
- package/dist/webhookDiscovery-D7VaeMlz.js +51 -0
- package/dist/webhooksCommand-DlAgS2Iw.js +267 -0
- package/dist/workflowsCmd-BGF-mRZ5.js +608 -0
- package/package.json +209 -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 +23 -6
- package/templates/agent-docs/ai.md +370 -0
- package/templates/agent-docs/authentication.md +313 -31
- package/templates/agent-docs/caching.md +6 -0
- package/templates/agent-docs/cli.md +853 -50
- package/templates/agent-docs/data.md +608 -12
- package/templates/agent-docs/database/migrations.md +223 -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 +284 -25
- package/templates/agent-docs/introduction.md +88 -17
- package/templates/agent-docs/local-first-mobile.md +79 -4
- package/templates/agent-docs/multi-tenancy.md +188 -42
- package/templates/agent-docs/observability.md +58 -3
- package/templates/agent-docs/plugins/ai-flows.md +247 -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 +32 -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 +162 -8
- package/templates/agent-docs/plugins/sso-saml.md +47 -8
- package/templates/agent-docs/plugins/storage.md +11 -0
- package/templates/agent-docs/plugins/webhooks.md +105 -0
- package/templates/agent-docs/plugins.md +152 -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 +27 -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 +98 -136
- package/templates/agent-docs/workflows.md +231 -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/appGraph-CvQCte0z.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-BwIrO5nv.js +0 -638
- 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,42 @@
|
|
|
1
|
+
import { Effect as e, ManagedRuntime as t } from "effect";
|
|
2
|
+
import { Cache as n, CacheLayer as r } from "@voltro/cache";
|
|
3
|
+
//#region src/cacheCommand.ts
|
|
4
|
+
var i = (e) => {
|
|
5
|
+
if (!e) return "<no url>";
|
|
6
|
+
try {
|
|
7
|
+
let t = new URL(e);
|
|
8
|
+
return t.password &&= "***", t.toString();
|
|
9
|
+
} catch {
|
|
10
|
+
return e;
|
|
11
|
+
}
|
|
12
|
+
}, a = () => {
|
|
13
|
+
console.error("usage: voltro cache <status | flush | invalidate <tag>>");
|
|
14
|
+
}, o = async (o) => {
|
|
15
|
+
let [s, ...c] = o;
|
|
16
|
+
if (s === void 0) return a(), 1;
|
|
17
|
+
let l = (process.env.CACHE_BACKEND ?? "memory").toLowerCase();
|
|
18
|
+
if (l !== "redis" && (s === "flush" || s === "invalidate")) return console.error(`voltro cache ${s}: CACHE_BACKEND=${l} is per-process — the CLI cannot reach the dev server's in-memory cache.`), console.error(" Use CACHE_BACKEND=redis (a shared backend) to flush/invalidate from the CLI."), 1;
|
|
19
|
+
let u = t.make(r.layer);
|
|
20
|
+
try {
|
|
21
|
+
switch (s) {
|
|
22
|
+
case "status": {
|
|
23
|
+
let t = process.env.CACHE_REDIS_DRIVER ?? "resp", r = i(process.env.CACHE_REDIS_URL ?? process.env.REDIS_URL);
|
|
24
|
+
return console.log(l === "redis" ? `cache backend: redis (driver ${t}, ${r})` : "cache backend: memory — in-process, not shared across instances"), await u.runPromise(e.flatMap(n, (e) => e.has("__voltro_cache_probe__"))), console.log("connectivity: ok"), 0;
|
|
25
|
+
}
|
|
26
|
+
case "flush": return await u.runPromise(e.flatMap(n, (e) => e.clear())), console.log("cache flushed"), 0;
|
|
27
|
+
case "invalidate": {
|
|
28
|
+
let t = c[0];
|
|
29
|
+
if (t === void 0) return console.error("usage: voltro cache invalidate <tag>"), 1;
|
|
30
|
+
let r = await u.runPromise(e.flatMap(n, (e) => e.invalidateTag(t)));
|
|
31
|
+
return console.log(`invalidated tag '${t}': ${r} keys dropped`), 0;
|
|
32
|
+
}
|
|
33
|
+
default: return a(), 2;
|
|
34
|
+
}
|
|
35
|
+
} catch (e) {
|
|
36
|
+
return console.error(`voltro cache ${s} failed:`, e instanceof Error ? e.message : String(e)), 1;
|
|
37
|
+
} finally {
|
|
38
|
+
await u.dispose();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { o as runCacheCommand };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { n as e, r as t, t as n } from "./cliOutput-D1tSBoRM.js";
|
|
2
|
+
import { join as r, resolve as i } from "node:path";
|
|
3
|
+
import { existsSync as a, readFileSync as o, readdirSync as s, statSync as c } from "node:fs";
|
|
4
|
+
//#region src/capabilitiesCommand.ts
|
|
5
|
+
var l = (e, t) => t ? "type" : e.startsWith("define") ? "primitive" : /^use[A-Z]/.test(e) ? "hook" : /^[A-Z]/.test(e) ? "component" : "value", u = (e) => {
|
|
6
|
+
let t = /* @__PURE__ */ new Map(), n = (e, n) => {
|
|
7
|
+
(!t.has(e) || !n) && t.set(e, n);
|
|
8
|
+
};
|
|
9
|
+
for (let t of e.matchAll(/^export\s+declare\s+(?:const|function|class|abstract class)\s+([A-Za-z_$][\w$]*)/gm)) n(t[1], !1);
|
|
10
|
+
for (let t of e.matchAll(/^export\s+(?:declare\s+)?(?:type|interface)\s+([A-Za-z_$][\w$]*)/gm)) n(t[1], !0);
|
|
11
|
+
for (let t of e.matchAll(/^export\s*\{([^}]*)\}/gm)) for (let e of t[1].split(",")) {
|
|
12
|
+
let t = e.trim();
|
|
13
|
+
if (t === "") continue;
|
|
14
|
+
let r = t.startsWith("type "), i = t.replace(/^type\s+/, "").split(/\s+as\s+/), a = (i[1] ?? i[0] ?? "").trim();
|
|
15
|
+
/^[A-Za-z_$][\w$]*$/.test(a) && a !== "default" && n(a, r);
|
|
16
|
+
}
|
|
17
|
+
return [...t].map(([e, t]) => ({
|
|
18
|
+
name: e,
|
|
19
|
+
isType: t
|
|
20
|
+
})).sort((e, t) => e.name < t.name ? -1 : +(e.name > t.name));
|
|
21
|
+
}, d = (e) => {
|
|
22
|
+
let t = [r(e, "dist"), e], n = [];
|
|
23
|
+
for (let e of t) {
|
|
24
|
+
if (!a(e)) continue;
|
|
25
|
+
let t;
|
|
26
|
+
try {
|
|
27
|
+
t = s(e);
|
|
28
|
+
} catch {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
for (let i of t) if (i.endsWith(".d.ts")) try {
|
|
32
|
+
n.push(o(r(e, i), "utf8"));
|
|
33
|
+
} catch {}
|
|
34
|
+
if (n.length > 0) break;
|
|
35
|
+
}
|
|
36
|
+
return n.join("\n");
|
|
37
|
+
}, f = (e) => {
|
|
38
|
+
let t = [];
|
|
39
|
+
for (let n of ["AGENTS.md", "CLAUDE.md"]) {
|
|
40
|
+
let i = r(e, n);
|
|
41
|
+
if (a(i)) try {
|
|
42
|
+
t.push(o(i, "utf8"));
|
|
43
|
+
} catch {}
|
|
44
|
+
}
|
|
45
|
+
let n = [r(e, "agent-docs"), r(e, "node_modules", "@voltro", "cli", "templates", "agent-docs")];
|
|
46
|
+
for (let e of n) if (a(e)) {
|
|
47
|
+
try {
|
|
48
|
+
for (let n of s(e)) n.endsWith(".md") && t.push(o(r(e, n), "utf8"));
|
|
49
|
+
} catch {}
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
return t.join("\n");
|
|
53
|
+
}, p = (e) => {
|
|
54
|
+
let t = r(e, "node_modules", "@voltro"), n = f(e), i = [], a = [], p = [];
|
|
55
|
+
try {
|
|
56
|
+
p = s(t).filter((e) => {
|
|
57
|
+
try {
|
|
58
|
+
return c(r(t, e)).isDirectory();
|
|
59
|
+
} catch {
|
|
60
|
+
return !1;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
} catch {
|
|
64
|
+
return {
|
|
65
|
+
voltroPackages: 0,
|
|
66
|
+
totalSymbols: 0,
|
|
67
|
+
undocumented: [],
|
|
68
|
+
packages: []
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
for (let e of [...p].sort()) {
|
|
72
|
+
let s = r(t, e), c = "unknown";
|
|
73
|
+
try {
|
|
74
|
+
c = JSON.parse(o(r(s, "package.json"), "utf8")).version ?? "unknown";
|
|
75
|
+
} catch {}
|
|
76
|
+
let f = u(d(s)).map(({ name: t, isType: r }) => {
|
|
77
|
+
let i = l(t, r), o = n.length > 0 && n.includes(t);
|
|
78
|
+
return !o && (i === "primitive" || i === "hook") && a.push(`@voltro/${e}: ${t}`), {
|
|
79
|
+
name: t,
|
|
80
|
+
kind: i,
|
|
81
|
+
documented: o
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
f.length > 0 && i.push({
|
|
85
|
+
name: `@voltro/${e}`,
|
|
86
|
+
version: c,
|
|
87
|
+
symbols: f
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
voltroPackages: i.length,
|
|
92
|
+
totalSymbols: i.reduce((e, t) => e + t.symbols.length, 0),
|
|
93
|
+
undocumented: a,
|
|
94
|
+
packages: i
|
|
95
|
+
};
|
|
96
|
+
}, m = [
|
|
97
|
+
"primitive",
|
|
98
|
+
"hook",
|
|
99
|
+
"component",
|
|
100
|
+
"value",
|
|
101
|
+
"type"
|
|
102
|
+
], h = async (r) => {
|
|
103
|
+
let a = t(r);
|
|
104
|
+
a && n();
|
|
105
|
+
let o = i(r.find((e) => !e.startsWith("-")) ?? process.cwd()), s = p(o);
|
|
106
|
+
if (a) return e(s), 0;
|
|
107
|
+
if (s.voltroPackages === 0) return console.log(`voltro capabilities — no @voltro packages found under ${o}/node_modules.`), console.log(" Run this from an app root with dependencies installed."), 0;
|
|
108
|
+
console.log(`voltro capabilities — ${s.totalSymbols} exported symbols across ${s.voltroPackages} packages`);
|
|
109
|
+
for (let e of s.packages) {
|
|
110
|
+
let t = m.map((t) => [t, e.symbols.filter((e) => e.kind === t).length]).filter(([, e]) => e > 0).map(([e, t]) => `${t} ${e}${t === 1 ? "" : "s"}`).join(", ");
|
|
111
|
+
console.log(` ${e.name}@${e.version} — ${t}`);
|
|
112
|
+
let n = e.symbols.filter((e) => e.kind === "primitive" || e.kind === "hook");
|
|
113
|
+
n.length > 0 && console.log(` ${n.map((e) => e.name + (e.documented ? "" : " *")).join(", ")}`);
|
|
114
|
+
}
|
|
115
|
+
if (s.undocumented.length > 0) {
|
|
116
|
+
console.log(""), console.log(` * ${s.undocumented.length} primitive(s)/hook(s) appear nowhere in this project's agent guide:`);
|
|
117
|
+
for (let e of s.undocumented) console.log(` ${e}`);
|
|
118
|
+
console.log(" Run `voltro agents-md --force` to refresh it, or read that package README.");
|
|
119
|
+
}
|
|
120
|
+
return console.log(""), console.log(" --json emits the full machine-readable surface (every symbol, kind, and documented flag)."), 0;
|
|
121
|
+
};
|
|
122
|
+
//#endregion
|
|
123
|
+
export { h as runCapabilitiesCommand };
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { t as e } from "./cliArgs-D4p8n7EE.js";
|
|
2
|
+
import { c as t, i as n } from "./codegen-CYM3Zqrf.js";
|
|
3
|
+
import { r } from "./appGraph-KGDPTuTy.js";
|
|
4
|
+
import { n as i } from "./cliOutput-D1tSBoRM.js";
|
|
5
|
+
import { n as a, o, r as s, t as c } from "./inspectFetch-EMuhTG_9.js";
|
|
6
|
+
import { r as l } from "./fileTaxonomy-CJfgOllU.js";
|
|
7
|
+
import { x as u } from "./doctorCommand-DnimF5IM.js";
|
|
8
|
+
import { resolve as d } from "node:path";
|
|
9
|
+
import { readdirSync as f, statSync as p } from "node:fs";
|
|
10
|
+
//#region src/observedDiff.ts
|
|
11
|
+
var m = (e) => e === void 0 ? [] : typeof e == "string" ? [e] : e, h = /* @__PURE__ */ new Set([
|
|
12
|
+
"insert",
|
|
13
|
+
"update",
|
|
14
|
+
"delete",
|
|
15
|
+
"upsert"
|
|
16
|
+
]), g = (e, t) => {
|
|
17
|
+
let n = [], r = new Set(t.exercised), i = /* @__PURE__ */ new Map();
|
|
18
|
+
for (let e of t.edges) {
|
|
19
|
+
let t = i.get(e.tag);
|
|
20
|
+
t === void 0 ? i.set(e.tag, [e]) : t.push(e);
|
|
21
|
+
}
|
|
22
|
+
let a = [], o = [];
|
|
23
|
+
for (let t of e) {
|
|
24
|
+
if (!r.has(t.tag)) {
|
|
25
|
+
a.push(t.tag);
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
let e = `${t.kind}(${t.tag})`, s = t.file, c = i.get(t.tag) ?? [], l = new Set(m(t.source)), u = new Map((t.targets ?? []).map((e) => [e.table, e.op]));
|
|
29
|
+
for (let t of c) if (h.has(t.op)) {
|
|
30
|
+
let r = u.get(t.table);
|
|
31
|
+
r === void 0 ? n.push({
|
|
32
|
+
rule: "observed/undeclared-write",
|
|
33
|
+
node: e,
|
|
34
|
+
...s === void 0 ? {} : { file: s },
|
|
35
|
+
breaks: [`writes '${t.table}' (${t.op}) but declares no target for it`, "subscriptions on that table are not invalidated by this mutation"],
|
|
36
|
+
fix: `add { table: '${t.table}', op: '${t.op}' } to this procedure's targets`,
|
|
37
|
+
severity: "warn"
|
|
38
|
+
}) : r !== t.op && n.push({
|
|
39
|
+
rule: "observed/wrong-op",
|
|
40
|
+
node: e,
|
|
41
|
+
...s === void 0 ? {} : { file: s },
|
|
42
|
+
breaks: [`declares op '${r}' on '${t.table}' but performed '${t.op}'`, "the synthesized optimistic patch has the wrong shape"],
|
|
43
|
+
fix: `change the target op for '${t.table}' to '${t.op}'`,
|
|
44
|
+
severity: "warn"
|
|
45
|
+
});
|
|
46
|
+
} else !l.has(t.table) && !u.has(t.table) && n.push({
|
|
47
|
+
rule: "observed/undeclared-read",
|
|
48
|
+
node: e,
|
|
49
|
+
...s === void 0 ? {} : { file: s },
|
|
50
|
+
breaks: [`reads '${t.table}' but declares no source for it`],
|
|
51
|
+
fix: `add '${t.table}' to this procedure's source`,
|
|
52
|
+
severity: "warn"
|
|
53
|
+
});
|
|
54
|
+
if (c.length === 0) {
|
|
55
|
+
o.push(t.tag);
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
let d = new Set(c.map((e) => e.table));
|
|
59
|
+
for (let t of l) d.has(t) || n.push({
|
|
60
|
+
rule: "observed/declared-but-unobserved",
|
|
61
|
+
node: e,
|
|
62
|
+
...s === void 0 ? {} : { file: s },
|
|
63
|
+
breaks: [`declares source '${t}' but never read it while running`],
|
|
64
|
+
fix: `remove '${t}' from source, or check whether the handler still reads it`,
|
|
65
|
+
severity: "warn"
|
|
66
|
+
});
|
|
67
|
+
for (let [t] of u) d.has(t) || n.push({
|
|
68
|
+
rule: "observed/declared-but-unobserved",
|
|
69
|
+
node: e,
|
|
70
|
+
...s === void 0 ? {} : { file: s },
|
|
71
|
+
breaks: [`declares target '${t}' but never wrote it while running`],
|
|
72
|
+
fix: `remove the '${t}' target, or check whether the handler still writes it`,
|
|
73
|
+
severity: "warn"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
diagnostics: n,
|
|
78
|
+
unexercised: a.sort(),
|
|
79
|
+
unobservedReads: o.sort(),
|
|
80
|
+
coverage: {
|
|
81
|
+
exercised: e.length - a.length - o.length,
|
|
82
|
+
total: e.length
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}, _ = (e, t = [], r = 0) => {
|
|
86
|
+
if (r > 12) return t;
|
|
87
|
+
let i;
|
|
88
|
+
try {
|
|
89
|
+
i = f(e);
|
|
90
|
+
} catch {
|
|
91
|
+
return t;
|
|
92
|
+
}
|
|
93
|
+
for (let a of i) {
|
|
94
|
+
if ([
|
|
95
|
+
"node_modules",
|
|
96
|
+
"dist",
|
|
97
|
+
"build",
|
|
98
|
+
".framework",
|
|
99
|
+
".turbo",
|
|
100
|
+
".git",
|
|
101
|
+
"coverage"
|
|
102
|
+
].includes(a)) continue;
|
|
103
|
+
let i = `${e}/${a}`, o;
|
|
104
|
+
try {
|
|
105
|
+
o = p(i);
|
|
106
|
+
} catch {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
o.isDirectory() ? _(i, t, r + 1) : o.isFile() && n.test(a) && t.push(i);
|
|
110
|
+
}
|
|
111
|
+
return t;
|
|
112
|
+
}, v = /* @__PURE__ */ new Set(["actors", "tenants"]), y = async (e) => {
|
|
113
|
+
try {
|
|
114
|
+
let { readFile: t } = await import("node:fs/promises"), { join: n } = await import("node:path"), r = await t(n(e, "app.graph.observed.generated.json"), "utf8"), i = JSON.parse(r);
|
|
115
|
+
return i?.version !== 1 || !Array.isArray(i.edges) || !Array.isArray(i.exercised) ? null : i;
|
|
116
|
+
} catch {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
}, b = (e) => {
|
|
120
|
+
let { exercised: t, total: n } = e.coverage, r = `\nobserved: ${t}/${n} procedures exercised (${n === 0 ? 0 : Math.round(t / n * 100)}%)`;
|
|
121
|
+
if (e.diagnostics.length === 0) return `${r}\n no declared/observed mismatches${e.unexercised.length > 0 ? `\n ${e.unexercised.length} unexercised — no recording, so nothing is claimed about them` : ""}`;
|
|
122
|
+
let i = e.diagnostics.map((e) => ` ${e.node}${e.file === void 0 ? "" : ` (${e.file})`}\n` + e.breaks.map((e) => ` ${e}`).join("\n") + `\n fix: ${e.fix}`), a = e.unexercised.length > 0 ? `\n ${e.unexercised.length} unexercised — no recording, so nothing is claimed about them` : "";
|
|
123
|
+
return `${r}\n${i.join("\n")}${a}`;
|
|
124
|
+
}, x = (e, t) => ({
|
|
125
|
+
tables: (t.tables ?? []).map((e) => e.name),
|
|
126
|
+
frameworkOwnedTables: (t.tables ?? []).filter((e) => e.framework === !0 || e.name.startsWith("_voltro_") || v.has(e.name)).map((e) => e.name),
|
|
127
|
+
scopes: e.scopes ?? [],
|
|
128
|
+
procedures: (e.procedures ?? []).map((e) => {
|
|
129
|
+
let t = (e.guards ?? []).flatMap((e) => e.kind === "scope" ? e.scope ?? [] : []), n = (e.guards ?? []).find((e) => e.kind === "open")?.reason;
|
|
130
|
+
return {
|
|
131
|
+
tag: e.tag,
|
|
132
|
+
kind: e.kind,
|
|
133
|
+
...e.source === void 0 ? {} : { source: e.source },
|
|
134
|
+
...e.targets === void 0 ? {} : { targets: e.targets },
|
|
135
|
+
...t.length > 0 ? { requiresScopes: [...new Set(t)] } : {},
|
|
136
|
+
...e.guards === void 0 ? {} : { hasGuards: e.guards.some((e) => e.kind !== "open") },
|
|
137
|
+
...n === void 0 ? {} : { openAccess: n }
|
|
138
|
+
};
|
|
139
|
+
})
|
|
140
|
+
}), S = (e) => e.length === 0 ? "✓ voltro check: no issues" : e.map((e) => {
|
|
141
|
+
let t = e.severity === "error" ? "✗ error" : "⚠ warn", n = e.file ? ` (${e.file})` : "";
|
|
142
|
+
return `${t} ${e.rule} ${e.node}${n}\n ${e.breaks.join("; ")}\n fix: ${e.fix}`;
|
|
143
|
+
}).join("\n"), C = async (e) => {
|
|
144
|
+
let { walk: t, loadDiscovered: n, loadApiConfig: r } = await import("./dev-D2BikO7a.js"), { buildRpcEntry: i } = await import("./manifestBuild-COkJoyAr.js"), { buildCapabilityManifest: a } = await import("./inspect-P4pxoMaV.js"), { relative: o } = await import("node:path"), s = await n(await t(e)), c = (t, n, r) => i(t, n, o(e, r)), l = [
|
|
145
|
+
...s.queries.map((e) => c(e.descriptor, "query", e.file)),
|
|
146
|
+
...s.mutations.map((e) => c(e.descriptor, "mutation", e.file)),
|
|
147
|
+
...s.actions.map((e) => c(e.descriptor, "action", e.file)),
|
|
148
|
+
...s.streams.map((e) => c(e.descriptor, "stream", e.file))
|
|
149
|
+
], { assembleFrameworkTables: u } = await import("./frameworkTableAssembly-YyVe32Cb.js"), d = await u({ root: e }).catch((e) => (console.warn(`\n⚠ plugin tables could not be collected — this report is INCOMPLETE.\n ${e instanceof Error ? e.message.split("\n")[0] : String(e)}\n`), [])), f = new Set(s.tables.map((e) => e.tableName)), p = [...[...f].map((e) => ({ name: e })), ...d.map((e) => e.tableName).filter((e) => !f.has(e)).map((e) => ({
|
|
150
|
+
name: e,
|
|
151
|
+
framework: !0
|
|
152
|
+
}))], m = await r(e).then((e) => e?.plugins ?? []).catch(() => []);
|
|
153
|
+
return {
|
|
154
|
+
manifest: a(l, s.workflows.map((t) => ({
|
|
155
|
+
tag: t.definition.name ?? "",
|
|
156
|
+
file: o(e, t.file)
|
|
157
|
+
})), [], m),
|
|
158
|
+
tables: { tables: p }
|
|
159
|
+
};
|
|
160
|
+
}, w = async (n) => {
|
|
161
|
+
let f = a(n.flatMap((e) => e === "--json" ? ["--format", "json"] : [e]));
|
|
162
|
+
if ("error" in f) return console.error(`voltro check: ${f.error}`), 1;
|
|
163
|
+
let { process: p, target: m, rest: h } = s(f.rest), v;
|
|
164
|
+
for (let e = 0; e < h.length; e++) if (h[e] === "--diff") {
|
|
165
|
+
let [t, n] = (h[++e] ?? "").split(":");
|
|
166
|
+
if (t === "removeTable" && n) v = {
|
|
167
|
+
kind: "removeTable",
|
|
168
|
+
name: n
|
|
169
|
+
};
|
|
170
|
+
else if (t === "removeProcedure" && n) v = {
|
|
171
|
+
kind: "removeProcedure",
|
|
172
|
+
tag: n
|
|
173
|
+
};
|
|
174
|
+
else if (t === "removeScope" && n) v = {
|
|
175
|
+
kind: "removeScope",
|
|
176
|
+
name: n
|
|
177
|
+
};
|
|
178
|
+
else return console.error("voltro check --diff: expected removeTable:<name> | removeProcedure:<tag> | removeScope:<name>"), 1;
|
|
179
|
+
}
|
|
180
|
+
let w = e(h, ["--diff"]) ?? process.cwd(), T = h.includes("--offline"), E = T ? [] : await o(p, m), D, O;
|
|
181
|
+
if (E.length === 0) {
|
|
182
|
+
if (!T && m !== void 0) return console.error("voltro check: --url given but no api reachable there."), 1;
|
|
183
|
+
try {
|
|
184
|
+
let e = await C(d(w));
|
|
185
|
+
D = e.manifest, O = e.tables;
|
|
186
|
+
} catch (e) {
|
|
187
|
+
return console.error(`voltro check: could not assemble the graph from source: ${e.message}`), console.error(" Start `voltro dev` to check against a running api instead."), 1;
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
let e = E[0], [t, n] = await Promise.all([c(e, "/_voltro/inspect/manifest"), c(e, "/_voltro/inspect/data/tables")]);
|
|
191
|
+
if (t.kind === "err") return console.error(`voltro check: manifest fetch failed: ${t.error}`), 1;
|
|
192
|
+
D = t.data, O = n.kind === "ok" ? n.data : { tables: [] };
|
|
193
|
+
}
|
|
194
|
+
let k = x(D, O), A = r(k, v), j = [...l(w).findings.map((e) => ({
|
|
195
|
+
rule: e.rule,
|
|
196
|
+
node: e.file,
|
|
197
|
+
file: e.file,
|
|
198
|
+
breaks: [e.detail],
|
|
199
|
+
fix: e.fix,
|
|
200
|
+
severity: e.severity
|
|
201
|
+
})), ...u(w).map((e) => ({
|
|
202
|
+
rule: `page/${e.kind}`,
|
|
203
|
+
node: e.file,
|
|
204
|
+
file: e.file,
|
|
205
|
+
breaks: [e.kind === "suffixed-outside-pages" ? "a page.tsx outside src/pages/ never routes" : "no test beside it"],
|
|
206
|
+
fix: e.kind === "suffixed-outside-pages" ? "move it under src/pages/ into the directory whose route it serves, or rename it — page.tsx is reserved" : "write the test with the file — the name is derivable",
|
|
207
|
+
severity: e.kind === "suffixed-outside-pages" ? "error" : "warn"
|
|
208
|
+
}))], M = (await t(w, _(w))).map((e) => ({
|
|
209
|
+
rule: "client/not-browser-safe",
|
|
210
|
+
node: e.file,
|
|
211
|
+
file: e.file,
|
|
212
|
+
breaks: [`reaches the server-only '${e.violation.specifier}' — chain: ${e.violation.chain.join(" → ")}`],
|
|
213
|
+
fix: "move the server-only code behind a *.server.ts, or drop the .client suffix — an unmarked file makes no claim",
|
|
214
|
+
severity: "error"
|
|
215
|
+
})), N = [
|
|
216
|
+
...A.diagnostics,
|
|
217
|
+
...j,
|
|
218
|
+
...M
|
|
219
|
+
], P = A.ok && !j.some((e) => e.severity === "error") && M.length === 0, F = await y(d(w)), I = F === null ? null : g(k.procedures, F);
|
|
220
|
+
return f.format === "json" ? i(I === null ? {
|
|
221
|
+
...A,
|
|
222
|
+
ok: P,
|
|
223
|
+
diagnostics: N
|
|
224
|
+
} : {
|
|
225
|
+
...A,
|
|
226
|
+
ok: P,
|
|
227
|
+
diagnostics: N,
|
|
228
|
+
observed: I
|
|
229
|
+
}) : (console.log(S(N)), I !== null && console.log(b(I)), console.log(P ? "\nvoltro check: OK" : "\nvoltro check: FAILED (errors above)")), +!P;
|
|
230
|
+
};
|
|
231
|
+
//#endregion
|
|
232
|
+
export { w as n, x as r, C as t };
|
|
@@ -23,6 +23,17 @@ var e = (e, t) => {
|
|
|
23
23
|
value: r,
|
|
24
24
|
rest: n
|
|
25
25
|
};
|
|
26
|
-
}, n = (e, ...t) => e.some((e) => t.includes(e) || t.some((t) => e.startsWith(`${t}=`))), r = (e
|
|
26
|
+
}, n = (e, ...t) => e.some((e) => t.includes(e) || t.some((t) => e.startsWith(`${t}=`))), r = (e, t) => {
|
|
27
|
+
let n = [];
|
|
28
|
+
for (let r = 0; r < e.length; r++) {
|
|
29
|
+
let i = e[r];
|
|
30
|
+
if (t.includes(i)) {
|
|
31
|
+
r++;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
i.startsWith("-") || n.push(i);
|
|
35
|
+
}
|
|
36
|
+
return n;
|
|
37
|
+
}, i = (e, t) => r(e, t)[0];
|
|
27
38
|
//#endregion
|
|
28
39
|
export { t as a, r as i, e as n, n as r, i as t };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/cliError.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
isCliError = !0;
|
|
4
|
+
code;
|
|
5
|
+
constructor(e, t = 1) {
|
|
6
|
+
super(e), this.name = "CliError", this.code = t;
|
|
7
|
+
}
|
|
8
|
+
}, t = (e) => typeof e == "object" && !!e && e.isCliError === !0;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as n, e as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { routeDiagnosticsToStderr as e } from "@voltro/logger";
|
|
2
|
+
//#region src/cliOutput.ts
|
|
3
|
+
var t = () => {
|
|
4
|
+
e();
|
|
5
|
+
}, n = (e, t = {}) => {
|
|
6
|
+
console.log(JSON.stringify(e, null, t.pretty === !1 ? 0 : 2));
|
|
7
|
+
}, r = (e) => {
|
|
8
|
+
for (let t = 0; t < e.length; t++) {
|
|
9
|
+
let n = e[t];
|
|
10
|
+
if (n === "--json" || n === "--format=json" || n === "--format" && e[t + 1] === "json") return !0;
|
|
11
|
+
}
|
|
12
|
+
return !1;
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { n, r, t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Cause as
|
|
3
|
-
import {
|
|
1
|
+
import { LoggerLayer as e } from "@voltro/logger";
|
|
2
|
+
import { Cause as t, Effect as n, Layer as r } from "effect";
|
|
3
|
+
import { NodeContext as i, NodeRuntime as a } from "@effect/platform-node";
|
|
4
4
|
//#region src/cliRuntime.ts
|
|
5
5
|
var o = [
|
|
6
6
|
"severity",
|
|
@@ -51,23 +51,23 @@ var o = [
|
|
|
51
51
|
}, c = (e) => ({
|
|
52
52
|
...e.scope ? { defaultScope: e.scope } : {},
|
|
53
53
|
...e.logger
|
|
54
|
-
}), l = (t = {}) =>
|
|
55
|
-
let o =
|
|
56
|
-
return await
|
|
57
|
-
onSuccess: (e) =>
|
|
54
|
+
}), l = (t = {}) => r.merge(i.layer, e(c(t))), u = async (r, a = {}) => {
|
|
55
|
+
let o = r.pipe(n.provide(i.layer));
|
|
56
|
+
return await n.runPromise(n.matchCauseEffect(o, {
|
|
57
|
+
onSuccess: (e) => n.succeed(e),
|
|
58
58
|
onFailure: (e) => {
|
|
59
|
-
let
|
|
60
|
-
if (process.env.VOLTRO_CAUSE_DEBUG === "1") for (let [e,
|
|
61
|
-
let
|
|
62
|
-
process.stderr.write(`[VOLTRO_CAUSE_DEBUG] defect[${e}] ctor=${
|
|
63
|
-
let r =
|
|
59
|
+
let r = [...t.defects(e)];
|
|
60
|
+
if (process.env.VOLTRO_CAUSE_DEBUG === "1") for (let [e, t] of r.entries()) {
|
|
61
|
+
let n = Object.getOwnPropertyNames(t);
|
|
62
|
+
process.stderr.write(`[VOLTRO_CAUSE_DEBUG] defect[${e}] ctor=${t?.constructor?.name} props=${JSON.stringify(n)}\n`);
|
|
63
|
+
let r = t;
|
|
64
64
|
if (r.message && process.stderr.write(` message: ${String(r.message)}\n`), r.cause) {
|
|
65
65
|
let e = r.cause;
|
|
66
66
|
process.stderr.write(` cause.ctor=${e.constructor?.name} cause.message=${String(e.message)} cause.code=${String(e.code)}\n`);
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
let i = null;
|
|
70
|
-
for (let e of
|
|
70
|
+
for (let e of r) {
|
|
71
71
|
let t = s(e);
|
|
72
72
|
if (t) {
|
|
73
73
|
i = t;
|
|
@@ -83,14 +83,14 @@ var o = [
|
|
|
83
83
|
...i.column ? { pgColumn: i.column } : {},
|
|
84
84
|
...i.constraint ? { pgConstraint: i.constraint } : {},
|
|
85
85
|
...i.routine ? { pgRoutine: i.routine } : {},
|
|
86
|
-
causePretty:
|
|
87
|
-
} : { causePretty:
|
|
88
|
-
return
|
|
86
|
+
causePretty: t.pretty(e)
|
|
87
|
+
} : { causePretty: t.pretty(e) };
|
|
88
|
+
return n.zipRight(n.logError("cli command failed", a), n.succeed(1));
|
|
89
89
|
}
|
|
90
|
-
}).pipe(
|
|
91
|
-
}, d = (e,
|
|
92
|
-
let
|
|
93
|
-
|
|
90
|
+
}).pipe(n.provide(e(c(a)))));
|
|
91
|
+
}, d = (e, t = {}) => {
|
|
92
|
+
let r = e.pipe(n.provide(l(t)));
|
|
93
|
+
a.runMain(r, { disableErrorReporting: !1 });
|
|
94
94
|
};
|
|
95
95
|
//#endregion
|
|
96
96
|
export { d as n, u as t };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { dirname as e, join as t } from "node:path";
|
|
2
|
+
import { promises as n } from "node:fs";
|
|
3
|
+
import { homedir as r } from "node:os";
|
|
4
|
+
//#region src/cloudClient.ts
|
|
5
|
+
var i = () => process.env.VOLTRO_CREDENTIALS_PATH ?? t(r(), ".voltro", "credentials.json"), a = () => (process.env.VOLTRO_CLOUD_URL ?? "https://cloud.voltro.dev").replace(/\/+$/, ""), o = async () => {
|
|
6
|
+
try {
|
|
7
|
+
let e = await n.readFile(i(), "utf8"), t = JSON.parse(e);
|
|
8
|
+
return typeof t.token == "string" && t.token.length > 0 ? {
|
|
9
|
+
token: t.token,
|
|
10
|
+
url: t.url ?? a(),
|
|
11
|
+
savedAt: t.savedAt ?? ""
|
|
12
|
+
} : null;
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}, s = async (t) => {
|
|
17
|
+
let r = i();
|
|
18
|
+
await n.mkdir(e(r), {
|
|
19
|
+
recursive: !0,
|
|
20
|
+
mode: 448
|
|
21
|
+
}), await n.writeFile(r, JSON.stringify(t, null, 2), {
|
|
22
|
+
encoding: "utf8",
|
|
23
|
+
mode: 384
|
|
24
|
+
}), await n.chmod(r, 384).catch(() => {});
|
|
25
|
+
}, c = async (e, t) => {
|
|
26
|
+
let n = `${a()}${e.startsWith("/") ? e : `/${e}`}`, r = {};
|
|
27
|
+
t?.token !== void 0 && (r.authorization = `Bearer ${t.token}`);
|
|
28
|
+
let i = t?.body !== void 0;
|
|
29
|
+
i && (r["content-type"] = "application/json");
|
|
30
|
+
let o = t?.timeoutMs === void 0 ? void 0 : new AbortController(), s = o === void 0 ? void 0 : setTimeout(() => o.abort(), t.timeoutMs);
|
|
31
|
+
try {
|
|
32
|
+
let e = await fetch(n, {
|
|
33
|
+
method: t?.method ?? "GET",
|
|
34
|
+
headers: r,
|
|
35
|
+
...i ? { body: JSON.stringify(t.body) } : {},
|
|
36
|
+
...o === void 0 ? {} : { signal: o.signal }
|
|
37
|
+
}), a = await e.text(), s;
|
|
38
|
+
if (a.length > 0) try {
|
|
39
|
+
s = JSON.parse(a);
|
|
40
|
+
} catch {
|
|
41
|
+
s = a;
|
|
42
|
+
}
|
|
43
|
+
if (!e.ok) {
|
|
44
|
+
let t = typeof s == "object" && s && "error" in s ? String(s.error) : `HTTP ${e.status}`;
|
|
45
|
+
return {
|
|
46
|
+
kind: "err",
|
|
47
|
+
status: e.status,
|
|
48
|
+
error: t
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
kind: "ok",
|
|
53
|
+
status: e.status,
|
|
54
|
+
data: s
|
|
55
|
+
};
|
|
56
|
+
} catch (e) {
|
|
57
|
+
return {
|
|
58
|
+
kind: "err",
|
|
59
|
+
status: 0,
|
|
60
|
+
error: e.message || String(e)
|
|
61
|
+
};
|
|
62
|
+
} finally {
|
|
63
|
+
s !== void 0 && clearTimeout(s);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { s as a, o as i, c as n, i as r, a as t };
|