@fragment-dev/cli 2026.6.29 → 2026.6.30-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 (77) hide show
  1. package/README.md +42 -2
  2. package/dist/{chunk-I5JFFWZM.js → chunk-2VYJABNZ.js} +2 -2
  3. package/dist/{chunk-BBZDU3B4.js → chunk-34NLRFFT.js} +1 -1
  4. package/dist/{chunk-T5GGVB7Q.js → chunk-46HQGYHT.js} +32 -28
  5. package/dist/{chunk-7O5S6DOP.js → chunk-4H2VTNQ3.js} +3 -3
  6. package/dist/{chunk-UMAUSCLS.js → chunk-5A52AXRT.js} +3 -3
  7. package/dist/{chunk-LNYDUY5F.js → chunk-5HH4NNSE.js} +2 -2
  8. package/dist/{chunk-CMB5L4GJ.js → chunk-B2BG7TCY.js} +5 -5
  9. package/dist/{chunk-ECSXGVPP.js → chunk-C7ROAUIM.js} +1 -1
  10. package/dist/{chunk-Q25QYAZ7.js → chunk-FELYEHSZ.js} +1 -1
  11. package/dist/{chunk-6BF2IGEK.js → chunk-HCTAYKGL.js} +2 -2
  12. package/dist/{chunk-VKFC45KB.js → chunk-J6GQWO4E.js} +2 -2
  13. package/dist/{chunk-QI5VSJMP.js → chunk-J73JTDHN.js} +4 -4
  14. package/dist/{chunk-UGKG4UKY.js → chunk-KLPHEBPJ.js} +3 -3
  15. package/dist/{chunk-A43XU7QS.js → chunk-LB3C4WTL.js} +1 -1
  16. package/dist/{chunk-JN7B4RNC.js → chunk-LDDNVG3E.js} +3 -0
  17. package/dist/{chunk-BPA2ZDP4.js → chunk-MOZRABR6.js} +2 -2
  18. package/dist/{chunk-PCAB73GF.js → chunk-NWPJRN3W.js} +1 -1
  19. package/dist/{chunk-2BXFOBDR.js → chunk-NYTFP5AV.js} +1 -1
  20. package/dist/{chunk-L3XNEX33.js → chunk-OZQUYOQH.js} +2 -2
  21. package/dist/{chunk-TRYLEOKB.js → chunk-PILLZB3E.js} +8 -8
  22. package/dist/{chunk-NM7ENVG2.js → chunk-QDA5BIHP.js} +2 -2
  23. package/dist/{chunk-IJBNTQ7H.js → chunk-QJOWCJUB.js} +1 -1
  24. package/dist/{chunk-IO6HR226.js → chunk-QRP56DLY.js} +2 -2
  25. package/dist/chunk-RRQXUXAS.js +108 -0
  26. package/dist/{chunk-XKTOP23Z.js → chunk-SQL643PS.js} +1 -1
  27. package/dist/{chunk-WS2PJBP6.js → chunk-TLM4VKIC.js} +2 -0
  28. package/dist/{chunk-PFGF27Z7.js → chunk-UHVWN34X.js} +2 -2
  29. package/dist/{chunk-G5N2UVKQ.js → chunk-UMIUGX6O.js} +2 -2
  30. package/dist/{chunk-3QZ3TI7I.js → chunk-UOXPSGVC.js} +1 -1
  31. package/dist/{chunk-OVTTESEV.js → chunk-VGBDSE7K.js} +2 -2
  32. package/dist/{chunk-GT4DQ3S5.js → chunk-VIVSBPCD.js} +2 -2
  33. package/dist/{chunk-7X2QSWZ4.js → chunk-VJS4Z4XI.js} +4 -4
  34. package/dist/{chunk-YKRLZ565.js → chunk-WMBVWK2M.js} +1 -1
  35. package/dist/{chunk-DTKNXMNB.js → chunk-XDGKUJ32.js} +2 -2
  36. package/dist/{chunk-ESEZRPTU.js → chunk-YYTKYSJW.js} +73 -10
  37. package/dist/{chunk-F4X6QF3A.js → chunk-ZCK2KXOV.js} +1 -1
  38. package/dist/{chunk-NTVQKBTC.js → chunk-ZMSR4Z3E.js} +2 -2
  39. package/dist/chunk-ZQUZATVE.js +185 -0
  40. package/dist/commands/add-ledger-entry.js +7 -7
  41. package/dist/commands/api-client/create.js +18 -0
  42. package/dist/commands/create-custom-link.js +7 -7
  43. package/dist/commands/create-ledger.js +7 -7
  44. package/dist/commands/delete-custom-txs.js +7 -7
  45. package/dist/commands/delete-ledger.js +7 -7
  46. package/dist/commands/delete-schema.js +7 -7
  47. package/dist/commands/gen-graphql.js +11 -11
  48. package/dist/commands/get-schema.js +8 -8
  49. package/dist/commands/init.js +6 -6
  50. package/dist/commands/login.js +8 -7
  51. package/dist/commands/migrate-ledger-entry.js +7 -7
  52. package/dist/commands/query/ledgerAccounts.js +7 -7
  53. package/dist/commands/query/ledgers.js +7 -7
  54. package/dist/commands/query/schema.js +7 -7
  55. package/dist/commands/query/schemas.js +7 -7
  56. package/dist/commands/reverse-ledger-entry.js +7 -7
  57. package/dist/commands/start.js +6 -6
  58. package/dist/commands/store-schema.js +7 -7
  59. package/dist/commands/token.js +7 -7
  60. package/dist/commands/update-ledger-account.js +7 -7
  61. package/dist/commands/update.js +7 -7
  62. package/dist/commands/verify-schema.js +11 -11
  63. package/dist/commands/workspace.js +7 -7
  64. package/dist/commands.js +40 -38
  65. package/dist/graphql.js +4 -4
  66. package/dist/index.js +40 -38
  67. package/dist/lib/auth.js +2 -2
  68. package/dist/lib/authenticatedCommand.js +6 -6
  69. package/dist/lib/baseCommand.js +5 -5
  70. package/dist/lib/browserAuth.js +13 -0
  71. package/dist/lib/constants.js +5 -3
  72. package/dist/open-SJMVVA3H.js +551 -0
  73. package/dist/utils/formatValidationErrors.js +3 -3
  74. package/dist/utils/schemaValidation.js +6 -6
  75. package/dist/version.js +2 -2
  76. package/oclif.manifest.json +101 -1
  77. package/package.json +4 -1
