mkctx 2.0.1 โ†’ 3.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.
Files changed (3) hide show
  1. package/README.md +140 -135
  2. package/bin/mkctx.js +572 -374
  3. package/package.json +15 -6
package/README.md CHANGED
@@ -4,93 +4,97 @@
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="mkcommit logo" width="150">
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 use with AI assistants like ChatGPT, Claude, and others.
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/yourusername/mkctx/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/mkctx.svg" alt="license"></a>
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
26
  - ๐ŸŽฏ **AI-Friendly** - Outputs code in markdown format ideal for AI prompts
27
- - ๐Ÿ”ง **Zero Dependencies** - Pure Node.js, no external dependencies
28
27
  - ๐ŸŽจ **Syntax Highlighting** - Proper language detection for code blocks
29
28
  - ๐Ÿ”„ **Dynamic Mode** - Interactive path selection when needed
29
+ - ๐Ÿ“Š **Context Statistics** - Token estimation and file analysis
30
30
 
31
- ## Installation
31
+ ## ๐Ÿ“ฆ Installation
32
32
 
33
33
  ```bash
34
34
  npm install -g mkctx
35
35
  ```
36
36
 
37
- ## Quick Start
37
+ ### Requirements
38
38
 
39
- ### Generate context for your project
39
+ - **Node.js** 18.0+
40
+
41
+ ## ๐Ÿš€ Quick Start
42
+
43
+ ### Interactive Mode (Recommended)
40
44
 
41
45
  ```bash
42
46
  mkctx
43
47
  ```
44
48
 
45
- ### Create configuration file
49
+ This opens an interactive menu where you can:
50
+ 1. Generate context from config file or dynamically
51
+ 2. View context statistics
52
+ 3. Save the context to a file
53
+
54
+ ### Create Configuration File
46
55
 
47
56
  ```bash
48
57
  mkctx config
49
58
  ```
50
59
 
51
- ### Show help
60
+ ### Show Help
52
61
 
53
62
  ```bash
54
63
  mkctx help
55
64
  ```
56
65
 
57
- ## Usage
58
-
59
- ### Basic Usage
66
+ ## ๐Ÿ“‹ Usage
60
67
 
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
68
  ```
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:
71
-
69
+ โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
70
+ โ•‘ ๐Ÿ“„ mkctx - Make Context โ•‘
71
+ โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
72
+
73
+ ? What would you like to do?
74
+ โฏ ๐Ÿ“ Generate from config file
75
+ ๐Ÿ” Generate dynamically (choose path)
76
+ โš™๏ธ View configuration
77
+ โŒ Exit
72
78
  ```
73
- ๐Ÿ” Dynamic mode enabled
74
- Current directory: /home/user/my-project
75
- Enter path (or press Enter for './src'): app/components
76
- ```
77
-
78
- ### Configuration
79
79
 
80
- Create a configuration file to customize behavior:
80
+ After generating context:
81
81
 
82
- ```bash
83
- mkctx config
82
+ ```
83
+ ๐Ÿ“Š Context Summary:
84
+ Files: 42
85
+ Lines: 3,847
86
+ Size: 156.23 KB
87
+ Est. tokens: ~39,058
88
+
89
+ ? What would you like to do with this context?
90
+ โฏ ๐Ÿ’พ Save context to file
91
+ ๐Ÿ”™ Back to main menu
92
+ โŒ Exit
84
93
  ```
85
94
 
86
- This creates:
87
-
88
- - `mkctx.config.json` - Configuration file
89
- - `mkctx/` directory - Output folder (added to .gitignore)
90
-
91
- ## Configuration Options
95
+ ## โš™๏ธ Configuration
92
96
 
93
- The `mkctx.config.json` file supports the following options:
97
+ ### Project Configuration (`mkctx.config.json`)
94
98
 
95
99
  ```json
96
100
  {
@@ -98,26 +102,34 @@ The `mkctx.config.json` file supports the following options:
98
102
  "ignore": "*.log, temp/, node_modules/, .git/, dist/, build/",
99
103
  "output": "./mkctx",
100
104
  "first_comment": "/* Project Context */",
101
- "last_comment": "/* End of Context */",
102
- "dynamic": false
105
+ "last_comment": "/* End of Context */"
103
106
  }
104
107
  ```
