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.
Files changed (3) hide show
  1. package/README.md +173 -146
  2. package/bin/mkctx.js +510 -395
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- <h1 align="center">mkctx - Make Context</h1>
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
- <p align="center">
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
- <p align="center">
16
- <a href="https://www.npmjs.com/package/mkctx"><img src="https://img.shields.io/npm/v/mkctx.svg" alt="npm version"></a>
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/pnkkzero/mkctx/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/mkctx.svg" alt="license"></a>
19
- </p>
13
+ [![npm version](https://img.shields.io/npm/v/mkctx.svg)](https://www.npmjs.com/package/mkctx)
14
+ [![npm downloads](https://img.shields.io/npm/dm/mkctx.svg)](https://www.npmjs.com/package/mkctx)
15
+ [![license](https://img.shields.io/npm/l/mkctx.svg)](https://github.com/pnkkzero/mkctx/blob/main/LICENSE)
20
16
 
21
- ## โœจ Features
17
+ ## Features
22
18
 
23
- - ๐Ÿš€ **Multi-platform** - Works on Windows, macOS, and Linux
24
- - ๐Ÿ“ **Smart Ignoring** - Respects custom ignore patterns and common system files
25
- - โš™๏ธ **Configurable** - Customize source directories, output locations, and comments
26
- - ๐ŸŽฏ **AI-Friendly** - Outputs code in markdown format ideal for AI prompts
27
- - ๐ŸŽจ **Syntax Highlighting** - Proper language detection for code blocks
28
- - ๐Ÿ”„ **Dynamic Mode** - Interactive path selection when needed
29
- - ๐Ÿ“Š **Context Statistics** - Token estimation and file analysis
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
- ## ๐Ÿ“ฆ Installation
28
+ ## Installation
32
29
 
33
30
  ```bash
34
31
  npm install -g mkctx
35
32
  ```
36
33
 
37
- ### Requirements
34
+ **Requirements:** Node.js 18.0+
38
35
 
39
- - **Node.js** 18.0+
36
+ ## Quick Start
40
37
 
41
- ## ๐Ÿš€ Quick Start
42
-
43
- ### Interactive Mode (Recommended)
38
+ ### Interactive mode
44
39
 
45
40
  ```bash
46
41
  mkctx
47
42
  ```
48
43
 
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
44
+ Opens a menu where you can generate context, choose output formats, and save with a custom name.
53
45
 
54
- ### Create Configuration File
46
+ ### Non-interactive mode (no prompts)
55
47
 
56
48
  ```bash
57
- mkctx config
49
+ mkctx --src ./src --format md --name my-project
58
50
  ```
59
51
 
60
- ### Show Help
52
+ Pass flags directly and the tool runs to completion without asking anything.
61
53
 
62
- ```bash
63
- mkctx help
64
- ```
54
+ ## Usage
65
55
 
66
- ## ๐Ÿ“‹ Usage
56
+ ### Interactive menu
67
57
 
68
58
  ```
69
59
  โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—
@@ -77,28 +67,67 @@ mkctx help
77
67
  โŒ Exit
78
68
  ```
79
69
 
80
- After generating context:
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: 156.23 KB
87
- Est. tokens: ~39,058
76
+ Size: 156.23 KB
88
77
 
89
- ? What would you like to do with this context?
90
- โฏ ๐Ÿ’พ Save context to file
91
- ๐Ÿ”™ Back to main menu
92
- โŒ Exit
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
- ## โš™๏ธ Configuration
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
- ### Project Configuration (`mkctx.config.json`)
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": "./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 | 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 */"` |
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
- ## ๐Ÿ“‚ Ignore Patterns
146
+ When a config file is present and CLI flags are also passed, the flags take priority over the file values.
127
147
 
128
- mkctx supports several pattern types:
148
+ ## Ignore patterns
129
149
 
130
- - **Wildcards**: `*.log`, `*.test.js`, `*.spec.ts`
131
- - **Directories**: `temp/`, `dist/`, `build/`
132
- - **Glob patterns**: `**/.cache/`, `**/node_modules/`
133
- - **Exact match**: `config.local.json`
150
+ Supported pattern types:
134
151
 
135
- ### Default System Ignores
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
- These are always ignored automatically:
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
- - `.git`, `.svn`, `.hg`
140
- - `node_modules`, `__pycache__`
141
- - `.DS_Store`, `Thumbs.db`
142
- - `.vscode`, `.idea`
143
- - Binary files, images, archives
159
+ ## Output formats
144
160
 
145
- ## ๐Ÿ“„ Output Format
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
- The generated `context.md` file contains your project code:
168
+ ### Markdown output example
148
169
 
149
170
  ````markdown
150
- /* Project Context */
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
- ```typescript
186
+ \```typescript
167
187
  import { App } from './app';
168
-
169
188
  const app = new App();
170
189
  app.start();
171
- ```
190
+ \```
172
191
 
173
- ### src/utils/helpers.ts
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
- ## ๐ŸŽจ Supported Languages
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
- | Platform | Status |
214
- |----------|--------|
215
- | **macOS** | โœ… Full support |
216
- | **Linux** | โœ… Full support |
217
- | **Windows** | โœ… Full support |
218
-
219
- ## ๐Ÿ”ง Troubleshooting
220
-
221
- ### Command Not Found
222
-
223
- If `mkctx` is not found after installation:
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
- 1. Make sure npm global bin is in your PATH
226
- 2. Try: `npm bin -g` to see where global packages are installed
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
- ### Permission Errors (Unix)
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
- ## ๐Ÿ“‹ Changelog
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
- ## ๐Ÿค Contributing
288
+ ## Contributing
256
289
 
257
- Contributions are welcome! Please feel free to submit pull requests or open issues.
290
+ Contributions are welcome! Feel free to open issues or submit pull requests.
258
291
 
259
- ## ๐Ÿ“„ License
292
+ ## License
260
293
 
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>
294
+ MIT License โ€” see [LICENSE](LICENSE) for details.