wdyt 0.1.3 → 0.1.5

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wdyt",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "description": "Code review context builder for LLMs - what do you think?",
6
6
  "license": "MIT",
@@ -87,39 +87,24 @@ async function claudeCliAvailable(): Promise<boolean> {
87
87
  }
88
88
 
89
89
  /**
90
- * Run a review using Claude CLI
91
- * Returns the review output including verdict
90
+ * Run a chat using Claude CLI
91
+ * Sends the prompt + context to Claude and returns the response
92
92
  */
93
- async function runClaudeReview(contextPath: string, prompt: string): Promise<string> {
93
+ async function runClaudeChat(contextPath: string, prompt: string): Promise<string> {
94
94
  // Read the context file content first
95
95
  const contextFile = Bun.file(contextPath);
96
96
  const contextContent = await contextFile.text();
97
97
 
98
- const reviewPrompt = `You are reviewing code changes. Analyze the following context and provide a thorough review.
99
-
100
- Review instructions:
101
- ${prompt}
98
+ // Build the full prompt with context
99
+ const fullPrompt = `${prompt}
102
100
 
103
101
  <context>
104
102
  ${contextContent}
105
- </context>
106
-
107
- Analyze the code for:
108
- - Correctness - Logic errors, bugs, spec compliance
109
- - Security - Injection risks, auth gaps, data exposure
110
- - Simplicity - Over-engineering, unnecessary complexity
111
- - Edge cases - Failure modes, boundary conditions
112
-
113
- Provide findings organized by severity (Critical > Major > Minor).
114
-
115
- REQUIRED: End your review with exactly one verdict tag:
116
- <verdict>SHIP</verdict> - Code is production-ready
117
- <verdict>NEEDS_WORK</verdict> - Issues must be fixed first
118
- <verdict>MAJOR_RETHINK</verdict> - Fundamental problems require redesign`;
103
+ </context>`;
119
104
 
120
105
  // Write prompt to temp file to avoid shell escaping issues
121
- const tempPromptPath = join(getChatsDir(), `review-prompt-${Date.now()}.txt`);
122
- await Bun.write(tempPromptPath, reviewPrompt);
106
+ const tempPromptPath = join(getChatsDir(), `prompt-${Date.now()}.txt`);
107
+ await Bun.write(tempPromptPath, fullPrompt);
123
108
 
124
109
  try {
125
110
  // Run claude CLI in print mode, reading from temp file
@@ -318,34 +303,24 @@ export async function chatSendCommand(
318
303
  const chatPath = join(chatsDir, `${chatId}.xml`);
319
304
  await Bun.write(chatPath, xmlContent);
320
305
 
321
- // Check if this is a review request - if so, run Claude CLI to do the review
322
- const isReviewMode = payload.mode === "review";
323
-
324
- if (isReviewMode) {
325
- // Check if claude CLI is available
326
- if (!(await claudeCliAvailable())) {
327
- return {
328
- success: false,
329
- error: "Review mode requires Claude CLI (claude) to be installed and in PATH",
330
- };
331
- }
332
-
333
- // Run the review using Claude CLI
334
- console.error("Running review with Claude CLI...");
335
- const reviewOutput = await runClaudeReview(chatPath, prompt);
306
+ // Always run Claude CLI to process the chat - that's what a drop-in rp-cli replacement does
307
+ if (await claudeCliAvailable()) {
308
+ console.error("[wdyt] Processing with Claude CLI...");
309
+ const response = await runClaudeChat(chatPath, prompt);
336
310
 
337
311
  return {
338
312
  success: true,
339
- data: { id: chatId, path: chatPath, review: reviewOutput },
340
- output: `Chat: \`${chatId}\`\n\n${reviewOutput}`,
313
+ data: { id: chatId, path: chatPath, review: response },
314
+ output: `Chat: \`${chatId}\`\n\n${response}`,
341
315
  };
342
316
  }
343
317
 
344
- // Return in the expected format: Chat: `<uuid>`
318
+ // Fallback: just return the chat ID if Claude CLI isn't available
319
+ console.error("[wdyt] Claude CLI not found, returning context only");
345
320
  return {
346
321
  success: true,
347
322
  data: { id: chatId, path: chatPath },
348
- output: `Chat: \`${chatId}\``,
323
+ output: `Chat: \`${chatId}\`\n\nContext exported to: ${chatPath}\n(Install Claude CLI for automatic LLM processing)`,
349
324
  };
350
325
  } catch (error) {
351
326
  const message = error instanceof Error ? error.message : String(error);