@kabmo-labs/kabmo 0.53.0 → 0.53.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 (152) hide show
  1. package/dist/client/index.html +1 -1
  2. package/dist/client/index.js +384 -384
  3. package/dist/client/static/js/{Body-sdq2yhmp.js → Body-vaa10tcd.js} +3 -3
  4. package/dist/client/static/js/{CsvGrid-afz6vr3m.js → CsvGrid-wabx4e6w.js} +1 -1
  5. package/dist/client/static/js/{DocxView-xwjgt7qq.js → DocxView-22b3mhh5.js} +1 -1
  6. package/dist/client/static/js/{DrawioView-7m4e8zcm.js → DrawioView-e02qhkp2.js} +1 -1
  7. package/dist/client/static/js/{HtmlPreview-tad0dezn.js → HtmlPreview-q7hwcf4s.js} +1 -1
  8. package/dist/client/static/js/{ImageView-7bpm4xhb.js → ImageView-fxb60ge7.js} +1 -1
  9. package/dist/client/static/js/{LayoutWrapper-ehxhj6t3.js → LayoutWrapper-cey5agsf.js} +2 -2
  10. package/dist/client/static/js/MergeDiffView-1z9mwf73.js +1 -0
  11. package/dist/client/static/js/{Modal-5qt3v5gn.js → Modal-e4yq7p5f.js} +9 -9
  12. package/dist/client/static/js/{PdfView-hbgnnana.js → PdfView-pf3angsq.js} +1 -1
  13. package/dist/client/static/js/{SessionsView-rv9jmr2e.js → SessionsView-mcvhpx0b.js} +1 -1
  14. package/dist/client/static/js/{SheetView-55e0a8as.js → SheetView-5ha5vvsr.js} +1 -1
  15. package/dist/client/static/js/{SvgPreview-10fa6mj1.js → SvgPreview-45wqjw0b.js} +1 -1
  16. package/dist/client/static/js/{abnfDiagram-O67JEVCF-9w4p3dhe.js → abnfDiagram-O67JEVCF-gnf6krbs.js} +1 -1
  17. package/dist/client/static/js/{architectureDiagram-NJMV4G6O-5x6sb253.js → architectureDiagram-NJMV4G6O-00fd0wsg.js} +2 -2
  18. package/dist/client/static/js/{astro-m3fcq2sa.js → astro-asmathwv.js} +1 -1
  19. package/dist/client/static/js/{blockDiagram-BEXU5L5S-2c6y4pkn.js → blockDiagram-BEXU5L5S-9c2sm96a.js} +2 -2
  20. package/dist/client/static/js/c-20y64hcp.js +1 -0
  21. package/dist/client/static/js/{c4Diagram-YGBWAQC7-45rtm401.js → c4Diagram-YGBWAQC7-pemygn0s.js} +2 -2
  22. package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-rksw3aw9.js → classDiagram-v2-NBCMYWYE-h7r3sx3s.js} +2 -2
  23. package/dist/client/static/js/{cose-bilkent-JH36ORCC-4hxtttt5.js → cose-bilkent-JH36ORCC-krx9crwv.js} +1 -1
  24. package/dist/client/static/js/cpp-ty6n0dg9.js +1 -0
  25. package/dist/client/static/js/css-ncvxaxt0.js +1 -0
  26. package/dist/client/static/js/{cynefinDiagram-VND7K2PF-5dhexpf2.js → cynefinDiagram-VND7K2PF-5rp2btew.js} +1 -1
  27. package/dist/client/static/js/{dagre-6A5THRUB-1k3w4qm9.js → dagre-6A5THRUB-q57cnz52.js} +2 -2
  28. package/dist/client/static/js/{diagram-22UHCM2B-fw76k272.js → diagram-22UHCM2B-0bptn06k.js} +2 -2
  29. package/dist/client/static/js/{diagram-3UASUU5V-qnb2gn31.js → diagram-3UASUU5V-60snxawz.js} +1 -1
  30. package/dist/client/static/js/{diagram-ATOU4E4O-cavnxzpf.js → diagram-ATOU4E4O-bb0kewfp.js} +2 -2
  31. package/dist/client/static/js/{diagram-CDSNMT55-6dxaj054.js → diagram-CDSNMT55-3cdkns0z.js} +2 -2
  32. package/dist/client/static/js/{diagram-MLGK6HIB-f16fv9ay.js → diagram-MLGK6HIB-03mbhzeq.js} +1 -1
  33. package/dist/client/static/js/{diagram-MPIPVDR6-zsryj72g.js → diagram-MPIPVDR6-bcvzqqf4.js} +1 -1
  34. package/dist/client/static/js/{dockerfile-frznktsa.js → dockerfile-7kqkk4tz.js} +1 -1
  35. package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-1zz5h7sw.js → ebnfDiagram-ZINNZB2B-sg6kwnbx.js} +1 -1
  36. package/dist/client/static/js/{elk-276RUBZZ-25pehy1p.js → elk-276RUBZZ-5b8v0sdv.js} +1 -1
  37. package/dist/client/static/js/{erDiagram-OPXOYQCR-ezpjhgzw.js → erDiagram-OPXOYQCR-xbs156j5.js} +2 -2
  38. package/dist/client/static/js/flowDiagram-KWPJA3E3-sasgvf55.js +1 -0
  39. package/dist/client/static/js/{ganttDiagram-FUAMR5RP-n11hq4ag.js → ganttDiagram-FUAMR5RP-4p7pfk6c.js} +1 -1
  40. package/dist/client/static/js/{gitGraphDiagram-X574FWY7-3znkxh7y.js → gitGraphDiagram-X574FWY7-3xqwr9pf.js} +1 -1
  41. package/dist/client/static/js/{index-10cxm9ty.js → index-0btbxkxf.js} +2 -2
  42. package/dist/client/static/js/{index-5pbf6dcz.js → index-1d8ff4t7.js} +3 -3
  43. package/dist/client/static/js/{index-9n1cg95f.js → index-1regq9wd.js} +1 -1
  44. package/dist/client/static/js/{index-4nvcwtvr.js → index-25zpywv7.js} +1 -1
  45. package/dist/client/static/js/{index-qj6b15r4.js → index-26a4afcr.js} +2 -2
  46. package/dist/client/static/js/{index-scmtzcv1.js → index-396g4zz4.js} +2 -2
  47. package/dist/client/static/js/{index-m1hd7ska.js → index-3amzzsdk.js} +25 -25
  48. package/dist/client/static/js/{index-vjmy9r20.js → index-3bmn5cc5.js} +1 -1
  49. package/dist/client/static/js/{index-qrpx4sk1.js → index-3x88t8g9.js} +2 -2
  50. package/dist/client/static/js/{index-e0h6xkpv.js → index-45vcpqp9.js} +1 -1
  51. package/dist/client/static/js/{index-7ag37ghj.js → index-4kchzh9y.js} +8 -8
  52. package/dist/client/static/js/{index-5hqjscys.js → index-5qtnmn76.js} +2 -2
  53. package/dist/client/static/js/{index-wvw70pgd.js → index-668fc1df.js} +2 -2
  54. package/dist/client/static/js/{index-b039ef9w.js → index-ayx3q8t9.js} +2 -2
  55. package/dist/client/static/js/{index-dzp9rwy0.js → index-c8ta3k4g.js} +161 -161
  56. package/dist/client/static/js/{index-ey0ckd66.js → index-cj8v7b50.js} +2 -2
  57. package/dist/client/static/js/{index-dkz8d77n.js → index-cy6ceab8.js} +1 -1
  58. package/dist/client/static/js/index-cysdvwqw.js +1 -0
  59. package/dist/client/static/js/{index-y79ebmam.js → index-e2esj214.js} +1 -1
  60. package/dist/client/static/js/{index-32gh2645.js → index-gzz6snng.js} +1 -1
  61. package/dist/client/static/js/{index-kyarw08m.js → index-hp3s5r3g.js} +2 -2
  62. package/dist/client/static/js/{index-5z7f6bq4.js → index-hwq7zgqd.js} +1 -1
  63. package/dist/client/static/js/{index-1qjxg7mh.js → index-j9t5xc3y.js} +1 -1
  64. package/dist/client/static/js/{index-58kgkwxt.js → index-jf8zcg99.js} +4 -4
  65. package/dist/client/static/js/{index-2k6wyyds.js → index-jg6ecfc7.js} +4 -4
  66. package/dist/client/static/js/{index-er7pj5k6.js → index-m6eh5g1q.js} +1 -1
  67. package/dist/client/static/js/{index-4faphth3.js → index-mgs5nscx.js} +1 -1
  68. package/dist/client/static/js/{index-me7ag6sy.js → index-mtjbp5ga.js} +1 -1
  69. package/dist/client/static/js/{index-dzsjyzht.js → index-ng3e6k6x.js} +2 -2
  70. package/dist/client/static/js/{index-z9msykm1.js → index-nmhwjwmt.js} +1 -1
  71. package/dist/client/static/js/{index-s78f7j47.js → index-nnhs52db.js} +1 -1
  72. package/dist/client/static/js/{index-8972fxm9.js → index-p75b7phb.js} +1 -1
  73. package/dist/client/static/js/{index-5j0wejvq.js → index-pak6t03c.js} +2 -2
  74. package/dist/client/static/js/{index-zkkttvtx.js → index-pdkt3r4r.js} +2 -2
  75. package/dist/client/static/js/{index-gmea6fjd.js → index-qj9tcz44.js} +5 -5
  76. package/dist/client/static/js/{index-ej1va073.js → index-rsyqf691.js} +2 -2
  77. package/dist/client/static/js/{index-tnhnysj1.js → index-rtpg4t84.js} +1 -1
  78. package/dist/client/static/js/{index-1e7fek0v.js → index-ryww3xxj.js} +1 -1
  79. package/dist/client/static/js/index-trrmbq0h.js +2 -0
  80. package/dist/client/static/js/{index-02skcm4d.js → index-vwxt5ss9.js} +1 -1
  81. package/dist/client/static/js/{index-acpn178r.js → index-x0y2c61e.js} +1 -1
  82. package/dist/client/static/js/{index-899yw6fh.js → index-x3g8fwkc.js} +2 -2
  83. package/dist/client/static/js/{index-j97qmbbv.js → index-xqkcx4az.js} +1 -1
  84. package/dist/client/static/js/{index-hqc2cazc.js → index-yf5a6t3p.js} +4 -4
  85. package/dist/client/static/js/{index-ht164kw9.js → index-z7gd7nvb.js} +1 -1
  86. package/dist/client/static/js/{index-1w92sjkm.js → index-zc3snsr9.js} +2 -2
  87. package/dist/client/static/js/{infoDiagram-VRGFBTTK-kmv3jtrd.js → infoDiagram-VRGFBTTK-c362sv3t.js} +1 -1
  88. package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-5kp6geeh.js → ishikawaDiagram-OU5B5YK6-yc8ts8wj.js} +1 -1
  89. package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-6w5f1ddc.js → journeyDiagram-ZHPQQLJL-178c75fy.js} +2 -2
  90. package/dist/client/static/js/json-xha2drny.js +1 -0
  91. package/dist/client/static/js/{julia-nwh5w343.js → julia-d18zhpyp.js} +1 -1
  92. package/dist/client/static/js/{kanban-definition-PNTS6WVX-6esn6xqn.js → kanban-definition-PNTS6WVX-w6g3n001.js} +2 -2
  93. package/dist/client/static/js/lua-njwwdj4s.js +1 -0
  94. package/dist/client/static/js/{mermaid.core-z83pf8ch.js → mermaid.core-vcdgn378.js} +7 -7
  95. package/dist/client/static/js/{mindmap-definition-NLK3R4M7-0h1nhw66.js → mindmap-definition-NLK3R4M7-t9e8arca.js} +1 -1
  96. package/dist/client/static/js/one-dark-pro-17hh3q12.js +1 -0
  97. package/dist/client/static/js/one-light-cntgvscy.js +1 -0
  98. package/dist/client/static/js/{pegDiagram-GJSIUBJH-xdcpr8my.js → pegDiagram-GJSIUBJH-nehn0x9n.js} +1 -1
  99. package/dist/client/static/js/{perl-wb4wtc9x.js → perl-sns2qvmf.js} +1 -1
  100. package/dist/client/static/js/{php-9g594k9f.js → php-3q6v9eey.js} +1 -1
  101. package/dist/client/static/js/{pieDiagram-5QR66LMP-0210zd5b.js → pieDiagram-5QR66LMP-p1t3ctd4.js} +1 -1
  102. package/dist/client/static/js/{quadrantDiagram-O4NWA36T-j0rtvvcm.js → quadrantDiagram-O4NWA36T-614rtbfe.js} +1 -1
  103. package/dist/client/static/js/{railroadDiagram-XR7U4H2S-mzxat5g5.js → railroadDiagram-XR7U4H2S-2vpr6pw8.js} +1 -1
  104. package/dist/client/static/js/{requirementDiagram-PLB6GJNP-zq5b9ts2.js → requirementDiagram-PLB6GJNP-b91s5q3p.js} +2 -2
  105. package/dist/client/static/js/{ruby-c4hxsegh.js → ruby-f9k99tfq.js} +1 -1
  106. package/dist/client/static/js/{rust-vmn352hx.js → rust-jj206pb7.js} +1 -1
  107. package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-06s3r7bv.js → sankeyDiagram-IPEJSGJF-4101kt9r.js} +2 -2
  108. package/dist/client/static/js/{sass-6yxywx7t.js → sass-2syegq28.js} +1 -1
  109. package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-7s4gz4t5.js → sequenceDiagram-PO4LG4MO-yq0cxg8c.js} +3 -3
  110. package/dist/client/static/js/{sizeCapture-INFHLROL-yensh9k2.js → sizeCapture-INFHLROL-jkvq39vz.js} +1 -1
  111. package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-1q8p06fk.js → stateDiagram-v2-GCMORJYK-y0h7w5rw.js} +1 -1
  112. package/dist/client/static/js/{swimlanes-2SLR337P-2mfxddzf.js → swimlanes-2SLR337P-1y073wzx.js} +1 -1
  113. package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-k2xf0gby.js → swimlanesDiagram-TC7HE7FX-8ahz3c68.js} +1 -1
  114. package/dist/client/static/js/{timeline-definition-EJHVYXUP-xrk07evk.js → timeline-definition-EJHVYXUP-yjb0g0ys.js} +2 -2
  115. package/dist/client/static/js/{usecaseDiagram-POWQR4AR-ca9h5skn.js → usecaseDiagram-POWQR4AR-8xjkxrkv.js} +1 -1
  116. package/dist/client/static/js/{vennDiagram-UO4OBE2U-c0y47znt.js → vennDiagram-UO4OBE2U-18wjbwtg.js} +1 -1
  117. package/dist/client/static/js/{vue-rcdqpz7q.js → vue-e8e3q3hj.js} +1 -1
  118. package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-mfk1ck3n.js → wardleyDiagram-VNRHLVJA-xqrfsrwp.js} +1 -1
  119. package/dist/client/static/js/xml-8516fzfp.js +1 -0
  120. package/dist/client/static/js/{xychartDiagram-PMCCYNJV-6f8xt89k.js → xychartDiagram-PMCCYNJV-azygghkz.js} +2 -2
  121. package/package.json +2 -2
  122. package/src/client/components/workspace/git-panel/index.test.ts +56 -7
  123. package/src/client/components/workspace/git-panel/index.tsx +9 -4
  124. package/src/client/components/workspace/repo-picker/index.test.tsx +29 -2
  125. package/src/client/hooks/chat/timeline/new-chat-open.ts +5 -3
  126. package/src/client/hooks/chat/timeline/new-chat.test.ts +18 -2
  127. package/src/client/hooks/chat/timeline/new-chat.ts +13 -12
  128. package/src/client/hooks/chat/timeline/scope.test.ts +100 -0
  129. package/src/client/hooks/chat/timeline/scope.ts +9 -9
  130. package/src/client/hooks/workspace/commit-box.ts +6 -1
  131. package/src/client/lib/tts/gapless.ts +205 -0
  132. package/src/client/lib/tts/player.test.ts +83 -64
  133. package/src/client/lib/tts/player.ts +48 -98
  134. package/src/server/lib/fs/fs-write-git.test.ts +15 -47
  135. package/src/server/lib/fs/git-ignore.test.ts +101 -0
  136. package/src/server/lib/fs/git-ignore.ts +38 -1
  137. package/src/server/lib/fs/git-repos.ts +32 -11
  138. package/src/server/lib/fs/listing.test.ts +19 -0
  139. package/src/shared/lib/workspace/active-project.test.ts +45 -0
  140. package/src/shared/lib/workspace/active-project.ts +21 -0
  141. package/dist/client/static/js/MergeDiffView-28xkyts9.js +0 -1
  142. package/dist/client/static/js/c-ypdp030b.js +0 -1
  143. package/dist/client/static/js/cpp-cxwev3gs.js +0 -1
  144. package/dist/client/static/js/css-6mxcqf8c.js +0 -1
  145. package/dist/client/static/js/flowDiagram-KWPJA3E3-zh6hmn6g.js +0 -1
  146. package/dist/client/static/js/index-qva2vqbh.js +0 -2
  147. package/dist/client/static/js/index-xvh25zer.js +0 -1
  148. package/dist/client/static/js/json-mb8k0b1n.js +0 -1
  149. package/dist/client/static/js/lua-nxnqww9z.js +0 -1
  150. package/dist/client/static/js/one-dark-pro-wsgaqq27.js +0 -1
  151. package/dist/client/static/js/one-light-w8zdrvyc.js +0 -1
  152. package/dist/client/static/js/xml-vtrdnrn6.js +0 -1
