yt-briefing 0.3.0 → 0.3.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.
|
@@ -24,6 +24,7 @@ out = JSON.parse(`bun run src/yt-sweep.ts --reset`) // Bash — first call: --
|
|
|
24
24
|
while true:
|
|
25
25
|
out.status:
|
|
26
26
|
"done" → sweep finished — tell the user, stop
|
|
27
|
+
"error" → setup/config problem (e.g. missing API key) — show `out.error` to the user verbatim, stop
|
|
27
28
|
"rate_limited" → transcript fetch blocked (usually a blocked egress IP) — tell the user, stop; recovery in README.md → Proxy
|
|
28
29
|
"rating_needed" → steps A–E
|
|
29
30
|
```
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
19
19
|
import { join, resolve } from 'node:path';
|
|
20
|
-
import { PKG_ROOT } from "./paths.js";
|
|
20
|
+
import { PKG_ROOT, DATA_DIR } from "./paths.js";
|
|
21
21
|
/** Compiled output dir — what a baked (dist) skill command points the runtime at. */
|
|
22
22
|
const DIST_DIR = join(PKG_ROOT, 'dist');
|
|
23
23
|
/** True when the installer itself is running under Bun (vs plain Node). */
|
|
@@ -39,8 +39,11 @@ export const AGENTS = {
|
|
|
39
39
|
/**
|
|
40
40
|
* The shipped SKILL.md. `dist=false` (default) returns it verbatim — the `bun run src/X.ts`
|
|
41
41
|
* dev form, correct only when cwd is the package AND the runtime is Bun. `dist=true` rewrites
|
|
42
|
-
* the engine commands
|
|
43
|
-
*
|
|
42
|
+
* for the consumed case: engine commands become `"<process.execPath>" "<abs>/dist/X.js"` (this
|
|
43
|
+
* machine's runtime, Node or Bun, against the compiled build, so they run from any cwd), and the
|
|
44
|
+
* bare `data/…` paths the agent reads (e.g. `data/config.json`) become the absolute `DATA_DIR`.
|
|
45
|
+
* In dev the agent's cwd IS the package so `data/` resolves; when consumed, DATA_DIR moves to
|
|
46
|
+
* `<project>/.yt-briefing/data`, so the dev-relative paths would miss — hence the rewrite.
|
|
44
47
|
*/
|
|
45
48
|
export function skillBody(dist = false) {
|
|
46
49
|
const raw = readFileSync(SOURCE, 'utf8');
|
|
@@ -50,7 +53,8 @@ export function skillBody(dist = false) {
|
|
|
50
53
|
const cmd = (base) => `"${exe}" "${join(DIST_DIR, base + '.js')}"`;
|
|
51
54
|
return raw
|
|
52
55
|
.replace(/bun run src\/yt-sweep\.ts/g, cmd('yt-sweep'))
|
|
53
|
-
.replace(/bun run src\/yt-rating\.ts/g, cmd('yt-rating'))
|
|
56
|
+
.replace(/bun run src\/yt-rating\.ts/g, cmd('yt-rating'))
|
|
57
|
+
.replace(/data\//g, DATA_DIR + '/');
|
|
54
58
|
}
|
|
55
59
|
/** Write the skill into `dir` (created if needed). Returns the SKILL.md path written. */
|
|
56
60
|
export function installSkill(dir, dist = false) {
|
package/dist/yt-sweep.js
CHANGED
|
@@ -542,5 +542,12 @@ if (reset) {
|
|
|
542
542
|
clearRest();
|
|
543
543
|
clearPrefetch();
|
|
544
544
|
}
|
|
545
|
+
// Fatal config check, foreground only (the detached --fill / --prefetch children already
|
|
546
|
+
// exited above). A missing YouTube Data API key makes EVERY channel expansion throw the same
|
|
547
|
+
// error, which the per-channel `catch` collapses to 0 items — surfacing as a misleading
|
|
548
|
+
// `status:"done"` ("no new videos"). Fail fast with a clear, actionable error instead.
|
|
549
|
+
if (!process.env.YT_BRIEFING_YOUTUBE_API_KEY) {
|
|
550
|
+
emit({ status: 'error', error: 'YT_BRIEFING_YOUTUBE_API_KEY is not set — add a YouTube Data API v3 key to .yt-briefing/.env (see README → first run / .env.example).' });
|
|
551
|
+
}
|
|
545
552
|
const queue = loadQueue() ?? buildQueue();
|
|
546
553
|
await advance(queue);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yt-briefing",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "A self-learning YouTube briefing engine: it sweeps the channels you follow, filters noise in two stages (title, then transcript), summarizes the rest in your language, and adapts to your ratings — one video at a time.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|