@scalar/cli 2.5.1 → 2.7.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 (78) hide show
  1. package/README.md +113 -28
  2. package/chunks/{action-VTVFY2MP.js → action-4NGK5XMD.js} +38 -21
  3. package/chunks/{action-FDB7NEOK.js → action-5SK5NE7E.js} +10 -4
  4. package/chunks/{action-QE2ZQQX7.js → action-7PEQXDWT.js} +4 -4
  5. package/chunks/action-AQRPFQKI.js +231 -0
  6. package/chunks/{action-R7IMFHQ5.js → action-ATGZOWSH.js} +49 -26
  7. package/chunks/{action-XMNX5ZYT.js → action-BAQYJ6UE.js} +25 -21
  8. package/chunks/{action-M7RQKBSB.js → action-BOZNBCNZ.js} +89 -14
  9. package/chunks/{action-QPUSPD5M.js → action-BRSSC2SR.js} +7 -7
  10. package/chunks/{action-37EV4UHW.js → action-CA4QYPI6.js} +6 -6
  11. package/chunks/{action-JZLZ7ZAD.js → action-CPLH2CQ5.js} +17 -17
  12. package/chunks/{action-SQG3JAII.js → action-E4YSRFGT.js} +34 -20
  13. package/chunks/{action-CH24QGTE.js → action-EOAVVL52.js} +11 -5
  14. package/chunks/action-F2ZJNURT.js +72 -0
  15. package/chunks/{action-5IU77OII.js → action-F7A2K74G.js} +4 -4
  16. package/chunks/{action-SH4UUXPL.js → action-H6OUJWWM.js} +4 -4
  17. package/chunks/{action-SNLCIBQC.js → action-HJYZCPUN.js} +5 -5
  18. package/chunks/{action-LA6KVAXQ.js → action-JAHFRYWZ.js} +58 -9
  19. package/chunks/{action-UZQJNYK4.js → action-LPVITMWA.js} +3 -3
  20. package/chunks/{action-VC4DCVST.js → action-LVDU6YOI.js} +32 -23
  21. package/chunks/{action-4XI7XJR4.js → action-N7BA5I3E.js} +37 -12
  22. package/chunks/{action-NVSZT2ZD.js → action-NVI5DWFP.js} +6 -6
  23. package/chunks/{action-F3UX5E3M.js → action-OX2566BE.js} +32 -25
  24. package/chunks/{action-OGQSTRMX.js → action-QYGOPSTY.js} +13 -13
  25. package/chunks/{action-IUE4IOWO.js → action-RBOLLIGX.js} +82 -16
  26. package/chunks/{action-MSLBC2SO.js → action-SCOXTCPR.js} +15 -15
  27. package/chunks/{action-WFWYGY7O.js → action-SNPOOW6S.js} +20 -15
  28. package/chunks/{action-HGBBV353.js → action-SRBN7N3R.js} +10 -10
  29. package/chunks/{action-PAGJ5PWC.js → action-T5XMJXPO.js} +11 -7
  30. package/chunks/{action-G26LSVZ7.js → action-VOFDW3U2.js} +4 -4
  31. package/chunks/{action-FIXBOJEW.js → action-YRX6SN5F.js} +10 -4
  32. package/chunks/{agent-HCQRMHQ5.js → agent-ASPV3R5U.js} +4 -4
  33. package/chunks/{asyncapi-QM76O55R.js → asyncapi-H4FU6GPC.js} +10 -11
  34. package/chunks/{build.action-P7FCIMYU.js → build.action-6V6GXI3X.js} +35 -31
  35. package/chunks/{chunk-PT5TI77I.js → chunk-2DSVF5AD.js} +3 -3
  36. package/chunks/{chunk-X5T526CE.js → chunk-2PPRO2QB.js} +1 -1
  37. package/chunks/{chunk-Z2KMGFE6.js → chunk-4X47MN6Q.js} +2 -2
  38. package/chunks/{chunk-OQKDBLOZ.js → chunk-5JLVQVKO.js} +8 -0
  39. package/chunks/{chunk-VNYE4R7N.js → chunk-5UHLAJQD.js} +2 -1
  40. package/chunks/{chunk-Q7DOQHZN.js → chunk-6XWCMJDB.js} +1 -1
  41. package/chunks/{chunk-6ZMT63IV.js → chunk-6YPQGVF4.js} +1 -1
  42. package/chunks/{chunk-UGGNHILG.js → chunk-BDEPNGTO.js} +1 -1
  43. package/chunks/{chunk-HCPN3KNF.js → chunk-BIKOD3SG.js} +134 -1
  44. package/chunks/{chunk-P7H7GY5A.js → chunk-C2KAWRIX.js} +1 -1
  45. package/chunks/{chunk-M37TP6U2.js → chunk-CWCETP6H.js} +170 -5
  46. package/chunks/chunk-EGOXR5FB.js +15 -0
  47. package/chunks/{chunk-3L6DLIXJ.js → chunk-FDC2IESH.js} +3474 -1319
  48. package/chunks/{chunk-4ZDQXWBT.js → chunk-GPNB7ISG.js} +14 -1
  49. package/chunks/{chunk-24WAOKGG.js → chunk-HGOD6THU.js} +27 -18
  50. package/chunks/{chunk-4NHMAG6F.js → chunk-IMG35UXX.js} +1 -1
  51. package/chunks/{chunk-AO3F5XWR.js → chunk-ISXH6Q7I.js} +253 -9
  52. package/chunks/{chunk-CISTON3A.js → chunk-KCCFN4F7.js} +2 -2
  53. package/chunks/{chunk-F467BYYR.js → chunk-LG7IFACX.js} +38 -87
  54. package/chunks/{chunk-B2MHTD3R.js → chunk-MLSZVVTT.js} +1 -1
  55. package/chunks/{chunk-K4DTP5TV.js → chunk-OJ2EWIJH.js} +21 -2
  56. package/chunks/{chunk-LFU5ZUAP.js → chunk-QXQZVEDC.js} +105 -15
  57. package/chunks/{chunk-HPL3ZZ2P.js → chunk-R5LK6VPY.js} +72 -7
  58. package/chunks/{chunk-T7B6WNZC.js → chunk-TSURUX4A.js} +12 -3
  59. package/chunks/{chunk-7AGLC7WV.js → chunk-W24BETFG.js} +2 -2
  60. package/chunks/{chunk-GSGZHE26.js → chunk-XEDGMZJD.js} +19 -5
  61. package/chunks/{chunk-PBXZN65A.js → chunk-XXSQUBXS.js} +82 -6
  62. package/chunks/{chunk-XCSR4RIT.js → chunk-YILQODZF.js} +2 -2
  63. package/chunks/{chunk-COBPBRQF.js → chunk-ZJVYOZFB.js} +2 -2
  64. package/chunks/{create.action-HDD2WUON.js → create.action-P6DLCK4W.js} +27 -15
  65. package/chunks/{delete.action-VE66JFDS.js → delete.action-HJKRRHE2.js} +24 -15
  66. package/chunks/{delete.action-7GOZY7ID.js → delete.action-Z3GAA4ZN.js} +24 -15
  67. package/chunks/{get.action-2745EB4N.js → get.action-IT4EHAV4.js} +10 -10
  68. package/chunks/{list.action-4QDCZLSZ.js → list.action-2FU5UZNH.js} +15 -15
  69. package/chunks/{list.action-3VTXQJRA.js → list.action-WLIAO5UW.js} +13 -13
  70. package/chunks/{publish.action-ULQLZKWU.js → publish.action-T4J4DRXR.js} +48 -22
  71. package/chunks/{update.action-OROQSP2S.js → update.action-3OVS3HWC.js} +25 -16
  72. package/chunks/{update.action-6QEFP7NA.js → update.action-MY7QPSSU.js} +25 -16
  73. package/docs.html +294 -99
  74. package/index.js +436 -401
  75. package/package.json +15 -23
  76. package/skills/scalar-cli/SKILL.md +71 -0
  77. package/template.md +81 -3
  78. package/chunks/action-B3KKREWQ.js +0 -64
