@mohantn/gate-keeper 2.1.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 (272) hide show
  1. package/.github/instructions/dotnet-api-integration.instructions.md +416 -0
  2. package/.github/instructions/dotnet-development.instructions.md +353 -0
  3. package/.github/instructions/dotnet-testing.instructions.md +406 -0
  4. package/.github/instructions/gate-keeper.instructions.md +91 -0
  5. package/.github/instructions/react-development.instructions.md +315 -0
  6. package/.github/instructions/react-testing-optimization.instructions.md +373 -0
  7. package/.github/instructions/uiux.instructions.md +261 -0
  8. package/LICENSE +21 -0
  9. package/README.md +181 -0
  10. package/dist/analyzer/coverage-analyzer.d.ts +126 -0
  11. package/dist/analyzer/coverage-analyzer.d.ts.map +1 -0
  12. package/dist/analyzer/coverage-analyzer.js +633 -0
  13. package/dist/analyzer/coverage-analyzer.js.map +1 -0
  14. package/dist/analyzer/csharp-analyzer.d.ts +28 -0
  15. package/dist/analyzer/csharp-analyzer.d.ts.map +1 -0
  16. package/dist/analyzer/csharp-analyzer.js +437 -0
  17. package/dist/analyzer/csharp-analyzer.js.map +1 -0
  18. package/dist/analyzer/pattern-detector.d.ts +5 -0
  19. package/dist/analyzer/pattern-detector.d.ts.map +1 -0
  20. package/dist/analyzer/pattern-detector.js +74 -0
  21. package/dist/analyzer/pattern-detector.js.map +1 -0
  22. package/dist/analyzer/refactoring-advisor.d.ts +7 -0
  23. package/dist/analyzer/refactoring-advisor.d.ts.map +1 -0
  24. package/dist/analyzer/refactoring-advisor.js +280 -0
  25. package/dist/analyzer/refactoring-advisor.js.map +1 -0
  26. package/dist/analyzer/sonar-eslint-runner.d.ts +3 -0
  27. package/dist/analyzer/sonar-eslint-runner.d.ts.map +1 -0
  28. package/dist/analyzer/sonar-eslint-runner.js +136 -0
  29. package/dist/analyzer/sonar-eslint-runner.js.map +1 -0
  30. package/dist/analyzer/sonar-rule-map.d.ts +19 -0
  31. package/dist/analyzer/sonar-rule-map.d.ts.map +1 -0
  32. package/dist/analyzer/sonar-rule-map.js +67 -0
  33. package/dist/analyzer/sonar-rule-map.js.map +1 -0
  34. package/dist/analyzer/string-analyzer.d.ts +27 -0
  35. package/dist/analyzer/string-analyzer.d.ts.map +1 -0
  36. package/dist/analyzer/string-analyzer.js +274 -0
  37. package/dist/analyzer/string-analyzer.js.map +1 -0
  38. package/dist/analyzer/typescript-analyzer.d.ts +27 -0
  39. package/dist/analyzer/typescript-analyzer.d.ts.map +1 -0
  40. package/dist/analyzer/typescript-analyzer.js +437 -0
  41. package/dist/analyzer/typescript-analyzer.js.map +1 -0
  42. package/dist/analyzer/universal-analyzer.d.ts +10 -0
  43. package/dist/analyzer/universal-analyzer.d.ts.map +1 -0
  44. package/dist/analyzer/universal-analyzer.js +155 -0
  45. package/dist/analyzer/universal-analyzer.js.map +1 -0
  46. package/dist/cache/quality-cache.d.ts +119 -0
  47. package/dist/cache/quality-cache.d.ts.map +1 -0
  48. package/dist/cache/quality-cache.js +130 -0
  49. package/dist/cache/quality-cache.js.map +1 -0
  50. package/dist/cache/sqlite-cache.d.ts +43 -0
  51. package/dist/cache/sqlite-cache.d.ts.map +1 -0
  52. package/dist/cache/sqlite-cache.js +346 -0
  53. package/dist/cache/sqlite-cache.js.map +1 -0
  54. package/dist/cli/query-repl.d.ts +37 -0
  55. package/dist/cli/query-repl.d.ts.map +1 -0
  56. package/dist/cli/query-repl.js +298 -0
  57. package/dist/cli/query-repl.js.map +1 -0
  58. package/dist/cli/repl-algorithms.d.ts +49 -0
  59. package/dist/cli/repl-algorithms.d.ts.map +1 -0
  60. package/dist/cli/repl-algorithms.js +147 -0
  61. package/dist/cli/repl-algorithms.js.map +1 -0
  62. package/dist/cli/setup-core.d.ts +38 -0
  63. package/dist/cli/setup-core.d.ts.map +1 -0
  64. package/dist/cli/setup-core.js +427 -0
  65. package/dist/cli/setup-core.js.map +1 -0
  66. package/dist/cli/setup.d.ts +25 -0
  67. package/dist/cli/setup.d.ts.map +1 -0
  68. package/dist/cli/setup.js +159 -0
  69. package/dist/cli/setup.js.map +1 -0
  70. package/dist/cli-entry.d.ts +19 -0
  71. package/dist/cli-entry.d.ts.map +1 -0
  72. package/dist/cli-entry.js +178 -0
  73. package/dist/cli-entry.js.map +1 -0
  74. package/dist/daemon/watch-mode.d.ts +41 -0
  75. package/dist/daemon/watch-mode.d.ts.map +1 -0
  76. package/dist/daemon/watch-mode.js +163 -0
  77. package/dist/daemon/watch-mode.js.map +1 -0
  78. package/dist/daemon.d.ts +24 -0
  79. package/dist/daemon.d.ts.map +1 -0
  80. package/dist/daemon.js +357 -0
  81. package/dist/daemon.js.map +1 -0
  82. package/dist/github/app.d.ts +34 -0
  83. package/dist/github/app.d.ts.map +1 -0
  84. package/dist/github/app.js +261 -0
  85. package/dist/github/app.js.map +1 -0
  86. package/dist/github/commenter.d.ts +67 -0
  87. package/dist/github/commenter.d.ts.map +1 -0
  88. package/dist/github/commenter.js +155 -0
  89. package/dist/github/commenter.js.map +1 -0
  90. package/dist/graph/dependency-graph.d.ts +28 -0
  91. package/dist/graph/dependency-graph.d.ts.map +1 -0
  92. package/dist/graph/dependency-graph.js +198 -0
  93. package/dist/graph/dependency-graph.js.map +1 -0
  94. package/dist/graph/global-graph.d.ts +65 -0
  95. package/dist/graph/global-graph.d.ts.map +1 -0
  96. package/dist/graph/global-graph.js +153 -0
  97. package/dist/graph/global-graph.js.map +1 -0
  98. package/dist/graph/graph-algorithms.d.ts +90 -0
  99. package/dist/graph/graph-algorithms.d.ts.map +1 -0
  100. package/dist/graph/graph-algorithms.js +180 -0
  101. package/dist/graph/graph-algorithms.js.map +1 -0
  102. package/dist/graph/graph-export.d.ts +68 -0
  103. package/dist/graph/graph-export.d.ts.map +1 -0
  104. package/dist/graph/graph-export.js +264 -0
  105. package/dist/graph/graph-export.js.map +1 -0
  106. package/dist/graph/graph-report.d.ts +34 -0
  107. package/dist/graph/graph-report.d.ts.map +1 -0
  108. package/dist/graph/graph-report.js +136 -0
  109. package/dist/graph/graph-report.js.map +1 -0
  110. package/dist/graph/graph-summary.d.ts +68 -0
  111. package/dist/graph/graph-summary.d.ts.map +1 -0
  112. package/dist/graph/graph-summary.js +213 -0
  113. package/dist/graph/graph-summary.js.map +1 -0
  114. package/dist/graph/graphify-ignore.d.ts +32 -0
  115. package/dist/graph/graphify-ignore.d.ts.map +1 -0
  116. package/dist/graph/graphify-ignore.js +124 -0
  117. package/dist/graph/graphify-ignore.js.map +1 -0
  118. package/dist/graph/question-suggester.d.ts +30 -0
  119. package/dist/graph/question-suggester.d.ts.map +1 -0
  120. package/dist/graph/question-suggester.js +113 -0
  121. package/dist/graph/question-suggester.js.map +1 -0
  122. package/dist/graph/relationship-extractor.d.ts +40 -0
  123. package/dist/graph/relationship-extractor.d.ts.map +1 -0
  124. package/dist/graph/relationship-extractor.js +254 -0
  125. package/dist/graph/relationship-extractor.js.map +1 -0
  126. package/dist/graph/relationship-types.d.ts +24 -0
  127. package/dist/graph/relationship-types.d.ts.map +1 -0
  128. package/dist/graph/relationship-types.js +21 -0
  129. package/dist/graph/relationship-types.js.map +1 -0
  130. package/dist/graph/surprising-connections.d.ts +39 -0
  131. package/dist/graph/surprising-connections.d.ts.map +1 -0
  132. package/dist/graph/surprising-connections.js +127 -0
  133. package/dist/graph/surprising-connections.js.map +1 -0
  134. package/dist/hook-pre-tool-use.d.ts +14 -0
  135. package/dist/hook-pre-tool-use.d.ts.map +1 -0
  136. package/dist/hook-pre-tool-use.js +167 -0
  137. package/dist/hook-pre-tool-use.js.map +1 -0
  138. package/dist/hook-receiver.d.ts +29 -0
  139. package/dist/hook-receiver.d.ts.map +1 -0
  140. package/dist/hook-receiver.js +327 -0
  141. package/dist/hook-receiver.js.map +1 -0
  142. package/dist/hooks/git-hooks.d.ts +30 -0
  143. package/dist/hooks/git-hooks.d.ts.map +1 -0
  144. package/dist/hooks/git-hooks.js +179 -0
  145. package/dist/hooks/git-hooks.js.map +1 -0
  146. package/dist/mcp/cache-preload.d.ts +29 -0
  147. package/dist/mcp/cache-preload.d.ts.map +1 -0
  148. package/dist/mcp/cache-preload.js +103 -0
  149. package/dist/mcp/cache-preload.js.map +1 -0
  150. package/dist/mcp/handlers/analysis.d.ts +4 -0
  151. package/dist/mcp/handlers/analysis.d.ts.map +1 -0
  152. package/dist/mcp/handlers/analysis.js +196 -0
  153. package/dist/mcp/handlers/analysis.js.map +1 -0
  154. package/dist/mcp/handlers/context.d.ts +25 -0
  155. package/dist/mcp/handlers/context.d.ts.map +1 -0
  156. package/dist/mcp/handlers/context.js +382 -0
  157. package/dist/mcp/handlers/context.js.map +1 -0
  158. package/dist/mcp/handlers/graph-intelligence.d.ts +26 -0
  159. package/dist/mcp/handlers/graph-intelligence.d.ts.map +1 -0
  160. package/dist/mcp/handlers/graph-intelligence.js +371 -0
  161. package/dist/mcp/handlers/graph-intelligence.js.map +1 -0
  162. package/dist/mcp/handlers/graph-query.d.ts +25 -0
  163. package/dist/mcp/handlers/graph-query.d.ts.map +1 -0
  164. package/dist/mcp/handlers/graph-query.js +410 -0
  165. package/dist/mcp/handlers/graph-query.js.map +1 -0
  166. package/dist/mcp/handlers/graph.d.ts +5 -0
  167. package/dist/mcp/handlers/graph.d.ts.map +1 -0
  168. package/dist/mcp/handlers/graph.js +283 -0
  169. package/dist/mcp/handlers/graph.js.map +1 -0
  170. package/dist/mcp/handlers/impact-format.d.ts +9 -0
  171. package/dist/mcp/handlers/impact-format.d.ts.map +1 -0
  172. package/dist/mcp/handlers/impact-format.js +189 -0
  173. package/dist/mcp/handlers/impact-format.js.map +1 -0
  174. package/dist/mcp/handlers/impact.d.ts +4 -0
  175. package/dist/mcp/handlers/impact.d.ts.map +1 -0
  176. package/dist/mcp/handlers/impact.js +139 -0
  177. package/dist/mcp/handlers/impact.js.map +1 -0
  178. package/dist/mcp/handlers/improvement.d.ts +4 -0
  179. package/dist/mcp/handlers/improvement.d.ts.map +1 -0
  180. package/dist/mcp/handlers/improvement.js +136 -0
  181. package/dist/mcp/handlers/improvement.js.map +1 -0
  182. package/dist/mcp/handlers/index.d.ts +14 -0
  183. package/dist/mcp/handlers/index.d.ts.map +1 -0
  184. package/dist/mcp/handlers/index.js +36 -0
  185. package/dist/mcp/handlers/index.js.map +1 -0
  186. package/dist/mcp/handlers/platform-installer.d.ts +10 -0
  187. package/dist/mcp/handlers/platform-installer.d.ts.map +1 -0
  188. package/dist/mcp/handlers/platform-installer.js +168 -0
  189. package/dist/mcp/handlers/platform-installer.js.map +1 -0
  190. package/dist/mcp/handlers/pr-review.d.ts +33 -0
  191. package/dist/mcp/handlers/pr-review.d.ts.map +1 -0
  192. package/dist/mcp/handlers/pr-review.js +170 -0
  193. package/dist/mcp/handlers/pr-review.js.map +1 -0
  194. package/dist/mcp/handlers/shared.d.ts +20 -0
  195. package/dist/mcp/handlers/shared.d.ts.map +1 -0
  196. package/dist/mcp/handlers/shared.js +27 -0
  197. package/dist/mcp/handlers/shared.js.map +1 -0
  198. package/dist/mcp/handlers/types.d.ts +46 -0
  199. package/dist/mcp/handlers/types.d.ts.map +1 -0
  200. package/dist/mcp/handlers/types.js +3 -0
  201. package/dist/mcp/handlers/types.js.map +1 -0
  202. package/dist/mcp/helpers.d.ts +36 -0
  203. package/dist/mcp/helpers.d.ts.map +1 -0
  204. package/dist/mcp/helpers.js +199 -0
  205. package/dist/mcp/helpers.js.map +1 -0
  206. package/dist/mcp/installer.d.ts +22 -0
  207. package/dist/mcp/installer.d.ts.map +1 -0
  208. package/dist/mcp/installer.js +341 -0
  209. package/dist/mcp/installer.js.map +1 -0
  210. package/dist/mcp/server.d.ts +111 -0
  211. package/dist/mcp/server.d.ts.map +1 -0
  212. package/dist/mcp/server.js +216 -0
  213. package/dist/mcp/server.js.map +1 -0
  214. package/dist/mcp/token-tracker.d.ts +47 -0
  215. package/dist/mcp/token-tracker.d.ts.map +1 -0
  216. package/dist/mcp/token-tracker.js +93 -0
  217. package/dist/mcp/token-tracker.js.map +1 -0
  218. package/dist/quality-loop/file-lock.d.ts +12 -0
  219. package/dist/quality-loop/file-lock.d.ts.map +1 -0
  220. package/dist/quality-loop/file-lock.js +38 -0
  221. package/dist/quality-loop/file-lock.js.map +1 -0
  222. package/dist/quality-loop/fix-worker.d.ts +44 -0
  223. package/dist/quality-loop/fix-worker.d.ts.map +1 -0
  224. package/dist/quality-loop/fix-worker.js +414 -0
  225. package/dist/quality-loop/fix-worker.js.map +1 -0
  226. package/dist/quality-loop/orchestrator.d.ts +137 -0
  227. package/dist/quality-loop/orchestrator.d.ts.map +1 -0
  228. package/dist/quality-loop/orchestrator.js +894 -0
  229. package/dist/quality-loop/orchestrator.js.map +1 -0
  230. package/dist/quality-loop/queue-manager.d.ts +45 -0
  231. package/dist/quality-loop/queue-manager.d.ts.map +1 -0
  232. package/dist/quality-loop/queue-manager.js +173 -0
  233. package/dist/quality-loop/queue-manager.js.map +1 -0
  234. package/dist/rating/rating-calculator.d.ts +15 -0
  235. package/dist/rating/rating-calculator.d.ts.map +1 -0
  236. package/dist/rating/rating-calculator.js +136 -0
  237. package/dist/rating/rating-calculator.js.map +1 -0
  238. package/dist/types/agent.d.ts +49 -0
  239. package/dist/types/agent.d.ts.map +1 -0
  240. package/dist/types/agent.js +7 -0
  241. package/dist/types/agent.js.map +1 -0
  242. package/dist/types.d.ts +156 -0
  243. package/dist/types.d.ts.map +1 -0
  244. package/dist/types.js +3 -0
  245. package/dist/types.js.map +1 -0
  246. package/dist/util/fix-text.d.ts +7 -0
  247. package/dist/util/fix-text.d.ts.map +1 -0
  248. package/dist/util/fix-text.js +13 -0
  249. package/dist/util/fix-text.js.map +1 -0
  250. package/dist/viz/graph-viz.d.ts +40 -0
  251. package/dist/viz/graph-viz.d.ts.map +1 -0
  252. package/dist/viz/graph-viz.js +332 -0
  253. package/dist/viz/graph-viz.js.map +1 -0
  254. package/dist/viz/viz-helpers.d.ts +13 -0
  255. package/dist/viz/viz-helpers.d.ts.map +1 -0
  256. package/dist/viz/viz-helpers.js +134 -0
  257. package/dist/viz/viz-helpers.js.map +1 -0
  258. package/dist/viz/viz-routes.d.ts +28 -0
  259. package/dist/viz/viz-routes.d.ts.map +1 -0
  260. package/dist/viz/viz-routes.js +333 -0
  261. package/dist/viz/viz-routes.js.map +1 -0
  262. package/dist/viz/viz-scanner.d.ts +20 -0
  263. package/dist/viz/viz-scanner.d.ts.map +1 -0
  264. package/dist/viz/viz-scanner.js +241 -0
  265. package/dist/viz/viz-scanner.js.map +1 -0
  266. package/dist/viz/viz-server.d.ts +38 -0
  267. package/dist/viz/viz-server.d.ts.map +1 -0
  268. package/dist/viz/viz-server.js +240 -0
  269. package/dist/viz/viz-server.js.map +1 -0
  270. package/package.json +89 -0
  271. package/scripts/postinstall.js +28 -0
  272. package/scripts/setup.sh +113 -0
