@mesh-tech/mesh-cli 0.1.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/intent/agents-fence.md +10 -0
- package/assets/intent/intent-claude-gate.mjs +255 -0
- package/assets/log-shipper.mjs +94 -0
- package/bin/mesh.mjs +80 -0
- package/dist/bin/mesh.d.ts +7 -9
- package/dist/bin/mesh.d.ts.map +1 -1
- package/dist/bin/mesh.js +20826 -37
- package/dist/bin/mesh.js.map +7 -1
- package/dist/build-info.json +4 -0
- package/dist/src/commands/agent-api-client.d.ts +79 -0
- package/dist/src/commands/agent-api-client.d.ts.map +1 -0
- package/dist/src/commands/agent-api-client.js +170 -0
- package/dist/src/commands/agent-api-client.js.map +1 -0
- package/dist/src/commands/artifacts.d.ts +13 -0
- package/dist/src/commands/artifacts.d.ts.map +1 -0
- package/dist/src/commands/artifacts.js +140 -0
- package/dist/src/commands/artifacts.js.map +1 -0
- package/dist/src/commands/cluster.d.ts +45 -0
- package/dist/src/commands/cluster.d.ts.map +1 -0
- package/dist/src/commands/cluster.js +259 -0
- package/dist/src/commands/cluster.js.map +1 -0
- package/dist/src/commands/conversations.d.ts +61 -0
- package/dist/src/commands/conversations.d.ts.map +1 -0
- package/dist/src/commands/conversations.js +239 -0
- package/dist/src/commands/conversations.js.map +1 -0
- package/dist/src/commands/create-app.d.ts +26 -3
- package/dist/src/commands/create-app.d.ts.map +1 -1
- package/dist/src/commands/create-app.js +465 -107
- package/dist/src/commands/create-app.js.map +1 -1
- package/dist/src/commands/deploy.d.ts +19 -0
- package/dist/src/commands/deploy.d.ts.map +1 -1
- package/dist/src/commands/deploy.js +83 -142
- package/dist/src/commands/deploy.js.map +1 -1
- package/dist/src/commands/dev-doctor.d.ts +137 -0
- package/dist/src/commands/dev-doctor.d.ts.map +1 -0
- package/dist/src/commands/dev-doctor.js +671 -0
- package/dist/src/commands/dev-doctor.js.map +1 -0
- package/dist/src/commands/dev-launch.d.ts +59 -0
- package/dist/src/commands/dev-launch.d.ts.map +1 -0
- package/dist/src/commands/dev-launch.js +118 -0
- package/dist/src/commands/dev-launch.js.map +1 -0
- package/dist/src/commands/dev-token-server.d.ts +32 -0
- package/dist/src/commands/dev-token-server.d.ts.map +1 -0
- package/dist/src/commands/dev-token-server.js +68 -0
- package/dist/src/commands/dev-token-server.js.map +1 -0
- package/dist/src/commands/dev.d.ts +289 -2
- package/dist/src/commands/dev.d.ts.map +1 -1
- package/dist/src/commands/dev.js +2501 -574
- package/dist/src/commands/dev.js.map +1 -1
- package/dist/src/commands/docs.d.ts +3 -0
- package/dist/src/commands/docs.d.ts.map +1 -0
- package/dist/src/commands/docs.js +262 -0
- package/dist/src/commands/docs.js.map +1 -0
- package/dist/src/commands/hub/index.d.ts +99 -0
- package/dist/src/commands/hub/index.d.ts.map +1 -0
- package/dist/src/commands/hub/index.js +452 -0
- package/dist/src/commands/hub/index.js.map +1 -0
- package/dist/src/commands/init.d.ts +65 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +370 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/install-shim.d.ts +21 -0
- package/dist/src/commands/install-shim.d.ts.map +1 -0
- package/dist/src/commands/install-shim.js +132 -0
- package/dist/src/commands/install-shim.js.map +1 -0
- package/dist/src/commands/local/auth-provision.d.ts +71 -0
- package/dist/src/commands/local/auth-provision.d.ts.map +1 -0
- package/dist/src/commands/local/auth-provision.js +286 -0
- package/dist/src/commands/local/auth-provision.js.map +1 -0
- package/dist/src/commands/local/dev-local.d.ts +97 -0
- package/dist/src/commands/local/dev-local.d.ts.map +1 -0
- package/dist/src/commands/local/dev-local.js +306 -0
- package/dist/src/commands/local/dev-local.js.map +1 -0
- package/dist/src/commands/local/docker-runner.d.ts +37 -0
- package/dist/src/commands/local/docker-runner.d.ts.map +1 -0
- package/dist/src/commands/local/docker-runner.js +104 -0
- package/dist/src/commands/local/docker-runner.js.map +1 -0
- package/dist/src/commands/local/helpers.d.ts +22 -0
- package/dist/src/commands/local/helpers.d.ts.map +1 -0
- package/dist/src/commands/local/helpers.js +46 -0
- package/dist/src/commands/local/helpers.js.map +1 -0
- package/dist/src/commands/local/hub-local.d.ts +51 -0
- package/dist/src/commands/local/hub-local.d.ts.map +1 -0
- package/dist/src/commands/local/hub-local.js +197 -0
- package/dist/src/commands/local/hub-local.js.map +1 -0
- package/dist/src/commands/local/index.d.ts +23 -0
- package/dist/src/commands/local/index.d.ts.map +1 -0
- package/dist/src/commands/local/index.js +386 -0
- package/dist/src/commands/local/index.js.map +1 -0
- package/dist/src/commands/local/mocks.d.ts +361 -0
- package/dist/src/commands/local/mocks.d.ts.map +1 -0
- package/dist/src/commands/local/mocks.js +756 -0
- package/dist/src/commands/local/mocks.js.map +1 -0
- package/dist/src/commands/local/seed-zitadel.d.ts +151 -0
- package/dist/src/commands/local/seed-zitadel.d.ts.map +1 -0
- package/dist/src/commands/local/seed-zitadel.js +408 -0
- package/dist/src/commands/local/seed-zitadel.js.map +1 -0
- package/dist/src/commands/local/seed.d.ts +106 -0
- package/dist/src/commands/local/seed.d.ts.map +1 -0
- package/dist/src/commands/local/seed.js +252 -0
- package/dist/src/commands/local/seed.js.map +1 -0
- package/dist/src/commands/local/stack.d.ts +173 -0
- package/dist/src/commands/local/stack.d.ts.map +1 -0
- package/dist/src/commands/local/stack.js +499 -0
- package/dist/src/commands/local/stack.js.map +1 -0
- package/dist/src/commands/login.d.ts +256 -12
- package/dist/src/commands/login.d.ts.map +1 -1
- package/dist/src/commands/login.js +978 -50
- package/dist/src/commands/login.js.map +1 -1
- package/dist/src/commands/peer-addressing.d.ts +51 -0
- package/dist/src/commands/peer-addressing.d.ts.map +1 -0
- package/dist/src/commands/peer-addressing.js +64 -0
- package/dist/src/commands/peer-addressing.js.map +1 -0
- package/dist/src/commands/port-ownership.d.ts +69 -0
- package/dist/src/commands/port-ownership.d.ts.map +1 -0
- package/dist/src/commands/port-ownership.js +161 -0
- package/dist/src/commands/port-ownership.js.map +1 -0
- package/dist/src/commands/registry-publish.d.ts +3 -0
- package/dist/src/commands/registry-publish.d.ts.map +1 -0
- package/dist/src/commands/registry-publish.js +161 -0
- package/dist/src/commands/registry-publish.js.map +1 -0
- package/dist/src/commands/registry.d.ts +146 -2
- package/dist/src/commands/registry.d.ts.map +1 -1
- package/dist/src/commands/registry.js +541 -85
- package/dist/src/commands/registry.js.map +1 -1
- package/dist/src/commands/secrets/index.d.ts.map +1 -1
- package/dist/src/commands/secrets/index.js +15 -1
- package/dist/src/commands/secrets/index.js.map +1 -1
- package/dist/src/commands/secrets/migrate-config.d.ts +24 -0
- package/dist/src/commands/secrets/migrate-config.d.ts.map +1 -0
- package/dist/src/commands/secrets/migrate-config.js +277 -0
- package/dist/src/commands/secrets/migrate-config.js.map +1 -0
- package/dist/src/commands/secrets/set.d.ts +4 -0
- package/dist/src/commands/secrets/set.d.ts.map +1 -1
- package/dist/src/commands/secrets/set.js +243 -64
- package/dist/src/commands/secrets/set.js.map +1 -1
- package/dist/src/commands/skills.d.ts +34 -0
- package/dist/src/commands/skills.d.ts.map +1 -0
- package/dist/src/commands/skills.js +207 -0
- package/dist/src/commands/skills.js.map +1 -0
- package/dist/src/commands/stack.d.ts.map +1 -1
- package/dist/src/commands/stack.js +361 -23
- package/dist/src/commands/stack.js.map +1 -1
- package/dist/src/commands/temporal.d.ts +15 -0
- package/dist/src/commands/temporal.d.ts.map +1 -0
- package/dist/src/commands/temporal.js +781 -0
- package/dist/src/commands/temporal.js.map +1 -0
- package/dist/src/commands/tenant.d.ts +56 -0
- package/dist/src/commands/tenant.d.ts.map +1 -0
- package/dist/src/commands/tenant.js +233 -0
- package/dist/src/commands/tenant.js.map +1 -0
- package/dist/src/commands/tunnel/index.d.ts +49 -3
- package/dist/src/commands/tunnel/index.d.ts.map +1 -1
- package/dist/src/commands/tunnel/index.js +331 -8
- package/dist/src/commands/tunnel/index.js.map +1 -1
- package/dist/src/commands/vcs/clone.d.ts +3 -0
- package/dist/src/commands/vcs/clone.d.ts.map +1 -0
- package/dist/src/commands/vcs/clone.js +20 -0
- package/dist/src/commands/vcs/clone.js.map +1 -0
- package/dist/src/commands/vcs/common.d.ts +21 -0
- package/dist/src/commands/vcs/common.d.ts.map +1 -0
- package/dist/src/commands/vcs/common.js +62 -0
- package/dist/src/commands/vcs/common.js.map +1 -0
- package/dist/src/commands/vcs/drafts.d.ts +13 -0
- package/dist/src/commands/vcs/drafts.d.ts.map +1 -0
- package/dist/src/commands/vcs/drafts.js +45 -0
- package/dist/src/commands/vcs/drafts.js.map +1 -0
- package/dist/src/commands/vcs/get.d.ts +8 -0
- package/dist/src/commands/vcs/get.d.ts.map +1 -0
- package/dist/src/commands/vcs/get.js +61 -0
- package/dist/src/commands/vcs/get.js.map +1 -0
- package/dist/src/commands/vcs/index.d.ts +3 -0
- package/dist/src/commands/vcs/index.d.ts.map +1 -0
- package/dist/src/commands/vcs/index.js +58 -0
- package/dist/src/commands/vcs/index.js.map +1 -0
- package/dist/src/commands/vcs/propose.d.ts +23 -0
- package/dist/src/commands/vcs/propose.d.ts.map +1 -0
- package/dist/src/commands/vcs/propose.js +94 -0
- package/dist/src/commands/vcs/propose.js.map +1 -0
- package/dist/src/commands/vcs/review.d.ts +15 -0
- package/dist/src/commands/vcs/review.d.ts.map +1 -0
- package/dist/src/commands/vcs/review.js +35 -0
- package/dist/src/commands/vcs/review.js.map +1 -0
- package/dist/src/commands/vcs-enrich.d.ts +15 -0
- package/dist/src/commands/vcs-enrich.d.ts.map +1 -0
- package/dist/src/commands/vcs-enrich.js +28 -0
- package/dist/src/commands/vcs-enrich.js.map +1 -0
- package/dist/src/commands/vpn/index.d.ts +24 -0
- package/dist/src/commands/vpn/index.d.ts.map +1 -0
- package/dist/src/commands/vpn/index.js +543 -0
- package/dist/src/commands/vpn/index.js.map +1 -0
- package/dist/src/commands/vpn/tunnel.d.ts +11 -0
- package/dist/src/commands/vpn/tunnel.d.ts.map +1 -0
- package/dist/src/commands/vpn/tunnel.js +188 -0
- package/dist/src/commands/vpn/tunnel.js.map +1 -0
- package/dist/src/commands/workflow.d.ts +24 -0
- package/dist/src/commands/workflow.d.ts.map +1 -0
- package/dist/src/commands/workflow.js +577 -0
- package/dist/src/commands/workflow.js.map +1 -0
- package/dist/src/docs/assemble.d.ts +217 -0
- package/dist/src/docs/assemble.d.ts.map +1 -0
- package/dist/src/docs/assemble.js +739 -0
- package/dist/src/docs/assemble.js.map +1 -0
- package/dist/src/docs/cli-reference.d.ts +93 -0
- package/dist/src/docs/cli-reference.d.ts.map +1 -0
- package/dist/src/docs/cli-reference.js +256 -0
- package/dist/src/docs/cli-reference.js.map +1 -0
- package/dist/src/docs/discover.d.ts +60 -0
- package/dist/src/docs/discover.d.ts.map +1 -0
- package/dist/src/docs/discover.js +233 -0
- package/dist/src/docs/discover.js.map +1 -0
- package/dist/src/docs/portal.d.ts +79 -0
- package/dist/src/docs/portal.d.ts.map +1 -0
- package/dist/src/docs/portal.js +242 -0
- package/dist/src/docs/portal.js.map +1 -0
- package/dist/src/docs/registry-docs.d.ts +43 -0
- package/dist/src/docs/registry-docs.d.ts.map +1 -0
- package/dist/src/docs/registry-docs.js +138 -0
- package/dist/src/docs/registry-docs.js.map +1 -0
- package/dist/src/docs/schema.d.ts +48 -0
- package/dist/src/docs/schema.d.ts.map +1 -0
- package/dist/src/docs/schema.js +96 -0
- package/dist/src/docs/schema.js.map +1 -0
- package/dist/src/docs/serve.d.ts +27 -0
- package/dist/src/docs/serve.d.ts.map +1 -0
- package/dist/src/docs/serve.js +102 -0
- package/dist/src/docs/serve.js.map +1 -0
- package/dist/src/docs/start.d.ts +80 -0
- package/dist/src/docs/start.d.ts.map +1 -0
- package/dist/src/docs/start.js +313 -0
- package/dist/src/docs/start.js.map +1 -0
- package/dist/src/eval/agent-eval.d.mts +14 -0
- package/dist/src/eval/agent-eval.d.mts.map +1 -0
- package/dist/src/eval/agent-eval.mjs +273 -0
- package/dist/src/eval/agent-eval.mjs.map +1 -0
- package/dist/src/index.js +624 -7
- package/dist/src/index.js.map +7 -1
- package/dist/src/program.d.ts +26 -0
- package/dist/src/program.d.ts.map +1 -0
- package/dist/src/program.js +76 -0
- package/dist/src/program.js.map +1 -0
- package/dist/src/utils/auth-preflight.d.ts +159 -0
- package/dist/src/utils/auth-preflight.d.ts.map +1 -0
- package/dist/src/utils/auth-preflight.js +298 -0
- package/dist/src/utils/auth-preflight.js.map +1 -0
- package/dist/src/utils/aws-auth.d.ts +181 -0
- package/dist/src/utils/aws-auth.d.ts.map +1 -0
- package/dist/src/utils/aws-auth.js +527 -0
- package/dist/src/utils/aws-auth.js.map +1 -0
- package/dist/src/utils/bastion.d.ts +1 -1
- package/dist/src/utils/bastion.d.ts.map +1 -1
- package/dist/src/utils/bastion.js +29 -8
- package/dist/src/utils/bastion.js.map +1 -1
- package/dist/src/utils/build-info.d.ts +33 -0
- package/dist/src/utils/build-info.d.ts.map +1 -0
- package/dist/src/utils/build-info.js +102 -0
- package/dist/src/utils/build-info.js.map +1 -0
- package/dist/src/utils/capture-history.d.ts +62 -0
- package/dist/src/utils/capture-history.d.ts.map +1 -0
- package/dist/src/utils/capture-history.js +94 -0
- package/dist/src/utils/capture-history.js.map +1 -0
- package/dist/src/utils/deploy-preflight.d.ts +52 -0
- package/dist/src/utils/deploy-preflight.d.ts.map +1 -0
- package/dist/src/utils/deploy-preflight.js +183 -0
- package/dist/src/utils/deploy-preflight.js.map +1 -0
- package/dist/src/utils/errors.d.ts +75 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +106 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/first-party-contexts.d.ts +40 -0
- package/dist/src/utils/first-party-contexts.d.ts.map +1 -0
- package/dist/src/utils/first-party-contexts.js +53 -0
- package/dist/src/utils/first-party-contexts.js.map +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/kubeconfig.d.ts +62 -0
- package/dist/src/utils/kubeconfig.d.ts.map +1 -0
- package/dist/src/utils/kubeconfig.js +118 -0
- package/dist/src/utils/kubeconfig.js.map +1 -0
- package/dist/src/utils/log.d.ts +27 -1
- package/dist/src/utils/log.d.ts.map +1 -1
- package/dist/src/utils/log.js +59 -5
- package/dist/src/utils/log.js.map +1 -1
- package/dist/src/utils/pid.d.ts +47 -0
- package/dist/src/utils/pid.d.ts.map +1 -0
- package/dist/src/utils/pid.js +83 -0
- package/dist/src/utils/pid.js.map +1 -0
- package/dist/src/utils/pulumi-run.d.ts +23 -0
- package/dist/src/utils/pulumi-run.d.ts.map +1 -0
- package/dist/src/utils/pulumi-run.js +112 -0
- package/dist/src/utils/pulumi-run.js.map +1 -0
- package/dist/src/utils/pulumi.d.ts +15 -0
- package/dist/src/utils/pulumi.d.ts.map +1 -1
- package/dist/src/utils/pulumi.js +35 -0
- package/dist/src/utils/pulumi.js.map +1 -1
- package/dist/src/utils/reachability.d.ts +29 -0
- package/dist/src/utils/reachability.d.ts.map +1 -0
- package/dist/src/utils/reachability.js +81 -0
- package/dist/src/utils/reachability.js.map +1 -0
- package/dist/src/utils/recover-conversation.d.ts +154 -0
- package/dist/src/utils/recover-conversation.d.ts.map +1 -0
- package/dist/src/utils/recover-conversation.js +314 -0
- package/dist/src/utils/recover-conversation.js.map +1 -0
- package/dist/src/utils/registry-broker.d.ts +148 -0
- package/dist/src/utils/registry-broker.d.ts.map +1 -0
- package/dist/src/utils/registry-broker.js +180 -0
- package/dist/src/utils/registry-broker.js.map +1 -0
- package/dist/src/utils/socks-forward.d.ts +40 -0
- package/dist/src/utils/socks-forward.d.ts.map +1 -0
- package/dist/src/utils/socks-forward.js +97 -0
- package/dist/src/utils/socks-forward.js.map +1 -0
- package/dist/src/utils/stack-flag.d.ts +23 -0
- package/dist/src/utils/stack-flag.d.ts.map +1 -0
- package/dist/src/utils/stack-flag.js +41 -0
- package/dist/src/utils/stack-flag.js.map +1 -0
- package/dist/src/utils/tailscale-targets.d.ts +52 -0
- package/dist/src/utils/tailscale-targets.d.ts.map +1 -0
- package/dist/src/utils/tailscale-targets.js +93 -0
- package/dist/src/utils/tailscale-targets.js.map +1 -0
- package/dist/src/utils/tailscale.d.ts +277 -0
- package/dist/src/utils/tailscale.d.ts.map +1 -0
- package/dist/src/utils/tailscale.js +1007 -0
- package/dist/src/utils/tailscale.js.map +1 -0
- package/dist/src/utils/temporal-auth.d.ts +43 -0
- package/dist/src/utils/temporal-auth.d.ts.map +1 -0
- package/dist/src/utils/temporal-auth.js +176 -0
- package/dist/src/utils/temporal-auth.js.map +1 -0
- package/dist/src/utils/temporal-codec.d.ts +101 -0
- package/dist/src/utils/temporal-codec.d.ts.map +1 -0
- package/dist/src/utils/temporal-codec.js +319 -0
- package/dist/src/utils/temporal-codec.js.map +1 -0
- package/dist/src/utils/tunnel-ownership.d.ts +130 -0
- package/dist/src/utils/tunnel-ownership.d.ts.map +1 -0
- package/dist/src/utils/tunnel-ownership.js +274 -0
- package/dist/src/utils/tunnel-ownership.js.map +1 -0
- package/dist/src/utils/vpn-join.d.ts +32 -0
- package/dist/src/utils/vpn-join.d.ts.map +1 -0
- package/dist/src/utils/vpn-join.js +62 -0
- package/dist/src/utils/vpn-join.js.map +1 -0
- package/dist/src/utils/vpn.d.ts +62 -0
- package/dist/src/utils/vpn.d.ts.map +1 -0
- package/dist/src/utils/vpn.js +183 -0
- package/dist/src/utils/vpn.js.map +1 -0
- package/dist/src/utils/workflow-fingerprint.d.ts +49 -0
- package/dist/src/utils/workflow-fingerprint.d.ts.map +1 -0
- package/dist/src/utils/workflow-fingerprint.js +135 -0
- package/dist/src/utils/workflow-fingerprint.js.map +1 -0
- package/dist/src/utils/worktree-identity.d.ts +86 -0
- package/dist/src/utils/worktree-identity.d.ts.map +1 -0
- package/dist/src/utils/worktree-identity.js +164 -0
- package/dist/src/utils/worktree-identity.js.map +1 -0
- package/fragments/agents/AGENTS.md.hbs +92 -0
- package/fragments/agents/CLAUDE.md.hbs +8 -0
- package/fragments/base/Pulumi.dev.yaml.hbs +10 -0
- package/fragments/base/Pulumi.yaml.hbs +9 -0
- package/fragments/base/index.ts.hbs +107 -0
- package/fragments/base/package.json.hbs +22 -0
- package/{templates/api-web-db/api → fragments/base}/tsconfig.json +3 -4
- package/fragments/bucket/api/src/storage.ts.hbs +81 -0
- package/fragments/database/api/src/db.ts.hbs +23 -0
- package/fragments/database/prisma/schema.prisma.hbs +18 -0
- package/{templates/api-web-db → fragments/service}/api/.dockerignore +2 -0
- package/fragments/service/api/package.json.hbs +40 -0
- package/fragments/service/api/src/index.ts.hbs +58 -0
- package/{templates/api-web-db → fragments/service/api}/tsconfig.json +5 -3
- package/fragments/temporal/worker/.dockerignore +4 -0
- package/fragments/temporal/worker/Dockerfile +15 -0
- package/{templates/temporal-api-worker → fragments/temporal}/worker/package.json.hbs +3 -2
- package/fragments/temporal/worker/src/activities.ts.hbs +14 -0
- package/fragments/temporal/worker/src/worker.ts.hbs +27 -0
- package/fragments/temporal/worker/src/workflows.ts.hbs +24 -0
- package/fragments/temporal/worker/tsconfig.json +13 -0
- package/package.json +35 -21
- package/skills/core/SKILL.md +365 -0
- package/skills/pull-remote-agent-context/SKILL.md +194 -0
- package/stack/docker-compose.hub.yml +134 -0
- package/stack/docker-compose.yml +447 -0
- package/stack/hub/Dockerfile.api +18 -0
- package/stack/hub/Dockerfile.auth +10 -0
- package/stack/hub/Dockerfile.ui +10 -0
- package/stack/init/01-databases.sql +12 -0
- package/stack/observability/blackbox.yml +20 -0
- package/stack/observability/otel-collector.yaml +73 -0
- package/stack/observability/prometheus.yml +36 -0
- package/stack/observability/tempo.yaml +25 -0
- package/stack/temporal/local.yaml +44 -0
- package/templates/api-auth/AGENTS.md.hbs +16 -0
- package/templates/api-auth/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-auth/Pulumi.yaml.hbs +8 -0
- package/templates/api-auth/README.md.hbs +67 -0
- package/templates/api-auth/api/package.json.hbs +28 -0
- package/templates/api-auth/api/src/index.ts.hbs +96 -0
- package/templates/api-auth/api/src/schema.ts.hbs +35 -0
- package/templates/api-auth/api/src/seed-authz.ts.hbs +48 -0
- package/templates/api-auth/api/src/spicedb-http-provider.ts.hbs +89 -0
- package/templates/api-auth/index.ts.hbs +65 -0
- package/templates/api-auth/package.json.hbs +20 -0
- package/templates/api-auth/skills/develop/SKILL.md.hbs +32 -0
- package/templates/api-role-gating/AGENTS.md.hbs +20 -0
- package/templates/api-role-gating/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-role-gating/Pulumi.yaml.hbs +8 -0
- package/templates/api-role-gating/README.md.hbs +64 -0
- package/templates/api-role-gating/api/Dockerfile +17 -0
- package/templates/api-role-gating/api/package.json.hbs +28 -0
- package/templates/api-role-gating/api/src/authn.ts.hbs +29 -0
- package/templates/api-role-gating/api/src/authz.ts.hbs +12 -0
- package/templates/api-role-gating/api/src/main.ts.hbs +58 -0
- package/templates/api-role-gating/api/src/schema.ts.hbs +22 -0
- package/templates/api-role-gating/api/tsconfig.json +13 -0
- package/templates/api-role-gating/index.ts.hbs +107 -0
- package/templates/api-role-gating/package.json.hbs +21 -0
- package/templates/api-role-gating/skills/develop/SKILL.md.hbs +60 -0
- package/templates/api-role-gating/tsconfig.json +10 -0
- package/templates/apps-repo/README.md.hbs +24 -0
- package/templates/apps-repo/gitignore +41 -0
- package/templates/apps-repo/npmrc.hbs +7 -0
- package/templates/apps-repo/package.json.hbs +15 -0
- package/templates/apps-repo/pnpm-workspace.yaml +3 -0
- package/templates/apps-repo/tsconfig.json +18 -0
- package/templates/external-service/AGENTS.md.hbs +20 -0
- package/templates/external-service/Pulumi.dev.yaml.hbs +8 -0
- package/templates/external-service/Pulumi.yaml.hbs +8 -0
- package/templates/external-service/README.md.hbs +56 -0
- package/templates/external-service/api/Dockerfile +15 -0
- package/templates/external-service/api/package.json.hbs +25 -0
- package/templates/external-service/api/src/index.ts.hbs +81 -0
- package/templates/external-service/index.ts.hbs +82 -0
- package/templates/external-service/mocks/vendorpay/package.json.hbs +9 -0
- package/templates/external-service/mocks/vendorpay/server.mjs.hbs +61 -0
- package/templates/external-service/package.json.hbs +34 -0
- package/templates/external-service/skills/develop/SKILL.md.hbs +55 -0
- package/templates/external-service/tsconfig.json +10 -0
- package/templates/platform-repo/AGENTS.md.hbs +18 -0
- package/templates/platform-repo/README.md.hbs +38 -0
- package/templates/platform-repo/core/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/core/Pulumi.{{tenant}}-{{env}}.yaml.hbs +57 -0
- package/templates/platform-repo/core/index.ts +62 -0
- package/templates/platform-repo/core/package.json.hbs +22 -0
- package/templates/platform-repo/core/tsconfig.json +8 -0
- package/templates/platform-repo/package.json.hbs +15 -0
- package/templates/platform-repo/platform/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/platform/Pulumi.{{tenant}}-{{env}}.yaml.hbs +59 -0
- package/templates/platform-repo/platform/index.ts +95 -0
- package/templates/platform-repo/platform/package.json.hbs +26 -0
- package/templates/platform-repo/platform/tsconfig.json +8 -0
- package/templates/platform-repo/pnpm-workspace.yaml +3 -0
- package/templates/workflow/AGENTS.md.hbs +15 -0
- package/templates/workflow/Pulumi.dev.yaml.hbs +8 -0
- package/templates/workflow/Pulumi.yaml.hbs +8 -0
- package/templates/workflow/README.md.hbs +45 -0
- package/templates/workflow/api/.dockerignore +4 -0
- package/templates/workflow/api/Dockerfile +15 -0
- package/templates/{temporal-api-worker → workflow}/api/package.json.hbs +8 -6
- package/templates/workflow/api/src/index.ts.hbs +130 -0
- package/templates/workflow/api/tsconfig.json +14 -0
- package/templates/workflow/index.ts.hbs +67 -0
- package/templates/workflow/package.json.hbs +20 -0
- package/templates/workflow/skills/develop/SKILL.md.hbs +32 -0
- package/templates/workflow/tsconfig.json +10 -0
- package/templates/workflow/worker/.dockerignore +4 -0
- package/templates/workflow/worker/Dockerfile +13 -0
- package/templates/workflow/worker/package.json.hbs +25 -0
- package/templates/workflow/worker/src/worker.ts.hbs +24 -0
- package/templates/workflow/worker/tsconfig.json +14 -0
- package/dist/src/commands/devbox.d.ts +0 -22
- package/dist/src/commands/devbox.d.ts.map +0 -1
- package/dist/src/commands/devbox.js +0 -463
- package/dist/src/commands/devbox.js.map +0 -1
- package/templates/api-web-db/api/Dockerfile +0 -16
- package/templates/api-web-db/api/package.json.hbs +0 -21
- package/templates/api-web-db/api/src/index.ts.hbs +0 -123
- package/templates/api-web-db/package.json.hbs +0 -27
- package/templates/api-web-db/sst.config.ts.hbs +0 -151
- package/templates/api-web-db/web/.dockerignore +0 -3
- package/templates/api-web-db/web/Dockerfile +0 -17
- package/templates/api-web-db/web/app/lib/db.server.ts +0 -36
- package/templates/api-web-db/web/app/root.tsx +0 -29
- package/templates/api-web-db/web/app/routes/home.tsx.hbs +0 -114
- package/templates/api-web-db/web/app/routes.ts +0 -3
- package/templates/api-web-db/web/package.json.hbs +0 -30
- package/templates/api-web-db/web/prisma/schema.prisma +0 -25
- package/templates/api-web-db/web/prisma.config.ts +0 -18
- package/templates/api-web-db/web/react-router.config.ts +0 -5
- package/templates/api-web-db/web/tsconfig.json +0 -19
- package/templates/api-web-db/web/vite.config.ts +0 -9
- package/templates/temporal-api-worker/README.md.hbs +0 -133
- package/templates/temporal-api-worker/api/src/index.ts.hbs +0 -145
- package/templates/temporal-api-worker/package.json.hbs +0 -29
- package/templates/temporal-api-worker/sst.config.ts.hbs +0 -161
- package/templates/temporal-api-worker/worker/Dockerfile +0 -11
- package/templates/temporal-api-worker/worker/src/bundle-workflows.ts +0 -38
- package/templates/temporal-api-worker/worker/src/worker.ts.hbs +0 -93
- /package/templates/{temporal-api-worker → api-auth}/api/.dockerignore +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/Dockerfile +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → api-auth}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker/worker → api-role-gating/api}/.dockerignore +0 -0
- /package/templates/{temporal-api-worker/worker → external-service/api}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → workflow}/api/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/activities.ts.hbs +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/workflows.ts.hbs +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace packages whose src the agent/interpreter worker bundles as workflows.
|
|
3
|
+
* MUST stay a subset of the CI replay-gate path filter (`checks.yaml` →
|
|
4
|
+
* `replay-changes`); a drift-guard test asserts it (MESH-2093).
|
|
5
|
+
*/
|
|
6
|
+
export declare const WORKFLOW_PACKAGE_DIRS: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Walk up from `startDir` to the monorepo root (the dir with pnpm-workspace.yaml).
|
|
9
|
+
* Falls back to `startDir` if none is found.
|
|
10
|
+
*/
|
|
11
|
+
export declare function findRepoRoot(startDir: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* The set of directories whose `.ts` the worker turns into Temporal workflows.
|
|
14
|
+
*
|
|
15
|
+
* Prefers the shared workflow **packages** (agent-sdk / interpreter / contracts)
|
|
16
|
+
* when they exist — the precise, low-noise signal for the monorepo agent/interpreter
|
|
17
|
+
* dev loop. When they're absent (a **tenant repo**), falls back to the app's own
|
|
18
|
+
* worker source (`extraDirs`) so the guard isn't silently inert there (MESH-2093).
|
|
19
|
+
* Only existing dirs are returned.
|
|
20
|
+
*/
|
|
21
|
+
export declare function workflowSourceDirs(repoRoot: string, extraDirs?: string[]): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Resolve the worker service(s)' source dirs from a dev-output `services` map, so a
|
|
24
|
+
* tenant repo (no shared workflow packages) still fingerprints the code its worker
|
|
25
|
+
* actually runs. A service is a worker when its name matches `/worker/i` (best
|
|
26
|
+
* effort until dev-output carries a `type: "temporal-worker"` marker — MESH-2093).
|
|
27
|
+
*/
|
|
28
|
+
export declare function resolveWorkerSourceDirs(repoRoot: string, services?: Record<string, {
|
|
29
|
+
src?: string;
|
|
30
|
+
}>): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Content fingerprint of every non-test `.ts`/`.tsx` under `dirs`. Stable across
|
|
33
|
+
* runs for identical content; changes iff a workflow source file's content
|
|
34
|
+
* changes. Returns a short hex digest ('' if no files).
|
|
35
|
+
*
|
|
36
|
+
* Each file is labelled by its path relative to `relativeTo` (when given) so the
|
|
37
|
+
* hash is stable across checkout location/renames; falls back to the absolute path
|
|
38
|
+
* otherwise.
|
|
39
|
+
*/
|
|
40
|
+
export declare function computeWorkflowFingerprint(dirs: string[], relativeTo?: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Convenience: fingerprint an app's workflow source. Pass the dev-output `services`
|
|
43
|
+
* map so a tenant repo falls back to its worker source when the shared workflow
|
|
44
|
+
* packages aren't present.
|
|
45
|
+
*/
|
|
46
|
+
export declare function fingerprintWorkflowSource(appRoot: string, services?: Record<string, {
|
|
47
|
+
src?: string;
|
|
48
|
+
}>): string;
|
|
49
|
+
//# sourceMappingURL=workflow-fingerprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-fingerprint.d.ts","sourceRoot":"","sources":["../../../src/utils/workflow-fingerprint.ts"],"names":[],"mappings":"AA0BA;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,UAIjC,CAAC;AAIF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,GAAE,MAAM,EAAO,GAAG,MAAM,EAAE,CAIvF;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAM,GAC9C,MAAM,EAAE,CAQV;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CA6BtF;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAM,GAC9C,MAAM,CAIR"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow-source fingerprint for relaunch safety (MESH-2017).
|
|
3
|
+
*
|
|
4
|
+
* A `mesh dev` relaunch (or `restart <worker>`) restarts the Temporal worker onto
|
|
5
|
+
* whatever code is current. If the WORKFLOW code changed since the session
|
|
6
|
+
* started, in-flight conversations replay against the new code and — if the change
|
|
7
|
+
* is replay-incompatible — get stranded (observed: conversation 523a4103). The
|
|
8
|
+
* replay-safety gate (MESH-2091) catches this at CI; this catches it at the *local*
|
|
9
|
+
* dev loop, where uncommitted edits haven't been through CI.
|
|
10
|
+
*
|
|
11
|
+
* We fingerprint the source the agent/interpreter worker bundles into Temporal
|
|
12
|
+
* workflows: the workflow packages agent-sdk, workflow-interpreter, agent-contracts
|
|
13
|
+
* (the same set the CI replay-gate path filter covers). A content hash (not mtime)
|
|
14
|
+
* so a `git checkout`/rebase that rewrites mtimes without changing content doesn't
|
|
15
|
+
* produce a false "code changed" warning; paths are hashed repo-root-relative so
|
|
16
|
+
* moving/renaming the checkout doesn't either.
|
|
17
|
+
*
|
|
18
|
+
* NOTE (MESH-2017 follow-up): this covers the shared workflow packages, not a
|
|
19
|
+
* tenant repo's own worker source — `workflowSourceDirs` accepts extra dirs for
|
|
20
|
+
* that, but no caller wires them yet, so in a repo without those packages the
|
|
21
|
+
* fingerprint is empty and the guard is inert. Tracked separately.
|
|
22
|
+
*/
|
|
23
|
+
import { createHash } from "node:crypto";
|
|
24
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
25
|
+
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
26
|
+
/**
|
|
27
|
+
* Workspace packages whose src the agent/interpreter worker bundles as workflows.
|
|
28
|
+
* MUST stay a subset of the CI replay-gate path filter (`checks.yaml` →
|
|
29
|
+
* `replay-changes`); a drift-guard test asserts it (MESH-2093).
|
|
30
|
+
*/
|
|
31
|
+
export const WORKFLOW_PACKAGE_DIRS = [
|
|
32
|
+
"packages/agent-sdk/src",
|
|
33
|
+
"packages/workflow-interpreter/src",
|
|
34
|
+
"packages/agent-contracts/src",
|
|
35
|
+
];
|
|
36
|
+
const EXCLUDE = /(^|\/)(node_modules|dist|__tests__)(\/|$)|\.(test|spec)\.[cm]?tsx?$/;
|
|
37
|
+
/**
|
|
38
|
+
* Walk up from `startDir` to the monorepo root (the dir with pnpm-workspace.yaml).
|
|
39
|
+
* Falls back to `startDir` if none is found.
|
|
40
|
+
*/
|
|
41
|
+
export function findRepoRoot(startDir) {
|
|
42
|
+
let dir = startDir;
|
|
43
|
+
for (;;) {
|
|
44
|
+
if (existsSync(join(dir, "pnpm-workspace.yaml")))
|
|
45
|
+
return dir;
|
|
46
|
+
const parent = dirname(dir);
|
|
47
|
+
if (parent === dir)
|
|
48
|
+
return startDir;
|
|
49
|
+
dir = parent;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The set of directories whose `.ts` the worker turns into Temporal workflows.
|
|
54
|
+
*
|
|
55
|
+
* Prefers the shared workflow **packages** (agent-sdk / interpreter / contracts)
|
|
56
|
+
* when they exist — the precise, low-noise signal for the monorepo agent/interpreter
|
|
57
|
+
* dev loop. When they're absent (a **tenant repo**), falls back to the app's own
|
|
58
|
+
* worker source (`extraDirs`) so the guard isn't silently inert there (MESH-2093).
|
|
59
|
+
* Only existing dirs are returned.
|
|
60
|
+
*/
|
|
61
|
+
export function workflowSourceDirs(repoRoot, extraDirs = []) {
|
|
62
|
+
const pkgDirs = WORKFLOW_PACKAGE_DIRS.map((d) => join(repoRoot, d)).filter((d) => existsSync(d));
|
|
63
|
+
if (pkgDirs.length > 0)
|
|
64
|
+
return pkgDirs;
|
|
65
|
+
return extraDirs.filter((d) => existsSync(d));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Resolve the worker service(s)' source dirs from a dev-output `services` map, so a
|
|
69
|
+
* tenant repo (no shared workflow packages) still fingerprints the code its worker
|
|
70
|
+
* actually runs. A service is a worker when its name matches `/worker/i` (best
|
|
71
|
+
* effort until dev-output carries a `type: "temporal-worker"` marker — MESH-2093).
|
|
72
|
+
*/
|
|
73
|
+
export function resolveWorkerSourceDirs(repoRoot, services = {}) {
|
|
74
|
+
const dirs = [];
|
|
75
|
+
for (const [name, svc] of Object.entries(services)) {
|
|
76
|
+
if (/worker/i.test(name) && svc?.src) {
|
|
77
|
+
dirs.push(isAbsolute(svc.src) ? svc.src : join(repoRoot, svc.src));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return dirs;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Content fingerprint of every non-test `.ts`/`.tsx` under `dirs`. Stable across
|
|
84
|
+
* runs for identical content; changes iff a workflow source file's content
|
|
85
|
+
* changes. Returns a short hex digest ('' if no files).
|
|
86
|
+
*
|
|
87
|
+
* Each file is labelled by its path relative to `relativeTo` (when given) so the
|
|
88
|
+
* hash is stable across checkout location/renames; falls back to the absolute path
|
|
89
|
+
* otherwise.
|
|
90
|
+
*/
|
|
91
|
+
export function computeWorkflowFingerprint(dirs, relativeTo) {
|
|
92
|
+
const files = [];
|
|
93
|
+
for (const dir of dirs) {
|
|
94
|
+
let rels;
|
|
95
|
+
try {
|
|
96
|
+
rels = readdirSync(dir, { recursive: true });
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
continue; // dir removed mid-scan
|
|
100
|
+
}
|
|
101
|
+
for (const rel of rels) {
|
|
102
|
+
const p = String(rel);
|
|
103
|
+
if (/\.(ts|tsx)$/.test(p) && !EXCLUDE.test(p))
|
|
104
|
+
files.push(join(dir, p));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
files.sort();
|
|
108
|
+
if (files.length === 0)
|
|
109
|
+
return "";
|
|
110
|
+
const h = createHash("sha256");
|
|
111
|
+
for (const f of files) {
|
|
112
|
+
try {
|
|
113
|
+
const content = readFileSync(f);
|
|
114
|
+
h.update(relativeTo ? relative(relativeTo, f) : f);
|
|
115
|
+
h.update("\0");
|
|
116
|
+
h.update(content);
|
|
117
|
+
h.update("\0");
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
/* unreadable/removed mid-scan — skip */
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return h.digest("hex").slice(0, 16);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Convenience: fingerprint an app's workflow source. Pass the dev-output `services`
|
|
127
|
+
* map so a tenant repo falls back to its worker source when the shared workflow
|
|
128
|
+
* packages aren't present.
|
|
129
|
+
*/
|
|
130
|
+
export function fingerprintWorkflowSource(appRoot, services = {}) {
|
|
131
|
+
const repoRoot = findRepoRoot(appRoot);
|
|
132
|
+
const workerDirs = resolveWorkerSourceDirs(repoRoot, services);
|
|
133
|
+
return computeWorkflowFingerprint(workflowSourceDirs(repoRoot, workerDirs), repoRoot);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=workflow-fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-fingerprint.js","sourceRoot":"","sources":["../../../src/utils/workflow-fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,Y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AAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;YAChC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACnD,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACf,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAClB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;QAAC,MAAM,CAAC;YACP,wCAAwC;QAC1C,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAe,EACf,WAA6C,EAAE;IAE/C,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/D,OAAO,0BAA0B,CAAC,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Number of distinct port blocks (block 0 reserved for the primary checkout). */
|
|
2
|
+
export declare const NUM_PORT_BLOCKS = 64;
|
|
3
|
+
/** First port of block 1; block 0 uses the app's preferred ports, not this range. */
|
|
4
|
+
export declare const PORT_BLOCK_BASE = 40000;
|
|
5
|
+
/** Ports reserved per worktree block (split into service + tunnel sub-ranges). */
|
|
6
|
+
export declare const PORT_BLOCK_SIZE = 40;
|
|
7
|
+
/** Service ports occupy `[base, base+SERVICE_SUBRANGE)`; tunnels take the rest. */
|
|
8
|
+
export declare const PORT_BLOCK_SERVICE_SUBRANGE = 24;
|
|
9
|
+
export interface WorktreeIdentity {
|
|
10
|
+
/** Absolute path to this worktree's root (git top-level). */
|
|
11
|
+
worktreeRoot: string;
|
|
12
|
+
/** True for the repo's primary checkout; false for a linked `git worktree`. */
|
|
13
|
+
isPrimary: boolean;
|
|
14
|
+
/** Human-readable sanitized basename of the worktree root (e.g. "design-registry"). */
|
|
15
|
+
slug: string;
|
|
16
|
+
/** 4 hex chars of sha256(worktreeRoot) — disambiguates same-named worktrees. */
|
|
17
|
+
hash: string;
|
|
18
|
+
/** "" for the primary checkout; else `${slug}-${hash}`. */
|
|
19
|
+
token: string;
|
|
20
|
+
/** 0 for primary (preferred ports); 1..NUM_PORT_BLOCKS-1 for linked worktrees. */
|
|
21
|
+
portBlock: number;
|
|
22
|
+
/** "" for primary; else `-${token}` — appended to Temporal/Nexus task queues (Tier 2). */
|
|
23
|
+
taskQueueSuffix: string;
|
|
24
|
+
}
|
|
25
|
+
/** Lowercase, hyphenate, strip non-alphanumerics; never empty. */
|
|
26
|
+
export declare function sanitizeSlug(name: string): string;
|
|
27
|
+
/** Stable 4-hex-char fingerprint of a worktree's absolute path. */
|
|
28
|
+
export declare function worktreeHash(worktreeRoot: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Map a worktree hash to a port block. Primary → 0 (preferred ports).
|
|
31
|
+
* Linked → deterministic 1..NUM_PORT_BLOCKS-1 (stable across runs for the same
|
|
32
|
+
* worktree path, so ports don't drift between launches).
|
|
33
|
+
*/
|
|
34
|
+
export declare function portBlockFor(hash: string, isPrimary: boolean): number;
|
|
35
|
+
/** First port of a block (block 0 has no dedicated range — callers use preferred ports). */
|
|
36
|
+
export declare function blockBasePort(block: number): number;
|
|
37
|
+
/**
|
|
38
|
+
* Identity whose PORT BLOCK is derived from (worktree, app) — every non-port
|
|
39
|
+
* field stays worktree-scoped. A repo can hold several apps whose `mesh dev`
|
|
40
|
+
* sessions run CONCURRENTLY (e.g. scu-mesh-apps' plaid-token-manager +
|
|
41
|
+
* plaid-reporting); with a per-worktree block they draw the same ports, and
|
|
42
|
+
* the availability probe alone races services that are still booting and
|
|
43
|
+
* haven't bound yet — both sessions allocated 41800 in the wild. Same
|
|
44
|
+
* philosophy as the per-worktree blocks of MESH-2013.
|
|
45
|
+
*
|
|
46
|
+
* NOT disjoint by construction: `portBlockFor` buckets a hash into
|
|
47
|
+
* NUM_PORT_BLOCKS-1 slots, so two (worktree, app) pairs CAN land on the same
|
|
48
|
+
* block — and app-scoping raises the entity count from #worktrees to
|
|
49
|
+
* #worktrees x #apps, which makes that likelier. Sibling apps in one worktree
|
|
50
|
+
* (the case this fixes) are disjoint by default; the in-block probe and the
|
|
51
|
+
* ephemeral fallback in `allocatePorts` remain the backstop for a collision.
|
|
52
|
+
*
|
|
53
|
+
* Primary checkouts keep preferred-port semantics (block 0) — sibling apps
|
|
54
|
+
* there still share preferred ports and rely on that probe.
|
|
55
|
+
*/
|
|
56
|
+
export declare function withAppScopedPortBlock(wt: WorktreeIdentity, appRoot: string): WorktreeIdentity;
|
|
57
|
+
/**
|
|
58
|
+
* Stack name for `mesh stack init --worktree` (MESH-2013 Slice 3): append the
|
|
59
|
+
* worktree token so concurrent worktrees deploy to distinct stacks. The SSM
|
|
60
|
+
* export paths (`apps/{app}/stacks/{stack}/...`), Temporal namespace
|
|
61
|
+
* (`{tenant}-{stack}-{app}`), and Nexus endpoint name all derive from the stack
|
|
62
|
+
* name, so one discriminator isolates all three. The primary checkout has an
|
|
63
|
+
* empty token → the base name is returned unchanged (it IS the canonical stack).
|
|
64
|
+
*/
|
|
65
|
+
/** Max chars of the worktree slug that reach a stack name. Deploy-time surfaces
|
|
66
|
+
* (Temporal namespace `{tenant}-{stack}-{app}`, Nexus endpoint names) have
|
|
67
|
+
* provider length limits, so we cap the human-readable slug here; the 4-hex hash
|
|
68
|
+
* still guarantees uniqueness. (The local-only token — tmux/ports — is uncapped.) */
|
|
69
|
+
export declare const STACK_SLUG_MAX = 16;
|
|
70
|
+
export declare function worktreeStackName(baseName: string, wt: WorktreeIdentity): string;
|
|
71
|
+
/**
|
|
72
|
+
* True when `stackName` would collide across worktrees: we're in a LINKED
|
|
73
|
+
* worktree (non-empty token) but the stack name doesn't carry that token — so a
|
|
74
|
+
* concurrent `pulumi up` from another worktree on the same name hits identical
|
|
75
|
+
* SSM export paths / Temporal namespace. Drives the `mesh deploy` warning.
|
|
76
|
+
*/
|
|
77
|
+
export declare function stackNeedsWorktreeIsolation(stackName: string, wt: WorktreeIdentity): boolean;
|
|
78
|
+
type GitRunner = (args: string[], cwd: string) => string;
|
|
79
|
+
/**
|
|
80
|
+
* Resolve the worktree identity for a given cwd. Returns a primary-checkout
|
|
81
|
+
* identity (token "", block 0) when not inside a git repo, so non-repo/edge
|
|
82
|
+
* cases degrade to today's behavior rather than throwing.
|
|
83
|
+
*/
|
|
84
|
+
export declare function resolveWorktreeIdentity(cwd?: string, gitRunner?: GitRunner): WorktreeIdentity;
|
|
85
|
+
export {};
|
|
86
|
+
//# sourceMappingURL=worktree-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-identity.d.ts","sourceRoot":"","sources":["../../../src/utils/worktree-identity.ts"],"names":[],"mappings":"AA+BA,kFAAkF;AAClF,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,qFAAqF;AACrF,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,kFAAkF;AAClF,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,mFAAmF;AACnF,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C,MAAM,WAAW,gBAAgB;IAC/B,6DAA6D;IAC7D,YAAY,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,SAAS,EAAE,OAAO,CAAC;IACnB,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMjD;AAED,mEAAmE;AACnE,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,CAIrE;AAED,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAI9F;AAED;;;;;;;GAOG;AACH;;;qFAGqF;AACrF,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,gBAAgB,GAAG,MAAM,CAIhF;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAK5F;AAED,KAAK,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;AAKzD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,GAAE,MAAsB,EAC3B,SAAS,GAAE,SAA4B,GACtC,gBAAgB,CAmClB"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-worktree identity for collision-free concurrent `mesh dev` (MESH-2013).
|
|
3
|
+
*
|
|
4
|
+
* Running `mesh dev` in several git worktrees at once collides on ports, tmux
|
|
5
|
+
* session names, tmpdir session state, and env-file dirs — because every one of
|
|
6
|
+
* those derives from the app's Pulumi project name, which is identical across
|
|
7
|
+
* worktrees. This module derives ONE deterministic token per worktree (from its
|
|
8
|
+
* path) that the dev launcher threads through all of those so worktrees can't
|
|
9
|
+
* step on each other.
|
|
10
|
+
*
|
|
11
|
+
* TASK QUEUES are unique by construction — `taskQueueSuffix` is `-${token}` and
|
|
12
|
+
* the token carries the 4-hex path hash. SESSION NAMES are not: the tmux name is
|
|
13
|
+
* `${projectName}-${slug}` (slug only), and the state file + env dir derive from
|
|
14
|
+
* it, so two linked worktrees whose basenames sanitize to the same slug (e.g.
|
|
15
|
+
* `.worktrees/MESH-2375` and `~/scratch/mesh-2375`) share all three. PORTS are
|
|
16
|
+
* not either: the block is a hash bucketed into NUM_PORT_BLOCKS-1 slots and is
|
|
17
|
+
* additionally scoped by app — see `withAppScopedPortBlock` below for what that
|
|
18
|
+
* does and does not guarantee.
|
|
19
|
+
*
|
|
20
|
+
* The PRIMARY checkout (the repo's main working tree) keeps its historical
|
|
21
|
+
* behavior — empty token, port block 0 (preferred ports), no session suffix —
|
|
22
|
+
* so existing muscle memory is preserved. Only LINKED worktrees get offsets.
|
|
23
|
+
*
|
|
24
|
+
* Pure helpers (`sanitizeSlug`, `worktreeHash`, `portBlockFor`, `blockBasePort`)
|
|
25
|
+
* are git-free and unit-tested; `resolveWorktreeIdentity` shells to git via an
|
|
26
|
+
* injectable runner so it can be tested without a real repo.
|
|
27
|
+
*/
|
|
28
|
+
import { execFileSync } from "node:child_process";
|
|
29
|
+
import * as crypto from "node:crypto";
|
|
30
|
+
import * as path from "node:path";
|
|
31
|
+
/** Number of distinct port blocks (block 0 reserved for the primary checkout). */
|
|
32
|
+
export const NUM_PORT_BLOCKS = 64;
|
|
33
|
+
/** First port of block 1; block 0 uses the app's preferred ports, not this range. */
|
|
34
|
+
export const PORT_BLOCK_BASE = 40000;
|
|
35
|
+
/** Ports reserved per worktree block (split into service + tunnel sub-ranges). */
|
|
36
|
+
export const PORT_BLOCK_SIZE = 40;
|
|
37
|
+
/** Service ports occupy `[base, base+SERVICE_SUBRANGE)`; tunnels take the rest. */
|
|
38
|
+
export const PORT_BLOCK_SERVICE_SUBRANGE = 24;
|
|
39
|
+
/** Lowercase, hyphenate, strip non-alphanumerics; never empty. */
|
|
40
|
+
export function sanitizeSlug(name) {
|
|
41
|
+
const s = name
|
|
42
|
+
.toLowerCase()
|
|
43
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
44
|
+
.replace(/^-+|-+$/g, "");
|
|
45
|
+
return s || "wt";
|
|
46
|
+
}
|
|
47
|
+
/** Stable 4-hex-char fingerprint of a worktree's absolute path. */
|
|
48
|
+
export function worktreeHash(worktreeRoot) {
|
|
49
|
+
return crypto.createHash("sha256").update(worktreeRoot).digest("hex").slice(0, 4);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Map a worktree hash to a port block. Primary → 0 (preferred ports).
|
|
53
|
+
* Linked → deterministic 1..NUM_PORT_BLOCKS-1 (stable across runs for the same
|
|
54
|
+
* worktree path, so ports don't drift between launches).
|
|
55
|
+
*/
|
|
56
|
+
export function portBlockFor(hash, isPrimary) {
|
|
57
|
+
if (isPrimary)
|
|
58
|
+
return 0;
|
|
59
|
+
const n = parseInt(hash, 16);
|
|
60
|
+
return 1 + (n % (NUM_PORT_BLOCKS - 1));
|
|
61
|
+
}
|
|
62
|
+
/** First port of a block (block 0 has no dedicated range — callers use preferred ports). */
|
|
63
|
+
export function blockBasePort(block) {
|
|
64
|
+
return PORT_BLOCK_BASE + block * PORT_BLOCK_SIZE;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Identity whose PORT BLOCK is derived from (worktree, app) — every non-port
|
|
68
|
+
* field stays worktree-scoped. A repo can hold several apps whose `mesh dev`
|
|
69
|
+
* sessions run CONCURRENTLY (e.g. scu-mesh-apps' plaid-token-manager +
|
|
70
|
+
* plaid-reporting); with a per-worktree block they draw the same ports, and
|
|
71
|
+
* the availability probe alone races services that are still booting and
|
|
72
|
+
* haven't bound yet — both sessions allocated 41800 in the wild. Same
|
|
73
|
+
* philosophy as the per-worktree blocks of MESH-2013.
|
|
74
|
+
*
|
|
75
|
+
* NOT disjoint by construction: `portBlockFor` buckets a hash into
|
|
76
|
+
* NUM_PORT_BLOCKS-1 slots, so two (worktree, app) pairs CAN land on the same
|
|
77
|
+
* block — and app-scoping raises the entity count from #worktrees to
|
|
78
|
+
* #worktrees x #apps, which makes that likelier. Sibling apps in one worktree
|
|
79
|
+
* (the case this fixes) are disjoint by default; the in-block probe and the
|
|
80
|
+
* ephemeral fallback in `allocatePorts` remain the backstop for a collision.
|
|
81
|
+
*
|
|
82
|
+
* Primary checkouts keep preferred-port semantics (block 0) — sibling apps
|
|
83
|
+
* there still share preferred ports and rely on that probe.
|
|
84
|
+
*/
|
|
85
|
+
export function withAppScopedPortBlock(wt, appRoot) {
|
|
86
|
+
if (wt.isPrimary)
|
|
87
|
+
return wt;
|
|
88
|
+
const appHash = worktreeHash(`${wt.worktreeRoot}#${path.resolve(appRoot)}`);
|
|
89
|
+
return { ...wt, portBlock: portBlockFor(appHash, false) };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Stack name for `mesh stack init --worktree` (MESH-2013 Slice 3): append the
|
|
93
|
+
* worktree token so concurrent worktrees deploy to distinct stacks. The SSM
|
|
94
|
+
* export paths (`apps/{app}/stacks/{stack}/...`), Temporal namespace
|
|
95
|
+
* (`{tenant}-{stack}-{app}`), and Nexus endpoint name all derive from the stack
|
|
96
|
+
* name, so one discriminator isolates all three. The primary checkout has an
|
|
97
|
+
* empty token → the base name is returned unchanged (it IS the canonical stack).
|
|
98
|
+
*/
|
|
99
|
+
/** Max chars of the worktree slug that reach a stack name. Deploy-time surfaces
|
|
100
|
+
* (Temporal namespace `{tenant}-{stack}-{app}`, Nexus endpoint names) have
|
|
101
|
+
* provider length limits, so we cap the human-readable slug here; the 4-hex hash
|
|
102
|
+
* still guarantees uniqueness. (The local-only token — tmux/ports — is uncapped.) */
|
|
103
|
+
export const STACK_SLUG_MAX = 16;
|
|
104
|
+
export function worktreeStackName(baseName, wt) {
|
|
105
|
+
if (!wt.token)
|
|
106
|
+
return baseName;
|
|
107
|
+
const cappedSlug = wt.slug.slice(0, STACK_SLUG_MAX).replace(/-+$/, "");
|
|
108
|
+
return `${baseName}-${cappedSlug}-${wt.hash}`;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* True when `stackName` would collide across worktrees: we're in a LINKED
|
|
112
|
+
* worktree (non-empty token) but the stack name doesn't carry that token — so a
|
|
113
|
+
* concurrent `pulumi up` from another worktree on the same name hits identical
|
|
114
|
+
* SSM export paths / Temporal namespace. Drives the `mesh deploy` warning.
|
|
115
|
+
*/
|
|
116
|
+
export function stackNeedsWorktreeIsolation(stackName, wt) {
|
|
117
|
+
// The 4-hex hash is the stable discriminator present in every worktree stack
|
|
118
|
+
// name (`worktreeStackName` ends with `-${hash}`), and survives the slug cap —
|
|
119
|
+
// so match on it rather than the full (uncapped) token.
|
|
120
|
+
return !!wt.token && !stackName.endsWith(`-${wt.hash}`);
|
|
121
|
+
}
|
|
122
|
+
const defaultGitRunner = (args, cwd) => execFileSync("git", args, { cwd, encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
123
|
+
/**
|
|
124
|
+
* Resolve the worktree identity for a given cwd. Returns a primary-checkout
|
|
125
|
+
* identity (token "", block 0) when not inside a git repo, so non-repo/edge
|
|
126
|
+
* cases degrade to today's behavior rather than throwing.
|
|
127
|
+
*/
|
|
128
|
+
export function resolveWorktreeIdentity(cwd = process.cwd(), gitRunner = defaultGitRunner) {
|
|
129
|
+
let worktreeRoot;
|
|
130
|
+
let isPrimary = true;
|
|
131
|
+
try {
|
|
132
|
+
worktreeRoot = path.resolve(gitRunner(["rev-parse", "--show-toplevel"], cwd));
|
|
133
|
+
// The common git dir is `<primary-worktree>/.git`; its parent is the primary
|
|
134
|
+
// checkout. A linked worktree's top-level differs from that parent.
|
|
135
|
+
const commonDir = gitRunner(["rev-parse", "--git-common-dir"], cwd);
|
|
136
|
+
const primaryRoot = path.resolve(path.dirname(path.resolve(cwd, commonDir)));
|
|
137
|
+
isPrimary = worktreeRoot === primaryRoot;
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
// Not a git repo (or git unavailable) — behave as the primary checkout.
|
|
141
|
+
return {
|
|
142
|
+
worktreeRoot: path.resolve(cwd),
|
|
143
|
+
isPrimary: true,
|
|
144
|
+
slug: sanitizeSlug(path.basename(path.resolve(cwd))),
|
|
145
|
+
hash: worktreeHash(path.resolve(cwd)),
|
|
146
|
+
token: "",
|
|
147
|
+
portBlock: 0,
|
|
148
|
+
taskQueueSuffix: "",
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const slug = sanitizeSlug(path.basename(worktreeRoot));
|
|
152
|
+
const hash = worktreeHash(worktreeRoot);
|
|
153
|
+
const token = isPrimary ? "" : `${slug}-${hash}`;
|
|
154
|
+
return {
|
|
155
|
+
worktreeRoot,
|
|
156
|
+
isPrimary,
|
|
157
|
+
slug,
|
|
158
|
+
hash,
|
|
159
|
+
token,
|
|
160
|
+
portBlock: portBlockFor(hash, isPrimary),
|
|
161
|
+
taskQueueSuffix: token ? `-${token}` : "",
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=worktree-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-identity.js","sourceRoot":"","sources":["../../../src/utils/worktree-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,kFAAkF;AAClF,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,qFAAqF;AACrF,M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,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Agent Instructions — {{titleCase name}}
|
|
2
|
+
|
|
3
|
+
## This App
|
|
4
|
+
|
|
5
|
+
Read these files to understand the infrastructure and configuration:
|
|
6
|
+
- `index.ts` — Pulumi app definition (primitives, services, linking)
|
|
7
|
+
- `Pulumi.*.yaml` — Stack config (tenant, platform, deploy mode)
|
|
8
|
+
|
|
9
|
+
## Pattern
|
|
10
|
+
|
|
11
|
+
Every mesh app follows 5 steps in `index.ts`:
|
|
12
|
+
1. `mesh.apps.getConfig(pulumi)` — read stack config
|
|
13
|
+
2. `new mesh.apps.AppEnvironment(...)` — namespace, IAM, providers
|
|
14
|
+
3. Add primitives (Database, Bucket, TemporalWorker, etc.)
|
|
15
|
+
4. Create services with `link()` — wires env vars, tunnels, secrets
|
|
16
|
+
5. `env.register()` — finalize SSM metadata + dev outputs
|
|
17
|
+
|
|
18
|
+
{{#if temporal}}
|
|
19
|
+
## Temporal Workers & Clients
|
|
20
|
+
|
|
21
|
+
**Always use `@mesh-tech/app-kit` factories** — never raw `@temporalio/*` setup.
|
|
22
|
+
|
|
23
|
+
### Worker (`worker/src/worker.ts`)
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { createTemporalWorker, resolveWorkflows } from "@mesh-tech/app-kit/temporal";
|
|
27
|
+
import * as activities from "./activities.js";
|
|
28
|
+
|
|
29
|
+
const { worker, cleanup } = await createTemporalWorker({
|
|
30
|
+
activities,
|
|
31
|
+
...await resolveWorkflows(import.meta.url),
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`createTemporalWorker()` handles authenticated connections (M2M tokens),
|
|
36
|
+
encryption codec, and OpenTelemetry — no manual setup needed.
|
|
37
|
+
|
|
38
|
+
### Client (`api/src/index.ts`)
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { createTemporalClient } from "@mesh-tech/app-kit/temporal-client";
|
|
42
|
+
|
|
43
|
+
const { withClient } = await createTemporalClient();
|
|
44
|
+
|
|
45
|
+
// Use withClient() for each operation — it handles auth token injection
|
|
46
|
+
const result = await withClient(async (client) => {
|
|
47
|
+
const handle = await client.workflow.start("myWorkflow", { ... });
|
|
48
|
+
return handle.result();
|
|
49
|
+
});
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Important:** Always use `withClient()` callback — don't hold a raw `Client` reference.
|
|
53
|
+
The callback injects fresh auth metadata per call.
|
|
54
|
+
{{/if}}
|
|
55
|
+
|
|
56
|
+
{{#if database}}
|
|
57
|
+
## Database
|
|
58
|
+
|
|
59
|
+
Uses Prisma with the `pg` adapter. Connection via `DATABASE_URL` from `link()`.
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { getDb } from "./db.js";
|
|
63
|
+
const db = getDb();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Run migrations: `pnpm mesh db exec -- npx prisma migrate dev`
|
|
67
|
+
{{/if}}
|
|
68
|
+
|
|
69
|
+
{{#if bucket}}
|
|
70
|
+
## S3 Bucket
|
|
71
|
+
|
|
72
|
+
The `uploads` bucket is linked to the API service. See `api/src/storage.ts`
|
|
73
|
+
for helper functions using the injected `UPLOADS_BUCKET` and `UPLOADS_REGION` env vars.
|
|
74
|
+
{{/if}}
|
|
75
|
+
|
|
76
|
+
## Documentation
|
|
77
|
+
|
|
78
|
+
- `npx intent load @mesh-tech/app-kit#core` — the authoritative app-authoring API
|
|
79
|
+
(getConfig → AppEnvironment → primitives → link → register; arg tables + `link()` semantics)
|
|
80
|
+
- The **mesh-apps** skill (`.claude/skills/mesh-apps/`) — the scaffold → wire → run → debug recipe
|
|
81
|
+
- `libs/infra-components/docs/primitives/` — per-component reference (in-repo)
|
|
82
|
+
|
|
83
|
+
## CLI
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
pnpm mesh dev # Local development (tunnels + services in tmux)
|
|
87
|
+
pnpm mesh deploy up # Deploy to cluster
|
|
88
|
+
{{#if database}}
|
|
89
|
+
pnpm mesh db psql # Interactive database session
|
|
90
|
+
{{/if}}
|
|
91
|
+
pnpm mesh tunnel dev # Open tunnels without starting services
|
|
92
|
+
```
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# CLAUDE.md — {{titleCase name}}
|
|
2
|
+
|
|
3
|
+
<!-- Bridge this app's AGENTS.md into Claude's context. TanStack Intent (`intent
|
|
4
|
+
install`) writes its skill-loading guidance to AGENTS.md, but Claude Code loads
|
|
5
|
+
CLAUDE.md, not AGENTS.md — without this import the guidance never reaches Claude,
|
|
6
|
+
and intent-skill activation drops to ~0% (agents guess a non-existent bare
|
|
7
|
+
`intent` command and give up). Keep this import. See MESH-2156 / MESH-2159. -->
|
|
8
|
+
@AGENTS.md
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
secretsprovider: awskms:///alias/{{tenant}}-dev-pulumi-secrets?region={{region}}
|
|
2
|
+
config:
|
|
3
|
+
aws:region: {{region}}
|
|
4
|
+
mesh:tenant: {{tenant}}
|
|
5
|
+
mesh:platform:
|
|
6
|
+
name: mesh
|
|
7
|
+
env: dev
|
|
8
|
+
mesh:deploy: 'false'
|
|
9
|
+
# Deployer role for this tenant/hub — assumed via your `mesh login` session.
|
|
10
|
+
mesh:deployerRole: {{deployerRoleArn}}
|