Skip to content

Added opt-in showSemanticIds to DOM renderer.#67

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
opencode/issue63-20260626103740
Closed

Added opt-in showSemanticIds to DOM renderer.#67
github-actions[bot] wants to merge 1 commit into
mainfrom
opencode/issue63-20260626103740

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Completion Report

Branch: opencode/issue63-20260626103740
Base: main
Commit: 4752d62
PR: Created automatically by infrastructure

Files changed (7 files, +209/-7)

  • .changeset/forty-hotels-write.md — empty changeset (no version bump needed)
  • packages/dom/src/index.ts — added showSemanticIds option, semanticSlugify and createSemanticIdFactory helpers, updated buildDom to emit data-intent-screen, data-intent-surface, data-intent-ask, data-intent-action attributes
  • packages/dom/src/dom-router.ts — forwarded showSemanticIds option through renderRouter
  • packages/dom/src/dom.test.ts — added 6 tests covering: absent-by-default, present-when-enabled, same ID on label+input, duplicate ask labels, duplicate action labels, and accessibility preservation
  • packages/dom/README.md — mentioned showSemanticIds in feature list
  • docs/Inspect-Screen.md — updated boundary note to reflect new capability
  • docs/Quickstart.md — added showSemanticIds to example options

Summary

Added an opt-in showSemanticIds option to renderDom() and renderRouter(). When enabled, rendered DOM elements receive data-intent-* attributes matching the semantic IDs produced by inspectScreen():

  • <main data-intent-screen="screen:invite-member">
  • <main data-intent-surface="surface:main">
  • <label data-intent-ask="ask:email"> + <input data-intent-ask="ask:email">
  • <button data-intent-action="action:invite-member">

Semantic ID generation replicates the same slugify + per-kind counter algorithm used by core's inspectScreen(), producing identical IDs for the same screen definition.

Validation

  • pnpm test ✅ — 329 tests pass
  • pnpm typecheck
  • pnpm build
  • pnpm lint
  • pnpm pack:check
  • pnpm changeset status

Known limitations

  • Resource semantic IDs are not emitted (no rendered DOM element representing them in current renderer)
  • Flow semantic IDs are not emitted (no rendered DOM element representing them)

Next recommended step

CI will run automatically on the PR. Since this is a runtime/API change, do not merge automatically — wait for review.

Closes #63

New%20session%20-%202026-06-26T10%3A37%3A39.995Z
opencode session  |  github run

@mahyarmlk

Copy link
Copy Markdown
Collaborator

Closing as superseded.

@mahyarmlk

Copy link
Copy Markdown
Collaborator

Closing as superseded by #66

@mahyarmlk mahyarmlk closed this Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add opt-in DOM semantic data attributes

1 participant