📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -2,41 +2,41 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const { findProjectRoot } = require('../lib/project-root');
|
||||
const { listSkillIdsRecursive } = require('../lib/skill-utils');
|
||||
const { resolveSafeRealPath } = require('../lib/symlink-safety');
|
||||
|
||||
const ROOT_DIR = findProjectRoot(__dirname);
|
||||
const WEB_APP_PUBLIC = path.join(ROOT_DIR, 'apps', 'web-app', 'public');
|
||||
|
||||
// 2. Copy skills directory content
|
||||
// Note: Symlinking is better, but Windows often requires admin for symlinks.
|
||||
// We will try to copy for reliability in this environment.
|
||||
function copySkillMarkdownFiles(sourceSkills, destinationSkills) {
|
||||
for (const skillId of listSkillIdsRecursive(sourceSkills)) {
|
||||
const sourceFile = path.join(sourceSkills, skillId, 'SKILL.md');
|
||||
const destinationFile = path.join(destinationSkills, skillId, 'SKILL.md');
|
||||
fs.mkdirSync(path.dirname(destinationFile), { recursive: true });
|
||||
fs.copyFileSync(sourceFile, destinationFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Kept for the security-copy test harness and local callers. Production web
|
||||
// setup uses copySkillMarkdownFiles above, so it never publishes active files.
|
||||
function copyFolderSync(from, to, rootDir = from) {
|
||||
if (!fs.existsSync(to)) fs.mkdirSync(to, { recursive: true });
|
||||
|
||||
fs.readdirSync(from).forEach(element => {
|
||||
if (element.startsWith('.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const element of fs.readdirSync(from)) {
|
||||
if (element.startsWith('.')) continue;
|
||||
const srcPath = path.join(from, element);
|
||||
const destPath = path.join(to, element);
|
||||
const stat = fs.lstatSync(srcPath);
|
||||
const realPath = stat.isSymbolicLink() ? resolveSafeRealPath(rootDir, srcPath) : srcPath;
|
||||
|
||||
if (!realPath) {
|
||||
console.warn(`[app:setup] Skipping symlink outside skills root: ${srcPath}`);
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
const realStat = fs.statSync(realPath);
|
||||
|
||||
if (realStat.isFile()) {
|
||||
if (fs.statSync(realPath).isFile()) {
|
||||
fs.copyFileSync(realPath, destPath);
|
||||
} else if (realStat.isDirectory()) {
|
||||
} else if (fs.statSync(realPath).isDirectory()) {
|
||||
copyFolderSync(realPath, destPath, rootDir);
|
||||
}
|
||||
// Skip other types (e.g. sockets, FIFOs)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function copyIndexFiles(sourceIndex, destIndex, destBackupIndex, publicRoot = path.dirname(destIndex)) {
|
||||
@@ -74,14 +74,14 @@ function main() {
|
||||
const sourceSkills = path.join(ROOT_DIR, 'skills');
|
||||
const destSkills = path.join(WEB_APP_PUBLIC, 'skills');
|
||||
|
||||
console.log(`Copying skills directory...`);
|
||||
console.log(`Copying skill markdown files...`);
|
||||
|
||||
// Check if destination exists and remove it to ensure fresh copy
|
||||
if (fs.existsSync(destSkills)) {
|
||||
fs.rmSync(destSkills, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
copyFolderSync(sourceSkills, destSkills, sourceSkills);
|
||||
copySkillMarkdownFiles(sourceSkills, destSkills);
|
||||
|
||||
console.log('✅ Web app assets setup complete!');
|
||||
}
|
||||
@@ -90,4 +90,4 @@ if (require.main === module) {
|
||||
main();
|
||||
}
|
||||
|
||||
module.exports = { copyFolderSync, copyIndexFile, copyIndexFiles, main };
|
||||
module.exports = { copyFolderSync, copySkillMarkdownFiles, copyIndexFile, copyIndexFiles, main };
|
||||
|
||||
Reference in New Issue
Block a user