@kaitranntt/ccs 7.65.3 → 7.66.0-dev.2

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.
Files changed (245) hide show
  1. package/README.md +88 -750
  2. package/dist/api/services/profile-lifecycle-service.d.ts.map +1 -1
  3. package/dist/api/services/profile-lifecycle-service.js +4 -0
  4. package/dist/api/services/profile-lifecycle-service.js.map +1 -1
  5. package/dist/api/services/profile-writer.d.ts.map +1 -1
  6. package/dist/api/services/profile-writer.js +3 -0
  7. package/dist/api/services/profile-writer.js.map +1 -1
  8. package/dist/auth/auth-commands.d.ts +1 -0
  9. package/dist/auth/auth-commands.d.ts.map +1 -1
  10. package/dist/auth/auth-commands.js +11 -0
  11. package/dist/auth/auth-commands.js.map +1 -1
  12. package/dist/auth/commands/backup-command.d.ts +3 -0
  13. package/dist/auth/commands/backup-command.d.ts.map +1 -0
  14. package/dist/auth/commands/backup-command.js +126 -0
  15. package/dist/auth/commands/backup-command.js.map +1 -0
  16. package/dist/auth/commands/index.d.ts +1 -0
  17. package/dist/auth/commands/index.d.ts.map +1 -1
  18. package/dist/auth/commands/index.js +3 -1
  19. package/dist/auth/commands/index.js.map +1 -1
  20. package/dist/auth/profile-continuity-inheritance.d.ts +1 -0
  21. package/dist/auth/profile-continuity-inheritance.d.ts.map +1 -1
  22. package/dist/auth/profile-continuity-inheritance.js +10 -6
  23. package/dist/auth/profile-continuity-inheritance.js.map +1 -1
  24. package/dist/auth/profile-detector.d.ts +9 -1
  25. package/dist/auth/profile-detector.d.ts.map +1 -1
  26. package/dist/auth/profile-detector.js +35 -0
  27. package/dist/auth/profile-detector.js.map +1 -1
  28. package/dist/auth/resume-lane-diagnostics.d.ts +21 -0
  29. package/dist/auth/resume-lane-diagnostics.d.ts.map +1 -0
  30. package/dist/auth/resume-lane-diagnostics.js +146 -0
  31. package/dist/auth/resume-lane-diagnostics.js.map +1 -0
  32. package/dist/auth/resume-lane-warning.d.ts +9 -0
  33. package/dist/auth/resume-lane-warning.d.ts.map +1 -0
  34. package/dist/auth/resume-lane-warning.js +60 -0
  35. package/dist/auth/resume-lane-warning.js.map +1 -0
  36. package/dist/ccs.js +82 -7
  37. package/dist/ccs.js.map +1 -1
  38. package/dist/cliproxy/auth/auth-types.d.ts +29 -6
  39. package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
  40. package/dist/cliproxy/auth/auth-types.js +58 -10
  41. package/dist/cliproxy/auth/auth-types.js.map +1 -1
  42. package/dist/cliproxy/auth/oauth-handler.d.ts +9 -1
  43. package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
  44. package/dist/cliproxy/auth/oauth-handler.js +196 -45
  45. package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
  46. package/dist/cliproxy/auth/oauth-process.d.ts +13 -1
  47. package/dist/cliproxy/auth/oauth-process.d.ts.map +1 -1
  48. package/dist/cliproxy/auth/oauth-process.js +262 -17
  49. package/dist/cliproxy/auth/oauth-process.js.map +1 -1
  50. package/dist/cliproxy/executor/env-resolver.d.ts +3 -0
  51. package/dist/cliproxy/executor/env-resolver.d.ts.map +1 -1
  52. package/dist/cliproxy/executor/env-resolver.js +19 -1
  53. package/dist/cliproxy/executor/env-resolver.js.map +1 -1
  54. package/dist/cliproxy/executor/index.d.ts +5 -0
  55. package/dist/cliproxy/executor/index.d.ts.map +1 -1
  56. package/dist/cliproxy/executor/index.js +138 -12
  57. package/dist/cliproxy/executor/index.js.map +1 -1
  58. package/dist/cliproxy/gemini-cli-quota-normalizer.d.ts +10 -0
  59. package/dist/cliproxy/gemini-cli-quota-normalizer.d.ts.map +1 -0
  60. package/dist/cliproxy/gemini-cli-quota-normalizer.js +122 -0
  61. package/dist/cliproxy/gemini-cli-quota-normalizer.js.map +1 -0
  62. package/dist/cliproxy/quota-fetcher-gemini-cli.d.ts.map +1 -1
  63. package/dist/cliproxy/quota-fetcher-gemini-cli.js +133 -92
  64. package/dist/cliproxy/quota-fetcher-gemini-cli.js.map +1 -1
  65. package/dist/cliproxy/quota-types.d.ts +8 -0
  66. package/dist/cliproxy/quota-types.d.ts.map +1 -1
  67. package/dist/cliproxy/services/variant-settings.d.ts.map +1 -1
  68. package/dist/cliproxy/services/variant-settings.js +11 -0
  69. package/dist/cliproxy/services/variant-settings.js.map +1 -1
  70. package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
  71. package/dist/commands/cliproxy/quota-subcommand.js +10 -1
  72. package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
  73. package/dist/commands/command-catalog.d.ts +39 -0
  74. package/dist/commands/command-catalog.d.ts.map +1 -0
  75. package/dist/commands/command-catalog.js +299 -0
  76. package/dist/commands/command-catalog.js.map +1 -0
  77. package/dist/commands/completion-backend.d.ts +14 -0
  78. package/dist/commands/completion-backend.d.ts.map +1 -0
  79. package/dist/commands/completion-backend.js +216 -0
  80. package/dist/commands/completion-backend.js.map +1 -0
  81. package/dist/commands/cursor-command-display.d.ts.map +1 -1
  82. package/dist/commands/cursor-command-display.js +25 -5
  83. package/dist/commands/cursor-command-display.js.map +1 -1
  84. package/dist/commands/cursor-command.d.ts +1 -3
  85. package/dist/commands/cursor-command.d.ts.map +1 -1
  86. package/dist/commands/cursor-command.js +3 -15
  87. package/dist/commands/cursor-command.js.map +1 -1
  88. package/dist/commands/help-command.d.ts +4 -3
  89. package/dist/commands/help-command.d.ts.map +1 -1
  90. package/dist/commands/help-command.js +209 -503
  91. package/dist/commands/help-command.js.map +1 -1
  92. package/dist/commands/install-command.d.ts.map +1 -1
  93. package/dist/commands/install-command.js +16 -3
  94. package/dist/commands/install-command.js.map +1 -1
  95. package/dist/commands/root-command-router.d.ts +2 -0
  96. package/dist/commands/root-command-router.d.ts.map +1 -1
  97. package/dist/commands/root-command-router.js +13 -13
  98. package/dist/commands/root-command-router.js.map +1 -1
  99. package/dist/commands/shell-completion-command.d.ts +1 -0
  100. package/dist/commands/shell-completion-command.d.ts.map +1 -1
  101. package/dist/commands/shell-completion-command.js +27 -11
  102. package/dist/commands/shell-completion-command.js.map +1 -1
  103. package/dist/copilot/copilot-executor.d.ts +2 -0
  104. package/dist/copilot/copilot-executor.d.ts.map +1 -1
  105. package/dist/copilot/copilot-executor.js +36 -4
  106. package/dist/copilot/copilot-executor.js.map +1 -1
  107. package/dist/cursor/constants.d.ts +3 -0
  108. package/dist/cursor/constants.d.ts.map +1 -0
  109. package/dist/cursor/constants.js +20 -0
  110. package/dist/cursor/constants.js.map +1 -0
  111. package/dist/cursor/cursor-models.d.ts.map +1 -1
  112. package/dist/cursor/cursor-models.js +2 -0
  113. package/dist/cursor/cursor-models.js.map +1 -1
  114. package/dist/cursor/cursor-profile-executor.d.ts +10 -0
  115. package/dist/cursor/cursor-profile-executor.d.ts.map +1 -0
  116. package/dist/cursor/cursor-profile-executor.js +158 -0
  117. package/dist/cursor/cursor-profile-executor.js.map +1 -0
  118. package/dist/cursor/cursor-translator.d.ts +22 -11
  119. package/dist/cursor/cursor-translator.d.ts.map +1 -1
  120. package/dist/cursor/cursor-translator.js +254 -75
  121. package/dist/cursor/cursor-translator.js.map +1 -1
  122. package/dist/cursor/index.d.ts +1 -0
  123. package/dist/cursor/index.d.ts.map +1 -1
  124. package/dist/cursor/index.js +4 -1
  125. package/dist/cursor/index.js.map +1 -1
  126. package/dist/delegation/headless-executor.d.ts.map +1 -1
  127. package/dist/delegation/headless-executor.js +79 -2
  128. package/dist/delegation/headless-executor.js.map +1 -1
  129. package/dist/management/checks/image-analysis-check.d.ts.map +1 -1
  130. package/dist/management/checks/image-analysis-check.js +4 -5
  131. package/dist/management/checks/image-analysis-check.js.map +1 -1
  132. package/dist/management/instance-manager.js +1 -1
  133. package/dist/management/instance-manager.js.map +1 -1
  134. package/dist/shared/claude-extension-setup.d.ts.map +1 -1
  135. package/dist/shared/claude-extension-setup.js +36 -16
  136. package/dist/shared/claude-extension-setup.js.map +1 -1
  137. package/dist/targets/target-runtime-compatibility.d.ts.map +1 -1
  138. package/dist/targets/target-runtime-compatibility.js +6 -0
  139. package/dist/targets/target-runtime-compatibility.js.map +1 -1
  140. package/dist/types/profile.d.ts +1 -1
  141. package/dist/types/profile.d.ts.map +1 -1
  142. package/dist/ui/assets/accounts-l__hcQUq.js +1 -0
  143. package/dist/ui/assets/{alert-dialog-D0EFRcfB.js → alert-dialog-BtM3eP43.js} +1 -1
  144. package/dist/ui/assets/{api-DhM3BYXr.js → api-Ddwn7EXC.js} +1 -1
  145. package/dist/ui/assets/{auth-section-DVp8FQGm.js → auth-section-BnYn1EA3.js} +1 -1
  146. package/dist/ui/assets/{backups-section-CRo0NZkA.js → backups-section-M4jx3HzK.js} +1 -1
  147. package/dist/ui/assets/{channels-uZ_9CBqO.js → channels-D9ywyAj3.js} +1 -1
  148. package/dist/ui/assets/{checkbox-32DNqW_Q.js → checkbox-Df-yoPbe.js} +1 -1
  149. package/dist/ui/assets/{claude-extension-BfXlz5gV.js → claude-extension-Cxg0a-Ee.js} +1 -1
  150. package/dist/ui/assets/cliproxy-DPFdpIHy.js +3 -0
  151. package/dist/ui/assets/{cliproxy-ai-providers-5SHLMHiy.js → cliproxy-ai-providers-DtW-6cPc.js} +6 -6
  152. package/dist/ui/assets/cliproxy-control-panel-0TyLDMf7.js +1 -0
  153. package/dist/ui/assets/{codex-CRUSpjsu.js → codex-BtPojOrJ.js} +3 -3
  154. package/dist/ui/assets/{confirm-dialog-DVf5ZmCZ.js → confirm-dialog-BMwFBq5G.js} +1 -1
  155. package/dist/ui/assets/{copilot-BZrihl_Z.js → copilot-BG3BnHxa.js} +2 -2
  156. package/dist/ui/assets/{cursor-BP4nbEk_.js → cursor-BfDO73Lu.js} +1 -1
  157. package/dist/ui/assets/{droid-BG92rdM2.js → droid-iW-Vtuhy.js} +2 -2
  158. package/dist/ui/assets/{globalenv-section-Cf6dKgSf.js → globalenv-section-d9h23hIf.js} +1 -1
  159. package/dist/ui/assets/{health-BTy1UZs3.js → health-BPPMFQMR.js} +1 -1
  160. package/dist/ui/assets/icons-BxSzn11s.js +1 -0
  161. package/dist/ui/assets/index-B6Y8wFQ0.css +1 -0
  162. package/dist/ui/assets/{index-wg7UtkFv.js → index-BPyp9RJE.js} +1 -1
  163. package/dist/ui/assets/{index-DHrTq-0n.js → index-CctYE17X.js} +1 -1
  164. package/dist/ui/assets/{index-BVeN0dIB.js → index-CeP2Pr2w.js} +1 -1
  165. package/dist/ui/assets/{index-DuRYaONg.js → index-DYY3wcwk.js} +1 -1
  166. package/dist/ui/assets/{index-N2ZSJurX.js → index-DusmDwkD.js} +1 -1
  167. package/dist/ui/assets/index-wIy8qzU9.js +69 -0
  168. package/dist/ui/assets/{masked-input-DX9bedLy.js → masked-input-DWNtAEKs.js} +1 -1
  169. package/dist/ui/assets/{proxy-status-widget-DVDMuZK5.js → proxy-status-widget-GS3qroms.js} +1 -1
  170. package/dist/ui/assets/{radix-ui-C98W0NRG.js → radix-ui-Zb8sVEtn.js} +1 -1
  171. package/dist/ui/assets/{raw-json-settings-editor-panel-Dkt5E6Z_.js → raw-json-settings-editor-panel-e3Ziu5B1.js} +1 -1
  172. package/dist/ui/assets/{searchable-select-BP3Q1-Yn.js → searchable-select-D2G6gg3h.js} +1 -1
  173. package/dist/ui/assets/{separator-BLGGUlh9.js → separator-CR1SGLxF.js} +1 -1
  174. package/dist/ui/assets/{shared-G0XRyLig.js → shared-BpB5GiWS.js} +1 -1
  175. package/dist/ui/assets/{table-B4lRrWC-.js → table-BMbwptG_.js} +1 -1
  176. package/dist/ui/assets/{tanstack-CfKik0yL.js → tanstack-DWm6aJ-G.js} +1 -1
  177. package/dist/ui/assets/{updates--A2Sdo7N.js → updates-iC3kvbKP.js} +1 -1
  178. package/dist/ui/index.html +5 -5
  179. package/dist/utils/config-manager.d.ts +5 -0
  180. package/dist/utils/config-manager.d.ts.map +1 -1
  181. package/dist/utils/config-manager.js +10 -1
  182. package/dist/utils/config-manager.js.map +1 -1
  183. package/dist/utils/hooks/get-image-analysis-hook-env.d.ts +26 -0
  184. package/dist/utils/hooks/get-image-analysis-hook-env.d.ts.map +1 -1
  185. package/dist/utils/hooks/get-image-analysis-hook-env.js +79 -1
  186. package/dist/utils/hooks/get-image-analysis-hook-env.js.map +1 -1
  187. package/dist/utils/hooks/image-analysis-backend-resolver.d.ts.map +1 -1
  188. package/dist/utils/hooks/image-analysis-backend-resolver.js +13 -5
  189. package/dist/utils/hooks/image-analysis-backend-resolver.js.map +1 -1
  190. package/dist/utils/hooks/image-analysis-runtime-status.d.ts +2 -0
  191. package/dist/utils/hooks/image-analysis-runtime-status.d.ts.map +1 -1
  192. package/dist/utils/hooks/image-analysis-runtime-status.js +15 -11
  193. package/dist/utils/hooks/image-analysis-runtime-status.js.map +1 -1
  194. package/dist/utils/hooks/image-analyzer-hook-installer.d.ts.map +1 -1
  195. package/dist/utils/hooks/image-analyzer-hook-installer.js +60 -27
  196. package/dist/utils/hooks/image-analyzer-hook-installer.js.map +1 -1
  197. package/dist/utils/hooks/image-analyzer-profile-hook-injector.d.ts.map +1 -1
  198. package/dist/utils/hooks/image-analyzer-profile-hook-injector.js +3 -0
  199. package/dist/utils/hooks/image-analyzer-profile-hook-injector.js.map +1 -1
  200. package/dist/utils/hooks/index.d.ts +2 -1
  201. package/dist/utils/hooks/index.d.ts.map +1 -1
  202. package/dist/utils/hooks/index.js +14 -7
  203. package/dist/utils/hooks/index.js.map +1 -1
  204. package/dist/utils/image-analysis/claude-tool-args.d.ts +6 -0
  205. package/dist/utils/image-analysis/claude-tool-args.d.ts.map +1 -0
  206. package/dist/utils/image-analysis/claude-tool-args.js +65 -0
  207. package/dist/utils/image-analysis/claude-tool-args.js.map +1 -0
  208. package/dist/utils/image-analysis/index.d.ts +4 -0
  209. package/dist/utils/image-analysis/index.d.ts.map +1 -1
  210. package/dist/utils/image-analysis/index.js +20 -1
  211. package/dist/utils/image-analysis/index.js.map +1 -1
  212. package/dist/utils/image-analysis/mcp-installer.d.ts +18 -0
  213. package/dist/utils/image-analysis/mcp-installer.d.ts.map +1 -0
  214. package/dist/utils/image-analysis/mcp-installer.js +447 -0
  215. package/dist/utils/image-analysis/mcp-installer.js.map +1 -0
  216. package/dist/web-server/routes/account-routes.d.ts.map +1 -1
  217. package/dist/web-server/routes/account-routes.js +14 -2
  218. package/dist/web-server/routes/account-routes.js.map +1 -1
  219. package/dist/web-server/routes/auth-routes.d.ts +10 -0
  220. package/dist/web-server/routes/auth-routes.d.ts.map +1 -1
  221. package/dist/web-server/routes/auth-routes.js +33 -6
  222. package/dist/web-server/routes/auth-routes.js.map +1 -1
  223. package/dist/web-server/routes/cliproxy-auth-routes.d.ts +8 -0
  224. package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
  225. package/dist/web-server/routes/cliproxy-auth-routes.js +141 -11
  226. package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
  227. package/dist/web-server/routes/image-analysis-routes.d.ts.map +1 -1
  228. package/dist/web-server/routes/image-analysis-routes.js +30 -5
  229. package/dist/web-server/routes/image-analysis-routes.js.map +1 -1
  230. package/lib/hooks/image-analysis-runtime.cjs +469 -0
  231. package/lib/hooks/image-analyzer-transformer.cjs +27 -418
  232. package/lib/hooks/websearch-transformer.cjs +37 -2
  233. package/lib/mcp/ccs-image-analysis-server.cjs +440 -0
  234. package/package.json +1 -1
  235. package/scripts/completion/README.md +55 -131
  236. package/scripts/completion/ccs.bash +22 -190
  237. package/scripts/completion/ccs.fish +19 -245
  238. package/scripts/completion/ccs.ps1 +37 -427
  239. package/scripts/completion/ccs.zsh +27 -305
  240. package/dist/ui/assets/accounts-BHEYnq6b.js +0 -1
  241. package/dist/ui/assets/cliproxy-DjNY9H-U.js +0 -3
  242. package/dist/ui/assets/cliproxy-control-panel-Zax_m1AC.js +0 -1
  243. package/dist/ui/assets/icons-CeH5899d.js +0 -1
  244. package/dist/ui/assets/index-B6SrL1O-.css +0 -1
  245. package/dist/ui/assets/index-Corv1lSo.js +0 -69
