mirror of
https://github.com/getsentry/sentry-for-ai.git
synced 2026-09-14 14:28:22 +08:00
cc302403eb
Task-shaped skills will draw their reference material (per-platform SDK guides, per-signal concepts) from a single maintained library rather than duplicating it. Each shipped skill must still be self-contained, so the build copies a skill's declared references into it. Add a CONTENT_ROOT env var (default: repo root) so the same build steps can assemble an alternate skill tree, e.g. CONTENT_ROOT=skills-next. hydrate-references.py walks a skills directory: for every skill with a references.yml it brace-expands and globs the `needs:` patterns against the library, copies the matches into the skill's references/ preserving subpaths, and strips the manifest so it never ships. It runs via `uv run --script` with inline PyYAML and braceexpand dependencies. build-common.sh invokes it once per build, and only when some skill declares references, so existing skills are unaffected and the common case spawns no interpreter. Factor the steps shared across all four agent builders into build-common.sh (content-root resolution, skill copy+hydrate, commands, SKILL_TREE), sourced by each plugin-src/<agent>/build.sh.
43 lines
1.8 KiB
Bash
Executable File
43 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# build.sh — Build the Grok distribution of the Sentry plugin.
|
|
#
|
|
# Grok plugins put their components at the repo ROOT (skills/, commands/, and a
|
|
# `.mcp.json` file Grok auto-discovers). The plugin manifest lives at
|
|
# `.grok-plugin/plugin.json` — that is where the xAI plugin marketplace scanner
|
|
# (generate-plugin-index.py) looks for it. A marketplace catalog also lives at
|
|
# `.grok-plugin/marketplace.json` whose `source: "./"` points back at this same
|
|
# root. This differs from Claude (`.claude-plugin/`) and Codex (`plugins/sentry/`).
|
|
# No skill mutation is needed; skills ship as-authored.
|
|
#
|
|
# MCP is a root `.mcp.json`, built from the repo's `mcp.json` source of truth.
|
|
#
|
|
# Skill content (skills/, commands/, references/, SKILL_TREE.md) is read from
|
|
# CONTENT_ROOT, defaulting to the repo root. Point it at an alternate tree (e.g.
|
|
# CONTENT_ROOT=skills-next) to build a different skill set with the same steps.
|
|
#
|
|
# Usage: build.sh <TARGET_DIR> (TARGET_DIR assumed empty)
|
|
|
|
set -euo pipefail
|
|
|
|
TARGET_DIR="${1:?usage: build.sh <TARGET_DIR>}"
|
|
SRC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd "$SRC_DIR/../.." && pwd)"
|
|
cd "$REPO_ROOT"
|
|
source "$REPO_ROOT/scripts/build-common.sh"
|
|
resolve_content_root "$REPO_ROOT"
|
|
|
|
mkdir -p "$TARGET_DIR/.grok-plugin"
|
|
|
|
cp "$SRC_DIR/plugin.json" "$TARGET_DIR/.grok-plugin/plugin.json"
|
|
cp "$SRC_DIR/marketplace.json" "$TARGET_DIR/.grok-plugin/marketplace.json"
|
|
copy_skills "$CONTENT_ROOT" "$TARGET_DIR/skills"
|
|
copy_commands "$CONTENT_ROOT" "$TARGET_DIR/commands"
|
|
copy_skill_tree "$CONTENT_ROOT" "$TARGET_DIR/SKILL_TREE.md"
|
|
rsync -a assets/ "$TARGET_DIR/assets/"
|
|
cp mcp.json "$TARGET_DIR/.mcp.json"
|
|
cp "$SRC_DIR/README.md" "$TARGET_DIR/README.md"
|
|
cp LICENSE "$TARGET_DIR/LICENSE"
|
|
|
|
echo "Built Grok dist into $TARGET_DIR (root plugin, content from $CONTENT_ROOT)."
|