@staff0rd/assist 0.57.0 → 0.58.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.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +65 -13
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -74,6 +74,7 @@ After installation, the `assist` command will be available globally.
74
74
  - `assist devlog next` - Show commits for the day after the last versioned entry
75
75
  - `assist devlog skip <date>` - Add a date to the skip list
76
76
  - `assist devlog version` - Show current repo name and version info
77
+ - `assist update` - Update assist to the latest version and sync commands
77
78
  - `assist vscode init` - Add VS Code configuration files
78
79
  - `assist deploy init` - Initialize Netlify project and configure deployment
79
80
  - `assist deploy redirect` - Add trailing slash redirect script to index.html
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.57.0",
9
+ version: "0.58.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -221,9 +221,9 @@ function isTraversable(value) {
221
221
  function stepInto(current, key) {
222
222
  return isTraversable(current) ? current[key] : void 0;
223
223
  }
224
- function getNestedValue(obj, path30) {
224
+ function getNestedValue(obj, path31) {
225
225
  let current = obj;
226
- for (const key of path30.split(".")) current = stepInto(current, key);
226
+ for (const key of path31.split(".")) current = stepInto(current, key);
227
227
  return current;
228
228
  }
229
229
  function isPlainObject(val) {
@@ -240,8 +240,8 @@ function buildNestedPath(root, keys) {
240
240
  }
241
241
  return current;
242
242
  }
243
- function setNestedValue(obj, path30, value) {
244
- const keys = path30.split(".");
243
+ function setNestedValue(obj, path31, value) {
244
+ const keys = path31.split(".");
245
245
  const result = { ...obj };
246
246
  buildNestedPath(result, keys)[keys[keys.length - 1]] = value;
247
247
  return result;
@@ -1362,18 +1362,18 @@ function initTaskStatuses(scripts) {
1362
1362
  function spawnScript(script, cwd) {
1363
1363
  return spawn("npm", ["run", script], { stdio: "inherit", shell: true, cwd });
1364
1364
  }
1365
- function onScriptClose(script, onComplete, resolve2) {
1365
+ function onScriptClose(script, onComplete, resolve3) {
1366
1366
  return (code) => {
1367
1367
  const exitCode = code ?? 1;
1368
1368
  onComplete?.(exitCode);
1369
- resolve2({ script, code: exitCode });
1369
+ resolve3({ script, code: exitCode });
1370
1370
  };
1371
1371
  }
1372
1372
  function runScript(script, cwd, onComplete) {
1373
- return new Promise((resolve2) => {
1373
+ return new Promise((resolve3) => {
1374
1374
  spawnScript(script, cwd).on(
1375
1375
  "close",
1376
- onScriptClose(script, onComplete, resolve2)
1376
+ onScriptClose(script, onComplete, resolve3)
1377
1377
  );
1378
1378
  });
1379
1379
  }
@@ -3601,7 +3601,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
3601
3601
 
3602
3602
  // src/commands/refactor/check/index.ts
3603
3603
  function runScript2(script, cwd) {
3604
- return new Promise((resolve2) => {
3604
+ return new Promise((resolve3) => {
3605
3605
  const child = spawn3("npm", ["run", script], {
3606
3606
  stdio: "pipe",
3607
3607
  shell: true,
@@ -3615,7 +3615,7 @@ function runScript2(script, cwd) {
3615
3615
  output += data.toString();
3616
3616
  });
3617
3617
  child.on("close", (code) => {
3618
- resolve2({ script, code: code ?? 1, output });
3618
+ resolve3({ script, code: code ?? 1, output });
3619
3619
  });
3620
3620
  });
3621
3621
  }
@@ -4238,9 +4238,9 @@ function createReadlineInterface() {
4238
4238
  });
4239
4239
  }
4240
4240
  function askQuestion(rl, question) {
4241
- return new Promise((resolve2) => {
4241
+ return new Promise((resolve3) => {
4242
4242
  rl.question(question, (answer) => {
4243
- resolve2(answer.trim());
4243
+ resolve3(answer.trim());
4244
4244
  });
4245
4245
  });
4246
4246
  }
@@ -5057,6 +5057,57 @@ function syncCommands(claudeDir, targetBase) {
5057
5057
  console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
5058
5058
  }
5059
5059
 
5060
+ // src/commands/update.ts
5061
+ import { execSync as execSync23 } from "child_process";
5062
+ import * as path30 from "path";
5063
+ import { fileURLToPath as fileURLToPath4 } from "url";
5064
+ var __filename3 = fileURLToPath4(import.meta.url);
5065
+ var __dirname5 = path30.dirname(__filename3);
5066
+ function getInstallDir() {
5067
+ return path30.resolve(__dirname5, "..");
5068
+ }
5069
+ function isGitRepo(dir) {
5070
+ try {
5071
+ execSync23("git rev-parse --is-inside-work-tree", {
5072
+ cwd: dir,
5073
+ stdio: "pipe"
5074
+ });
5075
+ return true;
5076
+ } catch {
5077
+ return false;
5078
+ }
5079
+ }
5080
+ function isGlobalNpmInstall(dir) {
5081
+ try {
5082
+ const globalPrefix = execSync23("npm prefix -g", { stdio: "pipe" }).toString().trim();
5083
+ return dir.startsWith(globalPrefix);
5084
+ } catch {
5085
+ return false;
5086
+ }
5087
+ }
5088
+ async function update() {
5089
+ const installDir = getInstallDir();
5090
+ console.log(`Assist is installed at: ${installDir}`);
5091
+ if (isGitRepo(installDir)) {
5092
+ console.log("Detected git repo installation, pulling latest...");
5093
+ execSync23("git pull", { cwd: installDir, stdio: "inherit" });
5094
+ console.log("Building...");
5095
+ execSync23("npm run build", { cwd: installDir, stdio: "inherit" });
5096
+ console.log("Syncing commands...");
5097
+ execSync23("assist sync", { stdio: "inherit" });
5098
+ } else if (isGlobalNpmInstall(installDir)) {
5099
+ console.log("Detected global npm installation, updating...");
5100
+ execSync23("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
5101
+ console.log("Syncing commands...");
5102
+ execSync23("assist sync", { stdio: "inherit" });
5103
+ } else {
5104
+ console.error(
5105
+ "Could not determine installation method. Expected a git repo or global npm install."
5106
+ );
5107
+ process.exit(1);
5108
+ }
5109
+ }
5110
+
5060
5111
  // src/index.ts
5061
5112
  var program = new Command();
5062
5113
  program.name("assist").description("CLI application").version(package_default.version);
@@ -5080,6 +5131,7 @@ program.command("status-line").description("Format Claude Code status line from
5080
5131
  program.command("notify").description(
5081
5132
  "Show notification from Claude Code hook (reads JSON from stdin)"
5082
5133
  ).action(notify);
5134
+ program.command("update").description("Update assist to the latest version and sync commands").action(update);
5083
5135
  registerPrs(program);
5084
5136
  registerBacklog(program);
5085
5137
  registerVerify(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.57.0",
3
+ "version": "0.58.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {