fix: pass nerveRoot to tester prompts for correct path resolution

Hermes agent cwd is not necessarily the nerve workspace root.
Inject nerveRoot into tester prompts so all file paths and commands
use absolute paths to the workspace directory.
This commit is contained in:
小橘 2026-04-28 13:03:31 +00:00
parent ef7d83ad0a
commit e8765abac6
5 changed files with 13 additions and 9 deletions

View File

@ -21,7 +21,7 @@ export function buildSenseGenerator({
roles: {
planner: buildPlannerRole({ provider, cwd }),
coder: buildCoderRole({ provider, cwd }),
tester: buildTesterRole({ provider }),
tester: buildTesterRole({ provider, nerveRoot: cwd }),
committer: buildCommitterRole({ nerveRoot: cwd }),
},
moderator,

View File

@ -10,11 +10,12 @@ export type TesterMeta = z.infer<typeof testerMetaSchema>;
export type BuildTesterDeps = {
provider: LlmProvider;
nerveRoot: string;
};
export function buildTesterRole({ provider }: BuildTesterDeps) {
export function buildTesterRole({ provider, nerveRoot }: BuildTesterDeps) {
return createHermesRole<TesterMeta>({
prompt: async (threadId) => testerPrompt({ threadId }),
prompt: async (threadId) => testerPrompt({ threadId, nerveRoot }),
extract: { provider, schema: testerMetaSchema },
});
}

View File

@ -1,8 +1,10 @@
export function testerPrompt({ threadId }: { threadId: string }): string {
export function testerPrompt({ threadId, nerveRoot }: { threadId: string; nerveRoot: string }): string {
return `You are testing a newly created Nerve sense end-to-end.
**IMPORTANT: The Nerve workspace is at \`${nerveRoot}\`. All paths below are relative to this directory. Always \`cd ${nerveRoot}\` first.**
Read the workflow thread for context: \`nerve thread ${threadId}\`
Read the nerve-dev skill for expected file structure: \`cat node_modules/@uncaged/nerve-skills/nerve-dev/SKILL.md\`
Read the nerve-dev skill for expected file structure: \`cat ${nerveRoot}/node_modules/@uncaged/nerve-skills/nerve-dev/SKILL.md\`
Verify the full lifecycle in this order:
@ -14,7 +16,7 @@ Verify the full lifecycle in this order:
2. **Build** run inside the sense directory:
\`\`\`
cd senses/<name> && pnpm install --no-cache && pnpm build
cd ${nerveRoot}/senses/<name> && pnpm install --no-cache && pnpm build
\`\`\`
Must produce \`index.js\` at sense root without errors.

View File

@ -22,7 +22,7 @@ export function buildWorkflowGenerator({
roles: {
planner: buildPlannerRole({ provider, cwd: nerveRoot }),
coder: buildCoderRole({ provider, cwd: nerveRoot }),
tester: buildTesterRole({ provider }),
tester: buildTesterRole({ provider, nerveRoot }),
committer: buildCommitterRole({ nerveRoot }),
},
moderator,

View File

@ -10,11 +10,12 @@ export type TesterMeta = z.infer<typeof testerMetaSchema>;
export type BuildTesterDeps = {
provider: LlmProvider;
nerveRoot: string;
};
export function buildTesterRole({ provider }: BuildTesterDeps) {
export function buildTesterRole({ provider, nerveRoot }: BuildTesterDeps) {
return createHermesRole<TesterMeta>({
prompt: async (threadId) => testerPrompt({ threadId }),
prompt: async (threadId) => testerPrompt({ threadId, nerveRoot }),
extract: { provider, schema: testerMetaSchema },
});
}