mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
refactor(sandbox): pin shell shim to sandbox agent bash without rewriting commands
This commit is contained in:
1 parent
681181ef4c
commit
098816f7cc
14 files changed
+1041
-1357
No files matched your search
@@ -2,15 +2,16 @@ import { join } from 'path'
|
||||
import { writeFileAtomic } from '../../utils/fs-safe'
|
||||
import { buildGhEnvPluginSource } from '../opencode-gh-env-plugin'
|
||||
import { buildSandboxPluginSource } from '../opencode-sandbox-plugin'
|
||||
import { ensureSandboxShellShim } from '../sandbox/shell-shim'
|
||||
|
||||
type ManagedOpenCodePlugin = {
|
||||
filename: string
|
||||
buildSource: () => string
|
||||
buildSource: (context: { shellShimPath: string }) => string
|
||||
}
|
||||
|
||||
const MANAGED_OPENCODE_PLUGINS: readonly ManagedOpenCodePlugin[] = [
|
||||
{ filename: 'ocm-gh-env.js', buildSource: buildGhEnvPluginSource },
|
||||
{ filename: 'ocm-sandbox.js', buildSource: buildSandboxPluginSource },
|
||||
{ filename: 'ocm-gh-env.js', buildSource: () => buildGhEnvPluginSource() },
|
||||
{ filename: 'ocm-sandbox.js', buildSource: ({ shellShimPath }) => buildSandboxPluginSource(shellShimPath) },
|
||||
]
|
||||
|
||||
export function getOpenCodePluginDir(configHome: string): string {
|
||||
@@ -18,8 +19,9 @@ export function getOpenCodePluginDir(configHome: string): string {
|
||||
}
|
||||
|
||||
export async function installManagedPlugins(configHome: string): Promise<void> {
|
||||
const shellShimPath = await ensureSandboxShellShim(configHome)
|
||||
const dir = getOpenCodePluginDir(configHome)
|
||||
for (const plugin of MANAGED_OPENCODE_PLUGINS) {
|
||||
await writeFileAtomic(join(dir, plugin.filename), plugin.buildSource())
|
||||
await writeFileAtomic(join(dir, plugin.filename), plugin.buildSource({ shellShimPath }))
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user