@bevel-software/platform-core-frontend 0.25.2 → 0.27.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 (193) hide show
  1. package/package.json +2 -2
  2. package/src/core/CoreAppShell.tsx +87 -25
  3. package/src/core/ProductName.tsx +49 -0
  4. package/src/core/__tests__/ShellRoutes.test.tsx +22 -0
  5. package/src/core/__tests__/core-contributions.test.ts +16 -0
  6. package/src/core/core-contributions.ts +17 -0
  7. package/src/core/registry.ts +51 -1
  8. package/src/index.css +23 -5
  9. package/src/index.ts +5 -0
  10. package/src/modules/access/__tests__/ManageAccessDialog.proposal.test.tsx +1 -1
  11. package/src/modules/access/components/ManageAccessDialog.tsx +1 -1
  12. package/src/modules/admin/__tests__/RolesCorruptedBanner.test.tsx +70 -0
  13. package/src/modules/admin/components/RolesCorruptedBanner.tsx +9 -4
  14. package/src/modules/auth/components/LoginScreen.tsx +4 -1
  15. package/src/modules/auth/services/account.api.ts +28 -1
  16. package/src/modules/auth/services/sso.ts +1 -2
  17. package/src/modules/change-requests/__tests__/ChangeRequestDialog.sync-banner.test.tsx +176 -0
  18. package/src/modules/change-requests/__tests__/ChangeRequestDialog.unreadable.test.tsx +68 -0
  19. package/src/modules/change-requests/__tests__/ChangeRequestLink.test.tsx +182 -0
  20. package/src/modules/change-requests/__tests__/FileChangeBoxes.test.tsx +1 -1
  21. package/src/modules/change-requests/__tests__/readFileOnBranch.test.ts +79 -0
  22. package/src/modules/change-requests/components/ChangeBox.tsx +6 -1
  23. package/src/modules/change-requests/components/ChangeRequestDialog.tsx +45 -15
  24. package/src/modules/change-requests/components/ChangeRequestLink.tsx +151 -0
  25. package/src/modules/change-requests/components/CrFileTree.tsx +2 -1
  26. package/src/modules/change-requests/components/FileChangeBoxes.tsx +4 -2
  27. package/src/modules/change-requests/hooks/useApplyChangeRequest.ts +6 -3
  28. package/src/modules/change-requests/services/change-requests.api.ts +15 -2
  29. package/src/modules/change-requests/utils/readFailure.ts +22 -0
  30. package/src/modules/embed/__tests__/EmbedLinkPage.test.tsx +74 -0
  31. package/src/modules/embed/__tests__/EmbedView.test.tsx +473 -0
  32. package/src/modules/embed/__tests__/embed-config.test.ts +128 -0
  33. package/src/modules/embed/__tests__/embed-host.test.ts +111 -0
  34. package/src/modules/embed/__tests__/mcp-app-view.test.ts +295 -0
  35. package/src/modules/embed/__tests__/mount.test.tsx +157 -0
  36. package/src/modules/embed/components/EmbedLinkPage.tsx +109 -0
  37. package/src/modules/embed/components/EmbedView.tsx +545 -0
  38. package/src/modules/embed/embed-config.ts +132 -0
  39. package/src/modules/embed/embed-host.ts +120 -0
  40. package/src/modules/embed/mount.tsx +80 -0
  41. package/src/modules/embed/services/embed-token.ts +22 -0
  42. package/src/modules/embed/services/embed.api.ts +158 -0
  43. package/src/modules/git/__tests__/BranchSwitcher.test.tsx +202 -4
  44. package/src/modules/git/__tests__/GitSyncFailedBanner.test.tsx +59 -1
  45. package/src/modules/git/__tests__/PullNeededBanner.test.tsx +39 -22
  46. package/src/modules/git/__tests__/useAutoPullUpdates.test.tsx +7 -2
  47. package/src/modules/git/branch-delete-menu-item.tsx +24 -0
  48. package/src/modules/git/components/BranchSwitcher.tsx +29 -5
  49. package/src/modules/git/components/GitSyncFailedBanner.tsx +53 -15
  50. package/src/modules/git/components/HistoryVersionPreview.tsx +5 -3
  51. package/src/modules/git/components/PullNeededBanner.tsx +15 -49
  52. package/src/modules/git/hooks/useAutoPullUpdates.ts +9 -5
  53. package/src/modules/git/index.ts +15 -0
  54. package/src/modules/git/services/__tests__/error-messages.test.ts +67 -0
  55. package/src/modules/git/services/__tests__/pull-failure.test.ts +36 -0
  56. package/src/modules/git/services/error-messages.ts +58 -1
  57. package/src/modules/git/services/pull-failure.ts +68 -0
  58. package/src/modules/git/state/branch-delete-confirm.ts +46 -0
  59. package/src/modules/layout/__tests__/HeaderAlignment.test.tsx +1 -0
  60. package/src/modules/layout/__tests__/breakpoints.test.ts +7 -1
  61. package/src/modules/layout/breakpoints.ts +8 -0
  62. package/src/modules/library/__tests__/PluginExtras.test.tsx +9 -9
  63. package/src/modules/library/__tests__/PluginPage.test.tsx +8 -1
  64. package/src/modules/library/__tests__/SkillsTree.test.tsx +13 -4
  65. package/src/modules/library/__tests__/ToolPage.test.tsx +53 -0
  66. package/src/modules/library/components/LibraryPage.tsx +22 -0
  67. package/src/modules/library/components/PluginExtras.tsx +23 -6
  68. package/src/modules/library/components/PluginPage.tsx +6 -1
  69. package/src/modules/library/components/tool-page/ToolPage.tsx +45 -1
  70. package/src/modules/library/routes/LibraryRoutes.tsx +8 -7
  71. package/src/modules/library/services/plugins.api.ts +4 -1
  72. package/src/modules/library/services/tools.api.ts +27 -0
  73. package/src/modules/library/state/plugins-revision.ts +28 -0
  74. package/src/modules/onboarding/__tests__/agent-connection-api.test.ts +55 -0
  75. package/src/modules/onboarding/__tests__/creator-welcome.test.tsx +87 -82
  76. package/src/modules/onboarding/__tests__/first-page-prompt.test.ts +109 -0
  77. package/src/modules/onboarding/__tests__/get-started-column.test.tsx +1001 -0
  78. package/src/modules/onboarding/__tests__/invite-dialog.test.tsx +392 -0
  79. package/src/modules/onboarding/__tests__/onboarding.test.tsx +226 -193
  80. package/src/modules/onboarding/__tests__/starter-pack-card.test.tsx +136 -0
  81. package/src/modules/onboarding/components/CreatorWelcomePage.tsx +7 -11
  82. package/src/modules/onboarding/components/EmailChipsInput.tsx +138 -0
  83. package/src/modules/onboarding/components/GetStartedColumn.tsx +651 -0
  84. package/src/modules/onboarding/components/InviteButton.tsx +35 -0
  85. package/src/modules/onboarding/components/InviteDialog.tsx +424 -0
  86. package/src/modules/onboarding/components/RootLanding.tsx +8 -24
  87. package/src/modules/onboarding/components/StarterPackCard.tsx +98 -0
  88. package/src/modules/onboarding/components/WelcomePage.tsx +65 -154
  89. package/src/modules/onboarding/first-page-prompt.ts +89 -0
  90. package/src/modules/onboarding/invite-emails.ts +175 -0
  91. package/src/modules/onboarding/services/agent-connection.api.ts +53 -0
  92. package/src/modules/onboarding/services/starter-packs.api.ts +83 -0
  93. package/src/modules/onboarding/state/agent-connection.ts +167 -0
  94. package/src/modules/onboarding/state/invite-dialog.context.ts +32 -0
  95. package/src/modules/onboarding/state/invite-dialog.tsx +31 -0
  96. package/src/modules/onboarding/state/onboarding.ts +133 -59
  97. package/src/modules/onboarding/state/starter-packs.ts +169 -0
  98. package/src/modules/settings/settings-nav-items.tsx +8 -3
  99. package/src/modules/setup/__tests__/setup.first-run-storage.test.tsx +389 -0
  100. package/src/modules/setup/__tests__/setup.github.test.tsx +5 -5
  101. package/src/modules/setup/__tests__/setup.kept-draft.test.tsx +1 -1
  102. package/src/modules/setup/__tests__/setup.repository-change.test.tsx +1 -1
  103. package/src/modules/setup/__tests__/setup.repository.test.tsx +21 -21
  104. package/src/modules/setup/__tests__/setup.test.tsx +65 -81
  105. package/src/modules/setup/__tests__/useConnectionProbe.test.tsx +123 -0
  106. package/src/modules/setup/components/FirstRunStorage.tsx +560 -0
  107. package/src/modules/setup/components/SetupGate.tsx +46 -1
  108. package/src/modules/setup/components/SetupScreen.tsx +92 -152
  109. package/src/modules/setup/hooks/useConnectionProbe.ts +93 -0
  110. package/src/modules/setup/services/setup.api.ts +3 -3
  111. package/src/modules/setup/utils/suggested-branch.ts +27 -0
  112. package/src/modules/toolbar/commands/__tests__/actions.test.tsx +210 -0
  113. package/src/modules/toolbar/commands/actions.tsx +324 -0
  114. package/src/modules/toolbar/commands/command-menu.ts +44 -0
  115. package/src/modules/toolbar/commands/useCommandActions.ts +69 -0
  116. package/src/modules/toolbar/commands/useCommandShortcuts.ts +121 -0
  117. package/src/modules/toolbar/components/AppSwitcher.tsx +106 -22
  118. package/src/modules/toolbar/components/ExternalAgentAccessPage.tsx +1 -1
  119. package/src/modules/toolbar/components/ProfileMenu.tsx +9 -4
  120. package/src/modules/toolbar/components/SearchPalette.tsx +540 -0
  121. package/src/modules/toolbar/components/Toolbar.tsx +10 -0
  122. package/src/modules/toolbar/components/__tests__/AppSwitcher.test.tsx +187 -54
  123. package/src/modules/toolbar/components/__tests__/ExternalAgentAccessPage.test.tsx +4 -4
  124. package/src/modules/toolbar/components/__tests__/ProfileMenu.test.tsx +64 -0
  125. package/src/modules/toolbar/components/__tests__/SearchPalette.test.tsx +832 -0
  126. package/src/modules/toolbar/components/__tests__/Toolbar.test.tsx +57 -2
  127. package/src/modules/toolbar/search/__tests__/rank.test.ts +93 -0
  128. package/src/modules/toolbar/search/__tests__/sources.test.ts +131 -0
  129. package/src/modules/toolbar/search/rank.ts +111 -0
  130. package/src/modules/toolbar/search/sources.ts +169 -0
  131. package/src/modules/workflow/hooks/useFileLock.ts +10 -7
  132. package/src/modules/workflow/services/__tests__/lock.api.test.ts +41 -0
  133. package/src/modules/workflow/services/lock.api.ts +17 -2
  134. package/src/modules/workspace/__tests__/useWorkspaceState.test.ts +49 -1
  135. package/src/modules/workspace/components/EditorTabs.tsx +39 -15
  136. package/src/modules/workspace/components/FileExplorer.tsx +39 -6
  137. package/src/modules/workspace/components/FilePaneCard.tsx +6 -2
  138. package/src/modules/workspace/components/FileRoute.tsx +12 -7
  139. package/src/modules/workspace/components/FileViewer.tsx +271 -74
  140. package/src/modules/workspace/components/KbPageHeader.tsx +13 -6
  141. package/src/modules/workspace/components/__tests__/EditorTabs.test.tsx +88 -21
  142. package/src/modules/workspace/components/__tests__/FileExplorer.test.tsx +101 -11
  143. package/src/modules/workspace/components/__tests__/FileRoute.test.tsx +23 -3
  144. package/src/modules/workspace/components/__tests__/FileViewer.test.tsx +330 -6
  145. package/src/modules/workspace/components/__tests__/KbPageHeader.test.tsx +17 -2
  146. package/src/modules/workspace/components/renderers/DocxRenderer.tsx +11 -16
  147. package/src/modules/workspace/components/renderers/DownloadFileButton.tsx +6 -0
  148. package/src/modules/workspace/components/renderers/EmailRenderer.tsx +23 -21
  149. package/src/modules/workspace/components/renderers/ImageRenderer.tsx +13 -29
  150. package/src/modules/workspace/components/renderers/KbMarkdownView.tsx +9 -2
  151. package/src/modules/workspace/components/renderers/MarkdownRenderer.tsx +8 -0
  152. package/src/modules/workspace/components/renderers/PdfRenderer.tsx +14 -19
  153. package/src/modules/workspace/components/renderers/PptxRenderer.tsx +11 -17
  154. package/src/modules/workspace/components/renderers/ToolRenderer.tsx +35 -7
  155. package/src/modules/workspace/components/renderers/XlsxRenderer.tsx +11 -17
  156. package/src/modules/workspace/components/renderers/__tests__/EmailRenderer.links.test.tsx +73 -0
  157. package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.scaffold.test.tsx +64 -0
  158. package/src/modules/workspace/components/renderers/__tests__/ToolRenderer.surface.test.tsx +82 -0
  159. package/src/modules/workspace/components/renderers/__tests__/bridgeHarness.ts +99 -0
  160. package/src/modules/workspace/components/renderers/__tests__/htmlSandbox.test.ts +129 -35
  161. package/src/modules/workspace/components/renderers/__tests__/htmlViewsGuide.test.ts +149 -0
  162. package/src/modules/workspace/components/renderers/__tests__/kbMarkdownLinkPolicy.test.tsx +100 -0
  163. package/src/modules/workspace/components/renderers/htmlSandbox.ts +76 -20
  164. package/src/modules/workspace/components/renderers/index.ts +26 -0
  165. package/src/modules/workspace/components/renderers/kbMarkdownPipeline.tsx +51 -1
  166. package/src/modules/workspace/components/renderers/rendererRawRead.ts +53 -0
  167. package/src/modules/workspace/components/renderers/rendererSurface.ts +109 -0
  168. package/src/modules/workspace/components/renderers/rendererWorkspace.ts +8 -2
  169. package/src/modules/workspace/hooks/__tests__/useWorkspaceState.test.tsx +126 -21
  170. package/src/modules/workspace/hooks/useCreatePage.ts +116 -0
  171. package/src/modules/workspace/hooks/useWorkspaceImageResolver.ts +24 -7
  172. package/src/modules/workspace/hooks/useWorkspaceState.ts +42 -8
  173. package/src/modules/workspace/routing/__tests__/kb-routes.test.tsx +10 -0
  174. package/src/modules/workspace/routing/__tests__/md-links-parity.test.tsx +113 -0
  175. package/src/modules/workspace/routing/kb-routes.ts +66 -12
  176. package/src/modules/workspace/state/editable-page.ts +42 -0
  177. package/src/modules/workspace/state/workspace.context.ts +13 -4
  178. package/src/modules/workspace/utils/__tests__/display-file-name.test.ts +60 -0
  179. package/src/modules/workspace/utils/__tests__/fileTree.test.ts +75 -0
  180. package/src/modules/workspace/utils/__tests__/treeConfirm.test.ts +26 -14
  181. package/src/modules/workspace/utils/display-file-name.ts +102 -0
  182. package/src/modules/workspace/utils/fileTree.ts +49 -14
  183. package/src/modules/workspace/utils/treeConfirm.ts +22 -5
  184. package/src/shared/__tests__/no-builtin-confirm.test.ts +102 -0
  185. package/src/shared/components/ConfirmProvider.tsx +156 -0
  186. package/src/shared/components/Dialog.tsx +7 -0
  187. package/src/shared/components/__tests__/ConfirmProvider.test.tsx +198 -0
  188. package/src/shared/components/confirm-context.ts +94 -0
  189. package/src/shared/components/index.ts +3 -0
  190. package/src/shared/mcp/__tests__/connect-snippets.test.ts +2 -2
  191. package/src/shared/mcp/connect-snippets.ts +8 -5
  192. package/src/modules/onboarding/components/WelcomeRoute.tsx +0 -57
  193. package/src/modules/onboarding/welcome-state.ts +0 -36
