claude-inbox 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -8
  3. data/lib/claude_inbox/actions.rb +10 -2
  4. data/lib/claude_inbox/agents_client.rb +1 -1
  5. data/lib/claude_inbox/app/browsing.rb +35 -4
  6. data/lib/claude_inbox/app/triaging.rb +5 -0
  7. data/lib/claude_inbox/app.rb +10 -3
  8. data/lib/claude_inbox/cli.rb +7 -2
  9. data/lib/claude_inbox/clipboard.rb +35 -0
  10. data/lib/claude_inbox/config.rb +1 -1
  11. data/lib/claude_inbox/dialog.rb +45 -5
  12. data/lib/claude_inbox/headless.rb +3 -2
  13. data/lib/claude_inbox/images.rb +4 -1
  14. data/lib/claude_inbox/keymap.rb +1 -1
  15. data/lib/claude_inbox/mouse.rb +5 -5
  16. data/lib/claude_inbox/new_session_form.rb +1 -1
  17. data/lib/claude_inbox/notifier.rb +85 -0
  18. data/lib/claude_inbox/notifier_app.rb +82 -0
  19. data/lib/claude_inbox/poller.rb +14 -6
  20. data/lib/claude_inbox/pull_requests.rb +43 -6
  21. data/lib/claude_inbox/remote/icon.icns +0 -0
  22. data/lib/claude_inbox/renderer.rb +45 -15
  23. data/lib/claude_inbox/session.rb +14 -1
  24. data/lib/claude_inbox/snapshot.rb +1 -1
  25. data/lib/claude_inbox/snooze_time.rb +69 -0
  26. data/lib/claude_inbox/store/entry.rb +20 -0
  27. data/lib/claude_inbox/store/row.rb +22 -1
  28. data/lib/claude_inbox/store/sections.rb +0 -4
  29. data/lib/claude_inbox/store.rb +1 -1
  30. data/lib/claude_inbox/subprocess.rb +17 -2
  31. data/lib/claude_inbox/terminal.rb +0 -3
  32. data/lib/claude_inbox.rb +1 -1
  33. data/mod/hooks/register.tsx +23 -10
  34. data/mod/tests/contract.test.tsx +1 -0
  35. data/mod/tests/pane.test.tsx +27 -1
  36. data/mod/tests/snapshot.fixture.ts +4 -2
  37. data/mod/types/index.d.ts +1 -0
  38. metadata +6 -1
