@staff0rd/assist 0.780.1 → 0.781.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.
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.780.1",
9
+ version: "0.781.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -518,33 +518,6 @@ function originDisplayName(origin) {
518
518
  return origin.slice(firstSlash + 1);
519
519
  }
520
520
 
521
- // src/commands/backlog/originDisplayLabels.ts
522
- function originDisplayLabels(origins) {
523
- const isLocal = (origin) => origin.startsWith("local:");
524
- const bareName = (origin) => {
525
- const full = originDisplayName(origin);
526
- const segments = full.split("/");
527
- return segments[segments.length - 1] ?? full;
528
- };
529
- const remoteCounts = /* @__PURE__ */ new Map();
530
- for (const origin of new Set(origins)) {
531
- if (isLocal(origin)) continue;
532
- const name = bareName(origin);
533
- remoteCounts.set(name, (remoteCounts.get(name) ?? 0) + 1);
534
- }
535
- const labels = /* @__PURE__ */ new Map();
536
- for (const origin of origins) {
537
- if (isLocal(origin)) {
538
- labels.set(origin, originDisplayName(origin));
539
- continue;
540
- }
541
- const name = bareName(origin);
542
- const collides = (remoteCounts.get(name) ?? 0) > 1;
543
- labels.set(origin, collides ? originDisplayName(origin) : name);
544
- }
545
- return labels;
546
- }
547
-
548
521
  // src/shared/resolveRepoOverride.ts