@@ -4,34 +4,40 @@ import {
4
4
  identityProviderRecordSchema,
5
5
  loginPortalSchema,
6
6
  managedSchema,
7
+ siteDeploySchema,
7
8
  workspaceSchema
8
- } from "./chunk-HCPN3KNF.js";
9
+ } from "./chunk-BIKOD3SG.js";
9
10
  import {
10
11
  userSchema
11
- } from "./chunk-B2MHTD3R.js";
12
+ } from "./chunk-MLSZVVTT.js";
12
13
  import {
13
14
  sdkSchema
14
- } from "./chunk-3L6DLIXJ.js";
15
+ } from "./chunk-FDC2IESH.js";
15
16
  import {
16
17
  teamSchema
17
- } from "./chunk-VNYE4R7N.js";
18
+ } from "./chunk-5UHLAJQD.js";
18
19
  import {
19
20
  activeDeploymentSchema,
20
21
  publishRecordSchema,
21
22
  themeSchema
22
- } from "./chunk-OQKDBLOZ.js";
23
+ } from "./chunk-5JLVQVKO.js";
23
24
  import {
24
25
  managedDocSchema,
25
26
  ruleSchema
26
- } from "./chunk-CISTON3A.js";
27
+ } from "./chunk-KCCFN4F7.js";
27
28
  import {
28
29
  docVersionRecordSchema
29
- } from "./chunk-Q7DOQHZN.js";
30
+ } from "./chunk-6XWCMJDB.js";
30
31
  import {
32
+ brandedUid,
31
33
  emailSchema,
32
34
  entitySchema,
33
35
  external_exports,
36
+ mintUid,
37
+ namespaceSchema,
34
38
  nanoidSchema,
39
+ timestampSchema,
40
+ unixTimestamp,
35
41
  zod_default
36
42
  } from "./chunk-IKT5F47M.js";
