feat(init): make --codespaces optional-value; grant discussions/issues write#46849
Merged
Conversation
…r issues/discussions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
feat: update init --codespaces to not require a value; grant write for issues/discussions
feat(init): make --codespaces optional-value; grant discussions/issues write
Jul 20, 2026
Copilot created this pull request from a session on behalf of
pelikhan
July 20, 2026 13:37
View session
pelikhan
marked this pull request as ready for review
July 20, 2026 14:00
Contributor
There was a problem hiding this comment.
Pull request overview
Makes gh aw init --codespaces value-optional and expands current-repository Codespaces permissions.
Changes:
- Adds optional-value handling and updated help examples.
- Grants write access to discussions and issues.
- Adjusts flag metadata and example validation tests.
Show a summary per file
| File | Description |
|---|---|
pkg/cli/init_command.go |
Configures and documents optional Codespaces values. |
pkg/cli/init_command_test.go |
Updates flag metadata assertions. |
pkg/cli/devcontainer.go |
Grants discussions/issues write permissions. |
cmd/gh-aw/help_examples_test.go |
Accepts flags with NoOptDefVal in examples. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Medium
| // pflag treats NoOptDefVal="" as "flag requires a value", so we use a single space as | ||
| // the no-value sentinel. The existing strings.TrimSpace call in RunE normalises it to "" | ||
| // (current repo only), while still distinguishing flag-present from flag-absent via Changed. | ||
| cmd.Flags().Lookup("codespaces").NoOptDefVal = " " |
Comment on lines
+104
to
+106
| // Verify NoOptDefVal is set so --codespaces can be used without a value | ||
| if codespaceFlag.NoOptDefVal == "" { | ||
| t.Errorf("Expected codespaces flag NoOptDefVal to be non-empty (optional value), got %q", codespaceFlag.NoOptDefVal) |
Comment on lines
+232
to
+233
| "discussions": "write", | ||
| "issues": "write", |
Collaborator
|
@copilot run pr-finishser skill |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Ran the PR finisher pass and pushed 2eff522. The review feedback is addressed locally; |
Contributor
|
🎉 This pull request is included in a new release. Release: |
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.
--codespacesrequired an explicit value (--codespaces ""for current repo), and the devcontainer permissions fordiscussionsandissueswere read-only on the current repo.Changes
pkg/cli/init_command.goNoOptDefVal = " "on--codespacesso the flag is usable without a value. pflag treatsNoOptDefVal = ""as "requires value", so a space sentinel is used — the existingstrings.TrimSpaceinRunEcollapses it to""transparently.Longdescription and examples:pkg/cli/devcontainer.gobuildRepositoryPermissions:discussionsandissuesfor the current repo changed from"read"→"write".pkg/cli/init_command_test.goNoOptDefValand usage-text assertions to match new flag behaviour.cmd/gh-aw/help_examples_test.govalidateExampleTokens: allow optional-value flags (NoOptDefVal != "") without a value in examples, consistent with existing bool-flag handling.