@bojackduy/opencode-telescope 0.1.2
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.
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/components/preview.tsx +256 -0
- package/components/result-list.tsx +82 -0
- package/package.json +63 -0
- package/search.ts +448 -0
- package/telescope.tsx +256 -0
- package/tsconfig.json +17 -0
- package/tui.tsx +46 -0
- package/ui/format.ts +106 -0
- package/ui/keyboard.ts +14 -0
- package/ui/render-target.ts +76 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# opencode-telescope
|
|
2
|
+
|
|
3
|
+
Telescope-style session conversation search for the OpenCode TUI.
|
|
4
|
+
|
|
5
|
+
This plugin searches OpenCode's local SQLite session database directly in read-only mode, then opens the selected session with the existing TUI route.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add the plugin to your `opencode.json` (or `tui.json`):
|
|
10
|
+
|
|
11
|
+
```jsonc
|
|
12
|
+
{
|
|
13
|
+
"plugin": ["@bojackduy/opencode-telescope"]
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> To use it from a local clone:
|
|
18
|
+
>
|
|
19
|
+
> ```jsonc
|
|
20
|
+
> "plugin": ["./path/to/opencode-telescope"]
|
|
21
|
+
> ```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Run `/telescope` or shortcut `<lead>+f` in OpenCode to search and jump to any session.
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/** @jsxImportSource @opentui/solid */
|
|
2
|
+
import type { TuiThemeCurrent } from "@opencode-ai/plugin/tui"
|
|
3
|
+
import type { SyntaxStyle } from "@opentui/core"
|
|
4
|
+
import { For, Show, createMemo } from "solid-js"
|
|
5
|
+
import type { ConversationPreviewPart, SearchResult } from "../search.ts"
|
|
6
|
+
import {
|
|
7
|
+
compactTime,
|
|
8
|
+
markdownWithMatch,
|
|
9
|
+
reasoningSummary,
|
|
10
|
+
roleColor,
|
|
11
|
+
roleLabel,
|
|
12
|
+
toolIcon,
|
|
13
|
+
toolInputSummary,
|
|
14
|
+
toolLabel,
|
|
15
|
+
truncate,
|
|
16
|
+
} from "../ui/format.ts"
|
|
17
|
+
|
|
18
|
+
export const PreviewHeader = (props: { item: SearchResult | undefined; query: string; theme: TuiThemeCurrent }) => (
|
|
19
|
+
<box
|
|
20
|
+
paddingLeft={1}
|
|
21
|
+
paddingRight={1}
|
|
22
|
+
height={props.query.trim() ? 3 : 2}
|
|
23
|
+
flexDirection="column"
|
|
24
|
+
backgroundColor={props.theme.backgroundPanel}
|
|
25
|
+
flexShrink={0}
|
|
26
|
+
>
|
|
27
|
+
<Show when={props.item} fallback={<text fg={props.theme.textMuted}>Select a hit to preview the exact matched message.</text>}>
|
|
28
|
+
{(item) => (
|
|
29
|
+
<>
|
|
30
|
+
<box width="100%" flexShrink={0}>
|
|
31
|
+
<text fg={props.theme.text} wrapMode="none" overflow="hidden">
|
|
32
|
+
<span style={{ fg: roleColor(item().role, props.theme), bold: true }}>{roleLabel(item().role)}</span>
|
|
33
|
+
<span style={{ fg: props.theme.textMuted }}> · {compactTime(item().timeCreated)}</span>
|
|
34
|
+
<span style={{ fg: props.theme.textMuted }}> · </span>
|
|
35
|
+
<span>{item().sessionTitle}</span>
|
|
36
|
+
</text>
|
|
37
|
+
</box>
|
|
38
|
+
<Show when={props.query.trim()}>
|
|
39
|
+
<box width="100%" flexShrink={0}>
|
|
40
|
+
<text fg={props.theme.textMuted} wrapMode="none" overflow="hidden">match: {props.query.trim()}</text>
|
|
41
|
+
</box>
|
|
42
|
+
</Show>
|
|
43
|
+
</>
|
|
44
|
+
)}
|
|
45
|
+
</Show>
|
|
46
|
+
</box>
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
export const ConversationPreview = (props: { item: SearchResult; parts: ConversationPreviewPart[]; syntax: SyntaxStyle; theme: TuiThemeCurrent }) => (
|
|
50
|
+
<box flexDirection="column" paddingTop={1}>
|
|
51
|
+
<Show when={props.parts.length > 0} fallback={<ConversationFallback item={props.item} syntax={props.syntax} theme={props.theme} />}>
|
|
52
|
+
<For each={props.parts}>
|
|
53
|
+
{(part) => (
|
|
54
|
+
<PreviewConversationPart part={part} item={props.item} syntax={props.syntax} theme={props.theme} />
|
|
55
|
+
)}
|
|
56
|
+
</For>
|
|
57
|
+
</Show>
|
|
58
|
+
</box>
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
const PreviewConversationPart = (props: { part: ConversationPreviewPart; item: SearchResult; syntax: SyntaxStyle; theme: TuiThemeCurrent }) => {
|
|
62
|
+
if (props.part.type === "tool") return <PreviewToolPart part={props.part} theme={props.theme} />
|
|
63
|
+
if (props.part.type === "reasoning") return <PreviewReasoningPart part={props.part} syntax={props.syntax} theme={props.theme} />
|
|
64
|
+
if (props.part.role === "assistant") return <PreviewAssistantPart part={props.part} item={props.item} syntax={props.syntax} theme={props.theme} />
|
|
65
|
+
return <PreviewUserPart part={props.part} item={props.item} theme={props.theme} />
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const PreviewUserPart = (props: { part: ConversationPreviewPart; item: SearchResult; theme: TuiThemeCurrent }) => (
|
|
69
|
+
<box
|
|
70
|
+
id={props.part.messageID}
|
|
71
|
+
border={["left"]}
|
|
72
|
+
borderColor={props.part.target ? props.theme.warning : props.theme.primary}
|
|
73
|
+
customBorderChars={splitBorderChars}
|
|
74
|
+
marginTop={1}
|
|
75
|
+
>
|
|
76
|
+
<box paddingTop={1} paddingBottom={1} paddingLeft={2} backgroundColor={props.theme.backgroundPanel} flexDirection="column">
|
|
77
|
+
<text fg={props.theme.textMuted}>you · {compactTime(props.part.timeCreated)}</text>
|
|
78
|
+
<HighlightedConversationText part={props.part} item={props.item} theme={props.theme} />
|
|
79
|
+
</box>
|
|
80
|
+
</box>
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
const PreviewAssistantPart = (props: { part: ConversationPreviewPart; item: SearchResult; syntax: SyntaxStyle; theme: TuiThemeCurrent }) => (
|
|
84
|
+
<box id={`text-${props.part.messageID}-${props.part.id}`} paddingLeft={3} marginTop={1} flexShrink={0} flexDirection="column">
|
|
85
|
+
<Show when={props.part.target}>
|
|
86
|
+
<TargetMarker part={props.part} item={props.item} role="assistant" time={props.part.timeCreated} theme={props.theme} />
|
|
87
|
+
</Show>
|
|
88
|
+
<markdown
|
|
89
|
+
syntaxStyle={props.syntax}
|
|
90
|
+
streaming={true}
|
|
91
|
+
internalBlockMode="top-level"
|
|
92
|
+
content={conversationMarkdown(props.part, props.item)}
|
|
93
|
+
tableOptions={{ style: "grid" }}
|
|
94
|
+
fg={props.theme.markdownText}
|
|
95
|
+
bg={props.theme.background}
|
|
96
|
+
/>
|
|
97
|
+
</box>
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
const PreviewReasoningPart = (props: { part: ConversationPreviewPart; syntax: SyntaxStyle; theme: TuiThemeCurrent }) => {
|
|
101
|
+
const summary = createMemo(() => reasoningSummary(props.part.text.replace("[REDACTED]", "").trim()))
|
|
102
|
+
return (
|
|
103
|
+
<Show when={summary().title || summary().body}>
|
|
104
|
+
<box id={`text-${props.part.messageID}-${props.part.id}`} paddingLeft={3} marginTop={1} flexDirection="column" flexShrink={0}>
|
|
105
|
+
<Show when={props.part.target}>
|
|
106
|
+
<TargetMarker part={props.part} role="thought" time={props.part.timeCreated} theme={props.theme} />
|
|
107
|
+
</Show>
|
|
108
|
+
<text fg={props.theme.warning} wrapMode="none">
|
|
109
|
+
<span>Thought</span>
|
|
110
|
+
<Show when={summary().title}>
|
|
111
|
+
<span>: {summary().title}</span>
|
|
112
|
+
</Show>
|
|
113
|
+
</text>
|
|
114
|
+
<Show when={summary().body}>
|
|
115
|
+
<box paddingLeft={2} marginTop={1}>
|
|
116
|
+
<markdown
|
|
117
|
+
syntaxStyle={props.syntax}
|
|
118
|
+
streaming={true}
|
|
119
|
+
internalBlockMode="top-level"
|
|
120
|
+
content={summary().body}
|
|
121
|
+
tableOptions={{ style: "grid" }}
|
|
122
|
+
fg={props.theme.textMuted}
|
|
123
|
+
bg={props.theme.background}
|
|
124
|
+
/>
|
|
125
|
+
</box>
|
|
126
|
+
</Show>
|
|
127
|
+
</box>
|
|
128
|
+
</Show>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const PreviewToolPart = (props: { part: ConversationPreviewPart; theme: TuiThemeCurrent }) => {
|
|
133
|
+
const status = createMemo(() => props.part.state?.status ?? "pending")
|
|
134
|
+
const failed = createMemo(() => status() === "error")
|
|
135
|
+
const color = createMemo(() => {
|
|
136
|
+
if (failed()) return props.theme.error
|
|
137
|
+
if (status() === "completed") return props.theme.textMuted
|
|
138
|
+
return props.theme.text
|
|
139
|
+
})
|
|
140
|
+
return (
|
|
141
|
+
<box id={`tool-inline-${props.part.messageID}-${props.part.id}`} paddingLeft={3} marginTop={1} flexDirection="column" flexShrink={0}>
|
|
142
|
+
<Show when={props.part.target}>
|
|
143
|
+
<TargetMarker part={props.part} role="tool" time={props.part.timeCreated} theme={props.theme} />
|
|
144
|
+
</Show>
|
|
145
|
+
<text fg={color()} wrapMode="none" overflow="hidden">
|
|
146
|
+
<span style={{ fg: failed() ? props.theme.error : props.theme.textMuted }}>{toolIcon(props.part.tool)} </span>
|
|
147
|
+
<span>{toolLabel(props.part.tool)}</span>
|
|
148
|
+
<span style={{ fg: props.theme.textMuted }}> {toolInputSummary(props.part.state?.input)}</span>
|
|
149
|
+
<span style={{ fg: props.theme.textMuted }}> · {status()}</span>
|
|
150
|
+
</text>
|
|
151
|
+
<Show when={props.part.state?.error}>
|
|
152
|
+
{(error) => <text fg={props.theme.error}>{error()}</text>}
|
|
153
|
+
</Show>
|
|
154
|
+
<Show when={failed() ? props.part.state?.output : undefined}>
|
|
155
|
+
{(output) => <text fg={props.theme.textMuted}>{truncate(output().trim(), 300)}</text>}
|
|
156
|
+
</Show>
|
|
157
|
+
</box>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const TargetMarker = (props: { part: ConversationPreviewPart; item?: SearchResult; role: string; time: number; theme: TuiThemeCurrent }) => (
|
|
162
|
+
<box flexDirection="column" flexShrink={0}>
|
|
163
|
+
<text fg={props.theme.warning} wrapMode="none" overflow="hidden">
|
|
164
|
+
<span>match</span>
|
|
165
|
+
<span style={{ fg: props.theme.textMuted }}> · {props.role} · {compactTime(props.time)}</span>
|
|
166
|
+
</text>
|
|
167
|
+
<Show when={props.item && matchExcerpt(props.part.text, props.item.match)}>
|
|
168
|
+
{(excerpt) => (
|
|
169
|
+
<text fg={props.theme.textMuted} wrapMode="none" overflow="hidden">
|
|
170
|
+
<span>{excerpt().before}</span>
|
|
171
|
+
<span style={{ fg: props.theme.warning, bold: true }}>{excerpt().match}</span>
|
|
172
|
+
<span>{excerpt().after}</span>
|
|
173
|
+
</text>
|
|
174
|
+
)}
|
|
175
|
+
</Show>
|
|
176
|
+
</box>
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
const HighlightedConversationText = (props: { part: ConversationPreviewPart; item: SearchResult; theme: TuiThemeCurrent }) => {
|
|
180
|
+
const match = createMemo(() => conversationMatch(props.part, props.item))
|
|
181
|
+
return (
|
|
182
|
+
<Show when={match()} fallback={<text fg={props.theme.text}>{props.part.text}</text>}>
|
|
183
|
+
{(hit) => (
|
|
184
|
+
<text fg={props.theme.text}>
|
|
185
|
+
<span>{props.part.text.slice(0, hit().start)}</span>
|
|
186
|
+
<span style={{ fg: props.theme.warning, bold: true }}>{props.part.text.slice(hit().start, hit().end)}</span>
|
|
187
|
+
<span>{props.part.text.slice(hit().end)}</span>
|
|
188
|
+
</text>
|
|
189
|
+
)}
|
|
190
|
+
</Show>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const ConversationFallback = (props: { item: SearchResult; syntax: SyntaxStyle; theme: TuiThemeCurrent }) => (
|
|
195
|
+
<Show
|
|
196
|
+
when={props.item.role === "assistant"}
|
|
197
|
+
fallback={<PreviewUserPart part={searchResultPreviewPart(props.item)} item={props.item} theme={props.theme} />}
|
|
198
|
+
>
|
|
199
|
+
<PreviewAssistantPart part={searchResultPreviewPart(props.item)} item={props.item} syntax={props.syntax} theme={props.theme} />
|
|
200
|
+
</Show>
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
const splitBorderChars = {
|
|
204
|
+
topLeft: "",
|
|
205
|
+
bottomLeft: "",
|
|
206
|
+
vertical: "┃",
|
|
207
|
+
topRight: "",
|
|
208
|
+
bottomRight: "",
|
|
209
|
+
horizontal: " ",
|
|
210
|
+
bottomT: "",
|
|
211
|
+
topT: "",
|
|
212
|
+
cross: "",
|
|
213
|
+
leftT: "",
|
|
214
|
+
rightT: "",
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function searchResultPreviewPart(item: SearchResult): ConversationPreviewPart {
|
|
218
|
+
return {
|
|
219
|
+
id: item.id,
|
|
220
|
+
messageID: item.messageID,
|
|
221
|
+
sessionID: item.sessionID,
|
|
222
|
+
role: item.role,
|
|
223
|
+
type: "text",
|
|
224
|
+
timeCreated: item.timeCreated,
|
|
225
|
+
text: item.text,
|
|
226
|
+
target: true,
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function conversationMatch(part: ConversationPreviewPart, item: SearchResult) {
|
|
231
|
+
if (!part.target) return
|
|
232
|
+
const index = part.text.toLowerCase().indexOf(item.match.toLowerCase())
|
|
233
|
+
if (index === -1 || !item.match) return
|
|
234
|
+
return { start: index, end: index + item.match.length }
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function conversationMarkdown(part: ConversationPreviewPart, item: SearchResult) {
|
|
238
|
+
const hit = conversationMatch(part, item)
|
|
239
|
+
if (!hit || !item.previewHighlight) return part.text
|
|
240
|
+
return markdownWithMatch(part.text.slice(0, hit.start), part.text.slice(hit.start, hit.end), part.text.slice(hit.end), true)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function matchExcerpt(text: string, query: string, radius = 80) {
|
|
244
|
+
const needle = query.trim()
|
|
245
|
+
if (!needle) return
|
|
246
|
+
const start = text.toLowerCase().indexOf(needle.toLowerCase())
|
|
247
|
+
if (start === -1) return
|
|
248
|
+
const end = start + needle.length
|
|
249
|
+
const beforeStart = Math.max(0, start - radius)
|
|
250
|
+
const afterEnd = Math.min(text.length, end + radius)
|
|
251
|
+
return {
|
|
252
|
+
before: `${beforeStart > 0 ? "..." : ""}${text.slice(beforeStart, start).replace(/\s+/g, " ")}`,
|
|
253
|
+
match: text.slice(start, end),
|
|
254
|
+
after: `${text.slice(end, afterEnd).replace(/\s+/g, " ")}${afterEnd < text.length ? "..." : ""}`,
|
|
255
|
+
}
|
|
256
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** @jsxImportSource @opentui/solid */
|
|
2
|
+
import type { TuiThemeCurrent } from "@opencode-ai/plugin/tui"
|
|
3
|
+
import { Show } from "solid-js"
|
|
4
|
+
import type { SearchResult } from "../search.ts"
|
|
5
|
+
import { compactTime, roleColor, roleLabel, truncate } from "../ui/format.ts"
|
|
6
|
+
|
|
7
|
+
export const ResultRow = (props: {
|
|
8
|
+
item: SearchResult
|
|
9
|
+
active: boolean
|
|
10
|
+
width: number
|
|
11
|
+
query: string
|
|
12
|
+
theme: TuiThemeCurrent
|
|
13
|
+
onMouseOver: () => void
|
|
14
|
+
onOpen: () => void
|
|
15
|
+
}) => (
|
|
16
|
+
<box
|
|
17
|
+
flexDirection="column"
|
|
18
|
+
paddingLeft={2}
|
|
19
|
+
paddingRight={2}
|
|
20
|
+
paddingTop={0}
|
|
21
|
+
paddingBottom={1}
|
|
22
|
+
backgroundColor={props.active ? props.theme.backgroundElement : undefined}
|
|
23
|
+
onMouseOver={props.onMouseOver}
|
|
24
|
+
onMouseUp={props.onOpen}
|
|
25
|
+
>
|
|
26
|
+
<text wrapMode="none" overflow="hidden">
|
|
27
|
+
<span style={{ fg: props.active ? props.theme.accent : props.theme.textMuted }}>
|
|
28
|
+
{props.active ? "› " : " "}
|
|
29
|
+
</span>
|
|
30
|
+
<span style={{ fg: props.active ? props.theme.accent : props.theme.text, bold: true }}>
|
|
31
|
+
{truncate(props.item.sessionTitle, sessionTitleWidth(props.width))}
|
|
32
|
+
</span>
|
|
33
|
+
<Show when={props.width >= 48}>
|
|
34
|
+
<span style={{ fg: props.theme.textMuted }}> </span>
|
|
35
|
+
<span style={{ fg: roleColor(props.item.role, props.theme), bold: true }}>{roleLabel(props.item.role)}</span>
|
|
36
|
+
<span style={{ fg: props.theme.textMuted }}> · {compactTime(props.item.timeCreated)}</span>
|
|
37
|
+
</Show>
|
|
38
|
+
</text>
|
|
39
|
+
<Show when={props.width < 48}>
|
|
40
|
+
<text wrapMode="none" overflow="hidden">
|
|
41
|
+
<span style={{ fg: roleColor(props.item.role, props.theme), bold: true }}>{roleLabel(props.item.role)}</span>
|
|
42
|
+
<span style={{ fg: props.theme.textMuted }}> · {compactTime(props.item.timeCreated)}</span>
|
|
43
|
+
</text>
|
|
44
|
+
</Show>
|
|
45
|
+
<HighlightedText
|
|
46
|
+
before={props.item.before}
|
|
47
|
+
match={props.item.match}
|
|
48
|
+
after={props.item.after}
|
|
49
|
+
query={props.query}
|
|
50
|
+
active={props.active}
|
|
51
|
+
theme={props.theme}
|
|
52
|
+
/>
|
|
53
|
+
</box>
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
export const EmptyState = (props: { query: string; theme: TuiThemeCurrent }) => (
|
|
57
|
+
<box paddingLeft={1} paddingTop={1}>
|
|
58
|
+
<text fg={props.theme.textMuted}>{props.query.trim() ? "No matching user/assistant conversation text." : "No recent conversation text found."}</text>
|
|
59
|
+
</box>
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
const HighlightedText = (props: {
|
|
63
|
+
before: string
|
|
64
|
+
match: string
|
|
65
|
+
after: string
|
|
66
|
+
query: string
|
|
67
|
+
active: boolean
|
|
68
|
+
theme: TuiThemeCurrent
|
|
69
|
+
}) => (
|
|
70
|
+
<text wrapMode="none" overflow="hidden">
|
|
71
|
+
<span style={{ fg: props.theme.textMuted }}> </span>
|
|
72
|
+
<span style={{ fg: props.active ? props.theme.text : props.theme.textMuted }}>{props.before}</span>
|
|
73
|
+
<span style={{ fg: props.theme.warning, bold: true }}>{props.match || props.query}</span>
|
|
74
|
+
<span style={{ fg: props.active ? props.theme.text : props.theme.textMuted }}>{props.after}</span>
|
|
75
|
+
</text>
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
function sessionTitleWidth(width: number) {
|
|
79
|
+
if (width >= 54) return 28
|
|
80
|
+
if (width >= 48) return 22
|
|
81
|
+
return Math.max(18, width - 6)
|
|
82
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
+
"name": "@bojackduy/opencode-telescope",
|
|
4
|
+
"version": "0.1.2",
|
|
5
|
+
"description": "Telescope-style session conversation search for OpenCode TUI",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Duyyy123/opencode-telescope.git"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/Duyyy123/opencode-telescope#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Duyyy123/opencode-telescope/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"opencode",
|
|
18
|
+
"opencode-plugin",
|
|
19
|
+
"tui",
|
|
20
|
+
"telescope",
|
|
21
|
+
"search"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"typecheck": "bun tsc -p tsconfig.json --noEmit",
|
|
25
|
+
"test": "bun test",
|
|
26
|
+
"prepack": "bun run typecheck && bun test",
|
|
27
|
+
"release:patch": "bun run typecheck && bun test && npm version patch -m \"chore: release %s\" && git push && git push origin $(git describe --tags --abbrev=0)",
|
|
28
|
+
"release:minor": "bun run typecheck && bun test && npm version minor -m \"chore: release %s\" && git push && git push origin $(git describe --tags --abbrev=0)",
|
|
29
|
+
"release:major": "bun run typecheck && bun test && npm version major -m \"chore: release %s\" && git push && git push origin $(git describe --tags --abbrev=0)"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"README.md",
|
|
33
|
+
"LICENSE",
|
|
34
|
+
"tui.tsx",
|
|
35
|
+
"telescope.tsx",
|
|
36
|
+
"search.ts",
|
|
37
|
+
"components",
|
|
38
|
+
"ui",
|
|
39
|
+
"tsconfig.json"
|
|
40
|
+
],
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"import": "./tui.tsx"
|
|
44
|
+
},
|
|
45
|
+
"./tui": {
|
|
46
|
+
"import": "./tui.tsx"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"@opencode-ai/plugin": "*",
|
|
51
|
+
"@opentui/core": "*",
|
|
52
|
+
"@opentui/solid": "*",
|
|
53
|
+
"solid-js": "*"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@opencode-ai/plugin": "^1.14.28",
|
|
57
|
+
"@opentui/core": "^0.1.105",
|
|
58
|
+
"@opentui/solid": "^0.1.105",
|
|
59
|
+
"@types/bun": "^1.3.13",
|
|
60
|
+
"solid-js": "^1.9.12",
|
|
61
|
+
"typescript": "^5.9.3"
|
|
62
|
+
}
|
|
63
|
+
}
|