@lmzhen/dsh-evolution-maintenance 0.3.32 → 0.3.34

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.
Files changed (2) hide show
  1. package/lib/index.js +20 -7
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -112,13 +112,18 @@ function validateAndNormalizeMaintainPlan(raw, report, validSignals) {
112
112
  const protectedNames = /* @__PURE__ */ new Set();
113
113
  const factNames = /* @__PURE__ */ new Set();
114
114
  const canonicalByName = /* @__PURE__ */ new Map();
115
- const ambiguousNames = /* @__PURE__ */ new Set();
115
+ const spellingsByName = /* @__PURE__ */ new Map();
116
116
  for (const skill of report.skills) {
117
117
  const key = skill.name.trim().toLowerCase();
118
+ const trimmed = skill.name.trim();
118
119
  factNames.add(key);
119
- const existing = canonicalByName.get(key);
120
- if (existing !== void 0 && existing !== skill.name) ambiguousNames.add(key);
121
- else canonicalByName.set(key, skill.name);
120
+ let spellings = spellingsByName.get(key);
121
+ if (spellings === void 0) {
122
+ spellings = /* @__PURE__ */ new Set();
123
+ spellingsByName.set(key, spellings);
124
+ }
125
+ spellings.add(trimmed);
126
+ if (canonicalByName.get(key) === void 0) canonicalByName.set(key, trimmed);
122
127
  if (skill.protected) protectedNames.add(key);
123
128
  }
124
129
  if (!isRecord(raw)) return {
@@ -151,11 +156,19 @@ function validateAndNormalizeMaintainPlan(raw, report, validSignals) {
151
156
  if (rawNames.length === 0 || !rawNames.every(isNonEmptyString)) errors.push(`${path}.names: non-empty string array required`);
152
157
  else {
153
158
  namesOut = rawNames.map((nm) => {
159
+ const trimmed = nm.trim();
160
+ const key = trimmed.toLowerCase();
161
+ const spellings = spellingsByName.get(key);
162
+ if (spellings === void 0) return trimmed;
163
+ if (spellings.has(trimmed)) return trimmed;
164
+ if (spellings.size === 1) return canonicalByName.get(key) ?? trimmed;
165
+ return trimmed;
166
+ });
167
+ const ambiguousHit = namesOut.find((nm) => {
154
168
  const key = nm.trim().toLowerCase();
155
- if (ambiguousNames.has(key)) return nm.trim();
156
- return canonicalByName.get(key) ?? nm.trim();
169
+ const spellings = spellingsByName.get(key);
170
+ return spellings !== void 0 && spellings.size > 1 && !spellings.has(nm.trim());
157
171
  });
158
- const ambiguousHit = namesOut.find((nm) => ambiguousNames.has(nm.trim().toLowerCase()));
159
172
  if (ambiguousHit !== void 0) errors.push(`${path}.names: "${ambiguousHit}" matches multiple differently-cased skill names in the facts report — use the exact spelling`);
160
173
  else {
161
174
  const missing = namesOut.find((nm) => !factNames.has(nm.toLowerCase()));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-maintenance",
3
3
  "description": "Deterministic maintenance-scan surface: skill-library snapshot assembly, drift signals and mechanical-facts rendering (design 011) (community build)",
4
- "version": "0.3.32",
4
+ "version": "0.3.34",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -34,7 +34,7 @@
34
34
  ],
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
- "@lmzhen/dsh-evolution-core": "^0.3.32"
37
+ "@lmzhen/dsh-evolution-core": "^0.3.34"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",