105
108
 
106
- | Option | Description | Default |
107
- | --------------- | --------------------------------------------- | -------------------------------------- |
108
- | `src` | Source directory to scan | `"./src"` |
109
- | `ignore` | Comma-separated patterns to ignore | `"*.log, temp/, node_modules/, .git/"` |
110
- | `output` | Output directory for context file | `"./mkctx"` |
111
- | `first_comment` | Comment added at the beginning of the context | `"/* Project Context */"` |
112
- | `last_comment` | Comment added at the end of the context | `"/* End of Context */"` |
113
- | `dynamic` | Prompt for path on each run | `false` |
109
+ | Option | Description | Default |
110
+ |--------|-------------|---------|
111
+ | `src` | Source directory to scan | `"."` |
112
+ | `ignore` | Comma-separated patterns to ignore | See defaults |
113
+ | `output` | Output directory for context file | `"./mkctx"` |
114
+ | `first_comment` | Comment at the beginning | `"/* Project Context */"` |
115
+ | `last_comment` | Comment at the end | `"/* End of Context */"` |
114
116
 
115
- ## Ignore Patterns
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
+ ```
125
+
126
+ ## ๐Ÿ“‚ Ignore Patterns
116
127
 
117
128
  mkctx supports several pattern types:
118
129
 
119
130
  - **Wildcards**: `*.log`, `*.test.js`, `*.spec.ts`
120
131
  - **Directories**: `temp/`, `dist/`, `build/`
132
+ - **Glob patterns**: `**/.cache/`, `**/node_modules/`
121
133
  - **Exact match**: `config.local.json`
122
134
 
123
135
  ### Default System Ignores
@@ -125,105 +137,88 @@ mkctx supports several pattern types:
125
137
  These are always ignored automatically:
126
138
 
127
139
  - `.git`, `.svn`, `.hg`
128
- - `node_modules`
140
+ - `node_modules`, `__pycache__`
129
141
  - `.DS_Store`, `Thumbs.db`
130
- - `__pycache__`, `.pytest_cache`
131
142
  - `.vscode`, `.idea`
143
+ - Binary files, images, archives
132
144
 
133
- ## Output Format
145
+ ## ๐Ÿ“„ Output Format
134
146
 
135
- The generated `context.md` file contains your project code in this format:
147
+ The generated `context.md` file contains your project code:
136
148
 
137
149
  ````markdown
138
- /_ Project Context _/
150
+ /* Project Context */
151
+
152
+ ## Project Structure
139
153
 
140
- ```javascript
141
- // src/index.js
142
- console.log("Hello World!");
143
154
  ```
155
+ ๐Ÿ“ src/
156
+ ๐Ÿ“ src/components/
157
+ ๐Ÿ“ src/utils/
144
158
 
145
- ```typescript
146
- // src/utils/helpers.ts
147
- export function helper() {
148
- return true;
149
- }
159
+ 42 files total
150
160
  ```
151
161
 
152
- /_ End of Context _/
153
- ````
162
+ ## Source Files
154
163
 
155
- ## Examples
164
+ ### src/index.ts
156
165
 
157
- ### Include only specific directories
166
+ ```typescript
167
+ import { App } from './app';
158
168
 
159
- ```json
160
- {
161
- "src": "./src",
162
- "ignore": "*.test.js, __tests__/, *.spec.ts",
163
- "output": "./docs",
164
- "first_comment": "/* My App Codebase */"
165
- }
169
+ const app = new App();
170
+ app.start();
166
171
  ```
167
172
 
168
- ### Generate context for documentation
173
+ ### src/utils/helpers.ts
169
174
 
170
- ```json
171
- {
172
- "src": ".",
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"
175
+ ```typescript
176
+ export function helper() {
177
+ return true;
176
178
  }
