Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
293 changes: 293 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
validate:
name: Validate plugin
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v2

- name: Resolve Antigravity CLI version
id: agy-version
run: |
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
manifest="$(curl -fsSL https://antigravity-cli-auto-updater-974169037036.us-central1.run.app/manifests/linux_amd64.json)"
version="$(printf '%s' "$manifest" | jq -r '.version')"
sha512="$(printf '%s' "$manifest" | jq -r '.sha512' | cut -c1-16)"
if [ -z "$version" ] || [ "$version" = "null" ] || [ -z "$sha512" ] || [ "$sha512" = "null" ]; then
echo "Failed to resolve Antigravity CLI version from manifest" >&2
exit 1
fi
echo "version=${version}-${sha512}" >> "$GITHUB_OUTPUT"

- name: Cache Antigravity CLI
id: cache-agy
uses: actions/cache@v4
with:
path: ~/.local/bin/agy
key: agy-cli-${{ runner.os }}-${{ runner.arch }}-${{ steps.agy-version.outputs.version }}

- name: Install Antigravity CLI
if: steps.cache-agy.outputs.cache-hit != 'true'
run: curl -fsSL https://antigravity.google/cli/install.sh | bash

- name: Verify Antigravity CLI version
run: agy --version

- name: Validate plugin with Antigravity CLI
run: |
AGY_HOME="$(mktemp -d)"
trap 'rm -rf "$AGY_HOME"' EXIT
HOME="$AGY_HOME" agy plugin validate .
HOME="$AGY_HOME" agy plugin install .
HOME="$AGY_HOME" agy plugin validate "$AGY_HOME/.gemini/config/plugins/pstack"
HOME="$AGY_HOME" agy plugin list --json > "$AGY_HOME/plugins.json"
AGY_PLUGINS_JSON="$AGY_HOME/plugins.json" bun -e '
import { readdirSync, readFileSync, existsSync, statSync } from "node:fs";
import { join, basename } from "node:path";

const errors = [];
const fail = (msg) => errors.push(msg);

const pluginJson = JSON.parse(readFileSync("plugin.json", "utf8"));
const agyPluginJson = JSON.parse(readFileSync(".antigravity-plugin/plugin.json", "utf8"));

const allowedPluginKeys = new Set([
"$schema",
"name",
"version",
"description",
"author",
"homepage",
"repository",
"license",
"keywords",
"extensions",
]);
for (const key of Object.keys(pluginJson)) {
if (!allowedPluginKeys.has(key)) {
fail(`plugin.json contains unsupported key "${key}"`);
}
}
if (pluginJson.$schema !== "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json") {
fail(`plugin.json $schema must be https://agent-plugins.org/schemas/1.0.0/plugin.schema.json`);
}
if (!/^(?!.*(?:--|\.\.))[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/.test(pluginJson.name ?? "")) {
fail(`plugin.json has invalid name "${pluginJson.name}"`);
}
for (const field of ["name", "version", "description"]) {
if (!pluginJson[field] || typeof pluginJson[field] !== "string") {
fail(`plugin.json missing string field "${field}"`);
}
if (pluginJson[field] !== agyPluginJson[field]) {
fail(`Manifest mismatch for "${field}": plugin.json="${pluginJson[field]}" vs .antigravity-plugin/plugin.json="${agyPluginJson[field]}"`);
}
}
if (!agyPluginJson.logo || !existsSync(agyPluginJson.logo)) {
fail(`.antigravity-plugin/plugin.json logo "${agyPluginJson.logo}" does not exist`);
}

const parseFrontmatter = (filePath) => {
const content = readFileSync(filePath, "utf8");
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n/);
if (!match) {
fail(`${filePath}: missing YAML frontmatter`);
return null;
}
return match[1];
};

const validateSkillDir = (skillsRoot) => {
const dirs = readdirSync(skillsRoot, { withFileTypes: true })
.filter((d) => d.isDirectory())
.map((d) => d.name)
.sort();
for (const dir of dirs) {
const skillFile = join(skillsRoot, dir, "SKILL.md");
if (!existsSync(skillFile)) {
fail(`${skillsRoot}/${dir}: missing SKILL.md`);
continue;
}
const fm = parseFrontmatter(skillFile);
if (!fm) continue;
const nameMatch = fm.match(/^name:\s*(.+)$/m);
const descMatch = fm.match(/^description:\s*(.+)$/m);
const skillName = nameMatch?.[1]?.trim();
if (skillName !== dir) {
fail(`${skillFile}: frontmatter name "${skillName}" does not match directory "${dir}"`);
}
if (!descMatch?.[1]?.trim()) {
fail(`${skillFile}: missing description in frontmatter`);
}
for (const badKey of ["paths", "icon", "color"]) {
if (new RegExp(`^${badKey}:`, "m").test(fm)) {
fail(`${skillFile}: unsupported top-level frontmatter key "${badKey}"`);
}
}
}
return dirs;
};

const expectedSkills = validateSkillDir("skills");
for (const autoEntry of readdirSync("automations", { withFileTypes: true })) {
if (!autoEntry.isDirectory()) continue;
const autoSkillsRoot = join("automations", autoEntry.name, "skills");
if (existsSync(autoSkillsRoot) && statSync(autoSkillsRoot).isDirectory()) {
validateSkillDir(autoSkillsRoot);
}
}

