feat(coding): add bundled plugin package selection

This commit is contained in:
brother7 committed 2026-08-27 15:16:07 +08:00
1 parent 2ab1c51a24
commit 422150d4fa
14 files changed
+2188 -15

No files matched your search

+13 -4
View File
@@ -8,7 +8,8 @@ import ts from 'typescript';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { listProductCodingSkills } from '@electron/coding-projects/skill-registry';
const ASSET_ROOT = path.resolve('resources/coding-skills/data-service/assets');
const PLUGIN_SKILL_ROOT = path.resolve('resources/coding-plugins/data-service/skills/data-service');
const ASSET_ROOT = path.join(PLUGIN_SKILL_ROOT, 'assets');
const ASSETS = ['makelore-data.ts', 'makelore-data.js'] as const;
const temporaryRoots: string[] = [];
let moduleCounter = 0;
@@ -236,7 +237,7 @@ describe.each(ASSETS)('generated Data Service SDK (%s)', (assetName) => {
describe('bundled Data Service Skill packaging', () => {
it('ships both canonical assets and an ordered workflow with explicit completion criteria', async () => {
const skill = await readFile(path.resolve('resources/coding-skills/data-service/SKILL.md'), 'utf8');
const skill = await readFile(path.join(PLUGIN_SKILL_ROOT, 'SKILL.md'), 'utf8');
const readme = await readFile(path.resolve('README.md'), 'utf8');
const tsAsset = await readFile(path.join(ASSET_ROOT, 'makelore-data.ts'), 'utf8');
const jsAsset = await readFile(path.join(ASSET_ROOT, 'makelore-data.js'), 'utf8');
@@ -263,9 +264,17 @@ describe('bundled Data Service Skill packaging', () => {
expect(readme).toContain('data-service');
expect(readme).toContain('显式请求');
expect(readme).toContain('预览');
const packaged = await listProductCodingSkills(path.resolve('resources/coding-skills'));
const packaged = await listProductCodingSkills(
path.resolve('resources/coding-skills'),
[],
[{ id: 'data-service', directory: PLUGIN_SKILL_ROOT }],
);
const dataService = packaged.find(({ id }) => id === 'data-service');
expect(dataService).toMatchObject({ id: 'data-service', name: 'data-service' });
expect(dataService).toMatchObject({
id: 'data-service',
name: 'data-service',
location: PLUGIN_SKILL_ROOT,
});
expect(dataService?.entries).toEqual(expect.arrayContaining([
{ path: 'SKILL.md', type: 'file' },
{ path: 'assets', type: 'directory' },