driftdetect-vscode 0.8.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 (309) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/.turbo/turbo-test.log +138 -0
  3. package/.vscode/launch.json +17 -0
  4. package/.vscode/tasks.json +15 -0
  5. package/LICENSE +121 -0
  6. package/dist/activation/activation-controller.d.ts +61 -0
  7. package/dist/activation/activation-controller.d.ts.map +1 -0
  8. package/dist/activation/activation-controller.js +235 -0
  9. package/dist/activation/activation-controller.js.map +1 -0
  10. package/dist/activation/activation-phases.d.ts +28 -0
  11. package/dist/activation/activation-phases.d.ts.map +1 -0
  12. package/dist/activation/activation-phases.js +80 -0
  13. package/dist/activation/activation-phases.js.map +1 -0
  14. package/dist/activation/index.d.ts +6 -0
  15. package/dist/activation/index.d.ts.map +1 -0
  16. package/dist/activation/index.js +6 -0
  17. package/dist/activation/index.js.map +1 -0
  18. package/dist/client/connection-config.d.ts +50 -0
  19. package/dist/client/connection-config.d.ts.map +1 -0
  20. package/dist/client/connection-config.js +56 -0
  21. package/dist/client/connection-config.js.map +1 -0
  22. package/dist/client/connection-manager.d.ts +70 -0
  23. package/dist/client/connection-manager.d.ts.map +1 -0
  24. package/dist/client/connection-manager.js +214 -0
  25. package/dist/client/connection-manager.js.map +1 -0
  26. package/dist/client/index.d.ts +8 -0
  27. package/dist/client/index.d.ts.map +1 -0
  28. package/dist/client/index.js +8 -0
  29. package/dist/client/index.js.map +1 -0
  30. package/dist/client/language-client-factory.d.ts +29 -0
  31. package/dist/client/language-client-factory.d.ts.map +1 -0
  32. package/dist/client/language-client-factory.js +76 -0
  33. package/dist/client/language-client-factory.js.map +1 -0
  34. package/dist/client/request-middleware.d.ts +38 -0
  35. package/dist/client/request-middleware.d.ts.map +1 -0
  36. package/dist/client/request-middleware.js +85 -0
  37. package/dist/client/request-middleware.js.map +1 -0
  38. package/dist/commands/command-definitions.d.ts +53 -0
  39. package/dist/commands/command-definitions.d.ts.map +1 -0
  40. package/dist/commands/command-definitions.js +212 -0
  41. package/dist/commands/command-definitions.js.map +1 -0
  42. package/dist/commands/command-router.d.ts +80 -0
  43. package/dist/commands/command-router.d.ts.map +1 -0
  44. package/dist/commands/command-router.js +127 -0
  45. package/dist/commands/command-router.js.map +1 -0
  46. package/dist/commands/handlers/connection-handlers.d.ts +14 -0
  47. package/dist/commands/handlers/connection-handlers.d.ts.map +1 -0
  48. package/dist/commands/handlers/connection-handlers.js +57 -0
  49. package/dist/commands/handlers/connection-handlers.js.map +1 -0
  50. package/dist/commands/handlers/constants-handlers.d.ts +11 -0
  51. package/dist/commands/handlers/constants-handlers.d.ts.map +1 -0
  52. package/dist/commands/handlers/constants-handlers.js +84 -0
  53. package/dist/commands/handlers/constants-handlers.js.map +1 -0
  54. package/dist/commands/handlers/index.d.ts +10 -0
  55. package/dist/commands/handlers/index.d.ts.map +1 -0
  56. package/dist/commands/handlers/index.js +10 -0
  57. package/dist/commands/handlers/index.js.map +1 -0
  58. package/dist/commands/handlers/pattern-handlers.d.ts +13 -0
  59. package/dist/commands/handlers/pattern-handlers.d.ts.map +1 -0
  60. package/dist/commands/handlers/pattern-handlers.js +127 -0
  61. package/dist/commands/handlers/pattern-handlers.js.map +1 -0
  62. package/dist/commands/handlers/scan-handlers.d.ts +15 -0
  63. package/dist/commands/handlers/scan-handlers.d.ts.map +1 -0
  64. package/dist/commands/handlers/scan-handlers.js +74 -0
  65. package/dist/commands/handlers/scan-handlers.js.map +1 -0
  66. package/dist/commands/handlers/ui-handlers.d.ts +12 -0
  67. package/dist/commands/handlers/ui-handlers.d.ts.map +1 -0
  68. package/dist/commands/handlers/ui-handlers.js +74 -0
  69. package/dist/commands/handlers/ui-handlers.js.map +1 -0
  70. package/dist/commands/handlers/violation-handlers.d.ts +13 -0
  71. package/dist/commands/handlers/violation-handlers.d.ts.map +1 -0
  72. package/dist/commands/handlers/violation-handlers.js +76 -0
  73. package/dist/commands/handlers/violation-handlers.js.map +1 -0
  74. package/dist/commands/index.d.ts +7 -0
  75. package/dist/commands/index.d.ts.map +1 -0
  76. package/dist/commands/index.js +7 -0
  77. package/dist/commands/index.js.map +1 -0
  78. package/dist/commands/middleware/connection-check-middleware.d.ts +12 -0
  79. package/dist/commands/middleware/connection-check-middleware.d.ts.map +1 -0
  80. package/dist/commands/middleware/connection-check-middleware.js +34 -0
  81. package/dist/commands/middleware/connection-check-middleware.js.map +1 -0
  82. package/dist/commands/middleware/index.d.ts +7 -0
  83. package/dist/commands/middleware/index.d.ts.map +1 -0
  84. package/dist/commands/middleware/index.js +7 -0
  85. package/dist/commands/middleware/index.js.map +1 -0
  86. package/dist/commands/middleware/logging-middleware.d.ts +12 -0
  87. package/dist/commands/middleware/logging-middleware.d.ts.map +1 -0
  88. package/dist/commands/middleware/logging-middleware.js +24 -0
  89. package/dist/commands/middleware/logging-middleware.js.map +1 -0
  90. package/dist/commands/middleware/telemetry-middleware.d.ts +22 -0
  91. package/dist/commands/middleware/telemetry-middleware.d.ts.map +1 -0
  92. package/dist/commands/middleware/telemetry-middleware.js +30 -0
  93. package/dist/commands/middleware/telemetry-middleware.js.map +1 -0
  94. package/dist/config/config-manager.d.ts +53 -0
  95. package/dist/config/config-manager.d.ts.map +1 -0
  96. package/dist/config/config-manager.js +178 -0
  97. package/dist/config/config-manager.js.map +1 -0
  98. package/dist/config/defaults.d.ts +11 -0
  99. package/dist/config/defaults.d.ts.map +1 -0
  100. package/dist/config/defaults.js +43 -0
  101. package/dist/config/defaults.js.map +1 -0
  102. package/dist/config/index.d.ts +7 -0
  103. package/dist/config/index.d.ts.map +1 -0
  104. package/dist/config/index.js +7 -0
  105. package/dist/config/index.js.map +1 -0
  106. package/dist/config/validator.d.ts +22 -0
  107. package/dist/config/validator.d.ts.map +1 -0
  108. package/dist/config/validator.js +93 -0
  109. package/dist/config/validator.js.map +1 -0
  110. package/dist/extension.d.ts +32 -0
  111. package/dist/extension.d.ts.map +1 -0
  112. package/dist/extension.js +50 -0
  113. package/dist/extension.js.map +1 -0
  114. package/dist/infrastructure/disposable-manager.d.ts +43 -0
  115. package/dist/infrastructure/disposable-manager.d.ts.map +1 -0
  116. package/dist/infrastructure/disposable-manager.js +75 -0
  117. package/dist/infrastructure/disposable-manager.js.map +1 -0
  118. package/dist/infrastructure/event-bus.d.ts +85 -0
  119. package/dist/infrastructure/event-bus.d.ts.map +1 -0
  120. package/dist/infrastructure/event-bus.js +74 -0
  121. package/dist/infrastructure/event-bus.js.map +1 -0
  122. package/dist/infrastructure/index.d.ts +10 -0
  123. package/dist/infrastructure/index.d.ts.map +1 -0
  124. package/dist/infrastructure/index.js +10 -0
  125. package/dist/infrastructure/index.js.map +1 -0
  126. package/dist/infrastructure/logger.d.ts +37 -0
  127. package/dist/infrastructure/logger.d.ts.map +1 -0
  128. package/dist/infrastructure/logger.js +86 -0
  129. package/dist/infrastructure/logger.js.map +1 -0
  130. package/dist/infrastructure/service-container.d.ts +68 -0
  131. package/dist/infrastructure/service-container.d.ts.map +1 -0
  132. package/dist/infrastructure/service-container.js +94 -0
  133. package/dist/infrastructure/service-container.js.map +1 -0
  134. package/dist/state/index.d.ts +7 -0
  135. package/dist/state/index.d.ts.map +1 -0
  136. package/dist/state/index.js +7 -0
  137. package/dist/state/index.js.map +1 -0
  138. package/dist/state/initial-state.d.ts +11 -0
  139. package/dist/state/initial-state.d.ts.map +1 -0
  140. package/dist/state/initial-state.js +58 -0
  141. package/dist/state/initial-state.js.map +1 -0
  142. package/dist/state/selectors.d.ts +41 -0
  143. package/dist/state/selectors.d.ts.map +1 -0
  144. package/dist/state/selectors.js +61 -0
  145. package/dist/state/selectors.js.map +1 -0
  146. package/dist/state/state-manager.d.ts +54 -0
  147. package/dist/state/state-manager.d.ts.map +1 -0
  148. package/dist/state/state-manager.js +166 -0
  149. package/dist/state/state-manager.js.map +1 -0
  150. package/dist/types/config-types.d.ts +69 -0
  151. package/dist/types/config-types.d.ts.map +1 -0
  152. package/dist/types/config-types.js +5 -0
  153. package/dist/types/config-types.js.map +1 -0
  154. package/dist/types/extension-types.d.ts +45 -0
  155. package/dist/types/extension-types.d.ts.map +1 -0
  156. package/dist/types/extension-types.js +5 -0
  157. package/dist/types/extension-types.js.map +1 -0
  158. package/dist/types/index.d.ts +12 -0
  159. package/dist/types/index.d.ts.map +1 -0
  160. package/dist/types/index.js +12 -0
  161. package/dist/types/index.js.map +1 -0
  162. package/dist/types/lsp-types.d.ts +70 -0
  163. package/dist/types/lsp-types.d.ts.map +1 -0
  164. package/dist/types/lsp-types.js +5 -0
  165. package/dist/types/lsp-types.js.map +1 -0
  166. package/dist/types/state-types.d.ts +82 -0
  167. package/dist/types/state-types.d.ts.map +1 -0
  168. package/dist/types/state-types.js +5 -0
  169. package/dist/types/state-types.js.map +1 -0
  170. package/dist/types/vscode-types.d.ts +36 -0
  171. package/dist/types/vscode-types.d.ts.map +1 -0
  172. package/dist/types/vscode-types.js +7 -0
  173. package/dist/types/vscode-types.js.map +1 -0
  174. package/dist/ui/decorations/decoration-controller.d.ts +45 -0
  175. package/dist/ui/decorations/decoration-controller.d.ts.map +1 -0
  176. package/dist/ui/decorations/decoration-controller.js +198 -0
  177. package/dist/ui/decorations/decoration-controller.js.map +1 -0
  178. package/dist/ui/decorations/decoration-types.d.ts +28 -0
  179. package/dist/ui/decorations/decoration-types.d.ts.map +1 -0
  180. package/dist/ui/decorations/decoration-types.js +98 -0
  181. package/dist/ui/decorations/decoration-types.js.map +1 -0
  182. package/dist/ui/decorations/index.d.ts +7 -0
  183. package/dist/ui/decorations/index.d.ts.map +1 -0
  184. package/dist/ui/decorations/index.js +6 -0
  185. package/dist/ui/decorations/index.js.map +1 -0
  186. package/dist/ui/index.d.ts +7 -0
  187. package/dist/ui/index.d.ts.map +1 -0
  188. package/dist/ui/index.js +7 -0
  189. package/dist/ui/index.js.map +1 -0
  190. package/dist/ui/notifications/index.d.ts +5 -0
  191. package/dist/ui/notifications/index.d.ts.map +1 -0
  192. package/dist/ui/notifications/index.js +5 -0
  193. package/dist/ui/notifications/index.js.map +1 -0
  194. package/dist/ui/notifications/notification-service.d.ts +66 -0
  195. package/dist/ui/notifications/notification-service.d.ts.map +1 -0
  196. package/dist/ui/notifications/notification-service.js +103 -0
  197. package/dist/ui/notifications/notification-service.js.map +1 -0
  198. package/dist/ui/status-bar/index.d.ts +6 -0
  199. package/dist/ui/status-bar/index.d.ts.map +1 -0
  200. package/dist/ui/status-bar/index.js +6 -0
  201. package/dist/ui/status-bar/index.js.map +1 -0
  202. package/dist/ui/status-bar/status-bar-controller.d.ts +37 -0
  203. package/dist/ui/status-bar/status-bar-controller.d.ts.map +1 -0
  204. package/dist/ui/status-bar/status-bar-controller.js +111 -0
  205. package/dist/ui/status-bar/status-bar-controller.js.map +1 -0
  206. package/dist/ui/status-bar/status-bar-modes.d.ts +26 -0
  207. package/dist/ui/status-bar/status-bar-modes.d.ts.map +1 -0
  208. package/dist/ui/status-bar/status-bar-modes.js +97 -0
  209. package/dist/ui/status-bar/status-bar-modes.js.map +1 -0
  210. package/dist/views/base-tree-provider.d.ts +74 -0
  211. package/dist/views/base-tree-provider.d.ts.map +1 -0
  212. package/dist/views/base-tree-provider.js +95 -0
  213. package/dist/views/base-tree-provider.js.map +1 -0
  214. package/dist/views/constants-tree-provider.d.ts +112 -0
  215. package/dist/views/constants-tree-provider.d.ts.map +1 -0
  216. package/dist/views/constants-tree-provider.js +344 -0
  217. package/dist/views/constants-tree-provider.js.map +1 -0
  218. package/dist/views/files-tree-provider.d.ts +37 -0
  219. package/dist/views/files-tree-provider.d.ts.map +1 -0
  220. package/dist/views/files-tree-provider.js +98 -0
  221. package/dist/views/files-tree-provider.js.map +1 -0
  222. package/dist/views/index.d.ts +10 -0
  223. package/dist/views/index.d.ts.map +1 -0
  224. package/dist/views/index.js +10 -0
  225. package/dist/views/index.js.map +1 -0
  226. package/dist/views/patterns-tree-provider.d.ts +39 -0
  227. package/dist/views/patterns-tree-provider.d.ts.map +1 -0
  228. package/dist/views/patterns-tree-provider.js +139 -0
  229. package/dist/views/patterns-tree-provider.js.map +1 -0
  230. package/dist/views/violations-tree-provider.d.ts +46 -0
  231. package/dist/views/violations-tree-provider.d.ts.map +1 -0
  232. package/dist/views/violations-tree-provider.js +158 -0
  233. package/dist/views/violations-tree-provider.js.map +1 -0
  234. package/dist/webview/index.d.ts +7 -0
  235. package/dist/webview/index.d.ts.map +1 -0
  236. package/dist/webview/index.js +7 -0
  237. package/dist/webview/index.js.map +1 -0
  238. package/dist/webview/webview-manager.d.ts +57 -0
  239. package/dist/webview/webview-manager.d.ts.map +1 -0
  240. package/dist/webview/webview-manager.js +167 -0
  241. package/dist/webview/webview-manager.js.map +1 -0
  242. package/package.json +405 -0
  243. package/resources/drift-icon.png +0 -0
  244. package/resources/drift-icon.svg +5 -0
  245. package/resources/icons/error.svg +4 -0
  246. package/resources/icons/info.svg +4 -0
  247. package/resources/icons/lightbulb.svg +4 -0
  248. package/resources/icons/warning.svg +4 -0
  249. package/src/activation/activation-controller.ts +320 -0
  250. package/src/activation/activation-phases.ts +96 -0
  251. package/src/activation/index.ts +6 -0
  252. package/src/client/connection-config.ts +64 -0
  253. package/src/client/connection-manager.ts +263 -0
  254. package/src/client/index.ts +8 -0
  255. package/src/client/language-client-factory.ts +111 -0
  256. package/src/client/request-middleware.ts +117 -0
  257. package/src/commands/command-definitions.ts +243 -0
  258. package/src/commands/command-router.ts +194 -0
  259. package/src/commands/handlers/connection-handlers.ts +74 -0
  260. package/src/commands/handlers/constants-handlers.ts +99 -0
  261. package/src/commands/handlers/index.ts +10 -0
  262. package/src/commands/handlers/pattern-handlers.ts +167 -0
  263. package/src/commands/handlers/scan-handlers.ts +107 -0
  264. package/src/commands/handlers/ui-handlers.ts +88 -0
  265. package/src/commands/handlers/violation-handlers.ts +97 -0
  266. package/src/commands/index.ts +7 -0
  267. package/src/commands/middleware/connection-check-middleware.ts +46 -0
  268. package/src/commands/middleware/index.ts +7 -0
  269. package/src/commands/middleware/logging-middleware.ts +28 -0
  270. package/src/commands/middleware/telemetry-middleware.ts +46 -0
  271. package/src/config/config-manager.ts +213 -0
  272. package/src/config/defaults.ts +45 -0
  273. package/src/config/index.ts +7 -0
  274. package/src/config/validator.ts +118 -0
  275. package/src/extension.ts +57 -0
  276. package/src/infrastructure/disposable-manager.ts +87 -0
  277. package/src/infrastructure/event-bus.ts +121 -0
  278. package/src/infrastructure/index.ts +10 -0
  279. package/src/infrastructure/logger.ts +108 -0
  280. package/src/infrastructure/service-container.ts +123 -0
  281. package/src/state/index.ts +7 -0
  282. package/src/state/initial-state.ts +60 -0
  283. package/src/state/selectors.ts +126 -0
  284. package/src/state/state-manager.ts +198 -0
  285. package/src/types/config-types.ts +77 -0
  286. package/src/types/extension-types.ts +58 -0
  287. package/src/types/index.ts +12 -0
  288. package/src/types/lsp-types.ts +77 -0
  289. package/src/types/state-types.ts +92 -0
  290. package/src/types/vscode-types.ts +40 -0
  291. package/src/ui/decorations/decoration-controller.ts +252 -0
  292. package/src/ui/decorations/decoration-types.ts +129 -0
  293. package/src/ui/decorations/index.ts +7 -0
  294. package/src/ui/index.ts +7 -0
  295. package/src/ui/notifications/index.ts +5 -0
  296. package/src/ui/notifications/notification-service.ts +167 -0
  297. package/src/ui/status-bar/index.ts +6 -0
  298. package/src/ui/status-bar/status-bar-controller.ts +135 -0
  299. package/src/ui/status-bar/status-bar-modes.ts +119 -0
  300. package/src/views/base-tree-provider.ts +127 -0
  301. package/src/views/constants-tree-provider.ts +525 -0
  302. package/src/views/files-tree-provider.ts +140 -0
  303. package/src/views/index.ts +10 -0
  304. package/src/views/patterns-tree-provider.ts +179 -0
  305. package/src/views/violations-tree-provider.ts +210 -0
  306. package/src/webview/index.ts +7 -0
  307. package/src/webview/webview-manager.ts +238 -0
  308. package/tsconfig.json +22 -0
  309. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Extension-level type definitions
