@mesh-tech/mesh-cli 0.1.0 → 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 +4 -0
- package/dist/src/commands/secrets/set.d.ts.map +1 -1
- package/dist/src/commands/secrets/set.js +243 -64
- 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 +35 -21
- 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,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local DevOutput source for `mesh dev` (design §5.2, AC C1/C3).
|
|
3
|
+
*
|
|
4
|
+
* Instead of reading a deployed Pulumi stack, synthesize the same DevOutput
|
|
5
|
+
* shape from repo conventions and point every service at the running
|
|
6
|
+
* `mesh start` platform. Zero AWS credentials, zero VPN, zero Pulumi state —
|
|
7
|
+
* the app's code never knows it's local:
|
|
8
|
+
* - Temporal → localhost:7233, namespace local-dev (seeded)
|
|
9
|
+
* - Postgres → the local `app` database
|
|
10
|
+
* - Zitadel → http://localhost:8080 (seeded org/app/users)
|
|
11
|
+
* - SpiceDB → localhost:50051 (preshared key)
|
|
12
|
+
* - AWS SDK → ministack via AWS_ENDPOINT_URL (SSM/Secrets/S3 registry)
|
|
13
|
+
*
|
|
14
|
+
* Detection convention = what `mesh create-app` templates emit: immediate
|
|
15
|
+
* subdirectories of the app root whose package.json has a `dev` script
|
|
16
|
+
* (api/, worker/, web/, …); a single-package app root with its own `dev`
|
|
17
|
+
* script becomes one service.
|
|
18
|
+
*/
|
|
19
|
+
import * as fs from "fs";
|
|
20
|
+
import * as path from "path";
|
|
21
|
+
import { isServiceMode, openapiMockCommand } from "./mocks.js";
|
|
22
|
+
import { probeTcp } from "./helpers.js";
|
|
23
|
+
import { MeshCliError } from "../../utils/errors.js";
|
|
24
|
+
import { localAwsEnv, LOCAL_ENV } from "./seed.js";
|
|
25
|
+
import { TEMPORAL_ADDRESS } from "./seed.js";
|
|
26
|
+
import { LOGIN_CONTEXT, ZITADEL_ISSUER } from "./seed-zitadel.js";
|
|
27
|
+
import { authSecretPath } from "./auth-provision.js";
|
|
28
|
+
import { findPackageRoot } from "./stack.js";
|
|
29
|
+
import { getContextConfig } from "../login.js";
|
|
30
|
+
export const LOCAL_STACK_NAME = "local";
|
|
31
|
+
const BASE_PORT = 3000;
|
|
32
|
+
/**
|
|
33
|
+
* The app's namespace, exactly the name the cloud gives it in K8s AND
|
|
34
|
+
* Temporal ({tenant}-{env}-{app}) — the Hub resolves both from this one
|
|
35
|
+
* convention, so local runs are addressable with zero translation.
|
|
36
|
+
*/
|
|
37
|
+
export function localAppNamespace(tenant, appName) {
|
|
38
|
+
return `${tenant}-${LOCAL_ENV}-${appName}`;
|
|
39
|
+
}
|
|
40
|
+
/** The OTLP log shipper (assets/log-shipper.mjs) each local service's
|
|
41
|
+
* launch pipeline pipes through — ships stdout to the stack's collector
|
|
42
|
+
* with the hosted k8s_* attribution. */
|
|
43
|
+
export function logShipperPath() {
|
|
44
|
+
return path.join(findPackageRoot(), "assets", "log-shipper.mjs");
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* OTel SDK bootstrap — the local analog of the OTel Operator's pod
|
|
48
|
+
* injection: when the service ships `@opentelemetry/auto-instrumentations-
|
|
49
|
+
* node` (the templates declare it), the platform injects the `--import`
|
|
50
|
+
* register hook + exporter env, and HTTP/fetch/gRPC spans flow to the
|
|
51
|
+
* stack's collector → Tempo → the Hub's Traces views. Apps without the
|
|
52
|
+
* package run untouched.
|
|
53
|
+
*/
|
|
54
|
+
export function autoInstrumentationEnv(appRoot, src) {
|
|
55
|
+
const pkgDir = path.join("node_modules", "@opentelemetry", "auto-instrumentations-node");
|
|
56
|
+
const present = fs.existsSync(path.join(appRoot, src, pkgDir)) || fs.existsSync(path.join(appRoot, pkgDir));
|
|
57
|
+
if (!present)
|
|
58
|
+
return {};
|
|
59
|
+
return {
|
|
60
|
+
NODE_OPTIONS: { value: "--import @opentelemetry/auto-instrumentations-node/register" },
|
|
61
|
+
OTEL_TRACES_EXPORTER: { value: "otlp" },
|
|
62
|
+
// Logs ship via the launch pipeline; metrics locally come from
|
|
63
|
+
// Prometheus scrapes — keep the SDK to traces.
|
|
64
|
+
OTEL_METRICS_EXPORTER: { value: "none" },
|
|
65
|
+
OTEL_LOGS_EXPORTER: { value: "none" },
|
|
66
|
+
OTEL_NODE_DISABLED_INSTRUMENTATIONS: { value: "fs,dns,net" },
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Hosted-parity resource attribution for a local service — what the
|
|
70
|
+
* in-cluster k8sattributes processor stamps. */
|
|
71
|
+
export function otelEnv(tenant, appName, serviceName) {
|
|
72
|
+
const namespace = localAppNamespace(tenant, appName);
|
|
73
|
+
return {
|
|
74
|
+
OTEL_EXPORTER_OTLP_ENDPOINT: { value: "http://localhost:4318" },
|
|
75
|
+
OTEL_SERVICE_NAME: { value: serviceName },
|
|
76
|
+
OTEL_RESOURCE_ATTRIBUTES: {
|
|
77
|
+
value: `k8s.namespace.name=${namespace},k8s.deployment.name=${serviceName},k8s.container.name=${serviceName},service.namespace=${appName}`,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** Endpoints of the running `mesh start` platform, as service env. */
|
|
82
|
+
export function localPlatformEnv(tenant, appName, serviceName) {
|
|
83
|
+
const namespace = localAppNamespace(tenant, appName);
|
|
84
|
+
const env = {
|
|
85
|
+
TEMPORAL_ADDRESS: { value: TEMPORAL_ADDRESS },
|
|
86
|
+
TEMPORAL_NAMESPACE: { value: namespace },
|
|
87
|
+
TEMPORAL_TASK_QUEUE: { value: appName },
|
|
88
|
+
// OTel wiring, two consumers: instrumented services ship traces/metrics
|
|
89
|
+
// themselves, and the launch pipeline's log shipper reads these to ship
|
|
90
|
+
// stdout logs — both with the in-cluster k8sattributes attribution.
|
|
91
|
+
...otelEnv(tenant, appName, serviceName),
|
|
92
|
+
DATABASE_URL: { value: "postgres://postgres:postgres@localhost:5433/app" },
|
|
93
|
+
ZITADEL_ISSUER: { value: ZITADEL_ISSUER },
|
|
94
|
+
// The service's own Zitadel M2M credentials (created by ensureAppTenantAuth
|
|
95
|
+
// on session start) — resolveCredentials("zitadel") picks this up, so apps
|
|
96
|
+
// can hydrate introspection/M2M config the same way they resolve
|
|
97
|
+
// ExternalService links instead of hand-carrying client ids in env files.
|
|
98
|
+
ZITADEL_SECRET_PREFIX: { value: authSecretPath(tenant, appName, serviceName) },
|
|
99
|
+
SPICEDB_ENDPOINT: { value: "localhost:50051" },
|
|
100
|
+
SPICEDB_HTTP_ENDPOINT: { value: "http://localhost:8443" },
|
|
101
|
+
SPICEDB_PRESHARED_KEY: { value: "local-dev-key" },
|
|
102
|
+
MEMCACHED_SERVERS: { value: "localhost:11211" },
|
|
103
|
+
MESH_LOCAL: { value: "1" },
|
|
104
|
+
MESH_SERVICE: { value: serviceName },
|
|
105
|
+
};
|
|
106
|
+
// Local tokens come from `mesh login local` (the seeded CLI app), so that
|
|
107
|
+
// app's clientId is the audience local APIs should verify. In the cloud,
|
|
108
|
+
// consumers request the API project's audience scope instead.
|
|
109
|
+
const cliClientId = getContextConfig(LOGIN_CONTEXT)?.clientId;
|
|
110
|
+
if (cliClientId) {
|
|
111
|
+
env.AUTH_AUDIENCE = { value: cliClientId };
|
|
112
|
+
}
|
|
113
|
+
for (const [key, value] of Object.entries(localAwsEnv())) {
|
|
114
|
+
env[key] = { value };
|
|
115
|
+
}
|
|
116
|
+
return env;
|
|
117
|
+
}
|
|
118
|
+
function hasDevScript(dir) {
|
|
119
|
+
const pkgPath = path.join(dir, "package.json");
|
|
120
|
+
if (!fs.existsSync(pkgPath))
|
|
121
|
+
return false;
|
|
122
|
+
try {
|
|
123
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
124
|
+
return typeof pkg?.scripts?.dev === "string";
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Detect runnable services by template convention: immediate subdirectories
|
|
132
|
+
* with a package.json `dev` script; falls back to the app root itself when
|
|
133
|
+
* it is a single-package app.
|
|
134
|
+
*/
|
|
135
|
+
export function detectLocalServices(appRoot) {
|
|
136
|
+
const services = {};
|
|
137
|
+
for (const entry of fs.readdirSync(appRoot, { withFileTypes: true })) {
|
|
138
|
+
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules")
|
|
139
|
+
continue;
|
|
140
|
+
if (hasDevScript(path.join(appRoot, entry.name))) {
|
|
141
|
+
services[entry.name] = { src: entry.name };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (Object.keys(services).length === 0 && hasDevScript(appRoot)) {
|
|
145
|
+
services[path.basename(appRoot)] = { src: "." };
|
|
146
|
+
}
|
|
147
|
+
return services;
|
|
148
|
+
}
|
|
149
|
+
/** Synthesize the DevOutput `mesh dev` would otherwise read from Pulumi.
|
|
150
|
+
* `tenant` is the app tenant (detectLocalTenant) — it scopes the app's
|
|
151
|
+
* namespace ({tenant}-{env}-{app}) for Temporal, logs, and traces.
|
|
152
|
+
* `opts.mocks` (mesh dev --externals) appends declared mock services and injects
|
|
153
|
+
* their ExternalService credential prefixes into every app service. */
|
|
154
|
+
export function buildLocalDevOutput(appRoot, tenant, opts = {}) {
|
|
155
|
+
const detected = detectLocalServices(appRoot);
|
|
156
|
+
const names = Object.keys(detected);
|
|
157
|
+
if (names.length === 0) {
|
|
158
|
+
throw new MeshCliError(`No runnable services found under ${appRoot} — expected subdirectories (api/, worker/, …) with a package.json 'dev' script.`, { remediation: { command: "mesh create-app" } });
|
|
159
|
+
}
|
|
160
|
+
// App name = project name = authz namespace. Pulumi.yaml `name:` wins
|
|
161
|
+
// (matches getProjectName — a stack-backed app run with --local must keep
|
|
162
|
+
// its deployed identity), then package.json name, then the basename.
|
|
163
|
+
// Scoped package names (@scu-apps/plaid) are unusable as Temporal/K8s
|
|
164
|
+
// namespaces — drop the scope.
|
|
165
|
+
let appName = path.basename(appRoot);
|
|
166
|
+
try {
|
|
167
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(appRoot, "package.json"), "utf-8"));
|
|
168
|
+
if (typeof pkg?.name === "string" && pkg.name)
|
|
169
|
+
appName = pkg.name.replace(/^@[^/]+\//, "");
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
// no root package.json — keep the basename
|
|
173
|
+
}
|
|
174
|
+
const pulumiYaml = path.join(appRoot, "Pulumi.yaml");
|
|
175
|
+
if (fs.existsSync(pulumiYaml)) {
|
|
176
|
+
const match = fs.readFileSync(pulumiYaml, "utf-8").match(/^name:\s*(.+)$/m);
|
|
177
|
+
if (match?.[1]?.trim())
|
|
178
|
+
appName = match[1].trim();
|
|
179
|
+
}
|
|
180
|
+
const services = {};
|
|
181
|
+
const mocks = opts.mocks ?? {};
|
|
182
|
+
// Only process/openapi declarations run as mock-{name} services in this
|
|
183
|
+
// orchestration; compose externals are docker-managed and sandbox
|
|
184
|
+
// declarations spawn nothing (dev.ts seeds their credentials directly).
|
|
185
|
+
const mockNames = Object.keys(mocks).filter((name) => isServiceMode(name, mocks[name]));
|
|
186
|
+
// The ExternalService link() contract, synthesized: every app service gets
|
|
187
|
+
// {EXT}_SECRET_PREFIX for each mocked external, so resolveCredentials()
|
|
188
|
+
// runs the exact deployed code path against the locally seeded secret.
|
|
189
|
+
const externalEnv = {};
|
|
190
|
+
for (const decl of Object.values(mocks)) {
|
|
191
|
+
if (!decl.external)
|
|
192
|
+
continue;
|
|
193
|
+
const prefix = decl.external.toUpperCase().replace(/-/g, "_");
|
|
194
|
+
externalEnv[`${prefix}_SECRET_PREFIX`] = {
|
|
195
|
+
value: `mesh/${tenant}/${LOCAL_ENV}/external/${decl.external}`,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
names.forEach((name, i) => {
|
|
199
|
+
const port = BASE_PORT + i;
|
|
200
|
+
services[name] = {
|
|
201
|
+
src: detected[name].src,
|
|
202
|
+
port,
|
|
203
|
+
command: ["pnpm", "dev"],
|
|
204
|
+
env: {
|
|
205
|
+
// allocatePorts keeps service.port and env.PORT in sync on reallocation
|
|
206
|
+
PORT: { value: String(port) },
|
|
207
|
+
...localPlatformEnv(tenant, appName, name),
|
|
208
|
+
...autoInstrumentationEnv(appRoot, detected[name].src),
|
|
209
|
+
...externalEnv,
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
});
|
|
213
|
+
// Sibling-service URLs — the local analog of the deployed cross-service
|
|
214
|
+
// wiring (http://{svc}.{namespace}.svc.cluster.local:{port} in-cluster):
|
|
215
|
+
// every app service gets SERVICE_{NAME}_URL for each app service, so code
|
|
216
|
+
// can wire cross-service clients locally without knowing allocated ports.
|
|
217
|
+
// allocatePorts' cross-service localhost:{port} rewrite keeps them in sync
|
|
218
|
+
// when ports are reallocated.
|
|
219
|
+
//
|
|
220
|
+
// This is a PUBLIC, app-facing env contract — {NAME} is the service's
|
|
221
|
+
// directory name upper-cased, non-[A-Z0-9] → "_". Apps that name their
|
|
222
|
+
// link the same way (events.link({ environmentPrefix: "SERVICE_EVENTS" }))
|
|
223
|
+
// read ONE variable deployed and locally, with no isLocal branch.
|
|
224
|
+
// See docs/guides/mesh-dev-local-env.md.
|
|
225
|
+
for (const name of names) {
|
|
226
|
+
const key = `SERVICE_${name.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_URL`;
|
|
227
|
+
const url = `http://localhost:${services[name].port}`;
|
|
228
|
+
for (const other of names) {
|
|
229
|
+
services[other].env[key] = { value: url };
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// Declared mocks join the same orchestration (ports, env file, tmux
|
|
233
|
+
// window, log pipeline) as first-class services named mock-{name}.
|
|
234
|
+
mockNames.forEach((name, i) => {
|
|
235
|
+
const decl = mocks[name];
|
|
236
|
+
const serviceName = `mock-${name}`;
|
|
237
|
+
const port = decl.port ?? BASE_PORT + names.length + i;
|
|
238
|
+
services[serviceName] = {
|
|
239
|
+
// openapi mode runs Prism from the app root against the spec path.
|
|
240
|
+
src: decl.src ?? ".",
|
|
241
|
+
port,
|
|
242
|
+
command: decl.openapi ? openapiMockCommand(decl) : (decl.command ?? ["pnpm", "dev"]),
|
|
243
|
+
env: {
|
|
244
|
+
PORT: { value: String(port) },
|
|
245
|
+
...otelEnv(tenant, appName, serviceName),
|
|
246
|
+
...Object.fromEntries(Object.entries(decl.env ?? {}).map(([key, value]) => [key, { value }])),
|
|
247
|
+
},
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
return {
|
|
251
|
+
platform: { tenant: "local", env: "dev" },
|
|
252
|
+
app: appName,
|
|
253
|
+
stack: LOCAL_STACK_NAME,
|
|
254
|
+
services,
|
|
255
|
+
tunnels: {},
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Whether the app is backed by a Pulumi program: its own (Pulumi.yaml or a
|
|
260
|
+
* Pulumi.<stack>.yaml stack config in the app dir), or a monorepo ROOT
|
|
261
|
+
* program above it (walk up to the repo boundary — .git/pnpm-workspace).
|
|
262
|
+
* Apps like apps/hub deploy via a root program and have no per-app
|
|
263
|
+
* Pulumi.yaml; they must NOT default into `mesh dev` local mode.
|
|
264
|
+
*/
|
|
265
|
+
export function hasStackBacking(appRoot) {
|
|
266
|
+
const hasOwn = fs.existsSync(path.join(appRoot, "Pulumi.yaml")) ||
|
|
267
|
+
fs.readdirSync(appRoot).some((f) => /^Pulumi\..+\.yaml$/.test(f));
|
|
268
|
+
if (hasOwn)
|
|
269
|
+
return true;
|
|
270
|
+
let dir = path.dirname(appRoot);
|
|
271
|
+
while (true) {
|
|
272
|
+
if (fs.existsSync(path.join(dir, "Pulumi.yaml")))
|
|
273
|
+
return true;
|
|
274
|
+
if (fs.existsSync(path.join(dir, ".git")) || fs.existsSync(path.join(dir, "pnpm-workspace.yaml"))) {
|
|
275
|
+
return fs.existsSync(path.join(dir, "Pulumi.yaml"));
|
|
276
|
+
}
|
|
277
|
+
const parent = path.dirname(dir);
|
|
278
|
+
if (parent === dir)
|
|
279
|
+
return false;
|
|
280
|
+
dir = parent;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* The app's tenant, for auth provisioning: `mesh:tenant` from the app's
|
|
285
|
+
* Pulumi stack config when present (templates write it), else "local".
|
|
286
|
+
*/
|
|
287
|
+
export function detectLocalTenant(appRoot) {
|
|
288
|
+
for (const file of fs.readdirSync(appRoot)) {
|
|
289
|
+
if (!/^Pulumi\..*\.yaml$/.test(file))
|
|
290
|
+
continue;
|
|
291
|
+
const match = fs
|
|
292
|
+
.readFileSync(path.join(appRoot, file), "utf-8")
|
|
293
|
+
.match(/^\s*mesh:tenant:\s*["']?([A-Za-z0-9-]+)["']?\s*$/m);
|
|
294
|
+
if (match)
|
|
295
|
+
return match[1];
|
|
296
|
+
}
|
|
297
|
+
return "local";
|
|
298
|
+
}
|
|
299
|
+
/** The local platform must be up before `mesh dev` can wire services to it. */
|
|
300
|
+
export async function ensureLocalPlatformRunning() {
|
|
301
|
+
const [temporalUp, fabricUp] = await Promise.all([probeTcp(7233), probeTcp(4566)]);
|
|
302
|
+
if (!temporalUp || !fabricUp) {
|
|
303
|
+
throw new MeshCliError("The local Mesh platform is not running (mesh dev local mode wires services to it).", { remediation: { command: "mesh start" } });
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=dev-local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-local.js","sourceRoot":"","sources":["../../../../src/commands/local/dev-local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,QAAQ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|
+
* The tmux runner stays the default on dev machines; `--runner docker` is
|
|
5
|
+
* for environments where tmux isn't sensible — CI (the golden-path
|
|
6
|
+
* workflow), headless agents, non-macOS boxes. It renders the SAME
|
|
7
|
+
* synthesized DevOutput into a docker compose project:
|
|
8
|
+
*
|
|
9
|
+
* - one service per DevOutput service, `node:22-bookworm`, the app
|
|
10
|
+
* bind-mounted at /workspace, `pnpm dev` in the service dir
|
|
11
|
+
* - `network_mode: host` — services reach the `mesh start` platform on
|
|
12
|
+
* localhost exactly like the tmux runner (Linux/CI semantics; on macOS
|
|
13
|
+
* Docker Desktop host networking must be enabled, and host-installed
|
|
14
|
+
* node_modules are platform-specific — tmux is the right runner there)
|
|
15
|
+
* - per-service env files carrying the identical env contract
|
|
16
|
+
* - logs ship through the same OTLP shipper (mounted from the CLI)
|
|
17
|
+
*
|
|
18
|
+
* Parity: `mesh dev --status|--kill|logs|restart` map to
|
|
19
|
+
* `docker compose ps|down|logs|restart` via the session state's runner.
|
|
20
|
+
*/
|
|
21
|
+
interface RunnerService {
|
|
22
|
+
src: string;
|
|
23
|
+
port: number;
|
|
24
|
+
command: string[];
|
|
25
|
+
env?: Record<string, {
|
|
26
|
+
value: string;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
/** Write the compose project for a dev session; returns the compose file path. */
|
|
30
|
+
export declare function writeDevCompose(sessionName: string, appRoot: string, services: Record<string, RunnerService>): string;
|
|
31
|
+
export declare function dockerDevUp(sessionName: string): void;
|
|
32
|
+
export declare function dockerDevDown(sessionName: string): void;
|
|
33
|
+
export declare function dockerDevPs(sessionName: string): string;
|
|
34
|
+
export declare function dockerDevLogs(sessionName: string, service: string, tail: number): string;
|
|
35
|
+
export declare function dockerDevRestart(sessionName: string, service: string): void;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=docker-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker-runner.d.ts","sourceRoot":"","sources":["../../../../src/commands/local/docker-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAaH,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzC;AAkBD,kFAAkF;AAClF,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GACtC,MAAM,CA0CR;AAMD,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAIvD;AAED,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKxF;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAI3E"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docker runner for `mesh dev --local` (design §5.3, AC C2).
|
|
3
|
+
*
|
|
4
|
+
* The tmux runner stays the default on dev machines; `--runner docker` is
|
|
5
|
+
* for environments where tmux isn't sensible — CI (the golden-path
|
|
6
|
+
* workflow), headless agents, non-macOS boxes. It renders the SAME
|
|
7
|
+
* synthesized DevOutput into a docker compose project:
|
|
8
|
+
*
|
|
9
|
+
* - one service per DevOutput service, `node:22-bookworm`, the app
|
|
10
|
+
* bind-mounted at /workspace, `pnpm dev` in the service dir
|
|
11
|
+
* - `network_mode: host` — services reach the `mesh start` platform on
|
|
12
|
+
* localhost exactly like the tmux runner (Linux/CI semantics; on macOS
|
|
13
|
+
* Docker Desktop host networking must be enabled, and host-installed
|
|
14
|
+
* node_modules are platform-specific — tmux is the right runner there)
|
|
15
|
+
* - per-service env files carrying the identical env contract
|
|
16
|
+
* - logs ship through the same OTLP shipper (mounted from the CLI)
|
|
17
|
+
*
|
|
18
|
+
* Parity: `mesh dev --status|--kill|logs|restart` map to
|
|
19
|
+
* `docker compose ps|down|logs|restart` via the session state's runner.
|
|
20
|
+
*/
|
|
21
|
+
import { execFileSync } from "child_process";
|
|
22
|
+
import * as fs from "fs";
|
|
23
|
+
import * as os from "os";
|
|
24
|
+
import * as path from "path";
|
|
25
|
+
import { logShipperPath } from "./dev-local.js";
|
|
26
|
+
// Digest-pinned so dev-runner containers are reproducible (matches the
|
|
27
|
+
// pinning of the stack's third-party images).
|
|
28
|
+
const DEV_RUNNER_IMAGE = "node:22-bookworm@sha256:5647be709086c696ff32edaaf1c70cd26d1da6ab2b39c32f3c7b4c4a31957e37";
|
|
29
|
+
function sessionDir(sessionName) {
|
|
30
|
+
const dir = path.join(os.homedir(), ".cache", "mesh", "mesh-local", "dev", sessionName);
|
|
31
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
32
|
+
return dir;
|
|
33
|
+
}
|
|
34
|
+
/** docker env-file format: KEY=VALUE, no quoting, single-line values only. */
|
|
35
|
+
function renderDockerEnvFile(env) {
|
|
36
|
+
const lines = [];
|
|
37
|
+
for (const [key, entry] of Object.entries(env)) {
|
|
38
|
+
if (entry.value.includes("\n"))
|
|
39
|
+
continue; // multi-line values unsupported by env_file
|
|
40
|
+
lines.push(`${key}=${entry.value}`);
|
|
41
|
+
}
|
|
42
|
+
return lines.join("\n") + "\n";
|
|
43
|
+
}
|
|
44
|
+
/** Write the compose project for a dev session; returns the compose file path. */
|
|
45
|
+
export function writeDevCompose(sessionName, appRoot, services) {
|
|
46
|
+
const dir = sessionDir(sessionName);
|
|
47
|
+
const shipper = logShipperPath();
|
|
48
|
+
const blocks = [
|
|
49
|
+
`# Generated by \`mesh dev --local --runner docker\` — do not edit.`,
|
|
50
|
+
`name: ${sessionName}`,
|
|
51
|
+
`services:`,
|
|
52
|
+
];
|
|
53
|
+
for (const [name, service] of Object.entries(services)) {
|
|
54
|
+
const env = service.env ?? {};
|
|
55
|
+
fs.writeFileSync(path.join(dir, `${name}.env`), renderDockerEnvFile(env), { mode: 0o600 });
|
|
56
|
+
const workdir = path.posix.join("/workspace", service.src === "." ? "" : service.src);
|
|
57
|
+
const ship = env.OTEL_RESOURCE_ATTRIBUTES
|
|
58
|
+
? ` 2>&1 | NODE_OPTIONS= node /mesh-assets/log-shipper.mjs`
|
|
59
|
+
: "";
|
|
60
|
+
blocks.push(` ${name}:`, ` image: ${DEV_RUNNER_IMAGE}`, ` network_mode: host`, ` working_dir: ${workdir}`, ` volumes:`, ` - '${appRoot}:/workspace'`, ` - '${path.dirname(shipper)}:/mesh-assets:ro'`, ` environment:`,
|
|
61
|
+
// node_modules is the HOST's bind-mounted install — pnpm inside the
|
|
62
|
+
// container must never "verify" it and try a purge/reinstall (pnpm
|
|
63
|
+
// ≥10.9's verify-deps-before-run prompts and dies headless; worse, a
|
|
64
|
+
// purge would clobber the host install).
|
|
65
|
+
` CI: 'true'`, ` npm_config_verify_deps_before_run: 'false'`, ` env_file:`, ` - './${name}.env'`,
|
|
66
|
+
// pipefail: the container's exit code must be the SERVICE's, not the
|
|
67
|
+
// log-shipper's — otherwise a crashed service reports success (CI).
|
|
68
|
+
` command: ["bash", "-lc", "set -o pipefail; corepack enable >/dev/null 2>&1; { ${service.command.join(" ")}; }${ship}"]`, ` restart: unless-stopped`);
|
|
69
|
+
}
|
|
70
|
+
const composePath = path.join(dir, "compose.yml");
|
|
71
|
+
fs.writeFileSync(composePath, blocks.join("\n") + "\n");
|
|
72
|
+
return composePath;
|
|
73
|
+
}
|
|
74
|
+
function composeArgs(sessionName, args) {
|
|
75
|
+
return ["compose", "-p", sessionName, "-f", path.join(sessionDir(sessionName), "compose.yml"), ...args];
|
|
76
|
+
}
|
|
77
|
+
export function dockerDevUp(sessionName) {
|
|
78
|
+
execFileSync("docker", composeArgs(sessionName, ["up", "-d"]), {
|
|
79
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export function dockerDevDown(sessionName) {
|
|
83
|
+
execFileSync("docker", composeArgs(sessionName, ["down", "--remove-orphans"]), {
|
|
84
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function dockerDevPs(sessionName) {
|
|
88
|
+
return execFileSync("docker", composeArgs(sessionName, ["ps", "--format", "table {{.Service}}\t{{.State}}\t{{.Status}}"]), {
|
|
89
|
+
encoding: "utf-8",
|
|
90
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export function dockerDevLogs(sessionName, service, tail) {
|
|
94
|
+
return execFileSync("docker", composeArgs(sessionName, ["logs", "--tail", String(tail), service]), {
|
|
95
|
+
encoding: "utf-8",
|
|
96
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export function dockerDevRestart(sessionName, service) {
|
|
100
|
+
execFileSync("docker", composeArgs(sessionName, ["restart", service]), {
|
|
101
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=docker-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker-runner.js","sourceRoot":"","sources":["../../../../src/commands/local/docker-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAA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AAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;KAClC,CAAsB,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,WAAmB,EAAE,OAAe;IACnE,YAAY,CAAC,QAAQ,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,EAAE;QACrE,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;KACxC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small shared helpers for the local-platform commands — extracted from the
|
|
3
|
+
* copies that had grown in auth-provision/mocks (secret upsert) and
|
|
4
|
+
* dev-local/stack (TCP probe).
|
|
5
|
+
*/
|
|
6
|
+
/** The subset of SecretsManagerClient upsertLocalSecret depends on. */
|
|
7
|
+
export interface SecretsSender {
|
|
8
|
+
send(command: unknown): Promise<unknown>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Create-or-update a Secrets Manager secret in the local AWS fabric
|
|
12
|
+
* (ministack). Create first; on ResourceExistsException, put a new value.
|
|
13
|
+
* `client` is injectable for tests; defaults to a client against the local
|
|
14
|
+
* fabric.
|
|
15
|
+
*/
|
|
16
|
+
export declare function upsertLocalSecret(secretId: string, value: Record<string, string>, client?: SecretsSender): Promise<void>;
|
|
17
|
+
/** True when a TCP connect to host:port succeeds within timeoutMs. */
|
|
18
|
+
export declare function probeTcp(port: number, opts?: {
|
|
19
|
+
host?: string;
|
|
20
|
+
timeoutMs?: number;
|
|
21
|
+
}): Promise<boolean>;
|
|
22
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/commands/local/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC7B,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,IAAI,CAAC,CAef;AAED,sEAAsE;AACtE,wBAAgB,QAAQ,CACtB,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/C,OAAO,CAAC,OAAO,CAAC,CAclB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small shared helpers for the local-platform commands — extracted from the
|
|
3
|
+
* copies that had grown in auth-provision/mocks (secret upsert) and
|
|
4
|
+
* dev-local/stack (TCP probe).
|
|
5
|
+
*/
|
|
6
|
+
import * as net from "net";
|
|
7
|
+
import { LOCAL_AWS_CONFIG } from "./seed.js";
|
|
8
|
+
/**
|
|
9
|
+
* Create-or-update a Secrets Manager secret in the local AWS fabric
|
|
10
|
+
* (ministack). Create first; on ResourceExistsException, put a new value.
|
|
11
|
+
* `client` is injectable for tests; defaults to a client against the local
|
|
12
|
+
* fabric.
|
|
13
|
+
*/
|
|
14
|
+
export async function upsertLocalSecret(secretId, value, client) {
|
|
15
|
+
const { SecretsManagerClient, CreateSecretCommand, PutSecretValueCommand } = await import("@aws-sdk/client-secrets-manager");
|
|
16
|
+
const sm = client ?? new SecretsManagerClient(LOCAL_AWS_CONFIG);
|
|
17
|
+
const secretString = JSON.stringify(value);
|
|
18
|
+
try {
|
|
19
|
+
await sm.send(new CreateSecretCommand({ Name: secretId, SecretString: secretString }));
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
if (err?.name === "ResourceExistsException") {
|
|
23
|
+
await sm.send(new PutSecretValueCommand({ SecretId: secretId, SecretString: secretString }));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** True when a TCP connect to host:port succeeds within timeoutMs. */
|
|
31
|
+
export function probeTcp(port, opts = {}) {
|
|
32
|
+
const { host = "127.0.0.1", timeoutMs = 2000 } = opts;
|
|
33
|
+
return new Promise((resolve) => {
|
|
34
|
+
const socket = net.connect({ host, port, timeout: timeoutMs });
|
|
35
|
+
socket.once("connect", () => {
|
|
36
|
+
socket.destroy();
|
|
37
|
+
resolve(true);
|
|
38
|
+
});
|
|
39
|
+
socket.once("error", () => resolve(false));
|
|
40
|
+
socket.once("timeout", () => {
|
|
41
|
+
socket.destroy();
|
|
42
|
+
resolve(false);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/commands/local/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAO7C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAgB,EAChB,KAA6B,EAC7B,MAAsB;IAEtB,MAAM,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CACvF,iCAAiC,CAClC,CAAC;IACF,MAAM,EAAE,GAAG,MAAM,IAAI,IAAI,oBAAoB,CAAC,gBAAgB,CAAC,CAAC;IAChE,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC3C,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,EAAE,IAAI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
|
+
* until the hub pipeline publishes pullable container images (design §11).
|
|
4
|
+
*
|
|
5
|
+
* Resolves the published @mesh-tech/hub tarball with the user's registry
|
|
6
|
+
* auth (mesh registry login), extracts it, and docker-builds two images
|
|
7
|
+
* from the prebuilt dists it ships (api/dist → mesh-local-hub-api,
|
|
8
|
+
* ui/build → mesh-local-hub-ui). The CodeArtifact token enters the build
|
|
9
|
+
* as a BuildKit secret and never lands in a layer. Idempotent: images are
|
|
10
|
+
* keyed by the package version and rebuilt only when missing.
|
|
11
|
+
*/
|
|
12
|
+
import { type RegistryTokenState } from "../../utils/auth-preflight.js";
|
|
13
|
+
export declare const HUB_IMAGES: readonly ["mesh-local-hub-api", "mesh-local-hub-ui"];
|
|
14
|
+
/**
|
|
15
|
+
* Build the Hub's oauth2-proxy image (hosted sidecar + loopback issuer
|
|
16
|
+
* forward). Public base images only — no registry auth involved.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ensureHubAuthImage(): void;
|
|
19
|
+
/** Registry auth present? (Needed only to BUILD hub images, not to run them.) */
|
|
20
|
+
export declare function hasRegistryAuth(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Newest hub version whose images already exist locally — lets `mesh start`
|
|
23
|
+
* include the Hub by default with no network and no registry auth. Returns
|
|
24
|
+
* undefined when no built images are present.
|
|
25
|
+
*/
|
|
26
|
+
export declare function localHubVersion(): string | undefined;
|
|
27
|
+
export type WithHubPlan = {
|
|
28
|
+
action: "refresh";
|
|
29
|
+
} | {
|
|
30
|
+
action: "use-local";
|
|
31
|
+
version: string;
|
|
32
|
+
warning: string;
|
|
33
|
+
} | {
|
|
34
|
+
action: "fail";
|
|
35
|
+
message: string;
|
|
36
|
+
remediation: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Pure: decide what `mesh start --with-hub` does given the registry probe
|
|
40
|
+
* and any already-built local images. Only a *refresh* needs the registry —
|
|
41
|
+
* already-built images run without it, so an expired/missing token degrades
|
|
42
|
+
* to those (with the fixing command) instead of hard-failing a path that
|
|
43
|
+
* works offline (MESH-2479).
|
|
44
|
+
*/
|
|
45
|
+
export declare function planWithHubRefresh(probeState: RegistryTokenState, builtVersion: string | undefined): WithHubPlan;
|
|
46
|
+
/**
|
|
47
|
+
* Ensure the two local hub images exist; build them from the tarball when
|
|
48
|
+
* missing. Returns the hub version (used as the compose image tag).
|
|
49
|
+
*/
|
|
50
|
+
export declare function ensureHubImages(): Promise<string>;
|
|
51
|
+
//# sourceMappingURL=hub-local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-local.d.ts","sourceRoot":"","sources":["../../../../src/commands/local/hub-local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAM5G,eAAO,MAAM,UAAU,sDAAuD,CAAC;AAkC/E;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAUzC;AAED,iFAAiF;AACjF,wBAAgB,eAAe,IAAI,OAAO,CAGzC;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,MAAM,GAAG,SAAS,CAkBpD;AAkDD,MAAM,MAAM,WAAW,GACnB;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,kBAAkB,EAC9B,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,WAAW,CAmBb;AAED;;;GAGG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAuCvD"}
|