Skip to content

Commit 55b65b7

Browse files
authored
Merge pull request #98 from AltimateAI/fix/restore-branding-and-tui-config
fix: restore TUI crash after upstream merge
1 parent 4180c47 commit 55b65b7

14 files changed

Lines changed: 364 additions & 72 deletions

File tree

packages/opencode/src/cli/cmd/github.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ type IssueQueryResponse = {
133133
}
134134
}
135135

136-
const AGENT_USERNAME = "opencode-agent[bot]"
136+
const AGENT_USERNAME = "altimate-code-agent[bot]"
137137
const AGENT_REACTION = "eyes"
138-
const WORKFLOW_FILE = ".github/workflows/opencode.yml"
138+
const WORKFLOW_FILE = ".github/workflows/altimate-code.yml"
139139

140140
// Event categories for routing
141141
// USER_EVENTS: triggered by user actions, have actor/issueId, support reactions/comments
@@ -242,7 +242,7 @@ export const GithubInstallCommand = cmd({
242242
"",
243243
" 3. Go to a GitHub issue and comment `/oc summarize` to see the agent in action",
244244
"",
245-
" Learn more about the GitHub agent - https://opencode.ai/docs/github/#usage-examples",
245+
" Learn more about the GitHub agent - https://altimate-code.dev/docs/github/#usage-examples",
246246
].join("\n"),
247247
)
248248
}
@@ -266,7 +266,7 @@ export const GithubInstallCommand = cmd({
266266

267267
async function promptProvider() {
268268
const priority: Record<string, number> = {
269-
opencode: 0,
269+
"altimate-code": 0,
270270
anthropic: 1,
271271
openai: 2,
272272
google: 3,
@@ -324,7 +324,7 @@ export const GithubInstallCommand = cmd({
324324
if (installation) return s.stop("GitHub app already installed")
325325

326326
// Open browser
327-
const url = "https://github.com/apps/opencode-agent"
327+
const url = "https://github.com/apps/altimate-code-agent"
328328
const command =
329329
process.platform === "darwin"
330330
? `open "${url}"`
@@ -361,7 +361,7 @@ export const GithubInstallCommand = cmd({
361361

362362
async function getInstallation() {
363363
return await fetch(
364-
`https://api.opencode.ai/get_github_app_installation?owner=${app.owner}&repo=${app.repo}`,
364+
`https://api.altimate-code.dev/get_github_app_installation?owner=${app.owner}&repo=${app.repo}`,
365365
)
366366
.then((res) => res.json())
367367
.then((data) => data.installation)
@@ -376,7 +376,7 @@ export const GithubInstallCommand = cmd({
376376

377377
await Filesystem.write(
378378
path.join(app.root, WORKFLOW_FILE),
379-
`name: opencode
379+
`name: altimate-code
380380
381381
on:
382382
issue_comment:
@@ -385,12 +385,12 @@ on:
385385
types: [created]
386386
387387
jobs:
388-
opencode:
388+
altimate-code:
389389
if: |
390390
contains(github.event.comment.body, ' /oc') ||
391391
startsWith(github.event.comment.body, '/oc') ||
392-
contains(github.event.comment.body, ' /opencode') ||
393-
startsWith(github.event.comment.body, '/opencode')
392+
contains(github.event.comment.body, ' /altimate-code') ||
393+
startsWith(github.event.comment.body, '/altimate-code')
394394
runs-on: ubuntu-latest
395395
permissions:
396396
id-token: write
@@ -403,8 +403,8 @@ jobs:
403403
with:
404404
persist-credentials: false
405405
406-
- name: Run opencode
407-
uses: anomalyco/opencode/github@latest${envStr}
406+
- name: Run altimate-code
407+
uses: altimate/altimate-code/github@latest${envStr}
408408
with:
409409
model: ${provider}/${model}`,
410410
)
@@ -474,7 +474,7 @@ export const GithubRunCommand = cmd({
474474
? (payload as IssueCommentEvent | IssuesEvent).issue.number
475475
: (payload as PullRequestEvent | PullRequestReviewCommentEvent).pull_request.number
476476
const runUrl = `/${owner}/${repo}/actions/runs/${runId}`
477-
const shareBaseUrl = isMock ? "https://dev.opencode.ai" : "https://opencode.ai"
477+
const shareBaseUrl = isMock ? "https://dev.altimate-code.dev" : "https://altimate-code.dev"
478478

479479
let appToken: string
480480
let octoRest: Octokit
@@ -522,7 +522,7 @@ export const GithubRunCommand = cmd({
522522
await addReaction(commentType)
523523
}
524524

525-
// Setup opencode session
525+
// Setup altimate-code session
526526
const repoData = await fetchRepo()
527527
session = await Session.create({
528528
permission: [
@@ -540,7 +540,7 @@ export const GithubRunCommand = cmd({
540540
await Session.share(session.id)
541541
return session.id.slice(-8)
542542
})()
543-
console.log("opencode session", session.id)
543+
console.log("altimate-code session", session.id)
544544

545545
// Handle event types:
546546
// REPO_EVENTS (schedule, workflow_dispatch): no issue/PR context, output to logs/PR only
@@ -713,7 +713,7 @@ export const GithubRunCommand = cmd({
713713

714714
function normalizeOidcBaseUrl(): string {
715715
const value = process.env["OIDC_BASE_URL"]
716-
if (!value) return "https://api.opencode.ai"
716+
if (!value) return "https://api.altimate-code.dev"
717717
return value.replace(/\/+$/, "")
718718
}
719719

@@ -762,7 +762,7 @@ export const GithubRunCommand = cmd({
762762
}
763763

764764
const reviewContext = getReviewCommentContext()
765-
const mentions = (process.env["MENTIONS"] || "/opencode,/oc")
765+
const mentions = (process.env["MENTIONS"] || "/altimate-code,/oc")
766766
.split(",")
767767
.map((m) => m.trim().toLowerCase())
768768
.filter(Boolean)
@@ -909,7 +909,7 @@ export const GithubRunCommand = cmd({
909909
}
910910

911911
async function chat(message: string, files: PromptFiles = []) {
912-
console.log("Sending message to opencode...")
912+
console.log("Sending message to altimate-code...")
913913

914914
const result = await SessionPrompt.prompt({
915915
sessionID: session.id,
@@ -1005,7 +1005,7 @@ export const GithubRunCommand = cmd({
10051005

10061006
async function getOidcToken() {
10071007
try {
1008-
return await core.getIDToken("opencode-github-action")
1008+
return await core.getIDToken("altimate-code-github-action")
10091009
} catch (error) {
10101010
console.error("Failed to get OIDC token:", error instanceof Error ? error.message : error)
10111011
throw new Error(
@@ -1107,9 +1107,9 @@ export const GithubRunCommand = cmd({
11071107
.join("")
11081108
if (type === "schedule" || type === "dispatch") {
11091109
const hex = crypto.randomUUID().slice(0, 6)
1110-
return `opencode/${type}-${hex}-${timestamp}`
1110+
return `altimate-code/${type}-${hex}-${timestamp}`
11111111
}
1112-
return `opencode/${type}${issueId}-${timestamp}`
1112+
return `altimate-code/${type}${issueId}-${timestamp}`
11131113
}
11141114

11151115
async function pushToNewBranch(summary: string, branch: string, commit: boolean, isSchedule: boolean) {
@@ -1388,9 +1388,9 @@ Co-authored-by: ${actor} <${actor}@users.noreply.github.com>"`
13881388
const titleAlt = encodeURIComponent(session.title.substring(0, 50))
13891389
const title64 = Buffer.from(session.title.substring(0, 700), "utf8").toString("base64")
13901390

1391-
return `<a href="${shareBaseUrl}/s/${shareId}"><img width="200" alt="${titleAlt}" src="https://social-cards.sst.dev/opencode-share/${title64}.png?model=${providerID}/${modelID}&version=${session.version}&id=${shareId}" /></a>\n`
1391+
return `<a href="${shareBaseUrl}/s/${shareId}"><img width="200" alt="${titleAlt}" src="https://social-cards.sst.dev/altimate-code-share/${title64}.png?model=${providerID}/${modelID}&version=${session.version}&id=${shareId}" /></a>\n`
13921392
})()
1393-
const shareUrl = shareId ? `[opencode session](${shareBaseUrl}/s/${shareId})&nbsp;&nbsp;|&nbsp;&nbsp;` : ""
1393+
const shareUrl = shareId ? `[altimate-code session](${shareBaseUrl}/s/${shareId})&nbsp;&nbsp;|&nbsp;&nbsp;` : ""
13941394
return `\n\n${image}${shareUrl}[github run](${runUrl})`
13951395
}
13961396

@@ -1451,7 +1451,7 @@ query($owner: String!, $repo: String!, $number: Int!) {
14511451
return [
14521452
"<github_action_context>",
14531453
"You are running as a GitHub Action. Important:",
1454-
"- Git push and PR creation are handled AUTOMATICALLY by the opencode infrastructure after your response",
1454+
"- Git push and PR creation are handled AUTOMATICALLY by the altimate-code infrastructure after your response",
14551455
"- Do NOT include warnings or disclaimers about GitHub tokens, workflow permissions, or PR creation capabilities",
14561456
"- Do NOT suggest manual steps for creating PRs or pushing code - this happens automatically",
14571457
"- Focus only on the code changes and your analysis/response",
@@ -1589,7 +1589,7 @@ query($owner: String!, $repo: String!, $number: Int!) {
15891589
return [
15901590
"<github_action_context>",
15911591
"You are running as a GitHub Action. Important:",
1592-
"- Git push and PR creation are handled AUTOMATICALLY by the opencode infrastructure after your response",
1592+
"- Git push and PR creation are handled AUTOMATICALLY by the altimate-code infrastructure after your response",
15931593
"- Do NOT include warnings or disclaimers about GitHub tokens, workflow permissions, or PR creation capabilities",
15941594
"- Do NOT suggest manual steps for creating PRs or pushing code - this happens automatically",
15951595
"- Focus only on the code changes and your analysis/response",

packages/opencode/src/cli/cmd/tui/app.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import { TuiEvent } from "./event"
3535
import { KVProvider, useKV } from "./context/kv"
3636
import { Provider } from "@/provider/provider"
3737
import { ArgsProvider, useArgs, type Args } from "./context/args"
38+
import { TuiConfigProvider } from "@tui/context/tui-config"
39+
import type { TuiConfig } from "@/config/tui"
3840
import open from "open"
3941
import { writeHeapSnapshot } from "v8"
4042
import { PromptRefProvider, usePromptRef } from "./context/prompt"
@@ -108,6 +110,7 @@ export function tui(input: {
108110
fetch?: typeof fetch
109111
headers?: RequestInit["headers"]
110112
events?: EventSource
113+
tuiConfig?: TuiConfig.Info
111114
onExit?: () => Promise<void>
112115
}) {
113116
// promise to prevent immediate exit
@@ -116,6 +119,7 @@ export function tui(input: {
116119
win32DisableProcessedInput()
117120

118121
const mode = await getTerminalBackgroundColor()
122+
const tuiConfig = input.tuiConfig ?? {}
119123

120124
// Re-clear after getTerminalBackgroundColor() — setRawMode(false) restores
121125
// the original console mode which re-enables ENABLE_PROCESSED_INPUT.
@@ -146,9 +150,10 @@ export function tui(input: {
146150
events={input.events}
147151
>
148152
<SyncProvider>
149-
<ThemeProvider mode={mode}>
150-
<LocalProvider>
151-
<KeybindProvider>
153+
<TuiConfigProvider config={tuiConfig}>
154+
<ThemeProvider mode={mode}>
155+
<LocalProvider>
156+
<KeybindProvider>
152157
<PromptStashProvider>
153158
<DialogProvider>
154159
<CommandProvider>
@@ -164,7 +169,8 @@ export function tui(input: {
164169
</PromptStashProvider>
165170
</KeybindProvider>
166171
</LocalProvider>
167-
</ThemeProvider>
172+
</ThemeProvider>
173+
</TuiConfigProvider>
168174
</SyncProvider>
169175
</SDKProvider>
170176
</RouteProvider>

packages/opencode/src/cli/cmd/tui/component/dialog-status.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function DialogStatus() {
7979
<Match when={item.status === "failed" && item}>{(val) => val().error}</Match>
8080
<Match when={item.status === "disabled"}>Disabled in configuration</Match>
8181
<Match when={(item.status as string) === "needs_auth"}>
82-
Needs authentication (run: opencode mcp auth {key})
82+
Needs authentication (run: altimate mcp auth {key})
8383
</Match>
8484
<Match when={(item.status as string) === "needs_client_registration" && item}>
8585
{(val) => (val() as { error: string }).error}

packages/opencode/src/cli/cmd/tui/component/logo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ export function Logo() {
7575
<For each={logo.left}>
7676
{(line, index) => (
7777
<box flexDirection="row" gap={1}>
78-
<box flexDirection="row">{renderLine(line, theme.textMuted, false)}</box>
79-
<box flexDirection="row">{renderLine(logo.right[index()], theme.text, true)}</box>
78+
<box flexDirection="row">{renderLine(line, theme.primary, false)}</box>
79+
<box flexDirection="row">{renderLine(logo.right[index()], theme.accent, true)}</box>
8080
</box>
8181
)}
8282
</For>

0 commit comments

Comments
 (0)