3
+ */
4
+
5
+ import type * as vscode from 'vscode';
6
+
7
+ /**
8
+ * Extension activation phases for progressive loading
9
+ */
10
+ export type ActivationPhase = 'immediate' | 'deferred' | 'lazy';
11
+
12
+ /**
13
+ * Connection states for LSP client
14
+ */
15
+ export type ConnectionState =
16
+ | 'disconnected'
17
+ | 'connecting'
18
+ | 'connected'
19
+ | 'reconnecting'
20
+ | 'error'
21
+ | 'failed';
22
+
23
+ /**
24
+ * Severity levels matching LSP
25
+ */
26
+ export type Severity = 'error' | 'warning' | 'info' | 'hint';
27
+
28
+ /**
29
+ * Pattern status
30
+ */
31
+ export type PatternStatus = 'discovered' | 'approved' | 'ignored';
32
+
33
+ /**
34
+ * Logger interface for dependency injection
35
+ */
36
+ export interface Logger {
37
+ error(message: string, ...args: unknown[]): void;
38
+ warn(message: string, ...args: unknown[]): void;
39
+ info(message: string, ...args: unknown[]): void;
40
+ debug(message: string, ...args: unknown[]): void;
41
+ }
42
+
43
+ /**
44
+ * Disposable resource manager
45
+ */
46
+ export interface DisposableManager {
47
+ add(disposable: vscode.Disposable): void;
48
+ dispose(): void;
49
+ }
50
+
51
+ /**
52
+ * Service locator for dependency injection
53
+ */
54
+ export interface ServiceContainer {
55
+ get<T>(key: string): T;
56
+ register<T>(key: string, instance: T): void;
57
+ has(key: string): boolean;
58
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @drift/vscode - Type definitions
3
+ *
4
+ * Central type exports for the VS Code extension.
5
+ * All types are defined in domain-specific files and re-exported here.
6
+ */
7
+
8
+ export * from './extension-types.js';
9
+ export * from './state-types.js';
10
+ export * from './config-types.js';
11
+ export * from './lsp-types.js';
12
+ export * from './vscode-types.js';
@@ -0,0 +1,77 @@
1
+ /**
2
+ * LSP-related type definitions
3
+ */
4
+
5
+ import type { Severity, PatternStatus } from './extension-types.js';
6
+
7
+ /**
8
+ * Pattern data from LSP
9
+ */
10
+ export interface PatternData {
11
+ id: string;
12
+ name: string;
13
+ category: string;
14
+ confidence: number;
15
+ status: PatternStatus;
16
+ locationCount: number;
17
+ description?: string;
18
+ }
19
+
20
+ /**
21
+ * Violation data from LSP
22
+ */
23
+ export interface ViolationData {
24
+ id: string;
25
+ patternId: string;
26
+ severity: Severity;
27
+ file: string;
28
+ range: {
29
+ start: { line: number; character: number };
30
+ end: { line: number; character: number };
31
+ };
32
+ message: string;
33
+ hasQuickFix: boolean;
34
+ aiExplainAvailable: boolean;
35
+ aiFixAvailable: boolean;
36
+ }
37
+
38
+ /**
39
+ * Category summary from LSP
40
+ */
41
+ export interface CategoryData {
42
+ name: string;
43
+ count: number;
44
+ approvedCount: number;
45
+ violationCount: number;
46
+ }
47
+
48
+ /**
49
+ * File pattern data from LSP
50
+ */
51
+ export interface FilePatternData {
52
+ path: string;
53
+ patternCount: number;
54
+ violationCount: number;
55
+ categories: string[];
56
+ }
57
+
58
+ /**
59
+ * LSP health check response
60
+ */
61
+ export interface HealthCheckResponse {
62
+ status: 'healthy' | 'degraded' | 'unhealthy';
63
+ version: string;
64
+ uptime: number;
65
+ }
66
+
67
+ /**
68
+ * LSP request types
69
+ */
70
+ export type LSPRequestType =
71
+ | 'drift/health'
72
+ | 'drift/patterns/list'
73
+ | 'drift/patterns/get'
74
+ | 'drift/patterns/categories'
75
+ | 'drift/violations/list'
76
+ | 'drift/files/list'
77
+ | 'drift/rescan';
@@ -0,0 +1,92 @@
1
+ /**
2
+ * State management type definitions
3
+ */
4
+
5
+ import type { ConnectionState, Severity, PatternStatus } from './extension-types.js';
6
+
7
+ /**
8
+ * Connection state slice
9
+ */
10
+ export interface ConnectionStateSlice {
11
+ status: ConnectionState;
12
+ serverVersion: string | null;
13
+ lastError: string | null;
14
+ restartCount: number;
15
+ }
16
+
17
+ /**
18
+ * Workspace state slice
19
+ */
20
+ export interface WorkspaceStateSlice {
21
+ initialized: boolean;
22
+ projectRoot: string | null;
23
+ configPath: string | null;
24
+ lastScanTime: number | null;
25
+ scanning: boolean;
26
+ }
27
+
28
+ /**
29
+ * Pattern summary state slice
30
+ */
31
+ export interface PatternStateSlice {
32
+ total: number;
33
+ byCategory: Record<string, number>;
34
+ byStatus: Record<PatternStatus, number>;
35
+ lastUpdated: number | null;
36
+ }
37
+
38
+ /**
39
+ * Violation state slice
40
+ */
41
+ export interface ViolationStateSlice {
42
+ total: number;
43
+ bySeverity: Record<Severity, number>;
44
+ activeFile: string | null;
45
+ activeFileCount: number;
46
+ }
47
+
48
+ /**
49
+ * UI state slice
50
+ */
51
+ export interface UIStateSlice {
52
+ statusBarVisible: boolean;
53
+ sidebarExpanded: boolean;
54
+ activePanel: string | null;
55
+ }
56
+
57
+ /**
58
+ * User preferences (persisted)
59
+ */
60
+ export interface PreferencesSlice {
61
+ autoScan: boolean;
62
+ showInlineHints: boolean;
63
+ severityFilter: Severity[];
64
+ categoryFilter: string[];
65
+ }
66
+
67
+ /**
68
+ * Complete extension state
69
+ */
70
+ export interface ExtensionState {
71
+ connection: ConnectionStateSlice;
72
+ workspace: WorkspaceStateSlice;
73
+ patterns: PatternStateSlice;
74
+ violations: ViolationStateSlice;
75
+ ui: UIStateSlice;
76
+ preferences: PreferencesSlice;
77
+ }
78
+
79
+ /**
80
+ * State update function type
81
+ */
82
+ export type StateUpdater = (draft: ExtensionState) => void;
83
+
84
+ /**
85
+ * State selector function type
86
+ */
87
+ export type StateSelector<T> = (state: ExtensionState) => T;
88
+
89
+ /**
90
+ * State subscription callback
91
+ */
92
+ export type StateSubscriber<T> = (value: T) => void;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * VS Code-specific type definitions
3
+ *
4
+ * Re-exports and extensions of VS Code types.
5
+ */
6
+
7
+ import type * as vscode from 'vscode';
8
+
9
+ /**
10
+ * Extended quick pick item with additional data
11
+ */
12
+ export interface ExtendedQuickPickItem<T = unknown> extends vscode.QuickPickItem {
13
+ data?: T;
14
+ }
15
+
16
+ /**
17
+ * Tree item with generic data
18
+ */
19
+ export interface DataTreeItem<T = unknown> extends vscode.TreeItem {
20
+ data?: T;
21
+ }
22
+
23
+ /**
24
+ * Webview message types
25
+ */
26
+ export interface WebviewMessage<T = unknown> {
27
+ type: string;
28
+ requestId?: string;
29
+ data?: T;
30
+ }
31
+
32
+ /**
33
+ * Webview response types
34
+ */
35
+ export interface WebviewResponse<T = unknown> {
36
+ type: string;
37
+ requestId: string;
38
+ data?: T;
39
+ error?: string;
40
+ }
@@ -0,0 +1,252 @@
1
+ /**
2
+ * DecorationController - Editor decoration management
3
+ *
4
+ * Single responsibility: Apply visual decorations to editors.
5
+ */
6
+
7
+ import * as vscode from 'vscode';
8
+
9
+ import { createDecorationTypes, type DecorationTypes, type DecorationTypeKey } from './decoration-types.js';
10
+
11
+ import type { ConfigManager } from '../../config/index.js';
12
+ import type { DisplayConfig, Severity } from '../../types/index.js';
13
+
14
+ /**
15
+ * Decoration controller for editor visuals
16
+ */
17
+ export class DecorationController implements vscode.Disposable {
18
+ private readonly decorationTypes: DecorationTypes;
19
+ private readonly disposables: vscode.Disposable[] = [];
20
+ private config: DisplayConfig;
21
+
22
+ constructor(
23
+ context: vscode.ExtensionContext,
24
+ private readonly configManager: ConfigManager
25
+ ) {
26
+ this.decorationTypes = createDecorationTypes(context);
27
+ this.config = configManager.get('display');
28
+
29
+ this.setupEventHandlers();
30
+ }
31
+
32
+ /**
33
+ * Update decorations for the active editor
34
+ */
35
+ updateDecorations(editor: vscode.TextEditor): void {
36
+ if (!editor) {return;}
37
+
38
+ const uri = editor.document.uri;
39
+ const diagnostics = vscode.languages.getDiagnostics(uri);
40
+
41
+ // Filter to Drift diagnostics only
42
+ const driftDiagnostics = diagnostics.filter(d => d.source === 'drift');
43
+
44
+ // Clear all decorations first
45
+ this.clearDecorations(editor);
46
+
47
+ if (driftDiagnostics.length === 0) {return;}
48
+
49
+ // Apply gutter decorations
50
+ if (this.config.showGutterIcons) {
51
+ this.applyGutterDecorations(editor, driftDiagnostics);
52
+ }
53
+
54
+ // Apply inline hints
55
+ if (this.config.showInlineHints) {
56
+ this.applyInlineHints(editor, driftDiagnostics);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Clear all decorations from an editor
62
+ */
63
+ clearDecorations(editor: vscode.TextEditor): void {
64
+ for (const [, type] of this.decorationTypes) {
65
+ editor.setDecorations(type, []);
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Refresh decorations for all visible editors
71
+ */
72
+ refreshAll(): void {
73
+ for (const editor of vscode.window.visibleTextEditors) {
74
+ this.updateDecorations(editor);
75
+ }
76
+ }
77
+
78
+ /**
79
+ * Dispose resources
80
+ */
81
+ dispose(): void {
82
+ for (const d of this.disposables) {
83
+ d.dispose();
84
+ }
85
+ }
86
+
87
+ private setupEventHandlers(): void {
88
+ // Update decorations when active editor changes
89
+ this.disposables.push(
90
+ vscode.window.onDidChangeActiveTextEditor(editor => {
91
+ if (editor) {
92
+ this.updateDecorations(editor);
93
+ }
94
+ })
95
+ );
96
+
97
+ // Update decorations when diagnostics change
98
+ this.disposables.push(
99
+ vscode.languages.onDidChangeDiagnostics(event => {
100
+ const editor = vscode.window.activeTextEditor;
101
+ if (editor && event.uris.some(uri => uri.toString() === editor.document.uri.toString())) {
102
+ this.updateDecorations(editor);
103
+ }
104
+ })
105
+ );
106
+
107
+ // Update config when it changes
108
+ this.disposables.push(
109
+ this.configManager.onConfigChange(event => {
110
+ if (event.section === 'display') {
111
+ this.config = event.newValue as DisplayConfig;
112
+ this.refreshAll();
113
+ }
114
+ })
115
+ );
116
+ }
117
+
118
+ private applyGutterDecorations(
119
+ editor: vscode.TextEditor,
120
+ diagnostics: vscode.Diagnostic[]
121
+ ): void {
122
+ // Group diagnostics by severity
123
+ const bySeverity = this.groupBySeverity(diagnostics);
124
+
125
+ for (const [severity, diags] of bySeverity) {
126
+ // Check if this severity is in the filter
127
+ if (!this.config.severityFilter.includes(severity)) {
128
+ continue;
129
+ }
130
+
131
+ const decorationType = this.decorationTypes.get(`gutter-${severity}` as DecorationTypeKey);
132
+ if (!decorationType) {continue;}
133
+
134
+ const decorations: vscode.DecorationOptions[] = diags.map(d => ({
135
+ range: d.range,
136
+ hoverMessage: this.buildHoverMessage(d),
137
+ }));
138
+
139
+ editor.setDecorations(decorationType, decorations);
140
+ }
141
+ }
142
+
143
+ private applyInlineHints(
144
+ editor: vscode.TextEditor,
145
+ diagnostics: vscode.Diagnostic[]
146
+ ): void {
147
+ const decorationType = this.decorationTypes.get('inline-hint');
148
+ if (!decorationType) {return;}
149
+
150
+ // Only show hints for filtered severities
151
+ const filtered = diagnostics.filter(d => {
152
+ const severity = this.diagnosticSeverityToString(d.severity);
153
+ return this.config.severityFilter.includes(severity);
154
+ });
155
+
156
+ // Group by line to avoid multiple hints on same line
157
+ const byLine = new Map<number, vscode.Diagnostic>();
158
+ for (const d of filtered) {
159
+ const line = d.range.start.line;
160
+ if (!byLine.has(line)) {
161
+ byLine.set(line, d);
162
+ }
163
+ }
164
+
165
+ const decorations: vscode.DecorationOptions[] = [];
166
+ for (const [, diagnostic] of byLine) {
167
+ decorations.push({
168
+ range: new vscode.Range(
169
+ diagnostic.range.end.line,
170
+ Number.MAX_SAFE_INTEGER,
171
+ diagnostic.range.end.line,
172
+ Number.MAX_SAFE_INTEGER
173
+ ),
174
+ renderOptions: {
175
+ after: {
176
+ contentText: ` ← ${diagnostic.message}`,
177
+ },
178
+ },
179
+ });
180
+ }
181
+
182
+ editor.setDecorations(decorationType, decorations);
183
+ }
184
+
185
+ private groupBySeverity(diagnostics: vscode.Diagnostic[]): Map<Severity, vscode.Diagnostic[]> {
186
+ const groups = new Map<Severity, vscode.Diagnostic[]>();
187
+
188
+ for (const d of diagnostics) {
189
+ const severity = this.diagnosticSeverityToString(d.severity);
190
+ const group = groups.get(severity) || [];
191
+ group.push(d);
192
+ groups.set(severity, group);
193
+ }
194
+
195
+ return groups;
196
+ }
197
+
198
+ private diagnosticSeverityToString(severity: vscode.DiagnosticSeverity): Severity {
199
+ switch (severity) {
200
+ case vscode.DiagnosticSeverity.Error:
201
+ return 'error';
202
+ case vscode.DiagnosticSeverity.Warning:
203
+ return 'warning';
204
+ case vscode.DiagnosticSeverity.Information:
205
+ return 'info';
206
+ case vscode.DiagnosticSeverity.Hint:
207
+ return 'hint';
208
+ }
209
+ }
210
+
211
+ private buildHoverMessage(diagnostic: vscode.Diagnostic): vscode.MarkdownString {
212
+ const md = new vscode.MarkdownString();
213
+ md.isTrusted = true;
214
+ md.supportThemeIcons = true;
215
+
216
+ const icon = this.getSeverityIcon(diagnostic.severity);
217
+ md.appendMarkdown(`${icon} **${diagnostic.message}**\n\n`);
218
+
219
+ if (diagnostic.code) {
220
+ md.appendMarkdown(`Pattern: \`${diagnostic.code}\`\n\n`);
221
+ }
222
+
223
+ md.appendMarkdown(`---\n\n`);
224
+ md.appendMarkdown(`[Quick Fix](command:editor.action.quickFix) | `);
225
+ md.appendMarkdown(`[Ignore](command:drift.ignoreOnce)\n`);
226
+
227
+ return md;
228
+ }
229
+
230
+ private getSeverityIcon(severity: vscode.DiagnosticSeverity): string {
231
+ switch (severity) {
232
+ case vscode.DiagnosticSeverity.Error:
233
+ return '$(error)';
234
+ case vscode.DiagnosticSeverity.Warning:
235
+ return '$(warning)';
236
+ case vscode.DiagnosticSeverity.Information:
237
+ return '$(info)';
238
+ case vscode.DiagnosticSeverity.Hint:
239
+ return '$(lightbulb)';
240
+ }
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Factory function for creating decoration controller
246
+ */
247
+ export function createDecorationController(
248
+ context: vscode.ExtensionContext,
249
+ configManager: ConfigManager
250
+ ): DecorationController {
251
+ return new DecorationController(context, configManager);
252
+ }
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Decoration type definitions
3
+ *
4
+ * Single responsibility: Create VS Code decoration types.
5
+ */
6
+
7
+ import * as vscode from 'vscode';
8
+
9
+ import type { Severity } from '../../types/index.js';
10
+
11
+ /**
12
+ * Decoration type keys
13
+ */
14
+ export type DecorationTypeKey =
15
+ | `gutter-${Severity}`
16
+ | 'inline-hint'
17
+ | `background-${Severity}`;
18
+
19
+ /**
20
+ * Decoration types container
21
+ */
22
+ export type DecorationTypes = Map<DecorationTypeKey, vscode.TextEditorDecorationType>;
23
+
24
+ /**
25
+ * Gutter icon colors by severity
26
+ */
27
+ const GUTTER_COLORS: Record<Severity, string> = {
28
+ error: '#f44336',
29
+ warning: '#ff9800',
30
+ info: '#2196f3',
31
+ hint: '#4caf50',
32
+ };
33
+
34
+ /**
35
+ * Background colors by severity (with alpha)
36
+ */
37
+ const BACKGROUND_COLORS: Record<Severity, string> = {
38
+ error: 'rgba(244, 67, 54, 0.1)',
39
+ warning: 'rgba(255, 152, 0, 0.1)',
40
+ info: 'rgba(33, 150, 243, 0.1)',
41
+ hint: 'rgba(76, 175, 80, 0.1)',
42
+ };
43
+
44
+ /**
45
+ * Create all decoration types
46
+ */
47
+ export function createDecorationTypes(
48
+ context: vscode.ExtensionContext
49
+ ): DecorationTypes {
50
+ const types = new Map<DecorationTypeKey, vscode.TextEditorDecorationType>();
51
+ const severities: Severity[] = ['error', 'warning', 'info', 'hint'];
52
+
53
+ // Create gutter decorations
54
+ for (const severity of severities) {
55
+ const type = vscode.window.createTextEditorDecorationType({
56
+ gutterIconPath: createGutterIcon(context, severity),
57
+ gutterIconSize: 'contain',
58
+ });
59
+ types.set(`gutter-${severity}`, type);
60
+ context.subscriptions.push(type);
61
+ }
62
+
63
+ // Create inline hint decoration
64
+ const inlineHint = vscode.window.createTextEditorDecorationType({
65
+ after: {
66
+ margin: '0 0 0 1em',
67
+ color: new vscode.ThemeColor('editorCodeLens.foreground'),
68
+ fontStyle: 'italic',
69
+ fontWeight: 'normal',
70
+ },
71
+ });
72
+ types.set('inline-hint', inlineHint);
73
+ context.subscriptions.push(inlineHint);
74
+
75
+ // Create background decorations
76
+ for (const severity of severities) {
77
+ const type = vscode.window.createTextEditorDecorationType({
78
+ backgroundColor: BACKGROUND_COLORS[severity],
79
+ isWholeLine: true,
80
+ });
81
+ types.set(`background-${severity}`, type);
82
+ context.subscriptions.push(type);
83
+ }
84
+
85
+ return types;
86
+ }
87
+
88
+ /**
89
+ * Create a gutter icon for a severity
90
+ */
91
+ function createGutterIcon(
92
+ context: vscode.ExtensionContext,
93
+ severity: Severity
94
+ ): vscode.Uri {
95
+ // Use built-in icons via ThemeIcon
96
+ // For custom icons, you'd create SVGs in resources/
97
+ const iconName = getIconName(severity);
98
+ return vscode.Uri.joinPath(context.extensionUri, 'resources', 'icons', `${iconName}.svg`);
99
+ }
100
+
101
+ /**
102
+ * Get icon name for severity
103
+ */
104
+ function getIconName(severity: Severity): string {
105
+ switch (severity) {
106
+ case 'error':
107
+ return 'error';
108
+ case 'warning':
109
+ return 'warning';
110
+ case 'info':
111
+ return 'info';
112
+ case 'hint':
113
+ return 'lightbulb';
114
+ }
115
+ }
116
+
117
+ /**
118
+ * Get gutter color for severity
119
+ */
120
+ export function getGutterColor(severity: Severity): string {
121
+ return GUTTER_COLORS[severity];
122
+ }
123
+
124
+ /**
125
+ * Get background color for severity
126
+ */
127
+ export function getBackgroundColor(severity: Severity): string {
128
+ return BACKGROUND_COLORS[severity];
129
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Decorations module exports
3
+ */
4
+
5
+ export { DecorationController, createDecorationController } from './decoration-controller.js';
6
+ export type { DecorationTypes } from './decoration-types.js';
7
+ export { createDecorationTypes } from './decoration-types.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * UI module exports
3
+ */
4
+
5
+ export { StatusBarController, createStatusBar } from './status-bar/status-bar-controller.js';
6
+ export { DecorationController, createDecorationController } from './decorations/decoration-controller.js';
7
+ export { NotificationService, createNotificationService } from './notifications/notification-service.js';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Notifications module exports
3
+ */
4
+
5
+ export { NotificationService, createNotificationService } from './notification-service.js';