File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,9 +105,7 @@ function logHelpMessage(
105105 extraTools ?: ExtraTool [ ] ,
106106) {
107107 const extraToolNames = extraTools ?. map ( ( tool ) => tool . value ) ?? [ ] ;
108- const toolsList = [ ...BUILTIN_TOOLS , ...extraToolNames ] . join (
109- ', ' ,
110- ) ;
108+ const toolsList = [ ...BUILTIN_TOOLS , ...extraToolNames ] . join ( ', ' ) ;
111109
112110 logger . log ( `
113111 Usage: create-${ name } [dir] [options]
@@ -222,7 +220,11 @@ type ExtraTool = {
222220 /**
223221 * The action to perform when the tool is selected.
224222 */
225- action ?: ( ) => unknown ;
223+ action ?: ( context : {
224+ templateName : string ;
225+ distFolder : string ;
226+ addAgentsMdSearchDirs : ( dir : string ) => void ;
227+ } ) => unknown ;
226228 /**
227229 * The custom command to run when the tool is selected.
228230 */
@@ -368,7 +370,12 @@ export async function create({
368370 ) ;
369371 if ( matchedTool ) {
370372 if ( matchedTool . action ) {
371- await matchedTool . action ( ) ;
373+ await matchedTool . action ( {
374+ templateName,
375+ distFolder,
376+ addAgentsMdSearchDirs : ( dir : string ) =>
377+ agentsMdSearchDirs . push ( dir ) ,
378+ } ) ;
372379 }
373380 if ( matchedTool . command ) {
374381 runCommand ( matchedTool . command , distFolder ) ;
Original file line number Diff line number Diff line change @@ -35,7 +35,9 @@ test('should run extra tool action', async () => {
3535 {
3636 value : 'custom-action' ,
3737 label : 'Custom Action' ,
38- action : ( ) => {
38+ action : ( { templateName, distFolder } ) => {
39+ expect ( templateName ) . toBe ( 'vanilla' ) ;
40+ expect ( distFolder ) . toBe ( projectDir ) ;
3941 actionCalled = true ;
4042 } ,
4143 } ,
You can’t perform that action at this time.
0 commit comments