@gobing-ai/knowledge-kit 0.0.17 → 0.0.19

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 (76) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +74 -0
  3. package/dist/index.js +108 -107
  4. package/package.json +19 -1
  5. package/plugins/generations/content-gen/dist/index.js +42 -94
  6. package/plugins/generations/core-facts-gen/dist/index.js +51 -100
  7. package/plugins/generations/daily-article-gen/dist/index.js +57 -99
  8. package/plugins/generations/daily-article-gen/src/index.ts +12 -4
  9. package/plugins/generations/dailynews-gen/dist/index.js +57 -102
  10. package/plugins/generations/dailynews-gen/src/script-builder.ts +9 -1
  11. package/plugins/generations/episode-plan-gen/dist/index.js +120 -113
  12. package/plugins/generations/episode-plan-gen/src/index.ts +102 -22
  13. package/plugins/generations/image-gen/dist/index.js +63 -115
  14. package/plugins/generations/news-report-gen/dist/index.js +117 -99
  15. package/plugins/generations/news-report-gen/src/index.ts +117 -1
  16. package/plugins/generations/omni-voice-gen/src/omni_voice_gen/pipeline.py +1 -1
  17. package/plugins/generations/omni-voice-gen/src/omni_voice_gen/voicescript.py +8 -0
  18. package/plugins/generations/voice-gen/dist/index.js +161 -120
  19. package/plugins/generations/voice-gen/src/concat.ts +34 -0
  20. package/plugins/generations/voice-gen/src/index.ts +14 -4
  21. package/plugins/generations/voice-gen/src/voicebox-server.ts +91 -0
  22. package/plugins/generations/voice-gen/src/voicescript.ts +8 -0
  23. package/plugins/ingestions/aihot-ingest/dist/index.js +47 -97
  24. package/plugins/ingestions/horizon-ingest/dist/index.js +47 -96
  25. package/plugins/ingestions/karakeep-local/dist/index.js +217 -266
  26. package/plugins/ingestions/last30days-ingest/dist/index.js +42 -91
  27. package/plugins/ingestions/web-search/dist/index.js +68 -117
  28. package/plugins/kk/commands/workflow-run.md +10 -6
  29. package/plugins/kk/plugin.json +1 -1
  30. package/plugins/kk/scripts/kk-workflow-stages.ts +376 -70
  31. package/plugins/kk/skills/publish/SKILL.md +80 -0
  32. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +136 -224
  33. package/plugins/kk/workflows/leftover-publish-fanout-example.yaml +53 -0
  34. package/plugins/publishings/emdash-pub/dist/index.js +42 -91
  35. package/plugins/publishings/infoq-pub/dist/index.js +21994 -0
  36. package/plugins/publishings/infoq-pub/package.json +17 -0
  37. package/plugins/publishings/infoq-pub/plugin.json +7 -0
  38. package/plugins/publishings/infoq-pub/src/index.ts +123 -0
  39. package/plugins/publishings/infoq-pub/tsconfig.json +4 -0
  40. package/plugins/publishings/juejin-pub/dist/index.js +21994 -0
  41. package/plugins/publishings/juejin-pub/package.json +17 -0
  42. package/plugins/publishings/juejin-pub/plugin.json +7 -0
  43. package/plugins/publishings/juejin-pub/src/index.ts +123 -0
  44. package/plugins/publishings/juejin-pub/tsconfig.json +4 -0
  45. package/plugins/publishings/medium-pub/dist/index.js +22041 -0
  46. package/plugins/publishings/medium-pub/package.json +17 -0
  47. package/plugins/publishings/medium-pub/plugin.json +7 -0
  48. package/plugins/publishings/medium-pub/src/index.ts +215 -0
  49. package/plugins/publishings/medium-pub/tsconfig.json +4 -0
  50. package/plugins/publishings/podcast-pub/dist/index.js +183 -123
  51. package/plugins/publishings/podcast-pub/src/index.ts +47 -3
  52. package/plugins/publishings/podcast-pub/src/show-notes.ts +153 -34
  53. package/plugins/publishings/qiita-pub/dist/index.js +42 -91
  54. package/plugins/publishings/substack-pub/dist/index.js +21994 -0
  55. package/plugins/publishings/substack-pub/package.json +17 -0
  56. package/plugins/publishings/substack-pub/plugin.json +7 -0
  57. package/plugins/publishings/substack-pub/src/index.ts +123 -0
  58. package/plugins/publishings/substack-pub/tsconfig.json +4 -0
  59. package/plugins/publishings/surfdash-pub/dist/index.js +172 -103
  60. package/plugins/publishings/surfdash-pub/src/index.ts +32 -2
  61. package/plugins/publishings/wechatmp-pub/dist/index.js +22119 -0
  62. package/plugins/publishings/wechatmp-pub/package.json +17 -0
  63. package/plugins/publishings/wechatmp-pub/plugin.json +7 -0
  64. package/plugins/publishings/wechatmp-pub/src/index.ts +304 -0
  65. package/plugins/publishings/wechatmp-pub/tsconfig.json +4 -0
  66. package/plugins/publishings/x-pub/dist/index.js +22110 -0
  67. package/plugins/publishings/x-pub/package.json +17 -0
  68. package/plugins/publishings/x-pub/plugin.json +7 -0
  69. package/plugins/publishings/x-pub/src/index.ts +222 -0
  70. package/plugins/publishings/x-pub/tsconfig.json +4 -0
  71. package/plugins/publishings/xhs-pub/dist/index.js +21994 -0
  72. package/plugins/publishings/xhs-pub/package.json +17 -0
  73. package/plugins/publishings/xhs-pub/plugin.json +7 -0
  74. package/plugins/publishings/xhs-pub/src/index.ts +123 -0
  75. package/plugins/publishings/xhs-pub/tsconfig.json +4 -0
  76. package/plugins/publishings/zenn-pub/dist/index.js +42 -91
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "plugins": [
8
8
  {
9
- "version": "0.0.17",
9
+ "version": "0.0.19",
10
10
  "name": "kk",
11
11
  "source": "./plugins/kk",
12
12
  "description": "knowledge-kit — a set of toolkit for knowledge management"
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ # @gobing-ai/knowledge-kit
2
+
3
+ **Ingest → Create → Publish** — a content pipeline CLI. `knowledge-kit` turns documents (or
4
+ just a topic brief) into finished, published content across multiple channels.
5
+
6
+ > **The name is historical.** knowledge-kit is not only a knowledge-management tool: content
7
+ > creation and multi-channel publishing are first-class, co-equal capabilities, and
8
+ > **ingestion is optional** — a pipeline may start from a `Brief` (topic → article) with no
9
+ > ingested documents.
10
+
11
+ The binary installs as both `kk` and `knowledge-kit`. Pipelines are expressed as **plugins**
12
+ (ingestion / generator / publish) wired together by [spur](https://www.npmjs.com/package/@gobing-ai/spur)
13
+ workflows — `kk` owns each step, `spur` owns the orchestration.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ bun add -g @gobing-ai/knowledge-kit
19
+ ```
20
+
21
+ Requires [Bun](https://bun.sh) ≥ 1.3.14.
22
+
23
+ ### Optional: install the `kk` agent plugin collection
24
+
25
+ The npm tarball ships the `kk` plugin collection (skills, commands, agents, hooks, rules) for
26
+ coding agents. Install it globally via [superskill](https://www.npmjs.com/package/@gobing-ai/superskill):
27
+
28
+ ```bash
29
+ bun add -g @gobing-ai/superskill
30
+ superskill install kk --marketplace gobing-ai/knowledge-kit
31
+ ```
32
+
33
+ The repo is private, so superskill needs a GitHub token in the environment
34
+ (`GITHUB_TOKEN` or `GH_TOKEN`). It caches under `~/.cache/superskill/marketplaces`
35
+ (a warm cache works offline).
36
+
37
+ ## Commands
38
+
39
+ | Command | What it does |
40
+ | --------------------------------------------------- | ----------------------------------------------------------------------------------- |
41
+ | `kk executor run <plugin> --in <path> --out <path>` | Invoke a plugin with input/output files and contract validation |
42
+ | `kk executor fan-in` | Merge N `Doc[]` JSON inputs into one deduplicated `Doc[]` output |
43
+ | `kk executor fan-out` | Publish one `Content` JSON to N targets, aggregating per-target results |
44
+ | `kk plugin status` | List discovered plugins grouped by kind with per-plugin health (`--kind`, `--json`) |
45
+ | `kk -v, --verbose` | Enable verbose diagnostics |
46
+ | `kk --help` / `kk <command> --help` | Full flag reference |
47
+
48
+ Hidden one-release aliases (`invoke`, `fanin`, `fanout`, `plugins list`, `plugins doctor`)
49
+ still work but are not listed in `kk --help`.
50
+
51
+ ## The plugin model
52
+
53
+ Plugins are directories with a `plugin.json` manifest, discovered by a registry scan across
54
+ built-in, user, project, and `KK_PLUGIN_PATH` roots. Three kinds:
55
+
56
+ | Kind | Contract | Shipped examples |
57
+ | ----------- | -------------------------- | ---------------------------------------------------------------- |
58
+ | `ingestion` | `source → Doc[]` | `karakeep-local`, `web-search`, `last30days-ingest` |
59
+ | `generator` | `Doc[] \| Brief → Content` | `content-gen` (owned STORM pipeline), `voice-gen` (Voicebox TTS) |
60
+ | `publish` | `Content → Result` | `surfdash-pub`, `zenn-pub`, `qiita-pub` |
61
+
62
+ Core contracts (`Doc`, `Brief`, `Content`, `Result`) and per-kind validation live in
63
+ `@gobing-ai/kk-core`. **LLM-as-judge is not a plugin kind** — quality gating is delivered as
64
+ agent skills + `agent.run` in the `kk` plugin collection.
65
+
66
+ ## Documentation
67
+
68
+ Source repo: [gobing-ai/knowledge-kit](https://github.com/gobing-ai/knowledge-kit) —
69
+ architecture decisions (`docs/00_ADR.md`), command surface (`docs/04_DESIGN.md`), feature
70
+ status (`docs/05_FEATURES.md`), and per-kind plugin authoring specs (`docs/design/`).
71
+
72
+ ## License
73
+
74
+ [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
package/dist/index.js CHANGED
@@ -14643,75 +14643,6 @@ 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
-
14715
14646
  // ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
14716
14647
  var require_identity = __commonJS((exports) => {
14717
14648
  var ALIAS = Symbol.for("yaml.alias");
@@ -17616,15 +17547,15 @@ var require_timestamp = __commonJS((exports) => {
17616
17547
  throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
17617
17548
  const [, year, month, day, hour, minute, second] = match.map(Number);
17618
17549
  const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
17619
- let date6 = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
17550
+ let date5 = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
17620
17551
  const tz = match[8];
17621
17552
  if (tz && tz !== "Z") {
17622
17553
  let d = parseSexagesimal(tz, false);
17623
17554
  if (Math.abs(d) < 30)
17624
17555
  d *= 60;
17625
- date6 -= 60000 * d;
17556
+ date5 -= 60000 * d;
17626
17557
  }
17627
- return new Date(date6);
17558
+ return new Date(date5);
17628
17559
  },
17629
17560
  stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
17630
17561
  };
@@ -19484,7 +19415,7 @@ var require_composer = __commonJS((exports) => {
19484
19415
  var node_process = __require("process");
19485
19416
  var directives = require_directives();
19486
19417
  var Document = require_Document();
19487
- var errors4 = require_errors();
19418
+ var errors3 = require_errors();
19488
19419
  var identity = require_identity();
19489
19420
  var composeDoc = require_compose_doc();
19490
19421
  var resolveEnd = require_resolve_end();
@@ -19535,9 +19466,9 @@ var require_composer = __commonJS((exports) => {
19535
19466
  this.onError = (source, code, message, warning) => {
19536
19467
  const pos = getErrorPos(source);
19537
19468
  if (warning)
19538
- this.warnings.push(new errors4.YAMLWarning(pos, code, message));
19469
+ this.warnings.push(new errors3.YAMLWarning(pos, code, message));
19539
19470
  else
19540
- this.errors.push(new errors4.YAMLParseError(pos, code, message));
19471
+ this.errors.push(new errors3.YAMLParseError(pos, code, message));
19541
19472
  };
19542
19473
  this.directives = new directives.Directives({ version: options.version || "1.2" });
19543
19474
  this.options = options;
@@ -19623,7 +19554,7 @@ ${cb}` : comment;
19623
19554
  break;
19624
19555
  case "error": {
19625
19556
  const msg = token.source ? `${token.message}: ${JSON.stringify(token.source)}` : token.message;
19626
- const error51 = new errors4.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg);
19557
+ const error51 = new errors3.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg);
19627
19558
  if (this.atDirectives || !this.doc)
19628
19559
  this.errors.push(error51);
19629
19560
  else
@@ -19633,7 +19564,7 @@ ${cb}` : comment;
19633
19564
  case "doc-end": {
19634
19565
  if (!this.doc) {
19635
19566
  const msg = "Unexpected doc-end without preceding document";
19636
- this.errors.push(new errors4.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg));
19567
+ this.errors.push(new errors3.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg));
19637
19568
  break;
19638
19569
  }
19639
19570
  this.doc.directives.docEnd = true;
@@ -19648,7 +19579,7 @@ ${end.comment}` : end.comment;
19648
19579
  break;
19649
19580
  }
19650
19581
  default:
19651
- this.errors.push(new errors4.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", `Unsupported token ${token.type}`));
19582
+ this.errors.push(new errors3.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", `Unsupported token ${token.type}`));
19652
19583
  }
19653
19584
  }
19654
19585
  *end(forceDoc = false, endOffset = -1) {
@@ -19674,7 +19605,7 @@ ${end.comment}` : end.comment;
19674
19605
  var require_cst_scalar = __commonJS((exports) => {
19675
19606
  var resolveBlockScalar = require_resolve_block_scalar();
19676
19607
  var resolveFlowScalar = require_resolve_flow_scalar();
19677
- var errors4 = require_errors();
19608
+ var errors3 = require_errors();
19678
19609
  var stringifyString = require_stringifyString();
19679
19610
  function resolveAsScalar(token, strict = true, onError) {
19680
19611
  if (token) {
@@ -19683,7 +19614,7 @@ var require_cst_scalar = __commonJS((exports) => {
19683
19614
  if (onError)
19684
19615
  onError(offset, code, message);
19685
19616
  else
19686
- throw new errors4.YAMLParseError([offset, offset + 1], code, message);
19617
+ throw new errors3.YAMLParseError([offset, offset + 1], code, message);
19687
19618
  };
19688
19619
  switch (token.type) {
19689
19620
  case "scalar":
@@ -21563,7 +21494,7 @@ var require_parser = __commonJS((exports) => {
21563
21494
  var require_public_api = __commonJS((exports) => {
21564
21495
  var composer = require_composer();
21565
21496
  var Document = require_Document();
21566
- var errors4 = require_errors();
21497
+ var errors3 = require_errors();
21567
21498
  var log = require_log();
21568
21499
  var identity = require_identity();
21569
21500
  var lineCounter = require_line_counter();
@@ -21580,8 +21511,8 @@ var require_public_api = __commonJS((exports) => {
21580
21511
  const docs = Array.from(composer$1.compose(parser$1.parse(source)));
21581
21512
  if (prettyErrors && lineCounter2)
21582
21513
  for (const doc2 of docs) {
21583
- doc2.errors.forEach(errors4.prettifyError(source, lineCounter2));
21584
- doc2.warnings.forEach(errors4.prettifyError(source, lineCounter2));
21514
+ doc2.errors.forEach(errors3.prettifyError(source, lineCounter2));
21515
+ doc2.warnings.forEach(errors3.prettifyError(source, lineCounter2));
21585
21516
  }
21586
21517
  if (docs.length > 0)
21587
21518
  return docs;
@@ -21596,13 +21527,13 @@ var require_public_api = __commonJS((exports) => {
21596
21527
  if (!doc2)
21597
21528
  doc2 = _doc;
21598
21529
  else if (doc2.options.logLevel !== "silent") {
21599
- doc2.errors.push(new errors4.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
21530
+ doc2.errors.push(new errors3.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
21600
21531
  break;
21601
21532
  }
21602
21533
  }
21603
21534
  if (prettyErrors && lineCounter2) {
21604
- doc2.errors.forEach(errors4.prettifyError(source, lineCounter2));
21605
- doc2.warnings.forEach(errors4.prettifyError(source, lineCounter2));
21535
+ doc2.errors.forEach(errors3.prettifyError(source, lineCounter2));
21536
+ doc2.warnings.forEach(errors3.prettifyError(source, lineCounter2));
21606
21537
  }
21607
21538
  return doc2;
21608
21539
  }
@@ -21654,12 +21585,12 @@ var require_public_api = __commonJS((exports) => {
21654
21585
  });
21655
21586
 
21656
21587
  // ../../node_modules/.bun/yaml@2.9.0/node_modules/yaml/dist/index.js
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(() => {
21588
+ var composer, Document, Schema, errors3, 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;
21589
+ var init_dist = __esm(() => {
21659
21590
  composer = require_composer();
21660
21591
  Document = require_Document();
21661
21592
  Schema = require_Schema();
21662
- errors4 = require_errors();
21593
+ errors3 = require_errors();
21663
21594
  Alias = require_Alias();
21664
21595
  identity = require_identity();
21665
21596
  Pair = require_Pair();
@@ -21675,9 +21606,9 @@ var init_dist2 = __esm(() => {
21675
21606
  $Composer = composer.Composer;
21676
21607
  $Document = Document.Document;
21677
21608
  $Schema = Schema.Schema;
21678
- $YAMLError = errors4.YAMLError;
21679
- $YAMLParseError = errors4.YAMLParseError;
21680
- $YAMLWarning = errors4.YAMLWarning;
21609
+ $YAMLError = errors3.YAMLError;
21610
+ $YAMLParseError = errors3.YAMLParseError;
21611
+ $YAMLWarning = errors3.YAMLWarning;
21681
21612
  $Alias = Alias.Alias;
21682
21613
  $isAlias = identity.isAlias;
21683
21614
  $isCollection = identity.isCollection;
@@ -21705,7 +21636,7 @@ var init_dist2 = __esm(() => {
21705
21636
  // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.39/node_modules/@gobing-ai/ts-runtime/dist/config.js
21706
21637
  var configSchema;
21707
21638
  var init_config = __esm(() => {
21708
- init_dist2();
21639
+ init_dist();
21709
21640
  init_zod();
21710
21641
  configSchema = exports_external.object({
21711
21642
  app: exports_external.object({
@@ -26385,16 +26316,34 @@ function getByName(result, name) {
26385
26316
  init_file_system_node();
26386
26317
  init_config();
26387
26318
 
26319
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.67/node_modules/@gobing-ai/ts-utils/dist/output.js
26320
+ var defaultStdoutTarget;
26321
+ var defaultStderrTarget;
26322
+ function processStream(name) {
26323
+ const proc = globalThis.process;
26324
+ const stream = proc?.[name];
26325
+ if (stream === undefined) {
26326
+ throw new Error(`No ${name} target available: set one via setDefaultOutputTargets or pass an explicit target`);
26327
+ }
26328
+ return stream;
26329
+ }
26330
+ function writeLine(message, target) {
26331
+ target.write(`${message}
26332
+ `);
26333
+ }
26334
+ function echo(message, target = defaultStdoutTarget ?? processStream("stdout")) {
26335
+ writeLine(message, target);
26336
+ }
26337
+ function echoError(message, target = defaultStderrTarget ?? processStream("stderr")) {
26338
+ writeLine(message, target);
26339
+ }
26340
+
26388
26341
  // ../../packages/kk-core/src/render-md.ts
26389
26342
  if (false) {}
26390
- // src/fanin.ts
26391
- init_dist();
26392
-
26393
26343
  // src/invoke.ts
26394
26344
  import { existsSync as existsSync3, readFileSync as readFileSync3, statSync as statSync3, unlinkSync } from "fs";
26395
26345
  import { homedir as homedir2 } from "os";
26396
26346
  import { isAbsolute, join as join2, resolve as resolve2 } from "path";
26397
- init_dist();
26398
26347
  function resolveKkConfigPath() {
26399
26348
  return process.env.KK_CONFIG || join2(homedir2(), ".config/kk/config.yaml");
26400
26349
  }
@@ -26471,24 +26420,38 @@ function spawnPluginEntry(opts) {
26471
26420
  stderr: proc.stderr.toString().trim()
26472
26421
  };
26473
26422
  }
26474
- function killProcessTree(pid) {
26423
+ var KILL_TREE_SETTLE_MS = 100;
26424
+ function listChildren(pid) {
26475
26425
  let stdout;
26476
26426
  try {
26477
26427
  stdout = Bun.spawnSync(["pgrep", "-P", String(pid)]).stdout.toString();
26478
26428
  } catch {
26479
26429
  stdout = "";
26480
26430
  }
26481
- for (const line of stdout.trim().split(`
26482
- `)) {
26483
- const child = Number(line);
26484
- if (Number.isInteger(child) && child > 0) {
26485
- killProcessTree(child);
26486
- }
26431
+ return stdout.trim().split(`
26432
+ `).map(Number).filter((child) => Number.isInteger(child) && child > 0);
26433
+ }
26434
+ function killSubtree(pid) {
26435
+ for (const child of listChildren(pid)) {
26436
+ killSubtree(child);
26487
26437
  }
26488
26438
  try {
26489
26439
  process.kill(pid, "SIGKILL");
26490
26440
  } catch {}
26491
26441
  }
26442
+ async function killProcessTree(pid) {
26443
+ const sweep = () => {
26444
+ for (const child of listChildren(pid)) {
26445
+ killSubtree(child);
26446
+ }
26447
+ };
26448
+ sweep();
26449
+ await Bun.sleep(KILL_TREE_SETTLE_MS);
26450
+ sweep();
26451
+ try {
26452
+ process.kill(pid, "SIGKILL");
26453
+ } catch {}
26454
+ }
26492
26455
  async function spawnPluginEntryAsync(opts) {
26493
26456
  let timedOut = false;
26494
26457
  let timer;
@@ -26938,7 +26901,6 @@ async function runFanin(argv) {
26938
26901
  // src/fanout.ts
26939
26902
  import { tmpdir as tmpdir2 } from "os";
26940
26903
  import { isAbsolute as isAbsolute3, join as join4, resolve as resolve4 } from "path";
26941
- init_dist();
26942
26904
  var EXIT_FAILURE = 1;
26943
26905
  var EXIT_INPUT2 = 2;
26944
26906
  function aggregate(entries) {
@@ -27378,10 +27340,8 @@ function registerExecutorCommand(program2) {
27378
27340
  // src/commands/plugin.ts
27379
27341
  import { existsSync as existsSync4 } from "fs";
27380
27342
  import { resolve as resolve5 } from "path";
27381
- init_dist();
27382
27343
 
27383
27344
  // src/output.ts
27384
- init_dist();
27385
27345
  function withoutFinalLineEnding(message) {
27386
27346
  return message.replace(/\r?\n$/, "");
27387
27347
  }
@@ -27499,6 +27459,46 @@ function registerPluginCommand(program2) {
27499
27459
  registerStatusVerb(plugins, "doctor", "Alias for `plugin status` (deprecated)", true);
27500
27460
  }
27501
27461
 
27462
+ // src/stage.ts
27463
+ import { spawnSync } from "child_process";
27464
+ import { existsSync as existsSync5, realpathSync as realpathSync3 } from "fs";
27465
+ import { dirname as dirname3, join as join5, resolve as resolve6 } from "path";
27466
+ var STAGES_REL = "plugins/kk/scripts/kk-workflow-stages.ts";
27467
+ function resolveStagesScript(argv1 = process.argv[1]) {
27468
+ let fromPkg = "";
27469
+ if (argv1) {
27470
+ try {
27471
+ fromPkg = join5(dirname3(dirname3(realpathSync3(argv1))), STAGES_REL);
27472
+ } catch {
27473
+ fromPkg = "";
27474
+ }
27475
+ }
27476
+ if (fromPkg && existsSync5(fromPkg))
27477
+ return fromPkg;
27478
+ const fromCwd = resolve6(STAGES_REL);
27479
+ if (existsSync5(fromCwd))
27480
+ return fromCwd;
27481
+ throw new Error(`kk-workflow-stages.ts not found at ${fromPkg || STAGES_REL} \u2014 install or refresh the kk package (bun link in a checkout)`);
27482
+ }
27483
+ function runStage(args, execPath = process.execPath, argv1) {
27484
+ const script = resolveStagesScript(argv1);
27485
+ const res = spawnSync(execPath, [script, ...args], { stdio: "inherit" });
27486
+ if (res.error) {
27487
+ throw new Error(`failed to spawn stage runner at ${script}: ${res.error.message}`);
27488
+ }
27489
+ return res.status ?? 1;
27490
+ }
27491
+
27492
+ // src/commands/stage.ts
27493
+ function registerStageCommand(program2) {
27494
+ program2.command("stage").description("Run a kk-workflow-stages.ts stage (workflow orchestration steps)").argument("<args...>", "Stage name followed by its positional arguments").allowUnknownOption(true).action((args) => {
27495
+ const code = runStage(args);
27496
+ if (code !== 0) {
27497
+ throw new CommanderError(code, "kk.stage.failed", `stage failed with exit code ${code}`);
27498
+ }
27499
+ });
27500
+ }
27501
+
27502
27502
  // src/config.ts
27503
27503
  import { readFileSync as readFileSync4 } from "fs";
27504
27504
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -27514,6 +27514,7 @@ function createProgram() {
27514
27514
  const program2 = new Command().name(CLI_CONFIG.binaryName).description("knowledge-kit CLI").version(CLI_CONFIG.binaryVersion).option("-v, --verbose", "enable verbose diagnostics");
27515
27515
  registerExecutorCommand(program2);
27516
27516
  registerPluginCommand(program2);
27517
+ registerStageCommand(program2);
27517
27518
  return program2;
27518
27519
  }
27519
27520
 
package/package.json CHANGED
@@ -1,13 +1,31 @@
1
1
  {
2
2
  "name": "@gobing-ai/knowledge-kit",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "An ingest → create → publish content pipeline CLI (Bun).",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/gobing-ai/knowledge-kit.git"
8
8
  },
9
+ "homepage": "https://github.com/gobing-ai/knowledge-kit#readme",
10
+ "bugs": {
11
+ "url": "https://github.com/gobing-ai/knowledge-kit/issues"
12
+ },
13
+ "keywords": [
14
+ "cli",
15
+ "content-pipeline",
16
+ "content-creation",
17
+ "publishing",
18
+ "ingestion",
19
+ "plugins",
20
+ "ai",
21
+ "bun",
22
+ "typescript"
23
+ ],
9
24
  "author": "Robin Min <minlongbing@gmail.com>",
10
25
  "license": "Apache-2.0",
26
+ "engines": {
27
+ "bun": ">=1.3.14"
28
+ },
11
29
  "type": "module",
12
30
  "bin": {
13
31
  "kk": "./dist/index.js",