aicodeman 1.34.0 → 1.40.0

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 (299) hide show
  1. package/README.md +11 -0
  2. package/README.zh-CN.md +8 -0
  3. package/dist/attachment-registry.d.ts +6 -0
  4. package/dist/attachment-registry.d.ts.map +1 -1
  5. package/dist/attachment-registry.js +9 -3
  6. package/dist/attachment-registry.js.map +1 -1
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +2 -2
  9. package/dist/cli.js.map +1 -1
  10. package/dist/config/cli-registry/patterns.d.ts +6 -0
  11. package/dist/config/cli-registry/patterns.d.ts.map +1 -1
  12. package/dist/config/cli-registry/patterns.js +13 -0
  13. package/dist/config/cli-registry/patterns.js.map +1 -1
  14. package/dist/config/cli-registry/schema.d.ts +13 -0
  15. package/dist/config/cli-registry/schema.d.ts.map +1 -1
  16. package/dist/config/cli-registry/schema.js +60 -2
  17. package/dist/config/cli-registry/schema.js.map +1 -1
  18. package/dist/config/cli-registry/stock.d.ts.map +1 -1
  19. package/dist/config/cli-registry/stock.js +175 -7
  20. package/dist/config/cli-registry/stock.js.map +1 -1
  21. package/dist/config/cli-registry/types.d.ts +93 -6
  22. package/dist/config/cli-registry/types.d.ts.map +1 -1
  23. package/dist/config/dependency-registry.d.ts +7 -0
  24. package/dist/config/dependency-registry.d.ts.map +1 -1
  25. package/dist/config/dependency-registry.js +15 -0
  26. package/dist/config/dependency-registry.js.map +1 -1
  27. package/dist/config/path-probe.d.ts +37 -0
  28. package/dist/config/path-probe.d.ts.map +1 -0
  29. package/dist/config/path-probe.js +43 -0
  30. package/dist/config/path-probe.js.map +1 -0
  31. package/dist/deepseek-route-config.d.ts +110 -0
  32. package/dist/deepseek-route-config.d.ts.map +1 -0
  33. package/dist/deepseek-route-config.js +477 -0
  34. package/dist/deepseek-route-config.js.map +1 -0
  35. package/dist/git-workspace-status.d.ts +246 -0
  36. package/dist/git-workspace-status.d.ts.map +1 -0
  37. package/dist/git-workspace-status.js +626 -0
  38. package/dist/git-workspace-status.js.map +1 -0
  39. package/dist/hooks-config.d.ts.map +1 -1
  40. package/dist/hooks-config.js +83 -13
  41. package/dist/hooks-config.js.map +1 -1
  42. package/dist/model-config-resolvers.d.ts +29 -0
  43. package/dist/model-config-resolvers.d.ts.map +1 -0
  44. package/dist/model-config-resolvers.js +34 -0
  45. package/dist/model-config-resolvers.js.map +1 -0
  46. package/dist/session-display-model.d.ts +110 -0
  47. package/dist/session-display-model.d.ts.map +1 -0
  48. package/dist/session-display-model.js +154 -0
  49. package/dist/session-display-model.js.map +1 -0
  50. package/dist/session.d.ts +145 -8
  51. package/dist/session.d.ts.map +1 -1
  52. package/dist/session.js +280 -35
  53. package/dist/session.js.map +1 -1
  54. package/dist/types/api.d.ts +7 -0
  55. package/dist/types/api.d.ts.map +1 -1
  56. package/dist/types/api.js.map +1 -1
  57. package/dist/types/session.d.ts +28 -1
  58. package/dist/types/session.d.ts.map +1 -1
  59. package/dist/types/session.js.map +1 -1
  60. package/dist/types/tools.d.ts +1 -1
  61. package/dist/types/tools.d.ts.map +1 -1
  62. package/dist/utils/bounded-path-probe.d.ts +99 -0
  63. package/dist/utils/bounded-path-probe.d.ts.map +1 -0
  64. package/dist/utils/bounded-path-probe.js +228 -0
  65. package/dist/utils/bounded-path-probe.js.map +1 -0
  66. package/dist/utils/cli-executable-resolver.d.ts +2 -0
  67. package/dist/utils/cli-executable-resolver.d.ts.map +1 -1
  68. package/dist/utils/cli-executable-resolver.js +2 -1
  69. package/dist/utils/cli-executable-resolver.js.map +1 -1
  70. package/dist/utils/deepseek-cli-resolver.d.ts +8 -0
  71. package/dist/utils/deepseek-cli-resolver.d.ts.map +1 -1
  72. package/dist/utils/deepseek-cli-resolver.js +18 -2
  73. package/dist/utils/deepseek-cli-resolver.js.map +1 -1
  74. package/dist/utils/dependency-checker.d.ts +2 -0
  75. package/dist/utils/dependency-checker.d.ts.map +1 -1
  76. package/dist/utils/dependency-checker.js +37 -9
  77. package/dist/utils/dependency-checker.js.map +1 -1
  78. package/dist/utils/index.d.ts +2 -0
  79. package/dist/utils/index.d.ts.map +1 -1
  80. package/dist/utils/index.js +1 -0
  81. package/dist/utils/index.js.map +1 -1
  82. package/dist/web/case-path.d.ts +58 -0
  83. package/dist/web/case-path.d.ts.map +1 -0
  84. package/dist/web/case-path.js +182 -0
  85. package/dist/web/case-path.js.map +1 -0
  86. package/dist/web/launch-defaults.d.ts +22 -0
  87. package/dist/web/launch-defaults.d.ts.map +1 -0
  88. package/dist/web/launch-defaults.js +46 -0
  89. package/dist/web/launch-defaults.js.map +1 -0
  90. package/dist/web/public/admin-ui.js.gz +0 -0
  91. package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
  92. package/dist/web/public/app.abadc970.js +43 -0
  93. package/dist/web/public/app.abadc970.js.br +0 -0
  94. package/dist/web/public/app.abadc970.js.gz +0 -0
  95. package/dist/web/public/approvals-ui.js.gz +0 -0
  96. package/dist/web/public/{constants.d95fade9.js → constants.c0f8f9de.js} +1009 -127
  97. package/dist/web/public/constants.c0f8f9de.js.br +0 -0
  98. package/dist/web/public/constants.c0f8f9de.js.gz +0 -0
  99. package/dist/web/public/cron-ui.js.gz +0 -0
  100. package/dist/web/public/entrance-animations.js +1 -0
  101. package/dist/web/public/entrance-animations.js.br +0 -0
  102. package/dist/web/public/entrance-animations.js.gz +0 -0
  103. package/dist/web/public/git-status-ui.js +719 -0
  104. package/dist/web/public/git-status-ui.js.br +0 -0
  105. package/dist/web/public/git-status-ui.js.gz +0 -0
  106. package/dist/web/public/home-sessions.js +12 -9
  107. package/dist/web/public/home-sessions.js.br +0 -0
  108. package/dist/web/public/home-sessions.js.gz +0 -0
  109. package/dist/web/public/host-wake-ui.js.gz +0 -0
  110. package/dist/web/public/i18n.a31747a9.js +2 -0
  111. package/dist/web/public/i18n.a31747a9.js.br +0 -0
  112. package/dist/web/public/i18n.a31747a9.js.gz +0 -0
  113. package/dist/web/public/{image-input.a216cf9e.js → image-input.898a538b.js} +18 -8
  114. package/dist/web/public/image-input.898a538b.js.br +0 -0
  115. package/dist/web/public/image-input.898a538b.js.gz +0 -0
  116. package/dist/web/public/index.html +205 -42
  117. package/dist/web/public/index.html.br +0 -0
  118. package/dist/web/public/index.html.gz +0 -0
  119. package/dist/web/public/input-cjk.8bc46081.js.gz +0 -0
  120. package/dist/web/public/keyboard-accessory.c1e7c7b7.js.gz +0 -0
  121. package/dist/web/public/{mobile-handlers.23a85db1.js → mobile-handlers.0ef9c311.js} +20 -0
  122. package/dist/web/public/mobile-handlers.0ef9c311.js.br +0 -0
  123. package/dist/web/public/mobile-handlers.0ef9c311.js.gz +0 -0
  124. package/dist/web/public/mobile-ime-preview.2dbaf262.js.gz +0 -0
  125. package/dist/web/public/mobile-overview.js.gz +0 -0
  126. package/dist/web/public/mobile.111b187d.css +1 -0
  127. package/dist/web/public/mobile.111b187d.css.br +0 -0
  128. package/dist/web/public/mobile.111b187d.css.gz +0 -0
  129. package/dist/web/public/notification-manager.50bb87d8.js.gz +0 -0
  130. package/dist/web/public/orchestrator-panel.js.gz +0 -0
  131. package/dist/web/public/{panels-ui.6a5898d9.js → panels-ui.4735dfc2.js} +4 -4
  132. package/dist/web/public/panels-ui.4735dfc2.js.br +0 -0
  133. package/dist/web/public/{panels-ui.6a5898d9.js.gz → panels-ui.4735dfc2.js.gz} +0 -0
  134. package/dist/web/public/ralph-panel.b350e2ef.js.gz +0 -0
  135. package/dist/web/public/ralph-wizard.b6c0dd19.js.gz +0 -0
  136. package/dist/web/public/readmymind-ui.js.gz +0 -0
  137. package/dist/web/public/reboot-restore-ui.js.gz +0 -0
  138. package/dist/web/public/respawn-ui.ff0dae4c.js.gz +0 -0
  139. package/dist/web/public/sanitize-html.e7147e76.js.gz +0 -0
  140. package/dist/web/public/session-lineage.js +229 -86
  141. package/dist/web/public/session-lineage.js.br +0 -0
  142. package/dist/web/public/session-lineage.js.gz +0 -0
  143. package/dist/web/public/session-ui.f731602c.js +100 -0
  144. package/dist/web/public/session-ui.f731602c.js.br +0 -0
  145. package/dist/web/public/session-ui.f731602c.js.gz +0 -0
  146. package/dist/web/public/settings-ui.a97ab16f.js +97 -0
  147. package/dist/web/public/settings-ui.a97ab16f.js.br +0 -0
  148. package/dist/web/public/settings-ui.a97ab16f.js.gz +0 -0
  149. package/dist/web/public/spreadsheet-preview-worker.js +290 -0
  150. package/dist/web/public/spreadsheet-preview-worker.js.br +0 -0
  151. package/dist/web/public/spreadsheet-preview-worker.js.gz +0 -0
  152. package/dist/web/public/spreadsheet-preview.af82fa2f.js +555 -0
  153. package/dist/web/public/spreadsheet-preview.af82fa2f.js.br +0 -0
  154. package/dist/web/public/spreadsheet-preview.af82fa2f.js.gz +0 -0
  155. package/dist/web/public/spreadsheet-xlsx-core.js +1006 -0
  156. package/dist/web/public/spreadsheet-xlsx-core.js.br +0 -0
  157. package/dist/web/public/spreadsheet-xlsx-core.js.gz +0 -0
  158. package/dist/web/public/styles.8ee12666.css +1 -0
  159. package/dist/web/public/styles.8ee12666.css.br +0 -0
  160. package/dist/web/public/styles.8ee12666.css.gz +0 -0
  161. package/dist/web/public/subagent-windows.e6ca799f.js.gz +0 -0
  162. package/dist/web/public/sw.js +2 -2
  163. package/dist/web/public/sw.js.br +0 -0
  164. package/dist/web/public/sw.js.gz +0 -0
  165. package/dist/web/public/tab-layout-browser.065fcba4.js +1 -0
  166. package/dist/web/public/tab-layout-browser.065fcba4.js.br +0 -0
  167. package/dist/web/public/tab-layout-browser.065fcba4.js.gz +0 -0
  168. package/dist/web/public/{tab-rail-resize.dcdc5772.js → tab-rail-resize.a5867793.js} +1 -1
  169. package/dist/web/public/tab-rail-resize.a5867793.js.br +0 -0
  170. package/dist/web/public/tab-rail-resize.a5867793.js.gz +0 -0
  171. package/dist/web/public/terminal-keycode229-recovery.af09f99a.js +1 -0
  172. package/dist/web/public/terminal-keycode229-recovery.af09f99a.js.br +0 -0
  173. package/dist/web/public/terminal-keycode229-recovery.af09f99a.js.gz +0 -0
  174. package/dist/web/public/terminal-split.js +146 -649
  175. package/dist/web/public/terminal-split.js.br +0 -0
  176. package/dist/web/public/terminal-split.js.gz +0 -0
  177. package/dist/web/public/terminal-tile.js +1611 -0
  178. package/dist/web/public/terminal-tile.js.br +0 -0
  179. package/dist/web/public/terminal-tile.js.gz +0 -0
  180. package/dist/web/public/terminal-ui.5059b30e.js +2 -0
  181. package/dist/web/public/terminal-ui.5059b30e.js.br +0 -0
  182. package/dist/web/public/terminal-ui.5059b30e.js.gz +0 -0
  183. package/dist/web/public/tile-grid.js +2684 -0
  184. package/dist/web/public/tile-grid.js.br +0 -0
  185. package/dist/web/public/tile-grid.js.gz +0 -0
  186. package/dist/web/public/ultracode-panel.js.gz +0 -0
  187. package/dist/web/public/ultracode-windows.js.gz +0 -0
  188. package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
  189. package/dist/web/public/vendor/exceljs.min.js +44 -0
  190. package/dist/web/public/vendor/exceljs.min.js.br +0 -0
  191. package/dist/web/public/vendor/exceljs.min.js.gz +0 -0
  192. package/dist/web/public/vendor/fflate.min.js +1 -0
  193. package/dist/web/public/vendor/fflate.min.js.br +0 -0
  194. package/dist/web/public/vendor/fflate.min.js.gz +0 -0
  195. package/dist/web/public/vendor/marked.min.js.gz +0 -0
  196. package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
  197. package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
  198. package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
  199. package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
  200. package/dist/web/public/vendor/xterm-predictive-echo.ae5e3d5d.js.gz +0 -0
  201. package/dist/web/public/vendor/xterm-zerolag-input.bbb5f84c.js.gz +0 -0
  202. package/dist/web/public/vendor/xterm.css.gz +0 -0
  203. package/dist/web/public/vendor/xterm.min.js.gz +0 -0
  204. package/dist/web/public/{voice-input.c4b51eb6.js → voice-input.2342c37b.js} +64 -10
  205. package/dist/web/public/voice-input.2342c37b.js.br +0 -0
  206. package/dist/web/public/voice-input.2342c37b.js.gz +0 -0
  207. package/dist/web/public/voice-pcm-worklet.js.gz +0 -0
  208. package/dist/web/public/webview-tabs.js +9 -1
  209. package/dist/web/public/webview-tabs.js.br +0 -0
  210. package/dist/web/public/webview-tabs.js.gz +0 -0
  211. package/dist/web/routes/case-routes.d.ts.map +1 -1
  212. package/dist/web/routes/case-routes.js +136 -18
  213. package/dist/web/routes/case-routes.js.map +1 -1
  214. package/dist/web/routes/cli-registry-routes.d.ts.map +1 -1
  215. package/dist/web/routes/cli-registry-routes.js +3 -1
  216. package/dist/web/routes/cli-registry-routes.js.map +1 -1
  217. package/dist/web/routes/doctor-routes.d.ts +23 -0
  218. package/dist/web/routes/doctor-routes.d.ts.map +1 -0
  219. package/dist/web/routes/doctor-routes.js +83 -0
  220. package/dist/web/routes/doctor-routes.js.map +1 -0
  221. package/dist/web/routes/file-routes.d.ts +7 -0
  222. package/dist/web/routes/file-routes.d.ts.map +1 -1
  223. package/dist/web/routes/file-routes.js +34 -4
  224. package/dist/web/routes/file-routes.js.map +1 -1
  225. package/dist/web/routes/git-status-routes.d.ts +16 -0
  226. package/dist/web/routes/git-status-routes.d.ts.map +1 -0
  227. package/dist/web/routes/git-status-routes.js +98 -0
  228. package/dist/web/routes/git-status-routes.js.map +1 -0
  229. package/dist/web/routes/index.d.ts +2 -0
  230. package/dist/web/routes/index.d.ts.map +1 -1
  231. package/dist/web/routes/index.js +2 -0
  232. package/dist/web/routes/index.js.map +1 -1
  233. package/dist/web/routes/session-routes.d.ts +18 -0
  234. package/dist/web/routes/session-routes.d.ts.map +1 -1
  235. package/dist/web/routes/session-routes.js +106 -42
  236. package/dist/web/routes/session-routes.js.map +1 -1
  237. package/dist/web/routes/status-telemetry-routes.d.ts +3 -0
  238. package/dist/web/routes/status-telemetry-routes.d.ts.map +1 -1
  239. package/dist/web/routes/status-telemetry-routes.js +12 -0
  240. package/dist/web/routes/status-telemetry-routes.js.map +1 -1
  241. package/dist/web/routes/system-routes.d.ts.map +1 -1
  242. package/dist/web/routes/system-routes.js +13 -0
  243. package/dist/web/routes/system-routes.js.map +1 -1
  244. package/dist/web/schemas.d.ts +28 -0
  245. package/dist/web/schemas.d.ts.map +1 -1
  246. package/dist/web/schemas.js +41 -0
  247. package/dist/web/schemas.js.map +1 -1
  248. package/dist/web/server.d.ts +5 -0
  249. package/dist/web/server.d.ts.map +1 -1
  250. package/dist/web/server.js +35 -12
  251. package/dist/web/server.js.map +1 -1
  252. package/dist/web/session-listener-wiring.d.ts +1 -0
  253. package/dist/web/session-listener-wiring.d.ts.map +1 -1
  254. package/dist/web/session-listener-wiring.js +11 -0
  255. package/dist/web/session-listener-wiring.js.map +1 -1
  256. package/package.json +3 -1
  257. package/scripts/postinstall.js +16 -0
  258. package/skills/codeman/reference/verbs.md +3 -0
  259. package/dist/web/public/app.cf0db8ce.js +0 -43
  260. package/dist/web/public/app.cf0db8ce.js.br +0 -0
  261. package/dist/web/public/app.cf0db8ce.js.gz +0 -0
  262. package/dist/web/public/constants.d95fade9.js.br +0 -0
  263. package/dist/web/public/constants.d95fade9.js.gz +0 -0
  264. package/dist/web/public/i18n.398b8331.js +0 -1
  265. package/dist/web/public/i18n.398b8331.js.br +0 -0
  266. package/dist/web/public/i18n.398b8331.js.gz +0 -0
  267. package/dist/web/public/image-input.a216cf9e.js.br +0 -0
  268. package/dist/web/public/image-input.a216cf9e.js.gz +0 -0
  269. package/dist/web/public/mobile-handlers.23a85db1.js.br +0 -0
  270. package/dist/web/public/mobile-handlers.23a85db1.js.gz +0 -0
  271. package/dist/web/public/mobile.1aa4952d.css +0 -1
  272. package/dist/web/public/mobile.1aa4952d.css.br +0 -0
  273. package/dist/web/public/mobile.1aa4952d.css.gz +0 -0
  274. package/dist/web/public/panels-ui.6a5898d9.js.br +0 -0
  275. package/dist/web/public/session-ui.bf66c13b.js +0 -89
  276. package/dist/web/public/session-ui.bf66c13b.js.br +0 -0
  277. package/dist/web/public/session-ui.bf66c13b.js.gz +0 -0
  278. package/dist/web/public/settings-ui.331d3b1d.js +0 -97
  279. package/dist/web/public/settings-ui.331d3b1d.js.br +0 -0
  280. package/dist/web/public/settings-ui.331d3b1d.js.gz +0 -0
  281. package/dist/web/public/styles.8c485d26.css +0 -1
  282. package/dist/web/public/styles.8c485d26.css.br +0 -0
  283. package/dist/web/public/styles.8c485d26.css.gz +0 -0
  284. package/dist/web/public/tab-layout-browser.4e0ed50c.js +0 -1
  285. package/dist/web/public/tab-layout-browser.4e0ed50c.js.br +0 -0
  286. package/dist/web/public/tab-layout-browser.4e0ed50c.js.gz +0 -0
  287. package/dist/web/public/tab-rail-resize.dcdc5772.js.br +0 -0
  288. package/dist/web/public/tab-rail-resize.dcdc5772.js.gz +0 -0
  289. package/dist/web/public/terminal-keycode229-recovery.fb91b25b.js +0 -1
  290. package/dist/web/public/terminal-keycode229-recovery.fb91b25b.js.br +0 -0
  291. package/dist/web/public/terminal-keycode229-recovery.fb91b25b.js.gz +0 -0
  292. package/dist/web/public/terminal-ui.a4535311.js +0 -2
  293. package/dist/web/public/terminal-ui.a4535311.js.br +0 -0
  294. package/dist/web/public/terminal-ui.a4535311.js.gz +0 -0
  295. package/dist/web/public/upload.html +0 -155
  296. package/dist/web/public/upload.html.br +0 -0
  297. package/dist/web/public/upload.html.gz +0 -0
  298. package/dist/web/public/voice-input.c4b51eb6.js.br +0 -0
  299. package/dist/web/public/voice-input.c4b51eb6.js.gz +0 -0
