Commit Graph
29 Commits
Author SHA1 Message Date
6f0df5a774 release: v0.2.0 repository hygiene, CI, and docs sync
Stop tracking personal workflow artifacts at repo root, add CI and MIT
license, align README and agent skills with artifacts/ defaults, and
enable Ruff in dev/CI so releases are verifiable without local-only runs.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-01 15:32:03 +08:00
windyboyandCursor e70bd35498 docs: archive completed functional simplification plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 10:42:38 +08:00
79797644e1 chore: trim dead code, modularize CLI, and archive stale docs
Extract review-plan, report, quarantine, state, and config handlers into
commands/ with shared cli_helpers; remove unused exceptions and duplicate
plan summary wrappers. Archive superseded review markdown, sync docs to
517-test baseline, and fix empty series titles when only a quality tag remains.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 10:36:03 +08:00
windyboyandCursor 5f0b531269 Improve plan review UX with enriched rows, TUI filters, and execute gate.
Make review-plan easier to act on: Chinese risk labels, relative paths,
verdict/next-step footer, optional identity/analysis enrichment, grouping,
spot-check sampling, and structure preview. Extend the TUI with filters,
duplicate-group reject, and quality context. Persist review_context on
plan operations and add --require-review for confirmed execute.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 09:27:12 +08:00
windyboy c9d22d5136 docs sync post-refactor baseline 2026-04-07 11:07:01 +08:00
windyboy 0a6bddcc7e refactor review-plan safety and validation 2026-04-07 11:00:47 +08:00
windyboy fb128c70d6 commit remaining modified project files 2026-04-07 08:07:18 +08:00
windyboy d010cf936c update review report from verified technical review 2026-04-07 08:06:38 +08:00
windyboy ea21e15b3a improve review-plan preview output and docs 2026-04-02 11:31:49 +08:00
windyboy ace3229b62 add 2026-04-01 code analysis report 2026-04-01 17:50:38 +08:00
windyboy caa6881fd2 refactor default artifacts workspace and path compatibility 2026-02-16 13:23:01 +08:00
windyboy 2dd329cba9 refactor CLI command modules and synchronize docs 2026-02-16 12:31:26 +08:00
windyboy 0be802eac5 chore: snapshot current project updates 2026-02-13 13:36:39 +08:00
windyboy 5931f16a71 merge VLM skills into a single workflow expert skill 2026-02-13 12:01:10 +08:00
windyboyandClaude Sonnet 4.5 54416065fe Create structured exception hierarchy with exit codes
Implements comprehensive exception hierarchy for better error handling,
structured exit codes, and retry support for transient failures.

New file: src/vlm/exceptions.py

Exception Classes:
- VLMError (base, exit code 1)
  - VLMConfigError (exit code 2) - configuration errors
  - VLMFileSystemError (exit code 3) - file operations
  - VLMIOError (exit code 4) - data file I/O
  - VLMTransientError (exit code 1, retryable) - temporary failures
  - VLMValidationError (exit code 5) - data validation
  - VLMQuarantineError (exit code 6) - quarantine operations

Features:
- Structured exit codes for different error types
- is_retryable flag for transient errors
- Clear error messages with context
- Ready for future retry logic implementation

Usage Example:
```python
try:
    validate_config(config)
except VLMConfigError as e:
    sys.exit(e.exit_code)  # Exit with code 2
```

Future Work:
- Migrate existing ValueError/Exception usage to new hierarchy
- Implement retry logic for VLMTransientError
- Add exit code handling in CLI main()
- Add error context tracking

Testing:
- Module loads successfully
- Exit codes and flags verified
- All 449 tests still pass

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 09:55:24 +08:00
windyboyandClaude Sonnet 4.5 71e67ab65c Add schema versioning to all remaining data files
Adds vlm_schema_version field to all data file formats for schema
evolution and migration tracking. Task #1 already added versioning
to identities.json; this completes the remaining files.

Changes to scanner.py:
- Add "# vlm_schema_version: 1.0" as first comment line in inventory.csv

Changes to commands/analyze.py:
- Add "vlm_schema_version": "1.0" to analysis.json root

Changes to planner.py:
- Add "vlm_schema_version": "1.0" to plan.json root

