nulladrift 0.10.1 → 0.11.0

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.
package/README.md CHANGED
@@ -143,6 +143,16 @@ describes the new code. The same npm version arriving with different bytes is
143
143
  `server.artifact.substituted`, which has no innocent explanation. `--no-provenance` skips the
144
144
  registry lookups for an air-gapped run.
145
145
 
146
+ **Name an exact version in the config.** `npx -y @modelcontextprotocol/server-memory` and
147
+ `uvx mcp-server-fetch` run whatever was published last, so every upstream release is a different
148
+ artifact and fails `check` with nothing in the project changed. `init`, `check` and `push` say
149
+ which servers are written that way and give the spec for what runs now, such as
150
+ `@modelcontextprotocol/server-memory@2.2.1`, `mcp-server-fetch==2026.11.18` or an image by digest.
151
+ Written that way, an upgrade is a pull request that changes the version, and the drift it brings
152
+ is reviewed there. Changing the command is itself reported once, as `server.transport.changed`;
153
+ accept it with `nulladrift review`. An image with a version tag is left alone, and the warning
154
+ never changes the exit code.
155
+
146
156
  **What it leaves out: credentials, wherever a config puts them.** `env` and header values are
147
157
  recorded by name only, and a URL loses its query string and `user:password`. A credential
148
158
  written literally (`--api-key sk-...`, `-e GITHUB_TOKEN=ghp_...`, a connection string's password,
package/dist/index.js CHANGED
@@ -2441,7 +2441,7 @@ import { readFile as readFile3 } from "fs/promises";
2441
2441
  import { isAbsolute as isAbsolute2, resolve as resolve3 } from "path";
2442
2442
 
2443
2443
  // src/lib/version.ts
2444
- var VERSION = "0.10.1";
2444
+ var VERSION = "0.11.0";
2445
2445
  var USER_AGENT = `nulladrift/${VERSION} (+https://github.com/Nulladrift/nulladrift)`;
2446
2446
 
2447
2447
  // src/lock/provenance.ts
@@ -2722,6 +2722,35 @@ function isExact(reference) {
2722
2722
  return false;
2723
2723
  }
2724
2724
  }
2725
+ function floatingRequest(reference, provenance2) {
2726
+ const found = provenance2?.ecosystem === reference.ecosystem && provenance2.name === reference.name ? provenance2 : void 0;
2727
+ switch (reference.ecosystem) {
2728
+ case "npm":
2729
+ if (isExact(reference)) return void 0;
2730
+ return {
2731
+ ecosystem: "npm",
2732
+ name: reference.name,
2733
+ asked: reference.requested === void 0 ? reference.name : `${reference.name}@${reference.requested}`,
2734
+ ...found?.version === void 0 ? {} : { exact: `${reference.name}@${found.version}` }
2735
+ };
2736
+ case "pypi": {
2737
+ if (isExact(reference)) return void 0;
2738
+ const asked = reference.requested === void 0 ? reference.name : /^[=<>~!]/.test(reference.requested) ? `${reference.name}${reference.requested}` : `${reference.name}@${reference.requested}`;
2739
+ return { ecosystem: "pypi", name: reference.name, asked, ...found?.version === void 0 ? {} : { exact: `${reference.name}==${found.version}` } };
2740
+ }
2741
+ case "oci":
2742
+ if (reference.digest !== void 0 || reference.requested !== "latest") return void 0;
2743
+ return {
2744
+ ecosystem: "oci",
2745
+ name: reference.name,
2746
+ asked: `${reference.name}:latest`,
2747
+ // By digest, the only name for an image that cannot be pointed somewhere else.
2748
+ ...found?.integrity === void 0 ? {} : { exact: `${reference.name}@${found.integrity}` }
2749
+ };
2750
+ case "file":
2751
+ return void 0;
2752
+ }
2753
+ }
2725
2754
  var NPM_PUBLIC = "https://registry.npmjs.org";
