@scalar/cli 2.10.0 → 2.12.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 +84 -1289
  2. package/chunks/action-2OPUQFUY.js +164 -0
  3. package/chunks/{action-4GZI2M5B.js → action-36LZ6XXE.js} +19 -17
  4. package/chunks/{action-KDUFU7TZ.js → action-3XMTJJRT.js} +19 -16
  5. package/chunks/{action-R4PGILN4.js → action-6CLEENBI.js} +47 -36
  6. package/chunks/{action-ZFI77WA5.js → action-7HXYZPOT.js} +10 -10
  7. package/chunks/{action-X7BA7PQQ.js → action-AC5ENU6Z.js} +20 -18
  8. package/chunks/{action-PPTFYZWD.js → action-ADGLTNFC.js} +28 -22
  9. package/chunks/{action-7XOHYWYM.js → action-AOKHLTZ6.js} +25 -21
  10. package/chunks/{action-XOADBXSX.js → action-AVSJ3AJY.js} +17 -16
  11. package/chunks/{action-GFLRD7LO.js → action-D3IVCY24.js} +8 -8
  12. package/chunks/action-EBZJS367.js +130 -0
  13. package/chunks/{action-ZKA3RR3S.js → action-EZXHSAJ2.js} +18 -17
  14. package/chunks/{action-5LF4XYHX.js → action-FDTVHVHF.js} +12 -12
  15. package/chunks/{action-JEYDBB3P.js → action-FUO5F7NV.js} +15 -15
  16. package/chunks/{action-DKDRAIKV.js → action-HA3CMV3P.js} +13 -15
  17. package/chunks/{action-YSVTZVKV.js → action-IG3BK2LF.js} +37 -26
  18. package/chunks/{action-H3RTILLM.js → action-IIQMZVRJ.js} +1 -1
  19. package/chunks/{action-DTEO4YNX.js → action-JT6C472I.js} +13 -11
  20. package/chunks/{action-UUL6SWV4.js → action-KDT6H6ML.js} +12 -14
  21. package/chunks/{action-PAM2EZ22.js → action-KJDIJQ3A.js} +8 -7
  22. package/chunks/{action-HT42NUUX.js → action-NF5E7JKA.js} +40 -38
  23. package/chunks/{action-EAUTQ77U.js → action-NIZBME45.js} +26 -24
  24. package/chunks/{action-CB55NWAU.js → action-O757TFA2.js} +9 -9
  25. package/chunks/{action-XLE37MZL.js → action-ONR7QSN7.js} +23 -22
  26. package/chunks/{action-5RL4NWUZ.js → action-QM2BMMHG.js} +33 -30
  27. package/chunks/{action-GWYYTUTM.js → action-QVTAZCKY.js} +5 -5
  28. package/chunks/action-SLB52XRG.js +65 -0
  29. package/chunks/{action-CABLS46Q.js → action-UTFRCKGE.js} +11 -11
  30. package/chunks/{action-4W5GUGEG.js → action-VESBFIP3.js} +20 -19
  31. package/chunks/{action-657A4K2D.js → action-VGFAIFYE.js} +26 -23
  32. package/chunks/action-WCU5O2VT.js +100 -0
  33. package/chunks/{action-TOBU74JH.js → action-XS5EESHW.js} +51 -27
  34. package/chunks/action-XVNRZ5VX.js +38 -0
  35. package/chunks/action-Y7EBKCUU.js +16 -0
  36. package/chunks/{action-5N3P43MD.js → action-YWQ2OKS3.js} +16 -15
  37. package/chunks/{actions-3SAMH7A5.js → actions-6QG7LH7P.js} +23 -20
  38. package/chunks/{agent-2ESZI7NO.js → agent-ONXROEAE.js} +44 -9
  39. package/chunks/{asyncapi-4HGVM3PR.js → asyncapi-7IFXAIE3.js} +13 -12
  40. package/chunks/{build.action-VBGFGACM.js → build.action-FI4OWY3T.js} +28 -26
  41. package/chunks/{chunk-ZGNDXPLU.js → chunk-26VIHQGL.js} +3 -3
  42. package/chunks/{chunk-JXGF5EHC.js → chunk-3HCEUGOE.js} +42 -13
  43. package/chunks/{chunk-G4HRW2FZ.js → chunk-5TNKTLQP.js} +370 -254
  44. package/chunks/{chunk-XAGJJNQW.js → chunk-BB6WWG25.js} +10 -10
  45. package/chunks/{chunk-K2HIB5BA.js → chunk-BCFUMXMC.js} +3 -3
  46. package/chunks/{action-F2ZJNURT.js → chunk-EBNFCIKS.js} +7 -10
  47. package/chunks/{chunk-MC4EMNOR.js → chunk-EJSGWV2K.js} +7 -6
  48. package/chunks/{chunk-GYRQPDTK.js → chunk-FJCOYEKT.js} +139 -3
  49. package/chunks/{chunk-ZKJPLWRJ.js → chunk-HU47OMI4.js} +4 -4
  50. package/chunks/{chunk-VVRUSQCY.js → chunk-I57ID5K7.js} +13 -0
  51. package/chunks/{chunk-43WALAW3.js → chunk-JLNHOA5Z.js} +64 -115
  52. package/chunks/{chunk-5SMP756H.js → chunk-LCSU43NJ.js} +2 -2
  53. package/chunks/{chunk-KHF2QXBG.js → chunk-N645RGAB.js} +1853 -683
  54. package/chunks/{chunk-3ZJYGGAA.js → chunk-ORCUZITN.js} +1 -1
  55. package/chunks/{chunk-H467HDVV.js → chunk-PERC34BV.js} +1 -1
  56. package/chunks/chunk-Q26DFKTY.js +37 -0
  57. package/chunks/{chunk-MMWSCTDB.js → chunk-QJQTSRU4.js} +19 -19
  58. package/chunks/{chunk-WDIWLXLV.js → chunk-RLBS4HJT.js} +3 -3
  59. package/chunks/{chunk-ATNTXKMS.js → chunk-RNZVZMYC.js} +198 -42
  60. package/chunks/{chunk-IPZP3VRA.js → chunk-RYWXF3LO.js} +12 -21
  61. package/chunks/{chunk-CWVYOXXM.js → chunk-SNOAL2C5.js} +11 -7
  62. package/chunks/{chunk-UDBSV3CK.js → chunk-T3R66THO.js} +6085 -4167
  63. package/chunks/{chunk-VYFGRLVQ.js → chunk-U73OW57G.js} +1 -1
  64. package/chunks/chunk-U764PQUA.js +1034 -0
  65. package/chunks/{chunk-KZNRQVMY.js → chunk-UAFCSWQ6.js} +1 -1
  66. package/chunks/{chunk-WB6PWTMU.js → chunk-UBLFIMUA.js} +1 -1
  67. package/chunks/{chunk-WIEXQUTD.js → chunk-UODTHS76.js} +1 -1
  68. package/chunks/chunk-V3MYP5SQ.js +247 -0
  69. package/chunks/{chunk-36LXIJIZ.js → chunk-V6LUKXBV.js} +1 -16
  70. package/chunks/{chunk-6M7TL2G2.js → chunk-VRZSDUZK.js} +45 -5
  71. package/chunks/{chunk-GLWTVLKM.js → chunk-VUNOOPEG.js} +9 -2
  72. package/chunks/chunk-VUXPDHTQ.js +22 -0
  73. package/chunks/{chunk-DHZW7Q7U.js → chunk-VVQOFG76.js} +2 -4
  74. package/chunks/chunk-XP5UM7SF.js +21 -0
  75. package/chunks/{chunk-ZYBLQ5CT.js → chunk-Y6C3H27E.js} +9 -4
  76. package/chunks/{chunk-35Z7VTJT.js → chunk-YTFFBGNQ.js} +52 -38
  77. package/chunks/{chunk-BIMLCGKS.js → chunk-ZNLMQKDU.js} +1 -1
  78. package/chunks/{create.action-DBNIS665.js → create.action-PPMZEMZL.js} +34 -32
  79. package/chunks/{delete.action-GBOZC45K.js → delete.action-GDOHATRZ.js} +30 -28
  80. package/chunks/{delete.action-K7BLK7DK.js → delete.action-VAHKEHEU.js} +29 -27
  81. package/chunks/{get.action-QHKMYZBK.js → get.action-UXFTGO7W.js} +24 -20
  82. package/chunks/{get.action-N3JOY3OU.js → get.action-XON3EZDT.js} +16 -15
  83. package/chunks/{list.action-TJCS6UEY.js → list.action-24F5WDGR.js} +37 -26
  84. package/chunks/{list.action-6SSO3JVN.js → list.action-OQEAEJ5U.js} +39 -29
  85. package/chunks/{publish.action-T24VHRMR.js → publish.action-G7FPDRBZ.js} +45 -43
  86. package/chunks/{scripts-VIBLGKYG.js → scripts-6CI6U32J.js} +1 -1
  87. package/chunks/{update.action-VOE6PH5F.js → update.action-IFIFXZWA.js} +29 -27
  88. package/chunks/{update.action-OGYNBXRU.js → update.action-MJDHVVR3.js} +30 -28
  89. package/index.js +290 -284
  90. package/package.json +2 -2
  91. package/skills/scalar-cli/SKILL.md +49 -49
  92. package/template.md +68 -252
  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-QJQTSRU4.js";
