@nebulr-group/bridge-cli 0.6.6 → 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/README.md +98 -458
  2. package/dist/api/accounts.d.ts +105 -0
  3. package/dist/api/accounts.d.ts.map +1 -0
  4. package/dist/api/accounts.js +58 -0
  5. package/dist/api/accounts.js.map +1 -0
  6. package/dist/api/apps.d.ts +50 -0
  7. package/dist/api/apps.d.ts.map +1 -0
  8. package/dist/api/apps.js +62 -0
  9. package/dist/api/apps.js.map +1 -0
  10. package/dist/api/billing.d.ts +131 -0
  11. package/dist/api/billing.d.ts.map +1 -0
  12. package/dist/api/billing.js +42 -0
  13. package/dist/api/billing.js.map +1 -0
  14. package/dist/api/flags.d.ts +73 -0
  15. package/dist/api/flags.d.ts.map +1 -0
  16. package/dist/api/flags.js +108 -0
  17. package/dist/api/flags.js.map +1 -0
  18. package/dist/api/keys.d.ts +48 -0
  19. package/dist/api/keys.d.ts.map +1 -0
  20. package/dist/api/keys.js +87 -0
  21. package/dist/api/keys.js.map +1 -0
  22. package/dist/auth/browser-open.d.ts +21 -4
  23. package/dist/auth/browser-open.d.ts.map +1 -1
  24. package/dist/auth/browser-open.js +45 -65
  25. package/dist/auth/browser-open.js.map +1 -1
  26. package/dist/auth/lock.d.ts +8 -0
  27. package/dist/auth/lock.d.ts.map +1 -0
  28. package/dist/auth/lock.js +43 -0
  29. package/dist/auth/lock.js.map +1 -0
  30. package/dist/auth/loopback.d.ts +8 -12
  31. package/dist/auth/loopback.d.ts.map +1 -1
  32. package/dist/auth/loopback.js +40 -45
  33. package/dist/auth/loopback.js.map +1 -1
  34. package/dist/auth/session.d.ts +61 -0
  35. package/dist/auth/session.d.ts.map +1 -0
  36. package/dist/auth/session.js +142 -0
  37. package/dist/auth/session.js.map +1 -0
  38. package/dist/auth/sign-in.d.ts +67 -0
  39. package/dist/auth/sign-in.d.ts.map +1 -0
  40. package/dist/auth/sign-in.js +113 -0
  41. package/dist/auth/sign-in.js.map +1 -0
  42. package/dist/auth/store.d.ts +89 -0
  43. package/dist/auth/store.d.ts.map +1 -0
  44. package/dist/auth/store.js +214 -0
  45. package/dist/auth/store.js.map +1 -0
  46. package/dist/bin.js +0 -2
  47. package/dist/bin.js.map +1 -1
  48. package/dist/cli.d.ts +1 -2
  49. package/dist/cli.d.ts.map +1 -1
  50. package/dist/cli.js +13 -17
  51. package/dist/cli.js.map +1 -1
  52. package/dist/client.d.ts +31 -0
  53. package/dist/client.d.ts.map +1 -0
  54. package/dist/client.js +67 -0
  55. package/dist/client.js.map +1 -0
  56. package/dist/commands/accounts.command.d.ts +4 -0
  57. package/dist/commands/accounts.command.d.ts.map +1 -0
  58. package/dist/commands/accounts.command.js +166 -0
  59. package/dist/commands/accounts.command.js.map +1 -0
  60. package/dist/commands/app.command.d.ts +3 -2
  61. package/dist/commands/app.command.d.ts.map +1 -1
  62. package/dist/commands/app.command.js +132 -233
  63. package/dist/commands/app.command.js.map +1 -1
  64. package/dist/commands/auth.command.d.ts +2 -12
  65. package/dist/commands/auth.command.d.ts.map +1 -1
  66. package/dist/commands/auth.command.js +147 -20
  67. package/dist/commands/auth.command.js.map +1 -1
  68. package/dist/commands/billing.command.d.ts +4 -0
  69. package/dist/commands/billing.command.d.ts.map +1 -0
  70. package/dist/commands/billing.command.js +185 -0
  71. package/dist/commands/billing.command.js.map +1 -0
  72. package/dist/commands/check.command.d.ts +2 -1
  73. package/dist/commands/check.command.d.ts.map +1 -1
  74. package/dist/commands/check.command.js +11 -14
  75. package/dist/commands/check.command.js.map +1 -1
  76. package/dist/commands/context.d.ts +58 -0
  77. package/dist/commands/context.d.ts.map +1 -0
  78. package/dist/commands/context.js +78 -0
  79. package/dist/commands/context.js.map +1 -0
  80. package/dist/commands/flag.command.d.ts +3 -62
  81. package/dist/commands/flag.command.d.ts.map +1 -1
  82. package/dist/commands/flag.command.js +181 -864
  83. package/dist/commands/flag.command.js.map +1 -1
  84. package/dist/commands/key.command.d.ts +4 -0
  85. package/dist/commands/key.command.d.ts.map +1 -0
  86. package/dist/commands/key.command.js +44 -0
  87. package/dist/commands/key.command.js.map +1 -0
  88. package/dist/commands/plan.command.d.ts +3 -203
  89. package/dist/commands/plan.command.d.ts.map +1 -1
  90. package/dist/commands/plan.command.js +200 -759
  91. package/dist/commands/plan.command.js.map +1 -1
  92. package/dist/config.d.ts +19 -101
  93. package/dist/config.d.ts.map +1 -1
  94. package/dist/config.js +51 -364
  95. package/dist/config.js.map +1 -1
  96. package/dist/core/discovery.d.ts +27 -0
  97. package/dist/core/discovery.d.ts.map +1 -0
  98. package/dist/core/discovery.js +97 -0
  99. package/dist/core/discovery.js.map +1 -0
  100. package/dist/core/errors.d.ts +26 -0
  101. package/dist/core/errors.d.ts.map +1 -0
  102. package/dist/core/errors.js +33 -0
  103. package/dist/core/errors.js.map +1 -0
  104. package/dist/core/http.d.ts +23 -0
  105. package/dist/core/http.d.ts.map +1 -0
  106. package/dist/core/http.js +153 -0
  107. package/dist/core/http.js.map +1 -0
  108. package/dist/core/private-files.d.ts +6 -0
  109. package/dist/core/private-files.d.ts.map +1 -0
  110. package/dist/core/private-files.js +96 -0
  111. package/dist/core/private-files.js.map +1 -0
  112. package/dist/core/routes.d.ts +100 -0
  113. package/dist/core/routes.d.ts.map +1 -0
  114. package/dist/core/routes.js +99 -0
  115. package/dist/core/routes.js.map +1 -0
  116. package/dist/core/urls.d.ts +15 -0
  117. package/dist/core/urls.d.ts.map +1 -0
  118. package/dist/core/urls.js +55 -0
  119. package/dist/core/urls.js.map +1 -0
  120. package/dist/gate-rules.d.ts +1 -2
  121. package/dist/gate-rules.d.ts.map +1 -1
  122. package/dist/gate-rules.js +4 -5
  123. package/dist/gate-rules.js.map +1 -1
  124. package/dist/index.d.ts +24 -3
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +18 -3
  127. package/dist/index.js.map +1 -1
  128. package/dist/io.d.ts +21 -0
  129. package/dist/io.d.ts.map +1 -0
  130. package/dist/io.js +59 -0
  131. package/dist/io.js.map +1 -0
  132. package/dist/money.d.ts +42 -0
  133. package/dist/money.d.ts.map +1 -0
  134. package/dist/money.js +112 -0
  135. package/dist/money.js.map +1 -0
  136. package/dist/program.d.ts +5 -24
  137. package/dist/program.d.ts.map +1 -1
  138. package/dist/program.js +25 -113
  139. package/dist/program.js.map +1 -1
  140. package/package.json +7 -8
  141. package/dist/auth/api-client.d.ts +0 -50
  142. package/dist/auth/api-client.d.ts.map +0 -1
  143. package/dist/auth/api-client.js +0 -109
  144. package/dist/auth/api-client.js.map +0 -1
  145. package/dist/auth/relative-time.d.ts +0 -2
  146. package/dist/auth/relative-time.d.ts.map +0 -1
  147. package/dist/auth/relative-time.js +0 -27
  148. package/dist/auth/relative-time.js.map +0 -1
  149. package/dist/auth/scopes.d.ts +0 -30
  150. package/dist/auth/scopes.d.ts.map +0 -1
  151. package/dist/auth/scopes.js +0 -39
  152. package/dist/auth/scopes.js.map +0 -1
  153. package/dist/auth/workspace-client.d.ts +0 -70
  154. package/dist/auth/workspace-client.d.ts.map +0 -1
  155. package/dist/auth/workspace-client.js +0 -105
  156. package/dist/auth/workspace-client.js.map +0 -1
  157. package/dist/commands/auth/config.command.d.ts +0 -8
  158. package/dist/commands/auth/config.command.d.ts.map +0 -1
  159. package/dist/commands/auth/config.command.js +0 -60
  160. package/dist/commands/auth/config.command.js.map +0 -1
  161. package/dist/commands/auth/login.command.d.ts +0 -46
  162. package/dist/commands/auth/login.command.d.ts.map +0 -1
  163. package/dist/commands/auth/login.command.js +0 -166
  164. package/dist/commands/auth/login.command.js.map +0 -1
  165. package/dist/commands/auth/logout.command.d.ts +0 -21
  166. package/dist/commands/auth/logout.command.d.ts.map +0 -1
  167. package/dist/commands/auth/logout.command.js +0 -97
  168. package/dist/commands/auth/logout.command.js.map +0 -1
  169. package/dist/commands/auth/methods.command.d.ts +0 -68
  170. package/dist/commands/auth/methods.command.d.ts.map +0 -1
  171. package/dist/commands/auth/methods.command.js +0 -91
  172. package/dist/commands/auth/methods.command.js.map +0 -1
  173. package/dist/commands/auth/status.command.d.ts +0 -18
  174. package/dist/commands/auth/status.command.d.ts.map +0 -1
  175. package/dist/commands/auth/status.command.js +0 -104
  176. package/dist/commands/auth/status.command.js.map +0 -1
  177. package/dist/commands/auth/use.command.d.ts +0 -17
  178. package/dist/commands/auth/use.command.d.ts.map +0 -1
  179. package/dist/commands/auth/use.command.js +0 -47
  180. package/dist/commands/auth/use.command.js.map +0 -1
  181. package/dist/commands/branding.command.d.ts +0 -3
  182. package/dist/commands/branding.command.d.ts.map +0 -1
  183. package/dist/commands/branding.command.js +0 -42
  184. package/dist/commands/branding.command.js.map +0 -1
  185. package/dist/commands/event.command.d.ts +0 -3
  186. package/dist/commands/event.command.d.ts.map +0 -1
  187. package/dist/commands/event.command.js +0 -27
  188. package/dist/commands/event.command.js.map +0 -1
  189. package/dist/commands/flag-init.command.d.ts +0 -13
  190. package/dist/commands/flag-init.command.d.ts.map +0 -1
  191. package/dist/commands/flag-init.command.js +0 -463
  192. package/dist/commands/flag-init.command.js.map +0 -1
  193. package/dist/commands/guide.command.d.ts +0 -61
  194. package/dist/commands/guide.command.d.ts.map +0 -1
  195. package/dist/commands/guide.command.js +0 -655
  196. package/dist/commands/guide.command.js.map +0 -1
  197. package/dist/commands/info.command.d.ts +0 -3
  198. package/dist/commands/info.command.d.ts.map +0 -1
  199. package/dist/commands/info.command.js +0 -70
  200. package/dist/commands/info.command.js.map +0 -1
  201. package/dist/commands/integration.command.d.ts +0 -35
  202. package/dist/commands/integration.command.d.ts.map +0 -1
  203. package/dist/commands/integration.command.js +0 -290
  204. package/dist/commands/integration.command.js.map +0 -1
  205. package/dist/commands/journeys.d.ts +0 -43
  206. package/dist/commands/journeys.d.ts.map +0 -1
  207. package/dist/commands/journeys.js +0 -221
  208. package/dist/commands/journeys.js.map +0 -1
  209. package/dist/commands/ops.command.d.ts +0 -17
  210. package/dist/commands/ops.command.d.ts.map +0 -1
  211. package/dist/commands/ops.command.js +0 -129
  212. package/dist/commands/ops.command.js.map +0 -1
  213. package/dist/commands/privilege.command.d.ts +0 -16
  214. package/dist/commands/privilege.command.d.ts.map +0 -1
  215. package/dist/commands/privilege.command.js +0 -86
  216. package/dist/commands/privilege.command.js.map +0 -1
  217. package/dist/commands/role.command.d.ts +0 -3
  218. package/dist/commands/role.command.d.ts.map +0 -1
  219. package/dist/commands/role.command.js +0 -101
  220. package/dist/commands/role.command.js.map +0 -1
  221. package/dist/commands/runtime-dir.d.ts +0 -16
  222. package/dist/commands/runtime-dir.d.ts.map +0 -1
  223. package/dist/commands/runtime-dir.js +0 -18
  224. package/dist/commands/runtime-dir.js.map +0 -1
  225. package/dist/commands/setup.command.d.ts +0 -63
  226. package/dist/commands/setup.command.d.ts.map +0 -1
  227. package/dist/commands/setup.command.js +0 -148
  228. package/dist/commands/setup.command.js.map +0 -1
  229. package/dist/commands/stripe.command.d.ts +0 -29
  230. package/dist/commands/stripe.command.d.ts.map +0 -1
  231. package/dist/commands/stripe.command.js +0 -99
  232. package/dist/commands/stripe.command.js.map +0 -1
  233. package/dist/commands/tenant.command.d.ts +0 -3
  234. package/dist/commands/tenant.command.d.ts.map +0 -1
  235. package/dist/commands/tenant.command.js +0 -135
  236. package/dist/commands/tenant.command.js.map +0 -1
  237. package/dist/commands/token.command.d.ts +0 -3
  238. package/dist/commands/token.command.d.ts.map +0 -1
  239. package/dist/commands/token.command.js +0 -54
  240. package/dist/commands/token.command.js.map +0 -1
  241. package/dist/commands/user.command.d.ts +0 -3
  242. package/dist/commands/user.command.d.ts.map +0 -1
  243. package/dist/commands/user.command.js +0 -117
  244. package/dist/commands/user.command.js.map +0 -1
  245. package/dist/credentials.d.ts +0 -141
  246. package/dist/credentials.d.ts.map +0 -1
  247. package/dist/credentials.js +0 -348
  248. package/dist/credentials.js.map +0 -1
  249. package/dist/flag-coherence.d.ts +0 -42
  250. package/dist/flag-coherence.d.ts.map +0 -1
  251. package/dist/flag-coherence.js +0 -103
  252. package/dist/flag-coherence.js.map +0 -1
  253. package/dist/output.d.ts +0 -17
  254. package/dist/output.d.ts.map +0 -1
  255. package/dist/output.js +0 -107
  256. package/dist/output.js.map +0 -1
  257. package/dist/preview.d.ts +0 -9
  258. package/dist/preview.d.ts.map +0 -1
  259. package/dist/preview.js +0 -63
  260. package/dist/preview.js.map +0 -1
  261. package/dist/product-decisions.d.ts +0 -40
  262. package/dist/product-decisions.d.ts.map +0 -1
  263. package/dist/product-decisions.js +0 -52
  264. package/dist/product-decisions.js.map +0 -1
  265. package/dist/prompt-urls.d.ts +0 -31
  266. package/dist/prompt-urls.d.ts.map +0 -1
  267. package/dist/prompt-urls.js +0 -35
  268. package/dist/prompt-urls.js.map +0 -1
  269. package/dist/prompts/auth-master-integration-prompt.md +0 -255
  270. package/dist/prompts/billing/master.md +0 -332
  271. package/dist/prompts/decisions/feature-control.md +0 -131
  272. package/dist/prompts/decisions/going-live.md +0 -60
  273. package/dist/prompts/decisions/login.md +0 -71
  274. package/dist/prompts/decisions/look-and-feel.md +0 -68
  275. package/dist/prompts/decisions/payments.md +0 -97
  276. package/dist/prompts/decisions/roles.md +0 -78
  277. package/dist/prompts/decisions/teams.md +0 -61
  278. package/dist/prompts/fit-together.md +0 -97
  279. package/dist/prompts/flags/master.md +0 -220
  280. package/dist/prompts/guide-coverage.json +0 -17
  281. package/dist/prompts/integration-success.md +0 -106
  282. package/dist/prompts/mcp-tools.json +0 -90
  283. package/dist/prompts/mechanisms.md +0 -304
  284. package/dist/prompts/orientation.md +0 -42
  285. package/dist/prompts/product-decisions.json +0 -338
  286. package/dist/resolve.d.ts +0 -110
  287. package/dist/resolve.d.ts.map +0 -1
  288. package/dist/resolve.js +0 -260
  289. package/dist/resolve.js.map +0 -1
  290. package/dist/shape.d.ts +0 -25
  291. package/dist/shape.d.ts.map +0 -1
  292. package/dist/shape.js +0 -74
  293. package/dist/shape.js.map +0 -1
