@@ -38,6 +38,18 @@ describe('create command', () => {
3838 expect ( json . success ) . toBe ( false ) ;
3939 expect ( json . error . includes ( 'conflicts' ) ) . toBeTruthy ( ) ;
4040 } ) ;
41+
42+ it ( 'creates project-only scaffold with --project-name and no --name' , async ( ) => {
43+ const projectName = `ProjOnly${ Date . now ( ) } ` ;
44+ const result = await runCLI ( [ 'create' , '--project-name' , projectName , '--no-agent' , '--json' ] , testDir ) ;
45+
46+ expect ( result . exitCode , `stderr: ${ result . stderr } , stdout: ${ result . stdout } ` ) . toBe ( 0 ) ;
47+
48+ const json = JSON . parse ( result . stdout ) ;
49+ expect ( json . success ) . toBe ( true ) ;
50+ expect ( json . projectPath ) . toMatch ( new RegExp ( `/${ projectName } $` ) ) ;
51+ expect ( await exists ( join ( json . projectPath , 'agentcore' ) ) ) . toBeTruthy ( ) ;
52+ } ) ;
4153 } ) ;
4254
4355 describe ( 'with agent' , ( ) => {
@@ -145,6 +157,82 @@ describe('create command', () => {
145157 expect ( episodic ?. namespaces ) . toEqual ( [ '/episodes/{actorId}/{sessionId}' ] ) ;
146158 expect ( episodic ?. reflectionNamespaces ) . toEqual ( [ '/episodes/{actorId}' ] ) ;
147159 } ) ;
160+
161+ it ( 'uses --project-name for project and --name for agent resource' , async ( ) => {
162+ const projectName = `AgentProj${ Date . now ( ) . toString ( ) . slice ( - 6 ) } ` ;
163+ const agentName = `AgentResource${ randomUUID ( ) . replace ( / - / g, '' ) . slice ( 0 , 16 ) } ` ;
164+ const result = await runCLI (
165+ [
166+ 'create' ,
167+ '--project-name' ,
168+ projectName ,
169+ '--name' ,
170+ agentName ,
171+ '--language' ,
172+ 'Python' ,
173+ '--framework' ,
174+ 'Strands' ,
175+ '--model-provider' ,
176+ 'Bedrock' ,
177+ '--memory' ,
178+ 'none' ,
179+ '--skip-git' ,
180+ '--skip-install' ,
181+ '--json' ,
182+ ] ,
183+ testDir
184+ ) ;
185+
186+ expect ( result . exitCode , `stdout: ${ result . stdout } , stderr: ${ result . stderr } ` ) . toBe ( 0 ) ;
187+
188+ const json = JSON . parse ( result . stdout ) ;
189+ expect ( json . success ) . toBe ( true ) ;
190+ expect ( json . projectPath ) . toMatch ( new RegExp ( `/${ projectName } $` ) ) ;
191+ expect ( json . agentName ) . toBe ( agentName ) ;
192+ expect ( await exists ( join ( json . projectPath , 'app' , agentName ) ) ) . toBeTruthy ( ) ;
193+
194+ const projectSpec = JSON . parse ( await readFile ( join ( json . projectPath , 'agentcore/agentcore.json' ) , 'utf-8' ) ) ;
195+ expect ( projectSpec . name ) . toBe ( projectName ) ;
196+ expect ( projectSpec . runtimes [ 0 ] . name ) . toBe ( agentName ) ;
197+ } ) ;
198+ } ) ;
199+
200+ describe ( 'with harness' , ( ) => {
201+ it ( 'uses --project-name for project and --name for harness resource' , async ( ) => {
202+ const projectName = `HarnessProj${ Date . now ( ) . toString ( ) . slice ( - 6 ) } ` ;
203+ const harnessName = `HarnessResource${ randomUUID ( ) . replace ( / - / g, '' ) . slice ( 0 , 16 ) } ` ;
204+ const result = await runCLI (
205+ [ 'create' , '--project-name' , projectName , '--name' , harnessName , '--skip-git' , '--skip-install' , '--json' ] ,
206+ testDir
207+ ) ;
208+
209+ expect ( result . exitCode , `stdout: ${ result . stdout } , stderr: ${ result . stderr } ` ) . toBe ( 0 ) ;
210+
211+ const json = JSON . parse ( result . stdout ) ;
212+ expect ( json . success ) . toBe ( true ) ;
213+ expect ( json . projectPath ) . toMatch ( new RegExp ( `/${ projectName } $` ) ) ;
214+ expect ( await exists ( join ( json . projectPath , 'app' , harnessName , 'harness.json' ) ) ) . toBeTruthy ( ) ;
215+
216+ const projectSpec = JSON . parse ( await readFile ( join ( json . projectPath , 'agentcore/agentcore.json' ) , 'utf-8' ) ) ;
217+ expect ( projectSpec . name ) . toBe ( projectName ) ;
218+ expect ( projectSpec . harnesses [ 0 ] . name ) . toBe ( harnessName ) ;
219+ expect ( projectSpec . harnesses [ 0 ] . path ) . toBe ( `app/${ harnessName } ` ) ;
220+ } ) ;
221+
222+ it ( 'rejects long harness name without --project-name but accepts it with --project-name' , async ( ) => {
223+ const harnessName = `Harness${ 'A' . repeat ( 30 ) } ` ;
224+ const rejected = await runCLI ( [ 'create' , '--name' , harnessName , '--skip-install' , '--json' ] , testDir ) ;
225+ expect ( rejected . exitCode ) . toBe ( 1 ) ;
226+ expect ( JSON . parse ( rejected . stdout ) . success ) . toBe ( false ) ;
227+
228+ const projectName = `ShortProj${ Date . now ( ) . toString ( ) . slice ( - 6 ) } ` ;
229+ const accepted = await runCLI (
230+ [ 'create' , '--project-name' , projectName , '--name' , harnessName , '--skip-git' , '--skip-install' , '--json' ] ,
231+ testDir
232+ ) ;
233+ expect ( accepted . exitCode , `stdout: ${ accepted . stdout } , stderr: ${ accepted . stderr } ` ) . toBe ( 0 ) ;
234+ expect ( JSON . parse ( accepted . stdout ) . success ) . toBe ( true ) ;
235+ } ) ;
148236 } ) ;
149237
150238 describe ( '--defaults' , ( ) => {
@@ -163,12 +251,41 @@ describe('create command', () => {
163251 it ( 'shows files without creating' , async ( ) => {
164252 const name = `DryRun${ Date . now ( ) } ` ;
165253 // --framework triggers agent path where --dry-run is supported
166- const result = await runCLI ( [ 'create' , '--name' , name , '--defaults' , '--framework' , 'Strands' , '--dry-run' ] , testDir ) ;
254+ const result = await runCLI (
255+ [ 'create' , '--name' , name , '--defaults' , '--framework' , 'Strands' , '--dry-run' ] ,
256+ testDir
257+ ) ;
167258
168259 expect ( result . exitCode ) . toBe ( 0 ) ;
169260 expect ( result . stdout . includes ( 'would create' ) || result . stdout . includes ( 'Dry run' ) ) . toBeTruthy ( ) ;
170261 expect ( await exists ( join ( testDir , name ) ) , 'Should not create directory' ) . toBe ( false ) ;
171262 } ) ;
263+
264+ it ( 'uses project-name for project paths and name for app paths' , async ( ) => {
265+ const projectName = `DryProj${ Date . now ( ) . toString ( ) . slice ( - 6 ) } ` ;
266+ const agentName = `DryAgent${ Date . now ( ) . toString ( ) . slice ( - 6 ) } ` ;
267+ const result = await runCLI (
268+ [
269+ 'create' ,
270+ '--project-name' ,
271+ projectName ,
272+ '--name' ,
273+ agentName ,
274+ '--defaults' ,
275+ '--framework' ,
276+ 'Strands' ,
277+ '--dry-run' ,
278+ '--json' ,
279+ ] ,
280+ testDir
281+ ) ;
282+
283+ expect ( result . exitCode ) . toBe ( 0 ) ;
284+ const json = JSON . parse ( result . stdout ) ;
285+ expect ( json . projectPath ) . toMatch ( new RegExp ( `/${ projectName } $` ) ) ;
286+ expect ( json . wouldCreate ) . toContain ( `${ json . projectPath } /app/${ agentName } /` ) ;
287+ expect ( await exists ( join ( testDir , projectName ) ) , 'Should not create directory' ) . toBe ( false ) ;
288+ } ) ;
172289 } ) ;
173290
174291 describe ( '--skip-git' , ( ) => {
0 commit comments