From 1aa8042777da44900f727e0da5b9a61fe8c0d46a Mon Sep 17 00:00:00 2001 From: mahimathacker Date: Sun, 10 May 2026 15:48:07 +0530 Subject: [PATCH 1/5] test: trigger DriftGuard for PR test --- src/analyzers/solidity/diff.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/analyzers/solidity/diff.ts b/src/analyzers/solidity/diff.ts index c653dd9..4a247f1 100644 --- a/src/analyzers/solidity/diff.ts +++ b/src/analyzers/solidity/diff.ts @@ -18,6 +18,7 @@ export type ContractChange = export function diffContracts( baseline: Record, head: Record, + options?: { strict? : boolean}, ): ContractChange[] { const changes: ContractChange[] = []; From 2ff642c18b556e9df5f4452a433ce497b93e2752 Mon Sep 17 00:00:00 2001 From: mahimathacker Date: Sun, 10 May 2026 16:25:26 +0530 Subject: [PATCH 2/5] fix emit repo relative paths in the findings for GH annotations and SARIF --- src/cli/commands/check.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cli/commands/check.ts b/src/cli/commands/check.ts index 5529bbc..082b0b3 100644 --- a/src/cli/commands/check.ts +++ b/src/cli/commands/check.ts @@ -1,5 +1,5 @@ import { mkdir, writeFile } from 'node:fs/promises'; -import { dirname, resolve } from 'node:path'; +import { dirname, isAbsolute, relative, resolve } from 'node:path'; import { runDemos } from '../../analyzers/demos/run.js'; import type { DriftGuardConfig } from '../../config/schema.js'; import { findingsFromDemos } from '../../reporter/findings.js'; @@ -28,6 +28,11 @@ export async function runCheck( const head = await analyze(cwd, config); const report = buildReport(baseline, head, config); + // GitHub annotations require repo-relative paths; SARIF spec wants the same. + for (const f of report.findings) { + if (f.file && isAbsolute(f.file)) f.file = relative(cwd, f.file); + } + if (config.demos.enabled) { const demoResults = await runDemos(config.demos, cwd); const demoFindings = findingsFromDemos(demoResults, config.severity); From a48d3feb8c3af48ba9aa02b246eff546d10271ce Mon Sep 17 00:00:00 2001 From: mahimathacker Date: Sun, 10 May 2026 18:37:54 +0530 Subject: [PATCH 3/5] fix --- src/analyzers/typescript/extract.ts | 19 ++++++++++++++----- src/reporter/findings.ts | 9 ++++++++- src/snapshot/schema.ts | 2 ++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/analyzers/typescript/extract.ts b/src/analyzers/typescript/extract.ts index 43e6bf2..1169e60 100644 --- a/src/analyzers/typescript/extract.ts +++ b/src/analyzers/typescript/extract.ts @@ -1,5 +1,5 @@ import { readFile } from 'node:fs/promises'; -import { dirname, resolve } from 'node:path'; +import { dirname, isAbsolute, relative, resolve } from 'node:path'; import { Project, type SourceFile } from 'ts-morph'; import type { SdkExport } from '../../snapshot/schema.js'; import { serializeExport } from './serialize.js'; @@ -33,22 +33,31 @@ export async function loadSdk( return { packageName, packageVersion, - entryPath: resolvedEntry, - exports: extractExports(source), + entryPath: toRelative(resolvedEntry, cwd), + exports: extractExports(source, cwd), }; } -function extractExports(source: SourceFile): Record { +function extractExports(source: SourceFile, cwd: string): Record { const exports: Record = {}; for (const [name, declarations] of source.getExportedDeclarations()) { const decl = declarations[0]; if (!decl) continue; const serialized = serializeExport(decl); - if (serialized) exports[name] = serialized; + if (!serialized) continue; + exports[name] = { + ...serialized, + sourceFile: toRelative(decl.getSourceFile().getFilePath(), cwd), + line: decl.getStartLineNumber(), + }; } return exports; } +function toRelative(p: string, cwd: string): string { + return isAbsolute(p) ? relative(cwd, p) : p; +} + async function resolveEntry(entry: string, cwd: string): Promise { const abs = resolve(cwd, entry); if (entry.endsWith('.ts') || entry.endsWith('.tsx') || entry.endsWith('.d.ts')) { diff --git a/src/reporter/findings.ts b/src/reporter/findings.ts index d431513..773bc72 100644 --- a/src/reporter/findings.ts +++ b/src/reporter/findings.ts @@ -91,32 +91,39 @@ export function findingsFromSdk( baseline: Snapshot, head: Snapshot, ): Finding[] { - const file = head.sdk?.entryPath ?? baseline.sdk?.entryPath; + const entryFile = head.sdk?.entryPath ?? baseline.sdk?.entryPath; const out: Finding[] = []; for (const change of changes) { + const exp = head.sdk?.exports[change.name] ?? baseline.sdk?.exports[change.name]; + const file = exp?.sourceFile ?? entryFile; + const line = exp?.line; switch (change.kind) { case 'export-added': push(out, 'sdk-added', 'sdk', config, { message: `Export ${change.name} added (${change.export.kind})`, file, + line, }); break; case 'export-removed': push(out, 'sdk-breaking', 'sdk', config, { message: `Export ${change.name} removed`, file, + line, }); break; case 'kind-changed': push(out, 'sdk-breaking', 'sdk', config, { message: `Export ${change.name} kind changed: ${change.before.kind} → ${change.after.kind}`, file, + line, }); break; case 'signature-changed': push(out, 'sdk-signature-changed', 'sdk', config, { message: `Export ${change.name} signature changed`, file, + line, before: change.before.signature, after: change.after.signature, }); diff --git a/src/snapshot/schema.ts b/src/snapshot/schema.ts index 7940f76..01a0ae1 100644 --- a/src/snapshot/schema.ts +++ b/src/snapshot/schema.ts @@ -47,6 +47,8 @@ const SdkExportSchema = z.object({ 'namespace', ]), signature: z.string(), + sourceFile: z.string().optional(), + line: z.number().int().nonnegative().optional(), }).strict(); const SdkSnapshotSchema = z.object({ From c15224b982c7133161549a3ddc99ba8a5abe7ab7 Mon Sep 17 00:00:00 2001 From: mahimathacker Date: Sun, 10 May 2026 19:05:23 +0530 Subject: [PATCH 4/5] snapshots --- .driftguard/snapshot.json | 176 ++++++++++++++++++++++++++++---------- 1 file changed, 131 insertions(+), 45 deletions(-) diff --git a/.driftguard/snapshot.json b/.driftguard/snapshot.json index a602d46..92fc188 100644 --- a/.driftguard/snapshot.json +++ b/.driftguard/snapshot.json @@ -1,180 +1,266 @@ { - "createdAt": "2026-05-10T13:49:00.521Z", + "createdAt": "2026-05-10T13:08:16.899Z", "driftguardVersion": "0.1.0", "sdk": { - "entryPath": "/Users/mahimathacker/driftguard/src/index.ts", + "entryPath": "src/index.ts", "exports": { "AbiFragment": { "kind": "typeAlias", - "signature": "type = z.infer" + "line": 89, + "signature": "type = z.infer", + "sourceFile": "src/snapshot/schema.ts" }, "AbiParameter": { "kind": "typeAlias", - "signature": "type = {\n name: string;\n type: string;\n internalType?: string;\n indexed?: boolean;\n components?: AbiParameter[];\n}" + "line": 15, + "signature": "type = {\n name: string;\n type: string;\n internalType?: string;\n indexed?: boolean;\n components?: AbiParameter[];\n}", + "sourceFile": "src/snapshot/schema.ts" }, "ContractChange": { "kind": "typeAlias", - "signature": "type = | { kind: 'contract-added'; name: string; contract: ContractSnapshot }\n | { kind: 'contract-removed'; name: string; contract: ContractSnapshot }\n | { kind: 'contract-modified'; name: string; fragments: FragmentChange[] }" + "line": 13, + "signature": "type = | { kind: 'contract-added'; name: string; contract: ContractSnapshot }\n | { kind: 'contract-removed'; name: string; contract: ContractSnapshot }\n | { kind: 'contract-modified'; name: string; fragments: FragmentChange[] }", + "sourceFile": "src/analyzers/solidity/diff.ts" }, "ContractSnapshot": { "kind": "typeAlias", - "signature": "type = z.infer" + "line": 84, + "signature": "type = z.infer", + "sourceFile": "src/snapshot/schema.ts" }, "DemoResult": { "kind": "typeAlias", - "signature": "type = {\n name: string;\n command: string;\n passed: boolean;\n exitCode: number;\n durationMs: number;\n output: string;\n}" + "line": 10, + "signature": "type = {\n name: string;\n command: string;\n passed: boolean;\n exitCode: number;\n durationMs: number;\n output: string;\n}", + "sourceFile": "src/analyzers/demos/run.ts" }, "DocChange": { "kind": "typeAlias", - "signature": "type = | { kind: 'doc-added'; file: string }\n | { kind: 'doc-removed'; file: string }\n | { kind: 'snippet-broken'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-fixed'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-removed'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-added-broken'; file: string; snippet: DocSnippet }" + "line": 3, + "signature": "type = | { kind: 'doc-added'; file: string }\n | { kind: 'doc-removed'; file: string }\n | { kind: 'snippet-broken'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-fixed'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-removed'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-added-broken'; file: string; snippet: DocSnippet }", + "sourceFile": "src/analyzers/docs/diff.ts" }, "DocFileSnapshot": { "kind": "typeAlias", - "signature": "type = z.infer" + "line": 87, + "signature": "type = z.infer", + "sourceFile": "src/snapshot/schema.ts" }, "DocSnippet": { "kind": "typeAlias", - "signature": "type = z.infer" + "line": 88, + "signature": "type = z.infer", + "sourceFile": "src/snapshot/schema.ts" }, "DriftGuardConfig": { "kind": "typeAlias", - "signature": "type = z.infer" + "line": 86, + "signature": "type = z.infer", + "sourceFile": "src/config/schema.ts" }, "DriftGuardConfigInput": { "kind": "typeAlias", - "signature": "type = z.input" + "line": 87, + "signature": "type = z.input", + "sourceFile": "src/config/schema.ts" }, "DriftGuardConfigSchema": { "kind": "variable", - "signature": "z.object({\n contracts: ContractsConfig.optional(),\n sdk: SdkConfig.optional(),\n docs: DocsConfig.optional(),\n demos: DemosConfig.prefault({}),\n severity: SeverityRules.prefault({}),\n snapshot: SnapshotConfig.prefault({}),\n report: ReportConfig.prefault({}),\n}).strict().refine(\n (c) => c.contracts || c.sdk || c.docs,\n { message: 'At least one of `contracts`, `sdk`, or `docs` must be configured.' },\n)" + "line": 73, + "signature": "z.ZodObject<{ contracts: z.ZodOptional; toolchain: z.ZodDefault>; ignore: z.ZodDefault>; }, z.core.$strict>>; sdk: z.ZodOptional>; tsconfig: z.ZodOptional; ignore: z.ZodDefault>; }, z.core.$strict>>; docs: z.ZodOptional; snippetLanguages: z.ZodDefault>>; ignoreTag: z.ZodDefault; ignore: z.ZodDefault>; }, z.core.$strict>>; demos: z.ZodPrefault; docker: z.ZodDefault; repos: z.ZodDefault; install: z.ZodOptional; packageManager: z.ZodDefault>; timeoutMs: z.ZodDefault; env: z.ZodDefault>; }, z.core.$strict>>>; }, z.core.$strict>>; severity: z.ZodPrefault>; abiAdded: z.ZodDefault>; abiMutabilityRelaxed: z.ZodDefault>; abiMutabilityTightened: z.ZodDefault>; solidityAstBreaking: z.ZodDefault>; sdkBreaking: z.ZodDefault>; sdkAdded: z.ZodDefault>; sdkSignatureChanged: z.ZodDefault>; docSnippetFails: z.ZodDefault>; docSnippetReferencesRemoved: z.ZodDefault>; demoFails: z.ZodDefault>; }, z.core.$strict>>; snapshot: z.ZodPrefault; mode: z.ZodDefault>; baseBranch: z.ZodDefault; }, z.core.$strict>>; report: z.ZodPrefault>>; sarifPath: z.ZodDefault; markdownPath: z.ZodDefault; jsonPath: z.ZodDefault; }, z.core.$strict>>; }, z.core.$strict>", + "sourceFile": "src/config/schema.ts" }, "Finding": { "kind": "typeAlias", - "signature": "type = {\n ruleId: RuleId;\n severity: 'error' | 'warning';\n layer: Layer;\n message: string;\n file?: string;\n line?: number;\n before?: string;\n after?: string;\n}" + "line": 11, + "signature": "type = {\n ruleId: RuleId;\n severity: 'error' | 'warning';\n layer: Layer;\n message: string;\n file?: string;\n line?: number;\n before?: string;\n after?: string;\n}", + "sourceFile": "src/reporter/findings.ts" }, "FragmentChange": { "kind": "typeAlias", - "signature": "type = | { kind: 'fragment-added'; key: string; fragment: AbiFragment }\n | { kind: 'fragment-removed'; key: string; fragment: AbiFragment }\n | { kind: 'mutability-tightened'; key: string; before: Mutability; after: Mutability }\n | { kind: 'mutability-relaxed'; key: string; before: Mutability; after: Mutability }\n | { kind: 'outputs-changed'; key: string; before: AbiParameter[]; after: AbiParameter[] }" + "line": 6, + "signature": "type = | { kind: 'fragment-added'; key: string; fragment: AbiFragment }\n | { kind: 'fragment-removed'; key: string; fragment: AbiFragment }\n | { kind: 'mutability-tightened'; key: string; before: Mutability; after: Mutability }\n | { kind: 'mutability-relaxed'; key: string; before: Mutability; after: Mutability }\n | { kind: 'outputs-changed'; key: string; before: AbiParameter[]; after: AbiParameter[] }", + "sourceFile": "src/analyzers/solidity/diff.ts" }, "Layer": { "kind": "typeAlias", - "signature": "type = 'contracts' | 'sdk' | 'docs' | 'demos'" + "line": 9, + "signature": "type = 'contracts' | 'sdk' | 'docs' | 'demos'", + "sourceFile": "src/reporter/findings.ts" }, "RULES": { "kind": "variable", - "signature": "Record" + "line": 16, + "signature": "Record", + "sourceFile": "src/reporter/rules.ts" }, "Report": { "kind": "typeAlias", - "signature": "type = {\n findings: Finding[];\n errorCount: number;\n warningCount: number;\n exitCode: 0 | 1;\n}" + "line": 13, + "signature": "type = {\n findings: Finding[];\n errorCount: number;\n warningCount: number;\n exitCode: 0 | 1;\n}", + "sourceFile": "src/reporter/report.ts" }, "RuleId": { "kind": "typeAlias", - "signature": "type = | 'abi-breaking'\n | 'abi-added'\n | 'abi-mutability-tightened'\n | 'abi-mutability-relaxed'\n | 'sdk-breaking'\n | 'sdk-added'\n | 'sdk-signature-changed'\n | 'doc-snippet-fails'\n | 'demo-fails'" + "line": 5, + "signature": "type = | 'abi-breaking'\n | 'abi-added'\n | 'abi-mutability-tightened'\n | 'abi-mutability-relaxed'\n | 'sdk-breaking'\n | 'sdk-added'\n | 'sdk-signature-changed'\n | 'doc-snippet-fails'\n | 'demo-fails'", + "sourceFile": "src/reporter/rules.ts" }, "SNAPSHOT_VERSION": { "kind": "variable", - "signature": "1 as const" + "line": 3, + "signature": "1", + "sourceFile": "src/snapshot/schema.ts" }, "SdkChange": { "kind": "typeAlias", - "signature": "type = | { kind: 'export-added'; name: string; export: SdkExport }\n | { kind: 'export-removed'; name: string; export: SdkExport }\n | { kind: 'kind-changed'; name: string; before: SdkExport; after: SdkExport }\n | { kind: 'signature-changed'; name: string; before: SdkExport; after: SdkExport }" + "line": 3, + "signature": "type = | { kind: 'export-added'; name: string; export: SdkExport }\n | { kind: 'export-removed'; name: string; export: SdkExport }\n | { kind: 'kind-changed'; name: string; before: SdkExport; after: SdkExport }\n | { kind: 'signature-changed'; name: string; before: SdkExport; after: SdkExport }", + "sourceFile": "src/analyzers/typescript/diff.ts" }, "SdkExport": { "kind": "typeAlias", - "signature": "type = z.infer" + "line": 86, + "signature": "type = z.infer", + "sourceFile": "src/snapshot/schema.ts" }, "SdkSnapshot": { "kind": "typeAlias", - "signature": "type = z.infer" + "line": 85, + "signature": "type = z.infer", + "sourceFile": "src/snapshot/schema.ts" }, "Severity": { "kind": "typeAlias", - "signature": "type = z.infer" + "line": 4, + "signature": "type = z.infer", + "sourceFile": "src/config/schema.ts" }, "Snapshot": { "kind": "typeAlias", - "signature": "type = z.infer" + "line": 83, + "signature": "type = z.infer", + "sourceFile": "src/snapshot/schema.ts" }, "SnapshotNotFoundError": { "kind": "class", - "signature": "class {\n constructor(path: string);\n}" + "line": 6, + "signature": "class {\n constructor(path: string);\n}", + "sourceFile": "src/snapshot/io.ts" }, "SnapshotParseError": { "kind": "class", - "signature": "class {\n constructor(path: string, cause: unknown);\n}" + "line": 25, + "signature": "class {\n constructor(path: string, cause: unknown);\n}", + "sourceFile": "src/snapshot/io.ts" }, "SnapshotSchema": { "kind": "variable", - "signature": "z.object({\n version: z.literal(SNAPSHOT_VERSION),\n createdAt: z.iso.datetime(),\n driftguardVersion: z.string(),\n contracts: z.record(z.string(), ContractSnapshotSchema).optional(),\n sdk: SdkSnapshotSchema.optional(),\n docs: z.array(DocFileSnapshotSchema).optional(),\n}).strict()" + "line": 74, + "signature": "z.ZodObject<{ version: z.ZodLiteral<1>; createdAt: z.ZodISODateTime; driftguardVersion: z.ZodString; contracts: z.ZodOptional; abi: z.ZodArray; name: z.ZodOptional; inputs: z.ZodDefault>>>; outputs: z.ZodOptional>>>; stateMutability: z.ZodOptional>; anonymous: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>>>; sdk: z.ZodOptional; entryPath: z.ZodString; exports: z.ZodRecord; signature: z.ZodString; }, z.core.$strict>>; }, z.core.$strict>>; docs: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>>>; }, z.core.$strict>", + "sourceFile": "src/snapshot/schema.ts" }, "SnapshotVersionError": { "kind": "class", - "signature": "class {\n constructor(path: string, found: number);\n}" + "line": 15, + "signature": "class {\n constructor(path: string, found: number);\n}", + "sourceFile": "src/snapshot/io.ts" }, "analyzeContracts": { "kind": "function", - "signature": "(config: ContractsConfig, cwd?: string): Promise>" + "line": 12, + "signature": "(config: ContractsConfig, cwd?: string): Promise>", + "sourceFile": "src/analyzers/solidity/index.ts" }, "analyzeDocs": { "kind": "function", - "signature": "(config: DocsConfig, context: DocsAnalysisContext, cwd?: string): Promise" + "line": 20, + "signature": "(config: DocsConfig, context: DocsAnalysisContext, cwd?: string): Promise", + "sourceFile": "src/analyzers/docs/index.ts" }, "analyzeSdk": { "kind": "function", - "signature": "(config: SdkConfig, cwd?: string): Promise" + "line": 8, + "signature": "(config: SdkConfig, cwd?: string): Promise", + "sourceFile": "src/analyzers/typescript/index.ts" }, "buildReport": { "kind": "function", - "signature": "(baseline: Snapshot, head: Snapshot, config: DriftGuardConfig): Report" + "line": 20, + "signature": "(baseline: Snapshot, head: Snapshot, config: DriftGuardConfig): Report", + "sourceFile": "src/reporter/report.ts" }, "createEmptySnapshot": { "kind": "function", - "signature": "(driftguardVersion: string): Snapshot" + "line": 91, + "signature": "(driftguardVersion: string): Snapshot", + "sourceFile": "src/snapshot/schema.ts" }, "defineConfig": { "kind": "function", - "signature": "(config: DriftGuardConfigInput): DriftGuardConfigInput" + "line": 89, + "signature": "(config: DriftGuardConfigInput): DriftGuardConfigInput", + "sourceFile": "src/config/schema.ts" }, "diffContracts": { "kind": "function", - "signature": "(baseline: Record, head: Record): ContractChange[]" + "line": 18, + "signature": "(baseline: Record, head: Record): ContractChange[]", + "sourceFile": "src/analyzers/solidity/diff.ts" }, "diffDocs": { "kind": "function", - "signature": "(baseline: DocFileSnapshot[], head: DocFileSnapshot[]): DocChange[]" + "line": 11, + "signature": "(baseline: DocFileSnapshot[], head: DocFileSnapshot[]): DocChange[]", + "sourceFile": "src/analyzers/docs/diff.ts" }, "diffSdk": { "kind": "function", - "signature": "(baseline: SdkSnapshot, head: SdkSnapshot): SdkChange[]" + "line": 9, + "signature": "(baseline: SdkSnapshot, head: SdkSnapshot): SdkChange[]", + "sourceFile": "src/analyzers/typescript/diff.ts" }, "readSnapshot": { "kind": "function", - "signature": "(path: string): Promise" + "line": 33, + "signature": "(path: string): Promise", + "sourceFile": "src/snapshot/io.ts" }, "renderConsole": { "kind": "function", - "signature": "(report: Report): string" + "line": 5, + "signature": "(report: Report): string", + "sourceFile": "src/reporter/console.ts" }, "renderMarkdown": { "kind": "function", - "signature": "(report: Report): string" + "line": 11, + "signature": "(report: Report): string", + "sourceFile": "src/reporter/markdown.ts" }, "renderSarif": { "kind": "function", - "signature": "(report: Report, toolVersion: string): string" + "line": 30, + "signature": "(report: Report, toolVersion: string): string", + "sourceFile": "src/reporter/sarif.ts" }, "runDemos": { "kind": "function", - "signature": "(config: DemosConfig, cwd: string): Promise" + "line": 21, + "signature": "(config: DemosConfig, cwd: string): Promise", + "sourceFile": "src/analyzers/demos/run.ts" }, "snapshotExists": { "kind": "function", - "signature": "(path: string): Promise" + "line": 77, + "signature": "(path: string): Promise", + "sourceFile": "src/snapshot/io.ts" }, "writeSnapshot": { "kind": "function", - "signature": "(path: string, snapshot: Snapshot): Promise" + "line": 68, + "signature": "(path: string, snapshot: Snapshot): Promise", + "sourceFile": "src/snapshot/io.ts" } }, "packageName": "" From 671198760f8579f9ddbd8242076df59addfa5a23 Mon Sep 17 00:00:00 2001 From: mahimathacker Date: Sun, 10 May 2026 19:22:14 +0530 Subject: [PATCH 5/5] regenrated the snapshot filee --- .driftguard/snapshot.json | 176 ++++++++++---------------------------- 1 file changed, 45 insertions(+), 131 deletions(-) diff --git a/.driftguard/snapshot.json b/.driftguard/snapshot.json index 92fc188..a602d46 100644 --- a/.driftguard/snapshot.json +++ b/.driftguard/snapshot.json @@ -1,266 +1,180 @@ { - "createdAt": "2026-05-10T13:08:16.899Z", + "createdAt": "2026-05-10T13:49:00.521Z", "driftguardVersion": "0.1.0", "sdk": { - "entryPath": "src/index.ts", + "entryPath": "/Users/mahimathacker/driftguard/src/index.ts", "exports": { "AbiFragment": { "kind": "typeAlias", - "line": 89, - "signature": "type = z.infer", - "sourceFile": "src/snapshot/schema.ts" + "signature": "type = z.infer" }, "AbiParameter": { "kind": "typeAlias", - "line": 15, - "signature": "type = {\n name: string;\n type: string;\n internalType?: string;\n indexed?: boolean;\n components?: AbiParameter[];\n}", - "sourceFile": "src/snapshot/schema.ts" + "signature": "type = {\n name: string;\n type: string;\n internalType?: string;\n indexed?: boolean;\n components?: AbiParameter[];\n}" }, "ContractChange": { "kind": "typeAlias", - "line": 13, - "signature": "type = | { kind: 'contract-added'; name: string; contract: ContractSnapshot }\n | { kind: 'contract-removed'; name: string; contract: ContractSnapshot }\n | { kind: 'contract-modified'; name: string; fragments: FragmentChange[] }", - "sourceFile": "src/analyzers/solidity/diff.ts" + "signature": "type = | { kind: 'contract-added'; name: string; contract: ContractSnapshot }\n | { kind: 'contract-removed'; name: string; contract: ContractSnapshot }\n | { kind: 'contract-modified'; name: string; fragments: FragmentChange[] }" }, "ContractSnapshot": { "kind": "typeAlias", - "line": 84, - "signature": "type = z.infer", - "sourceFile": "src/snapshot/schema.ts" + "signature": "type = z.infer" }, "DemoResult": { "kind": "typeAlias", - "line": 10, - "signature": "type = {\n name: string;\n command: string;\n passed: boolean;\n exitCode: number;\n durationMs: number;\n output: string;\n}", - "sourceFile": "src/analyzers/demos/run.ts" + "signature": "type = {\n name: string;\n command: string;\n passed: boolean;\n exitCode: number;\n durationMs: number;\n output: string;\n}" }, "DocChange": { "kind": "typeAlias", - "line": 3, - "signature": "type = | { kind: 'doc-added'; file: string }\n | { kind: 'doc-removed'; file: string }\n | { kind: 'snippet-broken'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-fixed'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-removed'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-added-broken'; file: string; snippet: DocSnippet }", - "sourceFile": "src/analyzers/docs/diff.ts" + "signature": "type = | { kind: 'doc-added'; file: string }\n | { kind: 'doc-removed'; file: string }\n | { kind: 'snippet-broken'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-fixed'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-removed'; file: string; snippet: DocSnippet }\n | { kind: 'snippet-added-broken'; file: string; snippet: DocSnippet }" }, "DocFileSnapshot": { "kind": "typeAlias", - "line": 87, - "signature": "type = z.infer", - "sourceFile": "src/snapshot/schema.ts" + "signature": "type = z.infer" }, "DocSnippet": { "kind": "typeAlias", - "line": 88, - "signature": "type = z.infer", - "sourceFile": "src/snapshot/schema.ts" + "signature": "type = z.infer" }, "DriftGuardConfig": { "kind": "typeAlias", - "line": 86, - "signature": "type = z.infer", - "sourceFile": "src/config/schema.ts" + "signature": "type = z.infer" }, "DriftGuardConfigInput": { "kind": "typeAlias", - "line": 87, - "signature": "type = z.input", - "sourceFile": "src/config/schema.ts" + "signature": "type = z.input" }, "DriftGuardConfigSchema": { "kind": "variable", - "line": 73, - "signature": "z.ZodObject<{ contracts: z.ZodOptional; toolchain: z.ZodDefault>; ignore: z.ZodDefault>; }, z.core.$strict>>; sdk: z.ZodOptional>; tsconfig: z.ZodOptional; ignore: z.ZodDefault>; }, z.core.$strict>>; docs: z.ZodOptional; snippetLanguages: z.ZodDefault>>; ignoreTag: z.ZodDefault; ignore: z.ZodDefault>; }, z.core.$strict>>; demos: z.ZodPrefault; docker: z.ZodDefault; repos: z.ZodDefault; install: z.ZodOptional; packageManager: z.ZodDefault>; timeoutMs: z.ZodDefault; env: z.ZodDefault>; }, z.core.$strict>>>; }, z.core.$strict>>; severity: z.ZodPrefault>; abiAdded: z.ZodDefault>; abiMutabilityRelaxed: z.ZodDefault>; abiMutabilityTightened: z.ZodDefault>; solidityAstBreaking: z.ZodDefault>; sdkBreaking: z.ZodDefault>; sdkAdded: z.ZodDefault>; sdkSignatureChanged: z.ZodDefault>; docSnippetFails: z.ZodDefault>; docSnippetReferencesRemoved: z.ZodDefault>; demoFails: z.ZodDefault>; }, z.core.$strict>>; snapshot: z.ZodPrefault; mode: z.ZodDefault>; baseBranch: z.ZodDefault; }, z.core.$strict>>; report: z.ZodPrefault>>; sarifPath: z.ZodDefault; markdownPath: z.ZodDefault; jsonPath: z.ZodDefault; }, z.core.$strict>>; }, z.core.$strict>", - "sourceFile": "src/config/schema.ts" + "signature": "z.object({\n contracts: ContractsConfig.optional(),\n sdk: SdkConfig.optional(),\n docs: DocsConfig.optional(),\n demos: DemosConfig.prefault({}),\n severity: SeverityRules.prefault({}),\n snapshot: SnapshotConfig.prefault({}),\n report: ReportConfig.prefault({}),\n}).strict().refine(\n (c) => c.contracts || c.sdk || c.docs,\n { message: 'At least one of `contracts`, `sdk`, or `docs` must be configured.' },\n)" }, "Finding": { "kind": "typeAlias", - "line": 11, - "signature": "type = {\n ruleId: RuleId;\n severity: 'error' | 'warning';\n layer: Layer;\n message: string;\n file?: string;\n line?: number;\n before?: string;\n after?: string;\n}", - "sourceFile": "src/reporter/findings.ts" + "signature": "type = {\n ruleId: RuleId;\n severity: 'error' | 'warning';\n layer: Layer;\n message: string;\n file?: string;\n line?: number;\n before?: string;\n after?: string;\n}" }, "FragmentChange": { "kind": "typeAlias", - "line": 6, - "signature": "type = | { kind: 'fragment-added'; key: string; fragment: AbiFragment }\n | { kind: 'fragment-removed'; key: string; fragment: AbiFragment }\n | { kind: 'mutability-tightened'; key: string; before: Mutability; after: Mutability }\n | { kind: 'mutability-relaxed'; key: string; before: Mutability; after: Mutability }\n | { kind: 'outputs-changed'; key: string; before: AbiParameter[]; after: AbiParameter[] }", - "sourceFile": "src/analyzers/solidity/diff.ts" + "signature": "type = | { kind: 'fragment-added'; key: string; fragment: AbiFragment }\n | { kind: 'fragment-removed'; key: string; fragment: AbiFragment }\n | { kind: 'mutability-tightened'; key: string; before: Mutability; after: Mutability }\n | { kind: 'mutability-relaxed'; key: string; before: Mutability; after: Mutability }\n | { kind: 'outputs-changed'; key: string; before: AbiParameter[]; after: AbiParameter[] }" }, "Layer": { "kind": "typeAlias", - "line": 9, - "signature": "type = 'contracts' | 'sdk' | 'docs' | 'demos'", - "sourceFile": "src/reporter/findings.ts" + "signature": "type = 'contracts' | 'sdk' | 'docs' | 'demos'" }, "RULES": { "kind": "variable", - "line": 16, - "signature": "Record", - "sourceFile": "src/reporter/rules.ts" + "signature": "Record" }, "Report": { "kind": "typeAlias", - "line": 13, - "signature": "type = {\n findings: Finding[];\n errorCount: number;\n warningCount: number;\n exitCode: 0 | 1;\n}", - "sourceFile": "src/reporter/report.ts" + "signature": "type = {\n findings: Finding[];\n errorCount: number;\n warningCount: number;\n exitCode: 0 | 1;\n}" }, "RuleId": { "kind": "typeAlias", - "line": 5, - "signature": "type = | 'abi-breaking'\n | 'abi-added'\n | 'abi-mutability-tightened'\n | 'abi-mutability-relaxed'\n | 'sdk-breaking'\n | 'sdk-added'\n | 'sdk-signature-changed'\n | 'doc-snippet-fails'\n | 'demo-fails'", - "sourceFile": "src/reporter/rules.ts" + "signature": "type = | 'abi-breaking'\n | 'abi-added'\n | 'abi-mutability-tightened'\n | 'abi-mutability-relaxed'\n | 'sdk-breaking'\n | 'sdk-added'\n | 'sdk-signature-changed'\n | 'doc-snippet-fails'\n | 'demo-fails'" }, "SNAPSHOT_VERSION": { "kind": "variable", - "line": 3, - "signature": "1", - "sourceFile": "src/snapshot/schema.ts" + "signature": "1 as const" }, "SdkChange": { "kind": "typeAlias", - "line": 3, - "signature": "type = | { kind: 'export-added'; name: string; export: SdkExport }\n | { kind: 'export-removed'; name: string; export: SdkExport }\n | { kind: 'kind-changed'; name: string; before: SdkExport; after: SdkExport }\n | { kind: 'signature-changed'; name: string; before: SdkExport; after: SdkExport }", - "sourceFile": "src/analyzers/typescript/diff.ts" + "signature": "type = | { kind: 'export-added'; name: string; export: SdkExport }\n | { kind: 'export-removed'; name: string; export: SdkExport }\n | { kind: 'kind-changed'; name: string; before: SdkExport; after: SdkExport }\n | { kind: 'signature-changed'; name: string; before: SdkExport; after: SdkExport }" }, "SdkExport": { "kind": "typeAlias", - "line": 86, - "signature": "type = z.infer", - "sourceFile": "src/snapshot/schema.ts" + "signature": "type = z.infer" }, "SdkSnapshot": { "kind": "typeAlias", - "line": 85, - "signature": "type = z.infer", - "sourceFile": "src/snapshot/schema.ts" + "signature": "type = z.infer" }, "Severity": { "kind": "typeAlias", - "line": 4, - "signature": "type = z.infer", - "sourceFile": "src/config/schema.ts" + "signature": "type = z.infer" }, "Snapshot": { "kind": "typeAlias", - "line": 83, - "signature": "type = z.infer", - "sourceFile": "src/snapshot/schema.ts" + "signature": "type = z.infer" }, "SnapshotNotFoundError": { "kind": "class", - "line": 6, - "signature": "class {\n constructor(path: string);\n}", - "sourceFile": "src/snapshot/io.ts" + "signature": "class {\n constructor(path: string);\n}" }, "SnapshotParseError": { "kind": "class", - "line": 25, - "signature": "class {\n constructor(path: string, cause: unknown);\n}", - "sourceFile": "src/snapshot/io.ts" + "signature": "class {\n constructor(path: string, cause: unknown);\n}" }, "SnapshotSchema": { "kind": "variable", - "line": 74, - "signature": "z.ZodObject<{ version: z.ZodLiteral<1>; createdAt: z.ZodISODateTime; driftguardVersion: z.ZodString; contracts: z.ZodOptional; abi: z.ZodArray; name: z.ZodOptional; inputs: z.ZodDefault>>>; outputs: z.ZodOptional>>>; stateMutability: z.ZodOptional>; anonymous: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>>>; sdk: z.ZodOptional; entryPath: z.ZodString; exports: z.ZodRecord; signature: z.ZodString; }, z.core.$strict>>; }, z.core.$strict>>; docs: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>>>; }, z.core.$strict>", - "sourceFile": "src/snapshot/schema.ts" + "signature": "z.object({\n version: z.literal(SNAPSHOT_VERSION),\n createdAt: z.iso.datetime(),\n driftguardVersion: z.string(),\n contracts: z.record(z.string(), ContractSnapshotSchema).optional(),\n sdk: SdkSnapshotSchema.optional(),\n docs: z.array(DocFileSnapshotSchema).optional(),\n}).strict()" }, "SnapshotVersionError": { "kind": "class", - "line": 15, - "signature": "class {\n constructor(path: string, found: number);\n}", - "sourceFile": "src/snapshot/io.ts" + "signature": "class {\n constructor(path: string, found: number);\n}" }, "analyzeContracts": { "kind": "function", - "line": 12, - "signature": "(config: ContractsConfig, cwd?: string): Promise>", - "sourceFile": "src/analyzers/solidity/index.ts" + "signature": "(config: ContractsConfig, cwd?: string): Promise>" }, "analyzeDocs": { "kind": "function", - "line": 20, - "signature": "(config: DocsConfig, context: DocsAnalysisContext, cwd?: string): Promise", - "sourceFile": "src/analyzers/docs/index.ts" + "signature": "(config: DocsConfig, context: DocsAnalysisContext, cwd?: string): Promise" }, "analyzeSdk": { "kind": "function", - "line": 8, - "signature": "(config: SdkConfig, cwd?: string): Promise", - "sourceFile": "src/analyzers/typescript/index.ts" + "signature": "(config: SdkConfig, cwd?: string): Promise" }, "buildReport": { "kind": "function", - "line": 20, - "signature": "(baseline: Snapshot, head: Snapshot, config: DriftGuardConfig): Report", - "sourceFile": "src/reporter/report.ts" + "signature": "(baseline: Snapshot, head: Snapshot, config: DriftGuardConfig): Report" }, "createEmptySnapshot": { "kind": "function", - "line": 91, - "signature": "(driftguardVersion: string): Snapshot", - "sourceFile": "src/snapshot/schema.ts" + "signature": "(driftguardVersion: string): Snapshot" }, "defineConfig": { "kind": "function", - "line": 89, - "signature": "(config: DriftGuardConfigInput): DriftGuardConfigInput", - "sourceFile": "src/config/schema.ts" + "signature": "(config: DriftGuardConfigInput): DriftGuardConfigInput" }, "diffContracts": { "kind": "function", - "line": 18, - "signature": "(baseline: Record, head: Record): ContractChange[]", - "sourceFile": "src/analyzers/solidity/diff.ts" + "signature": "(baseline: Record, head: Record): ContractChange[]" }, "diffDocs": { "kind": "function", - "line": 11, - "signature": "(baseline: DocFileSnapshot[], head: DocFileSnapshot[]): DocChange[]", - "sourceFile": "src/analyzers/docs/diff.ts" + "signature": "(baseline: DocFileSnapshot[], head: DocFileSnapshot[]): DocChange[]" }, "diffSdk": { "kind": "function", - "line": 9, - "signature": "(baseline: SdkSnapshot, head: SdkSnapshot): SdkChange[]", - "sourceFile": "src/analyzers/typescript/diff.ts" + "signature": "(baseline: SdkSnapshot, head: SdkSnapshot): SdkChange[]" }, "readSnapshot": { "kind": "function", - "line": 33, - "signature": "(path: string): Promise", - "sourceFile": "src/snapshot/io.ts" + "signature": "(path: string): Promise" }, "renderConsole": { "kind": "function", - "line": 5, - "signature": "(report: Report): string", - "sourceFile": "src/reporter/console.ts" + "signature": "(report: Report): string" }, "renderMarkdown": { "kind": "function", - "line": 11, - "signature": "(report: Report): string", - "sourceFile": "src/reporter/markdown.ts" + "signature": "(report: Report): string" }, "renderSarif": { "kind": "function", - "line": 30, - "signature": "(report: Report, toolVersion: string): string", - "sourceFile": "src/reporter/sarif.ts" + "signature": "(report: Report, toolVersion: string): string" }, "runDemos": { "kind": "function", - "line": 21, - "signature": "(config: DemosConfig, cwd: string): Promise", - "sourceFile": "src/analyzers/demos/run.ts" + "signature": "(config: DemosConfig, cwd: string): Promise" }, "snapshotExists": { "kind": "function", - "line": 77, - "signature": "(path: string): Promise", - "sourceFile": "src/snapshot/io.ts" + "signature": "(path: string): Promise" }, "writeSnapshot": { "kind": "function", - "line": 68, - "signature": "(path: string, snapshot: Snapshot): Promise", - "sourceFile": "src/snapshot/io.ts" + "signature": "(path: string, snapshot: Snapshot): Promise" } }, "packageName": ""