@mesh-tech/mesh-cli 0.20.1 → 0.20.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (436) hide show
  1. package/README.md +6 -5
  2. package/dist/bin/mesh.d.ts +0 -12
  3. package/dist/bin/mesh.js +99 -50
  4. package/dist/bin/mesh.js.map +2 -3
  5. package/dist/build-info.json +2 -2
  6. package/dist/src/commands/agent-api-client.d.ts +0 -70
  7. package/dist/src/commands/agent-api-client.js +0 -80
  8. package/dist/src/commands/app-check.d.ts +0 -56
  9. package/dist/src/commands/app-check.js +0 -72
  10. package/dist/src/commands/artifacts.d.ts +0 -11
  11. package/dist/src/commands/artifacts.js +0 -33
  12. package/dist/src/commands/cluster.d.ts +0 -39
  13. package/dist/src/commands/cluster.js +0 -73
  14. package/dist/src/commands/conversations.d.ts +0 -36
  15. package/dist/src/commands/conversations.js +0 -59
  16. package/dist/src/commands/create-app.d.ts +4 -88
  17. package/dist/src/commands/create-app.js +16 -155
  18. package/dist/src/commands/db/connect.d.ts +0 -7
  19. package/dist/src/commands/db/connect.js +0 -9
  20. package/dist/src/commands/db/credentials.d.ts +0 -7
  21. package/dist/src/commands/db/credentials.js +0 -10
  22. package/dist/src/commands/db/env.d.ts +0 -6
  23. package/dist/src/commands/db/env.js +0 -14
  24. package/dist/src/commands/db/exec.d.ts +0 -43
  25. package/dist/src/commands/db/exec.js +0 -69
  26. package/dist/src/commands/db/index.d.ts +0 -10
  27. package/dist/src/commands/db/index.js +0 -10
  28. package/dist/src/commands/db/psql.d.ts +0 -7
  29. package/dist/src/commands/db/psql.js +0 -18
  30. package/dist/src/commands/deploy.d.ts +0 -38
  31. package/dist/src/commands/deploy.js +1 -76
  32. package/dist/src/commands/dev-doctor.d.ts +0 -82
  33. package/dist/src/commands/dev-doctor.js +3 -132
  34. package/dist/src/commands/dev-launch.d.ts +0 -52
  35. package/dist/src/commands/dev-launch.js +0 -56
  36. package/dist/src/commands/dev-token-server.d.ts +0 -18
  37. package/dist/src/commands/dev-token-server.js +1 -24
  38. package/dist/src/commands/dev.d.ts +0 -246
  39. package/dist/src/commands/dev.js +5 -963
  40. package/dist/src/commands/docs.d.ts +0 -1
  41. package/dist/src/commands/docs.js +0 -12
  42. package/dist/src/commands/hub/index.d.ts +0 -60
  43. package/dist/src/commands/hub/index.js +2 -139
  44. package/dist/src/commands/init/wizard.d.ts +5 -116
  45. package/dist/src/commands/init/wizard.js +42 -110
  46. package/dist/src/commands/init.d.ts +0 -55
  47. package/dist/src/commands/init.js +0 -70
  48. package/dist/src/commands/install-shim.d.ts +0 -23
  49. package/dist/src/commands/install-shim.js +2 -29
  50. package/dist/src/commands/local/auth-provision.d.ts +0 -80
  51. package/dist/src/commands/local/auth-provision.js +0 -109
  52. package/dist/src/commands/local/dev-local.d.ts +0 -91
  53. package/dist/src/commands/local/dev-local.js +0 -147
  54. package/dist/src/commands/local/docker-runner.d.ts +0 -22
  55. package/dist/src/commands/local/docker-runner.js +2 -35
  56. package/dist/src/commands/local/helpers.d.ts +0 -14
  57. package/dist/src/commands/local/helpers.js +0 -13
  58. package/dist/src/commands/local/hub-local.d.ts +0 -96
  59. package/dist/src/commands/local/hub-local.js +0 -111
  60. package/dist/src/commands/local/index.d.ts +0 -14
  61. package/dist/src/commands/local/index.js +0 -86
  62. package/dist/src/commands/local/mocks.d.ts +0 -269
  63. package/dist/src/commands/local/mocks.js +1 -274
  64. package/dist/src/commands/local/seed-hub-catalog.d.ts +0 -25
  65. package/dist/src/commands/local/seed-hub-catalog.js +0 -41
  66. package/dist/src/commands/local/seed-zitadel.d.ts +0 -82
  67. package/dist/src/commands/local/seed-zitadel.js +0 -158
  68. package/dist/src/commands/local/seed.d.ts +0 -64
  69. package/dist/src/commands/local/seed.js +0 -78
  70. package/dist/src/commands/local/stack.d.ts +0 -141
  71. package/dist/src/commands/local/stack.js +0 -153
  72. package/dist/src/commands/login.d.ts +0 -265
  73. package/dist/src/commands/login.js +4 -418
  74. package/dist/src/commands/peer-addressing.d.ts +0 -39
  75. package/dist/src/commands/peer-addressing.js +0 -37
  76. package/dist/src/commands/port-ownership.d.ts +0 -44
  77. package/dist/src/commands/port-ownership.js +0 -47
  78. package/dist/src/commands/registry-publish.d.ts +0 -1
  79. package/dist/src/commands/registry-publish.js +0 -46
  80. package/dist/src/commands/registry.d.ts +4 -237
  81. package/dist/src/commands/registry.js +2 -316
  82. package/dist/src/commands/secrets/exec.d.ts +0 -16
  83. package/dist/src/commands/secrets/exec.js +0 -24
  84. package/dist/src/commands/secrets/index.d.ts +0 -9
  85. package/dist/src/commands/secrets/index.js +0 -10
  86. package/dist/src/commands/secrets/migrate-config.d.ts +0 -17
  87. package/dist/src/commands/secrets/migrate-config.js +0 -40
  88. package/dist/src/commands/secrets/reindex.d.ts +0 -38
  89. package/dist/src/commands/secrets/reindex.js +0 -39
  90. package/dist/src/commands/secrets/set.d.ts +0 -47
  91. package/dist/src/commands/secrets/set.js +0 -107
  92. package/dist/src/commands/site.d.ts +0 -1
  93. package/dist/src/commands/site.js +0 -61
  94. package/dist/src/commands/skills.d.ts +0 -61
  95. package/dist/src/commands/skills.js +0 -83
  96. package/dist/src/commands/stack.d.ts +0 -15
  97. package/dist/src/commands/stack.js +1 -128
  98. package/dist/src/commands/temporal.d.ts +0 -30
  99. package/dist/src/commands/temporal.js.map +0 -1
  100. package/dist/src/commands/tenant.d.ts +0 -31
  101. package/dist/src/commands/tenant.js +0 -55
  102. package/dist/src/commands/tunnel/index.d.ts +0 -40
  103. package/dist/src/commands/tunnel/index.js +0 -141
  104. package/dist/src/commands/vcs/clone.d.ts +0 -1
  105. package/dist/src/commands/vcs/clone.js +0 -4
  106. package/dist/src/commands/vcs/common.d.ts +0 -32
  107. package/dist/src/commands/vcs/common.js +0 -41
  108. package/dist/src/commands/vcs/drafts.d.ts +0 -1
  109. package/dist/src/commands/vcs/drafts.js +0 -1
  110. package/dist/src/commands/vcs/get.d.ts +0 -1
  111. package/dist/src/commands/vcs/get.js +0 -11
  112. package/dist/src/commands/vcs/index.d.ts +0 -1
  113. package/dist/src/commands/vcs/index.js +0 -1
  114. package/dist/src/commands/vcs/propose.d.ts +0 -26
  115. package/dist/src/commands/vcs/propose.js +3 -34
  116. package/dist/src/commands/vcs/review.d.ts +0 -1
  117. package/dist/src/commands/vcs/review.js +0 -1
  118. package/dist/src/commands/vcs/rm.d.ts +0 -11
  119. package/dist/src/commands/vcs/rm.js +0 -14
  120. package/dist/src/commands/vcs-enrich.d.ts +0 -12
  121. package/dist/src/commands/vcs-enrich.js +0 -12
  122. package/dist/src/commands/vpn/index.d.ts +0 -17
  123. package/dist/src/commands/vpn/index.js +0 -102
  124. package/dist/src/commands/vpn/tunnel.d.ts +0 -9
  125. package/dist/src/commands/vpn/tunnel.js +0 -37
  126. package/dist/src/commands/workflow.d.ts +0 -22
  127. package/dist/src/commands/workflow.js +0 -80
  128. package/dist/src/docs/assemble.d.ts +0 -117
  129. package/dist/src/docs/assemble.js +0 -142
  130. package/dist/src/docs/cli-reference.d.ts +0 -58
  131. package/dist/src/docs/cli-reference.js +0 -77
  132. package/dist/src/docs/discover.d.ts +0 -40
  133. package/dist/src/docs/discover.js +2 -60
  134. package/dist/src/docs/portal.d.ts +0 -44
  135. package/dist/src/docs/portal.js +0 -49
  136. package/dist/src/docs/registry-docs.d.ts +0 -29
  137. package/dist/src/docs/registry-docs.js +0 -40
  138. package/dist/src/docs/schema.d.ts +0 -36
  139. package/dist/src/docs/schema.js +0 -52
  140. package/dist/src/docs/serve.d.ts +0 -18
  141. package/dist/src/docs/serve.js +2 -30
  142. package/dist/src/docs/start.d.ts +0 -42
  143. package/dist/src/docs/start.js +0 -70
  144. package/dist/src/eval/agent-eval.d.mts +0 -12
  145. package/dist/src/eval/agent-eval.mjs +0 -22
  146. package/dist/src/index.d.ts +0 -6
  147. package/dist/src/index.js.map +0 -1
  148. package/dist/src/program.d.ts +0 -20
  149. package/dist/src/program.js +0 -24
  150. package/dist/src/utils/auth-preflight.d.ts +0 -137
  151. package/dist/src/utils/auth-preflight.js +0 -149
  152. package/dist/src/utils/aws-auth.d.ts +0 -163
  153. package/dist/src/utils/aws-auth.js +3 -232
  154. package/dist/src/utils/bastion.d.ts +0 -27
  155. package/dist/src/utils/bastion.js +0 -28
  156. package/dist/src/utils/build-info.d.ts +0 -22
  157. package/dist/src/utils/build-info.js +0 -27
  158. package/dist/src/utils/cache-home.d.ts +0 -23
  159. package/dist/src/utils/cache-home.js +0 -25
  160. package/dist/src/utils/capture-history.d.ts +0 -54
  161. package/dist/src/utils/capture-history.js +1 -55
  162. package/dist/src/utils/context.d.ts +0 -23
  163. package/dist/src/utils/context.js +0 -43
  164. package/dist/src/utils/credentials.d.ts +0 -38
  165. package/dist/src/utils/credentials.js +0 -39
  166. package/dist/src/utils/deploy-preflight.d.ts +0 -38
  167. package/dist/src/utils/deploy-preflight.js +1 -71
  168. package/dist/src/utils/errors.d.ts +0 -53
  169. package/dist/src/utils/errors.js +0 -49
  170. package/dist/src/utils/first-party-contexts.d.ts +0 -38
  171. package/dist/src/utils/first-party-contexts.js +0 -44
  172. package/dist/src/utils/index.d.ts +0 -4
  173. package/dist/src/utils/index.js +0 -4
  174. package/dist/src/utils/kubeconfig.d.ts +0 -40
  175. package/dist/src/utils/kubeconfig.js +0 -44
  176. package/dist/src/utils/log.d.ts +0 -20
  177. package/dist/src/utils/log.js +0 -20
  178. package/dist/src/utils/mesh-json.d.ts +0 -46
  179. package/dist/src/utils/mesh-json.js +0 -39
  180. package/dist/src/utils/pid.d.ts +0 -42
  181. package/dist/src/utils/pid.js +0 -48
  182. package/dist/src/utils/pulumi-run.d.ts +0 -14
  183. package/dist/src/utils/pulumi-run.js +0 -42
  184. package/dist/src/utils/pulumi.d.ts +0 -34
  185. package/dist/src/utils/pulumi.js +0 -38
  186. package/dist/src/utils/reachability.d.ts +0 -27
  187. package/dist/src/utils/reachability.js +0 -40
  188. package/dist/src/utils/recover-conversation.d.ts +0 -110
  189. package/dist/src/utils/recover-conversation.js +0 -108
  190. package/dist/src/utils/registry-broker.d.ts +5 -84
  191. package/dist/src/utils/registry-broker.js +0 -62
  192. package/dist/src/utils/registry-identity.d.ts +0 -149
  193. package/dist/src/utils/registry-identity.js +0 -143
  194. package/dist/src/utils/scaffold-versions.d.ts +0 -41
  195. package/dist/src/utils/scaffold-versions.js +0 -42
  196. package/dist/src/utils/socks-forward.d.ts +0 -24
  197. package/dist/src/utils/socks-forward.js +2 -25
  198. package/dist/src/utils/stack-flag.d.ts +0 -13
  199. package/dist/src/utils/stack-flag.js +0 -21
  200. package/dist/src/utils/tailscale-targets.d.ts +0 -37
  201. package/dist/src/utils/tailscale-targets.js +0 -33
  202. package/dist/src/utils/tailscale.d.ts +0 -177
  203. package/dist/src/utils/tailscale.js +6 -337
  204. package/dist/src/utils/temporal-auth.d.ts +0 -41
  205. package/dist/src/utils/temporal-auth.js +0 -52
  206. package/dist/src/utils/temporal-codec.d.ts +0 -89
  207. package/dist/src/utils/temporal-codec.js.map +0 -1
  208. package/dist/src/utils/tunnel-ownership.d.ts +0 -79
  209. package/dist/src/utils/tunnel-ownership.js +0 -74
  210. package/dist/src/utils/vpn-join.d.ts +0 -16
  211. package/dist/src/utils/vpn-join.js +0 -17
  212. package/dist/src/utils/vpn.d.ts +0 -42
  213. package/dist/src/utils/vpn.js +0 -52
  214. package/dist/src/utils/workflow-fingerprint.d.ts +0 -39
  215. package/dist/src/utils/workflow-fingerprint.js +1 -63
  216. package/dist/src/utils/worktree-identity.d.ts +0 -62
  217. package/dist/src/utils/worktree-identity.js +0 -88
  218. package/package.json +1 -1
  219. package/skills/core/SKILL.md +10 -11
  220. package/templates/api-auth/api/src/index.ts.hbs +1 -1
  221. package/templates/api-auth/api/src/spicedb-http-provider.ts.hbs +2 -2
  222. package/templates/api-role-gating/api/src/authn.ts.hbs +2 -2
  223. package/templates/api-role-gating/index.ts.hbs +1 -1
  224. package/templates/api-role-gating/skills/develop/SKILL.md.hbs +1 -1
  225. package/templates/platform-repo/core/Pulumi.{{tenant}}-{{env}}.yaml.hbs +2 -2
  226. package/templates/platform-repo/platform/index.ts +1 -1
  227. package/dist/bin/mesh.d.ts.map +0 -1
  228. package/dist/src/commands/agent-api-client.d.ts.map +0 -1
  229. package/dist/src/commands/agent-api-client.js.map +0 -1
  230. package/dist/src/commands/app-check.d.ts.map +0 -1
  231. package/dist/src/commands/app-check.js.map +0 -1
  232. package/dist/src/commands/artifacts.d.ts.map +0 -1
  233. package/dist/src/commands/artifacts.js.map +0 -1
  234. package/dist/src/commands/cluster.d.ts.map +0 -1
  235. package/dist/src/commands/cluster.js.map +0 -1
  236. package/dist/src/commands/conversations.d.ts.map +0 -1
  237. package/dist/src/commands/conversations.js.map +0 -1
  238. package/dist/src/commands/create-app.d.ts.map +0 -1
  239. package/dist/src/commands/create-app.js.map +0 -1
  240. package/dist/src/commands/db/connect.d.ts.map +0 -1
  241. package/dist/src/commands/db/connect.js.map +0 -1
  242. package/dist/src/commands/db/credentials.d.ts.map +0 -1
  243. package/dist/src/commands/db/credentials.js.map +0 -1
  244. package/dist/src/commands/db/env.d.ts.map +0 -1
  245. package/dist/src/commands/db/env.js.map +0 -1
  246. package/dist/src/commands/db/exec.d.ts.map +0 -1
  247. package/dist/src/commands/db/exec.js.map +0 -1
  248. package/dist/src/commands/db/index.d.ts.map +0 -1
  249. package/dist/src/commands/db/index.js.map +0 -1
  250. package/dist/src/commands/db/psql.d.ts.map +0 -1
  251. package/dist/src/commands/db/psql.js.map +0 -1
  252. package/dist/src/commands/deploy.d.ts.map +0 -1
  253. package/dist/src/commands/deploy.js.map +0 -1
  254. package/dist/src/commands/dev-doctor.d.ts.map +0 -1
  255. package/dist/src/commands/dev-doctor.js.map +0 -1
  256. package/dist/src/commands/dev-launch.d.ts.map +0 -1
  257. package/dist/src/commands/dev-launch.js.map +0 -1
  258. package/dist/src/commands/dev-token-server.d.ts.map +0 -1
  259. package/dist/src/commands/dev-token-server.js.map +0 -1
  260. package/dist/src/commands/dev.d.ts.map +0 -1
  261. package/dist/src/commands/dev.js.map +0 -1
  262. package/dist/src/commands/docs.d.ts.map +0 -1
  263. package/dist/src/commands/docs.js.map +0 -1
  264. package/dist/src/commands/hub/index.d.ts.map +0 -1
  265. package/dist/src/commands/hub/index.js.map +0 -1
  266. package/dist/src/commands/init/wizard.d.ts.map +0 -1
  267. package/dist/src/commands/init/wizard.js.map +0 -1
  268. package/dist/src/commands/init.d.ts.map +0 -1
  269. package/dist/src/commands/init.js.map +0 -1
  270. package/dist/src/commands/install-shim.d.ts.map +0 -1
  271. package/dist/src/commands/install-shim.js.map +0 -1
  272. package/dist/src/commands/local/auth-provision.d.ts.map +0 -1
  273. package/dist/src/commands/local/auth-provision.js.map +0 -1
  274. package/dist/src/commands/local/dev-local.d.ts.map +0 -1
  275. package/dist/src/commands/local/dev-local.js.map +0 -1
  276. package/dist/src/commands/local/docker-runner.d.ts.map +0 -1
  277. package/dist/src/commands/local/docker-runner.js.map +0 -1
  278. package/dist/src/commands/local/helpers.d.ts.map +0 -1
  279. package/dist/src/commands/local/helpers.js.map +0 -1
  280. package/dist/src/commands/local/hub-local.d.ts.map +0 -1
  281. package/dist/src/commands/local/hub-local.js.map +0 -1
  282. package/dist/src/commands/local/index.d.ts.map +0 -1
  283. package/dist/src/commands/local/index.js.map +0 -1
  284. package/dist/src/commands/local/mocks.d.ts.map +0 -1
  285. package/dist/src/commands/local/mocks.js.map +0 -1
  286. package/dist/src/commands/local/seed-hub-catalog.d.ts.map +0 -1
  287. package/dist/src/commands/local/seed-hub-catalog.js.map +0 -1
  288. package/dist/src/commands/local/seed-zitadel.d.ts.map +0 -1
  289. package/dist/src/commands/local/seed-zitadel.js.map +0 -1
  290. package/dist/src/commands/local/seed.d.ts.map +0 -1
  291. package/dist/src/commands/local/seed.js.map +0 -1
  292. package/dist/src/commands/local/stack.d.ts.map +0 -1
  293. package/dist/src/commands/local/stack.js.map +0 -1
  294. package/dist/src/commands/login.d.ts.map +0 -1
  295. package/dist/src/commands/login.js.map +0 -1
  296. package/dist/src/commands/peer-addressing.d.ts.map +0 -1
  297. package/dist/src/commands/peer-addressing.js.map +0 -1
  298. package/dist/src/commands/port-ownership.d.ts.map +0 -1
  299. package/dist/src/commands/port-ownership.js.map +0 -1
  300. package/dist/src/commands/registry-publish.d.ts.map +0 -1
  301. package/dist/src/commands/registry-publish.js.map +0 -1
  302. package/dist/src/commands/registry.d.ts.map +0 -1
  303. package/dist/src/commands/registry.js.map +0 -1
  304. package/dist/src/commands/secrets/exec.d.ts.map +0 -1
  305. package/dist/src/commands/secrets/exec.js.map +0 -1
  306. package/dist/src/commands/secrets/index.d.ts.map +0 -1
  307. package/dist/src/commands/secrets/index.js.map +0 -1
  308. package/dist/src/commands/secrets/migrate-config.d.ts.map +0 -1
  309. package/dist/src/commands/secrets/migrate-config.js.map +0 -1
  310. package/dist/src/commands/secrets/reindex.d.ts.map +0 -1
  311. package/dist/src/commands/secrets/reindex.js.map +0 -1
  312. package/dist/src/commands/secrets/set.d.ts.map +0 -1
  313. package/dist/src/commands/secrets/set.js.map +0 -1
  314. package/dist/src/commands/site.d.ts.map +0 -1
  315. package/dist/src/commands/site.js.map +0 -1
  316. package/dist/src/commands/skills.d.ts.map +0 -1
  317. package/dist/src/commands/skills.js.map +0 -1
  318. package/dist/src/commands/stack.d.ts.map +0 -1
  319. package/dist/src/commands/stack.js.map +0 -1
  320. package/dist/src/commands/temporal.d.ts.map +0 -1
  321. package/dist/src/commands/tenant.d.ts.map +0 -1
  322. package/dist/src/commands/tenant.js.map +0 -1
  323. package/dist/src/commands/tunnel/index.d.ts.map +0 -1
  324. package/dist/src/commands/tunnel/index.js.map +0 -1
  325. package/dist/src/commands/vcs/clone.d.ts.map +0 -1
  326. package/dist/src/commands/vcs/clone.js.map +0 -1
  327. package/dist/src/commands/vcs/common.d.ts.map +0 -1
  328. package/dist/src/commands/vcs/common.js.map +0 -1
  329. package/dist/src/commands/vcs/drafts.d.ts.map +0 -1
  330. package/dist/src/commands/vcs/drafts.js.map +0 -1
  331. package/dist/src/commands/vcs/get.d.ts.map +0 -1
  332. package/dist/src/commands/vcs/get.js.map +0 -1
  333. package/dist/src/commands/vcs/index.d.ts.map +0 -1
  334. package/dist/src/commands/vcs/index.js.map +0 -1
  335. package/dist/src/commands/vcs/propose.d.ts.map +0 -1
  336. package/dist/src/commands/vcs/propose.js.map +0 -1
  337. package/dist/src/commands/vcs/review.d.ts.map +0 -1
  338. package/dist/src/commands/vcs/review.js.map +0 -1
  339. package/dist/src/commands/vcs/rm.d.ts.map +0 -1
  340. package/dist/src/commands/vcs/rm.js.map +0 -1
  341. package/dist/src/commands/vcs-enrich.d.ts.map +0 -1
  342. package/dist/src/commands/vcs-enrich.js.map +0 -1
  343. package/dist/src/commands/vpn/index.d.ts.map +0 -1
  344. package/dist/src/commands/vpn/index.js.map +0 -1
  345. package/dist/src/commands/vpn/tunnel.d.ts.map +0 -1
  346. package/dist/src/commands/vpn/tunnel.js.map +0 -1
  347. package/dist/src/commands/workflow.d.ts.map +0 -1
  348. package/dist/src/commands/workflow.js.map +0 -1
  349. package/dist/src/docs/assemble.d.ts.map +0 -1
  350. package/dist/src/docs/assemble.js.map +0 -1
  351. package/dist/src/docs/cli-reference.d.ts.map +0 -1
  352. package/dist/src/docs/cli-reference.js.map +0 -1
  353. package/dist/src/docs/discover.d.ts.map +0 -1
  354. package/dist/src/docs/discover.js.map +0 -1
  355. package/dist/src/docs/portal.d.ts.map +0 -1
  356. package/dist/src/docs/portal.js.map +0 -1
  357. package/dist/src/docs/registry-docs.d.ts.map +0 -1
  358. package/dist/src/docs/registry-docs.js.map +0 -1
  359. package/dist/src/docs/schema.d.ts.map +0 -1
  360. package/dist/src/docs/schema.js.map +0 -1
  361. package/dist/src/docs/serve.d.ts.map +0 -1
  362. package/dist/src/docs/serve.js.map +0 -1
  363. package/dist/src/docs/start.d.ts.map +0 -1
  364. package/dist/src/docs/start.js.map +0 -1
  365. package/dist/src/eval/agent-eval.d.mts.map +0 -1
  366. package/dist/src/eval/agent-eval.mjs.map +0 -1
  367. package/dist/src/index.d.ts.map +0 -1
  368. package/dist/src/program.d.ts.map +0 -1
  369. package/dist/src/program.js.map +0 -1
  370. package/dist/src/utils/auth-preflight.d.ts.map +0 -1
  371. package/dist/src/utils/auth-preflight.js.map +0 -1
  372. package/dist/src/utils/aws-auth.d.ts.map +0 -1
  373. package/dist/src/utils/aws-auth.js.map +0 -1
  374. package/dist/src/utils/bastion.d.ts.map +0 -1
  375. package/dist/src/utils/bastion.js.map +0 -1
  376. package/dist/src/utils/build-info.d.ts.map +0 -1
  377. package/dist/src/utils/build-info.js.map +0 -1
  378. package/dist/src/utils/cache-home.d.ts.map +0 -1
  379. package/dist/src/utils/cache-home.js.map +0 -1
  380. package/dist/src/utils/capture-history.d.ts.map +0 -1
  381. package/dist/src/utils/capture-history.js.map +0 -1
  382. package/dist/src/utils/context.d.ts.map +0 -1
  383. package/dist/src/utils/context.js.map +0 -1
  384. package/dist/src/utils/credentials.d.ts.map +0 -1
  385. package/dist/src/utils/credentials.js.map +0 -1
  386. package/dist/src/utils/deploy-preflight.d.ts.map +0 -1
  387. package/dist/src/utils/deploy-preflight.js.map +0 -1
  388. package/dist/src/utils/errors.d.ts.map +0 -1
  389. package/dist/src/utils/errors.js.map +0 -1
  390. package/dist/src/utils/first-party-contexts.d.ts.map +0 -1
  391. package/dist/src/utils/first-party-contexts.js.map +0 -1
  392. package/dist/src/utils/index.d.ts.map +0 -1
  393. package/dist/src/utils/index.js.map +0 -1
  394. package/dist/src/utils/kubeconfig.d.ts.map +0 -1
  395. package/dist/src/utils/kubeconfig.js.map +0 -1
  396. package/dist/src/utils/log.d.ts.map +0 -1
  397. package/dist/src/utils/log.js.map +0 -1
  398. package/dist/src/utils/mesh-json.d.ts.map +0 -1
  399. package/dist/src/utils/mesh-json.js.map +0 -1
  400. package/dist/src/utils/pid.d.ts.map +0 -1
  401. package/dist/src/utils/pid.js.map +0 -1
  402. package/dist/src/utils/pulumi-run.d.ts.map +0 -1
  403. package/dist/src/utils/pulumi-run.js.map +0 -1
  404. package/dist/src/utils/pulumi.d.ts.map +0 -1
  405. package/dist/src/utils/pulumi.js.map +0 -1
  406. package/dist/src/utils/reachability.d.ts.map +0 -1
  407. package/dist/src/utils/reachability.js.map +0 -1
  408. package/dist/src/utils/recover-conversation.d.ts.map +0 -1
  409. package/dist/src/utils/recover-conversation.js.map +0 -1
  410. package/dist/src/utils/registry-broker.d.ts.map +0 -1
  411. package/dist/src/utils/registry-broker.js.map +0 -1
  412. package/dist/src/utils/registry-identity.d.ts.map +0 -1
  413. package/dist/src/utils/registry-identity.js.map +0 -1
  414. package/dist/src/utils/scaffold-versions.d.ts.map +0 -1
  415. package/dist/src/utils/scaffold-versions.js.map +0 -1
  416. package/dist/src/utils/socks-forward.d.ts.map +0 -1
  417. package/dist/src/utils/socks-forward.js.map +0 -1
  418. package/dist/src/utils/stack-flag.d.ts.map +0 -1
  419. package/dist/src/utils/stack-flag.js.map +0 -1
  420. package/dist/src/utils/tailscale-targets.d.ts.map +0 -1
  421. package/dist/src/utils/tailscale-targets.js.map +0 -1
  422. package/dist/src/utils/tailscale.d.ts.map +0 -1
  423. package/dist/src/utils/tailscale.js.map +0 -1
  424. package/dist/src/utils/temporal-auth.d.ts.map +0 -1
  425. package/dist/src/utils/temporal-auth.js.map +0 -1
  426. package/dist/src/utils/temporal-codec.d.ts.map +0 -1
  427. package/dist/src/utils/tunnel-ownership.d.ts.map +0 -1
  428. package/dist/src/utils/tunnel-ownership.js.map +0 -1
  429. package/dist/src/utils/vpn-join.d.ts.map +0 -1
  430. package/dist/src/utils/vpn-join.js.map +0 -1
  431. package/dist/src/utils/vpn.d.ts.map +0 -1
  432. package/dist/src/utils/vpn.js.map +0 -1
  433. package/dist/src/utils/workflow-fingerprint.d.ts.map +0 -1
  434. package/dist/src/utils/workflow-fingerprint.js.map +0 -1
  435. package/dist/src/utils/worktree-identity.d.ts.map +0 -1
  436. package/dist/src/utils/worktree-identity.js.map +0 -1
