@birdie_moblie/plugin-marketplace-cli 1.0.1 → 1.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.
- package/CHANGELOG.md +28 -0
- package/README.md +32 -3
- package/dist/adapters/claude.d.ts +17 -1
- package/dist/adapters/claude.js +37 -1
- package/dist/adapters/claude.js.map +1 -1
- package/dist/adapters/openspec.d.ts +66 -0
- package/dist/adapters/openspec.js +232 -0
- package/dist/adapters/openspec.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/build.js +2 -0
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/index-gen.js +32 -1
- package/dist/commands/index-gen.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.js +44 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/release-local.js +25 -0
- package/dist/commands/release-local.js.map +1 -1
- package/dist/commands/validate.js +232 -3
- package/dist/commands/validate.js.map +1 -1
- package/dist/generated/skill-content.js +1 -1
- package/dist/generated/skill-content.js.map +1 -1
- package/dist/schema/plugin-yaml.d.ts +14 -0
- package/dist/schema/plugin-yaml.js +38 -0
- package/dist/schema/plugin-yaml.js.map +1 -1
- package/package.json +7 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
本文件记录 `@birdie_moblie/plugin-marketplace-cli` 的对外变更。版本号遵循 semver,日期使用 ISO 8601。
|
|
4
|
+
|
|
5
|
+
## 1.1.0 - 2026-06-29
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- 新增 `lsp` 组件类型:`plugin.yaml` 可声明 `components.lsp`,build 阶段派生 `.lsp.json`,Claude Code 直接消费原生 LSP 配置。
|
|
9
|
+
- `init --type lsp` 生成 LSP 插件骨架,并写入面向 agent 的语义检索边界 skill 模板。
|
|
10
|
+
- marketplace 索引(`.claude-plugin/marketplace.json`、根 `marketplace.json`、`CATALOG.md`)、`release-local` 打包以及 `validate` 全面纳入 LSP 组件;Codex 输出仍然保持隔离,不暴露 LSP 字段。
|
|
11
|
+
- 新增 OpenSpec source adapter sidecar 流水线:`plugin.yaml` 中的 `openspec` overlay 由 CLI 生成 `.openspec-plugin/plugin.json` 与根 `.openspec-plugin/source-adapters.json`,不污染 Claude Code / Codex 平台原生格式。
|
|
12
|
+
- Lark 源适配抽象为通用 sheet fetch 命名,保留必需参数,多 source adapter 共存。
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- `validate` 在 LSP 组件下校验文件存在性、extension 形式、startupTimeout / maxRestarts 非负,并比对 `.lsp.json` 是否与 `plugin.yaml` 一致,杜绝手改派生产物。
|
|
16
|
+
- 修正 LSP 派生产物中布尔/数字 `null` 字段被序列化为 JSON `null` 的问题。
|
|
17
|
+
- 清理 LSP 插件被移除时残留的 `.lsp.json`。
|
|
18
|
+
|
|
19
|
+
### Notes
|
|
20
|
+
- `.claude-plugin/plugin.json`、`.codex-plugin/plugin.json`、`.lsp.json`、`.openspec-plugin/plugin.json` 等派生文件必须通过 CLI 生成,不要手动编辑;CI 会校验它们与 `plugin.yaml` 派生结果一致。
|
|
21
|
+
|
|
22
|
+
## 1.0.1
|
|
23
|
+
|
|
24
|
+
- 修复 `init-repo` 阶段未注入维护 skill 的问题。
|
|
25
|
+
|
|
26
|
+
## 1.0.0
|
|
27
|
+
|
|
28
|
+
- 首次公开发布:`init-repo` / `init` / `validate` / `build` / `index` / `release-local`。
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @birdie_moblie/plugin-marketplace-cli
|
|
2
2
|
|
|
3
|
-
这是用于维护 Claude Code / Codex plugin marketplace 仓库的 CLI。它负责创建插件骨架、验证 `plugin.yaml`、生成平台 manifest、更新 marketplace 索引,并打出本地发布包。
|
|
3
|
+
这是用于维护 Claude Code / Codex plugin marketplace 仓库的 CLI。它负责创建插件骨架、验证 `plugin.yaml`、生成平台 manifest、更新 marketplace 索引,并打出本地发布包。OpenSpec source adapter metadata 通过插件内 overlay 生成 sidecar,作为兼容层存在,不改变 Claude Code / Codex 输出格式。
|
|
4
4
|
|
|
5
5
|
## 使用公网 CLI
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ npx @birdie_moblie/plugin-marketplace-cli --help
|
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npx @birdie_moblie/plugin-marketplace-cli init-repo [name] --organization "团队名" [--no-skill]
|
|
15
|
-
npx @birdie_moblie/plugin-marketplace-cli init <plugin-name> --type <skill|mcp|hook>
|
|
15
|
+
npx @birdie_moblie/plugin-marketplace-cli init <plugin-name> --type <skill|mcp|lsp|hook>
|
|
16
16
|
npx @birdie_moblie/plugin-marketplace-cli validate [plugin-name] --all
|
|
17
17
|
npx @birdie_moblie/plugin-marketplace-cli build [plugin-name] --all
|
|
18
18
|
npx @birdie_moblie/plugin-marketplace-cli index
|
|
@@ -45,17 +45,46 @@ npx @birdie_moblie/plugin-marketplace-cli --root /path/to/repo validate --all
|
|
|
45
45
|
└── marketplace.json
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
每个插件的 Claude Code / Codex 平台信息以 `plugin.yaml` 为唯一来源。插件也可以额外提供 `openspec-source-adapters.yaml` overlay,用于声明 OpenSpec source adapter metadata。
|
|
49
|
+
|
|
50
|
+
仓库本身要作为 marketplace 源使用时,以下生成物需要随源码一起提交:
|
|
49
51
|
|
|
50
52
|
- `.claude-plugin/marketplace.json`
|
|
51
53
|
- `.agents/plugins/marketplace.json`
|
|
54
|
+
- `.openspec-plugin/source-adapters.json`
|
|
52
55
|
- `plugins/**/.claude-plugin/plugin.json`
|
|
53
56
|
- `plugins/**/.codex-plugin/plugin.json`
|
|
57
|
+
- `plugins/**/.openspec-plugin/plugin.json`
|
|
54
58
|
- `plugins/**/.mcp.json`
|
|
59
|
+
- `plugins/**/.lsp.json`
|
|
55
60
|
- `plugins/**/hooks/hooks.json`
|
|
56
61
|
- `marketplace.json`
|
|
57
62
|
- `plugins/CATALOG.md`
|
|
58
63
|
|
|
64
|
+
LSP 插件在 `plugin.yaml` 的 `components.lsp` 声明 server metadata:
|
|
65
|
+
|
|
66
|
+
```yaml
|
|
67
|
+
components:
|
|
68
|
+
lsp:
|
|
69
|
+
- name: dart
|
|
70
|
+
command: dart
|
|
71
|
+
args: ["language-server", "--protocol=lsp"]
|
|
72
|
+
extensionToLanguage:
|
|
73
|
+
".dart": dart
|
|
74
|
+
startupTimeout: 30000
|
|
75
|
+
maxRestarts: 3
|
|
76
|
+
diagnostics: true
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
CLI 会由 `components.lsp` 生成插件根目录 `.lsp.json`,并只在 Claude Code marketplace 写入 `lspServers` 字段。Codex 当前没有原生 LSP manifest;语义能力必须通过 MCP server 暴露。
|
|
80
|
+
|
|
81
|
+
OpenSpec sidecar 输出只来自 `openspec-source-adapters.yaml` overlay:
|
|
82
|
+
|
|
83
|
+
- `plugins/<name>/.openspec-plugin/plugin.json`
|
|
84
|
+
- `.openspec-plugin/source-adapters.json`
|
|
85
|
+
|
|
86
|
+
不要把 OpenSpec-only 字段加入 `plugin.yaml`、`.claude-plugin/plugin.json`、`.codex-plugin/plugin.json`、`.claude-plugin/marketplace.json`、`.agents/plugins/marketplace.json` 或根 `marketplace.json`。
|
|
87
|
+
|
|
59
88
|
## 推荐脚本
|
|
60
89
|
|
|
61
90
|
`plugin-marketplace init-repo` 会给新仓库写入一组 npm scripts,并默认注入 `marketplace-maintainer`
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* - skills/<name>/SKILL.md — skill 文件(已在源码中维护,无需生成)
|
|
9
9
|
* - hooks/hooks.json — hook 配置(如果有 hooks 组件)
|
|
10
10
|
* - .mcp.json — MCP server 配置(如果有 mcp 组件)
|
|
11
|
+
* - .lsp.json — LSP server 配置(如果有 lsp 组件)
|
|
11
12
|
*/
|
|
12
|
-
import type { PluginYaml } from '../schema/plugin-yaml.js';
|
|
13
|
+
import type { PluginLspTransport, PluginYaml } from '../schema/plugin-yaml.js';
|
|
13
14
|
export interface ClaudeManifest {
|
|
14
15
|
name: string;
|
|
15
16
|
version: string;
|
|
@@ -35,6 +36,21 @@ export interface ClaudeMcpConfig {
|
|
|
35
36
|
env?: Record<string, string>;
|
|
36
37
|
}>;
|
|
37
38
|
}
|
|
39
|
+
export type ClaudeLspConfig = Record<string, {
|
|
40
|
+
command: string;
|
|
41
|
+
args?: string[];
|
|
42
|
+
env?: Record<string, string>;
|
|
43
|
+
transport?: PluginLspTransport;
|
|
44
|
+
extensionToLanguage: Record<string, string>;
|
|
45
|
+
workspaceFolder?: string;
|
|
46
|
+
startupTimeout?: number;
|
|
47
|
+
maxRestarts?: number;
|
|
48
|
+
diagnostics?: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* 生成 Claude Code 的 .lsp.json(如果有 lsp 组件)
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildLspConfig(config: PluginYaml): ClaudeLspConfig | null;
|
|
38
54
|
/**
|
|
39
55
|
* 将 Claude Code 兼容的文件写入插件目录
|
|
40
56
|
*/
|
package/dist/adapters/claude.js
CHANGED
|
@@ -8,9 +8,13 @@
|
|
|
8
8
|
* - skills/<name>/SKILL.md — skill 文件(已在源码中维护,无需生成)
|
|
9
9
|
* - hooks/hooks.json — hook 配置(如果有 hooks 组件)
|
|
10
10
|
* - .mcp.json — MCP server 配置(如果有 mcp 组件)
|
|
11
|
+
* - .lsp.json — LSP server 配置(如果有 lsp 组件)
|
|
11
12
|
*/
|
|
12
|
-
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import { mkdirSync, rmSync, writeFileSync } from 'node:fs';
|
|
13
14
|
import { join } from 'node:path';
|
|
15
|
+
function isPresent(value) {
|
|
16
|
+
return value != null;
|
|
17
|
+
}
|
|
14
18
|
/**
|
|
15
19
|
* 生成 Claude Code 的 .claude-plugin/plugin.json
|
|
16
20
|
*/
|
|
@@ -65,6 +69,29 @@ function buildMcpConfig(config) {
|
|
|
65
69
|
}
|
|
66
70
|
return { mcpServers: servers };
|
|
67
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* 生成 Claude Code 的 .lsp.json(如果有 lsp 组件)
|
|
74
|
+
*/
|
|
75
|
+
export function buildLspConfig(config) {
|
|
76
|
+
const lsps = config.components.lsp;
|
|
77
|
+
if (!lsps || lsps.length === 0)
|
|
78
|
+
return null;
|
|
79
|
+
const servers = {};
|
|
80
|
+
for (const lsp of lsps) {
|
|
81
|
+
servers[lsp.name] = {
|
|
82
|
+
command: lsp.command,
|
|
83
|
+
...(isPresent(lsp.args) ? { args: lsp.args } : {}),
|
|
84
|
+
...(isPresent(lsp.env) ? { env: lsp.env } : {}),
|
|
85
|
+
...(isPresent(lsp.transport) ? { transport: lsp.transport } : {}),
|
|
86
|
+
extensionToLanguage: lsp.extensionToLanguage,
|
|
87
|
+
...(isPresent(lsp.workspaceFolder) ? { workspaceFolder: lsp.workspaceFolder } : {}),
|
|
88
|
+
...(isPresent(lsp.startupTimeout) ? { startupTimeout: lsp.startupTimeout } : {}),
|
|
89
|
+
...(isPresent(lsp.maxRestarts) ? { maxRestarts: lsp.maxRestarts } : {}),
|
|
90
|
+
...(isPresent(lsp.diagnostics) ? { diagnostics: lsp.diagnostics } : {}),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return servers;
|
|
94
|
+
}
|
|
68
95
|
/**
|
|
69
96
|
* 将 Claude Code 兼容的文件写入插件目录
|
|
70
97
|
*/
|
|
@@ -85,5 +112,14 @@ export function generateClaude(config, pluginDir) {
|
|
|
85
112
|
if (mcpConfig) {
|
|
86
113
|
writeFileSync(join(pluginDir, '.mcp.json'), JSON.stringify(mcpConfig, null, 2) + '\n');
|
|
87
114
|
}
|
|
115
|
+
// 4. .lsp.json
|
|
116
|
+
const lspConfig = buildLspConfig(config);
|
|
117
|
+
const lspPath = join(pluginDir, '.lsp.json');
|
|
118
|
+
if (lspConfig) {
|
|
119
|
+
writeFileSync(lspPath, JSON.stringify(lspConfig, null, 2) + '\n');
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
rmSync(lspPath, { force: true });
|
|
123
|
+
}
|
|
88
124
|
}
|
|
89
125
|
//# sourceMappingURL=claude.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAAA
|
|
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;AAkDjC,SAAS,SAAS,CAAI,KAA2B;IAC/C,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAC,MAAkB;IACvC,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;KACrC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAC,MAAkB;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;IACtC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAE9C,MAAM,QAAQ,GAA+B,EAAE,CAAC;IAEhD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG;YACZ,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,G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AC,CAAC,GAAG,IAAI,CAC1C,CAAC;IACJ,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,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenSpec 适配器
|
|
3
|
+
*
|
|
4
|
+
* 从 OpenSpec 专属配置生成独立 sidecar。
|
|
5
|
+
* 该 sidecar 不属于 Claude/Codex 原生 manifest,避免污染平台 manifest。
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginYaml } from '../schema/plugin-yaml.js';
|
|
8
|
+
export declare const OPENSPEC_SOURCE_ADAPTERS_FILE = "openspec-source-adapters.yaml";
|
|
9
|
+
export type OpenSpecAdapterKind = 'command' | 'skill' | 'deferred' | 'manual';
|
|
10
|
+
export declare const OPEN_SPEC_ADAPTER_KINDS: OpenSpecAdapterKind[];
|
|
11
|
+
export interface OpenSpecAdapterOperation {
|
|
12
|
+
command?: string;
|
|
13
|
+
args?: string[];
|
|
14
|
+
output?: 'json' | 'markdown' | 'text';
|
|
15
|
+
parser?: 'prd-markdown' | 'yapi-summary-json' | 'raw-json' | 'raw-text';
|
|
16
|
+
skill?: string;
|
|
17
|
+
execution?: 'agent-plan' | 'agent-mcp';
|
|
18
|
+
produces?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface OpenSpecAdapterParam {
|
|
21
|
+
key: string;
|
|
22
|
+
scope?: 'capability' | 'adapter' | 'operation';
|
|
23
|
+
required?: boolean;
|
|
24
|
+
label?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
sensitive?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface OpenSpecAdapter {
|
|
29
|
+
id: string;
|
|
30
|
+
capability: string;
|
|
31
|
+
kind: OpenSpecAdapterKind;
|
|
32
|
+
operations: Record<string, OpenSpecAdapterOperation>;
|
|
33
|
+
knownParams?: OpenSpecAdapterParam[];
|
|
34
|
+
requiredParams?: OpenSpecAdapterParam[];
|
|
35
|
+
}
|
|
36
|
+
export interface OpenSpecSourceAdaptersYaml {
|
|
37
|
+
schemaVersion?: 'openspec.source-adapters.v1';
|
|
38
|
+
adapters: OpenSpecAdapter[];
|
|
39
|
+
}
|
|
40
|
+
export interface OpenSpecPluginManifest {
|
|
41
|
+
name: string;
|
|
42
|
+
version: string;
|
|
43
|
+
description: string;
|
|
44
|
+
author: PluginYaml['author'];
|
|
45
|
+
openspec: {
|
|
46
|
+
adapters: OpenSpecAdapter[];
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export interface OpenSpecSourceAdapterIndexEntry {
|
|
50
|
+
name: string;
|
|
51
|
+
source: string;
|
|
52
|
+
manifest: string;
|
|
53
|
+
adapters: Array<{
|
|
54
|
+
id: string;
|
|
55
|
+
capability: string;
|
|
56
|
+
kind: OpenSpecAdapter['kind'];
|
|
57
|
+
operations: string[];
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
export declare function isOpenSpecAdapterKind(value: unknown): value is OpenSpecAdapterKind;
|
|
61
|
+
export declare function findDuplicateOpenSpecAdapterOperations(entries: OpenSpecSourceAdapterIndexEntry[]): string[];
|
|
62
|
+
export declare function assertUniqueOpenSpecAdapterOperations(entries: OpenSpecSourceAdapterIndexEntry[]): void;
|
|
63
|
+
export declare function loadOpenSpecAdapters(pluginDir: string): OpenSpecAdapter[];
|
|
64
|
+
export declare function buildOpenSpecManifest(config: PluginYaml, pluginDir: string): OpenSpecPluginManifest | null;
|
|
65
|
+
export declare function generateOpenSpec(config: PluginYaml, pluginDir: string): boolean;
|
|
66
|
+
export declare function buildOpenSpecSourceAdapterIndexEntry(config: PluginYaml, pluginDir: string, relativePath: string): OpenSpecSourceAdapterIndexEntry | null;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenSpec 适配器
|
|
3
|
+
*
|
|
4
|
+
* 从 OpenSpec 专属配置生成独立 sidecar。
|
|
5
|
+
* 该 sidecar 不属于 Claude/Codex 原生 manifest,避免污染平台 manifest。
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import Ajv from 'ajv';
|
|
10
|
+
import yaml from 'js-yaml';
|
|
11
|
+
export const OPENSPEC_SOURCE_ADAPTERS_FILE = 'openspec-source-adapters.yaml';
|
|
12
|
+
export const OPEN_SPEC_ADAPTER_KINDS = [
|
|
13
|
+
'command',
|
|
14
|
+
'skill',
|
|
15
|
+
'deferred',
|
|
16
|
+
'manual',
|
|
17
|
+
];
|
|
18
|
+
const paramSchema = {
|
|
19
|
+
type: 'object',
|
|
20
|
+
required: ['key'],
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
properties: {
|
|
23
|
+
key: { type: 'string' },
|
|
24
|
+
scope: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
nullable: true,
|
|
27
|
+
enum: ['capability', 'adapter', 'operation', null],
|
|
28
|
+
},
|
|
29
|
+
required: { type: 'boolean', nullable: true },
|
|
30
|
+
label: { type: 'string', nullable: true },
|
|
31
|
+
description: { type: 'string', nullable: true },
|
|
32
|
+
sensitive: { type: 'boolean', nullable: true },
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
const openSpecSourceAdaptersSchema = {
|
|
36
|
+
type: 'object',
|
|
37
|
+
required: ['adapters'],
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
properties: {
|
|
40
|
+
schemaVersion: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
nullable: true,
|
|
43
|
+
enum: ['openspec.source-adapters.v1', null],
|
|
44
|
+
},
|
|
45
|
+
adapters: {
|
|
46
|
+
type: 'array',
|
|
47
|
+
items: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
required: ['id', 'capability', 'kind', 'operations'],
|
|
50
|
+
additionalProperties: false,
|
|
51
|
+
properties: {
|
|
52
|
+
id: { type: 'string' },
|
|
53
|
+
capability: { type: 'string' },
|
|
54
|
+
kind: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
enum: ['command', 'skill', 'deferred', 'manual'],
|
|
57
|
+
},
|
|
58
|
+
operations: {
|
|
59
|
+
type: 'object',
|
|
60
|
+
required: [],
|
|
61
|
+
additionalProperties: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
required: [],
|
|
64
|
+
additionalProperties: false,
|
|
65
|
+
properties: {
|
|
66
|
+
command: { type: 'string', nullable: true },
|
|
67
|
+
args: {
|
|
68
|
+
type: 'array',
|
|
69
|
+
nullable: true,
|
|
70
|
+
items: { type: 'string' },
|
|
71
|
+
},
|
|
72
|
+
output: {
|
|
73
|
+
type: 'string',
|
|
74
|
+
nullable: true,
|
|
75
|
+
enum: ['json', 'markdown', 'text', null],
|
|
76
|
+
},
|
|
77
|
+
parser: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
nullable: true,
|
|
80
|
+
enum: ['prd-markdown', 'yapi-summary-json', 'raw-json', 'raw-text', null],
|
|
81
|
+
},
|
|
82
|
+
skill: { type: 'string', nullable: true },
|
|
83
|
+
execution: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
nullable: true,
|
|
86
|
+
enum: ['agent-plan', 'agent-mcp', null],
|
|
87
|
+
},
|
|
88
|
+
produces: { type: 'string', nullable: true },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
knownParams: {
|
|
93
|
+
type: 'array',
|
|
94
|
+
nullable: true,
|
|
95
|
+
items: paramSchema,
|
|
96
|
+
},
|
|
97
|
+
requiredParams: {
|
|
98
|
+
type: 'array',
|
|
99
|
+
nullable: true,
|
|
100
|
+
items: paramSchema,
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
// @ts-expect-error -- ajv v8 CJS/ESM interop: runtime can construct Ajv in this project setup.
|
|
108
|
+
const ajv = new Ajv({ allErrors: true });
|
|
109
|
+
const validateOpenSpecSourceAdapters = ajv.compile(openSpecSourceAdaptersSchema);
|
|
110
|
+
function formatAjvErrors(errors) {
|
|
111
|
+
return (errors
|
|
112
|
+
?.map((error) => ` - ${error.instancePath || '/'}: ${error.message}`)
|
|
113
|
+
.join('\n') || ' - unknown validation error');
|
|
114
|
+
}
|
|
115
|
+
function stripNullish(value) {
|
|
116
|
+
if (Array.isArray(value)) {
|
|
117
|
+
return value.map((item) => stripNullish(item));
|
|
118
|
+
}
|
|
119
|
+
if (value && typeof value === 'object') {
|
|
120
|
+
const result = {};
|
|
121
|
+
for (const [key, child] of Object.entries(value)) {
|
|
122
|
+
if (child === null || child === undefined)
|
|
123
|
+
continue;
|
|
124
|
+
result[key] = stripNullish(child);
|
|
125
|
+
}
|
|
126
|
+
return result;
|
|
127
|
+
}
|
|
128
|
+
return value;
|
|
129
|
+
}
|
|
130
|
+
function validateUniqueAdapterOperations(adapters) {
|
|
131
|
+
const seen = new Map();
|
|
132
|
+
for (const adapter of adapters) {
|
|
133
|
+
for (const operation of Object.keys(adapter.operations)) {
|
|
134
|
+
const key = `${adapter.id}:${adapter.capability}:${operation}`;
|
|
135
|
+
const existing = seen.get(key);
|
|
136
|
+
if (existing) {
|
|
137
|
+
throw new Error(`${OPENSPEC_SOURCE_ADAPTERS_FILE} declares duplicate adapter operation '${key}' in '${existing}' and '${adapter.id}'`);
|
|
138
|
+
}
|
|
139
|
+
seen.set(key, adapter.id);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export function isOpenSpecAdapterKind(value) {
|
|
144
|
+
return typeof value === 'string' && OPEN_SPEC_ADAPTER_KINDS.includes(value);
|
|
145
|
+
}
|
|
146
|
+
export function findDuplicateOpenSpecAdapterOperations(entries) {
|
|
147
|
+
const seen = new Map();
|
|
148
|
+
const errors = [];
|
|
149
|
+
for (const entry of entries) {
|
|
150
|
+
for (const adapter of entry.adapters) {
|
|
151
|
+
for (const operation of adapter.operations) {
|
|
152
|
+
const key = `${adapter.id}:${adapter.capability}:${operation}`;
|
|
153
|
+
const existing = seen.get(key);
|
|
154
|
+
if (existing) {
|
|
155
|
+
errors.push(`OpenSpec source adapter duplicate operation '${key}': ` +
|
|
156
|
+
`${existing.plugin} (${existing.source}, adapter ${existing.adapterId}) conflicts with ` +
|
|
157
|
+
`${entry.name} (${entry.source}, adapter ${adapter.id})`);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
seen.set(key, {
|
|
161
|
+
plugin: entry.name,
|
|
162
|
+
source: entry.source,
|
|
163
|
+
adapterId: adapter.id,
|
|
164
|
+
capability: adapter.capability,
|
|
165
|
+
operation,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return errors;
|
|
171
|
+
}
|
|
172
|
+
export function assertUniqueOpenSpecAdapterOperations(entries) {
|
|
173
|
+
const errors = findDuplicateOpenSpecAdapterOperations(entries);
|
|
174
|
+
if (errors.length > 0) {
|
|
175
|
+
throw new Error(`OpenSpec source adapter index validation failed:\n${errors.join('\n')}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export function loadOpenSpecAdapters(pluginDir) {
|
|
179
|
+
const yamlPath = join(pluginDir, OPENSPEC_SOURCE_ADAPTERS_FILE);
|
|
180
|
+
if (!existsSync(yamlPath))
|
|
181
|
+
return [];
|
|
182
|
+
const raw = readFileSync(yamlPath, 'utf-8');
|
|
183
|
+
const data = yaml.load(raw);
|
|
184
|
+
if (!validateOpenSpecSourceAdapters(data)) {
|
|
185
|
+
throw new Error(`${OPENSPEC_SOURCE_ADAPTERS_FILE} validation failed:\n${formatAjvErrors(validateOpenSpecSourceAdapters.errors)}`);
|
|
186
|
+
}
|
|
187
|
+
const sourceAdapters = data;
|
|
188
|
+
validateUniqueAdapterOperations(sourceAdapters.adapters);
|
|
189
|
+
return stripNullish(sourceAdapters.adapters);
|
|
190
|
+
}
|
|
191
|
+
export function buildOpenSpecManifest(config, pluginDir) {
|
|
192
|
+
const adapters = loadOpenSpecAdapters(pluginDir);
|
|
193
|
+
if (!adapters || adapters.length === 0)
|
|
194
|
+
return null;
|
|
195
|
+
return {
|
|
196
|
+
name: config.name,
|
|
197
|
+
version: config.version,
|
|
198
|
+
description: config.description,
|
|
199
|
+
author: stripNullish(config.author),
|
|
200
|
+
openspec: {
|
|
201
|
+
adapters,
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
export function generateOpenSpec(config, pluginDir) {
|
|
206
|
+
const openSpecDir = join(pluginDir, '.openspec-plugin');
|
|
207
|
+
const manifest = buildOpenSpecManifest(config, pluginDir);
|
|
208
|
+
if (!manifest) {
|
|
209
|
+
rmSync(openSpecDir, { recursive: true, force: true });
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
mkdirSync(openSpecDir, { recursive: true });
|
|
213
|
+
writeFileSync(join(openSpecDir, 'plugin.json'), JSON.stringify(manifest, null, 2) + '\n');
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
export function buildOpenSpecSourceAdapterIndexEntry(config, pluginDir, relativePath) {
|
|
217
|
+
const manifest = buildOpenSpecManifest(config, pluginDir);
|
|
218
|
+
if (!manifest)
|
|
219
|
+
return null;
|
|
220
|
+
return {
|
|
221
|
+
name: config.name,
|
|
222
|
+
source: relativePath,
|
|
223
|
+
manifest: `${relativePath}/.openspec-plugin/plugin.json`,
|
|
224
|
+
adapters: manifest.openspec.adapters.map((adapter) => ({
|
|
225
|
+
id: adapter.id,
|
|
226
|
+
capability: adapter.capability,
|
|
227
|
+
kind: adapter.kind,
|
|
228
|
+
operations: Object.keys(adapter.operations),
|
|
229
|
+
})),
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=openspec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openspec.js","sourceRoot":"","sources":["../../src/adapters/openspec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B,MAAM,CAAC,MAAM,6BAA6B,GAAG,+BAA+B,CAAC;AAI7E,MAAM,CAAC,MAAM,uBAAuB,GAA0B;IAC5D,SAAS;IACT,OAAO;IACP,UAAU;IACV,QAAQ;CACT,CAAC;AAyDF,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,KAAK,CAAC;IACjB,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE;QACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACvB,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,IAAI,CAAC;SACnD;QACD,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC7C,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;QACzC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IA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AClB,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;SAC5C,CAAC,CAAC;KACJ,CAAC;AACJ,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -78,7 +78,7 @@ program
|
|
|
78
78
|
program
|
|
79
79
|
.command('init <name>')
|
|
80
80
|
.description('创建新插件骨架')
|
|
81
|
-
.option('-t, --type <type>', '插件类型: skill, mcp, hook', 'skill')
|
|
81
|
+
.option('-t, --type <type>', '插件类型: skill, mcp, lsp, hook', 'skill')
|
|
82
82
|
.action((name, options) => runInit(name, { ...options, root: rootOption() }));
|
|
83
83
|
program
|
|
84
84
|
.command('validate [name]')
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAe,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,SAAS,UAAU;IACjB,OAAO,OAAO,CAAC,IAAI,EAAqB,CAAC,IAAI,CAAC;AAChD,CAAC;AAED,SAAS,kBAAkB;IACzB,M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AC,QAAQ,CAAC;KACrB,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC;KAC7B,MAAM,CAAC,CAAC,IAAwB,EAAE,OAAyB,EAAE,EAAE,CAC9D,WAAW,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,CACtD,CAAC;AAEJ,OAAO;KACJ,OAAO,CAAC,cAAc,CAAC;KACvB,WAAW,CAAC,8BAA8B,CAAC;KAC3C,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC;KAC7B,MAAM,CAAC,CAAC,IAAwB,EAAE,OAAyB,EAAE,EAAE,CAC9D,QAAQ,CAAC,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,CACnD,CAAC;AAEJ,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,qBAAqB,CAAC;KAClC,MAAM,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC;AAErD,OAAO;KACJ,OAAO,CAAC,eAAe,CAAC;KACxB,WAAW,CAAC,SAAS,CAAC;KACtB,MAAM,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC;AAEzD,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
package/dist/commands/build.js
CHANGED
|
@@ -8,11 +8,13 @@ import chalk from 'chalk';
|
|
|
8
8
|
import { loadPluginYaml, listPluginNames, resolveRepoContext, } from '../utils/helpers.js';
|
|
9
9
|
import { generateClaude } from '../adapters/claude.js';
|
|
10
10
|
import { generateCodex } from '../adapters/codex.js';
|
|
11
|
+
import { generateOpenSpec } from '../adapters/openspec.js';
|
|
11
12
|
function buildOne(context, name) {
|
|
12
13
|
const pluginDir = join(context.pluginsDir, name);
|
|
13
14
|
const config = loadPluginYaml(pluginDir);
|
|
14
15
|
generateClaude(config, pluginDir);
|
|
15
16
|
generateCodex(config, pluginDir);
|
|
17
|
+
generateOpenSpec(config, pluginDir);
|
|
16
18
|
console.log(chalk.green(` ✓ ${name}`));
|
|
17
19
|
}
|
|
18
20
|
export function runBuild(name, options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,cAAc,EACd,eAAe,EACf,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,SAAS,QAAQ,CAAC,OAA0B,EAAE,IAAY;IACxD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAEzC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAClC,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;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
|
import chalk from 'chalk';
|
|
10
10
|
import { loadAllPlugins, loadMarketplaceMetadata, resolveRepoContext, toTitleCase, } from '../utils/helpers.js';
|
|
11
11
|
import { buildMarketplaceEntry } from '../adapters/codex.js';
|
|
12
|
+
import { assertUniqueOpenSpecAdapterOperations, buildOpenSpecSourceAdapterIndexEntry, } from '../adapters/openspec.js';
|
|
12
13
|
function writeJson(path, value) {
|
|
13
14
|
mkdirSync(join(path, '..'), { recursive: true });
|
|
14
15
|
writeFileSync(path, JSON.stringify(value, null, 2) + '\n');
|
|
15
16
|
}
|
|
17
|
+
function listComponentLabels(config) {
|
|
18
|
+
const labels = [];
|
|
19
|
+
if (config.components.skills?.length)
|
|
20
|
+
labels.push('Skill');
|
|
21
|
+
if (config.components.mcp?.length)
|
|
22
|
+
labels.push('MCP');
|
|
23
|
+
if (config.components.lsp?.length)
|
|
24
|
+
labels.push('LSP');
|
|
25
|
+
if (config.components.hooks?.length)
|
|
26
|
+
labels.push('Hook');
|
|
27
|
+
return labels;
|
|
28
|
+
}
|
|
16
29
|
export function runIndexGen(options = {}) {
|
|
17
30
|
console.log(chalk.blue('⟳ 生成 marketplace 索引...\n'));
|
|
18
31
|
const context = resolveRepoContext(options.root);
|
|
@@ -42,6 +55,7 @@ export function runIndexGen(options = {}) {
|
|
|
42
55
|
},
|
|
43
56
|
...(config.category ? { category: config.category } : {}),
|
|
44
57
|
...(config.tags?.length ? { tags: config.tags } : {}),
|
|
58
|
+
...(config.components.lsp?.length ? { lspServers: './.lsp.json' } : {}),
|
|
45
59
|
})),
|
|
46
60
|
};
|
|
47
61
|
writeJson(join(context.rootDir, '.claude-plugin/marketplace.json'), claudeMarketplace);
|
|
@@ -60,9 +74,26 @@ export function runIndexGen(options = {}) {
|
|
|
60
74
|
// ── 根目录兼容镜像 ──
|
|
61
75
|
writeJson(join(context.rootDir, 'marketplace.json'), codexMarketplace);
|
|
62
76
|
console.log(chalk.green(' ✓ marketplace.json (兼容镜像)'));
|
|
77
|
+
// ── OpenSpec source adapter sidecar 索引 ──
|
|
78
|
+
const openSpecEntries = plugins
|
|
79
|
+
.map(({ name, dir, config }) => buildOpenSpecSourceAdapterIndexEntry(config, dir, `./plugins/${name}`))
|
|
80
|
+
.filter((entry) => entry !== null);
|
|
81
|
+
assertUniqueOpenSpecAdapterOperations(openSpecEntries);
|
|
82
|
+
const openSpecSourceAdapters = {
|
|
83
|
+
schemaVersion: 'openspec.source-adapters.v1',
|
|
84
|
+
name: marketplace.name,
|
|
85
|
+
description: marketplace.description || '',
|
|
86
|
+
plugins: openSpecEntries,
|
|
87
|
+
};
|
|
88
|
+
writeJson(join(context.rootDir, '.openspec-plugin/source-adapters.json'), openSpecSourceAdapters);
|
|
89
|
+
console.log(chalk.green(' ✓ .openspec-plugin/source-adapters.json (OpenSpec)'));
|
|
63
90
|
// ── 人类可读目录 ──
|
|
64
91
|
const pluginList = plugins
|
|
65
|
-
.map(({ name, config }) =>
|
|
92
|
+
.map(({ name, config }) => {
|
|
93
|
+
const labels = listComponentLabels(config);
|
|
94
|
+
const labelText = labels.length ? ` [${labels.join(', ')}]` : '';
|
|
95
|
+
return `- **${name}** (v${config.version})${labelText}: ${config.description}`;
|
|
96
|
+
})
|
|
66
97
|
.join('\n');
|
|
67
98
|
const catalogMd = `# 插件目录\n\n${pluginList}\n\n_由 CLI 自动生成,请勿手动编辑。_\n`;
|
|
68
99
|
writeFileSync(join(context.pluginsDir, 'CATALOG.md'), catalogMd);
|