Skip to content
Closed

closed #1643

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions integ-tests/create-edge-cases.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,11 @@ describe.skipIf(!prereqs.npm || !prereqs.git)('integration: create edge cases',
expect(json.success).toBe(true);
expect(json.projectPath).toBeTruthy();

// No agent-path flags -> create defaults to the harness path.
// --defaults is an agent-path flag -> routes to the agent creation path.
telemetry.assertMetricEmitted({
command: 'create',
exit_reason: 'success',
agent_environment: 'harness',
model_provider: 'bedrock',
agent_environment: 'runtime',
has_agent: 'true',
});
});
Expand Down
5 changes: 3 additions & 2 deletions src/cli/commands/create/__tests__/create.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

const json = JSON.parse(result.stdout);
expect(json.success).toBe(true);
expect(json.projectPath).toMatch(new RegExp(`/${projectName}$`));

Check warning on line 50 in src/cli/commands/create/__tests__/create.test.ts

View workflow job for this annotation

GitHub Actions / lint

Found non-literal argument to RegExp Constructor

Check warning on line 50 in src/cli/commands/create/__tests__/create.test.ts

View workflow job for this annotation

GitHub Actions / lint

Found non-literal argument to RegExp Constructor
expect(await exists(join(json.projectPath, 'agentcore'))).toBeTruthy();
});
});
Expand Down Expand Up @@ -192,7 +192,7 @@

const json = JSON.parse(result.stdout);
expect(json.success).toBe(true);
expect(json.projectPath).toMatch(new RegExp(`/${projectName}$`));

Check warning on line 195 in src/cli/commands/create/__tests__/create.test.ts

View workflow job for this annotation

GitHub Actions / lint

Found non-literal argument to RegExp Constructor

Check warning on line 195 in src/cli/commands/create/__tests__/create.test.ts

View workflow job for this annotation

GitHub Actions / lint

Found non-literal argument to RegExp Constructor
expect(json.agentName).toBe(agentName);
expect(await exists(join(json.projectPath, 'app', agentName))).toBeTruthy();

Expand Down Expand Up @@ -230,7 +230,7 @@

const json = JSON.parse(result.stdout);
expect(json.success).toBe(true);
expect(json.projectPath).toMatch(new RegExp(`/${projectName}$`));

Check warning on line 233 in src/cli/commands/create/__tests__/create.test.ts

View workflow job for this annotation

GitHub Actions / lint

Found non-literal argument to RegExp Constructor

Check warning on line 233 in src/cli/commands/create/__tests__/create.test.ts

View workflow job for this annotation

GitHub Actions / lint

Found non-literal argument to RegExp Constructor
expect(json.agentName).toBe(agentName);
expect(await exists(join(json.projectPath, 'app', agentName))).toBeTruthy();

Expand All @@ -241,14 +241,15 @@
});

describe('--defaults', () => {
it('creates project with defaults', async () => {
it('creates project with defaults via agent path', async () => {
const name = `Defaults${Date.now()}`;
const result = await runCLI(['create', '--name', name, '--defaults', '--json'], testDir);

expect(result.exitCode, `stderr: ${result.stderr}`).toBe(0);
const json = JSON.parse(result.stdout);
expect(json.success).toBe(true);
expect(await exists(join(testDir, name))).toBeTruthy();
expect(json.agentName).toBe(name);
expect(await exists(join(json.projectPath, 'app', name))).toBeTruthy();
});
});

Expand All @@ -272,7 +273,7 @@

expect(result.exitCode).toBe(0);
const json = JSON.parse(result.stdout);
expect(json.projectPath).toMatch(new RegExp(`/${projectName}$`));

Check warning on line 276 in src/cli/commands/create/__tests__/create.test.ts

View workflow job for this annotation

GitHub Actions / lint

Found non-literal argument to RegExp Constructor

Check warning on line 276 in src/cli/commands/create/__tests__/create.test.ts

View workflow job for this annotation

GitHub Actions / lint

Found non-literal argument to RegExp Constructor
expect(json.wouldCreate).toContain(`${json.projectPath}/app/${agentName}/`);
expect(await exists(join(testDir, projectName)), 'Should not create directory').toBe(false);
});
Expand Down
1 change: 1 addition & 0 deletions src/cli/commands/create/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function printCreateSummary(
* agent-only concept — harnesses use --memory-mode/--no-memory — so it routes to the agent path
* (and conflicts with harness-only flags) rather than being silently ignored on the harness path. */
const AGENT_PATH_FLAGS = [
'defaults',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix is correct. See review body for a test-coverage suggestion to lock this in — the existing --defaults integration test passes on both the agent and harness paths, so it wouldn't have caught this regression.

'framework',
'language',
'build',
Expand Down
Loading