cngkit 1.1.19 → 1.1.20

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 (58) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +9 -9
  3. package/dist/{chunk-TYDIBWZV.js → chunk-CIZBVLN5.js} +2 -2
  4. package/dist/{chunk-GBONV6XP.js → chunk-E2GLGGKO.js} +3 -3
  5. package/dist/chunk-MRXGD6TC.js +42 -0
  6. package/dist/chunk-MRXGD6TC.js.map +1 -0
  7. package/dist/{chunk-L6ZVQRSY.js → chunk-NODJM6SH.js} +141 -52
  8. package/dist/chunk-NODJM6SH.js.map +1 -0
  9. package/dist/{chunk-3A6GRNEV.js → chunk-SKK2XLRZ.js} +21 -21
  10. package/dist/chunk-SKK2XLRZ.js.map +1 -0
  11. package/dist/{chunk-DBA3BZXP.js → chunk-SMTQ3W3F.js} +50 -10
  12. package/dist/chunk-SMTQ3W3F.js.map +1 -0
  13. package/dist/{chunk-7SO75QXJ.js → chunk-WDI43VPW.js} +108 -88
  14. package/dist/chunk-WDI43VPW.js.map +1 -0
  15. package/dist/cli.js +63 -24
  16. package/dist/cli.js.map +1 -1
  17. package/dist/commands/coderoom/index.js +3 -3
  18. package/dist/commands/coderoom/join.js +4 -4
  19. package/dist/commands/coderoom/share.js +4 -4
  20. package/dist/commands/hookify/index.js +3 -3
  21. package/dist/commands/hookify/ingest.js +3 -3
  22. package/dist/commands/hooks/index.js +3 -3
  23. package/dist/commands/hooks/install.js +3 -3
  24. package/dist/commands/hooks/uninstall.js +3 -3
  25. package/dist/commands/index.js +3 -3
  26. package/dist/commands/knowledges/audiences.js +5 -5
  27. package/dist/commands/knowledges/cat.js +5 -5
  28. package/dist/commands/knowledges/files.js +5 -5
  29. package/dist/commands/knowledges/find.js +5 -5
  30. package/dist/commands/knowledges/glob.js +5 -5
  31. package/dist/commands/knowledges/grep.js +5 -5
  32. package/dist/commands/knowledges/head.js +5 -5
  33. package/dist/commands/knowledges/index.js +3 -3
  34. package/dist/commands/knowledges/list.js +5 -5
  35. package/dist/commands/knowledges/ls.js +5 -5
  36. package/dist/commands/knowledges/read.js +5 -5
  37. package/dist/commands/knowledges/realpath.js +6 -6
  38. package/dist/commands/knowledges/realpath.js.map +1 -1
  39. package/dist/commands/knowledges/search.js +5 -5
  40. package/dist/commands/knowledges/stat.js +5 -5
  41. package/dist/commands/knowledges/status.js +5 -5
  42. package/dist/commands/knowledges/tail.js +5 -5
  43. package/dist/commands/knowledges/tree.js +5 -5
  44. package/dist/commands/login.js +3 -3
  45. package/dist/commands/login.js.map +1 -1
  46. package/dist/commands/scrub.js +37 -14
  47. package/dist/commands/scrub.js.map +1 -1
  48. package/dist/commands/transcripts.js +41 -21
  49. package/dist/commands/transcripts.js.map +1 -1
  50. package/package.json +2 -3
  51. package/dist/chunk-3A6GRNEV.js.map +0 -1
  52. package/dist/chunk-7SO75QXJ.js.map +0 -1
  53. package/dist/chunk-DBA3BZXP.js.map +0 -1
  54. package/dist/chunk-L6ZVQRSY.js.map +0 -1
  55. package/dist/chunk-X4E7NAN4.js +0 -26
  56. package/dist/chunk-X4E7NAN4.js.map +0 -1
  57. /package/dist/{chunk-TYDIBWZV.js.map → chunk-CIZBVLN5.js.map} +0 -0
  58. /package/dist/{chunk-GBONV6XP.js.map → chunk-E2GLGGKO.js.map} +0 -0
