- Add Pydantic models: AnswerData, ArticleData, ContentMetadata, AuthorInfo, CrawlResult
- Create test fixtures in conftest.py with mock browser and sample API responses
- Set up crawler module with __init__.py exports
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add login_command function with QR code login, cookie import, and status check
- Add login subcommand with --import-cookie and --status options
- Update CLI help text with login examples
- Fix mock paths in tests to match actual import locations
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add CookieValidationResult Pydantic model with valid, username, user_id, reason fields
- Add validate_cookie async method to ZhihuLogin class
- Validate cookie via Zhihu /api/v4/me endpoint
- Handle 200, 401, and other status codes appropriately
- Handle network errors gracefully
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Test validate_cookie_valid - valid cookie returns user info
- Test validate_cookie_expired - expired cookie returns False
- Test validate_cookie_empty - empty cookie returns False
- Test validate_cookie_malformed - network error handling
- Test validate_cookie_other_status_code - non-200/401 handling
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TDD GREEN phase - implementation passes all 8 tests:
- ZhihuLoginResult: Pydantic model for login results
- ZhihuLogin: Main class with QR code login flow
- LOGIN_URL: https://www.zhihu.com/signin
- CANVAS_SELECTORS: Multiple fallback selectors for QR canvas
- _find_qrcode_canvas(): Find canvas with fallback selectors
- _save_qrcode_image(): Save QR code to intermediate directory
- check_login_cookie(): Detect z_c0 cookie for login state
- get_cookies_str(): Extract cookie string from context
- _wait_for_login(): Poll with configurable timeout (tenacity)
- login_by_qrcode(): Main entry point for login flow
Key design decisions:
- Uses tenacity Retrying for configurable timeout
- QR code saved to intermediate_path with timestamp
- Multiple canvas selectors for robustness
- Proper browser lifecycle management
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CookieManager saves cookies to ~/.kb_env file
- Updates existing ZHIHU_COOKIE line or appends new
- Preserves other configuration lines
- Sets file permissions to 600 for security
- Loads cookies from env file
- Clears get_settings cache after saving
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TDD RED phase - tests expect ZhihuLogin class that doesn't exist yet:
- test_login_page_access: verify correct login URL
- test_qrcode_screenshot: verify QR code capture and save
- test_cookie_detection_with_z_c0: verify login detection
- test_cookie_detection_without_z_c0: verify no login when missing z_c0
- test_cookie_extraction: verify cookie string format
- test_login_timeout: verify timeout after 60s polling
- test_result_model_success: verify success result model
- test_result_model_failure: verify failure result model
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Test save_cookie creates env file
- Test save_cookie updates existing line
- Test save_cookie appends new line
- Test save_cookie preserves other lines
- Test save_cookie sets file permissions to 600
- Test load_cookie returns saved value
- Test load_cookie returns empty if file not exists
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Create tests/test_auth/conftest.py with pytest fixtures
- mock_browser: Mock PlaywrightBrowser for unit testing
- mock_canvas: Mock canvas element for QR code screenshot
- sample_cookies: Test cookie data with z_c0 login cookie
- sample_cookies_no_login: Test cookies without login state
- mock_env_file: Temporary .kb_env file fixture
- intermediate_path: Temporary intermediate directory fixture
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Parse Chrome Cookie Editor JSON format
- Filter cookies by zhihu.com domain
- Handle malformed JSON with ValueError
- Handle file not found with ValueError
- Return cookie string in "name=value; name2=value2" format
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Test parse_json_cookies for Chrome Cookie Editor format
- Test domain filtering for zhihu.com
- Test empty array handling
- Test malformed JSON error handling
- Test file not found error handling
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move kb-deep-analyzer/deep_analyzer.py to kb_workflow/deep_analyzer/__init__.py
- Update analyze.py to import from kb_workflow.deep_analyzer directly
- Remove sys.path manipulation for external package
- DeepAnalyzer, SimpleAIClient, generate_frontmatter now available as:
from kb_workflow.deep_analyzer import DeepAnalyzer, SimpleAIClient, generate_frontmatter
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add one more .parent to reach correct directory level
- Fixed path: /home/.../kb-skills/kb-deep-analyzer (was /home/.../kb-skills/kb_workflow/kb-deep-analyzer)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract archive_file from pipeline results and include in response
- Allows callers to get the final archive path instead of only content_dir
- Fixes report display issue where content directory showed working dir instead of archive location
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix download processor to return actual author name (e.g. "HOLA小测佬")
instead of B站用户ID (mid, e.g. "406636263")
- Add 5 test cases for author extraction logic
- Resolves report display issue where UP主名称 showed numeric ID
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Root cause: ~/.openclaw/skills/kb-workflow/kb_workflow.py used old
import paths (kb_pipeline.*) after v1.1 refactor renamed package to
kb_workflow.pipeline
Fix applied to external skill directory:
- Updated imports from kb_pipeline.* to kb_workflow.pipeline.*
- Fixed project_root path calculation
- Updated SKILL.md documentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove sys.path manipulation from test file
- Use standard package import from kb_workflow.metadata
- Test file now follows the same import pattern as production code
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Pipeline import from kb_workflow.pipeline.pipeline
- Add Pipeline to __all__ exports list
- Enables: from kb_workflow.pipeline import Pipeline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove top-level sys.path.insert for kb-deep-analyzer
- Add module-level flag _deep_analyzer_path_added for single execution
- Move sys.path manipulation inside _run_analysis method
- External dependency import now happens lazily at runtime
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unnecessary sys.path.insert for current directory
- Use relative import for zhihu_extractor
- Package imports work correctly without path manipulation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unnecessary sys.path.insert for current directory
- Use pure relative import for markdown_converter
- Package imports work correctly without path manipulation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unnecessary sys.path.insert for project root
- Update docstring to reference kb_workflow.pipeline
- Package imports work correctly without path manipulation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
9/9 core functions verified, but gaps found:
- 4 remaining sys.path manipulations
- Pipeline not exported at package level
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 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>
All code has been moved to kb_workflow.pipeline with updated imports.
278 tests pass (14 pre-existing mock-related failures unrelated to refactoring).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove sys.path manipulation from kb_workflow.py
- Update CLI imports to use kb_workflow.pipeline prefix
- Update all test file imports and patch paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Move all processor implementations (parse, download, asr, analyze, archive)
- Move all platform adapters (base, bilibili, zhihu)
- Update all internal imports to use kb_workflow.pipeline prefix
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>