37
43
 
@@ -42,86 +48,17 @@ var scalarAdminSchema = entitySchema.extend({
42
48
  role: zod_default.enum(["admin", "super-admin"])
43
49
  }).meta({ id: "scalar-admin" });
44
50
 
45
- // ../../packages/entities/dist/publish/publish.js
46
- var headingRecordSchema = external_exports.object({
47
- slug: external_exports.string(),
48
- name: external_exports.string(),
49
- level: external_exports.coerce.number().int(),
50
- uid: nanoidSchema,
51
- parent: external_exports.string().optional(),
52
- isPageTitle: external_exports.boolean().optional()
53
- }).meta({ id: "heading-record" });
54
- var publishAssetSchema = external_exports.object({
55
- path: external_exports.string(),
56
- data: external_exports.string()
57
- }).meta({ id: "publish-asset" });
58
- var typesenseConfigSchema = external_exports.object({
59
- keyId: external_exports.number(),
60
- keyValue: external_exports.string(),
61
- collectionName: external_exports.string()
62
- }).meta({ id: "typesense-config" });
63
-
64
- // ../../packages/entities/dist/deploys/deploy.js
65
- var subpathSchema = external_exports.object({
66
- subpath: external_exports.string(),
67
- projectUid: external_exports.string(),
68
- /**
69
- * The project's own title, for labelling it in cross-project search.
70
- * Written on publish, so it is absent until the project next publishes.
71
- */
72
- name: external_exports.string().optional(),
73
- /**
74
- * The project's active publish, used to cache-bust its search index the
75
- * way a project already busts its own. Absent until it next publishes.
76
- */
77
- publishUid: external_exports.string().optional(),
78
- /**
79
- * Present only for sites still served by Typesense. Builds on the jsonl
80
- * search backend omit it; federated search fetches `${subpath}/search-entries.jsonl`.
81
- */
82
- typesenseConfig: typesenseConfigSchema.optional().nullable()
83
- }).meta({ id: "subpath" });
84
- var cloudflareHttpTokenSchema = external_exports.object({
85
- /** URL path, e.g. `/.well-known/pki-validation/ca3-<id>.txt` */
86
- path: external_exports.string(),
87
- /** Plain-text response body the token path must answer with */
88
- body: external_exports.string()
89
- }).meta({ id: "cloudflare-http-token" });
90
- var cloudflareHostnameStateSchema = external_exports.object({
91
- /** Custom hostname id in the Cloudflare zone */
92
- hostnameId: external_exports.string(),
93
- /** Hostname ownership status reported by Cloudflare (pending, active, …) */
94
- status: external_exports.string(),
95
- /** Certificate status reported by Cloudflare (pending_validation, active, …) */
96
- sslStatus: external_exports.string(),
97
- httpTokens: cloudflareHttpTokenSchema.array().default([]),
98
- /** Unix seconds of the reconciler run that last wrote this state */
99
- syncedAt: external_exports.number()
100
- }).meta({ id: "cloudflare-hostname-state" });
101
- var siteDeploySchema = entitySchema.extend({
102
- domain: external_exports.string(),
103
- teamUid: nanoidSchema,
104
- projectUid: nanoidSchema,
105
- /**
106
- * Title of the project mounted at the domain root.
107
- *
108
- * The root project is deliberately not one of `subpaths` — both request
109
- * matchers resolve by longest path prefix, so a '/' entry would become a
110
- * catch-all that every request matched. It is denormalized here instead so
111
- * search can name and scope it without a second lookup.
112
- */
113
- rootName: external_exports.string().optional(),
114
- subpaths: subpathSchema.array().default([]),
115
- cloudflare: cloudflareHostnameStateSchema.optional().nullable()
116
- }).meta({ id: "site-deploy" });
117
- var searchConfigRootSchema = external_exports.object({
118
- projectUid: external_exports.string(),
119
- name: external_exports.string().optional()
120
- }).meta({ id: "search-config-root" });
121
- var searchConfigResponseSchema = external_exports.object({
122
- subpaths: subpathSchema.array(),
123
- root: searchConfigRootSchema.optional()
124
- }).meta({ id: "search-config-response" });
51
+ // ../../packages/entities/dist/namespace/schema.js
52
+ var namespaceTombstoneSchema = entitySchema.extend({
53
+ uid: brandedUid().default(mintUid).meta({ default: "nanoid()" }),
54
+ namespace: namespaceSchema,
55
+ /** The team that held the name last. Only this team may claim it again. */
56
+ teamUid: brandedUid(),
57
+ /** Unix seconds at which the team gave the name up. */
58
+ releasedAt: timestampSchema.default(unixTimestamp).meta({ default: "unixTimestamp()" }),
59
+ /** The user whose action released the name. */
60
+ releasedBy: external_exports.string()
61
+ }).meta({ id: "namespace-tombstone" });
125
62
 
