@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,254 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { findPackage, findWorkspaceRoot } from './chunk-JMJP4A47.js';
|
|
4
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
5
|
+
import { existsSync, readFileSync } from 'fs';
|
|
6
|
+
import path, { join } from 'path';
|
|
7
|
+
import { loadRunaConfigOrThrow } from '@runa-ai/runa';
|
|
8
|
+
|
|
9
|
+
createRequire(import.meta.url);
|
|
10
|
+
|
|
11
|
+
// src/utils/config-loader.ts
|
|
12
|
+
init_esm_shims();
|
|
13
|
+
function getDefaultDrizzlePaths(isMonorepo2) {
|
|
14
|
+
if (!isMonorepo2) {
|
|
15
|
+
return { schemaPath: "src/schema", outputPath: "src/zod" };
|
|
16
|
+
}
|
|
17
|
+
const workspaceRoot = findWorkspaceRoot(process.cwd()) || process.cwd();
|
|
18
|
+
const databaseSchemaDir = join(workspaceRoot, "packages", "database", "src", "schema");
|
|
19
|
+
if (existsSync(databaseSchemaDir)) {
|
|
20
|
+
return {
|
|
21
|
+
schemaPath: "packages/database/src/schema",
|
|
22
|
+
outputPath: "packages/database/src/zod"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
schemaPath: "packages/db/src/schema",
|
|
27
|
+
outputPath: "packages/db/src/zod"
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var _configCache = /* @__PURE__ */ new Map();
|
|
31
|
+
function loadRunaConfig(cwd = process.cwd()) {
|
|
32
|
+
const cached = _configCache.get(cwd);
|
|
33
|
+
if (cached) return cached;
|
|
34
|
+
const config = loadRunaConfigOrThrow(cwd).config;
|
|
35
|
+
_configCache.set(cwd, config);
|
|
36
|
+
return config;
|
|
37
|
+
}
|
|
38
|
+
function getDatabaseConfig(config) {
|
|
39
|
+
const dbConfig = config.database;
|
|
40
|
+
if (!dbConfig) {
|
|
41
|
+
const defaults = getDefaultDrizzlePaths(config.project.monorepo ?? false);
|
|
42
|
+
return {
|
|
43
|
+
type: "supabase",
|
|
44
|
+
schemaPath: defaults.schemaPath,
|
|
45
|
+
outputPath: defaults.outputPath
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (dbConfig.type === "supabase" || dbConfig.type === void 0) {
|
|
49
|
+
const defaults = getDefaultDrizzlePaths(config.project.monorepo ?? false);
|
|
50
|
+
return {
|
|
51
|
+
type: "supabase",
|
|
52
|
+
schemaPath: dbConfig.drizzle?.schemaPath || defaults.schemaPath,
|
|
53
|
+
outputPath: dbConfig.drizzle?.outputPath || defaults.outputPath
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
type: "none",
|
|
58
|
+
schemaPath: "",
|
|
59
|
+
outputPath: ""
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function getAppConfig(config) {
|
|
63
|
+
return {
|
|
64
|
+
directory: config.app?.directory || ".",
|
|
65
|
+
framework: config.app?.framework || "next"
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function getDeployConfig(config) {
|
|
69
|
+
const preview = config.deploy?.environments?.preview || "preview";
|
|
70
|
+
const production = config.deploy?.environments?.production || "production";
|
|
71
|
+
return {
|
|
72
|
+
provider: config.deploy?.provider || "vercel",
|
|
73
|
+
environments: {
|
|
74
|
+
preview,
|
|
75
|
+
production
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function isMonorepo(config) {
|
|
80
|
+
return config.project.monorepo ?? false;
|
|
81
|
+
}
|
|
82
|
+
function validateProjectName(config, errors) {
|
|
83
|
+
if (!config.project.name) {
|
|
84
|
+
errors.push("project.name is required");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function validateFramework(config, errors) {
|
|
88
|
+
if (config.app?.framework) {
|
|
89
|
+
const validFrameworks = ["next", "vite", "remix"];
|
|
90
|
+
if (!validFrameworks.includes(config.app.framework)) {
|
|
91
|
+
errors.push(
|
|
92
|
+
`app.framework must be one of: ${validFrameworks.join(", ")} (got: ${config.app.framework})`
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function validateDeploymentProvider(config, errors) {
|
|
98
|
+
if (config.deploy?.provider) {
|
|
99
|
+
const validProviders = ["vercel", "cloudflare", "amplify", "none"];
|
|
100
|
+
if (!validProviders.includes(config.deploy.provider)) {
|
|
101
|
+
errors.push(
|
|
102
|
+
`deploy.provider must be one of: ${validProviders.join(", ")} (got: ${config.deploy.provider})`
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function validateDatabaseType(config, errors) {
|
|
108
|
+
if (config.database?.type) {
|
|
109
|
+
const validTypes = ["supabase", "none"];
|
|
110
|
+
if (!validTypes.includes(config.database.type)) {
|
|
111
|
+
errors.push(
|
|
112
|
+
`database.type must be one of: ${validTypes.join(", ")} (got: ${config.database.type})`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function validateDrizzleConfig(config, errors) {
|
|
118
|
+
if (config.database?.drizzle) {
|
|
119
|
+
if (config.database.drizzle.schemaPath && !config.database.drizzle.schemaPath.trim()) {
|
|
120
|
+
errors.push("database.drizzle.schemaPath cannot be empty");
|
|
121
|
+
}
|
|
122
|
+
if (config.database.drizzle.outputPath && !config.database.drizzle.outputPath.trim()) {
|
|
123
|
+
errors.push("database.drizzle.outputPath cannot be empty");
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function validateAppDirectory(config, errors) {
|
|
128
|
+
if (config.app?.directory && !config.app.directory.trim()) {
|
|
129
|
+
errors.push("app.directory cannot be empty");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function validateRunaConfig(config) {
|
|
133
|
+
const errors = [];
|
|
134
|
+
validateProjectName(config, errors);
|
|
135
|
+
validateFramework(config, errors);
|
|
136
|
+
validateDeploymentProvider(config, errors);
|
|
137
|
+
validateDatabaseType(config, errors);
|
|
138
|
+
validateDrizzleConfig(config, errors);
|
|
139
|
+
validateAppDirectory(config, errors);
|
|
140
|
+
return {
|
|
141
|
+
valid: errors.length === 0,
|
|
142
|
+
errors
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function hasValidDatabaseIndicators(dir) {
|
|
146
|
+
const hasPrimaryIndicator = existsSync(path.join(dir, "drizzle.config.ts")) || existsSync(path.join(dir, "supabase", "schemas")) || existsSync(path.join(dir, "src", "schema")) || existsSync(path.join(dir, "scripts", "db-sync.ts"));
|
|
147
|
+
if (hasPrimaryIndicator) {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
const pkgJsonPath = path.join(dir, "package.json");
|
|
151
|
+
if (existsSync(pkgJsonPath)) {
|
|
152
|
+
try {
|
|
153
|
+
const pkgJson = JSON.parse(readFileSync(pkgJsonPath, "utf-8"));
|
|
154
|
+
const name = pkgJson.name?.toLowerCase() ?? "";
|
|
155
|
+
if (name.includes("database") || name.endsWith("-db") || name.endsWith("/db")) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
} catch {
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
function tryResolveFromConfig(cwd) {
|
|
164
|
+
try {
|
|
165
|
+
const loaded = loadRunaConfigOrThrow(cwd);
|
|
166
|
+
const configDir = path.dirname(loaded.configPath);
|
|
167
|
+
const config = loaded.config;
|
|
168
|
+
if (config.project.monorepo === false && hasValidDatabaseIndicators(configDir)) {
|
|
169
|
+
return configDir;
|
|
170
|
+
}
|
|
171
|
+
const dbConfig = getDatabaseConfig(config);
|
|
172
|
+
const schemaPath = dbConfig.schemaPath;
|
|
173
|
+
const dbPath = schemaPath.includes("/src/") ? schemaPath.split("/src/")[0] : schemaPath.startsWith("src/") ? "." : path.dirname(schemaPath);
|
|
174
|
+
const fullPath = dbPath === "." ? configDir : path.join(configDir, dbPath);
|
|
175
|
+
return existsSync(fullPath) ? fullPath : null;
|
|
176
|
+
} catch {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async function getDatabasePackagePath(cwd = process.cwd()) {
|
|
181
|
+
const configResult = tryResolveFromConfig(cwd);
|
|
182
|
+
if (configResult) return configResult;
|
|
183
|
+
const dbPackage = findPackage("database", cwd) ?? findPackage("db", cwd);
|
|
184
|
+
if (dbPackage) return dbPackage;
|
|
185
|
+
const baseDir = findWorkspaceRoot(cwd) || cwd;
|
|
186
|
+
const conventionalPaths = [
|
|
187
|
+
path.join(baseDir, "packages", "database"),
|
|
188
|
+
path.join(baseDir, "packages", "db"),
|
|
189
|
+
path.join(baseDir, "db"),
|
|
190
|
+
baseDir
|
|
191
|
+
];
|
|
192
|
+
for (const candidate of conventionalPaths) {
|
|
193
|
+
if (existsSync(candidate) && hasValidDatabaseIndicators(candidate)) {
|
|
194
|
+
return candidate;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
throw new Error(`\u274C Database package not found
|
|
198
|
+
|
|
199
|
+
Expected locations:
|
|
200
|
+
- packages/database/ (monorepo structure, recommended)
|
|
201
|
+
- packages/db/ (monorepo structure, legacy)
|
|
202
|
+
- db/ (single-package structure)
|
|
203
|
+
- . (project root with drizzle.config.ts or supabase/schemas/)
|
|
204
|
+
|
|
205
|
+
Valid indicators (at least one required):
|
|
206
|
+
- package.json
|
|
207
|
+
- drizzle.config.ts (Drizzle ORM)
|
|
208
|
+
- supabase/schemas/ (Supabase SQL-First)
|
|
209
|
+
- src/schema/ (TypeScript schemas)
|
|
210
|
+
|
|
211
|
+
Solutions:
|
|
212
|
+
1. Run: runa init (generates structure)
|
|
213
|
+
2. Set project.monorepo: false in runa.config.ts for single-app
|
|
214
|
+
3. Ensure supabase/schemas/ exists for Supabase projects
|
|
215
|
+
`);
|
|
216
|
+
}
|
|
217
|
+
async function getSDKScriptsPath(cwd = process.cwd()) {
|
|
218
|
+
const sdkPackage = findPackage("sdk", cwd);
|
|
219
|
+
if (sdkPackage) {
|
|
220
|
+
const scriptsPath = path.join(sdkPackage, "scripts");
|
|
221
|
+
if (existsSync(scriptsPath)) {
|
|
222
|
+
return scriptsPath;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const workspaceRoot = findWorkspaceRoot(cwd);
|
|
226
|
+
const baseDir = workspaceRoot || cwd;
|
|
227
|
+
const installedPath = path.join(baseDir, "node_modules", "@runa-ai", "runa", "scripts");
|
|
228
|
+
if (existsSync(installedPath)) {
|
|
229
|
+
return installedPath;
|
|
230
|
+
}
|
|
231
|
+
throw new Error(
|
|
232
|
+
"\u274C SDK scripts directory not found\n\nExpected locations:\n - packages/sdk/scripts (workspace development)\n - node_modules/@runa-ai/runa/scripts (npm installed)\n\nSolutions:\n 1. Install @runa-ai/runa: pnpm add @runa-ai/runa\n 2. Check workspace structure: pnpm list @runa-ai/runa\n 3. Run: pnpm install (reinstall dependencies)\n"
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
async function getSDKTemplatesPath(cwd = process.cwd()) {
|
|
236
|
+
const sdkPackage = findPackage("sdk", cwd);
|
|
237
|
+
if (sdkPackage) {
|
|
238
|
+
const templatesPath = path.join(sdkPackage, "templates");
|
|
239
|
+
if (existsSync(templatesPath)) {
|
|
240
|
+
return templatesPath;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
const workspaceRoot = findWorkspaceRoot(cwd);
|
|
244
|
+
const baseDir = workspaceRoot || cwd;
|
|
245
|
+
const installedPath = path.join(baseDir, "node_modules", "@runa-ai", "runa", "templates");
|
|
246
|
+
if (existsSync(installedPath)) {
|
|
247
|
+
return installedPath;
|
|
248
|
+
}
|
|
249
|
+
throw new Error(
|
|
250
|
+
"\u274C SDK templates directory not found\n\nExpected locations:\n - packages/sdk/templates (workspace development)\n - node_modules/@runa-ai/runa/templates (npm installed)\n\nSolutions:\n 1. Install @runa-ai/runa: pnpm add @runa-ai/runa\n 2. Check: ls node_modules/@runa-ai/runa/templates\n 3. Run: pnpm install (reinstall dependencies)\n"
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export { getAppConfig, getDatabaseConfig, getDatabasePackagePath, getDeployConfig, getSDKScriptsPath, getSDKTemplatesPath, isMonorepo, loadRunaConfig, validateRunaConfig };
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { validateEnvSuffix, isPathContained, MAX_DIRECTORY_TRAVERSAL_DEPTH } from './chunk-DRSUEMAK.js';
|
|
4
|
+
import { findWorkspaceRoot } from './chunk-JMJP4A47.js';
|
|
5
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
6
|
+
import { existsSync, readFileSync } from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { config } from '@dotenvx/dotenvx';
|
|
9
|
+
import { parse } from 'dotenv';
|
|
10
|
+
import { expand } from 'dotenv-expand';
|
|
11
|
+
|
|
12
|
+
createRequire(import.meta.url);
|
|
13
|
+
|
|
14
|
+
// src/config/env-files.ts
|
|
15
|
+
init_esm_shims();
|
|
16
|
+
process.env.DOTENVX_QUIET = "true";
|
|
17
|
+
function isSupportedNodeEnv(value) {
|
|
18
|
+
if (typeof value !== "string") return false;
|
|
19
|
+
return value === "development" || value === "production" || value === "test";
|
|
20
|
+
}
|
|
21
|
+
function findProjectRoot(from) {
|
|
22
|
+
const workspaceRoot = findWorkspaceRoot(from);
|
|
23
|
+
if (workspaceRoot) return workspaceRoot;
|
|
24
|
+
let current = path.resolve(from);
|
|
25
|
+
const root = path.parse(current).root;
|
|
26
|
+
let depth = 0;
|
|
27
|
+
while (current !== root && depth < MAX_DIRECTORY_TRAVERSAL_DEPTH) {
|
|
28
|
+
const hasGit = existsSync(path.join(current, ".git"));
|
|
29
|
+
const hasPackageJson = existsSync(path.join(current, "package.json"));
|
|
30
|
+
if (hasGit || hasPackageJson) return current;
|
|
31
|
+
const parent = path.dirname(current);
|
|
32
|
+
if (parent === current) break;
|
|
33
|
+
current = parent;
|
|
34
|
+
depth++;
|
|
35
|
+
}
|
|
36
|
+
return path.resolve(from);
|
|
37
|
+
}
|
|
38
|
+
function mapRunaEnvToVercelEnv(runaEnv) {
|
|
39
|
+
if (runaEnv === "preview") return "preview";
|
|
40
|
+
if (runaEnv === "main" || runaEnv === "production") return "production";
|
|
41
|
+
return "development";
|
|
42
|
+
}
|
|
43
|
+
function inferVercelEnv(params) {
|
|
44
|
+
if (params.runaEnv) return mapRunaEnvToVercelEnv(params.runaEnv);
|
|
45
|
+
if (params.nodeEnv === "production") return "production";
|
|
46
|
+
return "development";
|
|
47
|
+
}
|
|
48
|
+
function loadEnvFileIntoTarget(params) {
|
|
49
|
+
if (!existsSync(params.filePath)) return false;
|
|
50
|
+
const raw = readFileSync(params.filePath, "utf-8");
|
|
51
|
+
const parsed = parse(raw);
|
|
52
|
+
const parsedKeys = new Set(Object.keys(parsed));
|
|
53
|
+
const processEnv = Object.fromEntries(
|
|
54
|
+
Object.entries(params.targetEnv).filter((entry) => {
|
|
55
|
+
const [key, value] = entry;
|
|
56
|
+
if (parsedKeys.has(key)) return false;
|
|
57
|
+
return typeof value === "string";
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
const expanded = expand({
|
|
61
|
+
parsed,
|
|
62
|
+
processEnv
|
|
63
|
+
});
|
|
64
|
+
const finalParsed = expanded.parsed ?? parsed;
|
|
65
|
+
for (const [key, value] of Object.entries(finalParsed)) {
|
|
66
|
+
if (params.protectedKeys.has(key)) continue;
|
|
67
|
+
params.targetEnv[key] = value;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
function loadEnvFiles(options = {}) {
|
|
72
|
+
const protectedKeys = new Set(Object.keys(process.env));
|
|
73
|
+
const cwd = options.cwd ?? process.cwd();
|
|
74
|
+
const nodeEnv = resolveNodeEnv(options.nodeEnv);
|
|
75
|
+
const projectRoot = findProjectRoot(cwd);
|
|
76
|
+
const vercelEnv = options.vercelEnv ?? inferVercelEnv({ nodeEnv, runaEnv: options.runaEnv });
|
|
77
|
+
const keysFile = path.join(projectRoot, ".env.keys");
|
|
78
|
+
const baseFilePaths = buildBaseEnvFilePaths({ nodeEnv, vercelEnv });
|
|
79
|
+
const runaFilePaths = options.runaEnv ? buildRunaEnvFilePaths(options.runaEnv) : [];
|
|
80
|
+
const allRelPaths = [...baseFilePaths, ...runaFilePaths];
|
|
81
|
+
const hasEncryptedFiles = existsSync(keysFile);
|
|
82
|
+
let loadedFiles;
|
|
83
|
+
if (hasEncryptedFiles) {
|
|
84
|
+
const reversedRelPaths = [...allRelPaths].reverse();
|
|
85
|
+
const filePaths = [
|
|
86
|
+
keysFile,
|
|
87
|
+
// Load keys first (needed for decryption)
|
|
88
|
+
...reversedRelPaths.map((rel) => path.join(projectRoot, rel)).filter(existsSync)
|
|
89
|
+
];
|
|
90
|
+
config({
|
|
91
|
+
path: filePaths,
|
|
92
|
+
override: false,
|
|
93
|
+
// Don't override existing process.env values
|
|
94
|
+
quiet: true
|
|
95
|
+
// Suppress dotenvx verbose output
|
|
96
|
+
});
|
|
97
|
+
loadedFiles = allRelPaths.filter((rel) => existsSync(path.join(projectRoot, rel)));
|
|
98
|
+
} else {
|
|
99
|
+
const targetEnv = { ...process.env };
|
|
100
|
+
loadedFiles = [
|
|
101
|
+
...loadEnvFilesIntoTarget({
|
|
102
|
+
projectRoot,
|
|
103
|
+
relPaths: baseFilePaths,
|
|
104
|
+
targetEnv,
|
|
105
|
+
protectedKeys
|
|
106
|
+
}),
|
|
107
|
+
...loadEnvFilesIntoTarget({
|
|
108
|
+
projectRoot,
|
|
109
|
+
relPaths: runaFilePaths,
|
|
110
|
+
targetEnv,
|
|
111
|
+
protectedKeys
|
|
112
|
+
})
|
|
113
|
+
];
|
|
114
|
+
applyTargetEnvToProcessEnv({ targetEnv, protectedKeys });
|
|
115
|
+
}
|
|
116
|
+
if (options.runaEnv === "local") {
|
|
117
|
+
const localExcludedKeys = ["DATABASE_URL", "DATABASE_URL_ADMIN", "DATABASE_URL_SERVICE"];
|
|
118
|
+
for (const key of localExcludedKeys) {
|
|
119
|
+
delete process.env[key];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (!options.silent && loadedFiles.length > 0) {
|
|
123
|
+
process.stderr.write(`\u2705 Loaded env files: ${loadedFiles.join(", ")}
|
|
124
|
+
`);
|
|
125
|
+
process.stderr.write(` Project root: ${projectRoot}
|
|
126
|
+
`);
|
|
127
|
+
process.stderr.write(` NODE_ENV: ${nodeEnv}
|
|
128
|
+
`);
|
|
129
|
+
process.stderr.write(` Vercel env: ${vercelEnv}
|
|
130
|
+
`);
|
|
131
|
+
if (hasEncryptedFiles) {
|
|
132
|
+
process.stderr.write(" \u{1F513} Auto-decrypted with .env.keys\n");
|
|
133
|
+
}
|
|
134
|
+
if (options.runaEnv === "local") {
|
|
135
|
+
process.stderr.write(" \u{1F3E0} Local mode: DATABASE_URL excluded (using local Supabase)\n");
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return { projectRoot, loadedFiles };
|
|
139
|
+
}
|
|
140
|
+
function resolveNodeEnv(requested) {
|
|
141
|
+
if (isSupportedNodeEnv(requested)) return requested;
|
|
142
|
+
if (isSupportedNodeEnv(process.env.NODE_ENV)) return process.env.NODE_ENV;
|
|
143
|
+
return "development";
|
|
144
|
+
}
|
|
145
|
+
function buildBaseEnvFilePaths(params) {
|
|
146
|
+
validateEnvSuffix(params.nodeEnv);
|
|
147
|
+
validateEnvSuffix(params.vercelEnv);
|
|
148
|
+
const baseFiles = [
|
|
149
|
+
".env",
|
|
150
|
+
// Vercel-aligned: .env.{environment} (3 files = 3 keys)
|
|
151
|
+
`.env.${params.vercelEnv}`,
|
|
152
|
+
`.env.${params.nodeEnv}`
|
|
153
|
+
];
|
|
154
|
+
baseFiles.push(`.vercel/.env.${params.vercelEnv}.local`);
|
|
155
|
+
const includeDotEnvLocal = params.nodeEnv !== "test";
|
|
156
|
+
if (includeDotEnvLocal) baseFiles.push(".env.local");
|
|
157
|
+
baseFiles.push(".env.personal");
|
|
158
|
+
baseFiles.push(`.env.${params.nodeEnv}.local`);
|
|
159
|
+
return baseFiles;
|
|
160
|
+
}
|
|
161
|
+
function buildRunaEnvFilePaths(runaEnv) {
|
|
162
|
+
validateEnvSuffix(runaEnv);
|
|
163
|
+
const runaFiles = [`.env.${runaEnv}`, `.env.${runaEnv}.local`];
|
|
164
|
+
if (runaEnv === "main" || runaEnv === "production") {
|
|
165
|
+
runaFiles.push(".env.production", ".env.production.local");
|
|
166
|
+
}
|
|
167
|
+
return runaFiles;
|
|
168
|
+
}
|
|
169
|
+
function loadEnvFilesIntoTarget(params) {
|
|
170
|
+
const loadedFiles = [];
|
|
171
|
+
for (const relPath of params.relPaths) {
|
|
172
|
+
const fullPath = path.join(params.projectRoot, relPath);
|
|
173
|
+
const resolvedPath = path.resolve(fullPath);
|
|
174
|
+
if (!isPathContained(params.projectRoot, resolvedPath)) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
const loaded = loadEnvFileIntoTarget({
|
|
178
|
+
filePath: resolvedPath,
|
|
179
|
+
targetEnv: params.targetEnv,
|
|
180
|
+
protectedKeys: params.protectedKeys
|
|
181
|
+
});
|
|
182
|
+
if (loaded) loadedFiles.push(relPath);
|
|
183
|
+
}
|
|
184
|
+
return loadedFiles;
|
|
185
|
+
}
|
|
186
|
+
function applyTargetEnvToProcessEnv(params) {
|
|
187
|
+
for (const [key, value] of Object.entries(params.targetEnv)) {
|
|
188
|
+
if (value === void 0) continue;
|
|
189
|
+
if (params.protectedKeys.has(key)) continue;
|
|
190
|
+
process.env[key] = value;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export { loadEnvFiles };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync } from 'fs';
|
|
5
|
+
import { resolve } from 'path';
|
|
6
|
+
|
|
7
|
+
createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// src/utils/config-updater.ts
|
|
10
|
+
init_esm_shims();
|
|
11
|
+
var VALID_DIRECTORY_PATTERN = /^[a-zA-Z0-9.][a-zA-Z0-9/_.-]*$/;
|
|
12
|
+
var VALID_VERSION_PATTERN = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[a-zA-Z0-9.-]+)?$/;
|
|
13
|
+
function isControlChar(charCode) {
|
|
14
|
+
return charCode <= 31 || charCode === 127;
|
|
15
|
+
}
|
|
16
|
+
function isValidDirectoryPath(dir) {
|
|
17
|
+
if (!dir || typeof dir !== "string") {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
if (dir.trim() === "") {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (/['"\\]/.test(dir)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
for (let i = 0; i < dir.length; i++) {
|
|
27
|
+
if (isControlChar(dir.charCodeAt(i))) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return VALID_DIRECTORY_PATTERN.test(dir);
|
|
32
|
+
}
|
|
33
|
+
function isValidVersion(version) {
|
|
34
|
+
if (!version || typeof version !== "string") {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return VALID_VERSION_PATTERN.test(version);
|
|
38
|
+
}
|
|
39
|
+
function escapeReplacementString(str) {
|
|
40
|
+
return str.replace(/\$/g, "$$$$");
|
|
41
|
+
}
|
|
42
|
+
function updateRunaConfigAppDirectory(appDirectory, targetDir = process.cwd()) {
|
|
43
|
+
if (!isValidDirectoryPath(appDirectory)) {
|
|
44
|
+
return { updated: false, reason: "Invalid directory path format" };
|
|
45
|
+
}
|
|
46
|
+
const configPath = resolve(targetDir, "runa.config.ts");
|
|
47
|
+
if (!existsSync(configPath)) {
|
|
48
|
+
return { updated: false, reason: "runa.config.ts not found" };
|
|
49
|
+
}
|
|
50
|
+
const content = readFileSync(configPath, "utf-8");
|
|
51
|
+
const currentMatch = content.match(/directory:\s*['"]([^'"]+)['"]/);
|
|
52
|
+
const currentValue = currentMatch?.[1];
|
|
53
|
+
if (currentValue && currentValue !== "." && currentValue !== "apps/web") {
|
|
54
|
+
if (currentValue === appDirectory) {
|
|
55
|
+
return { updated: false, reason: "Already set to the same value" };
|
|
56
|
+
}
|
|
57
|
+
return { updated: false, reason: `Already customized to '${currentValue}'` };
|
|
58
|
+
}
|
|
59
|
+
const directoryPattern = /(directory:\s*)(['"])([^'"]*)\2/;
|
|
60
|
+
if (!directoryPattern.test(content)) {
|
|
61
|
+
return { updated: false, reason: "Could not find directory field in config" };
|
|
62
|
+
}
|
|
63
|
+
const safeDirectory = escapeReplacementString(appDirectory);
|
|
64
|
+
const newContent = content.replace(directoryPattern, `$1'${safeDirectory}'`);
|
|
65
|
+
if (newContent === content) {
|
|
66
|
+
return { updated: false, reason: "No changes needed" };
|
|
67
|
+
}
|
|
68
|
+
writeFileSync(configPath, newContent, "utf-8");
|
|
69
|
+
return { updated: true, reason: `Updated to '${appDirectory}'` };
|
|
70
|
+
}
|
|
71
|
+
function syncRunaConfigWithVercel(targetDir, vercelRootDirectory) {
|
|
72
|
+
if (!vercelRootDirectory) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const result = updateRunaConfigAppDirectory(vercelRootDirectory, targetDir);
|
|
76
|
+
return {
|
|
77
|
+
updated: result.updated,
|
|
78
|
+
field: "app.directory",
|
|
79
|
+
reason: result.reason
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function updateRunaConfigSdkVersion(version, targetDir = process.cwd()) {
|
|
83
|
+
if (!isValidVersion(version)) {
|
|
84
|
+
return { updated: false, reason: "Invalid version format" };
|
|
85
|
+
}
|
|
86
|
+
const configPath = resolve(targetDir, "runa.config.ts");
|
|
87
|
+
if (!existsSync(configPath)) {
|
|
88
|
+
return { updated: false, reason: "runa.config.ts not found" };
|
|
89
|
+
}
|
|
90
|
+
const content = readFileSync(configPath, "utf-8");
|
|
91
|
+
const currentMatch = content.match(/sdkVersion:\s*['"]([^'"]+)['"]/);
|
|
92
|
+
const currentVersion = currentMatch?.[1];
|
|
93
|
+
if (currentVersion === version) {
|
|
94
|
+
return { updated: false, reason: "Already at this version" };
|
|
95
|
+
}
|
|
96
|
+
const sdkVersionPattern = /(sdkVersion:\s*)(['"])([^'"]*)\2/;
|
|
97
|
+
const safeVersion = escapeReplacementString(version);
|
|
98
|
+
if (sdkVersionPattern.test(content)) {
|
|
99
|
+
const newContent = content.replace(sdkVersionPattern, `$1'${safeVersion}'`);
|
|
100
|
+
if (newContent === content) {
|
|
101
|
+
return { updated: false, reason: "No changes needed" };
|
|
102
|
+
}
|
|
103
|
+
writeFileSync(configPath, newContent, "utf-8");
|
|
104
|
+
return {
|
|
105
|
+
updated: true,
|
|
106
|
+
reason: currentVersion ? `Updated from '${currentVersion}' to '${version}'` : `Set to '${version}'`
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const configVersionPattern = /(configVersion:\s*\d+,?)(\s*\n)/;
|
|
110
|
+
if (configVersionPattern.test(content)) {
|
|
111
|
+
const newContent = content.replace(
|
|
112
|
+
configVersionPattern,
|
|
113
|
+
`$1$2 sdkVersion: '${safeVersion}',$2`
|
|
114
|
+
);
|
|
115
|
+
writeFileSync(configPath, newContent, "utf-8");
|
|
116
|
+
return { updated: true, reason: `Added sdkVersion: '${version}'` };
|
|
117
|
+
}
|
|
118
|
+
return { updated: false, reason: "Could not find appropriate location to add sdkVersion" };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { syncRunaConfigWithVercel, updateRunaConfigSdkVersion };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { redactSecrets } from './chunk-II7VYQEM.js';
|
|
4
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
5
|
+
import { createWriteStream } from 'fs';
|
|
6
|
+
import { mkdir } from 'fs/promises';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { execa } from 'execa';
|
|
9
|
+
|
|
10
|
+
createRequire(import.meta.url);
|
|
11
|
+
|
|
12
|
+
// src/commands/ci/utils/execa-helpers.ts
|
|
13
|
+
init_esm_shims();
|
|
14
|
+
function redactArgsForLog(args) {
|
|
15
|
+
return args.map((a) => redactSecrets(a));
|
|
16
|
+
}
|
|
17
|
+
function pipeToSharedLog(params) {
|
|
18
|
+
let pending = 0;
|
|
19
|
+
const maybeEnd = () => {
|
|
20
|
+
if (pending !== 0) return;
|
|
21
|
+
try {
|
|
22
|
+
params.logStream.end();
|
|
23
|
+
} catch (error) {
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
for (const s of params.streams) {
|
|
27
|
+
if (!s) continue;
|
|
28
|
+
pending += 1;
|
|
29
|
+
s.pipe(params.logStream, { end: false });
|
|
30
|
+
const done = () => {
|
|
31
|
+
pending -= 1;
|
|
32
|
+
maybeEnd();
|
|
33
|
+
};
|
|
34
|
+
s.once("end", done);
|
|
35
|
+
s.once("close", done);
|
|
36
|
+
s.once("error", done);
|
|
37
|
+
}
|
|
38
|
+
maybeEnd();
|
|
39
|
+
}
|
|
40
|
+
async function ensureRunaTmpDir(cwd) {
|
|
41
|
+
const root = cwd ?? process.cwd();
|
|
42
|
+
const dir = path.join(root, ".runa", "tmp");
|
|
43
|
+
await mkdir(dir, { recursive: true });
|
|
44
|
+
return dir;
|
|
45
|
+
}
|
|
46
|
+
function runLogged(params) {
|
|
47
|
+
console.log(`\u25B6 ${params.label}: ${params.command} ${redactArgsForLog(params.args).join(" ")}`);
|
|
48
|
+
const proc = execa(params.command, params.args, {
|
|
49
|
+
cwd: params.cwd,
|
|
50
|
+
env: { DOTENVX_QUIET: "1", ...params.env },
|
|
51
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
52
|
+
shell: false,
|
|
53
|
+
timeout: params.timeoutMs,
|
|
54
|
+
reject: params.reject
|
|
55
|
+
});
|
|
56
|
+
const stream = createWriteStream(params.logFile, { flags: "a" });
|
|
57
|
+
if (proc.stdout) proc.stdout.pipe(process.stdout, { end: false });
|
|
58
|
+
if (proc.stderr) proc.stderr.pipe(process.stderr, { end: false });
|
|
59
|
+
pipeToSharedLog({ streams: [proc.stdout, proc.stderr], logStream: stream });
|
|
60
|
+
return proc;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export { ensureRunaTmpDir, runLogged };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
4
|
+
import { CLIError } from '@runa-ai/runa/cli-runtime';
|
|
5
|
+
|
|
6
|
+
createRequire(import.meta.url);
|
|
7
|
+
|
|
8
|
+
// src/cli/non-interactive.ts
|
|
9
|
+
init_esm_shims();
|
|
10
|
+
function isTrueEnv(value) {
|
|
11
|
+
return value === "1" || value === "true" || value === "yes";
|
|
12
|
+
}
|
|
13
|
+
function isNonInteractiveEnabled() {
|
|
14
|
+
if (isTrueEnv(process.env.RUNA_NON_INTERACTIVE)) return true;
|
|
15
|
+
if (process.env.CI === "true") return true;
|
|
16
|
+
if (process.env.RUNA_OUTPUT_FORMAT === "json") return true;
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
function enableNonInteractiveMode() {
|
|
20
|
+
process.env.RUNA_NON_INTERACTIVE = "true";
|
|
21
|
+
}
|
|
22
|
+
function assertTtyRequired(featureName) {
|
|
23
|
+
const stdinTty = process.stdin.isTTY === true;
|
|
24
|
+
const stdoutTty = process.stdout.isTTY === true;
|
|
25
|
+
if (stdinTty && stdoutTty) return;
|
|
26
|
+
throw new CLIError(
|
|
27
|
+
`${featureName} requires an interactive TTY`,
|
|
28
|
+
"TTY_REQUIRED",
|
|
29
|
+
["Run in a terminal (TTY)", "Avoid piping stdin/stdout when using TUI features"],
|
|
30
|
+
void 0,
|
|
31
|
+
2
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { assertTtyRequired, enableNonInteractiveMode, isNonInteractiveEnabled };
|