@staff0rd/assist 0.248.0 → 0.250.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.248.0",
9
+ version: "0.250.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -332,17 +332,6 @@ function loadConfig() {
332
332
  const merged = mergeRawConfigs(globalRaw, projectRaw);
333
333
  return assistConfigSchema.parse(merged);
334
334
  }
335
- function loadConfigFrom(startDir) {
336
- const found = findConfigUp(startDir);
337
- const configPath = found?.configPath ?? join(startDir, "assist.yml");
338
- const globalRaw = loadRawYaml(getGlobalConfigPath());
339
- const projectRaw = loadRawYaml(configPath);
340
- const merged = mergeRawConfigs(globalRaw, projectRaw);
341
- return {
342
- config: assistConfigSchema.parse(merged),
343
- configDir: dirname(configPath)
344
- };
345
- }
346
335
  function loadProjectConfig() {
347
336
  return loadRawYaml(getConfigPath());
348
337
  }
@@ -4564,12 +4553,7 @@ var handleRequest = createFallbackHandler(
4564
4553
 
4565
4554
  // src/commands/sessions/web/handleSocket.ts
4566
4555
  import { createInterface as createInterface2 } from "readline";
4567
- var CWD_DEFAULTED_TYPES = /* @__PURE__ */ new Set([
4568
- "create",
4569
- "create-run",
4570
- "create-assist",
4571
- "run-configs"
4572
- ]);
4556
+ var CWD_DEFAULTED_TYPES = /* @__PURE__ */ new Set(["create", "create-run", "create-assist"]);
4573
4557
  function handleSocket(ws, ctx) {
4574
4558
  const connection = openDaemonConnection(ws, ctx);
4575
4559
  connection.catch(() => {
@@ -16319,15 +16303,23 @@ function requireRunConfigs() {
16319
16303
  if (configs.length === 0) return exitNoRunConfigs();
16320
16304
  return configs;
16321
16305
  }
16322
- function findRunConfig(name) {
16306
+ function lookupRunConfig(name) {
16323
16307
  const configs = requireRunConfigs();
16324
16308
  const exact = configs.find((r) => r.name === name);
16325
- if (exact) return exact;
16309
+ if (exact) return { kind: "match", config: exact };
16326
16310
  const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
16327
- if (suffixMatches.length === 1) return suffixMatches[0];
16311
+ if (suffixMatches.length === 1)
16312
+ return { kind: "match", config: suffixMatches[0] };
16328
16313
  if (suffixMatches.length > 1)
16329
- return exitWithAmbiguousConfig(name, suffixMatches);
16330
- return exitWithConfigNotFound(name, configs);
16314
+ return { kind: "ambiguous", matches: suffixMatches };
16315
+ return { kind: "not-found" };
16316
+ }
16317
+ function findRunConfig(name) {
16318
+ const result = lookupRunConfig(name);
16319
+ if (result.kind === "match") return result.config;
16320
+ if (result.kind === "ambiguous")
16321
+ return exitWithAmbiguousConfig(name, result.matches);
16322
+ return exitWithConfigNotFound(name, requireRunConfigs());
16331
16323
  }
16332
16324
 
16333
16325
  // src/commands/run/formatConfiguredCommands.ts
@@ -16445,12 +16437,30 @@ function execRunConfig(config, args) {
16445
16437
  config.quiet
16446
16438
  );
16447
16439
  }
16448
- function run3(name, args) {
16440
+ function parseBacklogRunOptions(id, args) {
16441
+ let allowEdits = true;
16442
+ for (const arg of args) {
16443
+ if (arg === "--write" || arg === "-w") allowEdits = true;
16444
+ else if (arg === "--no-write") allowEdits = false;
16445
+ else {
16446
+ console.error(`error: unexpected argument '${arg}' for 'run ${id}'`);
16447
+ process.exit(1);
16448
+ }
16449
+ }
16450
+ return { allowEdits };
16451
+ }
16452
+ async function run3(name, args) {
16449
16453
  if (!name) {
16450
16454
  console.error("error: missing required argument 'name'");
16451
16455
  console.error(formatConfiguredCommands());
16452
16456
  process.exit(1);
16453
16457
  }
16458
+ if (/^\d+$/.test(name) && lookupRunConfig(name).kind === "not-found") {
16459
+ const options2 = parseBacklogRunOptions(name, args);
16460
+ pullIfConfigured();
16461
+ await run2(name, options2);
16462
+ return;
16463
+ }
16454
16464
  execRunConfig(findRunConfig(name), args);
16455
16465
  }
16456
16466
 
@@ -16619,7 +16629,10 @@ function remove() {
16619
16629
 
16620
16630
  // src/commands/run/registerRun.ts
16621
16631
  function registerRun(program2) {
16622
- const runCommand = program2.command("run").description("Run a configured command from assist.yml").argument("[name]", "Name of the configured command").argument("[args...]", "Arguments to pass to the command").allowUnknownOption().addHelpText("after", () => formatConfiguredCommands()).action((name, args) => run3(name, args));
16632
+ const runCommand = program2.command("run").description("Run a configured command from assist.yml").argument("[name]", "Name of the configured command").argument("[args...]", "Arguments to pass to the command").allowUnknownOption().addHelpText(
16633
+ "after",
16634
+ "\nA purely numeric name with no matching command is an alias for\n'assist backlog run <id>' (forwards --write/--no-write/-w)."
16635
+ ).addHelpText("after", () => formatConfiguredCommands()).action((name, args) => run3(name, args));
16623
16636
  runCommand.command("list").description("List configured run commands").option("-v, --verbose", "Show full command details").action((opts) => listRunConfigs(!!opts.verbose));
16624
16637
  runCommand.command("add").description("Add a new run configuration to assist.yml").argument("<name>", "Name for the run configuration").argument("<command>", "Command to execute").argument("[args...]", "Static args to pass to the command").option(
16625
16638
  "--cwd <dir>",
@@ -17599,20 +17612,6 @@ import * as net2 from "net";
17599
17612
  // src/commands/sessions/daemon/handleConnection.ts
17600
17613
  import { createInterface as createInterface5 } from "readline";
17601
17614
 
17602
- // src/commands/sessions/daemon/handleRunConfigs.ts
17603
- function handleRunConfigs(client, cwd) {
17604
- try {
17605
- const { config, configDir } = loadConfigFrom(cwd);
17606
- const configs = resolveRunConfigs(config.run, configDir);
17607
- sendTo(client, {
17608
- type: "run-configs",
17609
- configs: configs.map(({ name, params }) => ({ name, params }))
17610
- });
17611
- } catch {
17612
- sendTo(client, { type: "run-configs", configs: [] });
17613
- }
17614
- }
17615
-
17616
17615
  // src/commands/sessions/daemon/dispatchMessage.ts
17617
17616
  function sendCreated(client, id) {
17618
17617
  sendTo(client, { type: "created", sessionId: id });
@@ -17655,9 +17654,6 @@ function handleResume(client, manager, data) {
17655
17654
  )
17656
17655
  );
17657
17656
  }
17658
- function runConfigs(client, _manager, data) {
17659
- handleRunConfigs(client, data.cwd);
17660
- }
17661
17657
  function handleHistory(client, manager) {
17662
17658
  manager.getHistory().then((history) => {
17663
17659
  sendTo(client, { type: "history", sessions: history });
@@ -17674,7 +17670,6 @@ var handlers = {
17674
17670
  "create-run": handleCreateRun,
17675
17671
  "create-assist": handleCreateAssist,
17676
17672
  resume: handleResume,
17677
- "run-configs": runConfigs,
17678
17673
  history: handleHistory,
17679
17674
  shutdown: handleShutdown,
17680
17675
  input: (_client, m, d) => m.writeToSession(d.sessionId, d.data),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.248.0",
3
+ "version": "0.250.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {