@scalar/cli 2.10.0 → 2.11.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 (99) hide show
  1. package/README.md +82 -1290
  2. package/chunks/{action-YSVTZVKV.js → action-25QMCP5G.js} +37 -26
  3. package/chunks/{action-X7BA7PQQ.js → action-2VF6LODL.js} +20 -18
  4. package/chunks/{action-5N3P43MD.js → action-5I4XDPPG.js} +16 -15
  5. package/chunks/action-6M5PTDF6.js +100 -0
  6. package/chunks/{action-PAM2EZ22.js → action-73ELLN3T.js} +8 -7
  7. package/chunks/{action-XOADBXSX.js → action-7H3AWCHX.js} +17 -16
  8. package/chunks/{action-KDUFU7TZ.js → action-BRSLSOE5.js} +19 -16
  9. package/chunks/{action-7XOHYWYM.js → action-CQQCKSNS.js} +13 -15
  10. package/chunks/action-D5QWDNQ2.js +65 -0
  11. package/chunks/{action-5RL4NWUZ.js → action-DQDHBOLJ.js} +33 -30
  12. package/chunks/{action-DKDRAIKV.js → action-EYPYQQVM.js} +13 -15
  13. package/chunks/{action-ZFI77WA5.js → action-FMA5ECUA.js} +10 -10
  14. package/chunks/{action-DTEO4YNX.js → action-GXDJLF2G.js} +13 -11
  15. package/chunks/{action-657A4K2D.js → action-HUICEXJZ.js} +26 -23
  16. package/chunks/action-IH6G77C5.js +38 -0
  17. package/chunks/{action-H3RTILLM.js → action-IIQMZVRJ.js} +1 -1
  18. package/chunks/action-IQM54ITT.js +164 -0
  19. package/chunks/{action-EAUTQ77U.js → action-J5TO3UJW.js} +26 -24
  20. package/chunks/{action-UUL6SWV4.js → action-KC3ZCNDR.js} +12 -14
  21. package/chunks/{action-HT42NUUX.js → action-L7TMS3Q3.js} +40 -38
  22. package/chunks/{action-GWYYTUTM.js → action-LAAHRDSR.js} +5 -5
  23. package/chunks/{action-5LF4XYHX.js → action-LR75GHBA.js} +12 -12
  24. package/chunks/{action-PPTFYZWD.js → action-MJMLQFLT.js} +12 -12
  25. package/chunks/action-NHU4CUKT.js +130 -0
  26. package/chunks/{action-4GZI2M5B.js → action-NKTFNFU7.js} +19 -17
  27. package/chunks/{action-CB55NWAU.js → action-NMW5WPD2.js} +9 -9
  28. package/chunks/{action-GFLRD7LO.js → action-OTPXODUE.js} +8 -8
  29. package/chunks/{action-R4PGILN4.js → action-RPCDNGCI.js} +47 -36
  30. package/chunks/{action-TOBU74JH.js → action-RQCXSJPZ.js} +51 -27
  31. package/chunks/{action-JEYDBB3P.js → action-SOYSVG67.js} +15 -15
  32. package/chunks/action-Y7EBKCUU.js +16 -0
  33. package/chunks/{action-XLE37MZL.js → action-YN4TE7TG.js} +23 -22
  34. package/chunks/{action-CABLS46Q.js → action-ZGNVWTHZ.js} +11 -11
  35. package/chunks/{action-4W5GUGEG.js → action-ZKKRPLDK.js} +20 -19
  36. package/chunks/{action-ZKA3RR3S.js → action-ZUZL7R3H.js} +18 -17
  37. package/chunks/{actions-3SAMH7A5.js → actions-S6K76HCW.js} +23 -20
  38. package/chunks/{agent-2ESZI7NO.js → agent-IRNEV4K5.js} +44 -9
  39. package/chunks/{asyncapi-4HGVM3PR.js → asyncapi-WQPIQMEZ.js} +13 -12
  40. package/chunks/{build.action-VBGFGACM.js → build.action-CLBVKFWD.js} +28 -26
  41. package/chunks/chunk-25XERWCE.js +1058 -0
  42. package/chunks/{chunk-35Z7VTJT.js → chunk-3RIUDHLG.js} +52 -38
  43. package/chunks/{chunk-ZYBLQ5CT.js → chunk-3TFOA64C.js} +9 -4
  44. package/chunks/{chunk-CWVYOXXM.js → chunk-4JKXZ5CF.js} +11 -7
  45. package/chunks/{chunk-XAGJJNQW.js → chunk-5L7V7RCH.js} +10 -10
  46. package/chunks/{chunk-KZNRQVMY.js → chunk-ALYM4ZB2.js} +1 -1
  47. package/chunks/chunk-AVZFSWPD.js +37 -0
  48. package/chunks/{chunk-GYRQPDTK.js → chunk-BQYVSPAI.js} +14 -2
  49. package/chunks/{chunk-UDBSV3CK.js → chunk-CSSTCHHF.js} +6083 -4167
  50. package/chunks/{chunk-ZGNDXPLU.js → chunk-DQD2753S.js} +3 -3
  51. package/chunks/{action-F2ZJNURT.js → chunk-EBNFCIKS.js} +7 -10
  52. package/chunks/{chunk-ATNTXKMS.js → chunk-F3OPMYME.js} +118 -38
  53. package/chunks/{chunk-KHF2QXBG.js → chunk-FG5AOTDN.js} +1433 -641
  54. package/chunks/{chunk-K2HIB5BA.js → chunk-GKCVATQJ.js} +3 -3
  55. package/chunks/{chunk-BIMLCGKS.js → chunk-GMHIK5K2.js} +1 -1
  56. package/chunks/{chunk-5SMP756H.js → chunk-GYR5E6RB.js} +2 -2
  57. package/chunks/{chunk-MC4EMNOR.js → chunk-HZN6IIPZ.js} +7 -6
  58. package/chunks/{chunk-VVRUSQCY.js → chunk-I57ID5K7.js} +13 -0
  59. package/chunks/{chunk-VYFGRLVQ.js → chunk-KOD2HX5I.js} +1 -1
  60. package/chunks/{chunk-ZKJPLWRJ.js → chunk-LOLVJNI5.js} +4 -4
  61. package/chunks/{chunk-GLWTVLKM.js → chunk-MN2AFJXM.js} +9 -2
  62. package/chunks/{chunk-WB6PWTMU.js → chunk-N5CJ5MTY.js} +1 -1
  63. package/chunks/{chunk-JXGF5EHC.js → chunk-NWJ37GI2.js} +23 -13
  64. package/chunks/{chunk-3ZJYGGAA.js → chunk-ORCUZITN.js} +1 -1
  65. package/chunks/{chunk-H467HDVV.js → chunk-QMLRYD76.js} +1 -1
  66. package/chunks/{chunk-43WALAW3.js → chunk-SEURG74P.js} +64 -115
  67. package/chunks/{chunk-G4HRW2FZ.js → chunk-SOV4POMS.js} +366 -253
  68. package/chunks/chunk-T34TL6KL.js +222 -0
  69. package/chunks/{chunk-WDIWLXLV.js → chunk-U6VE6JOS.js} +3 -3
  70. package/chunks/{chunk-MMWSCTDB.js → chunk-UFSFY7Z4.js} +19 -19
  71. package/chunks/{chunk-WIEXQUTD.js → chunk-ULRJZXMS.js} +1 -1
  72. package/chunks/{chunk-DHZW7Q7U.js → chunk-US54KYOJ.js} +2 -4
  73. package/chunks/{chunk-36LXIJIZ.js → chunk-V6LUKXBV.js} +1 -16
  74. package/chunks/{chunk-6M7TL2G2.js → chunk-VRZSDUZK.js} +45 -5
  75. package/chunks/chunk-VUXPDHTQ.js +22 -0
  76. package/chunks/chunk-XP5UM7SF.js +21 -0
  77. package/chunks/{chunk-IPZP3VRA.js → chunk-Y6XGC4K5.js} +5 -21
  78. package/chunks/{create.action-DBNIS665.js → create.action-ITEOQ644.js} +34 -32
  79. package/chunks/{delete.action-K7BLK7DK.js → delete.action-77MFPLUN.js} +29 -27
  80. package/chunks/{delete.action-GBOZC45K.js → delete.action-C6VX4S5Q.js} +30 -28
  81. package/chunks/{get.action-N3JOY3OU.js → get.action-3BP4FHZC.js} +16 -15
  82. package/chunks/{get.action-QHKMYZBK.js → get.action-LNBOWUVE.js} +24 -20
  83. package/chunks/{list.action-6SSO3JVN.js → list.action-6CRFQPJT.js} +39 -29
  84. package/chunks/{list.action-TJCS6UEY.js → list.action-KR5YIDR4.js} +37 -26
  85. package/chunks/{publish.action-T24VHRMR.js → publish.action-YBORRPBM.js} +45 -43
  86. package/chunks/{scripts-VIBLGKYG.js → scripts-6CI6U32J.js} +1 -1
  87. package/chunks/{update.action-VOE6PH5F.js → update.action-O7TSXDGV.js} +29 -27
  88. package/chunks/{update.action-OGYNBXRU.js → update.action-QZI7M2MV.js} +30 -28
  89. package/index.js +283 -278
  90. package/package.json +2 -2
  91. package/skills/scalar-cli/SKILL.md +49 -49
  92. package/template.md +66 -253
  93. package/chunks/action-FBRY5JKU.js +0 -37
  94. package/chunks/action-LYCNT3KA.js +0 -73
  95. package/chunks/action-OJ2NK25F.js +0 -121
  96. package/chunks/action-U2L5DCFG.js +0 -91
  97. package/chunks/chunk-MNNGUUKJ.js +0 -405
  98. package/chunks/chunk-ZGVZU6L2.js +0 -422
  99. package/docs.html +0 -6977