12
+ import {
13
+ BaseCollections
14
+ } from "./chunk-3HCEUGOE.js";
15
+ import {
16
+ getDatabaseClient
17
+ } from "./chunk-RLBS4HJT.js";
18
+ import {
19
+ apiService
20
+ } from "./chunk-RNZVZMYC.js";
21
+ import "./chunk-N645RGAB.js";
22
+ import "./chunk-JLNHOA5Z.js";
23
+ import "./chunk-Y6C3H27E.js";
24
+ import "./chunk-5ENKYZA4.js";
25
+ import "./chunk-RYWXF3LO.js";
26
+ import "./chunk-5TNKTLQP.js";
27
+ import "./chunk-V3MYP5SQ.js";
28
+ import "./chunk-V6LUKXBV.js";
29
+ import "./chunk-VUXPDHTQ.js";
30
+ import {
31
+ getAuthData
32
+ } from "./chunk-YTFFBGNQ.js";
33
+ import "./chunk-UBLFIMUA.js";
34
+ import "./chunk-VVQOFG76.js";
35
+ import "./chunk-FJCOYEKT.js";
36
+ import {
37
+ publishRecordSchema
38
+ } from "./chunk-VRZSDUZK.js";
39
+ import "./chunk-4ORL4MST.js";
40
+ import "./chunk-VUNOOPEG.js";
41
+ import {
42
+ output,
43
+ printTable
44
+ } from "./chunk-T5HJUAWB.js";
45
+ import "./chunk-U764PQUA.js";
46
+ import "./chunk-Q26DFKTY.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,32 +1,34 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  BaseCollections
4
- } from "./chunk-JXGF5EHC.js";
4
+ } from "./chunk-3HCEUGOE.js";
5
5
  import {
6
6
  getDatabaseClient
7
- } from "./chunk-WDIWLXLV.js";
8
- import "./chunk-43WALAW3.js";
9
- import "./chunk-ZYBLQ5CT.js";
10
- import "./chunk-IPZP3VRA.js";
7
+ } from "./chunk-RLBS4HJT.js";
8
+ import "./chunk-JLNHOA5Z.js";
9
+ import "./chunk-Y6C3H27E.js";
11
10
  import "./chunk-5ENKYZA4.js";
