geopilot 0.0.0-stage → 0.0.1-bootstrap.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/LICENSE +202 -0
- package/README.md +72 -2
- package/dist/agent/install.d.ts +23 -0
- package/dist/agent/install.js +75 -0
- package/dist/agent/install.js.map +1 -0
- package/dist/cache/runs.d.ts +18 -0
- package/dist/cache/runs.js +91 -0
- package/dist/cache/runs.js.map +1 -0
- package/dist/cli/args.d.ts +20 -0
- package/dist/cli/args.js +116 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/commands/agent.d.ts +2 -0
- package/dist/cli/commands/agent.js +48 -0
- package/dist/cli/commands/agent.js.map +1 -0
- package/dist/cli/commands/fix.d.ts +2 -0
- package/dist/cli/commands/fix.js +284 -0
- package/dist/cli/commands/fix.js.map +1 -0
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.js +62 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/insights.d.ts +17 -0
- package/dist/cli/commands/insights.js +143 -0
- package/dist/cli/commands/insights.js.map +1 -0
- package/dist/cli/commands/rules.d.ts +5 -0
- package/dist/cli/commands/rules.js +86 -0
- package/dist/cli/commands/rules.js.map +1 -0
- package/dist/cli/commands/scan.d.ts +14 -0
- package/dist/cli/commands/scan.js +127 -0
- package/dist/cli/commands/scan.js.map +1 -0
- package/dist/cli/commands-list.d.ts +6 -0
- package/dist/cli/commands-list.js +15 -0
- package/dist/cli/commands-list.js.map +1 -0
- package/dist/cli/context.d.ts +26 -0
- package/dist/cli/context.js +108 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/io.d.ts +16 -0
- package/dist/cli/io.js +28 -0
- package/dist/cli/io.js.map +1 -0
- package/dist/cli/main.d.ts +15 -0
- package/dist/cli/main.js +118 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/collect/crawl.d.ts +51 -0
- package/dist/collect/crawl.js +187 -0
- package/dist/collect/crawl.js.map +1 -0
- package/dist/config/config.d.ts +86 -0
- package/dist/config/config.js +396 -0
- package/dist/config/config.js.map +1 -0
- package/dist/core/errors.d.ts +20 -0
- package/dist/core/errors.js +32 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/hash.d.ts +7 -0
- package/dist/core/hash.js +28 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/redact.d.ts +3 -0
- package/dist/core/redact.js +23 -0
- package/dist/core/redact.js.map +1 -0
- package/dist/core/tty.d.ts +12 -0
- package/dist/core/tty.js +33 -0
- package/dist/core/tty.js.map +1 -0
- package/dist/core/version.d.ts +6 -0
- package/dist/core/version.js +10 -0
- package/dist/core/version.js.map +1 -0
- package/dist/fix/apply.d.ts +119 -0
- package/dist/fix/apply.js +334 -0
- package/dist/fix/apply.js.map +1 -0
- package/dist/fix/diff.d.ts +1 -0
- package/dist/fix/diff.js +35 -0
- package/dist/fix/diff.js.map +1 -0
- package/dist/fix/plan.d.ts +42 -0
- package/dist/fix/plan.js +385 -0
- package/dist/fix/plan.js.map +1 -0
- package/dist/fix/serve.d.ts +13 -0
- package/dist/fix/serve.js +112 -0
- package/dist/fix/serve.js.map +1 -0
- package/dist/fix/variants.d.ts +13 -0
- package/dist/fix/variants.js +8 -0
- package/dist/fix/variants.js.map +1 -0
- package/dist/frameworks/ast.d.ts +84 -0
- package/dist/frameworks/ast.js +231 -0
- package/dist/frameworks/ast.js.map +1 -0
- package/dist/frameworks/nextjs-app/analyze.d.ts +92 -0
- package/dist/frameworks/nextjs-app/analyze.js +350 -0
- package/dist/frameworks/nextjs-app/analyze.js.map +1 -0
- package/dist/frameworks/static/analyze.d.ts +18 -0
- package/dist/frameworks/static/analyze.js +66 -0
- package/dist/frameworks/static/analyze.js.map +1 -0
- package/dist/html/parse.d.ts +50 -0
- package/dist/html/parse.js +205 -0
- package/dist/html/parse.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/insights/validate.d.ts +74 -0
- package/dist/insights/validate.js +213 -0
- package/dist/insights/validate.js.map +1 -0
- package/dist/net/address.d.ts +10 -0
- package/dist/net/address.js +116 -0
- package/dist/net/address.js.map +1 -0
- package/dist/net/fetch.d.ts +53 -0
- package/dist/net/fetch.js +281 -0
- package/dist/net/fetch.js.map +1 -0
- package/dist/repo/detect.d.ts +3 -0
- package/dist/repo/detect.js +92 -0
- package/dist/repo/detect.js.map +1 -0
- package/dist/repo/reader.d.ts +12 -0
- package/dist/repo/reader.js +97 -0
- package/dist/repo/reader.js.map +1 -0
- package/dist/report/render.d.ts +20 -0
- package/dist/report/render.js +176 -0
- package/dist/report/render.js.map +1 -0
- package/dist/robots/crawlers.d.ts +10 -0
- package/dist/robots/crawlers.js +20 -0
- package/dist/robots/crawlers.js.map +1 -0
- package/dist/robots/robots.d.ts +33 -0
- package/dist/robots/robots.js +133 -0
- package/dist/robots/robots.js.map +1 -0
- package/dist/rules/catalogue.d.ts +43 -0
- package/dist/rules/catalogue.js +361 -0
- package/dist/rules/catalogue.js.map +1 -0
- package/dist/rules/context.d.ts +36 -0
- package/dist/rules/context.js +129 -0
- package/dist/rules/context.js.map +1 -0
- package/dist/rules/evaluate.d.ts +11 -0
- package/dist/rules/evaluate.js +1070 -0
- package/dist/rules/evaluate.js.map +1 -0
- package/dist/rules/finalize.d.ts +34 -0
- package/dist/rules/finalize.js +93 -0
- package/dist/rules/finalize.js.map +1 -0
- package/dist/scan.d.ts +27 -0
- package/dist/scan.js +147 -0
- package/dist/scan.js.map +1 -0
- package/dist/scoring/compare.d.ts +21 -0
- package/dist/scoring/compare.js +47 -0
- package/dist/scoring/compare.js.map +1 -0
- package/dist/scoring/score.d.ts +21 -0
- package/dist/scoring/score.js +112 -0
- package/dist/scoring/score.js.map +1 -0
- package/dist/sitemap/sitemap.d.ts +10 -0
- package/dist/sitemap/sitemap.js +48 -0
- package/dist/sitemap/sitemap.js.map +1 -0
- package/dist/types.d.ts +155 -0
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -0
- package/hosts/claude-project/.claude/agents/geopilot-explainer.md +36 -0
- package/hosts/claude-project/.claude/agents/geopilot-fixer.md +42 -0
- package/hosts/claude-project/.claude/agents/geopilot-investigator.md +45 -0
- package/hosts/claude-project/.claude/agents/geopilot-reviewer.md +41 -0
- package/hosts/claude-project/.claude/agents/geopilot-scanner.md +47 -0
- package/hosts/claude-project/.claude/skills/geo/SKILL.md +95 -0
- package/hosts/claude-project/.claude/skills/geo/references/frameworks.md +20 -0
- package/hosts/claude-project/.claude/skills/geo/references/insight-contract.md +42 -0
- package/hosts/claude-project/.claude/skills/geo/references/safety.md +30 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-explain.md +8 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-fix.md +20 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-init.md +6 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-insights.md +13 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-plan.md +13 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-review.md +8 -0
- package/hosts/claude-project/.claude/skills/geo/references/workflow-scan.md +18 -0
- package/hosts/claude-project/.claude/skills/geo/schemas/insights.schema.json +255 -0
- package/hosts/claude-project/.claude/skills/geo/scripts/geo.ps1 +11 -0
- package/hosts/claude-project/.claude/skills/geo/scripts/geo.sh +11 -0
- package/hosts/claude-project/.claude/skills/geopilot-explain/SKILL.md +9 -0
- package/hosts/claude-project/.claude/skills/geopilot-fix/SKILL.md +12 -0
- package/hosts/claude-project/.claude/skills/geopilot-init/SKILL.md +15 -0
- package/hosts/claude-project/.claude/skills/geopilot-insights/SKILL.md +11 -0
- package/hosts/claude-project/.claude/skills/geopilot-review/SKILL.md +11 -0
- package/hosts/claude-project/.claude/skills/geopilot-scan/SKILL.md +11 -0
- package/hosts/geopilot/.claude-plugin/plugin.json +22 -0
- package/hosts/geopilot/README.md +25 -0
- package/hosts/geopilot/agents/explainer.agent.md +36 -0
- package/hosts/geopilot/agents/fixer.agent.md +42 -0
- package/hosts/geopilot/agents/investigator.agent.md +45 -0
- package/hosts/geopilot/agents/reviewer.agent.md +41 -0
- package/hosts/geopilot/agents/scanner.agent.md +47 -0
- package/hosts/geopilot/assets/icon.png +0 -0
- package/hosts/geopilot/skills/explain/SKILL.md +9 -0
- package/hosts/geopilot/skills/fix/SKILL.md +12 -0
- package/hosts/geopilot/skills/geo/SKILL.md +95 -0
- package/hosts/geopilot/skills/geo/references/frameworks.md +20 -0
- package/hosts/geopilot/skills/geo/references/insight-contract.md +42 -0
- package/hosts/geopilot/skills/geo/references/safety.md +30 -0
- package/hosts/geopilot/skills/geo/references/workflow-explain.md +8 -0
- package/hosts/geopilot/skills/geo/references/workflow-fix.md +20 -0
- package/hosts/geopilot/skills/geo/references/workflow-init.md +6 -0
- package/hosts/geopilot/skills/geo/references/workflow-insights.md +13 -0
- package/hosts/geopilot/skills/geo/references/workflow-plan.md +13 -0
- package/hosts/geopilot/skills/geo/references/workflow-review.md +8 -0
- package/hosts/geopilot/skills/geo/references/workflow-scan.md +18 -0
- package/hosts/geopilot/skills/geo/schemas/insights.schema.json +255 -0
- package/hosts/geopilot/skills/geo/scripts/geo.ps1 +11 -0
- package/hosts/geopilot/skills/geo/scripts/geo.sh +11 -0
- package/hosts/geopilot/skills/init/SKILL.md +15 -0
- package/hosts/geopilot/skills/insights/SKILL.md +11 -0
- package/hosts/geopilot/skills/review/SKILL.md +11 -0
- package/hosts/geopilot/skills/scan/SKILL.md +11 -0
- package/hosts/opencode/.opencode/agents/geopilot-explainer.md +39 -0
- package/hosts/opencode/.opencode/agents/geopilot-fixer.md +45 -0
- package/hosts/opencode/.opencode/agents/geopilot-investigator.md +48 -0
- package/hosts/opencode/.opencode/agents/geopilot-reviewer.md +44 -0
- package/hosts/opencode/.opencode/agents/geopilot-scanner.md +50 -0
- package/hosts/opencode/.opencode/commands/geopilot-explain.md +8 -0
- package/hosts/opencode/.opencode/commands/geopilot-fix.md +10 -0
- package/hosts/opencode/.opencode/commands/geopilot-init.md +12 -0
- package/hosts/opencode/.opencode/commands/geopilot-insights.md +10 -0
- package/hosts/opencode/.opencode/commands/geopilot-review.md +10 -0
- package/hosts/opencode/.opencode/commands/geopilot-scan.md +10 -0
- package/hosts/opencode/.opencode/skills/geo/SKILL.md +95 -0
- package/hosts/opencode/.opencode/skills/geo/references/frameworks.md +20 -0
- package/hosts/opencode/.opencode/skills/geo/references/insight-contract.md +42 -0
- package/hosts/opencode/.opencode/skills/geo/references/safety.md +30 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-explain.md +8 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-fix.md +20 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-init.md +6 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-insights.md +13 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-plan.md +13 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-review.md +8 -0
- package/hosts/opencode/.opencode/skills/geo/references/workflow-scan.md +18 -0
- package/hosts/opencode/.opencode/skills/geo/schemas/insights.schema.json +255 -0
- package/hosts/opencode/.opencode/skills/geo/scripts/geo.ps1 +11 -0
- package/hosts/opencode/.opencode/skills/geo/scripts/geo.sh +11 -0
- package/package.json +65 -4
- package/schemas/config-v1.json +392 -0
- package/schemas/insights-v1.json +255 -0
- package/schemas/merged-v1.json +71 -0
- package/schemas/report-v1.json +836 -0
- package/skill/geo/SKILL.md +95 -0
- package/skill/geo/references/frameworks.md +20 -0
- package/skill/geo/references/insight-contract.md +42 -0
- package/skill/geo/references/safety.md +30 -0
- package/skill/geo/references/workflow-explain.md +8 -0
- package/skill/geo/references/workflow-fix.md +20 -0
- package/skill/geo/references/workflow-init.md +6 -0
- package/skill/geo/references/workflow-insights.md +13 -0
- package/skill/geo/references/workflow-plan.md +13 -0
- package/skill/geo/references/workflow-review.md +8 -0
- package/skill/geo/references/workflow-scan.md +18 -0
- package/skill/geo/schemas/insights.schema.json +255 -0
- package/skill/geo/scripts/geo.ps1 +11 -0
- package/skill/geo/scripts/geo.sh +11 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { type Report } from '../types.ts';
|
|
2
|
+
import { VARIANTS, type FixProposal, type VerificationLevel } from './plan.ts';
|
|
3
|
+
export type Outcome = 'verified' | 'applied_unverified' | 'rolled_back';
|
|
4
|
+
export type CheckStatus = 'pass' | 'fail' | 'not_run';
|
|
5
|
+
export interface Check {
|
|
6
|
+
readonly level: VerificationLevel;
|
|
7
|
+
readonly status: CheckStatus;
|
|
8
|
+
readonly detail: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ChangeReport {
|
|
11
|
+
readonly fixId: string;
|
|
12
|
+
readonly variant: string;
|
|
13
|
+
readonly class: string;
|
|
14
|
+
readonly ruleId: string;
|
|
15
|
+
readonly subjects: readonly string[];
|
|
16
|
+
readonly fingerprints: readonly string[];
|
|
17
|
+
readonly files: readonly {
|
|
18
|
+
readonly path: string;
|
|
19
|
+
readonly linesChanged: number;
|
|
20
|
+
readonly created: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
readonly conditionBefore: string;
|
|
23
|
+
readonly conditionAfter: string;
|
|
24
|
+
readonly newAffectedFindings: readonly string[];
|
|
25
|
+
readonly verification: {
|
|
26
|
+
readonly required: VerificationLevel;
|
|
27
|
+
readonly achieved: VerificationLevel | null;
|
|
28
|
+
readonly checks: readonly Check[];
|
|
29
|
+
};
|
|
30
|
+
readonly runtime_observation: 'changed' | 'unchanged' | 'unavailable';
|
|
31
|
+
readonly source_freshness: 'confirmed' | 'unconfirmed';
|
|
32
|
+
readonly freshness_basis: string | null;
|
|
33
|
+
readonly rule_outcome: 'pass' | 'fail' | 'not_evaluated' | 'error';
|
|
34
|
+
readonly runtime_unavailable: string | null;
|
|
35
|
+
readonly outcome: Outcome;
|
|
36
|
+
readonly snapshot: string;
|
|
37
|
+
}
|
|
38
|
+
export interface Rescanner {
|
|
39
|
+
/** Repo-only re-scan of the working tree as it is on disk now. */
|
|
40
|
+
repo(): Promise<Report>;
|
|
41
|
+
/** URL-only scan of specific URLs (no crawl). */
|
|
42
|
+
urls(urls: readonly string[]): Promise<Report>;
|
|
43
|
+
}
|
|
44
|
+
export interface VerifyAuthority {
|
|
45
|
+
readonly commands: readonly (readonly string[])[];
|
|
46
|
+
readonly serve: {
|
|
47
|
+
readonly command: readonly string[];
|
|
48
|
+
readonly url: string;
|
|
49
|
+
readonly readyTimeoutSeconds: number;
|
|
50
|
+
} | null;
|
|
51
|
+
/** A server the developer runs. Observation only: never confirms freshness. */
|
|
52
|
+
readonly observeUrl: string | null;
|
|
53
|
+
readonly runtimeTimeoutSeconds: number;
|
|
54
|
+
}
|
|
55
|
+
export interface ManifestEntry {
|
|
56
|
+
readonly fixId: string;
|
|
57
|
+
readonly outcome: Outcome;
|
|
58
|
+
readonly proposal: Pick<FixProposal, 'variant' | 'ruleId' | 'subCheck' | 'subjects' | 'required' | 'affectedRoutes' | 'fingerprints' | 'class' | 'title'>;
|
|
59
|
+
readonly files: readonly {
|
|
60
|
+
readonly path: string;
|
|
61
|
+
readonly existedBefore: boolean;
|
|
62
|
+
readonly beforeHash: string | null;
|
|
63
|
+
readonly afterHash: string;
|
|
64
|
+
readonly snapshot: string | null;
|
|
65
|
+
}[];
|
|
66
|
+
readonly lastWriteMs: number;
|
|
67
|
+
}
|
|
68
|
+
export interface Manifest {
|
|
69
|
+
readonly runId: string;
|
|
70
|
+
readonly appliedAt: string;
|
|
71
|
+
readonly fixes: ManifestEntry[];
|
|
72
|
+
}
|
|
73
|
+
export declare function readManifest(runDir: string): Manifest | null;
|
|
74
|
+
export interface VerifyInput {
|
|
75
|
+
readonly proposal: ManifestEntry['proposal'];
|
|
76
|
+
readonly lastWriteMs: number;
|
|
77
|
+
readonly before: Report;
|
|
78
|
+
readonly after: Report;
|
|
79
|
+
readonly authority: VerifyAuthority;
|
|
80
|
+
readonly repoRoot: string;
|
|
81
|
+
readonly rescan: Rescanner;
|
|
82
|
+
readonly priorRuntime: Report | null;
|
|
83
|
+
readonly v1Checks: readonly Check[];
|
|
84
|
+
}
|
|
85
|
+
export interface VerifyResult {
|
|
86
|
+
readonly checks: Check[];
|
|
87
|
+
readonly achieved: VerificationLevel | null;
|
|
88
|
+
readonly outcome: Outcome;
|
|
89
|
+
readonly conditionAfter: string;
|
|
90
|
+
readonly newAffected: string[];
|
|
91
|
+
readonly runtime_observation: ChangeReport['runtime_observation'];
|
|
92
|
+
readonly source_freshness: ChangeReport['source_freshness'];
|
|
93
|
+
readonly freshness_basis: string | null;
|
|
94
|
+
readonly rule_outcome: ChangeReport['rule_outcome'];
|
|
95
|
+
readonly runtime_unavailable: string | null;
|
|
96
|
+
}
|
|
97
|
+
/** V1–V4 for one applied fix (spec 12.2–12.4). Pure decision logic over the evidence it gathers. */
|
|
98
|
+
export declare function verifyApplied(input: VerifyInput): Promise<VerifyResult>;
|
|
99
|
+
export interface ApplyInput {
|
|
100
|
+
readonly proposals: readonly FixProposal[];
|
|
101
|
+
readonly repoRoot: string;
|
|
102
|
+
readonly runDir: string;
|
|
103
|
+
readonly runId: string;
|
|
104
|
+
readonly before: Report;
|
|
105
|
+
readonly priorRuntime: Report | null;
|
|
106
|
+
readonly authority: VerifyAuthority;
|
|
107
|
+
readonly rescan: Rescanner;
|
|
108
|
+
}
|
|
109
|
+
/** Snapshot, splice, verify, and roll back only the fix whose check failed. */
|
|
110
|
+
export declare function applyFixes(input: ApplyInput): Promise<ChangeReport[]>;
|
|
111
|
+
export interface RollbackResult {
|
|
112
|
+
readonly restored: string[];
|
|
113
|
+
readonly conflicts: string[];
|
|
114
|
+
}
|
|
115
|
+
/** Restore snapshots, refusing any file edited after the fix run (spec 12.4.6). */
|
|
116
|
+
export declare function rollback(repoRoot: string, runDir: string, dryRun: boolean): RollbackResult;
|
|
117
|
+
export declare function loadBefore(runDir: string, fixId: string): Report | null;
|
|
118
|
+
export declare function currentV1(repoRoot: string, entry: ManifestEntry): Check[];
|
|
119
|
+
export declare function variantRequired(variant: keyof typeof VARIANTS): VerificationLevel;
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { canonicalJson, sha256 } from "../core/hash.js";
|
|
5
|
+
import { redact } from "../core/redact.js";
|
|
6
|
+
import { parseModule } from "../frameworks/ast.js";
|
|
7
|
+
import { parseHtml } from "../html/parse.js";
|
|
8
|
+
import { parseRobots } from "../robots/robots.js";
|
|
9
|
+
import { clusterPath } from "../rules/context.js";
|
|
10
|
+
import { subjectKey } from "../types.js";
|
|
11
|
+
import { VARIANTS } from "./plan.js";
|
|
12
|
+
import { startServe } from "./serve.js";
|
|
13
|
+
const LEVEL_ORDER = ['V1', 'V2', 'V3', 'V4'];
|
|
14
|
+
function manifestPath(runDir) {
|
|
15
|
+
return join(runDir, 'fix', 'manifest.json');
|
|
16
|
+
}
|
|
17
|
+
export function readManifest(runDir) {
|
|
18
|
+
const p = manifestPath(runDir);
|
|
19
|
+
return existsSync(p) ? JSON.parse(readFileSync(p, 'utf8')) : null;
|
|
20
|
+
}
|
|
21
|
+
function writeManifest(runDir, m) {
|
|
22
|
+
mkdirSync(join(runDir, 'fix'), { recursive: true });
|
|
23
|
+
writeFileSync(manifestPath(runDir), canonicalJson(m));
|
|
24
|
+
}
|
|
25
|
+
function v1(path, content) {
|
|
26
|
+
if (/\.(tsx?|jsx?|mjs|cjs|mts|cts)$/.test(path)) {
|
|
27
|
+
const r = parseModule(path, content);
|
|
28
|
+
return 'error' in r ? { level: 'V1', status: 'fail', detail: `${path}: ${r.error.split('\n')[0]}` } : { level: 'V1', status: 'pass', detail: `${path} parses` };
|
|
29
|
+
}
|
|
30
|
+
if (/robots\.txt$/.test(path)) {
|
|
31
|
+
const r = parseRobots(content);
|
|
32
|
+
return r.invalidLines.length === 0 ? { level: 'V1', status: 'pass', detail: `${path} parses` } : { level: 'V1', status: 'fail', detail: `${path}: invalid lines ${r.invalidLines.join(', ')}` };
|
|
33
|
+
}
|
|
34
|
+
if (/\.html?$/.test(path)) {
|
|
35
|
+
const doc = parseHtml(content);
|
|
36
|
+
return doc.elements.some((e) => e.name === 'html') ? { level: 'V1', status: 'pass', detail: `${path} parses` } : { level: 'V1', status: 'fail', detail: `${path}: no <html> element after edit` };
|
|
37
|
+
}
|
|
38
|
+
return { level: 'V1', status: 'pass', detail: `${path}: no parser for this type; byte check only` };
|
|
39
|
+
}
|
|
40
|
+
function findEvaluations(report, ruleId, subjects) {
|
|
41
|
+
const keys = new Set(subjects.map(subjectKey));
|
|
42
|
+
return report.evaluations.filter((e) => e.ruleId === ruleId && keys.has(subjectKey(e.subject)));
|
|
43
|
+
}
|
|
44
|
+
function subCheckStatus(evals, subCheck) {
|
|
45
|
+
if (evals.length === 0)
|
|
46
|
+
return 'not_run';
|
|
47
|
+
const statuses = evals.map((e) => e.subChecks.find((s) => s.id === subCheck)?.status ?? 'not_run');
|
|
48
|
+
if (statuses.some((s) => s === 'fail'))
|
|
49
|
+
return 'fail';
|
|
50
|
+
if (statuses.every((s) => s === 'pass'))
|
|
51
|
+
return 'pass';
|
|
52
|
+
return 'not_run';
|
|
53
|
+
}
|
|
54
|
+
function affectedKeys(p) {
|
|
55
|
+
return new Set([...p.subjects.map(subjectKey), ...p.affectedRoutes.map((r) => `route:${r}`), 'site']);
|
|
56
|
+
}
|
|
57
|
+
function newFindings(before, after, p) {
|
|
58
|
+
const keys = affectedKeys(p);
|
|
59
|
+
const old = new Set(before.evaluations.flatMap((e) => e.findings.map((f) => f.fingerprint)));
|
|
60
|
+
return after.evaluations
|
|
61
|
+
.filter((e) => keys.has(subjectKey(e.subject)))
|
|
62
|
+
.flatMap((e) => e.findings.filter((f) => f.evidenceQuality !== 'inferred' && !old.has(f.fingerprint)).map((f) => `${f.ruleId} ${f.fingerprint}: ${f.message}`));
|
|
63
|
+
}
|
|
64
|
+
function runCommand(argv, cwd, timeoutSeconds) {
|
|
65
|
+
return new Promise((resolve) => {
|
|
66
|
+
execFile(argv[0], argv.slice(1), { cwd, timeout: timeoutSeconds * 1000, shell: false, maxBuffer: 4 * 1024 * 1024, windowsHide: true }, (err, stdout, stderr) => {
|
|
67
|
+
const tail = redact(`${stdout}${stderr}`).trim().split('\n').slice(-5).join(' | ').slice(0, 300);
|
|
68
|
+
resolve({ ok: !err, detail: `${argv.join(' ')} → ${err ? `failed (${err.code ?? 'exit'})` : 'exit 0'}${tail ? `: ${tail}` : ''}` });
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function signature(r, path) {
|
|
73
|
+
const ev = r.evaluations.find((e) => e.sampledUrls?.some((u) => new URL(u).pathname === path));
|
|
74
|
+
if (!ev)
|
|
75
|
+
return null;
|
|
76
|
+
return sha256(canonicalJson(r.evaluations.filter((e) => e.sampledUrls?.some((u) => new URL(u).pathname === path)).map((e) => ({ r: e.ruleId, s: e.status, c: e.subChecks }))));
|
|
77
|
+
}
|
|
78
|
+
function urlsFor(origin, p) {
|
|
79
|
+
const routes = p.affectedRoutes.filter((r) => !r.includes('[')).slice(0, 10);
|
|
80
|
+
const paths = p.ruleId === 'GEO-011' ? ['/'] : routes.length ? routes : ['/'];
|
|
81
|
+
return [...new Set(paths)].map((r) => new URL(r, origin).href);
|
|
82
|
+
}
|
|
83
|
+
function runtimeSubject(p, s) {
|
|
84
|
+
return s.kind === 'routeGroup' ? { kind: 'routeGroup', route: clusterPath(s.route) } : s;
|
|
85
|
+
}
|
|
86
|
+
/** V1–V4 for one applied fix (spec 12.2–12.4). Pure decision logic over the evidence it gathers. */
|
|
87
|
+
export async function verifyApplied(input) {
|
|
88
|
+
const p = input.proposal;
|
|
89
|
+
const checks = [...input.v1Checks];
|
|
90
|
+
const v2Status = subCheckStatus(findEvaluations(input.after, p.ruleId, p.subjects), p.subCheck);
|
|
91
|
+
const newAffected = newFindings(input.before, input.after, p);
|
|
92
|
+
if (v2Status === 'fail')
|
|
93
|
+
checks.push({ level: 'V2', status: 'fail', detail: `${p.ruleId} ${p.subCheck} still fails on the affected subject` });
|
|
94
|
+
else if (newAffected.length > 0)
|
|
95
|
+
checks.push({ level: 'V2', status: 'fail', detail: `new finding on an affected subject: ${newAffected[0]}` });
|
|
96
|
+
else if (v2Status === 'pass')
|
|
97
|
+
checks.push({ level: 'V2', status: 'pass', detail: `${p.ruleId} ${p.subCheck} passes; no new affected findings` });
|
|
98
|
+
else
|
|
99
|
+
checks.push({ level: 'V2', status: 'not_run', detail: `${p.ruleId} ${p.subCheck} cannot be evaluated statically after the change (it disappeared into not_evaluated); that is unverified, not success` });
|
|
100
|
+
const a = input.authority;
|
|
101
|
+
if (a.commands.length === 0)
|
|
102
|
+
checks.push({ level: 'V3', status: 'not_run', detail: 'no verify command was authorised for this run' });
|
|
103
|
+
else {
|
|
104
|
+
for (const cmd of a.commands) {
|
|
105
|
+
const r = await runCommand(cmd, input.repoRoot, a.runtimeTimeoutSeconds);
|
|
106
|
+
checks.push({ level: 'V3', status: r.ok ? 'pass' : 'fail', detail: r.detail });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
let runtime_observation = 'unavailable';
|
|
110
|
+
let source_freshness = 'unconfirmed';
|
|
111
|
+
let freshness_basis = null;
|
|
112
|
+
let rule_outcome = 'not_evaluated';
|
|
113
|
+
let runtime_unavailable = null;
|
|
114
|
+
const observe = async (origin) => {
|
|
115
|
+
const report = await input.rescan.urls(urlsFor(origin, p));
|
|
116
|
+
const evals = findEvaluations(report, p.ruleId, p.subjects.map((s) => runtimeSubject(p, s)));
|
|
117
|
+
const st = subCheckStatus(evals, p.subCheck);
|
|
118
|
+
rule_outcome = st === 'pass' ? 'pass' : st === 'fail' ? 'fail' : evals.some((e) => e.status === 'error') ? 'error' : 'not_evaluated';
|
|
119
|
+
if (input.priorRuntime) {
|
|
120
|
+
const path = new URL(urlsFor(origin, p)[0]).pathname;
|
|
121
|
+
const before = signature(input.priorRuntime, path);
|
|
122
|
+
const after = signature(report, path);
|
|
123
|
+
runtime_observation = before === null || after === null ? 'unavailable' : before === after ? 'unchanged' : 'changed';
|
|
124
|
+
}
|
|
125
|
+
return report;
|
|
126
|
+
};
|
|
127
|
+
if (a.serve) {
|
|
128
|
+
const handle = await startServe(a.serve.command, a.serve.url, input.repoRoot, a.serve.readyTimeoutSeconds, input.lastWriteMs);
|
|
129
|
+
if ('unavailable' in handle) {
|
|
130
|
+
runtime_unavailable = handle.unavailable;
|
|
131
|
+
checks.push({ level: 'V4', status: 'not_run', detail: `runtime_unavailable: ${handle.unavailable} — ${handle.detail}` });
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
try {
|
|
135
|
+
const report = await observe(handle.origin);
|
|
136
|
+
source_freshness = handle.startedAt > input.lastWriteMs ? 'confirmed' : 'unconfirmed';
|
|
137
|
+
freshness_basis = source_freshness === 'confirmed' ? 'process_started_after_write' : null;
|
|
138
|
+
const regress = newFindings(input.priorRuntime ?? report, report, p);
|
|
139
|
+
if (source_freshness !== 'confirmed') {
|
|
140
|
+
runtime_unavailable = 'freshness_unconfirmed';
|
|
141
|
+
checks.push({ level: 'V4', status: 'not_run', detail: 'runtime_unavailable: freshness_unconfirmed' });
|
|
142
|
+
}
|
|
143
|
+
else if (rule_outcome === 'pass' && (input.priorRuntime === null || regress.length === 0)) {
|
|
144
|
+
checks.push({ level: 'V4', status: 'pass', detail: `${p.ruleId} ${p.subCheck} passes on ${handle.origin}, served by a process GEO started after the write` });
|
|
145
|
+
}
|
|
146
|
+
else if (rule_outcome === 'fail' || regress.length > 0) {
|
|
147
|
+
checks.push({ level: 'V4', status: 'fail', detail: rule_outcome === 'fail' ? `${p.ruleId} ${p.subCheck} still fails on a confirmed-fresh runtime` : `new runtime finding: ${regress[0]}` });
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
checks.push({ level: 'V4', status: 'not_run', detail: `${p.ruleId} ${p.subCheck} could not be evaluated on the runtime (${rule_outcome})` });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
finally {
|
|
154
|
+
await handle.stop();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else if (a.observeUrl) {
|
|
159
|
+
await observe(new URL(a.observeUrl).origin);
|
|
160
|
+
runtime_unavailable = 'freshness_unconfirmed';
|
|
161
|
+
checks.push({ level: 'V4', status: 'not_run', detail: `observed ${a.observeUrl} (rule ${rule_outcome}), but GEO did not start that server, so freshness is unconfirmed. Configure fix.serve and pass --serve for V4.` });
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
runtime_unavailable = 'not_configured';
|
|
165
|
+
checks.push({ level: 'V4', status: 'not_run', detail: 'runtime_unavailable: no serve command authorised (configure fix.serve and pass --serve)' });
|
|
166
|
+
}
|
|
167
|
+
const failed = checks.some((c) => c.status === 'fail');
|
|
168
|
+
let achieved = null;
|
|
169
|
+
for (const lvl of LEVEL_ORDER)
|
|
170
|
+
if (checks.some((c) => c.level === lvl && c.status === 'pass') && !checks.some((c) => c.level === lvl && c.status === 'fail'))
|
|
171
|
+
achieved = lvl;
|
|
172
|
+
if (!checks.some((c) => c.level === 'V1' && c.status === 'pass'))
|
|
173
|
+
achieved = null;
|
|
174
|
+
const meets = achieved !== null && LEVEL_ORDER.indexOf(achieved) >= LEVEL_ORDER.indexOf(p.required) && (p.required !== 'V4' || checks.some((c) => c.level === 'V4' && c.status === 'pass')) && (p.required !== 'V2' || checks.some((c) => (c.level === 'V2' || c.level === 'V4') && c.status === 'pass'));
|
|
175
|
+
const outcome = failed ? 'rolled_back' : meets ? 'verified' : 'applied_unverified';
|
|
176
|
+
return {
|
|
177
|
+
checks,
|
|
178
|
+
achieved,
|
|
179
|
+
outcome,
|
|
180
|
+
conditionAfter: v2Status === 'pass' ? 'pass' : v2Status === 'fail' ? 'fail' : rule_outcome === 'pass' ? 'pass (runtime)' : 'not_evaluated',
|
|
181
|
+
newAffected,
|
|
182
|
+
runtime_observation,
|
|
183
|
+
source_freshness,
|
|
184
|
+
freshness_basis,
|
|
185
|
+
rule_outcome,
|
|
186
|
+
runtime_unavailable,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function countChangedLines(before, after) {
|
|
190
|
+
const a = (before ?? '').split('\n');
|
|
191
|
+
const b = after.split('\n');
|
|
192
|
+
let i = 0;
|
|
193
|
+
while (i < a.length && i < b.length && a[i] === b[i])
|
|
194
|
+
i++;
|
|
195
|
+
let j = 0;
|
|
196
|
+
while (j < a.length - i && j < b.length - i && a[a.length - 1 - j] === b[b.length - 1 - j])
|
|
197
|
+
j++;
|
|
198
|
+
return Math.max(b.length - i - j, a.length - i - j);
|
|
199
|
+
}
|
|
200
|
+
function restore(repoRoot, files, snapshots) {
|
|
201
|
+
for (const f of files) {
|
|
202
|
+
const abs = join(repoRoot, f.path);
|
|
203
|
+
const before = snapshots.get(f.path) ?? null;
|
|
204
|
+
if (!f.existedBefore)
|
|
205
|
+
rmSync(abs, { force: true });
|
|
206
|
+
else if (before !== null)
|
|
207
|
+
writeFileSync(abs, before);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/** Snapshot, splice, verify, and roll back only the fix whose check failed. */
|
|
211
|
+
export async function applyFixes(input) {
|
|
212
|
+
const reports = [];
|
|
213
|
+
const manifest = readManifest(input.runDir) ?? { runId: input.runId, appliedAt: new Date().toISOString(), fixes: [] };
|
|
214
|
+
for (const p of input.proposals) {
|
|
215
|
+
const snapDir = join(input.runDir, 'fix', p.fixId);
|
|
216
|
+
const before = await input.rescan.repo();
|
|
217
|
+
mkdirSync(snapDir, { recursive: true });
|
|
218
|
+
writeFileSync(join(snapDir, 'before.json'), canonicalJson(before));
|
|
219
|
+
const snaps = new Map();
|
|
220
|
+
const files = [];
|
|
221
|
+
for (const c of p.changes) {
|
|
222
|
+
const abs = join(input.repoRoot, c.path);
|
|
223
|
+
const existed = existsSync(abs);
|
|
224
|
+
const current = existed ? readFileSync(abs, 'utf8') : null;
|
|
225
|
+
if ((current === null ? null : sha256(current)) !== c.beforeHash)
|
|
226
|
+
throw new Error(`${c.path} changed since the fix was planned; re-run the dry run`);
|
|
227
|
+
snaps.set(c.path, current);
|
|
228
|
+
let snapshot = null;
|
|
229
|
+
if (current !== null) {
|
|
230
|
+
snapshot = join(snapDir, 'files', c.path);
|
|
231
|
+
mkdirSync(dirname(snapshot), { recursive: true });
|
|
232
|
+
writeFileSync(snapshot, current);
|
|
233
|
+
}
|
|
234
|
+
files.push({ path: c.path, existedBefore: existed, beforeHash: c.beforeHash, afterHash: sha256(c.after), snapshot });
|
|
235
|
+
}
|
|
236
|
+
// Multi-file fixes are atomic: a failed write restores what was written.
|
|
237
|
+
const written = [];
|
|
238
|
+
try {
|
|
239
|
+
for (const c of p.changes) {
|
|
240
|
+
const abs = join(input.repoRoot, c.path);
|
|
241
|
+
mkdirSync(dirname(abs), { recursive: true });
|
|
242
|
+
writeFileSync(abs, c.after);
|
|
243
|
+
written.push(c.path);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
catch (e) {
|
|
247
|
+
restore(input.repoRoot, files.filter((f) => written.includes(f.path)), snaps);
|
|
248
|
+
throw e;
|
|
249
|
+
}
|
|
250
|
+
const lastWriteMs = Math.max(...p.changes.map((c) => statSync(join(input.repoRoot, c.path)).mtimeMs), Date.now());
|
|
251
|
+
const v1Checks = p.changes.map((c) => v1(c.path, c.after));
|
|
252
|
+
const after = await input.rescan.repo();
|
|
253
|
+
const result = await verifyApplied({ proposal: p, lastWriteMs, before, after, authority: input.authority, repoRoot: input.repoRoot, rescan: input.rescan, priorRuntime: input.priorRuntime, v1Checks });
|
|
254
|
+
if (result.outcome === 'rolled_back')
|
|
255
|
+
restore(input.repoRoot, files, snaps);
|
|
256
|
+
const entry = {
|
|
257
|
+
fixId: p.fixId,
|
|
258
|
+
outcome: result.outcome,
|
|
259
|
+
proposal: { variant: p.variant, ruleId: p.ruleId, subCheck: p.subCheck, subjects: p.subjects, required: p.required, affectedRoutes: p.affectedRoutes, fingerprints: p.fingerprints, class: p.class, title: p.title },
|
|
260
|
+
files,
|
|
261
|
+
lastWriteMs,
|
|
262
|
+
};
|
|
263
|
+
manifest.fixes.push(entry);
|
|
264
|
+
writeManifest(input.runDir, manifest);
|
|
265
|
+
reports.push({
|
|
266
|
+
fixId: p.fixId,
|
|
267
|
+
variant: p.variant,
|
|
268
|
+
class: p.class,
|
|
269
|
+
ruleId: p.ruleId,
|
|
270
|
+
subjects: p.subjects.map(subjectKey),
|
|
271
|
+
fingerprints: p.fingerprints,
|
|
272
|
+
files: p.changes.map((c) => ({ path: c.path, linesChanged: countChangedLines(c.before, c.after), created: c.before === null })),
|
|
273
|
+
conditionBefore: 'fail',
|
|
274
|
+
conditionAfter: result.conditionAfter,
|
|
275
|
+
newAffectedFindings: result.newAffected,
|
|
276
|
+
verification: { required: p.required, achieved: result.achieved, checks: result.checks },
|
|
277
|
+
runtime_observation: result.runtime_observation,
|
|
278
|
+
source_freshness: result.source_freshness,
|
|
279
|
+
freshness_basis: result.freshness_basis,
|
|
280
|
+
rule_outcome: result.rule_outcome,
|
|
281
|
+
runtime_unavailable: result.runtime_unavailable,
|
|
282
|
+
outcome: result.outcome,
|
|
283
|
+
snapshot: snapDir,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
return reports;
|
|
287
|
+
}
|
|
288
|
+
/** Restore snapshots, refusing any file edited after the fix run (spec 12.4.6). */
|
|
289
|
+
export function rollback(repoRoot, runDir, dryRun) {
|
|
290
|
+
const m = readManifest(runDir);
|
|
291
|
+
if (!m)
|
|
292
|
+
return { restored: [], conflicts: ['no fix manifest in this run'] };
|
|
293
|
+
const live = m.fixes.filter((f) => f.outcome !== 'rolled_back');
|
|
294
|
+
const conflicts = [];
|
|
295
|
+
for (const f of live) {
|
|
296
|
+
for (const file of f.files) {
|
|
297
|
+
const abs = join(repoRoot, file.path);
|
|
298
|
+
const current = existsSync(abs) ? sha256(readFileSync(abs, 'utf8')) : null;
|
|
299
|
+
if (current !== file.afterHash)
|
|
300
|
+
conflicts.push(`${file.path} was changed after ${f.fixId} was applied`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
if (conflicts.length > 0 || dryRun)
|
|
304
|
+
return { restored: [], conflicts };
|
|
305
|
+
const restored = [];
|
|
306
|
+
for (const f of live) {
|
|
307
|
+
for (const file of f.files) {
|
|
308
|
+
const abs = join(repoRoot, file.path);
|
|
309
|
+
if (!file.existedBefore)
|
|
310
|
+
rmSync(abs, { force: true });
|
|
311
|
+
else
|
|
312
|
+
writeFileSync(abs, readFileSync(file.snapshot, 'utf8'));
|
|
313
|
+
restored.push(file.path);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
writeManifest(runDir, { ...m, fixes: m.fixes.map((f) => (f.outcome === 'rolled_back' ? f : { ...f, outcome: 'rolled_back' })) });
|
|
317
|
+
return { restored, conflicts };
|
|
318
|
+
}
|
|
319
|
+
export function loadBefore(runDir, fixId) {
|
|
320
|
+
const p = join(runDir, 'fix', fixId, 'before.json');
|
|
321
|
+
return existsSync(p) ? JSON.parse(readFileSync(p, 'utf8')) : null;
|
|
322
|
+
}
|
|
323
|
+
export function currentV1(repoRoot, entry) {
|
|
324
|
+
return entry.files.map((f) => {
|
|
325
|
+
const abs = join(repoRoot, f.path);
|
|
326
|
+
if (!existsSync(abs))
|
|
327
|
+
return { level: 'V1', status: 'fail', detail: `${f.path} no longer exists` };
|
|
328
|
+
return v1(f.path, readFileSync(abs, 'utf8'));
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
export function variantRequired(variant) {
|
|
332
|
+
return VARIANTS[variant].required;
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/fix/apply.ts"],"names":[],"mappings":"AAAA,OAA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AAC;AAED,MAAM,UAAU,eAAe,CAAC,OAA8B;IAC5D,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function unifiedDiff(path: string, before: string | null, after: string, context?: number): string;
|
package/dist/fix/diff.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Fixes are local splices, so a single hunk around the changed span is the
|
|
2
|
+
// whole diff: trim the common prefix and suffix, then show three lines of
|
|
3
|
+
// context either side.
|
|
4
|
+
export function unifiedDiff(path, before, after, context = 3) {
|
|
5
|
+
const a = before === null ? [] : before.split('\n');
|
|
6
|
+
const b = after.split('\n');
|
|
7
|
+
let start = 0;
|
|
8
|
+
while (start < a.length && start < b.length && a[start] === b[start])
|
|
9
|
+
start++;
|
|
10
|
+
let endA = a.length;
|
|
11
|
+
let endB = b.length;
|
|
12
|
+
while (endA > start && endB > start && a[endA - 1] === b[endB - 1]) {
|
|
13
|
+
endA--;
|
|
14
|
+
endB--;
|
|
15
|
+
}
|
|
16
|
+
if (start === endA && start === endB)
|
|
17
|
+
return '';
|
|
18
|
+
const from = Math.max(0, start - context);
|
|
19
|
+
const toA = Math.min(a.length, endA + context);
|
|
20
|
+
const toB = Math.min(b.length, endB + context);
|
|
21
|
+
const lines = [];
|
|
22
|
+
lines.push(`--- ${before === null ? '/dev/null' : `a/${path}`}`);
|
|
23
|
+
lines.push(`+++ b/${path}`);
|
|
24
|
+
lines.push(`@@ -${before === null ? 0 : from + 1},${toA - from} +${from + 1},${toB - from} @@`);
|
|
25
|
+
for (let i = from; i < start; i++)
|
|
26
|
+
lines.push(` ${a[i]}`);
|
|
27
|
+
for (let i = start; i < endA; i++)
|
|
28
|
+
lines.push(`-${a[i]}`);
|
|
29
|
+
for (let i = start; i < endB; i++)
|
|
30
|
+
lines.push(`+${b[i]}`);
|
|
31
|
+
for (let i = endA; i < toA; i++)
|
|
32
|
+
lines.push(` ${a[i]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O,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ScanContext } from '../rules/context.ts';
|
|
2
|
+
import type { Evaluation, Provenance, RuleId, Subject } from '../types.ts';
|
|
3
|
+
import { type Variant, type VerificationLevel } from './variants.ts';
|
|
4
|
+
export { VARIANTS, type Variant, type VerificationLevel, type VariantSpec } from './variants.ts';
|
|
5
|
+
export interface FileChange {
|
|
6
|
+
readonly path: string;
|
|
7
|
+
readonly before: string | null;
|
|
8
|
+
readonly after: string;
|
|
9
|
+
readonly beforeHash: string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface Precondition {
|
|
12
|
+
readonly check: string;
|
|
13
|
+
readonly ok: boolean;
|
|
14
|
+
readonly detail: string;
|
|
15
|
+
}
|
|
16
|
+
export interface FixProposal {
|
|
17
|
+
readonly fixId: string;
|
|
18
|
+
readonly variant: Variant;
|
|
19
|
+
readonly class: 'safe' | 'guarded';
|
|
20
|
+
readonly title: string;
|
|
21
|
+
readonly ruleId: RuleId;
|
|
22
|
+
readonly subCheck: string;
|
|
23
|
+
readonly subjects: readonly Subject[];
|
|
24
|
+
readonly fingerprints: readonly string[];
|
|
25
|
+
readonly changes: readonly FileChange[];
|
|
26
|
+
readonly preconditions: readonly Precondition[];
|
|
27
|
+
readonly required: VerificationLevel;
|
|
28
|
+
readonly provenance: Provenance;
|
|
29
|
+
readonly alternative: string | null;
|
|
30
|
+
readonly affectedRoutes: readonly string[];
|
|
31
|
+
}
|
|
32
|
+
export interface BlockedFix {
|
|
33
|
+
readonly variant: Variant;
|
|
34
|
+
readonly subject: Subject;
|
|
35
|
+
readonly preconditions: readonly Precondition[];
|
|
36
|
+
}
|
|
37
|
+
export interface FixPlan {
|
|
38
|
+
readonly proposals: readonly FixProposal[];
|
|
39
|
+
readonly blocked: readonly BlockedFix[];
|
|
40
|
+
}
|
|
41
|
+
export declare function planAll(ctx: ScanContext, evals: readonly Evaluation[]): FixPlan;
|
|
42
|
+
export declare function planFixes(ctx: ScanContext, evals: readonly Evaluation[]): FixProposal[];
|