@@ -0,0 +1,164 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ projectDetails
4
+ } from "./chunk-6PSYZO3U.js";
5
+ import {
6
+ formatListTime
7
+ } from "./chunk-XP5UM7SF.js";
8
+ import "./chunk-AEFPCC4U.js";
9
+ import {
10
+ getPublishUrl
11
+ } from "./chunk-UFSFY7Z4.js";
12
+ import {
13
+ BaseCollections
14
+ } from "./chunk-NWJ37GI2.js";
15
+ import {
16
+ getDatabaseClient
17
+ } from "./chunk-U6VE6JOS.js";
18
+ import {
19
+ apiService
20
+ } from "./chunk-F3OPMYME.js";
21
+ import "./chunk-FG5AOTDN.js";
22
+ import "./chunk-SEURG74P.js";
23
+ import "./chunk-3TFOA64C.js";
24
+ import "./chunk-5ENKYZA4.js";
25
+ import "./chunk-Y6XGC4K5.js";
26
+ import "./chunk-SOV4POMS.js";
27
+ import "./chunk-T34TL6KL.js";
28
+ import "./chunk-V6LUKXBV.js";
29
+ import "./chunk-VUXPDHTQ.js";
30
+ import {
31
+ getAuthData
32
+ } from "./chunk-3RIUDHLG.js";
33
+ import "./chunk-N5CJ5MTY.js";
34
+ import "./chunk-US54KYOJ.js";
35
+ import "./chunk-BQYVSPAI.js";
36
+ import {
37
+ publishRecordSchema
38
+ } from "./chunk-VRZSDUZK.js";
39
+ import "./chunk-4ORL4MST.js";
40
+ import "./chunk-MN2AFJXM.js";
41
+ import {
42
+ output,
43
+ printTable
44
+ } from "./chunk-T5HJUAWB.js";
45
+ import "./chunk-25XERWCE.js";
46
+ import "./chunk-AVZFSWPD.js";
47
+ import "./chunk-I57ID5K7.js";
48
+ import "./chunk-3MZYUBJ6.js";
49
+
50
+ // src/domains/project/list/action.ts
51
+ async function listAction(options) {
52
+ const client = await apiService();
53
+ const projects = [];
54
+ let cursor;
55
+ const seenCursors = /* @__PURE__ */ new Set();
56
+ do {
57
+ const response = await client.docsProject.listProjects({
58
+ limit: 200,
59
+ cursor
60
+ });
61
+ if (response.error) {
62
+ return output.error().title("Could not list projects").message(response.message).exit("error");
63
+ }
64
+ projects.push(...response.data.data);
65
+ if (!response.data.hasMore) break;
66
+ const nextCursor = response.data.nextCursor;
67
+ if (!nextCursor || seenCursors.has(nextCursor)) {
68
+ return output.error().title("Could not list all projects").message(
69
+ "The server did not return a valid continuation cursor. No partial list was printed."
70
+ ).exit("error");
71
+ }
72
+ seenCursors.add(nextCursor);
73
+ cursor = nextCursor;
74
+ } while (cursor);
75
+ const legacy = await client.github.getProjects();
76
+ if (legacy.error) {
77
+ return output.error().title("Could not list projects").message(legacy.message).exit("error");
78
+ }
79
+ const unifiedUids = new Set(projects.map((project) => project.uid));
80
+ const unifiedSlugs = new Set(projects.map((project) => project.slug));
81
+ const details = [
82
+ ...projects,
83
+ ...legacy.data.filter(
84
+ (project) => !unifiedUids.has(project.uid) && !unifiedSlugs.has(project.slug)
85
+ )
86
+ ].map(projectDetails).sort((a, b) => a.slug.localeCompare(b.slug));
87
+ if (options.json) {
88
+ console.log(JSON.stringify(details));
89
+ return;
90
+ }
91
+ if (details.length === 0) {
92
+ output.info().message("No projects found for the current team.").print();
93
+ return;
94
+ }
95
+ const deploymentUids = details.flatMap(
96
+ (project) => project.activeDeployment?.domain ? [project.activeDeployment.uid] : []
97
+ );
98
+ const urls = /* @__PURE__ */ new Map();
99
+ if (deploymentUids.length > 0) {
100
+ const auth = await getAuthData();
101
+ const database = await getDatabaseClient();
102
+ const records = await database.getMany({
103
+ collectionPath: BaseCollections.PublishRecords(auth.teamUid),
104
+ query: { uid: { $in: deploymentUids } },
105
+ schema: publishRecordSchema.array()
106
+ });
107
+ if (records.error) {
108
+ console.error(
109
+ "[WARN] Could not load project URLs. Project details are still available."
110
+ );
111
+ } else {
112
+ for (const project of details) {
113
+ const deployment = project.activeDeployment;
114
+ if (!deployment?.domain) continue;
115
+ const record = records.data.find(
116
+ (record2) => record2.uid === deployment.uid
117
+ );
118
+ if (!record) continue;
119
+ try {
120
+ urls.set(
121
+ project.uid,
122
+ getPublishUrl(
123
+ deployment.domain.replace(/^https?:\/\//, ""),
124
+ record.subpath
125
+ )
126
+ );
127
+ } catch {
128
+ urls.set(project.uid, "\u2014");
129
+ }
130
+ }
131
+ }
132
+ }
133
+ const now = Date.now();
134
+ printTable(
135
+ [
136
+ { name: "name", title: "Name", alignment: "left", maxLen: 40 },
137
+ { name: "slug", title: "Slug", alignment: "left" },
138
+ { name: "provider", title: "Source", alignment: "left" },
139
+ { name: "access", title: "Access", alignment: "left" },
140
+ { name: "url", title: "URL", alignment: "left" },
141
+ { name: "published", title: "Published", alignment: "left" }
142
+ ],
143
+ [...details].sort(
144
+ (a, b) => (b.activeDeployment?.publishedAt ?? Number.NEGATIVE_INFINITY) - (a.activeDeployment?.publishedAt ?? Number.NEGATIVE_INFINITY) || a.slug.localeCompare(b.slug)
145
+ ).map((project) => {
146
+ return {
147
+ name: project.name,
148
+ slug: project.slug,
149
+ provider: {
150
+ forgejo: "Scalar",
151
+ github: "GitHub",
152
+ bitbucket: "Bitbucket",
153
+ unlinked: "Unlinked"
154
+ }[project.provider],
155
+ access: project.isPrivate ? "Private" : "Public",
156
+ url: urls.get(project.uid) ?? "\u2014",
157
+ published: project.activeDeployment ? formatListTime(project.activeDeployment.publishedAt, now) : "\u2014"
158
+ };
159
+ })
160
+ );
161
+ }
162
+ export {
163
+ listAction
164
+ };
@@ -1,50 +1,52 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  getPublishDeploymentUrl
4
- } from "./chunk-KZNRQVMY.js";
4
+ } from "./chunk-ALYM4ZB2.js";
5
5
  import {
6
6
  getProjectDeployments
7
- } from "./chunk-ZGNDXPLU.js";
7
+ } from "./chunk-DQD2753S.js";
8
8
  import {
9
9
  resolveProject
10
10
  } from "./chunk-TSURUX4A.js";
