Skip to content
Merged
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
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

## 全局约束(照 spec 决策表)

- 命名:仓库 `flowguard-plugin`、name `flowguard`、displayName「研发流程门禁」、i18n en "FlowGuard: R&D Process Gate"、命令前缀 `/flowguard-*`。十阶段产物只写 `docs/project/` 与 `docs/features/<task-id>/`;新项目不得创建 `.flowguard/`。
- 命名:仓库 `flowguard-plugin`、name `flowguard`、displayName「研发流程门禁」、i18n en "FlowGuard: R&D Process Gate"、命令前缀 `/flowguard-*`。十阶段产物只写 `docs/project/` 与 `docs/features/<task-id>/`;仓库内不得出现 `.flowguard/`。
- Python 仅标准库;测试用 `python3 -m unittest discover -s tests`(不是 pytest)。
- SKILL.md ≤ 500 行;frontmatter 必含 `name`(kebab,与目录同名)/ `license: Apache-2.0` / `description`(含触发词与负面边界)/ `compatibility`。
- 跨技能引用只用「技能名 + `npx skills add <org>/<pkg> --skill <name>`」,禁止 `../` 相对路径指向其它技能。
- 十阶段由智能体推进,Hook 只校验与拦截;门禁无 strict_mode 软化开关。用户批准与验收不得由 agent 伪造;旧状态仅供迁移和兼容读取。
- 十阶段由智能体推进,Hook 只校验与拦截;门禁无 strict_mode 软化开关。用户批准与验收不得由 agent 伪造。
- REQ-ID 全局唯一,格式 `<feature-id>/REQ-<n>`;feature-id/模块名 kebab `^[a-z0-9]+(?:-[a-z0-9]+)*$`。
- 门禁/校验输出统一诊断信封基础字段 `{severity, code, message, fix}`;新治理拒绝可追加 `missing/allowed_actions`。
- 四宿主 manifest 版本字段必须一致(`.codex-plugin/plugin.json` 例外:`<v>+codex.<YYYYMMDD>`);`.zcode-plugin/plugin.json` 不得含 `hooks` 键;不得含占位 `mcpServers`。
Expand Down Expand Up @@ -37,5 +37,5 @@

- 当前规格(单一权威):`docs/superpowers/specs/2026-09-23-flowguard-docs-ten-stage-governance.md`
- 当前实施计划:`docs/superpowers/plans/2026-09-23-flowguard-agent-driven-sdd-governance.md`
- v0.2 的“十阶段仅兼容”决策已被当前规格取代;旧 `.flowguard/` 仅是迁移输入,不得作为新任务默认产物。
- v0.2 的“十阶段仅兼容”决策已被当前规格取代;`.flowguard/` 兼容/迁移线已于 v0.4.0(2026-09-23)下线,旧命令面一并移除。
- 钩子协议:`hooks/__protocol__.md`(改协议必须同 commit 更新契约与测试)
2 changes: 1 addition & 1 deletion PRIVACY.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
flowguard-plugin(研发流程门禁)完全在本地运行:

- 不采集、不上传任何用户数据、代码内容或流程产物;
- 流程状态(`.flowguard/`)与审计日志(`.flowguard/journal/`)仅存在于用户项目仓库内;
- 流程状态(`docs/` 阶段文档与证据登记)仅存在于用户项目仓库内;会话缓存(上下文/锁)仅存在于本机宿主状态目录;
- 插件不包含任何遥测、统计或网络上报代码。

如插件分发渠道另有要求,以渠道政策与本文件中更严格者为准。
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ Denials use exit code 2 and return `code / message / fix / missing / allowed_act

See [hooks/__protocol__.md](hooks/__protocol__.md).

## Document locations and legacy migration
## Document locations

Project stages 02/07/10 live in `docs/project/`; feature stages 01/03/04/05/06/08/09 live in `docs/features/<task-id>/`. New projects do not create `.flowguard/`; session cache lives outside the repository. For existing projects, run `migrate --dry-run`, resolve conflicts, then `migrate --apply`; retain the original data until verified. If migration stops midway, newly created documents are listed and kept for inspection rather than deleting files another process may have edited. `legacy-init` is only for old-command compatibility.
Project stages 02/07/10 live in `docs/project/`; feature stages 01/03/04/05/06/08/09 live in `docs/features/<task-id>/`. Session cache lives outside the repository in the host state directory. The legacy `.flowguard/` layout and its migration commands were removed in v0.4.0; `docs/legacy-flowguard/` in this repository is a read-only historical archive.

## Documentation

- [Current architecture](docs/FlowGuard-Architecture.zh_CN.md)
- [Ten-stage docs governance specification](docs/superpowers/specs/2026-09-23-flowguard-docs-ten-stage-governance.md)
- [Implementation plan](docs/superpowers/plans/2026-09-23-flowguard-agent-driven-sdd-governance.md)
- [Legacy artifact contract](docs/FLOWGUARD_ARTIFACT_SPEC.md)
- [Artifact contract](docs/FLOWGUARD_ARTIFACT_SPEC.md)
- [Roadmap](docs/roadmap.md)

## Verification
Expand Down
6 changes: 3 additions & 3 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ python3 scripts/flowguard_state.py governance \

协议见 [hooks/__protocol__.md](hooks/__protocol__.md)。

## 文档位置与旧项目迁移
## 文档位置

项目级 02/07/10 放在 `docs/project/`,功能级 01/03/04/05/06/08/09 放在 `docs/features/<task-id>/`。新项目不创建 `.flowguard/`;会话缓存保存在宿主状态目录。旧项目先运行 `migrate --dry-run`,确认无冲突后再 `migrate --apply`,核对完成前保留旧数据。迁移中途失败时,已创建文档保留并在错误中列出,需人工核对;不会为了回滚而删除可能已被他人修改的文件。`legacy-init` 仅供旧命令兼容。
项目级 02/07/10 放在 `docs/project/`,功能级 01/03/04/05/06/08/09 放在 `docs/features/<task-id>/`。会话缓存保存在仓库外的宿主状态目录。旧 `.flowguard/` 布局及其迁移命令已在 v0.4.0 下线;本仓 `docs/legacy-flowguard/` 仅是只读历史归档。

## 文档

- [FlowGuard-Architecture.zh_CN.md](docs/FlowGuard-Architecture.zh_CN.md) — 当前架构、运行流、可信边界和风险
- [十阶段 docs 治理规格](docs/superpowers/specs/2026-09-23-flowguard-docs-ten-stage-governance.md)
- [实施计划](docs/superpowers/plans/2026-09-23-flowguard-agent-driven-sdd-governance.md)
- [旧产物兼容契约](docs/FLOWGUARD_ARTIFACT_SPEC.md)
- [产物格式契约](docs/FLOWGUARD_ARTIFACT_SPEC.md)
- [路线图](docs/roadmap.md)

## 验证
Expand Down
5 changes: 0 additions & 5 deletions commands/flowguard-advance.json

This file was deleted.

2 changes: 1 addition & 1 deletion commands/flowguard-context.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "flowguard-context",
"description": "绑定会话、worktree、任务与原生规格,并创建 docs/ 阶段文档",
"prompt": "先运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" discover --json`,再根据真实任务运行 `... flowguard_state.py context bind --session <session> --task-id <id> --task-type <read_only|simple_change|important_change|incident> --spec-system <none|spec-kit|openspec|superpowers|external> [--spec-ref <path-or-url>] [--parent-id <context-id>] --json`。可用 `context show` 或 `context list` 查看。绑定可写任务会在 docs/project/ 与 docs/features/<id>/ 创建缺失的十阶段文档,不创建 .flowguard/。仅在用户明确确认后使用 `context approve --context-id <id> --approval scope_approved --actor user --json`;actor 文本不是可信用户回执,不得编造批准。"
"prompt": "先运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" discover --json`,再根据真实任务运行 `... flowguard_state.py context bind --session <session> --task-id <id> --task-type <read_only|simple_change|important_change|incident> --spec-system <none|spec-kit|openspec|superpowers|external> [--spec-ref <path-or-url>] [--parent-id <context-id>] --json`。可用 `context show` 或 `context list` 查看。绑定可写任务会在 docs/project/ 与 docs/features/<id>/ 创建缺失的十阶段文档。仅在用户明确确认后使用 `context approve --context-id <id> --approval scope_approved --actor user --json`;actor 文本不是可信用户回执,不得编造批准。"
}
2 changes: 1 addition & 1 deletion commands/flowguard-discover.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "flowguard-discover",
"description": "只读发现目标 Git 项目、原生 SDD 体系、CLI 可用性与冲突,不初始化任何工具",
"prompt": "执行 FlowGuard 的只读 SDD 发现:\n\n1. 确认用户指定的真实仓库或模块路径,运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" discover --json`\n2. 报告 Git/worktree、项目类型、`.specify/`、`openspec/`、Superpowers 产物、CLI 可用性和旧 FlowGuard 状态\n3. 明确区分:CLI 已安装、Skill 已安装、项目已初始化\n4. 若状态为 `choice_required`,停止创建规格并请求用户选择事实源\n5. 若状态为 `assessment_required`,由智能体结合用户任务分类 read_only/simple_change/important_change/incident;不要静默初始化\n\n本命令严格只读,不运行 specify init、openspec init、安装或迁移。"
"prompt": "执行 FlowGuard 的只读 SDD 发现:\n\n1. 确认用户指定的真实仓库或模块路径,运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" discover --json`\n2. 报告 Git/worktree、项目类型、`.specify/`、`openspec/`、Superpowers 产物与 CLI 可用性\n3. 明确区分:CLI 已安装、Skill 已安装、项目已初始化\n4. 若状态为 `choice_required`,停止创建规格并请求用户选择事实源\n5. 若状态为 `assessment_required`,由智能体结合用户任务分类 read_only/simple_change/important_change/incident;不要静默初始化\n\n本命令严格只读,不运行 specify init、openspec init 或安装。"
}
5 changes: 0 additions & 5 deletions commands/flowguard-feature.json

This file was deleted.

5 changes: 0 additions & 5 deletions commands/flowguard-gate.json

This file was deleted.

4 changes: 2 additions & 2 deletions commands/flowguard-init.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "flowguard-init",
"description": "只创建 docs/project/ 中的项目级十阶段文档;不创建 .flowguard/",
"prompt": "先运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" discover --json` 做只读检查。若用户已要求初始化 FlowGuard 文档且目标仓库明确,运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" init --json`。只创建 docs/project/ 下的 02/07/10;功能文档由 context bind 创建。不得自动执行 specify init、openspec init 或 legacy-init。"
"description": "只创建 docs/project/ 中的项目级十阶段文档",
"prompt": "先运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" discover --json` 做只读检查。若用户已要求初始化 FlowGuard 文档且目标仓库明确,运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" init --json`。只创建 docs/project/ 下的 02/07/10;功能文档由 context bind 创建。不得自动执行 specify init 或 openspec init。"
}
5 changes: 0 additions & 5 deletions commands/flowguard-next.json

