yt-briefing 0.12.0 → 0.12.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/dist/bootstrap.js CHANGED
@@ -16,7 +16,8 @@
16
16
  */
17
17
  import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
18
18
  import { join } from 'node:path';
19
- import { DATA_DIR, BASE_DIR, PKG_ROOT, CHANNELS_DIR, CHANNELS_MD, STATE_MD, CONFIG_JSON, profilePath, } from "./lib/paths.js";
19
+ import { DATA_DIR, BASE_DIR, PKG_ROOT, CHANNELS_DIR, CHANNELS_MD, STATE_MD, CONFIG_JSON, profilePath, ROOT_ENV_PATH, } from "./lib/paths.js";
20
+ import { loadEnv, missingEnv, REQUIRED_LLM, REQUIRED_YOUTUBE } from "./lib/env.js";
20
21
  import { AGENTS, installSkills, projectSkillsRoot, customSkillsRootDefault, isPackageDevCwd } from "./lib/skill-install.js";
21
22
  import { question } from "./lib/prompt.js";
22
23
  import { normalizeHandle, slugify, serializeChannels, serializeState, profileBody, baselineStateRow } from "./lib/channels.js";
@@ -120,6 +121,17 @@ function main() {
120
121
  catch (e) {
121
122
  console.log(` ! Couldn't install the skills (${e.message}) — run yt-briefing install-skill later.`);
122
123
  }
124
+ // Preflight the keys the engine needs at run time. init deliberately does NOT write them —
125
+ // they live in the project root .env (12-factor) — but warn now, naming any still missing, so
126
+ // the gap surfaces here instead of at the first /yt.
127
+ loadEnv();
128
+ const missingKeys = missingEnv([...REQUIRED_LLM, ...REQUIRED_YOUTUBE]);
129
+ if (missingKeys.length) {
130
+ console.log('\n ⚠ Keys still needed before /yt will run — add them to your project root .env:');
131
+ for (const k of missingKeys)
132
+ console.log(` ${k}`);
133
+ console.log(` Path: ${ROOT_ENV_PATH} · full block in README → Setup`);
134
+ }
123
135
  console.log('\n Next:');
124
136
  console.log(` 1. Open this folder in ${agent ? agent.name : 'your agent'}.`);
125
137
  console.log(' 2. Start a new chat and type /yt (or /yt-transcribe <url>)');
package/dist/lib/env.js CHANGED
@@ -28,7 +28,7 @@ export function missingEnv(names) {
28
28
  export function missingEnvMessage(missing) {
29
29
  const plural = missing.length > 1;
30
30
  return `Missing required environment variable${plural ? 's' : ''}: ${missing.join(', ')}. ` +
31
- `Set ${plural ? 'them' : 'it'} in your project root .env (see README → Providers → Where the keys live).`;
31
+ `Set ${plural ? 'them' : 'it'} in your project root .env (see README → Setup).`;
32
32
  }
33
33
  /** Throw a clear, named error if any required var is missing. */
34
34
  export function requireEnv(names) {
@@ -12,7 +12,7 @@ const API = 'https://www.googleapis.com/youtube/v3';
12
12
  function apiKey() {
13
13
  const k = process.env.YT_BRIEFING_YOUTUBE_API_KEY;
14
14
  if (!k)
15
- throw new Error('Missing required environment variable: YT_BRIEFING_YOUTUBE_API_KEY. Set it in your project root .env (see README → Providers → Where the keys live).');
15
+ throw new Error('Missing required environment variable: YT_BRIEFING_YOUTUBE_API_KEY. Set it in your project root .env (see README → Setup).');
16
16
  return k;
17
17
  }
18
18
  async function get(path, params) {
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Usage: bun src/yt-transcript.ts VIDEO_ID_OR_URL [--lang pl|en|auto]
4
- * Accepts: bare 11-char video ID, youtube.com/watch?v=..., or youtu.be/... URL.
4
+ * Accepts: bare 11-char video ID, youtube.com/watch?v=..., youtu.be/..., or
5
+ * path-based URLs (youtube.com/shorts|embed|live|v/...).
5
6
  * Output: plain text transcript on stdout
6
7
  * Exit 1 if the video genuinely has no subtitles — caller should skip this video.
7
8
  * Exit 2 if YouTube rate-limited / blocked the IP (caller may retry later).
@@ -55,6 +56,10 @@ function extractVideoId(input) {
55
56
  const short = t.match(/youtu\.be\/([A-Za-z0-9_-]{11})/);
56
57
  if (short)
57
58
  return short[1];
59
+ // Path-based forms: youtube.com/shorts/ID, /embed/ID, /live/ID, /v/ID
60
+ const path = t.match(/youtube\.com\/(?:shorts|embed|live|v)\/([A-Za-z0-9_-]{11})/);
61
+ if (path)
62
+ return path[1];
58
63
  if (/^[A-Za-z0-9_-]{11}$/.test(t))
59
64
  return t;
60
65
  console.error(`Invalid VIDEO_ID or YouTube URL: ${input}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yt-briefing",
3
- "version": "0.12.0",
3
+ "version": "0.12.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": {