Skip to content

Comments

docs: Add migrate_filenames module to library reference#17

Merged
zircote merged 2 commits intomainfrom
docs/add-migrate-filenames-docs-3c267d862bd7cdf5
Feb 16, 2026
Merged

docs: Add migrate_filenames module to library reference#17
zircote merged 2 commits intomainfrom
docs/add-migrate-filenames-docs-3c267d862bd7cdf5

Conversation

@github-actions
Copy link
Contributor

Summary

Adds comprehensive documentation for the lib/migrate_filenames.py module to the library reference guide.

Changes

  • ✅ Document migrate_all(), migrate_file(), is_migration_complete(), mark_migration_complete() functions
  • ✅ Add migration behavior explanation (rename/merge/idempotent execution)
  • ✅ Include practical examples for bulk migration workflows
  • ✅ Update table of contents to include migrate_filenames
  • ✅ Update module index table
  • ✅ Add import cheat sheet entry for migration functions

Documentation Gap Addressed

The lib/migrate_filenames.py module was the only library module without documentation in the library reference guide. This PR completes the library documentation coverage.

Diátaxis Framework

This documentation follows the Technical Reference pattern:

  • Information-oriented
  • Precise function signatures and parameters
  • Clear return types and behavior
  • Practical examples for common use cases

Testing

  • Verified all documented functions exist in implementation
  • Checked function signatures match actual code
  • Validated examples are syntactically correct
  • Cross-referenced with existing documentation structure

Related

  • Completes library documentation started in #89c02b2
  • Maintains consistency with existing module documentation style
  • Follows Google Developer Style Guide principles

AI generated by Update Docs

- Document migrate_all, migrate_file, is_migration_complete functions
- Add migration behavior explanation (rename/merge/idempotent)
- Include practical examples for bulk migration workflows
- Update table of contents and module index
- Add import cheat sheet entry

Addresses documentation gap: lib/migrate_filenames.py was undocumented

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot added automation documentation Improvements or additions to documentation labels Feb 16, 2026
@zircote zircote marked this pull request as ready for review February 16, 2026 23:34
Copilot AI review requested due to automatic review settings February 16, 2026 23:34
@zircote zircote merged commit b05782a into main Feb 16, 2026
7 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing technical-reference documentation for lib/migrate_filenames.py to the library reference, expanding coverage of the lib/ module set.

Changes:

  • Adds a new migrate_filenames section with function signatures, behavior notes, and examples.
  • Updates the table of contents and module index to include migrate_filenames.
  • Adds migration imports to the “Import Cheat Sheet”.

When target file exists, merges content by:
1. Keeping existing frontmatter (preserves original ID, dates)
2. Appending incoming body under separator
3. Adding provenance note with incoming UUID
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collision handling says the provenance note includes the incoming UUID, but the implementation’s provenance note is based on the incoming frontmatter id: (and doesn’t use the filename UUID). Please update this section to reflect what is actually recorded.

Suggested change
3. Adding provenance note with incoming UUID
3. Adding provenance note with incoming frontmatter `id`

Copilot uses AI. Check for mistakes.
print(f"Migration complete:")
print(f" Renamed: {summary['renamed']} files")
print(f" Merged: {summary['merged']} files")
print(f" Skipped: {summary['skipped']} files")
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bulk migration example prints a “Skipped” count, but migrate_all() only processes UUID-prefixed files (should_migrate() filter), so results from migrate_all() will never include the "skipped" action (it’s only returned by migrate_file() when called on a non-UUID file). Consider removing/adjusting the skipped count in this example or clarifying when "skipped" can occur.

Suggested change
print(f" Skipped: {summary['skipped']} files")

Copilot uses AI. Check for mistakes.
Comment on lines +242 to +249
from lib.migrate_filenames import migrate_all, migration_summary
from pathlib import Path

memory_root = Path("~/.claude/mnemonic").expanduser()

# Execute with logging
results = migrate_all(memory_root, dry_run=False)
summary = migration_summary(results)
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migration_summary() is used in the bulk migration example, but it isn’t included anywhere in the API reference for migrate_filenames. Either document migration_summary(results: list[MigrationResult]) -> dict alongside the other functions or avoid using it in the example to keep the section self-contained.

Copilot uses AI. Check for mistakes.
- Git-aware (uses `git mv` when possible)
- Collision-safe (merges rather than overwrites)
- Idempotent by default (marker file prevents re-runs)
- CLI support: `python -m lib.migrate_filenames --dry-run`
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI note suggests running python -m lib.migrate_filenames --dry-run but the module’s __main__ currently hardcodes the root to Path.home() / ".claude" / "mnemonic" (and also supports --force). Consider documenting the hardcoded root and/or mentioning --force so readers understand the CLI’s limitations and available flags.

Suggested change
- CLI support: `python -m lib.migrate_filenames --dry-run`
- CLI support (operates on `~/.claude/mnemonic`): `python -m lib.migrate_filenames --dry-run` (add `--force` to bypass the idempotency marker)

Copilot uses AI. Check for mistakes.
Comment on lines +170 to +173
from pathlib import Path

# Check if migration already completed
memory_root = Path.home() / ".claude" / "mnemonic"
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The examples hardcode memory_root = Path.home() / ".claude" / "mnemonic", but this repo’s canonical way to locate the memory root is lib.config.get_memory_root() (supports user-configured memory_store_path). Consider updating the examples to use get_memory_root() to avoid documenting a potentially incorrect path for users with custom configs.

Suggested change
from pathlib import Path
# Check if migration already completed
memory_root = Path.home() / ".claude" / "mnemonic"
from lib.config import get_memory_root
# Check if migration already completed
memory_root = get_memory_root()

Copilot uses AI. Check for mistakes.
````

**Migration Behavior**:
- **Rename**: `{uuid}-decision.memory.md` → `decision.memory.md` (preserves git history)
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration behavior bullet says rename “preserves git history”, but the implementation only attempts git mv and falls back to Path.rename() when git mv fails. Please qualify this claim to match the actual behavior.

Suggested change
- **Rename**: `{uuid}-decision.memory.md``decision.memory.md` (preserves git history)
- **Rename**: `{uuid}-decision.memory.md``decision.memory.md` (attempts to preserve git history via `git mv` when available)

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant