@ryuenn3123/agentic-senior-core 4.4.0 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/.agents/plugins/agentic-senior-core/plugin.json +3 -0
  2. package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +131 -0
  3. package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +16 -0
  4. package/.agents/plugins/agentic-senior-core/skills/asc-audit/SKILL.md +28 -0
  5. package/.agents/plugins/agentic-senior-core/skills/asc-refactor/SKILL.md +35 -0
  6. package/.agents/plugins/agentic-senior-core/skills/asc-review/SKILL.md +54 -0
  7. package/.agents/rules/agentic-senior-core.md +131 -0
  8. package/.claude-plugin/marketplace.json +17 -0
  9. package/.claude-plugin/plugin.json +17 -0
  10. package/.clinerules/agentic-senior-core.md +94 -0
  11. package/.codex-plugin/plugin.json +24 -0
  12. package/.cursor/rules/agentic-senior-core.mdc +99 -0
  13. package/.devin-plugin/plugin.json +13 -0
  14. package/.github/copilot-instructions.md +94 -0
  15. package/.github/plugin/marketplace.json +20 -0
  16. package/.github/plugin/plugin.json +16 -0
  17. package/.kiro/steering/agentic-senior-core.md +94 -0
  18. package/.openclaw/skills/asc/SKILL.md +23 -0
  19. package/.openclaw/skills/asc-audit/SKILL.md +28 -0
  20. package/.openclaw/skills/asc-review/SKILL.md +54 -0
  21. package/.opencode/plugins/agentic-senior-core.mjs +31 -0
  22. package/.windsurf/rules/agentic-senior-core.md +94 -0
  23. package/AGENTS.md +126 -127
  24. package/CONTRIBUTING.md +93 -63
  25. package/README.md +190 -110
  26. package/__init__.py +61 -0
  27. package/bin/agentic-senior-core.js +42 -41
  28. package/commands/asc-audit.md +1 -0
  29. package/commands/asc-audit.toml +2 -0
  30. package/commands/asc-help.md +9 -0
  31. package/commands/asc-help.toml +2 -0
  32. package/commands/asc-refactor.md +1 -0
  33. package/commands/asc-refactor.toml +2 -0
  34. package/commands/asc-review.md +1 -0
  35. package/commands/asc-review.toml +2 -0
  36. package/gemini-extension.json +10 -0
  37. package/hooks/copilot-hooks.json +21 -0
  38. package/hooks/hooks.json +31 -0
  39. package/hooks/session-start.js +36 -0
  40. package/hooks/subagent-start.js +38 -0
  41. package/lib/cli/commands/adapter.mjs +109 -0
  42. package/lib/cli/commands/clean.mjs +63 -0
  43. package/lib/cli/commands/status.mjs +94 -0
  44. package/package.json +43 -60
  45. package/plugin.yaml +16 -0
  46. package/scripts/uninstall.js +38 -0
  47. package/skills/asc/SKILL.md +16 -0
  48. package/skills/asc-audit/SKILL.md +28 -0
  49. package/skills/asc-refactor/SKILL.md +35 -0
  50. package/skills/asc-review/SKILL.md +54 -0
  51. package/.agent-context/policies/llm-judge-threshold.json +0 -29
  52. package/.agent-context/prompts/bootstrap-design.md +0 -63
  53. package/.agent-context/prompts/compact-natural-mode.md +0 -100
  54. package/.agent-context/prompts/init-project.md +0 -60
  55. package/.agent-context/prompts/refactor.md +0 -38
  56. package/.agent-context/prompts/review-code.md +0 -31
  57. package/.agent-context/review-checklists/architecture-review.md +0 -57
  58. package/.agent-context/review-checklists/pr-checklist.md +0 -134
  59. package/.agent-context/rules/api-docs.md +0 -24
  60. package/.agent-context/rules/api-versioning.md +0 -16
  61. package/.agent-context/rules/architecture.md +0 -38
  62. package/.agent-context/rules/background-jobs.md +0 -17
  63. package/.agent-context/rules/config-and-flags.md +0 -16
  64. package/.agent-context/rules/database-design.md +0 -18
  65. package/.agent-context/rules/docker-runtime.md +0 -17
  66. package/.agent-context/rules/error-handling.md +0 -16
  67. package/.agent-context/rules/event-driven.md +0 -16
  68. package/.agent-context/rules/frontend-architecture.md +0 -54
  69. package/.agent-context/rules/microservices.md +0 -16
  70. package/.agent-context/rules/migrations.md +0 -16
  71. package/.agent-context/rules/observability.md +0 -16
  72. package/.agent-context/rules/performance.md +0 -16
  73. package/.agent-context/rules/realtime.md +0 -16
  74. package/.agent-context/rules/resilience.md +0 -18
  75. package/.agent-context/rules/security.md +0 -18
  76. package/.agent-context/rules/testing.md +0 -16
  77. package/.agent-context/state/README.md +0 -25
  78. package/.agent-context/state/architecture-map.md +0 -40
  79. package/.agent-context/state/benchmark-comparison-schema.json +0 -181
  80. package/.agent-context/state/benchmark-reproducibility.json +0 -87
  81. package/.agent-context/state/benchmark-thresholds.json +0 -10
  82. package/.agent-context/state/benchmark-writer-judge-config.json +0 -58
  83. package/.agent-context/state/dependency-map.md +0 -41
  84. package/.agent-context/state/memory-adapter-contract.json +0 -52
  85. package/.agent-context/state/memory-schema-v1.json +0 -88
  86. package/GEMINI.md +0 -1
  87. package/benchmarks/README.md +0 -60
  88. package/benchmarks/compact-natural-mode/fixtures.mjs +0 -359
  89. package/benchmarks/compact-natural-mode/scorer.mjs +0 -331
  90. package/benchmarks/runtime-token-saver/fixtures.mjs +0 -836
  91. package/lib/cli/adaptive-context/catalog.mjs +0 -394
  92. package/lib/cli/adaptive-context/file-signals.mjs +0 -100
  93. package/lib/cli/adaptive-context/implications.mjs +0 -44
  94. package/lib/cli/adaptive-context.mjs +0 -151
  95. package/lib/cli/audits/typography-palette-anti-repeat/color-utils.mjs +0 -156
  96. package/lib/cli/audits/typography-palette-anti-repeat/file-scanner.mjs +0 -103
  97. package/lib/cli/audits/typography-palette-anti-repeat/typography-utils.mjs +0 -70
  98. package/lib/cli/backup.mjs +0 -210
  99. package/lib/cli/commands/context.mjs +0 -140
  100. package/lib/cli/commands/init/project-context.mjs +0 -60
  101. package/lib/cli/commands/init/runtime-environment.mjs +0 -59
  102. package/lib/cli/commands/init/setup-decisions.mjs +0 -83
  103. package/lib/cli/commands/init.mjs +0 -654
  104. package/lib/cli/commands/launch.mjs +0 -76
  105. package/lib/cli/commands/optimize.mjs +0 -284
  106. package/lib/cli/commands/rollback.mjs +0 -64
  107. package/lib/cli/commands/upgrade/token-optimization-state.mjs +0 -51
  108. package/lib/cli/commands/upgrade.mjs +0 -451
  109. package/lib/cli/compiler.mjs +0 -187
  110. package/lib/cli/constants.mjs +0 -136
  111. package/lib/cli/detector/constants.mjs +0 -135
  112. package/lib/cli/detector/design-evidence/collector.mjs +0 -256
  113. package/lib/cli/detector/design-evidence/constants.mjs +0 -39
  114. package/lib/cli/detector/design-evidence/file-traversal.mjs +0 -83
  115. package/lib/cli/detector/design-evidence/structured-attribute-evidence.mjs +0 -117
  116. package/lib/cli/detector/design-evidence/summary.mjs +0 -109
  117. package/lib/cli/detector/design-evidence/utility-helpers.mjs +0 -122
  118. package/lib/cli/detector/design-evidence.mjs +0 -25
  119. package/lib/cli/detector/stack-detection.mjs +0 -243
  120. package/lib/cli/detector/ui-signals.mjs +0 -150
  121. package/lib/cli/detector/workspace-scan.mjs +0 -177
  122. package/lib/cli/detector.mjs +0 -23
  123. package/lib/cli/init-detection-flow.mjs +0 -48
  124. package/lib/cli/init-options.mjs +0 -237
  125. package/lib/cli/init-selection.mjs +0 -29
  126. package/lib/cli/memory-continuity.mjs +0 -537
  127. package/lib/cli/preflight.mjs +0 -76
  128. package/lib/cli/project-scaffolder/constants.mjs +0 -69
  129. package/lib/cli/project-scaffolder/discovery.mjs +0 -272
  130. package/lib/cli/project-scaffolder/prompt-builders.mjs +0 -171
  131. package/lib/cli/project-scaffolder/storage.mjs +0 -144
  132. package/lib/cli/project-scaffolder/ui-scope-detection.mjs +0 -36
  133. package/lib/cli/project-scaffolder.mjs +0 -29
  134. package/lib/cli/rollback.mjs +0 -66
  135. package/lib/cli/token-optimization.mjs +0 -401
  136. package/lib/cli/utils/filesystem.mjs +0 -81
  137. package/lib/cli/utils/managed-surface.mjs +0 -280
  138. package/lib/cli/utils/prompting.mjs +0 -44
  139. package/lib/cli/utils.mjs +0 -479
  140. package/mcp.json +0 -134
  141. package/scripts/adaptive-context/fixtures.mjs +0 -183
  142. package/scripts/adaptive-context-benchmark.mjs +0 -9
  143. package/scripts/ascx-runtime-token-saver-benchmark.mjs +0 -9
  144. package/scripts/benchmark-evidence-bundle.mjs +0 -645
  145. package/scripts/benchmark-gate.mjs +0 -121
  146. package/scripts/benchmark-intelligence.mjs +0 -33
  147. package/scripts/benchmark-writer-judge-matrix.mjs +0 -379
  148. package/scripts/build-release-benchmark-bundle.mjs +0 -202
  149. package/scripts/bump-version.mjs +0 -103
  150. package/scripts/clean-local-artifacts.mjs +0 -78
  151. package/scripts/compact-natural-mode-benchmark.mjs +0 -9
  152. package/scripts/context-triggered-audit.mjs +0 -391
  153. package/scripts/detection-benchmark.mjs +0 -127
  154. package/scripts/docs-quality-drift-report.mjs +0 -358
  155. package/scripts/documentation-boundary-audit.mjs +0 -305
  156. package/scripts/explain-on-demand-audit.mjs +0 -427
  157. package/scripts/forbidden-content-check.mjs +0 -123
  158. package/scripts/frontend-usability-audit.mjs +0 -243
  159. package/scripts/generate-sbom.mjs +0 -61
  160. package/scripts/governance-weekly-report.mjs +0 -466
  161. package/scripts/llm-judge/checklist-loader.mjs +0 -45
  162. package/scripts/llm-judge/constants.mjs +0 -66
  163. package/scripts/llm-judge/diff-collection.mjs +0 -74
  164. package/scripts/llm-judge/prompting.mjs +0 -78
  165. package/scripts/llm-judge/providers.mjs +0 -111
  166. package/scripts/llm-judge/verdict.mjs +0 -134
  167. package/scripts/llm-judge.mjs +0 -200
  168. package/scripts/memory-continuity-benchmark.mjs +0 -322
  169. package/scripts/quality-trend-report.mjs +0 -289
  170. package/scripts/release-gate/audit-checks.mjs +0 -441
  171. package/scripts/release-gate/constants.mjs +0 -53
  172. package/scripts/release-gate/runtime.mjs +0 -63
  173. package/scripts/release-gate/static-checks.mjs +0 -182
  174. package/scripts/release-gate.mjs +0 -42
  175. package/scripts/rules-guardian-audit.mjs +0 -580
  176. package/scripts/single-source-lazy-loading-audit.mjs +0 -449
  177. package/scripts/sync-thin-adapters.mjs +0 -72
  178. package/scripts/token-optimization-benchmark.mjs +0 -252
  179. package/scripts/ui-design-judge/constants.mjs +0 -13
  180. package/scripts/ui-design-judge/design-execution-summary.mjs +0 -81
  181. package/scripts/ui-design-judge/git-input.mjs +0 -134
  182. package/scripts/ui-design-judge/prompting.mjs +0 -52
  183. package/scripts/ui-design-judge/providers.mjs +0 -102
  184. package/scripts/ui-design-judge/reporting.mjs +0 -183
  185. package/scripts/ui-design-judge/rubric-calibration.mjs +0 -214
  186. package/scripts/ui-design-judge/rubric-goldset.json +0 -188
  187. package/scripts/ui-design-judge.mjs +0 -319
  188. package/scripts/ui-rubric-calibration.mjs +0 -35
  189. package/scripts/validate/audits/cache-layer-contract.mjs +0 -230
  190. package/scripts/validate/audits/caching-scope-hygiene.mjs +0 -235
  191. package/scripts/validate/audits/file-size.mjs +0 -158
  192. package/scripts/validate/audits/reflection-citations.mjs +0 -130
  193. package/scripts/validate/audits/release-bundle.mjs +0 -135
  194. package/scripts/validate/audits/rule-id-uniqueness.mjs +0 -278
  195. package/scripts/validate/config.mjs +0 -501
  196. package/scripts/validate/coverage-checks.mjs +0 -446
  197. package/scripts/validate/file-structure.mjs +0 -158
  198. package/scripts/validate/markdown-content.mjs +0 -109
  199. package/scripts/validate/project-metadata.mjs +0 -166
  200. package/scripts/validate/utils.mjs +0 -52
  201. package/scripts/validate.mjs +0 -267
