cngkit 1.1.21 → 1.1.23

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 (87) hide show
  1. package/LICENSE +198 -4
  2. package/README.md +22 -12
  3. package/dist/{chunk-NGEWD4BW.js → chunk-25Q463MH.js} +1 -2
  4. package/dist/{chunk-SMTQ3W3F.js → chunk-3BATDTKU.js} +131 -112
  5. package/dist/chunk-3BATDTKU.js.map +1 -0
  6. package/dist/{chunk-DIJEVOVN.js → chunk-67FUBMNB.js} +71 -240
  7. package/dist/chunk-67FUBMNB.js.map +1 -0
  8. package/dist/chunk-AS7FIJWP.js +88 -0
  9. package/dist/chunk-AS7FIJWP.js.map +1 -0
  10. package/dist/chunk-BRFWVQI4.js +18 -0
  11. package/dist/chunk-BRFWVQI4.js.map +1 -0
  12. package/dist/{chunk-CVF2ODLP.js → chunk-BXS4IKUA.js} +300 -143
  13. package/dist/chunk-BXS4IKUA.js.map +1 -0
  14. package/dist/{chunk-YJXAH7D5.js → chunk-GYRLVNJX.js} +2 -2
  15. package/dist/chunk-GYRLVNJX.js.map +1 -0
  16. package/dist/{chunk-SKK2XLRZ.js → chunk-JNHW72SU.js} +21 -15
  17. package/dist/chunk-JNHW72SU.js.map +1 -0
  18. package/dist/chunk-U725ZHCI.js +67 -0
  19. package/dist/chunk-U725ZHCI.js.map +1 -0
  20. package/dist/chunk-VMTXY4KQ.js +111 -0
  21. package/dist/chunk-VMTXY4KQ.js.map +1 -0
  22. package/dist/chunk-WIEYHKQA.js +268 -0
  23. package/dist/chunk-WIEYHKQA.js.map +1 -0
  24. package/dist/chunk-YALWTRIP.js +102 -0
  25. package/dist/chunk-YALWTRIP.js.map +1 -0
  26. package/dist/cli.js +2 -2
  27. package/dist/cli.js.map +1 -1
  28. package/dist/commands/coderoom/index.js +4 -4
  29. package/dist/commands/coderoom/join.js +5 -5
  30. package/dist/commands/coderoom/share.js +8 -11
  31. package/dist/commands/coderoom/share.js.map +1 -1
  32. package/dist/commands/hookify/index.js +4 -4
  33. package/dist/commands/hookify/ingest.js +4 -4
  34. package/dist/commands/hooks/index.js +4 -4
  35. package/dist/commands/hooks/install.js +4 -4
  36. package/dist/commands/hooks/uninstall.js +4 -4
  37. package/dist/commands/index.js +3 -3
  38. package/dist/commands/knowledges/audiences.js +26 -8
  39. package/dist/commands/knowledges/audiences.js.map +1 -1
  40. package/dist/commands/knowledges/cat.js +26 -7
  41. package/dist/commands/knowledges/cat.js.map +1 -1
  42. package/dist/commands/knowledges/files.js +39 -8
  43. package/dist/commands/knowledges/files.js.map +1 -1
  44. package/dist/commands/knowledges/find.js +48 -8
  45. package/dist/commands/knowledges/find.js.map +1 -1
  46. package/dist/commands/knowledges/glob.js +41 -8
  47. package/dist/commands/knowledges/glob.js.map +1 -1
  48. package/dist/commands/knowledges/grep.js +73 -8
  49. package/dist/commands/knowledges/grep.js.map +1 -1
  50. package/dist/commands/knowledges/head.js +31 -8
  51. package/dist/commands/knowledges/head.js.map +1 -1
  52. package/dist/commands/knowledges/index.js +4 -4
  53. package/dist/commands/knowledges/list.js +39 -8
  54. package/dist/commands/knowledges/list.js.map +1 -1
  55. package/dist/commands/knowledges/ls.js +47 -8
  56. package/dist/commands/knowledges/ls.js.map +1 -1
  57. package/dist/commands/knowledges/read.js +46 -8
  58. package/dist/commands/knowledges/read.js.map +1 -1
  59. package/dist/commands/knowledges/realpath.js +23 -8
  60. package/dist/commands/knowledges/realpath.js.map +1 -1
  61. package/dist/commands/knowledges/search.js +34 -8
  62. package/dist/commands/knowledges/search.js.map +1 -1
  63. package/dist/commands/knowledges/stat.js +32 -8
  64. package/dist/commands/knowledges/stat.js.map +1 -1
  65. package/dist/commands/knowledges/status.js +26 -8
  66. package/dist/commands/knowledges/status.js.map +1 -1
  67. package/dist/commands/knowledges/tail.js +30 -8
  68. package/dist/commands/knowledges/tail.js.map +1 -1
  69. package/dist/commands/knowledges/tree.js +38 -8
  70. package/dist/commands/knowledges/tree.js.map +1 -1
  71. package/dist/commands/login.js +3 -3
  72. package/dist/commands/login.js.map +1 -1
  73. package/dist/commands/scrub.js +3 -3
  74. package/dist/commands/scrub.js.map +1 -1
  75. package/dist/commands/transcripts.js +137 -119
  76. package/dist/commands/transcripts.js.map +1 -1
  77. package/package.json +2 -2
  78. package/dist/chunk-52PGDSFU.js +0 -42
  79. package/dist/chunk-52PGDSFU.js.map +0 -1
  80. package/dist/chunk-5WTRGYAO.js +0 -658
  81. package/dist/chunk-5WTRGYAO.js.map +0 -1
  82. package/dist/chunk-CVF2ODLP.js.map +0 -1
  83. package/dist/chunk-DIJEVOVN.js.map +0 -1
  84. package/dist/chunk-SKK2XLRZ.js.map +0 -1
  85. package/dist/chunk-SMTQ3W3F.js.map +0 -1
  86. package/dist/chunk-YJXAH7D5.js.map +0 -1
  87. /package/dist/{chunk-NGEWD4BW.js.map → chunk-25Q463MH.js.map} +0 -0
