mkctx 2.0.1 โ 4.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 +146 -135
- package/bin/mkctx.js +720 -374
- package/package.json +15 -6
package/README.md
CHANGED
|
@@ -4,93 +4,104 @@
|
|
|
4
4
|
<picture>
|
|
5
5
|
<source media="(prefers-color-scheme: dark)" srcset="./black-favicon.svg">
|
|
6
6
|
<source media="(prefers-color-scheme: light)" srcset="./white-favicon.svg">
|
|
7
|
-
<img src="./black-favicon.svg" alt="
|
|
7
|
+
<img src="./black-favicon.svg" alt="mkctx logo" width="150">
|
|
8
8
|
</picture>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
A powerful command-line tool that generates comprehensive markdown context files from your project code, perfect for
|
|
12
|
+
A powerful command-line tool that generates comprehensive markdown context files from your project code, perfect for AI prompts and code analysis.
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
16
|
<a href="https://www.npmjs.com/package/mkctx"><img src="https://img.shields.io/npm/v/mkctx.svg" alt="npm version"></a>
|
|
17
17
|
<a href="https://www.npmjs.com/package/mkctx"><img src="https://img.shields.io/npm/dm/mkctx.svg" alt="npm downloads"></a>
|
|
18
|
-
<a href="https://github.com/
|
|
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
19
|
</p>
|
|
20
20
|
|
|
21
|
-
## Features
|
|
21
|
+
## โจ Features
|
|
22
22
|
|
|
23
23
|
- ๐ **Multi-platform** - Works on Windows, macOS, and Linux
|
|
24
24
|
- ๐ **Smart Ignoring** - Respects custom ignore patterns and common system files
|
|
25
25
|
- โ๏ธ **Configurable** - Customize source directories, output locations, and comments
|
|
26
|
+
- โ๏ธ **Custom Naming** - Specify custom filenames for your outputs or use the default 'context'
|
|
26
27
|
- ๐ฏ **AI-Friendly** - Outputs code in markdown format ideal for AI prompts
|
|
27
|
-
- ๐ง **Zero Dependencies** - Pure Node.js, no external dependencies
|
|
28
28
|
- ๐จ **Syntax Highlighting** - Proper language detection for code blocks
|
|
29
29
|
- ๐ **Dynamic Mode** - Interactive path selection when needed
|
|
30
|
+
- ๐ **Context Statistics** - Token estimation and file analysis
|
|
30
31
|
|
|
31
|
-
## Installation
|
|
32
|
+
## ๐ฆ Installation
|
|
32
33
|
|
|
33
34
|
```bash
|
|
34
35
|
npm install -g mkctx
|
|
35
36
|
```
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
### Requirements
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
- **Node.js** 18.0+
|
|
41
|
+
|
|
42
|
+
## ๐ Quick Start
|
|
43
|
+
|
|
44
|
+
### Interactive Mode (Recommended)
|
|
40
45
|
|
|
41
46
|
```bash
|
|
42
47
|
mkctx
|
|
43
48
|
```
|
|
44
49
|
|
|
45
|
-
|
|
50
|
+
This opens an interactive menu where you can:
|
|
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
|
|
54
|
+
|
|
55
|
+
### Create Configuration File
|
|
46
56
|
|
|
47
57
|
```bash
|
|
48
58
|
mkctx config
|
|
49
59
|
```
|
|
50
60
|
|
|
51
|
-
### Show
|
|
61
|
+
### Show Help
|
|
52
62
|
|
|
53
63
|
```bash
|
|
54
64
|
mkctx help
|
|
55
65
|
```
|
|
56
66
|
|
|
57
|
-
## Usage
|
|
58
|
-
|
|
59
|
-
### Basic Usage
|
|
60
|
-
|
|
61
|
-
Run `mkctx` in your project root to generate a `context.md` file containing all your project code:
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
cd your-project/
|
|
65
|
-
mkctx
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Dynamic Mode
|
|
69
|
-
|
|
70
|
-
If no configuration file exists, or if `dynamic: true` is set, mkctx will prompt you for the source path:
|
|
67
|
+
## ๐ Usage
|
|
71
68
|
|
|
72
69
|
```
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
71
|
+
โ ๐ mkctx - Make Context โ
|
|
72
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
73
|
+
|
|
74
|
+
? What would you like to do?
|
|
75
|
+
โฏ ๐ Generate from config file
|
|
76
|
+
๐ Generate dynamically (choose path)
|
|
77
|
+
โ๏ธ View configuration
|
|
78
|
+
โ Exit
|
|
76
79
|
```
|
|
77
80
|
|
|
78
|
-
|
|
81
|
+
After generating context:
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
```
|
|
84
|
+
๐ Context Summary:
|
|
85
|
+
Files: 42
|
|
86
|
+
Lines: 3,847
|
|
87
|
+
Size: 156.23 KB
|
|
88
|
+
Est. tokens: ~39,058
|
|
89
|
+
|
|
90
|
+
? Select output format:
|
|
91
|
+
โฏ ๐ฆ All formats (MD, JSON, TOON, XML)
|
|
92
|
+
๐ Markdown (.md)
|
|
93
|
+
๐ง JSON (.json) - Simple array
|
|
94
|
+
๐ TOON (.toon) - Token-optimized
|
|
95
|
+
๐ XML (.xml)
|
|
96
|
+
|
|
97
|
+
? Enter a name for the output files: (context)
|
|
84
98
|
```
|
|
85
99
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
- `mkctx.config.json` - Configuration file
|
|
89
|
-
- `mkctx/` directory - Output folder (added to .gitignore)
|
|
100
|
+
> **Note:** Simply press Enter to use the default name `context`.
|
|
90
101
|
|
|
91
|
-
## Configuration
|
|
102
|
+
## โ๏ธ Configuration
|
|
92
103
|
|
|
93
|
-
|
|
104
|
+
### Project Configuration (`mkctx.config.json`)
|
|
94
105
|
|
|
95
106
|
```json
|
|
96
107
|
{
|
|
@@ -98,26 +109,34 @@ The `mkctx.config.json` file supports the following options:
|
|
|
98
109
|
"ignore": "*.log, temp/, node_modules/, .git/, dist/, build/",
|
|
99
110
|
"output": "./mkctx",
|
|
100
111
|
"first_comment": "/* Project Context */",
|
|
101
|
-
"last_comment": "/* End of Context */"
|
|
102
|
-
"dynamic": false
|
|
112
|
+
"last_comment": "/* End of Context */"
|
|
103
113
|
}
|
|
104
114
|
```
|
|
105
115
|
|
|
106
|
-
| Option
|
|
107
|
-
|
|
108
|
-
| `src`
|
|
109
|
-
| `ignore`
|
|
110
|
-
| `output`
|
|
111
|
-
| `first_comment` | Comment
|
|
112
|
-
| `last_comment`
|
|
113
|
-
| `dynamic` | Prompt for path on each run | `false` |
|
|
116
|
+
| Option | Description | Default |
|
|
117
|
+
|--------|-------------|---------|
|
|
118
|
+
| `src` | Source directory to scan | `"."` |
|
|
119
|
+
| `ignore` | Comma-separated patterns to ignore | See defaults |
|
|
120
|
+
| `output` | Output directory for context file | `"./mkctx"` |
|
|
121
|
+
| `first_comment` | Comment at the beginning | `"/* Project Context */"` |
|
|
122
|
+
| `last_comment` | Comment at the end | `"/* End of Context */"` |
|
|
114
123
|
|
|
115
|
-
##
|
|
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
|
+
```
|
|
132
|
+
|
|
133
|
+
## ๐ Ignore Patterns
|
|
116
134
|
|
|
117
135
|
mkctx supports several pattern types:
|
|
118
136
|
|
|
119
137
|
- **Wildcards**: `*.log`, `*.test.js`, `*.spec.ts`
|
|
120
138
|
- **Directories**: `temp/`, `dist/`, `build/`
|
|
139
|
+
- **Glob patterns**: `**/.cache/`, `**/node_modules/`
|
|
121
140
|
- **Exact match**: `config.local.json`
|
|
122
141
|
|
|
123
142
|
### Default System Ignores
|
|
@@ -125,105 +144,88 @@ mkctx supports several pattern types:
|
|
|
125
144
|
These are always ignored automatically:
|
|
126
145
|
|
|
127
146
|
- `.git`, `.svn`, `.hg`
|
|
128
|
-
- `node_modules`
|
|
147
|
+
- `node_modules`, `__pycache__`
|
|
129
148
|
- `.DS_Store`, `Thumbs.db`
|
|
130
|
-
- `__pycache__`, `.pytest_cache`
|
|
131
149
|
- `.vscode`, `.idea`
|
|
150
|
+
- Binary files, images, archives
|
|
132
151
|
|
|
133
|
-
## Output Format
|
|
152
|
+
## ๐ Output Format
|
|
134
153
|
|
|
135
|
-
The generated
|
|
154
|
+
The generated file contains your project code. When saving, you can specify a filename (e.g., `my_project_docs.md`) or use the default.
|
|
136
155
|
|
|
137
156
|
````markdown
|
|
138
|
-
|
|
157
|
+
/* Project Context */
|
|
158
|
+
|
|
159
|
+
## Project Structure
|
|
139
160
|
|
|
140
|
-
```javascript
|
|
141
|
-
// src/index.js
|
|
142
|
-
console.log("Hello World!");
|
|
143
161
|
```
|
|
162
|
+
๐ src/
|
|
163
|
+
๐ src/components/
|
|
164
|
+
๐ src/utils/
|
|
144
165
|
|
|
145
|
-
|
|
146
|
-
// src/utils/helpers.ts
|
|
147
|
-
export function helper() {
|
|
148
|
-
return true;
|
|
149
|
-
}
|
|
166
|
+
42 files total
|
|
150
167
|
```
|
|
151
168
|
|
|
152
|
-
|
|
153
|
-
````
|
|
169
|
+
## Source Files
|
|
154
170
|
|
|
155
|
-
|
|
171
|
+
### src/index.ts
|
|
156
172
|
|
|
157
|
-
|
|
173
|
+
```typescript
|
|
174
|
+
import { App } from './app';
|
|
158
175
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
"src": "./src",
|
|
162
|
-
"ignore": "*.test.js, __tests__/, *.spec.ts",
|
|
163
|
-
"output": "./docs",
|
|
164
|
-
"first_comment": "/* My App Codebase */"
|
|
165
|
-
}
|
|
176
|
+
const app = new App();
|
|
177
|
+
app.start();
|
|
166
178
|
```
|
|
167
179
|
|
|
168
|
-
###
|
|
180
|
+
### src/utils/helpers.ts
|
|
169
181
|
|
|
170
|
-
```
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
"ignore": "node_modules/, .git/, *.md, package-lock.json, yarn.lock",
|
|
174
|
-
"first_comment": "## Project Overview\n\nThis is the complete codebase.",
|
|
175
|
-
"last_comment": "## End of Codebase"
|
|
182
|
+
```typescript
|
|
183
|
+
export function helper() {
|
|
184
|
+
return true;
|
|
176
185
|
}
|
|
177
186
|
```
|
|
178
187
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
```json
|
|
182
|
-
{
|
|
183
|
-
"src": "./src",
|
|
184
|
-
"dynamic": true
|
|
185
|
-
}
|
|
186
|
-
```
|
|
188
|
+
/* End of Context */
|
|
189
|
+
````
|
|
187
190
|
|
|
188
|
-
## Supported Languages
|
|
191
|
+
## ๐จ Supported Languages
|
|
189
192
|
|
|
190
193
|
mkctx automatically detects and applies proper syntax highlighting for:
|
|
191
194
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
- **
|
|
210
|
-
- **
|
|
211
|
-
- **
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
### Command not found
|
|
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` |
|
|
209
|
+
|
|
210
|
+
## ๐ก Use Cases
|
|
211
|
+
|
|
212
|
+
- **๐ค AI Code Analysis** - Feed your codebase to ChatGPT, Claude, or other AI tools
|
|
213
|
+
- **๐ Code Understanding** - Share project overview for quick understanding
|
|
214
|
+
- **๐ฅ Code Reviews** - Share project overview with reviewers
|
|
215
|
+
- **๐ Onboarding** - Help new developers understand the project
|
|
216
|
+
- **๐ Documentation** - Generate a snapshot of your codebase with custom naming
|
|
217
|
+
|
|
218
|
+
## ๐ฅ๏ธ Platform Support
|
|
219
|
+
|
|
220
|
+
| Platform | Status |
|
|
221
|
+
|----------|--------|
|
|
222
|
+
| **macOS** | โ
Full support |
|
|
223
|
+
| **Linux** | โ
Full support |
|
|
224
|
+
| **Windows** | โ
Full support |
|
|
225
|
+
|
|
226
|
+
## ๐ง Troubleshooting
|
|
227
|
+
|
|
228
|
+
### Command Not Found
|
|
227
229
|
|
|
228
230
|
If `mkctx` is not found after installation:
|
|
229
231
|
|
|
@@ -231,7 +233,7 @@ If `mkctx` is not found after installation:
|
|
|
231
233
|
2. Try: `npm bin -g` to see where global packages are installed
|
|
232
234
|
3. Restart your terminal
|
|
233
235
|
|
|
234
|
-
### Permission
|
|
236
|
+
### Permission Errors (Unix)
|
|
235
237
|
|
|
236
238
|
```bash
|
|
237
239
|
sudo npm install -g mkctx
|
|
@@ -239,24 +241,33 @@ sudo npm install -g mkctx
|
|
|
239
241
|
|
|
240
242
|
Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors
|
|
241
243
|
|
|
242
|
-
## Changelog
|
|
244
|
+
## ๐ Changelog
|
|
245
|
+
|
|
246
|
+
### v4.0.0
|
|
247
|
+
|
|
248
|
+
- โ๏ธ Added interactive filename selection when saving (defaults to "context")
|
|
249
|
+
- ๐จ Improved UI/UX for file saving workflow
|
|
250
|
+
|
|
251
|
+
### v3.0.0
|
|
252
|
+
|
|
253
|
+
- ๐ฏ Simplified to focus on context generation
|
|
254
|
+
- ๐๏ธ Removed Ollama chat integration
|
|
255
|
+
- โก Faster startup and smaller footprint
|
|
256
|
+
- ๐งน Cleaner codebase
|
|
243
257
|
|
|
244
|
-
### v2.
|
|
258
|
+
### v2.x
|
|
245
259
|
|
|
246
|
-
-
|
|
247
|
-
-
|
|
248
|
-
- Improved language detection
|
|
249
|
-
- Better ignore pattern handling
|
|
250
|
-
- Zero external dependencies
|
|
260
|
+
- Ollama AI chat integration (removed in v3)
|
|
261
|
+
- Interactive chat interface
|
|
251
262
|
|
|
252
263
|
### v1.x
|
|
253
264
|
|
|
254
265
|
- Initial Go-based implementation
|
|
255
266
|
|
|
256
|
-
## Contributing
|
|
267
|
+
## ๐ค Contributing
|
|
257
268
|
|
|
258
269
|
Contributions are welcome! Please feel free to submit pull requests or open issues.
|
|
259
270
|
|
|
260
|
-
## License
|
|
271
|
+
## ๐ License
|
|
261
272
|
|
|
262
|
-
MIT License - see [LICENSE](LICENSE) file for details.
|
|
273
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|