Changes to executor.py:
- Add "vlm_schema_version": "1.0" to rollback log JSON

Schema versions:
- inventory.csv: 1.0 (in comment header)
- identities.json: 1.0 or 2.0 (set by parse command)
- analysis.json: 1.0
- plan.json: 1.0
- rollback_log.json: 1.0

Future migrations:
- Version field allows detecting old formats
- Can implement auto-migration logic
- Can warn users about version mismatches
- Enables schema evolution without breaking changes

Testing:
- All 449 tests pass
- No test changes needed (backward compatible)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 09:54:11 +08:00
windyboyandClaude Sonnet 4.5 e3069a287e Add path canonicalization to prevent symlink duplicates
Implements centralized path canonicalization to ensure symlinks and paths
with . or .. segments are resolved to their canonical form, preventing
false duplicate detection.

Changes to utils.py:
- Add canonical_path() function using Path.resolve()
- Add canonical_path_str() for dictionary key usage

Changes to models.py:
- Add __post_init__ to VideoFile to auto-canonicalize paths
- All VideoFile instances now have canonical paths automatically

Impact:
- Path-based dictionary lookups now work correctly with symlinks
- io.py: path_to_inventory dictionary uses canonical keys
- planner.py: path_to_index dictionary uses canonical keys
- analysis.py: Duplicate detection uses canonical paths
- No false duplicates from symlinks or relative paths

Testing:
- Added comprehensive tests for canonical_path functions
- Tests verify symlink resolution, absolute path conversion, .. removal
- All 449 tests pass (added 10 new tests)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 09:52:14 +08:00
windyboyandClaude Sonnet 4.5 d6c8852e1e Fix quarantine non-atomic operations with two-phase commit
Implements atomic quarantine/restore operations using two-phase commit
pattern to prevent orphaned files when manifest updates fail.

Changes to models.py:
- Add status field to QuarantineEntry ("pending" | "committed")
- Default to "committed" for backward compatibility

Changes to quarantine.py:
- Rewrite quarantine_file() with three phases:
  1. Write pending manifest entry BEFORE moving file
  2. Move file to quarantine
  3. Mark manifest entry as committed
- Rewrite restore_from_quarantine() with same pattern
- Add _recover_pending_entries() for auto-recovery on manifest load
- Update _load_manifest() and _save_manifest() to handle status field

Changes to executor.py:
- Add special handling for quarantine rollback using QuarantineManager
- Fix bug where executor didn't preserve quarantine destination_path
- Return QuarantineManager result directly (includes actual quarantine path)

Testing:
- Fixed pre-existing test_rollback_quarantine_operation
- All 439 tests now pass (was 438 with 1 failure)

Atomicity guarantees:
- If manifest write fails → operation fails, no file moved
- If file move fails → rollback removes pending manifest entry
- If commit fails → auto-recovery fixes on next load
- No orphaned files possible

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 09:50:29 +08:00
windyboyandClaude Sonnet 4.5 065195b83b Fix identity reconstruction metadata loss with v2 schema
Implements identities.json v2 schema with embedded video metadata to fix
duplicate resolution by quality, which previously failed due to VideoFile
objects being reconstructed with hardcoded defaults (size_bytes=0,
resolution=None, codec=None).

Changes:
- Add --inventory flag to vlm parse command to embed video metadata
- Update _video_file_from_record() to extract embedded metadata if present
- Add vlm_schema_version field to identities.json (v1.0 or v2.0)
- Maintain backward compatibility with v1 files (no metadata)

Schema v2 format:
- Embeds video_metadata object in each record (movies/series)
- Contains: size_bytes, modified_timestamp, resolution, codec,
  duration_seconds, bitrate_kbps
- Enables accurate quality comparison during duplicate analysis

Testing:
- Added comprehensive unit tests for io.py functions
- Added CLI integration tests for parse command
- Added end-to-end tests for duplicate quality comparison
- All 437 existing tests still pass (1 pre-existing failure in executor)

Documentation:
- Updated README.md with --inventory usage examples
- Updated CLAUDE.md with schema versioning details
- Added workflow examples showing metadata embedding