@@ -0,0 +1,60 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { displayFileName, fileNameTooltip, isAccessRulesFile } from '../display-file-name';
3
+
4
+ const KB = 'knowledge-base';
5
+
6
+ describe('displayFileName', () => {
7
+ it("calls a plugin's plugin.json Plugin settings, from a workspace path or a repository path", () => {
8
+ expect(displayFileName('knowledge-base/Plugins/GTM/plugin.json', KB)).toBe('Plugin settings');
9
+ expect(displayFileName('Plugins/GTM/plugin.json')).toBe('Plugin settings');
10
+ expect(fileNameTooltip('knowledge-base/Plugins/GTM/plugin.json', KB)).toBe('plugin.json');
11
+ });
12
+
13
+ it('names a plugin under grouping folders the same way: a plugin has no fixed depth', () => {
14
+ expect(displayFileName('knowledge-base/Plugins/departments/engineering/shared/ado/plugin.json', KB)).toBe(
15
+ 'Plugin settings',
16
+ );
17
+ expect(displayFileName('Plugins/departments/engineering/shared/ado/plugin.json')).toBe('Plugin settings');
18
+ });
19
+
20
+ it("leaves a skill's bundled plugin.json alone: it is an example, not a plugin's settings", () => {
21
+ expect(displayFileName('knowledge-base/Plugins/GTM/skills/demo/plugin.json', KB)).toBe('plugin.json');
22
+ expect(displayFileName('Plugins/departments/ado/skills/demo/assets/plugin.json')).toBe('plugin.json');
23
+ // A plugin that is itself called skills is still a plugin.
24
+ expect(displayFileName('Plugins/skills/plugin.json')).toBe('Plugin settings');
25
+ expect(displayFileName('knowledge-base/Plugins/departments/skills/plugin.json', KB)).toBe('Plugin settings');
26
+ });
27
+
28
+ it('knows the plugins root only at the top of the repository', () => {
29
+ // A folder somebody called Plugins inside the knowledge tree holds no plugins.
30
+ expect(displayFileName('knowledge-base/KnowledgeBase/Plugins/x/plugin.json', KB)).toBe('plugin.json');
31
+ expect(displayFileName('KnowledgeBase/Plugins/x/plugin.json')).toBe('plugin.json');
32
+ // A workspace path is read from the clone folder; without it the root cannot be placed.
33
+ expect(displayFileName('knowledge-base/Plugins/GTM/plugin.json')).toBe('plugin.json');
34
+ expect(displayFileName('elsewhere/Plugins/GTM/plugin.json', KB)).toBe('plugin.json');
35
+ expect(displayFileName('knowledge-base/KnowledgeBase/plugin.json', KB)).toBe('plugin.json');
36
+ expect(displayFileName('Plugins/plugin.json')).toBe('plugin.json');
37
+ expect(displayFileName('plugin.json')).toBe('plugin.json');
38
+ expect(fileNameTooltip('knowledge-base/KnowledgeBase/plugin.json', KB)).toBeUndefined();
39
+ });
40
+
41
+ it("calls a folder's access.md Who has access, at any depth and in any case", () => {
42
+ expect(displayFileName('knowledge-base/access.md', KB)).toBe('Who has access');
43
+ expect(displayFileName('knowledge-base/Plugins/GTM/access.md', KB)).toBe('Who has access');
44
+ expect(displayFileName('KnowledgeBase/Legal/access.md')).toBe('Who has access');
45
+ expect(displayFileName('KnowledgeBase/Legal/Access.MD')).toBe('Who has access');
46
+ expect(fileNameTooltip('knowledge-base/KnowledgeBase/Legal/access.md', KB)).toBe('access.md');
47
+ expect(isAccessRulesFile('knowledge-base/KnowledgeBase/Legal/access.md')).toBe(true);
48
+ expect(isAccessRulesFile('KnowledgeBase/Legal/ACCESS.md')).toBe(true);
49
+ // A note that only mentions access in its name is a note.
50
+ expect(displayFileName('knowledge-base/KnowledgeBase/access-policy.md', KB)).toBe('access-policy.md');
51
+ expect(isAccessRulesFile('knowledge-base/KnowledgeBase/access-policy.md')).toBe(false);
52
+ });
53
+
54
+ it('shows every other file by its own name, with no tooltip of its own', () => {
55
+ expect(displayFileName('knowledge-base/KnowledgeBase/Handbook.md', KB)).toBe('Handbook.md');
56
+ expect(displayFileName('Plugins/GTM/mcp.json')).toBe('mcp.json');
57
+ expect(displayFileName('README.md')).toBe('README.md');
58
+ expect(fileNameTooltip('knowledge-base/KnowledgeBase/Handbook.md', KB)).toBeUndefined();
59
+ });
60
+ });
@@ -2,6 +2,8 @@ import { describe, it, expect } from 'vitest';
2
2
  import type { FileTreeEntry } from '@bevel-software/platform-shared';
