agent-plugkit 0.1.0

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.
Files changed (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +295 -0
  3. package/dist/adapters/agent-plugins.d.ts +35 -0
  4. package/dist/adapters/agent-plugins.js +57 -0
  5. package/dist/adapters/agent-plugins.js.map +1 -0
  6. package/dist/adapters/claude.d.ts +64 -0
  7. package/dist/adapters/claude.js +123 -0
  8. package/dist/adapters/claude.js.map +1 -0
  9. package/dist/adapters/cli-validation.d.ts +12 -0
  10. package/dist/adapters/cli-validation.js +31 -0
  11. package/dist/adapters/cli-validation.js.map +1 -0
  12. package/dist/adapters/codex.d.ts +62 -0
  13. package/dist/adapters/codex.js +91 -0
  14. package/dist/adapters/codex.js.map +1 -0
  15. package/dist/adapters/marketplace-registration.d.ts +17 -0
  16. package/dist/adapters/marketplace-registration.js +369 -0
  17. package/dist/adapters/marketplace-registration.js.map +1 -0
  18. package/dist/adapters/marketplace.d.ts +11 -0
  19. package/dist/adapters/marketplace.js +96 -0
  20. package/dist/adapters/marketplace.js.map +1 -0
  21. package/dist/adapters/mcp.d.ts +17 -0
  22. package/dist/adapters/mcp.js +28 -0
  23. package/dist/adapters/mcp.js.map +1 -0
  24. package/dist/application/artifact-generation.d.ts +58 -0
  25. package/dist/application/artifact-generation.js +344 -0
  26. package/dist/application/artifact-generation.js.map +1 -0
  27. package/dist/application/local-release.d.ts +122 -0
  28. package/dist/application/local-release.js +940 -0
  29. package/dist/application/local-release.js.map +1 -0
  30. package/dist/application/marketplace-document-contract.d.ts +81 -0
  31. package/dist/application/marketplace-document-contract.js +2 -0
  32. package/dist/application/marketplace-document-contract.js.map +1 -0
  33. package/dist/application/marketplace-document.d.ts +45 -0
  34. package/dist/application/marketplace-document.js +557 -0
  35. package/dist/application/marketplace-document.js.map +1 -0
  36. package/dist/application/marketplace-registration-contract.d.ts +51 -0
  37. package/dist/application/marketplace-registration-contract.js +11 -0
  38. package/dist/application/marketplace-registration-contract.js.map +1 -0
  39. package/dist/application/marketplace-registration.d.ts +20 -0
  40. package/dist/application/marketplace-registration.js +304 -0
  41. package/dist/application/marketplace-registration.js.map +1 -0
  42. package/dist/application/marketplace.d.ts +9 -0
  43. package/dist/application/marketplace.js +32 -0
  44. package/dist/application/marketplace.js.map +1 -0
  45. package/dist/application/plugin-components-contract.d.ts +135 -0
  46. package/dist/application/plugin-components-contract.js +2 -0
  47. package/dist/application/plugin-components-contract.js.map +1 -0
  48. package/dist/application/plugin-components.d.ts +17 -0
  49. package/dist/application/plugin-components.js +1000 -0
  50. package/dist/application/plugin-components.js.map +1 -0
  51. package/dist/application/plugin-document-contract.d.ts +115 -0
  52. package/dist/application/plugin-document-contract.js +2 -0
  53. package/dist/application/plugin-document-contract.js.map +1 -0
  54. package/dist/application/plugin-document.d.ts +69 -0
  55. package/dist/application/plugin-document.js +1037 -0
  56. package/dist/application/plugin-document.js.map +1 -0
  57. package/dist/application/plugin-lifecycle-contract.d.ts +230 -0
  58. package/dist/application/plugin-lifecycle-contract.js +3 -0
  59. package/dist/application/plugin-lifecycle-contract.js.map +1 -0
  60. package/dist/application/plugin-lifecycle.d.ts +8 -0
  61. package/dist/application/plugin-lifecycle.js +1375 -0
  62. package/dist/application/plugin-lifecycle.js.map +1 -0
  63. package/dist/application/plugin-scaffold.d.ts +18 -0
  64. package/dist/application/plugin-scaffold.js +188 -0
  65. package/dist/application/plugin-scaffold.js.map +1 -0
  66. package/dist/application/plugin-source.d.ts +39 -0
  67. package/dist/application/plugin-source.js +59 -0
  68. package/dist/application/plugin-source.js.map +1 -0
  69. package/dist/application/skill-document-contract.d.ts +92 -0
  70. package/dist/application/skill-document-contract.js +8 -0
  71. package/dist/application/skill-document-contract.js.map +1 -0
  72. package/dist/application/skill-document-guided.d.ts +3 -0
  73. package/dist/application/skill-document-guided.js +53 -0
  74. package/dist/application/skill-document-guided.js.map +1 -0
  75. package/dist/application/skill-document.d.ts +19 -0
  76. package/dist/application/skill-document.js +368 -0
  77. package/dist/application/skill-document.js.map +1 -0
  78. package/dist/application/workspace-create-contract.d.ts +50 -0
  79. package/dist/application/workspace-create-contract.js +16 -0
  80. package/dist/application/workspace-create-contract.js.map +1 -0
  81. package/dist/application/workspace-create.d.ts +8 -0
  82. package/dist/application/workspace-create.js +656 -0
  83. package/dist/application/workspace-create.js.map +1 -0
  84. package/dist/application/workspace-health-contract.d.ts +133 -0
  85. package/dist/application/workspace-health-contract.js +272 -0
  86. package/dist/application/workspace-health-contract.js.map +1 -0
  87. package/dist/application/workspace-health.d.ts +10 -0
  88. package/dist/application/workspace-health.js +1114 -0
  89. package/dist/application/workspace-health.js.map +1 -0
  90. package/dist/application/workspace-operation-contract.d.ts +99 -0
  91. package/dist/application/workspace-operation-contract.js +450 -0
  92. package/dist/application/workspace-operation-contract.js.map +1 -0
  93. package/dist/application/workspace-operation.d.ts +42 -0
  94. package/dist/application/workspace-operation.js +517 -0
  95. package/dist/application/workspace-operation.js.map +1 -0
  96. package/dist/cli.d.ts +16 -0
  97. package/dist/cli.js +136 -0
  98. package/dist/cli.js.map +1 -0
  99. package/dist/commands/add.d.ts +8 -0
  100. package/dist/commands/add.js +77 -0
  101. package/dist/commands/add.js.map +1 -0
  102. package/dist/commands/build.d.ts +7 -0
  103. package/dist/commands/build.js +29 -0
  104. package/dist/commands/build.js.map +1 -0
  105. package/dist/commands/component-scaffold.d.ts +4 -0
  106. package/dist/commands/component-scaffold.js +14 -0
  107. package/dist/commands/component-scaffold.js.map +1 -0
  108. package/dist/commands/import-skill.d.ts +15 -0
  109. package/dist/commands/import-skill.js +41 -0
  110. package/dist/commands/import-skill.js.map +1 -0
  111. package/dist/commands/index-gen.d.ts +12 -0
  112. package/dist/commands/index-gen.js +33 -0
  113. package/dist/commands/index-gen.js.map +1 -0
  114. package/dist/commands/init-repo.d.ts +8 -0
  115. package/dist/commands/init-repo.js +53 -0
  116. package/dist/commands/init-repo.js.map +1 -0
  117. package/dist/commands/init.d.ts +9 -0
  118. package/dist/commands/init.js +33 -0
  119. package/dist/commands/init.js.map +1 -0
  120. package/dist/commands/install-repo.d.ts +20 -0
  121. package/dist/commands/install-repo.js +200 -0
  122. package/dist/commands/install-repo.js.map +1 -0
  123. package/dist/commands/release-local.d.ts +9 -0
  124. package/dist/commands/release-local.js +27 -0
  125. package/dist/commands/release-local.js.map +1 -0
  126. package/dist/commands/validate.d.ts +8 -0
  127. package/dist/commands/validate.js +45 -0
  128. package/dist/commands/validate.js.map +1 -0
  129. package/dist/core/errors.d.ts +5 -0
  130. package/dist/core/errors.js +12 -0
  131. package/dist/core/errors.js.map +1 -0
  132. package/dist/generated/skill-content.d.ts +3 -0
  133. package/dist/generated/skill-content.js +9 -0
  134. package/dist/generated/skill-content.js.map +1 -0
  135. package/dist/infrastructure/authorized-path.d.ts +20 -0
  136. package/dist/infrastructure/authorized-path.js +85 -0
  137. package/dist/infrastructure/authorized-path.js.map +1 -0
  138. package/dist/infrastructure/document-commit.d.ts +165 -0
  139. package/dist/infrastructure/document-commit.js +1352 -0
  140. package/dist/infrastructure/document-commit.js.map +1 -0
  141. package/dist/infrastructure/process-runner.d.ts +29 -0
  142. package/dist/infrastructure/process-runner.js +130 -0
  143. package/dist/infrastructure/process-runner.js.map +1 -0
  144. package/dist/infrastructure/vscode-user-settings.d.ts +42 -0
  145. package/dist/infrastructure/vscode-user-settings.js +509 -0
  146. package/dist/infrastructure/vscode-user-settings.js.map +1 -0
  147. package/dist/schema/plugin-yaml.d.ts +89 -0
  148. package/dist/schema/plugin-yaml.js +241 -0
  149. package/dist/schema/plugin-yaml.js.map +1 -0
  150. package/dist/utils/frontmatter.d.ts +30 -0
  151. package/dist/utils/frontmatter.js +60 -0
  152. package/dist/utils/frontmatter.js.map +1 -0
  153. package/dist/utils/helpers.d.ts +44 -0
  154. package/dist/utils/helpers.js +94 -0
  155. package/dist/utils/helpers.js.map +1 -0
  156. package/package.json +56 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 agent-plugkit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,295 @@
1
+ # agent-plugkit
2
+
3
+ `agent-plugkit` is a CLI-first toolkit for building and maintaining AI agent plugin marketplaces.
4
+
5
+ It lets you keep plugin metadata in one declarative `plugin.yaml`, then generate an [Agent Plugins 1.0](https://agent-plugins.org/specification) portable package, Claude Code and Codex native artifacts, and client marketplace indexes from that source.
6
+
7
+ ## Why
8
+
9
+ AI coding agent ecosystems now have rules sync tools, Agent Skills, content marketplaces, MCP registries, and platform-native plugin formats. `agent-plugkit` focuses on one narrower job: helping teams operate a structured plugin marketplace repository without hand-editing every platform manifest.
10
+
11
+ It is not a rules synchronizer like Ruler or LNAI, and it is not a content catalog like wshobson/agents. It is the maintenance toolchain for your own marketplace.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npx agent-plugkit --help
17
+ ```
18
+
19
+ For a repository that wants a pinned version:
20
+
21
+ ```bash
22
+ npm install --save-dev agent-plugkit
23
+ ```
24
+
25
+ ## Commands
26
+
27
+ ```bash
28
+ npx agent-plugkit init-repo [name] --organization "Team Name" [--no-plugkit]
29
+ npx agent-plugkit init <plugin-name> --type <skill|mcp|lsp|hook>
30
+ npx agent-plugkit add <skill|mcp|lsp|hook> <plugin-name> <component-name>
31
+ npx agent-plugkit import-skill <source-dir> [plugin-name] [--description "..."] [--author "..."]
32
+ npx agent-plugkit build [plugin-name] --all
33
+ npx agent-plugkit index
34
+ npx agent-plugkit validate [plugin-name] --all
35
+ npx agent-plugkit release-local
36
+ npx agent-plugkit install-repo <git-repo|local-path> [--agent <agent>...] [--all]
37
+ ```
38
+
39
+ Use `--root <dir>` when running from outside a marketplace repository:
40
+
41
+ ```bash
42
+ npx agent-plugkit --root /path/to/marketplace validate --all
43
+ ```
44
+
45
+ ## Marketplace Shape
46
+
47
+ ```text
48
+ .
49
+ ├── marketplace.yaml
50
+ ├── plugins/
51
+ │ ├── plugkit/
52
+ │ │ ├── plugin.yaml
53
+ │ │ └── skills/
54
+ │ │ ├── setup/
55
+ │ │ │ └── SKILL.md
56
+ │ │ └── maintain/
57
+ │ │ └── SKILL.md
58
+ │ └── my-plugin/
59
+ │ ├── plugin.yaml
60
+ │ ├── plugin.json
61
+ │ ├── mcp.json # only when MCP servers are declared
62
+ │ └── skills/
63
+ ├── .github/plugin/marketplace.json
64
+ ├── .cursor-plugin/marketplace.json
65
+ ├── .claude-plugin/marketplace.json
66
+ ├── .agents/plugins/marketplace.json
67
+ └── marketplace.json
68
+ ```
69
+
70
+ Each plugin owns a `plugin.yaml`:
71
+
72
+ ```yaml
73
+ name: my-plugin
74
+ version: "0.1.0"
75
+ description: "Describe the plugin"
76
+ author:
77
+ name: "Team Name"
78
+ category: tooling
79
+ tags: []
80
+
81
+ components:
82
+ skills:
83
+ - name: my-plugin
84
+ path: skills/my-plugin
85
+ description: "Skill description"
86
+
87
+ platform:
88
+ codex:
89
+ interface:
90
+ displayName: "My Plugin"
91
+ capabilities: ["Interactive", "Write"]
92
+ defaultPrompt:
93
+ - "Help me use My Plugin."
94
+ ```
95
+
96
+ The canonical `name` is also the portable package identifier: use 2–64 lowercase letters,
97
+ digits, or single hyphens, with an alphanumeric first and last character; consecutive `--` is
98
+ rejected before any Agent Plugins manifest is generated.
99
+
100
+ `platform.codex.interface` is optional. `capabilities` is an array of non-empty strings;
101
+ `defaultPrompt` accepts one to three non-empty strings of at most 128 characters each. When these
102
+ fields are omitted, the Codex adapter emits `capabilities: []` and a safe
103
+ `defaultPrompt: ["Help me use <Display Name>."]` fallback. Optional `author.email` and `author.url`
104
+ are omitted from the Codex manifest when they are not declared instead of being written as empty
105
+ strings.
106
+
107
+ Supported components:
108
+
109
+ - `skills`: Agent Skills instruction directories discovered strictly as `skills/<name>/SKILL.md`; `validate` checks the required frontmatter, directory/name match, and declared/discovered set.
110
+ - `mcp`: MCP server metadata. Legacy or explicit `stdio` supports `command`, `args`, `env`, and `cwd`; `streamable-http` and `sse` support `url` and `headers`.
111
+ - `hooks`: Claude Code hook configuration. The current Codex ingestion manifest does not accept a `hooks` field, so the Codex adapter deliberately omits it.
112
+ - `lsp`: Claude Code LSP configuration. Pair it with a skill when Codex strategy guidance is needed.
113
+
114
+ Optional portable metadata can be declared as `homepage`, `repository`, and `license` alongside the existing author and tag fields. Transport path, URL, and header safety is validated before delivery; invalid servers are never silently dropped or converted to another transport. MCP `env` and `headers` are visible package data, not portable secret or OAuth mechanisms—do not place credentials in them.
115
+
116
+ ## Agent Plugins and Client Marketplaces
117
+
118
+ `agent-plugkit build` emits the fixed Agent Plugins 1.0.0 portable contract at each plugin root:
119
+
120
+ - `plugin.json` with the canonical 1.0.0 schema identifier.
121
+ - `skills/<name>/SKILL.md` as the protocol-discovered Skill set.
122
+ - `mcp.json` when MCP servers are declared.
123
+
124
+ Agent Plugins 1.0 standardizes portable Skills and MCP servers. Hooks, LSP configuration, installation sources, registries, and marketplace/update policy remain client-specific. That boundary follows the [Agent Plugins client implementer guidance](https://agent-plugins.org/client-implementers); the client indexes below are distribution adapters, not fields in the portable manifest.
125
+
126
+ After a repository is available to its intended users, `install-repo` registers its generated
127
+ indexes with selected clients:
128
+
129
+ ```bash
130
+ npx agent-plugkit install-repo OWNER/REPO
131
+ npx agent-plugkit install-repo OWNER/REPO --agent claude --agent codex
132
+ npx agent-plugkit install-repo /absolute/path/to/marketplace --all
133
+ ```
134
+
135
+ Without `--agent` or `--all`, an interactive terminal shows a numbered multi-select and defaults to
136
+ the targets that can currently be handled automatically. Non-interactive callers must pass an
137
+ explicit selection. Target IDs are `claude`, `codex`, `copilot`, `vscode`, and `cursor`; repeated
138
+ `--agent` values are deduplicated and `--all` includes Cursor.
139
+
140
+ Client behavior is deliberately adapter-specific:
141
+
142
+ - Claude Code runs `claude plugin marketplace add <source>` after probing that exact command.
143
+ - Codex runs `codex plugin marketplace add <source>` after probing that exact command.
144
+ - GitHub Copilot runs `copilot plugin marketplace add <source>` after probing that exact command.
145
+ - VS Code atomically updates the current user's JSONC `settings.json`, enables
146
+ `chat.plugins.enabled`, and deduplicates `chat.plugins.marketplaces`. Local directories are stored
147
+ as `file://` URIs. Comments, trailing commas, indentation, unrelated settings, and the existing
148
+ file mode are preserved. Only a safe absolute user configuration root and lossless UTF-8 input
149
+ are accepted. If deduplication cannot retain existing comments, or the file is malformed or
150
+ a revision/guard check detects a concurrent change, registration fails without overwriting it.
151
+ This is a pure Node best-effort transaction rather than filesystem compare-and-swap: an
152
+ uncooperative writer that atomically replaces the path with a new inode after the last observable
153
+ check but before either candidate commit or guard-content recovery rename can still be overwritten.
154
+ Failure output therefore directs users to inspect the current file instead of claiming every
155
+ failure left the original untouched. A local Marketplace cannot contain, equal, or resolve through
156
+ a symlink to the selected VS Code user settings path.
157
+ - Cursor remains selectable but returns a manual task: Team/Enterprise administrators use
158
+ Dashboard → Plugins → Add Marketplace → Import from Repo. No private cache, database, or
159
+ undocumented Cursor command is touched.
160
+
161
+ Accepted sources are an existing local directory, `owner/repo`, an HTTPS Git URL, or an SSH Git
162
+ URL. Missing path-like inputs, ambiguous bare values, option-like values, non-HTTPS Web URLs, and
163
+ sources containing C0/C1/DEL control characters (including percent-decoded URL controls), dot-only
164
+ Git shorthand segments, or embedded URL credentials are rejected before any client action. A local directory must already contain the selected client's generated index;
165
+ `install-repo` never builds or repairs it.
166
+
167
+ Each target is processed in a fixed order and a failure does not stop later targets unless a user or
168
+ child-process interrupt occurs. The final text summary uses explicit labels such as `[完成]`,
169
+ `[缺少 CLI]`, `[需手动]`, and `[失败]`:
170
+
171
+ | Exit code | Meaning |
172
+ | --- | --- |
173
+ | `0` | Every selected target completed registration or VS Code configuration injection |
174
+ | `2` | At least one target completed and at least one target is missing, manual, or failed |
175
+ | `1` | No target completed, or source/argument preflight failed |
176
+ | `130` | The user or a client process interrupted the run |
177
+
178
+ The generated indexes still support direct client flows when needed:
179
+
180
+ - GitHub Copilot CLI checks root `marketplace.json` before `.github/plugin/marketplace.json`; `agent-plugkit` emits the same client-compatible bytes at both paths so the legacy root mirror cannot shadow the canonical GitHub index. The Claude path remains a client fallback:
181
+
182
+ ```bash
183
+ copilot plugin marketplace add OWNER/REPO
184
+ copilot plugin install PLUGIN_NAME@MARKETPLACE_NAME
185
+ ```
186
+
187
+ - VS Code can register the same Git marketplace in `settings.json`, then install from the Agent Plugins view or Agent Customizations editor:
188
+
189
+ ```json
190
+ {
191
+ "chat.plugins.marketplaces": ["OWNER/REPO"]
192
+ }
193
+ ```
194
+
195
+ - Cursor Team/Enterprise can use Dashboard → Plugins → Add Marketplace → Import from Repo. Cursor detects the root Agent Plugins `plugin.json` for entries referenced by `.cursor-plugin/marketplace.json`.
196
+
197
+ `install-repo` performs only current-user Marketplace registration or VS Code configuration. It
198
+ does not push or publish a Git repository, build or modify the source, install a missing client CLI,
199
+ import into Cursor automatically, or install any plugin from the Marketplace. `release-local` only
200
+ creates a checked local directory and tar archive.
201
+
202
+ ## Importing an Existing Skill
203
+
204
+ `agent-plugkit import-skill <source-dir> [plugin-name]` turns a skill that already exists on disk into a new, single-skill plugin — no template placeholders to fill in by hand.
205
+
206
+ ```bash
207
+ npx agent-plugkit import-skill ~/.claude/skills/dataviz
208
+ npx agent-plugkit import-skill ~/.claude/skills/dataviz custom-name --description "..." --author "..."
209
+ ```
210
+
211
+ - **One skill in, one plugin out.** It always creates a brand-new plugin (`plugins/<name>/`); it does not add a skill to an existing plugin and does not import multiple skills in one call.
212
+ - **Two local source shapes are accepted**: a directory containing `SKILL.md` directly, or an existing plugin-shaped directory with a `skills/` subfolder — when that subfolder holds exactly one skill, it is selected automatically. Pointing at a single `SKILL.md` file or a remote git/npm source is not supported.
213
+ - **`SKILL.md` is copied byte-for-byte and never rewritten.** `plugin.yaml` metadata (`name`, `description`, `argument-hint`) is derived from the source `SKILL.md` frontmatter, with `[plugin-name]`, `--description`, and `--author` as explicit overrides. Any mismatch between the frontmatter and the derived plugin name is reported as a warning, not silently fixed by editing the source file.
214
+ - Like `init` and `add`, it only prints next-step guidance (`build` / `validate`) — it does not run them automatically.
215
+
216
+ ## Generated Artifacts
217
+
218
+ `agent-plugkit build` writes plugin-level artifacts:
219
+
220
+ - `plugins/**/plugin.json`
221
+ - `plugins/**/mcp.json` (when MCP servers are declared)
222
+ - `plugins/**/.claude-plugin/plugin.json`
223
+ - `plugins/**/.codex-plugin/plugin.json`
224
+ - `plugins/**/.mcp.json`
225
+ - `plugins/**/.lsp.json`
226
+ - `plugins/**/hooks/hooks.json`
227
+
228
+ `agent-plugkit index` writes marketplace-level artifacts:
229
+
230
+ - `.github/plugin/marketplace.json`
231
+ - `.cursor-plugin/marketplace.json`
232
+ - `.claude-plugin/marketplace.json`
233
+ - `.agents/plugins/marketplace.json`
234
+ - `marketplace.json`
235
+ - `plugins/CATALOG.md`
236
+
237
+ Generated files should be regenerated, not edited by hand.
238
+
239
+ ## Recommended Scripts
240
+
241
+ `agent-plugkit init-repo` writes scripts like these:
242
+
243
+ ```json
244
+ {
245
+ "scripts": {
246
+ "mp": "npx agent-plugkit",
247
+ "validate:plugins": "npx agent-plugkit validate --all",
248
+ "build:plugins": "npx agent-plugkit build --all",
249
+ "build:index": "npx agent-plugkit index",
250
+ "build:all": "npm run build:plugins && npm run build:index",
251
+ "ci:local": "npm run build:all && npm run validate:plugins",
252
+ "release:local": "npm run ci:local && npx agent-plugkit release-local"
253
+ }
254
+ }
255
+ ```
256
+
257
+ ## This Monorepo Includes a Marketplace
258
+
259
+ `agent-plugkit` dogfoods itself through the monorepo's `marketplace/` workspace, currently hosting the official `plugkit` maintenance plugin and the bundled `mermaid-render` visualization plugin. All canonical YAML, plugins, generated indexes, and local release artifacts live under that workspace.
260
+
261
+ The repository root deliberately does not mirror marketplace discovery files. Clients may use a checkout's `marketplace/` directory as a local marketplace; registering this whole Git repository as a remote marketplace is not supported. Remote distribution requires publishing that workspace as its own repository or equivalent marketplace root.
262
+
263
+ ### Mermaid Render
264
+
265
+ `mermaid-render@0.2.0` turns Mermaid into a designed visual through two independent paths: editable `html`, or direct `imagent` image creation that may actively illustrate individual nodes. Imagent does not render, screenshot, or imitate an HTML intermediate.
266
+
267
+ The built-in art directions are Swiss Style, Neo-Brutalism, and JAPANESE MA. They are concise design definitions with a few Good/Bad cases—not fixed templates, reference-image hashes, layout algorithms, or theme presets—so the Agent retains room to make diagram-specific visual decisions.
268
+
269
+ ## Development
270
+
271
+ ```bash
272
+ npm install
273
+ npm run build
274
+ npm test
275
+ npm run mp:check # build --all + index + validate --all against marketplace/
276
+ npm run pack:cli
277
+ ```
278
+
279
+ ### Desktop status
280
+
281
+ The previous private desktop workspace was removed on 2026-08-15. The current product and
282
+ distribution surface is CLI-only. Historical desktop specifications and design evidence remain
283
+ for traceability, but they are superseded by
284
+ [ADR-0006](https://github.com/agent-plugkit/agent-plugkit/blob/main/docs/adr/0006-remove-desktop-implementation.md); any future desktop rebuild starts from
285
+ a new confirmed product, design, and engineering contract.
286
+
287
+ The public contract is the CLI, `marketplace.yaml`, `plugin.yaml`, and generated marketplace artifacts. Internal TypeScript functions are intentionally not documented as a Node library API yet (see [ADR-0001](https://github.com/agent-plugkit/agent-plugkit/blob/main/docs/adr/0001-cli-only-public-contract.md)).
288
+
289
+ ## Project Docs
290
+
291
+ - [`AGENTS.md`](https://github.com/agent-plugkit/agent-plugkit/blob/main/AGENTS.md) — repository rules, architecture boundaries, and definition of done.
292
+ - [`docs/architecture/overview.md`](https://github.com/agent-plugkit/agent-plugkit/blob/main/docs/architecture/overview.md) — layering, invariants, and known debt.
293
+ - [`docs/product/`](https://github.com/agent-plugkit/agent-plugkit/tree/main/docs/product) — positioning, roadmap, market research, risks.
294
+ - [`docs/release/`](https://github.com/agent-plugkit/agent-plugkit/tree/main/docs/release) — release plan and gates.
295
+ - [`specs/`](https://github.com/agent-plugkit/agent-plugkit/tree/main/specs) — per-iteration scope, specs, and task lists.
@@ -0,0 +1,35 @@
1
+ import type { PluginYaml } from '../schema/plugin-yaml.js';
2
+ export declare const AGENT_PLUGINS_VERSION = "1.0.0";
3
+ export declare const AGENT_PLUGIN_SCHEMA_ID: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json";
4
+ export declare const AGENT_PLUGIN_MCP_SCHEMA_ID: "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json";
5
+ export interface AgentPluginManifest {
6
+ $schema: typeof AGENT_PLUGIN_SCHEMA_ID;
7
+ name: string;
8
+ version?: string;
9
+ description?: string;
10
+ author?: {
11
+ name: string;
12
+ email?: string;
13
+ url?: string;
14
+ };
15
+ homepage?: string;
16
+ repository?: string;
17
+ license?: string;
18
+ keywords?: string[];
19
+ }
20
+ export interface AgentPluginMcpConfig {
21
+ $schema: typeof AGENT_PLUGIN_MCP_SCHEMA_ID;
22
+ mcpServers: Record<string, {
23
+ type: 'stdio';
24
+ command: string;
25
+ args?: string[];
26
+ env?: Record<string, string>;
27
+ cwd?: string;
28
+ } | {
29
+ type: 'streamable-http' | 'sse';
30
+ url: string;
31
+ headers?: Record<string, string>;
32
+ }>;
33
+ }
34
+ export declare function buildAgentPluginManifest(config: PluginYaml): AgentPluginManifest;
35
+ export declare function buildAgentPluginMcpConfig(config: PluginYaml): AgentPluginMcpConfig | null;
@@ -0,0 +1,57 @@
1
+ import { isStdioMcp } from './mcp.js';
2
+ export const AGENT_PLUGINS_VERSION = '1.0.0';
3
+ export const AGENT_PLUGIN_SCHEMA_ID = `https://agent-plugins.org/schemas/${AGENT_PLUGINS_VERSION}/plugin.schema.json`;
4
+ export const AGENT_PLUGIN_MCP_SCHEMA_ID = `https://agent-plugins.org/schemas/${AGENT_PLUGINS_VERSION}/mcp.schema.json`;
5
+ export function buildAgentPluginManifest(config) {
6
+ return {
7
+ $schema: AGENT_PLUGIN_SCHEMA_ID,
8
+ name: config.name,
9
+ version: config.version,
10
+ description: config.description,
11
+ author: {
12
+ name: config.author.name,
13
+ ...(typeof config.author.email === 'string'
14
+ ? { email: config.author.email }
15
+ : {}),
16
+ ...(typeof config.author.url === 'string'
17
+ ? { url: config.author.url }
18
+ : {}),
19
+ },
20
+ ...(typeof config.homepage === 'string'
21
+ ? { homepage: config.homepage }
22
+ : {}),
23
+ ...(typeof config.repository === 'string'
24
+ ? { repository: config.repository }
25
+ : {}),
26
+ ...(typeof config.license === 'string' ? { license: config.license } : {}),
27
+ ...(config.tags ? { keywords: config.tags } : {}),
28
+ };
29
+ }
30
+ export function buildAgentPluginMcpConfig(config) {
31
+ const mcps = config.components.mcp;
32
+ if (!mcps || mcps.length === 0)
33
+ return null;
34
+ const servers = {};
35
+ for (const mcp of mcps) {
36
+ if (isStdioMcp(mcp)) {
37
+ servers[mcp.name] = {
38
+ type: 'stdio',
39
+ command: mcp.command,
40
+ ...(mcp.args ? { args: mcp.args } : {}),
41
+ ...(mcp.env ? { env: mcp.env } : {}),
42
+ ...(mcp.cwd ? { cwd: mcp.cwd } : {}),
43
+ };
44
+ continue;
45
+ }
46
+ servers[mcp.name] = {
47
+ type: mcp.type,
48
+ url: mcp.url,
49
+ ...(mcp.headers ? { headers: mcp.headers } : {}),
50
+ };
51
+ }
52
+ return {
53
+ $schema: AGENT_PLUGIN_MCP_SCHEMA_ID,
54
+ mcpServers: servers,
55
+ };
56
+ }
57
+ //# sourceMappingURL=agent-plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-plugins.js","sourceRoot":"","sources":["../../src/adapters/agent-plugins.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAC7C,MAAM,CAAC,MAAM,sBAAsB,GACjC,qCAAqC,qBAAqB,qBAA8B,CAAC;AAC3F,MAAM,CAAC,MAAM,0BAA0B,GACrC,qCAAqC,qBAAqB,kBAA2B,CAAC;AAqCxF,MAAM,UAAU,wBAAwB,CAAC,MAAkB;IACzD,OAAO;QACL,OAAO,EAAE,sBAAsB;QAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;YACxB,GAAG,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,QAAQ;gBACzC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;gBAChC,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,KAAK,QAAQ;gBACvC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;gBAC5B,CAAC,CAAC,EAAE,CAAC;SACR;QACD,GAAG,CAAC,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ;YACrC,CAAC,CAAC,EAAE,QAAQ,EAAE,M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C,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACrC,CAAC;YACF,SAAS;QACX,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG;YAClB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACjD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,0BAA0B;QACnC,UAAU,EAAE,OAAO;KACpB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Claude Code 适配器
3
+ *
4
+ * 从 plugin.yaml 生成 .claude-plugin/plugin.json 和相关配置文件。
5
+ *
6
+ * Claude Code 插件结构约定:
7
+ * - .claude-plugin/plugin.json — manifest
8
+ * - skills/<name>/SKILL.md — skill 文件(已在源码中维护,无需生成)
9
+ * - hooks/hooks.json — hook 配置(如果有 hooks 组件)
10
+ * - .mcp.json — MCP server 配置(如果有 mcp 组件)
11
+ * - .lsp.json — LSP server 配置(如果有 lsp 组件)
12
+ */
13
+ import type { PluginLspTransport, PluginYaml } from '../schema/plugin-yaml.js';
14
+ import { type NativeMcpConfig } from './mcp.js';
15
+ export interface ClaudeManifest {
16
+ name: string;
17
+ version: string;
18
+ description: string;
19
+ author: {
20
+ name: string;
21
+ };
22
+ }
23
+ export interface ClaudeHooksConfig {
24
+ hooks: Record<string, Array<{
25
+ matcher: string;
26
+ hooks: Array<{
27
+ type: 'command';
28
+ command: string;
29
+ timeout?: number;
30
+ }>;
31
+ }>>;
32
+ }
33
+ export type ClaudeMcpConfig = NativeMcpConfig;
34
+ export type ClaudeLspConfig = Record<string, {
35
+ command: string;
36
+ args?: string[];
37
+ env?: Record<string, string>;
38
+ transport?: PluginLspTransport;
39
+ extensionToLanguage: Record<string, string>;
40
+ workspaceFolder?: string;
41
+ startupTimeout?: number;
42
+ maxRestarts?: number;
43
+ diagnostics?: boolean;
44
+ }>;
45
+ /**
46
+ * 生成 Claude Code 的 .claude-plugin/plugin.json
47
+ */
48
+ export declare function buildClaudeManifest(config: PluginYaml): ClaudeManifest;
49
+ /**
50
+ * 生成 Claude Code 的 hooks/hooks.json(如果有 hooks 组件)
51
+ */
52
+ export declare function buildClaudeHooksConfig(config: PluginYaml): ClaudeHooksConfig | null;
53
+ /**
54
+ * 生成 Claude Code 的 .mcp.json(如果有 mcp 组件)
55
+ */
56
+ export declare function buildClaudeMcpConfig(config: PluginYaml): ClaudeMcpConfig | null;
57
+ /**
58
+ * 生成 Claude Code 的 .lsp.json(如果有 lsp 组件)
59
+ */
60
+ export declare function buildLspConfig(config: PluginYaml): ClaudeLspConfig | null;
61
+ /**
62
+ * 将 Claude Code 兼容的文件写入插件目录
63
+ */
64
+ export declare function generateClaude(config: PluginYaml, pluginDir: string): void;
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Claude Code 适配器
3
+ *
4
+ * 从 plugin.yaml 生成 .claude-plugin/plugin.json 和相关配置文件。
5
+ *
6
+ * Claude Code 插件结构约定:
7
+ * - .claude-plugin/plugin.json — manifest
8
+ * - skills/<name>/SKILL.md — skill 文件(已在源码中维护,无需生成)
9
+ * - hooks/hooks.json — hook 配置(如果有 hooks 组件)
10
+ * - .mcp.json — MCP server 配置(如果有 mcp 组件)
11
+ * - .lsp.json — LSP server 配置(如果有 lsp 组件)
12
+ */
13
+ import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
14
+ import { join } from 'node:path';
15
+ import { buildNativeMcpConfig, } from './mcp.js';
16
+ function isPresent(value) {
17
+ return value != null;
18
+ }
19
+ /**
20
+ * 生成 Claude Code 的 .claude-plugin/plugin.json
21
+ */
22
+ export function buildClaudeManifest(config) {
23
+ return {
24
+ name: config.name,
25
+ version: config.version,
26
+ description: config.description,
27
+ author: { name: config.author.name },
28
+ };
29
+ }
30
+ /**
31
+ * 生成 Claude Code 的 hooks/hooks.json(如果有 hooks 组件)
32
+ */
33
+ export function buildClaudeHooksConfig(config) {
34
+ const hooks = config.components.hooks;
35
+ if (!hooks || hooks.length === 0)
36
+ return null;
37
+ const hooksMap = {};
38
+ for (const hook of hooks) {
39
+ const entry = {
40
+ matcher: hook.pattern || '*',
41
+ hooks: [
42
+ {
43
+ type: 'command',
44
+ command: hook.command,
45
+ ...(hook.timeout ? { timeout: hook.timeout } : {}),
46
+ },
47
+ ],
48
+ };
49
+ if (!hooksMap[hook.event]) {
50
+ hooksMap[hook.event] = [];
51
+ }
52
+ hooksMap[hook.event].push(entry);
53
+ }
54
+ return { hooks: hooksMap };
55
+ }
56
+ /**
57
+ * 生成 Claude Code 的 .mcp.json(如果有 mcp 组件)
58
+ */
59
+ export function buildClaudeMcpConfig(config) {
60
+ return buildNativeMcpConfig(config);
61
+ }
62
+ /**
63
+ * 生成 Claude Code 的 .lsp.json(如果有 lsp 组件)
64
+ */
65
+ export function buildLspConfig(config) {
66
+ const lsps = config.components.lsp;
67
+ if (!lsps || lsps.length === 0)
68
+ return null;
69
+ const servers = {};
70
+ for (const lsp of lsps) {
71
+ servers[lsp.name] = {
72
+ command: lsp.command,
73
+ ...(isPresent(lsp.args) ? { args: lsp.args } : {}),
74
+ ...(isPresent(lsp.env) ? { env: lsp.env } : {}),
75
+ ...(isPresent(lsp.transport) ? { transport: lsp.transport } : {}),
76
+ extensionToLanguage: lsp.extensionToLanguage,
77
+ ...(isPresent(lsp.workspaceFolder) ? { workspaceFolder: lsp.workspaceFolder } : {}),
78
+ ...(isPresent(lsp.startupTimeout) ? { startupTimeout: lsp.startupTimeout } : {}),
79
+ ...(isPresent(lsp.maxRestarts) ? { maxRestarts: lsp.maxRestarts } : {}),
80
+ ...(isPresent(lsp.diagnostics) ? { diagnostics: lsp.diagnostics } : {}),
81
+ };
82
+ }
83
+ return servers;
84
+ }
85
+ /**
86
+ * 将 Claude Code 兼容的文件写入插件目录
87
+ */
88
+ export function generateClaude(config, pluginDir) {
89
+ // 1. .claude-plugin/plugin.json
90
+ const claudeDir = join(pluginDir, '.claude-plugin');
91
+ mkdirSync(claudeDir, { recursive: true });
92
+ writeFileSync(join(claudeDir, 'plugin.json'), JSON.stringify(buildClaudeManifest(config), null, 2) + '\n');
93
+ // 2. hooks/hooks.json
94
+ const hooksConfig = buildClaudeHooksConfig(config);
95
+ const hooksPath = join(pluginDir, 'hooks', 'hooks.json');
96
+ if (hooksConfig) {
97
+ const hooksDir = join(pluginDir, 'hooks');
98
+ mkdirSync(hooksDir, { recursive: true });
99
+ writeFileSync(hooksPath, JSON.stringify(hooksConfig, null, 2) + '\n');
100
+ }
101
+ else {
102
+ rmSync(hooksPath, { force: true });
103
+ }
104
+ // 3. .mcp.json
105
+ const mcpConfig = buildClaudeMcpConfig(config);
106
+ const mcpPath = join(pluginDir, '.mcp.json');
107
+ if (mcpConfig) {
108
+ writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + '\n');
109
+ }
110
+ else {
111
+ rmSync(mcpPath, { force: true });
112
+ }
113
+ // 4. .lsp.json
114
+ const lspConfig = buildLspConfig(config);
115
+ const lspPath = join(pluginDir, '.lsp.json');
116
+ if (lspConfig) {
117
+ writeFileSync(lspPath, JSON.stringify(lspConfig, null, 2) + '\n');
118
+ }
119
+ else {
120
+ rmSync(lspPath, { force: true });
121
+ }
122
+ }
123
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,oBAAoB,GAErB,MAAM,UAAU,CAAC;AAwClB,SAAS,SA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,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,eAAe;IACf,MAAM,SAAS,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7C,IAAI,SAAS,EAAE,CAAC;QACd,aAAa,CACX,OAAO,EACP,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAC1C,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,eAAe;IACf,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC7C,IAAI,SAAS,EAAE,CAAC;QACd,aAAa,CACX,OAAO,EACP,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAC1C,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnC,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { WorkspaceHealthSnapshot, WorkspaceValidationDiagnostic } from '../application/workspace-health-contract.js';
2
+ export interface CliPluginValidationResult {
3
+ readonly name: string;
4
+ readonly valid: boolean;
5
+ readonly errors: readonly string[];
6
+ }
7
+ /**
8
+ * Converts the shared structured health result back into the legacy validate
9
+ * command's ordered, line-oriented model. It deliberately has no chalk,
10
+ * console, commander, or process dependency.
11
+ */
12
+ export declare function adaptHealthToCliValidation(snapshot: WorkspaceHealthSnapshot, validationDiagnostics: readonly WorkspaceValidationDiagnostic[], orderedNames: readonly string[]): readonly CliPluginValidationResult[];
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Converts the shared structured health result back into the legacy validate
3
+ * command's ordered, line-oriented model. It deliberately has no chalk,
4
+ * console, commander, or process dependency.
5
+ */
6
+ export function adaptHealthToCliValidation(snapshot, validationDiagnostics, orderedNames) {
7
+ const plugins = new Map(snapshot.plugins.map((plugin) => [plugin.directoryName, plugin]));
8
+ const diagnostics = new Map();
9
+ for (const diagnostic of validationDiagnostics) {
10
+ const messages = diagnostics.get(diagnostic.pluginDirectoryName) ?? [];
11
+ messages.push(diagnostic.message);
12
+ diagnostics.set(diagnostic.pluginDirectoryName, messages);
13
+ }
14
+ return orderedNames.map((name) => {
15
+ const plugin = plugins.get(name);
16
+ if (plugin === undefined) {
17
+ return {
18
+ name,
19
+ valid: false,
20
+ errors: [`插件目录不存在: plugins/${name}`],
21
+ };
22
+ }
23
+ const errors = diagnostics.get(name) ?? [];
24
+ return {
25
+ name,
26
+ valid: errors.length === 0,
27
+ errors,
28
+ };
29
+ });
30
+ }
31
+ //# sourceMappingURL=cli-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-validation.js","sourceRoot":"","sources":["../../src/adapters/cli-validation.ts"],"names":[],"mappings":"AAWA;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,QAAiC,EACjC,qBAA+D,EAC/D,YAA+B;IAE/B,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CACjE,CAAC;IACF,MAAM,WAAW,GAAG,IAAI,GAAG,EAAoB,CAAC;IAChD,KAAK,MAAM,UAAU,IAAI,qBAAqB,EAAE,CAAC;QAC/C,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,EAAE,CAAC;QACvE,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAClC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,OAAO;gBACL,IAAI;gBACJ,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,CAAC,oBAAoB,IAAI,EAAE,CAAC;aACrC,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAC3C,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;YAC1B,MAAM;SACP,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}