wdyt 0.1.4 → 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 +1 -1
- package/src/commands/chat.ts +17 -48
package/package.json
CHANGED
package/src/commands/chat.ts
CHANGED
|
@@ -87,39 +87,24 @@ async function claudeCliAvailable(): Promise<boolean> {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* Run a
|
|
91
|
-
*
|
|
90
|
+
* Run a chat using Claude CLI
|
|
91
|
+
* Sends the prompt + context to Claude and returns the response
|
|
92
92
|
*/
|
|
93
|
-
async function
|
|
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
|
-
|
|
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(), `
|
|
122
|
-
await Bun.write(tempPromptPath,
|
|
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,40 +303,24 @@ export async function chatSendCommand(
|
|
|
318
303
|
const chatPath = join(chatsDir, `${chatId}.xml`);
|
|
319
304
|
await Bun.write(chatPath, xmlContent);
|
|
320
305
|
|
|
321
|
-
//
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
process.env.WDYT_REVIEW === "1" ||
|
|
326
|
-
prompt.includes("[REVIEW]");
|
|
327
|
-
|
|
328
|
-
if (isReviewMode) {
|
|
329
|
-
console.error(`[wdyt] Review mode triggered (mode=${payload.mode}, env=${process.env.WDYT_REVIEW || "unset"})`);
|
|
330
|
-
|
|
331
|
-
// Check if claude CLI is available
|
|
332
|
-
if (!(await claudeCliAvailable())) {
|
|
333
|
-
return {
|
|
334
|
-
success: false,
|
|
335
|
-
error: "Review mode requires Claude CLI (claude) to be installed and in PATH",
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Run the review using Claude CLI
|
|
340
|
-
console.error("[wdyt] Running review with Claude CLI...");
|
|
341
|
-
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);
|
|
342
310
|
|
|
343
311
|
return {
|
|
344
312
|
success: true,
|
|
345
|
-
data: { id: chatId, path: chatPath, review:
|
|
346
|
-
output: `Chat: \`${chatId}\`\n\n${
|
|
313
|
+
data: { id: chatId, path: chatPath, review: response },
|
|
314
|
+
output: `Chat: \`${chatId}\`\n\n${response}`,
|
|
347
315
|
};
|
|
348
316
|
}
|
|
349
317
|
|
|
350
|
-
//
|
|
318
|
+
// Fallback: just return the chat ID if Claude CLI isn't available
|
|
319
|
+
console.error("[wdyt] Claude CLI not found, returning context only");
|
|
351
320
|
return {
|
|
352
321
|
success: true,
|
|
353
322
|
data: { id: chatId, path: chatPath },
|
|
354
|
-
output: `Chat: \`${chatId}
|
|
323
|
+
output: `Chat: \`${chatId}\`\n\nContext exported to: ${chatPath}\n(Install Claude CLI for automatic LLM processing)`,
|
|
355
324
|
};
|
|
356
325
|
} catch (error) {
|
|
357
326
|
const message = error instanceof Error ? error.message : String(error);
|