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