refactor: simplify workspace committer — remove redundant parameters #17

Closed
opened 2026-04-29 12:51:29 +00:00 by xiaoju · 0 comments
Owner

What

Simplify createWorkspaceCommitterRole in _shared/workspace-committer.ts. The agent can infer workflow name, commit scope, and branch naming from the thread history — no need to pass them as parameters.

Current signature

createWorkspaceCommitterRole(adapter, {
  extract,
  nerveRoot,
  workflowName,
  conventionalCommitScopeHint,
  branchCheckoutExample,
})

Target signature

createWorkspaceCommitterRole(adapter: AgentFn, extract: LlmExtractorConfig): Role<CommitterMeta>

Only adapter and extract remain. Everything else the agent figures out from the thread.

Changes

1. _shared/workspace-committer.ts

  • Remove BuildWorkspaceCommitterDeps type (or reduce to just extract)
  • Remove nerveRoot, workflowName, conventionalCommitScopeHint, branchCheckoutExample parameters
  • Simplify prompt: tell the agent to read the thread (nerve thread show <threadId>), infer the workflow context, and decide branch name / commit scope / message on its own
  • nerveRoot: get from start.meta.workdir or fall back to process.cwd(). The outer wrapper already sets start.meta.workdir — but actually, since we are simplifying, just let the agent use the working directory it is started in (the engine already sets workdir via the adapter). Remove the innerStart workdir override hack.
  • Keep the dry-run check and error handling wrapper
  • Keep the --author prohibition in the prompt

2. Prompt should be roughly

You are the committer agent. The coder finished with a passing build; your job is to branch, commit, and push.

1. Read the workflow thread: `nerve thread show <threadId>` — understand what was planned, coded, and reviewed.
2. Run `git status`. If nothing to commit, set committed=false.
3. Create a feature branch: infer a good `fix/<slug>` or `feat/<slug>` name from the thread context.
4. `git add -A`
5. Write a conventional commit message based on the thread context.
6. `git commit -m "<message>"` — do NOT pass `--author`, use repo git config.
7. `git push -u origin <branch>`

3. Update all callers

  • workflows/develop-sense/build.ts — change createWorkspaceCommitterRole(a("committer"), { extract, nerveRoot, ... }) to createWorkspaceCommitterRole(a("committer"), extract)
  • workflows/develop-workflow/build.ts — same
  • workflows/develop-sense/roles/committer.ts — update re-export if type changed
  • workflows/develop-workflow/roles/committer.ts — same
  • workflows/solve-issue/roles/committer/ — if it uses the shared function, update too. If it has its own committer, apply same simplification.

4. Verify

  • pnpm build at repo root must pass
## What Simplify `createWorkspaceCommitterRole` in `_shared/workspace-committer.ts`. The agent can infer workflow name, commit scope, and branch naming from the thread history — no need to pass them as parameters. ## Current signature ```ts createWorkspaceCommitterRole(adapter, { extract, nerveRoot, workflowName, conventionalCommitScopeHint, branchCheckoutExample, }) ``` ## Target signature ```ts createWorkspaceCommitterRole(adapter: AgentFn, extract: LlmExtractorConfig): Role<CommitterMeta> ``` Only `adapter` and `extract` remain. Everything else the agent figures out from the thread. ## Changes ### 1. `_shared/workspace-committer.ts` - Remove `BuildWorkspaceCommitterDeps` type (or reduce to just `extract`) - Remove `nerveRoot`, `workflowName`, `conventionalCommitScopeHint`, `branchCheckoutExample` parameters - Simplify prompt: tell the agent to read the thread (`nerve thread show <threadId>`), infer the workflow context, and decide branch name / commit scope / message on its own - `nerveRoot`: get from `start.meta.workdir` or fall back to `process.cwd()`. The outer wrapper already sets `start.meta.workdir` — but actually, since we are simplifying, just let the agent use the working directory it is started in (the engine already sets workdir via the adapter). Remove the `innerStart` workdir override hack. - Keep the dry-run check and error handling wrapper - Keep the `--author` prohibition in the prompt ### 2. Prompt should be roughly ``` You are the committer agent. The coder finished with a passing build; your job is to branch, commit, and push. 1. Read the workflow thread: `nerve thread show <threadId>` — understand what was planned, coded, and reviewed. 2. Run `git status`. If nothing to commit, set committed=false. 3. Create a feature branch: infer a good `fix/<slug>` or `feat/<slug>` name from the thread context. 4. `git add -A` 5. Write a conventional commit message based on the thread context. 6. `git commit -m "<message>"` — do NOT pass `--author`, use repo git config. 7. `git push -u origin <branch>` ``` ### 3. Update all callers - `workflows/develop-sense/build.ts` — change `createWorkspaceCommitterRole(a("committer"), { extract, nerveRoot, ... })` to `createWorkspaceCommitterRole(a("committer"), extract)` - `workflows/develop-workflow/build.ts` — same - `workflows/develop-sense/roles/committer.ts` — update re-export if type changed - `workflows/develop-workflow/roles/committer.ts` — same - `workflows/solve-issue/roles/committer/` — if it uses the shared function, update too. If it has its own committer, apply same simplification. ### 4. Verify - `pnpm build` at repo root must pass
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: xiaoju/nerve-workspace#17
No description provided.