Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 243 to 244

Compare

+28 −13 in 3 places
Lines 238–250 at 244 (were 238–252 at 243)
238238 };
239239}
240240
241−/** Every file that differs between two versions of shared (or a named draft), before (at `from`) and after (at `to`). */
242−export function compare(
241+/** The files that may differ between two versions, and both views: compare's and compareSummary's ground. */
242+function compared(
243243 host: LogHost,
244244 from: number,
245245 to: number,
246− options: { draft?: string | null; agent?: string; summary?: boolean } = {},
247−):
248− | { from: number; to: number; files: FileChange[] }
249− | { from: number; to: number; summary: true; files: ReturnType<typeof summariesBetween> } {
246+ options: { draft?: string | null; agent?: string },
247+): { before: ReadView; after: ReadView; files: Set<string> } {
250248 host.needInit();
251249 const space = host.spaceFor(options);
252250 host.checkVersion(space, from);
Lines 252–264 at 244 (were 254–271 at 243)
254252 const before = host.viewAt(space, from);
255253 const after = host.viewAt(space, to);
256254 const files = new Set<string>();
257− // With summary, each file's size and SHA-256 instead of its texts (abso issue 680).
258− const answer = (paths: Iterable<string>) =>
259− options.summary
260− ? { from, to, summary: true as const, files: summariesBetween(before, after, paths) }
261− : { from, to, files: changesBetween(before, after, paths) };
262255 // A stored writer keeps each shared version's changed files (version-files.ts, abso Capacity): every file that
263256 // differs between two versions changed in one between them, so those lists are the candidates, not every atom
264257 // either set holds.
265258 if (space.name === SHARED && host.graph.packedFiles) {
266259 for (let v = Math.min(from, to) + 1; v <= Math.max(from, to); v++)
267260 for (const file of host.paths.versionFiles(space, v)) files.add(file);
268− return answer(files);
261+ return { before, after, files };
269262 }
270263 const a = host.at(space, from);
271264 const b = host.at(space, to);
Lines 274–304 at 244 (were 281–289 at 243)
281274 ))
282275 files.add(file);
283276 }
284− return answer(files);
277+ return { before, after, files };
285278}
286279
280+/** Every file that differs between two versions of shared (or a named draft), before (at `from`) and after (at `to`). */
281+export function compare(
282+ host: LogHost,
283+ from: number,
284+ to: number,
285+ options: { draft?: string | null; agent?: string } = {},
286+): { from: number; to: number; files: FileChange[] } {
287+ const { before, after, files } = compared(host, from, to, options);
288+ return { from, to, files: changesBetween(before, after, files) };
289+}
291+/** compare's files as each one's size and SHA-256 before and after, not its texts (abso issue 680). */
292+export function compareSummary(
293+ host: LogHost,
294+ from: number,
295+ to: number,
296+ options: { draft?: string | null; agent?: string } = {},
297+): { from: number; to: number; summary: true; files: ReturnType<typeof summariesBetween> } {
298+ const { before, after, files } = compared(host, from, to, options);
299+ return { from, to, summary: true, files: summariesBetween(before, after, files) };
300+}
287302/** A version of shared (or of a named draft) as a ReadView, for reading lines (blame at a version). */
288303export function viewAt(
289304 host: LogHost,
MCP
compare on this site's /mcp
CLI
abso diff 243 244 worker/project/version-log.ts --json
JSON
/christopher/abso-core/compare/243..244?file=worker%2Fproject%2Fversion-log.ts&format=json