Skip to content

feat(core): discover project icons automatically - #56698

Open
kitlangton wants to merge 1 commit into
betafrom
project-icons
Open

kitlangton wants to merge 1 commit into
betafrom
project-icons

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

How it works

  1. When discovery runs: Inline on first Project.resolve when project.icon_url is unset, and across unarchived projects during the hourly Project.sweep.
  2. What it reads: opencode.json(c) / .opencode/opencode.json(c) icon first (https: URLs kept as-is; relative paths validated inside the project root), then a fixed priority list of well-known paths (Xcode .appiconset picking a 128–256 px entry, Icon Composer .icon front layer, assets/app-icon.*, build/icon.*, src-tauri/icons/icon.*, resources/icon.*, icons/icon.*, extension/icons/icon.*, web favicons/apple-touch-icon in public//app//src/app//site/public//root, and logo.*/icon.* in assets//public//root).
  3. Where it is stored: Stores the project-relative path and 16-char content hash in the existing project.icon_url column (no database migration or schema change) and exposes /api/project/<id>/icon?v=<hash> on Project.Info.icon.url.
  4. How it is served (GET /api/project/:projectID/icon): Resolves the stored relative path inside the project's canonical worktree (rejecting any path escaping it at the boundary), streams the image bytes with Content-Type, ETag: "<hash>", and Cache-Control (private, max-age=31536000, immutable when ?v= matches, 304 on If-None-Match), and returns 404 when the file is missing so ProjectAvatar falls back to the letter tile.
  5. Freshness: Reading at request time means edits show up immediately; the hourly Project.sweep updates the v= hash if the file changed, or clears and rediscovers if the file was deleted.

Stack

  1. PR A (fix(ui): show the OpenCode icon for the current project ID #57499): show the OpenCode icon for the current project ID (+9 / -4 code, +21 tests)
  2. PR B (feat(core): discover project icons automatically #56698, this PR): store discovered icon location and serve via GET /api/project/:projectID/icon (+216 / -21 code, +190 / -1 tests, +42 / -4 generated client, 0 migrations)
  3. PR C (feat(app): add detected icons picker in project settings #57500, draft): "Detected icons" picker in project settings

Proof

Dark Light
Dark sidebar Light sidebar

@kitlangton
kitlangton force-pushed the project-icons branch 2 times, most recently from e37eea8 to 22eb137 Compare October 20, 2026 19:16
@kitlangton kitlangton changed the title feat(app): discover project icons and names automatically feat(core): discover project icons automatically Oct 20, 2026
@kitlangton
kitlangton changed the base branch from beta to project-remote-names October 20, 2026 19:29
@kitlangton
kitlangton force-pushed the project-icons branch 2 times, most recently from b96f66a to 69c4e2e Compare October 20, 2026 22:27
@kitlangton
kitlangton force-pushed the project-remote-names branch from 763c6dd to abd6f0e Compare October 20, 2026 22:27
Base automatically changed from project-remote-names to beta October 20, 2026 22:50
@kitlangton
kitlangton force-pushed the project-icons branch 5 times, most recently from 5efaf8f to 9ca7f24 Compare October 21, 2026 01:01

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant