@@ -114,92 +114,99 @@ async function handleCreateCLI(options: CreateOptions): Promise<void> {
114114 process . exit ( 0 ) ;
115115 }
116116
117- await runCliCommand ( 'create' , ! ! options . json , async ( ) => {
118- const validation = validateCreateOptions ( options , cwd ) ;
119- if ( ! validation . valid ) {
120- throw new Error ( validation . error ) ;
121- }
122- const green = '\x1b[32m' ;
123- const reset = '\x1b[0m' ;
117+ const knownAttrs = {
118+ language : standardize ( Language , options . language ) ,
119+ framework : standardize ( Framework , options . framework ) ,
120+ model_provider : standardize ( ModelProviderEnum , options . modelProvider ) ,
121+ memory : standardize ( Memory , options . memory ?? 'none' ) ,
122+ protocol : standardize ( Protocol , options . protocol ?? 'http' ) ,
123+ build : standardize ( Build , options . build ?? 'codezip' ) ,
124+ agent_type : standardize ( AgentType , options . type ?? 'create' ) ,
125+ network_mode : standardize ( NetworkModeEnum , options . networkMode ?? 'public' ) ,
126+ has_agent : options . agent !== false ,
127+ } ;
124128
125- // Progress callback for real-time output
126- const onProgress : ProgressCallback | undefined = options . json
127- ? undefined
128- : ( step , status ) => {
129- if ( status === 'done' ) {
130- console . log ( `${ green } [done]${ reset } ${ step } ` ) ;
131- } else if ( status === 'error' ) {
132- console . log ( `\x1b[31m[error]${ reset } ${ step } ` ) ;
133- }
134- // 'start' is silent - we only show when done
135- } ;
129+ await runCliCommand (
130+ 'create' ,
131+ ! ! options . json ,
132+ async ( ) => {
133+ const validation = validateCreateOptions ( options , cwd ) ;
134+ if ( ! validation . valid ) {
135+ throw new Error ( validation . error ) ;
136+ }
137+ const green = '\x1b[32m' ;
138+ const reset = '\x1b[0m' ;
136139
137- // Commander.js --no-agent sets agent=false, not noAgent=true
138- const skipAgent = options . agent === false ;
140+ // Progress callback for real-time output
141+ const onProgress : ProgressCallback | undefined = options . json
142+ ? undefined
143+ : ( step , status ) => {
144+ if ( status === 'done' ) {
145+ console . log ( `${ green } [done]${ reset } ${ step } ` ) ;
146+ } else if ( status === 'error' ) {
147+ console . log ( `\x1b[31m[error]${ reset } ${ step } ` ) ;
148+ }
149+ // 'start' is silent - we only show when done
150+ } ;
139151
140- const result = skipAgent
141- ? await createProject ( {
142- name : projectName ! ,
143- cwd,
144- skipGit : options . skipGit ,
145- skipInstall : options . skipInstall ,
146- onProgress,
147- } )
148- : await createProjectWithAgent ( {
149- name : name ! ,
150- projectName,
151- cwd,
152- type : options . type as 'create' | 'import' | undefined ,
153- buildType : ( options . build as BuildType ) ?? 'CodeZip' ,
154- language : ( options . language as TargetLanguage ) ?? ( options . type === 'import' ? 'Python' : undefined ) ,
155- framework : options . framework as SDKFramework | undefined ,
156- modelProvider : options . modelProvider as ModelProvider | undefined ,
157- apiKey : options . apiKey ,
158- memory : ( options . memory as 'none' | 'shortTerm' | 'longAndShortTerm' ) ?? 'none' ,
159- protocol : options . protocol as ProtocolMode | undefined ,
160- agentId : options . agentId ,
161- agentAliasId : options . agentAliasId ,
162- region : options . region ,
163- networkMode : options . networkMode as NetworkMode | undefined ,
164- subnets : parseCommaSeparatedList ( options . subnets ) ,
165- securityGroups : parseCommaSeparatedList ( options . securityGroups ) ,
166- idleTimeout : options . idleTimeout ? Number ( options . idleTimeout ) : undefined ,
167- maxLifetime : options . maxLifetime ? Number ( options . maxLifetime ) : undefined ,
168- sessionStorageMountPath : options . sessionStorageMountPath ,
169- withConfigBundle : options . withConfigBundle ,
170- skipGit : options . skipGit ,
171- skipInstall : options . skipInstall ,
172- skipPythonSetup : options . skipPythonSetup ,
173- onProgress,
174- } ) ;
152+ // Commander.js --no-agent sets agent=false, not noAgent=true
153+ const skipAgent = options . agent === false ;
175154
176- if ( ! result . success ) {
177- throw result . error ;
178- }
155+ const result = skipAgent
156+ ? await createProject ( {
157+ name : projectName ! ,
158+ cwd,
159+ skipGit : options . skipGit ,
160+ skipInstall : options . skipInstall ,
161+ onProgress,
162+ } )
163+ : await createProjectWithAgent ( {
164+ name : name ! ,
165+ projectName,
166+ cwd,
167+ type : options . type as 'create' | 'import' | undefined ,
168+ buildType : ( options . build as BuildType ) ?? 'CodeZip' ,
169+ language : ( options . language as TargetLanguage ) ?? ( options . type === 'import' ? 'Python' : undefined ) ,
170+ framework : options . framework as SDKFramework | undefined ,
171+ modelProvider : options . modelProvider as ModelProvider | undefined ,
172+ apiKey : options . apiKey ,
173+ memory : ( options . memory as 'none' | 'shortTerm' | 'longAndShortTerm' ) ?? 'none' ,
174+ protocol : options . protocol as ProtocolMode | undefined ,
175+ agentId : options . agentId ,
176+ agentAliasId : options . agentAliasId ,
177+ region : options . region ,
178+ networkMode : options . networkMode as NetworkMode | undefined ,
179+ subnets : parseCommaSeparatedList ( options . subnets ) ,
180+ securityGroups : parseCommaSeparatedList ( options . securityGroups ) ,
181+ idleTimeout : options . idleTimeout ? Number ( options . idleTimeout ) : undefined ,
182+ maxLifetime : options . maxLifetime ? Number ( options . maxLifetime ) : undefined ,
183+ sessionStorageMountPath : options . sessionStorageMountPath ,
184+ withConfigBundle : options . withConfigBundle ,
185+ skipGit : options . skipGit ,
186+ skipInstall : options . skipInstall ,
187+ skipPythonSetup : options . skipPythonSetup ,
188+ onProgress,
189+ } ) ;
179190
180- if ( options . json ) {
181- console . log ( JSON . stringify ( serializeResult ( result ) ) ) ;
182- } else {
183- printCreateSummary ( projectName ! , result . agentName , options . language , options . framework ) ;
184- if ( options . skipInstall ) {
185- console . log (
186- "\nDependency installation was skipped. Run 'npm install' in agentcore/cdk/ and 'uv sync' in your agent directory manually."
187- ) ;
191+ if ( ! result . success ) {
192+ throw result . error ;
188193 }
189- }
190194
191- return {
192- language : standardize ( Language , options . language ) ,
193- framework : standardize ( Framework , options . framework ) ,
194- model_provider : standardize ( ModelProviderEnum , options . modelProvider ) ,
195- memory : standardize ( Memory , options . memory ?? 'none' ) ,
196- protocol : standardize ( Protocol , options . protocol ?? 'http' ) ,
197- build : standardize ( Build , options . build ?? 'codezip' ) ,
198- agent_type : standardize ( AgentType , options . type ?? 'create' ) ,
199- network_mode : standardize ( NetworkModeEnum , options . networkMode ?? 'public' ) ,
200- has_agent : options . agent !== false ,
201- } ;
202- } ) ;
195+ if ( options . json ) {
196+ console . log ( JSON . stringify ( result ) ) ;
197+ } else {
198+ printCreateSummary ( projectName ! , result . agentName , options . language , options . framework ) ;
199+ if ( options . skipInstall ) {
200+ console . log (
201+ "\nDependency installation was skipped. Run 'npm install' in agentcore/cdk/ and 'uv sync' in your agent directory manually."
202+ ) ;
203+ }
204+ }
205+
206+ return knownAttrs ;
207+ } ,
208+ knownAttrs
209+ ) ;
203210}
204211
205212export const registerCreate = ( program : Command ) => {
0 commit comments