@@ -286,7 +286,7 @@ async function ensureAgentsGuidance(
286286 }
287287
288288 if ( ! force ) {
289- if ( ! process . stdin . isTTY ) {
289+ if ( ! isInteractiveTTY ( ) ) {
290290 throw new Error (
291291 `${ AGENTS_FILE_NAME } exists and requires confirmation to update. Re-run with --force to apply the change in non-interactive mode.` ,
292292 ) ;
@@ -317,6 +317,7 @@ const CUSTOM_PATH_SENTINEL = '__custom__';
317317interface InitSelection {
318318 skillType : SkillType ;
319319 targets : ClientInfo [ ] ;
320+ selectionMode : 'flags_or_dest' | 'interactive' ;
320321}
321322
322323async function collectInitSelection (
@@ -361,12 +362,13 @@ async function collectInitSelection(
361362 return {
362363 skillType,
363364 targets : [ { name : 'Custom' , id : 'custom' , skillsDir : resolvedDest } ] ,
365+ selectionMode : 'flags_or_dest' ,
364366 } ;
365367 }
366368
367369 if ( argv . client !== undefined ) {
368370 const targets = resolveTargets ( argv . client , undefined , 'install' ) ;
369- return { skillType, targets } ;
371+ return { skillType, targets, selectionMode : 'flags_or_dest' } ;
370372 }
371373
372374 if ( ! interactive ) {
@@ -421,7 +423,7 @@ async function collectInitSelection(
421423 }
422424 }
423425
424- return { skillType, targets } ;
426+ return { skillType, targets, selectionMode : 'interactive' } ;
425427}
426428
427429async function promptCustomPath ( ) : Promise < string > {
@@ -577,6 +579,7 @@ export function registerInitCommand(app: Argv, ctx?: { workspaceRoot: string }):
577579 selection . skillType ,
578580 clientFlag ,
579581 destFlag ,
582+ selection . selectionMode ,
580583 ) ;
581584 if ( policy . allowedTargets . length === 0 ) {
582585 throw new Error ( 'No eligible install targets after applying skill policy.' ) ;
@@ -656,6 +659,7 @@ function enforceInstallPolicy(
656659 skillType : SkillType ,
657660 clientFlag : string | undefined ,
658661 destFlag : string | undefined ,
662+ selectionMode : InitSelection [ 'selectionMode' ] ,
659663) : InstallPolicyResult {
660664 if ( skillType !== 'mcp' ) {
661665 return { allowedTargets : targets , skippedClients : [ ] } ;
@@ -679,7 +683,7 @@ function enforceInstallPolicy(
679683 allowedTargets . push ( target ) ;
680684 }
681685
682- if ( clientFlag === 'claude' ) {
686+ if ( clientFlag === 'claude' || selectionMode === 'interactive' ) {
683687 return { allowedTargets : targets , skippedClients : [ ] } ;
684688 }
685689
0 commit comments