@kevisual/cli 0.0.70 → 0.0.72
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/assistant-server.js +50213 -4932
- package/dist/assistant.js +2422 -607
- package/dist/envision.js +391 -439
- package/package.json +5 -4
package/dist/envision.js
CHANGED
|
@@ -21134,7 +21134,7 @@ var require_safe_buffer = __commonJS((exports, module) => {
|
|
|
21134
21134
|
};
|
|
21135
21135
|
});
|
|
21136
21136
|
|
|
21137
|
-
// node_modules/.pnpm/jws@
|
|
21137
|
+
// node_modules/.pnpm/jws@4.0.1/node_modules/jws/lib/data-stream.js
|
|
21138
21138
|
var require_data_stream = __commonJS((exports, module) => {
|
|
21139
21139
|
var Buffer2 = require_safe_buffer().Buffer;
|
|
21140
21140
|
var Stream = __require("stream");
|
|
@@ -21180,37 +21180,6 @@ var require_data_stream = __commonJS((exports, module) => {
|
|
|
21180
21180
|
module.exports = DataStream;
|
|
21181
21181
|
});
|
|
21182
21182
|
|
|
21183
|
-
// node_modules/.pnpm/buffer-equal-constant-time@1.0.1/node_modules/buffer-equal-constant-time/index.js
|
|
21184
|
-
var require_buffer_equal_constant_time = __commonJS((exports, module) => {
|
|
21185
|
-
var Buffer2 = __require("buffer").Buffer;
|
|
21186
|
-
var SlowBuffer = __require("buffer").SlowBuffer;
|
|
21187
|
-
module.exports = bufferEq;
|
|
21188
|
-
function bufferEq(a, b) {
|
|
21189
|
-
if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
|
|
21190
|
-
return false;
|
|
21191
|
-
}
|
|
21192
|
-
if (a.length !== b.length) {
|
|
21193
|
-
return false;
|
|
21194
|
-
}
|
|
21195
|
-
var c = 0;
|
|
21196
|
-
for (var i = 0;i < a.length; i++) {
|
|
21197
|
-
c |= a[i] ^ b[i];
|
|
21198
|
-
}
|
|
21199
|
-
return c === 0;
|
|
21200
|
-
}
|
|
21201
|
-
bufferEq.install = function() {
|
|
21202
|
-
Buffer2.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
|
|
21203
|
-
return bufferEq(this, that);
|
|
21204
|
-
};
|
|
21205
|
-
};
|
|
21206
|
-
var origBufEqual = Buffer2.prototype.equal;
|
|
21207
|
-
var origSlowBufEqual = SlowBuffer.prototype.equal;
|
|
21208
|
-
bufferEq.restore = function() {
|
|
21209
|
-
Buffer2.prototype.equal = origBufEqual;
|
|
21210
|
-
SlowBuffer.prototype.equal = origSlowBufEqual;
|
|
21211
|
-
};
|
|
21212
|
-
});
|
|
21213
|
-
|
|
21214
21183
|
// node_modules/.pnpm/ecdsa-sig-formatter@1.0.11/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js
|
|
21215
21184
|
var require_param_bytes_for_alg = __commonJS((exports, module) => {
|
|
21216
21185
|
function getParamSize(keySize) {
|
|
@@ -21369,9 +21338,39 @@ var require_ecdsa_sig_formatter = __commonJS((exports, module) => {
|
|
|
21369
21338
|
};
|
|
21370
21339
|
});
|
|
21371
21340
|
|
|
21372
|
-
// node_modules/.pnpm/
|
|
21341
|
+
// node_modules/.pnpm/buffer-equal-constant-time@1.0.1/node_modules/buffer-equal-constant-time/index.js
|
|
21342
|
+
var require_buffer_equal_constant_time = __commonJS((exports, module) => {
|
|
21343
|
+
var Buffer2 = __require("buffer").Buffer;
|
|
21344
|
+
var SlowBuffer = __require("buffer").SlowBuffer;
|
|
21345
|
+
module.exports = bufferEq;
|
|
21346
|
+
function bufferEq(a, b) {
|
|
21347
|
+
if (!Buffer2.isBuffer(a) || !Buffer2.isBuffer(b)) {
|
|
21348
|
+
return false;
|
|
21349
|
+
}
|
|
21350
|
+
if (a.length !== b.length) {
|
|
21351
|
+
return false;
|
|
21352
|
+
}
|
|
21353
|
+
var c = 0;
|
|
21354
|
+
for (var i = 0;i < a.length; i++) {
|
|
21355
|
+
c |= a[i] ^ b[i];
|
|
21356
|
+
}
|
|
21357
|
+
return c === 0;
|
|
21358
|
+
}
|
|
21359
|
+
bufferEq.install = function() {
|
|
21360
|
+
Buffer2.prototype.equal = SlowBuffer.prototype.equal = function equal(that) {
|
|
21361
|
+
return bufferEq(this, that);
|
|
21362
|
+
};
|
|
21363
|
+
};
|
|
21364
|
+
var origBufEqual = Buffer2.prototype.equal;
|
|
21365
|
+
var origSlowBufEqual = SlowBuffer.prototype.equal;
|
|
21366
|
+
bufferEq.restore = function() {
|
|
21367
|
+
Buffer2.prototype.equal = origBufEqual;
|
|
21368
|
+
SlowBuffer.prototype.equal = origSlowBufEqual;
|
|
21369
|
+
};
|
|
21370
|
+
});
|
|
21371
|
+
|
|
21372
|
+
// node_modules/.pnpm/jwa@2.0.1/node_modules/jwa/index.js
|
|
21373
21373
|
var require_jwa = __commonJS((exports, module) => {
|
|
21374
|
-
var bufferEqual = require_buffer_equal_constant_time();
|
|
21375
21374
|
var Buffer2 = require_safe_buffer().Buffer;
|
|
21376
21375
|
var crypto = __require("crypto");
|
|
21377
21376
|
var formatEcdsa = require_ecdsa_sig_formatter();
|
|
@@ -21477,10 +21476,22 @@ var require_jwa = __commonJS((exports, module) => {
|
|
|
21477
21476
|
return fromBase64(sig);
|
|
21478
21477
|
};
|
|
21479
21478
|
}
|
|
21479
|
+
var bufferEqual;
|
|
21480
|
+
var timingSafeEqual = "timingSafeEqual" in crypto ? function timingSafeEqual(a, b) {
|
|
21481
|
+
if (a.byteLength !== b.byteLength) {
|
|
21482
|
+
return false;
|
|
21483
|
+
}
|
|
21484
|
+
return crypto.timingSafeEqual(a, b);
|
|
21485
|
+
} : function timingSafeEqual(a, b) {
|
|
21486
|
+
if (!bufferEqual) {
|
|
21487
|
+
bufferEqual = require_buffer_equal_constant_time();
|
|
21488
|
+
}
|
|
21489
|
+
return bufferEqual(a, b);
|
|
21490
|
+
};
|
|
21480
21491
|
function createHmacVerifier(bits) {
|
|
21481
21492
|
return function verify(thing, signature, secret) {
|
|
21482
21493
|
var computedSig = createHmacSigner(bits)(thing, secret);
|
|
21483
|
-
return
|
|
21494
|
+
return timingSafeEqual(Buffer2.from(signature), Buffer2.from(computedSig));
|
|
21484
21495
|
};
|
|
21485
21496
|
}
|
|
21486
21497
|
function createKeySigner(bits) {
|
|
@@ -21570,7 +21581,7 @@ var require_jwa = __commonJS((exports, module) => {
|
|
|
21570
21581
|
es: createECDSAVerifer,
|
|
21571
21582
|
none: createNoneVerifier
|
|
21572
21583
|
};
|
|
21573
|
-
var match = algorithm.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/
|
|
21584
|
+
var match = algorithm.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/);
|
|
21574
21585
|
if (!match)
|
|
21575
21586
|
throw typeError(MSG_INVALID_ALGORITHM, algorithm);
|
|
21576
21587
|
var algo = (match[1] || match[3]).toLowerCase();
|
|
@@ -21582,7 +21593,7 @@ var require_jwa = __commonJS((exports, module) => {
|
|
|
21582
21593
|
};
|
|
21583
21594
|
});
|
|
21584
21595
|
|
|
21585
|
-
// node_modules/.pnpm/jws@
|
|
21596
|
+
// node_modules/.pnpm/jws@4.0.1/node_modules/jws/lib/tostring.js
|
|
21586
21597
|
var require_tostring = __commonJS((exports, module) => {
|
|
21587
21598
|
var Buffer2 = __require("buffer").Buffer;
|
|
21588
21599
|
module.exports = function toString(obj) {
|
|
@@ -21594,7 +21605,7 @@ var require_tostring = __commonJS((exports, module) => {
|
|
|
21594
21605
|
};
|
|
21595
21606
|
});
|
|
21596
21607
|
|
|
21597
|
-
// node_modules/.pnpm/jws@
|
|
21608
|
+
// node_modules/.pnpm/jws@4.0.1/node_modules/jws/lib/sign-stream.js
|
|
21598
21609
|
var require_sign_stream = __commonJS((exports, module) => {
|
|
21599
21610
|
var Buffer2 = require_safe_buffer().Buffer;
|
|
21600
21611
|
var DataStream = require_data_stream();
|
|
@@ -21622,7 +21633,12 @@ var require_sign_stream = __commonJS((exports, module) => {
|
|
|
21622
21633
|
return util.format("%s.%s", securedInput, signature);
|
|
21623
21634
|
}
|
|
21624
21635
|
function SignStream(opts) {
|
|
21625
|
-
var secret = opts.secret
|
|
21636
|
+
var secret = opts.secret;
|
|
21637
|
+
secret = secret == null ? opts.privateKey : secret;
|
|
21638
|
+
secret = secret == null ? opts.key : secret;
|
|
21639
|
+
if (/^hs/i.test(opts.header.alg) === true && secret == null) {
|
|
21640
|
+
throw new TypeError("secret must be a string or buffer or a KeyObject");
|
|
21641
|
+
}
|
|
21626
21642
|
var secretStream = new DataStream(secret);
|
|
21627
21643
|
this.readable = true;
|
|
21628
21644
|
this.header = opts.header;
|
|
@@ -21662,7 +21678,7 @@ var require_sign_stream = __commonJS((exports, module) => {
|
|
|
21662
21678
|
module.exports = SignStream;
|
|
21663
21679
|
});
|
|
21664
21680
|
|
|
21665
|
-
// node_modules/.pnpm/jws@
|
|
21681
|
+
// node_modules/.pnpm/jws@4.0.1/node_modules/jws/lib/verify-stream.js
|
|
21666
21682
|
var require_verify_stream = __commonJS((exports, module) => {
|
|
21667
21683
|
var Buffer2 = require_safe_buffer().Buffer;
|
|
21668
21684
|
var DataStream = require_data_stream();
|
|
@@ -21732,7 +21748,12 @@ var require_verify_stream = __commonJS((exports, module) => {
|
|
|
21732
21748
|
}
|
|
21733
21749
|
function VerifyStream(opts) {
|
|
21734
21750
|
opts = opts || {};
|
|
21735
|
-
var secretOrKey = opts.secret
|
|
21751
|
+
var secretOrKey = opts.secret;
|
|
21752
|
+
secretOrKey = secretOrKey == null ? opts.publicKey : secretOrKey;
|
|
21753
|
+
secretOrKey = secretOrKey == null ? opts.key : secretOrKey;
|
|
21754
|
+
if (/^hs/i.test(opts.algorithm) === true && secretOrKey == null) {
|
|
21755
|
+
throw new TypeError("secret must be a string or buffer or a KeyObject");
|
|
21756
|
+
}
|
|
21736
21757
|
var secretStream = new DataStream(secretOrKey);
|
|
21737
21758
|
this.readable = true;
|
|
21738
21759
|
this.algorithm = opts.algorithm;
|
|
@@ -21770,7 +21791,7 @@ var require_verify_stream = __commonJS((exports, module) => {
|
|
|
21770
21791
|
module.exports = VerifyStream;
|
|
21771
21792
|
});
|
|
21772
21793
|
|
|
21773
|
-
// node_modules/.pnpm/jws@
|
|
21794
|
+
// node_modules/.pnpm/jws@4.0.1/node_modules/jws/index.js
|
|
21774
21795
|
var require_jws = __commonJS((exports) => {
|
|
21775
21796
|
var SignStream = require_sign_stream();
|
|
21776
21797
|
var VerifyStream = require_verify_stream();
|
|
@@ -21801,7 +21822,7 @@ var require_jws = __commonJS((exports) => {
|
|
|
21801
21822
|
};
|
|
21802
21823
|
});
|
|
21803
21824
|
|
|
21804
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
21825
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/decode.js
|
|
21805
21826
|
var require_decode = __commonJS((exports, module) => {
|
|
21806
21827
|
var jws = require_jws();
|
|
21807
21828
|
module.exports = function(jwt, options) {
|
|
@@ -21830,7 +21851,7 @@ var require_decode = __commonJS((exports, module) => {
|
|
|
21830
21851
|
};
|
|
21831
21852
|
});
|
|
21832
21853
|
|
|
21833
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
21854
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/JsonWebTokenError.js
|
|
21834
21855
|
var require_JsonWebTokenError = __commonJS((exports, module) => {
|
|
21835
21856
|
var JsonWebTokenError = function(message, error) {
|
|
21836
21857
|
Error.call(this, message);
|
|
@@ -21847,7 +21868,7 @@ var require_JsonWebTokenError = __commonJS((exports, module) => {
|
|
|
21847
21868
|
module.exports = JsonWebTokenError;
|
|
21848
21869
|
});
|
|
21849
21870
|
|
|
21850
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
21871
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/NotBeforeError.js
|
|
21851
21872
|
var require_NotBeforeError = __commonJS((exports, module) => {
|
|
21852
21873
|
var JsonWebTokenError = require_JsonWebTokenError();
|
|
21853
21874
|
var NotBeforeError = function(message, date) {
|
|
@@ -21860,7 +21881,7 @@ var require_NotBeforeError = __commonJS((exports, module) => {
|
|
|
21860
21881
|
module.exports = NotBeforeError;
|
|
21861
21882
|
});
|
|
21862
21883
|
|
|
21863
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
21884
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/TokenExpiredError.js
|
|
21864
21885
|
var require_TokenExpiredError = __commonJS((exports, module) => {
|
|
21865
21886
|
var JsonWebTokenError = require_JsonWebTokenError();
|
|
21866
21887
|
var TokenExpiredError = function(message, expiredAt) {
|
|
@@ -21983,7 +22004,7 @@ var require_ms = __commonJS((exports, module) => {
|
|
|
21983
22004
|
}
|
|
21984
22005
|
});
|
|
21985
22006
|
|
|
21986
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
22007
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/timespan.js
|
|
21987
22008
|
var require_timespan = __commonJS((exports, module) => {
|
|
21988
22009
|
var ms = require_ms();
|
|
21989
22010
|
module.exports = function(time, iat) {
|
|
@@ -23785,19 +23806,19 @@ var require_semver2 = __commonJS((exports, module) => {
|
|
|
23785
23806
|
};
|
|
23786
23807
|
});
|
|
23787
23808
|
|
|
23788
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
23809
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js
|
|
23789
23810
|
var require_asymmetricKeyDetailsSupported = __commonJS((exports, module) => {
|
|
23790
23811
|
var semver = require_semver2();
|
|
23791
23812
|
module.exports = semver.satisfies(process.version, ">=15.7.0");
|
|
23792
23813
|
});
|
|
23793
23814
|
|
|
23794
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
23815
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js
|
|
23795
23816
|
var require_rsaPssKeyDetailsSupported = __commonJS((exports, module) => {
|
|
23796
23817
|
var semver = require_semver2();
|
|
23797
23818
|
module.exports = semver.satisfies(process.version, ">=16.9.0");
|
|
23798
23819
|
});
|
|
23799
23820
|
|
|
23800
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
23821
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/validateAsymmetricKey.js
|
|
23801
23822
|
var require_validateAsymmetricKey = __commonJS((exports, module) => {
|
|
23802
23823
|
var ASYMMETRIC_KEY_DETAILS_SUPPORTED = require_asymmetricKeyDetailsSupported();
|
|
23803
23824
|
var RSA_PSS_KEY_DETAILS_SUPPORTED = require_rsaPssKeyDetailsSupported();
|
|
@@ -23850,13 +23871,13 @@ var require_validateAsymmetricKey = __commonJS((exports, module) => {
|
|
|
23850
23871
|
};
|
|
23851
23872
|
});
|
|
23852
23873
|
|
|
23853
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
23874
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/lib/psSupported.js
|
|
23854
23875
|
var require_psSupported = __commonJS((exports, module) => {
|
|
23855
23876
|
var semver = require_semver2();
|
|
23856
23877
|
module.exports = semver.satisfies(process.version, "^6.12.0 || >=8.0.0");
|
|
23857
23878
|
});
|
|
23858
23879
|
|
|
23859
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
23880
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/verify.js
|
|
23860
23881
|
var require_verify = __commonJS((exports, module) => {
|
|
23861
23882
|
var JsonWebTokenError = require_JsonWebTokenError();
|
|
23862
23883
|
var NotBeforeError = require_NotBeforeError();
|
|
@@ -24477,7 +24498,7 @@ var require_lodash7 = __commonJS((exports, module) => {
|
|
|
24477
24498
|
module.exports = once;
|
|
24478
24499
|
});
|
|
24479
24500
|
|
|
24480
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
24501
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/sign.js
|
|
24481
24502
|
var require_sign = __commonJS((exports, module) => {
|
|
24482
24503
|
var timespan = require_timespan();
|
|
24483
24504
|
var PS_SUPPORTED = require_psSupported();
|
|
@@ -24699,7 +24720,7 @@ var require_sign = __commonJS((exports, module) => {
|
|
|
24699
24720
|
};
|
|
24700
24721
|
});
|
|
24701
24722
|
|
|
24702
|
-
// node_modules/.pnpm/jsonwebtoken@9.0.
|
|
24723
|
+
// node_modules/.pnpm/jsonwebtoken@9.0.3/node_modules/jsonwebtoken/index.js
|
|
24703
24724
|
var require_jsonwebtoken = __commonJS((exports, module) => {
|
|
24704
24725
|
module.exports = {
|
|
24705
24726
|
decode: require_decode(),
|
|
@@ -40643,8 +40664,8 @@ InitEnv.init();
|
|
|
40643
40664
|
var version = useContextKey("version", () => {
|
|
40644
40665
|
let version2 = "0.0.64";
|
|
40645
40666
|
try {
|
|
40646
|
-
if ("0.0.
|
|
40647
|
-
version2 = "0.0.
|
|
40667
|
+
if ("0.0.71")
|
|
40668
|
+
version2 = "0.0.71";
|
|
40648
40669
|
} catch (e) {}
|
|
40649
40670
|
return version2;
|
|
40650
40671
|
});
|
|
@@ -40691,7 +40712,7 @@ var writeConfig = (config) => {
|
|
|
40691
40712
|
return config;
|
|
40692
40713
|
};
|
|
40693
40714
|
|
|
40694
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
40715
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/key.js
|
|
40695
40716
|
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
40696
40717
|
var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
40697
40718
|
var isSpaceKey = (key) => key.name === "space";
|
|
@@ -40699,7 +40720,7 @@ var isBackspaceKey = (key) => key.name === "backspace";
|
|
|
40699
40720
|
var isTabKey = (key) => key.name === "tab";
|
|
40700
40721
|
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
40701
40722
|
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
40702
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
40723
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/errors.js
|
|
40703
40724
|
class AbortPromptError extends Error {
|
|
40704
40725
|
name = "AbortPromptError";
|
|
40705
40726
|
message = "Prompt was aborted";
|
|
@@ -40725,10 +40746,10 @@ class HookError extends Error {
|
|
|
40725
40746
|
class ValidationError extends Error {
|
|
40726
40747
|
name = "ValidationError";
|
|
40727
40748
|
}
|
|
40728
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
40749
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
40729
40750
|
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
40730
40751
|
|
|
40731
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
40752
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
40732
40753
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
40733
40754
|
var hookStorage = new AsyncLocalStorage;
|
|
40734
40755
|
function createStore(rl) {
|
|
@@ -40833,7 +40854,7 @@ var effectScheduler = {
|
|
|
40833
40854
|
}
|
|
40834
40855
|
};
|
|
40835
40856
|
|
|
40836
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
40857
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
40837
40858
|
function useState(defaultValue) {
|
|
40838
40859
|
return withPointer((pointer) => {
|
|
40839
40860
|
const setState = AsyncResource2.bind(function setState(newValue) {
|
|
@@ -40851,7 +40872,7 @@ function useState(defaultValue) {
|
|
|
40851
40872
|
});
|
|
40852
40873
|
}
|
|
40853
40874
|
|
|
40854
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
40875
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
40855
40876
|
function useEffect(cb, depArray) {
|
|
40856
40877
|
withPointer((pointer) => {
|
|
40857
40878
|
const oldDeps = pointer.get();
|
|
@@ -40863,10 +40884,10 @@ function useEffect(cb, depArray) {
|
|
|
40863
40884
|
});
|
|
40864
40885
|
}
|
|
40865
40886
|
|
|
40866
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
40887
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/theme.js
|
|
40867
40888
|
import { styleText } from "node:util";
|
|
40868
40889
|
|
|
40869
|
-
// node_modules/.pnpm/@inquirer+figures@2.0.
|
|
40890
|
+
// node_modules/.pnpm/@inquirer+figures@2.0.2/node_modules/@inquirer/figures/dist/index.js
|
|
40870
40891
|
import process2 from "node:process";
|
|
40871
40892
|
function isUnicodeSupported() {
|
|
40872
40893
|
if (process2.platform !== "win32") {
|
|
@@ -41155,7 +41176,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
|
41155
41176
|
var dist_default = figures;
|
|
41156
41177
|
var replacements = Object.entries(specialMainSymbols);
|
|
41157
41178
|
|
|
41158
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41179
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/theme.js
|
|
41159
41180
|
var defaultTheme = {
|
|
41160
41181
|
prefix: {
|
|
41161
41182
|
idle: styleText("blue", "?"),
|
|
@@ -41176,7 +41197,7 @@ var defaultTheme = {
|
|
|
41176
41197
|
}
|
|
41177
41198
|
};
|
|
41178
41199
|
|
|
41179
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41200
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
41180
41201
|
function isPlainObject(value) {
|
|
41181
41202
|
if (typeof value !== "object" || value === null)
|
|
41182
41203
|
return false;
|
|
@@ -41204,7 +41225,7 @@ function makeTheme(...themes) {
|
|
|
41204
41225
|
return deepMerge(...themesToMerge);
|
|
41205
41226
|
}
|
|
41206
41227
|
|
|
41207
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41228
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
41208
41229
|
function usePrefix({ status = "idle", theme }) {
|
|
41209
41230
|
const [showLoader, setShowLoader] = useState(false);
|
|
41210
41231
|
const [tick, setTick] = useState(0);
|
|
@@ -41234,7 +41255,7 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
41234
41255
|
const iconName = status === "loading" ? "idle" : status;
|
|
41235
41256
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
41236
41257
|
}
|
|
41237
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41258
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
41238
41259
|
function useMemo(fn, dependencies) {
|
|
41239
41260
|
return withPointer((pointer) => {
|
|
41240
41261
|
const prev = pointer.get();
|
|
@@ -41246,11 +41267,11 @@ function useMemo(fn, dependencies) {
|
|
|
41246
41267
|
return prev.value;
|
|
41247
41268
|
});
|
|
41248
41269
|
}
|
|
41249
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41270
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
41250
41271
|
function useRef(val) {
|
|
41251
41272
|
return useState({ current: val })[0];
|
|
41252
41273
|
}
|
|
41253
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41274
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
41254
41275
|
function useKeypress(userHandler) {
|
|
41255
41276
|
const signal = useRef(userHandler);
|
|
41256
41277
|
signal.current = userHandler;
|
|
@@ -41268,7 +41289,7 @@ function useKeypress(userHandler) {
|
|
|
41268
41289
|
};
|
|
41269
41290
|
}, []);
|
|
41270
41291
|
}
|
|
41271
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41292
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/utils.js
|
|
41272
41293
|
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
41273
41294
|
|
|
41274
41295
|
// node_modules/.pnpm/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
|
|
@@ -41702,7 +41723,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
41702
41723
|
`);
|
|
41703
41724
|
}
|
|
41704
41725
|
|
|
41705
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41726
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/utils.js
|
|
41706
41727
|
function breakLines(content, width) {
|
|
41707
41728
|
return content.split(`
|
|
41708
41729
|
`).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
|
|
@@ -41713,7 +41734,7 @@ function readlineWidth() {
|
|
|
41713
41734
|
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
41714
41735
|
}
|
|
41715
41736
|
|
|
41716
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41737
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
41717
41738
|
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
41718
41739
|
const state = useRef({
|
|
41719
41740
|
lastPointer: active,
|
|
@@ -41779,7 +41800,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
|
41779
41800
|
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
41780
41801
|
`);
|
|
41781
41802
|
}
|
|
41782
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
41803
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
41783
41804
|
var import_mute_stream = __toESM(require_lib(), 1);
|
|
41784
41805
|
import * as readline2 from "node:readline";
|
|
41785
41806
|
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
@@ -41992,10 +42013,10 @@ var {
|
|
|
41992
42013
|
unload
|
|
41993
42014
|
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
41994
42015
|
|
|
41995
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
42016
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
41996
42017
|
import { stripVTControlCharacters } from "node:util";
|
|
41997
42018
|
|
|
41998
|
-
// node_modules/.pnpm/@inquirer+ansi@2.0.
|
|
42019
|
+
// node_modules/.pnpm/@inquirer+ansi@2.0.2/node_modules/@inquirer/ansi/dist/index.js
|
|
41999
42020
|
var ESC = "\x1B[";
|
|
42000
42021
|
var cursorLeft = ESC + "G";
|
|
42001
42022
|
var cursorHide = ESC + "?25l";
|
|
@@ -42011,7 +42032,7 @@ var cursorTo = (x, y) => {
|
|
|
42011
42032
|
var eraseLine = ESC + "2K";
|
|
42012
42033
|
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
42013
42034
|
|
|
42014
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
42035
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
42015
42036
|
var height = (content) => content.split(`
|
|
42016
42037
|
`).length;
|
|
42017
42038
|
var lastLine = (content) => content.split(`
|
|
@@ -42076,7 +42097,7 @@ class ScreenManager {
|
|
|
42076
42097
|
}
|
|
42077
42098
|
}
|
|
42078
42099
|
|
|
42079
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
42100
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
42080
42101
|
class PromisePolyfill extends Promise {
|
|
42081
42102
|
static withResolver() {
|
|
42082
42103
|
let resolve;
|
|
@@ -42089,7 +42110,7 @@ class PromisePolyfill extends Promise {
|
|
|
42089
42110
|
}
|
|
42090
42111
|
}
|
|
42091
42112
|
|
|
42092
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
42113
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
42093
42114
|
function getCallSites() {
|
|
42094
42115
|
const _prepareStackTrace = Error.prepareStackTrace;
|
|
42095
42116
|
let result = [];
|
|
@@ -42175,7 +42196,7 @@ function createPrompt(view) {
|
|
|
42175
42196
|
};
|
|
42176
42197
|
return prompt;
|
|
42177
42198
|
}
|
|
42178
|
-
// node_modules/.pnpm/@inquirer+core@11.0.
|
|
42199
|
+
// node_modules/.pnpm/@inquirer+core@11.0.2_@types+node@24.10.1/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
42179
42200
|
import { styleText as styleText2 } from "node:util";
|
|
42180
42201
|
class Separator {
|
|
42181
42202
|
separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
@@ -42189,7 +42210,7 @@ class Separator {
|
|
|
42189
42210
|
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
42190
42211
|
}
|
|
42191
42212
|
}
|
|
42192
|
-
// node_modules/.pnpm/@inquirer+checkbox@5.0.
|
|
42213
|
+
// node_modules/.pnpm/@inquirer+checkbox@5.0.2_@types+node@24.10.1/node_modules/@inquirer/checkbox/dist/index.js
|
|
42193
42214
|
import { styleText as styleText3 } from "node:util";
|
|
42194
42215
|
var checkboxTheme = {
|
|
42195
42216
|
icon: {
|
|
@@ -42362,7 +42383,7 @@ var dist_default2 = createPrompt((config, done) => {
|
|
|
42362
42383
|
`).trimEnd();
|
|
42363
42384
|
return `${lines}${cursorHide}`;
|
|
42364
42385
|
});
|
|
42365
|
-
// node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
42386
|
+
// node_modules/.pnpm/@inquirer+external-editor@2.0.2_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/index.js
|
|
42366
42387
|
var import_chardet = __toESM(require_lib2(), 1);
|
|
42367
42388
|
var import_iconv_lite = __toESM(require_lib3(), 1);
|
|
42368
42389
|
import { spawn, spawnSync } from "child_process";
|
|
@@ -42371,7 +42392,7 @@ import path2 from "node:path";
|
|
|
42371
42392
|
import os2 from "node:os";
|
|
42372
42393
|
import { randomUUID } from "node:crypto";
|
|
42373
42394
|
|
|
42374
|
-
// node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
42395
|
+
// node_modules/.pnpm/@inquirer+external-editor@2.0.2_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/errors/CreateFileError.js
|
|
42375
42396
|
class CreateFileError extends Error {
|
|
42376
42397
|
originalError;
|
|
42377
42398
|
constructor(originalError) {
|
|
@@ -42380,7 +42401,7 @@ class CreateFileError extends Error {
|
|
|
42380
42401
|
}
|
|
42381
42402
|
}
|
|
42382
42403
|
|
|
42383
|
-
// node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
42404
|
+
// node_modules/.pnpm/@inquirer+external-editor@2.0.2_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/errors/LaunchEditorError.js
|
|
42384
42405
|
class LaunchEditorError extends Error {
|
|
42385
42406
|
originalError;
|
|
42386
42407
|
constructor(originalError) {
|
|
@@ -42389,7 +42410,7 @@ class LaunchEditorError extends Error {
|
|
|
42389
42410
|
}
|
|
42390
42411
|
}
|
|
42391
42412
|
|
|
42392
|
-
// node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
42413
|
+
// node_modules/.pnpm/@inquirer+external-editor@2.0.2_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/errors/ReadFileError.js
|
|
42393
42414
|
class ReadFileError extends Error {
|
|
42394
42415
|
originalError;
|
|
42395
42416
|
constructor(originalError) {
|
|
@@ -42398,7 +42419,7 @@ class ReadFileError extends Error {
|
|
|
42398
42419
|
}
|
|
42399
42420
|
}
|
|
42400
42421
|
|
|
42401
|
-
// node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
42422
|
+
// node_modules/.pnpm/@inquirer+external-editor@2.0.2_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/errors/RemoveFileError.js
|
|
42402
42423
|
class RemoveFileError extends Error {
|
|
42403
42424
|
originalError;
|
|
42404
42425
|
constructor(originalError) {
|
|
@@ -42407,7 +42428,7 @@ class RemoveFileError extends Error {
|
|
|
42407
42428
|
}
|
|
42408
42429
|
}
|
|
42409
42430
|
|
|
42410
|
-
// node_modules/.pnpm/@inquirer+external-editor@2.0.
|
|
42431
|
+
// node_modules/.pnpm/@inquirer+external-editor@2.0.2_@types+node@24.10.1/node_modules/@inquirer/external-editor/dist/index.js
|
|
42411
42432
|
function editAsync(text = "", callback, fileOptions) {
|
|
42412
42433
|
const editor = new ExternalEditor(text, fileOptions);
|
|
42413
42434
|
editor.runAsync((err, result) => {
|
|
@@ -42562,7 +42583,7 @@ class ExternalEditor {
|
|
|
42562
42583
|
}
|
|
42563
42584
|
}
|
|
42564
42585
|
|
|
42565
|
-
// node_modules/.pnpm/@inquirer+editor@5.0.
|
|
42586
|
+
// node_modules/.pnpm/@inquirer+editor@5.0.2_@types+node@24.10.1/node_modules/@inquirer/editor/dist/index.js
|
|
42566
42587
|
var editorTheme = {
|
|
42567
42588
|
validationFailureMode: "keep"
|
|
42568
42589
|
};
|
|
@@ -42630,7 +42651,7 @@ var dist_default3 = createPrompt((config, done) => {
|
|
|
42630
42651
|
}
|
|
42631
42652
|
return [[prefix, message, helpTip].filter(Boolean).join(" "), error];
|
|
42632
42653
|
});
|
|
42633
|
-
// node_modules/.pnpm/@inquirer+confirm@6.0.
|
|
42654
|
+
// node_modules/.pnpm/@inquirer+confirm@6.0.2_@types+node@24.10.1/node_modules/@inquirer/confirm/dist/index.js
|
|
42634
42655
|
function getBooleanValue(value, defaultValue) {
|
|
42635
42656
|
let answer = defaultValue !== false;
|
|
42636
42657
|
if (/^(y|yes)/i.test(value))
|
|
@@ -42675,7 +42696,7 @@ var dist_default4 = createPrompt((config, done) => {
|
|
|
42675
42696
|
const message = theme.style.message(config.message, status);
|
|
42676
42697
|
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
42677
42698
|
});
|
|
42678
|
-
// node_modules/.pnpm/@inquirer+input@5.0.
|
|
42699
|
+
// node_modules/.pnpm/@inquirer+input@5.0.2_@types+node@24.10.1/node_modules/@inquirer/input/dist/index.js
|
|
42679
42700
|
var inputTheme = {
|
|
42680
42701
|
validationFailureMode: "keep"
|
|
42681
42702
|
};
|
|
@@ -42759,7 +42780,7 @@ var dist_default5 = createPrompt((config, done) => {
|
|
|
42759
42780
|
error
|
|
42760
42781
|
];
|
|
42761
42782
|
});
|
|
42762
|
-
// node_modules/.pnpm/@inquirer+number@4.0.
|
|
42783
|
+
// node_modules/.pnpm/@inquirer+number@4.0.2_@types+node@24.10.1/node_modules/@inquirer/number/dist/index.js
|
|
42763
42784
|
function isStepOf(value, step, min) {
|
|
42764
42785
|
const valuePow = value * Math.pow(10, 6);
|
|
42765
42786
|
const stepPow = step * Math.pow(10, 6);
|
|
@@ -42839,7 +42860,7 @@ var dist_default6 = createPrompt((config, done) => {
|
|
|
42839
42860
|
error
|
|
42840
42861
|
];
|
|
42841
42862
|
});
|
|
42842
|
-
// node_modules/.pnpm/@inquirer+expand@5.0.
|
|
42863
|
+
// node_modules/.pnpm/@inquirer+expand@5.0.2_@types+node@24.10.1/node_modules/@inquirer/expand/dist/index.js
|
|
42843
42864
|
import { styleText as styleText4 } from "node:util";
|
|
42844
42865
|
function normalizeChoices2(choices) {
|
|
42845
42866
|
return choices.map((choice) => {
|
|
@@ -42936,7 +42957,7 @@ var dist_default7 = createPrompt((config, done) => {
|
|
|
42936
42957
|
`)
|
|
42937
42958
|
];
|
|
42938
42959
|
});
|
|
42939
|
-
// node_modules/.pnpm/@inquirer+rawlist@5.0.
|
|
42960
|
+
// node_modules/.pnpm/@inquirer+rawlist@5.0.2_@types+node@24.10.1/node_modules/@inquirer/rawlist/dist/index.js
|
|
42940
42961
|
import { styleText as styleText5 } from "node:util";
|
|
42941
42962
|
var numberRegex = /\d+/;
|
|
42942
42963
|
function isSelectableChoice(choice) {
|
|
@@ -43047,7 +43068,7 @@ var dist_default8 = createPrompt((config, done) => {
|
|
|
43047
43068
|
`)
|
|
43048
43069
|
];
|
|
43049
43070
|
});
|
|
43050
|
-
// node_modules/.pnpm/@inquirer+password@5.0.
|
|
43071
|
+
// node_modules/.pnpm/@inquirer+password@5.0.2_@types+node@24.10.1/node_modules/@inquirer/password/dist/index.js
|
|
43051
43072
|
var dist_default9 = createPrompt((config, done) => {
|
|
43052
43073
|
const { validate: validate2 = () => true } = config;
|
|
43053
43074
|
const theme = makeTheme(config.theme);
|
|
@@ -43095,7 +43116,7 @@ var dist_default9 = createPrompt((config, done) => {
|
|
|
43095
43116
|
}
|
|
43096
43117
|
return [[prefix, message, config.mask ? formattedValue : helpTip].join(" "), error];
|
|
43097
43118
|
});
|
|
43098
|
-
// node_modules/.pnpm/@inquirer+search@4.0.
|
|
43119
|
+
// node_modules/.pnpm/@inquirer+search@4.0.2_@types+node@24.10.1/node_modules/@inquirer/search/dist/index.js
|
|
43099
43120
|
import { styleText as styleText6 } from "node:util";
|
|
43100
43121
|
var searchTheme = {
|
|
43101
43122
|
icon: { cursor: dist_default.pointer },
|
|
@@ -43257,7 +43278,7 @@ var dist_default10 = createPrompt((config, done) => {
|
|
|
43257
43278
|
`).trimEnd();
|
|
43258
43279
|
return [header, body];
|
|
43259
43280
|
});
|
|
43260
|
-
// node_modules/.pnpm/@inquirer+select@5.0.
|
|
43281
|
+
// node_modules/.pnpm/@inquirer+select@5.0.2_@types+node@24.10.1/node_modules/@inquirer/select/dist/index.js
|
|
43261
43282
|
import { styleText as styleText7 } from "node:util";
|
|
43262
43283
|
var selectTheme = {
|
|
43263
43284
|
icon: { cursor: dist_default.pointer },
|
|
@@ -43412,7 +43433,7 @@ var dist_default11 = createPrompt((config, done) => {
|
|
|
43412
43433
|
`).trimEnd();
|
|
43413
43434
|
return `${lines}${cursorHide}`;
|
|
43414
43435
|
});
|
|
43415
|
-
// node_modules/.pnpm/inquirer@13.0.
|
|
43436
|
+
// node_modules/.pnpm/inquirer@13.0.2_@types+node@24.10.1/node_modules/inquirer/dist/ui/prompt.js
|
|
43416
43437
|
var import_rxjs = __toESM(require_cjs(), 1);
|
|
43417
43438
|
var import_run_async = __toESM(require_run_async(), 1);
|
|
43418
43439
|
var import_mute_stream2 = __toESM(require_lib(), 1);
|
|
@@ -43623,7 +43644,7 @@ class PromptsRunner {
|
|
|
43623
43644
|
};
|
|
43624
43645
|
}
|
|
43625
43646
|
|
|
43626
|
-
// node_modules/.pnpm/inquirer@13.0.
|
|
43647
|
+
// node_modules/.pnpm/inquirer@13.0.2_@types+node@24.10.1/node_modules/inquirer/dist/index.js
|
|
43627
43648
|
var builtInPrompts = {
|
|
43628
43649
|
input: dist_default5,
|
|
43629
43650
|
select: dist_default11,
|
|
@@ -43674,19 +43695,23 @@ var dist_default12 = inquirer;
|
|
|
43674
43695
|
// src/module/login/login-by-web.ts
|
|
43675
43696
|
var import_md5 = __toESM(require_md5(), 1);
|
|
43676
43697
|
|
|
43677
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
43698
|
+
// node_modules/.pnpm/@kevisual+query@0.0.31/node_modules/@kevisual/query/dist/query.js
|
|
43678
43699
|
var isTextForContentType = (contentType) => {
|
|
43679
43700
|
if (!contentType)
|
|
43680
43701
|
return false;
|
|
43681
|
-
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded"];
|
|
43702
|
+
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded", "md"];
|
|
43682
43703
|
return textTypes.some((type) => contentType.includes(type));
|
|
43683
43704
|
};
|
|
43684
43705
|
var adapter = async (opts = {}, overloadOpts) => {
|
|
43685
43706
|
const controller = new AbortController;
|
|
43686
43707
|
const signal = controller.signal;
|
|
43687
|
-
const isBlob = opts.isBlob || false;
|
|
43688
|
-
const isText = opts.isText || false;
|
|
43689
43708
|
const isPostFile = opts.isPostFile || false;
|
|
43709
|
+
let responseType = opts.responseType || "json";
|
|
43710
|
+
if (opts.isBlob) {
|
|
43711
|
+
responseType = "blob";
|
|
43712
|
+
} else if (opts.isText) {
|
|
43713
|
+
responseType = "text";
|
|
43714
|
+
}
|
|
43690
43715
|
const timeout = opts.timeout || 60000 * 3;
|
|
43691
43716
|
const timer = setTimeout(() => {
|
|
43692
43717
|
controller.abort();
|
|
@@ -43704,6 +43729,9 @@ var adapter = async (opts = {}, overloadOpts) => {
|
|
|
43704
43729
|
const isGet = method === "GET";
|
|
43705
43730
|
if (isGet) {
|
|
43706
43731
|
url.search = new URLSearchParams(opts.body).toString();
|
|
43732
|
+
} else {
|
|
43733
|
+
const params = opts.params || {};
|
|
43734
|
+
url.search = new URLSearchParams(params).toString();
|
|
43707
43735
|
}
|
|
43708
43736
|
let body = undefined;
|
|
43709
43737
|
if (isGet) {
|
|
@@ -43725,9 +43753,10 @@ var adapter = async (opts = {}, overloadOpts) => {
|
|
|
43725
43753
|
headers
|
|
43726
43754
|
}).then(async (response) => {
|
|
43727
43755
|
const contentType = response.headers.get("Content-Type");
|
|
43728
|
-
if (
|
|
43756
|
+
if (responseType === "blob") {
|
|
43729
43757
|
return await response.blob();
|
|
43730
43758
|
}
|
|
43759
|
+
const isText = responseType === "text";
|
|
43731
43760
|
const isJson = contentType && contentType.includes("application/json");
|
|
43732
43761
|
if (isJson && !isText) {
|
|
43733
43762
|
return await response.json();
|
|
@@ -43893,19 +43922,23 @@ class Query {
|
|
|
43893
43922
|
}
|
|
43894
43923
|
}
|
|
43895
43924
|
|
|
43896
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
43925
|
+
// node_modules/.pnpm/@kevisual+query@0.0.31/node_modules/@kevisual/query/dist/query-browser.js
|
|
43897
43926
|
var isTextForContentType2 = (contentType) => {
|
|
43898
43927
|
if (!contentType)
|
|
43899
43928
|
return false;
|
|
43900
|
-
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded"];
|
|
43929
|
+
const textTypes = ["text/", "xml", "html", "javascript", "css", "csv", "plain", "x-www-form-urlencoded", "md"];
|
|
43901
43930
|
return textTypes.some((type) => contentType.includes(type));
|
|
43902
43931
|
};
|
|
43903
43932
|
var adapter2 = async (opts = {}, overloadOpts) => {
|
|
43904
43933
|
const controller = new AbortController;
|
|
43905
43934
|
const signal = controller.signal;
|
|
43906
|
-
const isBlob = opts.isBlob || false;
|
|
43907
|
-
const isText = opts.isText || false;
|
|
43908
43935
|
const isPostFile = opts.isPostFile || false;
|
|
43936
|
+
let responseType = opts.responseType || "json";
|
|
43937
|
+
if (opts.isBlob) {
|
|
43938
|
+
responseType = "blob";
|
|
43939
|
+
} else if (opts.isText) {
|
|
43940
|
+
responseType = "text";
|
|
43941
|
+
}
|
|
43909
43942
|
const timeout = opts.timeout || 60000 * 3;
|
|
43910
43943
|
const timer = setTimeout(() => {
|
|
43911
43944
|
controller.abort();
|
|
@@ -43923,6 +43956,9 @@ var adapter2 = async (opts = {}, overloadOpts) => {
|
|
|
43923
43956
|
const isGet = method === "GET";
|
|
43924
43957
|
if (isGet) {
|
|
43925
43958
|
url.search = new URLSearchParams(opts.body).toString();
|
|
43959
|
+
} else {
|
|
43960
|
+
const params = opts.params || {};
|
|
43961
|
+
url.search = new URLSearchParams(params).toString();
|
|
43926
43962
|
}
|
|
43927
43963
|
let body = undefined;
|
|
43928
43964
|
if (isGet) {
|
|
@@ -43944,9 +43980,10 @@ var adapter2 = async (opts = {}, overloadOpts) => {
|
|
|
43944
43980
|
headers
|
|
43945
43981
|
}).then(async (response) => {
|
|
43946
43982
|
const contentType = response.headers.get("Content-Type");
|
|
43947
|
-
if (
|
|
43983
|
+
if (responseType === "blob") {
|
|
43948
43984
|
return await response.blob();
|
|
43949
43985
|
}
|
|
43986
|
+
const isText = responseType === "text";
|
|
43950
43987
|
const isJson = contentType && contentType.includes("application/json");
|
|
43951
43988
|
if (isJson && !isText) {
|
|
43952
43989
|
return await response.json();
|
|
@@ -44137,7 +44174,7 @@ class BaseQuery {
|
|
|
44137
44174
|
}
|
|
44138
44175
|
}
|
|
44139
44176
|
|
|
44140
|
-
// node_modules/.pnpm/@kevisual+query-login@0.0.
|
|
44177
|
+
// node_modules/.pnpm/@kevisual+query-login@0.0.7_@kevisual+query@0.0.31/node_modules/@kevisual/query-login/dist/query-login-node.js
|
|
44141
44178
|
import { homedir } from "os";
|
|
44142
44179
|
import { join, dirname } from "path";
|
|
44143
44180
|
import fs3 from "fs";
|
|
@@ -45998,16 +46035,16 @@ import path3 from "path";
|
|
|
45998
46035
|
import fs5 from "fs";
|
|
45999
46036
|
|
|
46000
46037
|
// src/uitls/hash.ts
|
|
46001
|
-
|
|
46038
|
+
import crypto from "node:crypto";
|
|
46002
46039
|
import fs4 from "node:fs";
|
|
46003
46040
|
var getHash = (file) => {
|
|
46004
46041
|
if (!fs4.existsSync(file))
|
|
46005
46042
|
return "";
|
|
46006
|
-
const
|
|
46007
|
-
return
|
|
46043
|
+
const buffer = fs4.readFileSync(file);
|
|
46044
|
+
return crypto.createHash("md5").update(buffer).digest("hex");
|
|
46008
46045
|
};
|
|
46009
46046
|
var getBufferHash = (buffer) => {
|
|
46010
|
-
return
|
|
46047
|
+
return crypto.createHash("md5").update(buffer).digest("hex");
|
|
46011
46048
|
};
|
|
46012
46049
|
|
|
46013
46050
|
// src/module/download/upload.ts
|
|
@@ -46682,10 +46719,12 @@ var upload = (opts) => {
|
|
|
46682
46719
|
value = opts.file;
|
|
46683
46720
|
}
|
|
46684
46721
|
form.append("file", value);
|
|
46722
|
+
const fileSize = Buffer.byteLength(value);
|
|
46685
46723
|
if (opts.needHash) {
|
|
46686
46724
|
hash = opts?.hash || getBufferHash(value);
|
|
46687
46725
|
opts.url = new URL(opts.url.toString());
|
|
46688
46726
|
opts.url.searchParams.append("hash", hash);
|
|
46727
|
+
opts.url.searchParams.append("size", fileSize.toString());
|
|
46689
46728
|
}
|
|
46690
46729
|
}
|
|
46691
46730
|
const headers = form.getHeaders();
|
|
@@ -47233,43 +47272,6 @@ var checkPnpm = () => {
|
|
|
47233
47272
|
return false;
|
|
47234
47273
|
}
|
|
47235
47274
|
};
|
|
47236
|
-
var checkPm2 = () => {
|
|
47237
|
-
try {
|
|
47238
|
-
spawnSync2("pm2", ["--version"]);
|
|
47239
|
-
return true;
|
|
47240
|
-
} catch (e) {
|
|
47241
|
-
return false;
|
|
47242
|
-
}
|
|
47243
|
-
};
|
|
47244
|
-
var installDep = (opts) => {
|
|
47245
|
-
const { appPath, dep } = opts;
|
|
47246
|
-
const params = [];
|
|
47247
|
-
const syncSpawn = opts.sync ? spawnSync2 : spawn2;
|
|
47248
|
-
if (opts.isGlobal) {
|
|
47249
|
-
params.push("-g");
|
|
47250
|
-
}
|
|
47251
|
-
if (checkPnpm()) {
|
|
47252
|
-
params.push("add", dep);
|
|
47253
|
-
syncSpawn("pnpm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
47254
|
-
} else {
|
|
47255
|
-
params.push("install", dep);
|
|
47256
|
-
syncSpawn("npm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
47257
|
-
}
|
|
47258
|
-
};
|
|
47259
|
-
var installDeps = (opts) => {
|
|
47260
|
-
const { appPath } = opts;
|
|
47261
|
-
const isProduction = opts.isProduction ?? true;
|
|
47262
|
-
const params = ["i"];
|
|
47263
|
-
if (isProduction) {
|
|
47264
|
-
params.push("--production");
|
|
47265
|
-
}
|
|
47266
|
-
const syncSpawn = opts.sync ? spawnSync2 : spawn2;
|
|
47267
|
-
if (checkPnpm()) {
|
|
47268
|
-
syncSpawn("pnpm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
47269
|
-
} else {
|
|
47270
|
-
syncSpawn("npm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
47271
|
-
}
|
|
47272
|
-
};
|
|
47273
47275
|
|
|
47274
47276
|
// src/command/npm.ts
|
|
47275
47277
|
var parseIfJson = (str) => {
|
|
@@ -47675,7 +47677,7 @@ var deployLoadFn2 = async (id, fileKey, force = false, install2 = false) => {
|
|
|
47675
47677
|
});
|
|
47676
47678
|
if (res.code === 200) {
|
|
47677
47679
|
console.log("deploy-load success. current version:", res.data?.pkg?.version);
|
|
47678
|
-
console.log("run: ", "envision services -s", res.data?.
|
|
47680
|
+
console.log("run: ", "envision services -s", res.data?.showAppInfo?.key);
|
|
47679
47681
|
} else {
|
|
47680
47682
|
console.error("deploy-load failed", res.message);
|
|
47681
47683
|
}
|
|
@@ -47848,208 +47850,8 @@ var detectCommand = new Command("detect").description("检测服务, 当返回
|
|
|
47848
47850
|
program.addCommand(servicesCommand);
|
|
47849
47851
|
servicesCommand.addCommand(detectCommand);
|
|
47850
47852
|
|
|
47851
|
-
// src/command/init.ts
|
|
47852
|
-
import path7 from "path";
|
|
47853
|
-
import fs10 from "fs";
|
|
47854
|
-
import { spawn as spawn4 } from "child_process";
|
|
47855
|
-
var command6 = new Command("init").description("初始化应用").action((optison) => {
|
|
47856
|
-
console.log("init");
|
|
47857
|
-
});
|
|
47858
|
-
program.addCommand(command6);
|
|
47859
|
-
var setMainAppConfig = async (mainAppPath) => {
|
|
47860
|
-
const config2 = getConfig();
|
|
47861
|
-
config2.mainAppPath = mainAppPath;
|
|
47862
|
-
writeConfig(config2);
|
|
47863
|
-
};
|
|
47864
|
-
var initMain = async () => {
|
|
47865
|
-
const mainAppPath = path7.join(envisionPath, "main-app");
|
|
47866
|
-
const pkgPath = path7.join(mainAppPath, "package.json");
|
|
47867
|
-
if (!checkFileExists(pkgPath)) {
|
|
47868
|
-
fs10.mkdirSync(mainAppPath, { recursive: true });
|
|
47869
|
-
const pkg = {
|
|
47870
|
-
name: "main-app",
|
|
47871
|
-
version: "1.0.0",
|
|
47872
|
-
type: "module",
|
|
47873
|
-
main: "dist/app.mjs",
|
|
47874
|
-
scripts: {
|
|
47875
|
-
start: "node dist/app.mjs",
|
|
47876
|
-
pm2: "pm2 start dist/app.mjs --name main-app"
|
|
47877
|
-
},
|
|
47878
|
-
dependencies: {
|
|
47879
|
-
"@kevisual/router": "latest",
|
|
47880
|
-
"@kevisual/local-app-manager": "latest",
|
|
47881
|
-
"@kevisual/use-config": "latest"
|
|
47882
|
-
}
|
|
47883
|
-
};
|
|
47884
|
-
fs10.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
47885
|
-
console.log(chalk2.green("初始化 main-app 成功"));
|
|
47886
|
-
}
|
|
47887
|
-
installDeps({ appPath: mainAppPath, sync: true });
|
|
47888
|
-
const code = `import { App } from '@kevisual/router';
|
|
47889
|
-
import { app as LocalApp } from '@kevisual/local-app-manager';
|
|
47890
|
-
import { useConfig } from '@kevisual/use-config';
|
|
47891
|
-
const config = useConfig();
|
|
47892
|
-
const host = config.host || '127.0.0.1';
|
|
47893
|
-
LocalApp.listen(config.port, host, () => {
|
|
47894
|
-
console.log(\`LocalApp is running on http://\${host}:\${config.port}\`);
|
|
47895
|
-
});
|
|
47896
|
-
`;
|
|
47897
|
-
const codeDistPath = path7.join(mainAppPath, "dist");
|
|
47898
|
-
if (!checkFileExists(codeDistPath)) {
|
|
47899
|
-
fs10.mkdirSync(codeDistPath, { recursive: true });
|
|
47900
|
-
}
|
|
47901
|
-
fs10.writeFileSync(path7.join(codeDistPath, "app.mjs"), code);
|
|
47902
|
-
console.log(chalk2.green("创建 app.mjs 成功"));
|
|
47903
|
-
const answers = await dist_default12.prompt([
|
|
47904
|
-
{
|
|
47905
|
-
type: "input",
|
|
47906
|
-
name: "port",
|
|
47907
|
-
message: "请输入端口号",
|
|
47908
|
-
default: "11015"
|
|
47909
|
-
},
|
|
47910
|
-
{
|
|
47911
|
-
type: "input",
|
|
47912
|
-
name: "host",
|
|
47913
|
-
message: "请输入host",
|
|
47914
|
-
default: "127.0.0.1"
|
|
47915
|
-
},
|
|
47916
|
-
{
|
|
47917
|
-
type: "input",
|
|
47918
|
-
name: "appsPath",
|
|
47919
|
-
message: "请输入apps路径",
|
|
47920
|
-
default: path7.join(mainAppPath, "apps")
|
|
47921
|
-
}
|
|
47922
|
-
]);
|
|
47923
|
-
const json5 = {
|
|
47924
|
-
port: Number(answers.port),
|
|
47925
|
-
host: answers.host,
|
|
47926
|
-
appsPath: answers.appsPath
|
|
47927
|
-
};
|
|
47928
|
-
fs10.writeFileSync(path7.join(mainAppPath, "app.config.json5"), JSON.stringify(json5, null, 2));
|
|
47929
|
-
console.log(chalk2.green("创建 app.config.json5 成功"));
|
|
47930
|
-
setMainAppConfig(mainAppPath);
|
|
47931
|
-
writeConfig({ ...getConfig(), appsPath: answers.appsPath });
|
|
47932
|
-
};
|
|
47933
|
-
var checkPid = (pid) => {
|
|
47934
|
-
try {
|
|
47935
|
-
process.kill(pid, 0);
|
|
47936
|
-
return true;
|
|
47937
|
-
} catch (err) {
|
|
47938
|
-
if (err.code === "ESRCH") {
|
|
47939
|
-
console.log(`进程 ${pid} 不存在`);
|
|
47940
|
-
return false;
|
|
47941
|
-
} else if (err.code === "EPERM") {
|
|
47942
|
-
console.log(`没有权限检查进程 ${pid}`);
|
|
47943
|
-
return true;
|
|
47944
|
-
} else {
|
|
47945
|
-
console.error(`检查进程 ${pid} 时出错:`, err);
|
|
47946
|
-
return false;
|
|
47947
|
-
}
|
|
47948
|
-
}
|
|
47949
|
-
};
|
|
47950
|
-
var mainApp = new Command("main").description("初始化main的应用").option("-i, --init", "初始化main应用").option("-s, --start", "启动main应用").option("-r, --restart", "重启main应用").option("-e, --exit", "停止main应用").option("-p, --pm2", "使用pm2管理,只作为启动").action(async (options) => {
|
|
47951
|
-
if (options.init) {
|
|
47952
|
-
await initMain();
|
|
47953
|
-
return;
|
|
47954
|
-
} else if (!options.start && !options.restart && !options.exit && !options.pm2) {
|
|
47955
|
-
console.warn(chalk2.yellow("请使用 --init 初始化 main 应用"));
|
|
47956
|
-
}
|
|
47957
|
-
const runChild = () => {
|
|
47958
|
-
const logDir = path7.join(envisionPath, "log");
|
|
47959
|
-
const logFile = path7.join(logDir, "child.log");
|
|
47960
|
-
fs10.mkdirSync(logDir, { recursive: true });
|
|
47961
|
-
if (!checkFileExists(logFile)) {
|
|
47962
|
-
fs10.writeFileSync(logFile, "");
|
|
47963
|
-
}
|
|
47964
|
-
const stats = fs10.statSync(logFile);
|
|
47965
|
-
if (stats.size > 1024 * 1024 * 10) {
|
|
47966
|
-
fs10.renameSync(logFile, path7.join(logDir, `child-${Date.now()}.log`));
|
|
47967
|
-
fs10.writeFileSync(logFile, "");
|
|
47968
|
-
}
|
|
47969
|
-
const logStream = fs10.openSync(logFile, "a");
|
|
47970
|
-
if (options.pm2) {
|
|
47971
|
-
if (!checkPm2()) {
|
|
47972
|
-
console.log("安装pm2");
|
|
47973
|
-
installDep({ isGlobal: true, sync: true, dep: "pm2" });
|
|
47974
|
-
console.log(chalk2.green("安装pm2成功"));
|
|
47975
|
-
}
|
|
47976
|
-
}
|
|
47977
|
-
let comm = options.pm2 ? "pm2" : "node";
|
|
47978
|
-
const args = options.pm2 ? ["start", "dist/app.mjs", "--name", "main-app"] : ["dist/app.mjs"];
|
|
47979
|
-
const childProcess = spawn4(comm, args, {
|
|
47980
|
-
cwd: getConfig().mainAppPath,
|
|
47981
|
-
stdio: ["ignore", logStream, logStream],
|
|
47982
|
-
detached: true
|
|
47983
|
-
});
|
|
47984
|
-
childProcess.unref();
|
|
47985
|
-
if (!options.pm2) {
|
|
47986
|
-
writeConfig({ ...getConfig(), mainAppPid: childProcess.pid });
|
|
47987
|
-
}
|
|
47988
|
-
};
|
|
47989
|
-
const config2 = getConfig();
|
|
47990
|
-
if (!config2.mainAppPath) {
|
|
47991
|
-
console.log("请先初始化 main 应用");
|
|
47992
|
-
return;
|
|
47993
|
-
}
|
|
47994
|
-
if (options.start) {
|
|
47995
|
-
if (config2.mainAppPid) {
|
|
47996
|
-
if (checkPid(config2.mainAppPid)) {
|
|
47997
|
-
console.log("main app 已经启动");
|
|
47998
|
-
return;
|
|
47999
|
-
}
|
|
48000
|
-
}
|
|
48001
|
-
runChild();
|
|
48002
|
-
}
|
|
48003
|
-
if (options.restart) {
|
|
48004
|
-
if (config2.mainAppPid) {
|
|
48005
|
-
if (checkPid(config2.mainAppPid)) {
|
|
48006
|
-
process.kill(config2.mainAppPid);
|
|
48007
|
-
}
|
|
48008
|
-
}
|
|
48009
|
-
runChild();
|
|
48010
|
-
} else if (options.exit) {
|
|
48011
|
-
if (config2.mainAppPid) {
|
|
48012
|
-
if (checkPid(config2.mainAppPid)) {
|
|
48013
|
-
process.kill(config2.mainAppPid);
|
|
48014
|
-
}
|
|
48015
|
-
writeConfig({ ...config2, mainAppPid: null });
|
|
48016
|
-
console.log("main app 已经停止");
|
|
48017
|
-
}
|
|
48018
|
-
}
|
|
48019
|
-
});
|
|
48020
|
-
var mainPathCommand = new Command("path").action(() => {
|
|
48021
|
-
const config2 = getConfig();
|
|
48022
|
-
const appPath = path7.resolve(config2.mainAppPath);
|
|
48023
|
-
console.log(`cd ${appPath}`);
|
|
48024
|
-
});
|
|
48025
|
-
mainApp.addCommand(mainPathCommand);
|
|
48026
|
-
var mainLogCommand = new Command("log").option("-t, --tail", "查看日志").option("-f, --follow", "跟踪日志").description("查看main的日志").action((options) => {
|
|
48027
|
-
const logDir = path7.join(envisionPath, "log");
|
|
48028
|
-
const logFile = path7.join(logDir, "child.log");
|
|
48029
|
-
if (!checkFileExists(logFile)) {
|
|
48030
|
-
console.log("日志文件不存在");
|
|
48031
|
-
return;
|
|
48032
|
-
}
|
|
48033
|
-
if (options.tail) {
|
|
48034
|
-
const childProcess = spawn4("tail", ["-n", "20", "-f", logFile]);
|
|
48035
|
-
childProcess.stdout?.pipe(process.stdout);
|
|
48036
|
-
childProcess.stderr?.pipe(process.stderr);
|
|
48037
|
-
return;
|
|
48038
|
-
}
|
|
48039
|
-
if (options.follow) {
|
|
48040
|
-
const childProcess = spawn4("tail", ["-n", "50", "-f", logFile]);
|
|
48041
|
-
childProcess.stdout?.pipe(process.stdout);
|
|
48042
|
-
childProcess.stderr?.pipe(process.stderr);
|
|
48043
|
-
return;
|
|
48044
|
-
}
|
|
48045
|
-
const log = fs10.readFileSync(logFile, "utf-8");
|
|
48046
|
-
console.log(log);
|
|
48047
|
-
});
|
|
48048
|
-
mainApp.addCommand(mainLogCommand);
|
|
48049
|
-
program.addCommand(mainApp);
|
|
48050
|
-
|
|
48051
47853
|
// src/command/proxy.ts
|
|
48052
|
-
var
|
|
47854
|
+
var command6 = new Command("proxy").description("执行代理相关的命令").option("-s, --start", "启动代理").option("-u, --unset", "关闭代理").action((options) => {
|
|
48053
47855
|
const proxyShell = "export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890";
|
|
48054
47856
|
const unProxyShell = "unset https_proxy http_proxy all_proxy";
|
|
48055
47857
|
if (options.start) {
|
|
@@ -48072,16 +47874,16 @@ var command7 = new Command("proxy").description("执行代理相关的命令").o
|
|
|
48072
47874
|
console.log(chalk2.red("请提供选项 -s 或 -u"));
|
|
48073
47875
|
}
|
|
48074
47876
|
});
|
|
48075
|
-
program.addCommand(
|
|
47877
|
+
program.addCommand(command6);
|
|
48076
47878
|
|
|
48077
47879
|
// src/command/update.ts
|
|
48078
47880
|
import { execSync } from "node:child_process";
|
|
48079
|
-
import
|
|
48080
|
-
import
|
|
47881
|
+
import path8 from "node:path";
|
|
47882
|
+
import fs11 from "node:fs";
|
|
48081
47883
|
|
|
48082
47884
|
// src/module/download/install.ts
|
|
48083
|
-
import
|
|
48084
|
-
import
|
|
47885
|
+
import path7 from "path";
|
|
47886
|
+
import fs10 from "fs";
|
|
48085
47887
|
var import_fast_glob3 = __toESM(require_out4(), 1);
|
|
48086
47888
|
var fetchLink = async (url = "", opts) => {
|
|
48087
47889
|
const token2 = process.env.KEVISUAL_TOKEN || storage.getItem("token");
|
|
@@ -48133,7 +47935,7 @@ var checkDelete = async (opts) => {
|
|
|
48133
47935
|
}
|
|
48134
47936
|
]);
|
|
48135
47937
|
if (answers?.confirm || yes) {
|
|
48136
|
-
|
|
47938
|
+
fs10.rmSync(dir, { recursive: true });
|
|
48137
47939
|
console.log(chalk2.green("删除成功", dir));
|
|
48138
47940
|
} else {
|
|
48139
47941
|
console.log(chalk2.red("取消删除", dir));
|
|
@@ -48142,29 +47944,29 @@ var checkDelete = async (opts) => {
|
|
|
48142
47944
|
} catch (error) {
|
|
48143
47945
|
console.error(error);
|
|
48144
47946
|
} finally {
|
|
48145
|
-
|
|
47947
|
+
fs10.mkdirSync(dir, { recursive: true });
|
|
48146
47948
|
}
|
|
48147
47949
|
}
|
|
48148
47950
|
};
|
|
48149
47951
|
var rewritePkg = (packagePath, pkg) => {
|
|
48150
47952
|
const readJsonFile = (filePath) => {
|
|
48151
47953
|
try {
|
|
48152
|
-
return JSON.parse(
|
|
47954
|
+
return JSON.parse(fs10.readFileSync(filePath, "utf-8"));
|
|
48153
47955
|
} catch (error) {
|
|
48154
47956
|
return {};
|
|
48155
47957
|
}
|
|
48156
47958
|
};
|
|
48157
47959
|
try {
|
|
48158
|
-
const dirname2 =
|
|
48159
|
-
if (!
|
|
48160
|
-
|
|
47960
|
+
const dirname2 = path7.dirname(packagePath);
|
|
47961
|
+
if (!fs10.existsSync(dirname2)) {
|
|
47962
|
+
fs10.mkdirSync(dirname2, { recursive: true });
|
|
48161
47963
|
}
|
|
48162
47964
|
const json = readJsonFile(packagePath);
|
|
48163
47965
|
json.id = pkg?.id;
|
|
48164
47966
|
json.appInfo = pkg;
|
|
48165
|
-
|
|
47967
|
+
fs10.writeFileSync(packagePath, JSON.stringify(json, null, 2));
|
|
48166
47968
|
} catch (error) {
|
|
48167
|
-
|
|
47969
|
+
fs10.writeFileSync(packagePath, JSON.stringify({ appInfo: pkg, id: pkg?.id }, null, 2));
|
|
48168
47970
|
}
|
|
48169
47971
|
return pkg;
|
|
48170
47972
|
};
|
|
@@ -48176,9 +47978,9 @@ var installApp = async (app, opts = {}) => {
|
|
|
48176
47978
|
const version2 = _app.version;
|
|
48177
47979
|
const user = _app.user;
|
|
48178
47980
|
const key = _app.key;
|
|
48179
|
-
const downloadDirPath =
|
|
47981
|
+
const downloadDirPath = path7.join(appDir, user, key);
|
|
48180
47982
|
await checkDelete({ force: opts?.force, yes: opts?.yes, dir: downloadDirPath });
|
|
48181
|
-
const packagePath =
|
|
47983
|
+
const packagePath = path7.join(appDir, `${user}/${key}/package.json`);
|
|
48182
47984
|
const downFiles = files.filter((file) => file?.path).map((file) => {
|
|
48183
47985
|
const name = file?.name || "";
|
|
48184
47986
|
const noVersionPath = file.path.replace(`/${version2}`, "");
|
|
@@ -48191,7 +47993,7 @@ var installApp = async (app, opts = {}) => {
|
|
|
48191
47993
|
}
|
|
48192
47994
|
return {
|
|
48193
47995
|
...file,
|
|
48194
|
-
downloadPath:
|
|
47996
|
+
downloadPath: path7.join(appDir, downloadPath),
|
|
48195
47997
|
downloadUrl
|
|
48196
47998
|
};
|
|
48197
47999
|
});
|
|
@@ -48200,9 +48002,9 @@ var installApp = async (app, opts = {}) => {
|
|
|
48200
48002
|
for (const file of downloadTasks) {
|
|
48201
48003
|
const downloadPath = file.downloadPath;
|
|
48202
48004
|
const downloadUrl = file.downloadUrl;
|
|
48203
|
-
const dir =
|
|
48204
|
-
if (!
|
|
48205
|
-
|
|
48005
|
+
const dir = path7.dirname(downloadPath);
|
|
48006
|
+
if (!fs10.existsSync(dir)) {
|
|
48007
|
+
fs10.mkdirSync(dir, { recursive: true });
|
|
48206
48008
|
}
|
|
48207
48009
|
console.log("downloadUrl", downloadUrl);
|
|
48208
48010
|
const { blob, type } = await fetchLink(downloadUrl);
|
|
@@ -48213,7 +48015,7 @@ var installApp = async (app, opts = {}) => {
|
|
|
48213
48015
|
throw new Error("fetchRes is error");
|
|
48214
48016
|
}
|
|
48215
48017
|
}
|
|
48216
|
-
|
|
48018
|
+
fs10.writeFileSync(downloadPath, Buffer.from(await blob.arrayBuffer()));
|
|
48217
48019
|
}
|
|
48218
48020
|
let indexHtml = files.find((file) => file.name === "index.html");
|
|
48219
48021
|
_app.data.files = files;
|
|
@@ -48233,15 +48035,15 @@ var installApp = async (app, opts = {}) => {
|
|
|
48233
48035
|
};
|
|
48234
48036
|
var checkAppDir = (appDir) => {
|
|
48235
48037
|
try {
|
|
48236
|
-
const files =
|
|
48038
|
+
const files = fs10.readdirSync(appDir);
|
|
48237
48039
|
if (files.length === 0) {
|
|
48238
|
-
|
|
48040
|
+
fs10.rmSync(appDir, { recursive: true });
|
|
48239
48041
|
}
|
|
48240
48042
|
} catch (error) {}
|
|
48241
48043
|
};
|
|
48242
|
-
var checkFileExists2 = (
|
|
48044
|
+
var checkFileExists2 = (path8) => {
|
|
48243
48045
|
try {
|
|
48244
|
-
|
|
48046
|
+
fs10.accessSync(path8);
|
|
48245
48047
|
return true;
|
|
48246
48048
|
} catch (error) {
|
|
48247
48049
|
return false;
|
|
@@ -48251,8 +48053,8 @@ var uninstallApp = async (app, opts = {}) => {
|
|
|
48251
48053
|
const { appDir = "" } = opts;
|
|
48252
48054
|
try {
|
|
48253
48055
|
const { user, key } = app;
|
|
48254
|
-
const keyDir =
|
|
48255
|
-
const parentDir =
|
|
48056
|
+
const keyDir = path7.join(appDir, user, key);
|
|
48057
|
+
const parentDir = path7.join(appDir, user);
|
|
48256
48058
|
if (!checkFileExists2(appDir) || !checkFileExists2(keyDir)) {
|
|
48257
48059
|
return {
|
|
48258
48060
|
code: 200,
|
|
@@ -48260,7 +48062,7 @@ var uninstallApp = async (app, opts = {}) => {
|
|
|
48260
48062
|
};
|
|
48261
48063
|
}
|
|
48262
48064
|
try {
|
|
48263
|
-
|
|
48065
|
+
fs10.rmSync(keyDir, { recursive: true });
|
|
48264
48066
|
} catch (error) {
|
|
48265
48067
|
console.error(error);
|
|
48266
48068
|
}
|
|
@@ -48304,14 +48106,14 @@ var fetchAiList = async (url, opts) => {
|
|
|
48304
48106
|
var import_semver = __toESM(require_semver2(), 1);
|
|
48305
48107
|
var getRunFilePath = () => {
|
|
48306
48108
|
const c = process.argv[1];
|
|
48307
|
-
const runFilePath =
|
|
48109
|
+
const runFilePath = path8.resolve(c);
|
|
48308
48110
|
const isJs = runFilePath.endsWith(".js");
|
|
48309
48111
|
let distDir = "";
|
|
48310
48112
|
if (isJs) {
|
|
48311
|
-
const dir =
|
|
48312
|
-
distDir =
|
|
48113
|
+
const dir = path8.dirname(runFilePath);
|
|
48114
|
+
distDir = path8.relative(dir, "../dist");
|
|
48313
48115
|
} else {
|
|
48314
|
-
distDir =
|
|
48116
|
+
distDir = path8.resolve(process.cwd(), "dist");
|
|
48315
48117
|
}
|
|
48316
48118
|
return distDir;
|
|
48317
48119
|
};
|
|
@@ -48320,7 +48122,7 @@ var downloadNewDistFiles = async (distDir) => {
|
|
|
48320
48122
|
const baseURL3 = getConfig().baseURL || "https://kevisual.cn";
|
|
48321
48123
|
const newData = distFiles.map((file) => {
|
|
48322
48124
|
const url = `${baseURL3}/root/cli/dist/${file}`;
|
|
48323
|
-
const filePath =
|
|
48125
|
+
const filePath = path8.join(distDir, file);
|
|
48324
48126
|
const exist = fileIsExist(filePath);
|
|
48325
48127
|
let hash = "";
|
|
48326
48128
|
hash = getHash(filePath);
|
|
@@ -48341,13 +48143,13 @@ var downloadNewDistFiles = async (distDir) => {
|
|
|
48341
48143
|
console.log("更新文件:", filePath);
|
|
48342
48144
|
isUpdate = true;
|
|
48343
48145
|
if (data.exist) {
|
|
48344
|
-
|
|
48146
|
+
fs11.writeFileSync(filePath, res.content, "utf-8");
|
|
48345
48147
|
} else {
|
|
48346
|
-
const dir =
|
|
48347
|
-
if (!
|
|
48348
|
-
|
|
48148
|
+
const dir = path8.dirname(filePath);
|
|
48149
|
+
if (!fs11.existsSync(dir)) {
|
|
48150
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
48349
48151
|
}
|
|
48350
|
-
|
|
48152
|
+
fs11.writeFileSync(filePath, res.content, "utf-8");
|
|
48351
48153
|
}
|
|
48352
48154
|
});
|
|
48353
48155
|
if (isUpdate) {
|
|
@@ -48396,8 +48198,8 @@ var update = new Command("update").option("-g --global", "update global").option
|
|
|
48396
48198
|
program.addCommand(update);
|
|
48397
48199
|
|
|
48398
48200
|
// src/command/sync/modules/base.ts
|
|
48399
|
-
import
|
|
48400
|
-
import
|
|
48201
|
+
import path9 from "node:path";
|
|
48202
|
+
import fs12 from "node:fs";
|
|
48401
48203
|
var import_fast_glob4 = __toESM(require_out4(), 1);
|
|
48402
48204
|
var import_micromatch = __toESM(require_micromatch(), 1);
|
|
48403
48205
|
var checkAuth = (value = "", baseURL3 = "") => {
|
|
@@ -48417,7 +48219,7 @@ class SyncBase {
|
|
|
48417
48219
|
const filename = opts?.configFilename || "kevisual.json";
|
|
48418
48220
|
const dir = opts?.dir || process.cwd();
|
|
48419
48221
|
this.#filename = filename;
|
|
48420
|
-
this.#dir =
|
|
48222
|
+
this.#dir = path9.resolve(dir);
|
|
48421
48223
|
this.baseURL = opts?.baseURL ?? "";
|
|
48422
48224
|
this.init();
|
|
48423
48225
|
}
|
|
@@ -48425,16 +48227,16 @@ class SyncBase {
|
|
|
48425
48227
|
try {
|
|
48426
48228
|
const dir = this.#dir;
|
|
48427
48229
|
const filename = this.#filename;
|
|
48428
|
-
const filepath =
|
|
48230
|
+
const filepath = path9.join(dir, filename);
|
|
48429
48231
|
if (!fileIsExist(filepath))
|
|
48430
48232
|
throw new Error("config file not found");
|
|
48431
|
-
const config2 = JSON.parse(
|
|
48233
|
+
const config2 = JSON.parse(fs12.readFileSync(filepath, "utf-8"));
|
|
48432
48234
|
const sync = config2.sync || {};
|
|
48433
48235
|
const keys = Object.keys(sync);
|
|
48434
48236
|
const newConfigSync = {};
|
|
48435
48237
|
for (let key of keys) {
|
|
48436
|
-
const keyPath =
|
|
48437
|
-
const newKey =
|
|
48238
|
+
const keyPath = path9.join(dir, key);
|
|
48239
|
+
const newKey = path9.relative(dir, keyPath);
|
|
48438
48240
|
newConfigSync[newKey] = sync[key];
|
|
48439
48241
|
}
|
|
48440
48242
|
config2.sync = newConfigSync;
|
|
@@ -48449,8 +48251,8 @@ class SyncBase {
|
|
|
48449
48251
|
if (!filename)
|
|
48450
48252
|
return false;
|
|
48451
48253
|
const dir = this.#dir;
|
|
48452
|
-
const file =
|
|
48453
|
-
return { relative:
|
|
48254
|
+
const file = path9.join(dir, filename);
|
|
48255
|
+
return { relative: path9.relative(dir, file), absolute: file };
|
|
48454
48256
|
}
|
|
48455
48257
|
async canDone(syncType, type) {
|
|
48456
48258
|
if (syncType === "sync")
|
|
@@ -48478,7 +48280,7 @@ class SyncBase {
|
|
|
48478
48280
|
const baseURL3 = this.baseURL;
|
|
48479
48281
|
const syncList = syncKeys.map((key) => {
|
|
48480
48282
|
const value = sync[key];
|
|
48481
|
-
const filepath =
|
|
48283
|
+
const filepath = path9.join(this.#dir, key);
|
|
48482
48284
|
if (typeof value === "string") {
|
|
48483
48285
|
const auth2 = checkAuth(value, baseURL3);
|
|
48484
48286
|
const type2 = auth2 ? "sync" : "none";
|
|
@@ -48555,7 +48357,7 @@ class SyncBase {
|
|
|
48555
48357
|
continue;
|
|
48556
48358
|
}
|
|
48557
48359
|
for (let file of glob_files) {
|
|
48558
|
-
const key =
|
|
48360
|
+
const key = path9.relative(cwd, file);
|
|
48559
48361
|
const _registryURL = new URL(registyURL);
|
|
48560
48362
|
const replaceKeys = Object.keys(replace);
|
|
48561
48363
|
let newKey = key;
|
|
@@ -48565,7 +48367,7 @@ class SyncBase {
|
|
|
48565
48367
|
newKey = key.replace(_replaceKey, replace[replaceKey]);
|
|
48566
48368
|
}
|
|
48567
48369
|
}
|
|
48568
|
-
const pathname =
|
|
48370
|
+
const pathname = path9.join(_registryURL.pathname, newKey);
|
|
48569
48371
|
_registryURL.pathname = pathname;
|
|
48570
48372
|
keys.push(key);
|
|
48571
48373
|
obj[key] = { url: _registryURL.toString() };
|
|
@@ -48594,10 +48396,10 @@ class SyncBase {
|
|
|
48594
48396
|
}
|
|
48595
48397
|
getHash = getHash;
|
|
48596
48398
|
async getDir(filepath, check2 = false) {
|
|
48597
|
-
const dir =
|
|
48399
|
+
const dir = path9.dirname(filepath);
|
|
48598
48400
|
if (check2) {
|
|
48599
48401
|
if (!fileIsExist(dir)) {
|
|
48600
|
-
|
|
48402
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
48601
48403
|
}
|
|
48602
48404
|
}
|
|
48603
48405
|
return dir;
|
|
@@ -48607,9 +48409,9 @@ class SyncBase {
|
|
|
48607
48409
|
}
|
|
48608
48410
|
|
|
48609
48411
|
// src/command/sync/sync.ts
|
|
48610
|
-
import
|
|
48611
|
-
import
|
|
48612
|
-
var
|
|
48412
|
+
import fs13 from "node:fs";
|
|
48413
|
+
import path10 from "node:path";
|
|
48414
|
+
var command7 = new Command("sync").option("-d --dir <dir>").description("同步项目").action(() => {
|
|
48613
48415
|
console.log("同步项目");
|
|
48614
48416
|
});
|
|
48615
48417
|
var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-f --file <file>", "操作的对应的文件名").description("上传项目, 上传需要和registry的地址同步。").action(async (opts) => {
|
|
@@ -48638,7 +48440,7 @@ var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").
|
|
|
48638
48440
|
}
|
|
48639
48441
|
const res = await upload({
|
|
48640
48442
|
token: token2,
|
|
48641
|
-
file:
|
|
48443
|
+
file: fs13.readFileSync(item.filepath),
|
|
48642
48444
|
url: item.url,
|
|
48643
48445
|
needHash: true,
|
|
48644
48446
|
hash: item.hash,
|
|
@@ -48650,7 +48452,7 @@ var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").
|
|
|
48650
48452
|
} else if (res.data?.isNewMeta) {
|
|
48651
48453
|
newInfos.push(["上传成功", item.key, chalk2.green(item.url), chalk2.green("元数据更新")]);
|
|
48652
48454
|
} else {
|
|
48653
|
-
logger.
|
|
48455
|
+
logger.debug("上传成功", item.key, chalk2.green(item.url), chalk2.blue("文件未更新"));
|
|
48654
48456
|
}
|
|
48655
48457
|
}
|
|
48656
48458
|
logger.debug(res);
|
|
@@ -48685,7 +48487,7 @@ var syncDownload = new Command("download").option("-d --dir <dir>", "配置目
|
|
|
48685
48487
|
const { content, status } = await fetchLink(item.url, { setToken: item.auth, returnContent: true, hash });
|
|
48686
48488
|
if (status === 200) {
|
|
48687
48489
|
await sync.getDir(item.filepath, true);
|
|
48688
|
-
|
|
48490
|
+
fs13.writeFileSync(item.filepath, content);
|
|
48689
48491
|
logger.info("下载成功", item.key, chalk2.green(item.url));
|
|
48690
48492
|
} else if (status === 304) {
|
|
48691
48493
|
logger.info("文件未修改", item.key, chalk2.green(item.url));
|
|
@@ -48726,7 +48528,7 @@ var syncCreateList = new Command("create").option("-d --dir <dir>", "配置目
|
|
|
48726
48528
|
const filepath = sync.getRelativePath(opts.output);
|
|
48727
48529
|
if (filepath) {
|
|
48728
48530
|
logger.debug("输出文件", filepath);
|
|
48729
|
-
|
|
48531
|
+
fs13.writeFileSync(filepath.absolute, JSON.stringify(newJson, null, 2));
|
|
48730
48532
|
} else {
|
|
48731
48533
|
logger.info(`输出内容
|
|
48732
48534
|
`);
|
|
@@ -48752,7 +48554,7 @@ var checkDir = new Command("check").option("-d --dir <dir>", "配置目录").opt
|
|
|
48752
48554
|
if (res.code === 200) {
|
|
48753
48555
|
const data = res?.data || [];
|
|
48754
48556
|
let matchObjectList = data.filter((dataItem) => {
|
|
48755
|
-
dataItem.pathname =
|
|
48557
|
+
dataItem.pathname = path10.join(item.key || "", dataItem.path);
|
|
48756
48558
|
return dataItem;
|
|
48757
48559
|
});
|
|
48758
48560
|
matchObjectList = sync.getMatchList({ ignore: item.ignore, matchObjectList }).matchObjectList;
|
|
@@ -48781,7 +48583,7 @@ var checkDir = new Command("check").option("-d --dir <dir>", "配置目录").opt
|
|
|
48781
48583
|
if (needDownload) {
|
|
48782
48584
|
const { content, status } = await fetchLink(matchItem.url, { setToken: item.auth, returnContent: true, hash });
|
|
48783
48585
|
if (status === 200) {
|
|
48784
|
-
|
|
48586
|
+
fs13.writeFileSync(matchItem.absolute, content);
|
|
48785
48587
|
logger.info("下载成功", matchItem.pathname, chalk2.green(matchItem.url));
|
|
48786
48588
|
} else if (status === 304) {
|
|
48787
48589
|
logger.info("文件未修改", matchItem.pathname, chalk2.green(matchItem.url));
|
|
@@ -48796,16 +48598,16 @@ var checkDir = new Command("check").option("-d --dir <dir>", "配置目录").opt
|
|
|
48796
48598
|
}
|
|
48797
48599
|
}
|
|
48798
48600
|
});
|
|
48799
|
-
|
|
48800
|
-
|
|
48801
|
-
|
|
48802
|
-
|
|
48803
|
-
|
|
48804
|
-
program.addCommand(
|
|
48601
|
+
command7.addCommand(syncUpload);
|
|
48602
|
+
command7.addCommand(syncDownload);
|
|
48603
|
+
command7.addCommand(syncList);
|
|
48604
|
+
command7.addCommand(syncCreateList);
|
|
48605
|
+
command7.addCommand(checkDir);
|
|
48606
|
+
program.addCommand(command7);
|
|
48805
48607
|
|
|
48806
48608
|
// src/command/app/front-app/index.ts
|
|
48807
|
-
import
|
|
48808
|
-
import
|
|
48609
|
+
import fs14 from "fs";
|
|
48610
|
+
import path11 from "path";
|
|
48809
48611
|
var appCommand = new Command("app").description("app 命令").action(() => {
|
|
48810
48612
|
console.log("app");
|
|
48811
48613
|
});
|
|
@@ -48821,7 +48623,7 @@ app download -i root/code-center`).option("-i, --id <id>", "下载 app serve cli
|
|
|
48821
48623
|
if (output) {
|
|
48822
48624
|
const checkOutput = fileIsExist(output);
|
|
48823
48625
|
if (!checkOutput) {
|
|
48824
|
-
|
|
48626
|
+
fs14.mkdirSync(output, { recursive: true });
|
|
48825
48627
|
}
|
|
48826
48628
|
}
|
|
48827
48629
|
const [user, key] = id.split("/");
|
|
@@ -48860,7 +48662,7 @@ app download -i root/code-center`).option("-i, --id <id>", "下载 app serve cli
|
|
|
48860
48662
|
});
|
|
48861
48663
|
var uninstallAppCommand = new Command("uninstall").alias("remove").description("卸载 app serve client的包。 手动删除更简单。").option("-i, --id <id>", "user/key").option("-p, --path <path>", "删除的路径, 如果存在,则优先执行,不会去判断 id 和 type 。").action(async (options) => {
|
|
48862
48664
|
if (options.path) {
|
|
48863
|
-
const _path =
|
|
48665
|
+
const _path = path11.resolve(options.path);
|
|
48864
48666
|
try {
|
|
48865
48667
|
const checkPath = fileIsExist(_path);
|
|
48866
48668
|
if (!checkPath) {
|
|
@@ -48875,7 +48677,7 @@ var uninstallAppCommand = new Command("uninstall").alias("remove").description("
|
|
|
48875
48677
|
}
|
|
48876
48678
|
]);
|
|
48877
48679
|
if (answer.confirm) {
|
|
48878
|
-
|
|
48680
|
+
fs14.rmSync(_path, { recursive: true });
|
|
48879
48681
|
console.log(chalk2.green("删除成功", _path));
|
|
48880
48682
|
}
|
|
48881
48683
|
}
|
|
@@ -48919,29 +48721,29 @@ var link = new Command("link").argument("url").option("-o --output <output>", "
|
|
|
48919
48721
|
if (output) {
|
|
48920
48722
|
const checkOutput = fileIsExist(output);
|
|
48921
48723
|
if (!checkOutput) {
|
|
48922
|
-
|
|
48724
|
+
fs14.mkdirSync(output, { recursive: true });
|
|
48923
48725
|
}
|
|
48924
48726
|
}
|
|
48925
|
-
|
|
48727
|
+
fs14.writeFileSync(path11.join(output, filename), content);
|
|
48926
48728
|
});
|
|
48927
48729
|
appCommand.addCommand(link);
|
|
48928
48730
|
|
|
48929
48731
|
// src/command/gist/index.ts
|
|
48930
|
-
import
|
|
48931
|
-
import
|
|
48932
|
-
import { spawn as
|
|
48933
|
-
var
|
|
48732
|
+
import path12 from "node:path";
|
|
48733
|
+
import fs15 from "node:fs";
|
|
48734
|
+
import { spawn as spawn4 } from "child_process";
|
|
48735
|
+
var command8 = new Command("gist").description("同步片段代码").option("-d, --dir <dir>", "配置目录").arguments("<link>").action((link2, opts) => {
|
|
48934
48736
|
if (!link2) {
|
|
48935
48737
|
console.log(chalk2.red("请提供链接"));
|
|
48936
48738
|
return;
|
|
48937
48739
|
}
|
|
48938
|
-
const dir =
|
|
48939
|
-
if (!
|
|
48940
|
-
|
|
48740
|
+
const dir = path12.resolve(opts.dir || process.cwd());
|
|
48741
|
+
if (!fs15.existsSync(dir)) {
|
|
48742
|
+
fs15.mkdirSync(dir, { recursive: true });
|
|
48941
48743
|
}
|
|
48942
48744
|
const cmd = `ev gist download -l ${link2} -s `;
|
|
48943
48745
|
console.log(chalk2.green("开始执行"), cmd);
|
|
48944
|
-
|
|
48746
|
+
spawn4(cmd, {
|
|
48945
48747
|
shell: true,
|
|
48946
48748
|
stdio: "inherit",
|
|
48947
48749
|
cwd: dir
|
|
@@ -48949,10 +48751,10 @@ var command9 = new Command("gist").description("同步片段代码").option("-d,
|
|
|
48949
48751
|
});
|
|
48950
48752
|
var download = new Command("download").option("-d --dir <dir>", "配置目录").option("-c --config <config>", "配置文件的名字", "kevisual.json").option("-s --sync", "下载配置成功后,是否需要同步文件").option("-l --link <link>", "下载配置链接").description("克隆代码片段").action(async (opts) => {
|
|
48951
48753
|
console.log("克隆代码片段", opts);
|
|
48952
|
-
const dir =
|
|
48754
|
+
const dir = path12.resolve(opts.dir || process.cwd());
|
|
48953
48755
|
const link2 = opts.link || "";
|
|
48954
48756
|
const configFilename = opts.config || "kevisual.json";
|
|
48955
|
-
const configPath2 =
|
|
48757
|
+
const configPath2 = path12.join(dir, configFilename);
|
|
48956
48758
|
if (!link2) {
|
|
48957
48759
|
console.log(chalk2.red("请提供链接"));
|
|
48958
48760
|
return;
|
|
@@ -48965,20 +48767,170 @@ var download = new Command("download").option("-d --dir <dir>", "配置目录").
|
|
|
48965
48767
|
console.log(chalk2.red("配置文件下载失败"));
|
|
48966
48768
|
throw "配置文件下载失败";
|
|
48967
48769
|
});
|
|
48968
|
-
|
|
48969
|
-
|
|
48770
|
+
fs15.mkdirSync(dir, { recursive: true });
|
|
48771
|
+
fs15.writeFileSync(configPath2, JSON.stringify(res, null, 2));
|
|
48970
48772
|
console.log(chalk2.green("配置文件下载成功: " + configPath2));
|
|
48971
48773
|
if (opts.sync) {
|
|
48972
48774
|
const cmd = `ev sync download --config "${configFilename}"`;
|
|
48973
48775
|
console.log(chalk2.green("开始同步文件"), cmd);
|
|
48974
|
-
|
|
48776
|
+
spawn4(cmd, {
|
|
48975
48777
|
cwd: dir,
|
|
48976
48778
|
shell: true,
|
|
48977
48779
|
stdio: "inherit"
|
|
48978
48780
|
});
|
|
48979
48781
|
}
|
|
48980
48782
|
});
|
|
48981
|
-
|
|
48783
|
+
command8.addCommand(download);
|
|
48784
|
+
program.addCommand(command8);
|
|
48785
|
+
|
|
48786
|
+
// src/query/query-config/query-config.ts
|
|
48787
|
+
class QueryConfig {
|
|
48788
|
+
query;
|
|
48789
|
+
constructor(opts) {
|
|
48790
|
+
this.query = opts?.query || new Query2;
|
|
48791
|
+
}
|
|
48792
|
+
async post(data) {
|
|
48793
|
+
return this.query.post({ path: "config", ...data });
|
|
48794
|
+
}
|
|
48795
|
+
async getConfig({ id, key }, opts) {
|
|
48796
|
+
return this.post({
|
|
48797
|
+
key: "get",
|
|
48798
|
+
data: {
|
|
48799
|
+
id,
|
|
48800
|
+
key
|
|
48801
|
+
},
|
|
48802
|
+
...opts
|
|
48803
|
+
});
|
|
48804
|
+
}
|
|
48805
|
+
async updateConfig(data, opts) {
|
|
48806
|
+
return this.post({
|
|
48807
|
+
key: "update",
|
|
48808
|
+
data,
|
|
48809
|
+
...opts
|
|
48810
|
+
});
|
|
48811
|
+
}
|
|
48812
|
+
async deleteConfig(data, opts) {
|
|
48813
|
+
console.log("Delete Config Params:", data);
|
|
48814
|
+
return this.post({
|
|
48815
|
+
key: "delete",
|
|
48816
|
+
data
|
|
48817
|
+
});
|
|
48818
|
+
}
|
|
48819
|
+
async listConfig(opts) {
|
|
48820
|
+
return this.post({
|
|
48821
|
+
key: "list",
|
|
48822
|
+
...opts
|
|
48823
|
+
});
|
|
48824
|
+
}
|
|
48825
|
+
async getUploadConfig(opts) {
|
|
48826
|
+
return this.post({
|
|
48827
|
+
key: "getUploadConfig",
|
|
48828
|
+
...opts
|
|
48829
|
+
});
|
|
48830
|
+
}
|
|
48831
|
+
async updateUploadConfig(data, opts) {
|
|
48832
|
+
return this.post({
|
|
48833
|
+
key: "updateUploadConfig",
|
|
48834
|
+
data,
|
|
48835
|
+
...opts
|
|
48836
|
+
});
|
|
48837
|
+
}
|
|
48838
|
+
async detectConfig(opts) {
|
|
48839
|
+
return this.post({
|
|
48840
|
+
key: "detect",
|
|
48841
|
+
...opts
|
|
48842
|
+
});
|
|
48843
|
+
}
|
|
48844
|
+
async getConfigByKey(key, opts) {
|
|
48845
|
+
return this.post({
|
|
48846
|
+
key: "defaultConfig",
|
|
48847
|
+
configKey: key,
|
|
48848
|
+
...opts
|
|
48849
|
+
});
|
|
48850
|
+
}
|
|
48851
|
+
async getByKey(key, opts) {
|
|
48852
|
+
return this.post({
|
|
48853
|
+
key: "get",
|
|
48854
|
+
...opts,
|
|
48855
|
+
data: { key }
|
|
48856
|
+
});
|
|
48857
|
+
}
|
|
48858
|
+
}
|
|
48859
|
+
|
|
48860
|
+
// src/uitls/show-more.ts
|
|
48861
|
+
import util4 from "node:util";
|
|
48862
|
+
var showMore = (obj, depth = 5) => {
|
|
48863
|
+
return util4.inspect(obj, { showHidden: false, depth, colors: true });
|
|
48864
|
+
};
|
|
48865
|
+
|
|
48866
|
+
// src/command/config-remote.ts
|
|
48867
|
+
import fs16 from "node:fs";
|
|
48868
|
+
import path13 from "node:path";
|
|
48869
|
+
var queryConfig = new QueryConfig({ query });
|
|
48870
|
+
var command9 = new Command("remote-config").alias("rc").description("获取或设置远程配置");
|
|
48871
|
+
var getCommand2 = new Command("get").option("-k, --key <key>", "配置键名").action(async (options) => {
|
|
48872
|
+
const { key } = options || {};
|
|
48873
|
+
if (!key) {
|
|
48874
|
+
console.log("Please provide a key using -k or --key option.");
|
|
48875
|
+
return;
|
|
48876
|
+
}
|
|
48877
|
+
const res = await queryConfig.getConfigByKey(key);
|
|
48878
|
+
console.log("res Config Result:", showMore(res.data));
|
|
48879
|
+
});
|
|
48880
|
+
var listCommand = new Command("list").description("列出所有配置").action(async () => {
|
|
48881
|
+
const res = await queryConfig.listConfig();
|
|
48882
|
+
console.log("Remote Configs:", res);
|
|
48883
|
+
if (res.code === 200) {
|
|
48884
|
+
const list2 = res.data?.list || [];
|
|
48885
|
+
list2.forEach((item) => {
|
|
48886
|
+
console.log(item.id, item.key, item.data);
|
|
48887
|
+
});
|
|
48888
|
+
}
|
|
48889
|
+
});
|
|
48890
|
+
var updateCommand = new Command("update").description("更新远程配置").option("-k, --key <key>", "配置键名").option("-v, --value <value>", "配置值").option("-f, --file <file>", "从文件读取配置值").action(async (options) => {
|
|
48891
|
+
const { key, value, file } = options || {};
|
|
48892
|
+
if (!key) {
|
|
48893
|
+
console.log("请提供配置键名,使用 -k 或 --key 选项。", options);
|
|
48894
|
+
return;
|
|
48895
|
+
}
|
|
48896
|
+
try {
|
|
48897
|
+
let data = {};
|
|
48898
|
+
const filePath = path13.resolve(process.cwd(), file);
|
|
48899
|
+
const hasFile = fs16.existsSync(filePath);
|
|
48900
|
+
if (value) {
|
|
48901
|
+
data = JSON.parse(value);
|
|
48902
|
+
} else if (file || hasFile) {
|
|
48903
|
+
if (!hasFile) {
|
|
48904
|
+
console.log("指定的文件不存在:", filePath);
|
|
48905
|
+
return;
|
|
48906
|
+
}
|
|
48907
|
+
data = JSON.parse(fs16.readFileSync(filePath, "utf-8"));
|
|
48908
|
+
} else {
|
|
48909
|
+
console.log("请提供配置值,使用 -v 或 --value 选项,或使用 -f 或 --file 从文件读取。");
|
|
48910
|
+
return;
|
|
48911
|
+
}
|
|
48912
|
+
const res = await queryConfig.updateConfig({
|
|
48913
|
+
key,
|
|
48914
|
+
data
|
|
48915
|
+
});
|
|
48916
|
+
console.log("Update Config Result:", showMore(res.data));
|
|
48917
|
+
} catch (error) {
|
|
48918
|
+
console.log("Error parsing JSON:");
|
|
48919
|
+
}
|
|
48920
|
+
});
|
|
48921
|
+
var deleteCommand = new Command("delete").description("删除远程配置").option("-i, --id <id>", "配置ID").option("-k, --key <key>", "配置键名").action(async (options) => {
|
|
48922
|
+
const { key, id } = options || {};
|
|
48923
|
+
if (!key && !id) {
|
|
48924
|
+
console.log("请提供配置键名或配置ID,使用 -k 或 --key 选项,或 -i 或 --id 选项。");
|
|
48925
|
+
return;
|
|
48926
|
+
}
|
|
48927
|
+
const res = await queryConfig.deleteConfig({ key, id });
|
|
48928
|
+
console.log("Delete Config Result:", showMore(res));
|
|
48929
|
+
});
|
|
48930
|
+
command9.addCommand(listCommand);
|
|
48931
|
+
command9.addCommand(getCommand2);
|
|
48932
|
+
command9.addCommand(updateCommand);
|
|
48933
|
+
command9.addCommand(deleteCommand);
|
|
48982
48934
|
program.addCommand(command9);
|
|
48983
48935
|
|
|
48984
48936
|
// src/index.ts
|