Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hooks/band/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export const CSV_HEADER = 'key,started,project,name,cost_usd,turns,agent_minutes

const csvField = (v: string | number | null) => {
const s = v === null ? '' : String(v)
return /[",\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s
return /[",\r\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s
}

export const csvRow = (s: Snapshot) =>
Expand Down
2 changes: 1 addition & 1 deletion hooks/band/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const register: Register = (on, options) => {
on('prompt.submit', async ($, e, next) => {
const text = e.text.trim()
if (e.origin.kind !== 'plugin' && text !== '' && !text.startsWith('/')) {
const name = (text.split('\n')[0] ?? '').slice(0, 60)
const name = (text.split(/\r?\n/)[0] ?? '').slice(0, 60)
await update($, band, b => (b.name === '' ? { ...EMPTY, ...b, name } : b))
}
return next(e)
Expand Down
5 changes: 5 additions & 0 deletions tests/band.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ describe('metrics', () => {
expect(markdown(snapshot(BASE, Date.UTC(2026, 9, 15, 12, 0)))).toContain('| Model | claude-opus-5-5 |')
})

test('a name with a carriage return stays in one ledger row', () => {
const csv = upsertCsv('', snapshot({ ...BASE, name: 'Fix it\r' }, Date.UTC(2026, 9, 15, 12, 0)))
expect(tasksFrom(csv).map(t => t.name)).toEqual(['Fix it\r'])
})

test('the webhook sends the token only over https, or to this machine', () => {
const row = snapshot(BASE, Date.UTC(2026, 9, 15, 12, 0))
const sent = webhookRequest('https://board.example.com/tasks', 'ptb_x', true, row)
Expand Down