@runa-ai/runa-cli 0.5.72 → 0.6.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-BXUJKYHC.js +1730 -0
- package/dist/cache-H63JKFYH.js +112 -0
- package/dist/check-6AB5NGWK.js +207 -0
- package/dist/chunk-22CS6EMA.js +31 -0
- package/dist/chunk-3FDQW524.js +544 -0
- package/dist/chunk-5NKWR4FF.js +254 -0
- package/dist/chunk-6AALH2ED.js +121 -0
- package/dist/chunk-6Y3LAUGL.js +35 -0
- package/dist/chunk-7QV7U6NI.js +62 -0
- package/dist/chunk-AAIE4F2U.js +140 -0
- package/dist/chunk-CCKG5R4Y.js +59 -0
- package/dist/chunk-CE3DEYFT.js +480 -0
- package/dist/chunk-DRSUEMAK.js +123 -0
- package/dist/chunk-GOGRLQNP.js +12 -0
- package/dist/chunk-HD74F6W2.js +460 -0
- package/dist/chunk-HKUWEGUX.js +36 -0
- package/dist/chunk-HPYJPB5Y.js +408 -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-JT5SUTWE.js +9 -0
- package/dist/chunk-KWX3JHCY.js +85 -0
- package/dist/chunk-M47WJJVS.js +71 -0
- package/dist/chunk-MNPMZERI.js +194 -0
- package/dist/chunk-MXRWBNIY.js +74 -0
- package/dist/chunk-NPSRD26F.js +149 -0
- package/dist/chunk-P7U52PBY.js +1149 -0
- package/dist/chunk-QDF7QXBL.js +67 -0
- package/dist/chunk-RRGQCUKT.js +48 -0
- package/dist/chunk-RZLYEO4U.js +219 -0
- package/dist/chunk-TYIAD6SB.js +74 -0
- package/dist/chunk-UU55OH7P.js +42 -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-XJBQINSA.js +351 -0
- package/dist/chunk-ZZOXM6Q4.js +8 -0
- package/dist/ci-V3PIG2GI.js +8322 -0
- package/dist/cli/index.d.ts +7 -1
- package/dist/cli/requested-command.d.ts +8 -0
- package/dist/cli-GFRZCJQR.js +661 -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/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/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/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 +0 -5
- package/dist/commands/ci/utils/ci-summary.d.ts +15 -15
- package/dist/commands/ci/utils/execa-helpers.d.ts +1 -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/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 +7 -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/contract.d.ts +2 -2
- package/dist/commands/dev/machine.d.ts +7 -31
- 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/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/config/env.d.ts +4 -4
- package/dist/config-loader-GT3HAQ7U.js +7 -0
- package/dist/db-HR7CREX2.js +15913 -0
- package/dist/dev-A7RW6XQV.js +873 -0
- package/dist/env-B47Z4747.js +2624 -0
- package/dist/env-HMMRSYCI.js +7 -0
- package/dist/env-files-K2C7O7L5.js +8 -0
- package/dist/error-handler-4EYSDOSE.js +460 -0
- package/dist/hotfix-CULKKMGS.js +1477 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +48 -42995
- package/dist/init-ELK5QCWR.js +632 -0
- package/dist/inject-test-attrs-Y5UD5P7Q.js +36 -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-C43JRZWY.js +60 -0
- package/dist/manifest-2NOQ2IMK.js +32 -0
- package/dist/prepare-32DOVHTE.js +250 -0
- package/dist/risk-detector-BXUY2WKS.js +6 -0
- package/dist/risk-detector-core-O7I7SPR7.js +166 -0
- package/dist/risk-detector-plpgsql-SGMVKYJP.js +1856 -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-IJ4ZWHMX.js +95 -0
- package/dist/telemetry-FN7V727Y.js +94 -0
- package/dist/template-check-PNG5NQ5H.js +1933 -0
- package/dist/test-QYXE5UVW.js +626 -0
- package/dist/test-gen-QPWOIEHU.js +89 -0
- package/dist/ui-RJAMCWUI.js +331 -0
- package/dist/upgrade-3SLWVNAC.js +625 -0
- package/dist/utils/config-loader.d.ts +0 -3
- package/dist/validate-SM4PXPS7.js +55 -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-TYQNEFS7.js +122 -0
- package/dist/vuln-checker-2QXGN5YT.js +2950 -0
- package/dist/watch-UCDVOQAH.js +911 -0
- package/dist/workflow-ZB5Q2PFY.js +898 -0
- package/package.json +4 -1
- 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,911 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { registerCleanup } from './chunk-TYIAD6SB.js';
|
|
4
|
+
import { isNonInteractiveEnabled, assertTtyRequired } from './chunk-6Y3LAUGL.js';
|
|
5
|
+
import { getDatabasePackagePath } from './chunk-5NKWR4FF.js';
|
|
6
|
+
import './chunk-JMJP4A47.js';
|
|
7
|
+
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
8
|
+
import path, { basename } from 'path';
|
|
9
|
+
import { createCLILogger, CLIError, detectDatabasePackage, DATABASE_PACKAGE_CANDIDATES } from '@runa-ai/runa';
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import { Command } from 'commander';
|
|
12
|
+
import { watch } from 'chokidar';
|
|
13
|
+
import notifier from 'node-notifier';
|
|
14
|
+
import { existsSync } from 'fs';
|
|
15
|
+
import { readFile } from 'fs/promises';
|
|
16
|
+
import { execa } from 'execa';
|
|
17
|
+
import { glob } from 'glob';
|
|
18
|
+
|
|
19
|
+
createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
// src/commands/watch.ts
|
|
22
|
+
init_esm_shims();
|
|
23
|
+
|
|
24
|
+
// src/watchers/schema-watcher.ts
|
|
25
|
+
init_esm_shims();
|
|
26
|
+
|
|
27
|
+
// src/notifiers/desktop-notifier.ts
|
|
28
|
+
init_esm_shims();
|
|
29
|
+
var logger = createCLILogger("notifier");
|
|
30
|
+
async function notifyDesktop(options) {
|
|
31
|
+
if (process.env.CI === "true") {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const { title, message, type = "info", timeout = 5 } = options;
|
|
35
|
+
try {
|
|
36
|
+
const iconMap = {
|
|
37
|
+
info: "\u2139\uFE0F",
|
|
38
|
+
success: "\u2705",
|
|
39
|
+
warning: "\u26A0\uFE0F",
|
|
40
|
+
error: "\u274C"
|
|
41
|
+
};
|
|
42
|
+
const icon = iconMap[type];
|
|
43
|
+
const fullTitle = `${icon} ${title}`;
|
|
44
|
+
notifier.notify({
|
|
45
|
+
title: fullTitle,
|
|
46
|
+
message,
|
|
47
|
+
timeout: timeout * 1e3,
|
|
48
|
+
// Convert to milliseconds
|
|
49
|
+
wait: false
|
|
50
|
+
});
|
|
51
|
+
} catch (error) {
|
|
52
|
+
logger.debug(`Notification failed: ${error}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/validators/schema-validator.ts
|
|
57
|
+
init_esm_shims();
|
|
58
|
+
var RE_DOLLAR_TAG = /\$([a-zA-Z_][a-zA-Z0-9_]*)?\$/y;
|
|
59
|
+
function maskLiteralChar(char) {
|
|
60
|
+
return char === "\n" ? "\n" : " ";
|
|
61
|
+
}
|
|
62
|
+
function appendSpaces(state, count) {
|
|
63
|
+
state.result += " ".repeat(count);
|
|
64
|
+
}
|
|
65
|
+
function consumeLineComment(content, state) {
|
|
66
|
+
if (state.inSingleQuote || state.inDoubleQuote || state.inDollarQuote) return false;
|
|
67
|
+
if (content[state.i] !== "-" || content[state.i + 1] !== "-") return false;
|
|
68
|
+
appendSpaces(state, 2);
|
|
69
|
+
state.i += 2;
|
|
70
|
+
while (state.i < content.length && content[state.i] !== "\n") {
|
|
71
|
+
state.result += " ";
|
|
72
|
+
state.i += 1;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
function consumeBlockComment(content, state) {
|
|
77
|
+
if (state.inSingleQuote || state.inDoubleQuote || state.inDollarQuote) return false;
|
|
78
|
+
if (content[state.i] !== "/" || content[state.i + 1] !== "*") return false;
|
|
79
|
+
appendSpaces(state, 2);
|
|
80
|
+
state.i += 2;
|
|
81
|
+
while (state.i < content.length) {
|
|
82
|
+
const blockChar = content[state.i] ?? "";
|
|
83
|
+
if (blockChar === "*" && content[state.i + 1] === "/") {
|
|
84
|
+
appendSpaces(state, 2);
|
|
85
|
+
state.i += 2;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
state.result += blockChar === "\n" ? "\n" : " ";
|
|
89
|
+
state.i += 1;
|
|
90
|
+
}
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
function toggleSingleQuote(content, state) {
|
|
94
|
+
if (state.inDoubleQuote || state.inDollarQuote || content[state.i] !== "'") return false;
|
|
95
|
+
if (state.inSingleQuote && content[state.i + 1] === "'") {
|
|
96
|
+
state.result += `''`;
|
|
97
|
+
state.i += 2;
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
state.inSingleQuote = !state.inSingleQuote;
|
|
101
|
+
state.result += " ";
|
|
102
|
+
state.i += 1;
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
function toggleDoubleQuote(content, state) {
|
|
106
|
+
if (state.inSingleQuote || state.inDollarQuote || content[state.i] !== '"') return false;
|
|
107
|
+
if (state.inDoubleQuote && content[state.i + 1] === '"') {
|
|
108
|
+
state.result += '""';
|
|
109
|
+
state.i += 2;
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
state.inDoubleQuote = !state.inDoubleQuote;
|
|
113
|
+
state.result += " ";
|
|
114
|
+
state.i += 1;
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
function consumeDollarQuoteBoundary(content, state) {
|
|
118
|
+
if (state.inSingleQuote || state.inDoubleQuote || content[state.i] !== "$") return false;
|
|
119
|
+
if (state.inDollarQuote) {
|
|
120
|
+
const closeTag = `$${state.dollarTag}$`;
|
|
121
|
+
if (!content.startsWith(closeTag, state.i)) return false;
|
|
122
|
+
state.inDollarQuote = false;
|
|
123
|
+
state.dollarTag = "";
|
|
124
|
+
appendSpaces(state, closeTag.length);
|
|
125
|
+
state.i += closeTag.length;
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
RE_DOLLAR_TAG.lastIndex = state.i;
|
|
129
|
+
const tagMatch = RE_DOLLAR_TAG.exec(content);
|
|
130
|
+
if (!tagMatch) return false;
|
|
131
|
+
state.inDollarQuote = true;
|
|
132
|
+
state.dollarTag = tagMatch[1] ?? "";
|
|
133
|
+
appendSpaces(state, tagMatch[0].length);
|
|
134
|
+
state.i += tagMatch[0].length;
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
function consumeLiteralBody(content, state) {
|
|
138
|
+
if (!state.inSingleQuote && !state.inDoubleQuote && !state.inDollarQuote) return false;
|
|
139
|
+
state.result += maskLiteralChar(content[state.i]);
|
|
140
|
+
state.i += 1;
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
function stripSqlCommentsAndLiterals(content) {
|
|
144
|
+
const state = {
|
|
145
|
+
result: "",
|
|
146
|
+
i: 0,
|
|
147
|
+
inSingleQuote: false,
|
|
148
|
+
inDoubleQuote: false,
|
|
149
|
+
inDollarQuote: false,
|
|
150
|
+
dollarTag: ""
|
|
151
|
+
};
|
|
152
|
+
while (state.i < content.length) {
|
|
153
|
+
if (consumeLineComment(content, state)) continue;
|
|
154
|
+
if (consumeBlockComment(content, state)) continue;
|
|
155
|
+
if (toggleSingleQuote(content, state)) continue;
|
|
156
|
+
if (toggleDoubleQuote(content, state)) continue;
|
|
157
|
+
if (consumeDollarQuoteBoundary(content, state)) continue;
|
|
158
|
+
if (consumeLiteralBody(content, state)) continue;
|
|
159
|
+
state.result += content[state.i] ?? "";
|
|
160
|
+
state.i += 1;
|
|
161
|
+
}
|
|
162
|
+
return state.result;
|
|
163
|
+
}
|
|
164
|
+
function extractStatements(sql) {
|
|
165
|
+
const cleaned = stripSqlCommentsAndLiterals(sql);
|
|
166
|
+
const statements = cleaned.split(";");
|
|
167
|
+
return statements.map((stmt) => stmt.trim()).filter((stmt) => stmt.length > 0);
|
|
168
|
+
}
|
|
169
|
+
function tableHasColumn(tableBody, columnName) {
|
|
170
|
+
const escapedColumnName = columnName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
171
|
+
const target = `\\b${escapedColumnName}\\b`;
|
|
172
|
+
const colRe = new RegExp(target, "i");
|
|
173
|
+
return colRe.test(tableBody);
|
|
174
|
+
}
|
|
175
|
+
async function validateSchemaFile(filePath) {
|
|
176
|
+
const errors = [];
|
|
177
|
+
const warnings = [];
|
|
178
|
+
try {
|
|
179
|
+
if (!existsSync(filePath)) {
|
|
180
|
+
errors.push(`File not found: ${filePath}`);
|
|
181
|
+
return { isValid: false, errors, warnings };
|
|
182
|
+
}
|
|
183
|
+
const content = await readFile(filePath, "utf-8");
|
|
184
|
+
if (filePath.endsWith(".ts") || filePath.endsWith(".tsx")) {
|
|
185
|
+
validateDrizzleSchema(content, errors, warnings);
|
|
186
|
+
} else if (filePath.endsWith(".sql")) {
|
|
187
|
+
validateSqlSchema(content, errors, warnings);
|
|
188
|
+
} else {
|
|
189
|
+
warnings.push(`Unknown file type: ${filePath}`);
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
isValid: errors.length === 0,
|
|
193
|
+
errors,
|
|
194
|
+
warnings
|
|
195
|
+
};
|
|
196
|
+
} catch (error) {
|
|
197
|
+
errors.push(`Validation error: ${error}`);
|
|
198
|
+
return { isValid: false, errors, warnings };
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
function validateDrizzleSchema(content, _errors, warnings) {
|
|
202
|
+
if (!content.includes("drizzle-orm")) {
|
|
203
|
+
warnings.push("Missing drizzle-orm import");
|
|
204
|
+
}
|
|
205
|
+
if (!content.includes(".table(")) {
|
|
206
|
+
warnings.push("No table definitions found");
|
|
207
|
+
}
|
|
208
|
+
if (content.includes(".table(")) {
|
|
209
|
+
if (!content.includes("id:")) {
|
|
210
|
+
warnings.push("Table missing id column");
|
|
211
|
+
}
|
|
212
|
+
if (!content.includes("createdAt:") && !content.includes("created_at:")) {
|
|
213
|
+
warnings.push("Table missing createdAt column");
|
|
214
|
+
}
|
|
215
|
+
if (!content.includes("updatedAt:") && !content.includes("updated_at:")) {
|
|
216
|
+
warnings.push("Table missing updatedAt column");
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (/\bany\b/.test(content)) {
|
|
220
|
+
warnings.push('Usage of "any" type detected - prefer specific types');
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function checkIdempotence(content, errors, warnings) {
|
|
224
|
+
for (const statement of extractStatements(content)) {
|
|
225
|
+
if (/^CREATE\s+TABLE/i.test(statement) && !/\bIF\s+NOT\s+EXISTS\b/i.test(statement)) {
|
|
226
|
+
errors.push("CREATE TABLE without IF NOT EXISTS - not idempotent");
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
if (/^CREATE\s+INDEX/i.test(statement) && !/\bIF\s+NOT\s+EXISTS\b/i.test(statement)) {
|
|
230
|
+
warnings.push("CREATE INDEX without IF NOT EXISTS - not idempotent");
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function checkDangerousOperations(content, errors) {
|
|
236
|
+
const cleaned = stripSqlCommentsAndLiterals(content);
|
|
237
|
+
if (/\bDROP\s+TABLE\b/i.test(cleaned) && !/\b_deprecated_\b/i.test(cleaned)) {
|
|
238
|
+
errors.push("DROP TABLE detected - use _deprecated_ prefix instead");
|
|
239
|
+
}
|
|
240
|
+
if (/\bDROP\s+COLUMN\b/i.test(cleaned)) {
|
|
241
|
+
errors.push("DROP COLUMN detected - use _deprecated_ prefix instead");
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function checkDocumentation(content, warnings) {
|
|
245
|
+
if (!/AI HINT/i.test(content) && content.length > 100) {
|
|
246
|
+
warnings.push("Missing AI HINT comment for documentation");
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function checkMandatoryColumns(content, warnings) {
|
|
250
|
+
const cleaned = stripSqlCommentsAndLiterals(content);
|
|
251
|
+
const statements = extractStatements(cleaned);
|
|
252
|
+
for (const statement of statements) {
|
|
253
|
+
if (!/^\s*CREATE\s+TABLE\b/i.test(statement)) {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
const openParen = statement.indexOf("(");
|
|
257
|
+
if (openParen === -1) {
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
const closeParen = statement.lastIndexOf(")");
|
|
261
|
+
if (closeParen === -1 || closeParen <= openParen) {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
const body = statement.slice(openParen + 1, closeParen);
|
|
265
|
+
if (!tableHasColumn(body, "id")) {
|
|
266
|
+
warnings.push("Table missing id column");
|
|
267
|
+
}
|
|
268
|
+
if (!tableHasColumn(body, "created_at")) {
|
|
269
|
+
warnings.push("Table missing created_at column");
|
|
270
|
+
}
|
|
271
|
+
if (!tableHasColumn(body, "updated_at")) {
|
|
272
|
+
warnings.push("Table missing updated_at column");
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function validateSqlSchema(content, errors, warnings) {
|
|
277
|
+
checkIdempotence(content, errors, warnings);
|
|
278
|
+
checkDangerousOperations(content, errors);
|
|
279
|
+
checkDocumentation(content, warnings);
|
|
280
|
+
checkMandatoryColumns(content, warnings);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// src/watchers/schema-watcher.ts
|
|
284
|
+
var riskDetectorLoader = null;
|
|
285
|
+
function loadRiskDetectorModule() {
|
|
286
|
+
if (!riskDetectorLoader) {
|
|
287
|
+
riskDetectorLoader = import('./risk-detector-BXUY2WKS.js').then((module) => ({
|
|
288
|
+
detectSchemaRisks: module.detectSchemaRisks
|
|
289
|
+
})).catch((error) => {
|
|
290
|
+
riskDetectorLoader = null;
|
|
291
|
+
throw error;
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
return riskDetectorLoader;
|
|
295
|
+
}
|
|
296
|
+
var SchemaWatcher = class {
|
|
297
|
+
watcher = null;
|
|
298
|
+
logger = createCLILogger("schema-watcher");
|
|
299
|
+
debounceTimers = /* @__PURE__ */ new Map();
|
|
300
|
+
options;
|
|
301
|
+
constructor(options) {
|
|
302
|
+
this.options = {
|
|
303
|
+
patterns: options.patterns,
|
|
304
|
+
ignored: options.ignored || ["**/node_modules/**", "**/.git/**"],
|
|
305
|
+
autoValidate: options.autoValidate ?? true,
|
|
306
|
+
notifyOnError: options.notifyOnError ?? true,
|
|
307
|
+
debounceMs: options.debounceMs ?? 500
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Start watching schema files
|
|
312
|
+
*/
|
|
313
|
+
async start() {
|
|
314
|
+
this.logger.info(chalk.cyan("\u{1F50D} Starting schema watcher..."));
|
|
315
|
+
this.logger.info(chalk.dim(` Watching: ${this.options.patterns.join(", ")}`));
|
|
316
|
+
this.watcher = watch(this.options.patterns, {
|
|
317
|
+
ignored: this.options.ignored,
|
|
318
|
+
persistent: true,
|
|
319
|
+
ignoreInitial: true
|
|
320
|
+
});
|
|
321
|
+
this.watcher.on("add", (path2) => this.handleFileEvent("add", path2)).on("change", (path2) => this.handleFileEvent("change", path2)).on("unlink", (path2) => this.handleFileEvent("unlink", path2)).on("error", (error) => this.handleError(error));
|
|
322
|
+
if (this.options.autoValidate) {
|
|
323
|
+
loadRiskDetectorModule().catch(() => {
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
this.logger.success("\u2705 Schema watcher started");
|
|
327
|
+
this.logger.info(chalk.dim(" Press Ctrl+C to stop\n"));
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Stop watching
|
|
331
|
+
*/
|
|
332
|
+
async stop() {
|
|
333
|
+
if (this.watcher) {
|
|
334
|
+
await this.watcher.close();
|
|
335
|
+
this.watcher = null;
|
|
336
|
+
this.logger.info("Schema watcher stopped");
|
|
337
|
+
}
|
|
338
|
+
for (const timer of this.debounceTimers.values()) {
|
|
339
|
+
clearTimeout(timer);
|
|
340
|
+
}
|
|
341
|
+
this.debounceTimers.clear();
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Handle file system events with debouncing
|
|
345
|
+
*/
|
|
346
|
+
handleFileEvent(type, path2) {
|
|
347
|
+
const existingTimer = this.debounceTimers.get(path2);
|
|
348
|
+
if (existingTimer) {
|
|
349
|
+
clearTimeout(existingTimer);
|
|
350
|
+
}
|
|
351
|
+
const timer = setTimeout(() => {
|
|
352
|
+
this.processFileEvent({ type, path: path2, timestamp: /* @__PURE__ */ new Date() });
|
|
353
|
+
this.debounceTimers.delete(path2);
|
|
354
|
+
}, this.options.debounceMs);
|
|
355
|
+
this.debounceTimers.set(path2, timer);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Process file system event
|
|
359
|
+
*/
|
|
360
|
+
async processFileEvent(event) {
|
|
361
|
+
const { type, path: path2 } = event;
|
|
362
|
+
const fileName = basename(path2);
|
|
363
|
+
switch (type) {
|
|
364
|
+
case "add":
|
|
365
|
+
this.logger.info(chalk.green(`\u2795 Added: ${fileName}`));
|
|
366
|
+
break;
|
|
367
|
+
case "change":
|
|
368
|
+
this.logger.info(chalk.blue(`\u{1F4DD} Changed: ${fileName}`));
|
|
369
|
+
break;
|
|
370
|
+
case "unlink":
|
|
371
|
+
this.logger.info(chalk.red(`\u{1F5D1}\uFE0F Removed: ${fileName}`));
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
if (this.options.autoValidate) {
|
|
375
|
+
await this.validateFile(path2);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Validate schema file
|
|
380
|
+
*/
|
|
381
|
+
async validateFile(path2) {
|
|
382
|
+
try {
|
|
383
|
+
this.logger.info(chalk.dim(" Validating..."));
|
|
384
|
+
const validationResult = await validateSchemaFile(path2);
|
|
385
|
+
if (validationResult.isValid) {
|
|
386
|
+
this.logger.success(chalk.green(" \u2713 Validation passed"));
|
|
387
|
+
const { detectSchemaRisks } = await loadRiskDetectorModule();
|
|
388
|
+
const risks = await detectSchemaRisks(path2);
|
|
389
|
+
if (risks.length > 0) {
|
|
390
|
+
this.logger.warn(` \u26A0\uFE0F ${risks.length} risk(s) detected`);
|
|
391
|
+
for (const risk of risks) {
|
|
392
|
+
this.logger.warn(chalk.yellow(` \u2022 ${risk.description}`));
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
} else {
|
|
396
|
+
this.logger.error(chalk.red(" \u2717 Validation failed"));
|
|
397
|
+
for (const error of validationResult.errors) {
|
|
398
|
+
this.logger.error(chalk.red(` \u2022 ${error}`));
|
|
399
|
+
}
|
|
400
|
+
if (this.options.notifyOnError) {
|
|
401
|
+
await notifyDesktop({
|
|
402
|
+
title: "Schema Validation Failed",
|
|
403
|
+
message: `${validationResult.errors.length} error(s) in ${path2.split("/").pop()}`,
|
|
404
|
+
type: "error"
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
} catch (error) {
|
|
409
|
+
this.logger.error(chalk.red(` Error during validation: ${error}`));
|
|
410
|
+
}
|
|
411
|
+
this.logger.info("");
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Handle watcher errors
|
|
415
|
+
*/
|
|
416
|
+
handleError(error) {
|
|
417
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
418
|
+
this.logger.error(chalk.red(`Watcher error: ${message}`));
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Get watcher statistics
|
|
422
|
+
*/
|
|
423
|
+
getStats() {
|
|
424
|
+
return {
|
|
425
|
+
isActive: this.watcher !== null,
|
|
426
|
+
watchedFiles: this.watcher?.getWatched() ? Object.keys(this.watcher.getWatched()).length : 0
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
async function createSchemaWatcher(options) {
|
|
431
|
+
const watcher = new SchemaWatcher(options);
|
|
432
|
+
await watcher.start();
|
|
433
|
+
return watcher;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// src/watchers/test-watcher.ts
|
|
437
|
+
init_esm_shims();
|
|
438
|
+
|
|
439
|
+
// src/incremental/affected-tests.ts
|
|
440
|
+
init_esm_shims();
|
|
441
|
+
function isVitestV1Output(output) {
|
|
442
|
+
if (typeof output !== "object" || output === null) return false;
|
|
443
|
+
const obj = output;
|
|
444
|
+
return Array.isArray(obj.testResults);
|
|
445
|
+
}
|
|
446
|
+
function isVitestV2Output(output) {
|
|
447
|
+
if (typeof output !== "object" || output === null) return false;
|
|
448
|
+
const obj = output;
|
|
449
|
+
return Array.isArray(obj.results);
|
|
450
|
+
}
|
|
451
|
+
function parseVitestV1(output) {
|
|
452
|
+
let passed = 0;
|
|
453
|
+
let failed = 0;
|
|
454
|
+
let total = 0;
|
|
455
|
+
for (const file of output.testResults || []) {
|
|
456
|
+
for (const assertion of file.assertionResults || []) {
|
|
457
|
+
total++;
|
|
458
|
+
if (assertion.status === "passed") passed++;
|
|
459
|
+
else if (assertion.status === "failed") failed++;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return { passed, failed, total };
|
|
463
|
+
}
|
|
464
|
+
function parseVitestV2(output) {
|
|
465
|
+
let passed = 0;
|
|
466
|
+
let failed = 0;
|
|
467
|
+
let total = 0;
|
|
468
|
+
for (const file of output.results || []) {
|
|
469
|
+
for (const test of file.tests || []) {
|
|
470
|
+
total++;
|
|
471
|
+
const state = test.result?.state;
|
|
472
|
+
if (state === "pass") passed++;
|
|
473
|
+
else if (state === "fail") failed++;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return { passed, failed, total };
|
|
477
|
+
}
|
|
478
|
+
function parseVitestOutput(jsonOutput) {
|
|
479
|
+
if (isVitestV1Output(jsonOutput)) {
|
|
480
|
+
return parseVitestV1(jsonOutput);
|
|
481
|
+
}
|
|
482
|
+
if (isVitestV2Output(jsonOutput)) {
|
|
483
|
+
return parseVitestV2(jsonOutput);
|
|
484
|
+
}
|
|
485
|
+
return { passed: 0, failed: 0, total: 0 };
|
|
486
|
+
}
|
|
487
|
+
async function findAffectedTests(changedFiles) {
|
|
488
|
+
const affectedTests = /* @__PURE__ */ new Set();
|
|
489
|
+
for (const file of changedFiles) {
|
|
490
|
+
if (file.includes(".test.") || file.includes(".spec.")) {
|
|
491
|
+
affectedTests.add(file);
|
|
492
|
+
continue;
|
|
493
|
+
}
|
|
494
|
+
const relatedTests = await findRelatedTestFiles(file);
|
|
495
|
+
for (const test of relatedTests) {
|
|
496
|
+
affectedTests.add(test);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
return Array.from(affectedTests);
|
|
500
|
+
}
|
|
501
|
+
async function findRelatedTestFiles(sourceFile) {
|
|
502
|
+
const tests = [];
|
|
503
|
+
try {
|
|
504
|
+
const baseName = sourceFile.replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
505
|
+
const fileName = baseName.split("/").pop() || "";
|
|
506
|
+
const patterns = [
|
|
507
|
+
`**/${fileName}.test.ts`,
|
|
508
|
+
`**/${fileName}.test.tsx`,
|
|
509
|
+
`**/${fileName}.spec.ts`,
|
|
510
|
+
`**/${fileName}.spec.tsx`,
|
|
511
|
+
`**/__tests__/${fileName}.ts`,
|
|
512
|
+
`**/__tests__/${fileName}.tsx`
|
|
513
|
+
];
|
|
514
|
+
for (const pattern of patterns) {
|
|
515
|
+
const matches = await glob(pattern, {
|
|
516
|
+
ignore: ["**/node_modules/**", "**/dist/**"]
|
|
517
|
+
});
|
|
518
|
+
tests.push(...matches);
|
|
519
|
+
}
|
|
520
|
+
return tests;
|
|
521
|
+
} catch (_error) {
|
|
522
|
+
return tests;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
async function runAffectedTests(changedFiles) {
|
|
526
|
+
const affectedTests = await findAffectedTests(changedFiles);
|
|
527
|
+
if (affectedTests.length === 0) {
|
|
528
|
+
return {
|
|
529
|
+
success: true,
|
|
530
|
+
totalTests: 0,
|
|
531
|
+
passedTests: 0,
|
|
532
|
+
failedTests: 0,
|
|
533
|
+
duration: 0
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
const startTime = Date.now();
|
|
537
|
+
try {
|
|
538
|
+
const result = await execa(
|
|
539
|
+
"pnpm",
|
|
540
|
+
["exec", "vitest", "run", "--reporter=json", ...affectedTests],
|
|
541
|
+
{
|
|
542
|
+
reject: false,
|
|
543
|
+
// Don't throw on test failures
|
|
544
|
+
timeout: 3e5
|
|
545
|
+
// 5 minute timeout
|
|
546
|
+
}
|
|
547
|
+
);
|
|
548
|
+
const duration = Date.now() - startTime;
|
|
549
|
+
try {
|
|
550
|
+
const jsonOutput = JSON.parse(result.stdout);
|
|
551
|
+
const { passed, failed, total } = parseVitestOutput(jsonOutput);
|
|
552
|
+
if (total === 0 && affectedTests.length > 0) {
|
|
553
|
+
process.stderr.write(
|
|
554
|
+
"[affected-tests] Warning: Unrecognized vitest output format, falling back to exit code\n"
|
|
555
|
+
);
|
|
556
|
+
return {
|
|
557
|
+
success: result.exitCode === 0,
|
|
558
|
+
totalTests: affectedTests.length,
|
|
559
|
+
passedTests: result.exitCode === 0 ? affectedTests.length : 0,
|
|
560
|
+
failedTests: result.exitCode === 0 ? 0 : affectedTests.length,
|
|
561
|
+
duration
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
return {
|
|
565
|
+
success: failed === 0,
|
|
566
|
+
totalTests: total,
|
|
567
|
+
passedTests: passed,
|
|
568
|
+
failedTests: failed,
|
|
569
|
+
duration
|
|
570
|
+
};
|
|
571
|
+
} catch {
|
|
572
|
+
return {
|
|
573
|
+
success: result.exitCode === 0,
|
|
574
|
+
totalTests: affectedTests.length,
|
|
575
|
+
passedTests: result.exitCode === 0 ? affectedTests.length : 0,
|
|
576
|
+
failedTests: result.exitCode === 0 ? 0 : affectedTests.length,
|
|
577
|
+
duration
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
} catch (error) {
|
|
581
|
+
const duration = Date.now() - startTime;
|
|
582
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
583
|
+
process.stderr.write(`[affected-tests] Test execution failed: ${message}
|
|
584
|
+
`);
|
|
585
|
+
return {
|
|
586
|
+
success: false,
|
|
587
|
+
totalTests: affectedTests.length,
|
|
588
|
+
passedTests: 0,
|
|
589
|
+
failedTests: affectedTests.length,
|
|
590
|
+
duration
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
// src/watchers/test-watcher.ts
|
|
596
|
+
var TestWatcher = class {
|
|
597
|
+
watcher = null;
|
|
598
|
+
logger = createCLILogger("test-watcher");
|
|
599
|
+
debounceTimers = /* @__PURE__ */ new Map();
|
|
600
|
+
options;
|
|
601
|
+
isRunning = false;
|
|
602
|
+
constructor(options) {
|
|
603
|
+
this.options = {
|
|
604
|
+
patterns: options.patterns,
|
|
605
|
+
ignored: options.ignored || ["**/node_modules/**", "**/.git/**", "**/dist/**"],
|
|
606
|
+
autoRun: options.autoRun ?? true,
|
|
607
|
+
notifyOnFailure: options.notifyOnFailure ?? true,
|
|
608
|
+
debounceMs: options.debounceMs ?? 1e3
|
|
609
|
+
};
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Start watching test files
|
|
613
|
+
*/
|
|
614
|
+
async start() {
|
|
615
|
+
this.logger.info(chalk.cyan("\u{1F50D} Starting test watcher..."));
|
|
616
|
+
this.logger.info(chalk.dim(` Watching: ${this.options.patterns.join(", ")}`));
|
|
617
|
+
this.watcher = watch(this.options.patterns, {
|
|
618
|
+
ignored: this.options.ignored,
|
|
619
|
+
persistent: true,
|
|
620
|
+
ignoreInitial: true
|
|
621
|
+
});
|
|
622
|
+
this.watcher.on("add", (path2) => this.handleFileEvent("add", path2)).on("change", (path2) => this.handleFileEvent("change", path2)).on("unlink", (path2) => this.handleFileEvent("unlink", path2)).on("error", (error) => this.handleError(error));
|
|
623
|
+
this.logger.success("\u2705 Test watcher started");
|
|
624
|
+
this.logger.info(chalk.dim(" Press Ctrl+C to stop\n"));
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Stop watching
|
|
628
|
+
*/
|
|
629
|
+
async stop() {
|
|
630
|
+
if (this.watcher) {
|
|
631
|
+
await this.watcher.close();
|
|
632
|
+
this.watcher = null;
|
|
633
|
+
this.logger.info("Test watcher stopped");
|
|
634
|
+
}
|
|
635
|
+
for (const timer of this.debounceTimers.values()) {
|
|
636
|
+
clearTimeout(timer);
|
|
637
|
+
}
|
|
638
|
+
this.debounceTimers.clear();
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Handle file system events with debouncing
|
|
642
|
+
*/
|
|
643
|
+
handleFileEvent(type, path2) {
|
|
644
|
+
const existingTimer = this.debounceTimers.get(path2);
|
|
645
|
+
if (existingTimer) {
|
|
646
|
+
clearTimeout(existingTimer);
|
|
647
|
+
}
|
|
648
|
+
const timer = setTimeout(() => {
|
|
649
|
+
this.processFileEvent(type, path2);
|
|
650
|
+
this.debounceTimers.delete(path2);
|
|
651
|
+
}, this.options.debounceMs);
|
|
652
|
+
this.debounceTimers.set(path2, timer);
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Process file system event
|
|
656
|
+
*/
|
|
657
|
+
async processFileEvent(type, path2) {
|
|
658
|
+
if (this.isRunning) {
|
|
659
|
+
this.logger.warn(chalk.yellow("\u23F3 Tests already running, skipping..."));
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
const fileName = path2.split("/").pop() || path2;
|
|
663
|
+
switch (type) {
|
|
664
|
+
case "add":
|
|
665
|
+
this.logger.info(chalk.green(`\u2795 Test added: ${fileName}`));
|
|
666
|
+
break;
|
|
667
|
+
case "change":
|
|
668
|
+
this.logger.info(chalk.blue(`\u{1F4DD} Test changed: ${fileName}`));
|
|
669
|
+
break;
|
|
670
|
+
case "unlink":
|
|
671
|
+
this.logger.info(chalk.red(`\u{1F5D1}\uFE0F Test removed: ${fileName}`));
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
if (this.options.autoRun) {
|
|
675
|
+
await this.runTests(path2);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Run affected tests
|
|
680
|
+
*/
|
|
681
|
+
async runTests(changedFile) {
|
|
682
|
+
this.isRunning = true;
|
|
683
|
+
try {
|
|
684
|
+
this.logger.info(chalk.cyan("\n\u{1F9EA} Running affected tests...\n"));
|
|
685
|
+
const startTime = Date.now();
|
|
686
|
+
const result = await runAffectedTests([changedFile]);
|
|
687
|
+
const duration = Date.now() - startTime;
|
|
688
|
+
if (result.success) {
|
|
689
|
+
this.logger.success(
|
|
690
|
+
chalk.green(
|
|
691
|
+
`
|
|
692
|
+
\u2705 Tests passed (${result.passedTests}/${result.totalTests}) in ${duration}ms`
|
|
693
|
+
)
|
|
694
|
+
);
|
|
695
|
+
await notifyDesktop({
|
|
696
|
+
title: "Tests Passed",
|
|
697
|
+
message: `${result.passedTests}/${result.totalTests} tests passed`,
|
|
698
|
+
type: "success"
|
|
699
|
+
});
|
|
700
|
+
} else {
|
|
701
|
+
this.logger.error(
|
|
702
|
+
chalk.red(`
|
|
703
|
+
\u274C Tests failed (${result.failedTests} failed) in ${duration}ms`)
|
|
704
|
+
);
|
|
705
|
+
if (this.options.notifyOnFailure) {
|
|
706
|
+
await notifyDesktop({
|
|
707
|
+
title: "Tests Failed",
|
|
708
|
+
message: `${result.failedTests} test(s) failed`,
|
|
709
|
+
type: "error"
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
} catch (error) {
|
|
714
|
+
this.logger.error(chalk.red(`Test execution error: ${error}`));
|
|
715
|
+
} finally {
|
|
716
|
+
this.isRunning = false;
|
|
717
|
+
this.logger.info("");
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Handle watcher errors
|
|
722
|
+
*/
|
|
723
|
+
handleError(error) {
|
|
724
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
725
|
+
this.logger.error(chalk.red(`Watcher error: ${message}`));
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Get watcher status
|
|
729
|
+
*/
|
|
730
|
+
getStatus() {
|
|
731
|
+
return {
|
|
732
|
+
isActive: this.watcher !== null,
|
|
733
|
+
isRunning: this.isRunning
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
async function createTestWatcher(options) {
|
|
738
|
+
const watcher = new TestWatcher(options);
|
|
739
|
+
await watcher.start();
|
|
740
|
+
return watcher;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// src/commands/watch.ts
|
|
744
|
+
var logger2 = createCLILogger("watch");
|
|
745
|
+
function addFallbackSchemaPatterns(patterns) {
|
|
746
|
+
const detected = detectDatabasePackage(process.cwd());
|
|
747
|
+
if (detected) {
|
|
748
|
+
patterns.push(path.join(detected, "src/schema/**/*.ts"));
|
|
749
|
+
patterns.push(path.join(detected, "sql/**/*.sql"));
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
for (const candidate of DATABASE_PACKAGE_CANDIDATES) {
|
|
753
|
+
patterns.push(`packages/${candidate}/src/schema/**/*.ts`);
|
|
754
|
+
patterns.push(`packages/${candidate}/sql/**/*.sql`);
|
|
755
|
+
}
|
|
756
|
+
patterns.push("src/schema/**/*.ts");
|
|
757
|
+
patterns.push("db/src/schema/**/*.ts");
|
|
758
|
+
}
|
|
759
|
+
async function buildSchemaPatterns() {
|
|
760
|
+
const patterns = ["supabase/schemas/**/*.sql"];
|
|
761
|
+
try {
|
|
762
|
+
const dbPackagePath = await getDatabasePackagePath();
|
|
763
|
+
patterns.push(path.join(dbPackagePath, "src/schema/**/*.ts"));
|
|
764
|
+
patterns.push(path.join(dbPackagePath, "sql/**/*.sql"));
|
|
765
|
+
} catch {
|
|
766
|
+
addFallbackSchemaPatterns(patterns);
|
|
767
|
+
}
|
|
768
|
+
return patterns;
|
|
769
|
+
}
|
|
770
|
+
var watchSchemaCommand = new Command("schema").description("Watch schema files for changes").option("--no-validate", "Disable automatic validation").option("--no-notify", "Disable desktop notifications").action(async (options) => {
|
|
771
|
+
try {
|
|
772
|
+
if (isNonInteractiveEnabled()) {
|
|
773
|
+
throw new CLIError(
|
|
774
|
+
"Watch mode is not available in non-interactive mode",
|
|
775
|
+
"NON_INTERACTIVE_REQUIRED",
|
|
776
|
+
["Run without --json/--format json", "Avoid running in CI"]
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
assertTtyRequired("watch schema");
|
|
780
|
+
logger2.section("Schema Watcher");
|
|
781
|
+
const patterns = await buildSchemaPatterns();
|
|
782
|
+
const watcher = await createSchemaWatcher({
|
|
783
|
+
patterns,
|
|
784
|
+
autoValidate: options.validate ?? true,
|
|
785
|
+
notifyOnError: options.notify ?? true
|
|
786
|
+
});
|
|
787
|
+
const cleanup = async () => {
|
|
788
|
+
logger2.info(chalk.yellow("Stopping schema watcher..."));
|
|
789
|
+
await watcher.stop();
|
|
790
|
+
};
|
|
791
|
+
registerCleanup(cleanup);
|
|
792
|
+
await new Promise(() => {
|
|
793
|
+
});
|
|
794
|
+
} catch (error) {
|
|
795
|
+
if (error instanceof CLIError) {
|
|
796
|
+
throw error;
|
|
797
|
+
}
|
|
798
|
+
throw new CLIError(
|
|
799
|
+
"Schema watcher failed",
|
|
800
|
+
"WATCH_SCHEMA_ERROR",
|
|
801
|
+
["Check error details above", "Verify file paths are correct"],
|
|
802
|
+
error instanceof Error ? error : void 0
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
var watchTestCommand = new Command("test").description("Watch test files and re-run on changes").option("--no-run", "Disable automatic test execution").option("--no-notify", "Disable desktop notifications").action(async (options) => {
|
|
807
|
+
try {
|
|
808
|
+
if (isNonInteractiveEnabled()) {
|
|
809
|
+
throw new CLIError(
|
|
810
|
+
"Watch mode is not available in non-interactive mode",
|
|
811
|
+
"NON_INTERACTIVE_REQUIRED",
|
|
812
|
+
["Run without --json/--format json", "Avoid running in CI"]
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
assertTtyRequired("watch test");
|
|
816
|
+
logger2.section("Test Watcher");
|
|
817
|
+
const watcher = await createTestWatcher({
|
|
818
|
+
patterns: [
|
|
819
|
+
"packages/**/tests/**/*.test.ts",
|
|
820
|
+
"packages/**/__tests__/**/*.ts",
|
|
821
|
+
"apps/**/tests/**/*.test.ts",
|
|
822
|
+
"apps/**/__tests__/**/*.ts"
|
|
823
|
+
],
|
|
824
|
+
autoRun: options.run ?? true,
|
|
825
|
+
notifyOnFailure: options.notify ?? true
|
|
826
|
+
});
|
|
827
|
+
const cleanup = async () => {
|
|
828
|
+
logger2.info(chalk.yellow("Stopping test watcher..."));
|
|
829
|
+
await watcher.stop();
|
|
830
|
+
};
|
|
831
|
+
registerCleanup(cleanup);
|
|
832
|
+
await new Promise(() => {
|
|
833
|
+
});
|
|
834
|
+
} catch (error) {
|
|
835
|
+
if (error instanceof CLIError) {
|
|
836
|
+
throw error;
|
|
837
|
+
}
|
|
838
|
+
throw new CLIError(
|
|
839
|
+
"Test watcher failed",
|
|
840
|
+
"WATCH_TEST_ERROR",
|
|
841
|
+
["Check error details above", "Verify test file paths are correct"],
|
|
842
|
+
error instanceof Error ? error : void 0
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
});
|
|
846
|
+
var watchAllAction = async (options) => {
|
|
847
|
+
try {
|
|
848
|
+
if (isNonInteractiveEnabled()) {
|
|
849
|
+
throw new CLIError(
|
|
850
|
+
"Watch mode is not available in non-interactive mode",
|
|
851
|
+
"NON_INTERACTIVE_REQUIRED",
|
|
852
|
+
["Run without --json/--format json", "Avoid running in CI"]
|
|
853
|
+
);
|
|
854
|
+
}
|
|
855
|
+
assertTtyRequired("watch --all");
|
|
856
|
+
logger2.section("Combined Watcher");
|
|
857
|
+
logger2.info(chalk.cyan("Starting schema and test watchers...\n"));
|
|
858
|
+
const schemaPatterns = await buildSchemaPatterns();
|
|
859
|
+
const schemaWatcher = await createSchemaWatcher({
|
|
860
|
+
patterns: schemaPatterns,
|
|
861
|
+
autoValidate: options.validate ?? true,
|
|
862
|
+
notifyOnError: options.notify ?? true
|
|
863
|
+
});
|
|
864
|
+
const testWatcher = await createTestWatcher({
|
|
865
|
+
patterns: [
|
|
866
|
+
"packages/**/tests/**/*.test.ts",
|
|
867
|
+
"packages/**/__tests__/**/*.ts",
|
|
868
|
+
"apps/**/tests/**/*.test.ts",
|
|
869
|
+
"apps/**/__tests__/**/*.ts"
|
|
870
|
+
],
|
|
871
|
+
autoRun: options.run ?? true,
|
|
872
|
+
notifyOnFailure: options.notify ?? true
|
|
873
|
+
});
|
|
874
|
+
logger2.success(chalk.green("\u2705 All watchers started\n"));
|
|
875
|
+
const cleanup = async () => {
|
|
876
|
+
logger2.info(chalk.yellow("Stopping all watchers..."));
|
|
877
|
+
await Promise.all([schemaWatcher.stop(), testWatcher.stop()]);
|
|
878
|
+
};
|
|
879
|
+
registerCleanup(cleanup);
|
|
880
|
+
await new Promise(() => {
|
|
881
|
+
});
|
|
882
|
+
} catch (error) {
|
|
883
|
+
if (error instanceof CLIError) {
|
|
884
|
+
throw error;
|
|
885
|
+
}
|
|
886
|
+
throw new CLIError(
|
|
887
|
+
"Combined watcher failed",
|
|
888
|
+
"WATCH_ALL_ERROR",
|
|
889
|
+
["Check error details above", "Verify file paths are correct"],
|
|
890
|
+
error instanceof Error ? error : void 0
|
|
891
|
+
);
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
var watchCommand = new Command("watch").description("Watch files for changes and provide instant feedback").option("--all", "Watch all file types (schema + tests)").option("--no-validate", "Disable automatic validation").option("--no-run", "Disable automatic test execution").option("--no-notify", "Disable desktop notifications").action(async (options) => {
|
|
895
|
+
if (options.all) {
|
|
896
|
+
await watchAllAction(options);
|
|
897
|
+
} else {
|
|
898
|
+
logger2.info("Usage: runa watch [command]");
|
|
899
|
+
logger2.info("");
|
|
900
|
+
logger2.info("Commands:");
|
|
901
|
+
logger2.info(" schema Watch schema files");
|
|
902
|
+
logger2.info(" test Watch test files");
|
|
903
|
+
logger2.info("");
|
|
904
|
+
logger2.info("Options:");
|
|
905
|
+
logger2.info(" --all Watch all file types");
|
|
906
|
+
}
|
|
907
|
+
});
|
|
908
|
+
watchCommand.addCommand(watchSchemaCommand);
|
|
909
|
+
watchCommand.addCommand(watchTestCommand);
|
|
910
|
+
|
|
911
|
+
export { watchCommand, watchSchemaCommand, watchTestCommand };
|