kfc-code-cli 0.0.1-alpha.4 → 0.0.1-alpha.5

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 (2) hide show
  1. package/dist/main.mjs +123 -93
  2. package/package.json +1 -1
package/dist/main.mjs CHANGED
@@ -5,7 +5,7 @@ import { createRequire } from "node:module";
5
5
  import { Command, Option } from "commander";
6
6
  import * as nodeFs from "node:fs";
7
7
  import Vt, { chmodSync, closeSync, constants, createReadStream, createWriteStream, existsSync, fsyncSync, mkdirSync, openSync, promises, readFileSync, readdirSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync, writeSync } from "node:fs";
8
- import fs, { access, appendFile, chmod, lstat, mkdir, mkdtemp, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
8
+ import jn, { access, appendFile, chmod, lstat, mkdir, mkdtemp, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
9
9
  import * as path$2 from "node:path";
10
10
  import path, { basename, dirname, extname, isAbsolute, join, normalize, posix, resolve, sep, win32 } from "node:path";
11
11
  import { finished, pipeline } from "node:stream/promises";
@@ -28,7 +28,7 @@ import * as ks from "zlib";
28
28
  import qr from "zlib";
29
29
  import so from "node:assert";
30
30
  import { parse as parse$1, stringify } from "smol-toml";
31
- import * as fs$2 from "fs/promises";
31
+ import * as fs$1 from "fs/promises";
32
32
  import { writeFile as writeFile$1 } from "fs/promises";
33
33
  import { AsyncLocalStorage } from "node:async_hooks";
34
34
  import "yazl";
@@ -26600,7 +26600,7 @@ K(Un, Hn, Wn, Gn, (s, t) => {
26600
26600
  if (!t?.length) throw new TypeError("no paths specified to add to archive");
26601
26601
  });
26602
26602
  var fr = (process.env.__FAKE_PLATFORM__ || process.platform) === "win32", { O_CREAT: dr, O_NOFOLLOW: ar, O_TRUNC: ur, O_WRONLY: mr } = I.constants, pr = Number(process.env.__FAKE_FS_O_FILENAME__) || I.constants.UV_FS_O_FILEMAP || 0, Kn = fr && !!pr, Vn = 512 * 1024, $n = pr | ur | dr | mr, lr = !fr && typeof ar == "number" ? ar | ur | dr | mr : null, cs = lr !== null ? () => lr : Kn ? (s) => s < Vn ? $n : "w" : () => "w";
26603
- var fs$13 = (s, t, e) => {
26603
+ var fs$12 = (s, t, e) => {
26604
26604
  try {
26605
26605
  return Vt.lchownSync(s, t, e);
26606
26606
  } catch (i) {
@@ -26632,7 +26632,7 @@ var fs$13 = (s, t, e) => {
26632
26632
  for (let l of n) Xn(s, l, t, e, a);
26633
26633
  });
26634
26634
  }, qn = (s, t, e, i) => {
26635
- t.isDirectory() && us(path.resolve(s, t.name), e, i), fs$13(path.resolve(s, t.name), e, i);
26635
+ t.isDirectory() && us(path.resolve(s, t.name), e, i), fs$12(path.resolve(s, t.name), e, i);
26636
26636
  }, us = (s, t, e) => {
26637
26637
  let i;
26638
26638
  try {
@@ -26640,11 +26640,11 @@ var fs$13 = (s, t, e) => {
26640
26640
  } catch (r) {
26641
26641
  let n = r;
26642
26642
  if (n?.code === "ENOENT") return;
26643
- if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return fs$13(s, t, e);
26643
+ if (n?.code === "ENOTDIR" || n?.code === "ENOTSUP") return fs$12(s, t, e);
26644
26644
  throw n;
26645
26645
  }
26646
26646
  for (let r of i) qn(s, r, t, e);
26647
- return fs$13(s, t, e);
26647
+ return fs$12(s, t, e);
26648
26648
  };
26649
26649
  var we = class extends Error {
26650
26650
  path;
@@ -26679,7 +26679,7 @@ var Qn = (s, t) => {
26679
26679
  E ? e(E) : x && a ? ds(x, o, h, (xe) => S(xe)) : n ? Vt.chmod(s, r, e) : e();
26680
26680
  };
26681
26681
  if (s === d) return Qn(s, S);
26682
- if (l) return fs.mkdir(s, {
26682
+ if (l) return jn.mkdir(s, {
26683
26683
  mode: r,
26684
26684
  recursive: !0
26685
26685
  }).then((E) => S(null, E ?? void 0), S);
@@ -27438,7 +27438,7 @@ var require_pend = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27438
27438
  //#endregion
27439
27439
  //#region ../../node_modules/.pnpm/yauzl@3.3.0/node_modules/yauzl/fd-slicer.js
27440
27440
  var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
27441
- var fs$12 = __require("fs");
27441
+ var fs$11 = __require("fs");
27442
27442
  var util$7 = __require("util");
27443
27443
  var stream$4 = __require("stream");
27444
27444
  var Readable = stream$4.Readable;
@@ -27463,7 +27463,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
27463
27463
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
27464
27464
  var self = this;
27465
27465
  self.pend.go(function(cb) {
27466
- fs$12.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
27466
+ fs$11.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
27467
27467
  cb();
27468
27468
  callback(err, bytesRead, buffer);
27469
27469
  });
@@ -27472,7 +27472,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
27472
27472
  FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
27473
27473
  var self = this;
27474
27474
  self.pend.go(function(cb) {
27475
- fs$12.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
27475
+ fs$11.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
27476
27476
  cb();
27477
27477
  callback(err, written, buffer);
27478
27478
  });
@@ -27492,7 +27492,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
27492
27492
  self.refCount -= 1;
27493
27493
  if (self.refCount > 0) return;
27494
27494
  if (self.refCount < 0) throw new Error("invalid unref");
27495
- if (self.autoClose) fs$12.close(self.fd, onCloseDone);
27495
+ if (self.autoClose) fs$11.close(self.fd, onCloseDone);
27496
27496
  function onCloseDone(err) {
27497
27497
  if (err) self.emit("error", err);
27498
27498
  else self.emit("close");
@@ -27523,7 +27523,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
27523
27523
  self.context.pend.go(function(cb) {
27524
27524
  if (self.destroyed) return cb();
27525
27525
  var buffer = Buffer.allocUnsafe(toRead);
27526
- fs$12.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
27526
+ fs$11.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
27527
27527
  if (err) self.destroy(err);
27528
27528
  else if (bytesRead === 0) {
27529
27529
  self.destroyed = true;
@@ -27569,7 +27569,7 @@ var require_fd_slicer = /* @__PURE__ */ __commonJSMin(((exports) => {
27569
27569
  }
27570
27570
  self.context.pend.go(function(cb) {
27571
27571
  if (self.destroyed) return cb();
27572
- fs$12.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
27572
+ fs$11.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
27573
27573
  if (err) {
27574
27574
  self.destroy();
27575
27575
  cb();
@@ -39243,7 +39243,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39243
39243
  };
39244
39244
  return _setPrototypeOf(o, p);
39245
39245
  }
39246
- var fs$10 = __require("fs");
39246
+ var fs$9 = __require("fs");
39247
39247
  var path$10 = __require("path");
39248
39248
  var Loader = require_loader();
39249
39249
  var PrecompiledLoader = require_precompiled_loader().PrecompiledLoader;
@@ -39267,7 +39267,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39267
39267
  } catch (e) {
39268
39268
  throw new Error("watch requires chokidar to be installed");
39269
39269
  }
39270
- var paths = _this.searchPaths.filter(fs$10.existsSync);
39270
+ var paths = _this.searchPaths.filter(fs$9.existsSync);
39271
39271
  var watcher = chokidar.watch(paths);
39272
39272
  watcher.on("all", function(event, fullname) {
39273
39273
  fullname = path$10.resolve(fullname);
@@ -39286,7 +39286,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39286
39286
  for (var i = 0; i < paths.length; i++) {
39287
39287
  var basePath = path$10.resolve(paths[i]);
39288
39288
  var p = path$10.resolve(paths[i], name);
39289
- if (p.indexOf(basePath) === 0 && fs$10.existsSync(p)) {
39289
+ if (p.indexOf(basePath) === 0 && fs$9.existsSync(p)) {
39290
39290
  fullpath = p;
39291
39291
  break;
39292
39292
  }
@@ -39294,7 +39294,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39294
39294
  if (!fullpath) return null;
39295
39295
  this.pathsToNames[fullpath] = name;
39296
39296
  var source = {
39297
- src: fs$10.readFileSync(fullpath, "utf-8"),
39297
+ src: fs$9.readFileSync(fullpath, "utf-8"),
39298
39298
  path: fullpath,
39299
39299
  noCache: this.noCache
39300
39300
  };
@@ -39342,7 +39342,7 @@ var require_node_loaders = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39342
39342
  }
39343
39343
  this.pathsToNames[fullpath] = name;
39344
39344
  var source = {
39345
- src: fs$10.readFileSync(fullpath, "utf-8"),
39345
+ src: fs$9.readFileSync(fullpath, "utf-8"),
39346
39346
  path: fullpath,
39347
39347
  noCache: this.noCache
39348
39348
  };
@@ -40086,7 +40086,7 @@ var require_precompile_global = /* @__PURE__ */ __commonJSMin(((exports, module)
40086
40086
  //#endregion
40087
40087
  //#region ../../node_modules/.pnpm/nunjucks@3.2.4/node_modules/nunjucks/src/precompile.js
40088
40088
  var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40089
- var fs$9 = __require("fs");
40089
+ var fs$8 = __require("fs");
40090
40090
  var path$8 = __require("path");
40091
40091
  var _prettifyError = require_lib$1()._prettifyError;
40092
40092
  var compiler = require_compiler();
@@ -40111,27 +40111,27 @@ var require_precompile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
40111
40111
  var env = opts.env || new Environment([]);
40112
40112
  var wrapper = opts.wrapper || precompileGlobal;
40113
40113
  if (opts.isString) return precompileString(input, opts);
40114
- var pathStats = fs$9.existsSync(input) && fs$9.statSync(input);
40114
+ var pathStats = fs$8.existsSync(input) && fs$8.statSync(input);
40115
40115
  var precompiled = [];
40116
40116
  var templates = [];
40117
40117
  function addTemplates(dir) {
40118
- fs$9.readdirSync(dir).forEach(function(file) {
40118
+ fs$8.readdirSync(dir).forEach(function(file) {
40119
40119
  var filepath = path$8.join(dir, file);
40120
40120
  var subpath = filepath.substr(path$8.join(input, "/").length);
40121
- var stat = fs$9.statSync(filepath);
40121
+ var stat = fs$8.statSync(filepath);
40122
40122
  if (stat && stat.isDirectory()) {
40123
40123
  subpath += "/";
40124
40124
  if (!match(subpath, opts.exclude)) addTemplates(filepath);
40125
40125
  } else if (match(subpath, opts.include)) templates.push(filepath);
40126
40126
  });
40127
40127
  }
40128
- if (pathStats.isFile()) precompiled.push(_precompile(fs$9.readFileSync(input, "utf-8"), opts.name || input, env));
40128
+ if (pathStats.isFile()) precompiled.push(_precompile(fs$8.readFileSync(input, "utf-8"), opts.name || input, env));
40129
40129
  else if (pathStats.isDirectory()) {
40130
40130
  addTemplates(input);
40131
40131
  for (var i = 0; i < templates.length; i++) {
40132
40132
  var name = templates[i].replace(path$8.join(input, "/"), "");
40133
40133
  try {
40134
- precompiled.push(_precompile(fs$9.readFileSync(templates[i], "utf-8"), name, env));
40134
+ precompiled.push(_precompile(fs$8.readFileSync(templates[i], "utf-8"), name, env));
40135
40135
  } catch (e) {
40136
40136
  if (opts.force) console.error(e);
40137
40137
  else throw e;
@@ -51405,7 +51405,7 @@ var require_util = /* @__PURE__ */ __commonJSMin(((exports) => {
51405
51405
  exports.removeUndefinedValuesInObject = removeUndefinedValuesInObject;
51406
51406
  exports.isValidFile = isValidFile;
51407
51407
  exports.getWellKnownCertificateConfigFileLocation = getWellKnownCertificateConfigFileLocation;
51408
- const fs$8 = __require("fs");
51408
+ const fs$7 = __require("fs");
51409
51409
  const os$1 = __require("os");
51410
51410
  const path$6 = __require("path");
51411
51411
  const WELL_KNOWN_CERTIFICATE_CONFIG_FILE = "certificate_config.json";
@@ -51525,7 +51525,7 @@ var require_util = /* @__PURE__ */ __commonJSMin(((exports) => {
51525
51525
  */
51526
51526
  async function isValidFile(filePath) {
51527
51527
  try {
51528
- return (await fs$8.promises.lstat(filePath)).isFile();
51528
+ return (await fs$7.promises.lstat(filePath)).isFile();
51529
51529
  } catch (e) {
51530
51530
  return false;
51531
51531
  }
@@ -53238,10 +53238,10 @@ var require_getCredentials = /* @__PURE__ */ __commonJSMin(((exports) => {
53238
53238
  Object.defineProperty(exports, "__esModule", { value: true });
53239
53239
  exports.getCredentials = getCredentials;
53240
53240
  const path$5 = __require("path");
53241
- const fs$7 = __require("fs");
53241
+ const fs$6 = __require("fs");
53242
53242
  const util_1$1 = __require("util");
53243
53243
  const errorWithCode_1 = require_errorWithCode();
53244
- const readFile = fs$7.readFile ? (0, util_1$1.promisify)(fs$7.readFile) : async () => {
53244
+ const readFile = fs$6.readFile ? (0, util_1$1.promisify)(fs$6.readFile) : async () => {
53245
53245
  throw new errorWithCode_1.ErrorWithCode("use key rather than keyFile.", "MISSING_CREDENTIALS");
53246
53246
  };
53247
53247
  var ExtensionFiles;
@@ -54788,10 +54788,10 @@ var require_filesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((exports)
54788
54788
  Object.defineProperty(exports, "__esModule", { value: true });
54789
54789
  exports.FileSubjectTokenSupplier = void 0;
54790
54790
  const util_1 = __require("util");
54791
- const fs$6 = __require("fs");
54792
- const readFile = (0, util_1.promisify)(fs$6.readFile ?? (() => {}));
54793
- const realpath = (0, util_1.promisify)(fs$6.realpath ?? (() => {}));
54794
- const lstat = (0, util_1.promisify)(fs$6.lstat ?? (() => {}));
54791
+ const fs$5 = __require("fs");
54792
+ const readFile = (0, util_1.promisify)(fs$5.readFile ?? (() => {}));
54793
+ const realpath = (0, util_1.promisify)(fs$5.realpath ?? (() => {}));
54794
+ const lstat = (0, util_1.promisify)(fs$5.lstat ?? (() => {}));
54795
54795
  /**
54796
54796
  * Internal subject token supplier implementation used when a file location
54797
54797
  * is configured in the credential configuration used to build an {@link IdentityPoolClient}
@@ -54893,7 +54893,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
54893
54893
  Object.defineProperty(exports, "__esModule", { value: true });
54894
54894
  exports.CertificateSubjectTokenSupplier = exports.InvalidConfigurationError = exports.CertificateSourceUnavailableError = exports.CERTIFICATE_CONFIGURATION_ENV_VARIABLE = void 0;
54895
54895
  const util_1 = require_util();
54896
- const fs$5 = __require("fs");
54896
+ const fs$4 = __require("fs");
54897
54897
  const crypto_1 = __require("crypto");
54898
54898
  const https$1 = __require("https");
54899
54899
  exports.CERTIFICATE_CONFIGURATION_ENV_VARIABLE = "GOOGLE_API_CERTIFICATE_CONFIG";
@@ -54988,7 +54988,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
54988
54988
  const configPath = this.certificateConfigPath;
54989
54989
  let fileContents;
54990
54990
  try {
54991
- fileContents = await fs$5.promises.readFile(configPath, "utf8");
54991
+ fileContents = await fs$4.promises.readFile(configPath, "utf8");
54992
54992
  } catch (err) {
54993
54993
  throw new CertificateSourceUnavailableError(`Failed to read certificate config file at: ${configPath}`);
54994
54994
  }
@@ -55013,13 +55013,13 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
55013
55013
  async #getKeyAndCert(certPath, keyPath) {
55014
55014
  let cert, key;
55015
55015
  try {
55016
- cert = await fs$5.promises.readFile(certPath);
55016
+ cert = await fs$4.promises.readFile(certPath);
55017
55017
  new crypto_1.X509Certificate(cert);
55018
55018
  } catch (err) {
55019
55019
  throw new CertificateSourceUnavailableError(`Failed to read certificate file at ${certPath}: ${err instanceof Error ? err.message : String(err)}`);
55020
55020
  }
55021
55021
  try {
55022
- key = await fs$5.promises.readFile(keyPath);
55022
+ key = await fs$4.promises.readFile(keyPath);
55023
55023
  (0, crypto_1.createPrivateKey)(key);
55024
55024
  } catch (err) {
55025
55025
  throw new CertificateSourceUnavailableError(`Failed to read private key file at ${keyPath}: ${err instanceof Error ? err.message : String(err)}`);
@@ -55038,7 +55038,7 @@ var require_certificatesubjecttokensupplier = /* @__PURE__ */ __commonJSMin(((ex
55038
55038
  const leafCert = new crypto_1.X509Certificate(leafCertBuffer);
55039
55039
  if (!this.trustChainPath) return JSON.stringify([leafCert.raw.toString("base64")]);
55040
55040
  try {
55041
- const chainCerts = ((await fs$5.promises.readFile(this.trustChainPath, "utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g) ?? []).map((pem, index) => {
55041
+ const chainCerts = ((await fs$4.promises.readFile(this.trustChainPath, "utf8")).match(/-----BEGIN CERTIFICATE-----[^-]+-----END CERTIFICATE-----/g) ?? []).map((pem, index) => {
55042
55042
  try {
55043
55043
  return new crypto_1.X509Certificate(pem);
55044
55044
  } catch (err) {
@@ -55698,7 +55698,7 @@ var require_pluggable_auth_handler = /* @__PURE__ */ __commonJSMin(((exports) =>
55698
55698
  exports.PluggableAuthHandler = exports.ExecutableError = void 0;
55699
55699
  const executable_response_1 = require_executable_response();
55700
55700
  const childProcess = __require("child_process");
55701
- const fs$4 = __require("fs");
55701
+ const fs$3 = __require("fs");
55702
55702
  /**
55703
55703
  * Error thrown from the executable run by PluggableAuthClient.
55704
55704
  */
@@ -55775,12 +55775,12 @@ var require_pluggable_auth_handler = /* @__PURE__ */ __commonJSMin(((exports) =>
55775
55775
  if (!this.outputFile || this.outputFile.length === 0) return;
55776
55776
  let filePath;
55777
55777
  try {
55778
- filePath = await fs$4.promises.realpath(this.outputFile);
55778
+ filePath = await fs$3.promises.realpath(this.outputFile);
55779
55779
  } catch {
55780
55780
  return;
55781
55781
  }
55782
- if (!(await fs$4.promises.lstat(filePath)).isFile()) return;
55783
- const responseString = await fs$4.promises.readFile(filePath, { encoding: "utf8" });
55782
+ if (!(await fs$3.promises.lstat(filePath)).isFile()) return;
55783
+ const responseString = await fs$3.promises.readFile(filePath, { encoding: "utf8" });
55784
55784
  if (responseString === "") return;
55785
55785
  try {
55786
55786
  const responseJson = JSON.parse(responseString);
@@ -56202,7 +56202,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
56202
56202
  Object.defineProperty(exports, "__esModule", { value: true });
56203
56203
  exports.GoogleAuth = exports.GoogleAuthExceptionMessages = void 0;
56204
56204
  const child_process_1 = __require("child_process");
56205
- const fs$3 = __require("fs");
56205
+ const fs$2 = __require("fs");
56206
56206
  const gaxios_1 = require_src$3();
56207
56207
  const gcpMetadata = require_src$1();
56208
56208
  const os = __require("os");
@@ -56450,7 +56450,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
56450
56450
  }
56451
56451
  if (location) {
56452
56452
  location = path$4.join(location, "gcloud", "application_default_credentials.json");
56453
- if (!fs$3.existsSync(location)) location = null;
56453
+ if (!fs$2.existsSync(location)) location = null;
56454
56454
  }
56455
56455
  if (!location) return null;
56456
56456
  return await this._getApplicationCredentialsFromFilePath(location, options);
@@ -56464,13 +56464,13 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
56464
56464
  async _getApplicationCredentialsFromFilePath(filePath, options = {}) {
56465
56465
  if (!filePath || filePath.length === 0) throw new Error("The file path is invalid.");
56466
56466
  try {
56467
- filePath = fs$3.realpathSync(filePath);
56468
- if (!fs$3.lstatSync(filePath).isFile()) throw new Error();
56467
+ filePath = fs$2.realpathSync(filePath);
56468
+ if (!fs$2.lstatSync(filePath).isFile()) throw new Error();
56469
56469
  } catch (err) {
56470
56470
  if (err instanceof Error) err.message = `The file at ${filePath} does not exist, or it is not a file. ${err.message}`;
56471
56471
  throw err;
56472
56472
  }
56473
- const readStream = fs$3.createReadStream(filePath);
56473
+ const readStream = fs$2.createReadStream(filePath);
56474
56474
  return this.fromStream(readStream, options);
56475
56475
  }
56476
56476
  /**
@@ -56737,7 +56737,7 @@ var require_googleauth = /* @__PURE__ */ __commonJSMin(((exports) => {
56737
56737
  if (this.jsonContent) return this._cacheClientFromJSON(this.jsonContent, this.clientOptions);
56738
56738
  else if (this.keyFilename) {
56739
56739
  const filePath = path$4.resolve(this.keyFilename);
56740
- const stream = fs$3.createReadStream(filePath);
56740
+ const stream = fs$2.createReadStream(filePath);
56741
56741
  return await this.fromStreamAsync(stream, this.clientOptions);
56742
56742
  } else if (this.apiKey) {
56743
56743
  const client = await this.fromAPIKey(this.apiKey, this.clientOptions);
@@ -75247,7 +75247,7 @@ var NodeUploader = class {
75247
75247
  type: void 0
75248
75248
  };
75249
75249
  if (typeof file === "string") {
75250
- fileStat.size = (await fs$2.stat(file)).size;
75250
+ fileStat.size = (await fs$1.stat(file)).size;
75251
75251
  fileStat.type = this.inferMimeType(file);
75252
75252
  return fileStat;
75253
75253
  } else return await getBlobStat(file);
@@ -75380,7 +75380,7 @@ var NodeUploader = class {
75380
75380
  let fileHandle;
75381
75381
  const fileName = path$1$1.basename(file);
75382
75382
  try {
75383
- fileHandle = await fs$2.open(file, "r");
75383
+ fileHandle = await fs$1.open(file, "r");
75384
75384
  if (!fileHandle) throw new Error(`Failed to open file`);
75385
75385
  fileSize = (await fileHandle.stat()).size;
75386
75386
  while (offset < fileSize) {
@@ -91814,7 +91814,7 @@ var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
91814
91814
  //#endregion
91815
91815
  //#region ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
91816
91816
  var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
91817
- var fs$1 = __require("fs");
91817
+ var fs = __require("fs");
91818
91818
  var polyfills = require_polyfills();
91819
91819
  var legacy = require_legacy_streams();
91820
91820
  var clone = require_clone();
@@ -91843,36 +91843,36 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
91843
91843
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
91844
91844
  console.error(m);
91845
91845
  };
91846
- if (!fs$1[gracefulQueue]) {
91847
- publishQueue(fs$1, global[gracefulQueue] || []);
91848
- fs$1.close = (function(fs$close) {
91846
+ if (!fs[gracefulQueue]) {
91847
+ publishQueue(fs, global[gracefulQueue] || []);
91848
+ fs.close = (function(fs$close) {
91849
91849
  function close(fd, cb) {
91850
- return fs$close.call(fs$1, fd, function(err) {
91850
+ return fs$close.call(fs, fd, function(err) {
91851
91851
  if (!err) resetQueue();
91852
91852
  if (typeof cb === "function") cb.apply(this, arguments);
91853
91853
  });
91854
91854
  }
91855
91855
  Object.defineProperty(close, previousSymbol, { value: fs$close });
91856
91856
  return close;
91857
- })(fs$1.close);
91858
- fs$1.closeSync = (function(fs$closeSync) {
91857
+ })(fs.close);
91858
+ fs.closeSync = (function(fs$closeSync) {
91859
91859
  function closeSync(fd) {
91860
- fs$closeSync.apply(fs$1, arguments);
91860
+ fs$closeSync.apply(fs, arguments);
91861
91861
  resetQueue();
91862
91862
  }
91863
91863
  Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
91864
91864
  return closeSync;
91865
- })(fs$1.closeSync);
91865
+ })(fs.closeSync);
91866
91866
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
91867
- debug(fs$1[gracefulQueue]);
91868
- __require("assert").equal(fs$1[gracefulQueue].length, 0);
91867
+ debug(fs[gracefulQueue]);
91868
+ __require("assert").equal(fs[gracefulQueue].length, 0);
91869
91869
  });
91870
91870
  }
91871
- if (!global[gracefulQueue]) publishQueue(global, fs$1[gracefulQueue]);
91872
- module.exports = patch(clone(fs$1));
91873
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs$1.__patched) {
91874
- module.exports = patch(fs$1);
91875
- fs$1.__patched = true;
91871
+ if (!global[gracefulQueue]) publishQueue(global, fs[gracefulQueue]);
91872
+ module.exports = patch(clone(fs));
91873
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
91874
+ module.exports = patch(fs);
91875
+ fs.__patched = true;
91876
91876
  }
91877
91877
  function patch(fs) {
91878
91878
  polyfills(fs);
@@ -92127,23 +92127,23 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
92127
92127
  }
92128
92128
  function enqueue(elem) {
92129
92129
  debug("ENQUEUE", elem[0].name, elem[1]);
92130
- fs$1[gracefulQueue].push(elem);
92130
+ fs[gracefulQueue].push(elem);
92131
92131
  retry();
92132
92132
  }
92133
92133
  var retryTimer;
92134
92134
  function resetQueue() {
92135
92135
  var now = Date.now();
92136
- for (var i = 0; i < fs$1[gracefulQueue].length; ++i) if (fs$1[gracefulQueue][i].length > 2) {
92137
- fs$1[gracefulQueue][i][3] = now;
92138
- fs$1[gracefulQueue][i][4] = now;
92136
+ for (var i = 0; i < fs[gracefulQueue].length; ++i) if (fs[gracefulQueue][i].length > 2) {
92137
+ fs[gracefulQueue][i][3] = now;
92138
+ fs[gracefulQueue][i][4] = now;
92139
92139
  }
92140
92140
  retry();
92141
92141
  }
92142
92142
  function retry() {
92143
92143
  clearTimeout(retryTimer);
92144
92144
  retryTimer = void 0;
92145
- if (fs$1[gracefulQueue].length === 0) return;
92146
- var elem = fs$1[gracefulQueue].shift();
92145
+ if (fs[gracefulQueue].length === 0) return;
92146
+ var elem = fs[gracefulQueue].shift();
92147
92147
  var fn = elem[0];
92148
92148
  var args = elem[1];
92149
92149
  var err = elem[2];
@@ -92162,7 +92162,7 @@ var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
92162
92162
  if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
92163
92163
  debug("RETRY", fn.name, args);
92164
92164
  fn.apply(null, args.concat([startTime]));
92165
- } else fs$1[gracefulQueue].push(elem);
92165
+ } else fs[gracefulQueue].push(elem);
92166
92166
  }
92167
92167
  if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
92168
92168
  }
@@ -95324,12 +95324,14 @@ var WelcomeComponent = class {
95324
95324
  const gap = " ";
95325
95325
  const textWidth = Math.max(4, innerWidth - logoWidth - 2);
95326
95326
  const rightRow0 = truncateToWidth(chalk.bold.hex(this.colors.primary)("Welcome to Kimi Code!"), textWidth, "…");
95327
- const rightRow1 = truncateToWidth(chalk.dim("Send /help for help information."), textWidth, "…");
95327
+ const isLoggedOut = !this.state.model;
95328
+ const rightRow1 = truncateToWidth(chalk.dim(isLoggedOut ? "Run /login to sign in." : "Send /help for help information."), textWidth, "…");
95328
95329
  const headerLines = [primary(logo[0].padEnd(logoWidth)) + gap + rightRow0, primary(logo[1].padEnd(logoWidth)) + gap + rightRow1];
95330
+ const modelValue = isLoggedOut ? chalk.yellow("(not signed in — run /login)") : this.state.model;
95329
95331
  const infoLines = [
95330
95332
  chalk.dim.bold("Directory: ") + this.state.workDir,
95331
95333
  chalk.dim.bold("Session: ") + this.state.sessionId,
95332
- chalk.dim.bold("Model: ") + this.state.model,
95334
+ chalk.dim.bold("Model: ") + modelValue,
95333
95335
  chalk.dim.bold("Version: ") + this.state.version
95334
95336
  ];
95335
95337
  const contentLines = [
@@ -95495,8 +95497,8 @@ function createTranscriptComponent(state, entry) {
95495
95497
  if (state.toolOutputExpanded) tc.setExpanded(true);
95496
95498
  return tc;
95497
95499
  }
95498
- return createStatusEntry(entry.content, entry.color);
95499
- case "status": return createStatusEntry(entry.content, entry.color);
95500
+ return entry.renderMode === "notice" ? createNoticeEntry(entry.content, entry.detail, state.colors) : createStatusEntry(entry.content, entry.color);
95501
+ case "status": return entry.renderMode === "notice" ? createNoticeEntry(entry.content, entry.detail, state.colors) : createStatusEntry(entry.content, entry.color);
95500
95502
  default: return null;
95501
95503
  }
95502
95504
  }
@@ -95517,6 +95519,13 @@ function createStatusEntry(content, color) {
95517
95519
  container.addChild(new Text(` ${styled}`, 0, 0));
95518
95520
  return container;
95519
95521
  }
95522
+ function createNoticeEntry(title, detail, colors) {
95523
+ const container = new Container();
95524
+ container.addChild(new Spacer(1));
95525
+ container.addChild(new Text(` ${chalk.white(title)}`, 0, 0));
95526
+ if (detail !== void 0 && detail.length > 0) container.addChild(new Text(` ${chalk.hex(colors.textDim)(detail)}`, 0, 0));
95527
+ return container;
95528
+ }
95520
95529
  /**
95521
95530
  * Push a new entry onto the transcript and render the matching
95522
95531
  * component. Equivalent to the old `KimiTUI.addTranscriptEntry`.
@@ -95548,6 +95557,16 @@ function emitStatus(state, message, color) {
95548
95557
  ...color !== void 0 ? { color } : {}
95549
95558
  });
95550
95559
  }
95560
+ function emitNotice(state, title, detail) {
95561
+ appendTranscriptEntry(state, {
95562
+ id: nextTranscriptId(),
95563
+ kind: "status",
95564
+ turnId: state.currentTurnId,
95565
+ renderMode: "notice",
95566
+ content: title,
95567
+ ...detail !== void 0 ? { detail } : {}
95568
+ });
95569
+ }
95551
95570
  /** Red. */
95552
95571
  function emitError(state, message) {
95553
95572
  emitStatus(state, message, state.colors.error);
@@ -95560,10 +95579,6 @@ function emitSuccess(state, message) {
95560
95579
  function emitMuted(state, message) {
95561
95580
  emitStatus(state, message, state.colors.textDim);
95562
95581
  }
95563
- /** Primary (brand) color. */
95564
- function emitPrimary(state, message) {
95565
- emitStatus(state, message, state.colors.primary);
95566
- }
95567
95582
  //#endregion
95568
95583
  //#region src/tui/input/image-placeholder.ts
95569
95584
  const PLACEHOLDER_REGEX = /\[image #(\d+) \((\d+)×(\d+)\)\]/g;
@@ -95938,6 +95953,10 @@ function ok$1(message) {
95938
95953
  };
95939
95954
  return { type: "ok" };
95940
95955
  }
95956
+ function showNotice(ctx, title, detail) {
95957
+ ctx.showNotice(title, detail);
95958
+ return ok$1();
95959
+ }
95941
95960
  const shellCommands = [
95942
95961
  {
95943
95962
  name: "exit",
@@ -96019,7 +96038,8 @@ const shellCommands = [
96019
96038
  else enabled = !ctx.appState.yolo;
96020
96039
  await ctx.client.setYolo(ctx.appState.sessionId, enabled);
96021
96040
  ctx.setAppState({ yolo: enabled });
96022
- return ok$1(`YOLO mode: ${enabled ? "on" : "off"}`);
96041
+ if (enabled) return showNotice(ctx, "YOLO mode: ON", "All actions will be approved automatically. Use with caution.");
96042
+ return showNotice(ctx, "YOLO mode: OFF");
96023
96043
  }
96024
96044
  },
96025
96045
  {
@@ -96044,8 +96064,9 @@ const shellCommands = [
96044
96064
  else enabled = !ctx.appState.planMode;
96045
96065
  const res = await ctx.client.setPlanMode(ctx.appState.sessionId, enabled);
96046
96066
  ctx.setAppState({ planMode: enabled });
96047
- if (enabled && res.plan_path !== void 0) return ok$1(`Plan mode ON. Write your plan to: ${res.plan_path}`);
96048
- return ok$1(`Plan mode: ${enabled ? "on" : "off"}`);
96067
+ if (enabled && res.plan_path !== void 0) return showNotice(ctx, "Plan mode: ON", `Plan will be created here: ${res.plan_path}`);
96068
+ if (enabled) return showNotice(ctx, "Plan mode: ON");
96069
+ return showNotice(ctx, "Plan mode: OFF");
96049
96070
  }
96050
96071
  },
96051
96072
  {
@@ -96183,7 +96204,7 @@ var SlashCommandRegistry = class {
96183
96204
  * 再注册当前 session 下的可用 skills。
96184
96205
  */
96185
96206
  setSkillCommands(defs) {
96186
- for (const [name, def] of [...this.commands]) if (name.startsWith("skill:")) {
96207
+ for (const [name, def] of this.commands) if (name.startsWith("skill:")) {
96187
96208
  this.commands.delete(name);
96188
96209
  this.lookup.delete(name);
96189
96210
  for (const alias of def.aliases) this.lookup.delete(alias);
@@ -97275,7 +97296,9 @@ async function openExternalEditor(state) {
97275
97296
  state.externalEditorRunning = true;
97276
97297
  const seed = state.editor.getExpandedText?.() ?? state.editor.getText();
97277
97298
  state.ui.stop();
97278
- await new Promise((resolve) => setImmediate(resolve));
97299
+ await new Promise((resolve) => {
97300
+ setImmediate(resolve);
97301
+ });
97279
97302
  try {
97280
97303
  const result = await editInExternalEditor(seed, cmd);
97281
97304
  if (result !== void 0) state.editor.setText(result.replaceAll("\r\n", "\n").replace(/\n$/, ""));
@@ -97299,11 +97322,11 @@ async function togglePlanMode(state, hooks) {
97299
97322
  return;
97300
97323
  }
97301
97324
  setState(state, { planMode: enabled }, hooks);
97302
- if (enabled && planPath !== void 0) {
97303
- emitPrimary(state, `Plan mode: ON. Write your plan to: ${planPath}`);
97325
+ if (enabled) {
97326
+ emitNotice(state, "Plan mode: ON", planPath !== void 0 ? `Plan will be created here: ${planPath}` : void 0);
97304
97327
  return;
97305
97328
  }
97306
- emitPrimary(state, `Plan mode: ${enabled ? "ON" : "OFF"}`);
97329
+ emitNotice(state, "Plan mode: OFF");
97307
97330
  }
97308
97331
  async function performReload(state, action, hooks) {
97309
97332
  if (state.appState.isStreaming) {
@@ -97957,7 +97980,8 @@ async function dispatchSlashCommand(input, state, buildCtx, addEntry) {
97957
97980
  client: ctx.client,
97958
97981
  appState: ctx.appState,
97959
97982
  setAppState: ctx.setAppState,
97960
- showStatus: ctx.showStatus
97983
+ showStatus: ctx.showStatus,
97984
+ showNotice: ctx.showNotice
97961
97985
  };
97962
97986
  let result;
97963
97987
  try {
@@ -101316,14 +101340,18 @@ var KimiTUI = class {
101316
101340
  this.stateHooks.syncFooter();
101317
101341
  this.stateHooks.refreshActivityPane();
101318
101342
  },
101319
- showStatus: (message) => {
101343
+ showStatus: (message, color) => {
101320
101344
  addTranscriptEntry(this.state, {
101321
101345
  id: `status-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
101322
101346
  kind: "status",
101323
101347
  renderMode: "plain",
101324
- content: message
101348
+ content: message,
101349
+ ...color !== void 0 ? { color } : {}
101325
101350
  });
101326
101351
  },
101352
+ showNotice: (title, detail) => {
101353
+ emitNotice(this.state, title, detail);
101354
+ },
101327
101355
  stop: () => void this.stop(),
101328
101356
  showHelpPanel: () => showHelpPanel(this.state),
101329
101357
  showSessionPicker: () => showSessionPicker(this.state, this.buildSessionHooks()),
@@ -101454,6 +101482,7 @@ const MUTED = "#999999";
101454
101482
  const TEXT_DIM = "#6B7280";
101455
101483
  const INSTALL_HINT = "Install update now";
101456
101484
  const SKIP_HINT = "Continue with current version";
101485
+ const PRODUCT_NAME = "Kimi Code";
101457
101486
  function createInstallPromptChoices(target) {
101458
101487
  return [{
101459
101488
  value: "install",
@@ -101465,7 +101494,7 @@ function createInstallPromptChoices(target) {
101465
101494
  }
101466
101495
  function getDefaultInstallPromptSelection(choices) {
101467
101496
  const installIndex = choices.findIndex((choice) => choice.value === "install");
101468
- return installIndex >= 0 ? installIndex : 0;
101497
+ return Math.max(installIndex, 0);
101469
101498
  }
101470
101499
  function moveInstallPromptSelection(currentIndex, direction, choiceCount) {
101471
101500
  if (direction === "up") return Math.max(0, currentIndex - 1);
@@ -101479,7 +101508,7 @@ function renderInstallPrompt(options, choices, selectedIndex) {
101479
101508
  const command = chalk.hex(PRIMARY)(options.installCommand);
101480
101509
  const lines = [
101481
101510
  chalk.hex(PRIMARY).bold("Kimi Code Update Available"),
101482
- chalk.hex(MUTED)(`${NPM_PACKAGE_NAME} has a newer release ready.`),
101511
+ chalk.hex(MUTED)(`${PRODUCT_NAME} has a newer release ready.`),
101483
101512
  "",
101484
101513
  `${label("Current")} ${currentVersion}`,
101485
101514
  `${label("Target ")} ${targetVersion} ${channel}`,
@@ -101490,6 +101519,7 @@ function renderInstallPrompt(options, choices, selectedIndex) {
101490
101519
  ];
101491
101520
  for (let i = 0; i < choices.length; i++) {
101492
101521
  const choice = choices[i];
101522
+ if (choice === void 0) continue;
101493
101523
  const isSelected = i === selectedIndex;
101494
101524
  const content = ` ${isSelected ? "❯" : " "} ${choice.label}`;
101495
101525
  if (isSelected) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kfc-code-cli",
3
- "version": "0.0.1-alpha.4",
3
+ "version": "0.0.1-alpha.5",
4
4
  "description": "KFC crazy ",
5
5
  "license": "MIT",
6
6
  "bin": {