canicode 0.10.1 → 0.10.3
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/README.md +3 -1
- package/dist/cli/index.js +95 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +57 -2
- package/dist/mcp/server.js.map +1 -1
- package/package.json +2 -2
- package/skills/canicode-roundtrip/SKILL.md +122 -19
- package/skills/canicode-roundtrip/helpers.js +54 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { GetFileResponse, Node } from '@figma/rest-api-spec';
|
|
3
3
|
|
|
4
|
-
var version = "0.10.
|
|
4
|
+
var version = "0.10.3";
|
|
5
5
|
|
|
6
6
|
declare const SeveritySchema: z.ZodEnum<{
|
|
7
7
|
blocking: "blocking";
|
|
@@ -652,6 +652,8 @@ declare const GotchaSurveyQuestionSchema: z.ZodObject<{
|
|
|
652
652
|
suggestedName: z.ZodOptional<z.ZodString>;
|
|
653
653
|
isInstanceChild: z.ZodBoolean;
|
|
654
654
|
sourceChildId: z.ZodOptional<z.ZodString>;
|
|
655
|
+
replicas: z.ZodOptional<z.ZodNumber>;
|
|
656
|
+
replicaNodeIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
655
657
|
}, z.core.$strip>;
|
|
656
658
|
type GotchaSurveyQuestion = z.infer<typeof GotchaSurveyQuestionSchema>;
|
|
657
659
|
declare const GotchaSurveySchema: z.ZodObject<{
|
|
@@ -699,6 +701,8 @@ declare const GotchaSurveySchema: z.ZodObject<{
|
|
|
699
701
|
suggestedName: z.ZodOptional<z.ZodString>;
|
|
700
702
|
isInstanceChild: z.ZodBoolean;
|
|
701
703
|
sourceChildId: z.ZodOptional<z.ZodString>;
|
|
704
|
+
replicas: z.ZodOptional<z.ZodNumber>;
|
|
705
|
+
replicaNodeIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
702
706
|
}, z.core.$strip>>;
|
|
703
707
|
}, z.core.$strip>;
|
|
704
708
|
type GotchaSurvey = z.infer<typeof GotchaSurveySchema>;
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import 'crypto';
|
|
|
6
6
|
import { homedir } from 'os';
|
|
7
7
|
|
|
8
8
|
// package.json
|
|
9
|
-
var version = "0.10.
|
|
9
|
+
var version = "0.10.3";
|
|
10
10
|
var SeveritySchema = z.enum([
|
|
11
11
|
"blocking",
|
|
12
12
|
"risk",
|
|
@@ -353,7 +353,15 @@ var GotchaSurveyQuestionSchema = z.object({
|
|
|
353
353
|
annotationProperties: z.array(AnnotationPropertySchema).optional(),
|
|
354
354
|
suggestedName: z.string().optional(),
|
|
355
355
|
isInstanceChild: z.boolean(),
|
|
356
|
-
sourceChildId: z.string().optional()
|
|
356
|
+
sourceChildId: z.string().optional(),
|
|
357
|
+
// #356: when this question collapses N instance-child issues that share the
|
|
358
|
+
// same `(sourceComponentId, sourceNodeId, ruleId)` tuple, `replicas` is the
|
|
359
|
+
// total instance count (>=2) and `replicaNodeIds` lists every instance scene
|
|
360
|
+
// node id OTHER than the kept `nodeId`. Apply step iterates
|
|
361
|
+
// `[nodeId, ...replicaNodeIds]` so the same answer lands on every replica.
|
|
362
|
+
// Single-instance questions omit both fields.
|
|
363
|
+
replicas: z.number().int().min(2).optional(),
|
|
364
|
+
replicaNodeIds: z.array(z.string()).optional()
|
|
357
365
|
});
|
|
358
366
|
var GotchaSurveySchema = z.object({
|
|
359
367
|
designGrade: GradeSchema2,
|
|
@@ -3156,6 +3164,15 @@ function hasStateInComponentMaster(node, context, statePattern) {
|
|
|
3156
3164
|
if (!master) return false;
|
|
3157
3165
|
return hasStateInVariantProps(master, statePattern);
|
|
3158
3166
|
}
|
|
3167
|
+
function canDetermineVariants(node, context) {
|
|
3168
|
+
if (node.type === "COMPONENT") return true;
|
|
3169
|
+
if (node.componentPropertyDefinitions !== void 0) return true;
|
|
3170
|
+
if (node.componentId !== void 0) {
|
|
3171
|
+
const defs = context.file.componentDefinitions;
|
|
3172
|
+
if (defs && defs[node.componentId] !== void 0) return true;
|
|
3173
|
+
}
|
|
3174
|
+
return false;
|
|
3175
|
+
}
|
|
3159
3176
|
var missingInteractionStateDef = {
|
|
3160
3177
|
id: "missing-interaction-state",
|
|
3161
3178
|
name: "Missing Interaction State",
|
|
@@ -3170,6 +3187,7 @@ var missingInteractionStateCheck = (node, context) => {
|
|
|
3170
3187
|
if (!interactiveType) return null;
|
|
3171
3188
|
const expectedStates = EXPECTED_STATES[interactiveType];
|
|
3172
3189
|
if (!expectedStates) return null;
|
|
3190
|
+
if (!canDetermineVariants(node, context)) return null;
|
|
3173
3191
|
const seen = getSeen(context);
|
|
3174
3192
|
const nodePath = context.path.join(" > ");
|
|
3175
3193
|
for (const state of expectedStates) {
|