refactor: firstCommand

This commit is contained in:
d-kimsuon
2025-10-18 03:39:12 +09:00
parent e45a841656
commit 45ebfad36a
20 changed files with 190 additions and 187 deletions

View File

@@ -1,6 +1,6 @@
import type { ParsedCommand } from "../../../../server/core/claude-code/functions/parseCommandXml";
import type { ParsedUserMessage } from "../../../../server/core/claude-code/functions/parseUserMessage";
export const firstCommandToTitle = (firstCommand: ParsedCommand) => {
export const firstUserMessageToTitle = (firstCommand: ParsedUserMessage) => {
switch (firstCommand.kind) {
case "command":
if (firstCommand.commandArgs === undefined) {

View File

@@ -17,7 +17,7 @@ import { useTaskNotifications } from "@/hooks/useTaskNotifications";
import { Badge } from "../../../../../../components/ui/badge";
import { honoClient } from "../../../../../../lib/api/client";
import { useProject } from "../../../hooks/useProject";
import { firstCommandToTitle } from "../../../services/firstCommandToTitle";
import { firstUserMessageToTitle } from "../../../services/firstCommandToTitle";
import { useSession } from "../hooks/useSession";
import { useSessionProcess } from "../hooks/useSessionProcess";
import { ConversationList } from "./conversationList/ConversationList";
@@ -117,8 +117,8 @@ export const SessionPageContent: FC<{
<MenuIcon className="w-4 h-4" />
</Button>
<h1 className="text-lg sm:text-2xl md:text-3xl font-bold break-all overflow-ellipsis line-clamp-1 px-1 sm:px-5 min-w-0">
{session.meta.firstCommand !== null
? firstCommandToTitle(session.meta.firstCommand)
{session.meta.firstUserMessage !== null
? firstUserMessageToTitle(session.meta.firstUserMessage)
: sessionId}
</h1>
</div>

View File

@@ -3,14 +3,14 @@ import type { FC } from "react";
import { Badge } from "@/components/ui/badge";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { parseCommandXml } from "../../../../../../../server/core/claude-code/functions/parseCommandXml";
import { parseUserMessage } from "../../../../../../../server/core/claude-code/functions/parseUserMessage";
import { MarkdownContent } from "../../../../../../components/MarkdownContent";
export const UserTextContent: FC<{ text: string; id?: string }> = ({
text,
id,
}) => {
const parsed = parseCommandXml(text);
const parsed = parseUserMessage(text);
if (parsed.kind === "command") {
return (

View File

@@ -9,7 +9,7 @@ import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
import type { Session } from "../../../../../../../server/core/types";
import { NewChatModal } from "../../../../components/newChat/NewChatModal";
import { firstCommandToTitle } from "../../../../services/firstCommandToTitle";
import { firstUserMessageToTitle } from "../../../../services/firstCommandToTitle";
import { sessionProcessesAtom } from "../../store/sessionProcessesAtom";
export const SessionsTab: FC<{
@@ -86,8 +86,8 @@ export const SessionsTab: FC<{
{sortedSessions.map((session) => {
const isActive = session.id === currentSessionId;
const title =
session.meta.firstCommand !== null
? firstCommandToTitle(session.meta.firstCommand)
session.meta.firstUserMessage !== null
? firstUserMessageToTitle(session.meta.firstUserMessage)
: session.id;
const sessionProcess = sessionProcesses.find(