Files
getsentry__sentry-for-ai/plugin-src/codex/validate.sh
Evan Purkhiser d65bd23b67 feat(dist): build and publish per-agent plugin distributions (#158)
This repository is the single source of truth for skills and routing metadata,
but it is not itself an installable plugin, and each assistant (Claude Code,
Cursor, Codex, Grok) expects the plugin in a different on-disk shape. No plugin
ecosystem can consume a zip or release asset; all install from a git ref. So a
GitHub Actions workflow builds each agent's distribution from this repository
and deploys it to a dedicated repository whose root is exactly that agent's
plugin, which a marketplace points at as getsentry/plugin-<agent>.

Each agent has a `plugin-src/<agent>/` dir with its manifests, README, and a
`build.sh` that assembles the dist tree from shared repo content. Claude, Cursor,
and Grok consume the plugin at the repo root; Codex requires it under
`plugins/sentry/` and rejects the `disable-model-invocation` field the skill
tree relies on, so its build strips that field and emits a per-skill
`agents/openai.yaml` (see `hide-skills.py`). MCP config is built from the repo's
`mcp.json` source of truth: inline in Claude's manifest, and a file for the
others.

Cross-repo writes use a short-lived token from a dedicated GitHub App scoped to
contents:write on the plugin repos; the default GITHUB_TOKEN cannot push to
other repositories.

The root `.claude-plugin/`, `.cursor-plugin/`, and `.mcp.json` are retained so
existing installs that consumed the plugin from this repo's root keep working;
their READMEs announce removal on or after 2026-07-11.
2026-06-12 13:39:38 -04:00

31 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# validate.sh — Validate the built Codex distribution before publishing.
#
# Codex has no published JSON Schema; OpenAI ships an authoritative validator
# script instead. We run it (pinned to a known-good commit) against the built
# plugin root. It enforces an allow-list of manifest keys — which is why the
# Codex manifest carries no `$schema` — and also checks the bundled SKILL.md /
# agents/openai.yaml files this dist generates. The validator needs PyYAML,
# supplied on the fly via `uv run --with`.
#
# Usage: validate.sh <TARGET_DIR> (a tree produced by build.sh)
set -euo pipefail
TARGET_DIR="${1:?usage: validate.sh <TARGET_DIR>}"
PLUGIN_ROOT="$TARGET_DIR/plugins/sentry"
# Pinned to openai/codex; bump the SHA to track upstream contract changes.
VALIDATOR_SHA="cdc1d592df7f066c141025cc8ae80bb3202580b6"
VALIDATOR_URL="https://raw.githubusercontent.com/openai/codex/${VALIDATOR_SHA}/codex-rs/skills/src/assets/samples/plugin-creator/scripts/validate_plugin.py"
WORK="$(mktemp -d)"
trap 'rm -rf "$WORK"' EXIT
VALIDATOR="$WORK/validate_plugin.py"
curl -fsSL "$VALIDATOR_URL" -o "$VALIDATOR"
uv run --with pyyaml "$VALIDATOR" "$PLUGIN_ROOT"
echo "Validated Codex dist at $TARGET_DIR."