@@ -1,14 +1,3 @@
1
- /**
2
- * Shared AWS credential resolution for mesh CLI commands.
3
- *
4
- * Three-tier resolution:
5
- * 1. Existing AWS credentials in environment (CI/CD) → use directly
6
- * 2. Zitadel JWT via `mesh login` → AssumeRoleWithWebIdentity
7
- * 3. Fallback → AssumeRole via current AWS session (SSO)
8
- *
9
- * Uses @aws-sdk/client-sts directly — does NOT shell out to the `aws` CLI
10
- * binary, so the binary is not a runtime requirement.
11
- */
12
1
  import * as fs from "fs";
13
2
  import * as path from "path";
14
3
  import { AssumeRoleCommand, AssumeRoleWithWebIdentityCommand, GetCallerIdentityCommand, STSClient, } from "@aws-sdk/client-sts";
@@ -16,21 +5,11 @@ import { logInfo, logSuccess, logWarn } from "./log.js";
16
5
  import { isExpiredAwsTokenMessage, SSO_LOGIN_FIX } from "./auth-preflight.js";
17
6
  import { ensureLogin } from "../commands/login.js";
18
7
  const DEFAULT_REGION = process.env.AWS_REGION ?? process.env.AWS_DEFAULT_REGION ?? "us-east-2";