This file was deleted.

5 changes: 0 additions & 5 deletions commands/flowguard-override.json

This file was deleted.

2 changes: 1 addition & 1 deletion commands/flowguard-stage.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "flowguard-stage",
"description": "查看和推进 docs/ 中的十阶段文档",
"prompt": "运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" stage status --task-id <task-id> --json` 查看阶段。写入 docs/project/ 或 docs/features/<task-id>/ 对应文档并自检后,可运行 `... flowguard_state.py stage advance --task-id <task-id> --stage <阶段文件名> --status in_progress --json`;只有真实用户批准或可审计依据才可将阶段标记 accepted/inherited/skipped。不能用模型自述伪造批准;旧 .flowguard/ 仅是迁移输入。"
"prompt": "运行 `python3 \"${CLAUDE_PLUGIN_ROOT}/scripts/flowguard_state.py\" stage status --task-id <task-id> --json` 查看阶段。写入 docs/project/ 或 docs/features/<task-id>/ 对应文档并自检后,可运行 `... flowguard_state.py stage advance --task-id <task-id> --stage <阶段文件名> --status in_progress --json`;只有真实用户批准或可审计依据才可将阶段标记 accepted/inherited/skipped。不能用模型自述伪造批准。"
}
5 changes: 0 additions & 5 deletions commands/flowguard-status.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/FLOWGUARD_ARTIFACT_SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
## 1. 通用规则

