@staff0rd/assist 0.189.0 → 0.189.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.
Files changed (2) hide show
  1. package/dist/index.js +54 -41
  2. package/package.json +1 -1
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.189.0",
9
+ version: "0.189.2",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -425,7 +425,7 @@ var gitignoreEntries = [".assist-*", ".assist/*.db*"];
425
425
  function ensureGitignore(dir) {
426
426
  const gitignorePath = join2(dir, ".gitignore");
427
427
  const existing = existsSync2(gitignorePath) ? readFileSync3(gitignorePath, "utf-8") : "";
428
- const lines = existing.split("\n");
428
+ const lines = existing.split(/\r?\n/);
429
429
  const missing = gitignoreEntries.filter((entry) => !lines.includes(entry));
430
430
  if (missing.length === 0) return;
431
431
  const suffix = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
@@ -973,8 +973,8 @@ function spawnClaude(prompt, options2 = {}) {
973
973
  const child = spawn("claude", args, {
974
974
  stdio: "inherit"
975
975
  });
976
- const done2 = new Promise((resolve12, reject) => {
977
- child.on("close", (code) => resolve12(code ?? 0));
976
+ const done2 = new Promise((resolve13, reject) => {
977
+ child.on("close", (code) => resolve13(code ?? 0));
978
978
  child.on("error", reject);
979
979
  });
980
980
  return { child, done: done2 };
@@ -1420,12 +1420,12 @@ function getHtml() {
1420
1420
 
1421
1421
  // src/commands/backlog/web/parseItemBody.ts
1422
1422
  function readBody(req) {
1423
- return new Promise((resolve12, reject) => {
1423
+ return new Promise((resolve13, reject) => {
1424
1424
  let body = "";
1425
1425
  req.on("data", (chunk) => {
1426
1426
  body += chunk.toString();
1427
1427
  });
1428
- req.on("end", () => resolve12(body));
1428
+ req.on("end", () => resolve13(body));
1429
1429
  req.on("error", reject);
1430
1430
  });
1431
1431
  }
@@ -3366,14 +3366,14 @@ function flushIfFailed(exitCode, chunks) {
3366
3366
 
3367
3367
  // src/commands/verify/run/runAllEntries.ts
3368
3368
  function runEntry(entry, onComplete) {
3369
- return new Promise((resolve12) => {
3369
+ return new Promise((resolve13) => {
3370
3370
  const child = spawnCommand(entry.fullCommand, entry.cwd, entry.env);
3371
3371
  const chunks = collectOutput(child);
3372
3372
  child.on("close", (code) => {
3373
3373
  const exitCode = code ?? 1;
3374
3374
  flushIfFailed(exitCode, chunks);
3375
3375
  onComplete?.(exitCode);
3376
- resolve12({ script: entry.name, code: exitCode });
3376
+ resolve13({ script: entry.name, code: exitCode });
3377
3377
  });
3378
3378
  });
3379
3379
  }
@@ -5324,12 +5324,12 @@ function hasSubcommands(helpText) {
5324
5324
  // src/commands/permitCliReads/runHelp.ts
5325
5325
  import { exec as exec2 } from "child_process";
5326
5326
  function runHelp(args) {
5327
- return new Promise((resolve12) => {
5327
+ return new Promise((resolve13) => {
5328
5328
  exec2(
5329
5329
  `${args.join(" ")} --help`,
5330
5330
  { encoding: "utf-8", timeout: 3e4 },
5331
5331
  (_err, stdout, stderr) => {
5332
- resolve12(stdout || stderr || "");
5332
+ resolve13(stdout || stderr || "");
5333
5333
  }
5334
5334
  );
5335
5335
  });
@@ -9066,7 +9066,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
9066
9066
 
9067
9067
  // src/commands/refactor/check/index.ts
9068
9068
  function runScript(script, cwd) {
9069
- return new Promise((resolve12) => {
9069
+ return new Promise((resolve13) => {
9070
9070
  const child = spawn4("npm", ["run", script], {
9071
9071
  stdio: "pipe",
9072
9072
  shell: true,
@@ -9080,7 +9080,7 @@ function runScript(script, cwd) {
9080
9080
  output += data.toString();
9081
9081
  });
9082
9082
  child.on("close", (code) => {
9083
- resolve12({ script, code: code ?? 1, output });
9083
+ resolve13({ script, code: code ?? 1, output });
9084
9084
  });
9085
9085
  });
9086
9086
  }
@@ -10741,9 +10741,9 @@ function createReadlineInterface() {
10741
10741
  });
10742
10742
  }
10743
10743
  function askQuestion(rl, question) {
10744
- return new Promise((resolve12) => {
10744
+ return new Promise((resolve13) => {
10745
10745
  rl.question(question, (answer) => {
10746
- resolve12(answer.trim());
10746
+ resolve13(answer.trim());
10747
10747
  });
10748
10748
  });
10749
10749
  }
@@ -11684,7 +11684,7 @@ function extractCode(url, expectedState) {
11684
11684
  return code;
11685
11685
  }
11686
11686
  function waitForCallback(port, expectedState) {
11687
- return new Promise((resolve12, reject) => {
11687
+ return new Promise((resolve13, reject) => {
11688
11688
  const timeout = setTimeout(() => {
11689
11689
  server.close();
11690
11690
  reject(new Error("Authorization timed out after 120 seconds"));
@@ -11701,7 +11701,7 @@ function waitForCallback(port, expectedState) {
11701
11701
  const code = extractCode(url, expectedState);
11702
11702
  respondHtml(res, 200, "Authorization successful!");
11703
11703
  server.close();
11704
- resolve12(code);
11704
+ resolve13(code);
11705
11705
  } catch (err) {
11706
11706
  respondHtml(res, 400, err.message);
11707
11707
  server.close();
@@ -11852,7 +11852,7 @@ function registerRoam(program2) {
11852
11852
  }
11853
11853
 
11854
11854
  // src/commands/run/index.ts
11855
- import { resolve as resolve9 } from "path";
11855
+ import { resolve as resolve10 } from "path";
11856
11856
 
11857
11857
  // src/commands/run/formatConfiguredCommands.ts
11858
11858
  function formatConfiguredCommands() {
@@ -11903,12 +11903,24 @@ function runPreCommands(pre, cwd) {
11903
11903
  }
11904
11904
 
11905
11905
  // src/commands/run/spawnRunCommand.ts
11906
- import { spawn as spawn6 } from "child_process";
11907
- function spawnRunCommand(fullCommand, env, cwd) {
11906
+ import { execFileSync, spawn as spawn6 } from "child_process";
11907
+ import { existsSync as existsSync41 } from "fs";
11908
+ import { dirname as dirname24, join as join44, resolve as resolve9 } from "path";
11909
+ function resolveCommand2(command) {
11910
+ if (process.platform !== "win32" || command !== "bash") return command;
11911
+ try {
11912
+ const gitPath = execFileSync("where", ["git"], { encoding: "utf8" }).trim().split("\r\n")[0];
11913
+ const gitRoot = resolve9(dirname24(gitPath), "..");
11914
+ const gitBash = join44(gitRoot, "bin", "bash.exe");
11915
+ if (existsSync41(gitBash)) return gitBash;
11916
+ } catch {
11917
+ }
11918
+ return command;
11919
+ }
11920
+ function spawnRunCommand(command, args, env, cwd) {
11908
11921
  const start3 = Date.now();
11909
- const child = spawn6(fullCommand, [], {
11922
+ const child = spawn6(resolveCommand2(command), args, {
11910
11923
  stdio: "inherit",
11911
- shell: true,
11912
11924
  env: env ? { ...process.env, ...expandEnv(env) } : void 0,
11913
11925
  cwd
11914
11926
  });
@@ -11925,10 +11937,6 @@ Done in ${elapsed}`);
11925
11937
  }
11926
11938
 
11927
11939
  // src/commands/run/index.ts
11928
- function buildCommand(command, configArgs, extraArgs) {
11929
- const parts = [command, ...configArgs];
11930
- return [...parts.map(shellQuote), ...extraArgs.map(shellQuote)].join(" ");
11931
- }
11932
11940
  function printAvailableConfigs(configs) {
11933
11941
  console.error("Available configurations:");
11934
11942
  for (const r of configs) {
@@ -11952,7 +11960,11 @@ function exitWithConfigNotFound(name, configs) {
11952
11960
  }
11953
11961
  function findRunConfig(name) {
11954
11962
  const configs = requireRunConfigs();
11955
- return configs.find((r) => r.name === name) ?? exitWithConfigNotFound(name, configs);
11963
+ const exact = configs.find((r) => r.name === name);
11964
+ if (exact) return exact;
11965
+ const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name}`));
11966
+ if (suffixMatches.length === 1) return suffixMatches[0];
11967
+ return exitWithConfigNotFound(name, configs);
11956
11968
  }
11957
11969
  function listRunConfigs(verbose) {
11958
11970
  const configs = requireRunConfigs();
@@ -11966,11 +11978,12 @@ function listRunConfigs(verbose) {
11966
11978
  }
11967
11979
  }
11968
11980
  function execRunConfig(config, args) {
11969
- const cwd = config.cwd ? resolve9(getConfigDir(), config.cwd) : void 0;
11981
+ const cwd = config.cwd ? resolve10(getConfigDir(), config.cwd) : void 0;
11970
11982
  if (config.pre) runPreCommands(config.pre, cwd);
11971
11983
  const resolved = resolveParams(config.params, args);
11972
11984
  spawnRunCommand(
11973
- buildCommand(config.command, config.args ?? [], resolved),
11985
+ config.command,
11986
+ [...config.args ?? [], ...resolved],
11974
11987
  config.env,
11975
11988
  cwd
11976
11989
  );
@@ -11986,7 +11999,7 @@ function run3(name, args) {
11986
11999
 
11987
12000
  // src/commands/run/add.ts
11988
12001
  import { mkdirSync as mkdirSync13, writeFileSync as writeFileSync28 } from "fs";
11989
- import { join as join44 } from "path";
12002
+ import { join as join45 } from "path";
11990
12003
 
11991
12004
  // src/commands/run/extractOption.ts
11992
12005
  function extractOption(args, flag) {
@@ -12047,7 +12060,7 @@ function saveNewRunConfig(name, command, args, cwd) {
12047
12060
  saveConfig(config);
12048
12061
  }
12049
12062
  function createCommandFile(name) {
12050
- const dir = join44(".claude", "commands");
12063
+ const dir = join45(".claude", "commands");
12051
12064
  mkdirSync13(dir, { recursive: true });
12052
12065
  const content = `---
12053
12066
  description: Run ${name}
@@ -12055,7 +12068,7 @@ description: Run ${name}
12055
12068
 
12056
12069
  Run \`assist run ${name} $ARGUMENTS 2>&1\`.
12057
12070
  `;
12058
- const filePath = join44(dir, `${name}.md`);
12071
+ const filePath = join45(dir, `${name}.md`);
12059
12072
  writeFileSync28(filePath, content);
12060
12073
  console.log(`Created command file: ${filePath}`);
12061
12074
  }
@@ -12109,8 +12122,8 @@ function link2() {
12109
12122
  }
12110
12123
 
12111
12124
  // src/commands/run/remove.ts
12112
- import { existsSync as existsSync41, unlinkSync as unlinkSync11 } from "fs";
12113
- import { join as join45 } from "path";
12125
+ import { existsSync as existsSync42, unlinkSync as unlinkSync11 } from "fs";
12126
+ import { join as join46 } from "path";
12114
12127
  function findRemoveIndex() {
12115
12128
  const idx = process.argv.indexOf("remove");
12116
12129
  if (idx === -1 || idx + 1 >= process.argv.length) return -1;
@@ -12125,8 +12138,8 @@ function parseRemoveName() {
12125
12138
  return process.argv[idx + 1];
12126
12139
  }
12127
12140
  function deleteCommandFile(name) {
12128
- const filePath = join45(".claude", "commands", `${name}.md`);
12129
- if (existsSync41(filePath)) {
12141
+ const filePath = join46(".claude", "commands", `${name}.md`);
12142
+ if (existsSync42(filePath)) {
12130
12143
  unlinkSync11(filePath);
12131
12144
  console.log(`Deleted command file: ${filePath}`);
12132
12145
  }
@@ -12162,9 +12175,9 @@ function registerRun(program2) {
12162
12175
 
12163
12176
  // src/commands/screenshot/index.ts
12164
12177
  import { execSync as execSync41 } from "child_process";
12165
- import { existsSync as existsSync42, mkdirSync as mkdirSync14, unlinkSync as unlinkSync12, writeFileSync as writeFileSync29 } from "fs";
12178
+ import { existsSync as existsSync43, mkdirSync as mkdirSync14, unlinkSync as unlinkSync12, writeFileSync as writeFileSync29 } from "fs";
12166
12179
  import { tmpdir as tmpdir6 } from "os";
12167
- import { join as join46, resolve as resolve10 } from "path";
12180
+ import { join as join47, resolve as resolve11 } from "path";
12168
12181
  import chalk132 from "chalk";
12169
12182
 
12170
12183
  // src/commands/screenshot/captureWindowPs1.ts
@@ -12294,14 +12307,14 @@ Write-Output $OutputPath
12294
12307
 
12295
12308
  // src/commands/screenshot/index.ts
12296
12309
  function buildOutputPath(outputDir, processName) {
12297
- if (!existsSync42(outputDir)) {
12310
+ if (!existsSync43(outputDir)) {
12298
12311
  mkdirSync14(outputDir, { recursive: true });
12299
12312
  }
12300
12313
  const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
12301
- return resolve10(outputDir, `${processName}-${timestamp}.png`);
12314
+ return resolve11(outputDir, `${processName}-${timestamp}.png`);
12302
12315
  }
12303
12316
  function runPowerShellScript(processName, outputPath) {
12304
- const scriptPath = join46(tmpdir6(), `assist-screenshot-${Date.now()}.ps1`);
12317
+ const scriptPath = join47(tmpdir6(), `assist-screenshot-${Date.now()}.ps1`);
12305
12318
  writeFileSync29(scriptPath, captureWindowPs1, "utf-8");
12306
12319
  try {
12307
12320
  execSync41(
@@ -12314,7 +12327,7 @@ function runPowerShellScript(processName, outputPath) {
12314
12327
  }
12315
12328
  function screenshot(processName) {
12316
12329
  const config = loadConfig();
12317
- const outputDir = resolve10(config.screenshot.outputDir);
12330
+ const outputDir = resolve11(config.screenshot.outputDir);
12318
12331
  const outputPath = buildOutputPath(outputDir, processName);
12319
12332
  console.log(chalk132.gray(`Capturing window for process "${processName}" ...`));
12320
12333
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.189.0",
3
+ "version": "0.189.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {