canicode 0.12.1 → 0.12.2
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/cli/index.js +47 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +24 -7
- package/dist/mcp/server.js.map +1 -1
- package/package.json +1 -1
- package/skills/canicode-roundtrip/SKILL.md +16 -0
- 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 +16 -0
- 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
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.12.
|
|
9
|
+
var version = "0.12.2";
|
|
10
10
|
var SeveritySchema = z.enum([
|
|
11
11
|
"blocking",
|
|
12
12
|
"risk",
|
|
@@ -3442,6 +3442,7 @@ var variantStructureMismatch = defineRule({
|
|
|
3442
3442
|
});
|
|
3443
3443
|
var CODE_CONNECT_SETUP_KEY = "unmapped-component:setup-detected";
|
|
3444
3444
|
var CODE_CONNECT_MAPPINGS_KEY = "unmapped-component:mappings";
|
|
3445
|
+
var SEEN_MAIN_IDS_KEY = "unmapped-component:seen-main-ids";
|
|
3445
3446
|
function codeConnectIsSetUp(context) {
|
|
3446
3447
|
return getAnalysisState(context, CODE_CONNECT_SETUP_KEY, () => {
|
|
3447
3448
|
return existsSync(join(process.cwd(), "figma.config.json"));
|
|
@@ -3454,6 +3455,9 @@ function codeConnectMappings(context) {
|
|
|
3454
3455
|
() => parseCodeConnectMappings(process.cwd())
|
|
3455
3456
|
);
|
|
3456
3457
|
}
|
|
3458
|
+
function seenMainIds(context) {
|
|
3459
|
+
return getAnalysisState(context, SEEN_MAIN_IDS_KEY, () => /* @__PURE__ */ new Set());
|
|
3460
|
+
}
|
|
3457
3461
|
var unmappedComponentDef = {
|
|
3458
3462
|
id: "unmapped-component",
|
|
3459
3463
|
name: "Unmapped Component",
|
|
@@ -3463,20 +3467,33 @@ var unmappedComponentDef = {
|
|
|
3463
3467
|
fix: "Run /canicode-roundtrip on this component to register a mapping. Figma's get_code_connect_map will skip if a mapping already exists."
|
|
3464
3468
|
};
|
|
3465
3469
|
var unmappedComponentCheck = (node, context) => {
|
|
3466
|
-
if (node.type !== "COMPONENT" && node.type !== "COMPONENT_SET") return null;
|
|
3467
|
-
if (isInsideInstance(context)) return null;
|
|
3468
3470
|
if (!codeConnectIsSetUp(context)) return null;
|
|
3471
|
+
let mainId = null;
|
|
3472
|
+
let mainName = node.name;
|
|
3473
|
+
if (node.type === "COMPONENT" || node.type === "COMPONENT_SET") {
|
|
3474
|
+
if (isInsideInstance(context)) return null;
|
|
3475
|
+
mainId = node.id;
|
|
3476
|
+
} else if (node.type === "INSTANCE" && node.componentId) {
|
|
3477
|
+
mainId = node.componentId;
|
|
3478
|
+
const meta = context.file.components[node.componentId];
|
|
3479
|
+
if (meta?.name) mainName = meta.name;
|
|
3480
|
+
} else {
|
|
3481
|
+
return null;
|
|
3482
|
+
}
|
|
3483
|
+
const seen = seenMainIds(context);
|
|
3484
|
+
if (seen.has(mainId)) return null;
|
|
3485
|
+
seen.add(mainId);
|
|
3469
3486
|
const mappings = codeConnectMappings(context);
|
|
3470
|
-
if (mappings.mappedNodeIds.has(
|
|
3471
|
-
const ack = context.findAcknowledgment(
|
|
3487
|
+
if (mappings.mappedNodeIds.has(mainId)) return null;
|
|
3488
|
+
const ack = context.findAcknowledgment(mainId, unmappedComponentDef.id);
|
|
3472
3489
|
if (ack && isRuleOptOutIntent(ack.intent) && ack.intent.ruleId === unmappedComponentDef.id) {
|
|
3473
3490
|
return null;
|
|
3474
3491
|
}
|
|
3475
3492
|
return {
|
|
3476
3493
|
ruleId: unmappedComponentDef.id,
|
|
3477
|
-
nodeId:
|
|
3494
|
+
nodeId: mainId,
|
|
3478
3495
|
nodePath: context.path.join(" > "),
|
|
3479
|
-
...unmappedComponentMsg(
|
|
3496
|
+
...unmappedComponentMsg(mainName)
|
|
3480
3497
|
};
|
|
3481
3498
|
};
|
|
3482
3499
|
var unmappedComponent = defineRule({
|