@staff0rd/assist 0.433.2 → 0.433.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 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.433.2",
9
+ version: "0.433.4",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -13883,8 +13883,7 @@ function aggregateResults(fileMetrics) {
13883
13883
  file,
13884
13884
  avgMaintainability,
13885
13885
  minMaintainability,
13886
- override: metrics.override,
13887
- largestFunction: metrics.largestFunction
13886
+ override: metrics.override
13888
13887
  });
13889
13888
  }
13890
13889
  results.sort((a, b) => a.minMaintainability - b.minMaintainability);
@@ -13911,12 +13910,10 @@ function collectFileMetrics(files) {
13911
13910
  fileMetrics.set(file, {
13912
13911
  sloc: countSloc(content),
13913
13912
  functions: [],
13914
- override: parseMaintainabilityOverride(content),
13915
- largestFunction: "",
13916
- largestFunctionSize: -1
13913
+ override: parseMaintainabilityOverride(content)
13917
13914
  });
13918
13915
  }
13919
- forEachFunction(files, (file, name, node) => {
13916
+ forEachFunction(files, (file, _name, node) => {
13920
13917
  const metrics = fileMetrics.get(file);
13921
13918
  if (metrics) {
13922
13919
  const complexity = calculateCyclomaticComplexity(node);
@@ -13927,11 +13924,6 @@ function collectFileMetrics(files) {
13927
13924
  metrics.sloc
13928
13925
  );
13929
13926
  metrics.functions.push(mi);
13930
- const size = node.end - node.pos;
13931
- if (size > metrics.largestFunctionSize) {
13932
- metrics.largestFunctionSize = size;
13933
- metrics.largestFunction = name;
13934
- }
13935
13927
  }
13936
13928
  });
13937
13929
  return fileMetrics;
@@ -13998,17 +13990,11 @@ function getMaintainabilityGitState() {
13998
13990
  // src/commands/complexity/maintainability/printMaintainabilityFailure.ts
13999
13991
  import path29 from "path";
14000
13992
  import chalk119 from "chalk";
14001
- function suggestDestination(file, functionName) {
14002
- return path29.join(path29.dirname(file), `${functionName}.ts`);
14003
- }
13993
+ var extractTemplate = "assist refactor extract <file> <functionName> <destination> --apply";
14004
13994
  function remediationLine(entry) {
14005
- const { file, largestFunction } = entry;
14006
- if (largestFunction === "" || largestFunction.startsWith("<"))
14007
- return ` Move the largest responsibility out of ${chalk119.bold(file)} into a new file with 'assist refactor extract'.`;
14008
- const dest = suggestDestination(file, largestFunction);
14009
- const command = `assist refactor extract ${file} ${largestFunction} ${dest} --apply`;
14010
- return ` ${chalk119.bold(file)} \u2192 extract '${largestFunction}' to a new file:
14011
- ${chalk119.cyan(command)}`;
13995
+ return ` ${chalk119.bold(entry.file)}
13996
+ Pick a responsibility and extract it:
13997
+ ${chalk119.cyan(extractTemplate)}`;
14012
13998
  }
14013
13999
  function cheatLine(entry, gitState) {
14014
14000
  const shrank = gitState.shrunkFiles.has(path29.resolve(entry.file));
@@ -25414,7 +25400,8 @@ function toSessionInfo({
25414
25400
  usedPct,
25415
25401
  design,
25416
25402
  pendingPrPreview,
25417
- undurable
25403
+ undurable,
25404
+ closing
25418
25405
  }) {
25419
25406
  return {
25420
25407
  id,
@@ -25443,7 +25430,8 @@ function toSessionInfo({
25443
25430
  usedPct,
25444
25431
  design,
25445
25432
  pendingPrPreview,
25446
- undurable
25433
+ undurable,
25434
+ closing
25447
25435
  };
25448
25436
  }
25449
25437
 
@@ -25965,6 +25953,7 @@ async function resolveDoneDurability(session, finalize, notify2) {
25965
25953
  await reapWorktree(worktree.path);
25966
25954
  session.worktree = void 0;
25967
25955
  session.undurable = void 0;
25956
+ session.closing = void 0;
25968
25957
  session.gitWatcher?.close();
25969
25958
  session.gitWatcher = void 0;
25970
25959
  finalize();
@@ -25973,6 +25962,7 @@ function holdStopped(session, reason, finalize, notify2) {
25973
25962
  if (session.undurable?.reason !== reason)
25974
25963
  daemonLog(`session ${session.id} stopped; reap blocked: ${reason}`);
25975
25964
  session.undurable = { reason };
25965
+ session.closing = void 0;
25976
25966
  setStatus2(session, "stopped");
25977
25967
  if (!session.gitWatcher && session.worktree)
25978
25968
  session.gitWatcher = watchGitState(session.worktree.path, () => {
@@ -25999,14 +25989,17 @@ function dismissSessionGated(sessions, id, notify2, discard = false) {
25999
25989
  }
26000
25990
  removeCard();
26001
25991
  };
25992
+ s.closing = true;
26002
25993
  if (s.pty) {
26003
25994
  s.pendingDismiss = discard ? () => void discardTree() : () => void resolveDoneDurability(s, removeCard, notify2);
26004
25995
  daemonLog(
26005
25996
  `session ${id} ${discard ? "discard" : "dismiss"} requested: killing process tree first`
26006
25997
  );
26007
25998
  killPtyTree(s.pty);
25999
+ notify2();
26008
26000
  return;
26009
26001
  }
26002
+ notify2();
26010
26003
  if (discard) void discardTree();
26011
26004
  else void resolveDoneDurability(s, removeCard, notify2);
26012
26005
  }
@@ -26418,6 +26411,8 @@ function applyStatusChange(session, status3, exitCode, dismiss, notify2, reuseFo
26418
26411
  const deps2 = { dismiss, notify: notify2, reuseForRun };
26419
26412
  const chainsToNextRun = shouldAutoRun(session, status3).run;
26420
26413
  if (status3 === "done" && session.worktree && !chainsToNextRun) {
26414
+ session.closing = true;
26415
+ notify2();
26421
26416
  void resolveDoneDurability(
26422
26417
  session,
26423
26418
  () => finishStatusChange(session, "done", exitCode, deps2),
@@ -26655,6 +26650,7 @@ function respawnSession(session, respawn, status3, clients, onStatusChange) {
26655
26650
  session.gitWatcher = void 0;
26656
26651
  session.undurable = void 0;
26657
26652
  session.pendingDismiss = void 0;
26653
+ session.closing = void 0;
26658
26654
  session.scrollback = "";
26659
26655
  session.startedAt = Date.now();
26660
26656
  session.runningMs = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.433.2",
3
+ "version": "0.433.4",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {