[K4][6][8] S3/S4: Öffnen/Neu laden im Kern, Importe als Ops, diffToOps gelöscht

Öffnen/Vorlage/Wiederherstellen: Store openProjectFile (Kern liest, migriert, lädt
direkt ins Dokument, Verlauf leer); Neu/Musterhaus: loadProject (doc_load_json).
Autosave sichert den Datei-Text des Kerns, Wiederherstellen lädt ihn wie eine Datei.
CLI/MCP laden ins gemeinsame Abfrage-Dokument. DXF/PDF-Import als Ops in einer Gruppe
(ein Undo-Schritt), Bilder und IFC-Bauteile als Ops, CLI-Importe über fieldOps/addItems.
setProject/CommandResult.commit/ToolResult.commit nehmen nur noch ProjectMutation;
diffToOps, isOpsMutation, addNewElementsToActiveGroup, project_parse gelöscht.
documentFor folgt fremden Projekten feldweise (fieldOps). Tests: Laden/Speichern
zeichengleich zu JSON.stringify, Store-Laden, e2e Öffnen leert Verlauf und
DXF-Import = ein Schritt; Zufallsänderungen in Tests über projectDiff.testutil.
This commit is contained in:
Claude committed 2026-10-29 04:19:56 +00:00
1 parent 77b45c13a1
commit 256b7c0b4b
37 files changed
+582 -485

No files matched your search

+3 -3
View File
@@ -7,7 +7,7 @@ import type { Command, CommandContext, CmdInput } from "../types";
import { explodeOps } from "../../editors/explode";
import { translateOps, translateProject } from "../../model/geoRebase";
import { applyOps } from "../../core/ops";
import { isOpsMutation } from "../../core";
import type { ProjectMutation } from "../../core";
import { joinCommand } from "./join";
import { defblockCommand } from "./defblock";
import { terrainCommand } from "./terrain";
@@ -45,13 +45,13 @@ function ctxOf(p: Project, ids: string[] = []): CommandContext {
function commitOf(cmd: Command, p: Project, inputs: CmdInput[], ids: string[] = []): { out: Project; viaOps: boolean } {
const ctx = ctxOf(p, ids);
let st = cmd.init();
let fn: ((p: Project) => Project) | undefined = cmd.autoRun?.(ctx).commit;
let fn: ProjectMutation | undefined = cmd.autoRun?.(ctx).commit;
for (const input of inputs) {
const [ns, res] = cmd.onInput(st, input, ctx);
st = ns;
if (res.commit) fn = res.commit;
}
return { out: fn ? fn(p) : p, viaOps: fn ? isOpsMutation(fn) : true };
return { out: fn ? fn(p) : p, viaOps: fn ? typeof fn.toOps === "function" : true };
}
describe("Editier-Befehle: Ops", () => {