@scalar/cli 2.5.2 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +319 -55
  2. package/chunks/{action-XUQ7TKKJ.js → action-354TUG4H.js} +11 -7
  3. package/chunks/{action-PHLOE27S.js → action-43YBNBDR.js} +33 -26
  4. package/chunks/{action-DGD6Q6Y5.js → action-5SK5NE7E.js} +10 -4
  5. package/chunks/{action-Y6CEKYEK.js → action-6BYGBXRC.js} +40 -23
  6. package/chunks/{action-LUVBQEIQ.js → action-7PEQXDWT.js} +4 -4
  7. package/chunks/action-AQRPFQKI.js +231 -0
  8. package/chunks/{action-RBVPKCRI.js → action-CA4QYPI6.js} +6 -6
  9. package/chunks/{action-7H3XARJP.js → action-EOAVVL52.js} +11 -5
  10. package/chunks/action-F2ZJNURT.js +72 -0
  11. package/chunks/{action-AMNYOA4B.js → action-F7A2K74G.js} +4 -4
  12. package/chunks/{action-HIL5ZFNB.js → action-FCAYFPVR.js} +5 -5
  13. package/chunks/{action-42D2C47G.js → action-GWXLHL2Z.js} +3 -3
  14. package/chunks/{action-ZWQLQENM.js → action-H6OUJWWM.js} +4 -4
  15. package/chunks/{action-TWHLZW4V.js → action-HT2DJ34Z.js} +49 -26
  16. package/chunks/{action-PAA4NWUJ.js → action-JAHFRYWZ.js} +58 -9
  17. package/chunks/{action-HXHBU7XC.js → action-KTYOCA2V.js} +37 -12
  18. package/chunks/{action-LFL3ZZKN.js → action-LEUD5P2U.js} +17 -17
  19. package/chunks/{action-FF2OMGAS.js → action-LLH4QPXM.js} +34 -20
  20. package/chunks/{action-OILGZAMK.js → action-LXGXKXZZ.js} +20 -15
  21. package/chunks/{action-W62AIEBN.js → action-NVI5DWFP.js} +6 -6
  22. package/chunks/{action-EPNE5XCM.js → action-QQZLPI42.js} +17 -17
  23. package/chunks/{action-ZLTUMRO2.js → action-UIKH4SZX.js} +25 -21
  24. package/chunks/{action-6FAJNP6C.js → action-VOFDW3U2.js} +4 -4
  25. package/chunks/{action-OK55BFGM.js → action-W3C53GPH.js} +7 -7
  26. package/chunks/{action-P7RFXIC7.js → action-WFDNRA7D.js} +32 -23
  27. package/chunks/{action-V5KYG7XD.js → action-XIUO64C7.js} +10 -10
  28. package/chunks/{action-X7TZA3RE.js → action-Y6NXJQ4H.js} +89 -14
  29. package/chunks/{action-6MZZHPVQ.js → action-Y7OUGD56.js} +27 -14
  30. package/chunks/{action-DCINFQ57.js → action-YLF2G4G5.js} +13 -13
  31. package/chunks/{action-SJYAMXYI.js → action-YRX6SN5F.js} +10 -4
  32. package/chunks/actions-OGIVBQC7.js +158 -0
  33. package/chunks/{agent-JAXLLDPE.js → agent-ASPV3R5U.js} +4 -4
  34. package/chunks/{asyncapi-P6Y3L7RG.js → asyncapi-QNFKXHEI.js} +10 -11
  35. package/chunks/{build.action-AZ5ECU4B.js → build.action-NM6CAE5F.js} +37 -33
  36. package/chunks/{chunk-FOKFF4EP.js → chunk-22HYZ7LE.js} +3 -3
  37. package/chunks/{chunk-KEOCJ3NJ.js → chunk-2OCWX42S.js} +38 -87
  38. package/chunks/{chunk-RPVHJMQT.js → chunk-5DEU2DVL.js} +2 -2
  39. package/chunks/{chunk-OQKDBLOZ.js → chunk-5JLVQVKO.js} +8 -0
  40. package/chunks/{chunk-VNYE4R7N.js → chunk-5UHLAJQD.js} +2 -1
  41. package/chunks/{chunk-CX7ZRMTC.js → chunk-6XWCMJDB.js} +1 -1
  42. package/chunks/{chunk-6ZMT63IV.js → chunk-6YPQGVF4.js} +1 -1
  43. package/chunks/{chunk-HXIDUCSZ.js → chunk-BPGFSSUH.js} +1 -1
  44. package/chunks/{chunk-M622VXRQ.js → chunk-C2KAWRIX.js} +1 -1
  45. package/chunks/chunk-EGOXR5FB.js +15 -0
  46. package/chunks/{chunk-UB3XGOUW.js → chunk-EXY3ZTV4.js} +262 -9
  47. package/chunks/{chunk-3BWGTPPT.js → chunk-FDC2IESH.js} +1776 -1113
  48. package/chunks/{chunk-TYLWJ2UL.js → chunk-GTV2BVXV.js} +2 -2
  49. package/chunks/{chunk-SWWWYWHC.js → chunk-HGOD6THU.js} +27 -18
  50. package/chunks/{chunk-3DJ2GKEG.js → chunk-IMG35UXX.js} +1 -1
  51. package/chunks/{chunk-MNLXYOVF.js → chunk-KCCFN4F7.js} +2 -2
  52. package/chunks/{chunk-FQVVKQPU.js → chunk-KKRGBXCE.js} +137 -1
  53. package/chunks/{chunk-UMPODUJO.js → chunk-L3UXDCBI.js} +105 -15
  54. package/chunks/{chunk-B2MHTD3R.js → chunk-MLSZVVTT.js} +1 -1
  55. package/chunks/{chunk-LCPFHE4Z.js → chunk-OJ2EWIJH.js} +21 -2
  56. package/chunks/{chunk-RAO7VUGM.js → chunk-PH3WFNXJ.js} +1 -1
  57. package/chunks/{chunk-NIXG4KDE.js → chunk-QVQ4PNVL.js} +170 -5
  58. package/chunks/{chunk-CIFOFSZ3.js → chunk-R5LK6VPY.js} +72 -7
  59. package/chunks/{chunk-T7B6WNZC.js → chunk-TSURUX4A.js} +12 -3
  60. package/chunks/{chunk-JV7TUEXQ.js → chunk-UXJ753NV.js} +14 -1
  61. package/chunks/{chunk-HUCR333E.js → chunk-W24BETFG.js} +2 -2
  62. package/chunks/{chunk-LQN4S62O.js → chunk-XEDGMZJD.js} +18 -4
  63. package/chunks/{chunk-NNMSZVAB.js → chunk-XXSQUBXS.js} +82 -6
  64. package/chunks/{chunk-M6Q3ARBV.js → chunk-YILQODZF.js} +2 -2
  65. package/chunks/{create.action-34OTO2SB.js → create.action-FUQ2BVJA.js} +29 -17
  66. package/chunks/{delete.action-ZYXFMIOW.js → delete.action-47E66R3I.js} +26 -17
  67. package/chunks/{delete.action-6LRT4M3S.js → delete.action-BTDFH7WY.js} +26 -17
  68. package/chunks/{get.action-XP36SA2J.js → get.action-XC7KC2JO.js} +10 -10
  69. package/chunks/{list.action-6LF6KSD5.js → list.action-LXKEUYKO.js} +13 -13
  70. package/chunks/{list.action-WVRVLX5E.js → list.action-OFGLMRE7.js} +17 -17
  71. package/chunks/{publish.action-AHFUBT5C.js → publish.action-OS27XOX4.js} +50 -24
  72. package/chunks/{update.action-YQTVUDYE.js → update.action-AEIBLCWD.js} +27 -18
  73. package/chunks/{update.action-ZREAFJVG.js → update.action-ZMS4CQ3T.js} +27 -18
  74. package/docs.html +679 -175
  75. package/index.js +492 -406
  76. package/package.json +14 -22
  77. package/skills/scalar-cli/SKILL.md +77 -0
  78. package/template.md +101 -3
  79. package/chunks/action-YRWHX2AE.js +0 -64