package/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  <!-- commands -->
8
8
  * [`fragment add-ledger-entry`](#fragment-add-ledger-entry)
9
+ * [`fragment api-client create`](#fragment-api-client-create)
9
10
  * [`fragment autocomplete [SHELL]`](#fragment-autocomplete-shell)
10
11
  * [`fragment commands`](#fragment-commands)
11
12
  * [`fragment create-custom-link`](#fragment-create-custom-link)
@@ -65,6 +66,39 @@ FLAG DESCRIPTIONS
65
66
  You may specify multiple parameters by repeating the flag.
66
67
  ```
67
68
 
69
+ ## `fragment api-client create`
70
+
71
+ Create an API client for an integration.
72
+
73
+ ```
74
+ USAGE
75
+ $ fragment api-client create --workspace <value> --name <value> [--role admin|reader] [--mcp-url <value>] [--output
76
+ <value>] [--format json|env]
77
+
78
+ FLAGS
79
+ --format=<option> [default: json] Output format (applies to both stdout and --output).
80
+ <options: json|env>
81
+ --mcp-url=<value> The Workspace MCP server origin (ex: https://mcp.us-west-2.fragment.dev). Falls back to
82
+ FRAGMENT_MCP_URL.
83
+ --name=<value> (required) A display name for the API client.
84
+ --output=<value> Write the credentials to this file instead of stdout.
85
+ --role=<option> Role to assign the API client (defaults to your own role, capped at it).
86
+ <options: admin|reader>
87
+ --workspace=<value> (required) The Workspace id to create the API client in.
88
+
89
+ DESCRIPTION
90
+ Create an API client for an integration.
91
+
92
+ Authenticates in the browser and provisions a new API client for the
93
+ given Workspace, then writes the credentials to a file or stdout. The
94
+ authorizing user must have permission to create API clients.
95
+
96
+ EXAMPLES
97
+ $ fragment api-client create --workspace <workspace-id> --name "Billing service" --role reader
98
+
99
+ $ fragment api-client create --workspace <workspace-id> --name CI --output ./fragment-client.json
100
+ ```
101
+
68
102
  ## `fragment autocomplete [SHELL]`
69
103
 
70
104
  Display autocomplete installation instructions.
@@ -342,17 +376,21 @@ Authenticate with FRAGMENT.
342
376
 
343
377
  ```
344
378
  USAGE
345
- $ fragment login [--client-id <value>] [--client-secret <value>] [--api-url <value>] [--oauth-url
346
- <value>] [--oauth-scope <value>] [--test]
379
+ $ fragment login [--browser] [--workspace <value>] [--mcp-url <value>] [--client-id <value>]
380
+ [--client-secret <value>] [--api-url <value>] [--oauth-url <value>] [--oauth-scope <value>] [--test]
347
381
 
348
382
  FLAGS
349
383
  --api-url=<value> The API URL for your FRAGMENT Workspace (ex: https://api.us-west-2.fragment.dev/graphql)
384
+ --browser Authenticate in the browser and provision an API client automatically.
350
385
  --client-id=<value> The API Client ID for your FRAGMENT Workspace.
351
386
  --client-secret=<value> The API Client Secret for your FRAGMENT Workspace
387
+ --mcp-url=<value> The Workspace MCP server origin (ex: https://mcp.us-west-2.fragment.dev). Used with
388
+ --browser.
352
389
  --oauth-scope=<value> The OAuth Scope for your auth token (ex: https://api.us-west-2.fragment.dev/*)
353
390
  --oauth-url=<value> The OAuth URL from which to retrieve your auth token (ex:
354
391
  https://auth.fragment.dev/oauth2/token)
355
392
  --test If set, tests stored credentials only
393
+ --workspace=<value> The Workspace id to authenticate against (required with --browser).
356
394
 
357
395
  DESCRIPTION
358
396
  Authenticate with FRAGMENT.
@@ -365,6 +403,8 @@ DESCRIPTION
365
403
  EXAMPLES
366
404
  $ fragment login
367
405
 
406
+ $ fragment login --browser --workspace <workspace-id>
407
+
368
408
  $ fragment login --client-id <client-id> --client-secret <client-secret> --api-url <api-url> --oauth-url <oauth-url>
369
409
  ```
370
410
 
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-TRYLEOKB.js";
6
+ } from "./chunk-PILLZB3E.js";
7
7
  import {
8
8
  require_source
9
9
  } from "./chunk-XK2D2Z44.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-L7ZGDLYU.js";
4
4
  import {
5
5
  FRAGMENT_VERSION_PATH
6
- } from "./chunk-WS2PJBP6.js";
6
+ } from "./chunk-TLM4VKIC.js";
7
7
  import {
8
8
  init_cjs_shims
9
9
  } from "./chunk-7GH3YGSC.js";
@@ -1,72 +1,75 @@
1
+ import {
2
+ Workspace
3
+ } from "./chunk-NWPJRN3W.js";
4
+ import {
5
+ QuerySchemas
6
+ } from "./chunk-UOXPSGVC.js";
1
7
  import {
2
8
  ReverseLedgerEntry
3
- } from "./chunk-NTVQKBTC.js";
9
+ } from "./chunk-ZMSR4Z3E.js";
4
10
  import {
5
11
  Start
6
- } from "./chunk-A43XU7QS.js";
12
+ } from "./chunk-LB3C4WTL.js";
7
13
  import {
8
14
  StoreSchema
9
- } from "./chunk-L3XNEX33.js";
15
+ } from "./chunk-OZQUYOQH.js";
10
16
  import {
11
17
  Token
12
- } from "./chunk-ECSXGVPP.js";
18
+ } from "./chunk-C7ROAUIM.js";
13
19
  import {
14
20
  UpdateLedgerAccount
15
- } from "./chunk-I5JFFWZM.js";
21
+ } from "./chunk-2VYJABNZ.js";
16
22
  import {
17
23
  Update
18
- } from "./chunk-G5N2UVKQ.js";
24
+ } from "./chunk-UMIUGX6O.js";
19
25
  import {
20
26
  VerifySchema
21
- } from "./chunk-UGKG4UKY.js";
27
+ } from "./chunk-KLPHEBPJ.js";
22
28
  import {
23
- Workspace
24
- } from "./chunk-PCAB73GF.js";
29
+ GenGraphQL
30
+ } from "./chunk-B2BG7TCY.js";
25
31
  import {
26
32
  GetSchema
27
- } from "./chunk-UMAUSCLS.js";
33
+ } from "./chunk-5A52AXRT.js";
28
34
  import {
29
35
  Init
30
- } from "./chunk-XKTOP23Z.js";
36
+ } from "./chunk-SQL643PS.js";
31
37
  import {
32
38
  Login
33
- } from "./chunk-ESEZRPTU.js";
39
+ } from "./chunk-YYTKYSJW.js";
34
40
  import {
35
41
  MigrateLedgerEntry
36
- } from "./chunk-DTKNXMNB.js";
42
+ } from "./chunk-XDGKUJ32.js";
37
43
  import {
38
44
  QueryLedgerAccounts
39
- } from "./chunk-BPA2ZDP4.js";
45
+ } from "./chunk-MOZRABR6.js";
40
46
  import {
41
47
  QueryLedgers
42
- } from "./chunk-YKRLZ565.js";
48
+ } from "./chunk-WMBVWK2M.js";
43
49
  import {
44
50
  GetSchema as GetSchema2
45
- } from "./chunk-OVTTESEV.js";
46
- import {
47
- QuerySchemas
48
- } from "./chunk-3QZ3TI7I.js";
51
+ } from "./chunk-VGBDSE7K.js";
49
52
  import {
50
53
  AddLedgerEntry
51
- } from "./chunk-VKFC45KB.js";
54
+ } from "./chunk-J6GQWO4E.js";
55
+ import {
56
+ ApiClientCreate
57
+ } from "./chunk-RRQXUXAS.js";
52
58
  import {
53
59
  CreateCustomLink
54
- } from "./chunk-NM7ENVG2.js";
60
+ } from "./chunk-QDA5BIHP.js";
55
61
  import {
56
62
  CreateLedger
57
- } from "./chunk-IO6HR226.js";
63
+ } from "./chunk-QRP56DLY.js";
58
64
  import {
59
65
  DeleteCustomTxs
60
- } from "./chunk-GT4DQ3S5.js";
66
+ } from "./chunk-VIVSBPCD.js";
61
67
  import {
62
68
  DeleteLedger
63
- } from "./chunk-6BF2IGEK.js";
69
+ } from "./chunk-HCTAYKGL.js";
64
70
  import {
65
71
  DeleteSchema
66
- } from "./chunk-LNYDUY5F.js";
67
- import {
68
- GenGraphQL
69
- } from "./chunk-CMB5L4GJ.js";
72
+ } from "./chunk-5HH4NNSE.js";
70
73
  import {
71
74
  init_cjs_shims
72
75
  } from "./chunk-7GH3YGSC.js";
@@ -81,6 +84,7 @@ var COMMANDS = {
81
84
  // Auth commands
82
85
  login: Login,
83
86
  token: Token,
87
+ "api-client:create": ApiClientCreate,
84
88
  // Workspace commands
85
89
  workspace: Workspace,
86
90
  // Schema commands
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Schema,
3
3
  parseWithError
4
- } from "./chunk-PFGF27Z7.js";
4
+ } from "./chunk-UHVWN34X.js";
5
5
  import {
6
6
  formatValidationErrors
7
- } from "./chunk-QI5VSJMP.js";
7
+ } from "./chunk-J73JTDHN.js";
8
8
  import {
9
9
  BadRequestError
10
- } from "./chunk-JN7B4RNC.js";
10
+ } from "./chunk-LDDNVG3E.js";
11
11
  import {
12
12
  init_cjs_shims
13
13
  } from "./chunk-7GH3YGSC.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  inquirer_default
3
- } from "./chunk-IJBNTQ7H.js";
3
+ } from "./chunk-QJOWCJUB.js";
4
4
  import {
5
5
  AuthenticatedCommand
6
- } from "./chunk-Q25QYAZ7.js";
6
+ } from "./chunk-FELYEHSZ.js";
7
7
  import {
8
8
  require_lib
9
- } from "./chunk-TRYLEOKB.js";
9
+ } from "./chunk-PILLZB3E.js";
10
10
  import {
11
11
  require_source
12
12
  } from "./chunk-XK2D2Z44.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-TRYLEOKB.js";
6
+ } from "./chunk-PILLZB3E.js";
7
7
  import {
8
8
  require_source
9
9
  } from "./chunk-XK2D2Z44.js";
@@ -3,22 +3,22 @@ import {
3
3
  generateQueryFiles,
4
4
  schemaToEntryDefinitions,
5
5
  validateOutputName
6
- } from "./chunk-7X2QSWZ4.js";
6
+ } from "./chunk-VJS4Z4XI.js";
7
7
  import {
8
8
  Schema,
9
9
  parseWithError
10
- } from "./chunk-PFGF27Z7.js";
10
+ } from "./chunk-UHVWN34X.js";
11
11
  import {
12
12
  formatValidationErrors,
13
13
  logValidationErrors
14
- } from "./chunk-QI5VSJMP.js";
14
+ } from "./chunk-J73JTDHN.js";
15
15
  import {
16
16
  BadRequestError
17
- } from "./chunk-JN7B4RNC.js";
17
+ } from "./chunk-LDDNVG3E.js";
18
18
  import {
19
19
  FragmentCommand,
20
20
  require_lib
21
- } from "./chunk-TRYLEOKB.js";
21
+ } from "./chunk-PILLZB3E.js";
22
22
  import {
23
23
  getParsedSchema
24
24
  } from "./chunk-O7AE4SQS.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  require_source
6
6
  } from "./chunk-XK2D2Z44.js";
@@ -5,7 +5,7 @@ import {
5
5
  FragmentCommand,
6
6
  GraphQLClient,
7
7
  require_lib
8
- } from "./chunk-TRYLEOKB.js";
8
+ } from "./chunk-PILLZB3E.js";
9
9
  import {
10
10
  colorizeJson
11
11
  } from "./chunk-O7AE4SQS.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-TRYLEOKB.js";
6
+ } from "./chunk-PILLZB3E.js";
7
7
  import {
8
8
  require_source
9
9
  } from "./chunk-XK2D2Z44.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-TRYLEOKB.js";
6
+ } from "./chunk-PILLZB3E.js";
7
7
  import {
8
8
  require_source
9
9
  } from "./chunk-XK2D2Z44.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  BadRequestError
3
- } from "./chunk-JN7B4RNC.js";
4
- import {
5
- ZodError
6
- } from "./chunk-L7ZGDLYU.js";
3
+ } from "./chunk-LDDNVG3E.js";
7
4
  import {
8
5
  require_source
9
6
  } from "./chunk-XK2D2Z44.js";
7
+ import {
8
+ ZodError
9
+ } from "./chunk-L7ZGDLYU.js";
10
10
  import {
11
11
  __toESM,
12
12
  init_cjs_shims
@@ -2,17 +2,17 @@ import {
2
2
  extractSchemaMetadata,
3
3
  isJsonParseError,
4
4
  validateSchemaStructure
5
- } from "./chunk-7O5S6DOP.js";
5
+ } from "./chunk-4H2VTNQ3.js";
6
6
  import {
7
7
  DEFAULT_SCHEMA_PATH
8
8
  } from "./chunk-A4BSWX5D.js";
9
9
  import {
10
10
  logValidationErrors
11
- } from "./chunk-QI5VSJMP.js";
11
+ } from "./chunk-J73JTDHN.js";
12
12
  import {
13
13
  FragmentCommand,
14
14
  require_lib
15
- } from "./chunk-TRYLEOKB.js";
15
+ } from "./chunk-PILLZB3E.js";
16
16
  import {
17
17
  colorizeJson,
18
18
  emphasize,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FragmentCommand,
3
3
  require_lib
4
- } from "./chunk-TRYLEOKB.js";
4
+ } from "./chunk-PILLZB3E.js";
5
5
  import {
6
6
  require_source
7
7
  } from "./chunk-XK2D2Z44.js";
@@ -6062,6 +6062,9 @@ var codes = {
6062
6062
  workspace: {
6063
6063
  workspace_not_found: "workspace_not_found"
6064
6064
  },
6065
+ api_client: {
6066
+ invalid_role: "api_client_invalid_role"
6067
+ },
6065
6068
  user: {
6066
6069
  user_not_found: "user_not_found",
6067
6070
  user_not_belong_to_workspace: "user_not_belong_to_workspace",
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-TRYLEOKB.js";
6
+ } from "./chunk-PILLZB3E.js";
7
7
  import {
8
8
  __toESM,
9
9
  init_cjs_shims
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  init_cjs_shims
6
6
  } from "./chunk-7GH3YGSC.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-L7ZGDLYU.js";
4
4
  import {
5
5
  FRAGMENT_ACCESS_TOKEN_PATH
6
- } from "./chunk-WS2PJBP6.js";
6
+ } from "./chunk-TLM4VKIC.js";
7
7
  import {
8
8
  init_cjs_shims
9
9
  } from "./chunk-7GH3YGSC.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-TRYLEOKB.js";
6
+ } from "./chunk-PILLZB3E.js";
7
7
  import {
8
8
  getParsedSchema
9
9
  } from "./chunk-O7AE4SQS.js";
@@ -4,28 +4,28 @@ import {
4
4
  import {
5
5
  readVersionFile,
6
6
  updateVersionFile
7
- } from "./chunk-BBZDU3B4.js";
7
+ } from "./chunk-34NLRFFT.js";
8
8
  import {
9
9
  require_graphql
10
10
  } from "./chunk-QF5EN33L.js";
11
11
  import {
12
12
  getFragmentCliVersion
13
13
  } from "./chunk-CW4UI44G.js";
14
+ import {
15
+ require_color_convert,
16
+ require_has_flag,
17
+ require_source
18
+ } from "./chunk-XK2D2Z44.js";
14
19
  import {
15
20
  attemptToCacheToken,
16
21
  getToken,
17
22
  readUnexpiredAccessToken
18
- } from "./chunk-2BXFOBDR.js";
23
+ } from "./chunk-NYTFP5AV.js";
19
24
  import {
20
25
  FRAGMENT_AUTH_PATH,
21
26
  FRAGMENT_HOME,
22
27
  getPosthogApiKey
23
- } from "./chunk-WS2PJBP6.js";
24
- import {
25
- require_color_convert,
26
- require_has_flag,
27
- require_source
28
- } from "./chunk-XK2D2Z44.js";
28
+ } from "./chunk-TLM4VKIC.js";
29
29
  import {
30
30
  __commonJS,
31
31
  __require,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-TRYLEOKB.js";
6
+ } from "./chunk-PILLZB3E.js";
7
7
  import {
8
8
  require_source
9
9
  } from "./chunk-XK2D2Z44.js";
@@ -13,7 +13,7 @@ import {
13
13
  require_syntax,
14
14
  require_type,
15
15
  require_uri
16
- } from "./chunk-TRYLEOKB.js";
16
+ } from "./chunk-PILLZB3E.js";
17
17
  import {
18
18
  require_color_convert,
19
19
  require_source
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  AuthenticatedCommand
3
- } from "./chunk-Q25QYAZ7.js";
3
+ } from "./chunk-FELYEHSZ.js";
4
4
  import {
5
5
  require_lib
6
- } from "./chunk-TRYLEOKB.js";
6
+ } from "./chunk-PILLZB3E.js";
7
7
  import {
8
8
  getParsedSchema
9
9
  } from "./chunk-O7AE4SQS.js";
@@ -0,0 +1,108 @@
1
+ import {
2
+ defaultBrowserAuthDeps,
3
+ provisionApiClient
4
+ } from "./chunk-ZQUZATVE.js";
5
+ import {
6
+ FragmentCommand,
7
+ require_lib
8
+ } from "./chunk-PILLZB3E.js";
9
+ import {
10
+ resolveMcpBaseUrl
11
+ } from "./chunk-TLM4VKIC.js";
12
+ import {
13
+ __toESM,
14
+ init_cjs_shims
15
+ } from "./chunk-7GH3YGSC.js";
16
+
17
+ // src/commands/api-client/create.ts
18
+ init_cjs_shims();
19
+ var import_core = __toESM(require_lib(), 1);
20
+ import { writeFile } from "node:fs/promises";
21
+ var ROLE_KEYS = {
22
+ admin: "workspace_admin",
23
+ reader: "workspace_reader"
24
+ };
25
+ var ApiClientCreate = class _ApiClientCreate extends FragmentCommand {
26
+ static {
27
+ this.summary = "Create an API client for an integration.";
28
+ }
29
+ static {
30
+ this.description = `Authenticates in the browser and provisions a new API client for the
31
+ given Workspace, then writes the credentials to a file or stdout. The
32
+ authorizing user must have permission to create API clients.`;
33
+ }
34
+ static {
35
+ this.examples = [
36
+ '<%= config.bin %> <%= command.id %> --workspace <workspace-id> --name "Billing service" --role reader',
37
+ "<%= config.bin %> <%= command.id %> --workspace <workspace-id> --name CI --output ./fragment-client.json"
38
+ ];
39
+ }
40
+ static {
41
+ this.flags = {
42
+ workspace: import_core.Flags.string({
43
+ required: true,
44
+ description: "The Workspace id to create the API client in."
45
+ }),
46
+ name: import_core.Flags.string({
47
+ required: true,
48
+ description: "A display name for the API client."
49
+ }),
50
+ role: import_core.Flags.string({
51
+ required: false,
52
+ options: ["admin", "reader"],
53
+ description: "Role to assign the API client (defaults to your own role, capped at it)."
54
+ }),
55
+ "mcp-url": import_core.Flags.string({
56
+ required: false,
57
+ description: "The Workspace MCP server origin (ex: https://mcp.us-west-2.fragment.dev). Falls back to FRAGMENT_MCP_URL."
58
+ }),
59
+ output: import_core.Flags.string({
60
+ required: false,
61
+ description: "Write the credentials to this file instead of stdout."
62
+ }),
63
+ format: import_core.Flags.string({
64
+ required: false,
65
+ options: ["json", "env"],
66
+ default: "json",
67
+ description: "Output format (applies to both stdout and --output)."
68
+ })
69
+ };
70
+ }
71
+ render(result, format) {
72
+ return format === "env" ? [
73
+ `FRAGMENT_CLIENT_ID=${result.clientId}`,
74
+ `FRAGMENT_CLIENT_SECRET=${result.clientSecret}`,
75
+ `FRAGMENT_API_URL=${result.apiUrl}`,
76
+ `FRAGMENT_OAUTH_URL=${result.oauthUrl}`,
77
+ `FRAGMENT_OAUTH_SCOPE=${result.oauthScope}`
78
+ ].join("\n") : JSON.stringify(result, null, 2);
79
+ }
80
+ async run() {
81
+ const { flags } = await this.parse(_ApiClientCreate);
82
+ const mcpBaseUrl = resolveMcpBaseUrl(flags["mcp-url"]);
83
+ this.assert(mcpBaseUrl, {
84
+ message: "Must provide --mcp-url (or set FRAGMENT_MCP_URL), e.g. https://mcp.us-west-2.fragment.dev"
85
+ });
86
+ const result = await provisionApiClient(
87
+ {
88
+ mcpBaseUrl,
89
+ workspaceId: flags.workspace,
90
+ clientName: flags.name,
91
+ role: flags.role ? ROLE_KEYS[flags.role] : void 0
92
+ },
93
+ defaultBrowserAuthDeps((msg) => this.log(msg))
94
+ );
95
+ const rendered = this.render(result, flags.format);
96
+ if (flags.output) {
97
+ await writeFile(flags.output, `${rendered}
98
+ `, { mode: 384 });
99
+ this.log(`API client credentials written to ${flags.output}`);
100
+ return;
101
+ }
102
+ this.log(rendered);
103
+ }
104
+ };
105
+
106
+ export {
107
+ ApiClientCreate
108
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FragmentCommand,
3
3
  require_lib
4
- } from "./chunk-TRYLEOKB.js";
4
+ } from "./chunk-PILLZB3E.js";
5
5
  import {
6
6
  require_source
7
7
  } from "./chunk-XK2D2Z44.js";
@@ -9,6 +9,7 @@ var FRAGMENT_HOME = process.env.FRAGMENT_PATH ?? `${homedir()}/.fragment`;
9
9
  var FRAGMENT_VERSION_PATH = `${FRAGMENT_HOME}/version.json`;
10
10
  var FRAGMENT_AUTH_PATH = `${FRAGMENT_HOME}/auth.json`;
11
11
  var FRAGMENT_ACCESS_TOKEN_PATH = `${FRAGMENT_HOME}/token.json`;
12
+ var resolveMcpBaseUrl = (flag) => flag ?? process.env.FRAGMENT_MCP_URL;
12
13
  var DEV_POSTHOG_API_KEY = "phc_eHLtmjtSfHGfAMzmIxjgtwjp0SP8g1KrIbE1sM8jZVX";
13
14
  var PROD_POSTHOG_API_KEY = "phc_dMs2ythnUI9lm53ZM60NawtEw6TypZuYngHb4SKAnV9";
14
15
  var getPosthogApiKey = () => {
@@ -24,5 +25,6 @@ export {
24
25
  FRAGMENT_VERSION_PATH,
25
26
  FRAGMENT_AUTH_PATH,
26
27
  FRAGMENT_ACCESS_TOKEN_PATH,
28
+ resolveMcpBaseUrl,
27
29
  getPosthogApiKey
28
30
  };
@@ -5,7 +5,7 @@ import {
5
5
  getStructuralPath,
6
6
  getStructuralSubpaths,
7
7
  getSubpaths
8
- } from "./chunk-F4X6QF3A.js";
8
+ } from "./chunk-ZCK2KXOV.js";
9
9
  import {
10
10
  BadRequestError,
11
11
  CurrencyMatchInputSchema,
@@ -21,7 +21,7 @@ import {
21
21
  currencyCodes,
22
22
  safe,
23
23
  z
24
- } from "./chunk-JN7B4RNC.js";
24
+ } from "./chunk-LDDNVG3E.js";
25
25
  import {
26
26
  __commonJS,
27
27
  __toESM,