@@ -3,9 +3,8 @@ import {
3
3
  } from "./chunk-PZ5AY32C.js";
4
4
 
5
5
  // src/shared/config.ts
6
- import { randomBytes, randomUUID } from "crypto";
7
6
  import process2 from "process";
8
- var packageVersion = "1.1.21";
7
+ var packageVersion = "1.1.23";
9
8
  var defaultApiBaseUrl = "https://curly.ng";
10
9
  function resolveApiBaseUrl(options) {
11
10
  void options;
@@ -25,18 +24,6 @@ function parseOutputFormat(value) {
25
24
  }
26
25
  throw new Error("Unknown --format value. Use one of: text, json, markdown.");
27
26
  }
28
- function createRoomCode() {
29
- return randomBytes(4).toString("hex").toUpperCase();
30
- }
31
- function createPeerId() {
32
- return randomUUID();
33
- }
34
-
35
- // src/shared/output.ts
36
- import process3 from "process";
37
- import { createElement, useEffect } from "react";
38
- import { Static, Text, useStderr, useStdout } from "ink";
39
- import Markdown from "@inkkit/ink-markdown";
40
27
 
41
28
  // ../../packages/client/src/generated/core/json.ts
42
29
  var toJson = (value, replacer, space) => {
@@ -2119,6 +2106,61 @@ var AuthClient = class {
2119
2106
  }
2120
2107
  };
2121
2108
 
2109
+ // ../../packages/client/src/generated/api/resources/coderoom/client/Client.ts
2110
+ var CoderoomClient = class {
2111
+ _options;
2112
+ constructor(options = {}) {
2113
+ this._options = normalizeClientOptions(options);
2114
+ }
2115
+ /**
2116
+ * @param {CoderoomClient.RequestOptions} requestOptions - Request-specific configuration.
2117
+ *
2118
+ * @throws {@link CngApi.InternalServerError}
2119
+ * @throws {@link CngApi.ServiceUnavailableError}
2120
+ *
2121
+ * @example
2122
+ * await client.coderoom.createCoderoomRoom()
2123
+ */
2124
+ createCoderoomRoom(requestOptions) {
2125
+ return HttpResponsePromise.fromPromise(this.__createCoderoomRoom(requestOptions));
2126
+ }
2127
+ async __createCoderoomRoom(requestOptions) {
2128
+ const _headers = mergeHeaders(this._options?.headers, requestOptions?.headers);
2129
+ const _response = await fetcher({
2130
+ url: url_exports.join(
2131
+ await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? CngApiEnvironment.Default,
2132
+ "api/cng/coderoom/rooms"
2133
+ ),
2134
+ method: "POST",
2135
+ headers: _headers,
2136
+ queryString: url_exports.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
2137
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1e3,
2138
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
2139
+ abortSignal: requestOptions?.abortSignal,
2140
+ fetchFn: this._options?.fetch,
2141
+ logging: this._options.logging
2142
+ });
2143
+ if (_response.ok) {
2144
+ return { data: _response.body, rawResponse: _response.rawResponse };
2145
+ }
2146
+ if (_response.error.reason === "status-code") {
2147
+ switch (_response.error.statusCode) {
2148
+ case 500:
2149
+ throw new InternalServerError(_response.error.body, _response.rawResponse);
2150
+ case 503:
2151
+ throw new ServiceUnavailableError(_response.error.body, _response.rawResponse);
2152
+ default:
2153
+ throw new CngApiError({
2154
+ statusCode: _response.error.statusCode,
2155
+ body: _response.error.body,
2156
+ rawResponse: _response.rawResponse
2157
+ });
2158
+ }
2159
+ }
2160
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/api/cng/coderoom/rooms");
2161
+ }
2162
+ };
2163
+
2122
2164
  // ../../packages/client/src/generated/api/resources/harnessFilesystem/client/Client.ts
