audit-tools 0.56.1 → 0.56.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "audit-tools",
3
- "version": "0.56.1",
3
+ "version": "0.56.2",
4
4
  "private": false,
5
5
  "license": "ISC",
6
6
  "description": "Provider-neutral code auditing and remediation workflows for arbitrary repositories.",
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ // sites-pinned: tests/shared/postinstall-mcp-registration.test.ts
2
3
  // Single-package postinstall: deploy BOTH the audit-code and remediate-code host
3
4
  // assets (global slash commands, Codex/OpenCode/Antigravity skills, plugin
4
5
  // manifests). Each sub-deployer is self-contained — it computes its own package
@@ -8,19 +9,29 @@
8
9
  // corrupts the other's, and surface a non-zero exit if EITHER reports a failure
9
10
  // (INV-remediate-infra-08: a partial deploy must not report success).
10
11
  import { spawnSync } from "node:child_process";
11
- import { existsSync } from "node:fs";
12
+ import { existsSync, statSync } from "node:fs";
12
13
  import { fileURLToPath } from "node:url";
13
14
 
14
15
  const packageRoot = fileURLToPath(new URL("..", import.meta.url));
16
+ // Source markers are excluded from the release manifest. Neither a parent
17
+ // directory named node_modules nor a prebuilt dist identifies a packed install.
18
+ const sourceCheckout =
19
+ statSync(new URL("../src", import.meta.url), { throwIfNoEntry: false })?.isDirectory() === true &&
20
+ statSync(new URL("../tsconfig.json", import.meta.url), { throwIfNoEntry: false })?.isFile() === true;
15
21
  let failed = false;
16
22
 
17
23
  // A published tarball already carries dist/. A source checkout does not, and
18
24
  // npm's postinstall runs only after dependencies are present, so this is the
19
25
  // first reliable point at which it can build the shared export. Without this
20
- // bootstrap a fresh checkout partially deployed host assets and skipped both
21
- // OpenCode config and artifact .gitignore management until a human happened to
22
- // rerun postinstall after the first build.
23
- if (!ensureSourceCheckoutBuilt()) failed = true;
26
+ // bootstrap a fresh checkout cannot load the package's shared export.
27
+ if (sourceCheckout && !ensureSourceCheckoutBuilt()) failed = true;
28
+
29
+ // A development dependency install owns the checkout build, not host assets
30
+ // or launch paths. Packaged installs and explicit host setup keep their
31
+ // existing behavior. Stop here even when dist was already available.
32
+ if (sourceCheckout && process.env.npm_lifecycle_event === "postinstall") {
33
+ process.exit(failed ? 1 : 0);
34
+ }
24
35
 
25
36
  for (const script of ["./audit/postinstall.mjs", "./remediate/postinstall.mjs"]) {
26
37
  const scriptPath = fileURLToPath(new URL(script, import.meta.url));
@@ -47,10 +58,6 @@ function ensureSourceCheckoutBuilt() {
47
58
  const sharedEntry = fileURLToPath(new URL("../dist/shared/index.js", import.meta.url));
48
59
  if (existsSync(sharedEntry)) return true;
49
60
 
50
- const sourceTree = fileURLToPath(new URL("../src", import.meta.url));
51
- const tsconfig = fileURLToPath(new URL("../tsconfig.json", import.meta.url));
52
- if (!existsSync(sourceTree) || !existsSync(tsconfig)) return true;
53
-
54
61
  const npmCli = process.env.npm_execpath;
55
62
  if (!npmCli) {
56
63
  console.warn(