@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,1933 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import { getErrorMessage } from './chunk-IBVVGH6X.js';
|
|
4
|
+
import { getOutputFormatFromEnv } from './chunk-HKUWEGUX.js';
|
|
5
|
+
import { __export, __esm, init_esm_shims, __require, __toCommonJS } from './chunk-VRXHCR5K.js';
|
|
6
|
+
import { createCLILogger, CLIError } from '@runa-ai/runa';
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { fromPromise, setup, assign, createActor } from 'xstate';
|
|
9
|
+
import * as fs2 from 'fs';
|
|
10
|
+
import * as path2 from 'path';
|
|
11
|
+
|
|
12
|
+
createRequire(import.meta.url);
|
|
13
|
+
|
|
14
|
+
// src/commands/template-check/types.ts
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
__export(types_exports, {
|
|
17
|
+
calculateSummary: () => calculateSummary,
|
|
18
|
+
createInitialContext: () => createInitialContext,
|
|
19
|
+
createOutput: () => createOutput
|
|
20
|
+
});
|
|
21
|
+
function createInitialContext(input, repoRoot) {
|
|
22
|
+
return {
|
|
23
|
+
input,
|
|
24
|
+
repoRoot,
|
|
25
|
+
templateDir: `${repoRoot}/packages/runa-templates/templates`,
|
|
26
|
+
inventory: null,
|
|
27
|
+
results: [],
|
|
28
|
+
startTime: Date.now(),
|
|
29
|
+
error: null
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function calculateSummary(results) {
|
|
33
|
+
const total = results.length;
|
|
34
|
+
const identical = results.filter(
|
|
35
|
+
(r) => r.status === "identical" || r.status === "renamed" || r.status === "intentionally-different"
|
|
36
|
+
).length;
|
|
37
|
+
const diff = results.filter((r) => r.status === "diff").length;
|
|
38
|
+
const runaOnly = results.filter((r) => r.status === "runa-only").length;
|
|
39
|
+
const templateOnly = results.filter((r) => r.status === "template-only").length;
|
|
40
|
+
const expectedOnly = results.filter(
|
|
41
|
+
(r) => r.status === "expected-runa-only" || r.status === "expected-template-only"
|
|
42
|
+
).length;
|
|
43
|
+
return {
|
|
44
|
+
total,
|
|
45
|
+
identical,
|
|
46
|
+
diff,
|
|
47
|
+
runaOnly,
|
|
48
|
+
templateOnly,
|
|
49
|
+
expectedOnly,
|
|
50
|
+
identicalPercent: total > 0 ? Math.round(identical / total * 1e3) / 10 : 100
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function createOutput(context) {
|
|
54
|
+
const durationMs = Date.now() - context.startTime;
|
|
55
|
+
const summary = calculateSummary(context.results);
|
|
56
|
+
const hasUnexpectedDiffs = summary.diff > 0 || summary.runaOnly > 0 || summary.templateOnly > 0;
|
|
57
|
+
return {
|
|
58
|
+
success: !context.error && !hasUnexpectedDiffs,
|
|
59
|
+
exitCode: context.error ? 2 : hasUnexpectedDiffs ? 1 : 0,
|
|
60
|
+
results: context.results,
|
|
61
|
+
summary,
|
|
62
|
+
error: context.error ?? void 0,
|
|
63
|
+
durationMs
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
var init_types = __esm({
|
|
67
|
+
"src/commands/template-check/types.ts"() {
|
|
68
|
+
init_esm_shims();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// src/commands/template-check/index.ts
|
|
73
|
+
init_esm_shims();
|
|
74
|
+
|
|
75
|
+
// src/commands/template-check/commands/template-check.ts
|
|
76
|
+
init_esm_shims();
|
|
77
|
+
|
|
78
|
+
// src/commands/template-check/machine.ts
|
|
79
|
+
init_esm_shims();
|
|
80
|
+
|
|
81
|
+
// src/commands/template-check/actors/index.ts
|
|
82
|
+
init_esm_shims();
|
|
83
|
+
|
|
84
|
+
// src/commands/template-check/actors/compare.ts
|
|
85
|
+
init_esm_shims();
|
|
86
|
+
|
|
87
|
+
// src/commands/template-check/utils/diff-analyzer.ts
|
|
88
|
+
init_esm_shims();
|
|
89
|
+
|
|
90
|
+
// src/commands/template-check/utils/normalizer.ts
|
|
91
|
+
init_esm_shims();
|
|
92
|
+
|
|
93
|
+
// src/commands/template-check/config.ts
|
|
94
|
+
init_esm_shims();
|
|
95
|
+
var CODE_EXTENSIONS = [".ts", ".tsx", ".yml", ".yaml"];
|
|
96
|
+
var RUNA_ONLY_FILES = [
|
|
97
|
+
// === Root Config ===
|
|
98
|
+
"runa.config.ts",
|
|
99
|
+
// runa-repo dogfooding config
|
|
100
|
+
// === Documentation ===
|
|
101
|
+
".claude/rules/dogfooding.md",
|
|
102
|
+
// SDK development philosophy
|
|
103
|
+
// === runa-repo Domain Schemas (runa-specific business logic) ===
|
|
104
|
+
"supabase/schemas/declarative/10_accounts.sql",
|
|
105
|
+
"supabase/schemas/declarative/20_repos.sql",
|
|
106
|
+
"supabase/schemas/declarative/30_pipelines.sql",
|
|
107
|
+
"supabase/schemas/declarative/40_projects.sql",
|
|
108
|
+
"supabase/schemas/declarative/80_analytics.sql",
|
|
109
|
+
"supabase/schemas/declarative/90_test_execution.sql",
|
|
110
|
+
"supabase/schemas/idempotent/20_security_hardening.sql",
|
|
111
|
+
// === runa-repo Workflows (SDK release & internal) ===
|
|
112
|
+
".github/workflows/auto-changeset.yml",
|
|
113
|
+
".github/workflows/changesets.yml",
|
|
114
|
+
".github/workflows/license-check.yml",
|
|
115
|
+
// SDK license compatibility check
|
|
116
|
+
".github/workflows/package-test.yml",
|
|
117
|
+
".github/workflows/publish-packages.yml",
|
|
118
|
+
".github/workflows/publish-templates.yml",
|
|
119
|
+
".github/workflows/publish-github-packages.yml",
|
|
120
|
+
// SDK package publishing
|
|
121
|
+
".github/workflows/publish-npmjs.yml",
|
|
122
|
+
// SDK package publishing (npmjs)
|
|
123
|
+
".github/workflows/runa-templates.yml",
|
|
124
|
+
// Template validation (pj-repos don't have templates)
|
|
125
|
+
// === runa-repo Specific Scripts ===
|
|
126
|
+
"packages/database/scripts/db-sync-partition.ts",
|
|
127
|
+
// Partition defense (TODO: add to template)
|
|
128
|
+
"packages/database/scripts/db-sync-partition.test.ts",
|
|
129
|
+
// Partition defense tests
|
|
130
|
+
"packages/database/scripts/check-plpgsql.ts",
|
|
131
|
+
"packages/database/scripts/run-splinter.ts",
|
|
132
|
+
"packages/database/scripts/seed-generators/index.ts",
|
|
133
|
+
"packages/database/scripts/seed-generators/loader.ts",
|
|
134
|
+
"packages/database/scripts/seed-generators/types.ts",
|
|
135
|
+
"packages/database/scripts/seed-plugins/supabase-auth.ts",
|
|
136
|
+
"packages/database/scripts/seed-data-sources/api-source.ts",
|
|
137
|
+
"packages/database/scripts/seed-data-sources/csv-source.ts",
|
|
138
|
+
"packages/database/scripts/seed-data-sources/index.ts",
|
|
139
|
+
"packages/database/scripts/seed-data-sources/json-source.ts",
|
|
140
|
+
"packages/database/scripts/seed-data-sources/types.ts",
|
|
141
|
+
"packages/database/scripts/seed-hooks/index.ts",
|
|
142
|
+
"packages/database/scripts/seed-hooks/types.ts",
|
|
143
|
+
"packages/database/scripts/seed-utils/index.ts",
|
|
144
|
+
"packages/database/scripts/seed-utils/security.ts",
|
|
145
|
+
// === runa-repo Specific Tests ===
|
|
146
|
+
"packages/database/tests/00_system-schemas.sql",
|
|
147
|
+
"packages/database/tests/01_table-helpers.sql",
|
|
148
|
+
"packages/database/tests/02_constraint-helpers.sql",
|
|
149
|
+
"packages/database/tests/03_rls-helpers.sql",
|
|
150
|
+
"packages/database/tests/04_behavior-tests.sql",
|
|
151
|
+
"packages/database/tests/05_supabase-compat.sql",
|
|
152
|
+
"packages/database/tests/10_behavior_tests.sql",
|
|
153
|
+
"supabase/tests/00_system-schemas.sql",
|
|
154
|
+
"supabase/tests/01_table-helpers.sql",
|
|
155
|
+
"supabase/tests/02_constraint-helpers.sql",
|
|
156
|
+
"supabase/tests/03_rls-helpers.sql",
|
|
157
|
+
"supabase/tests/04_behavior-tests.sql",
|
|
158
|
+
"supabase/tests/05_supabase-compat.sql",
|
|
159
|
+
// === runa-repo Vitest Configs ===
|
|
160
|
+
"config/vitest/vitest.config.cli.ts",
|
|
161
|
+
"config/vitest/vitest.config.e2e.ts",
|
|
162
|
+
"config/vitest/vitest.config.runa.ts",
|
|
163
|
+
"config/vitest/layer3-global-setup.ts",
|
|
164
|
+
// === runa-repo Database Extension Types ===
|
|
165
|
+
// Note: schema.ts, relations.ts, entities.ts moved to INTENTIONALLY_DIFFERENT_FILES
|
|
166
|
+
// (templates have stub versions, runa-repo has actual generated code)
|
|
167
|
+
"packages/database/src/types/extensions/index.ts",
|
|
168
|
+
"packages/database/src/types/extensions/pgvector.ts",
|
|
169
|
+
"packages/database/src/types/extensions/postgis.ts"
|
|
170
|
+
];
|
|
171
|
+
var TEMPLATE_ONLY_FILES = [
|
|
172
|
+
// === Documentation & Setup ===
|
|
173
|
+
".claude/rules/sdk/setup.md",
|
|
174
|
+
// pj-repo setup guide
|
|
175
|
+
".claude/rules/local/README.md",
|
|
176
|
+
// Local rules customization guide
|
|
177
|
+
".claude/commands/local/README.md",
|
|
178
|
+
// Local commands guide
|
|
179
|
+
".claude/skills/local/README.md",
|
|
180
|
+
// Local skills guide
|
|
181
|
+
// === pj-repo Starter Files ===
|
|
182
|
+
".env.example",
|
|
183
|
+
// Environment template
|
|
184
|
+
".runa/ci.config.json",
|
|
185
|
+
// CI configuration
|
|
186
|
+
"scripts/load-env.ts",
|
|
187
|
+
// Environment loader
|
|
188
|
+
"global-setup.ts",
|
|
189
|
+
// Root global setup (runa-repo uses config/playwright/global-setup.ts)
|
|
190
|
+
// === apps/web/ (pj-repo starter app) ===
|
|
191
|
+
// Note: runa-repo uses apps/dashboard/, templates provide apps/web/ starter
|
|
192
|
+
"apps/web/package.json",
|
|
193
|
+
"apps/web/tsconfig.json",
|
|
194
|
+
"apps/web/next.config.ts",
|
|
195
|
+
"apps/web/proxy.ts",
|
|
196
|
+
// Next.js 16+ proxy (replaces middleware.ts)
|
|
197
|
+
"apps/web/app/layout.tsx",
|
|
198
|
+
"apps/web/app/page.tsx",
|
|
199
|
+
"apps/web/app/(protected)/layout.tsx",
|
|
200
|
+
// Auth guard layout
|
|
201
|
+
"apps/web/app/(protected)/dashboard/page.tsx",
|
|
202
|
+
// Protected dashboard
|
|
203
|
+
"apps/web/app/(public)/login/page.tsx",
|
|
204
|
+
// Public login page
|
|
205
|
+
"apps/web/app/auth/callback/route.ts",
|
|
206
|
+
// OAuth callback handler
|
|
207
|
+
"apps/web/lib/supabase/index.ts",
|
|
208
|
+
// Supabase client exports
|
|
209
|
+
"apps/web/lib/supabase/client.ts",
|
|
210
|
+
// Browser client
|
|
211
|
+
"apps/web/lib/supabase/server.ts",
|
|
212
|
+
// Server client
|
|
213
|
+
"apps/web/lib/supabase/env.ts",
|
|
214
|
+
// Environment resolution
|
|
215
|
+
// === packages/api-client (pj-repo starter) ===
|
|
216
|
+
"packages/api-client/package.json",
|
|
217
|
+
"packages/api-client/tsconfig.json",
|
|
218
|
+
"packages/api-client/index.ts",
|
|
219
|
+
"packages/api-client/mutations/example.ts",
|
|
220
|
+
"packages/api-client/queries/example.ts",
|
|
221
|
+
"packages/api-client/tests/queries.test.tsx",
|
|
222
|
+
// === Optional Database Extensions ===
|
|
223
|
+
"packages/database/extensions/pgvector.sql",
|
|
224
|
+
"packages/database/extensions/postgis.sql",
|
|
225
|
+
// === pj-repo Universal Tests ===
|
|
226
|
+
"packages/database/tests/10_universal_constraints.test.sql",
|
|
227
|
+
"packages/database/tests/40_universal_security_rls.test.sql",
|
|
228
|
+
"packages/database/tests/50_universal_data_integrity.test.sql",
|
|
229
|
+
"packages/database/tests/90_behavior_patterns.test.sql",
|
|
230
|
+
"packages/database/scripts/run-pgtap-tests.ts",
|
|
231
|
+
// === pj-repo Seed Helpers ===
|
|
232
|
+
"supabase/migrations/00000000000000_extensions.sql",
|
|
233
|
+
"supabase/seeds/data/00_auth_users.sql",
|
|
234
|
+
"supabase/seeds/helpers/00_seed_helpers.sql",
|
|
235
|
+
"supabase/seeds/helpers/99_sequences.sql",
|
|
236
|
+
// Note: local.sql, preview.sql, production.sql are NOT allowed (ci.sql only)
|
|
237
|
+
"supabase/tests/00_test-helpers.sql"
|
|
238
|
+
];
|
|
239
|
+
var PLACEHOLDER_PATTERNS = {
|
|
240
|
+
// === Package & Import References ===
|
|
241
|
+
// Package references: @runa-ai/runa, @runa-ai/runa-cli, etc.
|
|
242
|
+
PACKAGE_REF: {
|
|
243
|
+
pattern: /@runa-ai\/runa(-\w+)?/g,
|
|
244
|
+
replacement: "{{PACKAGE_REF}}"
|
|
245
|
+
},
|
|
246
|
+
// Internal SDK paths (runa-repo uses direct paths, pj-repo uses package imports)
|
|
247
|
+
// Example: ../../packages/sdk/src/test/runtime/config/runa-config.js
|
|
248
|
+
INTERNAL_SDK_PATH: {
|
|
249
|
+
pattern: /['"]\.\.\/+packages\/sdk\/src\/[^'"]+['"]/g,
|
|
250
|
+
replacement: "'{{SDK_IMPORT}}'"
|
|
251
|
+
},
|
|
252
|
+
// Path aliases: @/database, @/machines, etc.
|
|
253
|
+
PATH_ALIAS: {
|
|
254
|
+
pattern: /@\/(\w+)/g,
|
|
255
|
+
replacement: "{{PATH_ALIAS}}/$1"
|
|
256
|
+
},
|
|
257
|
+
// === Schema & Database References ===
|
|
258
|
+
// Schema.table references
|
|
259
|
+
SCHEMA_TABLE: {
|
|
260
|
+
pattern: /\b(accounts|repos|pipelines|identity|products|orders)\.(clients|repositories|webhooks|users|tenants|items|purchases)\b/g,
|
|
261
|
+
replacement: "{{SCHEMA}}.{{TABLE}}"
|
|
262
|
+
},
|
|
263
|
+
// Drizzle table names
|
|
264
|
+
DRIZZLE_TABLE: {
|
|
265
|
+
pattern: /\b(clients|repositories|webhooks|users|tenants|items)In(Accounts|Repos|Pipelines|Identity|Products|Orders)\b/g,
|
|
266
|
+
replacement: "{{DRIZZLE_TABLE}}"
|
|
267
|
+
},
|
|
268
|
+
// Scope column names
|
|
269
|
+
SCOPE_COLUMN: {
|
|
270
|
+
pattern: /\b(client_id|tenant_id|scope_id|org_id|organization_id|workspace_id)\b/g,
|
|
271
|
+
replacement: "{{SCOPE_COLUMN}}"
|
|
272
|
+
},
|
|
273
|
+
// === Comment Differences ===
|
|
274
|
+
// Workspace type: "runa workspace" vs "pj-repo workspace"
|
|
275
|
+
WORKSPACE_TYPE: {
|
|
276
|
+
pattern: /\b(runa|pj-repo|the)\s+workspace\b/gi,
|
|
277
|
+
replacement: "{{REPO_TYPE}} workspace"
|
|
278
|
+
},
|
|
279
|
+
// Config purpose: Dogfooding vs Generated
|
|
280
|
+
CONFIG_PURPOSE: {
|
|
281
|
+
pattern: /\(Dogfooding\)|\(Generated by:.*?\)/g,
|
|
282
|
+
replacement: "({{CONFIG_TYPE}})"
|
|
283
|
+
},
|
|
284
|
+
// File path comments (normalize path styles)
|
|
285
|
+
// e.g., "config/vitest/env" vs "./config/vitest/env"
|
|
286
|
+
RELATIVE_PATH_PREFIX: {
|
|
287
|
+
pattern: /(?:path\.resolve\(__dirname,\s*)?['"]\.\/([^'"]+)['"]\)?|['"]([^'"]+)['"]/g,
|
|
288
|
+
replacement: "'{{PATH}}'"
|
|
289
|
+
},
|
|
290
|
+
// === Metadata ===
|
|
291
|
+
// Version numbers
|
|
292
|
+
VERSION: {
|
|
293
|
+
pattern: /Version:\s*[\d.]+/gi,
|
|
294
|
+
replacement: "Version: {{VERSION}}"
|
|
295
|
+
},
|
|
296
|
+
// Timestamps in docs
|
|
297
|
+
DATE: {
|
|
298
|
+
pattern: /\*\*(Created|Updated)\*\*:\s*\d{4}-\d{2}-\d{2}/g,
|
|
299
|
+
replacement: "**$1**: {{DATE}}"
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
var INTENTIONALLY_DIFFERENT_FILES = [
|
|
303
|
+
// === Config Files ===
|
|
304
|
+
"pnpm-workspace.yaml",
|
|
305
|
+
// runa-repo has "admin" workspace (internal)
|
|
306
|
+
"runa.config.ts",
|
|
307
|
+
// Dogfooding vs Generated comments
|
|
308
|
+
"vitest.config.ts",
|
|
309
|
+
// Internal paths vs package imports
|
|
310
|
+
"vitest.global-setup.ts",
|
|
311
|
+
// Vercel pull vs generic setup
|
|
312
|
+
"playwright.config.ts",
|
|
313
|
+
// Internal paths + ESM/CJS fallback in template
|
|
314
|
+
"config/vitest/vitest.config.layer3.ts",
|
|
315
|
+
// Internal SDK path vs package import
|
|
316
|
+
// === Workflow Files ===
|
|
317
|
+
// runa-repo uses hardcoded organization URLs, templates use secrets
|
|
318
|
+
".github/workflows/runa.yml",
|
|
319
|
+
// r06-corp/runa vs ${{ secrets.* }}
|
|
320
|
+
".github/workflows/deploy-db.yml",
|
|
321
|
+
// github-token parameter differences
|
|
322
|
+
// === GitHub Actions ===
|
|
323
|
+
".github/actions/setup-playwright-deps/action.yml",
|
|
324
|
+
// Comment: "runa-repo and pj-repos" vs "pj-repos"
|
|
325
|
+
".github/actions/setup-node-pnpm/action.yml",
|
|
326
|
+
// Comment: SSOT note vs DRY principle
|
|
327
|
+
".github/actions/setup-runa-cli/action.yml",
|
|
328
|
+
// Comment: Zero-PAT description differences
|
|
329
|
+
// === Database Auto-Generated vs Stub Files ===
|
|
330
|
+
// runa-repo has actual drizzle-kit generated code, templates have stub files
|
|
331
|
+
// Stub files are placeholders that get replaced by `runa db sync`
|
|
332
|
+
"packages/database/src/schema/schema.ts",
|
|
333
|
+
// Generated vs stub
|
|
334
|
+
"packages/database/src/schema/relations.ts",
|
|
335
|
+
// Generated vs stub
|
|
336
|
+
"packages/database/src/types/entities.ts",
|
|
337
|
+
// Generated vs stub
|
|
338
|
+
"packages/database/scripts/db-sync.ts",
|
|
339
|
+
// Template has formatGeneratedCode(), runa-repo doesn't
|
|
340
|
+
// === Database Scripts ===
|
|
341
|
+
// runa-repo has domain-specific tables (accounts.clients, repos.repositories, etc.)
|
|
342
|
+
// while templates use generic examples
|
|
343
|
+
"packages/database/drizzle.config.ts",
|
|
344
|
+
// Different schema paths
|
|
345
|
+
"packages/database/src/index.ts",
|
|
346
|
+
// Different schema exports
|
|
347
|
+
"packages/database/src/schema/index.ts",
|
|
348
|
+
// Different table exports
|
|
349
|
+
"packages/database/scripts/generate-seeds.ts",
|
|
350
|
+
// runa-specific seed logic
|
|
351
|
+
"packages/database/scripts/validate-schema-consistency.ts",
|
|
352
|
+
// runa-specific validation
|
|
353
|
+
"packages/database/scripts/seed-requirements.ts",
|
|
354
|
+
// runa-specific seed requirements
|
|
355
|
+
"packages/database/scripts/seed-semantic-rules.ts",
|
|
356
|
+
// runa-specific semantic rules
|
|
357
|
+
"packages/database/scripts/seed-writer.ts",
|
|
358
|
+
// runa-specific seed writer
|
|
359
|
+
"packages/database/scripts/seed-media/index.ts",
|
|
360
|
+
// runa-specific media seeds
|
|
361
|
+
"packages/database/scripts/seed-engines/auto-seed-generator.test.ts",
|
|
362
|
+
// runa-specific tests
|
|
363
|
+
"packages/database/scripts/seed-engines/constants.test.ts",
|
|
364
|
+
// runa-specific tests
|
|
365
|
+
"packages/database/scripts/seed-engines/db-schema-analyzer.ts",
|
|
366
|
+
// Re-export order differences
|
|
367
|
+
"packages/database/scripts/seed-engines/generators/locale.ts",
|
|
368
|
+
// Import style differences
|
|
369
|
+
"packages/database/scripts/setup-db-roles.ts",
|
|
370
|
+
// Role setup variations
|
|
371
|
+
"packages/database/src/zod/index.ts",
|
|
372
|
+
// Auto-generated, schema-specific exports
|
|
373
|
+
// === Skills/Prompts ===
|
|
374
|
+
// Minor wording differences in CLI vs SDK references
|
|
375
|
+
"docs/prompts/AUDIT-GEN.yml",
|
|
376
|
+
// "Official CLI + runa" vs "Official CLI priority"
|
|
377
|
+
"docs/prompts/SPEC-PATTERNS.yml",
|
|
378
|
+
// Spec pattern differences
|
|
379
|
+
".claude/skills/audit/templates/AUDIT-GEN.yml",
|
|
380
|
+
// Same as above
|
|
381
|
+
// === apps/api vs packages/api path differences ===
|
|
382
|
+
// runa-repo uses apps/api (internal), templates use packages/api (standard pj-repo pattern)
|
|
383
|
+
"docs/prompts/REFACTOR-GEN.yml",
|
|
384
|
+
// apps/api vs packages/api
|
|
385
|
+
"docs/prompts/REFACTOR-PATTERNS.yml",
|
|
386
|
+
// apps/api vs packages/api
|
|
387
|
+
"docs/prompts/SPEC-TEMPLATE-PRD.yml",
|
|
388
|
+
// apps/api vs packages/api
|
|
389
|
+
"docs/prompts/SPEC-TEMPLATE-MACHINE.yml",
|
|
390
|
+
// apps/api vs packages/api
|
|
391
|
+
".claude/skills/refactor/templates/REFACTOR-GEN.yml",
|
|
392
|
+
// apps/api vs packages/api
|
|
393
|
+
".claude/skills/refactor/templates/REFACTOR-PATTERNS.yml",
|
|
394
|
+
// apps/api vs packages/api
|
|
395
|
+
".claude/skills/spec/templates/RESEARCH-CHECKLIST.yml"
|
|
396
|
+
// apps/api vs packages/api
|
|
397
|
+
];
|
|
398
|
+
|
|
399
|
+
// src/commands/template-check/utils/normalizer.ts
|
|
400
|
+
function normalizeContent(content) {
|
|
401
|
+
let normalized = content;
|
|
402
|
+
for (const [_key, { pattern, replacement }] of Object.entries(PLACEHOLDER_PATTERNS)) {
|
|
403
|
+
normalized = normalized.replace(pattern, replacement);
|
|
404
|
+
}
|
|
405
|
+
normalized = normalized.replace(/[ \t]+$/gm, "");
|
|
406
|
+
normalized = normalized.replace(/\n{3,}/g, "\n\n");
|
|
407
|
+
if (!normalized.endsWith("\n")) {
|
|
408
|
+
normalized += "\n";
|
|
409
|
+
}
|
|
410
|
+
return normalized;
|
|
411
|
+
}
|
|
412
|
+
function isExpectedRunaOnly(runaPath) {
|
|
413
|
+
return RUNA_ONLY_FILES.includes(runaPath);
|
|
414
|
+
}
|
|
415
|
+
function isExpectedTemplateOnly(templatePath) {
|
|
416
|
+
return TEMPLATE_ONLY_FILES.includes(templatePath);
|
|
417
|
+
}
|
|
418
|
+
function isIntentionallyDifferent(filePath) {
|
|
419
|
+
return INTENTIONALLY_DIFFERENT_FILES.includes(filePath);
|
|
420
|
+
}
|
|
421
|
+
function isCodeFile(filePath) {
|
|
422
|
+
const ext = filePath.slice(filePath.lastIndexOf("."));
|
|
423
|
+
return CODE_EXTENSIONS.includes(ext);
|
|
424
|
+
}
|
|
425
|
+
function countLines(content) {
|
|
426
|
+
return content.split("\n").length;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// src/commands/template-check/utils/diff-analyzer.ts
|
|
430
|
+
function compareFiles(runaContent, templateContent) {
|
|
431
|
+
const normalizedRuna = normalizeContent(runaContent);
|
|
432
|
+
const normalizedTemplate = normalizeContent(templateContent);
|
|
433
|
+
if (normalizedRuna === normalizedTemplate) {
|
|
434
|
+
return {
|
|
435
|
+
identical: true,
|
|
436
|
+
ahead: "equal",
|
|
437
|
+
lineDiff: "\xB10",
|
|
438
|
+
addedLines: 0,
|
|
439
|
+
removedLines: 0
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
const runaLines = countLines(normalizedRuna);
|
|
443
|
+
const templateLines = countLines(normalizedTemplate);
|
|
444
|
+
const lineDiff = runaLines - templateLines;
|
|
445
|
+
const ahead = determineAhead(normalizedRuna, normalizedTemplate, runaLines, templateLines);
|
|
446
|
+
return {
|
|
447
|
+
identical: false,
|
|
448
|
+
ahead,
|
|
449
|
+
lineDiff: formatLineDiff(lineDiff),
|
|
450
|
+
addedLines: Math.max(0, lineDiff),
|
|
451
|
+
removedLines: Math.max(0, -lineDiff)
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
function determineAhead(runaContent, templateContent, runaLines, templateLines) {
|
|
455
|
+
const runaVersion = extractVersion(runaContent);
|
|
456
|
+
const templateVersion = extractVersion(templateContent);
|
|
457
|
+
if (runaVersion && templateVersion && runaVersion !== templateVersion) {
|
|
458
|
+
return runaVersion > templateVersion ? "runa" : "template";
|
|
459
|
+
}
|
|
460
|
+
const lineDiff = Math.abs(runaLines - templateLines);
|
|
461
|
+
if (lineDiff > 10) {
|
|
462
|
+
return runaLines > templateLines ? "runa" : "template";
|
|
463
|
+
}
|
|
464
|
+
const runaDate = extractUpdateDate(runaContent);
|
|
465
|
+
const templateDate = extractUpdateDate(templateContent);
|
|
466
|
+
if (runaDate && templateDate && runaDate !== templateDate) {
|
|
467
|
+
return runaDate > templateDate ? "runa" : "template";
|
|
468
|
+
}
|
|
469
|
+
return "diverged";
|
|
470
|
+
}
|
|
471
|
+
function buildDiffHunkMeta(change, contextSize, runaLineCount) {
|
|
472
|
+
const contextStart = Math.max(0, change.currentStart - contextSize);
|
|
473
|
+
const hasContextBefore = contextStart < change.currentStart;
|
|
474
|
+
const runaStart = hasContextBefore ? contextStart : change.currentStart;
|
|
475
|
+
const runaCount = change.currentEnd - runaStart + contextSize;
|
|
476
|
+
const templateCount = change.templateEnd - change.templateStart + (hasContextBefore ? contextSize : 0);
|
|
477
|
+
return {
|
|
478
|
+
header: `@@ -${runaStart + 1},${runaCount} +${change.templateStart + 1},${templateCount} @@`,
|
|
479
|
+
contextStart,
|
|
480
|
+
contextEnd: Math.min(runaLineCount, change.currentEnd + contextSize)
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
function appendPrefixedLines(diffLines, sourceLines, start, end, prefix, totalLines, maxLines) {
|
|
484
|
+
for (let index = start; index < end && totalLines < maxLines; index++) {
|
|
485
|
+
diffLines.push(`${prefix}${sourceLines[index] ?? ""}`);
|
|
486
|
+
totalLines++;
|
|
487
|
+
}
|
|
488
|
+
return totalLines;
|
|
489
|
+
}
|
|
490
|
+
function generateUnifiedDiff(runaContent, templateContent, options = {}) {
|
|
491
|
+
const maxLines = options.maxLines ?? 50;
|
|
492
|
+
const runaLabel = options.runaLabel ?? "runa";
|
|
493
|
+
const templateLabel = options.templateLabel ?? "template";
|
|
494
|
+
const runaLines = runaContent.split("\n");
|
|
495
|
+
const templateLines = templateContent.split("\n");
|
|
496
|
+
const contextSize = 2;
|
|
497
|
+
const changes = findDiffChanges(runaLines, templateLines);
|
|
498
|
+
if (changes.length === 0) return "";
|
|
499
|
+
const diffLines = [`--- ${runaLabel}`, `+++ ${templateLabel}`];
|
|
500
|
+
let totalLines = 0;
|
|
501
|
+
for (let idx = 0; idx < changes.length; idx++) {
|
|
502
|
+
if (totalLines >= maxLines) {
|
|
503
|
+
diffLines.push(`... (${changes.length - idx} more change(s) truncated)`);
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
const change = changes[idx];
|
|
507
|
+
const hunkMeta = buildDiffHunkMeta(change, contextSize, runaLines.length);
|
|
508
|
+
diffLines.push(hunkMeta.header);
|
|
509
|
+
totalLines = appendPrefixedLines(
|
|
510
|
+
diffLines,
|
|
511
|
+
runaLines,
|
|
512
|
+
hunkMeta.contextStart,
|
|
513
|
+
change.currentStart,
|
|
514
|
+
" ",
|
|
515
|
+
totalLines,
|
|
516
|
+
maxLines
|
|
517
|
+
);
|
|
518
|
+
totalLines = appendPrefixedLines(
|
|
519
|
+
diffLines,
|
|
520
|
+
runaLines,
|
|
521
|
+
change.currentStart,
|
|
522
|
+
change.currentEnd,
|
|
523
|
+
"-",
|
|
524
|
+
totalLines,
|
|
525
|
+
maxLines
|
|
526
|
+
);
|
|
527
|
+
totalLines = appendPrefixedLines(
|
|
528
|
+
diffLines,
|
|
529
|
+
templateLines,
|
|
530
|
+
change.templateStart,
|
|
531
|
+
change.templateEnd,
|
|
532
|
+
"+",
|
|
533
|
+
totalLines,
|
|
534
|
+
maxLines
|
|
535
|
+
);
|
|
536
|
+
totalLines = appendPrefixedLines(
|
|
537
|
+
diffLines,
|
|
538
|
+
runaLines,
|
|
539
|
+
change.currentEnd,
|
|
540
|
+
hunkMeta.contextEnd,
|
|
541
|
+
" ",
|
|
542
|
+
totalLines,
|
|
543
|
+
maxLines
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
return diffLines.join("\n");
|
|
547
|
+
}
|
|
548
|
+
function findDiffChanges(currentLines, templateLines) {
|
|
549
|
+
const changes = [];
|
|
550
|
+
let i = 0;
|
|
551
|
+
let j = 0;
|
|
552
|
+
while (i < currentLines.length || j < templateLines.length) {
|
|
553
|
+
if (i < currentLines.length && j < templateLines.length && currentLines[i] === templateLines[j]) {
|
|
554
|
+
i++;
|
|
555
|
+
j++;
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
const changeStart = { current: i, template: j };
|
|
559
|
+
while (i < currentLines.length && j < templateLines.length && currentLines[i] !== templateLines[j]) {
|
|
560
|
+
const sync = tryResync(currentLines, templateLines, i, j);
|
|
561
|
+
i += sync.iOffset;
|
|
562
|
+
j += sync.jOffset;
|
|
563
|
+
}
|
|
564
|
+
if (i >= currentLines.length && j < templateLines.length) {
|
|
565
|
+
j = templateLines.length;
|
|
566
|
+
} else if (j >= templateLines.length && i < currentLines.length) {
|
|
567
|
+
i = currentLines.length;
|
|
568
|
+
}
|
|
569
|
+
changes.push({
|
|
570
|
+
currentStart: changeStart.current,
|
|
571
|
+
currentEnd: i,
|
|
572
|
+
templateStart: changeStart.template,
|
|
573
|
+
templateEnd: j
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
return changes;
|
|
577
|
+
}
|
|
578
|
+
function tryResync(currentLines, templateLines, i, j) {
|
|
579
|
+
const maxLookahead = 5;
|
|
580
|
+
for (let lookahead = 1; lookahead <= maxLookahead && i + lookahead < currentLines.length; lookahead++) {
|
|
581
|
+
if (currentLines[i + lookahead] === templateLines[j]) {
|
|
582
|
+
return { found: true, iOffset: lookahead, jOffset: 0 };
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
for (let lookahead = 1; lookahead <= maxLookahead && j + lookahead < templateLines.length; lookahead++) {
|
|
586
|
+
if (currentLines[i] === templateLines[j + lookahead]) {
|
|
587
|
+
return { found: true, iOffset: 0, jOffset: lookahead };
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return { found: false, iOffset: 1, jOffset: 1 };
|
|
591
|
+
}
|
|
592
|
+
function extractVersion(content) {
|
|
593
|
+
const match = content.match(/(?:Version|version|v)[\s:]*(\d+(?:\.\d+)*)/i);
|
|
594
|
+
return match ? match[1] : null;
|
|
595
|
+
}
|
|
596
|
+
function extractUpdateDate(content) {
|
|
597
|
+
const match = content.match(/\*\*Updated\*\*:\s*(\d{4}-\d{2}-\d{2})/);
|
|
598
|
+
return match ? match[1] : null;
|
|
599
|
+
}
|
|
600
|
+
function formatLineDiff(diff) {
|
|
601
|
+
if (diff > 0) {
|
|
602
|
+
return `+${diff}`;
|
|
603
|
+
}
|
|
604
|
+
if (diff < 0) {
|
|
605
|
+
return String(diff);
|
|
606
|
+
}
|
|
607
|
+
return "\xB10";
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// src/commands/template-check/actors/compare.ts
|
|
611
|
+
function compareBothFiles(runaRelPath, templateRelPath, runaAbsPath, templateAbsPath, category, includeDiff) {
|
|
612
|
+
const runaContent = fs2.readFileSync(runaAbsPath, "utf-8");
|
|
613
|
+
const templateContent = fs2.readFileSync(templateAbsPath, "utf-8");
|
|
614
|
+
const comparison = compareFiles(runaContent, templateContent);
|
|
615
|
+
let status;
|
|
616
|
+
if (comparison.identical) {
|
|
617
|
+
status = runaRelPath !== templateRelPath ? "renamed" : "identical";
|
|
618
|
+
} else if (isIntentionallyDifferent(runaRelPath)) {
|
|
619
|
+
status = "intentionally-different";
|
|
620
|
+
} else {
|
|
621
|
+
status = "diff";
|
|
622
|
+
}
|
|
623
|
+
const result = {
|
|
624
|
+
runaPath: runaRelPath,
|
|
625
|
+
templatePath: templateRelPath,
|
|
626
|
+
category,
|
|
627
|
+
status,
|
|
628
|
+
ahead: comparison.identical ? void 0 : comparison.ahead,
|
|
629
|
+
lineDiff: comparison.identical ? void 0 : comparison.lineDiff
|
|
630
|
+
};
|
|
631
|
+
if (includeDiff && !comparison.identical) {
|
|
632
|
+
result.diffOutput = generateUnifiedDiff(runaContent, templateContent, {
|
|
633
|
+
maxLines: 30,
|
|
634
|
+
runaLabel: runaRelPath,
|
|
635
|
+
templateLabel: templateRelPath
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
return result;
|
|
639
|
+
}
|
|
640
|
+
function createRunaOnlyResult(runaRelPath, category) {
|
|
641
|
+
return {
|
|
642
|
+
runaPath: runaRelPath,
|
|
643
|
+
templatePath: null,
|
|
644
|
+
category,
|
|
645
|
+
status: isExpectedRunaOnly(runaRelPath) ? "expected-runa-only" : "runa-only"
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
function createTemplateOnlyResult(templateRelPath, category) {
|
|
649
|
+
return {
|
|
650
|
+
runaPath: null,
|
|
651
|
+
templatePath: templateRelPath,
|
|
652
|
+
category,
|
|
653
|
+
status: isExpectedTemplateOnly(templateRelPath) ? "expected-template-only" : "template-only"
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
function sortResults(results) {
|
|
657
|
+
results.sort((a, b) => {
|
|
658
|
+
if (a.category !== b.category) {
|
|
659
|
+
return a.category.localeCompare(b.category);
|
|
660
|
+
}
|
|
661
|
+
const pathA = a.runaPath ?? a.templatePath ?? "";
|
|
662
|
+
const pathB = b.runaPath ?? b.templatePath ?? "";
|
|
663
|
+
return pathA.localeCompare(pathB);
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
function filterResults(results, category) {
|
|
667
|
+
let filtered = results.filter((r) => {
|
|
668
|
+
const filePath = r.runaPath ?? r.templatePath ?? "";
|
|
669
|
+
return isCodeFile(filePath);
|
|
670
|
+
});
|
|
671
|
+
if (category) {
|
|
672
|
+
filtered = filtered.filter((r) => r.category === category);
|
|
673
|
+
}
|
|
674
|
+
return filtered;
|
|
675
|
+
}
|
|
676
|
+
var compareActor = fromPromise(async ({ input }) => {
|
|
677
|
+
const { inventory, repoRoot, templateDir, options } = input;
|
|
678
|
+
const results = [];
|
|
679
|
+
const processedKeys = /* @__PURE__ */ new Set();
|
|
680
|
+
for (const [key, runaRelPath] of inventory.runaByKey) {
|
|
681
|
+
processedKeys.add(key);
|
|
682
|
+
const runaFile = inventory.runaFiles.get(runaRelPath);
|
|
683
|
+
if (!runaFile) continue;
|
|
684
|
+
const templateRelPath = inventory.templateByKey.get(key);
|
|
685
|
+
if (templateRelPath) {
|
|
686
|
+
const templateFile = inventory.templateFiles.get(templateRelPath);
|
|
687
|
+
if (!templateFile) continue;
|
|
688
|
+
const result = compareBothFiles(
|
|
689
|
+
runaRelPath,
|
|
690
|
+
templateRelPath,
|
|
691
|
+
path2.join(repoRoot, runaRelPath),
|
|
692
|
+
path2.join(templateDir, templateRelPath),
|
|
693
|
+
runaFile.category,
|
|
694
|
+
options.diff ?? false
|
|
695
|
+
);
|
|
696
|
+
results.push(result);
|
|
697
|
+
} else {
|
|
698
|
+
results.push(createRunaOnlyResult(runaRelPath, runaFile.category));
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
for (const [key, templateRelPath] of inventory.templateByKey) {
|
|
702
|
+
if (processedKeys.has(key)) continue;
|
|
703
|
+
const templateFile = inventory.templateFiles.get(templateRelPath);
|
|
704
|
+
if (!templateFile) continue;
|
|
705
|
+
results.push(createTemplateOnlyResult(templateRelPath, templateFile.category));
|
|
706
|
+
}
|
|
707
|
+
sortResults(results);
|
|
708
|
+
return { results: filterResults(results, options.category) };
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
// src/commands/template-check/actors/discover.ts
|
|
712
|
+
init_esm_shims();
|
|
713
|
+
|
|
714
|
+
// src/commands/template-check/utils/path-mapping.ts
|
|
715
|
+
init_esm_shims();
|
|
716
|
+
var PATH_MAPPING_RULES = [
|
|
717
|
+
// ============================================================
|
|
718
|
+
// ROOT CONFIG FILES (HIGH PRIORITY)
|
|
719
|
+
// ============================================================
|
|
720
|
+
{
|
|
721
|
+
runa: "package.json",
|
|
722
|
+
template: "package.json",
|
|
723
|
+
category: "config"
|
|
724
|
+
},
|
|
725
|
+
{
|
|
726
|
+
runa: "turbo.json",
|
|
727
|
+
template: "turbo.json",
|
|
728
|
+
category: "config"
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
runa: "runa.config.ts",
|
|
732
|
+
template: "runa.config.ts",
|
|
733
|
+
category: "config"
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
runa: "tsconfig.json",
|
|
737
|
+
template: "tsconfig.json",
|
|
738
|
+
category: "config"
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
runa: "vitest.config.ts",
|
|
742
|
+
template: "vitest.config.ts",
|
|
743
|
+
category: "config"
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
runa: "vitest.global-setup.ts",
|
|
747
|
+
template: "vitest.global-setup.ts",
|
|
748
|
+
category: "config"
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
runa: "global-setup.ts",
|
|
752
|
+
template: "global-setup.ts",
|
|
753
|
+
category: "config"
|
|
754
|
+
},
|
|
755
|
+
{
|
|
756
|
+
runa: "playwright.config.ts",
|
|
757
|
+
template: "playwright.config.ts",
|
|
758
|
+
category: "config"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
runa: "pnpm-workspace.yaml",
|
|
762
|
+
template: "pnpm-workspace.yaml",
|
|
763
|
+
category: "config"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
runa: ".gitignore",
|
|
767
|
+
template: ".gitignore",
|
|
768
|
+
category: "config"
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
runa: ".squawk.toml",
|
|
772
|
+
template: ".squawk.toml",
|
|
773
|
+
category: "config"
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
runa: ".npmrc",
|
|
777
|
+
template: ".npmrc",
|
|
778
|
+
category: "config"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
runa: ".env.example",
|
|
782
|
+
template: ".env.example",
|
|
783
|
+
category: "config"
|
|
784
|
+
},
|
|
785
|
+
// config/vitest/
|
|
786
|
+
{
|
|
787
|
+
runa: "config/vitest/*.ts",
|
|
788
|
+
template: "config/vitest/*.ts",
|
|
789
|
+
category: "config"
|
|
790
|
+
},
|
|
791
|
+
// scripts/
|
|
792
|
+
{
|
|
793
|
+
runa: "scripts/*.ts",
|
|
794
|
+
template: "scripts/*.ts",
|
|
795
|
+
category: "config"
|
|
796
|
+
},
|
|
797
|
+
// .runa/
|
|
798
|
+
{
|
|
799
|
+
runa: ".runa/*.json",
|
|
800
|
+
template: ".runa/*.json",
|
|
801
|
+
category: "config"
|
|
802
|
+
},
|
|
803
|
+
// ============================================================
|
|
804
|
+
// APPS/WEB (HIGH PRIORITY - FRONTEND CODE)
|
|
805
|
+
// ============================================================
|
|
806
|
+
{
|
|
807
|
+
runa: "apps/web/package.json",
|
|
808
|
+
template: "apps/web/package.json",
|
|
809
|
+
category: "config"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
runa: "apps/web/tsconfig.json",
|
|
813
|
+
template: "apps/web/tsconfig.json",
|
|
814
|
+
category: "config"
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
runa: "apps/web/next.config.ts",
|
|
818
|
+
template: "apps/web/next.config.ts",
|
|
819
|
+
category: "config"
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
runa: "apps/web/app/**/*.tsx",
|
|
823
|
+
template: "apps/web/app/**/*.tsx",
|
|
824
|
+
category: "other"
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
runa: "apps/web/app/**/*.ts",
|
|
828
|
+
template: "apps/web/app/**/*.ts",
|
|
829
|
+
category: "other"
|
|
830
|
+
},
|
|
831
|
+
// ============================================================
|
|
832
|
+
// PACKAGES/DATABASE (HIGH PRIORITY - CODE)
|
|
833
|
+
// ============================================================
|
|
834
|
+
{
|
|
835
|
+
runa: "packages/database/package.json",
|
|
836
|
+
template: "packages/database/package.json",
|
|
837
|
+
category: "database"
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
runa: "packages/database/tsconfig.json",
|
|
841
|
+
template: "packages/database/tsconfig.json",
|
|
842
|
+
category: "database"
|
|
843
|
+
},
|
|
844
|
+
{
|
|
845
|
+
runa: "packages/database/biome.json",
|
|
846
|
+
template: "packages/database/biome.json",
|
|
847
|
+
category: "database"
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
runa: "packages/database/drizzle.config.ts",
|
|
851
|
+
template: "packages/database/drizzle.config.ts",
|
|
852
|
+
category: "database"
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
runa: "packages/database/src/*.ts",
|
|
856
|
+
template: "packages/database/src/*.ts",
|
|
857
|
+
category: "database"
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
runa: "packages/database/src/**/*.ts",
|
|
861
|
+
template: "packages/database/src/**/*.ts",
|
|
862
|
+
category: "database"
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
runa: "packages/database/scripts/**/*.ts",
|
|
866
|
+
template: "packages/database/scripts/**/*.ts",
|
|
867
|
+
category: "database"
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
runa: "packages/database/extensions/*.sql",
|
|
871
|
+
template: "packages/database/extensions/*.sql",
|
|
872
|
+
category: "database"
|
|
873
|
+
},
|
|
874
|
+
{
|
|
875
|
+
runa: "packages/database/tests/*.sql",
|
|
876
|
+
template: "packages/database/tests/*.sql",
|
|
877
|
+
category: "database"
|
|
878
|
+
},
|
|
879
|
+
// ============================================================
|
|
880
|
+
// SUPABASE (HIGH PRIORITY - SQL)
|
|
881
|
+
// ============================================================
|
|
882
|
+
{
|
|
883
|
+
runa: "supabase/config.toml",
|
|
884
|
+
template: "supabase/config.toml",
|
|
885
|
+
category: "database"
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
runa: "supabase/schemas/**/*.sql",
|
|
889
|
+
template: "supabase/schemas/**/*.sql",
|
|
890
|
+
category: "database"
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
runa: "supabase/seeds/*.sql",
|
|
894
|
+
template: "supabase/seeds/*.sql",
|
|
895
|
+
category: "database"
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
runa: "supabase/seeds/**/*.sql",
|
|
899
|
+
template: "supabase/seeds/**/*.sql",
|
|
900
|
+
category: "database"
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
runa: "supabase/migrations/*.sql",
|
|
904
|
+
template: "supabase/migrations/*.sql",
|
|
905
|
+
category: "database"
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
runa: "supabase/tests/*.sql",
|
|
909
|
+
template: "supabase/tests/*.sql",
|
|
910
|
+
category: "database"
|
|
911
|
+
},
|
|
912
|
+
// ============================================================
|
|
913
|
+
// GITHUB ACTIONS & WORKFLOWS (HIGH PRIORITY)
|
|
914
|
+
// ============================================================
|
|
915
|
+
{
|
|
916
|
+
runa: ".github/workflows/*.yml",
|
|
917
|
+
template: ".github/workflows/*.yml",
|
|
918
|
+
category: "workflows"
|
|
919
|
+
},
|
|
920
|
+
{
|
|
921
|
+
runa: ".github/actions/**/action.yml",
|
|
922
|
+
template: ".github/actions/**/action.yml",
|
|
923
|
+
category: "workflows"
|
|
924
|
+
},
|
|
925
|
+
// ============================================================
|
|
926
|
+
// HUSKY (GIT HOOKS)
|
|
927
|
+
// ============================================================
|
|
928
|
+
{
|
|
929
|
+
runa: ".husky/pre-commit",
|
|
930
|
+
template: ".husky/pre-commit",
|
|
931
|
+
category: "config"
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
runa: ".husky/pre-push",
|
|
935
|
+
template: ".husky/pre-push",
|
|
936
|
+
category: "config"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
runa: ".husky/_common.sh",
|
|
940
|
+
template: ".husky/_common.sh",
|
|
941
|
+
category: "config"
|
|
942
|
+
},
|
|
943
|
+
// ============================================================
|
|
944
|
+
// PACKAGES/API-CLIENT (CODE)
|
|
945
|
+
// ============================================================
|
|
946
|
+
{
|
|
947
|
+
runa: "packages/api-client/package.json",
|
|
948
|
+
template: "packages/api-client/package.json",
|
|
949
|
+
category: "other"
|
|
950
|
+
},
|
|
951
|
+
{
|
|
952
|
+
runa: "packages/api-client/tsconfig.json",
|
|
953
|
+
template: "packages/api-client/tsconfig.json",
|
|
954
|
+
category: "other"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
runa: "packages/api-client/**/*.ts",
|
|
958
|
+
template: "packages/api-client/**/*.ts",
|
|
959
|
+
category: "other"
|
|
960
|
+
},
|
|
961
|
+
{
|
|
962
|
+
runa: "packages/api-client/**/*.tsx",
|
|
963
|
+
template: "packages/api-client/**/*.tsx",
|
|
964
|
+
category: "other"
|
|
965
|
+
},
|
|
966
|
+
// ============================================================
|
|
967
|
+
// .CLAUDE DIRECTORY (LOWER PRIORITY)
|
|
968
|
+
// Note: Templates use _claude/ to avoid Claude Code detection in runa-repo.
|
|
969
|
+
// At runa init/upgrade time, _claude/ is renamed to .claude/.
|
|
970
|
+
// ============================================================
|
|
971
|
+
{
|
|
972
|
+
runa: ".claude/settings.json",
|
|
973
|
+
template: "_claude/settings.json",
|
|
974
|
+
category: "config"
|
|
975
|
+
},
|
|
976
|
+
{
|
|
977
|
+
runa: ".claude/rules/*.md",
|
|
978
|
+
template: "_claude/rules/sdk/*.md",
|
|
979
|
+
category: "rules",
|
|
980
|
+
rename: {
|
|
981
|
+
"code-quality.md": "quality.md",
|
|
982
|
+
"core-philosophy.md": "core.md",
|
|
983
|
+
"pj-repo-compatibility.md": "pj-repo-compat.md"
|
|
984
|
+
}
|
|
985
|
+
},
|
|
986
|
+
{
|
|
987
|
+
runa: ".claude/agents/*.md",
|
|
988
|
+
template: "_claude/agents/sdk/*.md",
|
|
989
|
+
category: "agents"
|
|
990
|
+
},
|
|
991
|
+
// Skills with SKILL.md (explicit paths instead of ** wildcard for reliable matching)
|
|
992
|
+
{
|
|
993
|
+
runa: ".claude/skills/audit/SKILL.md",
|
|
994
|
+
template: "_claude/skills/sdk/audit/SKILL.md",
|
|
995
|
+
category: "skills"
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
runa: ".claude/skills/refactor/SKILL.md",
|
|
999
|
+
template: "_claude/skills/sdk/refactor/SKILL.md",
|
|
1000
|
+
category: "skills"
|
|
1001
|
+
},
|
|
1002
|
+
{
|
|
1003
|
+
runa: ".claude/skills/spec/SKILL.md",
|
|
1004
|
+
template: "_claude/skills/sdk/spec/SKILL.md",
|
|
1005
|
+
category: "skills"
|
|
1006
|
+
},
|
|
1007
|
+
// Skills with templates/*.yml
|
|
1008
|
+
{
|
|
1009
|
+
runa: ".claude/skills/audit/templates/*.yml",
|
|
1010
|
+
template: "_claude/skills/sdk/audit/templates/*.yml",
|
|
1011
|
+
category: "skills"
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
runa: ".claude/skills/refactor/templates/*.yml",
|
|
1015
|
+
template: "_claude/skills/sdk/refactor/templates/*.yml",
|
|
1016
|
+
category: "skills"
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
runa: ".claude/skills/spec/templates/*.yml",
|
|
1020
|
+
template: "_claude/skills/sdk/spec/templates/*.yml",
|
|
1021
|
+
category: "skills"
|
|
1022
|
+
},
|
|
1023
|
+
{
|
|
1024
|
+
runa: ".claude/commands/*.md",
|
|
1025
|
+
template: "_claude/commands/sdk/*.md",
|
|
1026
|
+
category: "commands"
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
runa: ".claude/maps/*.md",
|
|
1030
|
+
template: "_claude/maps/*.md",
|
|
1031
|
+
category: "other"
|
|
1032
|
+
},
|
|
1033
|
+
// ============================================================
|
|
1034
|
+
// .CODEX DIRECTORY (mirrors .claude policies for Codex)
|
|
1035
|
+
// ============================================================
|
|
1036
|
+
{
|
|
1037
|
+
runa: ".codex/README.md",
|
|
1038
|
+
template: "_codex/README.md",
|
|
1039
|
+
category: "config"
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
runa: ".codex/AGENTS.md",
|
|
1043
|
+
template: "_codex/AGENTS.md",
|
|
1044
|
+
category: "config"
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
runa: ".codex/CODEX.md",
|
|
1048
|
+
template: "_codex/CODEX.md",
|
|
1049
|
+
category: "config"
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
runa: ".codex/config.toml",
|
|
1053
|
+
template: "_codex/config.toml",
|
|
1054
|
+
category: "config"
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
runa: ".codex/rules/devops.md",
|
|
1058
|
+
template: "_codex/rules/devops.md",
|
|
1059
|
+
category: "rules"
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
runa: ".codex/rules/permissions.toml",
|
|
1063
|
+
template: "_codex/rules/permissions.toml",
|
|
1064
|
+
category: "rules"
|
|
1065
|
+
},
|
|
1066
|
+
// ============================================================
|
|
1067
|
+
// ROOT DOCUMENTATION (LOWEST PRIORITY)
|
|
1068
|
+
// ============================================================
|
|
1069
|
+
{
|
|
1070
|
+
runa: "AGENTS.md",
|
|
1071
|
+
template: "AGENTS.md",
|
|
1072
|
+
category: "root-docs"
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
runa: "CLAUDE.md",
|
|
1076
|
+
template: "CLAUDE.md",
|
|
1077
|
+
category: "root-docs"
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
runa: "docs/prompts/*.md",
|
|
1081
|
+
template: "docs/prompts/*.md",
|
|
1082
|
+
category: "prompts"
|
|
1083
|
+
},
|
|
1084
|
+
{
|
|
1085
|
+
runa: "docs/prompts/*.yml",
|
|
1086
|
+
template: "docs/prompts/*.yml",
|
|
1087
|
+
category: "prompts"
|
|
1088
|
+
}
|
|
1089
|
+
];
|
|
1090
|
+
function getCategoryForPath(path3) {
|
|
1091
|
+
for (const rule of PATH_MAPPING_RULES) {
|
|
1092
|
+
if (matchGlobPattern(path3, rule.runa) || matchGlobPattern(path3, rule.template)) {
|
|
1093
|
+
return rule.category;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return "other";
|
|
1097
|
+
}
|
|
1098
|
+
function normalizeTemplatePath(templatePath) {
|
|
1099
|
+
return templatePath.replace(/^_claude\//, ".claude/").replace(".claude/rules/sdk/", ".claude/rules/").replace(".claude/agents/sdk/", ".claude/agents/").replace(".claude/skills/sdk/", ".claude/skills/").replace(".claude/commands/sdk/", ".claude/commands/");
|
|
1100
|
+
}
|
|
1101
|
+
function applyReverseRename(normalized, rule, isTemplate) {
|
|
1102
|
+
if (!rule.rename) return normalized;
|
|
1103
|
+
const ruleBasePath = rule.runa.replace("/*.md", "/").replace("/**/*.md", "/");
|
|
1104
|
+
if (!normalized.startsWith(ruleBasePath)) return normalized;
|
|
1105
|
+
for (const [runaName, templateName] of Object.entries(rule.rename)) {
|
|
1106
|
+
if (isTemplate && normalized.endsWith(templateName)) {
|
|
1107
|
+
return normalized.replace(templateName, runaName);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return normalized;
|
|
1111
|
+
}
|
|
1112
|
+
function generateComparisonKey(path3, isTemplate) {
|
|
1113
|
+
let normalized = isTemplate ? normalizeTemplatePath(path3) : path3;
|
|
1114
|
+
for (const rule of PATH_MAPPING_RULES) {
|
|
1115
|
+
normalized = applyReverseRename(normalized, rule, isTemplate);
|
|
1116
|
+
}
|
|
1117
|
+
return normalized;
|
|
1118
|
+
}
|
|
1119
|
+
function matchGlobPattern(path3, pattern) {
|
|
1120
|
+
const regexPattern = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "<<DOUBLE_STAR>>").replace(/\*/g, "([^/]*)").replace(/<<DOUBLE_STAR>>/g, "(.*)");
|
|
1121
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
1122
|
+
const match = path3.match(regex);
|
|
1123
|
+
if (match) {
|
|
1124
|
+
const subPath = match[1] ?? "";
|
|
1125
|
+
return { matched: true, subPath };
|
|
1126
|
+
}
|
|
1127
|
+
return null;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
// src/commands/template-check/actors/discover.ts
|
|
1131
|
+
var discoverActor = fromPromise(async ({ input }) => {
|
|
1132
|
+
const { repoRoot, templateDir } = input;
|
|
1133
|
+
const inventory = {
|
|
1134
|
+
runaFiles: /* @__PURE__ */ new Map(),
|
|
1135
|
+
templateFiles: /* @__PURE__ */ new Map(),
|
|
1136
|
+
runaByKey: /* @__PURE__ */ new Map(),
|
|
1137
|
+
templateByKey: /* @__PURE__ */ new Map()
|
|
1138
|
+
};
|
|
1139
|
+
for (const rule of PATH_MAPPING_RULES) {
|
|
1140
|
+
const runaPattern = rule.runa;
|
|
1141
|
+
const runaFiles = await globFiles(repoRoot, runaPattern);
|
|
1142
|
+
for (const file of runaFiles) {
|
|
1143
|
+
const relativePath = path2.relative(repoRoot, file.absolutePath);
|
|
1144
|
+
const key = generateComparisonKey(relativePath, false);
|
|
1145
|
+
inventory.runaFiles.set(relativePath, {
|
|
1146
|
+
...file,
|
|
1147
|
+
relativePath,
|
|
1148
|
+
category: rule.category
|
|
1149
|
+
});
|
|
1150
|
+
inventory.runaByKey.set(key, relativePath);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
for (const rule of PATH_MAPPING_RULES) {
|
|
1154
|
+
const templatePattern = rule.template;
|
|
1155
|
+
const templateFiles = await globFiles(templateDir, templatePattern);
|
|
1156
|
+
for (const file of templateFiles) {
|
|
1157
|
+
const relativePath = path2.relative(templateDir, file.absolutePath);
|
|
1158
|
+
const key = generateComparisonKey(relativePath, true);
|
|
1159
|
+
inventory.templateFiles.set(relativePath, {
|
|
1160
|
+
...file,
|
|
1161
|
+
relativePath,
|
|
1162
|
+
category: rule.category
|
|
1163
|
+
});
|
|
1164
|
+
inventory.templateByKey.set(key, relativePath);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1167
|
+
return {
|
|
1168
|
+
inventory,
|
|
1169
|
+
runaCount: inventory.runaFiles.size,
|
|
1170
|
+
templateCount: inventory.templateFiles.size
|
|
1171
|
+
};
|
|
1172
|
+
});
|
|
1173
|
+
async function globFiles(baseDir, pattern) {
|
|
1174
|
+
const results = [];
|
|
1175
|
+
const parts = pattern.split("/");
|
|
1176
|
+
await walkAndMatch({
|
|
1177
|
+
currentDir: baseDir,
|
|
1178
|
+
patternParts: parts,
|
|
1179
|
+
partIndex: 0,
|
|
1180
|
+
results,
|
|
1181
|
+
fullPattern: pattern
|
|
1182
|
+
});
|
|
1183
|
+
return results;
|
|
1184
|
+
}
|
|
1185
|
+
function addFileResult(entryPath, fullPattern, results) {
|
|
1186
|
+
const stats = fs2.statSync(entryPath);
|
|
1187
|
+
results.push({
|
|
1188
|
+
absolutePath: entryPath,
|
|
1189
|
+
size: stats.size,
|
|
1190
|
+
category: getCategoryForPath(fullPattern)
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
async function processEntry(ctx, entryPath, isFile, isDirectory, isLastPart) {
|
|
1194
|
+
if (isLastPart && isFile) {
|
|
1195
|
+
addFileResult(entryPath, ctx.fullPattern, ctx.results);
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
if (!isLastPart && isDirectory) {
|
|
1199
|
+
await walkAndMatch({ ...ctx, currentDir: entryPath, partIndex: ctx.partIndex + 1 });
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
async function matchDoubleWildcard(ctx, entries) {
|
|
1203
|
+
await walkAndMatch({ ...ctx, partIndex: ctx.partIndex + 1 });
|
|
1204
|
+
for (const entry of entries) {
|
|
1205
|
+
if (entry.isDirectory()) {
|
|
1206
|
+
const subDir = path2.join(ctx.currentDir, entry.name);
|
|
1207
|
+
await walkAndMatch({ ...ctx, currentDir: subDir });
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
async function matchSingleWildcard(ctx, entries, pattern, isLastPart) {
|
|
1212
|
+
const regex = patternToRegex(pattern);
|
|
1213
|
+
for (const entry of entries) {
|
|
1214
|
+
if (regex.test(entry.name)) {
|
|
1215
|
+
const entryPath = path2.join(ctx.currentDir, entry.name);
|
|
1216
|
+
await processEntry(ctx, entryPath, entry.isFile(), entry.isDirectory(), isLastPart);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
async function matchBraceExpansion(ctx, entries, pattern, isLastPart) {
|
|
1221
|
+
const options = extractBraceOptions(pattern);
|
|
1222
|
+
for (const option of options) {
|
|
1223
|
+
for (const entry of entries) {
|
|
1224
|
+
if (entry.name === option) {
|
|
1225
|
+
const entryPath = path2.join(ctx.currentDir, entry.name);
|
|
1226
|
+
await processEntry(ctx, entryPath, entry.isFile(), entry.isDirectory(), isLastPart);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
async function matchLiteral(ctx, pattern, isLastPart) {
|
|
1232
|
+
const entryPath = path2.join(ctx.currentDir, pattern);
|
|
1233
|
+
if (!fs2.existsSync(entryPath)) return;
|
|
1234
|
+
const stats = fs2.statSync(entryPath);
|
|
1235
|
+
await processEntry(ctx, entryPath, stats.isFile(), stats.isDirectory(), isLastPart);
|
|
1236
|
+
}
|
|
1237
|
+
async function walkAndMatch(ctx) {
|
|
1238
|
+
if (ctx.partIndex >= ctx.patternParts.length) return;
|
|
1239
|
+
if (!fs2.existsSync(ctx.currentDir)) return;
|
|
1240
|
+
const currentPattern = ctx.patternParts[ctx.partIndex];
|
|
1241
|
+
const isLastPart = ctx.partIndex === ctx.patternParts.length - 1;
|
|
1242
|
+
const entries = fs2.readdirSync(ctx.currentDir, { withFileTypes: true });
|
|
1243
|
+
if (currentPattern === "**") {
|
|
1244
|
+
await matchDoubleWildcard(ctx, entries);
|
|
1245
|
+
} else if (currentPattern.includes("*")) {
|
|
1246
|
+
await matchSingleWildcard(ctx, entries, currentPattern, isLastPart);
|
|
1247
|
+
} else if (currentPattern.includes("{")) {
|
|
1248
|
+
await matchBraceExpansion(ctx, entries, currentPattern, isLastPart);
|
|
1249
|
+
} else {
|
|
1250
|
+
await matchLiteral(ctx, currentPattern, isLastPart);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
function patternToRegex(pattern) {
|
|
1254
|
+
const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
1255
|
+
return new RegExp(`^${escaped}$`);
|
|
1256
|
+
}
|
|
1257
|
+
function extractBraceOptions(pattern) {
|
|
1258
|
+
const match = pattern.match(/\{([^}]+)\}/);
|
|
1259
|
+
if (!match) return [pattern];
|
|
1260
|
+
const options = match[1].split(",");
|
|
1261
|
+
const prefix = pattern.slice(0, match.index);
|
|
1262
|
+
const suffix = pattern.slice((match.index ?? 0) + match[0].length);
|
|
1263
|
+
return options.map((opt) => prefix + opt.trim() + suffix);
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
// src/commands/template-check/actors/report.ts
|
|
1267
|
+
init_esm_shims();
|
|
1268
|
+
init_types();
|
|
1269
|
+
var CATEGORY_DISPLAY_NAMES = {
|
|
1270
|
+
rules: "Rules (.claude/rules/)",
|
|
1271
|
+
agents: "Agents (.claude/agents/)",
|
|
1272
|
+
skills: "Skills (.claude/skills/)",
|
|
1273
|
+
commands: "Commands (.claude/commands/)",
|
|
1274
|
+
prompts: "Prompts (docs/prompts/)",
|
|
1275
|
+
database: "Database (packages/database/scripts/)",
|
|
1276
|
+
workflows: "Workflows (.github/workflows/)",
|
|
1277
|
+
"root-docs": "Root Documentation",
|
|
1278
|
+
config: "Configuration",
|
|
1279
|
+
other: "Other"
|
|
1280
|
+
};
|
|
1281
|
+
var reportActor = fromPromise(async ({ input }) => {
|
|
1282
|
+
const { results, options, durationMs } = input;
|
|
1283
|
+
const summary = calculateSummary(results);
|
|
1284
|
+
const byCategory = groupByCategory(results);
|
|
1285
|
+
const actionsNeeded = collectActionsNeeded(results);
|
|
1286
|
+
let jsonString;
|
|
1287
|
+
if (options.json) {
|
|
1288
|
+
jsonString = JSON.stringify(
|
|
1289
|
+
{
|
|
1290
|
+
success: summary.diff === 0 && summary.runaOnly === 0 && summary.templateOnly === 0,
|
|
1291
|
+
summary,
|
|
1292
|
+
results,
|
|
1293
|
+
actionsNeeded,
|
|
1294
|
+
durationMs
|
|
1295
|
+
},
|
|
1296
|
+
null,
|
|
1297
|
+
2
|
|
1298
|
+
);
|
|
1299
|
+
}
|
|
1300
|
+
return {
|
|
1301
|
+
byCategory,
|
|
1302
|
+
summary,
|
|
1303
|
+
actionsNeeded,
|
|
1304
|
+
jsonOutput: options.json,
|
|
1305
|
+
jsonString
|
|
1306
|
+
};
|
|
1307
|
+
});
|
|
1308
|
+
function groupByCategory(results) {
|
|
1309
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
1310
|
+
for (const result of results) {
|
|
1311
|
+
const existing = categoryMap.get(result.category) ?? [];
|
|
1312
|
+
existing.push(result);
|
|
1313
|
+
categoryMap.set(result.category, existing);
|
|
1314
|
+
}
|
|
1315
|
+
const reports = [];
|
|
1316
|
+
for (const [category, categoryResults] of categoryMap) {
|
|
1317
|
+
const identical = categoryResults.filter(
|
|
1318
|
+
(r) => r.status === "identical" || r.status === "renamed" || r.status === "intentionally-different"
|
|
1319
|
+
).length;
|
|
1320
|
+
const diff = categoryResults.filter((r) => r.status === "diff").length;
|
|
1321
|
+
const runaOnly = categoryResults.filter((r) => r.status === "runa-only").length;
|
|
1322
|
+
const templateOnly = categoryResults.filter((r) => r.status === "template-only").length;
|
|
1323
|
+
const expectedOnly = categoryResults.filter(
|
|
1324
|
+
(r) => r.status === "expected-runa-only" || r.status === "expected-template-only"
|
|
1325
|
+
).length;
|
|
1326
|
+
reports.push({
|
|
1327
|
+
category,
|
|
1328
|
+
displayName: CATEGORY_DISPLAY_NAMES[category],
|
|
1329
|
+
results: categoryResults,
|
|
1330
|
+
identical,
|
|
1331
|
+
diff,
|
|
1332
|
+
runaOnly,
|
|
1333
|
+
templateOnly,
|
|
1334
|
+
expectedOnly
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
const categoryOrder = [
|
|
1338
|
+
"rules",
|
|
1339
|
+
"agents",
|
|
1340
|
+
"skills",
|
|
1341
|
+
"commands",
|
|
1342
|
+
"prompts",
|
|
1343
|
+
"database",
|
|
1344
|
+
"workflows",
|
|
1345
|
+
"root-docs",
|
|
1346
|
+
"config",
|
|
1347
|
+
"other"
|
|
1348
|
+
];
|
|
1349
|
+
reports.sort((a, b) => {
|
|
1350
|
+
return categoryOrder.indexOf(a.category) - categoryOrder.indexOf(b.category);
|
|
1351
|
+
});
|
|
1352
|
+
return reports;
|
|
1353
|
+
}
|
|
1354
|
+
function collectActionsNeeded(results) {
|
|
1355
|
+
const actions = [];
|
|
1356
|
+
for (const result of results) {
|
|
1357
|
+
if (result.status === "diff" || result.status === "runa-only" || result.status === "template-only") {
|
|
1358
|
+
actions.push({
|
|
1359
|
+
path: result.runaPath ?? result.templatePath ?? "",
|
|
1360
|
+
targetPath: result.runaPath && result.templatePath ? result.templatePath : null,
|
|
1361
|
+
status: result.status,
|
|
1362
|
+
ahead: result.ahead ?? null,
|
|
1363
|
+
lineDiff: result.lineDiff ?? null,
|
|
1364
|
+
diffOutput: result.diffOutput
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
return actions;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
// src/commands/template-check/machine.ts
|
|
1372
|
+
init_types();
|
|
1373
|
+
var e2eMeta = {
|
|
1374
|
+
idle: {
|
|
1375
|
+
description: "Waiting for START event to begin template check",
|
|
1376
|
+
severity: "non-critical",
|
|
1377
|
+
observables: {
|
|
1378
|
+
log: "Template Check"
|
|
1379
|
+
},
|
|
1380
|
+
assertions: ["expect(log).toContain('Template Check')", "expect(state).toBe('idle')"],
|
|
1381
|
+
nextStates: ["discover"]
|
|
1382
|
+
},
|
|
1383
|
+
discover: {
|
|
1384
|
+
description: "Scan runa-repo and pj-repo for template files",
|
|
1385
|
+
severity: "blocking",
|
|
1386
|
+
observables: {
|
|
1387
|
+
log: "Discovering files",
|
|
1388
|
+
fs: "packages/runa-templates/templates/ scanned"
|
|
1389
|
+
},
|
|
1390
|
+
assertions: [
|
|
1391
|
+
"expect(log).toContain('Discovering files')",
|
|
1392
|
+
"expect(ctx.inventory).toBeDefined()"
|
|
1393
|
+
],
|
|
1394
|
+
nextStates: ["compare", "failed"]
|
|
1395
|
+
},
|
|
1396
|
+
compare: {
|
|
1397
|
+
description: "Normalize content and compare template files",
|
|
1398
|
+
severity: "blocking",
|
|
1399
|
+
observables: {
|
|
1400
|
+
log: "Comparing files"
|
|
1401
|
+
},
|
|
1402
|
+
assertions: ["expect(log).toContain('Comparing files')", "expect(ctx.results).toBeArray()"],
|
|
1403
|
+
nextStates: ["report", "failed"]
|
|
1404
|
+
},
|
|
1405
|
+
report: {
|
|
1406
|
+
description: "Generate comparison report and summary",
|
|
1407
|
+
severity: "blocking",
|
|
1408
|
+
observables: {
|
|
1409
|
+
log: "Summary"
|
|
1410
|
+
},
|
|
1411
|
+
assertions: ["expect(log).toContain('Summary')"],
|
|
1412
|
+
nextStates: ["done", "failed"]
|
|
1413
|
+
},
|
|
1414
|
+
done: {
|
|
1415
|
+
description: "Template check completed",
|
|
1416
|
+
severity: "final",
|
|
1417
|
+
observables: {
|
|
1418
|
+
log: "Summary",
|
|
1419
|
+
exit: "0 (all identical) or 1 (differences found)"
|
|
1420
|
+
},
|
|
1421
|
+
assertions: ["expect(log).toContain('Summary')", "expect(exitCode).toBe(0).or.toBe(1)"],
|
|
1422
|
+
nextStates: []
|
|
1423
|
+
},
|
|
1424
|
+
failed: {
|
|
1425
|
+
description: "Template check failed with error",
|
|
1426
|
+
severity: "final",
|
|
1427
|
+
observables: {
|
|
1428
|
+
log: "failed",
|
|
1429
|
+
exit: 2
|
|
1430
|
+
},
|
|
1431
|
+
assertions: ["expect(log).toContain('failed')", "expect(exitCode).toBe(2)"],
|
|
1432
|
+
nextStates: []
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
var syncCheckMachine = setup({
|
|
1436
|
+
types: {},
|
|
1437
|
+
actors: {
|
|
1438
|
+
discover: discoverActor,
|
|
1439
|
+
compare: compareActor,
|
|
1440
|
+
report: reportActor
|
|
1441
|
+
}
|
|
1442
|
+
}).createMachine({
|
|
1443
|
+
id: "templateCheck",
|
|
1444
|
+
initial: "idle",
|
|
1445
|
+
context: ({ input }) => ({
|
|
1446
|
+
input: input.input,
|
|
1447
|
+
repoRoot: input.repoRoot,
|
|
1448
|
+
templateDir: `${input.repoRoot}/packages/runa-templates/templates`,
|
|
1449
|
+
inventory: null,
|
|
1450
|
+
results: [],
|
|
1451
|
+
startTime: Date.now(),
|
|
1452
|
+
error: null
|
|
1453
|
+
}),
|
|
1454
|
+
states: {
|
|
1455
|
+
// ============================================================
|
|
1456
|
+
// Idle State
|
|
1457
|
+
// ============================================================
|
|
1458
|
+
idle: {
|
|
1459
|
+
meta: { e2e: e2eMeta.idle },
|
|
1460
|
+
on: {
|
|
1461
|
+
START: { target: "discover" }
|
|
1462
|
+
}
|
|
1463
|
+
},
|
|
1464
|
+
// ============================================================
|
|
1465
|
+
// Discover Phase
|
|
1466
|
+
// ============================================================
|
|
1467
|
+
discover: {
|
|
1468
|
+
meta: { e2e: e2eMeta.discover },
|
|
1469
|
+
invoke: {
|
|
1470
|
+
src: "discover",
|
|
1471
|
+
input: ({ context }) => ({
|
|
1472
|
+
repoRoot: context.repoRoot,
|
|
1473
|
+
templateDir: context.templateDir
|
|
1474
|
+
}),
|
|
1475
|
+
onDone: {
|
|
1476
|
+
target: "compare",
|
|
1477
|
+
actions: assign({
|
|
1478
|
+
inventory: ({ event }) => event.output.inventory
|
|
1479
|
+
})
|
|
1480
|
+
},
|
|
1481
|
+
onError: {
|
|
1482
|
+
target: "failed",
|
|
1483
|
+
actions: assign({
|
|
1484
|
+
error: ({ event }) => `Discovery failed: ${getErrorMessage(event.error)}`
|
|
1485
|
+
})
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
},
|
|
1489
|
+
// ============================================================
|
|
1490
|
+
// Compare Phase
|
|
1491
|
+
// ============================================================
|
|
1492
|
+
compare: {
|
|
1493
|
+
meta: { e2e: e2eMeta.compare },
|
|
1494
|
+
invoke: {
|
|
1495
|
+
src: "compare",
|
|
1496
|
+
input: ({ context }) => ({
|
|
1497
|
+
inventory: context.inventory,
|
|
1498
|
+
repoRoot: context.repoRoot,
|
|
1499
|
+
templateDir: context.templateDir,
|
|
1500
|
+
options: context.input
|
|
1501
|
+
}),
|
|
1502
|
+
onDone: {
|
|
1503
|
+
target: "report",
|
|
1504
|
+
actions: assign({
|
|
1505
|
+
results: ({ event }) => event.output.results
|
|
1506
|
+
})
|
|
1507
|
+
},
|
|
1508
|
+
onError: {
|
|
1509
|
+
target: "failed",
|
|
1510
|
+
actions: assign({
|
|
1511
|
+
error: ({ event }) => `Comparison failed: ${getErrorMessage(event.error)}`
|
|
1512
|
+
})
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
},
|
|
1516
|
+
// ============================================================
|
|
1517
|
+
// Report Phase
|
|
1518
|
+
// ============================================================
|
|
1519
|
+
report: {
|
|
1520
|
+
meta: { e2e: e2eMeta.report },
|
|
1521
|
+
invoke: {
|
|
1522
|
+
src: "report",
|
|
1523
|
+
input: ({ context }) => ({
|
|
1524
|
+
results: context.results,
|
|
1525
|
+
options: context.input,
|
|
1526
|
+
durationMs: Date.now() - context.startTime
|
|
1527
|
+
}),
|
|
1528
|
+
onDone: {
|
|
1529
|
+
target: "done"
|
|
1530
|
+
// Report output is used for rendering, not stored in context
|
|
1531
|
+
},
|
|
1532
|
+
onError: {
|
|
1533
|
+
target: "failed",
|
|
1534
|
+
actions: assign({
|
|
1535
|
+
error: ({ event }) => `Report generation failed: ${getErrorMessage(event.error)}`
|
|
1536
|
+
})
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
},
|
|
1540
|
+
// ============================================================
|
|
1541
|
+
// Final States
|
|
1542
|
+
// ============================================================
|
|
1543
|
+
done: {
|
|
1544
|
+
meta: { e2e: e2eMeta.done },
|
|
1545
|
+
type: "final"
|
|
1546
|
+
},
|
|
1547
|
+
failed: {
|
|
1548
|
+
meta: { e2e: e2eMeta.failed },
|
|
1549
|
+
type: "final"
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
output: ({ context }) => createOutput(context)
|
|
1553
|
+
});
|
|
1554
|
+
function getStateName(snapshot) {
|
|
1555
|
+
return typeof snapshot.value === "string" ? snapshot.value : "unknown";
|
|
1556
|
+
}
|
|
1557
|
+
function isComplete(snapshot) {
|
|
1558
|
+
return snapshot.status === "done";
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
// src/commands/template-check/commands/template-check.ts
|
|
1562
|
+
var stateLogHandlers = {
|
|
1563
|
+
idle: (logger) => {
|
|
1564
|
+
logger.section("Template Check");
|
|
1565
|
+
logger.info("Comparing runa-repo with pj-repo templates...");
|
|
1566
|
+
},
|
|
1567
|
+
discover: (logger) => {
|
|
1568
|
+
logger.info("Discovering files...");
|
|
1569
|
+
},
|
|
1570
|
+
compare: (logger) => {
|
|
1571
|
+
logger.info("Comparing files...");
|
|
1572
|
+
},
|
|
1573
|
+
report: (_logger) => {
|
|
1574
|
+
}
|
|
1575
|
+
};
|
|
1576
|
+
function handleStateChange(snapshot, prevState, logger, jsonMode, quietMode) {
|
|
1577
|
+
if (jsonMode || quietMode) return;
|
|
1578
|
+
const state = getStateName(snapshot);
|
|
1579
|
+
if (state === prevState) return;
|
|
1580
|
+
const handler = stateLogHandlers[state];
|
|
1581
|
+
if (handler) {
|
|
1582
|
+
handler(logger);
|
|
1583
|
+
}
|
|
1584
|
+
}
|
|
1585
|
+
var CATEGORY_DISPLAY_NAMES2 = {
|
|
1586
|
+
rules: "Rules (.claude/rules/)",
|
|
1587
|
+
agents: "Agents (.claude/agents/)",
|
|
1588
|
+
skills: "Skills (.claude/skills/)",
|
|
1589
|
+
commands: "Commands (.claude/commands/)",
|
|
1590
|
+
prompts: "Prompts (docs/prompts/)",
|
|
1591
|
+
database: "Database (packages/database/scripts/)",
|
|
1592
|
+
workflows: "Workflows (.github/workflows/)",
|
|
1593
|
+
"root-docs": "Root Documentation",
|
|
1594
|
+
config: "Configuration",
|
|
1595
|
+
other: "Other"
|
|
1596
|
+
};
|
|
1597
|
+
var STATUS_ICONS = {
|
|
1598
|
+
identical: "\u2705",
|
|
1599
|
+
renamed: "\u{1F504}",
|
|
1600
|
+
diff: "\u26A0\uFE0F",
|
|
1601
|
+
"runa-only": "\u{1F535}",
|
|
1602
|
+
"template-only": "\u{1F7E0}",
|
|
1603
|
+
"expected-runa-only": "\u23ED\uFE0F",
|
|
1604
|
+
"expected-template-only": "\u23ED\uFE0F",
|
|
1605
|
+
"intentionally-different": "\u{1F4CC}"
|
|
1606
|
+
// Expected to differ (dogfooding vs pj-repo)
|
|
1607
|
+
};
|
|
1608
|
+
var AHEAD_LABELS = {
|
|
1609
|
+
runa: "runa ahead",
|
|
1610
|
+
template: "template ahead",
|
|
1611
|
+
diverged: "diverged",
|
|
1612
|
+
equal: ""
|
|
1613
|
+
};
|
|
1614
|
+
var STATUS_SUFFIXES = {
|
|
1615
|
+
"runa-only": "(unexpected - missing in template)",
|
|
1616
|
+
"template-only": "(unexpected - missing in runa-repo)",
|
|
1617
|
+
"expected-runa-only": "(expected - runa-repo only)",
|
|
1618
|
+
"expected-template-only": "(expected - pj-repo only)",
|
|
1619
|
+
renamed: "(file renamed, content identical)"
|
|
1620
|
+
};
|
|
1621
|
+
function getStatusSuffix(result) {
|
|
1622
|
+
if (result.status === "diff") {
|
|
1623
|
+
let suffix = result.lineDiff ?? "";
|
|
1624
|
+
if (result.ahead && AHEAD_LABELS[result.ahead]) {
|
|
1625
|
+
suffix += ` (${AHEAD_LABELS[result.ahead]})`;
|
|
1626
|
+
}
|
|
1627
|
+
return suffix;
|
|
1628
|
+
}
|
|
1629
|
+
if (result.status === "intentionally-different") {
|
|
1630
|
+
return `${result.lineDiff ?? ""} (expected - dogfooding vs pj-repo)`;
|
|
1631
|
+
}
|
|
1632
|
+
return STATUS_SUFFIXES[result.status] ?? "";
|
|
1633
|
+
}
|
|
1634
|
+
function getPathDisplay(result) {
|
|
1635
|
+
const runaPath = result.runaPath ?? "(none)";
|
|
1636
|
+
const templatePath = result.templatePath ?? "(none)";
|
|
1637
|
+
if (result.runaPath && result.templatePath && result.runaPath !== result.templatePath) {
|
|
1638
|
+
return `${runaPath} \u2192 ${templatePath.split("/").pop()}`;
|
|
1639
|
+
}
|
|
1640
|
+
return runaPath !== "(none)" ? runaPath : templatePath;
|
|
1641
|
+
}
|
|
1642
|
+
function printDiffOutput(logger, diffOutput) {
|
|
1643
|
+
logger.info("");
|
|
1644
|
+
for (const line of diffOutput.split("\n")) {
|
|
1645
|
+
if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
1646
|
+
logger.success(` ${line}`);
|
|
1647
|
+
} else if (line.startsWith("-") && !line.startsWith("---")) {
|
|
1648
|
+
logger.error(` ${line}`);
|
|
1649
|
+
} else {
|
|
1650
|
+
logger.info(` ${line}`);
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
logger.info("");
|
|
1654
|
+
}
|
|
1655
|
+
function printResult(logger, result, verbose) {
|
|
1656
|
+
const icon = STATUS_ICONS[result.status] ?? "\u2753";
|
|
1657
|
+
const pathDisplay = getPathDisplay(result);
|
|
1658
|
+
const suffix = getStatusSuffix(result);
|
|
1659
|
+
const statusLine = suffix ? ` ${icon} ${pathDisplay} ${suffix}` : ` ${icon} ${pathDisplay}`;
|
|
1660
|
+
if (verbose || result.status !== "identical") {
|
|
1661
|
+
logger.info(statusLine);
|
|
1662
|
+
}
|
|
1663
|
+
if (result.diffOutput) {
|
|
1664
|
+
printDiffOutput(logger, result.diffOutput);
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
function printCategoryReport(logger, category, verbose) {
|
|
1668
|
+
logger.info("");
|
|
1669
|
+
logger.info(`\u2501\u2501\u2501 ${category.displayName} \u2501\u2501\u2501`);
|
|
1670
|
+
for (const result of category.results) {
|
|
1671
|
+
printResult(logger, result, verbose);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
function printSummary(logger, summary, _durationMs) {
|
|
1675
|
+
const needsAction = summary.diff + summary.runaOnly + summary.templateOnly;
|
|
1676
|
+
logger.info("");
|
|
1677
|
+
logger.info("\u2501\u2501\u2501 Summary (code files only) \u2501\u2501\u2501");
|
|
1678
|
+
logger.info(
|
|
1679
|
+
` Total: ${summary.total} | In sync: ${summary.identical} | Needs action: ${needsAction}`
|
|
1680
|
+
);
|
|
1681
|
+
if (needsAction === 0) {
|
|
1682
|
+
logger.success(" \u2705 Template is up to date!");
|
|
1683
|
+
} else {
|
|
1684
|
+
logger.warn(` \u26A0\uFE0F ${needsAction} file(s) need attention`);
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
function printActionGroup(logger, actions, header, isWarning, formatter) {
|
|
1688
|
+
if (actions.length === 0) return;
|
|
1689
|
+
logger.info("");
|
|
1690
|
+
if (isWarning) {
|
|
1691
|
+
logger.warn(header);
|
|
1692
|
+
} else {
|
|
1693
|
+
logger.info(header);
|
|
1694
|
+
}
|
|
1695
|
+
for (const action of actions) {
|
|
1696
|
+
for (const line of formatter(action)) {
|
|
1697
|
+
logger.info(line);
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
function printActionsNeeded(logger, actions) {
|
|
1702
|
+
if (actions.length === 0) {
|
|
1703
|
+
logger.info("");
|
|
1704
|
+
logger.success("\u2705 All code files are in sync! No action needed.");
|
|
1705
|
+
return;
|
|
1706
|
+
}
|
|
1707
|
+
const updateTemplate = actions.filter((a) => a.ahead === "runa");
|
|
1708
|
+
const checkRuna = actions.filter((a) => a.ahead === "template");
|
|
1709
|
+
const manualMerge = actions.filter((a) => a.ahead === "diverged");
|
|
1710
|
+
const missingInTemplate = actions.filter((a) => a.status === "runa-only");
|
|
1711
|
+
const missingInRuna = actions.filter((a) => a.status === "template-only");
|
|
1712
|
+
logger.info("");
|
|
1713
|
+
logger.info("\u2501\u2501\u2501 Actions Required \u2501\u2501\u2501");
|
|
1714
|
+
printActionGroup(
|
|
1715
|
+
logger,
|
|
1716
|
+
updateTemplate,
|
|
1717
|
+
"\u{1F4E4} UPDATE TEMPLATE (runa-repo has newer code):",
|
|
1718
|
+
false,
|
|
1719
|
+
(action) => {
|
|
1720
|
+
const templatePath = action.targetPath ?? action.path.replace(/^\.claude\//, ".claude/sdk/");
|
|
1721
|
+
return [` cp ${action.path} packages/runa-templates/templates/${templatePath}`];
|
|
1722
|
+
}
|
|
1723
|
+
);
|
|
1724
|
+
printActionGroup(
|
|
1725
|
+
logger,
|
|
1726
|
+
checkRuna,
|
|
1727
|
+
"\u26A0\uFE0F CHECK RUNA-REPO (template is ahead - unusual):",
|
|
1728
|
+
true,
|
|
1729
|
+
(action) => [
|
|
1730
|
+
` ${action.path}`,
|
|
1731
|
+
` \u2192 Template was updated but runa-repo wasn't. Intentional?`
|
|
1732
|
+
]
|
|
1733
|
+
);
|
|
1734
|
+
printActionGroup(
|
|
1735
|
+
logger,
|
|
1736
|
+
manualMerge,
|
|
1737
|
+
"\u{1F500} MANUAL MERGE NEEDED (both sides changed):",
|
|
1738
|
+
true,
|
|
1739
|
+
(action) => [` ${action.path}`, " \u2192 Run: runa template-check --diff to see differences"]
|
|
1740
|
+
);
|
|
1741
|
+
printActionGroup(
|
|
1742
|
+
logger,
|
|
1743
|
+
missingInTemplate,
|
|
1744
|
+
"\u2795 ADD TO TEMPLATE (or mark as runa-only in normalizer.ts):",
|
|
1745
|
+
false,
|
|
1746
|
+
(action) => [` ${action.path}`]
|
|
1747
|
+
);
|
|
1748
|
+
printActionGroup(
|
|
1749
|
+
logger,
|
|
1750
|
+
missingInRuna,
|
|
1751
|
+
"\u2753 MISSING IN RUNA-REPO (template has code that runa-repo doesn't):",
|
|
1752
|
+
true,
|
|
1753
|
+
(action) => [` ${action.path}`]
|
|
1754
|
+
);
|
|
1755
|
+
}
|
|
1756
|
+
function findRepoRoot(startDir) {
|
|
1757
|
+
const { existsSync: existsSync2, readFileSync: readFileSync2 } = __require("fs");
|
|
1758
|
+
const { join: join3, dirname } = __require("path");
|
|
1759
|
+
let current = startDir;
|
|
1760
|
+
while (current !== dirname(current)) {
|
|
1761
|
+
if (existsSync2(join3(current, "turbo.json"))) {
|
|
1762
|
+
return current;
|
|
1763
|
+
}
|
|
1764
|
+
const pkgPath = join3(current, "package.json");
|
|
1765
|
+
if (existsSync2(pkgPath)) {
|
|
1766
|
+
try {
|
|
1767
|
+
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
1768
|
+
if (pkg.workspaces) {
|
|
1769
|
+
return current;
|
|
1770
|
+
}
|
|
1771
|
+
} catch {
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
current = dirname(current);
|
|
1775
|
+
}
|
|
1776
|
+
return startDir;
|
|
1777
|
+
}
|
|
1778
|
+
function groupResultsByCategory(results) {
|
|
1779
|
+
const categoryMap = /* @__PURE__ */ new Map();
|
|
1780
|
+
for (const result of results) {
|
|
1781
|
+
const existing = categoryMap.get(result.category) ?? [];
|
|
1782
|
+
existing.push(result);
|
|
1783
|
+
categoryMap.set(result.category, existing);
|
|
1784
|
+
}
|
|
1785
|
+
const byCategory = [];
|
|
1786
|
+
for (const [category, categoryResults] of categoryMap) {
|
|
1787
|
+
byCategory.push({
|
|
1788
|
+
category,
|
|
1789
|
+
displayName: CATEGORY_DISPLAY_NAMES2[category] ?? category,
|
|
1790
|
+
results: categoryResults,
|
|
1791
|
+
// Count identical, renamed, and intentionally-different as "in sync"
|
|
1792
|
+
identical: categoryResults.filter(
|
|
1793
|
+
(r) => r.status === "identical" || r.status === "renamed" || r.status === "intentionally-different"
|
|
1794
|
+
).length,
|
|
1795
|
+
diff: categoryResults.filter((r) => r.status === "diff").length,
|
|
1796
|
+
runaOnly: categoryResults.filter((r) => r.status === "runa-only").length,
|
|
1797
|
+
templateOnly: categoryResults.filter((r) => r.status === "template-only").length,
|
|
1798
|
+
expectedOnly: categoryResults.filter(
|
|
1799
|
+
(r) => r.status === "expected-runa-only" || r.status === "expected-template-only"
|
|
1800
|
+
).length
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
return byCategory;
|
|
1804
|
+
}
|
|
1805
|
+
function collectActionsNeeded2(results) {
|
|
1806
|
+
return results.filter((r) => r.status === "diff" || r.status === "runa-only" || r.status === "template-only").map((r) => ({
|
|
1807
|
+
path: r.runaPath ?? r.templatePath ?? "",
|
|
1808
|
+
targetPath: r.runaPath && r.templatePath ? r.templatePath : null,
|
|
1809
|
+
status: r.status,
|
|
1810
|
+
ahead: r.ahead ?? null,
|
|
1811
|
+
lineDiff: r.lineDiff ?? null,
|
|
1812
|
+
diffOutput: r.diffOutput
|
|
1813
|
+
}));
|
|
1814
|
+
}
|
|
1815
|
+
function generateReportOutput(output, isJsonMode) {
|
|
1816
|
+
const { calculateSummary: calculateSummary2 } = (init_types(), __toCommonJS(types_exports));
|
|
1817
|
+
const summary = calculateSummary2(output.results);
|
|
1818
|
+
const byCategory = groupResultsByCategory(output.results);
|
|
1819
|
+
const actionsNeeded = collectActionsNeeded2(output.results);
|
|
1820
|
+
return {
|
|
1821
|
+
byCategory,
|
|
1822
|
+
summary,
|
|
1823
|
+
actionsNeeded,
|
|
1824
|
+
jsonOutput: isJsonMode,
|
|
1825
|
+
jsonString: isJsonMode ? JSON.stringify(
|
|
1826
|
+
{ success: output.success, summary, results: output.results, actionsNeeded },
|
|
1827
|
+
null,
|
|
1828
|
+
2
|
|
1829
|
+
) : void 0
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
function validateRunaRepo(repoRoot) {
|
|
1833
|
+
const { existsSync: existsSync2 } = __require("fs");
|
|
1834
|
+
const { join: join3 } = __require("path");
|
|
1835
|
+
const templateDir = join3(repoRoot, "packages/runa-templates/templates");
|
|
1836
|
+
if (!existsSync2(templateDir)) {
|
|
1837
|
+
throw new CLIError("template-check is a runa-repo only command", "NOT_RUNA_REPO", [
|
|
1838
|
+
"This command compares runa-repo with pj-repo templates",
|
|
1839
|
+
"It should only be run in the runa repository",
|
|
1840
|
+
`Expected: ${templateDir}`
|
|
1841
|
+
]);
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
async function runTemplateCheckMachine(input, logger) {
|
|
1845
|
+
const repoRoot = input.targetDir ?? findRepoRoot(process.cwd());
|
|
1846
|
+
validateRunaRepo(repoRoot);
|
|
1847
|
+
return new Promise((resolve, reject) => {
|
|
1848
|
+
const actor = createActor(syncCheckMachine, {
|
|
1849
|
+
input: { input, repoRoot }
|
|
1850
|
+
});
|
|
1851
|
+
let previousState = "";
|
|
1852
|
+
const isJsonMode = getOutputFormatFromEnv() === "json";
|
|
1853
|
+
const isQuietMode = input.quiet ?? false;
|
|
1854
|
+
actor.subscribe((snapshot) => {
|
|
1855
|
+
const currentState = getStateName(snapshot);
|
|
1856
|
+
if (currentState !== previousState) {
|
|
1857
|
+
handleStateChange(snapshot, previousState, logger, isJsonMode, isQuietMode);
|
|
1858
|
+
previousState = currentState;
|
|
1859
|
+
}
|
|
1860
|
+
if (isComplete(snapshot)) {
|
|
1861
|
+
const output = snapshot.output;
|
|
1862
|
+
if (output) {
|
|
1863
|
+
const reportOutput = generateReportOutput(output, isJsonMode);
|
|
1864
|
+
resolve({ output, reportOutput });
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
});
|
|
1868
|
+
actor.subscribe({
|
|
1869
|
+
error: (error) => {
|
|
1870
|
+
reject(error);
|
|
1871
|
+
actor.stop();
|
|
1872
|
+
}
|
|
1873
|
+
});
|
|
1874
|
+
actor.start();
|
|
1875
|
+
actor.send({ type: "START" });
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
function printReportOutput(logger, reportOutput, durationMs, options) {
|
|
1879
|
+
if (!options.quiet) {
|
|
1880
|
+
for (const category of reportOutput.byCategory) {
|
|
1881
|
+
printCategoryReport(logger, category, options.verbose);
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
printSummary(logger, reportOutput.summary);
|
|
1885
|
+
printActionsNeeded(logger, reportOutput.actionsNeeded);
|
|
1886
|
+
}
|
|
1887
|
+
function wrapError(error) {
|
|
1888
|
+
if (error instanceof CLIError) {
|
|
1889
|
+
return error;
|
|
1890
|
+
}
|
|
1891
|
+
return new CLIError(
|
|
1892
|
+
error instanceof Error ? error.message : String(error),
|
|
1893
|
+
"TEMPLATE_CHECK_ERROR",
|
|
1894
|
+
["Check file paths and permissions"],
|
|
1895
|
+
error instanceof Error ? error : void 0
|
|
1896
|
+
);
|
|
1897
|
+
}
|
|
1898
|
+
async function runTemplateCheckAction(options) {
|
|
1899
|
+
const logger = createCLILogger("template-check");
|
|
1900
|
+
try {
|
|
1901
|
+
const { output, reportOutput } = await runTemplateCheckMachine(options, logger);
|
|
1902
|
+
const isJsonMode = getOutputFormatFromEnv() === "json";
|
|
1903
|
+
if (isJsonMode && reportOutput?.jsonString) {
|
|
1904
|
+
console.log(reportOutput.jsonString);
|
|
1905
|
+
process.exit(output.exitCode);
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
if (reportOutput) {
|
|
1909
|
+
printReportOutput(logger, reportOutput, output.durationMs, options);
|
|
1910
|
+
}
|
|
1911
|
+
if (output.error) {
|
|
1912
|
+
throw new CLIError(output.error, "SYNC_CHECK_ERROR");
|
|
1913
|
+
}
|
|
1914
|
+
process.exit(output.exitCode);
|
|
1915
|
+
} catch (error) {
|
|
1916
|
+
throw wrapError(error);
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
var templateCheckCommand = new Command("template-check").description(
|
|
1920
|
+
"Compare runa-repo with SDK templates (runa-repo only)\n\n Exit codes:\n 0 = All files in sync\n 1 = Differences detected (action needed)\n 2 = Error occurred"
|
|
1921
|
+
).option("--verbose", "Show all files including identical ones").option("--diff", "Show unified diff for differences").option("--category <name>", "Filter by category (rules, agents, skills, etc.)").option("--json", "Output as JSON (for CI integration)").option("--quiet", "Only show summary and actions (for pre-commit hooks)").option("--target-dir <path>", "Target directory (defaults to repo root)").action(async (options) => {
|
|
1922
|
+
const input = {
|
|
1923
|
+
verbose: options.verbose ?? false,
|
|
1924
|
+
diff: options.diff ?? false,
|
|
1925
|
+
category: options.category,
|
|
1926
|
+
json: options.json ?? false,
|
|
1927
|
+
quiet: options.quiet ?? false,
|
|
1928
|
+
targetDir: options.targetDir
|
|
1929
|
+
};
|
|
1930
|
+
await runTemplateCheckAction(input);
|
|
1931
|
+
});
|
|
1932
|
+
|
|
1933
|
+
export { templateCheckCommand };
|