Skip to content

Commit 871eb5c

Browse files
committed
feat(agent/version): improve UX by surfacing per-version usage with a badge and metrics; refine Run/Save button icons and prompts for clarity.\n\n🤖 Generated with Codebuff\nCo-Authored-By: Codebuff <noreply@codebuff.com>
1 parent d57cb1f commit 871eb5c

File tree

5 files changed

+34
-18
lines changed

5 files changed

+34
-18
lines changed

bun.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm-app/src/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,21 @@ For all commands and options, run 'codebuff' and then type 'help'.
240240
)
241241
const initialInput = isCommand ? '' : filteredArgs.join(' ')
242242

243+
// Handle --agent flag by prefilling user input instead of directly invoking
244+
let finalInitialInput = initialInput
245+
if (options.agent && !initialInput) {
246+
finalInitialInput = `@${options.agent}`
247+
} else if (options.agent && initialInput) {
248+
finalInitialInput = `@${options.agent} ${initialInput}`
249+
}
250+
243251
codebuff({
244-
initialInput,
252+
initialInput: finalInitialInput,
245253
git,
246254
costMode,
247255
runInitFlow: options.init,
248256
model: options.model,
249-
agent: options.agent,
257+
agent: undefined, // Don't pass agent to CLI - use prefilled input instead
250258
params: parsedAgentParams,
251259
print: options.print,
252260
cwd: options.cwd,

web/src/app/publishers/[id]/agents/[agentId]/[version]/page.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { AgentUsageMetrics } from './agent-usage-metrics'
1616
import { RunAgentButton } from './run-agent-button'
1717
import { CopyIdButton } from './copy-id-button'
1818
import { SaveAgentButton } from './save-agent-button'
19+
import { VersionUsageBadge } from './version-usage-badge'
1920
import { Button } from '@/components/ui/button'
2021

2122
interface AgentDetailPageProps {
@@ -200,12 +201,6 @@ const AgentDetailPage = async ({ params }: AgentDetailPageProps) => {
200201
</div>
201202
</CardHeader>
202203
</Card>
203-
{/* Usage Metrics */}
204-
<AgentUsageMetrics
205-
publisherId={params.id}
206-
agentId={params.agentId}
207-
version={params.version}
208-
/>
209204
<div className="grid grid-cols-1 lg:grid-cols-4 gap-6">
210205
{/* Version Navigation */}
211206
<div className="lg:col-span-1">
@@ -236,9 +231,16 @@ const AgentDetailPage = async ({ params }: AgentDetailPageProps) => {
236231
className="w-full justify-start group transition-colors"
237232
>
238233
<div className="flex items-center justify-between w-full">
239-
<span className="font-mono">
240-
v{version.version}
241-
</span>
234+
<div className="flex items-center">
235+
<span className="font-mono">
236+
v{version.version}
237+
</span>
238+
<VersionUsageBadge
239+
publisherId={params.id}
240+
agentId={params.agentId}
241+
version={version.version}
242+
/>
243+
</div>
242244
{index === 0 && (
243245
<Badge
244246
className={cn(
@@ -262,6 +264,12 @@ const AgentDetailPage = async ({ params }: AgentDetailPageProps) => {
262264

263265
{/* Agent Definition */}
264266
<div className="lg:col-span-3">
267+
{/* Usage Metrics */}
268+
<AgentUsageMetrics
269+
publisherId={params.id}
270+
agentId={params.agentId}
271+
version={params.version}
272+
/>
265273
<Card>
266274
<CardHeader>
267275
<CardTitle className="text-lg">Agent Definition</CardTitle>

web/src/app/publishers/[id]/agents/[agentId]/[version]/run-agent-button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { Copy } from 'lucide-react'
3+
import { Play } from 'lucide-react'
44
import { Button } from '@/components/ui/button'
55
import { toast } from '@/components/ui/use-toast'
66

@@ -12,7 +12,7 @@ export function RunAgentButton({ agentId }: RunAgentButtonProps) {
1212
const handleCopy = () => {
1313
navigator.clipboard.writeText(`codebuff --agent ${agentId}`)
1414
toast({
15-
description: `Command copied to clipboard: "codebuff --agent ${agentId}"`,
15+
description: `Command copied! Go to your terminal and paste to run this agent.`,
1616
})
1717
}
1818

@@ -23,7 +23,7 @@ export function RunAgentButton({ agentId }: RunAgentButtonProps) {
2323
onClick={handleCopy}
2424
className="flex items-center gap-2"
2525
>
26-
<Copy className="h-4 w-4" />
26+
<Play className="h-4 w-4" />
2727
Run this agent
2828
</Button>
2929
)

web/src/app/publishers/[id]/agents/[agentId]/[version]/save-agent-button.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client'
22

3-
import { Copy } from 'lucide-react'
3+
import { Bookmark } from 'lucide-react'
44
import { Button } from '@/components/ui/button'
55
import { toast } from '@/components/ui/use-toast'
66

@@ -12,7 +12,7 @@ export function SaveAgentButton({ agentId }: SaveAgentButtonProps) {
1212
const handleCopy = () => {
1313
navigator.clipboard.writeText(`codebuff save-agent ${agentId}`)
1414
toast({
15-
description: `Command copied to clipboard: "codebuff save-agent ${agentId}"`,
15+
description: `Command copied! Go to your terminal and paste to save this agent to your project.`,
1616
})
1717
}
1818

@@ -23,7 +23,7 @@ export function SaveAgentButton({ agentId }: SaveAgentButtonProps) {
2323
onClick={handleCopy}
2424
className="flex items-center gap-2"
2525
>
26-
<Copy className="h-4 w-4" />
26+
<Bookmark className="h-4 w-4" />
2727
Save this agent
2828
</Button>
2929
)

0 commit comments

Comments
 (0)