12
- import "./chunk-36LXIJIZ.js";
11
+ import "./chunk-RYWXF3LO.js";
12
+ import "./chunk-V3MYP5SQ.js";
13
+ import "./chunk-V6LUKXBV.js";
14
+ import "./chunk-VUXPDHTQ.js";
13
15
  import {
14
16
  getAuthData
15
- } from "./chunk-35Z7VTJT.js";
16
- import "./chunk-WB6PWTMU.js";
17
- import "./chunk-DHZW7Q7U.js";
17
+ } from "./chunk-YTFFBGNQ.js";
18
+ import "./chunk-UBLFIMUA.js";
19
+ import "./chunk-VVQOFG76.js";
18
20
  import {
19
21
  teamSchema
20
- } from "./chunk-GYRQPDTK.js";
21
- import "./chunk-6M7TL2G2.js";
22
- import "./chunk-GLWTVLKM.js";
22
+ } from "./chunk-FJCOYEKT.js";
23
+ import "./chunk-VRZSDUZK.js";
23
24
  import "./chunk-4ORL4MST.js";
24
- import "./chunk-MNNGUUKJ.js";
25
+ import "./chunk-VUNOOPEG.js";
25
26
  import {
26
27
  output
27
28
  } from "./chunk-T5HJUAWB.js";
28
- import "./chunk-ZGVZU6L2.js";
29
- import "./chunk-VVRUSQCY.js";
29
+ import "./chunk-U764PQUA.js";
30
+ import "./chunk-Q26DFKTY.js";
31
+ import "./chunk-I57ID5K7.js";
30
32
  import "./chunk-3MZYUBJ6.js";
31
33
 
32
34
  // src/domains/team/get/action.ts
@@ -40,7 +42,7 @@ async function getAction(args = {}) {
40
42
  schema: teamSchema
41
43
  });
