code-context-extractor 0.1.3 → 0.2.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.
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.exportMarkdown = exportMarkdown;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const skipSummary_1 = require("./skipSummary");
|
|
8
9
|
const tree_1 = require("./tree");
|
|
9
10
|
const writer_1 = require("./writer");
|
|
10
11
|
function formatBytes(size) {
|
|
@@ -56,10 +57,14 @@ async function exportMarkdown(result, config, output, metadata) {
|
|
|
56
57
|
await (0, writer_1.writeText)(output, '- (none)\n\n');
|
|
57
58
|
}
|
|
58
59
|
else {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const summary = (0, skipSummary_1.summarizeSkipped)(result.skipped);
|
|
61
|
+
const reasons = Object.entries(summary.byReason)
|
|
62
|
+
.map(([reason, count]) => `${reason} (${count})`)
|
|
63
|
+
.join(', ');
|
|
64
|
+
const roots = summary.topRoots.map((root) => `${root.name} (${root.count})`).join(', ');
|
|
65
|
+
await (0, writer_1.writeText)(output, `- Total: ${summary.total}\n`);
|
|
66
|
+
await (0, writer_1.writeText)(output, `- By reason: ${reasons}\n`);
|
|
67
|
+
await (0, writer_1.writeText)(output, `- Top skipped roots: ${roots}\n\n`);
|
|
63
68
|
}
|
|
64
69
|
await (0, writer_1.writeText)(output, '## Files\n\n');
|
|
65
70
|
for (const file of result.files) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.summarizeSkipped = summarizeSkipped;
|
|
4
|
+
function getRootName(relativePath) {
|
|
5
|
+
const parts = relativePath.split('/');
|
|
6
|
+
return parts[0] || relativePath;
|
|
7
|
+
}
|
|
8
|
+
function summarizeSkipped(skipped, rootLimit = 10) {
|
|
9
|
+
const byReason = {};
|
|
10
|
+
const byRoot = {};
|
|
11
|
+
for (const entry of skipped) {
|
|
12
|
+
byReason[entry.reason] = (byReason[entry.reason] ?? 0) + 1;
|
|
13
|
+
const root = getRootName(entry.relativePath);
|
|
14
|
+
byRoot[root] = (byRoot[root] ?? 0) + 1;
|
|
15
|
+
}
|
|
16
|
+
const topRoots = Object.entries(byRoot)
|
|
17
|
+
.map(([name, count]) => ({ name, count }))
|
|
18
|
+
.sort((a, b) => b.count - a.count || a.name.localeCompare(b.name))
|
|
19
|
+
.slice(0, rootLimit);
|
|
20
|
+
return { total: skipped.length, byReason, topRoots };
|
|
21
|
+
}
|
package/dist/exporters/text.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exportText = exportText;
|
|
4
|
+
const skipSummary_1 = require("./skipSummary");
|
|
4
5
|
const tree_1 = require("./tree");
|
|
5
6
|
const writer_1 = require("./writer");
|
|
6
7
|
function formatBytes(size) {
|
|
@@ -45,9 +46,14 @@ async function exportText(result, config, output, metadata) {
|
|
|
45
46
|
await (0, writer_1.writeText)(output, '(none)\n');
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
const summary = (0, skipSummary_1.summarizeSkipped)(result.skipped);
|
|
50
|
+
const reasons = Object.entries(summary.byReason)
|
|
51
|
+
.map(([reason, count]) => `${reason} (${count})`)
|
|
52
|
+
.join(', ');
|
|
53
|
+
const roots = summary.topRoots.map((root) => `${root.name} (${root.count})`).join(', ');
|
|
54
|
+
await (0, writer_1.writeText)(output, `Total: ${summary.total}\n`);
|
|
55
|
+
await (0, writer_1.writeText)(output, `By reason: ${reasons}\n`);
|
|
56
|
+
await (0, writer_1.writeText)(output, `Top skipped roots: ${roots}\n`);
|
|
51
57
|
}
|
|
52
58
|
await (0, writer_1.writeText)(output, '\nFiles\n');
|
|
53
59
|
for (const file of result.files) {
|
package/package.json
CHANGED