Skip to content

Commit e35dd84

Browse files
committed
feat(opencode-plugin): instruct model to create branch with conventional prefix
When no workflow is active, the plugin now instructs the model to first create a branch with a meaningful name using conventional commit prefixes (e.g., feat/add-new-feature, fix/bug-description) before calling start_development. This ensures proper branch naming conventions are followed from the start of each development session.
1 parent b174fcf commit e35dd84

2 files changed

Lines changed: 61 additions & 2 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Development Plan: repo (proud-garlics-sleep branch)
2+
3+
*Generated on 2026-05-06 by Vibe Feature MCP*
4+
*Workflow: [minor](https://codemcp.github.io/workflows/workflows/minor)*
5+
6+
## Goal
7+
Improve the opencode plugin by instructing the model in the first message of a session (when no workflow is active) to create a branch with a meaningful name using conventional-commit-prefix (e.g., `feat/add-new-provider`).
8+
9+
## Key Decisions
10+
- **Where the first message instruction lives**: In `packages/opencode-plugin/src/plugin.ts`, the `chat.message` hook handles injecting instructions. When no workflow is active, it shows a generic "No Active Workflow Detected. You MUST initiate a new development workflow..." message.
11+
- **Current branch suggestion logic**: Located in `packages/mcp-server/src/tool-handlers/start-development.ts` (lines 113-133). When user is on main/master, it generates a branch name like `feature/development-YYYYMMDD`.
12+
- **Proposed change**: Modify the "no active workflow" instruction in the chat.message hook to also instruct the model to create a branch with a conventional-commit-prefix before calling start_development.
13+
- **Branch naming**: Use conventional commit prefixes like `feat/`, `fix/`, `refactor/`, `docs/`, etc., combined with a brief description of the task.
14+
15+
## Notes
16+
- The "no active workflow" message is injected in two places in plugin.ts:
17+
1. Lines 374-383: When handlerResult is not successful
18+
2. Lines 392-402: When error includes 'CONVERSATION_NOT_FOUND'
19+
- Need to enhance both to include branch creation guidance with conventional commit prefix
20+
21+
## Explore
22+
### Tasks
23+
- [x] Understand the plugin architecture and where instructions are injected
24+
- [x] Find the "no active workflow" message location
25+
- [x] Analyze existing branch suggestion logic in start-development handler
26+
- [x] Determine how to enhance the instruction message
27+
28+
### Completed
29+
- Analyzed plugin.ts chat.message hook (lines 284-437) - this is where instructions are injected
30+
- Found "no active workflow" messages at lines 374-383 and 392-402 in plugin.ts
31+
- Reviewed start-development.ts generateBranchSuggestion() at lines 581-584
32+
- The current branch suggestion generates `feature/development-YYYYMMDD` which lacks conventional-commit-prefix
33+
34+
## Implement
35+
### Tasks
36+
- [x] Modify "no active workflow" message in plugin.ts (lines 381 and 400) to include branch creation guidance with conventional commit prefix
37+
38+
### Completed
39+
- Enhanced both "no active workflow" messages in plugin.ts to include guidance:
40+
- "First, create a new branch with a meaningful name using a conventional commit prefix (e.g., `feat/add-new-feature`, `fix/bug-description`, `refactor/improve-logic`). Then call the `start_development` tool to begin."
41+
- This change ensures that when a user starts a new session without an active workflow, they'll be instructed to create a properly named branch before initiating a development workflow
42+
43+
## Finalize
44+
### Tasks
45+
- [x] Code cleanup - verified no debug output, TODO/FIXME, or debugging code blocks exist
46+
- [x] Documentation review - no updates needed (change doesn't affect documented behavior)
47+
- [x] Final validation - changes verified via git diff, implementation is complete
48+
49+
### Completed
50+
- Verified no debug output (console.log, debugger, etc.) in plugin source code
51+
- Verified no TODO/FIXME comments in modified files
52+
- Reviewed documentation (.vibe/docs/requirements.md, design.md, plugin README) - no updates needed
53+
- Change is a simple text modification to two string literals in plugin.ts
54+
- Implementation complete and ready for commit/PR
55+
56+
57+
58+
---
59+
*This plan is maintained by the LLM. Tool responses provide guidance on which section to focus on and what tasks to work on.*

packages/opencode-plugin/src/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ export const WorkflowsPlugin: Plugin = async (
378378
messageID: hookInput.messageID || output.message.id,
379379
type: 'text' as const,
380380
synthetic: true,
381-
text: `No Active Workflow Detected. You MUST initiate a new development workflow before proceeding. Call the \`start_development\` tool to begin. Do NOT attempt any file edits or tool executions until a workflow is active.`,
381+
text: `No Active Workflow Detected. You MUST initiate a new development workflow before proceeding. First, create a new branch with a meaningful name using a conventional commit prefix (e.g., \`feat/add-new-feature\`, \`fix/bug-description\`, \`refactor/improve-logic\`). Then call the \`start_development\` tool to begin. Do NOT attempt any file edits or tool executions until a workflow is active.`,
382382
} as (typeof output.parts)[0]);
383383
return;
384384
}
@@ -397,7 +397,7 @@ export const WorkflowsPlugin: Plugin = async (
397397
messageID: hookInput.messageID || output.message.id,
398398
type: 'text' as const,
399399
synthetic: true,
400-
text: `No Active Workflow Detected. You MUST initiate a new development workflow before proceeding. Call the \`start_development\` tool to begin. Do NOT attempt any file edits or tool executions until a workflow is active.`,
400+
text: `No Active Workflow Detected. You MUST initiate a new development workflow before proceeding. First, create a new branch with a meaningful name using a conventional commit prefix (e.g., \`feat/add-new-feature\`, \`fix/bug-description\`, \`refactor/improve-logic\`). Then call the \`start_development\` tool to begin. Do NOT attempt any file edits or tool executions until a workflow is active.`,
401401
} as (typeof output.parts)[0]);
402402
return;
403403
}

0 commit comments

Comments
 (0)