Skip to content

feat(init): make --codespaces optional-value; grant discussions/issues write#46849

Merged
pelikhan merged 3 commits into
mainfrom
copilot/update-init-command-codespaces-arg
Jul 20, 2026
Merged

feat(init): make --codespaces optional-value; grant discussions/issues write#46849
pelikhan merged 3 commits into
mainfrom
copilot/update-init-command-codespaces-arg

Conversation

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

--codespaces required an explicit value (--codespaces "" for current repo), and the devcontainer permissions for discussions and issues were read-only on the current repo.

Changes

pkg/cli/init_command.go

  • Set NoOptDefVal = " " on --codespaces so the flag is usable without a value. pflag treats NoOptDefVal = "" as "requires value", so a space sentinel is used — the existing strings.TrimSpace in RunE collapses it to "" transparently.
  • Updated Long description and examples:
# Before — required explicit empty string
gh aw init --codespaces ""

# After — value is optional
gh aw init --codespaces              # current repo only
gh aw init --codespaces repo1,repo2  # current + additional repos

pkg/cli/devcontainer.go

  • buildRepositoryPermissions: discussions and issues for the current repo changed from "read""write".

pkg/cli/init_command_test.go

  • Updated NoOptDefVal and usage-text assertions to match new flag behaviour.

cmd/gh-aw/help_examples_test.go

  • validateExampleTokens: allow optional-value flags (NoOptDefVal != "") without a value in examples, consistent with existing bool-flag handling.

…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 AI requested a review from pelikhan July 20, 2026 13:37
@pelikhan
pelikhan marked this pull request as ready for review July 20, 2026 14:00
Copilot AI review requested due to automatic review settings July 20, 2026 14:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Comment thread pkg/cli/init_command.go
// 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 thread pkg/cli/devcontainer.go
Comment on lines +232 to +233
"discussions": "write",
"issues": "write",
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finishser skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finishser skill

Ran the PR finisher pass and pushed 2eff522. The review feedback is addressed locally; make fmt, make lint, make test-unit, make test, make recompile, make agent-report-progress, and final PR validation passed. CI on this new HEAD still needs a maintainer-triggered rerun before merge.

@pelikhan
pelikhan merged commit 3ceb8ec into main Jul 20, 2026
19 checks passed
@pelikhan
pelikhan deleted the copilot/update-init-command-codespaces-arg branch July 20, 2026 14:31
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.82.14

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.

3 participants