@crouton-kit/crouter 0.2.6 → 0.3.2
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 +294 -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 +613 -456
- 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 -4
- 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/core/self-update.js +105 -0
- 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/commands/update.js +0 -140
- 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/prompts/agent.js
CHANGED
|
@@ -1,30 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { planReviewPrompt, specReviewPrompt } from './review.js';
|
|
2
2
|
/**
|
|
3
3
|
* First user message for a spec → plan handoff.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* Thin prompt: the worker discovers the full planning workflow by running
|
|
6
|
+
* `crtr flow plan new -h`, then saves the plan via `crtr flow plan new`. This avoids
|
|
7
|
+
* embedding the planPrompt() blob here and keeps the prompt in sync with the
|
|
8
|
+
* live CLI without any coupling.
|
|
5
9
|
*/
|
|
6
|
-
export function planHandoffPrompt(specPath,
|
|
7
|
-
return
|
|
10
|
+
export function planHandoffPrompt(specPath, jobId) {
|
|
11
|
+
return `You were launched in a new tmux pane to turn an approved spec into a plan.
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
**Spec:** ${specPath}
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
1. Run \`crtr flow plan new -h\` to load the planning workflow and output schema.
|
|
16
|
+
2. Read the spec end-to-end.
|
|
17
|
+
3. Follow the workflow from step 1 and save the plan by passing the plan markdown to \`crtr flow plan new\` on stdin.
|
|
18
|
+
4. When done, submit your result:
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
\`\`\`bash
|
|
21
|
+
echo '{"status":"done","plan_saved":true}' > /tmp/crtr-result-${jobId}.json
|
|
22
|
+
crtr job submit ${jobId} --context-file /tmp/crtr-result-${jobId}.json
|
|
23
|
+
\`\`\`
|
|
15
24
|
|
|
16
|
-
|
|
25
|
+
If you cannot complete the plan, still submit:
|
|
17
26
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
\`\`\`bash
|
|
28
|
+
echo '{"status":"failed","reason":"<why>"}' > /tmp/crtr-result-${jobId}.json
|
|
29
|
+
crtr job submit ${jobId} --context-file /tmp/crtr-result-${jobId}.json
|
|
30
|
+
\`\`\`
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
Begin now.`;
|
|
23
33
|
}
|
|
24
34
|
/**
|
|
25
35
|
* First user message for a plan → implementation handoff.
|
|
26
36
|
*/
|
|
27
|
-
export function implementHandoffPrompt(planPath) {
|
|
37
|
+
export function implementHandoffPrompt(planPath, jobId) {
|
|
28
38
|
return `You are executing an approved plan. For small plans, implement directly.
|
|
29
39
|
For plans with parallelizable scale, orchestrate parallel subagents and
|
|
30
40
|
coordinate them — don't write all the code yourself when the plan is
|
|
@@ -34,11 +44,9 @@ structured to fan out.
|
|
|
34
44
|
|
|
35
45
|
## Phase 1: Read
|
|
36
46
|
|
|
37
|
-
1. Read the plan end-to-end. If it references a spec
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
per-task \`Files:\` lines) and "Existing utilities to reuse" to ground
|
|
41
|
-
yourself in current code.
|
|
47
|
+
1. Read the plan end-to-end. If it references a spec, read that too.
|
|
48
|
+
2. Read the files the plan names under "Files to modify / create" and
|
|
49
|
+
"Existing utilities to reuse" to ground yourself in current code.
|
|
42
50
|
3. If the plan has task blocks with dependencies, extract the task list,
|
|
43
51
|
dependency graph, and integration contracts.
|
|
44
52
|
|
|
@@ -101,11 +109,20 @@ Wait for all subagents in the current layer. Then:
|
|
|
101
109
|
subagent returns blocked work and the fix is small enough that re-dispatch
|
|
102
110
|
would be slower.
|
|
103
111
|
|
|
104
|
-
## Phase 6: Report
|
|
112
|
+
## Phase 6: Report and submit
|
|
113
|
+
|
|
114
|
+
When all tasks complete and verification passes, submit your result:
|
|
105
115
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
\`\`\`bash
|
|
117
|
+
echo '{"status":"done","summary":"<one-line summary of files touched>"}' > /tmp/crtr-result-${jobId}.json
|
|
118
|
+
crtr job submit ${jobId} --context-file /tmp/crtr-result-${jobId}.json
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
If implementation fails, still submit:
|
|
122
|
+
\`\`\`bash
|
|
123
|
+
echo '{"status":"failed","reason":"<why>"}' > /tmp/crtr-result-${jobId}.json
|
|
124
|
+
crtr job submit ${jobId} --context-file /tmp/crtr-result-${jobId}.json
|
|
125
|
+
\`\`\`
|
|
109
126
|
|
|
110
127
|
## Guardrails (apply to you AND your subagents)
|
|
111
128
|
|
|
@@ -117,58 +134,18 @@ a code review via \`crtr agent review\`.
|
|
|
117
134
|
patterns. Use the utilities the plan named.
|
|
118
135
|
- **Commit only if the user asks.**
|
|
119
136
|
|
|
120
|
-
|
|
121
|
-
originating pane has closed; the user is watching you here. Begin by reading
|
|
122
|
-
the plan.`;
|
|
137
|
+
Begin by reading the plan.`;
|
|
123
138
|
}
|
|
124
139
|
/**
|
|
125
|
-
* First user message for a
|
|
140
|
+
* First user message for a reviewer agent.
|
|
141
|
+
* The reviewer submits via `crtr job submit` rather than `crtr agent submit`.
|
|
126
142
|
*/
|
|
127
|
-
export function
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
\`git diff --cached\`) to enumerate what changed. If there are zero changes,
|
|
136
|
-
say so and stop.
|
|
137
|
-
|
|
138
|
-
## What to check
|
|
139
|
-
|
|
140
|
-
| Category | What to look for |
|
|
141
|
-
|----------|------------------|
|
|
142
|
-
| Correctness | Does the code do what it claims? Off-by-ones, wrong branches, missed cases. |
|
|
143
|
-
| Security | Injection, auth bypass, leaking secrets, unsafe defaults. |
|
|
144
|
-
| Style fit | Matches the file's existing conventions, naming, error-handling style. |
|
|
145
|
-
| Tests | Are there tests for new behavior? Do they actually exercise the change? |
|
|
146
|
-
| Scope | Did the change stay within its mandate, or sneak in unrelated edits? |
|
|
147
|
-
| Reuse | Are there existing utilities that should have been used? |
|
|
148
|
-
|
|
149
|
-
## Calibration
|
|
150
|
-
|
|
151
|
-
Only flag issues that would matter to the next reader, on-call, or future
|
|
152
|
-
maintainer. Nits are fine in a "Recommendations" section, but **do not block
|
|
153
|
-
on style preferences**. Approve unless something is wrong, missing, or risky.
|
|
154
|
-
|
|
155
|
-
## Output
|
|
156
|
-
|
|
157
|
-
\`\`\`
|
|
158
|
-
## Code Review
|
|
159
|
-
|
|
160
|
-
**Status:** Approved | Issues Found
|
|
161
|
-
|
|
162
|
-
**Issues (if any):**
|
|
163
|
-
- [file:line]: [specific issue] — [why it matters]
|
|
164
|
-
|
|
165
|
-
**Recommendations (advisory):**
|
|
166
|
-
- [suggestions]
|
|
167
|
-
\`\`\`
|
|
168
|
-
|
|
169
|
-
After printing the review, your turn ends.
|
|
170
|
-
|
|
171
|
-
You were launched in a new tmux pane via \`crtr agent review\`. The
|
|
172
|
-
originating pane has closed; the user is watching you here. Begin by checking
|
|
173
|
-
the working tree.`;
|
|
143
|
+
export function reviewerHandoffPrompt(artifactPath, artifactKind, specPath, jobId) {
|
|
144
|
+
const reviewBody = artifactKind === 'spec'
|
|
145
|
+
? specReviewPrompt(artifactPath)
|
|
146
|
+
: planReviewPrompt(artifactPath, specPath);
|
|
147
|
+
const patched = reviewBody.replace('__CRTR_SUBMIT_INSTRUCTION__', `the submit command injected below. The \`--kill-pane\` flag closes this reviewer pane after submission — keep it, do not drop it.\n\n\`\`\`bash\ncat > /tmp/crtr-result-${jobId}.json <<'JSON'\n{"status":"done","review":"<your full review markdown>"}\nJSON\ncrtr job submit ${jobId} --context-file /tmp/crtr-result-${jobId}.json --kill-pane\n\`\`\``);
|
|
148
|
+
return `${patched}
|
|
149
|
+
|
|
150
|
+
After calling \`crtr job submit\`, your turn ends and the pane closes itself. Do NOT chat or summarize after submission.`;
|
|
174
151
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First user message for a reproduction-only debug handoff.
|
|
3
|
+
*
|
|
4
|
+
* The agent's sole job is ONE failing integration test that reproduces the
|
|
5
|
+
* reported bug. It never fixes the bug. Symmetric with the agent.ts handoff
|
|
6
|
+
* builders: thin prompt, exact submit contract, turn ends after submit.
|
|
7
|
+
*/
|
|
8
|
+
export declare function reproHandoffPrompt(issue: string, jobId: string): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First user message for a reproduction-only debug handoff.
|
|
3
|
+
*
|
|
4
|
+
* The agent's sole job is ONE failing integration test that reproduces the
|
|
5
|
+
* reported bug. It never fixes the bug. Symmetric with the agent.ts handoff
|
|
6
|
+
* builders: thin prompt, exact submit contract, turn ends after submit.
|
|
7
|
+
*/
|
|
8
|
+
export function reproHandoffPrompt(issue, jobId) {
|
|
9
|
+
return `You were spawned solely to write ONE integration test that fails *because of this bug*:
|
|
10
|
+
|
|
11
|
+
${issue}
|
|
12
|
+
|
|
13
|
+
Rules — follow exactly:
|
|
14
|
+
|
|
15
|
+
- Do NOT fix the bug. Do NOT modify product code to make a test pass. Your only output is a test.
|
|
16
|
+
- The test must fail against the current code, and the failure must BE the reported bug — not an import error, a typo, or an unrelated assertion. Run it; paste the real failing output; confirm the failure mode matches the issue.
|
|
17
|
+
- Prefer an integration test against real dependencies. Mocking away the broken component is theater and does NOT count as reproduction.
|
|
18
|
+
- If you cannot produce a faithful failing test, GIVE UP. Never weaken assertions, hardcode expected values, or fabricate a clean-looking run — a tautological or over-mocked test is worse than none.
|
|
19
|
+
|
|
20
|
+
Submit exactly one of the following via \`crtr job submit\`, then your turn ends — do not chat:
|
|
21
|
+
|
|
22
|
+
Reproduced:
|
|
23
|
+
\`\`\`bash
|
|
24
|
+
cat > /tmp/crtr-result-${jobId}.json <<'JSON'
|
|
25
|
+
{"status":"done","reproduces":true,"test_path":"<path>","test_command":"<exact cmd>","failure_output":"<pasted failing output>"}
|
|
26
|
+
JSON
|
|
27
|
+
crtr job submit ${jobId} --context-file /tmp/crtr-result-${jobId}.json
|
|
28
|
+
\`\`\`
|
|
29
|
+
|
|
30
|
+
Gave up (no faithful repro achievable):
|
|
31
|
+
\`\`\`bash
|
|
32
|
+
echo '{"status":"failed","reproduces":false,"reason":"<why a faithful repro was not achievable>"}' > /tmp/crtr-result-${jobId}.json
|
|
33
|
+
crtr job submit ${jobId} --context-file /tmp/crtr-result-${jobId}.json
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
Begin now.`;
|
|
37
|
+
}
|
package/dist/prompts/review.js
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
const SUBMIT_INSTRUCTIONS = `## Delivering your review
|
|
2
2
|
|
|
3
|
-
When your review is complete,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
\`\`\`bash
|
|
7
|
-
crtr agent submit "$(cat <<'EOF'
|
|
8
|
-
<your full review markdown here, using the Output Format below>
|
|
9
|
-
EOF
|
|
10
|
-
)"
|
|
11
|
-
\`\`\`
|
|
3
|
+
When your review is complete, deliver your verdict as instructed by
|
|
4
|
+
__CRTR_SUBMIT_INSTRUCTION__
|
|
12
5
|
|
|
13
6
|
The pane will close automatically once your review is delivered. Do NOT
|
|
14
|
-
summarize or chat after submission —
|
|
7
|
+
summarize or chat after submission — the submit call IS the response.
|
|
15
8
|
|
|
16
9
|
If you cannot complete the review (file missing, totally malformed, etc.),
|
|
17
|
-
still
|
|
10
|
+
still submit with a brief explanation of why.`;
|
|
18
11
|
export function specReviewPrompt(specPath) {
|
|
19
12
|
return `You are reviewing a spec document. Verify it is complete and ready for
|
|
20
13
|
planning.
|
package/dist/prompts/skill.d.ts
CHANGED