3
3
  import {
4
4
  checkoutRoot,
5
+ findEntryByPath,
6
+ knowledgeFiles,
5
7
  mergePendingIntoTree,
6
8
  omitPathFromTree,
7
9
  pathExistsInTree,
@@ -61,6 +63,54 @@ describe('subtreeHasVisibleEntries', () => {
61
63
  });
62
64
  });
63
65
 
66
+ /** The one exact-path lookup the workspace and the Get set up column share. */
67
+ describe('findEntryByPath', () => {
68
+ const page: FileTreeEntry = { name: 'note.md', relativePath: 'knowledge-base/KnowledgeBase/note.md', type: 'file' };
69
+ const folder: FileTreeEntry = {
70
+ name: 'KnowledgeBase',
71
+ relativePath: 'knowledge-base/KnowledgeBase',
72
+ type: 'directory',
73
+ children: [page],
74
+ };
75
+ const tree: FileTreeEntry = {
76
+ name: '.',
77
+ relativePath: '.',
78
+ type: 'directory',
79
+ children: [{ name: 'knowledge-base', relativePath: 'knowledge-base', type: 'directory', children: [folder] }],
80
+ };
81
+
82
+ it('finds a folder and a file at their exact paths', () => {
83
+ expect(findEntryByPath(tree, 'knowledge-base/KnowledgeBase')).toBe(folder);
84
+ expect(findEntryByPath(tree, 'knowledge-base/KnowledgeBase/note.md')).toBe(page);
85
+ });
86
+
87
+ it('answers null for a path the tree does not have, a prefix of a name included, and for no tree', () => {
88
+ expect(findEntryByPath(tree, 'knowledge-base/Knowledge')).toBeNull();
89
+ expect(findEntryByPath(tree, 'knowledge-base/KnowledgeBase/other.md')).toBeNull();
90
+ expect(findEntryByPath(null, 'knowledge-base')).toBeNull();
91
+ });
92
+
93
+ it('never opens a folder off the path', () => {
94
+ let opened = 0;
95
+ const skills: FileTreeEntry = { name: 'Skills', relativePath: 'knowledge-base/Skills', type: 'directory' };
96
+ Object.defineProperty(skills, 'children', {
97
+ get: () => {
98
+ opened++;
99
+ return [{ name: 'a.md', relativePath: 'knowledge-base/Skills/a.md', type: 'file' }];
100
+ },
101
+ });
102
+ const wide: FileTreeEntry = {
103
+ name: '.',
104
+ relativePath: '.',
105
+ type: 'directory',
106
+ children: [{ name: 'knowledge-base', relativePath: 'knowledge-base', type: 'directory', children: [skills, folder] }],
107
+ };
108
+ expect(findEntryByPath(wide, 'knowledge-base/KnowledgeBase/note.md')).toBe(page);
109
+ expect(findEntryByPath(wide, 'knowledge-base/Missing.md')).toBeNull();
110
+ expect(opened).toBe(0);
111
+ });
112
+ });
113
+
64
114
  /**
65
115
  * What was kept out of ONE root is that root's own count, set by the server
66
116
  * per folder: a Skills tree emptied by the read rules says "nothing shared",
@@ -225,6 +275,31 @@ describe('suggestedPages', () => {
225
275
  });
226
276
  });
227
277
 
278
+ describe('knowledgeFiles', () => {
279
+ it('lists every file the Knowledge explorer browses, not only documents — but never access rules or Plugins/', () => {
280
+ expect(knowledgeFiles(TREE, KB).map((e) => e.relativePath)).toEqual([
281
+ 'knowledge-base/KnowledgeBase/Onboarding.md',
282
+ 'knowledge-base/KnowledgeBase/GTM/Pricing.md',
283
+ 'knowledge-base/KnowledgeBase/GTM/deals.csv',
284
+ ]);
285
+ });
286
+
287
+ it('skips dot-prefixed bookkeeping and is empty without a checkout', () => {
288
+ const tree = dir('', [
289
+ dir(KB, [
290
+ dir(`${KB}/KnowledgeBase`, [
291
+ file(`${KB}/KnowledgeBase/.bevelignore`),
292
+ dir(`${KB}/KnowledgeBase/.git`, [file(`${KB}/KnowledgeBase/.git/HEAD`)]),
293
+ file(`${KB}/KnowledgeBase/Team.md`),
294
+ ]),
295
+ ]),
296
+ ]);
297
+ expect(knowledgeFiles(tree, KB).map((e) => e.name)).toEqual(['Team.md']);
298
+ expect(knowledgeFiles(null, KB)).toEqual([]);
299
+ expect(knowledgeFiles(TREE, null)).toEqual([]);
300
+ });
301
+ });
302
+
228
303
  describe('omitPathFromTree', () => {
229
304
  it('removes only the exact root control file and preserves a nested namesake', () => {
230
305
  const tree = dir('', [
@@ -8,6 +8,7 @@ import {
8
8
  moveQuestion,
9
9
  moveSentence,
10
10
  moveWarnings,
11
+ platformFileDeleteRefusal,
11
12
  platformFileDragRefusal,
12
13
  platformFileMoveRefusal,
13
14
  principalLabel,
@@ -224,8 +225,23 @@ const KB = 'knowledge-base';
224
225
  * The refusal is the server's sentence, decided by the shared predicate, so
225
226
  * the sidebar cannot drift from the endpoint it would have called.
226
227
  */