@@ -1,319 +1,41 @@
1
1
  #compdef ccs
2
2
 
3
3
  # Zsh completion for CCS (Claude Code Switch)
4
- # Compatible with zsh 5.0+
5
- #
6
- # Installation:
7
- # Add to ~/.zshrc:
8
- # fpath=(~/.zsh/completion $fpath)
9
- # autoload -Uz compinit && compinit
10
- # source /path/to/ccs/scripts/completion/ccs.zsh
11
- #
12
- # Or install system-wide:
13
- # sudo cp scripts/completion/ccs.zsh /usr/local/share/zsh/site-functions/_ccs
14
-
15
- # Set up completion styles for better formatting and colors
16
- zstyle ':completion:*:*:ccs:*:commands' list-colors '=(#b)(auth|api|cliproxy|doctor|env|sync|update)([[:space:]]#--[[:space:]]#*)==0\;34=2\;37'
17
- zstyle ':completion:*:*:ccs:*:proxy-profiles' list-colors '=(#b)(gemini|codex|agy|qwen)([[:space:]]#--[[:space:]]#*)==0\;35=2\;37'
18
- zstyle ':completion:*:*:ccs:*:model-profiles' list-colors '=(#b)(default|glm|kimi|[^[:space:]]##)([[:space:]]#--[[:space:]]#*)==0\;32=2\;37'
19
- zstyle ':completion:*:*:ccs:*:account-profiles' list-colors '=(#b)([^[:space:]]##)([[:space:]]#--[[:space:]]#*)==0\;33=2\;37'
20
- zstyle ':completion:*:*:ccs:*' group-name ''
21
- zstyle ':completion:*:*:ccs:*:descriptions' format $'\n%B%F{yellow}── %d ──%f%b'
22
- zstyle ':completion:*:*:ccs:*' list-separator ' -- '
23
- zstyle ':completion:*:*:ccs:*' list-rows-first true
24
- zstyle ':completion:*:*:ccs:*' menu select
25
4
 
26
5
  _ccs() {
27
- local -a commands proxy_profiles settings_profiles_described account_profiles_described cliproxy_variants_described
28
- local curcontext="$curcontext" state line
29
- typeset -A opt_args
30
-
31
- # Define top-level commands
32
- commands=(
33
- 'auth:Manage multiple Claude accounts'
34
- 'api:Manage API profiles (create/remove)'
35
- 'cliproxy:Manage CLIProxy variants and binary'
36
- 'doctor:Run health check and diagnostics'
37
- 'env:Export env vars for third-party tools'
38
- 'sync:Sync delegation commands and skills'
39
- 'update:Update CCS to latest version'
40
- )
41
-
42
- # Define CLIProxy hardcoded profiles (OAuth providers)
43
- proxy_profiles=(
44
- 'gemini:Google Gemini (OAuth)'
45
- 'codex:OpenAI Codex (OAuth)'
46
- 'agy:Antigravity (OAuth)'
47
- 'qwen:Qwen Code (OAuth)'
48
- 'iflow:iFlow (OAuth)'
49
- 'kiro:Kiro (OAuth)'
50
- 'ghcp:GitHub Copilot (OAuth)'
51
- 'claude:Claude Direct (OAuth)'
52
- )
53
-
54
- # Define known settings profiles with descriptions
55
- local -A profile_descriptions
56
- profile_descriptions=(
57
- 'default' 'Default Claude Sonnet 4.5'
58
- 'glm' 'GLM-4.6 (cost-optimized)'
59
- 'kimi' 'Kimi for Coding (long-context)'
60
- )
61
-
62
- # Load settings-based profiles from config.json
63
- if [[ -f ~/.ccs/config.json ]]; then
64
- local -a raw_settings_profiles
65
- raw_settings_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null)"})
66
-
67
- for profile in $raw_settings_profiles; do
68
- local desc="${profile_descriptions[$profile]:-Settings-based profile}"
69
- settings_profiles_described+=("${profile}:${desc}")
70
- done
6
+ local current
7
+ current="${words[CURRENT]}"
8
+
9
+ local -a tokens_before_current
10
+ if (( CURRENT > 2 )); then
11
+ tokens_before_current=("${words[@]:2:$((CURRENT-2))}")
12
+ else
13
+ tokens_before_current=()
71
14
  fi
