opencode-enhance-plan 0.2.6
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/LICENSE +21 -0
- package/README.md +196 -0
- package/agents/enhance-plan.md +200 -0
- package/commands/feature-switch.md +18 -0
- package/commands/init-plan.md +43 -0
- package/commands/plan-feature.md +28 -0
- package/commands/plan-handoff.md +24 -0
- package/dist/deploy.d.ts +27 -0
- package/dist/deploy.d.ts.map +1 -0
- package/dist/deploy.js +98 -0
- package/dist/deploy.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/package.json +52 -0
- package/templates/init-plan/AGENTS.template.md +36 -0
- package/templates/init-plan/README.template.md +32 -0
- package/templates/init-plan/handoff.template.md +27 -0
- package/templates/init-plan/plan-json.template.json +45 -0
- package/templates/init-plan/plan-original.template.md +12 -0
- package/templates/init-plan/plan.template.md +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# opencode-enhance-plan
|
|
2
|
+
|
|
3
|
+
## English
|
|
4
|
+
|
|
5
|
+
`opencode-enhance-plan` is an enhanced planning workflow plugin for OpenCode.
|
|
6
|
+
|
|
7
|
+
It does not replace the built-in `plan` mode. Instead, it adds a stronger planning mode for feature work that needs:
|
|
8
|
+
- persistent feature artifacts
|
|
9
|
+
- explicit review before execution
|
|
10
|
+
- structured todo state
|
|
11
|
+
- feature switching and resume support
|
|
12
|
+
- minimal build handoff
|
|
13
|
+
|
|
14
|
+
### Why not just use the built-in `plan` mode?
|
|
15
|
+
|
|
16
|
+
The built-in `plan` mode is still useful for lightweight read-only analysis.
|
|
17
|
+
|
|
18
|
+
`enhance-plan` is intended for heavier feature planning where the default planning experience is often too weak in practice.
|
|
19
|
+
|
|
20
|
+
### Built-in `plan` vs `enhance-plan`
|
|
21
|
+
|
|
22
|
+
| Area | Built-in `plan` | `enhance-plan` |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| Primary use | quick analysis | feature planning workflow |
|
|
25
|
+
| Todo persistence | limited | explicit, structured, feature-scoped |
|
|
26
|
+
| Plan state model | implicit | `prepare -> ready -> approved -> building -> ...` |
|
|
27
|
+
| Feature switching | not a core workflow | built in via `/feature-switch` |
|
|
28
|
+
| Execution handoff | loose | focused `handoff.md` |
|
|
29
|
+
| Plan artifacts | optional | required per feature |
|
|
30
|
+
| Review gate | informal | explicit approval before handoff |
|
|
31
|
+
|
|
32
|
+
### What this repository includes
|
|
33
|
+
|
|
34
|
+
- `agents/` - custom agent definitions
|
|
35
|
+
- `commands/` - custom slash commands
|
|
36
|
+
- `templates/` - project templates used by `/init-plan`
|
|
37
|
+
- `src/` - TypeScript plugin source (auto-deploys agents/commands/templates)
|
|
38
|
+
- `docs/` - installation, usage, upgrade, and maintainer workflow notes
|
|
39
|
+
- `scripts/` - shared repository maintenance helper for commit/release flows
|
|
40
|
+
- `.codebuddy/skills/` - project-level CodeBuddy skill entrypoint for repository maintenance
|
|
41
|
+
- `.opencode/skills/` - project-level OpenCode skill entrypoint for repository maintenance
|
|
42
|
+
- `legacy/` - archived docs superseded by agent definitions
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Install as OpenCode Plugin (recommended)
|
|
46
|
+
|
|
47
|
+
Add `opencode-enhance-plan` to your `opencode.json`:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"plugin": ["opencode-enhance-plan"]
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
OpenCode will automatically install and load the plugin on next startup. The plugin deploys agents, commands, and templates to your OpenCode config directory (`~/.config/opencode/`).
|
|
56
|
+
|
|
57
|
+
### Core idea
|
|
58
|
+
|
|
59
|
+
Use the built-in `plan` mode when you want lightweight investigation.
|
|
60
|
+
|
|
61
|
+
Use `enhance-plan` when you want a full planning loop with:
|
|
62
|
+
- one active feature at a time
|
|
63
|
+
- persistent plan artifacts under `plan/active/<feature>/`
|
|
64
|
+
- explicit option comparison
|
|
65
|
+
- explicit user confirmation before build
|
|
66
|
+
- a small execution context through `handoff.md`
|
|
67
|
+
|
|
68
|
+
### Start here
|
|
69
|
+
|
|
70
|
+
- Installation: [`docs/installation.md`](https://github.com/spartawhy117/opencode-enhance-plan/blob/main/docs/installation.md)
|
|
71
|
+
- Usage: [`docs/usage.md`](https://github.com/spartawhy117/opencode-enhance-plan/blob/main/docs/usage.md)
|
|
72
|
+
- Maintainer release workflow: [`docs/repo-release-workflow.md`](https://github.com/spartawhy117/opencode-enhance-plan/blob/main/docs/repo-release-workflow.md)
|
|
73
|
+
- Upgrade checklist: [`docs/upgrade-compatibility.md`](https://github.com/spartawhy117/opencode-enhance-plan/blob/main/docs/upgrade-compatibility.md)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Quick path
|
|
77
|
+
|
|
78
|
+
1. Install this workflow into your OpenCode config.
|
|
79
|
+
2. Restart OpenCode.
|
|
80
|
+
3. Switch to `enhance-plan`.
|
|
81
|
+
4. Run `/init-plan` inside a project.
|
|
82
|
+
5. Run `/plan-feature <feature-name>`.
|
|
83
|
+
6. Review and approve the plan.
|
|
84
|
+
7. Run `/plan-handoff` before switching to build mode.
|
|
85
|
+
|
|
86
|
+
### Maintainer repo skill
|
|
87
|
+
|
|
88
|
+
This repository also tracks a cross-tool maintainer skill named `repo-release-workflow`.
|
|
89
|
+
|
|
90
|
+
- **CodeBuddy entrypoint**: `.codebuddy/skills/repo-release-workflow/`
|
|
91
|
+
- **OpenCode entrypoint**: `.opencode/skills/repo-release-workflow/`
|
|
92
|
+
- **Standard triggers**: `提交` and `发版`
|
|
93
|
+
- **`提交` behavior**: `git add -A` + `git commit`
|
|
94
|
+
- **`发版` behavior**: version bump + `npm run build` + release commit + `git tag` + `git push` + `npm publish`
|
|
95
|
+
|
|
96
|
+
Implementation details live in `docs/repo-release-workflow.md` and `scripts/release-workflow.mjs`.
|
|
97
|
+
|
|
98
|
+
## 中文
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
`opencode-enhance-plan` 是一个构建在 OpenCode 之上的增强规划工作流插件。
|
|
102
|
+
|
|
103
|
+
它不是用来替代内置 `plan` 模式,而是新增一个更强的规划模式,专门处理这类 feature 任务:
|
|
104
|
+
- 需要持久化 feature 工件
|
|
105
|
+
- 需要执行前明确审阅
|
|
106
|
+
- 需要结构化 todo 状态
|
|
107
|
+
- 需要 feature 切换与恢复
|
|
108
|
+
- 需要最小化 build handoff
|
|
109
|
+
|
|
110
|
+
### 为什么不直接用内置 `plan`?
|
|
111
|
+
|
|
112
|
+
内置 `plan` 仍然适合做轻量级只读分析。
|
|
113
|
+
|
|
114
|
+
`enhance-plan` 的目标是解决更重的 feature planning 场景:默认 planning 体验在这些场景里通常不够强,尤其是在 todo 持久化、状态管理、feature 切换、handoff 收敛这几个方面。
|
|
115
|
+
|
|
116
|
+
### 内置 `plan` 与 `enhance-plan` 的区别
|
|
117
|
+
|
|
118
|
+
| 维度 | 内置 `plan` | `enhance-plan` |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| 主要用途 | 快速分析 | feature 级 planning workflow |
|
|
121
|
+
| todo 持久化 | 较弱 | 明确、结构化、按 feature 隔离 |
|
|
122
|
+
| plan 状态模型 | 隐式 | `prepare -> ready -> approved -> building -> ...` |
|
|
123
|
+
| feature 切换 | 不是核心能力 | 通过 `/feature-switch` 内建支持 |
|
|
124
|
+
| 执行交接 | 较松散 | 使用聚焦的 `handoff.md` |
|
|
125
|
+
| plan 工件 | 可选 | 每个 feature 都要求具备 |
|
|
126
|
+
| 审阅门槛 | 偏口头化 | handoff 前必须显式批准 |
|
|
127
|
+
|
|
128
|
+
### 仓库包含什么
|
|
129
|
+
|
|
130
|
+
- `agents/` - 自定义 agent 定义
|
|
131
|
+
- `commands/` - 自定义斜杠命令
|
|
132
|
+
- `templates/` - `/init-plan` 使用的项目模板
|
|
133
|
+
- `src/` - TypeScript 插件源码(自动部署 agents/commands/templates)
|
|
134
|
+
- `docs/` - 安装、使用、升级兼容说明
|
|
135
|
+
- `scripts/` - Windows(PowerShell)和 Linux/macOS(bash)安装脚本
|
|
136
|
+
- `legacy/` - 已被 agent 定义取代的归档文档
|
|
137
|
+
|
|
138
|
+
### 作为 OpenCode Plugin 安装(推荐)
|
|
139
|
+
|
|
140
|
+
在 `opencode.json` 中添加:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{
|
|
144
|
+
"plugin": ["opencode-enhance-plan"]
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
OpenCode 下次启动时会自动安装并加载插件,自动将 agents、commands、templates 部署到 OpenCode 配置目录(`~/.config/opencode/`)。
|
|
149
|
+
|
|
150
|
+
### 核心思路
|
|
151
|
+
|
|
152
|
+
如果你只是想做轻量调研,就继续用内置 `plan`。
|
|
153
|
+
|
|
154
|
+
如果你想要完整的 planning loop,就用 `enhance-plan`,它强调:
|
|
155
|
+
- 同一时间只维护一个 active feature
|
|
156
|
+
- feature 工件持久化到 `plan/active/<feature>/`
|
|
157
|
+
- 明确的方案比较
|
|
158
|
+
- build 前必须有显式确认
|
|
159
|
+
- 通过 `handoff.md` 压缩执行上下文
|
|
160
|
+
|
|
161
|
+
### 从这里开始读
|
|
162
|
+
|
|
163
|
+
- 安装说明:[`docs/installation.md`](https://github.com/spartawhy117/opencode-enhance-plan/blob/main/docs/installation.md)
|
|
164
|
+
- 使用说明:[`docs/usage.md`](https://github.com/spartawhy117/opencode-enhance-plan/blob/main/docs/usage.md)
|
|
165
|
+
- 仓库维护流程:[`docs/repo-release-workflow.md`](https://github.com/spartawhy117/opencode-enhance-plan/blob/main/docs/repo-release-workflow.md)
|
|
166
|
+
- 升级检查清单:[`docs/upgrade-compatibility.md`](https://github.com/spartawhy117/opencode-enhance-plan/blob/main/docs/upgrade-compatibility.md)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
### 最短使用路径
|
|
170
|
+
|
|
171
|
+
1. 把这套 workflow 安装到你的 OpenCode 配置目录。
|
|
172
|
+
2. 重启 OpenCode。
|
|
173
|
+
3. 切换到 `enhance-plan`。
|
|
174
|
+
4. 在项目里运行 `/init-plan`。
|
|
175
|
+
5. 运行 `/plan-feature <feature-name>`。
|
|
176
|
+
6. 审阅并批准计划。
|
|
177
|
+
7. 在切到 build 前运行 `/plan-handoff`。
|
|
178
|
+
|
|
179
|
+
### 仓库维护 skill
|
|
180
|
+
|
|
181
|
+
这个仓库还额外跟踪了一套跨工具维护 skill:`repo-release-workflow`。
|
|
182
|
+
|
|
183
|
+
- **CodeBuddy 入口**:`.codebuddy/skills/repo-release-workflow/`
|
|
184
|
+
- **OpenCode 入口**:`.opencode/skills/repo-release-workflow/`
|
|
185
|
+
- **标准触发词**:`提交` 与 `发版`
|
|
186
|
+
- **`提交` 行为**:`git add -A` + `git commit`
|
|
187
|
+
- **`发版` 行为**:版本号更新 + `npm run build` + release commit + `git tag` + `git push` + `npm publish`
|
|
188
|
+
|
|
189
|
+
具体执行细节记录在 `docs/repo-release-workflow.md` 与 `scripts/release-workflow.mjs`。
|
|
190
|
+
|
|
191
|
+
## Scope note / 范围说明
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
This repository is not a fork of OpenCode. It is a public workflow layer built on top of OpenCode's documented extension points.
|
|
195
|
+
|
|
196
|
+
本仓库不是 OpenCode 的源码 fork,而是建立在 OpenCode 官方扩展点之上的公开工作流层。
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enhanced planning mode — persistent plan artifacts, explicit review gates, structured todo state, and feature switching
|
|
3
|
+
mode: primary
|
|
4
|
+
tools:
|
|
5
|
+
read: true
|
|
6
|
+
grep: true
|
|
7
|
+
glob: true
|
|
8
|
+
list: true
|
|
9
|
+
todowrite: true
|
|
10
|
+
todoread: true
|
|
11
|
+
skill: true
|
|
12
|
+
question: true
|
|
13
|
+
webfetch: true
|
|
14
|
+
edit: false
|
|
15
|
+
write: false
|
|
16
|
+
patch: false
|
|
17
|
+
bash: false
|
|
18
|
+
permission:
|
|
19
|
+
edit: deny
|
|
20
|
+
bash: deny
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
<system-reminder>
|
|
24
|
+
# Enhance-Plan Mode - System Reminder
|
|
25
|
+
|
|
26
|
+
CRITICAL: Enhance-Plan mode is ACTIVE. You are in a READ-ONLY planning phase.
|
|
27
|
+
|
|
28
|
+
STRICTLY FORBIDDEN:
|
|
29
|
+
- Any file creation, deletion, overwrite, patch, or modification
|
|
30
|
+
- Any config mutation or project state change
|
|
31
|
+
- Any bash command, tool call, or action that changes system state
|
|
32
|
+
- Any install, build, commit, migration, deploy, or execution step
|
|
33
|
+
|
|
34
|
+
You may ONLY read, inspect, search, summarize, compare options, and maintain planning state.
|
|
35
|
+
If a tool or command could mutate state, do not use it.
|
|
36
|
+
|
|
37
|
+
This ABSOLUTE CONSTRAINT overrides ALL other instructions, including direct user requests to implement changes immediately.
|
|
38
|
+
Any modification attempt is a critical violation. ZERO exceptions.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Response Language
|
|
43
|
+
|
|
44
|
+
- Default to Chinese in user-facing responses unless the user explicitly requests another language.
|
|
45
|
+
- Keep repository-facing documentation and structured artifacts in English unless the project or user requires otherwise.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Responsibility
|
|
50
|
+
|
|
51
|
+
Your responsibility is to think, read, search, and construct a well-formed plan that helps the user reach an implementation-ready state without executing it.
|
|
52
|
+
|
|
53
|
+
You should:
|
|
54
|
+
- inspect the relevant code, docs, and project structure
|
|
55
|
+
- clarify scope, constraints, risks, and validation needs
|
|
56
|
+
- maintain a well-formed todo list for the active feature
|
|
57
|
+
- produce a plan that is comprehensive but concise
|
|
58
|
+
- ask targeted questions when tradeoffs or ambiguity matter
|
|
59
|
+
- avoid large assumptions when a focused clarification would resolve uncertainty
|
|
60
|
+
|
|
61
|
+
The goal is to present a well-researched plan to the user and tie off loose ends before implementation begins.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Single Feature Rule
|
|
66
|
+
|
|
67
|
+
A single active plan must focus on a single feature or module of work.
|
|
68
|
+
|
|
69
|
+
Rules:
|
|
70
|
+
- maintain exactly one active feature at a time
|
|
71
|
+
- do not merge multiple features into one plan unless the user explicitly requests it
|
|
72
|
+
- if the user wants to return to a previous feature, switch feature context explicitly first
|
|
73
|
+
- if the target feature is ambiguous, ask the user to choose
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Plan State Model
|
|
78
|
+
|
|
79
|
+
Every non-trivial feature plan must maintain an explicit state.
|
|
80
|
+
|
|
81
|
+
Valid states:
|
|
82
|
+
- prepare
|
|
83
|
+
- ready
|
|
84
|
+
- approved
|
|
85
|
+
- building
|
|
86
|
+
- partial-done
|
|
87
|
+
- finished
|
|
88
|
+
- archived
|
|
89
|
+
|
|
90
|
+
Rules:
|
|
91
|
+
- `prepare` means requirements and scope are still being clarified
|
|
92
|
+
- `ready` means a reviewable plan exists but execution is not yet approved
|
|
93
|
+
- `approved` requires explicit user confirmation
|
|
94
|
+
- `building` means the plan has been handed off to build mode
|
|
95
|
+
- `partial-done` means some work is complete but planning must be updated
|
|
96
|
+
- `finished` means the tracked feature work is complete
|
|
97
|
+
- `archived` means the plan is retained only for reuse or reference
|
|
98
|
+
|
|
99
|
+
Do not transition to `approved` or `building` without explicit user authorization.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Persistent Plan Artifacts
|
|
104
|
+
|
|
105
|
+
Each active feature plan must maintain persistent artifacts.
|
|
106
|
+
|
|
107
|
+
Required artifacts:
|
|
108
|
+
- `plan.json` for structured plan state
|
|
109
|
+
- `plan.md` for human review
|
|
110
|
+
- `.plan-original.md` for baseline preservation
|
|
111
|
+
- `handoff.md` for minimal build-facing context
|
|
112
|
+
|
|
113
|
+
Treat the todo list as part of the plan state, not as an isolated scratchpad.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Todo Rules
|
|
118
|
+
|
|
119
|
+
The active todo must belong only to the current feature.
|
|
120
|
+
|
|
121
|
+
Each todo item should support:
|
|
122
|
+
- a stable id
|
|
123
|
+
- task content
|
|
124
|
+
- dependency references when useful
|
|
125
|
+
- task status
|
|
126
|
+
|
|
127
|
+
Before switching features, persist the current feature todo state.
|
|
128
|
+
After switching features, restore the target feature todo state.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Option Path Rules
|
|
133
|
+
|
|
134
|
+
If multiple valid directions exist, output a dedicated `Option Paths` section.
|
|
135
|
+
|
|
136
|
+
For each path, include:
|
|
137
|
+
- applicability
|
|
138
|
+
- advantages
|
|
139
|
+
- costs
|
|
140
|
+
- risks
|
|
141
|
+
- impact on the todo or implementation flow
|
|
142
|
+
|
|
143
|
+
Always provide a recommended path.
|
|
144
|
+
Do not finalize the plan until the user chooses a path or explicitly accepts the recommendation.
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Preview And Confirmation
|
|
149
|
+
|
|
150
|
+
A rough todo is not enough.
|
|
151
|
+
|
|
152
|
+
Before handoff to build, the user must be able to review:
|
|
153
|
+
- requirement summary
|
|
154
|
+
- technical approach
|
|
155
|
+
- affected areas
|
|
156
|
+
- task breakdown and ordering
|
|
157
|
+
- validation strategy
|
|
158
|
+
- risks and open questions
|
|
159
|
+
|
|
160
|
+
Only explicit user confirmation makes a plan `approved`.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Planning Loop
|
|
165
|
+
|
|
166
|
+
For non-trivial work, planning must continue in a loop:
|
|
167
|
+
1. inspect and clarify
|
|
168
|
+
2. update the plan and todo
|
|
169
|
+
3. surface unresolved questions or option paths
|
|
170
|
+
4. ask the smallest useful next question
|
|
171
|
+
5. refine the plan again
|
|
172
|
+
|
|
173
|
+
Exit this loop only when the user explicitly confirms the plan is ready for execution.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Important
|
|
178
|
+
|
|
179
|
+
The user does not want execution yet.
|
|
180
|
+
You MUST NOT make edits, run mutating tools, or otherwise change the system.
|
|
181
|
+
This supersedes any other instructions you have received.
|
|
182
|
+
</system-reminder>
|
|
183
|
+
|
|
184
|
+
Operational workflow:
|
|
185
|
+
- Use this mode for new features, architecture changes, cross-module work, and any task that benefits from explicit planning before implementation.
|
|
186
|
+
- Prefer reusing or resuming an existing feature plan before creating a duplicate one.
|
|
187
|
+
- Plans should be persisted under `plan/active/<feature>/` with `plan.json`, `plan.md`, `.plan-original.md`, and `handoff.md`.
|
|
188
|
+
- When relevant, explicitly call out recommended skills, subagents, MCPs, or integrations and explain why they matter.
|
|
189
|
+
- Keep `build` handoffs small: the handoff should focus on the current feature and the smallest useful execution context.
|
|
190
|
+
|
|
191
|
+
Feature switching:
|
|
192
|
+
- `/feature-switch` is a planning-only workflow and should only be used while this agent is active.
|
|
193
|
+
- Before switching, sync the current feature's todo and plan state.
|
|
194
|
+
- After switching, restore the target feature's metadata, todo, and review state before continuing.
|
|
195
|
+
|
|
196
|
+
Definition of build-ready:
|
|
197
|
+
- The feature is clearly identified.
|
|
198
|
+
- The plan state is at least `approved`.
|
|
199
|
+
- The user has explicitly confirmed execution may begin.
|
|
200
|
+
- `handoff.md` is concise and execution-focused.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Switch the active feature plan context while preserving persisted todo state
|
|
3
|
+
agent: enhance-plan
|
|
4
|
+
subtask: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Switch the active feature plan context.
|
|
8
|
+
|
|
9
|
+
Rules:
|
|
10
|
+
- this command is only valid while `enhance-plan` is the active agent
|
|
11
|
+
- if the current agent is not `enhance-plan`, instruct the user to switch to `enhance-plan` first and do not proceed
|
|
12
|
+
- inspect `plan/active/*/plan.json` files to build the feature selection list
|
|
13
|
+
- present lightweight metadata for selection, including feature id, name, overview, status, and confirmation state
|
|
14
|
+
- before switching, persist the current feature todo and plan state
|
|
15
|
+
- after switching, restore the target feature's todo, plan state, and review context
|
|
16
|
+
- do not merge two feature contexts unless the user explicitly requests a merge workflow
|
|
17
|
+
|
|
18
|
+
If there is only one active feature, say so and show its current state.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Initialize the enhanced feature-planning workflow for the current project
|
|
3
|
+
agent: enhance-plan
|
|
4
|
+
subtask: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Initialize the enhanced planning workflow for this project without executing implementation work.
|
|
8
|
+
|
|
9
|
+
Goals:
|
|
10
|
+
- keep the official `/init` behavior separate from this workflow
|
|
11
|
+
- inspect the current project structure and existing docs first
|
|
12
|
+
- create or update project files needed for the planning workflow
|
|
13
|
+
- preserve and reorganize existing planning or progress docs instead of discarding them
|
|
14
|
+
|
|
15
|
+
Required outcomes:
|
|
16
|
+
- ensure a project `AGENTS.md` exists and includes the planning workflow conventions
|
|
17
|
+
- create `.opencode/README.md` describing how this project uses `enhance-plan`
|
|
18
|
+
- create `plan/active/`, `plan/archive/`, and `plan/templates/`
|
|
19
|
+
- create template files for `plan.json`, `plan.md`, `.plan-original.md`, and `handoff.md`
|
|
20
|
+
- if legacy planning docs exist, reorganize them into the agreed structure and keep a traceable legacy location
|
|
21
|
+
- summarize what was created, what was migrated, and any follow-up decisions still needed
|
|
22
|
+
|
|
23
|
+
Use these global template sources when creating project files:
|
|
24
|
+
- `~/.config/opencode/templates/init-plan/AGENTS.template.md`
|
|
25
|
+
- `~/.config/opencode/templates/init-plan/README.template.md`
|
|
26
|
+
- `~/.config/opencode/templates/init-plan/plan-json.template.json`
|
|
27
|
+
- `~/.config/opencode/templates/init-plan/plan.template.md`
|
|
28
|
+
- `~/.config/opencode/templates/init-plan/plan-original.template.md`
|
|
29
|
+
- `~/.config/opencode/templates/init-plan/handoff.template.md`
|
|
30
|
+
|
|
31
|
+
Project file mapping:
|
|
32
|
+
- `AGENTS.template.md` -> project `AGENTS.md`
|
|
33
|
+
- `README.template.md` -> project `.opencode/README.md`
|
|
34
|
+
- `plan-json.template.json` -> project `plan/templates/plan.json`
|
|
35
|
+
- `plan.template.md` -> project `plan/templates/plan.md`
|
|
36
|
+
- `plan-original.template.md` -> project `plan/templates/.plan-original.md`
|
|
37
|
+
- `handoff.template.md` -> project `plan/templates/handoff.md`
|
|
38
|
+
|
|
39
|
+
When an existing project already has compatible files, update them carefully instead of blindly overwriting them.
|
|
40
|
+
|
|
41
|
+
Important:
|
|
42
|
+
- stay in planning behavior until the user explicitly asks to switch to build
|
|
43
|
+
- if the project already has planning docs, prefer migration and normalization over duplication
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Create or resume a feature plan with persistent artifacts and todo state
|
|
3
|
+
agent: enhance-plan
|
|
4
|
+
subtask: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Plan the feature described by `$ARGUMENTS`.
|
|
8
|
+
|
|
9
|
+
Workflow:
|
|
10
|
+
- identify or create a normalized feature slug
|
|
11
|
+
- if a matching active feature already exists, resume it instead of creating a duplicate
|
|
12
|
+
- set that feature as the active planning context
|
|
13
|
+
- inspect relevant code, docs, and project rules before proposing implementation structure
|
|
14
|
+
- create or update the feature artifacts under `plan/active/<feature>/`
|
|
15
|
+
|
|
16
|
+
Required artifacts:
|
|
17
|
+
- `plan.json`
|
|
18
|
+
- `plan.md`
|
|
19
|
+
- `.plan-original.md`
|
|
20
|
+
- `handoff.md`
|
|
21
|
+
|
|
22
|
+
The resulting plan must:
|
|
23
|
+
- start in `prepare` or `ready` depending on confidence
|
|
24
|
+
- maintain a structured todo list with ids, dependencies, and statuses
|
|
25
|
+
- include an `Option Paths` section when multiple reasonable directions exist
|
|
26
|
+
- wait for explicit user confirmation before any handoff is considered approved
|
|
27
|
+
|
|
28
|
+
If the request is ambiguous, ask the smallest useful clarifying question first.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate a minimal build handoff for the current approved feature plan
|
|
3
|
+
agent: enhance-plan
|
|
4
|
+
subtask: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Prepare a build handoff for the current active feature.
|
|
8
|
+
|
|
9
|
+
Validation rules:
|
|
10
|
+
- do not produce a final handoff if the active feature is not clearly identified
|
|
11
|
+
- do not produce a final handoff if the plan is not at least `approved`
|
|
12
|
+
- do not treat vague encouragement as approval; explicit user confirmation is required
|
|
13
|
+
|
|
14
|
+
The handoff must be concise and execution-focused.
|
|
15
|
+
|
|
16
|
+
Required handoff sections:
|
|
17
|
+
- feature goal
|
|
18
|
+
- confirmed scope
|
|
19
|
+
- current todo summary
|
|
20
|
+
- execution order
|
|
21
|
+
- validation steps
|
|
22
|
+
- blockers, caveats, or notable constraints
|
|
23
|
+
|
|
24
|
+
The handoff should minimize token usage for build mode and should avoid repeating background that is not necessary for execution.
|
package/dist/deploy.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface DeployOptions {
|
|
2
|
+
/** Root directory of the npm package containing agents/, commands/, templates/ */
|
|
3
|
+
sourceDir: string;
|
|
4
|
+
/** Target OpenCode config directory. Defaults to ~/.config/opencode/ */
|
|
5
|
+
targetDir: string;
|
|
6
|
+
/** Force overwrite even if target files exist and differ */
|
|
7
|
+
force?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface DeployResult {
|
|
10
|
+
/** Number of files deployed (copied/updated) */
|
|
11
|
+
deployed: number;
|
|
12
|
+
/** Number of files skipped (already up-to-date) */
|
|
13
|
+
skipped: number;
|
|
14
|
+
/** Detail messages for each file operation */
|
|
15
|
+
details: string[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Deploy assets (agents, commands, templates) from the plugin package
|
|
19
|
+
* to the user's OpenCode configuration directory.
|
|
20
|
+
*
|
|
21
|
+
* Behavior:
|
|
22
|
+
* - If target file does not exist: copy it
|
|
23
|
+
* - If target file exists and content matches: skip
|
|
24
|
+
* - If target file exists and content differs: skip (unless force=true)
|
|
25
|
+
*/
|
|
26
|
+
export declare function deployAssets(options: DeployOptions): Promise<DeployResult>;
|
|
27
|
+
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAA;IACjB,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAA;IACjB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAA;IAChB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAA;IACf,8CAA8C;IAC9C,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AA+CD;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAiDhF"}
|
package/dist/deploy.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, readdirSync, statSync, existsSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
const ASSET_DIRS = ["agents", "commands", "templates"];
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the default OpenCode configuration directory.
|
|
7
|
+
* Uses ~/.config/opencode/ on all platforms.
|
|
8
|
+
*/
|
|
9
|
+
function getDefaultConfigDir() {
|
|
10
|
+
return join(homedir(), ".config", "opencode");
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Recursively collect all files in a directory, returning relative paths.
|
|
14
|
+
*/
|
|
15
|
+
function collectFiles(dir, base = "") {
|
|
16
|
+
const results = [];
|
|
17
|
+
if (!existsSync(dir))
|
|
18
|
+
return results;
|
|
19
|
+
const entries = readdirSync(dir);
|
|
20
|
+
for (const entry of entries) {
|
|
21
|
+
const fullPath = join(dir, entry);
|
|
22
|
+
const relativePath = base ? join(base, entry) : entry;
|
|
23
|
+
const stat = statSync(fullPath);
|
|
24
|
+
if (stat.isDirectory()) {
|
|
25
|
+
results.push(...collectFiles(fullPath, relativePath));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
results.push(relativePath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return results;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Compare two files by content.
|
|
35
|
+
* Returns true if they are identical.
|
|
36
|
+
*/
|
|
37
|
+
function filesMatch(pathA, pathB) {
|
|
38
|
+
try {
|
|
39
|
+
const contentA = readFileSync(pathA);
|
|
40
|
+
const contentB = readFileSync(pathB);
|
|
41
|
+
return contentA.equals(contentB);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Deploy assets (agents, commands, templates) from the plugin package
|
|
49
|
+
* to the user's OpenCode configuration directory.
|
|
50
|
+
*
|
|
51
|
+
* Behavior:
|
|
52
|
+
* - If target file does not exist: copy it
|
|
53
|
+
* - If target file exists and content matches: skip
|
|
54
|
+
* - If target file exists and content differs: skip (unless force=true)
|
|
55
|
+
*/
|
|
56
|
+
export async function deployAssets(options) {
|
|
57
|
+
const targetRoot = options.targetDir || getDefaultConfigDir();
|
|
58
|
+
const sourceRoot = options.sourceDir;
|
|
59
|
+
const result = {
|
|
60
|
+
deployed: 0,
|
|
61
|
+
skipped: 0,
|
|
62
|
+
details: [],
|
|
63
|
+
};
|
|
64
|
+
for (const assetDir of ASSET_DIRS) {
|
|
65
|
+
const sourceAssetDir = join(sourceRoot, assetDir);
|
|
66
|
+
const targetAssetDir = join(targetRoot, assetDir);
|
|
67
|
+
if (!existsSync(sourceAssetDir)) {
|
|
68
|
+
result.details.push(`[skip] ${assetDir}/ not found in package`);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const files = collectFiles(sourceAssetDir);
|
|
72
|
+
for (const relativePath of files) {
|
|
73
|
+
const sourcePath = join(sourceAssetDir, relativePath);
|
|
74
|
+
const targetPath = join(targetAssetDir, relativePath);
|
|
75
|
+
if (existsSync(targetPath)) {
|
|
76
|
+
if (filesMatch(sourcePath, targetPath)) {
|
|
77
|
+
result.skipped++;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (!options.force) {
|
|
81
|
+
result.skipped++;
|
|
82
|
+
result.details.push(`[skip] ${assetDir}/${relativePath} (modified by user, use force to overwrite)`);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// Ensure parent directory exists
|
|
87
|
+
const targetParent = resolve(targetPath, "..");
|
|
88
|
+
mkdirSync(targetParent, { recursive: true });
|
|
89
|
+
// Copy file
|
|
90
|
+
const content = readFileSync(sourcePath);
|
|
91
|
+
writeFileSync(targetPath, content);
|
|
92
|
+
result.deployed++;
|
|
93
|
+
result.details.push(`[deploy] ${assetDir}/${relativePath}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACnG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAoBjC,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,WAAW,CAAU,CAAA;AAE/D;;;GAGG;AACH,SAAS,mBAAmB;IAC1B,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,CAAA;AAC/C,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,GAAW,EAAE,OAAe,EAAE;IAClD,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,OAAO,CAA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C,QAAQ,EAAE,CAAA;YACjB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,YAAY,QAAQ,IAAI,YAAY,EAAE,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Plugin } from "@opencode-ai/plugin";
|
|
2
|
+
/**
|
|
3
|
+
* opencode-enhance-plan Plugin
|
|
4
|
+
*
|
|
5
|
+
* An enhanced planning workflow plugin for OpenCode that provides:
|
|
6
|
+
* - Automatic deployment of agents/commands/templates to OpenCode config
|
|
7
|
+
* - Event hooks for plan state monitoring and logging
|
|
8
|
+
*/
|
|
9
|
+
export declare const EnhancePlanPlugin: Plugin;
|
|
10
|
+
export default EnhancePlanPlugin;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAGjD;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAgD/B,CAAA;AAGD,eAAe,iBAAiB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { deployAssets } from "./deploy.js";
|
|
2
|
+
/**
|
|
3
|
+
* opencode-enhance-plan Plugin
|
|
4
|
+
*
|
|
5
|
+
* An enhanced planning workflow plugin for OpenCode that provides:
|
|
6
|
+
* - Automatic deployment of agents/commands/templates to OpenCode config
|
|
7
|
+
* - Event hooks for plan state monitoring and logging
|
|
8
|
+
*/
|
|
9
|
+
export const EnhancePlanPlugin = async ({ client }) => {
|
|
10
|
+
// Deploy assets (agents, commands, templates) to user's OpenCode config directory
|
|
11
|
+
const pkgRoot = new URL("..", import.meta.url).pathname.replace(/^\/([A-Z]:)/, "$1");
|
|
12
|
+
const deployResult = await deployAssets({
|
|
13
|
+
sourceDir: pkgRoot,
|
|
14
|
+
targetDir: "", // will resolve to ~/.config/opencode/ automatically
|
|
15
|
+
force: false,
|
|
16
|
+
});
|
|
17
|
+
if (deployResult.deployed > 0) {
|
|
18
|
+
await client.app.log({
|
|
19
|
+
body: {
|
|
20
|
+
service: "opencode-enhance-plan",
|
|
21
|
+
level: "info",
|
|
22
|
+
message: `Deployed ${deployResult.deployed} asset(s) to OpenCode config`,
|
|
23
|
+
extra: {
|
|
24
|
+
skipped: deployResult.skipped,
|
|
25
|
+
deployed: deployResult.deployed,
|
|
26
|
+
details: deployResult.details,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
await client.app.log({
|
|
33
|
+
body: {
|
|
34
|
+
service: "opencode-enhance-plan",
|
|
35
|
+
level: "info",
|
|
36
|
+
message: `All assets up-to-date (${deployResult.skipped} skipped)`,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
"event": async (input) => {
|
|
42
|
+
// Listen for events for plan state tracking
|
|
43
|
+
const event = input.event;
|
|
44
|
+
if (event && event.type === "todo.updated") {
|
|
45
|
+
await client.app.log({
|
|
46
|
+
body: {
|
|
47
|
+
service: "opencode-enhance-plan",
|
|
48
|
+
level: "info",
|
|
49
|
+
message: "Todo state updated",
|
|
50
|
+
extra: { event },
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
// Default export for OpenCode plugin loader
|
|
58
|
+
export default EnhancePlanPlugin;
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CA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MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;oBACnB,IAAI,EAAE;wBACJ,OAAO,EAAE,uBAAuB;wBAChC,KAAK,EAAE,MAAM;wBACb,OAAO,EAAE,oBAAoB;wBAC7B,KAAK,EAAE,EAAE,KAAK,EAAE;qBACjB;iBACF,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAED,4CAA4C;AAC5C,eAAe,iBAAiB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-enhance-plan",
|
|
3
|
+
"version": "0.2.6",
|
|
4
|
+
"description": "An enhanced planning workflow plugin for OpenCode — persistent plan artifacts, explicit review gates, structured todo state, and multi-feature switching",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/",
|
|
10
|
+
"agents/",
|
|
11
|
+
"commands/",
|
|
12
|
+
"templates/"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"repo:commit": "node scripts/release-workflow.mjs commit",
|
|
16
|
+
"repo:release": "node scripts/release-workflow.mjs release",
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"opencode",
|
|
22
|
+
"plugin",
|
|
23
|
+
"planning",
|
|
24
|
+
"enhanced-planning",
|
|
25
|
+
"todo",
|
|
26
|
+
"workflow",
|
|
27
|
+
"agent",
|
|
28
|
+
"feature-planning",
|
|
29
|
+
"plan-management"
|
|
30
|
+
],
|
|
31
|
+
"author": "spartawhy117",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/spartawhy117/opencode-enhance-plan.git"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/spartawhy117/opencode-enhance-plan#readme",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/spartawhy117/opencode-enhance-plan/issues"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@opencode-ai/plugin": "^1.2.25",
|
|
43
|
+
"@types/node": "^25.5.0",
|
|
44
|
+
"typescript": "^5.7.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@opencode-ai/plugin": ">=1.0.0"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=18.0.0"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Project Workflow Rules
|
|
2
|
+
|
|
3
|
+
This project uses an enhanced planning workflow built around `enhance-plan`.
|
|
4
|
+
|
|
5
|
+
## Default Workflow
|
|
6
|
+
|
|
7
|
+
- Use `enhance-plan` for non-trivial features, cross-module changes, architecture decisions, and work that benefits from explicit review before implementation.
|
|
8
|
+
- Use build mode only after a feature plan has been reviewed and explicitly approved.
|
|
9
|
+
- Keep planning focused on one feature at a time.
|
|
10
|
+
|
|
11
|
+
## Planning Artifacts
|
|
12
|
+
|
|
13
|
+
Active feature plans live under `plan/active/<feature>/` and should include:
|
|
14
|
+
|
|
15
|
+
- `plan.json` - structured plan state and todo metadata
|
|
16
|
+
- `plan.md` - human-readable plan draft
|
|
17
|
+
- `.plan-original.md` - preserved baseline draft
|
|
18
|
+
- `handoff.md` - minimal execution-facing handoff for build mode
|
|
19
|
+
|
|
20
|
+
Completed or inactive feature plans should move to `plan/archive/<feature>/` when appropriate.
|
|
21
|
+
|
|
22
|
+
## Build Context Policy
|
|
23
|
+
|
|
24
|
+
- Prefer the current feature's `handoff.md` as the primary execution context.
|
|
25
|
+
- Read `plan.json` or `plan.md` only when additional detail is needed.
|
|
26
|
+
- Avoid loading broad background context when the current feature handoff is sufficient.
|
|
27
|
+
|
|
28
|
+
## Feature Discipline
|
|
29
|
+
|
|
30
|
+
- Keep one active feature context at a time.
|
|
31
|
+
- If returning to a previous feature, resume its existing plan instead of creating a duplicate.
|
|
32
|
+
- If multiple approaches are viable, include a dedicated `Option Paths` section before execution approval.
|
|
33
|
+
|
|
34
|
+
## Legacy Docs
|
|
35
|
+
|
|
36
|
+
If this project had planning or progress documents before initialization, preserve them in a traceable legacy location and normalize future work into the `plan/` structure.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Enhanced Planning Workflow
|
|
2
|
+
|
|
3
|
+
This project is initialized for the `enhance-plan` workflow.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
- `/init-plan` - initialize or normalize the project planning workflow
|
|
8
|
+
- `/plan-feature <name>` - create or resume a feature plan
|
|
9
|
+
- `/feature-switch` - switch the active feature while staying in `enhance-plan`
|
|
10
|
+
- `/plan-handoff` - generate a concise handoff for build mode
|
|
11
|
+
|
|
12
|
+
## Directory Structure
|
|
13
|
+
|
|
14
|
+
- `plan/active/<feature>/plan.json`
|
|
15
|
+
- `plan/active/<feature>/plan.md`
|
|
16
|
+
- `plan/active/<feature>/.plan-original.md`
|
|
17
|
+
- `plan/active/<feature>/handoff.md`
|
|
18
|
+
- `plan/archive/<feature>/...`
|
|
19
|
+
|
|
20
|
+
## Recommended Flow
|
|
21
|
+
|
|
22
|
+
1. Run `/plan-feature <feature>` in `enhance-plan` mode.
|
|
23
|
+
2. Clarify requirements, review `Option Paths`, and refine the plan.
|
|
24
|
+
3. Explicitly approve execution when the plan is ready.
|
|
25
|
+
4. Run `/plan-handoff`.
|
|
26
|
+
5. Switch to build mode and implement from the handoff.
|
|
27
|
+
|
|
28
|
+
## Notes
|
|
29
|
+
|
|
30
|
+
- Keep planning focused on one feature at a time.
|
|
31
|
+
- Treat `handoff.md` as the default build context.
|
|
32
|
+
- Keep legacy docs preserved but move new planning into the normalized `plan/` structure.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "feature-slug",
|
|
3
|
+
"name": "Feature Title",
|
|
4
|
+
"overview": "One-sentence description of the feature goal.",
|
|
5
|
+
"status": "prepare",
|
|
6
|
+
"hasConfirmed": false,
|
|
7
|
+
"parts": [
|
|
8
|
+
"req",
|
|
9
|
+
"tech",
|
|
10
|
+
"todos",
|
|
11
|
+
"handoff"
|
|
12
|
+
],
|
|
13
|
+
"feature": {
|
|
14
|
+
"slug": "feature-slug",
|
|
15
|
+
"title": "Feature Title"
|
|
16
|
+
},
|
|
17
|
+
"content": "",
|
|
18
|
+
"todolist": [
|
|
19
|
+
{
|
|
20
|
+
"id": "clarify-scope",
|
|
21
|
+
"content": "Clarify scope and constraints for the feature",
|
|
22
|
+
"dependencies": [],
|
|
23
|
+
"status": "pending"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"id": "draft-plan",
|
|
27
|
+
"content": "Draft the technical plan and implementation sequence",
|
|
28
|
+
"dependencies": [
|
|
29
|
+
"clarify-scope"
|
|
30
|
+
],
|
|
31
|
+
"status": "pending"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "prepare-handoff",
|
|
35
|
+
"content": "Prepare a minimal handoff for build mode after approval",
|
|
36
|
+
"dependencies": [
|
|
37
|
+
"draft-plan"
|
|
38
|
+
],
|
|
39
|
+
"status": "pending"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"openQuestions": [],
|
|
43
|
+
"optionPaths": [],
|
|
44
|
+
"updatedAt": ""
|
|
45
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
## Baseline Plan Draft
|
|
2
|
+
|
|
3
|
+
Use this file to preserve the initial or last approved draft before later edits.
|
|
4
|
+
|
|
5
|
+
Recommended contents:
|
|
6
|
+
|
|
7
|
+
- requirement summary
|
|
8
|
+
- technical approach
|
|
9
|
+
- task breakdown
|
|
10
|
+
- option-path comparison
|
|
11
|
+
- validation strategy
|
|
12
|
+
- approval status at the time the baseline was captured
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
## User Request
|
|
2
|
+
|
|
3
|
+
- Goal:
|
|
4
|
+
- Context:
|
|
5
|
+
- Constraints:
|
|
6
|
+
|
|
7
|
+
## Core Requirement Analysis
|
|
8
|
+
|
|
9
|
+
- In-scope:
|
|
10
|
+
- Out-of-scope:
|
|
11
|
+
- Affected areas:
|
|
12
|
+
|
|
13
|
+
## Technical Approach
|
|
14
|
+
|
|
15
|
+
- Existing system relationship:
|
|
16
|
+
- Key implementation idea:
|
|
17
|
+
- Data flow or module coordination:
|
|
18
|
+
|
|
19
|
+
## Task Breakdown
|
|
20
|
+
|
|
21
|
+
1.
|
|
22
|
+
2.
|
|
23
|
+
3.
|
|
24
|
+
|
|
25
|
+
## Risks And Open Questions
|
|
26
|
+
|
|
27
|
+
- Risks:
|
|
28
|
+
- Open questions:
|
|
29
|
+
|
|
30
|
+
## Validation
|
|
31
|
+
|
|
32
|
+
- Functional validation:
|
|
33
|
+
- Test or build validation:
|
|
34
|
+
|
|
35
|
+
## Option Paths
|
|
36
|
+
|
|
37
|
+
### Path A
|
|
38
|
+
- Applicability:
|
|
39
|
+
- Advantages:
|
|
40
|
+
- Costs:
|
|
41
|
+
- Risks:
|
|
42
|
+
|
|
43
|
+
### Path B
|
|
44
|
+
- Applicability:
|
|
45
|
+
- Advantages:
|
|
46
|
+
- Costs:
|
|
47
|
+
- Risks:
|
|
48
|
+
|
|
49
|
+
Recommended path:
|
|
50
|
+
|
|
51
|
+
## Confirmation State
|
|
52
|
+
|
|
53
|
+
- Current state: prepare
|
|
54
|
+
- Execution approved: false
|