Skip to content

fix: alias pr update to pr edit#149

Merged
avivsinai merged 2 commits intoavivsinai:masterfrom
ekrako:fix-pr-update-alias
Apr 12, 2026
Merged

fix: alias pr update to pr edit#149
avivsinai merged 2 commits intoavivsinai:masterfrom
ekrako:fix-pr-update-alias

Conversation

@ekrako
Copy link
Copy Markdown
Contributor

@ekrako ekrako commented Apr 10, 2026

Summary

Add bkt pr update as an alias of bkt pr edit so agent and user command resolution can match the more intuitive verb. The motivation is to improve command resolving for agents and automation that may naturally choose update over edit for modifying an existing pull request.

Changes

  • Added the update Cobra alias to the pr edit command.
  • Added a focused command-resolution test covering both pr edit and pr update.
  • Regenerated the skills/bkt PR rule doc so the alias is reflected in agent-facing help.

Testing

  • pre-commit run --files pkg/cmd/pr/pr.go pkg/cmd/pr/edit_alias_test.go skills/bkt/rules/pr.md
  • go test ./pkg/cmd/pr

Risks

  • None.

@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ekrako ekrako marked this pull request as ready for review April 10, 2026 13:58
Copy link
Copy Markdown
Owner

@avivsinai avivsinai left a comment

Choose a reason for hiding this comment

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

One present blocker plus a few optional nits.

Blocker: skills/bkt/rules/pr.md on this branch head is already drifted from fresh generator output. Running go run ./cmd/docgen -o skills/bkt/rules on a clean checkout adds a trailing newline at EOF — committed is 1368 lines, regenerated is 1369. This isn't a future hazard; the generated artifact on the branch is stale right now. (PR #148's staleness gate will start catching this automatically once it lands, but the drift exists today.) Fix: run make generate-skill from a clean tree and commit the result without any post-processing that strips EOF whitespace — some formatters and pre-commit hooks do.

Everything else looks good:

  • Alias is on the leaf newEditCmd, so bkt pr update <id> --title ... inherits all flags and examples for free with zero duplication.
  • edit_alias_test.go drives root.NewCmdRoot(factory) + runCLI, so it exercises Cobra's real alias resolution through the root command — right level.
  • No subcommand collision: audited all 19 newXxxCmd registrations in pkg/cmd/pr/pr.go, no existing update, no other alias using it.
  • The generator already handles Aliases rendering (internal/docgen/generate.go:313-316), so the docs change flowed through codegen rather than being hand-edited.

Non-blocking:

  • Consider mentioning the alias in newEditCmd.Long, e.g. "Edit a pull request's title, description, and/or reviewers. Also available as 'pr update'." — carries context into the generated rules prose, not just the **Alias:** line.
  • edit_alias_test.go could additionally assert stdout byte-equality between pr edit --help and pr update --help to catch a future refactor that accidentally repoints update at a different command with the same flag shape.
  • If agent intuition is the motivator, a follow-up sweep for other verbs (closedecline, replycomment) would be consistent.

@ekrako ekrako force-pushed the fix-pr-update-alias branch from 305e7d5 to 4851115 Compare April 12, 2026 09:07
@ekrako
Copy link
Copy Markdown
Contributor Author

ekrako commented Apr 12, 2026

All addressed:

  • Blocker: Ran make generate-skill and committed the regenerated output (trailing newline at EOF).
  • Long description: Added "Also available as 'pr update'." to newEditCmd.Long; regenerated skill docs.
  • Help equality test: Added a subtest asserting pr edit --help and pr update --help produce identical output.
  • Verb sweep: Good idea — will track as a follow-up.

Copy link
Copy Markdown
Owner

@avivsinai avivsinai left a comment

Choose a reason for hiding this comment

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

Reviewed the updated diff.

The alias wiring on pr edit looks correct, the generated docs were refreshed, and the tests now cover canonical help, alias help, and output equality. I did not find actionable issues in the current patch.

@avivsinai avivsinai merged commit 8da820f into avivsinai:master Apr 12, 2026
7 checks passed
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