mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
feat(worktree): worktree tabs, server env vars, and multi-directory SSE (#240)
* loop: worktree-tabs-2 completed after 4 iterations * loop: server-env-vars completed after 7 iterations * feat(worktree): add worktree tabs and server env vars settings * refactor(worktree): multi-directory SSE support and workspace chip row * feat(workspace): collapsible workspace manager and sibling filtering * feat(workspace): workspace creation endpoint, refactored workspace manager, and tests * refactor(frontend): unify workspace label and remove dead code - extract shared workspaceLabel helper into api/repos and reuse in WorkspaceManager and RepoDetail directoryLabels - remove unused useSessions hook and subscribeToDirectory subscription - drop redundant frontend workspace dedup now guaranteed by backend - align WorktreeTabs empty-state test with create-workspace button
This commit is contained in:
1 parent
60ed756a0b
commit
b9236f7f20
38 files changed
+2423
-133
No files matched your search
@@ -15,6 +15,7 @@ import {
|
||||
parseSSHHost
|
||||
} from '../utils/ssh-key-manager'
|
||||
import { decryptSecret } from '../utils/crypto'
|
||||
import { BLOCKED_SERVER_ENV_KEYS, DEFAULT_SERVER_ENV_VARS } from '@opencode-manager/shared'
|
||||
import { SettingsService } from './settings'
|
||||
import { getWorkspacePath, getOpenCodeConfigFilePath, ENV } from '@opencode-manager/shared/config/env'
|
||||
import { parseJsonc } from '@opencode-manager/shared/utils'
|
||||
@@ -199,11 +200,28 @@ class OpenCodeServerManager {
|
||||
|
||||
let gitCredentials: GitCredential[] = []
|
||||
let gitIdentityEnv: Record<string, string> = {}
|
||||
let userEnvVars: Record<string, string> = {}
|
||||
if (this.db) {
|
||||
try {
|
||||
const settingsService = new SettingsService(this.db)
|
||||
const settings = settingsService.getSettings('default')
|
||||
gitCredentials = settings.preferences.gitCredentials || []
|
||||
const disabledDefaultEnvVars = new Set(settings.preferences.disabledDefaultServerEnvVars || [])
|
||||
const rawEnvVars = [
|
||||
...DEFAULT_SERVER_ENV_VARS.filter((envVar) => !disabledDefaultEnvVars.has(envVar.key)),
|
||||
...(settings.preferences.serverEnvVars || []),
|
||||
]
|
||||
if (rawEnvVars.length > 0) {
|
||||
userEnvVars = Object.fromEntries(
|
||||
rawEnvVars
|
||||
.filter(({ key }) => {
|
||||
const normalizedKey = key.trim()
|
||||
return normalizedKey !== '' && !(BLOCKED_SERVER_ENV_KEYS as readonly string[]).includes(normalizedKey)
|
||||
})
|
||||
.map(({ key, value }) => [key.trim(), value])
|
||||
)
|
||||
logger.info(`Injecting ${Object.keys(userEnvVars).length} custom server env vars`)
|
||||
}
|
||||
|
||||
const identity = await resolveGitIdentity(settings.preferences.gitIdentity, gitCredentials)
|
||||
if (identity) {
|
||||
@@ -327,6 +345,7 @@ class OpenCodeServerManager {
|
||||
stdio: isDevelopment ? 'inherit' : ['ignore', 'pipe', 'pipe'],
|
||||
env: {
|
||||
...cleanEnv,
|
||||
...userEnvVars,
|
||||
...gitEnv,
|
||||
...gitIdentityEnv,
|
||||
GIT_SSH_COMMAND: gitSshCommand,
|
||||
|
||||
Reference in new issue
Block a user