agor-live 0.3.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.
Files changed (297) hide show
  1. package/LICENSE +94 -0
  2. package/README.md +163 -0
  3. package/bin/agor-daemon.js +20 -0
  4. package/bin/agor.js +14 -0
  5. package/dist/cli/base-command.d.ts +29 -0
  6. package/dist/cli/base-command.js +41 -0
  7. package/dist/cli/commands/board/add-session.d.ts +15 -0
  8. package/dist/cli/commands/board/add-session.js +102 -0
  9. package/dist/cli/commands/board/list.d.ts +14 -0
  10. package/dist/cli/commands/board/list.js +74 -0
  11. package/dist/cli/commands/config/clear.d.ts +13 -0
  12. package/dist/cli/commands/config/clear.js +21 -0
  13. package/dist/cli/commands/config/get.d.ts +13 -0
  14. package/dist/cli/commands/config/get.js +41 -0
  15. package/dist/cli/commands/config/index.d.ts +13 -0
  16. package/dist/cli/commands/config/index.js +118 -0
  17. package/dist/cli/commands/config/set.d.ts +14 -0
  18. package/dist/cli/commands/config/set.js +50 -0
  19. package/dist/cli/commands/config/unset.d.ts +13 -0
  20. package/dist/cli/commands/config/unset.js +35 -0
  21. package/dist/cli/commands/daemon/index.d.ts +13 -0
  22. package/dist/cli/commands/daemon/index.js +65 -0
  23. package/dist/cli/commands/daemon/logs.d.ts +13 -0
  24. package/dist/cli/commands/daemon/logs.js +78 -0
  25. package/dist/cli/commands/daemon/restart.d.ts +13 -0
  26. package/dist/cli/commands/daemon/restart.js +177 -0
  27. package/dist/cli/commands/daemon/start.d.ts +13 -0
  28. package/dist/cli/commands/daemon/start.js +193 -0
  29. package/dist/cli/commands/daemon/status.d.ts +13 -0
  30. package/dist/cli/commands/daemon/status.js +93 -0
  31. package/dist/cli/commands/daemon/stop.d.ts +13 -0
  32. package/dist/cli/commands/daemon/stop.js +108 -0
  33. package/dist/cli/commands/init.d.ts +44 -0
  34. package/dist/cli/commands/init.js +459 -0
  35. package/dist/cli/commands/mcp/add.d.ts +26 -0
  36. package/dist/cli/commands/mcp/add.js +162 -0
  37. package/dist/cli/commands/mcp/list.d.ts +16 -0
  38. package/dist/cli/commands/mcp/list.js +89 -0
  39. package/dist/cli/commands/mcp/remove.d.ts +17 -0
  40. package/dist/cli/commands/mcp/remove.js +86 -0
  41. package/dist/cli/commands/mcp/show.d.ts +14 -0
  42. package/dist/cli/commands/mcp/show.js +131 -0
  43. package/dist/cli/commands/repo/add.d.ts +16 -0
  44. package/dist/cli/commands/repo/add.js +105 -0
  45. package/dist/cli/commands/repo/list.d.ts +17 -0
  46. package/dist/cli/commands/repo/list.js +99 -0
  47. package/dist/cli/commands/repo/rm.d.ts +17 -0
  48. package/dist/cli/commands/repo/rm.js +126 -0
  49. package/dist/cli/commands/repo/worktree/add.d.ts +21 -0
  50. package/dist/cli/commands/repo/worktree/add.js +145 -0
  51. package/dist/cli/commands/repo/worktree/list.d.ts +21 -0
  52. package/dist/cli/commands/repo/worktree/list.js +136 -0
  53. package/dist/cli/commands/session/list.d.ts +30 -0
  54. package/dist/cli/commands/session/list.js +204 -0
  55. package/dist/cli/commands/session/load-claude.d.ts +16 -0
  56. package/dist/cli/commands/session/load-claude.js +211 -0
  57. package/dist/cli/commands/user/create-admin.d.ts +13 -0
  58. package/dist/cli/commands/user/create-admin.js +65 -0
  59. package/dist/cli/commands/user/create.d.ts +16 -0
  60. package/dist/cli/commands/user/create.js +126 -0
  61. package/dist/cli/commands/user/delete.d.ts +16 -0
  62. package/dist/cli/commands/user/delete.js +77 -0
  63. package/dist/cli/commands/user/list.d.ts +13 -0
  64. package/dist/cli/commands/user/list.js +78 -0
  65. package/dist/cli/commands/user/update.d.ts +19 -0
  66. package/dist/cli/commands/user/update.js +149 -0
  67. package/dist/cli/hooks/command-not-found.d.ts +9 -0
  68. package/dist/cli/hooks/command-not-found.js +14 -0
  69. package/dist/cli/lib/banner.d.ts +25 -0
  70. package/dist/cli/lib/banner.js +25 -0
  71. package/dist/cli/lib/context.d.ts +27 -0
  72. package/dist/cli/lib/context.js +32 -0
  73. package/dist/cli/lib/daemon-manager.d.ts +48 -0
  74. package/dist/cli/lib/daemon-manager.js +109 -0
  75. package/dist/cli/lib/help.d.ts +13 -0
  76. package/dist/cli/lib/help.js +46 -0
  77. package/dist/core/agentic-tool-B_gFNpk5.d.ts +33 -0
  78. package/dist/core/agentic-tool-DsyX8diw.d.cts +33 -0
  79. package/dist/core/api/index.cjs +98 -0
  80. package/dist/core/api/index.d.cts +174 -0
  81. package/dist/core/api/index.d.ts +174 -0
  82. package/dist/core/api/index.js +62 -0
  83. package/dist/core/board-comment-BUm0fpmD.d.cts +134 -0
  84. package/dist/core/board-comment-gC_-twPx.d.ts +134 -0
  85. package/dist/core/claude/index.cjs +673 -0
  86. package/dist/core/claude/index.d.cts +124 -0
  87. package/dist/core/claude/index.d.ts +124 -0
  88. package/dist/core/claude/index.js +629 -0
  89. package/dist/core/config/browser.cjs +165 -0
  90. package/dist/core/config/browser.d.cts +289 -0
  91. package/dist/core/config/browser.d.ts +289 -0
  92. package/dist/core/config/browser.js +131 -0
  93. package/dist/core/config/index.cjs +518 -0
  94. package/dist/core/config/index.d.cts +246 -0
  95. package/dist/core/config/index.d.ts +246 -0
  96. package/dist/core/config/index.js +451 -0
  97. package/dist/core/db/index.cjs +3726 -0
  98. package/dist/core/db/index.d.cts +631 -0
  99. package/dist/core/db/index.d.ts +631 -0
  100. package/dist/core/db/index.js +3649 -0
  101. package/dist/core/dist/agentic-tool-B_gFNpk5.d.ts +33 -0
  102. package/dist/core/dist/agentic-tool-DsyX8diw.d.cts +33 -0
  103. package/dist/core/dist/api/index.cjs +98 -0
  104. package/dist/core/dist/api/index.d.cts +174 -0
  105. package/dist/core/dist/api/index.d.ts +174 -0
  106. package/dist/core/dist/api/index.js +62 -0
  107. package/dist/core/dist/board-comment-BUm0fpmD.d.cts +134 -0
  108. package/dist/core/dist/board-comment-gC_-twPx.d.ts +134 -0
  109. package/dist/core/dist/claude/index.cjs +673 -0
  110. package/dist/core/dist/claude/index.d.cts +124 -0
  111. package/dist/core/dist/claude/index.d.ts +124 -0
  112. package/dist/core/dist/claude/index.js +629 -0
  113. package/dist/core/dist/config/browser.cjs +165 -0
  114. package/dist/core/dist/config/browser.d.cts +289 -0
  115. package/dist/core/dist/config/browser.d.ts +289 -0
  116. package/dist/core/dist/config/browser.js +131 -0
  117. package/dist/core/dist/config/index.cjs +518 -0
  118. package/dist/core/dist/config/index.d.cts +246 -0
  119. package/dist/core/dist/config/index.d.ts +246 -0
  120. package/dist/core/dist/config/index.js +451 -0
  121. package/dist/core/dist/db/index.cjs +3726 -0
  122. package/dist/core/dist/db/index.d.cts +631 -0
  123. package/dist/core/dist/db/index.d.ts +631 -0
  124. package/dist/core/dist/db/index.js +3649 -0
  125. package/dist/core/dist/environment/variable-resolver.cjs +92 -0
  126. package/dist/core/dist/environment/variable-resolver.d.cts +52 -0
  127. package/dist/core/dist/environment/variable-resolver.d.ts +52 -0
  128. package/dist/core/dist/environment/variable-resolver.js +53 -0
  129. package/dist/core/dist/feathers/index.cjs +66 -0
  130. package/dist/core/dist/feathers/index.d.cts +7 -0
  131. package/dist/core/dist/feathers/index.d.ts +7 -0
  132. package/dist/core/dist/feathers/index.js +25 -0
  133. package/dist/core/dist/feathers-BzHEPnpl.d.cts +228 -0
  134. package/dist/core/dist/feathers-BzHEPnpl.d.ts +228 -0
  135. package/dist/core/dist/git/index.cjs +302 -0
  136. package/dist/core/dist/git/index.d.cts +137 -0
  137. package/dist/core/dist/git/index.d.ts +137 -0
  138. package/dist/core/dist/git/index.js +260 -0
  139. package/dist/core/dist/id-DMqyogFB.d.cts +131 -0
  140. package/dist/core/dist/id-DMqyogFB.d.ts +131 -0
  141. package/dist/core/dist/index.cjs +4653 -0
  142. package/dist/core/dist/index.d.cts +23 -0
  143. package/dist/core/dist/index.d.ts +23 -0
  144. package/dist/core/dist/index.js +4509 -0
  145. package/dist/core/dist/message-BoxZISHg.d.cts +120 -0
  146. package/dist/core/dist/message-DvBzHu7V.d.ts +120 -0
  147. package/dist/core/dist/permissions/index.cjs +112 -0
  148. package/dist/core/dist/permissions/index.d.cts +81 -0
  149. package/dist/core/dist/permissions/index.d.ts +81 -0
  150. package/dist/core/dist/permissions/index.js +85 -0
  151. package/dist/core/dist/repo-3CUrCRbq.d.cts +405 -0
  152. package/dist/core/dist/repo-CnvJ0B6-.d.ts +405 -0
  153. package/dist/core/dist/session-BPjJlVdZ.d.cts +429 -0
  154. package/dist/core/dist/session-wAzjHatv.d.ts +429 -0
  155. package/dist/core/dist/task-BIEgT1DK.d.cts +163 -0
  156. package/dist/core/dist/task-DuIfiUbW.d.ts +163 -0
  157. package/dist/core/dist/templates/handlebars-helpers.cjs +156 -0
  158. package/dist/core/dist/templates/handlebars-helpers.d.cts +45 -0
  159. package/dist/core/dist/templates/handlebars-helpers.d.ts +45 -0
  160. package/dist/core/dist/templates/handlebars-helpers.js +119 -0
  161. package/dist/core/dist/tools/claude/models.cjs +70 -0
  162. package/dist/core/dist/tools/claude/models.d.cts +27 -0
  163. package/dist/core/dist/tools/claude/models.d.ts +27 -0
  164. package/dist/core/dist/tools/claude/models.js +44 -0
  165. package/dist/core/dist/tools/index.cjs +3367 -0
  166. package/dist/core/dist/tools/index.d.cts +967 -0
  167. package/dist/core/dist/tools/index.d.ts +967 -0
  168. package/dist/core/dist/tools/index.js +3314 -0
  169. package/dist/core/dist/tools/models.cjs +119 -0
  170. package/dist/core/dist/tools/models.d.cts +47 -0
  171. package/dist/core/dist/tools/models.d.ts +47 -0
  172. package/dist/core/dist/tools/models.js +86 -0
  173. package/dist/core/dist/types/index.cjs +152 -0
  174. package/dist/core/dist/types/index.d.cts +214 -0
  175. package/dist/core/dist/types/index.d.ts +214 -0
  176. package/dist/core/dist/types/index.js +112 -0
  177. package/dist/core/dist/user-BmL3kFol.d.ts +50 -0
  178. package/dist/core/dist/user-eUuKj7yM.d.cts +50 -0
  179. package/dist/core/dist/utils/pricing.cjs +102 -0
  180. package/dist/core/dist/utils/pricing.d.cts +43 -0
  181. package/dist/core/dist/utils/pricing.d.ts +43 -0
  182. package/dist/core/dist/utils/pricing.js +75 -0
  183. package/dist/core/dist/worktrees-BzIxB1U6.d.cts +2745 -0
  184. package/dist/core/dist/worktrees-CYem1ya2.d.ts +2745 -0
  185. package/dist/core/environment/variable-resolver.cjs +92 -0
  186. package/dist/core/environment/variable-resolver.d.cts +52 -0
  187. package/dist/core/environment/variable-resolver.d.ts +52 -0
  188. package/dist/core/environment/variable-resolver.js +53 -0
  189. package/dist/core/feathers/index.cjs +66 -0
  190. package/dist/core/feathers/index.d.cts +7 -0
  191. package/dist/core/feathers/index.d.ts +7 -0
  192. package/dist/core/feathers/index.js +25 -0
  193. package/dist/core/feathers-BzHEPnpl.d.cts +228 -0
  194. package/dist/core/feathers-BzHEPnpl.d.ts +228 -0
  195. package/dist/core/git/index.cjs +302 -0
  196. package/dist/core/git/index.d.cts +137 -0
  197. package/dist/core/git/index.d.ts +137 -0
  198. package/dist/core/git/index.js +260 -0
  199. package/dist/core/id-DMqyogFB.d.cts +131 -0
  200. package/dist/core/id-DMqyogFB.d.ts +131 -0
  201. package/dist/core/index.cjs +4653 -0
  202. package/dist/core/index.d.cts +23 -0
  203. package/dist/core/index.d.ts +23 -0
  204. package/dist/core/index.js +4509 -0
  205. package/dist/core/message-BoxZISHg.d.cts +120 -0
  206. package/dist/core/message-DvBzHu7V.d.ts +120 -0
  207. package/dist/core/package.json +133 -0
  208. package/dist/core/permissions/index.cjs +112 -0
  209. package/dist/core/permissions/index.d.cts +81 -0
  210. package/dist/core/permissions/index.d.ts +81 -0
  211. package/dist/core/permissions/index.js +85 -0
  212. package/dist/core/repo-3CUrCRbq.d.cts +405 -0
  213. package/dist/core/repo-CnvJ0B6-.d.ts +405 -0
  214. package/dist/core/session-BPjJlVdZ.d.cts +429 -0
  215. package/dist/core/session-wAzjHatv.d.ts +429 -0
  216. package/dist/core/task-BIEgT1DK.d.cts +163 -0
  217. package/dist/core/task-DuIfiUbW.d.ts +163 -0
  218. package/dist/core/templates/handlebars-helpers.cjs +156 -0
  219. package/dist/core/templates/handlebars-helpers.d.cts +45 -0
  220. package/dist/core/templates/handlebars-helpers.d.ts +45 -0
  221. package/dist/core/templates/handlebars-helpers.js +119 -0
  222. package/dist/core/tools/claude/models.cjs +70 -0
  223. package/dist/core/tools/claude/models.d.cts +27 -0
  224. package/dist/core/tools/claude/models.d.ts +27 -0
  225. package/dist/core/tools/claude/models.js +44 -0
  226. package/dist/core/tools/index.cjs +3367 -0
  227. package/dist/core/tools/index.d.cts +967 -0
  228. package/dist/core/tools/index.d.ts +967 -0
  229. package/dist/core/tools/index.js +3314 -0
  230. package/dist/core/tools/models.cjs +119 -0
  231. package/dist/core/tools/models.d.cts +47 -0
  232. package/dist/core/tools/models.d.ts +47 -0
  233. package/dist/core/tools/models.js +86 -0
  234. package/dist/core/types/index.cjs +152 -0
  235. package/dist/core/types/index.d.cts +214 -0
  236. package/dist/core/types/index.d.ts +214 -0
  237. package/dist/core/types/index.js +112 -0
  238. package/dist/core/user-BmL3kFol.d.ts +50 -0
  239. package/dist/core/user-eUuKj7yM.d.cts +50 -0
  240. package/dist/core/utils/pricing.cjs +102 -0
  241. package/dist/core/utils/pricing.d.cts +43 -0
  242. package/dist/core/utils/pricing.d.ts +43 -0
  243. package/dist/core/utils/pricing.js +75 -0
  244. package/dist/core/worktrees-BzIxB1U6.d.cts +2745 -0
  245. package/dist/core/worktrees-CYem1ya2.d.ts +2745 -0
  246. package/dist/daemon/adapters/drizzle.d.ts +114 -0
  247. package/dist/daemon/adapters/drizzle.js +219 -0
  248. package/dist/daemon/declarations.d.ts +101 -0
  249. package/dist/daemon/declarations.js +0 -0
  250. package/dist/daemon/index.d.ts +2 -0
  251. package/dist/daemon/index.js +4093 -0
  252. package/dist/daemon/mcp/routes.d.ts +15 -0
  253. package/dist/daemon/mcp/routes.js +641 -0
  254. package/dist/daemon/mcp/tokens.d.ts +50 -0
  255. package/dist/daemon/mcp/tokens.js +85 -0
  256. package/dist/daemon/services/board-comments.d.ts +97 -0
  257. package/dist/daemon/services/board-comments.js +326 -0
  258. package/dist/daemon/services/board-objects.d.ts +71 -0
  259. package/dist/daemon/services/board-objects.js +117 -0
  260. package/dist/daemon/services/boards.d.ts +64 -0
  261. package/dist/daemon/services/boards.js +286 -0
  262. package/dist/daemon/services/config.d.ts +35 -0
  263. package/dist/daemon/services/config.js +68 -0
  264. package/dist/daemon/services/context.d.ts +55 -0
  265. package/dist/daemon/services/context.js +113 -0
  266. package/dist/daemon/services/health-monitor.d.ts +58 -0
  267. package/dist/daemon/services/health-monitor.js +158 -0
  268. package/dist/daemon/services/mcp-servers.d.ts +42 -0
  269. package/dist/daemon/services/mcp-servers.js +275 -0
  270. package/dist/daemon/services/messages.d.ts +49 -0
  271. package/dist/daemon/services/messages.js +269 -0
  272. package/dist/daemon/services/repos.d.ts +61 -0
  273. package/dist/daemon/services/repos.js +350 -0
  274. package/dist/daemon/services/session-mcp-servers.d.ts +56 -0
  275. package/dist/daemon/services/session-mcp-servers.js +51 -0
  276. package/dist/daemon/services/sessions.d.ts +64 -0
  277. package/dist/daemon/services/sessions.js +398 -0
  278. package/dist/daemon/services/tasks.d.ts +55 -0
  279. package/dist/daemon/services/tasks.js +318 -0
  280. package/dist/daemon/services/terminals.d.ts +75 -0
  281. package/dist/daemon/services/terminals.js +110 -0
  282. package/dist/daemon/services/users.d.ts +98 -0
  283. package/dist/daemon/services/users.js +177 -0
  284. package/dist/daemon/services/worktrees.d.ts +98 -0
  285. package/dist/daemon/services/worktrees.js +719 -0
  286. package/dist/daemon/strategies/anonymous.d.ts +20 -0
  287. package/dist/daemon/strategies/anonymous.js +32 -0
  288. package/dist/ui/assets/cc-CYmbalCD.png +0 -0
  289. package/dist/ui/assets/codex-4sLD1mVS.png +0 -0
  290. package/dist/ui/assets/cursor-BUy5pFVL.png +0 -0
  291. package/dist/ui/assets/gemini-ajOb7iAl.png +0 -0
  292. package/dist/ui/assets/index-Dc4ELxry.css +32 -0
  293. package/dist/ui/assets/index-KfIu8v4V.js +578 -0
  294. package/dist/ui/favicon.png +0 -0
  295. package/dist/ui/index.html +26 -0
  296. package/dist/ui/vite.svg +1 -0
  297. package/package.json +90 -0
