Skip to content

merge: develop → main#7

Merged
JheisonMB merged 61 commits into
mainfrom
develop
Jul 10, 2026
Merged

merge: develop → main#7
JheisonMB merged 61 commits into
mainfrom
develop

Conversation

@JheisonMB

Copy link
Copy Markdown
Contributor

Release: all develop changes merged to main.

JheisonMB and others added 30 commits June 12, 2026 00:28
…ured dimensions, highlights and entity metadata
…dded monospace font and richer agent metadata
…pector, layer ghost states and 3D stacked view
…nonical spacing, comment preservation and a semantic safety check
…tity styles, and export dim offsets perpendicular to the measured axis
…ews and derived plans wired into the live preview
…GitHub repo URLs kept until the repo is renamed)
…lowing light/dark theme and a built-in .cf editor
JheisonMB and others added 23 commits June 30, 2026 19:06
…e records

compile_project registered every layer with ACI 7 (white) and compile_cf
re-added it with the actual color; the dxf crate appends layer records, so
the output contained two LAYER table entries per layer and external CAD
readers picked the white one. Layers are now registered once, after loading
the .cf files, using each layer's [layer].color.

DxfWriter::add_layer is now an upsert: re-adding an existing layer updates
its color instead of duplicating the table record.

hex_to_aci previously matched only 9 exact hex strings and silently mapped
everything else to white, so common colors like #FF4444 or #00CC44 lost all
color in the exported DXF and on import roundtrip. It now maps any parseable
color to the nearest entry of the standard ACI palette.

The roundtrip integration test now uses a non-palette layer color and
asserts the layer table has no duplicate records.
The build summary ("DXF generado", "entidades en capas") was the only
Spanish output left in an otherwise English CLI. Align it with the rest of
the command surface and the docs.
…rt --output

The CLI reference and guides were missing flags that exist on the real
surface: serve's background/daemon behavior (--foreground, --stop),
preview --format all and --plano (drawing sheets declared as [[plano]] in
project.toml), and import --output.
The [[plano]] project.toml feature (named views on paper-sized sheets with
title blocks, including section cuts) had no user documentation beyond the
new CLI reference row. Document the declaration keys, the available views,
and the preview --plano workflow, all verified against the real CLI.
The build pipeline never emitted HATCH or MTEXT entities: filled regions
compile to fan-triangulated SOLID entities, hatch patterns to clipped
LINE segments (the dxf crate has no native HATCH), and annotations to
TEXT. Update README and the building-and-export guide to describe the
entities actually written.
…l boundaries

A hatch or fill whose `boundary` id did not match a closed polyline or
rect in the same layer file was skipped with no diagnostic, so a filled
region could silently vanish from the DXF. Emit a stderr warning naming
the entity, its layer, and the missing boundary id; the build still
succeeds. Boundaries remain resolved per layer file.
The fl-closet-d1 fill referenced boundary rc-closet-d1, which is defined
in muros.cf; since boundaries resolve per layer file the reference never
matched and the fill was skipped (no SOLID in the DXF, no fill in the
preview). Use inline points matching that rect so the closet renders as a
filled region in both DXF and preview.
The importer skipped SOLID entities as unsupported, so a build → import
round-trip lost every filled region. Import SOLIDs as fill polygons and
fuse edge-adjacent ones per layer back into a single `[[fill]]`: the
fan-triangulated triangles `cadspec build` emits are stitched into their
original boundary by dropping shared interior edges and chaining the
remaining boundary edges into one ring. Disjoint fills stay separate, and
a ring that can't be stitched cleanly falls back to per-triangle fills.
Recovers fill color/lineweight and keeps the entity count stable across
round-trips.
A `[[hatch]]` expands into many clipped DXF LINE entities (the DXF format
this tool targets has no native HATCH entity). A build→import round-trip
used to bring every one of those back as a separate `[[line]]`, inflating
one source hatch into dozens of stray lines.

Stamp each generated pattern line with `CADSPEC_HATCH` XDATA carrying a
group id plus the source region, pattern, angle and scale. On import,
lines sharing a group id collapse back into a single `[[hatch]]` (using
inline points), while untagged lines stay `[[line]]` — so a foreign DXF's
ordinary lines are never mistaken for hatch pattern (no false positives).