177
179
  ```
178
180
 
179
- ### Always prompt for path
180
-
181
- ```json
182
- {
183
- "src": "./src",
184
- "dynamic": true
185
- }
186
- ```
181
+ /* End of Context */
182
+ ````
187
183
 
188
- ## Supported Languages
184
+ ## ๐ŸŽจ Supported Languages
189
185
 
190
186
  mkctx automatically detects and applies proper syntax highlighting for:
191
187
 
192
- - **JavaScript/TypeScript**: `.js`, `.ts`, `.jsx`, `.tsx`, `.mjs`, `.cjs`
193
- - **Python**: `.py`
194
- - **Go**: `.go`
195
- - **Rust**: `.rs`
196
- - **Java/Kotlin**: `.java`, `.kt`
197
- - **C/C++**: `.c`, `.cpp`, `.h`, `.hpp`
198
- - **PHP**: `.php`
199
- - **Ruby**: `.rb`
200
- - **Shell**: `.sh`, `.bash`, `.zsh`, `.ps1`
201
- - **Web**: `.html`, `.css`, `.scss`, `.vue`, `.svelte`
202
- - **Data**: `.json`, `.yaml`, `.yml`, `.xml`, `.toml`
203
- - **And many more...**
204
-
205
- ## Use Cases
206
-
207
- - **AI Pair Programming** - Provide complete context to AI assistants
208
- - **Code Reviews** - Share project overview with reviewers
209
- - **Documentation** - Create living documentation of your codebase
210
- - **Onboarding** - Help new developers understand the project structure
211
- - **Backup** - Generate searchable archives of your code
212
-
213
- ## Platform Support
214
-
215
- - โœ… **Windows** - Full support
216
- - โœ… **macOS** - Full support
217
- - โœ… **Linux** - Full support
218
-
219
- ## Requirements
220
-
221
- - **Node.js** 14.0+
222
- - **npm** (for installation)
223
-
224
- ## Troubleshooting
225
-
226
- ### Command not found
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
212
+
213
+ | Platform | Status |
214
+ |----------|--------|
215
+ | **macOS** | โœ… Full support |
216
+ | **Linux** | โœ… Full support |
217
+ | **Windows** | โœ… Full support |
218
+
219
+ ## ๐Ÿ”ง Troubleshooting
220
+
221
+ ### Command Not Found
227
222
 
228
223
  If `mkctx` is not found after installation:
229
224
 
@@ -231,7 +226,7 @@ If `mkctx` is not found after installation:
231
226
  2. Try: `npm bin -g` to see where global packages are installed
232
227
  3. Restart your terminal
233
228
 
234
- ### Permission errors (Unix)
229
+ ### Permission Errors (Unix)
235
230
 
236
231
  ```bash
237
232
  sudo npm install -g mkctx
@@ -239,24 +234,34 @@ sudo npm install -g mkctx
239
234
 
240
235
  Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors
241
236
 
242
- ## Changelog
237
+ ## ๐Ÿ“‹ Changelog
238
+
239
+ ### v3.0.0
240
+
241
+ - ๐ŸŽฏ Simplified to focus on context generation
242
+ - ๐Ÿ—‘๏ธ Removed Ollama chat integration
243
+ - โšก Faster startup and smaller footprint
244
+ - ๐Ÿงน Cleaner codebase
243
245
 
244
- ### v2.0.0
246
+ ### v2.x
245
247
 
246
- - Complete rewrite in Node.js (no more Go binaries)
247
- - Added dynamic mode for interactive path selection
248
- - Improved language detection
249
- - Better ignore pattern handling
250
- - Zero external dependencies
248
+ - Ollama AI chat integration (removed in v3)
249
+ - Interactive chat interface
251
250
 
252
251
  ### v1.x
253
252
 
254
253
  - Initial Go-based implementation
255
254
 
256
- ## Contributing
255
+ ## ๐Ÿค Contributing
257
256
 
258
257
  Contributions are welcome! Please feel free to submit pull requests or open issues.
259
258
 
260
- ## License
259
+ ## ๐Ÿ“„ License
261
260
 
262
261
  MIT License - see [LICENSE](LICENSE) file for details.
262
+
263
+ ---
264
+
265
+ <p align="center">
266
+ Made with โค๏ธ for developers who love AI-assisted coding
267
+ </p>