docs(05-01): complete unified intermediate directory plan

- Added intermediate_path config field with KB_INTERMEDIATE_PATH env var support
- Updated Pipeline to use configurable intermediate directory
- Updated CLI to default to intermediate_path instead of cwd
- Completed requirements: INT-01, INT-02, INT-03

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-16 23:16:09 +08:00
parent 7f9caa32d2
commit 129a6311f4
4 changed files with 124 additions and 28 deletions
+7 -7
View File
@@ -7,9 +7,9 @@
### 中间目录 (Intermediate)
- [ ] **INT-01**: 中间目录统一到 `~/work/intermediate/analysis/`
- [ ] **INT-02**: 内容目录命名保持 `{platform}_{content_id}/` 格式
- [ ] **INT-03**: 配置文件支持自定义中间目录路径
- [x] **INT-01**: 中间目录统一到 `~/work/intermediate/analysis/`
- [x] **INT-02**: 内容目录命名保持 `{platform}_{content_id}/` 格式
- [x] **INT-03**: 配置文件支持自定义中间目录路径
### 归档步骤 (Archive)
@@ -69,9 +69,9 @@ Deferred to future release.
| Requirement | Phase | Status |
|-------------|-------|--------|
| INT-01 | Phase 5 | Pending |
| INT-02 | Phase 5 | Pending |
| INT-03 | Phase 5 | Pending |
| INT-01 | Phase 5 | Complete |
| INT-02 | Phase 5 | Complete |
| INT-03 | Phase 5 | Complete |
| ARC-01 | Phase 5 | Pending |
| ARC-02 | Phase 5 | Pending |
| ARC-03 | Phase 5 | Pending |
@@ -97,4 +97,4 @@ Deferred to future release.
---
*Requirements defined: 2026-03-16*
*Last updated: 2026-03-16 after roadmap creation*
*Last updated: 2026-03-16 after 05-01 completion*
+2 -2
View File
@@ -63,7 +63,7 @@ Plans:
**Plans**: 3 plans
Plans:
- [ ] 05-01-PLAN.md — 中间目录统一和配置 (INT-01, INT-02, INT-03)
- [x] 05-01-PLAN.md — 中间目录统一和配置 (INT-01, INT-02, INT-03)
- [ ] 05-02-PLAN.md — ArchiveProcessor 归档处理器 (ARC-01, ARC-02, ARC-03, ARC-04)
- [ ] 05-03-PLAN.md — 最终目录结构验证和测试 (OUT-01, OUT-02, OUT-03, OUT-04)
@@ -93,5 +93,5 @@ Phases execute in numeric order: 1 → 2 → 3 → 4 → 5 → 6
| 2. Adapters | v1.0 | 2/2 | Complete | 2026-03-15 |
| 3. Processors | v1.0 | 3/3 | Complete | 2026-03-15 |
| 4. Pipeline | v1.0 | 2/2 | Complete | 2026-03-15 |
| 5. 归档与目录优化 | v1.1 | 0/3 | Ready to execute | - |
| 5. 归档与目录优化 | v1.1 | 1/3 | In progress | 2026-03-16 |
| 6. 代码整合 | v1.1 | 0/2 | Not started | - |
+19 -19
View File
@@ -2,16 +2,16 @@
gsd_state_version: 1.0
milestone: v1.1
milestone_name: Architecture Refactor
status: planning
stopped_at: Phase 5 context gathered
last_updated: "2026-03-16T14:54:52.761Z"
last_activity: 2026-03-16 — v1.1 roadmap created
status: executing
stopped_at: 05-01 unified intermediate directory completed
last_updated: "2026-03-16T15:14:10Z"
last_activity: 2026-03-16 — 05-01 unified intermediate directory completed
progress:
total_phases: 6
completed_phases: 4
total_plans: 12
completed_plans: 12
percent: 0
completed_plans: 13
percent: 8
---
# Project State
@@ -26,28 +26,28 @@ See: .planning/PROJECT.md (updated 2026-03-16)
## Current Position
Phase: 5 of 6 (归档与目录优化)
Plan: 0 of 3 in current phase
Status: Ready to plan
Last activity: 2026-03-16 — v1.1 roadmap created
Plan: 1 of 3 in current phase
Status: Executing
Last activity: 2026-03-16 — 05-01 unified intermediate directory completed
Progress: [░░░░░░░░░░] 0% (v1.1 milestone)
Progress: [█░░░░░░░░░] 8% (v1.1 milestone)
## Performance Metrics
**Velocity:**
- Total plans completed: 0 (v1.1)
- Average duration: -
- Total execution time: -
- Total plans completed: 1 (v1.1)
- Average duration: 2 min
- Total execution time: 2 min
**By Phase:**
| Phase | Plans | Total | Avg/Plan |
|-------|-------|-------|----------|
| 5. 归档与目录优化 | 0/3 | - | - |
| 5. 归档与目录优化 | 1/3 | 2 min | 2 min |
| 6. 代码整合 | 0/2 | - | - |
**Recent Trend:**
- Last 5 plans: N/A
- Last 5 plans: 2 min
- Trend: N/A
*Updated after each plan completion*
@@ -74,8 +74,8 @@ None.
## Session Continuity
Last session: 2026-03-16T14:54:52.760Z
Stopped at: Phase 5 context gathered
Resume file: .planning/phases/05-archive-directory/05-CONTEXT.md
Last session: 2026-03-16T15:14:10Z
Stopped at: 05-01 unified intermediate directory completed
Resume file: .planning/phases/05-archive-directory/05-01-SUMMARY.md
**Next step:** `/gsd:plan-phase 5`
**Next step:** Execute 05-02-PLAN.md
@@ -0,0 +1,96 @@
---
phase: 05-archive-directory
plan: 01
subsystem: config
tags: [pydantic-settings, intermediate-path, env-var, configuration]
# Dependency graph
requires: []
provides:
- KB_INTERMEDIATE_PATH configuration field in KBSettings
- Default intermediate directory path for all analysis tasks
- Pipeline and CLI default output directory
affects: [pipeline, cli, config]
# Tech tracking
tech-stack:
added: []
patterns: [pydantic-settings env var override, configurable default paths]
key-files:
created: []
modified:
- kb_pipeline/config.py
- kb_pipeline/pipeline.py
- kb-workflow/kb_workflow.py
key-decisions:
- "Default intermediate path: ~/work/intermediate/analysis/"
- "Use pydantic-settings naming convention (KB_INTERMEDIATE_PATH env var)"
- "Preserve output_dir parameter for testing/custom override"
patterns-established:
- "Configurable paths via pydantic-settings with env var override support"
requirements-completed: [INT-01, INT-02, INT-03]
# Metrics
duration: 2min
completed: 2026-03-16
---
# Phase 5 Plan 1: Unified Intermediate Directory Summary
**Unified intermediate directory configuration with KB_INTERMEDIATE_PATH support for customizable analysis output paths**
## Performance
- **Duration:** 2 min
- **Started:** 2026-03-16T15:12:20Z
- **Completed:** 2026-03-16T15:14:10Z
- **Tasks:** 3
- **Files modified:** 3
## Accomplishments
- Added intermediate_path field to KBSettings with pydantic-settings env var support
- Updated Pipeline to use settings.intermediate_path as default output directory
- Updated CLI process_command to default to intermediate_path instead of cwd
## Task Commits
Each task was committed atomically:
1. **Task 1: Add KB_INTERMEDIATE_PATH config to KBSettings** - `c5b2c66` (feat)
2. **Task 2: Update Pipeline to use configurable intermediate directory** - `10f4dfa` (feat)
3. **Task 3: Update CLI to use configurable intermediate directory default** - `7f9caa3` (feat)
## Files Created/Modified
- `kb_pipeline/config.py` - Added intermediate_path field with default ~/work/intermediate/analysis/
- `kb_pipeline/pipeline.py` - Changed default output_dir from cwd to settings.intermediate_path
- `kb-workflow/kb_workflow.py` - Updated process_command to use intermediate_path default
## Decisions Made
- Default path is ~/work/intermediate/analysis/ (consistent with project conventions)
- Use pydantic-settings naming convention for env var (KB_INTERMEDIATE_PATH)
- Preserve output_dir parameter override for testing and special cases
## Deviations from Plan
None - plan executed exactly as written.
## Issues Encountered
One pre-existing test failure detected (test_workflow_skips_completed_steps) - this is unrelated to our changes. The test has a bug where it doesn't mock _ask_rerun_step, causing it to prompt for stdin during pytest. This is a pre-existing issue and not in scope for this plan.
## User Setup Required
None - no external service configuration required.
## Next Phase Readiness
- Intermediate directory configuration complete
- Ready for archive directory implementation
- Users can now customize intermediate path via KB_INTERMEDIATE_PATH env var
---
*Phase: 05-archive-directory*
*Completed: 2026-03-16*