Skip to content

Commit cd763a4

Browse files
Rodriguespnclaude
andcommitted
test: port plugin checks to TypeScript + vitest, run via npm scripts
Replace the shell-based install checks in the workflow with a vitest suite runnable locally and in CI (hybrid model): - tests/unit/manifests.test.ts — fast structural assertions: manifest validity, shared version, keyword consistency (grok/kimi/copilot match the canonical Claude list), per-vendor X-Source-Name/Version, the Grok dedicated-file and Kimi-inline rules, and release-please wiring. - tests/integration/install.test.ts — installs the plugin into a sandboxed HOME once per supported target via the `plugins` CLI, plus Grok's native `grok plugin install`. Specs needing a native CLI (grok, copilot) skip when the binary is absent, so local runs without those tools stay green. package.json exposes `npm test` (unit) and `npm run test:install` (integration); the workflow now runs `npm ci` + the scripts, provisioning the Grok and Copilot CLIs for the install job. `plugins` is pinned as a devDep. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 758169b commit cd763a4

9 files changed

Lines changed: 1956 additions & 62 deletions

File tree

.github/workflows/validate-plugin-manifests.yml

Lines changed: 30 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ on:
55
branches:
66
- main
77

8-
env:
9-
# Pin the vendor-neutral installer so CI is deterministic; bump intentionally.
10-
PLUGINS_CLI_VERSION: "1.3.4"
11-
128
jobs:
139
validate:
1410
name: Validate Claude plugin manifest
@@ -26,29 +22,12 @@ jobs:
2622
- name: Validate plugin manifest
2723
run: npx -y @anthropic-ai/claude-code plugin validate .claude-plugin/plugin.json
2824

29-
install-via-plugins:
30-
# Verify every supported vendor is installable through the vendor-neutral
31-
# `plugins` CLI (https://www.npmjs.com/package/plugins). One leg per agent,
32-
# forced with --target so we exercise exactly that vendor's surface.
33-
# Gemini is intentionally omitted: it is not a `plugins` CLI target (it ships
34-
# as a Gemini extension via gemini-extension.json).
35-
name: Install via plugins CLI (${{ matrix.target }})
25+
test-unit:
26+
# Fast structural checks: manifest validity, version + keyword consistency,
27+
# per-vendor X-Source headers, the Kimi-inline / Grok-dedicated-file rules,
28+
# and release-please wiring. See tests/unit.
29+
name: Unit tests
3630
runs-on: ubuntu-latest
37-
strategy:
38-
fail-fast: false
39-
matrix:
40-
# Target ids per the plugins CLI docs (Supported targets table).
41-
target:
42-
- claude-code
43-
- cursor
44-
- codex
45-
- grok
46-
- kimi
47-
- github-copilot
48-
49-
env:
50-
NO_COLOR: "1"
51-
DO_NOT_TRACK: "1"
5231

5332
steps:
5433
- name: Check out repository
@@ -58,53 +37,42 @@ jobs:
5837
uses: actions/setup-node@v4
5938
with:
6039
node-version: 20
40+
cache: npm
6141

62-
# Grok and Copilot install through their native CLIs, so those binaries
63-
# must be present. The other targets are installed file-based and need no
64-
# extra tooling.
65-
- name: Install Grok Build CLI
66-
if: matrix.target == 'grok'
67-
run: |
68-
curl -fsSL https://x.ai/cli/install.sh | GROK_BIN_DIR="$HOME/.grokbin" bash
69-
echo "$HOME/.grokbin" >> "$GITHUB_PATH"
42+
- name: Install dependencies
43+
run: npm ci
7044

71-
- name: Install GitHub Copilot CLI
72-
if: matrix.target == 'github-copilot'
73-
run: npm install -g @github/copilot
45+
- name: Run unit tests
46+
run: npm test
7447

75-
- name: Install Supabase plugin via plugins CLI
76-
run: |
77-
npx -y "plugins@${PLUGINS_CLI_VERSION}" add . --target "${{ matrix.target }}" --yes 2>&1 | tee install.log
78-
grep -q "Installed" install.log
79-
80-
install-via-grok-cli:
81-
# Verify the plugin also installs through Grok Build's own CLI
82-
# (`grok plugin install`), independent of the plugins CLI. Grok natively
83-
# prefers .grok-plugin/plugin.json.
84-
#
85-
# Kimi Code has no equivalent headless native install: `/plugins install` is
86-
# an interactive TUI slash-command, and Kimi's only programmatic installer is
87-
# the `plugins` CLI (covered above), which writes Kimi's native plugin store
88-
# directly without invoking a `kimi` binary.
89-
name: Install via native Grok CLI
48+
test-install:
49+
# Installability checks: run the vendor-neutral `plugins` CLI once per
50+
# supported target, plus Grok's native `grok plugin install`. See
51+
# tests/integration. Grok and Copilot install through their native CLIs, so
52+
# this job provisions those binaries; the specs skip any CLI that is absent.
53+
name: Install tests
9054
runs-on: ubuntu-latest
9155

92-
env:
93-
NO_COLOR: "1"
94-
9556
steps:
9657
- name: Check out repository
9758
uses: actions/checkout@v4
9859

60+
- name: Set up Node.js
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: 20
64+
cache: npm
65+
66+
- name: Install dependencies
67+
run: npm ci
68+
9969
- name: Install Grok Build CLI
10070
run: |
10171
curl -fsSL https://x.ai/cli/install.sh | GROK_BIN_DIR="$HOME/.grokbin" bash
10272
echo "$HOME/.grokbin" >> "$GITHUB_PATH"
10373
104-
- name: Validate and install with grok plugin install
105-
run: |
106-
grok plugin validate .
107-
grok plugin install . --trust 2>&1 | tee grok-install.log
108-
grep -qi "supabase" grok-install.log
109-
grok plugin list 2>&1 | tee grok-list.log
110-
grep -qi "supabase" grok-list.log
74+
- name: Install GitHub Copilot CLI
75+
run: npm install -g @github/copilot
76+
77+
- name: Run install tests
78+
run: npm run test:install

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### Node ###
2+
node_modules/
3+
14
### Agents ###
25
CLAUDE.local.md
36
.claude/

AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ Validate the plugin manifest:
3232
npx claude plugin validate .claude-plugin/plugin.json
3333
```
3434

35+
Run the tests (see `tests/`):
36+
37+
```bash
38+
npm install # once, to install the dev dependencies
39+
npm test # fast structural checks (manifests, versions, keywords, MCP headers)
40+
npm run test:install # install each vendor via the `plugins` CLI + native Grok CLI
41+
```
42+
43+
`npm run test:install` installs the supabase plugin for every supported vendor into a sandboxed `HOME`. Specs that need a native CLI (`grok`, `copilot`) skip automatically when that binary is not on `PATH`; CI provisions them.
44+
3545
## Editing Rules
3646

3747
- Do not move `skills/`, `agents/`, `.claude-plugin/plugin.json`, `.cursor-plugin/plugin.json`, `.codex-plugin/plugin.json`, `.grok-plugin/plugin.json`, or `.kimi-plugin/plugin.json` out of the repo root layout.

0 commit comments

Comments
 (0)