feat: add sloctl edit command - #460
Merged
Merged
Conversation
Adds an interactive `edit` command for modifying resources in an editor and applying validated changes. Also centralizes service aliases for get, delete, and edit commands.
Adds edit command scenarios for unchanged files, successful edits, editor failures, and invalid identity changes. Documents e2e fixture generation and debugging conventions.
Use SHELL when launching the editor and document editor and shell fallback behavior in the edit command help.
nobl9-adam-szymanski
approved these changes
May 5, 2026
nobl9-adam-szymanski
left a comment
There was a problem hiding this comment.
I played with this on macos and works like kubectl edit.
Adds guidance comments to edited files and treats empty or comment-only content as a cancel. This lets resource-type edits open selected objects and exit cleanly when unchanged.
Preserve validation failures in the edit buffer so users can correct and retry. Treat reverted edits as canceled and show cleaner API validation messages.
Reject multiple agent names before editing and after object lookup to enforce the single-Agent constraint and keep the command help text consistent.
Reuse object selection flags and query building across get and edit so edit supports labels, services, and budget adjustment SLO filters. Handle report and budget adjustment identities without project scoping to avoid edit lookup issues.
Reuse annotation selection parsing for both get and edit so edit annotations can filter by slo, time range, and category consistently with get behavior.
replace project-scoped type assertions with `v1alpha.GenericObject` access so edit validation works with the parser's generic object model. also add agent and development docs to capture the object-model caveat and repository workflow expectations.
Adapt project scoping checks to the updated `nobl9-go` APIs and use `v1alpha.GenericObject` only for objects whose kind is project-scoped. Also make edit selection mismatch errors clearer for project-scoped resources.
Route annotation lookups through `GetCmd` so `get` and `edit` share the same code path. Build annotation queries explicitly for the `/annotations` endpoint to preserve selection filters.
Convert annotation API responses into typed annotation objects before printing or editing. Include the project field in annotation selection so filtered edit/get commands target the expected review notes.
Align `edit_test` with string-based kind values and the new mismatched resource error. This keeps the test assertions consistent with current edit validation output.
nieomylnieja
force-pushed
the
add-sloctl-edit-command
branch
from
May 20, 2026 23:14
fc7d60d to
cfd9210
Compare
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.
Motivation
Sometimes you just wanna quickly edit something out in your SLOs, you already know
kubectl edit, this brings the exact same functionality to the table.Summary
In addition to the new command, it centralizes service aliases for get, delete, and edit commands.
Testing
SLOCTL_EDITORand injecting a script in place of an editor command that programatically modifies the fileRelease Notes
Added an interactive
sloctl editcommand for modifying resources in an editor and applying validated changes in one go.