收口 Makelore 客户端变更
This commit is contained in:
@@ -12,10 +12,7 @@ import { tmpdir } from 'node:os';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { performance } from 'node:perf_hooks';
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import {
|
||||
ensureBundledCourseSkills,
|
||||
ensureBundledSuperpowersPlugin,
|
||||
} from '@electron/opencode/superpowers';
|
||||
import { ensureBundledCourseSkills } from '@electron/opencode/course-skills';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const describeWindows = process.platform === 'win32' ? describe : describe.skip;
|
||||
@@ -29,7 +26,6 @@ function writeFixtureFile(filePath: string, content: string): void {
|
||||
function createFixture() {
|
||||
const root = mkdtempSync(join(tmpdir(), 'niancode-electron-unicode-'));
|
||||
const sources = join(root, 'sources');
|
||||
const superpowers = join(sources, 'superpowers');
|
||||
const courseSkills = join(sources, 'course-skills');
|
||||
const managedConfigDir = join(
|
||||
root,
|
||||
@@ -41,18 +37,6 @@ function createFixture() {
|
||||
'niancode-config',
|
||||
);
|
||||
|
||||
writeFixtureFile(
|
||||
join(superpowers, 'package.json'),
|
||||
`${JSON.stringify({ name: 'superpowers', version: '5.0.7' })}\n`,
|
||||
);
|
||||
writeFixtureFile(
|
||||
join(superpowers, '.opencode', 'plugins', 'superpowers.js'),
|
||||
'export const SuperpowersPlugin = async () => ({});\n',
|
||||
);
|
||||
writeFixtureFile(
|
||||
join(superpowers, 'skills', 'using-superpowers', 'SKILL.md'),
|
||||
'---\nname: using-superpowers\n---\n',
|
||||
);
|
||||
writeFixtureFile(
|
||||
join(courseSkills, 'pm-project-plan', 'SKILL.md'),
|
||||
'---\nname: pm-project-plan\n---\n',
|
||||
@@ -64,7 +48,6 @@ function createFixture() {
|
||||
return {
|
||||
root,
|
||||
managedConfigDir,
|
||||
superpowers,
|
||||
courseSkills,
|
||||
rootEntriesBeforeCopy: readdirSync(root).sort(),
|
||||
};
|
||||
@@ -124,55 +107,6 @@ describeWindows('Windows Unicode runtime directory copies', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('installs and reuses Superpowers below a Chinese user path', () => {
|
||||
expect(ensureBundledSuperpowersPlugin({
|
||||
managedConfigDir: fixture.managedConfigDir,
|
||||
sourceDir: fixture.superpowers,
|
||||
})).toBe(true);
|
||||
|
||||
const installedSkill = join(
|
||||
fixture.managedConfigDir,
|
||||
'superpowers-bundles',
|
||||
'5.0.7',
|
||||
'skills',
|
||||
'using-superpowers',
|
||||
'SKILL.md',
|
||||
);
|
||||
expect(readFileSync(installedSkill, 'utf8')).toBe(
|
||||
readFileSync(join(fixture.superpowers, 'skills', 'using-superpowers', 'SKILL.md'), 'utf8'),
|
||||
);
|
||||
expect(JSON.parse(readFileSync(
|
||||
join(fixture.managedConfigDir, 'superpowers-active.json'),
|
||||
'utf8',
|
||||
))).toEqual({ version: '5.0.7', directory: '5.0.7' });
|
||||
expect(readFileSync(
|
||||
join(fixture.managedConfigDir, 'plugins', 'superpowers-niancode.js'),
|
||||
'utf8',
|
||||
)).toContain('../superpowers-bundles/5.0.7/.opencode/plugins/superpowers.js');
|
||||
expect(readdirSync(join(
|
||||
fixture.managedConfigDir,
|
||||
'superpowers-bundles',
|
||||
)).sort()).toEqual(['5.0.7']);
|
||||
|
||||
const reuseMarker = join(
|
||||
fixture.managedConfigDir,
|
||||
'superpowers-bundles',
|
||||
'5.0.7',
|
||||
'reuse-marker.txt',
|
||||
);
|
||||
writeFileSync(reuseMarker, 'preserve-me', 'utf8');
|
||||
expect(ensureBundledSuperpowersPlugin({
|
||||
managedConfigDir: fixture.managedConfigDir,
|
||||
sourceDir: fixture.superpowers,
|
||||
})).toBe(true);
|
||||
expect(readFileSync(reuseMarker, 'utf8')).toBe('preserve-me');
|
||||
expect(readdirSync(join(
|
||||
fixture.managedConfigDir,
|
||||
'superpowers-bundles',
|
||||
)).sort()).toEqual(['5.0.7']);
|
||||
expectNoUnexpectedRootEntries(fixture);
|
||||
});
|
||||
|
||||
it('copies course Skills below a Chinese user path twice', () => {
|
||||
const unrelatedSkill = join(
|
||||
fixture.managedConfigDir,
|
||||
Reference in New Issue
Block a user