Skip to content

feat(cli): add history command to show changes made to components#212

Open
dmcilvaney wants to merge 2 commits into
microsoft:mainfrom
dmcilvaney:damcilva/add_history_tool
Open

feat(cli): add history command to show changes made to components#212
dmcilvaney wants to merge 2 commits into
microsoft:mainfrom
dmcilvaney:damcilva/add_history_tool

Conversation

@dmcilvaney
Copy link
Copy Markdown
Contributor

If a single component is specified, the history command will show the full details of the changes made to that component, including commit details if '-O json' is used.

If a single component is specified, the history command will show the
full details of the changes made to that component, including
commit details if '-O json' is used.
Copilot AI review requested due to automatic review settings May 27, 2026 20:53
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

Adds a new azldev component history subcommand to report per-component change activity (TOML commit counts, customization items, and lock fingerprint-change history), with MCP tool exposure and scenario-level coverage.

Changes:

  • Introduces azldev component history command implementation, including JSON output shape and a single-component “card” view.
  • Adds git helper to count commits touching a specific file efficiently via git log.
  • Adds a scenario smoke test and updates the MCP server mode snapshot to include the new tool.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scenario/component_history_test.go New scenario smoke test for component history JSON output and filtering behavior.
scenario/snapshots/TestMCPServerMode_1.snap.json Snapshot updated to include the new MCP tool definition for component-history.
internal/utils/git/log.go New helper for fast per-file commit counting via git log.
internal/app/azldev/core/sources/synthistory.go Adds JSON tags for commit metadata structs used in history output.
internal/app/azldev/cmds/component/history.go New component history command, options, output types, and parallelized metric computation.
internal/app/azldev/cmds/component/component.go Wires the new history subcommand into the component command tree.

Comment on lines +55 to +66
// NewHistoryCmd constructs a [cobra.Command] for the "component history" CLI subcommand.
func NewHistoryCmd() *cobra.Command {
options := &HistoryOptions{
Since: "",
SharedTomlMode: sharedTomlModeShow,
}

cmd := &cobra.Command{
Use: "history",
Aliases: []string{"hist"},
Short: "Report per-component change activity and customization detail",
Long: `Report three independent change-activity signals per component:
Customizations: len(stub.customizationItems),
}

populateTomlMetrics(stub.component, ctx, tomlSharing, tomlCache, sharedMode, &result)
Comment on lines +162 to +163
// SharedToml is true when at least one other selected component has the
// same source-config-file path; the TomlCommits count is then coarse.
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.

2 participants