@staff0rd/assist 0.311.0 → 0.312.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 +52 -48
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -158,6 +158,7 @@ The first backlog command in a repository that still has a local `.assist/backlo
158
158
  - `prs.slack` - The Slack channel (e.g. `#example`) that `/prs-slack` posts pull requests to via the Slack MCP connector
159
159
  - `assist verify` - Run all verify:* commands in parallel (from run configs in assist.yml and scripts in package.json)
160
160
  - `assist verify all` - Run all checks, ignoring diff-based filters
161
+ - `assist verify --measure` - After the run, print a summary table of each command's status and duration (slowest first) plus a wall-clock total
161
162
  - `assist verify init` - Add verify scripts to a project (writes to `assist.yml` by default; pass `--package-json` to write to `package.json` scripts instead)
162
163
  - `assist verify hardcoded-colors` - Check for hardcoded hex colors in src/ (supports `hardcodedColors.ignore` globs in config)
163
164
  - `assist verify comment-policy` - Flag comments added on changed lines (staged + unstaged) unless they carry a justification marker; supports `commentPolicy.markers` and `commentPolicy.ignore` globs in config
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.311.0",
9
+ version: "0.312.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -2129,7 +2129,7 @@ function filterByChangedFiles(entries) {
2129
2129
  });
2130
2130
  }
2131
2131
 
2132
- // src/commands/verify/run/createTimerCallback/printTaskStatuses.ts
2132
+ // src/commands/verify/run/printMeasureTable.ts
2133
2133
  function formatDuration(ms) {
2134
2134
  if (ms < 1e3) {
2135
2135
  return `${ms}ms`;
@@ -2137,38 +2137,31 @@ function formatDuration(ms) {
2137
2137
  const seconds = (ms / 1e3).toFixed(1);
2138
2138
  return `${seconds}s`;
2139
2139
  }
2140
- function printTaskStatuses(tasks) {
2141
- console.log("\n--- Task Status ---");
2142
- for (const task of tasks) {
2143
- if (task.endTime !== void 0) {
2144
- const duration = formatDuration(task.endTime - task.startTime);
2145
- const status2 = task.code === 0 ? "\u2713" : "\u2717";
2146
- console.log(` ${status2} ${task.script}: ${duration}`);
2147
- } else {
2148
- const elapsed = formatDuration(Date.now() - task.startTime);
2149
- console.log(` \u22EF ${task.script}: running (${elapsed})`);
2150
- }
2140
+ function printMeasureTable(records, totalMs) {
2141
+ const rows = [...records].sort((a, b) => b.durationMs - a.durationMs).map((record) => ({
2142
+ status: record.code === 0 ? "\u2713" : "\u2717",
2143
+ name: record.script,
2144
+ duration: formatDuration(record.durationMs)
2145
+ }));
2146
+ const nameWidth = Math.max(
2147
+ "Command".length,
2148
+ "TOTAL".length,
2149
+ ...rows.map((row) => row.name.length)
2150
+ );
2151
+ const durationWidth = Math.max(
2152
+ "Duration".length,
2153
+ formatDuration(totalMs).length,
2154
+ ...rows.map((row) => row.duration.length)
2155
+ );
2156
+ const line = (status2, name, duration) => ` ${status2.padEnd(6)} ${name.padEnd(nameWidth)} ${duration.padStart(durationWidth)}`;
2157
+ const separator = ` ${" ".repeat(6)} ${"\u2500".repeat(nameWidth)} ${"\u2500".repeat(durationWidth)}`;
2158
+ console.log();
2159
+ console.log(line("Status", "Command", "Duration"));
2160
+ for (const row of rows) {
2161
+ console.log(line(row.status, row.name, row.duration));
2151
2162
  }
2152
- console.log("-------------------\n");
2153
- }
2154
-
2155
- // src/commands/verify/run/createTimerCallback/index.ts
2156
- function logFailedScripts(failed2) {
2157
- console.error(`
2158
- ${failed2.length} script(s) failed:`);
2159
- for (const f of failed2) {
2160
- console.error(` - ${f.script} (exit code ${f.code})`);
2161
- }
2162
- }
2163
- function createTimerCallback(taskStatuses, index3) {
2164
- return (exitCode) => {
2165
- taskStatuses[index3].endTime = Date.now();
2166
- taskStatuses[index3].code = exitCode;
2167
- printTaskStatuses(taskStatuses);
2168
- };
2169
- }
2170
- function initTaskStatuses(scripts) {
2171
- return scripts.map((script) => ({ script, startTime: Date.now() }));
2163
+ console.log(separator);
2164
+ console.log(line("", "TOTAL", formatDuration(totalMs)));
2172
2165
  }
2173
2166
 
2174
2167
  // src/commands/verify/run/spawnCommand.ts
@@ -2216,8 +2209,16 @@ function flushIfFailed(exitCode, chunks) {
2216
2209
  }
2217
2210
 
2218
2211
  // src/commands/verify/run/runAllEntries.ts
2219
- function runEntry(entry, onComplete) {
2212
+ function logFailedScripts(failed2) {
2213
+ console.error(`
2214
+ ${failed2.length} script(s) failed:`);
2215
+ for (const f of failed2) {
2216
+ console.error(` - ${f.script} (exit code ${f.code})`);
2217
+ }
2218
+ }
2219
+ function runEntry(entry) {
2220
2220
  return new Promise((resolve16) => {
2221
+ const startTime = Date.now();
2221
2222
  const child = spawnCommand(
2222
2223
  entry.fullCommand,
2223
2224
  entry.cwd,
@@ -2228,8 +2229,11 @@ function runEntry(entry, onComplete) {
2228
2229
  child.on("close", (code) => {
2229
2230
  const exitCode = code ?? 1;
2230
2231
  flushIfFailed(exitCode, chunks);
2231
- onComplete?.(exitCode);
2232
- resolve16({ script: entry.name, code: exitCode });
2232
+ resolve16({
2233
+ script: entry.name,
2234
+ code: exitCode,
2235
+ durationMs: Date.now() - startTime
2236
+ });
2233
2237
  });
2234
2238
  });
2235
2239
  }
@@ -2238,16 +2242,10 @@ function exitIfFailed(failed2) {
2238
2242
  logFailedScripts(failed2);
2239
2243
  process.exit(1);
2240
2244
  }
2241
- function runAllEntries(entries, timer) {
2242
- const taskStatuses = initTaskStatuses(entries.map((e) => e.name));
2243
- return Promise.all(
2244
- entries.map(
2245
- (entry, index3) => runEntry(
2246
- entry,
2247
- timer ? createTimerCallback(taskStatuses, index3) : void 0
2248
- )
2249
- )
2250
- );
2245
+ async function runAllEntries(entries) {
2246
+ const startTime = Date.now();
2247
+ const results = await Promise.all(entries.map((entry) => runEntry(entry)));
2248
+ return { results, totalMs: Date.now() - startTime };
2251
2249
  }
2252
2250
  function handleResults(results, totalCount) {
2253
2251
  exitIfFailed(results.filter((r) => r.code !== 0));
@@ -2275,7 +2273,10 @@ async function run(options2 = {}) {
2275
2273
  return;
2276
2274
  }
2277
2275
  printEntryList(entries);
2278
- const results = await runAllEntries(entries, options2.timer ?? false);
2276
+ const { results, totalMs } = await runAllEntries(entries);
2277
+ if (options2.measure) {
2278
+ printMeasureTable(results, totalMs);
2279
+ }
2279
2280
  handleResults(results, entries.length);
2280
2281
  }
2281
2282
 
@@ -18256,7 +18257,10 @@ function registerVerify(program2) {
18256
18257
  const verifyCommand = program2.command("verify").description("Run all verify:* commands in parallel").argument(
18257
18258
  "[scope]",
18258
18259
  'Use "all" to run all checks, ignoring diff-based filters'
18259
- ).option("--timer", "Show timing information for each task as they complete").option("--verbose", "Show all output (bypass CLAUDECODE suppression)").action((scope, options2) => {
18260
+ ).option(
18261
+ "--measure",
18262
+ "Print a summary table of each command's status and duration after the run"
18263
+ ).option("--verbose", "Show all output (bypass CLAUDECODE suppression)").action((scope, options2) => {
18260
18264
  if (scope && scope !== "all") {
18261
18265
  console.error(
18262
18266
  `Unknown scope: "${scope}". Use "all" to run all checks.`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.311.0",
3
+ "version": "0.312.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {