- MCP
- blame on this site's /mcp
- CLI
- abso blame worker/project/amend.ts --version 100 --json
- JSON
- /christopher/abso-core/blame/worker/project/amend.ts?version=100&format=json
59 linesFirst import 98% · rename 2%Last change rename in version 100,
59 lines from 2 changes in 2 versions.
2// through AmendHost; today the host is Project.
4import { ProjectError } from "./project-error.ts";
5import type { AgentState, Entry } from "./project-types.ts";
6import { last, SHARED, type Space } from "./spaces.ts";
8/** What amending a publish message needs from a project. */
9export interface AmendHost {
10 agent(name: string, entries: Entry[]): AgentState;
11 spaceOf(agent: AgentState): Space;
12 apply(entry: Entry): void;
13 flush(entries: Entry[]): void;
14}
16/**
17 * Correct the message of the agent's newest publish in its space (#27).
18 * Only the message changes: shared only grows, so a version's changes are
19 * fixed by publishing again (or dropping it). The log keeps the original.
20 */
21export function amend(
22 host: AmendHost,
23 agentName: string,
24 message: string,
25 time: number,
26): { version: number; draft: string | null; message: string; was: string } {
27 if (typeof message !== "string" || message.trim() === "")
28 throw new ProjectError("bad-request", "amend needs the new message");
29 const entries: Entry[] = [];
30 const agent = host.agent(agentName, entries);
31 const space = host.spaceOf(agent);
32 // Its newest version that published something (not a draft's bookkeeping versions).
33 const mineAt = (v: number): boolean =>
34 space.versions[v]!.agent === agent.name &&
35 (space.versions[v]!.atoms.length > 0 || space.versions[v]!.dropped !== undefined);
36 let version = last(space);
37 while (version > 0 && !mineAt(version)) version--;
38 const p = space.versions[version]!;
39 if (version === 0) {
40 host.flush(entries);
41 throw new ProjectError(
42 "bad-request",
rename100abso publish is now abso push, abso sync is now abso pull (abso 427)
Commands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; "shared" stays the noun ("Pushed version N"). No aliases, no notices. A queued push that was "pulled" is now "turned back", so pull means one thing.
push -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch.
Kept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.Compare43 `${agent.name} hasn't pushed in ${space.name === SHARED ? "shared" : `draft ${space.name}`}, so there is nothing to amend`,
45 }
46 const was = p.message;
47 const entry: Entry = {
48 type: "amend",
49 agent: agent.name,
50 ...(space.name !== SHARED ? { space: space.name } : {}),
51 version,
52 message,
53 time,
54 };
55 entries.push(entry);
56 host.apply(entry);
57 host.flush(entries);
58 return { version, draft: space.name === SHARED ? null : space.name, message, was };
59}