feat: extend Telegram dock commands and config hashing (#929)

Thanks @grp06.

Co-authored-by: George Pickett <gpickett00@gmail.com>
This commit is contained in:
Peter Steinberger
2026-01-15 05:25:35 +00:00
parent a2f0d335f4
commit 54fb59b8f3
9 changed files with 49 additions and 18 deletions

View File

@@ -3,6 +3,7 @@ export {
loadConfig,
parseConfigJson5,
readConfigFileSnapshot,
resolveConfigSnapshotHash,
writeConfigFile,
} from "./io.js";
export { migrateLegacyConfig } from "./legacy-migrate.js";

View File

@@ -58,6 +58,18 @@ function hashConfigRaw(raw: string | null): string {
.digest("hex");
}
export function resolveConfigSnapshotHash(snapshot: {
hash?: string;
raw?: string | null;
}): string | null {
if (typeof snapshot.hash === "string") {
const trimmed = snapshot.hash.trim();
if (trimmed) return trimmed;
}
if (typeof snapshot.raw !== "string") return null;
return hashConfigRaw(snapshot.raw);
}
export type ConfigIoDeps = {
fs?: typeof fs;
json5?: typeof JSON5;