code-context-extractor 0.1.0 → 0.1.2
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 +28 -26
- package/dist/config.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,31 +13,32 @@ CodeContextExtractor is a local-only CLI that captures a deterministic snapshot
|
|
|
13
13
|
|
|
14
14
|
## Quick start
|
|
15
15
|
```bash
|
|
16
|
-
|
|
17
|
-
npm run build
|
|
18
|
-
npx --no-install code-context-extractor extract . --verbose
|
|
16
|
+
npx code-context-extractor extract . --verbose
|
|
19
17
|
```
|
|
20
18
|
|
|
21
|
-
The output is written to
|
|
19
|
+
The output is written to `code-context/` with a timestamped filename like:
|
|
20
|
+
```
|
|
21
|
+
code-context/<root>_context_YYYY-MM-DD_HHMMSS.txt
|
|
22
22
|
```
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
## Install from npm
|
|
25
|
+
```bash
|
|
26
|
+
npx code-context-extractor extract C:\projects\MyNewProject --verbose
|
|
24
27
|
```
|
|
25
28
|
|
|
26
29
|
## Important: .gitignore your outputs
|
|
27
30
|
> **Warning ⚠️**
|
|
28
|
-
> CodeContextExtractor writes files into a
|
|
31
|
+
> CodeContextExtractor writes files into a `code-context/` folder inside your project root. If that folder is not ignored, you may accidentally commit and push your context exports.
|
|
29
32
|
|
|
30
33
|
Add this line to your project's `.gitignore`:
|
|
31
34
|
```
|
|
32
|
-
|
|
35
|
+
code-context/
|
|
33
36
|
```
|
|
34
37
|
|
|
35
38
|
## npm and npx (for beginners)
|
|
36
39
|
- `npm` is the package manager that installs tools and libraries.
|
|
37
40
|
- `npx` runs a tool. If it is not installed locally, it will try to download it.
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
In this repo, `code-context-extractor` is not published to npm yet, so `npx` needs `--no-install` or a direct `node dist/cli.js` call.
|
|
41
|
+
- `npx` is great for one-off CLI runs without a global install.
|
|
41
42
|
|
|
42
43
|
## User journey (example)
|
|
43
44
|
You want to generate a context file for a project at `C:\projects\MyNewProject`.
|
|
@@ -48,6 +49,7 @@ git clone https://github.com/Rwstrobe/CodeContextExtractor.git
|
|
|
48
49
|
cd CodeContextExtractor
|
|
49
50
|
npm install
|
|
50
51
|
npm run build
|
|
52
|
+
npm link
|
|
51
53
|
```
|
|
52
54
|
|
|
53
55
|
### Step 2: Go to your project folder
|
|
@@ -57,23 +59,23 @@ cd C:\projects\MyNewProject
|
|
|
57
59
|
|
|
58
60
|
### Step 3: Generate the context file
|
|
59
61
|
```bash
|
|
60
|
-
|
|
62
|
+
code-context-extractor extract . --verbose
|
|
61
63
|
```
|
|
62
64
|
|
|
63
65
|
The output will be saved to:
|
|
64
66
|
```
|
|
65
|
-
|
|
67
|
+
.\code-context\MyNewProject_context_YYYY-MM-DD_HHMMSS.txt
|
|
66
68
|
```
|
|
67
69
|
|
|
68
70
|
### macOS/Linux variant
|
|
69
71
|
You can follow the same steps with a Unix-style path:
|
|
70
72
|
```bash
|
|
71
73
|
cd ~/projects/MyNewProject
|
|
72
|
-
|
|
74
|
+
code-context-extractor extract . --verbose
|
|
73
75
|
```
|
|
74
76
|
The output will be saved to:
|
|
75
77
|
```
|
|
76
|
-
|
|
78
|
+
./code-context/MyNewProject_context_YYYY-MM-DD_HHMMSS.txt
|
|
77
79
|
```
|
|
78
80
|
|
|
79
81
|
## Install from GitHub (beginner-friendly)
|
|
@@ -93,9 +95,13 @@ npm install
|
|
|
93
95
|
```bash
|
|
94
96
|
npm run build
|
|
95
97
|
```
|
|
96
|
-
5.
|
|
98
|
+
5. Link the CLI so it is available on your PATH:
|
|
97
99
|
```bash
|
|
98
|
-
|
|
100
|
+
npm link
|
|
101
|
+
```
|
|
102
|
+
6. Run the extractor:
|
|
103
|
+
```bash
|
|
104
|
+
code-context-extractor extract . --verbose
|
|
99
105
|
```
|
|
100
106
|
|
|
101
107
|
If you prefer, you can run the built CLI directly:
|
|
@@ -112,25 +118,21 @@ node dist/cli.js extract . --verbose
|
|
|
112
118
|
- Streaming output (does not load large files into memory)
|
|
113
119
|
- Conservative redaction enabled by default
|
|
114
120
|
- Optional Markdown output
|
|
115
|
-
- Automatic output folder
|
|
121
|
+
- Automatic output folder `code-context/`
|
|
116
122
|
|
|
117
123
|
## Commands
|
|
118
124
|
### Extract
|
|
119
125
|
```bash
|
|
120
|
-
|
|
126
|
+
code-context-extractor extract [path]
|
|
121
127
|
```
|
|
122
128
|
Example:
|
|
123
129
|
```bash
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
If you installed the CLI globally (for example via `npm link` or a future npm publish), you can run:
|
|
127
|
-
```bash
|
|
128
|
-
code-context-extractor extract [path]
|
|
130
|
+
code-context-extractor extract ./project --format md --depth 3 --verbose
|
|
129
131
|
```
|
|
130
132
|
|
|
131
133
|
## Options
|
|
132
134
|
```bash
|
|
133
|
-
--out <file> Output file (default:
|
|
135
|
+
--out <file> Output file (default: code-context/<root>_context_YYYY-MM-DD_HHMMSS.txt)
|
|
134
136
|
--format <text|md> Output format (default: text)
|
|
135
137
|
--depth <n> Tree depth (default: 4)
|
|
136
138
|
--include <glob> Include glob (repeatable)
|
|
@@ -171,7 +173,7 @@ node_modules
|
|
|
171
173
|
dist
|
|
172
174
|
build
|
|
173
175
|
out
|
|
174
|
-
|
|
176
|
+
code-context
|
|
175
177
|
.next
|
|
176
178
|
.turbo
|
|
177
179
|
.git
|
|
@@ -194,7 +196,7 @@ id_ed25519
|
|
|
194
196
|
Use an optional JSON file (example: `example-config.json`) to set defaults.
|
|
195
197
|
```json
|
|
196
198
|
{
|
|
197
|
-
"outFile": "
|
|
199
|
+
"outFile": "code-context/project_context_2026-01-19_145227.txt",
|
|
198
200
|
"format": "text",
|
|
199
201
|
"depth": 4,
|
|
200
202
|
"include": [],
|
package/dist/config.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.DEFAULT_EXCLUDES = [
|
|
|
13
13
|
'dist/**',
|
|
14
14
|
'build/**',
|
|
15
15
|
'out/**',
|
|
16
|
-
'
|
|
16
|
+
'code-context/**',
|
|
17
17
|
'.next/**',
|
|
18
18
|
'.turbo/**',
|
|
19
19
|
'.git/**',
|
|
@@ -87,7 +87,7 @@ function buildAutoOutFile(rootPath, format) {
|
|
|
87
87
|
pad(now.getDate())
|
|
88
88
|
].join('-');
|
|
89
89
|
const time = [pad(now.getHours()), pad(now.getMinutes()), pad(now.getSeconds())].join('');
|
|
90
|
-
return path_1.default.join('
|
|
90
|
+
return path_1.default.join('code-context', `${rootName}_context_${stamp}_${time}.${ext}`);
|
|
91
91
|
}
|
|
92
92
|
function normalizeFormat(value) {
|
|
93
93
|
return value === 'md' ? 'md' : 'text';
|
package/package.json
CHANGED