@staff0rd/assist 0.487.2 → 0.488.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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.487.2",
9
+ version: "0.488.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -580,7 +580,8 @@ var assistConfigShape = {
580
580
  windowsVersionCheck: z2.enum(["block", "warn", "off"]).default("block"),
581
581
  includeCommittedChanges: z2.boolean().default(true),
582
582
  topBar: z2.boolean().default(true),
583
- floatWaiting: z2.boolean().default(true)
583
+ floatWaiting: z2.boolean().default(true),
584
+ floatWaitingAfterMs: z2.number().default(5e3)
584
585
  }).optional(),
585
586
  database: z2.strictObject({
586
587
  url: z2.string().optional()
@@ -10664,10 +10665,19 @@ function sessionLayout(_req, res) {
10664
10665
  respondJson(res, 200, { topBar });
10665
10666
  }
10666
10667
 
10668
+ // src/commands/sessions/shared/sessionViewDefaults.ts
10669
+ var sessionViewDefaults = {
10670
+ floatWaiting: true,
10671
+ floatWaitingAfterMs: 5e3
10672
+ };
10673
+
10667
10674
  // src/commands/sessions/web/sessionView.ts
10668
10675
  function sessionView(_req, res) {
10669
- const floatWaiting = loadConfig().sessions?.floatWaiting ?? true;
10670
- respondJson(res, 200, { floatWaiting });
10676
+ const sessions = loadConfig().sessions;
10677
+ respondJson(res, 200, {
10678
+ floatWaiting: sessions?.floatWaiting ?? sessionViewDefaults.floatWaiting,
10679
+ floatWaitingAfterMs: sessions?.floatWaitingAfterMs ?? sessionViewDefaults.floatWaitingAfterMs
10680
+ });
10671
10681
  }
10672
10682
 
10673
10683
  // src/commands/config/coerceConfigScalar.ts
@@ -10881,6 +10891,18 @@ function resolveNamedRepoWriteLabel(globalRaw, name) {
10881
10891
  return matches[0];
10882
10892
  }
10883
10893
 
10894
+ // src/commands/config/resolveRepoConfigBlock.ts
10895
+ function resolveRepoConfigBlock(repoName, cwd) {
10896
+ const globalRaw = loadGlobalConfigRaw();
10897
+ const label2 = repoName === void 0 ? resolveRepoWriteLabel(globalRaw, getCurrentOrigin(cwd)) : resolveNamedRepoWriteLabel(globalRaw, repoName);
10898
+ const repos2 = isPlainObject3(globalRaw.repos) ? { ...globalRaw.repos } : {};
10899
+ const block = isPlainObject3(repos2[label2]) ? repos2[label2] : {};
10900
+ return { globalRaw, repos: repos2, label: label2, block };
10901
+ }
10902
+ function isPlainObject3(value) {
10903
+ return value !== null && typeof value === "object" && !Array.isArray(value);
10904
+ }
10905
+
10884
10906
  // src/commands/config/applyRepoConfigSet.ts
10885
10907
  function applyRepoConfigSet(key, coerced, repoName, cwd = process.cwd()) {
10886
10908
  if (isGlobalOnlyConfigKey(key)) {
@@ -10891,20 +10913,17 @@ function applyRepoConfigSet(key, coerced, repoName, cwd = process.cwd()) {
10891
10913
  ]
10892
10914
  };
10893
10915
  }
10894
- const globalRaw = loadGlobalConfigRaw();
10895
- const label2 = repoName === void 0 ? resolveRepoWriteLabel(globalRaw, getCurrentOrigin(cwd)) : resolveNamedRepoWriteLabel(globalRaw, repoName);
10896
- const repos2 = isPlainObject3(globalRaw.repos) ? { ...globalRaw.repos } : {};
10897
- const existingBlock = isPlainObject3(repos2[label2]) ? repos2[label2] : {};
10898
- const updatedBlock = setNestedValue(existingBlock, key, coerced);
10916
+ const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
10917
+ repoName,
10918
+ cwd
10919
+ );
10920
+ const updatedBlock = setNestedValue(block, key, coerced);
10899
10921
  const validation = validateConfig(updatedBlock, key, repoConfigSchema);
10900
10922
  if (!validation.ok) return validation;
10901
10923
  repos2[label2] = updatedBlock;
10902
10924
  saveGlobalConfig({ ...globalRaw, repos: repos2 });
10903
10925
  return { ok: true, target: "repo", label: label2 };
10904
10926
  }
