mkctx 1.0.2 → 2.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/LICENSE +21 -0
- package/README.md +242 -176
- package/bin/mkctx.js +462 -0
- package/favicon.svg +5 -0
- package/package.json +57 -49
- package/cleanup.js +0 -28
- package/install.js +0 -185
- package/main.go +0 -210
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Your Name
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,176 +1,242 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
##
|
|
144
|
-
|
|
145
|
-
###
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./favicon.svg" alt="mkctx logo" width="120" height="140" style="background: #fff; padding: 10px; border-radius: 15px" >
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">mkctx - Make Context</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
A powerful command-line tool that generates comprehensive markdown context files from your project code, perfect for use with AI assistants like ChatGPT, Claude, and others.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://www.npmjs.com/package/mkctx"><img src="https://img.shields.io/npm/v/mkctx.svg" alt="npm version"></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/mkctx"><img src="https://img.shields.io/npm/dm/mkctx.svg" alt="npm downloads"></a>
|
|
14
|
+
<a href="https://github.com/yourusername/mkctx/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/mkctx.svg" alt="license"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
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
|
+
- 🎯 **AI-Friendly** - Outputs code in markdown format ideal for AI prompts
|
|
23
|
+
- 🔧 **Zero Dependencies** - Pure Node.js, no external dependencies
|
|
24
|
+
- 🎨 **Syntax Highlighting** - Proper language detection for code blocks
|
|
25
|
+
- 🔄 **Dynamic Mode** - Interactive path selection when needed
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install -g mkctx
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
### Generate context for your project
|
|
36
|
+
```bash
|
|
37
|
+
mkctx
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Create configuration file
|
|
41
|
+
```bash
|
|
42
|
+
mkctx config
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Show help
|
|
46
|
+
```bash
|
|
47
|
+
mkctx help
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
### Basic Usage
|
|
53
|
+
Run `mkctx` in your project root to generate a `context.md` file containing all your project code:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
cd your-project/
|
|
57
|
+
mkctx
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Dynamic Mode
|
|
61
|
+
If no configuration file exists, or if `dynamic: true` is set, mkctx will prompt you for the source path:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
🔍 Dynamic mode enabled
|
|
65
|
+
Current directory: /home/user/my-project
|
|
66
|
+
Enter path (or press Enter for './src'): app/components
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Configuration
|
|
70
|
+
Create a configuration file to customize behavior:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
mkctx config
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This creates:
|
|
77
|
+
- `mkctx.config.json` - Configuration file
|
|
78
|
+
- `mkctx/` directory - Output folder (added to .gitignore)
|
|
79
|
+
|
|
80
|
+
## Configuration Options
|
|
81
|
+
|
|
82
|
+
The `mkctx.config.json` file supports the following options:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"src": "./src",
|
|
87
|
+
"ignore": "*.log, temp/, node_modules/, .git/, dist/, build/",
|
|
88
|
+
"output": "./mkctx",
|
|
89
|
+
"first_comment": "/* Project Context */",
|
|
90
|
+
"last_comment": "/* End of Context */",
|
|
91
|
+
"dynamic": false
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
| Option | Description | Default |
|
|
96
|
+
|--------|-------------|---------|
|
|
97
|
+
| `src` | Source directory to scan | `"./src"` |
|
|
98
|
+
| `ignore` | Comma-separated patterns to ignore | `"*.log, temp/, node_modules/, .git/"` |
|
|
99
|
+
| `output` | Output directory for context file | `"./mkctx"` |
|
|
100
|
+
| `first_comment` | Comment added at the beginning of the context | `"/* Project Context */"` |
|
|
101
|
+
| `last_comment` | Comment added at the end of the context | `"/* End of Context */"` |
|
|
102
|
+
| `dynamic` | Prompt for path on each run | `false` |
|
|
103
|
+
|
|
104
|
+
## Ignore Patterns
|
|
105
|
+
|
|
106
|
+
mkctx supports several pattern types:
|
|
107
|
+
|
|
108
|
+
- **Wildcards**: `*.log`, `*.test.js`, `*.spec.ts`
|
|
109
|
+
- **Directories**: `temp/`, `dist/`, `build/`
|
|
110
|
+
- **Exact match**: `config.local.json`
|
|
111
|
+
|
|
112
|
+
### Default System Ignores
|
|
113
|
+
|
|
114
|
+
These are always ignored automatically:
|
|
115
|
+
- `.git`, `.svn`, `.hg`
|
|
116
|
+
- `node_modules`
|
|
117
|
+
- `.DS_Store`, `Thumbs.db`
|
|
118
|
+
- `__pycache__`, `.pytest_cache`
|
|
119
|
+
- `.vscode`, `.idea`
|
|
120
|
+
|
|
121
|
+
## Output Format
|
|
122
|
+
|
|
123
|
+
The generated `context.md` file contains your project code in this format:
|
|
124
|
+
|
|
125
|
+
````markdown
|
|
126
|
+
/* Project Context */
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
// src/index.js
|
|
130
|
+
console.log("Hello World!");
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
// src/utils/helpers.ts
|
|
135
|
+
export function helper() {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
/* End of Context */
|
|
141
|
+
````
|
|
142
|
+
|
|
143
|
+
## Examples
|
|
144
|
+
|
|
145
|
+
### Include only specific directories
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"src": "./src",
|
|
149
|
+
"ignore": "*.test.js, __tests__/, *.spec.ts",
|
|
150
|
+
"output": "./docs",
|
|
151
|
+
"first_comment": "/* My App Codebase */"
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Generate context for documentation
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"src": ".",
|
|
159
|
+
"ignore": "node_modules/, .git/, *.md, package-lock.json, yarn.lock",
|
|
160
|
+
"first_comment": "## Project Overview\n\nThis is the complete codebase.",
|
|
161
|
+
"last_comment": "## End of Codebase"
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Always prompt for path
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"src": "./src",
|
|
169
|
+
"dynamic": true
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Supported Languages
|
|
174
|
+
|
|
175
|
+
mkctx automatically detects and applies proper syntax highlighting for:
|
|
176
|
+
|
|
177
|
+
- **JavaScript/TypeScript**: `.js`, `.ts`, `.jsx`, `.tsx`, `.mjs`, `.cjs`
|
|
178
|
+
- **Python**: `.py`
|
|
179
|
+
- **Go**: `.go`
|
|
180
|
+
- **Rust**: `.rs`
|
|
181
|
+
- **Java/Kotlin**: `.java`, `.kt`
|
|
182
|
+
- **C/C++**: `.c`, `.cpp`, `.h`, `.hpp`
|
|
183
|
+
- **PHP**: `.php`
|
|
184
|
+
- **Ruby**: `.rb`
|
|
185
|
+
- **Shell**: `.sh`, `.bash`, `.zsh`, `.ps1`
|
|
186
|
+
- **Web**: `.html`, `.css`, `.scss`, `.vue`, `.svelte`
|
|
187
|
+
- **Data**: `.json`, `.yaml`, `.yml`, `.xml`, `.toml`
|
|
188
|
+
- **And many more...**
|
|
189
|
+
|
|
190
|
+
## Use Cases
|
|
191
|
+
|
|
192
|
+
- **AI Pair Programming** - Provide complete context to AI assistants
|
|
193
|
+
- **Code Reviews** - Share project overview with reviewers
|
|
194
|
+
- **Documentation** - Create living documentation of your codebase
|
|
195
|
+
- **Onboarding** - Help new developers understand the project structure
|
|
196
|
+
- **Backup** - Generate searchable archives of your code
|
|
197
|
+
|
|
198
|
+
## Platform Support
|
|
199
|
+
|
|
200
|
+
- ✅ **Windows** - Full support
|
|
201
|
+
- ✅ **macOS** - Full support
|
|
202
|
+
- ✅ **Linux** - Full support
|
|
203
|
+
|
|
204
|
+
## Requirements
|
|
205
|
+
|
|
206
|
+
- **Node.js** 14.0+
|
|
207
|
+
- **npm** (for installation)
|
|
208
|
+
|
|
209
|
+
## Troubleshooting
|
|
210
|
+
|
|
211
|
+
### Command not found
|
|
212
|
+
If `mkctx` is not found after installation:
|
|
213
|
+
1. Make sure npm global bin is in your PATH
|
|
214
|
+
2. Try: `npm bin -g` to see where global packages are installed
|
|
215
|
+
3. Restart your terminal
|
|
216
|
+
|
|
217
|
+
### Permission errors (Unix)
|
|
218
|
+
```bash
|
|
219
|
+
sudo npm install -g mkctx
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors
|
|
223
|
+
|
|
224
|
+
## Changelog
|
|
225
|
+
|
|
226
|
+
### v2.0.0
|
|
227
|
+
- Complete rewrite in Node.js (no more Go binaries)
|
|
228
|
+
- Added dynamic mode for interactive path selection
|
|
229
|
+
- Improved language detection
|
|
230
|
+
- Better ignore pattern handling
|
|
231
|
+
- Zero external dependencies
|
|
232
|
+
|
|
233
|
+
### v1.x
|
|
234
|
+
- Initial Go-based implementation
|
|
235
|
+
|
|
236
|
+
## Contributing
|
|
237
|
+
|
|
238
|
+
Contributions are welcome! Please feel free to submit pull requests or open issues.
|
|
239
|
+
|
|
240
|
+
## License
|
|
241
|
+
|
|
242
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|