@gobing-ai/knowledge-kit 0.0.8 → 0.0.10
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/index.js +102 -50
- package/package.json +4 -4
- package/plugins/generations/dailynews-gen/package.json +17 -0
- package/plugins/generations/dailynews-gen/plugin.json +7 -0
- package/plugins/generations/dailynews-gen/src/index.ts +111 -0
- package/plugins/generations/dailynews-gen/src/script-builder.ts +430 -0
- package/plugins/generations/dailynews-gen/tsconfig.json +4 -0
- package/plugins/generations/voice-gen/src/concat.ts +9 -7
- package/plugins/generations/voice-gen/src/index.ts +65 -11
- package/plugins/generations/voice-gen/src/mp3.ts +65 -0
- package/plugins/generations/voice-gen/src/qc.ts +157 -0
- package/plugins/generations/voice-gen/src/voicebox-client.ts +40 -2
- package/plugins/generations/voice-gen/src/voicescript.ts +149 -12
- package/plugins/ingestions/aihot-ingest/package.json +17 -0
- package/plugins/ingestions/aihot-ingest/plugin.json +7 -0
- package/plugins/ingestions/aihot-ingest/src/client.ts +185 -0
- package/plugins/ingestions/aihot-ingest/src/index.ts +137 -0
- package/plugins/ingestions/aihot-ingest/src/mapper.ts +42 -0
- package/plugins/ingestions/aihot-ingest/tsconfig.json +4 -0
- package/plugins/ingestions/web-search/src/index.ts +2 -1
- package/plugins/kk/commands/workflow-run.md +70 -48
- package/plugins/kk/skills/audio-authoring/SKILL.md +185 -0
- package/plugins/kk/skills/audio-authoring/templates/voicescript.solo.yaml +25 -0
- package/plugins/kk/workflows/judge-gated-publish-example.yaml +6 -7
- package/plugins/kk/workflows/kk-daily-ai-voice.yaml +158 -0
- package/plugins/kk/workflows/kk-ingest-generate-publish.yaml +13 -4
- package/plugins/kk/workflows/kk-itc.yaml +14 -18
- package/plugins/kk/workflows/kk-solo-podcast.yaml +135 -104
- package/plugins/kk/workflows/kk-storm-research.yaml +26 -5
- package/plugins/kk/workflows/wrap-voicescript-doc.ts +40 -0
- package/plugins/publishings/surfdash-pub/src/index.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -14643,6 +14643,75 @@ var init_zod = __esm(() => {
|
|
|
14643
14643
|
init_external();
|
|
14644
14644
|
});
|
|
14645
14645
|
|
|
14646
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.39/node_modules/@gobing-ai/ts-utils/dist/errors.js
|
|
14647
|
+
var ErrorCode;
|
|
14648
|
+
var init_errors3 = __esm(() => {
|
|
14649
|
+
ErrorCode = {
|
|
14650
|
+
NotFound: "NOT_FOUND",
|
|
14651
|
+
Validation: "VALIDATION",
|
|
14652
|
+
Conflict: "CONFLICT",
|
|
14653
|
+
Internal: "INTERNAL"
|
|
14654
|
+
};
|
|
14655
|
+
});
|
|
14656
|
+
|
|
14657
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.39/node_modules/@gobing-ai/ts-utils/dist/api-response.js
|
|
14658
|
+
var API_ERROR_CODES, ERROR_CODE_TO_HTTP, CLIENT_SAFE_CODES;
|
|
14659
|
+
var init_api_response = __esm(() => {
|
|
14660
|
+
init_errors3();
|
|
14661
|
+
API_ERROR_CODES = {
|
|
14662
|
+
SUCCESS: 0,
|
|
14663
|
+
NOT_FOUND: 404,
|
|
14664
|
+
VALIDATION_ERROR: 422,
|
|
14665
|
+
BAD_REQUEST: 400,
|
|
14666
|
+
UNAUTHORIZED: 401,
|
|
14667
|
+
FORBIDDEN: 403,
|
|
14668
|
+
CONFLICT: 409,
|
|
14669
|
+
INTERNAL_ERROR: 500
|
|
14670
|
+
};
|
|
14671
|
+
ERROR_CODE_TO_HTTP = {
|
|
14672
|
+
[ErrorCode.NotFound]: API_ERROR_CODES.NOT_FOUND,
|
|
14673
|
+
[ErrorCode.Validation]: API_ERROR_CODES.VALIDATION_ERROR,
|
|
14674
|
+
[ErrorCode.Conflict]: API_ERROR_CODES.CONFLICT,
|
|
14675
|
+
[ErrorCode.Internal]: API_ERROR_CODES.INTERNAL_ERROR
|
|
14676
|
+
};
|
|
14677
|
+
CLIENT_SAFE_CODES = new Set([ErrorCode.NotFound, ErrorCode.Validation, ErrorCode.Conflict]);
|
|
14678
|
+
});
|
|
14679
|
+
|
|
14680
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.39/node_modules/@gobing-ai/ts-utils/dist/cursor.js
|
|
14681
|
+
var init_cursor = () => {};
|
|
14682
|
+
|
|
14683
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.39/node_modules/@gobing-ai/ts-utils/dist/event-severity.js
|
|
14684
|
+
var init_event_severity = () => {};
|
|
14685
|
+
|
|
14686
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.39/node_modules/@gobing-ai/ts-utils/dist/output.js
|
|
14687
|
+
function processStream(name) {
|
|
14688
|
+
const proc = globalThis.process;
|
|
14689
|
+
const stream = proc?.[name];
|
|
14690
|
+
if (stream === undefined) {
|
|
14691
|
+
throw new Error(`No ${name} target available: set one via setDefaultOutputTargets or pass an explicit target`);
|
|
14692
|
+
}
|
|
14693
|
+
return stream;
|
|
14694
|
+
}
|
|
14695
|
+
function writeLine(message, target) {
|
|
14696
|
+
target.write(`${message}
|
|
14697
|
+
`);
|
|
14698
|
+
}
|
|
14699
|
+
function echo(message, target = defaultStdoutTarget ?? processStream("stdout")) {
|
|
14700
|
+
writeLine(message, target);
|
|
14701
|
+
}
|
|
14702
|
+
function echoError(message, target = defaultStderrTarget ?? processStream("stderr")) {
|
|
14703
|
+
writeLine(message, target);
|
|
14704
|
+
}
|
|
14705
|
+
var defaultStdoutTarget, defaultStderrTarget;
|
|
14706
|
+
|
|
14707
|
+
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.39/node_modules/@gobing-ai/ts-utils/dist/index.js
|
|
14708
|
+
var init_dist = __esm(() => {
|
|
14709
|
+
init_api_response();
|
|
14710
|
+
init_cursor();
|
|
14711
|
+
init_errors3();
|
|
14712
|
+
init_event_severity();
|
|
14713
|
+
});
|
|
14714
|
+
|
|
14646
14715
|
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
|
|
14647
14716
|
var require_identity = __commonJS((exports) => {
|
|
14648
14717
|
var ALIAS = Symbol.for("yaml.alias");
|
|
@@ -17547,15 +17616,15 @@ var require_timestamp = __commonJS((exports) => {
|
|
|
17547
17616
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
17548
17617
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
17549
17618
|
const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
|
|
17550
|
-
let
|
|
17619
|
+
let date6 = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
|
|
17551
17620
|
const tz = match[8];
|
|
17552
17621
|
if (tz && tz !== "Z") {
|
|
17553
17622
|
let d = parseSexagesimal(tz, false);
|
|
17554
17623
|
if (Math.abs(d) < 30)
|
|
17555
17624
|
d *= 60;
|
|
17556
|
-
|
|
17625
|
+
date6 -= 60000 * d;
|
|
17557
17626
|
}
|
|
17558
|
-
return new Date(
|
|
17627
|
+
return new Date(date6);
|
|
17559
17628
|
},
|
|
17560
17629
|
stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
|
|
17561
17630
|
};
|
|
@@ -19415,7 +19484,7 @@ var require_composer = __commonJS((exports) => {
|
|
|
19415
19484
|
var node_process = __require("process");
|
|
19416
19485
|
var directives = require_directives();
|
|
19417
19486
|
var Document = require_Document();
|
|
19418
|
-
var
|
|
19487
|
+
var errors4 = require_errors();
|
|
19419
19488
|
var identity = require_identity();
|
|
19420
19489
|
var composeDoc = require_compose_doc();
|
|
19421
19490
|
var resolveEnd = require_resolve_end();
|
|
@@ -19466,9 +19535,9 @@ var require_composer = __commonJS((exports) => {
|
|
|
19466
19535
|
this.onError = (source, code, message, warning) => {
|
|
19467
19536
|
const pos = getErrorPos(source);
|
|
19468
19537
|
if (warning)
|
|
19469
|
-
this.warnings.push(new
|
|
19538
|
+
this.warnings.push(new errors4.YAMLWarning(pos, code, message));
|
|
19470
19539
|
else
|
|
19471
|
-
this.errors.push(new
|
|
19540
|
+
this.errors.push(new errors4.YAMLParseError(pos, code, message));
|
|
19472
19541
|
};
|
|
19473
19542
|
this.directives = new directives.Directives({ version: options.version || "1.2" });
|
|
19474
19543
|
this.options = options;
|
|
@@ -19554,7 +19623,7 @@ ${cb}` : comment;
|
|
|
19554
19623
|
break;
|
|
19555
19624
|
case "error": {
|
|
19556
19625
|
const msg = token.source ? `${token.message}: ${JSON.stringify(token.source)}` : token.message;
|
|
19557
|
-
const error51 = new
|
|
19626
|
+
const error51 = new errors4.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg);
|
|
19558
19627
|
if (this.atDirectives || !this.doc)
|
|
19559
19628
|
this.errors.push(error51);
|
|
19560
19629
|
else
|
|
@@ -19564,7 +19633,7 @@ ${cb}` : comment;
|
|
|
19564
19633
|
case "doc-end": {
|
|
19565
19634
|
if (!this.doc) {
|
|
19566
19635
|
const msg = "Unexpected doc-end without preceding document";
|
|
19567
|
-
this.errors.push(new
|
|
19636
|
+
this.errors.push(new errors4.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg));
|
|
19568
19637
|
break;
|
|
19569
19638
|
}
|
|
19570
19639
|
this.doc.directives.docEnd = true;
|
|
@@ -19579,7 +19648,7 @@ ${end.comment}` : end.comment;
|
|
|
19579
19648
|
break;
|
|
19580
19649
|
}
|
|
19581
19650
|
default:
|
|
19582
|
-
this.errors.push(new
|
|
19651
|
+
this.errors.push(new errors4.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", `Unsupported token ${token.type}`));
|
|
19583
19652
|
}
|
|
19584
19653
|
}
|
|
19585
19654
|
*end(forceDoc = false, endOffset = -1) {
|
|
@@ -19605,7 +19674,7 @@ ${end.comment}` : end.comment;
|
|
|
19605
19674
|
var require_cst_scalar = __commonJS((exports) => {
|
|
19606
19675
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
19607
19676
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
19608
|
-
var
|
|
19677
|
+
var errors4 = require_errors();
|
|
19609
19678
|
var stringifyString = require_stringifyString();
|
|
19610
19679
|
function resolveAsScalar(token, strict = true, onError) {
|
|
19611
19680
|
if (token) {
|
|
@@ -19614,7 +19683,7 @@ var require_cst_scalar = __commonJS((exports) => {
|
|
|
19614
19683
|
if (onError)
|
|
19615
19684
|
onError(offset, code, message);
|
|
19616
19685
|
else
|
|
19617
|
-
throw new
|
|
19686
|
+
throw new errors4.YAMLParseError([offset, offset + 1], code, message);
|
|
19618
19687
|
};
|
|
19619
19688
|
switch (token.type) {
|
|
19620
19689
|
case "scalar":
|
|
@@ -21494,7 +21563,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
21494
21563
|
var require_public_api = __commonJS((exports) => {
|
|
21495
21564
|
var composer = require_composer();
|
|
21496
21565
|
var Document = require_Document();
|
|
21497
|
-
var
|
|
21566
|
+
var errors4 = require_errors();
|
|
21498
21567
|
var log = require_log();
|
|
21499
21568
|
var identity = require_identity();
|
|
21500
21569
|
var lineCounter = require_line_counter();
|
|
@@ -21511,8 +21580,8 @@ var require_public_api = __commonJS((exports) => {
|
|
|
21511
21580
|
const docs = Array.from(composer$1.compose(parser$1.parse(source)));
|
|
21512
21581
|
if (prettyErrors && lineCounter2)
|
|
21513
21582
|
for (const doc2 of docs) {
|
|
21514
|
-
doc2.errors.forEach(
|
|
21515
|
-
doc2.warnings.forEach(
|
|
21583
|
+
doc2.errors.forEach(errors4.prettifyError(source, lineCounter2));
|
|
21584
|
+
doc2.warnings.forEach(errors4.prettifyError(source, lineCounter2));
|
|
21516
21585
|
}
|
|
21517
21586
|
if (docs.length > 0)
|
|
21518
21587
|
return docs;
|
|
@@ -21527,13 +21596,13 @@ var require_public_api = __commonJS((exports) => {
|
|
|
21527
21596
|
if (!doc2)
|
|
21528
21597
|
doc2 = _doc;
|
|
21529
21598
|
else if (doc2.options.logLevel !== "silent") {
|
|
21530
|
-
doc2.errors.push(new
|
|
21599
|
+
doc2.errors.push(new errors4.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
|
|
21531
21600
|
break;
|
|
21532
21601
|
}
|
|
21533
21602
|
}
|
|
21534
21603
|
if (prettyErrors && lineCounter2) {
|
|
21535
|
-
doc2.errors.forEach(
|
|
21536
|
-
doc2.warnings.forEach(
|
|
21604
|
+
doc2.errors.forEach(errors4.prettifyError(source, lineCounter2));
|
|
21605
|
+
doc2.warnings.forEach(errors4.prettifyError(source, lineCounter2));
|
|
21537
21606
|
}
|
|
21538
21607
|
return doc2;
|
|
21539
21608
|
}
|
|
@@ -21585,12 +21654,12 @@ var require_public_api = __commonJS((exports) => {
|
|
|
21585
21654
|
});
|
|
21586
21655
|
|
|
21587
21656
|
// ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/index.js
|
|
21588
|
-
var composer, Document, Schema,
|
|
21589
|
-
var
|
|
21657
|
+
var composer, Document, Schema, errors4, Alias, identity, Pair, Scalar, YAMLMap, YAMLSeq, cst, lexer, lineCounter, parser, publicApi, visit, $Composer, $Document, $Schema, $YAMLError, $YAMLParseError, $YAMLWarning, $Alias, $isAlias, $isCollection, $isDocument, $isMap, $isNode, $isPair, $isScalar, $isSeq, $Pair, $Scalar, $YAMLMap, $YAMLSeq, $Lexer, $LineCounter, $Parser, $parse, $parseAllDocuments, $parseDocument, $stringify, $visit, $visitAsync;
|
|
21658
|
+
var init_dist2 = __esm(() => {
|
|
21590
21659
|
composer = require_composer();
|
|
21591
21660
|
Document = require_Document();
|
|
21592
21661
|
Schema = require_Schema();
|
|
21593
|
-
|
|
21662
|
+
errors4 = require_errors();
|
|
21594
21663
|
Alias = require_Alias();
|
|
21595
21664
|
identity = require_identity();
|
|
21596
21665
|
Pair = require_Pair();
|
|
@@ -21606,9 +21675,9 @@ var init_dist = __esm(() => {
|
|
|
21606
21675
|
$Composer = composer.Composer;
|
|
21607
21676
|
$Document = Document.Document;
|
|
21608
21677
|
$Schema = Schema.Schema;
|
|
21609
|
-
$YAMLError =
|
|
21610
|
-
$YAMLParseError =
|
|
21611
|
-
$YAMLWarning =
|
|
21678
|
+
$YAMLError = errors4.YAMLError;
|
|
21679
|
+
$YAMLParseError = errors4.YAMLParseError;
|
|
21680
|
+
$YAMLWarning = errors4.YAMLWarning;
|
|
21612
21681
|
$Alias = Alias.Alias;
|
|
21613
21682
|
$isAlias = identity.isAlias;
|
|
21614
21683
|
$isCollection = identity.isCollection;
|
|
@@ -21633,10 +21702,10 @@ var init_dist = __esm(() => {
|
|
|
21633
21702
|
$visitAsync = visit.visitAsync;
|
|
21634
21703
|
});
|
|
21635
21704
|
|
|
21636
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
21705
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.39/node_modules/@gobing-ai/ts-runtime/dist/config.js
|
|
21637
21706
|
var configSchema;
|
|
21638
21707
|
var init_config = __esm(() => {
|
|
21639
|
-
|
|
21708
|
+
init_dist2();
|
|
21640
21709
|
init_zod();
|
|
21641
21710
|
configSchema = exports_external.object({
|
|
21642
21711
|
app: exports_external.object({
|
|
@@ -21657,7 +21726,7 @@ var init_config = __esm(() => {
|
|
|
21657
21726
|
});
|
|
21658
21727
|
});
|
|
21659
21728
|
|
|
21660
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
21729
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.39/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
|
|
21661
21730
|
import { appendFileSync, cpSync, createReadStream, createWriteStream, existsSync as existsSync2, mkdirSync, readdirSync as readdirSync2, readFileSync as readFileSync2, realpathSync as realpathSync2, renameSync, rmSync, statSync as statSync2, writeFileSync } from "fs";
|
|
21662
21731
|
import { dirname as dirname2, resolve as resolvePath } from "path";
|
|
21663
21732
|
function createNodeFileSystem(root, paths) {
|
|
@@ -23869,7 +23938,7 @@ var ConfigError = class extends Error {
|
|
|
23869
23938
|
}
|
|
23870
23939
|
};
|
|
23871
23940
|
|
|
23872
|
-
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.
|
|
23941
|
+
// ../../node_modules/.bun/@gobing-ai+ts-infra@0.4.39+6ae14a6e2b3a5898/node_modules/@gobing-ai/ts-infra/dist/logger.js
|
|
23873
23942
|
var ROOT_CATEGORY = "app";
|
|
23874
23943
|
function toLogTapeLevel(level) {
|
|
23875
23944
|
return level === "warn" ? "warning" : level;
|
|
@@ -26288,35 +26357,14 @@ function isDirectory(path2) {
|
|
|
26288
26357
|
function getByName(result, name) {
|
|
26289
26358
|
return result.plugins.find((p) => p.name === name);
|
|
26290
26359
|
}
|
|
26291
|
-
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.
|
|
26360
|
+
// ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.39/node_modules/@gobing-ai/ts-runtime/dist/index.js
|
|
26292
26361
|
init_file_system_node();
|
|
26293
26362
|
init_config();
|
|
26294
26363
|
|
|
26295
26364
|
// ../../packages/kk-core/src/render-md.ts
|
|
26296
26365
|
if (false) {}
|
|
26297
|
-
// ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.35/node_modules/@gobing-ai/ts-utils/dist/output.js
|
|
26298
|
-
var defaultStdoutTarget;
|
|
26299
|
-
var defaultStderrTarget;
|
|
26300
|
-
function processStream(name) {
|
|
26301
|
-
const proc = globalThis.process;
|
|
26302
|
-
const stream = proc?.[name];
|
|
26303
|
-
if (stream === undefined) {
|
|
26304
|
-
throw new Error(`No ${name} target available: set one via setDefaultOutputTargets or pass an explicit target`);
|
|
26305
|
-
}
|
|
26306
|
-
return stream;
|
|
26307
|
-
}
|
|
26308
|
-
function writeLine(message, target) {
|
|
26309
|
-
target.write(`${message}
|
|
26310
|
-
`);
|
|
26311
|
-
}
|
|
26312
|
-
function echo(message, target = defaultStdoutTarget ?? processStream("stdout")) {
|
|
26313
|
-
writeLine(message, target);
|
|
26314
|
-
}
|
|
26315
|
-
function echoError(message, target = defaultStderrTarget ?? processStream("stderr")) {
|
|
26316
|
-
writeLine(message, target);
|
|
26317
|
-
}
|
|
26318
|
-
|
|
26319
26366
|
// src/fanin.ts
|
|
26367
|
+
init_dist();
|
|
26320
26368
|
var EXIT_USAGE = 2;
|
|
26321
26369
|
var EXIT_INPUT = 1;
|
|
26322
26370
|
function mergeDocLists(inputs, sources) {
|
|
@@ -26439,11 +26487,13 @@ async function runFanin(argv) {
|
|
|
26439
26487
|
// src/fanout.ts
|
|
26440
26488
|
import { tmpdir } from "os";
|
|
26441
26489
|
import { isAbsolute as isAbsolute2, join as join3, resolve as resolve4 } from "path";
|
|
26490
|
+
init_dist();
|
|
26442
26491
|
|
|
26443
26492
|
// src/invoke.ts
|
|
26444
26493
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
|
|
26445
26494
|
import { homedir as homedir2 } from "os";
|
|
26446
26495
|
import { isAbsolute, join as join2, resolve as resolve3 } from "path";
|
|
26496
|
+
init_dist();
|
|
26447
26497
|
function resolveKkConfigPath() {
|
|
26448
26498
|
return process.env.KK_CONFIG || join2(homedir2(), ".config/kk/config.yaml");
|
|
26449
26499
|
}
|
|
@@ -27009,8 +27059,10 @@ function registerExecutorCommand(program2) {
|
|
|
27009
27059
|
// src/commands/plugin.ts
|
|
27010
27060
|
import { existsSync as existsSync4 } from "fs";
|
|
27011
27061
|
import { resolve as resolve5 } from "path";
|
|
27062
|
+
init_dist();
|
|
27012
27063
|
|
|
27013
27064
|
// src/output.ts
|
|
27065
|
+
init_dist();
|
|
27014
27066
|
function withoutFinalLineEnding(message) {
|
|
27015
27067
|
return message.replace(/\r?\n$/, "");
|
|
27016
27068
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/knowledge-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "An ingest → create → publish content pipeline CLI (Bun).",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"typecheck": "tsc --noEmit"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@gobing-ai/ts-infra": "
|
|
32
|
-
"@gobing-ai/ts-runtime": "
|
|
33
|
-
"@gobing-ai/ts-utils": "
|
|
31
|
+
"@gobing-ai/ts-infra": "^0.4.39",
|
|
32
|
+
"@gobing-ai/ts-runtime": "^0.4.39",
|
|
33
|
+
"@gobing-ai/ts-utils": "^0.4.39",
|
|
34
34
|
"commander": "15.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gobing-ai/dailynews-gen",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"typecheck": "tsc --noEmit"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@gobing-ai/kk-core": "workspace:*",
|
|
10
|
+
"@gobing-ai/ts-runtime": "catalog:",
|
|
11
|
+
"@gobing-ai/ts-utils": "catalog:",
|
|
12
|
+
"zod": "4.4.3"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/bun": "1.3.14"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { dirname } from 'node:path';
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { type Content, ContentSchema, type Doc, DocListSchema } from '@gobing-ai/kk-core';
|
|
4
|
+
import { createNodeFileSystem } from '@gobing-ai/ts-runtime';
|
|
5
|
+
import { echoError } from '@gobing-ai/ts-utils';
|
|
6
|
+
import { buildNewsVoiceScript, formatVoiceScriptToYaml, type ScriptBuilderOptions } from './script-builder';
|
|
7
|
+
|
|
8
|
+
export * from './script-builder';
|
|
9
|
+
|
|
10
|
+
export interface GeneratorOptions extends ScriptBuilderOptions {
|
|
11
|
+
in: string;
|
|
12
|
+
out: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function processGeneratorIO(
|
|
16
|
+
inputPath: string,
|
|
17
|
+
outputPath: string,
|
|
18
|
+
options?: ScriptBuilderOptions,
|
|
19
|
+
): Promise<Content> {
|
|
20
|
+
const fs = createNodeFileSystem();
|
|
21
|
+
|
|
22
|
+
let docs: Doc[];
|
|
23
|
+
try {
|
|
24
|
+
const rawInput = await fs.readFile(inputPath);
|
|
25
|
+
docs = DocListSchema.parse(JSON.parse(rawInput));
|
|
26
|
+
} catch (err: unknown) {
|
|
27
|
+
throw new Error(`Invalid DocList input: ${err instanceof Error ? err.message : String(err)}`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const script = buildNewsVoiceScript(docs, options);
|
|
31
|
+
const yamlBody = formatVoiceScriptToYaml(script);
|
|
32
|
+
|
|
33
|
+
const content: Content = {
|
|
34
|
+
title: script.title,
|
|
35
|
+
body: yamlBody,
|
|
36
|
+
format: 'markdown',
|
|
37
|
+
references: docs
|
|
38
|
+
.filter((d) => d.sourceUri)
|
|
39
|
+
.map((d) => ({
|
|
40
|
+
title: d.title,
|
|
41
|
+
url: d.sourceUri,
|
|
42
|
+
})),
|
|
43
|
+
metadata: {
|
|
44
|
+
generator: 'kk:dailynews-gen',
|
|
45
|
+
language: script.language,
|
|
46
|
+
voiceProfile: script.default_profile,
|
|
47
|
+
storyCount: docs.length,
|
|
48
|
+
stories: docs.map((d) => ({
|
|
49
|
+
id: d.id,
|
|
50
|
+
title: d.title,
|
|
51
|
+
sourceUri: d.sourceUri,
|
|
52
|
+
})),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const validatedContent = ContentSchema.parse(content);
|
|
57
|
+
|
|
58
|
+
const outDir = dirname(outputPath);
|
|
59
|
+
if (outDir && outDir !== '.') {
|
|
60
|
+
await fs.ensureDir(outDir);
|
|
61
|
+
}
|
|
62
|
+
await fs.writeFile(outputPath, JSON.stringify(validatedContent, null, 2));
|
|
63
|
+
|
|
64
|
+
return validatedContent;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function main(): Promise<number> {
|
|
68
|
+
let values: {
|
|
69
|
+
in?: string;
|
|
70
|
+
out?: string;
|
|
71
|
+
language?: string;
|
|
72
|
+
title?: string;
|
|
73
|
+
'voice-profile'?: string;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
({ values } = parseArgs({
|
|
78
|
+
options: {
|
|
79
|
+
in: { type: 'string' },
|
|
80
|
+
out: { type: 'string' },
|
|
81
|
+
language: { type: 'string' },
|
|
82
|
+
title: { type: 'string' },
|
|
83
|
+
'voice-profile': { type: 'string' },
|
|
84
|
+
},
|
|
85
|
+
}));
|
|
86
|
+
} catch (err: unknown) {
|
|
87
|
+
echoError(`dailynews-gen failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
88
|
+
return 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (!values.in || !values.out) {
|
|
92
|
+
echoError('dailynews-gen failed: Missing required arguments: --in and --out');
|
|
93
|
+
return 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
await processGeneratorIO(values.in, values.out, {
|
|
98
|
+
language: values.language || process.env.DAILYNEWS_LANGUAGE,
|
|
99
|
+
title: values.title || process.env.DAILYNEWS_TITLE,
|
|
100
|
+
voiceProfile: values['voice-profile'] || process.env.VOICEBOX_DEFAULT_PROFILE,
|
|
101
|
+
});
|
|
102
|
+
return 0;
|
|
103
|
+
} catch (err: unknown) {
|
|
104
|
+
echoError(`dailynews-gen failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
105
|
+
return 1;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (import.meta.main) {
|
|
110
|
+
process.exit(await main());
|
|
111
|
+
}
|