Files
Agent-System-Dev/scripts/plugin-new.sh
weichenandCursor 09964e522b Pin the extension roadmap and downstream spike
Why: Downstream products need a published extension surface, contract checks, and a sample plugin that does not modify the base.
Evidence: scripts/lint-boundaries.sh printed boundaries ok. examples/downstream-rdm go test passed. Submodule pointers record the core, documents, backend, ui, and frontend commits for this roadmap.
Impact: make test runs the boundary lint first. make plugin-new scaffolds a declaration plugin. Version tags and remote downstream repositories are not created.
Refs: .task/feature-base-extension-roadmap.md
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 10:35:15 +00:00

38 lines
1000 B
Bash
Executable File

#!/usr/bin/env bash
# 生成声明式插件骨架:make plugin-new NAME=<id>
set -euo pipefail
name="${1:-}"
if [ -z "$name" ]; then
echo "usage: plugin-new.sh <id>" >&2
exit 2
fi
root=$(cd "$(dirname "$0")/.." && pwd)
dest="$root/examples/plugins/$name"
if [ -e "$dest" ]; then
echo "exists: $dest" >&2
exit 1
fi
mkdir -p "$dest/tools" "$dest/skills" "$dest/pages"
cat > "$dest/plugin.json" <<EOF
{
"id": "$name",
"name": "$name",
"version": "0.1.0",
"apiVersion": "2.0-experimental",
"requires": { "network": [] },
"provides": { "skills": ["welcome"], "pages": ["home"] }
}
EOF
printf '# %s\n\n描述这个技能做什么、何时使用。\n' "$name" > "$dest/skills/welcome.md"
cat > "$dest/pages/home.json" <<EOF
{ "id": "home", "title": "$name", "module": "./page.mjs" }
EOF
cat > "$dest/page.mjs" <<'EOF'
export function mount(el, bridge) {
el.textContent = '插件页面'
el.dataset.bridge = bridge ? 'ready' : ''
}
export function unmount() {}
EOF
echo "wrote $dest"