Skip to content

Rename generic utility files in pkg/cli to reflect their specific purpose#3627

Merged
pelikhan merged 3 commits into
mainfrom
copilot/rename-utility-files-cli
Nov 11, 2025
Merged

Rename generic utility files in pkg/cli to reflect their specific purpose#3627
pelikhan merged 3 commits into
mainfrom
copilot/rename-utility-files-cli

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 11, 2025

Three utility files in pkg/cli had generic names that didn't reflect their actual functionality, reducing code discoverability. This refactors them to use descriptive names matching their purpose.

Changes

File Renames

  • shared_utils.gopr_automerge.go - PR auto-merge and workflow completion logic
  • frontmatter_utils.gofrontmatter_editor.go - Frontmatter field update operations
  • repeat_utils.goretry.go - Retry/repeat execution with signal handling

Logger Updates

  • Updated logger names to match new file names:
    • sharedUtilsLogprAutomergeLog ("cli:pr_automerge")
    • frontmatterUtilsLogfrontmatterEditorLog ("cli:frontmatter_editor")

Impact

No breaking changes - all files remain in the same package with identical public APIs. No import updates required in consuming code (trial_command.go, run_command.go, add_command.go, update_command.go).

Addresses Priority 1 refactoring from #3604.

Original prompt

This section details on the original issue you should resolve

<issue_title>[task] Rename utility files in pkg/cli to match their specific purpose</issue_title>
<issue_description>## Objective
Rename small utility files in pkg/cli to accurately reflect their specific purpose, improving code discoverability and maintainability.

Context

This addresses Priority 1: High Impact, Low Risk refactoring identified in #3604. Three utility files have generic names that don't match their actual content:

Files to Rename

1. shared_utils.go (3 functions - all PR auto-merge related)

Current name: Generic "shared_utils"
Actual purpose: PR auto-merge functionality
Recommended action:

  • Option A: Rename to pr_merge_utils.go or pr_automerge.go
  • Option B: Move functions into pr_command.go since they're PR-specific

2. frontmatter_utils.go (3 functions - frontmatter field updates)

Current name: Generic "frontmatter_utils"
Actual purpose: Frontmatter field editing
Recommended action:

  • Option A: Rename to frontmatter_editor.go or frontmatter_update.go
  • Option B: Inline into files that use it (if limited usage)

3. repeat_utils.go (2 functions - retry logic)

Current name: Generic "repeat_utils"
Actual purpose: Retry/backoff functionality
Recommended action:

  • Option A: Rename to retry.go
  • Option B: Move to a general utilities package if used widely

Approach

  1. Analyze usage: Determine how many files import each utility
  2. Choose strategy: Rename vs. consolidate vs. move based on usage
  3. Make changes: Rename files or move functions as appropriate
  4. Update imports: Fix all import statements across the codebase
  5. Verify: Ensure all tests pass and no broken imports

Files to Modify

  • pkg/cli/shared_utils.go → rename or consolidate
  • pkg/cli/frontmatter_utils.go → rename or consolidate
  • pkg/cli/repeat_utils.go → rename or consolidate
  • All files importing these utilities (update import paths)

Acceptance Criteria

  • All utility files have clear, descriptive names matching their purpose
  • File names accurately reflect the contained functionality
  • All imports updated correctly across the codebase
  • All tests pass (make test-unit)
  • No broken imports or references
  • Code formatted (make fmt)

Estimated Effort

1-2 hours

Related

Part of refactoring work identified in #3604
Related to #3604

AI generated by Plan Command for #3604</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits November 11, 2025 15:52
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Rename shared_utils.go → pr_automerge.go (PR auto-merge functionality)
- Rename frontmatter_utils.go → frontmatter_editor.go (frontmatter field editing)
- Rename repeat_utils.go → retry.go (retry/repeat execution logic)
- Update logger names to match new file names
- All tests pass

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Rename utility files in pkg/cli for clarity Rename generic utility files in pkg/cli to reflect their specific purpose Nov 11, 2025
Copilot AI requested a review from pelikhan November 11, 2025 16:03
@pelikhan pelikhan marked this pull request as ready for review November 11, 2025 16:33
Copilot AI review requested due to automatic review settings November 11, 2025 16:33
Copy link
Copy Markdown
Contributor

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

This PR improves code discoverability by renaming three utility files in pkg/cli to have more descriptive names that reflect their actual functionality. The renaming follows established best practices from the project's coding guidelines by avoiding generic names like "utils" in favor of specific, purpose-driven filenames.

Key Changes:

  • Renamed utility files to better reflect their purpose
  • Updated logger variable names to match new file names
  • Updated Claude Code CLI version from 2.0.35 to 2.0.37 across multiple workflow lock files

Reviewed Changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

File Description
pkg/cli/retry.go Renamed from repeat_utils.go - provides retry/repeat execution with signal handling
pkg/cli/pr_automerge.go Renamed from shared_utils.go - contains PR auto-merge and workflow completion logic
pkg/cli/frontmatter_editor.go Renamed from frontmatter_utils.go - handles frontmatter field update operations
.github/workflows/*.lock.yml (11 files) Updated Claude Code CLI version to 2.0.37

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pelikhan pelikhan merged commit 6d0b1df into main Nov 11, 2025
76 of 80 checks passed
@pelikhan pelikhan deleted the copilot/rename-utility-files-cli branch November 11, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[task] Rename utility files in pkg/cli to match their specific purpose

3 participants