mkctx 1.0.3 β†’ 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.
package/bin/mkctx.js ADDED
@@ -0,0 +1,462 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const readline = require('readline');
6
+
7
+ const CONFIG_FILE = 'mkctx.config.json';
8
+
9
+ const defaultConfig = {
10
+ src: './src',
11
+ ignore: '*.log, temp/, node_modules/, .git/, dist/, build/',
12
+ output: './mkctx',
13
+ first_comment: '/* Project Context */',
14
+ last_comment: '/* End of Context */',
15
+ dynamic: false
16
+ };
17
+
18
+ // Mapeo de extensiones a lenguajes para mejor resaltado de sintaxis
19
+ const langMap = {
20
+ js: 'javascript',
21
+ ts: 'typescript',
22
+ jsx: 'jsx',
23
+ tsx: 'tsx',
24
+ py: 'python',
25
+ rb: 'ruby',
26
+ go: 'go',
27
+ rs: 'rust',
28
+ java: 'java',
29
+ kt: 'kotlin',
30
+ cs: 'csharp',
31
+ cpp: 'cpp',
32
+ c: 'c',
33
+ h: 'c',
34
+ hpp: 'cpp',
35
+ php: 'php',
36
+ sh: 'bash',
37
+ bash: 'bash',
38
+ zsh: 'bash',
39
+ ps1: 'powershell',
40
+ sql: 'sql',
41
+ html: 'html',
42
+ css: 'css',
43
+ scss: 'scss',
44
+ sass: 'sass',
45
+ less: 'less',
46
+ json: 'json',
47
+ xml: 'xml',
48
+ yaml: 'yaml',
49
+ yml: 'yaml',
50
+ md: 'markdown',
51
+ vue: 'vue',
52
+ svelte: 'svelte',
53
+ dockerfile: 'dockerfile',
54
+ makefile: 'makefile',
55
+ toml: 'toml',
56
+ ini: 'ini',
57
+ cfg: 'ini',
58
+ env: 'bash'
59
+ };
60
+
61
+ async function main() {
62
+ const args = process.argv.slice(2);
63
+ const command = args[0];
64
+
65
+ switch (command) {
66
+ case 'config':
67
+ createConfig();
68
+ break;
69
+ case 'help':
70
+ case '--help':
71
+ case '-h':
72
+ showHelp();
73
+ break;
74
+ case 'version':
75
+ case '--version':
76
+ case '-v':
77
+ showVersion();
78
+ break;
79
+ default:
80
+ await generateContext();
81
+ }
82
+ }
83
+
84
+ function showHelp() {
85
+ console.log(`
86
+ πŸ“„ mkctx - Make Context
87
+
88
+ Generate markdown context files from your project code for AI assistants.
89
+
90
+ Usage:
91
+ mkctx Generate context (interactive if dynamic mode enabled)
92
+ mkctx config Create configuration file
93
+ mkctx help Show this help message
94
+ mkctx version Show version
95
+
96
+ Configuration (mkctx.config.json):
97
+ src Source directory to scan (default: "./src")
98
+ ignore Comma-separated patterns to ignore
99
+ output Output directory (default: "./mkctx")
100
+ first_comment Comment at the beginning of context
101
+ last_comment Comment at the end of context
102
+ dynamic If true, prompts for path on each run
103
+
104
+ Examples:
105
+ mkctx # Generate context
106
+ mkctx config # Create config file
107
+
108
+ More info: https://github.com/yourusername/mkctx
109
+ `);
110
+ }
111
+
112
+ function showVersion() {
113
+ const pkg = require('../package.json');
114
+ console.log(`mkctx v${pkg.version}`);
115
+ }
116
+
117
+ function createConfig() {
118
+ // Crear directorio mkctx
119
+ if (!fs.existsSync('mkctx')) {
120
+ fs.mkdirSync('mkctx', { recursive: true });
121
+ }
122
+
123
+ // Escribir configuraciΓ³n
124
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(defaultConfig, null, 2));
125
+
126
+ // Actualizar .gitignore
127
+ updateGitignore();
128
+
129
+ console.log('βœ… Configuration created:');
130
+ console.log(' - mkctx.config.json');
131
+ console.log(' - mkctx/ folder');
132
+ console.log(' - Entry in .gitignore');
133
+ }
134
+
135
+ function updateGitignore() {
136
+ const gitignorePath = '.gitignore';
137
+ let content = '';
138
+
139
+ if (fs.existsSync(gitignorePath)) {
140
+ content = fs.readFileSync(gitignorePath, 'utf-8');
141
+ }
142
+
143
+ if (!content.includes('mkctx/')) {
144
+ const entry = '\n# mkctx - generated context\nmkctx/\n';
145
+ content += entry;
146
+ fs.writeFileSync(gitignorePath, content);
147
+ }
148
+ }
149
+
150
+ function loadConfig() {
151
+ if (fs.existsSync(CONFIG_FILE)) {
152
+ try {
153
+ const config = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf-8'));
154
+ return { ...defaultConfig, ...config };
155
+ } catch (err) {
156
+ console.log('⚠️ Error parsing config file, using defaults');
157
+ return { ...defaultConfig, dynamic: true };
158
+ }
159
+ }
160
+ // Sin config, activar dynamic por defecto
161
+ return { ...defaultConfig, dynamic: true };
162
+ }
163
+
164
+ async function askForPath(defaultPath) {
165
+ const rl = readline.createInterface({
166
+ input: process.stdin,
167
+ output: process.stdout
168
+ });
169
+
170
+ return new Promise((resolve) => {
171
+ console.log('\nπŸ” Dynamic mode enabled');
172
+ console.log(` Current directory: ${process.cwd()}`);
173
+
174
+ rl.question(` Enter path (or press Enter for '${defaultPath}'): `, (answer) => {
175
+ rl.close();
176
+ const input = answer.trim();
177
+
178
+ if (!input) {
179
+ resolve(defaultPath);
180
+ return;
181
+ }
182
+
183
+ if (!fs.existsSync(input)) {
184
+ console.log(`⚠️ Path '${input}' does not exist. Using default: ${defaultPath}`);
185
+ resolve(defaultPath);
186
+ return;
187
+ }
188
+
189
+ resolve(input);
190
+ });
191
+ });
192
+ }
193
+
194
+ async function generateContext() {
195
+ const config = loadConfig();
196
+
197
+ let srcPath = config.src || '.';
198
+
199
+ // Determinar si usar modo dinΓ‘mico
200
+ if (config.dynamic) {
201
+ srcPath = await askForPath(srcPath);
202
+ } else if (config.src === '.' || config.src === '') {
203
+ srcPath = await askForPath('.');
204
+ }
205
+
206
+ // Verificar que la ruta existe
207
+ if (!fs.existsSync(srcPath)) {
208
+ console.log(`❌ Source path does not exist: ${srcPath}`);
209
+ process.exit(1);
210
+ }
211
+
212
+ const files = getFiles(srcPath, config);
213
+
214
+ if (files.length === 0) {
215
+ console.log(`⚠️ No files found in: ${srcPath}`);
216
+ return;
217
+ }
218
+
219
+ const content = buildContent(files, config);
220
+
221
+ const outputPath = config.output || '.';
222
+ if (!fs.existsSync(outputPath)) {
223
+ fs.mkdirSync(outputPath, { recursive: true });
224
+ }
225
+
226
+ const outputFile = path.join(outputPath, 'context.md');
227
+ fs.writeFileSync(outputFile, content);
228
+
229
+ console.log(`βœ… Context generated at: ${outputFile}`);
230
+ console.log(` πŸ“ Source: ${srcPath}`);
231
+ console.log(` πŸ“„ Files included: ${files.length}`);
232
+ }
233
+
234
+ function getFiles(srcPath, config) {
235
+ const files = [];
236
+ const ignorePatterns = parseIgnorePatterns(config.ignore);
237
+
238
+ function walk(dir) {
239
+ if (!fs.existsSync(dir)) return;
240
+
241
+ let entries;
242
+ try {
243
+ entries = fs.readdirSync(dir, { withFileTypes: true });
244
+ } catch (err) {
245
+ // Sin permisos para leer el directorio
246
+ return;
247
+ }
248
+
249
+ for (const entry of entries) {
250
+ const fullPath = path.join(dir, entry.name);
251
+ const relativePath = path.relative(srcPath, fullPath);
252
+
253
+ if (shouldIgnore(fullPath, entry.name, relativePath, ignorePatterns)) {
254
+ continue;
255
+ }
256
+
257
+ if (entry.isDirectory()) {
258
+ walk(fullPath);
259
+ } else if (entry.isFile()) {
260
+ // Verificar que es un archivo de texto (no binario)
261
+ if (isTextFile(entry.name)) {
262
+ files.push(fullPath);
263
+ }
264
+ }
265
+ }
266
+ }
267
+
268
+ walk(srcPath);
269
+ return files.sort(); // Ordenar alfabΓ©ticamente
270
+ }
271
+
272
+ function parseIgnorePatterns(ignoreString) {
273
+ if (!ignoreString) return [];
274
+ return ignoreString
275
+ .split(',')
276
+ .map(p => p.trim())
277
+ .filter(Boolean);
278
+ }
279
+
280
+ function shouldIgnore(fullPath, name, relativePath, patterns) {
281
+ // Ignorar archivos y carpetas del sistema
282
+ const systemIgnores = [
283
+ '.git',
284
+ '.DS_Store',
285
+ 'Thumbs.db',
286
+ 'node_modules',
287
+ '.svn',
288
+ '.hg',
289
+ '__pycache__',
290
+ '.pytest_cache',
291
+ '.mypy_cache',
292
+ '.vscode',
293
+ '.idea',
294
+ '*.pyc',
295
+ '*.pyo',
296
+ '.env.local',
297
+ '.env.*.local'
298
+ ];
299
+
300
+ for (const ignore of systemIgnores) {
301
+ if (ignore.includes('*')) {
302
+ if (matchWildcard(ignore, name)) return true;
303
+ } else {
304
+ if (fullPath.includes(ignore) || name === ignore) return true;
305
+ }
306
+ }
307
+
308
+ // Aplicar patrones de configuraciΓ³n
309
+ for (const pattern of patterns) {
310
+ // Wildcard (*.log, *.test.js)
311
+ if (pattern.includes('*')) {
312
+ if (matchWildcard(pattern, name)) return true;
313
+ }
314
+
315
+ // Directorio (temp/, dist/)
316
+ if (pattern.endsWith('/')) {
317
+ const dir = pattern.slice(0, -1);
318
+ if (fullPath.includes(path.sep + dir + path.sep) ||
319
+ fullPath.includes(dir + path.sep) ||
320
+ name === dir) {
321
+ return true;
322
+ }
323
+ }
324
+
325
+ // Coincidencia exacta o parcial
326
+ if (relativePath.includes(pattern) || name === pattern) {
327
+ return true;
328
+ }
329
+ }
330
+
331
+ return false;
332
+ }
333
+
334
+ function matchWildcard(pattern, filename) {
335
+ // Convertir patrΓ³n glob simple a regex
336
+ const regexPattern = pattern
337
+ .replace(/\./g, '\\.')
338
+ .replace(/\*/g, '.*');
339
+ const regex = new RegExp(`^${regexPattern}$`, 'i');
340
+ return regex.test(filename);
341
+ }
342
+
343
+ function isTextFile(filename) {
344
+ // Extensiones de archivos de texto conocidos
345
+ const textExtensions = [
346
+ '.js', '.ts', '.jsx', '.tsx', '.mjs', '.cjs',
347
+ '.py', '.pyw',
348
+ '.rb', '.rake',
349
+ '.go',
350
+ '.rs',
351
+ '.java', '.kt', '.kts', '.scala',
352
+ '.cs', '.fs', '.vb',
353
+ '.cpp', '.c', '.h', '.hpp', '.cc', '.cxx',
354
+ '.php', '.phtml',
355
+ '.sh', '.bash', '.zsh', '.fish', '.ps1', '.bat', '.cmd',
356
+ '.sql',
357
+ '.html', '.htm', '.xhtml',
358
+ '.css', '.scss', '.sass', '.less', '.styl',
359
+ '.json', '.json5',
360
+ '.xml', '.xsl', '.xslt',
361
+ '.yaml', '.yml',
362
+ '.md', '.markdown', '.mdx',
363
+ '.txt', '.text',
364
+ '.vue', '.svelte',
365
+ '.dockerfile', '.makefile',
366
+ '.toml', '.ini', '.cfg', '.conf',
367
+ '.env', '.env.example',
368
+ '.gitignore', '.gitattributes', '.editorconfig',
369
+ '.eslintrc', '.prettierrc', '.babelrc',
370
+ '.graphql', '.gql',
371
+ '.proto',
372
+ '.tf', '.tfvars',
373
+ '.lua',
374
+ '.r', '.R',
375
+ '.swift',
376
+ '.m', '.mm',
377
+ '.ex', '.exs',
378
+ '.erl', '.hrl',
379
+ '.clj', '.cljs', '.cljc',
380
+ '.hs', '.lhs',
381
+ '.elm',
382
+ '.pug', '.jade',
383
+ '.ejs', '.hbs', '.handlebars',
384
+ '.twig', '.blade.php',
385
+ '.astro',
386
+ '.prisma',
387
+ '.sol'
388
+ ];
389
+
390
+ const ext = path.extname(filename).toLowerCase();
391
+ const basename = path.basename(filename).toLowerCase();
392
+
393
+ // Archivos sin extensiΓ³n pero conocidos
394
+ const knownFiles = [
395
+ 'dockerfile', 'makefile', 'gemfile', 'rakefile',
396
+ 'procfile', 'vagrantfile', 'jenkinsfile',
397
+ '.gitignore', '.gitattributes', '.editorconfig',
398
+ '.eslintrc', '.prettierrc', '.babelrc',
399
+ '.env', '.env.example', '.env.local'
400
+ ];
401
+
402
+ if (knownFiles.includes(basename)) return true;
403
+ if (ext && textExtensions.includes(ext)) return true;
404
+
405
+ return false;
406
+ }
407
+
408
+ function getLanguage(filename) {
409
+ const ext = path.extname(filename).slice(1).toLowerCase();
410
+ const basename = path.basename(filename).toLowerCase();
411
+
412
+ // Archivos especiales
413
+ if (basename === 'dockerfile') return 'dockerfile';
414
+ if (basename === 'makefile') return 'makefile';
415
+ if (basename.startsWith('.env')) return 'bash';
416
+
417
+ return langMap[ext] || ext || 'text';
418
+ }
419
+
420
+ function buildContent(files, config) {
421
+ let content = '';
422
+
423
+ if (config.first_comment) {
424
+ content += config.first_comment + '\n\n';
425
+ }
426
+
427
+ for (const file of files) {
428
+ let fileContent;
429
+ try {
430
+ fileContent = fs.readFileSync(file, 'utf-8');
431
+ } catch (err) {
432
+ console.log(`⚠️ Could not read: ${file}`);
433
+ continue;
434
+ }
435
+
436
+ const lang = getLanguage(file);
437
+ const relativePath = file; // Mantener ruta relativa
438
+
439
+ content += '```' + lang + '\n';
440
+ content += '// ' + relativePath + '\n';
441
+ content += fileContent;
442
+
443
+ // Asegurar que termina con newline
444
+ if (!fileContent.endsWith('\n')) {
445
+ content += '\n';
446
+ }
447
+
448
+ content += '```\n\n';
449
+ }
450
+
451
+ if (config.last_comment) {
452
+ content += config.last_comment;
453
+ }
454
+
455
+ return content;
456
+ }
457
+
458
+ // Ejecutar
459
+ main().catch((err) => {
460
+ console.error('❌ Error:', err.message);
461
+ process.exit(1);
462
+ });
package/favicon.svg ADDED
@@ -0,0 +1,5 @@
1
+ <svg width="164" height="194" viewBox="0 0 164.37044 194.44035" xmlns="http://www.w3.org/2000/svg">
2
+ <g transform="translate(-21.493657,-47.985515)">
3
+ <path fill="#000000" d="m 113.34675,241.91651 c -5.33297,-1.39692 -9.51517,-5.87489 -10.77484,-11.53687 -0.59493,-2.67409 -0.41231,-7.40107 0.38267,-9.90489 1.4657,-4.61629 5.54113,-8.49263 10.32287,-9.81857 2.00394,-0.55568 6.10108,-0.64641 8.28183,-0.18341 4.9645,1.05404 9.38772,5.49662 9.91154,9.95492 l 0.16321,1.38906 h -3.97692 c -3.90279,0 -3.97976,-0.0111 -4.12895,-0.59531 -0.24867,-0.97381 -1.67651,-2.49331 -2.89897,-3.08509 -1.30625,-0.63235 -3.36794,-0.72681 -5.04546,-0.23116 -0.68858,0.20344 -1.59302,0.8227 -2.45963,1.68407 -1.88095,1.86956 -2.58261,4.08851 -2.40386,7.60197 0.18511,3.63824 1.5037,6.07002 4.01399,7.40268 1.4516,0.77062 4.86002,0.81833 6.24276,0.0874 1.34783,-0.7125 2.32814,-1.71547 2.66023,-2.72172 l 0.29122,-0.8824 h 3.90413 c 2.14728,0 3.96671,0.0626 4.04318,0.13904 0.30828,0.30828 -0.41056,2.99948 -1.19584,4.47698 -1.64714,3.09909 -5.08465,5.57698 -8.8411,6.37301 -2.50807,0.53148 -6.13568,0.46754 -8.49206,-0.14969 z m -91.670083,-0.42578 c -0.10066,-0.10065 -0.18301,-7.06652 -0.18301,-15.4797 v -15.29669 l 0.59531,-0.14752 c 0.32742,-0.0811 2.14313,-0.11317 4.0349,-0.0712 l 3.43958,0.0763 0.13229,2.38125 0.1323,2.38125 0.61216,-0.98453 c 0.91799,-1.4764 2.83034,-3.02962 4.50829,-3.66166 1.23843,-0.46648 1.92633,-0.546 4.01961,-0.46467 2.14575,0.0834 2.75365,0.21358 4.04299,0.86592 1.42061,0.71876 3.40238,2.52224 4.08635,3.71872 0.29324,0.51296 0.31226,0.50955 0.75435,-0.13523 0.85821,-1.2517 2.81561,-2.90555 4.30076,-3.63379 1.29782,-0.63638 1.86583,-0.74179 4.44451,-0.8248 2.30796,-0.0743 3.26563,0.007 4.36562,0.37074 2.81769,0.93163 4.76023,2.7248 5.83876,5.38977 0.5898,1.45735 0.59743,1.62992 0.59743,13.51474 v 12.03854 l -3.81618,0.0737 c -2.87439,0.0555 -3.8699,-0.01 -4.03385,-0.26458 -0.11971,-0.18605 -0.20754,-4.68406 -0.19518,-9.99557 0.0237,-10.16592 -0.003,-10.42553 -1.22919,-12.03335 -1.67889,-2.20113 -5.73367,-2.25509 -7.71245,-0.10263 -1.47472,1.60416 -1.52356,1.97145 -1.66628,12.53286 l -0.13229,9.78958 h -3.96875 -3.96875 l -0.13229,-10.18646 c -0.0728,-5.60255 -0.24096,-10.42458 -0.37378,-10.71562 -0.89084,-1.95204 -2.54739,-3.03109 -4.6533,-3.03109 -2.10383,0 -4.24443,1.39018 -5.07469,3.29567 -0.25574,0.58694 -0.38077,3.37896 -0.47985,10.71563 l -0.134,9.92187 -3.98419,0.0728 c -2.19129,0.04 -4.06653,-0.01 -4.16718,-0.11025 z m 52.380881,-0.007 c -0.097,-0.097 -0.17639,-9.7388 -0.17639,-21.4262 v -21.24982 l 0.59531,-0.14752 c 0.32742,-0.0811 2.14313,-0.11317 4.0349,-0.0712 l 3.43958,0.0763 0.0688,11.9724 c 0.0578,10.05253 0.12824,11.97239 0.43924,11.97239 0.40546,0 1.92778,-1.67521 7.27882,-8.00989 l 3.525389,-4.17343 4.39802,0.0724 c 4.299053,0.0708 4.398023,0.0852 4.398023,0.64026 0,0.36501 -1.84299,2.6192 -5.159373,6.31054 -7.125599,7.93119 -6.746249,7.44686 -6.313139,8.06025 0.19801,0.28041 2.800789,3.68153 5.783969,7.55803 6.589093,8.56222 6.169563,7.97708 5.961153,8.31428 -0.10972,0.17753 -1.85853,0.2733 -4.852293,0.26572 l -4.68073,-0.0118 -4.365629,-5.82584 c -5.04564,-6.7333 -5.1452,-6.85046 -5.8213,-6.85046 -0.48761,0 -0.50898,0.25639 -0.50795,6.09303 6e-4,3.35116 -0.0704,6.20866 -0.15774,6.35 -0.17733,0.28692 -7.60648,0.36281 -7.8887,0.0806 z m 70.335062,-0.0786 c -2.45805,-0.64201 -4.31494,-2.23319 -5.21185,-4.46607 -0.57666,-1.4356 -0.60469,-1.86099 -0.68723,-10.42635 l -0.086,-8.92969 h -2.62983 -2.62984 v -3.43958 -3.43958 h 2.63876 2.63876 l 0.0732,-3.90261 0.0732,-3.9026 4.0349,-0.073 4.03489,-0.073 v 3.84335 3.84335 l 2.57969,0.0375 c 2.40776,0.035 3.14052,0.0685 3.96875,0.18187 0.2453,0.0336 0.33073,0.9337 0.33073,3.48484 v 3.43958 h -3.45087 -3.45087 l 0.0774,7.82725 0.0774,7.82726 0.86407,0.7717 c 0.82625,0.73793 0.97424,0.77171 3.38134,0.77171 h 2.51727 l -0.074,3.37343 -0.074,3.37344 -4.10104,0.0423 c -2.25557,0.0233 -4.45823,-0.051 -4.89479,-0.165 z m 11.38505,0.003 c -0.22217,-0.35947 -0.12403,-0.51856 5.15141,-8.35152 2.54661,-3.7812 4.66888,-6.96117 4.71615,-7.06659 0.0473,-0.10543 -2.01975,-3.37451 -4.59337,-7.26462 -2.57362,-3.89011 -4.743,-7.23892 -4.82085,-7.44179 -0.0779,-0.20287 0.0246,-0.47408 0.22774,-0.60269 0.44383,-0.28102 8.18686,-0.31658 8.58848,-0.0394 0.15493,0.10691 1.51769,2.19084 3.02836,4.63094 1.51067,2.4401 2.85797,4.39945 2.994,4.35411 0.13604,-0.0454 1.51534,-2.10133 3.06512,-4.56885 l 2.81778,-4.4864 h 4.06414 c 3.41787,0 4.10612,0.0665 4.32807,0.41841 0.20754,0.32901 -0.74135,1.88351 -4.44138,7.27604 -2.58792,3.7717 -4.75998,7.06049 -4.82681,7.30843 -0.0752,0.27908 1.72122,3.19804 4.71609,7.66295 2.66067,3.96669 4.89022,7.48748 4.95454,7.82398 l 0.11696,0.61182 -4.45842,-0.0727 -4.45843,-0.0727 -2.97184,-4.732 c -1.63451,-2.6026 -3.03232,-4.86479 -3.10625,-5.02708 -0.16406,-0.36019 -0.075,-0.48479 -3.7251,5.21226 l -2.91314,4.54682 -4.14476,0.0728 c -2.56197,0.045 -4.20728,-0.0284 -4.30849,-0.19217 z M 44.350267,189.27332 c -5.8481,-0.85707 -10.63511,-5.4096 -11.88359,-11.3015 -0.57953,-2.73497 -0.57165,-116.084502 0.008,-118.54402 1.26338,-5.35839 5.52827,-9.736089 10.73147,-11.015312 1.55089,-0.381293 5.25197,-0.426973 34.594271,-0.426973 18.071659,0 32.857572,0.07092 32.857572,0.157594 0,0.08668 -0.2529,0.512756 -0.562,0.946843 -0.6433,0.903443 -1.80536,4.038598 -1.81367,4.893194 -0.0148,1.523596 2.49313,1.410702 -31.338992,1.410702 -34.823361,0 -32.783091,-0.112185 -34.992141,1.924048 -0.65329,0.602182 -1.44565,1.576477 -1.76081,2.165101 l -0.57301,1.070226 -0.0685,57.669907 c -0.0755,63.51098 -0.19049,58.96472 1.54527,61.0705 0.44614,0.54124 1.36794,1.31137 2.04845,1.71141 l 1.23729,0.72734 h 58.635103 58.6351 l 1.29333,-0.88257 c 1.40132,-0.95625 2.46812,-2.28564 3.00738,-3.74764 0.27034,-0.73291 0.35636,-7.4371 0.41249,-32.14687 l 0.0709,-31.22083 h 3.66346 3.66346 v 31.61771 31.6177 l -0.58422,1.85209 c -1.70136,5.39363 -6.04873,9.26747 -11.59017,10.32772 -1.74558,0.33399 -9.93989,0.38331 -58.95565,0.35489 -31.310565,-0.0181 -57.537035,-0.12222 -58.281055,-0.23126 z m 17.17524,-27.95225 c -1.29015,-0.457 -2.98235,-2.04859 -3.68853,-3.4692 -0.46361,-0.93265 -0.49654,-2.06727 -0.5654,-19.48559 -0.0815,-20.60599 -0.1087,-20.24409 1.68052,-22.33439 0.53102,-0.62037 1.54349,-1.42085 2.24994,-1.77883 l 1.28444,-0.65088 h 28.529361 28.529352 l 1.43302,0.85989 c 1.5213,0.91287 2.6799,2.35852 3.15138,3.93217 0.19422,0.64826 0.28698,6.85511 0.28698,19.20244 0,20.29337 0.054,19.63441 -1.78559,21.78357 -0.52971,0.61885 -1.56504,1.40547 -2.30074,1.74805 l -1.33763,0.62287 -28.178122,-0.0183 c -24.232671,-0.0157 -28.333661,-0.0734 -29.288981,-0.4118 z m 47.075983,-12.5415 c 0.54228,-0.15061 1.52558,-0.68573 2.18511,-1.18915 0.65952,-0.50343 1.25763,-0.91533 1.32913,-0.91533 0.0715,0 0.13001,0.40815 0.13001,0.90701 0,0.89588 0.017,0.90911 1.38906,1.07939 0.76398,0.0948 1.86531,0.13315 2.44739,0.0852 l 1.05834,-0.0872 v -12.17083 -12.17083 l -2.57969,-0.0757 -2.57969,-0.0757 v 4.26353 4.26354 l -1.0694,-0.91538 c -2.68653,-2.29956 -6.9541,-1.89018 -9.33885,0.89586 -1.2627,1.47517 -1.782898,3.06941 -1.954898,5.99101 -0.158355,2.69001 0.21058,5.1672 1.000048,6.71468 0.61616,1.20778 2.59711,2.97575 3.74709,3.34424 1.15315,0.3695 3.01823,0.39404 4.23635,0.0557 z m -2.28058,-4.77532 c -1.15135,-0.90565 -1.74809,-2.37792 -1.74809,-4.31285 0,-1.99804 0.2967,-2.9238 1.261,-3.93459 1.5488,-1.62346 3.9602,-1.43556 5.46025,0.42545 0.74371,0.92268 0.82669,1.21586 0.89863,3.175 0.0927,2.52326 -0.33864,3.64302 -1.77203,4.60058 -1.19601,0.79899 -3.11538,0.82072 -4.09976,0.0464 z m -40.415623,4.41048 c 0.84231,-0.43558 1.36128,-1.41624 1.36128,-2.5723 0,-1.2091 -1.48961,-2.60692 -2.77812,-2.60692 -0.76055,0 -1.17966,0.2007 -1.87854,0.89958 -2.35294,2.35294 0.31672,5.81996 3.29538,4.27964 z m 9.034201,-5.37413 c 0,-6.06168 0.16311,-7.00628 1.35384,-7.8403 0.69333,-0.48563 2.38896,-0.571 3.15873,-0.15903 1.16194,0.62185 1.30826,1.47587 1.30826,7.63572 v 5.81776 l 1.12448,0.16715 c 0.61847,0.0919 1.71979,0.12899 2.4474,0.0824 l 1.32292,-0.0848 0.13229,-6.30726 0.13229,-6.30726 0.74236,-0.63805 c 0.80125,-0.68867 2.43659,-0.86696 3.37001,-0.36741 1.05716,0.56578 1.17478,1.24148 1.31159,7.53457 l 0.13229,6.08541 h 2.381249 2.38125 l -0.0275,-6.62572 c -0.0291,-7.02408 -0.16451,-8.00327 -1.3208,-9.55265 -0.34172,-0.4579 -1.24333,-1.14251 -2.00357,-1.52136 -2.473759,-1.23272 -5.287839,-0.74746 -6.971699,1.20221 l -0.78896,0.9135 -1.09447,-1.11695 c -2.36818,-2.41684 -5.71637,-2.24745 -8.11785,0.4107 l -0.97414,1.07826 v -1.32368 -1.32368 h -2.38125 -2.381251 v 8.84149 c 0,6.82121 0.0756,8.87388 0.33073,8.98323 0.1819,0.078 1.25346,0.12306 2.381251,0.10023 l 2.05052,-0.0415 z m 58.982052,-23.77069 c -0.63842,-0.67907 -0.6418,-0.71305 -0.72037,-7.25254 l -0.0789,-6.57027 -4.0221,-0.0975 c -3.86024,-0.0936 -4.09385,-0.13104 -5.80477,-0.93146 -3.44338,-1.61092 -5.94305,-4.808188 -6.49101,-8.302509 -0.12542,-0.799817 -0.19897,-9.872256 -0.16343,-20.160977 0.0569,-16.48141 0.11664,-18.887862 0.50205,-20.229106 0.78988,-2.748799 2.7626,-5.195638 5.18542,-6.43167 2.62508,-1.339215 1.53658,-1.287738 27.55971,-1.303344 13.42133,-0.008 24.81914,0.08832 25.32846,0.214156 2.54886,0.629722 5.73953,3.010515 7.06443,5.271282 0.36843,0.62868 0.89419,1.863775 1.16835,2.744655 0.46844,1.505102 0.49847,2.728663 0.49847,20.307854 0,20.358838 0.002,20.326239 -1.50752,23.099966 -0.97246,1.786723 -3.19153,3.791993 -5.30324,4.792293 l -1.7882,0.84705 -11.03071,0.13229 -11.03071,0.13229 -4.56404,4.10104 c -12.67712,11.39108 -11.33614,10.31875 -12.90392,10.31875 -1.00826,0 -1.38322,-0.13479 -1.89793,-0.68227 z m 3.48817,-30.075543 1.21122,-3.241146 5.66396,-0.06525 5.66397,-0.06525 1.19062,3.240254 1.19063,3.240253 3.50573,0.07382 c 2.87321,0.06051 3.50573,0.0066 3.50573,-0.298766 0,-0.204925 -0.78254,-2.440803 -1.73896,-4.968617 -0.95643,-2.527814 -3.44756,-9.1204 -5.53583,-14.650191 -2.08828,-5.529791 -3.87955,-10.265709 -3.9806,-10.524262 -0.16588,-0.424397 -0.54488,-0.462978 -3.89866,-0.396875 l -3.71492,0.07322 -1.57321,4.101041 c -0.86527,2.255573 -2.4379,6.363229 -3.49474,9.128125 -1.05684,2.764896 -2.90405,7.586927 -4.10491,10.715624 -1.20086,3.128698 -2.24269,5.956432 -2.31516,6.283854 -0.13174,0.5951 -0.13047,0.595313 3.54106,0.595313 h 3.67285 z m 3.78452,-11.641666 c 0.48389,-1.346068 1.3304,-3.732923 1.88112,-5.304122 0.55072,-1.5712 1.08864,-2.761825 1.19539,-2.645834 0.21614,0.234863 3.69374,9.809065 3.69374,10.169267 0,0.125446 -1.72126,0.228085 -3.82503,0.228085 h -3.82503 z m 29.25984,-0.727604 c 0,-14.682892 -0.0275,-15.61163 -0.46302,-15.630845 -2.65965,-0.117346 -5.11815,-0.130692 -5.82084,-0.0316 l -0.85989,0.121266 v 15.575797 15.575798 h 3.57187 3.57188 z"/>
4
+ </g>
5
+ </svg>
package/package.json CHANGED
@@ -1,45 +1,57 @@
1
- {
2
- "name": "mkctx",
3
- "version": "1.0.3",
4
- "description": "Tool to generate project context in markdown for AI assistants",
5
- "main": "index.js",
6
- "scripts": {
7
- "build": "node -e \"console.log('Use build.ps1 on Windows or build.sh on Unix')\"",
8
- "build:windows": "powershell -ExecutionPolicy Bypass -File build.ps1",
9
- "build:unix": "chmod +x build.sh && ./build.sh",
10
- "prepublishOnly": "npm run build:windows || npm run build:unix || echo 'Build failed - manual build required'",
11
- "install": "node install.js"
12
- },
13
- "keywords": [
14
- "context",
15
- "markdown",
16
- "documentation",
17
- "ai",
18
- "prompt",
19
- "code-context"
20
- ],
21
- "author": "Your Name",
22
- "license": "MIT",
23
- "bin": {
24
- "mkctx": "./bin/mkctx.exe"
25
- },
26
- "files": [
27
- "bin/",
28
- "install.js",
29
- "build.ps1",
30
- "build.sh",
31
- "README.md"
32
- ],
33
- "engines": {
34
- "node": ">=14.0.0"
35
- },
36
- "os": [
37
- "darwin",
38
- "linux",
39
- "win32"
40
- ],
41
- "cpu": [
42
- "x64",
43
- "arm64"
44
- ]
45
- }
1
+ {
2
+ "name": "mkctx",
3
+ "version": "2.0.0",
4
+ "description": "Generate markdown context files from your project code for AI assistants",
5
+ "main": "bin/mkctx.js",
6
+ "bin": {
7
+ "mkctx": "./bin/mkctx.js"
8
+ },
9
+ "scripts": {
10
+ "start": "node bin/mkctx.js",
11
+ "config": "node bin/mkctx.js config",
12
+ "test": "node bin/mkctx.js --help",
13
+ "prepublishOnly": "node bin/mkctx.js --version",
14
+ "release:patch": "npm version patch && npm publish",
15
+ "release:minor": "npm version minor && npm publish",
16
+ "release:major": "npm version major && npm publish",
17
+ "deploy": "npm publish",
18
+ "deploy:dry": "npm publish --dry-run"
19
+ },
20
+ "keywords": [
21
+ "context",
22
+ "markdown",
23
+ "documentation",
24
+ "ai",
25
+ "llm",
26
+ "chatgpt",
27
+ "claude",
28
+ "prompt",
29
+ "code-context",
30
+ "code-documentation",
31
+ "project-context"
32
+ ],
33
+ "author": "Your Name <your.email@example.com>",
34
+ "license": "MIT",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/yourusername/mkctx.git"
38
+ },
39
+ "bugs": {
40
+ "url": "https://github.com/yourusername/mkctx/issues"
41
+ },
42
+ "homepage": "https://github.com/yourusername/mkctx#readme",
43
+ "files": [
44
+ "bin/",
45
+ "README.md",
46
+ "LICENSE",
47
+ "favicon.svg"
48
+ ],
49
+ "engines": {
50
+ "node": ">=14.0.0"
51
+ },
52
+ "os": [
53
+ "darwin",
54
+ "linux",
55
+ "win32"
56
+ ]
57
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/build.ps1 DELETED
@@ -1,74 +0,0 @@
1
- # build.ps1 - Build script for Windows PowerShell
2
-
3
- Write-Host "Building mkctx for all platforms..." -ForegroundColor Green
4
-
5
- # Create directory structure
6
- $platforms = @("win32", "darwin", "linux")
7
- $archs = @("x64", "arm64")
8
-
9
- foreach ($platform in $platforms) {
10
- foreach ($arch in $archs) {
11
- $dir = "bin/$platform/$arch"
12
- Write-Host "Creating directory: $dir"
13
- New-Item -ItemType Directory -Force -Path $dir | Out-Null
14
- }
15
- }
16
-
17
- # Build for each platform
18
- Write-Host "Building for Windows x64..." -ForegroundColor Yellow
19
- $env:GOOS = "windows"
20
- $env:GOARCH = "amd64"
21
- go build -o bin/win32/x64/mkctx.exe main.go
22
- if ($LASTEXITCODE -ne 0) {
23
- Write-Host "Failed to build for Windows x64" -ForegroundColor Red
24
- }
25
-
26
- Write-Host "Building for Windows ARM64..." -ForegroundColor Yellow
27
- $env:GOOS = "windows"
28
- $env:GOARCH = "arm64"
29
- go build -o bin/win32/arm64/mkctx.exe main.go
30
- if ($LASTEXITCODE -ne 0) {
31
- Write-Host "Failed to build for Windows ARM64" -ForegroundColor Red
32
- }
33
-
34
- Write-Host "Building for macOS x64..." -ForegroundColor Yellow
35
- $env:GOOS = "darwin"
36
- $env:GOARCH = "amd64"
37
- go build -o bin/darwin/x64/mkctx main.go
38
- if ($LASTEXITCODE -ne 0) {
39
- Write-Host "Failed to build for macOS x64" -ForegroundColor Red
40
- }
41
-
42
- Write-Host "Building for macOS ARM64..." -ForegroundColor Yellow
43
- $env:GOOS = "darwin"
44
- $env:GOARCH = "arm64"
45
- go build -o bin/darwin/arm64/mkctx main.go
46
- if ($LASTEXITCODE -ne 0) {
47
- Write-Host "Failed to build for macOS ARM64" -ForegroundColor Red
48
- }
49
-
50
- Write-Host "Building for Linux x64..." -ForegroundColor Yellow
51
- $env:GOOS = "linux"
52
- $env:GOARCH = "amd64"
53
- go build -o bin/linux/x64/mkctx main.go
54
- if ($LASTEXITCODE -ne 0) {
55
- Write-Host "Failed to build for Linux x64" -ForegroundColor Red
56
- }
57
-
58
- Write-Host "Building for Linux ARM64..." -ForegroundColor Yellow
59
- $env:GOOS = "linux"
60
- $env:GOARCH = "arm64"
61
- go build -o bin/linux/arm64/mkctx main.go
62
- if ($LASTEXITCODE -ne 0) {
63
- Write-Host "Failed to build for Linux ARM64" -ForegroundColor Red
64
- }
65
-
66
- Write-Host "Build completed!" -ForegroundColor Green
67
-
68
- # Verify created files
69
- Write-Host "Files created:" -ForegroundColor Cyan
70
- if (Test-Path "bin") {
71
- Get-ChildItem -Recurse "bin" | ForEach-Object { Write-Host " - $($_.FullName)" }
72
- } else {
73
- Write-Host " No bin directory found" -ForegroundColor Red
74
- }
package/build.sh DELETED
@@ -1,41 +0,0 @@
1
- #!/bin/bash
2
- # build.sh - Script de compilaciΓ³n para Linux/macOS
3
-
4
- echo "πŸ”¨ Building mkctx for all platforms..."
5
-
6
- # Crear estructura de directorios
7
- platforms=("win32" "darwin" "linux")
8
- archs=("x64" "arm64")
9
-
10
- for platform in "${platforms[@]}"; do
11
- for arch in "${archs[@]}"; do
12
- mkdir -p "bin/$platform/$arch"
13
- done
14
- done
15
-
16
- # Compilar para cada plataforma
17
- echo "Building for Windows x64..."
18
- GOOS=windows GOARCH=amd64 go build -o bin/win32/x64/mkctx.exe main.go
19
-
20
- echo "Building for Windows ARM64..."
21
- GOOS=windows GOARCH=arm64 go build -o bin/win32/arm64/mkctx.exe main.go
22
-
23
- echo "Building for macOS x64..."
24
- GOOS=darwin GOARCH=amd64 go build -o bin/darwin/x64/mkctx main.go
25
-
26
- echo "Building for macOS ARM64..."
27
- GOOS=darwin GOARCH=arm64 go build -o bin/darwin/arm64/mkctx main.go
28
-
29
- echo "Building for Linux x64..."
30
- GOOS=linux GOARCH=amd64 go build -o bin/linux/x64/mkctx main.go
31
-
32
- echo "Building for Linux ARM64..."
33
- GOOS=linux GOARCH=arm64 go build -o bin/linux/arm64/mkctx main.go
34
-
35
- echo "βœ… Build completed!"
36
-
37
- # Verificar archivos creados
38
- echo "πŸ“ Files created:"
39
- find bin/ -type f | while read file; do
40
- echo " - $file"
41
- done
package/install.js DELETED
@@ -1,166 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const { execSync } = require("child_process");
4
-
5
- function install() {
6
- const platform = process.platform;
7
- const arch = process.arch;
8
- const isWindows = platform === "win32";
9
-
10
- const binaryName = isWindows ? "mkctx.exe" : "mkctx";
11
-
12
- // Determinar la ruta del binario precompilado
13
- let binaryPath;
14
-
15
- if (platform === "win32") {
16
- binaryPath = path.join(__dirname, "bin", "win32", arch, "mkctx.exe");
17
- } else if (platform === "darwin") {
18
- binaryPath = path.join(__dirname, "bin", "darwin", arch, "mkctx");
19
- } else if (platform === "linux") {
20
- binaryPath = path.join(__dirname, "bin", "linux", arch, "mkctx");
21
- } else {
22
- console.log("❌ Unsupported platform:", platform);
23
- return;
24
- }
25
-
26
- // Verificar que el binario precompilado existe
27
- if (!fs.existsSync(binaryPath)) {
28
- console.log(
29
- "❌ Precompiled binary not found for your platform:",
30
- binaryPath
31
- );
32
- console.log("πŸ“‹ Available platforms: win32, darwin, linux");
33
- console.log("πŸ“‹ Available architectures: x64, arm64");
34
- return;
35
- }
36
-
37
- try {
38
- // MΓ©todo 1: Usar npm para obtener el directorio global de bins
39
- let npmGlobalBin;
40
- try {
41
- npmGlobalBin = execSync("npm bin -g").toString().trim();
42
- } catch (error) {
43
- // Alternative method to get global bin directory
44
- npmGlobalBin = execSync("npm root -g").toString().trim();
45
- npmGlobalBin = path.join(npmGlobalBin, ".bin");
46
- }
47
-
48
- const installPath = path.join(npmGlobalBin, binaryName);
49
-
50
- console.log(`πŸ“¦ Installing mkctx at: ${installPath}`);
51
-
52
- // Ensure the directory exists
53
- if (!fs.existsSync(npmGlobalBin)) {
54
- fs.mkdirSync(npmGlobalBin, { recursive: true });
55
- }
56
-
57
- // Copy the precompiled binary
58
- fs.copyFileSync(binaryPath, installPath);
59
-
60
- // Set execution permissions (Unix only)
61
- if (!isWindows) {
62
- fs.chmodSync(installPath, 0o755);
63
- }
64
-
65
- console.log("βœ… mkctx installed successfully");
66
-
67
- // Create a .cmd wrapper for Windows
68
- if (isWindows) {
69
- createWindowsWrapper(npmGlobalBin, installPath);
70
- }
71
-
72
- return;
73
- } catch (error) {
74
- console.log(
75
- "⚠️ npm method failed, trying alternative method...",
76
- error.message
77
- );
78
- }
79
-
80
- // Alternative method: Search common PATH directories
81
- const alternativePaths = getAlternativePaths();
82
-
83
- for (const altPath of alternativePaths) {
84
- try {
85
- if (fs.existsSync(altPath)) {
86
- const altInstallPath = path.join(altPath, binaryName);
87
- console.log(`πŸ”„ Trying to install at: ${altInstallPath}`);
88
-
89
- fs.copyFileSync(binaryPath, altInstallPath);
90
-
91
- // Set execution permissions (Unix only)
92
- if (!isWindows) {
93
- fs.chmodSync(altInstallPath, 0o755);
94
- }
95
-
96
- // Create Windows wrapper if needed
97
- if (isWindows) {
98
- createWindowsWrapper(altPath, altInstallPath);
99
- }
100
-
101
- console.log(`βœ… mkctx installed at: ${altInstallPath}`);
102
- return;
103
- }
104
- } catch (e) {
105
- console.log(` ❌ Installation failed at ${altPath}: ${e.message}`);
106
- }
107
- }
108
-
109
- console.log("❌ Could not install automatically");
110
- console.log("πŸ“‹ Manual installation required:");
111
- console.log(` 1. Copy the file '${binaryPath}' to a folder in your PATH`);
112
- }
113
-
114
- function createWindowsWrapper(installDir, binaryPath) {
115
- const wrapperPath = path.join(installDir, "mkctx.cmd");
116
- const wrapperContent = `@echo off
117
- "${binaryPath}" %*
118
- `;
119
- fs.writeFileSync(wrapperPath, wrapperContent);
120
- console.log(`βœ… Created Windows wrapper: ${wrapperPath}`);
121
- }
122
-
123
- function getAlternativePaths() {
124
- const paths = [];
125
- const isWindows = process.platform === "win32";
126
-
127
- if (isWindows) {
128
- if (process.env.APPDATA) {
129
- paths.push(path.join(process.env.APPDATA, "npm"));
130
- }
131
- if (process.env.LOCALAPPDATA) {
132
- paths.push(
133
- path.join(process.env.LOCALAPPDATA, "Microsoft", "WindowsApps")
134
- );
135
- }
136
- if (process.env.ProgramFiles) {
137
- paths.push(path.join(process.env.ProgramFiles, "nodejs"));
138
- }
139
- paths.push("C:\\Program Files\\nodejs");
140
- paths.push("C:\\Program Files (x86)\\nodejs");
141
-
142
- if (process.env.USERPROFILE) {
143
- paths.push(
144
- path.join(process.env.USERPROFILE, "AppData", "Roaming", "npm")
145
- );
146
- }
147
- } else {
148
- paths.push("/usr/local/bin");
149
- paths.push("/usr/bin");
150
- paths.push("/opt/local/bin");
151
-
152
- if (process.env.HOME) {
153
- paths.push(path.join(process.env.HOME, "bin"));
154
- paths.push(path.join(process.env.HOME, ".local", "bin"));
155
- }
156
-
157
- if (process.platform === "darwin") {
158
- paths.push("/opt/homebrew/bin");
159
- paths.push("/usr/local/opt/bin");
160
- }
161
- }
162
-
163
- return paths.filter((p) => p !== null && p !== undefined);
164
- }
165
-
166
- install();