letagents 0.12.22 → 0.12.23

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.
@@ -0,0 +1,84 @@
1
+ export interface DirectoryRoom {
2
+ id: string
3
+ title: string
4
+ kind: 'topic' | 'task' | 'branch'
5
+ kindLabel?: string
6
+ closed: boolean
7
+ description: string
8
+ createdAt: string | null
9
+ closedAt: string | null
10
+ searchText?: string
11
+ }
12
+
13
+ export interface DirectoryTask {
14
+ id: string
15
+ title: string
16
+ description: string
17
+ status: string
18
+ roomId?: string
19
+ roomClosed?: boolean
20
+ }
21
+
22
+ export function roomDisplayTitle(title: string): string {
23
+ return title.replace(/^Focus:\s*/i, '').trim() || 'Untitled room'
24
+ }
25
+
26
+ export function filterRooms(
27
+ rooms: readonly DirectoryRoom[],
28
+ closed: boolean,
29
+ query: string,
30
+ ): DirectoryRoom[] {
31
+ const terms = query.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean)
32
+ return rooms
33
+ .filter(
34
+ (room) =>
35
+ room.closed === closed &&
36
+ terms.every((term) =>
37
+ `${room.title} ${room.kind} ${room.kindLabel || ''} ${room.description} ${room.searchText || ''}`
38
+ .toLocaleLowerCase()
39
+ .includes(term),
40
+ ),
41
+ )
42
+ .sort((a, b) => {
43
+ const date = (room: DirectoryRoom) =>
44
+ Date.parse((closed ? room.closedAt : null) || room.createdAt || '') || 0
45
+ return (
46
+ date(b) - date(a) ||
47
+ a.title.localeCompare(b.title) ||
48
+ a.id.localeCompare(b.id)
49
+ )
50
+ })
51
+ }
52
+
53
+ export function roomDate(value: string | null): string {
54
+ if (!value || Number.isNaN(Date.parse(value))) return ''
55
+ return new Intl.DateTimeFormat(undefined, {
56
+ month: 'short',
57
+ day: 'numeric',
58
+ year: 'numeric',
59
+ }).format(new Date(value))
60
+ }
61
+
62
+ export function roomKindLabel(room: DirectoryRoom): string {
63
+ return (
64
+ room.kindLabel ||
65
+ (room.kind === 'branch'
66
+ ? 'Git branch'
67
+ : room.kind === 'task'
68
+ ? 'Task'
69
+ : 'Topic')
70
+ )
71
+ }
72
+
73
+ export function taskStatusLabel(status: string): string {
74
+ const labels: Record<string, string> = {
75
+ open: 'Open',
76
+ accepted: 'Ready to start',
77
+ assigned: 'Assigned',
78
+ in_progress: 'In progress',
79
+ in_review: 'Ready for review',
80
+ blocked: 'Blocked',
81
+ proposed: 'Proposed',
82
+ }
83
+ return labels[status] || status.replace(/_/g, ' ')
84
+ }