agentic-compaction 0.0.2 → 0.0.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/README.md CHANGED
@@ -1,25 +1,25 @@
1
- # codebase-compact
1
+ # agentic-compaction
2
2
 
3
3
  Walks a project directory, parses JS/TS/Python files, and outputs a compact structural skeleton of the entire codebase. Designed for feeding project context into LLM prompts with minimal token usage.
4
4
 
5
5
  Typical compaction rate: **~95%** token reduction.
6
6
 
7
- ## Install
7
+ ## Quick Start
8
8
 
9
9
  ```bash
10
- npm install -g codebase-compact
10
+ npx agentic-compaction /path/to/project
11
11
  ```
12
12
 
13
- Or run directly from the repo:
13
+ ## Install
14
14
 
15
15
  ```bash
16
- node src/cli.js /path/to/project
16
+ npm install -g agentic-compaction
17
17
  ```
18
18
 
19
19
  ## CLI Usage
20
20
 
21
21
  ```bash
22
- codebase-compact [path] [options]
22
+ agentic-compaction [path] [options]
23
23
  ```
24
24
 
25
25
  **Options:**
@@ -36,7 +36,7 @@ Output is saved to the target directory as `compacted_<project>_<date>.md`.
36
36
  **Example:**
37
37
 
38
38
  ```bash
39
- $ codebase-compact ~/projects/my-app
39
+ $ npx agentic-compaction ~/projects/my-app
40
40
 
41
41
  Saved to /home/user/projects/my-app/compacted_my-app_2026-02-12_15-30-00.md
42
42
 
@@ -49,7 +49,7 @@ Saved to /home/user/projects/my-app/compacted_my-app_2026-02-12_15-30-00.md
49
49
  ## Library Usage
50
50
 
51
51
  ```js
52
- import { compactProject, compactFile } from 'codebase-compact';
52
+ import { compactProject, compactFile } from 'agentic-compaction';
53
53
 
54
54
  // Compact an entire directory
55
55
  const { output, stats } = compactProject('/path/to/project');
@@ -1,6 +1,6 @@
1
1
  ## src/cli.js
2
- imports: 2 ext, ./index.js, ./formatter.js
3
- fn: getDateStamp:8, pad:10
2
+ imports: 3 ext, ./index.js, ./formatter.js
3
+ fn: getDateStamp:9, pad:11
4
4
  ## src/formatter.js
5
5
  imports: ./parsers/python.js, ./parsers/babel.js, ./parsers/python.js
6
6
  exports: estimateTokens, formatTokenCount, formatOutput
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-compaction",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Walk a project directory and output a compact structural skeleton of the entire codebase",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/cli.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { resolve, join, basename } from 'path';
4
4
  import { writeFileSync } from 'fs';
5
+ import pc from 'picocolors';
5
6
  import { compactProject } from './index.js';
6
7
  import { formatTokenCount } from './formatter.js';
7
8
 
@@ -52,8 +53,9 @@ const compactionRate = stats.rawTokens > 0
52
53
  ? ((1 - stats.compactedTokens / stats.rawTokens) * 100).toFixed(1)
53
54
  : '0';
54
55
 
