feat: add Altimate as a provider via /connect#162
Conversation
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
`Filesystem.write()` passes `mode` to `writeFile()`, but Node.js only applies the mode on file creation — not when overwriting an existing file. Add explicit `chmod()` after write to ensure `0o600` permissions are always enforced on `~/.altimate/altimate.json`, even on subsequent logins. Addresses Sentry review finding on PR #162. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
🤖 Behavioral Analysis — 3 Finding(s)🟡 Warnings (3)
Because submit() is called fire-and-forget from the keyboard handler (no await), any exception from writeJson or dispose becomes an unhandled promise rejection. The dialog remains open (dialog.clear() never called), but validating() is already false so the form looks ready for another attempt. There is zero indication to the user that credentials were not saved. The PR itself introduces the new chmod call in writeFile that can now throw on restricted filesystems (EPERM), making this more likely to trigger than before. Analysis run | Powered by QA Autopilot |
af70cf9 to
dc75bc3
Compare
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Adds first-class support for an Altimate-hosted “OpenAI-compatible” backend provider, including a TUI login flow that persists credentials locally and prefers Altimate as the default model when configured.
Changes:
- Add an
altimate-backendprovider loader (autoloads when Altimate credentials exist) and register a default Altimate model in the provider database. - Introduce a new TUI “Login to Altimate” dialog and wire it into
/connectand a new/logincommand. - Ensure file writes that specify a mode also apply permissions via
chmod.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/opencode/src/util/filesystem.ts | Applies chmod after writes when mode is provided. |
| packages/opencode/src/provider/provider.ts | Adds altimate-backend custom loader and registers an OpenAI-compatible Altimate model/provider entry. |
| packages/opencode/src/cli/cmd/tui/context/local.tsx | Prefers Altimate provider/model as the fallback default when connected. |
| packages/opencode/src/cli/cmd/tui/component/dialog-provider.tsx | Adds Altimate to provider list priority and routes selection to the Altimate login dialog. |
| packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx | New dialog to validate and store Altimate credentials, then bootstrap and select Altimate model. |
| packages/opencode/src/cli/cmd/tui/app.tsx | Adds a “Login to Altimate” command with /login slash entry. |
| docs/docs/getting-started.md | Documents how to connect/login to Altimate and where credentials are stored. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
dc75bc3 to
bdc5217
Compare
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
bdc5217 to
bc2c8a7
Compare
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
bc2c8a7 to
b6fb0e9
Compare
b6fb0e9 to
abb6294
Compare
abb6294 to
4fc2c1a
Compare
4fc2c1a to
36b20c6
Compare
packages/opencode/src/cli/cmd/tui/component/dialog-altimate-login.tsx
Outdated
Show resolved
Hide resolved
36b20c6 to
8d22792
Compare
✅ Tests — All PassedTypeScript — passedPython — passedcc @suryaiyer95 |
Summary
Registers Altimate as an OpenAI-compatible provider accessible through the
/connectflow.altimate-backendauto-loads when~/.altimate/altimate.jsonexists, configured withbaseURL,apiKey, andx-tenantheader/connectopens a 3-field form — Instance Name, API Key, URL — with tab navigation and credential validation against/auth_healthFilesystem.write()enforces file permissions viachmod()on every write. Credentials saved with0o600Files changed
dialog-altimate-login.tsxdialog-provider.tsxprovider.tsaltimate-backendwith auto-loader using saved credentialsfilesystem.tschmod()afterwriteFileto enforce permissions on existing filesgetting-started.md/connectprovider options and Altimate credential setupTest Plan
/connect→ Altimate appears in Popular with(API key)label~/.altimate/altimate.json, dialog closesChecklist