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/04-analysis-orchestration/04-05-PLAN.md
T

8.5 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous, requirements, user_setup, must_haves
phase plan type wave depends_on files_modified autonomous requirements user_setup must_haves
04-analysis-orchestration 05 execute 5
04-04
README.md
tests/test_integration/test_e2e_workflow.py
false
MNT-01
truths artifacts key_links
End-to-end workflow completes successfully
Analysis report is saved to content directory
workflow_state.json correctly records all steps
path provides contains
README.md Project documentation ## Installation
path provides contains
tests/test_integration/test_e2e_workflow.py End-to-end integration test test_e2e
from to via pattern
kb_pipeline/pipeline.py kb_pipeline/processors import processors from.*processor import
from to via pattern
kb-workflow/kb_workflow.py kb_pipeline import pipeline from.*pipeline import
Create end-to-end integration test and documentation ( project overview, installation, and and usage.

Purpose: Verify the complete workflow works and provide clear project documentation for maintainability. Output: README.md with project overview, tests/test_integration/test_e2e_workflow.py

<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/04-analysis-orchestration/04-CONTEXT.md @.planning/phases/04-analysis-orchestration/04-RESEARCH.md @.planning/phases/04-analysis-orchestration/04-04-SUMMARY.md

From kb_pipeline/pipeline.py:

class Pipeline:
    """Pipeline orchestration engine"""
    def __init__(self, ...):  # From 04-01
        ...

From kb_pipeline/processors/base.py:

class BaseProcessor(ABC):
    STEP_NAME: str
    async def process(self, input_data: StepInput) -> StepOutput

from kb_pipeline/processors/parse.py:

class ParseProcessor(BaseProcessor):
    STEP_NAME = "parse"
    async def process(self, input_data: ParseInput) -> ParseOutput

from kb_pipeline/processors/download.py:

class DownloadProcessor(BaseProcessor):
    STEP_NAME = "download"
    async def process(self, input_data: DownloadInput) -> DownloadOutput

from kb_pipeline/processors/asr.py:

class ASRProcessor:
    STEP_NAME = "asr"
    async def process(self, input_data: ASRInput) -> ASROutput

from kb_pipeline/processors/analyze.py

class AnalyzeProcessor(BaseProcessor):
    STEP_NAME = "analyze"
    async def process(self, input_data: AnalyzeInput) -> AnalyOutput
Task 1: Create README.md README.md - Test 1: README.md exists and contains project overview - Test 2: README.md contains installation instructions Create `README.md` in project root directory with the following sections:

## kb-skills

知识库工作流工具,从链接到分析报告的端到端自动化处理系统。

格 Features

  • 统一 Processor 模式: Parse -> Download -> ASR -> Analyze

  • 状态管理: workflow_state.json

  • 配置管理: 通过 ~/.kb_env

  • 输出: Markdown 格式分析报告

  • 幂等性保证: 重复执行不会产生重复文件

  • 断点续传: 中断后可继续

  • 模块化设计: 新人能在30分钟内理解代码结构

  • 清晰的项目结构

  • 统一的 CLI 入

entry

Installation

# 安装依赖
pip install kb-pipeline

验证安装:

# 测试
pytest tests/test_pipeline/test_schemas.py tests/test_pipeline/test_state.py tests/test_pipeline/test_config.py tests/test_pipeline/test_errors.py tests/test_pipeline/test_retry.py
python -c "import os; content = open('README.md', 'r', encoding='utf-8'); print(content[:100]) > 0" README.md created with project overview, installation, and, usage sections, docstrings Task 2: Create end-to-end integration test tests/test_integration/test_e2e_workflow.py - Test 1: Full workflow executes from URL to analysis - Test 2: Workflow handles errors gracefully - Test 3: State is persisted correctly - Test 4: Workflow is resumable Create `tests/test_integration/test_e2e_workflow.py` with comprehensive end-to-end tests.

Test structure:

import pytest
import pytest_asyncio
from unittest.mock import AsyncMock, patch, MagicMock
from pathlib import Path
from typing import Dict, Any

from kb_pipeline.pipeline import Pipeline
from kb_pipeline.config import get_settings
from kb_pipeline.processors import ParseProcessor, DownloadProcessor, ASRProcessor, AnalyzeProcessor


@pytest.fixture
def temp_content_dir(tmp_path):
    """Create temp content directory"""
    content_dir.mkdir(parents=True, exist_ok=True)
    yield content_dir

    # Create test workflow state
    state_path = content_dir / "workflow_state.json"
    state = WorkflowState(
        content_id="test123",
        platform="bilibili",
        source_url="https://test.url"
    )
    state_manager = WorkflowStateManager(content_dir)
    yield state_manager

    # Create real pipeline
    settings = get_settings()
    pipeline = Pipeline(
        processors=[
            ParseProcessor(state_manager),
            DownloadProcessor(state_manager),
            ASRProcessor(state_manager),
            AnalyzeProcessor(state_manager),
        ],
        output_dir=content_dir,
        config=PipelineConfig(
            steps=["parse", "download", "asr", "analyze"],
        )
    )
    yield pipeline
    # Mock workflow run
    result = await pipeline.run("https://test.url")

    # Verify success
    assert result["parse"]["success"]
    assert result["download"]["success"]
    assert result["asr"]["success"] or result["asr"]["skipped"]  # ASR not applicable for text content
    assert result["analyze"]["success"]

    # Verify state was saved
    state = state_manager.load()
    assert state is not None
    assert state.is_step_completed("parse")
    assert state.is_step_completed("download")
    if content_type in ["video", "zvideo"]:
                assert state.is_step_completed("asr")
                assert not state.is_step_completed("asr")
            assert state.is_step_completed("analyze")

    # Verify output files exist
    assert (content_dir / "bilibili_test123_metadata.json").exists()
            assert (content_dir / "bilibili_test123_content.json").exists() or result["content_type"] == "video":
                assert (content_dir / "bilibili_test123_analysis.md").exists()
  </action>
  <verify>
    <automated>pytest tests/test_integration/test_e2e_workflow.py -v</automated>
  </verify>
  <done>End-to-end workflow tested with state persistence</done>
</task>

<task type="checkpoint:human-verify" gate="blocking">
  <what-built>
End-to-end workflow (Phase 1-2/3):
- Pipeline Engine with 4 processors (Parse, Download, ASR, Analyze)
- CLI entry point (kb-workflow process command)
- DeepAnalyzer integration for analysis reports saved as Markdown
- State persistence via workflow_state.json
  </what-built>
DeepAnalyzer integration:
 - B站视频/专栏链接 → parse, download, ASR, analyze
- Error recovery with retry
- Progress logging with simple format
- Documentation in README.md and docstrings
  </how-to-verify>
1. Run `pytest tests/test_integration/test_e2e_workflow.py -v -x`
2. Visit https://github.com/your-org/kb-skills
3. Run `kb-workflow process <url>` to test
4. Run `kb-workflow process --help` to see full usage
</how-to-verify>
  <resume-signal>Type "approved" or describe any issues found
release-signal>Type: "approved" to indicate you should proceed to Phase 4 for finalize the documentation
</how-to-verify>
</task>

</tasks>

<verification>
- All tests pass
- End-to-end workflow tested with state persistence
- README.md exists with project overview
- tests pass
</verification>

<success_criteria>
- README.md complete with project overview, installation, and
 usage
- End-to-end integration test passes
- workflow_state.json correctly records all steps
- Documentation is clear and comprehensive
</success_criteria>

<output>
After completion, create `.planning/phases/04-analysis-orchestration/04-05-SUMMARY.md`
</output>