@tvbs-ai/news-rd 0.3.3 → 0.4.0

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.
Files changed (2) hide show
  1. package/dist/cli.js +25 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
- var CLI_VERSION = "0.3.3";
4
+ var CLI_VERSION = "0.4.0";
5
5
  var rawArgs = process.argv.slice(2);
6
6
  function parseArgs() {
7
7
  const options = {
@@ -25,6 +25,9 @@ function parseArgs() {
25
25
  case "--json":
26
26
  options.json = true;
27
27
  break;
28
+ case "--channel":
29
+ options.channel = rawArgs[++i];
30
+ break;
28
31
  case "--category":
29
32
  options.category = rawArgs[++i];
30
33
  break;
@@ -113,6 +116,7 @@ Groups:
113
116
  Global Options:
114
117
  --base-url URL API base URL (default: https://news-rundown.tvbs.ai)
115
118
  --token TOKEN JWT token (or RD_TOKEN env)
119
+ --channel CODE Channel code (default: tvbsn)
116
120
  --json Raw JSON output
117
121
  --version, -v Show version
118
122
  --help, -h Show help
@@ -127,8 +131,12 @@ config \u2014 \u6642\u6BB5\u8207\u74B0\u5883\u8A2D\u5B9A
127
131
  Commands:
128
132
  timeslots List all available timeslots
129
133
 
134
+ Options:
135
+ --channel CODE Channel code (default: tvbsn)
136
+
130
137
  Examples:
131
138
  news-rd config timeslots
139
+ news-rd config timeslots --channel news-ctv
132
140
  `,
133
141
  rundown: `
134
142
  rundown \u2014 Rundown \u67E5\u8A62\u8207\u7248\u672C\u6BD4\u5C0D
@@ -137,8 +145,12 @@ Commands:
137
145
  get <date> <timeslot> Get rundown content
138
146
  history <date> <timeslot> Get version history (initial + edits)
139
147
 
148
+ Options:
149
+ --channel CODE Channel code (default: tvbsn)
150
+
140
151
  Examples:
141
152
  news-rd rundown get 2026-03-10 0600
153
+ news-rd rundown get 2026-03-10 0600 --channel news-ctv
142
154
  news-rd rundown history 2026-03-10 0600
143
155
  `,
144
156
  news: `
@@ -172,14 +184,17 @@ Commands:
172
184
  Options:
173
185
  --version N Specific prompt version (show, compile)
174
186
  --variables VARS Comma-separated variable names (resolve)
187
+ --channel CODE Channel code (resolve, compile; default: tvbsn)
175
188
 
176
189
  Examples:
177
190
  news-rd prompt list
178
191
  news-rd prompt show rundown-generation-0600
179
- news-rd prompt show rundown-generation-0600 --version 5
192
+ news-rd prompt show tvbsn:rundown-generation-0600 --version 5
180
193
  news-rd prompt variables
181
194
  news-rd prompt resolve 2026-03-10 0600 --variables GOOGLE_TRENDS_FOUR_HR
195
+ news-rd prompt resolve 2026-03-10 0600 --channel news-ctv
182
196
  news-rd prompt compile 2026-03-10 0600
197
+ news-rd prompt compile 2026-03-10 0600 --channel news-ctv
183
198
  `,
184
199
  token: `
185
200
  token \u2014 JWT Token \u7BA1\u7406
@@ -317,11 +332,13 @@ function printTable(rows, columns) {
317
332
  async function handleConfig(command, _positional, options) {
318
333
  switch (command) {
319
334
  case "timeslots": {
320
- const data = await apiCall("/timeslots", options);
335
+ const data = await apiCall(`/timeslots${qs({ channel: options.channel })}`, options);
321
336
  if (options.json) {
322
337
  printJson(data);
323
338
  return;
324
339
  }
340
+ if (data.channel) console.log(`Channel: ${data.channel}
341
+ `);
325
342
  printTable(data.timeslots, ["slot_code", "description"]);
326
343
  return;
327
344
  }
@@ -334,7 +351,7 @@ async function handleRundown(command, positional, options) {
334
351
  switch (command) {
335
352
  case "get": {
336
353
  const [date, timeslot] = requireDateTimeslot(positional, "rundown", "get");
337
- const data = await apiCall(`/rundown${qs({ date, timeslot })}`, options);
354
+ const data = await apiCall(`/rundown${qs({ date, timeslot, channel: options.channel })}`, options);
338
355
  if (options.json) {
339
356
  printJson(data);
340
357
  return;
@@ -367,7 +384,7 @@ async function handleRundown(command, positional, options) {
367
384
  }
368
385
  case "history": {
369
386
  const [date, timeslot] = requireDateTimeslot(positional, "rundown", "history");
370
- const data = await apiCall(`/rundown/changes${qs({ date, timeslot })}`, options);
387
+ const data = await apiCall(`/rundown/changes${qs({ date, timeslot, channel: options.channel })}`, options);
371
388
  if (options.json) {
372
389
  printJson(data);
373
390
  return;
@@ -503,6 +520,7 @@ ${data.template}
503
520
  const data = await apiCall(`/prompt/rundown/variables/resolve${qs({
504
521
  date,
505
522
  timeslot,
523
+ channel: options.channel,
506
524
  variables: options.variables
507
525
  })}`, options);
508
526
  if (options.json) {
@@ -520,7 +538,7 @@ ${v.name} (${v.value_type}, ${v.value_length} chars${v.item_count !== void 0 ? `
520
538
  }
521
539
  case "compile": {
522
540
  const [date, timeslot] = requireDateTimeslot(positional, "prompt", "compile");
523
- const data = await apiCall(`/prompt/rundown/compiled${qs({ date, timeslot, version: options.version })}`, options);
541
+ const data = await apiCall(`/prompt/rundown/compiled${qs({ date, timeslot, version: options.version, channel: options.channel })}`, options);
524
542
  if (options.json) {
525
543
  printJson(data);
526
544
  return;
@@ -583,7 +601,7 @@ var COMPLETION_DATA = {
583
601
  completion: "bash zsh"
584
602
  },
585
603
  timeslots: "0600 0700 0800 1400 1500 1600",
586
- optionsWithValue: "--base-url --token --category --content-type --limit --version --variables",
604
+ optionsWithValue: "--base-url --token --channel --category --content-type --limit --version --variables",
587
605
  globalFlags: "--help --version --json"
588
606
  };
589
607
  function generateBashCompletion() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tvbs-ai/news-rd",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "TVBS News Rundown AI CLI — query rundowns, candidates, trends, and prompts",
5
5
  "type": "module",
6
6
  "bin": {