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.
- package/LICENSE +21 -0
- package/README.md +295 -0
- package/dist/adapters/agent-plugins.d.ts +35 -0
- package/dist/adapters/agent-plugins.js +57 -0
- package/dist/adapters/agent-plugins.js.map +1 -0
- package/dist/adapters/claude.d.ts +64 -0
- package/dist/adapters/claude.js +123 -0
- package/dist/adapters/claude.js.map +1 -0
- package/dist/adapters/cli-validation.d.ts +12 -0
- package/dist/adapters/cli-validation.js +31 -0
- package/dist/adapters/cli-validation.js.map +1 -0
- package/dist/adapters/codex.d.ts +62 -0
- package/dist/adapters/codex.js +91 -0
- package/dist/adapters/codex.js.map +1 -0
- package/dist/adapters/marketplace-registration.d.ts +17 -0
- package/dist/adapters/marketplace-registration.js +369 -0
- package/dist/adapters/marketplace-registration.js.map +1 -0
- package/dist/adapters/marketplace.d.ts +11 -0
- package/dist/adapters/marketplace.js +96 -0
- package/dist/adapters/marketplace.js.map +1 -0
- package/dist/adapters/mcp.d.ts +17 -0
- package/dist/adapters/mcp.js +28 -0
- package/dist/adapters/mcp.js.map +1 -0
- package/dist/application/artifact-generation.d.ts +58 -0
- package/dist/application/artifact-generation.js +344 -0
- package/dist/application/artifact-generation.js.map +1 -0
- package/dist/application/local-release.d.ts +122 -0
- package/dist/application/local-release.js +940 -0
- package/dist/application/local-release.js.map +1 -0
- package/dist/application/marketplace-document-contract.d.ts +81 -0
- package/dist/application/marketplace-document-contract.js +2 -0
- package/dist/application/marketplace-document-contract.js.map +1 -0
- package/dist/application/marketplace-document.d.ts +45 -0
- package/dist/application/marketplace-document.js +557 -0
- package/dist/application/marketplace-document.js.map +1 -0
- package/dist/application/marketplace-registration-contract.d.ts +51 -0
- package/dist/application/marketplace-registration-contract.js +11 -0
- package/dist/application/marketplace-registration-contract.js.map +1 -0
- package/dist/application/marketplace-registration.d.ts +20 -0
- package/dist/application/marketplace-registration.js +304 -0
- package/dist/application/marketplace-registration.js.map +1 -0
- package/dist/application/marketplace.d.ts +9 -0
- package/dist/application/marketplace.js +32 -0
- package/dist/application/marketplace.js.map +1 -0
- package/dist/application/plugin-components-contract.d.ts +135 -0
- package/dist/application/plugin-components-contract.js +2 -0
- package/dist/application/plugin-components-contract.js.map +1 -0
- package/dist/application/plugin-components.d.ts +17 -0
- package/dist/application/plugin-components.js +1000 -0
- package/dist/application/plugin-components.js.map +1 -0
- package/dist/application/plugin-document-contract.d.ts +115 -0
- package/dist/application/plugin-document-contract.js +2 -0
- package/dist/application/plugin-document-contract.js.map +1 -0
- package/dist/application/plugin-document.d.ts +69 -0
- package/dist/application/plugin-document.js +1037 -0
- package/dist/application/plugin-document.js.map +1 -0
- package/dist/application/plugin-lifecycle-contract.d.ts +230 -0
- package/dist/application/plugin-lifecycle-contract.js +3 -0
- package/dist/application/plugin-lifecycle-contract.js.map +1 -0
- package/dist/application/plugin-lifecycle.d.ts +8 -0
- package/dist/application/plugin-lifecycle.js +1375 -0
- package/dist/application/plugin-lifecycle.js.map +1 -0
- package/dist/application/plugin-scaffold.d.ts +18 -0
- package/dist/application/plugin-scaffold.js +188 -0
- package/dist/application/plugin-scaffold.js.map +1 -0
- package/dist/application/plugin-source.d.ts +39 -0
- package/dist/application/plugin-source.js +59 -0
- package/dist/application/plugin-source.js.map +1 -0
- package/dist/application/skill-document-contract.d.ts +92 -0
- package/dist/application/skill-document-contract.js +8 -0
- package/dist/application/skill-document-contract.js.map +1 -0
- package/dist/application/skill-document-guided.d.ts +3 -0
- package/dist/application/skill-document-guided.js +53 -0
- package/dist/application/skill-document-guided.js.map +1 -0
- package/dist/application/skill-document.d.ts +19 -0
- package/dist/application/skill-document.js +368 -0
- package/dist/application/skill-document.js.map +1 -0
- package/dist/application/workspace-create-contract.d.ts +50 -0
- package/dist/application/workspace-create-contract.js +16 -0
- package/dist/application/workspace-create-contract.js.map +1 -0
- package/dist/application/workspace-create.d.ts +8 -0
- package/dist/application/workspace-create.js +656 -0
- package/dist/application/workspace-create.js.map +1 -0
- package/dist/application/workspace-health-contract.d.ts +133 -0
- package/dist/application/workspace-health-contract.js +272 -0
- package/dist/application/workspace-health-contract.js.map +1 -0
- package/dist/application/workspace-health.d.ts +10 -0
- package/dist/application/workspace-health.js +1114 -0
- package/dist/application/workspace-health.js.map +1 -0
- package/dist/application/workspace-operation-contract.d.ts +99 -0
- package/dist/application/workspace-operation-contract.js +450 -0
- package/dist/application/workspace-operation-contract.js.map +1 -0
- package/dist/application/workspace-operation.d.ts +42 -0
- package/dist/application/workspace-operation.js +517 -0
- package/dist/application/workspace-operation.js.map +1 -0
- package/dist/cli.d.ts +16 -0
- package/dist/cli.js +136 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/add.d.ts +8 -0
- package/dist/commands/add.js +77 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/build.d.ts +7 -0
- package/dist/commands/build.js +29 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/component-scaffold.d.ts +4 -0
- package/dist/commands/component-scaffold.js +14 -0
- package/dist/commands/component-scaffold.js.map +1 -0
- package/dist/commands/import-skill.d.ts +15 -0
- package/dist/commands/import-skill.js +41 -0
- package/dist/commands/import-skill.js.map +1 -0
- package/dist/commands/index-gen.d.ts +12 -0
- package/dist/commands/index-gen.js +33 -0
- package/dist/commands/index-gen.js.map +1 -0
- package/dist/commands/init-repo.d.ts +8 -0
- package/dist/commands/init-repo.js +53 -0
- package/dist/commands/init-repo.js.map +1 -0
- package/dist/commands/init.d.ts +9 -0
- package/dist/commands/init.js +33 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/install-repo.d.ts +20 -0
- package/dist/commands/install-repo.js +200 -0
- package/dist/commands/install-repo.js.map +1 -0
- package/dist/commands/release-local.d.ts +9 -0
- package/dist/commands/release-local.js +27 -0
- package/dist/commands/release-local.js.map +1 -0
- package/dist/commands/validate.d.ts +8 -0
- package/dist/commands/validate.js +45 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/core/errors.d.ts +5 -0
- package/dist/core/errors.js +12 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/generated/skill-content.d.ts +3 -0
- package/dist/generated/skill-content.js +9 -0
- package/dist/generated/skill-content.js.map +1 -0
- package/dist/infrastructure/authorized-path.d.ts +20 -0
- package/dist/infrastructure/authorized-path.js +85 -0
- package/dist/infrastructure/authorized-path.js.map +1 -0
- package/dist/infrastructure/document-commit.d.ts +165 -0
- package/dist/infrastructure/document-commit.js +1352 -0
- package/dist/infrastructure/document-commit.js.map +1 -0
- package/dist/infrastructure/process-runner.d.ts +29 -0
- package/dist/infrastructure/process-runner.js +130 -0
- package/dist/infrastructure/process-runner.js.map +1 -0
- package/dist/infrastructure/vscode-user-settings.d.ts +42 -0
- package/dist/infrastructure/vscode-user-settings.js +509 -0
- package/dist/infrastructure/vscode-user-settings.js.map +1 -0
- package/dist/schema/plugin-yaml.d.ts +89 -0
- package/dist/schema/plugin-yaml.js +241 -0
- package/dist/schema/plugin-yaml.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +30 -0
- package/dist/utils/frontmatter.js +60 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/helpers.d.ts +44 -0
- package/dist/utils/helpers.js +94 -0
- package/dist/utils/helpers.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { existsSync, lstatSync, realpathSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { isAbsolute, resolve, sep } from 'node:path';
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
5
|
+
import { getMarketplaceRegistrationAdapter, MARKETPLACE_REGISTRATION_ADAPTERS, } from '../adapters/marketplace-registration.js';
|
|
6
|
+
import { CommandError } from '../core/errors.js';
|
|
7
|
+
import { AGENT_TARGET_IDS, isAgentTargetId, } from './marketplace-registration-contract.js';
|
|
8
|
+
const GITHUB_SHORTHAND = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/;
|
|
9
|
+
const SCP_SSH_URL = /^[A-Za-z0-9._-]+@[A-Za-z0-9.-]+:[^\s:][^\s]*$/;
|
|
10
|
+
const TERMINAL_CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f]/u;
|
|
11
|
+
function assertNoTerminalControlCharacters(value, label) {
|
|
12
|
+
if (TERMINAL_CONTROL_CHARACTERS.test(value)) {
|
|
13
|
+
throw new CommandError(`${label}不能包含 C0、C1 或 DEL 控制字符。`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function assertNoEncodedTerminalControlCharacters(value, label) {
|
|
17
|
+
let decoded;
|
|
18
|
+
try {
|
|
19
|
+
decoded = decodeURIComponent(value);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
throw new CommandError(`${label}包含无效的百分号编码。`);
|
|
23
|
+
}
|
|
24
|
+
assertNoTerminalControlCharacters(decoded, `解码后的${label}`);
|
|
25
|
+
}
|
|
26
|
+
function appendPathWithoutNormalizing(baseDir, relativePath) {
|
|
27
|
+
return `${baseDir}${baseDir.endsWith(sep) ? '' : sep}${relativePath}`;
|
|
28
|
+
}
|
|
29
|
+
function expandHomePath(value, homeDir) {
|
|
30
|
+
if (value === '~') {
|
|
31
|
+
return resolve(homeDir);
|
|
32
|
+
}
|
|
33
|
+
if (value.startsWith('~/') || value.startsWith('~\\')) {
|
|
34
|
+
return appendPathWithoutNormalizing(resolve(homeDir), value.slice(2));
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
}
|
|
38
|
+
function looksLikeLocalPath(value) {
|
|
39
|
+
return (value === '.' ||
|
|
40
|
+
value === '..' ||
|
|
41
|
+
value === '~' ||
|
|
42
|
+
value.startsWith('./') ||
|
|
43
|
+
value.startsWith('../') ||
|
|
44
|
+
value.startsWith('~/') ||
|
|
45
|
+
value.startsWith('.\\') ||
|
|
46
|
+
value.startsWith('..\\') ||
|
|
47
|
+
value.startsWith('~\\') ||
|
|
48
|
+
isAbsolute(value) ||
|
|
49
|
+
/^[A-Za-z]:[\\/]/.test(value));
|
|
50
|
+
}
|
|
51
|
+
function normalizeLocalSource(input, candidatePath) {
|
|
52
|
+
const stat = lstatSync(candidatePath);
|
|
53
|
+
if (!stat.isDirectory() && !stat.isSymbolicLink()) {
|
|
54
|
+
throw new CommandError(`Marketplace 本地来源不是目录: ${candidatePath}`);
|
|
55
|
+
}
|
|
56
|
+
const localPath = realpathSync(candidatePath);
|
|
57
|
+
assertNoTerminalControlCharacters(localPath, '解析后的 Marketplace 本地路径');
|
|
58
|
+
if (!lstatSync(localPath).isDirectory()) {
|
|
59
|
+
throw new CommandError(`Marketplace 本地来源不是目录: ${candidatePath}`);
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
kind: 'local',
|
|
63
|
+
input,
|
|
64
|
+
displayValue: localPath,
|
|
65
|
+
clientValue: localPath,
|
|
66
|
+
vscodeValue: pathToFileURL(localPath).href,
|
|
67
|
+
localPath,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function normalizeHttpsSource(input, parsed) {
|
|
71
|
+
if (parsed.protocol !== 'https:') {
|
|
72
|
+
throw new CommandError(`Git URL 只接受 HTTPS 或 SSH: ${parsed.protocol}`);
|
|
73
|
+
}
|
|
74
|
+
if (parsed.username || parsed.password) {
|
|
75
|
+
throw new CommandError('Git URL 不能包含内嵌凭据;请使用客户端已有的认证配置。');
|
|
76
|
+
}
|
|
77
|
+
if (!parsed.hostname || parsed.pathname.split('/').filter(Boolean).length < 2) {
|
|
78
|
+
throw new CommandError('HTTPS Git URL 必须包含主机、owner 与 repository 路径。');
|
|
79
|
+
}
|
|
80
|
+
if (parsed.search || parsed.hash) {
|
|
81
|
+
throw new CommandError('Git URL 不能包含 query 或 fragment。');
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
kind: 'git',
|
|
85
|
+
input,
|
|
86
|
+
displayValue: input,
|
|
87
|
+
clientValue: input,
|
|
88
|
+
vscodeValue: input,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function normalizeSshSource(input, parsed) {
|
|
92
|
+
if (parsed.password) {
|
|
93
|
+
throw new CommandError('SSH Git URL 不能包含内嵌密码。');
|
|
94
|
+
}
|
|
95
|
+
if (!parsed.hostname || parsed.pathname.split('/').filter(Boolean).length < 2) {
|
|
96
|
+
throw new CommandError('SSH Git URL 必须包含主机、owner 与 repository 路径。');
|
|
97
|
+
}
|
|
98
|
+
if (parsed.search || parsed.hash) {
|
|
99
|
+
throw new CommandError('SSH Git URL 不能包含 query 或 fragment。');
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
kind: 'git',
|
|
103
|
+
input,
|
|
104
|
+
displayValue: input,
|
|
105
|
+
clientValue: input,
|
|
106
|
+
vscodeValue: input,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export function normalizeMarketplaceSource(sourceInput, options = {}) {
|
|
110
|
+
assertNoTerminalControlCharacters(sourceInput, 'Marketplace 来源');
|
|
111
|
+
if (sourceInput.length === 0 || sourceInput !== sourceInput.trim()) {
|
|
112
|
+
throw new CommandError('Marketplace 来源不能为空,也不能包含首尾空白。');
|
|
113
|
+
}
|
|
114
|
+
if (sourceInput.startsWith('-')) {
|
|
115
|
+
throw new CommandError('Marketplace 来源不能以 - 开头。');
|
|
116
|
+
}
|
|
117
|
+
const baseDir = resolve(options.baseDir ?? process.env.INIT_CWD ?? process.cwd());
|
|
118
|
+
const expanded = expandHomePath(sourceInput, options.homeDir ?? homedir());
|
|
119
|
+
const localCandidate = isAbsolute(expanded)
|
|
120
|
+
? expanded
|
|
121
|
+
: appendPathWithoutNormalizing(baseDir, expanded);
|
|
122
|
+
assertNoTerminalControlCharacters(localCandidate, '解析后的 Marketplace 本地路径');
|
|
123
|
+
if (existsSync(localCandidate)) {
|
|
124
|
+
return normalizeLocalSource(sourceInput, localCandidate);
|
|
125
|
+
}
|
|
126
|
+
if (looksLikeLocalPath(sourceInput)) {
|
|
127
|
+
throw new CommandError(`Marketplace 本地路径不存在: ${localCandidate}`);
|
|
128
|
+
}
|
|
129
|
+
const shorthand = GITHUB_SHORTHAND.exec(sourceInput);
|
|
130
|
+
if (shorthand) {
|
|
131
|
+
if (shorthand[1] === '.' || shorthand[1] === '..' || shorthand[2] === '.' || shorthand[2] === '..') {
|
|
132
|
+
throw new CommandError('GitHub owner/repo 的 owner 与 repository 不能是 . 或 ..。');
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
kind: 'git',
|
|
136
|
+
input: sourceInput,
|
|
137
|
+
displayValue: sourceInput,
|
|
138
|
+
clientValue: sourceInput,
|
|
139
|
+
vscodeValue: sourceInput,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
if (SCP_SSH_URL.test(sourceInput)) {
|
|
143
|
+
assertNoEncodedTerminalControlCharacters(sourceInput, 'SCP SSH Git URL');
|
|
144
|
+
return {
|
|
145
|
+
kind: 'git',
|
|
146
|
+
input: sourceInput,
|
|
147
|
+
displayValue: sourceInput,
|
|
148
|
+
clientValue: sourceInput,
|
|
149
|
+
vscodeValue: sourceInput,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
if (sourceInput.includes('://')) {
|
|
153
|
+
assertNoEncodedTerminalControlCharacters(sourceInput, 'Marketplace Git URL');
|
|
154
|
+
let parsed;
|
|
155
|
+
try {
|
|
156
|
+
parsed = new URL(sourceInput);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
throw new CommandError('Marketplace Git URL 格式无效。');
|
|
160
|
+
}
|
|
161
|
+
if (parsed.protocol === 'ssh:') {
|
|
162
|
+
return normalizeSshSource(sourceInput, parsed);
|
|
163
|
+
}
|
|
164
|
+
return normalizeHttpsSource(sourceInput, parsed);
|
|
165
|
+
}
|
|
166
|
+
throw new CommandError('无法识别来源;请传入已存在的本地目录、owner/repo、HTTPS Git URL 或 SSH Git URL。');
|
|
167
|
+
}
|
|
168
|
+
export function normalizeTargetIds(values) {
|
|
169
|
+
const requested = new Set();
|
|
170
|
+
for (const value of values) {
|
|
171
|
+
if (!isAgentTargetId(value)) {
|
|
172
|
+
throw new CommandError(`未知 agent: ${value}。可选值: ${AGENT_TARGET_IDS.join(', ')}`);
|
|
173
|
+
}
|
|
174
|
+
requested.add(value);
|
|
175
|
+
}
|
|
176
|
+
const normalized = AGENT_TARGET_IDS.filter((id) => requested.has(id));
|
|
177
|
+
if (normalized.length === 0) {
|
|
178
|
+
throw new CommandError('至少选择一个 agent。');
|
|
179
|
+
}
|
|
180
|
+
return normalized;
|
|
181
|
+
}
|
|
182
|
+
export async function inspectMarketplaceRegistration(sourceInput, options = {}) {
|
|
183
|
+
const source = normalizeMarketplaceSource(sourceInput, options);
|
|
184
|
+
const targetIds = normalizeTargetIds(options.targetIds ?? AGENT_TARGET_IDS);
|
|
185
|
+
const selected = new Set(targetIds);
|
|
186
|
+
const targets = [];
|
|
187
|
+
let interrupted = false;
|
|
188
|
+
for (const adapter of MARKETPLACE_REGISTRATION_ADAPTERS) {
|
|
189
|
+
if (!selected.has(adapter.id)) {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (!interrupted && options.runtime?.signal?.aborted) {
|
|
193
|
+
targets.push({
|
|
194
|
+
id: adapter.id,
|
|
195
|
+
label: adapter.label,
|
|
196
|
+
status: 'interrupted',
|
|
197
|
+
message: '因用户中断未执行能力探测或注册。',
|
|
198
|
+
recovery: '确认客户端状态后重新运行命令。',
|
|
199
|
+
});
|
|
200
|
+
interrupted = true;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
if (interrupted) {
|
|
204
|
+
targets.push({
|
|
205
|
+
id: adapter.id,
|
|
206
|
+
label: adapter.label,
|
|
207
|
+
status: 'interrupted',
|
|
208
|
+
message: '因前序目标中断未执行能力探测或注册。',
|
|
209
|
+
recovery: '确认中断目标的客户端状态后重新运行命令。',
|
|
210
|
+
});
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
const inspection = await adapter.inspect(source, options.runtime);
|
|
214
|
+
targets.push(inspection);
|
|
215
|
+
if (inspection.status === 'interrupted') {
|
|
216
|
+
interrupted = true;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return { source, targets };
|
|
220
|
+
}
|
|
221
|
+
function resultFromInspection(target) {
|
|
222
|
+
return {
|
|
223
|
+
id: target.id,
|
|
224
|
+
label: target.label,
|
|
225
|
+
status: target.status === 'ready' ? 'failed' : target.status,
|
|
226
|
+
message: target.message,
|
|
227
|
+
recovery: target.recovery,
|
|
228
|
+
...(target.invocation ? { invocation: target.invocation } : {}),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
function interruptedBeforeRegistrationResult(target, message) {
|
|
232
|
+
return {
|
|
233
|
+
id: target.id,
|
|
234
|
+
label: target.label,
|
|
235
|
+
status: 'interrupted',
|
|
236
|
+
message,
|
|
237
|
+
recovery: '确认中断目标的客户端状态后重新运行命令。',
|
|
238
|
+
...(target.invocation ? { invocation: target.invocation } : {}),
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export function marketplaceRegistrationExitCode(results) {
|
|
242
|
+
if (results.some((result) => result.status === 'interrupted')) {
|
|
243
|
+
return 130;
|
|
244
|
+
}
|
|
245
|
+
const completed = results.filter((result) => result.status === 'completed').length;
|
|
246
|
+
if (completed === results.length && results.length > 0) {
|
|
247
|
+
return 0;
|
|
248
|
+
}
|
|
249
|
+
if (completed > 0) {
|
|
250
|
+
return 2;
|
|
251
|
+
}
|
|
252
|
+
return 1;
|
|
253
|
+
}
|
|
254
|
+
export async function executeMarketplaceRegistration(inspection, options = {}) {
|
|
255
|
+
const preflightInterruptedIndex = inspection.targets.findIndex((target) => target.status === 'interrupted');
|
|
256
|
+
if (preflightInterruptedIndex >= 0) {
|
|
257
|
+
const results = inspection.targets.map((target, index) => {
|
|
258
|
+
if (index < preflightInterruptedIndex && target.status === 'ready') {
|
|
259
|
+
return interruptedBeforeRegistrationResult(target, `因能力探测阶段中断未执行注册。预检状态:${target.message}`);
|
|
260
|
+
}
|
|
261
|
+
return resultFromInspection(target);
|
|
262
|
+
});
|
|
263
|
+
results.forEach((result) => options.onTargetResult?.(result));
|
|
264
|
+
return {
|
|
265
|
+
source: inspection.source,
|
|
266
|
+
results,
|
|
267
|
+
exitCode: 130,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
const results = [];
|
|
271
|
+
for (const [index, target] of inspection.targets.entries()) {
|
|
272
|
+
if (options.runtime?.signal?.aborted) {
|
|
273
|
+
for (const remaining of inspection.targets.slice(index)) {
|
|
274
|
+
const skipped = remaining.status === 'ready'
|
|
275
|
+
? interruptedBeforeRegistrationResult(remaining, `因用户中断未执行注册。预检状态:${remaining.message}`)
|
|
276
|
+
: resultFromInspection(remaining);
|
|
277
|
+
results.push(skipped);
|
|
278
|
+
options.onTargetResult?.(skipped);
|
|
279
|
+
}
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
options.onTargetStart?.(target);
|
|
283
|
+
const adapter = getMarketplaceRegistrationAdapter(target.id);
|
|
284
|
+
const result = await adapter.execute(inspection.source, target, options.runtime);
|
|
285
|
+
results.push(result);
|
|
286
|
+
options.onTargetResult?.(result);
|
|
287
|
+
if (result.status === 'interrupted') {
|
|
288
|
+
for (const remaining of inspection.targets.slice(index + 1)) {
|
|
289
|
+
const skipped = remaining.status === 'ready'
|
|
290
|
+
? interruptedBeforeRegistrationResult(remaining, `因前序目标中断未执行注册。预检状态:${remaining.message}`)
|
|
291
|
+
: resultFromInspection(remaining);
|
|
292
|
+
results.push(skipped);
|
|
293
|
+
options.onTargetResult?.(skipped);
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
source: inspection.source,
|
|
300
|
+
results,
|
|
301
|
+
exitCode: marketplaceRegistrationExitCode(results),
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=marketplace-registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace-registration.js","sourceRoot":"","sources":["../../src/application/marketplace-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,iCAAiC,EACjC,iCAAiC,GAElC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,gBAAgB,EAChB,eAAe,GAOhB,MAAM,wCAAwC,CAAC;AAOhD,MAAM,gBAAgB,GAAG,wCAAwC,CAAC;AAClE,MAAM,WAAW,GAAG,+CAA+C,CAAC;AACpE,MAAM,2BAA2B,GAAG,+BAA+B,CAAC;AAEpE,SAAS,iCAAiC,CAAC,KAAa,EAAE,KAAa;IACrE,IAAI,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,YAAY,CAAC,GAAG,KAAK,wBAAwB,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,SAAS,wCAAwC,CAAC,KAAa,EAAE,KAAa;IAC5E,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,YAAY,CAAC,GAAG,KAAK,aAAa,CAAC,CAAC;IAChD,CAAC;IACD,iCAAiC,CAAC,OAAO,EAAE,OAAO,KAAK,EAAE,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,4BAA4B,CAAC,OAAe,EAAE,YAAoB;IACzE,OAAO,G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AAC,OAAO,CAAC,CAAC;gBACtB,OAAO,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC;YACpC,CAAC;YACD,MAAM;QACR,CAAC;IACH,CAAC;IACD,OAAO;QACL,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,OAAO;QACP,QAAQ,EAAE,+BAA+B,CAAC,OAAO,CAAC;KACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type MarketplaceMetadata } from './marketplace-document-contract.js';
|
|
2
|
+
export { MARKETPLACE_FILENAME, type MarketplaceMetadata, } from './marketplace-document-contract.js';
|
|
3
|
+
/**
|
|
4
|
+
* Compatibility reader for existing CLI and health consumers. Document
|
|
5
|
+
* interpretation is owned by marketplace-document; callers keep their current
|
|
6
|
+
* throw-on-invalid behavior and optional-field compatibility without a
|
|
7
|
+
* parallel YAML parser.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readMarketplaceMetadata(rootDirectory: string): MarketplaceMetadata;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { readMarketplaceCompatibilityView } from './marketplace-document.js';
|
|
3
|
+
import { MARKETPLACE_FILENAME, } from './marketplace-document-contract.js';
|
|
4
|
+
export { MARKETPLACE_FILENAME, } from './marketplace-document-contract.js';
|
|
5
|
+
/**
|
|
6
|
+
* Compatibility reader for existing CLI and health consumers. Document
|
|
7
|
+
* interpretation is owned by marketplace-document; callers keep their current
|
|
8
|
+
* throw-on-invalid behavior and optional-field compatibility without a
|
|
9
|
+
* parallel YAML parser.
|
|
10
|
+
*/
|
|
11
|
+
export function readMarketplaceMetadata(rootDirectory) {
|
|
12
|
+
const result = readMarketplaceCompatibilityView(rootDirectory);
|
|
13
|
+
if (result.status === 'loaded')
|
|
14
|
+
return result.metadata;
|
|
15
|
+
if (result.status === 'unavailable' &&
|
|
16
|
+
result.problem.code === 'MARKETPLACE_MISSING') {
|
|
17
|
+
throw new Error(`marketplace.yaml not found: ${join(rootDirectory, MARKETPLACE_FILENAME)}`);
|
|
18
|
+
}
|
|
19
|
+
if (result.status === 'invalid' &&
|
|
20
|
+
result.compatibilityFailure === 'non-object') {
|
|
21
|
+
throw new Error('marketplace.yaml must contain an object');
|
|
22
|
+
}
|
|
23
|
+
if (result.status === 'invalid' &&
|
|
24
|
+
result.compatibilityFailure === 'invalid-name') {
|
|
25
|
+
throw new Error('marketplace.yaml field `name` must be a non-empty string');
|
|
26
|
+
}
|
|
27
|
+
const detail = result.problem.technicalDetail === undefined
|
|
28
|
+
? result.problem.message
|
|
29
|
+
: `${result.problem.message}: ${result.problem.technicalDetail}`;
|
|
30
|
+
throw new Error(`${MARKETPLACE_FILENAME}: ${detail}`);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=marketplace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marketplace.js","sourceRoot":"","sources":["../../src/application/marketplace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EACL,oBAAoB,GAErB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,oBAAoB,GAErB,MAAM,oCAAoC,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,aAAqB;IAC3D,MAAM,MAAM,GAAG,gCAAgC,CAAC,aAAa,CAAC,CAAC;IAC/D,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC;IACvD,IACE,MAAM,CAAC,MAAM,KAAK,aAAa;QAC/B,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,qBAAqB,EAC7C,CAAC;QACD,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,CAAC,aAAa,EAAE,oBAAoB,CAAC,EAAE,CAC3E,CAAC;IACJ,CAAC;IACD,IACE,MAAM,CAAC,MAAM,KAAK,SAAS;QAC3B,MAAM,CAAC,oBAAoB,KAAK,YAAY,EAC5C,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC7D,CAAC;IACD,IACE,MAAM,CAAC,MAAM,KAAK,SAAS;QAC3B,MAAM,CAAC,oBAAoB,KAAK,cAAc,EAC9C,CAAC;QACD,MAAM,IAAI,KAAK,CACb,0DAA0D,CAC3D,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GACV,MAAM,CAAC,OAAO,CAAC,eAAe,KAAK,SAAS;QAC1C,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO;QACxB,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,KAAK,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC;IACrE,MAAM,IAAI,KAAK,CAAC,GAAG,oBAAoB,KAAK,MAAM,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { PluginHook, PluginLsp, PluginMcp, PluginSkill } from "../schema/plugin-yaml.js";
|
|
2
|
+
import type { ComponentType } from "./plugin-scaffold.js";
|
|
3
|
+
export type PluginComponentKind = ComponentType;
|
|
4
|
+
export interface PluginComponentCollections {
|
|
5
|
+
readonly skill: readonly PluginSkill[];
|
|
6
|
+
readonly mcp: readonly PluginMcp[];
|
|
7
|
+
readonly hook: readonly PluginHook[];
|
|
8
|
+
readonly lsp: readonly PluginLsp[];
|
|
9
|
+
}
|
|
10
|
+
export type PluginComponentValue = PluginSkill | PluginMcp | PluginHook | PluginLsp;
|
|
11
|
+
export type PluginComponentMutation = {
|
|
12
|
+
readonly operation: "add";
|
|
13
|
+
readonly kind: PluginComponentKind;
|
|
14
|
+
readonly value: PluginComponentValue;
|
|
15
|
+
readonly createScaffold: boolean;
|
|
16
|
+
} | {
|
|
17
|
+
readonly operation: "edit";
|
|
18
|
+
readonly kind: PluginComponentKind;
|
|
19
|
+
readonly index: number;
|
|
20
|
+
readonly value: PluginComponentValue;
|
|
21
|
+
} | {
|
|
22
|
+
readonly operation: "remove";
|
|
23
|
+
readonly kind: PluginComponentKind;
|
|
24
|
+
readonly index: number;
|
|
25
|
+
};
|
|
26
|
+
export interface PluginComponentIssue {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
readonly severity: "blocking" | "attention";
|
|
29
|
+
readonly kind: PluginComponentKind;
|
|
30
|
+
readonly index?: number;
|
|
31
|
+
readonly field: string;
|
|
32
|
+
readonly title: string;
|
|
33
|
+
readonly message: string;
|
|
34
|
+
readonly impact: string;
|
|
35
|
+
readonly nextAction: string;
|
|
36
|
+
readonly technicalPath: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PluginComponentPermissions {
|
|
39
|
+
readonly readable: boolean;
|
|
40
|
+
readonly writable: boolean;
|
|
41
|
+
readonly executable: boolean;
|
|
42
|
+
}
|
|
43
|
+
export type PluginComponentFileState = "present" | "missing" | "unsafe" | "wrong-type" | "unavailable" | "external-command";
|
|
44
|
+
export interface PluginComponentFileFact {
|
|
45
|
+
readonly kind: PluginComponentKind;
|
|
46
|
+
readonly componentIndex: number;
|
|
47
|
+
readonly role: "skill-directory" | "skill-document" | "hook-script" | "command" | "argument" | "workspace-folder";
|
|
48
|
+
readonly configuredPath: string;
|
|
49
|
+
readonly state: PluginComponentFileState;
|
|
50
|
+
readonly objectType: "file" | "directory" | "other" | "unknown";
|
|
51
|
+
readonly permissions: PluginComponentPermissions;
|
|
52
|
+
readonly canReveal: boolean;
|
|
53
|
+
readonly canOpenExternally: boolean;
|
|
54
|
+
readonly message: string;
|
|
55
|
+
}
|
|
56
|
+
export interface PluginComponentImpactPreview {
|
|
57
|
+
readonly operation: PluginComponentMutation["operation"];
|
|
58
|
+
readonly kind: PluginComponentKind;
|
|
59
|
+
readonly title: string;
|
|
60
|
+
readonly summary: string;
|
|
61
|
+
readonly canonicalChanges: readonly string[];
|
|
62
|
+
readonly generatedResults: readonly string[];
|
|
63
|
+
readonly retainedUserFiles: readonly string[];
|
|
64
|
+
readonly scaffoldFiles: readonly string[];
|
|
65
|
+
readonly generatedAction: "none";
|
|
66
|
+
}
|
|
67
|
+
export interface PluginComponentPlan {
|
|
68
|
+
readonly workspaceCanonicalPath: string;
|
|
69
|
+
readonly pluginDirectoryName: string;
|
|
70
|
+
readonly expectedRevision: string;
|
|
71
|
+
readonly fingerprint: string;
|
|
72
|
+
readonly nextBytes: Buffer;
|
|
73
|
+
readonly createFiles: readonly {
|
|
74
|
+
readonly relativePath: string;
|
|
75
|
+
readonly bytes: Buffer;
|
|
76
|
+
readonly mode: number;
|
|
77
|
+
}[];
|
|
78
|
+
readonly impact: PluginComponentImpactPreview;
|
|
79
|
+
}
|
|
80
|
+
export interface PluginComponentTransactionFacts {
|
|
81
|
+
readonly canonical: "unchanged" | "committed" | "restored" | "uncertain";
|
|
82
|
+
readonly scaffolds: "none" | "committed" | "rolled-back" | "residual";
|
|
83
|
+
readonly cleanupComplete: boolean;
|
|
84
|
+
}
|
|
85
|
+
export type ReadPluginComponentsResult = {
|
|
86
|
+
readonly status: "loaded";
|
|
87
|
+
readonly canonicalName: string;
|
|
88
|
+
readonly revision: string;
|
|
89
|
+
readonly collections: PluginComponentCollections;
|
|
90
|
+
readonly issues: readonly PluginComponentIssue[];
|
|
91
|
+
readonly files: readonly PluginComponentFileFact[];
|
|
92
|
+
} | {
|
|
93
|
+
readonly status: "invalid" | "unavailable";
|
|
94
|
+
readonly message: string;
|
|
95
|
+
readonly impact: string;
|
|
96
|
+
readonly nextAction: string;
|
|
97
|
+
readonly revision?: string;
|
|
98
|
+
};
|
|
99
|
+
export type PlanPluginComponentMutationResult = {
|
|
100
|
+
readonly status: "planned";
|
|
101
|
+
readonly plan: PluginComponentPlan;
|
|
102
|
+
readonly issues: readonly PluginComponentIssue[];
|
|
103
|
+
} | {
|
|
104
|
+
readonly status: "conflict";
|
|
105
|
+
readonly currentRevision: string;
|
|
106
|
+
readonly message: string;
|
|
107
|
+
} | {
|
|
108
|
+
readonly status: "invalid" | "unavailable";
|
|
109
|
+
readonly message: string;
|
|
110
|
+
readonly impact: string;
|
|
111
|
+
readonly nextAction: string;
|
|
112
|
+
readonly issues: readonly PluginComponentIssue[];
|
|
113
|
+
};
|
|
114
|
+
export type ExecutePluginComponentPlanResult = {
|
|
115
|
+
readonly status: "saved";
|
|
116
|
+
readonly revision: string;
|
|
117
|
+
readonly changedPaths: readonly string[];
|
|
118
|
+
readonly diskChanged: boolean;
|
|
119
|
+
readonly cleanupComplete: true;
|
|
120
|
+
readonly transaction: PluginComponentTransactionFacts;
|
|
121
|
+
} | {
|
|
122
|
+
readonly status: "conflict";
|
|
123
|
+
readonly currentRevision: string;
|
|
124
|
+
readonly diskChanged: false;
|
|
125
|
+
readonly changedPaths: readonly [];
|
|
126
|
+
readonly cleanupComplete: true;
|
|
127
|
+
readonly transaction: PluginComponentTransactionFacts;
|
|
128
|
+
} | {
|
|
129
|
+
readonly status: "busy" | "failed";
|
|
130
|
+
readonly message: string;
|
|
131
|
+
readonly diskChanged: boolean;
|
|
132
|
+
readonly changedPaths: readonly string[];
|
|
133
|
+
readonly cleanupComplete: boolean;
|
|
134
|
+
readonly transaction: PluginComponentTransactionFacts;
|
|
135
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-components-contract.js","sourceRoot":"","sources":["../../src/application/plugin-components-contract.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AtomicDocumentAndFilesCommitDependencies } from "../infrastructure/document-commit.js";
|
|
2
|
+
import { type PluginDocumentReadDependencies } from "./plugin-document.js";
|
|
3
|
+
import { type ExecutePluginComponentPlanResult, type PlanPluginComponentMutationResult, type PluginComponentMutation, type PluginComponentPlan, type ReadPluginComponentsResult } from "./plugin-components-contract.js";
|
|
4
|
+
export interface PluginComponentsRequest {
|
|
5
|
+
readonly directory: string;
|
|
6
|
+
readonly pluginDirectoryName: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PlanPluginComponentMutationRequest extends PluginComponentsRequest {
|
|
9
|
+
readonly expectedRevision: string;
|
|
10
|
+
readonly mutation: PluginComponentMutation;
|
|
11
|
+
}
|
|
12
|
+
export interface PluginComponentDependencies extends PluginDocumentReadDependencies {
|
|
13
|
+
readonly commitDependencies?: AtomicDocumentAndFilesCommitDependencies;
|
|
14
|
+
}
|
|
15
|
+
export declare function readPluginComponents(request: PluginComponentsRequest, dependencies?: PluginDocumentReadDependencies): ReadPluginComponentsResult;
|
|
16
|
+
export declare function planPluginComponentMutation(request: PlanPluginComponentMutationRequest, dependencies?: PluginDocumentReadDependencies): PlanPluginComponentMutationResult;
|
|
17
|
+
export declare function executePluginComponentPlan(plan: PluginComponentPlan, dependencies?: PluginComponentDependencies): ExecutePluginComponentPlanResult;
|