Skip to content

Commit 20539ae

Browse files
committed
Revert "feat: add VPC CLI flags to create and add commands [2/3] (#425)"
This reverts commit c75f4cd.
1 parent ca5644f commit 20539ae

File tree

14 files changed

+6
-288
lines changed

14 files changed

+6
-288
lines changed

src/cli/commands/add/__tests__/validate.test.ts

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -162,52 +162,6 @@ describe('validate', () => {
162162
expect(validateAddAgentOptions(validAgentOptionsByo)).toEqual({ valid: true });
163163
expect(validateAddAgentOptions(validAgentOptionsCreate)).toEqual({ valid: true });
164164
});
165-
166-
// VPC validation tests
167-
it('rejects invalid network mode', () => {
168-
const result = validateAddAgentOptions({ ...validAgentOptionsCreate, networkMode: 'INVALID' as any });
169-
expect(result.valid).toBe(false);
170-
expect(result.error).toContain('Invalid network mode');
171-
});
172-
173-
it('rejects VPC mode without subnets', () => {
174-
const result = validateAddAgentOptions({
175-
...validAgentOptionsCreate,
176-
networkMode: 'VPC',
177-
securityGroups: 'sg-12345678',
178-
});
179-
expect(result.valid).toBe(false);
180-
expect(result.error).toContain('--subnets is required');
181-
});
182-
183-
it('rejects VPC mode without security groups', () => {
184-
const result = validateAddAgentOptions({
185-
...validAgentOptionsCreate,
186-
networkMode: 'VPC',
187-
subnets: 'subnet-12345678',
188-
});
189-
expect(result.valid).toBe(false);
190-
expect(result.error).toContain('--security-groups is required');
191-
});
192-
193-
it('rejects subnets without VPC mode', () => {
194-
const result = validateAddAgentOptions({
195-
...validAgentOptionsCreate,
196-
subnets: 'subnet-12345678',
197-
});
198-
expect(result.valid).toBe(false);
199-
expect(result.error).toContain('require --network-mode VPC');
200-
});
201-
202-
it('passes for valid VPC options', () => {
203-
const result = validateAddAgentOptions({
204-
...validAgentOptionsCreate,
205-
networkMode: 'VPC',
206-
subnets: 'subnet-12345678',
207-
securityGroups: 'sg-12345678',
208-
});
209-
expect(result.valid).toBe(true);
210-
});
211165
});
212166

