mirror of
https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git
synced 2026-11-19 09:00:32 +00:00
fix: align dry-run output with skipped installs (#564)
* test: cover dry-run with an existing skill * fix: align dry-run output with skipped installs * test: compare skip preview with actual install
This commit is contained in:
parent
4f2dbb67e6
commit
9b675f0b13
@ -424,11 +424,10 @@ export async function planPlatformInstallActions(
|
||||
|
||||
const actions: string[] = [];
|
||||
const skillFileExists = await exists(skillFilePath);
|
||||
actions.push(
|
||||
skillFileExists && !force
|
||||
? `Would skip (exists, use --force): ${skillFilePath}`
|
||||
: `Would write: ${skillFilePath}`
|
||||
);
|
||||
if (skillFileExists && !force) {
|
||||
return [`Would skip (exists, use --force): ${skillFilePath}`];
|
||||
}
|
||||
actions.push(`Would write: ${skillFilePath}`);
|
||||
actions.push(`Would copy data + scripts: ${dataDir}`);
|
||||
|
||||
const subSkills = await listBundledSubSkills();
|
||||
@ -438,10 +437,8 @@ export async function planPlatformInstallActions(
|
||||
);
|
||||
}
|
||||
|
||||
if (!skillFileExists || force) {
|
||||
for (const path of await findLegacyInstallPaths(baseDir, aiType)) {
|
||||
actions.push(`Would remove legacy install: ${join(baseDir, path)}`);
|
||||
}
|
||||
for (const path of await findLegacyInstallPaths(baseDir, aiType)) {
|
||||
actions.push(`Would remove legacy install: ${join(baseDir, path)}`);
|
||||
}
|
||||
|
||||
return actions;
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { mkdtemp, readdir } from 'node:fs/promises';
|
||||
import { mkdir, mkdtemp, readFile, readdir, writeFile } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import {
|
||||
planAllPlatformInstallActions,
|
||||
planPlatformInstallActions,
|
||||
generatePlatformFiles,
|
||||
listBundledSubSkills,
|
||||
} from '../../src/utils/template.js';
|
||||
|
||||
test('dry-run plan lists the install actions for one platform', async () => {
|
||||
@ -30,6 +32,29 @@ test('dry-run plan writes nothing to the target directory', async () => {
|
||||
expect(await readdir(scratch)).toEqual(before);
|
||||
});
|
||||
|
||||
test('dry-run skips all install actions for an existing skill unless forced', async () => {
|
||||
const scratch = await mkdtemp(join(tmpdir(), 'uipro-dry-run-existing-'));
|
||||
const skillDir = join(scratch, '.opencode', 'skills', 'ui-ux-pro-max');
|
||||
const skillFile = join(skillDir, 'SKILL.md');
|
||||
await mkdir(skillDir, { recursive: true });
|
||||
await writeFile(skillFile, 'existing skill');
|
||||
|
||||
const skipped = await planPlatformInstallActions(scratch, 'opencode');
|
||||
expect(skipped).toEqual([`Would skip (exists, use --force): ${skillFile}`]);
|
||||
const all = await planAllPlatformInstallActions(scratch);
|
||||
expect(all.get('opencode')).toEqual(skipped);
|
||||
expect(await generatePlatformFiles(scratch, 'opencode')).toEqual([]);
|
||||
expect(await readdir(skillDir)).toEqual(['SKILL.md']);
|
||||
expect(await readFile(skillFile, 'utf-8')).toBe('existing skill');
|
||||
|
||||
const forced = await planPlatformInstallActions(scratch, 'opencode', false, true);
|
||||
expect(forced[0]).toBe(`Would write: ${skillFile}`);
|
||||
expect(forced).toContain(`Would copy data + scripts: ${skillDir}`);
|
||||
const subSkills = await listBundledSubSkills();
|
||||
expect(forced.some(action => action.startsWith(`Would copy ${subSkills.length} sub-skills`))).toBe(true);
|
||||
expect(await readdir(skillDir)).toEqual(['SKILL.md']);
|
||||
});
|
||||
|
||||
test('dry-run plan supports the zcode platform layout', async () => {
|
||||
const scratch = await mkdtemp(join(tmpdir(), 'uipro-dry-run-zcode-'));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user