code-context-extractor 0.1.2 → 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.
package/README.md CHANGED
@@ -180,6 +180,13 @@ code-context
180
180
  .idea
181
181
  .vscode
182
182
  coverage
183
+ package-lock.json
184
+ yarn.lock
185
+ pnpm-lock.yaml
186
+ bun.lockb
187
+ .npmrc
188
+ .yarnrc
189
+ .yarnrc.yml
183
190
  *.lock
184
191
  *.log
185
192
  *.pem
@@ -192,6 +199,8 @@ id_rsa
192
199
  id_ed25519
193
200
  ```
194
201
 
202
+ Lock files are excluded by default because they are machine-generated, often large, and typically add little architectural context.
203
+
195
204
  ## Configuration file
196
205
  Use an optional JSON file (example: `example-config.json`) to set defaults.
197
206
  ```json
package/dist/config.js CHANGED
@@ -21,6 +21,13 @@ exports.DEFAULT_EXCLUDES = [
21
21
  '.vscode/**',
22
22
  'coverage/**',
23
23
  '*.lock',
24
+ 'package-lock.json',
25
+ 'yarn.lock',
26
+ 'pnpm-lock.yaml',
27
+ 'bun.lockb',
28
+ '.npmrc',
29
+ '.yarnrc',
30
+ '.yarnrc.yml',
24
31
  '*.log',
25
32
  '*.pem',
26
33
  '*.key',
@@ -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
- for (const skipped of result.skipped) {
60
- await (0, writer_1.writeText)(output, `- ${skipped.relativePath} (${skipped.reason})\n`);
61
- }
62
- await (0, writer_1.writeText)(output, '\n');
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
+ }
@@ -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
- for (const skipped of result.skipped) {
49
- await (0, writer_1.writeText)(output, `${skipped.relativePath} - ${skipped.reason}\n`);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-context-extractor",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Local-only CLI tool to extract codebase context into a single text or Markdown file.",
5
5
  "license": "MIT",
6
6
  "author": "Open Source Contributors",