Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions extensions/dev-workflow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# @openclaw/dev-workflow
[中文文档](./README_CN.md)

AI-driven spec-driven development workflow plugin for [OpenClaw](https://github.com/openclaw/openclaw), integrating Claw Code harness patterns with multi-agent orchestration.

## Features

- **3 Complexity Modes**: Quick (fast fixes), Standard (balanced), Full (production-grade)
- **10-Step Workflow**: Analysis → Requirement → Brainstorm → Spec → Tech Selection → Development → Review → Test → Docs → Delivery
- **Ship/Show/Ask Framework**: Automatic categorization of changes for safe delivery
- **Multi-Agent Orchestration**: Subagent runtime for LLM calls, code review, test execution
- **TDD Cycle Enforcement**: RED → GREEN → REFACTOR → VERIFY → COMMIT (strict in Full mode)
- **Conventional Commits**: Auto-generated `type(scope): description` commit messages
- **Working Memory**: 3-layer context system (Project → Task → Step)
- **QA Gate**: 10 quality checks including lint, format, tests, coverage, typecheck, simplify, commits, todos, docs, and rule enforcement
- **Rule Enforcement**: 21 built-in code quality rules (configurable via feature flags)
- **Feature Flags**: Fine-grained control over workflow behavior
- **GitHub Integration**: Auto-tag releases, merge feature branches, update repo descriptions
- **Git Branch Management**: Automatic `feature/<project>-<timestamp>` branch creation

## Installation

```bash
# In your OpenClaw monorepo
pnpm add @openclaw/dev-workflow --workspace
```

Or add to `extensions/` directory for local development.

## Usage

### As an OpenClaw Extension

The plugin registers automatically when loaded by OpenClaw's plugin discovery system.

### Tools Provided

| Tool | Description |
|------|-------------|
| `dev_workflow_start` | Start a new workflow with a requirement |
| `workflow_status` | Check current workflow progress |
| `task_execute` | Execute a specific task by ID |
| `spec_view` | View the spec (proposal, design, tasks) |
| `qa_gate_check` | Run quality gate checks |

### Starting a Workflow

```
dev_workflow_start({
requirement: "Add dark mode toggle to settings page",
projectDir: "/path/to/project",
mode: "standard",
featureFlags: {
strictTdd: true,
ruleEnforcement: true
}
})
```

### Feature Flags

| Flag | Default | Description |
|------|---------|-------------|
| `strictTdd` | `false` | Enforce strict TDD (auto-enabled in Full mode) |
| `ruleEnforcement` | `true` | Check code against 21 quality rules |
| `autoCommit` | `true` | Auto-commit after task completion |
| `workingMemoryPersist` | `true` | Persist working memory across tasks |
| `dependencyParallelTasks` | `true` | Execute independent tasks in dependency order |
| `conventionalCommits` | `true` | Generate Conventional Commits messages |
| `qaGateBlocking` | `false` | Block delivery on QA failures (auto-enabled in Full mode) |
| `githubIntegration` | `true` | Enable GitHub tag/release/merge steps |
| `coverageThreshold` | `80` | Minimum test coverage percentage |
| `maxFileLines` | `500` | Maximum lines per file before warning |
| `maxFunctionLines` | `50` | Maximum lines per function before warning |

### QA Gate Checks

1. **lint** — ESLint or project lint script
2. **format** — Prettier or project format script
3. **tests** — Test suite execution
4. **coverage** — Coverage threshold enforcement
5. **typecheck** — TypeScript type checking
6. **simplify** — Complex function/file detection
7. **commits** — Conventional Commits format validation
8. **todos** — TODO/FIXME/HACK/XXX detection
9. **docs** — README.md existence and content
10. **rules** — 21 built-in code quality rules

### Rule Enforcement (21 Rules)

Rules are checked during QA gate and embedded in agent prompts during task execution:

- No unused variables, prefer const, no console.log
- No any type, explicit return types, no magic numbers
- File/function size limits, no inline styles
- Prefer immutable patterns, avoid deep nesting
- No duplicate code, meaningful names, single responsibility
- No commented code, no debugger, no hardcoded secrets
- Prefer early return, avoid boolean params
- No global mutation, prefer pure functions

## Architecture

```
src/
├── index.ts # Plugin entry point
├── types.ts # Domain types & feature flags
├── channel/
│ ├── dev-workflow-channel.ts # Channel plugin definition
│ └── runtime.ts # Runtime singleton
├── agents/
│ └── index.ts # AgentOrchestrator (9 agent methods)
├── engine/
│ └── index.ts # DevWorkflowEngine (10-step workflow)
├── tools/
│ ├── dev-workflow-tool.ts # Start workflow tool
│ ├── workflow-status-tool.ts # Status check tool
│ ├── task-execute-tool.ts # Task execution tool
│ ├── spec-view-tool.ts # Spec viewer tool
│ ├── qa-gate-tool.ts # QA gate with 10 checks
│ └── index.ts # Tool registration
└── hooks/
└── index.ts # Event hooks (4 hooks)
```

## Development

```bash
# Install dependencies
pnpm install

# Type check
pnpm typecheck

# Run tests
pnpm test

# Build
pnpm build

# Lint
pnpm lint
```

## License

MIT
147 changes: 147 additions & 0 deletions extensions/dev-workflow/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# @openclaw/dev-workflow
[English Docs](./README.md)

基于 AI 的规格驱动开发工作流插件,适用于 [OpenClaw](https://github.com/openclaw/openclaw),集成 Claw Code harness 模式与多智能体编排。

## 功能特性

- **3 种复杂度模式**: Quick(快速修复)、Standard(均衡模式)、Full(生产级)
- **10 步工作流**: 分析 → 需求 → 头脑风暴 → 规格 → 技术选型 → 开发 → 评审 → 测试 → 文档 → 交付
- **Ship/Show/Ask 框架**: 自动分类变更以安全交付
- **多智能体编排**: 通过子智能体运行时进行 LLM 调用、代码评审、测试执行
- **TDD 周期强制**: RED → GREEN → REFACTOR → VERIFY → COMMIT(Full 模式下严格)
- **约定式提交**: 自动生成 `type(scope): description` 提交信息
- **工作记忆**: 3 层上下文系统(项目 → 任务 → 步骤)
- **QA 质量门**: 10 项质量检查,包括 lint、格式化、测试、覆盖率、类型检查、简化、提交、TODO、文档和规则执行
- **规则执行**: 21 条内置代码质量规则(通过 feature flags 配置)
- **Feature Flags**: 细粒度控制工作流行为
- **GitHub 集成**: 自动标签发布、合并特性分支、更新仓库描述
- **Git 分支管理**: 自动创建 `feature/<project>-<timestamp>` 分支

## 安装

```bash
# 在 OpenClaw 单仓库中
pnpm add @openclaw/dev-workflow --workspace
```

或添加到 `extensions/` 目录进行本地开发。

## 使用方法

### 作为 OpenClaw 扩展

插件在 OpenClaw 插件发现系统加载时自动注册。

### 提供的工具

| 工具 | 描述 |
|------|------|
| `dev_workflow_start` | 启动新的工作流 |
| `workflow_status` | 检查当前工作流进度 |
| `task_execute` | 按 ID 执行特定任务 |
| `spec_view` | 查看规格(提案、设计、任务) |
| `qa_gate_check` | 运行质量门检查 |

### 启动工作流

```
dev_workflow_start({
requirement: "为设置页面添加暗色模式切换",
projectDir: "/path/to/project",
mode: "standard",
featureFlags: {
strictTdd: true,
ruleEnforcement: true
}
})
```

### Feature Flags

| 标志 | 默认值 | 描述 |
|------|--------|------|
| `strictTdd` | `false` | 强制严格 TDD(Full 模式自动启用) |
| `ruleEnforcement` | `true` | 检查代码是否符合 21 条质量规则 |
| `autoCommit` | `true` | 任务完成后自动提交 |
| `workingMemoryPersist` | `true` | 跨任务持久化工作记忆 |
| `dependencyParallelTasks` | `true` | 按依赖顺序执行独立任务 |
| `conventionalCommits` | `true` | 生成约定式提交信息 |
| `qaGateBlocking` | `false` | QA 失败时阻止交付(Full 模式自动启用) |
| `githubIntegration` | `true` | 启用 GitHub 标签/发布/合并步骤 |
| `coverageThreshold` | `80` | 最低测试覆盖率百分比 |
| `maxFileLines` | `500` | 文件最大行数警告阈值 |
| `maxFunctionLines` | `50` | 函数最大行数警告阈值 |

### QA 质量门检查

1. **lint** — ESLint 或项目 lint 脚本
2. **format** — Prettier 或项目格式化脚本
3. **tests** — 测试套件执行
4. **coverage** — 覆盖率阈值检查
5. **typecheck** — TypeScript 类型检查
6. **simplify** — 复杂函数/文件检测
7. **commits** — 约定式提交格式验证
8. **todos** — TODO/FIXME/HACK/XXX 检测
9. **docs** — README.md 存在性和内容检查
10. **rules** — 21 条内置代码质量规则

### 规则执行(21 条规则)

规则在 QA 质量门期间检查,并在任务执行期间嵌入智能体提示:

- 无未使用变量、优先使用 const、禁止 console.log
- 禁止 any 类型、显式返回类型、禁止魔术数字
- 文件/函数大小限制、禁止内联样式
- 优先不可变模式、避免深层嵌套
- 禁止重复代码、有意义命名、单一职责
- 禁止注释代码、禁止 debugger、禁止硬编码密钥
- 优先早期返回、避免布尔参数
- 禁止全局变异、优先纯函数

## 架构

```
src/
├── index.ts # 插件入口
├── types.ts # 领域类型 & feature flags
├── channel/
│ ├── dev-workflow-channel.ts # 频道插件定义
│ └── runtime.ts # 运行时单例
├── agents/
│ └── index.ts # AgentOrchestrator(9 个智能体方法)
├── engine/
│ └── index.ts # DevWorkflowEngine(10 步工作流)
├── tools/
│ ├── dev-workflow-tool.ts # 启动工作流工具
│ ├── workflow-status-tool.ts # 状态检查工具
│ ├── task-execute-tool.ts # 任务执行工具
│ ├── spec-view-tool.ts # 规格查看工具
│ ├── qa-gate-tool.ts # QA 质量门(10 项检查)
│ └── index.ts # 工具注册
└── hooks/
└── index.ts # 事件钩子(4 个钩子)
```

## 开发

```bash
# 安装依赖
pnpm install

# 类型检查
pnpm typecheck

# 运行测试
pnpm test

# 构建
pnpm build

# Lint
pnpm lint
```

## 许可证

MIT
38 changes: 38 additions & 0 deletions extensions/dev-workflow/openclaw.plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"id": "dev-workflow",
"enabledByDefault": false,
"channels": ["dev-workflow"],
"skills": ["./skills"],
"configSchema": {
"type": "object",
"additionalProperties": false,
"properties": {
"defaultMode": {
"type": "string",
"enum": ["quick", "standard", "full"],
"default": "standard",
"description": "Default complexity mode for development tasks"
},
"defaultModel": {
"type": "string",
"default": "kilo/minimax/minimax-m2.5:free",
"description": "Default model for agent orchestration"
},
"specDriven": {
"type": "boolean",
"default": true,
"description": "Enable spec-driven development (proposal/design/tasks)"
},
"qualityGate": {
"type": "boolean",
"default": true,
"description": "Enable QA gate checks before delivery"
},
"agentParallelism": {
"type": "boolean",
"default": true,
"description": "Allow parallel agent execution for independent tasks"
}
}
}
}
Loading