mirror of
https://github.com/openclaw/openclaw.git
synced 2026-10-03 17:53:39 +00:00
* refactor: remove narrowly used helper dependencies Replace markdown-it-task-lists and grammY runner sequencing with their local owners. Remove direct ms/pretty-ms usage and share the existing duration factors and formatting. Preserve rendering and parsing contracts, and keep overlapping Telegram lanes ordered when a predecessor fails. Remove obsolete mocks, declarations, dependency metadata, and build references; regenerate the lockfile and Control UI boot manifest. Deduplicate an inherited over-limit replay test without changing coverage. Closes #158499 Co-authored-by: steipete <58493+steipete@users.noreply.github.com> * refactor: remove narrowly used helper dependencies Worked on by: - @steipete Co-authored-by: steipete <58493+steipete@users.noreply.github.com> OpenClaw-Publication: f4ef665a-7e2b-47ce-a454-adc19e798bee * refactor: remove narrowly used helper dependencies Worked on by: - @steipete Co-authored-by: steipete <58493+steipete@users.noreply.github.com> OpenClaw-Publication: abec5219-5bd0-4480-8604-a57c1063f638 * fix(ci): preserve base-only dependencies in UI comparison Materialize removed dependency declarations from the archived base lockfile before overlaying the candidate toolchain. Keep both builds on the same Vite and compressor without restoring removed application dependencies. Extend the real build regression with a dependency absent from the candidate and verify the original comparator fails to resolve it. Co-authored-by: steipete <58493+steipete@users.noreply.github.com> * refactor: remove narrowly used helper dependencies Worked on by: - @steipete Co-authored-by: steipete <58493+steipete@users.noreply.github.com> OpenClaw-Publication: 2db2eea4-87fe-4071-ab37-28da02f1bd24 * refactor: remove narrowly used helper dependencies Worked on by: - @steipete Co-authored-by: steipete <58493+steipete@users.noreply.github.com> OpenClaw-Publication: 8c381a6d-38f2-417f-85ee-9353cb5694dc --------- Co-authored-by: steipete <58493+steipete@users.noreply.github.com>
90 lines
2.9 KiB
JavaScript
90 lines
2.9 KiB
JavaScript
import {
|
|
existsSync,
|
|
lstatSync,
|
|
mkdirSync,
|
|
readFileSync,
|
|
realpathSync,
|
|
statSync,
|
|
symlinkSync,
|
|
} from "node:fs";
|
|
import { dirname, join } from "node:path";
|
|
|
|
const manifestPath = join(dirname(process.argv[3]), "package.json");
|
|
const manifest = existsSync(manifestPath)
|
|
? JSON.parse(readFileSync(manifestPath, "utf8"))
|
|
: undefined;
|
|
// Pre-#149585 anchors contain no package manifest and need only these tooling pins.
|
|
const dependencies = [
|
|
"tsx",
|
|
"zod",
|
|
"minimatch",
|
|
"yaml",
|
|
...(manifest
|
|
? [
|
|
"@openclaw/fs-safe",
|
|
"@openclaw/proxyline",
|
|
"acorn",
|
|
"chalk",
|
|
"commander",
|
|
"dotenv",
|
|
"execa",
|
|
"hosted-git-info",
|
|
"import-meta-resolve",
|
|
"ipaddr.js",
|
|
"jiti",
|
|
"json5",
|
|
"koffi",
|
|
"kysely",
|
|
"p-map",
|
|
"semver",
|
|
"string-width",
|
|
"tsdown",
|
|
"tslog",
|
|
"typebox",
|
|
"typescript",
|
|
"undici",
|
|
]
|
|
: []),
|
|
].map((dependency) => {
|
|
const link = join(process.argv[3], dependency);
|
|
// An older parent or the current supervisor may already have pinned this package.
|
|
// Preserve that installation even if canonical aliases change during the run.
|
|
const present = lstatSync(link, { throwIfNoEntry: false });
|
|
const installedPath = present ? link : join(process.argv[2], dependency);
|
|
try {
|
|
const target = realpathSync(installedPath);
|
|
if (!statSync(target).isDirectory()) {
|
|
throw new Error("not a package directory");
|
|
}
|
|
const expectedVersion =
|
|
manifest?.dependencies?.[dependency] ?? manifest?.devDependencies?.[dependency];
|
|
const installedVersion = JSON.parse(readFileSync(join(target, "package.json"), "utf8")).version;
|
|
if (manifest && (!expectedVersion || installedVersion !== expectedVersion)) {
|
|
console.error(
|
|
`Installed scripts/pr dependency '${dependency}' has version ${installedVersion}; the trust anchor requires ${expectedVersion}.`,
|
|
);
|
|
throw new Error("dependency version mismatch");
|
|
}
|
|
return { dependency, target, present };
|
|
} catch {
|
|
console.error(
|
|
`Cannot resolve installed scripts/pr dependency '${dependency}' at ${installedPath}.`,
|
|
);
|
|
console.error(
|
|
"Restore frozen dependencies in a clean trusted-main checkout or set OPENCLAW_PR_TOOLING_ROOT before retrying; no dependencies were installed.",
|
|
);
|
|
// Distinguish dependency drift from a destination write failure. Only the
|
|
// former may trigger a refresh of an explicitly selected tooling checkout.
|
|
return process.exit(78);
|
|
}
|
|
});
|
|
mkdirSync(process.argv[3], { recursive: true });
|
|
for (const { dependency, target, present } of dependencies) {
|
|
if (present) {
|
|
continue;
|
|
}
|
|
// Native junctions avoid Git Bash copying package directories on Windows.
|
|
const link = join(process.argv[3], dependency);
|
|
mkdirSync(dirname(link), { recursive: true });
|
|
symlinkSync(target, link, process.platform === "win32" ? "junction" : "dir");
|
|
}
|