@jmruthers/pace-core 0.6.6 → 0.6.8

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 (292) hide show
  1. package/{scripts/audit/audit-dependencies.cjs → audit-tool/00-dependencies.cjs} +227 -22
  2. package/audit-tool/audits/01-pace-core-compliance.cjs +556 -0
  3. package/audit-tool/audits/02-project-structure.cjs +240 -0
  4. package/audit-tool/audits/03-architecture.cjs +224 -0
  5. package/audit-tool/audits/04-code-quality.cjs +149 -0
  6. package/audit-tool/audits/05-styling.cjs +224 -0
  7. package/audit-tool/audits/06-security-rbac.cjs +554 -0
  8. package/audit-tool/audits/07-api-tech-stack.cjs +355 -0
  9. package/audit-tool/audits/08-testing-documentation.cjs +202 -0
  10. package/audit-tool/audits/09-operations.cjs +208 -0
  11. package/audit-tool/index.cjs +295 -0
  12. package/audit-tool/utils/code-utils.cjs +218 -0
  13. package/audit-tool/utils/file-utils.cjs +230 -0
  14. package/audit-tool/utils/report-utils.cjs +380 -0
  15. package/cursor-rules/00-standards-overview.mdc +156 -0
  16. package/cursor-rules/{00-pace-core-compliance.mdc → 01-pace-core-compliance.mdc} +187 -34
  17. package/cursor-rules/02-project-structure.mdc +37 -5
  18. package/cursor-rules/{03-solid-principles.mdc → 03-architecture.mdc} +125 -11
  19. package/cursor-rules/04-code-quality.mdc +419 -0
  20. package/cursor-rules/{08-markup-quality.mdc → 05-styling.mdc} +55 -10
  21. package/cursor-rules/{09-rbac-compliance.mdc → 06-security-rbac.mdc} +62 -6
  22. package/cursor-rules/07-api-tech-stack.mdc +377 -0
  23. package/cursor-rules/08-testing-documentation.mdc +324 -0
  24. package/cursor-rules/09-operations.mdc +365 -0
  25. package/dist/DataTable-6RMSCQJ6.js +15 -0
  26. package/dist/{DataTable-2N_tqbfq.d.ts → DataTable-DRUIgtUH.d.ts} +1 -1
  27. package/dist/{PublicPageProvider-BBH6Vqg7.d.ts → PublicPageProvider-CIGSujI2.d.ts} +40 -24
  28. package/dist/{UnifiedAuthProvider-ZT6TIGM7.js → UnifiedAuthProvider-7SNDOWYD.js} +2 -2
  29. package/dist/{api-Y4MQWOFW.js → api-7P7DI652.js} +1 -1
  30. package/dist/{chunk-MAGBIDNS.js → chunk-4DDCYDQ3.js} +8 -7
  31. package/dist/{chunk-BVP2BCJF.js → chunk-5W2A3DRC.js} +10 -9
  32. package/dist/{chunk-SD6WQY43.js → chunk-7ILTDCL2.js} +9 -1
  33. package/dist/{chunk-3QC3KRHK.js → chunk-A3W6LW53.js} +16 -1
  34. package/dist/{chunk-3O3WHILE.js → chunk-EF2UGZWY.js} +239 -63
  35. package/dist/{chunk-LAZMKTTF.js → chunk-EURB7QFZ.js} +341 -337
  36. package/dist/{chunk-2HGJFNAH.js → chunk-FEJLJNWA.js} +1 -15
  37. package/dist/{chunk-7TYHROIV.js → chunk-GS5672WG.js} +55 -13
  38. package/dist/{chunk-UIYSCEV7.js → chunk-IUBRCBSY.js} +1 -1
  39. package/dist/{chunk-ZFYPMX46.js → chunk-LX6U42O3.js} +1 -1
  40. package/dist/{chunk-FENMYN2U.js → chunk-MPBLMWVR.js} +3 -3
  41. package/dist/{chunk-ZS5VO5JB.js → chunk-NKHKXPI4.js} +408 -453
  42. package/dist/{chunk-A55DK444.js → chunk-OJ4SKRSV.js} +1 -7
  43. package/dist/{chunk-4T7OBVTU.js → chunk-S6ZQKDY6.js} +1 -1
  44. package/dist/{chunk-FTCRZOG2.js → chunk-T5CVK4R3.js} +5 -5
  45. package/dist/{chunk-OHIK3MIO.js → chunk-Z2FNRKF3.js} +13 -13
  46. package/dist/components.d.ts +5 -4
  47. package/dist/components.js +29 -34
  48. package/dist/eslint-rules/index.cjs +22 -9
  49. package/{src/eslint-rules/rules/compliance.cjs → dist/eslint-rules/rules/01-pace-core-compliance.cjs} +184 -23
  50. package/dist/eslint-rules/rules/04-code-quality.cjs +346 -0
  51. package/dist/eslint-rules/rules/05-styling.cjs +61 -0
  52. package/dist/eslint-rules/rules/{rbac.cjs → 06-security-rbac.cjs} +34 -13
  53. package/dist/eslint-rules/rules/07-api-tech-stack.cjs +385 -0
  54. package/dist/eslint-rules/rules/08-testing.cjs +94 -0
  55. package/dist/{functions-DHebl8-F.d.ts → functions-lBy5L2ry.d.ts} +1 -1
  56. package/dist/hooks.d.ts +5 -5
  57. package/dist/hooks.js +8 -8
  58. package/dist/index.d.ts +7 -7
  59. package/dist/index.js +21 -20
  60. package/dist/providers.js +2 -2
  61. package/dist/rbac/index.d.ts +1 -1
  62. package/dist/rbac/index.js +8 -8
  63. package/dist/theming/runtime.d.ts +61 -1
  64. package/dist/theming/runtime.js +1 -1
  65. package/dist/{types-B-K_5VnO.d.ts → types-DXstZpNI.d.ts} +0 -17
  66. package/dist/types.d.ts +2 -2
  67. package/dist/{usePublicRouteParams-COZ28Mvq.d.ts → usePublicRouteParams-MamNgwqe.d.ts} +19 -19
  68. package/dist/utils.d.ts +2 -2
  69. package/dist/utils.js +8 -8
  70. package/docs/README.md +1 -1
  71. package/docs/api/modules.md +106 -41
  72. package/docs/api-reference/components.md +18 -20
  73. package/docs/api-reference/hooks.md +80 -80
  74. package/docs/api-reference/types.md +1 -1
  75. package/docs/api-reference/utilities.md +1 -1
  76. package/docs/architecture/README.md +1 -1
  77. package/docs/core-concepts/events.md +3 -3
  78. package/docs/core-concepts/organisations.md +6 -6
  79. package/docs/core-concepts/permissions.md +6 -6
  80. package/docs/documentation-index.md +12 -18
  81. package/docs/getting-started/dependencies.md +23 -0
  82. package/docs/getting-started/documentation-index.md +1 -1
  83. package/docs/getting-started/examples/README.md +4 -4
  84. package/docs/getting-started/examples/full-featured-app.md +1 -1
  85. package/docs/getting-started/faq.md +2 -2
  86. package/docs/getting-started/quick-reference.md +4 -4
  87. package/docs/implementation-guides/app-layout.md +1 -1
  88. package/docs/implementation-guides/authentication.md +15 -15
  89. package/docs/implementation-guides/component-styling.md +1 -1
  90. package/docs/implementation-guides/data-tables.md +127 -34
  91. package/docs/implementation-guides/datatable-rbac-usage.md +1 -1
  92. package/docs/implementation-guides/dynamic-colors.md +3 -3
  93. package/docs/implementation-guides/file-upload-storage.md +2 -2
  94. package/docs/implementation-guides/hierarchical-datatable.md +40 -60
  95. package/docs/implementation-guides/inactivity-tracking.md +3 -3
  96. package/docs/implementation-guides/large-datasets.md +3 -2
  97. package/docs/implementation-guides/organisation-security.md +2 -2
  98. package/docs/implementation-guides/performance.md +2 -2
  99. package/docs/implementation-guides/permission-enforcement.md +1 -1
  100. package/docs/migration/V0.3.44_organisation-context-timing-fix.md +1 -1
  101. package/docs/migration/V0.4.0_rbac-migration.md +6 -6
  102. package/docs/rbac/README.md +5 -5
  103. package/docs/rbac/advanced-patterns.md +6 -6
  104. package/docs/rbac/api-reference.md +20 -20
  105. package/docs/rbac/event-based-apps.md +3 -3
  106. package/docs/rbac/examples.md +41 -41
  107. package/docs/rbac/getting-started.md +37 -37
  108. package/docs/rbac/performance.md +1 -1
  109. package/docs/rbac/quick-start.md +52 -52
  110. package/docs/rbac/secure-client-protection.md +1 -1
  111. package/docs/rbac/troubleshooting.md +1 -1
  112. package/docs/security/README.md +5 -5
  113. package/docs/standards/0-standards-overview.md +220 -0
  114. package/docs/standards/{00-pace-core-compliance.md → 1-pace-core-compliance-standards.md} +241 -185
  115. package/docs/standards/{02-project-structure.md → 2-project-structure-standards.md} +11 -47
  116. package/docs/standards/3-architecture-standards.md +606 -0
  117. package/docs/standards/4-code-quality-standards.md +728 -0
  118. package/docs/standards/{08-markup-quality.md → 5-styling-standards.md} +12 -9
  119. package/docs/standards/{09-rbac-compliance.md → 6-security-rbac-standards.md} +126 -18
  120. package/docs/standards/7-api-tech-stack-standards.md +662 -0
  121. package/docs/standards/8-testing-documentation-standards.md +401 -0
  122. package/docs/standards/9-operations-standards.md +1102 -0
  123. package/docs/standards/README.md +203 -104
  124. package/docs/troubleshooting/README.md +4 -4
  125. package/docs/troubleshooting/common-issues.md +2 -2
  126. package/docs/troubleshooting/debugging.md +9 -9
  127. package/docs/troubleshooting/migration.md +4 -4
  128. package/eslint-config-pace-core.cjs +50 -20
  129. package/package.json +50 -19
  130. package/scripts/eslint-audit.cjs +123 -0
  131. package/scripts/install-cursor-rules.cjs +11 -243
  132. package/scripts/install-eslint-config.cjs +349 -0
  133. package/scripts/validate-dependencies.cjs +248 -0
  134. package/src/__tests__/helpers/__tests__/component-test-utils.test.tsx +2 -2
  135. package/src/__tests__/helpers/__tests__/test-providers.test.tsx +2 -2
  136. package/src/__tests__/helpers/__tests__/test-utils.test.tsx +30 -18
  137. package/src/__tests__/integration/UserProfile.test.tsx +14 -14
  138. package/src/__tests__/rbac/PagePermissionGuard.test.tsx +6 -6
  139. package/src/__tests__/templates/accessibility.test.template.tsx +10 -9
  140. package/src/__tests__/templates/component.test.template.tsx +18 -15
  141. package/src/components/AddressField/AddressField.tsx +26 -1
  142. package/src/components/Alert/Alert.test.tsx +86 -22
  143. package/src/components/Alert/Alert.tsx +19 -11
  144. package/src/components/Badge/Badge.tsx +1 -1
  145. package/src/components/Calendar/Calendar.tsx +201 -47
  146. package/src/components/Checkbox/Checkbox.test.tsx +2 -1
  147. package/src/components/ContextSelector/ContextSelector.tsx +108 -126
  148. package/src/components/DataTable/AUDIT_REPORT.md +293 -0
  149. package/src/components/DataTable/DataTable.tsx +1 -19
  150. package/src/components/DataTable/__tests__/DataTableCore.test.tsx +6 -2
  151. package/src/components/DataTable/__tests__/a11y.basic.test.tsx +21 -6
  152. package/src/components/DataTable/__tests__/pagination.modes.test.tsx +3 -2
  153. package/src/components/DataTable/__tests__/test-utils/sharedTestUtils.tsx +9 -9
  154. package/src/components/DataTable/components/ColumnFilter.tsx +63 -74
  155. package/src/components/DataTable/components/ColumnVisibilityDropdown.tsx +43 -41
  156. package/src/components/DataTable/components/DataTableErrorBoundary.tsx +9 -11
  157. package/src/components/DataTable/components/DataTableLayout.tsx +5 -16
  158. package/src/components/DataTable/components/EditableRow.tsx +5 -7
  159. package/src/components/DataTable/components/EmptyState.tsx +11 -10
  160. package/src/components/DataTable/components/FilterRow.tsx +2 -4
  161. package/src/components/DataTable/components/ImportModal.tsx +124 -126
  162. package/src/components/DataTable/components/LoadingState.tsx +5 -6
  163. package/src/components/DataTable/components/SortIndicator.tsx +50 -0
  164. package/src/components/DataTable/components/__tests__/COVERAGE_NOTE.md +4 -4
  165. package/src/components/DataTable/components/__tests__/ColumnFilter.test.tsx +23 -82
  166. package/src/components/DataTable/components/__tests__/DataTableErrorBoundary.test.tsx +37 -9
  167. package/src/components/DataTable/components/__tests__/EmptyState.test.tsx +7 -4
  168. package/src/components/DataTable/components/__tests__/FilterRow.test.tsx +12 -4
  169. package/src/components/DataTable/components/__tests__/LoadingState.test.tsx +45 -27
  170. package/src/components/DataTable/components/index.ts +2 -1
  171. package/src/components/DataTable/types.ts +0 -18
  172. package/src/components/DataTable/utils/a11yUtils.ts +17 -0
  173. package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +1 -1
  174. package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx +11 -15
  175. package/src/components/DateTimeField/DateTimeField.tsx +7 -8
  176. package/src/components/Dialog/Dialog.test.tsx +1 -0
  177. package/src/components/Dialog/Dialog.tsx +25 -8
  178. package/src/components/ErrorBoundary/ErrorBoundary.tsx +77 -79
  179. package/src/components/FileUpload/FileUpload.test.tsx +45 -16
  180. package/src/components/FileUpload/FileUpload.tsx +141 -130
  181. package/src/components/NavigationMenu/NavigationMenu.test.tsx +48 -12
  182. package/src/components/PaceAppLayout/PaceAppLayout.performance.test.tsx +9 -9
  183. package/src/components/PaceAppLayout/PaceAppLayout.security.test.tsx +30 -30
  184. package/src/components/PaceAppLayout/PaceAppLayout.test.tsx +4 -4
  185. package/src/components/PaceLoginPage/PaceLoginPage.test.tsx +7 -1
  186. package/src/components/Progress/Progress.tsx +2 -4
  187. package/src/components/ProtectedRoute/ProtectedRoute.tsx +8 -8
  188. package/src/components/Select/Select.tsx +86 -77
  189. package/src/components/Select/types.ts +3 -0
  190. package/src/hooks/__tests__/ServiceHooks.test.tsx +16 -16
  191. package/src/hooks/__tests__/hooks.integration.test.tsx +49 -49
  192. package/src/hooks/__tests__/useDataTablePerformance.unit.test.ts +8 -5
  193. package/src/hooks/__tests__/useFileUrl.unit.test.ts +4 -0
  194. package/src/hooks/__tests__/useFocusTrap.unit.test.tsx +99 -99
  195. package/src/hooks/__tests__/useInactivityTracker.unit.test.ts +45 -8
  196. package/src/hooks/__tests__/usePerformanceMonitor.unit.test.ts +22 -2
  197. package/src/hooks/public/usePublicEvent.ts +5 -5
  198. package/src/hooks/public/usePublicEventLogo.ts +5 -5
  199. package/src/hooks/public/usePublicFileDisplay.ts +2 -2
  200. package/src/hooks/public/usePublicRouteParams.ts +13 -9
  201. package/src/hooks/useAddressAutocomplete.test.ts +18 -18
  202. package/src/hooks/useAppConfig.ts +2 -2
  203. package/src/hooks/useEventTheme.test.ts +7 -7
  204. package/src/hooks/useEventTheme.ts +2 -1
  205. package/src/hooks/useFileDisplay.ts +2 -2
  206. package/src/hooks/useFileUrl.ts +52 -8
  207. package/src/hooks/useOrganisationSecurity.test.ts +2 -1
  208. package/src/providers/UnifiedAuthProvider.smoke.test.tsx +21 -21
  209. package/src/providers/__tests__/AuthProvider.test.tsx +21 -21
  210. package/src/providers/__tests__/EventProvider.test.tsx +61 -61
  211. package/src/providers/__tests__/InactivityProvider.test.tsx +56 -56
  212. package/src/providers/__tests__/OrganisationProvider.test.tsx +75 -75
  213. package/src/providers/__tests__/ProviderLifecycle.test.tsx +38 -38
  214. package/src/providers/__tests__/UnifiedAuthProvider.test.tsx +103 -103
  215. package/src/providers/services/__tests__/AuthServiceProvider.integration.test.tsx +7 -7
  216. package/src/providers/services/__tests__/UnifiedAuthProvider.integration.test.tsx +10 -10
  217. package/src/rbac/__tests__/auth-rbac.e2e.test.tsx +15 -6
  218. package/src/rbac/__tests__/rbac-functions.test.ts +3 -3
  219. package/src/rbac/api.test.ts +104 -0
  220. package/src/rbac/engine.ts +1 -1
  221. package/src/rbac/hooks/useCan.test.ts +2 -2
  222. package/src/rbac/secureClient.ts +1 -1
  223. package/src/rbac/types/functions.ts +1 -1
  224. package/src/styles/core.css +7 -0
  225. package/src/theming/__tests__/parseEventColours.test.ts +118 -3
  226. package/src/theming/parseEventColours.ts +77 -11
  227. package/src/types/supabase.ts +2 -3
  228. package/src/utils/__tests__/bundleAnalysis.unit.test.ts +9 -9
  229. package/src/utils/__tests__/lazyLoad.unit.test.tsx +42 -39
  230. package/src/utils/file-reference/__tests__/file-reference.test.ts +4 -0
  231. package/src/utils/formatting/formatDate.test.ts +3 -2
  232. package/src/utils/formatting/formatDateTime.test.ts +2 -2
  233. package/src/utils/google-places/googlePlacesUtils.test.ts +36 -24
  234. package/src/utils/storage/README.md +1 -1
  235. package/src/utils/storage/__tests__/helpers.unit.test.ts +19 -12
  236. package/src/utils/storage/helpers.test.ts +69 -3
  237. package/cursor-rules/01-standards-compliance.mdc +0 -285
  238. package/cursor-rules/04-testing-standards.mdc +0 -270
  239. package/cursor-rules/05-bug-reports-and-features.mdc +0 -248
  240. package/cursor-rules/06-code-quality.mdc +0 -311
  241. package/cursor-rules/07-tech-stack-compliance.mdc +0 -216
  242. package/cursor-rules/10-error-handling-patterns.mdc +0 -179
  243. package/cursor-rules/11-performance-optimization.mdc +0 -169
  244. package/cursor-rules/12-ci-cd-integration.mdc +0 -150
  245. package/dist/DataTable-LRJL4IRV.js +0 -15
  246. package/dist/eslint-rules/rules/compliance.cjs +0 -348
  247. package/dist/eslint-rules/rules/components.cjs +0 -113
  248. package/dist/eslint-rules/rules/imports.cjs +0 -102
  249. package/docs/best-practices/README.md +0 -472
  250. package/docs/best-practices/accessibility.md +0 -604
  251. package/docs/best-practices/common-patterns.md +0 -516
  252. package/docs/best-practices/deployment.md +0 -1103
  253. package/docs/best-practices/performance.md +0 -1328
  254. package/docs/best-practices/security.md +0 -940
  255. package/docs/best-practices/testing.md +0 -1034
  256. package/docs/rbac/compliance/compliance-guide.md +0 -544
  257. package/docs/standards/01-standards-compliance.md +0 -188
  258. package/docs/standards/03-solid-principles.md +0 -39
  259. package/docs/standards/04-testing-standards.md +0 -36
  260. package/docs/standards/05-bug-reports-and-features.md +0 -27
  261. package/docs/standards/06-code-quality.md +0 -34
  262. package/docs/standards/07-tech-stack-compliance.md +0 -30
  263. package/docs/standards/10-error-handling-patterns.md +0 -401
  264. package/docs/standards/11-performance-optimization.md +0 -348
  265. package/docs/standards/12-ci-cd-integration.md +0 -370
  266. package/docs/standards/ALIGNMENT_REVIEW_SUMMARY.md +0 -192
  267. package/scripts/audit/audit-compliance.cjs +0 -1295
  268. package/scripts/audit/audit-components.cjs +0 -260
  269. package/scripts/audit/audit-rbac.cjs +0 -954
  270. package/scripts/audit/audit-standards.cjs +0 -1268
  271. package/scripts/audit/index.cjs +0 -1927
  272. package/src/components/DataTable/components/DataTableBody.tsx +0 -478
  273. package/src/components/DataTable/components/DraggableColumnHeader.tsx +0 -156
  274. package/src/components/DataTable/components/ExpandButton.tsx +0 -113
  275. package/src/components/DataTable/components/GroupHeader.tsx +0 -54
  276. package/src/components/DataTable/components/ViewRowModal.tsx +0 -68
  277. package/src/components/DataTable/components/VirtualizedDataTable.tsx +0 -525
  278. package/src/components/DataTable/components/__tests__/ExpandButton.test.tsx +0 -462
  279. package/src/components/DataTable/components/__tests__/GroupHeader.test.tsx +0 -393
  280. package/src/components/DataTable/components/__tests__/ViewRowModal.test.tsx +0 -476
  281. package/src/components/DataTable/components/__tests__/VirtualizedDataTable.test.tsx +0 -128
  282. package/src/components/DataTable/core/DataTableContext.tsx +0 -216
  283. package/src/components/DataTable/core/__tests__/DataTableContext.test.tsx +0 -136
  284. package/src/components/DataTable/hooks/__tests__/useColumnReordering.test.ts +0 -570
  285. package/src/components/DataTable/hooks/useColumnReordering.ts +0 -123
  286. package/src/components/DataTable/utils/debugTools.ts +0 -514
  287. package/src/eslint-rules/index.cjs +0 -22
  288. package/src/eslint-rules/rules/components.cjs +0 -113
  289. package/src/eslint-rules/rules/imports.cjs +0 -102
  290. package/src/eslint-rules/rules/rbac.cjs +0 -790
  291. package/src/eslint-rules/utils/helpers.cjs +0 -42
  292. package/src/eslint-rules/utils/manifest-loader.cjs +0 -75
