@@ -38,6 +38,7 @@ const CHECK_MODE = process.argv.includes('--check')
3838const MATERIALIZE_SKILLS = process . argv . includes ( '--materialize-skills' )
3939
4040const CORE_SKILLS_DIR = path . join ( ROOT , 'skills' )
41+ const CORE_PACKAGE_SKILLS_DIR = path . join ( ROOT , 'packages' , 'core' , 'skills' )
4142const PI_PLUGIN_DIR = path . join ( ROOT , 'packages' , 'pi-plugin' )
4243
4344const bundle = loadBundle ( ROOT )
@@ -55,6 +56,9 @@ const piSkillDrift = MATERIALIZE_SKILLS
5556 : cleanPiSkills ( )
5657if ( piSkillDrift ) driftDetected = true
5758
59+ const corePackageSkillDrift = cleanCorePackageSkills ( )
60+ if ( corePackageSkillDrift ) driftDetected = true
61+
5862const hygieneDrift = checkSourceHygiene ( )
5963if ( hygieneDrift ) driftDetected = true
6064
@@ -99,6 +103,19 @@ function cleanPiSkills () {
99103 return true
100104}
101105
106+ function cleanCorePackageSkills ( ) {
107+ if ( ! existsSync ( CORE_PACKAGE_SKILLS_DIR ) ) return false
108+
109+ if ( CHECK_MODE ) {
110+ console . error ( `Materialized skill dir present in source tree: ${ path . relative ( ROOT , CORE_PACKAGE_SKILLS_DIR ) } ` )
111+ return true
112+ }
113+
114+ rmSync ( CORE_PACKAGE_SKILLS_DIR , { recursive : true , force : true } )
115+ console . log ( `Removed materialized skill dir: ${ path . relative ( ROOT , CORE_PACKAGE_SKILLS_DIR ) } ` )
116+ return true
117+ }
118+
102119function materializePiSkills ( ) {
103120 const destSkillsDir = path . join ( PI_PLUGIN_DIR , 'skills' )
104121 let drift = false
@@ -145,9 +162,6 @@ function materializePiSkills () {
145162function checkSourceHygiene ( ) {
146163 let drift = false
147164 // Reject any package-local skills dirs in removed/legacy plugin packages.
148- // NOTE: packages/core is intentionally excluded — it legitimately materializes
149- // a skills/ dir during prepack (skills:sync). Its presence is governed by
150- // packages/core/scripts/sync-shared-skill-assets.mjs, not this hygiene check.
151165 const packageRoots = [
152166 path . join ( ROOT , 'packages' , 'claude-plugin' ) ,
153167 path . join ( ROOT , 'packages' , 'codex-plugin' ) ,
0 commit comments