@claude-sync/cli 0.1.4 → 0.1.5
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/bin/claude-sync.js +46 -12
- package/dist/bin/claude-sync.js.map +1 -1
- package/dist/src/index.js +46 -12
- package/dist/src/index.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/claude-sync.js
CHANGED
|
@@ -4660,8 +4660,8 @@ var init_auth = __esm({
|
|
|
4660
4660
|
// src/lib/progress.ts
|
|
4661
4661
|
import ora from "ora";
|
|
4662
4662
|
import chalk from "chalk";
|
|
4663
|
-
function createSpinner(
|
|
4664
|
-
return ora({ text: brandColor(
|
|
4663
|
+
function createSpinner(text4) {
|
|
4664
|
+
return ora({ text: brandColor(text4), spinner: "dots", color: "magenta" });
|
|
4665
4665
|
}
|
|
4666
4666
|
function formatBytes(bytes) {
|
|
4667
4667
|
if (bytes === 0) return "0 B";
|
|
@@ -5642,7 +5642,8 @@ import { Command as Command7 } from "commander";
|
|
|
5642
5642
|
init_esm_shims();
|
|
5643
5643
|
init_theme();
|
|
5644
5644
|
init_config();
|
|
5645
|
-
|
|
5645
|
+
init_api_client();
|
|
5646
|
+
import { select as select3, text as text3, isCancel as isCancel4 } from "@clack/prompts";
|
|
5646
5647
|
import chalk3 from "chalk";
|
|
5647
5648
|
function buildMenu(loggedIn) {
|
|
5648
5649
|
if (!loggedIn) {
|
|
@@ -5697,6 +5698,30 @@ async function runTui() {
|
|
|
5697
5698
|
console.log();
|
|
5698
5699
|
}
|
|
5699
5700
|
}
|
|
5701
|
+
async function promptDeviceSelection(config) {
|
|
5702
|
+
const client = new ApiClient(config.apiUrl);
|
|
5703
|
+
let devices;
|
|
5704
|
+
try {
|
|
5705
|
+
devices = await client.get("/api/devices");
|
|
5706
|
+
} catch {
|
|
5707
|
+
printError("Failed to fetch devices.");
|
|
5708
|
+
return null;
|
|
5709
|
+
}
|
|
5710
|
+
if (devices.length === 0) {
|
|
5711
|
+
printError("No devices registered.");
|
|
5712
|
+
return null;
|
|
5713
|
+
}
|
|
5714
|
+
const choice = await select3({
|
|
5715
|
+
message: brand("Select device"),
|
|
5716
|
+
options: devices.map((d) => ({
|
|
5717
|
+
value: d.id,
|
|
5718
|
+
label: d.name,
|
|
5719
|
+
hint: d.id === config.deviceId ? dim("current") : void 0
|
|
5720
|
+
}))
|
|
5721
|
+
});
|
|
5722
|
+
if (isCancel4(choice)) return null;
|
|
5723
|
+
return choice;
|
|
5724
|
+
}
|
|
5700
5725
|
async function executeCommand(command) {
|
|
5701
5726
|
const { loginCommand: loginCommand2 } = await Promise.resolve().then(() => (init_login(), login_exports));
|
|
5702
5727
|
const { logoutCommand: logoutCommand2 } = await Promise.resolve().then(() => (init_logout(), logout_exports));
|
|
@@ -5704,16 +5729,25 @@ async function executeCommand(command) {
|
|
|
5704
5729
|
const { syncCommand: syncCommand2 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
5705
5730
|
const { statusCommand: statusCommand2 } = await Promise.resolve().then(() => (init_status(), status_exports));
|
|
5706
5731
|
const { whoamiCommand: whoamiCommand2 } = await Promise.resolve().then(() => (init_whoami(), whoami_exports));
|
|
5732
|
+
const config = await loadConfig();
|
|
5707
5733
|
const handlers = {
|
|
5708
|
-
login: () => loginCommand2().parseAsync(["", ""
|
|
5709
|
-
logout: () => logoutCommand2().parseAsync(["", ""
|
|
5710
|
-
sync: () => syncCommand2().parseAsync(["", ""
|
|
5711
|
-
status: () => statusCommand2().parseAsync(["", ""
|
|
5712
|
-
whoami: () => whoamiCommand2().parseAsync(["", ""
|
|
5713
|
-
"device:add": () => deviceCommand2().parseAsync(["", "", "
|
|
5714
|
-
"device:list": () => deviceCommand2().parseAsync(["", "", "
|
|
5715
|
-
"device:remove": () =>
|
|
5716
|
-
|
|
5734
|
+
login: () => loginCommand2().parseAsync(["", ""]),
|
|
5735
|
+
logout: () => logoutCommand2().parseAsync(["", ""]),
|
|
5736
|
+
sync: () => syncCommand2().parseAsync(["", ""]),
|
|
5737
|
+
status: () => statusCommand2().parseAsync(["", ""]),
|
|
5738
|
+
whoami: () => whoamiCommand2().parseAsync(["", ""]),
|
|
5739
|
+
"device:add": () => deviceCommand2().parseAsync(["", "", "add"]),
|
|
5740
|
+
"device:list": () => deviceCommand2().parseAsync(["", "", "list"]),
|
|
5741
|
+
"device:remove": async () => {
|
|
5742
|
+
const deviceId = await promptDeviceSelection(config);
|
|
5743
|
+
if (!deviceId) return;
|
|
5744
|
+
await deviceCommand2().parseAsync(["", "", "remove", deviceId]);
|
|
5745
|
+
},
|
|
5746
|
+
"device:rename": async () => {
|
|
5747
|
+
const name = await text3({ message: `${brand("New device name")}:` });
|
|
5748
|
+
if (isCancel4(name)) return;
|
|
5749
|
+
await deviceCommand2().parseAsync(["", "", "rename", name]);
|
|
5750
|
+
}
|
|
5717
5751
|
};
|
|
5718
5752
|
const handler = handlers[command];
|
|
5719
5753
|
if (handler) {
|