SDK Developer CLI — Weavetab Docs — Weavetab Docs

Reference manual for the Weavetab developer CLI: init, build, manifest, dev, preflight, validate, doctor, and publish.

SDK Developer CLI — Weavetab Docs

Reference manual for the Weavetab developer CLI: init, build, manifest, dev, preflight, validate, doctor, and publish.

# SDK Developer CLI Reference

The `@weavetab/sdk` package provides a command-line interface for scaffolding, building, testing, auditing, and publishing Weavetab plugins.

You can run the CLI via `npx @weavetab/sdk <command>` or `weavetab <command>` when installed globally or in your npm scripts.

```bash
# Common workflow
weavetab init my-plugin      # 1. Scaffold project
cd my-plugin
weavetab dev                # 2. Develop in watch mode
weavetab preflight          # 3. Audit permissions & instructions budget
weavetab publish            # 4. Ship to registry & npm
```

---

## Command Reference

### `weavetab init [name] [--template <type>]`
Scaffolds a new plugin repository with strict TypeScript configuration, Zod validation, and a schema-compliant `weavetab.json` declaring inline agent instructions. Available templates: `standard`, `visual`, `scraper`, `automation`, `override`.

```bash
# Scaffold into a new directory
weavetab init my-custom-plugin

# Scaffold using a specific starter template
weavetab init my-visual-plugin --template visual

# Scaffold into current directory
weavetab init .
```

---

### `weavetab templates` (alias: `list-templates`)
Lists all 5 built-in starter plugin templates.

```bash
weavetab templates
```

---

### `weavetab build`
Compiles TypeScript source code (`src/` -> `dist/`), runs preflight audits, and automatically updates `weavetab.json` with extracted tool, command, prompt, and resource schemas.

```bash
weavetab build
```

---

### `weavetab dev`
Runs the TypeScript compiler in watch mode with automatic manifest synchronization on file change.

```bash
weavetab dev
```

---

### `weavetab manifest` (alias: `weavetab schema`)
Scans the compiled plugin entrypoint (`dist/index.js`) and synchronizes exported `tools`, `commands`, `prompts`, and `resources` directly into `weavetab.json`.

```bash
weavetab manifest
```

---

### `weavetab preflight [dir]`
Performs pre-publish quality, security, and context budget audits:
1. **Context Window Audit**: Verifies that agent `instructions` are declared in `weavetab.json` and stay within budget (`>= 20 chars`, `<= 3200 chars`, `<= 80 lines`).
2. **Permission Check**: Verifies that declared `tools`, `commands`, `prompts`, and `resources` have matching `permissions.<category>.add: true` grants in `weavetab.json` with valid `reason` strings.
3. **Anti-Squatting & Format Checks**: Rejects `id`/`agentsMd` manifest fields, validates prompt names and resource URI schemes, and guards against `entry` path traversal.
4. **Build Artifact Check**: Ensures the `entry` file exists on disk.

```bash
# Audit current working directory
weavetab-sdk preflight

# Audit a specific plugin directory
weavetab-sdk preflight ./my-plugin
```

---

### `weavetab validate`
Validates `weavetab.json` against the official JSON Schema (`https://weavetab.dev/schema/plugin.json`) and local manifest rules.

```bash
# Standard schema validation
weavetab-sdk validate

# Offline mode (skips remote schema fetch)
weavetab-sdk validate --offline
```

---

### `weavetab doctor`
Runs environment diagnostics across the current system:
- Verifies Node.js engine compatibility (`>= 20.19.0`).
- Checks TypeScript compiler presence and version.
- Validates local `~/.weavetab/` storage directory permissions.
- Inspects the current plugin manifest and exits with code `1` on failure.

```bash
weavetab-sdk doctor
```

---

### `weavetab publish`
Runs the preflight gate, executes `npm publish`, and POSTs `{ packageName }` to `https://weavetab.dev/api/plugins/sync`. Scaffolded projects wire this to `"release": "weavetab-sdk publish"` in `package.json` so `npm publish` does not recurse.

```bash
# Preview preflight and publish target without publishing
weavetab-sdk publish --dry-run

# Run preflight, publish to npm, and sync registry
npm run release
```

---

### `weavetab version`
Prints the active `@weavetab/sdk` version.

```bash
weavetab-sdk version
```

---

### `weavetab config` & `weavetab skills`
Prints command pointers to `npx -y @weavetab/mcp config` and `npx -y @weavetab/skills@latest`.

---

## Runtime Plugin Management (`@weavetab/mcp`)

Installing and managing plugins in the Weavetab runtime is handled by the `@weavetab/mcp` CLI:
- `weavetab plugin add <pkg>` (alias `install`)
- `weavetab plugin remove <pkg>` (alias `rm`)
- `weavetab plugin update [pkg]`
- `weavetab plugin list`
- `weavetab plugin info <pkg>` (alias `show`)
- `weavetab plugin enable <pkg>` / `weavetab plugin disable <pkg>`
- `weavetab plugin use <pkg> [cmd|instructions]` (shorthand: `weavetab use <pkg> [cmd]`)
- `weavetab plugin instructions [pkg]`, `browse`, `search <query>`, `verify <pkg>`

---

## Exit Codes

| Code | Meaning |
|---|---|
| `0` | Success / All checks passed. |
| `1` | Build, validation, preflight, doctor, or publish failure. |