72
15
 
73
- # Load account-based profiles from profiles.json
74
- if [[ -f ~/.ccs/profiles.json ]]; then
75
- local -a raw_account_profiles
76
- raw_account_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null)"})
77
-
78
- for profile in $raw_account_profiles; do
79
- account_profiles_described+=("${profile}:Account-based profile")
80
- done
81
- fi
82
-
83
- # Load cliproxy variants from config.json
84
- if [[ -f ~/.ccs/config.json ]]; then
85
- local -a raw_cliproxy_variants
86
- raw_cliproxy_variants=(${(f)"$(jq -r '.cliproxy | keys[]' ~/.ccs/config.json 2>/dev/null)"})
87
-
88
- for variant in $raw_cliproxy_variants; do
89
- cliproxy_variants_described+=("${variant}:CLIProxy variant")
90
- done
91
- fi
92
-
93
- _arguments -C \
94
- '(- *)'{-h,--help}'[Show help message]' \
95
- '(- *)'{-v,--version}'[Show version information]' \
96
- '(- *)'{-sc,--shell-completion}'[Install shell completion]' \
97
- '1: :->command' \
98
- '*:: :->args'
99
-
100
- case $state in
101
- command)
102
- _describe -t commands 'commands' commands
103
- _describe -t proxy-profiles 'CLIProxy profiles' proxy_profiles
104
- _describe -t model-profiles 'model profiles' settings_profiles_described
105
- _describe -t account-profiles 'account profiles' account_profiles_described
106
- _describe -t cliproxy-variants 'CLIProxy variants' cliproxy_variants_described
107
- ;;
108
-
109
- args)
110
- case $words[1] in
111
- auth)
112
- _ccs_auth
113
- ;;
114
- api)
115
- _ccs_api
116
- ;;
117
- cliproxy)
118
- _ccs_cliproxy
119
- ;;
120
- update)
121
- _arguments \
122
- '--force[Force reinstall current version]' \
123
- '--beta[Install from dev channel]' \
124
- '--dev[Install from dev channel]' \
125
- '(- *)'{-h,--help}'[Show help]'
126
- ;;
127
- doctor)
128
- _arguments \
129
- '(- *)'{-h,--help}'[Show help for doctor command]'
130
- ;;
131
- env)
132
- _arguments \
133
- '--format[Output format]:format:(openai anthropic raw)' \
134
- '--shell[Shell syntax]:shell:(auto bash zsh fish powershell)' \
135
- '(- *)'{-h,--help}'[Show help]' \
136
- '1:profile:($proxy_profiles ${(k)settings_profiles_described})'
137
- ;;
138
- gemini|codex|agy|qwen)
139
- _arguments \
140
- '--auth[Authenticate only]' \
141
- '--config[Change model configuration]' \
142
- '--logout[Clear authentication]' \
143
- '--headless[Headless auth (for SSH)]' \
144
- '(- *)'{-h,--help}'[Show help]'
145
- ;;
146
- --shell-completion|-sc)
147
- _arguments \
148
- '--bash[Install for bash]' \
149
- '--zsh[Install for zsh]' \
150
- '--fish[Install for fish]' \
151
- '--powershell[Install for PowerShell]'
152
- ;;
153
- *)
154
- _message 'Claude CLI arguments'
155
- ;;
156
- esac
157
- ;;
158
- esac
16
+ local -a suggestions
17
+ suggestions=("${(@f)$(__ccs_completion_run "${current}" "${tokens_before_current[@]}")}")
18
+ compadd -- "${suggestions[@]}"
159
19
  }
160
20
 
161
- _ccs_api() {
162
- local curcontext="$curcontext" state line
163
- typeset -A opt_args
164
-
165
- local -a api_commands settings_profiles
166
-
167
- api_commands=(
168
- 'create:Create new API profile (interactive)'
169
- 'list:List all API profiles'
170
- 'remove:Remove an API profile'
171
- )
172
-
173
- if [[ -f ~/.ccs/config.json ]]; then
174
- settings_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/config.json 2>/dev/null)"})
21
+ __ccs_completion_run() {
22
+ local current="$1"
23
+ shift || true
24
+
25
+ local script_path script_dir repo_root repo_cli
26
+ script_path="${(%):-%N}"
27
+ script_dir="${script_path:A:h}"
28
+ repo_root="${script_dir:h:h}"
29
+ repo_cli="${repo_root}/dist/ccs.js"
30
+ if [[ ! -f "${repo_cli}" ]]; then
31
+ repo_cli="${repo_root}/bin/ccs.js"
175
32
  fi
176
-
177
- _arguments -C \
178
- '(- *)'{-h,--help}'[Show help for api commands]' \
179
- '1: :->subcommand' \
180
- '*:: :->subargs'
181
-
182
- case $state in
183
- subcommand)
184
- _describe -t api-commands 'api commands' api_commands
185
- ;;
186
-
187
- subargs)
188
- case $words[1] in
189
- create)
190
- _arguments \
191
- '1:profile name:' \
192
- '--base-url[API base URL]:url:' \
193
- '--api-key[API key]:key:' \
194
- '--model[Default model]:model:' \
195
- '--force[Overwrite existing profile]' \
196
- {--yes,-y}'[Skip prompts]'
197
- ;;
198
- list)
199
- ;;
200
- remove|delete|rm)
201
- _arguments \
202
- '1:profile:($settings_profiles)' \
203
- {--yes,-y}'[Skip confirmation]'
204
- ;;
205
- esac
206
- ;;
207
- esac
208
- }
209
-
210
- _ccs_cliproxy() {
211
- local curcontext="$curcontext" state line
212
- typeset -A opt_args
213
-
214
- local -a cliproxy_commands cliproxy_variants providers
215
-
216
- cliproxy_commands=(
217
- 'create:Create new CLIProxy variant profile'
218
- 'list:List all CLIProxy variant profiles'
219
- 'remove:Remove a CLIProxy variant profile'
220
- )
221
-
222
- providers=(gemini codex agy qwen)
223
-
224
- if [[ -f ~/.ccs/config.json ]]; then
225
- cliproxy_variants=(${(f)"$(jq -r '.cliproxy | keys[]' ~/.ccs/config.json 2>/dev/null)"})
33
+ if [[ -f "${repo_cli}" ]]; then
34
+ node "${repo_cli}" __complete --shell zsh --current "${current}" -- "$@" 2>/dev/null
35
+ return 0
226
36
  fi
227
37
 
228
- _arguments -C \
229
- '(- *)'{-h,--help}'[Show help for cliproxy commands]' \
230
- '--install[Install specific version]:version:' \
231
- '--latest[Install latest version]' \
232
- '1: :->subcommand' \
233
- '*:: :->subargs'
234
-
235
- case $state in
236
- subcommand)
237
- _describe -t cliproxy-commands 'cliproxy commands' cliproxy_commands
238
- ;;
239
-
240
- subargs)
241
- case $words[1] in
242
- create)
243
- _arguments \
244
- '1:variant name:' \
245
- '--provider[Provider name]:provider:($providers)' \
246
- '--model[Model name]:model:' \
247
- '--force[Overwrite existing variant]' \
248
- {--yes,-y}'[Skip prompts]'
249
- ;;
250
- list|ls)
251
- ;;
252
- remove|delete|rm)
253
- _arguments \
254
- '1:variant:($cliproxy_variants)' \
255
- {--yes,-y}'[Skip confirmation]'
256
- ;;
257
- esac
258
- ;;
259
- esac
260
- }
261
-
262
- _ccs_auth() {
263
- local curcontext="$curcontext" state line
264
- typeset -A opt_args
265
-
266
- local -a auth_commands account_profiles
267
-
268
- auth_commands=(
269
- 'create:Create new profile and login'
270
- 'list:List all saved profiles'
271
- 'show:Show profile details'
272
- 'remove:Remove saved profile'
273
- 'default:Set default profile'
274
- )
275
-
276
- if [[ -f ~/.ccs/profiles.json ]]; then
277
- account_profiles=(${(f)"$(jq -r '.profiles | keys[]' ~/.ccs/profiles.json 2>/dev/null)"})
38
+ if (( $+commands[ccs] )); then
39
+ ccs __complete --shell zsh --current "${current}" -- "$@" 2>/dev/null
278
40
  fi
279
-
280
- _arguments -C \
281
- '(- *)'{-h,--help}'[Show help for auth commands]' \
282
- '1: :->subcommand' \
283
- '*:: :->subargs'
284
-
285
- case $state in
286
- subcommand)
287
- _describe -t auth-commands 'auth commands' auth_commands
288
- ;;
289
-
290
- subargs)
291
- case $words[1] in
292
- create)
293
- _message 'new profile name'
294
- _arguments '--force[Allow overwriting existing profile]'
295
- ;;
296
- list)
297
- _arguments \
298
- '--verbose[Show additional details]' \
299
- '--json[Output in JSON format]'
300
- ;;
301
- show)
302
- _arguments \
303
- '1:profile:($account_profiles)' \
304
- '--json[Output in JSON format]'
305
- ;;
306
- remove)
307
- _arguments \
308
- '1:profile:($account_profiles)' \
309
- {--yes,-y}'[Skip confirmation prompts]'
310
- ;;
311
- default)
312
- _arguments '1:profile:($account_profiles)'
313
- ;;
314
- esac
315
- ;;
316
- esac
317
41
  }
