Skip to content

Commit 409a6f9

Browse files
authored
fix: enforce field requirement for cli cmds (anomalyco#1796)
1 parent 55c294c commit 409a6f9

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

packages/opencode/src/cli/cmd/agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const AgentCreateCommand = cmd({
3939
const query = await prompts.text({
4040
message: "Description",
4141
placeholder: "What should this agent do?",
42-
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
42+
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
4343
})
4444
if (prompts.isCancel(query)) throw new UI.CancelledError()
4545

packages/opencode/src/cli/cmd/auth.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export const AuthLoginCommand = cmd({
139139
if (provider === "other") {
140140
provider = await prompts.text({
141141
message: "Enter provider id",
142-
validate: (x) => x && (x.match(/^[0-9a-z-]+$/) ? undefined : "a-z, 0-9 and hyphens only"),
142+
validate: (x) => (x && x.match(/^[0-9a-z-]+$/) ? undefined : "a-z, 0-9 and hyphens only"),
143143
})
144144
if (prompts.isCancel(provider)) throw new UI.CancelledError()
145145
provider = provider.replace(/^@ai-sdk\//, "")
@@ -193,7 +193,7 @@ export const AuthLoginCommand = cmd({
193193

194194
const code = await prompts.text({
195195
message: "Paste the authorization code here: ",
196-
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
196+
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
197197
})
198198
if (prompts.isCancel(code)) throw new UI.CancelledError()
199199

@@ -229,7 +229,7 @@ export const AuthLoginCommand = cmd({
229229

230230
const code = await prompts.text({
231231
message: "Paste the authorization code here: ",
232-
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
232+
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
233233
})
234234
if (prompts.isCancel(code)) throw new UI.CancelledError()
235235

@@ -302,7 +302,7 @@ export const AuthLoginCommand = cmd({
302302

303303
const key = await prompts.password({
304304
message: "Enter your API key",
305-
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
305+
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
306306
})
307307
if (prompts.isCancel(key)) throw new UI.CancelledError()
308308
await Auth.set(provider, {

packages/opencode/src/cli/cmd/mcp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const McpAddCommand = cmd({
1919

2020
const name = await prompts.text({
2121
message: "Enter MCP server name",
22-
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
22+
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
2323
})
2424
if (prompts.isCancel(name)) throw new UI.CancelledError()
2525

@@ -44,7 +44,7 @@ export const McpAddCommand = cmd({
4444
const command = await prompts.text({
4545
message: "Enter command to run",
4646
placeholder: "e.g., opencode x @modelcontextprotocol/server-filesystem",
47-
validate: (x) => x && (x.length > 0 ? undefined : "Required"),
47+
validate: (x) => (x && x.length > 0 ? undefined : "Required"),
4848
})
4949
if (prompts.isCancel(command)) throw new UI.CancelledError()
5050

0 commit comments

Comments
 (0)