42
44
  if (team.error) {
43
- return output.error().title("An error occurred when fetching your team.").message(team.message).exit("error");
45
+ return output.error().title("Could not load the current team").message(team.message).exit("error");
44
46
  }
45
47
  const details = {
46
48
  uid: team.data.uid,
@@ -53,7 +55,7 @@ async function getAction(args = {}) {
53
55
  `);
54
56
  return;
55
57
  }
56
- output.info().title(details.name).line(`Team UID: ${details.uid}`).line(`Slug: ${details.slug}`).line(
58
+ output.info().title(details.name).line(`Team ID: ${details.uid}`).line(`Slug: ${details.slug}`).line(
57
59
  `Namespaces: ${details.namespaces.length ? details.namespaces.join(", ") : "None"}`
58
60
  ).print();
59
61
  }
@@ -1,31 +1,33 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  downloadIsolate
4
- } from "./chunk-ZKJPLWRJ.js";
5
- import "./chunk-3ZJYGGAA.js";
4
+ } from "./chunk-HU47OMI4.js";
5
+ import "./chunk-ORCUZITN.js";
6
6
  import {
7
7
  readAndParseConfig,
8
8
  renderConfigError
9
- } from "./chunk-XAGJJNQW.js";
9
+ } from "./chunk-BB6WWG25.js";
10
10
  import {
11
11
  CONFIG_FILE_DEFAULT,
12
12
  findConfig
13
- } from "./chunk-UDBSV3CK.js";
13
+ } from "./chunk-T3R66THO.js";
14
14
  import {
15
15
  ISOLATE_DIR
16
- } from "./chunk-VYFGRLVQ.js";
17
- import "./chunk-36LXIJIZ.js";
16
+ } from "./chunk-U73OW57G.js";
17
+ import "./chunk-5ENKYZA4.js";
18
+ import "./chunk-V6LUKXBV.js";
19
+ import "./chunk-VUXPDHTQ.js";
18
20
  import {
19
21
  getAuthData
20
- } from "./chunk-35Z7VTJT.js";
22
+ } from "./chunk-YTFFBGNQ.js";
21
23
  import {
22
24
  config
23
- } from "./chunk-WB6PWTMU.js";
24
- import "./chunk-DHZW7Q7U.js";
25
- import "./chunk-GYRQPDTK.js";
25
+ } from "./chunk-UBLFIMUA.js";
26
+ import "./chunk-VVQOFG76.js";
27
+ import "./chunk-FJCOYEKT.js";
26
28
  import {
27
29
  ConfigVersion
28
- } from "./chunk-6M7TL2G2.js";
30
+ } from "./chunk-VRZSDUZK.js";
29
31
  import {
30
32
  requireInteractive
31
33
  } from "./chunk-EGOXR5FB.js";
@@ -33,7 +35,8 @@ import "./chunk-4ORL4MST.js";
33
35
  import {
34
36
  output
35
37
  } from "./chunk-T5HJUAWB.js";
36
- import "./chunk-VVRUSQCY.js";
38
+ import "./chunk-Q26DFKTY.js";
39
+ import "./chunk-I57ID5K7.js";
37
40
  import "./chunk-3MZYUBJ6.js";
38
41
 
39
42
  // src/domains/project/preview/action.ts
@@ -77,7 +80,7 @@ async function getAccessToken() {
77
80
  return accessToken;
78
81
  } catch {
79
82
  output.info().message(
80
- "You're not signed in. Private Scalar content will not be fetched."
83
+ "You're not logged in. Private Scalar content will not be fetched."
81
84
  ).print();
82
85
  return "";
83
86
  }
@@ -94,7 +97,7 @@ async function previewV2Project({
94
97
  const relativeConfigPath = path.relative(root, configPath);
95
98
  const accessToken = await getAccessToken();
96
99
  await downloadIsolate();
97
- output.info().message("Starting preview...").print();
100
+ output.info().message("Starting preview\u2026").print();
98
101
  await runIsolate({
99
102
  configPath: relativeConfigPath,
100
103
  projectDir: root,
@@ -114,7 +117,7 @@ async function previewV2Project({
114
117
  async function previewAction(__configPath, options) {
115
118
  const _port = Number.parseInt(options.port || "7970", 10);
116
119
  if (Number.isNaN(_port)) {
117
- return output.error().title("Invalid port").message("Please provide a valid port number").exit("error");
120
+ return output.error().title("Invalid port").message("Provide a valid port number").exit("error");
118
121
  }
119
122
  if (_port < 0 || _port > 65535) {
120
123
  return output.error().title("Invalid port").message("Port number must be between 0 and 65535").exit("error");
@@ -143,7 +146,7 @@ async function previewAction(__configPath, options) {
143
146
  }
144
147
  const { config: config2 } = parseConfigResult;
145
148
  if (config2.version === ConfigVersion.V1) {
146
- return output.error().title("V1 Preview is no longer supported.").message("Please upgrade your project with `scalar project upgrade`").exit("error");
149
+ return output.error().title("Version 1 previews are no longer supported").message("Run `scalar project upgrade` to upgrade your project.").exit("error");
147
150
  }
148
151
  if (config2.version === ConfigVersion.V2) {
149
152
  await previewV2Project({
@@ -1,53 +1,55 @@
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-UAFCSWQ6.js";
5
5
  import {
6
6
  readAndParseConfig,
7
7
  renderConfigError
8
- } from "./chunk-XAGJJNQW.js";
8
+ } from "./chunk-BB6WWG25.js";
9
9
  import {
10
10
  resolveProject
11
11
  } from "./chunk-TSURUX4A.js";
12
12
  import {
13
13
  DEFAULT_ASSETS_DIR
14
- } from "./chunk-UDBSV3CK.js";
15
- import "./chunk-MMWSCTDB.js";
14
+ } from "./chunk-T3R66THO.js";
15
+ import "./chunk-QJQTSRU4.js";
16
16
  import {
17
17
  getDatabaseClient
18
- } from "./chunk-WDIWLXLV.js";
18
+ } from "./chunk-RLBS4HJT.js";
19
19
  import {
20
20
  apiService
21
- } from "./chunk-ATNTXKMS.js";
22
- import "./chunk-43WALAW3.js";
23
- import "./chunk-ZYBLQ5CT.js";
24
- import "./chunk-KHF2QXBG.js";
25
- import "./chunk-IPZP3VRA.js";
21
+ } from "./chunk-RNZVZMYC.js";
22
+ import "./chunk-N645RGAB.js";
23
+ import "./chunk-JLNHOA5Z.js";
24
+ import "./chunk-Y6C3H27E.js";
26
25
  import "./chunk-5ENKYZA4.js";
27
- import "./chunk-G4HRW2FZ.js";
28
- import "./chunk-36LXIJIZ.js";
26
+ import "./chunk-RYWXF3LO.js";
27
+ import "./chunk-5TNKTLQP.js";
28
+ import "./chunk-V3MYP5SQ.js";
29
+ import "./chunk-V6LUKXBV.js";
30
+ import "./chunk-VUXPDHTQ.js";
29
31
  import {
30
32
  getAuthData
31
- } from "./chunk-35Z7VTJT.js";
32
- import "./chunk-WB6PWTMU.js";
33
- import "./chunk-DHZW7Q7U.js";
34
- import "./chunk-GYRQPDTK.js";
33
+ } from "./chunk-YTFFBGNQ.js";
34
+ import "./chunk-UBLFIMUA.js";
35
+ import "./chunk-VVQOFG76.js";
36
+ import "./chunk-FJCOYEKT.js";
35
37
  import {
36
38
  ConfigVersion,
37
39
  isGithubBackedDocsProject,
38
40
  publishRecordSchema
39
- } from "./chunk-6M7TL2G2.js";
40
- import "./chunk-GLWTVLKM.js";
41
+ } from "./chunk-VRZSDUZK.js";
41
42
  import "./chunk-4ORL4MST.js";
42
- import "./chunk-MNNGUUKJ.js";
43
+ import "./chunk-VUNOOPEG.js";
43
44
  import {
44
45
  output
45
46
  } from "./chunk-T5HJUAWB.js";
46
- import "./chunk-ZGVZU6L2.js";
47
+ import "./chunk-U764PQUA.js";
48
+ import "./chunk-Q26DFKTY.js";
47
49
  import {
48
50
  slugSchema,
49
51
  zod_default
50
- } from "./chunk-VVRUSQCY.js";
52
+ } from "./chunk-I57ID5K7.js";
51
53
  import "./chunk-3MZYUBJ6.js";
52
54
 
53
55
  // src/domains/project/publish/action.ts
@@ -397,7 +399,7 @@ async function publishAction(args) {
397
399
  github: zod_default.coerce.boolean().default(false)
398
400
  }).safeParse(args);
399
401
  if (argsParseResult.error)
400
- return output.error().title("Invalid Arguments").message(argsParseResult.error.issues[0].message).exit("error");
402
+ return output.error().title("Invalid arguments").message(argsParseResult.error.issues[0].message).exit("error");
401
403
  const {
402
404
  config: configPathOption,
403
405
  slug,
@@ -420,17 +422,17 @@ async function publishAction(args) {
420
422
  if (resolved.kind === "github") {
421
423
  if (!resolved.project.repository) {
422
424
  return output.error().title("Your project is not linked to a GitHub repository").message(
423
- "For a sync publish, please configure your GitHub connection through the dashboard."
425
+ "Connect the project to a GitHub repository in the Scalar Dashboard to publish from GitHub."
424
426
  ).exit("error");
425
427
  }
426
428
  if (resolved.project.repository.expired) {
427
- return output.error().title("Your GitHub repository access is expired.").message(
428
- "Please reconnect your project through the Scalar Dashboard to publish via sync."
429
+ return output.error().title("GitHub repository access has expired").message(
430
+ "Reconnect the GitHub repository in the Scalar Dashboard to publish from GitHub."
429
431
  ).exit("error");
430
432
  }
431
433
  const publishResult3 = await publishGithub({ apiClient, slug, preview });
432
434
  if (!publishResult3.success) {
433
- return output.error().title("Could not publish sync project.").message(publishResult3.error).exit("error");
435
+ return output.error().title("Could not publish from GitHub").message(publishResult3.error).exit("error");
434
436
  }
435
437
  return await waitForPublish({
436
438
  teamUid: auth.teamUid,
@@ -439,12 +441,12 @@ async function publishAction(args) {
439
441
  }
440
442
  if (!isGithubBackedDocsProject(resolved.project)) {
441
443
  return output.error().title("Your project is not linked to a GitHub repository").message(
442
- "For a sync publish, please configure your GitHub connection through the dashboard."
444
+ "Connect the project to a GitHub repository in the Scalar Dashboard to publish from GitHub."
443
445
  ).exit("error");
444
446
  }
445
447
  if (resolved.project.repository.expired) {
446
- return output.error().title("Your GitHub repository access is expired.").message(
447
- "Please reconnect your project through the Scalar Dashboard to publish via sync."
448
+ return output.error().title("GitHub repository access has expired").message(
449
+ "Reconnect the GitHub repository in the Scalar Dashboard to publish from GitHub."
448
450
  ).exit("error");
449
451
  }
450
452
  const publishResult2 = await publishUnifiedDocsProjectFromGithub({
@@ -453,7 +455,7 @@ async function publishAction(args) {
453
455
  preview
454
456
  });
455
457
  if (!publishResult2.success) {
456
- return output.error().title("Could not publish sync project.").message(publishResult2.error).exit("error");
458
+ return output.error().title("Could not publish from GitHub").message(publishResult2.error).exit("error");
457
459
  }
458
460
  return await waitForPublish({
459
461
  teamUid: auth.teamUid,
@@ -465,6 +467,7 @@ async function publishAction(args) {
465
467
  renderConfigError(configResult.error);
466
468
  }
467
469
  const { config, filePath: configPath } = configResult;
470
+ warnIfLegacyConfig(config);
468
471
  const publishResult = await publishProject({
469
472
  config,
470
473
  slug,
@@ -473,7 +476,7 @@ async function publishAction(args) {
473
476
  ...preview && { mode: "preview" }
474
477
  });
475
478
  if (!publishResult.success) {
476
- return output.error().title("Something went wrong while deploying the project").message(
479
+ return output.error().title("Could not deploy the project").message(
477
480
  publishResult.error instanceof Error ? publishResult.error.message : publishResult.error
478
481
  ).exit("error");
479
482
  }
@@ -482,12 +485,18 @@ async function publishAction(args) {
482
485
  publishUid: publishResult.publishUid
483
486
  });
484
487
  }
488
+ function warnIfLegacyConfig(config) {
489
+ if (config.version !== ConfigVersion.V1) return;
490
+ output.warn().title("This project uses a v1 Scalar config").line(
491
+ "It will be upgraded to v2 for this build only. Run `scalar project upgrade` to upgrade the config file."
492
+ ).print();
493
+ }
485
494
  async function waitForPublish({
486
495
  teamUid,
487
496
  publishUid
488
497
  }) {
489
498
  const dbClient = await getDatabaseClient();
490
- const logger = output.info({ animate: true }).loader("Deployment in progress");
499
+ const logger = output.info({ animate: true }).loader("Deploying project\u2026");
491
500
  while (true) {
492
501
  const deployStatus = await getDeployStatus({
493
502
  client: dbClient,
@@ -495,9 +504,7 @@ async function waitForPublish({
495
504
  teamUid
496
505
  });
497
506
  if (deployStatus.error === true) {
498
- return output.error().title(
499
- "Something went wrong while getting information about the deployment"
500
- ).exit("error");
507
+ return output.error().title("Could not load deployment status").exit("error");
501
508
  }
502
509
  logger.update("loader", 0, { content: deployStatus.data.message });
503
510
  if (deployStatus.data.status === "deployed") {
@@ -507,6 +514,9 @@ async function waitForPublish({
507
514
  `${deployStatus.data.preview ? "Preview URL" : "Deployment URL"}: ${deploymentUrl}`
508
515
  ).print();
509
516
  }
517
+ if (deployStatus.data.hasWarnings) {
518
+ output.warn().title("The build finished with warnings").line("Check the build log in the Scalar Dashboard for details.").print();
519
+ }
510
520
  logger.exit("success");
511
521
  return;
512
522
  }
@@ -529,5 +539,6 @@ async function getDeployStatus({
529
539
  }
530
540
  export {
531
541
  publishAction,
532
- waitForPublish
542
+ waitForPublish,
543
+ warnIfLegacyConfig
533
544
  };
@@ -4,23 +4,23 @@ import {
4
4
  } from "./chunk-KHDYYVYF.js";
5
5
  import {
6
6
  isDocument
7
- } from "./chunk-CWVYOXXM.js";
7
+ } from "./chunk-SNOAL2C5.js";
8
8
  import {
9
9
  isAsyncApiDocument
10
- } from "./chunk-H467HDVV.js";
10
+ } from "./chunk-PERC34BV.js";
11
11
  import {
12
12
  requireInteractive
13
13
  } from "./chunk-EGOXR5FB.js";
14
- import "./chunk-GLWTVLKM.js";
15
14
  import {
16
15
  isUrl
17
16
  } from "./chunk-4ORL4MST.js";
18
- import "./chunk-MNNGUUKJ.js";
17
+ import "./chunk-VUNOOPEG.js";
19
18
  import {
20
19
  output
21
20
  } from "./chunk-T5HJUAWB.js";
22
- import "./chunk-ZGVZU6L2.js";
23
- import "./chunk-VVRUSQCY.js";
21
+ import "./chunk-U764PQUA.js";
22
+ import "./chunk-Q26DFKTY.js";
23
+ import "./chunk-I57ID5K7.js";
24
24
  import "./chunk-3MZYUBJ6.js";
25
25
 
26
26
  // src/domains/document/split/action.ts
@@ -188,7 +188,7 @@ async function splitAsyncApi(document, outputPath) {
188
188
  // src/domains/document/split/action.ts
189
189
  async function splitAction(input, { output: __outputPath }) {
190
190
  if (!input) {
191
- return output.error().title("Missing input").message("Please provide a file path or URL to split").exit("error");
191
+ return output.error().title("Missing input").message("Provide a file path or URL to split.").exit("error");
192
192
  }
193
193
  const getOutputPath = async () => {
194
194
  if (__outputPath !== void 0 && typeof __outputPath === "string") {
@@ -203,7 +203,7 @@ async function splitAction(input, { output: __outputPath }) {
203
203
  placeholder: "./assets"
204
204
  });
205
205
  if (typeof outputPath2 !== "string") {
206
- return output.error().message("Operation cancelled by user").exit("error");
206
+ return output.error().message("Operation cancelled.").exit("error");
207
207
  }
208
208
  return outputPath2;
209
209
  };
@@ -219,7 +219,7 @@ async function splitAction(input, { output: __outputPath }) {
219
219
  }).catch(() => null);
220
220
  if (!isDocument(document)) {
221
221
  return output.error().title("Invalid input").message(
222
- "Could not read an OpenAPI or AsyncAPI document from the input. Please provide a valid JSON or YAML file."
222
+ "Could not read an OpenAPI or AsyncAPI document from the input. Provide a valid JSON or YAML file."
223
223
  ).exit("error");
224
224
  }
225
225
  const { executionTimeMs } = await measureTime(async () => {
@@ -245,7 +245,7 @@ async function splitAction(input, { output: __outputPath }) {
245
245
  );
246
246
  await fs2.rm(workspaceFilePath);
247
247
  });
248
- output.info().line().title(as.green("Document Split Successfully! \u{1F389}")).line().message(`\u2728 Chunks have been generated at: ${as.blue(outputPath)}`).line(`\u23F1\uFE0F Split completed in ${as.yellow(executionTimeMs.toFixed(2))}ms`).line("").print();
248
+ output.info().line().title(as.green("API description split")).line().message(`Written to ${as.blue(outputPath)}`).line(`Completed (${as.yellow(executionTimeMs.toFixed(2))} ms)`).line("").print();
249
249
  }
250
250
  export {
251
251
  splitAction
@@ -1,20 +1,21 @@
1
1
  import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
2
  import {
3
3
  getUserTeams
4
- } from "./chunk-WIEXQUTD.js";
4
+ } from "./chunk-UODTHS76.js";
5
5
  import {
6
6
  getDatabaseClient
7
- } from "./chunk-WDIWLXLV.js";
8
- import "./chunk-ZYBLQ5CT.js";
9
- import "./chunk-36LXIJIZ.js";
7
+ } from "./chunk-RLBS4HJT.js";
8
+ import "./chunk-Y6C3H27E.js";
9
+ import "./chunk-V6LUKXBV.js";
10
+ import "./chunk-VUXPDHTQ.js";
10
11
  import {
11
12
  getAuthData,
12
13
  refreshToken
13
- } from "./chunk-35Z7VTJT.js";
14
- import "./chunk-WB6PWTMU.js";
15
- import "./chunk-DHZW7Q7U.js";
16
- import "./chunk-GYRQPDTK.js";
17
- import "./chunk-6M7TL2G2.js";
14
+ } from "./chunk-YTFFBGNQ.js";
15
+ import "./chunk-UBLFIMUA.js";
16
+ import "./chunk-VVQOFG76.js";
17
+ import "./chunk-FJCOYEKT.js";
18
+ import "./chunk-VRZSDUZK.js";
18
19
  import {
19
20
  requireInteractive
20
21
  } from "./chunk-EGOXR5FB.js";
@@ -22,7 +23,8 @@ import "./chunk-4ORL4MST.js";
22
23
  import {
23
24
  output
24
25
  } from "./chunk-T5HJUAWB.js";
25
- import "./chunk-VVRUSQCY.js";
26
+ import "./chunk-Q26DFKTY.js";
27
+ import "./chunk-I57ID5K7.js";
26
28
  import "./chunk-3MZYUBJ6.js";
27
29
 
28
30
  // src/domains/team/set/action.ts
@@ -33,19 +35,19 @@ async function setAction({ team }) {
33
35
  auth.addEventListener((state) => Object.assign(auth, state));
34
36
  if (!("refreshToken" in auth)) {
35
37
  return output.error().title("Unsupported operation").message(
36
- "You can not change the selected team because you are using a personal token, which is related to a specific team. \nTo be able to perform actions on other teams you need to generate a new personal token and login with the new token."
38
+ "Personal tokens belong to one team. To switch teams, create a token for the target team and run `scalar auth login --token <token>`."
37
39
  ).exit("error");
38
40
  }
39
41
  const client = await getDatabaseClient();
40
42
  const userTeams = await getUserTeams(client, auth.email ?? "");
41
43
  if (userTeams.error) {
42
- return output.error().title("An error occurred while getting list of teams.").exit("error");
44
+ return output.error().title("Could not list your teams").exit("error");
43
45
  }
44
46
  let teamValue = team;
45
47
  if (!teamValue) {
46
- requireInteractive("Please provide --team with a valid team id.");
48
+ requireInteractive("Provide --team with a valid team ID.");
47
49
  teamValue = await select({
48
- message: "Please select one of the teams",
50
+ message: "Select a team",
49
51
  options: userTeams.data.map((it) => ({
50
52
  value: it.teamUid,
51
53
  label: it.teamName
@@ -54,12 +56,12 @@ async function setAction({ team }) {
54
56
  }
55
57
  const selectedTeam = userTeams.data.find((it) => it.teamUid === teamValue);
56
58
  if (!selectedTeam) {
57
- return output.error().title("Invalid team").message("Please choose a valid team id").exit("error");
59
+ return output.error().title("Invalid team").message(
60
+ "Provide a valid team ID. Run `scalar team list` to see available teams."
61
+ ).exit("error");
58
62
  }
59
63
  await refreshToken(auth.refreshToken, teamValue);
60
- output.info().message(
61
- `Operation ${as.green("successful")}. Selected team: ${as.cyan(selectedTeam.teamName)}`
62
- ).print();
64
+ output.info().message(`Current team: ${as.cyan(selectedTeam.teamName)}.`).print();
63
65
  }
64
66
  export {
65
67
  setAction