@@ -35,6 +35,7 @@ export type SnapshotRow = {
35
35
  state?: string
36
36
  actionable?: boolean
37
37
  waiting?: boolean
38
+ unread?: boolean
38
39
  line?: string
39
40
  wake_at?: number | 'until_woken'
40
41
  remote?: string
@@ -51,7 +52,7 @@ type Action = { action: 'settle' | 'wake' | 'pin'; id: string } | { action: 'sno
51
52
 
52
53
  const ORDER: Section[] = ['pinned', 'needs_you', 'active', 'snoozed', 'settled']
53
54
  const TITLE: Record<Section, string> = { pinned: 'Pinned', needs_you: 'Needs you', active: 'Active', snoozed: 'Snoozed', settled: 'Settled' }
54
- const GLYPH: Record<string, string> = { blocked: '●', failed: '✗', working: '◐', idle: '◌', done: '✓', stopped: '✓' }
55
+ const GLYPH: Record<string, string> = { blocked: '?', failed: '✗', working: '◐', idle: '◌', done: '✓', stopped: '✓' }
55
56
  const COLOR: Record<string, string> = { blocked: 'red', failed: 'red', working: 'green', idle: 'cyan' }
56
57
  const PR_COLOR: Record<string, string> = { open: 'green', draft: 'yellow', merged: 'magenta', closed: 'red' }
57
58
  // `/color`'s names as a label's background. A Button keeps the terminal's own ink, light on a dark
@@ -138,6 +139,7 @@ export function rowOf(section: Section, one: SnapshotRow): InboxRow {
138
139
  state: one.state ?? 'unknown',
139
140
  actionable: one.actionable === true,
140
141
  isWaiting: one.waiting === true,
142
+ isUnread: one.unread === true,
141
143
  line: one.line,
142
144
  wakeAt: one.wake_at,
143
145
  remote: one.remote,
@@ -410,11 +412,10 @@ export const register: Register = (on, options) => {
410
412
  key('u', onRow('wake', 'woke')),
411
413
  key('t', onRow('pin', 'pinned')),
412
414
  key('s', () => void startChord($, 's')),
413
- key('c', () => {
414
- if (!row?.id) return
415
- void $.ui.copy({ text: `claude attach ${row.id}`, surface: e.surface }).then(copied =>
416
- $.ui.toast(copied.isCopied ? `copied: claude attach ${row.id}` : 'no clipboard here'),
417
- )
415
+ key('y', () => {
416
+ if (!row) return $.ui.toast('nothing to copy')
417
+ const text = row.pr?.url ?? row.remote ?? row.id ?? row.label
418
+ void $.ui.copy({ text, surface: e.surface }).then(copied => $.ui.toast(copied.isCopied ? `copied ${text}` : 'no clipboard here'))
418
419
  }),
419
420
  key('o', () => (row?.pr ? void openInBrowser($, row.pr.url) : $.ui.toast('no pull request linked'))),
420
421
  key('w', () => (row?.remote ? void openInBrowser($, row.remote) : $.ui.toast('no claude.ai/code page for this session'))),
@@ -456,11 +457,20 @@ export const register: Register = (on, options) => {
456
457
  }
457
458
  const one = item.row
458
459
  const isQuiet = isFold(one.section)
460
+ // A finished or blocked row you have attached to since dims, as the gem's Active section draws it,
461
+ // unless it is tinted: faint ink on a /color background is unreadable.
462
+ const isRead = !isQuiet && one.actionable && ['done', 'stopped', 'blocked', 'failed'].includes(one.state) && !one.isUnread
463
+ // One dot asks for a look: red while the row needs you, blue when it only finished. A terminal
464
+ // cannot be attached to, so it is never read and keeps its dot while it waits.
465
+ const needsYou = one.state === 'blocked' || one.state === 'failed'
466
+ const alert = !isQuiet && needsYou && (one.isUnread || !one.actionable)
467
+ const dot = alert || (one.isUnread && !isQuiet)
468
+ const text = one.wakeAt !== undefined ? `${one.label} · ${wakeLabel(one.wakeAt)}` : one.label
459
469
  const tint = one.color ? TINT[one.color] : undefined
460
470
  return (
461
471
  <Box key={viewKey(item)} flexDirection="column">
462
472
  <Box>
463
- <Text color={isHere ? 'yellow' : undefined}>{isHere ? '› ' : ' '}</Text>
473
+ <Text color={isHere ? 'yellow' : alert ? 'red' : 'blue'}>{isHere ? '› ' : dot ? '● ' : ' '}</Text>
464
474
  <Text color={COLOR[one.state]} dimColor={isQuiet || one.state === 'done'}>
465
475
  {GLYPH[one.state] ?? '·'}{' '}
466
476
  </Text>
@@ -470,11 +480,14 @@ export const register: Register = (on, options) => {
470
480
  <Button
471
481
  key={itemKey(item)}
472
482
  plain
473
- dimColor={isQuiet && !isHere}
474
- label={one.wakeAt !== undefined ? `${one.label} · ${wakeLabel(one.wakeAt)}` : one.label}
483
+ dimColor={(isQuiet || isRead) && !isHere && tint === undefined}
484
+ label={text}
475
485
  onPress={enter(item)}
476
486
  autoFocus={isHere || undefined}
477
- />
487
+ >
488
+ {/* An unread row is bold, as a mail client marks one; a Button has no weight of its own. */}
489
+ {one.isUnread && !isQuiet ? <Text bold>{text}</Text> : text}
490
+ </Button>
478
491
  </Box>
479
492
  {/* The label gives up its cells to the PR chip, which would otherwise wrap under it. */}
480
493
  {one.pr ? (
@@ -19,4 +19,5 @@ test("the rows the pane reads are the ones the gem's Snapshot writes", () => {
19
19
  ])
20
20
  expect(rows[1]?.pr).toEqual({ short: '#7', state: 'open', url: 'https://github.com/o/r/pull/7' })
21
21
  expect(rows[0]?.isWaiting).toBe(false)
22
+ expect(rows.map(row => row.isUnread)).toEqual([true, false, true])
22
23
  })
@@ -13,6 +13,7 @@ const ROWS = [
13
13
  { section: 'needs_you', id: 'a1', label: 'needs an answer', state: 'blocked', actionable: true, line: 'confirm: drop it?' },
14
14
  { section: 'active', id: 'b2', label: 'still going', state: 'working', actionable: true, line: 'running bin/ci', pr: { short: '#7', state: 'open', url: 'https://github.com/o/r/pull/7' } },
15
15
  { section: 'active', id: 'uuid-term', label: 'a terminal', state: 'working', actionable: false },
16
+ { section: 'active', id: 'd4', label: 'finished unseen', state: 'done', actionable: true, isUnread: true },
16
17
  { section: 'settled', id: 'c3', label: 'put away', state: 'done', actionable: true },
17
18
  ]
18
19
 
@@ -97,9 +98,12 @@ test("rows sit under the gem's sections, Settled folded until za opens it", asyn
97
98
  for (const surface of ['terminal', 'desktop'] as const) {
98
99
  const ui = await $.ui.mount({ ...PANE, surface })
99
100
  expect(await ui.find({ type: 'Text', text: /Needs you · 1/ })).toBeDefined()
100
- expect(await ui.find({ type: 'Text', text: /Active · 2/ })).toBeDefined()
101
+ expect(await ui.find({ type: 'Text', text: /Active · 3/ })).toBeDefined()
101
102
  expect(await ui.find({ type: 'Text', text: /Settled · 1/ })).toBeDefined()
102
103
  expect(await ui.find({ type: 'Text', text: /confirm: drop it\?/ })).toBeDefined()
104
+ expect((await ui.findAll({ type: 'Text', text: '● ' })).filter(dot => dot.props.color === 'blue')).toHaveLength(1)
105
+ expect((await ui.find({ type: 'Text', text: 'finished unseen' }))?.props.bold).toBe(true)
106
+ expect(await ui.find({ type: 'Text', text: 'still going' })).toBeUndefined()
103
107
  expect(await ui.find({ type: 'Text', text: /#7 open/ })).toBeDefined()
104
108
  expect(await ui.find({ text: /1 folded/ })).toBeDefined()
105
109
  expect(await ui.find({ text: /put away/ })).toBeUndefined()
@@ -252,6 +256,28 @@ test('o and w hand the keys back to the prompt before they open the browser', as
252
256
  await ui.unmount()
253
257
  })
254
258
 
259
+ test("y copies the row's pull request, else its claude.ai/code page, else its id", async ($, on) => {
260
+ mock.env(on, { HOME: '/Users/me' })
261
+ mock.clock(on, { now: 1_700_000_000_000 })
262
+ const remote = { section: 'active', id: 'e5', label: 'on the web', state: 'working', actionable: true, remote: 'https://claude.ai/code/session_e5' }
263
+ on('state.get', ($, e, next) =>
264
+ e.key === 'rows' ? seeded([ROWS[0], ROWS[1], remote]) : e.key === 'writtenAt' ? seeded(1_700_000_000) : next(e),
265
+ )
266
+ const copied: string[] = []
267
+ on('ui.copy', ($, e) => {
268
+ copied.push(e.text)
269
+ return { value: { isCopied: true } }
270
+ })
271
+ const ui = await $.ui.mount({ ...PANE, surface: 'terminal' })
272
+ await ui.press({ key: 'y' })
273
+ await ui.press({ key: 'j' })
274
+ await ui.press({ key: 'y' })
275
+ await ui.press({ key: 'j' })
276
+ await ui.press({ key: 'y' })
277
+ expect(copied).toEqual(['a1', 'https://github.com/o/r/pull/7', 'https://claude.ai/code/session_e5'])
278
+ await ui.unmount()
279
+ })
280
+
255
281
  test('a click on a row puts the cursor on it before it asks for the switch', async ($, on) => {
256
282
  mock.env(on, { HOME: '/Users/me' })
257
283
  mock.clock(on, { now: 1_700_000_000_000 })
@@ -14,7 +14,8 @@ export const SNAPSHOT = `{
14
14
  "session": "u-a1",
15
15
  "label": "needs an answer",
16
16
  "state": "blocked",
17
- "actionable": true
17
+ "actionable": true,
18
+ "unread": true
18
19
  }
19
20
  ],
20
21
  "active": [
@@ -38,7 +39,8 @@ export const SNAPSHOT = `{
38
39
  "session": "u-c3",
39
40
  "label": "put away",
40
41
  "state": "done",
41
- "actionable": true
42
+ "actionable": true,
43
+ "unread": true
42
44
  }
43
45
  ]
44
46
  }
data/mod/types/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export type InboxRow = {
10
10
  state: string
11
11
  actionable: boolean
12
12
  isWaiting: boolean
13
+ isUnread: boolean
13
14
  line?: string
14
15
  wakeAt?: number | 'until_woken'
15
16
  remote?: string
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claude-inbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Byron
@@ -116,6 +116,7 @@ files:
116
116
  - lib/claude_inbox/app/triaging.rb
117
117
  - lib/claude_inbox/app/updating.rb
118
118
  - lib/claude_inbox/cli.rb
119
+ - lib/claude_inbox/clipboard.rb
119
120
  - lib/claude_inbox/config.rb
120
121
  - lib/claude_inbox/debug.rb
121
122
  - lib/claude_inbox/dialog.rb
@@ -127,6 +128,8 @@ files:
127
128
  - lib/claude_inbox/mod.rb
128
129
  - lib/claude_inbox/mouse.rb
129
130
  - lib/claude_inbox/new_session_form.rb
131
+ - lib/claude_inbox/notifier.rb
132
+ - lib/claude_inbox/notifier_app.rb
130
133
  - lib/claude_inbox/painter.rb
131
134
  - lib/claude_inbox/palette.rb
132
135
  - lib/claude_inbox/paste.rb
@@ -136,6 +139,7 @@ files:
136
139
  - lib/claude_inbox/reaper.rb
137
140
  - lib/claude_inbox/records.rb
138
141
  - lib/claude_inbox/remote/http.rb
142
+ - lib/claude_inbox/remote/icon.icns
139
143
  - lib/claude_inbox/remote/icon.png
140
144
  - lib/claude_inbox/remote/icon.svg
141
145
  - lib/claude_inbox/remote/listener.rb
@@ -150,6 +154,7 @@ files:
150
154
  - lib/claude_inbox/settings.rb
151
155
  - lib/claude_inbox/slash_commands.rb
152
156
  - lib/claude_inbox/snapshot.rb
157
+ - lib/claude_inbox/snooze_time.rb
153
158
  - lib/claude_inbox/store.rb
154
159
  - lib/claude_inbox/store/entry.rb
155
160
  - lib/claude_inbox/store/row.rb