mkctx 3.0.0 โ 4.0.1
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 +173 -146
- package/bin/mkctx.js +510 -395
- 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,62 +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
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
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
|
|
30
27
|
|
|
31
|
-
##
|
|
28
|
+
## Installation
|
|
32
29
|
|
|
33
30
|
```bash
|
|
34
31
|
npm install -g mkctx
|
|
35
32
|
```
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
**Requirements:** Node.js 18.0+
|
|
38
35
|
|
|
39
|
-
|
|
36
|
+
## Quick Start
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Interactive Mode (Recommended)
|
|
38
|
+
### Interactive mode
|
|
44
39
|
|
|
45
40
|
```bash
|
|
46
41
|
mkctx
|
|
47
42
|
```
|
|
48
43
|
|
|
49
|
-
|
|
50
|
-
1. Generate context from config file or dynamically
|
|
51
|
-
2. View context statistics
|
|
52
|
-
3. Save the context to a file
|
|
44
|
+
Opens a menu where you can generate context, choose output formats, and save with a custom name.
|
|
53
45
|
|
|
54
|
-
###
|
|
46
|
+
### Non-interactive mode (no prompts)
|
|
55
47
|
|
|
56
48
|
```bash
|
|
57
|
-
mkctx
|
|
49
|
+
mkctx --src ./src --format md --name my-project
|
|
58
50
|
```
|
|
59
51
|
|
|
60
|
-
|
|
52
|
+
Pass flags directly and the tool runs to completion without asking anything.
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
mkctx help
|
|
64
|
-
```
|
|
54
|
+
## Usage
|
|
65
55
|
|
|
66
|
-
|
|
56
|
+
### Interactive menu
|
|
67
57
|
|
|
68
58
|
```
|
|
69
59
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
@@ -77,28 +67,67 @@ mkctx help
|
|
|
77
67
|
โ Exit
|
|
78
68
|
```
|
|
79
69
|
|
|
80
|
-
After
|
|
70
|
+
After scanning, you choose a format and optionally a filename:
|
|
81
71
|
|
|
82
72
|
```
|
|
83
73
|
๐ Context Summary:
|
|
84
74
|
Files: 42
|
|
85
75
|
Lines: 3,847
|
|
86
|
-
Size:
|
|
87
|
-
Est. tokens: ~39,058
|
|
76
|
+
Size: 156.23 KB
|
|
88
77
|
|
|
89
|
-
?
|
|
90
|
-
โฏ
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
? Select output format:
|
|
79
|
+
โฏ ๐ฆ All formats (MD, JSON, TOON, XML)
|
|
80
|
+
๐ Markdown (.md)
|
|
81
|
+
๐ง JSON (.json) - Simple array
|
|
82
|
+
๐ TOON (.toon) - Token-optimized
|
|
83
|
+
๐ XML (.xml)
|
|
84
|
+
|
|
85
|
+
? Enter a name for the output files: (context)
|
|
93
86
|
```
|
|
94
87
|
|
|
95
|
-
|
|
88
|
+
### CLI flags (non-interactive)
|
|
89
|
+
|
|
90
|
+
When any of the following flags are passed, mkctx skips all prompts and runs directly.
|
|
96
91
|
|
|
97
|
-
|
|
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
|
+
|
|
102
|
+
**Format values:** `md`, `json`, `toon`, `xml`, `all`, or comma-separated combinations.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Single format
|
|
106
|
+
mkctx --src ./src --format md
|
|
107
|
+
|
|
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:
|
|
98
127
|
|
|
99
128
|
```json
|
|
100
129
|
{
|
|
101
|
-
"src": "
|
|
130
|
+
"src": ".",
|
|
102
131
|
"ignore": "*.log, temp/, node_modules/, .git/, dist/, build/",
|
|
103
132
|
"output": "./mkctx",
|
|
104
133
|
"first_comment": "/* Project Context */",
|
|
@@ -106,127 +135,121 @@ After generating context:
|
|
|
106
135
|
}
|
|
107
136
|
```
|
|
108
137
|
|
|
109
|
-
| Option
|
|
110
|
-
|
|
111
|
-
| `src`
|
|
112
|
-
| `ignore`
|
|
113
|
-
| `output`
|
|
114
|
-
| `first_comment` | Comment at the beginning | `"/* Project Context */"` |
|
|
115
|
-
| `last_comment`
|
|
116
|
-
|
|
117
|
-
## ๐ง CLI Options
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
mkctx # Interactive mode (recommended)
|
|
121
|
-
mkctx config # Create configuration file
|
|
122
|
-
mkctx help # Show help message
|
|
123
|
-
mkctx version # Show version
|
|
124
|
-
```
|
|
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 */"` |
|
|
125
145
|
|
|
126
|
-
|
|
146
|
+
When a config file is present and CLI flags are also passed, the flags take priority over the file values.
|
|
127
147
|
|
|
128
|
-
|
|
148
|
+
## Ignore patterns
|
|
129
149
|
|
|
130
|
-
|
|
131
|
-
- **Directories**: `temp/`, `dist/`, `build/`
|
|
132
|
-
- **Glob patterns**: `**/.cache/`, `**/node_modules/`
|
|
133
|
-
- **Exact match**: `config.local.json`
|
|
150
|
+
Supported pattern types:
|
|
134
151
|
|
|
135
|
-
|
|
152
|
+
- **Wildcards:** `*.log`, `*.test.js`, `*.spec.ts`
|
|
153
|
+
- **Directories:** `temp/`, `dist/`, `build/`
|
|
154
|
+
- **Glob patterns:** `**/.cache/`, `**/node_modules/`
|
|
155
|
+
- **Exact match:** `config.local.json`
|
|
136
156
|
|
|
137
|
-
|
|
157
|
+
The following are always ignored automatically: `.git`, `.svn`, `.hg`, `node_modules`, `__pycache__`, `.DS_Store`, `Thumbs.db`, `.vscode`, `.idea`, binary files, images, and archives.
|
|
138
158
|
|
|
139
|
-
|
|
140
|
-
- `node_modules`, `__pycache__`
|
|
141
|
-
- `.DS_Store`, `Thumbs.db`
|
|
142
|
-
- `.vscode`, `.idea`
|
|
143
|
-
- Binary files, images, archives
|
|
159
|
+
## Output formats
|
|
144
160
|
|
|
145
|
-
|
|
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 |
|
|
146
167
|
|
|
147
|
-
|
|
168
|
+
### Markdown output example
|
|
148
169
|
|
|
149
170
|
````markdown
|
|
150
|
-
|
|
171
|
+
/_ Project Context _/
|
|
151
172
|
|
|
152
173
|
## Project Structure
|
|
153
174
|
|
|
154
|
-
|
|
175
|
+
\```
|
|
155
176
|
๐ src/
|
|
156
177
|
๐ src/components/
|
|
157
|
-
๐ src/utils/
|
|
158
178
|
|
|
159
179
|
42 files total
|
|
160
|
-
|
|
180
|
+
\```
|
|
161
181
|
|
|
162
182
|
## Source Files
|
|
163
183
|
|
|
164
184
|
### src/index.ts
|
|
165
185
|
|
|
166
|
-
|
|
186
|
+
\```typescript
|
|
167
187
|
import { App } from './app';
|
|
168
|
-
|
|
169
188
|
const app = new App();
|
|
170
189
|
app.start();
|
|
171
|
-
|
|
190
|
+
\```
|
|
172
191
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
export function helper() {
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
/* End of Context */
|
|
192
|
+
/_ End of Context _/
|
|
182
193
|
````
|
|
183
194
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
mkctx automatically detects and applies proper syntax highlighting for:
|
|
187
|
-
|
|
188
|
-
| Category | Extensions |
|
|
189
|
-
|----------|------------|
|
|
190
|
-
| **JavaScript/TypeScript** | `.js`, `.ts`, `.jsx`, `.tsx`, `.mjs`, `.cjs` |
|
|
191
|
-
| **Python** | `.py`, `.pyw` |
|
|
192
|
-
| **Go** | `.go` |
|
|
193
|
-
| **Rust** | `.rs` |
|
|
194
|
-
| **Java/Kotlin** | `.java`, `.kt`, `.scala` |
|
|
195
|
-
| **C/C++** | `.c`, `.cpp`, `.h`, `.hpp` |
|
|
196
|
-
| **PHP** | `.php` |
|
|
197
|
-
| **Ruby** | `.rb`, `.rake` |
|
|
198
|
-
| **Shell** | `.sh`, `.bash`, `.zsh`, `.ps1` |
|
|
199
|
-
| **Web** | `.html`, `.css`, `.scss`, `.vue`, `.svelte` |
|
|
200
|
-
| **Data** | `.json`, `.yaml`, `.yml`, `.xml`, `.toml` |
|
|
201
|
-
| **And many more...** | `.sql`, `.graphql`, `.proto`, `.prisma`, `.sol` |
|
|
202
|
-
|
|
203
|
-
## ๐ก Use Cases
|
|
204
|
-
|
|
205
|
-
- **๐ค AI Code Analysis** - Feed your codebase to ChatGPT, Claude, or other AI tools
|
|
206
|
-
- **๐ Code Understanding** - Share project overview for quick understanding
|
|
207
|
-
- **๐ฅ Code Reviews** - Share project overview with reviewers
|
|
208
|
-
- **๐ Onboarding** - Help new developers understand the project
|
|
209
|
-
- **๐ Documentation** - Generate a snapshot of your codebase
|
|
210
|
-
|
|
211
|
-
## ๐ฅ๏ธ Platform Support
|
|
195
|
+
### JSON output example
|
|
212
196
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
+
```
|
|
224
210
|
|
|
225
|
-
|
|
226
|
-
|
|
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
|
|
227
250
|
3. Restart your terminal
|
|
228
251
|
|
|
229
|
-
|
|
252
|
+
**Permission errors on Unix**
|
|
230
253
|
|
|
231
254
|
```bash
|
|
232
255
|
sudo npm install -g mkctx
|
|
@@ -234,34 +257,38 @@ sudo npm install -g mkctx
|
|
|
234
257
|
|
|
235
258
|
Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors
|
|
236
259
|
|
|
237
|
-
##
|
|
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
|
|
268
|
+
|
|
269
|
+
### v4.0.0
|
|
270
|
+
|
|
271
|
+
- โ๏ธ Added interactive filename selection when saving (defaults to `context`)
|
|
272
|
+
- ๐จ Improved UI/UX for the file saving workflow
|
|
238
273
|
|
|
239
274
|
### v3.0.0
|
|
240
275
|
|
|
241
276
|
- ๐ฏ Simplified to focus on context generation
|
|
242
277
|
- ๐๏ธ Removed Ollama chat integration
|
|
243
278
|
- โก Faster startup and smaller footprint
|
|
244
|
-
- ๐งน Cleaner codebase
|
|
245
279
|
|
|
246
280
|
### v2.x
|
|
247
281
|
|
|
248
282
|
- Ollama AI chat integration (removed in v3)
|
|
249
|
-
- Interactive chat interface
|
|
250
283
|
|
|
251
284
|
### v1.x
|
|
252
285
|
|
|
253
286
|
- Initial Go-based implementation
|
|
254
287
|
|
|
255
|
-
##
|
|
288
|
+
## Contributing
|
|
256
289
|
|
|
257
|
-
Contributions are welcome!
|
|
290
|
+
Contributions are welcome! Feel free to open issues or submit pull requests.
|
|
258
291
|
|
|
259
|
-
##
|
|
292
|
+
## License
|
|
260
293
|
|
|
261
|
-
MIT License
|
|
262
|
-
|
|
263
|
-
---
|
|
264
|
-
|
|
265
|
-
<p align="center">
|
|
266
|
-
Made with โค๏ธ for developers who love AI-assisted coding
|
|
267
|
-
</p>
|
|
294
|
+
MIT License โ see [LICENSE](LICENSE) for details.
|