fix: close marketplace client review findings
This commit is contained in:
@@ -227,6 +227,7 @@ export class PiManagedExtensionHost {
|
||||
.map((entry) => [entry.id.trim(), {
|
||||
id: entry.id.trim(),
|
||||
entryPath: entry.entryPath.trim().replaceAll('\\', '/'),
|
||||
...(entry.packageRoot?.trim() ? { packageRoot: path.resolve(entry.packageRoot) } : {}),
|
||||
}]),
|
||||
).values()];
|
||||
const tools = role === 'child'
|
||||
|
||||
@@ -12,6 +12,7 @@ const MANAGED_SEGMENT_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/;
|
||||
export interface PiSkillEntry {
|
||||
id: string;
|
||||
entryPath: string;
|
||||
packageRoot?: string;
|
||||
}
|
||||
|
||||
export interface BundledCodingSkillsPathInput {
|
||||
@@ -157,6 +158,12 @@ function normalizeSkillEntries(skillEntries: readonly PiSkillEntry[]): PiSkillEn
|
||||
const skillId = rawEntry.id.trim();
|
||||
const entryPath = rawEntry.entryPath.trim().replaceAll('\\', '/');
|
||||
if (!skillId || !entryPath) throw new Error('Effective coding Skill entry is invalid');
|
||||
const packageRoot = typeof rawEntry.packageRoot === 'string'
|
||||
? rawEntry.packageRoot.trim()
|
||||
: undefined;
|
||||
if (rawEntry.packageRoot !== undefined && !packageRoot) {
|
||||
throw new Error('Effective coding Skill package root is invalid');
|
||||
}
|
||||
if (entryPath.startsWith('/') || /^[A-Za-z]:\//u.test(entryPath)
|
||||
|| /^[A-Za-z][A-Za-z0-9+.-]*:/u.test(entryPath)) {
|
||||
throw new Error(`Effective coding Skill entry path must be relative: ${entryPath}`);
|
||||
@@ -167,7 +174,11 @@ function normalizeSkillEntries(skillEntries: readonly PiSkillEntry[]): PiSkillEn
|
||||
}
|
||||
if (seen.has(skillId)) continue;
|
||||
seen.add(skillId);
|
||||
result.push({ id: skillId, entryPath: relative });
|
||||
result.push({
|
||||
id: skillId,
|
||||
entryPath: relative,
|
||||
...(packageRoot ? { packageRoot: path.resolve(packageRoot) } : {}),
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -194,14 +205,16 @@ async function resolveSkillEntryPath(
|
||||
entry: PiSkillEntry,
|
||||
skillRoots: readonly string[] = [],
|
||||
): Promise<string> {
|
||||
const roots = [
|
||||
path.resolve(bundledSkillsDir),
|
||||
...resolveBundledCodingPluginRootPaths(path.join(
|
||||
path.dirname(path.resolve(bundledSkillsDir)),
|
||||
'coding-plugins',
|
||||
)),
|
||||
...skillRoots.map((root) => path.resolve(root)),
|
||||
];
|
||||
const roots = entry.packageRoot
|
||||
? [path.resolve(entry.packageRoot)]
|
||||
: [
|
||||
path.resolve(bundledSkillsDir),
|
||||
...resolveBundledCodingPluginRootPaths(path.join(
|
||||
path.dirname(path.resolve(bundledSkillsDir)),
|
||||
'coding-plugins',
|
||||
)),
|
||||
...skillRoots.map((root) => path.resolve(root)),
|
||||
];
|
||||
for (const root of roots) {
|
||||
const candidate = pathWithin(root, entry.entryPath);
|
||||
if (!candidate) continue;
|
||||
|
||||
Reference in New Issue
Block a user