mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +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,46 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import {
|
||||
REMOTE_MANAGER_URL_ENV,
|
||||
buildRemoteAttachEnv,
|
||||
readRemoteContext,
|
||||
} from '../src/remote-context.js'
|
||||
|
||||
describe('buildRemoteAttachEnv', () => {
|
||||
it('round-trips through readRemoteContext', () => {
|
||||
const env = buildRemoteAttachEnv('https://mgr.example.com', 'oc-manager')
|
||||
const result = readRemoteContext(env)
|
||||
|
||||
expect(result).toEqual({ managerHost: 'mgr.example.com', repoName: 'oc-manager' })
|
||||
})
|
||||
})
|
||||
|
||||
describe('readRemoteContext', () => {
|
||||
it('returns undefined when env has no remote vars', () => {
|
||||
expect(readRemoteContext({})).toBeUndefined()
|
||||
})
|
||||
|
||||
it('returns undefined when URL is empty string', () => {
|
||||
expect(readRemoteContext({ [REMOTE_MANAGER_URL_ENV]: '' })).toBeUndefined()
|
||||
})
|
||||
|
||||
it('preserves port in managerHost', () => {
|
||||
const env = { [REMOTE_MANAGER_URL_ENV]: 'https://mgr.example.com:8443/base' }
|
||||
const result = readRemoteContext(env)
|
||||
|
||||
expect(result?.managerHost).toBe('mgr.example.com:8443')
|
||||
})
|
||||
|
||||
it('falls back to raw trimmed value for invalid URLs', () => {
|
||||
const env = { [REMOTE_MANAGER_URL_ENV]: 'not a url' }
|
||||
const result = readRemoteContext(env)
|
||||
|
||||
expect(result?.managerHost).toBe('not a url')
|
||||
})
|
||||
|
||||
it('returns undefined repoName when only URL var is set', () => {
|
||||
const env = { [REMOTE_MANAGER_URL_ENV]: 'https://mgr.example.com' }
|
||||
const result = readRemoteContext(env)
|
||||
|
||||
expect(result?.repoName).toBeUndefined()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user