Skip to content

Commit 46248ff

Browse files
committed
prevent the dev command from asking for user input when not interactive
1 parent 20c547a commit 46248ff

File tree

1 file changed

+32
-29
lines changed
  • packages/cli-v3/src/commands

1 file changed

+32
-29
lines changed

packages/cli-v3/src/commands/dev.ts

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -107,47 +107,50 @@ export function configureDevCommand(program: Command) {
107107
export async function devCommand(options: DevCommandOptions) {
108108
runtimeChecks();
109109

110-
const skipMCPInstall = typeof options.skipMCPInstall === "boolean" && options.skipMCPInstall;
110+
// Only show these install prompts if the user is in a terminal (not in a Coding Agent)
111+
if (process.stdout.isTTY) {
112+
const skipMCPInstall = typeof options.skipMCPInstall === "boolean" && options.skipMCPInstall;
111113

112-
if (!skipMCPInstall) {
113-
const hasSeenMCPInstallPrompt = readConfigHasSeenMCPInstallPrompt();
114+
if (!skipMCPInstall) {
115+
const hasSeenMCPInstallPrompt = readConfigHasSeenMCPInstallPrompt();
114116

115-
if (!hasSeenMCPInstallPrompt) {
116-
const installChoice = await confirm({
117-
message: "Would you like to install the Trigger.dev MCP server?",
118-
initialValue: true,
119-
});
117+
if (!hasSeenMCPInstallPrompt) {
118+
const installChoice = await confirm({
119+
message: "Would you like to install the Trigger.dev MCP server?",
120+
initialValue: true,
121+
});
120122

121-
writeConfigHasSeenMCPInstallPrompt(true);
123+
writeConfigHasSeenMCPInstallPrompt(true);
122124

123-
const skipInstall = isCancel(installChoice) || !installChoice;
125+
const skipInstall = isCancel(installChoice) || !installChoice;
124126

125-
if (!skipInstall) {
126-
log.step("Welcome to the Trigger.dev MCP server install wizard 🧙");
127+
if (!skipInstall) {
128+
log.step("Welcome to the Trigger.dev MCP server install wizard 🧙");
127129

128-
const [installError] = await tryCatch(
129-
installMcpServer({
130-
yolo: false,
131-
tag: VERSION as string,
132-
logLevel: options.logLevel,
133-
})
134-
);
130+
const [installError] = await tryCatch(
131+
installMcpServer({
132+
yolo: false,
133+
tag: VERSION as string,
134+
logLevel: options.logLevel,
135+
})
136+
);
135137

136-
if (installError) {
137-
log.error(`Failed to install MCP server: ${installError.message}`);
138+
if (installError) {
139+
log.error(`Failed to install MCP server: ${installError.message}`);
140+
}
138141
}
139142
}
140143
}
141-
}
142144

143-
const skipRulesInstall =
144-
typeof options.skipRulesInstall === "boolean" && options.skipRulesInstall;
145+
const skipRulesInstall =
146+
typeof options.skipRulesInstall === "boolean" && options.skipRulesInstall;
145147

146-
if (!skipRulesInstall) {
147-
await initiateRulesInstallWizard({
148-
manifestPath: options.rulesInstallManifestPath,
149-
branch: options.rulesInstallBranch,
150-
});
148+
if (!skipRulesInstall) {
149+
await initiateRulesInstallWizard({
150+
manifestPath: options.rulesInstallManifestPath,
151+
branch: options.rulesInstallBranch,
152+
});
153+
}
151154
}
152155

153156
const authorization = await login({

0 commit comments

Comments
 (0)