mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
feat(ocm-cli): add remote indicator to TUI when attached to Manager (#313)
* feat(ocm-cli): add remote indicator to TUI when attached to Manager * chore(ocm-cli): bump version to 0.2.3 * feat(ocm-cli): show remote indicator on home screen and session prompt * feat(ocm-cli): remove arrow icon from remote indicator * docs: remove arrow icon from remote indicator description
This commit is contained in:
1 parent
7c7e9f3c77
commit
ed02ddabba
13 files changed
+1435
-37
No files matched your search
@@ -0,0 +1,30 @@
|
||||
export const REMOTE_MANAGER_URL_ENV = 'OCM_REMOTE_MANAGER_URL'
|
||||
export const REMOTE_REPO_NAME_ENV = 'OCM_REMOTE_REPO_NAME'
|
||||
|
||||
export type RemoteContext = {
|
||||
managerHost: string
|
||||
repoName?: string
|
||||
}
|
||||
|
||||
export function buildRemoteAttachEnv(managerUrl: string, repoName: string): Record<string, string> {
|
||||
return {
|
||||
[REMOTE_MANAGER_URL_ENV]: managerUrl,
|
||||
[REMOTE_REPO_NAME_ENV]: repoName,
|
||||
}
|
||||
}
|
||||
|
||||
export function readRemoteContext(env: NodeJS.ProcessEnv): RemoteContext | undefined {
|
||||
const urlValue = env[REMOTE_MANAGER_URL_ENV]
|
||||
if (!urlValue) return undefined
|
||||
|
||||
let managerHost: string
|
||||
try {
|
||||
managerHost = new URL(urlValue).host
|
||||
} catch {
|
||||
managerHost = urlValue.trim()
|
||||
}
|
||||
|
||||
const repoName = env[REMOTE_REPO_NAME_ENV] || undefined
|
||||
|
||||
return { managerHost, repoName }
|
||||
}
|
||||
Reference in new issue
Block a user