anomalyco / anomalyco/opencode

feat(tui): render structured mentions inline

Open
#41,197 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Problem

Structured references are styled while composing a prompt, but projected user messages render the original text as plain text and show attachments separately below it.

For example, a selected skill currently becomes:

Compare the workspace provider options. /api-design

[ skill | API design ]

The same underlying inconsistency exists for file and agent mentions: composer extmarks communicate structure inline, but timeline rendering loses that styling and relies on separate badges or previews.

Proposed direction

Introduce one shared user-message mention renderer that segments message text using the structured attachment mention ranges and styles each recognized reference inline:

  • @file references
  • @agent references
  • /skill references

Render a separate badge or preview only when the attachment has no valid inline mention or needs richer presentation, such as an image preview.

renderMentions(message.text, {
  files: message.files,
  agents: message.agents,
  skills: message.skills,
})

The renderer should validate that each stored range still matches its mention text and fall back safely when ranges are stale or overlap.

Scope

This is a follow-up to #41188. That PR keeps the existing timeline convention and adds structured skill attachments; it should not special-case skill rendering before files and agents share the same treatment.

Acceptance criteria

  • Structured file, agent, and skill mentions retain recognizable inline styling after submission.
  • Inline mentions and separate badges are not duplicated unnecessarily.
  • Attachments without valid mention ranges still render through the existing badge/preview UI.
  • Multiple mentions, Unicode text, stale ranges, and overlapping ranges have focused tests.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the projected user-message timeline renderer and the composer’s structured attachment mention handling, then trace how files, agents, and skills are represented by their stored ranges. Use the acceptance criteria to guide focused tests for multiple mentions, Unicode text, stale ranges, and overlaps. Done means valid mentions are styled inline without unnecessary duplicate badges, while invalid or richer attachments retain the existing badge or preview UI.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.