This repository has been archived on 2026-08-07. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
kb-skills/.planning/phases/05-archive-directory/05-01-PLAN.md
T

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
kb_pipeline/pipeline.py
kb-workflow/kb_workflow.py
true
INT-01
INT-02
truths artifacts key_links
Pipeline uses ~/work/intermediate/analysis/ as intermediate directory
Content directory follows {platform}_{content_id}/ naming convention
CLI defaults to intermediate directory when no output_dir specified
path provides contains
kb_pipeline/pipeline.py Intermediate directory path logic intermediate
path provides contains
kb-workflow/kb_workflow.py CLI default output directory intermediate
from to via pattern
kb-workflow/kb_workflow.py kb_pipeline/pipeline.py output_dir parameter output_dir.*intermediate
统一中间目录结构到 `~/work/intermediate/analysis/`

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.md

From 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()
Task 1: Add intermediate directory constant and update Pipeline kb_pipeline/pipeline.py 1. Add module-level constant for intermediate directory: ```python INTERMEDIATE_DIR = Path.home() / "work" / "intermediate" / "analysis" ```
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 ```
  1. Verify intermediate directory path is correct:
    python3 -c "from kb_pipeline.pipeline import INTERMEDIATE_DIR; print(INTERMEDIATE_DIR)"
    
    Expected: /home/{user}/work/intermediate/analysis

<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>
After completion, create `.planning/phases/05-archive-directory/05-01-SUMMARY.md`