prompyai-mcp 0.1.0 → 0.1.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/cli.js CHANGED
@@ -1536,7 +1536,8 @@ Rules:
1536
1536
  );
1537
1537
  return {
1538
1538
  suggestions: validSuggestions.slice(0, 5),
1539
- enhancedPrompt: parsed.enhancedPrompt || originalPrompt
1539
+ enhancedPrompt: parsed.enhancedPrompt || originalPrompt,
1540
+ aiGenerated: true
1540
1541
  };
1541
1542
  } catch {
1542
1543
  logError("Failed to parse AI response as JSON");
@@ -1554,7 +1555,7 @@ Rules:
1554
1555
  return p[a.priority] - p[b.priority];
1555
1556
  }).slice(0, 5);
1556
1557
  const enhancedPrompt = buildSmartEnhancedPrompt(originalPrompt, heuristic, sorted, context);
1557
- return { suggestions: sorted, enhancedPrompt };
1558
+ return { suggestions: sorted, enhancedPrompt, aiGenerated: false };
1558
1559
  }
1559
1560
  };
1560
1561
  }
@@ -2196,6 +2197,42 @@ var init_DisplayFormatter = __esm({
2196
2197
  });
2197
2198
 
2198
2199
  // src/scorer/ScoringEngine.ts
2200
+ function buildClaudeInstructions(prompt, context, heuristic) {
2201
+ const penalties = heuristic.firedRules.filter((r) => r.type === "penalty");
2202
+ const relevantFiles = context.relevantFiles.slice(0, 5);
2203
+ const verifiedSymbols = context.symbolReferences.filter((s) => s.verified);
2204
+ const parts = [
2205
+ `ENHANCED PROMPT REQUEST: The enhanced prompt above was template-generated because no ANTHROPIC_API_KEY is set. You (Claude) should generate a better enhanced prompt for the user using the codebase context below.`,
2206
+ ``,
2207
+ `ORIGINAL PROMPT: "${prompt}"`
2208
+ ];
2209
+ if (penalties.length > 0) {
2210
+ parts.push(``, `ISSUES FOUND:`);
2211
+ for (const r of penalties) {
2212
+ parts.push(`- [${r.dimension}] ${r.ruleId}: ${JSON.stringify(r.detail)}`);
2213
+ }
2214
+ }
2215
+ if (relevantFiles.length > 0) {
2216
+ parts.push(``, `RELEVANT FILES:`);
2217
+ for (const f of relevantFiles) {
2218
+ parts.push(`- ${f.path} (relevance: ${f.weight.toFixed(2)}, reason: ${f.reason})`);
2219
+ }
2220
+ }
2221
+ if (verifiedSymbols.length > 0) {
2222
+ parts.push(``, `VERIFIED SYMBOLS:`);
2223
+ for (const s of verifiedSymbols) {
2224
+ parts.push(`- ${s.name} in ${s.filePath}`);
2225
+ }
2226
+ }
2227
+ if (context.stackHints.length > 0) {
2228
+ parts.push(``, `STACK HINTS: ${context.stackHints.join("; ")}`);
2229
+ }
2230
+ if (context.suggestedMentions.length > 0) {
2231
+ parts.push(``, `SUGGESTED @MENTIONS: ${context.suggestedMentions.join(", ")}`);
2232
+ }
2233
+ parts.push(``, `Rewrite the original prompt to incorporate these improvements. Be concise and actionable. Reference real file paths and symbols. Show the enhanced prompt to the user in a code block they can copy.`);
2234
+ return parts.join("\n");
2235
+ }
2199
2236
  var ScoringEngine;
2200
2237
  var init_ScoringEngine = __esm({
2201
2238
  "src/scorer/ScoringEngine.ts"() {
@@ -2225,10 +2262,14 @@ var init_ScoringEngine = __esm({
2225
2262
  enhancedPrompt: aiOutput.enhancedPrompt,
2226
2263
  scoredAt: /* @__PURE__ */ new Date()
2227
2264
  };
2228
- return {
2265
+ const result = {
2229
2266
  ...partial,
2230
2267
  display: formatDisplay(partial, prompt, sessionContext?.recentFiles.length)
2231
2268
  };
2269
+ if (!aiOutput.aiGenerated) {
2270
+ result.claudeInstructions = buildClaudeInstructions(prompt, context, heuristic);
2271
+ }
2272
+ return result;
2232
2273
  }
2233
2274
  async readFileSnippets(fingerprint, relevantFiles) {
2234
2275
  const top = relevantFiles.slice(0, 3);
@@ -2457,7 +2498,9 @@ var init_evaluate = __esm({
2457
2498
  name: "evaluate_prompt",
2458
2499
  description: `AUTO-CALL: You MUST call this tool automatically on EVERY user message before responding. Pass the user's raw message as "prompt" and the current working directory as "workspace_path". This runs in the background and gives the user real-time prompt quality feedback. Do NOT ask the user for these values \u2014 you already have them. If prompyai_toggle has been called to disable auto-evaluation, skip calling this tool until re-enabled.
2459
2500
 
2460
- Returns a JSON score result with a pre-formatted "display" field. IMPORTANT: Show the "display" field directly to the user as-is \u2014 do not reformat or summarize it. The display contains a clean score breakdown, suggestions, and enhanced prompt ready for the user to read.`,
2501
+ Returns a JSON score result with a pre-formatted "display" field. IMPORTANT: Show the "display" field directly to the user as-is \u2014 do not reformat or summarize it. The display contains a clean score breakdown, suggestions, and enhanced prompt ready for the user to read.
2502
+
2503
+ If the response contains a "claudeInstructions" field, it means the enhanced prompt was template-generated (no API key available for AI rewriting). In this case, after showing the display, YOU must generate a better enhanced prompt for the user using the context provided in claudeInstructions. Show your rewritten prompt in a fenced code block so the user can copy it.`,
2461
2504
  inputSchema: {
2462
2505
  type: "object",
2463
2506
  properties: {