Skip to content

fix(prereq-check): parse az version via JSON on PowerShell#131

Merged
arnaudlh merged 1 commit into
mainfrom
fix/prereq-check-ps-az-parsing
May 28, 2026
Merged

fix(prereq-check): parse az version via JSON on PowerShell#131
arnaudlh merged 1 commit into
mainfrom
fix/prereq-check-ps-az-parsing

Conversation

@arnaudlh
Copy link
Copy Markdown
Member

@arnaudlh arnaudlh commented May 27, 2026

Closes #130.

Problem

On Windows / PowerShell, prereq-check reports az as OUTDATED unknown even when a current Azure CLI is installed, blocking Git-Ape onboarding.

PowerShell's native-command argument parser strips the inner double-quotes from:

az version --query '"azure-cli"' -o tsv

The CLI ends up receiving the JMESPath query azure-cli (no quotes), which is an invalid identifier because of the hyphen — JMESPath fails to parse, stdout is empty, and the script falls back to the literal string unknown.

The POSIX sibling check-tools.sh is unaffected because POSIX shells preserve inner quotes.

Fix

Replace the JMESPath query with native PowerShell JSON parsing:

$v = az version -o json 2>$null | ConvertFrom-Json
if ($v) { $v.'azure-cli' } else { '' }

This sidesteps the quoting issue entirely. The TSV contract emitted by the script is unchanged, so prereq-check's SKILL.md consumer keeps working without modification.

Verification

Local run on macOS (pwsh 7.x):

Platform: Darwin / arm64
az      OK      2.86.0  2.50
gh      OK      2.92.0  2.0
jq      OK      1.8     1.6
git     OK      2.54.0  0

node scripts/validate-structure.js → 0 errors, no new warnings.

PowerShell's native-command argument parser strips inner double-quotes
from `--query '"azure-cli"'`, leaving JMESPath with an invalid
unquoted hyphenated identifier. The CLI returns nothing, the script
falls back to 'unknown', and the version compare flags az as OUTDATED
even when it is current.

Switch to `az version -o json | ConvertFrom-Json` and read the
`azure-cli` property natively. This avoids the quoting issue entirely
and keeps the TSV contract identical to check-tools.sh.

Fixes #130
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Documentation Staleness Warning

Source files (agents, skills, workflows, or config) changed in this PR, but the generated documentation is out of date.

Changed docs that need regeneration:

  • website/docs/reference/marketplace.md
  • website/docs/reference/plugin-json.md
  • website/docs/skills/overview.md
  • website/docs/skills/prereq-check.md
  • website/docs/workflows/daily-repo-status-lock.md
  • website/docs/workflows/git-ape-release.md
  • website/docs/workflows/issue-triage-agent-lock.md
  • website/docs/workflows/pr-validation.md
  • website/docs/workflows/waza-agent-evals.md
  • website/docs/workflows/waza-evals.md

To fix: Run the following command and commit the results:

node scripts/generate-docs.js

This is an advisory check — it does not block the PR.

@arnaudlh arnaudlh requested a review from dawright22 May 27, 2026 02:47
@arnaudlh arnaudlh self-assigned this May 28, 2026
@arnaudlh arnaudlh added the bug Something isn't working label May 28, 2026
@arnaudlh arnaudlh merged commit 2ae81c7 into main May 28, 2026
6 checks passed
@arnaudlh arnaudlh deleted the fix/prereq-check-ps-az-parsing branch May 28, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prereq-check: az version returns 'unknown' on Windows (PowerShell quoting bug)

2 participants