55
- console.log(`\nSaved to ${outputPath}\n`);
56
- console.log(` Files: ${stats.files}`);
57
- console.log(` Project tokens: ${formatTokenCount(stats.rawTokens)}`);
58
- console.log(` Compacted tokens: ${formatTokenCount(stats.compactedTokens)}`);
59
- console.log(` Compaction rate: ${compactionRate}%`);
56
+ console.log(`\n${pc.green('✔')} ${pc.bold('Compaction complete!')}\n`);
57
+ console.log(` ${pc.dim('Saved to')} ${pc.cyan(outputPath)}\n`);
58
+ console.log(` ${pc.dim('Files')} ${pc.white(stats.files)}`);
59
+ console.log(` ${pc.dim('Project tokens')} ${pc.yellow(formatTokenCount(stats.rawTokens))}`);
60
+ console.log(` ${pc.dim('Compacted tokens')} ${pc.green(formatTokenCount(stats.compactedTokens))}`);
61
+ console.log(` ${pc.dim('Compaction rate')} ${pc.bold(pc.green(compactionRate + '%'))}`);
@@ -1,34 +0,0 @@
1
- ## src/cli.js
2
- imports: 2 ext, ./index.js, ./formatter.js
3
- fn: getDateStamp:8, pad:10
4
- ## src/formatter.js
5
- imports: ./parsers/python.js, ./parsers/babel.js, ./parsers/python.js
6
- exports: estimateTokens, formatTokenCount, formatOutput
7
- fn: estimateTokens:5, formatTokenCount:10, formatOutput:16
8
- ## src/index.js
9
- imports: 1 ext, ./walker.js, ./formatter.js, ./parsers/babel.js, ./parsers/python.js
10
- exports: isBabelParseable, isPythonParseable, estimateTokens, formatTokenCount, compactFile, compactProject
11
- fn: compactFile:17, compactProject:38
12
- ## src/parsers/babel.js
13
- imports: 2 ext
14
- exports: isBabelParseable, extractSignatures, extractSkeleton, formatSignaturesForPrompt, formatSkeletonForPrompt
15
- fn: isBabelParseable:9, isPascalCase:13, getReactHOCInfo:17, isCreateContext:52, extractDependencyArray:69, getParamsString:97, getTypeName:123, getReturnType:141, extractSignatures:146, extractSkeleton:242, formatSignaturesForPrompt:402, formatSkeletonForPrompt:407
16
- ## src/parsers/python.js
17
- exports: isPythonParseable, extractSkeleton, formatSkeletonForPrompt
18
- fn: isPythonParseable:3, extractSkeleton:14, formatSkeletonForPrompt:148
19
- ## src/walker.js
20
- imports: 2 ext, ./parsers/babel.js, ./parsers/python.js
21
- exports: collectFiles
22
- fn: collectFiles:24, SKIP_DIRS_OR_DOT:48, isParseable:52
23
- ## test/fixtures/sample.js
24
- imports: 1 ext, ./api
25
- exports: MyComponent, MyComponent*
26
- components: MyComponent:6
27
- fn: helper:16
28
- hooks: useState(1), useEffect([id]):9
29
- ## test/fixtures/sample.py
30
- imports: 4 ext
31
- classes: BaseProcessor:9, Config @dataclass (BaseProcessor):13
32
- fn: process_data:17, fetch_remote:20, @app.route api_handler:24
33
- ## test/test.js
34
- imports: 5 ext, ../src/index.js, ../src/parsers/babel.js, ../src/parsers/python.js, ../src/walker.js
@@ -1,34 +0,0 @@
1
- ## src/cli.js
2
- imports: 2 ext, ./index.js, ./formatter.js
3
- fn: getDateStamp:8, pad:10
4
- ## src/formatter.js
5
- imports: ./parsers/python.js, ./parsers/babel.js, ./parsers/python.js
6
- exports: estimateTokens, formatTokenCount, formatOutput
7
- fn: estimateTokens:5, formatTokenCount:10, formatOutput:16
8
- ## src/index.js
9
- imports: 1 ext, ./walker.js, ./formatter.js, ./parsers/babel.js, ./parsers/python.js
10
- exports: isBabelParseable, isPythonParseable, estimateTokens, formatTokenCount, compactFile, compactProject
11
- fn: compactFile:17, compactProject:38
12
- ## src/parsers/babel.js
13
- imports: 2 ext
14
- exports: isBabelParseable, extractSignatures, extractSkeleton, formatSignaturesForPrompt, formatSkeletonForPrompt
15
- fn: isBabelParseable:9, isPascalCase:13, getReactHOCInfo:17, isCreateContext:52, extractDependencyArray:69, getParamsString:97, getTypeName:123, getReturnType:141, extractSignatures:146, extractSkeleton:242, formatSignaturesForPrompt:402, formatSkeletonForPrompt:407
16
- ## src/parsers/python.js
17
- exports: isPythonParseable, extractSkeleton, formatSkeletonForPrompt
18
- fn: isPythonParseable:3, extractSkeleton:14, formatSkeletonForPrompt:148
19
- ## src/walker.js
20
- imports: 2 ext, ./parsers/babel.js, ./parsers/python.js
21
- exports: collectFiles
22
- fn: collectFiles:24, SKIP_DIRS_OR_DOT:48, isParseable:52
23
- ## test/fixtures/sample.js
24
- imports: 1 ext, ./api
25
- exports: MyComponent, MyComponent*
26
- components: MyComponent:6
27
- fn: helper:16
28
- hooks: useState(1), useEffect([id]):9
29
- ## test/fixtures/sample.py
30
- imports: 4 ext
31
- classes: BaseProcessor:9, Config @dataclass (BaseProcessor):13
32
- fn: process_data:17, fetch_remote:20, @app.route api_handler:24
33
- ## test/test.js
34
- imports: 5 ext, ../src/index.js, ../src/parsers/babel.js, ../src/parsers/python.js, ../src/walker.js