shellx-cli 0.0.7 → 0.0.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/bundle/shellx.js +114 -39
- package/package.json +1 -1
package/bundle/shellx.js
CHANGED
|
@@ -138006,8 +138006,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
138006
138006
|
var init_git_commit = __esm({
|
|
138007
138007
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
138008
138008
|
"use strict";
|
|
138009
|
-
GIT_COMMIT_INFO = "
|
|
138010
|
-
CLI_VERSION = "0.0.
|
|
138009
|
+
GIT_COMMIT_INFO = "979a427a";
|
|
138010
|
+
CLI_VERSION = "0.0.8";
|
|
138011
138011
|
}
|
|
138012
138012
|
});
|
|
138013
138013
|
|
|
@@ -150655,7 +150655,7 @@ function createContentGeneratorConfig(config, authType) {
|
|
|
150655
150655
|
return contentGeneratorConfig;
|
|
150656
150656
|
}
|
|
150657
150657
|
async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
150658
|
-
const version2 = "0.0.
|
|
150658
|
+
const version2 = "0.0.8";
|
|
150659
150659
|
const userAgent2 = `GeminiCLI/${version2} (${process.platform}; ${process.arch})`;
|
|
150660
150660
|
const baseHeaders = {
|
|
150661
150661
|
"User-Agent": userAgent2
|
|
@@ -236819,13 +236819,53 @@ async function ensureInstallDir() {
|
|
|
236819
236819
|
await fs32.promises.mkdir(SHELLX_BIN_DIR, { recursive: true });
|
|
236820
236820
|
}
|
|
236821
236821
|
}
|
|
236822
|
+
async function copyFileWithSkip(source2, dest) {
|
|
236823
|
+
try {
|
|
236824
|
+
await fs32.promises.copyFile(source2, dest);
|
|
236825
|
+
return true;
|
|
236826
|
+
} catch (error) {
|
|
236827
|
+
if (error.code === "EBUSY" || error.code === "EPERM" || error.code === "EACCES" || error.code === "ETXTBSY") {
|
|
236828
|
+
console.log(`Skipping ${path31.basename(dest)} (file is in use or locked)`);
|
|
236829
|
+
return false;
|
|
236830
|
+
}
|
|
236831
|
+
throw error;
|
|
236832
|
+
}
|
|
236833
|
+
}
|
|
236834
|
+
async function copyDirContents(sourceDir, destDir) {
|
|
236835
|
+
let total = 0;
|
|
236836
|
+
let skipped = 0;
|
|
236837
|
+
const entries = await fs32.promises.readdir(sourceDir, { withFileTypes: true });
|
|
236838
|
+
for (const entry of entries) {
|
|
236839
|
+
const sourcePath = path31.join(sourceDir, entry.name);
|
|
236840
|
+
const destPath = path31.join(destDir, entry.name);
|
|
236841
|
+
if (entry.isDirectory()) {
|
|
236842
|
+
if (!fs32.existsSync(destPath)) {
|
|
236843
|
+
await fs32.promises.mkdir(destPath, { recursive: true });
|
|
236844
|
+
}
|
|
236845
|
+
const result = await copyDirContents(sourcePath, destPath);
|
|
236846
|
+
total += result.total;
|
|
236847
|
+
skipped += result.skipped;
|
|
236848
|
+
} else {
|
|
236849
|
+
total++;
|
|
236850
|
+
const success = await copyFileWithSkip(sourcePath, destPath);
|
|
236851
|
+
if (!success) {
|
|
236852
|
+
skipped++;
|
|
236853
|
+
}
|
|
236854
|
+
}
|
|
236855
|
+
}
|
|
236856
|
+
return { total, skipped };
|
|
236857
|
+
}
|
|
236822
236858
|
async function extractShellX(assetPath) {
|
|
236859
|
+
let tempDir = null;
|
|
236823
236860
|
try {
|
|
236824
236861
|
await ensureInstallDir();
|
|
236862
|
+
tempDir = path31.join(os13.tmpdir(), `shellx-extract-${Date.now()}`);
|
|
236863
|
+
await fs32.promises.mkdir(tempDir, { recursive: true });
|
|
236864
|
+
console.log("Extracting to temporary directory:", tempDir);
|
|
236825
236865
|
const isLinux2 = process.platform === "linux";
|
|
236826
236866
|
if (isLinux2) {
|
|
236827
236867
|
await new Promise((resolve23, reject) => {
|
|
236828
|
-
const unzip = child_process.spawn("unzip", ["-o", assetPath, "-d",
|
|
236868
|
+
const unzip = child_process.spawn("unzip", ["-o", assetPath, "-d", tempDir]);
|
|
236829
236869
|
unzip.on("error", reject);
|
|
236830
236870
|
unzip.on("close", (code) => {
|
|
236831
236871
|
if (code === 0)
|
|
@@ -236835,13 +236875,20 @@ async function extractShellX(assetPath) {
|
|
|
236835
236875
|
});
|
|
236836
236876
|
});
|
|
236837
236877
|
} else {
|
|
236838
|
-
await (0, import_extract_zip.default)(assetPath, { dir:
|
|
236878
|
+
await (0, import_extract_zip.default)(assetPath, { dir: tempDir });
|
|
236879
|
+
}
|
|
236880
|
+
console.log("Copying files to installation directory...");
|
|
236881
|
+
const { total, skipped } = await copyDirContents(tempDir, SHELLX_BIN_DIR);
|
|
236882
|
+
if (skipped > 0) {
|
|
236883
|
+
console.log(`Copied ${total - skipped}/${total} files (${skipped} files skipped due to being in use)`);
|
|
236884
|
+
} else {
|
|
236885
|
+
console.log(`All ${total} files copied successfully`);
|
|
236839
236886
|
}
|
|
236840
236887
|
const assetDir = path31.dirname(assetPath);
|
|
236841
236888
|
const sourceApkPath = path31.join(assetDir, "shellx.apk");
|
|
236842
|
-
await
|
|
236889
|
+
await copyFileWithSkip(sourceApkPath, SHELLX_APK_FILE);
|
|
236843
236890
|
const sourceApkSignPath = path31.join(assetDir, "shellx.apk.sha256");
|
|
236844
|
-
await
|
|
236891
|
+
await copyFileWithSkip(sourceApkSignPath, SHELLX_APK_SIGN_FILE);
|
|
236845
236892
|
console.log("ShellX extracted successfully.");
|
|
236846
236893
|
const version2 = path31.basename(assetPath).split("-")[2].replace(".zip", "");
|
|
236847
236894
|
await fs32.promises.writeFile(SHELLX_VERSION_FILE, version2);
|
|
@@ -236850,6 +236897,14 @@ async function extractShellX(assetPath) {
|
|
|
236850
236897
|
} catch (error) {
|
|
236851
236898
|
console.error("Failed to extract ShellX:", error);
|
|
236852
236899
|
return false;
|
|
236900
|
+
} finally {
|
|
236901
|
+
if (tempDir && fs32.existsSync(tempDir)) {
|
|
236902
|
+
try {
|
|
236903
|
+
await fs32.promises.rm(tempDir, { recursive: true, force: true });
|
|
236904
|
+
} catch (error) {
|
|
236905
|
+
console.log("Failed to clean up temporary directory:", error);
|
|
236906
|
+
}
|
|
236907
|
+
}
|
|
236853
236908
|
}
|
|
236854
236909
|
}
|
|
236855
236910
|
async function launchShellX(justStart = true) {
|
|
@@ -386325,14 +386380,17 @@ var init_config2 = __esm({
|
|
|
386325
386380
|
this.toolRegistry = await this.createToolRegistry();
|
|
386326
386381
|
logCliConfiguration(this, new StartSessionEvent(this, this.toolRegistry));
|
|
386327
386382
|
}
|
|
386328
|
-
|
|
386329
|
-
|
|
386330
|
-
|
|
386331
|
-
|
|
386332
|
-
}
|
|
386333
|
-
const newContentGeneratorConfig = createContentGeneratorConfig(this, authMethod);
|
|
386383
|
+
/**
|
|
386384
|
+
* Connect to ShellX with retry logic
|
|
386385
|
+
*/
|
|
386386
|
+
async connectToShellX(retryCount = 0) {
|
|
386334
386387
|
const deviceId = process23.env["SHELLX_DEVICE_ID"];
|
|
386335
386388
|
try {
|
|
386389
|
+
if (retryCount === 0) {
|
|
386390
|
+
console.log("\u{1F50C} Connecting to ShellX...");
|
|
386391
|
+
} else {
|
|
386392
|
+
console.log(`\u{1F504} Retry attempt ${retryCount}: Reconnecting to ShellX...`);
|
|
386393
|
+
}
|
|
386336
386394
|
let connectionResolved = false;
|
|
386337
386395
|
const createShellXPromise = new Promise(async (resolve23, reject) => {
|
|
386338
386396
|
try {
|
|
@@ -386371,33 +386429,49 @@ var init_config2 = __esm({
|
|
|
386371
386429
|
}, 15e3);
|
|
386372
386430
|
});
|
|
386373
386431
|
this.shellxClient = await Promise.race([createShellXPromise, timeoutPromise]);
|
|
386374
|
-
console.log("ShellX
|
|
386375
|
-
const newGeminiClient = new GeminiClient(this);
|
|
386376
|
-
await newGeminiClient.initialize(newContentGeneratorConfig);
|
|
386377
|
-
const fromGenaiToVertex = this.contentGeneratorConfig?.authType === AuthType2.USE_GEMINI && authMethod === AuthType2.LOGIN_WITH_GOOGLE;
|
|
386378
|
-
this.contentGeneratorConfig = newContentGeneratorConfig;
|
|
386379
|
-
this.geminiClient = newGeminiClient;
|
|
386380
|
-
if (existingHistory.length > 0) {
|
|
386381
|
-
this.geminiClient.setHistory(existingHistory, {
|
|
386382
|
-
stripThoughts: fromGenaiToVertex
|
|
386383
|
-
});
|
|
386384
|
-
}
|
|
386385
|
-
this.inFallbackMode = false;
|
|
386432
|
+
console.log("\u2705 ShellX connected successfully!");
|
|
386386
386433
|
} catch (error) {
|
|
386387
|
-
console.warn(
|
|
386388
|
-
console.log("
|
|
386434
|
+
console.warn(`\u274C ShellX connection failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
386435
|
+
console.log("");
|
|
386436
|
+
console.log("\u{1F4E6} Checking ShellX installation...");
|
|
386389
386437
|
const shellxResult = await ensureShellXAndLaunch();
|
|
386390
386438
|
if (shellxResult.success) {
|
|
386391
|
-
console.log(
|
|
386439
|
+
console.log(`\u2705 ${shellxResult.message}`);
|
|
386392
386440
|
} else {
|
|
386393
|
-
console.
|
|
386394
|
-
|
|
386395
|
-
|
|
386396
|
-
console.log("
|
|
386397
|
-
|
|
386398
|
-
|
|
386399
|
-
|
|
386441
|
+
console.error(`\u274C ${shellxResult.message}`);
|
|
386442
|
+
console.log("");
|
|
386443
|
+
console.log("Please ensure:");
|
|
386444
|
+
console.log(" 1. ShellX app is installed on your Android device");
|
|
386445
|
+
console.log(" 2. Device is connected via ADB");
|
|
386446
|
+
console.log(" 3. USB debugging is enabled");
|
|
386447
|
+
console.log(' 4. Run "adb devices" to verify device connection');
|
|
386448
|
+
}
|
|
386449
|
+
const retryDelay = Math.min(5e3 + retryCount * 2e3, 3e4);
|
|
386450
|
+
console.log("");
|
|
386451
|
+
console.log(`\u23F3 Retrying in ${retryDelay / 1e3} seconds...`);
|
|
386452
|
+
console.log(` (Attempt ${retryCount + 1})`);
|
|
386453
|
+
console.log("");
|
|
386454
|
+
await new Promise((resolve23) => setTimeout(resolve23, retryDelay));
|
|
386455
|
+
return await this.connectToShellX(retryCount + 1);
|
|
386456
|
+
}
|
|
386457
|
+
}
|
|
386458
|
+
async refreshAuth(authMethod) {
|
|
386459
|
+
let existingHistory = [];
|
|
386460
|
+
if (this.geminiClient && this.geminiClient.isInitialized()) {
|
|
386461
|
+
existingHistory = this.geminiClient.getHistory();
|
|
386462
|
+
}
|
|
386463
|
+
const newContentGeneratorConfig = createContentGeneratorConfig(this, authMethod);
|
|
386464
|
+
const newGeminiClient = new GeminiClient(this);
|
|
386465
|
+
await newGeminiClient.initialize(newContentGeneratorConfig);
|
|
386466
|
+
const fromGenaiToVertex = this.contentGeneratorConfig?.authType === AuthType2.USE_GEMINI && authMethod === AuthType2.LOGIN_WITH_GOOGLE;
|
|
386467
|
+
this.contentGeneratorConfig = newContentGeneratorConfig;
|
|
386468
|
+
this.geminiClient = newGeminiClient;
|
|
386469
|
+
if (existingHistory.length > 0) {
|
|
386470
|
+
this.geminiClient.setHistory(existingHistory, {
|
|
386471
|
+
stripThoughts: fromGenaiToVertex
|
|
386472
|
+
});
|
|
386400
386473
|
}
|
|
386474
|
+
this.inFallbackMode = false;
|
|
386401
386475
|
}
|
|
386402
386476
|
getSessionId() {
|
|
386403
386477
|
return this.sessionId;
|
|
@@ -433799,6 +433873,7 @@ var useAuthCommand = (settings, setAuthError, config) => {
|
|
|
433799
433873
|
}
|
|
433800
433874
|
try {
|
|
433801
433875
|
setIsAuthenticating(true);
|
|
433876
|
+
await config.connectToShellX();
|
|
433802
433877
|
await config.refreshAuth(authType);
|
|
433803
433878
|
console.log(`Authenticated via "${authType}".`);
|
|
433804
433879
|
} catch (e4) {
|
|
@@ -434609,7 +434684,7 @@ async function getPackageJson() {
|
|
|
434609
434684
|
// packages/cli/src/utils/version.ts
|
|
434610
434685
|
async function getCliVersion() {
|
|
434611
434686
|
const pkgJson = await getPackageJson();
|
|
434612
|
-
return "0.0.
|
|
434687
|
+
return "0.0.8";
|
|
434613
434688
|
}
|
|
434614
434689
|
|
|
434615
434690
|
// packages/cli/src/ui/commands/aboutCommand.ts
|
|
@@ -434947,7 +435022,7 @@ init_open();
|
|
|
434947
435022
|
import process31 from "node:process";
|
|
434948
435023
|
|
|
434949
435024
|
// packages/cli/src/generated/git-commit.ts
|
|
434950
|
-
var GIT_COMMIT_INFO2 = "
|
|
435025
|
+
var GIT_COMMIT_INFO2 = "979a427a";
|
|
434951
435026
|
|
|
434952
435027
|
// packages/cli/src/ui/commands/bugCommand.ts
|
|
434953
435028
|
init_dist5();
|
|
@@ -458807,7 +458882,7 @@ function AuthInProgress({
|
|
|
458807
458882
|
flexDirection: "column",
|
|
458808
458883
|
padding: 1,
|
|
458809
458884
|
width: "100%",
|
|
458810
|
-
children: timedOut ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: Colors.AccentRed, children: "Authentication timed out. Please try again." }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { flexDirection: "column", gap: 1, children: [
|
|
458885
|
+
children: timedOut ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { color: Colors.AccentRed, children: "Authentication timed out. Please try again. Ensure your Android device is connected and USB debugging is enabled before continuing." }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Box_default, { flexDirection: "column", gap: 1, children: [
|
|
458811
458886
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Text, { children: [
|
|
458812
458887
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(build_default, { type: "dots" }),
|
|
458813
458888
|
" Waiting for authentication... (Press ESC or CTRL+C to cancel)"
|
|
@@ -470300,7 +470375,7 @@ ${queuedText}` : queuedText;
|
|
|
470300
470375
|
AuthInProgress,
|
|
470301
470376
|
{
|
|
470302
470377
|
onTimeout: () => {
|
|
470303
|
-
setAuthError("Authentication timed out. Please try again.");
|
|
470378
|
+
setAuthError("Authentication timed out. Please try again. Ensure your Android device is connected and USB debugging is enabled before continuing.");
|
|
470304
470379
|
cancelAuthentication();
|
|
470305
470380
|
openAuthDialog();
|
|
470306
470381
|
}
|