feat(cli): add vault maintenance automation commands#20
Merged
Conversation
Implements vault maintenance automation from MAINTENANCE.md:
- of check-tags --fix --scope vault: scans PRIMARY docs for missing
layer/raw, type/{doc-type}, and project tags; auto-injects with --fix
- of check-links --fix: detects broken wikilinks, auto-fixes filename
mismatches (spaces<->hyphens) and .txt->.md extensions
- of normalize-frontmatter --dry-run: detects YAML malformations
(closing brace, broken list, empty tags, missing frontmatter)
- of graph orphans --exclude-seeded --min-importance N: filters seeded
paths and files below minimum character threshold
… naming - Extract shared EXCLUDED_DIRS, frontmatter_re(), doc_type_tag() into new vault_utils.rs module (was duplicated across 3 modules) - Fix fix_broken_yaml_list() which silently skipped instead of replacing bare tags: with tags: [] - Remove module-level #![allow(dead_code)] from check_links.rs - Change check-tags --scope from string to TagScope enum - Rename graph orphans --min-importance to --min-chars for clarity
- Unify normalize-frontmatter from --dry-run to --fix for CLI consistency - Add reverse index (BTreeMap) for O(1) wikilink target resolution - Eliminate double txt_stems linear search in check_links - Remove unused PRIMARY_FILES/SUPPLEMENTARY_DIRS constants - Track per-issue fixed status instead of batch marking all issues - Simplify orphans regex: [\s\S]*? → .*? with (?s) flag - Add frontmatter_re() regex safety comment
…p tests
- Replace trim_end_matches(".md") with strip_suffix(".md") to prevent
incorrect truncation (e.g. "README.md" → "READ")
- Add collision guard for .txt→.md rename when .md already exists
- Fix /seeded/ path matching to handle root-level and backslash paths
- Migrate check_links tests from manual temp dirs to tempfile::TempDir
- Fix collect_txt_stems doc comment (set → map)
- Add regression test for strip_suffix behavior
- Add stem collision warning in build_stem_index (check_links.rs) - Extract check_missing_tag and apply_tag_fixes helpers (check_tags.rs) - Decompose check_links into handle_extension_mismatch + handle_filename_mismatch - Replace BrokenLink.issue String with LinkIssue enum for type safety - Add fs::metadata pre-filter in detect_orphans before reading content
Owner
Author
PR 리뷰 피드백 반영 (commit 024b08a)PR 리뷰에서 지적된 이슈 1~5를 모두 수정했습니다.
검증: 131/131 테스트 통과, clippy clean, fmt clean |
- Extract check_and_fix_tags + apply_no_frontmatter_fixes in check_tags.rs, eliminating duplicated tag-check/fix-marking logic between scan_project_docs and scan_resource_docs (R2) - Extract check_file_links helper from check_links loop body, reducing check_links from 85 to 43 lines (R3)
- Guard fs::rename in handle_filename_mismatch with target existence check to prevent silent data loss - Unify scan_project_docs no-frontmatter handling with shared check_missing_tag + apply_no_frontmatter_fixes pattern - Replace info! with warn! on failure paths in check_links - Add test for rename content preservation - Add test for project doc no-frontmatter fix Co-Authored-By: Claude Opus 4.7 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements MAINTENANCE.md vault maintenance automation as 4 new CLI commands for obsidian-forge.
Spec
Changes
Acceptance Criteria Verified
Test Plan