示例工程 48-project-security-auditor

48-project-security-auditor/app/shared/ipc.ts

typescript · 1.0 KB

import type { ProjectReport, RuleSummary } from "./rules";

export const CH = {
  snapshot: "audit:snapshot",
  scan: "audit:scan",
  refresh: "audit:refresh",
} as const;

export type EventRow = {
  at: number;
  kind: string;
  detail: string;
};

export type Check = {
  id: string;
  label: string;
  pass: boolean;
  detail: string;
};

export type ExpectedState = {
  match: boolean;
  checked: number;
  mismatches: string[];
};

export type Snapshot = {
  platform: string;
  electronVersion: string;
  nodeVersion: string;
  projects: ProjectReport[];
  ruleSummaries: RuleSummary[];
  totals: {
    findings: number;
    high: number;
    medium: number;
    badScore: number;
    cleanScore: number;
  };
  expected: ExpectedState;
  checks: Check[];
  score: number;
  events: EventRow[];
};

export type AuditFile = {
  file: string;
  text: string;
};

export type AuditProject = {
  folder: string;
  files: AuditFile[];
};

export type ExpectedMap = Record<string, Record<string, string[]>>;