mkprompt 1.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
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 ADDED
@@ -0,0 +1,273 @@
1
+ <p align="center">
2
+ <img src="favicon.svg" alt="mkprompt logo" width="120" height="120">
3
+ </p>
4
+
5
+ # mkprompt - Dynamic Prompt Generator
6
+
7
+ A powerful command-line tool that generates dynamic prompts with variable substitution, perfect for AI assistants and templating workflows.
8
+
9
+ [![npm version](https://img.shields.io/npm/v/mkprompt.svg)](https://www.npmjs.com/package/mkprompt)
10
+ [![npm downloads](https://img.shields.io/npm/dm/mkprompt.svg)](https://www.npmjs.com/package/mkprompt)
11
+ [![license](https://img.shields.io/npm/l/mkprompt.svg)](https://github.com/yourusername/mkprompt/blob/main/LICENSE)
12
+
13
+ ## Features
14
+
15
+ * 🚀 **Interactive CLI** - Select prompts and fill variables interactively
16
+ * 📝 **Dynamic Variables** - Use `<?variable_name?>` syntax for templating
17
+ * ⚙️ **Configurable** - Customize paths, comments, and output settings
18
+ * 🎯 **AI-Friendly** - Generate prompts ready for ChatGPT, Claude, and others
19
+ * 🔧 **Zero Dependencies** - Pure Node.js, no external dependencies
20
+ * 📁 **Organized Output** - Timestamped files for easy tracking
21
+ * 🎨 **Beautiful CLI** - Colorful and intuitive interface
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ npm install -g mkprompt
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ### Initialize mkprompt in your project
32
+
33
+ ```bash
34
+ mkprompt config
35
+ ```
36
+
37
+ This creates:
38
+ - `mkprompt.config.json` - Configuration file
39
+ - `prompts/` - Directory for your prompt templates
40
+ - `mkprompt/` - Output directory (added to .gitignore)
41
+ - An example prompt template
42
+
43
+ ### Generate a prompt
44
+
45
+ ```bash
46
+ mkprompt
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ ### Basic Flow
52
+
53
+ 1. **Run mkprompt** in your project directory
54
+ 2. **Select a prompt** from your templates
55
+ 3. **Fill in the variables** when prompted
56
+ 4. **Get your generated prompt** in the `mkprompt/` directory
57
+
58
+ ### Example Session
59
+
60
+ ```
61
+ $ mkprompt
62
+
63
+ 📝 Available Prompts
64
+
65
+ 1) code-review.txt
66
+ 2) documentation.txt
67
+ 3) refactor.txt
68
+
69
+ ? Select a prompt (1-3): 1
70
+
71
+ ✓ Selected: code-review.txt
72
+
73
+ ℹ Found 3 variable(s): language, framework, focus_area
74
+
75
+ 📋 Fill in the variables
76
+
77
+ ? language: TypeScript
78
+ ? framework: NestJS
79
+ ? focus_area: performance optimization
80
+
81
+ ✨ Prompt generated successfully!
82
+ ✓ Output: mkprompt/code-review_2025-01-15_14-30-45.txt
83
+ ```
84
+
85
+ ## Variable Syntax
86
+
87
+ Use `<?variable_name?>` in your prompt templates:
88
+
89
+ ```
90
+ You are an expert in <?programming_language?>.
91
+
92
+ The project is called <?project_name?> and uses <?framework?>.
93
+
94
+ Please help with:
95
+ <?task_description?>
96
+
97
+ Focus on:
98
+ - <?focus_area_1?>
99
+ - <?focus_area_2?>
100
+ ```
101
+
102
+ ### Variable Naming
103
+
104
+ - Use underscores for multi-word variables: `<?user_name?>`
105
+ - Variables are displayed with spaces: `user name`
106
+ - Same variable can appear multiple times (only asked once)
107
+
108
+ ## Configuration
109
+
110
+ The `mkprompt.config.json` file:
111
+
112
+ ```json
113
+ {
114
+ "prompts_path": "./prompts",
115
+ "first_comment": "/* Prompt Generated by mkprompt */",
116
+ "last_comment": "/* End of Prompt */"
117
+ }
118
+ ```
119
+
120
+ | Option | Description | Default |
121
+ |--------|-------------|---------|
122
+ | `prompts_path` | Directory containing prompt templates | `"./prompts"` |
123
+ | `first_comment` | Comment added at the beginning | `"/* Prompt Generated by mkprompt */"` |
124
+ | `last_comment` | Comment added at the end | `"/* End of Prompt */"` |
125
+
126
+ ## Output Format
127
+
128
+ Generated prompts are saved as:
129
+
130
+ ```
131
+ mkprompt/
132
+ └── promptname_YYYY-MM-DD_HH-MM-SS.txt
133
+ ```
134
+
135
+ Example output:
136
+
137
+ ```
138
+ /* Prompt Generated by mkprompt */
139
+
140
+ You are an expert in TypeScript.
141
+
142
+ The project is called MyApp and uses NestJS.
143
+
144
+ Please help with:
145
+ Optimize database queries for better performance
146
+
147
+ Focus on:
148
+ - Query efficiency
149
+ - Caching strategies
150
+
151
+ /* End of Prompt */
152
+ ```
153
+
154
+ ## Example Prompts
155
+
156
+ ### Code Review Prompt
157
+
158
+ ```
159
+ You are a senior <?language?> developer reviewing code.
160
+
161
+ Project: <?project_name?>
162
+ Framework: <?framework?>
163
+
164
+ Review the following code focusing on:
165
+ - <?focus_area?>
166
+ - Best practices
167
+ - Potential bugs
168
+
169
+ Code to review:
170
+ <?code_snippet?>
171
+ ```
172
+
173
+ ### Documentation Prompt
174
+
175
+ ```
176
+ Generate documentation for a <?type?> in <?language?>.
177
+
178
+ Component name: <?component_name?>
179
+ Purpose: <?purpose?>
180
+
181
+ Include:
182
+ - Description
183
+ - Parameters/Props
184
+ - Usage examples
185
+ - <?additional_sections?>
186
+ ```
187
+
188
+ ### Refactoring Prompt
189
+
190
+ ```
191
+ Refactor the following <?language?> code.
192
+
193
+ Current implementation:
194
+ <?current_code?>
195
+
196
+ Goals:
197
+ - <?goal_1?>
198
+ - <?goal_2?>
199
+
200
+ Constraints:
201
+ - Maintain backward compatibility with <?api_version?>
202
+ - Follow <?style_guide?> guidelines
203
+ ```
204
+
205
+ ## Commands
206
+
207
+ | Command | Description |
208
+ |---------|-------------|
209
+ | `mkprompt` | Interactive prompt generation |
210
+ | `mkprompt config` | Create configuration and directories |
211
+ | `mkprompt help` | Show help message |
212
+ | `mkprompt --version` | Show version |
213
+
214
+ ## Directory Structure
215
+
216
+ After running `mkprompt config`:
217
+
218
+ ```
219
+ your-project/
220
+ ├── mkprompt.config.json # Configuration
221
+ ├── prompts/ # Your prompt templates
222
+ │ └── example.txt # Example template
223
+ ├── mkprompt/ # Generated outputs (gitignored)
224
+ │ └── example_2025-01-15_14-30-45.txt
225
+ └── .gitignore # Updated with mkprompt/
226
+ ```
227
+
228
+ ## Use Cases
229
+
230
+ - **AI Pair Programming** - Generate consistent prompts for code assistance
231
+ - **Documentation** - Create templated requests for doc generation
232
+ - **Code Reviews** - Standardize review request prompts
233
+ - **Onboarding** - Create repeatable prompts for common tasks
234
+ - **Team Workflows** - Share prompt templates across your team
235
+
236
+ ## Platform Support
237
+
238
+ - ✅ **Windows** - Full support
239
+ - ✅ **macOS** - Full support
240
+ - ✅ **Linux** - Full support
241
+
242
+ ## Requirements
243
+
244
+ - **Node.js** 14.0+
245
+ - **npm** (for installation)
246
+
247
+ ## Troubleshooting
248
+
249
+ ### Command not found
250
+
251
+ 1. Ensure npm global bin is in your PATH
252
+ 2. Try: `npm bin -g` to see installation location
253
+ 3. Restart your terminal
254
+
255
+ ### Permission errors (Unix)
256
+
257
+ ```bash
258
+ sudo npm install -g mkprompt
259
+ ```
260
+
261
+ Or fix npm permissions: https://docs.npmjs.com/resolving-eacces-permissions-errors
262
+
263
+ ## Contributing
264
+
265
+ Contributions are welcome! Please feel free to submit pull requests or open issues.
266
+
267
+ ## License
268
+
269
+ MIT License - see [LICENSE](LICENSE) file for details.
270
+
271
+ ## Related Projects
272
+
273
+ - [mkctx](https://github.com/David200197/mkctx) - Generate markdown context from your codebase
@@ -0,0 +1,420 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const readline = require('readline');
6
+
7
+ // ============================================================================
8
+ // Constants
9
+ // ============================================================================
10
+
11
+ const CONFIG_FILE = 'mkprompt.config.json';
12
+ const OUTPUT_DIR = 'mkprompt';
13
+ const VARIABLE_REGEX = /<\?([^?]+)\?>/g;
14
+
15
+ const DEFAULT_CONFIG = {
16
+ prompts_path: './prompts',
17
+ first_comment: '/* Prompt Generated by mkprompt */',
18
+ last_comment: '/* End of Prompt */'
19
+ };
20
+
21
+ // ============================================================================
22
+ // ANSI Colors
23
+ // ============================================================================
24
+
25
+ const colors = {
26
+ reset: '\x1b[0m',
27
+ bright: '\x1b[1m',
28
+ dim: '\x1b[2m',
29
+ green: '\x1b[32m',
30
+ yellow: '\x1b[33m',
31
+ blue: '\x1b[34m',
32
+ magenta: '\x1b[35m',
33
+ cyan: '\x1b[36m',
34
+ red: '\x1b[31m'
35
+ };
36
+
37
+ const log = {
38
+ info: (msg) => console.log(`${colors.cyan}ℹ${colors.reset} ${msg}`),
39
+ success: (msg) => console.log(`${colors.green}✓${colors.reset} ${msg}`),
40
+ warn: (msg) => console.log(`${colors.yellow}⚠${colors.reset} ${msg}`),
41
+ error: (msg) => console.log(`${colors.red}✗${colors.reset} ${msg}`),
42
+ prompt: (msg) => process.stdout.write(`${colors.magenta}?${colors.reset} ${msg}`),
43
+ title: (msg) => console.log(`\n${colors.bright}${colors.blue}${msg}${colors.reset}\n`)
44
+ };
45
+
46
+ // ============================================================================
47
+ // Readline Interface
48
+ // ============================================================================
49
+
50
+ function createReadlineInterface() {
51
+ return readline.createInterface({
52
+ input: process.stdin,
53
+ output: process.stdout
54
+ });
55
+ }
56
+
57
+ function askQuestion(rl, question) {
58
+ return new Promise((resolve) => {
59
+ rl.question(`${colors.magenta}?${colors.reset} ${question}`, (answer) => {
60
+ resolve(answer);
61
+ });
62
+ });
63
+ }
64
+
65
+ // ============================================================================
66
+ // Config Management
67
+ // ============================================================================
68
+
69
+ function loadConfig() {
70
+ const configPath = path.join(process.cwd(), CONFIG_FILE);
71
+
72
+ if (fs.existsSync(configPath)) {
73
+ try {
74
+ const content = fs.readFileSync(configPath, 'utf8');
75
+ return JSON.parse(content);
76
+ } catch (error) {
77
+ log.error(`Error reading config file: ${error.message}`);
78
+ return DEFAULT_CONFIG;
79
+ }
80
+ }
81
+
82
+ return null;
83
+ }
84
+
85
+ function createConfig() {
86
+ const configPath = path.join(process.cwd(), CONFIG_FILE);
87
+ const outputPath = path.join(process.cwd(), OUTPUT_DIR);
88
+ const promptsPath = path.join(process.cwd(), 'prompts');
89
+
90
+ // Create config file
91
+ fs.writeFileSync(configPath, JSON.stringify(DEFAULT_CONFIG, null, 2));
92
+ log.success(`Created ${CONFIG_FILE}`);
93
+
94
+ // Create output directory
95
+ if (!fs.existsSync(outputPath)) {
96
+ fs.mkdirSync(outputPath, { recursive: true });
97
+ log.success(`Created ${OUTPUT_DIR}/ directory`);
98
+ }
99
+
100
+ // Create prompts directory
101
+ if (!fs.existsSync(promptsPath)) {
102
+ fs.mkdirSync(promptsPath, { recursive: true });
103
+ log.success(`Created prompts/ directory`);
104
+
105
+ // Create example prompt
106
+ const examplePrompt = `You are a helpful assistant specialized in <?specialty?>.
107
+
108
+ The user's name is <?user_name?> and they are working on a project called <?project_name?>.
109
+
110
+ Please help them with the following task:
111
+ <?task_description?>
112
+
113
+ Requirements:
114
+ - Language: <?programming_language?>
115
+ - Framework: <?framework?>
116
+
117
+ Additional context:
118
+ <?additional_context?>
119
+ `;
120
+
121
+ fs.writeFileSync(path.join(promptsPath, 'example.txt'), examplePrompt);
122
+ log.success('Created example prompt: prompts/example.txt');
123
+ }
124
+
125
+ // Update .gitignore
126
+ updateGitignore();
127
+
128
+ return DEFAULT_CONFIG;
129
+ }
130
+
131
+ function updateGitignore() {
132
+ const gitignorePath = path.join(process.cwd(), '.gitignore');
133
+ const entriesToAdd = [OUTPUT_DIR + '/'];
134
+
135
+ let content = '';
136
+ if (fs.existsSync(gitignorePath)) {
137
+ content = fs.readFileSync(gitignorePath, 'utf8');
138
+ }
139
+
140
+ const lines = content.split('\n').map(l => l.trim());
141
+ const toAdd = entriesToAdd.filter(entry => !lines.includes(entry));
142
+
143
+ if (toAdd.length > 0) {
144
+ const newContent = content.trim() + '\n\n# mkprompt output\n' + toAdd.join('\n') + '\n';
145
+ fs.writeFileSync(gitignorePath, newContent);
146
+ log.success(`Updated .gitignore with ${OUTPUT_DIR}/`);
147
+ }
148
+ }
149
+
150
+ // ============================================================================
151
+ // Prompt Management
152
+ // ============================================================================
153
+
154
+ function getPromptFiles(promptsPath) {
155
+ const fullPath = path.resolve(process.cwd(), promptsPath);
156
+
157
+ if (!fs.existsSync(fullPath)) {
158
+ return [];
159
+ }
160
+
161
+ return fs.readdirSync(fullPath)
162
+ .filter(file => {
163
+ const filePath = path.join(fullPath, file);
164
+ const stat = fs.statSync(filePath);
165
+ return stat.isFile() && !file.startsWith('.');
166
+ })
167
+ .sort();
168
+ }
169
+
170
+ function extractVariables(content) {
171
+ const variables = [];
172
+ const seen = new Set();
173
+ let match;
174
+
175
+ while ((match = VARIABLE_REGEX.exec(content)) !== null) {
176
+ const varName = match[1].trim();
177
+ if (!seen.has(varName)) {
178
+ seen.add(varName);
179
+ variables.push(varName);
180
+ }
181
+ }
182
+
183
+ return variables;
184
+ }
185
+
186
+ function replaceVariables(content, values) {
187
+ let result = content;
188
+
189
+ for (const [varName, value] of Object.entries(values)) {
190
+ const regex = new RegExp(`<\\?${escapeRegex(varName)}\\?>`, 'g');
191
+ result = result.replace(regex, value);
192
+ }
193
+
194
+ return result;
195
+ }
196
+
197
+ function escapeRegex(string) {
198
+ return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
199
+ }
200
+
201
+ function formatDate() {
202
+ const now = new Date();
203
+ const year = now.getFullYear();
204
+ const month = String(now.getMonth() + 1).padStart(2, '0');
205
+ const day = String(now.getDate()).padStart(2, '0');
206
+ const hours = String(now.getHours()).padStart(2, '0');
207
+ const minutes = String(now.getMinutes()).padStart(2, '0');
208
+ const seconds = String(now.getSeconds()).padStart(2, '0');
209
+
210
+ return `${year}-${month}-${day}_${hours}-${minutes}-${seconds}`;
211
+ }
212
+
213
+ function getOutputFilename(originalName) {
214
+ const ext = path.extname(originalName);
215
+ const baseName = path.basename(originalName, ext);
216
+ const date = formatDate();
217
+
218
+ return `${baseName}_${date}${ext || '.md'}`;
219
+ }
220
+
221
+ // ============================================================================
222
+ // Main Flow
223
+ // ============================================================================
224
+
225
+ async function selectPrompt(rl, prompts) {
226
+ log.title('📝 Available Prompts');
227
+
228
+ prompts.forEach((prompt, index) => {
229
+ console.log(` ${colors.cyan}${index + 1}${colors.reset}) ${prompt}`);
230
+ });
231
+
232
+ console.log();
233
+
234
+ while (true) {
235
+ const answer = await askQuestion(rl, `Select a prompt (1-${prompts.length}): `);
236
+ const index = parseInt(answer, 10) - 1;
237
+
238
+ if (index >= 0 && index < prompts.length) {
239
+ return prompts[index];
240
+ }
241
+
242
+ log.error(`Invalid selection. Please enter a number between 1 and ${prompts.length}`);
243
+ }
244
+ }
245
+
246
+ async function fillVariables(rl, variables) {
247
+ log.title('📋 Fill in the variables');
248
+
249
+ const values = {};
250
+
251
+ for (const varName of variables) {
252
+ const displayName = varName.replace(/_/g, ' ');
253
+ const answer = await askQuestion(rl, `${colors.yellow}${displayName}${colors.reset}: `);
254
+ values[varName] = answer;
255
+ }
256
+
257
+ return values;
258
+ }
259
+
260
+ async function main() {
261
+ const args = process.argv.slice(2);
262
+
263
+ // Handle help command
264
+ if (args.includes('--help') || args.includes('-h') || args.includes('help')) {
265
+ showHelp();
266
+ return;
267
+ }
268
+
269
+ // Handle config command
270
+ if (args.includes('config')) {
271
+ log.title('⚙️ Creating mkprompt configuration');
272
+ createConfig();
273
+ log.info('\nEdit prompts/ directory to add your prompt templates.');
274
+ log.info('Use <?variable_name?> syntax for dynamic variables.');
275
+ return;
276
+ }
277
+
278
+ // Handle version command
279
+ if (args.includes('--version') || args.includes('-v')) {
280
+ const pkg = require('../package.json');
281
+ console.log(`mkprompt v${pkg.version}`);
282
+ return;
283
+ }
284
+
285
+ // Load or create config
286
+ let config = loadConfig();
287
+
288
+ if (!config) {
289
+ log.title('🚀 Welcome to mkprompt!');
290
+ log.info('No configuration found. Creating default config...\n');
291
+ config = createConfig();
292
+ console.log();
293
+ }
294
+
295
+ // Ensure output directory exists
296
+ const outputDir = path.join(process.cwd(), OUTPUT_DIR);
297
+ if (!fs.existsSync(outputDir)) {
298
+ fs.mkdirSync(outputDir, { recursive: true });
299
+ }
300
+
301
+ // Get available prompts
302
+ const prompts = getPromptFiles(config.prompts_path);
303
+
304
+ if (prompts.length === 0) {
305
+ log.error(`No prompts found in ${config.prompts_path}/`);
306
+ log.info('Add prompt template files to the prompts directory.');
307
+ log.info('Use <?variable_name?> syntax for dynamic variables.');
308
+ return;
309
+ }
310
+
311
+ const rl = createReadlineInterface();
312
+
313
+ try {
314
+ // Select prompt
315
+ const selectedPrompt = await selectPrompt(rl, prompts);
316
+ const promptPath = path.join(process.cwd(), config.prompts_path, selectedPrompt);
317
+
318
+ log.success(`Selected: ${selectedPrompt}\n`);
319
+
320
+ // Read prompt content
321
+ const content = fs.readFileSync(promptPath, 'utf8');
322
+
323
+ // Extract variables
324
+ const variables = extractVariables(content);
325
+
326
+ let finalContent;
327
+
328
+ if (variables.length === 0) {
329
+ log.info('No variables found in this prompt.');
330
+ finalContent = content;
331
+ } else {
332
+ log.info(`Found ${variables.length} variable(s): ${variables.map(v => colors.yellow + v + colors.reset).join(', ')}\n`);
333
+
334
+ // Fill variables
335
+ const values = await fillVariables(rl, variables);
336
+
337
+ // Replace variables
338
+ finalContent = replaceVariables(content, values);
339
+ }
340
+
341
+ // Build output
342
+ const outputContent = [
343
+ config.first_comment,
344
+ '',
345
+ finalContent,
346
+ '',
347
+ config.last_comment
348
+ ].join('\n');
349
+
350
+ // Generate output filename
351
+ const outputFilename = getOutputFilename(selectedPrompt);
352
+ const outputPath = path.join(outputDir, outputFilename);
353
+
354
+ // Write output
355
+ fs.writeFileSync(outputPath, outputContent);
356
+
357
+ log.title('✨ Prompt generated successfully!');
358
+ log.success(`Output: ${OUTPUT_DIR}/${outputFilename}`);
359
+
360
+ // Show preview
361
+ console.log(`\n${colors.dim}─────────────────────────────────────────${colors.reset}`);
362
+ console.log(`${colors.dim}Preview:${colors.reset}\n`);
363
+
364
+ const previewLines = finalContent.split('\n').slice(0, 10);
365
+ previewLines.forEach(line => {
366
+ console.log(` ${colors.dim}${line}${colors.reset}`);
367
+ });
368
+
369
+ if (finalContent.split('\n').length > 10) {
370
+ console.log(` ${colors.dim}...${colors.reset}`);
371
+ }
372
+
373
+ console.log(`\n${colors.dim}─────────────────────────────────────────${colors.reset}\n`);
374
+
375
+ } finally {
376
+ rl.close();
377
+ }
378
+ }
379
+
380
+ function showHelp() {
381
+ console.log(`
382
+ ${colors.bright}${colors.blue}mkprompt${colors.reset} - Dynamic Prompt Generator
383
+
384
+ ${colors.bright}USAGE${colors.reset}
385
+ mkprompt Generate a prompt from templates
386
+ mkprompt config Create configuration file and directories
387
+ mkprompt help Show this help message
388
+
389
+ ${colors.bright}OPTIONS${colors.reset}
390
+ -h, --help Show help
391
+ -v, --version Show version
392
+
393
+ ${colors.bright}CONFIGURATION${colors.reset}
394
+ The mkprompt.config.json file supports:
395
+
396
+ ${colors.cyan}prompts_path${colors.reset} Directory containing prompt templates (default: ./prompts)
397
+ ${colors.cyan}first_comment${colors.reset} Comment added at the beginning of output
398
+ ${colors.cyan}last_comment${colors.reset} Comment added at the end of output
399
+
400
+ ${colors.bright}VARIABLE SYNTAX${colors.reset}
401
+ Use ${colors.yellow}<?variable_name?>${colors.reset} in your prompts for dynamic values.
402
+
403
+ ${colors.bright}EXAMPLE PROMPT${colors.reset}
404
+ ${colors.dim}You are an expert in <?technology?>.
405
+ Help <?user_name?> with their project about <?topic?>.${colors.reset}
406
+
407
+ ${colors.bright}OUTPUT${colors.reset}
408
+ Generated prompts are saved to the mkprompt/ directory
409
+ with the format: promptname_YYYY-MM-DD_HH-MM-SS.ext
410
+
411
+ ${colors.bright}MORE INFO${colors.reset}
412
+ https://github.com/yourusername/mkprompt
413
+ `);
414
+ }
415
+
416
+ // Run
417
+ main().catch(error => {
418
+ log.error(`Unexpected error: ${error.message}`);
419
+ process.exit(1);
420
+ });
package/favicon.svg ADDED
@@ -0,0 +1,42 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+
4
+ <svg
5
+ width="202.94038mm"
6
+ height="178.27425mm"
7
+ viewBox="0 0 202.94038 178.27425"
8
+ version="1.1"
9
+ id="svg1"
10
+ xml:space="preserve"
11
+ inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
12
+ sodipodi:docname="mkprompt.svg"
13
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
14
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
17
+ id="namedview1"
18
+ pagecolor="#ffffff"
19
+ bordercolor="#000000"
20
+ borderopacity="0.25"
21
+ inkscape:showpageshadow="2"
22
+ inkscape:pageopacity="0.0"
23
+ inkscape:pagecheckerboard="0"
24
+ inkscape:deskcolor="#d1d1d1"
25
+ inkscape:document-units="mm"
26
+ inkscape:zoom="0.68862935"
27
+ inkscape:cx="387.00064"
28
+ inkscape:cy="445.08704"
29
+ inkscape:window-width="1920"
30
+ inkscape:window-height="991"
31
+ inkscape:window-x="-9"
32
+ inkscape:window-y="-9"
33
+ inkscape:window-maximized="1"
34
+ inkscape:current-layer="layer1" /><defs
35
+ id="defs1" /><g
36
+ inkscape:label="Layer 1"
37
+ inkscape:groupmode="layer"
38
+ id="layer1"
39
+ transform="translate(-2.8295136,-30.71086)"><path
40
+ style="fill:#000000"
41
+ d="m 64.062744,208.92977 c -0.0601,-0.0606 -0.10918,-6.90686 -0.10918,-15.21384 v -15.1036 l 2.77813,-0.0385 2.77812,-0.0385 v 1.59095 1.59094 l 1.04641,-0.94537 c 2.00537,-1.81173 2.9868,-2.15891 6.10291,-2.15891 2.6112,0 2.89293,0.0538 4.54681,0.86798 4.35446,2.1437 6.6286,7.0156 5.83058,12.49085 -0.57941,3.97528 -2.59639,6.80479 -6.06982,8.515 -1.6652,0.8199 -1.97,0.88034 -4.43961,0.88034 -2.94252,0 -4.17648,-0.43366 -5.90272,-2.07442 l -0.86982,-0.82675 0.0994,5.20517 0.0994,5.20517 -2.89074,0.0819 c -1.58991,0.045 -2.93987,0.0323 -2.99992,-0.0284 z m 13.45922,-13.07883 c 2.39291,-1.00276 3.6145,-2.9591 3.62371,-5.80328 0.0126,-3.90005 -2.27521,-6.52832 -5.68273,-6.52832 -2.45074,0 -4.79755,1.68534 -5.40805,3.88375 -0.72604,2.61447 -0.006,5.92101 1.61447,7.41059 1.36077,1.2511 4.15889,1.74701 5.8526,1.03726 z m 88.889326,-2.08423 0.0683,-15.14102 2.86606,-0.0386 2.86606,-0.0386 -0.0879,1.55406 c -0.0484,0.85474 -0.0459,1.55385 0.005,1.55358 0.0514,-2.7e-4 0.68,-0.52787 1.39694,-1.17246 1.76353,-1.58556 3.38121,-2.09837 6.1594,-1.95256 4.02316,0.21117 7.50204,2.56101 9.21846,6.22671 0.70191,1.49905 0.85658,2.18455 0.94445,4.1858 0.23858,5.43342 -2.02129,9.42492 -6.56787,11.60054 -1.56601,0.74936 -1.94456,0.82122 -4.23334,0.80369 -2.82459,-0.0216 -3.75346,-0.32664 -5.5397,-1.81901 -0.61872,-0.51692 -1.14345,-0.94 -1.16606,-0.94017 -0.0226,-1.7e-4 -0.004,2.32155 0.0408,5.15938 l 0.0819,5.15968 h -3.0606 -3.06059 z m 14.85041,1.47512 c 2.09619,-1.45226 3.08852,-4.69392 2.28963,-7.47949 -0.95162,-3.31812 -4.76762,-5.15374 -7.81131,-3.75751 -2.16041,0.99104 -3.30563,2.69183 -3.50771,5.20935 -0.17542,2.18526 0.46295,4.08953 1.80874,5.39558 1.28999,1.25189 2.33127,1.59938 4.44253,1.48252 1.32827,-0.0735 1.91671,-0.25366 2.77812,-0.85045 z m -69.14198,5.96854 c -2.8133,-0.55148 -6.13525,-3.01286 -7.39264,-5.47754 -3.04504,-5.96878 -0.82872,-13.27232 4.88444,-16.09592 1.76385,-0.87174 2.23735,-0.98522 4.58174,-1.09811 2.92007,-0.14062 4.72636,0.17822 6.747,1.19095 6.58231,3.299 7.86654,13.06028 2.42308,18.41746 -2.86408,2.81868 -6.89233,3.91612 -11.24362,3.06316 z m 4.82165,-5.28252 c 1.20975,-0.33596 2.72514,-1.7942 3.3932,-3.26525 1.00276,-2.20803 0.45704,-5.64117 -1.16114,-7.30471 -2.87285,-2.95337 -7.28238,-2.26 -9.26661,1.45712 -0.43258,0.81037 -0.56495,1.52326 -0.56495,3.04271 0,1.51945 0.13237,2.23234 0.56495,3.04271 1.45612,2.72778 4.06716,3.85148 7.03455,3.02742 z m 81.74379,5.19864 c -1.65801,-0.54112 -2.8243,-1.54818 -3.60321,-3.11124 -0.68521,-1.37505 -0.68881,-1.41583 -0.68881,-7.8126 v -6.43035 h -2.11666 -2.11667 v -2.59284 -2.59284 l 2.04971,0.0132 2.04971,0.0132 0.004,-2.32693 c 0.003,-1.7677 0.0989,-2.38671 0.39769,-2.57564 0.21634,-0.13679 1.55421,-0.25053 2.97304,-0.25275 l 2.57968,-0.004 v 2.48524 c 0,1.75286 0.0975,2.5178 0.33073,2.59574 0.1819,0.0608 1.43206,0.0816 2.77813,0.0464 l 2.44739,-0.0641 v 2.62778 2.62777 h -2.77812 -2.77813 v 5.05325 c 0,5.52015 0.2048,6.49972 1.48041,7.08093 0.84403,0.38456 1.58079,0.36589 2.80463,-0.0711 1.2134,-0.43326 1.27121,-0.32441 1.27121,2.39324 v 1.97762 l -1.25251,0.55404 c -1.56749,0.69338 -4.30373,0.86518 -5.83256,0.36622 z M 2.8981236,189.93188 l 0.069,-11.30293 2.84427,-0.0856 2.84427,-0.0856 v 1.77035 1.77036 l 0.6003,-0.89079 c 0.33017,-0.48994 1.1845304,-1.25169 1.8985804,-1.69278 1.21025,-0.74761 1.47002,-0.80175 3.83147,-0.7986 2.92219,0.004 4.04479,0.43923 5.61523,2.17752 l 0.92928,1.02861 1.2193,-1.10391 c 1.82445,-1.65178 2.89208,-2.07758 5.485,-2.18757 3.05149,-0.12944 4.79564,0.51085 6.47273,2.37617 2.02846,2.25614 2.23861,3.39583 2.32125,12.58881 l 0.0696,7.73925 -3.04271,-1.3e-4 -3.04271,-1.3e-4 v -7.20996 c 0,-6.68648 -0.0384,-7.28556 -0.52917,-8.25122 -0.78678,-1.54817 -1.7209,-2.12051 -3.42079,-2.09594 -1.63666,0.0237 -2.79373,0.69051 -3.52851,2.03358 -0.39791,0.72732 -0.47032,1.81671 -0.54384,8.18123 l -0.0848,7.34218 h -2.89175 -2.89174 l -0.006,-6.68073 c -0.003,-3.6744 -0.11463,-7.14776 -0.24702,-7.71858 -0.73962,-3.18903 -3.97628,-4.26035 -6.36135,-2.10558 -1.4406904,1.30158 -1.5874004,2.21425 -1.5874004,9.87518 v 6.62971 h -3.04555 -3.04555 z m 37.7721104,-4.70437 v -16.00729 l 2.57969,-0.004 c 1.41883,-0.002 2.84758,-0.0754 3.175,-0.16315 l 0.59531,-0.15954 v 9.55586 c 0,5.25572 0.0722,9.55586 0.16036,9.55586 0.0882,0 0.41554,-0.32742 0.72744,-0.72761 0.31189,-0.40018 2.01387,-2.46784 3.78217,-4.5948 l 3.21509,-3.8672 3.48486,-0.19273 c 1.91668,-0.10601 3.53139,-0.14622 3.58824,-0.0894 0.0569,0.0569 -1.11258,1.4745 -2.59874,3.15032 -4.1074,4.63154 -5.48025,6.24379 -5.48025,6.43592 0,0.0962 1.82041,2.93757 4.04536,6.31407 2.22495,3.3765 4.13698,6.28792 4.24895,6.46982 0.15884,0.25805 -0.5502,0.33073 -3.22629,0.33073 h -3.42988 l -2.96877,-4.49791 c -1.63282,-2.47386 -3.00688,-4.49792 -3.05347,-4.49792 -0.0466,0 -0.62429,0.56555 -1.28376,1.25677 l -1.19904,1.25677 -0.006,3.24115 -0.006,3.24114 h -3.175 -3.175 z m 48.90823,5.02709 c -0.0218,-6.03912 -0.0516,-11.12904 -0.0662,-11.31094 -0.0197,-0.24571 0.70463,-0.33073 2.81759,-0.33073 h 2.84405 l 0.009,1.71979 c 0.008,1.58384 0.0397,1.67796 0.4021,1.19063 1.67526,-2.25302 3.15018,-3.02852 5.775886,-3.0369 l 1.82055,-0.006 -0.164,0.99219 c -0.0902,0.5457 -0.16531,1.79025 -0.16691,2.76565 l -0.003,1.77348 -1.25677,-0.14836 c -2.810266,-0.33174 -4.961086,1.02307 -5.728926,3.60868 -0.33435,1.12587 -0.42263,2.71192 -0.42263,7.59284 v 6.16968 h -2.91042 -2.91042 z m 39.666686,-0.15787 c -0.0395,-6.12594 -0.002,-11.25018 0.0824,-11.3872 0.085,-0.1373 1.33198,-0.21489 2.77813,-0.17286 l 2.62396,0.0763 0.13229,1.5875 0.1323,1.5875 0.75402,-0.98565 c 0.42262,-0.55245 1.38437,-1.29406 2.1882,-1.68733 1.27395,-0.62329 1.66265,-0.68813 3.47931,-0.58038 1.13027,0.067 2.40904,0.31113 2.85864,0.54566 0.95298,0.49711 2.27828,1.69608 2.68401,2.42817 0.26589,0.47976 0.38369,0.42402 1.75778,-0.83182 0.85563,-0.782 1.9954,-1.52412 2.71994,-1.771 1.45574,-0.49602 4.64756,-0.55961 5.94205,-0.11839 1.50934,0.51444 3.09948,1.7648 3.83028,3.01182 1.31485,2.24362 1.41111,3.00445 1.44725,11.43902 l 0.0337,7.86448 -2.91836,0.0747 -2.91837,0.0747 -0.0813,-7.483 c -0.0713,-6.56247 -0.13895,-7.58848 -0.54984,-8.34041 -0.66889,-1.22408 -1.62108,-1.7579 -3.1356,-1.7579 -1.55546,0 -2.52607,0.61927 -3.2473,2.07186 -0.45498,0.91633 -0.50188,1.68082 -0.5062,8.25115 l -0.005,7.24125 h -2.99953 -2.99953 l -0.006,-7.20989 c -0.005,-6.57391 -0.0513,-7.3101 -0.52134,-8.34579 -0.40793,-0.89882 -0.77132,-1.24905 -1.74107,-1.67801 -1.95951,-0.86679 -3.8875,-0.28221 -5.15221,1.56218 -0.64567,0.94162 -0.64982,0.98879 -0.73084,8.30926 l -0.0815,7.36225 h -2.88943 -2.88944 z M 76.521274,166.72855 c -0.98603,-0.44012 -2.12488,-1.63466 -2.49671,-2.61878 -0.17769,-0.4703 -0.28141,-3.90087 -0.28141,-9.30756 v -8.56274 l -8.7974,-0.0895 -8.7974,-0.0895 -2.11666,-0.7433 c -5.49181,-1.92854 -9.2204,-5.15931 -11.60881,-10.05887 -2.32008,-4.75939 -2.12594,-0.79417 -2.22347,-45.413068 -0.0627,-28.702049 -0.003,-40.135885 0.21628,-41.671535 0.69055,-4.82733 2.46101,-8.432546 5.78708,-11.784315 2.28015,-2.297763 4.75063,-3.855247 7.82892,-4.935634 l 2.11666,-0.742888 h 47.492706 47.49271 l 1.98437,0.62536 c 6.64161,2.093053 11.37901,6.647617 13.67742,13.149557 l 0.74238,2.100082 0.0744,41.010415 c 0.0837,46.109026 0.21303,42.931736 -1.92799,47.360416 -2.40841,4.98177 -6.63902,8.5507 -12.43395,10.48923 l -1.85208,0.61956 -22.63278,0.13415 -22.63278,0.13414 -1.17972,0.92166 c -0.64884,0.50691 -4.989719,3.96334 -9.646379,7.68096 -11.53259,9.20697 -14.14531,11.23309 -15.13426,11.73631 -1.0165,0.51724 -2.56445,0.54092 -3.65116,0.0559 z m 21.58556,-24.16316 c 2.267686,-1.77245 4.448326,-3.3463 4.845866,-3.49744 0.4794,-0.18227 8.36089,-0.27481 23.40417,-0.27481 24.75342,0 24.24288,0.0288 27.12456,-1.53007 0.73091,-0.39539 2.02083,-1.3578 2.86649,-2.13869 1.87459,-1.73102 3.5024,-4.83183 3.9077,-7.44374 0.17019,-1.09682 0.26592,-15.32931 0.26427,-39.290626 -0.003,-41.177215 0.0556,-39.584326 -1.57185,-42.862499 -1.57812,-3.17887 -4.53769,-5.715602 -7.86862,-6.744421 -1.69551,-0.523691 -2.39876,-0.53162 -47.15362,-0.53162 -41.010876,0 -45.572296,0.0415 -46.869526,0.426382 -2.20837,0.655223 -3.75948,1.540749 -5.4493,3.110989 -1.9833,1.842961 -3.11996,3.752991 -3.78814,6.365535 -0.52356,2.04711 -0.53402,2.838046 -0.53402,40.397226 0,27.288344 0.0853,38.712594 0.29663,39.711324 1.0024,4.73811 4.46354,8.63268 8.88584,9.99859 1.59038,0.49121 2.45383,0.53162 11.36115,0.53162 9.08103,0 9.69942,0.0303 10.66547,0.52317 0.56404,0.28775 1.30343,0.91283 1.64311,1.38907 0.59951,0.84053 0.62226,1.07508 0.77685,8.00963 0.0876,3.92907 0.17689,7.17211 0.19844,7.20676 0.0216,0.0346 2.92644,-2.23127 6.45532,-5.03537 3.52888,-2.80411 8.27153,-6.54857 10.53921,-8.32101 z m -31.00941,-16.04378 c -2.37304,-0.84801 -4.33049,-2.68774 -5.48934,-5.15922 l -0.69723,-1.48696 -0.0696,-28.374489 c -0.0691,-28.132061 -0.065,-28.388447 0.48072,-30.008267 1.02074,-3.030025 2.8629,-5.01518 5.75944,-6.20653 l 1.50241,-0.617944 21.99869,-0.0063 c 21.294576,-0.0061 22.053786,0.01074 23.719876,0.525341 0.94665,0.292391 2.43777,1.010138 3.3136,1.594993 1.83179,1.22322 4.46926,3.95796 4.69865,4.871939 0.13529,0.539047 -0.75727,7.309629 -1.09569,8.311391 -0.0772,0.228561 -1.412,-0.891509 -3.6386,-3.053285 -1.93415,-1.87785 -4.10556,-3.7667 -4.82534,-4.197445 l -1.30869,-0.783172 -20.463726,-0.07248 c -20.17646,-0.07146 -20.47594,-0.06493 -21.33397,0.465361 -0.47864,0.295812 -1.0052,0.86421 -1.17015,1.263105 -0.21834,0.528028 -0.28078,8.00587 -0.22957,27.497004 l 0.0703,26.771738 0.78276,0.81698 c 0.43052,0.44934 1.20443,0.93937 1.71979,1.08896 0.62121,0.18031 9.40881,0.2452 26.07245,0.19253 l 25.135406,-0.0794 0.96402,-0.59949 c 1.81499,-1.12866 1.81411,-1.12227 1.81411,-13.20438 V 95.258077 l 3.60963,-3.897052 c 1.9853,-2.143379 3.71171,-3.897053 3.83646,-3.897053 0.33093,0 0.282,28.078018 -0.0525,30.139708 -0.68869,4.24455 -3.66885,7.70174 -7.64003,8.86298 -1.2734,0.37236 -4.57344,0.4189 -28.971879,0.40861 -21.82036,-0.009 -27.73344,-0.0826 -28.49197,-0.35366 z m 7.19997,-18.04276 c -1.17973,-0.99268 -1.53983,-2.40668 -0.93663,-3.67784 0.25978,-0.54744 0.83904,-1.21897 1.28725,-1.49229 0.77478,-0.47246 1.64643,-0.49699 17.69525,-0.49793 18.205316,-10e-4 17.836596,-0.0281 18.822366,1.37929 0.23717,0.33861 0.41293,1.13885 0.41293,1.88005 0,1.11486 -0.12244,1.41295 -0.89958,2.19009 l -0.89958,0.89958 H 92.443034 75.106664 Z M 111.64229,95.667484 c -1.74885,-1.066287 -2.37301,-3.110312 -1.47893,-4.843214 0.24029,-0.465716 2.4232,-2.93035 4.85092,-5.476964 2.42772,-2.546615 6.87783,-7.232928 9.88914,-10.414029 l 5.4751,-5.78382 -1.97605,-2.06831 c -2.62034,-2.742679 -2.93739,-4.254871 -1.27408,-6.076704 0.63296,-0.693284 1.52188,-1.017855 7.20434,-2.63052 3.56526,-1.011809 7.18554,-2.083751 8.04507,-2.382093 1.85244,-0.642983 3.5913,-0.695588 4.66359,-0.141086 0.84806,0.43855 1.57884,1.615567 1.57884,2.542936 0,1.330341 -3.21096,18.945939 -3.59021,19.696164 -0.22585,0.446781 -0.74921,1.012328 -1.16302,1.25677 -0.91936,0.54308 -2.95208,0.578099 -3.93879,0.06786 -0.53204,-0.275132 -3.5073,-3.564392 -4.15441,-4.592858 -0.0258,-0.04106 -0.92619,0.850388 -2.00079,1.980991 -1.0746,1.130603 -3.4421,3.607759 -5.26111,5.504791 -1.81901,1.897032 -4.2598,4.460628 -5.42396,5.69688 -7.56643,8.034944 -7.74445,8.187986 -9.525,8.188603 -0.59095,2.05e-4 -1.43915,-0.231822 -1.92065,-0.525393 z M 74.887594,93.42791 c -1.63309,-0.710359 -2.34232,-2.78338 -1.5346,-4.485515 0.91048,-1.918691 0.56166,-1.875298 15.07453,-1.875298 14.457816,0 14.168056,-0.03494 15.045566,1.814269 0.86638,1.825766 0.2986,3.507665 -1.47378,4.365659 -1.14771,0.555599 -1.42236,0.566739 -13.721466,0.55659 -10.075,-0.0083 -12.71598,-0.08241 -13.39025,-0.375705 z m -0.28683,-16.633321 c -2.04278,-1.13449 -2.03456,-3.966558 0.0151,-5.216328 0.8107,-0.494316 1.42375,-0.516519 14.28779,-0.517466 14.926946,-0.0011 14.685986,-0.0281 15.419676,1.727878 0.47622,1.139746 0.47217,1.56045 -0.0251,2.608397 -0.85218,1.795839 -0.43588,1.749183 -15.514666,1.738777 -10.38477,-0.0072 -13.726,-0.08756 -14.18281,-0.341258 z"
42
+ id="path1" /></g></svg>
@@ -0,0 +1,5 @@
1
+ {
2
+ "prompts_path": "./prompts",
3
+ "first_comment": "/* Prompt Generated by mkprompt */",
4
+ "last_comment": "/* End of Prompt */"
5
+ }
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "mkprompt",
3
+ "version": "1.0.0",
4
+ "description": "A powerful command-line tool that generates dynamic prompts with variable substitution, perfect for AI assistants and templating workflows.",
5
+ "main": "bin/mkprompt.js",
6
+ "bin": {
7
+ "mkprompt": "./bin/mkprompt.js"
8
+ },
9
+ "scripts": {
10
+ "test": "node bin/mkprompt.js",
11
+ "prepublishOnly": "node bin/mkprompt.js --version",
12
+ "release:patch": "npm version patch && npm publish",
13
+ "release:minor": "npm version minor && npm publish",
14
+ "release:major": "npm version major && npm publish",
15
+ "deploy": "npm publish",
16
+ "deploy:dry": "npm publish --dry-run"
17
+ },
18
+ "keywords": [
19
+ "prompt",
20
+ "template",
21
+ "ai",
22
+ "chatgpt",
23
+ "claude",
24
+ "llm",
25
+ "cli",
26
+ "markdown",
27
+ "dynamic-prompts"
28
+ ],
29
+ "author": "David200197",
30
+ "license": "MIT",
31
+ "engines": {
32
+ "node": ">=14.0.0"
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": ""
37
+ }
38
+ }