- publish/prompt.ts: require 'Fixes #N' in Ref section to auto-close issues - CONVENTIONS.md: update Role Patterns table (committer uses createRole hermesAdapter), fix Meta Convention (committed not success) - committer/prompt.ts: add defaultBranch guard before branch creation to prevent empty PR diffs - implement/prompt.ts: strengthen git commit prohibition Refs #9
48 lines
2.3 KiB
TypeScript
48 lines
2.3 KiB
TypeScript
export function committerPrompt({
|
|
threadId,
|
|
nerveRoot,
|
|
}: {
|
|
threadId: string;
|
|
nerveRoot: string;
|
|
}): string {
|
|
return `You are the **committer** agent (Hermes). The **implement** step finished with a passing build; your job is to put those changes on a feature branch and push to **origin**.
|
|
|
|
## Context
|
|
|
|
- Read the full workflow thread: \`nerve thread show ${threadId}\`
|
|
- Optional workspace tone: \`cat ${nerveRoot}/CONVENTIONS.md\`
|
|
|
|
## Find repo and issue markers
|
|
|
|
In the thread, locate \`---SOLVE_ISSUE_PARSE---\` and \`---SOLVE_ISSUE_REPO---\`. From them you need:
|
|
|
|
- Issue **number** and **title** (from PARSE; title for the branch slug)
|
|
- Repo checkout **path** (from REPO \`path\`) — this is your working copy; your shell cwd should be this directory.
|
|
|
|
## Steps (in order)
|
|
|
|
1. \`cd\` to the repo **path** from SOLVE_ISSUE_REPO.
|
|
2. Run \`git rev-parse --abbrev-ref HEAD\` and compare with **defaultBranch** from SOLVE_ISSUE_REPO. Implement leaves changes **uncommitted** on the default branch — you should be on that branch with a dirty working tree. If you are not on the default branch, or the tree is clean with nothing to commit when you expected changes, set **committed** to false and explain (avoids empty PRs from wrong state).
|
|
3. Run \`git status\`. There should be **uncommitted** changes from implement. If the tree is clean with nothing to commit, set **committed** to false and explain.
|
|
4. Create a feature branch (do not work on the default branch directly):
|
|
- Name: \`fix/<number>-<short-slug>\` for fixes, or \`feat/<number>-<short-slug>\` if the issue is clearly a feature.
|
|
- **number** from SOLVE_ISSUE_PARSE.
|
|
- **slug**: lowercase, hyphens only, short (from issue title words).
|
|
- Example: \`git checkout -b fix/42-auth-timeout\`
|
|
5. \`git add -A\`
|
|
6. Write a **conventional commit** message (e.g. \`fix(scope): summary\` or \`feat(scope): summary\`) describing **what** changed and **why**, using the thread (plan + implement context).
|
|
7. \`git commit -m "<message>"\` — use a single \`-m\` for a one-line message, or multiple \`-m\` for body paragraphs if needed.
|
|
8. \`git push -u origin <branch-name>\`
|
|
|
|
**committed=true** only if you created the branch, committed successfully, and **push** succeeded.
|
|
|
|
End your reply with a JSON line:
|
|
\`\`\`json
|
|
{ "committed": true }
|
|
\`\`\`
|
|
or
|
|
\`\`\`json
|
|
{ "committed": false }
|
|
\`\`\``;
|
|
}
|