fix(cli): version guard tolerates and fixtures include the extension manifest

The chrome-extension manifest check crashed jq (exit 2) inside the guard
self-test because the test fixtures never created the manifest, turning
the expected status-1 stale-version verdicts into harness errors. A
missing manifest is now reported as a normal version-sync failure, and
the fixture repo writes a manifest carrying the fixture version.
This commit is contained in:
Kayshen-X 2026-08-07 22:02:37 +08:00
parent ebc681881d
commit 2bd181bd60
2 changed files with 8 additions and 0 deletions

View file

@ -346,6 +346,11 @@ validate_package_versions() {
validate_chrome_extension_manifest_version() {
manifest=packages/op-chrome-extension/manifest.json
if [[ ! -f "$manifest" ]]; then
report_missing "$manifest" \
'Chrome extension manifest is missing; it must exist and carry the Cargo workspace version'
return
fi
manifest_version=$(jq -r '.version' "$manifest")
if [[ "$manifest_version" != "$current_version" ]]; then
report_missing "$manifest" \

View file

@ -216,6 +216,9 @@ new_repo() {
'edition = "2024"' > "$repo/Cargo.toml"
printf '%s\n' 'version = 4' > "$repo/Cargo.lock"
printf '%s\n' '{"name":"fixture-packages"}' > "$repo/packages/package.json"
mkdir -p "$repo/packages/op-chrome-extension"
printf '{"manifest_version":3,"name":"fixture-extension","version":"%s"}\n' "$version" \
> "$repo/packages/op-chrome-extension/manifest.json"
cat > "$repo/crates/op-cli/assets/skill-bundle.json" <<'JSON'
{"one":"__OPENPENCIL_VERSION__","two":"__OPENPENCIL_VERSION__","three":"__OPENPENCIL_VERSION__","four":"__OPENPENCIL_VERSION__","five":"__OPENPENCIL_VERSION__"}