whitesmith 0.0.2 → 0.0.4

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.
Files changed (50) hide show
  1. package/README.md +286 -88
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +90 -2
  4. package/dist/cli.js.map +1 -1
  5. package/dist/comment.d.ts.map +1 -1
  6. package/dist/comment.js +18 -11
  7. package/dist/comment.js.map +1 -1
  8. package/dist/git.d.ts +5 -3
  9. package/dist/git.d.ts.map +1 -1
  10. package/dist/git.js +20 -29
  11. package/dist/git.js.map +1 -1
  12. package/dist/harnesses/pi.d.ts.map +1 -1
  13. package/dist/harnesses/pi.js +22 -6
  14. package/dist/harnesses/pi.js.map +1 -1
  15. package/dist/index.d.ts +3 -1
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +2 -1
  18. package/dist/index.js.map +1 -1
  19. package/dist/orchestrator.d.ts +31 -3
  20. package/dist/orchestrator.d.ts.map +1 -1
  21. package/dist/orchestrator.js +214 -10
  22. package/dist/orchestrator.js.map +1 -1
  23. package/dist/prompts.d.ts +52 -0
  24. package/dist/prompts.d.ts.map +1 -1
  25. package/dist/prompts.js +197 -0
  26. package/dist/prompts.js.map +1 -1
  27. package/dist/providers/github-ci.d.ts +40 -0
  28. package/dist/providers/github-ci.d.ts.map +1 -1
  29. package/dist/providers/github-ci.js +463 -213
  30. package/dist/providers/github-ci.js.map +1 -1
  31. package/dist/providers/index.d.ts +1 -1
  32. package/dist/providers/index.d.ts.map +1 -1
  33. package/dist/review.d.ts +48 -0
  34. package/dist/review.d.ts.map +1 -0
  35. package/dist/review.js +221 -0
  36. package/dist/review.js.map +1 -0
  37. package/dist/types.d.ts +4 -0
  38. package/dist/types.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/cli.ts +116 -3
  41. package/src/comment.ts +20 -14
  42. package/src/git.ts +23 -30
  43. package/src/harnesses/pi.ts +27 -6
  44. package/src/index.ts +9 -1
  45. package/src/orchestrator.ts +253 -14
  46. package/src/prompts.ts +239 -0
  47. package/src/providers/github-ci.ts +513 -217
  48. package/src/providers/index.ts +1 -1
  49. package/src/review.ts +290 -0
  50. package/src/types.ts +4 -0