`[[hatch]]` now accepts inline `points` as an alternative to a `boundary`
id, mirroring `[[fill]]`; the compiler and SVG renderer resolve a hatch
region from either source. Verified stable across build→import→build on
the vivienda example (2 hatches + 4 real lines round-trip unchanged).
…d svg

Boundaries were already resolved per layer file in build (warns and skips
since 209d345), but preview/serve rendering and the svg module resolved
the same boundaries silently. Reuse the compiler's warning at the two
render_layer sites (fills, hatches) so the same condition is visible
regardless of which command triggered the render, and document that
per-file resolution is the intended design (cross-layer references use
inline `points`, not a project-wide boundary index).
D8 gap: fmt only had unit tests over inline TOML snippets, never an
end-to-end pass over a real multi-file project. Copy examples/vivienda's
sources into a tmp dir and drive format_project directly: verify the
first pass, that the result still compiles to a valid DXF, that
--check reports nothing outstanding, and that a second pass is a
byte-for-byte no-op across every file.
D8 gap: planos.rs only had 2 unit tests exercising render_plano directly
with a hand-built Plano struct; nothing drove the CLI-facing
generate_plano, which looks a plano up by name in project.toml. Declare
a [[plano]] on a copy of examples/vivienda and verify the happy path
(preview.png/svg written, title block content present) and that an
unknown name fails with a helpful error instead of panicking.
serve_project blocks forever in listener.incoming() and watch_project
blocks forever in rx.recv(), so both are exercised by spawning them on
a (deliberately leaked) thread and driving them from the outside: raw
TCP/HTTP against an OS-assigned port for serve (GET /state, /preview.svg,
404, and a rebuild triggered by editing a .cf file), and a filesystem
edit followed by polling for output.dxf for watch. Closes out D8.
hex_to_aci and aci_to_hex only knew about the 9 standard ACI colors, so
any layer color outside that small set (or a DXF layer index above 9 on
import) fell back to white. Both now use the full AutoCAD Color Index
table (indices 1-255), giving a much closer nearest-color match on
export and exact recovery of more colors on import.

aci_to_hex now returns an owned String since it looks up entries in a
255-color const table instead of matching a handful of literals.
The writer stamped hatch pattern lines with XDATA under the
CADSPEC_HATCH application name but never declared that name in the
DXF's APPID table. cadspec's own importer tolerated this (it reads
XDATA regardless of table registration), but strict DXF readers are
expected to ignore XDATA from unregistered apps. DxfWriter::new now
registers CADSPEC_HATCH via drawing.add_app_id, matching how AutoCAD's
own reserved app names are already ensured present.
config_path() reads $HOME directly, so config_set/config_show had zero
test coverage (testing them would have written into the real user's
~/.cadspec/config.toml). Split the path resolution out into
config_set_at/config_show_at, taking an explicit path like the rest of
the codebase's testable functions (fmt::format_project,
scaffold::create_project, etc.), and added tests against scratch paths
under /tmp.
Resolve the three D13 issues with the `serve` web viewer:

- Branding (13a): add an inline SVG favicon served at `/favicon.svg`
  and linked from the page head, so the tab has a "cs" monogram instead
  of a blank icon. The "cadspec live" wordmark already lived in the
  header.
- Themes (13b): drop the three-way theme toggle. The SVG background is
  hardcoded dark, so the light theme only ever recolored the chrome and
  read as a redundant second dark. Remove the toggle button, the
  pre-paint init script, the `[data-theme="light"]` and
  `prefers-color-scheme` CSS, and the `cadspec-theme` localStorage key,
  leaving a single dark theme.
- Editor auto-reload (13c): the built-in .cf editor now resyncs from
  disk when a file changes externally (another editor, git checkout).
  On every SSE tick `refresh()` calls a new `__reloadEditorIfClean`
  hook that reloads the current file unless there are unsaved edits or
  the user typed within the last 2s while focused, so in-progress edits
  are never clobbered.

Tests: unit tests assert the served HTML has the favicon/branding, no
theme-toggle remnants, and the reload hook; the serve e2e test now
checks `/favicon.svg` returns 200 with SVG content.
docs: initial documentation, glTF export, editor, and binary rename
@JheisonMB JheisonMB added the target:main Targets the main branch label Jul 10, 2026
@JheisonMB
JheisonMB merged commit f9d4e66 into main Jul 10, 2026
4 checks passed
@JheisonMB
JheisonMB deployed to production July 10, 2026 15:57 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target:main Targets the main branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant