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/mcp/server.js
CHANGED
|
@@ -1943,7 +1943,7 @@ function computeApplyContext(violation, instanceContext) {
|
|
|
1943
1943
|
}
|
|
1944
1944
|
|
|
1945
1945
|
// package.json
|
|
1946
|
-
var version = "0.12.
|
|
1946
|
+
var version = "0.12.2";
|
|
1947
1947
|
|
|
1948
1948
|
// src/core/engine/scoring.ts
|
|
1949
1949
|
var GRADE_ORDER = ["S", "A+", "A", "B+", "B", "C+", "C", "D", "F"];
|
|
@@ -5082,6 +5082,7 @@ defineRule({
|
|
|
5082
5082
|
});
|
|
5083
5083
|
var CODE_CONNECT_SETUP_KEY = "unmapped-component:setup-detected";
|
|
5084
5084
|
var CODE_CONNECT_MAPPINGS_KEY = "unmapped-component:mappings";
|
|
5085
|
+
var SEEN_MAIN_IDS_KEY = "unmapped-component:seen-main-ids";
|
|
5085
5086
|
function codeConnectIsSetUp(context) {
|
|
5086
5087
|
return getAnalysisState(context, CODE_CONNECT_SETUP_KEY, () => {
|
|
5087
5088
|
return existsSync(join(process.cwd(), "figma.config.json"));
|
|
@@ -5094,6 +5095,9 @@ function codeConnectMappings(context) {
|
|
|
5094
5095
|
() => parseCodeConnectMappings(process.cwd())
|
|
5095
5096
|
);
|
|
5096
5097
|
}
|
|
5098
|
+
function seenMainIds(context) {
|
|
5099
|
+
return getAnalysisState(context, SEEN_MAIN_IDS_KEY, () => /* @__PURE__ */ new Set());
|
|
5100
|
+
}
|
|
5097
5101
|
var unmappedComponentDef = {
|
|
5098
5102
|
id: "unmapped-component",
|
|
5099
5103
|
name: "Unmapped Component",
|
|
@@ -5103,20 +5107,33 @@ var unmappedComponentDef = {
|
|
|
5103
5107
|
fix: "Run /canicode-roundtrip on this component to register a mapping. Figma's get_code_connect_map will skip if a mapping already exists."
|
|
5104
5108
|
};
|
|
5105
5109
|
var unmappedComponentCheck = (node, context) => {
|
|
5106
|
-
if (node.type !== "COMPONENT" && node.type !== "COMPONENT_SET") return null;
|
|
5107
|
-
if (isInsideInstance(context)) return null;
|
|
5108
5110
|
if (!codeConnectIsSetUp(context)) return null;
|
|
5111
|
+
let mainId = null;
|
|
5112
|
+
let mainName = node.name;
|
|
5113
|
+
if (node.type === "COMPONENT" || node.type === "COMPONENT_SET") {
|
|
5114
|
+
if (isInsideInstance(context)) return null;
|
|
5115
|
+
mainId = node.id;
|
|
5116
|
+
} else if (node.type === "INSTANCE" && node.componentId) {
|
|
5117
|
+
mainId = node.componentId;
|
|
5118
|
+
const meta = context.file.components[node.componentId];
|
|
5119
|
+
if (meta?.name) mainName = meta.name;
|
|
5120
|
+
} else {
|
|
5121
|
+
return null;
|
|
5122
|
+
}
|
|
5123
|
+
const seen = seenMainIds(context);
|
|
5124
|
+
if (seen.has(mainId)) return null;
|
|
5125
|
+
seen.add(mainId);
|
|
5109
5126
|
const mappings = codeConnectMappings(context);
|
|
5110
|
-
if (mappings.mappedNodeIds.has(
|
|
5111
|
-
const ack = context.findAcknowledgment(
|
|
5127
|
+
if (mappings.mappedNodeIds.has(mainId)) return null;
|
|
5128
|
+
const ack = context.findAcknowledgment(mainId, unmappedComponentDef.id);
|
|
5112
5129
|
if (ack && isRuleOptOutIntent(ack.intent) && ack.intent.ruleId === unmappedComponentDef.id) {
|
|
5113
5130
|
return null;
|
|
5114
5131
|
}
|
|
5115
5132
|
return {
|
|
5116
5133
|
ruleId: unmappedComponentDef.id,
|
|
5117
|
-
nodeId:
|
|
5134
|
+
nodeId: mainId,
|
|
5118
5135
|
nodePath: context.path.join(" > "),
|
|
5119
|
-
...unmappedComponentMsg(
|
|
5136
|
+
...unmappedComponentMsg(mainName)
|
|
5120
5137
|
};
|
|
5121
5138
|
};
|
|
5122
5139
|
defineRule({
|