@kombai/cli 0.1.2-beta.1 → 0.1.2-beta.2
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.
- package/dist/kombai.mjs +193 -73
- package/package.json +1 -1
package/dist/kombai.mjs
CHANGED
|
@@ -818,7 +818,7 @@ var init_version = __esm({
|
|
|
818
818
|
"src/lib/version.js"() {
|
|
819
819
|
"use strict";
|
|
820
820
|
init_define_KOMBAI_TELEMETRY();
|
|
821
|
-
CLI_VERSION = true ? "0.1.2-beta.
|
|
821
|
+
CLI_VERSION = true ? "0.1.2-beta.2" : (
|
|
822
822
|
/** @type {{ version: string }} */
|
|
823
823
|
JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version
|
|
824
824
|
);
|
|
@@ -849,7 +849,7 @@ function retryAfterMs(value) {
|
|
|
849
849
|
const at = Date.parse(value ?? "");
|
|
850
850
|
return Number.isFinite(at) ? Math.max(0, at - Date.now()) : 2e3;
|
|
851
851
|
}
|
|
852
|
-
function apiError(status, body, method,
|
|
852
|
+
function apiError(status, body, method, path23) {
|
|
853
853
|
const {
|
|
854
854
|
errorCode,
|
|
855
855
|
apiMessage,
|
|
@@ -863,7 +863,7 @@ function apiError(status, body, method, path22) {
|
|
|
863
863
|
...extras
|
|
864
864
|
};
|
|
865
865
|
const code2 = typeof errorCode === "string" ? errorCode : `HTTP_${status}`;
|
|
866
|
-
const message = code2 === "DESIGN_NOT_FOUND" && rest.what === "canvas" ? PRIVATE_CANVAS : typeof apiMessage === "string" && apiMessage ? apiMessage : `${method} ${
|
|
866
|
+
const message = code2 === "DESIGN_NOT_FOUND" && rest.what === "canvas" ? PRIVATE_CANVAS : typeof apiMessage === "string" && apiMessage ? apiMessage : `${method} ${path23} answered ${status}.`;
|
|
867
867
|
const guestRow = GUEST_ERRORS[code2];
|
|
868
868
|
const needsLogin = status === 401 || guestRow !== void 0;
|
|
869
869
|
const text = guestRow?.message?.(rest, typeof apiMessage === "string" ? apiMessage : "") ?? message;
|
|
@@ -874,8 +874,8 @@ function apiError(status, body, method, path22) {
|
|
|
874
874
|
details: Object.keys(rest).length ? rest : void 0
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
|
-
function timedOut(method,
|
|
878
|
-
return new CliError("CLI_TIMEOUT", `The command's deadline passed during ${method} ${
|
|
877
|
+
function timedOut(method, path23) {
|
|
878
|
+
return new CliError("CLI_TIMEOUT", `The command's deadline passed during ${method} ${path23}.`, {
|
|
879
879
|
exit: Exit.TIMED_OUT
|
|
880
880
|
});
|
|
881
881
|
}
|
|
@@ -910,10 +910,10 @@ var init_api = __esm({
|
|
|
910
910
|
* @param {string} path
|
|
911
911
|
* @param {number | undefined} status
|
|
912
912
|
*/
|
|
913
|
-
constructor(method,
|
|
914
|
-
super("CLI_NETWORK", `${method} ${
|
|
913
|
+
constructor(method, path23, status) {
|
|
914
|
+
super("CLI_NETWORK", `${method} ${path23} got no usable answer${status ? ` (${status})` : ""}.`, {
|
|
915
915
|
status,
|
|
916
|
-
details: { method, path:
|
|
916
|
+
details: { method, path: path23 }
|
|
917
917
|
});
|
|
918
918
|
this.lost = true;
|
|
919
919
|
}
|
|
@@ -948,9 +948,9 @@ var init_api = __esm({
|
|
|
948
948
|
* @returns {Promise<ApiResponse>}
|
|
949
949
|
*/
|
|
950
950
|
async call(options) {
|
|
951
|
-
const { method, path:
|
|
951
|
+
const { method, path: path23, retry = "safe" } = options;
|
|
952
952
|
const deadline = options.deadline ?? this.deadline;
|
|
953
|
-
const url2 = `${this.baseUrl}${
|
|
953
|
+
const url2 = `${this.baseUrl}${path23}${queryString(options.query)}`;
|
|
954
954
|
const headers = {
|
|
955
955
|
"x-kombai-cli": this.ctx.version,
|
|
956
956
|
"x-type": "agent",
|
|
@@ -964,7 +964,7 @@ var init_api = __esm({
|
|
|
964
964
|
let lostTries = 0;
|
|
965
965
|
for (; ; ) {
|
|
966
966
|
const limit = deadline.clamp(CALL_LIMIT_MS);
|
|
967
|
-
if (limit <= 0) throw timedOut(method,
|
|
967
|
+
if (limit <= 0) throw timedOut(method, path23);
|
|
968
968
|
let res;
|
|
969
969
|
if (method !== "GET") this.ctx.changeSent = true;
|
|
970
970
|
try {
|
|
@@ -978,12 +978,12 @@ var init_api = __esm({
|
|
|
978
978
|
} catch (error3) {
|
|
979
979
|
const blocked = blockedRequest(this.ctx.sandbox, error3);
|
|
980
980
|
if (blocked) throw blocked;
|
|
981
|
-
if (deadline.expired()) throw timedOut(method,
|
|
981
|
+
if (deadline.expired()) throw timedOut(method, path23);
|
|
982
982
|
if (retry === "safe" && lostTries < LOST_ANSWER_BACKOFF_MS.length) {
|
|
983
|
-
await this.wait(LOST_ANSWER_BACKOFF_MS[lostTries++], deadline, method,
|
|
983
|
+
await this.wait(LOST_ANSWER_BACKOFF_MS[lostTries++], deadline, method, path23);
|
|
984
984
|
continue;
|
|
985
985
|
}
|
|
986
|
-
throw new LostAnswer(method,
|
|
986
|
+
throw new LostAnswer(method, path23, void 0);
|
|
987
987
|
}
|
|
988
988
|
this.checkContractVersion(res.headers);
|
|
989
989
|
const parsed = await readBody(res);
|
|
@@ -997,17 +997,17 @@ var init_api = __esm({
|
|
|
997
997
|
}
|
|
998
998
|
if (UNKNOWN_OUTCOME_STATUSES.has(res.status)) {
|
|
999
999
|
if (retry === "safe" && lostTries < LOST_ANSWER_BACKOFF_MS.length) {
|
|
1000
|
-
await this.wait(LOST_ANSWER_BACKOFF_MS[lostTries++], deadline, method,
|
|
1000
|
+
await this.wait(LOST_ANSWER_BACKOFF_MS[lostTries++], deadline, method, path23);
|
|
1001
1001
|
continue;
|
|
1002
1002
|
}
|
|
1003
|
-
if (retry === "once") throw new LostAnswer(method,
|
|
1003
|
+
if (retry === "once") throw new LostAnswer(method, path23, res.status);
|
|
1004
1004
|
}
|
|
1005
1005
|
if (res.ok) {
|
|
1006
1006
|
if (headers["x-kombai-guest"] && parsed?.guest === true && typeof parsed.guestExpiresAt === "string")
|
|
1007
1007
|
await this.onGuestExpires?.(parsed.guestExpiresAt);
|
|
1008
1008
|
return { status: res.status, body: parsed, headers: res.headers };
|
|
1009
1009
|
}
|
|
1010
|
-
const error2 = apiError(res.status, parsed, method,
|
|
1010
|
+
const error2 = apiError(res.status, parsed, method, path23);
|
|
1011
1011
|
if (res.status === 503 && res.headers.has("retry-after")) {
|
|
1012
1012
|
error2.details = { ...error2.details, retryAfter: res.headers.get("retry-after") };
|
|
1013
1013
|
}
|
|
@@ -1092,8 +1092,8 @@ var init_api = __esm({
|
|
|
1092
1092
|
* @param {string} method
|
|
1093
1093
|
* @param {string} path
|
|
1094
1094
|
*/
|
|
1095
|
-
async wait(ms, deadline, method,
|
|
1096
|
-
if (deadline.remaining() <= ms) throw timedOut(method,
|
|
1095
|
+
async wait(ms, deadline, method, path23) {
|
|
1096
|
+
if (deadline.remaining() <= ms) throw timedOut(method, path23);
|
|
1097
1097
|
await this.ctx.sleep(ms);
|
|
1098
1098
|
}
|
|
1099
1099
|
/** @param {Headers} headers */
|
|
@@ -1252,7 +1252,8 @@ function storePaths(home) {
|
|
|
1252
1252
|
credentialsLock: path4.join(home, "credentials.lock"),
|
|
1253
1253
|
browser: path4.join(home, "browser"),
|
|
1254
1254
|
render: path4.join(home, "render"),
|
|
1255
|
-
claims: path4.join(home, "claims")
|
|
1255
|
+
claims: path4.join(home, "claims"),
|
|
1256
|
+
appSkillsRemoved: path4.join(home, "app-skills-removed")
|
|
1256
1257
|
};
|
|
1257
1258
|
}
|
|
1258
1259
|
async function readRecord(file2, after) {
|
|
@@ -2504,6 +2505,10 @@ var init_asset = __esm({
|
|
|
2504
2505
|
|
|
2505
2506
|
// src/commands/auth.js
|
|
2506
2507
|
import { constants, generateKeyPairSync, privateDecrypt, randomBytes as randomBytes4 } from "node:crypto";
|
|
2508
|
+
function loginBudgetMs(expiresAt, serverDate) {
|
|
2509
|
+
const budget = Date.parse(expiresAt) - Date.parse(serverDate ?? "");
|
|
2510
|
+
return Number.isFinite(budget) ? budget : LOGIN_WINDOW_MS;
|
|
2511
|
+
}
|
|
2507
2512
|
async function claimGuest(ctx, env) {
|
|
2508
2513
|
if (!await readGuest(ctx.home, env)) return {};
|
|
2509
2514
|
const outcome = await settleClaim(ctx, await openSession(ctx, { claim: false }));
|
|
@@ -2571,7 +2576,7 @@ function loginExpired() {
|
|
|
2571
2576
|
next: "kombai login"
|
|
2572
2577
|
});
|
|
2573
2578
|
}
|
|
2574
|
-
var REUSE_KEY_MS, POLL_MS2, RSA_BITS, login, logout, whoami, guest, claim;
|
|
2579
|
+
var REUSE_KEY_MS, POLL_MS2, RSA_BITS, LOGIN_WINDOW_MS, login, logout, whoami, guest, claim;
|
|
2575
2580
|
var init_auth = __esm({
|
|
2576
2581
|
"src/commands/auth.js"() {
|
|
2577
2582
|
"use strict";
|
|
@@ -2588,6 +2593,7 @@ var init_auth = __esm({
|
|
|
2588
2593
|
REUSE_KEY_MS = 3 * 24 * 60 * 60 * 1e3;
|
|
2589
2594
|
POLL_MS2 = 2e3;
|
|
2590
2595
|
RSA_BITS = 3072;
|
|
2596
|
+
LOGIN_WINDOW_MS = 6e5;
|
|
2591
2597
|
login = {
|
|
2592
2598
|
name: "login",
|
|
2593
2599
|
summary: "Sign in through the browser. Prints a waiting line with a match code at once, then the signed-in line. A key with more than 3 days left is reused. With a guest token here, it then claims the guest canvas into the account.",
|
|
@@ -2606,6 +2612,7 @@ var init_auth = __esm({
|
|
|
2606
2612
|
const { publicKey, privateKey } = generateKeyPairSync("rsa", { modulusLength: RSA_BITS });
|
|
2607
2613
|
const api = new ApiClient({ ctx, baseUrl: hosts.api, key: null, deadline: new Deadline(null, ctx.now) });
|
|
2608
2614
|
let started;
|
|
2615
|
+
let serverDate;
|
|
2609
2616
|
try {
|
|
2610
2617
|
const res = await api.call({
|
|
2611
2618
|
method: "POST",
|
|
@@ -2625,6 +2632,7 @@ var init_auth = __esm({
|
|
|
2625
2632
|
if (!b || typeof b.code !== "string" || typeof b.matchCode !== "string" || typeof b.approveUrl !== "string" || !b.approveUrl.startsWith(`${hosts.web}/`) || !Number.isFinite(Date.parse(b.expiresAt)))
|
|
2626
2633
|
throw new CliError("CLI_BAD_ANSWER", "The sign-in answer was not a login code.", { next: "kombai login" });
|
|
2627
2634
|
started = b;
|
|
2635
|
+
serverDate = res.headers.get("date");
|
|
2628
2636
|
} catch (error2) {
|
|
2629
2637
|
if (error2 instanceof LostAnswer) error2.next = "kombai login";
|
|
2630
2638
|
throw error2;
|
|
@@ -2636,7 +2644,7 @@ var init_auth = __esm({
|
|
|
2636
2644
|
expiresAt: started.expiresAt
|
|
2637
2645
|
});
|
|
2638
2646
|
if (!flags["no-browser"] && ctx.hasDisplay) await ctx.openUrl(started.approveUrl);
|
|
2639
|
-
const deadline = new Deadline(
|
|
2647
|
+
const deadline = new Deadline(loginBudgetMs(started.expiresAt, serverDate), ctx.now);
|
|
2640
2648
|
for (; ; ) {
|
|
2641
2649
|
let answer2;
|
|
2642
2650
|
try {
|
|
@@ -4047,15 +4055,15 @@ function toWSLPath(dir, fallback) {
|
|
|
4047
4055
|
return fallback;
|
|
4048
4056
|
}
|
|
4049
4057
|
}
|
|
4050
|
-
function getLocalAppDataPath(
|
|
4058
|
+
function getLocalAppDataPath(path23) {
|
|
4051
4059
|
const userRegExp = /\/mnt\/([a-z])\/Users\/([^\/:]+)\/AppData\//;
|
|
4052
|
-
const results = userRegExp.exec(
|
|
4060
|
+
const results = userRegExp.exec(path23) || [];
|
|
4053
4061
|
return `/mnt/${results[1]}/Users/${results[2]}/AppData/Local`;
|
|
4054
4062
|
}
|
|
4055
|
-
function getWSLLocalAppDataPath(
|
|
4063
|
+
function getWSLLocalAppDataPath(path23) {
|
|
4056
4064
|
const userRegExp = /\/([a-z])\/Users\/([^\/:]+)\/AppData\//;
|
|
4057
|
-
const results = userRegExp.exec(
|
|
4058
|
-
return toWSLPath(`${results[1]}:\\Users\\${results[2]}\\AppData\\Local`, getLocalAppDataPath(
|
|
4065
|
+
const results = userRegExp.exec(path23) || [];
|
|
4066
|
+
return toWSLPath(`${results[1]}:\\Users\\${results[2]}\\AppData\\Local`, getLocalAppDataPath(path23));
|
|
4059
4067
|
}
|
|
4060
4068
|
function makeUnixTmpDir() {
|
|
4061
4069
|
return childProcess.execSync("mktemp -d -t lighthouse.XXXXXXX").toString().trim();
|
|
@@ -4704,7 +4712,7 @@ var require_windows = __commonJS({
|
|
|
4704
4712
|
module.exports = isexe;
|
|
4705
4713
|
isexe.sync = sync;
|
|
4706
4714
|
var fs19 = __require("fs");
|
|
4707
|
-
function checkPathExt(
|
|
4715
|
+
function checkPathExt(path23, options) {
|
|
4708
4716
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
4709
4717
|
if (!pathext) {
|
|
4710
4718
|
return true;
|
|
@@ -4715,25 +4723,25 @@ var require_windows = __commonJS({
|
|
|
4715
4723
|
}
|
|
4716
4724
|
for (var i = 0; i < pathext.length; i++) {
|
|
4717
4725
|
var p = pathext[i].toLowerCase();
|
|
4718
|
-
if (p &&
|
|
4726
|
+
if (p && path23.substr(-p.length).toLowerCase() === p) {
|
|
4719
4727
|
return true;
|
|
4720
4728
|
}
|
|
4721
4729
|
}
|
|
4722
4730
|
return false;
|
|
4723
4731
|
}
|
|
4724
|
-
function checkStat(stat,
|
|
4732
|
+
function checkStat(stat, path23, options) {
|
|
4725
4733
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
4726
4734
|
return false;
|
|
4727
4735
|
}
|
|
4728
|
-
return checkPathExt(
|
|
4736
|
+
return checkPathExt(path23, options);
|
|
4729
4737
|
}
|
|
4730
|
-
function isexe(
|
|
4731
|
-
fs19.stat(
|
|
4732
|
-
cb(er, er ? false : checkStat(stat,
|
|
4738
|
+
function isexe(path23, options, cb) {
|
|
4739
|
+
fs19.stat(path23, function(er, stat) {
|
|
4740
|
+
cb(er, er ? false : checkStat(stat, path23, options));
|
|
4733
4741
|
});
|
|
4734
4742
|
}
|
|
4735
|
-
function sync(
|
|
4736
|
-
return checkStat(fs19.statSync(
|
|
4743
|
+
function sync(path23, options) {
|
|
4744
|
+
return checkStat(fs19.statSync(path23), path23, options);
|
|
4737
4745
|
}
|
|
4738
4746
|
}
|
|
4739
4747
|
});
|
|
@@ -4745,13 +4753,13 @@ var require_mode = __commonJS({
|
|
|
4745
4753
|
module.exports = isexe;
|
|
4746
4754
|
isexe.sync = sync;
|
|
4747
4755
|
var fs19 = __require("fs");
|
|
4748
|
-
function isexe(
|
|
4749
|
-
fs19.stat(
|
|
4756
|
+
function isexe(path23, options, cb) {
|
|
4757
|
+
fs19.stat(path23, function(er, stat) {
|
|
4750
4758
|
cb(er, er ? false : checkStat(stat, options));
|
|
4751
4759
|
});
|
|
4752
4760
|
}
|
|
4753
|
-
function sync(
|
|
4754
|
-
return checkStat(fs19.statSync(
|
|
4761
|
+
function sync(path23, options) {
|
|
4762
|
+
return checkStat(fs19.statSync(path23), options);
|
|
4755
4763
|
}
|
|
4756
4764
|
function checkStat(stat, options) {
|
|
4757
4765
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -4785,7 +4793,7 @@ var require_isexe = __commonJS({
|
|
|
4785
4793
|
}
|
|
4786
4794
|
module.exports = isexe;
|
|
4787
4795
|
isexe.sync = sync;
|
|
4788
|
-
function isexe(
|
|
4796
|
+
function isexe(path23, options, cb) {
|
|
4789
4797
|
if (typeof options === "function") {
|
|
4790
4798
|
cb = options;
|
|
4791
4799
|
options = {};
|
|
@@ -4795,7 +4803,7 @@ var require_isexe = __commonJS({
|
|
|
4795
4803
|
throw new TypeError("callback not provided");
|
|
4796
4804
|
}
|
|
4797
4805
|
return new Promise(function(resolve, reject) {
|
|
4798
|
-
isexe(
|
|
4806
|
+
isexe(path23, options || {}, function(er, is) {
|
|
4799
4807
|
if (er) {
|
|
4800
4808
|
reject(er);
|
|
4801
4809
|
} else {
|
|
@@ -4804,7 +4812,7 @@ var require_isexe = __commonJS({
|
|
|
4804
4812
|
});
|
|
4805
4813
|
});
|
|
4806
4814
|
}
|
|
4807
|
-
core(
|
|
4815
|
+
core(path23, options || {}, function(er, is) {
|
|
4808
4816
|
if (er) {
|
|
4809
4817
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
4810
4818
|
er = null;
|
|
@@ -4814,9 +4822,9 @@ var require_isexe = __commonJS({
|
|
|
4814
4822
|
cb(er, is);
|
|
4815
4823
|
});
|
|
4816
4824
|
}
|
|
4817
|
-
function sync(
|
|
4825
|
+
function sync(path23, options) {
|
|
4818
4826
|
try {
|
|
4819
|
-
return core.sync(
|
|
4827
|
+
return core.sync(path23, options || {});
|
|
4820
4828
|
} catch (er) {
|
|
4821
4829
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
4822
4830
|
return false;
|
|
@@ -4833,7 +4841,7 @@ var require_which = __commonJS({
|
|
|
4833
4841
|
"../../node_modules/which/which.js"(exports, module) {
|
|
4834
4842
|
init_define_KOMBAI_TELEMETRY();
|
|
4835
4843
|
var isWindows3 = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
4836
|
-
var
|
|
4844
|
+
var path23 = __require("path");
|
|
4837
4845
|
var COLON = isWindows3 ? ";" : ":";
|
|
4838
4846
|
var isexe = require_isexe();
|
|
4839
4847
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -4871,7 +4879,7 @@ var require_which = __commonJS({
|
|
|
4871
4879
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
4872
4880
|
const ppRaw = pathEnv[i];
|
|
4873
4881
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
4874
|
-
const pCmd =
|
|
4882
|
+
const pCmd = path23.join(pathPart, cmd);
|
|
4875
4883
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
4876
4884
|
resolve(subStep(p, i, 0));
|
|
4877
4885
|
});
|
|
@@ -4898,7 +4906,7 @@ var require_which = __commonJS({
|
|
|
4898
4906
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
4899
4907
|
const ppRaw = pathEnv[i];
|
|
4900
4908
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
4901
|
-
const pCmd =
|
|
4909
|
+
const pCmd = path23.join(pathPart, cmd);
|
|
4902
4910
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
4903
4911
|
for (let j = 0; j < pathExt.length; j++) {
|
|
4904
4912
|
const cur = p + pathExt[j];
|
|
@@ -4930,8 +4938,8 @@ import { existsSync } from "fs";
|
|
|
4930
4938
|
import path10 from "path";
|
|
4931
4939
|
function getEdgeLinux(name) {
|
|
4932
4940
|
try {
|
|
4933
|
-
let
|
|
4934
|
-
return
|
|
4941
|
+
let path23 = import_which.default.sync(name);
|
|
4942
|
+
return path23;
|
|
4935
4943
|
} catch (e) {
|
|
4936
4944
|
}
|
|
4937
4945
|
return null;
|
|
@@ -5530,13 +5538,7 @@ import dns from "node:dns/promises";
|
|
|
5530
5538
|
import http from "node:http";
|
|
5531
5539
|
import net2 from "node:net";
|
|
5532
5540
|
function isPrivateAddress(ip) {
|
|
5533
|
-
|
|
5534
|
-
if (v4) {
|
|
5535
|
-
const [a, b] = v4.split(".").map(Number);
|
|
5536
|
-
return a === 0 || a === 10 || a === 127 || a >= 224 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 198 && (b === 18 || b === 19);
|
|
5537
|
-
}
|
|
5538
|
-
const lower = ip.toLowerCase();
|
|
5539
|
-
return lower === "::" || lower === "::1" || /^f[cd]/.test(lower) || /^fe[89ab]/.test(lower) || /^ff/.test(lower);
|
|
5541
|
+
return PRIVATE.check(ip, net2.isIPv4(ip) ? "ipv4" : "ipv6");
|
|
5540
5542
|
}
|
|
5541
5543
|
async function publicAddress(host) {
|
|
5542
5544
|
const bare = host.replace(/^\[|\]$/g, "");
|
|
@@ -5630,12 +5632,44 @@ async function startProxy() {
|
|
|
5630
5632
|
})
|
|
5631
5633
|
};
|
|
5632
5634
|
}
|
|
5633
|
-
var PAGE_HOST;
|
|
5635
|
+
var PAGE_HOST, PRIVATE;
|
|
5634
5636
|
var init_proxy = __esm({
|
|
5635
5637
|
"src/render/proxy.js"() {
|
|
5636
5638
|
"use strict";
|
|
5637
5639
|
init_define_KOMBAI_TELEMETRY();
|
|
5638
5640
|
PAGE_HOST = "render.kombai.invalid";
|
|
5641
|
+
PRIVATE = new net2.BlockList();
|
|
5642
|
+
for (
|
|
5643
|
+
const [prefix, bits] of
|
|
5644
|
+
/** @type {const} */
|
|
5645
|
+
[
|
|
5646
|
+
["0.0.0.0", 8],
|
|
5647
|
+
["10.0.0.0", 8],
|
|
5648
|
+
["100.64.0.0", 10],
|
|
5649
|
+
["127.0.0.0", 8],
|
|
5650
|
+
["169.254.0.0", 16],
|
|
5651
|
+
["172.16.0.0", 12],
|
|
5652
|
+
["192.168.0.0", 16],
|
|
5653
|
+
["198.18.0.0", 15],
|
|
5654
|
+
["224.0.0.0", 3]
|
|
5655
|
+
]
|
|
5656
|
+
) {
|
|
5657
|
+
PRIVATE.addSubnet(prefix, bits, "ipv4");
|
|
5658
|
+
}
|
|
5659
|
+
for (
|
|
5660
|
+
const [prefix, bits] of
|
|
5661
|
+
/** @type {const} */
|
|
5662
|
+
[
|
|
5663
|
+
["::", 96],
|
|
5664
|
+
["64:ff9b::", 96],
|
|
5665
|
+
["64:ff9b:1::", 48],
|
|
5666
|
+
["fc00::", 7],
|
|
5667
|
+
["fe80::", 10],
|
|
5668
|
+
["ff00::", 8]
|
|
5669
|
+
]
|
|
5670
|
+
) {
|
|
5671
|
+
PRIVATE.addSubnet(prefix, bits, "ipv6");
|
|
5672
|
+
}
|
|
5639
5673
|
}
|
|
5640
5674
|
});
|
|
5641
5675
|
|
|
@@ -8250,8 +8284,8 @@ var init_parseUtil = __esm({
|
|
|
8250
8284
|
init_errors();
|
|
8251
8285
|
init_en();
|
|
8252
8286
|
makeIssue = (params) => {
|
|
8253
|
-
const { data, path:
|
|
8254
|
-
const fullPath = [...
|
|
8287
|
+
const { data, path: path23, errorMaps, issueData } = params;
|
|
8288
|
+
const fullPath = [...path23, ...issueData.path || []];
|
|
8255
8289
|
const fullIssue = {
|
|
8256
8290
|
...issueData,
|
|
8257
8291
|
path: fullPath
|
|
@@ -8534,11 +8568,11 @@ var init_types = __esm({
|
|
|
8534
8568
|
init_parseUtil();
|
|
8535
8569
|
init_util();
|
|
8536
8570
|
ParseInputLazyPath = class {
|
|
8537
|
-
constructor(parent, value,
|
|
8571
|
+
constructor(parent, value, path23, key) {
|
|
8538
8572
|
this._cachedPath = [];
|
|
8539
8573
|
this.parent = parent;
|
|
8540
8574
|
this.data = value;
|
|
8541
|
-
this._path =
|
|
8575
|
+
this._path = path23;
|
|
8542
8576
|
this._key = key;
|
|
8543
8577
|
}
|
|
8544
8578
|
get path() {
|
|
@@ -12047,10 +12081,10 @@ function mergeDefs(...defs) {
|
|
|
12047
12081
|
function cloneDef(schema) {
|
|
12048
12082
|
return mergeDefs(schema._zod.def);
|
|
12049
12083
|
}
|
|
12050
|
-
function getElementAtPath(obj,
|
|
12051
|
-
if (!
|
|
12084
|
+
function getElementAtPath(obj, path23) {
|
|
12085
|
+
if (!path23)
|
|
12052
12086
|
return obj;
|
|
12053
|
-
return
|
|
12087
|
+
return path23.reduce((acc, key) => acc?.[key], obj);
|
|
12054
12088
|
}
|
|
12055
12089
|
function promiseAllObject(promisesObj) {
|
|
12056
12090
|
const keys = Object.keys(promisesObj);
|
|
@@ -12362,11 +12396,11 @@ function aborted(x, startIndex = 0) {
|
|
|
12362
12396
|
}
|
|
12363
12397
|
return false;
|
|
12364
12398
|
}
|
|
12365
|
-
function prefixIssues(
|
|
12399
|
+
function prefixIssues(path23, issues) {
|
|
12366
12400
|
return issues.map((iss) => {
|
|
12367
12401
|
var _a2;
|
|
12368
12402
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
12369
|
-
iss.path.unshift(
|
|
12403
|
+
iss.path.unshift(path23);
|
|
12370
12404
|
return iss;
|
|
12371
12405
|
});
|
|
12372
12406
|
}
|
|
@@ -25532,8 +25566,8 @@ var require_utils = __commonJS({
|
|
|
25532
25566
|
}
|
|
25533
25567
|
return ind;
|
|
25534
25568
|
}
|
|
25535
|
-
function removeDotSegments(
|
|
25536
|
-
let input =
|
|
25569
|
+
function removeDotSegments(path23) {
|
|
25570
|
+
let input = path23;
|
|
25537
25571
|
const output = [];
|
|
25538
25572
|
let nextSlash = -1;
|
|
25539
25573
|
let len = 0;
|
|
@@ -25733,8 +25767,8 @@ var require_schemes = __commonJS({
|
|
|
25733
25767
|
wsComponent.secure = void 0;
|
|
25734
25768
|
}
|
|
25735
25769
|
if (wsComponent.resourceName) {
|
|
25736
|
-
const [
|
|
25737
|
-
wsComponent.path =
|
|
25770
|
+
const [path23, query] = wsComponent.resourceName.split("?");
|
|
25771
|
+
wsComponent.path = path23 && path23 !== "/" ? path23 : void 0;
|
|
25738
25772
|
wsComponent.query = query;
|
|
25739
25773
|
wsComponent.resourceName = void 0;
|
|
25740
25774
|
}
|
|
@@ -33865,6 +33899,87 @@ var init_commands = __esm({
|
|
|
33865
33899
|
}
|
|
33866
33900
|
});
|
|
33867
33901
|
|
|
33902
|
+
// src/lib/app-skills.js
|
|
33903
|
+
import { access, readdir, rm } from "node:fs/promises";
|
|
33904
|
+
import path21 from "node:path";
|
|
33905
|
+
function appSkillDirsOf(home, env) {
|
|
33906
|
+
const dirs = [
|
|
33907
|
+
path21.join(home, ".claude", "skills"),
|
|
33908
|
+
path21.join(home, ".agents", "skills"),
|
|
33909
|
+
path21.join(home, ".cursor", "skills"),
|
|
33910
|
+
path21.join(home, ".copilot", "skills"),
|
|
33911
|
+
path21.join(home, ".gemini", "skills"),
|
|
33912
|
+
path21.join(home, ".gemini", "config", "skills")
|
|
33913
|
+
];
|
|
33914
|
+
if (env.CLAUDE_CONFIG_DIR) dirs.push(path21.join(path21.resolve(env.CLAUDE_CONFIG_DIR), "skills"));
|
|
33915
|
+
return [...new Set(dirs)];
|
|
33916
|
+
}
|
|
33917
|
+
async function removeAppSkillsOnce(ctx) {
|
|
33918
|
+
if (ctx.appSkillDirs.length === 0) return;
|
|
33919
|
+
const record2 = storePaths(ctx.home).appSkillsRemoved;
|
|
33920
|
+
try {
|
|
33921
|
+
await access(record2);
|
|
33922
|
+
return;
|
|
33923
|
+
} catch {
|
|
33924
|
+
}
|
|
33925
|
+
if (!await removeAppSkills(ctx.appSkillDirs)) return;
|
|
33926
|
+
try {
|
|
33927
|
+
await ensureDir(ctx.home);
|
|
33928
|
+
await writeFileAtomic(record2, `${new Date(ctx.now()).toISOString()}
|
|
33929
|
+
`);
|
|
33930
|
+
} catch {
|
|
33931
|
+
}
|
|
33932
|
+
}
|
|
33933
|
+
async function removeAppSkills(dirs) {
|
|
33934
|
+
const done = await Promise.all(
|
|
33935
|
+
dirs.map(async (dir) => {
|
|
33936
|
+
let names;
|
|
33937
|
+
try {
|
|
33938
|
+
names = await readdir(dir);
|
|
33939
|
+
} catch (error2) {
|
|
33940
|
+
const code2 = (
|
|
33941
|
+
/** @type {NodeJS.ErrnoException} */
|
|
33942
|
+
error2.code
|
|
33943
|
+
);
|
|
33944
|
+
return code2 === "ENOENT" || code2 === "ENOTDIR";
|
|
33945
|
+
}
|
|
33946
|
+
const removed = await Promise.all(
|
|
33947
|
+
names.filter((name) => APP_SKILL_NAMES.has(name)).map(
|
|
33948
|
+
(name) => rm(path21.join(dir, name), { recursive: true, force: true }).then(
|
|
33949
|
+
() => true,
|
|
33950
|
+
() => false
|
|
33951
|
+
)
|
|
33952
|
+
)
|
|
33953
|
+
);
|
|
33954
|
+
return removed.every(Boolean);
|
|
33955
|
+
})
|
|
33956
|
+
);
|
|
33957
|
+
return done.every(Boolean);
|
|
33958
|
+
}
|
|
33959
|
+
var APP_SKILL_NAMES;
|
|
33960
|
+
var init_app_skills = __esm({
|
|
33961
|
+
"src/lib/app-skills.js"() {
|
|
33962
|
+
"use strict";
|
|
33963
|
+
init_define_KOMBAI_TELEMETRY();
|
|
33964
|
+
init_fsx();
|
|
33965
|
+
init_store();
|
|
33966
|
+
APP_SKILL_NAMES = /* @__PURE__ */ new Set([
|
|
33967
|
+
"code-kombai-design",
|
|
33968
|
+
"code-with-kombai",
|
|
33969
|
+
"describe-kombai-canvas",
|
|
33970
|
+
"design-with-kombai",
|
|
33971
|
+
"detect-design-system-with-kombai",
|
|
33972
|
+
"improve-ui-with-kombai",
|
|
33973
|
+
"kombai-faq",
|
|
33974
|
+
"kombai-status",
|
|
33975
|
+
"report-to-kombai",
|
|
33976
|
+
"review-ui-with-kombai",
|
|
33977
|
+
"diagnose-kombai",
|
|
33978
|
+
"open-in-kombai"
|
|
33979
|
+
]);
|
|
33980
|
+
}
|
|
33981
|
+
});
|
|
33982
|
+
|
|
33868
33983
|
// src/lib/args.js
|
|
33869
33984
|
function parseArgv(argv, commands) {
|
|
33870
33985
|
const pretty = argv.includes("--pretty");
|
|
@@ -34280,14 +34395,14 @@ var init_telemetry = __esm({
|
|
|
34280
34395
|
// src/lib/context.js
|
|
34281
34396
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
34282
34397
|
import os4 from "node:os";
|
|
34283
|
-
import
|
|
34398
|
+
import path22 from "node:path";
|
|
34284
34399
|
function createContext(overrides = {}) {
|
|
34285
34400
|
const platform2 = overrides.platform ?? process.platform;
|
|
34286
34401
|
const stdout = overrides.stdout ?? process.stdout;
|
|
34287
34402
|
const ctx = {
|
|
34288
34403
|
stdout,
|
|
34289
34404
|
stderr: process.stderr,
|
|
34290
|
-
home:
|
|
34405
|
+
home: path22.join(os4.homedir(), ".kombai", "cli"),
|
|
34291
34406
|
cwd: process.cwd(),
|
|
34292
34407
|
fetch: globalThis.fetch,
|
|
34293
34408
|
now: Date.now,
|
|
@@ -34309,6 +34424,7 @@ function createContext(overrides = {}) {
|
|
|
34309
34424
|
sandbox: sandboxOf(process.env),
|
|
34310
34425
|
claudeDesktop: process.env.CLAUDE_CODE_ENTRYPOINT === "claude-desktop",
|
|
34311
34426
|
changeSent: false,
|
|
34427
|
+
appSkillDirs: appSkillDirsOf(os4.homedir(), process.env),
|
|
34312
34428
|
...overrides
|
|
34313
34429
|
};
|
|
34314
34430
|
return ctx;
|
|
@@ -34317,6 +34433,7 @@ var init_context = __esm({
|
|
|
34317
34433
|
"src/lib/context.js"() {
|
|
34318
34434
|
"use strict";
|
|
34319
34435
|
init_define_KOMBAI_TELEMETRY();
|
|
34436
|
+
init_app_skills();
|
|
34320
34437
|
init_deadline();
|
|
34321
34438
|
init_open();
|
|
34322
34439
|
init_output();
|
|
@@ -34333,10 +34450,12 @@ __export(cli_exports, {
|
|
|
34333
34450
|
});
|
|
34334
34451
|
async function run(argv, overrides = {}) {
|
|
34335
34452
|
const ctx = createContext(overrides);
|
|
34453
|
+
const appSkills = removeAppSkillsOnce(ctx);
|
|
34336
34454
|
ctx.pretty = argv.includes("--pretty");
|
|
34337
34455
|
const started = ctx.now();
|
|
34338
34456
|
const ran = { command: null, help: false, wasGuest: await guestBefore(ctx) };
|
|
34339
34457
|
const exit = await execute(ctx, argv, ran);
|
|
34458
|
+
await appSkills;
|
|
34340
34459
|
await sendTelemetry(ctx, { ...ran, exit, ms: ctx.now() - started });
|
|
34341
34460
|
return exit;
|
|
34342
34461
|
}
|
|
@@ -34424,6 +34543,7 @@ var init_cli = __esm({
|
|
|
34424
34543
|
init_define_KOMBAI_TELEMETRY();
|
|
34425
34544
|
init_commands();
|
|
34426
34545
|
init_skill();
|
|
34546
|
+
init_app_skills();
|
|
34427
34547
|
init_args();
|
|
34428
34548
|
init_context();
|
|
34429
34549
|
init_output();
|
package/package.json
CHANGED