canicode 0.12.3 → 0.12.4
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/CHANGELOG.md +172 -0
- package/README.md +46 -65
- package/dist/cli/index.js +46 -11
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -11
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +46 -11
- package/dist/mcp/server.js.map +1 -1
- package/package.json +3 -1
- package/skills/canicode-roundtrip/helpers-bootstrap.js +1 -1
- package/skills/canicode-roundtrip/helpers-installer.js +1 -1
- 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
|
@@ -1946,7 +1946,7 @@ function computeApplyContext(violation, instanceContext) {
|
|
|
1946
1946
|
}
|
|
1947
1947
|
|
|
1948
1948
|
// package.json
|
|
1949
|
-
var version = "0.12.
|
|
1949
|
+
var version = "0.12.4";
|
|
1950
1950
|
|
|
1951
1951
|
// src/core/engine/scoring.ts
|
|
1952
1952
|
var GRADE_ORDER = ["S", "A+", "A", "B+", "B", "C+", "C", "D", "F"];
|
|
@@ -3691,6 +3691,22 @@ body {
|
|
|
3691
3691
|
border: 1px solid rgba(239,68,68,0.15);
|
|
3692
3692
|
}
|
|
3693
3693
|
|
|
3694
|
+
/* ---- Warning (skipped nodes, etc.) ---- */
|
|
3695
|
+
.warning-msg {
|
|
3696
|
+
background: var(--amber-bg);
|
|
3697
|
+
color: #92400e;
|
|
3698
|
+
padding: 10px 12px;
|
|
3699
|
+
border-radius: var(--radius-sm);
|
|
3700
|
+
font-size: 12px;
|
|
3701
|
+
margin-bottom: 16px;
|
|
3702
|
+
border: 1px solid rgba(245,158,11,0.2);
|
|
3703
|
+
}
|
|
3704
|
+
.warning-msg details { margin-top: 8px; }
|
|
3705
|
+
.warning-msg summary { cursor: pointer; font-weight: 500; }
|
|
3706
|
+
.warning-msg ul { margin: 8px 0 0 16px; padding: 0; }
|
|
3707
|
+
.warning-msg li { margin: 4px 0; }
|
|
3708
|
+
.warning-msg a { color: inherit; text-decoration: underline; }
|
|
3709
|
+
|
|
3694
3710
|
/* ---- Layout (plugin) ---- */
|
|
3695
3711
|
.container { padding: 16px; }
|
|
3696
3712
|
.header {
|
|
@@ -4760,6 +4776,10 @@ defineRule({
|
|
|
4760
4776
|
function isOnGrid(value, gridBase) {
|
|
4761
4777
|
return value % gridBase === 0;
|
|
4762
4778
|
}
|
|
4779
|
+
function hasOwnBoundVariables(obj) {
|
|
4780
|
+
const bv = obj["boundVariables"];
|
|
4781
|
+
return bv !== void 0 && bv !== null && Object.keys(bv).length > 0;
|
|
4782
|
+
}
|
|
4763
4783
|
var rawValueDef = {
|
|
4764
4784
|
id: "raw-value",
|
|
4765
4785
|
name: "Raw Value",
|
|
@@ -4774,6 +4794,7 @@ var rawValueCheck = (node, context) => {
|
|
|
4774
4794
|
if (!hasStyleReference(node, "fill") && !hasBoundVariable(node, "fills")) {
|
|
4775
4795
|
for (const fill of node.fills) {
|
|
4776
4796
|
const fillObj = fill;
|
|
4797
|
+
if (hasOwnBoundVariables(fillObj)) continue;
|
|
4777
4798
|
if (fillObj["type"] === "SOLID" && fillObj["color"]) {
|
|
4778
4799
|
const c = fillObj["color"];
|
|
4779
4800
|
const hex = `#${Math.round((c["r"] ?? 0) * 255).toString(16).padStart(2, "0")}${Math.round((c["g"] ?? 0) * 255).toString(16).padStart(2, "0")}${Math.round((c["b"] ?? 0) * 255).toString(16).padStart(2, "0")}`.toUpperCase();
|
|
@@ -4808,9 +4829,10 @@ var rawValueCheck = (node, context) => {
|
|
|
4808
4829
|
}
|
|
4809
4830
|
}
|
|
4810
4831
|
if (node.effects && Array.isArray(node.effects) && node.effects.length > 0) {
|
|
4811
|
-
if (!hasStyleReference(node, "effect")) {
|
|
4832
|
+
if (!hasStyleReference(node, "effect") && !hasBoundVariable(node, "effects")) {
|
|
4812
4833
|
for (const effect of node.effects) {
|
|
4813
4834
|
const effectObj = effect;
|
|
4835
|
+
if (hasOwnBoundVariables(effectObj)) continue;
|
|
4814
4836
|
if (effectObj["type"] === "DROP_SHADOW" || effectObj["type"] === "INNER_SHADOW") {
|
|
4815
4837
|
const shadowType = effectObj["type"] === "DROP_SHADOW" ? "drop shadow" : "inner shadow";
|
|
4816
4838
|
const offset = effectObj["offset"];
|
|
@@ -4841,6 +4863,7 @@ var rawValueCheck = (node, context) => {
|
|
|
4841
4863
|
}
|
|
4842
4864
|
const spacingKeys = ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "itemSpacing"];
|
|
4843
4865
|
for (const key of spacingKeys) {
|
|
4866
|
+
if (key === "itemSpacing" && node.primaryAxisAlignItems === "SPACE_BETWEEN") continue;
|
|
4844
4867
|
const value = node[key];
|
|
4845
4868
|
if (value !== void 0 && value > 0 && !hasBoundVariable(node, key)) {
|
|
4846
4869
|
const label = key === "itemSpacing" ? "gap" : key.replace("padding", "padding-").toLowerCase();
|
|
@@ -4873,14 +4896,15 @@ var irregularSpacingCheck = (node, context, options) => {
|
|
|
4873
4896
|
const spacingEntries = [];
|
|
4874
4897
|
for (const key of ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom"]) {
|
|
4875
4898
|
const v = node[key];
|
|
4876
|
-
if (v !== void 0 && v > 0) spacingEntries.push({ value: v, subType: "padding" });
|
|
4899
|
+
if (v !== void 0 && v > 0) spacingEntries.push({ key, value: v, subType: "padding" });
|
|
4877
4900
|
}
|
|
4878
|
-
if (node.itemSpacing !== void 0 && node.itemSpacing > 0) {
|
|
4879
|
-
spacingEntries.push({ value: node.itemSpacing, subType: "gap" });
|
|
4901
|
+
if (node.itemSpacing !== void 0 && node.itemSpacing > 0 && node.primaryAxisAlignItems !== "SPACE_BETWEEN") {
|
|
4902
|
+
spacingEntries.push({ key: "itemSpacing", value: node.itemSpacing, subType: "gap" });
|
|
4880
4903
|
}
|
|
4881
4904
|
const commonValues = [1, 2];
|
|
4882
4905
|
for (const entry of spacingEntries) {
|
|
4883
4906
|
if (commonValues.includes(entry.value)) continue;
|
|
4907
|
+
if (hasBoundVariable(node, entry.key)) continue;
|
|
4884
4908
|
if (!isOnGrid(entry.value, gridBase)) {
|
|
4885
4909
|
return {
|
|
4886
4910
|
ruleId: irregularSpacingDef.id,
|
|
@@ -5138,17 +5162,28 @@ defineRule({
|
|
|
5138
5162
|
var CODE_CONNECT_SETUP_KEY = "unmapped-component:setup-detected";
|
|
5139
5163
|
var CODE_CONNECT_MAPPINGS_KEY = "unmapped-component:mappings";
|
|
5140
5164
|
var SEEN_MAIN_IDS_KEY = "unmapped-component:seen-main-ids";
|
|
5165
|
+
function browserCwd() {
|
|
5166
|
+
return typeof process !== "undefined" && typeof process.cwd === "function" ? process.cwd() : null;
|
|
5167
|
+
}
|
|
5141
5168
|
function codeConnectIsSetUp(context) {
|
|
5142
5169
|
return getAnalysisState(context, CODE_CONNECT_SETUP_KEY, () => {
|
|
5143
|
-
|
|
5170
|
+
const cwd = browserCwd();
|
|
5171
|
+
if (cwd === null) return false;
|
|
5172
|
+
return existsSync(join(cwd, "figma.config.json"));
|
|
5144
5173
|
});
|
|
5145
5174
|
}
|
|
5146
5175
|
function codeConnectMappings(context) {
|
|
5147
|
-
return getAnalysisState(
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5176
|
+
return getAnalysisState(context, CODE_CONNECT_MAPPINGS_KEY, () => {
|
|
5177
|
+
const cwd = browserCwd();
|
|
5178
|
+
if (cwd === null) {
|
|
5179
|
+
return {
|
|
5180
|
+
mappedNodeIds: /* @__PURE__ */ new Set(),
|
|
5181
|
+
scannedFiles: [],
|
|
5182
|
+
skipReason: "no-config"
|
|
5183
|
+
};
|
|
5184
|
+
}
|
|
5185
|
+
return parseCodeConnectMappings(cwd);
|
|
5186
|
+
});
|
|
5152
5187
|
}
|
|
5153
5188
|
function seenMainIds(context) {
|
|
5154
5189
|
return getAnalysisState(context, SEEN_MAIN_IDS_KEY, () => /* @__PURE__ */ new Set());
|