Skip to content

Commit 036f5e1

Browse files
committed
Improved styling and task code
1 parent 58ca84d commit 036f5e1

2 files changed

Lines changed: 35 additions & 28 deletions

File tree

claude-agent-github-wiki/app/response/[runId]/page.tsx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
CheckCircle,
1919
Loader2,
2020
XCircle,
21+
MessageCircleQuestionIcon,
2122
} from "lucide-react";
2223
import { agentStream } from "@/trigger/agent-stream";
2324
import type { analyzeRepo } from "@/trigger/analyze-repo";
@@ -110,17 +111,21 @@ export default function ResponsePage() {
110111
<div className="container mx-auto px-4 py-8 max-w-4xl">
111112
{/* Header */}
112113
<div className="mb-8">
113-
<Button variant="ghost" onClick={handleNewQuestion} className="mb-3">
114+
<Button
115+
variant="ghost"
116+
onClick={handleNewQuestion}
117+
className="mb-3 p-0"
118+
>
114119
<ArrowLeft className="w-4 h-4 mr-2" />
115-
Ask Another Question
120+
Ask another question
116121
</Button>
117122

118-
<h1 className="text-3xl font-bold mb-2">Repository Analysis</h1>
123+
<h1 className="text-3xl font-bold mb-2">Repository analysis</h1>
119124
</div>
120125

121126
{/* Status Card */}
122-
<Card className="mb-4">
123-
<CardHeader>
127+
<Card className="mb-4 p-0">
128+
<CardHeader className="p-6">
124129
<CardTitle className="flex justify-between gap-2">
125130
<div className="flex items-center gap-2">
126131
{status === "loading" && (
@@ -135,7 +140,7 @@ export default function ResponsePage() {
135140
{status === "error" && (
136141
<XCircle className="w-5 h-5 text-red-500" />
137142
)}
138-
<span className="text-xl">Analysis Status:</span>
143+
<span className="text-xl">Analysis status:</span>
139144
</div>
140145
<CardDescription className="text-lg font-medium">
141146
{statusText}
@@ -170,11 +175,9 @@ export default function ResponsePage() {
170175
</CardContent>
171176
</Card>
172177
{question && (
173-
<div className="flex items-center gap-2 bg-black/90 p-3 rounded-xl border mt-3 w-fit">
174-
<p className="text-white">
175-
<span className="font-medium text-white/70">Question:</span>{" "}
176-
{question}
177-
</p>
178+
<div className="flex items-center gap-2 bg-black/90 p-4 rounded-xl border mt-6 w-fit">
179+
<MessageCircleQuestionIcon className="w-6 h-6 text-gray-400" />
180+
<p className="text-white">{question}</p>
178181
</div>
179182
)}
180183
{/* Error Alert */}
@@ -192,8 +195,8 @@ export default function ResponsePage() {
192195

193196
{/* Response Content */}
194197
{combinedText.trim() && (
195-
<Card className="border-none">
196-
<CardContent className="p-0 py-4">
198+
<Card className="mt-4 p-4">
199+
<CardContent className="p-0">
197200
<Streamdown isAnimating={isStreaming} mode="streaming">
198201
{combinedText}
199202
</Streamdown>

claude-agent-github-wiki/trigger/analyze-repo.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,52 +100,56 @@ User's question: ${question}
100100
101101
Important: Only include your final analysis in your response. Do not include phrases like "Let me explore", "Let me check", "Now let me examine", etc. The user only wants to see the final answer.`;
102102

103-
metadata.set("status", "Generating response...");
104-
metadata.set("progress", 70);
105-
106103
// Use Claude Agent SDK to analyze the repository
107104
const result = query({
108105
prompt: systemPrompt,
109106
options: {
110107
model: "claude-sonnet-4-20250514",
111108
cwd: join(tempDir, "repo"),
112-
maxTurns: 10,
109+
maxTurns: 30,
113110
permissionMode: "acceptEdits",
114111
abortController,
115112
includePartialMessages: true, // Enable incremental text streaming
116113
allowedTools: [
117-
"Bash",
118-
"Glob",
114+
// "Bash",
115+
// "Glob",
119116
"Grep",
120117
"Read",
121118
// Not allowing Edit/Write since we're just analyzing
122119
],
123120
},
124121
});
125122

126-
metadata.set("status", "Streaming response...");
127-
metadata.set("progress", 90);
123+
metadata.set("status", "Generating response...");
124+
metadata.set("progress", 80);
128125

129126
// Stream text using writer API
130127
const { waitUntilComplete } = agentStream.writer({
131128
execute: async ({ write }) => {
132129
for await (const message of result) {
130+
// During tool use phase - update metadata with tool names
131+
if (message.type === "assistant" && message.message?.content) {
132+
const toolNames: string[] = [];
133+
for (const block of message.message.content) {
134+
if (block.type === "tool_use") {
135+
toolNames.push(block.name);
136+
}
137+
}
138+
if (toolNames.length > 0) {
139+
metadata.set("status", `Analyzing: ${toolNames.join(", ")}`);
140+
}
141+
}
142+
133143
// Handle incremental text deltas from stream events
134144
if (message.type === "stream_event") {
135145
const event = message.event;
136146
if (
137147
event.type === "content_block_delta" &&
138148
event.delta.type === "text_delta"
139149
) {
150+
metadata.set("status", "Streaming response...");
140151
write(event.delta.text);
141152
}
142-
} // Fallback: handle complete assistant messages
143-
else if (message.type === "assistant" && message.message?.content) {
144-
for (const block of message.message.content) {
145-
if (block.type === "text") {
146-
write(block.text);
147-
}
148-
}
149153
}
150154
}
151155
},

0 commit comments

Comments
 (0)