@gobing-ai/knowledge-kit 0.0.23 → 0.0.24

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 (67) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/index.js +137 -59
  3. package/package.json +4 -4
  4. package/plugins/generations/content-gen/dist/index.js +97 -45
  5. package/plugins/generations/core-facts-gen/dist/index.js +106 -57
  6. package/plugins/generations/daily-article-gen/dist/index.js +105 -56
  7. package/plugins/generations/dailynews-gen/dist/index.js +235 -57
  8. package/plugins/generations/dailynews-gen/src/index.ts +67 -2
  9. package/plugins/generations/dailynews-gen/src/script-builder.ts +36 -15
  10. package/plugins/generations/dailynews-gen/src/script-plan.ts +142 -0
  11. package/plugins/generations/episode-plan-gen/dist/index.js +115 -66
  12. package/plugins/generations/gemini-tts/README.md +24 -0
  13. package/plugins/generations/gemini-tts/dist/index.js +326 -260
  14. package/plugins/generations/gemini-tts/src/gemini-client.ts +41 -11
  15. package/plugins/generations/image-gen/dist/index.js +338 -117
  16. package/plugins/generations/image-gen/presets/formats/daily-news-cover.yaml +19 -0
  17. package/plugins/generations/image-gen/presets/formats/xhs-card.yaml +55 -0
  18. package/plugins/generations/image-gen/presets/styles/daily-news.yaml +9 -0
  19. package/plugins/generations/image-gen/presets/styles/xhs-knowledge.yaml +7 -0
  20. package/plugins/generations/image-gen/src/index.ts +148 -14
  21. package/plugins/generations/image-gen/src/job.ts +30 -0
  22. package/plugins/generations/image-gen/src/providers/errors.ts +91 -0
  23. package/plugins/generations/image-gen/src/providers/types.ts +79 -0
  24. package/plugins/generations/news-report-gen/dist/index.js +136 -55
  25. package/plugins/generations/news-report-gen/src/index.ts +57 -1
  26. package/plugins/generations/voice-gen/dist/index.js +119 -67
  27. package/plugins/ingestions/aihot-ingest/dist/index.js +103 -53
  28. package/plugins/ingestions/horizon-ingest/dist/index.js +102 -53
  29. package/plugins/ingestions/karakeep-local/dist/index.js +273 -224
  30. package/plugins/ingestions/last30days-ingest/dist/index.js +97 -48
  31. package/plugins/ingestions/web-search/dist/index.js +121 -72
  32. package/plugins/kk/config.example.yaml +13 -0
  33. package/plugins/kk/plugin.json +1 -1
  34. package/plugins/kk/scripts/daily-voice-style.zh.md +52 -0
  35. package/plugins/kk/scripts/kk-workflow-stages.ts +433 -16
  36. package/plugins/kk/skills/publish/SKILL.md +24 -1
  37. package/plugins/kk/skills/xhs-images/SKILL.md +89 -0
  38. package/plugins/kk/skills/xhs-images/references/card-layouts.md +35 -0
  39. package/plugins/kk/workflows/kk-daily-ai-voice.yaml +162 -11
  40. package/plugins/publishings/emdash-pub/dist/index.js +94 -45
  41. package/plugins/publishings/infoq-pub/dist/index.js +94 -45
  42. package/plugins/publishings/juejin-pub/dist/index.js +94 -45
  43. package/plugins/publishings/medium-pub/dist/index.js +94 -45
  44. package/plugins/publishings/podcast-pub/dist/index.js +115 -55
  45. package/plugins/publishings/podcast-pub/src/map.ts +30 -10
  46. package/plugins/publishings/podcast-pub/src/show-notes.ts +6 -1
  47. package/plugins/publishings/qiita-pub/dist/index.js +94 -45
  48. package/plugins/publishings/substack-pub/dist/index.js +94 -45
  49. package/plugins/publishings/surfdash-pub/dist/index.js +99 -63
  50. package/plugins/publishings/surfdash-pub/src/index.ts +10 -1
  51. package/plugins/publishings/wechatmp-pub/dist/index.js +94 -45
  52. package/plugins/publishings/x-pub/dist/index.js +94 -45
  53. package/plugins/publishings/xhs-pub/dist/index.js +8908 -229
  54. package/plugins/publishings/xhs-pub/package.json +1 -0
  55. package/plugins/publishings/xhs-pub/plugin.json +1 -1
  56. package/plugins/publishings/xhs-pub/src/automation-guard.ts +128 -0
  57. package/plugins/publishings/xhs-pub/src/index.ts +753 -24
  58. package/plugins/publishings/xhs-pub/src/profile-check.ts +133 -0
  59. package/plugins/publishings/zenn-pub/dist/index.js +94 -45
  60. package/plugins/sp/lib/env.ts +46 -0
  61. package/plugins/sp/lib/inline-run.generated.mjs +1489 -0
  62. package/plugins/sp/scripts/feature-verification-steps.ts +275 -0
  63. package/plugins/sp/scripts/inline-run-setup.ts +571 -47
  64. package/plugins/sp/scripts/wrapup-drift-probe.mjs +190 -0
  65. package/plugins/sp/scripts/wrapup-drift-probe.ts +258 -0
  66. package/plugins/sp/scripts/wrapup-steps.mjs +77 -6
  67. package/plugins/sp/scripts/wrapup-steps.ts +91 -5
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "plugins": [
8
8
  {
9
- "version": "0.0.23",
9
+ "version": "0.0.24",
10
10
  "name": "kk",
11
11
  "source": "./plugins/kk",
12
12
  "description": "knowledge-kit — a set of toolkit for knowledge management"
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.5.11/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.5.11/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.5.11/node_modules/@gobing-ai/ts-utils/dist/cursor.js
14681
+ var init_cursor = () => {};
14682
+
14683
+ // ../../node_modules/.bun/@gobing-ai+ts-utils@0.5.11/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.5.11/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.5.11/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 date5 = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
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
- date5 -= 60000 * d;
17625
+ date6 -= 60000 * d;
17557
17626
  }
17558
- return new Date(date5);
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 errors3 = require_errors();
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 errors3.YAMLWarning(pos, code, message));
19538
+ this.warnings.push(new errors4.YAMLWarning(pos, code, message));
19470
19539
  else