318
-
319
- _ccs "$@"
@@ -1 +0,0 @@
1
- import{j as e}from"./radix-ui-C98W0NRG.js";import{r as j,h as fe}from"./react-vendor-CNOkPC89.js";import{u as ye,a as L,b as z,e as be,f as B,g as Ne}from"./tanstack-CfKik0yL.js";import{T as Ce,a as ve,b as V,c as Pe,d as Ae,e as Se}from"./table-B4lRrWC-.js";import{Y as T,a as G,af as oe,ag as re,ah as ie,ai as le,aj as de,L as v,r as Z,s as I,t as Q,v as X,w as O,I as $,ax as De,d as u,C as A,j as S,k as D,_ as w,B as F,b as k,M as ue,N as xe,c as M,O as me,n as ke,x as W}from"./index-Corv1lSo.js";import{A as Te,a as _e,b as we,c as Me,d as Le,e as ze,f as Ge,g as Oe}from"./alert-dialog-D0EFRcfB.js";import{t as y}from"./notifications-B2HqRBj7.js";import{aT as Fe,aU as He,l as q,am as Re,N as $e,Y as qe,n as Y,aV as Ee,at as H,aW as Ue,aX as Ke,r as he,aY as Be,aM as Ve,U as Ze,a6 as J,Z as ee,T as Ie}from"./icons-CeH5899d.js";import{C as te}from"./checkbox-32DNqW_Q.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Qe(){return ye({queryKey:["accounts"],queryFn:()=>T.accounts.list(),select:s=>{const a=s.accounts.filter(i=>i.type!=="cliproxy"),t=s.accounts.length-a.length,c=a.filter(i=>i.context_mode==="shared").length,o=a.filter(i=>i.context_mode==="shared"&&i.continuity_mode==="deeper").length,x=Math.max(c-o,0),l=a.length-c,m=a.filter(i=>i.context_inferred).length,g=a.filter(i=>i.context_mode==="shared"&&i.continuity_mode!=="deeper"&&i.continuity_inferred).length,p=a.some(i=>i.name===s.default)?s.default:null;return{accounts:a,default:p,cliproxyCount:t,legacyContextCount:m,legacyContinuityCount:g,sharedCount:c,sharedStandardCount:x,deeperSharedCount:o,isolatedCount:l}}})}function Xe(){const s=L();return z({mutationFn:a=>T.accounts.setDefault(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),y.success(`Default account set to "${t}"`)},onError:a=>{y.error(a.message)}})}function We(){const s=L();return z({mutationFn:()=>T.accounts.resetDefault(),onSuccess:()=>{s.invalidateQueries({queryKey:["accounts"]}),y.success("Default account reset to CCS")},onError:a=>{y.error(a.message)}})}function Ye(){const s=L();return z({mutationFn:a=>T.accounts.delete(a),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]}),y.success(`Account "${t}" deleted`)},onError:a=>{y.error(a.message)}})}function ge(){const s=L();return z({mutationFn:({name:a,context_mode:t,context_group:c,continuity_mode:o})=>T.accounts.updateContext(a,{context_mode:t,context_group:c,continuity_mode:o}),onSuccess:(a,t)=>{s.invalidateQueries({queryKey:["accounts"]});const c=t.context_mode==="shared"?t.continuity_mode==="deeper"?`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, deeper continuity)`:`shared (${(t.context_group||"default").trim().toLowerCase().replace(/\s+/g,"-")}, standard)`:"isolated";y.success(`Updated "${t.name}" context to ${c}`)},onError:a=>{y.error(a.message)}})}function Je(){const s=L();return z({mutationFn:async a=>{const t=a.filter(c=>c.context_inferred||c.continuity_inferred);for(const c of t){const o=c.context_mode==="shared";await T.accounts.updateContext(c.name,{context_mode:o?"shared":"isolated",context_group:o?c.context_group||"default":void 0,continuity_mode:o?c.continuity_mode==="deeper"?"deeper":"standard":void 0})}return{updatedCount:t.length}},onSuccess:({updatedCount:a})=>{if(s.invalidateQueries({queryKey:["accounts"]}),a>0){y.success(`Confirmed explicit sync mode for ${a} legacy account${a>1?"s":""}`);return}y.info("No legacy accounts need confirmation")},onError:a=>{y.error(a.message)}})}const se=64,et=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function tt({account:s,onClose:a}){const{t}=G(),c=ge(),[o,x]=j.useState(s.context_mode==="shared"?"shared":"isolated"),[l,m]=j.useState(s.context_group||"default"),[g,p]=j.useState(s.continuity_mode==="deeper"?"deeper":"standard"),i=j.useMemo(()=>l.trim().toLowerCase().replace(/\s+/g,"-"),[l]),b=i.length>0&&i.length<=se&&et.test(i),f=o==="isolated"||b,n=()=>{f&&c.mutate({name:s.name,context_mode:o,context_group:o==="shared"?i:void 0,continuity_mode:o==="shared"?g:void 0},{onSuccess:()=>{a()}})},r=d=>{d||a()};return e.jsx(oe,{open:!0,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(ie,{children:[e.jsx(le,{children:t("editAccountContext.title")}),e.jsx(de,{children:t("editAccountContext.description",{name:s.name})})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"context-mode",children:t("editAccountContext.syncMode")}),e.jsxs(Z,{value:o,onValueChange:d=>x(d),children:[e.jsx(I,{id:"context-mode",children:e.jsx(Q,{placeholder:t("editAccountContext.selectContextMode")})}),e.jsxs(X,{children:[e.jsx(O,{value:"isolated",children:t("editAccountContext.isolatedOption")}),e.jsx(O,{value:"shared",children:t("editAccountContext.sharedOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(o==="shared"?"editAccountContext.sharedModeHint":"editAccountContext.isolatedModeHint")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"context-group",children:t("editAccountContext.historySyncGroup")}),e.jsx($,{id:"context-group",value:l,onChange:d=>m(d.target.value),placeholder:t("editAccountContext.groupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.groupHint",{max:se})}),!b&&e.jsx("p",{className:"text-xs text-destructive",children:t("editAccountContext.invalidGroup")})]}),o==="shared"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"continuity-mode",children:t("editAccountContext.continuityDepth")}),e.jsxs(Z,{value:g,onValueChange:d=>p(d),children:[e.jsx(I,{id:"continuity-mode",children:e.jsx(Q,{placeholder:t("editAccountContext.selectContinuityDepth")})}),e.jsxs(X,{children:[e.jsx(O,{value:"standard",children:t("editAccountContext.standardOption")}),e.jsx(O,{value:"deeper",children:t("editAccountContext.deeperOption")})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t(g==="deeper"?"editAccountContext.deeperHint":"editAccountContext.standardHint")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("editAccountContext.credentialsIsolated")})]}),e.jsxs(De,{children:[e.jsx(u,{variant:"outline",onClick:a,disabled:c.isPending,children:t("editAccountContext.cancel")}),e.jsx(u,{onClick:n,disabled:!f||c.isPending,children:c.isPending?t("editAccountContext.saving"):t("editAccountContext.save")})]})]})})}function ae({data:s,defaultAccount:a}){const{t}=G(),c=Xe(),o=Ye(),x=We(),l=ge(),[m,g]=j.useState(null),[p,i]=j.useState(null),b=[{accessorKey:"name",header:t("accountsTable.name"),size:200,cell:({row:n})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:n.original.name}),n.original.name===a&&e.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded border border-primary/20",children:t("accountsTable.defaultBadge")})]})},{accessorKey:"type",header:t("accountsTable.type"),size:100,cell:({row:n})=>e.jsx("span",{className:"capitalize text-muted-foreground",children:n.original.type||"oauth"})},{accessorKey:"created",header:t("accountsTable.created"),size:150,cell:({row:n})=>{const r=new Date(n.original.created);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{accessorKey:"last_used",header:t("accountsTable.lastUsed"),size:150,cell:({row:n})=>{if(!n.original.last_used)return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});const r=new Date(n.original.last_used);return e.jsx("span",{className:"text-muted-foreground",children:r.toLocaleDateString()})}},{id:"context",header:t("accountsTable.historySync"),size:170,cell:({row:n})=>{if(n.original.type==="cliproxy")return e.jsx("span",{className:"text-muted-foreground/50",children:"-"});if((n.original.context_mode||"isolated")==="shared"){const d=n.original.context_group||"default";return n.original.continuity_mode==="deeper"?e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupDeeper",{group:d})}):n.original.continuity_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.sharedGroupLegacy",{group:d})}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.sharedGroupStandard",{group:d})})}return n.original.context_inferred?e.jsx("span",{className:"text-amber-700 dark:text-amber-400",children:t("accountsTable.isolatedLegacy")}):e.jsx("span",{className:"text-muted-foreground",children:t("accountsTable.isolated")})}},{id:"actions",header:t("accountsTable.actions"),size:220,cell:({row:n})=>{const r=n.original.name===a,d=c.isPending||o.isPending||l.isPending,N=n.original.type==="cliproxy",P=n.original.context_inferred||n.original.continuity_inferred;return e.jsxs("div",{className:"flex items-center gap-1",children:[!N&&e.jsxs(u,{variant:"outline",size:"sm",className:"h-8 px-2",disabled:d,onClick:()=>i(n.original),title:t("accountsTable.syncTitle"),children:[e.jsx(Fe,{className:"w-3.5 h-3.5 mr-1"}),t("accountsTable.sync")]}),!N&&P&&e.jsxs(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-amber-700 hover:text-amber-700 hover:bg-amber-500/10 dark:text-amber-400 dark:hover:text-amber-400",disabled:d,onClick:()=>l.mutate({name:n.original.name,context_mode:n.original.context_mode==="shared"?"shared":"isolated",context_group:n.original.context_mode==="shared"?n.original.context_group||"default":void 0,continuity_mode:n.original.context_mode==="shared"?n.original.continuity_mode==="deeper"?"deeper":"standard":void 0}),title:t("accountsTable.confirmLegacyTitle"),children:[e.jsx(He,{className:"w-3 h-3 mr-1"}),t("accountsTable.confirm")]}),e.jsxs(u,{variant:r?"secondary":"default",size:"sm",className:"h-8 px-2",disabled:r||d,onClick:()=>c.mutate(n.original.name),children:[e.jsx(q,{className:`w-3 h-3 mr-1 ${r?"opacity-50":""}`}),t(r?"accountsTable.active":"accountsTable.setDefault")]}),e.jsx(u,{variant:"ghost",size:"sm",className:"h-8 px-2 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:r||d,onClick:()=>g(n.original.name),title:t(r?"accountsTable.cannotDeleteDefault":"accountsTable.deleteAccount"),children:e.jsx(Re,{className:"w-4 h-4"})})]})}}],f=be({data:s,columns:b,getCoreRowModel:Ne()});return s.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:t("accountsTable.noAccounts")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"border rounded-md",children:e.jsxs(Ce,{children:[e.jsx(ve,{children:f.getHeaderGroups().map(n=>e.jsx(V,{children:n.headers.map(r=>{const d={name:"w-[200px]",type:"w-[100px]",created:"w-[150px]",last_used:"w-[150px]",context:"w-[170px]",actions:"w-[290px]"}[r.id]||"w-auto";return e.jsx(Pe,{className:d,children:r.isPlaceholder?null:B(r.column.columnDef.header,r.getContext())},r.id)})},n.id))}),e.jsx(Ae,{children:f.getRowModel().rows.map(n=>e.jsx(V,{children:n.getVisibleCells().map(r=>e.jsx(Se,{children:B(r.column.columnDef.cell,r.getContext())},r.id))},n.id))})]})}),a&&e.jsx("div",{className:"flex justify-end",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:()=>x.mutate(),disabled:x.isPending,children:[e.jsx($e,{className:"w-4 h-4 mr-2"}),t("accountsTable.resetToDefault")]})})]}),p&&e.jsx(tt,{account:p,onClose:()=>i(null)}),e.jsx(Te,{open:!!m,onOpenChange:n=>!n&&g(null),children:e.jsxs(_e,{children:[e.jsxs(we,{children:[e.jsx(Me,{children:t("accountsTable.deleteDialogTitle")}),e.jsx(Le,{children:t("accountsTable.deleteDialogDesc",{name:m??""})})]}),e.jsxs(ze,{children:[e.jsx(Ge,{children:t("accountsTable.cancel")}),e.jsx(Oe,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{m&&(o.mutate(m),g(null))},children:t("accountsTable.delete")})]})]})})]})}const ne=64;function st({open:s,onClose:a}){const{t}=G(),[c,o]=j.useState(""),[x,l]=j.useState(!1),[m,g]=j.useState(""),[p,i]=j.useState(!1),[b,f]=j.useState(!1),n=/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(c),r=m.trim().toLowerCase().replace(/\s+/g,"-"),d=r.length===0||r.length<=ne&&/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(r),N=c&&n?[`ccs auth create ${c}`,x?r.length>0?`--context-group ${r}`:"--share-context":"",x&&p?"--deeper-continuity":""].filter(Boolean).join(" "):t("createAuthProfileDialog.commandFallback"),P=async()=>{!n||x&&!d||(await navigator.clipboard.writeText(N),f(!0),setTimeout(()=>f(!1),2e3))},_=()=>{o(""),l(!1),g(""),i(!1),f(!1),a()};return e.jsx(oe,{open:s,onOpenChange:h=>!h&&_(),children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(ie,{children:[e.jsx(le,{children:t("createAuthProfileDialog.title")}),e.jsx(de,{children:t("createAuthProfileDialog.description")})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"profile-name",children:t("createAuthProfileDialog.profileName")}),e.jsx($,{id:"profile-name",value:c,onChange:h=>o(h.target.value),placeholder:t("createAuthProfileDialog.profileNamePlaceholder"),autoComplete:"off"}),c&&!n&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidProfileName")})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{id:"share-context",checked:x,onCheckedChange:h=>l(h===!0)}),e.jsx(v,{htmlFor:"share-context",className:"cursor-pointer",children:t("createAuthProfileDialog.enableSharedHistory")})]}),x&&e.jsxs("div",{className:"space-y-2 pl-6",children:[e.jsx(v,{htmlFor:"context-group",children:t("createAuthProfileDialog.historySyncGroupOptional")}),e.jsx($,{id:"context-group",value:m,onChange:h=>g(h.target.value),placeholder:t("createAuthProfileDialog.historySyncGroupPlaceholder"),autoComplete:"off"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.historySyncGroupHint")}),e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(te,{id:"deeper-continuity",checked:p,onCheckedChange:h=>i(h===!0)}),e.jsx(v,{htmlFor:"deeper-continuity",className:"cursor-pointer",children:t("createAuthProfileDialog.deeperContinuity")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("createAuthProfileDialog.deeperContinuityHint")}),m.trim().length>0&&!d&&e.jsx("p",{className:"text-xs text-destructive",children:t("createAuthProfileDialog.invalidContextGroup",{max:ne})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{children:t("createAuthProfileDialog.command")}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-md font-mono text-sm",children:[e.jsx(qe,{className:"w-4 h-4 text-muted-foreground shrink-0"}),e.jsx("code",{className:"flex-1 break-all",children:N}),e.jsx(u,{variant:"ghost",size:"sm",className:"shrink-0 h-8 px-2",onClick:P,disabled:!n||x&&!d,children:b?e.jsx(q,{className:"w-4 h-4 text-green-500"}):e.jsx(Y,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"text-sm text-muted-foreground space-y-1",children:[e.jsx("p",{children:t("createAuthProfileDialog.afterRunPrefix")}),e.jsxs("ol",{className:"list-decimal list-inside pl-2 space-y-0.5",children:[e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep1")}),e.jsx("li",{children:t("createAuthProfileDialog.afterRunStep2")})]}),e.jsx("p",{className:"pt-1",children:t("createAuthProfileDialog.poolingHint")})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(u,{variant:"ghost",onClick:_,children:t("createAuthProfileDialog.close")}),e.jsx(u,{onClick:P,disabled:!n||x&&!d,children:b?e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copied")]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),t("createAuthProfileDialog.copyCommand")]})})]})]})]})})}function R({title:s,count:a,icon:t,tone:c}){const o={isolated:{border:"border-blue-300/60 bg-blue-50/40 dark:border-blue-900/40 dark:bg-blue-900/10",icon:"text-blue-700 dark:text-blue-400",count:"text-blue-700 dark:text-blue-400"},shared:{border:"border-emerald-300/60 bg-emerald-50/40 dark:border-emerald-900/40 dark:bg-emerald-900/10",icon:"text-emerald-700 dark:text-emerald-400",count:"text-emerald-700 dark:text-emerald-400"},deeper:{border:"border-indigo-300/60 bg-indigo-50/40 dark:border-indigo-900/40 dark:bg-indigo-900/10",icon:"text-indigo-700 dark:text-indigo-400",count:"text-indigo-700 dark:text-indigo-400"}};return e.jsxs("div",{className:M("rounded-md border p-2.5",o[c].border),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs font-semibold",children:s}),e.jsx(t,{className:M("h-3.5 w-3.5",o[c].icon)})]}),e.jsx("p",{className:M("mt-1 text-lg font-mono font-semibold",o[c].count),children:a})]})}function ce({isolatedCount:s,sharedStandardCount:a,deeperSharedCount:t,sharedGroups:c,legacyTargetCount:o,cliproxyCount:x}){const{t:l}=G(),[m,g]=j.useState(!1),p=c.length>0?c:["default"];return e.jsxs(A,{className:"border-dashed",children:[e.jsx(S,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{children:[e.jsx(D,{className:"text-base",children:l("historySyncLearningMap.title")}),e.jsx(w,{className:"mt-1",children:l("historySyncLearningMap.description")})]}),e.jsx(F,{variant:"outline",children:l("historySyncLearningMap.learningMap")})]})}),e.jsxs(k,{className:"space-y-3",children:[x>0&&e.jsx("div",{className:"rounded-md border border-blue-300/60 bg-blue-50/40 px-3 py-2 text-xs text-blue-800 dark:border-blue-900/40 dark:bg-blue-900/10 dark:text-blue-300",children:l("historySyncLearningMap.cliproxyManaged",{count:x})}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[1fr_auto_1fr_auto_1fr] sm:items-center",children:[e.jsx(R,{title:l("historySyncLearningMap.isolated"),count:s,icon:Ee,tone:"isolated"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(R,{title:l("historySyncLearningMap.shared"),count:a,icon:Ue,tone:"shared"}),e.jsx("div",{className:"hidden sm:flex justify-center text-muted-foreground",children:e.jsx(H,{className:"h-4 w-4"})}),e.jsx(R,{title:l("historySyncLearningMap.deeper"),count:t,icon:Ke,tone:"deeper"})]}),e.jsxs(ue,{open:m,onOpenChange:g,children:[e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-8 w-full justify-between rounded-md px-2 text-xs text-muted-foreground hover:bg-muted/40 hover:text-foreground",children:[e.jsx("span",{children:l("historySyncLearningMap.showDetails")}),e.jsx(he,{className:M("h-4 w-4 transition-transform",m&&"rotate-180")})]})}),e.jsxs(me,{className:"pt-2",children:[e.jsxs("div",{className:"grid gap-2 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Be,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:l("historySyncLearningMap.modeSwitch")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:l("historySyncLearningMap.modeSwitchDesc")})]}),e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ve,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"font-semibold",children:l("historySyncLearningMap.historySyncGroup")})]}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:l("historySyncLearningMap.historySyncGroupDesc")}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:p.map(i=>e.jsx(F,{variant:"outline",className:"font-mono text-[10px]",children:i},i))})]})]}),o>0&&e.jsx("div",{className:"mt-2 rounded-md border border-amber-500/50 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-300",children:l("historySyncLearningMap.legacyConfirmation",{count:o})})]})]})]})]})}function gt(){const{t:s}=G(),a=fe(),{data:t,isLoading:c}=Qe(),o=Je(),[x,l]=j.useState(!1),[m,g]=j.useState(!1),p=t?.accounts||[],i=t?.cliproxyCount||0,b=t?.legacyContextCount||0,f=t?.legacyContinuityCount||0,n=t?.sharedCount||0,r=t?.sharedStandardCount||0,d=t?.deeperSharedCount||0,N=t?.isolatedCount||0,P=Array.from(new Set(p.filter(C=>C.context_mode==="shared").map(C=>C.context_group||"default"))).sort((C,je)=>C.localeCompare(je)),_=p.filter(C=>C.context_inferred||C.continuity_inferred),h=_.length,pe=h>0,E=()=>a("/cliproxy?provider=claude"),U=()=>a("/cliproxy?provider=claude&action=auth"),K=()=>o.mutate(_);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden h-full min-h-0 lg:flex",children:[e.jsxs("div",{className:"w-80 border-r flex flex-col bg-muted/20 shrink-0",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ze,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("accountsPage.title")})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.manageSuffix")]})]}),e.jsx(ke,{className:"flex-1",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.primaryActions")}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:()=>l(!0),children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{size:"sm",className:"w-full justify-start",onClick:U,children:[e.jsx(ee,{className:"w-4 h-4 mr-2"}),s("accountsPage.authClaudeInPool")]}),e.jsxs(u,{variant:"outline",size:"sm",className:"w-full justify-start",onClick:E,children:[s("accountsPage.openClaudePoolSettings"),e.jsx(H,{className:"w-4 h-4 ml-auto"})]})]}),pe?e.jsxs("section",{className:"space-y-2",children:[e.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("accountsPage.migrationFollowup")}),e.jsxs("div",{className:"rounded-md border border-amber-500/50 bg-amber-500/10 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 mt-0.5 text-amber-700 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"space-y-1 text-xs",children:[b>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContextPending",{count:b})}),f>0&&e.jsx("p",{className:"text-amber-800 dark:text-amber-300",children:s("accountsPage.legacyContinuityPending",{count:f})})]})]}),e.jsx(u,{variant:"secondary",size:"sm",className:"w-full justify-start",onClick:K,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}):e.jsx("div",{className:"rounded-md border bg-background px-3 py-2 text-xs text-muted-foreground",children:s("accountsPage.noLegacyFollowup")}),e.jsx(ue,{open:m,onOpenChange:g,children:e.jsxs(A,{children:[e.jsx(S,{className:"pb-2",children:e.jsx(xe,{asChild:!0,children:e.jsxs(u,{variant:"ghost",className:"h-auto w-full justify-between px-0 py-0",children:[e.jsxs("div",{className:"text-left",children:[e.jsx(D,{className:"text-sm",children:s("accountsPage.continuityGuide")}),e.jsx(w,{className:"mt-1",children:s("accountsPage.expandWhenNeeded")})]}),e.jsx(he,{className:M("h-4 w-4 transition-transform",m&&"rotate-180")})]})})}),e.jsx(me,{children:e.jsxs(k,{className:"space-y-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedStandard")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.sharedStandardDesc")})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.sharedDeeper")}),e.jsxs("p",{className:"mt-1",children:[s("accountsPage.sharedDeeperPrefix")," ",e.jsx("code",{children:"session-env"}),","," ",e.jsx("code",{children:"file-history"}),", ",e.jsx("code",{children:"shell-snapshots"}),","," ",e.jsx("code",{children:"todos"}),"."]})]}),e.jsxs("div",{className:"rounded-md border p-2.5",children:[e.jsx("p",{className:"font-semibold text-foreground",children:s("accountsPage.isolated")}),e.jsx("p",{className:"mt-1",children:s("accountsPage.isolatedDesc")})]})]})})]})}),e.jsxs(A,{children:[e.jsxs(S,{className:"pb-2",children:[e.jsx(D,{className:"text-sm",children:s("accountsPage.quickCommands")}),e.jsx(w,{children:s("accountsPage.quickCommandsDesc")})]}),e.jsxs(k,{className:"space-y-2",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs auth create work --context-group sprint-a --deeper-continuity"}),e.jsx(W,{value:"ccs auth create work --context-group sprint-a --deeper-continuity",size:"icon"})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-2 font-mono text-[11px] flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 break-all",children:"ccs cliproxy auth claude"}),e.jsx(W,{value:"ccs cliproxy auth claude",size:"icon"})]})]})]})]})})]}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col bg-background",children:[e.jsxs("div",{className:"px-5 py-4 border-b bg-background",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(F,{variant:"outline",children:s("accountsPage.workspaceBadge")}),e.jsx(F,{variant:"secondary",children:s("accountsPage.historySyncBadge")})]}),e.jsx("h2",{className:"mt-2 text-xl font-semibold tracking-tight",children:s("accountsPage.authAccounts")}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[s("accountsPage.tableScopePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.tableScopeMiddle"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:s("accountsTable.sync")}),s("accountsPage.tableScopeSuffix")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 p-5 space-y-4 overflow-y-auto",children:[e.jsx(ce,{isolatedCount:N,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:P,legacyTargetCount:h,cliproxyCount:i}),e.jsxs(A,{className:"flex flex-col",children:[e.jsxs(S,{className:"pb-3",children:[e.jsx(D,{className:"text-lg",children:s("accountsPage.accountMatrix")}),e.jsx(w,{children:s("accountsPage.sharedTotalDesc",{count:n})})]}),e.jsx(k,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]})]})]}),e.jsxs("div",{className:"p-4 space-y-4 lg:hidden",children:[e.jsxs(A,{children:[e.jsxs(S,{children:[e.jsx(D,{className:"text-lg",children:s("accountsPage.title")}),e.jsxs(w,{children:[s("accountsPage.managePrefix"),e.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5",children:"ccs auth"}),s("accountsPage.mobileManageSuffix")]})]}),e.jsxs(k,{className:"space-y-2",children:[e.jsxs(u,{className:"w-full",onClick:()=>l(!0),children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),s("accountsPage.createAccount")]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:E,children:[s("accountsPage.openCliProxyClaudePool"),e.jsx(H,{className:"w-4 h-4 ml-2"})]}),e.jsxs(u,{variant:"outline",className:"w-full",onClick:U,children:[s("accountsPage.authClaudeInPool"),e.jsx(ee,{className:"w-4 h-4 ml-2"})]}),e.jsx(u,{variant:"outline",className:"w-full",onClick:K,disabled:o.isPending||h===0,children:o.isPending?s("accountsPage.confirmingLegacy"):s("accountsPage.confirmLegacy",{count:h})})]})]}),e.jsx(ce,{isolatedCount:N,sharedStandardCount:r,deeperSharedCount:d,sharedGroups:P,legacyTargetCount:h,cliproxyCount:i}),e.jsxs(A,{children:[e.jsx(S,{className:"pb-3",children:e.jsx(D,{className:"text-base",children:s("accountsPage.accountMatrix")})}),e.jsx(k,{children:c?e.jsx("div",{className:"text-muted-foreground",children:s("accountsPage.loadingAccounts")}):e.jsx(ae,{data:p,defaultAccount:t?.default??null})})]})]}),e.jsx(st,{open:x,onClose:()=>l(!1)})]})}export{gt as AccountsPage};