@cosmicdrift/kumiko-guards 0.313.0 → 0.315.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.313.0",
3
+ "version": "0.315.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.313.0",
31
+ "@cosmicdrift/kumiko-repo-manifest": "0.315.0",
32
32
  "ts-morph": "^28.0.0"
33
33
  },
34
34
  "publishConfig": {
package/src/changes.json CHANGED
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": "0.314.0",
4
+ "type": "fix",
5
+ "title": "Tailwind-Scan-Surface Guard classifies files against the runner's roots",
6
+ "detail": "The guard ignored the roots its runner passes to run() and re-derived the\nsingle repo of the current working directory. Under a multi-root runner,\na file from a checkout outside cwd fell through to the packages/ marker\nfallback, which misreads a checkout path that itself contains a packages/\nsegment. run() now uses the roots it is given, like the other guards."
7
+ },
2
8
  {
3
9
  "version": "0.311.0",
4
10
  "type": "breaking",
@@ -108,11 +108,14 @@ export interface Finding {
108
108
  readonly token: string;
109
109
  }
110
110
 
111
- function isTargetFile(sf: SourceFile): boolean {
112
- return relFromRepoRoot(sf.getFilePath()).startsWith(TARGET_DIR);
111
+ function isTargetFile(sf: SourceFile, roots: readonly RepoRoot[]): boolean {
112
+ return relFromRepoRoot(sf.getFilePath(), roots).startsWith(TARGET_DIR);
113
113
  }
114
114
 
115
- function scan(files: readonly SourceFile[]): {
115
+ function scan(
116
+ files: readonly SourceFile[],
117
+ roots: readonly RepoRoot[],
118
+ ): {
116
119
  findings: Finding[];
117
120
  scanned: number;
118
121
  } {
@@ -121,7 +124,7 @@ function scan(files: readonly SourceFile[]): {
121
124
  let scanned = 0;
122
125
 
123
126
  for (const sf of files) {
124
- if (isTargetFile(sf)) {
127
+ if (isTargetFile(sf, roots)) {
125
128
  if (EXCLUDE.test(sf.getFilePath())) continue;
126
129
  targets.push(sf);
127
130
  scanned++;
@@ -537,7 +540,7 @@ export function analyse(
537
540
  compareBaseline: boolean,
538
541
  roots: readonly RepoRoot[] = resolveRepoRoots(),
539
542
  ): GuardOutcome {
540
- const { findings } = scan(files);
543
+ const { findings } = scan(files, roots);
541
544
  const coverageFindings = scanSourceCoverage(roots);
542
545
  const publishedSurfaceFindings = scanPublishedScanSurface(roots);
543
546
  reportPublishedScanSurfaceFindings(publishedSurfaceFindings);
@@ -562,7 +565,7 @@ export const guard: AstGuard = {
562
565
  `— reuse a class already emitted there, or move the styling into renderer-web. Justified exception: // ${IGNORE_TAG} <reason>. ` +
563
566
  "Package without @source coverage in an app: add an @source entry for both install layouts. " +
564
567
  "@source with a node_modules/<pkg>/<segment> path: check whether <pkg> even publishes that segment (package.json files).",
565
- run: (files) => analyse(files, true),
568
+ run: (files, roots = resolveRepoRoots()) => analyse(files, true, roots),
566
569
  };
567
570
 
568
571
  // Flags are read ONLY here, not in run() — the shared runner
@@ -572,7 +575,7 @@ if (import.meta.main) {
572
575
  const args = process.argv.slice(2);
573
576
  if (args.includes("--write-baseline")) {
574
577
  const project = buildSharedProject([guard]);
575
- const { findings } = scan(filesForGuard(project, guard));
578
+ const { findings } = scan(filesForGuard(project, guard), resolveRepoRoots());
576
579
  tailwindScanSurfaceBaseline.write(baselineCounts(findings));
577
580
  sourceCoverageBaseline.write(
578
581
  sourceCoverageBaselineCounts(scanSourceCoverage(resolveRepoRoots())),