@contentful/experience-design-system-cli 2.6.2-dev-build-864e323.0 → 2.7.1-dev-build-02830eb.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.
- package/dist/package.json +1 -1
- package/dist/src/analyze/command.js +1 -1
- package/dist/src/analyze/extract/scoring.d.ts +3 -2
- package/dist/src/analyze/extract/scoring.js +39 -22
- package/dist/src/analyze/select/tui/App.js +54 -474
- package/dist/src/analyze/select/tui/components/ComponentDetail.d.ts +3 -5
- package/dist/src/analyze/select/tui/components/ComponentDetail.js +9 -10
- package/dist/src/analyze/select/tui/components/FinalizeDialog.d.ts +1 -1
- package/dist/src/analyze/select/tui/components/FinalizeDialog.js +2 -10
- package/dist/src/analyze/select/tui/components/HelpOverlay.d.ts +1 -1
- package/dist/src/analyze/select/tui/components/HelpOverlay.js +2 -7
- package/dist/src/analyze/select/tui/components/JsonEditor.d.ts +7 -5
- package/dist/src/analyze/select/tui/components/JsonEditor.js +15 -146
- package/dist/src/analyze/select/tui/components/QuitDialog.d.ts +1 -1
- package/dist/src/analyze/select/tui/components/QuitDialog.js +2 -10
- package/dist/src/analyze/select/tui/components/Sidebar.d.ts +0 -2
- package/dist/src/analyze/select/tui/components/StatusBar.d.ts +0 -2
- package/dist/src/analyze/select/tui/hooks/useImmediateInput.d.ts +5 -0
- package/dist/src/analyze/select/tui/hooks/useImmediateInput.js +7 -4
- package/dist/src/analyze/select/tui/hooks/useKeymap.d.ts +0 -23
- package/dist/src/analyze/select/tui/hooks/useKeymap.js +1 -67
- package/dist/src/analyze/select/tui/hooks/useRawMode.d.ts +6 -0
- package/dist/src/analyze/select/tui/hooks/useRawMode.js +16 -0
- package/dist/src/analyze/select/tui/hooks/useSideEffects.d.ts +17 -0
- package/dist/src/analyze/select/tui/hooks/useSideEffects.js +226 -0
- package/dist/src/analyze/select/tui/hooks/useUndo.js +15 -21
- package/dist/src/analyze/select/tui/inputToAction.d.ts +13 -0
- package/dist/src/analyze/select/tui/inputToAction.js +68 -0
- package/dist/src/analyze/select/tui/state.d.ts +136 -0
- package/dist/src/analyze/select/tui/state.js +385 -0
- package/dist/src/analyze/select/tui/utils.d.ts +5 -0
- package/dist/src/analyze/select/tui/utils.js +11 -0
- package/dist/src/analyze/select/types.d.ts +1 -1
- package/dist/src/analyze/select/types.js +1 -1
- package/dist/src/analyze/tui/AnalyzeView.d.ts +1 -1
- package/dist/src/analyze/tui/AnalyzeView.js +5 -3
- package/dist/src/generate/agent-runner.js +7 -2
- package/dist/src/import/tui/WizardApp.js +2 -0
- package/dist/src/import/tui/steps/GenerateReviewStep.js +5 -12
- package/dist/src/print/validate/tui/ValidateView.js +2 -0
- package/dist/src/session/db.js +4 -4
- package/dist/src/types.d.ts +3 -1
- package/dist/src/types.js +4 -1
- package/package.json +2 -2
- package/skills/select-components.md +8 -3
package/dist/package.json
CHANGED
|
@@ -153,7 +153,7 @@ export function registerAnalyzeCommand(program) {
|
|
|
153
153
|
propCount: c.props.length,
|
|
154
154
|
slotCount: c.slots.length,
|
|
155
155
|
warnings: allWarnings.filter((w) => w.startsWith(c.name + ':')),
|
|
156
|
-
extractionConfidence: c.extractionConfidence ??
|
|
156
|
+
extractionConfidence: c.extractionConfidence ?? null,
|
|
157
157
|
needsReview: c.needsReview ?? false,
|
|
158
158
|
})),
|
|
159
159
|
totalWarnings: allWarnings.length,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { RawComponentDefinition } from '../../types.js';
|
|
2
|
+
export type ExtractionConfidence = 1 | 2 | 3 | 4 | 5;
|
|
2
3
|
export type ExtractionScore = {
|
|
3
|
-
confidence:
|
|
4
|
+
confidence: ExtractionConfidence;
|
|
4
5
|
reasons: string[];
|
|
5
6
|
};
|
|
6
7
|
export declare function computeExtractionScore(component: RawComponentDefinition): ExtractionScore;
|
|
7
|
-
export declare function deriveNeedsReview(confidence:
|
|
8
|
+
export declare function deriveNeedsReview(confidence: ExtractionConfidence): boolean;
|
|
@@ -41,47 +41,64 @@ function isWidePrimitiveUnion(type) {
|
|
|
41
41
|
const nullability = new Set(['null', 'undefined']);
|
|
42
42
|
const baseCount = parts.filter((p) => basePrimitives.has(p)).length;
|
|
43
43
|
const nullabilityCount = parts.filter((p) => nullability.has(p)).length;
|
|
44
|
-
// Wide only when there are 3+ base primitives, or 2+ base primitives combined with nullability modifiers
|
|
45
44
|
return baseCount >= 3 || (baseCount >= 2 && nullabilityCount > 0 && baseCount + nullabilityCount >= 3);
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
// Count the number of issues found for scoring
|
|
47
|
+
function countIssues(component) {
|
|
48
|
+
let count = 0;
|
|
49
49
|
const reasons = [];
|
|
50
|
-
// No props and no slots — extractor likely missed something or component is a wrapper
|
|
51
50
|
if (component.props.length === 0 && component.slots.length === 0) {
|
|
52
|
-
|
|
51
|
+
count++;
|
|
53
52
|
reasons.push('no-props-or-slots');
|
|
54
53
|
}
|
|
54
|
+
if (component.props.length > 50) {
|
|
55
|
+
count++;
|
|
56
|
+
reasons.push(`high-prop-count:${component.props.length}`);
|
|
57
|
+
}
|
|
55
58
|
for (const prop of component.props) {
|
|
56
|
-
// Opaque types — extractor couldn't resolve the real type
|
|
57
59
|
if (OPAQUE_TYPES.has(prop.type.trim())) {
|
|
58
|
-
|
|
60
|
+
count++;
|
|
59
61
|
reasons.push(`opaque-type:${prop.name}`);
|
|
60
|
-
break;
|
|
62
|
+
break;
|
|
61
63
|
}
|
|
62
|
-
// Wide primitive union — hard for the AI agent to classify meaningfully
|
|
63
64
|
if (isWidePrimitiveUnion(prop.type)) {
|
|
64
|
-
|
|
65
|
+
count++;
|
|
65
66
|
reasons.push(`wide-union:${prop.name}`);
|
|
66
|
-
break;
|
|
67
|
+
break;
|
|
67
68
|
}
|
|
68
|
-
// Non-obvious prop name with no description
|
|
69
69
|
if (!prop.description && !OBVIOUS_PROP_NAMES.has(prop.name)) {
|
|
70
|
-
|
|
70
|
+
count++;
|
|
71
71
|
reasons.push('props-missing-description');
|
|
72
|
-
break;
|
|
72
|
+
break;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
return { count, reasons: [...new Set(reasons)] };
|
|
76
|
+
}
|
|
77
|
+
// Maps issue count to a 1–5 confidence scale:
|
|
78
|
+
// 0 issues → 5 (clean)
|
|
79
|
+
// 1 issue → 4 (minor concern)
|
|
80
|
+
// 2 issues → 3 (moderate concern)
|
|
81
|
+
// 3 issues → 2 (significant concern)
|
|
82
|
+
// 4+ issues → 1 (likely wrong)
|
|
83
|
+
function issueCountToConfidence(count) {
|
|
84
|
+
if (count === 0)
|
|
85
|
+
return 5;
|
|
86
|
+
if (count === 1)
|
|
87
|
+
return 4;
|
|
88
|
+
if (count === 2)
|
|
89
|
+
return 3;
|
|
90
|
+
if (count === 3)
|
|
91
|
+
return 2;
|
|
92
|
+
return 1;
|
|
93
|
+
}
|
|
94
|
+
export function computeExtractionScore(component) {
|
|
95
|
+
const { count, reasons } = countIssues(component);
|
|
80
96
|
return {
|
|
81
|
-
confidence:
|
|
82
|
-
reasons
|
|
97
|
+
confidence: issueCountToConfidence(count),
|
|
98
|
+
reasons,
|
|
83
99
|
};
|
|
84
100
|
}
|
|
101
|
+
// Flag components scoring 2 or below for human review
|
|
85
102
|
export function deriveNeedsReview(confidence) {
|
|
86
|
-
return confidence
|
|
103
|
+
return confidence <= 2;
|
|
87
104
|
}
|