## Summary
When Git is available but the opened folder is not a repository
(temporary workspaces, plain folders), the Files panel's Changes and
Commits views now say so and offer **Initialize Git**. Directory-only
mode, where the backend cannot run Git, is unchanged.
## Design
- **Route:** `POST /api/workspaces/:id/git-init` accepts only the exact
opened folder.
- It refuses directory-only mode, folders already inside a repository,
unowned folders and folders being deleted.
- It checks that OpenCode resolves the same folder as the project
directory, then calls native `vcs.init` once, without retry.
- A 501 maps to a localized "not supported" message.
- **Refresh after init:**
- The server re-reads the worktree inventory and resets the git-status
cache.
- The UI refreshes file caches, worktrees, project metadata and the
session list.
- Initialization changes the folder's native project ID, so stale
project metadata would otherwise leave later session pages empty.
- **No confirmation dialog:** creating `.git` is non-destructive and
easily undone.
- **Also fixed:** a spurious "detached HEAD" suffix on non-repository
folders in the worktree selector.
## Validation
- Server unit and route tests: authorization, refusals, 501, refresh.
- New browser regression `git-init.test.ts` (2/2): empty state, button,
refreshed Changes and branch, 501 message with no retry. The existing
Files panel suite passes 18/18.
- Isolated native check `scripts/test-git-init-native.mjs` against a
private OpenCode 2.0.27 daemon.
- Server and UI typechecks pass.
Oversized files touched: `workspaces/manager.ts` (~1307 lines) and
`lib/api-client.ts` (~809 lines).
An independent gatekeeper review will be published before the admin
merge.