@@ -16,6 +16,20 @@
16
16
  * Paths must be relative to `dir` and must exist on disk: git resolves
17
17
  * directory-only patterns (`build/`) by stat-ing the path.
18
18
  *
19
+ * Repository DISCOVERY stops at `dir`'s parent (`GIT_CEILING_DIRECTORIES`), so
20
+ * the rules that answer are the ones of a repository rooted at `dir` — never an
21
+ * enclosing repository's. Without the ceiling git walks up from `dir` and a
22
+ * workspace that is merely a subdirectory of some other repository answers with
23
+ * that repository's rules: measured on `~/JatisMobile/Workspace/projects`
24
+ * (a folder OF repositories, `.git` only in its children) whose parent repo
25
+ * ignores `projects/` — every row, the nested repositories included, came back
26
+ * `ignored: true` and the whole tree rendered faded. The ceiling is the parent
27
+ * rather than `dir` itself because git treats a ceiling equal to the starting
28
+ * directory as no ceiling at all (verified on git 2.56: `dir` still discovered
29
+ * the repository above, `dirname(dir)` exited 128), while a repository rooted
30
+ * AT `dir` is still found with the ceiling there — so a real workspace root
31
+ * keeps its own `.gitignore`, `.git/info/exclude` and global excludes.
32
+ *
19
33
  * Answers are memoized per path: the panel asks again every time a folder is
