Commit Graph

236 Commits

Author SHA1 Message Date
starmen1265 d1497ca550 feat(05-02): integrate ArchiveProcessor into Pipeline
- Add ArchiveInput creation in Pipeline.run()
- Import ArchiveInput in pipeline.py
- Add archive_file and skipped to output field recording
- Add ArchiveProcessor to CLI processors list
- Update PipelineConfig steps to include archive
2026-03-16 23:19:23 +08:00
starmen1265 63dd88279c feat(05-02): implement ArchiveProcessor
- Create ArchiveProcessor with STEP_NAME = archive
- Implement process() method with idempotent execution
- Add _find_existing_archive() for duplicate detection
- Add _ask_overwrite() using rich.prompt with fallback
- Only copy md files (not json) to archive directory
- Export ArchiveProcessor in __init__.py
2026-03-16 23:18:24 +08:00
starmen1265 9c74f51b43 feat(05-02): add ArchiveInput and ArchiveOutput schemas
- Add ArchiveInput with content_dir, analysis_file, content_type fields
- Add ArchiveOutput with archive_file, skipped, platform fields
- Update PipelineConfig default steps to include archive step
2026-03-16 23:17:29 +08:00
starmen1265 129a6311f4 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>
2026-03-16 23:16:09 +08:00
starmen1265 7f9caa32d2 feat(05-01): update CLI to use configurable intermediate directory default
- Import get_settings at top of process_command
- Change default output_dir from cwd to settings.intermediate_path
- Update docstring to document default behavior
- Users can still override with -o flag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 23:13:38 +08:00
starmen1265 10f4dfa22e feat(05-01): update Pipeline to use configurable intermediate directory
- Change default output_dir from cwd to settings.intermediate_path
- Reorder settings initialization before output_dir assignment
- Maintain output_dir parameter for testing/custom override

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 23:13:04 +08:00
starmen1265 c5b2c66bc7 feat(05-01): add KB_INTERMEDIATE_PATH config to KBSettings
- Add intermediate_path field with default ~/work/intermediate/analysis/
- Follow pydantic-settings naming convention for env var override
- Users can customize via KB_INTERMEDIATE_PATH environment variable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 23:12:36 +08:00
starmen1265 18bfb8886d docs(05): add INT-03 to Phase 5 requirements
- Update ROADMAP.md to include INT-03 (configurable intermediate path)
- Update 05-01 plan description to reflect INT-03 coverage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 23:10:50 +08:00
starmen1265 ae69878b59 fix(05): revise plan to include KB_INTERMEDIATE_PATH config support
- Add INT-03 requirement to 05-01-PLAN.md requirements field
- Add Task 1 for KB_INTERMEDIATE_PATH config in KBSettings
- Update Task 2 and Task 3 to use configurable path instead of hardcoded
- Update 05-CONTEXT.md to reflect new decision (config support vs hardcoded)

Addresses checker issue: requirement_coverage for INT-03

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 23:08:27 +08:00
starmen1265 a11a2dde99 docs(05): create phase 5 plans for archive and directory optimization 2026-03-16 23:03:14 +08:00
starmen1265 c92ace8e2d docs(state): record phase 5 context session 2026-03-16 22:54:58 +08:00
starmen1265 2eff597c3b docs(05): capture phase context 2026-03-16 22:54:52 +08:00
starmen1265 0bc5bb7584 docs: create milestone v1.1 roadmap (2 phases) 2026-03-16 21:06:43 +08:00
starmen1265 90b5ec2a27 docs: define milestone v1.1 requirements 2026-03-16 20:58:59 +08:00
starmen1265 643acbf165 docs: start milestone v1.1 Architecture Refactor 2026-03-16 20:54:53 +08:00
starmen1265 f358c52578 fix(zhihu): 修复文章归档格式问题
PR Test / lint (pull_request) Successful in 1s
1. author 字段清理零宽度空格和换行符,修复 Obsidian 解析
2. 扩展 content_type 条件,answer/zhuanlan 使用文章模板
3. 读取 content.md 时去除 YAML frontmatter
4. generate_frontmatter 正确推断 platform 为 zhihu

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 18:19:42 +08:00
starmen1265 e288a16944 docs: resolve debug zhihu-article-images-missing 2026-03-16 17:49:31 +08:00
starmen1265 84e9ada055 restore: 恢复误删的技能目录并修复导入方式
PR Test / lint (pull_request) Successful in 1s
- 恢复 kb-zhihu-metadata, kb-bilibili-metadata, kb-deep-analyzer
- 修改 zhihu.py 和 analyze.py 使用 sys.path 方式导入
- 删除符号链接 kb_zhihu_metadata

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 17:27:48 +08:00
starmen1265 ae8f6080c9 删除就技能
PR Test / lint (pull_request) Successful in 2s
2026-03-16 16:55:21 +08:00
starmen1265 f98d649b5c docs: resolve debug kb-workflow-legacy-code-removal
PR Test / lint (pull_request) Successful in 1s
2026-03-16 15:27:57 +08:00
starmen1265 0f0011b4a6 refactor(kb-workflow): remove legacy code - use kb_pipeline only
Root cause: kb_workflow.py contained 312 lines of deprecated legacy
code that was confusing AI agents. The legacy functions have been
completely replaced by the kb_pipeline package.

