cli-five 0.1.5 → 0.1.6
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/package.json
CHANGED
package/src/commands/init.mjs
CHANGED
|
@@ -49,6 +49,11 @@ export async function init(args) {
|
|
|
49
49
|
answers.costMode = args.costMode;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
if (answers.presetId && answers.presetId !== 'custom') {
|
|
53
|
+
log.info(`Preset: ${answers.presetId}`);
|
|
54
|
+
}
|
|
55
|
+
if (answers.frameworks.length) log.info(`Stack: ${answers.stack.join(', ')} + ${answers.frameworks.join(', ')}`);
|
|
56
|
+
|
|
52
57
|
// 5. Scaffold
|
|
53
58
|
log.step('4/6 Scaffold');
|
|
54
59
|
const written = scaffold({ cwd, answers, args });
|
package/src/steps/interview.mjs
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
import prompts from 'prompts';
|
|
2
2
|
|
|
3
|
+
// ── Preset stacks ─────────────────────────────────────────────────────
|
|
4
|
+
// Chosen for: LLM familiarity, low setup friction, minimal config,
|
|
5
|
+
// copy-paste quickstart, broad hosting support.
|
|
6
|
+
// Research via Context7: Next.js, Vite+React, Express, Hono all score
|
|
7
|
+
// 80+ benchmark with high snippet counts and well-indexed docs.
|
|
8
|
+
const STACK_PRESETS = [
|
|
9
|
+
{
|
|
10
|
+
title: 'Next.js (TypeScript)',
|
|
11
|
+
value: 'nextjs',
|
|
12
|
+
description: 'Full-stack React. App Router, TypeScript, Tailwind. `npx create-next-app`',
|
|
13
|
+
stack: ['Node + TypeScript'],
|
|
14
|
+
frameworks: ['Next.js', 'React', 'Tailwind CSS'],
|
|
15
|
+
quickstart: 'npx create-next-app@latest . --yes && npm run dev',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: 'Vite + React (TypeScript)',
|
|
19
|
+
value: 'vite-react',
|
|
20
|
+
description: 'SPA frontend. Lightning-fast HMR. `npm create vite`',
|
|
21
|
+
stack: ['Node + TypeScript'],
|
|
22
|
+
frameworks: ['Vite', 'React', 'TypeScript'],
|
|
23
|
+
quickstart: 'npm create vite@latest . -- --template react-ts && npm i && npm run dev',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: 'Express API (TypeScript)',
|
|
27
|
+
value: 'express',
|
|
28
|
+
description: 'REST API server. Minimal, well-known, huge ecosystem.',
|
|
29
|
+
stack: ['Node + TypeScript'],
|
|
30
|
+
frameworks: ['Express', 'TypeScript'],
|
|
31
|
+
quickstart: 'npm init -y && npm i express typescript tsx @types/express && npx tsx src/index.ts',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
title: 'Hono API (TypeScript)',
|
|
35
|
+
value: 'hono',
|
|
36
|
+
description: 'Ultrafast, Web Standards. Works on Node, Bun, Deno, Cloudflare.',
|
|
37
|
+
stack: ['Node + TypeScript'],
|
|
38
|
+
frameworks: ['Hono', 'TypeScript'],
|
|
39
|
+
quickstart: 'npm create hono@latest . && npm i && npm run dev',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
title: 'Vite + Vue (TypeScript)',
|
|
43
|
+
value: 'vite-vue',
|
|
44
|
+
description: 'SPA frontend with Vue 3 + Composition API.',
|
|
45
|
+
stack: ['Node + TypeScript'],
|
|
46
|
+
frameworks: ['Vite', 'Vue', 'TypeScript'],
|
|
47
|
+
quickstart: 'npm create vite@latest . -- --template vue-ts && npm i && npm run dev',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: 'Python + FastAPI',
|
|
51
|
+
value: 'fastapi',
|
|
52
|
+
description: 'Modern Python API with type hints and auto-docs.',
|
|
53
|
+
stack: ['Python'],
|
|
54
|
+
frameworks: ['FastAPI', 'Pydantic', 'Uvicorn'],
|
|
55
|
+
quickstart: 'pip install fastapi uvicorn && uvicorn main:app --reload',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: 'Custom (freeform)',
|
|
59
|
+
value: 'custom',
|
|
60
|
+
description: 'Enter your own stack and frameworks manually.',
|
|
61
|
+
stack: [],
|
|
62
|
+
frameworks: [],
|
|
63
|
+
quickstart: '',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
|
|
3
67
|
const COST_MODES = [
|
|
4
68
|
{ title: 'Premium (default)', value: 'premium', description: 'Sonnet/Opus/Codex. Best quality, real cost.' },
|
|
5
69
|
{ title: 'Cheap (0x)', value: 'cheap', description: 'GPT-4.1 / GPT-4o / GPT-5 mini. Free tier-friendly.' },
|
|
@@ -13,7 +77,8 @@ export async function interview(detected, args) {
|
|
|
13
77
|
throw new Error('Interview cancelled. Nothing was written.');
|
|
14
78
|
};
|
|
15
79
|
|
|
16
|
-
|
|
80
|
+
// ── Basic info ────────────────────────────────────────────────────
|
|
81
|
+
const basic = await prompts(
|
|
17
82
|
[
|
|
18
83
|
{
|
|
19
84
|
type: 'text',
|
|
@@ -27,20 +92,61 @@ export async function interview(detected, args) {
|
|
|
27
92
|
message: 'One-line description (becomes PROJECT.md vision)',
|
|
28
93
|
initial: '',
|
|
29
94
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
95
|
+
],
|
|
96
|
+
{ onCancel },
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
// ── Stack preset or freeform ──────────────────────────────────────
|
|
100
|
+
// If detection already found a stack, show it as initial hint
|
|
101
|
+
const detectedLabel = detected.stacks.map((s) => s.label).join(', ');
|
|
102
|
+
|
|
103
|
+
const { preset } = await prompts(
|
|
104
|
+
{
|
|
105
|
+
type: 'select',
|
|
106
|
+
name: 'preset',
|
|
107
|
+
message: detectedLabel
|
|
108
|
+
? `Stack preset (detected: ${detectedLabel})`
|
|
109
|
+
: 'Stack preset — pick one or go freeform',
|
|
110
|
+
choices: STACK_PRESETS,
|
|
111
|
+
initial: 0,
|
|
112
|
+
},
|
|
113
|
+
{ onCancel },
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
let stackAnswers;
|
|
117
|
+
const chosenPreset = STACK_PRESETS.find((p) => p.value === preset);
|
|
118
|
+
|
|
119
|
+
if (preset === 'custom') {
|
|
120
|
+
// Freeform: user types whatever they want
|
|
121
|
+
stackAnswers = await prompts(
|
|
122
|
+
[
|
|
123
|
+
{
|
|
124
|
+
type: 'list',
|
|
125
|
+
name: 'stack',
|
|
126
|
+
message: 'Tech stack (comma separated)',
|
|
127
|
+
initial: detectedLabel,
|
|
128
|
+
separator: ',',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: 'list',
|
|
132
|
+
name: 'frameworks',
|
|
133
|
+
message: 'Frameworks / key libraries (comma separated)',
|
|
134
|
+
initial: '',
|
|
135
|
+
separator: ',',
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
{ onCancel },
|
|
139
|
+
);
|
|
140
|
+
} else {
|
|
141
|
+
stackAnswers = {
|
|
142
|
+
stack: chosenPreset.stack,
|
|
143
|
+
frameworks: chosenPreset.frameworks,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ── Remaining questions ───────────────────────────────────────────
|
|
148
|
+
const rest = await prompts(
|
|
149
|
+
[
|
|
44
150
|
{
|
|
45
151
|
type: 'text',
|
|
46
152
|
name: 'goals',
|
|
@@ -68,19 +174,31 @@ export async function interview(detected, args) {
|
|
|
68
174
|
{ onCancel },
|
|
69
175
|
);
|
|
70
176
|
|
|
71
|
-
return normalize({
|
|
177
|
+
return normalize({
|
|
178
|
+
...defaults(detected),
|
|
179
|
+
...basic,
|
|
180
|
+
...stackAnswers,
|
|
181
|
+
...rest,
|
|
182
|
+
presetId: preset,
|
|
183
|
+
quickstart: chosenPreset?.quickstart || '',
|
|
184
|
+
});
|
|
72
185
|
}
|
|
73
186
|
|
|
187
|
+
/** Default stack is Next.js + TypeScript when nothing detected and --yes. */
|
|
74
188
|
function defaults(detected) {
|
|
189
|
+
const hasDetected = detected.stacks.length > 0;
|
|
190
|
+
const fallback = STACK_PRESETS[0]; // Next.js (TypeScript)
|
|
75
191
|
return {
|
|
76
192
|
projectName: detected.projectName,
|
|
77
193
|
oneLiner: '',
|
|
78
|
-
stack: detected.stacks.map((s) => s.label),
|
|
79
|
-
frameworks: [],
|
|
194
|
+
stack: hasDetected ? detected.stacks.map((s) => s.label) : fallback.stack,
|
|
195
|
+
frameworks: hasDetected ? [] : fallback.frameworks,
|
|
80
196
|
goals: '',
|
|
81
197
|
constraints: '',
|
|
82
198
|
costMode: 'premium',
|
|
83
199
|
snark: true,
|
|
200
|
+
presetId: hasDetected ? 'custom' : fallback.value,
|
|
201
|
+
quickstart: hasDetected ? '' : fallback.quickstart,
|
|
84
202
|
};
|
|
85
203
|
}
|
|
86
204
|
|
package/src/steps/scaffold.mjs
CHANGED
|
@@ -94,6 +94,7 @@ function buildVars(a) {
|
|
|
94
94
|
FRAMEWORKS: a.frameworks.length ? a.frameworks.join(', ') : 'None declared.',
|
|
95
95
|
GOALS: a.goals || 'TODO — declare the primary goal.',
|
|
96
96
|
CONSTRAINTS: a.constraints || 'None declared.',
|
|
97
|
+
QUICKSTART: a.quickstart || 'TODO — add install + run commands here.',
|
|
97
98
|
COST_MODE: a.costMode,
|
|
98
99
|
DATE: new Date().toISOString().slice(0, 10),
|
|
99
100
|
PERSONA_BLOCK: a.snark ? PERSONA_BLOCK : '',
|
|
@@ -54,6 +54,10 @@ Before writing code, read (if they exist):
|
|
|
54
54
|
|
|
55
55
|
Before finishing, if any implementation choice was made (library selection, pattern choice, API approach), append an entry to `decisions.md` using the format in that file. Skip silently if no decisions were made.
|
|
56
56
|
|
|
57
|
+
## README.md (MANDATORY)
|
|
58
|
+
|
|
59
|
+
After any session that adds, changes, or removes user-facing functionality, update `README.md` at the project root. The README must contain at minimum: project name & one-liner, **copy-paste quickstart commands** (install deps + run), usage notes, and tech stack. If `README.md` does not exist, create it as the FIRST file before any other work. A new developer must go from clone → running app in < 2 minutes.
|
|
60
|
+
|
|
57
61
|
## History (MANDATORY)
|
|
58
62
|
|
|
59
63
|
Before finishing, append at least one bullet to `histories/coder.md` below the `<!-- Append entries below this line -->` marker. Record: build quirks, API gotchas, pattern preferences, file structure observations, test insights. Format: `- YYYY-MM-DD: <learning>`. Skip only if the session had zero meaningful work.
|
|
@@ -23,6 +23,18 @@
|
|
|
23
23
|
- Read `PROJECT.md`, `STATE.md`, and `decisions.md` on entry.
|
|
24
24
|
- Before finishing: update `decisions.md` if any choice was made, update your `histories/<agent>.md` with at least one learning.
|
|
25
25
|
|
|
26
|
+
# README.md (MANDATORY)
|
|
27
|
+
- The project MUST have a `README.md` at the root at all times.
|
|
28
|
+
- After any session that adds, changes, or removes user-facing functionality, update `README.md`.
|
|
29
|
+
- The README must always contain at minimum:
|
|
30
|
+
1. **Project name & one-liner** — what this is.
|
|
31
|
+
2. **Quickstart** — exact commands to install dependencies and run the project locally (copy-paste ready, no placeholders).
|
|
32
|
+
3. **Usage** — how to use the main features.
|
|
33
|
+
4. **Tech stack** — languages, frameworks, key libraries.
|
|
34
|
+
- Keep it concise and user-friendly. A new developer should go from clone → running app in under 2 minutes.
|
|
35
|
+
- If the README does not exist yet, create it as the FIRST file before any other work.
|
|
36
|
+
- If unsure about run commands, inspect `package.json` scripts, `Makefile`, `Dockerfile`, or equivalent.
|
|
37
|
+
|
|
26
38
|
At the end of every agent session, before stopping, append a terse session summary to `agent-diary.md`
|
|
27
39
|
at the workspace root as a markdown section with format `## YYYY-MM-DD HH:MM` (24-hour time).
|
|
28
40
|
Include: 2-5 sentence summary of what was accomplished, include model used.
|