19
- /**
20
- * Derive the platform context key (e.g., "mesh.dev") from a Pulumi stack config.
21
- *
22
- * Reads `mesh:platform` from Pulumi.<stack>.yaml. Supports both formats:
23
- * mesh:platform: '{"env":"dev","name":"mesh"}' → "mesh.dev"
24
- * mesh:platform:
25
- * name: mesh
26
- * env: dev → "mesh.dev"
27
- */
28
8
  export function derivePlatformContext(appRoot, stack) {
29
9
  const configFile = path.join(appRoot, `Pulumi.${stack}.yaml`);
30
10
  if (!fs.existsSync(configFile))
31
11
  return null;
32
12
  const content = fs.readFileSync(configFile, "utf-8");
33
- // Try JSON-encoded string first
34
13
  const jsonMatch = content.match(/mesh:platform:\s*'(\{[^']+\})'/);
35
14
  if (jsonMatch) {
36
15
  try {
@@ -39,10 +18,8 @@ export function derivePlatformContext(appRoot, stack) {
39
18
  return `${parsed.name}.${parsed.env}`;
40
19
  }
41
20
  catch {
42
- // fall through
43
21
  }
44
22
  }
45
- // Try YAML block format
46
23
  const nameMatch = content.match(/mesh:platform:[\s\S]*?name:\s*(\S+)/);
47
24
  const envMatch = content.match(/mesh:platform:[\s\S]*?env:\s*(\S+)/);
48
25
  if (nameMatch && envMatch) {
@@ -50,38 +27,13 @@ export function derivePlatformContext(appRoot, stack) {
50
27
  }
51
28
  return null;
52
29
  }
53
- /**
54
- * Quote a `credential_process` command token for AWS config-file syntax: the
55
- * AWS SDK/CLI split the value on spaces, honoring double quotes — so any
56
- * token containing whitespace (e.g. a mesh binary under "Application
57
- * Support") must be wrapped in double quotes or the command is mis-split.
58
- * Tokens without whitespace are left bare (byte-identical to the historic
59
- * output).
60
- */
61
30
  function quoteCredProcessToken(token) {
62
31
  return /\s/.test(token) ? `"${token}"` : token;
63
32
  }
64
- /**
65
- * Resolve a STABLE absolute path to the running `mesh` entrypoint for
66
- * embedding in a `credential_process` line — or fall back to plain `mesh`
67
- * (PATH lookup) when `argv1` is missing, doesn't exist on disk, or lives in
68
- * a transient location (`npx` cache / OS temp dir): a profile pointing at a
69
- * path that evaporates breaks every later AWS call with a cryptic
70
- * credential_process error. The fallback is announced via `logWarn` so the
71
- * user knows to install mesh-cli globally.
72
- */
73
33
  export function resolveStableMeshBin(argv1, deps = {}) {
74
34
  const exists = deps.exists ?? fs.existsSync;
75
35
  const warn = deps.warn ?? logWarn;
76
36
  let resolved = argv1 ? path.resolve(argv1) : undefined;
77
- // Under the source launcher the CLI process's argv[1] is a TypeScript entry
78
- // (bin/mesh.ts), which plain node cannot execute (type-stripped .js-suffixed
79
- // imports fail with ERR_MODULE_NOT_FOUND). Point the profile at the sibling
80
- // .mjs launcher instead — it bootstraps tsx itself, from any cwd/env. Keyed on
81
- // the `.ts` extension + a derived sibling (not the literal `mesh.ts`), so a
82
- // rename of the source entry doesn't silently revert to a broken value. Assign
83
- // unconditionally: if the sibling is absent the existing !exists guard below
84
- // reports it by name (rather than collapsing into the "argv1 missing" branch).
85
37
  if (resolved && /\.ts$/.test(resolved)) {
86
38
  resolved = path.join(path.dirname(resolved), path.basename(resolved, ".ts") + ".mjs");
87
39
  }
@@ -95,18 +47,6 @@ export function resolveStableMeshBin(argv1, deps = {}) {
95
47
  }
96
48
  return resolved;
97
49
  }
98
- /**
99
- * Render an AWS config-file `[profile …]` block whose `credential_process`
100
- * re-invokes `mesh login … --credential-process`, so the AWS SDK's default
101
- * provider chain auto-refreshes the underlying STS triple (the `mesh login`
102
- * process re-issues the Zitadel token as needed).
103
- *
104
- * Shared by `mesh dev` (child services) and `mesh login --export` so both
105
- * produce byte-identical profiles. Pure — no I/O. The `region` line is
106
- * emitted only when `region` is a non-empty string. Includes a trailing
107
- * newline. The binary path and role ARN are double-quoted when they contain
108
- * whitespace (AWS config command-splitting rules).
109
- */
110
50
  export function renderCredentialProcessProfile(args) {
111
51
  const lines = [
112
52
  `[profile ${args.profileName}]`,
@@ -116,42 +56,23 @@ export function renderCredentialProcessProfile(args) {
116
56
  lines.push(`region = ${args.region}`);
117
57
  return lines.join("\n") + "\n";
118
58
  }
119
- // Marker lines delimiting the mesh-managed section of the user's AWS config
120
- // file. Follows the `conda init` / `nvm` managed-block convention so the
121
- // section is discoverable and safely re-writable. The START marker carries
122
- // the context (one managed section per context); the END marker is shared.
123
59
  const MANAGED_START_PREFIX = `# >>> mesh-cli managed profile `;
124
60
  const MANAGED_START = (context) => `${MANAGED_START_PREFIX}${context} >>>`;
125
61
  const MANAGED_END = `# <<< mesh-cli managed <<<`;
126
- /**
127
- * Given a managed START marker for OUR context whose matching END is missing
128
- * (orphaned — e.g. the user deleted the END line), find the index of the first
129
- * character we should NOT reclaim. Conservative by construction: because
130
- * `MANAGED_END` is a shared literal across contexts, an END found further down
131
- * may belong to ANOTHER context's healthy section — so we never scan to a
132
- * distant END or to EOF. We only reclaim the lines the mesh CLI provably
133
- * wrote (see `renderCredentialProcessProfile`): one `[profile …]` header
134
- * followed by contiguous `key = value` lines, stopping at the first blank
135
- * line, comment/marker, second profile header, or `boundIdx` (the next
136
- * managed START of any context), whichever comes first.
137
- *
138
- * @param afterStart index just past OUR START marker text (before its newline)
139
- * @param boundIdx index of the next managed START marker after ours, or -1
140
- */
141
62
  function orphanedSectionTail(existing, afterStart, boundIdx) {
142
63
  const limit = boundIdx === -1 ? existing.length : boundIdx;
143
64
  let idx = afterStart;
144
65
  if (idx >= limit || existing[idx] !== "\n")
145
66
  return Math.min(idx, limit);
146
- idx++; // consume the newline terminating our START marker line
67
+ idx++;
147
68
  let claimedHeader = false;
148
69
  while (idx < limit) {
149
70
  const nl = existing.indexOf("\n", idx);
150
71
  const lineEnd = nl === -1 || nl > limit ? limit : nl;
151
72
  const line = existing.slice(idx, lineEnd);
152
73
  const ours = claimedHeader
153
- ? /^[A-Za-z_][A-Za-z0-9_]*\s*=/.test(line) // key = value continuation
154
- : /^\[profile [^\]]+\]\s*$/.test(line); // exactly one profile header
74
+ ? /^[A-Za-z_][A-Za-z0-9_]*\s*=/.test(line)
75
+ : /^\[profile [^\]]+\]\s*$/.test(line);
155
76
  if (!ours)
156
77
  return idx;
157
78
  claimedHeader = true;
@@ -159,19 +80,6 @@ function orphanedSectionTail(existing, afterStart, boundIdx) {
159
80
  }
160
81
  return limit;
161
82
  }
162
- /**
163
- * Insert or replace the mesh-managed `[profile …]` section for `context` in
164
- * the user's AWS config content, preserving ALL other content byte-for-byte
165
- * (this is the user's real ~/.aws/config — clobbering it breaks their other
166
- * profiles). Pure — no I/O; exported for unit testing.
167
- *
168
- * - Existing managed section for this context → replaced in place.
169
- * - Orphaned START (matching END lost) → only the contiguous profile block
170
- * that is provably ours is reclaimed; other contexts' sections and user
171
- * content below are preserved (see `orphanedSectionTail`).
172
- * - No section → appended, separated by a single blank line (and a trailing
173
- * newline is added to the existing content if it lacks one).
174
- */
175
83
  export function upsertManagedAwsConfigSection(existing, context, profileBlock) {
176
84
  const body = profileBlock.endsWith("\n") ? profileBlock : profileBlock + "\n";
177
85
  const section = `${MANAGED_START(context)}\n${body}${MANAGED_END}\n`;
@@ -179,23 +87,13 @@ export function upsertManagedAwsConfigSection(existing, context, profileBlock) {
179
87
  if (startIdx !== -1) {
180
88
  const afterStart = startIdx + MANAGED_START(context).length;
181
89
  const endIdx = existing.indexOf(MANAGED_END, afterStart);
182
- // MANAGED_END is a shared literal across contexts, so the first END below
183
- // our START is only OURS if no other context's START sits in between —
184
- // otherwise that END closes the OTHER section and scanning to it would
185
- // swallow that section whole.
186
90
  const foreignIdx = existing.indexOf(MANAGED_START_PREFIX, afterStart);
187
91
  let tail;
188
92
  if (endIdx !== -1 && (foreignIdx === -1 || endIdx < foreignIdx)) {
189
- // Healthy section: replace START..END. Swallow a single trailing
190
- // newline of the old section so replacement is idempotent (the new
191
- // section brings its own).
192
93
  const tailIdx = endIdx + MANAGED_END.length;
193
94
  tail = existing[tailIdx] === "\n" ? tailIdx + 1 : tailIdx;
194
95
  }
195
96
  else {
196
- // Orphaned START (our END missing). Reclaim only the contiguous
197
- // profile block that is provably ours — never foreign sections, user
198
- // profiles below, or everything to EOF.
199
97
  tail = orphanedSectionTail(existing, afterStart, foreignIdx);
200
98
  }
201
99
  return existing.slice(0, startIdx) + section + existing.slice(tail);
@@ -205,15 +103,6 @@ export function upsertManagedAwsConfigSection(existing, context, profileBlock) {
205
103
  const sep = existing.endsWith("\n\n") ? "" : existing.endsWith("\n") ? "\n" : "\n\n";
206
104
  return existing + sep + section;
207
105
  }
208
- /**
209
- * Remove a BARE `[profile name]` block — one outside any managed section — from
210
- * AWS config content. A file written before the managed-section format carries
211
- * exactly one such block, and migrating it must not leave that block behind as a
212
- * duplicate profile. Pure; exported for unit testing.
213
- *
214
- * @example
215
- * stripBareProfile("[profile acme]\nregion = us-east-2\n", "acme"); // → ""
216
- */
217
106
  export function stripBareProfile(existing, profileName) {
218
107
  const header = `[profile ${profileName}]`;
219
108
  const lines = existing.split("\n");
@@ -243,7 +132,6 @@ export function stripBareProfile(existing, profileName) {
243
132
  function newStsClient() {
244
133
  return new STSClient({ region: DEFAULT_REGION });
245
134
  }
246
- /** Pull AWS env vars out of an STS Credentials struct; null if any field is missing. */
247
135
  function toEnv(credentials) {
248
136
  const { AccessKeyId, SecretAccessKey, SessionToken } = credentials;
249
137
  if (!AccessKeyId || !SecretAccessKey || !SessionToken)
@@ -254,10 +142,6 @@ function toEnv(credentials) {
254
142
  AWS_SESSION_TOKEN: SessionToken,
255
143
  };
256
144
  }
257
- /**
258
- * IAM rejects a DurationSeconds higher than the role's MaxSessionDuration with
259
- * a ValidationError. We detect that and fall back to a one-hour session.
260
- */
261
145
  function isMaxSessionDurationError(err) {
262
146
  if (!(err instanceof Error))
263
147
  return false;
@@ -265,7 +149,6 @@ function isMaxSessionDurationError(err) {
265
149
  return (message.includes("MaxSessionDuration") ||
266
150
  message.includes("DurationSeconds"));
267
151
  }
268
- /** Assume an IAM role via current AWS session and return credentials as env vars. */
269
152
  export async function assumeRole(roleArn, sessionName = "mesh-cli", durationSeconds = 43200) {
270
153
  const sts = newStsClient();
271
154
  for (const duration of [durationSeconds, 3600]) {
@@ -283,26 +166,16 @@ export async function assumeRole(roleArn, sessionName = "mesh-cli", durationSeco
283
166
  if (!isMaxSessionDurationError(err) || duration === 3600) {
284
167
  const message = err instanceof Error ? err.message : String(err);
285
168
  logWarn(`AssumeRole failed: ${message}`);
286
- // Name the SSO fix when the ambient session is the problem — the raw
287
- // STS error never mentions `aws sso login` (MESH-2479).
288
169
  if (isExpiredAwsTokenMessage(message)) {
289
170
  logWarn(` Your AWS SSO session looks expired or missing — refresh with: ${SSO_LOGIN_FIX}`);
290
171
  }
291
172
  return null;
292
173
  }
293
- // Retry with shorter duration
294
174
  }
295
175
  }
296
176
  return null;
297
177
  }
298
- /**
299
- * Assume role using a Zitadel JWT via AssumeRoleWithWebIdentity, returning
300
- * the full STS credential struct (including `Expiration`) rather than the
301
- * env-var shape. Used by callers that need to track/refresh expiry (e.g.
302
- * `credential_process`).
303
- */
304
178
  export async function assumeRoleCredentials(roleArn, idToken, sessionName, durationSeconds = 43200) {
305
- // STS WebIdentity does not require ambient AWS credentials — the JWT proves identity.
306
179
  const sts = newStsClient();
307
180
  for (const duration of [durationSeconds, 3600]) {
308
181
  try {
@@ -318,9 +191,6 @@ export async function assumeRoleCredentials(roleArn, idToken, sessionName, durat
318
191
  if (!env)
319
192
  return null;
320
193
  return {
321
- // `env` is a `Record<string, string>` (index-signature typed), so
322
- // `noUncheckedIndexedAccess` widens these to `string | undefined`
323
- // even though `toEnv` guarantees they're set — assert accordingly.
324
194
  AccessKeyId: env.AWS_ACCESS_KEY_ID,
325
195
  SecretAccessKey: env.AWS_SECRET_ACCESS_KEY,
326
196
  SessionToken: env.AWS_SESSION_TOKEN,
@@ -332,43 +202,20 @@ export async function assumeRoleCredentials(roleArn, idToken, sessionName, durat
332
202
  logWarn(`AssumeRoleWithWebIdentity failed: ${err instanceof Error ? err.message : String(err)}`);
333
203
  return null;
334
204
  }
335
- // Retry with shorter duration
336
205
  }
337
206
  }
338
207
  return null;
339
208
  }
340
- /** Assume role using a Zitadel JWT via AssumeRoleWithWebIdentity. */
341
209
  export async function assumeRoleWithWebIdentity(roleArn, idToken, sessionName, durationSeconds = 43200) {
342
210
  const creds = await assumeRoleCredentials(roleArn, idToken, sessionName, durationSeconds);
343
211
  if (!creds)
344
212
  return null;
345
213
  return toEnv(creds);
346
214
  }
347
- /**
348
- * Extract the `iss` claim from a JWT without ever throwing — malformed or
349
- * corrupt tokens (e.g. a damaged `~/.config/mesh/credentials.json`) yield
350
- * `undefined`. The failure-diagnostic paths use this; a decode that throws
351
- * there would crash before the diagnostic prints, which is exactly the
352
- * failure class MESH-2515 removes.
353
- */
354
215
  export function tokenIssuer(token) {
355
216
  const iss = decodeJwtPayload(token)?.iss;
356
217
  return typeof iss === "string" && iss ? iss : undefined;
357
218
  }
358
- /**
359
- * Explain an AssumeRoleWithWebIdentity failure in platform terms: which login
360
- * session (context + token issuer) tried to assume which role, in which AWS
361
- * account. STS's "web identity token could not be validated" reads like an
362
- * IAM/expiry problem, but the usual cause is a context whose issuer the role's
363
- * account simply doesn't trust — e.g. a `mesh.dev` session against a role in a
364
- * `trabian`-platform account (MESH-2515). stderr only — callers in
365
- * `--credential-process` mode must keep stdout JSON-clean.
366
- *
367
- * `format: "inline"` renders the same facts as one line, for detail fields
368
- * that get interpolated mid-sentence (the doctor/preflight cred probe). Both
369
- * forms keep the `AssumeRoleWithWebIdentity failed` prefix the doctor plan
370
- * documents as the detail capture.
371
- */
372
219
  export function describeAssumeFailure(opts, format = "block") {
373
220
  const account = /^arn:aws:iam::(\d+):/.exec(opts.roleArn)?.[1];
374
221
  const head = `AssumeRoleWithWebIdentity failed for ${opts.roleArn}` +
@@ -390,7 +237,6 @@ export function describeAssumeFailure(opts, format = "block") {
390
237
  lines.push(" If the role's account does not trust this issuer, you are logged into the", " wrong context for this stack — check `mesh:platform` in the app's Pulumi", " config and `mesh login <platform>.<env>` accordingly. (This is a context", " mismatch, not an IAM permission problem.)");
391
238
  return lines.join("\n");
392
239
  }
393
- /** Format STS credentials as AWS `credential_process` JSON (Version 1). */
394
240
  export function toCredentialProcessJson(creds) {
395
241
  return JSON.stringify({
396
242
  Version: 1,
@@ -400,16 +246,6 @@ export function toCredentialProcessJson(creds) {
400
246
  Expiration: creds.Expiration,
401
247
  });
402
248
  }
403
- /**
404
- * Ask "is there a working AWS connection right now?" — nothing more.
405
- *
406
- * Deliberately NOT `resolveAwsCredentials`: that one answers "get me credentials
407
- * for role X" and has an opinion about how they were obtained. This one runs
408
- * GetCallerIdentity through the SDK's default provider chain and reports whatever
409
- * it finds, so a static key/secret pair in `~/.aws/credentials` counts exactly as
410
- * much as an SSO session or a Zitadel-minted role. Returns null when the chain
411
- * yields nothing usable.
412
- */
413
249
  export async function probeAwsIdentity() {
414
250
  try {
415
251
  const out = await newStsClient().send(new GetCallerIdentityCommand({}));
@@ -425,12 +261,6 @@ export async function probeAwsIdentity() {
425
261
  return null;
426
262
  }
427
263
  }
428
- /**
429
- * Decode a Zitadel-issued JWT payload (no signature check — we only
430
- * use it for role-selection hints in mesh-cli; the actual STS calls
431
- * still verify against the OIDC provider). Returns null on malformed
432
- * input.
433
- */
434
264
  function decodeJwtPayload(token) {
435
265
  const parts = token.split(".");
436
266
  if (parts.length !== 3 || !parts[1])
@@ -442,25 +272,6 @@ function decodeJwtPayload(token) {
442
272
  return null;
443
273
  }
444
274
  }
445
- /**
446
- * Pick the AWS role ARN to assume based on Zitadel claims.
447
- *
448
- * Zitadel emits project roles under
449
- * `urn:zitadel:iam:org:project:<projectId>:roles` as a nested object
450
- * keyed by role name. We treat the presence of `mesh.platform:admin`
451
- * (or any role listed in `meshcli.adminRoles` in config) as the
452
- * signal to assume the broader admin role when the caller has
453
- * configured one.
454
- *
455
- * Returns `defaultRole` when no admin role is configured, no admin
456
- * claim is present, or the JWT can't be parsed. This keeps existing
457
- * deployments working without a config change.
458
- *
459
- * The admin AWS role's IAM trust policy is expected to gate
460
- * assumption on the same Zitadel claim in production (so the CLI
461
- * preference can't be spoofed). That setup is its own change — see
462
- * TODO(mesh-zitadel-aws-role-mapping).
463
- */
464
275
  export function selectRoleForCaller(idToken, options) {
465
276
  if (!options.adminRole || !idToken)
466
277
  return options.defaultRole;
@@ -473,24 +284,6 @@ export function selectRoleForCaller(idToken, options) {
473
284
  ? options.adminRole
474
285
  : options.defaultRole;
475
286
  }
476
- /**
477
- * The Zitadel project-role names a decoded token carries.
478
- *
479
- * Zitadel emits project roles under a claim whose key is either
480
- * `urn:zitadel:iam:org:project:roles` or the project-qualified
481
- * `urn:zitadel:iam:org:project:<projectId>:roles`, and whose value is
482
- * `{ "<roleKey>": { "<orgId>": "<domain>" } }` — the role name is the
483
- * TOP-LEVEL key. Unwrapping one level deeper collects org ids, which match no
484
- * role and deny every caller. A token may carry both claim shapes and roles
485
- * from several projects, so every matching key is walked and the names merged.
486
- *
487
- * @param claims A decoded JWT payload.
488
- * @returns Role names in claim order, deduplicated; empty when the token
489
- * carries no roles claim.
490
- * @example
491
- * projectRoleKeys({ "urn:zitadel:iam:org:project:roles": { "registry:read": {} } });
492
- * // → ["registry:read"]
493
- */
494
287
  export function projectRoleKeys(claims) {
495
288
  const names = new Set();
496
289
  for (const [key, value] of Object.entries(claims)) {
@@ -507,20 +300,8 @@ export function projectRoleKeys(claims) {
507
300
  }
508
301
  return [...names];
509
302
  }
510
- /**
511
- * Resolve AWS credentials using the three-tier strategy.
512
- *
513
- * @param roleArn The IAM role to assume (from mesh:deployerRole)
514
- * @param appRoot Pulumi app root directory
515
- * @param stack Pulumi stack name
516
- * @returns Resolved credentials, or null if all methods fail
517
- *
518
- * To inherit a broader role based on Zitadel claims, call
519
- * `selectRoleForCaller` first and pass the result as `roleArn`.
520
- */
521
303
  export async function resolveAwsCredentials(roleArn, appRoot, stack) {
522
304
  const roleName = roleArn.split("/").pop() ?? roleArn;
523
- // Path 1: Existing AWS credentials in environment (CI/CD)
524
305
  if (process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SESSION_TOKEN) {
525
306
  logInfo("Using existing AWS credentials from environment");
526
307
  return {
@@ -532,11 +313,6 @@ export async function resolveAwsCredentials(roleArn, appRoot, stack) {
532
313
  method: "environment",
533
314
  };
534
315
  }
535
- // Path 2: Zitadel JWT via mesh login → AssumeRoleWithWebIdentity.
536
- // Non-interactive here: only a valid CACHED session is used. An interactive
537
- // device-flow before the SSO fallback would stall headless runs (CI,
538
- // `mesh dev` with a working AWS_PROFILE) for minutes polling device codes
539
- // nobody sees — SSO gets its chance first; interactive login is Path 4.
540
316
  const platformContext = derivePlatformContext(appRoot, stack);
541
317
  if (platformContext) {
542
318
  const meshCreds = await ensureLogin(platformContext, { interactive: false });
@@ -554,16 +330,12 @@ export async function resolveAwsCredentials(roleArn, appRoot, stack) {
554
330
  ` (Try: mesh login ${platformContext})`);
555
331
  }
556
332
  }
557
- // Path 3: Fallback — AssumeRole via current AWS session (SSO)
558
333
  logInfo(`Assuming ${roleName} via AWS SSO`);
559
334
  const creds = await assumeRole(roleArn, "mesh-cli");
560
335
  if (creds) {
561
336
  logSuccess(`Assumed ${roleName}`);
562
337
  return { env: creds, method: "sso" };
563
338
  }
564
- // Path 4: Last resort — interactive Zitadel login (device/browser). Only
565
- // reached when there's no env cred, no cached session, and no working SSO,
566
- // i.e. a human at a terminal who genuinely needs to log in.
567
339
  if (platformContext && process.stdout.isTTY) {
568
340
  const meshCreds = await ensureLogin(platformContext);
569
341
  if (meshCreds) {
@@ -580,4 +352,3 @@ export async function resolveAwsCredentials(roleArn, appRoot, stack) {
580
352
  }
581
353
  return null;
582
354
  }
583
- //# sourceMappingURL=aws-auth.js.map
@@ -1,43 +1,16 @@
1
- /**
2
- * Bastion utilities for SSM tunneling to platform services
3
- */
4
- /**
5
- * Service endpoint info
6
- */
7
1
  export interface ServiceEndpoint {
8
2
  host: string;
9
3
  port: number;
10
4
  }
11
- /**
12
- * Platform bastion info from SSM
13
- */
14
5
  export interface PlatformBastionInfo {
15
6
  instanceId: string;
16
7
  securityGroupId: string;
17
8
  services: Record<string, ServiceEndpoint>;
18
9
  }
19
- /**
20
- * Legacy bastion info (for backward compatibility with db commands)
21
- */
22
10
  export interface BastionInfo {
23
11
  instanceId: string;
24
12
  rdsEndpoint: string;
25
13
  rdsPort: number;
26
14
  }
27
- /**
28
- * Get platform bastion info from SSM parameter store.
29
- *
30
- * Reads the platformBastion key from the platform export at
31
- * /mesh-platform/{tenant}/{platformEnv}/platform. Falls back to the legacy
32
- * separate parameter at /mesh-platform/{tenant}/{platformEnv}/platform-bastion
33
- * for backward compatibility.
34
- */
35
15
  export declare function getPlatformBastionInfo(tenant: string, platformEnv: string, region?: string): Promise<PlatformBastionInfo>;
36
- /**
37
- * Get bastion info from SSM parameter store (legacy format).
38
- * Reads from /mesh/{tenant}/{platformEnv}/platform-bastion and extracts RDS info.
39
- *
40
- * @deprecated Use getPlatformBastionInfo instead
41
- */
42
16
  export declare function getBastionInfo(tenant: string, platformEnv: string): Promise<BastionInfo>;
43
- //# sourceMappingURL=bastion.d.ts.map
@@ -1,24 +1,8 @@
1
- /**
2
- * Bastion utilities for SSM tunneling to platform services
3
- */
4
1
  import { SSMClient, GetParameterCommand } from "@aws-sdk/client-ssm";
5
2
  import { logInfo, logSuccess, logError } from "./log.js";
6
- /**
7
- * Get platform bastion info from SSM parameter store.
8
- *
9
- * Reads the platformBastion key from the platform export at
10
- * /mesh-platform/{tenant}/{platformEnv}/platform. Falls back to the legacy
11
- * separate parameter at /mesh-platform/{tenant}/{platformEnv}/platform-bastion
12
- * for backward compatibility.
13
- */
14
3
  export async function getPlatformBastionInfo(tenant, platformEnv, region) {
15
4
  const ssm = new SSMClient(region ? { region } : {});
16
- // Captured so the final error can distinguish a CREDS failure (the common
17
- // case — stale/expired ambient AWS creds, or creds lacking cross-tenant read
18
- // on the hub param) from a genuinely missing bastion. Without this the read
19
- // error is swallowed and every failure looks like "bastion not deployed".
20
5
  let primaryError;
21
- // Primary: read from the platform export (platformBastion is a nested key)
22
6
  const platformPath = `/mesh-platform/${tenant}/${platformEnv}/platform`;
23
7
  logInfo(`Looking up platform bastion from ${platformPath}...`);
24
8
  try {
@@ -37,11 +21,8 @@ export async function getPlatformBastionInfo(tenant, platformEnv, region) {
37
21
  }
38
22
  }
39
23
  catch (err) {
40
- // Don't swallow: keep the real reason (AccessDenied / ExpiredToken / …) so
41
- // the final error can be actionable. Then try the legacy path.
42
24
  primaryError = err;
43
25
  }
44
- // Fallback: legacy separate parameter
45
26
  const legacyPath = `/mesh-platform/${tenant}/${platformEnv}/platform-bastion`;
46
27
  logInfo(`Trying legacy path ${legacyPath}...`);
47
28
  try {
@@ -58,8 +39,6 @@ export async function getPlatformBastionInfo(tenant, platformEnv, region) {
58
39
  return info;
59
40
  }
60
41
  catch (legacyError) {
61
- // Classify on the PRIMARY read's error (the meaningful one) — the legacy
62
- // path is usually just ParameterNotFound and hides the real cause.
63
42
  const cause = primaryError ?? legacyError;
64
43
  const name = cause?.name ?? "";
65
44
  const credsProblem = /Expired|UnrecognizedClient|InvalidClientTokenId|InvalidSignature|CredentialsProviderError|AccessDenied/i.test(name);
@@ -77,12 +56,6 @@ export async function getPlatformBastionInfo(tenant, platformEnv, region) {
77
56
  throw cause;
78
57
  }
79
58
  }
80
- /**
81
- * Get bastion info from SSM parameter store (legacy format).
82
- * Reads from /mesh/{tenant}/{platformEnv}/platform-bastion and extracts RDS info.
83
- *
84
- * @deprecated Use getPlatformBastionInfo instead
85
- */
86
59
  export async function getBastionInfo(tenant, platformEnv) {
87
60
  const info = await getPlatformBastionInfo(tenant, platformEnv);
88
61
  const rdsService = info.services["rds"];
@@ -95,4 +68,3 @@ export async function getBastionInfo(tenant, platformEnv) {
95
68
  rdsPort: rdsService.port,
96
69
  };
97
70
  }
98
- //# sourceMappingURL=bastion.js.map
@@ -1,33 +1,11 @@
1
- /**
2
- * CLI provenance for `mesh --version` (MESH-2479).
3
- *
4
- * A stale shim / stale global install is invisible when --version prints only
5
- * the package version — two different checkouts (or a source tree vs a
6
- * published dist) can share "0.5.1". This resolves WHERE the running CLI
7
- * came from (TypeScript source vs published dist) plus the commit/build date,
8
- * so "am I running the code I think I am?" is answerable from one command.
9
- *
10
- * Source layout: bin/mesh.ts runs under tsx from the repo — commit/date come
11
- * from git at call time. Dist layout: the published package ships
12
- * dist/build-info.json written by scripts/build-for-publish.ts.
13
- */
14
1
  export interface CliRuntimeInfo {
15
2
  version: string;
16
3
  mode: "source" | "dist";
17
4
  commit?: string;
18
5
  builtAt?: string;
19
6
  }
20
- /** Pure: a module path under a `dist/` segment is the published build. */
21
7
  export declare function detectRuntimeMode(modulePath: string): "source" | "dist";
22
- /** Pure: one-line version string with provenance, e.g.
23
- * `0.5.1 (source @ abc1234 2026-07-30)` or
24
- * `0.5.1 (published build 2026-07-28, commit abc1234)`. */
25
8
  export declare function formatVersionLine(info: CliRuntimeInfo): string;
26
- /** Resolve the running CLI's version + provenance. Never throws.
27
- * `vcs: false` skips the git spawns in source mode (version + mode only) —
28
- * commit/date cost two synchronous `git` runs, too slow to pay on every
29
- * invocation when nothing will print them. */
30
9
  export declare function resolveCliRuntime(opts?: {
31
10
  vcs?: boolean;
32
11
  }): CliRuntimeInfo;
33
- //# sourceMappingURL=build-info.d.ts.map
@@ -1,27 +1,10 @@
1
- /**
2
- * CLI provenance for `mesh --version` (MESH-2479).
3
- *
4
- * A stale shim / stale global install is invisible when --version prints only
5
- * the package version — two different checkouts (or a source tree vs a
6
- * published dist) can share "0.5.1". This resolves WHERE the running CLI
7
- * came from (TypeScript source vs published dist) plus the commit/build date,
8
- * so "am I running the code I think I am?" is answerable from one command.
9
- *
10
- * Source layout: bin/mesh.ts runs under tsx from the repo — commit/date come
11
- * from git at call time. Dist layout: the published package ships
12
- * dist/build-info.json written by scripts/build-for-publish.ts.
13
- */
14
1
  import { execFileSync } from "child_process";
15
2
  import * as fs from "fs";
16
3
  import * as path from "path";
17
4
  import { fileURLToPath } from "url";
18
- /** Pure: a module path under a `dist/` segment is the published build. */
19
5
  export function detectRuntimeMode(modulePath) {
20
6
  return modulePath.split(/[\\/]/).includes("dist") ? "dist" : "source";
21
7
  }
22
- /** Pure: one-line version string with provenance, e.g.
23
- * `0.5.1 (source @ abc1234 2026-07-30)` or
24
- * `0.5.1 (published build 2026-07-28, commit abc1234)`. */
25
8
  export function formatVersionLine(info) {
26
9
  if (info.mode === "source") {
27
10
  const at = [info.commit, info.builtAt].filter(Boolean).join(" ");
@@ -32,7 +15,6 @@ export function formatVersionLine(info) {
32
15
  const detail = built || commit ? `${built}${commit}` : " — build metadata unavailable";
33
16
  return `${info.version} (published build${detail})`;
34
17
  }
35
- /** Walk up from `startDir` to the @mesh-tech/mesh-cli package root. */
36
18
  function findCliPackageRoot(startDir) {
37
19
  let dir = startDir;
38
20
  for (let i = 0; i < 8; i++) {
@@ -42,7 +24,6 @@ function findCliPackageRoot(startDir) {
42
24
  return dir;
43
25
  }
44
26
  catch {
45
- // keep walking
46
27
  }
47
28
  const parent = path.dirname(dir);
48
29
  if (parent === dir)
@@ -51,10 +32,6 @@ function findCliPackageRoot(startDir) {
51
32
  }
52
33
  return null;
53
34
  }
54
- /** Resolve the running CLI's version + provenance. Never throws.
55
- * `vcs: false` skips the git spawns in source mode (version + mode only) —
56
- * commit/date cost two synchronous `git` runs, too slow to pay on every
57
- * invocation when nothing will print them. */
58
35
  export function resolveCliRuntime(opts) {
59
36
  const vcs = opts?.vcs ?? true;
60
37
  const here = path.dirname(fileURLToPath(import.meta.url));
@@ -66,7 +43,6 @@ export function resolveCliRuntime(opts) {
66
43
  version = JSON.parse(fs.readFileSync(path.join(root, "package.json"), "utf-8")).version ?? version;
67
44
  }
68
45
  catch {
69
- // fall through with the placeholder
70
46
  }
71
47
  }
72
48
  const info = { version, mode };
@@ -79,7 +55,6 @@ export function resolveCliRuntime(opts) {
79
55
  info.builtAt = meta.builtAt;
80
56
  }
81
57
  catch {
82
- // pre-MESH-2479 publishes have no build-info.json
83
58
  }
84
59
  return info;
85
60
  }
@@ -95,8 +70,6 @@ export function resolveCliRuntime(opts) {
95
70
  info.builtAt = git(["log", "-1", "--format=%cs"]);
96
71
  }
97
72
  catch {
98
- // not a git checkout (e.g. exported source) — version + mode still print
99
73
  }
100
74
  return info;
101
75
  }
102
- //# sourceMappingURL=build-info.js.map