@runa-ai/runa-cli 0.5.72 → 0.7.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/dist/build-V66FAQXB.js +1719 -0
- package/dist/cache-N7WNPEYF.js +111 -0
- package/dist/check-LOMVIRHX.js +12 -0
- package/dist/chunk-2APB25TT.js +442 -0
- package/dist/chunk-3FDQW524.js +544 -0
- package/dist/chunk-3WDV32GA.js +33 -0
- package/dist/chunk-5FT3F36G.js +59 -0
- package/dist/chunk-5NKWR4FF.js +254 -0
- package/dist/chunk-644FVGIQ.js +194 -0
- package/dist/chunk-6AALH2ED.js +121 -0
- package/dist/chunk-6FAU4IGR.js +63 -0
- package/dist/chunk-6Y3LAUGL.js +35 -0
- package/dist/chunk-7B5C6U2K.js +274 -0
- package/dist/chunk-AAIE4F2U.js +140 -0
- package/dist/chunk-AIP6MR42.js +12 -0
- package/dist/chunk-CCKG5R4Y.js +59 -0
- package/dist/chunk-DRSUEMAK.js +123 -0
- package/dist/chunk-FHG3ILE4.js +2011 -0
- package/dist/chunk-H2AHNI75.js +31 -0
- package/dist/chunk-HD74F6W2.js +460 -0
- package/dist/chunk-HKUWEGUX.js +36 -0
- package/dist/chunk-IBVVGH6X.js +33 -0
- package/dist/chunk-II7VYQEM.js +179 -0
- package/dist/chunk-JMJP4A47.js +204 -0
- package/dist/chunk-JQXOVCOP.js +574 -0
- package/dist/chunk-KE6QJBZG.js +41 -0
- package/dist/chunk-KWX3JHCY.js +85 -0
- package/dist/chunk-MXRWBNIY.js +74 -0
- package/dist/chunk-NPSRD26F.js +149 -0
- package/dist/chunk-QDF7QXBL.js +67 -0
- package/dist/chunk-QM53IQHM.js +209 -0
- package/dist/chunk-RZLYEO4U.js +219 -0
- package/dist/chunk-SGJG3BKD.js +351 -0
- package/dist/chunk-TYIAD6SB.js +74 -0
- package/dist/chunk-UWWSAPDR.js +31 -0
- package/dist/chunk-VM3IWOT5.js +458 -0
- package/dist/chunk-VRXHCR5K.js +42 -0
- package/dist/chunk-WJXC4MVY.js +75 -0
- package/dist/chunk-XDCHRVE3.js +215 -0
- package/dist/chunk-Z4Z5DNW4.js +1196 -0
- package/dist/chunk-ZZOXM6Q4.js +8 -0
- package/dist/ci-ZWRVWNFX.js +9298 -0
- package/dist/cli/contract-output.d.ts +1 -0
- package/dist/cli/index.d.ts +7 -1
- package/dist/cli/requested-command.d.ts +8 -0
- package/dist/cli-2JNBJUBB.js +704 -0
- package/dist/commands/build/actors/db-sync.d.ts +2 -0
- package/dist/commands/build/actors/static-checks.d.ts +7 -6
- package/dist/commands/build/actors/validate.d.ts +2 -0
- package/dist/commands/build/contract.d.ts +30 -30
- package/dist/commands/build/machine-dry-run.d.ts +3 -0
- package/dist/commands/build/machine-e2e-meta.d.ts +120 -0
- package/dist/commands/build/machine.d.ts +22 -22
- package/dist/commands/build/types.d.ts +2 -4
- package/dist/commands/check/commands/check.d.ts +8 -3
- package/dist/commands/ci/machine/actors/db/collect-schema-stats.d.ts +9 -6
- package/dist/commands/ci/machine/actors/db/schema-canonical-diff.d.ts +55 -0
- package/dist/commands/ci/machine/actors/db/schema-stats.d.ts +11 -0
- package/dist/commands/ci/machine/actors/db/sync-schema.d.ts +9 -1
- package/dist/commands/ci/machine/contract.d.ts +26 -26
- package/dist/commands/ci/machine/formatters/sections/final-comment.d.ts +1 -5
- package/dist/commands/ci/machine/formatters/sections/format-helpers.d.ts +5 -0
- package/dist/commands/ci/machine/formatters/sections/index.d.ts +2 -2
- package/dist/commands/ci/machine/formatters/sections/schema-matrix.d.ts +3 -3
- package/dist/commands/ci/machine/machine-execution-helpers.d.ts +40 -0
- package/dist/commands/ci/machine/machine-state-helpers.d.ts +14 -0
- package/dist/commands/ci/machine/machine.d.ts +12 -12
- package/dist/commands/ci/machine/types.d.ts +2 -5
- package/dist/commands/ci/utils/ci-summary.d.ts +15 -15
- package/dist/commands/ci/utils/execa-helpers.d.ts +2 -0
- package/dist/commands/db/apply/actors/idempotent-actors.d.ts +34 -0
- package/dist/commands/db/apply/actors/lock-actors.d.ts +16 -0
- package/dist/commands/db/apply/actors/pg-schema-diff-actors.d.ts +31 -0
- package/dist/commands/db/apply/actors/seed-actors.d.ts +11 -0
- package/dist/commands/db/apply/actors/shared.d.ts +9 -0
- package/dist/commands/db/apply/actors.d.ts +16 -65
- package/dist/commands/db/apply/contract.d.ts +8 -1
- package/dist/commands/db/apply/helpers/data-compatibility-checker.d.ts +3 -4
- package/dist/commands/db/apply/helpers/data-integrity-verifier.d.ts +37 -0
- package/dist/commands/db/apply/helpers/fresh-db-handler.d.ts +34 -0
- package/dist/commands/db/apply/helpers/hazard-handler.d.ts +60 -0
- package/dist/commands/db/apply/helpers/idempotent-object-registry.d.ts +96 -0
- package/dist/commands/db/apply/helpers/idempotent-transaction.d.ts +20 -0
- package/dist/commands/db/apply/helpers/index.d.ts +6 -0
- package/dist/commands/db/apply/helpers/partition-validator.d.ts +2 -15
- package/dist/commands/db/apply/helpers/pg-schema-diff-helpers.d.ts +18 -162
- package/dist/commands/db/apply/helpers/pg-schema-diff-patterns.d.ts +55 -0
- package/dist/commands/db/apply/helpers/pg-schema-diff-version.d.ts +50 -0
- package/dist/commands/db/apply/helpers/plan-validator.d.ts +4 -10
- package/dist/commands/db/apply/helpers/rbac-password-manager.d.ts +34 -0
- package/dist/commands/db/apply/helpers/retry-logic.d.ts +16 -2
- package/dist/commands/db/apply/helpers/shadow-db-manager.d.ts +1 -1
- package/dist/commands/db/apply/helpers/sql-utils.d.ts +26 -0
- package/dist/commands/db/apply/machine.d.ts +52 -1
- package/dist/commands/db/commands/db-apply.d.ts +18 -0
- package/dist/commands/db/commands/db-sync/boundary-classifier.d.ts +21 -0
- package/dist/commands/db/commands/db-sync/error-classifier.d.ts +9 -0
- package/dist/commands/db/commands/db-sync/plan-hazard-analyzer.d.ts +13 -0
- package/dist/commands/db/commands/db-sync/risk-reporter.d.ts +19 -0
- package/dist/commands/db/commands/db-sync/sql-parser.d.ts +25 -0
- package/dist/commands/db/commands/db-sync/types.d.ts +47 -0
- package/dist/commands/db/commands/db-sync.d.ts +14 -0
- package/dist/commands/db/sync/contract.d.ts +6 -2
- package/dist/commands/db/sync/machine.d.ts +2 -1
- package/dist/commands/db/types.d.ts +2 -0
- package/dist/commands/db/utils/boundary-policy/rule-compiler.d.ts +11 -0
- package/dist/commands/db/utils/boundary-policy/types.d.ts +105 -0
- package/dist/commands/db/utils/boundary-policy/validation.d.ts +20 -0
- package/dist/commands/db/utils/boundary-policy-runtime.d.ts +28 -0
- package/dist/commands/db/utils/boundary-policy.d.ts +5 -0
- package/dist/commands/db/utils/idempotent-risk-context.d.ts +29 -0
- package/dist/commands/db/utils/preflight-check.d.ts +14 -0
- package/dist/commands/db/utils/preflight-checks/domain-naming-checks.d.ts +106 -0
- package/dist/commands/db/utils/preflight-checks/orphan-checks.d.ts +36 -0
- package/dist/commands/db/utils/preflight-checks/schema-risk-checks.d.ts +22 -0
- package/dist/commands/db/utils/preflight-checks/supabase-checks.d.ts +55 -0
- package/dist/commands/db/utils/risk-detector-loader.d.ts +8 -0
- package/dist/commands/db/utils/schema-precheck-budget.d.ts +17 -0
- package/dist/commands/db/utils/sql-boundary-parser.d.ts +12 -0
- package/dist/commands/db/utils/sql-file-collector.d.ts +8 -0
- package/dist/commands/db/utils/sql-filename-parser.d.ts +20 -0
- package/dist/commands/db/utils/sql-table-extractor-ast.d.ts +19 -0
- package/dist/commands/db/utils/sql-table-extractor-regex.d.ts +50 -0
- package/dist/commands/db/utils/sql-table-extractor-rls.d.ts +13 -0
- package/dist/commands/db/utils/sql-table-extractor.d.ts +79 -1
- package/dist/commands/db/utils/table-registry-introspection.d.ts +68 -0
- package/dist/commands/db/utils/table-registry.d.ts +3 -38
- package/dist/commands/dev/actors/app-lifecycle.d.ts +18 -0
- package/dist/commands/dev/actors/index.d.ts +12 -2
- package/dist/commands/dev/actors/process-check.d.ts +12 -0
- package/dist/commands/dev/actors/shared.d.ts +15 -0
- package/dist/commands/dev/actors/tables-manifest.d.ts +16 -0
- package/dist/commands/dev/contract.d.ts +3 -3
- package/dist/commands/dev/guards.d.ts +24 -0
- package/dist/commands/dev/machine.d.ts +27 -32
- package/dist/commands/dev/types.d.ts +2 -0
- package/dist/commands/doctor.d.ts +9 -0
- package/dist/commands/env/commands/env-pull/auth.d.ts +13 -0
- package/dist/commands/env/commands/env-pull/dotenv-files.d.ts +14 -0
- package/dist/commands/env/commands/env-pull/security.d.ts +12 -0
- package/dist/commands/env/commands/env-pull/service.d.ts +8 -0
- package/dist/commands/env/commands/env-pull/shared.d.ts +79 -0
- package/dist/commands/env/commands/setup/types.d.ts +1 -1
- package/dist/commands/env/constants/local-supabase.d.ts +2 -0
- package/dist/commands/inject-test-attrs/defaults.d.ts +9 -0
- package/dist/commands/template-check/contract.d.ts +6 -6
- package/dist/commands/template-check/machine.d.ts +2 -2
- package/dist/commands/template-check/types.d.ts +0 -4
- package/dist/commands/template-check/utils/diff-analyzer.d.ts +0 -4
- package/dist/commands/utils/machine-state-logging.d.ts +20 -0
- package/dist/commands/utils/repo-root.d.ts +2 -0
- package/dist/config/env.d.ts +4 -4
- package/dist/config-loader-GT3HAQ7U.js +7 -0
- package/dist/db-XULCILOU.js +14137 -0
- package/dist/dev-5YXNPTCJ.js +992 -0
- package/dist/doctor-MZLOA53G.js +44 -0
- package/dist/env-HMMRSYCI.js +7 -0
- package/dist/env-SS66PZ4B.js +2623 -0
- package/dist/env-files-2UIUYLLR.js +8 -0
- package/dist/error-handler-HEXBRNVV.js +460 -0
- package/dist/hotfix-YA3DGLOM.js +1477 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +48 -42995
- package/dist/init-ZIL6LRFO.js +631 -0
- package/dist/inject-test-attrs-P44BVTQS.js +23 -0
- package/dist/internal/machines/snapshot-helpers.d.ts +6 -0
- package/dist/lib/sql-comment-utils.d.ts +25 -0
- package/dist/license-OB7GVJQ2.js +468 -0
- package/dist/link-VSNDVZZD.js +59 -0
- package/dist/manifest-TMFLESHW.js +19 -0
- package/dist/prepare-32DOVHTE.js +250 -0
- package/dist/risk-detector-4U6ZJ2G5.js +6 -0
- package/dist/risk-detector-core-TK4OAI3N.js +166 -0
- package/dist/risk-detector-plpgsql-HWKS4OLR.js +1886 -0
- package/dist/sdk-XK6HQU7S.js +348 -0
- package/dist/services-7VK5KZTO.js +177 -0
- package/dist/session-SFW5QSXZ.js +142 -0
- package/dist/signal-handler-DO3OANW5.js +6 -0
- package/dist/status-UTKS63AB.js +94 -0
- package/dist/telemetry-P56UBLZ2.js +93 -0
- package/dist/template-check-3P4HZXVY.js +1944 -0
- package/dist/test-V4KQL574.js +650 -0
- package/dist/test-gen-FS4CEY3P.js +88 -0
- package/dist/ui-RJAMCWUI.js +331 -0
- package/dist/upgrade-NUK3ZBCL.js +637 -0
- package/dist/utils/config-loader.d.ts +0 -3
- package/dist/validate-CAAW4Y44.js +54 -0
- package/dist/validators/risk-detector-content-risks.d.ts +13 -0
- package/dist/validators/risk-detector-core.d.ts +25 -0
- package/dist/validators/risk-detector-patterns.d.ts +15 -0
- package/dist/validators/risk-detector-plpgsql-expression-resolver.d.ts +22 -0
- package/dist/validators/risk-detector-plpgsql-parser.d.ts +5 -0
- package/dist/validators/risk-detector-plpgsql-tokenizer.d.ts +18 -0
- package/dist/validators/risk-detector-plpgsql.d.ts +9 -0
- package/dist/validators/risk-detector-text-utils.d.ts +6 -0
- package/dist/validators/risk-detector-types.d.ts +16 -0
- package/dist/validators/risk-detector.d.ts +7 -26
- package/dist/vuln-check-2W7N5TA2.js +121 -0
- package/dist/vuln-checker-IQJ56RUV.js +3223 -0
- package/dist/watch-PNTKZYFB.js +911 -0
- package/dist/workflow-H75N4BXX.js +897 -0
- package/package.json +5 -2
- package/dist/cli/contract-mode.d.ts.map +0 -1
- package/dist/cli/contract-output.d.ts.map +0 -1
- package/dist/cli/early-flags.d.ts.map +0 -1
- package/dist/cli/error-handler.d.ts.map +0 -1
- package/dist/cli/exec.d.ts.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/json-output.d.ts.map +0 -1
- package/dist/cli/non-interactive.d.ts.map +0 -1
- package/dist/cli/output-format.d.ts.map +0 -1
- package/dist/cli/signal-handler.d.ts.map +0 -1
- package/dist/commands/build/actors/build.d.ts.map +0 -1
- package/dist/commands/build/actors/clean.d.ts.map +0 -1
- package/dist/commands/build/actors/db-sync.d.ts.map +0 -1
- package/dist/commands/build/actors/index.d.ts.map +0 -1
- package/dist/commands/build/actors/manifest.d.ts.map +0 -1
- package/dist/commands/build/actors/setup.d.ts.map +0 -1
- package/dist/commands/build/actors/static-checks.d.ts.map +0 -1
- package/dist/commands/build/actors/validate.d.ts.map +0 -1
- package/dist/commands/build/commands/build.d.ts.map +0 -1
- package/dist/commands/build/contract.d.ts.map +0 -1
- package/dist/commands/build/guards.d.ts.map +0 -1
- package/dist/commands/build/index.d.ts.map +0 -1
- package/dist/commands/build/machine.d.ts.map +0 -1
- package/dist/commands/build/types.d.ts.map +0 -1
- package/dist/commands/cache.d.ts.map +0 -1
- package/dist/commands/check/commands/check.d.ts.map +0 -1
- package/dist/commands/check/index.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-checks.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-layer-content.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-pr-capabilities.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-apply.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-db-operations.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-github.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-types.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-utils.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-prod-workflow.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-resolvers.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-static.d.ts.map +0 -1
- package/dist/commands/ci/commands/ci-supabase-local.d.ts.map +0 -1
- package/dist/commands/ci/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/app-build.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/app-start.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/build-and-playwright.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/playwright-install.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/build/static-checks.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/apply-seeds.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/collect-schema-stats.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/pgtap-install.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/production-preview.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/pull-production.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/reset.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/schema-stats.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/setup-roles.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/db/sync-schema.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/finalize/github.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/finalize/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/finalize/summary.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/setup/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/setup/local.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/setup/pr-common.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/setup/pr-local.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/test/capabilities.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/test/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/actors/test/run-layers.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/ci-local.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/ci-pr.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/machine-runner.d.ts.map +0 -1
- package/dist/commands/ci/machine/commands/runtime-env.d.ts.map +0 -1
- package/dist/commands/ci/machine/contract.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/github-comment-types.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/github-comment.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/final-comment.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/format-helpers.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/progress-comment.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/sections/schema-matrix.d.ts.map +0 -1
- package/dist/commands/ci/machine/formatters/summary.d.ts.map +0 -1
- package/dist/commands/ci/machine/guards.d.ts.map +0 -1
- package/dist/commands/ci/machine/helpers.d.ts.map +0 -1
- package/dist/commands/ci/machine/index.d.ts.map +0 -1
- package/dist/commands/ci/machine/machine.d.ts.map +0 -1
- package/dist/commands/ci/machine/types.d.ts.map +0 -1
- package/dist/commands/ci/utils/ai-report.d.ts.map +0 -1
- package/dist/commands/ci/utils/app-process.d.ts.map +0 -1
- package/dist/commands/ci/utils/app-runtime.d.ts.map +0 -1
- package/dist/commands/ci/utils/ci-config.d.ts.map +0 -1
- package/dist/commands/ci/utils/ci-env-schema.d.ts.map +0 -1
- package/dist/commands/ci/utils/ci-logging.d.ts.map +0 -1
- package/dist/commands/ci/utils/ci-summary.d.ts.map +0 -1
- package/dist/commands/ci/utils/config-readers.d.ts.map +0 -1
- package/dist/commands/ci/utils/db-url-utils.d.ts.map +0 -1
- package/dist/commands/ci/utils/e2e-auth-setup.d.ts.map +0 -1
- package/dist/commands/ci/utils/env-security.d.ts.map +0 -1
- package/dist/commands/ci/utils/execa-helpers.d.ts.map +0 -1
- package/dist/commands/ci/utils/exit-code-computation.d.ts.map +0 -1
- package/dist/commands/ci/utils/github-api.d.ts.map +0 -1
- package/dist/commands/ci/utils/github.d.ts.map +0 -1
- package/dist/commands/ci/utils/index.d.ts.map +0 -1
- package/dist/commands/ci/utils/pgtap-installer.d.ts.map +0 -1
- package/dist/commands/ci/utils/rls-verification.d.ts.map +0 -1
- package/dist/commands/ci/utils/schema-operations.d.ts.map +0 -1
- package/dist/commands/ci/utils/seed-operations.d.ts.map +0 -1
- package/dist/commands/ci/utils/test-parallel.d.ts.map +0 -1
- package/dist/commands/ci/utils/timestamp-invariants.d.ts.map +0 -1
- package/dist/commands/ci/utils/workflow-idempotency.d.ts.map +0 -1
- package/dist/commands/db/apply/actors.d.ts.map +0 -1
- package/dist/commands/db/apply/contract.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/advisory-lock.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/data-compatibility-checker.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/index.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/partition-acl-cleaner.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/partition-prefilter.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/partition-validator.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/pg-schema-diff-helpers.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/plan-validator.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/retry-logic.d.ts.map +0 -1
- package/dist/commands/db/apply/helpers/shadow-db-manager.d.ts.map +0 -1
- package/dist/commands/db/apply/index.d.ts.map +0 -1
- package/dist/commands/db/apply/machine.d.ts.map +0 -1
- package/dist/commands/db/commands/db-apply.d.ts.map +0 -1
- package/dist/commands/db/commands/db-audit.d.ts.map +0 -1
- package/dist/commands/db/commands/db-backup.d.ts.map +0 -1
- package/dist/commands/db/commands/db-cleanup.d.ts.map +0 -1
- package/dist/commands/db/commands/db-derive-role-passwords.d.ts.map +0 -1
- package/dist/commands/db/commands/db-derive-urls.d.ts.map +0 -1
- package/dist/commands/db/commands/db-diagram.d.ts.map +0 -1
- package/dist/commands/db/commands/db-drizzle.d.ts.map +0 -1
- package/dist/commands/db/commands/db-extension.d.ts.map +0 -1
- package/dist/commands/db/commands/db-generate-password.d.ts.map +0 -1
- package/dist/commands/db/commands/db-lifecycle.d.ts.map +0 -1
- package/dist/commands/db/commands/db-rollback.d.ts.map +0 -1
- package/dist/commands/db/commands/db-schema.d.ts.map +0 -1
- package/dist/commands/db/commands/db-seed-metadata.d.ts.map +0 -1
- package/dist/commands/db/commands/db-seed-verify.d.ts.map +0 -1
- package/dist/commands/db/commands/db-seed.d.ts.map +0 -1
- package/dist/commands/db/commands/db-snapshot.d.ts.map +0 -1
- package/dist/commands/db/commands/db-stack.d.ts.map +0 -1
- package/dist/commands/db/commands/db-stats.d.ts.map +0 -1
- package/dist/commands/db/commands/db-sync.d.ts.map +0 -1
- package/dist/commands/db/commands/db-test.d.ts.map +0 -1
- package/dist/commands/db/constants.d.ts.map +0 -1
- package/dist/commands/db/extension-registry.d.ts.map +0 -1
- package/dist/commands/db/index.d.ts.map +0 -1
- package/dist/commands/db/preflight/actors.d.ts.map +0 -1
- package/dist/commands/db/preflight/contract.d.ts.map +0 -1
- package/dist/commands/db/preflight/index.d.ts.map +0 -1
- package/dist/commands/db/sync/actors.d.ts.map +0 -1
- package/dist/commands/db/sync/contract.d.ts.map +0 -1
- package/dist/commands/db/sync/index.d.ts.map +0 -1
- package/dist/commands/db/sync/machine.d.ts.map +0 -1
- package/dist/commands/db/types.d.ts.map +0 -1
- package/dist/commands/db/utils/db-target.d.ts.map +0 -1
- package/dist/commands/db/utils/db-url-builder.d.ts.map +0 -1
- package/dist/commands/db/utils/error-handlers.d.ts.map +0 -1
- package/dist/commands/db/utils/import-impact-analyzer.d.ts.map +0 -1
- package/dist/commands/db/utils/preflight-check.d.ts.map +0 -1
- package/dist/commands/db/utils/psql.d.ts.map +0 -1
- package/dist/commands/db/utils/schema-detector.d.ts.map +0 -1
- package/dist/commands/db/utils/schema-sync.d.ts.map +0 -1
- package/dist/commands/db/utils/script-runner.d.ts.map +0 -1
- package/dist/commands/db/utils/seed-manager.d.ts.map +0 -1
- package/dist/commands/db/utils/semantic-mapper.d.ts.map +0 -1
- package/dist/commands/db/utils/sql-table-extractor.d.ts.map +0 -1
- package/dist/commands/db/utils/stack-detector.d.ts.map +0 -1
- package/dist/commands/db/utils/table-registry.d.ts.map +0 -1
- package/dist/commands/db/utils/table-source-classifier.d.ts.map +0 -1
- package/dist/commands/dev/actors/index.d.ts.map +0 -1
- package/dist/commands/dev/commands/dev.d.ts.map +0 -1
- package/dist/commands/dev/contract.d.ts.map +0 -1
- package/dist/commands/dev/guards.d.ts.map +0 -1
- package/dist/commands/dev/helpers/stale-process-detector.d.ts.map +0 -1
- package/dist/commands/dev/machine.d.ts.map +0 -1
- package/dist/commands/dev/types.d.ts.map +0 -1
- package/dist/commands/env/commands/env-check.d.ts.map +0 -1
- package/dist/commands/env/commands/env-encrypt.d.ts.map +0 -1
- package/dist/commands/env/commands/env-pull.d.ts.map +0 -1
- package/dist/commands/env/commands/env-setup.d.ts.map +0 -1
- package/dist/commands/env/commands/env-sync.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/action.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/auth.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/file-export.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/github-api.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/helpers.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/index.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/parsers.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/prompts.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/supabase-api.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/types.d.ts.map +0 -1
- package/dist/commands/env/commands/setup/vercel-api.d.ts.map +0 -1
- package/dist/commands/env/constants/local-supabase.d.ts.map +0 -1
- package/dist/commands/env/index.d.ts.map +0 -1
- package/dist/commands/hotfix/actors.d.ts.map +0 -1
- package/dist/commands/hotfix/commands/hotfix-complete.d.ts.map +0 -1
- package/dist/commands/hotfix/commands/hotfix-create.d.ts.map +0 -1
- package/dist/commands/hotfix/commands/hotfix-deploy.d.ts.map +0 -1
- package/dist/commands/hotfix/commands/hotfix-status.d.ts.map +0 -1
- package/dist/commands/hotfix/contract.d.ts.map +0 -1
- package/dist/commands/hotfix/index.d.ts.map +0 -1
- package/dist/commands/hotfix/machine.d.ts.map +0 -1
- package/dist/commands/hotfix/metadata.d.ts.map +0 -1
- package/dist/commands/hotfix/utils/hotfix-machine-helper.d.ts.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/action.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/commands/inject-test-attrs.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/contract.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/detection-diagnostics.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/formatter.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/index.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/manifest-generator.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/processor-utils.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/processor.d.ts.map +0 -1
- package/dist/commands/inject-test-attrs/types.d.ts.map +0 -1
- package/dist/commands/link.d.ts.map +0 -1
- package/dist/commands/manifest/index.d.ts.map +0 -1
- package/dist/commands/prepare/commands/prepare.d.ts.map +0 -1
- package/dist/commands/prepare/index.d.ts.map +0 -1
- package/dist/commands/sdk/commands/publish.d.ts.map +0 -1
- package/dist/commands/sdk/index.d.ts.map +0 -1
- package/dist/commands/services/index.d.ts.map +0 -1
- package/dist/commands/session/index.d.ts.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/telemetry.d.ts.map +0 -1
- package/dist/commands/template-check/actors/compare.d.ts.map +0 -1
- package/dist/commands/template-check/actors/discover.d.ts.map +0 -1
- package/dist/commands/template-check/actors/index.d.ts.map +0 -1
- package/dist/commands/template-check/actors/report.d.ts.map +0 -1
- package/dist/commands/template-check/commands/template-check.d.ts.map +0 -1
- package/dist/commands/template-check/config.d.ts.map +0 -1
- package/dist/commands/template-check/contract.d.ts.map +0 -1
- package/dist/commands/template-check/index.d.ts.map +0 -1
- package/dist/commands/template-check/machine.d.ts.map +0 -1
- package/dist/commands/template-check/types.d.ts.map +0 -1
- package/dist/commands/template-check/utils/diff-analyzer.d.ts.map +0 -1
- package/dist/commands/template-check/utils/normalizer.d.ts.map +0 -1
- package/dist/commands/template-check/utils/path-mapping.d.ts.map +0 -1
- package/dist/commands/test/commands/test-db.d.ts.map +0 -1
- package/dist/commands/test/commands/test-e2e.d.ts.map +0 -1
- package/dist/commands/test/commands/test-fast.d.ts.map +0 -1
- package/dist/commands/test/commands/test-integration.d.ts.map +0 -1
- package/dist/commands/test/commands/test-layer.d.ts.map +0 -1
- package/dist/commands/test/commands/test-owasp-generate.d.ts.map +0 -1
- package/dist/commands/test/commands/test-service.d.ts.map +0 -1
- package/dist/commands/test/commands/test-static.d.ts.map +0 -1
- package/dist/commands/test/commands/test.d.ts.map +0 -1
- package/dist/commands/test/index.d.ts.map +0 -1
- package/dist/commands/test-gen.d.ts.map +0 -1
- package/dist/commands/ui.d.ts.map +0 -1
- package/dist/commands/upgrade.d.ts.map +0 -1
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/vuln-check.d.ts.map +0 -1
- package/dist/commands/watch.d.ts.map +0 -1
- package/dist/commands/workflow/commands/deploy-production.d.ts.map +0 -1
- package/dist/commands/workflow/commands/final-status.d.ts.map +0 -1
- package/dist/commands/workflow/commands/log.d.ts.map +0 -1
- package/dist/commands/workflow/commands/notify.d.ts.map +0 -1
- package/dist/commands/workflow/commands/paths.d.ts.map +0 -1
- package/dist/commands/workflow/commands/sync.d.ts.map +0 -1
- package/dist/commands/workflow/commands/validate.d.ts.map +0 -1
- package/dist/commands/workflow/commands/verify-credentials.d.ts.map +0 -1
- package/dist/commands/workflow/index.d.ts.map +0 -1
- package/dist/commands/workflow/types.d.ts.map +0 -1
- package/dist/config/env-files.d.ts.map +0 -1
- package/dist/config/env.d.ts.map +0 -1
- package/dist/constants/versions.d.ts.map +0 -1
- package/dist/contracts/envelope.d.ts.map +0 -1
- package/dist/errors/catalog.d.ts.map +0 -1
- package/dist/errors/exit-codes.d.ts.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/incremental/affected-tests.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/internal/machines/index.d.ts.map +0 -1
- package/dist/internal/machines/machine-runner.d.ts.map +0 -1
- package/dist/internal/machines/snapshot-helpers.d.ts.map +0 -1
- package/dist/internal/machines/types.d.ts.map +0 -1
- package/dist/internal/vuln-checker/analyzers/dependency-analyzer.d.ts.map +0 -1
- package/dist/internal/vuln-checker/analyzers/rls-analyzer.d.ts.map +0 -1
- package/dist/internal/vuln-checker/analyzers/secret-analyzer.d.ts.map +0 -1
- package/dist/internal/vuln-checker/analyzers/typescript-analyzer.d.ts.map +0 -1
- package/dist/internal/vuln-checker/config/loader.d.ts.map +0 -1
- package/dist/internal/vuln-checker/constants.d.ts.map +0 -1
- package/dist/internal/vuln-checker/ignore/matcher.d.ts.map +0 -1
- package/dist/internal/vuln-checker/index.d.ts.map +0 -1
- package/dist/internal/vuln-checker/reporters/console-reporter.d.ts.map +0 -1
- package/dist/internal/vuln-checker/reporters/json-reporter.d.ts.map +0 -1
- package/dist/internal/vuln-checker/reporters/markdown-reporter.d.ts.map +0 -1
- package/dist/internal/vuln-checker/reporters/sarif-reporter.d.ts.map +0 -1
- package/dist/internal/vuln-checker/security/path-validation.d.ts.map +0 -1
- package/dist/internal/vuln-checker/types.d.ts.map +0 -1
- package/dist/notifiers/desktop-notifier.d.ts.map +0 -1
- package/dist/ui/components/db-panel.d.ts.map +0 -1
- package/dist/ui/components/status-bar.d.ts.map +0 -1
- package/dist/ui/components/test-panel.d.ts.map +0 -1
- package/dist/ui/dashboard.d.ts.map +0 -1
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/utils/config-loader.d.ts.map +0 -1
- package/dist/utils/config-updater.d.ts.map +0 -1
- package/dist/utils/diagnostics.d.ts.map +0 -1
- package/dist/utils/dotenvx.d.ts.map +0 -1
- package/dist/utils/env-local-bridge.d.ts.map +0 -1
- package/dist/utils/execution-plan.d.ts.map +0 -1
- package/dist/utils/github-output-security.d.ts.map +0 -1
- package/dist/utils/help-system.d.ts.map +0 -1
- package/dist/utils/license/admin-auth.d.ts.map +0 -1
- package/dist/utils/license/allowlist-checker.d.ts.map +0 -1
- package/dist/utils/license/ci-detector.d.ts.map +0 -1
- package/dist/utils/license/index.d.ts.map +0 -1
- package/dist/utils/license/owner-resolver.d.ts.map +0 -1
- package/dist/utils/license/types.d.ts.map +0 -1
- package/dist/utils/license/validate-owner.d.ts.map +0 -1
- package/dist/utils/path-security.d.ts.map +0 -1
- package/dist/utils/port-allocator.d.ts.map +0 -1
- package/dist/utils/secure-exec.d.ts.map +0 -1
- package/dist/utils/template-fetcher.d.ts.map +0 -1
- package/dist/utils/type-guards.d.ts.map +0 -1
- package/dist/utils/vercel-project.d.ts.map +0 -1
- package/dist/utils/workspace-detector.d.ts.map +0 -1
- package/dist/validators/risk-detector.d.ts.map +0 -1
- package/dist/validators/schema-validator.d.ts.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/watchers/schema-watcher.d.ts.map +0 -1
- package/dist/watchers/test-watcher.d.ts.map +0 -1
|
@@ -0,0 +1,1719 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import './chunk-QDF7QXBL.js';
|
|
4
|
+
import { getSnapshotStateName, isSnapshotComplete } from './chunk-IBVVGH6X.js';
|
|
5
|
+
import { guards, manifestActor, supabaseStartActor, envCheckActor, depsInstallActor, detectTurbo, detectManifestTask, detectDatabase, checkSupabaseStatus } from './chunk-2APB25TT.js';
|
|
6
|
+
import { findRepoRoot } from './chunk-3WDV32GA.js';
|
|
7
|
+
import { runLogged } from './chunk-6FAU4IGR.js';
|
|
8
|
+
import { createMachineStateChangeLogger } from './chunk-5FT3F36G.js';
|
|
9
|
+
import './chunk-II7VYQEM.js';
|
|
10
|
+
import './chunk-VM3IWOT5.js';
|
|
11
|
+
import { securePnpm } from './chunk-RZLYEO4U.js';
|
|
12
|
+
import { emitJsonSuccess } from './chunk-KE6QJBZG.js';
|
|
13
|
+
import './chunk-WJXC4MVY.js';
|
|
14
|
+
import './chunk-HKUWEGUX.js';
|
|
15
|
+
import { init_esm_shims, __require } from './chunk-VRXHCR5K.js';
|
|
16
|
+
import { CLIError, createCLILogger } from '@runa-ai/runa';
|
|
17
|
+
import { Command } from 'commander';
|
|
18
|
+
import { fromPromise, setup, assign, createActor } from 'xstate';
|
|
19
|
+
import { z } from 'zod';
|
|
20
|
+
import { existsSync, rmSync } from 'fs';
|
|
21
|
+
import { mkdir } from 'fs/promises';
|
|
22
|
+
import path5 from 'path';
|
|
23
|
+
import { loadManifestSafe, validateUnifiedManifest, validateTablesManifest } from '@runa-ai/runa/manifests';
|
|
24
|
+
|
|
25
|
+
createRequire(import.meta.url);
|
|
26
|
+
|
|
27
|
+
// src/commands/build/index.ts
|
|
28
|
+
init_esm_shims();
|
|
29
|
+
|
|
30
|
+
// src/commands/build/commands/build.ts
|
|
31
|
+
init_esm_shims();
|
|
32
|
+
|
|
33
|
+
// src/commands/build/contract.ts
|
|
34
|
+
init_esm_shims();
|
|
35
|
+
var BuildPhaseSchema = z.enum(["types", "lint", "build", "db", "manifest"]);
|
|
36
|
+
var VALID_BUILD_PHASES = ["types", "lint", "build", "db", "manifest"];
|
|
37
|
+
var BuildInputSchema = z.object({
|
|
38
|
+
/** Enable E2E mode (NEXT_PUBLIC_E2E_TEST=true) */
|
|
39
|
+
e2e: z.boolean().default(false),
|
|
40
|
+
/** Clear build caches (.next, .turbo, .runa/manifests) */
|
|
41
|
+
clean: z.boolean().default(false),
|
|
42
|
+
/** Full clean + reinstall node_modules */
|
|
43
|
+
fresh: z.boolean().default(false),
|
|
44
|
+
/** Skip database sync step */
|
|
45
|
+
skipDb: z.boolean().default(false),
|
|
46
|
+
/** Skip manifest generation step */
|
|
47
|
+
skipManifest: z.boolean().default(false),
|
|
48
|
+
/** Show detailed output */
|
|
49
|
+
verbose: z.boolean().default(false),
|
|
50
|
+
/** Dry-run mode (show what would be done) */
|
|
51
|
+
check: z.boolean().default(false),
|
|
52
|
+
/** Skip auto-setup phase (deps install, env check, supabase start) */
|
|
53
|
+
noSetup: z.boolean().default(false),
|
|
54
|
+
/** Target directory (defaults to cwd) */
|
|
55
|
+
targetDir: z.string().optional(),
|
|
56
|
+
/** Only run specific phases (partial build) */
|
|
57
|
+
only: z.array(BuildPhaseSchema).optional()
|
|
58
|
+
}).strict();
|
|
59
|
+
var BuildPhaseStatusSchema = z.enum(["pending", "running", "passed", "failed", "skipped"]);
|
|
60
|
+
var BuildPhaseResultSchema = z.object({
|
|
61
|
+
status: BuildPhaseStatusSchema,
|
|
62
|
+
durationMs: z.number().int().nonnegative(),
|
|
63
|
+
error: z.string().optional()
|
|
64
|
+
});
|
|
65
|
+
var BuildOutputSchema = z.object({
|
|
66
|
+
/** Overall success status */
|
|
67
|
+
success: z.boolean(),
|
|
68
|
+
/** Exit code: 0 = success, 1 = failure */
|
|
69
|
+
exitCode: z.union([z.literal(0), z.literal(1)]),
|
|
70
|
+
/** Results for each phase */
|
|
71
|
+
phases: z.object({
|
|
72
|
+
// Setup phase (auto-detect and fix)
|
|
73
|
+
depsInstall: BuildPhaseResultSchema.optional(),
|
|
74
|
+
envCheck: BuildPhaseResultSchema.optional(),
|
|
75
|
+
supabaseStart: BuildPhaseResultSchema.optional(),
|
|
76
|
+
// Clean phase
|
|
77
|
+
clean: BuildPhaseResultSchema.optional(),
|
|
78
|
+
fresh: BuildPhaseResultSchema.optional(),
|
|
79
|
+
// Core phases
|
|
80
|
+
typeCheck: BuildPhaseResultSchema,
|
|
81
|
+
lint: BuildPhaseResultSchema,
|
|
82
|
+
build: BuildPhaseResultSchema,
|
|
83
|
+
dbSync: BuildPhaseResultSchema.optional(),
|
|
84
|
+
manifest: BuildPhaseResultSchema.optional(),
|
|
85
|
+
validate: BuildPhaseResultSchema
|
|
86
|
+
}),
|
|
87
|
+
/** Total duration in milliseconds */
|
|
88
|
+
durationMs: z.number().int().nonnegative(),
|
|
89
|
+
/** Error message if failed */
|
|
90
|
+
error: z.string().optional(),
|
|
91
|
+
/** Warning messages (non-blocking issues) */
|
|
92
|
+
warnings: z.array(z.string()).optional()
|
|
93
|
+
}).strict();
|
|
94
|
+
|
|
95
|
+
// src/commands/build/machine.ts
|
|
96
|
+
init_esm_shims();
|
|
97
|
+
|
|
98
|
+
// src/commands/build/actors/index.ts
|
|
99
|
+
init_esm_shims();
|
|
100
|
+
|
|
101
|
+
// src/commands/build/actors/build.ts
|
|
102
|
+
init_esm_shims();
|
|
103
|
+
var buildActor = fromPromise(
|
|
104
|
+
async ({ input }) => {
|
|
105
|
+
const { repoRoot, tmpDir, hasTurbo, e2e, env = process.env } = input;
|
|
106
|
+
const startTime = Date.now();
|
|
107
|
+
try {
|
|
108
|
+
const fullTmpDir = path5.join(repoRoot, tmpDir);
|
|
109
|
+
await mkdir(fullTmpDir, { recursive: true });
|
|
110
|
+
const buildEnv = { ...env };
|
|
111
|
+
if (e2e) {
|
|
112
|
+
buildEnv.NEXT_PUBLIC_E2E_TEST = "true";
|
|
113
|
+
buildEnv.E2E_TEST = "true";
|
|
114
|
+
console.log(" E2E mode enabled: NEXT_PUBLIC_E2E_TEST=true");
|
|
115
|
+
}
|
|
116
|
+
const hasApps = existsSync(path5.join(repoRoot, "apps"));
|
|
117
|
+
let args;
|
|
118
|
+
if (hasTurbo) {
|
|
119
|
+
args = hasApps ? ["turbo", "run", "build", "--filter=./apps/*", "--filter=./packages/*"] : ["turbo", "run", "build"];
|
|
120
|
+
} else {
|
|
121
|
+
args = ["build"];
|
|
122
|
+
}
|
|
123
|
+
await runLogged({
|
|
124
|
+
cwd: repoRoot,
|
|
125
|
+
env: buildEnv,
|
|
126
|
+
label: "build",
|
|
127
|
+
command: "pnpm",
|
|
128
|
+
args,
|
|
129
|
+
logFile: path5.join(fullTmpDir, "build.log")
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
passed: true,
|
|
133
|
+
durationMs: Date.now() - startTime
|
|
134
|
+
};
|
|
135
|
+
} catch (error) {
|
|
136
|
+
return {
|
|
137
|
+
passed: false,
|
|
138
|
+
durationMs: Date.now() - startTime,
|
|
139
|
+
error: error instanceof Error ? error.message : String(error)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
// src/commands/build/actors/clean.ts
|
|
146
|
+
init_esm_shims();
|
|
147
|
+
var CLEAN_DIRS = [".next", ".turbo", ".runa/manifests", "dist"];
|
|
148
|
+
var FRESH_DIRS = ["node_modules"];
|
|
149
|
+
function deleteIfExists(fullPath, displayPath, verbose) {
|
|
150
|
+
if (existsSync(fullPath)) {
|
|
151
|
+
if (verbose) {
|
|
152
|
+
console.log(` Deleting: ${displayPath}`);
|
|
153
|
+
}
|
|
154
|
+
rmSync(fullPath, { recursive: true, force: true });
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
function deleteRootDirectories(repoRoot, dirs, verbose) {
|
|
160
|
+
const deleted = [];
|
|
161
|
+
for (const dir of dirs) {
|
|
162
|
+
const fullPath = path5.join(repoRoot, dir);
|
|
163
|
+
if (deleteIfExists(fullPath, dir, verbose)) {
|
|
164
|
+
deleted.push(dir);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return deleted;
|
|
168
|
+
}
|
|
169
|
+
function cleanMonorepoPackages(repoRoot, dirs, verbose) {
|
|
170
|
+
const deleted = [];
|
|
171
|
+
const subdirs = ["apps", "packages"];
|
|
172
|
+
for (const subdir of subdirs) {
|
|
173
|
+
const subdirPath = path5.join(repoRoot, subdir);
|
|
174
|
+
if (!existsSync(subdirPath)) continue;
|
|
175
|
+
const entries = __require("fs").readdirSync(subdirPath, { withFileTypes: true });
|
|
176
|
+
for (const entry of entries) {
|
|
177
|
+
if (!entry.isDirectory()) continue;
|
|
178
|
+
for (const dir of dirs) {
|
|
179
|
+
const targetPath = path5.join(subdirPath, entry.name, dir);
|
|
180
|
+
const displayPath = `${subdir}/${entry.name}/${dir}`;
|
|
181
|
+
if (deleteIfExists(targetPath, displayPath, verbose)) {
|
|
182
|
+
deleted.push(displayPath);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return deleted;
|
|
188
|
+
}
|
|
189
|
+
function deleteDirectories(repoRoot, dirs, verbose) {
|
|
190
|
+
const rootDeleted = deleteRootDirectories(repoRoot, dirs, verbose);
|
|
191
|
+
const packageDeleted = cleanMonorepoPackages(repoRoot, dirs, verbose);
|
|
192
|
+
return [...rootDeleted, ...packageDeleted];
|
|
193
|
+
}
|
|
194
|
+
var cleanActor = fromPromise(
|
|
195
|
+
async ({ input }) => {
|
|
196
|
+
const { repoRoot, tmpDir, verbose = false } = input;
|
|
197
|
+
try {
|
|
198
|
+
await mkdir(path5.join(repoRoot, tmpDir), { recursive: true });
|
|
199
|
+
if (verbose) {
|
|
200
|
+
console.log("Cleaning build caches...");
|
|
201
|
+
}
|
|
202
|
+
const deletedPaths = deleteDirectories(repoRoot, CLEAN_DIRS, verbose);
|
|
203
|
+
return {
|
|
204
|
+
passed: true,
|
|
205
|
+
deletedPaths
|
|
206
|
+
};
|
|
207
|
+
} catch (error) {
|
|
208
|
+
return {
|
|
209
|
+
passed: false,
|
|
210
|
+
deletedPaths: [],
|
|
211
|
+
error: error instanceof Error ? error.message : String(error)
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
var freshActor = fromPromise(
|
|
217
|
+
async ({ input }) => {
|
|
218
|
+
const { repoRoot, tmpDir, verbose = false } = input;
|
|
219
|
+
try {
|
|
220
|
+
await mkdir(path5.join(repoRoot, tmpDir), { recursive: true });
|
|
221
|
+
if (verbose) {
|
|
222
|
+
console.log("Fresh install: cleaning all caches and node_modules...");
|
|
223
|
+
}
|
|
224
|
+
const deletedBuildPaths = deleteDirectories(repoRoot, CLEAN_DIRS, verbose);
|
|
225
|
+
const deletedNodeModules = deleteDirectories(repoRoot, FRESH_DIRS, verbose);
|
|
226
|
+
const deletedPaths = [...deletedBuildPaths, ...deletedNodeModules];
|
|
227
|
+
if (verbose) {
|
|
228
|
+
console.log("Pruning pnpm store...");
|
|
229
|
+
}
|
|
230
|
+
await securePnpm(["store", "prune"], {
|
|
231
|
+
cwd: repoRoot,
|
|
232
|
+
stdio: verbose ? "inherit" : "pipe",
|
|
233
|
+
reject: false
|
|
234
|
+
// Don't fail if store prune fails
|
|
235
|
+
});
|
|
236
|
+
if (verbose) {
|
|
237
|
+
console.log("Reinstalling dependencies...");
|
|
238
|
+
}
|
|
239
|
+
const installResult = await securePnpm(["install"], {
|
|
240
|
+
cwd: repoRoot,
|
|
241
|
+
stdio: verbose ? "inherit" : "pipe",
|
|
242
|
+
reject: false
|
|
243
|
+
});
|
|
244
|
+
if (installResult.exitCode !== 0) {
|
|
245
|
+
const errorMsg = installResult.stderr || installResult.stdout || "pnpm install failed";
|
|
246
|
+
return {
|
|
247
|
+
passed: false,
|
|
248
|
+
deletedPaths,
|
|
249
|
+
error: `pnpm install failed: ${errorMsg.slice(0, 500)}`
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
if (verbose) {
|
|
253
|
+
console.log("Verifying dependency resolution...");
|
|
254
|
+
}
|
|
255
|
+
const lsResult = await securePnpm(["ls", "--depth=0"], {
|
|
256
|
+
cwd: repoRoot,
|
|
257
|
+
stdio: "pipe",
|
|
258
|
+
reject: false
|
|
259
|
+
});
|
|
260
|
+
if (lsResult.exitCode !== 0) {
|
|
261
|
+
return {
|
|
262
|
+
passed: false,
|
|
263
|
+
deletedPaths,
|
|
264
|
+
error: `Dependency verification failed. Some packages may not be explicitly declared in package.json.
|
|
265
|
+
|
|
266
|
+
Tip: If imports fail after --fresh, add missing dependencies to package.json explicitly.
|
|
267
|
+
|
|
268
|
+
Common missing deps: @supabase/supabase-js, drizzle-orm, @hono/node-server`
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
passed: true,
|
|
273
|
+
deletedPaths
|
|
274
|
+
};
|
|
275
|
+
} catch (error) {
|
|
276
|
+
return {
|
|
277
|
+
passed: false,
|
|
278
|
+
deletedPaths: [],
|
|
279
|
+
error: error instanceof Error ? error.message : String(error)
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
// src/commands/build/actors/db-sync.ts
|
|
286
|
+
init_esm_shims();
|
|
287
|
+
var DEFAULT_BUILD_DB_SYNC_TIMEOUT_MS = 18e4;
|
|
288
|
+
function resolveBuildDbSyncTimeoutMs(env) {
|
|
289
|
+
const configured = env.RUNA_BUILD_DB_SYNC_TIMEOUT_MS;
|
|
290
|
+
if (!configured) return DEFAULT_BUILD_DB_SYNC_TIMEOUT_MS;
|
|
291
|
+
const parsed = Number.parseInt(configured, 10);
|
|
292
|
+
if (Number.isNaN(parsed) || parsed <= 0) {
|
|
293
|
+
return DEFAULT_BUILD_DB_SYNC_TIMEOUT_MS;
|
|
294
|
+
}
|
|
295
|
+
return parsed;
|
|
296
|
+
}
|
|
297
|
+
function isTimeoutError(error) {
|
|
298
|
+
if (error && typeof error === "object") {
|
|
299
|
+
const maybeTimedOut = error.timedOut;
|
|
300
|
+
if (maybeTimedOut === true) return true;
|
|
301
|
+
}
|
|
302
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
303
|
+
const normalized = message.toLowerCase();
|
|
304
|
+
return normalized.includes("timed out") || normalized.includes("timeout");
|
|
305
|
+
}
|
|
306
|
+
function buildSupabaseSkipWarning(params) {
|
|
307
|
+
if (params.conflictingProject) {
|
|
308
|
+
const portInfo = params.actualPort != null ? ` (port ${params.actualPort})` : "";
|
|
309
|
+
return `Supabase is not running for this repo${portInfo}: port is used by project '${params.conflictingProject}'. Skipping db sync. Stop the conflicting project or run with '--skip-db'.`;
|
|
310
|
+
}
|
|
311
|
+
if (params.portInUse) {
|
|
312
|
+
const portInfo = params.actualPort != null ? ` (port ${params.actualPort})` : "";
|
|
313
|
+
return `Supabase is not running for this repo${portInfo}: port is already used by another process. Skipping db sync. Stop the conflicting process or run with '--skip-db'.`;
|
|
314
|
+
}
|
|
315
|
+
return "Supabase is not running for this repo. Skipping db sync. Start it with 'supabase start'.";
|
|
316
|
+
}
|
|
317
|
+
function resolveSupabaseSkipWarning(input, repoRoot) {
|
|
318
|
+
if (input.supabaseRunning === false) {
|
|
319
|
+
return "Supabase is not running for this repo. Skipping db sync. Start it with 'supabase start'.";
|
|
320
|
+
}
|
|
321
|
+
if (input.supabaseRunning === true) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
const supabaseStatus = checkSupabaseStatus(repoRoot);
|
|
325
|
+
if (supabaseStatus.running) {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
return buildSupabaseSkipWarning({
|
|
329
|
+
portInUse: supabaseStatus.portInUse,
|
|
330
|
+
actualPort: supabaseStatus.actualPort,
|
|
331
|
+
conflictingProject: supabaseStatus.conflictingProject
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
function isDatabaseUnavailableError(errorLower) {
|
|
335
|
+
const isConnectionError = errorLower.includes("econnrefused") || errorLower.includes("connection refused") || errorLower.includes("database system is not accepting connections") || errorLower.includes("could not connect to server") || errorLower.includes("connection timed out") || errorLower.includes("no pg_hba.conf entry");
|
|
336
|
+
const isMissingEnvVar = errorLower.includes("database_url") && (errorLower.includes("not set") || errorLower.includes("undefined") || errorLower.includes("missing"));
|
|
337
|
+
const isSupabaseNotRunning = errorLower.includes("supabase is not running") || errorLower.includes("supabase start") || errorLower.includes("supabase db is not running");
|
|
338
|
+
return isConnectionError || isMissingEnvVar || isSupabaseNotRunning;
|
|
339
|
+
}
|
|
340
|
+
var dbSyncActor = fromPromise(
|
|
341
|
+
async ({ input }) => {
|
|
342
|
+
const { repoRoot, tmpDir, env = process.env } = input;
|
|
343
|
+
const startTime = Date.now();
|
|
344
|
+
const timeoutMs = resolveBuildDbSyncTimeoutMs(env);
|
|
345
|
+
try {
|
|
346
|
+
const supabaseSkipWarning = resolveSupabaseSkipWarning(input, repoRoot);
|
|
347
|
+
if (supabaseSkipWarning) {
|
|
348
|
+
return {
|
|
349
|
+
passed: true,
|
|
350
|
+
durationMs: Date.now() - startTime,
|
|
351
|
+
warning: supabaseSkipWarning
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
const fullTmpDir = path5.join(repoRoot, tmpDir);
|
|
355
|
+
await mkdir(fullTmpDir, { recursive: true });
|
|
356
|
+
await runLogged({
|
|
357
|
+
cwd: repoRoot,
|
|
358
|
+
env,
|
|
359
|
+
label: "db-sync",
|
|
360
|
+
command: "pnpm",
|
|
361
|
+
args: ["exec", "runa", "db", "sync", "--auto-approve"],
|
|
362
|
+
logFile: path5.join(fullTmpDir, "db-sync.log"),
|
|
363
|
+
timeoutMs
|
|
364
|
+
});
|
|
365
|
+
return {
|
|
366
|
+
passed: true,
|
|
367
|
+
durationMs: Date.now() - startTime
|
|
368
|
+
};
|
|
369
|
+
} catch (error) {
|
|
370
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
371
|
+
const errorLower = errorMessage.toLowerCase();
|
|
372
|
+
if (isTimeoutError(error)) {
|
|
373
|
+
return {
|
|
374
|
+
passed: true,
|
|
375
|
+
// Non-blocking - timeout should not block build
|
|
376
|
+
durationMs: Date.now() - startTime,
|
|
377
|
+
warning: `Database sync timed out after ${timeoutMs}ms. Skipping db sync. Run 'runa db sync --auto-approve' manually when database is ready.`
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
if (isDatabaseUnavailableError(errorLower)) {
|
|
381
|
+
return {
|
|
382
|
+
passed: true,
|
|
383
|
+
// Non-blocking - treat as warning (DB not available is expected in some workflows)
|
|
384
|
+
durationMs: Date.now() - startTime,
|
|
385
|
+
warning: "Database not available. Skipping db sync. Run `runa db sync` manually when database is ready."
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
passed: false,
|
|
390
|
+
durationMs: Date.now() - startTime,
|
|
391
|
+
error: errorMessage
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
);
|
|
396
|
+
|
|
397
|
+
// src/commands/build/actors/static-checks.ts
|
|
398
|
+
init_esm_shims();
|
|
399
|
+
function getCommand(hasTurbo, task) {
|
|
400
|
+
return hasTurbo ? { command: "pnpm", args: ["turbo", "run", task] } : { command: "pnpm", args: [task] };
|
|
401
|
+
}
|
|
402
|
+
function parseCombinedTurboFailure(errorMessage) {
|
|
403
|
+
const normalized = errorMessage.toLowerCase();
|
|
404
|
+
const typeCheckFailed = normalized.includes("#type-check") || normalized.includes(" type-check ") || normalized.includes("type-check exited");
|
|
405
|
+
const lintFailed = normalized.includes("#lint") || normalized.includes(" lint ") || normalized.includes("lint exited");
|
|
406
|
+
if (!typeCheckFailed && !lintFailed) {
|
|
407
|
+
return { typeCheckPassed: false, lintPassed: false };
|
|
408
|
+
}
|
|
409
|
+
return {
|
|
410
|
+
typeCheckPassed: !typeCheckFailed,
|
|
411
|
+
lintPassed: !lintFailed
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function buildOutput(typeCheckPassed, lintPassed, typeCheckDurationMs, lintDurationMs, errors) {
|
|
415
|
+
const passed = errors.length === 0;
|
|
416
|
+
return {
|
|
417
|
+
passed,
|
|
418
|
+
typeCheckPassed,
|
|
419
|
+
lintPassed,
|
|
420
|
+
typeCheckDurationMs,
|
|
421
|
+
lintDurationMs,
|
|
422
|
+
...passed ? {} : { error: errors.join("; ") }
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function toErrorMessage(error) {
|
|
426
|
+
return error instanceof Error ? error.message : String(error);
|
|
427
|
+
}
|
|
428
|
+
async function runTurboStaticChecksIfApplicable(params) {
|
|
429
|
+
if (!params.hasTurbo || params.skipTypes || params.skipLint) {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
try {
|
|
433
|
+
await runLogged({
|
|
434
|
+
cwd: params.repoRoot,
|
|
435
|
+
env: params.env,
|
|
436
|
+
label: "static-checks",
|
|
437
|
+
command: "pnpm",
|
|
438
|
+
args: ["turbo", "run", "type-check", "lint"],
|
|
439
|
+
logFile: path5.join(params.fullTmpDir, "static-checks.log")
|
|
440
|
+
});
|
|
441
|
+
const durationMs = Date.now() - params.startTime;
|
|
442
|
+
return buildOutput(true, true, durationMs, durationMs, []);
|
|
443
|
+
} catch (error) {
|
|
444
|
+
const durationMs = Date.now() - params.startTime;
|
|
445
|
+
const errorMessage = toErrorMessage(error);
|
|
446
|
+
const parsed = parseCombinedTurboFailure(errorMessage);
|
|
447
|
+
return buildOutput(parsed.typeCheckPassed, parsed.lintPassed, durationMs, durationMs, [
|
|
448
|
+
`Static checks failed: ${errorMessage}`
|
|
449
|
+
]);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
async function runSingleStaticCheck(params) {
|
|
453
|
+
const cmd = getCommand(params.hasTurbo, params.task);
|
|
454
|
+
try {
|
|
455
|
+
await runLogged({
|
|
456
|
+
cwd: params.repoRoot,
|
|
457
|
+
env: params.env,
|
|
458
|
+
label: params.label,
|
|
459
|
+
command: cmd.command,
|
|
460
|
+
args: cmd.args,
|
|
461
|
+
logFile: path5.join(params.fullTmpDir, `${params.label}.log`)
|
|
462
|
+
});
|
|
463
|
+
return { passed: true };
|
|
464
|
+
} catch (error) {
|
|
465
|
+
return { passed: false, error: toErrorMessage(error) };
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
var staticChecksActor = fromPromise(
|
|
469
|
+
async ({ input }) => {
|
|
470
|
+
const { repoRoot, tmpDir, hasTurbo, env = process.env, skipTypes, skipLint } = input;
|
|
471
|
+
const fullTmpDir = path5.join(repoRoot, tmpDir);
|
|
472
|
+
await mkdir(fullTmpDir, { recursive: true });
|
|
473
|
+
const startTime = Date.now();
|
|
474
|
+
const turboOutput = await runTurboStaticChecksIfApplicable({
|
|
475
|
+
repoRoot,
|
|
476
|
+
env,
|
|
477
|
+
fullTmpDir,
|
|
478
|
+
startTime,
|
|
479
|
+
hasTurbo,
|
|
480
|
+
skipTypes,
|
|
481
|
+
skipLint
|
|
482
|
+
});
|
|
483
|
+
if (turboOutput) {
|
|
484
|
+
return turboOutput;
|
|
485
|
+
}
|
|
486
|
+
let typeCheckPassed = true;
|
|
487
|
+
let lintPassed = true;
|
|
488
|
+
const errors = [];
|
|
489
|
+
if (!skipTypes) {
|
|
490
|
+
const result = await runSingleStaticCheck({
|
|
491
|
+
repoRoot,
|
|
492
|
+
env,
|
|
493
|
+
fullTmpDir,
|
|
494
|
+
hasTurbo,
|
|
495
|
+
task: "type-check",
|
|
496
|
+
label: "type-check"
|
|
497
|
+
});
|
|
498
|
+
if (!result.passed) {
|
|
499
|
+
typeCheckPassed = false;
|
|
500
|
+
errors.push(`Type check failed: ${result.error}`);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
if (!skipLint) {
|
|
504
|
+
const result = await runSingleStaticCheck({
|
|
505
|
+
repoRoot,
|
|
506
|
+
env,
|
|
507
|
+
fullTmpDir,
|
|
508
|
+
hasTurbo,
|
|
509
|
+
task: "lint",
|
|
510
|
+
label: "lint"
|
|
511
|
+
});
|
|
512
|
+
if (!result.passed) {
|
|
513
|
+
lintPassed = false;
|
|
514
|
+
errors.push(`Lint failed: ${result.error}`);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
const durationMs = Date.now() - startTime;
|
|
518
|
+
return buildOutput(
|
|
519
|
+
skipTypes ? true : typeCheckPassed,
|
|
520
|
+
skipLint ? true : lintPassed,
|
|
521
|
+
skipTypes ? 0 : durationMs,
|
|
522
|
+
skipLint ? 0 : durationMs,
|
|
523
|
+
errors
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
);
|
|
527
|
+
|
|
528
|
+
// src/commands/build/actors/validate.ts
|
|
529
|
+
init_esm_shims();
|
|
530
|
+
function appendValidationWarnings(warnings, prefix, validationWarnings) {
|
|
531
|
+
for (const warning of validationWarnings) {
|
|
532
|
+
warnings.push(`${prefix}: ${warning.message}`);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function hasAnyBuildOutput(repoRoot) {
|
|
536
|
+
const buildOutputPaths = [
|
|
537
|
+
path5.join(repoRoot, ".next"),
|
|
538
|
+
path5.join(repoRoot, "dist"),
|
|
539
|
+
path5.join(repoRoot, "apps", "web", ".next"),
|
|
540
|
+
path5.join(repoRoot, "apps", "dashboard", ".next"),
|
|
541
|
+
path5.join(repoRoot, "packages", "cli", "dist"),
|
|
542
|
+
path5.join(repoRoot, "packages", "sdk", "dist")
|
|
543
|
+
];
|
|
544
|
+
return buildOutputPaths.some((outputPath) => existsSync(outputPath));
|
|
545
|
+
}
|
|
546
|
+
function applyManifestValidationResult(loadResult, warnings, errors) {
|
|
547
|
+
if (!loadResult.success) {
|
|
548
|
+
errors.push(loadResult.error.toUserMessage());
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
const validation = validateUnifiedManifest(loadResult.manifest);
|
|
552
|
+
return appendValidationOutcome("manifest.json", validation, warnings, errors);
|
|
553
|
+
}
|
|
554
|
+
function applyTablesValidationResult(loadResult, warnings, errors) {
|
|
555
|
+
if (!loadResult.success) {
|
|
556
|
+
errors.push(loadResult.error.toUserMessage());
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
const validation = validateTablesManifest(loadResult.manifest);
|
|
560
|
+
return appendValidationOutcome("tables.json", validation, warnings, errors);
|
|
561
|
+
}
|
|
562
|
+
function appendValidationOutcome(label, validation, warnings, errors) {
|
|
563
|
+
if (!validation.valid) {
|
|
564
|
+
errors.push(...validation.errors.map((error) => `${label}: ${error.code} - ${error.message}`));
|
|
565
|
+
}
|
|
566
|
+
appendValidationWarnings(warnings, label, validation.warnings);
|
|
567
|
+
return validation.valid;
|
|
568
|
+
}
|
|
569
|
+
var validateActor = fromPromise(
|
|
570
|
+
async ({ input }) => {
|
|
571
|
+
const { repoRoot, skipManifest, skipTables } = input;
|
|
572
|
+
const warnings = [];
|
|
573
|
+
const buildOutputsExist = hasAnyBuildOutput(repoRoot);
|
|
574
|
+
let manifestsExist = true;
|
|
575
|
+
let tablesExist = true;
|
|
576
|
+
const errors = [];
|
|
577
|
+
if (!buildOutputsExist) {
|
|
578
|
+
warnings.push(
|
|
579
|
+
"No build outputs found. Build may have failed or project structure is non-standard."
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
if (!skipManifest) {
|
|
583
|
+
manifestsExist = applyManifestValidationResult(
|
|
584
|
+
loadManifestSafe("unified", {
|
|
585
|
+
cwd: repoRoot,
|
|
586
|
+
useCache: false
|
|
587
|
+
}),
|
|
588
|
+
warnings,
|
|
589
|
+
errors
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
if (!skipTables) {
|
|
593
|
+
tablesExist = applyTablesValidationResult(
|
|
594
|
+
loadManifestSafe("tables", {
|
|
595
|
+
cwd: repoRoot,
|
|
596
|
+
useCache: false
|
|
597
|
+
}),
|
|
598
|
+
warnings,
|
|
599
|
+
errors
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
return {
|
|
603
|
+
passed: errors.length === 0,
|
|
604
|
+
checks: {
|
|
605
|
+
buildOutputs: buildOutputsExist,
|
|
606
|
+
manifests: manifestsExist,
|
|
607
|
+
tables: tablesExist
|
|
608
|
+
},
|
|
609
|
+
warnings,
|
|
610
|
+
error: errors.length > 0 ? errors.join("\n") : void 0
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
);
|
|
614
|
+
|
|
615
|
+
// src/commands/build/machine-dry-run.ts
|
|
616
|
+
init_esm_shims();
|
|
617
|
+
function getDryRunPhaseStatus(phaseNum, phaseName, config) {
|
|
618
|
+
if (config.shouldRun) {
|
|
619
|
+
return ` ${phaseNum}. ${phaseName}`;
|
|
620
|
+
}
|
|
621
|
+
return ` ${phaseNum}. ${phaseName}: SKIPPED${config.skipReason ? ` (${config.skipReason})` : ""}`;
|
|
622
|
+
}
|
|
623
|
+
function printStaticAnalysisPhase(shouldRunTypes, shouldRunLint) {
|
|
624
|
+
if (shouldRunTypes || shouldRunLint) {
|
|
625
|
+
const checks = [
|
|
626
|
+
...shouldRunTypes ? ["type-check"] : [],
|
|
627
|
+
...shouldRunLint ? ["lint"] : []
|
|
628
|
+
].join(" + ");
|
|
629
|
+
const parallel = shouldRunTypes && shouldRunLint ? " (parallel)" : "";
|
|
630
|
+
console.log(` 3. Static Analysis: ${checks}${parallel}`);
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
console.log(" 3. Static Analysis: SKIPPED (--only)");
|
|
634
|
+
}
|
|
635
|
+
function printDbSyncPhase(context, shouldRunDb) {
|
|
636
|
+
if (context.hasDatabase && !context.input.skipDb && shouldRunDb) {
|
|
637
|
+
console.log(" 5. DB Sync: runa db sync");
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
if (shouldRunDb && !context.hasDatabase) {
|
|
641
|
+
console.log(" 5. DB Sync: SKIPPED (no database configured)");
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
console.log(" 5. DB Sync: SKIPPED (--only)");
|
|
645
|
+
}
|
|
646
|
+
function printManifestPhase(context, shouldRunManifest) {
|
|
647
|
+
if (context.hasManifestTask && !context.input.skipManifest && shouldRunManifest) {
|
|
648
|
+
console.log(" 6. Manifest: runa manifest (bundler-independent)");
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
if (shouldRunManifest && !context.hasManifestTask) {
|
|
652
|
+
console.log(" 6. Manifest: SKIPPED (no manifest task)");
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
console.log(" 6. Manifest: SKIPPED (--only)");
|
|
656
|
+
}
|
|
657
|
+
function printDryRunPhases(context) {
|
|
658
|
+
const only = context.input.only;
|
|
659
|
+
const hasOnly = only && only.length > 0;
|
|
660
|
+
const shouldRunTypes = !hasOnly || only.includes("types");
|
|
661
|
+
const shouldRunLint = !hasOnly || only.includes("lint");
|
|
662
|
+
const shouldRunBuild = !hasOnly || only.includes("build");
|
|
663
|
+
const shouldRunDb = !hasOnly || only.includes("db");
|
|
664
|
+
const shouldRunManifest = !hasOnly || only.includes("manifest");
|
|
665
|
+
if (!context.input.noSetup) {
|
|
666
|
+
console.log(" 0. Auto-Setup: Check deps, env, Supabase");
|
|
667
|
+
}
|
|
668
|
+
if (context.input.clean || context.input.fresh) {
|
|
669
|
+
console.log(" 1. Clean: Delete .next, .turbo, .runa/manifests");
|
|
670
|
+
}
|
|
671
|
+
if (context.input.fresh) {
|
|
672
|
+
console.log(" 2. Fresh: Delete node_modules + pnpm install");
|
|
673
|
+
}
|
|
674
|
+
printStaticAnalysisPhase(shouldRunTypes, shouldRunLint);
|
|
675
|
+
console.log(
|
|
676
|
+
getDryRunPhaseStatus(4, "Build: turbo build", {
|
|
677
|
+
shouldRun: shouldRunBuild,
|
|
678
|
+
skipReason: "--only"
|
|
679
|
+
})
|
|
680
|
+
);
|
|
681
|
+
printDbSyncPhase(context, shouldRunDb);
|
|
682
|
+
printManifestPhase(context, shouldRunManifest);
|
|
683
|
+
console.log(" 7. Validate: Check build outputs");
|
|
684
|
+
}
|
|
685
|
+
function printDryRunConfig(context) {
|
|
686
|
+
const only = context.input.only;
|
|
687
|
+
const hasOnly = only && only.length > 0;
|
|
688
|
+
console.log("\nConfiguration:");
|
|
689
|
+
console.log(` E2E mode: ${context.input.e2e}`);
|
|
690
|
+
console.log(` Auto-setup: ${!context.input.noSetup}`);
|
|
691
|
+
console.log(` Has database: ${context.hasDatabase}`);
|
|
692
|
+
console.log(` Has manifest task: ${context.hasManifestTask}`);
|
|
693
|
+
console.log(` Has turbo: ${context.hasTurbo}`);
|
|
694
|
+
if (hasOnly) {
|
|
695
|
+
console.log(` Only phases: ${only.join(", ")}`);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
function printBuildDryRunPlan(context) {
|
|
699
|
+
const only = context.input.only;
|
|
700
|
+
const hasOnly = only && only.length > 0;
|
|
701
|
+
console.log("\n\u{1F4CB} Dry-run mode: showing what would be done\n");
|
|
702
|
+
if (hasOnly) {
|
|
703
|
+
console.log(`Partial build: only ${only.join(", ")}
|
|
704
|
+
`);
|
|
705
|
+
}
|
|
706
|
+
console.log("Phases to execute:");
|
|
707
|
+
printDryRunPhases(context);
|
|
708
|
+
printDryRunConfig(context);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// src/commands/build/machine-e2e-meta.ts
|
|
712
|
+
init_esm_shims();
|
|
713
|
+
var buildMachineE2EMeta = {
|
|
714
|
+
idle: {
|
|
715
|
+
description: "Waiting for START event to begin build workflow",
|
|
716
|
+
severity: "non-critical",
|
|
717
|
+
observables: { log: "Starting build" },
|
|
718
|
+
assertions: ["expect(state).toBe('idle')"],
|
|
719
|
+
nextStates: ["setup", "preClean", "dryRun"]
|
|
720
|
+
},
|
|
721
|
+
dryRun: {
|
|
722
|
+
description: "Show what would be done without executing (--check)",
|
|
723
|
+
severity: "non-critical",
|
|
724
|
+
observables: { log: "Dry-run mode: showing what would be done" },
|
|
725
|
+
assertions: ["expect(log).toContain('Dry-run')"],
|
|
726
|
+
nextStates: ["done"]
|
|
727
|
+
},
|
|
728
|
+
setup: {
|
|
729
|
+
description: "Auto-detect and fix prerequisites (deps, env, Supabase)",
|
|
730
|
+
severity: "blocking",
|
|
731
|
+
observables: {
|
|
732
|
+
log: "Auto-Setup: Check deps, env, Supabase",
|
|
733
|
+
fs: "node_modules installed if needed"
|
|
734
|
+
},
|
|
735
|
+
assertions: ["expect(log).toContain('Auto-Setup')"],
|
|
736
|
+
nextStates: ["preClean", "failed"]
|
|
737
|
+
},
|
|
738
|
+
clean: {
|
|
739
|
+
description: "Delete build caches (.next, .turbo, .runa/manifests)",
|
|
740
|
+
severity: "non-critical",
|
|
741
|
+
observables: {
|
|
742
|
+
log: "Cleaning build caches",
|
|
743
|
+
fs: "Deleted .next, .turbo, .runa/manifests"
|
|
744
|
+
},
|
|
745
|
+
assertions: ["expect(log).toContain('Cleaning')"],
|
|
746
|
+
nextStates: ["staticAnalysis"]
|
|
747
|
+
},
|
|
748
|
+
fresh: {
|
|
749
|
+
description: "Full clean + reinstall node_modules (--fresh)",
|
|
750
|
+
severity: "blocking",
|
|
751
|
+
observables: {
|
|
752
|
+
log: "Fresh install: deleting node_modules",
|
|
753
|
+
fs: "node_modules deleted and reinstalled"
|
|
754
|
+
},
|
|
755
|
+
assertions: ["expect(log).toContain('Fresh install')"],
|
|
756
|
+
nextStates: ["staticAnalysis", "failed"]
|
|
757
|
+
},
|
|
758
|
+
staticAnalysis: {
|
|
759
|
+
description: "Run type-check + lint in parallel",
|
|
760
|
+
severity: "blocking",
|
|
761
|
+
observables: {
|
|
762
|
+
log: "Running type-check and lint",
|
|
763
|
+
exitCode: "pnpm turbo type-check lint"
|
|
764
|
+
},
|
|
765
|
+
assertions: ["expect(log).toContain('type-check')", "expect(log).toContain('lint')"],
|
|
766
|
+
nextStates: ["build", "dbSync", "failed"]
|
|
767
|
+
},
|
|
768
|
+
build: {
|
|
769
|
+
description: "Run turbo build (or pnpm build if no turbo)",
|
|
770
|
+
severity: "blocking",
|
|
771
|
+
observables: {
|
|
772
|
+
log: "Building project",
|
|
773
|
+
fs: ".next/build-manifest.json created"
|
|
774
|
+
},
|
|
775
|
+
assertions: ["expect(log).toContain('build')"],
|
|
776
|
+
nextStates: ["dbSync", "failed"]
|
|
777
|
+
},
|
|
778
|
+
dbSync: {
|
|
779
|
+
description: "Sync database schema (if database exists)",
|
|
780
|
+
severity: "non-critical",
|
|
781
|
+
observables: {
|
|
782
|
+
log: "Syncing database schema",
|
|
783
|
+
db: "Schema applied via pg-schema-diff"
|
|
784
|
+
},
|
|
785
|
+
assertions: ["expect(log).toContain('db-sync').or.toContain('SKIPPED')"],
|
|
786
|
+
nextStates: ["manifest"]
|
|
787
|
+
},
|
|
788
|
+
manifest: {
|
|
789
|
+
description: "Generate XState manifests (if manifest task exists)",
|
|
790
|
+
severity: "non-critical",
|
|
791
|
+
observables: {
|
|
792
|
+
log: "Generating manifests",
|
|
793
|
+
fs: ".runa/manifests/manifest.json created"
|
|
794
|
+
},
|
|
795
|
+
assertions: ["expect(log).toContain('manifest').or.toContain('SKIPPED')"],
|
|
796
|
+
nextStates: ["validate"]
|
|
797
|
+
},
|
|
798
|
+
validate: {
|
|
799
|
+
description: "Validate build outputs (.next, manifests)",
|
|
800
|
+
severity: "non-critical",
|
|
801
|
+
observables: { log: "Validating build outputs" },
|
|
802
|
+
assertions: ["expect(log).toContain('Validating')"],
|
|
803
|
+
nextStates: ["done"]
|
|
804
|
+
},
|
|
805
|
+
done: {
|
|
806
|
+
description: "Build completed successfully",
|
|
807
|
+
severity: "final",
|
|
808
|
+
observables: { log: "Build complete", exitCode: 0 },
|
|
809
|
+
assertions: ["expect(exitCode).toBe(0)", "expect(log).toContain('Build complete')"],
|
|
810
|
+
nextStates: []
|
|
811
|
+
},
|
|
812
|
+
failed: {
|
|
813
|
+
description: "Build failed with error",
|
|
814
|
+
severity: "final",
|
|
815
|
+
observables: { log: "Build failed", exitCode: 1 },
|
|
816
|
+
assertions: ["expect(exitCode).toBe(1)", "expect(log).toContain('Build failed')"],
|
|
817
|
+
nextStates: []
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
// src/commands/build/types.ts
|
|
822
|
+
init_esm_shims();
|
|
823
|
+
function hasBlockingFailure(context) {
|
|
824
|
+
const blockingPhases = ["depsInstall", "typeCheck", "lint", "build"];
|
|
825
|
+
return blockingPhases.some((phase) => context.phases[phase]?.status === "failed");
|
|
826
|
+
}
|
|
827
|
+
function toOutputPhases(context) {
|
|
828
|
+
return {
|
|
829
|
+
depsInstall: context.phases.depsInstall ?? void 0,
|
|
830
|
+
envCheck: context.phases.envCheck ?? void 0,
|
|
831
|
+
supabaseStart: context.phases.supabaseStart ?? void 0,
|
|
832
|
+
clean: context.phases.clean ?? void 0,
|
|
833
|
+
fresh: context.phases.fresh ?? void 0,
|
|
834
|
+
typeCheck: context.phases.typeCheck ?? { status: "skipped", durationMs: 0 },
|
|
835
|
+
lint: context.phases.lint ?? { status: "skipped", durationMs: 0 },
|
|
836
|
+
build: context.phases.build ?? { status: "skipped", durationMs: 0 },
|
|
837
|
+
dbSync: context.phases.dbSync ?? void 0,
|
|
838
|
+
manifest: context.phases.manifest ?? void 0,
|
|
839
|
+
validate: context.phases.validate ?? { status: "skipped", durationMs: 0 }
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
function resolveWarnings(warnings) {
|
|
843
|
+
return warnings.length > 0 ? warnings : void 0;
|
|
844
|
+
}
|
|
845
|
+
function createOutput(context) {
|
|
846
|
+
const durationMs = Date.now() - context.startTime;
|
|
847
|
+
const blockingFailure = hasBlockingFailure(context);
|
|
848
|
+
const hasFatalError = Boolean(context.error);
|
|
849
|
+
return {
|
|
850
|
+
success: !hasFatalError && !blockingFailure,
|
|
851
|
+
exitCode: hasFatalError || blockingFailure ? 1 : 0,
|
|
852
|
+
phases: toOutputPhases(context),
|
|
853
|
+
durationMs,
|
|
854
|
+
error: context.error ?? void 0,
|
|
855
|
+
warnings: resolveWarnings(context.warnings)
|
|
856
|
+
};
|
|
857
|
+
}
|
|
858
|
+
function createPhaseResult(status, durationMs, error) {
|
|
859
|
+
return { status, durationMs, error };
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// src/commands/build/machine.ts
|
|
863
|
+
function normalizeBuildMachineInput(input) {
|
|
864
|
+
const normalizedInput = BuildInputSchema.parse(input?.input ?? {});
|
|
865
|
+
const repoRoot = input?.repoRoot ?? normalizedInput.targetDir ?? process.cwd();
|
|
866
|
+
return {
|
|
867
|
+
input: normalizedInput,
|
|
868
|
+
repoRoot
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
var buildMachine = setup({
|
|
872
|
+
types: {},
|
|
873
|
+
actors: {
|
|
874
|
+
// Setup actors
|
|
875
|
+
depsInstall: depsInstallActor,
|
|
876
|
+
envCheck: envCheckActor,
|
|
877
|
+
supabaseStart: supabaseStartActor,
|
|
878
|
+
// Clean actors
|
|
879
|
+
clean: cleanActor,
|
|
880
|
+
fresh: freshActor,
|
|
881
|
+
// Core build actors
|
|
882
|
+
staticChecks: staticChecksActor,
|
|
883
|
+
build: buildActor,
|
|
884
|
+
dbSync: dbSyncActor,
|
|
885
|
+
manifest: manifestActor,
|
|
886
|
+
validate: validateActor
|
|
887
|
+
},
|
|
888
|
+
guards: {
|
|
889
|
+
shouldClean: guards.shouldClean,
|
|
890
|
+
shouldFresh: guards.shouldFresh,
|
|
891
|
+
shouldSkipTypes: guards.shouldSkipTypes,
|
|
892
|
+
shouldSkipLint: guards.shouldSkipLint,
|
|
893
|
+
shouldSkipBuild: guards.shouldSkipBuild,
|
|
894
|
+
shouldSkipStaticAnalysis: guards.shouldSkipStaticAnalysis,
|
|
895
|
+
shouldSkipDb: guards.shouldSkipDb,
|
|
896
|
+
shouldSkipManifest: guards.shouldSkipManifest,
|
|
897
|
+
shouldSkipSetup: guards.shouldSkipSetup,
|
|
898
|
+
isDryRun: guards.isDryRun
|
|
899
|
+
}
|
|
900
|
+
}).createMachine({
|
|
901
|
+
id: "build",
|
|
902
|
+
initial: "idle",
|
|
903
|
+
context: ({ input }) => {
|
|
904
|
+
const normalizedInput = normalizeBuildMachineInput(input);
|
|
905
|
+
const repoRoot = normalizedInput.repoRoot;
|
|
906
|
+
return {
|
|
907
|
+
input: normalizedInput.input,
|
|
908
|
+
repoRoot,
|
|
909
|
+
tmpDir: ".runa/tmp/build",
|
|
910
|
+
hasDatabase: detectDatabase(repoRoot),
|
|
911
|
+
hasManifestTask: detectManifestTask(repoRoot),
|
|
912
|
+
hasTurbo: detectTurbo(repoRoot),
|
|
913
|
+
supabaseRunning: false,
|
|
914
|
+
phases: {
|
|
915
|
+
// Setup phase
|
|
916
|
+
depsInstall: null,
|
|
917
|
+
envCheck: null,
|
|
918
|
+
supabaseStart: null,
|
|
919
|
+
// Clean phase
|
|
920
|
+
clean: null,
|
|
921
|
+
fresh: null,
|
|
922
|
+
// Core phases
|
|
923
|
+
typeCheck: null,
|
|
924
|
+
lint: null,
|
|
925
|
+
build: null,
|
|
926
|
+
dbSync: null,
|
|
927
|
+
manifest: null,
|
|
928
|
+
validate: null
|
|
929
|
+
},
|
|
930
|
+
startTime: Date.now(),
|
|
931
|
+
error: null,
|
|
932
|
+
warnings: []
|
|
933
|
+
};
|
|
934
|
+
},
|
|
935
|
+
states: {
|
|
936
|
+
// ============================================================
|
|
937
|
+
// Idle State
|
|
938
|
+
// ============================================================
|
|
939
|
+
idle: {
|
|
940
|
+
meta: { e2e: buildMachineE2EMeta.idle },
|
|
941
|
+
on: {
|
|
942
|
+
START: [
|
|
943
|
+
// Dry-run mode: show what would be done
|
|
944
|
+
{ guard: "isDryRun", target: "dryRun" },
|
|
945
|
+
// Skip setup if --no-setup
|
|
946
|
+
{ guard: "shouldSkipSetup", target: "preClean" },
|
|
947
|
+
// Normal: go to setup first
|
|
948
|
+
{ target: "setup" }
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
// ============================================================
|
|
953
|
+
// Dry-run State
|
|
954
|
+
// ============================================================
|
|
955
|
+
dryRun: {
|
|
956
|
+
meta: { e2e: buildMachineE2EMeta.dryRun },
|
|
957
|
+
entry: ({ context }) => printBuildDryRunPlan(context),
|
|
958
|
+
always: { target: "done" }
|
|
959
|
+
},
|
|
960
|
+
// ============================================================
|
|
961
|
+
// Setup Phase (Auto-detect and fix prerequisites)
|
|
962
|
+
// ============================================================
|
|
963
|
+
setup: {
|
|
964
|
+
meta: { e2e: buildMachineE2EMeta.setup },
|
|
965
|
+
initial: "depsInstall",
|
|
966
|
+
states: {
|
|
967
|
+
depsInstall: {
|
|
968
|
+
invoke: {
|
|
969
|
+
src: "depsInstall",
|
|
970
|
+
input: ({ context }) => ({
|
|
971
|
+
repoRoot: context.repoRoot,
|
|
972
|
+
verbose: context.input.verbose
|
|
973
|
+
}),
|
|
974
|
+
onDone: {
|
|
975
|
+
target: "envCheck",
|
|
976
|
+
actions: assign({
|
|
977
|
+
phases: ({ context, event }) => ({
|
|
978
|
+
...context.phases,
|
|
979
|
+
depsInstall: event.output.needed ? createPhaseResult(
|
|
980
|
+
event.output.installed ? "passed" : "failed",
|
|
981
|
+
event.output.durationMs,
|
|
982
|
+
event.output.error
|
|
983
|
+
) : createPhaseResult("skipped", event.output.durationMs)
|
|
984
|
+
})
|
|
985
|
+
})
|
|
986
|
+
},
|
|
987
|
+
onError: {
|
|
988
|
+
target: "#build.failed",
|
|
989
|
+
// Blocking - can't build without deps
|
|
990
|
+
actions: assign({
|
|
991
|
+
error: ({ event }) => `Dependencies install failed: ${event.error instanceof Error ? event.error.message : String(event.error)}`,
|
|
992
|
+
phases: ({ context, event }) => ({
|
|
993
|
+
...context.phases,
|
|
994
|
+
depsInstall: createPhaseResult(
|
|
995
|
+
"failed",
|
|
996
|
+
0,
|
|
997
|
+
event.error instanceof Error ? event.error.message : String(event.error)
|
|
998
|
+
)
|
|
999
|
+
})
|
|
1000
|
+
})
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
envCheck: {
|
|
1005
|
+
invoke: {
|
|
1006
|
+
src: "envCheck",
|
|
1007
|
+
input: ({ context }) => ({
|
|
1008
|
+
repoRoot: context.repoRoot,
|
|
1009
|
+
verbose: context.input.verbose
|
|
1010
|
+
}),
|
|
1011
|
+
onDone: {
|
|
1012
|
+
target: "supabaseStart",
|
|
1013
|
+
actions: assign({
|
|
1014
|
+
phases: ({ context, event }) => ({
|
|
1015
|
+
...context.phases,
|
|
1016
|
+
envCheck: createPhaseResult(event.output.configured ? "passed" : "skipped", 0)
|
|
1017
|
+
}),
|
|
1018
|
+
warnings: ({ context, event }) => event.output.warning ? [...context.warnings, event.output.warning] : context.warnings
|
|
1019
|
+
})
|
|
1020
|
+
},
|
|
1021
|
+
onError: {
|
|
1022
|
+
target: "supabaseStart",
|
|
1023
|
+
// Non-blocking
|
|
1024
|
+
actions: assign({
|
|
1025
|
+
phases: ({ context }) => ({
|
|
1026
|
+
...context.phases,
|
|
1027
|
+
envCheck: createPhaseResult("skipped", 0)
|
|
1028
|
+
})
|
|
1029
|
+
})
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
supabaseStart: {
|
|
1034
|
+
invoke: {
|
|
1035
|
+
src: "supabaseStart",
|
|
1036
|
+
input: ({ context }) => ({
|
|
1037
|
+
repoRoot: context.repoRoot,
|
|
1038
|
+
verbose: context.input.verbose
|
|
1039
|
+
}),
|
|
1040
|
+
onDone: {
|
|
1041
|
+
target: "done",
|
|
1042
|
+
actions: assign({
|
|
1043
|
+
phases: ({ context, event }) => ({
|
|
1044
|
+
...context.phases,
|
|
1045
|
+
supabaseStart: event.output.needed ? createPhaseResult(
|
|
1046
|
+
event.output.started || event.output.alreadyRunning ? "passed" : "skipped",
|
|
1047
|
+
0
|
|
1048
|
+
) : createPhaseResult("skipped", 0)
|
|
1049
|
+
}),
|
|
1050
|
+
supabaseRunning: ({ event }) => event.output.started || event.output.alreadyRunning,
|
|
1051
|
+
warnings: ({ context, event }) => event.output.warning ? [...context.warnings, event.output.warning] : context.warnings
|
|
1052
|
+
})
|
|
1053
|
+
},
|
|
1054
|
+
onError: {
|
|
1055
|
+
target: "done",
|
|
1056
|
+
// Non-blocking
|
|
1057
|
+
actions: assign({
|
|
1058
|
+
phases: ({ context, event }) => ({
|
|
1059
|
+
...context.phases,
|
|
1060
|
+
supabaseStart: createPhaseResult(
|
|
1061
|
+
"skipped",
|
|
1062
|
+
0,
|
|
1063
|
+
event.error instanceof Error ? event.error.message : String(event.error)
|
|
1064
|
+
)
|
|
1065
|
+
}),
|
|
1066
|
+
warnings: ({ context, event }) => [
|
|
1067
|
+
...context.warnings,
|
|
1068
|
+
`Supabase start skipped: ${event.error instanceof Error ? event.error.message : String(event.error)}`
|
|
1069
|
+
]
|
|
1070
|
+
})
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1074
|
+
done: {
|
|
1075
|
+
type: "final"
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1078
|
+
onDone: { target: "preClean" }
|
|
1079
|
+
},
|
|
1080
|
+
// ============================================================
|
|
1081
|
+
// Pre-Clean Decision State
|
|
1082
|
+
// ============================================================
|
|
1083
|
+
preClean: {
|
|
1084
|
+
always: [
|
|
1085
|
+
{ guard: "shouldFresh", target: "fresh" },
|
|
1086
|
+
{ guard: "shouldClean", target: "clean" },
|
|
1087
|
+
// Skip static analysis if --only doesn't include 'types' or 'lint'
|
|
1088
|
+
// If build is also skipped by --only, jump directly to dbSync.
|
|
1089
|
+
{
|
|
1090
|
+
guard: ({ context }) => guards.shouldSkipStaticAnalysis({ context }) && guards.shouldSkipBuild({ context }),
|
|
1091
|
+
target: "dbSync"
|
|
1092
|
+
},
|
|
1093
|
+
{ guard: "shouldSkipStaticAnalysis", target: "build" },
|
|
1094
|
+
{ target: "staticAnalysis" }
|
|
1095
|
+
]
|
|
1096
|
+
},
|
|
1097
|
+
// ============================================================
|
|
1098
|
+
// Clean Phase
|
|
1099
|
+
// ============================================================
|
|
1100
|
+
clean: {
|
|
1101
|
+
meta: { e2e: buildMachineE2EMeta.clean },
|
|
1102
|
+
invoke: {
|
|
1103
|
+
src: "clean",
|
|
1104
|
+
input: ({ context }) => ({
|
|
1105
|
+
repoRoot: context.repoRoot,
|
|
1106
|
+
tmpDir: context.tmpDir,
|
|
1107
|
+
verbose: context.input.verbose
|
|
1108
|
+
}),
|
|
1109
|
+
onDone: {
|
|
1110
|
+
target: "staticAnalysis",
|
|
1111
|
+
actions: assign({
|
|
1112
|
+
phases: ({ context, event }) => ({
|
|
1113
|
+
...context.phases,
|
|
1114
|
+
clean: createPhaseResult(
|
|
1115
|
+
event.output.passed ? "passed" : "failed",
|
|
1116
|
+
0,
|
|
1117
|
+
event.output.error
|
|
1118
|
+
)
|
|
1119
|
+
}),
|
|
1120
|
+
warnings: ({ context, event }) => event.output.error ? [...context.warnings, `Clean warning: ${event.output.error}`] : context.warnings
|
|
1121
|
+
})
|
|
1122
|
+
},
|
|
1123
|
+
onError: {
|
|
1124
|
+
target: "staticAnalysis",
|
|
1125
|
+
// Non-blocking
|
|
1126
|
+
actions: assign({
|
|
1127
|
+
phases: ({ context, event }) => ({
|
|
1128
|
+
...context.phases,
|
|
1129
|
+
clean: createPhaseResult(
|
|
1130
|
+
"failed",
|
|
1131
|
+
0,
|
|
1132
|
+
event.error instanceof Error ? event.error.message : String(event.error)
|
|
1133
|
+
)
|
|
1134
|
+
}),
|
|
1135
|
+
warnings: ({ context, event }) => [
|
|
1136
|
+
...context.warnings,
|
|
1137
|
+
`Clean failed: ${event.error instanceof Error ? event.error.message : String(event.error)}`
|
|
1138
|
+
]
|
|
1139
|
+
})
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
// ============================================================
|
|
1144
|
+
// Fresh Phase
|
|
1145
|
+
// ============================================================
|
|
1146
|
+
fresh: {
|
|
1147
|
+
meta: { e2e: buildMachineE2EMeta.fresh },
|
|
1148
|
+
invoke: {
|
|
1149
|
+
src: "fresh",
|
|
1150
|
+
input: ({ context }) => ({
|
|
1151
|
+
repoRoot: context.repoRoot,
|
|
1152
|
+
tmpDir: context.tmpDir,
|
|
1153
|
+
verbose: context.input.verbose
|
|
1154
|
+
}),
|
|
1155
|
+
onDone: {
|
|
1156
|
+
target: "staticAnalysis",
|
|
1157
|
+
actions: assign({
|
|
1158
|
+
phases: ({ context, event }) => ({
|
|
1159
|
+
...context.phases,
|
|
1160
|
+
fresh: createPhaseResult(
|
|
1161
|
+
event.output.passed ? "passed" : "failed",
|
|
1162
|
+
0,
|
|
1163
|
+
event.output.error
|
|
1164
|
+
)
|
|
1165
|
+
})
|
|
1166
|
+
})
|
|
1167
|
+
},
|
|
1168
|
+
onError: {
|
|
1169
|
+
target: "failed",
|
|
1170
|
+
// Blocking
|
|
1171
|
+
actions: assign({
|
|
1172
|
+
error: ({ event }) => `Fresh install failed: ${event.error instanceof Error ? event.error.message : String(event.error)}`,
|
|
1173
|
+
phases: ({ context, event }) => ({
|
|
1174
|
+
...context.phases,
|
|
1175
|
+
fresh: createPhaseResult(
|
|
1176
|
+
"failed",
|
|
1177
|
+
0,
|
|
1178
|
+
event.error instanceof Error ? event.error.message : String(event.error)
|
|
1179
|
+
)
|
|
1180
|
+
})
|
|
1181
|
+
})
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
},
|
|
1185
|
+
// ============================================================
|
|
1186
|
+
// Static Analysis Phase
|
|
1187
|
+
// ============================================================
|
|
1188
|
+
staticAnalysis: {
|
|
1189
|
+
meta: { e2e: buildMachineE2EMeta.staticAnalysis },
|
|
1190
|
+
invoke: {
|
|
1191
|
+
src: "staticChecks",
|
|
1192
|
+
input: ({ context }) => ({
|
|
1193
|
+
repoRoot: context.repoRoot,
|
|
1194
|
+
tmpDir: context.tmpDir,
|
|
1195
|
+
hasTurbo: context.hasTurbo,
|
|
1196
|
+
// Pass skip flags for --only option
|
|
1197
|
+
skipTypes: guards.shouldSkipTypes({ context }),
|
|
1198
|
+
skipLint: guards.shouldSkipLint({ context })
|
|
1199
|
+
}),
|
|
1200
|
+
onDone: [
|
|
1201
|
+
{
|
|
1202
|
+
guard: ({ event }) => !event.output.passed,
|
|
1203
|
+
target: "failed",
|
|
1204
|
+
actions: assign({
|
|
1205
|
+
error: ({ event }) => event.output.error ?? "Static analysis failed",
|
|
1206
|
+
phases: ({ context, event }) => ({
|
|
1207
|
+
...context.phases,
|
|
1208
|
+
typeCheck: createPhaseResult(
|
|
1209
|
+
event.output.typeCheckPassed ? "passed" : "failed",
|
|
1210
|
+
event.output.typeCheckDurationMs ?? 0
|
|
1211
|
+
),
|
|
1212
|
+
lint: createPhaseResult(
|
|
1213
|
+
event.output.lintPassed ? "passed" : "failed",
|
|
1214
|
+
event.output.lintDurationMs ?? 0
|
|
1215
|
+
)
|
|
1216
|
+
})
|
|
1217
|
+
})
|
|
1218
|
+
},
|
|
1219
|
+
// Skip build if --only doesn't include 'build'
|
|
1220
|
+
{
|
|
1221
|
+
guard: "shouldSkipBuild",
|
|
1222
|
+
target: "dbSync",
|
|
1223
|
+
actions: assign({
|
|
1224
|
+
phases: ({ context, event }) => ({
|
|
1225
|
+
...context.phases,
|
|
1226
|
+
typeCheck: createPhaseResult(
|
|
1227
|
+
guards.shouldSkipTypes({ context }) ? "skipped" : "passed",
|
|
1228
|
+
event.output.typeCheckDurationMs ?? 0
|
|
1229
|
+
),
|
|
1230
|
+
lint: createPhaseResult(
|
|
1231
|
+
guards.shouldSkipLint({ context }) ? "skipped" : "passed",
|
|
1232
|
+
event.output.lintDurationMs ?? 0
|
|
1233
|
+
),
|
|
1234
|
+
build: createPhaseResult("skipped", 0)
|
|
1235
|
+
})
|
|
1236
|
+
})
|
|
1237
|
+
},
|
|
1238
|
+
{
|
|
1239
|
+
target: "build",
|
|
1240
|
+
actions: assign({
|
|
1241
|
+
phases: ({ context, event }) => ({
|
|
1242
|
+
...context.phases,
|
|
1243
|
+
typeCheck: createPhaseResult(
|
|
1244
|
+
guards.shouldSkipTypes({ context }) ? "skipped" : "passed",
|
|
1245
|
+
event.output.typeCheckDurationMs ?? 0
|
|
1246
|
+
),
|
|
1247
|
+
lint: createPhaseResult(
|
|
1248
|
+
guards.shouldSkipLint({ context }) ? "skipped" : "passed",
|
|
1249
|
+
event.output.lintDurationMs ?? 0
|
|
1250
|
+
)
|
|
1251
|
+
})
|
|
1252
|
+
})
|
|
1253
|
+
}
|
|
1254
|
+
],
|
|
1255
|
+
onError: {
|
|
1256
|
+
target: "failed",
|
|
1257
|
+
actions: assign({
|
|
1258
|
+
error: ({ event }) => `Static analysis failed: ${event.error instanceof Error ? event.error.message : String(event.error)}`,
|
|
1259
|
+
phases: ({ context, event }) => ({
|
|
1260
|
+
...context.phases,
|
|
1261
|
+
typeCheck: createPhaseResult(
|
|
1262
|
+
"failed",
|
|
1263
|
+
0,
|
|
1264
|
+
event.error instanceof Error ? event.error.message : String(event.error)
|
|
1265
|
+
),
|
|
1266
|
+
lint: createPhaseResult("skipped", 0)
|
|
1267
|
+
})
|
|
1268
|
+
})
|
|
1269
|
+
}
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1272
|
+
// ============================================================
|
|
1273
|
+
// Build Phase
|
|
1274
|
+
// ============================================================
|
|
1275
|
+
build: {
|
|
1276
|
+
meta: { e2e: buildMachineE2EMeta.build },
|
|
1277
|
+
invoke: {
|
|
1278
|
+
src: "build",
|
|
1279
|
+
input: ({ context }) => ({
|
|
1280
|
+
repoRoot: context.repoRoot,
|
|
1281
|
+
tmpDir: context.tmpDir,
|
|
1282
|
+
hasTurbo: context.hasTurbo,
|
|
1283
|
+
e2e: context.input.e2e
|
|
1284
|
+
}),
|
|
1285
|
+
onDone: [
|
|
1286
|
+
{
|
|
1287
|
+
guard: ({ event }) => !event.output.passed,
|
|
1288
|
+
target: "failed",
|
|
1289
|
+
actions: assign({
|
|
1290
|
+
error: ({ event }) => event.output.error ?? "Build failed",
|
|
1291
|
+
phases: ({ context, event }) => ({
|
|
1292
|
+
...context.phases,
|
|
1293
|
+
build: createPhaseResult("failed", event.output.durationMs, event.output.error)
|
|
1294
|
+
})
|
|
1295
|
+
})
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
target: "dbSync",
|
|
1299
|
+
actions: assign({
|
|
1300
|
+
phases: ({ context, event }) => ({
|
|
1301
|
+
...context.phases,
|
|
1302
|
+
build: createPhaseResult("passed", event.output.durationMs)
|
|
1303
|
+
})
|
|
1304
|
+
})
|
|
1305
|
+
}
|
|
1306
|
+
],
|
|
1307
|
+
onError: {
|
|
1308
|
+
target: "failed",
|
|
1309
|
+
actions: assign({
|
|
1310
|
+
error: ({ event }) => `Build failed: ${event.error instanceof Error ? event.error.message : String(event.error)}`,
|
|
1311
|
+
phases: ({ context, event }) => ({
|
|
1312
|
+
...context.phases,
|
|
1313
|
+
build: createPhaseResult(
|
|
1314
|
+
"failed",
|
|
1315
|
+
0,
|
|
1316
|
+
event.error instanceof Error ? event.error.message : String(event.error)
|
|
1317
|
+
)
|
|
1318
|
+
})
|
|
1319
|
+
})
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
},
|
|
1323
|
+
// ============================================================
|
|
1324
|
+
// DB Sync Phase
|
|
1325
|
+
// ============================================================
|
|
1326
|
+
dbSync: {
|
|
1327
|
+
meta: { e2e: buildMachineE2EMeta.dbSync },
|
|
1328
|
+
always: [{ guard: "shouldSkipDb", target: "manifest" }],
|
|
1329
|
+
invoke: {
|
|
1330
|
+
src: "dbSync",
|
|
1331
|
+
input: ({ context }) => ({
|
|
1332
|
+
repoRoot: context.repoRoot,
|
|
1333
|
+
tmpDir: context.tmpDir,
|
|
1334
|
+
supabaseRunning: context.supabaseRunning
|
|
1335
|
+
}),
|
|
1336
|
+
onDone: {
|
|
1337
|
+
target: "manifest",
|
|
1338
|
+
actions: assign({
|
|
1339
|
+
phases: ({ context, event }) => ({
|
|
1340
|
+
...context.phases,
|
|
1341
|
+
dbSync: createPhaseResult(
|
|
1342
|
+
event.output.passed ? "passed" : "failed",
|
|
1343
|
+
event.output.durationMs,
|
|
1344
|
+
event.output.error
|
|
1345
|
+
)
|
|
1346
|
+
}),
|
|
1347
|
+
warnings: ({ context, event }) => {
|
|
1348
|
+
const newWarnings = [...context.warnings];
|
|
1349
|
+
if (event.output.warning) {
|
|
1350
|
+
const normalizedWarning = event.output.warning.toLowerCase();
|
|
1351
|
+
const hasSupabaseSetupWarning = context.warnings.some(
|
|
1352
|
+
(warning) => warning.toLowerCase().includes("supabase start skipped")
|
|
1353
|
+
);
|
|
1354
|
+
const isSupabaseNotRunningWarning = normalizedWarning.includes(
|
|
1355
|
+
"supabase is not running for this repo"
|
|
1356
|
+
);
|
|
1357
|
+
const shouldSkipSupabaseDuplicate = hasSupabaseSetupWarning && isSupabaseNotRunningWarning;
|
|
1358
|
+
if (!shouldSkipSupabaseDuplicate && !newWarnings.includes(event.output.warning)) {
|
|
1359
|
+
newWarnings.push(event.output.warning);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
if (!event.output.passed && event.output.error) {
|
|
1363
|
+
const dbSyncErrorWarning = `DB sync failed: ${event.output.error}`;
|
|
1364
|
+
if (!newWarnings.includes(dbSyncErrorWarning)) {
|
|
1365
|
+
newWarnings.push(dbSyncErrorWarning);
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
return newWarnings;
|
|
1369
|
+
}
|
|
1370
|
+
})
|
|
1371
|
+
},
|
|
1372
|
+
onError: {
|
|
1373
|
+
target: "manifest",
|
|
1374
|
+
// Non-blocking
|
|
1375
|
+
actions: assign({
|
|
1376
|
+
phases: ({ context, event }) => ({
|
|
1377
|
+
...context.phases,
|
|
1378
|
+
dbSync: createPhaseResult(
|
|
1379
|
+
"failed",
|
|
1380
|
+
0,
|
|
1381
|
+
event.error instanceof Error ? event.error.message : String(event.error)
|
|
1382
|
+
)
|
|
1383
|
+
}),
|
|
1384
|
+
warnings: ({ context, event }) => [
|
|
1385
|
+
...context.warnings,
|
|
1386
|
+
`DB sync failed: ${event.error instanceof Error ? event.error.message : String(event.error)}`
|
|
1387
|
+
]
|
|
1388
|
+
})
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
},
|
|
1392
|
+
// ============================================================
|
|
1393
|
+
// Manifest Phase
|
|
1394
|
+
// ============================================================
|
|
1395
|
+
manifest: {
|
|
1396
|
+
meta: { e2e: buildMachineE2EMeta.manifest },
|
|
1397
|
+
always: [{ guard: "shouldSkipManifest", target: "validate" }],
|
|
1398
|
+
invoke: {
|
|
1399
|
+
src: "manifest",
|
|
1400
|
+
input: ({ context }) => ({
|
|
1401
|
+
repoRoot: context.repoRoot,
|
|
1402
|
+
tmpDir: context.tmpDir
|
|
1403
|
+
}),
|
|
1404
|
+
onDone: {
|
|
1405
|
+
target: "validate",
|
|
1406
|
+
actions: assign({
|
|
1407
|
+
phases: ({ context, event }) => ({
|
|
1408
|
+
...context.phases,
|
|
1409
|
+
manifest: createPhaseResult(
|
|
1410
|
+
event.output.passed ? "passed" : "failed",
|
|
1411
|
+
event.output.durationMs,
|
|
1412
|
+
event.output.error
|
|
1413
|
+
)
|
|
1414
|
+
}),
|
|
1415
|
+
error: ({ context, event }) => !event.output.passed ? event.output.error ?? context.error : context.error,
|
|
1416
|
+
warnings: ({ context, event }) => event.output.warning ? [...context.warnings, event.output.warning] : context.warnings
|
|
1417
|
+
})
|
|
1418
|
+
},
|
|
1419
|
+
onError: {
|
|
1420
|
+
target: "validate",
|
|
1421
|
+
// Non-blocking
|
|
1422
|
+
actions: assign({
|
|
1423
|
+
phases: ({ context, event }) => ({
|
|
1424
|
+
...context.phases,
|
|
1425
|
+
manifest: createPhaseResult(
|
|
1426
|
+
"failed",
|
|
1427
|
+
0,
|
|
1428
|
+
event.error instanceof Error ? event.error.message : String(event.error)
|
|
1429
|
+
)
|
|
1430
|
+
}),
|
|
1431
|
+
warnings: ({ context, event }) => [
|
|
1432
|
+
...context.warnings,
|
|
1433
|
+
`Manifest generation failed: ${event.error instanceof Error ? event.error.message : String(event.error)}`
|
|
1434
|
+
]
|
|
1435
|
+
})
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
},
|
|
1439
|
+
// ============================================================
|
|
1440
|
+
// Validate Phase
|
|
1441
|
+
// ============================================================
|
|
1442
|
+
validate: {
|
|
1443
|
+
meta: { e2e: buildMachineE2EMeta.validate },
|
|
1444
|
+
invoke: {
|
|
1445
|
+
src: "validate",
|
|
1446
|
+
input: ({ context }) => ({
|
|
1447
|
+
repoRoot: context.repoRoot,
|
|
1448
|
+
skipManifest: context.input.skipManifest || !context.hasManifestTask,
|
|
1449
|
+
skipTables: context.input.skipDb || !context.hasDatabase
|
|
1450
|
+
}),
|
|
1451
|
+
onDone: {
|
|
1452
|
+
target: "done",
|
|
1453
|
+
actions: assign({
|
|
1454
|
+
phases: ({ context, event }) => ({
|
|
1455
|
+
...context.phases,
|
|
1456
|
+
validate: createPhaseResult(
|
|
1457
|
+
event.output.passed ? "passed" : "failed",
|
|
1458
|
+
0,
|
|
1459
|
+
event.output.error
|
|
1460
|
+
)
|
|
1461
|
+
}),
|
|
1462
|
+
error: ({ context, event }) => !event.output.passed ? event.output.error ?? context.error : context.error,
|
|
1463
|
+
warnings: ({ context, event }) => [...context.warnings, ...event.output.warnings]
|
|
1464
|
+
})
|
|
1465
|
+
},
|
|
1466
|
+
onError: {
|
|
1467
|
+
target: "done",
|
|
1468
|
+
// Non-blocking
|
|
1469
|
+
actions: assign({
|
|
1470
|
+
phases: ({ context, event }) => ({
|
|
1471
|
+
...context.phases,
|
|
1472
|
+
validate: createPhaseResult(
|
|
1473
|
+
"failed",
|
|
1474
|
+
0,
|
|
1475
|
+
event.error instanceof Error ? event.error.message : String(event.error)
|
|
1476
|
+
)
|
|
1477
|
+
}),
|
|
1478
|
+
warnings: ({ context, event }) => [
|
|
1479
|
+
...context.warnings,
|
|
1480
|
+
`Validation failed: ${event.error instanceof Error ? event.error.message : String(event.error)}`
|
|
1481
|
+
]
|
|
1482
|
+
})
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
// ============================================================
|
|
1487
|
+
// Final States
|
|
1488
|
+
// ============================================================
|
|
1489
|
+
done: {
|
|
1490
|
+
meta: { e2e: buildMachineE2EMeta.done },
|
|
1491
|
+
type: "final"
|
|
1492
|
+
},
|
|
1493
|
+
failed: {
|
|
1494
|
+
meta: { e2e: buildMachineE2EMeta.failed },
|
|
1495
|
+
type: "final"
|
|
1496
|
+
}
|
|
1497
|
+
},
|
|
1498
|
+
output: ({ context }) => createOutput(context)
|
|
1499
|
+
});
|
|
1500
|
+
function getStateName(snapshot) {
|
|
1501
|
+
return getSnapshotStateName(snapshot);
|
|
1502
|
+
}
|
|
1503
|
+
function isComplete(snapshot) {
|
|
1504
|
+
return isSnapshotComplete(snapshot);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
// src/commands/build/commands/build.ts
|
|
1508
|
+
function parseOnlyOption(only) {
|
|
1509
|
+
if (!only) return void 0;
|
|
1510
|
+
const phases = only.split(",").map((p) => p.trim().toLowerCase());
|
|
1511
|
+
const valid = [];
|
|
1512
|
+
const invalid = [];
|
|
1513
|
+
for (const phase of phases) {
|
|
1514
|
+
if (VALID_BUILD_PHASES.includes(phase)) {
|
|
1515
|
+
valid.push(phase);
|
|
1516
|
+
} else {
|
|
1517
|
+
invalid.push(phase);
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
if (invalid.length > 0) {
|
|
1521
|
+
throw new CLIError(`Invalid phases: ${invalid.join(", ")}`, "INVALID_PHASES", [
|
|
1522
|
+
`Valid phases: ${VALID_BUILD_PHASES.join(", ")}`
|
|
1523
|
+
]);
|
|
1524
|
+
}
|
|
1525
|
+
return valid.length > 0 ? valid : void 0;
|
|
1526
|
+
}
|
|
1527
|
+
var handleStateChange = createMachineStateChangeLogger({
|
|
1528
|
+
getState: getStateName,
|
|
1529
|
+
getContext: (snapshot) => snapshot.context,
|
|
1530
|
+
handlers: {
|
|
1531
|
+
idle: (logger) => {
|
|
1532
|
+
logger.section("Build");
|
|
1533
|
+
logger.info("Starting smart build...");
|
|
1534
|
+
},
|
|
1535
|
+
dryRun: (_logger) => {
|
|
1536
|
+
},
|
|
1537
|
+
setup: (logger) => {
|
|
1538
|
+
logger.section("Phase 0: Auto-Setup");
|
|
1539
|
+
logger.info("Checking environment prerequisites...");
|
|
1540
|
+
},
|
|
1541
|
+
"setup.depsInstall": (logger) => {
|
|
1542
|
+
logger.info(" Checking dependencies...");
|
|
1543
|
+
},
|
|
1544
|
+
"setup.envCheck": (logger) => {
|
|
1545
|
+
logger.info(" Checking environment variables...");
|
|
1546
|
+
},
|
|
1547
|
+
"setup.supabaseStart": (logger) => {
|
|
1548
|
+
logger.info(" Checking Supabase...");
|
|
1549
|
+
},
|
|
1550
|
+
preClean: (_logger) => {
|
|
1551
|
+
},
|
|
1552
|
+
clean: (logger) => {
|
|
1553
|
+
logger.section("Phase 1: Clean");
|
|
1554
|
+
logger.info("Cleaning build caches...");
|
|
1555
|
+
},
|
|
1556
|
+
fresh: (logger) => {
|
|
1557
|
+
logger.section("Phase 1: Fresh Install");
|
|
1558
|
+
logger.info("Cleaning all caches and reinstalling dependencies...");
|
|
1559
|
+
},
|
|
1560
|
+
staticAnalysis: (logger) => {
|
|
1561
|
+
logger.section("Phase 2: Static Analysis");
|
|
1562
|
+
logger.info("Running type-check and lint in parallel...");
|
|
1563
|
+
},
|
|
1564
|
+
build: (logger) => {
|
|
1565
|
+
logger.section("Phase 3: Build");
|
|
1566
|
+
logger.info("Building project...");
|
|
1567
|
+
},
|
|
1568
|
+
dbSync: (logger) => {
|
|
1569
|
+
logger.section("Phase 4: Database Sync");
|
|
1570
|
+
logger.info("Syncing database schema and generating types...");
|
|
1571
|
+
},
|
|
1572
|
+
manifest: (logger) => {
|
|
1573
|
+
logger.section("Phase 5: Manifest Generation");
|
|
1574
|
+
logger.info("Generating manifests for E2E tests...");
|
|
1575
|
+
},
|
|
1576
|
+
validate: (logger) => {
|
|
1577
|
+
logger.section("Phase 6: Validation");
|
|
1578
|
+
logger.info("Validating build outputs...");
|
|
1579
|
+
}
|
|
1580
|
+
},
|
|
1581
|
+
useParentState: true
|
|
1582
|
+
});
|
|
1583
|
+
function formatDuration(ms) {
|
|
1584
|
+
if (ms < 1e3) return `${ms}ms`;
|
|
1585
|
+
const seconds = Math.floor(ms / 1e3);
|
|
1586
|
+
const minutes = Math.floor(seconds / 60);
|
|
1587
|
+
if (minutes > 0) {
|
|
1588
|
+
const remainingSeconds = seconds % 60;
|
|
1589
|
+
return `${minutes}m ${remainingSeconds}s`;
|
|
1590
|
+
}
|
|
1591
|
+
return `${seconds}s`;
|
|
1592
|
+
}
|
|
1593
|
+
function getPhaseIcon(status) {
|
|
1594
|
+
if (status === "passed") return "\u2705";
|
|
1595
|
+
if (status === "failed") return "\u274C";
|
|
1596
|
+
return "\u23ED\uFE0F";
|
|
1597
|
+
}
|
|
1598
|
+
function printPhaseResults(logger, phases) {
|
|
1599
|
+
for (const { name, result } of phases) {
|
|
1600
|
+
if (!result) continue;
|
|
1601
|
+
const icon = getPhaseIcon(result.status);
|
|
1602
|
+
const duration = result.durationMs > 0 ? ` (${formatDuration(result.durationMs)})` : "";
|
|
1603
|
+
logger.info(` ${name}: ${icon} ${result.status.toUpperCase()}${duration}`);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
function printWarnings(logger, warnings) {
|
|
1607
|
+
if (!warnings || warnings.length === 0) return;
|
|
1608
|
+
logger.info("");
|
|
1609
|
+
logger.warn("Warnings:");
|
|
1610
|
+
for (const warning of warnings) {
|
|
1611
|
+
logger.warn(` \u26A0\uFE0F ${warning}`);
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
function printSummary(logger, output) {
|
|
1615
|
+
logger.section("Summary");
|
|
1616
|
+
const phases = [
|
|
1617
|
+
{ name: "Deps Install", result: output.phases.depsInstall },
|
|
1618
|
+
{ name: "Env Check", result: output.phases.envCheck },
|
|
1619
|
+
{ name: "Supabase", result: output.phases.supabaseStart },
|
|
1620
|
+
{ name: "Clean", result: output.phases.clean },
|
|
1621
|
+
{ name: "Fresh", result: output.phases.fresh },
|
|
1622
|
+
{ name: "Type Check", result: output.phases.typeCheck },
|
|
1623
|
+
{ name: "Lint", result: output.phases.lint },
|
|
1624
|
+
{ name: "Build", result: output.phases.build },
|
|
1625
|
+
{ name: "DB Sync", result: output.phases.dbSync },
|
|
1626
|
+
{ name: "Manifest", result: output.phases.manifest },
|
|
1627
|
+
{ name: "Validate", result: output.phases.validate }
|
|
1628
|
+
];
|
|
1629
|
+
printPhaseResults(logger, phases);
|
|
1630
|
+
printWarnings(logger, output.warnings);
|
|
1631
|
+
logger.info("");
|
|
1632
|
+
logger.info(`Total time: ${formatDuration(output.durationMs)}`);
|
|
1633
|
+
if (output.success) {
|
|
1634
|
+
const hasWarnings = output.warnings && output.warnings.length > 0;
|
|
1635
|
+
if (hasWarnings) {
|
|
1636
|
+
logger.success("Build completed with warnings.");
|
|
1637
|
+
} else {
|
|
1638
|
+
logger.success("Build completed successfully!");
|
|
1639
|
+
}
|
|
1640
|
+
} else {
|
|
1641
|
+
logger.error(`Build failed: ${output.error}`);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
async function runBuildMachine(input, logger) {
|
|
1645
|
+
const repoRoot = input.targetDir ?? findRepoRoot(process.cwd());
|
|
1646
|
+
return new Promise((resolve, reject) => {
|
|
1647
|
+
const actor = createActor(buildMachine, {
|
|
1648
|
+
input: { input, repoRoot }
|
|
1649
|
+
});
|
|
1650
|
+
let previousState = "";
|
|
1651
|
+
actor.subscribe((snapshot) => {
|
|
1652
|
+
const currentState = getStateName(snapshot);
|
|
1653
|
+
if (currentState !== previousState) {
|
|
1654
|
+
handleStateChange(snapshot, previousState, logger);
|
|
1655
|
+
previousState = currentState;
|
|
1656
|
+
}
|
|
1657
|
+
if (isComplete(snapshot)) {
|
|
1658
|
+
const output = snapshot.output;
|
|
1659
|
+
if (output) {
|
|
1660
|
+
resolve(output);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
actor.subscribe({
|
|
1665
|
+
error: (error) => {
|
|
1666
|
+
reject(error);
|
|
1667
|
+
actor.stop();
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
actor.start();
|
|
1671
|
+
actor.send({ type: "START" });
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
async function runBuildAction(options, cmd) {
|
|
1675
|
+
const logger = createCLILogger("build");
|
|
1676
|
+
try {
|
|
1677
|
+
const result = await runBuildMachine(options, logger);
|
|
1678
|
+
printSummary(logger, result);
|
|
1679
|
+
emitJsonSuccess(cmd, BuildOutputSchema, result);
|
|
1680
|
+
if (!result.success) {
|
|
1681
|
+
throw new CLIError(result.error ?? "Build failed", "BUILD_FAILED", [
|
|
1682
|
+
"Run: runa check --verbose (diagnose environment)",
|
|
1683
|
+
"Run: runa db sync (if schema types missing)",
|
|
1684
|
+
"Check logs in .runa/tmp/build/ for details"
|
|
1685
|
+
]);
|
|
1686
|
+
}
|
|
1687
|
+
} catch (error) {
|
|
1688
|
+
if (error instanceof CLIError) {
|
|
1689
|
+
throw error;
|
|
1690
|
+
}
|
|
1691
|
+
throw new CLIError(
|
|
1692
|
+
error instanceof Error ? error.message : String(error),
|
|
1693
|
+
"BUILD_ERROR",
|
|
1694
|
+
[
|
|
1695
|
+
"Run: runa check --verbose (diagnose environment)",
|
|
1696
|
+
"Check logs in .runa/tmp/build/ for details"
|
|
1697
|
+
],
|
|
1698
|
+
error instanceof Error ? error : void 0
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
var buildCommand = new Command("build").description("Smart build with auto-setup (like vercel build / next build)").option("--e2e", "Enable E2E mode (test attributes + fresh cache)").option("--clean", "Clear build caches before building").option("--fresh", "Full clean (including node_modules) + reinstall").option("--skip-db", "Skip database sync step").option("--skip-manifest", "Skip manifest generation step").option("--no-setup", "Skip auto-setup phase (deps, env, Supabase)").option("--verbose", "Show detailed output").option("--check", "Dry-run mode (show what would be done)").option("--target-dir <path>", "Target directory (defaults to repo root)").option("--only <phases>", "Only run specific phases (types,lint,build,db,manifest)").action(async (options, cmd) => {
|
|
1703
|
+
const input = {
|
|
1704
|
+
e2e: options.e2e ?? false,
|
|
1705
|
+
clean: options.clean ?? false,
|
|
1706
|
+
fresh: options.fresh ?? false,
|
|
1707
|
+
skipDb: options.skipDb ?? false,
|
|
1708
|
+
skipManifest: options.skipManifest ?? false,
|
|
1709
|
+
verbose: options.verbose ?? false,
|
|
1710
|
+
check: options.check ?? false,
|
|
1711
|
+
noSetup: options.setup === false,
|
|
1712
|
+
// --no-setup sets setup to false
|
|
1713
|
+
targetDir: options.targetDir,
|
|
1714
|
+
only: parseOnlyOption(options.only)
|
|
1715
|
+
};
|
|
1716
|
+
await runBuildAction(input, cmd);
|
|
1717
|
+
});
|
|
1718
|
+
|
|
1719
|
+
export { BuildInputSchema, BuildOutputSchema, buildCommand };
|