Skip to content

feat: client-side Reference UUID generator tool #42

Description

@maehr

Re-scoped by #84 (2026-08-25)

#84 shipped /reg/work/{key}/aliases.json and /dump/aliases.json, so a client resolves a registered passage to its UUID with a JSON parse alone. Lookup is no longer a reason to build this tool.

What remains is author-side minting: computing the UUID for a reference that is not yet in the registry, so a contributor can quote the identifier in a data proposal before the compiler ever runs. Re-scope the issue to that before building it, and drop the registry autocomplete framing, which #84 now serves better.

The seed logic has moved. It is referenceUuid at scripts/compile.ts:298-303, not 326-329.


Summary

Add a small in-browser tool that mints a Reference UUID for a canonical reference entirely client-side, so contributors and third parties can compute an ID without running the compiler. This directly realizes ADR-0002 (Reference IDs are offline-computable from the semantic tuple).

What it computes

Reference UUID = uuidv5([work_key, citation_system_key, locator].join('\n'), REFERENCE_NS) with REFERENCE_NS = b1a3670e-2ac7-544c-a1b9-396e0dc193f7 — mirroring scripts/compile.ts:326-329. (Mapping UUIDs are out of scope for this first version.)

UX

  • Three inputs: work_key, citation_system_key, locator.
  • Existing data + free input: work/system fields offer autocomplete from the compiled registry (populated at build time via src/lib/registry.ts, embedded as JSON), but any value can be typed.
  • Live output: the computed UUID and the resulting IRI https://textrefs.org/id/ref/{uuid} with a copy button.
  • If the chosen system's locator_regex is known, warn (don't block) when the locator isn't canonical — reinforcing ADR-0002's "reject, don't fold" rule.

Implementation notes

  • New standalone Astro page, e.g. src/pages/tools/ref-uuid.astro (pattern: src/pages/reg/index.astro).
  • Reuse the already-installed uuid@14 package; import v5 in a client <script> (Astro bundles it).
  • Load registry data server-side for the datalists via src/lib/registry.ts; hydrate client-side.
  • Add a link from get-started/authoring.md (and/or the registry browse page).
  • Verify parity: a few sample tuples must produce the same UUID as scripts/compile.ts.

References

  • ADR-0002 (decisions/ADR-0002-uuid-seed-semantic-identity.md)
  • Seed logic: scripts/compile.ts:326-329
  • RFC 9562 (UUID v5)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpost-v0.1.0Deferred past the v0.1.0 baseline. Revisit if the need arises.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions