@mesh-tech/mesh-cli 0.1.1 → 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 +1 -0
- package/dist/src/commands/secrets/set.d.ts.map +1 -1
- package/dist/src/commands/secrets/set.js +96 -2
- package/dist/src/commands/secrets/set.js.map +1 -1
- package/dist/src/commands/skills.d.ts +34 -0
- package/dist/src/commands/skills.d.ts.map +1 -0
- package/dist/src/commands/skills.js +207 -0
- package/dist/src/commands/skills.js.map +1 -0
- package/dist/src/commands/stack.d.ts.map +1 -1
- package/dist/src/commands/stack.js +361 -23
- package/dist/src/commands/stack.js.map +1 -1
- package/dist/src/commands/temporal.d.ts +15 -0
- package/dist/src/commands/temporal.d.ts.map +1 -0
- package/dist/src/commands/temporal.js +781 -0
- package/dist/src/commands/temporal.js.map +1 -0
- package/dist/src/commands/tenant.d.ts +56 -0
- package/dist/src/commands/tenant.d.ts.map +1 -0
- package/dist/src/commands/tenant.js +233 -0
- package/dist/src/commands/tenant.js.map +1 -0
- package/dist/src/commands/tunnel/index.d.ts +49 -3
- package/dist/src/commands/tunnel/index.d.ts.map +1 -1
- package/dist/src/commands/tunnel/index.js +331 -8
- package/dist/src/commands/tunnel/index.js.map +1 -1
- package/dist/src/commands/vcs/clone.d.ts +3 -0
- package/dist/src/commands/vcs/clone.d.ts.map +1 -0
- package/dist/src/commands/vcs/clone.js +20 -0
- package/dist/src/commands/vcs/clone.js.map +1 -0
- package/dist/src/commands/vcs/common.d.ts +21 -0
- package/dist/src/commands/vcs/common.d.ts.map +1 -0
- package/dist/src/commands/vcs/common.js +62 -0
- package/dist/src/commands/vcs/common.js.map +1 -0
- package/dist/src/commands/vcs/drafts.d.ts +13 -0
- package/dist/src/commands/vcs/drafts.d.ts.map +1 -0
- package/dist/src/commands/vcs/drafts.js +45 -0
- package/dist/src/commands/vcs/drafts.js.map +1 -0
- package/dist/src/commands/vcs/get.d.ts +8 -0
- package/dist/src/commands/vcs/get.d.ts.map +1 -0
- package/dist/src/commands/vcs/get.js +61 -0
- package/dist/src/commands/vcs/get.js.map +1 -0
- package/dist/src/commands/vcs/index.d.ts +3 -0
- package/dist/src/commands/vcs/index.d.ts.map +1 -0
- package/dist/src/commands/vcs/index.js +58 -0
- package/dist/src/commands/vcs/index.js.map +1 -0
- package/dist/src/commands/vcs/propose.d.ts +23 -0
- package/dist/src/commands/vcs/propose.d.ts.map +1 -0
- package/dist/src/commands/vcs/propose.js +94 -0
- package/dist/src/commands/vcs/propose.js.map +1 -0
- package/dist/src/commands/vcs/review.d.ts +15 -0
- package/dist/src/commands/vcs/review.d.ts.map +1 -0
- package/dist/src/commands/vcs/review.js +35 -0
- package/dist/src/commands/vcs/review.js.map +1 -0
- package/dist/src/commands/vcs-enrich.d.ts +15 -0
- package/dist/src/commands/vcs-enrich.d.ts.map +1 -0
- package/dist/src/commands/vcs-enrich.js +28 -0
- package/dist/src/commands/vcs-enrich.js.map +1 -0
- package/dist/src/commands/vpn/index.d.ts +24 -0
- package/dist/src/commands/vpn/index.d.ts.map +1 -0
- package/dist/src/commands/vpn/index.js +543 -0
- package/dist/src/commands/vpn/index.js.map +1 -0
- package/dist/src/commands/vpn/tunnel.d.ts +11 -0
- package/dist/src/commands/vpn/tunnel.d.ts.map +1 -0
- package/dist/src/commands/vpn/tunnel.js +188 -0
- package/dist/src/commands/vpn/tunnel.js.map +1 -0
- package/dist/src/commands/workflow.d.ts +24 -0
- package/dist/src/commands/workflow.d.ts.map +1 -0
- package/dist/src/commands/workflow.js +577 -0
- package/dist/src/commands/workflow.js.map +1 -0
- package/dist/src/docs/assemble.d.ts +217 -0
- package/dist/src/docs/assemble.d.ts.map +1 -0
- package/dist/src/docs/assemble.js +739 -0
- package/dist/src/docs/assemble.js.map +1 -0
- package/dist/src/docs/cli-reference.d.ts +93 -0
- package/dist/src/docs/cli-reference.d.ts.map +1 -0
- package/dist/src/docs/cli-reference.js +256 -0
- package/dist/src/docs/cli-reference.js.map +1 -0
- package/dist/src/docs/discover.d.ts +60 -0
- package/dist/src/docs/discover.d.ts.map +1 -0
- package/dist/src/docs/discover.js +233 -0
- package/dist/src/docs/discover.js.map +1 -0
- package/dist/src/docs/portal.d.ts +79 -0
- package/dist/src/docs/portal.d.ts.map +1 -0
- package/dist/src/docs/portal.js +242 -0
- package/dist/src/docs/portal.js.map +1 -0
- package/dist/src/docs/registry-docs.d.ts +43 -0
- package/dist/src/docs/registry-docs.d.ts.map +1 -0
- package/dist/src/docs/registry-docs.js +138 -0
- package/dist/src/docs/registry-docs.js.map +1 -0
- package/dist/src/docs/schema.d.ts +48 -0
- package/dist/src/docs/schema.d.ts.map +1 -0
- package/dist/src/docs/schema.js +96 -0
- package/dist/src/docs/schema.js.map +1 -0
- package/dist/src/docs/serve.d.ts +27 -0
- package/dist/src/docs/serve.d.ts.map +1 -0
- package/dist/src/docs/serve.js +102 -0
- package/dist/src/docs/serve.js.map +1 -0
- package/dist/src/docs/start.d.ts +80 -0
- package/dist/src/docs/start.d.ts.map +1 -0
- package/dist/src/docs/start.js +313 -0
- package/dist/src/docs/start.js.map +1 -0
- package/dist/src/eval/agent-eval.d.mts +14 -0
- package/dist/src/eval/agent-eval.d.mts.map +1 -0
- package/dist/src/eval/agent-eval.mjs +273 -0
- package/dist/src/eval/agent-eval.mjs.map +1 -0
- package/dist/src/index.js +624 -7
- package/dist/src/index.js.map +7 -1
- package/dist/src/program.d.ts +26 -0
- package/dist/src/program.d.ts.map +1 -0
- package/dist/src/program.js +76 -0
- package/dist/src/program.js.map +1 -0
- package/dist/src/utils/auth-preflight.d.ts +159 -0
- package/dist/src/utils/auth-preflight.d.ts.map +1 -0
- package/dist/src/utils/auth-preflight.js +298 -0
- package/dist/src/utils/auth-preflight.js.map +1 -0
- package/dist/src/utils/aws-auth.d.ts +181 -0
- package/dist/src/utils/aws-auth.d.ts.map +1 -0
- package/dist/src/utils/aws-auth.js +527 -0
- package/dist/src/utils/aws-auth.js.map +1 -0
- package/dist/src/utils/bastion.d.ts +1 -1
- package/dist/src/utils/bastion.d.ts.map +1 -1
- package/dist/src/utils/bastion.js +29 -8
- package/dist/src/utils/bastion.js.map +1 -1
- package/dist/src/utils/build-info.d.ts +33 -0
- package/dist/src/utils/build-info.d.ts.map +1 -0
- package/dist/src/utils/build-info.js +102 -0
- package/dist/src/utils/build-info.js.map +1 -0
- package/dist/src/utils/capture-history.d.ts +62 -0
- package/dist/src/utils/capture-history.d.ts.map +1 -0
- package/dist/src/utils/capture-history.js +94 -0
- package/dist/src/utils/capture-history.js.map +1 -0
- package/dist/src/utils/deploy-preflight.d.ts +52 -0
- package/dist/src/utils/deploy-preflight.d.ts.map +1 -0
- package/dist/src/utils/deploy-preflight.js +183 -0
- package/dist/src/utils/deploy-preflight.js.map +1 -0
- package/dist/src/utils/errors.d.ts +75 -0
- package/dist/src/utils/errors.d.ts.map +1 -0
- package/dist/src/utils/errors.js +106 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/first-party-contexts.d.ts +40 -0
- package/dist/src/utils/first-party-contexts.d.ts.map +1 -0
- package/dist/src/utils/first-party-contexts.js +53 -0
- package/dist/src/utils/first-party-contexts.js.map +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/kubeconfig.d.ts +62 -0
- package/dist/src/utils/kubeconfig.d.ts.map +1 -0
- package/dist/src/utils/kubeconfig.js +118 -0
- package/dist/src/utils/kubeconfig.js.map +1 -0
- package/dist/src/utils/log.d.ts +27 -1
- package/dist/src/utils/log.d.ts.map +1 -1
- package/dist/src/utils/log.js +59 -5
- package/dist/src/utils/log.js.map +1 -1
- package/dist/src/utils/pid.d.ts +47 -0
- package/dist/src/utils/pid.d.ts.map +1 -0
- package/dist/src/utils/pid.js +83 -0
- package/dist/src/utils/pid.js.map +1 -0
- package/dist/src/utils/pulumi-run.d.ts +23 -0
- package/dist/src/utils/pulumi-run.d.ts.map +1 -0
- package/dist/src/utils/pulumi-run.js +112 -0
- package/dist/src/utils/pulumi-run.js.map +1 -0
- package/dist/src/utils/pulumi.d.ts +15 -0
- package/dist/src/utils/pulumi.d.ts.map +1 -1
- package/dist/src/utils/pulumi.js +35 -0
- package/dist/src/utils/pulumi.js.map +1 -1
- package/dist/src/utils/reachability.d.ts +29 -0
- package/dist/src/utils/reachability.d.ts.map +1 -0
- package/dist/src/utils/reachability.js +81 -0
- package/dist/src/utils/reachability.js.map +1 -0
- package/dist/src/utils/recover-conversation.d.ts +154 -0
- package/dist/src/utils/recover-conversation.d.ts.map +1 -0
- package/dist/src/utils/recover-conversation.js +314 -0
- package/dist/src/utils/recover-conversation.js.map +1 -0
- package/dist/src/utils/registry-broker.d.ts +148 -0
- package/dist/src/utils/registry-broker.d.ts.map +1 -0
- package/dist/src/utils/registry-broker.js +180 -0
- package/dist/src/utils/registry-broker.js.map +1 -0
- package/dist/src/utils/socks-forward.d.ts +40 -0
- package/dist/src/utils/socks-forward.d.ts.map +1 -0
- package/dist/src/utils/socks-forward.js +97 -0
- package/dist/src/utils/socks-forward.js.map +1 -0
- package/dist/src/utils/stack-flag.d.ts +23 -0
- package/dist/src/utils/stack-flag.d.ts.map +1 -0
- package/dist/src/utils/stack-flag.js +41 -0
- package/dist/src/utils/stack-flag.js.map +1 -0
- package/dist/src/utils/tailscale-targets.d.ts +52 -0
- package/dist/src/utils/tailscale-targets.d.ts.map +1 -0
- package/dist/src/utils/tailscale-targets.js +93 -0
- package/dist/src/utils/tailscale-targets.js.map +1 -0
- package/dist/src/utils/tailscale.d.ts +277 -0
- package/dist/src/utils/tailscale.d.ts.map +1 -0
- package/dist/src/utils/tailscale.js +1007 -0
- package/dist/src/utils/tailscale.js.map +1 -0
- package/dist/src/utils/temporal-auth.d.ts +43 -0
- package/dist/src/utils/temporal-auth.d.ts.map +1 -0
- package/dist/src/utils/temporal-auth.js +176 -0
- package/dist/src/utils/temporal-auth.js.map +1 -0
- package/dist/src/utils/temporal-codec.d.ts +101 -0
- package/dist/src/utils/temporal-codec.d.ts.map +1 -0
- package/dist/src/utils/temporal-codec.js +319 -0
- package/dist/src/utils/temporal-codec.js.map +1 -0
- package/dist/src/utils/tunnel-ownership.d.ts +130 -0
- package/dist/src/utils/tunnel-ownership.d.ts.map +1 -0
- package/dist/src/utils/tunnel-ownership.js +274 -0
- package/dist/src/utils/tunnel-ownership.js.map +1 -0
- package/dist/src/utils/vpn-join.d.ts +32 -0
- package/dist/src/utils/vpn-join.d.ts.map +1 -0
- package/dist/src/utils/vpn-join.js +62 -0
- package/dist/src/utils/vpn-join.js.map +1 -0
- package/dist/src/utils/vpn.d.ts +62 -0
- package/dist/src/utils/vpn.d.ts.map +1 -0
- package/dist/src/utils/vpn.js +183 -0
- package/dist/src/utils/vpn.js.map +1 -0
- package/dist/src/utils/workflow-fingerprint.d.ts +49 -0
- package/dist/src/utils/workflow-fingerprint.d.ts.map +1 -0
- package/dist/src/utils/workflow-fingerprint.js +135 -0
- package/dist/src/utils/workflow-fingerprint.js.map +1 -0
- package/dist/src/utils/worktree-identity.d.ts +86 -0
- package/dist/src/utils/worktree-identity.d.ts.map +1 -0
- package/dist/src/utils/worktree-identity.js +164 -0
- package/dist/src/utils/worktree-identity.js.map +1 -0
- package/fragments/agents/AGENTS.md.hbs +92 -0
- package/fragments/agents/CLAUDE.md.hbs +8 -0
- package/fragments/base/Pulumi.dev.yaml.hbs +10 -0
- package/fragments/base/Pulumi.yaml.hbs +9 -0
- package/fragments/base/index.ts.hbs +107 -0
- package/fragments/base/package.json.hbs +22 -0
- package/{templates/api-web-db/api → fragments/base}/tsconfig.json +3 -4
- package/fragments/bucket/api/src/storage.ts.hbs +81 -0
- package/fragments/database/api/src/db.ts.hbs +23 -0
- package/fragments/database/prisma/schema.prisma.hbs +18 -0
- package/{templates/api-web-db → fragments/service}/api/.dockerignore +2 -0
- package/fragments/service/api/package.json.hbs +40 -0
- package/fragments/service/api/src/index.ts.hbs +58 -0
- package/{templates/api-web-db → fragments/service/api}/tsconfig.json +5 -3
- package/fragments/temporal/worker/.dockerignore +4 -0
- package/fragments/temporal/worker/Dockerfile +15 -0
- package/{templates/temporal-api-worker → fragments/temporal}/worker/package.json.hbs +3 -2
- package/fragments/temporal/worker/src/activities.ts.hbs +14 -0
- package/fragments/temporal/worker/src/worker.ts.hbs +27 -0
- package/fragments/temporal/worker/src/workflows.ts.hbs +24 -0
- package/fragments/temporal/worker/tsconfig.json +13 -0
- package/package.json +36 -22
- package/skills/core/SKILL.md +365 -0
- package/skills/pull-remote-agent-context/SKILL.md +194 -0
- package/stack/docker-compose.hub.yml +134 -0
- package/stack/docker-compose.yml +447 -0
- package/stack/hub/Dockerfile.api +18 -0
- package/stack/hub/Dockerfile.auth +10 -0
- package/stack/hub/Dockerfile.ui +10 -0
- package/stack/init/01-databases.sql +12 -0
- package/stack/observability/blackbox.yml +20 -0
- package/stack/observability/otel-collector.yaml +73 -0
- package/stack/observability/prometheus.yml +36 -0
- package/stack/observability/tempo.yaml +25 -0
- package/stack/temporal/local.yaml +44 -0
- package/templates/api-auth/AGENTS.md.hbs +16 -0
- package/templates/api-auth/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-auth/Pulumi.yaml.hbs +8 -0
- package/templates/api-auth/README.md.hbs +67 -0
- package/templates/api-auth/api/package.json.hbs +28 -0
- package/templates/api-auth/api/src/index.ts.hbs +96 -0
- package/templates/api-auth/api/src/schema.ts.hbs +35 -0
- package/templates/api-auth/api/src/seed-authz.ts.hbs +48 -0
- package/templates/api-auth/api/src/spicedb-http-provider.ts.hbs +89 -0
- package/templates/api-auth/index.ts.hbs +65 -0
- package/templates/api-auth/package.json.hbs +20 -0
- package/templates/api-auth/skills/develop/SKILL.md.hbs +32 -0
- package/templates/api-role-gating/AGENTS.md.hbs +20 -0
- package/templates/api-role-gating/Pulumi.dev.yaml.hbs +8 -0
- package/templates/api-role-gating/Pulumi.yaml.hbs +8 -0
- package/templates/api-role-gating/README.md.hbs +64 -0
- package/templates/api-role-gating/api/Dockerfile +17 -0
- package/templates/api-role-gating/api/package.json.hbs +28 -0
- package/templates/api-role-gating/api/src/authn.ts.hbs +29 -0
- package/templates/api-role-gating/api/src/authz.ts.hbs +12 -0
- package/templates/api-role-gating/api/src/main.ts.hbs +58 -0
- package/templates/api-role-gating/api/src/schema.ts.hbs +22 -0
- package/templates/api-role-gating/api/tsconfig.json +13 -0
- package/templates/api-role-gating/index.ts.hbs +107 -0
- package/templates/api-role-gating/package.json.hbs +21 -0
- package/templates/api-role-gating/skills/develop/SKILL.md.hbs +60 -0
- package/templates/api-role-gating/tsconfig.json +10 -0
- package/templates/apps-repo/README.md.hbs +24 -0
- package/templates/apps-repo/gitignore +41 -0
- package/templates/apps-repo/npmrc.hbs +7 -0
- package/templates/apps-repo/package.json.hbs +15 -0
- package/templates/apps-repo/pnpm-workspace.yaml +3 -0
- package/templates/apps-repo/tsconfig.json +18 -0
- package/templates/external-service/AGENTS.md.hbs +20 -0
- package/templates/external-service/Pulumi.dev.yaml.hbs +8 -0
- package/templates/external-service/Pulumi.yaml.hbs +8 -0
- package/templates/external-service/README.md.hbs +56 -0
- package/templates/external-service/api/Dockerfile +15 -0
- package/templates/external-service/api/package.json.hbs +25 -0
- package/templates/external-service/api/src/index.ts.hbs +81 -0
- package/templates/external-service/index.ts.hbs +82 -0
- package/templates/external-service/mocks/vendorpay/package.json.hbs +9 -0
- package/templates/external-service/mocks/vendorpay/server.mjs.hbs +61 -0
- package/templates/external-service/package.json.hbs +34 -0
- package/templates/external-service/skills/develop/SKILL.md.hbs +55 -0
- package/templates/external-service/tsconfig.json +10 -0
- package/templates/platform-repo/AGENTS.md.hbs +18 -0
- package/templates/platform-repo/README.md.hbs +38 -0
- package/templates/platform-repo/core/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/core/Pulumi.{{tenant}}-{{env}}.yaml.hbs +57 -0
- package/templates/platform-repo/core/index.ts +62 -0
- package/templates/platform-repo/core/package.json.hbs +22 -0
- package/templates/platform-repo/core/tsconfig.json +8 -0
- package/templates/platform-repo/package.json.hbs +15 -0
- package/templates/platform-repo/platform/Pulumi.yaml.hbs +12 -0
- package/templates/platform-repo/platform/Pulumi.{{tenant}}-{{env}}.yaml.hbs +59 -0
- package/templates/platform-repo/platform/index.ts +95 -0
- package/templates/platform-repo/platform/package.json.hbs +26 -0
- package/templates/platform-repo/platform/tsconfig.json +8 -0
- package/templates/platform-repo/pnpm-workspace.yaml +3 -0
- package/templates/workflow/AGENTS.md.hbs +15 -0
- package/templates/workflow/Pulumi.dev.yaml.hbs +8 -0
- package/templates/workflow/Pulumi.yaml.hbs +8 -0
- package/templates/workflow/README.md.hbs +45 -0
- package/templates/workflow/api/.dockerignore +4 -0
- package/templates/workflow/api/Dockerfile +15 -0
- package/templates/{temporal-api-worker → workflow}/api/package.json.hbs +8 -6
- package/templates/workflow/api/src/index.ts.hbs +130 -0
- package/templates/workflow/api/tsconfig.json +14 -0
- package/templates/workflow/index.ts.hbs +67 -0
- package/templates/workflow/package.json.hbs +20 -0
- package/templates/workflow/skills/develop/SKILL.md.hbs +32 -0
- package/templates/workflow/tsconfig.json +10 -0
- package/templates/workflow/worker/.dockerignore +4 -0
- package/templates/workflow/worker/Dockerfile +13 -0
- package/templates/workflow/worker/package.json.hbs +25 -0
- package/templates/workflow/worker/src/worker.ts.hbs +24 -0
- package/templates/workflow/worker/tsconfig.json +14 -0
- package/dist/src/commands/devbox.d.ts +0 -22
- package/dist/src/commands/devbox.d.ts.map +0 -1
- package/dist/src/commands/devbox.js +0 -463
- package/dist/src/commands/devbox.js.map +0 -1
- package/templates/api-web-db/api/Dockerfile +0 -16
- package/templates/api-web-db/api/package.json.hbs +0 -21
- package/templates/api-web-db/api/src/index.ts.hbs +0 -123
- package/templates/api-web-db/package.json.hbs +0 -27
- package/templates/api-web-db/sst.config.ts.hbs +0 -151
- package/templates/api-web-db/web/.dockerignore +0 -3
- package/templates/api-web-db/web/Dockerfile +0 -17
- package/templates/api-web-db/web/app/lib/db.server.ts +0 -36
- package/templates/api-web-db/web/app/root.tsx +0 -29
- package/templates/api-web-db/web/app/routes/home.tsx.hbs +0 -114
- package/templates/api-web-db/web/app/routes.ts +0 -3
- package/templates/api-web-db/web/package.json.hbs +0 -30
- package/templates/api-web-db/web/prisma/schema.prisma +0 -25
- package/templates/api-web-db/web/prisma.config.ts +0 -18
- package/templates/api-web-db/web/react-router.config.ts +0 -5
- package/templates/api-web-db/web/tsconfig.json +0 -19
- package/templates/api-web-db/web/vite.config.ts +0 -9
- package/templates/temporal-api-worker/README.md.hbs +0 -133
- package/templates/temporal-api-worker/api/src/index.ts.hbs +0 -145
- package/templates/temporal-api-worker/package.json.hbs +0 -29
- package/templates/temporal-api-worker/sst.config.ts.hbs +0 -161
- package/templates/temporal-api-worker/worker/Dockerfile +0 -11
- package/templates/temporal-api-worker/worker/src/bundle-workflows.ts +0 -38
- package/templates/temporal-api-worker/worker/src/worker.ts.hbs +0 -93
- /package/templates/{temporal-api-worker → api-auth}/api/.dockerignore +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/Dockerfile +0 -0
- /package/templates/{temporal-api-worker → api-auth}/api/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → api-auth}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker/worker → api-role-gating/api}/.dockerignore +0 -0
- /package/templates/{temporal-api-worker/worker → external-service/api}/tsconfig.json +0 -0
- /package/templates/{temporal-api-worker → workflow}/api/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/activities.ts.hbs +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/encryption-codec.ts +0 -0
- /package/templates/{temporal-api-worker → workflow}/worker/src/workflows.ts.hbs +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<!-- intent-skills:start -->
|
|
2
|
+
## Skill Loading
|
|
3
|
+
|
|
4
|
+
Before editing files for a substantial task:
|
|
5
|
+
- Run `pnpm exec intent list` from the workspace root to see available local skills.
|
|
6
|
+
- If a listed skill matches the task, run `pnpm exec intent load <package>#<skill>` before changing files.
|
|
7
|
+
- Use the loaded `SKILL.md` guidance while making the change.
|
|
8
|
+
- Monorepos: when working across packages, run the skill check from the workspace root and prefer the local skill for the package being changed.
|
|
9
|
+
- Multiple matches: prefer the most specific local skill for the package or concern you are changing; load additional skills only when the task spans multiple packages or concerns.
|
|
10
|
+
<!-- intent-skills:end -->
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync } from 'node:fs'
|
|
3
|
+
import { execFileSync } from 'node:child_process'
|
|
4
|
+
import { tmpdir } from 'node:os'
|
|
5
|
+
import { dirname, join } from 'node:path'
|
|
6
|
+
import { createHash } from 'node:crypto'
|
|
7
|
+
import { performance } from 'node:perf_hooks'
|
|
8
|
+
|
|
9
|
+
const AGENT = "claude"
|
|
10
|
+
const CATALOG_COMMAND = "pnpm exec intent list --json --no-notices"
|
|
11
|
+
const EDIT_TOOLS = new Set(["Edit","MultiEdit","NotebookEdit","Write"])
|
|
12
|
+
// MESH-2162: name the exact runnable commands, not a vague "follow the setup".
|
|
13
|
+
// An agent that hits this deny WITHOUT the SessionStart catalog in view (subagent,
|
|
14
|
+
// post-compaction, headless) otherwise has no command to run — the "guess a bare
|
|
15
|
+
// `intent`, fail, give up" loop MESH-2160 closed for the catalog. Reuse
|
|
16
|
+
// CATALOG_COMMAND so the listing invocation stays in one place.
|
|
17
|
+
const GATE_DENY_REASON = `Blocked: load matching TanStack guidance before editing. Run \`${CATALOG_COMMAND}\` to see available skills, then \`pnpm exec intent load <package>#<skill>\` for the matching one, then retry the edit. (No bare \`intent\` on PATH — use \`pnpm exec intent\`.)`
|
|
18
|
+
const INTENT_COMMAND_PATTERN = /(?:^|&&|\|\||;|\|)\s*((?:bunx\s+@tanstack\/intent(?:@latest)?)|(?:pnpm\s+exec\s+intent)|(?:pnpm\s+dlx\s+@tanstack\/intent(?:@latest)?)|(?:npx\s+@tanstack\/intent(?:@latest)?)|(?:yarn\s+dlx\s+@tanstack\/intent(?:@latest)?)|(?:intent))\s+(list|load)(?:\s+([^\s|;&]+))?/i
|
|
19
|
+
|
|
20
|
+
// LOCAL HARDENING (MESH-2020): this file started as `intent install` output, but it
|
|
21
|
+
// is committed and CLI-managed — `mesh skills sync` (and `mesh init app-tenant --fix`)
|
|
22
|
+
// overwrite it from the mesh-cli asset (libs/mesh-cli/assets/intent/intent-claude-gate.mjs
|
|
23
|
+
// in mesh-platform). Never fix one copy without the other; in mesh-platform,
|
|
24
|
+
// scripts/check-intent-hook-sync.mjs fails CI when they diverge. The gate
|
|
25
|
+
// deliberately fails OPEN — it must never block a session or an edit on a bug in
|
|
26
|
+
// the gate tooling itself. But the original blanket `catch {}` made a broken gate
|
|
27
|
+
// SILENT: it would stop enforcing with zero signal. We keep fail-open, but surface
|
|
28
|
+
// the failure on stderr so it's diagnosable.
|
|
29
|
+
try {
|
|
30
|
+
await main()
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.error(
|
|
33
|
+
`[intent-${AGENT}-gate] hook error — continuing (gate open), but enforcement/catalog may be degraded: ${err?.stack ?? err}`,
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
process.exit(0)
|
|
38
|
+
|
|
39
|
+
async function main() {
|
|
40
|
+
const event = readEventFromStdin()
|
|
41
|
+
|
|
42
|
+
if (isSessionStartEvent(event)) {
|
|
43
|
+
const additionalContext = await createSessionCatalogContext(rootForEvent(event))
|
|
44
|
+
if (additionalContext) {
|
|
45
|
+
process.stdout.write(JSON.stringify(sessionStartOutput(additionalContext)))
|
|
46
|
+
}
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const stateFile = stateFileForEvent(event)
|
|
51
|
+
const observation = observationFromEvent(event)
|
|
52
|
+
|
|
53
|
+
if (observation) {
|
|
54
|
+
appendObservation(stateFile, observation)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const toolName = event?.tool_name ?? event?.toolName
|
|
58
|
+
if (typeof toolName === 'string' && EDIT_TOOLS.has(toolName) && !hasLoad(stateFile)) {
|
|
59
|
+
process.stdout.write(JSON.stringify(denyOutput()))
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function readEventFromStdin() {
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(readFileSync(0, 'utf8'))
|
|
66
|
+
} catch {
|
|
67
|
+
return {}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function isSessionStartEvent(event) {
|
|
72
|
+
return (event?.hook_event_name ?? event?.hookEventName) === 'SessionStart'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function rootForEvent(event) {
|
|
76
|
+
return typeof event?.cwd === 'string' ? event.cwd : process.cwd()
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function createSessionCatalogContext(root) {
|
|
80
|
+
try {
|
|
81
|
+
const start = performance.now()
|
|
82
|
+
const result = readIntentList(root)
|
|
83
|
+
const durationMs = performance.now() - start
|
|
84
|
+
console.error(
|
|
85
|
+
`[intent-${AGENT}-session-catalog] listIntentSkills found ${result.skills.length} skills from ${result.packages.length} packages in ${formatDuration(durationMs)} (packageJsonReadCount=${result.debug?.scan.packageJsonReadCount ?? 'unknown'})`,
|
|
86
|
+
)
|
|
87
|
+
return formatSessionCatalog(result)
|
|
88
|
+
} catch (err) {
|
|
89
|
+
// Fail open (no catalog) but visibly — a silent empty catalog looked identical
|
|
90
|
+
// to "no skills", hiding a broken `intent list` (e.g. version skew, parse error).
|
|
91
|
+
console.error(
|
|
92
|
+
`[intent-${AGENT}-session-catalog] failed to load skill catalog, continuing without it: ${err?.message ?? err}`,
|
|
93
|
+
)
|
|
94
|
+
return ''
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function readIntentList(root) {
|
|
99
|
+
const output = execFileSync(CATALOG_COMMAND, {
|
|
100
|
+
cwd: root,
|
|
101
|
+
encoding: 'utf8',
|
|
102
|
+
env: { ...process.env, INTENT_AUDIENCE: 'agent' },
|
|
103
|
+
maxBuffer: 1024 * 1024,
|
|
104
|
+
shell: true,
|
|
105
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
106
|
+
timeout: 9000,
|
|
107
|
+
})
|
|
108
|
+
return JSON.parse(output)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function formatDuration(durationMs) {
|
|
112
|
+
return `${durationMs.toFixed(1)}ms`
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function formatSessionCatalog(result) {
|
|
116
|
+
if (!Array.isArray(result.skills) || result.skills.length === 0) return ''
|
|
117
|
+
|
|
118
|
+
return [
|
|
119
|
+
'TanStack Intent skills are available in this repository.',
|
|
120
|
+
'',
|
|
121
|
+
'Before substantial work, check whether a listed skill matches the task or package you are about to work in. If one clearly matches, load its full guidance BEFORE you reason about that package by running the exact command shown for it below (always `pnpm exec intent load ...` — there is no bare `intent` on PATH, so `intent ...`/`npx intent ...` will fail).',
|
|
122
|
+
'',
|
|
123
|
+
'If no skill clearly matches, continue normally. Do not load a skill just to improve phrasing or gather nonessential context.',
|
|
124
|
+
'',
|
|
125
|
+
'Available local Intent skills:',
|
|
126
|
+
formatSkillCatalog(result.skills),
|
|
127
|
+
formatWarnings(result),
|
|
128
|
+
]
|
|
129
|
+
.filter(Boolean)
|
|
130
|
+
.join('\n')
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function formatSkillCatalog(skills) {
|
|
134
|
+
// Render each skill as a copy-paste load command (MESH-2160). `skill.use` is the
|
|
135
|
+
// exact `<package>#<skill>` id, so agents don't have to guess the invocation — the
|
|
136
|
+
// vague "load with the Intent CLI" wording made them try a non-existent bare
|
|
137
|
+
// `intent` and give up. LOCAL CUSTOMIZATION: re-apply if you re-run `intent install`.
|
|
138
|
+
return skills
|
|
139
|
+
.map((skill) => `- \`pnpm exec intent load ${skill.use}\` — ${normalizeDescription(skill.description)}`)
|
|
140
|
+
.join('\n')
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function normalizeDescription(description) {
|
|
144
|
+
return typeof description === 'string' ? description.replace(/\s+/g, ' ').trim() : ''
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function formatWarnings(result) {
|
|
148
|
+
const warnings = [
|
|
149
|
+
...(Array.isArray(result.warnings) ? result.warnings : []),
|
|
150
|
+
...(Array.isArray(result.conflicts)
|
|
151
|
+
? result.conflicts.map(
|
|
152
|
+
(conflict) =>
|
|
153
|
+
`Version conflict for ${conflict.packageName}; using ${conflict.chosen.version}`,
|
|
154
|
+
)
|
|
155
|
+
: []),
|
|
156
|
+
]
|
|
157
|
+
|
|
158
|
+
if (warnings.length === 0) return ''
|
|
159
|
+
return `\nWarnings:\n${warnings.map((warning) => `- ${warning}`).join('\n')}`
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function sessionStartOutput(additionalContext) {
|
|
163
|
+
if (AGENT === 'copilot') {
|
|
164
|
+
return { additionalContext }
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
hookSpecificOutput: {
|
|
169
|
+
hookEventName: 'SessionStart',
|
|
170
|
+
additionalContext,
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function stateFileForEvent(event) {
|
|
176
|
+
const sessionId = typeof event?.session_id === 'string' ? event.session_id : 'unknown'
|
|
177
|
+
const cwd = typeof event?.cwd === 'string' ? event.cwd : process.cwd()
|
|
178
|
+
const key = createHash('sha256').update(AGENT + '\0' + cwd + '\0' + sessionId).digest('hex')
|
|
179
|
+
return join(tmpdir(), 'tanstack-intent-hooks', key + '.jsonl')
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function observationFromEvent(event) {
|
|
183
|
+
if (!event || typeof event !== 'object') return undefined
|
|
184
|
+
const toolName = event.tool_name ?? event.toolName
|
|
185
|
+
const toolInput = event.tool_input ?? event.toolArgs
|
|
186
|
+
if (toolName !== 'Bash') return undefined
|
|
187
|
+
const command = typeof toolInput === 'string' ? safeCommandFromString(toolInput) : commandFromObject(toolInput)
|
|
188
|
+
const parsed = parseIntentInvocation(command)
|
|
189
|
+
if (!parsed || typeof command !== 'string') return undefined
|
|
190
|
+
return { action: parsed.action, skillUse: parsed.skillUse, raw: command }
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function parseIntentInvocation(command) {
|
|
194
|
+
if (typeof command !== 'string') return undefined
|
|
195
|
+
const match = command.match(INTENT_COMMAND_PATTERN)
|
|
196
|
+
if (!match?.[1] || !match[2]) return undefined
|
|
197
|
+
const action = match[2].toLowerCase()
|
|
198
|
+
if (action !== 'list' && action !== 'load') return undefined
|
|
199
|
+
const skillUse = action === 'load' ? match[3] : undefined
|
|
200
|
+
if (action === 'load' && !skillUse) return undefined
|
|
201
|
+
return action === 'load' ? { action, skillUse } : { action }
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function commandFromObject(value) {
|
|
205
|
+
return value && typeof value === 'object' ? value.command : undefined
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function safeCommandFromString(value) {
|
|
209
|
+
try {
|
|
210
|
+
const command = commandFromObject(JSON.parse(value))
|
|
211
|
+
return typeof command === 'string' ? command : value
|
|
212
|
+
} catch {
|
|
213
|
+
return value
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function appendObservation(stateFile, observation) {
|
|
218
|
+
try {
|
|
219
|
+
mkdirSync(dirname(stateFile), { recursive: true })
|
|
220
|
+
appendFileSync(stateFile, JSON.stringify({ ts: new Date().toISOString(), ...observation }) + '\n')
|
|
221
|
+
} catch {
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function hasLoad(stateFile) {
|
|
226
|
+
if (!existsSync(stateFile)) return false
|
|
227
|
+
try {
|
|
228
|
+
return readFileSync(stateFile, 'utf8')
|
|
229
|
+
.split('\n')
|
|
230
|
+
.filter(Boolean)
|
|
231
|
+
.some((line) => {
|
|
232
|
+
try {
|
|
233
|
+
return JSON.parse(line).action === 'load'
|
|
234
|
+
} catch {
|
|
235
|
+
return false
|
|
236
|
+
}
|
|
237
|
+
})
|
|
238
|
+
} catch {
|
|
239
|
+
return false
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function denyOutput() {
|
|
244
|
+
if (AGENT === 'copilot') {
|
|
245
|
+
return { permissionDecision: 'deny', permissionDecisionReason: GATE_DENY_REASON }
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
hookSpecificOutput: {
|
|
250
|
+
hookEventName: 'PreToolUse',
|
|
251
|
+
permissionDecision: 'deny',
|
|
252
|
+
permissionDecisionReason: GATE_DENY_REASON,
|
|
253
|
+
},
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* mesh dev --local log shipper.
|
|
4
|
+
*
|
|
5
|
+
* Sits at the end of each service's launch pipeline:
|
|
6
|
+
* { <dev command>; } 2>&1 | node log-shipper.mjs
|
|
7
|
+
*
|
|
8
|
+
* - Echoes every byte to stderr untouched (the tmux pane keeps colors).
|
|
9
|
+
* - Ships ANSI-stripped lines to the local platform's OTel collector via
|
|
10
|
+
* OTLP/HTTP — the SAME ingestion path instrumented apps use, carrying the
|
|
11
|
+
* resource attributes `mesh dev` injects (OTEL_RESOURCE_ATTRIBUTES /
|
|
12
|
+
* OTEL_SERVICE_NAME), so Loki indexes k8s_namespace_name /
|
|
13
|
+
* k8s_deployment_name exactly like the in-cluster k8sattributes processor.
|
|
14
|
+
*
|
|
15
|
+
* Why not a log file tailed by the collector: host-written files cross the
|
|
16
|
+
* macOS Docker mount with stale attributes — appends can stay invisible to
|
|
17
|
+
* the in-container tailer indefinitely. OTLP over localhost has no such
|
|
18
|
+
* boundary. Shipping is best-effort: the collector being down never breaks
|
|
19
|
+
* the dev loop.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const ENDPOINT = (process.env.OTEL_EXPORTER_OTLP_ENDPOINT ?? "http://localhost:4318").replace(/\/+$/, "");
|
|
23
|
+
const FLUSH_MS = 1000;
|
|
24
|
+
const MAX_BATCH = 200;
|
|
25
|
+
|
|
26
|
+
const attributes = [];
|
|
27
|
+
for (const pair of (process.env.OTEL_RESOURCE_ATTRIBUTES ?? "").split(",")) {
|
|
28
|
+
const eq = pair.indexOf("=");
|
|
29
|
+
if (eq > 0) {
|
|
30
|
+
attributes.push({ key: pair.slice(0, eq).trim(), value: { stringValue: pair.slice(eq + 1).trim() } });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (process.env.OTEL_SERVICE_NAME) {
|
|
34
|
+
attributes.push({ key: "service.name", value: { stringValue: process.env.OTEL_SERVICE_NAME } });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const ANSI = /\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?|\x1b[=>]|\r/g;
|
|
38
|
+
|
|
39
|
+
let queue = [];
|
|
40
|
+
let flushTimer = null;
|
|
41
|
+
let flushing = Promise.resolve();
|
|
42
|
+
|
|
43
|
+
function enqueue(line) {
|
|
44
|
+
const clean = line.replace(ANSI, "");
|
|
45
|
+
if (!clean.trim()) return;
|
|
46
|
+
queue.push({ timeUnixNano: String(Date.now()) + "000000", body: { stringValue: clean } });
|
|
47
|
+
if (queue.length >= MAX_BATCH) flush();
|
|
48
|
+
else if (!flushTimer) flushTimer = setTimeout(flush, FLUSH_MS);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function flush() {
|
|
52
|
+
if (flushTimer) {
|
|
53
|
+
clearTimeout(flushTimer);
|
|
54
|
+
flushTimer = null;
|
|
55
|
+
}
|
|
56
|
+
if (queue.length === 0) return flushing;
|
|
57
|
+
const logRecords = queue;
|
|
58
|
+
queue = [];
|
|
59
|
+
const payload = JSON.stringify({
|
|
60
|
+
resourceLogs: [
|
|
61
|
+
{
|
|
62
|
+
resource: { attributes },
|
|
63
|
+
scopeLogs: [{ scope: { name: "mesh-dev-local" }, logRecords }],
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
flushing = fetch(`${ENDPOINT}/v1/logs`, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
headers: { "content-type": "application/json" },
|
|
70
|
+
body: payload,
|
|
71
|
+
signal: AbortSignal.timeout(5000),
|
|
72
|
+
}).catch(() => {
|
|
73
|
+
/* best-effort — never break the dev loop */
|
|
74
|
+
});
|
|
75
|
+
return flushing;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let buffer = "";
|
|
79
|
+
process.stdin.on("data", (chunk) => {
|
|
80
|
+
process.stderr.write(chunk); // raw passthrough → the tmux pane
|
|
81
|
+
buffer += chunk.toString("utf-8");
|
|
82
|
+
let newline;
|
|
83
|
+
while ((newline = buffer.indexOf("\n")) >= 0) {
|
|
84
|
+
enqueue(buffer.slice(0, newline));
|
|
85
|
+
buffer = buffer.slice(newline + 1);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
process.stdin.on("end", async () => {
|
|
90
|
+
if (buffer) enqueue(buffer);
|
|
91
|
+
await flush();
|
|
92
|
+
await flushing;
|
|
93
|
+
process.exit(0);
|
|
94
|
+
});
|
package/bin/mesh.mjs
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* mesh dev launcher (MESH-2261).
|
|
4
|
+
*
|
|
5
|
+
* In the monorepo this IS the package `bin`, and it ALWAYS runs the CLI from
|
|
6
|
+
* TypeScript source via tsx — so the CLI is never stale, needs no build, and
|
|
7
|
+
* `pnpm exec mesh` works even in a never-built worktree.
|
|
8
|
+
*
|
|
9
|
+
* There is NO source-vs-dist detection here: the swap is native and
|
|
10
|
+
* build-time. `scripts/build-for-publish.ts` rewrites the PUBLISHED package's
|
|
11
|
+
* `bin` to `./dist/bin/mesh.js` (mirroring how it rewrites `exports` from
|
|
12
|
+
* source→dist), so consumers run the built dist and never touch this launcher.
|
|
13
|
+
*/
|
|
14
|
+
import { execFileSync } from "node:child_process";
|
|
15
|
+
import { realpathSync } from "node:fs";
|
|
16
|
+
import { createRequire } from "node:module";
|
|
17
|
+
import { dirname, resolve } from "node:path";
|
|
18
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Node argv that runs the TypeScript entry under tsx with the workspace
|
|
22
|
+
* `source` export condition. Pure, so it can be unit-tested without spawning.
|
|
23
|
+
*
|
|
24
|
+
* `tsxImport` is an ABSOLUTE tsx loader specifier resolved relative to THIS
|
|
25
|
+
* launcher — not the bare `"tsx"`. A bare `--import tsx` resolves tsx from the
|
|
26
|
+
* process CWD, so running the launcher from a directory without tsx on its
|
|
27
|
+
* module path (e.g. `~`) fails with "Cannot find package 'tsx'". Resolving it
|
|
28
|
+
* against the launcher makes `mesh` work from any cwd.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} tsxImport absolute tsx loader (file: URL or path)
|
|
31
|
+
* @param {string} srcEntry absolute path to `bin/mesh.ts`
|
|
32
|
+
* @param {string[]} args CLI args (process.argv.slice(2))
|
|
33
|
+
*/
|
|
34
|
+
export function sourceRunArgv(tsxImport, srcEntry, args) {
|
|
35
|
+
return ["--import", tsxImport, "--conditions", "source", srcEntry, ...args];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Absolute tsx loader specifier, resolved relative to this launcher. */
|
|
39
|
+
function tsxImportSpecifier() {
|
|
40
|
+
return pathToFileURL(createRequire(import.meta.url).resolve("tsx")).href;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Run only when invoked directly (not when imported by a test). Compare
|
|
44
|
+
// REALPATHS: pnpm's `.bin/mesh` shim execs this via a symlinked path, so
|
|
45
|
+
// `process.argv[1]` (symlink) would never string-equal `import.meta.url`
|
|
46
|
+
// (realpath) — collapse both through realpath first.
|
|
47
|
+
function invokedDirectly() {
|
|
48
|
+
try {
|
|
49
|
+
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1] ?? "");
|
|
50
|
+
} catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (invokedDirectly()) {
|
|
56
|
+
const srcEntry = resolve(dirname(fileURLToPath(import.meta.url)), "mesh.ts");
|
|
57
|
+
let tsxImport;
|
|
58
|
+
try {
|
|
59
|
+
tsxImport = tsxImportSpecifier();
|
|
60
|
+
} catch {
|
|
61
|
+
process.stderr.write(
|
|
62
|
+
"mesh: could not resolve tsx. Run `pnpm install` in this workspace, then retry.\n",
|
|
63
|
+
);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
execFileSync(process.execPath, sourceRunArgv(tsxImport, srcEntry, process.argv.slice(2)), {
|
|
68
|
+
stdio: "inherit",
|
|
69
|
+
});
|
|
70
|
+
} catch (err) {
|
|
71
|
+
if (err?.signal) {
|
|
72
|
+
// The CLI died from a signal (e.g. SIGINT) → re-raise it so the exit code
|
|
73
|
+
// reflects the signal (130 on Ctrl-C) instead of a bare 1.
|
|
74
|
+
process.kill(process.pid, err.signal);
|
|
75
|
+
} else {
|
|
76
|
+
// Exited non-zero → propagate its code; spawn failure → 1.
|
|
77
|
+
process.exit(typeof err?.status === "number" ? err.status : 1);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
package/dist/bin/mesh.d.ts
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* mesh - CLI for Mesh Lab development utilities
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* mesh db psql Connect to database with psql
|
|
13
|
-
* mesh secrets exec Run command with secrets as env vars
|
|
5
|
+
* The command tree itself lives in `src/program.ts` so `mesh docs
|
|
6
|
+
* cli-reference` can walk it without running the CLI. This file is only the
|
|
7
|
+
* runner: resolve the version, build the program, parse.
|
|
8
|
+
*
|
|
9
|
+
* For the command list, run `mesh --help` or read the generated reference
|
|
10
|
+
* (`docs/portal/generated/cli-reference.md`) — a hand-maintained list in this
|
|
11
|
+
* header is exactly the kind of prose that goes stale.
|
|
14
12
|
*/
|
|
15
13
|
export {};
|
|
16
14
|
//# sourceMappingURL=mesh.d.ts.map
|
package/dist/bin/mesh.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../../bin/mesh.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"mesh.d.ts","sourceRoot":"","sources":["../../bin/mesh.ts"],"names":[],"mappings":";AACA;;;;;;;;;;GAUG"}
|