@osdk/cli 0.3.0 → 0.4.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 (114) hide show
  1. package/build/js/{chunk-OOW63BC4.cjs → chunk-D7QHLGEU.cjs} +88 -24
  2. package/build/js/chunk-D7QHLGEU.cjs.map +1 -0
  3. package/build/js/chunk-N6K26UR4.mjs +9 -0
  4. package/build/js/chunk-N6K26UR4.mjs.map +1 -0
  5. package/build/js/chunk-X2S4O5ZR.cjs +11 -0
  6. package/build/js/chunk-X2S4O5ZR.cjs.map +1 -0
  7. package/build/js/{chunk-SQHFJOHN.mjs → chunk-XNYKWAIE.mjs} +84 -26
  8. package/build/js/chunk-XNYKWAIE.mjs.map +1 -0
  9. package/build/js/{handleGenerate-K6X2HG4V.mjs → handleGenerate-A7X2XAGW.mjs} +2 -2
  10. package/build/js/{handleGenerate-FCY2LRSZ.cjs → handleGenerate-WOW33WYG.cjs} +2 -2
  11. package/build/js/index.cjs +334 -81
  12. package/build/js/index.cjs.map +1 -1
  13. package/build/js/index.mjs +333 -80
  14. package/build/js/index.mjs.map +1 -1
  15. package/build/js/siteDeployCommand-HSR3QDAT.mjs +82 -0
  16. package/build/js/siteDeployCommand-HSR3QDAT.mjs.map +1 -0
  17. package/build/js/siteDeployCommand-MXKGJFFB.cjs +107 -0
  18. package/build/js/siteDeployCommand-MXKGJFFB.cjs.map +1 -0
  19. package/build/js/versionDeleteCommand-6BJL5XLG.mjs +26 -0
  20. package/build/js/versionDeleteCommand-6BJL5XLG.mjs.map +1 -0
  21. package/build/js/versionDeleteCommand-RLU7UUYD.cjs +28 -0
  22. package/build/js/versionDeleteCommand-RLU7UUYD.cjs.map +1 -0
  23. package/build/js/versionGetCommand-OR4RLOLM.mjs +28 -0
  24. package/build/js/versionGetCommand-OR4RLOLM.mjs.map +1 -0
  25. package/build/js/versionGetCommand-Y2VR2WKH.cjs +30 -0
  26. package/build/js/versionGetCommand-Y2VR2WKH.cjs.map +1 -0
  27. package/build/js/versionListCommand-5KM5PFYL.cjs +34 -0
  28. package/build/js/versionListCommand-5KM5PFYL.cjs.map +1 -0
  29. package/build/js/versionListCommand-LPPGQCQF.mjs +32 -0
  30. package/build/js/versionListCommand-LPPGQCQF.mjs.map +1 -0
  31. package/build/js/versionSetCommand-LHOVVI6U.mjs +31 -0
  32. package/build/js/versionSetCommand-LHOVVI6U.mjs.map +1 -0
  33. package/build/js/versionSetCommand-VD3L5DOV.cjs +33 -0
  34. package/build/js/versionSetCommand-VD3L5DOV.cjs.map +1 -0
  35. package/build/js/versionUnsetCommand-IJT4JWBN.mjs +24 -0
  36. package/build/js/versionUnsetCommand-IJT4JWBN.mjs.map +1 -0
  37. package/build/js/versionUnsetCommand-XYBUQ6XB.cjs +26 -0
  38. package/build/js/versionUnsetCommand-XYBUQ6XB.cjs.map +1 -0
  39. package/build/types/YargsCheckError.d.ts +3 -0
  40. package/build/types/commands/site/CommonSiteArgs.d.ts +4 -2
  41. package/build/types/commands/site/deploy/SiteDeployArgs.d.ts +5 -2
  42. package/build/types/commands/site/deploy/index.d.ts +1 -1
  43. package/build/types/commands/site/deploy/logDeployCommandConfigFileOverride.d.ts +4 -0
  44. package/build/types/commands/site/deploy/siteDeployCommand.d.mts +2 -0
  45. package/build/types/commands/site/index.d.ts +3 -3
  46. package/build/types/commands/site/logSiteCommandConfigFileOverride.d.ts +4 -0
  47. package/build/types/commands/site/version/SiteVersionArgs.d.ts +4 -0
  48. package/build/types/commands/site/version/delete/index.d.ts +5 -0
  49. package/build/types/commands/site/version/delete/versionDeleteCommand.d.mts +2 -0
  50. package/build/types/commands/site/version/get/index.d.ts +4 -0
  51. package/build/types/commands/site/version/get/versionGetCommand.d.mts +2 -0
  52. package/build/types/commands/site/{versions → version}/index.d.ts +1 -1
  53. package/build/types/commands/site/version/list/index.d.ts +4 -0
  54. package/build/types/commands/site/version/list/versionListCommand.d.mts +2 -0
  55. package/build/types/commands/site/version/set/index.d.ts +5 -0
  56. package/build/types/commands/site/version/set/versionSetCommand.d.mts +2 -0
  57. package/build/types/commands/site/version/unset/index.d.ts +4 -0
  58. package/build/types/commands/site/version/unset/versionUnsetCommand.d.mts +2 -0
  59. package/build/types/net/artifacts/SiteAssetArtifactsService/DeleteSiteVersionRequest.d.mts +5 -0
  60. package/build/types/net/artifacts/SiteAssetArtifactsService/UploadZippedSiteAssetRequest.d.mts +6 -0
  61. package/build/types/net/artifacts/SiteAssetArtifactsService/deleteSiteVersion.d.mts +3 -2
  62. package/build/types/net/artifacts/SiteAssetArtifactsService/fetchSiteVersions.d.mts +2 -1
  63. package/build/types/net/artifacts/SiteAssetArtifactsService/uploadSiteVersion.d.mts +3 -2
  64. package/build/types/net/createConjureContext.d.mts +1 -1
  65. package/build/types/net/createInternalClientContext.d.mts +2 -0
  66. package/build/types/net/index.d.mts +1 -0
  67. package/build/types/net/internalClientContext.d.mts +4 -0
  68. package/build/types/net/third-party-application-service/fetchWebsiteRepositoryRid.d.mts +2 -1
  69. package/build/types/util/autoVersion.d.ts +8 -0
  70. package/build/types/util/autoVersion.test.d.ts +1 -0
  71. package/build/types/util/config.d.ts +25 -0
  72. package/build/types/util/config.test.d.ts +1 -0
  73. package/build/types/util/configLoader.d.ts +3 -0
  74. package/build/types/util/isValidSemver.test.d.ts +1 -0
  75. package/build/types/util/token.d.ts +21 -0
  76. package/build/types/util/token.test.d.ts +1 -0
  77. package/build/types/yargs/logConfigFileMiddleware.d.ts +1 -0
  78. package/changelog/0.3.0/pr-20.v2.yml +5 -0
  79. package/changelog/0.4.0/pr-15.v2.yml +5 -0
  80. package/changelog/0.4.0/pr-17.v2.yml +5 -0
  81. package/changelog/0.4.0/pr-35.v2.yml +5 -0
  82. package/changelog/0.4.0/pr-41.v2.yml +5 -0
  83. package/changelog/0.4.0/pr-42.v2.yml +5 -0
  84. package/changelog/@unreleased/.gitkeep +0 -0
  85. package/package.json +5 -2
  86. package/build/js/chunk-OOW63BC4.cjs.map +0 -1
  87. package/build/js/chunk-SQHFJOHN.mjs.map +0 -1
  88. package/build/js/handleSiteDeploy-5C2FGADK.cjs +0 -30
  89. package/build/js/handleSiteDeploy-5C2FGADK.cjs.map +0 -1
  90. package/build/js/handleSiteDeploy-HHXON5YE.mjs +0 -28
  91. package/build/js/handleSiteDeploy-HHXON5YE.mjs.map +0 -1
  92. package/build/js/siteDeleteCommand-47GMSHFS.mjs +0 -13
  93. package/build/js/siteDeleteCommand-47GMSHFS.mjs.map +0 -1
  94. package/build/js/siteDeleteCommand-7YTHDD4P.cjs +0 -15
  95. package/build/js/siteDeleteCommand-7YTHDD4P.cjs.map +0 -1
  96. package/build/js/siteUploadCommand-HBZYJ4ZP.cjs +0 -58
  97. package/build/js/siteUploadCommand-HBZYJ4ZP.cjs.map +0 -1
  98. package/build/js/siteUploadCommand-S2HTCGZK.mjs +0 -33
  99. package/build/js/siteUploadCommand-S2HTCGZK.mjs.map +0 -1
  100. package/build/js/siteVersionsCommand-GU3HKEGQ.cjs +0 -29
  101. package/build/js/siteVersionsCommand-GU3HKEGQ.cjs.map +0 -1
  102. package/build/js/siteVersionsCommand-X5MO726Z.mjs +0 -27
  103. package/build/js/siteVersionsCommand-X5MO726Z.mjs.map +0 -1
  104. package/build/types/commands/site/delete/DeleteArgs.d.ts +0 -4
  105. package/build/types/commands/site/delete/index.d.ts +0 -5
  106. package/build/types/commands/site/delete/siteDeleteCommand.d.mts +0 -2
  107. package/build/types/commands/site/deploy/handleSiteDeploy.d.mts +0 -2
  108. package/build/types/commands/site/upload/UploadArgs.d.ts +0 -5
  109. package/build/types/commands/site/upload/index.d.ts +0 -5
  110. package/build/types/commands/site/upload/siteUploadCommand.d.mts +0 -2
  111. package/build/types/commands/site/versions/siteVersionsCommand.d.mts +0 -2
  112. /package/{CHANGELOG.md → CHANGELOG_OLD.md} +0 -0
  113. /package/build/js/{handleGenerate-FCY2LRSZ.cjs.map → handleGenerate-A7X2XAGW.mjs.map} +0 -0
  114. /package/build/js/{handleGenerate-K6X2HG4V.mjs.map → handleGenerate-WOW33WYG.cjs.map} +0 -0