@@ -1,117 +0,0 @@
1
- /**
2
- * Structured attribute-aware inspection: counts class attributes, bound class
3
- * expressions, JSX/Vue inline styles, and Tailwind utility families seen in the
4
- * source. These metrics complement the raw regex pass with a structurally
5
- * aware view that better matches modern frontend authorship patterns.
6
- */
7
-
8
- import {
9
- COLOR_PATTERN,
10
- CSS_VARIABLE_REFERENCE_PATTERN,
11
- EXPRESSION_CLASS_ATTRIBUTE_PATTERN,
12
- JSX_INLINE_STYLE_PATTERN,
13
- RAW_RADIUS_PATTERN,
14
- RAW_SHADOW_PATTERN,
15
- RAW_SPACING_PATTERN,
16
- STRING_CLASS_ATTRIBUTE_PATTERN,
17
- VUE_INLINE_STYLE_PATTERN,
18
- } from './constants.mjs';
19
- import {
20
- countPatternMatches,
21
- getFirstDefinedCapture,
22
- incrementCountMap,
23
- inferUtilityFamily,
24
- normalizeEvidenceSample,
25
- pushSampleValue,
26
- } from './utility-helpers.mjs';
27
-
28
- function collectTailwindUtilityFamilies(classValue, utilityFamilyCounts, utilityFamilySamples, utilityFamilySampleSet) {
29
- for (const utilityToken of String(classValue || '').split(/\s+/g)) {
30
- const utilityFamily = inferUtilityFamily(utilityToken);
31
- if (!utilityFamily) {
32
- continue;
33
- }
34
-
35
- incrementCountMap(utilityFamilyCounts, utilityFamily);
36
- pushSampleValue(utilityFamilySamples, utilityFamily, utilityFamilySampleSet);
37
- }
38
- }
39
-
40
- function applyInlineStyleInspection(styleSourceText, summary, styleSampleSet) {
41
- const normalizedStyleSource = normalizeEvidenceSample(styleSourceText);
42
- pushSampleValue(summary.structuredInspection.inlineStyleSamples, normalizedStyleSource, styleSampleSet);
43
-
44
- const hardcodedColorCount = countPatternMatches(styleSourceText, COLOR_PATTERN);
45
- const rawSpacingCount = countPatternMatches(styleSourceText, RAW_SPACING_PATTERN);
46
- const rawRadiusCount = countPatternMatches(styleSourceText, RAW_RADIUS_PATTERN);
47
- const rawShadowCount = countPatternMatches(styleSourceText, RAW_SHADOW_PATTERN);
48
- const cssVariableReferenceCount = countPatternMatches(styleSourceText, CSS_VARIABLE_REFERENCE_PATTERN);
49
-
50
- summary.structuredInspection.inlineTokenBypassSignals.hardcodedColorCount += hardcodedColorCount;
51
- summary.structuredInspection.inlineTokenBypassSignals.rawSpacingCount += rawSpacingCount;
52
- summary.structuredInspection.inlineTokenBypassSignals.rawRadiusCount += rawRadiusCount;
53
- summary.structuredInspection.inlineTokenBypassSignals.rawShadowCount += rawShadowCount;
54
- summary.structuredInspection.inlineTokenBypassSignals.cssVariableReferenceCount += cssVariableReferenceCount;
55
- }
56
-
57
- export function collectStructuredAttributeEvidence(
58
- sourceText,
59
- summary,
60
- classSampleSet,
61
- styleSampleSet,
62
- utilityFamilySampleSet,
63
- ) {
64
- for (const classAttributeMatch of sourceText.matchAll(STRING_CLASS_ATTRIBUTE_PATTERN)) {
65
- const classValue = getFirstDefinedCapture(classAttributeMatch.slice(1));
66
- if (!classValue) {
67
- continue;
68
- }
69
-
70
- summary.structuredInspection.classAttributeCount += 1;
71
- pushSampleValue(
72
- summary.structuredInspection.classAttributeSamples,
73
- normalizeEvidenceSample(classValue),
74
- classSampleSet,
75
- );
76
- collectTailwindUtilityFamilies(
77
- classValue,
78
- summary.structuredInspection.utilityFamilyCounts,
79
- summary.structuredInspection.utilityFamilySamples,
80
- utilityFamilySampleSet,
81
- );
82
- }
83
-
84
- for (const expressionClassAttributeMatch of sourceText.matchAll(EXPRESSION_CLASS_ATTRIBUTE_PATTERN)) {
85
- const expressionValue = getFirstDefinedCapture(expressionClassAttributeMatch.slice(1));
86
- if (!expressionValue) {
87
- continue;
88
- }
89
-
90
- summary.structuredInspection.boundClassExpressionCount += 1;
91
- pushSampleValue(
92
- summary.structuredInspection.classAttributeSamples,
93
- normalizeEvidenceSample(expressionValue),
94
- classSampleSet,
95
- );
96
- }
97
-
98
- for (const inlineStyleMatch of sourceText.matchAll(JSX_INLINE_STYLE_PATTERN)) {
99
- const inlineStyleSource = getFirstDefinedCapture(inlineStyleMatch.slice(1));
100
- if (!inlineStyleSource) {
101
- continue;
102
- }
103
-
104
- summary.structuredInspection.inlineStyleObjectCount += 1;
105
- applyInlineStyleInspection(inlineStyleSource, summary, styleSampleSet);
106
- }
107
-
108
- for (const vueInlineStyleMatch of sourceText.matchAll(VUE_INLINE_STYLE_PATTERN)) {
109
- const inlineStyleSource = getFirstDefinedCapture(vueInlineStyleMatch.slice(1));
110
- if (!inlineStyleSource) {
111
- continue;
112
- }
113
-
114
- summary.structuredInspection.inlineStyleBindingCount += 1;
115
- applyInlineStyleInspection(inlineStyleSource, summary, styleSampleSet);
116
- }
117
- }
@@ -1,109 +0,0 @@
1
- /**
2
- * Default-shaped design evidence summary. Constructed once per scan and then
3
- * mutated in place by the collector and inspection passes. Keeping the default
4
- * shape in one place makes downstream consumers diff-stable when adding new
5
- * counters: add the field here once, and every scan starts with it.
6
- */
7
-
8
- export function createDesignEvidenceSummary(scanRootRelativePaths) {
9
- return {
10
- summaryVersion: 'v1',
11
- source: 'lightweight-static-scan',
12
- scanRootRelativePaths,
13
- scannedFileCount: 0,
14
- cssVariables: {
15
- definitionCount: 0,
16
- referenceCount: 0,
17
- sampleNames: [],
18
- categoryCounts: {
19
- color: 0,
20
- spacing: 0,
21
- radius: 0,
22
- shadow: 0,
23
- typography: 0,
24
- motion: 0,
25
- other: 0,
26
- },
27
- },
28
- colors: {
29
- hardcodedCount: 0,
30
- kindCounts: {
31
- hex: 0,
32
- rgb: 0,
33
- hsl: 0,
34
- oklch: 0,
35
- other: 0,
36
- },
37
- sampleValues: [],
38
- },
39
- spacing: {
40
- rawValueCount: 0,
41
- sampleValues: [],
42
- },
43
- radius: {
44
- rawValueCount: 0,
45
- sampleValues: [],
46
- },
47
- shadow: {
48
- rawValueCount: 0,
49
- sampleValues: [],
50
- },
51
- typography: {
52
- fontFamilyCount: 0,
53
- fontSizeCount: 0,
54
- lineHeightCount: 0,
55
- letterSpacingCount: 0,
56
- fontFamilySamples: [],
57
- fontSizeSamples: [],
58
- lineHeightSamples: [],
59
- letterSpacingSamples: [],
60
- },
61
- motion: {
62
- transitionCount: 0,
63
- animationCount: 0,
64
- durationCount: 0,
65
- durationSamples: [],
66
- },
67
- tailwind: {
68
- breakpointUsageCount: 0,
69
- arbitraryBreakpointCount: 0,
70
- utilityFamilyCounts: {},
71
- utilityFamilySamples: [],
72
- },
73
- componentInventory: {
74
- componentFileCount: 0,
75
- pageFileCount: 0,
76
- layoutFileCount: 0,
77
- surfaceFileSamples: [],
78
- },
79
- structuredInspection: {
80
- mode: 'attribute-aware-static-scan',
81
- classAttributeCount: 0,
82
- boundClassExpressionCount: 0,
83
- inlineStyleObjectCount: 0,
84
- inlineStyleBindingCount: 0,
85
- classAttributeSamples: [],
86
- inlineStyleSamples: [],
87
- utilityFamilyCounts: {},
88
- utilityFamilySamples: [],
89
- inlineTokenBypassSignals: {
90
- hardcodedColorCount: 0,
91
- rawSpacingCount: 0,
92
- rawRadiusCount: 0,
93
- rawShadowCount: 0,
94
- cssVariableReferenceCount: 0,
95
- },
96
- },
97
- tokenBypassSignals: {
98
- hardcodedColorCount: 0,
99
- rawSpacingCount: 0,
100
- rawRadiusCount: 0,
101
- rawShadowCount: 0,
102
- inlineHardcodedColorCount: 0,
103
- inlineRawSpacingCount: 0,
104
- inlineRawRadiusCount: 0,
105
- inlineRawShadowCount: 0,
106
- inlineCssVariableReferenceCount: 0,
107
- },
108
- };
109
- }
@@ -1,122 +0,0 @@
1
- /**
2
- * Small pure helpers shared across the static design evidence scan modules.
3
- * Kept side-effect free so each can be tested in isolation.
4
- */
5
-
6
- import { DESIGN_EVIDENCE_SAMPLE_LIMIT } from './constants.mjs';
7
-
8
- export function countPatternMatches(sourceText, pattern) {
9
- return Array.from(sourceText.matchAll(pattern)).length;
10
- }
11
-
12
- export function pushSampleValue(targetSamples, value, targetSet) {
13
- const normalizedValue = String(value || '').trim();
14
- if (!normalizedValue || targetSet.has(normalizedValue)) {
15
- return;
16
- }
17
-
18
- targetSet.add(normalizedValue);
19
- if (targetSamples.length < DESIGN_EVIDENCE_SAMPLE_LIMIT) {
20
- targetSamples.push(normalizedValue);
21
- }
22
- }
23
-
24
- export function incrementCountMap(countMap, key) {
25
- countMap[key] = (countMap[key] || 0) + 1;
26
- }
27
-
28
- export function getFirstDefinedCapture(matchGroups) {
29
- for (const capturedValue of matchGroups) {
30
- if (typeof capturedValue === 'string' && capturedValue.trim().length > 0) {
31
- return capturedValue;
32
- }
33
- }
34
-
35
- return '';
36
- }
37
-
38
- export function normalizeEvidenceSample(rawValue) {
39
- return String(rawValue || '').replace(/\s+/g, ' ').trim();
40
- }
41
-
42
- export function categorizeCssVariable(variableName) {
43
- const normalizedVariableName = String(variableName || '').trim().toLowerCase();
44
-
45
- if (/(color|surface|accent|bg|text|border|fill|stroke|ink|tone)/.test(normalizedVariableName)) {
46
- return 'color';
47
- }
48
-
49
- if (/(space|gap|padding|margin|size|width|height|inset)/.test(normalizedVariableName)) {
50
- return 'spacing';
51
- }
52
-
53
- if (/(radius|rounded|corner)/.test(normalizedVariableName)) {
54
- return 'radius';
55
- }
56
-
57
- if (/(shadow|elevation)/.test(normalizedVariableName)) {
58
- return 'shadow';
59
- }
60
-
61
- if (/(font|type|line|letter|tracking|leading)/.test(normalizedVariableName)) {
62
- return 'typography';
63
- }
64
-
65
- if (/(motion|duration|easing|ease|animation|transition)/.test(normalizedVariableName)) {
66
- return 'motion';
67
- }
68
-
69
- return 'other';
70
- }
71
-
72
- export function inferColorKind(colorValue) {
73
- if (/^#/i.test(colorValue)) {
74
- return 'hex';
75
- }
76
-
77
- if (/^rgba?\(/i.test(colorValue)) {
78
- return 'rgb';
79
- }
80
-
81
- if (/^hsla?\(/i.test(colorValue)) {
82
- return 'hsl';
83
- }
84
-
85
- if (/^oklch\(/i.test(colorValue)) {
86
- return 'oklch';
87
- }
88
-
89
- return 'other';
90
- }
91
-
92
- export function inferUtilityFamily(rawUtilityToken) {
93
- const normalizedUtilityToken = String(rawUtilityToken || '')
94
- .trim()
95
- .split(':')
96
- .pop()
97
- ?.replace(/^!/, '')
98
- ?.replace(/\/.+$/, '')
99
- ?.trim();
100
-
101
- if (!normalizedUtilityToken) {
102
- return '';
103
- }
104
-
105
- if (/^grid(?:-|$)/.test(normalizedUtilityToken)) {
106
- return 'grid';
107
- }
108
-
109
- if (/^flex(?:-|$)/.test(normalizedUtilityToken)) {
110
- return 'flex';
111
- }
112
-
113
- if (/^(?:block|inline|hidden|contents)$/.test(normalizedUtilityToken)) {
114
- return normalizedUtilityToken;
115
- }
116
-
117
- if (/^(?:min|max)-\[/.test(normalizedUtilityToken)) {
118
- return 'arbitrary-breakpoint';
119
- }
120
-
121
- return normalizedUtilityToken.split('-')[0];
122
- }
@@ -1,25 +0,0 @@
1
- /**
2
- * Aggregator re-export for the design evidence scan. Implementation lives in
3
- * lib/cli/detector/design-evidence/* split per concern. Importers continue to
4
- * import the same public surface (collectFrontendDesignEvidence and
5
- * FRONTEND_SCAN_IGNORE_DIRECTORY_NAMES) from this module.
6
- *
7
- * Public schema produced by collectFrontendDesignEvidence (kept here so static
8
- * tooling can confirm the expected shape without crawling sub-files):
9
- *
10
- * designEvidenceSummary.summaryVersion: 'v1'
11
- * designEvidenceSummary.source: 'lightweight-static-scan'
12
- * designEvidenceSummary.cssVariables.{ definitionCount, referenceCount, sampleNames, categoryCounts }
13
- * designEvidenceSummary.componentInventory.{ componentFileCount, pageFileCount, layoutFileCount, surfaceFileSamples }
14
- * designEvidenceSummary.structuredInspection.{ classAttributeCount, inlineStyleObjectCount, ... }
15
- * designEvidenceSummary.tokenBypassSignals.{ hardcodedColorCount, rawSpacingCount, rawRadiusCount, rawShadowCount, ... }
16
- * designEvidenceSummary.tailwind.{ breakpointUsageCount, arbitraryBreakpointCount, utilityFamilyCounts, ... }
17
- *
18
- * frontendEvidenceMetrics.{ scannedFileCount, hardcodedColorCount, propDrillingCandidateCount,
19
- * mediaQueryCount, tailwindBreakpointUsageCount, arbitraryBreakpointCount,
20
- * uniqueMediaWidthCount, structuredClassAttributeCount, boundClassExpressionCount,
21
- * inlineStyleObjectCount, inlineStyleBindingCount, inlineStyleTokenBypassCount }
22
- */
23
-
24
- export { FRONTEND_SCAN_IGNORE_DIRECTORY_NAMES } from './design-evidence/constants.mjs';
25
- export { collectFrontendDesignEvidence } from './design-evidence/collector.mjs';
@@ -1,243 +0,0 @@
1
- /**
2
- * Stack detection: scores known marker sets per language ecosystem, ranks them,
3
- * and emits an explanation of what was chosen and why. Used by the CLI to seed
4
- * detection summaries and ranked candidate lists.
5
- */
6
-
7
- import { toTitleCase } from '../utils.mjs';
8
- import { collectNestedWorkspaceProjects, collectProjectMarkers } from './workspace-scan.mjs';
9
-
10
- export function collectStackDetectionCandidates(markerNames, evidencePrefix = null) {
11
- const detectionCandidates = [];
12
- const withEvidencePrefix = (evidenceItem) => evidencePrefix ? `${evidencePrefix}: ${evidenceItem}` : evidenceItem;
13
-
14
- if (
15
- markerNames.has('package.json')
16
- || markerNames.has('tsconfig.json')
17
- || markerNames.has('next.config.js')
18
- || markerNames.has('next.config.mjs')
19
- || markerNames.has('vite.config.js')
20
- || markerNames.has('vite.config.mjs')
21
- || markerNames.has('vite.config.ts')
22
- ) {
23
- const evidence = [];
24
- let confidenceScore = 0.7;
25
-
26
- if (markerNames.has('package.json')) {
27
- evidence.push(withEvidencePrefix('package.json'));
28
- confidenceScore += 0.12;
29
- }
30
-
31
- if (markerNames.has('tsconfig.json')) {
32
- evidence.push(withEvidencePrefix('tsconfig.json'));
33
- confidenceScore += 0.12;
34
- }
35
-
36
- if (markerNames.has('next.config.js') || markerNames.has('next.config.mjs')) {
37
- evidence.push(withEvidencePrefix('Next.js config'));
38
- confidenceScore += 0.05;
39
- }
40
-
41
- if (markerNames.has('vite.config.js') || markerNames.has('vite.config.mjs') || markerNames.has('vite.config.ts')) {
42
- evidence.push(withEvidencePrefix('Vite config'));
43
- confidenceScore += 0.08;
44
- }
45
-
46
- detectionCandidates.push({
47
- stackFileName: 'typescript.md',
48
- confidenceScore: Math.min(confidenceScore, 0.97),
49
- evidence,
50
- });
51
- }
52
-
53
- if (markerNames.has('pyproject.toml') || markerNames.has('requirements.txt')) {
54
- detectionCandidates.push({
55
- stackFileName: 'python.md',
56
- confidenceScore: markerNames.has('pyproject.toml') ? 0.96 : 0.78,
57
- evidence: markerNames.has('pyproject.toml')
58
- ? [withEvidencePrefix('pyproject.toml')]
59
- : [withEvidencePrefix('requirements.txt')],
60
- });
61
- }
62
-
63
- if (markerNames.has('pom.xml') || markerNames.has('build.gradle') || markerNames.has('build.gradle.kts')) {
64
- const evidence = [];
65
- if (markerNames.has('pom.xml')) evidence.push(withEvidencePrefix('pom.xml'));
66
- if (markerNames.has('build.gradle') || markerNames.has('build.gradle.kts')) evidence.push(withEvidencePrefix('Gradle build file'));
67
- detectionCandidates.push({
68
- stackFileName: 'java.md',
69
- confidenceScore: markerNames.has('pom.xml') ? 0.95 : 0.84,
70
- evidence,
71
- });
72
- }
73
-
74
- if (markerNames.has('composer.json')) {
75
- detectionCandidates.push({
76
- stackFileName: 'php.md',
77
- confidenceScore: 0.95,
78
- evidence: [withEvidencePrefix('composer.json')],
79
- });
80
- }
81
-
82
- if (markerNames.has('go.mod')) {
83
- detectionCandidates.push({
84
- stackFileName: 'go.md',
85
- confidenceScore: 0.96,
86
- evidence: [withEvidencePrefix('go.mod')],
87
- });
88
- }
89
-
90
- if (markerNames.has('Cargo.toml')) {
91
- detectionCandidates.push({
92
- stackFileName: 'rust.md',
93
- confidenceScore: 0.96,
94
- evidence: [withEvidencePrefix('Cargo.toml')],
95
- });
96
- }
97
-
98
- if (markerNames.has('Gemfile')) {
99
- detectionCandidates.push({
100
- stackFileName: 'ruby.md',
101
- confidenceScore: 0.95,
102
- evidence: [withEvidencePrefix('Gemfile')],
103
- });
104
- }
105
-
106
- const hasDotNetMarker = Array.from(markerNames).some(
107
- (markerName) => markerName.endsWith('.sln') || markerName.endsWith('.csproj'),
108
- );
109
- if (hasDotNetMarker) {
110
- detectionCandidates.push({
111
- stackFileName: 'csharp.md',
112
- confidenceScore: 0.95,
113
- evidence: [withEvidencePrefix('.sln or .csproj file')],
114
- });
115
- }
116
-
117
- if (
118
- markerNames.has('package.json')
119
- && (markerNames.has('android') || markerNames.has('ios') || markerNames.has('react-native.config.js'))
120
- ) {
121
- detectionCandidates.push({
122
- stackFileName: 'react-native.md',
123
- confidenceScore: 0.9,
124
- evidence: [withEvidencePrefix('package.json'), withEvidencePrefix('mobile runtime markers')],
125
- });
126
- }
127
-
128
- if (markerNames.has('pubspec.yaml')) {
129
- detectionCandidates.push({
130
- stackFileName: 'flutter.md',
131
- confidenceScore: 0.94,
132
- evidence: [withEvidencePrefix('pubspec.yaml')],
133
- });
134
- }
135
-
136
- return detectionCandidates;
137
- }
138
-
139
- export async function detectProjectContext(targetDirectoryPath) {
140
- const markerNames = await collectProjectMarkers(targetDirectoryPath);
141
- const nestedWorkspaceProjects = await collectNestedWorkspaceProjects(targetDirectoryPath);
142
- const detectionCandidates = [
143
- ...collectStackDetectionCandidates(markerNames),
144
- ...nestedWorkspaceProjects.flatMap((nestedWorkspaceProject) => (
145
- collectStackDetectionCandidates(
146
- nestedWorkspaceProject.markerNames,
147
- nestedWorkspaceProject.relativePath,
148
- )
149
- )),
150
- ];
151
- const hasExistingProjectFiles = markerNames.size > 0;
152
-
153
- if (detectionCandidates.length === 0) {
154
- return {
155
- hasExistingProjectFiles,
156
- detectedStackFileName: null,
157
- secondaryStackFileNames: [],
158
- detectedBlueprintFileName: null,
159
- confidenceLabel: null,
160
- confidenceScore: 0,
161
- confidenceGap: 0,
162
- detectionReasoning: 'No known project markers were detected.',
163
- rankedCandidates: [],
164
- evidence: [],
165
- };
166
- }
167
-
168
- detectionCandidates.sort(
169
- (leftCandidate, rightCandidate) => rightCandidate.confidenceScore - leftCandidate.confidenceScore,
170
- );
171
- const strongestCandidate = detectionCandidates[0];
172
- const secondStrongestCandidate = detectionCandidates[1];
173
- const confidenceGap = secondStrongestCandidate
174
- ? Number((strongestCandidate.confidenceScore - secondStrongestCandidate.confidenceScore).toFixed(2))
175
- : Number(strongestCandidate.confidenceScore.toFixed(2));
176
- const isAmbiguous = secondStrongestCandidate && confidenceGap < 0.08;
177
- const confidenceLabel = strongestCandidate.confidenceScore >= 0.9
178
- ? 'high'
179
- : strongestCandidate.confidenceScore >= 0.78
180
- ? 'medium'
181
- : 'low';
182
- const evidence = isAmbiguous
183
- ? [...strongestCandidate.evidence, 'multiple stack signals detected']
184
- : strongestCandidate.evidence;
185
- const rankedCandidates = detectionCandidates.slice(0, 3).map((detectionCandidate) => ({
186
- stackFileName: detectionCandidate.stackFileName,
187
- confidenceScore: Number(detectionCandidate.confidenceScore.toFixed(2)),
188
- evidence: detectionCandidate.evidence,
189
- }));
190
- const secondaryStackFileNames = rankedCandidates
191
- .slice(1)
192
- .filter((rankedCandidate) => (strongestCandidate.confidenceScore - rankedCandidate.confidenceScore) < 0.08)
193
- .map((rankedCandidate) => rankedCandidate.stackFileName);
194
- const detectionReasoning = isAmbiguous
195
- ? `Top signal ${toTitleCase(strongestCandidate.stackFileName)} is close to ${toTitleCase(secondStrongestCandidate.stackFileName)} (confidence gap ${confidenceGap}).`
196
- : `Top signal ${toTitleCase(strongestCandidate.stackFileName)} won with confidence ${strongestCandidate.confidenceScore.toFixed(2)} from markers: ${strongestCandidate.evidence.join(', ') || 'none'}.`;
197
-
198
- return {
199
- hasExistingProjectFiles,
200
- detectedStackFileName: strongestCandidate.stackFileName,
201
- secondaryStackFileNames,
202
- detectedBlueprintFileName: null,
203
- confidenceLabel,
204
- confidenceScore: strongestCandidate.confidenceScore,
205
- confidenceGap,
206
- detectionReasoning,
207
- rankedCandidates,
208
- evidence,
209
- };
210
- }
211
-
212
- export function buildDetectionSummary(projectDetection) {
213
- if (!projectDetection.detectedStackFileName) {
214
- return 'I did not find enough stack markers to auto-detect this project confidently.';
215
- }
216
-
217
- const readableEvidence = projectDetection.evidence.length > 0
218
- ? projectDetection.evidence.join(', ')
219
- : 'basic project markers';
220
-
221
- const confidenceGapSummary = typeof projectDetection.confidenceGap === 'number'
222
- ? ` Confidence gap: ${projectDetection.confidenceGap}.`
223
- : '';
224
-
225
- const secondaryStacksSummary = projectDetection.secondaryStackFileNames?.length
226
- ? ` Secondary stack signals: ${projectDetection.secondaryStackFileNames.map((stackFileName) => toTitleCase(stackFileName)).join(', ')}.`
227
- : '';
228
-
229
- return `This folder looks like ${toTitleCase(projectDetection.detectedStackFileName)} with ${projectDetection.confidenceLabel} confidence based on ${readableEvidence}.${confidenceGapSummary}${secondaryStacksSummary}`;
230
- }
231
-
232
- export function formatDetectionCandidates(rankedCandidates) {
233
- if (!rankedCandidates?.length) {
234
- return 'No ranked candidates available.';
235
- }
236
-
237
- return rankedCandidates
238
- .map((candidate, candidateIndex) => {
239
- const evidenceSummary = candidate.evidence?.length ? candidate.evidence.join(', ') : 'no direct markers';
240
- return `${candidateIndex + 1}. ${toTitleCase(candidate.stackFileName)} (score ${candidate.confidenceScore}) via ${evidenceSummary}`;
241
- })
242
- .join('\n');
243
- }