11
11
  import {
12
12
  formatAbsoluteTime
13
13
  } from "./chunk-AEFPCC4U.js";
14
- import "./chunk-MMWSCTDB.js";
15
- import "./chunk-JXGF5EHC.js";
16
- import "./chunk-WDIWLXLV.js";
14
+ import "./chunk-UFSFY7Z4.js";
15
+ import "./chunk-NWJ37GI2.js";
16
+ import "./chunk-U6VE6JOS.js";
17
17
  import {
18
18
  apiService
19
- } from "./chunk-ATNTXKMS.js";
20
- import "./chunk-43WALAW3.js";
21
- import "./chunk-ZYBLQ5CT.js";
22
- import "./chunk-KHF2QXBG.js";
23
- import "./chunk-IPZP3VRA.js";
19
+ } from "./chunk-F3OPMYME.js";
20
+ import "./chunk-FG5AOTDN.js";
21
+ import "./chunk-SEURG74P.js";
22
+ import "./chunk-3TFOA64C.js";
24
23
  import "./chunk-5ENKYZA4.js";
25
- import "./chunk-G4HRW2FZ.js";
26
- import "./chunk-36LXIJIZ.js";
24
+ import "./chunk-Y6XGC4K5.js";
25
+ import "./chunk-SOV4POMS.js";
26
+ import "./chunk-T34TL6KL.js";
27
+ import "./chunk-V6LUKXBV.js";
28
+ import "./chunk-VUXPDHTQ.js";
27
29
  import {
28
30
  getAuthData
29
- } from "./chunk-35Z7VTJT.js";
30
- import "./chunk-WB6PWTMU.js";
31
- import "./chunk-DHZW7Q7U.js";
32
- import "./chunk-GYRQPDTK.js";
33
- import "./chunk-6M7TL2G2.js";
31
+ } from "./chunk-3RIUDHLG.js";
32
+ import "./chunk-N5CJ5MTY.js";
33
+ import "./chunk-US54KYOJ.js";
34
+ import "./chunk-BQYVSPAI.js";
35
+ import "./chunk-VRZSDUZK.js";
34
36
  import {
35
37
  requireInteractive
36
38
  } from "./chunk-EGOXR5FB.js";
