@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,69 @@
|
|
|
1
|
+
import { c as e, i as t } from "./dev-C7sFZq3m.js";
|
|
2
|
+
import { n, t as r } from "./cliArgs-D4p8n7EE.js";
|
|
3
|
+
import { r as i } from "./appPort-B_HpJ_ck.js";
|
|
4
|
+
import { resolve as a } from "node:path";
|
|
5
|
+
import { createLogger as o } from "@voltro/logger";
|
|
6
|
+
import { nodeProcessSupervisor as s, runSingleNodeOrchestrator as c } from "@voltro/runtime";
|
|
7
|
+
//#region src/dormancyCommand.ts
|
|
8
|
+
var l = [
|
|
9
|
+
"--port",
|
|
10
|
+
"--app-port",
|
|
11
|
+
"--idle-grace-ms",
|
|
12
|
+
"--tick-ms"
|
|
13
|
+
], u = async (u) => {
|
|
14
|
+
let d = o({ scope: "dormancy" }), f = {
|
|
15
|
+
info: (e, t) => d.info(e, t ?? {}),
|
|
16
|
+
warn: (e, t) => d.warn(e, t ?? {})
|
|
17
|
+
}, p = a(r(u, l) ?? process.cwd()), m = await e(p), h = (process.env.DB_DIALECT ?? m?.store ?? "memory").toLowerCase();
|
|
18
|
+
if (h === "memory") return d.error("voltro dormancy needs a SQL store (postgres/mysql/mariadb/mssql) — the orchestrator and the app share the `_voltro_wakeups` table, which an in-process `memory` store cannot do. Set DB_DIALECT or the app.config `store` field."), 2;
|
|
19
|
+
let g = i({
|
|
20
|
+
kind: "api",
|
|
21
|
+
configPort: m?.port,
|
|
22
|
+
env: process.env,
|
|
23
|
+
flagPort: n(u, "--port")
|
|
24
|
+
});
|
|
25
|
+
for (let e of g.warnings) d.warn(e);
|
|
26
|
+
let _ = g.port, v = Number(n(u, "--app-port") ?? _ + 1), y = Number(n(u, "--idle-grace-ms") ?? 6e4), b = Number(n(u, "--tick-ms") ?? 1e3), x = await t(m, void 0), S = s({
|
|
27
|
+
command: process.execPath,
|
|
28
|
+
args: [
|
|
29
|
+
process.argv[1],
|
|
30
|
+
"serve",
|
|
31
|
+
p
|
|
32
|
+
],
|
|
33
|
+
env: {
|
|
34
|
+
PORT: String(v),
|
|
35
|
+
VOLTRO_DORMANCY: "sleep"
|
|
36
|
+
},
|
|
37
|
+
healthUrl: `http://127.0.0.1:${v}/`,
|
|
38
|
+
healthCheck: (e) => e.status < 500,
|
|
39
|
+
log: f
|
|
40
|
+
}), C = await c({
|
|
41
|
+
store: x,
|
|
42
|
+
supervisor: S,
|
|
43
|
+
publicPort: _,
|
|
44
|
+
targetHost: "127.0.0.1",
|
|
45
|
+
targetPort: v,
|
|
46
|
+
idleGraceMs: y,
|
|
47
|
+
tickMs: b,
|
|
48
|
+
log: f
|
|
49
|
+
});
|
|
50
|
+
return d.info("dormancy orchestrator running", {
|
|
51
|
+
public: C.port,
|
|
52
|
+
app: v,
|
|
53
|
+
dialect: h,
|
|
54
|
+
idleGraceMs: y
|
|
55
|
+
}), await new Promise((e) => {
|
|
56
|
+
let t = !1, n = (n) => {
|
|
57
|
+
t || (t = !0, d.info("dormancy: shutting down", { signal: n }), (async () => {
|
|
58
|
+
try {
|
|
59
|
+
await C.stop();
|
|
60
|
+
} finally {
|
|
61
|
+
await S.stop().catch(() => {}), e();
|
|
62
|
+
}
|
|
63
|
+
})());
|
|
64
|
+
};
|
|
65
|
+
process.once("SIGINT", () => n("SIGINT")), process.once("SIGTERM", () => n("SIGTERM"));
|
|
66
|
+
}), 0;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { u as runDormancyCommand };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import "./appPort-B_HpJ_ck.js";
|
|
2
|
+
import { t as e } from "./cliRuntime-Dh7UDinH.js";
|
|
3
|
+
import { n as t, t as n } from "./tsxLoader-EuXmSJ1K.js";
|
|
4
|
+
import { dirname as r, join as i, resolve as a } from "node:path";
|
|
5
|
+
import { promises as o } from "node:fs";
|
|
6
|
+
import { fileURLToPath as s, pathToFileURL as c } from "node:url";
|
|
7
|
+
import { createLogger as l } from "@voltro/logger";
|
|
8
|
+
import { Effect as u } from "effect";
|
|
9
|
+
import { spawn as d } from "node:child_process";
|
|
10
|
+
import { createConnection as f } from "node:net";
|
|
11
|
+
//#region src/e2eCmd.ts
|
|
12
|
+
var p = l({ scope: "voltro:e2e" }), m = async (e) => {
|
|
13
|
+
try {
|
|
14
|
+
let t = (await import(c(i(e, "app.config.ts")).href)).default;
|
|
15
|
+
if (typeof t == "object" && t && t.type === "web") return t;
|
|
16
|
+
} catch {}
|
|
17
|
+
return null;
|
|
18
|
+
}, h = async (e, t, n = 15e3) => {
|
|
19
|
+
let r = Date.now() + n;
|
|
20
|
+
for (; Date.now() < r;) {
|
|
21
|
+
if (await new Promise((t) => {
|
|
22
|
+
let n = f({
|
|
23
|
+
port: e,
|
|
24
|
+
host: "localhost"
|
|
25
|
+
});
|
|
26
|
+
n.on("connect", () => {
|
|
27
|
+
n.end(), t(!0);
|
|
28
|
+
}), n.on("error", () => t(!1));
|
|
29
|
+
})) return;
|
|
30
|
+
await new Promise((e) => setTimeout(e, 250));
|
|
31
|
+
}
|
|
32
|
+
throw Error(`${t} did not start listening on :${e} within ${n / 1e3}s`);
|
|
33
|
+
}, g = async (e, t) => {
|
|
34
|
+
if (!t.endsWith(".ts") && !t.endsWith(".tsx")) throw Error(`voltro e2e: unsupported pattern '${t}' (must end in .ts/.tsx)`);
|
|
35
|
+
let n = t.indexOf("/");
|
|
36
|
+
if (n === -1) throw Error(`voltro e2e: pattern '${t}' must include a directory prefix`);
|
|
37
|
+
let r = t.slice(0, n), a = t.slice(n + 1), s = i(e, r), c = [], l = (e, t) => t === "*.spec.ts" || t === "*.spec.tsx" ? e.endsWith(t.slice(1)) : RegExp("^" + t.replace(/\*/g, "[^/]*") + "$").test(e), u = async (e, t) => {
|
|
38
|
+
let n = t.indexOf("/");
|
|
39
|
+
if (n === -1) {
|
|
40
|
+
let n = [];
|
|
41
|
+
try {
|
|
42
|
+
n = await o.readdir(e, { withFileTypes: !0 });
|
|
43
|
+
} catch {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
for (let r of n) r.isFile() && l(r.name, t) && c.push(i(e, r.name));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
let r = t.slice(0, n), a = t.slice(n + 1);
|
|
50
|
+
if (r === "**") {
|
|
51
|
+
await u(e, a);
|
|
52
|
+
let n = [];
|
|
53
|
+
try {
|
|
54
|
+
n = await o.readdir(e, { withFileTypes: !0 });
|
|
55
|
+
} catch {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
for (let r of n) r.isDirectory() && await u(i(e, r.name), t);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
let s = [];
|
|
62
|
+
try {
|
|
63
|
+
s = await o.readdir(e, { withFileTypes: !0 });
|
|
64
|
+
} catch {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
for (let t of s) t.isDirectory() && l(t.name, r) && await u(i(e, t.name), a);
|
|
68
|
+
};
|
|
69
|
+
return await u(s, a), c.sort();
|
|
70
|
+
}, _ = () => a(r(s(import.meta.url)), "..", "bin", "voltro.mjs"), v = async (e) => {
|
|
71
|
+
p.info("starting e2e run", { webRoot: e });
|
|
72
|
+
let r = await m(e);
|
|
73
|
+
if (!r) return p.error("no app.config.ts (or type:'web') at this path", { webRoot: e }), 1;
|
|
74
|
+
let i = r.e2e ?? {}, o = a(e, i.apiDir ?? "../api"), s = i.pattern ?? "e2e/**/*.spec.ts", c = i.apiPort ?? 4e3, l = i.webPort ?? 5173, u = await g(e, s);
|
|
75
|
+
if (p.info(`discovered ${u.length} test file(s)`, {
|
|
76
|
+
apiDir: o,
|
|
77
|
+
pattern: s,
|
|
78
|
+
count: u.length
|
|
79
|
+
}), u.length === 0) return p.error("no test files found — exiting"), 1;
|
|
80
|
+
let f = [], v = () => {
|
|
81
|
+
for (let e of f) e.killed || e.kill("SIGTERM");
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
for (let e of f) e.killed || e.kill("SIGKILL");
|
|
84
|
+
}, 3e3).unref?.();
|
|
85
|
+
};
|
|
86
|
+
process.on("SIGINT", v), process.on("SIGTERM", v);
|
|
87
|
+
try {
|
|
88
|
+
let r = _();
|
|
89
|
+
p.info(`booting api on :${c}`, { port: c });
|
|
90
|
+
let i = d(r, ["dev", o], {
|
|
91
|
+
env: {
|
|
92
|
+
...process.env,
|
|
93
|
+
PORT: String(c),
|
|
94
|
+
DB_DIALECT: process.env.DB_DIALECT ?? "memory",
|
|
95
|
+
WATCH: "0"
|
|
96
|
+
},
|
|
97
|
+
stdio: [
|
|
98
|
+
"ignore",
|
|
99
|
+
"pipe",
|
|
100
|
+
"pipe"
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
f.push(i), await h(c, "api"), p.info(`booting web on :${l}`, { port: l });
|
|
104
|
+
let a = d(r, ["dev", e], {
|
|
105
|
+
env: {
|
|
106
|
+
...process.env,
|
|
107
|
+
PORT: String(l),
|
|
108
|
+
WATCH: "0"
|
|
109
|
+
},
|
|
110
|
+
stdio: [
|
|
111
|
+
"ignore",
|
|
112
|
+
"pipe",
|
|
113
|
+
"pipe"
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
f.push(a), await h(l, "web"), p.info(`running ${u.length} test file(s)`, { count: u.length });
|
|
117
|
+
let s = 0, m = n(), g = t(m);
|
|
118
|
+
g !== void 0 && p.warn(g);
|
|
119
|
+
for (let e of u) {
|
|
120
|
+
let t = await new Promise((t) => {
|
|
121
|
+
d(process.execPath, [...m.execArgv, e], {
|
|
122
|
+
env: {
|
|
123
|
+
...process.env,
|
|
124
|
+
WEB_URL: `http://localhost:${l}`,
|
|
125
|
+
API_URL: `http://localhost:${c}`
|
|
126
|
+
},
|
|
127
|
+
stdio: "inherit"
|
|
128
|
+
}).on("exit", (e) => t(e ?? 0));
|
|
129
|
+
});
|
|
130
|
+
t === 0 ? p.info("test passed", { file: e }) : (p.error(`test failed (exit ${t})`, {
|
|
131
|
+
file: e,
|
|
132
|
+
exitCode: t
|
|
133
|
+
}), s += 1);
|
|
134
|
+
}
|
|
135
|
+
return s > 0 ? (p.error(`${s} test file(s) failed`, {
|
|
136
|
+
failed: s,
|
|
137
|
+
total: u.length
|
|
138
|
+
}), 1) : (p.info(`all ${u.length} test file(s) passed`, { count: u.length }), 0);
|
|
139
|
+
} finally {
|
|
140
|
+
v(), await new Promise((e) => setTimeout(e, 200));
|
|
141
|
+
}
|
|
142
|
+
}, y = (e) => u.tryPromise({
|
|
143
|
+
try: () => v(e),
|
|
144
|
+
catch: (e) => e
|
|
145
|
+
}).pipe(u.orDie), b = async (t) => e(y(a(t.find((e) => !e.startsWith("-")) ?? process.cwd())), { scope: "voltro:e2e" });
|
|
146
|
+
//#endregion
|
|
147
|
+
export { b as runE2eCommand };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { c as e, i as t } from "./dev-C7sFZq3m.js";
|
|
2
|
+
import { Effect as n } from "effect";
|
|
3
|
+
import { embedMany as r } from "@voltro/ai";
|
|
4
|
+
//#region src/embeddingsBackfill.ts
|
|
5
|
+
var i = (e, t) => e.filter((e) => {
|
|
6
|
+
let n = e[t.vectorField];
|
|
7
|
+
return n == null || Array.isArray(n) && n.length === 0 ? !0 : t.modelField && t.model ? String(e[t.modelField]) !== t.model : !1;
|
|
8
|
+
}), a = (e, t) => {
|
|
9
|
+
let n = [];
|
|
10
|
+
for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
|
|
11
|
+
return n;
|
|
12
|
+
}, o = async (e, t, n) => {
|
|
13
|
+
let r = await e.all(n.table), o = i(r, {
|
|
14
|
+
vectorField: n.vectorField,
|
|
15
|
+
...n.modelField ? { modelField: n.modelField } : {},
|
|
16
|
+
...n.model ? { model: n.model } : {}
|
|
17
|
+
});
|
|
18
|
+
if (n.dryRun) return {
|
|
19
|
+
table: n.table,
|
|
20
|
+
scanned: r.length,
|
|
21
|
+
embedded: o.length,
|
|
22
|
+
dryRun: !0
|
|
23
|
+
};
|
|
24
|
+
let s = 0;
|
|
25
|
+
for (let r of a(o, n.batchSize ?? 50)) {
|
|
26
|
+
let i = await t(r.map((e) => String(e[n.textField] ?? "")));
|
|
27
|
+
for (let t = 0; t < r.length; t++) {
|
|
28
|
+
let a = { [n.vectorField]: i[t] };
|
|
29
|
+
n.modelField && n.model && (a[n.modelField] = n.model), await e.update(n.table, r[t].id, a), s++;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
table: n.table,
|
|
34
|
+
scanned: r.length,
|
|
35
|
+
embedded: s,
|
|
36
|
+
dryRun: !1
|
|
37
|
+
};
|
|
38
|
+
}, s = (e) => {
|
|
39
|
+
let [t, n, ...r] = e;
|
|
40
|
+
if (t !== "backfill") return { error: `unknown embeddings subcommand '${t ?? ""}' (expected: backfill)` };
|
|
41
|
+
if (!n) return { error: "usage: voltro embeddings backfill <table> --text <field> --vector <field> [--model <m>] [--model-field <f>] [--batch <n>] [--dry-run]" };
|
|
42
|
+
let i = (e) => {
|
|
43
|
+
let t = r.indexOf(`--${e}`);
|
|
44
|
+
return t === -1 ? void 0 : r[t + 1];
|
|
45
|
+
}, a = i("text"), o = i("vector") ?? "embedding";
|
|
46
|
+
if (!a) return { error: "--text <field> is required (the source text column)" };
|
|
47
|
+
let s = i("model"), c = i("model-field"), l = i("batch");
|
|
48
|
+
return {
|
|
49
|
+
sub: t,
|
|
50
|
+
table: n,
|
|
51
|
+
textField: a,
|
|
52
|
+
vectorField: o,
|
|
53
|
+
...s === void 0 ? {} : { model: s },
|
|
54
|
+
...c === void 0 ? {} : { modelField: c },
|
|
55
|
+
...l === void 0 ? {} : { batchSize: Number(l) },
|
|
56
|
+
dryRun: r.includes("--dry-run")
|
|
57
|
+
};
|
|
58
|
+
}, c = async (i) => {
|
|
59
|
+
let a = s(i);
|
|
60
|
+
if ("error" in a) return console.error(a.error), 1;
|
|
61
|
+
let c = await t(await e(process.cwd()), void 0), l = {
|
|
62
|
+
all: (e) => c.query({ table: e }).then((e) => e.map((e) => ({
|
|
63
|
+
...e,
|
|
64
|
+
id: String(e.id)
|
|
65
|
+
}))),
|
|
66
|
+
update: async (e, t, n) => {
|
|
67
|
+
await c.update(e, t, n);
|
|
68
|
+
}
|
|
69
|
+
}, u = (e) => n.runPromise(r(e)), { sub: d, ...f } = a, p = await o(l, u, f);
|
|
70
|
+
return console.log(`embeddings backfill — table=${p.table} scanned=${p.scanned} embedded=${p.embedded}${p.dryRun ? " (dry-run)" : ""}`), 0;
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { c as runEmbeddingsCommand };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { c as e } from "./dev-C7sFZq3m.js";
|
|
2
|
+
import { at as t, ct as n, lt as r, ot as i } from "./webDev-Dybxew86.js";
|
|
3
|
+
import { join as a } from "node:path";
|
|
4
|
+
import { promises as o } from "node:fs";
|
|
5
|
+
import { createLogger as s } from "@voltro/logger";
|
|
6
|
+
import { frameworkEnvNames as c, isEnvContract as l } from "@voltro/env";
|
|
7
|
+
//#region src/envCommand.ts
|
|
8
|
+
var u = s({ scope: "voltro:env" }), d = "# Environment for this app", f = async (t) => {
|
|
9
|
+
let n = await e(t).catch(() => null);
|
|
10
|
+
if (!n) return null;
|
|
11
|
+
let r = l(n.env) ? n.env : void 0, i = n.type === "api" ? n.plugins ?? [] : void 0;
|
|
12
|
+
return {
|
|
13
|
+
name: n.name ?? "app",
|
|
14
|
+
input: {
|
|
15
|
+
contract: r,
|
|
16
|
+
...i ? { plugins: i } : {}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}, p = (e, t) => e.length >= t ? e : e + " ".repeat(t - e.length), m = (e) => {
|
|
20
|
+
process.stdout.write(`${e}\n`);
|
|
21
|
+
}, h = async (e) => {
|
|
22
|
+
let n = await f(e);
|
|
23
|
+
if (!n) return u.error("no app.config.ts found in the current directory"), 1;
|
|
24
|
+
let r = t(n.name, n.input), i = `${p("KEY", 32)} ${p("OWNER", 16)} ${p("ACCESS", 8)} ${p("REQ", 4)} SET`;
|
|
25
|
+
u.info(`env manifest — ${r.app} (${r.summary.total} vars, ${r.summary.set} set)`), m(i);
|
|
26
|
+
for (let e of r.entries) {
|
|
27
|
+
let t = e.isSet ? "✓" : e.satisfied ? "·" : "✗";
|
|
28
|
+
m(`${p(e.key, 32)} ${p(e.owner, 16)} ${p(e.access, 8)} ${p(e.required ? "yes" : "", 4)} ${t}`);
|
|
29
|
+
}
|
|
30
|
+
return r.summary.missingRequired > 0 ? (u.error(`${r.summary.missingRequired} required var(s) are unset`), 1) : 0;
|
|
31
|
+
}, g = async (e, t) => {
|
|
32
|
+
let n = await f(e);
|
|
33
|
+
if (!n) return u.error("no app.config.ts found in the current directory"), 1;
|
|
34
|
+
let r = i(n.input, ["Environment for this app — generated from app.config.ts `env` + plugin declarations.", "Regenerate with `voltro env sync`. Copy to `.env` and fill in the blanks."]), s = a(e, ".env.example"), c = await o.readFile(s, "utf8").catch(() => null);
|
|
35
|
+
if (c !== null && !c.startsWith(d) && !t) {
|
|
36
|
+
let t = a(e, ".env.example.generated");
|
|
37
|
+
return await o.writeFile(t, r, "utf8"), u.warn(".env.example exists and is not framework-generated — wrote .env.example.generated instead", { hint: "merge it by hand, or pass --force to overwrite .env.example" }), 0;
|
|
38
|
+
}
|
|
39
|
+
return await o.writeFile(s, r, "utf8"), u.info("wrote .env.example", { app: n.name }), 0;
|
|
40
|
+
}, _ = async (t) => {
|
|
41
|
+
let i = await e(t).catch(() => null);
|
|
42
|
+
if (!i) return u.error("no app.config.ts found in the current directory"), 1;
|
|
43
|
+
let a = l(i.env) ? i.env : void 0;
|
|
44
|
+
return a ? (i.type === "web" ? (await n(t, a), u.info("wrote src/voltro-env.d.ts (publicEnv augmentation)", { app: i.name ?? "app" })) : (await r(t, a), u.info("wrote env.generated.d.ts (serverEnv augmentation)", { app: i.name ?? "app" })), 0) : (u.warn("no `defineEnv` declared in app.config.ts — nothing to generate", { hint: "add `env: defineEnv({ ... })` to app.config.ts (see @voltro/env)" }), 0);
|
|
45
|
+
}, v = () => {
|
|
46
|
+
let e = c();
|
|
47
|
+
return u.info(`${e.length} framework env vars for turbo.json globalPassThroughEnv:`), m(JSON.stringify([...e].sort(), null, 2)), u.info("merge these into the workspace turbo.json `globalPassThroughEnv` array (+ your own app vars)."), 0;
|
|
48
|
+
}, y = async (e) => {
|
|
49
|
+
let t = e[0] && !e[0].startsWith("-") ? e[0] : "check", n = e.includes("--force"), r = process.cwd();
|
|
50
|
+
switch (t) {
|
|
51
|
+
case "check":
|
|
52
|
+
case "list": return h(r);
|
|
53
|
+
case "sync": return g(r, n);
|
|
54
|
+
case "types": return _(r);
|
|
55
|
+
case "turbo": return v();
|
|
56
|
+
default: return u.error(`unknown subcommand: ${t}`, { hint: "voltro env [check|sync|types|turbo]" }), 2;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { y as runEnvCommand };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { n as e } from "./appModuleLoader-C9r9mxZt.js";
|
|
2
|
+
import { n as t } from "./cliOutput-D1tSBoRM.js";
|
|
3
|
+
import { basename as n, join as r, resolve as i } from "node:path";
|
|
4
|
+
import { readdirSync as a, statSync as o } from "node:fs";
|
|
5
|
+
import { Effect as s } from "effect";
|
|
6
|
+
import { generateText as c, isEvalDefinition as l, llmJudge as u, runEval as d } from "@voltro/ai";
|
|
7
|
+
import { branchNamespaceName as f } from "@voltro/database";
|
|
8
|
+
//#region src/evalCommand.ts
|
|
9
|
+
var p = /* @__PURE__ */ new Set([
|
|
10
|
+
"node_modules",
|
|
11
|
+
"dist",
|
|
12
|
+
"build",
|
|
13
|
+
".framework",
|
|
14
|
+
".turbo",
|
|
15
|
+
".git",
|
|
16
|
+
"coverage"
|
|
17
|
+
]), m = /\.eval\.ts$/, h = (e, t = [], n = 0) => {
|
|
18
|
+
if (n > 12) return t;
|
|
19
|
+
let i;
|
|
20
|
+
try {
|
|
21
|
+
i = a(e);
|
|
22
|
+
} catch {
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
for (let a of i) {
|
|
26
|
+
if (p.has(a) || a.startsWith(".")) continue;
|
|
27
|
+
let i = r(e, a), s;
|
|
28
|
+
try {
|
|
29
|
+
s = o(i);
|
|
30
|
+
} catch {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
s.isDirectory() ? h(i, t, n + 1) : s.isFile() && m.test(a) && t.push(i);
|
|
34
|
+
}
|
|
35
|
+
return t;
|
|
36
|
+
}, g = async (t) => {
|
|
37
|
+
let n = t.importFile ?? (async (t) => (await e(t)).default), r = t.log ?? (() => {}), i = [], a = [];
|
|
38
|
+
for (let e of t.files) {
|
|
39
|
+
let o;
|
|
40
|
+
try {
|
|
41
|
+
o = await n(e);
|
|
42
|
+
} catch (t) {
|
|
43
|
+
r(`eval: failed to import ${e}: ${t.message}`), a.push(e);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (!l(o)) {
|
|
47
|
+
a.push(e);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
let s = await d(o, {
|
|
51
|
+
replay: t.replay,
|
|
52
|
+
...t.judge === void 0 ? {} : { judge: t.judge },
|
|
53
|
+
...t.branchId === void 0 ? {} : { branchId: t.branchId }
|
|
54
|
+
});
|
|
55
|
+
i.push(s);
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
reports: i,
|
|
59
|
+
ok: i.length > 0 && i.every((e) => e.ok),
|
|
60
|
+
skipped: a
|
|
61
|
+
};
|
|
62
|
+
}, _ = async ({ case: e }) => {
|
|
63
|
+
let t = Date.now();
|
|
64
|
+
return await s.runPromise(c({
|
|
65
|
+
prompt: e.input.prompt,
|
|
66
|
+
...e.input.system === void 0 ? {} : { system: e.input.system }
|
|
67
|
+
}).pipe(s.map((e) => ({
|
|
68
|
+
text: e.text,
|
|
69
|
+
latencyMs: Date.now() - t
|
|
70
|
+
})), s.catchAll((n) => s.succeed({
|
|
71
|
+
text: "",
|
|
72
|
+
latencyMs: Date.now() - t
|
|
73
|
+
}).pipe(s.tap(() => s.sync(() => console.error(` replay error (${e.id}): ${n.message}`)))))));
|
|
74
|
+
}, v = (e) => [`${e.ok ? "✓" : "✗"} ${e.name}: ${e.passed}/${e.cases.length} passed${e.branch ? ` (branch ${e.branch.id})` : ""}`, ...e.cases.filter((e) => !e.pass).map((e) => {
|
|
75
|
+
let t = e.assertionFailures.map((e) => ` - ${e.detail}`), n = e.judge !== void 0 && e.judge.score < .7 ? [` - judge: ${e.judge.score.toFixed(2)} — ${e.judge.reason}`] : [];
|
|
76
|
+
return [
|
|
77
|
+
` ✗ ${e.id}`,
|
|
78
|
+
...t,
|
|
79
|
+
...n
|
|
80
|
+
].join("\n");
|
|
81
|
+
})].join("\n"), y = (e) => {
|
|
82
|
+
let t = e.indexOf("--threshold");
|
|
83
|
+
if (t === -1) return;
|
|
84
|
+
let n = Number(e[t + 1]);
|
|
85
|
+
return Number.isFinite(n) ? n : void 0;
|
|
86
|
+
}, b = (e) => {
|
|
87
|
+
let t = e.indexOf("--pr");
|
|
88
|
+
if (t === -1) return 0;
|
|
89
|
+
let n = Number(e[t + 1]);
|
|
90
|
+
return Number.isInteger(n) && n >= 0 ? n : 0;
|
|
91
|
+
}, x = async (e) => {
|
|
92
|
+
let r = e.includes("--json"), a = e.includes("--branch"), o = y(e);
|
|
93
|
+
if (o !== void 0 && (o < 0 || o > 1)) return console.error("voltro eval: --threshold must be within 0..1"), 1;
|
|
94
|
+
let s = i(e.find((e) => !e.startsWith("-") && Number.isNaN(Number(e))) ?? process.cwd()), c = h(s);
|
|
95
|
+
if (c.length === 0) return console.error(`voltro eval: no *.eval.ts found under ${s}`), console.error(" Author an eval with `export default defineEval({ name, cases, judge? })`."), 1;
|
|
96
|
+
let l = a ? f(n(s), b(e)) : void 0;
|
|
97
|
+
l !== void 0 && !r && console.log(`replays target data branch: ${l} (provision via voltro's BranchExecutor)`);
|
|
98
|
+
let d = await g({
|
|
99
|
+
root: s,
|
|
100
|
+
files: c,
|
|
101
|
+
replay: _,
|
|
102
|
+
judge: u,
|
|
103
|
+
...l === void 0 ? {} : { branchId: l },
|
|
104
|
+
log: (e) => console.error(e)
|
|
105
|
+
});
|
|
106
|
+
if (r) t({
|
|
107
|
+
ok: d.ok,
|
|
108
|
+
reports: d.reports,
|
|
109
|
+
skipped: d.skipped
|
|
110
|
+
});
|
|
111
|
+
else {
|
|
112
|
+
for (let e of d.reports) console.log(v(e));
|
|
113
|
+
d.reports.length === 0 && console.log("voltro eval: no runnable eval suites (files found but none exported a defineEval)"), console.log(d.ok ? "\nvoltro eval: OK" : "\nvoltro eval: FAILED (regressions above)");
|
|
114
|
+
}
|
|
115
|
+
return +!d.ok;
|
|
116
|
+
};
|
|
117
|
+
//#endregion
|
|
118
|
+
export { x as runEvalCommand };
|