yt-briefing 1.2.0 → 1.2.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yt-briefing",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A self-learning YouTube briefing for Claude Code: it sweeps the channels you follow, filters noise in two stages (title, then transcript), gives you a short briefing of the rest in your language in a pane, and adapts to your ratings — one video at a time.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -163,6 +163,7 @@ function plain(md: string): string {
|
|
|
163
163
|
.replace(/\*\*(.+?)\*\*/g, '$1')
|
|
164
164
|
.replace(/^_(.+)_$/gm, '$1')
|
|
165
165
|
.replace(/^(\d+\.)\s+/gm, '$1 ')
|
|
166
|
+
.replace(/(\d{4}-\d{2}-\d{2})T[\d:.]+Z/g, '$1')
|
|
166
167
|
}
|
|
167
168
|
|
|
168
169
|
/** True when the person typed /yt through Remote Control and nothing attached can show a pane. */
|
|
@@ -171,22 +172,14 @@ async function paneUnseen($: EngineInterface, origin: { kind: string } | undefin
|
|
|
171
172
|
return !(await $.session.surfaces()).some(s => s !== 'terminal')
|
|
172
173
|
}
|
|
173
174
|
|
|
174
|
-
/** The rating loop in the engine's question dialog, for a session where no pane can be seen. */
|
|
175
|
-
async function dialogLoop($: EngineInterface) {
|
|
176
|
-
let
|
|
175
|
+
/** The rating loop in the engine's question dialog, from a sweep already run, for a session where no pane can be seen. */
|
|
176
|
+
async function dialogLoop($: EngineInterface, first: SweepOut) {
|
|
177
|
+
let out = first
|
|
177
178
|
for (;;) {
|
|
178
|
-
|
|
179
|
-
try {
|
|
180
|
-
out = await runSweep($, reset)
|
|
181
|
-
} catch (err) {
|
|
182
|
-
return void $.ui.toast(`The engine did not answer: ${String(err)}`)
|
|
183
|
-
}
|
|
184
|
-
reset = false
|
|
185
|
-
if (out.status !== 'rating_needed' || !out.summary || !out.pending) return void $.ui.toast(endText(out))
|
|
179
|
+
if (out.status !== 'rating_needed' || !out.summary || !out.pending) return void $.ui.log(endText(out))
|
|
186
180
|
|
|
187
|
-
const
|
|
188
|
-
const question = [
|
|
189
|
-
.filter(line => line !== undefined).join('\n')
|
|
181
|
+
const filtered = out.skipped ? `(${out.skipped} filtered out)` : undefined
|
|
182
|
+
const question = [plain(out.summary), filtered, '', 'Rating?'].filter(line => line !== undefined).join('\n')
|
|
190
183
|
let answer: string
|
|
191
184
|
try {
|
|
192
185
|
answer = (await $.ui.ask(question, { header: 'yt-briefing', options: CHOICES })).trim()
|
|
@@ -203,7 +196,12 @@ async function dialogLoop($: EngineInterface) {
|
|
|
203
196
|
const args = answer === 'OK' ? ['--rating', '1'] : answer === 'Weak' ? ['--rating', '0'] : ['--raw-comment', answer]
|
|
204
197
|
const saved = await record($, args)
|
|
205
198
|
if (!saved) return
|
|
206
|
-
|
|
199
|
+
$.ui.log(saved.rule ? `Rule saved: ${saved.rule}. Looking for the next video…` : 'Saved. Looking for the next video…')
|
|
200
|
+
try {
|
|
201
|
+
out = await runSweep($, false)
|
|
202
|
+
} catch (err) {
|
|
203
|
+
return void $.ui.log(`The engine did not answer: ${String(err)}`)
|
|
204
|
+
}
|
|
207
205
|
}
|
|
208
206
|
}
|
|
209
207
|
|
|
@@ -226,9 +224,18 @@ export const register: Register = on => {
|
|
|
226
224
|
}
|
|
227
225
|
await $.ui.close({ id: PANE })
|
|
228
226
|
}
|
|
229
|
-
|
|
227
|
+
// No pane to show progress in: the command itself runs while the first sweep does, so the
|
|
228
|
+
// session shows it working, and only then hands over to the dialogs.
|
|
229
|
+
let first: SweepOut
|
|
230
|
+
try {
|
|
231
|
+
first = await runSweep($, true)
|
|
232
|
+
} catch (err) {
|
|
233
|
+
return { text: `The engine did not answer: ${String(err)}` }
|
|
234
|
+
}
|
|
235
|
+
if (first.status !== 'rating_needed') return { text: endText(first) }
|
|
236
|
+
void dialogLoop($, first)
|
|
230
237
|
|
|
231
|
-
return { text: '
|
|
238
|
+
return { text: 'Briefing ready: rate it in the question dialog.' }
|
|
232
239
|
})
|
|
233
240
|
|
|
234
241
|
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
|