Skip to content

Commit 562ff7f

Browse files
feat(compile): add --force flag to bypass GitHub-remote guard (#577)
Mirrors the existing 'ado-aw init --force' escape hatch on the compile subcommand so maintainers can compile pipelines inside 'githubnext/ado-aw' (or any GitHub-hosted fork) without setting CARGO_BIN_EXE_ado-aw. Also clarifies the guard's error message to mention --force as the bypass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ca914f1 commit 562ff7f

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

docs/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Global flags (apply to all subcommands): `--verbose, -v` (enable info-level logg
1313
- The agent auto-downloads the ado-aw compiler and handles the full lifecycle (create → compile → check)
1414
- `compile [<path>]` - Compile a markdown file to Azure DevOps pipeline YAML. If no path is given, auto-discovers and recompiles all detected agentic pipelines in the current directory.
1515
- `--output, -o <path>` - Optional output path for the generated YAML (only valid when a path is provided). If the path is an existing directory, the compiled YAML is written inside that directory using the default filename derived from the markdown source (e.g. `foo.md``<dir>/foo.lock.yml`).
16+
- `--force` - Bypass the GitHub-remote guard (use when running inside a GitHub-hosted repository like `githubnext/ado-aw` itself)
1617
- `--skip-integrity` - *(debug builds only)* Omit the "Verify pipeline integrity" step from the generated pipeline. Useful during local development when the compiled output won't match a released compiler version. This flag is not available in release builds. OR-ed with `ado-aw-debug.skip-integrity:` in front matter — either is sufficient. See [`docs/ado-aw-debug.md`](ado-aw-debug.md).
1718
- `--debug-pipeline` - *(debug builds only)* Include MCPG debug diagnostics in the generated pipeline: `DEBUG=*` environment variable for verbose MCPG logging, stderr streaming to log files, and a "Verify MCP backends" step that probes each backend with MCP initialize + tools/list before the agent runs. This flag is not available in release builds.
1819
- For `target: job` and `target: stage`, the output is an ADO YAML template (not a complete pipeline). Job names are prefixed with the agent name for uniqueness. Triggers configured via `on:` are ignored with a warning.

src/main.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ enum Commands {
3535
/// the input markdown (e.g. `foo.md` -> `<dir>/foo.lock.yml`).
3636
#[arg(short, long)]
3737
output: Option<String>,
38+
/// Bypass the GitHub-remote guard (use when running inside a
39+
/// GitHub-hosted repository like `githubnext/ado-aw` itself).
40+
#[arg(long)]
41+
force: bool,
3842
/// Omit the "Verify pipeline integrity" step from the generated pipeline.
3943
/// Only available in debug builds.
4044
#[cfg(debug_assertions)]
@@ -207,7 +211,10 @@ async fn ensure_non_github_remote_for_ado_aw(command_name: &str, repo_path: &Pat
207211
anyhow::bail!(
208212
"Cannot run `ado-aw {}` in a GitHub repository (origin: {}). \
209213
`ado-aw` is for Azure DevOps repositories. \
210-
For GitHub repositories, use gh-aw instead: https://github.com/github/gh-aw",
214+
For GitHub repositories, use gh-aw instead: https://github.com/github/gh-aw\n\
215+
\n\
216+
If you are working inside `githubnext/ado-aw` itself (or a fork), \
217+
pass `--force` to bypass this check.",
211218
command_name,
212219
remote_url
213220
);
@@ -499,6 +506,7 @@ async fn main() -> Result<()> {
499506
Commands::Compile {
500507
path,
501508
output,
509+
force,
502510
#[cfg(debug_assertions)]
503511
skip_integrity,
504512
#[cfg(debug_assertions)]
@@ -509,7 +517,12 @@ async fn main() -> Result<()> {
509517
#[cfg(not(debug_assertions))]
510518
let debug_pipeline = false;
511519

512-
ensure_non_github_remote_for_ado_aw("compile", Path::new(".")).await?;
520+
// `--force` bypasses the GitHub-remote guard so maintainers can
521+
// run `ado-aw compile` inside this repository (or other
522+
// GitHub-hosted forks) for development and example regeneration.
523+
if !force {
524+
ensure_non_github_remote_for_ado_aw("compile", Path::new(".")).await?;
525+
}
513526
run_compile(path, output, skip_integrity, debug_pipeline).await?;
514527
}
515528
Commands::Check { pipeline } => {

0 commit comments

Comments
 (0)