20
34
  * re-listed or re-expanded, and each question costs a `git` subprocess
21
35
  * (measured 5.6 ms). The TTL is short because a `.gitignore` the user just
@@ -24,6 +38,8 @@
24
38
  * nothing at all.
25
39
  */
26
40
 
41
+ import fs from 'node:fs';
42
+ import path from 'node:path';
27
43
  import { GIT_ENV } from '@kabmo-labs/kabmo-git/runner/git-run';
28
44
 
29
45
  const CACHE_TTL_MS = 5_000;
@@ -41,6 +57,25 @@ function cacheKey(dir: string, rel: string): string {
41
57
  return `${dir}\0${rel}`;
42
58
  }
43
59
 
60
+ /**
61
+ * Where git's repository discovery must stop: the parent of the browsed root.
62
+ *
63
+ * Resolved first, because git compares the ceiling against the real path of its
64
+ * working directory — a workspace root reached through a symlink would other-
65
+ * wise name a ceiling that is not an ancestor of `dir` and the walk would leak
66
+ * the enclosing repository back in.
67
+ */
68
+ function discoveryCeiling(dir: string): string {
69
+ let real = dir;
70
+ try {
71
+ real = fs.realpathSync(dir);
72
+ } catch {
73
+ // Vanished between `readdir` and here: the unresolved path is still
74
+ // absolute, and the listing is about to fail anyway.
75
+ }
76
+ return path.dirname(real);
77
+ }
78
+
44
79
  export async function collectIgnoredPaths(dir: string, relPaths: string[]): Promise<Set<string>> {
45
80
  if (relPaths.length === 0) return new Set();
46
81
 
@@ -68,7 +103,9 @@ export async function collectIgnoredPaths(dir: string, relPaths: string[]): Prom
68
103
  // The same three variables every other git spawn gets — `GIT_ENV` in
69
104
  // `lib/fs/git-run.ts` names what each prevents. This call site spawns
70
105
  // directly rather than through `runGit`/`runShell`, so it has to opt in.
71
- env: { ...Bun.env, ...GIT_ENV },
106
+ // The ceiling is this module's own rule: only the repository rooted at
107
+ // the browsed root may answer (see the header).
108
+ env: { ...Bun.env, ...GIT_ENV, GIT_CEILING_DIRECTORIES: discoveryCeiling(dir) },
72
109
  });
