Skip to content

Add opt-in DOM semantic data attributes #63

Closed

Description

@mahyarmlk

Goal

Add an opt-in way for @intent-framework/dom to expose Intent semantic IDs as data-intent-* attributes in rendered DOM.

This should help debugging, demos, and future tooling by connecting inspectScreen() output to actual rendered HTML.

Context

Intent now has stable semantic IDs in inspectScreen() for screens, asks, actions, flows, surfaces, and resources.

The DOM renderer currently renders semantic HTML, but users cannot easily map rendered elements back to inspected graph nodes.

Desired behavior

Add a new opt-in render option, probably:

renderDom(Screen, {
  target,
  showSemanticIds: true,
})

Exact option name can be chosen after inspecting existing DOM render options.

When enabled, rendered DOM should include stable semantic data attributes where appropriate, for example:

<main data-intent-screen="screen:invite-member">
  <label data-intent-ask="ask:email">Email</label>
  <input data-intent-ask="ask:email" />
  <button data-intent-action="action:invite-member">Invite member</button>
</main>

Use the actual semantic IDs produced by current graph/inspection logic.

Requirements

  • Opt-in only. Default DOM output should not change.

  • Do not use semantic IDs as DOM id attributes.

  • Do not expose data attributes for resources unless there is a real rendered element representing them.

  • Keep accessibility behavior unchanged.

  • Keep existing tests passing.

  • Add focused DOM tests for the new option.

  • Update docs where useful:

    • packages/dom/README.md
    • docs/Inspect-Screen.md
    • maybe docs/Quickstart.md only if it stays tiny

Boundaries

Do not build DevTools.
Do not add CSS styling.
Do not change public graph semantics.
Do not change core runtime behavior.
Do not add a dependency.

Activity

  1. mahyarmlk commented on Jun 26, 2026

    @mahyarmlk
    CollaboratorAuthor

    /oc implement this issue.

    Follow AGENTS.md first.

    Keep the PR small.

    Expected shape:

    • Inspect current renderDom options and DOM renderer tests.
    • Add an opt-in DOM render option for semantic data attributes.
    • Reuse the same semantic ID behavior as inspectScreen() where possible.
    • Add focused tests proving attributes appear only when enabled.
    • Ensure default rendered DOM is unchanged when the option is omitted.
    • Update minimal docs for the new option.
    • Do not add dependencies.
    • Do not publish.
    • Do not change package versions unless Changesets requires it.

    Run:

    • pnpm test
    • pnpm typecheck
    • pnpm build
    • pnpm lint
    • pnpm pack:check
    • pnpm changeset status

    Open a PR and report the result.

    Because this is a runtime/API change, do not merge automatically. Stop after CI is green and wait for review.

  2. github-actions commented on Jun 26, 2026

    @github-actions
    Contributor

    Author identity unknown

    *** Please tell me who you are.

    Run

    git config --global user.email "you@example.com"
    git config --global user.name "Your Name"

    to set your account's default identity.
    Omit --global to set the identity only in this repository.

    fatal: empty ident name (for runner@runnervmmklqx.z0vmolfl05tuxlqullhijl2tda.yx.internal.cloudapp.net) not allowed

    opencode session  |  github run

  3. mahyarmlk commented on Jun 26, 2026

    @mahyarmlk
    CollaboratorAuthor

    /oc continue the previous DOM semantic data attributes task.

    The last run failed only because git author identity was missing in the workflow. That is fixed on main now.

    Re-read this issue, inspect current main, and implement the task again from scratch if needed.

    Requirements:

    • Add an opt-in DOM render option for semantic data attributes.
    • Default DOM output must remain unchanged.
    • Reuse current semantic ID behavior from inspectScreen where possible.
    • Add focused tests proving attributes appear only when enabled.
    • Add focused tests proving attributes are absent by default.
    • Update minimal docs.
    • Do not add dependencies.
    • Do not publish.
    • Do not change package versions unless Changesets requires it.

    Run full validation:

    • pnpm test
    • pnpm typecheck
    • pnpm build
    • pnpm lint
    • pnpm pack:check
    • pnpm changeset status

    Open a PR and report the result.

    Because this is a runtime/API change, do not merge automatically. Stop after CI is green and wait for review.

  4. github-actions commented on Jun 26, 2026

    @github-actions
    Contributor

    fatal: could not read Username for 'https://github.com': No such device or address

    opencode session  |  github run

  5. mahyarmlk commented on Jun 26, 2026

    @mahyarmlk
    CollaboratorAuthor

    /oc continue the previous DOM semantic data attributes task.

    The last run failed only because checkout credentials were not persisted for git push. That is fixed on main now.

    Re-read this issue, inspect current main, and implement the task again from scratch if needed.

    Requirements:

    • Add an opt-in DOM render option for semantic data attributes.
    • Default DOM output must remain unchanged.
    • Reuse current semantic ID behavior from inspectScreen where possible.
    • Add focused tests proving attributes appear only when enabled.
    • Add focused tests proving attributes are absent by default.
    • Update minimal docs.
    • Do not add dependencies.
    • Do not publish.
    • Do not change package versions unless Changesets requires it.

    Run full validation:

    • pnpm test
    • pnpm typecheck
    • pnpm build
    • pnpm lint
    • pnpm pack:check
    • pnpm changeset status

    Open a PR and report the result.

    Because this is a runtime/API change, do not merge automatically. Stop after CI is green and wait for review.

  6. github-actions commented on Jun 26, 2026

    @github-actions
    Contributor

    GitHub Actions is not permitted to create or approve pull requests. - https://docs.github.com/rest/pulls/pulls#create-a-pull-request

    opencode session  |  github run

  7. mahyarmlk commented on Jun 26, 2026

    @mahyarmlk
    CollaboratorAuthor

    /oc continue the previous DOM semantic data attributes task.

    The last run failed only because GitHub Actions was not permitted to create pull requests. That permission is enabled now.

    Re-read this issue, inspect current main, and implement the task again from scratch if needed.

    Open a PR and stop after CI is green. Do not merge automatically because this is a runtime/API change.

  8. github-actions commented on Jun 26, 2026

    @github-actions
    Contributor

    Created PR #66

    New%20session%20-%202026-06-26T10%3A19%3A20.516Z
    opencode session  |  github run

  9. github-actions commented on Jun 26, 2026

    @github-actions
    Contributor

    Created PR #67

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

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions