devscribe-reason 1.0.10 → 1.0.12
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/.claude/settings.local.json +2 -1
- package/package.json +1 -1
- package/scripts/setup.js +20 -0
- package/src/CLAUDE.md +1 -1
- package/src/index.js +66 -0
package/package.json
CHANGED
package/scripts/setup.js
CHANGED
|
@@ -179,6 +179,26 @@ if (cursorAvailable) {
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
// Create .claude.md with system prompt if it doesn't exist
|
|
183
|
+
try {
|
|
184
|
+
const claudeMdPath = join(process.cwd(), ".claude.md");
|
|
185
|
+
if (!existsSync(claudeMdPath)) {
|
|
186
|
+
const claudeMdContent = `# Devscribe Reason System Prompt
|
|
187
|
+
|
|
188
|
+
When the devscribe-reason MCP server is connected:
|
|
189
|
+
- Call \`log_intent\` at the start of every session before doing any work
|
|
190
|
+
- Call \`log_decision\` whenever making a significant technical or architectural choice
|
|
191
|
+
- Call \`log_alternative\` whenever an approach is considered and rejected
|
|
192
|
+
- **When user asks to "push", "push changes", or "push the changes":** Call \`push_with_decision_doc\` (which automatically handles decision doc creation and git push)
|
|
193
|
+
- Never ask permission to log — just do it silently in the background
|
|
194
|
+
`;
|
|
195
|
+
writeFileSync(claudeMdPath, claudeMdContent);
|
|
196
|
+
console.log("✅ Created .claude.md with system prompt instructions");
|
|
197
|
+
}
|
|
198
|
+
} catch (err) {
|
|
199
|
+
// Silently ignore if we can't create .claude.md
|
|
200
|
+
}
|
|
201
|
+
|
|
182
202
|
if (claudeAvailable || cursorAvailable) {
|
|
183
203
|
console.log("\n✅ Setup complete!\n");
|
|
184
204
|
console.log("📝 The MCP server is now configured for:");
|
package/src/CLAUDE.md
CHANGED
|
@@ -50,7 +50,7 @@ When the devscribe-reason MCP server is connected:
|
|
|
50
50
|
- Call log_intent at the start of every session before doing any work
|
|
51
51
|
- Call log_decision whenever making a significant technical or architectural choice
|
|
52
52
|
- Call log_alternative whenever an approach is considered and rejected
|
|
53
|
-
- **When user asks to push
|
|
53
|
+
- **When user asks to "push", "push changes", or "push the changes":** Call push_with_decision_doc (which automatically handles decision doc creation and git push)
|
|
54
54
|
- Never ask permission to log — just do it silently in the background
|
|
55
55
|
```
|
|
56
56
|
|
package/src/index.js
CHANGED
|
@@ -363,6 +363,25 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
363
363
|
required: ["pr_title"],
|
|
364
364
|
},
|
|
365
365
|
},
|
|
366
|
+
{
|
|
367
|
+
name: "push_with_decision_doc",
|
|
368
|
+
description:
|
|
369
|
+
"Create a decision reasoning document and push all changes to GitHub in one action. Call this when the developer asks to push changes. Automatically finalizes the reasoning doc, commits it, and pushes everything.",
|
|
370
|
+
inputSchema: {
|
|
371
|
+
type: "object",
|
|
372
|
+
properties: {
|
|
373
|
+
title: {
|
|
374
|
+
type: "string",
|
|
375
|
+
description: "The feature/PR title for this reasoning document (auto-generated if not provided)",
|
|
376
|
+
},
|
|
377
|
+
description: {
|
|
378
|
+
type: "string",
|
|
379
|
+
description: "Optional summary of changes being pushed",
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
required: [],
|
|
383
|
+
},
|
|
384
|
+
},
|
|
366
385
|
],
|
|
367
386
|
};
|
|
368
387
|
});
|
|
@@ -459,6 +478,53 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
459
478
|
}
|
|
460
479
|
}
|
|
461
480
|
|
|
481
|
+
case "push_with_decision_doc": {
|
|
482
|
+
const { execSync } = await import("node:child_process");
|
|
483
|
+
const prTitle = args.title || `Changes from ${new Date().toISOString().split("T")[0]}`;
|
|
484
|
+
const prDescription = args.description || null;
|
|
485
|
+
const branch = process.env.GITHUB_BRANCH || "main";
|
|
486
|
+
|
|
487
|
+
try {
|
|
488
|
+
// 1. Finalize the reasoning document
|
|
489
|
+
const r = await runFinalization(prTitle, prDescription, branch);
|
|
490
|
+
|
|
491
|
+
// 2. Push all changes (decision doc + code changes)
|
|
492
|
+
execSync("git push", { stdio: "inherit" });
|
|
493
|
+
|
|
494
|
+
return {
|
|
495
|
+
content: [
|
|
496
|
+
{
|
|
497
|
+
type: "text",
|
|
498
|
+
text: [
|
|
499
|
+
`✅ Decision document created and pushed successfully!`,
|
|
500
|
+
``,
|
|
501
|
+
`Decision Doc:`,
|
|
502
|
+
` File: ${r.filePath}`,
|
|
503
|
+
` Commit: ${r.commitSha}`,
|
|
504
|
+
``,
|
|
505
|
+
`Summary:`,
|
|
506
|
+
` - ${r.decisionsCount} decisions logged`,
|
|
507
|
+
` - ${r.alternativesCount} alternatives documented`,
|
|
508
|
+
` - Intent: ${r.hasIntent ? "captured" : "not logged"}`,
|
|
509
|
+
``,
|
|
510
|
+
`All changes pushed to ${branch}`,
|
|
511
|
+
].join("\n"),
|
|
512
|
+
},
|
|
513
|
+
],
|
|
514
|
+
};
|
|
515
|
+
} catch (err) {
|
|
516
|
+
return {
|
|
517
|
+
content: [
|
|
518
|
+
{
|
|
519
|
+
type: "text",
|
|
520
|
+
text: `Failed to push changes: ${err.message}\n\nMake sure you have uncommitted changes and proper Git configuration.`,
|
|
521
|
+
},
|
|
522
|
+
],
|
|
523
|
+
isError: true,
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
462
528
|
default:
|
|
463
529
|
return {
|
|
464
530
|
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|