mkctx 4.0.0 โ 5.0.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 +161 -140
- package/bin/mkctx.js +473 -506
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
# mkctx - Make Context
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
<picture>
|
|
@@ -8,63 +8,52 @@
|
|
|
8
8
|
</picture>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
A powerful command-line tool that generates comprehensive markdown context files from your project code, perfect for AI prompts and code analysis.
|
|
13
|
-
</p>
|
|
11
|
+
A powerful command-line tool that generates comprehensive context files from your project code, perfect for AI prompts and code analysis.
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<a href="https://github.com/pnkkzero/mkctx/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/mkctx.svg" alt="license"></a>
|
|
19
|
-
</p>
|
|
13
|
+
[](https://www.npmjs.com/package/mkctx)
|
|
14
|
+
[](https://www.npmjs.com/package/mkctx)
|
|
15
|
+
[](https://github.com/pnkkzero/mkctx/blob/main/LICENSE)
|
|
20
16
|
|
|
21
|
-
##
|
|
17
|
+
## Features
|
|
22
18
|
|
|
23
|
-
- ๐ **Multi-platform**
|
|
24
|
-
- ๐ **Smart Ignoring**
|
|
25
|
-
- โ๏ธ **Configurable**
|
|
26
|
-
- โ๏ธ **Custom Naming**
|
|
27
|
-
- ๐ฏ **AI-Friendly**
|
|
28
|
-
- ๐จ **Syntax Highlighting**
|
|
29
|
-
- ๐ **
|
|
30
|
-
- ๐ **Context Statistics**
|
|
19
|
+
- ๐ **Multi-platform** โ Works on Windows, macOS, and Linux
|
|
20
|
+
- ๐ **Smart Ignoring** โ Respects custom ignore patterns and common system files
|
|
21
|
+
- โ๏ธ **Configurable** โ Customize source directories, output locations, and comments
|
|
22
|
+
- โ๏ธ **Custom Naming** โ Specify custom filenames for your outputs or use the default `context`
|
|
23
|
+
- ๐ฏ **AI-Friendly** โ Outputs code in markdown format ideal for AI prompts
|
|
24
|
+
- ๐จ **Syntax Highlighting** โ Proper language detection for code blocks
|
|
25
|
+
- ๐ **Dual Mode** โ Interactive menu or fully non-interactive via CLI flags
|
|
26
|
+
- ๐ **Context Statistics** โ Token estimation and file analysis
|
|
31
27
|
|
|
32
|
-
##
|
|
28
|
+
## Installation
|
|
33
29
|
|
|
34
30
|
```bash
|
|
35
31
|
npm install -g mkctx
|
|
36
32
|
```
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- **Node.js** 18.0+
|
|
34
|
+
**Requirements:** Node.js 18.0+
|
|
41
35
|
|
|
42
|
-
##
|
|
36
|
+
## Quick Start
|
|
43
37
|
|
|
44
|
-
### Interactive
|
|
38
|
+
### Interactive mode
|
|
45
39
|
|
|
46
40
|
```bash
|
|
47
41
|
mkctx
|
|
48
42
|
```
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
1. Generate context from config file or dynamically
|
|
52
|
-
2. View context statistics
|
|
53
|
-
3. Choose output formats and save with a custom name
|
|
44
|
+
Opens a menu where you can generate context, choose output formats, and save with a custom name.
|
|
54
45
|
|
|
55
|
-
###
|
|
46
|
+
### Non-interactive mode (no prompts)
|
|
56
47
|
|
|
57
48
|
```bash
|
|
58
|
-
mkctx
|
|
49
|
+
mkctx --src ./src --format md --name my-project
|
|
59
50
|
```
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
Pass flags directly and the tool runs to completion without asking anything.
|
|
62
53
|
|
|
63
|
-
|
|
64
|
-
mkctx help
|
|
65
|
-
```
|
|
54
|
+
## Usage
|
|
66
55
|
|
|
67
|
-
|
|
56
|
+
### Interactive menu
|
|
68
57
|
|
|
69
58
|
```
|
|
70
59
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
@@ -78,14 +67,13 @@ mkctx help
|
|
|
78
67
|
โ Exit
|
|
79
68
|
```
|
|
80
69
|
|
|
81
|
-
After
|
|
70
|
+
After scanning, you choose a format and optionally a filename:
|
|
82
71
|
|
|
83
72
|
```
|
|
84
73
|
๐ Context Summary:
|
|
85
74
|
Files: 42
|
|
86
75
|
Lines: 3,847
|
|
87
|
-
Size:
|
|
88
|
-
Est. tokens: ~39,058
|
|
76
|
+
Size: 156.23 KB
|
|
89
77
|
|
|
90
78
|
? Select output format:
|
|
91
79
|
โฏ ๐ฆ All formats (MD, JSON, TOON, XML)
|
|
@@ -97,15 +85,49 @@ After generating context:
|
|
|
97
85
|
? Enter a name for the output files: (context)
|
|
98
86
|
```
|
|
99
87
|
|
|
100
|
-
|
|
88
|
+
### CLI flags (non-interactive)
|
|
89
|
+
|
|
90
|
+
When any of the following flags are passed, mkctx skips all prompts and runs directly.
|
|
91
|
+
|
|
92
|
+
| Flag | Alias | Description | Default |
|
|
93
|
+
| ------------------------ | ----- | --------------------------------- | --------- |
|
|
94
|
+
| `--src <path>` | `-s` | Source directory to scan | `.` |
|
|
95
|
+
| `--output <path>` | `-o` | Output directory | `./mkctx` |
|
|
96
|
+
| `--format <fmt>` | `-f` | Output format (see below) | `md` |
|
|
97
|
+
| `--name <filename>` | `-n` | Base name for output files | `context` |
|
|
98
|
+
| `--ignore <patterns>` | | Comma-separated ignore patterns | |
|
|
99
|
+
| `--first-comment <text>` | | Override the first comment header | |
|
|
100
|
+
| `--last-comment <text>` | | Override the last comment footer | |
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
**Format values:** `md`, `json`, `toon`, `xml`, `all`, or comma-separated combinations.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Single format
|
|
106
|
+
mkctx --src ./src --format md
|
|
103
107
|
|
|
104
|
-
|
|
108
|
+
# Multiple formats
|
|
109
|
+
mkctx --src . --format md,json --name snapshot
|
|
110
|
+
|
|
111
|
+
# All formats with custom output directory
|
|
112
|
+
mkctx --src . --format all --name my-project --output ./docs
|
|
113
|
+
|
|
114
|
+
# Using short aliases
|
|
115
|
+
mkctx -s ./src -f toon -n snapshot
|
|
116
|
+
|
|
117
|
+
# With extra ignore patterns
|
|
118
|
+
mkctx --src ./app --format md --ignore "*.test.ts,__tests__/"
|
|
119
|
+
|
|
120
|
+
# Using = syntax
|
|
121
|
+
mkctx --src=./src --format=md,json --name=snapshot
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Configuration file
|
|
125
|
+
|
|
126
|
+
Run `mkctx config` to create a `mkctx.config.json` in the current directory:
|
|
105
127
|
|
|
106
128
|
```json
|
|
107
129
|
{
|
|
108
|
-
"src": "
|
|
130
|
+
"src": ".",
|
|
109
131
|
"ignore": "*.log, temp/, node_modules/, .git/, dist/, build/",
|
|
110
132
|
"output": "./mkctx",
|
|
111
133
|
"first_comment": "/* Project Context */",
|
|
@@ -113,127 +135,121 @@ After generating context:
|
|
|
113
135
|
}
|
|
114
136
|
```
|
|
115
137
|
|
|
116
|
-
| Option
|
|
117
|
-
|
|
118
|
-
| `src`
|
|
119
|
-
| `ignore`
|
|
120
|
-
| `output`
|
|
121
|
-
| `first_comment` | Comment at the beginning | `"/* Project Context */"` |
|
|
122
|
-
| `last_comment`
|
|
123
|
-
|
|
124
|
-
## ๐ง CLI Options
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
mkctx # Interactive mode (recommended)
|
|
128
|
-
mkctx config # Create configuration file
|
|
129
|
-
mkctx help # Show help message
|
|
130
|
-
mkctx version # Show version
|
|
131
|
-
```
|
|
138
|
+
| Option | Description | Default |
|
|
139
|
+
| --------------- | -------------------------------------- | ------------------------- |
|
|
140
|
+
| `src` | Source directory to scan | `"."` |
|
|
141
|
+
| `ignore` | Comma-separated patterns to ignore | See defaults |
|
|
142
|
+
| `output` | Output directory for context files | `"./mkctx"` |
|
|
143
|
+
| `first_comment` | Comment at the beginning of the output | `"/* Project Context */"` |
|
|
144
|
+
| `last_comment` | Comment at the end of the output | `"/* End of Context */"` |
|
|
132
145
|
|
|
133
|
-
|
|
146
|
+
When a config file is present and CLI flags are also passed, the flags take priority over the file values.
|
|
134
147
|
|
|
135
|
-
|
|
148
|
+
## Ignore patterns
|
|
136
149
|
|
|
137
|
-
|
|
138
|
-
- **Directories**: `temp/`, `dist/`, `build/`
|
|
139
|
-
- **Glob patterns**: `**/.cache/`, `**/node_modules/`
|
|
140
|
-
- **Exact match**: `config.local.json`
|
|
150
|
+
Supported pattern types:
|
|
141
151
|
|
|
142
|
-
|
|
152
|
+
- **Wildcards:** `*.log`, `*.test.js`, `*.spec.ts`
|
|
153
|
+
- **Directories:** `temp/`, `dist/`, `build/`
|
|
154
|
+
- **Glob patterns:** `**/.cache/`, `**/node_modules/`
|
|
155
|
+
- **Exact match:** `config.local.json`
|
|
143
156
|
|
|
144
|
-
|
|
157
|
+
The following are always ignored automatically: `.git`, `.svn`, `.hg`, `node_modules`, `__pycache__`, `.DS_Store`, `Thumbs.db`, `.vscode`, `.idea`, binary files, images, and archives.
|
|
145
158
|
|
|
146
|
-
|
|
147
|
-
- `node_modules`, `__pycache__`
|
|
148
|
-
- `.DS_Store`, `Thumbs.db`
|
|
149
|
-
- `.vscode`, `.idea`
|
|
150
|
-
- Binary files, images, archives
|
|
159
|
+
## Output formats
|
|
151
160
|
|
|
152
|
-
|
|
161
|
+
| Format | Extension | Description |
|
|
162
|
+
| ------ | --------- | ------------------------------------------------------- |
|
|
163
|
+
| `md` | `.md` | Markdown with fenced code blocks and project structure |
|
|
164
|
+
| `json` | `.json` | Simple JSON array of file objects |
|
|
165
|
+
| `toon` | `.toon` | Token-Oriented Object Notation โ compact, LLM-optimized |
|
|
166
|
+
| `xml` | `.xml` | XML with CDATA sections |
|
|
153
167
|
|
|
154
|
-
|
|
168
|
+
### Markdown output example
|
|
155
169
|
|
|
156
170
|
````markdown
|
|
157
|
-
|
|
171
|
+
/_ Project Context _/
|
|
158
172
|
|
|
159
173
|
## Project Structure
|
|
160
174
|
|
|
161
|
-
|
|
175
|
+
\```
|
|
162
176
|
๐ src/
|
|
163
177
|
๐ src/components/
|
|
164
|
-
๐ src/utils/
|
|
165
178
|
|
|
166
179
|
42 files total
|
|
167
|
-
|
|
180
|
+
\```
|
|
168
181
|
|
|
169
182
|
## Source Files
|
|
170
183
|
|
|
171
184
|
### src/index.ts
|
|
172
185
|
|
|
173
|
-
|
|
186
|
+
\```typescript
|
|
174
187
|
import { App } from './app';
|
|
175
|
-
|
|
176
188
|
const app = new App();
|
|
177
189
|
app.start();
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
### src/utils/helpers.ts
|
|
190
|
+
\```
|
|
181
191
|
|
|
182
|
-
|
|
183
|
-
export function helper() {
|
|
184
|
-
return true;
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
/* End of Context */
|
|
192
|
+
/_ End of Context _/
|
|
189
193
|
````
|
|
190
194
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
mkctx automatically detects and applies proper syntax highlighting for:
|
|
194
|
-
|
|
195
|
-
| Category | Extensions |
|
|
196
|
-
|----------|------------|
|
|
197
|
-
| **JavaScript/TypeScript** | `.js`, `.ts`, `.jsx`, `.tsx`, `.mjs`, `.cjs` |
|
|
198
|
-
| **Python** | `.py`, `.pyw` |
|
|
199
|
-
| **Go** | `.go` |
|
|
200
|
-
| **Rust** | `.rs` |
|
|
201
|
-
| **Java/Kotlin** | `.java`, `.kt`, `.scala` |
|
|
202
|
-
| **C/C++** | `.c`, `.cpp`, `.h`, `.hpp` |
|
|
203
|
-
| **PHP** | `.php` |
|
|
204
|
-
| **Ruby** | `.rb`, `.rake` |
|
|
205
|
-
| **Shell** | `.sh`, `.bash`, `.zsh`, `.ps1` |
|
|
206
|
-
| **Web** | `.html`, `.css`, `.scss`, `.vue`, `.svelte` |
|
|
207
|
-
| **Data** | `.json`, `.yaml`, `.yml`, `.xml`, `.toml` |
|
|
208
|
-
| **And many more...** | `.sql`, `.graphql`, `.proto`, `.prisma`, `.sol` |
|
|
195
|
+
### JSON output example
|
|
209
196
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
| **Linux** | โ
Full support |
|
|
224
|
-
| **Windows** | โ
Full support |
|
|
225
|
-
|
|
226
|
-
## ๐ง Troubleshooting
|
|
227
|
-
|
|
228
|
-
### Command Not Found
|
|
229
|
-
|
|
230
|
-
If `mkctx` is not found after installation:
|
|
197
|
+
```json
|
|
198
|
+
[
|
|
199
|
+
{
|
|
200
|
+
"path": "src/index.ts",
|
|
201
|
+
"name": "index.ts",
|
|
202
|
+
"extension": "ts",
|
|
203
|
+
"language": "typescript",
|
|
204
|
+
"lines": 150,
|
|
205
|
+
"size": 4096,
|
|
206
|
+
"content": "..."
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
```
|
|
231
210
|
|
|
232
|
-
|
|
233
|
-
|
|
211
|
+
## Supported languages
|
|
212
|
+
|
|
213
|
+
| Category | Extensions |
|
|
214
|
+
| ----------------------- | ----------------------------------------------- |
|
|
215
|
+
| JavaScript / TypeScript | `.js`, `.ts`, `.jsx`, `.tsx`, `.mjs`, `.cjs` |
|
|
216
|
+
| Python | `.py`, `.pyw` |
|
|
217
|
+
| Go | `.go` |
|
|
218
|
+
| Rust | `.rs` |
|
|
219
|
+
| Java / Kotlin | `.java`, `.kt`, `.scala` |
|
|
220
|
+
| C / C++ | `.c`, `.cpp`, `.h`, `.hpp` |
|
|
221
|
+
| PHP | `.php` |
|
|
222
|
+
| Ruby | `.rb`, `.rake` |
|
|
223
|
+
| Shell | `.sh`, `.bash`, `.zsh`, `.ps1` |
|
|
224
|
+
| Web | `.html`, `.css`, `.scss`, `.vue`, `.svelte` |
|
|
225
|
+
| Data | `.json`, `.yaml`, `.yml`, `.xml`, `.toml` |
|
|
226
|
+
| Other | `.sql`, `.graphql`, `.proto`, `.prisma`, `.sol` |
|
|
227
|
+
|
|
228
|
+
## Use cases
|
|
229
|
+
|
|
230
|
+
- **AI code analysis** โ Feed your codebase to ChatGPT, Claude, or other AI tools
|
|
231
|
+
- **Code reviews** โ Share a full project snapshot with reviewers
|
|
232
|
+
- **Onboarding** โ Help new developers get oriented quickly
|
|
233
|
+
- **Documentation** โ Generate a versioned snapshot of your codebase
|
|
234
|
+
- **CI/CD pipelines** โ Use non-interactive flags to automate context generation
|
|
235
|
+
|
|
236
|
+
## Platform support
|
|
237
|
+
|
|
238
|
+
| Platform | Status |
|
|
239
|
+
| -------- | --------------- |
|
|
240
|
+
| macOS | โ
Full support |
|
|
241
|
+
| Linux | โ
Full support |
|
|
242
|
+
| Windows | โ
Full support |
|
|
243
|
+
|
|
244
|
+
## Troubleshooting
|
|
245
|
+
|
|
246
|
+
**Command not found after installation**
|
|
247
|
+
|
|
248
|
+
1. Make sure the npm global bin directory is in your PATH
|
|
249
|
+
2. Run `npm bin -g` to check where global packages are installed
|
|
234
250
|
3. Restart your terminal
|
|
235
251
|
|
|
236
|
-
|
|
252
|
+
**Permission errors on Unix**
|
|
237
253
|
|
|
238
254
|
```bash
|
|
239
255
|
sudo npm install -g mkctx
|
|
@@ -241,33 +257,38 @@ sudo npm install -g mkctx
|
|
|
241
257
|
|
|
242
258
|
Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors
|
|
243
259
|
|
|
244
|
-
##
|
|
260
|
+
## Changelog
|
|
261
|
+
|
|
262
|
+
### v5.0.0
|
|
263
|
+
|
|
264
|
+
- โจ Added non-interactive CLI flags (`--src`, `--format`, `--output`, `--name`, `--ignore`, etc.)
|
|
265
|
+
- ๐ค Added short aliases (`-s`, `-o`, `-f`, `-n`)
|
|
266
|
+
- ๐ง Support for `--key=value` syntax
|
|
267
|
+
- โป๏ธ Internal refactor with clean code structure
|
|
245
268
|
|
|
246
269
|
### v4.0.0
|
|
247
270
|
|
|
248
|
-
- โ๏ธ Added interactive filename selection when saving (defaults to
|
|
249
|
-
- ๐จ Improved UI/UX for file saving workflow
|
|
271
|
+
- โ๏ธ Added interactive filename selection when saving (defaults to `context`)
|
|
272
|
+
- ๐จ Improved UI/UX for the file saving workflow
|
|
250
273
|
|
|
251
274
|
### v3.0.0
|
|
252
275
|
|
|
253
276
|
- ๐ฏ Simplified to focus on context generation
|
|
254
277
|
- ๐๏ธ Removed Ollama chat integration
|
|
255
278
|
- โก Faster startup and smaller footprint
|
|
256
|
-
- ๐งน Cleaner codebase
|
|
257
279
|
|
|
258
280
|
### v2.x
|
|
259
281
|
|
|
260
282
|
- Ollama AI chat integration (removed in v3)
|
|
261
|
-
- Interactive chat interface
|
|
262
283
|
|
|
263
284
|
### v1.x
|
|
264
285
|
|
|
265
286
|
- Initial Go-based implementation
|
|
266
287
|
|
|
267
|
-
##
|
|
288
|
+
## Contributing
|
|
268
289
|
|
|
269
|
-
Contributions are welcome!
|
|
290
|
+
Contributions are welcome! Feel free to open issues or submit pull requests.
|
|
270
291
|
|
|
271
|
-
##
|
|
292
|
+
## License
|
|
272
293
|
|
|
273
|
-
MIT License
|
|
294
|
+
MIT License โ see [LICENSE](LICENSE) for details.
|