@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,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local Hub image builder (`mesh start --with-hub`) — the interim path
|
|
3
|
+
* 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 { execFile, execFileSync } from "child_process";
|
|
13
|
+
import * as fs from "fs";
|
|
14
|
+
import * as os from "os";
|
|
15
|
+
import * as path from "path";
|
|
16
|
+
import { promisify } from "util";
|
|
17
|
+
import { logInfo, logSuccess, logWarn, startHeartbeat } from "../../utils/log.js";
|
|
18
|
+
import { MeshCliError } from "../../utils/errors.js";
|
|
19
|
+
import { isNpmAuthError, REGISTRY_LOGIN_FIX } from "../../utils/auth-preflight.js";
|
|
20
|
+
import { findPackageRoot } from "./stack.js";
|
|
21
|
+
const execFileAsync = promisify(execFile);
|
|
22
|
+
const HUB_PACKAGE = "@mesh-tech/hub";
|
|
23
|
+
export const HUB_IMAGES = ["mesh-local-hub-api", "mesh-local-hub-ui"];
|
|
24
|
+
/** Bump when stack/hub/Dockerfile.* change — forces a rebuild of images
|
|
25
|
+
* already cached for the same published hub version. */
|
|
26
|
+
const LOCAL_IMAGE_REV = "r2";
|
|
27
|
+
function cacheDir() {
|
|
28
|
+
const dir = path.join(os.homedir(), ".cache", "mesh", "hub-local");
|
|
29
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
30
|
+
return dir;
|
|
31
|
+
}
|
|
32
|
+
function npmrcPath() {
|
|
33
|
+
const p = path.join(os.homedir(), ".npmrc");
|
|
34
|
+
if (!fs.existsSync(p) || !fs.readFileSync(p, "utf-8").includes("codeartifact")) {
|
|
35
|
+
throw new MeshCliError("The local Hub builds from the published @mesh-tech/hub tarball, which needs registry auth.", { remediation: { command: REGISTRY_LOGIN_FIX } });
|
|
36
|
+
}
|
|
37
|
+
return p;
|
|
38
|
+
}
|
|
39
|
+
function imageExists(tag) {
|
|
40
|
+
try {
|
|
41
|
+
execFileSync("docker", ["image", "inspect", tag], { stdio: ["ignore", "pipe", "pipe"] });
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Tag referenced by docker-compose.hub.yml — bump alongside Dockerfile.auth. */
|
|
49
|
+
const HUB_AUTH_IMAGE = "mesh-local-hub-auth:v7.7.1-r1";
|
|
50
|
+
/**
|
|
51
|
+
* Build the Hub's oauth2-proxy image (hosted sidecar + loopback issuer
|
|
52
|
+
* forward). Public base images only — no registry auth involved.
|
|
53
|
+
*/
|
|
54
|
+
export function ensureHubAuthImage() {
|
|
55
|
+
if (imageExists(HUB_AUTH_IMAGE))
|
|
56
|
+
return;
|
|
57
|
+
logInfo(`Building ${HUB_AUTH_IMAGE} (Hub auth proxy)…`);
|
|
58
|
+
const hubStackDir = path.join(findPackageRoot(), "stack", "hub");
|
|
59
|
+
execFileSync("docker", ["build", "-f", path.join(hubStackDir, "Dockerfile.auth"), "-t", HUB_AUTH_IMAGE, hubStackDir], { stdio: ["ignore", "inherit", "inherit"], env: { ...process.env, DOCKER_BUILDKIT: "1" } });
|
|
60
|
+
logSuccess(`Built ${HUB_AUTH_IMAGE}`);
|
|
61
|
+
}
|
|
62
|
+
/** Registry auth present? (Needed only to BUILD hub images, not to run them.) */
|
|
63
|
+
export function hasRegistryAuth() {
|
|
64
|
+
const p = path.join(os.homedir(), ".npmrc");
|
|
65
|
+
return fs.existsSync(p) && fs.readFileSync(p, "utf-8").includes("codeartifact");
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Newest hub version whose images already exist locally — lets `mesh start`
|
|
69
|
+
* include the Hub by default with no network and no registry auth. Returns
|
|
70
|
+
* undefined when no built images are present.
|
|
71
|
+
*/
|
|
72
|
+
export function localHubVersion() {
|
|
73
|
+
const versions = HUB_IMAGES.map((name) => {
|
|
74
|
+
try {
|
|
75
|
+
const out = execFileSync("docker", ["images", name, "--format", "{{.Tag}}"], {
|
|
76
|
+
encoding: "utf-8",
|
|
77
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
78
|
+
});
|
|
79
|
+
return out.split("\n").map((t) => t.trim()).filter((t) => t && t !== "<none>");
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const shared = versions[0].filter((v) => v.endsWith(`-${LOCAL_IMAGE_REV}`) && versions.every((list) => list.includes(v)));
|
|
86
|
+
if (shared.length === 0)
|
|
87
|
+
return undefined;
|
|
88
|
+
// Highest semver wins (numeric-aware compare handles the -rN suffix).
|
|
89
|
+
return shared.sort((a, b) => a.localeCompare(b, undefined, { numeric: true })).at(-1);
|
|
90
|
+
}
|
|
91
|
+
/** `npm pack` the published hub tarball into the cache; returns its path +
|
|
92
|
+
* version. Falls back to the newest cached tarball when the registry is
|
|
93
|
+
* unreachable (offline / expired token). Async so the heartbeat can fill
|
|
94
|
+
* silence during the fetch — a first run's slowest, quietest step. */
|
|
95
|
+
async function fetchTarball() {
|
|
96
|
+
const dir = cacheDir();
|
|
97
|
+
logInfo(`Resolving ${HUB_PACKAGE} from the registry…`);
|
|
98
|
+
const heartbeat = startHeartbeat(`fetching the ${HUB_PACKAGE} tarball from CodeArtifact`);
|
|
99
|
+
try {
|
|
100
|
+
const { stdout } = await execFileAsync("npm", ["pack", `${HUB_PACKAGE}@latest`, "--pack-destination", dir, "--json"], { encoding: "utf-8" });
|
|
101
|
+
const info = JSON.parse(stdout)[0];
|
|
102
|
+
return { tarball: path.join(dir, info.filename), version: info.version };
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
const authFailure = isNpmAuthError(err);
|
|
106
|
+
const cached = fs
|
|
107
|
+
.readdirSync(dir)
|
|
108
|
+
.filter((f) => f.startsWith("mesh-tech-hub-") && f.endsWith(".tgz"))
|
|
109
|
+
.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }))
|
|
110
|
+
.at(-1);
|
|
111
|
+
if (!cached) {
|
|
112
|
+
// Map npm's E401 ("try npm login") to the Mesh fix — npm login can
|
|
113
|
+
// never mint a CodeArtifact token (MESH-2479).
|
|
114
|
+
if (authFailure) {
|
|
115
|
+
throw new MeshCliError(`The registry rejected the ${HUB_PACKAGE} tarball fetch (E401 Unauthorized) — your CodeArtifact token is expired or invalid. (npm's "try npm login" advice does not apply to this registry.)`, { remediation: { command: REGISTRY_LOGIN_FIX }, cause: err });
|
|
116
|
+
}
|
|
117
|
+
throw err;
|
|
118
|
+
}
|
|
119
|
+
const version = cached.replace("mesh-tech-hub-", "").replace(/\.tgz$/, "");
|
|
120
|
+
if (authFailure) {
|
|
121
|
+
logWarn(`Registry rejected the fetch (E401 — CodeArtifact token expired). Using the cached hub tarball v${version}; refresh with: ${REGISTRY_LOGIN_FIX}`);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
logInfo(`Registry unavailable — using the cached hub tarball v${version}`);
|
|
125
|
+
}
|
|
126
|
+
return { tarball: path.join(dir, cached), version };
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
heartbeat.stop();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Pure: decide what `mesh start --with-hub` does given the registry probe
|
|
134
|
+
* and any already-built local images. Only a *refresh* needs the registry —
|
|
135
|
+
* already-built images run without it, so an expired/missing token degrades
|
|
136
|
+
* to those (with the fixing command) instead of hard-failing a path that
|
|
137
|
+
* works offline (MESH-2479).
|
|
138
|
+
*/
|
|
139
|
+
export function planWithHubRefresh(probeState, builtVersion) {
|
|
140
|
+
if (probeState !== "expired" && probeState !== "missing")
|
|
141
|
+
return { action: "refresh" };
|
|
142
|
+
if (builtVersion) {
|
|
143
|
+
return {
|
|
144
|
+
action: "use-local",
|
|
145
|
+
version: builtVersion,
|
|
146
|
+
warning: `CodeArtifact token is ${probeState} — using the already-built local Hub images (v${builtVersion}). ` +
|
|
147
|
+
`To pick up a newer published Hub: ${REGISTRY_LOGIN_FIX}, then re-run mesh start --with-hub.`,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
return {
|
|
151
|
+
action: "fail",
|
|
152
|
+
message: probeState === "expired"
|
|
153
|
+
? "Your CodeArtifact token is expired or rejected — the Hub build would fail minutes in with E401."
|
|
154
|
+
: "No CodeArtifact registry auth found in ~/.npmrc — the Hub builds from the published @mesh-tech/hub tarball.",
|
|
155
|
+
remediation: REGISTRY_LOGIN_FIX,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Ensure the two local hub images exist; build them from the tarball when
|
|
160
|
+
* missing. Returns the hub version (used as the compose image tag).
|
|
161
|
+
*/
|
|
162
|
+
export async function ensureHubImages() {
|
|
163
|
+
const npmrc = npmrcPath();
|
|
164
|
+
const { tarball, version: packageVersion } = await fetchTarball();
|
|
165
|
+
const version = `${packageVersion}-${LOCAL_IMAGE_REV}`;
|
|
166
|
+
const tags = HUB_IMAGES.map((name) => `${name}:${version}`);
|
|
167
|
+
if (tags.every(imageExists)) {
|
|
168
|
+
logInfo(`Local Hub images ready (v${version})`);
|
|
169
|
+
return version;
|
|
170
|
+
}
|
|
171
|
+
const context = path.join(cacheDir(), `context-${version}`);
|
|
172
|
+
fs.rmSync(context, { recursive: true, force: true });
|
|
173
|
+
fs.mkdirSync(context, { recursive: true });
|
|
174
|
+
execFileSync("tar", ["-xzf", tarball, "-C", context, "--strip-components", "1"], {
|
|
175
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
176
|
+
});
|
|
177
|
+
const hubStackDir = path.join(findPackageRoot(), "stack", "hub");
|
|
178
|
+
for (const [name, dockerfile] of [
|
|
179
|
+
["mesh-local-hub-api", "Dockerfile.api"],
|
|
180
|
+
["mesh-local-hub-ui", "Dockerfile.ui"],
|
|
181
|
+
]) {
|
|
182
|
+
const tag = `${name}:${version}`;
|
|
183
|
+
if (imageExists(tag))
|
|
184
|
+
continue;
|
|
185
|
+
logInfo(`Building ${tag} from the published tarball…`);
|
|
186
|
+
execFileSync("docker", [
|
|
187
|
+
"build",
|
|
188
|
+
"-f", path.join(hubStackDir, dockerfile),
|
|
189
|
+
"-t", tag,
|
|
190
|
+
"--secret", `id=npmrc,src=${npmrc}`,
|
|
191
|
+
context,
|
|
192
|
+
], { stdio: ["ignore", "inherit", "inherit"], env: { ...process.env, DOCKER_BUILDKIT: "1" } });
|
|
193
|
+
logSuccess(`Built ${tag}`);
|
|
194
|
+
}
|
|
195
|
+
return version;
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=hub-local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hub-local.js","sourceRoot":"","sources":["../../../../src/commands/local/hub-local.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;A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;QACX,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;QACjC,IAAI,WAAW,CAAC,GAAG,CAAC;YAAE,SAAS;QAC/B,OAAO,CAAC,YAAY,GAAG,8BAA8B,CAAC,CAAC;QACvD,YAAY,CACV,QAAQ,EACR;YACE,OAAO;YACP,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC;YACxC,IAAI,EAAE,GAAG;YACT,UAAU,EAAE,gBAAgB,KAAK,EAAE;YACnC,OAAO;SACR,EACD,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,EAAE,CAC3F,CAAC;QACF,UAAU,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mesh start / stop / status — the full-local Mesh platform.
|
|
3
|
+
*
|
|
4
|
+
* mesh start [--no-seed] Bring up the local platform (docker compose) and
|
|
5
|
+
* seed tenant `local` / env `dev` on first boot.
|
|
6
|
+
* mesh stop [--destroy] Stop the stack; --destroy also removes volumes
|
|
7
|
+
* (resets databases and seeds).
|
|
8
|
+
* mesh status [--json] Per-service health, endpoints, and ports.
|
|
9
|
+
*
|
|
10
|
+
* Everything here works with zero AWS credentials, zero VPN, and zero Pulumi
|
|
11
|
+
* state — Docker is the only prerequisite.
|
|
12
|
+
*/
|
|
13
|
+
import { Command } from "commander";
|
|
14
|
+
import { type ServiceStatus, type StackEndpoint } from "./stack.js";
|
|
15
|
+
/** Injectable seams so tests can drive the wait loop without Docker. */
|
|
16
|
+
export interface WaitForStackIo {
|
|
17
|
+
probe: (endpoint: StackEndpoint) => Promise<boolean>;
|
|
18
|
+
services: () => ServiceStatus[];
|
|
19
|
+
overlayServices: () => ReadonlySet<string>;
|
|
20
|
+
}
|
|
21
|
+
export declare function waitForStack(io?: WaitForStackIo): Promise<void>;
|
|
22
|
+
export declare function registerLocalCommands(program: Command): void;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/local/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAiBL,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AA4BpB,wEAAwE;AACxE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrD,QAAQ,EAAE,MAAM,aAAa,EAAE,CAAC;IAChC,eAAe,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5C;AAED,wBAAsB,YAAY,CAChC,EAAE,GAAE,cAIH,GACA,OAAO,CAAC,IAAI,CAAC,CAwCf;AA6CD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAkT5D"}
|
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mesh start / stop / status — the full-local Mesh platform.
|
|
3
|
+
*
|
|
4
|
+
* mesh start [--no-seed] Bring up the local platform (docker compose) and
|
|
5
|
+
* seed tenant `local` / env `dev` on first boot.
|
|
6
|
+
* mesh stop [--destroy] Stop the stack; --destroy also removes volumes
|
|
7
|
+
* (resets databases and seeds).
|
|
8
|
+
* mesh status [--json] Per-service health, endpoints, and ports.
|
|
9
|
+
*
|
|
10
|
+
* Everything here works with zero AWS credentials, zero VPN, and zero Pulumi
|
|
11
|
+
* state — Docker is the only prerequisite.
|
|
12
|
+
*/
|
|
13
|
+
import chalk from "chalk";
|
|
14
|
+
import { logError, logInfo, logSuccess, logWarn } from "../../utils/log.js";
|
|
15
|
+
import { MeshCliError } from "../../utils/errors.js";
|
|
16
|
+
import { COMPOSE_PROJECT, DEFAULT_HUB_PORT, ONE_SHOT_SERVICES, STACK_ENDPOINTS, compose, composeStreamed, crashedServices, ensureDockerAvailable, hubApiRunning, hubEndpoints, hubOverlayRunning, hubOverlayServices, hubPort, probeEndpoint, stackOwnedElsewhere, stackServices, } from "./stack.js";
|
|
17
|
+
import { probeRegistryToken, REGISTRY_LOGIN_FIX } from "../../utils/auth-preflight.js";
|
|
18
|
+
import { ensureHubAuthImage, ensureHubImages, hasRegistryAuth, localHubVersion, planWithHubRefresh, } from "./hub-local.js";
|
|
19
|
+
import { reconcileRegistryFromZitadel } from "./auth-provision.js";
|
|
20
|
+
import { LOCAL_AWS_CONFIG, localAwsEnv, seedLocalPlatform, verifyFabric } from "./seed.js";
|
|
21
|
+
import { LOGIN_CONTEXT, readHubAuth, seedZitadel, TEST_USERS } from "./seed-zitadel.js";
|
|
22
|
+
const WAIT_TIMEOUT_MS = 180_000;
|
|
23
|
+
const WAIT_POLL_MS = 3_000;
|
|
24
|
+
/** The one crash message, so both wait loops stay on the same remediation. */
|
|
25
|
+
function crashError(crashed) {
|
|
26
|
+
return new MeshCliError(`Service(s) exited during startup: ${crashed.map((s) => s.name).join(", ")}`, {
|
|
27
|
+
remediation: {
|
|
28
|
+
command: `docker compose -p ${COMPOSE_PROJECT} logs ${crashed[0].name}`,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
export async function waitForStack(io = {
|
|
33
|
+
probe: probeEndpoint,
|
|
34
|
+
services: stackServices,
|
|
35
|
+
overlayServices: hubOverlayServices,
|
|
36
|
+
}) {
|
|
37
|
+
const deadline = Date.now() + WAIT_TIMEOUT_MS;
|
|
38
|
+
let pending = STACK_ENDPOINTS.filter((e) => e.probe.kind !== "none");
|
|
39
|
+
while (true) {
|
|
40
|
+
const results = await Promise.all(pending.map((e) => io.probe(e)));
|
|
41
|
+
const stillDown = [];
|
|
42
|
+
for (let i = 0; i < pending.length; i++) {
|
|
43
|
+
if (results[i]) {
|
|
44
|
+
logSuccess(`${pending[i].label} is up (${pending[i].url})`);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
stillDown.push(pending[i]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
pending = stillDown;
|
|
51
|
+
// Surface hard failures on EVERY round, including the one that would end
|
|
52
|
+
// the wait: not every container has a STACK_ENDPOINTS entry, so with all
|
|
53
|
+
// probes answering first try an endpoint-less service (blackbox-exporter,
|
|
54
|
+
// temporal-admin-tools) could exit during startup unseen.
|
|
55
|
+
// The Hub overlay has not been brought up yet (that happens after the
|
|
56
|
+
// seed, below), so its containers are excluded — an `exited` hub-api
|
|
57
|
+
// here is a leftover from a previous run, not this run's crash.
|
|
58
|
+
const crashed = crashedServices(io.services(), {
|
|
59
|
+
overlayServices: io.overlayServices(),
|
|
60
|
+
overlayStarted: false,
|
|
61
|
+
});
|
|
62
|
+
if (crashed.length > 0)
|
|
63
|
+
throw crashError(crashed);
|
|
64
|
+
if (pending.length === 0)
|
|
65
|
+
break;
|
|
66
|
+
if (Date.now() > deadline) {
|
|
67
|
+
throw new MeshCliError(`Timed out waiting for: ${pending.map((e) => e.label).join(", ")}`, { remediation: { command: "mesh status" } });
|
|
68
|
+
}
|
|
69
|
+
logInfo(`Waiting for ${pending.map((e) => e.label).join(", ")} …`);
|
|
70
|
+
await new Promise((resolve) => setTimeout(resolve, WAIT_POLL_MS));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function printEndpoints(hubRunning) {
|
|
74
|
+
console.log("");
|
|
75
|
+
if (hubRunning) {
|
|
76
|
+
// The Hub is the front door — the same operations dashboard customers
|
|
77
|
+
// use against the hosted platform. Everything else is plumbing.
|
|
78
|
+
console.log(chalk.bold.cyan("★ Mesh Hub — your operations dashboard (start here)"));
|
|
79
|
+
console.log(` ${"Hub UI".padEnd(34)} ${chalk.bold.cyan(`http://localhost:${hubPort()}`)}`);
|
|
80
|
+
console.log(` ${"".padEnd(34)} ${chalk.dim("sign in: admin@local.mesh or dev@local.mesh / LocalDev1!")}`);
|
|
81
|
+
console.log(` ${"Hub API".padEnd(34)} ${chalk.cyan("http://localhost:4568")}`);
|
|
82
|
+
console.log(` ${"".padEnd(34)} ${chalk.dim("tenants, apps, workflows, logs, traces — local runs self-register here")}`);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
logWarn("Hub is not running — it is the platform's front door. Enable it with:");
|
|
86
|
+
logInfo(` ${REGISTRY_LOGIN_FIX} (one-time, to build the Hub images — no AWS account needed)`);
|
|
87
|
+
logInfo(" mesh start (the Hub joins automatically)");
|
|
88
|
+
}
|
|
89
|
+
console.log("");
|
|
90
|
+
console.log(chalk.bold("Local platform endpoints"));
|
|
91
|
+
for (const endpoint of STACK_ENDPOINTS) {
|
|
92
|
+
console.log(` ${endpoint.label.padEnd(34)} ${chalk.cyan(endpoint.url)}`);
|
|
93
|
+
if (endpoint.hint) {
|
|
94
|
+
console.log(` ${"".padEnd(34)} ${chalk.dim(endpoint.hint)}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
console.log("");
|
|
98
|
+
console.log(chalk.bold("AWS SDK wiring (local fabric)"));
|
|
99
|
+
console.log(chalk.dim(" Point any AWS SDK process at the local registry — no code changes:"));
|
|
100
|
+
for (const [key, value] of Object.entries(localAwsEnv())) {
|
|
101
|
+
console.log(` export ${key}=${chalk.cyan(value)}`);
|
|
102
|
+
}
|
|
103
|
+
console.log("");
|
|
104
|
+
console.log(chalk.bold("Login"));
|
|
105
|
+
console.log(` mesh login ${LOGIN_CONTEXT}`);
|
|
106
|
+
console.log(` ${chalk.dim(`test users: ${TEST_USERS.map((u) => u.email).join(", ")} (password: ${TEST_USERS[0].password})`)}`);
|
|
107
|
+
console.log("");
|
|
108
|
+
logInfo("Next: `mesh dev` in an apps repo wires services to this stack automatically.");
|
|
109
|
+
}
|
|
110
|
+
export function registerLocalCommands(program) {
|
|
111
|
+
program
|
|
112
|
+
.command("start")
|
|
113
|
+
.description("Start the full-local Mesh platform (Docker only — no AWS, no VPN)")
|
|
114
|
+
.option("--no-seed", "skip first-boot seeding (tenant registry, artifacts bucket)")
|
|
115
|
+
.option("--no-hub", "start without the Hub (API + UI)")
|
|
116
|
+
.option("--with-hub", "force-refresh the Hub to the latest published @mesh-tech/hub (the Hub is included by default when its images exist or registry auth is available)")
|
|
117
|
+
.option("--takeover", "re-own a stack that another checkout started (may recreate shared containers with THIS checkout's config)", false)
|
|
118
|
+
.action(async (opts) => {
|
|
119
|
+
ensureDockerAvailable();
|
|
120
|
+
// The stack is machine-wide; a `start` from a checkout whose compose
|
|
121
|
+
// config differs recreates shared containers out from under whatever
|
|
122
|
+
// is running against them (another project's `mesh dev` session, a
|
|
123
|
+
// Hub under development, …). Tenant/app work never needs `start`
|
|
124
|
+
// against an already-running stack — `mesh dev --local` deploys
|
|
125
|
+
// tenant-scoped only.
|
|
126
|
+
const foreign = stackOwnedElsewhere();
|
|
127
|
+
if (foreign && !opts.takeover) {
|
|
128
|
+
throw new MeshCliError(`The local platform is already running, started from a different checkout:\n ${foreign}\n` +
|
|
129
|
+
`Re-running start from here may recreate shared containers with this checkout's config and disrupt work using the current stack.`, {
|
|
130
|
+
remediation: {
|
|
131
|
+
command: "mesh status # inspect the running stack (apps deploy tenant-scoped via `mesh dev --local`)\n" +
|
|
132
|
+
" mesh start --takeover # intentionally re-own the stack from this checkout",
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
if (foreign && opts.takeover) {
|
|
137
|
+
logWarn(`Taking over the running stack (previously driven from ${foreign}).`);
|
|
138
|
+
}
|
|
139
|
+
// The Hub is the platform's front door, so it's part of the default
|
|
140
|
+
// stack: use already-built images when present; build from the
|
|
141
|
+
// published tarball when registry auth allows; otherwise start
|
|
142
|
+
// without it and say exactly how to enable it. --with-hub forces a
|
|
143
|
+
// registry resolve (picks up newly published hub versions).
|
|
144
|
+
let hubVersion;
|
|
145
|
+
if (opts.hub) {
|
|
146
|
+
if (opts.withHub) {
|
|
147
|
+
// Auth preflight (MESH-2479): the tarball fetch + image build run
|
|
148
|
+
// for minutes — verify the CodeArtifact token BEFORE that work.
|
|
149
|
+
// Only a refresh needs the registry: with already-built images a
|
|
150
|
+
// bad token degrades to them instead of failing an offline path.
|
|
151
|
+
const probe = await probeRegistryToken();
|
|
152
|
+
const plan = planWithHubRefresh(probe.state, localHubVersion());
|
|
153
|
+
if (plan.action === "fail") {
|
|
154
|
+
throw new MeshCliError(plan.message, { remediation: { command: plan.remediation } });
|
|
155
|
+
}
|
|
156
|
+
if (plan.action === "use-local") {
|
|
157
|
+
logWarn(plan.warning);
|
|
158
|
+
hubVersion = plan.version;
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
hubVersion = await ensureHubImages();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
hubVersion = localHubVersion();
|
|
166
|
+
if (!hubVersion && hasRegistryAuth()) {
|
|
167
|
+
const probe = await probeRegistryToken();
|
|
168
|
+
if (probe.state === "expired") {
|
|
169
|
+
// Keep `mesh start`'s Docker-only promise: degrade to a
|
|
170
|
+
// hub-less stack, but say exactly how to get the Hub back.
|
|
171
|
+
logWarn(`CodeArtifact token is expired — starting without the Hub. Fix: ${REGISTRY_LOGIN_FIX}, then: mesh start --with-hub`);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
try {
|
|
175
|
+
hubVersion = await ensureHubImages();
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
logWarn(`Hub image build failed (${err instanceof Error ? err.message : err}) — starting without the Hub.`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
logInfo("Starting the local Mesh platform (docker compose project: mesh-local)…");
|
|
185
|
+
// Base stack first; the Hub joins AFTER seeding so its oauth2-proxy
|
|
186
|
+
// gets the seeded client credentials and hub-api never caches a
|
|
187
|
+
// pre-seed (empty) registry view.
|
|
188
|
+
await composeStreamed(["up", "-d"]);
|
|
189
|
+
// Deterministic cache bust for the bind-mounted observability configs:
|
|
190
|
+
// `up -d` only recreates a container whose compose spec changed, and
|
|
191
|
+
// Prometheus re-reads prometheus.yml on restart/SIGHUP only. A CLI
|
|
192
|
+
// upgrade that edits observability/*.yml would otherwise leave a
|
|
193
|
+
// running stack on the OLD scrape config (and blackbox on old modules)
|
|
194
|
+
// — silently, since a misrouted probe just reports probe_success 0.
|
|
195
|
+
compose(["restart", "prometheus", "blackbox-exporter"], { inherit: true });
|
|
196
|
+
await waitForStack();
|
|
197
|
+
let hubAuth = readHubAuth();
|
|
198
|
+
if (opts.seed) {
|
|
199
|
+
logInfo("Seeding local platform (tenant registry, artifacts bucket)…");
|
|
200
|
+
await seedLocalPlatform();
|
|
201
|
+
logInfo("Seeding Zitadel (Platform project, Mesh CLI app, Hub auth, test users)…");
|
|
202
|
+
const zitadel = await seedZitadel(LOCAL_AWS_CONFIG);
|
|
203
|
+
hubAuth = zitadel.hubAuth;
|
|
204
|
+
// Zitadel is the auth source of truth — mirror every provisioned
|
|
205
|
+
// app tenant/app into the registry so the Hub shows them even if
|
|
206
|
+
// the app hasn't been run since it was provisioned.
|
|
207
|
+
try {
|
|
208
|
+
const reconciled = await reconcileRegistryFromZitadel();
|
|
209
|
+
if (reconciled.tenants.length > 0) {
|
|
210
|
+
logSuccess(`Hub registry reconciled from Zitadel: ${reconciled.tenants.length} app tenant(s) (${reconciled.tenants.join(", ")}), ${reconciled.apps} app(s)`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
logWarn(`Registry reconcile skipped: ${err instanceof Error ? err.message : err}`);
|
|
215
|
+
}
|
|
216
|
+
logInfo("Verifying the local AWS fabric (8 KB Advanced-tier round-trip)…");
|
|
217
|
+
await verifyFabric();
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
logWarn("Skipping seed (--no-seed).");
|
|
221
|
+
}
|
|
222
|
+
if (hubVersion) {
|
|
223
|
+
if (!hubAuth) {
|
|
224
|
+
logWarn("Hub auth is not seeded yet (started with --no-seed?) — Hub sign-in needs one seeded run: mesh start");
|
|
225
|
+
}
|
|
226
|
+
// The redirect URI for a non-default port is registered during
|
|
227
|
+
// seeding (reconcileHubRedirectUris) — skipping the seed with a new
|
|
228
|
+
// port reproduces the "redirect_uri is missing in the client
|
|
229
|
+
// configuration" login failure.
|
|
230
|
+
if (!opts.seed && hubPort() !== DEFAULT_HUB_PORT) {
|
|
231
|
+
logWarn(`--no-seed with MESH_HUB_PORT=${hubPort()}: this port's redirect URI is registered during seeding — if Hub sign-in fails with "redirect_uri is missing in the client configuration", re-run without --no-seed.`);
|
|
232
|
+
}
|
|
233
|
+
ensureHubAuthImage();
|
|
234
|
+
const hubEnv = { MESH_HUB_VERSION: hubVersion };
|
|
235
|
+
if (hubAuth) {
|
|
236
|
+
hubEnv.MESH_HUB_OAUTH2_CLIENT_ID = hubAuth.clientId;
|
|
237
|
+
hubEnv.MESH_HUB_OAUTH2_CLIENT_SECRET = hubAuth.clientSecret;
|
|
238
|
+
hubEnv.MESH_HUB_OAUTH2_COOKIE_SECRET = hubAuth.cookieSecret;
|
|
239
|
+
}
|
|
240
|
+
await composeStreamed(["up", "-d"], { hub: true, env: hubEnv });
|
|
241
|
+
if (opts.seed) {
|
|
242
|
+
// Deterministic cache bust: hub-api holds its tenants view for 5
|
|
243
|
+
// minutes and this run's seed/reconcile may have changed it.
|
|
244
|
+
compose(["restart", "hub-api"], { hub: true, env: hubEnv });
|
|
245
|
+
}
|
|
246
|
+
// From here the overlay HAS been started, so an exited hub service is
|
|
247
|
+
// a real crash again — same message, same remediation as the base
|
|
248
|
+
// stack's. (Without this the loop would spin out its 60 attempts and
|
|
249
|
+
// then claim the endpoint was up.)
|
|
250
|
+
const overlayServices = hubOverlayServices();
|
|
251
|
+
for (const endpoint of hubEndpoints()) {
|
|
252
|
+
logInfo(`Waiting for ${endpoint.label}…`);
|
|
253
|
+
let up = await probeEndpoint(endpoint);
|
|
254
|
+
for (let i = 0; i < 60 && !up; i++) {
|
|
255
|
+
const crashed = crashedServices(stackServices(), {
|
|
256
|
+
overlayServices,
|
|
257
|
+
overlayStarted: true,
|
|
258
|
+
});
|
|
259
|
+
if (crashed.length > 0)
|
|
260
|
+
throw crashError(crashed);
|
|
261
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
262
|
+
up = await probeEndpoint(endpoint);
|
|
263
|
+
}
|
|
264
|
+
if (!up) {
|
|
265
|
+
throw new MeshCliError(`Timed out waiting for ${endpoint.label} (${endpoint.url}).`, {
|
|
266
|
+
remediation: {
|
|
267
|
+
command: `docker compose -p ${COMPOSE_PROJECT} logs ${endpoint.service}`,
|
|
268
|
+
},
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
logSuccess(`${endpoint.label} is up (${endpoint.url})`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
logSuccess("Local Mesh platform is running.");
|
|
275
|
+
printEndpoints(!!hubVersion);
|
|
276
|
+
});
|
|
277
|
+
program
|
|
278
|
+
.command("stop")
|
|
279
|
+
.description("Stop the local Mesh platform")
|
|
280
|
+
.option("--destroy", "also remove volumes (resets databases and seeds)", false)
|
|
281
|
+
.option("--force", "stop even when the stack was started from a different checkout", false)
|
|
282
|
+
.action((opts) => {
|
|
283
|
+
ensureDockerAvailable();
|
|
284
|
+
const foreign = stackOwnedElsewhere();
|
|
285
|
+
if (foreign && !opts.force) {
|
|
286
|
+
throw new MeshCliError(`The running local platform was started from a different checkout (${foreign}) — another project may be using it.`, { remediation: { command: "mesh stop --force # stop it anyway" } });
|
|
287
|
+
}
|
|
288
|
+
const args = ["down"];
|
|
289
|
+
if (opts.destroy)
|
|
290
|
+
args.push("-v");
|
|
291
|
+
compose(args, { inherit: true, hub: true });
|
|
292
|
+
logSuccess(opts.destroy ? "Local platform stopped and volumes destroyed." : "Local platform stopped.");
|
|
293
|
+
});
|
|
294
|
+
program
|
|
295
|
+
.command("status")
|
|
296
|
+
.description("Show local platform component health, endpoints, and ports")
|
|
297
|
+
.option("--json", "machine-readable output", false)
|
|
298
|
+
.action(async (opts) => {
|
|
299
|
+
ensureDockerAvailable();
|
|
300
|
+
const services = stackServices();
|
|
301
|
+
if (services.length === 0) {
|
|
302
|
+
if (opts.json) {
|
|
303
|
+
console.log(JSON.stringify({ running: false, services: [], endpoints: [] }));
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
throw new MeshCliError("The local Mesh platform is not running.", {
|
|
307
|
+
remediation: { command: "mesh start" },
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
// `status` never started anything, so "is the Hub overlay part of this
|
|
311
|
+
// run?" can only be read off the containers: at least one overlay
|
|
312
|
+
// service actually running. Everything Hub-related keys off that — an
|
|
313
|
+
// overlay container left `exited` by a previous run (a Docker restart,
|
|
314
|
+
// a laptop sleep) is "not started", not "crashed".
|
|
315
|
+
const overlayServices = hubOverlayServices();
|
|
316
|
+
const overlayStarted = hubOverlayRunning(services, overlayServices);
|
|
317
|
+
const notStarted = (s) => !overlayStarted && overlayServices.has(s.name) && s.state === "exited";
|
|
318
|
+
// A *running* hub-api, not merely a hub-api container: a leftover
|
|
319
|
+
// exited one from a previous run would otherwise make status probe Hub
|
|
320
|
+
// endpoints that were never meant to be up and report them down.
|
|
321
|
+
const hasHub = hubApiRunning(services);
|
|
322
|
+
const endpoints = hasHub ? [...STACK_ENDPOINTS, ...hubEndpoints()] : STACK_ENDPOINTS;
|
|
323
|
+
const probes = await Promise.all(endpoints.map(async (endpoint) => ({
|
|
324
|
+
service: endpoint.service,
|
|
325
|
+
label: endpoint.label,
|
|
326
|
+
url: endpoint.url,
|
|
327
|
+
up: await probeEndpoint(endpoint),
|
|
328
|
+
})));
|
|
329
|
+
// The P0 gate: with the fabric up, the 8 KB Advanced-tier round-trip
|
|
330
|
+
// must pass on every status check, not just at seed time.
|
|
331
|
+
let fabric = null;
|
|
332
|
+
if (probes.find((p) => p.service === "ministack")?.up) {
|
|
333
|
+
try {
|
|
334
|
+
await verifyFabric();
|
|
335
|
+
fabric = { ok: true };
|
|
336
|
+
}
|
|
337
|
+
catch (err) {
|
|
338
|
+
fabric = { ok: false, error: err instanceof Error ? err.message : String(err) };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
if (opts.json) {
|
|
342
|
+
console.log(JSON.stringify({
|
|
343
|
+
running: true,
|
|
344
|
+
services,
|
|
345
|
+
endpoints: probes,
|
|
346
|
+
fabric,
|
|
347
|
+
awsEnv: localAwsEnv(),
|
|
348
|
+
}));
|
|
349
|
+
if (fabric && !fabric.ok)
|
|
350
|
+
process.exitCode = 1;
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
console.log(chalk.bold("Containers"));
|
|
354
|
+
for (const service of services) {
|
|
355
|
+
const ok = service.state === "running" &&
|
|
356
|
+
(service.health === undefined || service.health === "healthy");
|
|
357
|
+
const oneShotDone = ONE_SHOT_SERVICES.has(service.name) && service.state === "exited";
|
|
358
|
+
const idle = notStarted(service);
|
|
359
|
+
const icon = ok || oneShotDone ? chalk.green("●") : idle ? chalk.dim("○") : chalk.red("●");
|
|
360
|
+
const health = service.health ? ` (${service.health})` : "";
|
|
361
|
+
const note = idle ? chalk.dim(" (Hub not started this run)") : "";
|
|
362
|
+
console.log(` ${icon} ${service.name.padEnd(22)} ${service.state}${health}${note}`);
|
|
363
|
+
}
|
|
364
|
+
console.log("");
|
|
365
|
+
console.log(chalk.bold("Endpoints"));
|
|
366
|
+
for (const probe of probes) {
|
|
367
|
+
const icon = probe.up ? chalk.green("●") : chalk.red("●");
|
|
368
|
+
console.log(` ${icon} ${probe.label.padEnd(34)} ${chalk.cyan(probe.url)}`);
|
|
369
|
+
}
|
|
370
|
+
if (fabric) {
|
|
371
|
+
const icon = fabric.ok ? chalk.green("●") : chalk.red("●");
|
|
372
|
+
const detail = fabric.ok ? "8 KB Advanced-tier round-trip OK" : fabric.error;
|
|
373
|
+
console.log(` ${icon} ${"AWS fabric check".padEnd(34)} ${chalk.dim(detail ?? "")}`);
|
|
374
|
+
}
|
|
375
|
+
const down = probes.filter((p) => !p.up);
|
|
376
|
+
const crashed = crashedServices(services, { overlayServices, overlayStarted });
|
|
377
|
+
if (fabric && !fabric.ok)
|
|
378
|
+
process.exitCode = 1;
|
|
379
|
+
if (down.length > 0 || crashed.length > 0) {
|
|
380
|
+
console.log("");
|
|
381
|
+
logError(`${down.length + crashed.length} component(s) unhealthy — inspect with: docker compose -p mesh-local logs <service>`);
|
|
382
|
+
process.exitCode = 1;
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
//# sourceMappingURL=index.js.map
|