@@ -1,221 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { join } from 'node:path';
3
- import { commandsDir } from './runtime-dir.js';
4
- import { outputError, outputPrompt, outputSuccess } from '../output.js';
5
- import { cliPromptUrl } from '../prompt-urls.js';
6
- /*
7
- * TBP-712 — the Bridge's seven journeys by name: `bridge guide add-login` etc.
8
- *
9
- * The same seven are prompts (client commands) on the Bridge MCP server, and
10
- * both surfaces compose the same content: the journey's decision guide
11
- * (TBP-540) or, until it is written, the framework-agnostic master that exists
12
- * today, then the per-framework guide. The MCP prompt steers to tools; this
13
- * steers to the matching `bridge …` commands.
14
- */
15
- /** The seven TBP-540 decision domains a journey can open with. */
16
- export const DECISION_DOMAINS = [
17
- 'login', 'teams', 'roles', 'payments', 'feature-control', 'look-and-feel', 'going-live',
18
- ];
19
- const PRODUCT_QUESTIONS = 'Product questions (what to charge, who may do what, what a plan includes, what users see) belong to the ' +
20
- 'developer: ask them and wait. Mechanics you decide, following the guide, and state the reason in one line.';
21
- export const JOURNEYS = [
22
- {
23
- name: 'add-login',
24
- title: 'Add login',
25
- domain: 'login',
26
- master: 'auth',
27
- feature: 'auth',
28
- steps: [
29
- 'Goal: users can sign up and sign in to this app through the Bridge.',
30
- 'Sign-in happens inside the app (SDK mode), styled to match its existing design; tell the developer in one line. (If they explicitly ask for Bridge\'s hosted sign-in page, or the app already uses it, respect that.)',
31
- 'Read the current setup with `bridge app get` and `bridge auth config`.',
32
- 'See every sign-in method with `bridge auth methods list`; ask the developer which they want, then `bridge auth methods enable|disable`. A social provider needs its credentials first: `bridge setup sso`.',
33
- 'Register the callback URL with `bridge app redirect-uris add` (never replace the list).',
34
- 'Prove it works at the end by asking the developer to sign up and sign in themselves in the running app: sign up at /auth/signup, open the verification email, set a password, sign in, sign out. Do not create test users. If any step fails, `bridge event auth-attempts --user <their email>` names the reason and the fix.',
35
- ],
36
- },
37
- {
38
- name: 'add-paid-plan',
39
- title: 'Add a paid plan',
40
- domain: 'payments',
41
- master: 'billing',
42
- feature: 'billing',
43
- steps: [
44
- 'Goal: a customer can pick a paid plan and pay for it.',
45
- 'Read the current plans with `bridge plan list`.',
46
- 'Plan names, prices, trials and quotas are product decisions: ask the developer, then `bridge plan create`, `bridge plan price set`, `bridge plan quota set`.',
47
- 'Check payments with `bridge stripe status`; `bridge stripe connect` if it is not connected.',
48
- 'A /welcome page for new customers is an offer: suggest it, and create it only if the developer says yes.',
49
- ],
50
- },
51
- {
52
- name: 'add-feature-flag',
53
- title: 'Add a feature flag',
54
- domain: 'feature-control',
55
- master: 'flags',
56
- feature: 'feature-flags',
57
- steps: [
58
- 'Goal: a feature in the app is controlled by a Bridge flag.',
59
- 'Read the current flags with `bridge flag list`.',
60
- 'How flags, plans, roles and limits fit together: `bridge guide fit-together`. A feature a plan sells goes on the plan (`bridge plan feature add`) and the rule points at `bridge:billing.entitlement.<feature>`; who someone is goes in a rule on a privilege, never a role check in code.',
61
- 'Who should see the feature is the developer\'s call: ask, then `bridge flag create` with that rule.',
62
- 'Read the flag in the app with the SDK surface the guide names, never by hand against SDK internals.',
63
- ],
64
- },
65
- {
66
- name: 'add-teams',
67
- title: 'Add teams',
68
- domain: 'teams',
69
- master: null,
70
- feature: 'team',
71
- steps: [
72
- 'Goal: a customer can invite teammates into their workspace, each with a role.',
73
- 'Read the current roles with `bridge role list`: what a role can do is only the default setup until you have read it.',
74
- 'Which roles exist and what each may do are product decisions: ask the developer, then `bridge role create` / `bridge role update`.',
75
- 'Wire the team UI with the SDK surface the per-framework team guide names.',
76
- ],
77
- },
78
- {
79
- name: 'go-live',
80
- title: 'Go live',
81
- domain: 'going-live',
82
- master: null,
83
- feature: null,
84
- steps: [
85
- 'Goal: nothing on the readiness checklist blocks real users.',
86
- 'Run `bridge setup status` and start from its productionNeeds. Take each item in turn with the developer: production URLs, redirect URIs and origins, the email sender (`bridge setup communication`), live Stripe keys.',
87
- 'Finish with `bridge setup status` again and show the developer what is left.',
88
- ],
89
- },
90
- {
91
- name: 'verify-setup',
92
- title: 'Verify setup',
93
- domain: null,
94
- master: null,
95
- feature: null,
96
- steps: [
97
- 'Goal: evidence that sign-in works end to end, not an opinion.',
98
- '1. `bridge diagnose` in the project: it reads the .env files and reports every difference with its fix.',
99
- '2. `bridge setup status` for the readiness checklist.',
100
- '3. Ask the developer to sign up and sign in themselves in the running app (signup, the verification email, sign-in, sign-out). Do not create test users. If a step fails, `bridge event auth-attempts --user <their email>` gives the reason and the fix.',
101
- ],
102
- },
103
- {
104
- name: 'whats-wrong',
105
- title: 'What is wrong',
106
- domain: null,
107
- master: null,
108
- feature: null,
109
- steps: [
110
- 'Goal: the reason for the failure and its fix, from evidence.',
111
- 'Someone cannot sign in: `bridge event auth-attempts` for their email; each failed attempt carries its reason and fix.',
112
- 'The app itself misbehaves: `bridge diagnose` in the project, then `bridge setup status`.',
113
- 'To tell a Bridge problem from an app-code problem: `bridge test-user create` and `bridge test-user verify`. If that works, the app code is the difference.',
114
- ],
115
- },
116
- ];
117
- export function findJourney(name) {
118
- return JOURNEYS.find((j) => j.name === name);
119
- }
120
- /**
121
- * THE seam for TBP-540: a decision guide is `prompts/decisions/<domain>.md`,
122
- * beside the masters. Read like them (dev override, then bundled), then from
123
- * GitHub so a CLI released before a guide was written still finds it — the
124
- * same path the MCP server reads. Null means not written yet.
125
- */
126
- export async function fetchDecisionGuide(domain) {
127
- const filename = `${domain}.md`;
128
- const localDir = process.env.BRIDGE_GUIDE_LOCAL_DIR;
129
- const candidates = [
130
- ...(localDir ? [join(localDir, 'bridge-cli', 'bridge-cli', 'prompts', 'decisions', filename)] : []),
131
- join(commandsDir, '..', 'prompts', 'decisions', filename),
132
- join(commandsDir, '..', '..', 'prompts', 'decisions', filename),
133
- ];
134
- for (const path of candidates) {
135
- try {
136
- return await readFile(path, 'utf-8');
137
- }
138
- catch {
139
- /* try next */
140
- }
141
- }
142
- try {
143
- const res = await fetch(cliPromptUrl('decisions', filename));
144
- return res.ok ? await res.text() : null;
145
- }
146
- catch {
147
- return null;
148
- }
149
- }
150
- export async function composeJourney(journey, framework, sources) {
151
- const header = [`# ${journey.title} — a Bridge journey`, '', ...journey.steps, '', PRODUCT_QUESTIONS, ''];
152
- if (journey.feature) {
153
- header.push(framework
154
- ? `Framework: ${framework}.`
155
- : 'Framework not detected from package.json: re-run with `--framework <name>` ' +
156
- '(svelte, react, angular, nextjs, nestjs, express) to include the per-framework guide, or ask the developer.');
157
- }
158
- header.push(`In an MCP client the same journey is the \`${journey.name}\` prompt of the Bridge server.`);
159
- const sections = [header.join('\n')];
160
- let opensWith = 'none';
161
- if (journey.domain) {
162
- const decision = await sources.decision(journey.domain);
163
- if (decision) {
164
- sections.push(decision);
165
- opensWith = 'decision';
166
- }
167
- else if (journey.master) {
168
- sections.push(`(The decision guide for ${journey.domain} is not written yet; this is the closest existing guide.)\n\n` +
169
- (await sources.master(journey.master)));
170
- opensWith = 'master';
171
- }
172
- else {
173
- sections.push(`(The decision guide for ${journey.domain} is not written yet, and no framework-agnostic guide covers it. ` +
174
- 'Work from the steps above, and take every product decision to the developer.)');
175
- }
176
- }
177
- if (journey.feature && framework) {
178
- const features = sources.coverage()[framework] ?? [];
179
- const feature = journey.feature === 'auth' && features.includes('sdk-auth') ? 'sdk-auth' : journey.feature;
180
- sections.push(await sources.frameworkGuide(framework, feature));
181
- }
182
- return { journey: journey.name, framework, opensWith, guide: sections.join('\n\n---\n\n') };
183
- }
184
- /** The message for `bridge guide <name>` when nothing matches: names what does. */
185
- export function unknownGuideMessage(name, frameworks) {
186
- return (`No guide named '${name}'. Journeys: ${JOURNEYS.map((j) => j.name).join(', ')}. ` +
187
- `Frameworks: ${frameworks.join(', ')} (e.g. \`bridge guide svelte auth\`). ` +
188
- 'Also: orientation (what Bridge does), fit-together (how roles, plans, limits and flags fit together), ' +
189
- 'decision <domain>, flags, billing, mechanisms, custom, list. ' +
190
- '`bridge guide` alone prints the integration master.');
191
- }
192
- export function registerJourneyCommands(guide, sources, detectFramework) {
193
- for (const journey of JOURNEYS) {
194
- const cmd = guide
195
- .command(journey.name)
196
- .description(`Journey: ${journey.title.toLowerCase()} (the same as the Bridge MCP prompt)`)
197
- .option('--json', 'Emit a JSON envelope instead of the raw markdown prompt');
198
- if (journey.feature) {
199
- cmd
200
- .option('--framework <name>', 'svelte | react | angular | nextjs | nestjs | express (auto-detected from package.json when omitted)')
201
- .option('--cwd <path>', 'Project dir used for framework detection', process.cwd());
202
- }
203
- cmd.action(async (_opts, command) => {
204
- try {
205
- const opts = command.optsWithGlobals();
206
- const framework = journey.feature
207
- ? (await detectFramework(opts.framework, opts.cwd ?? process.cwd())) ?? null
208
- : null;
209
- const composed = await composeJourney(journey, framework, sources);
210
- if (opts.json)
211
- outputSuccess(composed);
212
- else
213
- outputPrompt(composed.guide);
214
- }
215
- catch (err) {
216
- outputError(err);
217
- }
218
- });
219
- }
220
- }
221
- //# sourceMappingURL=journeys.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"journeys.js","sourceRoot":"","sources":["../../src/commands/journeys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;;;;;GAQG;AAEH,kEAAkE;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY;CAC/E,CAAC;AAgBX,MAAM,iBAAiB,GACrB,0GAA0G;IAC1G,4GAA4G,CAAC;AAE/G,MAAM,CAAC,MAAM,QAAQ,GAAc;IACjC;QACE,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,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,GAAG,GAAG,KAAK;aACd,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;aACrB,WAAW,CAAC,YAAY,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,sCAAsC,CAAC;aAC1F,MAAM,CAAC,QAAQ,EAAE,yDAAyD,CAAC,CAAC;QAC/E,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,GAAG;iBACA,MAAM,CAAC,oBAAoB,EAAE,qGAAqG,CAAC;iBACnI,MAAM,CAAC,cAAc,EAAE,0CAA0C,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACvF,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAgB,EAAE,EAAE;YAC3C,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,OAAO,CAAC,eAAe,EAA0D,CAAC;gBAC/F,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO;oBAC/B,CAAC,CAAC,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,IAAI;oBAC5E,CAAC,CAAC,IAAI,CAAC;gBACT,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;gBACnE,IAAI,IAAI,CAAC,IAAI;oBAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;;oBAClC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACpC,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,WAAW,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * `bridge ops` — operator / platform-internal commands.
3
- *
4
- * Phase E of Billing 2.0 (US-18) is hidden-hero: there is no admin-UI surface
5
- * for the reconciliation pipeline. Operators trigger / inspect it through this
6
- * CLI subcommand, which calls the `/admin/reconcile/...` endpoints on
7
- * bridge-api directly. Auth re-uses the standard CLI credentials (TBP-111
8
- * loopback PKCE flow → `x-api-key: <jwt>`).
9
- *
10
- * Subcommands:
11
- * bridge ops reconcile --workspace <id>
12
- * bridge ops reconcile --workspace <id> --metric <metric>
13
- * bridge ops reconcile --workspace <id> [--json]
14
- */
15
- import { Command } from 'commander';
16
- export declare function registerOpsCommands(program: Command): void;
17
- //# sourceMappingURL=ops.command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ops.command.d.ts","sourceRoot":"","sources":["../../src/commands/ops.command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAyBpC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+B1D"}
@@ -1,129 +0,0 @@
1
- import { DEFAULT_BASE_URL } from '../config.js';
2
- import { isExpired, readCredentials } from '../credentials.js';
3
- import { outputError, outputSuccess } from '../output.js';
4
- export function registerOpsCommands(program) {
5
- const ops = program
6
- .command('ops')
7
- .description('Operator / platform-internal commands');
8
- ops
9
- .command('reconcile')
10
- .description('Trigger Bridge↔Stripe usage reconciliation for a workspace (Billing 2.0 US-18). ' +
11
- 'Diffs Bridge raw events against Stripe usage records and replays the missing ones.')
12
- .requiredOption('--workspace <id>', 'Workspace (tenant) id to reconcile')
13
- .option('--metric <metric>', 'Scope to one metric instead of all metered metrics')
14
- .option('--json', 'Emit raw JSON instead of the human-readable table')
15
- .action(async (opts) => {
16
- try {
17
- const result = await callReconcile(opts.workspace, opts.metric);
18
- if (opts.json) {
19
- outputSuccess(result);
20
- return;
21
- }
22
- // Default: render a friendly table; still go through outputSuccess so
23
- // the success envelope + exit code stay consistent with the rest of the
24
- // CLI. The pretty table is appended to stderr so machine parsers that
25
- // only watch stdout get the JSON.
26
- printReconciliationTable(result);
27
- outputSuccess(result);
28
- }
29
- catch (err) {
30
- outputError(err);
31
- }
32
- });
33
- }
34
- async function callReconcile(workspaceId, metric) {
35
- const { apiKey, baseUrl } = resolveCredentials();
36
- const path = metric
37
- ? `/v1/admin/reconcile/${encodeURIComponent(workspaceId)}/${encodeURIComponent(metric)}`
38
- : `/v1/admin/reconcile/${encodeURIComponent(workspaceId)}`;
39
- const url = `${baseUrl.replace(/\/$/, '')}${path}`;
40
- const res = await fetch(url, {
41
- method: 'POST',
42
- headers: {
43
- 'content-type': 'application/json',
44
- 'x-api-key': apiKey,
45
- },
46
- body: '{}',
47
- });
48
- if (!res.ok) {
49
- let body;
50
- try {
51
- body = await res.json();
52
- }
53
- catch {
54
- body = await res.text().catch(() => '');
55
- }
56
- const message = (body && typeof body === 'object' && 'message' in body
57
- ? String(body.message)
58
- : '') || `HTTP ${res.status}`;
59
- const err = new Error(message);
60
- err.status = res.status;
61
- err.body = body;
62
- throw err;
63
- }
64
- return (await res.json());
65
- }
66
- function resolveCredentials() {
67
- const envKey = process.env.BRIDGE_API_KEY?.trim();
68
- const envBase = process.env.BRIDGE_BASE_URL?.trim();
69
- const creds = safeReadCredentials();
70
- if (creds && !isExpired(creds)) {
71
- return {
72
- apiKey: creds.apiKey,
73
- baseUrl: envBase && envBase.length > 0 ? envBase : creds.baseUrl,
74
- };
75
- }
76
- if (envKey && envKey.length > 0) {
77
- return {
78
- apiKey: envKey,
79
- baseUrl: envBase && envBase.length > 0 ? envBase : DEFAULT_BASE_URL,
80
- };
81
- }
82
- throw new Error('Not logged in. Run `bridge auth login`.');
83
- }
84
- function safeReadCredentials() {
85
- try {
86
- return readCredentials();
87
- }
88
- catch {
89
- return null;
90
- }
91
- }
92
- function printReconciliationTable(result) {
93
- const lines = [];
94
- lines.push('');
95
- lines.push(`workspace=${result.workspaceId} app=${result.appId}`);
96
- if (result.metrics.length === 0) {
97
- lines.push(' (no metered metrics reconciled)');
98
- process.stderr.write(lines.join('\n') + '\n');
99
- return;
100
- }
101
- const header = [
102
- 'metric'.padEnd(28),
103
- 'status'.padEnd(14),
104
- 'bridge'.padStart(7),
105
- 'provider'.padStart(9),
106
- 'missing'.padStart(8),
107
- 'healed'.padStart(7),
108
- 'attempts'.padStart(9),
109
- ].join(' ');
110
- lines.push(header);
111
- lines.push('-'.repeat(header.length));
112
- for (const m of result.metrics) {
113
- lines.push([
114
- m.metric.padEnd(28).slice(0, 28),
115
- m.status.padEnd(14),
116
- String(m.bridgeCount).padStart(7),
117
- String(m.providerCount).padStart(9),
118
- String(m.missing).padStart(8),
119
- String(m.healed).padStart(7),
120
- String(m.attempts).padStart(9),
121
- ].join(' '));
122
- if (m.failed.length > 0) {
123
- lines.push(` failed: ${m.failed.slice(0, 3).join('; ')}`);
124
- }
125
- }
126
- lines.push('');
127
- process.stderr.write(lines.join('\n') + '\n');
128
- }
129
- //# sourceMappingURL=ops.command.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ops.command.js","sourceRoot":"","sources":["../../src/commands/ops.command.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAsB1D,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,MAAM,GAAG,GAAG,OAAO;SAChB,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,uCAAuC,CAAC,CAAC;IAExD,GAAG;SACA,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CACV,kFAAkF;QAChF,oFAAoF,CACvF;SACA,cAAc,CAAC,kBAAkB,EAAE,oCAAoC,CAAC;SACxE,MAAM,CAAC,mBAAmB,EAAE,oDAAoD,CAAC;SACjF,MAAM,CAAC,QAAQ,EAAE,mDAAmD,CAAC;SACrE,MAAM,CAAC,KAAK,EAAE,IAA4D,EAAE,EAAE;QAC7E,IAAI,CAAC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AC,CAAC,CAAC;IACtC,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CACR;YACE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;YAChC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YACnB,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YACjC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YACnC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC7B,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC5B,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;SAC/B,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAC;QACF,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AAChD,CAAC"}
@@ -1,16 +0,0 @@
1
- import { Command } from 'commander';
2
- /**
3
- * TBP-589 / TBP-592 — `bridge privilege` did not exist.
4
- *
5
- * The account API has served full CRUD under `/account/role/privilege` all
6
- * along; nothing in the CLI reached it. An app with custom privileges — which
7
- * is most non-trivial apps — therefore could not be provisioned by the CLI at
8
- * all. Porting one real app meant ten raw `POST /account/role/privilege` calls
9
- * with the credential JWT passed as `x-api-key`, entirely outside the tool
10
- * that exists to do this.
11
- *
12
- * `role create --privileges` also depends on `list` here: it resolves the keys
13
- * a human types into the ids the API stores.
14
- */
15
- export declare function registerPrivilegeCommands(program: Command): void;
16
- //# sourceMappingURL=privilege.command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"privilege.command.d.ts","sourceRoot":"","sources":["../../src/commands/privilege.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAyDhE"}
@@ -1,86 +0,0 @@
1
- import { getManagementClient } from '../config.js';
2
- import { outputSuccess, outputError } from '../output.js';
3
- import { resolvePrivilegeId } from '../resolve.js';
4
- /**
5
- * TBP-589 / TBP-592 — `bridge privilege` did not exist.
6
- *
7
- * The account API has served full CRUD under `/account/role/privilege` all
8
- * along; nothing in the CLI reached it. An app with custom privileges — which
9
- * is most non-trivial apps — therefore could not be provisioned by the CLI at
10
- * all. Porting one real app meant ten raw `POST /account/role/privilege` calls
11
- * with the credential JWT passed as `x-api-key`, entirely outside the tool
12
- * that exists to do this.
13
- *
14
- * `role create --privileges` also depends on `list` here: it resolves the keys
15
- * a human types into the ids the API stores.
16
- */
17
- export function registerPrivilegeCommands(program) {
18
- const privilege = program
19
- .command('privilege')
20
- .description('Manage the privileges roles are built from');
21
- privilege.command('list')
22
- .description('List all privileges defined for this app')
23
- .action(async () => {
24
- try {
25
- outputSuccess(await getManagementClient().roles.listPrivileges());
26
- }
27
- catch (err) {
28
- outputError(err);
29
- }
30
- });
31
- privilege.command('create')
32
- .description('Create a new privilege')
33
- .requiredOption('--key <key>', 'Privilege key, e.g. CASE_READ')
34
- .option('--description <desc>', 'What this privilege grants')
35
- .action(async (opts) => {
36
- try {
37
- outputSuccess(await getManagementClient().roles.createPrivilege({
38
- key: opts.key,
39
- description: opts.description,
40
- }));
41
- }
42
- catch (err) {
43
- outputError(err);
44
- }
45
- });
46
- privilege.command('update')
47
- .description('Update a privilege by --key or --id')
48
- .option('--key <key>', 'Privilege key to address (alternative to --id)')
49
- .option('--id <id>', 'Privilege ID to address (alternative to --key)')
50
- .option('--new-key <key>', 'Rename the privilege to this key')
51
- .option('--description <desc>', 'What this privilege grants')
52
- .action(async (opts) => {
53
- try {
54
- const id = await resolvePrivilegeId({ id: opts.id, key: opts.key });
55
- // `--key` addresses; `--new-key` renames. Keeping them separate means
56
- // addressing by key can never be misread as a rename (TBP-586).
57
- const data = {};
58
- if (opts.newKey !== undefined)
59
- data.key = opts.newKey;
60
- if (opts.description !== undefined)
61
- data.description = opts.description;
62
- outputSuccess(await getManagementClient().roles.updatePrivilege(id, data));
63
- }
64
- catch (err) {
65
- outputError(err);
66
- }
67
- });
68
- privilege.command('delete')
69
- .description('Delete a privilege by --key or --id')
70
- .option('--key <key>', 'Privilege key to address (alternative to --id)')
71
- .option('--id <id>', 'Privilege ID to address (alternative to --key)')
72
- .action(async (opts) => {
73
- try {
74
- const id = await resolvePrivilegeId({ id: opts.id, key: opts.key });
75
- // Needs ROLE_DELETE on the token. Destructive privileges are opt-in
76
- // (TBP-552) — a plain `bridge auth login` token is refused with 403;
77
- // `bridge auth login --admin` requests them (TBP-593).
78
- await getManagementClient().roles.deletePrivilege(id);
79
- outputSuccess({ deleted: true, id });
80
- }
81
- catch (err) {
82
- outputError(err);
83
- }
84
- });
85
- }
86
- //# sourceMappingURL=privilege.command.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"privilege.command.js","sourceRoot":"","sources":["../../src/commands/privilege.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA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AE,CAAC,CAAC;YACtD,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function registerRoleCommands(program: Command): void;
3
- //# sourceMappingURL=role.command.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"role.command.d.ts","sourceRoot":"","sources":["../../src/commands/role.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoF3D"}
@@ -1,101 +0,0 @@
1
- import { getManagementClient } from '../config.js';
2
- import { outputSuccess, outputError } from '../output.js';
3
- import { resolvePrivilegeIds, resolveRoleId } from '../resolve.js';
4
- import { shapeRoleList } from '../shape.js';
5
- export function registerRoleCommands(program) {
6
- const role = program.command('role').description('Manage access roles');
7
- role.command('list')
8
- .description('List all access roles')
9
- .action(async () => {
10
- try {
11
- outputSuccess(shapeRoleList(await getManagementClient().roles.list()));
12
- }
13
- catch (err) {
14
- outputError(err);
15
- }
16
- });
17
- role.command('create')
18
- .description('Create a new access role')
19
- .requiredOption('--name <name>', 'Role name')
20
- .requiredOption('--key <key>', 'Role key')
21
- .option('--description <desc>', 'Description')
22
- .option('--privileges <list>', 'Comma-separated privilege keys (ids also accepted)', (v) => v.split(','))
23
- .option('--is-default', 'Make this the role people get when added to a workspace without a role named', false)
24
- .action(async (opts) => {
25
- try {
26
- // TBP-592: --privileges is documented as taking KEYS, but the API
27
- // stores ObjectIds and silently drops anything that isn't one. Resolve
28
- // here so the documented behaviour is the real behaviour.
29
- const privileges = await resolvePrivilegeIds(opts.privileges ?? []);
30
- outputSuccess(await getManagementClient().roles.create({
31
- name: opts.name,
32
- key: opts.key,
33
- description: opts.description,
34
- privileges,
35
- isDefault: opts.isDefault,
36
- }));
37
- }
38
- catch (err) {
39
- outputError(err);
40
- }
41
- });
42
- role.command('update')
43
- .description('Update an access role by --key or --id')
44
- .option('--key <key>', 'Role key to address, e.g. ADMIN (alternative to --id)')
45
- .option('--id <id>', 'Role ID to address (alternative to --key)')
46
- .option('--name <name>', 'Role name')
47
- .option('--description <desc>', 'Description')
48
- .option('--privileges <list>', 'Comma-separated privilege keys (ids also accepted)', (v) => v.split(','))
49
- // TBP-758: no default value — an absent flag must stay absent so an update
50
- // that only renames a role never touches which role is the default.
51
- .option('--is-default', 'Make this the default role (the previous default stops being default)')
52
- .action(async (opts) => {
53
- try {
54
- // TBP-586: `--key`/`--id` are addressing only — strip both out of the
55
- // write payload so addressing by key can never be read as a rename.
56
- const { id: _id, key: _key, ...data } = opts;
57
- const roleId = await resolveRoleId({ id: opts.id, key: opts.key });
58
- const cleaned = Object.fromEntries(Object.entries(data).filter(([, v]) => v !== undefined));
59
- // TBP-592: same key->id resolution as `create`. Only when the caller
60
- // actually passed --privileges: an absent key must stay absent so an
61
- // update that renames a role does not blank its privileges.
62
- if (opts.privileges !== undefined) {
63
- cleaned.privileges = await resolvePrivilegeIds(opts.privileges);
64
- }
65
- outputSuccess(await getManagementClient().roles.update(roleId, cleaned));
66
- }
67
- catch (err) {
68
- outputError(err);
69
- }
70
- });
71
- // TBP-758: which role people get when added to a workspace without a role
72
- // named. The API keeps exactly one default per app, so promoting this role
73
- // demotes the previous one; there is nothing to "unset".
74
- role.command('set-default')
75
- .description('Make an existing role the default for people added without a role named')
76
- .argument('<key>', 'Role key, e.g. MEMBER (see `bridge role list`)')
77
- .action(async (key) => {
78
- try {
79
- const id = await resolveRoleId({ key });
80
- outputSuccess(await getManagementClient().roles.update(id, { isDefault: true }));
81
- }
82
- catch (err) {
83
- outputError(err);
84
- }
85
- });
86
- role.command('delete')
87
- .description('Delete an access role by --key or --id')
88
- .option('--key <key>', 'Role key to address, e.g. ADMIN (alternative to --id)')
89
- .option('--id <id>', 'Role ID to address (alternative to --key)')
90
- .action(async (opts) => {
91
- try {
92
- const id = await resolveRoleId({ id: opts.id, key: opts.key });
93
- await getManagementClient().roles.delete(id);
94
- outputSuccess({ deleted: true, id });
95
- }
96
- catch (err) {
97
- outputError(err);
98
- }
99
- });
100
- }
101
- //# sourceMappingURL=role.command.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"role.command.js","sourceRoot":"","sources":["../../src/commands/role.command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;IAExE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;SACjB,WAAW,CAAC,uBAAuB,CAAC;SACpC,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,IAAI,CAAC;YAAC,aAAa,CAAC,aAAa,CAAC,MAAM,mBAAmB,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAAC,CAAC;QAC/E,OAAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;SACnB,WAAW,CAAC,0BAA0B,CAAC;SACvC,cAAc,CAAC,eAAe,EAAE,WAAW,CAAC;SAC5C,cAAc,CAAC,aAAa,EAAE,UAAU,CAAC;SACzC,MAAM,C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a,CAAC,MAAM,mBAAmB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACnF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;SACnB,WAAW,CAAC,wCAAwC,CAAC;SACrD,MAAM,CAAC,aAAa,EAAE,uDAAuD,CAAC;SAC9E,MAAM,CAAC,WAAW,EAAE,2CAA2C,CAAC;SAChE,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,MAAM,aAAa,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;YAC/D,MAAM,mBAAmB,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC7C,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Absolute path to this module's own directory — `dist/commands` in the built
3
- * (ESM) CLI. Bundled prompts ship at `dist/prompts`, i.e. `../prompts` from
4
- * here.
5
- *
6
- * The `import.meta` token is deliberately confined to this single file. The
7
- * production build is ESM (`"type": "module"`), so `import.meta.url` resolves
8
- * correctly at runtime. Under ts-jest, however, sources are loaded as
9
- * CommonJS, where `import.meta` is an *uncatchable parse-time* SyntaxError
10
- * ("Cannot use 'import.meta' outside a module") that crashes the whole module
11
- * on import. To keep the rest of the command code importable by the jest
12
- * suite, jest maps this module to a CJS-safe stub (`runtime-dir.stub.ts`) via
13
- * `moduleNameMapper` — see jest.config.cjs.
14
- */
15
- export declare const commandsDir: string;
16
- //# sourceMappingURL=runtime-dir.d.ts.map