@kevisual/cli 0.0.68 → 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/bin/assistant-server.js +3 -3
- package/bin/assistant.js +3 -3
- package/bin/envision.js +3 -3
- package/bun.config.mjs +19 -19
- package/dist/assistant-server.js +56993 -11609
- package/dist/assistant.js +2459 -631
- package/dist/envision.js +400 -441
- package/package.json +78 -77
- package/readme.md +8 -8
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.7_@kevisual+query@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();
|
|
@@ -47213,6 +47252,12 @@ var fileIsExist = (filePath) => {
|
|
|
47213
47252
|
return false;
|
|
47214
47253
|
}
|
|
47215
47254
|
};
|
|
47255
|
+
var normalizeScriptPath = (scriptPath) => {
|
|
47256
|
+
if (process.platform === "win32") {
|
|
47257
|
+
return scriptPath.replace(/\\/g, "/");
|
|
47258
|
+
}
|
|
47259
|
+
return scriptPath;
|
|
47260
|
+
};
|
|
47216
47261
|
|
|
47217
47262
|
// src/command/npm.ts
|
|
47218
47263
|
import fs8 from "fs";
|
|
@@ -47227,43 +47272,6 @@ var checkPnpm = () => {
|
|
|
47227
47272
|
return false;
|
|
47228
47273
|
}
|
|
47229
47274
|
};
|
|
47230
|
-
var checkPm2 = () => {
|
|
47231
|
-
try {
|
|
47232
|
-
spawnSync2("pm2", ["--version"]);
|
|
47233
|
-
return true;
|
|
47234
|
-
} catch (e) {
|
|
47235
|
-
return false;
|
|
47236
|
-
}
|
|
47237
|
-
};
|
|
47238
|
-
var installDep = (opts) => {
|
|
47239
|
-
const { appPath, dep } = opts;
|
|
47240
|
-
const params = [];
|
|
47241
|
-
const syncSpawn = opts.sync ? spawnSync2 : spawn2;
|
|
47242
|
-
if (opts.isGlobal) {
|
|
47243
|
-
params.push("-g");
|
|
47244
|
-
}
|
|
47245
|
-
if (checkPnpm()) {
|
|
47246
|
-
params.push("add", dep);
|
|
47247
|
-
syncSpawn("pnpm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
47248
|
-
} else {
|
|
47249
|
-
params.push("install", dep);
|
|
47250
|
-
syncSpawn("npm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
47251
|
-
}
|
|
47252
|
-
};
|
|
47253
|
-
var installDeps = (opts) => {
|
|
47254
|
-
const { appPath } = opts;
|
|
47255
|
-
const isProduction = opts.isProduction ?? true;
|
|
47256
|
-
const params = ["i"];
|
|
47257
|
-
if (isProduction) {
|
|
47258
|
-
params.push("--production");
|
|
47259
|
-
}
|
|
47260
|
-
const syncSpawn = opts.sync ? spawnSync2 : spawn2;
|
|
47261
|
-
if (checkPnpm()) {
|
|
47262
|
-
syncSpawn("pnpm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
47263
|
-
} else {
|
|
47264
|
-
syncSpawn("npm", params, { cwd: appPath, stdio: "inherit", env: process.env });
|
|
47265
|
-
}
|
|
47266
|
-
};
|
|
47267
47275
|
|
|
47268
47276
|
// src/command/npm.ts
|
|
47269
47277
|
var parseIfJson = (str) => {
|
|
@@ -47669,7 +47677,7 @@ var deployLoadFn2 = async (id, fileKey, force = false, install2 = false) => {
|
|
|
47669
47677
|
});
|
|
47670
47678
|
if (res.code === 200) {
|
|
47671
47679
|
console.log("deploy-load success. current version:", res.data?.pkg?.version);
|
|
47672
|
-
console.log("run: ", "envision services -s", res.data?.
|
|
47680
|
+
console.log("run: ", "envision services -s", res.data?.showAppInfo?.key);
|
|
47673
47681
|
} else {
|
|
47674
47682
|
console.error("deploy-load failed", res.message);
|
|
47675
47683
|
}
|
|
@@ -47842,208 +47850,8 @@ var detectCommand = new Command("detect").description("检测服务, 当返回
|
|
|
47842
47850
|
program.addCommand(servicesCommand);
|
|
47843
47851
|
servicesCommand.addCommand(detectCommand);
|
|
47844
47852
|
|
|
47845
|
-
// src/command/init.ts
|
|
47846
|
-
import path7 from "path";
|
|
47847
|
-
import fs10 from "fs";
|
|
47848
|
-
import { spawn as spawn4 } from "child_process";
|
|
47849
|
-
var command6 = new Command("init").description("初始化应用").action((optison) => {
|
|
47850
|
-
console.log("init");
|
|
47851
|
-
});
|
|
47852
|
-
program.addCommand(command6);
|
|
47853
|
-
var setMainAppConfig = async (mainAppPath) => {
|
|
47854
|
-
const config2 = getConfig();
|
|
47855
|
-
config2.mainAppPath = mainAppPath;
|
|
47856
|
-
writeConfig(config2);
|
|
47857
|
-
};
|
|
47858
|
-
var initMain = async () => {
|
|
47859
|
-
const mainAppPath = path7.join(envisionPath, "main-app");
|
|
47860
|
-
const pkgPath = path7.join(mainAppPath, "package.json");
|
|
47861
|
-
if (!checkFileExists(pkgPath)) {
|
|
47862
|
-
fs10.mkdirSync(mainAppPath, { recursive: true });
|
|
47863
|
-
const pkg = {
|
|
47864
|
-
name: "main-app",
|
|
47865
|
-
version: "1.0.0",
|
|
47866
|
-
type: "module",
|
|
47867
|
-
main: "dist/app.mjs",
|
|
47868
|
-
scripts: {
|
|
47869
|
-
start: "node dist/app.mjs",
|
|
47870
|
-
pm2: "pm2 start dist/app.mjs --name main-app"
|
|
47871
|
-
},
|
|
47872
|
-
dependencies: {
|
|
47873
|
-
"@kevisual/router": "latest",
|
|
47874
|
-
"@kevisual/local-app-manager": "latest",
|
|
47875
|
-
"@kevisual/use-config": "latest"
|
|
47876
|
-
}
|
|
47877
|
-
};
|
|
47878
|
-
fs10.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
|
|
47879
|
-
console.log(chalk2.green("初始化 main-app 成功"));
|
|
47880
|
-
}
|
|
47881
|
-
installDeps({ appPath: mainAppPath, sync: true });
|
|
47882
|
-
const code = `import { App } from '@kevisual/router';
|
|
47883
|
-
import { app as LocalApp } from '@kevisual/local-app-manager';
|
|
47884
|
-
import { useConfig } from '@kevisual/use-config';
|
|
47885
|
-
const config = useConfig();
|
|
47886
|
-
const host = config.host || '127.0.0.1';
|
|
47887
|
-
LocalApp.listen(config.port, host, () => {
|
|
47888
|
-
console.log(\`LocalApp is running on http://\${host}:\${config.port}\`);
|
|
47889
|
-
});
|
|
47890
|
-
`;
|
|
47891
|
-
const codeDistPath = path7.join(mainAppPath, "dist");
|
|
47892
|
-
if (!checkFileExists(codeDistPath)) {
|
|
47893
|
-
fs10.mkdirSync(codeDistPath, { recursive: true });
|
|
47894
|
-
}
|
|
47895
|
-
fs10.writeFileSync(path7.join(codeDistPath, "app.mjs"), code);
|
|
47896
|
-
console.log(chalk2.green("创建 app.mjs 成功"));
|
|
47897
|
-
const answers = await dist_default12.prompt([
|
|
47898
|
-
{
|
|
47899
|
-
type: "input",
|
|
47900
|
-
name: "port",
|
|
47901
|
-
message: "请输入端口号",
|
|
47902
|
-
default: "11015"
|
|
47903
|
-
},
|
|
47904
|
-
{
|
|
47905
|
-
type: "input",
|
|
47906
|
-
name: "host",
|
|
47907
|
-
message: "请输入host",
|
|
47908
|
-
default: "127.0.0.1"
|
|
47909
|
-
},
|
|
47910
|
-
{
|
|
47911
|
-
type: "input",
|
|
47912
|
-
name: "appsPath",
|
|
47913
|
-
message: "请输入apps路径",
|
|
47914
|
-
default: path7.join(mainAppPath, "apps")
|
|
47915
|
-
}
|
|
47916
|
-
]);
|
|
47917
|
-
const json5 = {
|
|
47918
|
-
port: Number(answers.port),
|
|
47919
|
-
host: answers.host,
|
|
47920
|
-
appsPath: answers.appsPath
|
|
47921
|
-
};
|
|
47922
|
-
fs10.writeFileSync(path7.join(mainAppPath, "app.config.json5"), JSON.stringify(json5, null, 2));
|
|
47923
|
-
console.log(chalk2.green("创建 app.config.json5 成功"));
|
|
47924
|
-
setMainAppConfig(mainAppPath);
|
|
47925
|
-
writeConfig({ ...getConfig(), appsPath: answers.appsPath });
|
|
47926
|
-
};
|
|
47927
|
-
var checkPid = (pid) => {
|
|
47928
|
-
try {
|
|
47929
|
-
process.kill(pid, 0);
|
|
47930
|
-
return true;
|
|
47931
|
-
} catch (err) {
|
|
47932
|
-
if (err.code === "ESRCH") {
|
|
47933
|
-
console.log(`进程 ${pid} 不存在`);
|
|
47934
|
-
return false;
|
|
47935
|
-
} else if (err.code === "EPERM") {
|
|
47936
|
-
console.log(`没有权限检查进程 ${pid}`);
|
|
47937
|
-
return true;
|
|
47938
|
-
} else {
|
|
47939
|
-
console.error(`检查进程 ${pid} 时出错:`, err);
|
|
47940
|
-
return false;
|
|
47941
|
-
}
|
|
47942
|
-
}
|
|
47943
|
-
};
|
|
47944
|
-
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) => {
|
|
47945
|
-
if (options.init) {
|
|
47946
|
-
await initMain();
|
|
47947
|
-
return;
|
|
47948
|
-
} else if (!options.start && !options.restart && !options.exit && !options.pm2) {
|
|
47949
|
-
console.warn(chalk2.yellow("请使用 --init 初始化 main 应用"));
|
|
47950
|
-
}
|
|
47951
|
-
const runChild = () => {
|
|
47952
|
-
const logDir = path7.join(envisionPath, "log");
|
|
47953
|
-
const logFile = path7.join(logDir, "child.log");
|
|
47954
|
-
fs10.mkdirSync(logDir, { recursive: true });
|
|
47955
|
-
if (!checkFileExists(logFile)) {
|
|
47956
|
-
fs10.writeFileSync(logFile, "");
|
|
47957
|
-
}
|
|
47958
|
-
const stats = fs10.statSync(logFile);
|
|
47959
|
-
if (stats.size > 1024 * 1024 * 10) {
|
|
47960
|
-
fs10.renameSync(logFile, path7.join(logDir, `child-${Date.now()}.log`));
|
|
47961
|
-
fs10.writeFileSync(logFile, "");
|
|
47962
|
-
}
|
|
47963
|
-
const logStream = fs10.openSync(logFile, "a");
|
|
47964
|
-
if (options.pm2) {
|
|
47965
|
-
if (!checkPm2()) {
|
|
47966
|
-
console.log("安装pm2");
|
|
47967
|
-
installDep({ isGlobal: true, sync: true, dep: "pm2" });
|
|
47968
|
-
console.log(chalk2.green("安装pm2成功"));
|
|
47969
|
-
}
|
|
47970
|
-
}
|
|
47971
|
-
let comm = options.pm2 ? "pm2" : "node";
|
|
47972
|
-
const args = options.pm2 ? ["start", "dist/app.mjs", "--name", "main-app"] : ["dist/app.mjs"];
|
|
47973
|
-
const childProcess = spawn4(comm, args, {
|
|
47974
|
-
cwd: getConfig().mainAppPath,
|
|
47975
|
-
stdio: ["ignore", logStream, logStream],
|
|
47976
|
-
detached: true
|
|
47977
|
-
});
|
|
47978
|
-
childProcess.unref();
|
|
47979
|
-
if (!options.pm2) {
|
|
47980
|
-
writeConfig({ ...getConfig(), mainAppPid: childProcess.pid });
|
|
47981
|
-
}
|
|
47982
|
-
};
|
|
47983
|
-
const config2 = getConfig();
|
|
47984
|
-
if (!config2.mainAppPath) {
|
|
47985
|
-
console.log("请先初始化 main 应用");
|
|
47986
|
-
return;
|
|
47987
|
-
}
|
|
47988
|
-
if (options.start) {
|
|
47989
|
-
if (config2.mainAppPid) {
|
|
47990
|
-
if (checkPid(config2.mainAppPid)) {
|
|
47991
|
-
console.log("main app 已经启动");
|
|
47992
|
-
return;
|
|
47993
|
-
}
|
|
47994
|
-
}
|
|
47995
|
-
runChild();
|
|
47996
|
-
}
|
|
47997
|
-
if (options.restart) {
|
|
47998
|
-
if (config2.mainAppPid) {
|
|
47999
|
-
if (checkPid(config2.mainAppPid)) {
|
|
48000
|
-
process.kill(config2.mainAppPid);
|
|
48001
|
-
}
|
|
48002
|
-
}
|
|
48003
|
-
runChild();
|
|
48004
|
-
} else if (options.exit) {
|
|
48005
|
-
if (config2.mainAppPid) {
|
|
48006
|
-
if (checkPid(config2.mainAppPid)) {
|
|
48007
|
-
process.kill(config2.mainAppPid);
|
|
48008
|
-
}
|
|
48009
|
-
writeConfig({ ...config2, mainAppPid: null });
|
|
48010
|
-
console.log("main app 已经停止");
|
|
48011
|
-
}
|
|
48012
|
-
}
|
|
48013
|
-
});
|
|
48014
|
-
var mainPathCommand = new Command("path").action(() => {
|
|
48015
|
-
const config2 = getConfig();
|
|
48016
|
-
const appPath = path7.resolve(config2.mainAppPath);
|
|
48017
|
-
console.log(`cd ${appPath}`);
|
|
48018
|
-
});
|
|
48019
|
-
mainApp.addCommand(mainPathCommand);
|
|
48020
|
-
var mainLogCommand = new Command("log").option("-t, --tail", "查看日志").option("-f, --follow", "跟踪日志").description("查看main的日志").action((options) => {
|
|
48021
|
-
const logDir = path7.join(envisionPath, "log");
|
|
48022
|
-
const logFile = path7.join(logDir, "child.log");
|
|
48023
|
-
if (!checkFileExists(logFile)) {
|
|
48024
|
-
console.log("日志文件不存在");
|
|
48025
|
-
return;
|
|
48026
|
-
}
|
|
48027
|
-
if (options.tail) {
|
|
48028
|
-
const childProcess = spawn4("tail", ["-n", "20", "-f", logFile]);
|
|
48029
|
-
childProcess.stdout?.pipe(process.stdout);
|
|
48030
|
-
childProcess.stderr?.pipe(process.stderr);
|
|
48031
|
-
return;
|
|
48032
|
-
}
|
|
48033
|
-
if (options.follow) {
|
|
48034
|
-
const childProcess = spawn4("tail", ["-n", "50", "-f", logFile]);
|
|
48035
|
-
childProcess.stdout?.pipe(process.stdout);
|
|
48036
|
-
childProcess.stderr?.pipe(process.stderr);
|
|
48037
|
-
return;
|
|
48038
|
-
}
|
|
48039
|
-
const log = fs10.readFileSync(logFile, "utf-8");
|
|
48040
|
-
console.log(log);
|
|
48041
|
-
});
|
|
48042
|
-
mainApp.addCommand(mainLogCommand);
|
|
48043
|
-
program.addCommand(mainApp);
|
|
48044
|
-
|
|
48045
47853
|
// src/command/proxy.ts
|
|
48046
|
-
var
|
|
47854
|
+
var command6 = new Command("proxy").description("执行代理相关的命令").option("-s, --start", "启动代理").option("-u, --unset", "关闭代理").action((options) => {
|
|
48047
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";
|
|
48048
47856
|
const unProxyShell = "unset https_proxy http_proxy all_proxy";
|
|
48049
47857
|
if (options.start) {
|
|
@@ -48066,16 +47874,16 @@ var command7 = new Command("proxy").description("执行代理相关的命令").o
|
|
|
48066
47874
|
console.log(chalk2.red("请提供选项 -s 或 -u"));
|
|
48067
47875
|
}
|
|
48068
47876
|
});
|
|
48069
|
-
program.addCommand(
|
|
47877
|
+
program.addCommand(command6);
|
|
48070
47878
|
|
|
48071
47879
|
// src/command/update.ts
|
|
48072
47880
|
import { execSync } from "node:child_process";
|
|
48073
|
-
import
|
|
48074
|
-
import
|
|
47881
|
+
import path8 from "node:path";
|
|
47882
|
+
import fs11 from "node:fs";
|
|
48075
47883
|
|
|
48076
47884
|
// src/module/download/install.ts
|
|
48077
|
-
import
|
|
48078
|
-
import
|
|
47885
|
+
import path7 from "path";
|
|
47886
|
+
import fs10 from "fs";
|
|
48079
47887
|
var import_fast_glob3 = __toESM(require_out4(), 1);
|
|
48080
47888
|
var fetchLink = async (url = "", opts) => {
|
|
48081
47889
|
const token2 = process.env.KEVISUAL_TOKEN || storage.getItem("token");
|
|
@@ -48127,7 +47935,7 @@ var checkDelete = async (opts) => {
|
|
|
48127
47935
|
}
|
|
48128
47936
|
]);
|
|
48129
47937
|
if (answers?.confirm || yes) {
|
|
48130
|
-
|
|
47938
|
+
fs10.rmSync(dir, { recursive: true });
|
|
48131
47939
|
console.log(chalk2.green("删除成功", dir));
|
|
48132
47940
|
} else {
|
|
48133
47941
|
console.log(chalk2.red("取消删除", dir));
|
|
@@ -48136,29 +47944,29 @@ var checkDelete = async (opts) => {
|
|
|
48136
47944
|
} catch (error) {
|
|
48137
47945
|
console.error(error);
|
|
48138
47946
|
} finally {
|
|
48139
|
-
|
|
47947
|
+
fs10.mkdirSync(dir, { recursive: true });
|
|
48140
47948
|
}
|
|
48141
47949
|
}
|
|
48142
47950
|
};
|
|
48143
47951
|
var rewritePkg = (packagePath, pkg) => {
|
|
48144
47952
|
const readJsonFile = (filePath) => {
|
|
48145
47953
|
try {
|
|
48146
|
-
return JSON.parse(
|
|
47954
|
+
return JSON.parse(fs10.readFileSync(filePath, "utf-8"));
|
|
48147
47955
|
} catch (error) {
|
|
48148
47956
|
return {};
|
|
48149
47957
|
}
|
|
48150
47958
|
};
|
|
48151
47959
|
try {
|
|
48152
|
-
const dirname2 =
|
|
48153
|
-
if (!
|
|
48154
|
-
|
|
47960
|
+
const dirname2 = path7.dirname(packagePath);
|
|
47961
|
+
if (!fs10.existsSync(dirname2)) {
|
|
47962
|
+
fs10.mkdirSync(dirname2, { recursive: true });
|
|
48155
47963
|
}
|
|
48156
47964
|
const json = readJsonFile(packagePath);
|
|
48157
47965
|
json.id = pkg?.id;
|
|
48158
47966
|
json.appInfo = pkg;
|
|
48159
|
-
|
|
47967
|
+
fs10.writeFileSync(packagePath, JSON.stringify(json, null, 2));
|
|
48160
47968
|
} catch (error) {
|
|
48161
|
-
|
|
47969
|
+
fs10.writeFileSync(packagePath, JSON.stringify({ appInfo: pkg, id: pkg?.id }, null, 2));
|
|
48162
47970
|
}
|
|
48163
47971
|
return pkg;
|
|
48164
47972
|
};
|
|
@@ -48170,9 +47978,9 @@ var installApp = async (app, opts = {}) => {
|
|
|
48170
47978
|
const version2 = _app.version;
|
|
48171
47979
|
const user = _app.user;
|
|
48172
47980
|
const key = _app.key;
|
|
48173
|
-
const downloadDirPath =
|
|
47981
|
+
const downloadDirPath = path7.join(appDir, user, key);
|
|
48174
47982
|
await checkDelete({ force: opts?.force, yes: opts?.yes, dir: downloadDirPath });
|
|
48175
|
-
const packagePath =
|
|
47983
|
+
const packagePath = path7.join(appDir, `${user}/${key}/package.json`);
|
|
48176
47984
|
const downFiles = files.filter((file) => file?.path).map((file) => {
|
|
48177
47985
|
const name = file?.name || "";
|
|
48178
47986
|
const noVersionPath = file.path.replace(`/${version2}`, "");
|
|
@@ -48185,7 +47993,7 @@ var installApp = async (app, opts = {}) => {
|
|
|
48185
47993
|
}
|
|
48186
47994
|
return {
|
|
48187
47995
|
...file,
|
|
48188
|
-
downloadPath:
|
|
47996
|
+
downloadPath: path7.join(appDir, downloadPath),
|
|
48189
47997
|
downloadUrl
|
|
48190
47998
|
};
|
|
48191
47999
|
});
|
|
@@ -48194,9 +48002,9 @@ var installApp = async (app, opts = {}) => {
|
|
|
48194
48002
|
for (const file of downloadTasks) {
|
|
48195
48003
|
const downloadPath = file.downloadPath;
|
|
48196
48004
|
const downloadUrl = file.downloadUrl;
|
|
48197
|
-
const dir =
|
|
48198
|
-
if (!
|
|
48199
|
-
|
|
48005
|
+
const dir = path7.dirname(downloadPath);
|
|
48006
|
+
if (!fs10.existsSync(dir)) {
|
|
48007
|
+
fs10.mkdirSync(dir, { recursive: true });
|
|
48200
48008
|
}
|
|
48201
48009
|
console.log("downloadUrl", downloadUrl);
|
|
48202
48010
|
const { blob, type } = await fetchLink(downloadUrl);
|
|
@@ -48207,7 +48015,7 @@ var installApp = async (app, opts = {}) => {
|
|
|
48207
48015
|
throw new Error("fetchRes is error");
|
|
48208
48016
|
}
|
|
48209
48017
|
}
|
|
48210
|
-
|
|
48018
|
+
fs10.writeFileSync(downloadPath, Buffer.from(await blob.arrayBuffer()));
|
|
48211
48019
|
}
|
|
48212
48020
|
let indexHtml = files.find((file) => file.name === "index.html");
|
|
48213
48021
|
_app.data.files = files;
|
|
@@ -48227,15 +48035,15 @@ var installApp = async (app, opts = {}) => {
|
|
|
48227
48035
|
};
|
|
48228
48036
|
var checkAppDir = (appDir) => {
|
|
48229
48037
|
try {
|
|
48230
|
-
const files =
|
|
48038
|
+
const files = fs10.readdirSync(appDir);
|
|
48231
48039
|
if (files.length === 0) {
|
|
48232
|
-
|
|
48040
|
+
fs10.rmSync(appDir, { recursive: true });
|
|
48233
48041
|
}
|
|
48234
48042
|
} catch (error) {}
|
|
48235
48043
|
};
|
|
48236
|
-
var checkFileExists2 = (
|
|
48044
|
+
var checkFileExists2 = (path8) => {
|
|
48237
48045
|
try {
|
|
48238
|
-
|
|
48046
|
+
fs10.accessSync(path8);
|
|
48239
48047
|
return true;
|
|
48240
48048
|
} catch (error) {
|
|
48241
48049
|
return false;
|
|
@@ -48245,8 +48053,8 @@ var uninstallApp = async (app, opts = {}) => {
|
|
|
48245
48053
|
const { appDir = "" } = opts;
|
|
48246
48054
|
try {
|
|
48247
48055
|
const { user, key } = app;
|
|
48248
|
-
const keyDir =
|
|
48249
|
-
const parentDir =
|
|
48056
|
+
const keyDir = path7.join(appDir, user, key);
|
|
48057
|
+
const parentDir = path7.join(appDir, user);
|
|
48250
48058
|
if (!checkFileExists2(appDir) || !checkFileExists2(keyDir)) {
|
|
48251
48059
|
return {
|
|
48252
48060
|
code: 200,
|
|
@@ -48254,7 +48062,7 @@ var uninstallApp = async (app, opts = {}) => {
|
|
|
48254
48062
|
};
|
|
48255
48063
|
}
|
|
48256
48064
|
try {
|
|
48257
|
-
|
|
48065
|
+
fs10.rmSync(keyDir, { recursive: true });
|
|
48258
48066
|
} catch (error) {
|
|
48259
48067
|
console.error(error);
|
|
48260
48068
|
}
|
|
@@ -48298,14 +48106,14 @@ var fetchAiList = async (url, opts) => {
|
|
|
48298
48106
|
var import_semver = __toESM(require_semver2(), 1);
|
|
48299
48107
|
var getRunFilePath = () => {
|
|
48300
48108
|
const c = process.argv[1];
|
|
48301
|
-
const runFilePath =
|
|
48109
|
+
const runFilePath = path8.resolve(c);
|
|
48302
48110
|
const isJs = runFilePath.endsWith(".js");
|
|
48303
48111
|
let distDir = "";
|
|
48304
48112
|
if (isJs) {
|
|
48305
|
-
const dir =
|
|
48306
|
-
distDir =
|
|
48113
|
+
const dir = path8.dirname(runFilePath);
|
|
48114
|
+
distDir = path8.relative(dir, "../dist");
|
|
48307
48115
|
} else {
|
|
48308
|
-
distDir =
|
|
48116
|
+
distDir = path8.resolve(process.cwd(), "dist");
|
|
48309
48117
|
}
|
|
48310
48118
|
return distDir;
|
|
48311
48119
|
};
|
|
@@ -48314,7 +48122,7 @@ var downloadNewDistFiles = async (distDir) => {
|
|
|
48314
48122
|
const baseURL3 = getConfig().baseURL || "https://kevisual.cn";
|
|
48315
48123
|
const newData = distFiles.map((file) => {
|
|
48316
48124
|
const url = `${baseURL3}/root/cli/dist/${file}`;
|
|
48317
|
-
const filePath =
|
|
48125
|
+
const filePath = path8.join(distDir, file);
|
|
48318
48126
|
const exist = fileIsExist(filePath);
|
|
48319
48127
|
let hash = "";
|
|
48320
48128
|
hash = getHash(filePath);
|
|
@@ -48335,13 +48143,13 @@ var downloadNewDistFiles = async (distDir) => {
|
|
|
48335
48143
|
console.log("更新文件:", filePath);
|
|
48336
48144
|
isUpdate = true;
|
|
48337
48145
|
if (data.exist) {
|
|
48338
|
-
|
|
48146
|
+
fs11.writeFileSync(filePath, res.content, "utf-8");
|
|
48339
48147
|
} else {
|
|
48340
|
-
const dir =
|
|
48341
|
-
if (!
|
|
48342
|
-
|
|
48148
|
+
const dir = path8.dirname(filePath);
|
|
48149
|
+
if (!fs11.existsSync(dir)) {
|
|
48150
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
48343
48151
|
}
|
|
48344
|
-
|
|
48152
|
+
fs11.writeFileSync(filePath, res.content, "utf-8");
|
|
48345
48153
|
}
|
|
48346
48154
|
});
|
|
48347
48155
|
if (isUpdate) {
|
|
@@ -48390,8 +48198,8 @@ var update = new Command("update").option("-g --global", "update global").option
|
|
|
48390
48198
|
program.addCommand(update);
|
|
48391
48199
|
|
|
48392
48200
|
// src/command/sync/modules/base.ts
|
|
48393
|
-
import
|
|
48394
|
-
import
|
|
48201
|
+
import path9 from "node:path";
|
|
48202
|
+
import fs12 from "node:fs";
|
|
48395
48203
|
var import_fast_glob4 = __toESM(require_out4(), 1);
|
|
48396
48204
|
var import_micromatch = __toESM(require_micromatch(), 1);
|
|
48397
48205
|
var checkAuth = (value = "", baseURL3 = "") => {
|
|
@@ -48411,7 +48219,7 @@ class SyncBase {
|
|
|
48411
48219
|
const filename = opts?.configFilename || "kevisual.json";
|
|
48412
48220
|
const dir = opts?.dir || process.cwd();
|
|
48413
48221
|
this.#filename = filename;
|
|
48414
|
-
this.#dir =
|
|
48222
|
+
this.#dir = path9.resolve(dir);
|
|
48415
48223
|
this.baseURL = opts?.baseURL ?? "";
|
|
48416
48224
|
this.init();
|
|
48417
48225
|
}
|
|
@@ -48419,16 +48227,16 @@ class SyncBase {
|
|
|
48419
48227
|
try {
|
|
48420
48228
|
const dir = this.#dir;
|
|
48421
48229
|
const filename = this.#filename;
|
|
48422
|
-
const filepath =
|
|
48230
|
+
const filepath = path9.join(dir, filename);
|
|
48423
48231
|
if (!fileIsExist(filepath))
|
|
48424
48232
|
throw new Error("config file not found");
|
|
48425
|
-
const config2 = JSON.parse(
|
|
48233
|
+
const config2 = JSON.parse(fs12.readFileSync(filepath, "utf-8"));
|
|
48426
48234
|
const sync = config2.sync || {};
|
|
48427
48235
|
const keys = Object.keys(sync);
|
|
48428
48236
|
const newConfigSync = {};
|
|
48429
48237
|
for (let key of keys) {
|
|
48430
|
-
const keyPath =
|
|
48431
|
-
const newKey =
|
|
48238
|
+
const keyPath = path9.join(dir, key);
|
|
48239
|
+
const newKey = path9.relative(dir, keyPath);
|
|
48432
48240
|
newConfigSync[newKey] = sync[key];
|
|
48433
48241
|
}
|
|
48434
48242
|
config2.sync = newConfigSync;
|
|
@@ -48443,8 +48251,8 @@ class SyncBase {
|
|
|
48443
48251
|
if (!filename)
|
|
48444
48252
|
return false;
|
|
48445
48253
|
const dir = this.#dir;
|
|
48446
|
-
const file =
|
|
48447
|
-
return { relative:
|
|
48254
|
+
const file = path9.join(dir, filename);
|
|
48255
|
+
return { relative: path9.relative(dir, file), absolute: file };
|
|
48448
48256
|
}
|
|
48449
48257
|
async canDone(syncType, type) {
|
|
48450
48258
|
if (syncType === "sync")
|
|
@@ -48472,7 +48280,7 @@ class SyncBase {
|
|
|
48472
48280
|
const baseURL3 = this.baseURL;
|
|
48473
48281
|
const syncList = syncKeys.map((key) => {
|
|
48474
48282
|
const value = sync[key];
|
|
48475
|
-
const filepath =
|
|
48283
|
+
const filepath = path9.join(this.#dir, key);
|
|
48476
48284
|
if (typeof value === "string") {
|
|
48477
48285
|
const auth2 = checkAuth(value, baseURL3);
|
|
48478
48286
|
const type2 = auth2 ? "sync" : "none";
|
|
@@ -48549,16 +48357,17 @@ class SyncBase {
|
|
|
48549
48357
|
continue;
|
|
48550
48358
|
}
|
|
48551
48359
|
for (let file of glob_files) {
|
|
48552
|
-
const key =
|
|
48360
|
+
const key = path9.relative(cwd, file);
|
|
48553
48361
|
const _registryURL = new URL(registyURL);
|
|
48554
48362
|
const replaceKeys = Object.keys(replace);
|
|
48555
48363
|
let newKey = key;
|
|
48556
48364
|
for (let replaceKey of replaceKeys) {
|
|
48557
|
-
|
|
48558
|
-
|
|
48365
|
+
const _replaceKey = normalizeScriptPath(replaceKey);
|
|
48366
|
+
if (newKey.startsWith(_replaceKey)) {
|
|
48367
|
+
newKey = key.replace(_replaceKey, replace[replaceKey]);
|
|
48559
48368
|
}
|
|
48560
48369
|
}
|
|
48561
|
-
const pathname =
|
|
48370
|
+
const pathname = path9.join(_registryURL.pathname, newKey);
|
|
48562
48371
|
_registryURL.pathname = pathname;
|
|
48563
48372
|
keys.push(key);
|
|
48564
48373
|
obj[key] = { url: _registryURL.toString() };
|
|
@@ -48587,10 +48396,10 @@ class SyncBase {
|
|
|
48587
48396
|
}
|
|
48588
48397
|
getHash = getHash;
|
|
48589
48398
|
async getDir(filepath, check2 = false) {
|
|
48590
|
-
const dir =
|
|
48399
|
+
const dir = path9.dirname(filepath);
|
|
48591
48400
|
if (check2) {
|
|
48592
48401
|
if (!fileIsExist(dir)) {
|
|
48593
|
-
|
|
48402
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
48594
48403
|
}
|
|
48595
48404
|
}
|
|
48596
48405
|
return dir;
|
|
@@ -48600,9 +48409,9 @@ class SyncBase {
|
|
|
48600
48409
|
}
|
|
48601
48410
|
|
|
48602
48411
|
// src/command/sync/sync.ts
|
|
48603
|
-
import
|
|
48604
|
-
import
|
|
48605
|
-
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(() => {
|
|
48606
48415
|
console.log("同步项目");
|
|
48607
48416
|
});
|
|
48608
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) => {
|
|
@@ -48631,7 +48440,7 @@ var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").
|
|
|
48631
48440
|
}
|
|
48632
48441
|
const res = await upload({
|
|
48633
48442
|
token: token2,
|
|
48634
|
-
file:
|
|
48443
|
+
file: fs13.readFileSync(item.filepath),
|
|
48635
48444
|
url: item.url,
|
|
48636
48445
|
needHash: true,
|
|
48637
48446
|
hash: item.hash,
|
|
@@ -48643,7 +48452,7 @@ var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").
|
|
|
48643
48452
|
} else if (res.data?.isNewMeta) {
|
|
48644
48453
|
newInfos.push(["上传成功", item.key, chalk2.green(item.url), chalk2.green("元数据更新")]);
|
|
48645
48454
|
} else {
|
|
48646
|
-
logger.
|
|
48455
|
+
logger.debug("上传成功", item.key, chalk2.green(item.url), chalk2.blue("文件未更新"));
|
|
48647
48456
|
}
|
|
48648
48457
|
}
|
|
48649
48458
|
logger.debug(res);
|
|
@@ -48678,7 +48487,7 @@ var syncDownload = new Command("download").option("-d --dir <dir>", "配置目
|
|
|
48678
48487
|
const { content, status } = await fetchLink(item.url, { setToken: item.auth, returnContent: true, hash });
|
|
48679
48488
|
if (status === 200) {
|
|
48680
48489
|
await sync.getDir(item.filepath, true);
|
|
48681
|
-
|
|
48490
|
+
fs13.writeFileSync(item.filepath, content);
|
|
48682
48491
|
logger.info("下载成功", item.key, chalk2.green(item.url));
|
|
48683
48492
|
} else if (status === 304) {
|
|
48684
48493
|
logger.info("文件未修改", item.key, chalk2.green(item.url));
|
|
@@ -48719,7 +48528,7 @@ var syncCreateList = new Command("create").option("-d --dir <dir>", "配置目
|
|
|
48719
48528
|
const filepath = sync.getRelativePath(opts.output);
|
|
48720
48529
|
if (filepath) {
|
|
48721
48530
|
logger.debug("输出文件", filepath);
|
|
48722
|
-
|
|
48531
|
+
fs13.writeFileSync(filepath.absolute, JSON.stringify(newJson, null, 2));
|
|
48723
48532
|
} else {
|
|
48724
48533
|
logger.info(`输出内容
|
|
48725
48534
|
`);
|
|
@@ -48745,7 +48554,7 @@ var checkDir = new Command("check").option("-d --dir <dir>", "配置目录").opt
|
|
|
48745
48554
|
if (res.code === 200) {
|
|
48746
48555
|
const data = res?.data || [];
|
|
48747
48556
|
let matchObjectList = data.filter((dataItem) => {
|
|
48748
|
-
dataItem.pathname =
|
|
48557
|
+
dataItem.pathname = path10.join(item.key || "", dataItem.path);
|
|
48749
48558
|
return dataItem;
|
|
48750
48559
|
});
|
|
48751
48560
|
matchObjectList = sync.getMatchList({ ignore: item.ignore, matchObjectList }).matchObjectList;
|
|
@@ -48774,7 +48583,7 @@ var checkDir = new Command("check").option("-d --dir <dir>", "配置目录").opt
|
|
|
48774
48583
|
if (needDownload) {
|
|
48775
48584
|
const { content, status } = await fetchLink(matchItem.url, { setToken: item.auth, returnContent: true, hash });
|
|
48776
48585
|
if (status === 200) {
|
|
48777
|
-
|
|
48586
|
+
fs13.writeFileSync(matchItem.absolute, content);
|
|
48778
48587
|
logger.info("下载成功", matchItem.pathname, chalk2.green(matchItem.url));
|
|
48779
48588
|
} else if (status === 304) {
|
|
48780
48589
|
logger.info("文件未修改", matchItem.pathname, chalk2.green(matchItem.url));
|
|
@@ -48789,16 +48598,16 @@ var checkDir = new Command("check").option("-d --dir <dir>", "配置目录").opt
|
|
|
48789
48598
|
}
|
|
48790
48599
|
}
|
|
48791
48600
|
});
|
|
48792
|
-
|
|
48793
|
-
|
|
48794
|
-
|
|
48795
|
-
|
|
48796
|
-
|
|
48797
|
-
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);
|
|
48798
48607
|
|
|
48799
48608
|
// src/command/app/front-app/index.ts
|
|
48800
|
-
import
|
|
48801
|
-
import
|
|
48609
|
+
import fs14 from "fs";
|
|
48610
|
+
import path11 from "path";
|
|
48802
48611
|
var appCommand = new Command("app").description("app 命令").action(() => {
|
|
48803
48612
|
console.log("app");
|
|
48804
48613
|
});
|
|
@@ -48814,7 +48623,7 @@ app download -i root/code-center`).option("-i, --id <id>", "下载 app serve cli
|
|
|
48814
48623
|
if (output) {
|
|
48815
48624
|
const checkOutput = fileIsExist(output);
|
|
48816
48625
|
if (!checkOutput) {
|
|
48817
|
-
|
|
48626
|
+
fs14.mkdirSync(output, { recursive: true });
|
|
48818
48627
|
}
|
|
48819
48628
|
}
|
|
48820
48629
|
const [user, key] = id.split("/");
|
|
@@ -48853,7 +48662,7 @@ app download -i root/code-center`).option("-i, --id <id>", "下载 app serve cli
|
|
|
48853
48662
|
});
|
|
48854
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) => {
|
|
48855
48664
|
if (options.path) {
|
|
48856
|
-
const _path =
|
|
48665
|
+
const _path = path11.resolve(options.path);
|
|
48857
48666
|
try {
|
|
48858
48667
|
const checkPath = fileIsExist(_path);
|
|
48859
48668
|
if (!checkPath) {
|
|
@@ -48868,7 +48677,7 @@ var uninstallAppCommand = new Command("uninstall").alias("remove").description("
|
|
|
48868
48677
|
}
|
|
48869
48678
|
]);
|
|
48870
48679
|
if (answer.confirm) {
|
|
48871
|
-
|
|
48680
|
+
fs14.rmSync(_path, { recursive: true });
|
|
48872
48681
|
console.log(chalk2.green("删除成功", _path));
|
|
48873
48682
|
}
|
|
48874
48683
|
}
|
|
@@ -48912,29 +48721,29 @@ var link = new Command("link").argument("url").option("-o --output <output>", "
|
|
|
48912
48721
|
if (output) {
|
|
48913
48722
|
const checkOutput = fileIsExist(output);
|
|
48914
48723
|
if (!checkOutput) {
|
|
48915
|
-
|
|
48724
|
+
fs14.mkdirSync(output, { recursive: true });
|
|
48916
48725
|
}
|
|
48917
48726
|
}
|
|
48918
|
-
|
|
48727
|
+
fs14.writeFileSync(path11.join(output, filename), content);
|
|
48919
48728
|
});
|
|
48920
48729
|
appCommand.addCommand(link);
|
|
48921
48730
|
|
|
48922
48731
|
// src/command/gist/index.ts
|
|
48923
|
-
import
|
|
48924
|
-
import
|
|
48925
|
-
import { spawn as
|
|
48926
|
-
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) => {
|
|
48927
48736
|
if (!link2) {
|
|
48928
48737
|
console.log(chalk2.red("请提供链接"));
|
|
48929
48738
|
return;
|
|
48930
48739
|
}
|
|
48931
|
-
const dir =
|
|
48932
|
-
if (!
|
|
48933
|
-
|
|
48740
|
+
const dir = path12.resolve(opts.dir || process.cwd());
|
|
48741
|
+
if (!fs15.existsSync(dir)) {
|
|
48742
|
+
fs15.mkdirSync(dir, { recursive: true });
|
|
48934
48743
|
}
|
|
48935
48744
|
const cmd = `ev gist download -l ${link2} -s `;
|
|
48936
48745
|
console.log(chalk2.green("开始执行"), cmd);
|
|
48937
|
-
|
|
48746
|
+
spawn4(cmd, {
|
|
48938
48747
|
shell: true,
|
|
48939
48748
|
stdio: "inherit",
|
|
48940
48749
|
cwd: dir
|
|
@@ -48942,10 +48751,10 @@ var command9 = new Command("gist").description("同步片段代码").option("-d,
|
|
|
48942
48751
|
});
|
|
48943
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) => {
|
|
48944
48753
|
console.log("克隆代码片段", opts);
|
|
48945
|
-
const dir =
|
|
48754
|
+
const dir = path12.resolve(opts.dir || process.cwd());
|
|
48946
48755
|
const link2 = opts.link || "";
|
|
48947
48756
|
const configFilename = opts.config || "kevisual.json";
|
|
48948
|
-
const configPath2 =
|
|
48757
|
+
const configPath2 = path12.join(dir, configFilename);
|
|
48949
48758
|
if (!link2) {
|
|
48950
48759
|
console.log(chalk2.red("请提供链接"));
|
|
48951
48760
|
return;
|
|
@@ -48958,20 +48767,170 @@ var download = new Command("download").option("-d --dir <dir>", "配置目录").
|
|
|
48958
48767
|
console.log(chalk2.red("配置文件下载失败"));
|
|
48959
48768
|
throw "配置文件下载失败";
|
|
48960
48769
|
});
|
|
48961
|
-
|
|
48962
|
-
|
|
48770
|
+
fs15.mkdirSync(dir, { recursive: true });
|
|
48771
|
+
fs15.writeFileSync(configPath2, JSON.stringify(res, null, 2));
|
|
48963
48772
|
console.log(chalk2.green("配置文件下载成功: " + configPath2));
|
|
48964
48773
|
if (opts.sync) {
|
|
48965
48774
|
const cmd = `ev sync download --config "${configFilename}"`;
|
|
48966
48775
|
console.log(chalk2.green("开始同步文件"), cmd);
|
|
48967
|
-
|
|
48776
|
+
spawn4(cmd, {
|
|
48968
48777
|
cwd: dir,
|
|
48969
48778
|
shell: true,
|
|
48970
48779
|
stdio: "inherit"
|
|
48971
48780
|
});
|
|
48972
48781
|
}
|
|
48973
48782
|
});
|
|
48974
|
-
|
|
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);
|
|
48975
48934
|
program.addCommand(command9);
|
|
48976
48935
|
|
|
48977
48936
|
// src/index.ts
|