@staff0rd/assist 0.92.2 → 0.92.4
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 +59 -47
- 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.92.
|
|
9
|
+
version: "0.92.4",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -1424,7 +1424,10 @@ Total: ${lines.length} hardcoded color(s)`);
|
|
|
1424
1424
|
// src/commands/verify/run/resolveEntries.ts
|
|
1425
1425
|
import * as path13 from "path";
|
|
1426
1426
|
function quoteIfNeeded(arg) {
|
|
1427
|
-
|
|
1427
|
+
if (/[^a-zA-Z0-9_./:=@%^+,-]/.test(arg)) {
|
|
1428
|
+
return `'${arg.replace(/'/g, "'\\''")}'`;
|
|
1429
|
+
}
|
|
1430
|
+
return arg;
|
|
1428
1431
|
}
|
|
1429
1432
|
function buildFullCommand(command, args) {
|
|
1430
1433
|
return [quoteIfNeeded(command), ...(args ?? []).map(quoteIfNeeded)].join(" ");
|
|
@@ -1497,6 +1500,32 @@ Total: ${folders.length} venv folder(s)`);
|
|
|
1497
1500
|
}
|
|
1498
1501
|
}
|
|
1499
1502
|
|
|
1503
|
+
// src/commands/verify/run/filterByChangedFiles.ts
|
|
1504
|
+
import { minimatch as minimatch2 } from "minimatch";
|
|
1505
|
+
|
|
1506
|
+
// src/commands/verify/run/getChangedFiles.ts
|
|
1507
|
+
import { execSync as execSync7 } from "child_process";
|
|
1508
|
+
function getChangedFiles() {
|
|
1509
|
+
const output = execSync7("git diff --name-only HEAD", {
|
|
1510
|
+
encoding: "utf-8"
|
|
1511
|
+
}).trim();
|
|
1512
|
+
if (output === "") return [];
|
|
1513
|
+
return output.split("\n");
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
// src/commands/verify/run/filterByChangedFiles.ts
|
|
1517
|
+
function filterByChangedFiles(entries) {
|
|
1518
|
+
const hasFilters = entries.some((e) => e.filter);
|
|
1519
|
+
if (!hasFilters) return entries;
|
|
1520
|
+
const changedFiles = getChangedFiles();
|
|
1521
|
+
return entries.filter((entry) => {
|
|
1522
|
+
const { filter } = entry;
|
|
1523
|
+
if (!filter) return true;
|
|
1524
|
+
if (changedFiles.length === 0) return false;
|
|
1525
|
+
return changedFiles.some((file) => minimatch2(file, filter));
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1500
1529
|
// src/commands/verify/run/createTimerCallback/printTaskStatuses.ts
|
|
1501
1530
|
function formatDuration(ms) {
|
|
1502
1531
|
if (ms < 1e3) {
|
|
@@ -1539,32 +1568,6 @@ function initTaskStatuses(scripts) {
|
|
|
1539
1568
|
return scripts.map((script) => ({ script, startTime: Date.now() }));
|
|
1540
1569
|
}
|
|
1541
1570
|
|
|
1542
|
-
// src/commands/verify/run/filterByChangedFiles.ts
|
|
1543
|
-
import { minimatch as minimatch2 } from "minimatch";
|
|
1544
|
-
|
|
1545
|
-
// src/commands/verify/run/getChangedFiles.ts
|
|
1546
|
-
import { execSync as execSync7 } from "child_process";
|
|
1547
|
-
function getChangedFiles() {
|
|
1548
|
-
const output = execSync7("git diff --name-only HEAD", {
|
|
1549
|
-
encoding: "utf-8"
|
|
1550
|
-
}).trim();
|
|
1551
|
-
if (output === "") return [];
|
|
1552
|
-
return output.split("\n");
|
|
1553
|
-
}
|
|
1554
|
-
|
|
1555
|
-
// src/commands/verify/run/filterByChangedFiles.ts
|
|
1556
|
-
function filterByChangedFiles(entries) {
|
|
1557
|
-
const hasFilters = entries.some((e) => e.filter);
|
|
1558
|
-
if (!hasFilters) return entries;
|
|
1559
|
-
const changedFiles = getChangedFiles();
|
|
1560
|
-
return entries.filter((entry) => {
|
|
1561
|
-
const { filter } = entry;
|
|
1562
|
-
if (!filter) return true;
|
|
1563
|
-
if (changedFiles.length === 0) return false;
|
|
1564
|
-
return changedFiles.some((file) => minimatch2(file, filter));
|
|
1565
|
-
});
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
1571
|
// src/commands/verify/run/spawnCommand.ts
|
|
1569
1572
|
import { spawn } from "child_process";
|
|
1570
1573
|
|
|
@@ -1580,17 +1583,20 @@ function expandEnv(env) {
|
|
|
1580
1583
|
}
|
|
1581
1584
|
|
|
1582
1585
|
// src/commands/verify/run/spawnCommand.ts
|
|
1583
|
-
var
|
|
1586
|
+
var suppressOutput = !!process.env.CLAUDECODE;
|
|
1587
|
+
function setVerbose(verbose) {
|
|
1588
|
+
if (verbose) suppressOutput = false;
|
|
1589
|
+
}
|
|
1584
1590
|
function spawnCommand(fullCommand, cwd, env) {
|
|
1585
1591
|
return spawn(fullCommand, [], {
|
|
1586
|
-
stdio:
|
|
1592
|
+
stdio: suppressOutput ? "pipe" : "inherit",
|
|
1587
1593
|
shell: true,
|
|
1588
1594
|
cwd: cwd ?? process.cwd(),
|
|
1589
1595
|
env: env ? { ...process.env, ...expandEnv(env) } : void 0
|
|
1590
1596
|
});
|
|
1591
1597
|
}
|
|
1592
1598
|
function collectOutput(child) {
|
|
1593
|
-
if (!
|
|
1599
|
+
if (!suppressOutput) return [];
|
|
1594
1600
|
const chunks = [];
|
|
1595
1601
|
child.stdout?.on("data", (data) => chunks.push(data));
|
|
1596
1602
|
child.stderr?.on("data", (data) => chunks.push(data));
|
|
@@ -1602,7 +1608,7 @@ function flushIfFailed(exitCode, chunks) {
|
|
|
1602
1608
|
}
|
|
1603
1609
|
}
|
|
1604
1610
|
|
|
1605
|
-
// src/commands/verify/run/
|
|
1611
|
+
// src/commands/verify/run/runAllEntries.ts
|
|
1606
1612
|
function runEntry(entry, onComplete) {
|
|
1607
1613
|
return new Promise((resolve3) => {
|
|
1608
1614
|
const child = spawnCommand(entry.fullCommand, entry.cwd, entry.env);
|
|
@@ -1615,6 +1621,11 @@ function runEntry(entry, onComplete) {
|
|
|
1615
1621
|
});
|
|
1616
1622
|
});
|
|
1617
1623
|
}
|
|
1624
|
+
function exitIfFailed(failed) {
|
|
1625
|
+
if (failed.length === 0) return;
|
|
1626
|
+
logFailedScripts(failed);
|
|
1627
|
+
process.exit(1);
|
|
1628
|
+
}
|
|
1618
1629
|
function runAllEntries(entries, timer) {
|
|
1619
1630
|
const taskStatuses = initTaskStatuses(entries.map((e) => e.name));
|
|
1620
1631
|
return Promise.all(
|
|
@@ -1626,29 +1637,27 @@ function runAllEntries(entries, timer) {
|
|
|
1626
1637
|
)
|
|
1627
1638
|
);
|
|
1628
1639
|
}
|
|
1640
|
+
function handleResults(results, totalCount) {
|
|
1641
|
+
exitIfFailed(results.filter((r) => r.code !== 0));
|
|
1642
|
+
console.log(`
|
|
1643
|
+
All ${totalCount} verify command(s) passed`);
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
// src/commands/verify/run/index.ts
|
|
1629
1647
|
function printEntryList(entries) {
|
|
1630
1648
|
console.log(`Running ${entries.length} verify command(s) in parallel:`);
|
|
1631
1649
|
for (const entry of entries) {
|
|
1632
1650
|
console.log(` - ${entry.name}`);
|
|
1633
1651
|
}
|
|
1634
1652
|
}
|
|
1635
|
-
function exitIfFailed(failed) {
|
|
1636
|
-
if (failed.length === 0) return;
|
|
1637
|
-
logFailedScripts(failed);
|
|
1638
|
-
process.exit(1);
|
|
1639
|
-
}
|
|
1640
|
-
function handleResults(results, totalCount) {
|
|
1641
|
-
exitIfFailed(results.filter((r) => r.code !== 0));
|
|
1642
|
-
console.log(`
|
|
1643
|
-
All ${totalCount} verify command(s) passed`);
|
|
1644
|
-
}
|
|
1645
1653
|
async function run(options2 = {}) {
|
|
1654
|
+
setVerbose(!!options2.verbose);
|
|
1646
1655
|
const allEntries = resolveEntries();
|
|
1656
|
+
const entries = options2.all ? allEntries : filterByChangedFiles(allEntries);
|
|
1647
1657
|
if (allEntries.length === 0) {
|
|
1648
1658
|
console.log("No verify commands found");
|
|
1649
1659
|
return;
|
|
1650
1660
|
}
|
|
1651
|
-
const entries = options2.all ? allEntries : filterByChangedFiles(allEntries);
|
|
1652
1661
|
if (entries.length === 0) {
|
|
1653
1662
|
console.log("No verify commands matched changed files \u2014 skipping");
|
|
1654
1663
|
return;
|
|
@@ -3629,7 +3638,7 @@ import { join as join16 } from "path";
|
|
|
3629
3638
|
import { stringify } from "yaml";
|
|
3630
3639
|
|
|
3631
3640
|
// src/lib/isClaudeCode.ts
|
|
3632
|
-
function
|
|
3641
|
+
function isClaudeCode() {
|
|
3633
3642
|
return process.env.CLAUDECODE !== void 0;
|
|
3634
3643
|
}
|
|
3635
3644
|
|
|
@@ -3730,7 +3739,7 @@ function formatForHuman(comment2) {
|
|
|
3730
3739
|
|
|
3731
3740
|
// src/commands/prs/listComments/index.ts
|
|
3732
3741
|
function formatComment(comment2) {
|
|
3733
|
-
return
|
|
3742
|
+
return isClaudeCode() ? JSON.stringify(comment2) : formatForHuman(comment2);
|
|
3734
3743
|
}
|
|
3735
3744
|
function printComments(comments) {
|
|
3736
3745
|
if (comments.length === 0) {
|
|
@@ -5369,7 +5378,7 @@ function registerVerify(program2) {
|
|
|
5369
5378
|
const verifyCommand = program2.command("verify").description("Run all verify:* commands in parallel").argument(
|
|
5370
5379
|
"[scope]",
|
|
5371
5380
|
'Use "all" to run all checks, ignoring diff-based filters'
|
|
5372
|
-
).option("--timer", "Show timing information for each task as they complete").action((scope, options2) => {
|
|
5381
|
+
).option("--timer", "Show timing information for each task as they complete").option("--verbose", "Show all output (bypass CLAUDECODE suppression)").action((scope, options2) => {
|
|
5373
5382
|
if (scope && scope !== "all") {
|
|
5374
5383
|
console.error(
|
|
5375
5384
|
`Unknown scope: "${scope}". Use "all" to run all checks.`
|
|
@@ -5937,7 +5946,10 @@ function add2() {
|
|
|
5937
5946
|
|
|
5938
5947
|
// src/commands/run/index.ts
|
|
5939
5948
|
function quoteIfNeeded2(arg) {
|
|
5940
|
-
|
|
5949
|
+
if (/[^a-zA-Z0-9_./:=@%^+,-]/.test(arg)) {
|
|
5950
|
+
return `'${arg.replace(/'/g, "'\\''")}'`;
|
|
5951
|
+
}
|
|
5952
|
+
return arg;
|
|
5941
5953
|
}
|
|
5942
5954
|
function buildCommand(command, configArgs, extraArgs) {
|
|
5943
5955
|
const allArgs = [...configArgs, ...extraArgs];
|