toolcraft 0.0.21 → 0.0.23

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/dist/cli.js +7 -1
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -434,7 +434,9 @@ function getErrorMessage(error) {
434
434
  }
435
435
  function formatJsonParseUserErrorMessage(label, filePath, source, error, options) {
436
436
  const location = getJsonParseErrorLocation(error, source);
437
- const message = getErrorMessage(error);
437
+ const message = location === null
438
+ ? getErrorMessage(error)
439
+ : removeNativeJsonParseLocation(getErrorMessage(error), location);
438
440
  const positionText = location === null ? "" : ` at line ${location.line} column ${location.column}`;
439
441
  const formattedPath = options.quotePath ? `"${filePath}"` : filePath;
440
442
  const snippet = location === null
@@ -447,6 +449,10 @@ function formatJsonParseUserErrorMessage(label, filePath, source, error, options
447
449
  })}`;
448
450
  return `${label} ${formattedPath} is not valid JSON: ${message}${positionText}.${snippet}`;
449
451
  }
452
+ function removeNativeJsonParseLocation(message, location) {
453
+ const nativeSuffix = ` (line ${location.line} column ${location.column})`;
454
+ return message.endsWith(nativeSuffix) ? message.slice(0, -nativeSuffix.length) : message;
455
+ }
450
456
  function getJsonParseErrorLocation(error, source) {
451
457
  const causeLocation = getJsonParseCauseLocation(error);
452
458
  if (causeLocation !== null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "jsonc-parser": "^3.3.1",
51
51
  "smol-toml": "^1.3.0",
52
52
  "tiny-stdio-mcp-server": "^0.1.0",
53
- "toolcraft-schema": "^0.0.21",
53
+ "toolcraft-schema": "^0.0.23",
54
54
  "yaml": "^2.8.2"
55
55
  },
56
56
  "files": [