19471
- this.errors.push(new errors3.YAMLParseError(pos, code, message));
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 errors3.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg);
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 errors3.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", msg));
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 errors3.YAMLParseError(getErrorPos(token), "UNEXPECTED_TOKEN", `Unsupported token ${token.type}`));
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 errors3 = require_errors();
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 errors3.YAMLParseError([offset, offset + 1], code, message);
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 errors3 = require_errors();
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(errors3.prettifyError(source, lineCounter2));
21515
- doc2.warnings.forEach(errors3.prettifyError(source, lineCounter2));
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 errors3.YAMLParseError(_doc.range.slice(0, 2), "MULTIPLE_DOCS", "Source contains multiple documents; please use YAML.parseAllDocuments()"));
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(errors3.prettifyError(source, lineCounter2));
21536
- doc2.warnings.forEach(errors3.prettifyError(source, lineCounter2));
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, 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(() => {
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
- errors3 = require_errors();
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 = errors3.YAMLError;
21610
- $YAMLParseError = errors3.YAMLParseError;
21611
- $YAMLWarning = errors3.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.39/node_modules/@gobing-ai/ts-runtime/dist/config.js
21705
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.11/node_modules/@gobing-ai/ts-runtime/dist/config.js
21637
21706
  var configSchema;
21638
21707
  var init_config = __esm(() => {
21639
- init_dist();
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.39/node_modules/@gobing-ai/ts-runtime/dist/file-system-node.js
21729
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.11/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.39+6ae14a6e2b3a5898/node_modules/@gobing-ai/ts-infra/dist/logger.js
23941
+ // ../../node_modules/.bun/@gobing-ai+ts-infra@0.5.11+b4fe47d5f279554c/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;
@@ -26332,38 +26401,20 @@ function isDirectory(path2) {
26332
26401
  function getByName(result, name) {
26333
26402
  return result.plugins.find((p) => p.name === name);
26334
26403
  }
26335
- // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.4.39/node_modules/@gobing-ai/ts-runtime/dist/index.js
26404
+ // ../../node_modules/.bun/@gobing-ai+ts-runtime@0.5.11/node_modules/@gobing-ai/ts-runtime/dist/index.js
26336
26405
  init_file_system_node();
26337
26406
  init_config();
26338
26407
 
26339
- // ../../node_modules/.bun/@gobing-ai+ts-utils@0.4.67/node_modules/@gobing-ai/ts-utils/dist/output.js
26340
- var defaultStdoutTarget;
26341
- var defaultStderrTarget;
26342
- function processStream(name) {
26343
- const proc = globalThis.process;
26344
- const stream = proc?.[name];
26345
- if (stream === undefined) {
26346
- throw new Error(`No ${name} target available: set one via setDefaultOutputTargets or pass an explicit target`);
26347
- }
26348
- return stream;
26349
- }
26350
- function writeLine(message, target) {
26351
- target.write(`${message}
26352
- `);
26353
- }
26354
- function echo(message, target = defaultStdoutTarget ?? processStream("stdout")) {
26355
- writeLine(message, target);
26356
- }
26357
- function echoError(message, target = defaultStderrTarget ?? processStream("stderr")) {
26358
- writeLine(message, target);
26359
- }
26360
-
26361
26408
  // ../../packages/kk-core/src/render-md.ts
26362
26409
  if (false) {}
26410
+ // src/fanin.ts
26411
+ init_dist();
26412
+
26363
26413
  // src/invoke.ts
26364
26414
  import { existsSync as existsSync3, readFileSync as readFileSync3, statSync as statSync3, unlinkSync } from "fs";
26365
26415
  import { homedir as homedir2 } from "os";
26366
26416
  import { isAbsolute, join as join2, resolve as resolve2 } from "path";
26417
+ init_dist();
26367
26418
 
26368
26419
  // src/plugin-output.ts
26369
26420
  function formatIssues(error51) {
@@ -26954,6 +27005,7 @@ async function runFanin(argv) {
26954
27005
  // src/fanout.ts
26955
27006
  import { tmpdir as tmpdir2 } from "os";
26956
27007
  import { isAbsolute as isAbsolute3, join as join4, resolve as resolve4 } from "path";
27008
+ init_dist();
26957
27009
  var EXIT_FAILURE = 1;
26958
27010
  var EXIT_INPUT2 = 2;
26959
27011
  function aggregate(entries) {
@@ -27362,8 +27414,10 @@ function registerExecutorCommand(program2) {
27362
27414
  // src/commands/plugin.ts
27363
27415
  import { existsSync as existsSync4 } from "fs";
27364
27416
  import { resolve as resolve5 } from "path";
27417
+ init_dist();
27365
27418
 
27366
27419
  // src/output.ts
27420
+ init_dist();
27367
27421
  function withoutFinalLineEnding(message) {
27368
27422
  return message.replace(/\r?\n$/, "");
27369
27423
  }
@@ -27479,25 +27533,49 @@ function registerPluginCommand(program2) {
27479
27533
 
27480
27534
  // src/stage.ts
27481
27535
  import { spawnSync } from "child_process";
27482
- import { existsSync as existsSync5, realpathSync as realpathSync3 } from "fs";
27536
+ import { realpathSync as realpathSync3, statSync as statSync4 } from "fs";
27483
27537
  import { dirname as dirname3, join as join5, resolve as resolve6 } from "path";
27484
27538
  var STAGES_REL = "plugins/kk/scripts/kk-workflow-stages.ts";
27539
+ var CHECKOUT_MARKER_REL = "apps/cli/src/stage.ts";
27485
27540
  var CHECKOUT_ROOT = resolve6(import.meta.dir, "../../..");
27541
+ var INSTALL_GUIDANCE = "install or refresh the kk package (bun link in a checkout)";
27542
+ function isFile(path3) {
27543
+ try {
27544
+ return statSync4(path3, { throwIfNoEntry: false })?.isFile() ?? false;
27545
+ } catch {
27546
+ return false;
27547
+ }
27548
+ }
27549
+ function canonical(path3) {
27550
+ try {
27551
+ return realpathSync3(path3);
27552
+ } catch {
27553
+ return "";
27554
+ }
27555
+ }
27486
27556
  function resolveStagesScript(argv1 = process.argv[1], checkoutRoot = CHECKOUT_ROOT) {
27557
+ const fromCheckout = join5(checkoutRoot, STAGES_REL);
27558
+ const checkoutMarker = join5(checkoutRoot, CHECKOUT_MARKER_REL);
27487
27559
  let fromPkg = "";
27560
+ let entryPkgRoot = "";
27488
27561
  if (argv1) {
27489
- try {
27490
- fromPkg = join5(dirname3(dirname3(realpathSync3(argv1))), STAGES_REL);
27491
- } catch {
27492
- fromPkg = "";
27562
+ const realEntry = canonical(argv1);
27563
+ if (realEntry) {
27564
+ entryPkgRoot = dirname3(dirname3(realEntry));
27565
+ fromPkg = join5(entryPkgRoot, STAGES_REL);
27493
27566
  }
27494
27567
  }
27495
- if (fromPkg && existsSync5(fromPkg))
27568
+ const checkoutEntry = isFile(checkoutMarker) && entryPkgRoot !== "" && canonical(join5(checkoutRoot, "apps/cli")) === entryPkgRoot;
27569
+ if (checkoutEntry) {
27570
+ if (isFile(fromCheckout))
27571
+ return fromCheckout;
27572
+ throw new Error(`kk-workflow-stages.ts not found at ${fromCheckout} \u2014 ${INSTALL_GUIDANCE}`);
27573
+ }
27574
+ if (fromPkg && isFile(fromPkg))
27496
27575
  return fromPkg;
27497
- const fromCheckout = join5(checkoutRoot, STAGES_REL);
27498
- if (existsSync5(fromCheckout))
27576
+ if (isFile(checkoutMarker) && isFile(fromCheckout))
27499
27577
  return fromCheckout;
27500
- 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)`);
27578
+ throw new Error(`kk-workflow-stages.ts not found at ${fromPkg || STAGES_REL} \u2014 ${INSTALL_GUIDANCE}`);
27501
27579
  }
27502
27580
  function runStage(args, execPath = process.execPath, argv1) {
27503
27581
  const script = resolveStagesScript(argv1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobing-ai/knowledge-kit",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "description": "An ingest → create → publish content pipeline CLI (Bun).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,9 +46,9 @@
46
46
  "typecheck": "tsc --noEmit"
47
47
  },
48
48
  "dependencies": {
49
- "@gobing-ai/ts-infra": "^0.4.39",
50
- "@gobing-ai/ts-runtime": "^0.4.39",
51
- "@gobing-ai/ts-utils": "^0.4.39",
49
+ "@gobing-ai/ts-infra": "^0.5.11",
50
+ "@gobing-ai/ts-runtime": "^0.5.11",
51
+ "@gobing-ai/ts-utils": "^0.5.11",
52
52
  "commander": "15.0.0"
53
53
  },
54
54
  "devDependencies": {