audit-tools 0.51.1 → 0.51.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.51.1",
3
+ "version": "0.51.2",
4
4
  "private": false,
5
5
  "license": "ISC",
6
6
  "description": "Provider-neutral code auditing and remediation workflows for arbitrary repositories.",
@@ -51,11 +51,14 @@
51
51
  "test": "npm run build && node scripts/shared/run-vitest-gate.mjs",
52
52
  "test:single": "npm run build && node scripts/shared/run-vitest-gate.mjs",
53
53
  "verify:guards": "node scripts/shared/run-vitest-gate.mjs --retry=2 --exclude \"**/audit-code-completion-*.test.ts\" --exclude \"**/audit-code-wrapper-*.test.ts\" --exclude \"**/audit/next-step-core-*.test.ts\" --exclude \"**/seam-host-only-next-step.test.ts\" --exclude \"**/*-e2e.test.*\" --exclude \"**/next-step-implement-dispatch.test.ts\" --exclude \"**/next-step-pipeline-dispatch.test.ts\"",
54
- "verify:checks": "node scripts/shared/profile-run.mjs verify-checks check:control-bytes check:shared-primitives check:version-gates check:guard-reach check:ci-trigger-paths check:loop-core-patterns check:loop-core-closure check:constitutional-doc-paths check:runtime-artifact-names check:friction-categories check:executor-producers check:spec-mirrors check:cli-surface check:ingestion-checks check:deadcode check:orphan-modules check:lint check:dup check:depgraph check:doc-manifest check:doc-links check:doc-code-citations check:gate-enumeration check:philosophy-brief check:readme-sample-report check:proposal-red-at check:handoff-roadmap check:backlog-index check:memory-citations check:backlog-budget check:backlog-status check:backlog-line-numbers check:tests build check:scripts verify:hosts verify:remediate-hosts pack:smoke smoke:packaged-audit-code smoke:packaged-remediate-code",
54
+ "verify:checks": "node scripts/shared/profile-run.mjs verify-checks check:control-bytes check:shared-primitives check:version-gates check:guard-reach check:generated-artifacts check:invariant-glossary check:nightly-inbox check:ci-trigger-paths check:loop-core-patterns check:loop-core-closure check:constitutional-doc-paths check:runtime-artifact-names check:friction-categories check:executor-producers check:spec-mirrors check:cli-surface check:ingestion-checks check:deadcode check:orphan-modules check:lint check:dup check:depgraph check:doc-manifest check:doc-links check:doc-code-citations check:gate-enumeration check:philosophy-brief check:readme-sample-report check:proposal-red-at check:handoff-roadmap check:backlog-index check:memory-citations check:backlog-budget check:backlog-status check:backlog-line-numbers check:tests build check:scripts verify:hosts verify:remediate-hosts pack:smoke smoke:packaged-audit-code smoke:packaged-remediate-code",
55
55
  "verify:release": "npm run verify:checks && node scripts/shared/run-vitest-gate.mjs && npm run smoke:linked-audit-code && npm run smoke:linked-remediate-code",
56
56
  "check:control-bytes": "node scripts/check-control-bytes.mjs",
57
57
  "check:shared-primitives": "node scripts/check-shared-primitives.mjs",
58
58
  "check:guard-reach": "node scripts/check-guard-reach.mjs",
59
+ "check:generated-artifacts": "node scripts/check-generated-artifacts.mjs",
60
+ "check:invariant-glossary": "node scripts/check-invariant-glossary.mjs",
61
+ "check:nightly-inbox": "node scripts/nightly/render-inbox.mjs --check",
59
62
  "closeout": "node scripts/render-closeout.mjs",
60
63
  "check:ci-trigger-paths": "node scripts/shared/generate-ci-trigger-paths.mjs --check",
61
64
  "check:deadcode": "knip --no-config-hints",
@@ -8,9 +8,20 @@
8
8
  // corrupts the other's, and surface a non-zero exit if EITHER reports a failure
9
9
  // (INV-remediate-infra-08: a partial deploy must not report success).
10
10
  import { spawnSync } from "node:child_process";
11
+ import { existsSync } from "node:fs";
11
12
  import { fileURLToPath } from "node:url";
12
13
 
14
+ const packageRoot = fileURLToPath(new URL("..", import.meta.url));
13
15
  let failed = false;
16
+
17
+ // A published tarball already carries dist/. A source checkout does not, and
18
+ // npm's postinstall runs only after dependencies are present, so this is the
19
+ // 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;
24
+
14
25
  for (const script of ["./audit/postinstall.mjs", "./remediate/postinstall.mjs"]) {
15
26
  const scriptPath = fileURLToPath(new URL(script, import.meta.url));
16
27
  const result = spawnSync(process.execPath, [scriptPath], { stdio: "inherit", windowsHide: true });
@@ -32,6 +43,37 @@ await manageArtifactGitignore();
32
43
 
33
44
  process.exit(failed ? 1 : 0);
34
45
 
46
+ function ensureSourceCheckoutBuilt() {
47
+ const sharedEntry = fileURLToPath(new URL("../dist/shared/index.js", import.meta.url));
48
+ if (existsSync(sharedEntry)) return true;
49
+
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
+ const npmCli = process.env.npm_execpath;
55
+ if (!npmCli) {
56
+ console.warn(
57
+ "[audit-tools] postinstall: source checkout needs a shared build, but npm_execpath is unavailable.",
58
+ );
59
+ return false;
60
+ }
61
+
62
+ console.log("[audit-tools] postinstall: building shared output for this source checkout...");
63
+ const result = spawnSync(process.execPath, [npmCli, "run", "build"], {
64
+ cwd: packageRoot,
65
+ stdio: "inherit",
66
+ windowsHide: true,
67
+ });
68
+ if (result.error || (result.status ?? 0) !== 0 || result.signal) {
69
+ console.warn(
70
+ `[audit-tools] postinstall: source-checkout build failed (${result.error?.message ?? result.signal ?? `exit ${result.status}`}).`,
71
+ );
72
+ return false;
73
+ }
74
+ return existsSync(sharedEntry);
75
+ }
76
+
35
77
  async function manageArtifactGitignore() {
36
78
  try {
37
79
  const shared = await import("audit-tools/shared");