MCPcopy
hub / github.com/nextlevelbuilder/ui-ux-pro-max-skill / syncAssets

Function syncAssets

cli/scripts/sync-assets.mjs:160–204  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

158}
159
160async function syncAssets() {
161 assertInsideRepo(assetRoot);
162 await mkdir(assetRoot, { recursive: true });
163
164 for (const dir of dirsToSync) {
165 const sourceDir = join(sourceRoot, dir);
166 const targetDir = assertInsideRepo(join(assetRoot, dir));
167
168 if (!(await exists(sourceDir))) {
169 throw new Error(`Source directory does not exist: ${sourceDir}`);
170 }
171
172 if (await exists(targetDir)) {
173 await rm(targetDir, { recursive: true, force: true });
174 }
175
176 for (const file of await listFiles(sourceDir)) {
177 if (isExcludedAssetFile(file)) continue;
178 const targetPath = assertInsideRepo(join(targetDir, file));
179 await mkdir(dirname(targetPath), { recursive: true });
180 await writeFile(targetPath, toLF(await readFile(join(sourceDir, file), 'utf8')));
181 }
182 }
183
184 // Sub-skills: copy text content only (fonts/binaries excluded) so all 7
185 // skills ship in the package without bloating it with ~5.8MB of fonts.
186 const skillsTarget = assertInsideRepo(skillsAssetRoot);
187 if (await exists(skillsTarget)) {
188 await rm(skillsTarget, { recursive: true, force: true });
189 }
190 for (const name of subSkills) {
191 const sourceDir = join(skillsSourceRoot, name);
192 if (!(await exists(sourceDir))) {
193 throw new Error(`Source sub-skill does not exist: ${sourceDir}`);
194 }
195 for (const file of await listFiles(sourceDir)) {
196 if (isExcludedAssetFile(file)) continue;
197 const targetPath = assertInsideRepo(join(skillsTarget, name, file));
198 await mkdir(dirname(targetPath), { recursive: true });
199 await writeFile(targetPath, toLF(await readFile(join(sourceDir, file), 'utf8')));
200 }
201 }
202
203 console.log('Synced CLI assets from src/ui-ux-pro-max + 6 sub-skills (normalized to LF).');
204}
205
206if (checkOnly) {
207 await checkAssets();

Callers 1

sync-assets.mjsFile · 0.85

Calls 5

assertInsideRepoFunction · 0.85
listFilesFunction · 0.85
isExcludedAssetFileFunction · 0.85
toLFFunction · 0.85
existsFunction · 0.70

Tested by

no test coverage detected