@@ -0,0 +1,289 @@
1
+ import { R as RepoSlug, W as WorktreeName, a as Repo, c as Worktree } from '../repo-CnvJ0B6-.js';
2
+ import { U as UUID } from '../id-DMqyogFB.js';
3
+
4
+ /**
5
+ * Agor Configuration Types
6
+ */
7
+ /**
8
+ * Type for user-provided JSON data where structure is unknown or dynamic
9
+ *
10
+ * Use this instead of `any` when dealing with user input or dynamic data structures.
11
+ */
12
+ type UnknownJson = any;
13
+ /**
14
+ * Active CLI context (stateful)
15
+ *
16
+ * Values that change frequently during CLI usage.
17
+ */
18
+ interface AgorContext {
19
+ /** Active board (slug, ID, or name) */
20
+ board?: string;
21
+ /** Active session (full UUID or short ID) */
22
+ session?: string;
23
+ /** Active repo reference (path | slug | slug:worktree) */
24
+ repo?: string;
25
+ /** Preferred agent for new sessions */
26
+ agent?: string;
27
+ }
28
+ /**
29
+ * Global default values
30
+ */
31
+ interface AgorDefaults {
32
+ /** Default board for new sessions */
33
+ board?: string;
34
+ /** Default agent for new sessions */
35
+ agent?: string;
36
+ }
37
+ /**
38
+ * Display settings
39
+ */
40
+ interface AgorDisplaySettings {
41
+ /** Table style: unicode, ascii, or minimal */
42
+ tableStyle?: 'unicode' | 'ascii' | 'minimal';
43
+ /** Enable color output */
44
+ colorOutput?: boolean;
45
+ /** Short ID length (default: 8) */
46
+ shortIdLength?: number;
47
+ }
48
+ /**
49
+ * Daemon settings
50
+ */
51
+ interface AgorDaemonSettings {
52
+ /** Daemon port (default: 3030) */
53
+ port?: number;
54
+ /** Daemon host (default: localhost) */
55
+ host?: string;
56
+ /** Allow anonymous access (default: true for local mode) */
57
+ allowAnonymous?: boolean;
58
+ /** Require authentication for all requests (default: false) */
59
+ requireAuth?: boolean;
60
+ /** JWT secret (auto-generated if not provided) */
61
+ jwtSecret?: string;
62
+ }
63
+ /**
64
+ * UI settings
65
+ */
66
+ interface AgorUISettings {
67
+ /** UI dev server port (default: 5173) */
68
+ port?: number;
69
+ /** UI host (default: localhost) */
70
+ host?: string;
71
+ }
72
+ /**
73
+ * Tool credentials (API keys, tokens, etc.)
74
+ */
75
+ interface AgorCredentials {
76
+ /** Anthropic API key for Claude Code */
77
+ ANTHROPIC_API_KEY?: string;
78
+ /** Cursor API key (if needed) */
79
+ CURSOR_API_KEY?: string;
80
+ /** OpenAI API key for Codex */
81
+ OPENAI_API_KEY?: string;
82
+ /** Google Gemini API key */
83
+ GEMINI_API_KEY?: string;
84
+ }
85
+ /**
86
+ * Complete Agor configuration
87
+ */
88
+ interface AgorConfig {
89
+ /** Active context (stateful CLI) */
90
+ context?: AgorContext;
91
+ /** Global defaults */
92
+ defaults?: AgorDefaults;
93
+ /** Display settings */
94
+ display?: AgorDisplaySettings;
95
+ /** Daemon settings */
96
+ daemon?: AgorDaemonSettings;
97
+ /** UI settings */
98
+ ui?: AgorUISettings;
99
+ /** Tool credentials (API keys, tokens) */
100
+ credentials?: AgorCredentials;
101
+ }
102
+ /**
103
+ * Valid context keys that can be set/get
104
+ */
105
+ type ContextKey = keyof AgorContext;
106
+ /**
107
+ * Valid config keys (includes nested keys with dot notation)
108
+ */
109
+ type ConfigKey = ContextKey | `defaults.${keyof AgorDefaults}` | `display.${keyof AgorDisplaySettings}` | `daemon.${keyof AgorDaemonSettings}` | `ui.${keyof AgorUISettings}` | `credentials.${keyof AgorCredentials}`;
110
+
111
+ /**
112
+ * Repo List Utilities
113
+ *
114
+ * Generate flattened lists of repo references for UI selection
115
+ */
116
+
117
+ /**
118
+ * Repo reference option for UI selection
119
+ */
120
+ interface RepoReferenceOption {
121
+ /** Display label (e.g., "anthropics/agor:main" or "/Users/max/code/agor") */
122
+ label: string;
123
+ /** ID value for selection (repo_id or worktree_id) */
124
+ value: string;
125
+ /** Reference type */
126
+ type: 'path' | 'managed' | 'managed-worktree';
127
+ /** Repository slug (for managed repos) */
128
+ slug?: RepoSlug;
129
+ /** Worktree name (for managed worktrees) */
130
+ worktree?: WorktreeName;
131
+ /** Display description */
132
+ description?: string;
133
+ }
134
+ /**
135
+ * Generate a list of all repo reference options
136
+ *
137
+ * Creates options for:
138
+ * - Each managed repo (bare repo)
139
+ * - Each worktree of each managed repo
140
+ * - User paths can be added manually
141
+ *
142
+ * @param repos - List of Agor-managed repositories
143
+ * @param worktrees - List of worktrees (optional, now fetched from worktrees table)
144
+ * @returns Flattened list of selectable repo references
145
+ *
146
+ * @example
147
+ * const options = getRepoReferenceOptions(repos, worktrees);
148
+ * // [
149
+ * // { label: "anthropics/agor", value: "anthropics/agor", type: "managed", ... },
150
+ * // { label: "anthropics/agor:main", value: "anthropics/agor:main", type: "managed-worktree", ... },
151
+ * // { label: "anthropics/agor:feat-auth", value: "anthropics/agor:feat-auth", type: "managed-worktree", ... },
152
+ * // { label: "apache/superset", value: "apache/superset", type: "managed", ... },
153
+ * // { label: "apache/superset:main", value: "apache/superset:main", type: "managed-worktree", ... },
154
+ * // ]
155
+ */
156
+ declare function getRepoReferenceOptions(repos: Repo[], worktrees?: Worktree[]): RepoReferenceOption[];
157
+ /**
158
+ * Group repo reference options by repository
159
+ *
160
+ * Useful for hierarchical dropdowns/menus
161
+ *
162
+ * @param repos - List of Agor-managed repositories
163
+ * @param worktrees - List of worktrees (optional, now fetched from worktrees table)
164
+ * @returns Map of repo slug to options
165
+ *
166
+ * @example
167
+ * const grouped = getGroupedRepoReferenceOptions(repos, worktrees);
168
+ * // {
169
+ * // "anthropics/agor": [
170
+ * // { label: "anthropics/agor", ... },
171
+ * // { label: "anthropics/agor:main", ... },
172
+ * // { label: "anthropics/agor:feat-auth", ... },
173
+ * // ],
174
+ * // "apache/superset": [...]
175
+ * // }
176
+ */
177
+ declare function getGroupedRepoReferenceOptions(repos: Repo[], worktrees?: Worktree[]): Record<RepoSlug, RepoReferenceOption[]>;
178
+ /**
179
+ * Get default repo reference (first worktree of first repo, or first repo)
180
+ *
181
+ * @param repos - List of Agor-managed repositories
182
+ * @returns Default reference or undefined if no repos
183
+ */
184
+ declare function getDefaultRepoReference(repos: Repo[]): string | undefined;
185
+
186
+ /**
187
+ * Repo Reference Parser
188
+ *
189
+ * Handles parsing and resolution of repo references in three formats:
190
+ * 1. Absolute path: /Users/max/code/agor
191
+ * 2. Agor-managed slug: anthropics/agor
192
+ * 3. Slug + worktree: anthropics/agor:feat-auth
193
+ */
194
+
195
+ /**
196
+ * Parsed repo reference
197
+ */
198
+ interface RepoReference {
199
+ /** Reference type */
200
+ type: 'path' | 'managed' | 'managed-worktree';
201
+ /** Absolute path (for type='path') */
202
+ path?: string;
203
+ /** Repository slug (for type='managed' or 'managed-worktree') */
204
+ slug?: RepoSlug;
205
+ /** Worktree name (for type='managed-worktree') */
206
+ worktree?: WorktreeName;
207
+ }
208
+ /**
209
+ * Parse a repo reference string
210
+ *
211
+ * @param ref - Repo reference (path | slug | slug:worktree)
212
+ * @returns Parsed reference
213
+ *
214
+ * @example
215
+ * parseRepoReference('/Users/max/code/agor')
216
+ * // => { type: 'path', path: '/Users/max/code/agor' }
217
+ *
218
+ * @example
219
+ * parseRepoReference('anthropics/agor')
220
+ * // => { type: 'managed', slug: 'anthropics/agor' }
221
+ *
222
+ * @example
223
+ * parseRepoReference('anthropics/agor:main')
224
+ * // => { type: 'managed-worktree', slug: 'anthropics/agor', worktree: 'main' }
225
+ */
226
+ declare function parseRepoReference(ref: string): RepoReference;
227
+ /**
228
+ * Extract slug from git URL
229
+ *
230
+ * @param url - Git remote URL
231
+ * @returns Repository slug (org/name)
232
+ *
233
+ * @example
234
+ * extractSlugFromUrl('https://github.com/anthropics/agor.git')
235
+ * // => 'anthropics/agor'
236
+ *
237
+ * @example
238
+ * extractSlugFromUrl('git@github.com:apache/superset.git')
239
+ * // => 'apache/superset'
240
+ */
241
+ declare function extractSlugFromUrl(url: string): RepoSlug;
242
+ /**
243
+ * Validate slug format (org/name)
244
+ *
245
+ * @param slug - Repository slug to validate
246
+ * @returns True if valid
247
+ */
248
+ declare function isValidSlug(slug: string): boolean;
249
+ /**
250
+ * Resolve repo reference to SessionRepoContext
251
+ *
252
+ * Note: This function requires database access and should be called from
253
+ * CLI commands or services that have access to the database instance.
254
+ * The actual implementation is in the CLI/daemon layer.
255
+ *
256
+ * @param ref - Repo reference string
257
+ * @returns Promise resolving to SessionRepoContext
258
+ *
259
+ * @throws Error if repo not found or path doesn't exist
260
+ *
261
+ * @example
262
+ * // In CLI command with database access:
263
+ * const context = await resolveRepoReference('anthropics/agor:main', db);
264
+ */
265
+ declare function resolveRepoReference(ref: string): Promise<{
266
+ repo_id?: UUID;
267
+ repo_slug?: RepoSlug;
268
+ worktree_name?: WorktreeName;
269
+ cwd: string;
270
+ managed_worktree: boolean;
271
+ }>;
272
+ /**
273
+ * Format repo reference for display
274
+ *
275
+ * @param slug - Repository slug
276
+ * @param worktreeName - Optional worktree name
277
+ * @returns Formatted reference string
278
+ *
279
+ * @example
280
+ * formatRepoReference('anthropics/agor', 'main')
281
+ * // => 'anthropics/agor:main'
282
+ *
283
+ * @example
284
+ * formatRepoReference('anthropics/agor')
285
+ * // => 'anthropics/agor'
286
+ */
287
+ declare function formatRepoReference(slug: RepoSlug, worktreeName?: WorktreeName): string;
288
+
289
+ export { type AgorConfig, type AgorContext, type AgorCredentials, type AgorDaemonSettings, type AgorDefaults, type AgorDisplaySettings, type AgorUISettings, type ConfigKey, type ContextKey, type RepoReference, type RepoReferenceOption, type UnknownJson, extractSlugFromUrl, formatRepoReference, getDefaultRepoReference, getGroupedRepoReferenceOptions, getRepoReferenceOptions, isValidSlug, parseRepoReference, resolveRepoReference };
@@ -0,0 +1,131 @@
1
+ // src/config/repo-list.ts
2
+ function getRepoReferenceOptions(repos, worktrees = []) {
3
+ const options = [];
4
+ const repoMap = new Map(repos.map((repo) => [repo.repo_id, repo]));
5
+ for (const repo of repos) {
6
+ options.push({
7
+ label: repo.slug,
8
+ value: repo.repo_id,
9
+ // Use repo_id as value
10
+ type: "managed",
11
+ slug: repo.slug,
12
+ description: `${repo.name} (bare repo)`
13
+ });
14
+ }
15
+ for (const worktree of worktrees) {
16
+ const repo = repoMap.get(worktree.repo_id);
17
+ if (!repo) continue;
18
+ const reference = `${repo.slug}:${worktree.name}`;
19
+ options.push({
20
+ label: reference,
21
+ value: worktree.worktree_id,
22
+ // Use worktree_id as value
23
+ type: "managed-worktree",
24
+ slug: repo.slug,
25
+ worktree: worktree.name,
26
+ description: `${repo.name} - ${worktree.name} (${worktree.ref})`
27
+ });
28
+ }
29
+ return options;
30
+ }
31
+ function getGroupedRepoReferenceOptions(repos, worktrees = []) {
32
+ const grouped = {};
33
+ const repoMap = new Map(repos.map((repo) => [repo.repo_id, repo]));
34
+ for (const repo of repos) {
35
+ const options = [];
36
+ options.push({
37
+ label: repo.slug,
38
+ value: repo.repo_id,
39
+ // Use repo_id as value
40
+ type: "managed",
41
+ slug: repo.slug,
42
+ description: `${repo.name} (bare repo)`
43
+ });
44
+ grouped[repo.slug] = options;
45
+ }
46
+ for (const worktree of worktrees) {
47
+ const repo = repoMap.get(worktree.repo_id);
48
+ if (!repo) continue;
49
+ const reference = `${repo.slug}:${worktree.name}`;
50
+ if (!grouped[repo.slug]) {
51
+ grouped[repo.slug] = [];
52
+ }
53
+ grouped[repo.slug].push({
54
+ label: reference,
55
+ value: worktree.worktree_id,
56
+ // Use worktree_id as value
57
+ type: "managed-worktree",
58
+ slug: repo.slug,
59
+ worktree: worktree.name,
60
+ description: `${repo.name} - ${worktree.name} (${worktree.ref})`
61
+ });
62
+ }
63
+ return grouped;
64
+ }
65
+ function getDefaultRepoReference(repos) {
66
+ if (repos.length === 0) return void 0;
67
+ const firstRepo = repos[0];
68
+ return firstRepo.slug;
69
+ }
70
+
71
+ // src/config/repo-reference.ts
72
+ function parseRepoReference(ref) {
73
+ if (ref.startsWith("/") || /^[A-Z]:\\/.test(ref)) {
74
+ return { type: "path", path: ref };
75
+ }
76
+ if (ref.includes(":")) {
77
+ const [slug, worktree] = ref.split(":", 2);
78
+ return { type: "managed-worktree", slug, worktree };
79
+ }
80
+ return { type: "managed", slug: ref };
81
+ }
82
+ function extractSlugFromUrl(url) {
83
+ const cleanUrl = url.endsWith(".git") ? url.slice(0, -4) : url;
84
+ if (cleanUrl.includes("@")) {
85
+ const match2 = cleanUrl.match(/:([^/]+\/[^/]+)$/);
86
+ if (match2) {
87
+ return match2[1];
88
+ }
89
+ }
90
+ const match = cleanUrl.match(/[:/]([^/]+\/[^/]+)$/);
91
+ if (match) {
92
+ return match[1];
93
+ }
94
+ const segments = cleanUrl.split("/").filter(Boolean);
95
+ if (segments.length >= 2) {
96
+ return `${segments[segments.length - 2]}/${segments[segments.length - 1]}`;
97
+ }
98
+ throw new Error(`Could not extract slug from URL: ${url}`);
99
+ }
100
+ function isValidSlug(slug) {
101
+ const slugPattern = /^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/;
102
+ return slugPattern.test(slug);
103
+ }
104
+ async function resolveRepoReference(ref) {
105
+ const parsed = parseRepoReference(ref);
106
+ if (parsed.type === "path") {
107
+ return {
108
+ cwd: parsed.path,
109
+ managed_worktree: false
110
+ };
111
+ }
112
+ throw new Error(
113
+ `Repository lookup not implemented in this context. Parsed reference: ${JSON.stringify(parsed)}`
114
+ );
115
+ }
116
+ function formatRepoReference(slug, worktreeName) {
117
+ if (worktreeName) {
118
+ return `${slug}:${worktreeName}`;
119
+ }
120
+ return slug;
121
+ }
122
+ export {
123
+ extractSlugFromUrl,
124
+ formatRepoReference,
125
+ getDefaultRepoReference,
126
+ getGroupedRepoReferenceOptions,
127
+ getRepoReferenceOptions,
128
+ isValidSlug,
129
+ parseRepoReference,
130
+ resolveRepoReference
131
+ };