diff --git a/frontend/src/components/message/ExecuteToolPart.tsx b/frontend/src/components/message/ExecuteToolPart.tsx
index c0a3b049..3a7e226a 100644
--- a/frontend/src/components/message/ExecuteToolPart.tsx
+++ b/frontend/src/components/message/ExecuteToolPart.tsx
@@ -197,7 +197,9 @@ export function ExecuteToolPart({ part, isWaitingPermission, onFileClick }: Exec
() => (displayOutput === output ? parseOutput(output) : undefined),
[displayOutput, output],
)
- const failed = part.state.status === 'error' || metadata.error === true
+ const failed = part.state.status === 'error'
+ || metadata.error === true
+ || (part.state.status === 'completed' && calls.some((call) => call.status === 'error'))
const status = part.state.status
const statusLabel = (() => {
diff --git a/frontend/src/components/message/FileReferenceText.tsx b/frontend/src/components/message/FileReferenceText.tsx
index a1a9e9e2..344f1731 100644
--- a/frontend/src/components/message/FileReferenceText.tsx
+++ b/frontend/src/components/message/FileReferenceText.tsx
@@ -20,17 +20,19 @@ export function FileReferenceText({ text, onFileClick }: FileReferenceTextProps)
}
segments.push(
- {
e.stopPropagation()
onFileClick?.(ref.filePath)
}}
- className="text-primary hover:text-primary-hover cursor-pointer underline decoration-dotted"
+ className="inline p-0 m-0 bg-transparent border-0 font-[inherit] text-left text-primary hover:text-primary-hover cursor-pointer underline decoration-dotted"
title={`Click to open ${ref.filePath}`}
+ aria-label={`Open ${ref.filePath}`}
>
{ref.fullMatch}
- ,
+ ,
)
lastIndex = ref.endIndex
diff --git a/frontend/src/components/message/ToolCallPart.test.tsx b/frontend/src/components/message/ToolCallPart.test.tsx
index ba0df89a..da0a074c 100644
--- a/frontend/src/components/message/ToolCallPart.test.tsx
+++ b/frontend/src/components/message/ToolCallPart.test.tsx
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'
-import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { act, fireEvent, render, screen, waitFor, within } from '@testing-library/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { MemoryRouter } from 'react-router-dom'
import type { PermissionRequest, SessionMessageAssistantTool } from '@opencode-manager/shared/opencode'
@@ -332,7 +332,10 @@ describe('ToolCallPart execute renderer', () => {
expect(screen.getByText('cua-driver.list_windows [app=TextEdit]')).toBeInTheDocument()
expect(screen.getByText('cua-driver.click [x=10]')).toBeInTheDocument()
- expect(screen.getByText('✗')).toBeInTheDocument()
+
+ const errorRow = screen.getByRole('button', { name: /cua-driver\.click/ })
+ expect(within(errorRow).getByText('✗')).toBeInTheDocument()
+ expect(screen.getByText(/Failed/)).toBeInTheDocument()
})
it('renders line-numbered code and output sections when expanded', () => {
@@ -423,7 +426,9 @@ describe('ToolCallPart execute renderer', () => {
renderWithProviders()
fireEvent.click(screen.getByRole('button', { name: /read \[path=src\/app.ts\]/ }))
- fireEvent.click(screen.getByTitle('Click to open src/app.ts'))
+ const reference = screen.getByRole('button', { name: 'Open src/app.ts' })
+ expect(reference).toHaveAttribute('title', 'Click to open src/app.ts')
+ fireEvent.click(reference)
expect(onFileClick).toHaveBeenCalledWith('src/app.ts')
})
diff --git a/ocm-cli/bin/ocm.ts b/ocm-cli/bin/ocm.ts
index 49cb7f4e..9f8cbfb6 100644
--- a/ocm-cli/bin/ocm.ts
+++ b/ocm-cli/bin/ocm.ts
@@ -135,15 +135,34 @@ function findRepo(repos: ManagerRepo[], needle: string | number): ManagerRepo |
return repos.find((r) => r.name === needle) ?? repos.find((r) => r.name.toLowerCase() === needle.toLowerCase())
}
-export async function cmdLogin(args: string[]): Promise {
- const nameFlag = args.indexOf('--name')
- const managerName = nameFlag >= 0 ? args[nameFlag + 1] : undefined
- const positional = nameFlag >= 0 ? [...args.slice(0, nameFlag), ...args.slice(nameFlag + 2)] : args
+const LOGIN_USAGE = 'usage: ocm login [token] [--name ]'
+
+function parseLoginArgs(args: string[]): { url: string; token?: string; managerName?: string } {
+ const positional: string[] = []
+ const managerNames: string[] = []
+ for (let index = 0; index < args.length; index++) {
+ const arg = args[index]
+ if (arg === '--name') {
+ const value = args[index + 1]
+ if (!value || value.startsWith('-')) die(LOGIN_USAGE)
+ managerNames.push(value)
+ index++
+ continue
+ }
+ if (arg.startsWith('-')) die(LOGIN_USAGE)
+ positional.push(arg)
+ }
+ if (managerNames.length > 1) die(LOGIN_USAGE)
const url = positional[0]
- if (!url || (nameFlag >= 0 && !managerName)) die('usage: ocm login [token] [--name ]')
+ if (!url) die(LOGIN_USAGE)
+ return { url, token: positional[1], managerName: managerNames[0] }
+}
+
+export async function cmdLogin(args: string[]): Promise {
+ const { url, token: providedToken, managerName } = parseLoginArgs(args)
const normalisedUrl = normalizeManagerUrl(url)
- let token = positional[1]
+ let token = providedToken
if (!token) {
if (process.stdin.isTTY) {
process.stderr.write('Paste token (input hidden): ')
diff --git a/ocm-cli/test/cli-auth-commands.test.ts b/ocm-cli/test/cli-auth-commands.test.ts
index ab8eb5b0..b6d37cf1 100644
--- a/ocm-cli/test/cli-auth-commands.test.ts
+++ b/ocm-cli/test/cli-auth-commands.test.ts
@@ -160,6 +160,46 @@ describe('cli auth commands', () => {
restore()
})
+ const expectLoginUsageError = async (args: string[]) => {
+ const { cli, stderr, setToken, restore } = await loadCli()
+ const exitSpy = vi.spyOn(process, 'exit').mockImplementation(() => {
+ throw new Error('exit')
+ })
+ await expect(cli.cmdLogin(args)).rejects.toThrow('exit')
+ expect(stderr.join('')).toContain('usage: ocm login [token] [--name ]')
+ expect(exitSpy).toHaveBeenCalledWith(1)
+ expect(setToken).not.toHaveBeenCalled()
+ restore()
+ }
+
+ it('ocm login rejects a repeated --name flag without saving a token', async () => {
+ await expectLoginUsageError(['https://manager.example.com', '--name', 'prod', '--name', 'staging'])
+ })
+
+ it('ocm login rejects a --name flag without a value', async () => {
+ await expectLoginUsageError(['https://manager.example.com', 'tok_xyz', '--name'])
+ })
+
+ it('ocm login rejects a --name value that looks like a flag', async () => {
+ await expectLoginUsageError(['https://manager.example.com', '--name', '--force'])
+ })
+
+ it('ocm login rejects an unknown flag', async () => {
+ await expectLoginUsageError(['https://manager.example.com', 'tok_xyz', '--force'])
+ })
+
+ it('ocm login accepts the token before or after --name', async () => {
+ const afterName = await loadCli()
+ await afterName.cli.cmdLogin(['https://manager.example.com', 'tok_xyz', '--name', 'prod'])
+ expect(afterName.setToken).toHaveBeenCalledWith('https://manager.example.com', 'tok_xyz')
+ afterName.restore()
+
+ const beforeName = await loadCli()
+ await beforeName.cli.cmdLogin(['https://manager.example.com', '--name', 'prod', 'tok_xyz'])
+ expect(beforeName.setToken).toHaveBeenCalledWith('https://manager.example.com', 'tok_xyz')
+ beforeName.restore()
+ })
+
it('ocm logout reports removal', async () => {
const { cli, written, restore } = await loadCli({ deleteTokenImpl: () => Promise.resolve(true) })
await cli.cmdLogout()