agents-pkg 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -0
- package/bin/agents-pkg.mjs +3 -0
- package/dist/add-plugin.d.ts +14 -0
- package/dist/add-plugin.d.ts.map +1 -0
- package/dist/add-plugin.js +171 -0
- package/dist/add-plugin.js.map +1 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +74 -0
- package/dist/cli.js.map +1 -0
- package/dist/del-plugin.d.ts +5 -0
- package/dist/del-plugin.d.ts.map +1 -0
- package/dist/del-plugin.js +38 -0
- package/dist/del-plugin.js.map +1 -0
- package/dist/lib/constants.d.ts +17 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +17 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/errors.d.ts +5 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +8 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/hooks.d.ts +28 -0
- package/dist/lib/hooks.d.ts.map +1 -0
- package/dist/lib/hooks.js +85 -0
- package/dist/lib/hooks.js.map +1 -0
- package/dist/lib/lock.d.ts +19 -0
- package/dist/lib/lock.d.ts.map +1 -0
- package/dist/lib/lock.js +59 -0
- package/dist/lib/lock.js.map +1 -0
- package/dist/lib/marketplace.d.ts +33 -0
- package/dist/lib/marketplace.d.ts.map +1 -0
- package/dist/lib/marketplace.js +60 -0
- package/dist/lib/marketplace.js.map +1 -0
- package/dist/lib/paths.d.ts +14 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/paths.js +38 -0
- package/dist/lib/paths.js.map +1 -0
- package/dist/lib/source-dir.d.ts +15 -0
- package/dist/lib/source-dir.d.ts.map +1 -0
- package/dist/lib/source-dir.js +99 -0
- package/dist/lib/source-dir.js.map +1 -0
- package/dist/lib/symlink.d.ts +16 -0
- package/dist/lib/symlink.d.ts.map +1 -0
- package/dist/lib/symlink.js +68 -0
- package/dist/lib/symlink.js.map +1 -0
- package/dist/lib/types.d.ts +17 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +5 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/update.d.ts +5 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +60 -0
- package/dist/update.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# agents-pkg
|
|
2
|
+
|
|
3
|
+
A wrapper around the [skills](https://github.com/vercel-labs/skills) CLI for **Cursor** and **Claude Code**. It keeps the same config location (`~/.agents/`) and folder layout each app expects, and adds **subagents** and **commands** management for both.
|
|
4
|
+
|
|
5
|
+
- **Skills** — Pass-through to `npx skills` (e.g. `agents-pkg skills add owner/repo`) with `--agent cursor claude-code` by default.
|
|
6
|
+
- **Subagents** — Agent definition files (`.md`) in `.cursor/agents` and `.claude/agents`.
|
|
7
|
+
- **Commands** — Slash commands in `.cursor/commands` and `.claude/commands`.
|
|
8
|
+
- **Hooks** — Cursor only: `.cursor/hooks.json` (Claude uses a different hooks setup and is not managed here).
|
|
9
|
+
|
|
10
|
+
**Note:** `--agent` (cursor, claude-code) is which *app* to install skills to. Subagents are the `.md` agent files in those apps’ agent dirs — a different concept.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g agents-pkg
|
|
18
|
+
# or
|
|
19
|
+
pnpm add -g agents-pkg
|
|
20
|
+
# or run without installing
|
|
21
|
+
npx agents-pkg --help
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Requires:** Node.js 18+
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Config
|
|
29
|
+
|
|
30
|
+
| Item | Location |
|
|
31
|
+
|------|----------|
|
|
32
|
+
| Lock file | `~/.agents/.agents-pkg-lock.json` (same parent as skills’ `.skill-lock.json`) |
|
|
33
|
+
| Schema | `{ "version": 1, "agents": { ... }, "sources": { "owner/repo": { "source", "repoHash", "options", "updatedAt" } } }` |
|
|
34
|
+
|
|
35
|
+
Override home for tests: set `AGENTS_PKG_HOME` to a temp directory.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
### Install from a repo (all at once)
|
|
42
|
+
|
|
43
|
+
Pass a **source** (GitHub `owner/repo`, git URL, or local path). By default this installs **skills**, **subagents**, **commands**, and **hooks** (Cursor only) from that repo. Use flags to install only what you want:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
agents-pkg owner/repo # install skills + subagents + commands + hooks
|
|
47
|
+
agents-pkg owner/repo --subagents --hooks # only subagents and hooks
|
|
48
|
+
agents-pkg ./my-local-repo --skills # only skills from local path
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The repo is expected to follow the [repo layout convention](#repo-layout-convention-for-install-from-source) below.
|
|
52
|
+
|
|
53
|
+
### Skills (pass-through to `npx skills`)
|
|
54
|
+
|
|
55
|
+
Under the `skills` command, all of these are forwarded to `npx skills` with **`--agent cursor claude-code`** unless you pass `--agent` yourself.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
agents-pkg skills add vercel-labs/agent-skills
|
|
59
|
+
agents-pkg skills remove <skill>
|
|
60
|
+
agents-pkg skills list
|
|
61
|
+
agents-pkg skills find
|
|
62
|
+
agents-pkg skills check
|
|
63
|
+
agents-pkg skills update
|
|
64
|
+
agents-pkg skills init [name]
|
|
65
|
+
agents-pkg skills experimental_install
|
|
66
|
+
agents-pkg skills experimental_sync
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Subagents (Cursor + Claude)
|
|
70
|
+
|
|
71
|
+
Subagents are `.md` files in `.cursor/agents` and `.claude/agents`. **Source** can be: omitted (stub), a local path, an HTTP(S) URL, or GitHub `owner/repo/path/to/file.md`.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
agents-pkg subagents list
|
|
75
|
+
agents-pkg subagents add <name> [source] # add -g for global dirs too
|
|
76
|
+
agents-pkg subagents remove <name>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Commands (slash commands)
|
|
80
|
+
|
|
81
|
+
Slash commands live in `.cursor/commands` and `.claude/commands`. Same **source** options as subagents.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
agents-pkg commands list
|
|
85
|
+
agents-pkg commands add <name> [source] # add -g for global dirs too
|
|
86
|
+
agents-pkg commands remove <name>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Hooks (Cursor only)
|
|
90
|
+
|
|
91
|
+
Hooks run shell commands at lifecycle events in Cursor (`.cursor/hooks.json`). Claude uses a different setup and is not managed here. See [Cursor hooks](https://cursor.com/docs/agent/third-party-hooks) for event names (e.g. `beforeShellExecution`, `afterFileEdit`).
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
agents-pkg hooks list
|
|
95
|
+
agents-pkg hooks add <hookName> <command> # e.g. hooks add beforeShellExecution ./check.sh; add -g for global
|
|
96
|
+
agents-pkg hooks remove <hookName>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Update
|
|
100
|
+
|
|
101
|
+
`agents-pkg update` runs **skills update** (so all skills installed via `npx skills` are updated), then checks each **tracked GitHub source** (repos you installed from with `agents-pkg owner/repo`). For each repo, it fetches the current default-branch tree hash from the GitHub API; if the hash changed, it re-installs from that source (skills, subagents, commands, hooks per the options used when you first installed). Local-path installs are not tracked for update.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
agents-pkg update
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Tracking is stored in the lock file (`~/.agents/.agents-pkg-lock.json` under `sources`). Optional: set `GITHUB_TOKEN` or `GH_TOKEN` for higher API rate limits.
|
|
108
|
+
|
|
109
|
+
### Agents and config
|
|
110
|
+
|
|
111
|
+
Custom install targets (in the lock file) and path info:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
agents-pkg agents list
|
|
115
|
+
agents-pkg agents add <name> <projectDir> [globalDir]
|
|
116
|
+
agents-pkg agents remove <name>
|
|
117
|
+
agents-pkg config path
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Repo layout convention (install from source)
|
|
123
|
+
|
|
124
|
+
When you run `agents-pkg owner/repo` (or any source), agents-pkg looks for these directories in the repo:
|
|
125
|
+
|
|
126
|
+
| Category | Location in repo | Contents |
|
|
127
|
+
|-----------|--------------------|----------|
|
|
128
|
+
| Skills | `skills/` | Directory the skills CLI can use: a single `SKILL.md` or subdirs each with `SKILL.md`. |
|
|
129
|
+
| Subagents | `agents/` | One `.md` file per subagent; filename (without `.md`) is the name. |
|
|
130
|
+
| Commands | `commands/` | One `.md` file per command; filename (without `.md`) is the name. |
|
|
131
|
+
| Hooks | `hooks/hooks.json` | Cursor-style JSON: `{ "version": 1, "hooks": { "hookName": [{ "command": "path" }] } }`. Merged into project `.cursor/hooks.json` only (Cursor only). |
|
|
132
|
+
|
|
133
|
+
If a path is missing, that category is skipped. Use `--skills`, `--subagents`, `--commands`, or `--hooks` to install only the categories you want.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Folder layout (where agents-pkg installs)
|
|
138
|
+
|
|
139
|
+
| Kind | Cursor (project / global) | Claude (project / global) |
|
|
140
|
+
|-----------|----------------------------------------|----------------------------------------|
|
|
141
|
+
| Skills | `.agents/skills` / `~/.cursor/skills` | `.claude/skills` / `~/.claude/skills` |
|
|
142
|
+
| Subagents | `.cursor/agents` / `~/.cursor/agents` | `.claude/agents` / `~/.claude/agents` |
|
|
143
|
+
| Commands | `.cursor/commands` / `~/.cursor/commands` | `.claude/commands` / `~/.claude/commands` |
|
|
144
|
+
| Hooks | `.cursor/hooks.json` / `~/.cursor/hooks.json` (Cursor only) | — |
|
|
145
|
+
|
|
146
|
+
Claude’s global config root can be overridden with `CLAUDE_CONFIG_DIR` (default `~/.claude`).
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
TypeScript, build to `dist/`, tests with **vitest**.
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
pnpm install
|
|
156
|
+
pnpm build # Compile src/ → dist/
|
|
157
|
+
pnpm dev -- --help # Run from source (tsx)
|
|
158
|
+
pnpm test # pretest runs build, then vitest
|
|
159
|
+
pnpm type-check # tsc --noEmit
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**Tests:** Lock file (read/write, version, `AGENTS_PKG_HOME`), source resolution (stub, local path, literal), subagents and commands (list/add/remove), CLI (help, version, subagents list, commands list, config path).
|
|
163
|
+
|
|
164
|
+
### CI and publishing
|
|
165
|
+
|
|
166
|
+
- **CI** (`.github/workflows/ci.yml`): On push/PR to `main`, runs type-check, build, and tests. Ignores changes that only touch `*.md`.
|
|
167
|
+
- **Publish** (`.github/workflows/publish.yml`): Same model as the [skills](https://github.com/vercel-labs/skills) repo.
|
|
168
|
+
- **Push to main**: Include `[patch]` or `[minor]` in a commit message; the workflow bumps the version, pushes the new commit and tag, publishes to npm, and creates a GitHub Release.
|
|
169
|
+
- **Manual**: Actions → Publish → Run workflow, then choose **patch** or **minor** to bump and release.
|
|
170
|
+
- **Tag push**: Pushing a tag `v*` triggers a publish-only run (no bump; the tag must already point to a commit with that version in `package.json`).
|
|
171
|
+
|
|
172
|
+
Add an **NPM_TOKEN** secret (Settings → Secrets and variables → Actions): create an [npm access token](https://www.npmjs.com/settings/~/tokens) (automation type) and add it as `NPM_TOKEN`.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## License
|
|
177
|
+
|
|
178
|
+
MIT
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* add-plugin — Cursor only. Install marketplace from source.
|
|
3
|
+
* Reads .cursor-plugin/marketplace.json inside the source; copies plugin dirs to store and symlinks into .cursor/*.
|
|
4
|
+
*/
|
|
5
|
+
import { type MarketplaceManifest } from './lib/marketplace.js';
|
|
6
|
+
/**
|
|
7
|
+
* Install marketplace from an already-resolved source dir. Used by add-plugin and update.
|
|
8
|
+
* Returns list of installed plugin names.
|
|
9
|
+
*/
|
|
10
|
+
export declare function installMarketplaceFromDir(manifest: MarketplaceManifest, sourceDir: string, options?: {
|
|
11
|
+
pluginNameFilter?: string;
|
|
12
|
+
}): Promise<string[]>;
|
|
13
|
+
export declare function runAddPlugin(args: string[]): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=add-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-plugin.d.ts","sourceRoot":"","sources":["../src/add-plugin.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AA0G9B;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAO,GAC1C,OAAO,CAAC,MAAM,EAAE,CAAC,CAqCnB;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAqChE"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* add-plugin — Cursor only. Install marketplace from source.
|
|
3
|
+
* Reads .cursor-plugin/marketplace.json inside the source; copies plugin dirs to store and symlinks into .cursor/*.
|
|
4
|
+
*/
|
|
5
|
+
import { join, resolve, sep } from 'path';
|
|
6
|
+
import { readdir, readFile, stat, cp } from 'fs/promises';
|
|
7
|
+
import { resolveSourceToDir } from './lib/source-dir.js';
|
|
8
|
+
import { readMarketplaceManifest, getPluginStorePath, } from './lib/marketplace.js';
|
|
9
|
+
import { REPO_SKILLS_DIR, REPO_AGENTS_DIR, REPO_COMMANDS_DIR, REPO_HOOKS_FILE, } from './lib/constants.js';
|
|
10
|
+
import { getCursorAgentsDir, getCursorCommandsDir, getCursorSkillsDir } from './lib/paths.js';
|
|
11
|
+
import { createSymlink } from './lib/symlink.js';
|
|
12
|
+
import { mergeHooksIntoProject } from './lib/hooks.js';
|
|
13
|
+
import { readLock, writeLock } from './lib/lock.js';
|
|
14
|
+
import { fatal } from './lib/errors.js';
|
|
15
|
+
function isContainedIn(childPath, parentPath) {
|
|
16
|
+
const normalizedParent = resolve(parentPath) + sep;
|
|
17
|
+
const normalizedChild = resolve(childPath);
|
|
18
|
+
return normalizedChild === resolve(parentPath) || normalizedChild.startsWith(normalizedParent);
|
|
19
|
+
}
|
|
20
|
+
async function listMdFiles(dir) {
|
|
21
|
+
try {
|
|
22
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
23
|
+
return entries
|
|
24
|
+
.filter((e) => e.isFile() && e.name.endsWith('.md'))
|
|
25
|
+
.map((e) => e.name.replace(/\.md$/, ''));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function listSkillDirs(skillsDir) {
|
|
32
|
+
try {
|
|
33
|
+
const st = await stat(skillsDir);
|
|
34
|
+
if (!st.isDirectory())
|
|
35
|
+
return [];
|
|
36
|
+
const entries = await readdir(skillsDir, { withFileTypes: true });
|
|
37
|
+
const names = [];
|
|
38
|
+
for (const e of entries) {
|
|
39
|
+
if (!e.isDirectory())
|
|
40
|
+
continue;
|
|
41
|
+
try {
|
|
42
|
+
const st2 = await stat(join(skillsDir, e.name, 'SKILL.md'));
|
|
43
|
+
if (st2.isFile())
|
|
44
|
+
names.push(e.name);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// no SKILL.md
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return names;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return [];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Copy plugin dir to store, then create symlinks for agents, commands, skills; merge hooks.
|
|
58
|
+
*/
|
|
59
|
+
async function installPlugin(pluginStorePath, cursorAgentsDir, cursorCommandsDir, cursorSkillsDir, cwd) {
|
|
60
|
+
const done = [];
|
|
61
|
+
const agentsDir = join(pluginStorePath, REPO_AGENTS_DIR);
|
|
62
|
+
const agentNames = await listMdFiles(agentsDir);
|
|
63
|
+
for (const name of agentNames) {
|
|
64
|
+
const target = join(agentsDir, name + '.md');
|
|
65
|
+
const linkPath = join(cursorAgentsDir, name + '.md');
|
|
66
|
+
await createSymlink(target, linkPath);
|
|
67
|
+
}
|
|
68
|
+
if (agentNames.length > 0)
|
|
69
|
+
done.push('agents');
|
|
70
|
+
const commandsDir = join(pluginStorePath, REPO_COMMANDS_DIR);
|
|
71
|
+
const commandNames = await listMdFiles(commandsDir);
|
|
72
|
+
for (const name of commandNames) {
|
|
73
|
+
const target = join(commandsDir, name + '.md');
|
|
74
|
+
const linkPath = join(cursorCommandsDir, name + '.md');
|
|
75
|
+
await createSymlink(target, linkPath);
|
|
76
|
+
}
|
|
77
|
+
if (commandNames.length > 0)
|
|
78
|
+
done.push('commands');
|
|
79
|
+
const skillsDir = join(pluginStorePath, REPO_SKILLS_DIR);
|
|
80
|
+
const skillNames = await listSkillDirs(skillsDir);
|
|
81
|
+
for (const name of skillNames) {
|
|
82
|
+
const target = join(skillsDir, name);
|
|
83
|
+
const linkPath = join(cursorSkillsDir, name);
|
|
84
|
+
await createSymlink(target, linkPath);
|
|
85
|
+
}
|
|
86
|
+
if (skillNames.length > 0)
|
|
87
|
+
done.push('skills');
|
|
88
|
+
const hooksPath = join(pluginStorePath, REPO_HOOKS_FILE);
|
|
89
|
+
try {
|
|
90
|
+
const raw = await readFile(hooksPath, 'utf-8');
|
|
91
|
+
const repoHooks = JSON.parse(raw);
|
|
92
|
+
if (repoHooks.hooks && typeof repoHooks.hooks === 'object' && Object.keys(repoHooks.hooks).length > 0) {
|
|
93
|
+
await mergeHooksIntoProject(repoHooks, cwd);
|
|
94
|
+
done.push('hooks');
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
// no hooks or invalid
|
|
99
|
+
}
|
|
100
|
+
return done;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Install marketplace from an already-resolved source dir. Used by add-plugin and update.
|
|
104
|
+
* Returns list of installed plugin names.
|
|
105
|
+
*/
|
|
106
|
+
export async function installMarketplaceFromDir(manifest, sourceDir, options = {}) {
|
|
107
|
+
let pluginsToInstall = manifest.plugins;
|
|
108
|
+
if (options.pluginNameFilter) {
|
|
109
|
+
pluginsToInstall = manifest.plugins.filter((p) => p.name === options.pluginNameFilter);
|
|
110
|
+
if (pluginsToInstall.length === 0) {
|
|
111
|
+
fatal(`Plugin "${options.pluginNameFilter}" not found in marketplace. Available: ${manifest.plugins.map((p) => p.name).join(', ')}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const absSourceDir = resolve(sourceDir);
|
|
115
|
+
const cwd = process.cwd();
|
|
116
|
+
const cursorAgentsDir = getCursorAgentsDir(false, cwd);
|
|
117
|
+
const cursorCommandsDir = getCursorCommandsDir(false, cwd);
|
|
118
|
+
const cursorSkillsDir = getCursorSkillsDir(true, cwd);
|
|
119
|
+
const installed = [];
|
|
120
|
+
for (const plugin of pluginsToInstall) {
|
|
121
|
+
const pluginDir = join(sourceDir, plugin.source);
|
|
122
|
+
const absPluginDir = resolve(pluginDir);
|
|
123
|
+
if (!isContainedIn(absPluginDir, absSourceDir)) {
|
|
124
|
+
fatal(`Plugin source "${plugin.source}" is outside the marketplace directory.`);
|
|
125
|
+
}
|
|
126
|
+
const storePath = getPluginStorePath(manifest.name, plugin.name);
|
|
127
|
+
const { mkdir } = await import('fs/promises');
|
|
128
|
+
await mkdir(storePath, { recursive: true });
|
|
129
|
+
await cp(pluginDir, storePath, { recursive: true });
|
|
130
|
+
const done = await installPlugin(storePath, cursorAgentsDir, cursorCommandsDir, cursorSkillsDir, cwd);
|
|
131
|
+
if (done.length > 0)
|
|
132
|
+
installed.push(plugin.name);
|
|
133
|
+
}
|
|
134
|
+
return installed;
|
|
135
|
+
}
|
|
136
|
+
export async function runAddPlugin(args) {
|
|
137
|
+
const source = args[0]?.trim();
|
|
138
|
+
if (!source) {
|
|
139
|
+
fatal('Usage: agents-pkg add-plugin <source> [plugin-name]\n source = repo URL or local path; optional plugin-name = install only that plugin.');
|
|
140
|
+
}
|
|
141
|
+
const pluginNameFilter = args[1]?.trim();
|
|
142
|
+
const { path: sourceDir, cleanup } = await resolveSourceToDir(source).catch((e) => {
|
|
143
|
+
fatal(e instanceof Error ? e.message : String(e));
|
|
144
|
+
});
|
|
145
|
+
try {
|
|
146
|
+
const manifest = await readMarketplaceManifest(sourceDir);
|
|
147
|
+
const version = manifest.metadata?.version ?? '0.0.0';
|
|
148
|
+
const installed = await installMarketplaceFromDir(manifest, sourceDir, {
|
|
149
|
+
pluginNameFilter: pluginNameFilter || undefined,
|
|
150
|
+
});
|
|
151
|
+
if (installed.length === 0) {
|
|
152
|
+
console.log(`No agents, commands, skills, or hooks found in the selected plugin(s).`);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
console.log(`Installed marketplace "${manifest.name}" (v${version}): ${installed.join(', ')}.`);
|
|
156
|
+
const lock = await readLock();
|
|
157
|
+
lock.marketplaces[manifest.name] = {
|
|
158
|
+
name: manifest.name,
|
|
159
|
+
source,
|
|
160
|
+
version,
|
|
161
|
+
pluginNames: installed,
|
|
162
|
+
updatedAt: new Date().toISOString(),
|
|
163
|
+
};
|
|
164
|
+
await writeLock(lock);
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
if (cleanup)
|
|
168
|
+
await cleanup();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+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;YAC3B,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;YACtF,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,0BAA0B,QAAQ,CAAC,IAAI,OAAO,OAAO,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEhG,MAAM,IAAI,GAAG,MAAM,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG;YACjC,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,MAAM;YACN,OAAO;YACP,WAAW,EAAE,SAAS;YACtB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC;QACF,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;YAAS,CAAC;QACT,IAAI,OAAO;YAAE,MAAM,OAAO,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* agents-pkg — Cursor-only marketplace installer.
|
|
4
|
+
* Commands: add-plugin <source> [plugin-name], del-plugin <name>, update.
|
|
5
|
+
*/
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { readFileSync } from 'fs';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import { fatal } from './lib/errors.js';
|
|
10
|
+
import { runAddPlugin } from './add-plugin.js';
|
|
11
|
+
import { runDelPlugin } from './del-plugin.js';
|
|
12
|
+
import { runUpdate } from './update.js';
|
|
13
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
function getVersion() {
|
|
15
|
+
try {
|
|
16
|
+
const pkgPath = join(__dirname, '..', 'package.json');
|
|
17
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
18
|
+
return pkg.version ?? '0.1.0';
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return '0.1.0';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function showBanner() {
|
|
25
|
+
console.log('agents-pkg — Cursor marketplace installer');
|
|
26
|
+
console.log('');
|
|
27
|
+
console.log('Usage: agents-pkg <command> [options]');
|
|
28
|
+
console.log('');
|
|
29
|
+
console.log('Commands:');
|
|
30
|
+
console.log(' add-plugin <source> [plugin-name] Install marketplace from source (read .cursor-plugin/marketplace.json inside source); all plugins or one by name');
|
|
31
|
+
console.log(' del-plugin <name> Uninstall marketplace by name');
|
|
32
|
+
console.log(' update Re-fetch each installed marketplace and reinstall if version changed');
|
|
33
|
+
console.log('');
|
|
34
|
+
console.log('Examples:');
|
|
35
|
+
console.log(' agents-pkg add-plugin https://gitlab.com/org/ai-kit');
|
|
36
|
+
console.log(' agents-pkg add-plugin ./local-repo ai-engineering-kit-backend');
|
|
37
|
+
console.log(' agents-pkg del-plugin ai-engineering-kit');
|
|
38
|
+
console.log(' agents-pkg update');
|
|
39
|
+
}
|
|
40
|
+
async function main() {
|
|
41
|
+
const argv = process.argv.slice(2);
|
|
42
|
+
if (argv.length === 0) {
|
|
43
|
+
showBanner();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const command = argv[0];
|
|
47
|
+
const rest = argv.slice(1);
|
|
48
|
+
switch (command) {
|
|
49
|
+
case 'add-plugin':
|
|
50
|
+
await runAddPlugin(rest);
|
|
51
|
+
break;
|
|
52
|
+
case 'del-plugin':
|
|
53
|
+
await runDelPlugin(rest);
|
|
54
|
+
break;
|
|
55
|
+
case 'update':
|
|
56
|
+
await runUpdate();
|
|
57
|
+
break;
|
|
58
|
+
case '--help':
|
|
59
|
+
case '-h':
|
|
60
|
+
showBanner();
|
|
61
|
+
break;
|
|
62
|
+
case '--version':
|
|
63
|
+
case '-v':
|
|
64
|
+
console.log(getVersion());
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
fatal('Unknown command: ' + command + '\nRun agents-pkg --help for usage.');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
main().catch((err) => {
|
|
71
|
+
console.error(err);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACtD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAyB,CAAC;QAC/E,OAAO,GAAG,CAAC,OAAO,IAAI,OAAO,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAA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AK,QAAQ;YACX,MAAM,SAAS,EAAE,CAAC;YAClB,MAAM;QAER,KAAK,QAAQ,CAAC;QACd,KAAK,IAAI;YACP,UAAU,EAAE,CAAC;YACb,MAAM;QAER,KAAK,WAAW,CAAC;QACjB,KAAK,IAAI;YACP,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;YAC1B,MAAM;QAER;YACE,KAAK,CAAC,mBAAmB,GAAG,OAAO,GAAG,oCAAoC,CAAC,CAAC;IAChF,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"del-plugin.d.ts","sourceRoot":"","sources":["../src/del-plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BhE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* del-plugin — Uninstall a marketplace by name (remove symlinks, delete store, update lock).
|
|
3
|
+
*/
|
|
4
|
+
import { rm } from 'fs/promises';
|
|
5
|
+
import { getCursorAgentsDir, getCursorCommandsDir, getCursorSkillsDir } from './lib/paths.js';
|
|
6
|
+
import { getMarketplaceStorePath } from './lib/marketplace.js';
|
|
7
|
+
import { removeSymlinksInDirPointingUnder } from './lib/symlink.js';
|
|
8
|
+
import { readLock, writeLock } from './lib/lock.js';
|
|
9
|
+
import { fatal } from './lib/errors.js';
|
|
10
|
+
export async function runDelPlugin(args) {
|
|
11
|
+
const name = args[0]?.trim();
|
|
12
|
+
if (!name) {
|
|
13
|
+
fatal('Usage: agents-pkg del-plugin <name>\n name = marketplace name (e.g. ai-engineering-kit).');
|
|
14
|
+
}
|
|
15
|
+
const lock = await readLock();
|
|
16
|
+
const entry = lock.marketplaces[name];
|
|
17
|
+
if (!entry) {
|
|
18
|
+
fatal(`Marketplace "${name}" is not installed.`);
|
|
19
|
+
}
|
|
20
|
+
const storeRoot = getMarketplaceStorePath(name);
|
|
21
|
+
const cwd = process.cwd();
|
|
22
|
+
const cursorAgentsDir = getCursorAgentsDir(false, cwd);
|
|
23
|
+
const cursorCommandsDir = getCursorCommandsDir(false, cwd);
|
|
24
|
+
const cursorSkillsDir = getCursorSkillsDir(true, cwd);
|
|
25
|
+
await removeSymlinksInDirPointingUnder(cursorAgentsDir, storeRoot);
|
|
26
|
+
await removeSymlinksInDirPointingUnder(cursorCommandsDir, storeRoot);
|
|
27
|
+
await removeSymlinksInDirPointingUnder(cursorSkillsDir, storeRoot);
|
|
28
|
+
try {
|
|
29
|
+
await rm(storeRoot, { recursive: true, force: true });
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
console.warn(`Could not remove store at ${storeRoot}:`, e instanceof Error ? e.message : String(e));
|
|
33
|
+
}
|
|
34
|
+
delete lock.marketplaces[name];
|
|
35
|
+
await writeLock(lock);
|
|
36
|
+
console.log(`Removed marketplace "${name}".`);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=del-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"del-plugin.js","sourceRoot":"","sources":["../src/del-plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,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,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACtG,CAAC;IAED,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,SAAS,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,IAAI,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for agents-pkg (marketplace-only, Cursor).
|
|
3
|
+
* Same parent dir as skills: ~/.agents/
|
|
4
|
+
*/
|
|
5
|
+
export declare const AGENTS_DIR = ".agents";
|
|
6
|
+
export declare const LOCK_FILE = ".agents-pkg-lock.json";
|
|
7
|
+
export declare const CURRENT_LOCK_VERSION = 1;
|
|
8
|
+
/** Marketplace store under ~/.agents/agents-pkg/marketplace/<name>/<plugin-name> */
|
|
9
|
+
export declare const MARKETPLACE_DIR = "agents-pkg/marketplace";
|
|
10
|
+
/** Path relative to resolved source dir: .cursor-plugin/marketplace.json */
|
|
11
|
+
export declare const MARKETPLACE_JSON = ".cursor-plugin/marketplace.json";
|
|
12
|
+
/** Plugin layout inside each plugin dir (agents, commands, skills, hooks) */
|
|
13
|
+
export declare const REPO_SKILLS_DIR = "skills";
|
|
14
|
+
export declare const REPO_AGENTS_DIR = "agents";
|
|
15
|
+
export declare const REPO_COMMANDS_DIR = "commands";
|
|
16
|
+
export declare const REPO_HOOKS_FILE = "hooks/hooks.json";
|
|
17
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,UAAU,YAAY,CAAC;AACpC,eAAO,MAAM,SAAS,0BAA0B,CAAC;AACjD,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,oFAAoF;AACpF,eAAO,MAAM,eAAe,2BAA2B,CAAC;AAExD,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,oCAAoC,CAAC;AAElE,6EAA6E;AAC7E,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAC5C,eAAO,MAAM,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for agents-pkg (marketplace-only, Cursor).
|
|
3
|
+
* Same parent dir as skills: ~/.agents/
|
|
4
|
+
*/
|
|
5
|
+
export const AGENTS_DIR = '.agents';
|
|
6
|
+
export const LOCK_FILE = '.agents-pkg-lock.json';
|
|
7
|
+
export const CURRENT_LOCK_VERSION = 1;
|
|
8
|
+
/** Marketplace store under ~/.agents/agents-pkg/marketplace/<name>/<plugin-name> */
|
|
9
|
+
export const MARKETPLACE_DIR = 'agents-pkg/marketplace';
|
|
10
|
+
/** Path relative to resolved source dir: .cursor-plugin/marketplace.json */
|
|
11
|
+
export const MARKETPLACE_JSON = '.cursor-plugin/marketplace.json';
|
|
12
|
+
/** Plugin layout inside each plugin dir (agents, commands, skills, hooks) */
|
|
13
|
+
export const REPO_SKILLS_DIR = 'skills';
|
|
14
|
+
export const REPO_AGENTS_DIR = 'agents';
|
|
15
|
+
export const REPO_COMMANDS_DIR = 'commands';
|
|
16
|
+
export const REPO_HOOKS_FILE = 'hooks/hooks.json';
|
|
17
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC;AACpC,MAAM,CAAC,MAAM,SAAS,GAAG,uBAAuB,CAAC;AACjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC,oFAAoF;AACpF,MAAM,CAAC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AAExD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,iCAAiC,CAAC;AAElE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AACxC,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAG5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hooks = Cursor .cursor/hooks.json only.
|
|
3
|
+
* Claude uses a different setup (.claude/settings.json, different format); not managed here.
|
|
4
|
+
* Format: { "version": 1, "hooks": { "hookName": [ { "command": "path/to/script" } ] } }
|
|
5
|
+
*/
|
|
6
|
+
export interface HooksJson {
|
|
7
|
+
version?: number;
|
|
8
|
+
hooks: Record<string, Array<{
|
|
9
|
+
command: string;
|
|
10
|
+
}>>;
|
|
11
|
+
}
|
|
12
|
+
export interface HooksOptions {
|
|
13
|
+
cwd?: string;
|
|
14
|
+
global?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ListHooksResult {
|
|
17
|
+
project: string[];
|
|
18
|
+
global: string[];
|
|
19
|
+
all: string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function listHooks(options?: HooksOptions): Promise<ListHooksResult>;
|
|
22
|
+
export declare function addHook(hookName: string, command: string, options?: HooksOptions): Promise<void>;
|
|
23
|
+
export declare function removeHook(hookName: string, options?: HooksOptions): Promise<boolean>;
|
|
24
|
+
/**
|
|
25
|
+
* Merge repo hooks into project .cursor/hooks.json (Cursor only).
|
|
26
|
+
*/
|
|
27
|
+
export declare function mergeHooksIntoProject(repoHooks: HooksJson, cwd: string): Promise<void>;
|
|
28
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/lib/hooks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf;AAsBD,wBAAsB,SAAS,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAYpF;AAED,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAWf;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAa/F;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAe5F"}
|