Repository navigation
CAD Editor Body Duplicate Plan
Capability CE-F03 in CAD Editor Product Roadmap still lacks duplication of an original native body. Existing #1133 renames a body; #1153 duplicates a Render workspace scene, and #752 qualifies duplicate local Curve IDs in the GPU. None implements this CAD authoring transaction. All-state title and CAD-editor duplicate searches found no matching leaf. This is a candidate for the CAD Editor owner, not a change to active #1291/#1292/#1303 order.
Read-only provider inspection at local integration ee87676c7b08e675dcbe426e9fc9ca9b72ff0939: packages/barocss-cad/src/cad-document.ts defines canonical direct-geometry v1 documents with1..4 complete authored Source0 assets and1..16 Curve/Surface bodies; duplicate (assetId,geometryId) ownership is rejected. createCadDocument compiles each full original source and validates the asset-qualified binding. Current editor candidate kinds are apply/open/undo/redo/display/rename; no duplication method or app action exists. Presence of those providers is not an executed duplication flow.
Duplicate one selected canonical direct-geometry body into a new independent authored asset namespace and new body ID. Copy its entire accepted Source0 asset text exactly, including other original objects, numeric spelling, signed zero, knots, weights, units and native local geometry IDs. The new asset-qualified geometry reference is distinct; reusing the same assetId/geometryId for both bodies is refused by the existing native validator. Do not synthesize a display mesh, silently extract one object or rewrite native geometry IDs.
Preserve the original document ID, source assets, bodies, object order and names. Increment the document revision once on accepted duplication; the new asset starts revision0. The owner must freeze the deterministic/caller-supplied new-ID and name rules within the existing48-character ID/128-UTF8-byte name limits. Enforce unchanged4asset/16body/source/file/history budgets; refuse when capacity or revision would overflow rather than increasing a global cap. No linked assembly instance, parametric copy, automatic offset, general B-Rep/Solid or feature-graph duplication claim.
Use the existing prepare -> actual Viewer admission -> accept/cancel transaction. Expose an editor-module duplication candidate/API, then a concise shadcn Objects/Inspector action in the app. Accepted source/history/dirty/selection changes occur only after genuine admitted acceptance; refusal/cancel leaves the old content and rendering. New and old bodies may initially overlap geometrically; follow-up native Move can separate them. Duplication itself does not move or rescale the source.
Freeze display behavior within existing1..4-body/document and Curve-focus capabilities. Never evict a displayed body silently, convert a null-document focused Curve to a fake canonical document, or bypass supported geometry admission. Show only a concise actionable refusal/disabled reason in the app. Feature graph, raw drafts, pending candidates/decisions, captured gestures, stale selection and disposal follow the existing session/host guards. No duplicate implementation of file/recovery logic.
Execute CAD Editor owns packages/barocss-cad-editor/** and apps/cad-editor/**; CAD kernel providers and shared/root/lock/static remain unchanged. The native document constructor/reference/file APIs are present. A new session duplication transaction and UI flow remain unimplemented. Current author WIP owns overlapping session/app/gizmo paths: do not concurrently edit them. The module chooses when to claim this card after reconciling its active work.
Before code, freeze clean immutable parent, exact public request/result/errors, owned files, source identity/selection/display/refusal rules, revision/name/ID budgets and literal one-flow commands. Up to three bounded transient helpers may own disjoint transaction, UI and flow files; primary composes shared types/barrel/README once. Integration alone adopts the completed native delta.
Affected pnpm --filter @barocss/cad-editor build:library and pnpm --filter @barocss/cad-editor-app build (confirm actual package/script names at the owner freeze), followed by one short real source/API/app/file flow at a fixed native head. Duplicate a real supported original Surface, accept through actual Viewer, inspect distinct qualified IDs and exact copied whole source, then native-edit the copy and verify original source/frame/history independence. Exercise Undo/Redo, genuine Save/Open and fresh copy re-edit; add a supported canonical Curve only if its existing actual display/focus contract supports the same transaction. Refuse same-qualified ownership, reused IDs, exhausted4assets/16bodies, revision overflow, pending/stale/captured/cancelled inputs without replacing accepted data. Keep one history entry for duplication, original failure records, actual JS/declaration/build/run evidence and explicit unsupported profiles. No broad regression campaign.
Current integrated UI/file/recovery acceptance stays #1254/#674. Public package configuration is not npm publication; no product push/PR/npm/deployment/release authorization.