Files
renamer/AGENTS.md
Rogee 3867736858 feat: implement AI-assisted rename prompting feature
- Added data model for AI-assisted renaming including structures for prompts, responses, and policies.
- Created implementation plan detailing the integration of Google Genkit into the CLI for renaming tasks.
- Developed quickstart guide for setting up and using the new AI rename functionality.
- Documented research decisions regarding Genkit orchestration and prompt composition.
- Established tasks for phased implementation, including setup, foundational work, and user stories.
- Implemented contract tests to ensure AI rename policies and ledger metadata are correctly applied.
- Developed integration tests for validating AI rename flows, including preview, apply, and undo functionalities.
- Added tooling to pin Genkit dependency for consistent builds.
2025-11-03 18:08:14 +08:00

2.9 KiB

renamer Development Guidelines

Auto-generated from all feature plans. Last updated: 2025-10-29

Active Technologies

  • Local filesystem (no persistent database) (002-add-replace-command)
  • Go 1.24 + spf13/cobra, spf13/pflag (001-list-command-filters)
  • Local filesystem only (ledger persisted as .renamer) (003-add-remove-command)
  • Go 1.24 + spf13/cobra, spf13/pflag, internal traversal/ledger packages (004-extension-rename)
  • Local filesystem + .renamer ledger files (004-extension-rename)
  • Go 1.24 + spf13/cobra, spf13/pflag, internal traversal/history/output packages (005-add-insert-command)
  • Go 1.24 + spf13/cobra, spf13/pflag, Go regexp (RE2 engine), internal traversal/history/output packages (006-add-regex-command)
  • Local filesystem and .renamer ledger files (006-add-regex-command)
  • Go 1.24 (CLI), Node.js 20 + TypeScript (Google Genkit workflow) + spf13/cobra, internal traversal/history/output packages, Google Genkit SDK, OpenAI-compatible HTTP client for fallbacks (008-ai-rename-prompt)
  • Local filesystem plus .renamer append-only ledger (008-ai-rename-prompt)

Project Structure

cmd/
internal/
scripts/
tests/

Commands

  • renamer list — preview rename scope with shared flags before executing changes.
  • renamer replace — consolidate multiple literal patterns into a single replacement (supports --dry-run + --yes).
  • renamer remove — delete ordered substrings from filenames with empty-name protections, duplicate warnings, and undoable ledger entries.
  • renamer undo — revert the most recent rename/replace batch using ledger entries.
  • Persistent scope flags: --path, -r/--recursive, -d/--include-dirs, --hidden, --extensions, --yes, --dry-run.

Code Style

  • Go 1.24: follow gofmt (already checked in CI)
  • Prefer composable packages under internal/ for reusable logic
  • Keep CLI wiring thin; place business logic in services

Testing

  • go test ./...
  • Contract tests: tests/contract/replace_command_test.go, tests/contract/remove_command_preview_test.go, tests/contract/remove_command_ledger_test.go
  • Integration tests: tests/integration/replace_flow_test.go, tests/integration/remove_flow_test.go, tests/integration/remove_undo_test.go, tests/integration/remove_validation_test.go
  • Smoke: scripts/smoke-test-replace.sh, scripts/smoke-test-remove.sh

Recent Changes

  • 008-ai-rename-prompt: Added Go 1.24 (CLI), Node.js 20 + TypeScript (Google Genkit workflow) + spf13/cobra, internal traversal/history/output packages, Google Genkit SDK, OpenAI-compatible HTTP client for fallbacks
  • 001-sequence-numbering: Added Go 1.24 + spf13/cobra, spf13/pflag, internal traversal/history/output packages
  • 006-add-regex-command: Added Go 1.24 + spf13/cobra, spf13/pflag, Go regexp (RE2 engine), internal traversal/history/output packages