xlsx-for-ai 2.19.0 → 2.19.1

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/register.js +33 -1
  2. package/package.json +1 -1
package/lib/register.js CHANGED
@@ -8,6 +8,12 @@
8
8
  *
9
9
  * Writes result to config and returns { client_id, api_key }.
10
10
  * Idempotent: if config already has api_key, returns it immediately.
11
+ *
12
+ * CI gate: when running in a CI environment (CI=true, GITHUB_ACTIONS=true,
13
+ * or XLSX_FOR_AI_CI=1) we skip registration entirely. This stops automated
14
+ * smoke tests + clean-install verifications from polluting the production
15
+ * client_id pool with synthetic per-publish UUIDs that don't represent
16
+ * real human users.
11
17
  */
12
18
 
13
19
  const os = require('os');
@@ -19,7 +25,33 @@ function platform() {
19
25
  return `${process.platform}-${process.arch}`;
20
26
  }
21
27
 
28
+ // Detect common CI signals. Bias is toward FALSE POSITIVES on the CI side
29
+ // (a real user running with CI=true in their shell will get the same skip).
30
+ // Those cases are vanishingly rare, and the cost of a missed CI gate is much
31
+ // higher: polluted analytics + 1M MAU dilution.
32
+ function isCiEnvironment() {
33
+ if (process.env.XLSX_FOR_AI_CI === '1') return true;
34
+ // GitHub Actions auto-sets CI=true AND GITHUB_ACTIONS=true. Other major
35
+ // providers also set CI=true (CircleCI, GitLab, Travis, Azure Pipelines,
36
+ // BuildKite, Drone, Jenkins via plugin).
37
+ if (process.env.CI === 'true' || process.env.CI === '1') return true;
38
+ if (process.env.GITHUB_ACTIONS === 'true') return true;
39
+ return false;
40
+ }
41
+
22
42
  async function ensureRegistered() {
43
+ if (isCiEnvironment()) {
44
+ // Return a sentinel handle. api_key prefix 'xfa_ci_' is invalid format,
45
+ // so any tool call would 401 with a clear "Invalid API key" rather than
46
+ // silently using a leaked real key. CI smoke tests that only call
47
+ // --version short-circuit before reaching this anyway.
48
+ return {
49
+ client_id: '00000000-0000-0000-0000-000000000000',
50
+ api_key: 'xfa_ci_skip_registration',
51
+ ci_skipped: true,
52
+ };
53
+ }
54
+
23
55
  const cfg = readConfig();
24
56
  if (cfg && cfg.api_key && cfg.client_id) {
25
57
  return { client_id: cfg.client_id, api_key: cfg.api_key };
@@ -34,4 +66,4 @@ async function ensureRegistered() {
34
66
  return { client_id: data.client_id, api_key: data.api_key };
35
67
  }
36
68
 
37
- module.exports = { ensureRegistered };
69
+ module.exports = { ensureRegistered, isCiEnvironment };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xlsx-for-ai",
3
3
  "mcpName": "io.github.senoff/xlsx-for-ai",
4
- "version": "2.19.0",
4
+ "version": "2.19.1",
5
5
  "description": "The MCP server that makes LLMs reliable on real-world Excel spreadsheets. Thin npm client over a hosted API — read, write, diff, redact, and supervise .xlsx files from any MCP-aware agent.",
6
6
  "main": "index.js",
7
7
  "bin": {