37
- import "./chunk-GLWTVLKM.js";
38
39
  import "./chunk-4ORL4MST.js";
39
- import "./chunk-MNNGUUKJ.js";
40
+ import "./chunk-MN2AFJXM.js";
40
41
  import {
41
42
  output
42
43
  } from "./chunk-T5HJUAWB.js";
43
- import "./chunk-ZGVZU6L2.js";
44
+ import "./chunk-25XERWCE.js";
45
+ import "./chunk-AVZFSWPD.js";
44
46
  import {
45
47
  external_exports,
46
48
  slugSchema
47
- } from "./chunk-VVRUSQCY.js";
49
+ } from "./chunk-I57ID5K7.js";
48
50
  import "./chunk-3MZYUBJ6.js";
49
51
 
50
52
  // src/domains/project/rollback/action.ts
@@ -104,7 +106,7 @@ var rollbackArgsSchema = external_exports.object({
104
106
  async function rollbackAction(args) {
105
107
  const argsParseResult = rollbackArgsSchema.safeParse(args);
106
108
  if (argsParseResult.error) {
107
- return output.error().title("Invalid Arguments").message(argsParseResult.error.issues[0].message).exit("error");
109
+ return output.error().title("Invalid arguments").message(argsParseResult.error.issues[0].message).exit("error");
108
110
  }
109
111
  const { slug, to, yes } = argsParseResult.data;
110
112
  if (!slug) {
@@ -153,7 +155,7 @@ async function rollbackAction(args) {
153
155
  initialValue: false
154
156
  });
155
157
  if (shouldContinue !== true) {
156
- output.info().title("Rollback cancelled.").print();
158
+ output.info().title("Operation cancelled.").print();
157
159
  return;
158
160
  }
159
161
  }
@@ -191,7 +193,7 @@ function renderRollbackError(error, slug) {
191
193
  ).exit("error");
192
194
  case "target-not-found":
193
195
  return output.error().title("Build not found").message(
194
- `No deployed build with id "${error.uid}" was found. Run "scalar project deployments list --slug ${slug}" to see available builds.`
196
+ `No deployed build with ID "${error.uid}" was found. Run "scalar project deployments list --slug ${slug}" to see available builds.`
195
197
  ).exit("error");
196
198
  case "target-not-deployable":
197
199
  return output.error().title("Build cannot be made live").message(
@@ -2,21 +2,21 @@ import { createRequire as $$cR } from "node:module"; const require = $$cR(import
2
2
  import {
3
3
  getFileOrUrl,
4
4
  isDocument
5
- } from "./chunk-CWVYOXXM.js";
5
+ } from "./chunk-4JKXZ5CF.js";
6
6
  import {
7
7
  safeNormalize
8
- } from "./chunk-H467HDVV.js";
9
- import "./chunk-GLWTVLKM.js";
8
+ } from "./chunk-QMLRYD76.js";
10
9
  import {
11
10
  isUrl,
12
11
  isYamlFileName
13
12
  } from "./chunk-4ORL4MST.js";
14
- import "./chunk-MNNGUUKJ.js";
13
+ import "./chunk-MN2AFJXM.js";
15
14
  import {
16
15
  output
17
16
  } from "./chunk-T5HJUAWB.js";
18
- import "./chunk-ZGVZU6L2.js";
19
- import "./chunk-VVRUSQCY.js";
17
+ import "./chunk-25XERWCE.js";
18
+ import "./chunk-AVZFSWPD.js";
19
+ import "./chunk-I57ID5K7.js";
20
20
  import "./chunk-3MZYUBJ6.js";
21
21
 
22
22
  // src/domains/document/format/action.ts
@@ -26,13 +26,13 @@ import { stringify } from "yaml";
26
26
  async function formatAction(inputArgument, { output: outputPath }) {
27
27
  const startTime = performance.now();
28
28
  if (!inputArgument) {
29
- return output.error().title("Invalid argument").message("Please provide a file path").exit("error");
29
+ return output.error().title("Missing input").message("Provide an API description file path or URL.").exit("error");
30
30
  }
31
31
  const content = await getFileOrUrl(inputArgument);
32
32
  const document = safeNormalize(content);
33
33
  if (!isDocument(document)) {
34
34
  return output.error().title("Invalid input").message(
35
- "Could not read a document from the input. Please provide a valid JSON or YAML file."
35
+ "Could not read a document from the input. Provide a valid JSON or YAML file."
36
36
  ).exit("error");
37
37
  }
38
38
  const newContent = isYamlFileName(outputPath || inputArgument) ? stringify(document) : JSON.stringify(document, null, 2);
@@ -41,16 +41,14 @@ async function formatAction(inputArgument, { output: outputPath }) {
41
41
  } else if (!isUrl(inputArgument)) {
42
42
  fs.writeFileSync(inputArgument, newContent, "utf8");
43
43
  } else {
44
- return output.error().title("Invalid argument").message().message(
45
- "Output file is required for URLs. Try passing --output file flag."
46
- ).exit("error");
44
+ return output.error().title("Missing input").message().message("URL input requires an output file. Use `--output <file>`.").exit("error");
47
45
  }
48
46
  const endTime = performance.now();
49
47
  output.info().line(
50
- `${as.green("File formatted")} ${as.grey(
51
- `in ${as.white(`${as.bold(`${Math.round(endTime - startTime)}`)} ms`)}`
48
+ `${as.green("API description formatted")} ${as.grey(
49
+ `(${as.white(`${as.bold(`${Math.round(endTime - startTime)}`)} ms`)})`
52
50
  )}`
53
- ).print();
51
+ ).line(`Written to ${as.cyan(outputPath ?? inputArgument)}`).print();
54
52
  }
55
53
  export {
56
54
  formatAction
@@ -1,68 +1,70 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ registry
4
+ } from "./chunk-UFSFY7Z4.js";
2
5
  import {
3
6
  dashboardUrl,
4
7
  registryUrl
5
- } from "./chunk-5SMP756H.js";
6
- import {
7
- registry
8
- } from "./chunk-MMWSCTDB.js";
8
+ } from "./chunk-GYR5E6RB.js";
9
9
  import {
10
10
  getFileOrUrl,
11
11
  isDocument
12
- } from "./chunk-CWVYOXXM.js";
12
+ } from "./chunk-4JKXZ5CF.js";
13
13
  import {
14
14
  safeNormalize
15
- } from "./chunk-H467HDVV.js";
15
+ } from "./chunk-QMLRYD76.js";
16
16
  import {
17
17
  DEFAULT_FETCH_CONCURRENCY
18
- } from "./chunk-MC4EMNOR.js";
18
+ } from "./chunk-HZN6IIPZ.js";
19
19
  import "./chunk-DFOZG7ZV.js";
20
20
  import {
21
21
  BaseCollections
22
- } from "./chunk-JXGF5EHC.js";
22
+ } from "./chunk-NWJ37GI2.js";
23
23
  import {
24
24
  getDatabaseClient
25
- } from "./chunk-WDIWLXLV.js";
25
+ } from "./chunk-U6VE6JOS.js";
26
26
  import {
27
27
  apiService
28
- } from "./chunk-ATNTXKMS.js";
29
- import "./chunk-43WALAW3.js";
30
- import "./chunk-ZYBLQ5CT.js";
31
- import "./chunk-KHF2QXBG.js";
32
- import "./chunk-IPZP3VRA.js";
28
+ } from "./chunk-F3OPMYME.js";
29
+ import "./chunk-FG5AOTDN.js";
30
+ import "./chunk-SEURG74P.js";
31
+ import "./chunk-3TFOA64C.js";
33
32
  import "./chunk-5ENKYZA4.js";
34
- import "./chunk-G4HRW2FZ.js";
35
- import "./chunk-36LXIJIZ.js";
33
+ import "./chunk-Y6XGC4K5.js";
34
+ import "./chunk-SOV4POMS.js";
35
+ import "./chunk-T34TL6KL.js";
36
+ import "./chunk-V6LUKXBV.js";
37
+ import "./chunk-VUXPDHTQ.js";
36
38
  import {
37
39
  getAuthData
38
- } from "./chunk-35Z7VTJT.js";
39
- import "./chunk-WB6PWTMU.js";
40
- import "./chunk-DHZW7Q7U.js";
40
+ } from "./chunk-3RIUDHLG.js";
41
+ import "./chunk-N5CJ5MTY.js";
42
+ import "./chunk-US54KYOJ.js";
41
43
  import {
42
44
  teamSchema
43
- } from "./chunk-GYRQPDTK.js";
44
- import "./chunk-6M7TL2G2.js";
45
+ } from "./chunk-BQYVSPAI.js";
46
+ import "./chunk-VRZSDUZK.js";
45
47
  import {
46
48
  requireInteractive
47
49
  } from "./chunk-EGOXR5FB.js";
48
- import {
49
- RegistryAsset
50
- } from "./chunk-GLWTVLKM.js";
51
50
  import {
52
51
  isUrl
53
52
  } from "./chunk-4ORL4MST.js";
54
- import "./chunk-MNNGUUKJ.js";
53
+ import {
54
+ RegistryAsset
55
+ } from "./chunk-MN2AFJXM.js";
55
56
  import {
56
57
  output
57
58
  } from "./chunk-T5HJUAWB.js";
58
- import "./chunk-ZGVZU6L2.js";
59
+ import "./chunk-25XERWCE.js";
60
+ import "./chunk-AVZFSWPD.js";
59
61
  import {
60
62
  docVersionSchema,
61
63
  external_exports,
62
64
  namespaceSchema,
63
65
  slugSchema,
64
66
  toAsciiSlug
65
- } from "./chunk-VVRUSQCY.js";
67
+ } from "./chunk-I57ID5K7.js";
66
68
  import "./chunk-3MZYUBJ6.js";
67
69
 
68
70
  // src/domains/registry/publish/action.ts
@@ -74,7 +76,7 @@ import { fetchUrls, readFiles } from "@scalar/json-magic/bundle/plugins/node";
74
76
  async function publishAction(file, args) {
75
77
  const { error, data } = external_exports.object({
76
78
  slug: slugSchema.optional(),
77
- file: external_exports.string().min(1, "Please provide a valid file path or URL for your document.").optional(),
79
+ file: external_exports.string().min(1, "Provide a valid file path or URL for your document.").optional(),
78
80
  namespace: namespaceSchema.optional(),
79
81
  version: docVersionSchema.optional(),
80
82
  private: external_exports.coerce.boolean(),
@@ -110,11 +112,11 @@ async function publishAction(file, args) {
110
112
  schema: teamSchema
111
113
  });
112
114
  if (team.error)
113
- return output.error().title("An error occurred when fetching your team.").message(team.message).exit("error");
115
+ return output.error().title("Could not load the current team").message(team.message).exit("error");
114
116
  const namespace = data.namespace || team.data.namespaces.at(0);
115
117
  if (!namespace) {
116
118
  return output.error().title("Missing namespace").message(
117
- "Could not find a valid namespace for your API. Please specify a namespace or contact support."
119
+ "No team namespace is selected. Pass --namespace <namespace> or run `scalar team get` to see available namespaces."
118
120
  ).exit("error");
119
121
  }
120
122
  const client = await apiService();
@@ -122,13 +124,13 @@ async function publishAction(file, args) {
122
124
  if (namespaceApisRes.error)
123
125
  return output.error().title(namespaceApisRes.message).exit("error");
124
126
  if (!data.file) {
125
- requireInteractive("Please provide a file path or URL.");
127
+ requireInteractive("Provide a file path or URL.");
126
128
  }
127
129
  const apiFile = data.file || (await text({
128
- message: "Please enter a file path or URL for your document",
130
+ message: "Enter a file path or URL for your document",
129
131
  placeholder: "./api.yaml",
130
132
  validate(value) {
131
- if (value.length === 0) return "File path or URL is required!";
133
+ if (value.length === 0) return "A file path or URL is required.";
132
134
  }
133
135
  })).toString();
134
136
  const content = await getFileOrUrl(apiFile);
@@ -159,18 +161,18 @@ async function publishAction(file, args) {
159
161
  );
160
162
  if (!parsedVersion.data) {
161
163
  requireInteractive(
162
- "Please provide --version or a document with a valid info.version."
164
+ "Provide --version or a document with a valid info.version."
163
165
  );
164
166
  }
165
167
  const version = parsedVersion.data || (await text({
166
- message: "What is the version of your document (e.g. 0.1.0)?",
168
+ message: "Enter the version (for example, 0.1.0)",
167
169
  validate(value) {
168
170
  if (value.length === 0) return "Version is required.";
169
171
  if (docVersionSchema.safeParse(value)?.error)
170
172
  return "Version must be a non-empty string";
171
173
  }
172
174
  })).toString();
173
- const logger = output.info().line().loader(`Publishing ${apiSlug} to Scalar registry...`);
175
+ const logger = output.info().line().loader(`Publishing ${apiSlug} to the Scalar Registry\u2026`);
174
176
  const matchingApi = namespaceApisRes.data.find((api2) => api2.slug === apiSlug);
175
177
  const document = JSON.stringify(bundledDocument);
176
178
  const publishRes = matchingApi ? await client.managedDocs.addVersion(namespace, apiSlug, {
@@ -189,14 +191,14 @@ async function publishAction(file, args) {
189
191
  if (publishRes.error)
190
192
  return output.error().title(publishRes.message).exit("error");
191
193
  logger.update("loader", 0, {
192
- content: `Successfully published v${version} for ${apiSlug}.`
194
+ content: `Published ${apiSlug} version ${version}.`
193
195
  }).line().print();
194
196
  const api = registry(namespace).apis(apiSlug);
195
197
  const apiUrl = dashboardUrl(
196
198
  RegistryAsset.Apis,
197
199
  matchingApi?.uid ?? publishRes.data.uid
198
200
  );
199
- output.info().line(`${as.green("\u279C")} ${as.white.bold("View in dashboard:")}`).line(as.cyan(apiUrl)).line().line(`${as.green("\u279C")} ${as.white.bold("Registry Preview:")}`).line(as.cyan(registryUrl(api.url({ version })))).line().line(`${as.green("\u279C")} ${as.white.bold("Registry YAML:")}`).line(as.cyan(registryUrl(api.url({ version, format: "yaml" })))).line().line(`${as.green("\u279C")} ${as.white.bold("Registry JSON:")}`).line(as.cyan(registryUrl(api.url({ version, format: "json" })))).print();
201
+ output.info().line(`${as.green("\u279C")} ${as.white.bold("Scalar Dashboard:")}`).line(as.cyan(apiUrl)).line().line(`${as.green("\u279C")} ${as.white.bold("Scalar Registry preview:")}`).line(as.cyan(registryUrl(api.url({ version })))).line().line(`${as.green("\u279C")} ${as.white.bold("Scalar Registry YAML:")}`).line(as.cyan(registryUrl(api.url({ version, format: "yaml" })))).line().line(`${as.green("\u279C")} ${as.white.bold("Scalar Registry JSON:")}`).line(as.cyan(registryUrl(api.url({ version, format: "json" })))).print();
200
202
  }
201
203
  export {
202
204
  publishAction
@@ -4,11 +4,11 @@ import {
4
4
  downloadIsolate,
5
5
  isDiskWriteError,
6
6
  updateIsolate
7
- } from "./chunk-ZKJPLWRJ.js";
8
- import "./chunk-3ZJYGGAA.js";
9
- import "./chunk-VYFGRLVQ.js";
10
- import "./chunk-WB6PWTMU.js";
11
- import "./chunk-DHZW7Q7U.js";
7
+ } from "./chunk-LOLVJNI5.js";
8
+ import "./chunk-ORCUZITN.js";
9
+ import "./chunk-KOD2HX5I.js";
10
+ import "./chunk-N5CJ5MTY.js";
11
+ import "./chunk-US54KYOJ.js";
12
12
  import "./chunk-T5HJUAWB.js";
13
13
  import "./chunk-3MZYUBJ6.js";
14
14
  export {
@@ -1,29 +1,29 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  getFileOrUrl
4
- } from "./chunk-CWVYOXXM.js";
4
+ } from "./chunk-4JKXZ5CF.js";
5
5
  import {
6
6
  isAsyncApiContent
7
- } from "./chunk-H467HDVV.js";
7
+ } from "./chunk-QMLRYD76.js";
8
8
  import {
9
9
  config
10
- } from "./chunk-WB6PWTMU.js";
11
- import "./chunk-DHZW7Q7U.js";
12
- import "./chunk-GLWTVLKM.js";
10
+ } from "./chunk-N5CJ5MTY.js";
11
+ import "./chunk-US54KYOJ.js";
13
12
  import "./chunk-4ORL4MST.js";
14
- import "./chunk-MNNGUUKJ.js";
13
+ import "./chunk-MN2AFJXM.js";
15
14
  import {
16
15
  output
17
16
  } from "./chunk-T5HJUAWB.js";
18
- import "./chunk-ZGVZU6L2.js";
19
- import "./chunk-VVRUSQCY.js";
17
+ import "./chunk-25XERWCE.js";
18
+ import "./chunk-AVZFSWPD.js";
19
+ import "./chunk-I57ID5K7.js";
20
20
  import "./chunk-3MZYUBJ6.js";
21
21
 
22
22
  // src/domains/document/share/action.ts
23
23
  import as from "ansis";
24
24
  async function shareAction(fileArgument, { token }) {
25
25
  if (!fileArgument) {
26
- return output.error().title("Invalid argument").message("Please provide a file path").exit("error");
26
+ return output.error().title("Invalid argument").message("Provide a file path or URL.").exit("error");
27
27
  }
28
28
  const content = await getFileOrUrl(fileArgument);
29
29
  const specification = isAsyncApiContent(content) ? "AsyncAPI" : "OpenAPI";
@@ -54,7 +54,7 @@ async function shareAction(fileArgument, { token }) {
54
54
  }
55
55
  const { id, token: newToken } = data;
56
56
  const link = (pathname) => new URL(pathname, sandboxUrl).toString();
57
- output.info().line(as.green.bold(`Your ${specification} file is public.`)).line().table(
57
+ output.info().line(as.green.bold(`Your ${specification} description is public.`)).line().table(
58
58
  [
59
59
  [
60
60
  `${as.green("\u279C")} ${as.white.bold("API Reference:")}`,
@@ -76,10 +76,10 @@ async function shareAction(fileArgument, { token }) {
76
76
  ],
77
77
  { padding: 1 }
78
78
  ).line().line("Use the token to update the existing sandbox:").line().line(
79
- `${as.grey("$")} ${as.white.bold("scalar document share --token=")}${as.cyan.bold(`${newToken}`)} `
79
+ `${as.grey("$")} ${as.white.bold("scalar document share <file> --token=")}${as.cyan.bold(`${newToken}`)} `
80
80
  ).line().print();
81
81
  }).catch((error) => {
82
- output.error().title("Failed to share the file.").message(`Details: ${error}`).exit("error");
82
+ output.error().title("Could not share the API description").message(`Details: ${error}`).exit("error");
83
83
  });
84
84
  }
85
85
  export {
@@ -1,18 +1,18 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  isAsyncApiContent
4
- } from "./chunk-H467HDVV.js";
4
+ } from "./chunk-QMLRYD76.js";
5
5
  import {
6
6
  err,
7
7
  ok
8
8
  } from "./chunk-5ENKYZA4.js";
9
9
  import {
10
10
  package_default
11
- } from "./chunk-DHZW7Q7U.js";
12
- import "./chunk-GLWTVLKM.js";
13
- import "./chunk-MNNGUUKJ.js";
14
- import "./chunk-ZGVZU6L2.js";
15
- import "./chunk-VVRUSQCY.js";
11
+ } from "./chunk-US54KYOJ.js";
12
+ import "./chunk-MN2AFJXM.js";
13
+ import "./chunk-25XERWCE.js";
14
+ import "./chunk-AVZFSWPD.js";
15
+ import "./chunk-I57ID5K7.js";
16
16
  import "./chunk-3MZYUBJ6.js";
17
17
 
18
18
  // src/domains/document/lint/action.ts
@@ -1328,9 +1328,7 @@ ${coloredStatus}`;
1328
1328
  return color ? text2 : stripVTControlCharacters(text2);
1329
1329
  }
1330
1330
  const lines = [
1331
- totals.errors ? as2.red("\u2716 Issues found:") : `
1332
- ${as2.green("\u2714 No issues found!")}
1333
- `
1331
+ diagnostics.length ? (totals.errors ? as2.red : as2.yellow)("\u2716 Lint issues found:") : as2.green("\u2714 No lint issues found.")
1334
1332
  ];
1335
1333
  for (const diagnostic of selected) {
1336
1334
  lines.push(
@@ -1346,7 +1344,8 @@ ${as2.green("\u2714 No issues found!")}
1346
1344
  as2.gray("---")
1347
1345
  );
1348
1346
  }
1349
- if (ignored) lines.push(`${ignored} finding(s) ignored.`);
1347
+ if (ignored)
1348
+ lines.push(`${ignored} ${ignored === 1 ? "finding" : "findings"} ignored.`);
1350
1349
  const text = `${lines.join("\n")}
1351
1350
  `;
1352
1351
  return color ? text : stripVTControlCharacters(text);
@@ -1431,7 +1430,7 @@ function fail(message) {
1431
1430
  }
1432
1431
  async function lintAction(inputArgument, options) {
1433
1432
  if (!inputArgument) {
1434
- fail("Invalid argument\n\nPlease provide a file path\n");
1433
+ fail("Missing input\n\nProvide an API description file path or URL.\n");
1435
1434
  return;
1436
1435
  }
1437
1436
  try {
@@ -1478,7 +1477,8 @@ async function runLint(inputArgument, options) {
1478
1477
  ruleset: ruleset.data,
1479
1478
  source
1480
1479
  });
1481
- if (!result.ok) return fail(`Failed to lint the document
1480
+ if (!result.ok)
1481
+ return fail(`Could not lint the API description
1482
1482
 
1483
1483
  ${result.error}`);
1484
1484
  const diagnostics = addRelatedLocations(