1- import { existsSync , mkdirSync , mkdtempSync , writeFileSync } from "node:fs" ;
1+ import { existsSync , mkdirSync , mkdtempSync , symlinkSync , writeFileSync } from "node:fs" ;
22import { tmpdir } from "node:os" ;
33import { join } from "node:path" ;
44import { describe , expect , test } from "vite-plus/test" ;
@@ -142,10 +142,14 @@ describe("e2e: skill (local, no credentials)", () => {
142142 test ( "skill remove --dry-run 仅输出计划且不删盘" , async ( ) => {
143143 const configDir = makeTempConfigDir ( ) ;
144144 const fakeHome = makeTempConfigDir ( ) ;
145- const linkPath = join ( fakeHome , ".claude" , "skills" , "seeded-skill" ) ;
146- seedInstalledSkill ( configDir , "seeded-skill" , [ linkPath ] ) ;
145+ const recordedLink = join ( fakeHome , ".claude" , "skills" , "seeded-skill" ) ;
146+ const historicalLink = join ( fakeHome , ".agents" , "skills" , "seeded-skill" ) ;
147+ seedInstalledSkill ( configDir , "seeded-skill" , [ recordedLink ] ) ;
147148 mkdirSync ( join ( fakeHome , ".claude" , "skills" ) , { recursive : true } ) ;
148- writeFileSync ( linkPath , "link-placeholder" ) ;
149+ mkdirSync ( join ( fakeHome , ".agents" , "skills" ) , { recursive : true } ) ;
150+ // recorded:普通占位文件;historical:指向 canonical 的托管 symlink(不在 lock 里)
151+ writeFileSync ( recordedLink , "link-placeholder" ) ;
152+ symlinkSync ( join ( configDir , "skills" , "seeded-skill" ) , historicalLink , "dir" ) ;
149153
150154 const { stdout, stderr, exitCode } = await runCommandE2e (
151155 SKILL_ROUTES ,
@@ -166,10 +170,11 @@ describe("e2e: skill (local, no credentials)", () => {
166170 expect ( data . skills ?. [ 0 ] ?. status ) . toBe ( "remove" ) ;
167171 expect ( data . skills ?. [ 0 ] ?. name ) . toBe ( "seeded-skill" ) ;
168172 expect ( data . skills ?. [ 0 ] ?. canonical ) . toBe ( join ( configDir , "skills" , "seeded-skill" ) ) ;
169- expect ( data . skills ?. [ 0 ] ?. links ) . toEqual ( [ linkPath ] ) ;
173+ expect ( data . skills ?. [ 0 ] ?. links ?. sort ( ) ) . toEqual ( [ recordedLink , historicalLink ] . sort ( ) ) ;
170174 expect ( existsSync ( join ( configDir , "skills" , "seeded-skill" , "SKILL.md" ) ) ) . toBe ( true ) ;
171175 expect ( existsSync ( join ( configDir , "skills" , "skill-lock.json" ) ) ) . toBe ( true ) ;
172- expect ( existsSync ( linkPath ) ) . toBe ( true ) ;
176+ expect ( existsSync ( recordedLink ) ) . toBe ( true ) ;
177+ expect ( existsSync ( historicalLink ) ) . toBe ( true ) ;
173178 } ) ;
174179
175180 test ( "skill update --dry-run 未安装时退出码与真实一致 (1)" , async ( ) => {
0 commit comments