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 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
- # mkctx - Make Context
2
-
3
- A powerful command-line tool that generates comprehensive markdown context files from your project code, perfect for use with AI assistants and documentation.
4
-
5
- ## Features
6
-
7
- - 🚀 **Multi-platform** - Works on Windows, macOS, and Linux
8
- - 📝 **Smart Ignoring** - Respects gitignore patterns and custom ignore rules
9
- - ⚙️ **Configurable** - Customize source directories, output locations, and comments
10
- - 🎯 **AI-Friendly** - Outputs code in markdown format ideal for AI prompts
11
- - 🔧 **Easy Installation** - Install globally via npm
12
-
13
- ## Installation
14
-
15
- ```bash
16
- npm install -g mkctx
17
- ```
18
-
19
- ## Quick Start
20
-
21
- ### Generate context for your project
22
- ```bash
23
- mkctx
24
- ```
25
-
26
- ### Create configuration file
27
- ```bash
28
- mkctx config
29
- ```
30
-
31
- ## Usage
32
-
33
- ### Basic Usage
34
- Run `mkctx` in your project root to generate a `context.md` file containing all your project code:
35
-
36
- ```bash
37
- cd your-project/
38
- mkctx
39
- ```
40
-
41
- ### Configuration
42
- Create a configuration file to customize behavior:
43
-
44
- ```bash
45
- mkctx config
46
- ```
47
-
48
- This creates:
49
- - `mkctx.config.json` - Configuration file
50
- - `mkctx/` directory - Output folder (added to .gitignore)
51
-
52
- ## Configuration Options
53
-
54
- The `mkctx.config.json` file supports the following options:
55
-
56
- ```json
57
- {
58
- "src": "./src",
59
- "ignore": "*.log, temp/, node_modules/, .git/",
60
- "output": "./mkctx",
61
- "first_comment": "/* Project Context */",
62
- "last_comment": "/* End of Context */"
63
- }
64
- ```
65
-
66
- | Option | Description | Default |
67
- |--------|-------------|---------|
68
- | `src` | Source directory to scan | `"."` (current directory) |
69
- | `ignore` | Comma-separated patterns to ignore | `"*.log, temp/, node_modules/, .git/"` |
70
- | `output` | Output directory for context file | `"."` (current directory) |
71
- | `first_comment` | Comment added at the beginning of the context | `"/* Project Context */"` |
72
- | `last_comment` | Comment added at the end of the context | `"/* End of Context */"` |
73
-
74
- ## Output Format
75
-
76
- The generated `context.md` file contains your project code in this format:
77
-
78
- ````markdown
79
- /* Project Context */
80
-
81
- ```javascript
82
- // src/main.js
83
- console.log("Hello World!");
84
- ```
85
-
86
- ```css
87
- // styles/main.css
88
- body { margin: 0; }
89
- ```
90
-
91
- /* End of Context */
92
- ````
93
-
94
- ## Examples
95
-
96
- ### Include only specific directories
97
- ```json
98
- {
99
- "src": "./src",
100
- "ignore": "*.test.js, __tests__/, dist/",
101
- "output": "./docs",
102
- "first_comment": "/* My App Codebase */"
103
- }
104
- ```
105
-
106
- ### Generate context for documentation
107
- ```json
108
- {
109
- "src": ".",
110
- "ignore": "node_modules/, .git/, *.md, package-lock.json",
111
- "first_comment": "## Project Overview\n\nThis is the complete codebase for my application.",
112
- "last_comment": "## End of Codebase\n\nThis context file was generated using mkctx."
113
- }
114
- ```
115
-
116
- ## Platform Support
117
-
118
- - **Windows** - Full support with automatic .exe handling
119
- - **macOS** - Native support with proper permissions
120
- - ✅ **Linux** - Complete compatibility
121
-
122
- ## Requirements
123
-
124
- - **Go** 1.16+ (for building from source)
125
- - **Node.js** 14.0+ (for npm installation)
126
- - **npm** or **yarn** (for package management)
127
-
128
- ## How It Works
129
-
130
- 1. **Scan**: Recursively scans your source directory
131
- 2. **Filter**: Applies ignore patterns from config and .gitignore
132
- 3. **Format**: Converts each file to markdown code blocks with file paths
133
- 4. **Output**: Generates a comprehensive context.md file
134
-
135
- ## Use Cases
136
-
137
- - **AI Pair Programming** - Provide complete context to AI assistants
138
- - **Code Reviews** - Share project overview with reviewers
139
- - **Documentation** - Create living documentation of your codebase
140
- - **Onboarding** - Help new developers understand the project structure
141
- - **Backup** - Generate searchable archives of your code
142
-
143
- ## Troubleshooting
144
-
145
- ### Installation Issues
146
- If installation fails, try manual installation:
147
- 1. Build the binary: `go build -o mkctx main.go`
148
- 2. Copy to a directory in your PATH
149
- 3. Ensure execution permissions: `chmod +x mkctx`
150
-
151
- ### Permission Errors
152
- On Unix systems, you might need to use `sudo`:
153
- ```bash
154
- sudo npm install -g mkctx
155
- ```
156
-
157
- ### Binary Not Found
158
- If `mkctx` command is not found after installation:
159
- 1. Check if the installation directory is in your PATH
160
- 2. Restart your terminal
161
- 3. Try reinstalling: `npm uninstall -g mkctx && npm install -g mkctx`
162
-
163
- ## Contributing
164
-
165
- Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
166
-
167
- ## License
168
-
169
- MIT License - see LICENSE file for details.
170
-
171
- ## Support
172
-
173
- If you encounter any problems or have questions:
174
- 1. Check this README for solutions
175
- 2. Open an issue on GitHub
176
- 3. Check the generated configuration for guidance
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.