2123
2165
  var HarnessFilesystemClient = class {
2124
2166
  _options;
@@ -3135,10 +3177,7 @@ var HarnessKnowledgesClient = class {
3135
3177
  if (_response.error.reason === "status-code") {
3136
3178
  switch (_response.error.statusCode) {
3137
3179
  case 500:
3138
- throw new InternalServerError(
3139
- _response.error.body,
3140
- _response.rawResponse
3141
- );
3180
+ throw new InternalServerError(_response.error.body, _response.rawResponse);
3142
3181
  default:
3143
3182
  throw new CngApiError({
3144
3183
  statusCode: _response.error.statusCode,
@@ -3741,6 +3780,7 @@ var CngApiClient = class {
3741
3780
  _telemetry;
3742
3781
  _llm;
3743
3782
  _hookify;
3783
+ _coderoom;
3744
3784
  constructor(options = {}) {
3745
3785
  this._options = normalizeClientOptions(options);
3746
3786
  }
@@ -3771,6 +3811,9 @@ var CngApiClient = class {
3771
3811
  get hookify() {
3772
3812
  return this._hookify ??= new HookifyClient(this._options);
3773
3813
  }
3814
+ get coderoom() {
3815
+ return this._coderoom ??= new CoderoomClient(this._options);
3816
+ }
3774
3817
  /**
3775
3818
  * Make a passthrough request using the SDK's configured auth, retry, logging, etc.
3776
3819
  * This is useful for making requests to endpoints not yet supported in the SDK.
@@ -3805,163 +3848,7 @@ var logging;
3805
3848
  logging2.ConsoleLogger = ConsoleLogger;
3806
3849
  })(logging || (logging = {}));
3807
3850
 
3808
- // src/shared/theme.ts
3809
- import { Chalk } from "chalk";
3810
- var statusStylePropsByOutputStyle = {
3811
- info: {
3812
- color: "cyan"
3813
- },
3814
- success: {
3815
- color: "green",
3816
- bold: true
3817
- },
3818
- warning: {
3819
- color: "yellow",
3820
- bold: true
3821
- },
3822
- muted: {
3823
- dimColor: true
3824
- },
3825
- error: {
3826
- color: "red",
3827
- bold: true
3828
- }
3829
- };
3830
- function createMarkdownTheme(useColor) {
3831
- const chalk = new Chalk({ level: useColor ? 1 : 0 });
3832
- const identity = (value) => value;
3833
- return {
3834
- code: chalk.green,
3835
- blockquote: chalk.dim.italic,
3836
- html: chalk.gray,
3837
- heading: chalk.blueBright.bold,
3838
- firstHeading: chalk.magentaBright.bold,
3839
- hr: chalk.gray,
3840
- listitem: identity,
3841
- table: identity,
3842
- paragraph: identity,
3843
- strong: chalk.bold,
3844
- em: chalk.italic,
3845
- codespan: chalk.cyanBright,
3846
- del: chalk.dim.strikethrough,
3847
- link: chalk.blueBright,
3848
- href: chalk.blue.underline,
3849
- text: identity,
3850
- showSectionPrefix: false,
3851
- reflowText: true,
3852
- unescape: true,
3853
- emoji: false,
3854
- tab: 2
3855
- };
3856
- }
3857
-
3858
- // src/shared/output.ts
3859
- function createCommandOutput(sink) {
3860
- const stdout = sink.stdout ?? process3.stdout;
3861
- const stderr = sink.stderr ?? process3.stderr;
3862
- return {
3863
- info(message) {
3864
- appendStyledMessage(sink, stdout, "stdout", "info", message);
3865
- },
3866
- success(message) {
3867
- appendStyledMessage(sink, stdout, "stdout", "success", message);
3868
- },
3869
- warning(message) {
3870
- appendStyledMessage(sink, stdout, "stdout", "warning", message);
3871
- },
3872
- muted(message) {
3873
- appendStyledMessage(sink, stdout, "stdout", "muted", message);
3874
- },
3875
- markdown(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}
3886
- `);
3887
- },
3888
- component(element) {
3889
- if (sink.appendMessage) {
3890
- sink.appendMessage({ kind: "component", element });
3891
- return;
3892
- }
3893
- stdout.write("\n");
3894
- },
3895
- raw(message) {
3896
- stdout.write(`${message}
3897
- `);
3898
- },
3899
- error(message) {
3900
- appendStyledMessage(sink, stderr, "stderr", "error", message);
3901
- }
3902
- };
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
- }
3851
+ // src/shared/output/errors.ts
3965
3852
  function formatError(error) {
3966
3853
  if (error instanceof CngApiError) {
3967
3854
  return formatApiError(error);
@@ -3985,88 +3872,32 @@ function formatApiError(error) {
3985
3872
  }
3986
3873
  return error.message;
3987
3874
  }
3875
+ function isRecord(value) {
3876
+ return value !== null && typeof value === "object" && !Array.isArray(value);
3877
+ }
3988
3878
  function extractBodyErrorMessage(body) {
3989
- if (body == null || typeof body !== "object") {
3879
+ if (!isRecord(body)) {
3990
3880
  return void 0;
3991
3881
  }
3992
- const record = body;
3993
- const errorField = record.error;
3994
- if (errorField != null && typeof errorField === "object") {
3882
+ const errorField = body.error;
3883
+ if (errorField != null && isRecord(errorField)) {
3995
3884
  const message = errorField.message;
3996
3885
  if (typeof message === "string") {
3997
3886
  return message;
3998
3887
  }
3999
3888
  }
4000
- if (typeof record.message === "string") {
4001
- return record.message;
3889
+ if (typeof body.message === "string") {
3890
+ return body.message;
4002
3891
  }
4003
3892
  return void 0;
4004
3893
  }
4005
- function appendStyledMessage(sink, stream, streamName, style, message) {
4006
- if (sink.appendMessage) {
4007
- sink.appendMessage({ kind: "styled", stream: streamName, style, message });
4008
- return;
4009
- }
4010
- stream.write(`${message}
4011
- `);
4012
- }
4013
- function prepareMarkdownForTerminal(markdown) {
4014
- if (!markdown.startsWith("---\n")) {
4015
- return markdown;
4016
- }
4017
- const frontmatterEndIndex = markdown.indexOf("\n---", 4);
4018
- if (frontmatterEndIndex < 0) {
4019
- return formatFrontmatterForTerminal(markdown.slice(4).trimEnd());
4020
- }
4021
- const frontmatter = markdown.slice(4, frontmatterEndIndex).trimEnd();
4022
- const body = markdown.slice(frontmatterEndIndex + "\n---".length).replace(/^\n+/, "");
4023
- return `${formatFrontmatterForTerminal(frontmatter)}
4024
-
4025
- ${body}`;
4026
- }
4027
- function formatFrontmatterForTerminal(frontmatter) {
4028
- return `## Metadata
4029
-
4030
- \`\`\`yaml
4031
- ${frontmatter}
4032
- \`\`\``;
4033
- }
4034
- function shouldRenderColor(stream) {
4035
- if (process3.env.CNGKIT_NO_COLOR === "1") {
4036
- return false;
4037
- }
4038
- const colorMode = process3.env.CNGKIT_COLOR?.toLowerCase();
4039
- if (colorMode === "never" || colorMode === "0" || colorMode === "false") {
4040
- return false;
4041
- }
4042
- if (colorMode === "always" || colorMode === "1" || colorMode === "true") {
4043
- return true;
4044
- }
4045
- if (process3.env.FORCE_COLOR !== void 0 && process3.env.FORCE_COLOR !== "0") {
4046
- return true;
4047
- }
4048
- if (process3.env.NO_COLOR !== void 0) {
4049
- return false;
4050
- }
4051
- return stream.isTTY === true;
4052
- }
4053
- function clampMarkdownWidth(columns) {
4054
- if (columns === void 0) {
4055
- return 100;
4056
- }
4057
- return Math.max(72, Math.min(columns, 120));
4058
- }
4059
3894
 
4060
3895
  export {
4061
3896
  packageVersion,
4062
3897
  resolveApiBaseUrl,
4063
3898
  resolveOutputFormat,
4064
3899
  parseOutputFormat,
4065
- createRoomCode,
4066
- createPeerId,
4067
3900
  CngApiClient,
4068
- createCommandOutput,
4069
- CommandOutputMessages,
4070
3901
  formatError
4071
3902
  };
4072
- //# sourceMappingURL=chunk-DIJEVOVN.js.map
3903
+ //# sourceMappingURL=chunk-67FUBMNB.js.map