diff options
| author | Drew Ritter <drew@primeradiant.com> | 2026-11-03 15:20:42 -0800 |
|---|---|---|
| committer | Drew Ritter <drew@primeradiant.com> | 2026-11-03 15:20:42 -0800 |
| commit | 58e107b4824f4cd084ecdc7f3e01c6dd20f9e391 (patch) | |
| tree | b9ea88a675416d3407f7ac6096f227da8d4ec035 | |
| parent | 22f0b463e7a5e579904dd6211a520321035526f7 (diff) | |
Fix Codex portal release metadata and hook packagingcodex/wip-codex-marketplace-upload-7.0.2
Drew reported that the v7.0.2 ZIP was rejected for a hooks declaration,
a subtitle longer than 30 characters, and a missing support URL. The
published main release lacked the fixes carried on the previous
marketplace upload branch.
Carry forward d19b503b, 6e11b443, and 705a8504: use the approved short
subtitle and support URL, and omit only the staged manifest hooks field.
Keep hooks: {} in the repository manifest so local installs do not
auto-discover the Claude Code SessionStart hook. Preserve the extracted
manifest permissions when writing its portal representation.
Retain behavioral archive coverage for ZIP and tar.gz, unchanged source
metadata, and restrictive umask. Add source-manifest checks for the
portal subtitle length/single-line contract and required HTTPS support
URL. The archive and source-manifest regressions failed before the fix;
all pass after it, as do shellcheck, bash syntax, and diff checks.
Build lineage is main/v7.0.2 at 22f0b463, with only these packaging and
listing corrections. Drew explicitly required building the replacement
ZIP from main before carrying the fixes onto dev. No dev content is part
of the release build. Portal validation remains separate from local
verification.
Tracked in PRI-3439.
| -rw-r--r-- | .codex-plugin/plugin.json | 3 | ||||
| -rwxr-xr-x | scripts/package-codex-plugin.sh | 8 | ||||
| -rwxr-xr-x | tests/codex/test-marketplace-manifest.sh | 12 | ||||
| -rwxr-xr-x | tests/codex/test-package-codex-plugin.sh | 48 |
4 files changed, 67 insertions, 4 deletions
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index b0bc130..0dc7daa 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -24,7 +24,7 @@ "hooks": {}, "interface": { "displayName": "Superpowers", - "shortDescription": "Planning, TDD, debugging, and delivery workflows for coding agents", + "shortDescription": "Planning, TDD, and debugging", "longDescription": "Use Superpowers to guide agent work through brainstorming, implementation planning, test-driven development, systematic debugging, parallel execution, code review, and finish-the-branch workflows.", "developerName": "Jesse Vincent", "category": "Developer Tools", @@ -38,6 +38,7 @@ "Let's add a feature to this project." ], "websiteURL": "https://github.com/obra/superpowers", + "supportURL": "https://github.com/obra/superpowers/issues", "privacyPolicyURL": "https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement", "termsOfServiceURL": "https://docs.github.com/en/site-policy/github-terms/github-terms-of-service", "brandColor": "#F59E0B", diff --git a/scripts/package-codex-plugin.sh b/scripts/package-codex-plugin.sh index fe90862..d20a13e 100755 --- a/scripts/package-codex-plugin.sh +++ b/scripts/package-codex-plugin.sh @@ -42,6 +42,7 @@ Options: The archive is rootless: .codex-plugin/, assets/, skills/, README.md, LICENSE, and CODE_OF_CONDUCT.md sit at the archive root. Source-only repo files, hooks, tests, docs, and other harness manifests are intentionally not shipped. +Hook declarations are removed from the packaged manifest for portal submission. EOF } @@ -244,6 +245,13 @@ git -C "$REPO_ROOT" -c tar.umask=0022 archive --format=tar "$REF" -- \ VERSION="$(jq -r '.version // empty' "$STAGE/.codex-plugin/plugin.json")" [[ -n "$VERSION" ]] || die "could not read version from .codex-plugin/plugin.json" +# Omit hook declarations from portal packages while retaining the source +# manifest's suppression of hook discovery for repository installs. +# Write into the extracted file to preserve its canonical mode. +manifest_tmp="$WORK_DIR/plugin-manifest.json" +jq 'del(.hooks)' "$STAGE/.codex-plugin/plugin.json" >"$manifest_tmp" +cat "$manifest_tmp" >"$STAGE/.codex-plugin/plugin.json" + if [[ -z "$OUTPUT" ]]; then case "$FORMAT" in zip) diff --git a/tests/codex/test-marketplace-manifest.sh b/tests/codex/test-marketplace-manifest.sh index 4301a06..db647c4 100755 --- a/tests/codex/test-marketplace-manifest.sh +++ b/tests/codex/test-marketplace-manifest.sh @@ -9,6 +9,7 @@ python3 - "$MARKETPLACE" "$REPO_ROOT" <<'PY' import json import sys from pathlib import Path +from urllib.parse import urlsplit marketplace_path = Path(sys.argv[1]) repo_root = Path(sys.argv[2]) @@ -52,6 +53,17 @@ if not plugin_manifest.exists(): manifest = json.loads(plugin_manifest.read_text(encoding="utf-8")) assert_equal(manifest.get("name"), plugin.get("name"), "plugin manifest name") +interface = manifest.get("interface", {}) +subtitle = interface.get("shortDescription") +if not isinstance(subtitle, str) or not 1 <= len(subtitle) <= 30: + raise AssertionError("marketplace subtitle must contain 1 to 30 characters") +if "\n" in subtitle or "\r" in subtitle: + raise AssertionError("marketplace subtitle must fit on one line") + +support_url = urlsplit(interface.get("supportURL", "")) +if support_url.scheme != "https" or not support_url.hostname: + raise AssertionError("marketplace support URL must be an HTTPS URL") + # Codex auto-discovers a plugin's hooks/hooks.json whenever the Codex manifest # has no `hooks` field: load_plugin_hooks falls back to a hardcoded # DEFAULT_HOOKS_CONFIG_FILE = "hooks/hooks.json" and registers it. That file is diff --git a/tests/codex/test-package-codex-plugin.sh b/tests/codex/test-package-codex-plugin.sh index 05e150a..bb13758 100755 --- a/tests/codex/test-package-codex-plugin.sh +++ b/tests/codex/test-package-codex-plugin.sh @@ -118,6 +118,28 @@ read_archive_file() { esac } +assert_packaged_manifest() { + local archive_path="$1" + + if read_archive_file "$archive_path" .codex-plugin/plugin.json | python3 -c ' +import json +import subprocess +import sys + +source = json.loads(subprocess.check_output( + ["git", "show", "HEAD:.codex-plugin/plugin.json"], cwd=sys.argv[1] +)) +manifest = json.load(sys.stdin) +assert "hooks" not in manifest, "packaged manifest must omit hook declarations" +source.pop("hooks", None) +assert manifest == source, "packaging must preserve all other manifest fields" +' "$REPO_ROOT"; then + pass "archive omits hook declarations and preserves all other manifest fields" + else + fail "archive omits hook declarations and preserves all other manifest fields" + fi +} + write_metadata_fixture() { local destination="$1" local skill @@ -145,6 +167,7 @@ write_metadata_fixture "$metadata_source" source_hooks="$(python3 -c 'import json; print(json.load(open("'"$REPO_ROOT"'/.codex-plugin/plugin.json")).get("hooks"))')" assert_equals "$source_hooks" "{}" "source Codex manifest suppresses local hook auto-discovery" +source_manifest_checksum="$(shasum -a 256 "$REPO_ROOT/.codex-plugin/plugin.json" | awk '{print $1}')" if output="$("$SCRIPT_UNDER_TEST" --allow-dirty --metadata-source "$metadata_source" --output "$archive" 2>&1)"; then pass "package script exits successfully" @@ -193,9 +216,7 @@ assert_contains "$archive_paths" "skills/brainstorming/agents/openai.yaml" "arch assert_contains "$archive_paths" "assets/app-icon.png" "archive includes app icon" assert_contains "$archive_paths" "assets/superpowers-small.svg" "archive includes composer icon" -manifest_summary="$(read_archive_file "$archive" .codex-plugin/plugin.json | python3 -c 'import json,sys; data=json.load(sys.stdin); print("\t".join([data["name"], data["version"], data["skills"], str(data.get("hooks"))]))')" -expected_version="$(python3 -c 'import json; print(json.load(open("'"$REPO_ROOT"'/.codex-plugin/plugin.json"))["version"])')" -assert_equals "$manifest_summary" "superpowers $expected_version ./skills/ $source_hooks" "archive manifest preserves source hooks" +assert_packaged_manifest "$archive" skill_count="$(find "$extracted/skills" -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')" metadata_count="$(find "$extracted/skills" -path '*/agents/openai.yaml' -type f | wc -l | tr -d ' ')" @@ -217,6 +238,23 @@ PY )" assert_equals "$zip_times" "(1980, 1, 1, 0, 0, 0)" "zip archive normalizes entry timestamps" +restrictive_archive="$TEST_ROOT/superpowers-restrictive.zip" +( + umask 077 + "$SCRIPT_UNDER_TEST" --allow-dirty --metadata-source "$metadata_source" --output "$restrictive_archive" >/dev/null +) +restrictive_manifest_mode="$(python3 - "$restrictive_archive" <<'PY' +import stat +import sys +import zipfile + +with zipfile.ZipFile(sys.argv[1]) as archive: + manifest = archive.getinfo(".codex-plugin/plugin.json") + print(oct(stat.S_IMODE(manifest.external_attr >> 16))) +PY +)" +assert_equals "$restrictive_manifest_mode" "0o644" "manifest preserves its mode under a restrictive umask" + if tar_output="$("$SCRIPT_UNDER_TEST" --allow-dirty --metadata-source "$metadata_source" --format tar.gz --output "$tar_archive" 2>&1)"; then pass "package script writes explicit tar.gz archive" else @@ -228,6 +266,7 @@ assert_contains "$tar_output" "Format: tar.gz" "reports explicit tar.gz format" extract_archive "$tar_archive" "$tar_extracted" tar_archive_paths="$(list_archive "$tar_archive" | normalize_archive_paths)" assert_equals "$tar_archive_paths" "$archive_paths" "zip and tar.gz archives contain the same paths" +assert_packaged_manifest "$tar_archive" tar_task_brief_mode="$(tar -tzvf "$tar_archive" skills/subagent-driven-development/scripts/task-brief | awk '{print $1}')" assert_equals "$tar_task_brief_mode" "-rwxr-xr-x" "tar.gz archive preserves executable script mode" @@ -311,6 +350,9 @@ else fi assert_contains "$dirty_output" "Working tree has uncommitted changes:" "dirty worktree reports changed files" +assert_equals "$(shasum -a 256 "$REPO_ROOT/.codex-plugin/plugin.json" | awk '{print $1}')" \ + "$source_manifest_checksum" "packaging leaves the repository manifest unchanged" + if [[ "$FAILURES" -eq 0 ]]; then echo "All Codex package archive tests passed" else |