@@ -0,0 +1,261 @@
1
+ # UI/UX Design System Instructions (Store Media Client)
2
+
3
+ **Scope**: All design & component files | **Version**: 3.0 | **Tags**: `dh-component-library`, `emotion`, `accessibility`, `wcag`
4
+
5
+ ## 🔴 MANDATORY: Use dh-component-library First
6
+ ALWAYS check dh-component-library and store-components before creating custom components:
7
+
8
+ **dh-component-library**: Button, Flex, Section, TextInput, DHIcon, ErrorPage, NotificationBanner, Spinner, LoaderOverlay, Toaster, ConfirmationDialog, ModalBox, GenericTable
9
+
10
+ **store-components**: PageCard, StoreDateRangePicker, TableDrawerTab, DataRow
11
+
12
+ Only create custom components when library components cannot meet requirements.
13
+
14
+ ## Core Design Principles
15
+
16
+ ### 1. Responsive Design
17
+ - **Mobile-First**: Design for 320px, then scale up
18
+ - **Breakpoints**: 320px (mobile) → 768px (tablet) → 1024px (desktop) → 1440px (wide) → 1920px (ultra-wide)
19
+ - **Fluid Typography**: Scale font sizes between breakpoints using `clamp()`
20
+ - **Flexible Layouts**: Grid/Flexbox with max-widths; avoid fixed widths
21
+
22
+ **CSS Example**:
23
+ ```css
24
+ /* Font scaling */
25
+ h1 { font-size: clamp(24px, 5vw, 48px); }
26
+
27
+ /* Responsive spacing */
28
+ .container {
29
+ padding: clamp(16px, 5vw, 32px);
30
+ max-width: 1200px;
31
+ margin: 0 auto;
32
+ }
33
+
34
+ /* Grid layout */
35
+ .grid {
36
+ display: grid;
37
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
38
+ gap: clamp(16px, 3vw, 32px);
39
+ }
40
+ ```
41
+
42
+ ### 2. Typography (dh-component-library Theme)
43
+ - **Use theme.typography**: h1, h2, h3, body1, body2, caption
44
+ - **Line Height**: Defined in theme (1.4-1.6 body, 1.2 headings)
45
+ - **Never hardcode**: Always use `theme.typography.*`
46
+
47
+ **Usage**:
48
+ ```typescript
49
+ import styled from '@emotion/styled';
50
+ import { ThemeType } from 'src/types';
51
+
52
+ const Title = styled.h2<{ theme?: ThemeType }>(({ theme }) => ({
53
+ ...theme?.typography.h2,
54
+ color: theme?.palette?.greyscale?.[700],
55
+ marginBottom: '16px',
56
+ }));
57
+ ```
58
+
59
+ ### 3. Color System (Theme Palette)
60
+ - **Greyscale**: theme.palette.greyscale[50-900] (50=lightest, 900=darkest)
61
+ - **Semantic**: primary, secondary, error, warning, success, info
62
+ - **Contrast**: WCAG AA minimum 4.5:1 (text), 3:1 (large text/UI)
63
+ - **Always use optional chaining**: `theme?.palette?.greyscale?.[200]`
64
+
65
+ **Pattern**:
66
+ ```typescript
67
+ const FilterActions = styled(Flex)<{ theme?: ThemeType }>(({ theme }) => ({
68
+ borderTop: `1px solid ${theme?.palette?.greyscale?.[200] || '#e5e7eb'}`,
69
+ color: theme?.palette?.greyscale?.[700],
70
+ // Provide fallback values for safety
71
+ }));
72
+ ```
73
+
74
+ ### 4. Spacing (Theme System)
75
+ - **Use theme.spacing()**: spacing(1)=8px, spacing(2)=16px, spacing(3)=24px
76
+ - **Direct values for gaps**: '16px', '24px' (common in project)
77
+ - **Consistent**: 4px, 8px, 12px, 16px, 24px, 32px, 48px
78
+
79
+ ```typescript
80
+ const Container = styled.div<{ theme?: ThemeType }>(({ theme }) => ({
81
+ padding: theme?.spacing?.(2) || '16px',
82
+ gap: '24px',
83
+ marginBottom: '16px',
84
+ }));
85
+ ```
86
+
87
+ ### 5. Accessibility (WCAG AA - Project Standards)
88
+
89
+ **Mandatory Checks**:
90
+ - ✅ Touch targets ≥ 44x44px (set in styled components)
91
+ - ✅ Color contrast ≥ 4.5:1 (verify with theme palette)
92
+ - ✅ data-testid on ALL interactive elements (hierarchical naming)
93
+ - ✅ Keyboard navigation: Tab order, focus indicators
94
+ - ✅ i18n: All text via `t('key')` from `src/I18n`
95
+ - ✅ Semantic HTML: Use dh-component-library components
96
+ - ✅ Skip links: Include on admin pages
97
+ - ✅ ARIA: aria-label, aria-describedby when needed
98
+
99
+ **Test ID Pattern**:
100
+ ```typescript
101
+ import { DATA_TEST_ID } from 'src/test/generic-ids';
102
+
103
+ export const DATA_TEST_ID = {
104
+ storeAvailability: {
105
+ section: 'section-store-availability',
106
+ field: {
107
+ storeSearch: 'field-store-search',
108
+ },
109
+ button: {
110
+ addStores: 'button-add-stores',
111
+ },
112
+ },
113
+ };
114
+
115
+ // Usage
116
+ <Button data-testid={DATA_TEST_ID.storeAvailability.button.addStores}>
117
+ {t('addStores')}
118
+ </Button>
119
+ ```
120
+ ```
121
+
122
+ ## Component Patterns (Project Standards)
123
+
124
+ ### Form Components (Use dh-component-library)
125
+ ```typescript
126
+ import { TextInput } from 'dh-component-library';
127
+ import { FormElementText } from 'src/Components/Forms/FormElements';
128
+ import { t } from 'src/I18n';
129
+
130
+ <FormElementText
131
+ id="activation-name"
132
+ label={t('activationName')}
133
+ dataTestId={DATA_TEST_ID.generalInfo.field.name}
134
+ isOptional={false}
135
+ onChange={handleChange}
136
+ onBlur={handleBlur}
137
+ counterMaxLimit={255}
138
+ unsafeNativeInputProps={{ placeholder: t('enterName') }}
139
+ />
140
+ ```
141
+
142
+ ### Layout Structure
143
+ ```tsx
144
+ import { PageCard } from 'store-components';
145
+ import { Section, Flex } from 'dh-component-library';
146
+
147
+ <Section gap="24">
148
+ <PageCard
149
+ title={t('sectionTitle')}
150
+ titleDescription={t('sectionDescription')}
151
+ divider
152
+ >
153
+ <Flex direction="column" gap="16px">
154
+ {/* Content */}
155
+ </Flex>
156
+ </PageCard>
157
+ </Section>
158
+ ```
159
+
160
+ ### Styled Components Pattern
161
+ ```typescript
162
+ import styled from '@emotion/styled';
163
+ import { Flex } from 'dh-component-library';
164
+ import { ThemeType } from 'src/types';
165
+
166
+ const FilterGrid = styled.div<{ theme?: ThemeType }>(({ theme }) => ({
167
+ display: 'grid',
168
+ gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))',
169
+ gap: '24px',
170
+ marginBottom: '24px',
171
+
172
+ '& > *': {
173
+ minHeight: '44px', // Accessibility: touch targets
174
+ },
175
+
176
+ '@media (max-width: 768px)': {
177
+ gridTemplateColumns: '1fr',
178
+ gap: '16px',
179
+ },
180
+ }));
181
+
182
+ // Always include responsive breakpoints and accessibility standards
183
+ ```
184
+
185
+ ### Loading States
186
+ ```typescript
187
+ import { LoadingSpinner } from 'src/Components/Layout/LoadingSpinner';
188
+ import { DATA_TEST_ID } from 'src/test/generic-ids';
189
+
190
+ // Overlay loading
191
+ <LoadingSpinner withBackdrop testId={DATA_TEST_ID.loadingSpinner} />
192
+
193
+ // Inline loading
194
+ <LoadingSpinner size={32} />
195
+ ```
196
+
197
+ ### Notifications
198
+ ```typescript
199
+ import { NotificationBanner } from 'dh-component-library';
200
+ import { t } from 'src/I18n';
201
+
202
+ <NotificationBanner
203
+ title={t('notificationTitle')}
204
+ message={t('notificationMessage')}
205
+ variant="warning" // 'success' | 'error' | 'info' | 'warning'
206
+ dataTestId="notification-banner"
207
+ />
208
+ ```
209
+
210
+ ## Common Mistakes ❌
211
+
212
+ - Creating custom components when dh-component-library has equivalent
213
+ - Hardcoding text instead of using `t('key')`
214
+ - Missing data-testid attributes
215
+ - Not using theme for colors/typography
216
+ - Touch targets < 44px
217
+ - Color contrast < 4.5:1
218
+ - Missing optional chaining: `theme?.palette?.greyscale?.[200]`
219
+ - Skipping responsive breakpoints
220
+
221
+ ## Testing Checklist ✅
222
+
223
+ **Test IDs**:
224
+ - All interactive elements have hierarchical test IDs
225
+ - Pattern: `DATA_TEST_ID.section.subsection.element`
226
+ - Export from centralized file
227
+
228
+ **Keyboard Navigation**:
229
+ - Tab through all interactive elements
230
+ - Enter/Space activate buttons
231
+ - Escape closes modals
232
+
233
+ **Responsive** (Test at 320px, 768px, 1024px):
234
+ - Touch targets ≥ 44px
235
+ - Text readable at all breakpoints
236
+ - Grid layouts adapt correctly
237
+
238
+ **Contrast** (Use browser DevTools):
239
+ - Min 4.5:1 for text
240
+ - Min 3:1 for large text/UI
241
+
242
+ **i18n**:
243
+ - All text uses `t('key')`
244
+ - No hardcoded strings
245
+
246
+ ## Tools
247
+
248
+ - **dh-component-library**: Primary component library
249
+ - **Emotion**: CSS-in-JS styling
250
+ - **MSW**: API mocking for tests
251
+ - **Cypress**: E2E testing
252
+ - **axe DevTools**: Accessibility audit
253
+ - **WebAIM**: Contrast checker
254
+
255
+ ## Resources
256
+
257
+ - [dh-component-library Docs](https://dh-component-library-docs)
258
+ - [store-components API](https://store-components-docs)
259
+ - [Emotion Documentation](https://emotion.sh)
260
+ - [WCAG 2.1 Guidelines](https://www.w3.org/WAI/WCAG21/quickref/)
261
+ - [WAI-ARIA Practices](https://www.w3.org/WAI/ARIA/apg/)
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mohan Talkad Nagaraju
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,181 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License">
3
+ <img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg" alt="Node >= 18">
4
+ <img src="https://img.shields.io/badge/TypeScript-5.0+-3178C6.svg" alt="TypeScript">
5
+ <img src="https://img.shields.io/badge/MCP-5_tools-6C47FF.svg" alt="MCP">
6
+ </p>
7
+
8
+ <h1 align="center">⬡ Gate Keeper</h1>
9
+ <p align="center"><strong>Graph-aware quality gates for AI-assisted development.</strong></p>
10
+
11
+ ---
12
+
13
+ ## What it is
14
+
15
+ Gate Keeper analyzes every file your AI agent writes — TypeScript Compiler API for TS/JS/JSX, Roslyn (or text fallback) for C# — rates it 0–10, and publishes the result to a live dependency graph. Agents see the graph through a 5-tool MCP server; humans see it at `http://localhost:5378/viz`.
16
+
17
+ There is no installer. Two integration points, both standard:
18
+
19
+ - **Claude Code** — two hook entries in `~/.claude/settings.json`.
20
+ - **GitHub Copilot / VS Code** — `.github/instructions/gate-keeper.instructions.md` is auto-injected on every file edit.
21
+
22
+ ---
23
+
24
+ ## Quick Start
25
+
26
+ ```bash
27
+ bash scripts/setup.sh
28
+ ```
29
+
30
+ Installs deps, builds, starts the daemon, and writes the Claude hooks to `~/.claude/settings.json` if absent. Open **http://localhost:5378/viz**.
31
+
32
+ To run pieces individually:
33
+
34
+ ```bash
35
+ npm run build:all # TypeScript + dashboard
36
+ npm run daemon # start daemon (ports 5378 / 5379)
37
+ npm run mcp # start MCP server (stdio)
38
+ npm test # run tests
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Claude Code integration
44
+
45
+ Add these two hooks to `~/.claude/settings.json` (replace `/abs/path/to/gate-keeper`):
46
+
47
+ ```json
48
+ {
49
+ "hooks": {
50
+ "PreToolUse": [
51
+ {
52
+ "matcher": "Write|Edit|MultiEdit",
53
+ "hooks": [{ "type": "command", "command": "node /abs/path/to/gate-keeper/dist/hook-pre-tool-use.js" }]
54
+ }
55
+ ],
56
+ "PostToolUse": [
57
+ {
58
+ "matcher": "Write|Edit|MultiEdit",
59
+ "hooks": [{ "type": "command", "command": "node /abs/path/to/gate-keeper/dist/hook-receiver.js" }]
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ ```
65
+
66
+ - **PreToolUse** — calls `/api/impact-set` and blocks the edit (exit 2) when 3+ fragile dependents would break.
67
+ - **PostToolUse** — analyzes the written file and blocks (exit 2) when the rating falls below `minRating` (default 6.5, configurable in `~/.gate-keeper/config.json`).
68
+
69
+ Both hooks exit in under 100 ms.
70
+
71
+ ---
72
+
73
+ ## GitHub Copilot / VS Code integration
74
+
75
+ `.github/instructions/gate-keeper.instructions.md` ships in the repo with `applyTo: "**/*.{ts,tsx,jsx,js,cs}"`. Copilot auto-loads it on every matching edit — no extra setup. The instructions tell the agent to call the 4 MCP tools at the right phases (session start, pre-edit, after bulk changes).
76
+
77
+ To let VS Code discover the MCP server, add `.vscode/mcp.json`:
78
+
79
+ ```json
80
+ {
81
+ "servers": {
82
+ "gate-keeper": {
83
+ "command": "node",
84
+ "args": ["/abs/path/to/gate-keeper/dist/mcp/server.js"]
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ ---
91
+
92
+ ## MCP tools (5)
93
+
94
+ | Tool | Purpose |
95
+ |------|---------|
96
+ | `get_quality_rules` | Scoring thresholds, deductions, minimum rating. Call once per session. |
97
+ | `get_file_context` | Single-file dossier: rating, imports, importers, cycles, trend, git diff. |
98
+ | `get_dependency_graph` | Full repo graph in compact LLM-optimized format: `nodes` (relative paths), `nd` (rating/violations/LOC matched by index), `adj` (integer-indexed adjacency). |
99
+ | `get_graph_summary` | Pre-computed analytics: rating distribution, hotspots (fan-in/fan-out), worst files, module coupling. |
100
+ | `get_codebase_health` | Avg rating, distribution, worst files, common violations, fix order. |
101
+
102
+ Test it manually:
103
+
104
+ ```bash
105
+ echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node dist/mcp/server.js
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Quality system
111
+
112
+ Each file rated 0–10 (10 minus deductions). Defaults:
113
+
114
+ | Deduction | Condition |
115
+ |-----------|-----------|
116
+ | −1.5 / error | missing `key`, empty catch |
117
+ | −0.5 / warning | `any`, god class, long method, tight coupling |
118
+ | −0.1 / info | `console.log`, magic number |
119
+ | −2.0 / −1.0 | Cyclomatic complexity > 20 / > 10 |
120
+ | −2.0 / −0.5 | Import count > 30 / > 15 |
121
+ | −1.5 / −0.5 | LOC > 500 / > 300 |
122
+ | −1.0 / cycle | Circular dependency |
123
+ | −2.5 / −2.0 / −1.0 | Test coverage < 30% / < 50% / < 80% |
124
+
125
+ **Minimum passing rating: 7.0** (the post-edit hook blocks anything below `minRating`).
126
+
127
+ Override threshold in `~/.gate-keeper/config.json`.
128
+
129
+ ---
130
+
131
+ ## Architecture
132
+
133
+ ```
134
+ Claude Code VS Code / Copilot
135
+ │ │
136
+ │ PreToolUse → hook-pre-tool-use.js │ reads
137
+ │ PostToolUse → hook-receiver.js │ .github/instructions/*
138
+ ▼ ▼
139
+ ┌──────────────────────────────────────────────────┐
140
+ │ daemon (ports 5378 / 5379) │
141
+ │ UniversalAnalyzer → RatingCalc → SqliteCache │
142
+ │ DependencyGraph (in-memory, cycle detection) │
143
+ └──────────┬───────────────────┬───────────────────┘
144
+ │ WebSocket+HTTP │ stdio
145
+ ▼ ▼
146
+ ┌────────────────┐ ┌────────────────┐
147
+ │ Dashboard │ │ MCP Server │
148
+ │ :5378/viz │ │ (5 tools) │
149
+ └────────────────┘ └────────────────┘
150
+ ```
151
+
152
+ ### Key files
153
+
154
+ | Path | Purpose |
155
+ |------|---------|
156
+ | `src/hook-pre-tool-use.ts` | PreToolUse hook — blocks risky edits, exit 2 |
157
+ | `src/hook-receiver.ts` | PostToolUse / SessionStart hook — < 100 ms, exit 2 = block |
158
+ | `src/daemon.ts` | Long-lived daemon, ports 5378 / 5379 |
159
+ | `src/analyzer/` | TS Compiler API + C# analyzers |
160
+ | `src/rating/rating-calculator.ts` | 0–10 scoring |
161
+ | `src/graph/` | Dependency graph, cycles, centrality, BFS impact sets |
162
+ | `src/mcp/server.ts` | 5-tool MCP server (stdio) |
163
+ | `src/viz/` | Dashboard server + HTML visualizer |
164
+
165
+ ---
166
+
167
+ ## Ports & files
168
+
169
+ | Resource | Purpose |
170
+ |----------|---------|
171
+ | `:5378` | Dashboard HTTP + WebSocket |
172
+ | `:5379` | Daemon IPC (localhost only) |
173
+ | `~/.gate-keeper/cache.db` | SQLite — analyses, rating history, repos |
174
+ | `~/.gate-keeper/config.json` | `minRating` threshold (default 6.5) |
175
+ | `~/.gate-keeper/daemon.pid` | PID file |
176
+
177
+ ---
178
+
179
+ ## License
180
+
181
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,126 @@
1
+ import { Violation } from '../types';
2
+ export interface FileCoverage {
3
+ filePath: string;
4
+ /** Map of line number → execution count */
5
+ lines: Map<number, number>;
6
+ /** Total instrumented lines */
7
+ linesFound: number;
8
+ /** Lines with at least one execution */
9
+ linesHit: number;
10
+ /** Coverage percentage 0–100 */
11
+ coveragePercent: number;
12
+ }
13
+ export interface CoverageResult {
14
+ /** undefined when coverage was not measured (no test file, hollow test, etc.) */
15
+ coveragePercent?: number;
16
+ uncoveredLines: number[];
17
+ violations: Violation[];
18
+ }
19
+ export declare class CoverageAnalyzer {
20
+ /** Per-project cache entry tracking both parsed data and file modification time. */
21
+ private coverageCache;
22
+ /** Max time (ms) to wait for a test runner to produce coverage. */
23
+ private static readonly RUNNER_TIMEOUT_MS;
24
+ /**
25
+ * Check coverage for a given source file.
26
+ * 1. Uses existing LCOV data when available.
27
+ * 2. If no LCOV exists but a test file is found, runs that test with
28
+ * coverage to generate LCOV on the fly for the file.
29
+ * 3. Falls back to a "no test file" warning when nothing is found.
30
+ */
31
+ checkCoverage(filePath: string): Promise<CoverageResult | null>;
32
+ /**
33
+ * Build a CoverageResult from parsed LCOV file coverage data.
34
+ */
35
+ private buildCoverageResult;
36
+ /**
37
+ * Detect which test runner is available in the project.
38
+ * Returns the runner name or null.
39
+ */
40
+ private detectTestRunner;
41
+ /**
42
+ * Run the test file with coverage enabled and parse the resulting LCOV
43
+ * to get per-line coverage for the source file.
44
+ */
45
+ private runCoverageForFile;
46
+ /**
47
+ * Build CLI arguments for the test runner.
48
+ */
49
+ private buildRunnerArgs;
50
+ /**
51
+ * Recursively remove a directory (sync). Safe for temp cleanup.
52
+ */
53
+ private removeDirSync;
54
+ /**
55
+ * Find the project root by searching upward for package.json or .csproj.
56
+ */
57
+ private findProjectRoot;
58
+ /**
59
+ * Load and cache coverage data for a project root.
60
+ * Searches for LCOV files in common locations.
61
+ */
62
+ private loadCoverageData;
63
+ /**
64
+ * Search common locations for an LCOV coverage report.
65
+ */
66
+ private findLcovFile;
67
+ /**
68
+ * Parse LCOV format into a map of file path → coverage data.
69
+ *
70
+ * LCOV records look like:
71
+ * SF:/path/to/file.ts
72
+ * DA:1,5
73
+ * DA:2,0
74
+ * LF:10
75
+ * LH:8
76
+ * end_of_record
77
+ */
78
+ private parseLcov;
79
+ /**
80
+ * Find coverage for a file, trying both exact match and relative path matching.
81
+ */
82
+ private findFileCoverage;
83
+ /**
84
+ * Compact line numbers into readable ranges: [1,2,3,5,7,8,9] → "1-3, 5, 7-9"
85
+ */
86
+ private compactLineRanges;
87
+ /** Patterns that identify test/spec files. */
88
+ private static readonly TEST_PATTERNS;
89
+ /**
90
+ * Patterns that identify config / build / tooling files that do not need
91
+ * unit test coverage. Matched against the file basename.
92
+ */
93
+ private static readonly CONFIG_FILE_PATTERNS;
94
+ /**
95
+ * Returns true if the file is itself a test/spec file.
96
+ */
97
+ private isTestFile;
98
+ /**
99
+ * Returns true if the file is a config/build/tooling file that should not
100
+ * require unit test coverage.
101
+ */
102
+ private isConfigFile;
103
+ /**
104
+ * Returns true when a C# file carries the [ExcludeFromCodeCoverage] attribute,
105
+ * indicating that the author intentionally exempted it from coverage requirements.
106
+ */
107
+ private isExcludedFromCoverage;
108
+ /**
109
+ * Search for a corresponding test file for the given source file.
110
+ * Checks sibling locations, `__tests__/` directories, and `tests/` folders.
111
+ */
112
+ private findTestFile;
113
+ /**
114
+ * Suggest a test file name for the given source file path.
115
+ */
116
+ private suggestTestFileName;
117
+ /**
118
+ * Returns true if a test file contains at least one real test assertion or
119
+ * test-framework call. Catches empty/placeholder test files that would
120
+ * otherwise satisfy the "test file exists" check without actually testing anything.
121
+ */
122
+ private hasRealTestContent;
123
+ /** Clear the coverage cache (e.g., when coverage files are regenerated). */
124
+ clearCache(): void;
125
+ }
126
+ //# sourceMappingURL=coverage-analyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage-analyzer.d.ts","sourceRoot":"","sources":["../../src/analyzer/coverage-analyzer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,eAAe,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC3B,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,UAAU,EAAE,SAAS,EAAE,CAAC;CAC3B;AAeD,qBAAa,gBAAgB;IACzB,oFAAoF;IACpF,OAAO,CAAC,aAAa,CAAyC;IAE9D,mEAAmE;IACnE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAU;IAEnD;;;;;;OAMG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAsErE;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAuC3B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAoBxB;;;OAGG;YACW,kBAAkB;IA0DhC;;OAEG;IACH,OAAO,CAAC,eAAe;IA4BvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAQrB;;OAEG;IACH,OAAO,CAAC,eAAe;IAgBvB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA8BxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAcpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,SAAS;IAoDjB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IA0BxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAwBzB,8CAA8C;IAC9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAUnC;IAEF;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAmC1C;IAEF;;OAEG;IACH,OAAO,CAAC,UAAU;IAKlB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAKpB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAU9B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAwDpB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;IAmC1B,4EAA4E;IAC5E,UAAU,IAAI,IAAI;CAGrB"}