This fix resolves the critical P0 issue where duplicate resolution by_quality
strategy failed completely due to missing video metadata in reconstructed
VideoFile objects.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 09:44:51 +08:00
windyboy 1f55eab304 Implement duplicate resolution strategy by quality and enhance related documentation
- Updated `duplicate_resolve.py` to introduce a new strategy for keeping files based on quality, considering resolution, source, codec, and size.
- Enhanced `planner.py` to utilize the new quality-based strategy during plan generation, updating quarantine reasons accordingly.
- Modified `README.md` to document the new `plan.duplicate_keep` options, including `by_quality`, and provided detailed descriptions of each strategy.
- Added unit tests in `test_duplicate_resolve.py` to validate the new quality-based resolution logic.
- Updated `analysis.json` and `plan.json` with new timestamps and IDs to reflect recent changes.

These updates improve the Video Library Manager's ability to handle duplicate files more effectively, ensuring users retain the highest quality versions.
2026-02-11 08:44:48 +08:00
windyboy 79f5ddf1f5 Update analysis and plan files to enhance duplicate handling and reporting
- Updated `analysis.json` with a new generation timestamp.
- Modified `plan.json` to include a new plan ID and created timestamp, and changed operation types from "no-op" to "quarantine" for specific files needing manual review.
- Enhanced the README.md to document the new `--analysis` option for generating execution plans, which now includes a human-readable summary and duplicate handling strategies.
- Introduced a new `duplicate_resolve.py` module to manage duplicate file resolution strategies.
- Improved the execution engine to support quarantine operations and added rollback functionality for quarantined files.

These changes improve the functionality of the Video Library Manager by providing better duplicate management and clearer reporting capabilities.
2026-02-10 18:07:38 +08:00
windyboy dcd87754cf Enhance project structure and add new files for enrichment and analysis
- Updated AGENTS.md to reflect changes in CLI commands and module organization, including the addition of an enrichment step and new functional modules.
- Introduced analysis.json, identities.json, inventory.csv, and plan.json to support enriched metadata and execution planning.
- Added CODE_IMPROVEMENTS.md to document identified code issues and proposed solutions for future enhancements.
- Updated README.md to include new enrichment features and configuration options.
- Removed unused dependency on ffmpeg-python from pyproject.toml.

These changes improve the overall functionality and maintainability of the Video Library Manager project.
2026-02-10 16:56:17 +08:00
windyboy f0c951ad7f refactor enrichment to tmdb-only and fix review findings 2026-02-10 08:29:31 +08:00
windyboy 53aaeeaedf add scanner metadata cache reuse and control flags 2026-02-09 23:55:35 +08:00
windyboy 59a3b52fee add incremental enrich controls with progress and retry limits 2026-02-09 23:55:13 +08:00
windyboyandClaude Sonnet 4.5 259e7506d7 feat: add configurable category mappings for directory recognition
Allow users to configure multiple directory names per category (movie/series/anime) to support variations like "movies", "tv", "films". This enables proper categorization of files in directories that don't match the hardcoded singular forms, solving the issue where 635 files in "/mnt/Downloads/movies/" were incorrectly categorized as "other".

Configuration example:
  categories:
    movie: [movie, movies, films]
    series: [series, tv, shows]
    anime: [anime]

Changes include comprehensive validation, backward-compatible defaults, case-insensitive matching, and full test coverage (395 tests passing).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-09 22:40:48 +08:00
windyboy aa0dc8ec47 fix timezone handling and logging fallback robustness 2026-02-09 20:16:39 +08:00
windyboy 976a1fa1d0 docs: Add repository guidelines and code review report
- Add AGENTS.md with comprehensive repository guidelines covering project structure, build/test commands, coding style, testing practices, and commit conventions
- Add REVIEW_REPORT.md documenting code review findings including 4 actionable issues: logging permission errors, incorrect test imports, timezone conversion bugs, and dead error counter code
- Include detailed recommendations for fix prioritization and test evidence from pytest runs
- Provide reference documentation for future development and maintenance workflows
2026-02-09 17:55:34 +08:00
windyboy 1705275e99 Initial commit: Video Library Manager
- Add core VLM modules (scanner, parser, planner, executor, analysis)
- Add CLI with quarantine, reports, rollback, and state management
- Add comprehensive test suite
- Add project configuration and documentation
- Add .gitignore for Python project
2026-02-09 17:43:35 +08:00