@kevisual/cli 0.1.17 → 0.1.19
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-opencode.d.ts +4 -1
- package/dist/assistant-opencode.js +382 -138
- package/dist/assistant-server.js +1401 -1067
- package/dist/assistant.js +383 -140
- package/dist/envision.js +169 -60
- package/package.json +7 -5
package/dist/envision.js
CHANGED
|
@@ -22490,8 +22490,8 @@ InitEnv.init();
|
|
|
22490
22490
|
var version = useContextKey("version", () => {
|
|
22491
22491
|
let version2 = "0.0.64";
|
|
22492
22492
|
try {
|
|
22493
|
-
if ("0.1.
|
|
22494
|
-
version2 = "0.1.
|
|
22493
|
+
if ("0.1.19")
|
|
22494
|
+
version2 = "0.1.19";
|
|
22495
22495
|
} catch (e) {}
|
|
22496
22496
|
return version2;
|
|
22497
22497
|
});
|
|
@@ -23608,14 +23608,14 @@ var getEnvToken = () => {
|
|
|
23608
23608
|
return envTokne;
|
|
23609
23609
|
};
|
|
23610
23610
|
|
|
23611
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
23611
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/key.js
|
|
23612
23612
|
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
23613
23613
|
var isDownKey = (key, keybindings = []) => key.name === "down" || keybindings.includes("vim") && key.name === "j" || keybindings.includes("emacs") && key.ctrl && key.name === "n";
|
|
23614
23614
|
var isBackspaceKey = (key) => key.name === "backspace";
|
|
23615
23615
|
var isTabKey = (key) => key.name === "tab";
|
|
23616
23616
|
var isNumberKey = (key) => "1234567890".includes(key.name);
|
|
23617
23617
|
var isEnterKey = (key) => key.name === "enter" || key.name === "return";
|
|
23618
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
23618
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/errors.js
|
|
23619
23619
|
class AbortPromptError extends Error {
|
|
23620
23620
|
name = "AbortPromptError";
|
|
23621
23621
|
message = "Prompt was aborted";
|
|
@@ -23641,10 +23641,10 @@ class HookError extends Error {
|
|
|
23641
23641
|
class ValidationError extends Error {
|
|
23642
23642
|
name = "ValidationError";
|
|
23643
23643
|
}
|
|
23644
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
23644
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
23645
23645
|
import { AsyncResource as AsyncResource2 } from "node:async_hooks";
|
|
23646
23646
|
|
|
23647
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
23647
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/hook-engine.js
|
|
23648
23648
|
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
23649
23649
|
var hookStorage = new AsyncLocalStorage;
|
|
23650
23650
|
function createStore(rl) {
|
|
@@ -23749,7 +23749,7 @@ var effectScheduler = {
|
|
|
23749
23749
|
}
|
|
23750
23750
|
};
|
|
23751
23751
|
|
|
23752
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
23752
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/use-state.js
|
|
23753
23753
|
function useState(defaultValue) {
|
|
23754
23754
|
return withPointer((pointer) => {
|
|
23755
23755
|
const setState = AsyncResource2.bind(function setState2(newValue) {
|
|
@@ -23767,7 +23767,7 @@ function useState(defaultValue) {
|
|
|
23767
23767
|
});
|
|
23768
23768
|
}
|
|
23769
23769
|
|
|
23770
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
23770
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/use-effect.js
|
|
23771
23771
|
function useEffect(cb, depArray) {
|
|
23772
23772
|
withPointer((pointer) => {
|
|
23773
23773
|
const oldDeps = pointer.get();
|
|
@@ -23779,7 +23779,7 @@ function useEffect(cb, depArray) {
|
|
|
23779
23779
|
});
|
|
23780
23780
|
}
|
|
23781
23781
|
|
|
23782
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
23782
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/theme.js
|
|
23783
23783
|
import { styleText } from "node:util";
|
|
23784
23784
|
|
|
23785
23785
|
// node_modules/.pnpm/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
|
|
@@ -24071,7 +24071,7 @@ var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
|
24071
24071
|
var dist_default = figures;
|
|
24072
24072
|
var replacements = Object.entries(specialMainSymbols);
|
|
24073
24073
|
|
|
24074
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24074
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/theme.js
|
|
24075
24075
|
var defaultTheme = {
|
|
24076
24076
|
prefix: {
|
|
24077
24077
|
idle: styleText("blue", "?"),
|
|
@@ -24092,7 +24092,7 @@ var defaultTheme = {
|
|
|
24092
24092
|
}
|
|
24093
24093
|
};
|
|
24094
24094
|
|
|
24095
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24095
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/make-theme.js
|
|
24096
24096
|
function isPlainObject(value) {
|
|
24097
24097
|
if (typeof value !== "object" || value === null)
|
|
24098
24098
|
return false;
|
|
@@ -24120,7 +24120,7 @@ function makeTheme(...themes) {
|
|
|
24120
24120
|
return deepMerge(...themesToMerge);
|
|
24121
24121
|
}
|
|
24122
24122
|
|
|
24123
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24123
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/use-prefix.js
|
|
24124
24124
|
function usePrefix({ status = "idle", theme }) {
|
|
24125
24125
|
const [showLoader, setShowLoader] = useState(false);
|
|
24126
24126
|
const [tick, setTick] = useState(0);
|
|
@@ -24150,7 +24150,7 @@ function usePrefix({ status = "idle", theme }) {
|
|
|
24150
24150
|
const iconName = status === "loading" ? "idle" : status;
|
|
24151
24151
|
return typeof prefix === "string" ? prefix : prefix[iconName] ?? prefix["idle"];
|
|
24152
24152
|
}
|
|
24153
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24153
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/use-memo.js
|
|
24154
24154
|
function useMemo(fn, dependencies) {
|
|
24155
24155
|
return withPointer((pointer) => {
|
|
24156
24156
|
const prev = pointer.get();
|
|
@@ -24162,11 +24162,11 @@ function useMemo(fn, dependencies) {
|
|
|
24162
24162
|
return prev.value;
|
|
24163
24163
|
});
|
|
24164
24164
|
}
|
|
24165
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24165
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/use-ref.js
|
|
24166
24166
|
function useRef(val) {
|
|
24167
24167
|
return useState({ current: val })[0];
|
|
24168
24168
|
}
|
|
24169
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24169
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/use-keypress.js
|
|
24170
24170
|
function useKeypress(userHandler) {
|
|
24171
24171
|
const signal = useRef(userHandler);
|
|
24172
24172
|
signal.current = userHandler;
|
|
@@ -24184,7 +24184,7 @@ function useKeypress(userHandler) {
|
|
|
24184
24184
|
};
|
|
24185
24185
|
}, []);
|
|
24186
24186
|
}
|
|
24187
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24187
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/utils.js
|
|
24188
24188
|
var import_cli_width = __toESM(require_cli_width(), 1);
|
|
24189
24189
|
|
|
24190
24190
|
// node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
|
|
@@ -24528,7 +24528,7 @@ function wrapAnsi(string, columns, options) {
|
|
|
24528
24528
|
`);
|
|
24529
24529
|
}
|
|
24530
24530
|
|
|
24531
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24531
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/utils.js
|
|
24532
24532
|
function breakLines(content, width) {
|
|
24533
24533
|
return content.split(`
|
|
24534
24534
|
`).flatMap((line) => wrapAnsi(line, width, { trim: false, hard: true }).split(`
|
|
@@ -24539,7 +24539,7 @@ function readlineWidth() {
|
|
|
24539
24539
|
return import_cli_width.default({ defaultWidth: 80, output: readline().output });
|
|
24540
24540
|
}
|
|
24541
24541
|
|
|
24542
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24542
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/pagination/use-pagination.js
|
|
24543
24543
|
function usePointerPosition({ active, renderedItems, pageSize, loop }) {
|
|
24544
24544
|
const state = useRef({
|
|
24545
24545
|
lastPointer: active,
|
|
@@ -24605,7 +24605,7 @@ function usePagination({ items, active, renderItem, pageSize, loop = true }) {
|
|
|
24605
24605
|
return pageBuffer.filter((line) => typeof line === "string").join(`
|
|
24606
24606
|
`);
|
|
24607
24607
|
}
|
|
24608
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24608
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
24609
24609
|
var import_mute_stream = __toESM(require_lib(), 1);
|
|
24610
24610
|
import * as readline2 from "node:readline";
|
|
24611
24611
|
import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
@@ -24818,7 +24818,7 @@ var {
|
|
|
24818
24818
|
unload
|
|
24819
24819
|
} = signalExitWrap(processOk(process3) ? new SignalExit(process3) : new SignalExitFallback);
|
|
24820
24820
|
|
|
24821
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24821
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
24822
24822
|
import { stripVTControlCharacters } from "node:util";
|
|
24823
24823
|
|
|
24824
24824
|
// node_modules/.pnpm/@inquirer+ansi@2.0.3/node_modules/@inquirer/ansi/dist/index.js
|
|
@@ -24837,7 +24837,7 @@ var cursorTo = (x, y) => {
|
|
|
24837
24837
|
var eraseLine = ESC2 + "2K";
|
|
24838
24838
|
var eraseLines = (lines) => lines > 0 ? (eraseLine + cursorUp(1)).repeat(lines - 1) + eraseLine + cursorLeft : "";
|
|
24839
24839
|
|
|
24840
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24840
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/screen-manager.js
|
|
24841
24841
|
var height = (content) => content.split(`
|
|
24842
24842
|
`).length;
|
|
24843
24843
|
var lastLine = (content) => content.split(`
|
|
@@ -24902,7 +24902,7 @@ class ScreenManager {
|
|
|
24902
24902
|
}
|
|
24903
24903
|
}
|
|
24904
24904
|
|
|
24905
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24905
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/promise-polyfill.js
|
|
24906
24906
|
class PromisePolyfill extends Promise {
|
|
24907
24907
|
static withResolver() {
|
|
24908
24908
|
let resolve;
|
|
@@ -24915,7 +24915,7 @@ class PromisePolyfill extends Promise {
|
|
|
24915
24915
|
}
|
|
24916
24916
|
}
|
|
24917
24917
|
|
|
24918
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
24918
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
24919
24919
|
var nativeSetImmediate = globalThis.setImmediate;
|
|
24920
24920
|
function getCallSites() {
|
|
24921
24921
|
const _prepareStackTrace = Error.prepareStackTrace;
|
|
@@ -25010,7 +25010,7 @@ function createPrompt(view) {
|
|
|
25010
25010
|
};
|
|
25011
25011
|
return prompt;
|
|
25012
25012
|
}
|
|
25013
|
-
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.
|
|
25013
|
+
// node_modules/.pnpm/@inquirer+core@11.1.5_@types+node@25.3.5/node_modules/@inquirer/core/dist/lib/Separator.js
|
|
25014
25014
|
import { styleText as styleText2 } from "node:util";
|
|
25015
25015
|
class Separator {
|
|
25016
25016
|
separator = styleText2("dim", Array.from({ length: 15 }).join(dist_default.line));
|
|
@@ -25024,7 +25024,7 @@ class Separator {
|
|
|
25024
25024
|
return Boolean(choice && typeof choice === "object" && "type" in choice && choice.type === "separator");
|
|
25025
25025
|
}
|
|
25026
25026
|
}
|
|
25027
|
-
// node_modules/.pnpm/@inquirer+confirm@6.0.8_@types+node@25.3.
|
|
25027
|
+
// node_modules/.pnpm/@inquirer+confirm@6.0.8_@types+node@25.3.5/node_modules/@inquirer/confirm/dist/index.js
|
|
25028
25028
|
function getBooleanValue(value, defaultValue) {
|
|
25029
25029
|
let answer = defaultValue !== false;
|
|
25030
25030
|
if (/^(y|yes)/i.test(value))
|
|
@@ -25069,7 +25069,7 @@ var dist_default4 = createPrompt((config, done) => {
|
|
|
25069
25069
|
const message = theme.style.message(config.message, status);
|
|
25070
25070
|
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
25071
25071
|
});
|
|
25072
|
-
// node_modules/.pnpm/@inquirer+input@5.0.8_@types+node@25.3.
|
|
25072
|
+
// node_modules/.pnpm/@inquirer+input@5.0.8_@types+node@25.3.5/node_modules/@inquirer/input/dist/index.js
|
|
25073
25073
|
var inputTheme = {
|
|
25074
25074
|
validationFailureMode: "keep"
|
|
25075
25075
|
};
|
|
@@ -25153,7 +25153,7 @@ var dist_default5 = createPrompt((config, done) => {
|
|
|
25153
25153
|
error
|
|
25154
25154
|
];
|
|
25155
25155
|
});
|
|
25156
|
-
// node_modules/.pnpm/@inquirer+select@5.1.0_@types+node@25.3.
|
|
25156
|
+
// node_modules/.pnpm/@inquirer+select@5.1.0_@types+node@25.3.5/node_modules/@inquirer/select/dist/index.js
|
|
25157
25157
|
import { styleText as styleText3 } from "node:util";
|
|
25158
25158
|
var selectTheme = {
|
|
25159
25159
|
icon: { cursor: dist_default.pointer },
|
|
@@ -25327,7 +25327,7 @@ var dist_default6 = createPrompt((config, done) => {
|
|
|
25327
25327
|
var import_md5 = __toESM(require_md5(), 1);
|
|
25328
25328
|
var import_jsonwebtoken = __toESM(require_jsonwebtoken(), 1);
|
|
25329
25329
|
|
|
25330
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
25330
|
+
// node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query.js
|
|
25331
25331
|
var isTextForContentType = (contentType) => {
|
|
25332
25332
|
if (!contentType)
|
|
25333
25333
|
return false;
|
|
@@ -25530,6 +25530,10 @@ class Query {
|
|
|
25530
25530
|
});
|
|
25531
25531
|
}
|
|
25532
25532
|
}
|
|
25533
|
+
const headers2 = req.headers || {};
|
|
25534
|
+
if (options?.token && !headers2["Authorization"]) {
|
|
25535
|
+
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
25536
|
+
}
|
|
25533
25537
|
} catch (e) {
|
|
25534
25538
|
console.error("request beforeFn error", e, req);
|
|
25535
25539
|
return wrapperError({
|
|
@@ -25590,20 +25594,20 @@ class Query {
|
|
|
25590
25594
|
this.afterResponse = fn;
|
|
25591
25595
|
}
|
|
25592
25596
|
async fetchText(urlOrOptions, options) {
|
|
25593
|
-
let _options = { ...options };
|
|
25597
|
+
let _options = { method: "GET", ...options };
|
|
25594
25598
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
25595
25599
|
_options.url = urlOrOptions;
|
|
25596
25600
|
}
|
|
25597
25601
|
if (typeof urlOrOptions === "object") {
|
|
25598
25602
|
_options = { ...urlOrOptions, ..._options };
|
|
25599
25603
|
}
|
|
25604
|
+
const headers = { ...this.headers, ..._options.headers };
|
|
25605
|
+
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
25606
|
+
headers["Authorization"] = `Bearer ${options.token}`;
|
|
25607
|
+
}
|
|
25600
25608
|
const res = await adapter({
|
|
25601
|
-
method: "GET",
|
|
25602
25609
|
..._options,
|
|
25603
|
-
headers
|
|
25604
|
-
...this.headers,
|
|
25605
|
-
..._options?.headers || {}
|
|
25606
|
-
}
|
|
25610
|
+
headers
|
|
25607
25611
|
});
|
|
25608
25612
|
if (res && !res.code) {
|
|
25609
25613
|
return {
|
|
@@ -25615,7 +25619,7 @@ class Query {
|
|
|
25615
25619
|
}
|
|
25616
25620
|
}
|
|
25617
25621
|
|
|
25618
|
-
// node_modules/.pnpm/@kevisual+query@0.0.
|
|
25622
|
+
// node_modules/.pnpm/@kevisual+query@0.0.53/node_modules/@kevisual/query/dist/query-browser.js
|
|
25619
25623
|
var isTextForContentType2 = (contentType) => {
|
|
25620
25624
|
if (!contentType)
|
|
25621
25625
|
return false;
|
|
@@ -25818,6 +25822,10 @@ class Query2 {
|
|
|
25818
25822
|
});
|
|
25819
25823
|
}
|
|
25820
25824
|
}
|
|
25825
|
+
const headers2 = req.headers || {};
|
|
25826
|
+
if (options?.token && !headers2["Authorization"]) {
|
|
25827
|
+
headers2["Authorization"] = `Bearer ${options.token}`;
|
|
25828
|
+
}
|
|
25821
25829
|
} catch (e) {
|
|
25822
25830
|
console.error("request beforeFn error", e, req);
|
|
25823
25831
|
return wrapperError2({
|
|
@@ -25878,20 +25886,20 @@ class Query2 {
|
|
|
25878
25886
|
this.afterResponse = fn;
|
|
25879
25887
|
}
|
|
25880
25888
|
async fetchText(urlOrOptions, options) {
|
|
25881
|
-
let _options = { ...options };
|
|
25889
|
+
let _options = { method: "GET", ...options };
|
|
25882
25890
|
if (typeof urlOrOptions === "string" && !_options.url) {
|
|
25883
25891
|
_options.url = urlOrOptions;
|
|
25884
25892
|
}
|
|
25885
25893
|
if (typeof urlOrOptions === "object") {
|
|
25886
25894
|
_options = { ...urlOrOptions, ..._options };
|
|
25887
25895
|
}
|
|
25896
|
+
const headers = { ...this.headers, ..._options.headers };
|
|
25897
|
+
if (options?.token && !headers["Authorization"] && _options.method !== "GET") {
|
|
25898
|
+
headers["Authorization"] = `Bearer ${options.token}`;
|
|
25899
|
+
}
|
|
25888
25900
|
const res = await adapter2({
|
|
25889
|
-
method: "GET",
|
|
25890
25901
|
..._options,
|
|
25891
|
-
headers
|
|
25892
|
-
...this.headers,
|
|
25893
|
-
..._options?.headers || {}
|
|
25894
|
-
}
|
|
25902
|
+
headers
|
|
25895
25903
|
});
|
|
25896
25904
|
if (res && !res.code) {
|
|
25897
25905
|
return {
|
|
@@ -28746,7 +28754,50 @@ var queryAppVersion = async (params, opts) => {
|
|
|
28746
28754
|
}, opts);
|
|
28747
28755
|
};
|
|
28748
28756
|
|
|
28757
|
+
// node_modules/.pnpm/nanoid@5.1.6/node_modules/nanoid/index.js
|
|
28758
|
+
import { webcrypto as crypto3 } from "node:crypto";
|
|
28759
|
+
var POOL_SIZE_MULTIPLIER = 128;
|
|
28760
|
+
var pool;
|
|
28761
|
+
var poolOffset;
|
|
28762
|
+
function fillPool(bytes) {
|
|
28763
|
+
if (!pool || pool.length < bytes) {
|
|
28764
|
+
pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
|
|
28765
|
+
crypto3.getRandomValues(pool);
|
|
28766
|
+
poolOffset = 0;
|
|
28767
|
+
} else if (poolOffset + bytes > pool.length) {
|
|
28768
|
+
crypto3.getRandomValues(pool);
|
|
28769
|
+
poolOffset = 0;
|
|
28770
|
+
}
|
|
28771
|
+
poolOffset += bytes;
|
|
28772
|
+
}
|
|
28773
|
+
function random(bytes) {
|
|
28774
|
+
fillPool(bytes |= 0);
|
|
28775
|
+
return pool.subarray(poolOffset - bytes, poolOffset);
|
|
28776
|
+
}
|
|
28777
|
+
function customRandom(alphabet, defaultSize, getRandom) {
|
|
28778
|
+
let mask = (2 << 31 - Math.clz32(alphabet.length - 1 | 1)) - 1;
|
|
28779
|
+
let step = Math.ceil(1.6 * mask * defaultSize / alphabet.length);
|
|
28780
|
+
return (size = defaultSize) => {
|
|
28781
|
+
if (!size)
|
|
28782
|
+
return "";
|
|
28783
|
+
let id = "";
|
|
28784
|
+
while (true) {
|
|
28785
|
+
let bytes = getRandom(step);
|
|
28786
|
+
let i = step;
|
|
28787
|
+
while (i--) {
|
|
28788
|
+
id += alphabet[bytes[i] & mask] || "";
|
|
28789
|
+
if (id.length >= size)
|
|
28790
|
+
return id;
|
|
28791
|
+
}
|
|
28792
|
+
}
|
|
28793
|
+
};
|
|
28794
|
+
}
|
|
28795
|
+
function customAlphabet(alphabet, size = 21) {
|
|
28796
|
+
return customRandom(alphabet, size, random);
|
|
28797
|
+
}
|
|
28798
|
+
|
|
28749
28799
|
// src/command/deploy.ts
|
|
28800
|
+
var nanoid = customAlphabet("abcdefghijklmnopqrstuvwxyz", 8);
|
|
28750
28801
|
var getPackageJson = (opts) => {
|
|
28751
28802
|
const filePath = path3.join(process.cwd(), "package.json");
|
|
28752
28803
|
if (!fs6.existsSync(filePath)) {
|
|
@@ -28755,7 +28806,7 @@ var getPackageJson = (opts) => {
|
|
|
28755
28806
|
try {
|
|
28756
28807
|
const packageJson = JSON.parse(fs6.readFileSync(filePath, "utf-8"));
|
|
28757
28808
|
const basename = packageJson.basename || "";
|
|
28758
|
-
const version2 = packageJson.version || "";
|
|
28809
|
+
const version2 = packageJson.version || "1.0.0";
|
|
28759
28810
|
const app = packageJson.app;
|
|
28760
28811
|
const userAppArry = basename.split("/");
|
|
28761
28812
|
if (userAppArry.length <= 2 && !opts?.appKey) {
|
|
@@ -28768,27 +28819,23 @@ var getPackageJson = (opts) => {
|
|
|
28768
28819
|
return null;
|
|
28769
28820
|
}
|
|
28770
28821
|
};
|
|
28771
|
-
var command2 = new Command("deploy").description("把前端文件传到服务器").argument("<filePath>", "Path to the file to be uploaded, filepath or directory").option("-v, --version <version>", "verbose").option("-k, --key <key>", "key").option("-y, --yes <yes>", "yes").option("-o, --org <org>", "org").option("-u, --update", "load current app. set current version in product。 redis 缓存更新").option("-s, --showBackend", "show backend url, 部署的后端应用,显示执行的cli命令").option("-d, --dot", "是否上传隐藏文件").option("--dir, --directory <directory>", "上传的prefix路径,默认为空,例如设置为static,则会上传到/${username}/resources/${key}/${version}/static/路径下").action(async (filePath, options) => {
|
|
28822
|
+
var command2 = new Command("deploy").description("把前端文件传到服务器").argument("<filePath>", "Path to the file to be uploaded, filepath or directory").option("-v, --version <version>", "verbose").option("-k, --key <key>", "key").option("-y, --yes <yes>", "yes 已经去除").option("-o, --org <org>", "org").option("-u, --update", "load current app. set current version in product。 redis 缓存更新").option("-s, --showBackend", "show backend url, 部署的后端应用,显示执行的cli命令").option("-d, --dot", "是否上传隐藏文件").option("--dir, --directory <directory>", "上传的prefix路径,默认为空,例如设置为static,则会上传到/${username}/resources/${key}/${version}/static/路径下").action(async (filePath, options) => {
|
|
28772
28823
|
try {
|
|
28773
|
-
let { version: version2, key,
|
|
28824
|
+
let { version: version2, key, update, org, showBackend } = options;
|
|
28774
28825
|
const dot = !!options.dot;
|
|
28775
28826
|
const pkgInfo = getPackageJson({ version: version2, appKey: key });
|
|
28776
28827
|
if (!version2 && pkgInfo?.version) {
|
|
28777
|
-
version2 = pkgInfo?.version || "";
|
|
28828
|
+
version2 = pkgInfo?.version || "1.0.0";
|
|
28778
28829
|
}
|
|
28779
28830
|
if (!key && pkgInfo?.appKey) {
|
|
28780
28831
|
key = pkgInfo?.appKey || "";
|
|
28781
28832
|
}
|
|
28782
28833
|
logger.debug("start deploy");
|
|
28783
28834
|
if (!version2) {
|
|
28784
|
-
version2 =
|
|
28785
|
-
message: "Enter your version:"
|
|
28786
|
-
});
|
|
28835
|
+
version2 = "1.0.0";
|
|
28787
28836
|
}
|
|
28788
28837
|
if (!key) {
|
|
28789
|
-
key =
|
|
28790
|
-
message: "Enter your key:"
|
|
28791
|
-
});
|
|
28838
|
+
key = nanoid(8);
|
|
28792
28839
|
}
|
|
28793
28840
|
const pwd = process.cwd();
|
|
28794
28841
|
const directory = path3.join(pwd, filePath);
|
|
@@ -28817,14 +28864,6 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
|
|
|
28817
28864
|
}
|
|
28818
28865
|
logger.debug("upload Files", _relativeFiles);
|
|
28819
28866
|
logger.debug("upload Files Key", key, version2);
|
|
28820
|
-
if (!yes) {
|
|
28821
|
-
const confirmed = await dist_default4({
|
|
28822
|
-
message: "Do you want to upload these files?"
|
|
28823
|
-
});
|
|
28824
|
-
if (!confirmed) {
|
|
28825
|
-
return;
|
|
28826
|
-
}
|
|
28827
|
-
}
|
|
28828
28867
|
let username = "";
|
|
28829
28868
|
if (pkgInfo?.user) {
|
|
28830
28869
|
username = pkgInfo.user;
|
|
@@ -34559,7 +34598,7 @@ var getJWKS = new Command("get").description("获取 JWKS 内容").option("-d ,
|
|
|
34559
34598
|
jwksCmd.addCommand(getJWKS);
|
|
34560
34599
|
program.addCommand(jwksCmd);
|
|
34561
34600
|
|
|
34562
|
-
// node_modules/.pnpm/@kevisual+cnb@0.0.
|
|
34601
|
+
// node_modules/.pnpm/@kevisual+cnb@0.0.37_dotenv@17.3.1_idb-keyval@6.2.2_ioredis@5.9.3/node_modules/@kevisual/cnb/dist/keep.js
|
|
34563
34602
|
import { createRequire as createRequire3 } from "node:module";
|
|
34564
34603
|
var __create3 = Object.create;
|
|
34565
34604
|
var __getProtoOf3 = Object.getPrototypeOf;
|
|
@@ -37660,6 +37699,76 @@ var workspaceCmd = new Command("workspace").alias("w").description("工作区liv
|
|
|
37660
37699
|
program.addCommand(workspaceCmd);
|
|
37661
37700
|
program.addCommand(cnbCmd);
|
|
37662
37701
|
|
|
37702
|
+
// src/command/download.ts
|
|
37703
|
+
import path18 from "path";
|
|
37704
|
+
import fs21 from "fs";
|
|
37705
|
+
var downloadCmd = new Command("download").description("下载项目").option("-l, --link <link>", "下载链接").option("-d, --directory <directory>", "下载目录", process.cwd()).action(async (opts) => {
|
|
37706
|
+
let link2 = opts.link || "";
|
|
37707
|
+
if (!link2) {
|
|
37708
|
+
console.log("请提供下载链接");
|
|
37709
|
+
return;
|
|
37710
|
+
}
|
|
37711
|
+
let url = new URL(link2);
|
|
37712
|
+
if (!url.pathname.endsWith("/")) {
|
|
37713
|
+
url.pathname += "/";
|
|
37714
|
+
}
|
|
37715
|
+
url.searchParams.set("recursive", "true");
|
|
37716
|
+
const directory = opts.directory || process.cwd();
|
|
37717
|
+
const token2 = await queryLogin.getToken();
|
|
37718
|
+
const res = await queryLogin.query.fetchText({
|
|
37719
|
+
url: url.toString(),
|
|
37720
|
+
method: "GET",
|
|
37721
|
+
headers: {
|
|
37722
|
+
Authorization: `Bearer ${token2}`
|
|
37723
|
+
}
|
|
37724
|
+
});
|
|
37725
|
+
if (res.code === 200 && res.data) {
|
|
37726
|
+
const files = res.data;
|
|
37727
|
+
console.log(`获取到 ${files.length} 个文件`);
|
|
37728
|
+
await downloadFiles(files, { directory });
|
|
37729
|
+
} else {
|
|
37730
|
+
console.log(chalk2.red("获取文件列表失败:"), res.message || "未知错误");
|
|
37731
|
+
}
|
|
37732
|
+
});
|
|
37733
|
+
program.addCommand(downloadCmd);
|
|
37734
|
+
var downloadFiles = async (files, opts) => {
|
|
37735
|
+
const directory = opts?.directory || process.cwd();
|
|
37736
|
+
let successCount = 0;
|
|
37737
|
+
let failCount = 0;
|
|
37738
|
+
for (const file of files) {
|
|
37739
|
+
try {
|
|
37740
|
+
const downloadPath = path18.join(directory, file.path);
|
|
37741
|
+
const dir = path18.dirname(downloadPath);
|
|
37742
|
+
if (!fs21.existsSync(dir)) {
|
|
37743
|
+
fs21.mkdirSync(dir, { recursive: true });
|
|
37744
|
+
}
|
|
37745
|
+
console.log(`下载中: ${file.name}`);
|
|
37746
|
+
const { blob, type } = await fetchLink(file.url);
|
|
37747
|
+
if (type.includes("text/html")) {
|
|
37748
|
+
const text = await blob.text();
|
|
37749
|
+
if (text === "fetchRes is error") {
|
|
37750
|
+
console.log(chalk2.red("下载失败:"), file.name);
|
|
37751
|
+
failCount++;
|
|
37752
|
+
continue;
|
|
37753
|
+
}
|
|
37754
|
+
}
|
|
37755
|
+
fs21.writeFileSync(downloadPath, Buffer.from(await blob.arrayBuffer()));
|
|
37756
|
+
successCount++;
|
|
37757
|
+
console.log(chalk2.green("下载成功:"), file.name);
|
|
37758
|
+
} catch (error) {
|
|
37759
|
+
failCount++;
|
|
37760
|
+
console.log(chalk2.red("下载失败:"), file.name, error);
|
|
37761
|
+
}
|
|
37762
|
+
}
|
|
37763
|
+
console.log(chalk2.blue("下载完成"));
|
|
37764
|
+
console.log(chalk2.green(`成功: ${successCount}`));
|
|
37765
|
+
console.log(chalk2.red(`失败: ${failCount}`));
|
|
37766
|
+
return {
|
|
37767
|
+
successCount,
|
|
37768
|
+
failCount
|
|
37769
|
+
};
|
|
37770
|
+
};
|
|
37771
|
+
|
|
37663
37772
|
// src/index.ts
|
|
37664
37773
|
var runParser = async (argv) => {
|
|
37665
37774
|
program.parse(argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "envision 命令行工具",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"basename": "/root/cli",
|
|
@@ -45,8 +45,9 @@
|
|
|
45
45
|
"@kevisual/app": "^0.0.2",
|
|
46
46
|
"@kevisual/auth": "^2.0.3",
|
|
47
47
|
"@kevisual/context": "^0.0.8",
|
|
48
|
+
"@kevisual/router": "^0.0.89",
|
|
48
49
|
"@kevisual/use-config": "^1.0.30",
|
|
49
|
-
"@opencode-ai/sdk": "^1.2.
|
|
50
|
+
"@opencode-ai/sdk": "^1.2.21",
|
|
50
51
|
"@types/busboy": "^1.5.4",
|
|
51
52
|
"busboy": "^1.6.0",
|
|
52
53
|
"eventemitter3": "^5.0.4",
|
|
@@ -54,22 +55,23 @@
|
|
|
54
55
|
"lowdb": "^7.0.1",
|
|
55
56
|
"lru-cache": "^11.2.6",
|
|
56
57
|
"micromatch": "^4.0.8",
|
|
58
|
+
"nanoid": "^5.1.6",
|
|
57
59
|
"pm2": "latest",
|
|
58
60
|
"semver": "^7.7.4",
|
|
59
61
|
"unstorage": "^1.17.4"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@kevisual/api": "^0.0.62",
|
|
63
|
-
"@kevisual/cnb": "^0.0.
|
|
65
|
+
"@kevisual/cnb": "^0.0.37",
|
|
64
66
|
"@kevisual/dts": "^0.0.4",
|
|
65
67
|
"@kevisual/load": "^0.0.6",
|
|
66
68
|
"@kevisual/logger": "^0.0.4",
|
|
67
|
-
"@kevisual/query": "0.0.
|
|
69
|
+
"@kevisual/query": "0.0.53",
|
|
68
70
|
"@types/bun": "^1.3.10",
|
|
69
71
|
"@types/crypto-js": "^4.2.2",
|
|
70
72
|
"@types/jsonwebtoken": "^9.0.10",
|
|
71
73
|
"@types/micromatch": "^4.0.10",
|
|
72
|
-
"@types/node": "^25.3.
|
|
74
|
+
"@types/node": "^25.3.5",
|
|
73
75
|
"@types/semver": "^7.7.1",
|
|
74
76
|
"chalk": "^5.6.2",
|
|
75
77
|
"commander": "^14.0.3",
|