package/src/prompts.ts CHANGED
@@ -68,6 +68,245 @@ Do NOT push. Do NOT create a PR. The orchestrator will handle that.
68
68
  `;
69
69
  }
70
70
 
71
+ // ─── Review Prompts ──────────────────────────────────────────────────────────
72
+
73
+ export interface ReviewTaskProposalArgs {
74
+ issueNumber: number;
75
+ issueTitle: string;
76
+ issueBody: string;
77
+ issueUrl: string;
78
+ tasks: Array<{id: string; title: string; content: string; filePath: string}>;
79
+ taskPRUrl?: string;
80
+ responseFile: string;
81
+ }
82
+
83
+ /**
84
+ * Build the prompt for reviewing a task proposal.
85
+ * Ensures proposed tasks are detailed, precise, and properly cover the issue.
86
+ */
87
+ export function buildReviewTaskProposalPrompt(args: ReviewTaskProposalArgs): string {
88
+ const taskList = args.tasks
89
+ .map((t) => `### Task ${t.id}: ${t.title}\n\n**File:** \`${t.filePath}\`\n\n${t.content}`)
90
+ .join('\n\n---\n\n');
91
+
92
+ return `# Review: Task Proposal for Issue #${args.issueNumber}
93
+
94
+ ## Issue
95
+ **Title:** ${args.issueTitle}
96
+ **URL:** ${args.issueUrl}
97
+
98
+ ### Description
99
+ ${args.issueBody}
100
+ ${args.taskPRUrl ? `\n**Task PR:** ${args.taskPRUrl}\n` : ''}
101
+ ## Proposed Tasks
102
+
103
+ ${taskList || '_No task files found._'}
104
+
105
+ ## Your Job
106
+
107
+ You are reviewing the proposed task breakdown for the issue above. Your goal is to ensure
108
+ the tasks are **detailed enough**, **precise**, and **complete** so that another AI agent
109
+ can implement them without ambiguity.
110
+
111
+ ### Review Criteria
112
+
113
+ 1. **Coverage**: Do the tasks fully address the issue? Are there missing aspects?
114
+ 2. **Clarity**: Is each task description clear and unambiguous? Could an AI agent implement it without asking questions?
115
+ 3. **Granularity**: Are tasks the right size? Not too large (hard to review) or too small (unnecessary overhead).
116
+ 4. **Acceptance Criteria**: Does each task have clear, verifiable acceptance criteria?
117
+ 5. **Dependencies**: Are task dependencies correct? Could any tasks be parallelized?
118
+ 6. **Implementation Notes**: Are there enough hints about which files/modules to modify?
119
+ 7. **Consistency**: Do the tasks follow the existing codebase patterns and conventions?
120
+
121
+ ### Instructions
122
+
123
+ 1. **Explore the codebase** to understand the architecture and verify the tasks make sense.
124
+ 2. **Read each task file** carefully.
125
+ 3. **Write your review** to \`${args.responseFile}\`.
126
+
127
+ Your review MUST start with a verdict line as the very first line:
128
+
129
+ \`\`\`
130
+ VERDICT: APPROVE
131
+ \`\`\`
132
+
133
+ or:
134
+
135
+ \`\`\`
136
+ VERDICT: REQUEST_CHANGES
137
+ \`\`\`
138
+
139
+ Followed by:
140
+ - An overall assessment explaining your verdict
141
+ - Per-task feedback (if any issues found)
142
+ - Suggestions for improvement
143
+ - Any missing tasks or concerns
144
+
145
+ Use markdown formatting. Be constructive and specific.
146
+
147
+ Do NOT modify any files other than \`${args.responseFile}\`.
148
+ Do NOT commit, push, or create PRs.
149
+ `;
150
+ }
151
+
152
+ export interface ReviewImplementationPRArgs {
153
+ prNumber: number;
154
+ prTitle: string;
155
+ prBody: string;
156
+ prBranch: string;
157
+ prUrl: string;
158
+ parentIssue?: {
159
+ number: number;
160
+ title: string;
161
+ body: string;
162
+ url: string;
163
+ };
164
+ responseFile: string;
165
+ }
166
+
167
+ /**
168
+ * Build the prompt for reviewing an implementation PR.
169
+ * Performs a detailed code review looking for bugs, quality issues, etc.
170
+ */
171
+ export function buildReviewImplementationPRPrompt(args: ReviewImplementationPRArgs): string {
172
+ const issueContext = args.parentIssue
173
+ ? `\n## Parent Issue\n**#${args.parentIssue.number}:** ${args.parentIssue.title}\n**URL:** ${args.parentIssue.url}\n\n### Issue Description\n${args.parentIssue.body}\n`
174
+ : '';
175
+
176
+ return `# Review: Pull Request #${args.prNumber}
177
+
178
+ ## Pull Request
179
+ **Title:** ${args.prTitle}
180
+ **URL:** ${args.prUrl}
181
+ **Branch:** ${args.prBranch}
182
+
183
+ ### PR Description
184
+ ${args.prBody}
185
+ ${issueContext}
186
+ ## Your Job
187
+
188
+ You are performing a detailed code review of this pull request. You are on the PR branch
189
+ (\`${args.prBranch}\`) and have full access to the codebase.
190
+
191
+ ### Review Criteria
192
+
193
+ 1. **Correctness**: Does the code work as intended? Are there any bugs or logic errors?
194
+ 2. **Edge Cases**: Are edge cases handled? Could inputs cause crashes or unexpected behavior?
195
+ 3. **Security**: Are there any security concerns (injection, data leaks, etc.)?
196
+ 4. **Performance**: Are there any performance issues or inefficiencies?
197
+ 5. **Code Quality**: Is the code clean, readable, and well-structured?
198
+ 6. **Conventions**: Does it follow the existing codebase patterns and style?
199
+ 7. **Tests**: Are there adequate tests? Are existing tests still passing?
200
+ 8. **Error Handling**: Are errors handled gracefully?
201
+ 9. **Documentation**: Are changes documented where needed?
202
+ 10. **Completeness**: Does it fully address the issue/task requirements?
203
+
204
+ ### Instructions
205
+
206
+ 1. **Examine the diff** by running \`git diff main...HEAD\` to see all changes.
207
+ 2. **Explore the codebase** to understand how the changes fit in.
208
+ 3. **Read the changed files** in full context.
209
+ 4. **Write your review** to \`${args.responseFile}\`.
210
+
211
+ Your review MUST start with a verdict line as the very first line:
212
+
213
+ \`\`\`
214
+ VERDICT: APPROVE
215
+ \`\`\`
216
+
217
+ or:
218
+
219
+ \`\`\`
220
+ VERDICT: REQUEST_CHANGES
221
+ \`\`\`
222
+
223
+ Followed by:
224
+ - An overall assessment explaining your verdict
225
+ - Specific issues found (with file paths and line references)
226
+ - Suggestions for improvement
227
+ - Any potential bugs or concerns
228
+
229
+ Use markdown formatting. Be thorough but constructive.
230
+
231
+ Do NOT modify any files other than \`${args.responseFile}\`.
232
+ Do NOT commit, push, or create PRs.
233
+ `;
234
+ }
235
+
236
+ export interface ReviewTaskCompletionArgs {
237
+ issueNumber: number;
238
+ issueTitle: string;
239
+ issueBody: string;
240
+ issueUrl: string;
241
+ implPRUrl?: string;
242
+ implBranch: string;
243
+ responseFile: string;
244
+ }
245
+
246
+ /**
247
+ * Build the prompt for reviewing completed tasks.
248
+ * Ensures the tasks were followed properly and checks for bugs or potential issues.
249
+ */
250
+ export function buildReviewTaskCompletionPrompt(args: ReviewTaskCompletionArgs): string {
251
+ return `# Review: Task Completion for Issue #${args.issueNumber}
252
+
253
+ ## Issue
254
+ **Title:** ${args.issueTitle}
255
+ **URL:** ${args.issueUrl}
256
+ ${args.implPRUrl ? `**Implementation PR:** ${args.implPRUrl}\n` : ''}
257
+ ### Issue Description
258
+ ${args.issueBody}
259
+
260
+ ## Your Job
261
+
262
+ You are reviewing the completed implementation for this issue. All tasks have been
263
+ implemented on the \`${args.implBranch}\` branch (you are currently on it).
264
+
265
+ ### Review Criteria
266
+
267
+ 1. **Task Adherence**: Were the original tasks followed? Check the git log for task commits.
268
+ 2. **Completeness**: Is the issue fully addressed? Are there any missing pieces?
269
+ 3. **Bugs**: Are there any bugs or logic errors in the implementation?
270
+ 4. **Edge Cases**: Are edge cases handled properly?
271
+ 5. **Regressions**: Could any changes break existing functionality?
272
+ 6. **Code Quality**: Is the code clean, well-structured, and following conventions?
273
+ 7. **Tests**: Are there adequate tests for the new functionality?
274
+ 8. **Security**: Any security concerns?
275
+ 9. **Performance**: Any performance issues?
276
+
277
+ ### Instructions
278
+
279
+ 1. **Examine the full diff** by running \`git diff main...HEAD\` to see all changes.
280
+ 2. **Check the git log** with \`git log main..HEAD --oneline\` to see all task commits.
281
+ 3. **Read the original task files** on main with \`git show main:tasks/${args.issueNumber}/\` (if they exist).
282
+ 4. **Explore the changed code** in full context.
283
+ 5. **Write your review** to \`${args.responseFile}\`.
284
+
285
+ Your review MUST start with a verdict line as the very first line:
286
+
287
+ \`\`\`
288
+ VERDICT: APPROVE
289
+ \`\`\`
290
+
291
+ or:
292
+
293
+ \`\`\`
294
+ VERDICT: REQUEST_CHANGES
295
+ \`\`\`
296
+
297
+ Followed by:
298
+ - An overall assessment explaining your verdict
299
+ - Whether each task was properly completed
300
+ - Any bugs, issues, or concerns found
301
+ - Suggestions for improvement
302
+
303
+ Use markdown formatting. Be thorough but constructive.
304
+
305
+ Do NOT modify any files other than \`${args.responseFile}\`.
306
+ Do NOT commit, push, or create PRs.
307
+ `;
308
+ }
309
+
71
310
  /**
72
311
  * Build the prompt for the "implement" phase.
73
312
  * The agent implements a specific task and deletes the task file.