const validAgentTools = new Set([
"send_message",
"view_file",
"grep_search",
"find_by_name",
"list_dir",
"read_url_content",
"search_web",
"schedule",
"generate_image",
"multi_replace_file_content",
"replace_file_content",
"write_to_file",
"run_command",
"manage_task",
"notebook_edit",
"define_subagent",
"invoke_subagent",
"manage_subagents",
]);

const expectedAgents = readdirSync("agents")
.filter((f) => f.endsWith(".md"))
.sort();
for (const agentFile of expectedAgents) {
const fullPath = join("agents", agentFile);
const fm = parseFrontmatter(fullPath);
if (!fm) continue;
const expectedName = basename(agentFile, ".md");
const nameMatch = fm.match(/^name:\s*(.+)$/m);
const descMatch = fm.match(/^description:\s*(.+)$/m);
if (nameMatch?.[1]?.trim() !== expectedName) {
fail(`${fullPath}: frontmatter name "${nameMatch?.[1]?.trim()}" does not match "${expectedName}"`);
}
if (!descMatch?.[1]?.trim()) {
fail(`${fullPath}: missing description in frontmatter`);
}
for (const toolMatch of fm.matchAll(/^\s*-\s*([a-z0-9_]+)\s*$/gm)) {
const toolName = toolMatch[1];
if (!validAgentTools.has(toolName)) {
fail(`${fullPath}: unregistered Antigravity subagent tool "${toolName}"`);
}
}
}

const toKebab = (s) =>
s
.toLowerCase()
.replace(/[^a-z0-9\s-]/g, "")
.trim()
.replace(/\s+/g, "-");

const potetoSkill = readFileSync("skills/poteto-mode/SKILL.md", "utf8");
const principlesSection = potetoSkill.split("## Principles")[1]?.split("## Autonomy")[0] ?? "";
const playbooksSection = potetoSkill.split("## Playbooks")[1] ?? "";

const indexedPrinciples = new Set();
for (const line of principlesSection.split(/\r?\n/)) {
const m = line.match(/^- \*\*([^*]+?)\.?\*\*(?: \(\*\*(principle-[a-z0-9-]+)\*\*\))?/);
if (m) {
indexedPrinciples.add(m[2] ?? `principle-${toKebab(m[1])}`);
}
}
const diskPrinciples = new Set(expectedSkills.filter((s) => s.startsWith("principle-")));
for (const p of indexedPrinciples) {
if (!diskPrinciples.has(p)) fail(`skills/poteto-mode/SKILL.md references missing principle skill "${p}"`);
}
for (const p of diskPrinciples) {
if (!indexedPrinciples.has(p)) fail(`skills/${p} is not indexed in skills/poteto-mode/SKILL.md`);
}

const indexedPlaybooks = new Set();
for (const line of playbooksSection.split(/\r?\n/)) {
const m = line.match(/^- \*\*([^*]+?)\.\*\*(?:.*?File: `playbooks\/([^`]+)`)?/);
if (m) {
indexedPlaybooks.add(m[2] ?? `${toKebab(m[1])}.md`);
}
}
const diskPlaybooks = new Set(readdirSync("skills/poteto-mode/playbooks").filter((f) => f.endsWith(".md")));
for (const pb of indexedPlaybooks) {
if (!diskPlaybooks.has(pb)) fail(`skills/poteto-mode/SKILL.md references missing playbook "playbooks/${pb}"`);
}
for (const pb of diskPlaybooks) {
if (!indexedPlaybooks.has(pb)) fail(`skills/poteto-mode/playbooks/${pb} is not indexed in skills/poteto-mode/SKILL.md`);
}

const installedList = JSON.parse(readFileSync(process.env.AGY_PLUGINS_JSON, "utf8"));
const installed = installedList.find((p) => p.name === pluginJson.name);
if (!installed) {
fail(`agy plugin list --json did not include "${pluginJson.name}"`);
} else {
if (!installed.enabled) fail(`Installed plugin "${pluginJson.name}" is not enabled`);
if (installed.version !== pluginJson.version) {
fail(`Installed plugin version "${installed.version}" !== "${pluginJson.version}"`);
}
const loadedSkills = [...(installed.skills ?? [])].sort();
const loadedAgents = [...(installed.agents ?? [])].sort();
if (JSON.stringify(loadedSkills) !== JSON.stringify(expectedSkills)) {
fail(`Loaded skills mismatch: expected ${expectedSkills.length}, got ${loadedSkills.length}`);
}
if (JSON.stringify(loadedAgents) !== JSON.stringify(expectedAgents)) {
fail(`Loaded agents mismatch: expected ${JSON.stringify(expectedAgents)}, got ${JSON.stringify(loadedAgents)}`);
}
}

if (errors.length > 0) {
for (const err of errors) console.error(`ERROR: ${err}`);
process.exit(1);
}
console.log(`Validated ${expectedSkills.length} skills, ${expectedAgents.length} agents, and ${diskPlaybooks.size} playbooks.`);
'

- name: Check shell scripts
run: |
bash -n skills/poteto-mode/scripts/worktree-audit.sh
bash -n skills/show-me-your-work/scripts/log.sh

- name: Install script dependencies
working-directory: skills/poteto-mode/scripts
run: bun install --frozen-lockfile

- name: Typecheck scripts
working-directory: skills/poteto-mode/scripts
run: bun run typecheck

- name: Run script tests
working-directory: skills/poteto-mode/scripts
env:
GIT_CONFIG_COUNT: "1"
GIT_CONFIG_KEY_0: commit.gpgsign
GIT_CONFIG_VALUE_0: "false"
run: bun run test
Loading