freshcontext-mcp 0.3.19 → 0.3.20

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.
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { existsSync } from "node:fs";
3
- import { spawnSync } from "node:child_process";
2
+ import { existsSync } from "node:fs";
3
+ import { spawnSync } from "node:child_process";
4
+ import { join } from "node:path";
4
5
 
5
6
  const SOURCE_CHECKOUT_MESSAGE = [
6
7
  "This npm script is for the FreshContext source checkout.",
@@ -39,13 +40,19 @@ const commands = {
39
40
  command: "tsx",
40
41
  args: ["examples/evaluate-with-source-profile.ts"],
41
42
  },
42
- "demo:evaluate:file": {
43
- required: ["examples/evaluate-file.ts", "examples/sources.academic.example.json"],
44
- command: "tsx",
45
- args: ["examples/evaluate-file.ts", "examples/sources.academic.example.json"],
46
- passThroughArgs: true,
47
- },
48
- "smoke:stdio": {
43
+ "demo:evaluate:file": {
44
+ required: ["examples/evaluate-file.ts", "examples/sources.academic.example.json"],
45
+ command: "tsx",
46
+ args: ["examples/evaluate-file.ts", "examples/sources.academic.example.json"],
47
+ passThroughArgs: true,
48
+ },
49
+ "batch:validate": {
50
+ required: ["examples/validate-signal-batch.ts"],
51
+ command: "tsx",
52
+ args: ["examples/validate-signal-batch.ts"],
53
+ passThroughArgs: true,
54
+ },
55
+ "smoke:stdio": {
49
56
  required: ["scripts/smoke-stdio.mjs"],
50
57
  command: "node",
51
58
  args: ["scripts/smoke-stdio.mjs"],
@@ -91,11 +98,17 @@ const commands = {
91
98
  "tests/freshnessStamp.test.ts",
92
99
  "tests/hackernews.test.ts",
93
100
  "tests/arxivSignals.test.ts",
94
- "tests/arxivDecisionIntegration.test.ts",
95
- "tests/core.test.ts",
96
- "tests/rank.test.ts",
97
- "tests/workerEnvelope.test.ts",
98
- "tests/workerCoreEnvelopeParity.test.ts",
101
+ "tests/arxivDecisionIntegration.test.ts",
102
+ "tests/core.test.ts",
103
+ "tests/haPriV2GoldenVectors.test.ts",
104
+ "tests/signalContractExamples.test.ts",
105
+ "tests/batchValidationHarness.test.ts",
106
+ "tests/rank.test.ts",
107
+ "tests/workerEnvelope.test.ts",
108
+ "tests/packageScriptGuard.test.mjs",
109
+ "tests/adapterNetworkBoundary.test.ts",
110
+ "tests/workerRouteSecurity.test.ts",
111
+ "tests/workerCoreEnvelopeParity.test.ts",
99
112
  "tests/coreEnvelopeOptions.test.ts",
100
113
  "tests/mathSpine.test.ts",
101
114
  "tests/coreApiContract.test.ts",
@@ -118,20 +131,54 @@ if (!config) {
118
131
  process.exit(1);
119
132
  }
120
133
 
121
- const hasSourceCheckoutFiles = config.required.every((path) => existsSync(path));
122
- if (!hasSourceCheckoutFiles) {
123
- console.log(SOURCE_CHECKOUT_MESSAGE);
124
- process.exit(0);
125
- }
126
-
127
- const args = [
128
- ...config.args,
129
- ...(config.passThroughArgs ? process.argv.slice(3) : []),
130
- ];
131
- const child = spawnSync(config.command, args, {
132
- stdio: "inherit",
133
- shell: process.platform === "win32",
134
- });
134
+ const hasSourceCheckoutFiles = config.required.every((path) => existsSync(path));
135
+ if (!hasSourceCheckoutFiles) {
136
+ console.log(SOURCE_CHECKOUT_MESSAGE);
137
+ process.exit(0);
138
+ }
139
+
140
+ function resolveCommand(command, args) {
141
+ if (command === "node") return { command: process.execPath, args };
142
+
143
+ const localNodeEntrypoints = {
144
+ tsx: join("node_modules", "tsx", "dist", "cli.mjs"),
145
+ tsc: join("node_modules", "typescript", "bin", "tsc"),
146
+ };
147
+ const nodeEntrypoint = localNodeEntrypoints[command];
148
+ if (nodeEntrypoint && existsSync(nodeEntrypoint)) {
149
+ return { command: process.execPath, args: [nodeEntrypoint, ...args] };
150
+ }
151
+
152
+ const localBin = process.platform === "win32"
153
+ ? join("node_modules", ".bin", `${command}.cmd`)
154
+ : join("node_modules", ".bin", command);
155
+
156
+ if (existsSync(localBin)) return { command: localBin, args };
157
+ if (process.platform === "win32" && !command.endsWith(".cmd")) {
158
+ return { command: `${command}.cmd`, args };
159
+ }
160
+ return { command, args };
161
+ }
162
+
163
+ function validatePassThroughArgs(args) {
164
+ for (const arg of args) {
165
+ if (arg.includes("\0")) {
166
+ console.error("FreshContext package script arguments cannot contain null bytes.");
167
+ process.exit(1);
168
+ }
169
+ }
170
+ return args;
171
+ }
172
+
173
+ const args = [
174
+ ...config.args,
175
+ ...(config.passThroughArgs ? validatePassThroughArgs(process.argv.slice(3)) : []),
176
+ ];
177
+ const invocation = resolveCommand(config.command, args);
178
+ const child = spawnSync(invocation.command, invocation.args, {
179
+ stdio: "inherit",
180
+ shell: false,
181
+ });
135
182
 
136
183
  if (child.error) {
137
184
  console.error(child.error.message);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "freshcontext-mcp",
3
3
  "mcpName": "io.github.PrinceGabriel-lgtm/freshcontext",
4
- "version": "0.3.19",
4
+ "version": "0.3.20",
5
5
  "description": "Context integrity infrastructure for AI agents and retrieval systems. Score, explain, and wrap candidate context before it reaches the model.",
6
6
  "keywords": [
7
7
  "mcp",
@@ -36,13 +36,17 @@
36
36
  ".env.example",
37
37
  "dist/",
38
38
  "!dist/apify.js",
39
+ "FRESHCONTEXT_SPEC.md",
40
+ "METHODOLOGY.md",
39
41
  "docs/API_DESIGN.md",
42
+ "docs/CLIENT_SETUP.md",
40
43
  "docs/CODEX_MCP_USAGE.md",
41
44
  "docs/CORE_MCP_BOUNDARY.md",
42
45
  "docs/CORE_API.md",
43
46
  "docs/DEPENDENCY_DILIGENCE.md",
44
47
  "docs/FUTURE_LANES.md",
45
48
  "docs/HA_PRI_V2_DESIGN.md",
49
+ "docs/HA_PRI_V2_PRODUCTION_ENFORCEMENT_PLAN.md",
46
50
  "docs/RELEASE_INTEGRITY.md",
47
51
  "docs/RELEASE_NOTES.md",
48
52
  "docs/SIGNAL_CONTRACT.md",
@@ -63,6 +67,7 @@
63
67
  "demo:arxiv": "node package-script-guard.mjs demo:arxiv",
64
68
  "demo:evaluate": "node package-script-guard.mjs demo:evaluate",
65
69
  "demo:evaluate:file": "node package-script-guard.mjs demo:evaluate:file",
70
+ "batch:validate": "node package-script-guard.mjs batch:validate",
66
71
  "smoke:stdio": "node package-script-guard.mjs smoke:stdio",
67
72
  "trust:gate": "node package-script-guard.mjs trust:gate",
68
73
  "trust:report": "node package-script-guard.mjs trust:report",
package/server.json CHANGED
@@ -6,13 +6,13 @@
6
6
  "url": "https://github.com/PrinceGabriel-lgtm/freshcontext-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.3.19",
9
+ "version": "0.3.20",
10
10
  "website_url": "https://freshcontext-site.pages.dev",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "npm",
14
14
  "identifier": "freshcontext-mcp",
15
- "version": "0.3.19",
15
+ "version": "0.3.20",
16
16
  "transport": {
17
17
  "type": "stdio"
18
18
  }