Skip to content

v0.12.0

Choose a tag to compare

@github-actions github-actions released this 17 Jun 11:08
36d9c97
docs(openspec): propose deterministic locator primitive (#506)

* docs(openspec): propose deterministic locator primitive

Add OpenSpec change add-deterministic-locator-primitive (proposal only, no
code): a deterministic resolveLocator(view, locator) over DocumentView, a
tested clean_text->raw offset map (generalizing visible_offset_correction),
and a shared-core fix so the free buildDocumentView returns populated nodes.
Extends the docx-primitives capability; ships as @usejunior/docx-core 0.12.0.

Reviewed dynamically by Codex + agy.

* feat(docx-core): implement deterministic locator primitive + offset map (0.12.0)

Implements the add-deterministic-locator-primitive proposal:

- locator.ts: resolveLocator(view, locator) — deterministic single-span
  resolution with scope (section, exactly-one-heading), primary
  (regex/contextual/fingerprint, exactly-one-span; 0/>1 and zero-length →
  unresolved), and corroborating assertions (span-equality for
  regex/contextual, node-identity for fingerprint). No fuzzy/scoring.
- document_view.ts: clean_text→raw offset map (buildCleanToRawOffsetMap /
  cleanToRawOffset) covering CR/LF strip, leading/trailing trim, and
  manual-list-label prefix; raw_text added to DocumentViewNode as its basis.
- document_view.ts: free buildDocumentView() now returns populated nodes via a
  shared collectViewParagraphs core (table helpers extracted to table_context.ts
  to avoid a circular import); parity with DocxDocument.buildDocumentView().
- Exports resolveLocator + offset-map helpers from the primitives barrel.
- Lockstep version bump of the suite to 0.12.0 (the hard prerequisite the
  open-agreements selector-contract change pins).

Tests: locator.test.ts + document_view_free.test.ts (allure BDD), all 18 spec
delta scenarios covered (check:spec-coverage --feature passes); full build and
docx-core suite green.