@mesh-tech/mesh-cli 0.20.2 → 0.20.3
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/dist/bin/mesh.d.ts +0 -12
- package/dist/bin/mesh.js +12 -12
- package/dist/bin/mesh.js.map +0 -1
- package/dist/build-info.json +2 -2
- package/dist/src/commands/agent-api-client.d.ts +0 -70
- package/dist/src/commands/agent-api-client.js +0 -80
- package/dist/src/commands/app-check.d.ts +0 -56
- package/dist/src/commands/app-check.js +0 -72
- package/dist/src/commands/artifacts.d.ts +0 -11
- package/dist/src/commands/artifacts.js +0 -33
- package/dist/src/commands/cluster.d.ts +0 -39
- package/dist/src/commands/cluster.js +0 -73
- package/dist/src/commands/conversations.d.ts +0 -36
- package/dist/src/commands/conversations.js +0 -59
- package/dist/src/commands/create-app.d.ts +0 -98
- package/dist/src/commands/create-app.js +1 -163
- package/dist/src/commands/db/connect.d.ts +0 -7
- package/dist/src/commands/db/connect.js +0 -9
- package/dist/src/commands/db/credentials.d.ts +0 -7
- package/dist/src/commands/db/credentials.js +0 -10
- package/dist/src/commands/db/env.d.ts +0 -6
- package/dist/src/commands/db/env.js +0 -14
- package/dist/src/commands/db/exec.d.ts +0 -43
- package/dist/src/commands/db/exec.js +0 -69
- package/dist/src/commands/db/index.d.ts +0 -10
- package/dist/src/commands/db/index.js +0 -10
- package/dist/src/commands/db/psql.d.ts +0 -7
- package/dist/src/commands/db/psql.js +0 -18
- package/dist/src/commands/deploy.d.ts +0 -38
- package/dist/src/commands/deploy.js +1 -76
- package/dist/src/commands/dev-doctor.d.ts +0 -82
- package/dist/src/commands/dev-doctor.js +3 -132
- package/dist/src/commands/dev-launch.d.ts +0 -52
- package/dist/src/commands/dev-launch.js +0 -56
- package/dist/src/commands/dev-token-server.d.ts +0 -18
- package/dist/src/commands/dev-token-server.js +1 -24
- package/dist/src/commands/dev.d.ts +0 -246
- package/dist/src/commands/dev.js +5 -963
- package/dist/src/commands/docs.d.ts +0 -1
- package/dist/src/commands/docs.js +0 -12
- package/dist/src/commands/hub/index.d.ts +0 -60
- package/dist/src/commands/hub/index.js +2 -139
- package/dist/src/commands/init/wizard.d.ts +0 -128
- package/dist/src/commands/init/wizard.js +0 -109
- package/dist/src/commands/init.d.ts +0 -55
- package/dist/src/commands/init.js +0 -70
- package/dist/src/commands/install-shim.d.ts +0 -23
- package/dist/src/commands/install-shim.js +2 -29
- package/dist/src/commands/local/auth-provision.d.ts +0 -80
- package/dist/src/commands/local/auth-provision.js +0 -109
- package/dist/src/commands/local/dev-local.d.ts +0 -91
- package/dist/src/commands/local/dev-local.js +0 -147
- package/dist/src/commands/local/docker-runner.d.ts +0 -22
- package/dist/src/commands/local/docker-runner.js +2 -35
- package/dist/src/commands/local/helpers.d.ts +0 -14
- package/dist/src/commands/local/helpers.js +0 -13
- package/dist/src/commands/local/hub-local.d.ts +0 -96
- package/dist/src/commands/local/hub-local.js +0 -111
- package/dist/src/commands/local/index.d.ts +0 -14
- package/dist/src/commands/local/index.js +0 -86
- package/dist/src/commands/local/mocks.d.ts +0 -269
- package/dist/src/commands/local/mocks.js +1 -274
- package/dist/src/commands/local/seed-hub-catalog.d.ts +0 -25
- package/dist/src/commands/local/seed-hub-catalog.js +0 -41
- package/dist/src/commands/local/seed-zitadel.d.ts +0 -82
- package/dist/src/commands/local/seed-zitadel.js +0 -158
- package/dist/src/commands/local/seed.d.ts +0 -64
- package/dist/src/commands/local/seed.js +0 -78
- package/dist/src/commands/local/stack.d.ts +0 -141
- package/dist/src/commands/local/stack.js +0 -153
- package/dist/src/commands/login.d.ts +0 -265
- package/dist/src/commands/login.js +4 -418
- package/dist/src/commands/peer-addressing.d.ts +0 -39
- package/dist/src/commands/peer-addressing.js +0 -37
- package/dist/src/commands/port-ownership.d.ts +0 -44
- package/dist/src/commands/port-ownership.js +0 -47
- package/dist/src/commands/registry-publish.d.ts +0 -1
- package/dist/src/commands/registry-publish.js +0 -46
- package/dist/src/commands/registry.d.ts +4 -237
- package/dist/src/commands/registry.js +2 -316
- package/dist/src/commands/secrets/exec.d.ts +0 -16
- package/dist/src/commands/secrets/exec.js +0 -24
- package/dist/src/commands/secrets/index.d.ts +0 -9
- package/dist/src/commands/secrets/index.js +0 -10
- package/dist/src/commands/secrets/migrate-config.d.ts +0 -17
- package/dist/src/commands/secrets/migrate-config.js +0 -40
- package/dist/src/commands/secrets/reindex.d.ts +0 -38
- package/dist/src/commands/secrets/reindex.js +0 -39
- package/dist/src/commands/secrets/set.d.ts +0 -47
- package/dist/src/commands/secrets/set.js +0 -107
- package/dist/src/commands/site.d.ts +0 -1
- package/dist/src/commands/site.js +0 -61
- package/dist/src/commands/skills.d.ts +0 -61
- package/dist/src/commands/skills.js +0 -83
- package/dist/src/commands/stack.d.ts +0 -15
- package/dist/src/commands/stack.js +1 -128
- package/dist/src/commands/temporal.d.ts +0 -30
- package/dist/src/commands/temporal.js.map +0 -1
- package/dist/src/commands/tenant.d.ts +0 -31
- package/dist/src/commands/tenant.js +0 -55
- package/dist/src/commands/tunnel/index.d.ts +0 -40
- package/dist/src/commands/tunnel/index.js +0 -141
- package/dist/src/commands/vcs/clone.d.ts +0 -1
- package/dist/src/commands/vcs/clone.js +0 -4
- package/dist/src/commands/vcs/common.d.ts +0 -32
- package/dist/src/commands/vcs/common.js +0 -41
- package/dist/src/commands/vcs/drafts.d.ts +0 -1
- package/dist/src/commands/vcs/drafts.js +0 -1
- package/dist/src/commands/vcs/get.d.ts +0 -1
- package/dist/src/commands/vcs/get.js +0 -11
- package/dist/src/commands/vcs/index.d.ts +0 -1
- package/dist/src/commands/vcs/index.js +0 -1
- package/dist/src/commands/vcs/propose.d.ts +0 -26
- package/dist/src/commands/vcs/propose.js +3 -34
- package/dist/src/commands/vcs/review.d.ts +0 -1
- package/dist/src/commands/vcs/review.js +0 -1
- package/dist/src/commands/vcs/rm.d.ts +0 -11
- package/dist/src/commands/vcs/rm.js +0 -14
- package/dist/src/commands/vcs-enrich.d.ts +0 -12
- package/dist/src/commands/vcs-enrich.js +0 -12
- package/dist/src/commands/vpn/index.d.ts +0 -17
- package/dist/src/commands/vpn/index.js +0 -102
- package/dist/src/commands/vpn/tunnel.d.ts +0 -9
- package/dist/src/commands/vpn/tunnel.js +0 -37
- package/dist/src/commands/workflow.d.ts +0 -22
- package/dist/src/commands/workflow.js +0 -80
- package/dist/src/docs/assemble.d.ts +0 -117
- package/dist/src/docs/assemble.js +0 -142
- package/dist/src/docs/cli-reference.d.ts +0 -58
- package/dist/src/docs/cli-reference.js +0 -77
- package/dist/src/docs/discover.d.ts +0 -40
- package/dist/src/docs/discover.js +2 -60
- package/dist/src/docs/portal.d.ts +0 -44
- package/dist/src/docs/portal.js +0 -49
- package/dist/src/docs/registry-docs.d.ts +0 -29
- package/dist/src/docs/registry-docs.js +0 -40
- package/dist/src/docs/schema.d.ts +0 -36
- package/dist/src/docs/schema.js +0 -52
- package/dist/src/docs/serve.d.ts +0 -18
- package/dist/src/docs/serve.js +2 -30
- package/dist/src/docs/start.d.ts +0 -42
- package/dist/src/docs/start.js +0 -70
- package/dist/src/eval/agent-eval.d.mts +0 -12
- package/dist/src/eval/agent-eval.mjs +0 -22
- package/dist/src/index.d.ts +0 -6
- package/dist/src/index.js.map +0 -1
- package/dist/src/program.d.ts +0 -20
- package/dist/src/program.js +0 -24
- package/dist/src/utils/auth-preflight.d.ts +0 -137
- package/dist/src/utils/auth-preflight.js +0 -149
- package/dist/src/utils/aws-auth.d.ts +0 -163
- package/dist/src/utils/aws-auth.js +3 -232
- package/dist/src/utils/bastion.d.ts +0 -27
- package/dist/src/utils/bastion.js +0 -28
- package/dist/src/utils/build-info.d.ts +0 -22
- package/dist/src/utils/build-info.js +0 -27
- package/dist/src/utils/cache-home.d.ts +0 -23
- package/dist/src/utils/cache-home.js +0 -25
- package/dist/src/utils/capture-history.d.ts +0 -54
- package/dist/src/utils/capture-history.js +1 -55
- package/dist/src/utils/context.d.ts +0 -23
- package/dist/src/utils/context.js +0 -43
- package/dist/src/utils/credentials.d.ts +0 -38
- package/dist/src/utils/credentials.js +0 -39
- package/dist/src/utils/deploy-preflight.d.ts +0 -38
- package/dist/src/utils/deploy-preflight.js +1 -71
- package/dist/src/utils/errors.d.ts +0 -53
- package/dist/src/utils/errors.js +0 -49
- package/dist/src/utils/first-party-contexts.d.ts +0 -38
- package/dist/src/utils/first-party-contexts.js +0 -44
- package/dist/src/utils/index.d.ts +0 -4
- package/dist/src/utils/index.js +0 -4
- package/dist/src/utils/kubeconfig.d.ts +0 -40
- package/dist/src/utils/kubeconfig.js +0 -44
- package/dist/src/utils/log.d.ts +0 -20
- package/dist/src/utils/log.js +0 -20
- package/dist/src/utils/mesh-json.d.ts +0 -46
- package/dist/src/utils/mesh-json.js +0 -39
- package/dist/src/utils/pid.d.ts +0 -42
- package/dist/src/utils/pid.js +0 -48
- package/dist/src/utils/pulumi-run.d.ts +0 -14
- package/dist/src/utils/pulumi-run.js +0 -42
- package/dist/src/utils/pulumi.d.ts +0 -34
- package/dist/src/utils/pulumi.js +0 -38
- package/dist/src/utils/reachability.d.ts +0 -27
- package/dist/src/utils/reachability.js +0 -40
- package/dist/src/utils/recover-conversation.d.ts +0 -110
- package/dist/src/utils/recover-conversation.js +0 -108
- package/dist/src/utils/registry-broker.d.ts +5 -84
- package/dist/src/utils/registry-broker.js +0 -62
- package/dist/src/utils/registry-identity.d.ts +0 -149
- package/dist/src/utils/registry-identity.js +0 -143
- package/dist/src/utils/scaffold-versions.d.ts +0 -41
- package/dist/src/utils/scaffold-versions.js +0 -42
- package/dist/src/utils/socks-forward.d.ts +0 -24
- package/dist/src/utils/socks-forward.js +2 -25
- package/dist/src/utils/stack-flag.d.ts +0 -13
- package/dist/src/utils/stack-flag.js +0 -21
- package/dist/src/utils/tailscale-targets.d.ts +0 -37
- package/dist/src/utils/tailscale-targets.js +0 -33
- package/dist/src/utils/tailscale.d.ts +0 -177
- package/dist/src/utils/tailscale.js +6 -337
- package/dist/src/utils/temporal-auth.d.ts +0 -41
- package/dist/src/utils/temporal-auth.js +0 -52
- package/dist/src/utils/temporal-codec.d.ts +0 -89
- package/dist/src/utils/temporal-codec.js.map +0 -1
- package/dist/src/utils/tunnel-ownership.d.ts +0 -79
- package/dist/src/utils/tunnel-ownership.js +0 -74
- package/dist/src/utils/vpn-join.d.ts +0 -16
- package/dist/src/utils/vpn-join.js +0 -17
- package/dist/src/utils/vpn.d.ts +0 -42
- package/dist/src/utils/vpn.js +0 -52
- package/dist/src/utils/workflow-fingerprint.d.ts +0 -39
- package/dist/src/utils/workflow-fingerprint.js +1 -63
- package/dist/src/utils/worktree-identity.d.ts +0 -62
- package/dist/src/utils/worktree-identity.js +0 -88
- package/package.json +1 -1
- package/skills/core/SKILL.md +9 -10
- package/templates/api-auth/api/src/index.ts.hbs +1 -1
- package/templates/api-auth/api/src/spicedb-http-provider.ts.hbs +2 -2
- package/templates/api-role-gating/api/src/authn.ts.hbs +2 -2
- package/templates/api-role-gating/index.ts.hbs +1 -1
- package/templates/api-role-gating/skills/develop/SKILL.md.hbs +1 -1
- package/templates/platform-repo/core/Pulumi.{{tenant}}-{{env}}.yaml.hbs +2 -2
- package/templates/platform-repo/platform/index.ts +1 -1
- package/dist/bin/mesh.d.ts.map +0 -1
- package/dist/src/commands/agent-api-client.d.ts.map +0 -1
- package/dist/src/commands/agent-api-client.js.map +0 -1
- package/dist/src/commands/app-check.d.ts.map +0 -1
- package/dist/src/commands/app-check.js.map +0 -1
- package/dist/src/commands/artifacts.d.ts.map +0 -1
- package/dist/src/commands/artifacts.js.map +0 -1
- package/dist/src/commands/cluster.d.ts.map +0 -1
- package/dist/src/commands/cluster.js.map +0 -1
- package/dist/src/commands/conversations.d.ts.map +0 -1
- package/dist/src/commands/conversations.js.map +0 -1
- package/dist/src/commands/create-app.d.ts.map +0 -1
- package/dist/src/commands/create-app.js.map +0 -1
- package/dist/src/commands/db/connect.d.ts.map +0 -1
- package/dist/src/commands/db/connect.js.map +0 -1
- package/dist/src/commands/db/credentials.d.ts.map +0 -1
- package/dist/src/commands/db/credentials.js.map +0 -1
- package/dist/src/commands/db/env.d.ts.map +0 -1
- package/dist/src/commands/db/env.js.map +0 -1
- package/dist/src/commands/db/exec.d.ts.map +0 -1
- package/dist/src/commands/db/exec.js.map +0 -1
- package/dist/src/commands/db/index.d.ts.map +0 -1
- package/dist/src/commands/db/index.js.map +0 -1
- package/dist/src/commands/db/psql.d.ts.map +0 -1
- package/dist/src/commands/db/psql.js.map +0 -1
- package/dist/src/commands/deploy.d.ts.map +0 -1
- package/dist/src/commands/deploy.js.map +0 -1
- package/dist/src/commands/dev-doctor.d.ts.map +0 -1
- package/dist/src/commands/dev-doctor.js.map +0 -1
- package/dist/src/commands/dev-launch.d.ts.map +0 -1
- package/dist/src/commands/dev-launch.js.map +0 -1
- package/dist/src/commands/dev-token-server.d.ts.map +0 -1
- package/dist/src/commands/dev-token-server.js.map +0 -1
- package/dist/src/commands/dev.d.ts.map +0 -1
- package/dist/src/commands/dev.js.map +0 -1
- package/dist/src/commands/docs.d.ts.map +0 -1
- package/dist/src/commands/docs.js.map +0 -1
- package/dist/src/commands/hub/index.d.ts.map +0 -1
- package/dist/src/commands/hub/index.js.map +0 -1
- package/dist/src/commands/init/wizard.d.ts.map +0 -1
- package/dist/src/commands/init/wizard.js.map +0 -1
- package/dist/src/commands/init.d.ts.map +0 -1
- package/dist/src/commands/init.js.map +0 -1
- package/dist/src/commands/install-shim.d.ts.map +0 -1
- package/dist/src/commands/install-shim.js.map +0 -1
- package/dist/src/commands/local/auth-provision.d.ts.map +0 -1
- package/dist/src/commands/local/auth-provision.js.map +0 -1
- package/dist/src/commands/local/dev-local.d.ts.map +0 -1
- package/dist/src/commands/local/dev-local.js.map +0 -1
- package/dist/src/commands/local/docker-runner.d.ts.map +0 -1
- package/dist/src/commands/local/docker-runner.js.map +0 -1
- package/dist/src/commands/local/helpers.d.ts.map +0 -1
- package/dist/src/commands/local/helpers.js.map +0 -1
- package/dist/src/commands/local/hub-local.d.ts.map +0 -1
- package/dist/src/commands/local/hub-local.js.map +0 -1
- package/dist/src/commands/local/index.d.ts.map +0 -1
- package/dist/src/commands/local/index.js.map +0 -1
- package/dist/src/commands/local/mocks.d.ts.map +0 -1
- package/dist/src/commands/local/mocks.js.map +0 -1
- package/dist/src/commands/local/seed-hub-catalog.d.ts.map +0 -1
- package/dist/src/commands/local/seed-hub-catalog.js.map +0 -1
- package/dist/src/commands/local/seed-zitadel.d.ts.map +0 -1
- package/dist/src/commands/local/seed-zitadel.js.map +0 -1
- package/dist/src/commands/local/seed.d.ts.map +0 -1
- package/dist/src/commands/local/seed.js.map +0 -1
- package/dist/src/commands/local/stack.d.ts.map +0 -1
- package/dist/src/commands/local/stack.js.map +0 -1
- package/dist/src/commands/login.d.ts.map +0 -1
- package/dist/src/commands/login.js.map +0 -1
- package/dist/src/commands/peer-addressing.d.ts.map +0 -1
- package/dist/src/commands/peer-addressing.js.map +0 -1
- package/dist/src/commands/port-ownership.d.ts.map +0 -1
- package/dist/src/commands/port-ownership.js.map +0 -1
- package/dist/src/commands/registry-publish.d.ts.map +0 -1
- package/dist/src/commands/registry-publish.js.map +0 -1
- package/dist/src/commands/registry.d.ts.map +0 -1
- package/dist/src/commands/registry.js.map +0 -1
- package/dist/src/commands/secrets/exec.d.ts.map +0 -1
- package/dist/src/commands/secrets/exec.js.map +0 -1
- package/dist/src/commands/secrets/index.d.ts.map +0 -1
- package/dist/src/commands/secrets/index.js.map +0 -1
- package/dist/src/commands/secrets/migrate-config.d.ts.map +0 -1
- package/dist/src/commands/secrets/migrate-config.js.map +0 -1
- package/dist/src/commands/secrets/reindex.d.ts.map +0 -1
- package/dist/src/commands/secrets/reindex.js.map +0 -1
- package/dist/src/commands/secrets/set.d.ts.map +0 -1
- package/dist/src/commands/secrets/set.js.map +0 -1
- package/dist/src/commands/site.d.ts.map +0 -1
- package/dist/src/commands/site.js.map +0 -1
- package/dist/src/commands/skills.d.ts.map +0 -1
- package/dist/src/commands/skills.js.map +0 -1
- package/dist/src/commands/stack.d.ts.map +0 -1
- package/dist/src/commands/stack.js.map +0 -1
- package/dist/src/commands/temporal.d.ts.map +0 -1
- package/dist/src/commands/tenant.d.ts.map +0 -1
- package/dist/src/commands/tenant.js.map +0 -1
- package/dist/src/commands/tunnel/index.d.ts.map +0 -1
- package/dist/src/commands/tunnel/index.js.map +0 -1
- package/dist/src/commands/vcs/clone.d.ts.map +0 -1
- package/dist/src/commands/vcs/clone.js.map +0 -1
- package/dist/src/commands/vcs/common.d.ts.map +0 -1
- package/dist/src/commands/vcs/common.js.map +0 -1
- package/dist/src/commands/vcs/drafts.d.ts.map +0 -1
- package/dist/src/commands/vcs/drafts.js.map +0 -1
- package/dist/src/commands/vcs/get.d.ts.map +0 -1
- package/dist/src/commands/vcs/get.js.map +0 -1
- package/dist/src/commands/vcs/index.d.ts.map +0 -1
- package/dist/src/commands/vcs/index.js.map +0 -1
- package/dist/src/commands/vcs/propose.d.ts.map +0 -1
- package/dist/src/commands/vcs/propose.js.map +0 -1
- package/dist/src/commands/vcs/review.d.ts.map +0 -1
- package/dist/src/commands/vcs/review.js.map +0 -1
- package/dist/src/commands/vcs/rm.d.ts.map +0 -1
- package/dist/src/commands/vcs/rm.js.map +0 -1
- package/dist/src/commands/vcs-enrich.d.ts.map +0 -1
- package/dist/src/commands/vcs-enrich.js.map +0 -1
- package/dist/src/commands/vpn/index.d.ts.map +0 -1
- package/dist/src/commands/vpn/index.js.map +0 -1
- package/dist/src/commands/vpn/tunnel.d.ts.map +0 -1
- package/dist/src/commands/vpn/tunnel.js.map +0 -1
- package/dist/src/commands/workflow.d.ts.map +0 -1
- package/dist/src/commands/workflow.js.map +0 -1
- package/dist/src/docs/assemble.d.ts.map +0 -1
- package/dist/src/docs/assemble.js.map +0 -1
- package/dist/src/docs/cli-reference.d.ts.map +0 -1
- package/dist/src/docs/cli-reference.js.map +0 -1
- package/dist/src/docs/discover.d.ts.map +0 -1
- package/dist/src/docs/discover.js.map +0 -1
- package/dist/src/docs/portal.d.ts.map +0 -1
- package/dist/src/docs/portal.js.map +0 -1
- package/dist/src/docs/registry-docs.d.ts.map +0 -1
- package/dist/src/docs/registry-docs.js.map +0 -1
- package/dist/src/docs/schema.d.ts.map +0 -1
- package/dist/src/docs/schema.js.map +0 -1
- package/dist/src/docs/serve.d.ts.map +0 -1
- package/dist/src/docs/serve.js.map +0 -1
- package/dist/src/docs/start.d.ts.map +0 -1
- package/dist/src/docs/start.js.map +0 -1
- package/dist/src/eval/agent-eval.d.mts.map +0 -1
- package/dist/src/eval/agent-eval.mjs.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/program.d.ts.map +0 -1
- package/dist/src/program.js.map +0 -1
- package/dist/src/utils/auth-preflight.d.ts.map +0 -1
- package/dist/src/utils/auth-preflight.js.map +0 -1
- package/dist/src/utils/aws-auth.d.ts.map +0 -1
- package/dist/src/utils/aws-auth.js.map +0 -1
- package/dist/src/utils/bastion.d.ts.map +0 -1
- package/dist/src/utils/bastion.js.map +0 -1
- package/dist/src/utils/build-info.d.ts.map +0 -1
- package/dist/src/utils/build-info.js.map +0 -1
- package/dist/src/utils/cache-home.d.ts.map +0 -1
- package/dist/src/utils/cache-home.js.map +0 -1
- package/dist/src/utils/capture-history.d.ts.map +0 -1
- package/dist/src/utils/capture-history.js.map +0 -1
- package/dist/src/utils/context.d.ts.map +0 -1
- package/dist/src/utils/context.js.map +0 -1
- package/dist/src/utils/credentials.d.ts.map +0 -1
- package/dist/src/utils/credentials.js.map +0 -1
- package/dist/src/utils/deploy-preflight.d.ts.map +0 -1
- package/dist/src/utils/deploy-preflight.js.map +0 -1
- package/dist/src/utils/errors.d.ts.map +0 -1
- package/dist/src/utils/errors.js.map +0 -1
- package/dist/src/utils/first-party-contexts.d.ts.map +0 -1
- package/dist/src/utils/first-party-contexts.js.map +0 -1
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/kubeconfig.d.ts.map +0 -1
- package/dist/src/utils/kubeconfig.js.map +0 -1
- package/dist/src/utils/log.d.ts.map +0 -1
- package/dist/src/utils/log.js.map +0 -1
- package/dist/src/utils/mesh-json.d.ts.map +0 -1
- package/dist/src/utils/mesh-json.js.map +0 -1
- package/dist/src/utils/pid.d.ts.map +0 -1
- package/dist/src/utils/pid.js.map +0 -1
- package/dist/src/utils/pulumi-run.d.ts.map +0 -1
- package/dist/src/utils/pulumi-run.js.map +0 -1
- package/dist/src/utils/pulumi.d.ts.map +0 -1
- package/dist/src/utils/pulumi.js.map +0 -1
- package/dist/src/utils/reachability.d.ts.map +0 -1
- package/dist/src/utils/reachability.js.map +0 -1
- package/dist/src/utils/recover-conversation.d.ts.map +0 -1
- package/dist/src/utils/recover-conversation.js.map +0 -1
- package/dist/src/utils/registry-broker.d.ts.map +0 -1
- package/dist/src/utils/registry-broker.js.map +0 -1
- package/dist/src/utils/registry-identity.d.ts.map +0 -1
- package/dist/src/utils/registry-identity.js.map +0 -1
- package/dist/src/utils/scaffold-versions.d.ts.map +0 -1
- package/dist/src/utils/scaffold-versions.js.map +0 -1
- package/dist/src/utils/socks-forward.d.ts.map +0 -1
- package/dist/src/utils/socks-forward.js.map +0 -1
- package/dist/src/utils/stack-flag.d.ts.map +0 -1
- package/dist/src/utils/stack-flag.js.map +0 -1
- package/dist/src/utils/tailscale-targets.d.ts.map +0 -1
- package/dist/src/utils/tailscale-targets.js.map +0 -1
- package/dist/src/utils/tailscale.d.ts.map +0 -1
- package/dist/src/utils/tailscale.js.map +0 -1
- package/dist/src/utils/temporal-auth.d.ts.map +0 -1
- package/dist/src/utils/temporal-auth.js.map +0 -1
- package/dist/src/utils/temporal-codec.d.ts.map +0 -1
- package/dist/src/utils/tunnel-ownership.d.ts.map +0 -1
- package/dist/src/utils/tunnel-ownership.js.map +0 -1
- package/dist/src/utils/vpn-join.d.ts.map +0 -1
- package/dist/src/utils/vpn-join.js.map +0 -1
- package/dist/src/utils/vpn.d.ts.map +0 -1
- package/dist/src/utils/vpn.js.map +0 -1
- package/dist/src/utils/workflow-fingerprint.d.ts.map +0 -1
- package/dist/src/utils/workflow-fingerprint.js.map +0 -1
- package/dist/src/utils/worktree-identity.d.ts.map +0 -1
- package/dist/src/utils/worktree-identity.js.map +0 -1
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mesh registry — Manage npm registry authentication for @mesh-tech packages.
|
|
3
|
-
*
|
|
4
|
-
* Handles CodeArtifact token refresh and project .npmrc setup so that
|
|
5
|
-
* `pnpm install` can resolve @mesh-tech/* packages from the private registry.
|
|
6
|
-
*
|
|
7
|
-
* The registry is ONE global identity (`utils/registry-identity.ts`), so the
|
|
8
|
-
* read path needs no platform context: `mesh registry login` resolves the
|
|
9
|
-
* registry, signs in to its issuer if there is no cached session, asks the
|
|
10
|
-
* Zitadel-gated `registry-auth` broker for a token, and writes `~/.npmrc` —
|
|
11
|
-
* one command, one browser round-trip, no AWS anything on the machine.
|
|
12
|
-
*
|
|
13
|
-
* Credential resolution, in order:
|
|
14
|
-
* 0. The registry-auth BROKER, authenticated with the registry session.
|
|
15
|
-
* This is the path a brand-new developer takes.
|
|
16
|
-
* 1. Existing AWS credentials in environment (CI/CD) → use directly
|
|
17
|
-
* 2. Zitadel JWT from `mesh login <context>` → AssumeRoleWithWebIdentity
|
|
18
|
-
* 3. AWS SSO / current profile → use directly
|
|
19
|
-
*
|
|
20
|
-
* Paths 1–3 all shell out to the AWS CLI, so they require it to be installed
|
|
21
|
-
* and credentialed. Path 0 requires only a Mesh account, which is the whole
|
|
22
|
-
* point (design: registry-access-without-aws-sso).
|
|
23
|
-
*
|
|
24
|
-
* Usage:
|
|
25
|
-
* mesh registry login — broker first (signs in if needed), then the AWS paths
|
|
26
|
-
* mesh registry login --device — same, device-code sign-in (headless / SSH)
|
|
27
|
-
* mesh registry login --ci — CI mode: AWS chain only, skip .npmrc creation
|
|
28
|
-
* mesh registry login --no-broker — skip the broker, force the AWS paths
|
|
29
|
-
* mesh registry login --profile p — a deployer's AWS profile (skips the broker)
|
|
30
|
-
* mesh registry logout — forget the registry session
|
|
31
|
-
* mesh registry status — show current auth state
|
|
32
|
-
*/
|
|
33
1
|
import { execFileSync } from "child_process";
|
|
34
2
|
import * as fs from "fs";
|
|
35
3
|
import * as path from "path";
|
|
@@ -40,22 +8,11 @@ import { fetchRegistryGrant, realGrantDeps, PUBLISHED_BROKER_TIMEOUT_MS, } from
|
|
|
40
8
|
import { clearRegistrySession, describeSessionExpiry, ensureRegistrySession, identityChanged, logRegistryIdentity, readRegistrySession, refreshRegistrySession, resolveRegistryIdentity, } from "../utils/registry-identity.js";
|
|
41
9
|
import { readCredentials } from "./login.js";
|
|
42
10
|
import { registerRegistryPublish } from "./registry-publish.js";
|
|
43
|
-
// =============================================================================
|
|
44
|
-
// Constants — platform CodeArtifact registry
|
|
45
|
-
// =============================================================================
|
|
46
11
|
const CA_DOMAIN = "mesh-platform";
|
|
47
12
|
const CA_REPOSITORY = "mesh-packages";
|
|
48
13
|
const CA_NAMESPACE = "@mesh-tech";
|
|
49
14
|
const CA_REGION = "us-east-2";
|
|
50
|
-
// Default registry role — tenants get read access via their deployer role,
|
|
51
|
-
// but a dedicated read-only role can be configured here.
|
|
52
15
|
const DEFAULT_REGISTRY_ROLE = null;
|
|
53
|
-
// =============================================================================
|
|
54
|
-
// Helpers
|
|
55
|
-
// =============================================================================
|
|
56
|
-
/**
|
|
57
|
-
* Get the CodeArtifact repository endpoint URL.
|
|
58
|
-
*/
|
|
59
16
|
function getEndpoint(env) {
|
|
60
17
|
try {
|
|
61
18
|
const result = execFileSync("aws", [
|
|
@@ -77,9 +34,6 @@ function getEndpoint(env) {
|
|
|
77
34
|
return null;
|
|
78
35
|
}
|
|
79
36
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Run `aws codeartifact login` to set the auth token in ~/.npmrc.
|
|
82
|
-
*/
|
|
83
37
|
export function codeartifactLogin(env) {
|
|
84
38
|
try {
|
|
85
39
|
execFileSync("aws", [
|
|
@@ -100,27 +54,12 @@ export function codeartifactLogin(env) {
|
|
|
100
54
|
return false;
|
|
101
55
|
}
|
|
102
56
|
}
|
|
103
|
-
/**
|
|
104
|
-
* Parse a mesh context like "mesh.dev" into tenant + env.
|
|
105
|
-
* Returns null if the context doesn't match the expected {tenant}.{env} pattern.
|
|
106
|
-
*
|
|
107
|
-
* (Mirrors login.ts's parseTenantEnv — kept local/minimal here to avoid
|
|
108
|
-
* expanding login.ts's export surface for a single caller.)
|
|
109
|
-
*/
|
|
110
57
|
function parseTenantEnv(context) {
|
|
111
58
|
const parts = context.split(".");
|
|
112
59
|
if (parts.length !== 2 || !parts[0] || !parts[1])
|
|
113
60
|
return null;
|
|
114
61
|
return { tenant: parts[0], env: parts[1] };
|
|
115
62
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Read the registry's SSM export (published by PackageRegistry, Task 2 of
|
|
118
|
-
* MESH-2168) for a given tenant/env, e.g. /mesh-platform/mesh/dev/registry.
|
|
119
|
-
*
|
|
120
|
-
* Returns null on any failure (missing param, no AWS creds, malformed JSON) —
|
|
121
|
-
* callers treat a null publisherRoleArn as "not configured" and surface an
|
|
122
|
-
* actionable error via resolvePublisherRoleArn.
|
|
123
|
-
*/
|
|
124
63
|
async function getRegistrySsmExport(tenant, env) {
|
|
125
64
|
try {
|
|
126
65
|
const { SSMClient, GetParameterCommand } = await import("@aws-sdk/client-ssm");
|
|
@@ -136,24 +75,13 @@ async function getRegistrySsmExport(tenant, env) {
|
|
|
136
75
|
return null;
|
|
137
76
|
}
|
|
138
77
|
}
|
|
139
|
-
/**
|
|
140
|
-
* Resolve the publisher role ARN to assume for `--publish`.
|
|
141
|
-
*
|
|
142
|
-
* Precedence: explicit --role-arn flag wins, then the registry's SSM export
|
|
143
|
-
* (publisherRoleArn, Task 2 of MESH-2168). Throws an actionable error if
|
|
144
|
-
* neither is available — there's no safe default to fall back to since
|
|
145
|
-
* publishing is an opt-in privileged path (DEFAULT_REGISTRY_ROLE stays null).
|
|
146
|
-
*/
|
|
147
78
|
export function resolvePublisherRoleArn({ roleArnFlag, ssmArn, }) {
|
|
148
79
|
const resolved = roleArnFlag || ssmArn;
|
|
149
80
|
if (!resolved) {
|
|
150
|
-
throw new Error("No publisher role: pass --role or ensure the registry stack exported publisherRoleArn
|
|
81
|
+
throw new Error("No publisher role: pass --role or ensure the registry stack exported publisherRoleArn.");
|
|
151
82
|
}
|
|
152
83
|
return resolved;
|
|
153
84
|
}
|
|
154
|
-
/**
|
|
155
|
-
* Assume an IAM role, return credential env vars.
|
|
156
|
-
*/
|
|
157
85
|
function assumeRole(roleArn) {
|
|
158
86
|
try {
|
|
159
87
|
const result = execFileSync("aws", [
|
|
@@ -173,9 +101,6 @@ function assumeRole(roleArn) {
|
|
|
173
101
|
return null;
|
|
174
102
|
}
|
|
175
103
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Assume role via Zitadel JWT (AssumeRoleWithWebIdentity).
|
|
178
|
-
*/
|
|
179
104
|
function assumeRoleWithWebIdentity(roleArn, idToken, sessionName) {
|
|
180
105
|
try {
|
|
181
106
|
const result = execFileSync("aws", [
|
|
@@ -196,18 +121,11 @@ function assumeRoleWithWebIdentity(roleArn, idToken, sessionName) {
|
|
|
196
121
|
return null;
|
|
197
122
|
}
|
|
198
123
|
}
|
|
199
|
-
/**
|
|
200
|
-
* Resolve AWS credentials for registry access.
|
|
201
|
-
*
|
|
202
|
-
* Returns env var overrides (or empty object if current env is fine).
|
|
203
|
-
*/
|
|
204
124
|
export function resolveCredentials(context, roleArn) {
|
|
205
|
-
// Path 1: Existing AWS credentials in environment
|
|
206
125
|
if (process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SESSION_TOKEN) {
|
|
207
126
|
logInfo("Using existing AWS credentials from environment");
|
|
208
127
|
return {};
|
|
209
128
|
}
|
|
210
|
-
// Path 2: Zitadel JWT → AssumeRoleWithWebIdentity
|
|
211
129
|
if (context) {
|
|
212
130
|
const meshCreds = readCredentials(context);
|
|
213
131
|
if (meshCreds && new Date(meshCreds.expiresAt) > new Date()) {
|
|
@@ -235,7 +153,6 @@ export function resolveCredentials(context, roleArn) {
|
|
|
235
153
|
logWarn(`No Zitadel credentials for ${context}. Run: mesh login ${context}`);
|
|
236
154
|
}
|
|
237
155
|
}
|
|
238
|
-
// Path 3: AssumeRole via current AWS session (if a role was specified)
|
|
239
156
|
if (roleArn) {
|
|
240
157
|
logInfo(`Assuming ${roleArn.split("/").pop()} via AWS SSO`);
|
|
241
158
|
const creds = assumeRole(roleArn);
|
|
@@ -245,14 +162,9 @@ export function resolveCredentials(context, roleArn) {
|
|
|
245
162
|
}
|
|
246
163
|
logWarn("Role assumption failed — trying current credentials directly");
|
|
247
164
|
}
|
|
248
|
-
// Path 4: Current AWS profile/credentials as-is
|
|
249
165
|
logInfo("Using current AWS profile");
|
|
250
166
|
return {};
|
|
251
167
|
}
|
|
252
|
-
/**
|
|
253
|
-
* Find project root by looking for pnpm-workspace.yaml, package.json, or .git
|
|
254
|
-
* walking up from cwd.
|
|
255
|
-
*/
|
|
256
168
|
function findProjectRoot() {
|
|
257
169
|
let dir = process.cwd();
|
|
258
170
|
while (true) {
|
|
@@ -268,11 +180,6 @@ function findProjectRoot() {
|
|
|
268
180
|
dir = parent;
|
|
269
181
|
}
|
|
270
182
|
}
|
|
271
|
-
/**
|
|
272
|
-
* Ensure project .npmrc has the @mesh-tech registry scope entry.
|
|
273
|
-
* Creates the file if it doesn't exist. Doesn't touch auth tokens
|
|
274
|
-
* (those live in ~/.npmrc via `aws codeartifact login`).
|
|
275
|
-
*/
|
|
276
183
|
function ensureProjectNpmrc(endpoint) {
|
|
277
184
|
const projectRoot = findProjectRoot() ?? process.cwd();
|
|
278
185
|
const npmrcPath = path.join(projectRoot, ".npmrc");
|
|
@@ -282,40 +189,25 @@ function ensureProjectNpmrc(endpoint) {
|
|
|
282
189
|
return { created: true, updated: false, path: npmrcPath };
|
|
283
190
|
}
|
|
284
191
|
const content = fs.readFileSync(npmrcPath, "utf-8");
|
|
285
|
-
// Check if scope already configured (with any endpoint)
|
|
286
192
|
const scopeRegex = new RegExp(`^${CA_NAMESPACE.replace("/", "\\/")}:registry=.+$`, "m");
|
|
287
193
|
if (scopeRegex.test(content)) {
|
|
288
|
-
// Check if it's the right endpoint
|
|
289
194
|
if (content.includes(scopeLine)) {
|
|
290
195
|
return { created: false, updated: false, path: npmrcPath };
|
|
291
196
|
}
|
|
292
|
-
// Update existing line
|
|
293
197
|
const updated = content.replace(scopeRegex, scopeLine);
|
|
294
198
|
fs.writeFileSync(npmrcPath, updated, "utf-8");
|
|
295
199
|
return { created: false, updated: true, path: npmrcPath };
|
|
296
200
|
}
|
|
297
|
-
// Append scope line
|
|
298
201
|
const separator = content.endsWith("\n") ? "" : "\n";
|
|
299
202
|
fs.writeFileSync(npmrcPath, content + separator + scopeLine + "\n", "utf-8");
|
|
300
203
|
return { created: false, updated: true, path: npmrcPath };
|
|
301
204
|
}
|
|
302
|
-
/**
|
|
303
|
-
* Write a broker-issued grant into ~/.npmrc: the scoped registry line and the
|
|
304
|
-
* endpoint's auth token, in exactly the shape `aws codeartifact login
|
|
305
|
-
* --namespace @mesh-tech` would have written.
|
|
306
|
-
*
|
|
307
|
-
* Byte-compatibility with the AWS CLI's output is the requirement, not a nicety:
|
|
308
|
-
* `mesh registry status`, the `mesh start` preflight and the dev doctor all
|
|
309
|
-
* parse ~/.npmrc for that pair, and a machine that gets its token from the
|
|
310
|
-
* broker has to look identical to one that got it from AWS.
|
|
311
|
-
*/
|
|
312
205
|
export function applyGrantToUserNpmrc(grant, npmrcPath = homeNpmrcPath()) {
|
|
313
206
|
let existing = "";
|
|
314
207
|
try {
|
|
315
208
|
existing = fs.readFileSync(npmrcPath, "utf-8");
|
|
316
209
|
}
|
|
317
210
|
catch {
|
|
318
|
-
// no ~/.npmrc yet — a clean laptop, which is the case this exists for
|
|
319
211
|
}
|
|
320
212
|
const content = upsertNpmrcLines(existing, [
|
|
321
213
|
{ key: `${grant.scope}:registry`, value: grant.endpoint },
|
|
@@ -323,32 +215,13 @@ export function applyGrantToUserNpmrc(grant, npmrcPath = homeNpmrcPath()) {
|
|
|
323
215
|
]);
|
|
324
216
|
fs.mkdirSync(path.dirname(npmrcPath), { recursive: true });
|
|
325
217
|
fs.writeFileSync(npmrcPath, content, { mode: 0o600 });
|
|
326
|
-
// `mode` only applies when writeFileSync CREATES the file, so an existing
|
|
327
|
-
// 0644 ~/.npmrc would keep world-readable permissions on a 12h bearer token.
|
|
328
|
-
// Parity with `aws codeartifact login` either way, but one line buys better.
|
|
329
218
|
try {
|
|
330
219
|
fs.chmodSync(npmrcPath, 0o600);
|
|
331
220
|
}
|
|
332
221
|
catch {
|
|
333
|
-
// A read-only home or an exotic filesystem must not fail an otherwise-good login.
|
|
334
222
|
}
|
|
335
223
|
return { path: npmrcPath };
|
|
336
224
|
}
|
|
337
|
-
/**
|
|
338
|
-
* Human-facing explanation of a failed broker attempt, plus whether the AWS
|
|
339
|
-
* fallback chain is worth running.
|
|
340
|
-
*
|
|
341
|
-
* `not-authorized` is the one case we do NOT fall through on: the caller has a
|
|
342
|
-
* working Mesh account that simply lacks the grant, and quietly trying AWS next
|
|
343
|
-
* would either succeed (masking a missing grant with an AWS account we're
|
|
344
|
-
* trying to stop requiring) or fail with an unrelated AWS error that buries the
|
|
345
|
-
* real answer. Its text ends by naming the re-run — the bare command, which
|
|
346
|
-
* re-mints the session so a role granted after the sign-in reaches the broker;
|
|
347
|
-
* a sign-out is the fallback for a session the issuer will not re-mint.
|
|
348
|
-
*
|
|
349
|
-
* @example
|
|
350
|
-
* describeBrokerFailure({ kind: "unavailable", detail: "ECONNREFUSED" }).fatal; // → false
|
|
351
|
-
*/
|
|
352
225
|
export function describeBrokerFailure(failure) {
|
|
353
226
|
switch (failure.kind) {
|
|
354
227
|
case "no-broker":
|
|
@@ -370,9 +243,6 @@ export function describeBrokerFailure(failure) {
|
|
|
370
243
|
};
|
|
371
244
|
case "not-authorized":
|
|
372
245
|
return {
|
|
373
|
-
// The whole message lives in the body, not in a `remediation.command`:
|
|
374
|
-
// the answer here is "ask a human for a role", which is not a command
|
|
375
|
-
// anyone can run, and rendering a URL behind "→ run:" reads as one.
|
|
376
246
|
message: `Your Mesh account${failure.email ? ` (${failure.email})` : ""} is not authorized to read ` +
|
|
377
247
|
`${CA_NAMESPACE} packages.` +
|
|
378
248
|
(failure.requiredRoles?.length
|
|
@@ -391,77 +261,20 @@ export function describeBrokerFailure(failure) {
|
|
|
391
261
|
};
|
|
392
262
|
}
|
|
393
263
|
}
|
|
394
|
-
/**
|
|
395
|
-
* A valid Mesh account that lacks the registry role. Its own class so a
|
|
396
|
-
* caller that runs the login in-process (the `mesh init` wizard) can tell
|
|
397
|
-
* "ask for a grant" from every other failure structurally, not by parsing
|
|
398
|
-
* the sentence.
|
|
399
|
-
*
|
|
400
|
-
* @example
|
|
401
|
-
* try {
|
|
402
|
-
* await runRegistryLogin(undefined, {});
|
|
403
|
-
* } catch (err) {
|
|
404
|
-
* if (err instanceof RegistryNotAuthorizedError) markStepFailedAndContinue(err);
|
|
405
|
-
* else throw err;
|
|
406
|
-
* }
|
|
407
|
-
*/
|
|
408
264
|
export class RegistryNotAuthorizedError extends MeshCliError {
|
|
409
265
|
constructor(message) {
|
|
410
266
|
super(message);
|
|
411
267
|
this.name = "RegistryNotAuthorizedError";
|
|
412
268
|
}
|
|
413
269
|
}
|
|
414
|
-
/**
|
|
415
|
-
* Whether this run may start a sign-in: always with `--device` (the device
|
|
416
|
-
* code works anywhere the output can be read), otherwise only when there is
|
|
417
|
-
* a terminal to print a code to or open a browser from. Which sign-in runs
|
|
418
|
-
* is the login flow's choice — browser PKCE on a laptop, device code over
|
|
419
|
-
* SSH or in a container. A run with no TTY and no `--device` never starts a
|
|
420
|
-
* device-code poll nobody can complete — it falls to the AWS chain, which
|
|
421
|
-
* is what a CI runner with ambient credentials expects.
|
|
422
|
-
*
|
|
423
|
-
* @example
|
|
424
|
-
* registrySignInAllowed({}, false); // → false (CI runner, no --device)
|
|
425
|
-
* registrySignInAllowed({ device: true }, false); // → true
|
|
426
|
-
* registrySignInAllowed({}, true); // → true (a laptop, or an SSH session with a TTY)
|
|
427
|
-
*/
|
|
428
270
|
export function registrySignInAllowed(opts, hasTty = Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
429
271
|
return Boolean(opts.device) || hasTty;
|
|
430
272
|
}
|
|
431
|
-
/**
|
|
432
|
-
* Whether a broker refusal is worth one re-mint of the session before it is
|
|
433
|
-
* reported.
|
|
434
|
-
*
|
|
435
|
-
* `not-authorized` and only `not-authorized`. It is the single refusal a token
|
|
436
|
-
* minted a moment later can answer differently, because Zitadel writes project
|
|
437
|
-
* roles into a token when it issues it and a grant that lands afterwards is
|
|
438
|
-
* absent from every token already held. Every other failure is about the
|
|
439
|
-
* broker or the session itself, which a re-mint does not change — and paying
|
|
440
|
-
* for one there only delays the AWS fallback those failures are meant to reach.
|
|
441
|
-
*
|
|
442
|
-
* Exported so the policy is asserted by a test rather than promised by the one
|
|
443
|
-
* call site that holds it.
|
|
444
|
-
*
|
|
445
|
-
* @example
|
|
446
|
-
* shouldRemintAfter({ kind: "unavailable", detail: "ETIMEDOUT" }); // → false
|
|
447
|
-
*/
|
|
448
273
|
export function shouldRemintAfter(failure) {
|
|
449
274
|
return failure.kind === "not-authorized";
|
|
450
275
|
}
|
|
451
|
-
/** The closing line of the not-authorized text: what to run once the role is granted. */
|
|
452
276
|
export const NOT_AUTHORIZED_RERUN = "Once granted, run: mesh registry login (it re-mints your sign-in; still refused? mesh registry logout && mesh registry login)";
|
|
453
|
-
/** Printed when the read path is given a context it no longer needs. */
|
|
454
277
|
export const CONTEXT_IGNORED_NOTICE = "The registry is global — the context argument is no longer needed (ignored).";
|
|
455
|
-
/**
|
|
456
|
-
* Try the broker. Returns the grant when it produced one, otherwise the
|
|
457
|
-
* outcome the caller carries into the AWS chain so the final error names the
|
|
458
|
-
* right cause.
|
|
459
|
-
*
|
|
460
|
-
* Throws `MeshCliError` for the two fatal cases: `not-authorized` (a valid
|
|
461
|
-
* account without the role — see describeBrokerFailure) and a sign-in that
|
|
462
|
-
* failed outright (denied, timed out), because falling through to AWS after
|
|
463
|
-
* either would print an unrelated error over the real answer.
|
|
464
|
-
*/
|
|
465
278
|
async function tryBrokerLogin(opts) {
|
|
466
279
|
if (opts.broker === false)
|
|
467
280
|
return { outcome: { kind: "skipped-flag", flag: "--no-broker" } };
|
|
@@ -493,15 +306,11 @@ async function tryBrokerLogin(opts) {
|
|
|
493
306
|
logInfo(`Registry session: ${session.email}`);
|
|
494
307
|
let result = await requestGrant(session.context, identity);
|
|
495
308
|
if (!result.ok && (result.failure.kind === "unauthenticated" || result.failure.kind === "unavailable")) {
|
|
496
|
-
// The pinned record may be stale — a moved broker host or a rotated
|
|
497
|
-
// client id. Re-discover once and retry only when something changed, so
|
|
498
|
-
// a genuinely down broker is not paid for twice.
|
|
499
309
|
let fresh = null;
|
|
500
310
|
try {
|
|
501
311
|
fresh = await resolveRegistryIdentity({ refresh: true });
|
|
502
312
|
}
|
|
503
313
|
catch {
|
|
504
|
-
// still unreachable — the original failure stands
|
|
505
314
|
}
|
|
506
315
|
if (fresh && identityChanged(identity, fresh)) {
|
|
507
316
|
logInfo(`Registry identity changed since it was cached — retrying with ${fresh.registryBroker}`);
|
|
@@ -510,10 +319,6 @@ async function tryBrokerLogin(opts) {
|
|
|
510
319
|
}
|
|
511
320
|
}
|
|
512
321
|
if (!result.ok && shouldRemintAfter(result.failure)) {
|
|
513
|
-
// Roles ride in the token from the moment it was issued, so the grant the
|
|
514
|
-
// broker just judged is the one the session held at sign-in. A re-mint
|
|
515
|
-
// that comes back carrying a role the last one lacked is worth a second
|
|
516
|
-
// ask; one that carries the same roles would buy the same refusal twice.
|
|
517
322
|
const { rolesChanged } = await refreshRegistrySession(session.context);
|
|
518
323
|
if (rolesChanged) {
|
|
519
324
|
logInfo("Your sign-in now carries a role it did not have — retrying…");
|
|
@@ -539,41 +344,16 @@ async function requestGrant(sessionContext, identity) {
|
|
|
539
344
|
timeoutMs: PUBLISHED_BROKER_TIMEOUT_MS,
|
|
540
345
|
});
|
|
541
346
|
}
|
|
542
|
-
/**
|
|
543
|
-
* Whether this `mesh registry login` invocation may rewrite ~/.npmrc.
|
|
544
|
-
*
|
|
545
|
-
* The self-heal is a **laptop** fix. CI pipelines run the unscoped
|
|
546
|
-
* `aws codeartifact login` DELIBERATELY — a host-scoped token is what lets
|
|
547
|
-
* pnpm pull upstream-cached public packages through CodeArtifact — so in a
|
|
548
|
-
* runner the "hijack" line is load-bearing and deleting it would break the
|
|
549
|
-
* install we were asked not to touch. `--ci` is the one signal that says so.
|
|
550
|
-
*
|
|
551
|
-
* Extracted (and tested) rather than left inline because "this changes no CI
|
|
552
|
-
* behaviour" is a promise about the code, not about the workflow files we
|
|
553
|
-
* happen not to have edited.
|
|
554
|
-
*/
|
|
555
347
|
export function shouldRepairUserNpmrc(opts) {
|
|
556
348
|
return !opts.ci;
|
|
557
349
|
}
|
|
558
|
-
/**
|
|
559
|
-
* Repair a hijacked ~/.npmrc: remove an unscoped `registry=<codeartifact>`
|
|
560
|
-
* line if one is present, after taking a timestamped backup.
|
|
561
|
-
*
|
|
562
|
-
* `aws codeartifact login` run WITHOUT `--namespace @mesh-tech` writes that
|
|
563
|
-
* line, and nothing in this CLI used to remove it — so one bare login made
|
|
564
|
-
* CodeArtifact the default registry forever, and every public `npm install`
|
|
565
|
-
* started failing with E401 12 hours later when the token expired. We write
|
|
566
|
-
* the correct (scoped) state; this is the missing repair of the wrong state.
|
|
567
|
-
*
|
|
568
|
-
* Never throws — a repair failure must not fail an otherwise-good login.
|
|
569
|
-
*/
|
|
570
350
|
export function repairUnscopedRegistry(npmrcPath = homeNpmrcPath()) {
|
|
571
351
|
let original;
|
|
572
352
|
try {
|
|
573
353
|
original = fs.readFileSync(npmrcPath, "utf-8");
|
|
574
354
|
}
|
|
575
355
|
catch {
|
|
576
|
-
return { removed: null };
|
|
356
|
+
return { removed: null };
|
|
577
357
|
}
|
|
578
358
|
const { content, removed } = stripUnscopedCodeArtifactRegistry(original);
|
|
579
359
|
if (!removed)
|
|
@@ -588,13 +368,6 @@ export function repairUnscopedRegistry(npmrcPath = homeNpmrcPath()) {
|
|
|
588
368
|
}
|
|
589
369
|
return { removed, backupPath };
|
|
590
370
|
}
|
|
591
|
-
/**
|
|
592
|
-
* The `Registry session:` line of `mesh registry status`. Pure; exported for
|
|
593
|
-
* the message test.
|
|
594
|
-
*
|
|
595
|
-
* @example
|
|
596
|
-
* renderRegistrySessionLine(null); // → "No registry session — run: mesh registry login"
|
|
597
|
-
*/
|
|
598
371
|
export function renderRegistrySessionLine(session, now = Date.now()) {
|
|
599
372
|
if (!session)
|
|
600
373
|
return "No registry session — run: mesh registry login";
|
|
@@ -625,23 +398,11 @@ export async function checkExistingToken() {
|
|
|
625
398
|
hijackLine,
|
|
626
399
|
};
|
|
627
400
|
}
|
|
628
|
-
// Token works — a hijacked default registry still breaks public installs.
|
|
629
401
|
if (hijackLine) {
|
|
630
402
|
return { valid: false, state: probe.state, reason: "unscoped CodeArtifact registry", hijackLine };
|
|
631
403
|
}
|
|
632
404
|
return { valid: true, state: probe.state, endpoint: getEndpoint() ?? undefined };
|
|
633
405
|
}
|
|
634
|
-
/**
|
|
635
|
-
* `mesh registry status` — returns the process exit code instead of calling
|
|
636
|
-
* `process.exit`, so the "broken" vs "unverifiable" distinction is testable.
|
|
637
|
-
*
|
|
638
|
-
* Exit 1 is for faults the user can act on right now: a missing or expired
|
|
639
|
-
* token, or an unscoped CodeArtifact `registry=` line (locally detectable, and
|
|
640
|
-
* broken regardless of the network). An **unreachable** registry is neither —
|
|
641
|
-
* it warns and exits 0, because the remediation we'd print (`mesh registry
|
|
642
|
-
* login`) cannot work offline either, and the same rule already governs the
|
|
643
|
-
* `mesh init` doctor.
|
|
644
|
-
*/
|
|
645
406
|
export async function runRegistryStatus(opts) {
|
|
646
407
|
const { valid, state, endpoint, reason, hijackLine } = await (opts?.check ?? checkExistingToken)();
|
|
647
408
|
if (hijackLine) {
|
|
@@ -650,7 +411,6 @@ export async function runRegistryStatus(opts) {
|
|
|
650
411
|
logInfo(` ${hijackLine.trim()}`);
|
|
651
412
|
logInfo("Fix: mesh registry login # removes it (backup taken) and keeps @mesh-tech scoped");
|
|
652
413
|
}
|
|
653
|
-
// A network fault is not an auth fault. Any *other* invalid state is.
|
|
654
414
|
const unverifiable = state === "unreachable" && !hijackLine;
|
|
655
415
|
if (!valid && !unverifiable) {
|
|
656
416
|
logWarn(`Registry auth is not usable${reason ? ` — ${reason}` : ""}. Run: mesh registry login`);
|
|
@@ -667,7 +427,6 @@ export async function runRegistryStatus(opts) {
|
|
|
667
427
|
}
|
|
668
428
|
}
|
|
669
429
|
logInfo(renderRegistrySessionLine(opts?.session ?? readRegistrySession()));
|
|
670
|
-
// Project .npmrc — worth reporting even when the token couldn't be verified.
|
|
671
430
|
const projectRoot = findProjectRoot();
|
|
672
431
|
if (projectRoot) {
|
|
673
432
|
const npmrcPath = path.join(projectRoot, ".npmrc");
|
|
@@ -688,17 +447,6 @@ export async function runRegistryStatus(opts) {
|
|
|
688
447
|
}
|
|
689
448
|
return 0;
|
|
690
449
|
}
|
|
691
|
-
// =============================================================================
|
|
692
|
-
// Commands
|
|
693
|
-
// =============================================================================
|
|
694
|
-
/**
|
|
695
|
-
* Ensure the named AWS SSO profile has a live session — trigger the
|
|
696
|
-
* interactive `aws sso login` (browser) when it's stale.
|
|
697
|
-
*
|
|
698
|
-
* Guardrails (MESH-2479): a missing profile fails fast with the exact
|
|
699
|
-
* `aws configure` setup instead of an opaque CLI error, and the identity
|
|
700
|
-
* probes are time-bounded so a wedged AWS CLI can't hang this silently.
|
|
701
|
-
*/
|
|
702
450
|
function ensureSsoProfile(profile) {
|
|
703
451
|
const awsConfig = readAwsConfig();
|
|
704
452
|
if (awsConfig && !awsConfigHasProfile(awsConfig, profile)) {
|
|
@@ -733,26 +481,7 @@ function ensureSsoProfile(profile) {
|
|
|
733
481
|
}
|
|
734
482
|
logSuccess(`AWS SSO session refreshed (profile '${profile}')`);
|
|
735
483
|
}
|
|
736
|
-
/**
|
|
737
|
-
* The full registry-auth sequence (CodeArtifact token → ~/.npmrc → project
|
|
738
|
-
* .npmrc). `context` matters only to `--publish` (the publisher role comes
|
|
739
|
-
* from that context's SSM export) and to the explicit AWS chain
|
|
740
|
-
* (`--no-broker` / `--ci`, where a cached platform session can assume a
|
|
741
|
-
* role); on the default read path it is ignored, because the registry is
|
|
742
|
-
* global.
|
|
743
|
-
*
|
|
744
|
-
* Fails by throwing `MeshCliError` rather than exiting, so a caller that runs
|
|
745
|
-
* this in-process (the `mesh init` wizard, the app-tenant doctor's `--fix`)
|
|
746
|
-
* can report the outcome and carry on.
|
|
747
|
-
*
|
|
748
|
-
* @example
|
|
749
|
-
* await runRegistryLogin(undefined, {}); // a laptop: broker, browser if needed
|
|
750
|
-
* await runRegistryLogin(undefined, { ci: true }); // a runner: ambient AWS creds only
|
|
751
|
-
*/
|
|
752
484
|
export async function runRegistryLogin(context, opts) {
|
|
753
|
-
// --publish is the opt-in privileged path: resolve the publisher role
|
|
754
|
-
// (explicit --role flag wins, else the registry's SSM export) and feed
|
|
755
|
-
// it through the same Zitadel role-assumption path as the reader flow.
|
|
756
485
|
let roleArn = opts.role;
|
|
757
486
|
if (opts.publish) {
|
|
758
487
|
let ssmArn;
|
|
@@ -775,13 +504,6 @@ export async function runRegistryLogin(context, opts) {
|
|
|
775
504
|
}
|
|
776
505
|
logInfo(`Publisher role resolved: ${roleArn}`);
|
|
777
506
|
}
|
|
778
|
-
// Step 0: the broker. Tried FIRST for the read path, because it is the only
|
|
779
|
-
// one that works on a machine with no AWS account, no AWS CLI and no
|
|
780
|
-
// ~/.aws/config — the machine this whole feature exists for.
|
|
781
|
-
//
|
|
782
|
-
// Skipped for --publish (a privileged write path that deliberately goes
|
|
783
|
-
// through an assumed IAM role) and for --profile (an explicit "use this AWS
|
|
784
|
-
// profile" instruction we must not silently override).
|
|
785
507
|
let outcome;
|
|
786
508
|
if (opts.publish) {
|
|
787
509
|
outcome = { kind: "skipped-flag", flag: "--publish" };
|
|
@@ -797,9 +519,6 @@ export async function runRegistryLogin(context, opts) {
|
|
|
797
519
|
const { path: npmrcPath } = applyGrantToUserNpmrc(attempt.grant);
|
|
798
520
|
logSuccess(`Registry token issued by the Mesh broker → ${npmrcPath}` +
|
|
799
521
|
(attempt.grant.expiresAt ? ` (expires ${attempt.grant.expiresAt})` : ""));
|
|
800
|
-
// Same hijack repair as the AWS path — an unscoped `registry=` line left
|
|
801
|
-
// by a past bare `aws codeartifact login` breaks public installs
|
|
802
|
-
// regardless of where today's token came from.
|
|
803
522
|
if (shouldRepairUserNpmrc(opts)) {
|
|
804
523
|
const repair = repairUnscopedRegistry();
|
|
805
524
|
if (repair.removed) {
|
|
@@ -829,8 +548,6 @@ export async function runRegistryLogin(context, opts) {
|
|
|
829
548
|
}
|
|
830
549
|
let env;
|
|
831
550
|
if (opts.profile) {
|
|
832
|
-
// Jawad's flow, one command: live SSO session + profile-scoped token.
|
|
833
|
-
// Static creds in the environment would override the profile — drop them.
|
|
834
551
|
ensureSsoProfile(opts.profile);
|
|
835
552
|
env = { ...process.env, AWS_PROFILE: opts.profile };
|
|
836
553
|
for (const key of ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN"]) {
|
|
@@ -843,19 +560,11 @@ export async function runRegistryLogin(context, opts) {
|
|
|
843
560
|
? { ...process.env, ...awsCreds }
|
|
844
561
|
: undefined;
|
|
845
562
|
}
|
|
846
|
-
// Step 1: Run `aws codeartifact login` (sets token in ~/.npmrc)
|
|
847
563
|
logInfo("Authenticating with CodeArtifact...");
|
|
848
564
|
if (!codeartifactLogin(env)) {
|
|
849
565
|
throw new MeshCliError(describeAwsChainFailure(outcome));
|
|
850
566
|
}
|
|
851
567
|
logSuccess("CodeArtifact token refreshed (valid for 12 hours)");
|
|
852
|
-
// Step 1b: Repair a hijacked ~/.npmrc. We always write the SCOPED form
|
|
853
|
-
// above (--namespace @mesh-tech), but a bare `aws codeartifact login` run
|
|
854
|
-
// at any point in the past leaves an unscoped `registry=` line that we
|
|
855
|
-
// never removed — so it survived every subsequent correct login.
|
|
856
|
-
//
|
|
857
|
-
// Laptops only — see shouldRepairUserNpmrc: in `--ci` the unscoped line is
|
|
858
|
-
// doing its job and a "repair" would break the runner's install.
|
|
859
568
|
if (shouldRepairUserNpmrc(opts)) {
|
|
860
569
|
const repair = repairUnscopedRegistry();
|
|
861
570
|
if (repair.removed) {
|
|
@@ -870,7 +579,6 @@ export async function runRegistryLogin(context, opts) {
|
|
|
870
579
|
logWarn(`Could not repair ~/.npmrc (${repair.error}) — remove any unscoped \`registry=\` line by hand.`);
|
|
871
580
|
}
|
|
872
581
|
}
|
|
873
|
-
// Step 2: Get endpoint URL
|
|
874
582
|
const endpoint = getEndpoint(env);
|
|
875
583
|
if (!endpoint) {
|
|
876
584
|
logWarn("Could not retrieve registry endpoint — .npmrc scope not configured");
|
|
@@ -878,7 +586,6 @@ export async function runRegistryLogin(context, opts) {
|
|
|
878
586
|
logInfo(` ${CA_NAMESPACE}:registry=https://mesh-platform-<ACCOUNT>.d.codeartifact.${CA_REGION}.amazonaws.com/npm/${CA_REPOSITORY}/`);
|
|
879
587
|
return;
|
|
880
588
|
}
|
|
881
|
-
// Step 3: Ensure project .npmrc (unless --ci or --skip-npmrc)
|
|
882
589
|
if (!opts.ci && !opts.skipNpmrc) {
|
|
883
590
|
const result = ensureProjectNpmrc(endpoint);
|
|
884
591
|
if (result.created) {
|
|
@@ -893,26 +600,6 @@ export async function runRegistryLogin(context, opts) {
|
|
|
893
600
|
}
|
|
894
601
|
logSuccess(`Ready — run pnpm install to fetch ${CA_NAMESPACE} packages`);
|
|
895
602
|
}
|
|
896
|
-
/**
|
|
897
|
-
* The error for a failed `aws codeartifact login`, built from WHY the AWS
|
|
898
|
-
* chain was the path taken — so the text can only ever describe something
|
|
899
|
-
* that actually happened on this run.
|
|
900
|
-
*
|
|
901
|
-
* Three shapes:
|
|
902
|
-
*
|
|
903
|
-
* - `--profile`: the profile's AWS identity cannot read the registry. That
|
|
904
|
-
* flag is for deployers whose account is allowed to; anyone else should drop
|
|
905
|
-
* it and take the broker path, which needs no AWS at all.
|
|
906
|
-
* - broker unavailable / no session: the broker was tried and printed a
|
|
907
|
-
* warning; this names that warning and the two ways forward.
|
|
908
|
-
* - an explicit AWS flag (`--no-broker`, `--ci`, `--publish`): the caller asked
|
|
909
|
-
* for the AWS chain, so the fix is the AWS credentials, not the broker.
|
|
910
|
-
*
|
|
911
|
-
* Pure; exported for the message tests.
|
|
912
|
-
*
|
|
913
|
-
* @example
|
|
914
|
-
* describeAwsChainFailure({ kind: "skipped-profile", profile: "ctdev" }); // "AWS profile 'ctdev' cannot read…"
|
|
915
|
-
*/
|
|
916
603
|
export function describeAwsChainFailure(outcome) {
|
|
917
604
|
switch (outcome.kind) {
|
|
918
605
|
case "skipped-profile":
|
|
@@ -973,4 +660,3 @@ export function registerRegistryCommands(program) {
|
|
|
973
660
|
});
|
|
974
661
|
registerRegistryPublish(registry);
|
|
975
662
|
}
|
|
976
|
-
//# sourceMappingURL=registry.js.map
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mesh secrets exec - Execute command with secrets from AWS Secrets Manager
|
|
3
|
-
*
|
|
4
|
-
* Fetches a JSON secret from Secrets Manager and injects all key-value pairs
|
|
5
|
-
* as environment variables before running the specified command.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* mesh secrets exec --secret=<name-or-arn> [--db-host=<host>] -- <command>
|
|
9
|
-
*
|
|
10
|
-
* Options:
|
|
11
|
-
* --db-host=<host> Rewrite DATABASE_URL host (for dev mode tunneling)
|
|
12
|
-
*
|
|
13
|
-
* Example:
|
|
14
|
-
* mesh secrets exec --secret=mesh/encore/dev/rdc/db-credentials --db-host=localhost -- pnpm dev
|
|
15
|
-
*/
|
|
16
1
|
export declare function execCommand(args: string[]): Promise<void>;
|
|
17
|
-
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* mesh secrets exec - Execute command with secrets from AWS Secrets Manager
|
|
3
|
-
*
|
|
4
|
-
* Fetches a JSON secret from Secrets Manager and injects all key-value pairs
|
|
5
|
-
* as environment variables before running the specified command.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* mesh secrets exec --secret=<name-or-arn> [--db-host=<host>] -- <command>
|
|
9
|
-
*
|
|
10
|
-
* Options:
|
|
11
|
-
* --db-host=<host> Rewrite DATABASE_URL host (for dev mode tunneling)
|
|
12
|
-
*
|
|
13
|
-
* Example:
|
|
14
|
-
* mesh secrets exec --secret=mesh/encore/dev/rdc/db-credentials --db-host=localhost -- pnpm dev
|
|
15
|
-
*/
|
|
16
1
|
import { spawn } from "child_process";
|
|
17
2
|
import { SecretsManagerClient, GetSecretValueCommand, } from "@aws-sdk/client-secrets-manager";
|
|
18
|
-
// Simple logging helpers
|
|
19
3
|
function logInfo(msg) {
|
|
20
4
|
console.log(`\u001b[36mℹ\u001b[0m ${msg}`);
|
|
21
5
|
}
|
|
@@ -61,16 +45,11 @@ async function fetchSecret(client, secretId) {
|
|
|
61
45
|
throw new Error("Secret is not valid JSON");
|
|
62
46
|
}
|
|
63
47
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Rewrite the host in a DATABASE_URL
|
|
66
|
-
* Useful for dev mode where we tunnel to the database via localhost
|
|
67
|
-
*/
|
|
68
48
|
function rewriteDatabaseHost(databaseUrl, newHost) {
|
|
69
49
|
try {
|
|
70
50
|
const url = new URL(databaseUrl);
|
|
71
51
|
const originalHost = url.host;
|
|
72
52
|
url.hostname = newHost;
|
|
73
|
-
// Keep the original port if the new host doesn't include one
|
|
74
53
|
if (!newHost.includes(":")) {
|
|
75
54
|
url.port = url.port || "5432";
|
|
76
55
|
}
|
|
@@ -108,11 +87,9 @@ export async function execCommand(args) {
|
|
|
108
87
|
}
|
|
109
88
|
const envKeys = Object.keys(secretValues);
|
|
110
89
|
logSuccess(`Loaded ${envKeys.length} environment variable(s) from secret`);
|
|
111
|
-
// Rewrite DATABASE_URL host for dev mode tunneling
|
|
112
90
|
if (options.dbHost && secretValues.DATABASE_URL) {
|
|
113
91
|
secretValues.DATABASE_URL = rewriteDatabaseHost(secretValues.DATABASE_URL, options.dbHost);
|
|
114
92
|
}
|
|
115
|
-
// Build environment with secret values injected
|
|
116
93
|
const env = {
|
|
117
94
|
...process.env,
|
|
118
95
|
...secretValues,
|
|
@@ -129,4 +106,3 @@ export async function execCommand(args) {
|
|
|
129
106
|
process.exit(1);
|
|
130
107
|
});
|
|
131
108
|
}
|
|
132
|
-
//# sourceMappingURL=exec.js.map
|