@chappibunny/repolens 1.15.3 → 1.15.5
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/CHANGELOG.md +55 -0
- package/README.md +13 -9
- package/llms-install.md +2 -0
- package/package.json +2 -2
- package/src/ai/generate-sections.js +202 -80
- package/src/analyzers/context-builder.js +120 -63
- package/src/analyzers/dependency-graph.js +97 -2
- package/src/analyzers/domain-inference.js +55 -4
- package/src/analyzers/flow-inference.js +48 -9
- package/src/analyzers/maturity.js +151 -0
- package/src/analyzers/security-patterns.js +29 -3
- package/src/cli.js +21 -17
- package/src/core/scan.js +50 -4
- package/src/docs/generate-doc-set.js +28 -0
- package/src/init.js +2 -4
- package/src/mcp/tools.js +2 -1
- package/src/renderers/render.js +3 -3
- package/src/renderers/renderAnalysis.js +28 -9
- package/src/utils/ai-notice.js +20 -0
- package/src/utils/path-roles.js +58 -0
- package/src/utils/project-name.js +24 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Resolve a human project name for a directory (never "." or "..")
|
|
2
|
+
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
function packageJsonName(dir) {
|
|
7
|
+
try {
|
|
8
|
+
const raw = fs.readFileSync(path.join(dir, "package.json"), "utf8");
|
|
9
|
+
const name = JSON.parse(raw)?.name;
|
|
10
|
+
if (typeof name === "string" && name.trim() && name.length <= 214) return name.trim();
|
|
11
|
+
} catch {
|
|
12
|
+
// no package.json or not valid JSON
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Name for a project directory. `--target .` resolves to the real directory,
|
|
19
|
+
* and a package.json name wins over the folder name when there is one.
|
|
20
|
+
*/
|
|
21
|
+
export function detectProjectName(dir, fallback = "my-project") {
|
|
22
|
+
const resolved = path.resolve(dir || ".");
|
|
23
|
+
return packageJsonName(resolved) || path.basename(resolved) || fallback;
|
|
24
|
+
}
|