Merge forge/terminal-dev-loop into beta

feat: integrated terminal, project actions and dev server preview (OM-17, OM-18, OM-19)

Integration with #380 and #379:
- Adopt the git-config identity model: drop the branch's identity stubs
  (getShellEnv, getAssignedGitIdentityEnv, repo identity ids, duplicate
  createGitService and getMainCheckoutPath); terminals receive only the
  GitHub token env and take their commit identity from git config.
- Add RepoWorkspaceService as the single owner of OpenCode workspace
  side effects: worktree setup commands on create and terminal cleanup on
  remove, used by the workspace routes, the session launcher (ocm tool and
  multi-run) and multi-run discard, with one worktree-sibling matcher.
- Run repo-delete terminal cleanup inside the worktree branch deletion
  flow.
- Combine the CreateWorktreeDialog tests and update docs for the identity
  model and setup command coverage.
This commit is contained in:
Chris Scott committed 2026-10-03 23:50:10 -04:00
commit b13707b5b3
135 files changed
+12726 -492

No files matched your search

+1
View File
@@ -2,3 +2,4 @@ export * from './jsonc'
export * from './repo'
export * from './sandbox-command'
export * from './semver'
export * from './terminal-title'
+59
View File
@@ -0,0 +1,59 @@
import type { TerminalInfo, TerminalKind } from '../schemas/terminal'
const ACTION_TITLE_PREFIX = 'ocm:action:'
const SETUP_TITLE_PREFIX = 'ocm:setup:'
const ACTION_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/
export interface FormatTerminalTitleInput {
kind: TerminalKind
name: string
actionId?: string
}
export interface ParsedTerminalTitle {
kind: TerminalKind
title: string
actionId?: string
}
export function formatTerminalTitle(input: FormatTerminalTitleInput): string {
if (input.kind === 'action') {
if (!input.actionId || !ACTION_ID_PATTERN.test(input.actionId)) {
throw new Error('Action terminals require a valid action id')
}
return `${ACTION_TITLE_PREFIX}${input.actionId}:${input.name}`
}
if (input.kind === 'setup') {
return `${SETUP_TITLE_PREFIX}${input.name}`
}
return input.name
}
export type RunningActionTerminal = Pick<TerminalInfo, 'kind' | 'actionId' | 'status'>
export function isRunningActionTerminal(terminal: RunningActionTerminal, actionId: string): boolean {
return terminal.kind === 'action' && terminal.actionId === actionId && terminal.status === 'running'
}
export function parseTerminalTitle(raw: string): ParsedTerminalTitle {
if (raw.startsWith(ACTION_TITLE_PREFIX)) {
const rest = raw.slice(ACTION_TITLE_PREFIX.length)
const separator = rest.indexOf(':')
const actionId = separator === -1 ? rest : rest.slice(0, separator)
const title = separator === -1 ? '' : rest.slice(separator + 1)
if (ACTION_ID_PATTERN.test(actionId) && title.length > 0) {
return { kind: 'action', title, actionId }
}
return { kind: 'shell', title: raw }
}
if (raw.startsWith(SETUP_TITLE_PREFIX)) {
return { kind: 'setup', title: raw.slice(SETUP_TITLE_PREFIX.length) }
}
return { kind: 'shell', title: raw }
}