ai-prompt-framework-helper 1.0.0 → 1.1.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/ai-prompt.js +52 -15
- package/package.json +20 -6
package/ai-prompt.js
CHANGED
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
// ─── AI Prompt Framework Helper — CLI ────────────────────────────────────────
|
|
5
5
|
// Author : Marcos Castro · https://marcoscv.github.io
|
|
6
6
|
// No external dependencies — requires only Node.js ≥ 16
|
|
7
|
-
// Usage :
|
|
8
|
-
// ai-prompt
|
|
9
|
-
// ai-prompt
|
|
7
|
+
// Usage : ai-prompt (interactive, select framework)
|
|
8
|
+
// ai-prompt ape (jump straight to APE)
|
|
9
|
+
// ai-prompt co-star (jump straight to CO-STAR)
|
|
10
|
+
// ai-prompt risen (jump straight to RISEN)
|
|
11
|
+
// ai-prompt rtccf (jump straight to RTCCF)
|
|
12
|
+
// ai-prompt costar | claude (build prompt and pipe to AI CLI)
|
|
10
13
|
|
|
11
14
|
const readline = require('readline');
|
|
12
15
|
const { execSync, spawnSync } = require('child_process');
|
|
@@ -117,6 +120,21 @@ const FRAMEWORKS = [
|
|
|
117
120
|
},
|
|
118
121
|
];
|
|
119
122
|
|
|
123
|
+
// ─── Argument → framework resolver ───────────────────────────────────────────
|
|
124
|
+
|
|
125
|
+
const FW_ALIASES = {
|
|
126
|
+
'ape': 0,
|
|
127
|
+
'costar': 1, 'co-star': 1, 'co_star': 1,
|
|
128
|
+
'risen': 2,
|
|
129
|
+
'rtccf': 3,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
function resolveFrameworkArg(arg) {
|
|
133
|
+
const key = arg.toLowerCase().replace(/\s+/g, '');
|
|
134
|
+
const idx = FW_ALIASES[key];
|
|
135
|
+
return idx !== undefined ? FRAMEWORKS[idx] : null;
|
|
136
|
+
}
|
|
137
|
+
|
|
120
138
|
// ─── Detect installed AI CLIs ─────────────────────────────────────────────────
|
|
121
139
|
|
|
122
140
|
const CLI_CATALOG = [
|
|
@@ -150,13 +168,16 @@ function box(lines, color = 'cyan') {
|
|
|
150
168
|
}
|
|
151
169
|
|
|
152
170
|
function header() {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
const art = [
|
|
172
|
+
'(_______) | (_____ \\ _ (_______) | | (_) (_) | | ',
|
|
173
|
+
' _______| | _____) )___ ___ ____ ____ _| |_ _____ ____ _____ ____ _____ _ _ _ ___ ____| | _ _______ _____| | ____ _____ ____ ',
|
|
174
|
+
' | ___ | | | ____/ ___) _ \\| \\| _ (_ _) | ___) ___|____ | \\| ___ | | | |/ _ \\ / ___) |_/ ) | ___ | ___ | || _ \\| ___ |/ ___) ',
|
|
175
|
+
' | | | | | | | | | | |_| | | | | |_| || |_ | | | | / ___ | | | | ____| | | | |_| | | | _ ( | | | | ____| || |_| | ____| | ',
|
|
176
|
+
' |_| |_|_| |_| |_| \\___/|_|_|_| __/ \\__) |_| |_| \\_____|_|_|_|_____)\\___/ \\___/|_| |_| \\_) |_| |_|_____)\\_ ) __/|_____)_| ',
|
|
177
|
+
' |_| |_|',
|
|
178
|
+
];
|
|
179
|
+
console.log('\n' + co('cyan', art.join('\n')));
|
|
180
|
+
console.log(d('\n by Marcos Castro · marcoscv.github.io') + '\n');
|
|
160
181
|
}
|
|
161
182
|
|
|
162
183
|
function sectionHeader(fw) {
|
|
@@ -349,20 +370,36 @@ async function saveToFile(prompt) {
|
|
|
349
370
|
// ─── Main ─────────────────────────────────────────────────────────────────────
|
|
350
371
|
|
|
351
372
|
async function main() {
|
|
352
|
-
// Detect before entering interactive mode
|
|
353
373
|
const detectedCLIs = detectCLIs();
|
|
354
374
|
|
|
355
375
|
console.clear();
|
|
356
376
|
header();
|
|
357
377
|
|
|
378
|
+
// ── Argument: ai-prompt [framework] ──────────────────────────────────────
|
|
379
|
+
const arg = process.argv[2];
|
|
380
|
+
let fw;
|
|
381
|
+
|
|
382
|
+
if (arg) {
|
|
383
|
+
fw = resolveFrameworkArg(arg);
|
|
384
|
+
if (!fw) {
|
|
385
|
+
console.error(co('red', ` Unknown framework: "${arg}"`));
|
|
386
|
+
console.error(d(' Valid options: ape · co-star · risen · rtccf\n'));
|
|
387
|
+
rl.close();
|
|
388
|
+
process.exit(1);
|
|
389
|
+
}
|
|
390
|
+
console.log(` ${co('green', '→')} Framework: ${b(co(fw.color, fw.key))} ${d(fw.fullName)}\n`);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// ── CLI detection notice ──────────────────────────────────────────────────
|
|
358
394
|
if (detectedCLIs.length > 0) {
|
|
359
|
-
|
|
360
|
-
console.log(`\n ${co('green', '✓')} Detected AI CLIs: ${detectedCLIs.map(c => b(c.name)).join(' ')}`);
|
|
395
|
+
console.log(` ${co('green', '✓')} Detected AI CLIs: ${detectedCLIs.map(c => b(c.name)).join(' ')}`);
|
|
361
396
|
} else {
|
|
362
|
-
console.log(
|
|
397
|
+
console.log(` ${d('No AI CLIs detected. Output options: clipboard, stdout, file.')}`);
|
|
363
398
|
}
|
|
364
399
|
|
|
365
|
-
|
|
400
|
+
// ── Framework selection (only if no arg) ─────────────────────────────────
|
|
401
|
+
if (!fw) fw = await selectFramework();
|
|
402
|
+
|
|
366
403
|
const values = await fillFields(fw);
|
|
367
404
|
const prompt = fw.build(values);
|
|
368
405
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-prompt-framework-helper",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Interactive CLI to build structured AI prompts using APE, CO-STAR, RISEN and RTCCF frameworks. Works with Claude, Gemini, and any AI CLI.",
|
|
5
5
|
"author": "Marcos Castro <marcoscv@gmail.com> (https://marcoscv.github.io)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"email": "marcoscv@gmail.com"
|
|
15
15
|
},
|
|
16
16
|
"bin": {
|
|
17
|
-
"ai-prompt": "
|
|
17
|
+
"ai-prompt": "ai-prompt.js"
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"ai-prompt.js",
|
|
@@ -25,9 +25,23 @@
|
|
|
25
25
|
"node": ">=16"
|
|
26
26
|
},
|
|
27
27
|
"keywords": [
|
|
28
|
-
"ai",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
28
|
+
"ai",
|
|
29
|
+
"prompt",
|
|
30
|
+
"prompt-engineering",
|
|
31
|
+
"cli",
|
|
32
|
+
"terminal",
|
|
33
|
+
"ape",
|
|
34
|
+
"costar",
|
|
35
|
+
"co-star",
|
|
36
|
+
"risen",
|
|
37
|
+
"rtccf",
|
|
38
|
+
"claude",
|
|
39
|
+
"gemini",
|
|
40
|
+
"chatgpt",
|
|
41
|
+
"llm",
|
|
42
|
+
"openai",
|
|
43
|
+
"framework",
|
|
44
|
+
"interactive",
|
|
45
|
+
"assistant"
|
|
32
46
|
]
|
|
33
47
|
}
|