@@ -1,10 +1,11 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  config
4
- } from "./chunk-JV7TUEXQ.js";
4
+ } from "./chunk-UXJ753NV.js";
5
5
  import {
6
+ TeamUserRole,
6
7
  roleSchema
7
- } from "./chunk-VNYE4R7N.js";
8
+ } from "./chunk-5UHLAJQD.js";
8
9
  import {
9
10
  isUrl
10
11
  } from "./chunk-4ORL4MST.js";
@@ -34,6 +35,153 @@ Visit https://nodejs.org to download the latest version.`
34
35
  }
35
36
  }
36
37
 
38
+ // ../../packages/entities/dist/oauth/scopes.js
39
+ var OAUTH_SCOPES = ["read", "write", "admin"];
40
+ var oauthScopeSchema = external_exports.enum(OAUTH_SCOPES).meta({ id: "oauth-scope" });
41
+ var roleRank = {
42
+ [TeamUserRole.Viewer]: 0,
43
+ [TeamUserRole.Editor]: 1,
44
+ [TeamUserRole.Admin]: 2,
45
+ [TeamUserRole.Owner]: 3
46
+ };
47
+ var oauthScopeRoleCeiling = {
48
+ read: TeamUserRole.Viewer,
49
+ write: TeamUserRole.Editor,
50
+ admin: TeamUserRole.Admin
51
+ };
52
+
53
+ // ../../packages/entities/dist/oauth/client.js
54
+ var oauthClientTypeSchema = external_exports.enum(["confidential", "public"]).meta({ id: "oauth-client-type" });
55
+ var oauthClientSchema = external_exports.object({
56
+ /** Doubles as the OAuth `client_id` */
57
+ uid: nanoidSchema,
58
+ teamUid: nanoidSchema,
59
+ name: external_exports.string().trim().min(1).max(100),
60
+ type: oauthClientTypeSchema,
61
+ /**
62
+ * sha256 hex digest of the client secret, confidential clients only. The
63
+ * plaintext is shown once at creation and never stored.
64
+ */
65
+ secretHash: external_exports.string().optional(),
66
+ redirectUris: external_exports.array(external_exports.string().max(2048)).min(1).max(10),
67
+ /** Scopes the client may request; the strongest sets its ceiling */
68
+ allowedScopes: external_exports.array(oauthScopeSchema).min(1),
69
+ createdBy: nanoidSchema,
70
+ createdAt: timestampSchema
71
+ }).meta({ id: "oauth-client" });
72
+ var oauthClientPublicSchema = oauthClientSchema.pick({ uid: true, name: true, type: true }).meta({ id: "oauth-client-public" });
73
+
74
+ // ../../packages/entities/dist/oauth/api.js
75
+ var oauthAuthorizeParamsSchema = external_exports.object({
76
+ client_id: external_exports.string().max(256).optional(),
77
+ redirect_uri: external_exports.string().max(2048).optional(),
78
+ response_type: external_exports.string().max(32).optional(),
79
+ scope: external_exports.string().max(256).optional(),
80
+ state: external_exports.string().max(1024).optional(),
81
+ code_challenge: external_exports.string().max(256).optional(),
82
+ code_challenge_method: external_exports.string().max(32).optional()
83
+ }).meta({ id: "oauth-authorize-params" });
84
+ var oauthAuthorizeResultSchema = external_exports.discriminatedUnion("status", [
85
+ external_exports.object({ status: external_exports.literal("ok"), uid: nanoidSchema }),
86
+ external_exports.object({
87
+ status: external_exports.literal("error"),
88
+ error: external_exports.string(),
89
+ errorDescription: external_exports.string(),
90
+ redirectTo: external_exports.string().optional()
91
+ })
92
+ ]).meta({ id: "oauth-authorize-result" });
93
+ var oauthAuthorizationRequestViewSchema = external_exports.object({
94
+ uid: nanoidSchema,
95
+ client: external_exports.object({
96
+ uid: external_exports.string(),
97
+ name: external_exports.string(),
98
+ firstParty: external_exports.boolean(),
99
+ /** Team that registered the app, absent for first-party clients */
100
+ ownerTeamName: external_exports.string().optional()
101
+ }),
102
+ scope: oauthScopeSchema,
103
+ /** Unix ms after which the request can no longer be decided */
104
+ expiresAt: external_exports.number().int()
105
+ }).meta({ id: "oauth-authorization-request-view" });
106
+ var oauthDecisionSchema = external_exports.object({ accept: external_exports.boolean() }).meta({ id: "oauth-decision" });
107
+ var oauthDecisionResultSchema = external_exports.object({ redirectTo: external_exports.string() }).meta({ id: "oauth-decision-result" });
108
+ var oauthTokenRequestSchema = external_exports.object({
109
+ grant_type: external_exports.string().max(64),
110
+ client_id: external_exports.string().max(256).optional(),
111
+ client_secret: external_exports.string().max(256).optional(),
112
+ code: external_exports.string().max(256).optional(),
113
+ redirect_uri: external_exports.string().max(2048).optional(),
114
+ code_verifier: external_exports.string().max(256).optional(),
115
+ refresh_token: external_exports.string().max(4096).optional(),
116
+ scope: external_exports.string().max(256).optional()
117
+ }).meta({ id: "oauth-token-request" });
118
+ var oauthTokenResponseSchema = external_exports.object({
119
+ access_token: external_exports.string(),
120
+ token_type: external_exports.literal("Bearer"),
121
+ /** Access token lifetime in seconds */
122
+ expires_in: external_exports.number().int(),
123
+ refresh_token: external_exports.string(),
124
+ scope: oauthScopeSchema
125
+ }).meta({ id: "oauth-token-response" });
126
+ var oauthRevokeRequestSchema = external_exports.object({
127
+ token: external_exports.string().max(4096),
128
+ token_type_hint: external_exports.string().max(64).optional(),
129
+ client_id: external_exports.string().max(256).optional(),
130
+ client_secret: external_exports.string().max(256).optional()
131
+ }).meta({ id: "oauth-revoke-request" });
132
+ var oauthErrorResponseSchema = external_exports.object({
133
+ error: external_exports.string(),
134
+ error_description: external_exports.string().optional()
135
+ }).meta({ id: "oauth-error-response" });
136
+ var oauthClientCreateSchema = external_exports.object({
137
+ name: external_exports.string().trim().min(1).max(100),
138
+ type: oauthClientTypeSchema,
139
+ redirectUris: external_exports.array(external_exports.string().trim().min(1).max(2048)).min(1).max(10),
140
+ allowedScopes: external_exports.array(oauthScopeSchema).min(1)
141
+ }).meta({ id: "oauth-client-create" });
142
+ var oauthClientListItemSchema = oauthClientSchema.omit({ secretHash: true }).meta({ id: "oauth-client-list-item" });
143
+ var oauthClientCreatedSchema = oauthClientListItemSchema.extend({ clientSecret: external_exports.string().optional() }).meta({ id: "oauth-client-created" });
144
+
145
+ // ../../packages/entities/dist/oauth/authorization.js
146
+ var codeChallengeSchema = external_exports.string().min(43).max(128);
147
+ var oauthAuthorizationRequestSchema = external_exports.object({
148
+ uid: nanoidSchema,
149
+ clientId: external_exports.string(),
150
+ redirectUri: external_exports.string(),
151
+ scope: oauthScopeSchema,
152
+ state: external_exports.string().max(1024).optional(),
153
+ codeChallenge: codeChallengeSchema,
154
+ /** Date because Mongo TTL indexes ignore numeric fields */
155
+ expiresAt: external_exports.date()
156
+ }).meta({ id: "oauth-authorization-request" });
157
+ var oauthAuthorizationCodeSchema = external_exports.object({
158
+ /** Row id only: mongobase keeps a unique `uid` index on every collection */
159
+ uid: nanoidSchema,
160
+ /** sha256 hex digest of the code; the plaintext only ever travels in the redirect */
161
+ codeHash: external_exports.string(),
162
+ clientId: external_exports.string(),
163
+ userUid: nanoidSchema,
164
+ teamUid: nanoidSchema,
165
+ redirectUri: external_exports.string(),
166
+ scope: oauthScopeSchema,
167
+ codeChallenge: codeChallengeSchema,
168
+ /**
169
+ * Whether the code has been exchanged. The `false` guard on the exchange
170
+ * write makes consumption a compare-and-set, so two racing exchanges of
171
+ * one code cannot both succeed.
172
+ */
173
+ used: external_exports.boolean(),
174
+ /** Unix ms of the exchange. A second exchange after this is a replay. */
175
+ usedAt: external_exports.number().int().optional(),
176
+ /** Refresh family issued from this code, revoked if the code is replayed */
177
+ familyId: external_exports.string().optional(),
178
+ /**
179
+ * When the code stops being exchangeable. The row outlives this (see the
180
+ * TTL index) so a late replay still revokes the family.
181
+ */
182
+ expiresAt: external_exports.date()
183
+ }).meta({ id: "oauth-authorization-code" });
184
+
37
185
  // ../../packages/entities/dist/token/token.js
38
186
  var accessTokenPayloadSchema = external_exports.object({
39
187
  userIndex: external_exports.string(),
@@ -43,6 +191,8 @@ var accessTokenPayloadSchema = external_exports.object({
43
191
  teamUid: external_exports.string().brand(),
44
192
  email: emailSchema.nullable(),
45
193
  role: roleSchema.optional(),
194
+ clientId: external_exports.string().min(1).optional(),
195
+ scope: oauthScopeSchema.optional(),
46
196
  exp: external_exports.number().int()
47
197
  }).meta({ id: "access-token-payload" });
48
198
  var healthTokenPayloadSchema = external_exports.object({
@@ -63,6 +213,8 @@ var refreshTokenPayloadSchema = external_exports.object({
63
213
  type: external_exports.string(),
64
214
  familyId: external_exports.string(),
65
215
  userIndex: external_exports.string(),
216
+ clientId: external_exports.string().min(1).optional(),
217
+ scope: oauthScopeSchema.optional(),
66
218
  exp: external_exports.number()
67
219
  }).meta({ id: "refresh-token-payload" });
68
220
  var personalTokenPayloadSchema = external_exports.object({
@@ -138,7 +290,14 @@ var refreshTokenRecordSchema = external_exports.object({
138
290
  /** family id is used to remove all tokens for a family in the event of a reuse */
139
291
  familyId: external_exports.string(),
140
292
  /** Unique lookup for the user */
141
- userIndex: external_exports.string()
293
+ userIndex: external_exports.string(),
294
+ /**
295
+ * OAuth client the family was granted to. Absent on first-party sessions;
296
+ * present, a rotation must come from the same client and re-signs the
297
+ * same scope.
298
+ */
299
+ clientId: external_exports.string().optional(),
300
+ scope: oauthScopeSchema.optional()
142
301
  }).meta({ id: "refresh-token-record" });
143
302
 
144
303
  // ../../node_modules/.pnpm/jose@5.9.6/node_modules/jose/dist/node/esm/runtime/base64url.js
@@ -385,12 +544,12 @@ var watchFile = async (file, callback, options) => {
385
544
  setInterval(callback, 5e3);
386
545
  return;
387
546
  }
388
- const absoluteFilePath = path2.join(process.cwd(), file);
547
+ const absoluteFilePath = path2.resolve(file);
389
548
  if (!fs2.existsSync(absoluteFilePath)) {
390
549
  throw new Error(`File ${absoluteFilePath} does not exist`);
391
550
  }
392
551
  output.info().title(`Watch ${file}`).print();
393
- const watcher = chokidar.watch(file, { persistent: true });
552
+ const watcher = chokidar.watch(absoluteFilePath, { persistent: true });
394
553
  watcher.on("change", () => {
395
554
  callback();
396
555
  });
@@ -431,6 +590,12 @@ var generateAccessByPersonalToken = async ({
431
590
 
432
591
  export {
433
592
  checkNodeVersion,
593
+ oauthAuthorizeResultSchema,
594
+ oauthAuthorizationRequestViewSchema,
595
+ oauthDecisionResultSchema,
596
+ oauthTokenResponseSchema,
597
+ oauthClientListItemSchema,
598
+ oauthClientCreatedSchema,
434
599
  tokenResponseSchema,
435
600
  accessTokenPayloadSchema,
436
601
  decode3 as decode,
@@ -1,10 +1,10 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  billingPlanSchema
4
- } from "./chunk-VNYE4R7N.js";
4
+ } from "./chunk-5UHLAJQD.js";
5
5
  import {
6
6
  sharedProjectSchema
7
- } from "./chunk-OQKDBLOZ.js";
7
+ } from "./chunk-5JLVQVKO.js";
8
8
  import {
9
9
  SCALAR_AGENT_KEY_HEADER,
10
10
  agentDocsProjectSchema,
@@ -21,9 +21,10 @@ import {
21
21
  mcpServerToolModes,
22
22
  mcpServerVersionSchema,
23
23
  monthlyUsageSchema
24
- } from "./chunk-LQN4S62O.js";
24
+ } from "./chunk-XEDGMZJD.js";
25
25
  import {
26
26
  external_exports,
27
+ namespaceSchema,
27
28
  nanoidSchema,
28
29
  slugSchema
29
30
  } from "./chunk-IKT5F47M.js";
@@ -475,6 +476,12 @@ var internalRoutes = {
475
476
  path: () => "/internal/mcp/by-slug",
476
477
  query: external_exports.object({
477
478
  teamUid: external_exports.string(),
479
+ /**
480
+ * A server slug is unique per namespace, so a team with more than one
481
+ * namespace names the one the server lives in; without it a slug found
482
+ * in several namespaces answers 409.
483
+ */
484
+ namespace: namespaceSchema.optional(),
478
485
  serverSlug: slugSchema,
479
486
  installationSlug: slugSchema
480
487
  }),
@@ -482,7 +489,11 @@ var internalRoutes = {
482
489
  mcpServerId: external_exports.string(),
483
490
  mcpInstallationId: external_exports.string()
484
491
  }),
485
- responses: { 400: agentApiErrorSchema, 404: agentApiErrorSchema },
492
+ responses: {
493
+ 400: agentApiErrorSchema,
494
+ 404: agentApiErrorSchema,
495
+ 409: agentApiErrorSchema
496
+ },
486
497
  summary: "Resolve an MCP installation by team and slugs"
487
498
  },
488
499
  createDocsProject: {
@@ -503,6 +514,51 @@ var internalRoutes = {
503
514
  params: external_exports.object({ projectUid: external_exports.string() }),
504
515
  response: external_exports.null(),
505
516
  summary: "Reclassify a docs project as unified docs"
517
+ },
518
+ /**
519
+ * Which of the given record uids have a Postgres row, with the identity
520
+ * fields the row holds. Core's reconcile sweep deletes the records the
521
+ * agent does not know and patches the ones whose fields drifted.
522
+ */
523
+ knownMcpServers: {
524
+ method: "POST",
525
+ path: () => "/internal/mcp/servers/known",
526
+ body: external_exports.object({ teamUid: external_exports.string(), uids: external_exports.string().array() }),
527
+ response: external_exports.object({
528
+ servers: external_exports.object({
529
+ uid: external_exports.string(),
530
+ namespace: external_exports.string(),
531
+ name: external_exports.string(),
532
+ slug: external_exports.string()
533
+ }).array()
534
+ }),
535
+ summary: "The MCP server rows behind the given record uids"
536
+ },
537
+ /** Delete a server by its record uid; core removes the record afterwards. */
538
+ deleteMcpServerByUid: {
539
+ method: "POST",
540
+ path: () => "/internal/mcp/servers/delete-by-uid",
541
+ body: external_exports.object({ teamUid: external_exports.string(), uid: external_exports.string() }),
542
+ response: external_exports.object({ deleted: external_exports.boolean() }),
543
+ responses: { 400: agentApiErrorSchema },
544
+ summary: "Delete an MCP server by its record uid"
545
+ },
546
+ /**
547
+ * Mirror the custom domain on a server's record onto its row, or release it
548
+ * with `null`. A 404 means the team has no row for the uid; a 409 means
549
+ * another server's row already holds the name.
550
+ */
551
+ setMcpServerDomain: {
552
+ method: "POST",
553
+ path: () => "/internal/mcp/servers/domain",
554
+ body: external_exports.object({
555
+ teamUid: external_exports.string(),
556
+ uid: external_exports.string(),
557
+ domain: external_exports.string().nullable()
558
+ }),
559
+ response: external_exports.object({ updated: external_exports.boolean() }),
560
+ responses: { 404: agentApiErrorSchema, 409: agentApiErrorSchema },
561
+ summary: "Set or release the custom domain of an MCP server"
506
562
  }
507
563
  };
508
564
 
@@ -701,8 +757,12 @@ var mcpServerRoutes = {
701
757
  method: "POST",
702
758
  path: () => "/mcp/servers",
703
759
  body: external_exports.object({
760
+ /** The uid of the identity record core wrote before calling. */
761
+ uid: external_exports.string(),
762
+ /** The namespace core derived from the linked API documents. */
763
+ namespace: namespaceSchema,
704
764
  name: external_exports.string().min(1).max(100),
705
- slug: slugSchema.optional(),
765
+ slug: slugSchema,
706
766
  versionUids: external_exports.array(external_exports.string()).optional(),
707
767
  projectUids: external_exports.array(external_exports.string()).optional(),
708
768
  documentTracking: external_exports.array(external_exports.object({
@@ -720,14 +780,19 @@ var mcpServerRoutes = {
720
780
  installation: mcpInstallationSchema
721
781
  }),
722
782
  responses: { 400: agentApiErrorSchema },
723
- summary: "Create an MCP server"
783
+ summary: "Create an MCP server",
784
+ description: "Provisions the Postgres half of a server whose identity record core has already written. Called by core with the provision secret header; the dashboard creates servers through core."
724
785
  },
725
786
  createInstantServer: {
726
787
  method: "POST",
727
788
  path: () => "/mcp/servers/instant",
728
789
  body: external_exports.object({
790
+ /** The uid of the identity record core wrote before calling. */
791
+ uid: external_exports.string(),
792
+ /** The namespace core derived from the linked API document. */
793
+ namespace: namespaceSchema,
729
794
  name: external_exports.string().min(1).max(100),
730
- slug: slugSchema.optional(),
795
+ slug: slugSchema,
731
796
  versionUid: external_exports.string(),
732
797
  installationName: external_exports.string().min(1).max(100),
733
798
  installationSlug: slugSchema.optional(),
@@ -1,14 +1,23 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ output
4
+ } from "./chunk-T5HJUAWB.js";
2
5
 
3
6
  // src/domains/project/resolve-project.ts
4
7
  async function resolveProject(slug, apiClient) {
8
+ const docsResult = await apiClient.docsProject.getProject(slug);
9
+ if (!docsResult.error) {
10
+ return { kind: "docs", project: docsResult.data };
11
+ }
12
+ if (docsResult.code !== "missing-project" && docsResult.status !== 404) {
13
+ return output.error().title("Could not load project").message(docsResult.message).exit("error");
14
+ }
5
15
  const githubResult = await apiClient.github.getProject(slug);
6
16
  if (!githubResult.error) {
7
17
  return { kind: "github", project: githubResult.data };
8
18
  }
9
- const docsResult = await apiClient.docsProject.getProject(slug);
10
- if (!docsResult.error) {
11
- return { kind: "docs", project: docsResult.data };
19
+ if (githubResult.code !== "missing-project" && githubResult.status !== 404) {
20
+ return output.error().title("Could not load project").message(githubResult.message).exit("error");
12
21
  }
13
22
  return { kind: "not-found" };
14
23
  }
@@ -2,6 +2,16 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
 
3
3
  // src/config.ts
4
4
  import { portNumbers } from "get-port";
5
+
6
+ // package.json
7
+ var name = "@scalar/cli";
8
+ var version = "2.8.0";
9
+ var bin = {
10
+ scalar: "./dist/index.js",
11
+ "scalar-cli": "./dist/index.js"
12
+ };
13
+
14
+ // src/config.ts
5
15
  var config = {
6
16
  projects: {
7
17
  dashboard: process.env.DASHBOARD_URL ?? "https://dashboard.scalar.com",
@@ -18,9 +28,12 @@ var config = {
18
28
  },
19
29
  cdnUrl: process.env.CDN_URL ?? "https://cdn.scalar.com",
20
30
  publishTld: process.env.PUBLISH_TLD ?? ((URL.parse(process.env.BASE_URL ?? "", "https://services.scalar.com")?.hostname ?? "services.scalar.com") === "services.scalar.com" ? "apidocumentation.com" : "staging-apidocumentation.com"),
21
- ssgDocsIsolateVersion: process.env.SSG_DOCS_ISOLATE_VERSION ?? "1.6.3"
31
+ ssgDocsIsolateVersion: process.env.SSG_DOCS_ISOLATE_VERSION ?? version
22
32
  };
23
33
 
24
34
  export {
35
+ name,
36
+ version,
37
+ bin,
25
38
  config
26
39
  };
@@ -2,10 +2,10 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  findConfig,
4
4
  parseConfig
5
- } from "./chunk-NNMSZVAB.js";
5
+ } from "./chunk-XXSQUBXS.js";
6
6
  import {
7
7
  ConfigVersion
8
- } from "./chunk-OQKDBLOZ.js";
8
+ } from "./chunk-5JLVQVKO.js";
9
9
  import {
10
10
  output
11
11
  } from "./chunk-T5HJUAWB.js";
@@ -104,9 +104,14 @@ var mcpServerSchema = external_exports.object({
104
104
  teamUid: external_exports.string(),
105
105
  name: external_exports.string(),
106
106
  slug: slugSchema,
107
+ uid: external_exports.string(),
108
+ namespace: namespaceSchema,
107
109
  // Missing key parses to false, so a dashboard bundle keeps parsing agent
108
110
  // responses that predate this column, whichever side deploys first.
109
111
  autoAddOperations: external_exports.boolean().default(false),
112
+ // A mirror of the domain on the server's record in core, which owns it.
113
+ // Missing key parses to null for the same reason as above.
114
+ domain: external_exports.string().nullable().default(null),
110
115
  createdAt: external_exports.string(),
111
116
  updatedAt: external_exports.string()
112
117
  }).meta({ id: "mcp-server" });
@@ -179,7 +184,7 @@ var mcpServerDocsPublishSchema = external_exports.object({
179
184
  }).meta({
180
185
  id: "mcp-server-docs-publish"
181
186
  });
182
- var mcpAuthModes = ["global", "passthrough"];
187
+ var mcpAuthModes = ["global", "passthrough", "identity"];
183
188
  var PASSTHROUGH_NAME_REGEX = /^[A-Za-z0-9!#$%&'*+\-.^_`|~]+$/;
184
189
  var PASSTHROUGH_MAX_ENTRIES = 20;
185
190
  var PASSTHROUGH_NAME_MAX_LENGTH = 128;
@@ -209,6 +214,14 @@ var PASSTHROUGH_HEADER_DENYLIST = [
209
214
  "x-forwarded-host",
210
215
  "x-forwarded-proto"
211
216
  ];
217
+ var PASSTHROUGH_QUERY_DENYLIST = ["env"];
218
+ function deniedPassthroughReason(entry) {
219
+ if (entry.in === "header" && PASSTHROUGH_HEADER_DENYLIST.includes(entry.name.toLowerCase()))
220
+ return `The ${entry.name} header cannot be forwarded`;
221
+ if (entry.in === "query" && PASSTHROUGH_QUERY_DENYLIST.includes(entry.name))
222
+ return `The ${entry.name} query parameter picks the environment and cannot be forwarded`;
223
+ return void 0;
224
+ }
212
225
  var passthroughAuthEntrySchema = external_exports.object({
213
226
  in: external_exports.enum(["header", "query"]),
214
227
  name: external_exports.string().min(1, "Name is required").max(PASSTHROUGH_NAME_MAX_LENGTH, "Name is too long").regex(PASSTHROUGH_NAME_REGEX, "Invalid character in name")
@@ -224,10 +237,11 @@ var passthroughAuthListSchema = external_exports.array(passthroughAuthEntrySchem
224
237
  path: [index, "name"]
225
238
  });
226
239
  seen.add(key);
227
- if (entry.in === "header" && PASSTHROUGH_HEADER_DENYLIST.includes(entry.name.toLowerCase()))
240
+ const denied = deniedPassthroughReason(entry);
241
+ if (denied)
228
242
  ctx.addIssue({
229
243
  code: "custom",
230
- message: `The ${entry.name} header cannot be forwarded`,
244
+ message: denied,
231
245
  path: [index, "name"]
232
246
  });
233
247
  });
@@ -298,7 +312,7 @@ var keyDocumentSchema = zod_default.object({
298
312
  documentId: zod_default.uuid()
299
313
  }).meta({ id: "key-documents" });
300
314
 
301
- // ../../node_modules/.pnpm/@scalar+helpers@0.12.0/node_modules/@scalar/helpers/dist/http/http-methods.js
315
+ // ../../node_modules/.pnpm/@scalar+helpers@0.15.0/node_modules/@scalar/helpers/dist/http/http-methods.js
302
316
  var HTTP_METHODS = ["delete", "get", "head", "options", "patch", "post", "put", "query", "trace"];
303
317
  var httpMethods = Object.freeze(new Set(HTTP_METHODS));
304
318
 
@@ -2,15 +2,17 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  ConfigVersion,
4
4
  SidebarType
5
- } from "./chunk-OQKDBLOZ.js";
5
+ } from "./chunk-5JLVQVKO.js";
6
6
  import {
7
7
  require_dist
8
8
  } from "./chunk-K74E42RV.js";
9
9
  import {
10
10
  getLegacyWysiwygVersion
11
- } from "./chunk-MNLXYOVF.js";
11
+ } from "./chunk-KCCFN4F7.js";
12
12
  import {
13
+ emailSchema,
13
14
  external_exports,
15
+ namespaceSchema,
14
16
  nanoid,
15
17
  nanoidSchema,
16
18
  randomSlug,
@@ -62102,6 +62104,58 @@ var require_vue = __commonJS({
62102
62104
  }
62103
62105
  });
62104
62106
 
62107
+ // ../../packages/entities/dist/user-info/schema.js
62108
+ var userGroupSchema = external_exports.string().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/, {
62109
+ message: "Group names may contain letters, digits, underscores, dots, colons, and hyphens, and must start with a letter or digit."
62110
+ }).meta({ id: "user-group" });
62111
+ var MAX_USER_INFO_GROUPS = 100;
62112
+ var MAX_USER_INFO_CONTENT_KEYS = 100;
62113
+ var playgroundInputValuesSchema = external_exports.record(external_exports.string().min(1).max(200), external_exports.string().max(4096));
62114
+ var apiPlaygroundInputsSchema = external_exports.object({
62115
+ header: playgroundInputValuesSchema.optional(),
62116
+ query: playgroundInputValuesSchema.optional(),
62117
+ cookie: playgroundInputValuesSchema.optional(),
62118
+ path: playgroundInputValuesSchema.optional(),
62119
+ server: playgroundInputValuesSchema.optional()
62120
+ }).meta({ id: "api-playground-inputs" });
62121
+ var userInfoSchema = external_exports.object({
62122
+ /**
62123
+ * Unix seconds after which the stored context is stale and the hook is
62124
+ * asked again. Absent means the hosting default TTL applies.
62125
+ */
62126
+ expiresAt: external_exports.number().int().positive().optional(),
62127
+ /** Groups that gate navigation entries and content blocks. */
62128
+ groups: external_exports.array(userGroupSchema).max(MAX_USER_INFO_GROUPS).optional(),
62129
+ /**
62130
+ * Free-form values a page can render, such as a first name or plan.
62131
+ * Keys are capped in length and count; total size is bounded by the
62132
+ * response cap core applies when it reads the hook.
62133
+ */
62134
+ content: external_exports.record(external_exports.string().min(1).max(64), external_exports.unknown()).refine((value) => Object.keys(value).length <= MAX_USER_INFO_CONTENT_KEYS, {
62135
+ message: `content may hold at most ${MAX_USER_INFO_CONTENT_KEYS} keys`
62136
+ }).optional(),
62137
+ /** Values that prefill the API playground. Visible to the browser. */
62138
+ apiPlaygroundInputs: apiPlaygroundInputsSchema.optional()
62139
+ }).meta({ id: "user-info" });
62140
+ var userInfoUserSchema = userInfoSchema.extend({
62141
+ email: emailSchema,
62142
+ groups: external_exports.array(userGroupSchema).max(MAX_USER_INFO_GROUPS).default([])
62143
+ }).meta({ id: "user-info-user" });
62144
+ var userInfoResponseSchema = external_exports.object({
62145
+ user: userInfoUserSchema.nullable()
62146
+ }).meta({ id: "user-info-response" });
62147
+ var USER_INFO_HOOK_EVENT = "user.info";
62148
+ var userInfoHookRequestSchema = external_exports.object({
62149
+ type: external_exports.literal(USER_INFO_HOOK_EVENT),
62150
+ /** The email hosting verified through a magic link, social login, or SSO. */
62151
+ email: emailSchema,
62152
+ /** The docs host the visitor signed in on. */
62153
+ host: external_exports.string(),
62154
+ project: external_exports.object({ uid: external_exports.string() }),
62155
+ /** Unix seconds when the request was signed. */
62156
+ timestamp: external_exports.number().int()
62157
+ }).meta({ id: "user-info-hook-request" });
62158
+
62105
62159
  // ../../packages/scalar-config/dist/schema/utility.js
62106
62160
  var jsonRef = external_exports.object({
62107
62161
  $ref: external_exports.string().describe("Internal JSON pointed to the value. Recommended to keep shared options objects in the `components` field of the configuration file.")
@@ -62114,6 +62168,7 @@ var iconSchema = external_exports.union([
62114
62168
  var titleSchema = external_exports.string().describe("Title to show use in any navigation links");
62115
62169
  var pathSchema = external_exports.string().startsWith("/");
62116
62170
  var linkSectionSchema = external_exports.string().min(1, "A section heading cannot be empty. Omit `section` instead.").describe("The column heading this link sits under inside its dropdown. A dropdown renders as a multi-column mega menu when any child names a section; consecutive children sharing a section become one column. Ignored for items outside a group.");
62171
+ var groupsSchema = userGroupSchema.array().max(MAX_USER_INFO_GROUPS).optional().describe("Groups a signed-in visitor must belong to (any of them) for this entry to show. Entries without groups are visible to everyone. Controls visibility only; the page stays reachable at its URL.");
62117
62172
 
62118
62173
  // ../../packages/scalar-config/dist/schema/navigation/header.js
62119
62174
  var HEADER_ALIGNS = ["start", "center", "end"];
@@ -62135,7 +62190,8 @@ var linkSchema = zod_default.object({
62135
62190
  to: zod_default.union([
62136
62191
  pathSchema.describe("A route path to another docs page, e.g. /about"),
62137
62192
  zod_default.url().describe("An external link, e.g. https://www.example.com")
62138
- ])
62193
+ ]),
62194
+ groups: groupsSchema
62139
62195
  });
62140
62196
  var headerSpacerSchema = zod_default.object({
62141
62197
  type: zod_default.literal("spacer").describe("Deprecated: use the align option instead")
@@ -62171,7 +62227,8 @@ var linkNavigationEntrySchema = external_exports.object({
62171
62227
  icon: iconSchema.optional(),
62172
62228
  newTab: external_exports.boolean().optional(),
62173
62229
  showInSidebar: external_exports.boolean().default(true),
62174
- hidden: external_exports.boolean().default(false).describe("Hide the link from the sidebar. Behaves like showInSidebar: false; the option exists on links for consistency with the other entry types.")
62230
+ hidden: external_exports.boolean().default(false).describe("Hide the link from the sidebar. Behaves like showInSidebar: false; the option exists on links for consistency with the other entry types."),
62231
+ groups: groupsSchema
62175
62232
  });
62176
62233
  var internalLinkNavigationEntrySchema = linkNavigationEntrySchema.extend({
62177
62234
  uid: nanoidSchema
@@ -62220,6 +62277,7 @@ var scopedApiConfigSchema = external_exports.object({
62220
62277
  baseServerURL: external_exports.string().optional()
62221
62278
  });
62222
62279
  var openapiNavigationEntryBase = external_exports.object({
62280
+ groups: groupsSchema,
62223
62281
  title: titleSchema.optional(),
62224
62282
  description: external_exports.string().optional(),
62225
62283
  /**
@@ -62330,6 +62388,7 @@ var headSchema = zod_default.object({
62330
62388
 
62331
62389
  // ../../packages/scalar-config/dist/schema/navigation/pages.js
62332
62390
  var pageFrontmatterSchema = external_exports.object({
62391
+ groups: groupsSchema,
62333
62392
  /** Primary title of the page. Will be added as an H1 if no other title is provided. Will be used in page links elements to reference the page. */
62334
62393
  title: external_exports.string().optional().describe("Primary title of the page. Will be added as an H1 if no other title is provided. Will be used in page links elements to reference the page."),
62335
62394
  /** Optional description of the page. Will be shown in the page header. */
@@ -62409,7 +62468,8 @@ var baseGroupNavigationEntrySchema = external_exports.object({
62409
62468
  */
62410
62469
  open: external_exports.boolean().optional().describe("Optional open state of the page in the sidebar."),
62411
62470
  showInSidebar: external_exports.boolean().default(true),
62412
- hidden: external_exports.boolean().default(false).describe("Hide the group and everything under it: removed from the sidebar, excluded from the sitemap, and rendered with a noindex robots meta. Pages stay reachable at their URLs. Unlike showInSidebar: false, which only removes the sidebar entry and leaves the pages indexable.")
62471
+ hidden: external_exports.boolean().default(false).describe("Hide the group and everything under it: removed from the sidebar, excluded from the sitemap, and rendered with a noindex robots meta. Pages stay reachable at their URLs. Unlike showInSidebar: false, which only removes the sidebar entry and leaves the pages indexable."),
62472
+ groups: groupsSchema
62413
62473
  });
62414
62474
  var childrenSchema = external_exports.record(external_exports.string(), external_exports.union([
62415
62475
  external_exports.lazy(() => groupNavigationEntrySchema),
@@ -62610,6 +62670,12 @@ var siteConfigSchema = external_exports.object({
62610
62670
  accessGroups: slugSchema.array().max(50).optional().describe("Slugs of access groups permitted to view the site when isPrivate is true."),
62611
62671
  /** The login portal slug for the site. References a created login portal from dashboard.scalar.com */
62612
62672
  loginPortal: slugSchema.optional(),
62673
+ /**
62674
+ * HTTPS endpoint Scalar asks about each signed-in visitor, signed with the
62675
+ * project's secret from the dashboard. Works on public and private sites;
62676
+ * on a public site it also enables the sign-in flow.
62677
+ */
62678
+ userInfoHook: external_exports.url({ protocol: /^https$/ }).optional().describe("HTTPS endpoint that personalizes the site for signed-in visitors. Scalar POSTs a signed request for each visitor and applies the groups, values, and playground inputs it returns."),
62613
62679
  /** Global layout options to hide/show select elements */
62614
62680
  layout: external_exports.object({
62615
62681
  toc: external_exports.boolean().optional(),
@@ -62637,6 +62703,15 @@ var siteConfigSchema = external_exports.object({
62637
62703
  routing: routingSchema.optional(),
62638
62704
  /** Head options for the site (meta, scripts, etc-) */
62639
62705
  head: headSchema.optional(),
62706
+ /** Open Graph card generation. */
62707
+ og: external_exports.object({
62708
+ imageTemplate: external_exports.string().refine((value) => value.endsWith(".tsx") || value.endsWith(".jsx"), 'The OG image template must point to a ".tsx" or ".jsx" file.').refine((value) => !URL.canParse(value), "The OG image template must be a path inside the project, not a URL.").refine((value) => (
62709
+ // Every absolute form, including the Windows ones a POSIX build
62710
+ // host would otherwise read as an ordinary filename: a leading
62711
+ // separator of either kind, a drive letter, and a UNC share.
62712
+ !/^[/\\]/.test(value) && !/^[a-zA-Z]:/.test(value) && !value.split(/[\\/]/).some((segment) => segment === "..")
62713
+ ), "The OG image template must be a relative path inside the project.").describe("Path to a Satori component rendered as the Open Graph card image for each page. Replaces the built-in card.")
62714
+ }).optional().describe("Customize the generated Open Graph card images."),
62640
62715
  /** RSS feed configuration for changelog-style content */
62641
62716
  rss: external_exports.union([rssFeedSchema, external_exports.array(rssFeedSchema)]).refine(hasUniqueFeedPaths, "Each RSS feed must have a unique path.").optional().describe("Generate an RSS feed at <path>/rss.xml from a changelog. Pass one feed, or a list of feeds to publish several from different paths."),
62642
62717
  /** Color scheme toggle configuration */
@@ -62653,7 +62728,8 @@ var siteConfigSchema = external_exports.object({
62653
62728
  suggestions: external_exports.array(external_exports.string()).optional().describe("Suggested questions shown as pills above the chat input when it is focused. Two or three short questions work best."),
62654
62729
  mcp: external_exports.object({
62655
62730
  url: external_exports.url({ protocol: /^https?$/ }).optional().describe("Absolute http(s) URL of a custom MCP server the docs install buttons point at. Overrides the site's own /mcp endpoint and the serverSlug/installationSlug binding. No auth header is sent, so protected servers must use client-side OAuth."),
62656
- serverSlug: slugSchema.optional().describe("Slug of the MCP server (scoped to the team)."),
62731
+ namespace: namespaceSchema.optional().describe("Namespace the MCP server is published under. Only needed when the team uses more than one namespace, since a server slug is unique per namespace."),
62732
+ serverSlug: slugSchema.optional().describe("Slug of the MCP server (scoped to the namespace)."),
62657
62733
  installationSlug: slugSchema.optional().describe("Slug of the MCP installation (scoped to the MCP server).")
62658
62734
  }).optional().describe("Binds the docs project to an MCP: either a custom server URL, or an MCP server + installation referenced by slug (resolved on publish).")
62659
62735
  }).optional().describe("Ask AI agent configuration"),