228
+ describe('platformFileDeleteRefusal', () => {
229
+ it('refuses only the repository\'s own files: the root access.md and roles.yaml', () => {
230
+ expect(platformFileDeleteRefusal(`${KB}/access.md`, KB)).toBe("access.md is the repository's own file and cannot be deleted.");
231
+ expect(platformFileDeleteRefusal(`${KB}/roles.yaml`, KB)).toBe("roles.yaml is the repository's own file and cannot be deleted.");
232
+ });
233
+
234
+ it('leaves a nested access.md, any .bevelignore and content to the server\'s write gate', () => {
235
+ expect(platformFileDeleteRefusal(`${KB}/Team/access.md`, KB)).toBeNull();
236
+ expect(platformFileDeleteRefusal(`${KB}/Team/roles.yaml`, KB)).toBeNull();
237
+ expect(platformFileDeleteRefusal(`${KB}/.bevelignore`, KB)).toBeNull();
238
+ expect(platformFileDeleteRefusal(`${KB}/Access.md`, KB)).toBeNull();
239
+ expect(platformFileDeleteRefusal('access.md', KB)).toBeNull();
240
+ });
241
+ });
242
+
227
243
  describe('platformFileMoveRefusal', () => {
228
- it('refuses the four platform files where the platform reads them', () => {
244
+ it('refuses the three platform files where the platform reads them', () => {
229
245
  expect(platformFileMoveRefusal(`${KB}/access.md`, KB))
230
246
  .toBe('access.md is a platform file and stays in its folder.');
231
247
  expect(platformFileMoveRefusal(`${KB}/Sales/access.md`, KB))
@@ -234,32 +250,29 @@ describe('platformFileMoveRefusal', () => {
234
250
  .toBe('.bevelignore is a platform file and stays in its folder.');
235
251
  expect(platformFileMoveRefusal(`${KB}/roles.yaml`, KB))
236
252
  .toBe('roles.yaml is a platform file and stays in its folder.');
237
- expect(platformFileMoveRefusal(`${KB}/AGENTS.md`, KB))
238
- .toBe('AGENTS.md is a platform file and stays in its folder.');
239
253
  });
240
254
 
241
- it('leaves content alone, including a nested roles.yaml or AGENTS.md the platform never reads', () => {
255
+ it('leaves content alone, including a nested roles.yaml the platform never reads, and any AGENTS.md', () => {
242
256
  expect(platformFileMoveRefusal(`${KB}/Sales/deal.md`, KB)).toBeNull();
243
257
  expect(platformFileMoveRefusal(`${KB}/Sales/roles.yaml`, KB)).toBeNull();
258
+ // The organisation's own conventions file, at the root or anywhere: the
259
+ // platform's guide is served from code, so nothing under this name is ours.
260
+ expect(platformFileMoveRefusal(`${KB}/AGENTS.md`, KB)).toBeNull();
244
261
  expect(platformFileMoveRefusal(`${KB}/Sales/AGENTS.md`, KB)).toBeNull();
245
262
  // Exact spelling, as the platform reads it.
246
263
  expect(platformFileMoveRefusal(`${KB}/Sales/Access.md`, KB)).toBeNull();
247
264
  });
248
265
 
249
266
  /**
250
- * The tree's copy of the rule reads the layout the browser was served, so a
251
- * deployment that renamed its guide gets the same two answers here as it
252
- * does from the server: ours is managed, theirs is a page.
267
+ * A deployment that gave the written guide a name of its own, back when it
268
+ * was written: that name is a read alias now, not a file, so a file under
269
+ * it is content like any other.
253
270
  */
254
- it('follows the configured guide name — and lets go of AGENTS.md when it differs', () => {
271
+ it('refuses nothing under a guide name a deployment saved', () => {
255
272
  configureKbLayout({ ...DEFAULT_KB_LAYOUT, agentsFile: 'HEXIS.md' });
256
- expect(platformFileMoveRefusal(`${KB}/HEXIS.md`, KB))
257
- .toBe('HEXIS.md is a platform file and stays in its folder.');
258
- // The customer's own conventions file moves, renames and deletes like any
259
- // page — which is the whole point of naming ours something else.
273
+ expect(platformFileMoveRefusal(`${KB}/HEXIS.md`, KB)).toBeNull();
260
274
  expect(platformFileMoveRefusal(`${KB}/AGENTS.md`, KB)).toBeNull();
261
275
  expect(platformFileDragRefusal(`${KB}/AGENTS.md`, KB, false)).toBeNull();
262
- // Root-only, like `roles.yaml`: a nested copy of ours is content too.
263
276
  expect(platformFileMoveRefusal(`${KB}/Sales/HEXIS.md`, KB)).toBeNull();
264
277
  });
265
278
 
@@ -289,7 +302,6 @@ describe('platformFileDragRefusal', () => {
289
302
  expect(platformFileDragRefusal(`${KB}/access.md`, KB, true)).toBe(sentence('access.md'));
290
303
  expect(platformFileDragRefusal(`${KB}/roles.yaml`, KB, true)).toBe(sentence('roles.yaml'));
291
304
  expect(platformFileDragRefusal(`${KB}/.bevelignore`, KB, true)).toBe(sentence('.bevelignore'));
292
- expect(platformFileDragRefusal(`${KB}/AGENTS.md`, KB, true)).toBe(sentence('AGENTS.md'));
293
305
  });
294
306
 
295
307
  it('leaves ordinary content alone for either of them', () => {
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The workspace's own: what a knowledge-base file is CALLED on screen is a
3
+ * fact about the workspace's layout (its plugins root, its access rules),
4
+ * so it lives here with the tree it names, not among the shared components
5
+ * that know nothing of either. Other modules — the change-request views,
6
+ * the history preview, the search — read it from here.
7
+ */
8
+ import { PLUGIN_MANIFEST_FILE, PLUGIN_SKILLS_DIR, currentKbLayout } from '@bevel-software/platform-shared';
9
+
10
+ /**
11
+ * What the app CALLS a file, wherever it names one: a row in the tree, a tab,
12
+ * a page's title, the bar above a document, a search result.
13
+ *
14
+ * Almost always that is the file's own name. The exceptions are the files the
15
+ * platform reads as configuration, whose names only make sense to someone who
16
+ * knows how Hexis is built: a plugin's `plugin.json` is its settings, and a
17
+ * folder's `access.md` is who has access to it. Those read in plain words
18
+ * here, and only here, so no surface can call the same file two different
19
+ * things.
20
+ *
21
+ * DISPLAY ONLY. The file on disk, its URL, every API and everything an agent
22
+ * reads keep the real name; {@link fileNameTooltip} hands it to whoever
23
+ * hovers, so it is never hidden from someone who needs it.
24
+ *
25
+ * Paths, not bare names: a `plugin.json` is the plugin's settings only in a
26
+ * plugin's own folder under the plugins root, and the plugins root is the one
27
+ * at the top of the repository — a folder a person happened to call `Plugins`
28
+ * inside the knowledge tree holds no plugins. So a caller says what its path
29
+ * is relative to: `kbDirName` for a workspace path (`<kbDirName>/Plugins/…`),
30
+ * null for one that is already repository-relative (a change request's file
31
+ * list). A plugin may sit under grouping folders, so its depth is not fixed;
32
+ * what is fixed is that a `plugin.json` inside a plugin's `skills/` is a
33
+ * skill's bundled example and nothing more. An `access.md` governs its folder
34
+ * at any depth, so its name alone is enough.
35
+ */
36
+
37
+ /** The access rules file's name — a platform file at any depth, in any case. */
38
+ const ACCESS_RULES_FILE = 'access.md';
39
+
40
+ function baseName(path: string): string {
41
+ return path.slice(path.lastIndexOf('/') + 1);
42
+ }
43
+
44
+ /**
45
+ * The path's segments from the repository root, or null for a workspace path
46
+ * that does not start with the clone folder: that file is outside the
47
+ * repository and under no root at all.
48
+ */
49
+ function repoSegments(path: string, kbDirName: string | null): string[] | null {
50
+ const segments = path.split('/').filter(Boolean);
51
+ if (kbDirName === null) return segments;
52
+ return segments[0] === kbDirName ? segments.slice(1) : null;
53
+ }
54
+
55
+ /**
56
+ * Whether repository-relative `segments` name a plugin's own manifest: a
57
+ * `plugin.json` under the plugins root, in a plugin's folder at any depth
58
+ * (plugins sit under grouping folders too), and not inside a plugin's
59
+ * `skills/`, where one is a skill's bundled example. A skill's example sits
60
+ * at least one folder below a `skills` segment (`<plugin>/skills/<skill>/…`),
61
+ * so only a `skills` segment ABOVE the file's own folder excludes it: a
62
+ * plugin that is itself called `skills` keeps its settings.
63
+ */
64
+ function isPluginManifest(segments: string[]): boolean {
65
+ if (segments.length < 3) return false;
66
+ if (segments[0] !== currentKbLayout().pluginsDir) return false;
67
+ if (segments[segments.length - 1] !== PLUGIN_MANIFEST_FILE) return false;
68
+ return !segments.slice(1, -2).includes(PLUGIN_SKILLS_DIR);
69
+ }
70
+
71
+ /** The plain name of a platform file, or null for every other file. */
72
+ function plainName(path: string, kbDirName: string | null): string | null {
73
+ if (isAccessRulesFile(path)) return 'Who has access';
74
+ const segments = repoSegments(path, kbDirName);
75
+ return segments && isPluginManifest(segments) ? 'Plugin settings' : null;
76
+ }
77
+
78
+ /**
79
+ * Whether `path` is a folder's access rules — the file "Who has access" names.
80
+ * The one rule for it, wherever the app asks: the tree's suggestions and the
81
+ * file page both read it from here.
82
+ */
83
+ export function isAccessRulesFile(path: string): boolean {
84
+ return baseName(path).toLowerCase() === ACCESS_RULES_FILE;
85
+ }
86
+
87
+ /**
88
+ * The name to show for the file at `path`. `kbDirName` is the clone folder a
89
+ * workspace path starts with; null (the default) says the path is already
90
+ * repository-relative.
91
+ */
92
+ export function displayFileName(path: string, kbDirName: string | null = null): string {
93
+ return plainName(path, kbDirName) ?? baseName(path);
94
+ }
95
+
96
+ /**
97
+ * The file's real name, for a `title` — set only when {@link displayFileName}
98
+ * shows something else, so an ordinary file keeps whatever tooltip it had.
99
+ */
100
+ export function fileNameTooltip(path: string, kbDirName: string | null = null): string | undefined {
101
+ return plainName(path, kbDirName) === null ? undefined : baseName(path);
102
+ }
@@ -5,6 +5,7 @@ import {
5
5
  type FileTreeEntry,
6
6
  } from '@bevel-software/platform-shared';
7
7
  import type { PendingEntry } from '../state/workspace.context';
8
+ import { isAccessRulesFile as isAccessRulesPath } from './display-file-name';
8
9
 
9
10
  // RESERVED is not the same as CREATED (see kb-layout.ts): core only seeds
10
11
  // KnowledgeBase/, Skills/ and Plugins/, but every reserved name renders as its
@@ -93,30 +94,58 @@ const READABLE_PAGE = /\.(md|markdown)$/i;
93
94
  * and any governed folder carries one), so the root-file exclusion below
94
95
  * never reaches it. Nobody opens a knowledge base to read who may edit it.
95
96
  */
96
- const ACCESS_RULES_FILE = 'access.md';
97
- const isAccessRulesFile = (entry: FileTreeEntry): boolean => entry.name.toLowerCase() === ACCESS_RULES_FILE;
97
+ const isAccessRulesFile = (entry: FileTreeEntry): boolean => isAccessRulesPath(entry.relativePath);
98
98
 
99
99
  /**
100
100
  * Pages worth offering to someone who has nothing open: the documents nearest
101
101
  * the top of the knowledge tree, breadth-first, so the opening suggestion is a
102
102
  * section heading rather than the fifth file inside the first folder.
103
103
  *
104
- * Scoped to exactly what the explorer browses under "Knowledge", and scoped
105
- * to the CHECKOUT: `KnowledgeBase/` plus any content folder beside it inside
106
- * `<kbDirName>/`. `Plugins/` is the Skills & Tools app's storage and is not a
107
- * browsing destination here, and the loose files at the checkout root
104
+ * Scoped to exactly what the explorer browses under "Knowledge" — see
105
+ * `knowledgeFiles` for what that scope is and why.
106
+ *
107
+ * Fewer than `limit` — including none at all — is a legitimate answer for a
108
+ * knowledge base that is still empty; the caller says so rather than padding.
109
+ */
110
+ export function suggestedPages(
111
+ tree: FileTreeEntry | null,
112
+ kbDirName: string | null,
113
+ limit: number,
114
+ ): FileTreeEntry[] {
115
+ return walkKnowledge(tree, kbDirName, (entry) => READABLE_PAGE.test(entry.name), limit);
116
+ }
117
+
118
+ /**
119
+ * Every file the explorer browses under "Knowledge", breadth-first — what the
120
+ * toolbar's search palette finds pages by name in. Not only documents: a
121
+ * spreadsheet or a PDF has a row in the explorer, and a search that could not
122
+ * find what the tree beside it shows would read as a broken search. The same
123
+ * exclusions as `suggestedPages` apply, because they are about what the
124
+ * explorer is FOR rather than about file types.
125
+ *
126
+ * Scoped to the CHECKOUT: `KnowledgeBase/` plus any content folder beside it
127
+ * inside `<kbDirName>/`. `Plugins/` is the Skills & Tools app's storage and is
128
+ * not a browsing destination here, and the loose files at the checkout root
108
129
  * (`access.md`, `roles.yaml`) are how the deployment is configured, not
109
130
  * something to read. A clone that predates the split has no named roots at
110
131
  * all, so its whole checkout is the knowledge — including the loose files at
111
132
  * its root, which in that layout are pages rather than configuration. A
112
133
  * workspace with no checkout in it has nothing to offer.
113
- *
114
- * Fewer than `limit` — including none at all — is a legitimate answer for a
115
- * knowledge base that is still empty; the caller says so rather than padding.
116
134
  */
117
- export function suggestedPages(
135
+ export function knowledgeFiles(tree: FileTreeEntry | null, kbDirName: string | null): FileTreeEntry[] {
136
+ return walkKnowledge(tree, kbDirName, () => true, Infinity);
137
+ }
138
+
139
+ /**
140
+ * The walk both of the above share: breadth-first from the knowledge roots,
141
+ * stopping once `limit` files have been accepted. Dot-prefixed entries,
142
+ * `access.md` files and folders named after a reserved root are skipped at
143
+ * every depth before `accept` is asked.
144
+ */
145
+ function walkKnowledge(
118
146
  tree: FileTreeEntry | null,
119
147
  kbDirName: string | null,
148
+ accept: (file: FileTreeEntry) => boolean,
120
149
  limit: number,
121
150
  ): FileTreeEntry[] {
122
151
  const kbRoot = checkoutRoot(tree, kbDirName);
@@ -142,7 +171,7 @@ export function suggestedPages(
142
171
  // Dot-prefixed entries are the repository's own bookkeeping.
143
172
  if (entry.name.startsWith('.')) continue;
144
173
  if (entry.type === 'file') {
145
- if (READABLE_PAGE.test(entry.name) && !isAccessRulesFile(entry)) pages.push(entry);
174
+ if (!isAccessRulesFile(entry) && accept(entry)) pages.push(entry);
146
175
  } else if (level === roots || !KB_ROOT_DIRS.has(entry.name)) {
147
176
  // Below the roots, the reserved SET decides — not two names: a folder
148
177
  // named after any reserved root, at any depth, is the same kind of
@@ -156,11 +185,17 @@ export function suggestedPages(
156
185
  return pages.slice(0, limit);
157
186
  }
158
187
 
159
- function findEntryByPath(tree: FileTreeEntry | null, relativePath: string): FileTreeEntry | null {
188
+ /**
189
+ * The entry at exactly `relativePath` (a file or a folder), or null when the
190
+ * tree has none. It descends only into the folder on the path: an entry's
191
+ * path is its folder's plus its own name, so no other subtree can hold it,
192
+ * and a caller asking on every render does not walk the whole checkout.
193
+ */
194
+ export function findEntryByPath(tree: FileTreeEntry | null, relativePath: string): FileTreeEntry | null {
160
195
  if (!tree) return null;
161
196
  if (tree.relativePath === relativePath) return tree;
162
- if (tree.children) {
163
- for (const child of tree.children) {
197
+ for (const child of tree.children ?? []) {
198
+ if (relativePath === child.relativePath || relativePath.startsWith(`${child.relativePath}/`)) {
164
199
  const found = findEntryByPath(child, relativePath);
165
200
  if (found) return found;
166
201
  }
@@ -2,8 +2,10 @@ import {
2
2
  currentKbLayout,
3
3
  isPlatformFile,
4
4
  isPlatformRestoreShape,
5
+ isRepositoryOwnFile,
5
6
  isRootPlatformFile,
6
7
  platformFileRefusal,
8
+ repositoryOwnFileDeleteRefusal,
7
9
  type FileTreeEntry,
8
10
  } from '@bevel-software/platform-shared';
9
11
  import {
@@ -30,11 +32,13 @@ function repoRelative(wsRelativePath: string, kbDirName: string | null): string
30
32
  * server refuses with — or null when it may.
31
33
  *
32
34
  * Judged on the path's REPO-relative form, because that is what the platform
33
- * reads: `roles.yaml` and the agent guide (`AGENTS.md` unless this deployment
34
- * named it something else) count at the repository root only, so a nested file
35
- * of either name is ordinary content and stays draggable. Outside
36
- * the KB clone, and before `kbDirName` is known, nothing is refused here — the
37
- * server is the gate and says the same sentence.
35
+ * reads: `roles.yaml` counts at the repository root only, so a nested file of
36
+ * that name is ordinary content and stays draggable. (A file under the
37
+ * guide's name — `AGENTS.md`, or the name a deployment saved for the guide —
38
+ * is content wherever it sits: the platform's guide is served from code, not
39
+ * written to the tree.) Outside the KB clone, and before `kbDirName` is
40
+ * known, nothing is refused here — the server is the gate and says the same
41
+ * sentence.
38
42
  */
39
43
  export function platformFileMoveRefusal(
40
44
  wsRelativePath: string,
@@ -45,6 +49,19 @@ export function platformFileMoveRefusal(
45
49
  return isPlatformFile(rel, currentKbLayout()) ? platformFileRefusal(rel) : null;
46
50
  }
47
51
 
52
+ /**
53
+ * Why this row may not be DELETED whoever asks — the same sentence the server
54
+ * refuses with — or null when the caller's write access decides. Only the
55
+ * repository's own files are refused: the root's `access.md` and
56
+ * `roles.yaml`. A nested `access.md` is deleted like any file its caller may
57
+ * write, which hands its folder back to the parent's rules.
58
+ */
59
+ export function platformFileDeleteRefusal(wsRelativePath: string, kbDirName: string | null): string | null {
60
+ const rel = repoRelative(wsRelativePath, kbDirName);
61
+ if (rel === null) return null;
62
+ return isRepositoryOwnFile(rel, currentKbLayout()) ? repositoryOwnFileDeleteRefusal(rel) : null;
63
+ }
64
+
48
65
  /**
49
66
  * Why this row may not be DRAGGED, or null when it may — the rename refusal
50
67
  * minus the one move that is a repair.
@@ -0,0 +1,102 @@
1
+ // @vitest-environment node
2
+ import { describe, it, expect } from 'vitest';
3
+ import { readdirSync, readFileSync, statSync } from 'node:fs';
4
+ import { join, dirname, relative, resolve } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { ESLint } from 'eslint';
7
+
8
+ /**
9
+ * The browser's built-in `confirm()` does not come back.
10
+ *
11
+ * The browser can switch it off ("prevent this page from creating additional
12
+ * dialogs"), after which every call answers false without showing anything —
13
+ * the branch delete stopped working that way. The rule lives in the repo's
14
+ * `eslint.config.js`; `pnpm lint` is not part of CI, so this suite runs that
15
+ * same rule from that same config over the package's source and apps/web's,
16
+ * and the test job fails on a new use.
17
+ */
18
+
19
+ const SRC = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
20
+ const REPO_ROOT = resolve(SRC, '..', '..', '..');
21
+ // The rule covers apps/web too (it mounts the app), so the scan does.
22
+ const WEB_SRC = join(REPO_ROOT, 'apps', 'web', 'src');
23
+ const RULES = new Set(['no-restricted-globals', 'no-restricted-properties']);
24
+
25
+ /**
26
+ * ONE instance for the whole suite. Building one loads the repo's flat config
27
+ * and the typescript parser — seconds on a slow machine — and the first case
28
+ * below lints four fixtures, which built four of them and ran past the
29
+ * default timeout on Windows. The config does not change between cases.
30
+ */
31
+ let instance: ESLint | null = null;
32
+ function eslint(): ESLint {
33
+ instance ??= new ESLint({
34
+ cwd: REPO_ROOT,
35
+ ruleFilter: ({ ruleId }) => RULES.has(ruleId),
36
+ });
37
+ return instance;
38
+ }
39
+
40
+ /** Lint `code` as if it were a file in this package, with the repo's config. */
41
+ async function lintFixture(code: string, dir = SRC): Promise<string[]> {
42
+ const [result] = await eslint().lintText(code, {
43
+ filePath: join(dir, '__lint_fixture__.tsx'),
44
+ });
45
+ return result.messages.map((m) => `${m.ruleId}:${m.line}`);
46
+ }
47
+
48
+ function sourceFiles(dir: string, out: string[] = []): string[] {
49
+ for (const entry of readdirSync(dir)) {
50
+ const full = join(dir, entry);
51
+ if (statSync(full).isDirectory()) sourceFiles(full, out);
52
+ else if (/\.tsx?$/.test(entry)) out.push(full);
53
+ }
54
+ return out;
55
+ }
56
+
57
+ describe('lint: no built-in confirm', () => {
58
+ it('rejects the global confirm() and window.confirm()', async () => {
59
+ expect(await lintFixture("export const a = confirm('Delete?');\n")).toEqual([
60
+ 'no-restricted-globals:1',
61
+ ]);
62
+ expect(await lintFixture("export const b = window.confirm('Delete?');\n")).toEqual([
63
+ 'no-restricted-properties:1',
64
+ ]);
65
+ expect(await lintFixture("export const c = globalThis.confirm('Delete?');\n")).toEqual([
66
+ 'no-restricted-properties:1',
67
+ ]);
68
+ // apps/web is under the same rule.
69
+ expect(await lintFixture("export const d = confirm('Delete?');\n", WEB_SRC)).toEqual([
70
+ 'no-restricted-globals:1',
71
+ ]);
72
+ // The first lint of the suite pays for loading the config and the parser.
73
+ }, 60_000);
74
+
75
+ it("allows a local function called confirm (useConfirm()'s result, the file tree's)", async () => {
76
+ const code = [
77
+ "import { useConfirm } from './shared/components';",
78
+ 'export function useThing() {',
79
+ ' const confirm = useConfirm();',
80
+ " return () => confirm({ title: 'Delete', message: 'Delete?' });",
81
+ '}',
82
+ '',
83
+ ].join('\n');
84
+ expect(await lintFixture(code)).toEqual([]);
85
+ });
86
+
87
+ it('finds no built-in confirm anywhere in core-frontend or apps/web', async () => {
88
+ // Only files that mention the word can break the rule; lint just those so
89
+ // the suite stays quick, with the real config.
90
+ const candidates = [...sourceFiles(SRC), ...sourceFiles(WEB_SRC)].filter((f) =>
91
+ /\bconfirm\b/.test(readFileSync(f, 'utf8')),
92
+ );
93
+ expect(candidates.length).toBeGreaterThan(0);
94
+ const results = await eslint().lintFiles(candidates);
95
+ const hits = results.flatMap((r) =>
96
+ r.messages
97
+ .filter((m) => m.ruleId && RULES.has(m.ruleId))
98
+ .map((m) => `${relative(REPO_ROOT, r.filePath)}:${m.line} ${m.message}`),
99
+ );
100
+ expect(hits).toEqual([]);
101
+ }, 120_000);
102
+ });