Skip to content

Commit 7555d3f

Browse files
committed
cp dines
1 parent fd82a24 commit 7555d3f

6 files changed

Lines changed: 29 additions & 30 deletions

File tree

src/cli.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,8 @@ blueprint
389389
});
390390

391391
blueprint
392-
.command("create")
392+
.command("create <name>")
393393
.description("Create a new blueprint")
394-
.option("--name <name>", "Blueprint name")
395394
.option("--dockerfile <content>", "Dockerfile contents")
396395
.option("--dockerfile-path <path>", "Dockerfile path")
397396
.option("--system-setup-commands <commands...>", "System setup commands")
@@ -404,9 +403,9 @@ blueprint
404403
"-o, --output [format]",
405404
"Output format: text|json|yaml (default: interactive)",
406405
)
407-
.action(async (options) => {
406+
.action(async (name, options) => {
408407
const { createBlueprint } = await import("./commands/blueprint/create.js");
409-
await createBlueprint(options);
408+
await createBlueprint({ name, ...options });
410409
});
411410

412411
blueprint

src/commands/blueprint/create.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ interface CreateBlueprintOptions {
1717
systemSetupCommands?: string[];
1818
resources?: string;
1919
architecture?: string;
20-
availablePorts?: number[];
20+
availablePorts?: string[];
2121
root?: boolean;
2222
user?: string;
23-
outputFormat?: string;
23+
output?: string;
2424
}
2525

2626
const CreateBlueprintUI: React.FC<{
@@ -30,7 +30,7 @@ const CreateBlueprintUI: React.FC<{
3030
systemSetupCommands?: string[];
3131
resources?: string;
3232
architecture?: string;
33-
availablePorts?: number[];
33+
availablePorts?: string[];
3434
root?: boolean;
3535
user?: string;
3636
}> = ({
@@ -80,7 +80,7 @@ const CreateBlueprintUI: React.FC<{
8080
launch_parameters: {
8181
resource_size_request: resources as any,
8282
architecture: architecture as any,
83-
available_ports: availablePorts,
83+
available_ports: availablePorts?.map(port => parseInt(port, 10)) as any,
8484
user_parameters: userParameters,
8585
},
8686
});
@@ -114,7 +114,7 @@ const CreateBlueprintUI: React.FC<{
114114
};
115115

116116
export async function createBlueprint(options: CreateBlueprintOptions) {
117-
const executor = createExecutor({ output: options.outputFormat });
117+
const executor = createExecutor({ output: options.output });
118118

119119
await executor.executeAction(
120120
async () => {
@@ -147,7 +147,7 @@ export async function createBlueprint(options: CreateBlueprintOptions) {
147147
launch_parameters: {
148148
resource_size_request: options.resources as any,
149149
architecture: options.architecture as any,
150-
available_ports: options.availablePorts,
150+
available_ports: options.availablePorts?.map(port => parseInt(port, 10)) as any,
151151
user_parameters: userParameters,
152152
},
153153
});

src/commands/blueprint/get.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { colors } from "../../utils/theme.js";
1111

1212
interface GetBlueprintOptions {
1313
id: string;
14-
outputFormat?: string;
14+
output?: string;
1515
}
1616

1717
const GetBlueprintUI: React.FC<{
@@ -55,7 +55,7 @@ const GetBlueprintUI: React.FC<{
5555
};
5656

5757
export async function getBlueprint(options: GetBlueprintOptions) {
58-
const executor = createExecutor({ output: options.outputFormat });
58+
const executor = createExecutor({ output: options.output });
5959

6060
await executor.executeAction(
6161
async () => {

src/commands/blueprint/logs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { colors } from "../../utils/theme.js";
1111

1212
interface BlueprintLogsOptions {
1313
id: string;
14-
outputFormat?: string;
14+
output?: string;
1515
}
1616

1717
const BlueprintLogsUI: React.FC<{
@@ -67,7 +67,7 @@ const BlueprintLogsUI: React.FC<{
6767
};
6868

6969
export async function getBlueprintLogs(options: BlueprintLogsOptions) {
70-
const executor = createExecutor({ output: options.outputFormat });
70+
const executor = createExecutor({ output: options.output });
7171

7272
await executor.executeAction(
7373
async () => {

src/commands/blueprint/preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface PreviewBlueprintOptions {
1313
name: string;
1414
dockerfile?: string;
1515
systemSetupCommands?: string[];
16-
outputFormat?: string;
16+
output?: string;
1717
}
1818

1919
const PreviewBlueprintUI: React.FC<{
@@ -63,7 +63,7 @@ const PreviewBlueprintUI: React.FC<{
6363
};
6464

6565
export async function previewBlueprint(options: PreviewBlueprintOptions) {
66-
const executor = createExecutor({ output: options.outputFormat });
66+
const executor = createExecutor({ output: options.output });
6767

6868
await executor.executeAction(
6969
async () => {

tests/__tests__/integration/blueprint.e2e.test.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('Blueprint E2E Tests', () => {
2323
let blueprintId: string;
2424

2525
it('should create a blueprint', async () => {
26-
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint --dockerfile "FROM ubuntu:20.04" --system-setup-commands "apt update" --resources SMALL');
26+
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint --dockerfile "FROM ubuntu:20.04" --system-setup-commands "apt update" --resources SMALL --output json');
2727

2828
// Extract blueprint ID from output
2929
const match = stdout.match(/"id":\s*"([^"]+)"/);
@@ -35,22 +35,22 @@ describe('Blueprint E2E Tests', () => {
3535
it('should get blueprint details', async () => {
3636
expect(blueprintId).toBeDefined();
3737

38-
const { stdout } = await execAsync(`node dist/cli.js blueprint get ${blueprintId}`);
38+
const { stdout } = await execAsync(`node dist/cli.js blueprint get ${blueprintId} --output json`);
3939

40-
expect(stdout).toContain('blueprint=');
40+
expect(stdout).toContain('"id":');
4141
expect(stdout).toContain(blueprintId);
4242
}, 30000);
4343

4444
it('should list blueprints', async () => {
45-
const { stdout } = await execAsync('node dist/cli.js blueprint list');
45+
const { stdout } = await execAsync('node dist/cli.js blueprint list --output json');
4646

47-
expect(stdout).toContain('blueprint=');
47+
expect(stdout).toContain('"id":');
4848
}, 30000);
4949

5050
it('should preview blueprint', async () => {
51-
const { stdout } = await execAsync('node dist/cli.js blueprint preview test-blueprint-preview --dockerfile "FROM ubuntu:20.04" --resources SMALL');
51+
const { stdout } = await execAsync('node dist/cli.js blueprint preview test-blueprint-preview --dockerfile "FROM ubuntu:20.04" --resources SMALL --output json');
5252

53-
expect(stdout).toContain('preview=');
53+
expect(stdout).toContain('"dockerfile":');
5454
}, 30000);
5555
});
5656

@@ -82,7 +82,7 @@ describe('Blueprint E2E Tests', () => {
8282
});
8383

8484
it('should create blueprint with dockerfile file', async () => {
85-
const { stdout } = await execAsync(`node dist/cli.js blueprint create test-blueprint-file --dockerfile-path ${dockerfilePath} --resources SMALL`);
85+
const { stdout } = await execAsync(`node dist/cli.js blueprint create test-blueprint-file --dockerfile-path ${dockerfilePath} --resources SMALL --output json`);
8686

8787
// Extract blueprint ID from output
8888
const match = stdout.match(/"id":\s*"([^"]+)"/);
@@ -96,7 +96,7 @@ describe('Blueprint E2E Tests', () => {
9696
let blueprintId: string;
9797

9898
it('should create blueprint with root user', async () => {
99-
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint-root --dockerfile "FROM ubuntu:20.04" --root --resources SMALL');
99+
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint-root --dockerfile "FROM ubuntu:20.04" --root --resources SMALL --output json');
100100

101101
// Extract blueprint ID from output
102102
const match = stdout.match(/"id":\s*"([^"]+)"/);
@@ -106,7 +106,7 @@ describe('Blueprint E2E Tests', () => {
106106
}, 60000);
107107

108108
it('should create blueprint with custom user', async () => {
109-
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint-user --dockerfile "FROM ubuntu:20.04" --user testuser:1000 --resources SMALL');
109+
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint-user --dockerfile "FROM ubuntu:20.04" --user testuser:1000 --resources SMALL --output json');
110110

111111
// Extract blueprint ID from output
112112
const match = stdout.match(/"id":\s*"([^"]+)"/);
@@ -119,7 +119,7 @@ describe('Blueprint E2E Tests', () => {
119119
let blueprintId: string;
120120

121121
it('should create blueprint with architecture and ports', async () => {
122-
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint-advanced --dockerfile "FROM ubuntu:20.04" --architecture arm64 --available-ports 3000,8080 --resources MEDIUM');
122+
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint-advanced --dockerfile "FROM ubuntu:20.04" --architecture arm64 --available-ports 3000,8080 --resources MEDIUM --output json');
123123

124124
// Extract blueprint ID from output
125125
const match = stdout.match(/"id":\s*"([^"]+)"/);
@@ -136,7 +136,7 @@ describe('Blueprint E2E Tests', () => {
136136
if (!apiKey) return;
137137

138138
// Create a blueprint for logs
139-
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint-logs --dockerfile "FROM ubuntu:20.04" --system-setup-commands "apt update" --resources SMALL');
139+
const { stdout } = await execAsync('node dist/cli.js blueprint create test-blueprint-logs --dockerfile "FROM ubuntu:20.04" --system-setup-commands "apt update" --resources SMALL --output json');
140140
const match = stdout.match(/"id":\s*"([^"]+)"/);
141141
if (match) {
142142
blueprintId = match[1];
@@ -148,9 +148,9 @@ describe('Blueprint E2E Tests', () => {
148148
pending('Blueprint not created');
149149
}
150150

151-
const { stdout } = await execAsync(`node dist/cli.js blueprint logs ${blueprintId}`);
151+
const { stdout } = await execAsync(`node dist/cli.js blueprint logs ${blueprintId} --output json`);
152152

153-
expect(stdout).toContain('logs=');
153+
expect(stdout).toContain('"logs":');
154154
}, 30000);
155155
});
156156
});

0 commit comments

Comments
 (0)