$npx -y skills add dsifry/metaswarm --skill setupInteractive project setup — detects your project, configures metaswarm, writes project-local files
| 1 | # Setup |
| 2 | |
| 3 | Interactive setup for metaswarm. Detects your stack, asks targeted questions, writes project-local files, and creates platform-appropriate instruction files and command shims. Replaces both `npx metaswarm init` and the old `/metaswarm-setup` command. |
| 4 | |
| 5 | <CRITICAL-REQUIREMENTS> |
| 6 | Setup MUST produce the mandatory outputs for the active platform. A shell script handles them automatically — you MUST run it. |
| 7 | |
| 8 | After Phase 2 (user questions), determine the correct coverage command from the detection results, then run this Bash command: |
| 9 | |
| 10 | ```bash |
| 11 | PLUGIN_ROOT="${PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-${extensionPath:-}}}" |
| 12 | if [ -z "$PLUGIN_ROOT" ]; then |
| 13 | setup_script="$(find "${CODEX_HOME:-$HOME/.codex}/plugins/cache" -path '*/metaswarm/*/lib/setup-mandatory-files.sh' -print -quit 2>/dev/null)" |
| 14 | if [ -n "$setup_script" ]; then |
| 15 | PLUGIN_ROOT="$(cd "$(dirname "$setup_script")/.." && pwd)" |
| 16 | fi |
| 17 | fi |
| 18 | if [ -z "$PLUGIN_ROOT" ] && [ -f "$(pwd)/lib/setup-mandatory-files.sh" ]; then |
| 19 | PLUGIN_ROOT="$(pwd)" |
| 20 | fi |
| 21 | bash "${PLUGIN_ROOT}/lib/setup-mandatory-files.sh" "$(pwd)" <threshold> "<coverage-command>" --platform <platform> |
| 22 | ``` |
| 23 | |
| 24 | Where: |
| 25 | - `<threshold>` is the user's chosen percentage (e.g., `100`) |
| 26 | - `<coverage-command>` is the enforcement command for their test runner: |
| 27 | - pytest → `"pytest --cov --cov-fail-under=<threshold>"` |
| 28 | - vitest/pnpm → `"pnpm vitest run --coverage"` |
| 29 | - jest/npm → `"npx jest --coverage"` |
| 30 | - go → `"go test -coverprofile=coverage.out ./..."` |
| 31 | - cargo → `"cargo tarpaulin --fail-under <threshold>"` |
| 32 | - `<platform>` is `codex`, `claude`, `gemini`, or `all`. Prefer: |
| 33 | - `codex` when running in Codex (`PLUGIN_ROOT` or `CODEX_HOME` is present, or the user invoked `$setup`) |
| 34 | - `claude` when running in Claude Code (`CLAUDE_PLUGIN_ROOT` is present, or the setup skill was invoked there) |
| 35 | - `gemini` when running in Gemini (`extensionPath` is present, or the setup skill was invoked there) |
| 36 | - `all` only when the user explicitly asks to configure every supported CLI |
| 37 | |
| 38 | The script handles: |
| 39 | 1. **Instruction file** — `AGENTS.md` for Codex, `CLAUDE.md` for Claude, `GEMINI.md` for Gemini; appends metaswarm section (or writes new), skips if already present |
| 40 | 2. **`.coverage-thresholds.json`** — writes at project root with correct thresholds and command |
| 41 | 3. **Claude command shims** — for Claude/all only, writes `.claude/commands/start-task.md`, `prime.md`, `review-design.md`, `self-reflect.md`, `pr-shepherd.md`, `brainstorm.md` |
| 42 | |
| 43 | The script outputs JSON with what was created/skipped/errored. Check that `"status": "ok"`. |
| 44 | |
| 45 | **If the script is not available or fails**, fall back to writing these files manually with the Write tool. Do NOT skip them. |
| 46 | </CRITICAL-REQUIREMENTS> |
| 47 | |
| 48 | ## Pre-Flight |
| 49 | |
| 50 | ### Existing Profile Check |
| 51 | |
| 52 | Use Glob to check if `.metaswarm/project-profile.json` exists. |
| 53 | |
| 54 | - **If it exists**: Read it, present the current configuration summary, and ask the user via AskUserQuestion: "You already have a metaswarm project profile. Re-run setup (overwrites choices) or skip?" Options: "Re-run setup" / "Skip". If the user skips, stop with: "Setup skipped. Existing configuration unchanged." |
| 55 | - **If it does not exist**: Continue to Project Detection. |
| 56 | |
| 57 | --- |
| 58 | |
| 59 | ## Phase 1: Project Detection |
| 60 | |
| 61 | Scan the project directory silently using Glob and Read. Do NOT ask the user for any of this information. Detect everything, then present results. |
| 62 | |
| 63 | ### 1.1 Language |
| 64 | |
| 65 | Check for marker files at the project root: |
| 66 | |
| 67 | | Marker File | Language | |
| 68 | |---|---| |
| 69 | | `package.json` | Node.js / JavaScript | |
| 70 | | `tsconfig.json` | TypeScript (refines Node.js to TypeScript) | |
| 71 | | `pyproject.toml` OR `setup.py` OR `requirements.txt` | Python | |
| 72 | | `go.mod` | Go | |
| 73 | | `Cargo.toml` | Rust | |
| 74 | | `pom.xml` OR `build.gradle` OR `build.gradle.kts` | Java | |
| 75 | | `Gemfile` | Ruby | |
| 76 | | `Makefile` (alone, no other markers) | Unknown (ask user) | |
| 77 | |
| 78 | If `tsconfig.json` exists alongside `package.json`, the language is "TypeScript". |
| 79 | |
| 80 | If multiple languages are detected, note all of them but use the primary one (most infrastructure) for command generation. |
| 81 | |
| 82 | **If no language detected**: Use AskUserQuestion to ask the user what language/stack they are using before proceeding. |
| 83 | |
| 84 | ### 1.2 Framework |
| 85 | |
| 86 | **Node.js/TypeScript** — Read `package.json` and check `dependencies` + `devDependencies`: |
| 87 | |
| 88 | | Dependency | Framework | |
| 89 | |---|---| |
| 90 | | `next` | Next.js | |
| 91 | | `nuxt` OR `nuxt3` | Nuxt | |
| 92 | | `@angular/core` | Angular | |
| 93 | | `svelte` OR `@sveltejs/kit` | SvelteKit | |
| 94 | | `react` (without next/nuxt) | React | |
| 95 | | `vue` (without nuxt) | Vue | |
| 96 | | `express` | Express | |
| 97 | | `fastify` | Fastify | |
| 98 | | `hono` | Hono | |
| 99 | | `@nestjs/core` | NestJS | |
| 100 | |
| 101 | **Python** — Check `pyproject.toml` or `requirements.txt` for: `fastapi`, `django`, `flask`. |
| 102 | |
| 103 | **Go** — Read `go.mod` for: `github.com/gin-gonic/gin` (Gin), `github.com/labstack/echo` (Echo), `github.com/gofiber/fiber` (Fiber). |
| 104 | |
| 105 | If no framework detected, set to `null`. |
| 106 | |
| 107 | ### 1.3 |