Changes:
- Removed all legacy functions (is_video_content, check_duplicate, etc.)
- Kept only process_command() and main() entry points
- Updated SKILL.md to remove old command examples
- File reduced from 495 to 143 lines (71% reduction)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 15:27:31 +08:00
starmen1265 f05c93d2b1 fix(zhihu): remove noscript tags to prevent duplicate images
PR Test / lint (pull_request) Successful in 1s
Zhihu HTML structure includes noscript fallback images:
<figure><img data-actualsrc=...><noscript><img src=...></noscript></figure>

After fixing lazy-load (replacing src with data-actualsrc), both imgs
have real URLs, causing duplicates. The fix removes noscript tags before
processing img elements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 15:08:08 +08:00
starmen1265 c8cdcb4631 fix(bilibili): correct metadata and filename in archive
PR Test / lint (pull_request) Successful in 1s
- Add _normalize_metadata() to flatten nested metadata structure
- Fix generate_frontmatter() to use correct metadata fields
- Change _sanitize_filename() to return standardized "bilibili_{bvid}" format

Fixes: analysis.md frontmatter showing "未命名"/0/"未知" instead of actual values
Fixes: audio filename using video title instead of platform_bvid format

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 13:48:28 +08:00
starmen1265 30552f2e5c refactor: remove deprecated kb-xxx sub-skills
PR Test / lint (pull_request) Successful in 2s
Remove sub-skills that have been replaced by kb_pipeline:
- kb-link-parser -> kb_pipeline/link_parser.py
- kb-whisper -> kb_pipeline/processors/asr.py
- kb-whisper-diarization -> kb_pipeline/processors/asr.py
- kb-bilibili-content -> BilibiliAdapter.download_video()
- kb-zhihu-content -> ZhihuAdapter.fetch_content()
- kb-ocr-processor -> unused
- kb-funasr -> unused (ASR uses Whisper)

Retained skills (still used by kb_pipeline):
- kb-bilibili-metadata
- kb-deep-analyzer
- kb-zhihu-metadata

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 12:03:57 +08:00
starmen1265 ca57a2f901 chore: update pycache
PR Test / lint (pull_request) Successful in 2s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:24:55 +08:00
starmen1265 1239fed9a9 docs(debug): mark bilibili subtitle debug session as resolved
All fixes verified working:
- Video download for videos without official subtitles
- Whisper transcription with correct offset parsing
- Text extraction from Whisper JSON format
- End-to-end analysis with real video content

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:24:21 +08:00
starmen1265 dd9d4cdf90 fix(analyze): extract text from Whisper JSON format
- Handle Whisper transcription format (array of segments with text)
- Extract full text from transcription array before passing to DeepAnalyzer
- Fix offsets parsing to support both dict and list formats

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:20:25 +08:00
starmen1265 153e6dfeba chore: add generated files and directories
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:09:16 +08:00
starmen1265 c7cdd49f01 chore: add debug session and init file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:09:16 +08:00
starmen1265 0b215dabe7 feat(download): add video download capability for videos without official subtitles
- Add download_video() to BilibiliAdapter using yt-dlp
- Add bilibili_cookie config to Settings
- Update DownloadProcessor to call video download for bilibili videos
- Add idempotency check to ASRProcessor for existing subtitle files
- Fix indentation error in asr.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:09:16 +08:00
starmen1265 07a9db85f7 feat(download): add video download capability for videos without official subtitles
- When content_type is video and no official subtitle available:
  - Download video using yt-dlp
  - Extract audio for Whisper fallback
- Update content_file with actual video path

This enables the pipeline to handle videos that don't have
official Bilibili subtitles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:09:16 +08:00
starmen1265 60b0eaec93 feat(download): add video download capability for videos without official subtitles
- When content_type is video and no official subtitle available:
  - Download video using yt-dlp
  - Extract audio for Whisper fallback
- Update content_file with actual video path

This enables the pipeline to handle videos that don't have
official Bilibili subtitles.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:04:56 +08:00
starmen1265 729f4650d5 fix(pipeline): populate results for skipped steps and support old file naming
- When a step is skipped (already completed), ask user if they want to re-run
- If skipping, scan content_dir for existing files and populate results
- Support both new naming (platform_id_subtitle.json) and old naming (platform_id.json)
- This fixes the issue where analyze step couldn't find subtitle files
  when ASR step was skipped

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:49:34 +08:00
starmen1265 f24841996a fix(analyze): include original text for zhihu answer/zhuanlan types
知乎回答(answer)和专栏(zhuanlan)的原文没有被追加到分析报告中。
代码只在 content_type == "article" 时设置和追加原文。

