Skip to content

Commit 8185ffe

Browse files
committed
CLI: Make publish a "command" not a flag
1 parent 76761e8 commit 8185ffe

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

npm-app/src/cli-definitions.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,4 @@ export const cliOptions: CliParam[] = [
9393
menuDescription: 'Log subagent messages to trace files',
9494
hidden: false,
9595
},
96-
{
97-
flags: '--publish <agent-name>',
98-
description: 'Publish a specific agent template to the agent store',
99-
menuDescription: 'Publish agent template to store',
100-
hidden: true,
101-
},
10296
]

npm-app/src/index.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Examples:
118118
$ codebuff --cwd my-project # Start in specific directory
119119
$ codebuff --trace # Enable subagent trace logging to .agents/traces/*.log
120120
$ codebuff --create nextjs my-app # Create and scaffold a new Next.js project
121-
$ codebuff --publish my-agent # Publish agent template to store
121+
$ codebuff publish my-agent # Publish agent template to store
122122
$ codebuff --agent file_picker "find relevant files for authentication"
123123
$ codebuff --agent reviewer --params '{"focus": "security"}' "review this code"
124124
@@ -129,9 +129,7 @@ For all commands and options, run 'codebuff' and then type 'help'.
129129
program.parse()
130130

131131
const options = program.opts()
132-
const args = program.args
133-
134-
// Handle template creation
132+
const args = program.args // Handle template creation
135133
if (options.create) {
136134
const template = options.create
137135
const projectDir = args[0] || '.'
@@ -141,8 +139,8 @@ For all commands and options, run 'codebuff' and then type 'help'.
141139
}
142140

143141
// Handle publish command
144-
if (options.publish) {
145-
const agentName = options.publish
142+
if (args[0] === 'publish') {
143+
const agentName = args[1]
146144
await handlePublish(agentName)
147145
process.exit(0)
148146
}
@@ -213,7 +211,10 @@ For all commands and options, run 'codebuff' and then type 'help'.
213211

214212
// Remove the first argument if it's the compiled binary path which bun weirdly injects (starts with /$bunfs)
215213
const filteredArgs = args[0]?.startsWith('/$bunfs') ? args.slice(1) : args
216-
const initialInput = filteredArgs.join(' ')
214+
215+
// If first arg is a command like 'publish', don't treat it as initial input
216+
const isCommand = filteredArgs[0] === 'publish'
217+
const initialInput = isCommand ? '' : filteredArgs.join(' ')
217218

218219
codebuff({
219220
initialInput,

0 commit comments

Comments
 (0)