@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,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mesh hub dev — one-command local Hub over a running dev-local stack (MESH-2275).
|
|
3
|
+
*
|
|
4
|
+
* Launches the CURRENT-CODE Hub (apps/hub api + ui from a mesh-platform
|
|
5
|
+
* checkout) pointed at an existing `mesh dev` session's stack, auto-assembling
|
|
6
|
+
* the env that used to be hand-set (the FUB-demo runbook §6 recipe):
|
|
7
|
+
*
|
|
8
|
+
* HUB_TENANT / HUB_SCOPE_ENV / HUB_SCOPE_TENANTS from the session's platform context
|
|
9
|
+
* TEMPORAL_ADDRESS from the session's tunnel (VPN or SSM)
|
|
10
|
+
* AWS_* from the session's scratch credential_process profile
|
|
11
|
+
* DEV_USER_* / DEV_USER_TOKEN_URL from the session's injected dev identity +
|
|
12
|
+
* per-session token-server (MESH-2039)
|
|
13
|
+
*
|
|
14
|
+
* The `mesh dev` session already resolved all of these — its tmux session
|
|
15
|
+
* environment and state file (`$TMPDIR/mesh-dev-sessions/<name>.json`) are the
|
|
16
|
+
* source of truth; this command only reads them and never mutates the app
|
|
17
|
+
* session.
|
|
18
|
+
*
|
|
19
|
+
* Scoped-tenant enumeration is validated up front: HUB_SCOPE_ENV without a
|
|
20
|
+
* non-empty HUB_SCOPE_TENANTS makes the Hub API silently return zero
|
|
21
|
+
* registrations (apps/hub/api/src/lib/ssm/reader.ts), so that combination is
|
|
22
|
+
* a loud error here, never an empty Hub.
|
|
23
|
+
*/
|
|
24
|
+
import { Command } from "commander";
|
|
25
|
+
import { type SessionState } from "../dev.js";
|
|
26
|
+
/** tmux session the Hub runs in — fixed, one local Hub at a time. */
|
|
27
|
+
export declare const HUB_SESSION = "mesh-hub-dev";
|
|
28
|
+
export declare const DEFAULT_HUB_UI_PORT: number;
|
|
29
|
+
export declare const DEFAULT_HUB_API_PORT = 3002;
|
|
30
|
+
export interface DiscoveredSession {
|
|
31
|
+
name: string;
|
|
32
|
+
state: SessionState;
|
|
33
|
+
}
|
|
34
|
+
export declare function devSessionsDir(): string;
|
|
35
|
+
/** All persisted `mesh dev` session states (unparseable files skipped). */
|
|
36
|
+
export declare function listDevSessions(dir?: string): DiscoveredSession[];
|
|
37
|
+
/**
|
|
38
|
+
* Pick the dev session to point the Hub at.
|
|
39
|
+
*
|
|
40
|
+
* 1. --session <name> wins (error if its state file is missing).
|
|
41
|
+
* 2. The session whose appRoot equals the cwd's app root (both sides come
|
|
42
|
+
* from findAppRoot, so exact equality is the right comparison).
|
|
43
|
+
* 3. A sole running session.
|
|
44
|
+
*
|
|
45
|
+
* Ambiguity (multiple sessions, none matching cwd) is an error listing the
|
|
46
|
+
* candidates — never a silent guess.
|
|
47
|
+
*/
|
|
48
|
+
export declare function pickDevSession(sessions: DiscoveredSession[], opts: {
|
|
49
|
+
session?: string;
|
|
50
|
+
cwdAppRoot?: string | null;
|
|
51
|
+
}): DiscoveredSession;
|
|
52
|
+
/** Parse `tmux show-environment` output (`KEY=value` lines; `-KEY` = unset). */
|
|
53
|
+
export declare function parseTmuxEnv(output: string): Record<string, string>;
|
|
54
|
+
export declare function forwardedSessionVars(sessionEnv: Record<string, string>): Record<string, string>;
|
|
55
|
+
export interface HubDevEnvOptions {
|
|
56
|
+
/** Comma-separated tenant override (--tenants). */
|
|
57
|
+
tenants?: string;
|
|
58
|
+
uiPort: number;
|
|
59
|
+
apiPort: number;
|
|
60
|
+
}
|
|
61
|
+
export interface AssembledHubEnv {
|
|
62
|
+
apiEnv: Record<string, string>;
|
|
63
|
+
uiEnv: Record<string, string>;
|
|
64
|
+
/** Human-readable scope summary for the launch banner. */
|
|
65
|
+
scope: {
|
|
66
|
+
hubTenant: string;
|
|
67
|
+
scopeEnv: string;
|
|
68
|
+
scopeTenants: string[];
|
|
69
|
+
};
|
|
70
|
+
temporalAddress: string;
|
|
71
|
+
warnings: string[];
|
|
72
|
+
/** Informational — things the command is handling itself, not user problems. */
|
|
73
|
+
notes: string[];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Assemble the Hub api/ui env from a discovered dev session. Throws loudly on
|
|
77
|
+
* the combinations that today produce a silently-empty Hub.
|
|
78
|
+
*/
|
|
79
|
+
export declare function assembleHubEnv(session: DiscoveredSession, sessionEnv: Record<string, string>, opts: HubDevEnvOptions): AssembledHubEnv;
|
|
80
|
+
/**
|
|
81
|
+
* Locate the mesh-platform checkout the Hub runs from:
|
|
82
|
+
* --platform-dir → $MESH_PLATFORM_DIR → walk up from cwd (monorepo case).
|
|
83
|
+
*
|
|
84
|
+
* An invalid `--platform-dir` is fatal (the user named it explicitly), but a
|
|
85
|
+
* stale `MESH_PLATFORM_DIR` left over in the shell only warns and falls through
|
|
86
|
+
* to the cwd walk-up — otherwise it would hard-fail runs made from inside a
|
|
87
|
+
* perfectly good checkout.
|
|
88
|
+
*/
|
|
89
|
+
export declare function resolvePlatformDir(explicit: string | undefined, cwd: string, env?: Record<string, string | undefined>): string;
|
|
90
|
+
/**
|
|
91
|
+
* Parse a port option, naming its source in the error. Without this a typo'd
|
|
92
|
+
* `--port` (or a stale non-numeric `MESH_HUB_DEV_PORT` left in the shell) becomes
|
|
93
|
+
* `NaN`, lands in the env file as `PORT=NaN`, and reaches `net.connect` — which
|
|
94
|
+
* throws a raw `ERR_SOCKET_BAD_PORT` instead of an actionable CLI error.
|
|
95
|
+
*/
|
|
96
|
+
export declare function parsePort(raw: string | undefined, fallback: number, source: string): number;
|
|
97
|
+
export declare function redactEnv(env: Record<string, string>): Record<string, string>;
|
|
98
|
+
export declare function registerHubCommands(program: Command): void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(apps/hub api + ui from a mesh-platform
|
|
5
|
+
* checkout) pointed at an existing `mesh dev` session's stack, auto-assembling
|
|
6
|
+
* the env that used to be hand-set (the FUB-demo runbook §6 recipe):
|
|
7
|
+
*
|
|
8
|
+
* HUB_TENANT / HUB_SCOPE_ENV / HUB_SCOPE_TENANTS from the session's platform context
|
|
9
|
+
* TEMPORAL_ADDRESS from the session's tunnel (VPN or SSM)
|
|
10
|
+
* AWS_* from the session's scratch credential_process profile
|
|
11
|
+
* DEV_USER_* / DEV_USER_TOKEN_URL from the session's injected dev identity +
|
|
12
|
+
* per-session token-server (MESH-2039)
|
|
13
|
+
*
|
|
14
|
+
* The `mesh dev` session already resolved all of these — its tmux session
|
|
15
|
+
* environment and state file (`$TMPDIR/mesh-dev-sessions/<name>.json`) are the
|
|
16
|
+
* source of truth; this command only reads them and never mutates the app
|
|
17
|
+
* session.
|
|
18
|
+
*
|
|
19
|
+
* Scoped-tenant enumeration is validated up front: HUB_SCOPE_ENV without a
|
|
20
|
+
* non-empty HUB_SCOPE_TENANTS makes the Hub API silently return zero
|
|
21
|
+
* registrations (apps/hub/api/src/lib/ssm/reader.ts), so that combination is
|
|
22
|
+
* a loud error here, never an empty Hub.
|
|
23
|
+
*/
|
|
24
|
+
import { execFileSync } from "node:child_process";
|
|
25
|
+
import * as fs from "node:fs";
|
|
26
|
+
import * as net from "node:net";
|
|
27
|
+
import * as os from "node:os";
|
|
28
|
+
import * as path from "node:path";
|
|
29
|
+
import chalk from "chalk";
|
|
30
|
+
import { buildLaunchCommand, waitForPort, writeEnvFile } from "../dev-launch.js";
|
|
31
|
+
import { tunnelClientAddress } from "../dev.js";
|
|
32
|
+
import { MeshCliError } from "../../utils/errors.js";
|
|
33
|
+
import { DEFAULT_HUB_PORT } from "../local/stack.js";
|
|
34
|
+
import { logInfo, logSuccess, logWarn } from "../../utils/log.js";
|
|
35
|
+
import { findAppRoot } from "../../utils/pulumi.js";
|
|
36
|
+
/** tmux session the Hub runs in — fixed, one local Hub at a time. */
|
|
37
|
+
export const HUB_SESSION = "mesh-hub-dev";
|
|
38
|
+
// Same default as the containerized Hub (local/stack.ts DEFAULT_HUB_PORT),
|
|
39
|
+
// but a SEPARATE override variable: MESH_HUB_PORT moves the containerized
|
|
40
|
+
// Hub's published port, MESH_HUB_DEV_PORT moves this dev-server Hub. The two
|
|
41
|
+
// are built to run side by side — one shared variable would make "move the
|
|
42
|
+
// containerized Hub off 9000" also move the dev server onto the same port.
|
|
43
|
+
export const DEFAULT_HUB_UI_PORT = Number(DEFAULT_HUB_PORT);
|
|
44
|
+
export const DEFAULT_HUB_API_PORT = 3002;
|
|
45
|
+
export function devSessionsDir() {
|
|
46
|
+
return path.join(os.tmpdir(), "mesh-dev-sessions");
|
|
47
|
+
}
|
|
48
|
+
/** All persisted `mesh dev` session states (unparseable files skipped). */
|
|
49
|
+
export function listDevSessions(dir = devSessionsDir()) {
|
|
50
|
+
if (!fs.existsSync(dir))
|
|
51
|
+
return [];
|
|
52
|
+
const sessions = [];
|
|
53
|
+
for (const entry of fs.readdirSync(dir)) {
|
|
54
|
+
if (!entry.endsWith(".json"))
|
|
55
|
+
continue;
|
|
56
|
+
try {
|
|
57
|
+
const state = JSON.parse(fs.readFileSync(path.join(dir, entry), "utf-8"));
|
|
58
|
+
if (state && typeof state === "object" && state.devOutput) {
|
|
59
|
+
sessions.push({ name: entry.slice(0, -".json".length), state });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// stale/corrupt state file — not a candidate
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return sessions;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Pick the dev session to point the Hub at.
|
|
70
|
+
*
|
|
71
|
+
* 1. --session <name> wins (error if its state file is missing).
|
|
72
|
+
* 2. The session whose appRoot equals the cwd's app root (both sides come
|
|
73
|
+
* from findAppRoot, so exact equality is the right comparison).
|
|
74
|
+
* 3. A sole running session.
|
|
75
|
+
*
|
|
76
|
+
* Ambiguity (multiple sessions, none matching cwd) is an error listing the
|
|
77
|
+
* candidates — never a silent guess.
|
|
78
|
+
*/
|
|
79
|
+
export function pickDevSession(sessions, opts) {
|
|
80
|
+
if (opts.session) {
|
|
81
|
+
const match = sessions.find((s) => s.name === opts.session);
|
|
82
|
+
if (!match) {
|
|
83
|
+
throw new MeshCliError(`No dev session state found for '${opts.session}'. Known sessions: ${sessions.map((s) => s.name).join(", ") || "(none)"}`, { remediation: { command: "mesh dev # from the app repo, to start the stack session" } });
|
|
84
|
+
}
|
|
85
|
+
return match;
|
|
86
|
+
}
|
|
87
|
+
if (sessions.length === 0) {
|
|
88
|
+
throw new MeshCliError("No running `mesh dev` session found — the Hub needs a dev-local stack to observe.", { remediation: { command: "mesh dev # from your app repo, then re-run mesh hub dev" } });
|
|
89
|
+
}
|
|
90
|
+
if (opts.cwdAppRoot) {
|
|
91
|
+
const root = path.resolve(opts.cwdAppRoot);
|
|
92
|
+
const match = sessions.find((s) => path.resolve(s.state.appRoot) === root);
|
|
93
|
+
if (match)
|
|
94
|
+
return match;
|
|
95
|
+
}
|
|
96
|
+
if (sessions.length === 1)
|
|
97
|
+
return sessions[0];
|
|
98
|
+
throw new MeshCliError(`Multiple dev sessions found and none matches this directory: ${sessions
|
|
99
|
+
.map((s) => `${s.name} (${s.state.appRoot})`)
|
|
100
|
+
.join(", ")}`, { remediation: { command: "mesh hub dev --session <name>" } });
|
|
101
|
+
}
|
|
102
|
+
// ── tmux session env ─────────────────────────────────────────────────────────
|
|
103
|
+
/** Parse `tmux show-environment` output (`KEY=value` lines; `-KEY` = unset). */
|
|
104
|
+
export function parseTmuxEnv(output) {
|
|
105
|
+
const env = {};
|
|
106
|
+
for (const line of output.split("\n")) {
|
|
107
|
+
if (!line || line.startsWith("-"))
|
|
108
|
+
continue;
|
|
109
|
+
const eq = line.indexOf("=");
|
|
110
|
+
if (eq <= 0)
|
|
111
|
+
continue;
|
|
112
|
+
env[line.slice(0, eq)] = line.slice(eq + 1);
|
|
113
|
+
}
|
|
114
|
+
return env;
|
|
115
|
+
}
|
|
116
|
+
function readTmuxSessionEnv(sessionName) {
|
|
117
|
+
try {
|
|
118
|
+
const out = execFileSync("tmux", ["show-environment", "-t", sessionName], {
|
|
119
|
+
encoding: "utf-8",
|
|
120
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
121
|
+
});
|
|
122
|
+
return parseTmuxEnv(out);
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return {};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function tmuxSessionExists(sessionName) {
|
|
129
|
+
try {
|
|
130
|
+
execFileSync("tmux", ["has-session", "-t", sessionName], { stdio: "ignore" });
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// ── env assembly ─────────────────────────────────────────────────────────────
|
|
138
|
+
/** Vars carried over verbatim from the dev session's tmux environment. */
|
|
139
|
+
const FORWARD_PREFIXES = ["AWS_", "DEV_USER_"];
|
|
140
|
+
export function forwardedSessionVars(sessionEnv) {
|
|
141
|
+
const out = {};
|
|
142
|
+
for (const [key, value] of Object.entries(sessionEnv)) {
|
|
143
|
+
if (FORWARD_PREFIXES.some((p) => key.startsWith(p)))
|
|
144
|
+
out[key] = value;
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Assemble the Hub api/ui env from a discovered dev session. Throws loudly on
|
|
150
|
+
* the combinations that today produce a silently-empty Hub.
|
|
151
|
+
*/
|
|
152
|
+
export function assembleHubEnv(session, sessionEnv, opts) {
|
|
153
|
+
const warnings = [];
|
|
154
|
+
const notes = [];
|
|
155
|
+
const platform = session.state.devOutput.platform;
|
|
156
|
+
if (!platform) {
|
|
157
|
+
throw new MeshCliError(`Dev session '${session.name}' has no platform context in its state file — cannot derive the Hub scope.`, { remediation: { command: "mesh dev --kill && mesh dev # relaunch to refresh session state" } });
|
|
158
|
+
}
|
|
159
|
+
if (platform.tenant === "local") {
|
|
160
|
+
throw new MeshCliError("This session runs on the full-local platform (`mesh start`) — use its containerized Hub instead of `mesh hub dev`.", { remediation: { command: "mesh start --with-hub # MESH_HUB_PORT=<port> publishes it off 9000" } });
|
|
161
|
+
}
|
|
162
|
+
const hubTenant = platform.name ?? "mesh";
|
|
163
|
+
const scopeEnv = platform.env;
|
|
164
|
+
const scopeTenants = (opts.tenants ?? platform.tenant)
|
|
165
|
+
.split(",")
|
|
166
|
+
.map((t) => t.trim())
|
|
167
|
+
.filter(Boolean);
|
|
168
|
+
if (scopeTenants.length === 0) {
|
|
169
|
+
// The Hub API's scoped SSM reader returns [] with no error when
|
|
170
|
+
// HUB_SCOPE_ENV is set and HUB_SCOPE_TENANTS is empty — every page renders
|
|
171
|
+
// blank with nothing in the logs. Refuse to launch into that state.
|
|
172
|
+
throw new MeshCliError("Tenant scope resolved EMPTY (HUB_SCOPE_ENV set, no HUB_SCOPE_TENANTS) — the Hub would launch but show zero tenants everywhere.", { remediation: { command: "mesh hub dev --tenants <tenant>[,<tenant>…]" } });
|
|
173
|
+
}
|
|
174
|
+
const forwarded = forwardedSessionVars(sessionEnv);
|
|
175
|
+
if (!Object.keys(forwarded).some((k) => k.startsWith("AWS_"))) {
|
|
176
|
+
warnings.push("No AWS_* vars found in the dev session env — the Hub API will fall back to ambient credentials (SSM reads may 403).");
|
|
177
|
+
}
|
|
178
|
+
if (!forwarded.DEV_USER_ID_TOKEN && !forwarded.DEV_USER_ACCESS_TOKEN) {
|
|
179
|
+
warnings.push("No DEV_USER_* identity in the dev session env — the Hub will show an unauthenticated state. Run `mesh login mesh." +
|
|
180
|
+
`${scopeEnv}\` and relaunch \`mesh dev\`.`);
|
|
181
|
+
}
|
|
182
|
+
if (!forwarded.DEV_USER_TOKEN_URL) {
|
|
183
|
+
// Not a warning: the launch path starts a dedicated token-server for this
|
|
184
|
+
// case, so telling the user to restart `mesh dev` would contradict the
|
|
185
|
+
// `✔ Dev-user token-server: …` line printed moments later.
|
|
186
|
+
notes.push("Dev session predates the per-session token-server (MESH-2039) — starting a dedicated one so tokens stay fresh past ~1h.");
|
|
187
|
+
}
|
|
188
|
+
const temporalAddress = sessionEnv.TEMPORAL_ADDRESS ??
|
|
189
|
+
(session.state.devOutput.tunnels["temporal"]
|
|
190
|
+
? tunnelClientAddress(session.state.devOutput.tunnels["temporal"])
|
|
191
|
+
: undefined);
|
|
192
|
+
if (!temporalAddress) {
|
|
193
|
+
throw new MeshCliError(`Dev session '${session.name}' exposes no Temporal tunnel — the Hub can't reach the stack's Temporal.`, { remediation: { command: "mesh dev # relaunch; the session records tunnels.temporal in its state" } });
|
|
194
|
+
}
|
|
195
|
+
const apiEnv = {
|
|
196
|
+
...forwarded,
|
|
197
|
+
PORT: String(opts.apiPort),
|
|
198
|
+
TEMPORAL_ADDRESS: temporalAddress,
|
|
199
|
+
HUB_TENANT: hubTenant,
|
|
200
|
+
HUB_SCOPE_ENV: scopeEnv,
|
|
201
|
+
HUB_SCOPE_TENANTS: scopeTenants.join(","),
|
|
202
|
+
};
|
|
203
|
+
const uiEnv = {
|
|
204
|
+
...forwarded,
|
|
205
|
+
PORT: String(opts.uiPort),
|
|
206
|
+
API_URL: `http://localhost:${opts.apiPort}`,
|
|
207
|
+
HUB_TENANT: hubTenant,
|
|
208
|
+
// UI namespace parsing + session defaults land on the scoped tenant.
|
|
209
|
+
DEFAULT_ORG: scopeTenants[0],
|
|
210
|
+
DEFAULT_ENV: scopeEnv,
|
|
211
|
+
};
|
|
212
|
+
return { apiEnv, uiEnv, scope: { hubTenant, scopeEnv, scopeTenants }, temporalAddress, warnings, notes };
|
|
213
|
+
}
|
|
214
|
+
// ── platform checkout resolution ────────────────────────────────────────────
|
|
215
|
+
/** Does `dir` look like a mesh-platform checkout root (has the Hub app)? */
|
|
216
|
+
function isPlatformRoot(dir) {
|
|
217
|
+
return (fs.existsSync(path.join(dir, "apps", "hub", "api", "package.json")) &&
|
|
218
|
+
fs.existsSync(path.join(dir, "apps", "hub", "ui", "package.json")));
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Locate the mesh-platform checkout the Hub runs from:
|
|
222
|
+
* --platform-dir → $MESH_PLATFORM_DIR → walk up from cwd (monorepo case).
|
|
223
|
+
*
|
|
224
|
+
* An invalid `--platform-dir` is fatal (the user named it explicitly), but a
|
|
225
|
+
* stale `MESH_PLATFORM_DIR` left over in the shell only warns and falls through
|
|
226
|
+
* to the cwd walk-up — otherwise it would hard-fail runs made from inside a
|
|
227
|
+
* perfectly good checkout.
|
|
228
|
+
*/
|
|
229
|
+
export function resolvePlatformDir(explicit, cwd, env = process.env) {
|
|
230
|
+
if (explicit) {
|
|
231
|
+
const resolved = path.resolve(explicit);
|
|
232
|
+
if (isPlatformRoot(resolved))
|
|
233
|
+
return resolved;
|
|
234
|
+
throw new MeshCliError(`'${resolved}' is not a mesh-platform checkout (apps/hub/{api,ui} not found).`, { remediation: { command: "mesh hub dev --platform-dir <path-to-mesh-platform>" } });
|
|
235
|
+
}
|
|
236
|
+
if (env.MESH_PLATFORM_DIR) {
|
|
237
|
+
const resolved = path.resolve(env.MESH_PLATFORM_DIR);
|
|
238
|
+
if (isPlatformRoot(resolved))
|
|
239
|
+
return resolved;
|
|
240
|
+
logWarn(`MESH_PLATFORM_DIR='${resolved}' is not a mesh-platform checkout (apps/hub/{api,ui} not found) — ignoring it.`);
|
|
241
|
+
}
|
|
242
|
+
let dir = path.resolve(cwd);
|
|
243
|
+
for (;;) {
|
|
244
|
+
if (isPlatformRoot(dir))
|
|
245
|
+
return dir;
|
|
246
|
+
const parent = path.dirname(dir);
|
|
247
|
+
if (parent === dir)
|
|
248
|
+
break;
|
|
249
|
+
dir = parent;
|
|
250
|
+
}
|
|
251
|
+
throw new MeshCliError("Can't find a mesh-platform checkout (the Hub's source). Run from inside one, or point at one explicitly.", {
|
|
252
|
+
remediation: {
|
|
253
|
+
command: "mesh hub dev --platform-dir <path-to-mesh-platform> # or export MESH_PLATFORM_DIR",
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
// ── token server ─────────────────────────────────────────────────────────────
|
|
258
|
+
async function findFreePort() {
|
|
259
|
+
return new Promise((resolve, reject) => {
|
|
260
|
+
const server = net.createServer();
|
|
261
|
+
server.listen(0, "127.0.0.1", () => {
|
|
262
|
+
const address = server.address();
|
|
263
|
+
server.close(() => typeof address === "object" && address ? resolve(address.port) : reject(new Error("no port")));
|
|
264
|
+
});
|
|
265
|
+
server.on("error", reject);
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
function isPortListening(port) {
|
|
269
|
+
return new Promise((resolve) => {
|
|
270
|
+
const socket = net.connect({ host: "127.0.0.1", port, timeout: 400 });
|
|
271
|
+
const done = (ok) => {
|
|
272
|
+
socket.removeAllListeners();
|
|
273
|
+
socket.destroy();
|
|
274
|
+
resolve(ok);
|
|
275
|
+
};
|
|
276
|
+
socket.once("connect", () => done(true));
|
|
277
|
+
socket.once("timeout", () => done(false));
|
|
278
|
+
socket.once("error", () => done(false));
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
// ── env file dir ─────────────────────────────────────────────────────────────
|
|
282
|
+
function hubEnvDir() {
|
|
283
|
+
return path.join(os.tmpdir(), "mesh-dev-sessions", HUB_SESSION);
|
|
284
|
+
}
|
|
285
|
+
// ── port parsing ─────────────────────────────────────────────────────────────
|
|
286
|
+
/**
|
|
287
|
+
* Parse a port option, naming its source in the error. Without this a typo'd
|
|
288
|
+
* `--port` (or a stale non-numeric `MESH_HUB_DEV_PORT` left in the shell) becomes
|
|
289
|
+
* `NaN`, lands in the env file as `PORT=NaN`, and reaches `net.connect` — which
|
|
290
|
+
* throws a raw `ERR_SOCKET_BAD_PORT` instead of an actionable CLI error.
|
|
291
|
+
*/
|
|
292
|
+
export function parsePort(raw, fallback, source) {
|
|
293
|
+
if (raw === undefined)
|
|
294
|
+
return fallback;
|
|
295
|
+
const n = Number(raw);
|
|
296
|
+
if (!Number.isInteger(n) || n < 1 || n > 65535) {
|
|
297
|
+
throw new MeshCliError(`Invalid port '${raw}' from ${source} — expected an integer 1–65535.`, {
|
|
298
|
+
remediation: { command: `mesh hub dev ${source.startsWith("--") ? source : "--port"} <1-65535>` },
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
return n;
|
|
302
|
+
}
|
|
303
|
+
// ── redaction for --print-env ────────────────────────────────────────────────
|
|
304
|
+
const SENSITIVE_RE = /TOKEN|SECRET|KEY|PASSWORD/i;
|
|
305
|
+
export function redactEnv(env) {
|
|
306
|
+
const out = {};
|
|
307
|
+
for (const [key, value] of Object.entries(env)) {
|
|
308
|
+
// URLs named *_TOKEN_URL etc. are locators, not credentials.
|
|
309
|
+
const sensitive = SENSITIVE_RE.test(key) && !key.endsWith("_URL") && !key.endsWith("_FILE");
|
|
310
|
+
out[key] = sensitive ? `<redacted ${value.length} chars>` : value;
|
|
311
|
+
}
|
|
312
|
+
return out;
|
|
313
|
+
}
|
|
314
|
+
async function hubDevAction(opts) {
|
|
315
|
+
if (opts.kill) {
|
|
316
|
+
if (tmuxSessionExists(HUB_SESSION)) {
|
|
317
|
+
execFileSync("tmux", ["kill-session", "-t", HUB_SESSION], { stdio: "ignore" });
|
|
318
|
+
fs.rmSync(hubEnvDir(), { recursive: true, force: true });
|
|
319
|
+
logSuccess(`Killed Hub session '${HUB_SESSION}'.`);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
logInfo(`No '${HUB_SESSION}' tmux session running.`);
|
|
323
|
+
}
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const uiPort = opts.port
|
|
327
|
+
? parsePort(opts.port, DEFAULT_HUB_UI_PORT, "--port")
|
|
328
|
+
: parsePort(process.env.MESH_HUB_DEV_PORT, DEFAULT_HUB_UI_PORT, "MESH_HUB_DEV_PORT");
|
|
329
|
+
const apiPort = parsePort(opts.apiPort, DEFAULT_HUB_API_PORT, "--api-port");
|
|
330
|
+
// 1. The Hub's source.
|
|
331
|
+
const platformDir = resolvePlatformDir(opts.platformDir, process.cwd());
|
|
332
|
+
// 2. The dev-local stack session to observe.
|
|
333
|
+
const cwdAppRoot = findAppRoot(process.cwd());
|
|
334
|
+
const session = pickDevSession(listDevSessions(), { session: opts.session, cwdAppRoot });
|
|
335
|
+
if (!tmuxSessionExists(session.name)) {
|
|
336
|
+
throw new MeshCliError(`Dev session '${session.name}' has a state file but no live tmux session — its tunnels and token-server are gone.`, { remediation: { command: `mesh dev # from ${session.state.appRoot}` } });
|
|
337
|
+
}
|
|
338
|
+
const sessionEnv = readTmuxSessionEnv(session.name);
|
|
339
|
+
// 3. Assemble the env (loud failures instead of a silently-empty Hub).
|
|
340
|
+
const assembled = assembleHubEnv(session, sessionEnv, { tenants: opts.tenants, uiPort, apiPort });
|
|
341
|
+
if (opts.printEnv) {
|
|
342
|
+
console.log(chalk.bold("\nhub-api env:"));
|
|
343
|
+
for (const [k, v] of Object.entries(redactEnv(assembled.apiEnv)))
|
|
344
|
+
console.log(` ${k}=${v}`);
|
|
345
|
+
console.log(chalk.bold("\nhub-ui env:"));
|
|
346
|
+
for (const [k, v] of Object.entries(redactEnv(assembled.uiEnv)))
|
|
347
|
+
console.log(` ${k}=${v}`);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (tmuxSessionExists(HUB_SESSION)) {
|
|
351
|
+
throw new MeshCliError(`A '${HUB_SESSION}' tmux session is already running.`, {
|
|
352
|
+
remediation: { command: "mesh hub dev --kill # then re-run mesh hub dev" },
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
// Pre-flight the ports. Without this, a port already owned by ANOTHER Hub
|
|
356
|
+
// (the containerized `mesh start` one is fixed at :9000, or a plain
|
|
357
|
+
// `mesh dev` from apps/hub holds :3002) makes the post-launch waitForPort
|
|
358
|
+
// succeed against that other process: vite has no strictPort in its config
|
|
359
|
+
// so the UI silently falls forward to the next free port, and we would then
|
|
360
|
+
// print "Hub → http://localhost:9000" pointing at someone else's Hub — the
|
|
361
|
+
// exact silently-wrong-Hub failure this command exists to remove.
|
|
362
|
+
for (const [label, port, flag] of [
|
|
363
|
+
["API", apiPort, "--api-port"],
|
|
364
|
+
["UI", uiPort, "--port"],
|
|
365
|
+
]) {
|
|
366
|
+
if (await isPortListening(port)) {
|
|
367
|
+
throw new MeshCliError(`Hub ${label} port ${port} is already in use — another process (a \`mesh start\` Hub, or another \`mesh hub dev\`) is listening there.`, { remediation: { command: `mesh hub dev ${flag} <free-port> # or free :${port} first` } });
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
logInfo(`Dev session : ${session.name} (${session.state.appRoot})`);
|
|
371
|
+
logInfo(`Hub source : ${platformDir}`);
|
|
372
|
+
logInfo(`Scope : HUB_TENANT=${assembled.scope.hubTenant} HUB_SCOPE_ENV=${assembled.scope.scopeEnv} HUB_SCOPE_TENANTS=${assembled.scope.scopeTenants.join(",")}`);
|
|
373
|
+
logInfo(`Temporal : ${assembled.temporalAddress}`);
|
|
374
|
+
for (const note of assembled.notes)
|
|
375
|
+
logInfo(note);
|
|
376
|
+
for (const warning of assembled.warnings)
|
|
377
|
+
logWarn(warning);
|
|
378
|
+
const apiDir = path.join(platformDir, "apps", "hub", "api");
|
|
379
|
+
const uiDir = path.join(platformDir, "apps", "hub", "ui");
|
|
380
|
+
execFileSync("tmux", ["new-session", "-d", "-s", HUB_SESSION, "-n", "api", "-c", apiDir]);
|
|
381
|
+
// Fresh dev tokens: reuse the app session's token-server when it has one;
|
|
382
|
+
// otherwise run our own (MESH-2039 pattern) so the Hub survives past the
|
|
383
|
+
// ~1h Zitadel horizon either way.
|
|
384
|
+
if (!assembled.apiEnv.DEV_USER_TOKEN_URL && assembled.apiEnv.DEV_USER_ID_TOKEN) {
|
|
385
|
+
const platform = session.state.devOutput.platform;
|
|
386
|
+
const credContext = `mesh.${platform.env}`;
|
|
387
|
+
const tokenPort = await findFreePort();
|
|
388
|
+
const tokenUrl = `http://127.0.0.1:${tokenPort}`;
|
|
389
|
+
execFileSync("tmux", ["new-window", "-t", HUB_SESSION, "-n", "token-server", "-c", platformDir]);
|
|
390
|
+
execFileSync("tmux", ["set-option", "-t", `${HUB_SESSION}:token-server`, "remain-on-exit", "on"], {
|
|
391
|
+
stdio: "ignore",
|
|
392
|
+
});
|
|
393
|
+
execFileSync("tmux", [
|
|
394
|
+
"send-keys",
|
|
395
|
+
"-t",
|
|
396
|
+
`${HUB_SESSION}:token-server`,
|
|
397
|
+
`npx mesh dev __token-server ${tokenPort} ${credContext}`,
|
|
398
|
+
"Enter",
|
|
399
|
+
]);
|
|
400
|
+
for (let i = 0; i < 15 && !(await isPortListening(tokenPort)); i++) {
|
|
401
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
402
|
+
}
|
|
403
|
+
assembled.apiEnv.DEV_USER_TOKEN_URL = tokenUrl;
|
|
404
|
+
assembled.uiEnv.DEV_USER_TOKEN_URL = tokenUrl;
|
|
405
|
+
logSuccess(`Dev-user token-server: ${tokenUrl} (context ${credContext})`);
|
|
406
|
+
}
|
|
407
|
+
const launch = (window, dir, env, cmd, createWindow) => {
|
|
408
|
+
const envFile = path.join(hubEnvDir(), `${window}.env.sh`);
|
|
409
|
+
writeEnvFile(envFile, env);
|
|
410
|
+
if (createWindow) {
|
|
411
|
+
execFileSync("tmux", ["new-window", "-t", HUB_SESSION, "-n", window, "-c", dir]);
|
|
412
|
+
}
|
|
413
|
+
execFileSync("tmux", ["set-option", "-t", `${HUB_SESSION}:${window}`, "remain-on-exit", "on"], {
|
|
414
|
+
stdio: "ignore",
|
|
415
|
+
});
|
|
416
|
+
execFileSync("tmux", ["send-keys", "-t", `${HUB_SESSION}:${window}`, buildLaunchCommand(envFile, dir, cmd), "Enter"]);
|
|
417
|
+
};
|
|
418
|
+
launch("api", apiDir, assembled.apiEnv, "pnpm dev", false);
|
|
419
|
+
// --strictPort: the Hub UI's vite config sets `port` but NOT `strictPort`, so
|
|
420
|
+
// vite would silently fall forward to the next free port and we'd advertise a
|
|
421
|
+
// URL serving something else. Fail instead — the pre-flight above already
|
|
422
|
+
// rejects a taken port, this closes the race. (`host: true` is already in
|
|
423
|
+
// apps/hub/ui/vite.config.ts, so the tailnet binding needs no flag here.)
|
|
424
|
+
launch("ui", uiDir, assembled.uiEnv, `pnpm dev -- --port ${uiPort} --strictPort`, true);
|
|
425
|
+
logInfo("Waiting for the Hub to come up…");
|
|
426
|
+
const apiUp = await waitForPort("127.0.0.1", apiPort, 90_000);
|
|
427
|
+
const uiUp = apiUp && (await waitForPort("127.0.0.1", uiPort, 90_000));
|
|
428
|
+
if (!apiUp || !uiUp) {
|
|
429
|
+
throw new MeshCliError(`Hub ${apiUp ? "UI" : "API"} did not start listening (api :${apiPort}, ui :${uiPort}).`, { remediation: { command: `tmux attach -t ${HUB_SESSION} # inspect the ${apiUp ? "ui" : "api"} window` } });
|
|
430
|
+
}
|
|
431
|
+
console.log("");
|
|
432
|
+
logSuccess(`Mesh Hub (dev-local scope ${assembled.scope.scopeTenants.join(",")} @ ${assembled.scope.scopeEnv})`);
|
|
433
|
+
console.log(` ${chalk.bold.cyan(`http://localhost:${uiPort}`)} (also reachable on your tailnet)`);
|
|
434
|
+
console.log(` api http://localhost:${apiPort}`);
|
|
435
|
+
console.log(` logs tmux attach -t ${HUB_SESSION}`);
|
|
436
|
+
console.log(` stop mesh hub dev --kill`);
|
|
437
|
+
}
|
|
438
|
+
export function registerHubCommands(program) {
|
|
439
|
+
const hub = program.command("hub").description("Local Hub over dev-local stacks");
|
|
440
|
+
hub
|
|
441
|
+
.command("dev")
|
|
442
|
+
.description("Launch the current-code Hub (api + ui) against a running `mesh dev` session — env auto-assembled, zero hand-set vars")
|
|
443
|
+
.option("--session <name>", "dev session to observe (default: auto-detect from cwd)")
|
|
444
|
+
.option("--tenants <list>", "comma-separated HUB_SCOPE_TENANTS override (default: the session's tenant)")
|
|
445
|
+
.option("--port <port>", `Hub UI host port (default: $MESH_HUB_DEV_PORT or ${DEFAULT_HUB_UI_PORT})`)
|
|
446
|
+
.option("--api-port <port>", `Hub API port (default: ${DEFAULT_HUB_API_PORT})`)
|
|
447
|
+
.option("--platform-dir <dir>", "mesh-platform checkout to run the Hub from (default: $MESH_PLATFORM_DIR or walk up from cwd)")
|
|
448
|
+
.option("--print-env", "print the assembled env (secrets redacted) and exit without launching")
|
|
449
|
+
.option("--kill", "tear down the running Hub session")
|
|
450
|
+
.action(hubDevAction);
|
|
451
|
+
}
|
|
452
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/commands/hub/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAqB,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,qEAAqE;AACrE,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAE1C,2EAA2E;AAC3E,0EAA0E;AAC1E,6EAA6E;AA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,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,iCAAiC,CAAC,CAAC;IAClF,GAAG;SACA,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CACV,sHAAsH,CACvH;SACA,MAAM,CAAC,kBAAkB,EAAE,wDAAwD,CAAC;SACpF,MAAM,CAAC,kBAAkB,EAAE,4EAA4E,CAAC;SACxG,MAAM,CAAC,eAAe,EAAE,oDAAoD,mBAAmB,GAAG,CAAC;SACnG,MAAM,CAAC,mBAAmB,EAAE,0BAA0B,oBAAoB,GAAG,CAAC;SAC9E,MAAM,CAAC,sBAAsB,EAAE,8FAA8F,CAAC;SAC9H,MAAM,CAAC,aAAa,EAAE,uEAAuE,CAAC;SAC9F,MAAM,CAAC,QAAQ,EAAE,mCAAmC,CAAC;SACrD,MAAM,CAAC,YAAY,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mesh init app-tenant — the doctor for a tenant apps repo (design §3.1,
|
|
3
|
+
* AC A1–A3).
|
|
4
|
+
*
|
|
5
|
+
* Runs a read-only check pipeline; every failure names the exact `mesh`
|
|
6
|
+
* command that fixes it (never a person — A2). Re-running IS the doctor
|
|
7
|
+
* (A3): exit 0 iff everything passes. `--json` is the agent surface (A5);
|
|
8
|
+
* `--fix` applies the developer-scope fixes directly (registry token
|
|
9
|
+
* refresh, skills sync) and leaves operator actions as remediations.
|
|
10
|
+
*
|
|
11
|
+
* Checks (API-first; local platform = the same Hub API on localhost):
|
|
12
|
+
* 1. CLI auth — cached `mesh login` credentials for the context
|
|
13
|
+
* 2. Registry access — the CodeArtifact token in ~/.npmrc is accepted by the
|
|
14
|
+
* registry (a live probe, not a substring match — an
|
|
15
|
+
* expired token used to report `pass`); local: skipped
|
|
16
|
+
* 2b. Public npm not hijacked — no unscoped `registry=<codeartifact>` in
|
|
17
|
+
* ~/.npmrc making CodeArtifact the DEFAULT registry
|
|
18
|
+
* 3. Platform tenant — Hub API /tenants (the platform registry)
|
|
19
|
+
* 4. App tenant — tenant present in the Hub registry
|
|
20
|
+
* 5. Deployer role — mesh:deployerRole config present (cloud contexts)
|
|
21
|
+
* 6. Repo shape — pnpm workspace + apps layout create-app expects
|
|
22
|
+
* 7. Skills wired — `mesh skills sync --check`
|
|
23
|
+
*/
|
|
24
|
+
import { Command } from "commander";
|
|
25
|
+
import { probeRegistryToken } from "../utils/auth-preflight.js";
|
|
26
|
+
type CheckStatus = "pass" | "warn" | "fail";
|
|
27
|
+
interface CheckResult {
|
|
28
|
+
name: string;
|
|
29
|
+
status: CheckStatus;
|
|
30
|
+
detail: string;
|
|
31
|
+
/** The exact command that remediates (A2: commands, never people). */
|
|
32
|
+
fix?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The remediation string the doctor prints for a registry fault. It must render
|
|
36
|
+
* the command `--fix` actually executes: `runRegistryLogin` is called with the
|
|
37
|
+
* doctor's own `--profile` (or none), so advertising a hardcoded
|
|
38
|
+
* `--profile mesh-dev` would be a command the doctor never runs.
|
|
39
|
+
*/
|
|
40
|
+
export declare function registryFixCommand(profile?: string, context?: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* The two registry checks, exported for tests.
|
|
43
|
+
*
|
|
44
|
+
* 1. **Registry access** — does the token in ~/.npmrc actually work? The old
|
|
45
|
+
* check was `content.includes("codeartifact")`, which reports `pass` for a
|
|
46
|
+
* token that expired two days ago. `probeRegistryToken` asks the registry.
|
|
47
|
+
* 2. **Public npm not hijacked** — is there an *unscoped* `registry=` line
|
|
48
|
+
* pointing at CodeArtifact? A bare `aws codeartifact login` (no
|
|
49
|
+
* `--namespace @mesh-tech`) writes one, which routes every public package
|
|
50
|
+
* through CodeArtifact and makes the whole of npm 401 at the 12h token
|
|
51
|
+
* expiry. `mesh registry login` now removes it, so it is the fix for both.
|
|
52
|
+
*/
|
|
53
|
+
export declare function registryChecks(args: {
|
|
54
|
+
context: string;
|
|
55
|
+
fix: boolean;
|
|
56
|
+
/** AWS SSO profile to log in with — threaded from `mesh init app-tenant --profile`. */
|
|
57
|
+
profile?: string;
|
|
58
|
+
/** Test seam — defaults to the real network probe against ~/.npmrc. */
|
|
59
|
+
probe?: typeof probeRegistryToken;
|
|
60
|
+
/** Test seam — defaults to `runRegistryLogin`. */
|
|
61
|
+
login?: (context: string) => Promise<void>;
|
|
62
|
+
}): Promise<CheckResult[]>;
|
|
63
|
+
export declare function registerInitCommands(program: Command): void;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=init.d.ts.map
|