@@ -291,7 +291,7 @@ const resolveSkillTargetAppFromRequest = instantiateFunction(
291291 'resolveSkillTargetAppFromRequest' ,
292292 {
293293 URL ,
294- normalizeSkillTargetApp
294+ resolveSkillTarget
295295 }
296296) ;
297297const resolveCopyTargetRootSource = extractFunctionBySignature (
@@ -723,10 +723,7 @@ test('importSkillsFromZip reuses a target-specific fallback zip name for base64
723723 let uploadArgs = null ;
724724 let importedOptions = null ;
725725 const importSkillsFromZip = instantiateFunction ( importSkillsFromZipSource , 'importSkillsFromZip' , {
726- normalizeSkillTargetApp ( app ) {
727- const value = typeof app === 'string' ? app . trim ( ) . toLowerCase ( ) : '' ;
728- return value === 'codex' || value === 'claude' ? value : '' ;
729- } ,
726+ resolveSkillTarget,
730727 writeUploadZip ( fileBase64 , prefix , fileName ) {
731728 uploadArgs = { fileBase64, prefix, fileName } ;
732729 return { zipPath : '/tmp/claude.zip' , tempDir : '/tmp/claude-upload' } ;
@@ -750,7 +747,7 @@ test('importSkillsFromZip reuses a target-specific fallback zip name for base64
750747 assert . deepStrictEqual ( importedOptions , {
751748 tempDir : '/tmp/claude-upload' ,
752749 fallbackName : 'claude-skills.zip' ,
753- targetApp : 'claude'
750+ target : 'claude'
754751 } ) ;
755752 assert . deepStrictEqual ( result , { imported : [ ] } ) ;
756753} ) ;
@@ -759,10 +756,7 @@ test('importSkillsFromZip keeps the raw explicit target for downstream validatio
759756 let uploadArgs = null ;
760757 let importedOptions = null ;
761758 const importSkillsFromZip = instantiateFunction ( importSkillsFromZipSource , 'importSkillsFromZip' , {
762- normalizeSkillTargetApp ( app ) {
763- const value = typeof app === 'string' ? app . trim ( ) . toLowerCase ( ) : '' ;
764- return value === 'codex' || value === 'claude' ? value : '' ;
765- } ,
759+ resolveSkillTarget,
766760 writeUploadZip ( fileBase64 , prefix , fileName ) {
767761 uploadArgs = { fileBase64, prefix, fileName } ;
768762 return { zipPath : '/tmp/upload.zip' , tempDir : '/tmp/upload-dir' } ;
@@ -786,7 +780,7 @@ test('importSkillsFromZip keeps the raw explicit target for downstream validatio
786780 assert . deepStrictEqual ( importedOptions , {
787781 tempDir : '/tmp/upload-dir' ,
788782 fallbackName : 'codex-skills.zip' ,
789- targetApp : 'claud'
783+ target : 'claud'
790784 } ) ;
791785 assert . deepStrictEqual ( result , { error : '目标宿主不支持' } ) ;
792786} ) ;
@@ -795,10 +789,7 @@ test('importSkillsFromZip keeps targetApp precedence over target', async () => {
795789 let uploadArgs = null ;
796790 let importedOptions = null ;
797791 const importSkillsFromZip = instantiateFunction ( importSkillsFromZipSource , 'importSkillsFromZip' , {
798- normalizeSkillTargetApp ( app ) {
799- const value = typeof app === 'string' ? app . trim ( ) . toLowerCase ( ) : '' ;
800- return value === 'codex' || value === 'claude' ? value : '' ;
801- } ,
792+ resolveSkillTarget,
802793 writeUploadZip ( fileBase64 , prefix , fileName ) {
803794 uploadArgs = { fileBase64, prefix, fileName } ;
804795 return { zipPath : '/tmp/claude.zip' , tempDir : '/tmp/claude-upload' } ;
@@ -823,11 +814,47 @@ test('importSkillsFromZip keeps targetApp precedence over target', async () => {
823814 assert . deepStrictEqual ( importedOptions , {
824815 tempDir : '/tmp/claude-upload' ,
825816 fallbackName : 'claude-skills.zip' ,
826- targetApp : 'claude'
817+ targetApp : 'claude' ,
818+ target : 'codex'
827819 } ) ;
828820 assert . deepStrictEqual ( result , { imported : [ ] } ) ;
829821} ) ;
830822
823+ test ( 'importSkillsFromZip preserves conflicting explicit target keys for downstream rejection' , async ( ) => {
824+ let uploadArgs = null ;
825+ let importedOptions = null ;
826+ const importSkillsFromZip = instantiateFunction ( importSkillsFromZipSource , 'importSkillsFromZip' , {
827+ resolveSkillTarget,
828+ writeUploadZip ( fileBase64 , prefix , fileName ) {
829+ uploadArgs = { fileBase64, prefix, fileName } ;
830+ return { zipPath : '/tmp/upload.zip' , tempDir : '/tmp/upload-dir' } ;
831+ } ,
832+ importSkillsFromZipFile : async ( _zipPath , options ) => {
833+ importedOptions = options ;
834+ return { error : '目标宿主不支持' } ;
835+ }
836+ } ) ;
837+
838+ const result = await importSkillsFromZip ( {
839+ fileBase64 : 'QUJD' ,
840+ targetApp : 'claud' ,
841+ target : 'claude'
842+ } ) ;
843+
844+ assert . deepStrictEqual ( uploadArgs , {
845+ fileBase64 : 'QUJD' ,
846+ prefix : 'codex-skills-import' ,
847+ fileName : 'codex-skills.zip'
848+ } ) ;
849+ assert . deepStrictEqual ( importedOptions , {
850+ tempDir : '/tmp/upload-dir' ,
851+ fallbackName : 'codex-skills.zip' ,
852+ targetApp : 'claud' ,
853+ target : 'claude'
854+ } ) ;
855+ assert . deepStrictEqual ( result , { error : '目标宿主不支持' } ) ;
856+ } ) ;
857+
831858test ( 'codex-only zip upload route pins target app before request fallback resolution' , ( ) => {
832859 assert . match (
833860 cliContent ,
0 commit comments