feat(cli): add history command to show changes made to components#212
Open
dmcilvaney wants to merge 2 commits into
Open
feat(cli): add history command to show changes made to components#212dmcilvaney wants to merge 2 commits into
dmcilvaney wants to merge 2 commits into
Conversation
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.
Contributor
There was a problem hiding this comment.
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 historycommand 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. |
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.
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.