@@ -1,7 +1,9 @@
1
+ import { isValidSemver } from './chunk-N6K26UR4.mjs';
1
2
  import { ExitProcessError } from './chunk-GTNZA5UY.mjs';
2
3
  import './chunk-E2SEJZTC.mjs';
3
4
  import yargs from 'yargs';
4
5
  import { hideBin } from 'yargs/helpers';
6
+ import { promises } from 'fs';
5
7
 
6
8
  // src/commands/auth/login/index.ts
7
9
  var command = {
@@ -14,8 +16,8 @@ var command = {
14
16
  });
15
17
  },
16
18
  handler: async (args) => {
17
- const command7 = await import('./loginFlow-KGLTXVZ6.mjs');
18
- await command7.default(args);
19
+ const command11 = await import('./loginFlow-KGLTXVZ6.mjs');
20
+ await command11.default(args);
19
21
  }
20
22
  };
21
23
  var login_default = command;
@@ -36,118 +38,335 @@ var site = {
36
38
  }
37
39
  };
38
40
  var auth_default = site;
39
-
40
- // src/commands/site/delete/index.ts
41
- var command2 = {
42
- command: "delete",
43
- describe: "Delete an uploaded version",
44
- builder: (argv) => {
45
- return argv.option("siteVersion", {
46
- type: "string",
47
- demandOption: true
48
- }).option("dir", {
41
+ var CONFIG_FILE_NAMES = ["foundry.config.json"];
42
+ var CONFIG_FILE_SCHEMA = {
43
+ type: "object",
44
+ properties: {
45
+ foundryUrl: {
49
46
  type: "string"
50
- });
47
+ },
48
+ site: {
49
+ type: "object",
50
+ properties: {
51
+ application: {
52
+ type: "string"
53
+ },
54
+ directory: {
55
+ type: "string"
56
+ },
57
+ autoVersion: {
58
+ type: "object",
59
+ nullable: true,
60
+ oneOf: [{
61
+ properties: {
62
+ "type": {
63
+ const: "git-describe",
64
+ type: "string"
65
+ },
66
+ "tagPrefix": {
67
+ type: "string",
68
+ nullable: true
69
+ }
70
+ }
71
+ }],
72
+ required: ["type"]
73
+ }
74
+ },
75
+ required: ["application", "directory"]
76
+ }
51
77
  },
52
- handler: async (args) => {
53
- const command7 = await import('./siteDeleteCommand-47GMSHFS.mjs');
54
- await command7.default(args);
78
+ required: ["foundryUrl", "site"],
79
+ additionalProperties: false
80
+ };
81
+ async function loadFoundryConfig() {
82
+ const ajvModule = await import('ajv');
83
+ const Ajv = ajvModule.default.default;
84
+ const ajv = new Ajv({
85
+ allErrors: true
86
+ });
87
+ const validate = ajv.compile(CONFIG_FILE_SCHEMA);
88
+ const Consola = await import('consola');
89
+ Consola.consola;
90
+ const {
91
+ findUp
92
+ } = await import('find-up');
93
+ const configFilePath = await findUp(CONFIG_FILE_NAMES);
94
+ if (configFilePath) {
95
+ let foundryConfig;
96
+ try {
97
+ const fileContent = await promises.readFile(configFilePath, "utf-8");
98
+ foundryConfig = JSON.parse(fileContent);
99
+ } catch {
100
+ throw new ExitProcessError(2, `Couldn't read or parse config file ${configFilePath}`);
101
+ }
102
+ if (!validate(foundryConfig)) {
103
+ throw new ExitProcessError(2, `The configuration file does not match the expected schema: ${ajv.errorsText(validate.errors)}`);
104
+ }
105
+ return {
106
+ foundryConfig,
107
+ configFilePath
108
+ };
109
+ }
110
+ return void 0;
111
+ }
112
+
113
+ // src/util/configLoader.ts
114
+ var configPromise = void 0;
115
+ function getConfig() {
116
+ if (configPromise == null) {
117
+ configPromise = loadFoundryConfig();
118
+ }
119
+ return configPromise;
120
+ }
121
+ var configLoader_default = getConfig;
122
+
123
+ // src/YargsCheckError.ts
124
+ var YargsCheckError = class extends Error {
125
+ constructor(msg) {
126
+ super(msg);
55
127
  }
56
128
  };
57
- var delete_default = command2;
129
+
130
+ // src/commands/site/deploy/logDeployCommandConfigFileOverride.ts
131
+ async function logDeployCommandConfigFileOverride(argv, config) {
132
+ const Consola = await import('consola');
133
+ const consola = Consola.consola;
134
+ if (config?.autoVersion != null && argv.autoVersion !== config?.autoVersion.type) {
135
+ consola.debug(`Overriding "autoVersion" from config file with ${argv.autoVersion}`);
136
+ }
137
+ if (config?.directory != null && argv.directory !== config?.directory) {
138
+ consola.debug(`Overriding "directory" from config file with ${argv.directory}`);
139
+ }
140
+ if (config?.autoVersion?.tagPrefix != null && argv.gitTagPrefix != null && argv.gitTagPrefix !== config?.autoVersion.tagPrefix) {
141
+ consola.debug(`Overriding "gitTagPrefix" from config file with ${argv.gitTagPrefix}`);
142
+ }
143
+ }
58
144
 
59
145
  // src/commands/site/deploy/index.ts
60
- var command3 = {
146
+ var command2 = {
61
147
  command: "deploy",
62
148
  describe: "Deploy an uploaded version",
63
- builder: (argv) => {
149
+ builder: async (argv) => {
150
+ const config = await configLoader_default();
151
+ const siteConfig = config?.foundryConfig.site;
152
+ const directory = siteConfig?.directory;
153
+ const autoVersion = siteConfig?.autoVersion;
154
+ const gitTagPrefix = autoVersion?.tagPrefix;
64
155
  return argv.options({
65
- "siteVersion": {
156
+ directory: {
66
157
  type: "string",
67
- conflicts: "clearVersion"
68
- // group: "Deploy Version",
69
- // implies: { "clearVersion": "false" },
158
+ description: "Directory to deploy",
159
+ ...directory ? {
160
+ default: directory
161
+ } : {
162
+ demandOption: true
163
+ }
70
164
  },
71
- undeploy: {
72
- alias: "clearVersion",
73
- description: "Causes the site to no longer be deployed",
165
+ uploadOnly: {
74
166
  type: "boolean",
75
- conflicts: "siteVersion"
76
- // group: "Deploy Version",
77
- // implies: { "siteVersion": "" },
167
+ description: "Upload the directory but do not deploy it",
168
+ default: false
169
+ },
170
+ version: {
171
+ type: "string",
172
+ description: "Version to deploy",
173
+ ...autoVersion == null ? {
174
+ conflicts: "autoVersion"
175
+ } : {}
176
+ },
177
+ autoVersion: {
178
+ type: "string",
179
+ description: "Enables autoversioning. Can be set to 'git-describe' to use git describe to determine the version.",
180
+ ...autoVersion != null ? {
181
+ default: autoVersion.type
182
+ } : {
183
+ conflicts: "version"
184
+ }
185
+ },
186
+ gitTagPrefix: {
187
+ type: "string",
188
+ description: "Prefix to match git tags against when --autoVersion=git-describe is used. If not provided, a default prefix 'v' is used.",
189
+ ...gitTagPrefix ? {
190
+ default: gitTagPrefix
191
+ } : {}
192
+ }
193
+ }).group(["autoVersion", "gitTagPrefix"], "Autoversion Arguments").group(["version", "directory", "uploadOnly"], "Common Arguments").check((argv2) => {
194
+ if (autoVersion == null && argv2.autoVersion == null && argv2.version == null) {
195
+ throw new YargsCheckError("One of --version or --autoVersion must be specified");
196
+ }
197
+ const autoVersionType = argv2.autoVersion ?? autoVersion;
198
+ if (autoVersionType !== "git-describe") {
199
+ throw new YargsCheckError(`Only 'git-describe' is supported for autoVersion`);
78
200
  }
79
- }).group(["siteVersion", "clearVersion"], "Version To Deploy (requires one of)");
201
+ const gitTagPrefixValue = argv2.gitTagPrefix ?? gitTagPrefix;
202
+ if (gitTagPrefixValue != null && autoVersionType !== "git-describe") {
203
+ throw new YargsCheckError(`--gitTagPrefix is only supported when --autoVersion=git-describe`);
204
+ }
205
+ return true;
206
+ }).middleware((argv2) => logDeployCommandConfigFileOverride(argv2, siteConfig));
80
207
  },
81
208
  handler: async (args) => {
82
- const command7 = await import('./handleSiteDeploy-HHXON5YE.mjs');
83
- await command7.default(args);
209
+ const command11 = await import('./siteDeployCommand-HSR3QDAT.mjs');
210
+ await command11.default(args);
84
211
  }
85
212
  };
86
- var deploy_default = command3;
213
+ var deploy_default = command2;
87
214
 
88
- // src/commands/site/upload/index.ts
89
- var command4 = {
90
- command: "upload",
91
- describe: "Upload an application version",
215
+ // src/commands/site/logSiteCommandConfigFileOverride.ts
216
+ async function logSiteCommandConfigFileOverride(argv, config) {
217
+ const Consola = await import('consola');
218
+ const consola = Consola.consola;
219
+ if (config?.site.application != null && argv.application !== config.site.application) {
220
+ consola.debug(`Overriding "application" from config file with ${argv.application}`);
221
+ }
222
+ if (config?.foundryUrl != null && argv.foundryUrl !== config.foundryUrl) {
223
+ consola.debug(`Overriding "foundryUrl" from config file with ${argv.foundryUrl}`);
224
+ }
225
+ }
226
+
227
+ // src/commands/site/version/delete/index.ts
228
+ var command3 = {
229
+ command: "delete <version>",
230
+ describe: "Delete the specified site version.",
92
231
  builder: (argv) => {
93
- return argv.option("siteVersion", {
232
+ return argv.positional("version", {
94
233
  type: "string",
95
- demandOption: true
96
- }).option("dir", {
97
- type: "string"
234
+ demandOption: true,
235
+ description: "Version to set as live"
98
236
  });
99
237
  },
100
238
  handler: async (args) => {
101
- const command7 = await import('./siteUploadCommand-S2HTCGZK.mjs');
102
- await command7.default(args);
239
+ const command11 = await import('./versionDeleteCommand-6BJL5XLG.mjs');
240
+ await command11.default(args);
241
+ }
242
+ };
243
+ var delete_default = command3;
244
+
245
+ // src/commands/site/version/get/index.ts
246
+ var command4 = {
247
+ command: "get",
248
+ describe: "Get the currently set live site version",
249
+ builder: (argv) => {
250
+ return argv;
251
+ },
252
+ handler: async (args) => {
253
+ const command11 = await import('./versionGetCommand-OR4RLOLM.mjs');
254
+ await command11.default(args);
103
255
  }
104
256
  };
105
- var upload_default = command4;
257
+ var get_default = command4;
106
258
 
107
- // src/commands/site/versions/index.ts
259
+ // src/commands/site/version/list/index.ts
108
260
  var command5 = {
109
- command: "versions",
261
+ command: "list",
110
262
  describe: "List application versions",
111
263
  builder: (argv) => {
112
264
  return argv;
113
265
  },
114
266
  handler: async (args) => {
115
- const command7 = await import('./siteVersionsCommand-X5MO726Z.mjs');
116
- await command7.default(args);
267
+ const command11 = await import('./versionListCommand-LPPGQCQF.mjs');
268
+ await command11.default(args);
269
+ }
270
+ };
271
+ var list_default = command5;
272
+
273
+ // src/commands/site/version/set/index.ts
274
+ var command6 = {
275
+ command: "set <version>",
276
+ describe: "Set the live site version",
277
+ builder: (argv) => {
278
+ return argv.positional("version", {
279
+ type: "string",
280
+ demandOption: true,
281
+ description: "Version to set as live"
282
+ });
283
+ },
284
+ handler: async (args) => {
285
+ const command11 = await import('./versionSetCommand-LHOVVI6U.mjs');
286
+ await command11.default(args);
117
287
  }
118
288
  };
119
- var versions_default = command5;
289
+ var set_default = command6;
290
+
291
+ // src/commands/site/version/unset/index.ts
292
+ var command7 = {
293
+ command: "unset",
294
+ describe: "Clear the currently set live site version.",
295
+ builder: (argv) => {
296
+ return argv;
297
+ },
298
+ handler: async (args) => {
299
+ const command11 = await import('./versionUnsetCommand-IJT4JWBN.mjs');
300
+ await command11.default(args);
301
+ }
302
+ };
303
+ var unset_default = command7;
304
+
305
+ // src/commands/site/version/index.ts
306
+ var command8 = {
307
+ command: "version",
308
+ describe: "Manage application version",
309
+ builder: (argv) => {
310
+ return argv.command(list_default).command(set_default).command(unset_default).command(delete_default).command(get_default).demandCommand();
311
+ },
312
+ handler: async (args) => {
313
+ }
314
+ };
315
+ var version_default = command8;
120
316
 
121
317
  // src/commands/site/index.ts
122
- var site2 = {
318
+ var command9 = {
123
319
  command: "site",
124
320
  describe: "Manage your site",
125
- builder: (argv) => {
321
+ builder: async (argv) => {
322
+ const config = await configLoader_default();
323
+ const application = config?.foundryConfig.site.application;
324
+ const foundryUrl = config?.foundryConfig.foundryUrl;
126
325
  return argv.options({
127
- appRid: {
326
+ application: {
128
327
  type: "string",
129
- demandOption: true,
130
- coerce: (a) => a
328
+ coerce: (application2) => application2,
329
+ ...application ? {
330
+ default: application
331
+ } : {
332
+ demandOption: true
333
+ },
334
+ description: "Application RID"
131
335
  },
132
- baseUrl: {
336
+ foundryUrl: {
337
+ coerce: (foundryUrl2) => foundryUrl2.replace(/\/$/, ""),
133
338
  type: "string",
134
- demandOption: true
339
+ ...foundryUrl ? {
340
+ default: foundryUrl
341
+ } : {
342
+ demandOption: true
343
+ },
344
+ description: "Foundry Stack URL with Protocol (e.g. https://example.palantirfoundry.com)"
345
+ },
346
+ token: {
347
+ type: "string",
348
+ conflicts: "tokenFile",
349
+ description: "Foundry API Token"
350
+ },
351
+ tokenFile: {
352
+ type: "string",
353
+ conflicts: "token",
354
+ description: "Path to a file containing your Foundry API Token"
355
+ }
356
+ }).group(["application", "foundryUrl", "token", "tokenFile"], "Common Arguments").command(version_default).command(deploy_default).check((argv2) => {
357
+ if (!argv2.foundryUrl.startsWith("https://")) {
358
+ throw new YargsCheckError("foundryUrl must start with https://");
135
359
  }
136
- }).group(["appRid", "baseUrl"], "Common Arguments").command(versions_default).command(upload_default).command(delete_default).command(deploy_default).demandCommand();
360
+ return true;
361
+ }).middleware((argv2) => logSiteCommandConfigFileOverride(argv2, config?.foundryConfig)).demandCommand();
137
362
  },
138
363
  handler: async (args) => {
139
364
  }
140
365
  };
141
- var site_default = site2;
142
-
143
- // src/util/isValidSemver.ts
144
- var semver = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
145
- function isValidSemver(semverString) {
146
- return semver.test(semverString);
147
- }
366
+ var site_default = command9;
148
367
 
149
368
  // src/commands/typescript/generate/generate.ts
150
- var command6 = {
369
+ var command10 = {
151
370
  command: "generate",
152
371
  describe: "Generate typescript from ontology",
153
372
  builder: (argv) => {
@@ -208,14 +427,14 @@ var command6 = {
208
427
  });
209
428
  },
210
429
  handler: async (args) => {
211
- const command7 = await import('./handleGenerate-K6X2HG4V.mjs');
212
- await command7.default(args);
430
+ const command11 = await import('./handleGenerate-A7X2XAGW.mjs');
431
+ await command11.default(args);
213
432
  }
214
433
  };
215
- var generate_default = command6;
434
+ var generate_default = command10;
216
435
 
217
436
  // src/commands/typescript/index.ts
218
- var site3 = {
437
+ var site2 = {
219
438
  command: "typescript",
220
439
  describe: "Manage code",
221
440
  builder: (argv) => {
@@ -224,21 +443,36 @@ var site3 = {
224
443
  handler: async (args) => {
225
444
  }
226
445
  };
227
- var typescript_default = site3;
446
+ var typescript_default = site2;
228
447
 
229
- // src/yargs/logVersionMiddleware.ts
448
+ // src/yargs/logConfigFileMiddleware.ts
230
449
  var firstTime = true;
231
- async function logVersionMiddleware(args) {
450
+ async function logConfigFileMiddleware() {
232
451
  if (firstTime) {
452
+ firstTime = false;
453
+ const config = configLoader_default();
454
+ const configFilePath = (await config)?.configFilePath;
455
+ if (configFilePath) {
456
+ const Consola = await import('consola');
457
+ const consola = Consola.consola;
458
+ consola.debug(`Using configuration from file: "${configFilePath}"`);
459
+ }
460
+ }
461
+ }
462
+
463
+ // src/yargs/logVersionMiddleware.ts
464
+ var firstTime2 = true;
465
+ async function logVersionMiddleware(args) {
466
+ if (firstTime2) {
467
+ firstTime2 = false;
233
468
  const Consola = await import('consola');
234
469
  const consola = Consola.consola;
235
- consola.info(`Palantir OSDK CLI ${"0.3.0"}`);
470
+ consola.info(`Palantir OSDK CLI ${"0.4.0"}`);
236
471
  consola.level = 3 + args.verbose;
237
472
  if (consola.level > 3) {
238
473
  consola.debug(`Verbose logging enabled (${consola.level === 4 ? "debug" : "trace"})`);
239
474
  }
240
- console.log();
241
- firstTime = false;
475
+ consola.log("");
242
476
  }
243
477
  }
244
478
 
@@ -249,7 +483,7 @@ async function cli(args = process.argv) {
249
483
  type: "boolean",
250
484
  description: "Enable verbose logging",
251
485
  count: true
252
- }).demandCommand().middleware(logVersionMiddleware, true).strict().command({
486
+ }).demandCommand().middleware(logVersionMiddleware, true).middleware(logConfigFileMiddleware).strict().command({
253
487
  command: "unstable",
254
488
  aliases: ["experimental"],
255
489
  builder: async (argv) => {
@@ -257,13 +491,32 @@ async function cli(args = process.argv) {
257
491
  },
258
492
  handler: (_args) => {
259
493
  }
494
+ }).fail(async (msg, err, yargsContext) => {
495
+ const Consola = await import('consola');
496
+ const isVerbose = args.some((arg) => ["-v", "--v", "--verbose"].includes(arg));
497
+ if (err instanceof ExitProcessError) {
498
+ if (isVerbose) {
499
+ Consola.consola.error(err);
500
+ } else {
501
+ Consola.consola.error(err.message);
502
+ }
503
+ } else {
504
+ if (err && err instanceof YargsCheckError === false) {
505
+ throw err;
506
+ } else {
507
+ yargsContext.showHelp();
508
+ Consola.consola.log("");
509
+ console.error(msg);
510
+ }
511
+ }
512
+ process.exit(1);
260
513
  });
261
514
  try {
262
- return base.parseAsync();
263
- } catch (e) {
264
- if (e instanceof ExitProcessError) {
515
+ return await base.parseAsync();
516
+ } catch (err) {
517
+ if (err instanceof ExitProcessError) {
265
518
  const Consola = await import('consola');
266
- Consola.consola.error(e.message);
519
+ Consola.consola.error(err);
267
520
  }
268
521
  }
269
522
  }