@crouton-kit/crouter 0.1.4 → 0.1.7

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.
@@ -0,0 +1,114 @@
1
+ import { planPrompt } from './plan.js';
2
+ /**
3
+ * First user message for a spec → plan handoff.
4
+ * Bundles the full planning workflow with the spec to plan.
5
+ */
6
+ export function planHandoffPrompt(specPath, plansDir) {
7
+ return `${planPrompt(plansDir)}
8
+
9
+ ---
10
+
11
+ ## Your task
12
+
13
+ You were just launched in a new tmux pane via \`crtr agent plan\`. A spec
14
+ has been approved upstream and you are responsible for turning it into a plan.
15
+
16
+ **Spec to plan:** ${specPath}
17
+
18
+ Read the spec end-to-end before anything else. Then proceed through the
19
+ workflow above. When you save the plan, pass \`--spec <spec-name>\` so the
20
+ plan reviewer can check alignment.
21
+
22
+ The originating pane has closed; the user is watching you here. Begin now.`;
23
+ }
24
+ /**
25
+ * First user message for a plan → implementation handoff.
26
+ */
27
+ export function implementHandoffPrompt(planPath) {
28
+ return `You are an implementation agent. A plan has been approved upstream and your
29
+ job is to execute it: write code, run tests, verify the change works
30
+ end-to-end.
31
+
32
+ **Plan to implement:** ${planPath}
33
+
34
+ ## Process
35
+
36
+ 1. Read the plan end-to-end before touching code.
37
+ 2. If the plan references a spec (\`--spec\` was passed when saving), read it
38
+ too — it has the contract you are realizing.
39
+ 3. Read the files listed under "Files to modify / create" and "Existing
40
+ utilities to reuse" to ground yourself in the current code.
41
+ 4. Execute the plan step by step. Stay within scope — if the plan does not
42
+ call for a change, do not make it.
43
+ 5. After each meaningful change, run the verification described in the plan
44
+ (tests, manual checks). Fix anything that fails before continuing.
45
+ 6. When the plan is complete and verification passes, summarize what
46
+ shipped in a single short message: files touched, tests run, what works.
47
+
48
+ ## Guardrails
49
+
50
+ - **Do not redesign.** If the plan is wrong, surface the issue and ask;
51
+ do not silently substitute your own approach.
52
+ - **Do not expand scope.** No drive-by refactors, no "while I'm here" cleanup.
53
+ - **Honor existing conventions.** Match the file's style, naming, and
54
+ patterns. Use the utilities the plan named.
55
+ - Commit only if the user asks.
56
+
57
+ When verification passes, your turn ends. The user may then ask for a code
58
+ review via \`crtr agent review\`.
59
+
60
+ You were launched in a new tmux pane via \`crtr agent implement\`. The
61
+ originating pane has closed; the user is watching you here. Begin by reading
62
+ the plan.`;
63
+ }
64
+ /**
65
+ * First user message for a handoff to code review of the working tree.
66
+ */
67
+ export function reviewHandoffPrompt() {
68
+ return `You are a code reviewer. A change has just been implemented and your job is
69
+ to review it before it lands.
70
+
71
+ ## Scope
72
+
73
+ Review the **uncommitted** changes in the working tree of the current
74
+ directory. Use \`git status\` and \`git diff\` (including staged changes via
75
+ \`git diff --cached\`) to enumerate what changed. If there are zero changes,
76
+ say so and stop.
77
+
78
+ ## What to check
79
+
80
+ | Category | What to look for |
81
+ |----------|------------------|
82
+ | Correctness | Does the code do what it claims? Off-by-ones, wrong branches, missed cases. |
83
+ | Security | Injection, auth bypass, leaking secrets, unsafe defaults. |
84
+ | Style fit | Matches the file's existing conventions, naming, error-handling style. |
85
+ | Tests | Are there tests for new behavior? Do they actually exercise the change? |
86
+ | Scope | Did the change stay within its mandate, or sneak in unrelated edits? |
87
+ | Reuse | Are there existing utilities that should have been used? |
88
+
89
+ ## Calibration
90
+
91
+ Only flag issues that would matter to the next reader, on-call, or future
92
+ maintainer. Nits are fine in a "Recommendations" section, but **do not block
93
+ on style preferences**. Approve unless something is wrong, missing, or risky.
94
+
95
+ ## Output
96
+
97
+ \`\`\`
98
+ ## Code Review
99
+
100
+ **Status:** Approved | Issues Found
101
+
102
+ **Issues (if any):**
103
+ - [file:line]: [specific issue] — [why it matters]
104
+
105
+ **Recommendations (advisory):**
106
+ - [suggestions]
107
+ \`\`\`
108
+
109
+ After printing the review, your turn ends.
110
+
111
+ You were launched in a new tmux pane via \`crtr agent review\`. The
112
+ originating pane has closed; the user is watching you here. Begin by checking
113
+ the working tree.`;
114
+ }
@@ -87,14 +87,50 @@ EOF
87
87
 
