analyze-codebase 1.2.2 ā 1.3.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/.claude/settings.local.json +16 -0
- package/.vscode/settings.json +5 -0
- package/CHANGELOG.md +137 -0
- package/ENHANCEMENTS.md +257 -0
- package/FEATURES.md +225 -0
- package/dist/analyze/i18n/index.js +477 -0
- package/dist/analyze/index.js +187 -25
- package/dist/index.js +203 -16
- package/dist/utils/__tests__/config.test.js +94 -0
- package/dist/utils/__tests__/progress.test.js +37 -0
- package/dist/utils/cancellation.js +75 -0
- package/dist/utils/config.js +83 -0
- package/dist/utils/export.js +218 -0
- package/dist/utils/output.js +137 -41
- package/dist/utils/progress.js +51 -0
- package/dist/utils/spinner.js +61 -0
- package/dist/utils/watch.js +99 -0
- package/docs/agents/developer-agent.md +818 -0
- package/docs/agents/research-agent.md +244 -0
- package/package.json +44 -20
- package/readme.md +163 -86
- package/tsconfig.json +5 -2
- package/vitest.config.ts +12 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createSpinner = exports.Spinner = void 0;
|
|
7
|
+
const ora_1 = __importDefault(require("ora"));
|
|
8
|
+
class Spinner {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.spinner = null;
|
|
11
|
+
}
|
|
12
|
+
start(message) {
|
|
13
|
+
this.spinner = (0, ora_1.default)({
|
|
14
|
+
text: message,
|
|
15
|
+
spinner: "dots",
|
|
16
|
+
color: "cyan",
|
|
17
|
+
}).start();
|
|
18
|
+
}
|
|
19
|
+
update(message) {
|
|
20
|
+
if (this.spinner) {
|
|
21
|
+
this.spinner.text = message;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
succeed(message) {
|
|
25
|
+
if (this.spinner) {
|
|
26
|
+
this.spinner.succeed(message);
|
|
27
|
+
this.spinner = null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
fail(message) {
|
|
31
|
+
if (this.spinner) {
|
|
32
|
+
this.spinner.fail(message);
|
|
33
|
+
this.spinner = null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
warn(message) {
|
|
37
|
+
if (this.spinner) {
|
|
38
|
+
this.spinner.warn(message);
|
|
39
|
+
this.spinner = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
info(message) {
|
|
43
|
+
if (this.spinner) {
|
|
44
|
+
this.spinner.info(message);
|
|
45
|
+
this.spinner = null;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
stop() {
|
|
49
|
+
if (this.spinner) {
|
|
50
|
+
this.spinner.stop();
|
|
51
|
+
this.spinner = null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.Spinner = Spinner;
|
|
56
|
+
const createSpinner = (message) => {
|
|
57
|
+
const spinner = new Spinner();
|
|
58
|
+
spinner.start(message);
|
|
59
|
+
return spinner;
|
|
60
|
+
};
|
|
61
|
+
exports.createSpinner = createSpinner;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.startWatchMode = void 0;
|
|
7
|
+
const chokidar_1 = __importDefault(require("chokidar"));
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const boxen_1 = __importDefault(require("boxen"));
|
|
10
|
+
const runner_1 = __importDefault(require("../runner"));
|
|
11
|
+
// Merge config with CLI options (CLI options take precedence)
|
|
12
|
+
const mergeOptions = (config, cliOptions) => {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14
|
+
return {
|
|
15
|
+
directory: cliOptions.directory || "",
|
|
16
|
+
framework: cliOptions.framework || (config === null || config === void 0 ? void 0 : config.framework),
|
|
17
|
+
extensions: ((_a = cliOptions.extensions) === null || _a === void 0 ? void 0 : _a.length)
|
|
18
|
+
? cliOptions.extensions
|
|
19
|
+
: config === null || config === void 0 ? void 0 : config.extensions,
|
|
20
|
+
exclude: ((_b = cliOptions.exclude) === null || _b === void 0 ? void 0 : _b.length) ? cliOptions.exclude : config === null || config === void 0 ? void 0 : config.exclude,
|
|
21
|
+
checkFileNames: cliOptions.checkFileNames !== undefined
|
|
22
|
+
? cliOptions.checkFileNames
|
|
23
|
+
: (_c = config === null || config === void 0 ? void 0 : config.checkFileNames) !== null && _c !== void 0 ? _c : true,
|
|
24
|
+
checkFileContent: cliOptions.checkFileContent !== undefined
|
|
25
|
+
? cliOptions.checkFileContent
|
|
26
|
+
: (_d = config === null || config === void 0 ? void 0 : config.checkFileContent) !== null && _d !== void 0 ? _d : true,
|
|
27
|
+
writeJsonOutput: cliOptions.writeJsonOutput !== undefined
|
|
28
|
+
? cliOptions.writeJsonOutput
|
|
29
|
+
: (_e = config === null || config === void 0 ? void 0 : config.writeJsonOutput) !== null && _e !== void 0 ? _e : false,
|
|
30
|
+
showProgress: (_f = config === null || config === void 0 ? void 0 : config.showProgress) !== null && _f !== void 0 ? _f : true,
|
|
31
|
+
parallel: (_g = config === null || config === void 0 ? void 0 : config.parallel) !== null && _g !== void 0 ? _g : true,
|
|
32
|
+
maxConcurrency: (_h = config === null || config === void 0 ? void 0 : config.maxConcurrency) !== null && _h !== void 0 ? _h : 50, // Lower for watch mode to avoid overwhelming system
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const startWatchMode = async (directory, options, config) => {
|
|
36
|
+
const mergedOptions = mergeOptions(config, {
|
|
37
|
+
...options,
|
|
38
|
+
directory,
|
|
39
|
+
showProgress: false, // Disable progress in watch mode
|
|
40
|
+
});
|
|
41
|
+
console.log((0, boxen_1.default)(chalk_1.default.cyan("š Watch mode enabled\n") +
|
|
42
|
+
chalk_1.default.gray(`Watching: ${chalk_1.default.white(directory)}\n`) +
|
|
43
|
+
chalk_1.default.gray("Press Ctrl+C to stop"), {
|
|
44
|
+
padding: 1,
|
|
45
|
+
borderColor: "cyan",
|
|
46
|
+
borderStyle: "round",
|
|
47
|
+
margin: { top: 0, bottom: 1, left: 0, right: 0 },
|
|
48
|
+
}));
|
|
49
|
+
let isAnalyzing = false;
|
|
50
|
+
let analysisTimeout = null;
|
|
51
|
+
const performAnalysis = async () => {
|
|
52
|
+
if (isAnalyzing)
|
|
53
|
+
return;
|
|
54
|
+
isAnalyzing = true;
|
|
55
|
+
try {
|
|
56
|
+
console.log(chalk_1.default.gray("\nš File change detected, re-analyzing...\n"));
|
|
57
|
+
await (0, runner_1.default)(mergedOptions);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error(chalk_1.default.red(`\nā Error during analysis: ${error}\n`));
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
isAnalyzing = false;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const debouncedAnalysis = () => {
|
|
67
|
+
if (analysisTimeout) {
|
|
68
|
+
clearTimeout(analysisTimeout);
|
|
69
|
+
}
|
|
70
|
+
analysisTimeout = setTimeout(performAnalysis, 500); // Debounce 500ms
|
|
71
|
+
};
|
|
72
|
+
// Initial analysis
|
|
73
|
+
await performAnalysis();
|
|
74
|
+
// Watch for changes
|
|
75
|
+
const watcher = chokidar_1.default.watch(directory, {
|
|
76
|
+
ignored: [
|
|
77
|
+
/node_modules/,
|
|
78
|
+
/\.git/,
|
|
79
|
+
/dist/,
|
|
80
|
+
/build/,
|
|
81
|
+
/coverage/,
|
|
82
|
+
/\.next/,
|
|
83
|
+
...(mergedOptions.exclude || []).map((ex) => new RegExp(ex)),
|
|
84
|
+
],
|
|
85
|
+
persistent: true,
|
|
86
|
+
ignoreInitial: true,
|
|
87
|
+
});
|
|
88
|
+
// Use addListener or on method - chokidar FSWatcher extends EventEmitter
|
|
89
|
+
watcher.on("change", () => debouncedAnalysis());
|
|
90
|
+
watcher.on("add", () => debouncedAnalysis());
|
|
91
|
+
watcher.on("unlink", () => debouncedAnalysis());
|
|
92
|
+
// Handle graceful shutdown
|
|
93
|
+
process.on("SIGINT", () => {
|
|
94
|
+
console.log(chalk_1.default.yellow("\n\nš Stopping watch mode...\n"));
|
|
95
|
+
watcher.close();
|
|
96
|
+
process.exit(0);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
exports.startWatchMode = startWatchMode;
|