@hoox-sh/hoox-cli 0.11.6 → 0.11.8
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/index.js +183 -87
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -21488,7 +21488,8 @@ var init_ui_store = __esm(() => {
|
|
|
21488
21488
|
sidebarExpanded: true,
|
|
21489
21489
|
modal: null,
|
|
21490
21490
|
commandPaletteOpen: false,
|
|
21491
|
-
previousView: null
|
|
21491
|
+
previousView: null,
|
|
21492
|
+
statusErrorExpanded: false
|
|
21492
21493
|
};
|
|
21493
21494
|
useUIStore = create()(immer2((set3) => ({
|
|
21494
21495
|
...initialState,
|
|
@@ -21519,6 +21520,12 @@ var init_ui_store = __esm(() => {
|
|
|
21519
21520
|
state.activeView = state.previousView;
|
|
21520
21521
|
state.previousView = null;
|
|
21521
21522
|
}
|
|
21523
|
+
}),
|
|
21524
|
+
toggleStatusErrorExpanded: () => set3((state) => {
|
|
21525
|
+
state.statusErrorExpanded = !state.statusErrorExpanded;
|
|
21526
|
+
}),
|
|
21527
|
+
setStatusErrorExpanded: (expanded) => set3((state) => {
|
|
21528
|
+
state.statusErrorExpanded = expanded;
|
|
21522
21529
|
})
|
|
21523
21530
|
})));
|
|
21524
21531
|
});
|
|
@@ -21535,13 +21542,28 @@ function ringPush(arr, item, max) {
|
|
|
21535
21542
|
const next = [...arr, item];
|
|
21536
21543
|
return next.length > max ? next.slice(next.length - max) : next;
|
|
21537
21544
|
}
|
|
21545
|
+
function clearReconnectTimer() {
|
|
21546
|
+
if (reconnectTimer !== null) {
|
|
21547
|
+
clearTimeout(reconnectTimer);
|
|
21548
|
+
reconnectTimer = null;
|
|
21549
|
+
}
|
|
21550
|
+
}
|
|
21551
|
+
function scheduleReconnect(delayMs) {
|
|
21552
|
+
clearReconnectTimer();
|
|
21553
|
+
if (delayMs < 0)
|
|
21554
|
+
return;
|
|
21555
|
+
reconnectTimer = setTimeout(() => {
|
|
21556
|
+
reconnectTimer = null;
|
|
21557
|
+
scheduledReconnectTick();
|
|
21558
|
+
}, delayMs);
|
|
21559
|
+
}
|
|
21538
21560
|
function getBackoffDelay(retryCount) {
|
|
21539
21561
|
if (retryCount <= 0)
|
|
21540
21562
|
return 0;
|
|
21541
21563
|
const index = Math.min(retryCount - 1, BACKOFF_SEQUENCE.length - 1);
|
|
21542
21564
|
return BACKOFF_SEQUENCE[index];
|
|
21543
21565
|
}
|
|
21544
|
-
var BACKOFF_SEQUENCE, MAX_RETRIES2 = 5, tradeStreamAbort = null, logStreamAbort = null, fetchWorkersGeneration = 0, MAX_TRADES = 500, MAX_ALERTS = 100, MAX_LOGS = 1000, initialState2, useServiceStore;
|
|
21566
|
+
var BACKOFF_SEQUENCE, MAX_RETRIES2 = 5, tradeStreamAbort = null, logStreamAbort = null, fetchWorkersGeneration = 0, reconnectTimer = null, scheduledReconnectTick = async () => {}, MAX_TRADES = 500, MAX_ALERTS = 100, MAX_LOGS = 1000, initialState2, useServiceStore;
|
|
21545
21567
|
var init_service_store = __esm(() => {
|
|
21546
21568
|
init_esm();
|
|
21547
21569
|
init_immer2();
|
|
@@ -21571,6 +21593,7 @@ var init_service_store = __esm(() => {
|
|
|
21571
21593
|
const data = await hooxFetch2("/v1/workers");
|
|
21572
21594
|
if (gen !== fetchWorkersGeneration)
|
|
21573
21595
|
return;
|
|
21596
|
+
clearReconnectTimer();
|
|
21574
21597
|
set3((state) => {
|
|
21575
21598
|
state.workers = data;
|
|
21576
21599
|
state.lastUpdated = Date.now();
|
|
@@ -21596,6 +21619,7 @@ var init_service_store = __esm(() => {
|
|
|
21596
21619
|
timestamp: Date.now(),
|
|
21597
21620
|
acknowledged: false
|
|
21598
21621
|
});
|
|
21622
|
+
let nextDelay = 0;
|
|
21599
21623
|
set3((state) => {
|
|
21600
21624
|
state.lastError = msg;
|
|
21601
21625
|
state.disconnectedAt = state.disconnectedAt ?? Date.now();
|
|
@@ -21604,21 +21628,26 @@ var init_service_store = __esm(() => {
|
|
|
21604
21628
|
state.retryCount = state.retryCount + 1;
|
|
21605
21629
|
if (state.retryCount >= MAX_RETRIES2) {
|
|
21606
21630
|
state.connectionStatus = "offline";
|
|
21607
|
-
state.lastError =
|
|
21631
|
+
state.lastError = `${msg} (gave up after ${MAX_RETRIES2} retries)`;
|
|
21632
|
+
state.reconnectDelay = 0;
|
|
21608
21633
|
} else {
|
|
21609
21634
|
state.reconnectDelay = getBackoffDelay(state.retryCount);
|
|
21635
|
+
nextDelay = state.reconnectDelay;
|
|
21610
21636
|
}
|
|
21611
21637
|
} else if (state.connectionStatus === "reconnecting") {
|
|
21612
21638
|
state.retryCount = state.retryCount + 1;
|
|
21613
21639
|
if (state.retryCount >= MAX_RETRIES2) {
|
|
21614
21640
|
state.connectionStatus = "offline";
|
|
21615
|
-
state.lastError =
|
|
21641
|
+
state.lastError = `${msg} (gave up after ${MAX_RETRIES2} retries)`;
|
|
21616
21642
|
state.reconnectDelay = 0;
|
|
21617
21643
|
} else {
|
|
21618
21644
|
state.reconnectDelay = getBackoffDelay(state.retryCount);
|
|
21645
|
+
nextDelay = state.reconnectDelay;
|
|
21619
21646
|
}
|
|
21620
21647
|
}
|
|
21621
21648
|
});
|
|
21649
|
+
if (nextDelay > 0)
|
|
21650
|
+
scheduleReconnect(nextDelay);
|
|
21622
21651
|
}
|
|
21623
21652
|
},
|
|
21624
21653
|
streamTrades: async () => {
|
|
@@ -21680,6 +21709,17 @@ var init_service_store = __esm(() => {
|
|
|
21680
21709
|
const merged = [...state.alerts, ...alerts];
|
|
21681
21710
|
state.alerts = merged.length > MAX_ALERTS ? merged.slice(merged.length - MAX_ALERTS) : merged;
|
|
21682
21711
|
}),
|
|
21712
|
+
acknowledgeAlert: (id) => set3((state) => {
|
|
21713
|
+
const hit = state.alerts.find((a) => a.id === id);
|
|
21714
|
+
if (hit)
|
|
21715
|
+
hit.acknowledged = true;
|
|
21716
|
+
}),
|
|
21717
|
+
dismissAlert: (id) => set3((state) => {
|
|
21718
|
+
state.alerts = state.alerts.filter((a) => a.id !== id);
|
|
21719
|
+
}),
|
|
21720
|
+
clearLogs: () => set3((state) => {
|
|
21721
|
+
state.logs = [];
|
|
21722
|
+
}),
|
|
21683
21723
|
setConnectionStatus: (status) => set3((state) => {
|
|
21684
21724
|
if (status === "connected") {
|
|
21685
21725
|
state.retryCount = 0;
|
|
@@ -21710,49 +21750,69 @@ var init_service_store = __esm(() => {
|
|
|
21710
21750
|
state.metrics = metrics;
|
|
21711
21751
|
state.lastUpdated = metrics.lastUpdated;
|
|
21712
21752
|
}),
|
|
21713
|
-
handleConnectionSuccess: () =>
|
|
21714
|
-
|
|
21715
|
-
state
|
|
21716
|
-
|
|
21717
|
-
|
|
21718
|
-
|
|
21719
|
-
|
|
21720
|
-
|
|
21721
|
-
|
|
21722
|
-
|
|
21723
|
-
|
|
21724
|
-
|
|
21725
|
-
|
|
21726
|
-
|
|
21727
|
-
|
|
21728
|
-
state.
|
|
21729
|
-
|
|
21730
|
-
state.
|
|
21731
|
-
|
|
21732
|
-
state.
|
|
21733
|
-
state.
|
|
21734
|
-
state.reconnectDelay
|
|
21735
|
-
} else {
|
|
21736
|
-
state.
|
|
21753
|
+
handleConnectionSuccess: () => {
|
|
21754
|
+
clearReconnectTimer();
|
|
21755
|
+
set3((state) => {
|
|
21756
|
+
state.lastSuccessfulFetch = Date.now();
|
|
21757
|
+
state.retryCount = 0;
|
|
21758
|
+
state.lastError = null;
|
|
21759
|
+
state.lastErrorDetails = null;
|
|
21760
|
+
state.reconnectDelay = 0;
|
|
21761
|
+
state.disconnectedAt = null;
|
|
21762
|
+
state.connectionStatus = "connected";
|
|
21763
|
+
});
|
|
21764
|
+
},
|
|
21765
|
+
handleConnectionFailure: (errorMessage) => {
|
|
21766
|
+
let nextDelay = 0;
|
|
21767
|
+
set3((state) => {
|
|
21768
|
+
state.lastError = errorMessage;
|
|
21769
|
+
state.disconnectedAt = state.disconnectedAt ?? Date.now();
|
|
21770
|
+
if (state.connectionStatus === "connected" || state.connectionStatus === "polling") {
|
|
21771
|
+
state.connectionStatus = "reconnecting";
|
|
21772
|
+
state.retryCount = 1;
|
|
21773
|
+
state.reconnectDelay = getBackoffDelay(1);
|
|
21774
|
+
nextDelay = state.reconnectDelay;
|
|
21775
|
+
} else if (state.connectionStatus === "reconnecting") {
|
|
21776
|
+
state.retryCount = state.retryCount + 1;
|
|
21777
|
+
if (state.retryCount >= MAX_RETRIES2) {
|
|
21778
|
+
state.connectionStatus = "offline";
|
|
21779
|
+
state.lastError = `${errorMessage} (gave up after ${MAX_RETRIES2} retries)`;
|
|
21780
|
+
state.reconnectDelay = 0;
|
|
21781
|
+
} else {
|
|
21782
|
+
state.reconnectDelay = getBackoffDelay(state.retryCount);
|
|
21783
|
+
nextDelay = state.reconnectDelay;
|
|
21784
|
+
}
|
|
21737
21785
|
}
|
|
21738
|
-
}
|
|
21739
|
-
|
|
21740
|
-
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
state
|
|
21745
|
-
state.disconnectedAt = null;
|
|
21746
|
-
}),
|
|
21747
|
-
forceRetry: () => set3((state) => {
|
|
21748
|
-
if (state.connectionStatus === "offline") {
|
|
21749
|
-
state.connectionStatus = "polling";
|
|
21786
|
+
});
|
|
21787
|
+
if (nextDelay > 0)
|
|
21788
|
+
scheduleReconnect(nextDelay);
|
|
21789
|
+
},
|
|
21790
|
+
resetRetries: () => {
|
|
21791
|
+
clearReconnectTimer();
|
|
21792
|
+
set3((state) => {
|
|
21750
21793
|
state.retryCount = 0;
|
|
21751
21794
|
state.lastError = null;
|
|
21752
21795
|
state.lastErrorDetails = null;
|
|
21753
21796
|
state.reconnectDelay = 0;
|
|
21797
|
+
state.disconnectedAt = null;
|
|
21798
|
+
});
|
|
21799
|
+
},
|
|
21800
|
+
forceRetry: () => {
|
|
21801
|
+
clearReconnectTimer();
|
|
21802
|
+
const wasOffline = get2().connectionStatus === "offline";
|
|
21803
|
+
set3((state) => {
|
|
21804
|
+
if (state.connectionStatus === "offline") {
|
|
21805
|
+
state.connectionStatus = "polling";
|
|
21806
|
+
state.retryCount = 0;
|
|
21807
|
+
state.lastError = null;
|
|
21808
|
+
state.lastErrorDetails = null;
|
|
21809
|
+
state.reconnectDelay = 0;
|
|
21810
|
+
}
|
|
21811
|
+
});
|
|
21812
|
+
if (wasOffline) {
|
|
21813
|
+
scheduleReconnect(0);
|
|
21754
21814
|
}
|
|
21755
|
-
}
|
|
21815
|
+
},
|
|
21756
21816
|
setLastErrorDetails: (details) => set3((state) => {
|
|
21757
21817
|
state.lastErrorDetails = details;
|
|
21758
21818
|
state.lastError = details === null ? null : summarizeCliError(details);
|
|
@@ -21775,6 +21835,12 @@ var init_service_store = __esm(() => {
|
|
|
21775
21835
|
}, MAX_ALERTS);
|
|
21776
21836
|
})
|
|
21777
21837
|
})));
|
|
21838
|
+
scheduledReconnectTick = async () => {
|
|
21839
|
+
const status = useServiceStore.getState().connectionStatus;
|
|
21840
|
+
if (status === "reconnecting" || status === "polling") {
|
|
21841
|
+
await useServiceStore.getState().fetchWorkers();
|
|
21842
|
+
}
|
|
21843
|
+
};
|
|
21778
21844
|
});
|
|
21779
21845
|
|
|
21780
21846
|
// ../../node_modules/.bun/zustand@5.0.14+158594928fb811b4/node_modules/zustand/esm/middleware.mjs
|
|
@@ -21961,36 +22027,66 @@ var init_middleware = __esm(() => {
|
|
|
21961
22027
|
});
|
|
21962
22028
|
|
|
21963
22029
|
// ../shared/src/stores/config-store.ts
|
|
21964
|
-
import { chmodSync as chmodSync3, mkdirSync as mkdirSync3, existsSync as existsSync4 } from "fs";
|
|
21965
|
-
import { homedir as homedir3 } from "os";
|
|
22030
|
+
import { chmodSync as chmodSync3, mkdirSync as mkdirSync3, existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
|
|
21966
22031
|
import { join as join4 } from "path";
|
|
22032
|
+
function getTuiPreferencesPath() {
|
|
22033
|
+
return join4(getHooxHome(), ".tui-state", "preferences.json");
|
|
22034
|
+
}
|
|
22035
|
+
function getLegacyConfigJsonPath() {
|
|
22036
|
+
return join4(getHooxHome(), "config.json");
|
|
22037
|
+
}
|
|
22038
|
+
function extractZustandPrefsPayload(raw) {
|
|
22039
|
+
try {
|
|
22040
|
+
const parsed = JSON.parse(raw);
|
|
22041
|
+
if (parsed && typeof parsed === "object" && parsed.state && typeof parsed.state === "object" && !Array.isArray(parsed.state) && (("theme" in parsed.state) || ("refreshIntervalMs" in parsed.state)) && !("apiToken" in parsed)) {
|
|
22042
|
+
return raw;
|
|
22043
|
+
}
|
|
22044
|
+
} catch {}
|
|
22045
|
+
return null;
|
|
22046
|
+
}
|
|
21967
22047
|
var bunConfigStorage, DEFAULT_SHORTCUTS, DEFAULT_LOG_FILTER, DEFAULT_NOTIFICATIONS, defaults, useConfigStore;
|
|
21968
22048
|
var init_config_store = __esm(() => {
|
|
21969
22049
|
init_esm();
|
|
21970
22050
|
init_immer2();
|
|
21971
22051
|
init_middleware();
|
|
21972
22052
|
init_config();
|
|
22053
|
+
init_path_utils();
|
|
21973
22054
|
bunConfigStorage = {
|
|
21974
22055
|
getItem: async (_name) => {
|
|
21975
22056
|
try {
|
|
21976
|
-
const
|
|
21977
|
-
const
|
|
21978
|
-
if (
|
|
21979
|
-
return
|
|
21980
|
-
|
|
22057
|
+
const prefsPath = getTuiPreferencesPath();
|
|
22058
|
+
const prefsFile = Bun.file(prefsPath);
|
|
22059
|
+
if (await prefsFile.exists()) {
|
|
22060
|
+
return await prefsFile.text();
|
|
22061
|
+
}
|
|
22062
|
+
const legacyPath = getLegacyConfigJsonPath();
|
|
22063
|
+
if (existsSync4(legacyPath)) {
|
|
22064
|
+
const legacyRaw = readFileSync4(legacyPath, "utf-8");
|
|
22065
|
+
const envelope = extractZustandPrefsPayload(legacyRaw);
|
|
22066
|
+
if (envelope) {
|
|
22067
|
+
await bunConfigStorage.setItem(_name, envelope);
|
|
22068
|
+
return envelope;
|
|
22069
|
+
}
|
|
22070
|
+
}
|
|
22071
|
+
return null;
|
|
21981
22072
|
} catch {
|
|
21982
22073
|
return null;
|
|
21983
22074
|
}
|
|
21984
22075
|
},
|
|
21985
22076
|
setItem: async (_name, value) => {
|
|
21986
|
-
const
|
|
21987
|
-
|
|
21988
|
-
|
|
22077
|
+
const home = getHooxHome();
|
|
22078
|
+
const stateDir = join4(home, ".tui-state");
|
|
22079
|
+
if (!existsSync4(home)) {
|
|
22080
|
+
mkdirSync3(home, { recursive: true, mode: HOOX_DIR_MODE });
|
|
22081
|
+
}
|
|
22082
|
+
if (!existsSync4(stateDir)) {
|
|
22083
|
+
mkdirSync3(stateDir, { recursive: true, mode: HOOX_DIR_MODE });
|
|
21989
22084
|
}
|
|
21990
22085
|
try {
|
|
21991
|
-
chmodSync3(
|
|
22086
|
+
chmodSync3(home, HOOX_DIR_MODE);
|
|
22087
|
+
chmodSync3(stateDir, HOOX_DIR_MODE);
|
|
21992
22088
|
} catch {}
|
|
21993
|
-
const filePath =
|
|
22089
|
+
const filePath = getTuiPreferencesPath();
|
|
21994
22090
|
await Bun.write(filePath, value);
|
|
21995
22091
|
try {
|
|
21996
22092
|
chmodSync3(filePath, HOOX_CONFIG_FILE_MODE);
|
|
@@ -22065,7 +22161,7 @@ var init_config_store = __esm(() => {
|
|
|
22065
22161
|
state.notifications[channel] = !state.notifications[channel];
|
|
22066
22162
|
})
|
|
22067
22163
|
})), {
|
|
22068
|
-
name: "hoox-
|
|
22164
|
+
name: "hoox-tui-prefs",
|
|
22069
22165
|
storage: createJSONStorage(() => bunConfigStorage),
|
|
22070
22166
|
partialize: (state) => ({
|
|
22071
22167
|
theme: state.theme,
|
|
@@ -26238,7 +26334,7 @@ var exports_schema_service = {};
|
|
|
26238
26334
|
__export(exports_schema_service, {
|
|
26239
26335
|
SchemaService: () => SchemaService
|
|
26240
26336
|
});
|
|
26241
|
-
import { readFileSync as
|
|
26337
|
+
import { readFileSync as readFileSync7, existsSync as existsSync11 } from "fs";
|
|
26242
26338
|
import { resolve as resolve4 } from "path";
|
|
26243
26339
|
|
|
26244
26340
|
class SchemaService {
|
|
@@ -26274,7 +26370,7 @@ class SchemaService {
|
|
|
26274
26370
|
const errors4 = [];
|
|
26275
26371
|
const isHooxProject = existsSync11(resolve4(this.projectRoot, "wrangler.jsonc")) || existsSync11(resolve4(this.projectRoot, "workers"));
|
|
26276
26372
|
try {
|
|
26277
|
-
const wranglerContent =
|
|
26373
|
+
const wranglerContent = readFileSync7(workerWranglerPath, "utf-8");
|
|
26278
26374
|
errors4.push(...validateWranglerJsonc(name, manifest, wranglerContent));
|
|
26279
26375
|
} catch (e) {
|
|
26280
26376
|
const isErrnoException = e instanceof Error && "code" in e;
|
|
@@ -26288,7 +26384,7 @@ class SchemaService {
|
|
|
26288
26384
|
});
|
|
26289
26385
|
}
|
|
26290
26386
|
try {
|
|
26291
|
-
const rootContent =
|
|
26387
|
+
const rootContent = readFileSync7(rootWranglerPath, "utf-8");
|
|
26292
26388
|
errors4.push(...validateRootSecrets(name, manifest, rootContent));
|
|
26293
26389
|
} catch (e) {
|
|
26294
26390
|
const errMessage = e instanceof Error ? e.message : String(e);
|
|
@@ -26299,7 +26395,7 @@ class SchemaService {
|
|
|
26299
26395
|
});
|
|
26300
26396
|
}
|
|
26301
26397
|
try {
|
|
26302
|
-
const devVarsContent =
|
|
26398
|
+
const devVarsContent = readFileSync7(devVarsPath, "utf-8");
|
|
26303
26399
|
errors4.push(...validateDevVars(name, manifest, devVarsContent));
|
|
26304
26400
|
} catch (e) {
|
|
26305
26401
|
const errMessage = e instanceof Error ? e.message : String(e);
|
|
@@ -26558,7 +26654,7 @@ var init_trace_service = __esm(() => {
|
|
|
26558
26654
|
});
|
|
26559
26655
|
|
|
26560
26656
|
// src/index.ts
|
|
26561
|
-
import { readFileSync as
|
|
26657
|
+
import { readFileSync as readFileSync12 } from "fs";
|
|
26562
26658
|
|
|
26563
26659
|
// ../../node_modules/.bun/commander@15.0.0/node_modules/commander/lib/error.js
|
|
26564
26660
|
class CommanderError extends Error {
|
|
@@ -29692,11 +29788,11 @@ import {
|
|
|
29692
29788
|
existsSync as existsSync7,
|
|
29693
29789
|
mkdirSync as mkdirSync5,
|
|
29694
29790
|
readdirSync as readdirSync3,
|
|
29695
|
-
readFileSync as
|
|
29791
|
+
readFileSync as readFileSync5,
|
|
29696
29792
|
statSync as statSync2,
|
|
29697
29793
|
writeFileSync as writeFileSync3
|
|
29698
29794
|
} from "fs";
|
|
29699
|
-
import { homedir as
|
|
29795
|
+
import { homedir as homedir3 } from "os";
|
|
29700
29796
|
import { join as join7 } from "path";
|
|
29701
29797
|
var ALL_WORKERS = [
|
|
29702
29798
|
"d1-worker",
|
|
@@ -29775,7 +29871,7 @@ function loadExistingKeysFromDisk() {
|
|
|
29775
29871
|
return null;
|
|
29776
29872
|
let text2;
|
|
29777
29873
|
try {
|
|
29778
|
-
text2 =
|
|
29874
|
+
text2 = readFileSync5(setupEnv, "utf-8");
|
|
29779
29875
|
} catch {
|
|
29780
29876
|
return null;
|
|
29781
29877
|
}
|
|
@@ -29865,7 +29961,7 @@ class SetupService {
|
|
|
29865
29961
|
const path4 = `workers/${workerFsDir(worker)}/.dev.vars`;
|
|
29866
29962
|
const meshNames = secretNames;
|
|
29867
29963
|
const meshSet = new Set(meshNames);
|
|
29868
|
-
const existing = existsSync7(path4) ? parseEnvFile(
|
|
29964
|
+
const existing = existsSync7(path4) ? parseEnvFile(readFileSync5(path4, "utf-8")) : new Map;
|
|
29869
29965
|
for (const secretName of meshNames) {
|
|
29870
29966
|
existing.set(secretName, keys[secretName]);
|
|
29871
29967
|
}
|
|
@@ -30025,7 +30121,7 @@ class SetupService {
|
|
|
30025
30121
|
const wranglerPath = join7("workers", workerFsDir(worker), "wrangler.jsonc");
|
|
30026
30122
|
let wranglerContent;
|
|
30027
30123
|
try {
|
|
30028
|
-
wranglerContent =
|
|
30124
|
+
wranglerContent = readFileSync5(wranglerPath, "utf-8");
|
|
30029
30125
|
} catch {
|
|
30030
30126
|
return { ok: false, error: errMsg };
|
|
30031
30127
|
}
|
|
@@ -30162,7 +30258,7 @@ class SetupService {
|
|
|
30162
30258
|
}
|
|
30163
30259
|
const fallbacks = [
|
|
30164
30260
|
"/usr/local/bin/wrangler",
|
|
30165
|
-
join7(
|
|
30261
|
+
join7(homedir3(), ".bun", "bin", "wrangler")
|
|
30166
30262
|
];
|
|
30167
30263
|
for (const fb of fallbacks) {
|
|
30168
30264
|
try {
|
|
@@ -30226,7 +30322,7 @@ class SetupService {
|
|
|
30226
30322
|
for (const name of workerDirs) {
|
|
30227
30323
|
const dir = `workers/${workerFsDir(name)}`;
|
|
30228
30324
|
try {
|
|
30229
|
-
const gitEntry =
|
|
30325
|
+
const gitEntry = readFileSync5(join7(dir, ".git"), "utf-8").trim();
|
|
30230
30326
|
if (gitEntry.startsWith("gitdir:") || gitEntry.length > 0) {
|
|
30231
30327
|
if (!this.isWorkerTreePopulated(dir, name))
|
|
30232
30328
|
missing.push(name);
|
|
@@ -30375,7 +30471,7 @@ class SetupService {
|
|
|
30375
30471
|
const wranglerPath = `workers/${workerFsDir(worker)}/wrangler.jsonc`;
|
|
30376
30472
|
let content;
|
|
30377
30473
|
try {
|
|
30378
|
-
content =
|
|
30474
|
+
content = readFileSync5(wranglerPath, "utf-8");
|
|
30379
30475
|
} catch {
|
|
30380
30476
|
continue;
|
|
30381
30477
|
}
|
|
@@ -30562,7 +30658,7 @@ class SetupService {
|
|
|
30562
30658
|
const devVarsPath = `workers/${workerFsDir(worker)}/.dev.vars`;
|
|
30563
30659
|
let devVarsContent;
|
|
30564
30660
|
try {
|
|
30565
|
-
devVarsContent =
|
|
30661
|
+
devVarsContent = readFileSync5(devVarsPath, "utf-8");
|
|
30566
30662
|
} catch {
|
|
30567
30663
|
missing.push(`${worker}:.dev.vars (missing file)`);
|
|
30568
30664
|
continue;
|
|
@@ -31367,7 +31463,7 @@ init_errors4();
|
|
|
31367
31463
|
import {
|
|
31368
31464
|
statSync as statSync3,
|
|
31369
31465
|
existsSync as existsSync8,
|
|
31370
|
-
readFileSync as
|
|
31466
|
+
readFileSync as readFileSync6,
|
|
31371
31467
|
writeFileSync as writeFileSync4,
|
|
31372
31468
|
renameSync
|
|
31373
31469
|
} from "fs";
|
|
@@ -32149,7 +32245,7 @@ async function doUpdateInternalUrls(fmt) {
|
|
|
32149
32245
|
process.exitCode = 1 /* ERROR */;
|
|
32150
32246
|
return;
|
|
32151
32247
|
}
|
|
32152
|
-
const content =
|
|
32248
|
+
const content = readFileSync6(filePath, "utf-8");
|
|
32153
32249
|
const errors4 = [];
|
|
32154
32250
|
const parsed = parse6(content, errors4);
|
|
32155
32251
|
if (errors4.length > 0) {
|
|
@@ -32175,7 +32271,7 @@ async function doUpdateInternalUrls(fmt) {
|
|
|
32175
32271
|
formatSuccess("All service URLs already up to date.", fmt);
|
|
32176
32272
|
return;
|
|
32177
32273
|
}
|
|
32178
|
-
const fresh =
|
|
32274
|
+
const fresh = readFileSync6(filePath, "utf-8");
|
|
32179
32275
|
const edits = modify(fresh, ["vars"], vars, {
|
|
32180
32276
|
formattingOptions: { tabSize: 2, insertSpaces: true }
|
|
32181
32277
|
});
|
|
@@ -37819,13 +37915,13 @@ import { createRequire } from "module";
|
|
|
37819
37915
|
import { resolve as resolve6, dirname as dirname3, join as join10 } from "path";
|
|
37820
37916
|
import { fileURLToPath } from "url";
|
|
37821
37917
|
import { existsSync as existsSync12, realpathSync } from "fs";
|
|
37822
|
-
import { homedir as
|
|
37918
|
+
import { homedir as homedir4 } from "os";
|
|
37823
37919
|
|
|
37824
37920
|
// src/services/perf/endpoint-resolver.ts
|
|
37825
|
-
import { readFileSync as
|
|
37921
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
37826
37922
|
function readSubdomainPrefix() {
|
|
37827
37923
|
try {
|
|
37828
|
-
const raw =
|
|
37924
|
+
const raw = readFileSync8("wrangler.jsonc", "utf8");
|
|
37829
37925
|
const stripped = raw.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
|
|
37830
37926
|
const parsed = JSON.parse(stripped);
|
|
37831
37927
|
const prefix = parsed.global?.subdomain_prefix;
|
|
@@ -37872,7 +37968,7 @@ function collectTuiCandidates() {
|
|
|
37872
37968
|
const cwdRequire = createRequire(join10(process.cwd(), "package.json"));
|
|
37873
37969
|
pushPackageEntries(candidates, cwdRequire);
|
|
37874
37970
|
} catch {}
|
|
37875
|
-
const bunGlobal = join10(
|
|
37971
|
+
const bunGlobal = join10(homedir4(), ".bun", "install", "global", "node_modules", TUI_PKG);
|
|
37876
37972
|
pushPackageRootEntries(candidates, bunGlobal);
|
|
37877
37973
|
const npmGlobal = process.env.npm_config_prefix?.trim();
|
|
37878
37974
|
if (npmGlobal) {
|
|
@@ -38125,7 +38221,7 @@ TUI exited with code ${code}
|
|
|
38125
38221
|
init_dist4();
|
|
38126
38222
|
init_src();
|
|
38127
38223
|
import { join as join12 } from "path";
|
|
38128
|
-
import { homedir as
|
|
38224
|
+
import { homedir as homedir5 } from "os";
|
|
38129
38225
|
|
|
38130
38226
|
// src/services/runtime/runtime-service.ts
|
|
38131
38227
|
init_src();
|
|
@@ -38606,7 +38702,7 @@ Hoox doctor
|
|
|
38606
38702
|
return failed === 0 ? 0 /* SUCCESS */ : 1 /* ERROR */;
|
|
38607
38703
|
}
|
|
38608
38704
|
function printSecurityHygieneSection(env = process.env) {
|
|
38609
|
-
const configPath = join12(
|
|
38705
|
+
const configPath = join12(homedir5(), ".hoox", "config.json");
|
|
38610
38706
|
const lines = collectSecurityHygiene(env, { configPath });
|
|
38611
38707
|
process.stdout.write(theme.heading(`Security hygiene
|
|
38612
38708
|
`));
|
|
@@ -38624,7 +38720,7 @@ async function runSecurityDoctor(options) {
|
|
|
38624
38720
|
env.HOOX_API_URL = options.apiUrl;
|
|
38625
38721
|
}
|
|
38626
38722
|
const profile = resolveOperatorTransportProfile(env);
|
|
38627
|
-
const configPath = join12(
|
|
38723
|
+
const configPath = join12(homedir5(), ".hoox", "config.json");
|
|
38628
38724
|
const hygiene = collectSecurityHygiene(env, { configPath });
|
|
38629
38725
|
const isLocal = profile.apiBase.includes("localhost") || profile.apiBase.includes("127.0.0.1");
|
|
38630
38726
|
const shouldProbe = options.probe === true || options.probe !== false && !isLocal;
|
|
@@ -38869,7 +38965,7 @@ function registerDisclaimerCommand(program2) {
|
|
|
38869
38965
|
}));
|
|
38870
38966
|
}
|
|
38871
38967
|
// src/commands/agent/agent-command.ts
|
|
38872
|
-
import { readFileSync as
|
|
38968
|
+
import { readFileSync as readFileSync9 } from "fs";
|
|
38873
38969
|
init_errors4();
|
|
38874
38970
|
var PROVIDERS = [
|
|
38875
38971
|
{
|
|
@@ -38903,7 +38999,7 @@ function checkDevVars() {
|
|
|
38903
38999
|
const candidates = ["workers/agent-worker/.dev.vars", ".dev.vars"];
|
|
38904
39000
|
for (const filePath of candidates) {
|
|
38905
39001
|
try {
|
|
38906
|
-
const content =
|
|
39002
|
+
const content = readFileSync9(filePath, "utf-8");
|
|
38907
39003
|
for (const line of content.split(`
|
|
38908
39004
|
`)) {
|
|
38909
39005
|
const trimmed = line.trim();
|
|
@@ -39434,7 +39530,7 @@ EXAMPLES:
|
|
|
39434
39530
|
}
|
|
39435
39531
|
// src/commands/pyne/pyne-command.ts
|
|
39436
39532
|
init_config2();
|
|
39437
|
-
import { existsSync as existsSync14, readFileSync as
|
|
39533
|
+
import { existsSync as existsSync14, readFileSync as readFileSync10 } from "fs";
|
|
39438
39534
|
import { resolve as resolve8 } from "path";
|
|
39439
39535
|
init_errors4();
|
|
39440
39536
|
var DEFAULT_TIMEOUT_MS = 30000;
|
|
@@ -39460,7 +39556,7 @@ function loadDevVars(workerDir) {
|
|
|
39460
39556
|
try {
|
|
39461
39557
|
if (!existsSync14(filePath))
|
|
39462
39558
|
continue;
|
|
39463
|
-
const content =
|
|
39559
|
+
const content = readFileSync10(filePath, "utf-8");
|
|
39464
39560
|
for (const line of content.split(`
|
|
39465
39561
|
`)) {
|
|
39466
39562
|
const trimmed = line.trim();
|
|
@@ -39679,7 +39775,7 @@ EXAMPLES:
|
|
|
39679
39775
|
if (!existsSync14(abs)) {
|
|
39680
39776
|
throw new CLIError(`Script not found: ${abs}`, 1 /* ERROR */);
|
|
39681
39777
|
}
|
|
39682
|
-
body.script =
|
|
39778
|
+
body.script = readFileSync10(abs, "utf-8");
|
|
39683
39779
|
}
|
|
39684
39780
|
const res = await pyneFetch(baseUrl, "/run", {
|
|
39685
39781
|
method: "POST",
|
|
@@ -39730,7 +39826,7 @@ EXAMPLES:
|
|
|
39730
39826
|
if (!existsSync14(abs)) {
|
|
39731
39827
|
throw new CLIError(`Script not found: ${abs}`, 1 /* ERROR */);
|
|
39732
39828
|
}
|
|
39733
|
-
const script =
|
|
39829
|
+
const script = readFileSync10(abs, "utf-8");
|
|
39734
39830
|
const baseName = abs.split(/[/\\]/).pop() ?? "script.pine";
|
|
39735
39831
|
const scriptId = opts.id ?? baseName.replace(/\.pine$/i, "").replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
39736
39832
|
const res = await pyneFetch(baseUrl, "/scripts", {
|
|
@@ -41393,7 +41489,7 @@ function registerCompletionCommand(program2) {
|
|
|
41393
41489
|
// src/ui/banner.ts
|
|
41394
41490
|
init_ansis();
|
|
41395
41491
|
init_theme();
|
|
41396
|
-
import { existsSync as existsSync15, readFileSync as
|
|
41492
|
+
import { existsSync as existsSync15, readFileSync as readFileSync11 } from "fs";
|
|
41397
41493
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
41398
41494
|
import { dirname as dirname4, join as join13 } from "path";
|
|
41399
41495
|
var ORANGE = ansis_default.hex("#ff7f2a");
|
|
@@ -41411,7 +41507,7 @@ function findCliVersion() {
|
|
|
41411
41507
|
const pkgPath = join13(dir, "package.json");
|
|
41412
41508
|
if (existsSync15(pkgPath)) {
|
|
41413
41509
|
try {
|
|
41414
|
-
const pkg = JSON.parse(
|
|
41510
|
+
const pkg = JSON.parse(readFileSync11(pkgPath, "utf-8"));
|
|
41415
41511
|
if (pkg.name === PKG_NAME)
|
|
41416
41512
|
return pkg.version;
|
|
41417
41513
|
} catch {}
|
|
@@ -42046,7 +42142,7 @@ if (typeof Bun === "undefined") {
|
|
|
42046
42142
|
`);
|
|
42047
42143
|
process.exit(1);
|
|
42048
42144
|
}
|
|
42049
|
-
var pkgVersion = JSON.parse(
|
|
42145
|
+
var pkgVersion = JSON.parse(readFileSync12(new URL("../package.json", import.meta.url), "utf-8")).version;
|
|
42050
42146
|
var program2 = new Command;
|
|
42051
42147
|
program2.name("hoox").description("Hoox CLI \u2014 manage Cloudflare Workers, infrastructure, secrets, and deployments").version(`${pkgVersion}
|
|
42052
42148
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hoox-sh/hoox-cli",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.8",
|
|
4
4
|
"description": "Hoox CLI — manage Cloudflare Workers, infrastructure, secrets, and deployments (@hoox-sh/hoox-cli)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@hoox-sh/hoox-tui": "workspace:*"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@hoox-sh/hoox-shared": "^1.
|
|
29
|
+
"@hoox-sh/hoox-shared": "^1.3.0",
|
|
30
30
|
"@types/node": "^26.1.1",
|
|
31
31
|
"bun-types": "^1.3.14",
|
|
32
32
|
"typescript": "^6.0.3"
|