Skip to content

#771 File-type icons in @ mentions and the File Browser - #772

Merged
ivanfenenko merged 2 commits into
mainfrom
feature/771-file-type-icons
Oct 20, 2026
Merged

ivanfenenko merged 2 commits into
mainfrom
feature/771-file-type-icons

Conversation

@ivanfenenko

@ivanfenenko ivanfenenko commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Composer @ suggestions now show a file-type icon for each file (chosen from its name or extension) and a Lucide brain glyph for agents, like the opencode desktop composer (ComposerSuggestionIcon). Row height and accessibility labels are unchanged.
  • New design-system component OpenCodeFileIcon(path, kind: file|directory, expanded, mono) on iOS and Android. It is an exact port of opencode's chooseIconName: lowercased basename in fileNames, then dotted suffixes longest first, then Document. Folders try name, .name, _name, __name__, plus the Open variant when expanded. mono draws in the current foreground colour.
  • OpenCodeComposerSuggestionItem gets an optional leadingIcon (.file(path, kind) / .icon(OpenCodeIcon), Android File / Icon). SessionChatAtSuggestion derives it, and file suggestions now carry isDirectory.
  • scripts/sync-file-type-icons.mjs (npm run file-icons:sync) vendors the 314 reachable SVGs and the three lookup tables from an opencode checkout into icons/file-types/ (--import <checkout>). From there it generates:
    • FileTypeIcons.xcassets, with vector preserved and original rendering
    • Android VectorDrawables, with gradients as aapt:attr and gradientTransform baked in
    • the Swift and Kotlin name tables
  • The converter needed two fixes: fills inherited from <svg> or <g> are written onto each shape, and unfilled shapes are dropped. Without this, fill="none" icons (Document, Readme, Log, Changelog, Settings) drew a black square on Android.
  • File Browser tree rows and find results use the same icons. Expanded folders get the open-folder art. OpenCodeTreeRow gains a variant-first icon: iOS icon: .generic | .fileType(path:) (default .generic); Android OpenCodeTreeRowIcon.Glyph | FileType(path), with the existing ImageVector overload delegating to Glyph. The file viewer header is a title-only top bar with no icon, so it is unchanged.
  • currentColor parts (the default folder, folder-github, folder-scripts and 16 more) are baked to the porcelain icon-base grey. Upstream inherits --icon-base there, and every preset uses a similar mid grey in light and dark. On Android, a non-zero viewBox origin (json, rollup) is now honoured; before, those icons drew off-canvas.
  • Gallery: new File Icon entry, a Mentions scenario in Composer Suggestion Overlay, and agent in Icons (both platforms).
  • Attribution for opencode (MIT) and the Material Icon Theme (MIT, Philipp Kief) is in THIRD_PARTY_NOTICES.md, with provenance in icons/file-types/README.md.

Checks

  • iOS: xcodebuild build-for-testing passed. OpenCodeFileIconTests + FilesViewModelTests passed (29 tests). OpenCodeFileIconTests covers basename, multi-dot, whole-name, default and folder-variant cases, and checks that every reachable icon resolves to a bundled asset (UIImage(named:)).
  • Android: :app:assembleDebug passed, so all 314 drawables compile under aapt. The full :app:testDebugUnitTest suite passed (2,391 tests, 0 failures), including OpenCodeFileIconLookupTest (8/8, the same cases as iOS).
  • ktlint found no new violations in the changed files. The ones reported in Navigation.kt, SessionChatScreen.kt and the overlay file were already there.

Evidence

Real apps, light and dark, iOS and Android: http://ivan-m2.local:8787/2026-10-20/2244-771-file-type-icons/

  • @ suggestions against the scenario harness (opencode v1 1.19.1).
  • File Browser with src and test expanded (.ts, .js, .mjs, .json, package.json, README.md), against a plain opencode serve v1 on the same throwaway project. Another session held the harness's fixed ports.

iOS 26.5 iPhone 17 simulator and Android Pixel 9a emulator, against opencode v1 1.19.1 on the scenario harness's throwaway project. The File Browser shots used a plain opencode serve on that project. These are static states, so there are no GIFs.

File Browser: src and test expanded (open-folder art), mixed .ts / .js / .mjs / .json / package.json / README.md

iOSAndroid
Lightios light filesandroid light files
Darkios dark filesandroid dark files

@ suggestions: agents (brain glyph) and project files (iOS @sr, Android @s)

iOSAndroid
Lightios light srcandroid light src
Darkios dark srcandroid dark src

@mobile/: Kotlin (gradient), Swift, Dockerfile (file-name match), Gradle

iOSAndroid
Lightios light mobileandroid light mobile
Darkios dark mobileandroid dark mobile

Issue

Risks / Follow-ups

  • Evidence covers v1 only. The icons are client-side and use the existing file search on both protocols, so v2 was not run separately.
  • The baked currentColor grey does not follow non-porcelain presets exactly; it is close for every preset except signal (#2A2A2A / #E0E0E0).
  • _light icon variants are not chosen by theme, same as upstream FileIcon.
  • Adds the dev dependency svg2vectordrawable 2.9.1 (MIT) for the generator only.

🤖 Generated with Claude Code

Port opencode's FileIcon lookup and its Material Icon Theme SVGs as
OpenCodeFileIcon on iOS and Android, generated from icons/file-types by
scripts/sync-file-type-icons.mjs. Composer @ suggestions now show the
file-type icon for files and a Lucide brain glyph for agents.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko
ivanfenenko marked this pull request as ready for review October 20, 2026 20:33
@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

@cursor review

OpenCodeTreeRow gains a file-type icon variant on both platforms (iOS
icon: .fileType(path:), Android OpenCodeTreeRowIcon.FileType); the File
Browser tree and find results use it, with open-folder art when expanded.

The generator now bakes currentColor (default folder, folder-github, ...)
to the porcelain icon-base grey and honours a non-zero viewBox origin on
Android (json, rollup).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ivanfenenko ivanfenenko changed the title #771 File-type icons in @ mention suggestions #771 File-type icons in @ mentions and the File Browser Oct 20, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 7ce2693. Configure here.

@ivanfenenko

Copy link
Copy Markdown
Collaborator Author

Evidence: real apps (#771)

iOS 26.5 iPhone 17 simulator and Android Pixel 9a emulator, against opencode v1 1.19.1 on the scenario harness's throwaway project. The File Browser shots used a plain opencode serve on that project. These are static states, so there are no GIFs.

File Browser: src and test expanded (open-folder art), mixed .ts / .js / .mjs / .json / package.json / README.md

iOSAndroid
Lightios light filesandroid light files
Darkios dark filesandroid dark files

@ suggestions: agents (brain glyph) and project files (iOS @sr, Android @s)

iOSAndroid
Lightios light srcandroid light src
Darkios dark srcandroid dark src

@mobile/: Kotlin (gradient), Swift, Dockerfile (file-name match), Gradle

iOSAndroid
Lightios light mobileandroid light mobile
Darkios dark mobileandroid dark mobile

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.

1 participant