cowork-flow 0.0.1
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/README.md +193 -0
- package/bin/cowork-flow.js +9 -0
- package/package.json +28 -0
- package/src/cli.js +61 -0
- package/src/commands/init.js +88 -0
- package/src/commands/sync.js +33 -0
- package/src/commands/update.js +60 -0
- package/src/lib/copy-template.js +189 -0
- package/src/lib/package-info.js +49 -0
- package/src/lib/paths.js +6 -0
- package/template/.agent/skills/break-loop/SKILL.md +131 -0
- package/template/.agent/skills/check-cross-layer/SKILL.md +158 -0
- package/template/.agent/skills/finish-work/SKILL.md +163 -0
- package/template/.agent/skills/record-session/SKILL.md +78 -0
- package/template/.agent/skills/start/SKILL.md +390 -0
- package/template/.agent/skills/update-spec/SKILL.md +335 -0
- package/template/.cowork-flow/.version +1 -0
- package/template/.cowork-flow/changes/archive/.gitkeep +1 -0
- package/template/.cowork-flow/config.yaml +49 -0
- package/template/.cowork-flow/plans/.gitkeep +1 -0
- package/template/.cowork-flow/scripts/add_session.py +441 -0
- package/template/.cowork-flow/scripts/change.py +314 -0
- package/template/.cowork-flow/scripts/common/__init__.py +84 -0
- package/template/.cowork-flow/scripts/common/config.py +128 -0
- package/template/.cowork-flow/scripts/common/developer.py +205 -0
- package/template/.cowork-flow/scripts/common/files.py +24 -0
- package/template/.cowork-flow/scripts/common/git_context.py +628 -0
- package/template/.cowork-flow/scripts/common/paths.py +350 -0
- package/template/.cowork-flow/scripts/common/task_utils.py +200 -0
- package/template/.cowork-flow/scripts/get_context.py +16 -0
- package/template/.cowork-flow/scripts/get_developer.py +26 -0
- package/template/.cowork-flow/scripts/init_developer.py +51 -0
- package/template/.cowork-flow/scripts/task.py +1378 -0
- package/template/.cowork-flow/spec/backend/database-guidelines.md +26 -0
- package/template/.cowork-flow/spec/backend/directory-structure.md +27 -0
- package/template/.cowork-flow/spec/backend/error-handling.md +20 -0
- package/template/.cowork-flow/spec/backend/index.md +36 -0
- package/template/.cowork-flow/spec/backend/logging-guidelines.md +20 -0
- package/template/.cowork-flow/spec/backend/quality-guidelines.md +24 -0
- package/template/.cowork-flow/spec/frontend/component-guidelines.md +19 -0
- package/template/.cowork-flow/spec/frontend/directory-structure.md +18 -0
- package/template/.cowork-flow/spec/frontend/hook-guidelines.md +17 -0
- package/template/.cowork-flow/spec/frontend/index.md +28 -0
- package/template/.cowork-flow/spec/frontend/quality-guidelines.md +23 -0
- package/template/.cowork-flow/spec/frontend/state-management.md +18 -0
- package/template/.cowork-flow/spec/frontend/type-safety.md +18 -0
- package/template/.cowork-flow/spec/guides/code-reuse-thinking-guide.md +26 -0
- package/template/.cowork-flow/spec/guides/cross-layer-thinking-guide.md +21 -0
- package/template/.cowork-flow/spec/guides/index.md +31 -0
- package/template/.cowork-flow/spec/guides/pre-implementation-checklist.md +15 -0
- package/template/.cowork-flow/tasks/.gitkeep +1 -0
- package/template/.cowork-flow/tasks/archive/.gitkeep +1 -0
- package/template/.cowork-flow/workflow.md +411 -0
- package/template/.cowork-flow/workspace/index.md +95 -0
- package/template/.superpowers/brainstorming/SKILL.md +164 -0
- package/template/.superpowers/brainstorming/scripts/frame-template.html +214 -0
- package/template/.superpowers/brainstorming/scripts/helper.js +88 -0
- package/template/.superpowers/brainstorming/scripts/server.cjs +354 -0
- package/template/.superpowers/brainstorming/scripts/start-server.sh +148 -0
- package/template/.superpowers/brainstorming/scripts/stop-server.sh +56 -0
- package/template/.superpowers/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/template/.superpowers/brainstorming/visual-companion.md +287 -0
- package/template/.superpowers/dispatching-parallel-agents/SKILL.md +182 -0
- package/template/.superpowers/executing-plans/SKILL.md +70 -0
- package/template/.superpowers/finishing-a-development-branch/SKILL.md +251 -0
- package/template/.superpowers/receiving-code-review/SKILL.md +213 -0
- package/template/.superpowers/requesting-code-review/SKILL.md +103 -0
- package/template/.superpowers/requesting-code-review/code-reviewer.md +168 -0
- package/template/.superpowers/subagent-driven-development/SKILL.md +279 -0
- package/template/.superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +25 -0
- package/template/.superpowers/subagent-driven-development/implementer-prompt.md +113 -0
- package/template/.superpowers/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/template/.superpowers/systematic-debugging/CREATION-LOG.md +119 -0
- package/template/.superpowers/systematic-debugging/SKILL.md +296 -0
- package/template/.superpowers/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/template/.superpowers/systematic-debugging/condition-based-waiting.md +115 -0
- package/template/.superpowers/systematic-debugging/defense-in-depth.md +122 -0
- package/template/.superpowers/systematic-debugging/find-polluter.sh +63 -0
- package/template/.superpowers/systematic-debugging/root-cause-tracing.md +169 -0
- package/template/.superpowers/systematic-debugging/test-academic.md +14 -0
- package/template/.superpowers/systematic-debugging/test-pressure-1.md +58 -0
- package/template/.superpowers/systematic-debugging/test-pressure-2.md +68 -0
- package/template/.superpowers/systematic-debugging/test-pressure-3.md +69 -0
- package/template/.superpowers/test-driven-development/SKILL.md +371 -0
- package/template/.superpowers/test-driven-development/testing-anti-patterns.md +299 -0
- package/template/.superpowers/using-git-worktrees/SKILL.md +215 -0
- package/template/.superpowers/using-superpowers/SKILL.md +117 -0
- package/template/.superpowers/using-superpowers/references/codex-tools.md +59 -0
- package/template/.superpowers/using-superpowers/references/copilot-tools.md +42 -0
- package/template/.superpowers/using-superpowers/references/gemini-tools.md +51 -0
- package/template/.superpowers/verification-before-completion/SKILL.md +139 -0
- package/template/.superpowers/writing-plans/SKILL.md +152 -0
- package/template/.superpowers/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/template/.superpowers/writing-skills/SKILL.md +655 -0
- package/template/.superpowers/writing-skills/anthropic-best-practices.md +1150 -0
- package/template/.superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/template/.superpowers/writing-skills/graphviz-conventions.dot +172 -0
- package/template/.superpowers/writing-skills/persuasion-principles.md +187 -0
- package/template/.superpowers/writing-skills/render-graphs.js +168 -0
- package/template/.superpowers/writing-skills/testing-skills-with-subagents.md +384 -0
- package/template/AGENTS.md +116 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# 后端数据库规范
|
|
2
|
+
|
|
3
|
+
## 目标
|
|
4
|
+
|
|
5
|
+
- 模型、迁移、查询方式一致
|
|
6
|
+
- 数据变更可审计、可回滚、可复现
|
|
7
|
+
|
|
8
|
+
## 基本要求
|
|
9
|
+
|
|
10
|
+
- 表结构变更必须通过迁移文件管理
|
|
11
|
+
- 查询优先使用项目统一的数据访问方式
|
|
12
|
+
- 事务边界由业务动作定义,不要为“方便”扩大事务
|
|
13
|
+
- 审计字段、逻辑删除、版本号等约定要全项目一致
|
|
14
|
+
|
|
15
|
+
## 建议检查项
|
|
16
|
+
|
|
17
|
+
- 新表是否补齐主键、索引、审计字段
|
|
18
|
+
- 复杂查询是否可通过统一 API 或查询构造器表达
|
|
19
|
+
- 是否存在拼接 SQL / 条件遗漏 / N+1 查询
|
|
20
|
+
- 是否在错误层做了数据一致性补偿
|
|
21
|
+
|
|
22
|
+
## 项目定制位
|
|
23
|
+
|
|
24
|
+
- 迁移工具:`<按项目填写>`
|
|
25
|
+
- ORM / 查询框架:`<按项目填写>`
|
|
26
|
+
- 审计字段:`<按项目填写,例如 created_at / updated_at>`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 后端目录结构规范
|
|
2
|
+
|
|
3
|
+
## 目标
|
|
4
|
+
|
|
5
|
+
- 模块职责清晰
|
|
6
|
+
- 包结构稳定
|
|
7
|
+
- 新人和 AI 能快速定位代码
|
|
8
|
+
|
|
9
|
+
## 推荐做法
|
|
10
|
+
|
|
11
|
+
- 按业务能力或边界拆模块,不按“工具类型”滥拆
|
|
12
|
+
- Controller / API 只做参数接收、鉴权入口和响应编排
|
|
13
|
+
- Service / UseCase 承接业务规则
|
|
14
|
+
- Repository / DAO 承接持久化访问
|
|
15
|
+
- Domain Model / Entity / Aggregate 保持边界清晰
|
|
16
|
+
|
|
17
|
+
## 命名建议
|
|
18
|
+
|
|
19
|
+
- 模块名体现业务边界,不体现实现细节
|
|
20
|
+
- 包名与目录名统一小写
|
|
21
|
+
- 同一层命名保持后缀一致,例如 `Controller`、`Service`、`Repository`
|
|
22
|
+
|
|
23
|
+
## 不建议
|
|
24
|
+
|
|
25
|
+
- 一个模块同时承担多个无关业务
|
|
26
|
+
- 在 Controller 中堆业务逻辑
|
|
27
|
+
- 在公共模块中混入业务特化逻辑
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 后端异常处理规范
|
|
2
|
+
|
|
3
|
+
## 目标
|
|
4
|
+
|
|
5
|
+
- 调用方能稳定感知错误
|
|
6
|
+
- 内部错误与外部错误边界清晰
|
|
7
|
+
|
|
8
|
+
## 推荐做法
|
|
9
|
+
|
|
10
|
+
- 统一定义错误码或错误类型
|
|
11
|
+
- 参数校验错误、业务错误、系统错误分层处理
|
|
12
|
+
- 对外返回稳定结构,对内保留足够上下文
|
|
13
|
+
- 不把底层异常原样泄露给调用方
|
|
14
|
+
|
|
15
|
+
## 典型检查项
|
|
16
|
+
|
|
17
|
+
- 是否区分“可预期业务失败”和“系统异常”
|
|
18
|
+
- 是否保留 traceId / requestId / correlationId
|
|
19
|
+
- 是否有统一异常兜底
|
|
20
|
+
- 是否记录了必要但不过量的日志
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# 后端开发规范
|
|
2
|
+
|
|
3
|
+
> 通用模板:复制到新项目后,请替换为项目真实技术栈、模块结构和运行边界。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 当前基线
|
|
8
|
+
|
|
9
|
+
- 架构形态:`<按项目填写>`
|
|
10
|
+
- 运行模块:`<按项目填写>`
|
|
11
|
+
- 技术栈:`<按项目填写>`
|
|
12
|
+
- 规范来源:以仓库内已落地代码、配置、测试和迁移脚本为准
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 阅读顺序
|
|
17
|
+
|
|
18
|
+
| 文档 | 用途 |
|
|
19
|
+
|------|------|
|
|
20
|
+
| [目录结构](./directory-structure.md) | 模块划分、包结构、命名方式 |
|
|
21
|
+
| [数据库规范](./database-guidelines.md) | 实体、迁移、查询、事务 |
|
|
22
|
+
| [异常处理](./error-handling.md) | 错误码、异常边界、统一返回 |
|
|
23
|
+
| [日志规范](./logging-guidelines.md) | 结构化日志、敏感信息、链路标识 |
|
|
24
|
+
| [质量规范](./quality-guidelines.md) | 测试、lint、门禁、禁止模式 |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 使用原则
|
|
29
|
+
|
|
30
|
+
- 优先遵循仓库现有模式,不新增与现有风格冲突的写法
|
|
31
|
+
- 先查已有公共模块、公共库或基础设施封装
|
|
32
|
+
- 涉及跨模块、异步链路、权限边界时,同时阅读 `guides/` 下的思考指引
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
**文档语言**:默认中文,可按项目统一改为英文。
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 后端日志规范
|
|
2
|
+
|
|
3
|
+
## 目标
|
|
4
|
+
|
|
5
|
+
- 便于排查
|
|
6
|
+
- 便于追踪链路
|
|
7
|
+
- 不泄露敏感信息
|
|
8
|
+
|
|
9
|
+
## 推荐做法
|
|
10
|
+
|
|
11
|
+
- 使用结构化日志
|
|
12
|
+
- 统一记录请求标识、用户标识、任务标识或链路标识
|
|
13
|
+
- 错误日志记录上下文,不重复打印同一异常
|
|
14
|
+
- 对账号、令牌、密钥、身份证号、手机号等敏感字段脱敏
|
|
15
|
+
|
|
16
|
+
## 不建议
|
|
17
|
+
|
|
18
|
+
- 直接输出完整请求体或完整响应体
|
|
19
|
+
- 使用临时 `print` / `console` 式调试输出长期留在主干
|
|
20
|
+
- 同一错误在多层重复打印
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 后端质量规范
|
|
2
|
+
|
|
3
|
+
## 完成定义
|
|
4
|
+
|
|
5
|
+
至少满足:
|
|
6
|
+
|
|
7
|
+
- 编译 / 构建通过
|
|
8
|
+
- 测试通过
|
|
9
|
+
- 核心场景已验证
|
|
10
|
+
- 新增约定已沉淀到 spec
|
|
11
|
+
|
|
12
|
+
## 推荐门禁
|
|
13
|
+
|
|
14
|
+
- 静态检查:`<按项目填写>`
|
|
15
|
+
- 单元测试:`<按项目填写>`
|
|
16
|
+
- 集成测试:`<按项目填写>`
|
|
17
|
+
- 构建验证:`<按项目填写>`
|
|
18
|
+
|
|
19
|
+
## 常见禁止模式
|
|
20
|
+
|
|
21
|
+
- 未验证就宣称完成
|
|
22
|
+
- 用硬编码绕过配置与契约
|
|
23
|
+
- 用临时兼容逻辑代替真实修复
|
|
24
|
+
- 变更接口或数据结构却不更新文档和调用方
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# 前端开发规范
|
|
2
|
+
|
|
3
|
+
> 通用模板:如项目没有前端,可保留占位说明;如有前端,请替换成真实前端技术栈与规则。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 当前基线
|
|
8
|
+
|
|
9
|
+
- 前端形态:`<按项目填写>`
|
|
10
|
+
- 技术栈:`<按项目填写>`
|
|
11
|
+
- 契约来源:以后端接口、共享类型、设计系统和交互规范为准
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 文档索引
|
|
16
|
+
|
|
17
|
+
| 文档 | 用途 |
|
|
18
|
+
|------|------|
|
|
19
|
+
| [目录结构](./directory-structure.md) | 说明模块划分和目录边界 |
|
|
20
|
+
| [组件规范](./component-guidelines.md) | 说明组件职责、组合与交互边界 |
|
|
21
|
+
| [Hook 规范](./hook-guidelines.md) | 说明复用逻辑与副作用边界 |
|
|
22
|
+
| [状态管理](./state-management.md) | 说明服务端状态、客户端状态和权限状态 |
|
|
23
|
+
| [质量规范](./quality-guidelines.md) | 说明前端门禁 |
|
|
24
|
+
| [类型安全](./type-safety.md) | 说明共享类型与契约同步原则 |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
**文档语言**:默认中文,可按项目统一改为英文。
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 前端质量规范
|
|
2
|
+
|
|
3
|
+
## 完成定义
|
|
4
|
+
|
|
5
|
+
至少满足:
|
|
6
|
+
|
|
7
|
+
- 构建通过
|
|
8
|
+
- 类型检查通过
|
|
9
|
+
- lint / format 通过
|
|
10
|
+
- 关键交互已手工验证
|
|
11
|
+
|
|
12
|
+
## 推荐门禁
|
|
13
|
+
|
|
14
|
+
- lint:`<按项目填写>`
|
|
15
|
+
- type-check:`<按项目填写>`
|
|
16
|
+
- test:`<按项目填写>`
|
|
17
|
+
- build:`<按项目填写>`
|
|
18
|
+
|
|
19
|
+
## 常见禁止模式
|
|
20
|
+
|
|
21
|
+
- 用 `any` 或强制断言掩盖真实类型问题
|
|
22
|
+
- 组件未处理加载、空态、错误态
|
|
23
|
+
- 交互依赖隐式副作用
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# 代码复用思考指引
|
|
2
|
+
|
|
3
|
+
## 什么时候必须看
|
|
4
|
+
|
|
5
|
+
- 你准备新增常量、错误码、工具函数、查询模板、DTO、校验逻辑
|
|
6
|
+
- 你刚在多个文件做了类似修改
|
|
7
|
+
- 你觉得“这个应该以后还会再用”
|
|
8
|
+
|
|
9
|
+
## 检查问题
|
|
10
|
+
|
|
11
|
+
- 项目里是否已经有同类实现?
|
|
12
|
+
- 这个能力应该放在公共层、领域层还是模块内?
|
|
13
|
+
- 现在抽象是否真的减少重复,还是提前设计?
|
|
14
|
+
- 如果以后只会复用一次,是否值得抽取?
|
|
15
|
+
|
|
16
|
+
## 最小动作
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
rg "相似关键字"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 原则
|
|
23
|
+
|
|
24
|
+
- 先搜索,后新增
|
|
25
|
+
- 先复用,后抽象
|
|
26
|
+
- 先最小可用,后稳定沉淀
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 跨层思考指引
|
|
2
|
+
|
|
3
|
+
## 什么时候必须看
|
|
4
|
+
|
|
5
|
+
- 变更穿过 3 层及以上
|
|
6
|
+
- 接口、状态、权限、异步链路发生变化
|
|
7
|
+
- 一个修改需要同步多个模块或多个进程
|
|
8
|
+
|
|
9
|
+
## 检查问题
|
|
10
|
+
|
|
11
|
+
- 输入从哪里来?经过哪些层?最终落到哪里?
|
|
12
|
+
- 输出给谁?哪些层依赖它?
|
|
13
|
+
- 错误在每一层如何表达和传播?
|
|
14
|
+
- 权限、鉴权、业务授权是否被混淆?
|
|
15
|
+
- 是否只改了主路径,漏掉异常路径和回滚路径?
|
|
16
|
+
|
|
17
|
+
## 常见漏项
|
|
18
|
+
|
|
19
|
+
- Controller 改了,但 service / repository / client 没改
|
|
20
|
+
- 消息结构改了,但消费者没同步
|
|
21
|
+
- 状态机规则改了,但校验和展示没同步
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# 思考指引
|
|
2
|
+
|
|
3
|
+
> 本目录不讲实现细节,只提醒最容易出问题的思考点。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 常见风险
|
|
8
|
+
|
|
9
|
+
- 模块边界被打穿
|
|
10
|
+
- 权限与业务授权混在一起
|
|
11
|
+
- 跨层契约只改了一半
|
|
12
|
+
- 新增一套重复常量、错误码、查询模式
|
|
13
|
+
- 接口、数据结构、任务流转没有同步更新
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 使用方式
|
|
18
|
+
|
|
19
|
+
- 写代码前先看 [编码前检查表](./pre-implementation-checklist.md)
|
|
20
|
+
- 涉及跨模块、异步链路、权限或状态流转时,看 [跨层思考指引](./cross-layer-thinking-guide.md)
|
|
21
|
+
- 涉及公共能力、常量、错误码、查询模板、校验逻辑时,看 [代码复用思考指引](./code-reuse-thinking-guide.md)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 最小动作
|
|
26
|
+
|
|
27
|
+
修改前先搜索:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
rg "关键字"
|
|
31
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 编码前检查表
|
|
2
|
+
|
|
3
|
+
## 在动手前先确认
|
|
4
|
+
|
|
5
|
+
- 这次改动属于 `L0`、`L1` 还是 `L2`?
|
|
6
|
+
- 是否涉及 API、数据库、异步链路、权限或状态流转?
|
|
7
|
+
- 是否需要先补 OpenSpec?
|
|
8
|
+
- 是否已经明确成功标准和验证方式?
|
|
9
|
+
- 是否已经搜索过相似实现与可复用能力?
|
|
10
|
+
|
|
11
|
+
## 如果涉及行为变化
|
|
12
|
+
|
|
13
|
+
- 是否已有 `proposal/spec/design/plan`?
|
|
14
|
+
- 是否已经明确输入、输出、错误、边界场景?
|
|
15
|
+
- 是否知道谁负责提交业务代码?
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|