@cosmicdrift/kumiko-guards 0.318.0 → 0.320.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmicdrift/kumiko-guards",
3
- "version": "0.318.0",
3
+ "version": "0.320.0",
4
4
  "description": "AST-based security guards for Kumiko repos: direct-fs/fetch, tenant escalation, admin-API, escape hatches and related checks, run over a shared ts-morph project.",
5
5
  "license": "BUSL-1.1",
6
6
  "author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
@@ -28,7 +28,7 @@
28
28
  "kumiko-pre-push": "./src/pre-push.sh"
29
29
  },
30
30
  "dependencies": {
31
- "@cosmicdrift/kumiko-repo-manifest": "0.318.0",
31
+ "@cosmicdrift/kumiko-repo-manifest": "0.320.0",
32
32
  "ts-morph": "^28.0.0"
33
33
  },
34
34
  "publishConfig": {
package/src/run-guards.ts CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  reportResults,
18
18
  runGuards,
19
19
  } from "./_lib/guard-kit";
20
+ import type { RepoRoot } from "./_lib/roots";
20
21
  import { writeSecurityBaselines } from "./_lib/security-baseline-cli";
21
22
  import { guard as asCasts } from "./check-as-casts";
22
23
  import { guard as complexity } from "./check-complexity";
@@ -103,10 +104,14 @@ export const GUARD_FLAGS = [
103
104
 
104
105
  const GUARD_NAME_PREFIX = "--guard=";
105
106
 
107
+ export type RunGuardsCliDeps = {
108
+ readonly writeBaselineRoots?: readonly RepoRoot[];
109
+ };
110
+
106
111
  // Shared by the direct `bun run-guards.ts` invocation below and by the
107
112
  // `guards` subcommand in cli.ts — one place for the flag behavior so the
108
113
  // two entry points can never drift.
109
- export function runGuardsCli(argv: readonly string[]): number {
114
+ export function runGuardsCli(argv: readonly string[], deps: RunGuardsCliDeps = {}): number {
110
115
  const guardNameArg = argv.find((arg) => arg.startsWith(GUARD_NAME_PREFIX));
111
116
  const flags = guardNameArg === undefined ? argv : argv.filter((arg) => arg !== guardNameArg);
112
117
  const flagsError = cliFlagsError("guards", flags, GUARD_FLAGS);
@@ -148,8 +153,8 @@ export function runGuardsCli(argv: readonly string[]): number {
148
153
  console.error(`Guard "${guardName}" has no ratchet baseline to write.`);
149
154
  return 1;
150
155
  }
151
- const project = buildSharedProject([target]);
152
- target.writeBaseline(filesForGuard(project, target));
156
+ const project = buildSharedProject([target], deps.writeBaselineRoots);
157
+ target.writeBaseline(filesForGuard(project, target, deps.writeBaselineRoots));
153
158
  return 0;
154
159
  }
155
160
  const strictSecurityBaseline = flags.includes("--strict-security-baseline");