@ryuenn3123/agentic-senior-core 3.0.50 → 4.0.1

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 (89) hide show
  1. package/.agent-context/prompts/bootstrap-design.md +3 -1
  2. package/.agent-context/prompts/research-design.md +165 -0
  3. package/.agent-context/review-checklists/pr-checklist.md +1 -0
  4. package/.agent-context/rules/api-docs.md +63 -47
  5. package/.agent-context/rules/architecture.md +133 -120
  6. package/.agent-context/rules/database-design.md +36 -18
  7. package/.agent-context/rules/docker-runtime.md +66 -43
  8. package/.agent-context/rules/efficiency-vs-hype.md +38 -17
  9. package/.agent-context/rules/error-handling.md +35 -16
  10. package/.agent-context/rules/event-driven.md +35 -18
  11. package/.agent-context/rules/frontend-architecture.md +103 -76
  12. package/.agent-context/rules/git-workflow.md +81 -197
  13. package/.agent-context/rules/microservices.md +42 -41
  14. package/.agent-context/rules/naming-conv.md +27 -8
  15. package/.agent-context/rules/performance.md +32 -12
  16. package/.agent-context/rules/realtime.md +26 -9
  17. package/.agent-context/rules/security.md +39 -20
  18. package/.agent-context/rules/testing.md +36 -16
  19. package/AGENTS.md +21 -20
  20. package/README.md +10 -1
  21. package/lib/cli/commands/init.mjs +12 -0
  22. package/lib/cli/commands/upgrade.mjs +11 -0
  23. package/lib/cli/compiler.mjs +1 -0
  24. package/lib/cli/detector/constants.mjs +135 -0
  25. package/lib/cli/detector/design-evidence/collector.mjs +256 -0
  26. package/lib/cli/detector/design-evidence/constants.mjs +39 -0
  27. package/lib/cli/detector/design-evidence/file-traversal.mjs +83 -0
  28. package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +117 -0
  29. package/lib/cli/detector/design-evidence/summary.mjs +109 -0
  30. package/lib/cli/detector/design-evidence/utility-helpers.mjs +122 -0
  31. package/lib/cli/detector/design-evidence.mjs +25 -610
  32. package/lib/cli/detector/stack-detection.mjs +243 -0
  33. package/lib/cli/detector/ui-signals.mjs +150 -0
  34. package/lib/cli/detector/workspace-scan.mjs +177 -0
  35. package/lib/cli/detector.mjs +20 -688
  36. package/lib/cli/memory-continuity.mjs +1 -0
  37. package/lib/cli/project-scaffolder/design-contract/research-dossier-migration.mjs +165 -0
  38. package/lib/cli/project-scaffolder/design-contract/sections/audits.mjs +96 -0
  39. package/lib/cli/project-scaffolder/design-contract/sections/conceptual-anchor.mjs +233 -0
  40. package/lib/cli/project-scaffolder/design-contract/sections/execution-handoff.mjs +211 -0
  41. package/lib/cli/project-scaffolder/design-contract/seed-signals.mjs +79 -0
  42. package/lib/cli/project-scaffolder/design-contract/signal-vocab.mjs +64 -0
  43. package/lib/cli/project-scaffolder/design-contract/validation/anchor-validators.mjs +456 -0
  44. package/lib/cli/project-scaffolder/design-contract/validation/audit-validators.mjs +117 -0
  45. package/lib/cli/project-scaffolder/design-contract/validation/completeness.mjs +83 -0
  46. package/lib/cli/project-scaffolder/design-contract/validation/execution-validators.mjs +328 -0
  47. package/lib/cli/project-scaffolder/design-contract/validation/helpers.mjs +8 -0
  48. package/lib/cli/project-scaffolder/design-contract/validation/research-dossier-validators.mjs +104 -0
  49. package/lib/cli/project-scaffolder/design-contract/validation/structural-validators.mjs +79 -0
  50. package/lib/cli/project-scaffolder/design-contract/validation/system-validators.mjs +256 -0
  51. package/lib/cli/project-scaffolder/design-contract/validation.mjs +61 -896
  52. package/lib/cli/project-scaffolder/design-contract.mjs +151 -556
  53. package/lib/cli/project-scaffolder/prompt-builders.mjs +9 -0
  54. package/mcp.json +30 -9
  55. package/package.json +17 -2
  56. package/scripts/audit-cache-layer-contract.mjs +258 -0
  57. package/scripts/audit-caching-scope-hygiene.mjs +263 -0
  58. package/scripts/audit-file-size.mjs +219 -0
  59. package/scripts/audit-reflection-citations.mjs +163 -0
  60. package/scripts/audit-release-bundle.mjs +170 -0
  61. package/scripts/audit-rule-id-uniqueness.mjs +313 -0
  62. package/scripts/benchmark-evidence-bundle.mjs +1 -0
  63. package/scripts/build-release-benchmark-bundle.mjs +204 -0
  64. package/scripts/context-triggered-audit.mjs +1 -0
  65. package/scripts/documentation-boundary-audit.mjs +1 -0
  66. package/scripts/explain-on-demand-audit.mjs +2 -1
  67. package/scripts/frontend-usability-audit.mjs +10 -10
  68. package/scripts/llm-judge/checklist-loader.mjs +45 -0
  69. package/scripts/llm-judge/constants.mjs +66 -0
  70. package/scripts/llm-judge/diff-collection.mjs +74 -0
  71. package/scripts/llm-judge/prompting.mjs +78 -0
  72. package/scripts/llm-judge/providers.mjs +111 -0
  73. package/scripts/llm-judge/verdict.mjs +134 -0
  74. package/scripts/llm-judge.mjs +21 -482
  75. package/scripts/mcp-server/tool-registry.mjs +55 -0
  76. package/scripts/mcp-server/tools.mjs +137 -1
  77. package/scripts/migrate-rule-format/id-prefix-table.mjs +37 -0
  78. package/scripts/migrate-rule-format/parse-legacy.mjs +180 -0
  79. package/scripts/migrate-rule-format/render-new.mjs +169 -0
  80. package/scripts/migrate-rule-format/roundtrip-validate.mjs +89 -0
  81. package/scripts/migrate-rule-format.mjs +192 -0
  82. package/scripts/release-gate/constants.mjs +1 -1
  83. package/scripts/release-gate/static-checks.mjs +1 -1
  84. package/scripts/rules-guardian-audit.mjs +5 -2
  85. package/scripts/single-source-lazy-loading-audit.mjs +2 -1
  86. package/scripts/ui-design-judge/git-input.mjs +3 -0
  87. package/scripts/validate/config.mjs +27 -2
  88. package/scripts/validate/coverage-checks.mjs +1 -1
  89. package/scripts/validate.mjs +94 -1
