@mesh-tech/mesh-cli 0.1.1 → 0.12.1
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 +20878 -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 +28 -0
- package/dist/src/commands/install-shim.d.ts.map +1 -0
- package/dist/src/commands/install-shim.js +191 -0
- package/dist/src/commands/install-shim.js.map +1 -0
- package/dist/src/commands/local/auth-provision.d.ts +71 -0
- package/dist/src/commands/local/auth-provision.d.ts.map +1 -0
- package/dist/src/commands/local/auth-provision.js +286 -0
- package/dist/src/commands/local/auth-provision.js.map +1 -0
- package/dist/src/commands/local/dev-local.d.ts +97 -0
- package/dist/src/commands/local/dev-local.d.ts.map +1 -0
- package/dist/src/commands/local/dev-local.js +306 -0
- package/dist/src/commands/local/dev-local.js.map +1 -0
- package/dist/src/commands/local/docker-runner.d.ts +37 -0
- package/dist/src/commands/local/docker-runner.d.ts.map +1 -0
- package/dist/src/commands/local/docker-runner.js +104 -0
- package/dist/src/commands/local/docker-runner.js.map +1 -0
- package/dist/src/commands/local/helpers.d.ts +22 -0
- package/dist/src/commands/local/helpers.d.ts.map +1 -0
- package/dist/src/commands/local/helpers.js +46 -0
- package/dist/src/commands/local/helpers.js.map +1 -0
- package/dist/src/commands/local/hub-local.d.ts +51 -0
- package/dist/src/commands/local/hub-local.d.ts.map +1 -0
- package/dist/src/commands/local/hub-local.js +197 -0
- package/dist/src/commands/local/hub-local.js.map +1 -0
- package/dist/src/commands/local/index.d.ts +23 -0
- package/dist/src/commands/local/index.d.ts.map +1 -0
- package/dist/src/commands/local/index.js +386 -0
- package/dist/src/commands/local/index.js.map +1 -0
- package/dist/src/commands/local/mocks.d.ts +361 -0
- package/dist/src/commands/local/mocks.d.ts.map +1 -0
- package/dist/src/commands/local/mocks.js +756 -0
- package/dist/src/commands/local/mocks.js.map +1 -0
- package/dist/src/commands/local/seed-zitadel.d.ts +151 -0
- package/dist/src/commands/local/seed-zitadel.d.ts.map +1 -0
- package/dist/src/commands/local/seed-zitadel.js +408 -0
- package/dist/src/commands/local/seed-zitadel.js.map +1 -0
- package/dist/src/commands/local/seed.d.ts +106 -0
- package/dist/src/commands/local/seed.d.ts.map +1 -0
- package/dist/src/commands/local/seed.js +252 -0
- package/dist/src/commands/local/seed.js.map +1 -0
- package/dist/src/commands/local/stack.d.ts +173 -0
- package/dist/src/commands/local/stack.d.ts.map +1 -0
- package/dist/src/commands/local/stack.js +499 -0
- package/dist/src/commands/local/stack.js.map +1 -0
- package/dist/src/commands/login.d.ts +256 -12
- package/dist/src/commands/login.d.ts.map +1 -1
- package/dist/src/commands/login.js +978 -50
- package/dist/src/commands/login.js.map +1 -1
- package/dist/src/commands/peer-addressing.d.ts +51 -0
- package/dist/src/commands/peer-addressing.d.ts.map +1 -0
- package/dist/src/commands/peer-addressing.js +64 -0
- package/dist/src/commands/peer-addressing.js.map +1 -0
- package/dist/src/commands/port-ownership.d.ts +69 -0
- package/dist/src/commands/port-ownership.d.ts.map +1 -0
- package/dist/src/commands/port-ownership.js +161 -0
- package/dist/src/commands/port-ownership.js.map +1 -0
- package/dist/src/commands/registry-publish.d.ts +3 -0
- package/dist/src/commands/registry-publish.d.ts.map +1 -0
- package/dist/src/commands/registry-publish.js +161 -0
- package/dist/src/commands/registry-publish.js.map +1 -0
- package/dist/src/commands/registry.d.ts +146 -2
- package/dist/src/commands/registry.d.ts.map +1 -1
- package/dist/src/commands/registry.js +541 -85
- package/dist/src/commands/registry.js.map +1 -1
- package/dist/src/commands/secrets/index.d.ts.map +1 -1
- package/dist/src/commands/secrets/index.js +15 -1
- package/dist/src/commands/secrets/index.js.map +1 -1
- package/dist/src/commands/secrets/migrate-config.d.ts +24 -0
- package/dist/src/commands/secrets/migrate-config.d.ts.map +1 -0
- package/dist/src/commands/secrets/migrate-config.js +277 -0
- package/dist/src/commands/secrets/migrate-config.js.map +1 -0
- package/dist/src/commands/secrets/set.d.ts +1 -0
- package/dist/src/commands/secrets/set.d.ts.map +1 -1
- package/dist/src/commands/secrets/set.js +96 -2
- package/dist/src/commands/secrets/set.js.map +1 -1
- package/dist/src/commands/skills.d.ts +34 -0
- package/dist/src/commands/skills.d.ts.map +1 -0
- package/dist/src/commands/skills.js +207 -0
- package/dist/src/commands/skills.js.map +1 -0
- package/dist/src/commands/stack.d.ts.map +1 -1
- package/dist/src/commands/stack.js +361 -23
- package/dist/src/commands/stack.js.map +1 -1
- package/dist/src/commands/temporal.d.ts +15 -0
- package/dist/src/commands/temporal.d.ts.map +1 -0
- package/dist/src/commands/temporal.js +781 -0
- package/dist/src/commands/temporal.js.map +1 -0
- package/dist/src/commands/tenant.d.ts +56 -0
- package/dist/src/commands/tenant.d.ts.map +1 -0
- package/dist/src/commands/tenant.js +233 -0
- package/dist/src/commands/tenant.js.map +1 -0
- package/dist/src/commands/tunnel/index.d.ts +49 -3
- package/dist/src/commands/tunnel/index.d.ts.map +1 -1
- package/dist/src/commands/tunnel/index.js +331 -8
- package/dist/src/commands/tunnel/index.js.map +1 -1
- package/dist/src/commands/vcs/clone.d.ts +3 -0
- package/dist/src/commands/vcs/clone.d.ts.map +1 -0
- package/dist/src/commands/vcs/clone.js +20 -0
- package/dist/src/commands/vcs/clone.js.map +1 -0
- package/dist/src/commands/vcs/common.d.ts +21 -0
- package/dist/src/commands/vcs/common.d.ts.map +1 -0
- package/dist/src/commands/vcs/common.js +62 -0
- package/dist/src/commands/vcs/common.js.map +1 -0
- package/dist/src/commands/vcs/drafts.d.ts +13 -0
- package/dist/src/commands/vcs/drafts.d.ts.map +1 -0
- package/dist/src/commands/vcs/drafts.js +45 -0
- package/dist/src/commands/vcs/drafts.js.map +1 -0
- package/dist/src/commands/vcs/get.d.ts +8 -0
- package/dist/src/commands/vcs/get.d.ts.map +1 -0
- package/dist/src/commands/vcs/get.js +61 -0
- package/dist/src/commands/vcs/get.js.map +1 -0
- package/dist/src/commands/vcs/index.d.ts +3 -0
- package/dist/src/commands/vcs/index.d.ts.map +1 -0
- package/dist/src/commands/vcs/index.js +58 -0
- package/dist/src/commands/vcs/index.js.map +1 -0
- package/dist/src/commands/vcs/propose.d.ts +23 -0
- package/dist/src/commands/vcs/propose.d.ts.map +1 -0
- package/dist/src/commands/vcs/propose.js +94 -0
- package/dist/src/commands/vcs/propose.js.map +1 -0
- package/dist/src/commands/vcs/review.d.ts +15 -0
- package/dist/src/commands/vcs/review.d.ts.map +1 -0
- package/dist/src/commands/vcs/review.js +35 -0
- package/dist/src/commands/vcs/review.js.map +1 -0
- package/dist/src/commands/vcs-enrich.d.ts +15 -0
- package/dist/src/commands/vcs-enrich.d.ts.map +1 -0
- package/dist/src/commands/vcs-enrich.js +28 -0
- package/dist/src/commands/vcs-enrich.js.map +1 -0
- package/dist/src/commands/vpn/index.d.ts +24 -0
- package/dist/src/commands/vpn/index.d.ts.map +1 -0
- package/dist/src/commands/vpn/index.js +543 -0
- package/dist/src/commands/vpn/index.js.map +1 -0
- package/dist/src/commands/vpn/tunnel.d.ts +11 -0
- package/dist/src/commands/vpn/tunnel.d.ts.map +1 -0
- package/dist/src/commands/vpn/tunnel.js +188 -0
- package/dist/src/commands/vpn/tunnel.js.map +1 -0
- package/dist/src/commands/workflow.d.ts +24 -0
- package/dist/src/commands/workflow.d.ts.map +1 -0
- package/dist/src/commands/workflow.js +577 -0
- package/dist/src/commands/workflow.js.map +1 -0
- package/dist/src/docs/assemble.d.ts +217 -0
- package/dist/src/docs/assemble.d.ts.map +1 -0
- package/dist/src/docs/assemble.js +739 -0
- package/dist/src/docs/assemble.js.map +1 -0
- package/dist/src/docs/cli-reference.d.ts +93 -0
- package/dist/src/docs/cli-reference.d.ts.map +1 -0
- package/dist/src/docs/cli-reference.js +256 -0
- package/dist/src/docs/cli-reference.js.map +1 -0
- package/dist/src/docs/discover.d.ts +60 -0
- package/dist/src/docs/discover.d.ts.map +1 -0
- package/dist/src/docs/discover.js +233 -0
- package/dist/src/docs/discover.js.map +1 -0
- package/dist/src/docs/portal.d.ts +79 -0
- package/dist/src/docs/portal.d.ts.map +1 -0
- package/dist/src/docs/portal.js +242 -0
- package/dist/src/docs/portal.js.map +1 -0
- package/dist/src/docs/registry-docs.d.ts +43 -0
- package/dist/src/docs/registry-docs.d.ts.map +1 -0
- package/dist/src/docs/registry-docs.js +138 -0
- package/dist/src/docs/registry-docs.js.map +1 -0
- package/dist/src/docs/schema.d.ts +48 -0
- package/dist/src/docs/schema.d.ts.map +1 -0
- package/dist/src/docs/schema.js +96 -0
- package/dist/src/docs/schema.js.map +1 -0
- package/dist/src/docs/serve.d.ts +27 -0
- package/dist/src/docs/serve.d.ts.map +1 -0
- package/dist/src/docs/serve.js +102 -0
- package/dist/src/docs/serve.js.map +1 -0
- package/dist/src/docs/start.d.ts +80 -0
- package/dist/src/docs/start.d.ts.map +1 -0
- package/dist/src/docs/start.js +313 -0
- package/dist/src/docs/start.js.map +1 -0
- package/dist/src/eval/agent-eval.d.mts +14 -0
- package/dist/src/eval/agent-eval.d.mts.map +1 -0
- package/dist/src/eval/agent-eval.mjs +273 -0
- package/dist/src/eval/agent-eval.mjs.map +1 -0
- package/dist/src/index.js +624 -7
- package/dist/src/index.js.map +7 -1
- package/dist/src/program.d.ts +26 -0
- package/dist/src/program.d.ts.map +1 -0
- package/dist/src/program.js +76 -0
- package/dist/src/program.js.map +1 -0
- package/dist/src/utils/auth-preflight.d.ts +159 -0
- package/dist/src/utils/auth-preflight.d.ts.map +1 -0
- package/dist/src/utils/auth-preflight.js +298 -0
- package/dist/src/utils/auth-preflight.js.map +1 -0
- package/dist/src/utils/aws-auth.d.ts +181 -0
- package/dist/src/utils/aws-auth.d.ts.map +1 -0
- package/dist/src/utils/aws-auth.js +527 -0
- package/dist/src/utils/aws-auth.js.map +1 -0
- package/dist/src/utils/bastion.d.ts +1 -1
- package/dist/src/utils/bastion.d.ts.map +1 -1
- package/dist/src/utils/bastion.js +29 -8
- package/dist/src/utils/bastion.js.map +1 -1
- package/dist/src/utils/build-info.d.ts +33 -0
- package/dist/src/utils/build-info.d.ts.map +1 -0
- package/dist/src/utils/build-info.js +102 -0
- package/dist/src/utils/build-info.js.map +1 -0
- package/dist/src/utils/capture-history.d.ts +62 -0
- package/dist/src/utils/capture-history.d.ts.map +1 -0
- package/dist/src/utils/capture-history.js +94 -0
- package/dist/src/utils/capture-history.js.map +1 -0
- package/dist/src/utils/deploy-preflight.d.ts +52 -0
- package/dist/src/utils/deploy-preflight.d.ts.map +1 -0
- package/dist/src/utils/deploy-preflight.js +183 -0
- package/dist/src/utils/deploy-preflight.js.map +1 -0
- package/dist/src/utils/errors.d.ts +75 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +106 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/first-party-contexts.d.ts +40 -0
- package/dist/src/utils/first-party-contexts.d.ts.map +1 -0
- package/dist/src/utils/first-party-contexts.js +53 -0
- package/dist/src/utils/first-party-contexts.js.map +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/kubeconfig.d.ts +62 -0
- package/dist/src/utils/kubeconfig.d.ts.map +1 -0
- package/dist/src/utils/kubeconfig.js +118 -0
- package/dist/src/utils/kubeconfig.js.map +1 -0
- package/dist/src/utils/log.d.ts +27 -1
- package/dist/src/utils/log.d.ts.map +1 -1
- package/dist/src/utils/log.js +59 -5
- package/dist/src/utils/log.js.map +1 -1
- package/dist/src/utils/pid.d.ts +47 -0
- package/dist/src/utils/pid.d.ts.map +1 -0
- package/dist/src/utils/pid.js +83 -0
- package/dist/src/utils/pid.js.map +1 -0
- package/dist/src/utils/pulumi-run.d.ts +23 -0
- package/dist/src/utils/pulumi-run.d.ts.map +1 -0
- package/dist/src/utils/pulumi-run.js +112 -0
- package/dist/src/utils/pulumi-run.js.map +1 -0
- package/dist/src/utils/pulumi.d.ts +15 -0
- package/dist/src/utils/pulumi.d.ts.map +1 -1
- package/dist/src/utils/pulumi.js +35 -0
- package/dist/src/utils/pulumi.js.map +1 -1
- package/dist/src/utils/reachability.d.ts +29 -0
- package/dist/src/utils/reachability.d.ts.map +1 -0
- package/dist/src/utils/reachability.js +81 -0
- package/dist/src/utils/reachability.js.map +1 -0
- package/dist/src/utils/recover-conversation.d.ts +154 -0
- package/dist/src/utils/recover-conversation.d.ts.map +1 -0
- package/dist/src/utils/recover-conversation.js +314 -0
- package/dist/src/utils/recover-conversation.js.map +1 -0
- package/dist/src/utils/registry-broker.d.ts +148 -0
- package/dist/src/utils/registry-broker.d.ts.map +1 -0
- package/dist/src/utils/registry-broker.js +180 -0
- package/dist/src/utils/registry-broker.js.map +1 -0
- package/dist/src/utils/socks-forward.d.ts +40 -0
- package/dist/src/utils/socks-forward.d.ts.map +1 -0
- package/dist/src/utils/socks-forward.js +97 -0
- package/dist/src/utils/socks-forward.js.map +1 -0
- package/dist/src/utils/stack-flag.d.ts +23 -0
- package/dist/src/utils/stack-flag.d.ts.map +1 -0
- package/dist/src/utils/stack-flag.js +41 -0
- package/dist/src/utils/stack-flag.js.map +1 -0
- package/dist/src/utils/tailscale-targets.d.ts +52 -0
- package/dist/src/utils/tailscale-targets.d.ts.map +1 -0
- package/dist/src/utils/tailscale-targets.js +93 -0
- package/dist/src/utils/tailscale-targets.js.map +1 -0
- package/dist/src/utils/tailscale.d.ts +277 -0
- package/dist/src/utils/tailscale.d.ts.map +1 -0
- package/dist/src/utils/tailscale.js +1007 -0
- package/dist/src/utils/tailscale.js.map +1 -0
- package/dist/src/utils/temporal-auth.d.ts +43 -0
- package/dist/src/utils/temporal-auth.d.ts.map +1 -0
- package/dist/src/utils/temporal-auth.js +176 -0
- package/dist/src/utils/temporal-auth.js.map +1 -0
- package/dist/src/utils/temporal-codec.d.ts +101 -0
- package/dist/src/utils/temporal-codec.d.ts.map +1 -0
- package/dist/src/utils/temporal-codec.js +319 -0
- package/dist/src/utils/temporal-codec.js.map +1 -0
- package/dist/src/utils/tunnel-ownership.d.ts +130 -0
- package/dist/src/utils/tunnel-ownership.d.ts.map +1 -0
- package/dist/src/utils/tunnel-ownership.js +274 -0
- package/dist/src/utils/tunnel-ownership.js.map +1 -0
- package/dist/src/utils/vpn-join.d.ts +32 -0
- package/dist/src/utils/vpn-join.d.ts.map +1 -0
- package/dist/src/utils/vpn-join.js +62 -0
- package/dist/src/utils/vpn-join.js.map +1 -0
- package/dist/src/utils/vpn.d.ts +62 -0
- package/dist/src/utils/vpn.d.ts.map +1 -0
- package/dist/src/utils/vpn.js +183 -0
- package/dist/src/utils/vpn.js.map +1 -0
- package/dist/src/utils/workflow-fingerprint.d.ts +49 -0
- package/dist/src/utils/workflow-fingerprint.d.ts.map +1 -0
- package/dist/src/utils/workflow-fingerprint.js +135 -0
- package/dist/src/utils/workflow-fingerprint.js.map +1 -0
- package/dist/src/utils/worktree-identity.d.ts +86 -0
- package/dist/src/utils/worktree-identity.d.ts.map +1 -0
- package/dist/src/utils/worktree-identity.js +164 -0
- package/dist/src/utils/worktree-identity.js.map +1 -0
- package/fragments/agents/AGENTS.md.hbs +92 -0
- package/fragments/agents/CLAUDE.md.hbs +8 -0
- package/fragments/base/Pulumi.dev.yaml.hbs +10 -0
- package/fragments/base/Pulumi.yaml.hbs +9 -0
- package/fragments/base/index.ts.hbs +107 -0
- package/fragments/base/package.json.hbs +22 -0
- package/{templates/api-web-db/api → fragments/base}/tsconfig.json +3 -4
- package/fragments/bucket/api/src/storage.ts.hbs +81 -0
- package/fragments/database/api/src/db.ts.hbs +23 -0
- package/fragments/database/prisma/schema.prisma.hbs +18 -0
- package/{templates/api-web-db → fragments/service}/api/.dockerignore +2 -0
- package/fragments/service/api/package.json.hbs +40 -0
- package/fragments/service/api/src/index.ts.hbs +58 -0
- package/{templates/api-web-db → fragments/service/api}/tsconfig.json +5 -3
- package/fragments/temporal/worker/.dockerignore +4 -0
- package/fragments/temporal/worker/Dockerfile +15 -0
- package/{templates/temporal-api-worker → fragments/temporal}/worker/package.json.hbs +3 -2
- package/fragments/temporal/worker/src/activities.ts.hbs +14 -0
- package/fragments/temporal/worker/src/worker.ts.hbs +27 -0
- package/fragments/temporal/worker/src/workflows.ts.hbs +24 -0
- package/fragments/temporal/worker/tsconfig.json +13 -0
- package/package.json +36 -22
- package/skills/core/SKILL.md +365 -0
- package/skills/pull-remote-agent-context/SKILL.md +194 -0
- package/stack/docker-compose.hub.yml +134 -0
- package/stack/docker-compose.yml +447 -0
- package/stack/hub/Dockerfile.api +18 -0
- package/stack/hub/Dockerfile.auth +10 -0
- package/stack/hub/Dockerfile.ui +10 -0
- package/stack/init/01-databases.sql +12 -0
- package/stack/observability/blackbox.yml +20 -0
- package/stack/observability/otel-collector.yaml +73 -0
- package/stack/observability/prometheus.yml +36 -0
- package/stack/observability/tempo.yaml +25 -0
- package/stack/temporal/local.yaml +44 -0
- package/templates/api-auth/AGENTS.md.hbs +16 -0
- package/templates/api-auth/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-auth/Pulumi.yaml.hbs +8 -0
- package/templates/api-auth/README.md.hbs +67 -0
- package/templates/api-auth/api/package.json.hbs +28 -0
- package/templates/api-auth/api/src/index.ts.hbs +96 -0
- package/templates/api-auth/api/src/schema.ts.hbs +35 -0
- package/templates/api-auth/api/src/seed-authz.ts.hbs +48 -0
- package/templates/api-auth/api/src/spicedb-http-provider.ts.hbs +89 -0
- package/templates/api-auth/index.ts.hbs +65 -0
- package/templates/api-auth/package.json.hbs +20 -0
- package/templates/api-auth/skills/develop/SKILL.md.hbs +32 -0
- package/templates/api-role-gating/AGENTS.md.hbs +20 -0
- package/templates/api-role-gating/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-role-gating/Pulumi.yaml.hbs +8 -0
- package/templates/api-role-gating/README.md.hbs +64 -0
- package/templates/api-role-gating/api/Dockerfile +17 -0
- package/templates/api-role-gating/api/package.json.hbs +28 -0
- package/templates/api-role-gating/api/src/authn.ts.hbs +29 -0
- package/templates/api-role-gating/api/src/authz.ts.hbs +12 -0
- package/templates/api-role-gating/api/src/main.ts.hbs +58 -0
- package/templates/api-role-gating/api/src/schema.ts.hbs +22 -0
- package/templates/api-role-gating/api/tsconfig.json +13 -0
- package/templates/api-role-gating/index.ts.hbs +107 -0
- package/templates/api-role-gating/package.json.hbs +21 -0
- package/templates/api-role-gating/skills/develop/SKILL.md.hbs +60 -0
- package/templates/api-role-gating/tsconfig.json +10 -0
- package/templates/apps-repo/README.md.hbs +24 -0
- package/templates/apps-repo/gitignore +41 -0
- package/templates/apps-repo/npmrc.hbs +7 -0
- package/templates/apps-repo/package.json.hbs +15 -0
- package/templates/apps-repo/pnpm-workspace.yaml +3 -0
- package/templates/apps-repo/tsconfig.json +18 -0
- package/templates/external-service/AGENTS.md.hbs +20 -0
- package/templates/external-service/Pulumi.dev.yaml.hbs +8 -0
- package/templates/external-service/Pulumi.yaml.hbs +8 -0
- package/templates/external-service/README.md.hbs +56 -0
- package/templates/external-service/api/Dockerfile +15 -0
- package/templates/external-service/api/package.json.hbs +25 -0
- package/templates/external-service/api/src/index.ts.hbs +81 -0
- package/templates/external-service/index.ts.hbs +82 -0
- package/templates/external-service/mocks/vendorpay/package.json.hbs +9 -0
- package/templates/external-service/mocks/vendorpay/server.mjs.hbs +61 -0
- package/templates/external-service/package.json.hbs +34 -0
- package/templates/external-service/skills/develop/SKILL.md.hbs +55 -0
- package/templates/external-service/tsconfig.json +10 -0
- package/templates/platform-repo/AGENTS.md.hbs +18 -0
- package/templates/platform-repo/README.md.hbs +38 -0
- package/templates/platform-repo/core/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/core/Pulumi.{{tenant}}-{{env}}.yaml.hbs +57 -0
- package/templates/platform-repo/core/index.ts +62 -0
- package/templates/platform-repo/core/package.json.hbs +22 -0
- package/templates/platform-repo/core/tsconfig.json +8 -0
- package/templates/platform-repo/package.json.hbs +15 -0
- package/templates/platform-repo/platform/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/platform/Pulumi.{{tenant}}-{{env}}.yaml.hbs +59 -0
- package/templates/platform-repo/platform/index.ts +95 -0
- package/templates/platform-repo/platform/package.json.hbs +26 -0
- package/templates/platform-repo/platform/tsconfig.json +8 -0
- package/templates/platform-repo/pnpm-workspace.yaml +3 -0
- package/templates/workflow/AGENTS.md.hbs +15 -0
- package/templates/workflow/Pulumi.dev.yaml.hbs +8 -0
- package/templates/workflow/Pulumi.yaml.hbs +8 -0
- package/templates/workflow/README.md.hbs +45 -0
- package/templates/workflow/api/.dockerignore +4 -0
- package/templates/workflow/api/Dockerfile +15 -0
- package/templates/{temporal-api-worker → workflow}/api/package.json.hbs +8 -6
- package/templates/workflow/api/src/index.ts.hbs +130 -0
- package/templates/workflow/api/tsconfig.json +14 -0
- package/templates/workflow/index.ts.hbs +67 -0
- package/templates/workflow/package.json.hbs +20 -0
- package/templates/workflow/skills/develop/SKILL.md.hbs +32 -0
- package/templates/workflow/tsconfig.json +10 -0
- package/templates/workflow/worker/.dockerignore +4 -0
- package/templates/workflow/worker/Dockerfile +13 -0
- package/templates/workflow/worker/package.json.hbs +25 -0
- package/templates/workflow/worker/src/worker.ts.hbs +24 -0
- package/templates/workflow/worker/tsconfig.json +14 -0
- package/dist/src/commands/devbox.d.ts +0 -22
- package/dist/src/commands/devbox.d.ts.map +0 -1
- package/dist/src/commands/devbox.js +0 -463
- package/dist/src/commands/devbox.js.map +0 -1
- package/templates/api-web-db/api/Dockerfile +0 -16
- package/templates/api-web-db/api/package.json.hbs +0 -21
- package/templates/api-web-db/api/src/index.ts.hbs +0 -123
- package/templates/api-web-db/package.json.hbs +0 -27
- package/templates/api-web-db/sst.config.ts.hbs +0 -151
- package/templates/api-web-db/web/.dockerignore +0 -3
- package/templates/api-web-db/web/Dockerfile +0 -17
- package/templates/api-web-db/web/app/lib/db.server.ts +0 -36
- package/templates/api-web-db/web/app/root.tsx +0 -29
- package/templates/api-web-db/web/app/routes/home.tsx.hbs +0 -114
- package/templates/api-web-db/web/app/routes.ts +0 -3
- package/templates/api-web-db/web/package.json.hbs +0 -30
- package/templates/api-web-db/web/prisma/schema.prisma +0 -25
- package/templates/api-web-db/web/prisma.config.ts +0 -18
- package/templates/api-web-db/web/react-router.config.ts +0 -5
- package/templates/api-web-db/web/tsconfig.json +0 -19
- package/templates/api-web-db/web/vite.config.ts +0 -9
- package/templates/temporal-api-worker/README.md.hbs +0 -133
- package/templates/temporal-api-worker/api/src/index.ts.hbs +0 -145
- package/templates/temporal-api-worker/package.json.hbs +0 -29
- package/templates/temporal-api-worker/sst.config.ts.hbs +0 -161
- package/templates/temporal-api-worker/worker/Dockerfile +0 -11
- package/templates/temporal-api-worker/worker/src/bundle-workflows.ts +0 -38
- package/templates/temporal-api-worker/worker/src/worker.ts.hbs +0 -93
- /package/templates/{temporal-api-worker → api-auth}/api/.dockerignore +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/Dockerfile +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → api-auth}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker/worker → api-role-gating/api}/.dockerignore +0 -0
- /package/templates/{temporal-api-worker/worker → external-service/api}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → workflow}/api/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/activities.ts.hbs +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/workflows.ts.hbs +0 -0
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/errors.ts", "../../src/utils/log.ts", "../../src/utils/context.ts", "../../src/utils/bastion.ts", "../../src/utils/credentials.ts", "../../src/utils/pulumi.ts", "../../src/utils/vpn.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Shared CLI error type with structured remediation.\n *\n * Every failure along the golden path should tell the user the exact `mesh`\n * command (or doc) that fixes it. Remediation strings must be commands or\n * docs \u2014 never \"ask <person>\".\n */\n\nimport chalk from \"chalk\";\n\nexport interface Remediation {\n /** Exact command that fixes the failure, e.g. \"mesh login trabian-dev\" */\n command?: string;\n /** Documentation URL or repo-relative doc path with more context */\n docs?: string;\n /** Whether the owning command can apply this fix itself via --fix */\n autoFixable?: boolean;\n}\n\nexport interface MeshCliErrorOptions {\n remediation?: Remediation;\n /** Process exit code (default 1) */\n exitCode?: number;\n cause?: unknown;\n}\n\nexport class MeshCliError extends Error {\n readonly remediation?: Remediation;\n readonly exitCode: number;\n\n constructor(message: string, options: MeshCliErrorOptions = {}) {\n super(message, options.cause !== undefined ? { cause: options.cause } : undefined);\n this.name = \"MeshCliError\";\n this.remediation = options.remediation;\n this.exitCode = options.exitCode ?? 1;\n }\n}\n\n/**\n * Render an error's BODY \u2014 the message plus its \"\u2192 run: <command>\" /\n * \"\u2192 see: <docs>\" remediation lines, with no leading severity glyph.\n *\n * Use this when the caller supplies its own glyph: a recovery path that logs a\n * refusal through `logWarn` (which prefixes \u26A0) and carries on would otherwise\n * print \"\u26A0 \u2717 \u2026\". The remediation lines are the part that must survive \u2014 they\n * name the corrupt file to delete.\n */\nexport function renderErrorBody(err: unknown): string {\n const message = err instanceof Error ? err.message : String(err);\n if (!(err instanceof MeshCliError)) return message;\n const lines = [message];\n if (err.remediation?.command) {\n lines.push(chalk.cyan(\" \u2192 run: \") + err.remediation.command);\n }\n if (err.remediation?.docs) {\n lines.push(chalk.cyan(\" \u2192 see: \") + err.remediation.docs);\n }\n return lines.join(\"\\n\");\n}\n\n/**\n * Render an error for humans. MeshCliError gets its remediation appended as\n * \"\u2192 run: <command>\" / \"\u2192 see: <docs>\" lines; anything else renders its message.\n */\nexport function renderError(err: unknown): string {\n return chalk.red(\"\u2717\") + \" \" + renderErrorBody(err);\n}\n\n/**\n * Render an error as JSON for agents. Same structure as the human output:\n * { error, remediation?: { command?, docs?, autoFixable? } }.\n */\nexport function renderErrorJson(err: unknown): string {\n if (err instanceof MeshCliError) {\n return JSON.stringify({\n error: err.message,\n ...(err.remediation ? { remediation: err.remediation } : {}),\n });\n }\n return JSON.stringify({ error: err instanceof Error ? err.message : String(err) });\n}\n\nlet jsonPayloadEmitted = false;\n\n/**\n * Print a command's `--json` payload \u2014 the single machine-readable document on\n * stdout \u2014 and record that it happened.\n *\n * A command that emits a payload and *then* throws (the `mesh init` doctor\n * throws by design whenever a check fails) used to produce TWO concatenated\n * JSON documents on stdout, because `handleCliError` appended `{\"error\":\u2026}`.\n * Two documents is not JSON: `mesh init app-tenant --json | jq` failed to parse\n * on exactly the failure path a script cares about. Routing every payload\n * through here lets the handler know stdout is already spoken for.\n */\nexport function emitJsonPayload(payload: unknown): void {\n console.log(JSON.stringify(payload, null, 2));\n jsonPayloadEmitted = true;\n}\n\n/** True once a command has written its `--json` payload to stdout. */\nexport function hasEmittedJsonPayload(): boolean {\n return jsonPayloadEmitted;\n}\n\n/** Test seam \u2014 the flag is module state, so specs have to be able to clear it. */\nexport function resetJsonPayloadEmitted(): void {\n jsonPayloadEmitted = false;\n}\n\n/**\n * Top-level handler for bin/mesh.ts. Prints the error (JSON when the\n * invocation asked for --json anywhere, since per-command flags aren't\n * parsed once dispatch has failed) and exits with the error's code.\n *\n * When the command already emitted a `--json` payload, that payload IS the\n * machine surface \u2014 and it says strictly more than this error would (the\n * doctor's payload carries `ok:false` plus a per-check `fix` command). So the\n * error goes to stderr as human diagnostics and stdout keeps exactly one\n * parseable document.\n */\nexport function handleCliError(err: unknown): never {\n const wantsJson = process.argv.includes(\"--json\");\n if (wantsJson && !hasEmittedJsonPayload()) {\n console.log(renderErrorJson(err));\n } else {\n console.error(renderError(err));\n }\n process.exit(err instanceof MeshCliError ? err.exitCode : 1);\n}\n", "/**\n * Logging utilities with colored output.\n *\n * Non-TTY streams (CI, agent runs, piped output) get an [HH:MM:SS] prefix on\n * every line so long quiet stretches are attributable after the fact\n * (MESH-2479); interactive terminals stay clean. Override with\n * MESH_LOG_TIMESTAMPS=1 (force on) / =0 (force off).\n */\n\nimport chalk from \"chalk\";\n\n/**\n * Pure prefix decision, exported for tests: timestamps when the env flag says\n * so, else whenever stderr is not a TTY.\n */\nexport function logPrefix(opts: {\n isTTY: boolean;\n envFlag: string | undefined;\n now: Date;\n}): string {\n const enabled = opts.envFlag === \"1\" || (opts.envFlag !== \"0\" && !opts.isTTY);\n return enabled ? `[${opts.now.toISOString().slice(11, 19)}] ` : \"\";\n}\n\nfunction prefix(): string {\n return chalk.dim(\n logPrefix({\n isTTY: !!process.stderr.isTTY,\n envFlag: process.env.MESH_LOG_TIMESTAMPS,\n now: new Date(),\n }),\n );\n}\n\nexport function logInfo(message: string): void {\n console.error(prefix() + chalk.blue(\"\u2139\"), message);\n}\n\nexport function logSuccess(message: string): void {\n console.error(prefix() + chalk.green(\"\u2713\"), message);\n}\n\nexport function logWarn(message: string): void {\n console.error(prefix() + chalk.yellow(\"\u26A0\"), message);\n}\n\nexport function logError(message: string): void {\n console.error(prefix() + chalk.red(\"\u2717\"), message);\n}\n\n/** Render elapsed milliseconds compactly: \"45s\", \"2m 30s\", \"1h 5m\". */\nexport function formatElapsed(ms: number): string {\n const totalSec = Math.max(0, Math.round(ms / 1000));\n const h = Math.floor(totalSec / 3600);\n const m = Math.floor((totalSec % 3600) / 60);\n const s = totalSec % 60;\n if (h > 0) return `${h}h ${m}m`;\n if (m > 0) return `${m}m ${s}s`;\n return `${s}s`;\n}\n\n/**\n * Periodic \"still working\" line during a long silent operation (registry\n * fetches, image builds) so a non-TTY first run never sits at 0 bytes of\n * output for minutes (MESH-2479). `touch()` marks recent real output, which\n * suppresses the next beat \u2014 the heartbeat only fills silence.\n */\nexport function startHeartbeat(\n label: string,\n intervalMs = 15_000,\n): { stop: () => void; touch: () => void } {\n const startedAt = Date.now();\n let lastOutputAt = startedAt;\n const timer = setInterval(() => {\n if (Date.now() - lastOutputAt < intervalMs) return;\n logInfo(`\u2026 still working: ${label} (${formatElapsed(Date.now() - startedAt)} elapsed)`);\n }, intervalMs);\n timer.unref?.();\n return {\n stop: () => clearInterval(timer),\n touch: () => {\n lastOutputAt = Date.now();\n },\n };\n}\n", "/**\n * Context detection - determines tenant, stage, and platform environment\n * from the current directory and environment variables.\n */\n\nimport * as fs from \"fs\";\nimport * as path from \"path\";\nimport { logInfo } from \"./log.js\";\n\nexport interface MeshContext {\n tenant: string;\n stage: string;\n platformEnv: string;\n}\n\n/**\n * Find a file by walking up directories from the starting directory.\n * Returns the full path to the file if found, undefined otherwise.\n */\nfunction findFileUpward(filename: string, startDir: string = process.cwd()): string | undefined {\n let currentDir = startDir;\n const root = path.parse(currentDir).root;\n\n while (currentDir !== root) {\n const filePath = path.join(currentDir, filename);\n if (fs.existsSync(filePath)) {\n return filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n return undefined;\n}\n\n/**\n * Detect tenant and stage from current directory and environment.\n *\n * Priority for stage:\n * 1. --stage flag (passed as stageArg)\n * 2. MESH_STAGE env var\n * 3. SST_STAGE env var\n * 4. .sst/stage file\n * 5. Pulumi config file name\n * 6. Default: \"dev\"\n *\n * Priority for tenant:\n * 1. MESH_TENANT env var\n * 2. config.ts tenant field\n * 3. Pulumi config mesh:tenant\n * 4. Directory path (tenants/{tenant}/...)\n * 5. Default: \"mesh\"\n */\nexport function detectContext(stageArg?: string): MeshContext {\n let tenant: string | undefined;\n let stage: string | undefined;\n\n const cwd = process.cwd();\n\n // Try to detect from Pulumi.yaml\n if (fs.existsSync(\"Pulumi.yaml\")) {\n // Look for Pulumi.*.yaml config files\n const files = fs.readdirSync(\".\").filter(\n (f) => f.startsWith(\"Pulumi.\") && f.endsWith(\".yaml\") && f !== \"Pulumi.yaml\"\n );\n\n const configFile = files[0];\n if (configFile) {\n const content = fs.readFileSync(configFile, \"utf-8\");\n\n // Extract tenant from mesh:tenant config\n const tenantMatch = content.match(/^\\s*mesh:tenant:\\s*[\"']?([^\"'\\n]+)[\"']?/m);\n if (tenantMatch?.[1]) {\n tenant = tenantMatch[1].trim();\n }\n\n // Extract stage from filename: Pulumi.<stage>.yaml\n const stageMatch = configFile.match(/Pulumi\\.(.+)\\.yaml/);\n if (stageMatch?.[1]) {\n stage = stageMatch[1];\n }\n }\n }\n\n // Try to detect from SST config (walk up directories to find it)\n const sstConfigPath = findFileUpward(\"sst.config.ts\");\n let sstDir: string | undefined;\n\n if (sstConfigPath) {\n sstDir = path.dirname(sstConfigPath);\n\n // Check parent config.ts for tenant (relative to sst.config.ts location)\n const parentConfigPath = path.join(sstDir, \"..\", \"config.ts\");\n if (fs.existsSync(parentConfigPath)) {\n const configContent = fs.readFileSync(parentConfigPath, \"utf-8\");\n const tenantMatch = configContent.match(/tenant:\\s*[\"']([^\"']+)[\"']/);\n if (tenantMatch) {\n tenant = tenantMatch[1];\n }\n }\n\n // Check .sst/stage for current stage (relative to sst.config.ts location)\n const sstStagePath = path.join(sstDir, \".sst\", \"stage\");\n if (fs.existsSync(sstStagePath)) {\n stage = fs.readFileSync(sstStagePath, \"utf-8\").trim();\n }\n }\n\n // Fallback: infer tenant from directory path\n if (!tenant) {\n const pathMatch = cwd.match(/tenants\\/([^/]+)/);\n if (pathMatch) {\n tenant = pathMatch[1];\n }\n }\n\n // Apply priority: stageArg > MESH_STAGE > SST_STAGE > detected > default\n stage = stageArg || process.env.MESH_STAGE || process.env.SST_STAGE || stage || \"dev\";\n tenant = process.env.MESH_TENANT || tenant || \"mesh\";\n\n // Resolve platform environment from config.ts if available\n let platformEnv = stage;\n let platformEnvMap: Record<string, string> = {};\n let defaultPlatformEnv: string | undefined;\n\n // Try to read platformEnvMap and defaultPlatformEnv from config.ts (relative to sst.config.ts location)\n const configPath = sstDir ? path.join(sstDir, \"..\", \"config.ts\") : \"../config.ts\";\n if (fs.existsSync(configPath)) {\n const configContent = fs.readFileSync(configPath, \"utf-8\");\n\n // Parse platformEnvMap object\n const mapMatch = configContent.match(/platformEnvMap:\\s*\\{([^}]+)\\}/);\n if (mapMatch?.[1]) {\n const entries = mapMatch[1].matchAll(/(\\w+):\\s*[\"']([^\"']+)[\"']/g);\n for (const entry of entries) {\n const key = entry[1];\n const value = entry[2];\n if (key && value) {\n platformEnvMap[key] = value;\n }\n }\n }\n\n // Parse defaultPlatformEnv\n const defaultMatch = configContent.match(/defaultPlatformEnv:\\s*[\"']([^\"']+)[\"']/);\n if (defaultMatch?.[1]) {\n defaultPlatformEnv = defaultMatch[1];\n }\n }\n\n // Parse env from stage by stripping tenant prefix (matches Pulumi pattern)\n // e.g., \"mesh-dev-temporal\" \u2192 env \"dev-temporal\"\n const tenantPrefix = `${tenant}-`;\n const parsedEnv = stage.startsWith(tenantPrefix)\n ? stage.slice(tenantPrefix.length)\n : stage;\n\n // Use config mapping if available, then defaultPlatformEnv, otherwise use parsed env directly\n platformEnv = platformEnvMap[parsedEnv] ?? platformEnvMap[stage] ?? defaultPlatformEnv ?? parsedEnv;\n\n logInfo(`Stage: ${stage}, Platform: ${platformEnv}, Tenant: ${tenant}`);\n\n return { tenant, stage, platformEnv };\n}\n", "/**\n * Bastion utilities for SSM tunneling to platform services\n */\n\nimport { SSMClient, GetParameterCommand } from \"@aws-sdk/client-ssm\";\nimport { logInfo, logSuccess, logError } from \"./log.js\";\n\n/**\n * Service endpoint info\n */\nexport interface ServiceEndpoint {\n host: string;\n port: number;\n}\n\n/**\n * Platform bastion info from SSM\n */\nexport interface PlatformBastionInfo {\n instanceId: string;\n securityGroupId: string;\n services: Record<string, ServiceEndpoint>;\n}\n\n/**\n * Legacy bastion info (for backward compatibility with db commands)\n */\nexport interface BastionInfo {\n instanceId: string;\n rdsEndpoint: string;\n rdsPort: number;\n}\n\n/**\n * Get platform bastion info from SSM parameter store.\n *\n * Reads the platformBastion key from the platform export at\n * /mesh-platform/{tenant}/{platformEnv}/platform. Falls back to the legacy\n * separate parameter at /mesh-platform/{tenant}/{platformEnv}/platform-bastion\n * for backward compatibility.\n */\nexport async function getPlatformBastionInfo(\n tenant: string,\n platformEnv: string,\n region?: string\n): Promise<PlatformBastionInfo> {\n const ssm = new SSMClient(region ? { region } : {});\n\n // Captured so the final error can distinguish a CREDS failure (the common\n // case \u2014 stale/expired ambient AWS creds, or creds lacking cross-tenant read\n // on the hub param) from a genuinely missing bastion. Without this the read\n // error is swallowed and every failure looks like \"bastion not deployed\".\n let primaryError: unknown;\n\n // Primary: read from the platform export (platformBastion is a nested key)\n const platformPath = `/mesh-platform/${tenant}/${platformEnv}/platform`;\n logInfo(`Looking up platform bastion from ${platformPath}...`);\n\n try {\n const response = await ssm.send(\n new GetParameterCommand({ Name: platformPath })\n );\n\n if (response.Parameter?.Value) {\n const platform = JSON.parse(response.Parameter.Value);\n if (platform.platformBastion) {\n const info = platform.platformBastion as PlatformBastionInfo;\n logSuccess(`Found bastion: ${info.instanceId}`);\n\n const serviceNames = Object.keys(info.services);\n if (serviceNames.length > 0) {\n logInfo(`Available services: ${serviceNames.join(\", \")}`);\n }\n\n return info;\n }\n }\n } catch (err) {\n // Don't swallow: keep the real reason (AccessDenied / ExpiredToken / \u2026) so\n // the final error can be actionable. Then try the legacy path.\n primaryError = err;\n }\n\n // Fallback: legacy separate parameter\n const legacyPath = `/mesh-platform/${tenant}/${platformEnv}/platform-bastion`;\n logInfo(`Trying legacy path ${legacyPath}...`);\n\n try {\n const response = await ssm.send(\n new GetParameterCommand({ Name: legacyPath })\n );\n\n if (!response.Parameter?.Value) {\n throw new Error(`Platform bastion not found`);\n }\n\n const info = JSON.parse(response.Parameter.Value) as PlatformBastionInfo;\n logSuccess(`Found bastion: ${info.instanceId}`);\n\n const serviceNames = Object.keys(info.services);\n if (serviceNames.length > 0) {\n logInfo(`Available services: ${serviceNames.join(\", \")}`);\n }\n\n return info;\n } catch (legacyError) {\n // Classify on the PRIMARY read's error (the meaningful one) \u2014 the legacy\n // path is usually just ParameterNotFound and hides the real cause.\n const cause = primaryError ?? legacyError;\n const name = (cause as { name?: string })?.name ?? \"\";\n const credsProblem = /Expired|UnrecognizedClient|InvalidClientTokenId|InvalidSignature|CredentialsProviderError|AccessDenied/i.test(\n name\n );\n\n if (credsProblem) {\n logError(\n `Could not read the platform bastion from ${platformPath} \u2014 AWS error: ${name}.`\n );\n logInfo(\n \"This is almost always a CREDENTIALS problem, not a missing bastion.\"\n );\n logInfo(\n \" \u2022 The read uses the ambient AWS creds of this process; they must be valid AND able to read the HUB param above.\"\n );\n logInfo(\n \" \u2022 Check: `aws sts get-caller-identity` (ExpiredToken \u2192 refresh; AccessDenied \u2192 those creds lack hub read \u2014 use InfraAdmin-grade creds).\"\n );\n logInfo(\n \" \u2022 Stale creds often hide in the tmux GLOBAL env (`tmux show-environment -g | grep AWS_`); a per-shell `unset` won't clear them.\"\n );\n } else {\n logError(`Platform bastion not found in ${platformPath} or ${legacyPath}`);\n logInfo(\"Make sure platformBastion is enabled in your platform config and deployed.\");\n }\n throw cause;\n }\n}\n\n/**\n * Get bastion info from SSM parameter store (legacy format).\n * Reads from /mesh/{tenant}/{platformEnv}/platform-bastion and extracts RDS info.\n *\n * @deprecated Use getPlatformBastionInfo instead\n */\nexport async function getBastionInfo(\n tenant: string,\n platformEnv: string\n): Promise<BastionInfo> {\n const info = await getPlatformBastionInfo(tenant, platformEnv);\n\n const rdsService = info.services[\"rds\"];\n if (!rdsService) {\n throw new Error(\"RDS service not available in platform bastion. Is RDS enabled?\");\n }\n\n return {\n instanceId: info.instanceId,\n rdsEndpoint: rdsService.host,\n rdsPort: rdsService.port,\n };\n}\n", "/**\n * Database credential utilities\n */\n\nimport {\n SecretsManagerClient,\n GetSecretValueCommand,\n} from \"@aws-sdk/client-secrets-manager\";\nimport { logInfo, logSuccess } from \"./log.js\";\n\nexport interface DatabaseCredentials {\n username: string;\n password: string;\n host: string;\n port: number;\n database: string;\n}\n\n/**\n * Options for credential lookup\n */\nexport interface CredentialLookupOptions {\n /** App name (e.g., \"rdc\") - if provided, uses path mesh/{tenant}/{stage}/{app}/db-credentials */\n app?: string;\n}\n\n/**\n * Get DATABASE_URL from Secrets Manager.\n *\n * Credential path patterns:\n * - With app: mesh/{tenant}/{stage}/{app}/db-credentials\n * - Without app: mesh/{tenant}/{stage}/db-credentials\n *\n * Returns the DATABASE_URL string directly. Use rewriteDatabaseUrl() to\n * modify host/port for tunnel usage.\n */\nexport async function getDatabaseUrl(\n tenant: string,\n stage: string,\n options?: CredentialLookupOptions\n): Promise<string> {\n const secretsManager = new SecretsManagerClient({});\n\n // Build secret path - with or without app name\n const secretName = options?.app\n ? `mesh/${tenant}/${stage}/${options.app}/db-credentials`\n : `mesh/${tenant}/${stage}/db-credentials`;\n logInfo(`Looking up credentials at ${secretName}...`);\n\n try {\n const response = await secretsManager.send(\n new GetSecretValueCommand({ SecretId: secretName })\n );\n\n if (response.SecretString) {\n const secret = JSON.parse(response.SecretString);\n\n // Handle DATABASE_URL format (preferred)\n if (secret.DATABASE_URL) {\n const parsed = new URL(secret.DATABASE_URL);\n logSuccess(`Got credentials for user: ${parsed.username}`);\n return secret.DATABASE_URL;\n }\n\n // Handle individual fields format (legacy)\n if (secret.username && secret.password) {\n logSuccess(`Got credentials for user: ${secret.username}`);\n const database = secret.dbname ?? secret.database ?? \"postgres\";\n return `postgresql://${secret.username}:${encodeURIComponent(secret.password)}@${secret.host ?? \"localhost\"}:${secret.port ?? 5432}/${database}`;\n }\n\n throw new Error(`Secret ${secretName} has unexpected format (needs DATABASE_URL or username/password)`);\n }\n } catch (error) {\n if ((error as Error).message?.includes(\"unexpected format\")) {\n throw error;\n }\n // Secret not found - will be caught by caller\n }\n\n throw new Error(`Could not find credentials at ${secretName}`);\n}\n\n/**\n * @deprecated Use getDatabaseUrl instead - returns DATABASE_URL directly\n */\nexport async function getDbCredentials(\n tenant: string,\n stage: string,\n _platformEnv: string,\n rdsHost: string,\n rdsPort: number,\n options?: CredentialLookupOptions\n): Promise<DatabaseCredentials> {\n const databaseUrl = await getDatabaseUrl(tenant, stage, options);\n const parsed = new URL(databaseUrl);\n\n return {\n username: parsed.username,\n password: decodeURIComponent(parsed.password),\n host: rdsHost,\n port: rdsPort,\n database: parsed.pathname.slice(1),\n };\n}\n\n/**\n * Options for rewriting DATABASE_URL\n */\nexport interface DatabaseUrlRewriteOptions {\n /** New host:port endpoint (e.g., \"localhost:5432\") */\n endpoint?: string;\n /** SSL mode (require, no-verify, disable) */\n sslMode?: string;\n}\n\n/**\n * Rewrite DATABASE_URL with new endpoint and/or SSL mode.\n * Preserves username, password, database name, and other query params.\n *\n * Used by both mesh-env-exec (for sst dev) and mesh db exec (for ad-hoc commands).\n */\nexport function rewriteDatabaseUrl(\n url: string,\n options: DatabaseUrlRewriteOptions\n): string {\n try {\n const parsed = new URL(url);\n\n // Rewrite endpoint if provided\n if (options.endpoint) {\n if (options.endpoint.includes(\":\")) {\n const colonIndex = options.endpoint.lastIndexOf(\":\");\n parsed.hostname = options.endpoint.slice(0, colonIndex);\n parsed.port = options.endpoint.slice(colonIndex + 1);\n } else {\n parsed.hostname = options.endpoint;\n parsed.port = parsed.port || \"5432\";\n }\n }\n\n // Set SSL mode if provided\n if (options.sslMode) {\n parsed.searchParams.set(\"sslmode\", options.sslMode);\n // For Prisma: accept invalid/self-signed certificates through tunnels\n if (options.sslMode === \"require\" || options.sslMode === \"no-verify\") {\n parsed.searchParams.set(\"sslaccept\", \"accept_invalid_certs\");\n }\n }\n\n return parsed.toString();\n } catch {\n // If URL parsing fails, return original\n return url;\n }\n}\n\n/**\n * Build a DATABASE_URL from credentials.\n */\nexport function buildDatabaseUrl(\n creds: DatabaseCredentials,\n options?: DatabaseUrlRewriteOptions\n): string {\n const host = options?.endpoint?.split(\":\")[0] ?? creds.host;\n const port = options?.endpoint?.split(\":\")[1] ?? String(creds.port);\n\n let url = `postgresql://${creds.username}:${encodeURIComponent(creds.password)}@${host}:${port}/${creds.database}`;\n\n if (options?.sslMode) {\n url += `?sslmode=${options.sslMode}`;\n if (options.sslMode === \"require\" || options.sslMode === \"no-verify\") {\n url += \"&sslaccept=accept_invalid_certs\";\n }\n }\n\n return url;\n}\n\n/**\n * Try to read database info from SST outputs (when sst dev has run).\n */\nexport async function readSstOutputs(): Promise<{\n databaseUrl?: string;\n databaseName?: string;\n secretArn?: string;\n} | null> {\n const fs = await import(\"fs\");\n\n if (!fs.existsSync(\".sst/outputs.json\")) {\n return null;\n }\n\n try {\n const content = fs.readFileSync(\".sst/outputs.json\", \"utf-8\");\n const outputs = JSON.parse(content);\n\n if (outputs.databaseUrl) {\n logInfo(\"Found SST outputs with database config\");\n\n // Extract secret ARN from URL if present\n const secretArnMatch = outputs.databaseUrl.match(/secretArn=([^&]+)/);\n const secretArn = secretArnMatch\n ? decodeURIComponent(secretArnMatch[1])\n : undefined;\n\n return {\n databaseUrl: outputs.databaseUrl,\n databaseName: outputs.databaseName,\n secretArn,\n };\n }\n } catch {\n // Ignore parse errors\n }\n\n return null;\n}\n", "/**\n * Pulumi-related utilities shared across CLI commands.\n */\n\nimport { execFileSync } from \"child_process\";\nimport * as path from \"path\";\nimport * as fs from \"fs\";\n\n/**\n * Find the Pulumi app root by walking up from a starting directory.\n * Returns the first directory containing `Pulumi.yaml`, or null.\n */\nexport function findAppRoot(startDir: string): string | null {\n let dir = startDir;\n while (true) {\n if (fs.existsSync(path.join(dir, \"Pulumi.yaml\"))) return dir;\n const parent = path.dirname(dir);\n if (parent === dir) return null;\n dir = parent;\n }\n}\n\n/**\n * Find Pulumi.<stack>.yaml files in a directory.\n * Returns an array of stack names (without the Pulumi. prefix and .yaml suffix).\n */\nexport function findStackConfigs(appRoot: string): string[] {\n return fs.readdirSync(appRoot)\n .filter((f) => /^Pulumi\\..+\\.yaml$/.test(f) && f !== \"Pulumi.yaml\")\n .map((f) => f.replace(/^Pulumi\\./, \"\").replace(/\\.yaml$/, \"\"));\n}\n\n/**\n * Get the currently selected Pulumi stack name, or null.\n */\nexport function getCurrentStack(appRoot: string): string | null {\n try {\n const result = execFileSync(\"pulumi\", [\"stack\", \"--show-name\"], {\n encoding: \"utf-8\",\n cwd: appRoot,\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n });\n return result.trim() || null;\n } catch {\n return null;\n }\n}\n\n/**\n * Read a config value from Pulumi.<stack>.yaml.\n * Simple regex-based parser \u2014 handles single-line string values.\n * For complex values, use `pulumi config` CLI instead.\n */\nexport function readStackConfig(appRoot: string, stack: string, key: string): string | null {\n const configFile = path.join(appRoot, `Pulumi.${stack}.yaml`);\n if (!fs.existsSync(configFile)) return null;\n\n const content = fs.readFileSync(configFile, \"utf-8\");\n const pattern = new RegExp(`^\\\\s+${key.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}:\\\\s*(.+)$`, \"m\");\n const match = content.match(pattern);\n if (!match) return null;\n\n return match[1]!.trim().replace(/^[\"']|[\"']$/g, \"\");\n}\n\n/**\n * Run `pulumi stack output <key> --json` with the given extra args.\n *\n * Pulumi redacts secret-tainted outputs as the literal string `\"[secret]\"`.\n * Outputs like `env.register()`'s `dev` blob are tainted because they transitively\n * include secret values (e.g. `TEMPORAL_ENCODING_KEY`, DB passwords), even though\n * much of the blob (tunnels, namespace, service scaffolding) is non-secret.\n *\n * This helper tries without `--show-secrets` first \u2014 which avoids requiring\n * the local machine to have the stack's secrets provider configured (KMS access\n * etc.) \u2014 and retries with `--show-secrets` only if the first call returns a\n * `\"[secret]\"` placeholder. KMS/secrets-provider errors are not retried because\n * they will fail the same way with the flag set.\n */\nexport function pulumiStackOutput(\n appRoot: string,\n key: string,\n extraArgs: string[],\n env?: Record<string, string>,\n): string {\n const execEnv = env ? { ...process.env, ...env } : undefined;\n // First attempt: no --show-secrets (works without PULUMI_CONFIG_PASSPHRASE / KMS)\n try {\n const result = execFileSync(\n \"pulumi\",\n [\"stack\", \"output\", key, \"--json\", ...extraArgs],\n { cwd: appRoot, encoding: \"utf-8\", stdio: [\"ignore\", \"pipe\", \"pipe\"], env: execEnv }\n );\n // If the output contains \"[secret]\" placeholders, retry with --show-secrets\n if (result.includes('\"[secret]\"')) {\n return execFileSync(\n \"pulumi\",\n [\"stack\", \"output\", key, \"--json\", \"--show-secrets\", ...extraArgs],\n { cwd: appRoot, encoding: \"utf-8\", stdio: [\"ignore\", \"pipe\", \"pipe\"], env: execEnv }\n );\n }\n return result;\n } catch (err: unknown) {\n // If the error is a secrets/KMS issue, don't retry with --show-secrets\n // (it will fail the same way). Only retry for other Pulumi errors.\n const errMsg = (err as { stderr?: string })?.stderr ?? \"\";\n if (errMsg.includes(\"kms:\") || errMsg.includes(\"KMS\") || errMsg.includes(\"secrets manager\")) {\n throw err;\n }\n return execFileSync(\n \"pulumi\",\n [\"stack\", \"output\", key, \"--json\", \"--show-secrets\", ...extraArgs],\n { cwd: appRoot, encoding: \"utf-8\", stdio: [\"ignore\", \"pipe\", \"pipe\"], env: execEnv }\n );\n }\n}\n", "/**\n * VPN detection utilities\n */\n\nimport { execFile, execFileSync } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nconst TAILSCALE_PATHS = [\n \"tailscale\",\n \"/Applications/Tailscale.app/Contents/MacOS/Tailscale\",\n];\n\n/**\n * Detect whether a Tailscale VPN connection is active.\n *\n * Uses socket-aware `execTailscaleCmd` so it works in both kernel tun mode\n * (standard socket) and legacy userspace networking (/tmp/tailscale.sock).\n * Returns `true` only when BackendState is \"Running\" and Self.Online is true.\n * Returns `false` silently on any failure (binary missing, daemon stopped,\n * parse error, missing fields).\n */\nexport async function isVpnConnected(): Promise<boolean> {\n try {\n const stdout = await execTailscaleCmd([\"status\", \"--json\"]);\n const status: TailscaleDetailedStatus = JSON.parse(stdout);\n return status.BackendState === \"Running\" && status.Self?.Online === true;\n } catch {\n return false;\n }\n}\n\n// ---------------------------------------------------------------------------\n// DNS record management & Tailscale info\n// ---------------------------------------------------------------------------\n\n/** Standard socket (kernel tun mode), then legacy (userspace mode). */\nconst TAILSCALE_SOCKET_PATHS = [\"/var/run/tailscale/tailscaled.sock\", \"/tmp/tailscale.sock\"];\n\n/** Connection details for the Headscale DNS writer sidecar. */\nexport interface HeadscaleDnsConfig {\n namespace: string;\n pod: string;\n container: string;\n filePath: string;\n}\n\n/**\n * Build a HeadscaleDnsConfig from tenant/env, following the same naming\n * convention as `mesh vpn` (\u2060{tenant}-{env}-headscale).\n *\n * Pod name, container, and file path are infrastructure conventions that\n * rarely change \u2014 override via the optional parameter if they do.\n */\nexport function headscaleDnsConfig(\n tenant = \"mesh\",\n env = \"dev\",\n overrides?: Partial<HeadscaleDnsConfig>,\n): HeadscaleDnsConfig {\n return {\n namespace: `${tenant}-${env}-headscale`,\n pod: \"headscale-0\",\n container: \"dns-writer\",\n filePath: \"/var/lib/headscale/dns/extra-records.json\",\n ...overrides,\n };\n}\n\nexport interface DnsRecord {\n name: string;\n type: \"A\";\n value: string;\n}\n\ninterface TailscaleDetailedStatus {\n BackendState?: string;\n Self?: {\n Online?: boolean;\n HostName?: string;\n TailscaleIPs?: string[];\n };\n}\n\n/**\n * Execute a tailscale CLI command, trying each known binary path.\n * Automatically appends `--socket <path>` when a tailscale socket is found.\n */\nfunction execTailscaleCmd(args: string[]): Promise<string> {\n const socketPath = TAILSCALE_SOCKET_PATHS.find(existsSync);\n\n interface Attempt {\n binary: string;\n args: string[];\n }\n\n const attempts: Attempt[] = [];\n for (const binary of TAILSCALE_PATHS) {\n if (socketPath) {\n attempts.push({ binary, args: [\"--socket\", socketPath, ...args] });\n }\n attempts.push({ binary, args });\n }\n\n return new Promise((resolve, reject) => {\n let index = 0;\n\n function tryNext(): void {\n if (index >= attempts.length) {\n reject(new Error(\"All tailscale binary attempts failed\"));\n return;\n }\n\n const attempt = attempts[index++]!;\n execFile(attempt.binary, attempt.args, (error, stdout) => {\n if (error) {\n tryNext();\n } else {\n resolve(stdout);\n }\n });\n }\n\n tryNext();\n });\n}\n\n/**\n * Retrieve the current Tailscale hostname and IP address.\n *\n * Returns `null` when Tailscale is not installed, not running, or not online.\n */\nexport async function getTailscaleInfo(): Promise<{ hostname: string; ip: string } | null> {\n try {\n const stdout = await execTailscaleCmd([\"status\", \"--json\"]);\n const status: TailscaleDetailedStatus = JSON.parse(stdout);\n\n if (\n status.BackendState === \"Running\" &&\n status.Self?.Online === true &&\n status.Self.HostName &&\n status.Self.TailscaleIPs?.length\n ) {\n return {\n hostname: status.Self.HostName,\n ip: status.Self.TailscaleIPs[0]!,\n };\n }\n\n return null;\n } catch {\n return null;\n }\n}\n\n/** Helper: build kubectl exec args for the dns-writer sidecar. */\nfunction dnsWriterExec(cfg: HeadscaleDnsConfig, cmd: string[], interactive = false): string[] {\n return [\n \"exec\", ...(interactive ? [\"-i\"] : []),\n \"-n\", cfg.namespace, cfg.pod, \"-c\", cfg.container, \"--\", ...cmd,\n ];\n}\n\n/**\n * Read DNS records from the dns-writer sidecar in the Headscale pod.\n *\n * Throws with an actionable message if kubectl can't reach the pod.\n * Returns an empty array when the file is missing or contains invalid JSON.\n */\nexport function readDnsRecords(cfg: HeadscaleDnsConfig): DnsRecord[] {\n try {\n const raw = execFileSync(\"kubectl\", dnsWriterExec(cfg, [\"cat\", cfg.filePath]), {\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n const trimmed = raw.trim();\n if (!trimmed || trimmed === \"[]\") return [];\n try {\n return JSON.parse(trimmed);\n } catch {\n console.warn(`[vpn] DNS records file contains invalid JSON, treating as empty`);\n return [];\n }\n } catch (err) {\n const msg = (err as Error).message ?? String(err);\n if (msg.includes(\"not found\") || msg.includes(\"Unable to connect\")) {\n throw new Error(\n `Cannot reach Headscale DNS writer (namespace=${cfg.namespace}, pod=${cfg.pod}).\\n` +\n `Verify kubectl context and that the Headscale pod is running:\\n` +\n ` kubectl get pods -n ${cfg.namespace}`,\n );\n }\n if (msg.includes(\"No such file\")) {\n return [];\n }\n // Unexpected error \u2014 rethrow\n throw err;\n }\n}\n\n/**\n * Write DNS A records to the dns-writer sidecar in the Headscale pod.\n *\n * Pipes JSON via stdin to avoid shell-escaping issues.\n * Throws with an actionable message if kubectl can't reach the pod.\n */\nexport function registerDnsRecords(cfg: HeadscaleDnsConfig, records: DnsRecord[]): void {\n const json = JSON.stringify(records);\n try {\n execFileSync(\n \"kubectl\",\n dnsWriterExec(cfg, [\"sh\", \"-c\", `cat > '${cfg.filePath}'`], true),\n { input: json, stdio: [\"pipe\", \"pipe\", \"pipe\"] },\n );\n } catch (err) {\n const msg = (err as Error).message ?? String(err);\n throw new Error(\n `Failed to write DNS records to Headscale (namespace=${cfg.namespace}, pod=${cfg.pod}).\\n` +\n `${msg.includes(\"not found\") ? \"Pod not found. \" : \"\"}` +\n `Verify kubectl context: kubectl get pods -n ${cfg.namespace}`,\n );\n }\n}\n\n/**\n * Remove DNS records whose `name` ends with `suffix` from the Headscale pod.\n * Best-effort: logs a warning on failure instead of throwing.\n */\nexport function unregisterDnsRecords(cfg: HeadscaleDnsConfig, suffix: string): void {\n try {\n const records = readDnsRecords(cfg);\n const filtered = records.filter((r) => !r.name.endsWith(suffix));\n registerDnsRecords(cfg, filtered);\n } catch {\n // Best-effort cleanup \u2014 silent on failure\n }\n}\n"],
|
|
5
|
+
"mappings":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ts` used to build the commander program inline and immediately
|
|
5
|
+
* parse it, which meant the tree only existed inside a running CLI process.
|
|
6
|
+
* The docs generator needs to *walk* the tree without executing anything, so
|
|
7
|
+
* construction lives here and the bin is a thin runner.
|
|
8
|
+
*
|
|
9
|
+
* Nothing in this module may perform I/O or read credentials at import time —
|
|
10
|
+
* `mesh docs cli-reference` imports it in a plain node process with no AWS
|
|
11
|
+
* config, no Docker, and no TTY.
|
|
12
|
+
*/
|
|
13
|
+
import { Command } from "commander";
|
|
14
|
+
export declare const CLI_NAME = "mesh";
|
|
15
|
+
export declare const CLI_DESCRIPTION = "CLI for Mesh Lab development utilities";
|
|
16
|
+
/**
|
|
17
|
+
* Build a fresh `mesh` program.
|
|
18
|
+
*
|
|
19
|
+
* @param options.version version string for `--version`. Resolving the real
|
|
20
|
+
* one costs git spawns, so callers that don't need it (the docs generator)
|
|
21
|
+
* pass nothing and get a placeholder that never reaches generated output.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createProgram(options?: {
|
|
24
|
+
version?: string;
|
|
25
|
+
}): Command;
|
|
26
|
+
//# sourceMappingURL=program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../../src/program.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0BpC,eAAO,MAAM,QAAQ,SAAS,CAAC;AAC/B,eAAO,MAAM,eAAe,2CAA2C,CAAC;AAExE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CA+BzE"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `mesh` command tree, as data.
|
|
3
|
+
*
|
|
4
|
+
* `bin/mesh.ts` used to build the commander program inline and immediately
|
|
5
|
+
* parse it, which meant the tree only existed inside a running CLI process.
|
|
6
|
+
* The docs generator needs to *walk* the tree without executing anything, so
|
|
7
|
+
* construction lives here and the bin is a thin runner.
|
|
8
|
+
*
|
|
9
|
+
* Nothing in this module may perform I/O or read credentials at import time —
|
|
10
|
+
* `mesh docs cli-reference` imports it in a plain node process with no AWS
|
|
11
|
+
* config, no Docker, and no TTY.
|
|
12
|
+
*/
|
|
13
|
+
import { Command } from "commander";
|
|
14
|
+
import { registerArtifactsCommands } from "./commands/artifacts.js";
|
|
15
|
+
import { registerClusterCommands } from "./commands/cluster.js";
|
|
16
|
+
import { registerConversationsCommands } from "./commands/conversations.js";
|
|
17
|
+
import { registerCreateAppCommand } from "./commands/create-app.js";
|
|
18
|
+
import { registerDbCommands } from "./commands/db/index.js";
|
|
19
|
+
import { registerDeployCommand } from "./commands/deploy.js";
|
|
20
|
+
import { registerDevCommand } from "./commands/dev.js";
|
|
21
|
+
import { registerDocsCommand } from "./commands/docs.js";
|
|
22
|
+
import { registerHubCommands } from "./commands/hub/index.js";
|
|
23
|
+
import { registerInitCommands } from "./commands/init.js";
|
|
24
|
+
import { registerInstallShimCommand } from "./commands/install-shim.js";
|
|
25
|
+
import { registerLocalCommands } from "./commands/local/index.js";
|
|
26
|
+
import { registerLoginCommand } from "./commands/login.js";
|
|
27
|
+
import { registerRegistryCommands } from "./commands/registry.js";
|
|
28
|
+
import { registerSecretsCommands } from "./commands/secrets/index.js";
|
|
29
|
+
import { registerSkillsCommands } from "./commands/skills.js";
|
|
30
|
+
import { registerStackCommand } from "./commands/stack.js";
|
|
31
|
+
import { registerTemporalCommands } from "./commands/temporal.js";
|
|
32
|
+
import { registerTenantCommands } from "./commands/tenant.js";
|
|
33
|
+
import { registerTunnelCommands } from "./commands/tunnel/index.js";
|
|
34
|
+
import { registerVcsCommands } from "./commands/vcs/index.js";
|
|
35
|
+
import { registerVpnCommands } from "./commands/vpn/index.js";
|
|
36
|
+
import { registerWorkflowCommands } from "./commands/workflow.js";
|
|
37
|
+
export const CLI_NAME = "mesh";
|
|
38
|
+
export const CLI_DESCRIPTION = "CLI for Mesh Lab development utilities";
|
|
39
|
+
/**
|
|
40
|
+
* Build a fresh `mesh` program.
|
|
41
|
+
*
|
|
42
|
+
* @param options.version version string for `--version`. Resolving the real
|
|
43
|
+
* one costs git spawns, so callers that don't need it (the docs generator)
|
|
44
|
+
* pass nothing and get a placeholder that never reaches generated output.
|
|
45
|
+
*/
|
|
46
|
+
export function createProgram(options = {}) {
|
|
47
|
+
const program = new Command();
|
|
48
|
+
program.name(CLI_NAME).description(CLI_DESCRIPTION);
|
|
49
|
+
if (options.version !== undefined)
|
|
50
|
+
program.version(options.version);
|
|
51
|
+
registerLoginCommand(program);
|
|
52
|
+
registerRegistryCommands(program);
|
|
53
|
+
registerDbCommands(program);
|
|
54
|
+
registerDeployCommand(program);
|
|
55
|
+
registerDevCommand(program);
|
|
56
|
+
registerCreateAppCommand(program);
|
|
57
|
+
registerDocsCommand(program);
|
|
58
|
+
registerStackCommand(program);
|
|
59
|
+
registerTunnelCommands(program);
|
|
60
|
+
registerSecretsCommands(program);
|
|
61
|
+
registerArtifactsCommands(program);
|
|
62
|
+
registerConversationsCommands(program);
|
|
63
|
+
registerVpnCommands(program);
|
|
64
|
+
registerWorkflowCommands(program);
|
|
65
|
+
registerTemporalCommands(program);
|
|
66
|
+
registerClusterCommands(program);
|
|
67
|
+
registerVcsCommands(program);
|
|
68
|
+
registerLocalCommands(program);
|
|
69
|
+
registerHubCommands(program);
|
|
70
|
+
registerSkillsCommands(program);
|
|
71
|
+
registerInitCommands(program);
|
|
72
|
+
registerTenantCommands(program);
|
|
73
|
+
registerInstallShimCommand(program);
|
|
74
|
+
return program;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=program.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../../src/program.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM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9B,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,0BAA0B,CAAC,OAAO,CAAC,CAAC;IAEpC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First-run auth preflight helpers (MESH-2479).
|
|
3
|
+
*
|
|
4
|
+
* `mesh start`/`mesh dev` do long work (registry tarball fetches, docker
|
|
5
|
+
* builds, pnpm installs) that fails minutes in — with npm's generic advice —
|
|
6
|
+
* when the CodeArtifact token or AWS SSO session is stale. These helpers
|
|
7
|
+
* verify auth BEFORE the long work and name the exact fixing command.
|
|
8
|
+
*
|
|
9
|
+
* Pure parsers/classifiers are exported separately from the impure probes so
|
|
10
|
+
* the branch logic is unit-testable without network or a home directory.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The context that owns the `@mesh-tech` registry. There is exactly one — the
|
|
14
|
+
* `mesh-platform` CodeArtifact domain every tenant pulls from — so this is the
|
|
15
|
+
* context whose broker can mint a read token for anybody, and it is what a
|
|
16
|
+
* printed remediation should name.
|
|
17
|
+
*
|
|
18
|
+
* Safe to hardcode for the same reason `--profile mesh-dev` already was: it
|
|
19
|
+
* identifies the registry, not the reader's own platform. It also resolves on a
|
|
20
|
+
* machine with no AWS at all, via the pinned first-party alias.
|
|
21
|
+
*/
|
|
22
|
+
export declare const REGISTRY_CONTEXT = "mesh.dev";
|
|
23
|
+
/**
|
|
24
|
+
* The command that fixes a stale/missing CodeArtifact token — **broker-first**,
|
|
25
|
+
* so it works for someone with no AWS account at all.
|
|
26
|
+
*
|
|
27
|
+
* Prefer `registryLoginFix(context)` at any call site that knows a better
|
|
28
|
+
* context than the registry's own.
|
|
29
|
+
*/
|
|
30
|
+
export declare const REGISTRY_LOGIN_FIX = "mesh registry login mesh.dev";
|
|
31
|
+
/**
|
|
32
|
+
* The AWS-profile form. Only correct for people who **deploy**, or when the
|
|
33
|
+
* platform publishes no registry broker.
|
|
34
|
+
*
|
|
35
|
+
* Kept as a separate named constant rather than the default: `--profile`
|
|
36
|
+
* deliberately skips the broker, so printing it as the generic fix sends a
|
|
37
|
+
* developer with no AWS account to a command that cannot work for them.
|
|
38
|
+
*/
|
|
39
|
+
export declare const REGISTRY_LOGIN_FIX_AWS = "mesh registry login --profile mesh-dev";
|
|
40
|
+
/**
|
|
41
|
+
* Render the registry fix for a known context, falling back to the registry's
|
|
42
|
+
* own context when the caller has none. Always returns a command that can be
|
|
43
|
+
* run as printed — a remediation the reader has to edit first is half a
|
|
44
|
+
* remediation.
|
|
45
|
+
*/
|
|
46
|
+
export declare function registryLoginFix(context?: string): string;
|
|
47
|
+
/** The documented AWS SSO login form (root package.json `sso` script). */
|
|
48
|
+
export declare const SSO_LOGIN_FIX = "aws sso login --sso-session=mesh # or: pnpm sso";
|
|
49
|
+
/**
|
|
50
|
+
* The `aws configure sso-session` snippet `pnpm sso` depends on. Printed
|
|
51
|
+
* verbatim when ~/.aws/config has no [sso-session mesh] section — kept here
|
|
52
|
+
* so the CLI and scripts/sso-login.sh describe the same setup.
|
|
53
|
+
*/
|
|
54
|
+
export declare const SSO_SESSION_SNIPPET = "[sso-session mesh]\nsso_start_url = https://trabian.awsapps.com/start\nsso_region = us-east-1\nsso_registration_scopes = sso:account:access";
|
|
55
|
+
/**
|
|
56
|
+
* The user-level npmrc `aws codeartifact login` writes into — the token line
|
|
57
|
+
* and, when the namespace flag is omitted, the unscoped `registry=` line.
|
|
58
|
+
*
|
|
59
|
+
* One definition for the whole CLI: the doctor, the probe, and the repair have
|
|
60
|
+
* to be looking at the same file or they disagree about the same machine.
|
|
61
|
+
* `os.homedir()` reads `$HOME` on POSIX, so a scratch-`HOME` test still works.
|
|
62
|
+
*/
|
|
63
|
+
export declare function homeNpmrcPath(): string;
|
|
64
|
+
export interface NpmrcRegistryAuth {
|
|
65
|
+
/** Registry base URL, e.g. https://mesh-platform-…codeartifact…/npm/mesh-packages/ */
|
|
66
|
+
endpoint: string;
|
|
67
|
+
token: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Extract the CodeArtifact registry endpoint + auth token from npmrc content.
|
|
71
|
+
* `aws codeartifact login` writes a line shaped like:
|
|
72
|
+
* //mesh-platform-…d.codeartifact.<region>.amazonaws.com/npm/<repo>/:_authToken=<tok>
|
|
73
|
+
* Returns null when no CodeArtifact token line is present.
|
|
74
|
+
*/
|
|
75
|
+
export declare function parseNpmrcRegistryAuth(content: string): NpmrcRegistryAuth | null;
|
|
76
|
+
/**
|
|
77
|
+
* Find an **unscoped** `registry=` line in npmrc content that points at
|
|
78
|
+
* CodeArtifact — the line `aws codeartifact login` writes when it is run
|
|
79
|
+
* WITHOUT `--namespace @mesh-tech`.
|
|
80
|
+
*
|
|
81
|
+
* That line makes CodeArtifact the *default* registry, so every public package
|
|
82
|
+
* (lodash, react, …) is fetched through it with the CodeArtifact token. When
|
|
83
|
+
* the token expires 12 hours later, `npm install` of anything at all fails
|
|
84
|
+
* with E401 — the private-scope breakage everyone expects, plus a total public
|
|
85
|
+
* npm outage nobody does.
|
|
86
|
+
*
|
|
87
|
+
* Deliberately narrow — it must only match a line that is BOTH unscoped AND a
|
|
88
|
+
* CodeArtifact host, so it never touches:
|
|
89
|
+
* - `@mesh-tech:registry=…` (scoped: the line we WANT)
|
|
90
|
+
* - `//…:_authToken=…` (auth, unaffected by the default registry)
|
|
91
|
+
* - `registry=https://npm.acme.internal/` (a team's legitimate private mirror)
|
|
92
|
+
*
|
|
93
|
+
* Returns the offending line verbatim (as it appears in the file), or null.
|
|
94
|
+
*/
|
|
95
|
+
export declare function findUnscopedCodeArtifactRegistry(content: string): string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Remove every unscoped CodeArtifact `registry=` line from npmrc content.
|
|
98
|
+
* Pure: returns the rewritten content plus the first line removed (null when
|
|
99
|
+
* the content was already clean, in which case `content` is returned
|
|
100
|
+
* unchanged and callers should skip the write entirely).
|
|
101
|
+
*/
|
|
102
|
+
export declare function stripUnscopedCodeArtifactRegistry(content: string): {
|
|
103
|
+
content: string;
|
|
104
|
+
removed: string | null;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The `//host/path/:_authToken=` key `aws codeartifact login` writes for a
|
|
108
|
+
* registry endpoint — the endpoint with its scheme stripped and a leading `//`.
|
|
109
|
+
*
|
|
110
|
+
* Pure and shared so the broker path writes byte-identical lines to the AWS CLI
|
|
111
|
+
* path. Two spellings of the same key would leave a stale token line behind
|
|
112
|
+
* that npm might prefer, and the symptom (E401 hours later) points nowhere
|
|
113
|
+
* near the cause.
|
|
114
|
+
*/
|
|
115
|
+
export declare function npmrcAuthKeyForEndpoint(endpoint: string): string;
|
|
116
|
+
/**
|
|
117
|
+
* Upsert `key=value` lines into npmrc content: replace the existing line for a
|
|
118
|
+
* key when present, append it otherwise, and leave every other line untouched.
|
|
119
|
+
*
|
|
120
|
+
* Pure. Always emits a trailing newline, and never reorders lines a
|
|
121
|
+
* user put there themselves — an npmrc is a config file people hand-edit, and
|
|
122
|
+
* a token refresh that rewrites the whole thing is how unrelated settings
|
|
123
|
+
* silently disappear.
|
|
124
|
+
*/
|
|
125
|
+
export declare function upsertNpmrcLines(content: string, entries: ReadonlyArray<{
|
|
126
|
+
key: string;
|
|
127
|
+
value: string;
|
|
128
|
+
}>): string;
|
|
129
|
+
export type RegistryTokenState = "fresh" | "expired" | "missing" | "unreachable";
|
|
130
|
+
/** Map an HTTP status from an authenticated registry request to a token state. */
|
|
131
|
+
export declare function classifyRegistryStatus(status: number): "fresh" | "expired";
|
|
132
|
+
export interface RegistryProbe {
|
|
133
|
+
state: RegistryTokenState;
|
|
134
|
+
detail?: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Verify the CodeArtifact token in ~/.npmrc actually works, with one small
|
|
138
|
+
* authenticated metadata request (bounded by `timeoutMs`). Never throws.
|
|
139
|
+
*/
|
|
140
|
+
export declare function probeRegistryToken(opts?: {
|
|
141
|
+
npmrcPath?: string;
|
|
142
|
+
timeoutMs?: number;
|
|
143
|
+
fetchFn?: typeof fetch;
|
|
144
|
+
}): Promise<RegistryProbe>;
|
|
145
|
+
/** True when npm output/an error message is an auth failure (E401/E403). */
|
|
146
|
+
export declare function isNpmAuthErrorText(text: string): boolean;
|
|
147
|
+
/** True when an npm exec error (with stderr/message) is an auth failure. */
|
|
148
|
+
export declare function isNpmAuthError(err: unknown): boolean;
|
|
149
|
+
/** True when an AWS SDK/CLI error message means the ambient session expired. */
|
|
150
|
+
export declare function isExpiredAwsTokenMessage(message: string): boolean;
|
|
151
|
+
/** Names of `[sso-session <name>]` sections in an AWS config file. */
|
|
152
|
+
export declare function parseSsoSessionNames(content: string): string[];
|
|
153
|
+
/** True when the AWS config file declares the named profile. */
|
|
154
|
+
export declare function awsConfigHasProfile(content: string, profile: string): boolean;
|
|
155
|
+
/** Read ~/.aws/config (honoring AWS_CONFIG_FILE); "" when unreadable. */
|
|
156
|
+
export declare function readAwsConfig(): string;
|
|
157
|
+
/** True when the app's package.json depends on any @mesh-tech/* package. */
|
|
158
|
+
export declare function appUsesMeshPackages(appRoot: string): boolean;
|
|
159
|
+
//# sourceMappingURL=auth-preflight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-preflight.d.ts","sourceRoot":"","sources":["../../../src/utils/auth-preflight.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,iCAA4C,CAAC;AAE5E;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,2CAA2C,CAAC;AAE/E;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,0EAA0E;AAC1E,eAAO,MAAM,aAAa,sDAAsD,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,mBA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