2726
2755
  function npmEnv(env, name) {
2727
2756
  const wanted = name.toLowerCase();
@@ -2934,6 +2963,14 @@ function ancestors(start) {
2934
2963
  function npmPrefix(start) {
2935
2964
  return ancestors(start).find((dir) => existsSync(join2(dir, "package.json")) || existsSync(join2(dir, "node_modules"))) ?? resolve4(start);
2936
2965
  }
2966
+ function installedCopy(transport2, reference, context) {
2967
+ const name = commandName(transport2.command);
2968
+ if (name === "pnpm" || name === "yarn" || name === "pnpx") return false;
2969
+ const bin = reference.name.split("/").pop();
2970
+ return ancestors(transport2.cwd ?? context.projectRoot).some(
2971
+ (dir) => existsSync(join2(dir, "node_modules", ...reference.name.split("/"), "package.json")) || existsSync(join2(dir, "node_modules", ".bin", bin))
2972
+ );
2973
+ }
2937
2974
  function npmElsewhere(transport2, reference, context) {
2938
2975
  const env = context.env ?? process.env;
2939
2976
  const name = commandName(transport2.command);
@@ -2941,14 +2978,7 @@ function npmElsewhere(transport2, reference, context) {
2941
2978
  const launcherEnv = { ...env, ...transport2.env };
2942
2979
  const options = launcherOptions(afterSubcommand(name, transport2.args), NPM_VALUE_FLAGS, ["-p", "--package"]);
2943
2980
  const prefix = npmPrefix(base);
2944
- if (name !== "pnpm" && name !== "yarn" && name !== "pnpx") {
2945
- const bin = reference.name.split("/").pop();
2946
- for (const dir of ancestors(base)) {
2947
- if (existsSync(join2(dir, "node_modules", ...reference.name.split("/"), "package.json")) || existsSync(join2(dir, "node_modules", ".bin", bin))) {
2948
- return "a copy installed in node_modules runs instead of the registry's";
2949
- }
2950
- }
2951
- }
2981
+ if (installedCopy(transport2, reference, context)) return "a copy installed in node_modules runs instead of the registry's";
2952
2982
  const cli = new Map(options.filter(([flag]) => flag.startsWith("--")).map(([flag, value]) => [flag.slice(2), value ?? ""]));
2953
2983
  const userconfig = cli.get("userconfig") ?? npmEnv(launcherEnv, "npm_config_userconfig");
2954
2984
  const levels = [
@@ -3820,6 +3850,14 @@ async function provenanceOf(server2, options) {
3820
3850
  const kept = carriedForward(previous, reference);
3821
3851
  return { ...kept ? { provenance: kept } : {}, unverified: true };
3822
3852
  }
3853
+ function floatingOf(server2, provenance2, projectRoot) {
3854
+ if (server2.transport.type !== "stdio") return void 0;
3855
+ const reference = referenceOf(server2.transport, projectRoot);
3856
+ if (!reference) return void 0;
3857
+ if (reference.ecosystem === "npm" && installedCopy(server2.transport, reference, { projectRoot })) return void 0;
3858
+ const floating = floatingRequest(reference, provenance2);
3859
+ return floating ? { server: server2.name, ...floating } : void 0;
3860
+ }
3823
3861
  async function mapWithLimit(items, limit, worker) {
3824
3862
  const results = new Array(items.length);
3825
3863
  let next = 0;
@@ -3838,19 +3876,21 @@ async function captureAll(options) {
3838
3876
  const discovery = await discoverServers(options.projectRoot, options.configFiles, { userConfigs: options.userConfigs === true });
3839
3877
  const captured = await mapWithLimit(discovery.servers, options.concurrency ?? 4, async (server2) => {
3840
3878
  let established;
3879
+ let floating2;
3841
3880
  try {
3842
3881
  established = await provenanceOf(server2, options);
3882
+ floating2 = floatingOf(server2, established.provenance, options.projectRoot);
3843
3883
  const { provenance: provenance2, unverified: unverified2, displaced: displaced2 } = established;
3844
3884
  const pinned = server2.transport.type === "stdio" ? launchPinned(server2.transport, provenance2) : void 0;
3845
3885
  const surface = await captureSurface(pinned ? { ...server2, transport: pinned } : server2, options.timeoutMs ?? DEFAULT_TIMEOUT_MS2);
3846
3886
  const entry = buildLockedServer(server2, surface, options.policy);
3847
3887
  options.onServerDone?.(server2.name, "captured");
3848
- return { name: server2.name, entry: provenance2 ? { ...entry, provenance: provenance2 } : entry, unverified: unverified2, displaced: displaced2 };
3888
+ return { name: server2.name, entry: provenance2 ? { ...entry, provenance: provenance2 } : entry, unverified: unverified2, displaced: displaced2, floating: floating2 };
3849
3889
  } catch (error) {
3850
3890
  options.onServerDone?.(server2.name, "failed");
3851
3891
  const reason = boundReason(withoutSecrets(error instanceof UnreachableServerError ? error.message : error.message, server2));
3852
3892
  const kind = authFailureKind(error) ?? "unreachable";
3853
- return { name: server2.name, failure: { server: server2.name, reason, kind }, provenance: established?.provenance, displaced: established?.displaced };
3893
+ return { name: server2.name, failure: { server: server2.name, reason, kind }, provenance: established?.provenance, displaced: established?.displaced, floating: floating2 };
3854
3894
  }
3855
3895
  });
3856
3896
  const subjects = {};
@@ -3859,8 +3899,10 @@ async function captureAll(options) {
3859
3899
  const displaced = [];
3860
3900
  const unaudited = {};
3861
3901
  const unauditedProvenance = {};
3902
+ const floating = [];
3862
3903
  const configured = new Map(discovery.servers.map((server2) => [server2.name, server2]));
3863
3904
  for (const result of captured) {
3905
+ if (result.floating) floating.push(result.floating);
3864
3906
  if ("entry" in result && result.entry) {
3865
3907
  setOwn(subjects, result.name, result.entry);
3866
3908
  if (result.unverified) unverified.push(result.name);
@@ -3901,7 +3943,8 @@ async function captureAll(options) {
3901
3943
  unaudited,
3902
3944
  unauditedProvenance,
3903
3945
  conflicted: discovery.conflicts.map((conflict) => conflict.name),
3904
- partial: Object.entries(subjects).filter(([, entry]) => entry.coverage !== void 0).map(([server2, entry]) => ({ server: server2, reasons: entry.coverage.reasons })).sort((a, b) => a.server.localeCompare(b.server))
3946
+ partial: Object.entries(subjects).filter(([, entry]) => entry.coverage !== void 0).map(([server2, entry]) => ({ server: server2, reasons: entry.coverage.reasons })).sort((a, b) => a.server.localeCompare(b.server)),
3947
+ floating: floating.sort((a, b) => a.server.localeCompare(b.server))
3905
3948
  };
3906
3949
  }
3907
3950
  function acknowledged(committed, name, now) {
@@ -4384,6 +4427,17 @@ function resolveExitCode(options) {
4384
4427
  return EXIT_CLEAN;
4385
4428
  }
4386
4429
 
4430
+ // src/report/floating.ts
4431
+ function floatingLine(entry) {
4432
+ const instead = entry.exact !== void 0 ? `Write it as ${entry.exact}, which is what runs now.` : entry.ecosystem === "oci" ? `Write it by digest, as ${entry.name}@sha256:<digest>.` : `Write it with an exact version, as ${entry.name}${entry.ecosystem === "pypi" ? "==" : "@"}<version>.`;
4433
+ return visibleControls(
4434
+ `${entry.asked} runs whatever version was published last, so a new release can show up as drift, and fail the build, with no change to the config. ${instead}`
4435
+ );
4436
+ }
4437
+ function floatingNotes(floating) {
4438
+ return floating.map((entry) => `${visibleControls(entry.server)}: ${floatingLine(entry)}`);
4439
+ }
4440
+
4387
4441
  // src/report/human.ts
4388
4442
  var MARK = {
4389
4443
  high: red,
@@ -4478,6 +4532,12 @@ function renderHumanReport(report) {
4478
4532
  ""
4479
4533
  );
4480
4534
  }
4535
+ const floating = report.floating ?? [];
4536
+ if (floating.length > 0) {
4537
+ lines.push(yellow(`${floating.length} server(s) name no exact version:`));
4538
+ for (const entry of floating) lines.push(` ${bold(visibleControls(entry.server))}`, ` ${floatingLine(entry)}`);
4539
+ lines.push(dim(" This did not change the verdict."), "");
4540
+ }
4481
4541
  const partial = report.partial ?? [];
4482
4542
  if (partial.length > 0) {
4483
4543
  lines.push(yellow(`Could not read ${partial.length} server(s) in full:`));
@@ -4618,6 +4678,7 @@ var STEERING_RULE = "steering.passage.arrived";
4618
4678
  var UNVERIFIED_RULE = "server.artifact.unverified";
4619
4679
  var PARTIAL_RULE = "server.surface.partial";
4620
4680
  var UNREAD_RULE = "server.surface.unread";
4681
+ var FLOATING_RULE = "server.artifact.floating";
4621
4682
  var RULE_HELP = {
4622
4683
  "tool.capability.gained": "A tool gained a capability it did not declare before, derived from its name, its argument names and the shape of its schema. The severity is the capability's, not the schema change's: gaining a `command` argument is not the same finding as gaining an optional string.",
4623
4684
  "tool.description.changed": "A tool description is injected into the model's context. A change here can carry instructions to the agent and should be read in full, not skimmed.",
@@ -4646,6 +4707,7 @@ function renderSarifReport(report, options = {}) {
4646
4707
  const unverified = report.unverified ?? [];
4647
4708
  const partial = report.partial ?? [];
4648
4709
  const unread = report.unreachable;
4710
+ const floating = report.floating ?? [];
4649
4711
  const at = (name, qualified) => [
4650
4712
  {
4651
4713
  physicalLocation: { artifactLocation: { uri: sarifUri(report), uriBaseId: "%SRCROOT%" } },
@@ -4687,6 +4749,13 @@ function renderSarifReport(report, options = {}) {
4687
4749
  shortDescription: { text: "What a server runs could not be checked" },
4688
4750
  fullDescription: { text: "The server answered and its declared surface was compared, but the artifact behind it could not be established on this run: a registry that did not answer, or a launcher configured to fetch from somewhere the pin does not describe. It does not affect the exit code." },
4689
4751
  defaultConfiguration: { level: "note" }
4752
+ }] : [],
4753
+ ...floating.length > 0 ? [{
4754
+ id: FLOATING_RULE,
4755
+ name: "ServerArtifactFloating",
4756
+ shortDescription: { text: "A server configured with no exact version" },
4757
+ fullDescription: { text: "The configuration names a package with no version, a dist-tag or a range, or an image with no tag or the latest tag, so the server runs whatever was published last and a new release shows up as drift with no change to the configuration. Name an exact version, or an image digest. It does not affect the exit code." },
4758
+ defaultConfiguration: { level: "note" }
4690
4759
  }] : []
4691
4760
  ];
4692
4761
  const document = {
@@ -4756,6 +4825,13 @@ function renderSarifReport(report, options = {}) {
4756
4825
  message: { text: `${server2}: what this server runs could not be checked on this run` },
4757
4826
  locations: at(server2, server2),
4758
4827
  partialFingerprints: { "mcpAuditChange/v1": `${server2}/unverified` }
4828
+ })),
4829
+ ...floating.map((entry) => ({
4830
+ ruleId: FLOATING_RULE,
4831
+ level: "note",
4832
+ message: { text: `${entry.server}: ${floatingLine(entry)}` },
4833
+ locations: at(entry.server, entry.server),
4834
+ partialFingerprints: { "mcpAuditChange/v1": `${entry.server}/floating` }
4759
4835
  }))
4760
4836
  ]
4761
4837
  }
@@ -5095,6 +5171,8 @@ async function buildReport(options) {
5095
5171
  unreachable: result.unreachable,
5096
5172
  // Reported beside the verdict and never part of it; see `AuditReport.unverified`.
5097
5173
  unverified: result.unverified,
5174
+ // Advice beside the verdict, like `unverified`: why the drift keeps coming, not more of it.
5175
+ floating: result.floating,
5098
5176
  partial: result.partial,
5099
5177
  serversChecked: Object.keys(result.lock.subjects).length,
5100
5178
  lockPath: options.lockPath,
@@ -5294,6 +5372,11 @@ async function runInit(options) {
5294
5372
  const unaudited = options.allowUnreachable ? unauditedToRecord(result) : void 0;
5295
5373
  if (pinnedSomething) await writeLockfile(options.lockPath, unaudited ? { ...result.lock, unaudited } : result.lock);
5296
5374
  const lines = pinnedSomething ? ["", bold(`Pinned ${names.length} server(s) to ${options.lockPath}:`), ""] : ["", bold("Pinned nothing: no server answered."), ""];
5375
+ const floating = new Map(result.floating.map((entry) => [entry.server, entry]));
5376
+ const floatingNote = (name) => {
5377
+ const entry = floating.get(name);
5378
+ return entry ? [` ${yellow(floatingLine(entry))}`] : [];
5379
+ };
5297
5380
  for (const name of names) {
5298
5381
  const entry = result.lock.subjects[name];
5299
5382
  const counts = [
@@ -5307,6 +5390,7 @@ async function runInit(options) {
5307
5390
  lines.push(` ${dim(visibleControls(`${entry?.protocol.era}/${entry?.protocol.version} \xB7 from ${entry?.source.file}${deprecated}`))}`);
5308
5391
  const redacted = entry ? countRedacted(entry.transport) : 0;
5309
5392
  if (redacted > 0) lines.push(` ${yellow(redactedLine(redacted))}`);
5393
+ lines.push(...floatingNote(name));
5310
5394
  const tools = entry?.tools ?? [];
5311
5395
  const capabilities = surfaceCapabilities(tools);
5312
5396
  if (capabilities.length > 0) {
@@ -5341,6 +5425,7 @@ async function runInit(options) {
5341
5425
  }
5342
5426
  for (const failure of result.unreachable) {
5343
5427
  lines.push(` ${red("\u2717")} ${bold(visibleControls(failure.server))} ${dim("not pinned")}`, ` ${visibleLines(failure.reason, " ")}`);
5428
+ lines.push(...floatingNote(failure.server));
5344
5429
  }
5345
5430
  const unagreeable = Object.keys(result.unaudited).filter((name) => options.allowUnreachable && !Object.hasOwn(unaudited ?? {}, name));
5346
5431
  if (unagreeable.length > 0) {
@@ -5835,6 +5920,8 @@ async function runPush(options) {
5835
5920
  userConfigs: options.userConfigs
5836
5921
  });
5837
5922
  for (const note of redactedNotes(result.lock)) process.stderr.write(`${yellow("note:")} ${note}
5923
+ `);
5924
+ for (const note of floatingNotes(result.floating)) process.stderr.write(`${yellow("note:")} ${note}
5838
5925
  `);
5839
5926
  if (Object.keys(result.lock.subjects).length === 0 && result.unreachable.length === 0) {
5840
5927
  const looked = result.discovery.filesRead.length > 0 ? result.discovery.filesRead.join(", ") : "no client config files exist for this project";