Commit a032b4e
feat: add \configure\ command to detect pipelines and update GITHUB_TOKEN (#92)
* feat: add \configure\ command to detect pipelines and update GITHUB_TOKEN
Add a new \�do-aw configure\ CLI command that:
- Detects agentic pipelines by scanning YAML files for a new \# @ado-aw\ header
- Infers ADO org/project from the git remote URL
- Matches detected pipelines to ADO build definitions (by YAML path, then name)
- Updates the GITHUB_TOKEN pipeline variable via the Build Definitions API
The compiler now prepends a header comment to all compiled YAML output:
# This file is auto-generated by ado-aw. Do not edit manually.
# @ado-aw source=<input-path> version=<compiler-version>
New modules: src/detect.rs (scanning/parsing), src/configure.rs (orchestration + ADO API).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address PR review feedback for configure command
- Security: read --token and --pat from env vars (GITHUB_TOKEN, AZURE_DEVOPS_EXT_PAT)
via clap's env attribute, avoiding exposure in process listings
- Performance: use BufReader to read only first 5 lines in pipeline detection
instead of loading entire files
- Correctness: paginate ADO Build Definitions API using x-ms-continuationtoken
header to handle projects with >100 pipelines
- Correctness: tighten name-based fallback matching — warn on fuzzy matches,
skip ambiguous ones (multiple candidates)
- Correctness: replace std::process::exit(1) with anyhow::bail! to preserve
Rust error handling and cleanup
- Cleanup: remove hardcoded version string in user-facing message
- Docs: add race condition comment on GET→PUT update cycle
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat: prompt for GITHUB_TOKEN interactively when not provided
The --token flag now falls back to an interactive password prompt (via
inquire) when neither the CLI flag nor the GITHUB_TOKEN env var is set.
This avoids exposing the token in shell history or process listings.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address second round of PR review feedback
- Fix header marker prefix matching: require exact '# @ado-aw ' with
trailing space so '# @ado-aw-v2' is not falsely detected
- Quote source path in header comment to support paths with spaces;
parser handles both quoted and unquoted for backward compatibility
- Strip newlines from input_path in header generation to prevent injection
- Guard index access in integration test with lines.len() >= 2 assertion
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address third round of PR review feedback
- URL-encode continuation token in ADO pagination (use reqwest .query())
- Escape double quotes in source path in header comment
- Handle escaped quotes in header parser for correct round-trip
- Extract fuzzy name matching into testable pure function
- Add unit tests for fuzzy matching (single, ambiguous, none, empty, case)
- Add tests for header comment quote escaping and round-trip
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address fourth round of PR review feedback
- Preserve existing allowOverride when updating pipeline variable instead
of silently hardcoding true (security posture fix)
- Add interactive prompt fallback for --pat (matching --token behavior)
- Add 30s timeout to reqwest HTTP client for better UX when ADO is slow
- Canonicalize repo_path early for clearer error messages
- Update --pat help text to recommend env var over CLI flag
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 3395b74 commit a032b4e
10 files changed
Lines changed: 1260 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
465 | 493 | | |
466 | 494 | | |
467 | 495 | | |
| |||
988 | 1016 | | |
989 | 1017 | | |
990 | 1018 | | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
991 | 1042 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
197 | 201 | | |
198 | 202 | | |
199 | 203 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
198 | 197 | | |
199 | 198 | | |
200 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
201 | 204 | | |
202 | 205 | | |
203 | 206 | | |
| |||
0 commit comments