73
110
 
74
111
  // Drain stdout while the listing is written: a directory big enough to
@@ -86,32 +86,53 @@ interface RepoDiscovery {
86
86
 
87
87
  const repoDiscovery = new Map<string, RepoDiscovery>();
88
88
 
89
- /** Begin the background walk for `rootDir`; a no-op once one has started. */
90
- export function startRepoScan(rootDir: string): void {
91
- if (repoDiscovery.has(rootDir)) return;
92
- const d: RepoDiscovery = { repos: ['.'], done: false };
89
+ /**
90
+ * Begin a background walk for `rootDir`, seeded with the list the client should
91
+ * see while it runs.
92
+ *
93
+ * The seed is why this is not inlined into `startRepoScan`: a FORCED rescan
94
+ * answers with the previous list, so the picker keeps the rows (and the pick's
95
+ * own row) instead of collapsing to the bare root for the length of the walk.
96
+ */
97
+ function beginScan(rootDir: string, seed: string[]): void {
98
+ const d: RepoDiscovery = { repos: seed, done: false };
93
99
  repoDiscovery.set(rootDir, d);
94
100
  void getRepos(rootDir)
95
- .then(repos => { d.repos = repos; d.done = true; })
96
- .catch(() => { d.repos = ['.']; d.done = true; })
101
+ // A newer scan may have replaced this entry (two rescans in flight, or a
102
+ // walk that outlived a rescan): only the CURRENT walk owns the cache.
103
+ .then(repos => { if (repoDiscovery.get(rootDir) === d) { d.repos = repos; d.done = true; } })
104
+ .catch(() => { if (repoDiscovery.get(rootDir) === d) { d.repos = ['.']; d.done = true; } })
97
105
  // The walk is STARTED by a read, so this completion is the only moment the
98
106
  // list becomes final — the `repos:` topic is re-snapshotted from it, and a
99
107
  // client watching the root never has to poll for the answer.
100
- .finally(() => emitRealtimeSignal('repos-scanned', undefined, rootDir));
108
+ .finally(() => {
109
+ if (repoDiscovery.get(rootDir) === d) emitRealtimeSignal('repos-scanned', undefined, rootDir);
110
+ });
111
+ }
112
+
113
+ /** Begin the background walk for `rootDir`; a no-op once one has started. */
114
+ export function startRepoScan(rootDir: string): void {
115
+ if (repoDiscovery.has(rootDir)) return;
116
+ beginScan(rootDir, ['.']);
101
117
  }
102
118
 
103
119
  /**
104
- * Drop the cached result for `rootDir` and start a fresh walk. Used by the
120
+ * Start a fresh walk for `rootDir`, ignoring the cached result. Used by the
105
121
  * repo-switcher's refresh button, which must not serve the previous answer.
122
+ *
123
+ * The PREVIOUS list is published while the new walk runs: the topic would
124
+ * otherwise report `['.']` as if discovery had found one repository, and every
125
+ * picker on the root dropped its nested rows — including the selected one —
126
+ * until the walk finished.
106
127
  */
107
128
  export function rescanRepos(rootDir: string): void {
108
- repoDiscovery.delete(rootDir);
109
- startRepoScan(rootDir);
129
+ const previous = repoDiscovery.get(rootDir)?.repos ?? ['.'];
130
+ beginScan(rootDir, previous);
110
131
  }
111
132
 
112
133
  /** The discovered repos for `rootDir`, and whether the walk is still running. */
113
134
  export function discoveredRepos(rootDir: string): { repos: string[]; pending: boolean } {
114
135
  const d = repoDiscovery.get(rootDir);
115
136
  if (!d) return { repos: ['.'], pending: false };
116
- return { repos: d.done ? d.repos : ['.'], pending: !d.done };
137
+ return { repos: d.repos, pending: !d.done };
117
138
  }
@@ -133,6 +133,25 @@ describe('single-child chains', () => {
133
133
  expect(pair.map((entry) => entry.name)).toEqual(['one', 'two']);
134
134
  });
135
135
 
136
+ test('a root that is not a repository does not inherit the repository above it', async () => {
137
+ const outer = makeRoot();
138
+ Bun.spawnSync({ cmd: ['git', 'init', '-q'], cwd: outer });
139
+ fs.writeFileSync(path.join(outer, '.gitignore'), 'projects/\n');
140
+ const root = path.join(outer, 'projects');
141
+ mkdirs(root, ['child-one', 'child-two']);
142
+ // A file in each child keeps the single-child collapse from folding them.
143
+ fs.writeFileSync(path.join(root, 'child-one', 'README.md'), 'x\n');
144
+ fs.writeFileSync(path.join(root, 'child-two', 'README.md'), 'x\n');
145
+ Bun.spawnSync({ cmd: ['git', 'init', '-q'], cwd: path.join(root, 'child-one') });
146
+
147
+ const entries = await listDirectoryEntries(root, root);
148
+
149
+ expect(entries.map((entry) => entry.name)).toEqual(['child-one', 'child-two']);
150
+ // One child is a repository, the other is not; neither is ignored. The
151
+ // parent's rules belong to a repository this workspace root is not part of.
152
+ expect(entries.some((entry) => entry.ignored)).toBe(false);
153
+ });
154
+
136
155
  test('a git-ignored chain is dimmed from its deepest directory', async () => {
137
156
  const root = makeRoot();
138
157
  fs.mkdirSync(path.join(root, 'a/b/c'), { recursive: true });
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ /**
7
+ * The ONE resolution of "which workspace does a new chat run in".
8
+ *
9
+ * The prewarm fires for it, the pending chat's `?folderId=` carries it, and the
10
+ * first send spawns in it. When those disagreed the prompt landed in another
11
+ * workspace than the warmed child: measured as the previous right-panel scope
12
+ * surviving a New Chat opened from a session in a different folder.
13
+ */
14
+
15
+ import { describe, expect, test } from 'bun:test';
16
+
17
+ import { newChatFolderId } from '@/shared/lib/workspace/active-project';
18
+ import type { WorkspaceFolderData } from '@/shared/types';
19
+
20
+ const FOLDERS = [
21
+ { id: 7, name: 'alpha', project_path: '/work/alpha', sessions: [{ id: 'omp-a' }] },
22
+ { id: 9, name: 'beta', project_path: '/work/beta', sessions: [{ id: 'omp-b' }] },
23
+ { id: 11, name: 'unbound', project_path: null, sessions: [] },
24
+ ] as unknown as WorkspaceFolderData[];
25
+
26
+ describe('newChatFolderId', () => {
27
+ test('the folder owning the source session wins over the right-panel scope', () => {
28
+ expect(newChatFolderId(FOLDERS, 'omp-a', 9)).toBe(7);
29
+ });
30
+
31
+ test('the composer pick is the fallback when the session is under no folder', () => {
32
+ expect(newChatFolderId(FOLDERS, 'omp-unknown', 9)).toBe(9);
33
+ expect(newChatFolderId(FOLDERS, null, 11)).toBe(11);
34
+ });
35
+
36
+ test('a pick the sidebar has not listed yet is kept verbatim', () => {
37
+ // The id is the user's choice; the send resolves it against the list later.
38
+ expect(newChatFolderId(FOLDERS, null, 42)).toBe(42);
39
+ });
40
+
41
+ test('nothing to resolve is null, never a guessed workspace', () => {
42
+ expect(newChatFolderId(FOLDERS, 'omp-unknown', null)).toBeNull();
43
+ expect(newChatFolderId([], null, undefined)).toBeNull();
44
+ });
45
+ });
@@ -46,6 +46,27 @@ export function effectiveRootFor(
46
46
  return folder.project_path ?? null;
47
47
  }
48
48
 
49
+ /**
50
+ * The workspace a NEW chat started from `sessionId` will run in: the folder
51
+ * owning that session, else the composer's pick.
52
+ *
53
+ * Stated once because three places must name the same folder — the prewarm's
54
+ * cwd, the pending chat's `?folderId=`, and its first send's spawn — and they
55
+ * did not: `useNewChatSubmit` wrote a folder only when the URL carried none, so
56
+ * the right panel's scope survived and the prompt spawned in the PREVIOUS
57
+ * workspace while the warmed child waited in the one the chat was started from.
58
+ *
59
+ * The raw pick is returned even when the sidebar's list has not loaded that
60
+ * folder yet: the id is the user's choice, and the send resolves it later.
61
+ */
62
+ export function newChatFolderId(
63
+ folders: WorkspaceFolderData[],
64
+ sessionId: string | number | null | undefined,
65
+ selectedFolderId: number | string | null | undefined,
66
+ ): number | string | null {
67
+ return activeProjectForSession(folders, sessionId).folder?.id ?? selectedFolderId ?? null;
68
+ }
69
+
49
70
  /**
50
71
  * Resolve the workspace root the composer should scope `@` file mentions to:
51
72
  * the active session's bound project first, then the explicitly selected
@@ -1 +0,0 @@
1
- import{pg}from"./index-gmea6fjd.js";import"./index-7ag37ghj.js";import"./index-me7ag6sy.js";export{pg as MergeDiffView};
@@ -1 +0,0 @@
1
- import{mi}from"./index-scmtzcv1.js";export{mi as default};
@@ -1 +0,0 @@
1
- import{Ec}from"./index-er7pj5k6.js";import"./index-scmtzcv1.js";export{Ec as default};
@@ -1 +0,0 @@
1
- import{np,Ps,tb,nb,rb,ab}from"./index-wvw70pgd.js";export{tb as css,ab as gss,Ps as keywords,rb as less,np as mkCSS,nb as sCSS};
@@ -1 +0,0 @@
1
- import"./index-m1hd7ska.js";import"./index-qj6b15r4.js";import{eb}from"./index-5hqjscys.js";export{eb as diagram};
@@ -1,2 +0,0 @@
1
- import{n,N,se,ys,aA}from"./index-dzp9rwy0.js";var r={left:aA.left,right:aA.right},a="omp:mobile-panel-nav-changed";function s(e,t){return ys(N(r[e],t))}function ug(e,t){if(typeof window>"u")return;window.dispatchEvent(new CustomEvent(a,{detail:{side:e,style:ys(t)}}))}function rp(e){let[t,i]=n(()=>s(e));return se(a,(l)=>{let o=l.detail;if(o?.side!==e)return;i(ys(o.style))}),t}
2
- export{ug,rp};
@@ -1 +0,0 @@
1
- import{zn,ho,fp,Oi,ai,el,Ku,tl,dg,Vu,gp,Ap,hp,bp,NA,nl,Yu,QA,Ju,Er,RA}from"./index-gmea6fjd.js";import"./index-7ag37ghj.js";export{tl as IndentContext,RA as StreamLanguage,Ju as bracketMatching,nl as codeFolding,hp as foldAll,gp as foldCode,Yu as foldGutter,NA as foldKeymap,Vu as foldService,ai as getIndentUnit,Ku as getIndentation,QA as highlightingFor,dg as indentOnInput,fp as indentService,el as indentString,Oi as indentUnit,ho as language,Er as matchBrackets,zn as syntaxTree,bp as unfoldAll,Ap as unfoldCode};
@@ -1 +0,0 @@
1
- import{Ri}from"./index-qrpx4sk1.js";export{Ri as default};
@@ -1 +0,0 @@
1
- import{qg}from"./index-4nvcwtvr.js";import"./index-scmtzcv1.js";export{qg as default};
@@ -1 +0,0 @@
1
- import{_h}from"./index-dzp9rwy0.js";export{_h as default};
@@ -1 +0,0 @@
1
- import{Ih}from"./index-dzp9rwy0.js";export{Ih as default};
@@ -1 +0,0 @@
1
- import{fi}from"./index-ej1va073.js";import"./index-0prwdwyb.js";export{fi as default};