549
522
  var AmbiguousRepoConfigError = class extends Error {
550
523
  name = "AmbiguousRepoConfigError";
@@ -578,17 +551,6 @@ function resolveRepoOverride(globalRaw, origin, source) {
578
551
  return {};
579
552
  return override;
580
553
  }
581
- function resolveRepoWriteLabel(globalRaw, origin) {
582
- const repos2 = globalRaw.repos;
583
- if (repos2 && typeof repos2 === "object" && !Array.isArray(repos2)) {
584
- const candidates = originKeyCandidates(origin);
585
- const existing = Object.keys(repos2).find(
586
- (key) => candidates.has(key)
587
- );
588
- if (existing) return existing;
589
- }
590
- return originDisplayLabels([origin]).get(origin) ?? origin;
591
- }
592
554
 
593
555
  // src/shared/resolveRepoLayer.ts
594
556
  var SHARED_REPO_CONFIG_SOURCE = "the shared db";
@@ -6671,6 +6633,33 @@ async function addPhase(id, name, options2) {
6671
6633
  // src/commands/backlog/list.ts
6672
6634
  import chalk51 from "chalk";
6673
6635
 
6636
+ // src/commands/backlog/originDisplayLabels.ts
6637
+ function originDisplayLabels(origins) {
6638
+ const isLocal = (origin) => origin.startsWith("local:");
6639
+ const bareName = (origin) => {
6640
+ const full = originDisplayName(origin);
6641
+ const segments = full.split("/");
6642
+ return segments[segments.length - 1] ?? full;
6643
+ };
6644
+ const remoteCounts = /* @__PURE__ */ new Map();
6645
+ for (const origin of new Set(origins)) {
6646
+ if (isLocal(origin)) continue;
6647
+ const name = bareName(origin);
6648
+ remoteCounts.set(name, (remoteCounts.get(name) ?? 0) + 1);
6649
+ }
6650
+ const labels = /* @__PURE__ */ new Map();
6651
+ for (const origin of origins) {
6652
+ if (isLocal(origin)) {
6653
+ labels.set(origin, originDisplayName(origin));
6654
+ continue;
6655
+ }
6656
+ const name = bareName(origin);
6657
+ const collides = (remoteCounts.get(name) ?? 0) > 1;
6658
+ labels.set(origin, collides ? originDisplayName(origin) : name);
6659
+ }
6660
+ return labels;
6661
+ }
6662
+
6674
6663
  // src/commands/backlog/list/shared.ts
6675
6664
  import chalk50 from "chalk";
6676
6665
  function statusIcon(status2) {
@@ -27374,48 +27363,18 @@ function normaliseItems(items2) {
27374
27363
  return items2.map(toItem);
27375
27364
  }
27376
27365
 
27377
- // src/commands/config/resolveRepoConfigBlock.ts
27378
- function resolveRepoConfigBlock(repoName, cwd, globalConfigPath) {
27379
- const globalRaw = loadGlobalConfigRaw(globalConfigPath);
27380
- const label2 = repoName === void 0 ? resolveRepoWriteLabel(globalRaw, getCurrentOrigin(cwd)) : resolveNamedRepoWriteLabel(globalRaw, repoName);
27381
- const repos2 = isPlainObject7(globalRaw.repos) ? { ...globalRaw.repos } : {};
27382
- const block = isPlainObject7(repos2[label2]) ? repos2[label2] : {};
27383
- return { globalRaw, repos: repos2, label: label2, block };
27384
- }
27385
- function isPlainObject7(value) {
27386
- return value !== null && typeof value === "object" && !Array.isArray(value);
27387
- }
27388
-
27389
- // src/commands/config/applyRepoConfigSet.ts
27390
- function applyRepoConfigSet(key, coerced, repoName, cwd = process.cwd(), globalConfigPath) {
27391
- const globalOnly = globalOnlyRepoKeyError(key, "Set");
27392
- if (globalOnly) return globalOnly;
27393
- const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
27394
- repoName,
27395
- cwd,
27396
- globalConfigPath
27397
- );
27398
- const updatedBlock = setNestedValue(block, key, coerced);
27399
- const validation = validateConfig(updatedBlock, key, repoConfigSchema);
27400
- if (!validation.ok) return validation;
27401
- repos2[label2] = updatedBlock;
27402
- saveGlobalConfig({ ...globalRaw, repos: repos2 }, globalConfigPath);
27403
- return { ok: true, target: "repo", label: label2 };
27404
- }
27405
-
27406
27366
  // src/commands/miro/saveMiroExtract.ts
27407
- function saveToRepo(key, extract2, repo, { cwd, globalConfigPath }) {
27408
- const result = applyRepoConfigSet(
27367
+ async function saveToRepo(key, extract2, repo, cwd) {
27368
+ const result = await applySharedRepoConfigSet(
27409
27369
  key,
27410
27370
  extract2,
27411
27371
  typeof repo === "string" ? repo : void 0,
27412
- cwd,
27413
- globalConfigPath
27372
+ cwd
27414
27373
  );
27415
27374
  if (!result.ok) throw new MiroExtractError(result.errors.join("\n"));
27416
- return `${globalConfigFileLabel(globalConfigPath)} under repos.${result.label}`;
27375
+ return `${SHARED_REPO_CONFIG_SOURCE} under repos.${result.label}`;
27417
27376
  }
27418
- function saveMiroExtract(name, extract2, options2, paths = {}) {
27377
+ async function saveMiroExtract(name, extract2, options2, paths = {}) {
27419
27378
  const resolved = {
27420
27379
  cwd: paths.cwd ?? process.cwd(),
27421
27380
  globalConfigPath: paths.globalConfigPath ?? getGlobalConfigPath()
@@ -27426,7 +27385,7 @@ function saveMiroExtract(name, extract2, options2, paths = {}) {
27426
27385
  );
27427
27386
  const key = `miro.extracts.${name}`;
27428
27387
  if (options2.repo !== void 0)
27429
- return saveToRepo(key, extract2, options2.repo, resolved);
27388
+ return saveToRepo(key, extract2, options2.repo, resolved.cwd);
27430
27389
  const result = applyConfigSet(
27431
27390
  key,
27432
27391
  extract2,
@@ -27450,9 +27409,8 @@ async function extractName(options2) {
27450
27409
  async function offerSaveExtract(extract2, options2, paths = {}) {
27451
27410
  const name = await extractName(options2);
27452
27411
  if (!name) return;
27453
- console.log(
27454
- `Saved extract "${name}" to ${saveMiroExtract(name, extract2, options2, paths)}`
27455
- );
27412
+ const target = await saveMiroExtract(name, extract2, options2, paths);
27413
+ console.log(`Saved extract "${name}" to ${target}`);
27456
27414
  }
27457
27415
 
27458
27416
  // src/commands/miro/pickAnchors.ts
@@ -27700,7 +27658,7 @@ function registerMiro(program2) {
27700
27658
  "Save the selection as this named extract without asking"
27701
27659
  ).option("-g, --global", "Save the extract to global ~/.assist.yml").option(
27702
27660
  "-r, --repo [name]",
27703
- "Requires -g: scope the saved extract to a repo's identity (defaults to the current repo)"
27661
+ "Requires -g: save the extract to a repo's shared db override instead (defaults to the current repo)"
27704
27662
  ).action(
27705
27663
  (name, options2) => runExtract(name, options2)
27706
27664
  );
@@ -31081,7 +31039,7 @@ function applyConfigWrites(base, writes, schema2) {
31081
31039
  }
31082
31040
 
31083
31041
  // src/commands/config/writeConfigKeys.ts
31084
- function writeConfigKeys(writes, scope, cwd = process.cwd(), globalConfigPath) {
31042
+ async function writeConfigKeys(writes, scope, cwd = process.cwd()) {
31085
31043
  const globalOnly = writes.filter((write) => isGlobalOnlyConfigKey(write.key));
31086
31044
  if (globalOnly.length > 0) {
31087
31045
  return {
@@ -31091,23 +31049,19 @@ function writeConfigKeys(writes, scope, cwd = process.cwd(), globalConfigPath) {
31091
31049
  )
31092
31050
  };
31093
31051
  }
31094
- if (scope === "repo") return writeRepoBlock(writes, cwd, globalConfigPath);
31052
+ if (scope === "repo") return writeRepoBlock(writes, cwd);
31095
31053
  const applied = applyConfigWrites(loadProjectConfig(cwd), writes);
31096
31054
  if (!applied.ok) return applied;
31097
31055
  saveConfig(applied.updated, cwd);
31098
31056
  return { ok: true, target: "project assist.yml" };
31099
31057
  }
31100
- function writeRepoBlock(writes, cwd, globalConfigPath) {
31101
- const { globalRaw, repos: repos2, label: label2, block } = resolveRepoConfigBlock(
31102
- void 0,
31103
- cwd,
31104
- globalConfigPath
31105
- );
31058
+ async function writeRepoBlock(writes, cwd) {
31059
+ const orm = await getDb();
31060
+ const { label: label2, block } = await resolveSharedRepoBlock(orm, void 0, cwd);
31106
31061
  const applied = applyConfigWrites(block, writes, repoConfigSchema);
31107
31062
  if (!applied.ok) return applied;
31108
- repos2[label2] = applied.updated;
31109
- saveGlobalConfig({ ...globalRaw, repos: repos2 }, globalConfigPath);
31110
- return { ok: true, target: `~/.assist.yml, repo: ${label2}` };
31063
+ await saveSharedRepoBlock(orm, label2, applied.updated);
31064
+ return { ok: true, target: `${SHARED_REPO_CONFIG_SOURCE}, repo: ${label2}` };
31111
31065
  }
31112
31066
 
31113
31067
  // src/commands/releases/declaredStreamsInScope.ts
@@ -31117,10 +31071,10 @@ function streamsOf(block) {
31117
31071
  const streams = releases.streams;
31118
31072
  return Array.isArray(streams) ? streams : [];
31119
31073
  }
31120
- function declaredStreamsInScope(scope, cwd = process.cwd()) {
31121
- if (scope === "repo")
31122
- return streamsOf(resolveRepoConfigBlock(void 0, cwd).block);
31123
- return streamsOf(loadProjectConfig(cwd));
31074
+ async function declaredStreamsInScope(scope, cwd = process.cwd()) {
31075
+ if (scope !== "repo") return streamsOf(loadProjectConfig(cwd));
31076
+ const { block } = await resolveSharedRepoBlock(await getDb(), void 0, cwd);
31077
+ return streamsOf(block);
31124
31078
  }
31125
31079
 
31126
31080
  // src/commands/releases/mergeRepoStreams.ts
@@ -31136,12 +31090,12 @@ function mergeRepoStreams(declared, incoming) {
31136
31090
  }
31137
31091
 
31138
31092
  // src/commands/releases/writeReleaseStreams.ts
31139
- function writeReleaseStreams(incoming, scope) {
31093
+ async function writeReleaseStreams(incoming, scope) {
31140
31094
  return writeConfigKeys(
31141
31095
  [
31142
31096
  {
31143
31097
  key: "releases.streams",
31144
- value: mergeRepoStreams(declaredStreamsInScope(scope), incoming)
31098
+ value: mergeRepoStreams(await declaredStreamsInScope(scope), incoming)
31145
31099
  }
31146
31100
  ],
31147
31101
  scope
@@ -31162,7 +31116,7 @@ function reportWritten(incoming, target) {
31162
31116
  target
31163
31117
  );
31164
31118
  }
31165
- function releasesConfigure(options2 = {}) {
31119
+ async function releasesConfigure(options2 = {}) {
31166
31120
  const scope = options2.scope === "repo" ? "repo" : "project";
31167
31121
  const input = readStreamsInput(options2.streams ?? "-");
31168
31122
  if ("error" in input) return fail6(`Could not read --streams: ${input.error}`);
@@ -31173,7 +31127,7 @@ function releasesConfigure(options2 = {}) {
31173
31127
  "The graph does not hold together, so nothing was written:",
31174
31128
  broken
31175
31129
  );
31176
- const written = writeReleaseStreams(incoming, scope);
31130
+ const written = await writeReleaseStreams(incoming, scope);
31177
31131
  if (!written.ok)
31178
31132
  return fail6(
31179
31133
  "releases.streams does not validate, so nothing was written:",
@@ -31222,7 +31176,7 @@ function registerReleases(parent) {
31222
31176
  "JSON or YAML array of streams to declare; '-' reads stdin"
31223
31177
  ).option(
31224
31178
  "--scope <project|repo>",
31225
- "project assist.yml or ~/.assist.yml repo block",
31179
+ "project assist.yml or this repo's shared db override",
31226
31180
  "project"
31227
31181
  ).action(releasesConfigure);
31228
31182
  }
@@ -34200,7 +34154,7 @@ async function promptConfigScope() {
34200
34154
  },
34201
34155
  {
34202
34156
  name: "repo",
34203
- message: "this repo's block in ~/.assist.yml \u2014 personal, as 'config set -g --repo' writes it"
34157
+ message: "this repo's override in the shared db \u2014 personal, seen by every node, as 'config set -g --repo' writes it"
34204
34158
  }
34205
34159
  ]
34206
34160
  }).run()
@@ -34240,7 +34194,7 @@ async function configureConfigKeys(questions, options2 = {}) {
34240
34194
  if (value === void 0) skipped.push(question.key);
34241
34195
  else written.push({ key: question.key, value });
34242
34196
  }
34243
- const result = writeConfigKeys(written, scope, options2.cwd);
34197
+ const result = await writeConfigKeys(written, scope, options2.cwd);
34244
34198
  if (!result.ok) exitWithConfigErrors(result.errors);
34245
34199
  return { scope, target: result.target, written, skipped };
34246
34200
  }
@@ -41856,6 +41810,13 @@ function broadcast(clients, msg) {
41856
41810
  }
41857
41811
  }
41858
41812
 
41813
+ // src/commands/sessions/shared/promptIssueRef.ts
41814
+ var issuePrompt = /^Issue ([^\s#]+\/[^\s#]+)#(\d+):/;
41815
+ function promptIssueRef(prompt) {
41816
+ const match = prompt ? issuePrompt.exec(prompt) : null;
41817
+ return match ? `${match[1]}#${match[2]}` : void 0;
41818
+ }
41819
+
41859
41820
  // src/commands/sessions/daemon/toSessionRunInfo.ts
41860
41821
  function toSessionRunInfo({
41861
41822
  status: status2,
@@ -41956,6 +41917,7 @@ function toSessionInfo(session) {
41956
41917
  lastUserMessage,
41957
41918
  activeViewer,
41958
41919
  activeViewerNode,
41920
+ promptIssue: promptIssueRef(session.initialPrompt),
41959
41921
  joinable: joinRefusal(session) === void 0
41960
41922
  };
41961
41923
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.780.1",
3
+ "version": "0.781.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {