mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor(plugin-sdk): replace hash manifest with JSONL contract (#121473)
* refactor(plugin-sdk): use JSONL API baseline contract * chore(plugin-sdk): add generated JSONL API baseline
This commit is contained in:
committed by
GitHub
parent
0a6a1d9419
commit
e37614c83f
@@ -96,7 +96,7 @@ const DOCTOR_CONTRACT_OWNER_TEST_PATH_RE =
|
||||
const SQLITE_SESSION_SCHEMA_BASELINE_PATH_RE =
|
||||
/^(?:src\/state\/openclaw-agent-schema\.sql|scripts\/(?:generate-sqlite-session-schema-baseline\.ts|lib\/sqlite-session-schema-baseline\.ts)|test\/scripts\/sqlite-session-schema-baseline\.test\.ts|docs\/\.generated\/sqlite-session-transcript-schema-baseline\.sha256)$/u;
|
||||
const PLUGIN_SDK_API_BASELINE_PATH_RE =
|
||||
/^(?:src\/|packages\/|extensions\/|pnpm-lock\.yaml$|tsconfig\.json$|scripts\/(?:generate-plugin-sdk-api-baseline\.ts|lib\/plugin-sdk-(?:doc-metadata\.ts|entries\.mts|entrypoints\.json|private-local-only-subpaths\.json))|docs\/\.generated\/plugin-sdk-api-baseline\.sha256$)/u;
|
||||
/^(?:src\/|packages\/|extensions\/|pnpm-lock\.yaml$|tsconfig\.json$|scripts\/(?:generate-plugin-sdk-api-baseline\.ts|lib\/plugin-sdk-(?:doc-metadata\.ts|entries\.mts|entrypoints\.json|private-local-only-subpaths\.json))|docs\/\.generated\/plugin-sdk-api-baseline\.jsonl$)/u;
|
||||
const PLUGIN_SDK_SURFACE_PATH_RE =
|
||||
/^(?:package\.json$|src\/plugin-sdk\/|packages\/plugin-sdk\/|scripts\/(?:plugin-sdk-surface-report\.mts|sync-plugin-sdk-exports\.mts|lib\/plugin-sdk-(?:declaration-budget\.mts|deprecated-barrel-subpaths\.json|deprecated-public-subpaths\.json|entries\.mts|entrypoints\.json|private-local-only-subpaths\.json)))/u;
|
||||
const DEPRECATION_HYGIENE_PATH_RE =
|
||||
|
||||
@@ -18,24 +18,33 @@ async function main(): Promise<void> {
|
||||
const result = await writePluginSdkApiBaselineArtifacts({ repoRoot, check: checkOnly });
|
||||
if (checkOnly) {
|
||||
if (result.changed) {
|
||||
const contractPath = path.relative(repoRoot, result.contractPath);
|
||||
const diff = result.contractDiff;
|
||||
console.error(
|
||||
[
|
||||
"Plugin SDK API contract drift detected.",
|
||||
`Manifest mismatch: ${path.relative(repoRoot, result.hashPath)}`,
|
||||
"If this Plugin SDK surface change is intentional, run `pnpm plugin-sdk:api:gen` and commit the updated manifest.",
|
||||
`Contract mismatch: ${contractPath}`,
|
||||
`--- ${contractPath} (committed)`,
|
||||
`+++ ${contractPath} (generated)`,
|
||||
...(diff?.previewLines ?? []),
|
||||
`Changed JSONL lines: ${diff?.changedLineCount ?? 0}${
|
||||
diff && diff.shownLineCount < diff.changedLineCount
|
||||
? ` (showing first ${diff.shownLineCount})`
|
||||
: ""
|
||||
}`,
|
||||
"If this Plugin SDK surface change is intentional, run `pnpm plugin-sdk:api:gen` and commit the updated contract.",
|
||||
"If not intentional, fix the plugin-sdk exports or metadata first.",
|
||||
].join("\n"),
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
console.log(`OK ${path.relative(repoRoot, result.hashPath)}`);
|
||||
console.log(`OK ${path.relative(repoRoot, result.contractPath)}`);
|
||||
return;
|
||||
}
|
||||
console.log(
|
||||
[
|
||||
`Wrote ${path.relative(repoRoot, result.hashPath)}`,
|
||||
`Wrote ${path.relative(repoRoot, result.contractPath)}`,
|
||||
`Wrote ${path.relative(repoRoot, result.jsonPath)} (gitignored, local only)`,
|
||||
`Wrote ${path.relative(repoRoot, result.statefilePath)} (gitignored, local only)`,
|
||||
].join("\n"),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user