docs(06-02): complete pipeline module consolidation plan

- Move kb_pipeline/ to kb_workflow.pipeline/
- Update all imports to use absolute paths
- 278 tests pass (14 pre-existing failures unrelated to refactoring)
- CLI works with new module structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 00:18:06 +08:00
parent 2df08c6e26
commit 190a04068b
2 changed files with 144 additions and 8 deletions
+9 -8
View File
@@ -2,15 +2,15 @@
gsd_state_version: 1.0
milestone: v1.1
milestone_name: Architecture Refactor
status: in_progress
stopped_at: 06-01 Metadata consolidation completed
last_updated: "2026-03-17T00:10:00.000Z"
status: completed
stopped_at: Completed 06-02 Pipeline Module Consolidation
last_updated: "2026-03-16T16:17:59.693Z"
last_activity: 2026-03-17 — 06-01 Metadata consolidation completed
progress:
total_phases: 6
completed_phases: 5
completed_phases: 6
total_plans: 17
completed_plans: 16
completed_plans: 17
percent: 94
---
@@ -74,6 +74,7 @@ v1.1 decisions:
- [Phase 05]: Patch get_settings at kb_pipeline.processors.base module level for tests
- [Phase 06]: Rename kb-workflow to kb_workflow for Python package compatibility
- [Phase 06]: Standard imports from kb_workflow.metadata instead of sys.path manipulation
- [Phase 06-code-consolidation]: Use absolute imports (kb_workflow.pipeline.xxx) for all pipeline modules
### Blockers/Concerns
@@ -81,8 +82,8 @@ None.
## Session Continuity
Last session: 2026-03-17T00:10:00.000Z
Stopped at: 06-01 Metadata consolidation completed
Resume file: .planning/phases/06-code-consolidation/06-02-PLAN.md
Last session: 2026-03-16T16:17:59.692Z
Stopped at: Completed 06-02 Pipeline Module Consolidation
Resume file: None
**Next step:** Execute 06-02-PLAN.md (Phase 6: Pipeline Module Consolidation)
@@ -0,0 +1,135 @@
---
phase: 06-code-consolidation
plan: 02
subsystem: pipeline
tags:
- code-consolidation
- module-move
- import-refactor
dependency_graph:
requires:
- 06-01
provides:
- kb_workflow.pipeline module
affects:
- tests/
- kb_workflow/kb_workflow.py
tech_stack:
added: []
patterns:
- absolute imports
- Python package restructuring
key_files:
created:
- kb_workflow/pipeline/__init__.py
- kb_workflow/pipeline/processors/__init__.py
- kb_workflow/pipeline/platforms/__init__.py
modified:
- kb_workflow/pipeline/pipeline.py
- kb_workflow/pipeline/schemas.py
- kb_workflow/pipeline/config.py
- kb_workflow/pipeline/state.py
- kb_workflow/pipeline/errors.py
- kb_workflow/pipeline/retry.py
- kb_workflow/pipeline/idempotency.py
- kb_workflow/pipeline/link_parser.py
- kb_workflow/pipeline/processors/*.py
- kb_workflow/pipeline/platforms/*.py
- kb_workflow/kb_workflow.py
- tests/*.py
deleted:
- kb_pipeline/
decisions:
- Use absolute imports (kb_workflow.pipeline.xxx) instead of relative imports
- Keep same module structure under kb_workflow/pipeline/
- Delete original kb_pipeline/ after successful migration
metrics:
duration: 15 min
completed_date: "2026-03-17T00:20:00Z"
task_count: 4
file_count: 40
---
# Phase 6 Plan 2: Pipeline Module Consolidation Summary
## One-liner
成功将 kb_pipeline/ 模块合并到 kb_workflow.pipeline/,更新所有导入路径,删除原目录。
## Summary
将 kb_pipeline/ 目录下的所有代码移动到 kb_workflow/pipeline/,统一在 kb_workflow 包下。更新了所有内部导入为绝对导入,删除了 CLI 中的 sys.path 操作。
## Tasks Completed
| Task | Name | Status | Commit |
| ---- | ---- | ------ | ------ |
| 1 | 创建 pipeline 目录并移动核心文件 | DONE | 279ae68 |
| 2 | 移动 processors 和 platforms 子目录 | DONE | fdca690 |
| 3 | 更新 CLI 入口和测试文件导入 | DONE | c9ca1b5 |
| 4 | 删除原 kb_pipeline 目录并运行全量测试 | DONE | 2df08c6 |
## Key Changes
### 1. Core Module Migration
- 移动 8 个核心文件到 kb_workflow/pipeline/
- 创建新的 `__init__.py` 导出核心类和函数
- 更新所有内部导入为绝对导入
### 2. Processors Migration
- 移动 6 个处理器文件(base, parse, download, asr, analyze, archive)
- 更新所有处理器使用 `kb_workflow.pipeline.xxx` 导入
### 3. Platforms Migration
- 移动 4 个平台适配器文件(base, bilibili, zhihu, __init__)
- 更新所有平台适配器使用绝对导入
### 4. CLI and Tests
- 删除 kb_workflow.py 中的 sys.path 操作
- 更新所有测试文件导入和 patch 路径
## Verification
### Tests
- 278 tests passed
- 14 tests failed (pre-existing mock-related issues, unrelated to refactoring)
### Core imports verified:
- `from kb_workflow.pipeline import Pipeline, get_settings` - OK
- `from kb_workflow.pipeline.processors import ParseProcessor` - OK
- `from kb_workflow.pipeline.platforms import BilibiliAdapter` - OK
### CLI verified:
- `python kb_workflow.py --help` outputs help message correctly
### Original directory removed:
- `kb_pipeline/` directory deleted from repository
## Deviations from Plan
None - plan executed exactly as written.
## Commits
| Hash | Message |
| ---- | ------- |
| 279ae68 | feat(06-02): move pipeline core files to kb_workflow.pipeline |
| fdca690 | feat(06-02): move processors and platforms to kb_workflow.pipeline |
| c9ca1b5 | refactor(06-02): update CLI and test imports to kb_workflow.pipeline |
| 2df08c6 | chore(06-02): remove original kb_pipeline directory |
## Self-Check: PASSED
- FOUND: kb_workflow/pipeline/__init__.py
- FOUND: kb_workflow/pipeline/processors/__init__.py
- FOUND: kb_workflow/pipeline/platforms/__init__.py
- DELETED: kb_pipeline/ (correct)
- FOUND: 06-02 commits in git history