Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions apps/server/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ let managedOpencode: ManagedOpencodeServer | null = null;

if (!config.readOnly) {
for (const workspace of config.workspaces) {
if (workspace.workspaceType === "remote") {
continue;
}
await ensureWorkspaceFiles(workspace.path, workspace.preset ?? "starter");
}
}

if (!config.opencodeBaseUrl && process.env.OPENWORK_MANAGE_OPENCODE === "1") {
const workspace = config.workspaces[0];
if (workspace?.path) {
const localWorkspace = config.workspaces.find((w) => w.workspaceType !== "remote" && w.path);
const managedOpencodeCwd = process.env.OPENWORK_MANAGED_OPENCODE_CWD?.trim() || localWorkspace?.path;
if (managedOpencodeCwd) {
const openworkRuntimeConfig = buildOpenworkRuntimeConfig();
const managedOpencodeCwd = process.env.OPENWORK_MANAGED_OPENCODE_CWD?.trim() || workspace.path;
await mkdir(managedOpencodeCwd, { recursive: true });
managedOpencode = await createManagedOpencodeServer({
bin: process.env.OPENWORK_OPENCODE_BIN,
Expand Down
13 changes: 8 additions & 5 deletions apps/server/src/embedded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,20 @@ export async function startEmbeddedServer(options: EmbeddedServerOptions): Promi

if (!config.readOnly) {
for (const workspace of config.workspaces) {
if (workspace.workspaceType === "remote") {
continue;
}
await ensureWorkspaceFiles(workspace.path, workspace.preset ?? "starter");
}
}

if (!config.opencodeBaseUrl && options.manageOpencode) {
const workspace = config.workspaces[0];
if (workspace?.path) {
const localWorkspace = config.workspaces.find((w) => w.workspaceType !== "remote" && w.path);
const cwd = options.opencodeCwd
|| process.env.OPENWORK_MANAGED_OPENCODE_CWD?.trim()
|| localWorkspace?.path;
if (cwd) {
const openworkRuntimeConfig = buildOpenworkRuntimeConfig();
const cwd = options.opencodeCwd
|| process.env.OPENWORK_MANAGED_OPENCODE_CWD?.trim()
|| workspace.path;
await mkdir(cwd, { recursive: true });

managedOpencode = await createManagedOpencodeServer({
Expand Down