This is a support entry point; it does not touch the Product Runtime, projects, media, or live cache. Only official Codex Marketplace commands are allowed to handle snapshots and activation.
[纯 inspect] ------------------------> [不 refresh]
[用户明确说“检查更新”] --> [Git?] --> [官方 marketplace upgrade]
| |
| v
| [可信 ref + checksum?]
| | no | yes
v v v
[local not refreshable] [停止] [compare -> confirm -> add -> reread]
1. Read-only inspect or user-requested check
Locate the script from the current Skill, and require the user to specify the configured Marketplace name:
PLUGIN_ROOT="$(codex plugin list --json | node -e 'let s=""; process.stdin.on("data", c => s += c); process.stdin.on("end", () => { const rows = JSON.parse(s).installed || []; const hit = rows.filter(x => x.enabled && x.name === "chengfeng-videocut" && x.source && x.source.path); if (hit.length !== 1) process.exit(1); process.stdout.write(hit[0].source.path); });')"
test -n "$PLUGIN_ROOT" && test -f "$PLUGIN_ROOT/.codex-plugin/plugin.json" || { echo "chengfeng-videocut enabled plugin root unavailable" >&2; exit 1; }
UPDATE="$PLUGIN_ROOT/scripts/check-plugin-update.cjs"
node "$UPDATE" --marketplace "$marketplaceName" --inspect --json
PLUGIN_ROOT Only from the enabled Plugin line above source.path. Do not rely on SKILL_DIR, which is not guaranteed to exist, hardcoded development machine paths, or directory searches to guess the installation location.
--inspect Do not refresh. Only after the user explicitly says "check for updates", run:
node "$UPDATE" --marketplace "$marketplaceName" --json
current: report current/latest, Marketplace, and refreshed facts.update_available_confirmation_required: show installed, available, 40-hex immutable commit, publisher SHA-256; stop and wait for user confirmation.marketplace_not_refreshable: a local marketplace is not a remote update source; do not fake a remote check.update_metadata_untrusted: missing 40-hex immutable commit, publisher package checksum, or inconsistent package manifest hash recalculable in the Codex snapshot; a bare semver/tag cannot replace a commit, do not download, do not callplugin add. The official CLI has no standalone stage command, so do not claim it has been staged.- Any refresh/parse/version error: retain structured JSON, stop; do not copy directories, do not delete cache.
When the current public Git baseline lacks immutable provenance and publisher checksum usable for activation, the correct result is update_metadata_untrusted; a visible new commit is not an installable update.
2. Activate only after explicit user confirmation
Confirmation must occur after the user has seen the exact available version, ref, and checksum:
node "$UPDATE" --marketplace "$marketplaceName" --activate --confirmed \
--expected-version "$shownVersion" --expected-ref "$shownImmutableRef" \
--expected-sha256 "$shownPublisherSha256" --json
The script refreshes the Git snapshot through the official codex plugin marketplace upgrade , recalculates the file manifest SHA-256 of the candidate package within the snapshot, and compares the three --expected-* values; only then use the official codex plugin add. There is no standalone stage: the officially refreshed snapshot is the only inspectable source. It must reread version, immutable ref, and publisher SHA-256 from the installed cache path returned by plugin add , and recalculate the same inventory digest; when the Codex list does not contain ref/checksum, accept only the verifiable source of the installed .codex-plugin/update-provenance.json , and fail if missing. Report only when all four items equal the candidate activated. After successful activation, tell the user to restart Codex.
plugin_activation_unsupported indicates the official CLI has no atomic selection of that version: stop, do not delete cache, copy sources, or reinstall Runtime to simulate an upgrade.
Boundaries
- A Plugin can be upgraded to
0.5.1, which does not equal a Runtime update; the Runtime minimum compatibility/Release is still controlled by theruntime-requirements.jsoncontract of0.2.0. - Do not describe local staging, legacy cache, or a local marketplace as remotely updatable.
- Do not publish, modify Product Runtime, 5190, project data, or media; after user confirmation, official Codex activation is the only write exception.