修复:
- deep_analyzer.py: 扩展条件支持 answer, zhuanlan 类型
- analyze.py: 同步扩展原文追加条件

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 23:41:42 +08:00
starmen1265 8ad64a4d1b fix(asr): use content_dir for subtitle output instead of video_path
PR Test / lint (pull_request) Successful in 2s
- Add content_dir field to ASRInput schema
- Pass content_dir from pipeline when creating ASRInput
- Modify _try_official_subtitle to use content_dir for output
- Modify _run_whisper_basic to use content_dir for output
- Add validation for empty video_path in Whisper fallback

Root cause: DownloadProcessor sets content_file="" for video types,
causing Path("").parent to resolve to current directory instead of
content directory. Subtitle files were written to wrong location.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 22:59:24 +08:00
starmen1265 b6ff7c81aa fix(zhihu): handle lazy-load images in markdown conversion
知乎使用图片懒加载机制,`<img>` 标签的 `src` 属性包含 SVG 占位符,
真实图片 URL 在 `data-actualsrc` 或 `data-original` 属性中。
`markdownify` 只读取 `src`,导致转换后得到无效占位符。

修复:在转换前预处理 HTML,将真实图片 URL 替换到 `src` 属性。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 22:59:24 +08:00
starmen1265 aae4d2fd70 docs(debug): resolve asyncio nested loop debug session
Root cause: BilibiliExtractor sync wrappers use asyncio.run() internally,
which fails when called from async context in BilibiliAdapter.

Fix: Call async methods directly instead of sync wrappers.

Verified: Human confirmed fix works (bilibili_BV16cNMzpExh)
2026-03-15 22:59:24 +08:00
starmen1265 47c4ee39c1 Merge branch 'main' into fix/ci-deploy-reset
PR Test / lint (pull_request) Successful in 2s
2026-03-15 18:17:51 +08:00
starmen1265 5d06056b43 fix(download): handle formatted duration strings in metadata
PR Test / lint (pull_request) Successful in 1s
Parse duration strings like "12:34" or "01:23:45" into seconds.
Previously only integer duration values were handled.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 18:17:03 +08:00
starmen1265 368e946cd1 fix(bilibili): avoid nested asyncio.run() in async context
BilibiliAdapter._fetch_metadata_with_retry() now calls the underlying
async methods directly instead of sync wrappers that use asyncio.run().
This prevents "asyncio.run() cannot be called from a running event loop"
error when the adapter is called from within an already-running event loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 18:17:03 +08:00
starmen1265 264dbe1cde Merge pull request 'fix/ci-deploy-reset' (#9) from fix/ci-deploy-reset into main
Deploy kb-skills / deploy (push) Successful in 2s
Reviewed-on: http://192.168.1.22:8418/starmen1265/kb-skills/pulls/9
2026-03-15 01:05:13 +08:00
starmen1265 f7569af007 Merge branch 'main' into fix/ci-deploy-reset
PR Test / lint (pull_request) Successful in 1s
2026-03-15 01:04:55 +08:00
starmen1265 6883a701c0 docs(kb-workflow): update SKILL.md for new pipeline architecture
PR Test / lint (pull_request) Successful in 2s
- Simplify to single-command workflow: kb-workflow process <url>
- Document new CLI parameters and options
- Add architecture overview
- Remove deprecated multi-step manual process

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 01:03:18 +08:00
starmen1265 46f7feb146 chore: complete v1.0 milestone
- Archive ROADMAP and REQUIREMENTS to milestones/
- Delete original ROADMAP.md and REQUIREMENTS.md
- Update PROJECT.md with v1.0 validated requirements
- Update STATE.md for milestone complete status
- Update MILESTONES.md with key accomplishments
- Add VERIFICATION.md for phase 04

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 00:59:18 +08:00
starmen1265 7cf6ddd02f chore: complete v1.0 milestone 2026-03-15 00:59:12 +08:00
starmen1265 5736e2228e docs(04-05): complete CLI process subcommand and E2E tests plan
- CLI 'process' subcommand for single-command workflow execution
- End-to-end integration tests (16 tests passing)
- State persistence and resumability verified

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 00:10:10 +08:00
starmen1265 ec2d12a05b feat(04-05): implement Pipeline.run() method
- Add async run() method to Pipeline class
- Execute processors sequentially with state persistence
- Handle step-specific input types (Parse, Download, ASR, Analyze)
- Support skip_completed for resumable workflows
- Return PipelineOutput with results and content_dir

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:46:54 +08:00
starmen1265 377794b5b3 test(04-05): add end-to-end integration tests
- Test full workflow execution from URL to analysis
- Test workflow error handling
- Test state persistence
- Test workflow resumability (skip completed steps)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:46:46 +08:00
starmen1265 33eeb6bc34 feat(04-05): add CLI 'process' subcommand
- Add process_command function that executes full pipeline
- Add subparser for 'process' command with URL argument
- Add --output-dir and --skip-completed flags
- Add --no-skip flag to re-run all steps
- Maintain backward compatibility with legacy arguments

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:44:10 +08:00
starmen1265 76aefa23e1 test(04-05): add failing tests for CLI process subcommand
- Test process --help shows usage
- Test process <url> calls Pipeline.run()
- Test invalid URL returns error
- Test --output-dir flag
- Test --no-skip flag

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 23:43:06 +08:00