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
@@ -0,0 +1,200 @@
1
+ import { createInterface } from 'node:readline/promises';
2
+ import { executeMarketplaceRegistration, inspectMarketplaceRegistration, normalizeTargetIds, } from '../application/marketplace-registration.js';
3
+ import { AGENT_TARGET_IDS, } from '../application/marketplace-registration-contract.js';
4
+ import { CommandError } from '../core/errors.js';
5
+ const INSPECTION_LABELS = {
6
+ ready: '可自动',
7
+ 'missing-cli': '缺少 CLI',
8
+ 'manual-required': '需手动',
9
+ failed: '不可用',
10
+ interrupted: '中断',
11
+ };
12
+ const RESULT_LABELS = {
13
+ completed: '完成',
14
+ 'missing-cli': '缺少 CLI',
15
+ 'manual-required': '需手动',
16
+ failed: '失败',
17
+ interrupted: '中断',
18
+ };
19
+ function defaultWrite(text) {
20
+ process.stdout.write(text);
21
+ }
22
+ async function defaultReadSelection(interruptController) {
23
+ if (interruptController.signal.aborted) {
24
+ return undefined;
25
+ }
26
+ const terminal = createInterface({ input: process.stdin, output: process.stdout });
27
+ const onSigint = () => {
28
+ interruptController.abort('SIGINT');
29
+ };
30
+ terminal.on('SIGINT', onSigint);
31
+ try {
32
+ if (interruptController.signal.aborted) {
33
+ return undefined;
34
+ }
35
+ return await terminal.question('> ', { signal: interruptController.signal });
36
+ }
37
+ catch (error) {
38
+ if (interruptController.signal.aborted ||
39
+ error?.name === 'AbortError') {
40
+ return undefined;
41
+ }
42
+ throw error;
43
+ }
44
+ finally {
45
+ terminal.removeListener('SIGINT', onSigint);
46
+ terminal.close();
47
+ }
48
+ }
49
+ export function parseTargetSelection(input, availableTargetIds, defaultTargetIds) {
50
+ const value = input.trim();
51
+ if (value.length === 0) {
52
+ if (defaultTargetIds.length === 0) {
53
+ throw new CommandError('当前没有默认可自动处理的 agent;请输入明确编号或 all。');
54
+ }
55
+ return normalizeTargetIds(defaultTargetIds);
56
+ }
57
+ if (value.toLowerCase() === 'all') {
58
+ return normalizeTargetIds(availableTargetIds);
59
+ }
60
+ const tokens = value.split(',').map((token) => token.trim());
61
+ if (tokens.some((token) => !/^\d+$/u.test(token))) {
62
+ throw new CommandError('请选择逗号分隔的 agent 编号,或输入 all。');
63
+ }
64
+ const selected = [];
65
+ for (const token of tokens) {
66
+ const index = Number(token) - 1;
67
+ const target = availableTargetIds[index];
68
+ if (!target) {
69
+ throw new CommandError(`agent 编号超出范围: ${token}`);
70
+ }
71
+ selected.push(target);
72
+ }
73
+ return normalizeTargetIds(selected);
74
+ }
75
+ function renderPrompt(inspection, write) {
76
+ write('请选择要注册 Marketplace 的 agent:\n');
77
+ inspection.targets.forEach((target, index) => {
78
+ write(` ${index + 1}. ${target.label.padEnd(18)} [${INSPECTION_LABELS[target.status]}]\n`);
79
+ });
80
+ const defaults = inspection.targets
81
+ .filter((target) => target.status === 'ready')
82
+ .map((target) => target.id);
83
+ const defaultNumbers = defaults.map((id) => inspection.targets.findIndex((target) => target.id === id) + 1);
84
+ write(`\n默认:${defaultNumbers.length > 0 ? defaultNumbers.join(',') : '无'}\n`);
85
+ write('输入编号(逗号分隔),输入 all 选择全部,直接回车接受默认:\n');
86
+ return defaults;
87
+ }
88
+ function formatInvocation(target) {
89
+ if (!target.invocation) {
90
+ return target.message;
91
+ }
92
+ return [target.invocation.executable, ...target.invocation.args.map((arg) => JSON.stringify(arg))]
93
+ .join(' ');
94
+ }
95
+ function renderTargetStart(target, write) {
96
+ if (target.status === 'ready') {
97
+ write(`→ ${target.label}: ${formatInvocation(target)}\n`);
98
+ }
99
+ }
100
+ function renderResultLine(result, write) {
101
+ write(` [${RESULT_LABELS[result.status]}] ${result.label}:${result.message}\n`);
102
+ if (result.status !== 'completed' && result.recovery) {
103
+ write(` 下一步:${result.recovery}\n`);
104
+ }
105
+ }
106
+ function renderReport(report, write) {
107
+ const completed = report.results.filter((result) => result.status === 'completed');
108
+ const incomplete = report.results.filter((result) => result.status !== 'completed');
109
+ write('\n注册结果:\n');
110
+ write('已完成:\n');
111
+ if (completed.length === 0) {
112
+ write(' 无\n');
113
+ }
114
+ else {
115
+ completed.forEach((result) => renderResultLine(result, write));
116
+ }
117
+ write('未完成:\n');
118
+ if (incomplete.length === 0) {
119
+ write(' 无\n');
120
+ }
121
+ else {
122
+ incomplete.forEach((result) => renderResultLine(result, write));
123
+ }
124
+ write(`退出码:${report.exitCode}\n`);
125
+ }
126
+ function selectedInspection(inspection, targetIds) {
127
+ const selected = new Set(targetIds);
128
+ return {
129
+ source: inspection.source,
130
+ targets: inspection.targets.filter((target) => selected.has(target.id)),
131
+ };
132
+ }
133
+ export async function runInstallRepo(source, options, dependencies = {}) {
134
+ const requested = [...(options.agent ?? [])];
135
+ if (options.all && requested.length > 0) {
136
+ throw new CommandError('不能同时使用 --agent 与 --all。');
137
+ }
138
+ const interactive = dependencies.interactive ?? Boolean(process.stdin.isTTY && process.stdout.isTTY);
139
+ const explicitTargetIds = options.all
140
+ ? [...AGENT_TARGET_IDS]
141
+ : requested.length > 0
142
+ ? normalizeTargetIds(requested)
143
+ : undefined;
144
+ if (!explicitTargetIds && !interactive) {
145
+ throw new CommandError('非交互终端必须显式传入至少一个 --agent,或使用 --all。');
146
+ }
147
+ const write = dependencies.write ?? defaultWrite;
148
+ const interruptController = new AbortController();
149
+ const onSigint = () => interruptController.abort('SIGINT');
150
+ const runtime = {
151
+ ...dependencies.runtime,
152
+ signal: interruptController.signal,
153
+ };
154
+ process.on('SIGINT', onSigint);
155
+ try {
156
+ let inspection = await inspectMarketplaceRegistration(source, {
157
+ baseDir: dependencies.baseDir,
158
+ homeDir: dependencies.homeDir,
159
+ targetIds: explicitTargetIds ?? AGENT_TARGET_IDS,
160
+ runtime,
161
+ });
162
+ if (!explicitTargetIds) {
163
+ const interrupted = inspection.targets.some((target) => target.status === 'interrupted');
164
+ if (interrupted) {
165
+ const report = await executeMarketplaceRegistration(inspection, {
166
+ runtime,
167
+ onTargetResult: (result) => renderResultLine(result, write),
168
+ });
169
+ renderReport(report, write);
170
+ return { exitCode: 130, report };
171
+ }
172
+ const defaultTargetIds = renderPrompt(inspection, write);
173
+ if (interruptController.signal.aborted) {
174
+ write('\n[中断] 用户取消了 Marketplace 注册。\n');
175
+ return { exitCode: 130 };
176
+ }
177
+ const answer = dependencies.readSelection
178
+ ? await dependencies.readSelection(interruptController.signal)
179
+ : await defaultReadSelection(interruptController);
180
+ if (answer === undefined || interruptController.signal.aborted) {
181
+ write('\n[中断] 用户取消了 Marketplace 注册。\n');
182
+ return { exitCode: 130 };
183
+ }
184
+ const selected = parseTargetSelection(answer, inspection.targets.map((target) => target.id), defaultTargetIds);
185
+ inspection = selectedInspection(inspection, selected);
186
+ }
187
+ write(`Marketplace 来源:${inspection.source.displayValue}\n`);
188
+ const report = await executeMarketplaceRegistration(inspection, {
189
+ runtime,
190
+ onTargetStart: (target) => renderTargetStart(target, write),
191
+ onTargetResult: (result) => renderResultLine(result, write),
192
+ });
193
+ renderReport(report, write);
194
+ return { exitCode: report.exitCode, report };
195
+ }
196
+ finally {
197
+ process.removeListener('SIGINT', onSigint);
198
+ }
199
+ }
200
+ //# sourceMappingURL=install-repo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-repo.js","sourceRoot":"","sources":["../../src/commands/install-repo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EACL,8BAA8B,EAC9B,8BAA8B,EAC9B,kBAAkB,GACnB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,gBAAgB,GAMjB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAqBjD,MAAM,iBAAiB,GAA+C;IACpE,KAAK,EAAE,KAAK;IACZ,aAAa,EAAE,QAAQ;IACvB,iBAAiB,EAAE,KAAK;IACxB,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF,MAAM,aAAa,GAAuD;IACxE,SAAS,EAAE,IAAI;IACf,aAAa,EAAE,QAAQ;IACvB,iBAAiB,EAAE,KAAK;IACxB,MAAM,EAAE,IAAI;IACZ,WAAW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AE,KAAK,CAAC,CAAC;QAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC/C,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * release-local 命令 — 组装本地发布产物
3
+ *
4
+ * CLI 只拥有终端呈现;目录、manifest、README、archive 身份与事务
5
+ * 由共享 application plan/commit 能力负责。
6
+ */
7
+ export declare function runReleaseLocal(options?: {
8
+ root?: string;
9
+ }): void;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * release-local 命令 — 组装本地发布产物
3
+ *
4
+ * CLI 只拥有终端呈现;目录、manifest、README、archive 身份与事务
5
+ * 由共享 application plan/commit 能力负责。
6
+ */
7
+ import { join } from "node:path";
8
+ import chalk from "chalk";
9
+ import { commitLocalReleasePlan, planLocalRelease, } from "../application/local-release.js";
10
+ import { resolveRepoContext } from "../utils/helpers.js";
11
+ export function runReleaseLocal(options = {}) {
12
+ console.log(chalk.blue("⟳ 组装本地发布包...\n"));
13
+ const plan = planLocalRelease(resolveRepoContext(options.root).rootDir);
14
+ const result = commitLocalReleasePlan(plan);
15
+ if (result.status !== "success") {
16
+ throw new Error(result.status === "canceled"
17
+ ? result.message
18
+ : result.phase === "archive"
19
+ ? `发布包压缩失败: ${plan.archiveName}`
20
+ : result.message);
21
+ }
22
+ const archivePath = join(plan.workspaceDirectory, plan.archiveRelativePath);
23
+ console.log(chalk.green(` ✓ dist/release (${plan.pluginCount} 个插件)`));
24
+ console.log(chalk.green(` ✓ ${archivePath}`));
25
+ console.log(chalk.green("\n✓ 本地发布包生成完成"));
26
+ }
27
+ //# sourceMappingURL=release-local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release-local.js","sourceRoot":"","sources":["../../src/commands/release-local.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;A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the shared read-only health
3
+ * scan. The public stdout and exit behavior remains the CLI contract.
4
+ */
5
+ export declare function runValidate(name: string | undefined, options: {
6
+ all: boolean;
7
+ root?: string;
8
+ }): void;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * validate command — terminal presentation over the shared read-only health
3
+ * scan. The public stdout and exit behavior remains the CLI contract.
4
+ */
5
+ import chalk from 'chalk';
6
+ import { adaptHealthToCliValidation } from '../adapters/cli-validation.js';
7
+ import { scanWorkspaceHealth } from '../application/workspace-health.js';
8
+ import { CommandError } from '../core/errors.js';
9
+ import { listPluginNames, resolveRepoContext, } from '../utils/helpers.js';
10
+ export function runValidate(name, options) {
11
+ const context = resolveRepoContext(options.root);
12
+ const names = options.all ? listPluginNames(context) : name ? [name] : [];
13
+ if (names.length === 0) {
14
+ throw new CommandError('请指定插件名或使用 --all');
15
+ }
16
+ const scan = scanWorkspaceHealth({
17
+ directory: context.rootDir,
18
+ pluginNames: names,
19
+ });
20
+ if (scan.status === 'unavailable') {
21
+ throw new CommandError(scan.error.technicalDetail ?? scan.error.message);
22
+ }
23
+ const results = adaptHealthToCliValidation(scan.snapshot, scan.validationDiagnostics, names);
24
+ console.log(chalk.blue(`⟳ 验证 ${names.length} 个插件...\n`));
25
+ let allValid = true;
26
+ for (const result of results) {
27
+ if (result.valid) {
28
+ console.log(chalk.green(` ✓ ${result.name}`));
29
+ continue;
30
+ }
31
+ allValid = false;
32
+ console.log(chalk.red(` ✗ ${result.name}`));
33
+ for (const error of result.errors) {
34
+ console.log(chalk.red(` └─ ${error}`));
35
+ }
36
+ }
37
+ console.log();
38
+ if (allValid) {
39
+ console.log(chalk.green('✓ 所有插件验证通过'));
40
+ }
41
+ else {
42
+ throw new CommandError('存在验证错误');
43
+ }
44
+ }
45
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,M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,CAAC;QAC7B,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAC/C,SAAS;QACX,CAAC;QACD,QAAQ,GAAG,KAAK,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IACzC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare class CommandError extends Error {
2
+ readonly exitCode: number;
3
+ constructor(message: string, exitCode?: number);
4
+ }
5
+ export declare function isCommandError(error: unknown): error is CommandError;
@@ -0,0 +1,12 @@
1
+ export class CommandError extends Error {
2
+ exitCode;
3
+ constructor(message, exitCode = 1) {
4
+ super(message);
5
+ this.name = 'CommandError';
6
+ this.exitCode = exitCode;
7
+ }
8
+ }
9
+ export function isCommandError(error) {
10
+ return error instanceof CommandError;
11
+ }
12
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,QAAQ,CAAS;IAE1B,YAAY,OAAe,EAAE,QAAQ,GAAG,CAAC;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,KAAK,YAAY,YAAY,CAAC;AACvC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const PLUGKIT_PLUGIN_YAML: string;
2
+ export declare const PLUGKIT_SETUP_SKILL: string;
3
+ export declare const PLUGKIT_MAINTAIN_SKILL: string;
@@ -0,0 +1,9 @@
1
+ // 此文件由 scripts/generate-skill.ts 自动生成,请勿手动编辑
2
+ // 源头:
3
+ // - marketplace/plugins/plugkit/plugin.yaml
4
+ // - marketplace/plugins/plugkit/skills/setup/SKILL.md
5
+ // - marketplace/plugins/plugkit/skills/maintain/SKILL.md
6
+ export const PLUGKIT_PLUGIN_YAML = "name: plugkit\nversion: \"0.1.0\"\ndescription: \"Official agent-plugkit maintenance plugin\"\nauthor:\n name: \"Agent Plugkit\"\ncategory: tooling\ntags:\n - plugkit\n - marketplace\n\ncomponents:\n skills:\n - name: setup\n path: skills/setup\n description: \"Guide agents to install, update, or uninstall the agent-plugkit CLI and bootstrap a marketplace repository.\"\n - name: maintain\n path: skills/maintain\n description: \"Guide agents to create, validate, build, and release plugkit plugins.\"\n\nplatform:\n codex:\n interface:\n displayName: \"Plugkit\"\n shortDescription: \"Setup and maintain agent-plugkit marketplaces\"\n longDescription: \"Official guidance for installing agent-plugkit and maintaining agent-plugkit marketplace repositories.\"\n category: \"Tooling\"\n developerName: \"Agent Plugkit\"\n";
7
+ export const PLUGKIT_SETUP_SKILL = "---\nname: setup\ndescription: \"Guide agents to install, update, or uninstall the agent-plugkit CLI and bootstrap a marketplace repository.\"\nargument-hint: \"<install|update|uninstall>\"\n---\n\n# setup\n\nUse this skill for the lifecycle of the `agent-plugkit` CLI tool and its marketplace repository scaffold: getting it installed, keeping it current, or removing it. Once a repository is bootstrapped, switch to the `maintain` skill for day-to-day plugin work (adding components, build/index/validate/release).\n\n## Install\n\n1. Check whether `marketplace.yaml` already exists at the repo root. If it does, this repo is already bootstrapped — skip straight to `agent-plugkit validate --all` instead of re-initializing.\n2. Add the CLI as a pinned dev dependency: `npm install --save-dev agent-plugkit`. For a one-off run without a persistent install, `npx agent-plugkit --help` works too.\n3. If `marketplace.yaml` does not exist yet, scaffold the marketplace: `npx agent-plugkit init-repo [name] --organization \"<org>\"`. Leave `--no-plugkit` off unless the user explicitly does not want the official `plugkit` plugin in this repo.\n4. Confirm the scaffold: `marketplace.yaml`, `plugins/plugkit/` (with both `setup` and `maintain` skills), and the `mp`/`validate:plugins`/`build:plugins`/`build:index` scripts in `package.json`.\n5. Run `agent-plugkit build --all && agent-plugkit index && agent-plugkit validate --all` to confirm the fresh scaffold is healthy.\n\n## Update\n\n1. Check the current pinned version against latest: `npm view agent-plugkit version`.\n2. `npm install --save-dev agent-plugkit@latest` (or a specific version if the user wants to pin one).\n3. Re-run `agent-plugkit build --all && agent-plugkit index && agent-plugkit validate --all` to surface any schema or generated-artifact drift introduced by the new CLI version.\n4. Updating the CLI does not rewrite files already scaffolded under `plugins/plugkit/` in this repo — `init-repo` never overwrites existing files. If the official `plugkit` skill content changed upstream and the user wants it, diff it manually before deciding whether to overwrite.\n5. If the `plugkit` plugin is installed in an Agent Plugins-compatible or native Claude Code / Codex client, refresh it there too through that client's own update flow — the npm upgrade only updates the CLI binary, not an already-installed agent-side copy.\n\n## Uninstall\n\n1. `npm uninstall agent-plugkit` to remove the CLI dev dependency.\n2. **Never delete `marketplace.yaml`, `plugins/`, or any generated manifests as part of this.** That is the user's real marketplace content, independent of the CLI tool. Only remove it if the user explicitly asks to tear down the marketplace itself, as a separate decision.\n3. Optionally, if the user also wants the `plugkit` plugin removed from an agent client, do that through the client's own plugin-removal flow — uninstalling the npm package does not touch anything already installed there.\n\n## Contracts\n\n- This skill owns the CLI tool and repository bootstrap lifecycle only. Once a marketplace exists, route ongoing plugin work (adding skills/mcp/hooks/lsp, build, validate, release) to the `maintain` skill instead of duplicating it here.\n- Never run `init-repo` against a directory that already has `marketplace.yaml` — it fails loudly by design; treat that as \"already installed,\" not an error to route around.\n- Do not hand-edit generated root `plugin.json`/`mcp.json`, `.claude-plugin`, `.codex-plugin`, `.mcp.json`, `.lsp.json`, `hooks/hooks.json`, or marketplace indexes.\n";
8
+ export const PLUGKIT_MAINTAIN_SKILL = "---\nname: maintain\ndescription: \"Guide agents to maintain agent-plugkit marketplace plugins.\"\nargument-hint: \"<plugin-name-or-task>\"\n---\n\n# maintain\n\nUse this skill when creating or maintaining an `agent-plugkit` marketplace repository.\n\n## Working Model\n\n- Treat `plugin.yaml` as the source of truth for the Agent Plugins 1.0 portable package, Claude Code and Codex native artifacts, and all client marketplace indexes.\n- Keep portable and client-specific layers distinct: Agent Plugins discovers only root `plugin.json`, immediate-child `skills/`, and optional root `mcp.json`; marketplace registration and installation belong to each client.\n- Treat a plugin as the namespace and container. Add related skills or platform components under the existing plugin when they belong together.\n- Prefer `agent-plugkit add <skill|mcp|hook|lsp> <plugin-name> <component-name>` when extending an existing plugin.\n- Prefer `agent-plugkit init <plugin-name> --type <skill|mcp|hook|lsp>` when creating a new plugin.\n- Prefer `agent-plugkit import-skill <source-dir> [plugin-name]` when the skill already exists on disk (for example `~/.claude/skills/<name>`) — it creates a new single-skill plugin and copies `SKILL.md` verbatim.\n\n## Flow\n\n1. Inspect the existing marketplace shape before editing.\n2. Choose the plugin ID and component type.\n3. Add or edit source files under `plugins/<plugin-name>/`.\n4. Run:\n\n ```bash\n agent-plugkit build --all\n agent-plugkit index\n agent-plugkit validate --all\n ```\n\n5. Before handing off a release candidate, run `agent-plugkit release-local` or the repository's release script and inspect the local directory/archive. This does not publish, push, register, or install anything remotely.\n6. Once a ready Marketplace has an intended local or Git source, register it only when the user asks:\n\n ```bash\n agent-plugkit install-repo OWNER/REPO\n agent-plugkit install-repo OWNER/REPO --agent claude --agent codex\n agent-plugkit install-repo /path/to/marketplace --all\n ```\n\n## Client Delivery\n\n`install-repo` accepts an existing local Marketplace directory, `owner/repo`, or an HTTPS/SSH Git\nURL. With no selection flags it provides a numbered TTY multi-select; automation must pass repeated\n`--agent` values or `--all`. Sources containing C0/C1/DEL control characters, including controls\nrevealed by URL percent-decoding, are rejected before terminal output or client execution. It\nprocesses these client adapters in a fixed order:\n\n- Claude Code: native `claude plugin marketplace add <source>`.\n- Codex: native `codex plugin marketplace add <source>`.\n- GitHub Copilot: native `copilot plugin marketplace add <source>`.\n- VS Code: atomically enable `chat.plugins.enabled` and deduplicate the source in the current user's\n `chat.plugins.marketplaces`; local directories become `file://` URIs. If safe deduplication would\n lose an existing JSONC comment, the configuration root is not an absolute user path, or the file\n is not lossless UTF-8, the file remains unchanged for manual cleanup. Reload the VS Code window\n after a completed update. Revision checks and an open-file guard reject or restore detectable\n conflicts, but this pure Node transaction is not filesystem compare-and-swap: an uncooperative\n new-inode replacement after the last observable check but before either candidate commit or\n guard-content recovery rename can be overwritten. Failure output asks the user to inspect the\n current file rather than claiming every failed transaction left the original untouched. Keep a\n local Marketplace outside the VS Code user configuration tree; overlapping or symlink-resolved\n paths fail before any settings write.\n- Cursor: never write private state or call an undocumented command. Tell a Team/Enterprise\n administrator to use Dashboard → Plugins → Add Marketplace → Import from Repo.\n\nMissing native CLIs and old versions remain explicit incomplete results; do not install them\nautomatically. Exit `0` means every selected target completed, `2` means a mixed result, `1` means\nnone completed or preflight failed, and `130` means interruption. Do not claim registration happened\nmerely because `build`, `index`, `validate`, or `release-local` passed; use the per-target\n`install-repo` summary as the evidence.\n\nMarketplace registration is not plugin installation. Run a client's plugin-install command only\nunder a separate explicit request.\n\n## Contracts\n\n- Do not edit generated root `plugin.json`/`mcp.json`, `.claude-plugin`, `.codex-plugin`, `.mcp.json`, `.lsp.json`, `hooks/hooks.json`, `.github/plugin/marketplace.json`, `.cursor-plugin/marketplace.json`, root `marketplace.json`, or other generated indexes by hand.\n- Keep canonical plugin names to 2–64 lowercase letters, digits, or single hyphens; start and end with an alphanumeric character and never use consecutive `--`.\n- Keep component paths relative to the plugin directory.\n- Keep every portable Skill at `skills/<name>/SKILL.md`; its frontmatter `name` must match the immediate parent directory and its `description` must be present.\n- Use legacy/explicit `stdio` MCP only with command fields, and `streamable-http`/`sse` only with URL/header fields. Do not silently convert an invalid transport.\n- Treat MCP `env` and `headers` as visible package data; never put credentials or other secrets in generated plugin configuration.\n- For multi-skill plugins, add child skills under the plugin instead of creating unrelated top-level plugin IDs.\n- When adding MCP, hook, or LSP components, keep the component name stable because generated manifests use it as an identifier.\n- `import-skill` never rewrites the copied `SKILL.md`. Fix a mismatched frontmatter name or description at the source, or edit the plugin after import.\n- `install-repo` treats its source as read-only. It does not build, validate, repair, commit, push, publish, or install Marketplace contents.\n";
9
+ //# sourceMappingURL=skill-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-content.js","sourceRoot":"","sources":["../../src/generated/skill-content.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM;AACN,4CAA4C;AAC5C,sDAAsD;AACtD,yDAAyD;AAEzD,MAAM,CAAC,MAAM,mBAAmB,GAAW,m3BAAm3B,CAAC;AAC/5B,MAAM,CAAC,MAAM,mBAAmB,GAAW,ggHAAggH,CAAC;AAC5iH,MAAM,CAAC,MAAM,sBAAsB,GAAW,w2LAAw2L,CAAC"}
@@ -0,0 +1,20 @@
1
+ export type AuthorizedPathErrorCode = 'EMPTY_PATH' | 'PATH_NOT_FOUND' | 'PATH_UNAVAILABLE' | 'NOT_A_DIRECTORY' | 'ABSOLUTE_PATH' | 'OUTSIDE_AUTHORIZED_ROOT' | 'UNSAFE_SYMLINK';
2
+ export declare class AuthorizedPathError extends Error {
3
+ readonly code: AuthorizedPathErrorCode;
4
+ readonly path: string;
5
+ constructor(code: AuthorizedPathErrorCode, message: string, path: string);
6
+ }
7
+ export interface AuthorizedRoot {
8
+ readonly canonicalPath: string;
9
+ }
10
+ /**
11
+ * Turns an explicitly selected, existing directory into a canonical authorization root.
12
+ * A symlink selected as the root is rejected; aliases in ancestor paths are canonicalized.
13
+ */
14
+ export declare function authorizeExistingDirectory(inputPath: string): AuthorizedRoot;
15
+ /**
16
+ * Resolves a declaration-owned relative path without allowing absolute paths,
17
+ * traversal outside the authorization root, or symlink traversal.
18
+ * Missing leaf paths are returned so callers can report their domain-specific error.
19
+ */
20
+ export declare function resolveAuthorizedPath(root: AuthorizedRoot | string, configuredPath: string): string;
@@ -0,0 +1,85 @@
1
+ import { existsSync, lstatSync, realpathSync } from 'node:fs';
2
+ import { isAbsolute, relative, resolve, sep } from 'node:path';
3
+ export class AuthorizedPathError extends Error {
4
+ code;
5
+ path;
6
+ constructor(code, message, path) {
7
+ super(message);
8
+ this.name = 'AuthorizedPathError';
9
+ this.code = code;
10
+ this.path = path;
11
+ }
12
+ }
13
+ function isInside(root, candidate) {
14
+ const rel = relative(root, candidate);
15
+ return rel === '' || (!rel.startsWith(`..${sep}`) && rel !== '..' && !isAbsolute(rel));
16
+ }
17
+ /**
18
+ * Turns an explicitly selected, existing directory into a canonical authorization root.
19
+ * A symlink selected as the root is rejected; aliases in ancestor paths are canonicalized.
20
+ */
21
+ export function authorizeExistingDirectory(inputPath) {
22
+ if (inputPath.trim().length === 0) {
23
+ throw new AuthorizedPathError('EMPTY_PATH', '授权目录不能为空', inputPath);
24
+ }
25
+ const absolutePath = resolve(inputPath);
26
+ try {
27
+ if (!existsSync(absolutePath)) {
28
+ throw new AuthorizedPathError('PATH_NOT_FOUND', '授权目录不存在', inputPath);
29
+ }
30
+ const selectedStat = lstatSync(absolutePath);
31
+ if (selectedStat.isSymbolicLink()) {
32
+ throw new AuthorizedPathError('UNSAFE_SYMLINK', '授权目录不能是符号链接', inputPath);
33
+ }
34
+ if (!selectedStat.isDirectory()) {
35
+ throw new AuthorizedPathError('NOT_A_DIRECTORY', '授权路径不是目录', inputPath);
36
+ }
37
+ return Object.freeze({ canonicalPath: realpathSync.native(absolutePath) });
38
+ }
39
+ catch (error) {
40
+ if (error instanceof AuthorizedPathError)
41
+ throw error;
42
+ throw new AuthorizedPathError('PATH_UNAVAILABLE', '授权目录当前不可访问', inputPath);
43
+ }
44
+ }
45
+ /**
46
+ * Resolves a declaration-owned relative path without allowing absolute paths,
47
+ * traversal outside the authorization root, or symlink traversal.
48
+ * Missing leaf paths are returned so callers can report their domain-specific error.
49
+ */
50
+ export function resolveAuthorizedPath(root, configuredPath) {
51
+ if (isAbsolute(configuredPath)) {
52
+ throw new AuthorizedPathError('ABSOLUTE_PATH', '授权范围内的路径必须是相对路径', configuredPath);
53
+ }
54
+ const authorization = typeof root === 'string' ? authorizeExistingDirectory(root) : root;
55
+ const candidate = resolve(authorization.canonicalPath, configuredPath);
56
+ if (!isInside(authorization.canonicalPath, candidate)) {
57
+ throw new AuthorizedPathError('OUTSIDE_AUTHORIZED_ROOT', '路径越过授权目录', configuredPath);
58
+ }
59
+ try {
60
+ const rel = relative(authorization.canonicalPath, candidate);
61
+ let cursor = authorization.canonicalPath;
62
+ for (const segment of rel === '' ? [] : rel.split(sep)) {
63
+ cursor = resolve(cursor, segment);
64
+ if (!existsSync(cursor)) {
65
+ break;
66
+ }
67
+ if (lstatSync(cursor).isSymbolicLink()) {
68
+ throw new AuthorizedPathError('UNSAFE_SYMLINK', '路径不能穿过符号链接', configuredPath);
69
+ }
70
+ }
71
+ if (existsSync(candidate)) {
72
+ const canonicalCandidate = realpathSync.native(candidate);
73
+ if (!isInside(authorization.canonicalPath, canonicalCandidate)) {
74
+ throw new AuthorizedPathError('OUTSIDE_AUTHORIZED_ROOT', '路径解析后越过授权目录', configuredPath);
75
+ }
76
+ }
77
+ }
78
+ catch (error) {
79
+ if (error instanceof AuthorizedPathError)
80
+ throw error;
81
+ throw new AuthorizedPathError('PATH_UNAVAILABLE', '授权范围内的路径当前不可访问', configuredPath);
82
+ }
83
+ return candidate;
84
+ }
85
+ //# sourceMappingURL=author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