From 93aba856a88f7d88d33b6741894c41565c77e731 Mon Sep 17 00:00:00 2001 From: Vagner Rodrigues Date: Mon, 25 May 2026 18:53:05 -0300 Subject: [PATCH] =?UTF-8?q?feat(plugins):=20OpenSpec=20=E2=80=94=20spec-dr?= =?UTF-8?q?iven=20development=20CLI=20(universal=20across=20all=20AI=20age?= =?UTF-8?q?nts)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenSpec (https://github.com/Fission-AI/OpenSpec) is a spec-driven dev framework. Standalone CLI installed once globally via npm; any AI assistant (Claude, Codex, Cursor, OpenCode, Antigravity) invokes it via /opsx:* slash commands after the project runs `openspec init`. No per-CLI binding needed. lib/plugins.sh - install_openspec: `npm install -g @fission-ai/openspec@` with an early-exit error message if npm is not on PATH. Default version: latest. profiles/cli-bundle/09-plugins.sh - INSTALL_OPENSPEC=true block, ordered before the official-Anthropic- marketplace block so the binary is on PATH if those plugins want to invoke openspec internally. - Appends OPENSPEC_TELEMETRY="${OPENSPEC_TELEMETRY:-0}" to ~/.bashrc on first install (telemetry off by default; opt-in by setting =1 in .env). profiles/cli-bundle/.env.example - INSTALL_OPENSPEC, OPENSPEC_VERSION, OPENSPEC_TELEMETRY. profiles/cli-bundle/README.md - New OpenSpec section covering install toggle + `openspec init` + /opsx:* usage from any AI CLI. tests/test_plugins.bats - install_openspec: errors when npm missing (PATH-isolated to STUB_DIR only) - install_openspec: invokes `npm install -g @fission-ai/openspec@latest` (PATH widened to include /usr/bin /bin so the bash-shebang stub resolves) All 31 bats tests + lint + env-completeness pass locally. Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/CHANGELOG.md | 22 ++++++++++++++++++++++ lib/plugins.sh | 14 ++++++++++++++ profiles/cli-bundle/.env.example | 8 ++++++++ profiles/cli-bundle/09-plugins.sh | 13 +++++++++++++ profiles/cli-bundle/README.md | 23 +++++++++++++++++++++++ tests/test_plugins.bats | 19 +++++++++++++++++++ 6 files changed, 99 insertions(+) diff --git a/.claude/CHANGELOG.md b/.claude/CHANGELOG.md index ab2e544..b36f614 100644 --- a/.claude/CHANGELOG.md +++ b/.claude/CHANGELOG.md @@ -5,6 +5,28 @@ Each entry: **what** changed, **why** it was needed, **files** touched. --- +## 2026-05-25 — v0.6.1 — OpenSpec (spec-driven development CLI) + +**What** +- `lib/plugins.sh` — new `install_openspec()` (npm-global install of `@fission-ai/openspec`). +- `profiles/cli-bundle/09-plugins.sh` — `INSTALL_OPENSPEC=true` block, installs OpenSpec + appends `OPENSPEC_TELEMETRY=0` to `~/.bashrc` (default off; opt-in by setting `OPENSPEC_TELEMETRY=1`). +- `profiles/cli-bundle/.env.example` — `INSTALL_OPENSPEC`, `OPENSPEC_VERSION`, `OPENSPEC_TELEMETRY`. +- `profiles/cli-bundle/README.md` — OpenSpec section with `openspec init` + `/opsx:*` usage. +- `tests/test_plugins.bats` — 2 new tests (missing-npm error path; correct npm-install dispatch with PATH-isolated stub). + +**Why** +- OpenSpec is universal — any AI CLI (Claude, Codex, Cursor, OpenCode, Antigravity) can invoke it via the `/opsx:*` slash commands once a project has run `openspec init`. No per-CLI binding needed. +- Single npm-global install + telemetry-off default = same pattern already used for Codex/Claude CLIs. + +**Files** +- `lib/plugins.sh` (+ `install_openspec`) +- `profiles/cli-bundle/09-plugins.sh` (block) +- `profiles/cli-bundle/.env.example` (3 vars) +- `profiles/cli-bundle/README.md` (section) +- `tests/test_plugins.bats` (2 tests, total 31) + +--- + ## 2026-05-25 — v0.6.0 — Official plugins (Linear/Slack/etc) + headless browser as base tool **What** diff --git a/lib/plugins.sh b/lib/plugins.sh index 55b4c91..a13cc06 100644 --- a/lib/plugins.sh +++ b/lib/plugins.sh @@ -42,6 +42,20 @@ install_claude_plugin() { claude_headless "/reload-plugins" || true } +# Install OpenSpec — spec-driven development CLI. npm-global; works inside +# any AI assistant via /opsx:* slash commands (no per-CLI binding). +# Upstream: https://github.com/Fission-AI/OpenSpec +install_openspec() { + local version="${OPENSPEC_VERSION:-latest}" + if ! command -v npm >/dev/null 2>&1; then + echo "ERROR: npm not on PATH — OpenSpec requires Node.js." + return 1 + fi + echo "==> Installing @fission-ai/openspec@${version} globally" + npm install -g "@fission-ai/openspec@${version}" + openspec --version 2>/dev/null || true +} + # Install gstack into a target CLI's skills dir. # $1 = host name (claude, opencode, etc.) install_gstack_for() { diff --git a/profiles/cli-bundle/.env.example b/profiles/cli-bundle/.env.example index fafb02b..198ab8a 100644 --- a/profiles/cli-bundle/.env.example +++ b/profiles/cli-bundle/.env.example @@ -115,6 +115,14 @@ INSTALL_GSTACK=false # Space-separated list. Valid: claude opencode GSTACK_TARGETS=claude +# OpenSpec — spec-driven development. Universal (works in any AI CLI via +# /opsx:* slash commands once invoked from a project that ran `openspec init`). +# Upstream: https://github.com/Fission-AI/OpenSpec +INSTALL_OPENSPEC=false +OPENSPEC_VERSION=latest +# Telemetry off (industry standard). Set to 1 to opt in. +OPENSPEC_TELEMETRY=0 + # --- Official Anthropic marketplace plugins (Claude-only) --- # Bundle pre-configured MCP + skills + slash commands. Richer than the raw # MCP registrations in 06-mcp.sh — either can be used (or both). diff --git a/profiles/cli-bundle/09-plugins.sh b/profiles/cli-bundle/09-plugins.sh index 38e8523..d7c2936 100644 --- a/profiles/cli-bundle/09-plugins.sh +++ b/profiles/cli-bundle/09-plugins.sh @@ -94,6 +94,19 @@ if [[ "${INSTALL_SUPERPOWERS:-false}" == "true" ]]; then fi fi +# --- OpenSpec (universal: works in any AI CLI via slash commands) ---------- +if [[ "${INSTALL_OPENSPEC:-false}" == "true" ]]; then + install_openspec + # Telemetry off by default unless operator opts in. + if ! grep -q 'OPENSPEC_TELEMETRY' "$HOME/.bashrc" 2>/dev/null; then + cat >> "$HOME/.bashrc" < +# /opsx:plan +``` + ### Plugins oficiais da Anthropic (Claude only) Toggles separados pra cada plugin do marketplace `claude-plugins-official`: diff --git a/tests/test_plugins.bats b/tests/test_plugins.bats index 918d10e..c775511 100644 --- a/tests/test_plugins.bats +++ b/tests/test_plugins.bats @@ -74,6 +74,25 @@ EOF # ---------- print_manual_install_hint ---------- +@test "install_openspec: errors when npm missing" { + PATH="$STUB_DIR" run install_openspec + [ "$status" -ne 0 ] + [[ "$output" == *"npm not on PATH"* ]] +} + +@test "install_openspec: invokes npm install -g with @fission-ai/openspec" { + CALLS_FILE="$TEST_HOME/npm-calls.txt" + cat > "$STUB_DIR/npm" <> "$CALLS_FILE" +EOF + chmod +x "$STUB_DIR/npm" + # Keep /usr/bin + /bin on PATH so the stub's shebang (`env bash`) resolves. + PATH="$STUB_DIR:/usr/bin:/bin" run install_openspec + [ -f "$CALLS_FILE" ] + grep -q "install -g @fission-ai/openspec@latest" "$CALLS_FILE" +} + @test "print_manual_install_hint: prints CLI name and instruction" { run print_manual_install_hint "Codex CLI" "/plugins → search" [ "$status" -eq 0 ]