Context
Closes part of #18481 — gh-aw in forks.
When users run gh aw init inside a forked repository, they receive the same instructions as a fresh install. There is no indication that they need to configure their own copies of all secrets (API keys, tokens), and no warning about features that are restricted in fork contexts.
Objective
Detect when gh aw init (and optionally gh aw compile) is run inside a forked repository and emit a clear warning listing which secrets need to be configured and which features have restrictions.
Approach
- In
pkg/cli/init_command.go (or equivalent), after determining the current repo context, add a call like gh repo view --json isFork to detect fork status.
- If the repo is a fork, print a
console.FormatWarningMessage(...) block that:
- States the repo is a fork
- Lists secrets that must be configured:
ANTHROPIC_API_KEY / OPENAI_API_KEY, GH_AW_GITHUB_TOKEN, GH_AW_COPILOT_TOKEN, GH_AW_GITHUB_MCP_SERVER_TOKEN
- Notes which features are limited (e.g.,
workflow_run cross-fork triggers are blocked by design)
- Optionally apply the same detection in
pkg/cli/compile_command.go with a lighter warning.
- Add unit tests for the fork-detection helper.
Files to Modify
pkg/cli/init_command.go — add fork detection + warning
pkg/cli/compile_command.go — optional lighter warning
pkg/cli/init_command_test.go — test fork detection path
Acceptance Criteria
Generated by Plan Command for issue #18481
Context
Closes part of #18481 — gh-aw in forks.
When users run
gh aw initinside a forked repository, they receive the same instructions as a fresh install. There is no indication that they need to configure their own copies of all secrets (API keys, tokens), and no warning about features that are restricted in fork contexts.Objective
Detect when
gh aw init(and optionallygh aw compile) is run inside a forked repository and emit a clear warning listing which secrets need to be configured and which features have restrictions.Approach
pkg/cli/init_command.go(or equivalent), after determining the current repo context, add a call likegh repo view --json isForkto detect fork status.console.FormatWarningMessage(...)block that:ANTHROPIC_API_KEY/OPENAI_API_KEY,GH_AW_GITHUB_TOKEN,GH_AW_COPILOT_TOKEN,GH_AW_GITHUB_MCP_SERVER_TOKENworkflow_runcross-fork triggers are blocked by design)pkg/cli/compile_command.gowith a lighter warning.Files to Modify
pkg/cli/init_command.go— add fork detection + warningpkg/cli/compile_command.go— optional lighter warningpkg/cli/init_command_test.go— test fork detection pathAcceptance Criteria
gh aw initdetects fork status viagh repo view --json isForkconsole.FormatWarningMessageRelated to Using gh-aw in forks of repositories #18481