Skip to content

feat(cli): make init always overwrite; --force bypasses GitHub remote guard#465

Merged
jamesadevine merged 3 commits intomainfrom
copilot/add-exception-case-for-ado-aw-init
May 8, 2026
Merged

feat(cli): make init always overwrite; --force bypasses GitHub remote guard#465
jamesadevine merged 3 commits intomainfrom
copilot/add-exception-case-for-ado-aw-init

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Summary

ado-aw init bails when the git origin is on GitHub, redirecting users to gh-aw. The only existing exception is the integration-test env var, so maintainers running the released binary inside a GitHub-hosted repo (e.g. githubnext/ado-aw itself, to recompile in-tree examples) hit the bail.

This PR makes two related changes to ado-aw init:

  • Always overwrite by default: init now unconditionally (re)writes .github/agents/ado-aw.agent.md so it stays in sync with the installed compiler version. The previous "already exists, use --force to overwrite" bail is removed.
  • --force repurposed for the GitHub-remote exception: the --force flag now only bypasses the GitHub-remote guard, allowing cargo r -- init --force to run inside githubnext/ado-aw (or other GitHub-hosted forks) without altering the default init codepath or the compile codepath.

Help text for --force and docs/cli.md are updated to reflect the new semantics.

Test plan

  • cargo build --bin ado-aw succeeds.
  • cargo test --test init_tests — 3/3 passing, including:
    • test_init_creates_agent_file (unchanged)
    • test_init_overwrites_by_default (new — verifies default init overwrites a tampered file without --force)
    • test_init_force_overwrites (verifies --force also overwrites)
  • Manual: cargo r -- init --force inside a GitHub-origin repo proceeds; cargo r -- init in the same repo still bails with the existing gh-aw message.

@jamesadevine
Copy link
Copy Markdown
Collaborator

@copilot Sorry, this is quite an invasive change. Can you make it so cargo r -- init --force works. WE should not actually modify the production codepath

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 8, 2026

@copilot Sorry, this is quite an invasive change. Can you make it so cargo r -- init --force works. WE should not actually modify the production codepath

Reverted the production-path change. ado-aw init --force now bypasses the GitHub-remote guard so cargo r -- init --force works inside this repo without altering the default codepath. (7efc689)

Copilot AI changed the title feat(cli): exempt githubnext/ado-aw repo from GitHub remote guard feat(cli): allow init --force to bypass GitHub remote guard May 8, 2026
Copilot AI requested a review from jamesadevine May 8, 2026 14:48
@jamesadevine jamesadevine marked this pull request as ready for review May 8, 2026 14:48
@jamesadevine
Copy link
Copy Markdown
Collaborator

@copilot that is a great change. The default behaviour should be to always overwrite ado-aw agent file when init is used. --force should only required in the exception case (e.g. to override github remote detection)

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 8, 2026

@copilot that is a great change. The default behaviour should be to always overwrite ado-aw agent file when init is used. --force should only required in the exception case (e.g. to override github re...

Done. init now always overwrites the agent file by default; --force is repurposed to only bypass the GitHub-remote guard. Help text, docs, and tests updated. (16a283c)

Copilot AI changed the title feat(cli): allow init --force to bypass GitHub remote guard feat(cli): make init always overwrite; --force bypasses GitHub remote guard May 8, 2026
@jamesadevine jamesadevine merged commit 6c1a332 into main May 8, 2026
@jamesadevine jamesadevine deleted the copilot/add-exception-case-for-ado-aw-init branch May 8, 2026 14:56
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