ai-dev-flow 3.10.0__tar.gz

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.
Files changed (56) hide show
  1. ai_dev_flow-3.10.0/LICENSE +21 -0
  2. ai_dev_flow-3.10.0/PKG-INFO +171 -0
  3. ai_dev_flow-3.10.0/README.en.md +140 -0
  4. ai_dev_flow-3.10.0/README.md +160 -0
  5. ai_dev_flow-3.10.0/ai_dev_flow/__init__.py +5 -0
  6. ai_dev_flow-3.10.0/ai_dev_flow/__main__.py +6 -0
  7. ai_dev_flow-3.10.0/ai_dev_flow/checkpoint.py +65 -0
  8. ai_dev_flow-3.10.0/ai_dev_flow/cli.py +598 -0
  9. ai_dev_flow-3.10.0/ai_dev_flow/config.py +404 -0
  10. ai_dev_flow-3.10.0/ai_dev_flow/data/pipeline.yaml +193 -0
  11. ai_dev_flow-3.10.0/ai_dev_flow/data/profiles/java-spring.yml +140 -0
  12. ai_dev_flow-3.10.0/ai_dev_flow/data/recipes/steps/00-init-project.yaml +168 -0
  13. ai_dev_flow-3.10.0/ai_dev_flow/data/recipes/steps/01-refine-requirement.yaml +117 -0
  14. ai_dev_flow-3.10.0/ai_dev_flow/data/recipes/steps/02-analysis.yaml +97 -0
  15. ai_dev_flow-3.10.0/ai_dev_flow/data/recipes/steps/03-design.yaml +91 -0
  16. ai_dev_flow-3.10.0/ai_dev_flow/data/recipes/steps/03.5-decompose.yaml +120 -0
  17. ai_dev_flow-3.10.0/ai_dev_flow/data/recipes/steps/05-build.yaml +72 -0
  18. ai_dev_flow-3.10.0/ai_dev_flow/data/recipes/steps/06-review.yaml +115 -0
  19. ai_dev_flow-3.10.0/ai_dev_flow/data/recipes/steps/07-delivery.yaml +76 -0
  20. ai_dev_flow-3.10.0/ai_dev_flow/data/recipes/steps/task-template.yaml +74 -0
  21. ai_dev_flow-3.10.0/ai_dev_flow/error_handler.py +122 -0
  22. ai_dev_flow-3.10.0/ai_dev_flow/executor.py +406 -0
  23. ai_dev_flow-3.10.0/ai_dev_flow/git_ops.py +187 -0
  24. ai_dev_flow-3.10.0/ai_dev_flow/knowledge_accumulator.py +121 -0
  25. ai_dev_flow-3.10.0/ai_dev_flow/logger.py +84 -0
  26. ai_dev_flow-3.10.0/ai_dev_flow/sandbox.py +291 -0
  27. ai_dev_flow-3.10.0/ai_dev_flow/semantic_summarizer.py +351 -0
  28. ai_dev_flow-3.10.0/ai_dev_flow/snapshot.py +210 -0
  29. ai_dev_flow-3.10.0/ai_dev_flow/state.py +87 -0
  30. ai_dev_flow-3.10.0/ai_dev_flow/task_context.py +134 -0
  31. ai_dev_flow-3.10.0/ai_dev_flow/task_graph.py +841 -0
  32. ai_dev_flow-3.10.0/ai_dev_flow/task_state.py +151 -0
  33. ai_dev_flow-3.10.0/ai_dev_flow/watchdog.py +120 -0
  34. ai_dev_flow-3.10.0/ai_dev_flow.egg-info/PKG-INFO +171 -0
  35. ai_dev_flow-3.10.0/ai_dev_flow.egg-info/SOURCES.txt +54 -0
  36. ai_dev_flow-3.10.0/ai_dev_flow.egg-info/dependency_links.txt +1 -0
  37. ai_dev_flow-3.10.0/ai_dev_flow.egg-info/entry_points.txt +2 -0
  38. ai_dev_flow-3.10.0/ai_dev_flow.egg-info/requires.txt +5 -0
  39. ai_dev_flow-3.10.0/ai_dev_flow.egg-info/top_level.txt +1 -0
  40. ai_dev_flow-3.10.0/pyproject.toml +52 -0
  41. ai_dev_flow-3.10.0/setup.cfg +4 -0
  42. ai_dev_flow-3.10.0/tests/test_checkpoint.py +75 -0
  43. ai_dev_flow-3.10.0/tests/test_config.py +152 -0
  44. ai_dev_flow-3.10.0/tests/test_executor.py +176 -0
  45. ai_dev_flow-3.10.0/tests/test_git_ops.py +95 -0
  46. ai_dev_flow-3.10.0/tests/test_integration.py +139 -0
  47. ai_dev_flow-3.10.0/tests/test_knowledge_accumulator.py +152 -0
  48. ai_dev_flow-3.10.0/tests/test_logger.py +60 -0
  49. ai_dev_flow-3.10.0/tests/test_sandbox.py +175 -0
  50. ai_dev_flow-3.10.0/tests/test_semantic_summarizer.py +165 -0
  51. ai_dev_flow-3.10.0/tests/test_snapshot.py +174 -0
  52. ai_dev_flow-3.10.0/tests/test_state.py +57 -0
  53. ai_dev_flow-3.10.0/tests/test_task_context.py +72 -0
  54. ai_dev_flow-3.10.0/tests/test_task_graph.py +553 -0
  55. ai_dev_flow-3.10.0/tests/test_task_state.py +181 -0
  56. ai_dev_flow-3.10.0/tests/test_watchdog.py +151 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ding An
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.
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.4
2
+ Name: ai-dev-flow
3
+ Version: 3.10.0
4
+ Summary: Stateful, resumable, auditable pipeline for agentic coding — requirements to design to tasks to code to review, with human checkpoints and one commit per task.
5
+ Author: Ding An
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/293498733/AI_A_PLANT
8
+ Project-URL: Repository, https://github.com/293498733/AI_A_PLANT
9
+ Project-URL: Changelog, https://github.com/293498733/AI_A_PLANT/blob/main/CHANGELOG.md
10
+ Keywords: agentic-coding,ai-agents,codex,llm-orchestration,developer-tools,goose,workflow-automation
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Build Tools
22
+ Classifier: Topic :: Software Development :: Code Generators
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: pyyaml>=6.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=8.0; extra == "dev"
29
+ Requires-Dist: pytest-mock>=3.14; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # AI Dev Flow
33
+
34
+ > One command drives the full pipeline: requirements → analysis → design → code → review → delivery.
35
+ > Interruptible and resumable, with a human in the loop at every decision point.
36
+
37
+ **Status**: Active development (v3.10.0) · [中文文档](README.md)
38
+
39
+ ---
40
+
41
+ ## What this is
42
+
43
+ An orchestration layer for agentic coding, not a chat wrapper. It turns
44
+ requirements → design → coding → verification → delivery into a stateful,
45
+ resumable, auditable machine: decision points force human sign-off, all context
46
+ is externalized to files, every task ends in a git commit, and failures preserve
47
+ the working tree for inspection.
48
+
49
+ | Design goal | Trade-off |
50
+ |-------------|-----------|
51
+ | Process stays controlled | 5 mandatory checkpoints; AI drafts, humans decide. Not unattended automation |
52
+ | Context stays trustworthy | Requirements, design and `tasks.yaml` all live on disk; tasks never share conversation memory |
53
+ | Interruptions are recoverable | Stage and task state persist; rerunning the same command resumes from the break point |
54
+ | Changes stay traceable | One git commit per task; failed verification keeps the sandbox for debugging |
55
+
56
+ **Who it is for**: developers and small teams with existing Java / Vue / Python
57
+ codebases who want AI inside a real delivery process — and who need to answer
58
+ "who made this change, and under what constraints". **Not for**: IDE autocomplete,
59
+ throwaway scripts, or teams that refuse any manual confirmation step.
60
+
61
+ ---
62
+
63
+ ## Pipeline overview
64
+
65
+ ```
66
+ ai-dev-flow --project /path/to/your/project
67
+
68
+ Phase 1 ─── requirement refinement (structured requirement doc)
69
+ ⚠ Checkpoint A ─ confirm requirements
70
+ Phase 2 ─── analysis (features, data flow, open questions)
71
+ ⚠ Checkpoint B ─ close open questions
72
+ Phase 3 ─── engineering design (architecture, interfaces, data model)
73
+ ⚠ Checkpoint C ─ confirm design
74
+ Phase 3.5 ─ task decomposition (atomic tasks with context_notes)
75
+ ⚠ Checkpoint C2 ─ confirm decomposition
76
+ █████████ task graph execution (each task = fresh session + git commit) █████████
77
+ Phase 5 ─── build + test
78
+ Phase 6 ─── code + security review
79
+ ⚠ Checkpoint D ─ security sign-off (high-risk only)
80
+ Phase 7 ─── delivery (change list, build verification, review verdict)
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Quick start
86
+
87
+ ### Prerequisites
88
+
89
+ | Dependency | Purpose |
90
+ |------------|---------|
91
+ | Python 3.9+ | orchestration engine |
92
+ | goose CLI >= 1.33 | AI execution engine |
93
+ | LLM API key | DeepSeek or any goose-compatible provider |
94
+
95
+ ### Install
96
+
97
+ ```bash
98
+ # install from PyPI
99
+ pip install ai-dev-flow
100
+
101
+ # or run from a source checkout
102
+ git clone https://github.com/293498733/AI_A_PLANT.git
103
+ cd AI_A_PLANT && pip install -r requirements.txt
104
+
105
+ # supply the API key via environment variable
106
+ export CUSTOM_DEEPSEEK_API_KEY=your_key # Windows: set CUSTOM_DEEPSEEK_API_KEY=your_key
107
+ ```
108
+
109
+ ### Usage
110
+
111
+ ```bash
112
+ ai-dev-flow # interactive start
113
+ ai-dev-flow --project /path/to/project # target a project directory
114
+ ai-dev-flow --project . --from-stage phase3 # start from a specific stage
115
+ ai-dev-flow --project . --dry-run # preview stages without executing
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Core mechanisms
121
+
122
+ ### Resume after interruption
123
+
124
+ Whatever stops the run — Ctrl+C, a reboot, a crashed engine — rerun the same
125
+ command and it continues from the break point. Global progress lives in
126
+ `.ai-dev/.pipeline_stage` inside the target project; per-task state lives in
127
+ `.ai-dev/task_state.json`.
128
+
129
+ ### Task-driven execution with externalized context
130
+
131
+ Large projects are not written in a single AI session. Phase 3.5 decomposes the
132
+ design into atomic tasks in `tasks.yaml`. Each task:
133
+
134
+ - runs in a **fresh engine session** (20–60 turns) and never relies on chat memory
135
+ - gets all its context from **files** (`input_files` + `reference_docs` + `context_notes`)
136
+ - ends with an **automatic git commit**, so the change is traceable
137
+ - is individually resumable — a crash restarts the failed task, not the phase
138
+
139
+ ### Error handling
140
+
141
+ Every AI stage offers 4 options on failure, and task-graph execution offers its
142
+ own 4: retry, fix/skip, write a note and exit, skip/abort.
143
+
144
+ ---
145
+
146
+ ## Project structure
147
+
148
+ ```
149
+ ai-dev-flow/
150
+ ├── pipeline.py source-tree launcher (same as the `ai-dev-flow` command)
151
+ ├── ai_dev_flow/ orchestration engine package
152
+ │ ├── cli.py CLI entry point
153
+ │ └── data/ stage definitions, recipes, profile templates (installed with the package)
154
+ ├── tests/ 212 tests
155
+ ├── ARCHITECTURE.md architecture design
156
+ └── CHANGELOG.md release history
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Configuration
162
+
163
+ | Variable | Purpose |
164
+ |----------|---------|
165
+ | `CUSTOM_DEEPSEEK_API_KEY` | LLM API key used by the engine |
166
+
167
+ ---
168
+
169
+ ## License
170
+
171
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,140 @@
1
+ # AI Dev Flow
2
+
3
+ > One command drives the full pipeline: requirements → analysis → design → code → review → delivery.
4
+ > Interruptible and resumable, with a human in the loop at every decision point.
5
+
6
+ **Status**: Active development (v3.10.0) · [中文文档](README.md)
7
+
8
+ ---
9
+
10
+ ## What this is
11
+
12
+ An orchestration layer for agentic coding, not a chat wrapper. It turns
13
+ requirements → design → coding → verification → delivery into a stateful,
14
+ resumable, auditable machine: decision points force human sign-off, all context
15
+ is externalized to files, every task ends in a git commit, and failures preserve
16
+ the working tree for inspection.
17
+
18
+ | Design goal | Trade-off |
19
+ |-------------|-----------|
20
+ | Process stays controlled | 5 mandatory checkpoints; AI drafts, humans decide. Not unattended automation |
21
+ | Context stays trustworthy | Requirements, design and `tasks.yaml` all live on disk; tasks never share conversation memory |
22
+ | Interruptions are recoverable | Stage and task state persist; rerunning the same command resumes from the break point |
23
+ | Changes stay traceable | One git commit per task; failed verification keeps the sandbox for debugging |
24
+
25
+ **Who it is for**: developers and small teams with existing Java / Vue / Python
26
+ codebases who want AI inside a real delivery process — and who need to answer
27
+ "who made this change, and under what constraints". **Not for**: IDE autocomplete,
28
+ throwaway scripts, or teams that refuse any manual confirmation step.
29
+
30
+ ---
31
+
32
+ ## Pipeline overview
33
+
34
+ ```
35
+ ai-dev-flow --project /path/to/your/project
36
+
37
+ Phase 1 ─── requirement refinement (structured requirement doc)
38
+ ⚠ Checkpoint A ─ confirm requirements
39
+ Phase 2 ─── analysis (features, data flow, open questions)
40
+ ⚠ Checkpoint B ─ close open questions
41
+ Phase 3 ─── engineering design (architecture, interfaces, data model)
42
+ ⚠ Checkpoint C ─ confirm design
43
+ Phase 3.5 ─ task decomposition (atomic tasks with context_notes)
44
+ ⚠ Checkpoint C2 ─ confirm decomposition
45
+ █████████ task graph execution (each task = fresh session + git commit) █████████
46
+ Phase 5 ─── build + test
47
+ Phase 6 ─── code + security review
48
+ ⚠ Checkpoint D ─ security sign-off (high-risk only)
49
+ Phase 7 ─── delivery (change list, build verification, review verdict)
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Quick start
55
+
56
+ ### Prerequisites
57
+
58
+ | Dependency | Purpose |
59
+ |------------|---------|
60
+ | Python 3.9+ | orchestration engine |
61
+ | goose CLI >= 1.33 | AI execution engine |
62
+ | LLM API key | DeepSeek or any goose-compatible provider |
63
+
64
+ ### Install
65
+
66
+ ```bash
67
+ # install from PyPI
68
+ pip install ai-dev-flow
69
+
70
+ # or run from a source checkout
71
+ git clone https://github.com/293498733/AI_A_PLANT.git
72
+ cd AI_A_PLANT && pip install -r requirements.txt
73
+
74
+ # supply the API key via environment variable
75
+ export CUSTOM_DEEPSEEK_API_KEY=your_key # Windows: set CUSTOM_DEEPSEEK_API_KEY=your_key
76
+ ```
77
+
78
+ ### Usage
79
+
80
+ ```bash
81
+ ai-dev-flow # interactive start
82
+ ai-dev-flow --project /path/to/project # target a project directory
83
+ ai-dev-flow --project . --from-stage phase3 # start from a specific stage
84
+ ai-dev-flow --project . --dry-run # preview stages without executing
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Core mechanisms
90
+
91
+ ### Resume after interruption
92
+
93
+ Whatever stops the run — Ctrl+C, a reboot, a crashed engine — rerun the same
94
+ command and it continues from the break point. Global progress lives in
95
+ `.ai-dev/.pipeline_stage` inside the target project; per-task state lives in
96
+ `.ai-dev/task_state.json`.
97
+
98
+ ### Task-driven execution with externalized context
99
+
100
+ Large projects are not written in a single AI session. Phase 3.5 decomposes the
101
+ design into atomic tasks in `tasks.yaml`. Each task:
102
+
103
+ - runs in a **fresh engine session** (20–60 turns) and never relies on chat memory
104
+ - gets all its context from **files** (`input_files` + `reference_docs` + `context_notes`)
105
+ - ends with an **automatic git commit**, so the change is traceable
106
+ - is individually resumable — a crash restarts the failed task, not the phase
107
+
108
+ ### Error handling
109
+
110
+ Every AI stage offers 4 options on failure, and task-graph execution offers its
111
+ own 4: retry, fix/skip, write a note and exit, skip/abort.
112
+
113
+ ---
114
+
115
+ ## Project structure
116
+
117
+ ```
118
+ ai-dev-flow/
119
+ ├── pipeline.py source-tree launcher (same as the `ai-dev-flow` command)
120
+ ├── ai_dev_flow/ orchestration engine package
121
+ │ ├── cli.py CLI entry point
122
+ │ └── data/ stage definitions, recipes, profile templates (installed with the package)
123
+ ├── tests/ 212 tests
124
+ ├── ARCHITECTURE.md architecture design
125
+ └── CHANGELOG.md release history
126
+ ```
127
+
128
+ ---
129
+
130
+ ## Configuration
131
+
132
+ | Variable | Purpose |
133
+ |----------|---------|
134
+ | `CUSTOM_DEEPSEEK_API_KEY` | LLM API key used by the engine |
135
+
136
+ ---
137
+
138
+ ## License
139
+
140
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,160 @@
1
+ # AI Dev Flow
2
+
3
+ > 一条命令驱动「需求→分析→方案→编码→审查→交付」的完整开发管线。
4
+ > 中断可恢复,失败可介入,全过程可追溯。
5
+
6
+ **Status**: Active development (v3.10.0) · [English](README.en.md)
7
+
8
+ ---
9
+
10
+ ## 定位与受众
11
+
12
+ **agentic coding 的基础设施** —— 不是"AI 写代码"的对话框,而是把
13
+ 「需求 → 方案 → 编码 → 验证 → 交付」变成一台有状态、可恢复、可审计的机器:
14
+ 决策点强制人工确认,上下文全部外化到文件,每个任务一个 commit,失败保留现场。
15
+
16
+ | 设计目标 | 取舍 |
17
+ |----------|------|
18
+ | 过程可控 | 5 个强制检查点,AI 起草、人拍板;不做无人值守全自动 |
19
+ | 上下文可信 | 需求/方案/tasks.yaml 全部落文件,任务之间不共享对话记忆 |
20
+ | 中断可续 | 阶段 + 任务状态落盘,重跑同一命令从断点继续 |
21
+ | 变更有痕 | 每任务一次 git commit,验证失败保留沙箱现场供排查 |
22
+
23
+ **Who uses this**:有存量 Java / Vue / Python 项目、要把 AI 接进真实交付流程的
24
+ 开发者与小团队;需要回答"这行改动是谁、在什么约束下做的"的交付场景。
25
+
26
+ **不适合**:想要 IDE 内即时补全;单文件脚本或一次性试验;不接受任何人工确认节点。
27
+
28
+ ---
29
+
30
+ ## 一句话理解
31
+
32
+ 这是一个 **AI 项目经理** — 你告诉它要做什么,它帮你走完整个软件开发流程,每一步产出文档,每一步你可以审核、修改、打断、恢复。
33
+
34
+ ---
35
+
36
+ ## 流程总览
37
+
38
+ ```
39
+ ai-dev-flow --project D:/MyPrj/你的项目
40
+
41
+ Phase 1 ─── 需求精炼 (AI 输出结构化需求文档)
42
+ ⚠ 检查点 A ─ 确认需求
43
+ Phase 2 ─── 需求分析 (拆功能点、数据流、不确定项)
44
+ ⚠ 检查点 B ─ 闭环不确定项
45
+ Phase 3 ─── 工程方案 (架构设计、接口定义、数据模型)
46
+ ⚠ 检查点 C ─ 确认方案
47
+ Phase 3.5 ─ 任务拆分 (AI 拆分为原子任务,含 context_notes)
48
+ ⚠ 检查点 C2 ─ 确认任务拆分合理性
49
+ █████████ 任务图执行 (每个任务 = 全新AI会话 + git commit) █████████
50
+ Phase 5 ─── 编译 + 测试
51
+ Phase 6 ─── 代码 + 安全审查
52
+ ⚠ 检查点 D ─ 安全确认(仅高危暂停)
53
+ Phase 7 ─── 交付 (变更清单、构建验证、审查结论)
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 快速开始
59
+
60
+ ### 前置条件
61
+
62
+ | 依赖 | 说明 |
63
+ |------|------|
64
+ | Python 3.9+ | 编排引擎 |
65
+ | goose CLI >= 1.33 | AI 执行引擎 |
66
+ | LLM API Key | DeepSeek 或其他 goose 兼容的 Provider |
67
+
68
+ ### 安装
69
+
70
+ ```bash
71
+ # 从 PyPI 安装
72
+ pip install ai-dev-flow
73
+
74
+ # 或直接用源码树运行(根目录 python pipeline.py 等价)
75
+ git clone https://github.com/293498733/AI_A_PLANT.git
76
+ cd AI_A_PLANT && pip install -r requirements.txt
77
+
78
+ # 配置 API Key
79
+ set CUSTOM_DEEPSEEK_API_KEY=你的key
80
+ # 或写入系统环境变量
81
+ ```
82
+
83
+ ### 使用
84
+
85
+ ```bash
86
+ # 交互式启动
87
+ ai-dev-flow
88
+
89
+ # 指定项目路径
90
+ ai-dev-flow --project D:/MyPrj/my-project
91
+
92
+ # 从指定阶段开始
93
+ ai-dev-flow --project D:/MyPrj/my-project --from-stage phase3
94
+
95
+ # 预览模式(不实际执行)
96
+ ai-dev-flow --project D:/MyPrj/my-project --dry-run
97
+ ```
98
+
99
+ ---
100
+
101
+ ## 核心机制
102
+
103
+ ### 中断恢复
104
+
105
+ 任何原因中断(Ctrl+C、关机、goose 崩溃),重新运行相同命令即可从断点继续。
106
+
107
+ **原理**:项目目录下的 `.ai-dev/.pipeline_stage` 记录全局进度,`task_state.json` 记录每个任务的完成状态。
108
+
109
+ ### 任务驱动 + 上下文外化 (v3.0.0)
110
+
111
+ 大项目不再用一个 AI 会话硬写所有代码。Phase 3.5 将工程方案拆分为原子任务(`tasks.yaml`),每个任务:
112
+ - 在**全新 goose 会话**中执行(20-60 turns),不依赖对话记忆
113
+ - 上下文完全来自**文件**(input_files + reference_docs + context_notes)
114
+ - 完成后**自动 git commit**,变更可追溯
115
+ - 崩溃后从**失败任务继续**,而非整阶段重跑
116
+
117
+ ### 错误处理
118
+
119
+ 每个 AI 阶段失败时提供 4 个选项;任务图执行阶段提供独立的 4 选项:
120
+
121
+ | 选项 | 行为 | 适用场景 |
122
+ |------|------|---------|
123
+ | 1) retry | 原地重试 | 网络波动 |
124
+ | 2) fix/skip | 手动修改后重试 / 跳过该任务 | 编译错误 / 已手动完成 |
125
+ | 3) write note | 写说明笔记并退出 | 问题复杂,晚点处理 |
126
+ | 4) skip/abort | 跳过该阶段 / 终止任务图 | 不可恢复的错误 |
127
+
128
+ ---
129
+
130
+ ## 项目结构
131
+
132
+ ```
133
+ ai-dev-flow/
134
+ ├── pipeline.py ← 源码树启动器(等价 ai-dev-flow 命令)
135
+ ├── ai_dev_flow/ ← 编排引擎包
136
+ │ ├── cli.py ← CLI 入口
137
+ │ └── data/ ← 阶段定义、Recipe、Profile 模板(随包安装)
138
+ ├── tests/ ← 212 个用例
139
+ ├── ARCHITECTURE.md ← 架构设计
140
+ └── CLAUDE.md ← 开发进度
141
+ ```
142
+
143
+ ---
144
+
145
+ ## 与原项目 (ai-dev-platform) 的区别
146
+
147
+ | 维度 | ai-dev-platform | ai-dev-flow |
148
+ |------|-----------------|-------------|
149
+ | 编排语言 | Windows Batch | Python 3.9+ |
150
+ | 阶段定义 | 硬编码在 bat 中 | 数据驱动 (pipeline.yaml) |
151
+ | 日志 | 屏幕输出 | 结构化日志到文件 |
152
+ | 加新阶段 | 改 bat 代码 | 改 YAML 配置 |
153
+ | 测试 | 不可测试 | 可单测 |
154
+ | Recipe 文件 | YAML | YAML (不变) |
155
+
156
+ ---
157
+
158
+ ## 许可证
159
+
160
+ MIT — 见 [LICENSE](LICENSE)。
@@ -0,0 +1,5 @@
1
+ """AI 全流程开发管线 - 编排引擎"""
2
+
3
+ __version__ = "3.10.0"
4
+
5
+ __all__ = ["__version__"]
@@ -0,0 +1,6 @@
1
+ """支持 `python -m ai_dev_flow`。"""
2
+
3
+ from ai_dev_flow.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()
@@ -0,0 +1,65 @@
1
+ """人工确认检查点。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import logging
6
+ from pathlib import Path
7
+
8
+ logger = logging.getLogger("ai-dev-flow")
9
+
10
+ SEPARATOR = "=" * 60
11
+ PREVIEW_LINES = 25
12
+
13
+ ci_mode = False
14
+
15
+
16
+ def set_ci_mode(enabled: bool) -> None:
17
+ global ci_mode
18
+ ci_mode = enabled
19
+
20
+
21
+ def confirm(title: str, prompt: str, preview_file: Path | None = None) -> None:
22
+ """暂停并等待用户确认,可选展示产出文件摘要。"""
23
+ print()
24
+ print(SEPARATOR)
25
+ print(f" [人工确认] {title}")
26
+ print(SEPARATOR)
27
+ if prompt:
28
+ print(f" {prompt}")
29
+ print(SEPARATOR)
30
+
31
+ if preview_file and preview_file.exists():
32
+ preview(preview_file)
33
+
34
+ if ci_mode:
35
+ print(" [CI] 自动确认,继续执行...")
36
+ return
37
+ print()
38
+ input("按 Enter 继续...")
39
+
40
+
41
+ def preview(filepath: Path, lines: int = PREVIEW_LINES) -> None:
42
+ """展示文件的前 N 行作为摘要。"""
43
+ try:
44
+ content = filepath.read_text(encoding="utf-8")
45
+ all_lines = content.splitlines()
46
+ print()
47
+ print(f" --- {filepath.name} 摘要 (前 {min(lines, len(all_lines))} 行) ---")
48
+ for line in all_lines[:lines]:
49
+ print(f" | {line}")
50
+ if len(all_lines) > lines:
51
+ print(f" | ... (共 {len(all_lines)} 行,已省略)")
52
+ print(f" --- {filepath.stat().st_size // 1024}KB ---")
53
+ except Exception:
54
+ print(f" (无法预览 {filepath.name})")
55
+
56
+
57
+ def ask_boolean(prompt: str, default: bool = True) -> bool:
58
+ if ci_mode:
59
+ print(f" [CI] {prompt} → {'Y' if default else 'N'} (auto)")
60
+ return default
61
+ suffix = " (Y/n): " if default else " (y/N): "
62
+ answer = input(prompt + suffix).strip().lower()
63
+ if not answer:
64
+ return default
65
+ return answer in ("y", "yes")