- **元信息头**:产物文件首行注释块 `<!-- artifact: <id> | feature: <来源> | modules: <模块列表> -->`,模板自带,勿删。
- **阶段信息**:`### 1.3 FlowGuard 阶段信息` 表记录任务、父任务、阶段、状态、规格事实源、原生产物、批准依据、前置指纹与验收指纹;新项目不创建 `.flowguard/`。
- **阶段信息**:`### 1.3 FlowGuard 阶段信息` 表记录任务、父任务、阶段、状态、规格事实源、原生产物、批准依据、前置指纹与验收指纹。
- **占位符规则**:含 `<占位符>`(尖括号)的块视为**模板未填写示例**,不参与机械检查。真实内容不得包含 `<...>` 形式文本。
- **代码围栏掩码**:``` 围栏内的 `###`/`####` 头不参与解析。
- **追加式**(项目级产物 02/07/10):增补条目一律追加并标注来源(`feature: <id>`),禁止改写既有正文;确需修改走回改降级流程。
Expand Down
6 changes: 3 additions & 3 deletions docs/FlowGuard-Architecture.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ flowchart TB
Proof --> Docs
```

十阶段文档不写进 `.flowguard/`。项目级 02 架构、07 规范、10 发布位于 `docs/project/`;功能级 01 需求、03 方案、04 用例、05 概要设计、06 详细设计、08 审查、09 文档位于 `docs/features/<task-id>/`。独立子功能有自己的功能级文档,通过父任务引用继承项目级约束。普通实现步骤仍留在原生 tasks 中。
十阶段文档只写 `docs/`。项目级 02 架构、07 规范、10 发布位于 `docs/project/`;功能级 01 需求、03 方案、04 用例、05 概要设计、06 详细设计、08 审查、09 文档位于 `docs/features/<task-id>/`。独立子功能有自己的功能级文档,通过父任务引用继承项目级约束。普通实现步骤仍留在原生 tasks 中。

`context.py` 将会话选择、worktree 和任务关系缓存于宿主状态目录;项目可用 Git、`docs/` 和原生规格重建流程事实。`stage_docs.py` 解析阶段状态和验收指纹,`evidence.py` 在阶段文档中登记检查结果,`governance.py` 提供唯一动作裁决;Hooks 与 CLI 仅为适配层。

Expand All @@ -66,9 +66,9 @@ flowchart LR

读取、澄清、补规格、补测试始终是解除阻断的路径。写业务代码要求 01—07 阶段满足;提交还要求 08—09 及当前代码的测试、静态分析、语义审查证据;发布还要求 10、发布就绪、用户验收与必要子任务完成。重要变更另须有效原生规格引用和明确范围批准。阶段正文变化使该阶段原验收失效;证据出现更新的失败或代码指纹变化时不得沿用旧 PASS。

## 4. 迁移与兼容
## 4. 兼容与历史

旧 `.flowguard/` 只作为已有项目的迁移输入。`migrate --dry-run` 检查映射与冲突;`migrate --apply` 无覆盖地复制十阶段正文到 `docs/`,将旧验收状态转为待复核。核对完成前保留旧数据。新项目的 `init` 只创建 `docs/project/`;`legacy-init` 明确限定旧命令兼容。
`.flowguard/` 兼容/迁移线已随 v0.4.0(2026-09-23)下线:不再提供 `migrate`/`legacy-init`,旧状态机命令与旧 gate 解锁矩阵一并移除。本仓 `docs/legacy-flowguard/` 仅是迁移前状态的只读历史归档,不是事实源,也不构成迁移承诺。新项目的 `init` 只创建 `docs/project/`。

## 5. 可信边界与当前限制

Expand Down
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

> 本文件保留为历史稳定链接。当前权威架构文档见 [FlowGuard-Architecture.zh_CN.md](FlowGuard-Architecture.zh_CN.md)。

当前架构保留强制十阶段,由智能体判断和推进;FlowGuard 校验 `docs/` 产物与证据,Hook 阻止绕过。旧版全局 `current_feature` 和 `.flowguard/` 状态仅作迁移输入。
当前架构保留强制十阶段,由智能体判断和推进;FlowGuard 校验 `docs/` 产物与证据,Hook 阻止绕过。旧版全局 `current_feature` 和 `.flowguard/` 状态模型已随 v0.4.0 下线。
Loading
Loading