apple-numbers-mcp 1.2.2 → 1.2.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.
Files changed (2) hide show
  1. package/build/index.js +51 -39
  2. package/package.json +3 -3
package/build/index.js CHANGED
@@ -2985,7 +2985,7 @@ var require_compile = __commonJS({
2985
2985
  const schOrFunc = root.refs[ref];
2986
2986
  if (schOrFunc)
2987
2987
  return schOrFunc;
2988
- let _sch = resolve3.call(this, root, ref);
2988
+ let _sch = resolve2.call(this, root, ref);
2989
2989
  if (_sch === void 0) {
2990
2990
  const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
2991
2991
  const { schemaId } = this.opts;
@@ -3012,7 +3012,7 @@ var require_compile = __commonJS({
3012
3012
  function sameSchemaEnv(s1, s2) {
3013
3013
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
3014
3014
  }
3015
- function resolve3(root, ref) {
3015
+ function resolve2(root, ref) {
3016
3016
  let sch;
3017
3017
  while (typeof (sch = this.refs[ref]) == "string")
3018
3018
  ref = sch;
@@ -3104,12 +3104,13 @@ var require_data = __commonJS({
3104
3104
  }
3105
3105
  });
3106
3106
 
3107
- // node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/utils.js
3107
+ // node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js
3108
3108
  var require_utils = __commonJS({
3109
- "node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/utils.js"(exports, module) {
3109
+ "node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/utils.js"(exports, module) {
3110
3110
  "use strict";
3111
3111
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
3112
3112
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
3113
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
3113
3114
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3114
3115
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3115
3116
  var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
@@ -3575,8 +3576,12 @@ var require_utils = __commonJS({
3575
3576
  uriTokens.push(host);
3576
3577
  }
3577
3578
  if (typeof component.port === "number" || typeof component.port === "string") {
3579
+ const port = String(component.port);
3580
+ if (!isPort(port)) {
3581
+ throw new TypeError("URI port is malformed.");
3582
+ }
3578
3583
  uriTokens.push(":");
3579
- uriTokens.push(String(component.port));
3584
+ uriTokens.push(port);
3580
3585
  }
3581
3586
  return uriTokens.length ? uriTokens.join("") : void 0;
3582
3587
  }
@@ -3601,9 +3606,9 @@ var require_utils = __commonJS({
3601
3606
  }
3602
3607
  });
3603
3608
 
3604
- // node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/schemes.js
3609
+ // node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js
3605
3610
  var require_schemes = __commonJS({
3606
- "node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3611
+ "node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/lib/schemes.js"(exports, module) {
3607
3612
  "use strict";
3608
3613
  var { isUUID } = require_utils();
3609
3614
  var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
@@ -3812,9 +3817,9 @@ var require_schemes = __commonJS({
3812
3817
  }
3813
3818
  });
3814
3819
 
3815
- // node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/index.js
3820
+ // node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js
3816
3821
  var require_fast_uri = __commonJS({
3817
- "node_modules/.pnpm/fast-uri@3.1.6/node_modules/fast-uri/index.js"(exports, module) {
3822
+ "node_modules/.pnpm/fast-uri@3.1.8/node_modules/fast-uri/index.js"(exports, module) {
3818
3823
  "use strict";
3819
3824
  var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3820
3825
  var { SCHEMES, getSchemeHandler } = require_schemes();
@@ -3837,7 +3842,7 @@ var require_fast_uri = __commonJS({
3837
3842
  }
3838
3843
  return uri;
3839
3844
  }
3840
- function resolve3(baseURI, relativeURI, options) {
3845
+ function resolve2(baseURI, relativeURI, options) {
3841
3846
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3842
3847
  const {
3843
3848
  parsed: baseParsed,
@@ -4019,12 +4024,15 @@ var require_fast_uri = __commonJS({
4019
4024
  }
4020
4025
  return false;
4021
4026
  }
4027
+ function isIPLiteral(host) {
4028
+ return host[0] === "[" && host[host.length - 1] === "]";
4029
+ }
4022
4030
  function hasMalformedComponentPercentEncoding(matches) {
4023
4031
  const host = matches[4];
4024
- return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !(host[0] === "[" && host[host.length - 1] === "]") && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4032
+ return hasMalformedPercentEncoding(matches[3]) || host !== void 0 && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
4025
4033
  }
4026
4034
  function canonicalizeHost(parsed, options, schemeHandler, isIP) {
4027
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && parsed.host[0] !== "[" && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4035
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
4028
4036
  try {
4029
4037
  parsed.host = new URL("http://" + parsed.host).hostname;
4030
4038
  } catch (e) {
@@ -4111,10 +4119,11 @@ var require_fast_uri = __commonJS({
4111
4119
  if (parsed.host) {
4112
4120
  const ipv4result = isIPv4(parsed.host);
4113
4121
  if (ipv4result === false) {
4114
- const bracketedIPLiteral = parsed.host[0] === "[" && parsed.host[parsed.host.length - 1] === "]";
4122
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
4123
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
4115
4124
  const ipv6result = normalizeIPv6(parsed.host);
4116
4125
  isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
4117
- malformedIPLiteral = bracketedIPLiteral && ipv6result.error === true;
4126
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
4118
4127
  parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
4119
4128
  if (malformedIPLiteral) {
4120
4129
  parsed.error = parsed.error || "URI host is malformed.";
@@ -4137,14 +4146,17 @@ var require_fast_uri = __commonJS({
4137
4146
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
4138
4147
  }
4139
4148
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
4140
- malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
4141
- if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4142
- if (uri.indexOf("%") !== -1) {
4143
- if (parsed.host !== void 0 && !malformedIPLiteral) {
4144
- const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4145
- parsed.host = reescapeHostDelimiters(host, isIP);
4146
- }
4149
+ if (!malformedIPLiteral) {
4150
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
4151
+ }
4152
+ if (uri.indexOf("%") !== -1 && parsed.host !== void 0 && !malformedIPLiteral) {
4153
+ let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
4154
+ if (!isIP) {
4155
+ host = normalizePercentEncoding(host.toLowerCase());
4147
4156
  }
4157
+ parsed.host = reescapeHostDelimiters(host, isIP);
4158
+ }
4159
+ if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
4148
4160
  if (parsed.path) {
4149
4161
  parsed.path = normalizePathEncoding(parsed.path);
4150
4162
  }
@@ -4199,7 +4211,7 @@ var require_fast_uri = __commonJS({
4199
4211
  var fastUri = {
4200
4212
  SCHEMES,
4201
4213
  normalize,
4202
- resolve: resolve3,
4214
+ resolve: resolve2,
4203
4215
  resolveComponent,
4204
4216
  equal,
4205
4217
  serialize,
@@ -19295,7 +19307,7 @@ var Protocol = class {
19295
19307
  return;
19296
19308
  }
19297
19309
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
19298
- await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
19310
+ await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
19299
19311
  options?.signal?.throwIfAborted();
19300
19312
  }
19301
19313
  } catch (error2) {
@@ -19312,7 +19324,7 @@ var Protocol = class {
19312
19324
  */
19313
19325
  request(request, resultSchema, options) {
19314
19326
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
19315
- return new Promise((resolve3, reject) => {
19327
+ return new Promise((resolve2, reject) => {
19316
19328
  const earlyReject = (error2) => {
19317
19329
  reject(error2);
19318
19330
  };
@@ -19390,7 +19402,7 @@ var Protocol = class {
19390
19402
  if (!parseResult.success) {
19391
19403
  reject(parseResult.error);
19392
19404
  } else {
19393
- resolve3(parseResult.data);
19405
+ resolve2(parseResult.data);
19394
19406
  }
19395
19407
  } catch (error2) {
19396
19408
  reject(error2);
@@ -19651,12 +19663,12 @@ var Protocol = class {
19651
19663
  }
19652
19664
  } catch {
19653
19665
  }
19654
- return new Promise((resolve3, reject) => {
19666
+ return new Promise((resolve2, reject) => {
19655
19667
  if (signal.aborted) {
19656
19668
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
19657
19669
  return;
19658
19670
  }
19659
- const timeoutId = setTimeout(resolve3, interval);
19671
+ const timeoutId = setTimeout(resolve2, interval);
19660
19672
  signal.addEventListener("abort", () => {
19661
19673
  clearTimeout(timeoutId);
19662
19674
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -20969,7 +20981,7 @@ var McpServer = class {
20969
20981
  let task = createTaskResult.task;
20970
20982
  const pollInterval = task.pollInterval ?? 5e3;
20971
20983
  while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
20972
- await new Promise((resolve3) => setTimeout(resolve3, pollInterval));
20984
+ await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
20973
20985
  const updatedTask = await extra.taskStore.getTask(taskId);
20974
20986
  if (!updatedTask) {
20975
20987
  throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
@@ -21657,12 +21669,12 @@ var StdioServerTransport = class {
21657
21669
  this.onclose?.();
21658
21670
  }
21659
21671
  send(message) {
21660
- return new Promise((resolve3) => {
21672
+ return new Promise((resolve2) => {
21661
21673
  const json2 = serializeMessage(message);
21662
21674
  if (this._stdout.write(json2)) {
21663
- resolve3();
21675
+ resolve2();
21664
21676
  } else {
21665
- this._stdout.once("drain", resolve3);
21677
+ this._stdout.once("drain", resolve2);
21666
21678
  }
21667
21679
  });
21668
21680
  }
@@ -22084,7 +22096,7 @@ function unmergeCells(filePath, sheet, table, startRow, startCol, endRow, endCol
22084
22096
  }
22085
22097
 
22086
22098
  // src/services/numbersManager.ts
22087
- import { existsSync as existsSync3 } from "node:fs";
22099
+ import { existsSync as existsSync2 } from "node:fs";
22088
22100
  import { extname } from "node:path";
22089
22101
 
22090
22102
  // src/utils/exportPath.ts
@@ -22215,7 +22227,7 @@ var NumbersManager = class {
22215
22227
  */
22216
22228
  validatePath(filePath) {
22217
22229
  const resolved = resolveWithinAllowedRoots(filePath, "Input path");
22218
- if (!existsSync3(resolved)) {
22230
+ if (!existsSync2(resolved)) {
22219
22231
  throw new Error(`File not found: ${resolved}`);
22220
22232
  }
22221
22233
  if (extname(resolved).toLowerCase() !== ".numbers") {
@@ -22408,7 +22420,7 @@ var NumbersManager = class {
22408
22420
  */
22409
22421
  importFile(inputPath, outputPath, options) {
22410
22422
  const inputResolved = this.resolveReadPath(inputPath);
22411
- if (!existsSync3(inputResolved)) {
22423
+ if (!existsSync2(inputResolved)) {
22412
22424
  throw new Error(`Input file not found: ${inputResolved}`);
22413
22425
  }
22414
22426
  const outputResolved = this.validateOutputPath(outputPath);
@@ -22546,7 +22558,7 @@ function withErrorHandling(handler, prefix) {
22546
22558
 
22547
22559
  // src/tools/doctor.ts
22548
22560
  import { execFileSync as execFileSync3 } from "node:child_process";
22549
- import { existsSync as existsSync4 } from "node:fs";
22561
+ import { existsSync as existsSync3 } from "node:fs";
22550
22562
  var NUMBERS_APP_PATHS = [
22551
22563
  "/Applications/Numbers.app",
22552
22564
  "/System/Applications/Numbers.app",
@@ -22555,7 +22567,7 @@ var NUMBERS_APP_PATHS = [
22555
22567
  ];
22556
22568
  var NUMBERS_BUNDLE_IDS = ["com.apple.Numbers", "com.apple.iWork.Numbers"];
22557
22569
  function findNumbersApp() {
22558
- const byPath = NUMBERS_APP_PATHS.find((p) => existsSync4(p));
22570
+ const byPath = NUMBERS_APP_PATHS.find((p) => existsSync3(p));
22559
22571
  if (byPath) return byPath;
22560
22572
  for (const id of NUMBERS_BUNDLE_IDS) {
22561
22573
  try {
@@ -22565,7 +22577,7 @@ function findNumbersApp() {
22565
22577
  { encoding: "utf8", timeout: 5e3, stdio: ["ignore", "pipe", "ignore"] }
22566
22578
  ).trim();
22567
22579
  const path = out.endsWith("/") ? out.slice(0, -1) : out;
22568
- if (path && existsSync4(path)) return path;
22580
+ if (path && existsSync3(path)) return path;
22569
22581
  } catch {
22570
22582
  }
22571
22583
  }
@@ -22742,7 +22754,7 @@ First use get-file-info and read-table to read the relevant table(s) so you know
22742
22754
  }
22743
22755
 
22744
22756
  // src/services/fileConfig.ts
22745
- import { existsSync as existsSync5, readFileSync as readFileSync2 } from "node:fs";
22757
+ import { existsSync as existsSync4, readFileSync as readFileSync2 } from "node:fs";
22746
22758
  import { join as join3 } from "node:path";
22747
22759
  import { homedir as homedir2 } from "node:os";
22748
22760
  function fileConfigPath(env = process.env) {
@@ -22753,7 +22765,7 @@ function fileConfigPath(env = process.env) {
22753
22765
  function loadFileConfig(env = process.env, path = fileConfigPath(env)) {
22754
22766
  const applied = [];
22755
22767
  try {
22756
- if (!existsSync5(path)) return applied;
22768
+ if (!existsSync4(path)) return applied;
22757
22769
  const parsed = JSON.parse(readFileSync2(path, "utf8"));
22758
22770
  if (!parsed || typeof parsed !== "object") return applied;
22759
22771
  for (const [k, v] of Object.entries(parsed)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apple-numbers-mcp",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "MCP server for Apple Numbers - read, write, search, and format .numbers spreadsheets via Claude and other AI assistants",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -55,7 +55,7 @@
55
55
  "@types/node": "^22.0.0",
56
56
  "@typescript-eslint/eslint-plugin": "^8.57.2",
57
57
  "@typescript-eslint/parser": "^8.57.2",
58
- "@vitest/coverage-v8": "^3.2.6",
58
+ "@vitest/coverage-v8": "^4.1.11",
59
59
  "ajv": "^8.17.1",
60
60
  "esbuild": "^0.28.1",
61
61
  "eslint": "^9.0.0",
@@ -63,7 +63,7 @@
63
63
  "lint-staged": "^16.2.7",
64
64
  "prettier": "^3.0.0",
65
65
  "typescript": "^5.5.0",
66
- "vitest": "^3.2.6"
66
+ "vitest": "^4.1.11"
67
67
  },
68
68
  "lint-staged": {
69
69
  "src/**/*.ts": [