Skip to content

Commit 380ac6e

Browse files
feat(create): add --skip-install flag to skip dependency installation (#782)
Adds a --skip-install flag to `agentcore create` that skips all dependency installation (npm install for CDK and uv sync for Python). This enables enterprise users behind corporate proxies or private registries to modify package.json/pyproject.toml before installing dependencies manually. The flag sets the existing AGENTCORE_SKIP_INSTALL env var (previously only used in tests) and also implies --skip-python-setup behavior. A post-create message instructs users to install manually.
1 parent 0aa9d55 commit 380ac6e

3 files changed

Lines changed: 26 additions & 4 deletions

File tree

src/cli/commands/create/action.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,17 @@ export interface CreateProjectOptions {
3434
name: string;
3535
cwd: string;
3636
skipGit?: boolean;
37+
skipInstall?: boolean;
3738
skipDependencyCheck?: boolean;
3839
onProgress?: ProgressCallback;
3940
}
4041

4142
export async function createProject(options: CreateProjectOptions): Promise<CreateResult> {
42-
const { name, cwd, skipGit, skipDependencyCheck, onProgress } = options;
43+
const { name, cwd, skipGit, skipInstall, skipDependencyCheck, onProgress } = options;
44+
45+
if (skipInstall) {
46+
process.env.AGENTCORE_SKIP_INSTALL = '1';
47+
}
4348
const projectRoot = join(cwd, name);
4449
const configBaseDir = join(projectRoot, CONFIG_DIR);
4550

@@ -125,6 +130,7 @@ export interface CreateWithAgentOptions {
125130
idleTimeout?: number;
126131
maxLifetime?: number;
127132
skipGit?: boolean;
133+
skipInstall?: boolean;
128134
skipPythonSetup?: boolean;
129135
onProgress?: ProgressCallback;
130136
}
@@ -147,6 +153,7 @@ export async function createProjectWithAgent(options: CreateWithAgentOptions): P
147153
idleTimeout,
148154
maxLifetime: maxLifetimeOpt,
149155
skipGit,
156+
skipInstall,
150157
skipPythonSetup,
151158
onProgress,
152159
} = options;
@@ -163,7 +170,7 @@ export async function createProjectWithAgent(options: CreateWithAgentOptions): P
163170
}
164171

165172
// First create the base project (skip dependency check since we already did it)
166-
const projectResult = await createProject({ name, cwd, skipGit, skipDependencyCheck: true, onProgress });
173+
const projectResult = await createProject({ name, cwd, skipGit, skipInstall, skipDependencyCheck: true, onProgress });
167174
if (!projectResult.success) {
168175
// Merge warnings from both checks
169176
const allWarnings = [...depWarnings, ...(projectResult.warnings ?? [])];
@@ -267,7 +274,7 @@ export async function createProjectWithAgent(options: CreateWithAgentOptions): P
267274
onProgress?.('Add agent to project', 'done');
268275

269276
// Set up Python environment if needed (unless skipped)
270-
if (language === 'Python' && !skipPythonSetup) {
277+
if (language === 'Python' && !skipPythonSetup && !skipInstall) {
271278
onProgress?.('Set up Python environment', 'start');
272279
const agentDir = join(projectRoot, APP_DIR, name);
273280
await setupPythonProject({ projectDir: agentDir });

src/cli/commands/create/command.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@ async function handleCreateCLI(options: CreateOptions): Promise<void> {
119119
const skipAgent = options.agent === false;
120120

121121
const result = skipAgent
122-
? await createProject({ name: options.name!, cwd, skipGit: options.skipGit, onProgress })
122+
? await createProject({
123+
name: options.name!,
124+
cwd,
125+
skipGit: options.skipGit,
126+
skipInstall: options.skipInstall,
127+
onProgress,
128+
})
123129
: await createProjectWithAgent({
124130
name: options.name!,
125131
cwd,
@@ -140,6 +146,7 @@ async function handleCreateCLI(options: CreateOptions): Promise<void> {
140146
idleTimeout: options.idleTimeout ? Number(options.idleTimeout) : undefined,
141147
maxLifetime: options.maxLifetime ? Number(options.maxLifetime) : undefined,
142148
skipGit: options.skipGit,
149+
skipInstall: options.skipInstall,
143150
skipPythonSetup: options.skipPythonSetup,
144151
onProgress,
145152
});
@@ -148,6 +155,11 @@ async function handleCreateCLI(options: CreateOptions): Promise<void> {
148155
console.log(JSON.stringify(result));
149156
} else if (result.success) {
150157
printCreateSummary(options.name!, result.agentName, options.language, options.framework);
158+
if (options.skipInstall) {
159+
console.log(
160+
"\nDependency installation was skipped. Run 'npm install' in agentcore/cdk/ and 'uv sync' in your agent directory manually."
161+
);
162+
}
151163
} else {
152164
console.error(result.error);
153165
}
@@ -190,6 +202,7 @@ export const registerCreate = (program: Command) => {
190202
.option('--output-dir <dir>', 'Output directory (default: current directory) [non-interactive]')
191203
.option('--skip-git', 'Skip git repository initialization [non-interactive]')
192204
.option('--skip-python-setup', 'Skip Python virtual environment setup [non-interactive]')
205+
.option('--skip-install', 'Skip all dependency installation (npm install, uv sync) [non-interactive]')
193206
.option('--dry-run', 'Preview what would be created without making changes [non-interactive]')
194207
.option('--json', 'Output as JSON [non-interactive]')
195208
.action(async options => {
@@ -217,6 +230,7 @@ export const registerCreate = (program: Command) => {
217230
options.outputDir ??
218231
options.skipGit ??
219232
options.skipPythonSetup ??
233+
options.skipInstall ??
220234
options.dryRun ??
221235
options.json
222236
);

src/cli/commands/create/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface CreateOptions extends VpcOptions {
2020
outputDir?: string;
2121
skipGit?: boolean;
2222
skipPythonSetup?: boolean;
23+
skipInstall?: boolean;
2324
dryRun?: boolean;
2425
json?: boolean;
2526
}

0 commit comments

Comments
 (0)