📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { readFile, mkdir, writeFile, cp, access, readdir } from 'node:fs/promises';
|
||||
import { readFile, mkdir, writeFile, cp, access, readdir, lstat, rm } from 'node:fs/promises';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { homedir } from 'node:os';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
@@ -156,6 +156,23 @@ export async function renderSkillFile(config: PlatformConfig, isGlobal = false):
|
||||
return frontmatter + content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace a pre-existing non-directory at `path` so a real directory can be
|
||||
* created there. Older CLI installs (and Windows checkouts of the repo's
|
||||
* symlinked data/scripts) can leave plain "pointer" files at these paths;
|
||||
* mkdir then throws EEXIST and the install silently leaves stale files.
|
||||
*/
|
||||
async function ensureCleanDir(path: string): Promise<void> {
|
||||
try {
|
||||
const stat = await lstat(path);
|
||||
if (!stat.isDirectory()) {
|
||||
await rm(path, { recursive: true, force: true });
|
||||
}
|
||||
} catch {
|
||||
// Nothing exists at the path yet — mkdir will create it.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy data and scripts to target directory
|
||||
*/
|
||||
@@ -168,17 +185,46 @@ async function copyDataAndScripts(targetSkillDir: string): Promise<void> {
|
||||
|
||||
// Copy data
|
||||
if (await exists(dataSource)) {
|
||||
await ensureCleanDir(dataTarget);
|
||||
await mkdir(dataTarget, { recursive: true });
|
||||
await cp(dataSource, dataTarget, { recursive: true });
|
||||
}
|
||||
|
||||
// Copy scripts
|
||||
if (await exists(scriptsSource)) {
|
||||
await ensureCleanDir(scriptsTarget);
|
||||
await mkdir(scriptsTarget, { recursive: true });
|
||||
await cp(scriptsSource, scriptsTarget, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* List the static sub-skills bundled under assets/skills/ (everything except
|
||||
* the template-rendered orchestrator). Empty if the package predates bundling.
|
||||
*/
|
||||
export async function listBundledSubSkills(): Promise<string[]> {
|
||||
const skillsSource = join(ASSETS_DIR, 'skills');
|
||||
if (!(await exists(skillsSource))) return [];
|
||||
const entries = await readdir(skillsSource, { withFileTypes: true });
|
||||
return entries.filter(e => e.isDirectory()).map(e => e.name).sort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the bundled sub-skills as siblings of the orchestrator skill, so a
|
||||
* single `uipro init` delivers all 7 skills instead of only ui-ux-pro-max.
|
||||
*/
|
||||
async function copySubSkills(skillsParentDir: string, force: boolean): Promise<void> {
|
||||
const skillsSource = join(ASSETS_DIR, 'skills');
|
||||
if (!(await exists(skillsSource))) return;
|
||||
|
||||
for (const name of await listBundledSubSkills()) {
|
||||
const target = join(skillsParentDir, name);
|
||||
if (await exists(target) && !force) continue;
|
||||
await mkdir(target, { recursive: true });
|
||||
await cp(join(skillsSource, name), target, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate platform files for a specific AI type
|
||||
* All platforms use self-contained installation with data and scripts
|
||||
@@ -222,6 +268,17 @@ export async function generatePlatformFiles(
|
||||
// Copy data and scripts into the skill directory (self-contained)
|
||||
await copyDataAndScripts(skillDir);
|
||||
|
||||
// Install the sibling sub-skills (banner-design, brand, design, ...) next to
|
||||
// the orchestrator so all 7 skills are delivered. The skills parent is the
|
||||
// orchestrator's parent dir (skills/ for most platforms, prompts/ for
|
||||
// copilot, steering/ for kiro) — derived, not hardcoded.
|
||||
const skillsParentDir = join(
|
||||
effectiveDir,
|
||||
config.folderStructure.root,
|
||||
dirname(config.folderStructure.skillPath)
|
||||
);
|
||||
await copySubSkills(skillsParentDir, force);
|
||||
|
||||
return createdFolders;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user