@staff0rd/assist 0.57.0 → 0.58.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/README.md +1 -0
- package/dist/index.js +68 -14
- 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.
|
|
9
|
+
version: "0.58.1",
|
|
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,
|
|
224
|
+
function getNestedValue(obj, path31) {
|
|
225
225
|
let current = obj;
|
|
226
|
-
for (const key of
|
|
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,
|
|
244
|
-
const keys =
|
|
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,
|
|
1365
|
+
function onScriptClose(script, onComplete, resolve3) {
|
|
1366
1366
|
return (code) => {
|
|
1367
1367
|
const exitCode = code ?? 1;
|
|
1368
1368
|
onComplete?.(exitCode);
|
|
1369
|
-
|
|
1369
|
+
resolve3({ script, code: exitCode });
|
|
1370
1370
|
};
|
|
1371
1371
|
}
|
|
1372
1372
|
function runScript(script, cwd, onComplete) {
|
|
1373
|
-
return new Promise((
|
|
1373
|
+
return new Promise((resolve3) => {
|
|
1374
1374
|
spawnScript(script, cwd).on(
|
|
1375
1375
|
"close",
|
|
1376
|
-
onScriptClose(script, onComplete,
|
|
1376
|
+
onScriptClose(script, onComplete, resolve3)
|
|
1377
1377
|
);
|
|
1378
1378
|
});
|
|
1379
1379
|
}
|
|
@@ -2403,7 +2403,9 @@ Analyzed ${results.length} files`));
|
|
|
2403
2403
|
console.error(
|
|
2404
2404
|
chalk31.red(
|
|
2405
2405
|
`
|
|
2406
|
-
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
2406
|
+
Fail: ${filtered.length} file(s) below threshold ${threshold}. Maintainability index (0\u2013100) is derived from Halstead volume, cyclomatic complexity, and lines of code.
|
|
2407
|
+
|
|
2408
|
+
\u26A0\uFE0F ${chalk31.bold("Fix only one file at a time")} \u2014 run 'assist complexity <file>' to see all metrics. For larger files, start by extracting responsibilities into smaller files.`
|
|
2407
2409
|
)
|
|
2408
2410
|
);
|
|
2409
2411
|
process.exit(1);
|
|
@@ -3601,7 +3603,7 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES) {
|
|
|
3601
3603
|
|
|
3602
3604
|
// src/commands/refactor/check/index.ts
|
|
3603
3605
|
function runScript2(script, cwd) {
|
|
3604
|
-
return new Promise((
|
|
3606
|
+
return new Promise((resolve3) => {
|
|
3605
3607
|
const child = spawn3("npm", ["run", script], {
|
|
3606
3608
|
stdio: "pipe",
|
|
3607
3609
|
shell: true,
|
|
@@ -3615,7 +3617,7 @@ function runScript2(script, cwd) {
|
|
|
3615
3617
|
output += data.toString();
|
|
3616
3618
|
});
|
|
3617
3619
|
child.on("close", (code) => {
|
|
3618
|
-
|
|
3620
|
+
resolve3({ script, code: code ?? 1, output });
|
|
3619
3621
|
});
|
|
3620
3622
|
});
|
|
3621
3623
|
}
|
|
@@ -4238,9 +4240,9 @@ function createReadlineInterface() {
|
|
|
4238
4240
|
});
|
|
4239
4241
|
}
|
|
4240
4242
|
function askQuestion(rl, question) {
|
|
4241
|
-
return new Promise((
|
|
4243
|
+
return new Promise((resolve3) => {
|
|
4242
4244
|
rl.question(question, (answer) => {
|
|
4243
|
-
|
|
4245
|
+
resolve3(answer.trim());
|
|
4244
4246
|
});
|
|
4245
4247
|
});
|
|
4246
4248
|
}
|
|
@@ -5057,6 +5059,57 @@ function syncCommands(claudeDir, targetBase) {
|
|
|
5057
5059
|
console.log(`Synced ${files.length} command(s) to ~/.claude/commands`);
|
|
5058
5060
|
}
|
|
5059
5061
|
|
|
5062
|
+
// src/commands/update.ts
|
|
5063
|
+
import { execSync as execSync23 } from "child_process";
|
|
5064
|
+
import * as path30 from "path";
|
|
5065
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
5066
|
+
var __filename3 = fileURLToPath4(import.meta.url);
|
|
5067
|
+
var __dirname5 = path30.dirname(__filename3);
|
|
5068
|
+
function getInstallDir() {
|
|
5069
|
+
return path30.resolve(__dirname5, "..");
|
|
5070
|
+
}
|
|
5071
|
+
function isGitRepo(dir) {
|
|
5072
|
+
try {
|
|
5073
|
+
execSync23("git rev-parse --is-inside-work-tree", {
|
|
5074
|
+
cwd: dir,
|
|
5075
|
+
stdio: "pipe"
|
|
5076
|
+
});
|
|
5077
|
+
return true;
|
|
5078
|
+
} catch {
|
|
5079
|
+
return false;
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
function isGlobalNpmInstall(dir) {
|
|
5083
|
+
try {
|
|
5084
|
+
const globalPrefix = execSync23("npm prefix -g", { stdio: "pipe" }).toString().trim();
|
|
5085
|
+
return dir.startsWith(globalPrefix);
|
|
5086
|
+
} catch {
|
|
5087
|
+
return false;
|
|
5088
|
+
}
|
|
5089
|
+
}
|
|
5090
|
+
async function update() {
|
|
5091
|
+
const installDir = getInstallDir();
|
|
5092
|
+
console.log(`Assist is installed at: ${installDir}`);
|
|
5093
|
+
if (isGitRepo(installDir)) {
|
|
5094
|
+
console.log("Detected git repo installation, pulling latest...");
|
|
5095
|
+
execSync23("git pull", { cwd: installDir, stdio: "inherit" });
|
|
5096
|
+
console.log("Building...");
|
|
5097
|
+
execSync23("npm run build", { cwd: installDir, stdio: "inherit" });
|
|
5098
|
+
console.log("Syncing commands...");
|
|
5099
|
+
execSync23("assist sync", { stdio: "inherit" });
|
|
5100
|
+
} else if (isGlobalNpmInstall(installDir)) {
|
|
5101
|
+
console.log("Detected global npm installation, updating...");
|
|
5102
|
+
execSync23("npm i -g @staff0rd/assist@latest", { stdio: "inherit" });
|
|
5103
|
+
console.log("Syncing commands...");
|
|
5104
|
+
execSync23("assist sync", { stdio: "inherit" });
|
|
5105
|
+
} else {
|
|
5106
|
+
console.error(
|
|
5107
|
+
"Could not determine installation method. Expected a git repo or global npm install."
|
|
5108
|
+
);
|
|
5109
|
+
process.exit(1);
|
|
5110
|
+
}
|
|
5111
|
+
}
|
|
5112
|
+
|
|
5060
5113
|
// src/index.ts
|
|
5061
5114
|
var program = new Command();
|
|
5062
5115
|
program.name("assist").description("CLI application").version(package_default.version);
|
|
@@ -5080,6 +5133,7 @@ program.command("status-line").description("Format Claude Code status line from
|
|
|
5080
5133
|
program.command("notify").description(
|
|
5081
5134
|
"Show notification from Claude Code hook (reads JSON from stdin)"
|
|
5082
5135
|
).action(notify);
|
|
5136
|
+
program.command("update").description("Update assist to the latest version and sync commands").action(update);
|
|
5083
5137
|
registerPrs(program);
|
|
5084
5138
|
registerBacklog(program);
|
|
5085
5139
|
registerVerify(program);
|