@staff0rd/assist 0.433.1 → 0.433.3
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/commands/sessions/web/bundle.js +385 -385
- package/dist/index.js +39 -35
- 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.433.
|
|
9
|
+
version: "0.433.3",
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
14006
|
-
|
|
14007
|
-
|
|
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));
|
|
@@ -29461,7 +29447,21 @@ import { fileURLToPath as fileURLToPath9 } from "url";
|
|
|
29461
29447
|
// src/commands/sync/syncClaudeMd.ts
|
|
29462
29448
|
import * as fs42 from "fs";
|
|
29463
29449
|
import * as path61 from "path";
|
|
29450
|
+
import chalk208 from "chalk";
|
|
29451
|
+
|
|
29452
|
+
// src/commands/sync/printAutoConfirmHint.ts
|
|
29464
29453
|
import chalk207 from "chalk";
|
|
29454
|
+
var autoConfirmHintCommand = "assist config set sync.autoConfirm true --global";
|
|
29455
|
+
function printAutoConfirmHint() {
|
|
29456
|
+
console.log(
|
|
29457
|
+
chalk207.dim(
|
|
29458
|
+
`Tip: run \`${autoConfirmHintCommand}\` to overwrite automatically next time`
|
|
29459
|
+
)
|
|
29460
|
+
);
|
|
29461
|
+
console.log();
|
|
29462
|
+
}
|
|
29463
|
+
|
|
29464
|
+
// src/commands/sync/syncClaudeMd.ts
|
|
29465
29465
|
async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
29466
29466
|
const source = path61.join(claudeDir, "CLAUDE.md");
|
|
29467
29467
|
const target = path61.join(targetBase, "CLAUDE.md");
|
|
@@ -29470,17 +29470,20 @@ async function syncClaudeMd(claudeDir, targetBase, options2) {
|
|
|
29470
29470
|
const targetContent = fs42.readFileSync(target, "utf8");
|
|
29471
29471
|
if (sourceContent !== targetContent) {
|
|
29472
29472
|
console.log(
|
|
29473
|
-
|
|
29473
|
+
chalk208.yellow("\n\u26A0\uFE0F Warning: CLAUDE.md differs from existing file")
|
|
29474
29474
|
);
|
|
29475
29475
|
console.log();
|
|
29476
29476
|
printDiff(targetContent, sourceContent);
|
|
29477
|
-
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
|
|
29481
|
-
|
|
29482
|
-
|
|
29483
|
-
|
|
29477
|
+
if (!options2?.yes) {
|
|
29478
|
+
printAutoConfirmHint();
|
|
29479
|
+
const confirm = await promptConfirm(
|
|
29480
|
+
chalk208.red("Overwrite existing CLAUDE.md?"),
|
|
29481
|
+
false
|
|
29482
|
+
);
|
|
29483
|
+
if (!confirm) {
|
|
29484
|
+
console.log("Skipped CLAUDE.md");
|
|
29485
|
+
return;
|
|
29486
|
+
}
|
|
29484
29487
|
}
|
|
29485
29488
|
}
|
|
29486
29489
|
}
|
|
@@ -29669,7 +29672,7 @@ function syncPi(claudeDir) {
|
|
|
29669
29672
|
// src/commands/sync/syncSettings.ts
|
|
29670
29673
|
import * as fs47 from "fs";
|
|
29671
29674
|
import * as path68 from "path";
|
|
29672
|
-
import
|
|
29675
|
+
import chalk209 from "chalk";
|
|
29673
29676
|
async function syncSettings(claudeDir, targetBase, options2) {
|
|
29674
29677
|
const source = path68.join(claudeDir, "settings.json");
|
|
29675
29678
|
const target = path68.join(targetBase, "settings.json");
|
|
@@ -29688,14 +29691,15 @@ async function syncSettings(claudeDir, targetBase, options2) {
|
|
|
29688
29691
|
if (mergedContent !== normalizedTarget) {
|
|
29689
29692
|
if (!options2?.yes) {
|
|
29690
29693
|
console.log(
|
|
29691
|
-
|
|
29694
|
+
chalk209.yellow(
|
|
29692
29695
|
"\n\u26A0\uFE0F Warning: settings.json differs from existing file"
|
|
29693
29696
|
)
|
|
29694
29697
|
);
|
|
29695
29698
|
console.log();
|
|
29696
29699
|
printDiff(targetContent, mergedContent);
|
|
29700
|
+
printAutoConfirmHint();
|
|
29697
29701
|
const confirm = await promptConfirm(
|
|
29698
|
-
|
|
29702
|
+
chalk209.red("Overwrite existing settings.json?"),
|
|
29699
29703
|
false
|
|
29700
29704
|
);
|
|
29701
29705
|
if (!confirm) {
|
|
@@ -29794,10 +29798,10 @@ async function update2() {
|
|
|
29794
29798
|
}
|
|
29795
29799
|
|
|
29796
29800
|
// src/reportCliError.ts
|
|
29797
|
-
import
|
|
29801
|
+
import chalk210 from "chalk";
|
|
29798
29802
|
function reportCliError(error) {
|
|
29799
29803
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError) {
|
|
29800
|
-
console.error(
|
|
29804
|
+
console.error(chalk210.red(error.message));
|
|
29801
29805
|
} else {
|
|
29802
29806
|
console.error(error);
|
|
29803
29807
|
}
|