126
63
  // ../../packages/entities/dist/user/ban.js
127
64
  var bannedUserSchema = entitySchema.extend({
@@ -139,6 +76,9 @@ var BaseCollections = {
139
76
  HostingExchange: "hosting-exchange",
140
77
  HostingLoginTokens: "hosting-login-tokens",
141
78
  HostingOauthStates: "hosting-oauth-states",
79
+ OauthClients: "oauth-clients",
80
+ OauthAuthorizationRequests: "oauth-authorization-requests",
81
+ OauthAuthorizationCodes: "oauth-authorization-codes",
142
82
  Passwords: "passwords",
143
83
  SignupOtp: "signup-otp",
144
84
  GithubUsers: "github-users",
@@ -165,11 +105,14 @@ var BaseCollections = {
165
105
  RegistryPublishes: (teamUid) => `team/${teamUid}/registry-publishes`,
166
106
  LinkedRepositories: (teamUid) => `team/${teamUid}/repositories`,
167
107
  RegistryGitMigrations: "registry-git-migrations",
108
+ NamespaceTombstones: "namespace-tombstones",
168
109
  AccessGroups: (teamUid) => `team/${teamUid}/access-groups`,
169
110
  LoginPortals: (teamUid) => `team/${teamUid}/login-portals`,
111
+ UserInfoHookSecrets: (teamUid) => `team/${teamUid}/user-info-hook-secrets`,
170
112
  Sdks: (teamUid) => `team/${teamUid}/sdks`,
171
113
  SdkBuilds: (teamUid) => `team/${teamUid}/sdk-builds`,
172
114
  SdkBuildLogs: (teamUid) => `team/${teamUid}/sdk-build-logs`,
115
+ McpServers: (teamUid) => `team/${teamUid}/mcp-servers`,
173
116
  PersonalTokens: (userUid) => `user/${userUid}/personal-tokens`,
174
117
  IdentityProviders: (teamUid) => `team/${teamUid}/identity-providers`,
175
118
  Workspaces: (teamUid) => `team/${teamUid}/workspaces`,
@@ -181,6 +124,7 @@ var BaseCollections = {
181
124
  Waitlist: "waitlist",
182
125
  BannedUsers: "banned-users"
183
126
  };
127
+ var MONGO_PLACEHOLDER_UID = "<uid-0>";
184
128
 
185
129
  // ../../packages/entities/dist/database/edge-cache.js
186
130
  var requiredUid = { uid: nanoidSchema };
@@ -209,6 +153,7 @@ var edgeCacheDeploySchema = siteDeploySchema.omit({ cloudflare: true }).extend(r
209
153
  var edgeCacheProjectSchema = external_exports.object({
210
154
  ...requiredUid,
211
155
  loginPortalUid: external_exports.string().default(""),
156
+ userInfoHookUrl: external_exports.string().default(""),
212
157
  accessGroups: external_exports.array(external_exports.string()).default([]),
213
158
  identityProviders: external_exports.string().array().default([]),
214
159
  isPrivate: external_exports.boolean().default(false),
@@ -305,6 +250,7 @@ var edgeCacheCollections = {
305
250
  projection: {
306
251
  uid: 1,
307
252
  loginPortalUid: 1,
253
+ userInfoHookUrl: 1,
308
254
  accessGroups: 1,
309
255
  identityProviders: 1,
310
256
  isPrivate: 1,
@@ -323,6 +269,7 @@ var edgeCacheCollections = {
323
269
  projection: {
324
270
  uid: 1,
325
271
  loginPortalUid: 1,
272
+ userInfoHookUrl: 1,
326
273
  accessGroups: 1,
327
274
  identityProviders: 1,
328
275
  isPrivate: 1,
@@ -341,6 +288,7 @@ var edgeCacheCollections = {
341
288
  projection: {
342
289
  uid: 1,
343
290
  loginPortalUid: 1,
291
+ userInfoHookUrl: 1,
344
292
  accessGroups: 1,
345
293
  identityProviders: 1,
346
294
  isPrivate: 1,
@@ -563,6 +511,9 @@ for (const [key, config] of Object.entries(edgeCacheCollections)) {
563
511
  prioritiesByTable.set(config.tableName, taken);
564
512
  }
565
513
 
514
+ // ../../packages/entities/dist/database/mcp-domain-holder.js
515
+ var MCP_SERVERS_MONGO_COLLECTION = BaseCollections.McpServers(MONGO_PLACEHOLDER_UID);
516
+
566
517
  export {
567
518
  BaseCollections
568
519
  };
@@ -2,7 +2,7 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  teamImageSchema,
4
4
  teamNameSchema
5
- } from "./chunk-VNYE4R7N.js";
5
+ } from "./chunk-5UHLAJQD.js";
6
6
  import {
7
7
  brandedUid,
8
8
  emailSchema,
@@ -2,6 +2,22 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
 
3
3
  // src/domains/document/bundle/index.ts
4
4
  import { Command } from "commander";
5
+
6
+ // src/helpers/parse-integer-option.ts
7
+ import { InvalidArgumentError } from "commander";
8
+ var parseIntegerOption = (value, minimum, maximum) => {
9
+ const parsed = Number(value);
10
+ if (!/^\d+$/.test(value) || !Number.isSafeInteger(parsed) || parsed < minimum || parsed > maximum) {
11
+ throw new InvalidArgumentError(
12
+ `Expected an integer between ${minimum} and ${maximum}.`
13
+ );
14
+ }
15
+ return parsed;
16
+ };
17
+ var parsePort = (value) => parseIntegerOption(value, 0, 65535);
18
+ var parseFetchLimit = (value) => parseIntegerOption(value, 1, Number.MAX_SAFE_INTEGER);
19
+
20
+ // src/domains/document/bundle/index.ts
5
21
  var DEFAULT_FETCH_CONCURRENCY = 5;
6
22
  function BundleCommand() {
7
23
  const cmd = new Command("bundle");
@@ -17,16 +33,19 @@ function BundleCommand() {
17
33
  );
18
34
  cmd.option(
19
35
  "--fetchLimit <limit>",
20
- "Maximum number of URLs to fetch during bundling at the same time"
36
+ "Maximum number of URLs to fetch during bundling at the same time",
37
+ parseFetchLimit
21
38
  );
22
39
  cmd.action(async (...args) => {
23
- const { bundleAction } = await import("./action-CH24QGTE.js");
40
+ const { bundleAction } = await import("./action-EOAVVL52.js");
24
41
  return bundleAction(...args);
25
42
  });
26
43
  return cmd;
27
44
  }
28
45
 
29
46
  export {
47
+ parsePort,
48
+ parseFetchLimit,
30
49
  DEFAULT_FETCH_CONCURRENCY,
31
50
  BundleCommand
32
51
  };
@@ -5,10 +5,10 @@ import {
5
5
  import {
6
6
  ISOLATE_DIR,
7
7
  ISOLATE_EXTRACTION_DIR
8
- } from "./chunk-X5T526CE.js";
8
+ } from "./chunk-2PPRO2QB.js";
9
9
  import {
10
10
  config
11
- } from "./chunk-4ZDQXWBT.js";
11
+ } from "./chunk-GPNB7ISG.js";
12
12
  import {
13
13
  output
14
14
  } from "./chunk-T5HJUAWB.js";
@@ -25,6 +25,7 @@ import { nanoid } from "nanoid";
25
25
  import tar from "tar-fs";
26
26
 
27
27
  // src/domains/project/download-isolate/helpers.ts
28
+ import semver from "semver";
28
29
  var PLATFORM_TARBALL_TARGETS = /* @__PURE__ */ new Set([
29
30
  "darwin-arm64",
30
31
  "darwin-x64",
@@ -40,14 +41,38 @@ function getIsolateDownloadUrls(options) {
40
41
  if (!PLATFORM_TARBALL_TARGETS.has(target)) return [universalUrl];
41
42
  return [`${baseUrl}-${target}.tar.gz`, universalUrl];
42
43
  }
44
+ var getLatestIsolateUrl = (cdnUrl) => `${cdnUrl}/isolates/latest.json`;
45
+ var getCompatibleFallbackVersion = (version, latestVersion) => {
46
+ if (!latestVersion || latestVersion === version) return void 0;
47
+ if (!semver.valid(version) || !semver.valid(latestVersion)) return void 0;
48
+ if (semver.prerelease(latestVersion)) return void 0;
49
+ if (semver.major(latestVersion) !== semver.major(version)) return void 0;
50
+ return latestVersion;
51
+ };
43
52
 
44
53
  // src/domains/project/download-isolate/action.ts
45
54
  var execFileAsync = promisify(execFile);
46
55
  var IsolateDownloadError = class extends Error {
56
+ /**
57
+ * True when every candidate URL answered 404: the version has no published
58
+ * archive, as opposed to a network problem. `installIsolate` uses this to
59
+ * try the newest published release instead of telling the user to check
60
+ * their connection.
61
+ */
62
+ notFound;
47
63
  constructor(message, options) {
48
64
  super(message, options);
49
65
  this.name = "IsolateDownloadError";
66
+ this.notFound = options?.notFound ?? false;
67
+ }
68
+ };
69
+ var HttpStatusError = class extends Error {
70
+ constructor(status, statusText) {
71
+ super(`HTTP ${status} ${statusText}`.trim());
72
+ this.status = status;
73
+ this.name = "HttpStatusError";
50
74
  }
75
+ status;
51
76
  };
52
77
  var DOWNLOAD_TIMEOUT_MS = 10 * 60 * 1e3;
53
78
  var EXTRACTION_ALLOWANCE_MS = 5 * 60 * 1e3;
@@ -121,7 +146,7 @@ async function downloadAndExtract(url, destinationDir, options) {
121
146
  signal: AbortSignal.timeout(options.timeoutMs)
122
147
  });
123
148
  if (!response.ok) {
124
- throw new Error(`HTTP ${response.status} ${response.statusText}`.trim());
149
+ throw new HttpStatusError(response.status, response.statusText);
125
150
  }
126
151
  if (!response.body) {
127
152
  throw new Error("Response had no body");
@@ -175,17 +200,24 @@ var DISK_WRITE_ERROR_MESSAGES = [
175
200
  "read-only file system"
176
201
  // EROFS
177
202
  ];
203
+ var getErrorDetails = (error) => `${error.message} ${error.stderr ?? ""}`;
178
204
  function isDiskWriteError(error) {
179
205
  if (!(error instanceof Error)) return false;
180
206
  const code = error.code;
181
207
  if (typeof code === "string" && DISK_WRITE_ERROR_CODES.has(code)) {
182
208
  return true;
183
209
  }
184
- const details = `${error.message} ${error.stderr ?? ""}`.toLowerCase();
210
+ const details = getErrorDetails(error).toLowerCase();
185
211
  return DISK_WRITE_ERROR_MESSAGES.some((phrase) => details.includes(phrase));
186
212
  }
213
+ var isNotFoundError = (error) => {
214
+ if (error instanceof HttpStatusError) return error.status === 404;
215
+ if (!(error instanceof Error)) return false;
216
+ return /\b404\b/.test(getErrorDetails(error));
217
+ };
187
218
  async function downloadFirstAvailable(urls, destinationDir, options) {
188
219
  const failures = [];
220
+ let notFound = true;
189
221
  for (const url of urls) {
190
222
  try {
191
223
  await fs.rm(destinationDir, { recursive: true, force: true });
@@ -194,6 +226,7 @@ async function downloadFirstAvailable(urls, destinationDir, options) {
194
226
  return url;
195
227
  } catch (error) {
196
228
  if (isDiskWriteError(error)) throw error;
229
+ notFound &&= isNotFoundError(error);
197
230
  failures.push(
198
231
  ` - ${url}: ${error instanceof Error ? error.message : String(error)}`
199
232
  );
@@ -202,7 +235,8 @@ async function downloadFirstAvailable(urls, destinationDir, options) {
202
235
  throw new IsolateDownloadError(
203
236
  `Failed to download the docs preview server. Attempted:
204
237
  ${failures.join("\n")}
205
- Your existing preview server (if any) was left untouched. Check your network connection and try again.`
238
+ Your existing preview server (if any) was left untouched.` + (notFound ? "" : " Check your network connection and try again."),
239
+ { notFound }
206
240
  );
207
241
  }
208
242
  async function removeQuarantineAttributes(isolateDir) {
@@ -310,18 +344,76 @@ async function updateIsolate(options) {
310
344
  });
311
345
  }
312
346
  }
347
+ var LATEST_LOOKUP_TIMEOUT_MS = 15 * 1e3;
348
+ var fetchLatestIsolateVersion = async (cdnUrl) => {
349
+ try {
350
+ const response = await fetch(getLatestIsolateUrl(cdnUrl), {
351
+ signal: AbortSignal.timeout(LATEST_LOOKUP_TIMEOUT_MS)
352
+ });
353
+ if (!response.ok) return void 0;
354
+ const pointer = await response.json();
355
+ const version = typeof pointer === "object" && pointer !== null && "version" in pointer ? pointer.version : void 0;
356
+ return typeof version === "string" ? version : void 0;
357
+ } catch {
358
+ return void 0;
359
+ }
360
+ };
361
+ var getMissingArchiveHint = (version, fallbackVersion) => {
362
+ const missing = `No docs preview server archive is published for version ${version}`;
363
+ const latestUrl = getLatestIsolateUrl(config.cdnUrl);
364
+ if (fallbackVersion) {
365
+ return `${missing}, and the newest release named by ${latestUrl}, ${fallbackVersion}, has none either. Set SSG_DOCS_ISOLATE_VERSION to the version of another released CLI and try again.`;
366
+ }
367
+ return `${missing}. Each CLI release publishes its own archive, so a local build has none until it ships. Set SSG_DOCS_ISOLATE_VERSION to the version of a released CLI (${latestUrl} names the newest one) and try again.`;
368
+ };
369
+ var isMissingArchiveError = (error) => error instanceof IsolateDownloadError && error.notFound;
370
+ var withMissingArchiveHint = (error, version, fallbackVersion) => new IsolateDownloadError(
371
+ `${error.message}
372
+
373
+ ${getMissingArchiveHint(version, fallbackVersion)}`,
374
+ { notFound: true }
375
+ );
376
+ var installIsolate = async (version, existingVersion) => {
377
+ const install = (isolateVersion) => updateIsolate({
378
+ urls: getIsolateDownloadUrls({
379
+ cdnUrl: config.cdnUrl,
380
+ version: isolateVersion,
381
+ platform: process.platform,
382
+ arch: process.arch
383
+ }),
384
+ extractionDir: ISOLATE_EXTRACTION_DIR
385
+ });
386
+ try {
387
+ await install(version);
388
+ return "Download complete.";
389
+ } catch (error) {
390
+ if (!isMissingArchiveError(error)) throw error;
391
+ const fallbackVersion = getCompatibleFallbackVersion(
392
+ version,
393
+ await fetchLatestIsolateVersion(config.cdnUrl)
394
+ );
395
+ if (!fallbackVersion) throw withMissingArchiveHint(error, version);
396
+ const notice = `no archive is published for ${version}, using the newest release, ${fallbackVersion}`;
397
+ if (fallbackVersion === existingVersion) {
398
+ return `Docs preview server ${fallbackVersion} is already installed (${notice}).`;
399
+ }
400
+ try {
401
+ await install(fallbackVersion);
402
+ } catch (fallbackError) {
403
+ throw isMissingArchiveError(fallbackError) ? withMissingArchiveHint(fallbackError, version, fallbackVersion) : fallbackError;
404
+ }
405
+ return `Download complete (${notice}).`;
406
+ }
407
+ };
313
408
  async function downloadIsolate() {
314
409
  const existingIsolateVersion = await getExistingIsolateVersion();
315
- if (config.ssgDocsIsolateVersion === existingIsolateVersion) return;
410
+ const version = config.ssgDocsIsolateVersion;
411
+ if (version === existingIsolateVersion) return;
316
412
  const logger = output.info({ animate: true }).loader("Downloading the docs preview server. This may take a minute...");
317
- const urls = getIsolateDownloadUrls({
318
- cdnUrl: config.cdnUrl,
319
- version: config.ssgDocsIsolateVersion,
320
- platform: process.platform,
321
- arch: process.arch
322
- });
323
413
  try {
324
- await updateIsolate({ urls, extractionDir: ISOLATE_EXTRACTION_DIR });
414
+ const completion = await installIsolate(version, existingIsolateVersion);
415
+ logger.update("loader", 0, { content: completion });
416
+ logger.finish();
325
417
  } catch (error) {
326
418
  const isDownloadFailure = error instanceof IsolateDownloadError;
327
419
  logger.update("loader", 0, {
@@ -338,8 +430,6 @@ async function downloadIsolate() {
338
430
  ].filter(Boolean).join("\n\n")
339
431
  ).exit("error");
340
432
  }
341
- logger.update("loader", 0, { content: "Download complete." });
342
- logger.finish();
343
433
  }
344
434
 
345
435
  export {
@@ -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-GSGZHE26.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,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-PBXZN65A.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";