213167
describe('validateAddGatewayOptions', () => {

src/cli/commands/add/actions.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {
77
GatewayAuthorizerType,
88
MemoryStrategyType,
99
ModelProvider,
10-
NetworkMode,
1110
SDKFramework,
1211
TargetLanguage,
1312
} from '../../../schema';
@@ -30,7 +29,6 @@ import { createRenderer } from '../../templates';
3029
import type { MemoryOption } from '../../tui/screens/generate/types';
3130
import type { AddGatewayConfig, AddMcpToolConfig } from '../../tui/screens/mcp/types';
3231
import { DEFAULT_EVENT_EXPIRY } from '../../tui/screens/memory/types';
33-
import { parseCommaSeparatedList } from '../shared/vpc-utils';
3432
import type { AddAgentResult, AddGatewayResult, AddIdentityResult, AddMcpToolResult, AddMemoryResult } from './types';
3533
import { mkdirSync } from 'fs';
3634
import { dirname, join } from 'path';
@@ -45,9 +43,6 @@ export interface ValidatedAddAgentOptions {
4543
modelProvider: ModelProvider;
4644
apiKey?: string;
4745
memory?: MemoryOption;
48-
networkMode?: NetworkMode;
49-
subnets?: string;
50-
securityGroups?: string;
5146
codeLocation?: string;
5247
entrypoint?: string;
5348
}
@@ -125,9 +120,6 @@ async function handleCreatePath(options: ValidatedAddAgentOptions, configBaseDir
125120
modelProvider: options.modelProvider,
126121
memory: options.memory!,
127122
language: options.language,
128-
networkMode: options.networkMode,
129-
subnets: parseCommaSeparatedList(options.subnets),
130-
securityGroups: parseCommaSeparatedList(options.securityGroups),
131123
};
132124

133125
const agentPath = join(projectRoot, APP_DIR, options.name);
@@ -194,23 +186,14 @@ async function handleByoPath(
194186

195187
const project = await configIO.readProjectSpec();
196188

197-
const networkMode = options.networkMode ?? 'PUBLIC';
198189
const agent: AgentEnvSpec = {
199190
type: 'AgentCoreRuntime',
200191
name: options.name,
201192
build: options.buildType,
202193
entrypoint: (options.entrypoint ?? 'main.py') as FilePath,
203194
codeLocation: codeLocation as DirectoryPath,
204195
runtimeVersion: 'PYTHON_3_12',
205-
networkMode,
206-
...(networkMode === 'VPC' && options.subnets && options.securityGroups
207-
? {
208-
networkConfig: {
209-
subnets: parseCommaSeparatedList(options.subnets)!,
210-
securityGroups: parseCommaSeparatedList(options.securityGroups)!,
211-
},
212-
}
213-
: {}),
196+
networkMode: 'PUBLIC',
214197
};
215198

216199
project.agents.push(agent);

src/cli/commands/add/command.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ async function handleAddAgentCLI(options: AddAgentOptions): Promise<void> {
4040
modelProvider: options.modelProvider!,
4141
apiKey: options.apiKey,
4242
memory: options.memory,
43-
networkMode: options.networkMode,
44-
subnets: options.subnets,
45-
securityGroups: options.securityGroups,
4643
codeLocation: options.codeLocation,
4744
entrypoint: options.entrypoint,
4845
});
@@ -230,9 +227,6 @@ export function registerAdd(program: Command) {
230227
.option('--model-provider <provider>', 'Model provider: Bedrock, Anthropic, OpenAI, Gemini [non-interactive]')
231228
.option('--api-key <key>', 'API key for non-Bedrock providers [non-interactive]')
232229
.option('--memory <mem>', 'Memory: none, shortTerm, longAndShortTerm (create path only) [non-interactive]')
233-
.option('--network-mode <mode>', 'Network mode: PUBLIC or VPC (default: PUBLIC) [non-interactive]')
234-
.option('--subnets <ids>', 'Comma-separated subnet IDs (required for VPC mode) [non-interactive]')
235-
.option('--security-groups <ids>', 'Comma-separated security group IDs (required for VPC mode) [non-interactive]')
236230
.option('--code-location <path>', 'Path to existing code (BYO path only) [non-interactive]')
237231
.option('--entrypoint <file>', 'Entry file relative to code-location (BYO, default: main.py) [non-interactive]')
238232
.option('--json', 'Output as JSON [non-interactive]')

src/cli/commands/add/types.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { GatewayAuthorizerType, ModelProvider, NetworkMode, SDKFramework, TargetLanguage } from '../../../schema';
1+
import type { GatewayAuthorizerType, ModelProvider, SDKFramework, TargetLanguage } from '../../../schema';
22
import type { MemoryOption } from '../../tui/screens/generate/types';
33

44
// Agent types
@@ -11,9 +11,6 @@ export interface AddAgentOptions {
1111
modelProvider?: ModelProvider;
1212
apiKey?: string;
1313
memory?: MemoryOption;
14-
networkMode?: NetworkMode;
15-
subnets?: string;
16-
securityGroups?: string;
1714
codeLocation?: string;
1815
entrypoint?: string;
1916
json?: boolean;

src/cli/commands/add/validate.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
TargetLanguageSchema,
88
getSupportedModelProviders,
99
} from '../../../schema';
10-
import { validateVpcOptions } from '../shared/vpc-utils';
1110
import type {
1211
AddAgentOptions,
1312
AddGatewayOptions,
@@ -103,9 +102,6 @@ export function validateAddAgentOptions(options: AddAgentOptions): ValidationRes
103102
}
104103
}
105104

106-
const vpcResult = validateVpcOptions(options);
107-
if (!vpcResult.valid) return vpcResult;
108-
109105
return { valid: true };
110106
}
111107

src/cli/commands/create/__tests__/validate.test.ts

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -132,90 +132,6 @@ describe('validateCreateOptions', () => {
132132
expect(result.valid).toBe(true);
133133
});
134134

135-
// VPC validation tests
136-
it('rejects invalid network mode', () => {
137-
const result = validateCreateOptions(
138-
{
139-
name: 'VpcTest1',
140-
language: 'Python',
141-
framework: 'Strands',
142-
modelProvider: 'Bedrock',
143-
memory: 'none',
144-
networkMode: 'INVALID',
145-
},
146-
testDir
147-
);
148-
expect(result.valid).toBe(false);
149-
expect(result.error).toContain('Invalid network mode');
150-
});
151-
152-
it('rejects VPC mode without subnets', () => {
153-
const result = validateCreateOptions(
154-
{
155-
name: 'VpcTest2',
156-
language: 'Python',
157-
framework: 'Strands',
158-
modelProvider: 'Bedrock',
159-
memory: 'none',
160-
networkMode: 'VPC',
161-
securityGroups: 'sg-12345678',
162-
},
163-
testDir
164-
);
165-
expect(result.valid).toBe(false);
166-
expect(result.error).toContain('--subnets is required');
167-
});
168-
169-
it('rejects VPC mode without security groups', () => {
170-
const result = validateCreateOptions(
171-
{
172-
name: 'VpcTest3',
173-
language: 'Python',
174-
framework: 'Strands',
175-
modelProvider: 'Bedrock',
176-
memory: 'none',
177-
networkMode: 'VPC',
178-
subnets: 'subnet-12345678',
179-
},
180-
testDir
181-
);
182-
expect(result.valid).toBe(false);
183-
expect(result.error).toContain('--security-groups is required');
184-
});
185-
186-
it('rejects subnets without VPC mode', () => {
187-
const result = validateCreateOptions(
188-
{
189-
name: 'VpcTest4',
190-
language: 'Python',
191-
framework: 'Strands',
192-
modelProvider: 'Bedrock',
193-
memory: 'none',
194-
subnets: 'subnet-12345678',
195-
},
196-
testDir
197-
);
198-
expect(result.valid).toBe(false);
199-
expect(result.error).toContain('require --network-mode VPC');
200-
});
201-
202-
it('returns valid with VPC mode and required options', () => {
203-
const result = validateCreateOptions(
204-
{
205-
name: 'VpcTest5',
206-
language: 'Python',
207-
framework: 'Strands',
208-
modelProvider: 'Bedrock',
209-
memory: 'none',
210-
networkMode: 'VPC',
211-
subnets: 'subnet-12345678',
212-
securityGroups: 'sg-12345678',
213-
},
214-
testDir
215-
);
216-
expect(result.valid).toBe(true);
217-
});
218-
219135
it('returns invalid for unsupported framework/model combination', () => {
220136
// GoogleADK only supports certain providers, not all
221137
const result = validateCreateOptions(

src/cli/commands/create/action.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type {
44
BuildType,
55
DeployedState,
66
ModelProvider,
7-
NetworkMode,
87
SDKFramework,
98
TargetLanguage,
109
} from '../../../schema';
@@ -121,9 +120,6 @@ export interface CreateWithAgentOptions {
121120
modelProvider: ModelProvider;
122121
apiKey?: string;
123122
memory: MemoryOption;
124-
networkMode?: NetworkMode;
125-
subnets?: string[];
126-
securityGroups?: string[];
127123
skipGit?: boolean;
128124
skipPythonSetup?: boolean;
129125
onProgress?: ProgressCallback;
@@ -139,9 +135,6 @@ export async function createProjectWithAgent(options: CreateWithAgentOptions): P
139135
modelProvider,
140136
apiKey,
141137
memory,
142-
networkMode,
143-
subnets,
144-
securityGroups,
145138
skipGit,
146139
skipPythonSetup,
147140
onProgress,
@@ -179,9 +172,6 @@ export async function createProjectWithAgent(options: CreateWithAgentOptions): P
179172
apiKey,
180173
memory,
181174
language,
182-
networkMode,
183-
subnets,
184-
securityGroups,
185175
};
186176

187177
// Resolve credential strategy FIRST (new project has no existing credentials)

src/cli/commands/create/command.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { getWorkingDirectory } from '../../../lib';
2-
import type { BuildType, ModelProvider, NetworkMode, SDKFramework, TargetLanguage } from '../../../schema';
2+
import type { BuildType, ModelProvider, SDKFramework, TargetLanguage } from '../../../schema';
33
import { getErrorMessage } from '../../errors';
44
import { COMMAND_DESCRIPTIONS } from '../../tui/copy';
55
import { CreateScreen } from '../../tui/screens/create';
6-
import { parseCommaSeparatedList } from '../shared/vpc-utils';
76
import { type ProgressCallback, createProject, createProjectWithAgent, getDryRunInfo } from './action';
87
import type { CreateOptions } from './types';
98
import { validateCreateOptions } from './validate';
@@ -121,9 +120,6 @@ async function handleCreateCLI(options: CreateOptions): Promise<void> {
121120
modelProvider: options.modelProvider as ModelProvider,
122121
apiKey: options.apiKey,
123122
memory: options.memory as 'none' | 'shortTerm' | 'longAndShortTerm',
124-
networkMode: options.networkMode as NetworkMode | undefined,
125-
subnets: parseCommaSeparatedList(options.subnets),
126-
securityGroups: parseCommaSeparatedList(options.securityGroups),
127123
skipGit: options.skipGit,
128124
skipPythonSetup: options.skipPythonSetup,
129125
onProgress,
@@ -156,9 +152,6 @@ export const registerCreate = (program: Command) => {
156152
.option('--model-provider <provider>', 'Model provider (Bedrock, Anthropic, OpenAI, Gemini) [non-interactive]')
157153
.option('--api-key <key>', 'API key for non-Bedrock providers [non-interactive]')
158154
.option('--memory <option>', 'Memory option (none, shortTerm, longAndShortTerm) [non-interactive]')
159-
.option('--network-mode <mode>', 'Network mode: PUBLIC or VPC (default: PUBLIC) [non-interactive]')
160-
.option('--subnets <ids>', 'Comma-separated subnet IDs (required for VPC mode) [non-interactive]')
161-
.option('--security-groups <ids>', 'Comma-separated security group IDs (required for VPC mode) [non-interactive]')
162155
.option('--output-dir <dir>', 'Output directory (default: current directory) [non-interactive]')
163156
.option('--skip-git', 'Skip git repository initialization [non-interactive]')
164157
.option('--skip-python-setup', 'Skip Python virtual environment setup [non-interactive]')
@@ -186,9 +179,6 @@ export const registerCreate = (program: Command) => {
186179
options.modelProvider ??
187180
options.apiKey ??
188181
options.memory ??
189-
options.networkMode ??
190-
options.subnets ??
191-
options.securityGroups ??
192182
options.outputDir ??
193183
options.skipGit ??
194184
options.skipPythonSetup ??

src/cli/commands/create/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ export interface CreateOptions {
88
modelProvider?: string;
99
apiKey?: string;
1010
memory?: string;
11-
networkMode?: string;
12-
subnets?: string;
13-
securityGroups?: string;
1411
outputDir?: string;
1512
skipGit?: boolean;
1613
skipPythonSetup?: boolean;

src/cli/commands/create/validate.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
TargetLanguageSchema,
77
getSupportedModelProviders,
88
} from '../../../schema';
9-
import { validateVpcOptions } from '../shared/vpc-utils';
109
import type { CreateOptions } from './types';
1110
import { existsSync } from 'fs';
1211
import { join } from 'path';
@@ -122,8 +121,5 @@ export function validateCreateOptions(options: CreateOptions, cwd?: string): Val
122121
}
123122
}
124123

125-
const vpcResult = validateVpcOptions(options);
126-
if (!vpcResult.valid) return vpcResult;
127-
128124
return { valid: true };
129125
}

0 commit comments

Comments
 (0)