ralph-mcp 1.0.6 → 1.0.8
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/tools/start.d.ts +3 -0
- package/dist/tools/start.js +8 -1
- package/dist/utils/agent.d.ts +1 -1
- package/dist/utils/agent.js +13 -1
- package/dist/utils/worktree.js +15 -2
- package/package.json +2 -2
package/dist/tools/start.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare const startInputSchema: z.ZodObject<{
|
|
|
7
7
|
autoMerge: z.ZodDefault<z.ZodBoolean>;
|
|
8
8
|
notifyOnComplete: z.ZodDefault<z.ZodBoolean>;
|
|
9
9
|
onConflict: z.ZodDefault<z.ZodEnum<["auto_theirs", "auto_ours", "notify", "agent"]>>;
|
|
10
|
+
contextInjectionPath: z.ZodOptional<z.ZodString>;
|
|
10
11
|
}, "strip", z.ZodTypeAny, {
|
|
11
12
|
prdPath: string;
|
|
12
13
|
onConflict: "auto_theirs" | "auto_ours" | "notify" | "agent";
|
|
@@ -15,6 +16,7 @@ export declare const startInputSchema: z.ZodObject<{
|
|
|
15
16
|
worktree: boolean;
|
|
16
17
|
autoStart: boolean;
|
|
17
18
|
projectRoot?: string | undefined;
|
|
19
|
+
contextInjectionPath?: string | undefined;
|
|
18
20
|
}, {
|
|
19
21
|
prdPath: string;
|
|
20
22
|
projectRoot?: string | undefined;
|
|
@@ -23,6 +25,7 @@ export declare const startInputSchema: z.ZodObject<{
|
|
|
23
25
|
notifyOnComplete?: boolean | undefined;
|
|
24
26
|
worktree?: boolean | undefined;
|
|
25
27
|
autoStart?: boolean | undefined;
|
|
28
|
+
contextInjectionPath?: string | undefined;
|
|
26
29
|
}>;
|
|
27
30
|
export type StartInput = z.infer<typeof startInputSchema>;
|
|
28
31
|
export interface StartResult {
|
package/dist/tools/start.js
CHANGED
|
@@ -16,6 +16,10 @@ export const startInputSchema = z.object({
|
|
|
16
16
|
.enum(["auto_theirs", "auto_ours", "notify", "agent"])
|
|
17
17
|
.default("agent")
|
|
18
18
|
.describe("Conflict resolution strategy for merge"),
|
|
19
|
+
contextInjectionPath: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Path to a file (e.g., CLAUDE.md) to inject into the agent prompt"),
|
|
19
23
|
});
|
|
20
24
|
export async function start(input) {
|
|
21
25
|
const projectRoot = input.projectRoot || process.cwd();
|
|
@@ -70,6 +74,9 @@ export async function start(input) {
|
|
|
70
74
|
// Generate agent prompt if auto-start
|
|
71
75
|
let agentPrompt = null;
|
|
72
76
|
if (input.autoStart) {
|
|
77
|
+
const contextPath = input.contextInjectionPath
|
|
78
|
+
? resolve(projectRoot, input.contextInjectionPath)
|
|
79
|
+
: undefined;
|
|
73
80
|
agentPrompt = generateAgentPrompt(prd.branchName, prd.description, worktreePath || projectRoot, storyRecords.map((s) => ({
|
|
74
81
|
storyId: s.storyId,
|
|
75
82
|
title: s.title,
|
|
@@ -77,7 +84,7 @@ export async function start(input) {
|
|
|
77
84
|
acceptanceCriteria: s.acceptanceCriteria,
|
|
78
85
|
priority: s.priority,
|
|
79
86
|
passes: s.passes,
|
|
80
|
-
})));
|
|
87
|
+
})), contextPath);
|
|
81
88
|
}
|
|
82
89
|
return {
|
|
83
90
|
executionId,
|
package/dist/utils/agent.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function generateAgentPrompt(branch: string, description: string,
|
|
|
8
8
|
acceptanceCriteria: string[];
|
|
9
9
|
priority: number;
|
|
10
10
|
passes: boolean;
|
|
11
|
-
}
|
|
11
|
+
}>, contextInjectionPath?: string): string;
|
|
12
12
|
/**
|
|
13
13
|
* Generate merge agent prompt for conflict resolution
|
|
14
14
|
*/
|
package/dist/utils/agent.js
CHANGED
|
@@ -6,7 +6,7 @@ const execAsync = promisify(exec);
|
|
|
6
6
|
/**
|
|
7
7
|
* Generate agent prompt for PRD execution
|
|
8
8
|
*/
|
|
9
|
-
export function generateAgentPrompt(branch, description, worktreePath, stories) {
|
|
9
|
+
export function generateAgentPrompt(branch, description, worktreePath, stories, contextInjectionPath) {
|
|
10
10
|
const pendingStories = stories
|
|
11
11
|
.filter((s) => !s.passes)
|
|
12
12
|
.sort((a, b) => a.priority - b.priority);
|
|
@@ -33,6 +33,16 @@ ${s.acceptanceCriteria.map((ac) => `- ${ac}`).join("\n")}
|
|
|
33
33
|
// Ignore read errors
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
// Read injected context if provided
|
|
37
|
+
let injectedContext = "";
|
|
38
|
+
if (contextInjectionPath && existsSync(contextInjectionPath)) {
|
|
39
|
+
try {
|
|
40
|
+
injectedContext = readFileSync(contextInjectionPath, "utf-8");
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
// Ignore read errors
|
|
44
|
+
}
|
|
45
|
+
}
|
|
36
46
|
return `You are an autonomous coding agent working on the "${branch}" branch.
|
|
37
47
|
|
|
38
48
|
## Working Directory
|
|
@@ -40,6 +50,8 @@ ${worktreePath}
|
|
|
40
50
|
|
|
41
51
|
## PRD: ${description}
|
|
42
52
|
|
|
53
|
+
${injectedContext ? `## Project Context\n${injectedContext}\n` : ""}
|
|
54
|
+
|
|
43
55
|
${progressLog ? `## Progress & Learnings\n${progressLog}\n` : ""}
|
|
44
56
|
|
|
45
57
|
## Pending User Stories
|
package/dist/utils/worktree.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execSync, exec } from "child_process";
|
|
2
|
-
import { existsSync, appendFileSync } from "fs";
|
|
2
|
+
import { existsSync, appendFileSync, readFileSync } from "fs";
|
|
3
3
|
import { join } from "path";
|
|
4
4
|
import { promisify } from "util";
|
|
5
5
|
const execAsync = promisify(exec);
|
|
@@ -27,8 +27,21 @@ export async function createWorktree(projectRoot, branch) {
|
|
|
27
27
|
}
|
|
28
28
|
// Prevent ralph-progress.md from being committed
|
|
29
29
|
try {
|
|
30
|
-
const
|
|
30
|
+
const { stdout: gitCommonDir } = await execAsync("git rev-parse --git-common-dir", {
|
|
31
|
+
cwd: worktreePath,
|
|
32
|
+
});
|
|
33
|
+
const excludePath = join(gitCommonDir.trim(), "info", "exclude");
|
|
34
|
+
// Ensure info directory exists
|
|
35
|
+
// (git-common-dir usually returns absolute path or relative to cwd.
|
|
36
|
+
// If relative, join with worktreePath might be needed, but rev-parse usually returns absolute if outside?
|
|
37
|
+
// Actually rev-parse --git-common-dir usually returns absolute path if called with proper context or relative.
|
|
38
|
+
// Safest is to resolve it.)
|
|
39
|
+
// Let's rely on reading current content to check if needed
|
|
40
|
+
let content = "";
|
|
31
41
|
if (existsSync(excludePath)) {
|
|
42
|
+
content = readFileSync(excludePath, "utf-8");
|
|
43
|
+
}
|
|
44
|
+
if (!content.includes("ralph-progress.md")) {
|
|
32
45
|
appendFileSync(excludePath, "\nralph-progress.md\n", "utf-8");
|
|
33
46
|
}
|
|
34
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ralph-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "MCP server for autonomous PRD execution with Claude Code. Git worktree isolation, progress tracking, auto-merge.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"user-story",
|
|
21
21
|
"merge-queue"
|
|
22
22
|
],
|
|
23
|
-
"author": "
|
|
23
|
+
"author": "Godzi11a <2492186627@qq.com>",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|