@mesh-tech/mesh-cli 0.1.1 → 0.12.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/assets/intent/agents-fence.md +10 -0
- package/assets/intent/intent-claude-gate.mjs +255 -0
- package/assets/log-shipper.mjs +94 -0
- package/bin/mesh.mjs +80 -0
- package/dist/bin/mesh.d.ts +7 -9
- package/dist/bin/mesh.d.ts.map +1 -1
- package/dist/bin/mesh.js +20826 -37
- package/dist/bin/mesh.js.map +7 -1
- package/dist/build-info.json +4 -0
- package/dist/src/commands/agent-api-client.d.ts +79 -0
- package/dist/src/commands/agent-api-client.d.ts.map +1 -0
- package/dist/src/commands/agent-api-client.js +170 -0
- package/dist/src/commands/agent-api-client.js.map +1 -0
- package/dist/src/commands/artifacts.d.ts +13 -0
- package/dist/src/commands/artifacts.d.ts.map +1 -0
- package/dist/src/commands/artifacts.js +140 -0
- package/dist/src/commands/artifacts.js.map +1 -0
- package/dist/src/commands/cluster.d.ts +45 -0
- package/dist/src/commands/cluster.d.ts.map +1 -0
- package/dist/src/commands/cluster.js +259 -0
- package/dist/src/commands/cluster.js.map +1 -0
- package/dist/src/commands/conversations.d.ts +61 -0
- package/dist/src/commands/conversations.d.ts.map +1 -0
- package/dist/src/commands/conversations.js +239 -0
- package/dist/src/commands/conversations.js.map +1 -0
- package/dist/src/commands/create-app.d.ts +26 -3
- package/dist/src/commands/create-app.d.ts.map +1 -1
- package/dist/src/commands/create-app.js +465 -107
- package/dist/src/commands/create-app.js.map +1 -1
- package/dist/src/commands/deploy.d.ts +19 -0
- package/dist/src/commands/deploy.d.ts.map +1 -1
- package/dist/src/commands/deploy.js +83 -142
- package/dist/src/commands/deploy.js.map +1 -1
- package/dist/src/commands/dev-doctor.d.ts +137 -0
- package/dist/src/commands/dev-doctor.d.ts.map +1 -0
- package/dist/src/commands/dev-doctor.js +671 -0
- package/dist/src/commands/dev-doctor.js.map +1 -0
- package/dist/src/commands/dev-launch.d.ts +59 -0
- package/dist/src/commands/dev-launch.d.ts.map +1 -0
- package/dist/src/commands/dev-launch.js +118 -0
- package/dist/src/commands/dev-launch.js.map +1 -0
- package/dist/src/commands/dev-token-server.d.ts +32 -0
- package/dist/src/commands/dev-token-server.d.ts.map +1 -0
- package/dist/src/commands/dev-token-server.js +68 -0
- package/dist/src/commands/dev-token-server.js.map +1 -0
- package/dist/src/commands/dev.d.ts +289 -2
- package/dist/src/commands/dev.d.ts.map +1 -1
- package/dist/src/commands/dev.js +2501 -574
- package/dist/src/commands/dev.js.map +1 -1
- package/dist/src/commands/docs.d.ts +3 -0
- package/dist/src/commands/docs.d.ts.map +1 -0
- package/dist/src/commands/docs.js +262 -0
- package/dist/src/commands/docs.js.map +1 -0
- package/dist/src/commands/hub/index.d.ts +99 -0
- package/dist/src/commands/hub/index.d.ts.map +1 -0
- package/dist/src/commands/hub/index.js +452 -0
- package/dist/src/commands/hub/index.js.map +1 -0
- package/dist/src/commands/init.d.ts +65 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +370 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/install-shim.d.ts +21 -0
- package/dist/src/commands/install-shim.d.ts.map +1 -0
- package/dist/src/commands/install-shim.js +132 -0
- package/dist/src/commands/install-shim.js.map +1 -0
- package/dist/src/commands/local/auth-provision.d.ts +71 -0
- package/dist/src/commands/local/auth-provision.d.ts.map +1 -0
- package/dist/src/commands/local/auth-provision.js +286 -0
- package/dist/src/commands/local/auth-provision.js.map +1 -0
- package/dist/src/commands/local/dev-local.d.ts +97 -0
- package/dist/src/commands/local/dev-local.d.ts.map +1 -0
- package/dist/src/commands/local/dev-local.js +306 -0
- package/dist/src/commands/local/dev-local.js.map +1 -0
- package/dist/src/commands/local/docker-runner.d.ts +37 -0
- package/dist/src/commands/local/docker-runner.d.ts.map +1 -0
- package/dist/src/commands/local/docker-runner.js +104 -0
- package/dist/src/commands/local/docker-runner.js.map +1 -0
- package/dist/src/commands/local/helpers.d.ts +22 -0
- package/dist/src/commands/local/helpers.d.ts.map +1 -0
- package/dist/src/commands/local/helpers.js +46 -0
- package/dist/src/commands/local/helpers.js.map +1 -0
- package/dist/src/commands/local/hub-local.d.ts +51 -0
- package/dist/src/commands/local/hub-local.d.ts.map +1 -0
- package/dist/src/commands/local/hub-local.js +197 -0
- package/dist/src/commands/local/hub-local.js.map +1 -0
- package/dist/src/commands/local/index.d.ts +23 -0
- package/dist/src/commands/local/index.d.ts.map +1 -0
- package/dist/src/commands/local/index.js +386 -0
- package/dist/src/commands/local/index.js.map +1 -0
- package/dist/src/commands/local/mocks.d.ts +361 -0
- package/dist/src/commands/local/mocks.d.ts.map +1 -0
- package/dist/src/commands/local/mocks.js +756 -0
- package/dist/src/commands/local/mocks.js.map +1 -0
- package/dist/src/commands/local/seed-zitadel.d.ts +151 -0
- package/dist/src/commands/local/seed-zitadel.d.ts.map +1 -0
- package/dist/src/commands/local/seed-zitadel.js +408 -0
- package/dist/src/commands/local/seed-zitadel.js.map +1 -0
- package/dist/src/commands/local/seed.d.ts +106 -0
- package/dist/src/commands/local/seed.d.ts.map +1 -0
- package/dist/src/commands/local/seed.js +252 -0
- package/dist/src/commands/local/seed.js.map +1 -0
- package/dist/src/commands/local/stack.d.ts +173 -0
- package/dist/src/commands/local/stack.d.ts.map +1 -0
- package/dist/src/commands/local/stack.js +499 -0
- package/dist/src/commands/local/stack.js.map +1 -0
- package/dist/src/commands/login.d.ts +256 -12
- package/dist/src/commands/login.d.ts.map +1 -1
- package/dist/src/commands/login.js +978 -50
- package/dist/src/commands/login.js.map +1 -1
- package/dist/src/commands/peer-addressing.d.ts +51 -0
- package/dist/src/commands/peer-addressing.d.ts.map +1 -0
- package/dist/src/commands/peer-addressing.js +64 -0
- package/dist/src/commands/peer-addressing.js.map +1 -0
- package/dist/src/commands/port-ownership.d.ts +69 -0
- package/dist/src/commands/port-ownership.d.ts.map +1 -0
- package/dist/src/commands/port-ownership.js +161 -0
- package/dist/src/commands/port-ownership.js.map +1 -0
- package/dist/src/commands/registry-publish.d.ts +3 -0
- package/dist/src/commands/registry-publish.d.ts.map +1 -0
- package/dist/src/commands/registry-publish.js +161 -0
- package/dist/src/commands/registry-publish.js.map +1 -0
- package/dist/src/commands/registry.d.ts +146 -2
- package/dist/src/commands/registry.d.ts.map +1 -1
- package/dist/src/commands/registry.js +541 -85
- package/dist/src/commands/registry.js.map +1 -1
- package/dist/src/commands/secrets/index.d.ts.map +1 -1
- package/dist/src/commands/secrets/index.js +15 -1
- package/dist/src/commands/secrets/index.js.map +1 -1
- package/dist/src/commands/secrets/migrate-config.d.ts +24 -0
- package/dist/src/commands/secrets/migrate-config.d.ts.map +1 -0
- package/dist/src/commands/secrets/migrate-config.js +277 -0
- package/dist/src/commands/secrets/migrate-config.js.map +1 -0
- package/dist/src/commands/secrets/set.d.ts +1 -0
- package/dist/src/commands/secrets/set.d.ts.map +1 -1
- package/dist/src/commands/secrets/set.js +96 -2
- package/dist/src/commands/secrets/set.js.map +1 -1
- package/dist/src/commands/skills.d.ts +34 -0
- package/dist/src/commands/skills.d.ts.map +1 -0
- package/dist/src/commands/skills.js +207 -0
- package/dist/src/commands/skills.js.map +1 -0
- package/dist/src/commands/stack.d.ts.map +1 -1
- package/dist/src/commands/stack.js +361 -23
- package/dist/src/commands/stack.js.map +1 -1
- package/dist/src/commands/temporal.d.ts +15 -0
- package/dist/src/commands/temporal.d.ts.map +1 -0
- package/dist/src/commands/temporal.js +781 -0
- package/dist/src/commands/temporal.js.map +1 -0
- package/dist/src/commands/tenant.d.ts +56 -0
- package/dist/src/commands/tenant.d.ts.map +1 -0
- package/dist/src/commands/tenant.js +233 -0
- package/dist/src/commands/tenant.js.map +1 -0
- package/dist/src/commands/tunnel/index.d.ts +49 -3
- package/dist/src/commands/tunnel/index.d.ts.map +1 -1
- package/dist/src/commands/tunnel/index.js +331 -8
- package/dist/src/commands/tunnel/index.js.map +1 -1
- package/dist/src/commands/vcs/clone.d.ts +3 -0
- package/dist/src/commands/vcs/clone.d.ts.map +1 -0
- package/dist/src/commands/vcs/clone.js +20 -0
- package/dist/src/commands/vcs/clone.js.map +1 -0
- package/dist/src/commands/vcs/common.d.ts +21 -0
- package/dist/src/commands/vcs/common.d.ts.map +1 -0
- package/dist/src/commands/vcs/common.js +62 -0
- package/dist/src/commands/vcs/common.js.map +1 -0
- package/dist/src/commands/vcs/drafts.d.ts +13 -0
- package/dist/src/commands/vcs/drafts.d.ts.map +1 -0
- package/dist/src/commands/vcs/drafts.js +45 -0
- package/dist/src/commands/vcs/drafts.js.map +1 -0
- package/dist/src/commands/vcs/get.d.ts +8 -0
- package/dist/src/commands/vcs/get.d.ts.map +1 -0
- package/dist/src/commands/vcs/get.js +61 -0
- package/dist/src/commands/vcs/get.js.map +1 -0
- package/dist/src/commands/vcs/index.d.ts +3 -0
- package/dist/src/commands/vcs/index.d.ts.map +1 -0
- package/dist/src/commands/vcs/index.js +58 -0
- package/dist/src/commands/vcs/index.js.map +1 -0
- package/dist/src/commands/vcs/propose.d.ts +23 -0
- package/dist/src/commands/vcs/propose.d.ts.map +1 -0
- package/dist/src/commands/vcs/propose.js +94 -0
- package/dist/src/commands/vcs/propose.js.map +1 -0
- package/dist/src/commands/vcs/review.d.ts +15 -0
- package/dist/src/commands/vcs/review.d.ts.map +1 -0
- package/dist/src/commands/vcs/review.js +35 -0
- package/dist/src/commands/vcs/review.js.map +1 -0
- package/dist/src/commands/vcs-enrich.d.ts +15 -0
- package/dist/src/commands/vcs-enrich.d.ts.map +1 -0
- package/dist/src/commands/vcs-enrich.js +28 -0
- package/dist/src/commands/vcs-enrich.js.map +1 -0
- package/dist/src/commands/vpn/index.d.ts +24 -0
- package/dist/src/commands/vpn/index.d.ts.map +1 -0
- package/dist/src/commands/vpn/index.js +543 -0
- package/dist/src/commands/vpn/index.js.map +1 -0
- package/dist/src/commands/vpn/tunnel.d.ts +11 -0
- package/dist/src/commands/vpn/tunnel.d.ts.map +1 -0
- package/dist/src/commands/vpn/tunnel.js +188 -0
- package/dist/src/commands/vpn/tunnel.js.map +1 -0
- package/dist/src/commands/workflow.d.ts +24 -0
- package/dist/src/commands/workflow.d.ts.map +1 -0
- package/dist/src/commands/workflow.js +577 -0
- package/dist/src/commands/workflow.js.map +1 -0
- package/dist/src/docs/assemble.d.ts +217 -0
- package/dist/src/docs/assemble.d.ts.map +1 -0
- package/dist/src/docs/assemble.js +739 -0
- package/dist/src/docs/assemble.js.map +1 -0
- package/dist/src/docs/cli-reference.d.ts +93 -0
- package/dist/src/docs/cli-reference.d.ts.map +1 -0
- package/dist/src/docs/cli-reference.js +256 -0
- package/dist/src/docs/cli-reference.js.map +1 -0
- package/dist/src/docs/discover.d.ts +60 -0
- package/dist/src/docs/discover.d.ts.map +1 -0
- package/dist/src/docs/discover.js +233 -0
- package/dist/src/docs/discover.js.map +1 -0
- package/dist/src/docs/portal.d.ts +79 -0
- package/dist/src/docs/portal.d.ts.map +1 -0
- package/dist/src/docs/portal.js +242 -0
- package/dist/src/docs/portal.js.map +1 -0
- package/dist/src/docs/registry-docs.d.ts +43 -0
- package/dist/src/docs/registry-docs.d.ts.map +1 -0
- package/dist/src/docs/registry-docs.js +138 -0
- package/dist/src/docs/registry-docs.js.map +1 -0
- package/dist/src/docs/schema.d.ts +48 -0
- package/dist/src/docs/schema.d.ts.map +1 -0
- package/dist/src/docs/schema.js +96 -0
- package/dist/src/docs/schema.js.map +1 -0
- package/dist/src/docs/serve.d.ts +27 -0
- package/dist/src/docs/serve.d.ts.map +1 -0
- package/dist/src/docs/serve.js +102 -0
- package/dist/src/docs/serve.js.map +1 -0
- package/dist/src/docs/start.d.ts +80 -0
- package/dist/src/docs/start.d.ts.map +1 -0
- package/dist/src/docs/start.js +313 -0
- package/dist/src/docs/start.js.map +1 -0
- package/dist/src/eval/agent-eval.d.mts +14 -0
- package/dist/src/eval/agent-eval.d.mts.map +1 -0
- package/dist/src/eval/agent-eval.mjs +273 -0
- package/dist/src/eval/agent-eval.mjs.map +1 -0
- package/dist/src/index.js +624 -7
- package/dist/src/index.js.map +7 -1
- package/dist/src/program.d.ts +26 -0
- package/dist/src/program.d.ts.map +1 -0
- package/dist/src/program.js +76 -0
- package/dist/src/program.js.map +1 -0
- package/dist/src/utils/auth-preflight.d.ts +159 -0
- package/dist/src/utils/auth-preflight.d.ts.map +1 -0
- package/dist/src/utils/auth-preflight.js +298 -0
- package/dist/src/utils/auth-preflight.js.map +1 -0
- package/dist/src/utils/aws-auth.d.ts +181 -0
- package/dist/src/utils/aws-auth.d.ts.map +1 -0
- package/dist/src/utils/aws-auth.js +527 -0
- package/dist/src/utils/aws-auth.js.map +1 -0
- package/dist/src/utils/bastion.d.ts +1 -1
- package/dist/src/utils/bastion.d.ts.map +1 -1
- package/dist/src/utils/bastion.js +29 -8
- package/dist/src/utils/bastion.js.map +1 -1
- package/dist/src/utils/build-info.d.ts +33 -0
- package/dist/src/utils/build-info.d.ts.map +1 -0
- package/dist/src/utils/build-info.js +102 -0
- package/dist/src/utils/build-info.js.map +1 -0
- package/dist/src/utils/capture-history.d.ts +62 -0
- package/dist/src/utils/capture-history.d.ts.map +1 -0
- package/dist/src/utils/capture-history.js +94 -0
- package/dist/src/utils/capture-history.js.map +1 -0
- package/dist/src/utils/deploy-preflight.d.ts +52 -0
- package/dist/src/utils/deploy-preflight.d.ts.map +1 -0
- package/dist/src/utils/deploy-preflight.js +183 -0
- package/dist/src/utils/deploy-preflight.js.map +1 -0
- package/dist/src/utils/errors.d.ts +75 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +106 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/first-party-contexts.d.ts +40 -0
- package/dist/src/utils/first-party-contexts.d.ts.map +1 -0
- package/dist/src/utils/first-party-contexts.js +53 -0
- package/dist/src/utils/first-party-contexts.js.map +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/kubeconfig.d.ts +62 -0
- package/dist/src/utils/kubeconfig.d.ts.map +1 -0
- package/dist/src/utils/kubeconfig.js +118 -0
- package/dist/src/utils/kubeconfig.js.map +1 -0
- package/dist/src/utils/log.d.ts +27 -1
- package/dist/src/utils/log.d.ts.map +1 -1
- package/dist/src/utils/log.js +59 -5
- package/dist/src/utils/log.js.map +1 -1
- package/dist/src/utils/pid.d.ts +47 -0
- package/dist/src/utils/pid.d.ts.map +1 -0
- package/dist/src/utils/pid.js +83 -0
- package/dist/src/utils/pid.js.map +1 -0
- package/dist/src/utils/pulumi-run.d.ts +23 -0
- package/dist/src/utils/pulumi-run.d.ts.map +1 -0
- package/dist/src/utils/pulumi-run.js +112 -0
- package/dist/src/utils/pulumi-run.js.map +1 -0
- package/dist/src/utils/pulumi.d.ts +15 -0
- package/dist/src/utils/pulumi.d.ts.map +1 -1
- package/dist/src/utils/pulumi.js +35 -0
- package/dist/src/utils/pulumi.js.map +1 -1
- package/dist/src/utils/reachability.d.ts +29 -0
- package/dist/src/utils/reachability.d.ts.map +1 -0
- package/dist/src/utils/reachability.js +81 -0
- package/dist/src/utils/reachability.js.map +1 -0
- package/dist/src/utils/recover-conversation.d.ts +154 -0
- package/dist/src/utils/recover-conversation.d.ts.map +1 -0
- package/dist/src/utils/recover-conversation.js +314 -0
- package/dist/src/utils/recover-conversation.js.map +1 -0
- package/dist/src/utils/registry-broker.d.ts +148 -0
- package/dist/src/utils/registry-broker.d.ts.map +1 -0
- package/dist/src/utils/registry-broker.js +180 -0
- package/dist/src/utils/registry-broker.js.map +1 -0
- package/dist/src/utils/socks-forward.d.ts +40 -0
- package/dist/src/utils/socks-forward.d.ts.map +1 -0
- package/dist/src/utils/socks-forward.js +97 -0
- package/dist/src/utils/socks-forward.js.map +1 -0
- package/dist/src/utils/stack-flag.d.ts +23 -0
- package/dist/src/utils/stack-flag.d.ts.map +1 -0
- package/dist/src/utils/stack-flag.js +41 -0
- package/dist/src/utils/stack-flag.js.map +1 -0
- package/dist/src/utils/tailscale-targets.d.ts +52 -0
- package/dist/src/utils/tailscale-targets.d.ts.map +1 -0
- package/dist/src/utils/tailscale-targets.js +93 -0
- package/dist/src/utils/tailscale-targets.js.map +1 -0
- package/dist/src/utils/tailscale.d.ts +277 -0
- package/dist/src/utils/tailscale.d.ts.map +1 -0
- package/dist/src/utils/tailscale.js +1007 -0
- package/dist/src/utils/tailscale.js.map +1 -0
- package/dist/src/utils/temporal-auth.d.ts +43 -0
- package/dist/src/utils/temporal-auth.d.ts.map +1 -0
- package/dist/src/utils/temporal-auth.js +176 -0
- package/dist/src/utils/temporal-auth.js.map +1 -0
- package/dist/src/utils/temporal-codec.d.ts +101 -0
- package/dist/src/utils/temporal-codec.d.ts.map +1 -0
- package/dist/src/utils/temporal-codec.js +319 -0
- package/dist/src/utils/temporal-codec.js.map +1 -0
- package/dist/src/utils/tunnel-ownership.d.ts +130 -0
- package/dist/src/utils/tunnel-ownership.d.ts.map +1 -0
- package/dist/src/utils/tunnel-ownership.js +274 -0
- package/dist/src/utils/tunnel-ownership.js.map +1 -0
- package/dist/src/utils/vpn-join.d.ts +32 -0
- package/dist/src/utils/vpn-join.d.ts.map +1 -0
- package/dist/src/utils/vpn-join.js +62 -0
- package/dist/src/utils/vpn-join.js.map +1 -0
- package/dist/src/utils/vpn.d.ts +62 -0
- package/dist/src/utils/vpn.d.ts.map +1 -0
- package/dist/src/utils/vpn.js +183 -0
- package/dist/src/utils/vpn.js.map +1 -0
- package/dist/src/utils/workflow-fingerprint.d.ts +49 -0
- package/dist/src/utils/workflow-fingerprint.d.ts.map +1 -0
- package/dist/src/utils/workflow-fingerprint.js +135 -0
- package/dist/src/utils/workflow-fingerprint.js.map +1 -0
- package/dist/src/utils/worktree-identity.d.ts +86 -0
- package/dist/src/utils/worktree-identity.d.ts.map +1 -0
- package/dist/src/utils/worktree-identity.js +164 -0
- package/dist/src/utils/worktree-identity.js.map +1 -0
- package/fragments/agents/AGENTS.md.hbs +92 -0
- package/fragments/agents/CLAUDE.md.hbs +8 -0
- package/fragments/base/Pulumi.dev.yaml.hbs +10 -0
- package/fragments/base/Pulumi.yaml.hbs +9 -0
- package/fragments/base/index.ts.hbs +107 -0
- package/fragments/base/package.json.hbs +22 -0
- package/{templates/api-web-db/api → fragments/base}/tsconfig.json +3 -4
- package/fragments/bucket/api/src/storage.ts.hbs +81 -0
- package/fragments/database/api/src/db.ts.hbs +23 -0
- package/fragments/database/prisma/schema.prisma.hbs +18 -0
- package/{templates/api-web-db → fragments/service}/api/.dockerignore +2 -0
- package/fragments/service/api/package.json.hbs +40 -0
- package/fragments/service/api/src/index.ts.hbs +58 -0
- package/{templates/api-web-db → fragments/service/api}/tsconfig.json +5 -3
- package/fragments/temporal/worker/.dockerignore +4 -0
- package/fragments/temporal/worker/Dockerfile +15 -0
- package/{templates/temporal-api-worker → fragments/temporal}/worker/package.json.hbs +3 -2
- package/fragments/temporal/worker/src/activities.ts.hbs +14 -0
- package/fragments/temporal/worker/src/worker.ts.hbs +27 -0
- package/fragments/temporal/worker/src/workflows.ts.hbs +24 -0
- package/fragments/temporal/worker/tsconfig.json +13 -0
- package/package.json +36 -22
- package/skills/core/SKILL.md +365 -0
- package/skills/pull-remote-agent-context/SKILL.md +194 -0
- package/stack/docker-compose.hub.yml +134 -0
- package/stack/docker-compose.yml +447 -0
- package/stack/hub/Dockerfile.api +18 -0
- package/stack/hub/Dockerfile.auth +10 -0
- package/stack/hub/Dockerfile.ui +10 -0
- package/stack/init/01-databases.sql +12 -0
- package/stack/observability/blackbox.yml +20 -0
- package/stack/observability/otel-collector.yaml +73 -0
- package/stack/observability/prometheus.yml +36 -0
- package/stack/observability/tempo.yaml +25 -0
- package/stack/temporal/local.yaml +44 -0
- package/templates/api-auth/AGENTS.md.hbs +16 -0
- package/templates/api-auth/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-auth/Pulumi.yaml.hbs +8 -0
- package/templates/api-auth/README.md.hbs +67 -0
- package/templates/api-auth/api/package.json.hbs +28 -0
- package/templates/api-auth/api/src/index.ts.hbs +96 -0
- package/templates/api-auth/api/src/schema.ts.hbs +35 -0
- package/templates/api-auth/api/src/seed-authz.ts.hbs +48 -0
- package/templates/api-auth/api/src/spicedb-http-provider.ts.hbs +89 -0
- package/templates/api-auth/index.ts.hbs +65 -0
- package/templates/api-auth/package.json.hbs +20 -0
- package/templates/api-auth/skills/develop/SKILL.md.hbs +32 -0
- package/templates/api-role-gating/AGENTS.md.hbs +20 -0
- package/templates/api-role-gating/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-role-gating/Pulumi.yaml.hbs +8 -0
- package/templates/api-role-gating/README.md.hbs +64 -0
- package/templates/api-role-gating/api/Dockerfile +17 -0
- package/templates/api-role-gating/api/package.json.hbs +28 -0
- package/templates/api-role-gating/api/src/authn.ts.hbs +29 -0
- package/templates/api-role-gating/api/src/authz.ts.hbs +12 -0
- package/templates/api-role-gating/api/src/main.ts.hbs +58 -0
- package/templates/api-role-gating/api/src/schema.ts.hbs +22 -0
- package/templates/api-role-gating/api/tsconfig.json +13 -0
- package/templates/api-role-gating/index.ts.hbs +107 -0
- package/templates/api-role-gating/package.json.hbs +21 -0
- package/templates/api-role-gating/skills/develop/SKILL.md.hbs +60 -0
- package/templates/api-role-gating/tsconfig.json +10 -0
- package/templates/apps-repo/README.md.hbs +24 -0
- package/templates/apps-repo/gitignore +41 -0
- package/templates/apps-repo/npmrc.hbs +7 -0
- package/templates/apps-repo/package.json.hbs +15 -0
- package/templates/apps-repo/pnpm-workspace.yaml +3 -0
- package/templates/apps-repo/tsconfig.json +18 -0
- package/templates/external-service/AGENTS.md.hbs +20 -0
- package/templates/external-service/Pulumi.dev.yaml.hbs +8 -0
- package/templates/external-service/Pulumi.yaml.hbs +8 -0
- package/templates/external-service/README.md.hbs +56 -0
- package/templates/external-service/api/Dockerfile +15 -0
- package/templates/external-service/api/package.json.hbs +25 -0
- package/templates/external-service/api/src/index.ts.hbs +81 -0
- package/templates/external-service/index.ts.hbs +82 -0
- package/templates/external-service/mocks/vendorpay/package.json.hbs +9 -0
- package/templates/external-service/mocks/vendorpay/server.mjs.hbs +61 -0
- package/templates/external-service/package.json.hbs +34 -0
- package/templates/external-service/skills/develop/SKILL.md.hbs +55 -0
- package/templates/external-service/tsconfig.json +10 -0
- package/templates/platform-repo/AGENTS.md.hbs +18 -0
- package/templates/platform-repo/README.md.hbs +38 -0
- package/templates/platform-repo/core/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/core/Pulumi.{{tenant}}-{{env}}.yaml.hbs +57 -0
- package/templates/platform-repo/core/index.ts +62 -0
- package/templates/platform-repo/core/package.json.hbs +22 -0
- package/templates/platform-repo/core/tsconfig.json +8 -0
- package/templates/platform-repo/package.json.hbs +15 -0
- package/templates/platform-repo/platform/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/platform/Pulumi.{{tenant}}-{{env}}.yaml.hbs +59 -0
- package/templates/platform-repo/platform/index.ts +95 -0
- package/templates/platform-repo/platform/package.json.hbs +26 -0
- package/templates/platform-repo/platform/tsconfig.json +8 -0
- package/templates/platform-repo/pnpm-workspace.yaml +3 -0
- package/templates/workflow/AGENTS.md.hbs +15 -0
- package/templates/workflow/Pulumi.dev.yaml.hbs +8 -0
- package/templates/workflow/Pulumi.yaml.hbs +8 -0
- package/templates/workflow/README.md.hbs +45 -0
- package/templates/workflow/api/.dockerignore +4 -0
- package/templates/workflow/api/Dockerfile +15 -0
- package/templates/{temporal-api-worker → workflow}/api/package.json.hbs +8 -6
- package/templates/workflow/api/src/index.ts.hbs +130 -0
- package/templates/workflow/api/tsconfig.json +14 -0
- package/templates/workflow/index.ts.hbs +67 -0
- package/templates/workflow/package.json.hbs +20 -0
- package/templates/workflow/skills/develop/SKILL.md.hbs +32 -0
- package/templates/workflow/tsconfig.json +10 -0
- package/templates/workflow/worker/.dockerignore +4 -0
- package/templates/workflow/worker/Dockerfile +13 -0
- package/templates/workflow/worker/package.json.hbs +25 -0
- package/templates/workflow/worker/src/worker.ts.hbs +24 -0
- package/templates/workflow/worker/tsconfig.json +14 -0
- package/dist/src/commands/devbox.d.ts +0 -22
- package/dist/src/commands/devbox.d.ts.map +0 -1
- package/dist/src/commands/devbox.js +0 -463
- package/dist/src/commands/devbox.js.map +0 -1
- package/templates/api-web-db/api/Dockerfile +0 -16
- package/templates/api-web-db/api/package.json.hbs +0 -21
- package/templates/api-web-db/api/src/index.ts.hbs +0 -123
- package/templates/api-web-db/package.json.hbs +0 -27
- package/templates/api-web-db/sst.config.ts.hbs +0 -151
- package/templates/api-web-db/web/.dockerignore +0 -3
- package/templates/api-web-db/web/Dockerfile +0 -17
- package/templates/api-web-db/web/app/lib/db.server.ts +0 -36
- package/templates/api-web-db/web/app/root.tsx +0 -29
- package/templates/api-web-db/web/app/routes/home.tsx.hbs +0 -114
- package/templates/api-web-db/web/app/routes.ts +0 -3
- package/templates/api-web-db/web/package.json.hbs +0 -30
- package/templates/api-web-db/web/prisma/schema.prisma +0 -25
- package/templates/api-web-db/web/prisma.config.ts +0 -18
- package/templates/api-web-db/web/react-router.config.ts +0 -5
- package/templates/api-web-db/web/tsconfig.json +0 -19
- package/templates/api-web-db/web/vite.config.ts +0 -9
- package/templates/temporal-api-worker/README.md.hbs +0 -133
- package/templates/temporal-api-worker/api/src/index.ts.hbs +0 -145
- package/templates/temporal-api-worker/package.json.hbs +0 -29
- package/templates/temporal-api-worker/sst.config.ts.hbs +0 -161
- package/templates/temporal-api-worker/worker/Dockerfile +0 -11
- package/templates/temporal-api-worker/worker/src/bundle-workflows.ts +0 -38
- package/templates/temporal-api-worker/worker/src/worker.ts.hbs +0 -93
- /package/templates/{temporal-api-worker → api-auth}/api/.dockerignore +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/Dockerfile +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → api-auth}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker/worker → api-role-gating/api}/.dockerignore +0 -0
- /package/templates/{temporal-api-worker/worker → external-service/api}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → workflow}/api/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/activities.ts.hbs +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/workflows.ts.hbs +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI provenance for `mesh --version` (MESH-2479).
|
|
3
|
+
*
|
|
4
|
+
* A stale shim / stale global install is invisible when --version prints only
|
|
5
|
+
* the package version — two different checkouts (or a source tree vs a
|
|
6
|
+
* published dist) can share "0.5.1". This resolves WHERE the running CLI
|
|
7
|
+
* came from (TypeScript source vs published dist) plus the commit/build date,
|
|
8
|
+
* so "am I running the code I think I am?" is answerable from one command.
|
|
9
|
+
*
|
|
10
|
+
* Source layout: bin/mesh.ts runs under tsx from the repo — commit/date come
|
|
11
|
+
* from git at call time. Dist layout: the published package ships
|
|
12
|
+
* dist/build-info.json written by scripts/build-for-publish.ts.
|
|
13
|
+
*/
|
|
14
|
+
export interface CliRuntimeInfo {
|
|
15
|
+
version: string;
|
|
16
|
+
mode: "source" | "dist";
|
|
17
|
+
commit?: string;
|
|
18
|
+
builtAt?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Pure: a module path under a `dist/` segment is the published build. */
|
|
21
|
+
export declare function detectRuntimeMode(modulePath: string): "source" | "dist";
|
|
22
|
+
/** Pure: one-line version string with provenance, e.g.
|
|
23
|
+
* `0.5.1 (source @ abc1234 2026-07-30)` or
|
|
24
|
+
* `0.5.1 (published build 2026-07-28, commit abc1234)`. */
|
|
25
|
+
export declare function formatVersionLine(info: CliRuntimeInfo): string;
|
|
26
|
+
/** Resolve the running CLI's version + provenance. Never throws.
|
|
27
|
+
* `vcs: false` skips the git spawns in source mode (version + mode only) —
|
|
28
|
+
* commit/date cost two synchronous `git` runs, too slow to pay on every
|
|
29
|
+
* invocation when nothing will print them. */
|
|
30
|
+
export declare function resolveCliRuntime(opts?: {
|
|
31
|
+
vcs?: boolean;
|
|
32
|
+
}): CliRuntimeInfo;
|
|
33
|
+
//# sourceMappingURL=build-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-info.d.ts","sourceRoot":"","sources":["../../../src/utils/build-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAEvE;AAED;;2DAE2D;AAC3D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAS9D;AAmBD;;;8CAG8C;AAC9C,wBAAgB,iBAAiB,CAAC,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,cAAc,CA8C1E"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI provenance for `mesh --version` (MESH-2479).
|
|
3
|
+
*
|
|
4
|
+
* A stale shim / stale global install is invisible when --version prints only
|
|
5
|
+
* the package version — two different checkouts (or a source tree vs a
|
|
6
|
+
* published dist) can share "0.5.1". This resolves WHERE the running CLI
|
|
7
|
+
* came from (TypeScript source vs published dist) plus the commit/build date,
|
|
8
|
+
* so "am I running the code I think I am?" is answerable from one command.
|
|
9
|
+
*
|
|
10
|
+
* Source layout: bin/mesh.ts runs under tsx from the repo — commit/date come
|
|
11
|
+
* from git at call time. Dist layout: the published package ships
|
|
12
|
+
* dist/build-info.json written by scripts/build-for-publish.ts.
|
|
13
|
+
*/
|
|
14
|
+
import { execFileSync } from "child_process";
|
|
15
|
+
import * as fs from "fs";
|
|
16
|
+
import * as path from "path";
|
|
17
|
+
import { fileURLToPath } from "url";
|
|
18
|
+
/** Pure: a module path under a `dist/` segment is the published build. */
|
|
19
|
+
export function detectRuntimeMode(modulePath) {
|
|
20
|
+
return modulePath.split(/[\\/]/).includes("dist") ? "dist" : "source";
|
|
21
|
+
}
|
|
22
|
+
/** Pure: one-line version string with provenance, e.g.
|
|
23
|
+
* `0.5.1 (source @ abc1234 2026-07-30)` or
|
|
24
|
+
* `0.5.1 (published build 2026-07-28, commit abc1234)`. */
|
|
25
|
+
export function formatVersionLine(info) {
|
|
26
|
+
if (info.mode === "source") {
|
|
27
|
+
const at = [info.commit, info.builtAt].filter(Boolean).join(" ");
|
|
28
|
+
return `${info.version} (source${at ? ` @ ${at}` : ""})`;
|
|
29
|
+
}
|
|
30
|
+
const built = info.builtAt ? ` ${info.builtAt.slice(0, 10)}` : "";
|
|
31
|
+
const commit = info.commit ? `, commit ${info.commit}` : "";
|
|
32
|
+
const detail = built || commit ? `${built}${commit}` : " — build metadata unavailable";
|
|
33
|
+
return `${info.version} (published build${detail})`;
|
|
34
|
+
}
|
|
35
|
+
/** Walk up from `startDir` to the @mesh-tech/mesh-cli package root. */
|
|
36
|
+
function findCliPackageRoot(startDir) {
|
|
37
|
+
let dir = startDir;
|
|
38
|
+
for (let i = 0; i < 8; i++) {
|
|
39
|
+
try {
|
|
40
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf-8"));
|
|
41
|
+
if (pkg.name === "@mesh-tech/mesh-cli")
|
|
42
|
+
return dir;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// keep walking
|
|
46
|
+
}
|
|
47
|
+
const parent = path.dirname(dir);
|
|
48
|
+
if (parent === dir)
|
|
49
|
+
break;
|
|
50
|
+
dir = parent;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
/** Resolve the running CLI's version + provenance. Never throws.
|
|
55
|
+
* `vcs: false` skips the git spawns in source mode (version + mode only) —
|
|
56
|
+
* commit/date cost two synchronous `git` runs, too slow to pay on every
|
|
57
|
+
* invocation when nothing will print them. */
|
|
58
|
+
export function resolveCliRuntime(opts) {
|
|
59
|
+
const vcs = opts?.vcs ?? true;
|
|
60
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
61
|
+
const mode = detectRuntimeMode(here);
|
|
62
|
+
const root = findCliPackageRoot(here);
|
|
63
|
+
let version = "0.0.0";
|
|
64
|
+
if (root) {
|
|
65
|
+
try {
|
|
66
|
+
version = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf-8")).version ?? version;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
// fall through with the placeholder
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const info = { version, mode };
|
|
73
|
+
if (!root)
|
|
74
|
+
return info;
|
|
75
|
+
if (mode === "dist") {
|
|
76
|
+
try {
|
|
77
|
+
const meta = JSON.parse(fs.readFileSync(path.join(root, "dist", "build-info.json"), "utf-8"));
|
|
78
|
+
info.commit = meta.commit;
|
|
79
|
+
info.builtAt = meta.builtAt;
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// pre-MESH-2479 publishes have no build-info.json
|
|
83
|
+
}
|
|
84
|
+
return info;
|
|
85
|
+
}
|
|
86
|
+
if (!vcs)
|
|
87
|
+
return info;
|
|
88
|
+
try {
|
|
89
|
+
const git = (args) => execFileSync("git", args, {
|
|
90
|
+
cwd: root,
|
|
91
|
+
encoding: "utf-8",
|
|
92
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
93
|
+
}).trim();
|
|
94
|
+
info.commit = git(["rev-parse", "--short", "HEAD"]);
|
|
95
|
+
info.builtAt = git(["log", "-1", "--format=%cs"]);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// not a git checkout (e.g. exported source) — version + mode still print
|
|
99
|
+
}
|
|
100
|
+
return info;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=build-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-info.js","sourceRoot":"","sources":["../../../src/utils/build-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AASpC,0EAA0E;AAC1E,MAAM,UAAU,iBAAiB,CAAC,UAAkB;IAClD,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;AACxE,CAAC;AAED;;2DAE2D;AAC3D,MAAM,UAAU,iBAAiB,CAAC,IAAoB;IACpD,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,GAAG,IAAI,CAAC,OAAO,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;IAC3D,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CA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AAC,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;IAC3E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a fetched Temporal workflow history into the replay-fixture JSON
|
|
3
|
+
* shape — the same canonical proto3-JSON `{ events: [...] }` that
|
|
4
|
+
* `@mesh-tech/agent-sdk`'s `replay/history-io.ts` `historyToFixture` produces,
|
|
5
|
+
* so a captured file replays via `replayFixture` (which rehydrates it with
|
|
6
|
+
* `historyFromJSON`) for LOCAL debugging. Captured PRODUCTION histories are
|
|
7
|
+
* never committed (they contain real, decrypted customer/conversation data —
|
|
8
|
+
* see the CLI's do-not-commit warning); only synthetic goldens live in
|
|
9
|
+
* `packages/agent-sdk/src/replay/fixtures/`.
|
|
10
|
+
*
|
|
11
|
+
* We reuse `@temporalio/common`'s `historyToJSON` directly (the exact helper
|
|
12
|
+
* agent-sdk's history-io uses) rather than importing `@mesh-tech/agent-sdk`:
|
|
13
|
+
* the CLI has no reason to pull in the whole worker/replay stack, and keeping
|
|
14
|
+
* the dependency pointed at the shared Temporal library guarantees the output
|
|
15
|
+
* round-trips through `historyFromJSON`.
|
|
16
|
+
*
|
|
17
|
+
* The one thing a *real* history needs that a synthetic golden fixture doesn't:
|
|
18
|
+
* its payloads are ENCRYPTED (the worker's AES-GCM codec). `historyToJSON`
|
|
19
|
+
* would just base64 the ciphertext, which `replayFixture`'s plaintext converter
|
|
20
|
+
* can't decode. So before serializing we walk every Payload in the history and
|
|
21
|
+
* replace each encrypted one with its decrypted inner Payload — yielding a
|
|
22
|
+
* plaintext fixture identical in shape to a codec-free golden capture.
|
|
23
|
+
*/
|
|
24
|
+
import type { RawPayloadDecrypter } from "./temporal-codec.js";
|
|
25
|
+
/**
|
|
26
|
+
* Walk an arbitrary history-event tree and decrypt every encrypted Payload in
|
|
27
|
+
* place, using `decrypt` to turn an encrypted Payload into its plaintext inner
|
|
28
|
+
* Payload. Payloads the decrypter reports as non-encrypted (`null`) are left
|
|
29
|
+
* untouched. Returns the number of payloads that were decrypted.
|
|
30
|
+
*
|
|
31
|
+
* The `{ metadata, data }` heuristic mirrors Temporal's own `fixPayloads` in
|
|
32
|
+
* `@temporalio/common/lib/proto-utils`, so it identifies exactly the nodes
|
|
33
|
+
* proto3-JSON treats as payloads. Once a node is a Payload we do NOT recurse
|
|
34
|
+
* into it (its metadata values are bytes, not nested payloads).
|
|
35
|
+
*/
|
|
36
|
+
export declare function decryptHistoryPayloads(node: unknown, decrypt: RawPayloadDecrypter): Promise<number>;
|
|
37
|
+
/** Result of {@link serializeHistoryToFixture}. */
|
|
38
|
+
export interface CaptureResult {
|
|
39
|
+
/** The parsed proto3-JSON fixture object (drop-in for `replayFixture`). */
|
|
40
|
+
fixture: unknown;
|
|
41
|
+
/** Total events serialized. */
|
|
42
|
+
eventCount: number;
|
|
43
|
+
/** How many encrypted payloads were decrypted (0 when no decrypter given). */
|
|
44
|
+
decryptedPayloads: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Turn an ordered list of raw history events into a replay fixture object.
|
|
48
|
+
*
|
|
49
|
+
* @param events - Raw proto-decoded history events, in order (as yielded by the
|
|
50
|
+
* CLI's `iterHistoryEvents` over `getWorkflowExecutionHistory`).
|
|
51
|
+
* @param decrypter - Optional raw payload decrypter. When provided, every
|
|
52
|
+
* encrypted payload in the history is decrypted in place before serialization
|
|
53
|
+
* so the fixture is replayable with a plaintext converter. When omitted, the
|
|
54
|
+
* payloads are serialized as-is (ciphertext, base64-encoded).
|
|
55
|
+
*
|
|
56
|
+
* `historyToJSON` runs its input through protobuf `History.fromObject`, so a
|
|
57
|
+
* plain `{ events }` object of raw events is accepted directly; it returns a
|
|
58
|
+
* proto3-JSON *string* which we parse back to a structured object (the same
|
|
59
|
+
* `JSON.parse(historyToJSON(...))` round-trip `historyToFixture` performs).
|
|
60
|
+
*/
|
|
61
|
+
export declare function serializeHistoryToFixture(events: unknown[], decrypter?: RawPayloadDecrypter): Promise<CaptureResult>;
|
|
62
|
+
//# sourceMappingURL=capture-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-history.d.ts","sourceRoot":"","sources":["../../../src/utils/capture-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,OAAO,KAAK,EAAc,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAqB3E;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,OAAO,EACb,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAqBjB;AAED,mDAAmD;AACnD,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,OAAO,EAAE,EACjB,SAAS,CAAC,EAAE,mBAAmB,GAC9B,OAAO,CAAC,aAAa,CAAC,CAUxB"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize a fetched Temporal workflow history into the replay-fixture JSON
|
|
3
|
+
* shape — the same canonical proto3-JSON `{ events: [...] }` that
|
|
4
|
+
* `@mesh-tech/agent-sdk`'s `replay/history-io.ts` `historyToFixture` produces,
|
|
5
|
+
* so a captured file replays via `replayFixture` (which rehydrates it with
|
|
6
|
+
* `historyFromJSON`) for LOCAL debugging. Captured PRODUCTION histories are
|
|
7
|
+
* never committed (they contain real, decrypted customer/conversation data —
|
|
8
|
+
* see the CLI's do-not-commit warning); only synthetic goldens live in
|
|
9
|
+
* `packages/agent-sdk/src/replay/fixtures/`.
|
|
10
|
+
*
|
|
11
|
+
* We reuse `@temporalio/common`'s `historyToJSON` directly (the exact helper
|
|
12
|
+
* agent-sdk's history-io uses) rather than importing `@mesh-tech/agent-sdk`:
|
|
13
|
+
* the CLI has no reason to pull in the whole worker/replay stack, and keeping
|
|
14
|
+
* the dependency pointed at the shared Temporal library guarantees the output
|
|
15
|
+
* round-trips through `historyFromJSON`.
|
|
16
|
+
*
|
|
17
|
+
* The one thing a *real* history needs that a synthetic golden fixture doesn't:
|
|
18
|
+
* its payloads are ENCRYPTED (the worker's AES-GCM codec). `historyToJSON`
|
|
19
|
+
* would just base64 the ciphertext, which `replayFixture`'s plaintext converter
|
|
20
|
+
* can't decode. So before serializing we walk every Payload in the history and
|
|
21
|
+
* replace each encrypted one with its decrypted inner Payload — yielding a
|
|
22
|
+
* plaintext fixture identical in shape to a codec-free golden capture.
|
|
23
|
+
*/
|
|
24
|
+
// Explicit `.js` — this package publishes native ESM, so the compiled dist
|
|
25
|
+
// must use a fully-specified specifier or Node throws ERR_MODULE_NOT_FOUND at
|
|
26
|
+
// runtime (MESH-2262). tsx tolerates the extensionless form; node does not.
|
|
27
|
+
import { historyToJSON } from "@temporalio/common/lib/proto-utils.js";
|
|
28
|
+
function isPayload(value) {
|
|
29
|
+
return (value != null &&
|
|
30
|
+
typeof value === "object" &&
|
|
31
|
+
"metadata" in value &&
|
|
32
|
+
"data" in value);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Walk an arbitrary history-event tree and decrypt every encrypted Payload in
|
|
36
|
+
* place, using `decrypt` to turn an encrypted Payload into its plaintext inner
|
|
37
|
+
* Payload. Payloads the decrypter reports as non-encrypted (`null`) are left
|
|
38
|
+
* untouched. Returns the number of payloads that were decrypted.
|
|
39
|
+
*
|
|
40
|
+
* The `{ metadata, data }` heuristic mirrors Temporal's own `fixPayloads` in
|
|
41
|
+
* `@temporalio/common/lib/proto-utils`, so it identifies exactly the nodes
|
|
42
|
+
* proto3-JSON treats as payloads. Once a node is a Payload we do NOT recurse
|
|
43
|
+
* into it (its metadata values are bytes, not nested payloads).
|
|
44
|
+
*/
|
|
45
|
+
export async function decryptHistoryPayloads(node, decrypt) {
|
|
46
|
+
if (node == null || typeof node !== "object")
|
|
47
|
+
return 0;
|
|
48
|
+
if (isPayload(node)) {
|
|
49
|
+
const inner = await decrypt(node);
|
|
50
|
+
if (inner === null)
|
|
51
|
+
return 0; // not encrypted — leave as-is
|
|
52
|
+
// Replace the encrypted envelope with the decrypted inner payload's bytes.
|
|
53
|
+
node.metadata = inner.metadata ?? {};
|
|
54
|
+
node.data = inner.data ?? new Uint8Array(0);
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
let count = 0;
|
|
58
|
+
if (Array.isArray(node)) {
|
|
59
|
+
for (const item of node)
|
|
60
|
+
count += await decryptHistoryPayloads(item, decrypt);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
for (const value of Object.values(node)) {
|
|
64
|
+
count += await decryptHistoryPayloads(value, decrypt);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return count;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Turn an ordered list of raw history events into a replay fixture object.
|
|
71
|
+
*
|
|
72
|
+
* @param events - Raw proto-decoded history events, in order (as yielded by the
|
|
73
|
+
* CLI's `iterHistoryEvents` over `getWorkflowExecutionHistory`).
|
|
74
|
+
* @param decrypter - Optional raw payload decrypter. When provided, every
|
|
75
|
+
* encrypted payload in the history is decrypted in place before serialization
|
|
76
|
+
* so the fixture is replayable with a plaintext converter. When omitted, the
|
|
77
|
+
* payloads are serialized as-is (ciphertext, base64-encoded).
|
|
78
|
+
*
|
|
79
|
+
* `historyToJSON` runs its input through protobuf `History.fromObject`, so a
|
|
80
|
+
* plain `{ events }` object of raw events is accepted directly; it returns a
|
|
81
|
+
* proto3-JSON *string* which we parse back to a structured object (the same
|
|
82
|
+
* `JSON.parse(historyToJSON(...))` round-trip `historyToFixture` performs).
|
|
83
|
+
*/
|
|
84
|
+
export async function serializeHistoryToFixture(events, decrypter) {
|
|
85
|
+
let decryptedPayloads = 0;
|
|
86
|
+
if (decrypter) {
|
|
87
|
+
for (const event of events) {
|
|
88
|
+
decryptedPayloads += await decryptHistoryPayloads(event, decrypter);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const fixture = JSON.parse(historyToJSON({ events }));
|
|
92
|
+
return { fixture, eventCount: events.length, decryptedPayloads };
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=capture-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-history.js","sourceRoot":"","sources":["../../../src/utils/capture-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,2EAA2E;AAC3E,8EAA8E;AAC9E,4EAA4E;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AActE,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,CACL,KAAK,IAAI,IAAI;QACb,OAAO,KAAK,KAAK,QAAQ;QACzB,UAAU,IAAI,KAAK;QACnB,MAAM,IAAI,KAAK,CAChB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,IAAa,EACb,OAA4B;IAE5B,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IAEvD,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,IAAkB,CAAC,CAAC;QAChD,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,CAAC,CAAC,CAAC,8BAA8B;QAC5D,2EAA2E;QAC3E,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
name: string;
|
|
4
|
+
/** Version the lockfile says should be installed. */
|
|
5
|
+
expected: string;
|
|
6
|
+
/** Version actually resolvable in node_modules, or null if not installed. */
|
|
7
|
+
installed: string | null;
|
|
8
|
+
}
|
|
9
|
+
/** pulumi ops that EVALUATE the program (a stale install can produce a wrong plan). */
|
|
10
|
+
export declare const PROGRAM_EVAL_OPS: Set<string>;
|
|
11
|
+
/** Env escape hatch — set truthy to skip the preflight (e.g. deliberate local link testing). */
|
|
12
|
+
export declare const SKIP_ENV = "MESH_SKIP_DEPLOY_PREFLIGHT";
|
|
13
|
+
/**
|
|
14
|
+
* A lockfile `version:` is checkable only when it's a concrete published version.
|
|
15
|
+
* `link:…`/`file:…` (dev-link pnpmfile, local tarballs) point at live source and
|
|
16
|
+
* are never stale; anything not starting with a digit isn't a comparable version.
|
|
17
|
+
* Peer/patch suffixes (`1.0.1(react@18)`) are stripped to the bare version.
|
|
18
|
+
*/
|
|
19
|
+
export declare function normalizeLockVersion(raw: unknown): string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Pure: extract the gated (`@mesh-tech/*`), concretely-versioned deps for one
|
|
22
|
+
* importer of a parsed pnpm-lock document → `{ name: expectedVersion }`.
|
|
23
|
+
*
|
|
24
|
+
* Handles the pnpm v9 shape (`{ specifier, version }` per dep) and the older flat
|
|
25
|
+
* shape (`name: "1.0.1"`). Unknown importer → `{}` (nothing checkable).
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractImporterMeshVersions(lockDoc: unknown, importerRel: string): Record<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* Pure: diff the lockfile's expected versions against the installed ones. A dep
|
|
30
|
+
* is a mismatch when the installed version differs (or it isn't installed).
|
|
31
|
+
*/
|
|
32
|
+
export declare function diffLockVsInstalled(expected: Record<string, string>, installed: Record<string, string | null>): DepMismatch[];
|
|
33
|
+
/** Walk up from `startDir` to the nearest directory containing a `pnpm-lock.yaml`. */
|
|
34
|
+
export declare function findPnpmLock(startDir: string): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Check that the `@mesh-tech/*` deps installed in `appRoot`'s `node_modules` match
|
|
37
|
+
* what the pnpm lockfile says. Returns the list of mismatches (empty = fresh), or
|
|
38
|
+
* `null` when the check does not apply (no lockfile — not a pnpm repo, or the
|
|
39
|
+
* monorepo running without one). IO wrapper around the pure helpers above.
|
|
40
|
+
*/
|
|
41
|
+
export declare function checkDeployDepsFresh(appRoot: string): DepMismatch[] | null;
|
|
42
|
+
/** Human-readable stale-deps report (mirrors the stale-dist detector's style). */
|
|
43
|
+
export declare function formatStaleDepsError(mismatches: DepMismatch[]): string;
|
|
44
|
+
/**
|
|
45
|
+
* Gate a `mesh deploy` invocation: if `op` evaluates the pulumi program and the
|
|
46
|
+
* deploy repo's `node_modules` is stale vs the lockfile, print the fix and exit
|
|
47
|
+
* non-zero BEFORE pulumi runs. No-op for non-evaluating ops, a fresh install, a
|
|
48
|
+
* non-pnpm repo, or when the skip env is set. Kept side-effecting (log + exit) so
|
|
49
|
+
* `deploy.ts` stays a thin wiring layer; the decision logic is pure above.
|
|
50
|
+
*/
|
|
51
|
+
export declare function assertDeployDepsFresh(appRoot: string, op: string): void;
|
|
52
|
+
//# sourceMappingURL=deploy-preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-preflight.d.ts","sourceRoot":"","sources":["../../../src/utils/deploy-preflight.ts"],"names":[],"mappings":"AAyBA,gFAAgF;AAChF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,6EAA6E;IAC7E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAKD,uFAAuF;AACvF,eAAO,MAAM,gBAAgB,aAA6D,CAAC;AAE3F,gGAAgG;AAChG,eAAO,MAAM,QAAQ,+BAA+B,CAAC;AAMrD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAIhE;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,GAClB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBxB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GACvC,WAAW,EAAE,CAOf;AAED,sFAAsF;AACtF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS5D;AAwBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,IAAI,CAqB1E;AAED,kFAAkF;AAClF,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,WAAW,EAAE,GAAG,MAAM,CAqBtE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAOvE"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deploy preflight — guard `mesh deploy` (pulumi up/preview/destroy/refresh) in a
|
|
3
|
+
* DEPLOY repo against a stale `node_modules` (MESH-2266).
|
|
4
|
+
*
|
|
5
|
+
* The hazard: a teammate pulls a `@mesh-tech/*` version bump (package.json +
|
|
6
|
+
* pnpm-lock.yaml move together in the commit) but forgets `pnpm install`, so
|
|
7
|
+
* `node_modules` still links the OLD version. The pulumi program then evaluates
|
|
8
|
+
* OLD component code and produces a plan that DELETES resources the new code would
|
|
9
|
+
* keep — the exact incident that showed `VpnJoinBroker` (+~40 resources) as a
|
|
10
|
+
* delete on mesh-dev when node_modules lagged the 1.0.1 bump. This is the same
|
|
11
|
+
* stale-artifact class as the monorepo stale-dist detector (MESH-2019) and the
|
|
12
|
+
* canonical CLI (MESH-2261), one layer up with higher stakes.
|
|
13
|
+
*
|
|
14
|
+
* The check is cheap and precise: compare each `@mesh-tech/*` version the LOCKFILE
|
|
15
|
+
* says should be installed against what is ACTUALLY installed in `node_modules`.
|
|
16
|
+
* A mismatch means `pnpm install` hasn't run since the lockfile changed. We only
|
|
17
|
+
* gate program-EVALUATING ops (a stale install can't corrupt `whoami`/`stack
|
|
18
|
+
* output`), and source-linked deps (`link:`/`file:`/dev-link pnpmfile) are skipped
|
|
19
|
+
* — they are intentionally pointed at live source and never "stale".
|
|
20
|
+
*/
|
|
21
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
22
|
+
import { dirname, join, relative } from 'node:path';
|
|
23
|
+
import { parse as parseYaml } from 'yaml';
|
|
24
|
+
import { logWarn } from './log.js';
|
|
25
|
+
/** Package-name prefixes whose version drift changes the pulumi plan. */
|
|
26
|
+
const GATED_PREFIXES = ['@mesh-tech/'];
|
|
27
|
+
/** pulumi ops that EVALUATE the program (a stale install can produce a wrong plan). */
|
|
28
|
+
export const PROGRAM_EVAL_OPS = new Set(['up', 'preview', 'destroy', 'refresh', 'import']);
|
|
29
|
+
/** Env escape hatch — set truthy to skip the preflight (e.g. deliberate local link testing). */
|
|
30
|
+
export const SKIP_ENV = 'MESH_SKIP_DEPLOY_PREFLIGHT';
|
|
31
|
+
function isGated(name) {
|
|
32
|
+
return GATED_PREFIXES.some((p) => name.startsWith(p));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A lockfile `version:` is checkable only when it's a concrete published version.
|
|
36
|
+
* `link:…`/`file:…` (dev-link pnpmfile, local tarballs) point at live source and
|
|
37
|
+
* are never stale; anything not starting with a digit isn't a comparable version.
|
|
38
|
+
* Peer/patch suffixes (`1.0.1(react@18)`) are stripped to the bare version.
|
|
39
|
+
*/
|
|
40
|
+
export function normalizeLockVersion(raw) {
|
|
41
|
+
if (typeof raw !== 'string' || raw.length === 0)
|
|
42
|
+
return null;
|
|
43
|
+
const bare = raw.split('(')[0].trim();
|
|
44
|
+
return /^\d/.test(bare) ? bare : null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Pure: extract the gated (`@mesh-tech/*`), concretely-versioned deps for one
|
|
48
|
+
* importer of a parsed pnpm-lock document → `{ name: expectedVersion }`.
|
|
49
|
+
*
|
|
50
|
+
* Handles the pnpm v9 shape (`{ specifier, version }` per dep) and the older flat
|
|
51
|
+
* shape (`name: "1.0.1"`). Unknown importer → `{}` (nothing checkable).
|
|
52
|
+
*/
|
|
53
|
+
export function extractImporterMeshVersions(lockDoc, importerRel) {
|
|
54
|
+
const out = {};
|
|
55
|
+
const importers = lockDoc?.importers;
|
|
56
|
+
const importer = importers?.[importerRel];
|
|
57
|
+
if (!importer)
|
|
58
|
+
return out;
|
|
59
|
+
for (const group of ['dependencies', 'devDependencies', 'optionalDependencies']) {
|
|
60
|
+
const deps = importer[group];
|
|
61
|
+
if (!deps)
|
|
62
|
+
continue;
|
|
63
|
+
for (const [name, entry] of Object.entries(deps)) {
|
|
64
|
+
if (!isGated(name))
|
|
65
|
+
continue;
|
|
66
|
+
const raw = typeof entry === 'string' ? entry : entry?.version;
|
|
67
|
+
const version = normalizeLockVersion(raw);
|
|
68
|
+
if (version)
|
|
69
|
+
out[name] = version;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return out;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Pure: diff the lockfile's expected versions against the installed ones. A dep
|
|
76
|
+
* is a mismatch when the installed version differs (or it isn't installed).
|
|
77
|
+
*/
|
|
78
|
+
export function diffLockVsInstalled(expected, installed) {
|
|
79
|
+
const out = [];
|
|
80
|
+
for (const [name, exp] of Object.entries(expected)) {
|
|
81
|
+
const got = installed[name] ?? null;
|
|
82
|
+
if (got !== exp)
|
|
83
|
+
out.push({ name, expected: exp, installed: got });
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
/** Walk up from `startDir` to the nearest directory containing a `pnpm-lock.yaml`. */
|
|
88
|
+
export function findPnpmLock(startDir) {
|
|
89
|
+
let dir = startDir;
|
|
90
|
+
for (;;) {
|
|
91
|
+
const candidate = join(dir, 'pnpm-lock.yaml');
|
|
92
|
+
if (existsSync(candidate))
|
|
93
|
+
return candidate;
|
|
94
|
+
const parent = dirname(dir);
|
|
95
|
+
if (parent === dir)
|
|
96
|
+
return null;
|
|
97
|
+
dir = parent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Read the installed version of `name` from `fromDir`'s `node_modules`, or null.
|
|
102
|
+
*
|
|
103
|
+
* Reads `node_modules/<name>/package.json` DIRECTLY (following pnpm's symlink into
|
|
104
|
+
* the store) rather than `require.resolve(`${name}/package.json`)`: Node's exports
|
|
105
|
+
* gate throws `ERR_PACKAGE_PATH_NOT_EXPORTED` for the many `@mesh-tech/*` packages
|
|
106
|
+
* whose `exports` omit `./package.json` (e.g. `tsconfig`, `pulumi-utils`) — which
|
|
107
|
+
* would return null → a FALSE "stale" hard-stop on a correctly-installed repo that
|
|
108
|
+
* `pnpm install` can't clear. A plain read sidesteps the gate and stays scoped to
|
|
109
|
+
* THIS importer's node_modules instead of walking up to a hoisted copy owned by
|
|
110
|
+
* another importer (MESH-2266 review).
|
|
111
|
+
*/
|
|
112
|
+
function readInstalledVersion(fromDir, name) {
|
|
113
|
+
try {
|
|
114
|
+
const pkgPath = join(fromDir, 'node_modules', name, 'package.json');
|
|
115
|
+
const version = JSON.parse(readFileSync(pkgPath, 'utf8')).version;
|
|
116
|
+
return typeof version === 'string' ? version : null;
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Check that the `@mesh-tech/*` deps installed in `appRoot`'s `node_modules` match
|
|
124
|
+
* what the pnpm lockfile says. Returns the list of mismatches (empty = fresh), or
|
|
125
|
+
* `null` when the check does not apply (no lockfile — not a pnpm repo, or the
|
|
126
|
+
* monorepo running without one). IO wrapper around the pure helpers above.
|
|
127
|
+
*/
|
|
128
|
+
export function checkDeployDepsFresh(appRoot) {
|
|
129
|
+
const lockPath = findPnpmLock(appRoot);
|
|
130
|
+
if (!lockPath)
|
|
131
|
+
return null;
|
|
132
|
+
let lockDoc;
|
|
133
|
+
try {
|
|
134
|
+
lockDoc = parseYaml(readFileSync(lockPath, 'utf8'));
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// Don't block the deploy on our own parse failure — but a silently-disabled
|
|
138
|
+
// safety guard is worse than a noisy one, so surface that the check is off.
|
|
139
|
+
logWarn(`deploy preflight: could not parse ${lockPath} — skipping the stale-node_modules check.`);
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
const importerRel = relative(dirname(lockPath), appRoot) || '.';
|
|
143
|
+
const expected = extractImporterMeshVersions(lockDoc, importerRel);
|
|
144
|
+
const names = Object.keys(expected);
|
|
145
|
+
if (names.length === 0)
|
|
146
|
+
return [];
|
|
147
|
+
const installed = {};
|
|
148
|
+
for (const name of names)
|
|
149
|
+
installed[name] = readInstalledVersion(appRoot, name);
|
|
150
|
+
return diffLockVsInstalled(expected, installed);
|
|
151
|
+
}
|
|
152
|
+
/** Human-readable stale-deps report (mirrors the stale-dist detector's style). */
|
|
153
|
+
export function formatStaleDepsError(mismatches) {
|
|
154
|
+
const lines = [
|
|
155
|
+
`✗ ${mismatches.length} @mesh-tech/* dep${mismatches.length === 1 ? '' : 's'} in node_modules ` +
|
|
156
|
+
`do not match the lockfile — run pnpm install before deploying:`,
|
|
157
|
+
'',
|
|
158
|
+
];
|
|
159
|
+
for (const m of mismatches) {
|
|
160
|
+
lines.push(` • ${m.name} — installed ${m.installed ?? '(missing)'}, lockfile wants ${m.expected}`);
|
|
161
|
+
}
|
|
162
|
+
lines.push('', ' A stale node_modules makes pulumi evaluate OLD component code and can plan to', ' DELETE resources the current code would keep (MESH-2266). Fix:', '', ' pnpm install', '', ` To bypass this check (rarely correct): ${SKIP_ENV}=1 mesh deploy …`);
|
|
163
|
+
return lines.join('\n');
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Gate a `mesh deploy` invocation: if `op` evaluates the pulumi program and the
|
|
167
|
+
* deploy repo's `node_modules` is stale vs the lockfile, print the fix and exit
|
|
168
|
+
* non-zero BEFORE pulumi runs. No-op for non-evaluating ops, a fresh install, a
|
|
169
|
+
* non-pnpm repo, or when the skip env is set. Kept side-effecting (log + exit) so
|
|
170
|
+
* `deploy.ts` stays a thin wiring layer; the decision logic is pure above.
|
|
171
|
+
*/
|
|
172
|
+
export function assertDeployDepsFresh(appRoot, op) {
|
|
173
|
+
if (!PROGRAM_EVAL_OPS.has(op))
|
|
174
|
+
return;
|
|
175
|
+
if (process.env[SKIP_ENV])
|
|
176
|
+
return;
|
|
177
|
+
const mismatches = checkDeployDepsFresh(appRoot);
|
|
178
|
+
if (!mismatches || mismatches.length === 0)
|
|
179
|
+
return;
|
|
180
|
+
process.stderr.write(formatStaleDepsError(mismatches) + '\n');
|
|
181
|
+
process.exit(1);
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=deploy-preflight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-preflight.js","sourceRoot":"","sources":["../../../src/utils/deploy-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAWnC,yEAAyE;AACzE,MAAM,cAAc,GAAG,CAAC,aAAa,CAAU,CAA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,oBAAoB,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI error type with structured remediation.
|
|
3
|
+
*
|
|
4
|
+
* Every failure along the golden path should tell the user the exact `mesh`
|
|
5
|
+
* command (or doc) that fixes it. Remediation strings must be commands or
|
|
6
|
+
* docs — never "ask <person>".
|
|
7
|
+
*/
|
|
8
|
+
export interface Remediation {
|
|
9
|
+
/** Exact command that fixes the failure, e.g. "mesh login trabian-dev" */
|
|
10
|
+
command?: string;
|
|
11
|
+
/** Documentation URL or repo-relative doc path with more context */
|
|
12
|
+
docs?: string;
|
|
13
|
+
/** Whether the owning command can apply this fix itself via --fix */
|
|
14
|
+
autoFixable?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface MeshCliErrorOptions {
|
|
17
|
+
remediation?: Remediation;
|
|
18
|
+
/** Process exit code (default 1) */
|
|
19
|
+
exitCode?: number;
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
}
|
|
22
|
+
export declare class MeshCliError extends Error {
|
|
23
|
+
readonly remediation?: Remediation;
|
|
24
|
+
readonly exitCode: number;
|
|
25
|
+
constructor(message: string, options?: MeshCliErrorOptions);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Render an error's BODY — the message plus its "→ run: <command>" /
|
|
29
|
+
* "→ see: <docs>" remediation lines, with no leading severity glyph.
|
|
30
|
+
*
|
|
31
|
+
* Use this when the caller supplies its own glyph: a recovery path that logs a
|
|
32
|
+
* refusal through `logWarn` (which prefixes ⚠) and carries on would otherwise
|
|
33
|
+
* print "⚠ ✗ …". The remediation lines are the part that must survive — they
|
|
34
|
+
* name the corrupt file to delete.
|
|
35
|
+
*/
|
|
36
|
+
export declare function renderErrorBody(err: unknown): string;
|
|
37
|
+
/**
|
|
38
|
+
* Render an error for humans. MeshCliError gets its remediation appended as
|
|
39
|
+
* "→ run: <command>" / "→ see: <docs>" lines; anything else renders its message.
|
|
40
|
+
*/
|
|
41
|
+
export declare function renderError(err: unknown): string;
|
|
42
|
+
/**
|
|
43
|
+
* Render an error as JSON for agents. Same structure as the human output:
|
|
44
|
+
* { error, remediation?: { command?, docs?, autoFixable? } }.
|
|
45
|
+
*/
|
|
46
|
+
export declare function renderErrorJson(err: unknown): string;
|
|
47
|
+
/**
|
|
48
|
+
* Print a command's `--json` payload — the single machine-readable document on
|
|
49
|
+
* stdout — and record that it happened.
|
|
50
|
+
*
|
|
51
|
+
* A command that emits a payload and *then* throws (the `mesh init` doctor
|
|
52
|
+
* throws by design whenever a check fails) used to produce TWO concatenated
|
|
53
|
+
* JSON documents on stdout, because `handleCliError` appended `{"error":…}`.
|
|
54
|
+
* Two documents is not JSON: `mesh init app-tenant --json | jq` failed to parse
|
|
55
|
+
* on exactly the failure path a script cares about. Routing every payload
|
|
56
|
+
* through here lets the handler know stdout is already spoken for.
|
|
57
|
+
*/
|
|
58
|
+
export declare function emitJsonPayload(payload: unknown): void;
|
|
59
|
+
/** True once a command has written its `--json` payload to stdout. */
|
|
60
|
+
export declare function hasEmittedJsonPayload(): boolean;
|
|
61
|
+
/** Test seam — the flag is module state, so specs have to be able to clear it. */
|
|
62
|
+
export declare function resetJsonPayloadEmitted(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Top-level handler for bin/mesh.ts. Prints the error (JSON when the
|
|
65
|
+
* invocation asked for --json anywhere, since per-command flags aren't
|
|
66
|
+
* parsed once dispatch has failed) and exits with the error's code.
|
|
67
|
+
*
|
|
68
|
+
* When the command already emitted a `--json` payload, that payload IS the
|
|
69
|
+
* machine surface — and it says strictly more than this error would (the
|
|
70
|
+
* doctor's payload carries `ok:false` plus a per-check `fix` command). So the
|
|
71
|
+
* error goes to stderr as human diagnostics and stdout keeps exactly one
|
|
72
|
+
* parseable document.
|
|
73
|
+
*/
|
|
74
|
+
export declare function handleCliError(err: unknown): never;
|
|
75
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,WAAW;IAC1B,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEd,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB;CAM/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAWpD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAEhD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAQpD;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAGtD;AAED,sEAAsE;AACtE,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAED,kFAAkF;AAClF,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,KAAK,CAQlD"}
|