@@ -0,0 +1,246 @@
1
+ /**
2
+ * @fileoverview "What has this session's workspace not committed or pushed?": a read-only git
3
+ * snapshot of a session's working directory, for the bottom-bar Git indicator and its panel
4
+ * (`GET /api/sessions/:id/git-status`). Agents leave work uncommitted and unpushed; this makes that
5
+ * visible without leaving Codeman.
6
+ *
7
+ * Split so the parts that matter test without a repo:
8
+ * - pure: `parsePorcelainV2` (status output → branch, upstream, ahead/behind, per-file entries),
9
+ * `parseCommitLog`
10
+ * - IO: `getGitWorkspaceStatus` (a handful of async, bounded, read-only `git` calls), with a short
11
+ * single-flight cache so several tabs polling one repo cost one set of git processes
12
+ *
13
+ * WHICH repositories. `getGitWorkspaceOverview` answers for the session's working directory:
14
+ * - inside a repository (or at its root): that one repository. git finds it by walking UP, so a
15
+ * subfolder reports its whole enclosing repo; a nested repo below it is just an untracked folder
16
+ * to the outer one, and is not scanned;
17
+ * - NOT inside one (a folder that holds several projects): every repository found up to two levels
18
+ * DOWN (the caller's `maxRepos` of them, `MAX_REPOS` by default, skipping dot-folders, `node_modules`
19
+ * and the like, never following symlinks), each reported separately;
20
+ * - a repository that merely sits ABOVE the workspace and is the home folder or higher (a dotfiles
21
+ * repo in `$HOME`, or `/`) is ignored: its dirty files are not this session's work.
22
+ *
23
+ * Rules the code keeps and the tests pin:
24
+ * - READ-ONLY and OFFLINE. It never fetches, pulls, commits or writes. "Behind" therefore reflects
25
+ * the last fetch (the UI says so); "ahead" and the unpushed list are exact against the
26
+ * remote-tracking refs already on disk. `--no-optional-locks` keeps `git status` from even
27
+ * refreshing the index, so polling cannot contend with the agent's own git commands.
28
+ * - Every call is async (`execFile`), bounded by a timeout, and never interpolates a path into a
29
+ * shell: the working directory is the process `cwd`, and the only operand-like input is a fixed
30
+ * revision range.
31
+ * - Output is capped: the counts are exact, the lists are not (`filesTruncated`).
32
+ * - git can run helpers a repository configures: a clean filter (`filter.<name>.clean`) still runs
33
+ * during `git status` and `git diff`, as it does for any `git status`. A LOCAL session already
34
+ * runs as this same OS user, so polling adds no privilege there. What is turned off: the
35
+ * filesystem monitor (`core.fsmonitor`), external diff and textconv drivers, and the signature
36
+ * program (`log.showSignature`). A repository a container can write to is NOT inspected: a
37
+ * Docker session answers `unsupported`, and any repository whose root is, or is inside, a Docker
38
+ * case workspace is dropped from the walk-up, the scan below a folder, and the diff route, because
39
+ * the container could have planted that config and git here would run it on the host.
40
+ * - Remote URLs and git's stderr can embed `user:token@host`; anything that reaches a client goes
41
+ * through `redactGitCredentials`.
42
+ *
43
+ * @module git-workspace-status
44
+ */
45
+ /** How long one git command may run, unless the caller passes `timeoutMs` (a slow network share needs more). */
46
+ export declare const DEFAULT_GIT_TIMEOUT_MS = 30000;
47
+ export declare const MIN_GIT_TIMEOUT_MS = 5000;
48
+ export declare const MAX_GIT_TIMEOUT_MS = 120000;
49
+ /** Max file rows returned. The counts stay exact. */
50
+ export declare const MAX_FILES = 300;
51
+ /** Max unpushed commits listed. The count stays exact. */
52
+ export declare const MAX_COMMITS = 50;
53
+ export type GitFileKind = 'staged' | 'unstaged' | 'untracked' | 'conflicted';
54
+ export interface GitFileEntry {
55
+ /** Path relative to the repository root, as git reports it. */
56
+ path: string;
57
+ /** Rename/copy source, when the entry is one. */
58
+ origPath?: string;
59
+ /** Status letter in the index (`M`, `A`, `D`, `R`, `C`, `T`, `.`). */
60
+ index: string;
61
+ /** Status letter in the working tree (`M`, `D`, `T`, `.`, ...). `?` for untracked. */
62
+ worktree: string;
63
+ kind: GitFileKind;
64
+ }
65
+ export interface GitCommitEntry {
66
+ hash: string;
67
+ author: string;
68
+ /** Seconds since the epoch. */
69
+ time: number;
70
+ subject: string;
71
+ }
72
+ export interface GitWorkspaceStatus {
73
+ /**
74
+ * `ok`: a repository, the rest of the fields are meaningful. `not-a-repo`: nothing to show.
75
+ * `unsupported`: a remote or Docker session (never inspected). `error`: git failed; see `error`.
76
+ */
77
+ state: 'ok' | 'not-a-repo' | 'unsupported' | 'error';
78
+ reason?: 'remote' | 'docker';
79
+ error?: string;
80
+ repoRoot?: string;
81
+ /** Null when HEAD is detached. */
82
+ branch: string | null;
83
+ detached: boolean;
84
+ upstream: string | null;
85
+ /**
86
+ * The configured upstream does not exist on the remote (deleted and pruned, or never pushed, as after
87
+ * cloning an empty repository and committing): nothing is tracked.
88
+ */
89
+ upstreamGone: boolean;
90
+ ahead: number;
91
+ /** Behind the remote-tracking ref as of the LAST FETCH; this module never fetches. */
92
+ behind: number;
93
+ /** Whether the repository has any remote at all. */
94
+ hasRemote: boolean;
95
+ counts: {
96
+ staged: number;
97
+ unstaged: number;
98
+ untracked: number;
99
+ conflicted: number;
100
+ /** Distinct paths that are not committed. */
101
+ uncommitted: number;
102
+ stashes: number;
103
+ };
104
+ files: GitFileEntry[];
105
+ filesTruncated: boolean;
106
+ /** Commits on this branch that no remote has: exact. */
107
+ unpushedCount: number;
108
+ unpushed: GitCommitEntry[];
109
+ checkedAt: number;
110
+ }
111
+ export declare const emptyStatus: (state: GitWorkspaceStatus["state"], extra?: Partial<GitWorkspaceStatus>) => GitWorkspaceStatus;
112
+ export interface ParsedStatus {
113
+ branch: string | null;
114
+ detached: boolean;
115
+ upstream: string | null;
116
+ /** `# branch.upstream` was printed but `# branch.ab` was not: no such remote branch (deleted and pruned, or never pushed). */
117
+ upstreamGone: boolean;
118
+ ahead: number;
119
+ behind: number;
120
+ files: GitFileEntry[];
121
+ }
122
+ /**
123
+ * Parse `git status --porcelain=v2 --branch -z`. Entries are NUL-separated and paths are NOT quoted,
124
+ * so a name with spaces, quotes or a newline arrives intact. A rename/copy (`2 ...`) is followed by
125
+ * one more NUL-terminated token holding the original path.
126
+ */
127
+ export declare function parsePorcelainV2(text: string): ParsedStatus;
128
+ /** Parse `git log --format=%h%x1f%an%x1f%ct%x1f%s%x1e`. */
129
+ export declare function parseCommitLog(text: string): GitCommitEntry[];
130
+ /** Runs `git <args>` in `cwd` and returns stdout. Injected so the cache and error paths test without git. */
131
+ export type GitRunner = (cwd: string, args: string[], opts?: {
132
+ timeoutMs?: number;
133
+ }) => Promise<string>;
134
+ export declare const runGit: GitRunner;
135
+ /** For tests. */
136
+ export declare function clearGitStatusCache(): void;
137
+ /**
138
+ * The git snapshot of `cwd`. Concurrent callers share one in-flight computation, and a result younger
139
+ * than a few seconds is reused, so several tabs polling one repo cost one set of git processes.
140
+ * `fresh` skips the reuse but still joins a computation already running (see `singleFlight`).
141
+ */
142
+ export declare function getGitWorkspaceStatus(cwd: string, opts?: {
143
+ git?: GitRunner;
144
+ now?: () => number;
145
+ fresh?: boolean;
146
+ timeoutMs?: number;
147
+ }): Promise<GitWorkspaceStatus>;
148
+ /** Repositories reported for one workspace. */
149
+ export declare const MAX_REPOS = 12;
150
+ /** The most repositories a caller may ask for: each one costs several git processes per poll. */
151
+ export declare const MAX_REPOS_LIMIT = 50;
152
+ /** `value` as a whole number within [min, max], else `fallback`. For options that arrive as untrusted query strings. */
153
+ export declare function clampInt(value: unknown, min: number, max: number, fallback: number): number;
154
+ export interface GitRepoEntry {
155
+ /** Folder name of the repository (its root's basename). */
156
+ name: string;
157
+ /** The repository root relative to the working directory: `.`, `..`, `api`, `apps/web`. */
158
+ path: string;
159
+ status: GitWorkspaceStatus;
160
+ }
161
+ export interface GitWorkspaceOverview {
162
+ /** `ok` when at least one repository was found; the other states are as in `GitWorkspaceStatus`. */
163
+ state: 'ok' | 'not-a-repo' | 'unsupported' | 'error';
164
+ reason?: 'remote' | 'docker';
165
+ error?: string;
166
+ repos: GitRepoEntry[];
167
+ /** More than `repoLimit` repositories were found; only the first are reported. */
168
+ reposTruncated: boolean;
169
+ /** The most repositories this overview would list (the caller's setting, or `MAX_REPOS`). */
170
+ repoLimit?: number;
171
+ checkedAt: number;
172
+ }
173
+ export declare const emptyOverview: (state: GitWorkspaceOverview["state"], extra?: Partial<GitWorkspaceOverview>) => GitWorkspaceOverview;
174
+ /**
175
+ * True when `path` is, or is inside, any of the (already real) `roots`. Used for Docker case
176
+ * workspaces: a container can write there, so git must not run on its behalf on the host.
177
+ */
178
+ export declare function isInsideAny(path: string, realRoots: string[]): Promise<boolean>;
179
+ /**
180
+ * True when `repoRoot` is a repository that merely contains the workspace and is the home folder or
181
+ * above it (`$HOME` managed as a dotfiles repo, `/`, `/home`): its changes are not the session's work.
182
+ * A workspace that IS the repository root is never "unrelated", even when that root is the home folder.
183
+ */
184
+ export declare function isUnrelatedAncestor(repoRoot: string, cwd: string, home: string): Promise<boolean>;
185
+ /** Repositories up to `DISCOVERY_MAX_DEPTH` levels below `cwd`, nearest and alphabetical first. Never follows symlinks. */
186
+ export declare function discoverChildRepos(cwd: string, excludeRealRoots?: string[], maxRepos?: number): Promise<{
187
+ dirs: string[];
188
+ truncated: boolean;
189
+ }>;
190
+ export interface GitOverviewOptions {
191
+ git?: GitRunner;
192
+ now?: () => number;
193
+ fresh?: boolean;
194
+ home?: string;
195
+ /** Docker case workspaces (host paths): repositories at or inside these are never inspected. */
196
+ dockerWorkspaces?: string[];
197
+ /** How many repositories to report below a folder that is not itself a repository (1 to `MAX_REPOS_LIMIT`, default `MAX_REPOS`). */
198
+ maxRepos?: number;
199
+ /** How long one git command may run, in ms (`MIN_GIT_TIMEOUT_MS` to `MAX_GIT_TIMEOUT_MS`, default `DEFAULT_GIT_TIMEOUT_MS`). */
200
+ timeoutMs?: number;
201
+ }
202
+ /** The repository limit and git timeout an overview was computed with, from untrusted options. */
203
+ export declare function resolveOverviewLimits(opts: {
204
+ maxRepos?: unknown;
205
+ timeoutMs?: unknown;
206
+ }): {
207
+ maxRepos: number;
208
+ timeoutMs: number;
209
+ };
210
+ /**
211
+ * Everything git knows about the session's workspace: the enclosing repository when there is one,
212
+ * otherwise each repository found below the working directory. See the module header for the rules.
213
+ */
214
+ export declare function getGitWorkspaceOverview(cwd: string, opts?: GitOverviewOptions): Promise<GitWorkspaceOverview>;
215
+ /**
216
+ * `repo` when it is the root of one of the repositories the overview reports for `cwd` (the same rules
217
+ * and caches, and the Docker roots as they are now), else null. The diff route checks a requested
218
+ * repository with this rather than recomputing every repository's status.
219
+ */
220
+ export declare function findWorkspaceRepo(cwd: string, repo: string, opts?: GitOverviewOptions): Promise<string | null>;
221
+ /** Longest diff handed to the browser; beyond this it is cut at a line boundary and flagged. */
222
+ export declare const MAX_DIFF_BYTES: number;
223
+ export interface GitFileDiff {
224
+ /** Unified diff text (empty when git reports no textual change, e.g. a mode-only edit shows its header). */
225
+ diff: string;
226
+ truncated: boolean;
227
+ binary: boolean;
228
+ }
229
+ /** A repo-relative path git reported, minus anything that could escape the repo. (A leading `-` is fine: every operand follows `--`.) */
230
+ export declare function isSafeRepoRelativePath(p: string): boolean;
231
+ /**
232
+ * The diff of one changed file, as the panel's rows describe it: `staged` is index vs HEAD,
233
+ * `unstaged`/`conflicted` is working tree vs index (a conflict shows git's combined diff), and
234
+ * `untracked` is the whole file as additions. Read-only. `--no-ext-diff --no-textconv` stop the external
235
+ * diff and textconv drivers a repository configures; a clean filter still runs, as it does for any
236
+ * `git diff`, which is why a container-writable repository never reaches this function.
237
+ */
238
+ export declare function getGitFileDiff(repoRoot: string, file: {
239
+ path: string;
240
+ origPath?: string;
241
+ kind: GitFileKind;
242
+ }, opts?: {
243
+ git?: GitRunner;
244
+ timeoutMs?: number;
245
+ }): Promise<GitFileDiff>;
246
+ //# sourceMappingURL=git-workspace-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-workspace-status.d.ts","sourceRoot":"","sources":["../src/git-workspace-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAWH,gHAAgH;AAChH,eAAO,MAAM,sBAAsB,QAAS,CAAC;AAC7C,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AACxC,eAAO,MAAM,kBAAkB,SAAU,CAAC;AAG1C,qDAAqD;AACrD,eAAO,MAAM,SAAS,MAAM,CAAC;AAC7B,0DAA0D;AAC1D,eAAO,MAAM,WAAW,KAAK,CAAC;AAK9B,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC;AAE7E,MAAM,WAAW,YAAY;IAC3B,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAC;IACd,sFAAsF;IACtF,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC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