Skip to content

Commit 8a57402

Browse files
committed
fix(dev): read runtimes from Project.spec after #2004
1 parent 6118781 commit 8a57402

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/handlers/project/dev/index.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ function runtime(name = "orders", build: ProjectRuntime["build"] = "CodeZip"): P
2222
}
2323

2424
function project(...runtimes: ProjectRuntime[]): Project {
25-
return { name: "test-project", rootPath: "/workspace/project", managedBy: "CDK", runtimes };
25+
return {
26+
name: "test-project",
27+
rootPath: "/workspace/project",
28+
spec: { runtimes } as Project["spec"],
29+
};
2630
}
2731

2832
function captureRunner(events: DevEvent[] = []) {

src/handlers/project/dev/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ export type DevProjectHandlerConfig = {
2222
};
2323

2424
function selectRuntime(project: Project, name?: string): ProjectRuntime {
25-
if (project.runtimes.length === 0) {
25+
if (project.spec.runtimes.length === 0) {
2626
throw new InputValidationError(
2727
"This project has no runtimes. Add a runtime to agentcore/agentcore.json and retry.",
2828
);
2929
}
30-
const available = project.runtimes.map(({ name }) => name).join(", ");
30+
const available = project.spec.runtimes.map(({ name }) => name).join(", ");
3131

3232
if (name) {
33-
const runtime = project.runtimes.find((candidate) => candidate.name === name);
33+
const runtime = project.spec.runtimes.find((candidate) => candidate.name === name);
3434
if (runtime) return runtime;
3535
throw new ResourceNotFoundError(
3636
`Runtime '${name}' was not found. Available runtimes: ${available}.`,
3737
);
3838
}
3939

40-
if (project.runtimes.length === 1) return project.runtimes[0]!;
40+
if (project.spec.runtimes.length === 1) return project.spec.runtimes[0]!;
4141
throw new InputValidationError(
4242
`Multiple runtimes found. Use --agent to select one. Available runtimes: ${available}.`,
4343
);

0 commit comments

Comments
 (0)