88
88
  - Pick a short, descriptive kebab-case name. Names may be nested
89
89
  (\`crtr plan --name auth/jwt-refresh\`) — they become subdirectories.
90
+ - If this plan implements a saved spec, pass \`--spec <spec-name>\` so the
91
+ reviewer can check alignment:
92
+ \`crtr plan --name <name> --spec <spec-name> <<'EOF' ... EOF\`
90
93
  - The file lands at \`${plansDir}/<name>.md\`.
91
94
  - If you are running inside tmux, the saved plan auto-opens in a side pane
92
95
  via termrender. No extra step needed.
93
96
 
94
- ## Phase 5: Done
97
+ ## Phase 5: Review
95
98
 
96
- Your turn ends after the save command succeeds. No need to summarize the plan
97
- in chat the user can read the file.
99
+ By default the save command **blocks** while a reviewer agent reads the plan
100
+ (and the spec, if \`--spec\` was passed) in a side pane (10-min budget) and
101
+ returns its findings on stdout under a \`--- review ---\` marker. **Read the
102
+ review** when the command returns:
103
+
104
+ - If \`Status: Approved\`, you are done.
105
+ - If \`Status: Issues Found\`, address the listed issues by editing the plan
106
+ (\`crtr plan edit <name>\` or rewriting via the save command), then save
107
+ again to re-trigger review.
108
+
109
+ Pass \`--no-review\` only when the plan is genuinely trivial (one-line fix,
110
+ typo, single-file rename). For anything substantive, take the review.
111
+
112
+ ## Phase 6: Oversize check
113
+
114
+ If the save command emits a \`--- advisory ---\` warning that the plan is
115
+ too long, do not ignore it. Split the plan into a short index plan plus
116
+ one or more nested part plans, each under the threshold, and re-save. The
117
+ implementer will execute parts one at a time; very long plans tend to be
118
+ under-decomposed.
119
+
120
+ ## Phase 7: Done
121
+
122
+ After the review returns Approved (or you have addressed its issues), your
123
+ turn ends. No need to summarize the plan in chat — the user can read the file.
124
+
125
+ If the user is ready to start building, ask once whether they want to hand
126
+ off now. If yes, run:
127
+
128
+ \`\`\`bash
129
+ crtr agent implement --plan <name>
130
+ \`\`\`
131
+
132
+ This fires up an implementer in a new tmux pane and closes the current
133
+ pane a few seconds later. Do NOT run this without the user's go-ahead.
98
134
 
99
135
  ## See also
100
136
 
@@ -0,0 +1,2 @@
1
+ export declare function specReviewPrompt(specPath: string): string;
2
+ export declare function planReviewPrompt(planPath: string, specPath: string | null): string;
@@ -0,0 +1,103 @@
1
+ const SUBMIT_INSTRUCTIONS = `## Delivering your review
2
+
3
+ When your review is complete, run a single Bash command to submit it back to
4
+ the parent agent:
5
+
6
+ \`\`\`bash
7
+ crtr agent submit "$(cat <<'EOF'
8
+ <your full review markdown here, using the Output Format below>
9
+ EOF
10
+ )"
11
+ \`\`\`
12
+
13
+ The pane will close automatically once your review is delivered. Do NOT
14
+ summarize or chat after submission — \`crtr agent submit\` IS the response.
15
+
16
+ If you cannot complete the review (file missing, totally malformed, etc.),
17
+ still call \`crtr agent submit\` with a brief explanation of why.`;
18
+ export function specReviewPrompt(specPath) {
19
+ return `You are reviewing a spec document. Verify it is complete and ready for planning.
20
+
21
+ **Spec to review:** ${specPath}
22
+
23
+ ## What to Check
24
+
25
+ | Category | What to Look For |
26
+ |----------|------------------|
27
+ | Completeness | TODOs, placeholders, "TBD", incomplete sections |
28
+ | Consistency | Internal contradictions, conflicting requirements |
29
+ | Clarity | Requirements ambiguous enough to cause someone to build the wrong thing |
30
+ | Scope | Focused enough for a single plan — not covering multiple independent subsystems |
31
+ | YAGNI | Unrequested features, over-engineering |
32
+
33
+ ## Calibration
34
+
35
+ **Only flag issues that would cause real problems during implementation planning.**
36
+ A missing section, a contradiction, or a requirement so ambiguous it could be
37
+ interpreted two different ways — those are issues. Minor wording improvements,
38
+ stylistic preferences, and "sections less detailed than others" are not.
39
+
40
+ Approve unless there are serious gaps that would lead to a flawed plan.
41
+
42
+ ## Output Format
43
+
44
+ ## Spec Review
45
+
46
+ **Status:** Approved | Issues Found
47
+
48
+ **Issues (if any):**
49
+ - [Section X]: [specific issue] - [why it matters for planning]
50
+
51
+ **Recommendations (advisory, do not block approval):**
52
+ - [suggestions for improvement]
53
+
54
+ ${SUBMIT_INSTRUCTIONS}`;
55
+ }
56
+ export function planReviewPrompt(planPath, specPath) {
57
+ const inputs = specPath === null
58
+ ? `**Plan to review:** ${planPath}
59
+
60
+ No spec was provided for cross-reference — evaluate the plan on its own
61
+ merits (internal completeness, task decomposition, buildability). Skip the
62
+ "Spec Alignment" check.`
63
+ : `**Plan to review:** ${planPath}
64
+ **Spec for reference:** ${specPath}
65
+
66
+ Read the plan first, then the spec, then evaluate alignment and the other
67
+ criteria below.`;
68
+ return `You are reviewing a plan document. Verify it is complete and ready for implementation.
69
+
70
+ ${inputs}
71
+
72
+ ## What to Check
73
+
74
+ | Category | What to Look For |
75
+ |----------|------------------|
76
+ | Completeness | TODOs, placeholders, incomplete tasks, missing steps |
77
+ | Spec Alignment | Plan covers spec requirements, no major scope creep |
78
+ | Task Decomposition | Tasks have clear boundaries, steps are actionable |
79
+ | Buildability | Could an engineer follow this plan without getting stuck? |
80
+
81
+ ## Calibration
82
+
83
+ **Only flag issues that would cause real problems during implementation.**
84
+ An implementer building the wrong thing or getting stuck is an issue.
85
+ Minor wording, stylistic preferences, and "nice to have" suggestions are not.
86
+
87
+ Approve unless there are serious gaps — missing requirements from the spec,
88
+ contradictory steps, placeholder content, or tasks so vague they can't be acted on.
89
+
90
+ ## Output Format
91
+
92
+ ## Plan Review
93
+
94
+ **Status:** Approved | Issues Found
95
+
96
+ **Issues (if any):**
97
+ - [Task X, Step Y]: [specific issue] - [why it matters for implementation]
98
+
99
+ **Recommendations (advisory, do not block approval):**
100
+ - [suggestions for improvement]
101
+
102
+ ${SUBMIT_INSTRUCTIONS}`;
103
+ }
@@ -1 +1,3 @@
1
1
  export declare function skillPrompt(): string;
2
+ export declare function skillCreatePrompt(topic: string): string;
3
+ export declare function skillTemplatePrompt(type: string, topic: string): string;