@@ -0,0 +1,380 @@
1
+ /**
2
+ * Report Generation Utilities for Audit Tool
3
+ * @package @jmruthers/pace-core
4
+ * @module Audit/utils/report-utils
5
+ */
6
+
7
+ const path = require('path');
8
+
9
+ /**
10
+ * Format a single issue for markdown report
11
+ * @param {Object} issue - Issue object
12
+ * @param {string} standard - Standard name (e.g., '01-pace-core-compliance')
13
+ * @returns {string} - Formatted markdown
14
+ */
15
+ function formatIssue(issue, standard) {
16
+ const severity = issue.severity || 'error';
17
+ const severityIcon = severity === 'error' ? '❌' : severity === 'warning' ? '⚠️' : 'ℹ️';
18
+
19
+ let formatted = `\n#### ${severityIcon} ${issue.type || 'Issue'}\n\n`;
20
+
21
+ if (issue.file) {
22
+ formatted += `**File:** \`${issue.file}\`\n\n`;
23
+ }
24
+
25
+ if (issue.line) {
26
+ formatted += `**Line:** ${issue.line}\n\n`;
27
+ }
28
+
29
+ if (issue.message) {
30
+ formatted += `**Message:** ${issue.message}\n\n`;
31
+ }
32
+
33
+ if (issue.code) {
34
+ formatted += `**Code:**\n\`\`\`\n${issue.code}\n\`\`\`\n\n`;
35
+ }
36
+
37
+ if (issue.fix) {
38
+ formatted += `**Fix:** ${issue.fix}\n\n`;
39
+ }
40
+
41
+ if (issue.details) {
42
+ formatted += `**Details:** ${issue.details}\n\n`;
43
+ }
44
+
45
+ return formatted;
46
+ }
47
+
48
+ /**
49
+ * Format a standard section in the report
50
+ * @param {string} standard - Standard number and name (e.g., '01-pace-core-compliance')
51
+ * @param {string} standardName - Human-readable standard name
52
+ * @param {Array} issues - Array of issues
53
+ * @param {string} standardDocPath - Path to standards documentation
54
+ * @returns {string} - Formatted markdown section
55
+ */
56
+ function formatStandardSection(standard, standardName, issues, standardDocPath) {
57
+ if (issues.length === 0) {
58
+ return `\n### ✅ Standard ${standard}: ${standardName}\n\nNo issues found.\n`;
59
+ }
60
+
61
+ let section = `\n### ❌ Standard ${standard}: ${standardName}\n\n`;
62
+ section += `**Reference:** [${standardName}](https://github.com/jmruthers/pace-core/blob/main/packages/core/docs/standards/${standardDocPath})\n\n`;
63
+ section += `**Issues Found:** ${issues.length}\n\n`;
64
+
65
+ // Group issues by type
66
+ const issuesByType = {};
67
+ issues.forEach(issue => {
68
+ const type = issue.type || 'other';
69
+ if (!issuesByType[type]) {
70
+ issuesByType[type] = [];
71
+ }
72
+ issuesByType[type].push(issue);
73
+ });
74
+
75
+ // Format each type group
76
+ Object.entries(issuesByType).forEach(([type, typeIssues]) => {
77
+ section += `\n#### ${type} (${typeIssues.length} issue${typeIssues.length > 1 ? 's' : ''})\n`;
78
+ typeIssues.forEach(issue => {
79
+ section += formatIssue(issue, standard);
80
+ });
81
+ });
82
+
83
+ return section;
84
+ }
85
+
86
+ /**
87
+ * Format dependency audit section for markdown report
88
+ * @param {Object} dependencyResult - Dependency audit result
89
+ * @returns {string} - Formatted markdown section
90
+ */
91
+ function formatDependencyAuditSection(dependencyResult) {
92
+ if (dependencyResult.error) {
93
+ return `\n### ❌ Dependency Audit\n\n**Error:** ${dependencyResult.error}\n\n`;
94
+ }
95
+
96
+ const issues = dependencyResult.issues || {};
97
+ const includedDeps = issues.includedDeps || [];
98
+ const missingRequired = issues.missingRequired || [];
99
+ const missingOptional = issues.missingOptional || [];
100
+ const versionIssues = issues.versionIssues || [];
101
+ const wrongLocation = issues.wrongLocation || [];
102
+ const missingDevDeps = issues.missingDevDeps || [];
103
+ const devVersionIssues = issues.devVersionIssues || [];
104
+
105
+ const totalIssues = includedDeps.length + missingRequired.length + versionIssues.length + wrongLocation.length + missingDevDeps.length + devVersionIssues.length;
106
+
107
+ if (totalIssues === 0 && missingOptional.length === 0) {
108
+ return `\n### ✅ Dependency Audit\n\nNo issues found.\n`;
109
+ }
110
+
111
+ let section = `\n### ${totalIssues > 0 ? '❌' : '⚠️'} Dependency Audit\n\n`;
112
+ section += `**Reference:** [Dependencies Guide](https://github.com/jmruthers/pace-core/blob/main/packages/core/docs/getting-started/dependencies.md)\n\n`;
113
+
114
+ if (totalIssues > 0) {
115
+ section += `**Issues Found:** ${totalIssues}\n\n`;
116
+ }
117
+
118
+ // Included dependencies (errors)
119
+ if (includedDeps.length > 0) {
120
+ section += `#### ❌ Included Dependencies (MUST REMOVE) - ${includedDeps.length} issue${includedDeps.length > 1 ? 's' : ''}\n\n`;
121
+ section += `These packages are already included in pace-core and should NOT be installed in your app:\n\n`;
122
+ includedDeps.forEach(issue => {
123
+ section += `- **${issue.package}**@${issue.installed} (in ${issue.location})\n`;
124
+ section += ` - Should NOT be installed (already included in pace-core)\n`;
125
+ section += ` - Fix: \`npm uninstall ${issue.package}\`\n\n`;
126
+ });
127
+ }
128
+
129
+ // Missing required dependencies (errors)
130
+ if (missingRequired.length > 0) {
131
+ section += `#### ❌ Missing Required Dependencies - ${missingRequired.length} issue${missingRequired.length > 1 ? 's' : ''}\n\n`;
132
+ section += `These packages are required for pace-core to function:\n\n`;
133
+ missingRequired.forEach(issue => {
134
+ section += `- **${issue.package}** (required: ${issue.required})\n`;
135
+ section += ` - Fix: \`npm install ${issue.package}@${issue.required}\`\n\n`;
136
+ });
137
+ }
138
+
139
+ // Version issues (errors)
140
+ if (versionIssues.length > 0) {
141
+ section += `#### ⚠️ Version Issues - ${versionIssues.length} issue${versionIssues.length > 1 ? 's' : ''}\n\n`;
142
+ section += `These packages have incorrect version ranges:\n\n`;
143
+ versionIssues.forEach(issue => {
144
+ section += `- **${issue.package}**\n`;
145
+ section += ` - Installed: ${issue.installed}\n`;
146
+ section += ` - Required: ${issue.required}\n`;
147
+ section += ` - Fix: \`npm install ${issue.package}@${issue.required}\`\n\n`;
148
+ });
149
+ }
150
+
151
+ // Wrong location (warnings)
152
+ if (wrongLocation.length > 0) {
153
+ section += `#### ⚠️ Wrong Location - ${wrongLocation.length} issue${wrongLocation.length > 1 ? 's' : ''}\n\n`;
154
+ section += `These packages are in the wrong location in package.json:\n\n`;
155
+ wrongLocation.forEach(issue => {
156
+ section += `- **${issue.package}**\n`;
157
+ section += ` - Currently in: ${issue.current}\n`;
158
+ section += ` - Should be in: ${issue.shouldBe}\n`;
159
+ section += ` - Fix: \`npm uninstall ${issue.package} && npm install -D ${issue.package}\`\n\n`;
160
+ });
161
+ }
162
+
163
+ // Missing optional dependencies (info)
164
+ if (missingOptional.length > 0) {
165
+ section += `#### ℹ️ Missing Optional Dependencies - ${missingOptional.length} package${missingOptional.length > 1 ? 's' : ''}\n\n`;
166
+ section += `These packages are optional and only needed if you use specific features:\n\n`;
167
+ missingOptional.forEach(issue => {
168
+ section += `- **${issue.package}** (required: ${issue.required})\n`;
169
+ section += ` - Install only if you use this feature\n`;
170
+ section += ` - Fix: \`npm install ${issue.package}@${issue.required}\`\n\n`;
171
+ });
172
+ }
173
+
174
+ // Missing dev dependencies (errors)
175
+ if (missingDevDeps.length > 0) {
176
+ section += `#### ❌ Missing Required Dev Dependencies - ${missingDevDeps.length} issue${missingDevDeps.length > 1 ? 's' : ''}\n\n`;
177
+ section += `These dev dependencies are required for a compatible development environment:\n\n`;
178
+ missingDevDeps.forEach(issue => {
179
+ section += `- **${issue.package}** (required: ${issue.required})\n`;
180
+ section += ` - Fix: \`npm install -D ${issue.package}@${issue.required}\`\n\n`;
181
+ });
182
+ }
183
+
184
+ // Dev version issues (errors)
185
+ if (devVersionIssues.length > 0) {
186
+ section += `#### ⚠️ Dev Dependency Version Issues - ${devVersionIssues.length} issue${devVersionIssues.length > 1 ? 's' : ''}\n\n`;
187
+ section += `These dev dependencies have incorrect version ranges:\n\n`;
188
+ devVersionIssues.forEach(issue => {
189
+ section += `- **${issue.package}** (in ${issue.location})\n`;
190
+ section += ` - Installed: ${issue.installed}\n`;
191
+ section += ` - Required: ${issue.required}\n`;
192
+ section += ` - Fix: \`npm install -D ${issue.package}@${issue.required}\`\n\n`;
193
+ });
194
+ }
195
+
196
+ return section;
197
+ }
198
+
199
+ /**
200
+ * Generate markdown report from audit results
201
+ * @param {Object} results - Audit results object (standard audits)
202
+ * @param {string} consumingAppPath - Path to consuming app
203
+ * @param {Object} dependencyResult - Dependency audit result (optional)
204
+ * @returns {string} - Complete markdown report
205
+ */
206
+ function generateMarkdownReport(results, consumingAppPath, dependencyResult = null) {
207
+ const now = new Date();
208
+ const timestamp = now.toISOString();
209
+
210
+ let report = `# pace-core Audit Report\n\n`;
211
+ report += `**Generated:** ${timestamp}\n`;
212
+ report += `**App Path:** ${consumingAppPath}\n\n`;
213
+ report += `---\n\n`;
214
+ report += `## Summary\n\n`;
215
+
216
+ // Calculate totals
217
+ const standardNames = {
218
+ '01-pace-core-compliance': 'pace-core Compliance',
219
+ '02-project-structure': 'Project Structure',
220
+ '03-architecture': 'Architecture',
221
+ '04-code-quality': 'Code Quality',
222
+ '05-styling': 'Styling',
223
+ '06-security-rbac': 'Security & RBAC',
224
+ '07-api-tech-stack': 'API & Tech Stack',
225
+ '08-testing-documentation': 'Testing & Documentation',
226
+ '09-operations': 'Operations',
227
+ };
228
+
229
+ const standardDocPaths = {
230
+ '01-pace-core-compliance': '1-pace-core-compliance-standards.md',
231
+ '02-project-structure': '2-project-structure-standards.md',
232
+ '03-architecture': '3-architecture-standards.md',
233
+ '04-code-quality': '4-code-quality-standards.md',
234
+ '05-styling': '5-styling-standards.md',
235
+ '06-security-rbac': '6-security-rbac-standards.md',
236
+ '07-api-tech-stack': '7-api-tech-stack-standards.md',
237
+ '08-testing-documentation': '8-testing-documentation-standards.md',
238
+ '09-operations': '9-operations-standards.md',
239
+ };
240
+
241
+ let totalIssues = 0;
242
+ const standardCounts = {};
243
+
244
+ // Count issues per standard
245
+ Object.keys(standardNames).forEach(standard => {
246
+ const standardResult = results[standard];
247
+ if (standardResult && standardResult.issues) {
248
+ const count = Array.isArray(standardResult.issues)
249
+ ? standardResult.issues.length
250
+ : Object.values(standardResult.issues).flat().length;
251
+ standardCounts[standard] = count;
252
+ totalIssues += count;
253
+ } else {
254
+ standardCounts[standard] = 0;
255
+ }
256
+ });
257
+
258
+ // Count dependency audit issues
259
+ let dependencyIssues = 0;
260
+ if (dependencyResult && !dependencyResult.error) {
261
+ const depIssues = dependencyResult.issues || {};
262
+ dependencyIssues = (depIssues.includedDeps?.length || 0) +
263
+ (depIssues.missingRequired?.length || 0) +
264
+ (depIssues.versionIssues?.length || 0) +
265
+ (depIssues.wrongLocation?.length || 0) +
266
+ (depIssues.missingDevDeps?.length || 0) +
267
+ (depIssues.devVersionIssues?.length || 0);
268
+ totalIssues += dependencyIssues;
269
+ }
270
+
271
+ report += `**Total Issues:** ${totalIssues}\n\n`;
272
+ report += `| Standard | Issues |\n`;
273
+ report += `|----------|--------|\n`;
274
+
275
+ // Add dependency audit to summary table first
276
+ if (dependencyResult) {
277
+ const depIcon = dependencyIssues === 0 ? '✅' : '❌';
278
+ report += `| ${depIcon} Dependency Audit | ${dependencyIssues} |\n`;
279
+ }
280
+
281
+ Object.entries(standardCounts).forEach(([standard, count]) => {
282
+ const icon = count === 0 ? '✅' : '❌';
283
+ report += `| ${icon} ${standardNames[standard]} | ${count} |\n`;
284
+ });
285
+
286
+ report += `\n---\n\n`;
287
+ report += `## Detailed Results\n\n`;
288
+
289
+ // Add dependency audit section first
290
+ if (dependencyResult) {
291
+ report += formatDependencyAuditSection(dependencyResult);
292
+ }
293
+
294
+ // Generate sections for each standard
295
+ Object.keys(standardNames).forEach(standard => {
296
+ const standardResult = results[standard];
297
+ if (standardResult) {
298
+ const issues = Array.isArray(standardResult.issues)
299
+ ? standardResult.issues
300
+ : Object.values(standardResult.issues || {}).flat();
301
+
302
+ report += formatStandardSection(
303
+ standard,
304
+ standardNames[standard],
305
+ issues,
306
+ standardDocPaths[standard]
307
+ );
308
+ }
309
+ });
310
+
311
+ report += `\n---\n\n`;
312
+ report += `## Next Steps\n\n`;
313
+
314
+ if (totalIssues === 0) {
315
+ report += `✅ All audits passed! Your app is compliant with pace-core standards.\n\n`;
316
+ } else {
317
+ report += `Please review the issues above and address them according to the referenced standards.\n\n`;
318
+ report += `For more information, see the [pace-core Standards Documentation](https://github.com/jmruthers/pace-core/blob/main/packages/core/docs/standards/README.md).\n\n`;
319
+ }
320
+
321
+ return report;
322
+ }
323
+
324
+ /**
325
+ * Generate summary statistics
326
+ * @param {Object} results - Audit results object
327
+ * @returns {Object} - Summary object with counts
328
+ */
329
+ function generateSummary(results) {
330
+ const standardNames = {
331
+ '01-pace-core-compliance': 'pace-core Compliance',
332
+ '02-project-structure': 'Project Structure',
333
+ '03-architecture': 'Architecture',
334
+ '04-code-quality': 'Code Quality',
335
+ '05-styling': 'Styling',
336
+ '06-security-rbac': 'Security & RBAC',
337
+ '07-api-tech-stack': 'API & Tech Stack',
338
+ '08-testing-documentation': 'Testing & Documentation',
339
+ '09-operations': 'Operations',
340
+ };
341
+
342
+ const summary = {
343
+ total: 0,
344
+ byStandard: {},
345
+ bySeverity: { error: 0, warning: 0, info: 0 },
346
+ };
347
+
348
+ Object.keys(standardNames).forEach(standard => {
349
+ const standardResult = results[standard];
350
+ if (standardResult && standardResult.issues) {
351
+ const issues = Array.isArray(standardResult.issues)
352
+ ? standardResult.issues
353
+ : Object.values(standardResult.issues || {}).flat();
354
+
355
+ const count = issues.length;
356
+ summary.byStandard[standard] = count;
357
+ summary.total += count;
358
+
359
+ // Count by severity
360
+ issues.forEach(issue => {
361
+ const severity = issue.severity || 'error';
362
+ if (summary.bySeverity[severity] !== undefined) {
363
+ summary.bySeverity[severity]++;
364
+ }
365
+ });
366
+ } else {
367
+ summary.byStandard[standard] = 0;
368
+ }
369
+ });
370
+
371
+ return summary;
372
+ }
373
+
374
+ module.exports = {
375
+ formatIssue,
376
+ formatStandardSection,
377
+ formatDependencyAuditSection,
378
+ generateMarkdownReport,
379
+ generateSummary,
380
+ };
@@ -0,0 +1,156 @@
1
+ ---
2
+ description: Overview of the pace-core standards system and the four layers of quality enforcement
3
+ globs: ["**/*.{ts,tsx,js,jsx,md,mdx}"]
4
+ alwaysApply: true
5
+ paceCoreVersion: "0.6.x"
6
+ rulesVersion: "2025-01-28"
7
+ ---
8
+ # Standards Overview
9
+
10
+ **📚 Human-Readable Standard**: See [0-standards-overview.md](../../packages/core/docs/standards/0-standards-overview.md) for complete documentation.
11
+
12
+ This is the entry point to the pace-core standards system. It explains how the four layers of quality enforcement work together and how cursor rules fit into the system.
13
+
14
+ ## AI Agent Instructions
15
+
16
+ **When writing or modifying code, ALWAYS:**
17
+ 1. **Start here** - Read this overview to understand the system
18
+ 2. **Use the right rule** - Check the Quick Reference below to find the relevant rule(s)
19
+ 3. **Follow decision trees** - Each rule includes decision trees to guide your choices
20
+ 4. **Check examples** - Every rule includes ❌ WRONG / ✅ CORRECT examples
21
+ 5. **Reference standards** - When in doubt, check the linked standards document
22
+ 6. **Focus on patterns** - These rules guide patterns, not mechanical checks (ESLint handles those)
23
+
24
+ ## The Four Layers of Quality Enforcement
25
+
26
+ The pace-suite uses **four complementary quality layers**, each with a distinct responsibility:
27
+
28
+ ### 1. Standards Documents (Source of Truth)
29
+ - Human-readable `.md` documents
30
+ - Define *what "good" looks like*
31
+ - **If there is a conflict, the standards win.**
32
+
33
+ ### 2. Cursor Rules (Real-time Guidance) ← **You are here**
34
+ - AI-optimised interpretations of the standards
35
+ - Applied while code is being written or modified
36
+ - Prevent mistakes *before* they land
37
+ - **Translate standards into behaviour**, but do not redefine them
38
+
39
+ ### 3. ESLint (Fast, Local Static Analysis)
40
+ - Deterministic, file-level static analysis
41
+ - Catches obvious issues early (types, hooks, imports, patterns)
42
+ - Enforces *how code is written*, not *whether the system is correct*
43
+
44
+ ### 4. Audit Tool (Deep, System-Level Analysis)
45
+ - Operates across files, folders, and systems
46
+ - Validates architectural compliance (RBAC, data access, boundaries)
47
+ - Answers: *"Is this system actually compliant?"*
48
+
49
+ ## How the Layers Work Together
50
+
51
+ | Layer | Strength | Timing |
52
+ |--------------|----------------------------------|-----------------|
53
+ | Standards | Intent & clarity | Design time |
54
+ | Cursor rules | Preventive guidance | Write time |
55
+ | ESLint | Fast mechanical enforcement | Dev / CI |
56
+ | Audit tool | Deep architectural verification | Review / CI |
57
+
58
+ **No single layer is sufficient on its own.** Together, they create a repeatable, scalable quality system.
59
+
60
+ ## Standards File Mapping
61
+
62
+ The standards are organized into 10 files, each with a corresponding cursor rule:
63
+
64
+ | File | Standard | Cursor Rule | Purpose |
65
+ |------|----------|------------|---------|
66
+ | `0-standards-overview.md` | Overview | `00-standards-overview.mdc` | This file - entry point and system overview |
67
+ | `1-pace-core-compliance-standards.md` | pace-core Compliance | `01-pace-core-compliance.mdc` | Enforce pace-core usage patterns |
68
+ | `2-project-structure-standards.md` | Project Structure | `02-project-structure.mdc` | Define standard folder structure |
69
+ | `3-architecture-standards.md` | Architecture | `03-architecture.mdc` | Enforce SOLID architecture principles |
70
+ | `4-code-quality-standards.md` | Code Quality | `04-code-quality.mdc` | Enforce code quality standards |
71
+ | `5-styling-standards.md` | Styling | `05-styling.mdc` | Enforce clean markup and styling standards |
72
+ | `6-security-rbac-standards.md` | Security & RBAC | `06-security-rbac.mdc` | Enforce RBAC contract and security |
73
+ | `7-api-tech-stack-standards.md` | API & Tech Stack | `07-api-tech-stack.mdc` | Enforce tech stack versions and API standards |
74
+ | `8-testing-documentation-standards.md` | Testing & Documentation | `08-testing-documentation.mdc` | Enforce testing and documentation standards |
75
+ | `9-operations-standards.md` | Operations | `09-operations.mdc` | Enforce error handling, performance, and CI/CD |
76
+
77
+ ## Precedence Order
78
+
79
+ When standards conflict, apply this precedence order:
80
+
81
+ 1. **Security** - Security and RBAC standards take highest priority
82
+ 2. **API/RPC** - API contracts and RPC standards
83
+ 3. **Components & Markup** - Component usage and markup quality
84
+ 4. **Code Quality/Style** - TypeScript, naming, code style
85
+ 5. **Testing & Documentation** - Testing and documentation requirements
86
+ 6. **Consuming App Structure** - Project structure and organization
87
+
88
+ **Example:** If a component pattern conflicts with a security requirement, security wins.
89
+
90
+ ## Quick Reference Guide
91
+
92
+ **New to pace-core?** Start here:
93
+ 1. Read [Standards Overview](../../packages/core/docs/standards/0-standards-overview.md) (this file) - Understand the system
94
+ 2. Read [Styling Standards](../../packages/core/docs/standards/5-styling-standards.md) - **CRITICAL:** Required CSS setup
95
+ 3. Read [pace-core Compliance](../../packages/core/docs/standards/1-pace-core-compliance-standards.md) - How to use pace-core
96
+ 4. Read [Project Structure](../../packages/core/docs/standards/2-project-structure-standards.md) - Organize your code
97
+
98
+ **Common Tasks:**
99
+ - **Setting up a new app?** → [Project Structure](../../packages/core/docs/standards/2-project-structure-standards.md) + [Styling Standards](../../packages/core/docs/standards/5-styling-standards.md)
100
+ - **Writing components?** → [Architecture](../../packages/core/docs/standards/3-architecture-standards.md) + [Code Quality](../../packages/core/docs/standards/4-code-quality-standards.md)
101
+ - **Working with RBAC?** → [Security & RBAC](../../packages/core/docs/standards/6-security-rbac-standards.md)
102
+ - **Creating APIs/RPCs?** → [API & Tech Stack](../../packages/core/docs/standards/7-api-tech-stack-standards.md)
103
+ - **Handling errors?** → [Operations](../../packages/core/docs/standards/9-operations-standards.md)
104
+ - **Writing tests?** → [Testing & Documentation](../../packages/core/docs/standards/8-testing-documentation-standards.md)
105
+
106
+ ## Key Principles
107
+
108
+ - **Do not silence tools** — fix the underlying issue
109
+ - **Do not duplicate rules** — each layer has a purpose
110
+ - **Do not diverge silently** — document exceptions explicitly
111
+ - **Standards always win** — tools must align to them
112
+
113
+ ## What Cursor Rules Do
114
+
115
+ Cursor rules provide **real-time guidance** during code writing:
116
+
117
+ ✅ **DO:**
118
+ - Steer AI agents toward correct patterns
119
+ - Enforce architectural intent during development
120
+ - Reduce rework later in linting or audits
121
+ - Translate standards into actionable behavior
122
+
123
+ ❌ **DON'T:**
124
+ - Replace lint or audits
125
+ - Invent new standards
126
+ - Silence problems "to move on"
127
+ - Enforce mechanical checks (ESLint handles this)
128
+ - Validate system-level compliance (audit tool handles this)
129
+
130
+ ## Quick Reference: Which Rule to Use?
131
+
132
+ **When writing code, use these rules:**
133
+
134
+ - **Creating components?** → `01-pace-core-compliance.mdc` + `03-architecture.mdc` + `05-styling.mdc`
135
+ - **Writing hooks or utilities?** → `01-pace-core-compliance.mdc` + `03-architecture.mdc` + `04-code-quality.mdc`
136
+ - **Setting up providers or auth?** → `01-pace-core-compliance.mdc` + `06-security-rbac.mdc`
137
+ - **Creating RPCs or APIs?** → `07-api-tech-stack.mdc` + `06-security-rbac.mdc`
138
+ - **Writing tests?** → `08-testing-documentation.mdc`
139
+ - **Handling errors?** → `09-operations.mdc`
140
+ - **Optimizing performance?** → `09-operations.mdc` + `04-code-quality.mdc`
141
+ - **Organizing files?** → `02-project-structure.mdc`
142
+ - **Styling components?** → `05-styling.mdc` (ALWAYS APPLIED)
143
+ - **Working with RBAC?** → `06-security-rbac.mdc`
144
+
145
+ ## Related Documentation
146
+
147
+ - [Standards Overview](../../packages/core/docs/standards/0-standards-overview.md) - Complete standards system documentation
148
+ - [pace-core Compliance](../../packages/core/docs/standards/1-pace-core-compliance-standards.md) - pace-core usage patterns
149
+ - [Project Structure](../../packages/core/docs/standards/2-project-structure-standards.md) - Project structure and organization
150
+ - [Architecture](../../packages/core/docs/standards/3-architecture-standards.md) - SOLID architecture principles
151
+ - [Code Quality](../../packages/core/docs/standards/4-code-quality-standards.md) - Code quality and TypeScript standards
152
+ - [Styling](../../packages/core/docs/standards/5-styling-standards.md) - Markup and styling standards
153
+ - [Security & RBAC](../../packages/core/docs/standards/6-security-rbac-standards.md) - RBAC and RLS standards
154
+ - [API & Tech Stack](../../packages/core/docs/standards/7-api-tech-stack-standards.md) - Tech stack and API/RPC standards
155
+ - [Testing & Documentation](../../packages/core/docs/standards/8-testing-documentation-standards.md) - Testing and documentation standards
156
+ - [Operations](../../packages/core/docs/standards/9-operations-standards.md) - Error handling, performance, and CI/CD