autohand-cli 0.7.5 → 0.7.7
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/README.md +2 -0
- package/dist/{AutomodeManager-TJSW2SQY.cjs → AutomodeManager-HV6M7EAX.cjs} +61 -22
- package/dist/{AutomodeManager-WIMHLG4W.js → AutomodeManager-YVCJXOMQ.js} +61 -22
- package/dist/CommunitySkillsCache-2BITCEAA.cjs +7 -0
- package/dist/{CommunitySkillsCache-XPDVYU3K.js → CommunitySkillsCache-Q22FUAR5.js} +2 -2
- package/dist/HookManager-X47HCM5G.cjs +6 -0
- package/dist/{HookManager-VIX56KFU.js → HookManager-ZXKHCD7U.js} +1 -1
- package/dist/MemoryManager-2ATHG7BH.js +7 -0
- package/dist/MemoryManager-AENCGCEW.cjs +7 -0
- package/dist/PermissionManager-6HZGTK2N.cjs +10 -0
- package/dist/{PermissionManager-YFZI4ZZ6.js → PermissionManager-HATZKTRC.js} +3 -3
- package/dist/SessionManager-AG4WT3DP.cjs +9 -0
- package/dist/{SessionManager-IMW2HGR3.js → SessionManager-S5R6O3NU.js} +2 -2
- package/dist/{SkillsRegistry-7NICF6FY.js → SkillsRegistry-R5WDM6T3.js} +2 -2
- package/dist/SkillsRegistry-ZXU6YDRP.cjs +8 -0
- package/dist/SyncApiClient-FAOMIZAP.js +10 -0
- package/dist/SyncApiClient-UOA4VLLD.cjs +10 -0
- package/dist/add-dir-OMK3Y4DM.cjs +8 -0
- package/dist/add-dir-PNU7AGKO.js +8 -0
- package/dist/{agents-B33IAATH.js → agents-ICAC3KD3.js} +2 -2
- package/dist/agents-YONWPKFS.cjs +9 -0
- package/dist/agents-new-NV557UVG.cjs +10 -0
- package/dist/{agents-new-KTXJFC5E.js → agents-new-QHM3CO4B.js} +2 -2
- package/dist/{chunk-MFLRXVKU.js → chunk-23JQSCTO.js} +1 -1
- package/dist/chunk-2JPUEN44.cjs +299 -0
- package/dist/{chunk-5PD2L6WI.js → chunk-3YEDXG6S.js} +1 -1
- package/dist/{chunk-3ZUWWML7.cjs → chunk-4M2GX7RH.cjs} +2 -2
- package/dist/chunk-4RWTUT2Z.js +151 -0
- package/dist/{chunk-CHQMK2ZG.js → chunk-52MLYK5P.js} +1 -1
- package/dist/{chunk-CVYEUA3D.cjs → chunk-53BR4MUW.cjs} +3 -3
- package/dist/{chunk-5WKR4HIB.js → chunk-5DN5KNXU.js} +1 -1
- package/dist/{chunk-3CO5R6M2.cjs → chunk-7TOHYAUF.cjs} +2 -2
- package/dist/{chunk-UPR5PKX4.cjs → chunk-7VW3A7DO.cjs} +7 -3
- package/dist/chunk-A552JHUJ.cjs +151 -0
- package/dist/{chunk-NGSLABLS.js → chunk-A6QBABQ7.js} +1 -1
- package/dist/chunk-ARVFUZOB.js +736 -0
- package/dist/{chunk-2FLBGPE3.js → chunk-AVL4DKQO.js} +6 -2
- package/dist/{chunk-CT2VTDPQ.cjs → chunk-B4ZPNXZE.cjs} +1 -1
- package/dist/{chunk-OKMYLMCR.cjs → chunk-B7EUETGY.cjs} +4 -4
- package/dist/chunk-C26EN22G.cjs +328 -0
- package/dist/chunk-DOTAX65F.js +328 -0
- package/dist/{chunk-SKT2CRNY.cjs → chunk-DSKVMFRM.cjs} +56 -8
- package/dist/{chunk-FUEL6BK7.js → chunk-EKY5PKQI.js} +15 -0
- package/dist/{chunk-YMP7AGNT.js → chunk-G77ZY4QG.js} +1 -1
- package/dist/{chunk-KN5C4TR4.cjs → chunk-GDTZQSJ6.cjs} +2 -2
- package/dist/{chunk-536VWSZK.cjs → chunk-GFJ6AETU.cjs} +4 -4
- package/dist/chunk-GR7VWN63.js +613 -0
- package/dist/{chunk-PVM5I5WI.js → chunk-GWIAMKKF.js} +1 -1
- package/dist/{chunk-XAM7SFVB.cjs → chunk-GWXXFQ3F.cjs} +2 -2
- package/dist/{chunk-REPKBECD.cjs → chunk-JHFH3N4U.cjs} +2 -2
- package/dist/{chunk-4L5WYXHN.js → chunk-KH7BCZJN.js} +1 -1
- package/dist/{chunk-JXOXZTMA.js → chunk-L5ZFPWHY.js} +54 -6
- package/dist/chunk-MDWULS57.js +288 -0
- package/dist/{chunk-6LP2GO5C.js → chunk-MJFBVQHB.js} +2 -2
- package/dist/{chunk-MWLAHCU7.js → chunk-NI3BQXKU.js} +1 -1
- package/dist/{chunk-63XGCFCC.cjs → chunk-NYQVQYIF.cjs} +6 -103
- package/dist/{chunk-SKU4M27Z.js → chunk-OBV3UUIL.js} +1 -1
- package/dist/{chunk-27ISZOFA.js → chunk-P2Z6GDEN.js} +1 -1
- package/dist/{chunk-XTHHDIBG.cjs → chunk-PMMSDR44.cjs} +16 -1
- package/dist/chunk-PR53E47T.cjs +613 -0
- package/dist/{chunk-URY4AS4L.cjs → chunk-PU534KPO.cjs} +4 -4
- package/dist/chunk-Q3WCMY3Z.js +104 -0
- package/dist/{chunk-EYBIKL2I.js → chunk-QXAPHGEW.js} +4 -101
- package/dist/chunk-SFGJQPGC.cjs +288 -0
- package/dist/{chunk-53YDUYNS.cjs → chunk-SLISYSP4.cjs} +2 -2
- package/dist/{chunk-2E2COWKB.cjs → chunk-SYJLMBLP.cjs} +66 -10
- package/dist/chunk-U5WIP4HS.js +674 -0
- package/dist/{chunk-7HB7GSQF.js → chunk-UL7YPRCU.js} +1 -1
- package/dist/chunk-VDZJ3W4M.cjs +104 -0
- package/dist/{chunk-LUKMRIKJ.cjs → chunk-VEDIYPWY.cjs} +2 -2
- package/dist/{chunk-C2NFLFHH.js → chunk-VPAN5H7Q.js} +1 -1
- package/dist/chunk-WH3D42BQ.js +299 -0
- package/dist/{chunk-2FSQPRPJ.js → chunk-WIUGUR5T.js} +59 -3
- package/dist/{chunk-QMVTT55Y.cjs → chunk-WQSWU2QA.cjs} +4 -4
- package/dist/chunk-XFPITUFJ.cjs +674 -0
- package/dist/chunk-XFQS2VGT.cjs +736 -0
- package/dist/{chunk-HYTYXN2G.cjs → chunk-YAGD43KA.cjs} +10 -10
- package/dist/constants-G2PLP5HH.cjs +20 -0
- package/dist/{constants-QYBEF3DB.js → constants-ZLG6M5SI.js} +3 -1
- package/dist/{defaultHooks-3G3DVF6I.js → defaultHooks-R56VYG7I.js} +315 -1
- package/dist/{defaultHooks-Z4KA6U5C.cjs → defaultHooks-WLMRQUXG.cjs} +315 -1
- package/dist/{feedback-PZ2PINDU.js → feedback-HZBCTSFG.js} +2 -2
- package/dist/feedback-JBQ3UPGZ.cjs +10 -0
- package/dist/index.cjs +2669 -978
- package/dist/index.js +2657 -966
- package/dist/language-KODBDE5R.js +12 -0
- package/dist/language-SJT475NW.cjs +12 -0
- package/dist/localProjectPermissions-AYQYGTOE.cjs +17 -0
- package/dist/{localProjectPermissions-DURCNDZG.js → localProjectPermissions-YFFAKLUZ.js} +2 -2
- package/dist/login-TC2KROQI.js +14 -0
- package/dist/login-TYMR2ZD3.cjs +14 -0
- package/dist/logout-2ECV365P.js +12 -0
- package/dist/logout-CO3CPYZJ.cjs +12 -0
- package/dist/resume-EPOEF3WV.cjs +9 -0
- package/dist/{resume-2NERFSTD.js → resume-LOYD5MMP.js} +2 -1
- package/dist/share-544SIZOY.js +10 -0
- package/dist/share-OETK2GUF.cjs +10 -0
- package/dist/{skills-CRFOVWEQ.js → skills-3YEEODHK.js} +1 -1
- package/dist/skills-CRM55MKM.cjs +12 -0
- package/dist/{skills-install-Z27KPEGF.cjs → skills-install-FTGOHOZ4.cjs} +5 -5
- package/dist/{skills-install-RMPXN6RK.js → skills-install-KAXAQSN6.js} +2 -2
- package/dist/skills-new-JF4FKNUT.cjs +11 -0
- package/dist/{skills-new-S2YPO635.js → skills-new-JYX2GBKM.js} +2 -2
- package/dist/{status-VRYDAEBT.js → status-7LCXYYY4.js} +2 -1
- package/dist/status-E7MZEQ26.cjs +9 -0
- package/dist/sync-3B7SNBYC.js +14 -0
- package/dist/sync-4RARBQIH.cjs +39 -0
- package/dist/sync-H4UHHLKU.js +39 -0
- package/dist/sync-YZ6YZ42H.cjs +14 -0
- package/dist/theme-3XV5BWUB.js +12 -0
- package/dist/theme-Z2WS5XWZ.cjs +12 -0
- package/package.json +5 -2
- package/dist/CommunitySkillsCache-X3X237QQ.cjs +0 -7
- package/dist/HookManager-EOMUXKJ4.cjs +0 -6
- package/dist/MemoryManager-UVHILGV5.js +0 -7
- package/dist/MemoryManager-WO3KUZVA.cjs +0 -7
- package/dist/PermissionManager-PMTQN263.cjs +0 -10
- package/dist/SessionManager-VZNWGX4O.cjs +0 -9
- package/dist/SkillsRegistry-OINIPILA.cjs +0 -8
- package/dist/agents-GRAFXZY3.cjs +0 -9
- package/dist/agents-new-67NJJSDA.cjs +0 -10
- package/dist/chunk-55DQY6B5.js +0 -49
- package/dist/chunk-RYY5I7QN.cjs +0 -49
- package/dist/constants-PE5DLI7Q.cjs +0 -18
- package/dist/feedback-R66B3B3C.cjs +0 -10
- package/dist/localProjectPermissions-75X3ZGKH.cjs +0 -17
- package/dist/login-NYWZRZO5.js +0 -12
- package/dist/login-QNJ5C42G.cjs +0 -12
- package/dist/logout-MBS7L3ZW.js +0 -12
- package/dist/logout-MVUP7GPU.cjs +0 -12
- package/dist/resume-OYZMJRNO.cjs +0 -8
- package/dist/skills-6PIGHOWS.cjs +0 -12
- package/dist/skills-new-3QJUST7P.cjs +0 -11
- package/dist/status-CYVPCW7G.cjs +0 -8
- package/dist/theme-CVY6MVEK.cjs +0 -12
- package/dist/theme-CY7WF4M6.js +0 -12
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var package_default = {
|
|
3
|
+
name: "autohand-cli",
|
|
4
|
+
version: "0.7.7",
|
|
5
|
+
license: "Apache-2.0",
|
|
6
|
+
description: "Autohand interactive coding agent CLI powered by LLMs.",
|
|
7
|
+
repository: {
|
|
8
|
+
type: "git",
|
|
9
|
+
url: "https://github.com/autohandai/code-cli.git"
|
|
10
|
+
},
|
|
11
|
+
homepage: "https://autohand.ai/cli/",
|
|
12
|
+
bugs: {
|
|
13
|
+
url: "https://github.com/autohandai/code-cli/issues"
|
|
14
|
+
},
|
|
15
|
+
type: "module",
|
|
16
|
+
bin: {
|
|
17
|
+
autohand: "dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
main: "dist/index.js",
|
|
20
|
+
files: [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
scripts: {
|
|
24
|
+
go: 'bun run build && ./install-local.sh && echo "COMPLETED"',
|
|
25
|
+
build: "tsup",
|
|
26
|
+
dev: "bun src/index.ts",
|
|
27
|
+
typecheck: "tsc --noEmit",
|
|
28
|
+
lint: "eslint .",
|
|
29
|
+
test: "vitest run",
|
|
30
|
+
start: "node dist/index.js",
|
|
31
|
+
"compile:macos-arm64": "bun build ./src/index.ts --compile --target=bun-darwin-arm64 --external react-devtools-core --outfile ./binaries/autohand-macos-arm64",
|
|
32
|
+
"compile:macos-x64": "bun build ./src/index.ts --compile --target=bun-darwin-x64 --external react-devtools-core --outfile ./binaries/autohand-macos-x64",
|
|
33
|
+
"compile:linux-x64": "bun build ./src/index.ts --compile --target=bun-linux-x64 --external react-devtools-core --outfile ./binaries/autohand-linux-x64",
|
|
34
|
+
"compile:linux-arm64": "bun build ./src/index.ts --compile --target=bun-linux-arm64 --external react-devtools-core --outfile ./binaries/autohand-linux-arm64",
|
|
35
|
+
"compile:windows-x64": "bun build ./src/index.ts --compile --target=bun-windows-x64 --external react-devtools-core --outfile ./binaries/autohand-windows-x64.exe",
|
|
36
|
+
"compile:all": "bun run compile:macos-arm64 && bun run compile:macos-x64 && bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64",
|
|
37
|
+
link: "bun link",
|
|
38
|
+
translate: "tsx scripts/generate-translations.ts"
|
|
39
|
+
},
|
|
40
|
+
keywords: [
|
|
41
|
+
"cli",
|
|
42
|
+
"llm",
|
|
43
|
+
"agent",
|
|
44
|
+
"autohand"
|
|
45
|
+
],
|
|
46
|
+
engines: {
|
|
47
|
+
node: ">=18.17.0"
|
|
48
|
+
},
|
|
49
|
+
dependencies: {
|
|
50
|
+
chalk: "^5.6.2",
|
|
51
|
+
commander: "^14.0.2",
|
|
52
|
+
diff: "^8.0.2",
|
|
53
|
+
dotenv: "^17.2.3",
|
|
54
|
+
enquirer: "^2.4.1",
|
|
55
|
+
"fs-extra": "^11.3.2",
|
|
56
|
+
i18next: "^25.7.4",
|
|
57
|
+
ignore: "^5.3.1",
|
|
58
|
+
ink: "^4.4.1",
|
|
59
|
+
"ink-spinner": "^5.0.0",
|
|
60
|
+
minimatch: "^10.1.1",
|
|
61
|
+
open: "^10.1.0",
|
|
62
|
+
ora: "^9.0.0",
|
|
63
|
+
react: "^18.2.0",
|
|
64
|
+
"react-devtools-core": "^7.0.1",
|
|
65
|
+
"terminal-link": "^3.0.0",
|
|
66
|
+
yaml: "^2.8.2",
|
|
67
|
+
zod: "^4.1.12"
|
|
68
|
+
},
|
|
69
|
+
devDependencies: {
|
|
70
|
+
"@types/diff": "^8.0.0",
|
|
71
|
+
"@types/fs-extra": "^11.0.4",
|
|
72
|
+
"@types/minimatch": "^6.0.0",
|
|
73
|
+
"@types/node": "^24.10.1",
|
|
74
|
+
"@types/react": "^18.3.3",
|
|
75
|
+
"@types/terminal-link": "^1.2.0",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
77
|
+
"@typescript-eslint/parser": "^8.48.1",
|
|
78
|
+
eslint: "^9.39.1",
|
|
79
|
+
memfs: "^4.51.1",
|
|
80
|
+
tsup: "^8.5.1",
|
|
81
|
+
tsx: "^4.20.6",
|
|
82
|
+
typescript: "^5.9.3",
|
|
83
|
+
vitest: "^1.6.0"
|
|
84
|
+
},
|
|
85
|
+
overrides: {
|
|
86
|
+
ink: {
|
|
87
|
+
"slice-ansi": {
|
|
88
|
+
"ansi-styles": "^6.2.1"
|
|
89
|
+
},
|
|
90
|
+
"wrap-ansi": {
|
|
91
|
+
"ansi-styles": "^6.2.1"
|
|
92
|
+
},
|
|
93
|
+
"cli-truncate": {
|
|
94
|
+
"slice-ansi": {
|
|
95
|
+
"ansi-styles": "^6.2.1"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
package_default
|
|
104
|
+
};
|
|
@@ -1,106 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
package_default
|
|
3
|
+
} from "./chunk-Q3WCMY3Z.js";
|
|
4
|
+
|
|
1
5
|
// src/commands/status.ts
|
|
2
6
|
import chalk from "chalk";
|
|
3
7
|
import readline from "readline";
|
|
4
|
-
|
|
5
|
-
// package.json
|
|
6
|
-
var package_default = {
|
|
7
|
-
name: "autohand-cli",
|
|
8
|
-
version: "0.7.5",
|
|
9
|
-
license: "Apache-2.0",
|
|
10
|
-
description: "Autohand interactive coding agent CLI powered by LLMs.",
|
|
11
|
-
repository: {
|
|
12
|
-
type: "git",
|
|
13
|
-
url: "https://github.com/autohandai/code-cli.git"
|
|
14
|
-
},
|
|
15
|
-
homepage: "https://autohand.ai/cli/",
|
|
16
|
-
bugs: {
|
|
17
|
-
url: "https://github.com/autohandai/code-cli/issues"
|
|
18
|
-
},
|
|
19
|
-
type: "module",
|
|
20
|
-
bin: {
|
|
21
|
-
autohand: "dist/index.js"
|
|
22
|
-
},
|
|
23
|
-
main: "dist/index.js",
|
|
24
|
-
files: [
|
|
25
|
-
"dist"
|
|
26
|
-
],
|
|
27
|
-
scripts: {
|
|
28
|
-
go: 'bun run build && ./install-local.sh && echo "COMPLETED"',
|
|
29
|
-
build: "tsup",
|
|
30
|
-
dev: "bun src/index.ts",
|
|
31
|
-
typecheck: "tsc --noEmit",
|
|
32
|
-
lint: "eslint .",
|
|
33
|
-
test: "vitest run",
|
|
34
|
-
start: "node dist/index.js",
|
|
35
|
-
"compile:macos-arm64": "bun build ./src/index.ts --compile --target=bun-darwin-arm64 --external react-devtools-core --outfile ./binaries/autohand-macos-arm64",
|
|
36
|
-
"compile:macos-x64": "bun build ./src/index.ts --compile --target=bun-darwin-x64 --external react-devtools-core --outfile ./binaries/autohand-macos-x64",
|
|
37
|
-
"compile:linux-x64": "bun build ./src/index.ts --compile --target=bun-linux-x64 --external react-devtools-core --outfile ./binaries/autohand-linux-x64",
|
|
38
|
-
"compile:linux-arm64": "bun build ./src/index.ts --compile --target=bun-linux-arm64 --external react-devtools-core --outfile ./binaries/autohand-linux-arm64",
|
|
39
|
-
"compile:windows-x64": "bun build ./src/index.ts --compile --target=bun-windows-x64 --external react-devtools-core --outfile ./binaries/autohand-windows-x64.exe",
|
|
40
|
-
"compile:all": "bun run compile:macos-arm64 && bun run compile:macos-x64 && bun run compile:linux-x64 && bun run compile:linux-arm64 && bun run compile:windows-x64",
|
|
41
|
-
link: "bun link"
|
|
42
|
-
},
|
|
43
|
-
keywords: [
|
|
44
|
-
"cli",
|
|
45
|
-
"llm",
|
|
46
|
-
"agent",
|
|
47
|
-
"autohand"
|
|
48
|
-
],
|
|
49
|
-
engines: {
|
|
50
|
-
node: ">=18.17.0"
|
|
51
|
-
},
|
|
52
|
-
dependencies: {
|
|
53
|
-
chalk: "^5.6.2",
|
|
54
|
-
commander: "^14.0.2",
|
|
55
|
-
diff: "^8.0.2",
|
|
56
|
-
dotenv: "^17.2.3",
|
|
57
|
-
enquirer: "^2.4.1",
|
|
58
|
-
"fs-extra": "^11.3.2",
|
|
59
|
-
ignore: "^5.3.1",
|
|
60
|
-
ink: "^4.4.1",
|
|
61
|
-
"ink-spinner": "^5.0.0",
|
|
62
|
-
minimatch: "^10.1.1",
|
|
63
|
-
open: "^10.1.0",
|
|
64
|
-
ora: "^9.0.0",
|
|
65
|
-
react: "^18.2.0",
|
|
66
|
-
"react-devtools-core": "^7.0.1",
|
|
67
|
-
"terminal-link": "^3.0.0",
|
|
68
|
-
yaml: "^2.8.2",
|
|
69
|
-
zod: "^4.1.12"
|
|
70
|
-
},
|
|
71
|
-
devDependencies: {
|
|
72
|
-
"@types/diff": "^8.0.0",
|
|
73
|
-
"@types/fs-extra": "^11.0.4",
|
|
74
|
-
"@types/minimatch": "^6.0.0",
|
|
75
|
-
"@types/node": "^24.10.1",
|
|
76
|
-
"@types/react": "^18.3.3",
|
|
77
|
-
"@types/terminal-link": "^1.2.0",
|
|
78
|
-
"@typescript-eslint/eslint-plugin": "^8.48.1",
|
|
79
|
-
"@typescript-eslint/parser": "^8.48.1",
|
|
80
|
-
eslint: "^9.39.1",
|
|
81
|
-
tsup: "^8.5.1",
|
|
82
|
-
tsx: "^4.20.6",
|
|
83
|
-
typescript: "^5.9.3",
|
|
84
|
-
vitest: "^1.6.0"
|
|
85
|
-
},
|
|
86
|
-
overrides: {
|
|
87
|
-
ink: {
|
|
88
|
-
"slice-ansi": {
|
|
89
|
-
"ansi-styles": "^6.2.1"
|
|
90
|
-
},
|
|
91
|
-
"wrap-ansi": {
|
|
92
|
-
"ansi-styles": "^6.2.1"
|
|
93
|
-
},
|
|
94
|
-
"cli-truncate": {
|
|
95
|
-
"slice-ansi": {
|
|
96
|
-
"ansi-styles": "^6.2.1"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
// src/commands/status.ts
|
|
104
8
|
var metadata = {
|
|
105
9
|
command: "/status",
|
|
106
10
|
description: "Show Autohand status including version, model, API connectivity, and usage",
|
|
@@ -304,7 +208,6 @@ function formatTokens(tokens) {
|
|
|
304
208
|
}
|
|
305
209
|
|
|
306
210
|
export {
|
|
307
|
-
package_default,
|
|
308
211
|
metadata,
|
|
309
212
|
status
|
|
310
213
|
};
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/sync/SyncApiClient.ts
|
|
2
|
+
var DEFAULT_BASE_URL = "https://api.autohand.ai";
|
|
3
|
+
var DEFAULT_TIMEOUT = 3e4;
|
|
4
|
+
var DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
5
|
+
var DEFAULT_MAX_TOTAL_SIZE = 100 * 1024 * 1024;
|
|
6
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
7
|
+
var DEFAULT_RETRY_DELAY = 1e3;
|
|
8
|
+
var SyncApiClient = class {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.baseUrl = _optionalChain([config, 'optionalAccess', _ => _.baseUrl]) || DEFAULT_BASE_URL;
|
|
11
|
+
this.timeout = _optionalChain([config, 'optionalAccess', _2 => _2.timeout]) || DEFAULT_TIMEOUT;
|
|
12
|
+
this.maxFileSize = _optionalChain([config, 'optionalAccess', _3 => _3.maxFileSize]) || DEFAULT_MAX_FILE_SIZE;
|
|
13
|
+
this.maxTotalSize = _optionalChain([config, 'optionalAccess', _4 => _4.maxTotalSize]) || DEFAULT_MAX_TOTAL_SIZE;
|
|
14
|
+
this.maxRetries = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _5 => _5.maxRetries]), () => ( DEFAULT_MAX_RETRIES));
|
|
15
|
+
this.retryDelay = _nullishCoalesce(_optionalChain([config, 'optionalAccess', _6 => _6.retryDelay]), () => ( DEFAULT_RETRY_DELAY));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Execute a fetch request with retry logic and rate limit handling
|
|
19
|
+
*/
|
|
20
|
+
async fetchWithRetry(url, options, timeoutMs = this.timeout) {
|
|
21
|
+
let lastError = null;
|
|
22
|
+
for (let attempt = 0; attempt < this.maxRetries; attempt++) {
|
|
23
|
+
const controller = new AbortController();
|
|
24
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
25
|
+
try {
|
|
26
|
+
const response = await fetch(url, {
|
|
27
|
+
...options,
|
|
28
|
+
signal: controller.signal
|
|
29
|
+
});
|
|
30
|
+
clearTimeout(timeoutId);
|
|
31
|
+
if (response.status === 429) {
|
|
32
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
33
|
+
const waitTime = retryAfter ? parseInt(retryAfter, 10) * 1e3 : this.retryDelay * Math.pow(2, attempt);
|
|
34
|
+
if (attempt < this.maxRetries - 1) {
|
|
35
|
+
await this.sleep(waitTime);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
throw new Error("Rate limited: too many requests");
|
|
39
|
+
}
|
|
40
|
+
if (response.status >= 500 && attempt < this.maxRetries - 1) {
|
|
41
|
+
await this.sleep(this.retryDelay * Math.pow(2, attempt));
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
return response;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
clearTimeout(timeoutId);
|
|
47
|
+
lastError = error;
|
|
48
|
+
if (error.name === "AbortError") {
|
|
49
|
+
throw new Error("Request timeout");
|
|
50
|
+
}
|
|
51
|
+
if (attempt < this.maxRetries - 1) {
|
|
52
|
+
await this.sleep(this.retryDelay * Math.pow(2, attempt));
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
throw lastError || new Error("Request failed after retries");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Sleep for a specified duration
|
|
61
|
+
*/
|
|
62
|
+
sleep(ms) {
|
|
63
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get the remote sync manifest for a user
|
|
67
|
+
* Returns null if no sync data exists
|
|
68
|
+
*/
|
|
69
|
+
async getRemoteManifest(token) {
|
|
70
|
+
const response = await this.fetchWithRetry(
|
|
71
|
+
`${this.baseUrl}/v1/sync/manifest`,
|
|
72
|
+
{
|
|
73
|
+
method: "GET",
|
|
74
|
+
headers: {
|
|
75
|
+
Authorization: `Bearer ${token}`,
|
|
76
|
+
"Content-Type": "application/json"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
if (response.status === 404) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
if (!response.ok) {
|
|
84
|
+
const error = await response.text().catch(() => "Unknown error");
|
|
85
|
+
throw new Error(`API error: ${response.status} ${error}`);
|
|
86
|
+
}
|
|
87
|
+
const data = await response.json();
|
|
88
|
+
return data.manifest || null;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Upload sync manifest and request pre-signed URLs for file uploads
|
|
92
|
+
*/
|
|
93
|
+
async initiateUpload(token, manifest, filePaths) {
|
|
94
|
+
const response = await this.fetchWithRetry(
|
|
95
|
+
`${this.baseUrl}/v1/sync/upload`,
|
|
96
|
+
{
|
|
97
|
+
method: "POST",
|
|
98
|
+
headers: {
|
|
99
|
+
Authorization: `Bearer ${token}`,
|
|
100
|
+
"Content-Type": "application/json"
|
|
101
|
+
},
|
|
102
|
+
body: JSON.stringify({
|
|
103
|
+
manifest,
|
|
104
|
+
files: filePaths
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
if (!response.ok) {
|
|
109
|
+
const error = await response.text().catch(() => "Unknown error");
|
|
110
|
+
throw new Error(`API error: ${response.status} ${error}`);
|
|
111
|
+
}
|
|
112
|
+
const data = await response.json();
|
|
113
|
+
return {
|
|
114
|
+
uploadUrls: data.uploadUrls || {}
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Upload a file to a pre-signed URL
|
|
119
|
+
*/
|
|
120
|
+
async uploadFile(uploadUrl, content) {
|
|
121
|
+
if (content.length > this.maxFileSize) {
|
|
122
|
+
throw new Error(`File exceeds max size of ${this.maxFileSize} bytes`);
|
|
123
|
+
}
|
|
124
|
+
const response = await this.fetchWithRetry(
|
|
125
|
+
uploadUrl,
|
|
126
|
+
{
|
|
127
|
+
method: "PUT",
|
|
128
|
+
headers: {
|
|
129
|
+
"Content-Type": "application/octet-stream",
|
|
130
|
+
"Content-Length": content.length.toString()
|
|
131
|
+
},
|
|
132
|
+
body: new Uint8Array(content)
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
if (!response.ok) {
|
|
136
|
+
throw new Error(`Upload failed: ${response.status}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Complete the upload and finalize the manifest
|
|
141
|
+
*/
|
|
142
|
+
async completeUpload(token, manifest) {
|
|
143
|
+
try {
|
|
144
|
+
const response = await this.fetchWithRetry(
|
|
145
|
+
`${this.baseUrl}/v1/sync/complete`,
|
|
146
|
+
{
|
|
147
|
+
method: "POST",
|
|
148
|
+
headers: {
|
|
149
|
+
Authorization: `Bearer ${token}`,
|
|
150
|
+
"Content-Type": "application/json"
|
|
151
|
+
},
|
|
152
|
+
body: JSON.stringify({ manifest })
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
if (!response.ok) {
|
|
156
|
+
const error = await response.text().catch(() => "Unknown error");
|
|
157
|
+
return {
|
|
158
|
+
success: false,
|
|
159
|
+
uploaded: 0,
|
|
160
|
+
downloaded: 0,
|
|
161
|
+
conflicts: 0,
|
|
162
|
+
error: `API error: ${response.status} ${error}`
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
success: true,
|
|
167
|
+
uploaded: manifest.files.length,
|
|
168
|
+
downloaded: 0,
|
|
169
|
+
conflicts: 0
|
|
170
|
+
};
|
|
171
|
+
} catch (error) {
|
|
172
|
+
return {
|
|
173
|
+
success: false,
|
|
174
|
+
uploaded: 0,
|
|
175
|
+
downloaded: 0,
|
|
176
|
+
conflicts: 0,
|
|
177
|
+
error: error.message
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Request pre-signed URLs for file downloads
|
|
183
|
+
*/
|
|
184
|
+
async initiateDownload(token, filePaths) {
|
|
185
|
+
const response = await this.fetchWithRetry(
|
|
186
|
+
`${this.baseUrl}/v1/sync/download`,
|
|
187
|
+
{
|
|
188
|
+
method: "POST",
|
|
189
|
+
headers: {
|
|
190
|
+
Authorization: `Bearer ${token}`,
|
|
191
|
+
"Content-Type": "application/json"
|
|
192
|
+
},
|
|
193
|
+
body: JSON.stringify({ files: filePaths })
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
if (!response.ok) {
|
|
197
|
+
const error = await response.text().catch(() => "Unknown error");
|
|
198
|
+
throw new Error(`API error: ${response.status} ${error}`);
|
|
199
|
+
}
|
|
200
|
+
const data = await response.json();
|
|
201
|
+
return {
|
|
202
|
+
downloadUrls: data.downloadUrls || {}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Download a file from a pre-signed URL
|
|
207
|
+
*/
|
|
208
|
+
async downloadFile(downloadUrl) {
|
|
209
|
+
const response = await this.fetchWithRetry(
|
|
210
|
+
downloadUrl,
|
|
211
|
+
{ method: "GET" }
|
|
212
|
+
);
|
|
213
|
+
if (!response.ok) {
|
|
214
|
+
throw new Error(`Download failed: ${response.status}`);
|
|
215
|
+
}
|
|
216
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
217
|
+
return Buffer.from(arrayBuffer);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Delete sync data for a user
|
|
221
|
+
*/
|
|
222
|
+
async deleteSyncData(token) {
|
|
223
|
+
try {
|
|
224
|
+
const response = await this.fetchWithRetry(
|
|
225
|
+
`${this.baseUrl}/v1/sync`,
|
|
226
|
+
{
|
|
227
|
+
method: "DELETE",
|
|
228
|
+
headers: {
|
|
229
|
+
Authorization: `Bearer ${token}`
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
return response.ok;
|
|
234
|
+
} catch (e) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Health check for the sync API
|
|
240
|
+
*/
|
|
241
|
+
async healthCheck() {
|
|
242
|
+
const controller = new AbortController();
|
|
243
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
244
|
+
try {
|
|
245
|
+
const response = await fetch(`${this.baseUrl}/health`, {
|
|
246
|
+
method: "GET",
|
|
247
|
+
signal: controller.signal
|
|
248
|
+
});
|
|
249
|
+
clearTimeout(timeoutId);
|
|
250
|
+
return response.ok;
|
|
251
|
+
} catch (e2) {
|
|
252
|
+
clearTimeout(timeoutId);
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get size limits
|
|
258
|
+
*/
|
|
259
|
+
get limits() {
|
|
260
|
+
return {
|
|
261
|
+
maxFileSize: this.maxFileSize,
|
|
262
|
+
maxTotalSize: this.maxTotalSize
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
var instance = null;
|
|
267
|
+
function getSyncApiClient(config) {
|
|
268
|
+
if (!instance) {
|
|
269
|
+
instance = new SyncApiClient(config);
|
|
270
|
+
}
|
|
271
|
+
return instance;
|
|
272
|
+
}
|
|
273
|
+
function resetSyncApiClient() {
|
|
274
|
+
instance = null;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
exports.SyncApiClient = SyncApiClient; exports.getSyncApiClient = getSyncApiClient; exports.resetSyncApiClient = resetSyncApiClient;
|
|
282
|
+
/**
|
|
283
|
+
* @license
|
|
284
|
+
* Copyright 2025 Autohand AI LLC
|
|
285
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
286
|
+
*
|
|
287
|
+
* Sync API Client for communicating with Cloudflare R2 via API
|
|
288
|
+
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunk3HPUOQJNcjs = require('./chunk-3HPUOQJN.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkPMMSDR44cjs = require('./chunk-PMMSDR44.cjs');
|
|
7
7
|
|
|
8
8
|
// src/commands/agents-new.ts
|
|
9
9
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
@@ -83,7 +83,7 @@ function buildPrompt(name, description) {
|
|
|
83
83
|
].filter(Boolean).join("\n");
|
|
84
84
|
}
|
|
85
85
|
function getAgentsDir() {
|
|
86
|
-
return
|
|
86
|
+
return _chunkPMMSDR44cjs.AUTOHAND_PATHS.agents;
|
|
87
87
|
}
|
|
88
88
|
function slugify(input) {
|
|
89
89
|
return input.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || "agent";
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var _chunkREPKBECDcjs = require('./chunk-REPKBECD.cjs');
|
|
4
3
|
|
|
4
|
+
var _chunkXFPITUFJcjs = require('./chunk-XFPITUFJ.cjs');
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
var _chunkJHFH3N4Ucjs = require('./chunk-JHFH3N4U.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkWQSWU2QAcjs = require('./chunk-WQSWU2QA.cjs');
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
var _chunk3HPUOQJNcjs = require('./chunk-3HPUOQJN.cjs');
|
|
10
14
|
|
|
11
15
|
|
|
12
|
-
var
|
|
16
|
+
var _chunkPMMSDR44cjs = require('./chunk-PMMSDR44.cjs');
|
|
13
17
|
|
|
14
18
|
// src/commands/login.ts
|
|
15
19
|
var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
|
|
@@ -60,7 +64,7 @@ async function login(ctx) {
|
|
|
60
64
|
return null;
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
|
-
const authClient =
|
|
67
|
+
const authClient = _chunkJHFH3N4Ucjs.getAuthClient.call(void 0, );
|
|
64
68
|
console.log(_chalk2.default.gray("Initiating authentication..."));
|
|
65
69
|
const initResult = await authClient.initiateDeviceAuth();
|
|
66
70
|
if (!initResult.success || !initResult.deviceCode || !initResult.userCode) {
|
|
@@ -69,13 +73,13 @@ async function login(ctx) {
|
|
|
69
73
|
}
|
|
70
74
|
console.log();
|
|
71
75
|
console.log(_chalk2.default.bold("To sign in, visit:"));
|
|
72
|
-
console.log(_chalk2.default.cyan.underline(initResult.verificationUriComplete || `${
|
|
76
|
+
console.log(_chalk2.default.cyan.underline(initResult.verificationUriComplete || `${_chunkPMMSDR44cjs.AUTH_CONFIG.authorizationUrl}?code=${initResult.userCode}`));
|
|
73
77
|
console.log();
|
|
74
78
|
console.log(_chalk2.default.gray("Or enter this code manually:"));
|
|
75
79
|
console.log(_chalk2.default.bold.yellow(` ${initResult.userCode}`));
|
|
76
80
|
console.log();
|
|
77
81
|
const browserOpened = await openBrowser(
|
|
78
|
-
initResult.verificationUriComplete || `${
|
|
82
|
+
initResult.verificationUriComplete || `${_chunkPMMSDR44cjs.AUTH_CONFIG.authorizationUrl}?code=${initResult.userCode}`
|
|
79
83
|
);
|
|
80
84
|
if (browserOpened) {
|
|
81
85
|
console.log(_chalk2.default.gray("Browser opened. Complete the login in your browser."));
|
|
@@ -86,8 +90,8 @@ async function login(ctx) {
|
|
|
86
90
|
console.log(_chalk2.default.gray("Waiting for authorization..."));
|
|
87
91
|
console.log(_chalk2.default.gray("(Press Ctrl+C to cancel)"));
|
|
88
92
|
const startTime = Date.now();
|
|
89
|
-
const timeout =
|
|
90
|
-
const pollInterval = initResult.interval ? initResult.interval * 1e3 :
|
|
93
|
+
const timeout = _chunkPMMSDR44cjs.AUTH_CONFIG.authTimeout;
|
|
94
|
+
const pollInterval = initResult.interval ? initResult.interval * 1e3 : _chunkPMMSDR44cjs.AUTH_CONFIG.pollInterval;
|
|
91
95
|
let dots = 0;
|
|
92
96
|
const maxDots = 3;
|
|
93
97
|
while (Date.now() - startTime < timeout) {
|
|
@@ -97,7 +101,7 @@ async function login(ctx) {
|
|
|
97
101
|
const pollResult = await authClient.pollDeviceAuth(initResult.deviceCode);
|
|
98
102
|
if (pollResult.status === "authorized" && pollResult.token && pollResult.user) {
|
|
99
103
|
process.stdout.write("\r" + " ".repeat(20) + "\r");
|
|
100
|
-
const expiresAt = new Date(Date.now() +
|
|
104
|
+
const expiresAt = new Date(Date.now() + _chunkPMMSDR44cjs.AUTH_CONFIG.sessionExpiryDays * 24 * 60 * 60 * 1e3).toISOString();
|
|
101
105
|
const updatedConfig = {
|
|
102
106
|
...config,
|
|
103
107
|
auth: {
|
|
@@ -106,11 +110,12 @@ async function login(ctx) {
|
|
|
106
110
|
expiresAt
|
|
107
111
|
}
|
|
108
112
|
};
|
|
109
|
-
await
|
|
113
|
+
await _chunkWQSWU2QAcjs.saveConfig.call(void 0, updatedConfig);
|
|
110
114
|
console.log();
|
|
111
115
|
console.log(_chalk2.default.green("Login successful!"));
|
|
112
116
|
console.log(_chalk2.default.cyan(`Welcome, ${pollResult.user.name || pollResult.user.email}!`));
|
|
113
117
|
console.log();
|
|
118
|
+
await checkAndRestoreSyncData(pollResult.token, pollResult.user.id, updatedConfig);
|
|
114
119
|
return null;
|
|
115
120
|
}
|
|
116
121
|
if (pollResult.status === "expired") {
|
|
@@ -123,6 +128,57 @@ async function login(ctx) {
|
|
|
123
128
|
console.log(_chalk2.default.red("Authorization timed out. Please try again."));
|
|
124
129
|
return null;
|
|
125
130
|
}
|
|
131
|
+
async function checkAndRestoreSyncData(token, userId, config) {
|
|
132
|
+
try {
|
|
133
|
+
const syncService = _chunkXFPITUFJcjs.createSyncService.call(void 0, {
|
|
134
|
+
authToken: token,
|
|
135
|
+
userId,
|
|
136
|
+
config: {
|
|
137
|
+
..._chunkXFPITUFJcjs.DEFAULT_SYNC_CONFIG,
|
|
138
|
+
...config.sync,
|
|
139
|
+
enabled: true
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
const { getSyncApiClient } = await Promise.resolve().then(() => _interopRequireWildcard(require("./SyncApiClient-UOA4VLLD.cjs")));
|
|
143
|
+
const apiClient = getSyncApiClient();
|
|
144
|
+
const remoteManifest = await apiClient.getRemoteManifest(token);
|
|
145
|
+
if (!remoteManifest || remoteManifest.files.length === 0) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const fileCount = remoteManifest.files.length;
|
|
149
|
+
const totalSize = remoteManifest.files.reduce((sum, f) => sum + f.size, 0);
|
|
150
|
+
const sizeStr = formatSize(totalSize);
|
|
151
|
+
console.log(_chalk2.default.cyan(`Found cloud sync data (${fileCount} files, ${sizeStr})`));
|
|
152
|
+
console.log(_chalk2.default.gray("This includes your settings, agents, skills, and memory."));
|
|
153
|
+
console.log();
|
|
154
|
+
const result = await _chunk3HPUOQJNcjs.safePrompt.call(void 0, {
|
|
155
|
+
type: "confirm",
|
|
156
|
+
name: "restore",
|
|
157
|
+
message: "Would you like to restore your settings from the cloud?",
|
|
158
|
+
initial: true
|
|
159
|
+
});
|
|
160
|
+
if (!result || !result.restore) {
|
|
161
|
+
console.log(_chalk2.default.gray("Skipped sync restore. You can sync later with /sync."));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
console.log(_chalk2.default.gray("Restoring settings from cloud..."));
|
|
165
|
+
const syncResult = await syncService.forceDownload();
|
|
166
|
+
if (syncResult.success) {
|
|
167
|
+
console.log(_chalk2.default.green(`Restored ${syncResult.downloaded} files from cloud.`));
|
|
168
|
+
} else {
|
|
169
|
+
console.log(_chalk2.default.yellow(`Sync restore failed: ${syncResult.error}`));
|
|
170
|
+
console.log(_chalk2.default.gray("You can try again later with /sync."));
|
|
171
|
+
}
|
|
172
|
+
} catch (error) {
|
|
173
|
+
console.log(_chalk2.default.gray("Could not check cloud sync data."));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
function formatSize(bytes) {
|
|
177
|
+
if (bytes === 0) return "0 B";
|
|
178
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
179
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
180
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
181
|
+
}
|
|
126
182
|
|
|
127
183
|
|
|
128
184
|
|