5.4 KiB
5.4 KiB
phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, must_haves
| phase | plan | type | wave | depends_on | files_modified | autonomous | requirements | must_haves | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 05-archive-directory | 01 | execute | 1 |
|
true |
|
|
Purpose: 为所有分析任务提供一致的中间文件存储位置,便于管理和清理 Output: 修改 Pipeline 和 CLI 使用统一的中间目录路径
<execution_context> @/home/starmen1265/.claude/get-shit-done/workflows/execute-plan.md @/home/starmen1265/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/05-archive-directory/05-CONTEXT.mdFrom kb_pipeline/pipeline.py:
class Pipeline:
def __init__(
self,
processors: List[BaseProcessor],
config: Optional[PipelineConfig] = None,
output_dir: Optional[Path] = None,
):
self.output_dir = output_dir or Path.cwd()
def _get_content_dir(self, parsed: ParsedLink) -> Path:
content_dir = self.output_dir / f"{parsed.platform}_{parsed.content_id}"
content_dir.mkdir(parents=True, exist_ok=True)
return content_dir
From kb-workflow/kb_workflow.py:
def process_command(
url: str,
output_dir: Optional[str] = None,
skip_completed: bool = True
) -> Dict[str, Any]:
out_dir = Path(output_dir) if output_dir else Path.cwd()
2. Modify `Pipeline.__init__` to use intermediate directory as default:
- Change `self.output_dir = output_dir or Path.cwd()` to use `INTERMEDIATE_DIR`
- The output_dir parameter still allows override for testing
3. Update `_get_content_dir` to ensure it follows `{platform}_{content_id}/` naming:
- Current implementation already does this: `f"{parsed.platform}_{parsed.content_id}"`
- Verify no changes needed
Key points:
- Hard-code path as `~/work/intermediate/analysis/` (per user decision)
- Do NOT add KB_INTERMEDIATE_PATH config option (user explicitly decided against this)
- Content directory naming stays as `{platform}_{content_id}/`
python3 -c "from kb_pipeline.pipeline import INTERMEDIATE_DIR; assert str(INTERMEDIATE_DIR) == str(Path.home() / 'work' / 'intermediate' / 'analysis')"
- INTERMEDIATE_DIR constant defined in pipeline.py
- Pipeline defaults to intermediate directory
- Content directory naming unchanged
Task 2: Update CLI to use intermediate directory default
kb-workflow/kb_workflow.py
1. Import INTERMEDIATE_DIR from kb_pipeline.pipeline:
```python
from kb_pipeline.pipeline import Pipeline, INTERMEDIATE_DIR
```
2. Modify `process_command` to use intermediate directory as default:
- Change: `out_dir = Path(output_dir) if output_dir else Path.cwd()`
- To: `out_dir = Path(output_dir) if output_dir else INTERMEDIATE_DIR`
3. Update docstring to document the default output directory behavior
Key points:
- When no -o/--output-dir specified, content goes to ~/work/intermediate/analysis/
- User can still override with -o flag for testing or special cases
python3 -c "from kb_workflow import process_command; import inspect; src = inspect.getsource(process_command); assert 'INTERMEDIATE_DIR' in src"
- CLI imports INTERMEDIATE_DIR
- Default output directory is ~/work/intermediate/analysis/
- Help text updated to reflect default
1. Run existing tests to ensure no regression:
```bash
python3 -m pytest tests/ -v --tb=short
```
- Verify intermediate directory path is correct:
Expected: /home/{user}/work/intermediate/analysis
python3 -c "from kb_pipeline.pipeline import INTERMEDIATE_DIR; print(INTERMEDIATE_DIR)"
<success_criteria>
- INT-01: All analysis tasks use
~/work/intermediate/analysis/as intermediate directory - INT-02: Content directory naming is
{platform}_{content_id}/ - No KB_INTERMEDIATE_PATH config option added (per user decision)
- Existing tests pass </success_criteria>