@@ -0,0 +1,256 @@
1
+ /**
2
+ * Validators for token system, color truth, viewport adaptation, motion
3
+ * system, component morphology, accessibility policy, and context hygiene
4
+ * sections. These cover the structured systems that drive UI implementation.
5
+ */
6
+
7
+ import { hasNonEmptyString } from './helpers.mjs';
8
+
9
+ function validateTokenLockingPolicy(tokenSystem, validationErrors) {
10
+ const tokenLockingPolicy = tokenSystem.tokenLockingPolicy;
11
+ if (!tokenLockingPolicy || typeof tokenLockingPolicy !== 'object') {
12
+ validationErrors.push('designIntent.tokenSystem.tokenLockingPolicy must exist.');
13
+ return;
14
+ }
15
+ if (tokenLockingPolicy.defaultLockState !== 'semantic-roles-locked-primitives-flexible') {
16
+ validationErrors.push('designIntent.tokenSystem.tokenLockingPolicy.defaultLockState must preserve semantic roles while keeping primitives flexible.');
17
+ }
18
+ if (!Array.isArray(tokenLockingPolicy.flexibleByDefault) || tokenLockingPolicy.flexibleByDefault.length < 4) {
19
+ validationErrors.push('designIntent.tokenSystem.tokenLockingPolicy.flexibleByDefault must list flexible primitive axes.');
20
+ }
21
+ if (!hasNonEmptyString(tokenLockingPolicy.promotionRule)) {
22
+ validationErrors.push('designIntent.tokenSystem.tokenLockingPolicy.promotionRule must be a non-empty string.');
23
+ }
24
+ }
25
+
26
+ function validateTokenFallbackAndNaming(tokenSystem, validationErrors) {
27
+ const fallbackPolicy = tokenSystem.fallbackPolicy;
28
+ if (!fallbackPolicy || typeof fallbackPolicy !== 'object') {
29
+ validationErrors.push('designIntent.tokenSystem.fallbackPolicy must exist.');
30
+ } else {
31
+ if (fallbackPolicy.forbidRawHexOutsidePrimitives !== true) {
32
+ validationErrors.push('designIntent.tokenSystem.fallbackPolicy.forbidRawHexOutsidePrimitives must equal true.');
33
+ }
34
+ if (fallbackPolicy.forbidRawSpacingOutsidePrimitives !== true) {
35
+ validationErrors.push('designIntent.tokenSystem.fallbackPolicy.forbidRawSpacingOutsidePrimitives must equal true.');
36
+ }
37
+ if (fallbackPolicy.requireDocumentedExceptionForLegacyBypass !== true) {
38
+ validationErrors.push('designIntent.tokenSystem.fallbackPolicy.requireDocumentedExceptionForLegacyBypass must equal true.');
39
+ }
40
+ }
41
+
42
+ const namingConstraints = tokenSystem.namingConstraints;
43
+ if (!namingConstraints || typeof namingConstraints !== 'object') {
44
+ validationErrors.push('designIntent.tokenSystem.namingConstraints must exist.');
45
+ return;
46
+ }
47
+ if (namingConstraints.forbidCurlyBracesInNames !== true) {
48
+ validationErrors.push('designIntent.tokenSystem.namingConstraints.forbidCurlyBracesInNames must equal true.');
49
+ }
50
+ if (namingConstraints.forbidDotsInNames !== true) {
51
+ validationErrors.push('designIntent.tokenSystem.namingConstraints.forbidDotsInNames must equal true.');
52
+ }
53
+ if (namingConstraints.forbidSquareBracketsInNames !== true) {
54
+ validationErrors.push('designIntent.tokenSystem.namingConstraints.forbidSquareBracketsInNames must equal true.');
55
+ }
56
+ }
57
+
58
+ export function validateTokenSystem(designIntentContract, validationErrors) {
59
+ if (!designIntentContract.tokenSystem || typeof designIntentContract.tokenSystem !== 'object') {
60
+ validationErrors.push('designIntent.tokenSystem must exist.');
61
+ return validationErrors;
62
+ }
63
+
64
+ const tokenSystem = designIntentContract.tokenSystem;
65
+ const taxonomyOrder = tokenSystem.taxonomyOrder;
66
+ if (!Array.isArray(taxonomyOrder) || taxonomyOrder.join('|') !== 'primitive|semantic|component') {
67
+ validationErrors.push('designIntent.tokenSystem.taxonomyOrder must equal ["primitive","semantic","component"].');
68
+ }
69
+ if (tokenSystem.primitiveColorSpace !== 'OKLCH') {
70
+ validationErrors.push('designIntent.tokenSystem.primitiveColorSpace must equal "OKLCH".');
71
+ }
72
+ if (tokenSystem.requireSemanticAliases !== true) {
73
+ validationErrors.push('designIntent.tokenSystem.requireSemanticAliases must equal true.');
74
+ }
75
+ if (tokenSystem.semanticAliasesMutableWithoutComponentRewrite !== true) {
76
+ validationErrors.push('designIntent.tokenSystem.semanticAliasesMutableWithoutComponentRewrite must equal true.');
77
+ }
78
+ if (tokenSystem.componentTokensConsumeSemantic !== true) {
79
+ validationErrors.push('designIntent.tokenSystem.componentTokensConsumeSemantic must equal true.');
80
+ }
81
+
82
+ validateTokenLockingPolicy(tokenSystem, validationErrors);
83
+ validateTokenFallbackAndNaming(tokenSystem, validationErrors);
84
+ return validationErrors;
85
+ }
86
+
87
+ export function validateColorTruth(designIntentContract, validationErrors) {
88
+ if (!designIntentContract.colorTruth || typeof designIntentContract.colorTruth !== 'object') {
89
+ validationErrors.push('designIntent.colorTruth must exist.');
90
+ return validationErrors;
91
+ }
92
+ const colorTruth = designIntentContract.colorTruth;
93
+ if (colorTruth.format !== 'OKLCH') {
94
+ validationErrors.push('designIntent.colorTruth.format must equal "OKLCH".');
95
+ }
96
+ if (colorTruth.allowHexDerivatives !== true) {
97
+ validationErrors.push('designIntent.colorTruth.allowHexDerivatives must equal true.');
98
+ }
99
+ if (!String(colorTruth.intent || '').trim()) {
100
+ validationErrors.push('designIntent.colorTruth.intent must be a non-empty string.');
101
+ }
102
+ const paletteRoles = colorTruth.paletteRoles;
103
+ if (!Array.isArray(paletteRoles) || paletteRoles.length < 1) {
104
+ validationErrors.push('designIntent.colorTruth.paletteRoles must define or request agent-defined semantic palette roles.');
105
+ }
106
+ if (colorTruth.rolesMustBeAgentDefined !== true) {
107
+ validationErrors.push('designIntent.colorTruth.rolesMustBeAgentDefined must equal true.');
108
+ }
109
+ return validationErrors;
110
+ }
111
+
112
+ export function validateCrossViewportAdaptation(designIntentContract, validationErrors) {
113
+ if (!designIntentContract.crossViewportAdaptation || typeof designIntentContract.crossViewportAdaptation !== 'object') {
114
+ validationErrors.push('designIntent.crossViewportAdaptation must exist.');
115
+ return validationErrors;
116
+ }
117
+ const mutationRules = designIntentContract.crossViewportAdaptation.mutationRules;
118
+ if (!mutationRules || typeof mutationRules !== 'object') {
119
+ validationErrors.push('designIntent.crossViewportAdaptation.mutationRules must exist.');
120
+ return validationErrors;
121
+ }
122
+ for (const viewportKey of ['mobile', 'tablet', 'desktop']) {
123
+ if (!String(mutationRules[viewportKey] || '').trim()) {
124
+ validationErrors.push(`designIntent.crossViewportAdaptation.mutationRules.${viewportKey} must be a non-empty string.`);
125
+ }
126
+ }
127
+ return validationErrors;
128
+ }
129
+
130
+ export function validateMotionSystem(designIntentContract, validationErrors) {
131
+ if (!designIntentContract.motionSystem || typeof designIntentContract.motionSystem !== 'object') {
132
+ validationErrors.push('designIntent.motionSystem must exist.');
133
+ return validationErrors;
134
+ }
135
+ if (designIntentContract.motionSystem.allowMeaningfulMotion !== true) {
136
+ validationErrors.push('designIntent.motionSystem.allowMeaningfulMotion must equal true.');
137
+ }
138
+ if (!String(designIntentContract.motionSystem.purpose || '').trim()) {
139
+ validationErrors.push('designIntent.motionSystem.purpose must be a non-empty string.');
140
+ }
141
+ if (designIntentContract.motionSystem.respectReducedMotion !== true) {
142
+ validationErrors.push('designIntent.motionSystem.respectReducedMotion must equal true.');
143
+ }
144
+ return validationErrors;
145
+ }
146
+
147
+ export function validateComponentMorphology(designIntentContract, validationErrors) {
148
+ if (!designIntentContract.componentMorphology || typeof designIntentContract.componentMorphology !== 'object') {
149
+ validationErrors.push('designIntent.componentMorphology must exist.');
150
+ return validationErrors;
151
+ }
152
+ const componentMorphology = designIntentContract.componentMorphology;
153
+ if (componentMorphology.requireStateBehaviorMatrix !== true) {
154
+ validationErrors.push('designIntent.componentMorphology.requireStateBehaviorMatrix must equal true.');
155
+ }
156
+ if (!Array.isArray(componentMorphology.stateKeys) || componentMorphology.stateKeys.length < 4) {
157
+ validationErrors.push('designIntent.componentMorphology.stateKeys must contain multiple interaction states.');
158
+ }
159
+ const viewportBehavior = componentMorphology.viewportBehavior;
160
+ if (!viewportBehavior || typeof viewportBehavior !== 'object') {
161
+ validationErrors.push('designIntent.componentMorphology.viewportBehavior must exist.');
162
+ return validationErrors;
163
+ }
164
+ for (const viewportKey of ['mobile', 'tablet', 'desktop']) {
165
+ if (!String(viewportBehavior[viewportKey] || '').trim()) {
166
+ validationErrors.push(`designIntent.componentMorphology.viewportBehavior.${viewportKey} must be a non-empty string.`);
167
+ }
168
+ }
169
+ return validationErrors;
170
+ }
171
+
172
+ export function validateAccessibilityPolicy(designIntentContract, validationErrors) {
173
+ if (!designIntentContract.accessibilityPolicy || typeof designIntentContract.accessibilityPolicy !== 'object') {
174
+ validationErrors.push('designIntent.accessibilityPolicy must exist.');
175
+ return validationErrors;
176
+ }
177
+ const accessibilityPolicy = designIntentContract.accessibilityPolicy;
178
+ if (accessibilityPolicy.hardComplianceFloor !== 'WCAG-2.2-AA') {
179
+ validationErrors.push('designIntent.accessibilityPolicy.hardComplianceFloor must equal "WCAG-2.2-AA".');
180
+ }
181
+ if (accessibilityPolicy.advisoryContrastModel !== 'APCA') {
182
+ validationErrors.push('designIntent.accessibilityPolicy.advisoryContrastModel must equal "APCA".');
183
+ }
184
+ if (accessibilityPolicy.failOnHardViolations !== true) {
185
+ validationErrors.push('designIntent.accessibilityPolicy.failOnHardViolations must equal true.');
186
+ }
187
+ if (accessibilityPolicy.advisoryFindingsDoNotBlockByDefault !== true) {
188
+ validationErrors.push('designIntent.accessibilityPolicy.advisoryFindingsDoNotBlockByDefault must equal true.');
189
+ }
190
+ const hardRequirements = accessibilityPolicy.hardRequirements;
191
+ if (!hardRequirements || typeof hardRequirements !== 'object') {
192
+ validationErrors.push('designIntent.accessibilityPolicy.hardRequirements must exist.');
193
+ } else {
194
+ for (const requirementKey of [
195
+ 'textContrastMinimum',
196
+ 'nonTextContrast',
197
+ 'useOfColorOnlyProhibited',
198
+ 'focusVisible',
199
+ 'focusAppearance',
200
+ 'targetSizeMinimum',
201
+ 'keyboardAccess',
202
+ 'reflowRequired',
203
+ 'accessibleAuthenticationMinimum',
204
+ 'statusMessagesAndDynamicStateAccess',
205
+ ]) {
206
+ if (hardRequirements[requirementKey] !== true) {
207
+ validationErrors.push(`designIntent.accessibilityPolicy.hardRequirements.${requirementKey} must equal true.`);
208
+ }
209
+ }
210
+ }
211
+ const advisoryChecks = accessibilityPolicy.advisoryChecks;
212
+ if (!advisoryChecks || typeof advisoryChecks !== 'object') {
213
+ validationErrors.push('designIntent.accessibilityPolicy.advisoryChecks must exist.');
214
+ return validationErrors;
215
+ }
216
+ for (const advisoryKey of [
217
+ 'perceptualContrastReview',
218
+ 'darkModeContrastTuning',
219
+ 'typographyReadabilityTuning',
220
+ ]) {
221
+ if (advisoryChecks[advisoryKey] !== true) {
222
+ validationErrors.push(`designIntent.accessibilityPolicy.advisoryChecks.${advisoryKey} must equal true.`);
223
+ }
224
+ }
225
+ return validationErrors;
226
+ }
227
+
228
+ export function validateContextHygiene(designIntentContract, validationErrors) {
229
+ if (!designIntentContract.contextHygiene || typeof designIntentContract.contextHygiene !== 'object') {
230
+ validationErrors.push('designIntent.contextHygiene must exist.');
231
+ return validationErrors;
232
+ }
233
+ const contextHygiene = designIntentContract.contextHygiene;
234
+ if (contextHygiene.continuityMode !== 'opt-in-only') {
235
+ validationErrors.push('designIntent.contextHygiene.continuityMode must equal "opt-in-only".');
236
+ }
237
+ if (contextHygiene.repoEvidenceOverridesMemory !== true) {
238
+ validationErrors.push('designIntent.contextHygiene.repoEvidenceOverridesMemory must equal true.');
239
+ }
240
+ if (contextHygiene.requireExplicitContinuityApproval !== true) {
241
+ validationErrors.push('designIntent.contextHygiene.requireExplicitContinuityApproval must equal true.');
242
+ }
243
+ if (contextHygiene.forbidCarryoverWhenUnapproved !== true) {
244
+ validationErrors.push('designIntent.contextHygiene.forbidCarryoverWhenUnapproved must equal true.');
245
+ }
246
+ if (!Array.isArray(contextHygiene.allowedSources) || contextHygiene.allowedSources.length < 4) {
247
+ validationErrors.push('designIntent.contextHygiene.allowedSources must list the approved design evidence sources.');
248
+ }
249
+ if (!Array.isArray(contextHygiene.taintedSources) || contextHygiene.taintedSources.length < 3) {
250
+ validationErrors.push('designIntent.contextHygiene.taintedSources must list tainted carryover sources.');
251
+ }
252
+ if (!String(contextHygiene.approvedExternalConstraintUsage || '').trim()) {
253
+ validationErrors.push('designIntent.contextHygiene.approvedExternalConstraintUsage must be a non-empty string.');
254
+ }
255
+ return validationErrors;
256
+ }