pybao-cli 1.3.3
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 +201 -0
- package/README.md +440 -0
- package/README.zh-CN.md +338 -0
- package/cli-acp.js +82 -0
- package/cli.js +105 -0
- package/dist/REPL-WPV32MTF.js +42 -0
- package/dist/REPL-WPV32MTF.js.map +7 -0
- package/dist/acp-75HO2LBV.js +1357 -0
- package/dist/acp-75HO2LBV.js.map +7 -0
- package/dist/agentsValidate-6Z57ARKC.js +373 -0
- package/dist/agentsValidate-6Z57ARKC.js.map +7 -0
- package/dist/ask-NXXXCGY4.js +125 -0
- package/dist/ask-NXXXCGY4.js.map +7 -0
- package/dist/autoUpdater-PJMGNPUG.js +17 -0
- package/dist/autoUpdater-PJMGNPUG.js.map +7 -0
- package/dist/chunk-27GYWUY2.js +72 -0
- package/dist/chunk-27GYWUY2.js.map +7 -0
- package/dist/chunk-3DFBSQIT.js +23 -0
- package/dist/chunk-3DFBSQIT.js.map +7 -0
- package/dist/chunk-3KNGJX7Q.js +794 -0
- package/dist/chunk-3KNGJX7Q.js.map +7 -0
- package/dist/chunk-3PDD7M4T.js +164 -0
- package/dist/chunk-3PDD7M4T.js.map +7 -0
- package/dist/chunk-3ZNSAB7B.js +515 -0
- package/dist/chunk-3ZNSAB7B.js.map +7 -0
- package/dist/chunk-4SNFQYCY.js +511 -0
- package/dist/chunk-4SNFQYCY.js.map +7 -0
- package/dist/chunk-4XPNRLJG.js +1609 -0
- package/dist/chunk-4XPNRLJG.js.map +7 -0
- package/dist/chunk-5P7HBXTD.js +12 -0
- package/dist/chunk-5P7HBXTD.js.map +7 -0
- package/dist/chunk-6RZIUY5K.js +191 -0
- package/dist/chunk-6RZIUY5K.js.map +7 -0
- package/dist/chunk-6WELHKDA.js +240 -0
- package/dist/chunk-6WELHKDA.js.map +7 -0
- package/dist/chunk-7AAE6EO2.js +145 -0
- package/dist/chunk-7AAE6EO2.js.map +7 -0
- package/dist/chunk-A3BVXXA3.js +47 -0
- package/dist/chunk-A3BVXXA3.js.map +7 -0
- package/dist/chunk-A6PUMROK.js +152 -0
- package/dist/chunk-A6PUMROK.js.map +7 -0
- package/dist/chunk-BH3Y62E3.js +11 -0
- package/dist/chunk-BH3Y62E3.js.map +7 -0
- package/dist/chunk-BJSWTHRM.js +16 -0
- package/dist/chunk-BJSWTHRM.js.map +7 -0
- package/dist/chunk-BQA2EOUU.js +124 -0
- package/dist/chunk-BQA2EOUU.js.map +7 -0
- package/dist/chunk-CZZKRPE2.js +19 -0
- package/dist/chunk-CZZKRPE2.js.map +7 -0
- package/dist/chunk-ERMQRV55.js +24 -0
- package/dist/chunk-ERMQRV55.js.map +7 -0
- package/dist/chunk-HB2P6645.js +34 -0
- package/dist/chunk-HB2P6645.js.map +7 -0
- package/dist/chunk-HIRIJ2LQ.js +1256 -0
- package/dist/chunk-HIRIJ2LQ.js.map +7 -0
- package/dist/chunk-ICTEVBLN.js +735 -0
- package/dist/chunk-ICTEVBLN.js.map +7 -0
- package/dist/chunk-JKGOGSFT.js +128 -0
- package/dist/chunk-JKGOGSFT.js.map +7 -0
- package/dist/chunk-JZDE77EH.js +836 -0
- package/dist/chunk-JZDE77EH.js.map +7 -0
- package/dist/chunk-M624LT6O.js +17 -0
- package/dist/chunk-M624LT6O.js.map +7 -0
- package/dist/chunk-OMELVAJD.js +96 -0
- package/dist/chunk-OMELVAJD.js.map +7 -0
- package/dist/chunk-OUXHGDLH.js +95 -0
- package/dist/chunk-OUXHGDLH.js.map +7 -0
- package/dist/chunk-PCXUZ6AT.js +249 -0
- package/dist/chunk-PCXUZ6AT.js.map +7 -0
- package/dist/chunk-Q24ZGKIE.js +1097 -0
- package/dist/chunk-Q24ZGKIE.js.map +7 -0
- package/dist/chunk-QBHEERCF.js +30254 -0
- package/dist/chunk-QBHEERCF.js.map +7 -0
- package/dist/chunk-QIHB5PYM.js +472 -0
- package/dist/chunk-QIHB5PYM.js.map +7 -0
- package/dist/chunk-RQVLBMP7.js +24 -0
- package/dist/chunk-RQVLBMP7.js.map +7 -0
- package/dist/chunk-SWYJOV5E.js +490 -0
- package/dist/chunk-SWYJOV5E.js.map +7 -0
- package/dist/chunk-T6GVXTNQ.js +21 -0
- package/dist/chunk-T6GVXTNQ.js.map +7 -0
- package/dist/chunk-T7GPUZVK.js +766 -0
- package/dist/chunk-T7GPUZVK.js.map +7 -0
- package/dist/chunk-TXFCNQDE.js +2934 -0
- package/dist/chunk-TXFCNQDE.js.map +7 -0
- package/dist/chunk-UNNVICVU.js +95 -0
- package/dist/chunk-UNNVICVU.js.map +7 -0
- package/dist/chunk-UUNVJZWA.js +515 -0
- package/dist/chunk-UUNVJZWA.js.map +7 -0
- package/dist/chunk-VRGR4ZTQ.js +49 -0
- package/dist/chunk-VRGR4ZTQ.js.map +7 -0
- package/dist/chunk-VTVTEE5N.js +2613 -0
- package/dist/chunk-VTVTEE5N.js.map +7 -0
- package/dist/chunk-WPTPPOYN.js +936 -0
- package/dist/chunk-WPTPPOYN.js.map +7 -0
- package/dist/chunk-XXFY63TM.js +196 -0
- package/dist/chunk-XXFY63TM.js.map +7 -0
- package/dist/chunk-Z3HMXDXP.js +654 -0
- package/dist/chunk-Z3HMXDXP.js.map +7 -0
- package/dist/chunk-ZJGXEWKF.js +138 -0
- package/dist/chunk-ZJGXEWKF.js.map +7 -0
- package/dist/cli-RFYBXM7F.js +3917 -0
- package/dist/cli-RFYBXM7F.js.map +7 -0
- package/dist/commands-YOXMODDO.js +46 -0
- package/dist/commands-YOXMODDO.js.map +7 -0
- package/dist/config-5OPX3H2K.js +81 -0
- package/dist/config-5OPX3H2K.js.map +7 -0
- package/dist/context-THRRBPFP.js +30 -0
- package/dist/context-THRRBPFP.js.map +7 -0
- package/dist/costTracker-ELNBZ2DN.js +19 -0
- package/dist/costTracker-ELNBZ2DN.js.map +7 -0
- package/dist/customCommands-4XOZH44N.js +25 -0
- package/dist/customCommands-4XOZH44N.js.map +7 -0
- package/dist/env-EL4KBHMB.js +22 -0
- package/dist/env-EL4KBHMB.js.map +7 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +7 -0
- package/dist/kodeAgentSessionId-PROTVRBR.js +13 -0
- package/dist/kodeAgentSessionId-PROTVRBR.js.map +7 -0
- package/dist/kodeAgentSessionLoad-UMPV7MC3.js +18 -0
- package/dist/kodeAgentSessionLoad-UMPV7MC3.js.map +7 -0
- package/dist/kodeAgentSessionResume-YJS4FVQM.js +16 -0
- package/dist/kodeAgentSessionResume-YJS4FVQM.js.map +7 -0
- package/dist/kodeAgentStreamJson-3T26CHCP.js +13 -0
- package/dist/kodeAgentStreamJson-3T26CHCP.js.map +7 -0
- package/dist/kodeAgentStreamJsonSession-BZS2VDCY.js +131 -0
- package/dist/kodeAgentStreamJsonSession-BZS2VDCY.js.map +7 -0
- package/dist/kodeAgentStructuredStdio-TNB6U6SP.js +10 -0
- package/dist/kodeAgentStructuredStdio-TNB6U6SP.js.map +7 -0
- package/dist/kodeHooks-VUAWIY2D.js +36 -0
- package/dist/kodeHooks-VUAWIY2D.js.map +7 -0
- package/dist/llm-A3BCM4Q2.js +3118 -0
- package/dist/llm-A3BCM4Q2.js.map +7 -0
- package/dist/llmLazy-ZJSRLZVD.js +15 -0
- package/dist/llmLazy-ZJSRLZVD.js.map +7 -0
- package/dist/loader-HZQBWO74.js +28 -0
- package/dist/loader-HZQBWO74.js.map +7 -0
- package/dist/mcp-XKOJ55B2.js +49 -0
- package/dist/mcp-XKOJ55B2.js.map +7 -0
- package/dist/mentionProcessor-ANYU5MLF.js +211 -0
- package/dist/mentionProcessor-ANYU5MLF.js.map +7 -0
- package/dist/messages-75DL5XBP.js +63 -0
- package/dist/messages-75DL5XBP.js.map +7 -0
- package/dist/model-OPJGJZRC.js +30 -0
- package/dist/model-OPJGJZRC.js.map +7 -0
- package/dist/openai-DT54BAFP.js +29 -0
- package/dist/openai-DT54BAFP.js.map +7 -0
- package/dist/outputStyles-TPFVI52O.js +28 -0
- package/dist/outputStyles-TPFVI52O.js.map +7 -0
- package/dist/package.json +4 -0
- package/dist/pluginRuntime-W74PYSZ4.js +218 -0
- package/dist/pluginRuntime-W74PYSZ4.js.map +7 -0
- package/dist/pluginValidation-FALYRVI2.js +17 -0
- package/dist/pluginValidation-FALYRVI2.js.map +7 -0
- package/dist/prompts-J4TPRMJ3.js +48 -0
- package/dist/prompts-J4TPRMJ3.js.map +7 -0
- package/dist/query-K3QKBVDN.js +50 -0
- package/dist/query-K3QKBVDN.js.map +7 -0
- package/dist/responsesStreaming-HMB74TRD.js +10 -0
- package/dist/responsesStreaming-HMB74TRD.js.map +7 -0
- package/dist/ripgrep-XJGSUBG7.js +17 -0
- package/dist/ripgrep-XJGSUBG7.js.map +7 -0
- package/dist/skillMarketplace-AUGKNCPW.js +37 -0
- package/dist/skillMarketplace-AUGKNCPW.js.map +7 -0
- package/dist/state-DQYRXKTG.js +16 -0
- package/dist/state-DQYRXKTG.js.map +7 -0
- package/dist/theme-MS5HDUBJ.js +14 -0
- package/dist/theme-MS5HDUBJ.js.map +7 -0
- package/dist/toolPermissionContext-GYD5LYFK.js +17 -0
- package/dist/toolPermissionContext-GYD5LYFK.js.map +7 -0
- package/dist/toolPermissionSettings-4MPZVYDR.js +18 -0
- package/dist/toolPermissionSettings-4MPZVYDR.js.map +7 -0
- package/dist/tools-QW6SIJLJ.js +47 -0
- package/dist/tools-QW6SIJLJ.js.map +7 -0
- package/dist/userInput-F2PGBRFU.js +311 -0
- package/dist/userInput-F2PGBRFU.js.map +7 -0
- package/dist/uuid-GYYCQ6QK.js +9 -0
- package/dist/uuid-GYYCQ6QK.js.map +7 -0
- package/dist/yoga.wasm +0 -0
- package/package.json +136 -0
- package/scripts/binary-utils.cjs +62 -0
- package/scripts/cli-acp-wrapper.cjs +82 -0
- package/scripts/cli-wrapper.cjs +105 -0
- package/scripts/postinstall.js +144 -0
- package/yoga.wasm +0 -0
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
import { createRequire as __pybCreateRequire } from "node:module";
|
|
2
|
+
const require = __pybCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
MarketplaceManifestSchema
|
|
5
|
+
} from "./chunk-Q24ZGKIE.js";
|
|
6
|
+
import {
|
|
7
|
+
parseFrontmatter
|
|
8
|
+
} from "./chunk-T7GPUZVK.js";
|
|
9
|
+
import {
|
|
10
|
+
getCwd
|
|
11
|
+
} from "./chunk-TXFCNQDE.js";
|
|
12
|
+
|
|
13
|
+
// src/services/plugins/pluginValidation.ts
|
|
14
|
+
import { existsSync, lstatSync, readFileSync } from "node:fs";
|
|
15
|
+
import { dirname, join, resolve, sep } from "node:path";
|
|
16
|
+
import figures from "figures";
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
var PluginManifestSchema = z.strictObject({
|
|
19
|
+
name: z.string().min(1),
|
|
20
|
+
version: z.string().optional(),
|
|
21
|
+
description: z.string().optional(),
|
|
22
|
+
author: z.unknown().optional(),
|
|
23
|
+
homepage: z.string().optional(),
|
|
24
|
+
repository: z.unknown().optional(),
|
|
25
|
+
license: z.string().optional(),
|
|
26
|
+
keywords: z.array(z.string()).optional(),
|
|
27
|
+
commands: z.union([z.string(), z.array(z.string())]).optional(),
|
|
28
|
+
agents: z.union([z.string(), z.array(z.string())]).optional(),
|
|
29
|
+
skills: z.union([z.string(), z.array(z.string())]).optional(),
|
|
30
|
+
hooks: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),
|
|
31
|
+
mcpServers: z.union([z.string(), z.record(z.string(), z.unknown())]).optional()
|
|
32
|
+
}).passthrough();
|
|
33
|
+
function resolveFromAgentCwd(input) {
|
|
34
|
+
const trimmed = input.trim();
|
|
35
|
+
if (!trimmed) return trimmed;
|
|
36
|
+
if (trimmed.startsWith("~")) {
|
|
37
|
+
return trimmed;
|
|
38
|
+
}
|
|
39
|
+
if (trimmed.startsWith(sep)) return trimmed;
|
|
40
|
+
return resolve(getCwd(), trimmed);
|
|
41
|
+
}
|
|
42
|
+
function validateRelativePath(path) {
|
|
43
|
+
if (!path.startsWith("./")) return 'must start with "./"';
|
|
44
|
+
if (path.split("/").includes("..")) return 'must not contain ".."';
|
|
45
|
+
if (path.includes("\\")) return "must use forward slashes";
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
function safeResolveWithin(baseDir, rel) {
|
|
49
|
+
const normalized = rel.replace(/\\/g, "/");
|
|
50
|
+
if (!normalized.startsWith("./") || normalized.split("/").includes(".."))
|
|
51
|
+
return null;
|
|
52
|
+
const abs = resolve(baseDir, normalized.split("/").join(sep));
|
|
53
|
+
const base = resolve(baseDir);
|
|
54
|
+
if (!abs.startsWith(base + sep) && abs !== base) return null;
|
|
55
|
+
return abs;
|
|
56
|
+
}
|
|
57
|
+
function validateSkillDir(skillDir) {
|
|
58
|
+
const issues = [];
|
|
59
|
+
const name = skillDir.split(sep).pop() || "";
|
|
60
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name) || name.length > 64) {
|
|
61
|
+
issues.push({
|
|
62
|
+
path: `skills/${name}`,
|
|
63
|
+
message: "Invalid skill directory name (must be lowercase kebab-case, 1\u201364 chars)"
|
|
64
|
+
});
|
|
65
|
+
return issues;
|
|
66
|
+
}
|
|
67
|
+
const skillFileCandidates = [
|
|
68
|
+
join(skillDir, "SKILL.md"),
|
|
69
|
+
join(skillDir, "skill.md")
|
|
70
|
+
];
|
|
71
|
+
const skillFile = skillFileCandidates.find((p) => existsSync(p));
|
|
72
|
+
if (!skillFile) {
|
|
73
|
+
issues.push({
|
|
74
|
+
path: `skills/${name}`,
|
|
75
|
+
message: "Missing SKILL.md (or skill.md)"
|
|
76
|
+
});
|
|
77
|
+
return issues;
|
|
78
|
+
}
|
|
79
|
+
try {
|
|
80
|
+
const raw = readFileSync(skillFile, "utf8");
|
|
81
|
+
const { frontmatter } = parseFrontmatter(raw);
|
|
82
|
+
const declared = typeof frontmatter.name === "string" ? String(frontmatter.name).trim() : "";
|
|
83
|
+
if (!declared) {
|
|
84
|
+
issues.push({
|
|
85
|
+
path: `${name}/SKILL.md`,
|
|
86
|
+
message: "Missing required frontmatter field: name"
|
|
87
|
+
});
|
|
88
|
+
} else if (declared !== name) {
|
|
89
|
+
issues.push({
|
|
90
|
+
path: `${name}/SKILL.md`,
|
|
91
|
+
message: `Frontmatter name must match directory name (dir=${name}, name=${declared})`
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const description = typeof frontmatter.description === "string" ? String(frontmatter.description).trim() : "";
|
|
95
|
+
if (!description) {
|
|
96
|
+
issues.push({
|
|
97
|
+
path: `${name}/SKILL.md`,
|
|
98
|
+
message: "Missing required frontmatter field: description"
|
|
99
|
+
});
|
|
100
|
+
} else if (description.length > 1024) {
|
|
101
|
+
issues.push({
|
|
102
|
+
path: `${name}/SKILL.md`,
|
|
103
|
+
message: "description must be <= 1024 characters"
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
} catch (err) {
|
|
107
|
+
issues.push({
|
|
108
|
+
path: `${name}/SKILL.md`,
|
|
109
|
+
message: `Failed to parse SKILL.md: ${err instanceof Error ? err.message : String(err)}`
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
return issues;
|
|
113
|
+
}
|
|
114
|
+
function validateMarketplaceJson(filePath) {
|
|
115
|
+
const errors = [];
|
|
116
|
+
const warnings = [];
|
|
117
|
+
let raw;
|
|
118
|
+
try {
|
|
119
|
+
raw = readFileSync(filePath, "utf8");
|
|
120
|
+
} catch (err) {
|
|
121
|
+
return {
|
|
122
|
+
success: false,
|
|
123
|
+
fileType: "marketplace",
|
|
124
|
+
filePath,
|
|
125
|
+
errors: [
|
|
126
|
+
{ path: "file", message: `Failed to read file: ${String(err)}` }
|
|
127
|
+
],
|
|
128
|
+
warnings: []
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
let json;
|
|
132
|
+
try {
|
|
133
|
+
json = JSON.parse(raw);
|
|
134
|
+
} catch (err) {
|
|
135
|
+
return {
|
|
136
|
+
success: false,
|
|
137
|
+
fileType: "marketplace",
|
|
138
|
+
filePath,
|
|
139
|
+
errors: [
|
|
140
|
+
{ path: "json", message: `Invalid JSON syntax: ${String(err)}` }
|
|
141
|
+
],
|
|
142
|
+
warnings: []
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
const parsed = MarketplaceManifestSchema.safeParse(json);
|
|
146
|
+
if (!parsed.success) {
|
|
147
|
+
errors.push(
|
|
148
|
+
...parsed.error.issues.map((i) => ({
|
|
149
|
+
path: i.path.join("."),
|
|
150
|
+
message: i.message
|
|
151
|
+
}))
|
|
152
|
+
);
|
|
153
|
+
return {
|
|
154
|
+
success: false,
|
|
155
|
+
fileType: "marketplace",
|
|
156
|
+
filePath,
|
|
157
|
+
errors,
|
|
158
|
+
warnings
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
const data = parsed.data;
|
|
162
|
+
const topLevelDescription = typeof data.description === "string" ? String(data.description).trim() : "";
|
|
163
|
+
const metadataDescription = typeof data.metadata?.description === "string" ? String(data.metadata.description).trim() : "";
|
|
164
|
+
if (!topLevelDescription && !metadataDescription) {
|
|
165
|
+
warnings.push({
|
|
166
|
+
path: "description",
|
|
167
|
+
message: "No marketplace description provided. Adding a description helps users understand what this marketplace offers"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (!data.plugins || data.plugins.length === 0) {
|
|
171
|
+
warnings.push({
|
|
172
|
+
path: "plugins",
|
|
173
|
+
message: "Marketplace has no plugins defined"
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
const pluginNames = /* @__PURE__ */ new Set();
|
|
177
|
+
for (const [index, plugin] of data.plugins.entries()) {
|
|
178
|
+
if (pluginNames.has(plugin.name)) {
|
|
179
|
+
errors.push({
|
|
180
|
+
path: `plugins[${index}].name`,
|
|
181
|
+
message: `Duplicate plugin name "${plugin.name}"`
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
pluginNames.add(plugin.name);
|
|
185
|
+
const source = plugin.source ?? "./";
|
|
186
|
+
const sourceErr = validateRelativePath(source);
|
|
187
|
+
if (sourceErr)
|
|
188
|
+
errors.push({ path: `plugins[${index}].source`, message: sourceErr });
|
|
189
|
+
const marketplaceRoot = dirname(dirname(filePath));
|
|
190
|
+
const pluginBase = safeResolveWithin(marketplaceRoot, source);
|
|
191
|
+
if (!pluginBase) {
|
|
192
|
+
errors.push({
|
|
193
|
+
path: `plugins[${index}].source`,
|
|
194
|
+
message: "Invalid source path (must be ./..., no .., forward slashes)"
|
|
195
|
+
});
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
if (!existsSync(pluginBase) || !lstatSync(pluginBase).isDirectory()) {
|
|
199
|
+
errors.push({
|
|
200
|
+
path: `plugins[${index}].source`,
|
|
201
|
+
message: `Source path not found: ${source}`
|
|
202
|
+
});
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
const skillPaths = plugin.skills ?? [];
|
|
206
|
+
for (const [j, rel] of skillPaths.entries()) {
|
|
207
|
+
const err = validateRelativePath(rel);
|
|
208
|
+
if (err) {
|
|
209
|
+
errors.push({ path: `plugins[${index}].skills[${j}]`, message: err });
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
const abs = safeResolveWithin(pluginBase, rel);
|
|
213
|
+
if (!abs) {
|
|
214
|
+
errors.push({
|
|
215
|
+
path: `plugins[${index}].skills[${j}]`,
|
|
216
|
+
message: "Invalid path (must be ./..., no .., forward slashes)"
|
|
217
|
+
});
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (!existsSync(abs) || !lstatSync(abs).isDirectory()) {
|
|
221
|
+
errors.push({
|
|
222
|
+
path: `plugins[${index}].skills[${j}]`,
|
|
223
|
+
message: `Skill directory not found: ${rel}`
|
|
224
|
+
});
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
errors.push(
|
|
228
|
+
...validateSkillDir(abs).map((e) => ({
|
|
229
|
+
...e,
|
|
230
|
+
path: `plugins[${index}].skills[${j}]: ${e.path}`
|
|
231
|
+
}))
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
const commandPaths = plugin.commands ?? [];
|
|
235
|
+
for (const [j, rel] of commandPaths.entries()) {
|
|
236
|
+
const err = validateRelativePath(rel);
|
|
237
|
+
if (err) {
|
|
238
|
+
errors.push({ path: `plugins[${index}].commands[${j}]`, message: err });
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
const abs = safeResolveWithin(pluginBase, rel);
|
|
242
|
+
if (!abs) {
|
|
243
|
+
errors.push({
|
|
244
|
+
path: `plugins[${index}].commands[${j}]`,
|
|
245
|
+
message: "Invalid path (must be ./..., no .., forward slashes)"
|
|
246
|
+
});
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
if (!existsSync(abs) || !lstatSync(abs).isDirectory()) {
|
|
250
|
+
errors.push({
|
|
251
|
+
path: `plugins[${index}].commands[${j}]`,
|
|
252
|
+
message: `Command directory not found: ${rel}`
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return {
|
|
258
|
+
success: errors.length === 0,
|
|
259
|
+
fileType: "marketplace",
|
|
260
|
+
filePath,
|
|
261
|
+
errors,
|
|
262
|
+
warnings
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function validatePluginJson(filePath) {
|
|
266
|
+
const errors = [];
|
|
267
|
+
const warnings = [];
|
|
268
|
+
let raw;
|
|
269
|
+
try {
|
|
270
|
+
raw = readFileSync(filePath, "utf8");
|
|
271
|
+
} catch (err) {
|
|
272
|
+
return {
|
|
273
|
+
success: false,
|
|
274
|
+
fileType: "plugin",
|
|
275
|
+
filePath,
|
|
276
|
+
errors: [
|
|
277
|
+
{ path: "file", message: `Failed to read file: ${String(err)}` }
|
|
278
|
+
],
|
|
279
|
+
warnings: []
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
let json;
|
|
283
|
+
try {
|
|
284
|
+
json = JSON.parse(raw);
|
|
285
|
+
} catch (err) {
|
|
286
|
+
return {
|
|
287
|
+
success: false,
|
|
288
|
+
fileType: "plugin",
|
|
289
|
+
filePath,
|
|
290
|
+
errors: [
|
|
291
|
+
{ path: "json", message: `Invalid JSON syntax: ${String(err)}` }
|
|
292
|
+
],
|
|
293
|
+
warnings: []
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
const parsed = PluginManifestSchema.safeParse(json);
|
|
297
|
+
if (!parsed.success) {
|
|
298
|
+
errors.push(
|
|
299
|
+
...parsed.error.issues.map((i) => ({
|
|
300
|
+
path: i.path.join("."),
|
|
301
|
+
message: i.message
|
|
302
|
+
}))
|
|
303
|
+
);
|
|
304
|
+
return { success: false, fileType: "plugin", filePath, errors, warnings };
|
|
305
|
+
}
|
|
306
|
+
const data = parsed.data;
|
|
307
|
+
if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(data.name)) {
|
|
308
|
+
errors.push({
|
|
309
|
+
path: "name",
|
|
310
|
+
message: "Must be kebab-case and start with a letter"
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
if (data.version && !/^(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.test(
|
|
314
|
+
data.version
|
|
315
|
+
)) {
|
|
316
|
+
errors.push({
|
|
317
|
+
path: "version",
|
|
318
|
+
message: "Invalid semantic version (expected MAJOR.MINOR.PATCH)"
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
if (data.homepage) {
|
|
322
|
+
try {
|
|
323
|
+
new URL(data.homepage);
|
|
324
|
+
} catch {
|
|
325
|
+
errors.push({ path: "homepage", message: "Invalid URL" });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (typeof data.repository === "string") {
|
|
329
|
+
try {
|
|
330
|
+
new URL(data.repository);
|
|
331
|
+
} catch {
|
|
332
|
+
errors.push({ path: "repository", message: "Invalid URL" });
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (!data.version) {
|
|
336
|
+
warnings.push({
|
|
337
|
+
path: "version",
|
|
338
|
+
message: 'No version specified. Consider adding a version following semver (e.g., "1.0.0")'
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
if (!data.description) {
|
|
342
|
+
warnings.push({
|
|
343
|
+
path: "description",
|
|
344
|
+
message: "No description provided. Adding a description helps users understand what your plugin does"
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
if (!data.author) {
|
|
348
|
+
warnings.push({
|
|
349
|
+
path: "author",
|
|
350
|
+
message: "No author information provided. Consider adding author details for plugin attribution"
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
const pluginRoot = dirname(dirname(filePath));
|
|
354
|
+
const validatePathList = (field, value) => {
|
|
355
|
+
if (!value) return;
|
|
356
|
+
const values = Array.isArray(value) ? value : [value];
|
|
357
|
+
for (const [idx, p] of values.entries()) {
|
|
358
|
+
if (typeof p !== "string") continue;
|
|
359
|
+
const err = validateRelativePath(p);
|
|
360
|
+
if (err) errors.push({ path: `${field}[${idx}]`, message: err });
|
|
361
|
+
const abs = safeResolveWithin(pluginRoot, p);
|
|
362
|
+
if (!abs) {
|
|
363
|
+
errors.push({
|
|
364
|
+
path: `${field}[${idx}]`,
|
|
365
|
+
message: "Invalid path (must be ./..., no .., forward slashes)"
|
|
366
|
+
});
|
|
367
|
+
} else if (!existsSync(abs)) {
|
|
368
|
+
errors.push({
|
|
369
|
+
path: `${field}[${idx}]`,
|
|
370
|
+
message: `Path not found: ${p}`
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
validatePathList("commands", data.commands);
|
|
376
|
+
validatePathList("agents", data.agents);
|
|
377
|
+
validatePathList("skills", data.skills);
|
|
378
|
+
if (typeof data.hooks === "string") validatePathList("hooks", data.hooks);
|
|
379
|
+
if (typeof data.mcpServers === "string")
|
|
380
|
+
validatePathList("mcpServers", data.mcpServers);
|
|
381
|
+
return {
|
|
382
|
+
success: errors.length === 0,
|
|
383
|
+
fileType: "plugin",
|
|
384
|
+
filePath,
|
|
385
|
+
errors,
|
|
386
|
+
warnings
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function validatePluginOrMarketplacePath(path) {
|
|
390
|
+
const abs = resolveFromAgentCwd(path);
|
|
391
|
+
if (!abs) {
|
|
392
|
+
return {
|
|
393
|
+
success: false,
|
|
394
|
+
fileType: "plugin",
|
|
395
|
+
filePath: "",
|
|
396
|
+
errors: [{ path: "path", message: "Path is required" }],
|
|
397
|
+
warnings: []
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
if (!existsSync(abs)) {
|
|
401
|
+
return {
|
|
402
|
+
success: false,
|
|
403
|
+
fileType: "plugin",
|
|
404
|
+
filePath: abs,
|
|
405
|
+
errors: [{ path: "file", message: `Path not found: ${abs}` }],
|
|
406
|
+
warnings: []
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
const stat = lstatSync(abs);
|
|
410
|
+
let filePath = abs;
|
|
411
|
+
if (stat.isDirectory()) {
|
|
412
|
+
const marketplace = join(abs, ".kode-plugin", "marketplace.json");
|
|
413
|
+
const plugin = join(abs, ".kode-plugin", "plugin.json");
|
|
414
|
+
const legacyMarketplace = join(abs, ".claude-plugin", "marketplace.json");
|
|
415
|
+
const legacyPlugin = join(abs, ".claude-plugin", "plugin.json");
|
|
416
|
+
if (existsSync(marketplace)) filePath = marketplace;
|
|
417
|
+
else if (existsSync(plugin)) filePath = plugin;
|
|
418
|
+
else if (existsSync(legacyMarketplace)) filePath = legacyMarketplace;
|
|
419
|
+
else if (existsSync(legacyPlugin)) filePath = legacyPlugin;
|
|
420
|
+
else {
|
|
421
|
+
return {
|
|
422
|
+
success: false,
|
|
423
|
+
fileType: "plugin",
|
|
424
|
+
filePath: abs,
|
|
425
|
+
errors: [
|
|
426
|
+
{
|
|
427
|
+
path: "directory",
|
|
428
|
+
message: "No manifest found in directory. Expected .kode-plugin/marketplace.json or .kode-plugin/plugin.json (legacy .claude-plugin/* is also supported)"
|
|
429
|
+
}
|
|
430
|
+
],
|
|
431
|
+
warnings: []
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
if (filePath.endsWith("marketplace.json"))
|
|
436
|
+
return validateMarketplaceJson(filePath);
|
|
437
|
+
if (filePath.endsWith("plugin.json")) return validatePluginJson(filePath);
|
|
438
|
+
try {
|
|
439
|
+
const raw = readFileSync(filePath, "utf8");
|
|
440
|
+
const json = JSON.parse(raw);
|
|
441
|
+
if (json && typeof json === "object" && Array.isArray(json.plugins)) {
|
|
442
|
+
return validateMarketplaceJson(filePath);
|
|
443
|
+
}
|
|
444
|
+
} catch {
|
|
445
|
+
}
|
|
446
|
+
return validatePluginJson(filePath);
|
|
447
|
+
}
|
|
448
|
+
function formatValidationResult(result) {
|
|
449
|
+
const lines = [];
|
|
450
|
+
for (const err of result.errors) {
|
|
451
|
+
lines.push(` ${figures.pointer} ${err.path}: ${err.message}`);
|
|
452
|
+
}
|
|
453
|
+
for (const warn of result.warnings) {
|
|
454
|
+
lines.push(` ${figures.pointer} ${warn.path}: ${warn.message}`);
|
|
455
|
+
}
|
|
456
|
+
lines.push("");
|
|
457
|
+
if (result.success) {
|
|
458
|
+
if (result.warnings.length > 0) {
|
|
459
|
+
lines.push(`${figures.tick} Validation passed with warnings`);
|
|
460
|
+
} else {
|
|
461
|
+
lines.push(`${figures.tick} Validation passed`);
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
lines.push(`${figures.cross} Validation failed`);
|
|
465
|
+
}
|
|
466
|
+
return lines.join("\n");
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export {
|
|
470
|
+
validatePluginOrMarketplacePath,
|
|
471
|
+
formatValidationResult
|
|
472
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/services/plugins/pluginValidation.ts"],
|
|
4
|
+
"sourcesContent": ["import { existsSync, lstatSync, readFileSync } from 'node:fs'\nimport { dirname, join, resolve, sep } from 'node:path'\nimport figures from 'figures'\nimport { z } from 'zod'\nimport { getCwd } from '@utils/state'\nimport { parseFrontmatter } from '@services/customCommands'\nimport { MarketplaceManifestSchema } from '@services/skillMarketplace'\n\nexport type ValidationIssue = {\n path: string\n message: string\n}\n\nexport type ValidationResult = {\n success: boolean\n fileType: 'plugin' | 'marketplace'\n filePath: string\n errors: ValidationIssue[]\n warnings: ValidationIssue[]\n}\n\nconst PluginManifestSchema = z\n .strictObject({\n name: z.string().min(1),\n version: z.string().optional(),\n description: z.string().optional(),\n author: z.unknown().optional(),\n homepage: z.string().optional(),\n repository: z.unknown().optional(),\n license: z.string().optional(),\n keywords: z.array(z.string()).optional(),\n commands: z.union([z.string(), z.array(z.string())]).optional(),\n agents: z.union([z.string(), z.array(z.string())]).optional(),\n skills: z.union([z.string(), z.array(z.string())]).optional(),\n hooks: z.union([z.string(), z.record(z.string(), z.unknown())]).optional(),\n mcpServers: z\n .union([z.string(), z.record(z.string(), z.unknown())])\n .optional(),\n })\n .passthrough()\n\nfunction resolveFromAgentCwd(input: string): string {\n const trimmed = input.trim()\n if (!trimmed) return trimmed\n if (trimmed.startsWith('~')) {\n return trimmed\n }\n if (trimmed.startsWith(sep)) return trimmed\n return resolve(getCwd(), trimmed)\n}\n\nfunction validateRelativePath(path: string): string | null {\n if (!path.startsWith('./')) return 'must start with \"./\"'\n if (path.split('/').includes('..')) return 'must not contain \"..\"'\n if (path.includes('\\\\')) return 'must use forward slashes'\n return null\n}\n\nfunction safeResolveWithin(baseDir: string, rel: string): string | null {\n const normalized = rel.replace(/\\\\/g, '/')\n if (!normalized.startsWith('./') || normalized.split('/').includes('..'))\n return null\n const abs = resolve(baseDir, normalized.split('/').join(sep))\n const base = resolve(baseDir)\n if (!abs.startsWith(base + sep) && abs !== base) return null\n return abs\n}\n\nfunction validateSkillDir(skillDir: string): ValidationIssue[] {\n const issues: ValidationIssue[] = []\n const name = skillDir.split(sep).pop() || ''\n if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name) || name.length > 64) {\n issues.push({\n path: `skills/${name}`,\n message:\n 'Invalid skill directory name (must be lowercase kebab-case, 1\u201364 chars)',\n })\n return issues\n }\n\n const skillFileCandidates = [\n join(skillDir, 'SKILL.md'),\n join(skillDir, 'skill.md'),\n ]\n const skillFile = skillFileCandidates.find(p => existsSync(p))\n if (!skillFile) {\n issues.push({\n path: `skills/${name}`,\n message: 'Missing SKILL.md (or skill.md)',\n })\n return issues\n }\n\n try {\n const raw = readFileSync(skillFile, 'utf8')\n const { frontmatter } = parseFrontmatter(raw)\n const declared =\n typeof (frontmatter as any).name === 'string'\n ? String((frontmatter as any).name).trim()\n : ''\n if (!declared) {\n issues.push({\n path: `${name}/SKILL.md`,\n message: 'Missing required frontmatter field: name',\n })\n } else if (declared !== name) {\n issues.push({\n path: `${name}/SKILL.md`,\n message: `Frontmatter name must match directory name (dir=${name}, name=${declared})`,\n })\n }\n\n const description =\n typeof (frontmatter as any).description === 'string'\n ? String((frontmatter as any).description).trim()\n : ''\n if (!description) {\n issues.push({\n path: `${name}/SKILL.md`,\n message: 'Missing required frontmatter field: description',\n })\n } else if (description.length > 1024) {\n issues.push({\n path: `${name}/SKILL.md`,\n message: 'description must be <= 1024 characters',\n })\n }\n } catch (err) {\n issues.push({\n path: `${name}/SKILL.md`,\n message: `Failed to parse SKILL.md: ${err instanceof Error ? err.message : String(err)}`,\n })\n }\n\n return issues\n}\n\nfunction validateMarketplaceJson(filePath: string): ValidationResult {\n const errors: ValidationIssue[] = []\n const warnings: ValidationIssue[] = []\n\n let raw: string\n try {\n raw = readFileSync(filePath, 'utf8')\n } catch (err) {\n return {\n success: false,\n fileType: 'marketplace',\n filePath,\n errors: [\n { path: 'file', message: `Failed to read file: ${String(err)}` },\n ],\n warnings: [],\n }\n }\n\n let json: unknown\n try {\n json = JSON.parse(raw)\n } catch (err) {\n return {\n success: false,\n fileType: 'marketplace',\n filePath,\n errors: [\n { path: 'json', message: `Invalid JSON syntax: ${String(err)}` },\n ],\n warnings: [],\n }\n }\n\n const parsed = MarketplaceManifestSchema.safeParse(json)\n if (!parsed.success) {\n errors.push(\n ...parsed.error.issues.map(i => ({\n path: i.path.join('.'),\n message: i.message,\n })),\n )\n return {\n success: false,\n fileType: 'marketplace',\n filePath,\n errors,\n warnings,\n }\n }\n\n const data = parsed.data\n const topLevelDescription =\n typeof (data as any).description === 'string'\n ? String((data as any).description).trim()\n : ''\n const metadataDescription =\n typeof (data.metadata as any)?.description === 'string'\n ? String((data.metadata as any).description).trim()\n : ''\n if (!topLevelDescription && !metadataDescription) {\n warnings.push({\n path: 'description',\n message:\n 'No marketplace description provided. Adding a description helps users understand what this marketplace offers',\n })\n }\n if (!data.plugins || data.plugins.length === 0) {\n warnings.push({\n path: 'plugins',\n message: 'Marketplace has no plugins defined',\n })\n }\n\n const pluginNames = new Set<string>()\n for (const [index, plugin] of data.plugins.entries()) {\n if (pluginNames.has(plugin.name)) {\n errors.push({\n path: `plugins[${index}].name`,\n message: `Duplicate plugin name \"${plugin.name}\"`,\n })\n }\n pluginNames.add(plugin.name)\n\n const source = plugin.source ?? './'\n const sourceErr = validateRelativePath(source)\n if (sourceErr)\n errors.push({ path: `plugins[${index}].source`, message: sourceErr })\n\n const marketplaceRoot = dirname(dirname(filePath))\n const pluginBase = safeResolveWithin(marketplaceRoot, source)\n if (!pluginBase) {\n errors.push({\n path: `plugins[${index}].source`,\n message: 'Invalid source path (must be ./..., no .., forward slashes)',\n })\n continue\n }\n if (!existsSync(pluginBase) || !lstatSync(pluginBase).isDirectory()) {\n errors.push({\n path: `plugins[${index}].source`,\n message: `Source path not found: ${source}`,\n })\n continue\n }\n\n const skillPaths = plugin.skills ?? []\n for (const [j, rel] of skillPaths.entries()) {\n const err = validateRelativePath(rel)\n if (err) {\n errors.push({ path: `plugins[${index}].skills[${j}]`, message: err })\n continue\n }\n const abs = safeResolveWithin(pluginBase, rel)\n if (!abs) {\n errors.push({\n path: `plugins[${index}].skills[${j}]`,\n message: 'Invalid path (must be ./..., no .., forward slashes)',\n })\n continue\n }\n if (!existsSync(abs) || !lstatSync(abs).isDirectory()) {\n errors.push({\n path: `plugins[${index}].skills[${j}]`,\n message: `Skill directory not found: ${rel}`,\n })\n continue\n }\n errors.push(\n ...validateSkillDir(abs).map(e => ({\n ...e,\n path: `plugins[${index}].skills[${j}]: ${e.path}`,\n })),\n )\n }\n\n const commandPaths = plugin.commands ?? []\n for (const [j, rel] of commandPaths.entries()) {\n const err = validateRelativePath(rel)\n if (err) {\n errors.push({ path: `plugins[${index}].commands[${j}]`, message: err })\n continue\n }\n const abs = safeResolveWithin(pluginBase, rel)\n if (!abs) {\n errors.push({\n path: `plugins[${index}].commands[${j}]`,\n message: 'Invalid path (must be ./..., no .., forward slashes)',\n })\n continue\n }\n if (!existsSync(abs) || !lstatSync(abs).isDirectory()) {\n errors.push({\n path: `plugins[${index}].commands[${j}]`,\n message: `Command directory not found: ${rel}`,\n })\n }\n }\n }\n\n return {\n success: errors.length === 0,\n fileType: 'marketplace',\n filePath,\n errors,\n warnings,\n }\n}\n\nfunction validatePluginJson(filePath: string): ValidationResult {\n const errors: ValidationIssue[] = []\n const warnings: ValidationIssue[] = []\n\n let raw: string\n try {\n raw = readFileSync(filePath, 'utf8')\n } catch (err) {\n return {\n success: false,\n fileType: 'plugin',\n filePath,\n errors: [\n { path: 'file', message: `Failed to read file: ${String(err)}` },\n ],\n warnings: [],\n }\n }\n\n let json: unknown\n try {\n json = JSON.parse(raw)\n } catch (err) {\n return {\n success: false,\n fileType: 'plugin',\n filePath,\n errors: [\n { path: 'json', message: `Invalid JSON syntax: ${String(err)}` },\n ],\n warnings: [],\n }\n }\n\n const parsed = PluginManifestSchema.safeParse(json)\n if (!parsed.success) {\n errors.push(\n ...parsed.error.issues.map(i => ({\n path: i.path.join('.'),\n message: i.message,\n })),\n )\n return { success: false, fileType: 'plugin', filePath, errors, warnings }\n }\n\n const data = parsed.data\n\n if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/.test(data.name)) {\n errors.push({\n path: 'name',\n message: 'Must be kebab-case and start with a letter',\n })\n }\n if (\n data.version &&\n !/^(\\d+)\\.(\\d+)\\.(\\d+)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$/.test(\n data.version,\n )\n ) {\n errors.push({\n path: 'version',\n message: 'Invalid semantic version (expected MAJOR.MINOR.PATCH)',\n })\n }\n if (data.homepage) {\n try {\n // eslint-disable-next-line no-new\n new URL(data.homepage)\n } catch {\n errors.push({ path: 'homepage', message: 'Invalid URL' })\n }\n }\n if (typeof data.repository === 'string') {\n try {\n // eslint-disable-next-line no-new\n new URL(data.repository)\n } catch {\n errors.push({ path: 'repository', message: 'Invalid URL' })\n }\n }\n if (!data.version) {\n warnings.push({\n path: 'version',\n message:\n 'No version specified. Consider adding a version following semver (e.g., \"1.0.0\")',\n })\n }\n if (!data.description) {\n warnings.push({\n path: 'description',\n message:\n 'No description provided. Adding a description helps users understand what your plugin does',\n })\n }\n if (!data.author) {\n warnings.push({\n path: 'author',\n message:\n 'No author information provided. Consider adding author details for plugin attribution',\n })\n }\n\n const pluginRoot = dirname(dirname(filePath))\n\n const validatePathList = (field: string, value: unknown) => {\n if (!value) return\n const values = Array.isArray(value) ? value : [value]\n for (const [idx, p] of values.entries()) {\n if (typeof p !== 'string') continue\n const err = validateRelativePath(p)\n if (err) errors.push({ path: `${field}[${idx}]`, message: err })\n const abs = safeResolveWithin(pluginRoot, p)\n if (!abs) {\n errors.push({\n path: `${field}[${idx}]`,\n message: 'Invalid path (must be ./..., no .., forward slashes)',\n })\n } else if (!existsSync(abs)) {\n errors.push({\n path: `${field}[${idx}]`,\n message: `Path not found: ${p}`,\n })\n }\n }\n }\n\n validatePathList('commands', data.commands)\n validatePathList('agents', data.agents)\n validatePathList('skills', data.skills)\n\n if (typeof data.hooks === 'string') validatePathList('hooks', data.hooks)\n if (typeof data.mcpServers === 'string')\n validatePathList('mcpServers', data.mcpServers)\n\n return {\n success: errors.length === 0,\n fileType: 'plugin',\n filePath,\n errors,\n warnings,\n }\n}\n\nexport function validatePluginOrMarketplacePath(\n path: string,\n): ValidationResult {\n const abs = resolveFromAgentCwd(path)\n if (!abs) {\n return {\n success: false,\n fileType: 'plugin',\n filePath: '',\n errors: [{ path: 'path', message: 'Path is required' }],\n warnings: [],\n }\n }\n if (!existsSync(abs)) {\n return {\n success: false,\n fileType: 'plugin',\n filePath: abs,\n errors: [{ path: 'file', message: `Path not found: ${abs}` }],\n warnings: [],\n }\n }\n\n const stat = lstatSync(abs)\n let filePath = abs\n if (stat.isDirectory()) {\n const marketplace = join(abs, '.kode-plugin', 'marketplace.json')\n const plugin = join(abs, '.kode-plugin', 'plugin.json')\n const legacyMarketplace = join(abs, '.claude-plugin', 'marketplace.json')\n const legacyPlugin = join(abs, '.claude-plugin', 'plugin.json')\n if (existsSync(marketplace)) filePath = marketplace\n else if (existsSync(plugin)) filePath = plugin\n else if (existsSync(legacyMarketplace)) filePath = legacyMarketplace\n else if (existsSync(legacyPlugin)) filePath = legacyPlugin\n else {\n return {\n success: false,\n fileType: 'plugin',\n filePath: abs,\n errors: [\n {\n path: 'directory',\n message:\n 'No manifest found in directory. Expected .kode-plugin/marketplace.json or .kode-plugin/plugin.json (legacy .claude-plugin/* is also supported)',\n },\n ],\n warnings: [],\n }\n }\n }\n\n if (filePath.endsWith('marketplace.json'))\n return validateMarketplaceJson(filePath)\n if (filePath.endsWith('plugin.json')) return validatePluginJson(filePath)\n\n try {\n const raw = readFileSync(filePath, 'utf8')\n const json = JSON.parse(raw)\n if (\n json &&\n typeof json === 'object' &&\n Array.isArray((json as any).plugins)\n ) {\n return validateMarketplaceJson(filePath)\n }\n } catch {}\n return validatePluginJson(filePath)\n}\n\nexport function formatValidationResult(result: ValidationResult): string {\n const lines: string[] = []\n for (const err of result.errors) {\n lines.push(` ${figures.pointer} ${err.path}: ${err.message}`)\n }\n for (const warn of result.warnings) {\n lines.push(` ${figures.pointer} ${warn.path}: ${warn.message}`)\n }\n\n lines.push('')\n\n if (result.success) {\n if (result.warnings.length > 0) {\n lines.push(`${figures.tick} Validation passed with warnings`)\n } else {\n lines.push(`${figures.tick} Validation passed`)\n }\n } else {\n lines.push(`${figures.cross} Validation failed`)\n }\n\n return lines.join('\\n')\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;AAAA,SAAS,YAAY,WAAW,oBAAoB;AACpD,SAAS,SAAS,MAAM,SAAS,WAAW;AAC5C,OAAO,aAAa;AACpB,SAAS,SAAS;AAkBlB,IAAM,uBAAuB,EAC1B,aAAa;AAAA,EACZ,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC;AAAA,EACtB,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO,EAAE,SAAS;AAAA,EACjC,QAAQ,EAAE,QAAQ,EAAE,SAAS;AAAA,EAC7B,UAAU,EAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,YAAY,EAAE,QAAQ,EAAE,SAAS;AAAA,EACjC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACvC,UAAU,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS;AAAA,EAC9D,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS;AAAA,EAC5D,QAAQ,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC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,SAAS;AAClB,QAAI,OAAO,SAAS,SAAS,GAAG;AAC9B,YAAM,KAAK,GAAG,QAAQ,IAAI,kCAAkC;AAAA,IAC9D,OAAO;AACL,YAAM,KAAK,GAAG,QAAQ,IAAI,oBAAoB;AAAA,IAChD;AAAA,EACF,OAAO;AACL,UAAM,KAAK,GAAG,QAAQ,KAAK,oBAAoB;AAAA,EACjD;AAEA,SAAO,MAAM,KAAK,IAAI;AACxB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createRequire as __pybCreateRequire } from "node:module";
|
|
2
|
+
const require = __pybCreateRequire(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// src/utils/text/errors.ts
|
|
5
|
+
var MalformedCommandError = class extends TypeError {
|
|
6
|
+
};
|
|
7
|
+
var AbortError = class extends Error {
|
|
8
|
+
};
|
|
9
|
+
var ConfigParseError = class extends Error {
|
|
10
|
+
filePath;
|
|
11
|
+
defaultConfig;
|
|
12
|
+
constructor(message, filePath, defaultConfig) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = "ConfigParseError";
|
|
15
|
+
this.filePath = filePath;
|
|
16
|
+
this.defaultConfig = defaultConfig;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
MalformedCommandError,
|
|
22
|
+
AbortError,
|
|
23
|
+
ConfigParseError
|
|
24
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/utils/text/errors.ts"],
|
|
4
|
+
"sourcesContent": ["export class MalformedCommandError extends TypeError {}\n\nexport class DeprecatedCommandError extends Error {}\n\nexport class AbortError extends Error {}\n\nexport class ConfigParseError extends Error {\n filePath: string\n defaultConfig: unknown\n\n constructor(message: string, filePath: string, defaultConfig: unknown) {\n super(message)\n this.name = 'ConfigParseError'\n this.filePath = filePath\n this.defaultConfig = defaultConfig\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;AAAO,IAAM,wBAAN,cAAoC,UAAU;AAAC;AAI/C,IAAM,aAAN,cAAyB,MAAM;AAAC;AAEhC,IAAM,mBAAN,cAA+B,MAAM;AAAA,EAC1C;AAAA,EACA;AAAA,EAEA,YAAY,SAAiB,UAAkB,eAAwB;AACrE,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,gBAAgB;AAAA,EACvB;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|