# v2d Declarative Plugin Specification (schemaVersion: 2)

Official Site: https://v2d.illli.cc
Marketplace Registry: https://v2d.illli.cc/registry.json
Public Repository & Releases: https://github.com/illli-studio/v2d

## Local Plugin Directories (AI Agents Can Write Directly Here!)
- **Windows**: `%APPDATA%\dev.v2d.desktop\plugins\<id>\plugin.json`
- **macOS**: `~/Library/Application Support/dev.v2d.desktop/plugins/<id>/plugin.json`

After saving `plugin.json` to the folder above, click **Plugins → Scan** inside v2d Desktop (or restart) to load and sync the card to mobile immediately.

## Required Fields
- `schemaVersion`: `2`
- `id`: lowercase slug matching `/^[a-z0-9][a-z0-9-_]{0,48}$/`
- `name`: display name shown in desktop & mobile
- `version`: semver string, e.g. `"1.0.0"`
- `author`: GitHub handle
- `category`: `"ai"` | `"media"` | `"office"` | `"tools"`
- `description`: concise Chinese description (plus optional `descriptionEn` for English)
- `icon`: Emoji string (e.g. `"🎬"`, `"📊"`, `"🎵"`) OR `data:image/svg+xml;base64,...` OR inline `<svg ...>` (or place `icon.svg` next to `plugin.json`)
- `iconBg`: hex background color, e.g. `"#eef2ff"`
- `detect`:
  - `aliases`: string[]
  - `windowPatterns`: string[] (lowercase substrings matched against desktop window titles)
  - `startAppPatterns`: string[] (Windows StartApps matching keywords)
  - `exePaths`: string[] (supports `$HOME`, `$LOCALAPPDATA`, `$APPDATA`, `$PROGRAMFILES`, `$PROGRAMFILES86`)
  - `cliNames`: string[]
  - `sessionDirs`: string[]
  - `alwaysShowRunning`: boolean (set `true` for hotkey-driven or CLI apps)
- `hook`: `{ "schema": "none" | "nested" | "cursor", "configPaths": [], "events": [] }`
- `actions`: array of mobile deck buttons:
  - `id`, `label`, `hint?`, `icon?` (`window`|`voice`|`mic`|`check`|`stop`|`spark`|`send`|`refresh`|`left`|`right`|`translate`|`pen`|`command`), `kind` (`primary`|`secondary`|`danger`), `when` (`always`|`stopped`|`running`|`waiting_approval`|`running_or_wait`|`voice_active`|`running_no_voice`), `ui?` (`"compose"`), `autoMic?` (boolean)
  - `exec`:
    - `{ "type": "focus" }`
    - `{ "type": "hotkey", "chord": "Ctrl + Shift + R" }`
    - `{ "type": "send_text", "text": "继续" }` (omit `text` when `ui: "compose"`)
    - `{ "type": "uia", "target": "approve" | "stop" | "new_chat" | "voice" | "dictate" | "composer" }`
    - `{ "type": "reset" }`

## Contributing to the Official Marketplace
1. Fork https://github.com/illli-studio/v2d
2. Add `plugins/<id>/plugin.json` (and optional `icon.svg`)
3. Run `npm run build` (Node.js 18+, zero dependencies)
4. Open a Pull Request to `main`.
