@crouton-kit/crouter 0.2.5 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builtin-skills/skills/crouter-development/marketplaces/SKILL.md +9 -9
- package/dist/builtin-skills/skills/crouter-development/plugins/SKILL.md +19 -19
- package/dist/cli.js +42 -37
- package/dist/commands/__tests__/human.test.d.ts +1 -0
- package/dist/commands/__tests__/human.test.js +214 -0
- package/dist/commands/__tests__/skill.test.d.ts +1 -0
- package/dist/commands/__tests__/skill.test.js +287 -0
- package/dist/commands/debug.d.ts +3 -0
- package/dist/commands/debug.js +179 -0
- package/dist/commands/flow.d.ts +2 -0
- package/dist/commands/flow.js +24 -0
- package/dist/commands/human.d.ts +2 -0
- package/dist/commands/human.js +480 -0
- package/dist/commands/job.d.ts +2 -0
- package/dist/commands/job.js +669 -0
- package/dist/commands/pkg.d.ts +2 -0
- package/dist/commands/pkg.js +1021 -0
- package/dist/commands/plan.d.ts +4 -2
- package/dist/commands/plan.js +306 -22
- package/dist/commands/skill.d.ts +2 -2
- package/dist/commands/skill.js +615 -459
- package/dist/commands/spec.d.ts +3 -2
- package/dist/commands/spec.js +283 -10
- package/dist/commands/sys.d.ts +2 -0
- package/dist/commands/sys.js +712 -0
- package/dist/core/__tests__/argv-parser.test.d.ts +1 -0
- package/dist/core/__tests__/argv-parser.test.js +199 -0
- package/dist/core/__tests__/flow-leaves.test.d.ts +1 -0
- package/dist/core/__tests__/flow-leaves.test.js +248 -0
- package/dist/core/__tests__/job.test.d.ts +1 -0
- package/dist/core/__tests__/job.test.js +346 -0
- package/dist/core/__tests__/pkg.test.d.ts +1 -0
- package/dist/core/__tests__/pkg.test.js +218 -0
- package/dist/core/__tests__/sys.test.d.ts +1 -0
- package/dist/core/__tests__/sys.test.js +208 -0
- package/dist/core/artifact.d.ts +29 -18
- package/dist/core/artifact.js +78 -221
- package/dist/core/auto-update.js +11 -3
- package/dist/core/command.d.ts +36 -0
- package/dist/core/command.js +287 -0
- package/dist/core/errors.d.ts +3 -0
- package/dist/core/errors.js +5 -0
- package/dist/core/fs-utils.d.ts +1 -0
- package/dist/core/fs-utils.js +4 -0
- package/dist/core/help.d.ts +98 -0
- package/dist/core/help.js +163 -0
- package/dist/core/io.d.ts +29 -0
- package/dist/core/io.js +83 -0
- package/dist/core/jobs.d.ts +87 -0
- package/dist/core/jobs.js +353 -0
- package/dist/core/pagination.d.ts +33 -0
- package/dist/core/pagination.js +89 -0
- package/dist/core/self-update.d.ts +21 -0
- package/dist/{commands/update.js → core/self-update.js} +28 -63
- package/dist/core/spawn.d.ts +47 -65
- package/dist/core/spawn.js +78 -228
- package/dist/prompts/agent.d.ts +10 -5
- package/dist/prompts/agent.js +51 -74
- package/dist/prompts/debug.d.ts +8 -0
- package/dist/prompts/debug.js +37 -0
- package/dist/prompts/review.js +4 -11
- package/dist/prompts/skill.d.ts +0 -1
- package/dist/prompts/skill.js +95 -149
- package/package.json +4 -2
- package/dist/commands/agent.d.ts +0 -2
- package/dist/commands/agent.js +0 -265
- package/dist/commands/config.d.ts +0 -2
- package/dist/commands/config.js +0 -146
- package/dist/commands/doctor.d.ts +0 -2
- package/dist/commands/doctor.js +0 -268
- package/dist/commands/marketplace.d.ts +0 -2
- package/dist/commands/marketplace.js +0 -365
- package/dist/commands/plugin.d.ts +0 -2
- package/dist/commands/plugin.js +0 -367
- package/dist/commands/update.d.ts +0 -4
- package/dist/prompts/plan.d.ts +0 -1
- package/dist/prompts/plan.js +0 -175
- package/dist/prompts/spec.d.ts +0 -1
- package/dist/prompts/spec.js +0 -153
package/dist/commands/spec.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const SPEC_NEW_GUIDE = "## Spec workflow\n\nBuild and save a design + requirements spec: a document describing what to\nbuild, the shape of the solution, and the behaviors it must satisfy. A spec is\nupstream of a plan \u2014 it captures decisions, not implementation steps.\n\nAnti-pattern: do not fish for clarifications upfront. Draft a concrete spec\nfirst based on your investigation, then iterate. A specific draft the user can\nreact to converges faster than a list of questions in a vacuum.\n\n### Phase 1: Shape\n\nBuild a comprehensive picture of the problem and the relevant code. Surface\nexisting patterns, constraints, and prior decisions.\n\nLaunch up to 3 Explore subagents IN PARALLEL (single message, multiple tool\ncalls). Use 1 agent for narrow, well-scoped problems; use more when the spec\ntouches several subsystems or you need to compare existing implementations.\nQuality over quantity \u2014 3 agents maximum.\n\nAfter exploration, draft a high-level design: the shape of the solution, new or\nchanged pieces, the boundaries.\n\n### Phase 2: Requirements\n\nTranslate the shape into concrete behavioral requirements. Each requirement\nmust be:\n\n- Testable \u2014 has a clear pass/fail condition.\n- Behavior-focused \u2014 describes what the system does, not how.\n- Scoped \u2014 covers one observable behavior.\n\nGroup requirements by capability. Plain English is fine. For conditional or\nstateful behaviors, EARS templates sharpen phrasing:\n`When <trigger>, the system shall <behavior>` or\n`If <condition>, then the system shall <response>`.\n\nFor larger / multi-component designs, walk the design end-to-end: at each step\nfrom trigger to final state, verify preconditions, state, failure handling, and\nhandoffs between components are specified. Skip this for small self-contained\nspecs.\n\n### Phase 3: Deepen\n\nRead the critical files identified during Phase 1. Reconcile requirements\nagainst the shape \u2014 if a requirement reveals a gap in the design, refine the\ndesign before saving.\n\nUse AskUserQuestion ONLY to clarify requirements or choose between approaches.\nNever use it to ask \"is this spec okay?\" or \"should I save?\".\n\n### Phase 4: Compose the spec body\n\nRequired sections:\n\n # Spec: <one-line title>\n\n ## Context\n <the problem this spec addresses, what motivates it, and the intended outcome.\n Include relevant constraints \u2014 user goals, stakeholders, deadlines.>\n\n ## Design\n <the shape of the solution. Components, data flow, key decisions and why they\n were chosen. Reference existing code with `file_path:line_number`.>\n\n ## Requirements\n <grouped behavioral requirements. Each one testable. Plain English is fine.>\n\n ### <Capability A>\n - <one observable behavior>\n\n ### <Capability B>\n - ...\n\n ## Out of scope\n <things explicitly NOT covered, so the next reader knows where the edges are.>\n\n ## Open questions\n <anything you could not resolve. Empty if all decisions are pinned.>\n\n### Phase 5: Save\n\nRun `crtr flow spec new`:\n\n echo '<spec markdown>' | crtr flow spec new <kebab-case-name>\n\n- NAME: short kebab-case slug. Nested names become subdirectories\n (e.g. `auth/refresh-tokens`).\n- Pipe the full spec markdown composed in Phase 4 on stdin.\n\nOutput: `{path, follow_up}`. The `follow_up` field names the exact next call\n\u2014 run it.\n\n### Phase 6: Done\n\nAfter the reviewer approves the spec, your turn ends. Do not summarize in chat.\nFor a human gate, optionally run `crtr human review` on the spec for anchored\ncomments and `crtr human approve` to gate the handoff \u2014 this complements, not\nreplaces, `crtr job start reviewer`.\nIf the user is ready to plan, ask once whether to hand off; if yes, follow the\n`follow_up` instructions from the save output.";
|
|
2
|
+
import type { BranchDef } from '../core/command.js';
|
|
3
|
+
export declare function registerSpec(): BranchDef;
|
package/dist/commands/spec.js
CHANGED
|
@@ -1,13 +1,286 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
// `crtr flow spec` subtree — spec new / show / list handlers.
|
|
2
|
+
export const SPEC_NEW_GUIDE = `## Spec workflow
|
|
3
|
+
|
|
4
|
+
Build and save a design + requirements spec: a document describing what to
|
|
5
|
+
build, the shape of the solution, and the behaviors it must satisfy. A spec is
|
|
6
|
+
upstream of a plan — it captures decisions, not implementation steps.
|
|
7
|
+
|
|
8
|
+
Anti-pattern: do not fish for clarifications upfront. Draft a concrete spec
|
|
9
|
+
first based on your investigation, then iterate. A specific draft the user can
|
|
10
|
+
react to converges faster than a list of questions in a vacuum.
|
|
11
|
+
|
|
12
|
+
### Phase 1: Shape
|
|
13
|
+
|
|
14
|
+
Build a comprehensive picture of the problem and the relevant code. Surface
|
|
15
|
+
existing patterns, constraints, and prior decisions.
|
|
16
|
+
|
|
17
|
+
Launch up to 3 Explore subagents IN PARALLEL (single message, multiple tool
|
|
18
|
+
calls). Use 1 agent for narrow, well-scoped problems; use more when the spec
|
|
19
|
+
touches several subsystems or you need to compare existing implementations.
|
|
20
|
+
Quality over quantity — 3 agents maximum.
|
|
21
|
+
|
|
22
|
+
After exploration, draft a high-level design: the shape of the solution, new or
|
|
23
|
+
changed pieces, the boundaries.
|
|
24
|
+
|
|
25
|
+
### Phase 2: Requirements
|
|
26
|
+
|
|
27
|
+
Translate the shape into concrete behavioral requirements. Each requirement
|
|
28
|
+
must be:
|
|
29
|
+
|
|
30
|
+
- Testable — has a clear pass/fail condition.
|
|
31
|
+
- Behavior-focused — describes what the system does, not how.
|
|
32
|
+
- Scoped — covers one observable behavior.
|
|
33
|
+
|
|
34
|
+
Group requirements by capability. Plain English is fine. For conditional or
|
|
35
|
+
stateful behaviors, EARS templates sharpen phrasing:
|
|
36
|
+
\`When <trigger>, the system shall <behavior>\` or
|
|
37
|
+
\`If <condition>, then the system shall <response>\`.
|
|
38
|
+
|
|
39
|
+
For larger / multi-component designs, walk the design end-to-end: at each step
|
|
40
|
+
from trigger to final state, verify preconditions, state, failure handling, and
|
|
41
|
+
handoffs between components are specified. Skip this for small self-contained
|
|
42
|
+
specs.
|
|
43
|
+
|
|
44
|
+
### Phase 3: Deepen
|
|
45
|
+
|
|
46
|
+
Read the critical files identified during Phase 1. Reconcile requirements
|
|
47
|
+
against the shape — if a requirement reveals a gap in the design, refine the
|
|
48
|
+
design before saving.
|
|
49
|
+
|
|
50
|
+
Use AskUserQuestion ONLY to clarify requirements or choose between approaches.
|
|
51
|
+
Never use it to ask "is this spec okay?" or "should I save?".
|
|
52
|
+
|
|
53
|
+
### Phase 4: Compose the spec body
|
|
54
|
+
|
|
55
|
+
Required sections:
|
|
56
|
+
|
|
57
|
+
# Spec: <one-line title>
|
|
58
|
+
|
|
59
|
+
## Context
|
|
60
|
+
<the problem this spec addresses, what motivates it, and the intended outcome.
|
|
61
|
+
Include relevant constraints — user goals, stakeholders, deadlines.>
|
|
62
|
+
|
|
63
|
+
## Design
|
|
64
|
+
<the shape of the solution. Components, data flow, key decisions and why they
|
|
65
|
+
were chosen. Reference existing code with \`file_path:line_number\`.>
|
|
66
|
+
|
|
67
|
+
## Requirements
|
|
68
|
+
<grouped behavioral requirements. Each one testable. Plain English is fine.>
|
|
69
|
+
|
|
70
|
+
### <Capability A>
|
|
71
|
+
- <one observable behavior>
|
|
72
|
+
|
|
73
|
+
### <Capability B>
|
|
74
|
+
- ...
|
|
75
|
+
|
|
76
|
+
## Out of scope
|
|
77
|
+
<things explicitly NOT covered, so the next reader knows where the edges are.>
|
|
78
|
+
|
|
79
|
+
## Open questions
|
|
80
|
+
<anything you could not resolve. Empty if all decisions are pinned.>
|
|
81
|
+
|
|
82
|
+
### Phase 5: Save
|
|
83
|
+
|
|
84
|
+
Run \`crtr flow spec new\`:
|
|
85
|
+
|
|
86
|
+
echo '<spec markdown>' | crtr flow spec new <kebab-case-name>
|
|
87
|
+
|
|
88
|
+
- NAME: short kebab-case slug. Nested names become subdirectories
|
|
89
|
+
(e.g. \`auth/refresh-tokens\`).
|
|
90
|
+
- Pipe the full spec markdown composed in Phase 4 on stdin.
|
|
91
|
+
|
|
92
|
+
Output: \`{path, follow_up}\`. The \`follow_up\` field names the exact next call
|
|
93
|
+
— run it.
|
|
94
|
+
|
|
95
|
+
### Phase 6: Done
|
|
96
|
+
|
|
97
|
+
After the reviewer approves the spec, your turn ends. Do not summarize in chat.
|
|
98
|
+
For a human gate, optionally run \`crtr human review\` on the spec for anchored
|
|
99
|
+
comments and \`crtr human approve\` to gate the handoff — this complements, not
|
|
100
|
+
replaces, \`crtr job start reviewer\`.
|
|
101
|
+
If the user is ready to plan, ask once whether to hand off; if yes, follow the
|
|
102
|
+
\`follow_up\` instructions from the save output.`;
|
|
103
|
+
import { defineBranch, defineLeaf } from '../core/command.js';
|
|
104
|
+
import { saveArtifact, readArtifact, listArtifacts, OVERSIZE_WARN_LINES } from '../core/artifact.js';
|
|
105
|
+
import { paginate } from '../core/pagination.js';
|
|
106
|
+
export function registerSpec() {
|
|
107
|
+
const specNew = defineLeaf({
|
|
108
|
+
name: 'new',
|
|
109
|
+
help: {
|
|
110
|
+
name: 'spec new',
|
|
111
|
+
summary: 'draft a specification artifact from intent',
|
|
112
|
+
guide: SPEC_NEW_GUIDE,
|
|
113
|
+
params: [
|
|
114
|
+
{
|
|
115
|
+
kind: 'positional',
|
|
116
|
+
name: 'name',
|
|
117
|
+
type: 'string',
|
|
118
|
+
required: true,
|
|
119
|
+
constraint: 'Kebab-case slug used as the artifact filename. No spaces; use hyphens.',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
kind: 'stdin',
|
|
123
|
+
name: 'body',
|
|
124
|
+
required: true,
|
|
125
|
+
constraint: 'Full specification prose. Treated as ground truth for downstream planning.',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
output: [
|
|
129
|
+
{
|
|
130
|
+
name: 'path',
|
|
131
|
+
type: 'string',
|
|
132
|
+
required: true,
|
|
133
|
+
constraint: 'Absolute path to the written spec artifact.',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: 'follow_up',
|
|
137
|
+
type: 'string',
|
|
138
|
+
required: true,
|
|
139
|
+
constraint: 'Recommended next call (planner job start).',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
outputKind: 'object',
|
|
143
|
+
effects: ['Writes a spec artifact to the specs artifact directory.'],
|
|
11
144
|
},
|
|
145
|
+
run: async (input) => {
|
|
146
|
+
const name = input['name'];
|
|
147
|
+
const body = input['body'];
|
|
148
|
+
const { path, oversize, lineCount } = saveArtifact('specs', name, body);
|
|
149
|
+
let follow_up = `Plan it: crtr job start planner --artifact-path ${path} (returns {job_id}), then crtr job read result <job_id> --wait.`;
|
|
150
|
+
follow_up +=
|
|
151
|
+
` Optional human gate before planning (complements, does not replace \`crtr job start reviewer\`): crtr human review --file ${path} for anchored comments, then gate with crtr human approve --title "Approve this spec?".`;
|
|
152
|
+
if (oversize) {
|
|
153
|
+
follow_up +=
|
|
154
|
+
` OVERSIZE ADVISORY: this spec is ${lineCount} lines (> ${OVERSIZE_WARN_LINES}). Split into focused sub-specs before planning.`;
|
|
155
|
+
}
|
|
156
|
+
return { path, follow_up };
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
const specShow = defineLeaf({
|
|
160
|
+
name: 'show',
|
|
161
|
+
help: {
|
|
162
|
+
name: 'spec show',
|
|
163
|
+
summary: 'read a spec artifact by name',
|
|
164
|
+
params: [
|
|
165
|
+
{
|
|
166
|
+
kind: 'positional',
|
|
167
|
+
name: 'name',
|
|
168
|
+
type: 'string',
|
|
169
|
+
required: true,
|
|
170
|
+
constraint: 'Exact artifact name (no path extension). Use `spec list` to enumerate.',
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
output: [
|
|
174
|
+
{
|
|
175
|
+
name: 'name',
|
|
176
|
+
type: 'string',
|
|
177
|
+
required: true,
|
|
178
|
+
constraint: 'Artifact name as stored.',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'path',
|
|
182
|
+
type: 'string',
|
|
183
|
+
required: true,
|
|
184
|
+
constraint: 'Absolute path to the artifact file.',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
name: 'body',
|
|
188
|
+
type: 'string',
|
|
189
|
+
required: true,
|
|
190
|
+
constraint: 'Full spec body text.',
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
outputKind: 'object',
|
|
194
|
+
effects: ['None. Read-only.'],
|
|
195
|
+
},
|
|
196
|
+
run: async (input) => {
|
|
197
|
+
const name = input['name'];
|
|
198
|
+
const record = readArtifact('specs', name);
|
|
199
|
+
return { name: record.name, path: record.path, body: record.body };
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
const specList = defineLeaf({
|
|
203
|
+
name: 'list',
|
|
204
|
+
help: {
|
|
205
|
+
name: 'spec list',
|
|
206
|
+
summary: 'paginated list of spec artifacts, sorted ascending by name',
|
|
207
|
+
params: [
|
|
208
|
+
{
|
|
209
|
+
kind: 'flag',
|
|
210
|
+
name: 'scope',
|
|
211
|
+
type: 'enum',
|
|
212
|
+
choices: ['user', 'project', 'all'],
|
|
213
|
+
required: false,
|
|
214
|
+
constraint: 'Filter by scope. Omit to list all.',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
kind: 'flag',
|
|
218
|
+
name: 'limit',
|
|
219
|
+
type: 'int',
|
|
220
|
+
required: false,
|
|
221
|
+
default: 20,
|
|
222
|
+
constraint: 'Default 20, max 100.',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
kind: 'flag',
|
|
226
|
+
name: 'cursor',
|
|
227
|
+
type: 'string',
|
|
228
|
+
required: false,
|
|
229
|
+
constraint: "Opaque token from a previous response's next_cursor. Omit on first call.",
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
output: [
|
|
233
|
+
{
|
|
234
|
+
name: 'items',
|
|
235
|
+
type: 'object[]',
|
|
236
|
+
required: true,
|
|
237
|
+
constraint: 'Each: {name, path, updated_at}. Sorted ascending by name.',
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: 'next_cursor',
|
|
241
|
+
type: 'string | null',
|
|
242
|
+
required: true,
|
|
243
|
+
constraint: 'Pass on the next call to continue. null means no more items.',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: 'total',
|
|
247
|
+
type: 'integer | null',
|
|
248
|
+
required: true,
|
|
249
|
+
constraint: 'Total specs matching the query. Exact when cheap; null on large/filtered sets — do not retry to force it.',
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
outputKind: 'object',
|
|
253
|
+
effects: ['None. Read-only.'],
|
|
254
|
+
},
|
|
255
|
+
run: async (input) => {
|
|
256
|
+
const limit = input['limit'] ?? 20;
|
|
257
|
+
const cursor = input['cursor'];
|
|
258
|
+
const all = listArtifacts('specs');
|
|
259
|
+
const result = paginate(all, { limit, cursor }, {
|
|
260
|
+
defaultLimit: 20,
|
|
261
|
+
maxLimit: 100,
|
|
262
|
+
keyOf: (item) => item.name,
|
|
263
|
+
total: 'count',
|
|
264
|
+
});
|
|
265
|
+
return {
|
|
266
|
+
items: result.items,
|
|
267
|
+
next_cursor: result.next_cursor,
|
|
268
|
+
total: result.total,
|
|
269
|
+
};
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
return defineBranch({
|
|
273
|
+
name: 'spec',
|
|
274
|
+
help: {
|
|
275
|
+
name: 'spec',
|
|
276
|
+
summary: 'create and read specification artifacts',
|
|
277
|
+
model: 'Lifecycle: draft -> approved. Approved specs drive plan creation.',
|
|
278
|
+
children: [
|
|
279
|
+
{ name: 'new', desc: 'draft a spec from intent', useWhen: 'capturing requirements before planning' },
|
|
280
|
+
{ name: 'show', desc: 'read a spec by name', useWhen: 'reasoning about an existing spec' },
|
|
281
|
+
{ name: 'list', desc: 'enumerate specs', useWhen: 'discovering what specs exist' },
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
children: [specNew, specShow, specList],
|
|
12
285
|
});
|
|
13
286
|
}
|