@@ -4,6 +4,7 @@ import { FS_TOKEN, IFileSystem } from "../types/FileSystem";
44import { NPM_ANGULAR , NPM_REACT , NPM_WEBCOMPONENTS , resolvePackage , UPGRADEABLE_PACKAGES } from "../update/package-resolve" ;
55import { App } from "./App" ;
66import { detectFrameworkFromPackageJson } from "./detect-framework" ;
7+ import { FsFileSystem } from "./FileSystem" ;
78import { TEMPLATE_MANAGER } from "./GlobalConstants" ;
89import { ProjectConfig } from "./ProjectConfig" ;
910import { Util } from "./Util" ;
@@ -73,11 +74,14 @@ function resolveSkillsRoots(): string[] {
7374
7475/**
7576 * Copies skill files from the installed Ignite UI package(s) into .claude/skills/.
76- * Works with both real FS (CLI) and virtual Tree FS (schematics) through IFileSystem.
7777 */
7878export function copyAISkillsToProject ( ) : AISkillsCopyResult {
7979 const result : AISkillsCopyResult = { found : 0 , skipped : 0 , failed : 0 } ;
80- const fs = App . container . get < IFileSystem > ( FS_TOKEN ) ;
80+ // Source reads (glob + readFile) always use physical FS - skill files can
81+ // come from sources outside the project virtual tree (external/global package):
82+ const srcFs = new FsFileSystem ( ) ;
83+ // Destination writes respect the App FS (which may be virtual):
84+ const destFs = App . container . get < IFileSystem > ( FS_TOKEN ) ;
8185 const skillsRoots = resolveSkillsRoots ( ) ;
8286
8387 if ( ! skillsRoots . length ) {
@@ -87,7 +91,7 @@ export function copyAISkillsToProject(): AISkillsCopyResult {
8791 const multiRoot = skillsRoots . length > 1 ;
8892
8993 for ( const skillsRoot of skillsRoots ) {
90- const rawPaths = fs . glob ( skillsRoot , "**/*" ) ;
94+ const rawPaths = srcFs . glob ( skillsRoot , "**/*" ) ;
9195 const pkgDirName = multiRoot ? path . basename ( path . dirname ( skillsRoot ) ) : "" ;
9296
9397 for ( const p of rawPaths ) {
@@ -101,18 +105,18 @@ export function copyAISkillsToProject(): AISkillsCopyResult {
101105 ? `${ CLAUDE_SKILLS_DIR } /${ pkgDirName } /${ rel } `
102106 : `${ CLAUDE_SKILLS_DIR } /${ rel } ` ;
103107
104- const newContent = fs . readFile ( p ) ;
108+ const newContent = srcFs . readFile ( p ) ;
105109 try {
106- if ( fs . fileExists ( dest ) ) {
107- const existingContent = fs . readFile ( dest ) ;
110+ if ( destFs . fileExists ( dest ) ) {
111+ const existingContent = destFs . readFile ( dest ) ;
108112 if ( existingContent === newContent ) {
109113 result . skipped ++ ;
110114 continue ;
111115 }
112- fs . writeFile ( dest , newContent ) ;
116+ destFs . writeFile ( dest , newContent ) ;
113117 Util . log ( `${ Util . greenCheck ( ) } Updated ${ dest } ` ) ;
114118 } else {
115- fs . writeFile ( dest , newContent ) ;
119+ destFs . writeFile ( dest , newContent ) ;
116120 Util . log ( `${ Util . greenCheck ( ) } Created ${ dest } ` ) ;
117121 }
118122 } catch {
0 commit comments