feat: add plugin marketplace renderer

This commit is contained in:
brother7 committed 2026-08-28 18:42:28 +08:00
1 parent 8b6824a8ba
commit 97c9ad1aad
27 files changed
+1585 -23

No files matched your search

+17 -4
View File
@@ -156,19 +156,32 @@ describe('ProjectPluginService', () => {
await expect(service.readSelection(root)).resolves.toMatchObject({ enabledPluginIds: [] });
});
it('rejects unknown plugin mutations but retains unknown IDs already in the file', async () => {
it('allows only explicit removal of a selected unknown ID and preserves every other ID', async () => {
const root = await project();
await writeFile(selectionPath(root), JSON.stringify({
schemaVersion: 1,
enabledPluginIds: ['future.plugin'],
enabledPluginIds: ['future.plugin', 'another.future', 'makelore.data-service'],
updatedAt: '2026-08-27T04:00:00.000Z',
}), 'utf8');
const service = new ProjectPluginService();
await expect(service.enable(root, 'future.plugin')).rejects.toMatchObject({
code: 'CODING_PLUGIN_UNKNOWN',
});
await expect(service.enable(root, 'makelore.data-service')).resolves.toMatchObject({
enabledPluginIds: ['future.plugin', 'makelore.data-service'],
await expect(service.disable(root, 'future.plugin')).resolves.toMatchObject({
enabledPluginIds: ['another.future', 'makelore.data-service'],
});
const saved = JSON.parse(await readFile(selectionPath(root), 'utf8')) as { enabledPluginIds: string[] };
expect(saved).toMatchObject({
enabledPluginIds: ['another.future', 'makelore.data-service'],
});
});
it('rejects unselected unknown disable without writing a selection file', async () => {
const root = await project();
const service = new ProjectPluginService();
await expect(service.disable(root, 'future.plugin')).rejects.toMatchObject({
code: 'CODING_PLUGIN_UNKNOWN',
});
await expect(stat(selectionPath(root))).rejects.toMatchObject({ code: 'ENOENT' });
});
});