abelworkflow 0.1.0
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/.gitignore +13 -0
- package/.skill-lock.json +29 -0
- package/AGENTS.md +45 -0
- package/README.md +147 -0
- package/bin/abelworkflow.mjs +2 -0
- package/commands/oc/diagnose.md +63 -0
- package/commands/oc/implementation.md +157 -0
- package/commands/oc/init.md +27 -0
- package/commands/oc/plan.md +88 -0
- package/commands/oc/research.md +126 -0
- package/lib/cli.mjs +222 -0
- package/package.json +23 -0
- package/skills/confidence-check/SKILL.md +124 -0
- package/skills/confidence-check/confidence.ts +335 -0
- package/skills/context7-auto-research/.env +4 -0
- package/skills/context7-auto-research/.env.example +4 -0
- package/skills/context7-auto-research/SKILL.md +83 -0
- package/skills/context7-auto-research/context7-api.js +283 -0
- package/skills/dev-browser/SKILL.md +225 -0
- package/skills/dev-browser/bun.lock +443 -0
- package/skills/dev-browser/package-lock.json +2988 -0
- package/skills/dev-browser/package.json +31 -0
- package/skills/dev-browser/references/scraping.md +155 -0
- package/skills/dev-browser/resolve-skill-dir.sh +35 -0
- package/skills/dev-browser/scripts/start-relay.ts +32 -0
- package/skills/dev-browser/scripts/start-server.ts +117 -0
- package/skills/dev-browser/server.sh +24 -0
- package/skills/dev-browser/src/client.ts +474 -0
- package/skills/dev-browser/src/index.ts +287 -0
- package/skills/dev-browser/src/relay.ts +731 -0
- package/skills/dev-browser/src/snapshot/browser-script.ts +877 -0
- package/skills/dev-browser/src/snapshot/index.ts +14 -0
- package/skills/dev-browser/src/snapshot/inject.ts +13 -0
- package/skills/dev-browser/src/types.ts +34 -0
- package/skills/dev-browser/tsconfig.json +36 -0
- package/skills/dev-browser/vitest.config.ts +12 -0
- package/skills/git-commit/SKILL.md +124 -0
- package/skills/grok-search/.env.example +24 -0
- package/skills/grok-search/SKILL.md +114 -0
- package/skills/grok-search/requirements.txt +2 -0
- package/skills/grok-search/scripts/groksearch_cli.py +1214 -0
- package/skills/grok-search/scripts/groksearch_entry.py +116 -0
- package/skills/prompt-enhancer/ADVANCED.md +74 -0
- package/skills/prompt-enhancer/SKILL.md +71 -0
- package/skills/prompt-enhancer/TEMPLATE.md +91 -0
- package/skills/prompt-enhancer/scripts/enhance.py +142 -0
- package/skills/sequential-think/SKILL.md +198 -0
- package/skills/sequential-think/scripts/.env.example +5 -0
- package/skills/sequential-think/scripts/sequential_think_cli.py +253 -0
- package/skills/time/SKILL.md +116 -0
- package/skills/time/scripts/time_cli.py +104 -0
package/.gitignore
ADDED
package/.skill-lock.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"skills": {
|
|
4
|
+
"git-commit": {
|
|
5
|
+
"source": "github/awesome-copilot",
|
|
6
|
+
"sourceType": "github",
|
|
7
|
+
"sourceUrl": "https://github.com/github/awesome-copilot.git",
|
|
8
|
+
"skillPath": "skills/git-commit/SKILL.md",
|
|
9
|
+
"skillFolderHash": "883a6a7466f55a9cd9f22cf1cce2d9333fc9b998",
|
|
10
|
+
"installedAt": "2026-03-12T08:25:08.313Z",
|
|
11
|
+
"updatedAt": "2026-03-12T08:25:08.313Z"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"dismissed": {
|
|
15
|
+
"findSkillsPrompt": true
|
|
16
|
+
},
|
|
17
|
+
"lastSelectedAgents": [
|
|
18
|
+
"amp",
|
|
19
|
+
"cline",
|
|
20
|
+
"codex",
|
|
21
|
+
"cursor",
|
|
22
|
+
"gemini-cli",
|
|
23
|
+
"github-copilot",
|
|
24
|
+
"kimi-cli",
|
|
25
|
+
"opencode",
|
|
26
|
+
"claude-code",
|
|
27
|
+
"crush"
|
|
28
|
+
]
|
|
29
|
+
}
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Configuration
|
|
2
|
+
|
|
3
|
+
## Language
|
|
4
|
+
|
|
5
|
+
- Tool/model interactions: **English**
|
|
6
|
+
- User-facing output: **Chinese**
|
|
7
|
+
|
|
8
|
+
## Code Style
|
|
9
|
+
|
|
10
|
+
- Concise, efficient, no redundancy
|
|
11
|
+
- Minimal comments/docs (only when necessary)
|
|
12
|
+
- Targeted changes only; never touch unrelated functionality
|
|
13
|
+
|
|
14
|
+
## Context Rules
|
|
15
|
+
|
|
16
|
+
- Use `mcp__augment-context-engine__codebase-retrieval` as the primary codebase search tool
|
|
17
|
+
- Rely only on project code plus `grok/context7` results
|
|
18
|
+
- If information is insufficient or uncertain, state it explicitly
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/oc:init → /oc:research → /oc:plan → /oc:implementation(TDD)
|
|
24
|
+
↘ /oc:diagnose (bug fix)
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Universal Constraints
|
|
28
|
+
|
|
29
|
+
1. Use `unified diff patch` format for proposed/applied changes
|
|
30
|
+
2. Require confidence ≥90% before applying changes
|
|
31
|
+
|
|
32
|
+
## Stage Skill Matrix
|
|
33
|
+
|
|
34
|
+
| Skill | Research | Plan | Implement | Diagnose | Capability & Triggers |
|
|
35
|
+
| --- | :---: | :---: | :---: | :---: | --- |
|
|
36
|
+
| /sequential-think | ✅ | ✅ | ❌ | ✅ | Multi-step reasoning, hypothesis testing. Trigger: 3+ interconnected components |
|
|
37
|
+
| /grok-search | ✅ | ○ | ❌ | ✅ | Deep research, concept understanding. Trigger: architectural patterns, best practices |
|
|
38
|
+
| /context7-auto-research | ✅ | ✅ | ✅ | ✅ | Official docs retrieval. Trigger: framework/library usage, APIs |
|
|
39
|
+
| /dev-browser | ○ | ○ | ✅ | ✅ | Browser automation. Trigger: E2E testing, UI verification |
|
|
40
|
+
| /confidence-check | ❌ | ✅ | ✅ | ✅ | Readiness verification. Trigger: before implementation/fix (≥90%) |
|
|
41
|
+
| /time | ○ | ✅ | ✅ | ○ | Time/timezone operations. Trigger: scheduling logic |
|
|
42
|
+
|
|
43
|
+
Legend: ✅ Primary, ○ Optional, ❌ Forbidden
|
|
44
|
+
|
|
45
|
+
OpenSpec commands: `/opsx:new` `/opsx:ff` `/opsx:archive` `openspec view` `openspec status`
|
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# AbelWorkflow
|
|
2
|
+
|
|
3
|
+
Codex、OpenCode、Claude Code 的 Skills 和 Commands 配置仓库。
|
|
4
|
+
|
|
5
|
+
## 目录结构
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.agents/
|
|
9
|
+
├── skills/ # 技能目录
|
|
10
|
+
│ ├── time/ # 时间与时区工具
|
|
11
|
+
│ ├── grok-search/ # 增强型网页搜索
|
|
12
|
+
│ ├── sequential-think/ # 多步推理引擎
|
|
13
|
+
│ ├── dev-browser/ # 浏览器自动化
|
|
14
|
+
│ ├── context7-auto-research/ # 自动文档检索
|
|
15
|
+
│ ├── confidence-check/ # 实施前信心评估
|
|
16
|
+
│ ├── git-commit/ # Git 提交助手
|
|
17
|
+
│ └── prompt-enhancer/ # 提示词优化器
|
|
18
|
+
├── commands/ # 命令目录
|
|
19
|
+
│ └── oc/ # 工作流命令
|
|
20
|
+
├── AGENTS.md # Agent 全局系统 prompts
|
|
21
|
+
└── README.md
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## 技能概览
|
|
25
|
+
|
|
26
|
+
| 技能 | 描述 |
|
|
27
|
+
|------|------|
|
|
28
|
+
| **time** | 时间和时区工具,获取当前时间及时区转换 |
|
|
29
|
+
| **grok-search** | 通过 Grok API 增强网页搜索与实时内容检索 |
|
|
30
|
+
| **sequential-think** | 多步推理引擎,支持假设检验与分支的复杂分析 |
|
|
31
|
+
| **dev-browser** | 浏览器自动化,支持导航、表单填写、截图与数据提取 |
|
|
32
|
+
| **context7-auto-research** | 自动从 Context7 获取最新库/框架文档 |
|
|
33
|
+
| **confidence-check** | 实施前置信度评估(≥90%),含架构合规与根因识别 |
|
|
34
|
+
| **git-commit** | Conventional Commits 规范提交,智能暂存与消息生成 |
|
|
35
|
+
| **prompt-enhancer** | CoT 推理优化 AI 编码提示词,模糊请求转结构化指令 |
|
|
36
|
+
|
|
37
|
+
## 命令概览
|
|
38
|
+
|
|
39
|
+
| 命令 | 描述 |
|
|
40
|
+
|------|------|
|
|
41
|
+
| **/oc:init** | 初始化 OpenSpec 环境并验证工具链 |
|
|
42
|
+
| **/oc:research** | 结构化需求探索与约束集生成(不实施) |
|
|
43
|
+
| **/oc:plan** | 将已批准变更细化为零决策可执行方案 |
|
|
44
|
+
| **/oc:implementation** | 以 TDD 方式实施已批准的变更 |
|
|
45
|
+
| **/oc:diagnose** | 系统化根因分析与批量修复报告 |
|
|
46
|
+
|
|
47
|
+
## 工作流
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
/oc:init → /oc:research → /oc:plan → /oc:implementation(TDD)
|
|
51
|
+
↘ /oc:diagnose (bug fix)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 配置说明
|
|
55
|
+
|
|
56
|
+
- **目录位置**:
|
|
57
|
+
- Linux/macOS: `~/.agents/`
|
|
58
|
+
- Windows: `%USERPROFILE%\.agents\`(PowerShell: `$HOME\.agents`)
|
|
59
|
+
- **AGENTS.md**: Agent 全局系统 prompts 配置
|
|
60
|
+
|
|
61
|
+
## 安装与更新
|
|
62
|
+
|
|
63
|
+
### 推荐:`npx` 一键安装
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# 安装到 ~/.agents,并自动完成 ~/.claude / ~/.codex 的链接
|
|
67
|
+
npx abelworkflow
|
|
68
|
+
|
|
69
|
+
# 更新到最新发布版本
|
|
70
|
+
npx abelworkflow@latest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> 说明:
|
|
74
|
+
> - npm 发布包名必须使用小写,所以实际可执行命令是 `npx abelworkflow`。
|
|
75
|
+
> - 仓库显示名可以继续叫 `AbelWorkflow`,但不建议承诺 `npx AbelWorkflow`,这不符合 npm 当前命名规则。
|
|
76
|
+
> - 一键安装会把仓库内容同步到 `~/.agents`,并自动建立下文 README 中的链接关系,无需再手动执行 `ln -s`。
|
|
77
|
+
|
|
78
|
+
### 备用:Git 克隆安装
|
|
79
|
+
|
|
80
|
+
### Linux/macOS(bash/zsh)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# 首次安装
|
|
84
|
+
git clone https://github.com/abelxiaoxing/AbelWorkflow ~/.agents
|
|
85
|
+
|
|
86
|
+
# 更新
|
|
87
|
+
git -C ~/.agents pull
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Windows(PowerShell)
|
|
91
|
+
|
|
92
|
+
```powershell
|
|
93
|
+
# 首次安装
|
|
94
|
+
git clone https://github.com/abelxiaoxing/AbelWorkflow "$HOME\.agents"
|
|
95
|
+
|
|
96
|
+
# 更新
|
|
97
|
+
git -C "$HOME\.agents" pull
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 链接到 Claude Code / Codex(`npx` 会自动完成)
|
|
101
|
+
|
|
102
|
+
> 目标:把本仓库作为「单一来源」,通过符号链接同步到 `~/.claude/` 和 `~/.codex/`。以后只需 `git -C ~/.agents pull`,两边配置会自动更新。
|
|
103
|
+
|
|
104
|
+
### 映射关系(本仓库 → 配置目录)
|
|
105
|
+
|
|
106
|
+
| 本仓库 | Claude Code | Codex | 说明 |
|
|
107
|
+
|---|---|---|---|
|
|
108
|
+
| `AGENTS.md` | `~/.claude/CLAUDE.md` | `~/.codex/AGENTS.md` | 全局系统提示词/规则 |
|
|
109
|
+
| `skills/<skill>/` | `~/.claude/skills/<skill>/` | `~/.codex/skills/<skill>/` | Skills(每个目录一个技能) |
|
|
110
|
+
| `commands/oc/` | `~/.claude/commands/oc/` | `~/.codex/prompts/*.md` | Claude 读 `commands/`;Codex 读 `prompts/` |
|
|
111
|
+
|
|
112
|
+
### Linux/macOS(bash/zsh)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
AGENTS_DIR="$HOME/.agents"
|
|
116
|
+
|
|
117
|
+
# Claude Code
|
|
118
|
+
mkdir -p "$HOME/.claude/commands" "$HOME/.claude/skills"
|
|
119
|
+
ln -s "$AGENTS_DIR/AGENTS.md" "$HOME/.claude/CLAUDE.md"
|
|
120
|
+
ln -s "$AGENTS_DIR/commands/oc" "$HOME/.claude/commands/oc"
|
|
121
|
+
for d in "$AGENTS_DIR/skills/"*; do
|
|
122
|
+
[ -d "$d" ] && ln -s "$d" "$HOME/.claude/skills/"
|
|
123
|
+
done
|
|
124
|
+
|
|
125
|
+
# Codex
|
|
126
|
+
mkdir -p "$HOME/.codex/skills" "$HOME/.codex/prompts"
|
|
127
|
+
ln -s "$AGENTS_DIR/AGENTS.md" "$HOME/.codex/AGENTS.md"
|
|
128
|
+
for d in "$AGENTS_DIR/skills/"*; do
|
|
129
|
+
[ -d "$d" ] && ln -s "$d" "$HOME/.codex/skills/"
|
|
130
|
+
done
|
|
131
|
+
ln -s "$AGENTS_DIR/commands/oc/init.md" "$HOME/.codex/prompts/init.md"
|
|
132
|
+
ln -s "$AGENTS_DIR/commands/oc/research.md" "$HOME/.codex/prompts/research.md"
|
|
133
|
+
ln -s "$AGENTS_DIR/commands/oc/plan.md" "$HOME/.codex/prompts/plan.md"
|
|
134
|
+
ln -s "$AGENTS_DIR/commands/oc/implementation.md" "$HOME/.codex/prompts/implementation.md"
|
|
135
|
+
ln -s "$AGENTS_DIR/commands/oc/diagnose.md" "$HOME/.codex/prompts/diagnose.md"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
> 提示:
|
|
139
|
+
> - 如果提示 `File exists`,说明目标路径已存在:先备份/删除原文件(例如 `mv ~/.claude/CLAUDE.md ~/.claude/CLAUDE.md.bak`),再重新执行 `ln -s`。
|
|
140
|
+
> - 不建议把整个 `skills/` 目录直接链接成 `~/.codex/skills`,否则可能遮住 Codex 自带的 `~/.codex/skills/.system/`。
|
|
141
|
+
|
|
142
|
+
### 验证(可选)
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
ls -la "$HOME/.claude/CLAUDE.md" "$HOME/.claude/commands/oc"
|
|
146
|
+
ls -la "$HOME/.codex/AGENTS.md" "$HOME/.codex/prompts/"{init,research,plan,implementation,diagnose}.md
|
|
147
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: OC:Diagnose
|
|
3
|
+
description: Parallel diagnosis with batch fix reporting via systematic root cause analysis.
|
|
4
|
+
category: OC
|
|
5
|
+
tags: [diagnosis, bugfix]
|
|
6
|
+
argument-hint: <problem-description>
|
|
7
|
+
---
|
|
8
|
+
<!-- OC:START -->
|
|
9
|
+
**Arguments**
|
|
10
|
+
- Required: `<problem-description>` (one or more bug descriptions; comma-separated supported)
|
|
11
|
+
|
|
12
|
+
**Guardrails**
|
|
13
|
+
- Root cause first; never fix symptoms only
|
|
14
|
+
- Verify root cause hypothesis with evidence before fix
|
|
15
|
+
- Confidence gate: ≥90% before applying fixes
|
|
16
|
+
- Every fix must include a regression test
|
|
17
|
+
- Keep changes minimal and scoped
|
|
18
|
+
- If verification fails, rollback and iterate
|
|
19
|
+
|
|
20
|
+
**Execution Model**
|
|
21
|
+
- Run detection and root-cause analysis for all issues in parallel
|
|
22
|
+
- Infer scope automatically from problem text, traces, and retrieved code context
|
|
23
|
+
- Build dependency/conflict order before any fix application
|
|
24
|
+
- Same file: force sequential fix order; same symbol: merge when compatible, otherwise sequential
|
|
25
|
+
- Independent scopes: parallel-safe
|
|
26
|
+
- Fix generation for READY issues runs fully in parallel via subagents with forked/minimal context; main agent only aggregates and resolves conflicts
|
|
27
|
+
- Patch application and final verification must run strictly sequential by dependency order
|
|
28
|
+
- Always output one consolidated batch report
|
|
29
|
+
|
|
30
|
+
**Skill Integration**: See `Stage Skill Matrix` (Diagnose column)
|
|
31
|
+
|
|
32
|
+
**Steps**
|
|
33
|
+
1. Parse input, infer scope, and split into issue list (single or multiple).
|
|
34
|
+
2. For each issue in parallel: collect logs/traces and locate code via `mcp__augment-context-engine__codebase-retrieval`.
|
|
35
|
+
3. For each issue in parallel: perform root cause analysis; use `/sequential-think` for multi-component chains.
|
|
36
|
+
4. Build dependency/conflict graph across issues and compute safe fix order.
|
|
37
|
+
5. Run `/confidence-check` per issue; only issues with score ≥90% can move to fix generation.
|
|
38
|
+
6. Spawn one subagent per READY issue to generate `unified diff patch` and regression test with minimal scoped context.
|
|
39
|
+
7. Main agent reviews/merges subagent outputs by dependency order and outputs one batch report with all issue statuses and patches.
|
|
40
|
+
8. Apply merged patches strictly sequentially by dependency order.
|
|
41
|
+
9. Run final verification strictly sequentially by the same dependency order and output verification matrix.
|
|
42
|
+
|
|
43
|
+
**Batch Output**
|
|
44
|
+
```text
|
|
45
|
+
## /oc:diagnose Batch Report
|
|
46
|
+
|
|
47
|
+
### Batch Summary
|
|
48
|
+
Total: {n} | ReadyToFix: {n_ready} | Blocked: {n_blocked}
|
|
49
|
+
|
|
50
|
+
### Issue Results
|
|
51
|
+
- [{id}] Classification: {category}/{severity} | Root Cause: {summary} | Confidence: {score} | Subagent: {agent_id|none} | Status: {READY|BLOCKED}
|
|
52
|
+
|
|
53
|
+
### Patch Queue (dependency order)
|
|
54
|
+
1. [{id}] [subagent:{agent_id}] {file_list}
|
|
55
|
+
{unified_diff_patch}
|
|
56
|
+
|
|
57
|
+
### Verification Matrix
|
|
58
|
+
- [{id}] Regression: {passed|failed} | Affected Suite: {passed|failed}
|
|
59
|
+
|
|
60
|
+
### Final Status
|
|
61
|
+
{FIXED|PARTIAL|NEEDS_REVIEW|BLOCKED}
|
|
62
|
+
```
|
|
63
|
+
<!-- OC:END -->
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: OC:Implementation
|
|
3
|
+
description: Implement approved changes with mandatory TDD.
|
|
4
|
+
category: OC
|
|
5
|
+
tags: [openspec, implementation, TDD]
|
|
6
|
+
argument-hint: [change_name]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!-- OC:START -->
|
|
10
|
+
**Arguments**
|
|
11
|
+
- Requested: `<change_name>`
|
|
12
|
+
|
|
13
|
+
**Guardrails**
|
|
14
|
+
|
|
15
|
+
**Guardrails**
|
|
16
|
+
|
|
17
|
+
- Keep changes tightly scoped to the requested outcome; enforce side-effect review before applying any modification.
|
|
18
|
+
- Minimize documentation—avoid unnecessary comments; prefer self-explanatory code.
|
|
19
|
+
- Refer to `openspec/AGENTS.md` (located inside the `openspec/` directory—run `ls openspec` or `openspec update` if you don't see it) for additional OpenSpec conventions or clarifications.
|
|
20
|
+
|
|
21
|
+
**TDD Guardrails (mandatory)**
|
|
22
|
+
- **Red Phase**: Generate failing tests ONLY; implementation code is FORBIDDEN.
|
|
23
|
+
- **Green Phase**: Write MINIMAL code to pass tests; over-engineering is FORBIDDEN.
|
|
24
|
+
- **Refactor Phase**: Optimize code quality while keeping ALL tests passing.
|
|
25
|
+
- **Mandatory**: Run tests after EVERY code change; never skip verification.
|
|
26
|
+
- **Test-First**: Each task MUST have a failing test before implementation begins.
|
|
27
|
+
|
|
28
|
+
**Skill Integration**: See `Stage Skill Matrix` (Implement column)
|
|
29
|
+
|
|
30
|
+
**Tool Routing**:
|
|
31
|
+
- **TDD Cycle**: Autonomous refactoring
|
|
32
|
+
- **Final Review** (after all tasks):
|
|
33
|
+
- Backend refactor (subagents)
|
|
34
|
+
- Frontend refactor (subagents)
|
|
35
|
+
- **E2E tasks** → `/dev-browser`
|
|
36
|
+
|
|
37
|
+
1. Run `openspec view` to inspect current project status and review `Active Changes`; ask the user to confirm which change folder (`<change_name>`) they want to implement.
|
|
38
|
+
2. Check artifact status: `openspec status --change <change_name>`
|
|
39
|
+
3. Get apply instructions: `openspec instructions apply --change <change_name>`
|
|
40
|
+
4. Detect test framework: identify project's testing setup (pytest/jest/vitest/etc.)
|
|
41
|
+
5. Work through tasks sequentially; for each task, execute the **TDD Cycle** below.
|
|
42
|
+
|
|
43
|
+
**TDD Cycle (per task)**
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
┌─────────────────────────────────────────────────────────┐
|
|
47
|
+
│ Step 0: Pre-Check │
|
|
48
|
+
│ └─ /confidence-check → require ≥90% to proceed │
|
|
49
|
+
├─────────────────────────────────────────────────────────┤
|
|
50
|
+
│ Step 1: 🔴 Red Phase - Generate Failing Test │
|
|
51
|
+
│ ├─ Analyze task → determine test type │
|
|
52
|
+
│ │ ├─ Backend → pytest/jest │
|
|
53
|
+
│ │ ├─ Frontend → vitest/jest │
|
|
54
|
+
│ │ └─ E2E → dev-browser │
|
|
55
|
+
│ ├─ Generate test via │
|
|
56
|
+
│ │ PROMPT: "Generate failing test for: {task} │
|
|
57
|
+
│ │ Context: {code_context} │
|
|
58
|
+
│ │ Output: unified diff patch │
|
|
59
|
+
│ │ FORBIDDEN: implementation code" │
|
|
60
|
+
│ ├─ Apply test code (after review) │
|
|
61
|
+
│ ├─ Run test → MUST FAIL │
|
|
62
|
+
│ └─ If passes → test invalid, regenerate │
|
|
63
|
+
├─────────────────────────────────────────────────────────┤
|
|
64
|
+
│ Step 2: 🟢 Green Phase - Minimal Implementation │
|
|
65
|
+
│ ├─ Generate minimal implementation │
|
|
66
|
+
│ │ PROMPT: "Generate minimal code to pass test: │
|
|
67
|
+
│ │ Test: {test_code} │
|
|
68
|
+
│ │ Context: {code_context} │
|
|
69
|
+
│ │ Output: unified diff patch │
|
|
70
|
+
│ │ FORBIDDEN: over-engineering" │
|
|
71
|
+
│ ├─ Apply implementation (after review & rewrite) │
|
|
72
|
+
│ ├─ Run test → MUST PASS │
|
|
73
|
+
│ └─ If fails → analyze error, fix, retry │
|
|
74
|
+
├─────────────────────────────────────────────────────────┤
|
|
75
|
+
│ Step 3: 🔵 Refactor Phase │
|
|
76
|
+
│ ├─ Analyzes code quality │
|
|
77
|
+
│ ├─ Apply standard refactoring techniques: │
|
|
78
|
+
│ │ ├─ Eliminate code duplication │
|
|
79
|
+
│ │ ├─ Improve naming and structure │
|
|
80
|
+
│ │ ├─ Enhance readability │
|
|
81
|
+
│ │ └─ Simplify logic where possible │
|
|
82
|
+
│ ├─ Apply refactoring changes │
|
|
83
|
+
│ ├─ Run test → MUST STILL PASS │
|
|
84
|
+
│ └─ If fails → rollback refactoring │
|
|
85
|
+
└─────────────────────────────────────────────────────────┘
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
6. Before applying any change, perform mandatory side-effect review.
|
|
89
|
+
|
|
90
|
+
7. After TDD cycle completes for a task, mark as `- [x]` in `tasks.md`.
|
|
91
|
+
|
|
92
|
+
**Final Review & Refactor** (after all tasks complete)
|
|
93
|
+
|
|
94
|
+
8. Run all tests to ensure everything passes.
|
|
95
|
+
|
|
96
|
+
9. Execute global code review via subagents:
|
|
97
|
+
|
|
98
|
+
10. Wait for background tasks to complete; review diff patches.
|
|
99
|
+
11. Rewrite patches into production-grade code (per rewriting principle).
|
|
100
|
+
12. Apply refactoring changes.
|
|
101
|
+
13. Run all tests → MUST ALL PASS.
|
|
102
|
+
14. If any test fails → analyze root cause, fix or rollback.
|
|
103
|
+
15. Perform final side-effect review.
|
|
104
|
+
16. Run `openspec archive <change_name>` or `/opsx:archive`.
|
|
105
|
+
|
|
106
|
+
**TDD Output Format**
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
## /oc:implementation (TDD Mode)
|
|
110
|
+
|
|
111
|
+
### Task 1/N: {task_description}
|
|
112
|
+
|
|
113
|
+
📋 Confidence Check: {score}% {status}
|
|
114
|
+
|
|
115
|
+
🔴 Red Phase
|
|
116
|
+
├─ Generated: tests/{test_file}
|
|
117
|
+
├─ Run: {test_command}
|
|
118
|
+
└─ Result: {count} failed ✓ (expected)
|
|
119
|
+
|
|
120
|
+
🟢 Green Phase
|
|
121
|
+
├─ Generated: src/{impl_file}
|
|
122
|
+
├─ Run: {test_command}
|
|
123
|
+
└─ Result: {count} passed ✓
|
|
124
|
+
|
|
125
|
+
🔵 Refactor Phase (Agent autonomous)
|
|
126
|
+
├─ Optimized: {description}
|
|
127
|
+
├─ Run: {test_command}
|
|
128
|
+
└─ Result: {count} passed ✓
|
|
129
|
+
|
|
130
|
+
✓ Task complete → Next task
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### All Tasks Complete
|
|
135
|
+
|
|
136
|
+
🔍 Final Review & Refactor
|
|
137
|
+
|
|
138
|
+
Backend Review
|
|
139
|
+
├─ Files: {backend_files}
|
|
140
|
+
├─ Status: Running in background...
|
|
141
|
+
└─ Task ID: {task_id}
|
|
142
|
+
|
|
143
|
+
Frontend Review
|
|
144
|
+
├─ Files: {frontend_files}
|
|
145
|
+
├─ Status: Running in background...
|
|
146
|
+
└─ Task ID: {task_id}
|
|
147
|
+
|
|
148
|
+
[Waiting for completion...]
|
|
149
|
+
|
|
150
|
+
✓ Reviews complete
|
|
151
|
+
├─ Applied: {refactoring_summary}
|
|
152
|
+
├─ Tests: {count} passed ✓
|
|
153
|
+
└─ Ready for archive
|
|
154
|
+
|
|
155
|
+
✓ Implementation complete
|
|
156
|
+
```
|
|
157
|
+
<!-- OC:END -->
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: OC:Init
|
|
3
|
+
description: Initialize OpenSpec environment and validate required tooling.
|
|
4
|
+
category: OC
|
|
5
|
+
tags: [openspec, init, setup]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<!-- OC:START -->
|
|
9
|
+
**Guardrails**
|
|
10
|
+
- Complete steps in order; stop on failure
|
|
11
|
+
- Preserve existing config; do not overwrite without confirmation
|
|
12
|
+
- Provide actionable remediation when a step fails
|
|
13
|
+
|
|
14
|
+
**Steps**
|
|
15
|
+
1. Detect OS and adapt command style (Unix/PowerShell).
|
|
16
|
+
2. Verify `openspec` availability via `openspec --version`.
|
|
17
|
+
3. If missing, `npm install -g @fission-ai/openspec@latest`, then re-check version.
|
|
18
|
+
4. Run `openspec init` (or `openspec update` for existing projects).
|
|
19
|
+
5. Verify required capability:
|
|
20
|
+
- MCP: `mcp__augment-context-engine__codebase-retrieval`
|
|
21
|
+
- Skills: `/dev-browser` `/sequential-think` `/context7-auto-research` `/grok-search` `/confidence-check`
|
|
22
|
+
6. Output summary with ✓/✗:
|
|
23
|
+
- OpenSpec installation
|
|
24
|
+
- Project initialization
|
|
25
|
+
- MCP availability
|
|
26
|
+
- Required skills availability
|
|
27
|
+
<!-- OC:END -->
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: OC:Plan
|
|
3
|
+
description: Refine approved change into a zero-decision executable plan.
|
|
4
|
+
category: OC
|
|
5
|
+
tags: [OC, plan, PBT]
|
|
6
|
+
argument-hint: [change_name]
|
|
7
|
+
---
|
|
8
|
+
<!-- OC:START -->
|
|
9
|
+
**Guardrails**
|
|
10
|
+
- Strictly adhere to **OpenSpec** rules when writing **standardized spec-structured projects**.
|
|
11
|
+
- The goal of this phase is to eliminate ALL decision points from the task flow—implementation should be pure mechanical execution.
|
|
12
|
+
- Do not proceed to implementation until every ambiguity is resolved and every constraint is explicitly documented.
|
|
13
|
+
- Every requirement must have Property-Based Testing (PBT) properties defined—focus on invariants, not just example-based tests.
|
|
14
|
+
- If constraints cannot be fully specified, escalate back to the user or return to the research phase rather than making assumptions.
|
|
15
|
+
- Refer to `openspec/AGENTS.md` for additional conventions; run `openspec update` if the file is missing.
|
|
16
|
+
|
|
17
|
+
**Skill Integration**: See `Stage Skill Matrix` (Plan column)
|
|
18
|
+
|
|
19
|
+
**FORBIDDEN**: Direct implementation code generation
|
|
20
|
+
|
|
21
|
+
**Steps**
|
|
22
|
+
1. Run `openspec view` to display all **Active Changes**, then confirm with the user which change folder (`<change_name>`) they wish to refine into a zero-decision plan.
|
|
23
|
+
|
|
24
|
+
2. Navigate to `openspec/changes/<change_name>/` and review existing artifacts:
|
|
25
|
+
- Check `openspec status --change <change_name>` for artifact completion
|
|
26
|
+
- Use `openspec instructions specs --change <change_name>` for specs guidance
|
|
27
|
+
|
|
28
|
+
3. **Implementation Analysis**: Invoke skills to perform systematic analysis to derive a plan:
|
|
29
|
+
```
|
|
30
|
+
# First, invoke /sequential-think skill for systematic analysis if proposal has 3+ interconnected requirements
|
|
31
|
+
|
|
32
|
+
/sequential-think: "Analyze change <change_name> systematically: Break down into components, identify dependencies, evaluate architectural trade-offs, and surface potential conflicts."
|
|
33
|
+
|
|
34
|
+
# Then invoke /context7-auto-research skill to validate framework/library choices
|
|
35
|
+
|
|
36
|
+
/context7-auto-research: "For each technology mentioned in change <change_name>, retrieve official documentation patterns and best practices."
|
|
37
|
+
```
|
|
38
|
+
Produce a consolidated, constraint-complete plan and list any missing constraints as questions to the user.
|
|
39
|
+
|
|
40
|
+
4. **Uncertainty Elimination Audit**: Invoke skills to detect and eliminate remaining ambiguities:
|
|
41
|
+
```
|
|
42
|
+
# First, use augment-context-engine to validate against existing codebase patterns
|
|
43
|
+
mcp__augment-context-engine__codebase-retrieval: "Search for existing implementations similar to change <change_name>. Keywords: [key concepts from proposal]"
|
|
44
|
+
# Then audit for ambiguities directly and list them explicitly
|
|
45
|
+
Review change <change_name> for decision points that remain unspecified. For each: [AMBIGUITY] <description> → [REQUIRED CONSTRAINT] <what must be specified>.
|
|
46
|
+
Identify implicit assumptions in change <change_name>. For each: [ASSUMPTION] <description> → [EXPLICIT CONSTRAINT NEEDED] <concrete specification>.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Anti-Pattern Detection** (flag and reject):
|
|
50
|
+
- Information collection without decision boundaries (e.g., "JWT vs OAuth2 vs session—all viable")
|
|
51
|
+
- Technical comparisons without selection criteria
|
|
52
|
+
- Deferred decisions marked as "to be determined during implementation"
|
|
53
|
+
|
|
54
|
+
**Target Pattern** (required for approval):
|
|
55
|
+
- Explicit technology choices with parameters (e.g., "JWT with accessToken TTL=15min, refreshToken TTL=7days")
|
|
56
|
+
- Concrete algorithm selections with configurations (e.g., "bcrypt with cost factor=12")
|
|
57
|
+
- Precise behavioral rules (e.g., "Lock account for 30min after 5 failed login attempts")
|
|
58
|
+
|
|
59
|
+
Iterate with user until ALL ambiguities are resolved into explicit constraints.
|
|
60
|
+
|
|
61
|
+
5. **PBT Property Extraction**: Invoke skills to derive testable invariants:
|
|
62
|
+
```
|
|
63
|
+
"Extract Property-Based Testing properties from change <change_name>. For each requirement: [INVARIANT] <must always hold> → [FALSIFICATION STRATEGY] <how to generate counterexamples>."
|
|
64
|
+
"Define system properties for change <change_name>: [PROPERTY] <name> | [DEFINITION] <formal description> | [BOUNDARY CONDITIONS] <edge cases> | [COUNTEREXAMPLE GENERATION] <approach>."
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**PBT Property Categories to Extract**:
|
|
68
|
+
- **Commutativity/Associativity**: Order-independent operations
|
|
69
|
+
- **Idempotency**: Repeated operations yield same result
|
|
70
|
+
- **Round-trip**: Encode→Decode returns original
|
|
71
|
+
- **Invariant Preservation**: State constraints maintained across operations
|
|
72
|
+
- **Monotonicity**: Ordering guarantees (e.g., timestamps always increase)
|
|
73
|
+
- **Bounds**: Value ranges, size limits, rate constraints
|
|
74
|
+
|
|
75
|
+
**Reference**
|
|
76
|
+
- Use `openspec show <change_name> --json --deltas-only` to inspect proposal structure when validation fails.
|
|
77
|
+
- Use `openspec list --specs` to check for conflicts with existing specifications.
|
|
78
|
+
- Search existing patterns with `rg -n "INVARIANT:|PROPERTY:|Constraint:" openspec/` before defining new ones.
|
|
79
|
+
- For complex proposals, consider running steps 2-4 iteratively on sub-components.
|
|
80
|
+
- Use `AskUserQuestions` for ANY ambiguity—do not assume or guess.
|
|
81
|
+
|
|
82
|
+
**Exit Criteria**
|
|
83
|
+
A proposal is ready to exit the Plan phase only when:
|
|
84
|
+
- [ ] Zero ambiguities remain (verified by step 4 audit)
|
|
85
|
+
- [ ] All PBT properties documented with falsification strategies
|
|
86
|
+
- [ ] `openspec validate <change_name> --strict` returns zero issues
|
|
87
|
+
- [ ] User has explicitly approved all constraint decisions
|
|
88
|
+
<!-- OC:END -->
|