canicode 0.11.4 → 0.12.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/.claude-plugin/marketplace.json +13 -0
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +50 -16
- package/dist/cli/index.js +391 -96
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +21 -3
- package/dist/index.js +89 -22
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +102 -29
- package/dist/mcp/server.js.map +1 -1
- package/docs/CUSTOMIZATION.md +51 -9
- package/package.json +1 -1
- package/skills/canicode-roundtrip/SKILL.md +104 -4
- package/skills/canicode-roundtrip/helpers-bootstrap.js +1 -1
- package/skills/canicode-roundtrip/helpers-installer.js +1 -1
- package/skills/cursor/canicode-roundtrip/SKILL.md +104 -4
- package/skills/cursor/canicode-roundtrip/helpers-bootstrap.js +1 -1
- package/skills/cursor/canicode-roundtrip/helpers-installer.js +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { GetFileResponse, Node } from '@figma/rest-api-spec';
|
|
3
3
|
|
|
4
|
-
var version = "0.
|
|
4
|
+
var version = "0.12.0";
|
|
5
5
|
|
|
6
6
|
declare const SeveritySchema: z.ZodEnum<{
|
|
7
7
|
blocking: "blocking";
|
|
8
8
|
risk: "risk";
|
|
9
9
|
"missing-info": "missing-info";
|
|
10
10
|
suggestion: "suggestion";
|
|
11
|
+
note: "note";
|
|
11
12
|
}>;
|
|
12
13
|
type Severity = z.infer<typeof SeveritySchema>;
|
|
13
14
|
declare const SEVERITY_WEIGHT: Record<Severity, number>;
|
|
@@ -404,6 +405,7 @@ declare const RuleConfigSchema: z.ZodObject<{
|
|
|
404
405
|
risk: "risk";
|
|
405
406
|
"missing-info": "missing-info";
|
|
406
407
|
suggestion: "suggestion";
|
|
408
|
+
note: "note";
|
|
407
409
|
}>;
|
|
408
410
|
score: z.ZodNumber;
|
|
409
411
|
depthWeight: z.ZodOptional<z.ZodNumber>;
|
|
@@ -489,7 +491,7 @@ interface Rule {
|
|
|
489
491
|
/**
|
|
490
492
|
* Rule ID type for type safety
|
|
491
493
|
*/
|
|
492
|
-
type RuleId = "no-auto-layout" | "absolute-position-in-auto-layout" | "non-layout-container" | "fixed-size-in-auto-layout" | "missing-size-constraint" | "missing-component" | "detached-instance" | "variant-structure-mismatch" | "deep-nesting" | "raw-value" | "irregular-spacing" | "missing-interaction-state" | "missing-prototype" | "non-standard-naming" | "non-semantic-name" | "inconsistent-naming-convention";
|
|
494
|
+
type RuleId = "no-auto-layout" | "absolute-position-in-auto-layout" | "non-layout-container" | "fixed-size-in-auto-layout" | "missing-size-constraint" | "missing-component" | "detached-instance" | "variant-structure-mismatch" | "deep-nesting" | "unmapped-component" | "raw-value" | "irregular-spacing" | "missing-interaction-state" | "missing-prototype" | "non-standard-naming" | "non-semantic-name" | "inconsistent-naming-convention";
|
|
493
495
|
/**
|
|
494
496
|
* Categories that support depthWeight
|
|
495
497
|
*/
|
|
@@ -510,6 +512,7 @@ declare const IssueSchema: z.ZodObject<{
|
|
|
510
512
|
risk: "risk";
|
|
511
513
|
"missing-info": "missing-info";
|
|
512
514
|
suggestion: "suggestion";
|
|
515
|
+
note: "note";
|
|
513
516
|
}>;
|
|
514
517
|
}, z.core.$strip>;
|
|
515
518
|
type Issue = z.infer<typeof IssueSchema>;
|
|
@@ -576,6 +579,7 @@ declare const ReportSchema: z.ZodObject<{
|
|
|
576
579
|
risk: "risk";
|
|
577
580
|
"missing-info": "missing-info";
|
|
578
581
|
suggestion: "suggestion";
|
|
582
|
+
note: "note";
|
|
579
583
|
}>;
|
|
580
584
|
}, z.core.$strip>>;
|
|
581
585
|
summary: z.ZodObject<{
|
|
@@ -665,6 +669,7 @@ declare const McpAnalyzeResponseSchema: z.ZodObject<{
|
|
|
665
669
|
risk: z.ZodNumber;
|
|
666
670
|
"missing-info": z.ZodNumber;
|
|
667
671
|
suggestion: z.ZodNumber;
|
|
672
|
+
note: z.ZodNumber;
|
|
668
673
|
}, z.core.$strip>;
|
|
669
674
|
}, z.core.$strip>>;
|
|
670
675
|
}, z.core.$strip>;
|
|
@@ -688,6 +693,7 @@ declare const McpAnalyzeResponseSchema: z.ZodObject<{
|
|
|
688
693
|
risk: "risk";
|
|
689
694
|
"missing-info": "missing-info";
|
|
690
695
|
suggestion: "suggestion";
|
|
696
|
+
note: "note";
|
|
691
697
|
}>;
|
|
692
698
|
nodeId: z.ZodString;
|
|
693
699
|
nodePath: z.ZodString;
|
|
@@ -757,6 +763,7 @@ declare const GotchaSurveyQuestionSchema: z.ZodObject<{
|
|
|
757
763
|
risk: "risk";
|
|
758
764
|
"missing-info": "missing-info";
|
|
759
765
|
suggestion: "suggestion";
|
|
766
|
+
note: "note";
|
|
760
767
|
}>;
|
|
761
768
|
question: z.ZodString;
|
|
762
769
|
hint: z.ZodString;
|
|
@@ -823,6 +830,7 @@ declare const SurveyQuestionBatchSchema: z.ZodObject<{
|
|
|
823
830
|
risk: "risk";
|
|
824
831
|
"missing-info": "missing-info";
|
|
825
832
|
suggestion: "suggestion";
|
|
833
|
+
note: "note";
|
|
826
834
|
}>;
|
|
827
835
|
question: z.ZodString;
|
|
828
836
|
hint: z.ZodString;
|
|
@@ -886,6 +894,7 @@ declare const SurveyQuestionGroupSchema: z.ZodObject<{
|
|
|
886
894
|
risk: "risk";
|
|
887
895
|
"missing-info": "missing-info";
|
|
888
896
|
suggestion: "suggestion";
|
|
897
|
+
note: "note";
|
|
889
898
|
}>;
|
|
890
899
|
question: z.ZodString;
|
|
891
900
|
hint: z.ZodString;
|
|
@@ -951,6 +960,7 @@ declare const GroupedSurveySchema: z.ZodObject<{
|
|
|
951
960
|
risk: "risk";
|
|
952
961
|
"missing-info": "missing-info";
|
|
953
962
|
suggestion: "suggestion";
|
|
963
|
+
note: "note";
|
|
954
964
|
}>;
|
|
955
965
|
question: z.ZodString;
|
|
956
966
|
hint: z.ZodString;
|
|
@@ -1015,6 +1025,7 @@ declare const GotchaSurveySchema: z.ZodObject<{
|
|
|
1015
1025
|
risk: "risk";
|
|
1016
1026
|
"missing-info": "missing-info";
|
|
1017
1027
|
suggestion: "suggestion";
|
|
1028
|
+
note: "note";
|
|
1018
1029
|
}>;
|
|
1019
1030
|
question: z.ZodString;
|
|
1020
1031
|
hint: z.ZodString;
|
|
@@ -1076,6 +1087,7 @@ declare const GotchaSurveySchema: z.ZodObject<{
|
|
|
1076
1087
|
risk: "risk";
|
|
1077
1088
|
"missing-info": "missing-info";
|
|
1078
1089
|
suggestion: "suggestion";
|
|
1090
|
+
note: "note";
|
|
1079
1091
|
}>;
|
|
1080
1092
|
question: z.ZodString;
|
|
1081
1093
|
hint: z.ZodString;
|
|
@@ -1278,6 +1290,7 @@ interface ScoreReport {
|
|
|
1278
1290
|
risk: number;
|
|
1279
1291
|
missingInfo: number;
|
|
1280
1292
|
suggestion: number;
|
|
1293
|
+
note: number;
|
|
1281
1294
|
nodeCount: number;
|
|
1282
1295
|
/**
|
|
1283
1296
|
* Number of issues marked `acknowledged` by an upstream
|
|
@@ -1806,6 +1819,7 @@ declare const irregularSpacing: Rule;
|
|
|
1806
1819
|
declare const missingComponent: Rule;
|
|
1807
1820
|
declare const detachedInstance: Rule;
|
|
1808
1821
|
declare const variantStructureMismatch: Rule;
|
|
1822
|
+
declare const unmappedComponent: Rule;
|
|
1809
1823
|
|
|
1810
1824
|
declare const nonSemanticName: Rule;
|
|
1811
1825
|
declare const inconsistentNamingConvention: Rule;
|
|
@@ -2045,6 +2059,7 @@ declare const MismatchCaseSchema: z.ZodObject<{
|
|
|
2045
2059
|
risk: "risk";
|
|
2046
2060
|
"missing-info": "missing-info";
|
|
2047
2061
|
suggestion: "suggestion";
|
|
2062
|
+
note: "note";
|
|
2048
2063
|
}>>;
|
|
2049
2064
|
actualDifficulty: z.ZodEnum<{
|
|
2050
2065
|
easy: "easy";
|
|
@@ -2154,12 +2169,14 @@ declare const ScoreAdjustmentSchema: z.ZodObject<{
|
|
|
2154
2169
|
risk: "risk";
|
|
2155
2170
|
"missing-info": "missing-info";
|
|
2156
2171
|
suggestion: "suggestion";
|
|
2172
|
+
note: "note";
|
|
2157
2173
|
}>;
|
|
2158
2174
|
proposedSeverity: z.ZodOptional<z.ZodEnum<{
|
|
2159
2175
|
blocking: "blocking";
|
|
2160
2176
|
risk: "risk";
|
|
2161
2177
|
"missing-info": "missing-info";
|
|
2162
2178
|
suggestion: "suggestion";
|
|
2179
|
+
note: "note";
|
|
2163
2180
|
}>>;
|
|
2164
2181
|
reasoning: z.ZodString;
|
|
2165
2182
|
confidence: z.ZodEnum<{
|
|
@@ -2180,6 +2197,7 @@ declare const NewRuleProposalSchema: z.ZodObject<{
|
|
|
2180
2197
|
risk: "risk";
|
|
2181
2198
|
"missing-info": "missing-info";
|
|
2182
2199
|
suggestion: "suggestion";
|
|
2200
|
+
note: "note";
|
|
2183
2201
|
}>;
|
|
2184
2202
|
suggestedScore: z.ZodNumber;
|
|
2185
2203
|
reasoning: z.ZodString;
|
|
@@ -2376,4 +2394,4 @@ declare class ActivityLogger {
|
|
|
2376
2394
|
getLogPath(): string;
|
|
2377
2395
|
}
|
|
2378
2396
|
|
|
2379
|
-
export { ALL_STRIP_TYPES, ActivityLogger, type AnalysisAgentInput, type AnalysisAgentOutput, type AnalysisFile, AnalysisFileSchema, type AnalysisIssue, type AnalysisNode, AnalysisNodeSchema, type AnalysisNodeType, AnalysisNodeTypeSchema, type AnalysisResult, type AnalysisScope, AnalysisScopeSchema, AnnotationPropertySchema, CATEGORIES, CATEGORY_LABELS, type CalibrationConfig, type CalibrationConfigInput, CalibrationConfigSchema, type CalibrationRun, type CalibrationStatus, CalibrationStatusSchema, type Category, CategorySchema, type CategoryScore, type CategoryScoreResult, CategoryScoreSchema, type Confidence, ConfidenceSchema, type ConversionRecord, ConversionRecordSchema, DEFAULT_CODEGEN_READY_MIN_GRADE, DEPTH_WEIGHT_CATEGORIES, DESIGN_TREE_INFO_TYPES, type DesignTreeInfoType, type DesignTreeOptions, type DesignTreeResult, type DesignTreeStripType, type Detection, DetectionSchema, type Difficulty, DifficultySchema, type EvaluationAgentInput, type EvaluationAgentOutput, FigmaClient, FigmaClientError, type FigmaClientOptions, FigmaFileLoadError, type FigmaUrlInfo, FigmaUrlInfoSchema, FigmaUrlParseError, GRADE_ORDER, type GapAnalyzerOutput, GapAnalyzerOutputSchema, type GapEntry, GapEntrySchema, type GetFileNodesResponse, type GotchaApplyResolution, type GotchaApplyStrategy, GotchaDetectionSchema, GotchaOutputChannelSchema, GotchaPersistenceIntentSchema, type GotchaSurvey, type GotchaSurveyQuestion, GotchaSurveyQuestionSchema, GotchaSurveySchema, type Grade, type GridChildAlign, GridChildAlignSchema, type GroupedSurvey, GroupedSurveySchema, type InstanceChildIdParts, type InstanceContext, InstanceContextSchema, type Issue, IssueSchema, type LayoutAlign, LayoutAlignSchema, type LayoutConstraint, LayoutConstraintSchema, type LayoutMode, LayoutModeSchema, type LayoutPositioning, LayoutPositioningSchema, type LayoutWrap, LayoutWrapSchema, type McpAnalyzeResponse, McpAnalyzeResponseSchema, type MismatchCase, MismatchCaseSchema, type MismatchType, MismatchTypeSchema, type NewRuleProposal, NewRuleProposalSchema, type NodeIssueDetail, type NodeIssueSummary, NodeIssueSummarySchema, type OutputChannel, OutputChannelSchema, type OverflowDirection, OverflowDirectionSchema, type PersistenceIntent, PersistenceIntentSchema, type Preset, RULE_ANNOTATION_PROPERTIES, RULE_CONFIGS, RULE_ID_CATEGORY, RULE_PURPOSE, type Report, type ReportMetadata, ReportMetadataSchema, ReportSchema, type Rule, type RuleApplyStrategy, RuleApplyStrategySchema, type RuleCheckFn, type RuleConfig, RuleConfigSchema, type RuleContext, type RuleDefinition, RuleDefinitionSchema, RuleEngine, type RuleEngineOptions, type RuleFailure, type RuleId, RuleImpactAssessmentSchema, type RulePurpose, RulePurposeSchema, type RuleRelatedStruggle, RuleRelatedStruggleSchema, type RuleViolation, SEVERITY_LABELS, SEVERITY_WEIGHT, type SamplingStrategy, SamplingStrategySchema, type ScoreAdjustment, ScoreAdjustmentSchema, type ScoreReport, type Severity, SeveritySchema, type StripDeltaForEval, type StripDeltaResult, StripDeltaResultSchema, StripDeltasArraySchema, StripTypeEnum, type SurveyQuestionBatch, SurveyQuestionBatchSchema, type SurveyQuestionGroup, SurveyQuestionGroupSchema, type TuningAgentInput, type TuningAgentOutput, type UncoveredStruggle, UncoveredStruggleSchema, UncoveredStrugglesInputSchema, version as VERSION, type VisualCompareCliOptions, VisualCompareCliOptionsSchema, absolutePositionInAutoLayout, analyzeFile, buildFigmaDeepLink, buildResultJson, calculateScores, collectComponentIds, collectInteractionDestinationIds, createRuleEngine, deepNesting, defineRule, detachedInstance, detectAnalysisScope, extractRuleScores, fixedSizeInAutoLayout, formatScoreSummary, generateCalibrationReport, generateDesignTree, generateDesignTreeWithStats, getAnalysisState, getAnnotationProperties, getCategoryLabel, getConfigsWithPreset, getRuleOption, getRulePurpose, getSeverityLabel, gradeToClassName, inconsistentNamingConvention, irregularSpacing, isInstanceChildNodeId, isReadyForCodeGen, loadFigmaFileFromJson, missingComponent, missingInteractionState, missingPrototype, missingSizeConstraint, noAutoLayout, nonLayoutContainer, nonSemanticName, nonStandardNaming, parseFigmaJson, parseFigmaUrl, parseInstanceChildNodeId, rawValue, resolveComponentDefinitions, resolveGotchaApplyTarget, resolveInteractionDestinations, ruleRegistry, runAnalysisAgent, runCalibrationAnalyze, runCalibrationEvaluate, runEvaluationAgent, runTuningAgent, stripDeltaToDifficulty, stripDesignTree, supportsDepthWeight, toCommentableNodeId, tokenDeltaToDifficulty, transformComponentMasterNodes, transformFigmaResponse, transformFileNodesResponse, variantStructureMismatch };
|
|
2397
|
+
export { ALL_STRIP_TYPES, ActivityLogger, type AnalysisAgentInput, type AnalysisAgentOutput, type AnalysisFile, AnalysisFileSchema, type AnalysisIssue, type AnalysisNode, AnalysisNodeSchema, type AnalysisNodeType, AnalysisNodeTypeSchema, type AnalysisResult, type AnalysisScope, AnalysisScopeSchema, AnnotationPropertySchema, CATEGORIES, CATEGORY_LABELS, type CalibrationConfig, type CalibrationConfigInput, CalibrationConfigSchema, type CalibrationRun, type CalibrationStatus, CalibrationStatusSchema, type Category, CategorySchema, type CategoryScore, type CategoryScoreResult, CategoryScoreSchema, type Confidence, ConfidenceSchema, type ConversionRecord, ConversionRecordSchema, DEFAULT_CODEGEN_READY_MIN_GRADE, DEPTH_WEIGHT_CATEGORIES, DESIGN_TREE_INFO_TYPES, type DesignTreeInfoType, type DesignTreeOptions, type DesignTreeResult, type DesignTreeStripType, type Detection, DetectionSchema, type Difficulty, DifficultySchema, type EvaluationAgentInput, type EvaluationAgentOutput, FigmaClient, FigmaClientError, type FigmaClientOptions, FigmaFileLoadError, type FigmaUrlInfo, FigmaUrlInfoSchema, FigmaUrlParseError, GRADE_ORDER, type GapAnalyzerOutput, GapAnalyzerOutputSchema, type GapEntry, GapEntrySchema, type GetFileNodesResponse, type GotchaApplyResolution, type GotchaApplyStrategy, GotchaDetectionSchema, GotchaOutputChannelSchema, GotchaPersistenceIntentSchema, type GotchaSurvey, type GotchaSurveyQuestion, GotchaSurveyQuestionSchema, GotchaSurveySchema, type Grade, type GridChildAlign, GridChildAlignSchema, type GroupedSurvey, GroupedSurveySchema, type InstanceChildIdParts, type InstanceContext, InstanceContextSchema, type Issue, IssueSchema, type LayoutAlign, LayoutAlignSchema, type LayoutConstraint, LayoutConstraintSchema, type LayoutMode, LayoutModeSchema, type LayoutPositioning, LayoutPositioningSchema, type LayoutWrap, LayoutWrapSchema, type McpAnalyzeResponse, McpAnalyzeResponseSchema, type MismatchCase, MismatchCaseSchema, type MismatchType, MismatchTypeSchema, type NewRuleProposal, NewRuleProposalSchema, type NodeIssueDetail, type NodeIssueSummary, NodeIssueSummarySchema, type OutputChannel, OutputChannelSchema, type OverflowDirection, OverflowDirectionSchema, type PersistenceIntent, PersistenceIntentSchema, type Preset, RULE_ANNOTATION_PROPERTIES, RULE_CONFIGS, RULE_ID_CATEGORY, RULE_PURPOSE, type Report, type ReportMetadata, ReportMetadataSchema, ReportSchema, type Rule, type RuleApplyStrategy, RuleApplyStrategySchema, type RuleCheckFn, type RuleConfig, RuleConfigSchema, type RuleContext, type RuleDefinition, RuleDefinitionSchema, RuleEngine, type RuleEngineOptions, type RuleFailure, type RuleId, RuleImpactAssessmentSchema, type RulePurpose, RulePurposeSchema, type RuleRelatedStruggle, RuleRelatedStruggleSchema, type RuleViolation, SEVERITY_LABELS, SEVERITY_WEIGHT, type SamplingStrategy, SamplingStrategySchema, type ScoreAdjustment, ScoreAdjustmentSchema, type ScoreReport, type Severity, SeveritySchema, type StripDeltaForEval, type StripDeltaResult, StripDeltaResultSchema, StripDeltasArraySchema, StripTypeEnum, type SurveyQuestionBatch, SurveyQuestionBatchSchema, type SurveyQuestionGroup, SurveyQuestionGroupSchema, type TuningAgentInput, type TuningAgentOutput, type UncoveredStruggle, UncoveredStruggleSchema, UncoveredStrugglesInputSchema, version as VERSION, type VisualCompareCliOptions, VisualCompareCliOptionsSchema, absolutePositionInAutoLayout, analyzeFile, buildFigmaDeepLink, buildResultJson, calculateScores, collectComponentIds, collectInteractionDestinationIds, createRuleEngine, deepNesting, defineRule, detachedInstance, detectAnalysisScope, extractRuleScores, fixedSizeInAutoLayout, formatScoreSummary, generateCalibrationReport, generateDesignTree, generateDesignTreeWithStats, getAnalysisState, getAnnotationProperties, getCategoryLabel, getConfigsWithPreset, getRuleOption, getRulePurpose, getSeverityLabel, gradeToClassName, inconsistentNamingConvention, irregularSpacing, isInstanceChildNodeId, isReadyForCodeGen, loadFigmaFileFromJson, missingComponent, missingInteractionState, missingPrototype, missingSizeConstraint, noAutoLayout, nonLayoutContainer, nonSemanticName, nonStandardNaming, parseFigmaJson, parseFigmaUrl, parseInstanceChildNodeId, rawValue, resolveComponentDefinitions, resolveGotchaApplyTarget, resolveInteractionDestinations, ruleRegistry, runAnalysisAgent, runCalibrationAnalyze, runCalibrationEvaluate, runEvaluationAgent, runTuningAgent, stripDeltaToDifficulty, stripDesignTree, supportsDepthWeight, toCommentableNodeId, tokenDeltaToDifficulty, transformComponentMasterNodes, transformFigmaResponse, transformFileNodesResponse, unmappedComponent, variantStructureMismatch };
|
package/dist/index.js
CHANGED
|
@@ -6,24 +6,33 @@ import 'crypto';
|
|
|
6
6
|
import { homedir } from 'os';
|
|
7
7
|
|
|
8
8
|
// package.json
|
|
9
|
-
var version = "0.
|
|
9
|
+
var version = "0.12.0";
|
|
10
10
|
var SeveritySchema = z.enum([
|
|
11
11
|
"blocking",
|
|
12
12
|
"risk",
|
|
13
13
|
"missing-info",
|
|
14
|
-
"suggestion"
|
|
14
|
+
"suggestion",
|
|
15
|
+
/**
|
|
16
|
+
* `note` is the zero-impact tier (#519): findings render in the report but
|
|
17
|
+
* never move the grade. Used for annotation-primary rules whose value is the
|
|
18
|
+
* nudge, not the score (e.g. unmapped Code Connect components, info-collection
|
|
19
|
+
* rules whose answers belong in figma-implement-design context, not in linting).
|
|
20
|
+
*/
|
|
21
|
+
"note"
|
|
15
22
|
]);
|
|
16
23
|
var SEVERITY_WEIGHT = {
|
|
17
24
|
blocking: 10,
|
|
18
25
|
risk: 5,
|
|
19
26
|
"missing-info": 2,
|
|
20
|
-
suggestion: 1
|
|
27
|
+
suggestion: 1,
|
|
28
|
+
note: 0
|
|
21
29
|
};
|
|
22
30
|
var SEVERITY_LABELS = {
|
|
23
31
|
blocking: "Blocking",
|
|
24
32
|
risk: "Risk",
|
|
25
33
|
"missing-info": "Missing Info",
|
|
26
|
-
suggestion: "Suggestion"
|
|
34
|
+
suggestion: "Suggestion",
|
|
35
|
+
note: "Note"
|
|
27
36
|
};
|
|
28
37
|
var DetectionSchema = z.literal("rule-based");
|
|
29
38
|
var OutputChannelSchema = z.enum(["score", "annotation"]);
|
|
@@ -298,7 +307,8 @@ var CategoryScoreResultSchema = z.object({
|
|
|
298
307
|
blocking: z.number().int().min(0),
|
|
299
308
|
risk: z.number().int().min(0),
|
|
300
309
|
"missing-info": z.number().int().min(0),
|
|
301
|
-
suggestion: z.number().int().min(0)
|
|
310
|
+
suggestion: z.number().int().min(0),
|
|
311
|
+
note: z.number().int().min(0)
|
|
302
312
|
})
|
|
303
313
|
});
|
|
304
314
|
var McpIssueSchema = z.object({
|
|
@@ -486,6 +496,7 @@ var RULE_ID_CATEGORY = {
|
|
|
486
496
|
"detached-instance": "code-quality",
|
|
487
497
|
"variant-structure-mismatch": "code-quality",
|
|
488
498
|
"deep-nesting": "code-quality",
|
|
499
|
+
"unmapped-component": "code-quality",
|
|
489
500
|
// Token Management
|
|
490
501
|
"raw-value": "token-management",
|
|
491
502
|
"irregular-spacing": "token-management",
|
|
@@ -516,6 +527,12 @@ var RULE_PURPOSE = {
|
|
|
516
527
|
"detached-instance": "violation",
|
|
517
528
|
"variant-structure-mismatch": "violation",
|
|
518
529
|
"deep-nesting": "violation",
|
|
530
|
+
// #520: unmapped-component is annotation-primary. Fires only when the
|
|
531
|
+
// user has Code Connect set up at all (figma.config.json present in cwd).
|
|
532
|
+
// The gotcha drives the user to /canicode-roundtrip for actual mapping
|
|
533
|
+
// registration via the Figma MCP tools — analyze itself does not parse
|
|
534
|
+
// mapping declarations (deferred to v1.5).
|
|
535
|
+
"unmapped-component": "info-collection",
|
|
519
536
|
// Token Management
|
|
520
537
|
"raw-value": "violation",
|
|
521
538
|
"irregular-spacing": "violation",
|
|
@@ -559,12 +576,12 @@ var RULE_CONFIGS = {
|
|
|
559
576
|
enabled: true
|
|
560
577
|
},
|
|
561
578
|
"missing-size-constraint": {
|
|
562
|
-
// #403:
|
|
563
|
-
//
|
|
564
|
-
//
|
|
565
|
-
//
|
|
566
|
-
severity: "
|
|
567
|
-
score:
|
|
579
|
+
// #403 → #519: info-collection rule. Score is 0 (severity `note`):
|
|
580
|
+
// its value is the gotcha annotation, not the grade impact. Survey-
|
|
581
|
+
// generator includes this rule via the `purpose === "info-collection"`
|
|
582
|
+
// branch so the gotcha keeps surfacing.
|
|
583
|
+
severity: "note",
|
|
584
|
+
score: 0,
|
|
568
585
|
enabled: true
|
|
569
586
|
},
|
|
570
587
|
// ── Code Quality ──
|
|
@@ -596,6 +613,16 @@ var RULE_CONFIGS = {
|
|
|
596
613
|
maxDepth: 5
|
|
597
614
|
}
|
|
598
615
|
},
|
|
616
|
+
"unmapped-component": {
|
|
617
|
+
// #520 / #519: zero-impact tier. Fires per main component when Code
|
|
618
|
+
// Connect is set up in the consuming repo (figma.config.json at cwd).
|
|
619
|
+
// Score is 0 because the rule's value is the gotcha + roundtrip handoff,
|
|
620
|
+
// not the grade signal — designers who deliberately do not map (e.g.
|
|
621
|
+
// marketing-only banners) are not punished.
|
|
622
|
+
severity: "note",
|
|
623
|
+
score: 0,
|
|
624
|
+
enabled: true
|
|
625
|
+
},
|
|
599
626
|
// ── Token Management ──
|
|
600
627
|
"raw-value": {
|
|
601
628
|
severity: "missing-info",
|
|
@@ -617,15 +644,15 @@ var RULE_CONFIGS = {
|
|
|
617
644
|
// is minimal. Score stays at -1 so re-enabling `missing-prototype` on
|
|
618
645
|
// fixtures that lack `interactionDestinations` (#139) cannot swing grades.
|
|
619
646
|
"missing-interaction-state": {
|
|
620
|
-
severity: "
|
|
621
|
-
|
|
622
|
-
|
|
647
|
+
severity: "note",
|
|
648
|
+
// #519: info-collection rule, zero-score tier
|
|
649
|
+
score: 0,
|
|
623
650
|
enabled: true
|
|
624
651
|
},
|
|
625
652
|
"missing-prototype": {
|
|
626
|
-
severity: "
|
|
627
|
-
|
|
628
|
-
|
|
653
|
+
severity: "note",
|
|
654
|
+
// #519: info-collection — annotation is primary output, no grade impact
|
|
655
|
+
score: 0,
|
|
629
656
|
enabled: true
|
|
630
657
|
},
|
|
631
658
|
// ── Semantic ──
|
|
@@ -1086,6 +1113,7 @@ var STRATEGY_BY_RULE = {
|
|
|
1086
1113
|
// Strategy C — annotation only
|
|
1087
1114
|
"absolute-position-in-auto-layout": "annotation",
|
|
1088
1115
|
"variant-structure-mismatch": "annotation",
|
|
1116
|
+
"unmapped-component": "annotation",
|
|
1089
1117
|
// Strategy D — auto-fix lower-severity issues from analyze output
|
|
1090
1118
|
"non-standard-naming": "auto-fix",
|
|
1091
1119
|
"inconsistent-naming-convention": "auto-fix",
|
|
@@ -1120,6 +1148,7 @@ function resolveTargetProperty(ruleId, subType) {
|
|
|
1120
1148
|
case "raw-value":
|
|
1121
1149
|
case "missing-interaction-state":
|
|
1122
1150
|
case "missing-prototype":
|
|
1151
|
+
case "unmapped-component":
|
|
1123
1152
|
return void 0;
|
|
1124
1153
|
}
|
|
1125
1154
|
}
|
|
@@ -1251,6 +1280,7 @@ function calculateScores(result, configs) {
|
|
|
1251
1280
|
risk: 0,
|
|
1252
1281
|
missingInfo: 0,
|
|
1253
1282
|
suggestion: 0,
|
|
1283
|
+
note: 0,
|
|
1254
1284
|
nodeCount,
|
|
1255
1285
|
acknowledgedCount: 0
|
|
1256
1286
|
};
|
|
@@ -1268,6 +1298,9 @@ function calculateScores(result, configs) {
|
|
|
1268
1298
|
case "suggestion":
|
|
1269
1299
|
summary.suggestion++;
|
|
1270
1300
|
break;
|
|
1301
|
+
case "note":
|
|
1302
|
+
summary.note++;
|
|
1303
|
+
break;
|
|
1271
1304
|
}
|
|
1272
1305
|
if (issue.acknowledged === true) summary.acknowledgedCount++;
|
|
1273
1306
|
}
|
|
@@ -1299,7 +1332,8 @@ function initializeCategoryScores() {
|
|
|
1299
1332
|
blocking: 0,
|
|
1300
1333
|
risk: 0,
|
|
1301
1334
|
"missing-info": 0,
|
|
1302
|
-
suggestion: 0
|
|
1335
|
+
suggestion: 0,
|
|
1336
|
+
note: 0
|
|
1303
1337
|
}
|
|
1304
1338
|
};
|
|
1305
1339
|
}
|
|
@@ -1320,6 +1354,7 @@ function formatScoreSummary(report) {
|
|
|
1320
1354
|
lines.push(` Risk: ${report.summary.risk}`);
|
|
1321
1355
|
lines.push(` Missing Info: ${report.summary.missingInfo}`);
|
|
1322
1356
|
lines.push(` Suggestion: ${report.summary.suggestion}`);
|
|
1357
|
+
lines.push(` Note: ${report.summary.note}`);
|
|
1323
1358
|
if (report.summary.acknowledgedCount > 0) {
|
|
1324
1359
|
const unaddressed = report.summary.totalIssues - report.summary.acknowledgedCount;
|
|
1325
1360
|
lines.push(
|
|
@@ -1338,7 +1373,8 @@ function getSeverityLabel(severity) {
|
|
|
1338
1373
|
blocking: "Blocking",
|
|
1339
1374
|
risk: "Risk",
|
|
1340
1375
|
"missing-info": "Missing Info",
|
|
1341
|
-
suggestion: "Suggestion"
|
|
1376
|
+
suggestion: "Suggestion",
|
|
1377
|
+
note: "Note"
|
|
1342
1378
|
};
|
|
1343
1379
|
return labels[severity];
|
|
1344
1380
|
}
|
|
@@ -2455,6 +2491,10 @@ var missingComponentMsg = {
|
|
|
2455
2491
|
suggestion: `Create a new variant for this style combination`
|
|
2456
2492
|
})
|
|
2457
2493
|
};
|
|
2494
|
+
var unmappedComponentMsg = (componentName) => ({
|
|
2495
|
+
message: `"${componentName}" has no Code Connect mapping`,
|
|
2496
|
+
suggestion: `Run /canicode-roundtrip on this component to register a mapping so figma-implement-design reuses your code instead of regenerating markup. Skip if intentionally unmapped.`
|
|
2497
|
+
});
|
|
2458
2498
|
var detachedInstanceMsg = (name, componentName) => ({
|
|
2459
2499
|
message: `"${name}" may be a detached instance of component "${componentName}"`,
|
|
2460
2500
|
suggestion: `Restore as an instance of "${componentName}" or create a new variant`
|
|
@@ -3006,8 +3046,6 @@ var irregularSpacing = defineRule({
|
|
|
3006
3046
|
definition: irregularSpacingDef,
|
|
3007
3047
|
check: irregularSpacingCheck
|
|
3008
3048
|
});
|
|
3009
|
-
|
|
3010
|
-
// src/core/rules/component/index.ts
|
|
3011
3049
|
var STYLE_COMPARE_KEYS = ["fills", "strokes", "effects", "cornerRadius", "strokeWeight", "individualStrokeWeights"];
|
|
3012
3050
|
function detectStyleOverrides(master, instance) {
|
|
3013
3051
|
const overrides = [];
|
|
@@ -3215,6 +3253,35 @@ var variantStructureMismatch = defineRule({
|
|
|
3215
3253
|
definition: variantStructureMismatchDef,
|
|
3216
3254
|
check: variantStructureMismatchCheck
|
|
3217
3255
|
});
|
|
3256
|
+
var CODE_CONNECT_SETUP_KEY = "unmapped-component:setup-detected";
|
|
3257
|
+
function codeConnectIsSetUp(context) {
|
|
3258
|
+
return getAnalysisState(context, CODE_CONNECT_SETUP_KEY, () => {
|
|
3259
|
+
return existsSync(join(process.cwd(), "figma.config.json"));
|
|
3260
|
+
});
|
|
3261
|
+
}
|
|
3262
|
+
var unmappedComponentDef = {
|
|
3263
|
+
id: "unmapped-component",
|
|
3264
|
+
name: "Unmapped Component",
|
|
3265
|
+
category: "code-quality",
|
|
3266
|
+
why: "Without a Code Connect mapping, figma-implement-design regenerates the same markup every time this component appears in a screen \u2014 wasting tokens and risking drift.",
|
|
3267
|
+
impact: "Future roundtrips on screens containing this component cannot reuse your existing code; they regenerate markup that may not match the canonical implementation.",
|
|
3268
|
+
fix: "Run /canicode-roundtrip on this component to register a mapping. Figma's get_code_connect_map will skip if a mapping already exists."
|
|
3269
|
+
};
|
|
3270
|
+
var unmappedComponentCheck = (node, context) => {
|
|
3271
|
+
if (node.type !== "COMPONENT" && node.type !== "COMPONENT_SET") return null;
|
|
3272
|
+
if (isInsideInstance(context)) return null;
|
|
3273
|
+
if (!codeConnectIsSetUp(context)) return null;
|
|
3274
|
+
return {
|
|
3275
|
+
ruleId: unmappedComponentDef.id,
|
|
3276
|
+
nodeId: node.id,
|
|
3277
|
+
nodePath: context.path.join(" > "),
|
|
3278
|
+
...unmappedComponentMsg(node.name)
|
|
3279
|
+
};
|
|
3280
|
+
};
|
|
3281
|
+
var unmappedComponent = defineRule({
|
|
3282
|
+
definition: unmappedComponentDef,
|
|
3283
|
+
check: unmappedComponentCheck
|
|
3284
|
+
});
|
|
3218
3285
|
|
|
3219
3286
|
// src/core/rules/naming/index.ts
|
|
3220
3287
|
function capitalize(s) {
|
|
@@ -5360,6 +5427,6 @@ var ActivityLogger = class {
|
|
|
5360
5427
|
}
|
|
5361
5428
|
};
|
|
5362
5429
|
|
|
5363
|
-
export { ALL_STRIP_TYPES, ActivityLogger, AnalysisFileSchema, AnalysisNodeSchema, AnalysisNodeTypeSchema, AnalysisScopeSchema, AnnotationPropertySchema, CATEGORIES, CATEGORY_LABELS, CalibrationConfigSchema, CalibrationStatusSchema, CategorySchema, CategoryScoreSchema, ConfidenceSchema, ConversionRecordSchema, DEFAULT_CODEGEN_READY_MIN_GRADE, DEPTH_WEIGHT_CATEGORIES, DESIGN_TREE_INFO_TYPES, DetectionSchema, DifficultySchema, FigmaClient, FigmaClientError, FigmaFileLoadError, FigmaUrlInfoSchema, FigmaUrlParseError, GRADE_ORDER, GapAnalyzerOutputSchema, GapEntrySchema, GotchaDetectionSchema, GotchaOutputChannelSchema, GotchaPersistenceIntentSchema, GotchaSurveyQuestionSchema, GotchaSurveySchema, GridChildAlignSchema, GroupedSurveySchema, InstanceContextSchema, IssueSchema, LayoutAlignSchema, LayoutConstraintSchema, LayoutModeSchema, LayoutPositioningSchema, LayoutWrapSchema, McpAnalyzeResponseSchema, MismatchCaseSchema, MismatchTypeSchema, NewRuleProposalSchema, NodeIssueSummarySchema, OutputChannelSchema, OverflowDirectionSchema, PersistenceIntentSchema, RULE_ANNOTATION_PROPERTIES, RULE_CONFIGS, RULE_ID_CATEGORY, RULE_PURPOSE, ReportMetadataSchema, ReportSchema, RuleApplyStrategySchema, RuleConfigSchema, RuleDefinitionSchema, RuleEngine, RuleImpactAssessmentSchema, RulePurposeSchema, RuleRelatedStruggleSchema, SEVERITY_LABELS, SEVERITY_WEIGHT, SamplingStrategySchema, ScoreAdjustmentSchema, SeveritySchema, StripDeltaResultSchema, StripDeltasArraySchema, StripTypeEnum, SurveyQuestionBatchSchema, SurveyQuestionGroupSchema, UncoveredStruggleSchema, UncoveredStrugglesInputSchema, version as VERSION, VisualCompareCliOptionsSchema, absolutePositionInAutoLayout, analyzeFile, buildFigmaDeepLink, buildResultJson, calculateScores, collectComponentIds, collectInteractionDestinationIds, createRuleEngine, deepNesting, defineRule, detachedInstance, detectAnalysisScope, extractRuleScores, fixedSizeInAutoLayout, formatScoreSummary, generateCalibrationReport, generateDesignTree, generateDesignTreeWithStats, getAnalysisState, getAnnotationProperties, getCategoryLabel, getConfigsWithPreset, getRuleOption, getRulePurpose, getSeverityLabel, gradeToClassName, inconsistentNamingConvention, irregularSpacing, isInstanceChildNodeId, isReadyForCodeGen, loadFigmaFileFromJson, missingComponent, missingInteractionState, missingPrototype, missingSizeConstraint, noAutoLayout, nonLayoutContainer, nonSemanticName, nonStandardNaming, parseFigmaJson, parseFigmaUrl, parseInstanceChildNodeId, rawValue, resolveComponentDefinitions, resolveGotchaApplyTarget, resolveInteractionDestinations, ruleRegistry, runAnalysisAgent, runCalibrationAnalyze, runCalibrationEvaluate, runEvaluationAgent, runTuningAgent, stripDeltaToDifficulty, stripDesignTree, supportsDepthWeight, toCommentableNodeId, tokenDeltaToDifficulty, transformComponentMasterNodes, transformFigmaResponse, transformFileNodesResponse, variantStructureMismatch };
|
|
5430
|
+
export { ALL_STRIP_TYPES, ActivityLogger, AnalysisFileSchema, AnalysisNodeSchema, AnalysisNodeTypeSchema, AnalysisScopeSchema, AnnotationPropertySchema, CATEGORIES, CATEGORY_LABELS, CalibrationConfigSchema, CalibrationStatusSchema, CategorySchema, CategoryScoreSchema, ConfidenceSchema, ConversionRecordSchema, DEFAULT_CODEGEN_READY_MIN_GRADE, DEPTH_WEIGHT_CATEGORIES, DESIGN_TREE_INFO_TYPES, DetectionSchema, DifficultySchema, FigmaClient, FigmaClientError, FigmaFileLoadError, FigmaUrlInfoSchema, FigmaUrlParseError, GRADE_ORDER, GapAnalyzerOutputSchema, GapEntrySchema, GotchaDetectionSchema, GotchaOutputChannelSchema, GotchaPersistenceIntentSchema, GotchaSurveyQuestionSchema, GotchaSurveySchema, GridChildAlignSchema, GroupedSurveySchema, InstanceContextSchema, IssueSchema, LayoutAlignSchema, LayoutConstraintSchema, LayoutModeSchema, LayoutPositioningSchema, LayoutWrapSchema, McpAnalyzeResponseSchema, MismatchCaseSchema, MismatchTypeSchema, NewRuleProposalSchema, NodeIssueSummarySchema, OutputChannelSchema, OverflowDirectionSchema, PersistenceIntentSchema, RULE_ANNOTATION_PROPERTIES, RULE_CONFIGS, RULE_ID_CATEGORY, RULE_PURPOSE, ReportMetadataSchema, ReportSchema, RuleApplyStrategySchema, RuleConfigSchema, RuleDefinitionSchema, RuleEngine, RuleImpactAssessmentSchema, RulePurposeSchema, RuleRelatedStruggleSchema, SEVERITY_LABELS, SEVERITY_WEIGHT, SamplingStrategySchema, ScoreAdjustmentSchema, SeveritySchema, StripDeltaResultSchema, StripDeltasArraySchema, StripTypeEnum, SurveyQuestionBatchSchema, SurveyQuestionGroupSchema, UncoveredStruggleSchema, UncoveredStrugglesInputSchema, version as VERSION, VisualCompareCliOptionsSchema, absolutePositionInAutoLayout, analyzeFile, buildFigmaDeepLink, buildResultJson, calculateScores, collectComponentIds, collectInteractionDestinationIds, createRuleEngine, deepNesting, defineRule, detachedInstance, detectAnalysisScope, extractRuleScores, fixedSizeInAutoLayout, formatScoreSummary, generateCalibrationReport, generateDesignTree, generateDesignTreeWithStats, getAnalysisState, getAnnotationProperties, getCategoryLabel, getConfigsWithPreset, getRuleOption, getRulePurpose, getSeverityLabel, gradeToClassName, inconsistentNamingConvention, irregularSpacing, isInstanceChildNodeId, isReadyForCodeGen, loadFigmaFileFromJson, missingComponent, missingInteractionState, missingPrototype, missingSizeConstraint, noAutoLayout, nonLayoutContainer, nonSemanticName, nonStandardNaming, parseFigmaJson, parseFigmaUrl, parseInstanceChildNodeId, rawValue, resolveComponentDefinitions, resolveGotchaApplyTarget, resolveInteractionDestinations, ruleRegistry, runAnalysisAgent, runCalibrationAnalyze, runCalibrationEvaluate, runEvaluationAgent, runTuningAgent, stripDeltaToDifficulty, stripDesignTree, supportsDepthWeight, toCommentableNodeId, tokenDeltaToDifficulty, transformComponentMasterNodes, transformFigmaResponse, transformFileNodesResponse, unmappedComponent, variantStructureMismatch };
|
|
5364
5431
|
//# sourceMappingURL=index.js.map
|
|
5365
5432
|
//# sourceMappingURL=index.js.map
|