@@ -34,10 +34,9 @@ function createPeerId() {
34
34
 
35
35
  // src/shared/output.ts
36
36
  import process3 from "process";
37
- import { createElement } from "react";
38
- import { renderToString, Text } from "ink";
37
+ import { createElement, useEffect } from "react";
38
+ import { Static, Text, useStderr, useStdout } from "ink";
39
39
  import Markdown from "@inkkit/ink-markdown";
40
- import stripAnsi from "strip-ansi";
41
40
 
42
41
  // ../../packages/client/src/generated/core/json.ts
43
42
  var toJson = (value, replacer, space) => {
@@ -328,7 +327,7 @@ var HarnessDatabaseBinding;
328
327
  var HarnessSemanticSearchResponse;
329
328
  ((HarnessSemanticSearchResponse2) => {
330
329
  HarnessSemanticSearchResponse2.Model = {
331
- PostgresTextSearch: "postgres-text-search"
330
+ HarnessSemanticTextSearch: "harness-semantic-text-search"
332
331
  };
333
332
  })(HarnessSemanticSearchResponse || (HarnessSemanticSearchResponse = {}));
334
333
 
@@ -2770,7 +2769,6 @@ var HarnessInternalKnowledgesClient = class {
2770
2769
  * uploadedAt: "uploadedAt",
2771
2770
  * files: [{
2772
2771
  * path: "path",
2773
- * slug: "slug",
2774
2772
  * sha256: "sha256",
2775
2773
  * size: 1,
2776
2774
  * mode: "mode",
@@ -2900,35 +2898,27 @@ var HarnessInternalKnowledgesClient = class {
2900
2898
  );
2901
2899
  }
2902
2900
  /**
2903
- * @param {CngApi.HarnessUploadTopicAssetsIndexRequest} request
2904
2901
  * @param {HarnessInternalKnowledgesClient.RequestOptions} requestOptions - Request-specific configuration.
2905
2902
  *
2906
2903
  * @throws {@link CngApi.UnauthorizedError}
2907
- * @throws {@link CngApi.InternalServerError}
2904
+ * @throws {@link CngApi.ConflictError}
2908
2905
  *
2909
2906
  * @example
2910
- * await client.harnessInternalKnowledges.createHarnessTopicAssetsIndex({
2911
- * runId: "runId",
2912
- * offset: 1,
2913
- * limit: 1
2914
- * })
2907
+ * await client.harnessInternalKnowledges.cleanHarnessKnowledgesCatalog()
2915
2908
  */
2916
- createHarnessTopicAssetsIndex(request, requestOptions) {
2917
- return HttpResponsePromise.fromPromise(this.__createHarnessTopicAssetsIndex(request, requestOptions));
2909
+ cleanHarnessKnowledgesCatalog(requestOptions) {
2910
+ return HttpResponsePromise.fromPromise(this.__cleanHarnessKnowledgesCatalog(requestOptions));
2918
2911
  }
2919
- async __createHarnessTopicAssetsIndex(request, requestOptions) {
2912
+ async __cleanHarnessKnowledgesCatalog(requestOptions) {
2920
2913
  const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
2921
2914
  const _response = await fetcher({
2922
2915
  url: url_exports.join(
2923
2916
  await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
2924
- "api/harness/internal/knowledges/indexes"
2917
+ "api/harness/internal/knowledges/catalog"
2925
2918
  ),
2926
- method: "POST",
2919
+ method: "DELETE",
2927
2920
  headers: _headers,
2928
- contentType: "application/json",
2929
2921
  queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
2930
- requestType: "json",
2931
- body: request,
2932
2922
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
2933
2923
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
2934
2924
  abortSignal: requestOptions?.abortSignal,
@@ -2936,17 +2926,14 @@ var HarnessInternalKnowledgesClient = class {
2936
2926
  logging: this._options.logging
2937
2927
  });
2938
2928
  if (_response.ok) {
2939
- return {
2940
- data: _response.body,
2941
- rawResponse: _response.rawResponse
2942
- };
2929
+ return { data: _response.body, rawResponse: _response.rawResponse };
2943
2930
  }
2944
2931
  if (_response.error.reason === "status-code") {
2945
2932
  switch (_response.error.statusCode) {
2946
2933
  case 401:
2947
2934
  throw new UnauthorizedError(_response.error.body, _response.rawResponse);
2948
- case 500:
2949
- throw new InternalServerError(
2935
+ case 409:
2936
+ throw new ConflictError(
2950
2937
  _response.error.body,
2951
2938
  _response.rawResponse
2952
2939
  );
@@ -2961,8 +2948,8 @@ var HarnessInternalKnowledgesClient = class {
2961
2948
  return handleNonStatusCodeError(
2962
2949
  _response.error,
2963
2950
  _response.rawResponse,
2964
- "POST",
2965
- "/api/harness/internal/knowledges/indexes"
2951
+ "DELETE",
2952
+ "/api/harness/internal/knowledges/catalog"
2966
2953
  );
2967
2954
  }
2968
2955
  };
@@ -3869,38 +3856,112 @@ function createMarkdownTheme(useColor) {
3869
3856
  }
3870
3857
 
3871
3858
  // src/shared/output.ts
3872
- var consoleOutput = createCommandOutput(process3.stdout, process3.stderr);
3873
- function createCommandOutput(stdout, stderr) {
3859
+ function createCommandOutput(sink) {
3860
+ const stdout = sink.stdout ?? process3.stdout;
3861
+ const stderr = sink.stderr ?? process3.stderr;
3874
3862
  return {
3875
3863
  info(message) {
3876
- writeStyledMessage(stdout, "info", message);
3864
+ appendStyledMessage(sink, stdout, "stdout", "info", message);
3877
3865
  },
3878
3866
  success(message) {
3879
- writeStyledMessage(stdout, "success", message);
3867
+ appendStyledMessage(sink, stdout, "stdout", "success", message);
3880
3868
  },
3881
3869
  warning(message) {
3882
- writeStyledMessage(stdout, "warning", message);
3870
+ appendStyledMessage(sink, stdout, "stdout", "warning", message);
3883
3871
  },
3884
3872
  muted(message) {
3885
- writeStyledMessage(stdout, "muted", message);
3873
+ appendStyledMessage(sink, stdout, "stdout", "muted", message);
3886
3874
  },
3887
3875
  markdown(message) {
3888
- stdout.write(`${formatMarkdownMessage(stdout, message)}
3876
+ if (resolveOutputFormat() === "markdown") {
3877
+ stdout.write(`${message}
3878
+ `);
3879
+ return;
3880
+ }
3881
+ if (sink.appendMessage) {
3882
+ sink.appendMessage({ kind: "markdown", message: prepareMarkdownForTerminal(message) });
3883
+ return;
3884
+ }
3885
+ stdout.write(`${message}
3889
3886
  `);
3890
3887
  },
3891
3888
  component(element) {
3892
- stdout.write(`${formatComponentMessage(stdout, element)}
3893
- `);
3889
+ if (sink.appendMessage) {
3890
+ sink.appendMessage({ kind: "component", element });
3891
+ return;
3892
+ }
3893
+ stdout.write("\n");
3894
3894
  },
3895
3895
  raw(message) {
3896
3896
  stdout.write(`${message}
3897
3897
  `);
3898
3898
  },
3899
3899
  error(message) {
3900
- writeStyledMessage(stderr, "error", message);
3900
+ appendStyledMessage(sink, stderr, "stderr", "error", message);
3901
3901
  }
3902
3902
  };
3903
3903
  }
3904
+ function CommandOutputMessages({
3905
+ messages
3906
+ }) {
3907
+ const { stdout } = useStdout();
3908
+ const width = clampMarkdownWidth(stdout.columns);
3909
+ const useColor = shouldRenderColor(stdout);
3910
+ if (messages.length === 0) {
3911
+ return null;
3912
+ }
3913
+ return createElement(
3914
+ Static,
3915
+ {
3916
+ items: [...messages],
3917
+ style: { flexDirection: "column" },
3918
+ children: (message) => createElement(CommandOutputMessageView, {
3919
+ key: message.id,
3920
+ message,
3921
+ useColor,
3922
+ width
3923
+ })
3924
+ }
3925
+ );
3926
+ }
3927
+ function CommandOutputMessageView({
3928
+ message,
3929
+ useColor,
3930
+ width
3931
+ }) {
3932
+ if (message.kind === "styled") {
3933
+ if (message.stream === "stderr") {
3934
+ return createElement(StderrLine, { message: message.message });
3935
+ }
3936
+ return createElement(
3937
+ Text,
3938
+ {
3939
+ ...statusStylePropsByOutputStyle[message.style],
3940
+ wrap: "wrap"
3941
+ },
3942
+ message.message
3943
+ );
3944
+ }
3945
+ if (message.kind === "markdown") {
3946
+ return createElement(
3947
+ Markdown,
3948
+ {
3949
+ ...createMarkdownTheme(useColor),
3950
+ width
3951
+ },
3952
+ message.message
3953
+ );
3954
+ }
3955
+ return message.element;
3956
+ }
3957
+ function StderrLine({ message }) {
3958
+ const { write } = useStderr();
3959
+ useEffect(() => {
3960
+ write(`${message}
3961
+ `);
3962
+ }, [message, write]);
3963
+ return null;
3964
+ }
3904
3965
  function formatError(error) {
3905
3966
  if (error instanceof CngApiError) {
3906
3967
  return formatApiError(error);
@@ -3941,54 +4002,13 @@ function extractBodyErrorMessage(body) {
3941
4002
  }
3942
4003
  return void 0;
3943
4004
  }
3944
- function writeStyledMessage(stream, style, message) {
3945
- stream.write(`${formatStyledMessage(stream, style, message)}
3946
- `);
3947
- }
3948
- function formatStyledMessage(stream, style, message) {
3949
- if (!shouldRenderColor(stream)) {
3950
- return message;
4005
+ function appendStyledMessage(sink, stream, streamName, style, message) {
4006
+ if (sink.appendMessage) {
4007
+ sink.appendMessage({ kind: "styled", stream: streamName, style, message });
4008
+ return;
3951
4009
  }
3952
- return renderToString(
3953
- createElement(
3954
- Text,
3955
- {
3956
- ...statusStylePropsByOutputStyle[style],
3957
- wrap: "wrap"
3958
- },
3959
- message
3960
- ),
3961
- {
3962
- columns: 1e4
3963
- }
3964
- );
3965
- }
3966
- function formatMarkdownMessage(stream, markdown) {
3967
- if (resolveOutputFormat() === "markdown") {
3968
- return markdown;
3969
- }
3970
- const useColor = shouldRenderColor(stream);
3971
- const markdownWidth = clampMarkdownWidth(stream.columns);
3972
- const preparedMarkdown = prepareMarkdownForTerminal(markdown);
3973
- const renderedMarkdown = renderToString(
3974
- createElement(Markdown, {
3975
- ...createMarkdownTheme(useColor),
3976
- children: preparedMarkdown,
3977
- width: markdownWidth
3978
- }),
3979
- {
3980
- columns: markdownWidth
3981
- }
3982
- );
3983
- return useColor ? renderedMarkdown.trimEnd() : stripAnsi(renderedMarkdown).trimEnd();
3984
- }
3985
- function formatComponentMessage(stream, element) {
3986
- const useColor = shouldRenderColor(stream);
3987
- const renderWidth = clampMarkdownWidth(stream.columns);
3988
- const rendered = renderToString(element, {
3989
- columns: renderWidth
3990
- });
3991
- return useColor ? rendered.trimEnd() : stripAnsi(rendered).trimEnd();
4010
+ stream.write(`${message}
4011
+ `);
3992
4012
  }
3993
4013
  function prepareMarkdownForTerminal(markdown) {
3994
4014
  if (!markdown.startsWith("---\n")) {
@@ -4038,15 +4058,15 @@ function clampMarkdownWidth(columns) {
4038
4058
  }
4039
4059
 
4040
4060
  export {
4041
- CngApiClient,
4042
4061
  packageVersion,
4043
4062
  resolveApiBaseUrl,
4044
4063
  resolveOutputFormat,
4045
4064
  parseOutputFormat,
4046
4065
  createRoomCode,
4047
4066
  createPeerId,
4048
- consoleOutput,
4067
+ CngApiClient,
4049
4068
  createCommandOutput,
4069
+ CommandOutputMessages,
4050
4070
  formatError
4051
4071
  };
4052
- //# sourceMappingURL=chunk-7SO75QXJ.js.map
4072
+ //# sourceMappingURL=chunk-WDI43VPW.js.map