@staff0rd/assist 0.484.0 → 0.484.2

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.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.484.0",
9
+ version: "0.484.2",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -16248,6 +16248,24 @@ function exitKeyNotSet(key) {
16248
16248
  // src/commands/config/configSet.ts
16249
16249
  import chalk131 from "chalk";
16250
16250
 
16251
+ // src/commands/config/coerceCliConfigValue.ts
16252
+ function coerceCliConfigValue(key, raw) {
16253
+ const leaf = describeConfigLeaves(assistConfigSchema).find(
16254
+ (candidate) => candidate.key === key
16255
+ );
16256
+ if (!leaf) return { ok: true, value: coerceWithoutSchemaLeaf(raw) };
16257
+ if (leaf.itemType) return coerceConfigValue(key, splitList(raw));
16258
+ return coerceConfigValue(key, raw);
16259
+ }
16260
+ function splitList(raw) {
16261
+ return raw.split(",").map((item) => item.trim()).filter((item) => item !== "");
16262
+ }
16263
+ function coerceWithoutSchemaLeaf(raw) {
16264
+ if (raw === "true") return true;
16265
+ if (raw === "false") return false;
16266
+ return raw;
16267
+ }
16268
+
16251
16269
  // src/commands/config/exitWithConfigErrors.ts
16252
16270
  import chalk130 from "chalk";
16253
16271
  function exitWithConfigErrors(errors) {
@@ -16279,7 +16297,9 @@ function configSet(key, value, options2 = {}) {
16279
16297
  console.error(chalk131.red(`Missing required argument for '${resolved.key}'`));
16280
16298
  process.exit(1);
16281
16299
  }
16282
- const coerced = coerceValue(resolved.value);
16300
+ const coercion = coerceCliConfigValue(resolved.key, resolved.value);
16301
+ if (!coercion.ok) exitWithConfigErrors([coercion.error]);
16302
+ const coerced = coercion.value;
16283
16303
  const target = resolved.useRepo ? `repo: ${applyRepoOrExit(resolved.key, coerced, resolved.repoName)}` : applyOrExit(resolved.key, coerced, options2.global ?? false);
16284
16304
  console.log(
16285
16305
  chalk131.green(`Set ${resolved.key} = ${JSON.stringify(coerced)} (${target})`)
@@ -16295,11 +16315,6 @@ function applyRepoOrExit(key, coerced, repoName) {
16295
16315
  if (!result.ok) exitWithConfigErrors(result.errors);
16296
16316
  return result.label;
16297
16317
  }
16298
- function coerceValue(value) {
16299
- if (value === "true") return true;
16300
- if (value === "false") return false;
16301
- return value;
16302
- }
16303
16318
 
16304
16319
  // src/commands/config/configUnset.ts
16305
16320
  import chalk132 from "chalk";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.484.0",
3
+ "version": "0.484.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {