Skip to content

Commit df20249

Browse files
committed
require input prompt for print mode
1 parent a1e678b commit df20249

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

npm-app/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ For all commands and options, run 'codebuff' and then type 'help'.
187187
if (!hasPrompt && !hasParams) {
188188
printModeLog({
189189
type: 'error',
190-
message:
191-
'Error: Print mode requires either a prompt or --params to be set',
190+
message: 'Error: Print mode requires a prompt to be set',
192191
})
193192
process.exit(1)
194193
}

sdk/src/client.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ export class CodebuffClient {
3434

3535
public async runNewChat({
3636
agent,
37-
input: { prompt, params },
37+
prompt,
38+
params,
3839
handleEvent,
3940
}: NewChatOptions): Promise<ChatContext> {
40-
const args = ['-p', '--agent', agent]
41+
const args = [prompt, '-p', '--agent', agent]
4142
if (prompt) {
4243
args.push(prompt)
4344
}
@@ -62,12 +63,13 @@ export class CodebuffClient {
6263
// WIP
6364
private async continueChat({
6465
agent,
65-
input: { prompt, params },
66+
prompt,
67+
params,
6668
context,
6769
handleEvent,
6870
}: ContinueChatOptions): Promise<ChatContext> {
6971
agent = agent ?? context.agentId
70-
const args = ['-p', '--agent', agent]
72+
const args = [prompt, '-p', '--agent', agent]
7173
if (prompt) {
7274
args.push(prompt)
7375
}

sdk/src/types.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,23 @@ export type CodebuffClientOptions = {
66
cwd: string
77
}
88

9-
export type InputType =
10-
| { prompt: string; params?: Record<string, any> }
11-
| { prompt?: string; params: Record<string, any> }
12-
| { prompt: string; params: Record<string, any> }
13-
149
export type ChatContext = {
1510
agentId: string
1611
chatId?: string
1712
}
1813

1914
export type NewChatOptions = {
2015
agent: AgentTemplateType
21-
input: InputType
16+
prompt: string
17+
params?: Record<string, any>
2218
handleEvent: (event: PrintModeEvent) => void
2319
}
2420

2521
export type ContinueChatOptions = {
2622
context: ChatContext
2723
agent?: AgentTemplateType
28-
input: InputType
24+
prompt: string
25+
params?: Record<string, any>
2926
chatId?: string
3027
handleEvent: (event: PrintModeEvent) => void
3128
}

0 commit comments

Comments
 (0)