10905
- function isPlainObject3(value) {
10906
- return value !== null && typeof value === "object" && !Array.isArray(value);
10907
- }
10908
10927
 
10909
10928
  // src/commands/sessions/web/applyScopedConfigSet.ts
10910
10929
  function applyScopedConfigSet(key, value, cwd, scope) {
@@ -10984,6 +11003,11 @@ function setConfig(req, res) {
10984
11003
  });
10985
11004
  }
10986
11005
 
11006
+ // src/commands/config/isKnownConfigKey.ts
11007
+ function isKnownConfigKey(key) {
11008
+ return enumerateConfigLeafKeys(assistConfigSchema).includes(key);
11009
+ }
11010
+
10987
11011
  // src/commands/config/unsetNestedValue.ts
10988
11012
  function isPlainObject4(val) {
10989
11013
  return val !== null && typeof val === "object" && !Array.isArray(val);
@@ -11074,9 +11098,48 @@ function applyConfigUnset(key, global, cwd = process.cwd()) {
11074
11098
  return { ok: true, target, removed: true };
11075
11099
  }
11076
11100
 
11077
- // src/commands/config/isKnownConfigKey.ts
11078
- function isKnownConfigKey(key) {
11079
- return enumerateConfigLeafKeys(assistConfigSchema).includes(key);
11101
+ // src/commands/config/applyRepoConfigUnset.ts
11102
+ function applyRepoConfigUnset(key, repoName, cwd = process.cwd()) {
11103
+ if (isGlobalOnlyConfigKey(key)) {
11104
+ return {
11105
+ ok: false,
11106
+ errors: [
11107
+ `"${key}" is a global-only key. Unset it in ~/.assist.yml rather than under repos:`
11108
+ ]
11109
+ };
11110
+ }
11111
+ const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
11112
+ repoName,
11113
+ cwd
11114
+ );
11115
+ const { config: updatedBlock, removed } = unsetNestedValue(block, key);
11116
+ if (!removed) return { ok: true, target: "repo", label: label2, removed: false };
11117
+ const validation = validateConfig(updatedBlock, key, repoConfigSchema);
11118
+ if (!validation.ok) return validation;
11119
+ if (Object.keys(updatedBlock).length === 0) delete repos2[label2];
11120
+ else repos2[label2] = updatedBlock;
11121
+ const next3 = { ...globalRaw };
11122
+ if (Object.keys(repos2).length === 0) delete next3.repos;
11123
+ else next3.repos = repos2;
11124
+ saveGlobalConfig(next3);
11125
+ return { ok: true, target: "repo", label: label2, removed: true };
11126
+ }
11127
+
11128
+ // src/commands/sessions/web/applyScopedConfigUnset.ts
11129
+ function applyScopedConfigUnset(key, cwd, scope) {
11130
+ if (scope === "repo") {
11131
+ const result2 = applyRepoConfigUnset(key, void 0, cwd);
11132
+ return result2.ok ? {
11133
+ ok: true,
11134
+ payload: {
11135
+ target: result2.target,
11136
+ repoKey: result2.label,
11137
+ removed: result2.removed
11138
+ }
11139
+ } : result2;
11140
+ }
11141
+ const result = applyConfigUnset(key, scope === "global", cwd);
11142
+ return result.ok ? { ok: true, payload: { target: result.target, removed: result.removed } } : result;
11080
11143
  }
11081
11144
 
11082
11145
  // src/commands/sessions/web/unsetConfig.ts
@@ -11084,22 +11147,7 @@ function unsetConfig(req, res) {
11084
11147
  return handleConfigWrite(req, res, (request) => {
11085
11148
  if (!isKnownConfigKey(request.key))
11086
11149
  return { ok: false, errors: [`Unknown config key "${request.key}"`] };
11087
- if (request.scope === "repo")
11088
- return {
11089
- ok: false,
11090
- errors: [
11091
- "Clearing a repos override is not supported \u2014 remove the key from repos: in ~/.assist.yml"
11092
- ]
11093
- };
11094
- const result = applyConfigUnset(
11095
- request.key,
11096
- request.scope === "global",
11097
- request.cwd
11098
- );
11099
- return result.ok ? {
11100
- ok: true,
11101
- payload: { target: result.target, removed: result.removed }
11102
- } : result;
11150
+ return applyScopedConfigUnset(request.key, request.cwd, request.scope);
11103
11151
  });
11104
11152
  }
11105
11153
 
@@ -16556,16 +16604,48 @@ function applyRepoOrExit(key, coerced, repoName) {
16556
16604
 
16557
16605
  // src/commands/config/configUnset.ts
16558
16606
  import chalk132 from "chalk";
16607
+
16608
+ // src/commands/config/resolveRepoUnsetTarget.ts
16609
+ function resolveRepoUnsetTarget(key, repo) {
16610
+ if (typeof repo === "string") {
16611
+ if (key === void 0)
16612
+ return { key: repo, useRepo: true, repoName: void 0 };
16613
+ return { key, useRepo: true, repoName: repo };
16614
+ }
16615
+ return { key, useRepo: repo === true, repoName: void 0 };
16616
+ }
16617
+
16618
+ // src/commands/config/configUnset.ts
16559
16619
  function configUnset(key, options2 = {}) {
16560
- const result = applyConfigUnset(key, options2.global ?? false);
16620
+ if (options2.repo !== void 0 && !options2.global) {
16621
+ console.error(
16622
+ chalk132.red(
16623
+ "--repo removes from the global config; add -g (e.g. -g --repo)"
16624
+ )
16625
+ );
16626
+ process.exit(1);
16627
+ }
16628
+ const resolved = resolveRepoUnsetTarget(key, options2.repo);
16629
+ if (resolved.key === void 0) {
16630
+ console.error(chalk132.red("Missing required argument 'key'"));
16631
+ process.exit(1);
16632
+ return;
16633
+ }
16634
+ const result = resolved.useRepo ? applyRepoConfigUnset(resolved.key, resolved.repoName) : applyConfigUnset(resolved.key, options2.global ?? false);
16561
16635
  if (!result.ok) exitWithConfigErrors(result.errors);
16562
16636
  if (!result.removed) {
16563
16637
  console.log(
16564
- chalk132.yellow(`${key} is not set in the ${result.target} config`)
16638
+ chalk132.yellow(`${resolved.key} is not set in ${whereLabel(result)}`)
16565
16639
  );
16566
16640
  return;
16567
16641
  }
16568
- console.log(chalk132.green(`Unset ${key} (${result.target})`));
16642
+ console.log(chalk132.green(`Unset ${resolved.key} (${targetLabel(result)})`));
16643
+ }
16644
+ function whereLabel(result) {
16645
+ return result.target === "repo" ? `repos.${result.label}` : `the ${result.target} config`;
16646
+ }
16647
+ function targetLabel(result) {
16648
+ return result.target === "repo" ? `repo: ${result.label}` : result.target;
16569
16649
  }
16570
16650
 
16571
16651
  // src/commands/registerConfig.ts
@@ -16575,7 +16655,10 @@ function registerConfig(program2) {
16575
16655
  "-r, --repo [name]",
16576
16656
  "Requires -g: scope the global write to a repo's identity (defaults to the current repo)"
16577
16657
  ).action((key, value, options2) => configSet(key, value, options2));
16578
- configCommand.command("unset <key>").description("Remove a config value (e.g. commit.push)").option("-g, --global", "Remove from global ~/.assist.yml").action((key, options2) => configUnset(key, options2));
16658
+ configCommand.command("unset [key]").description("Remove a config value (e.g. commit.push)").option("-g, --global", "Remove from global ~/.assist.yml").option(
16659
+ "-r, --repo [name]",
16660
+ "Requires -g: remove the key from a repo's identity block (defaults to the current repo)"
16661
+ ).action((key, options2) => configUnset(key, options2));
16579
16662
  configCommand.command("get <key>").description("Get a config value").action(configGet);
16580
16663
  configCommand.command("list").description("List all config values").action(configList);
16581
16664
  }
@@ -32380,6 +32463,11 @@ var sessionsConfigHelp = [
32380
32463
  setter: "assist config set sessions.floatWaiting false -g",
32381
32464
  note: "set false to stop the sidebar floating sessions that have been waiting on input for a few seconds above the other unstarred cards (default on)"
32382
32465
  },
32466
+ {
32467
+ key: "sessions.floatWaitingAfterMs",
32468
+ setter: "assist config set sessions.floatWaitingAfterMs 15000 -g",
32469
+ note: "how long a session must have been waiting on input before it floats (default: 5000ms)"
32470
+ },
32383
32471
  {
32384
32472
  key: "worktree.enabled",
32385
32473
  setter: "assist config set worktree.enabled true -g --repo",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.487.2",
3
+ "version": "0.488.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {