Redesign project codebase configuration
This commit is contained in:
@@ -108,6 +108,8 @@ export type {
|
|||||||
AdapterEnvironmentTestResult,
|
AdapterEnvironmentTestResult,
|
||||||
AssetImage,
|
AssetImage,
|
||||||
Project,
|
Project,
|
||||||
|
ProjectCodebase,
|
||||||
|
ProjectCodebaseOrigin,
|
||||||
ProjectGoalRef,
|
ProjectGoalRef,
|
||||||
ProjectWorkspace,
|
ProjectWorkspace,
|
||||||
ExecutionWorkspace,
|
ExecutionWorkspace,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export type {
|
|||||||
AdapterEnvironmentTestResult,
|
AdapterEnvironmentTestResult,
|
||||||
} from "./agent.js";
|
} from "./agent.js";
|
||||||
export type { AssetImage } from "./asset.js";
|
export type { AssetImage } from "./asset.js";
|
||||||
export type { Project, ProjectGoalRef, ProjectWorkspace } from "./project.js";
|
export type { Project, ProjectCodebase, ProjectCodebaseOrigin, ProjectGoalRef, ProjectWorkspace } from "./project.js";
|
||||||
export type {
|
export type {
|
||||||
ExecutionWorkspace,
|
ExecutionWorkspace,
|
||||||
WorkspaceRuntimeService,
|
WorkspaceRuntimeService,
|
||||||
|
|||||||
@@ -32,6 +32,20 @@ export interface ProjectWorkspace {
|
|||||||
updatedAt: Date;
|
updatedAt: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ProjectCodebaseOrigin = "local_folder" | "managed_checkout";
|
||||||
|
|
||||||
|
export interface ProjectCodebase {
|
||||||
|
workspaceId: string | null;
|
||||||
|
repoUrl: string | null;
|
||||||
|
repoRef: string | null;
|
||||||
|
defaultRef: string | null;
|
||||||
|
repoName: string | null;
|
||||||
|
localFolder: string | null;
|
||||||
|
managedFolder: string;
|
||||||
|
effectiveLocalFolder: string;
|
||||||
|
origin: ProjectCodebaseOrigin;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Project {
|
export interface Project {
|
||||||
id: string;
|
id: string;
|
||||||
companyId: string;
|
companyId: string;
|
||||||
@@ -47,6 +61,7 @@ export interface Project {
|
|||||||
targetDate: string | null;
|
targetDate: string | null;
|
||||||
color: string | null;
|
color: string | null;
|
||||||
executionWorkspacePolicy: ProjectExecutionWorkspacePolicy | null;
|
executionWorkspacePolicy: ProjectExecutionWorkspacePolicy | null;
|
||||||
|
codebase: ProjectCodebase;
|
||||||
workspaces: ProjectWorkspace[];
|
workspaces: ProjectWorkspace[];
|
||||||
primaryWorkspace: ProjectWorkspace | null;
|
primaryWorkspace: ProjectWorkspace | null;
|
||||||
archivedAt: Date | null;
|
archivedAt: Date | null;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import path from "node:path";
|
|||||||
const DEFAULT_INSTANCE_ID = "default";
|
const DEFAULT_INSTANCE_ID = "default";
|
||||||
const INSTANCE_ID_RE = /^[a-zA-Z0-9_-]+$/;
|
const INSTANCE_ID_RE = /^[a-zA-Z0-9_-]+$/;
|
||||||
const PATH_SEGMENT_RE = /^[a-zA-Z0-9_-]+$/;
|
const PATH_SEGMENT_RE = /^[a-zA-Z0-9_-]+$/;
|
||||||
|
const FRIENDLY_PATH_SEGMENT_RE = /[^a-zA-Z0-9._-]+/g;
|
||||||
|
|
||||||
function expandHomePrefix(value: string): string {
|
function expandHomePrefix(value: string): string {
|
||||||
if (value === "~") return os.homedir();
|
if (value === "~") return os.homedir();
|
||||||
@@ -61,6 +62,34 @@ export function resolveDefaultAgentWorkspaceDir(agentId: string): string {
|
|||||||
return path.resolve(resolvePaperclipInstanceRoot(), "workspaces", trimmed);
|
return path.resolve(resolvePaperclipInstanceRoot(), "workspaces", trimmed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sanitizeFriendlyPathSegment(value: string | null | undefined, fallback = "_default"): string {
|
||||||
|
const trimmed = value?.trim() ?? "";
|
||||||
|
if (!trimmed) return fallback;
|
||||||
|
const sanitized = trimmed
|
||||||
|
.replace(FRIENDLY_PATH_SEGMENT_RE, "-")
|
||||||
|
.replace(/^-+|-+$/g, "");
|
||||||
|
return sanitized || fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolveManagedProjectWorkspaceDir(input: {
|
||||||
|
companyId: string;
|
||||||
|
projectId: string;
|
||||||
|
repoName?: string | null;
|
||||||
|
}): string {
|
||||||
|
const companyId = input.companyId.trim();
|
||||||
|
const projectId = input.projectId.trim();
|
||||||
|
if (!companyId || !projectId) {
|
||||||
|
throw new Error("Managed project workspace path requires companyId and projectId.");
|
||||||
|
}
|
||||||
|
return path.resolve(
|
||||||
|
resolvePaperclipInstanceRoot(),
|
||||||
|
"projects",
|
||||||
|
sanitizeFriendlyPathSegment(companyId, "company"),
|
||||||
|
sanitizeFriendlyPathSegment(projectId, "project"),
|
||||||
|
sanitizeFriendlyPathSegment(input.repoName, "_default"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function resolveHomeAwarePath(value: string): string {
|
export function resolveHomeAwarePath(value: string): string {
|
||||||
return path.resolve(expandHomePrefix(value));
|
return path.resolve(expandHomePrefix(value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import { execFile as execFileCallback } from "node:child_process";
|
||||||
|
import { promisify } from "node:util";
|
||||||
import { and, asc, desc, eq, gt, inArray, sql } from "drizzle-orm";
|
import { and, asc, desc, eq, gt, inArray, sql } from "drizzle-orm";
|
||||||
import type { Db } from "@paperclipai/db";
|
import type { Db } from "@paperclipai/db";
|
||||||
import {
|
import {
|
||||||
@@ -23,7 +25,7 @@ import { createLocalAgentJwt } from "../agent-auth-jwt.js";
|
|||||||
import { parseObject, asBoolean, asNumber, appendWithCap, MAX_EXCERPT_BYTES } from "../adapters/utils.js";
|
import { parseObject, asBoolean, asNumber, appendWithCap, MAX_EXCERPT_BYTES } from "../adapters/utils.js";
|
||||||
import { costService } from "./costs.js";
|
import { costService } from "./costs.js";
|
||||||
import { secretService } from "./secrets.js";
|
import { secretService } from "./secrets.js";
|
||||||
import { resolveDefaultAgentWorkspaceDir } from "../home-paths.js";
|
import { resolveDefaultAgentWorkspaceDir, resolveManagedProjectWorkspaceDir } from "../home-paths.js";
|
||||||
import { summarizeHeartbeatRunResultJson } from "./heartbeat-run-summary.js";
|
import { summarizeHeartbeatRunResultJson } from "./heartbeat-run-summary.js";
|
||||||
import {
|
import {
|
||||||
buildWorkspaceReadyComment,
|
buildWorkspaceReadyComment,
|
||||||
@@ -48,6 +50,7 @@ const HEARTBEAT_MAX_CONCURRENT_RUNS_MAX = 10;
|
|||||||
const DEFERRED_WAKE_CONTEXT_KEY = "_paperclipWakeContext";
|
const DEFERRED_WAKE_CONTEXT_KEY = "_paperclipWakeContext";
|
||||||
const startLocksByAgent = new Map<string, Promise<void>>();
|
const startLocksByAgent = new Map<string, Promise<void>>();
|
||||||
const REPO_ONLY_CWD_SENTINEL = "/__paperclip_repo_only__";
|
const REPO_ONLY_CWD_SENTINEL = "/__paperclip_repo_only__";
|
||||||
|
const execFile = promisify(execFileCallback);
|
||||||
const SESSIONED_LOCAL_ADAPTERS = new Set([
|
const SESSIONED_LOCAL_ADAPTERS = new Set([
|
||||||
"claude_local",
|
"claude_local",
|
||||||
"codex_local",
|
"codex_local",
|
||||||
@@ -57,6 +60,69 @@ const SESSIONED_LOCAL_ADAPTERS = new Set([
|
|||||||
"pi_local",
|
"pi_local",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
function deriveRepoNameFromRepoUrl(repoUrl: string | null): string | null {
|
||||||
|
const trimmed = repoUrl?.trim() ?? "";
|
||||||
|
if (!trimmed) return null;
|
||||||
|
try {
|
||||||
|
const parsed = new URL(trimmed);
|
||||||
|
const cleanedPath = parsed.pathname.replace(/\/+$/, "");
|
||||||
|
const repoName = cleanedPath.split("/").filter(Boolean).pop()?.replace(/\.git$/i, "") ?? "";
|
||||||
|
return repoName || null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function ensureManagedProjectWorkspace(input: {
|
||||||
|
companyId: string;
|
||||||
|
projectId: string;
|
||||||
|
repoUrl: string | null;
|
||||||
|
}): Promise<{ cwd: string; warning: string | null }> {
|
||||||
|
const cwd = resolveManagedProjectWorkspaceDir({
|
||||||
|
companyId: input.companyId,
|
||||||
|
projectId: input.projectId,
|
||||||
|
repoName: deriveRepoNameFromRepoUrl(input.repoUrl),
|
||||||
|
});
|
||||||
|
await fs.mkdir(path.dirname(cwd), { recursive: true });
|
||||||
|
const stats = await fs.stat(cwd).catch(() => null);
|
||||||
|
|
||||||
|
if (!input.repoUrl) {
|
||||||
|
if (!stats) {
|
||||||
|
await fs.mkdir(cwd, { recursive: true });
|
||||||
|
}
|
||||||
|
return { cwd, warning: null };
|
||||||
|
}
|
||||||
|
|
||||||
|
const gitDirExists = await fs
|
||||||
|
.stat(path.resolve(cwd, ".git"))
|
||||||
|
.then((entry) => entry.isDirectory())
|
||||||
|
.catch(() => false);
|
||||||
|
if (gitDirExists) {
|
||||||
|
return { cwd, warning: null };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats) {
|
||||||
|
const entries = await fs.readdir(cwd).catch(() => []);
|
||||||
|
if (entries.length > 0) {
|
||||||
|
return {
|
||||||
|
cwd,
|
||||||
|
warning: `Managed workspace path "${cwd}" already exists but is not a git checkout. Using it as-is.`,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
await fs.rm(cwd, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await execFile("git", ["clone", input.repoUrl, cwd], {
|
||||||
|
env: process.env,
|
||||||
|
});
|
||||||
|
return { cwd, warning: null };
|
||||||
|
} catch (error) {
|
||||||
|
const reason = error instanceof Error ? error.message : String(error);
|
||||||
|
throw new Error(`Failed to prepare managed checkout for "${input.repoUrl}" at "${cwd}": ${reason}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const heartbeatRunListColumns = {
|
const heartbeatRunListColumns = {
|
||||||
id: heartbeatRuns.id,
|
id: heartbeatRuns.id,
|
||||||
companyId: heartbeatRuns.companyId,
|
companyId: heartbeatRuns.companyId,
|
||||||
@@ -876,13 +942,24 @@ export function heartbeatService(db: Db) {
|
|||||||
`Selected project workspace "${preferredProjectWorkspaceId}" is not available on this project.`;
|
`Selected project workspace "${preferredProjectWorkspaceId}" is not available on this project.`;
|
||||||
}
|
}
|
||||||
for (const workspace of projectWorkspaceRows) {
|
for (const workspace of projectWorkspaceRows) {
|
||||||
const projectCwd = readNonEmptyString(workspace.cwd);
|
let projectCwd = readNonEmptyString(workspace.cwd);
|
||||||
|
let managedWorkspaceWarning: string | null = null;
|
||||||
if (!projectCwd || projectCwd === REPO_ONLY_CWD_SENTINEL) {
|
if (!projectCwd || projectCwd === REPO_ONLY_CWD_SENTINEL) {
|
||||||
|
try {
|
||||||
|
const managedWorkspace = await ensureManagedProjectWorkspace({
|
||||||
|
companyId: agent.companyId,
|
||||||
|
projectId: workspaceProjectId ?? resolvedProjectId ?? workspace.projectId,
|
||||||
|
repoUrl: readNonEmptyString(workspace.repoUrl),
|
||||||
|
});
|
||||||
|
projectCwd = managedWorkspace.cwd;
|
||||||
|
managedWorkspaceWarning = managedWorkspace.warning;
|
||||||
|
} catch (error) {
|
||||||
if (preferredWorkspace?.id === workspace.id) {
|
if (preferredWorkspace?.id === workspace.id) {
|
||||||
preferredWorkspaceWarning = `Selected project workspace "${workspace.name}" has no local cwd configured.`;
|
preferredWorkspaceWarning = error instanceof Error ? error.message : String(error);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
hasConfiguredProjectCwd = true;
|
hasConfiguredProjectCwd = true;
|
||||||
const projectCwdExists = await fs
|
const projectCwdExists = await fs
|
||||||
.stat(projectCwd)
|
.stat(projectCwd)
|
||||||
@@ -897,7 +974,9 @@ export function heartbeatService(db: Db) {
|
|||||||
repoUrl: workspace.repoUrl,
|
repoUrl: workspace.repoUrl,
|
||||||
repoRef: workspace.repoRef,
|
repoRef: workspace.repoRef,
|
||||||
workspaceHints,
|
workspaceHints,
|
||||||
warnings: preferredWorkspaceWarning ? [preferredWorkspaceWarning] : [],
|
warnings: [preferredWorkspaceWarning, managedWorkspaceWarning].filter(
|
||||||
|
(value): value is string => Boolean(value),
|
||||||
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (preferredWorkspace?.id === workspace.id) {
|
if (preferredWorkspace?.id === workspace.id) {
|
||||||
@@ -938,6 +1017,24 @@ export function heartbeatService(db: Db) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (workspaceProjectId) {
|
||||||
|
const managedWorkspace = await ensureManagedProjectWorkspace({
|
||||||
|
companyId: agent.companyId,
|
||||||
|
projectId: workspaceProjectId,
|
||||||
|
repoUrl: null,
|
||||||
|
});
|
||||||
|
return {
|
||||||
|
cwd: managedWorkspace.cwd,
|
||||||
|
source: "project_primary" as const,
|
||||||
|
projectId: resolvedProjectId,
|
||||||
|
workspaceId: null,
|
||||||
|
repoUrl: null,
|
||||||
|
repoRef: null,
|
||||||
|
workspaceHints,
|
||||||
|
warnings: managedWorkspace.warning ? [managedWorkspace.warning] : [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const sessionCwd = readNonEmptyString(previousSessionParams?.cwd);
|
const sessionCwd = readNonEmptyString(previousSessionParams?.cwd);
|
||||||
if (sessionCwd) {
|
if (sessionCwd) {
|
||||||
const sessionCwdExists = await fs
|
const sessionCwdExists = await fs
|
||||||
|
|||||||
@@ -704,17 +704,16 @@ export function buildHostServices(
|
|||||||
const project = await projects.getById(params.projectId);
|
const project = await projects.getById(params.projectId);
|
||||||
if (!inCompany(project, companyId)) return null;
|
if (!inCompany(project, companyId)) return null;
|
||||||
const row = project.primaryWorkspace;
|
const row = project.primaryWorkspace;
|
||||||
if (!row) return null;
|
const path = sanitizeWorkspacePath(project.codebase.effectiveLocalFolder);
|
||||||
const path = sanitizeWorkspacePath(row.cwd);
|
const name = sanitizeWorkspaceName(row?.name ?? project.name, path);
|
||||||
const name = sanitizeWorkspaceName(row.name, path);
|
|
||||||
return {
|
return {
|
||||||
id: row.id,
|
id: row?.id ?? `${project.id}:managed`,
|
||||||
projectId: row.projectId,
|
projectId: project.id,
|
||||||
name,
|
name,
|
||||||
path,
|
path,
|
||||||
isPrimary: row.isPrimary,
|
isPrimary: true,
|
||||||
createdAt: row.createdAt.toISOString(),
|
createdAt: (row?.createdAt ?? project.createdAt).toISOString(),
|
||||||
updatedAt: row.updatedAt.toISOString(),
|
updatedAt: (row?.updatedAt ?? project.updatedAt).toISOString(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -728,17 +727,16 @@ export function buildHostServices(
|
|||||||
const project = await projects.getById(projectId);
|
const project = await projects.getById(projectId);
|
||||||
if (!inCompany(project, companyId)) return null;
|
if (!inCompany(project, companyId)) return null;
|
||||||
const row = project.primaryWorkspace;
|
const row = project.primaryWorkspace;
|
||||||
if (!row) return null;
|
const path = sanitizeWorkspacePath(project.codebase.effectiveLocalFolder);
|
||||||
const path = sanitizeWorkspacePath(row.cwd);
|
const name = sanitizeWorkspaceName(row?.name ?? project.name, path);
|
||||||
const name = sanitizeWorkspaceName(row.name, path);
|
|
||||||
return {
|
return {
|
||||||
id: row.id,
|
id: row?.id ?? `${project.id}:managed`,
|
||||||
projectId: row.projectId,
|
projectId: project.id,
|
||||||
name,
|
name,
|
||||||
path,
|
path,
|
||||||
isPrimary: row.isPrimary,
|
isPrimary: true,
|
||||||
createdAt: row.createdAt.toISOString(),
|
createdAt: (row?.createdAt ?? project.createdAt).toISOString(),
|
||||||
updatedAt: row.updatedAt.toISOString(),
|
updatedAt: (row?.updatedAt ?? project.updatedAt).toISOString(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
deriveProjectUrlKey,
|
deriveProjectUrlKey,
|
||||||
isUuidLike,
|
isUuidLike,
|
||||||
normalizeProjectUrlKey,
|
normalizeProjectUrlKey,
|
||||||
|
type ProjectCodebase,
|
||||||
type ProjectExecutionWorkspacePolicy,
|
type ProjectExecutionWorkspacePolicy,
|
||||||
type ProjectGoalRef,
|
type ProjectGoalRef,
|
||||||
type ProjectWorkspace,
|
type ProjectWorkspace,
|
||||||
@@ -13,6 +14,7 @@ import {
|
|||||||
} from "@paperclipai/shared";
|
} from "@paperclipai/shared";
|
||||||
import { listWorkspaceRuntimeServicesForProjectWorkspaces } from "./workspace-runtime.js";
|
import { listWorkspaceRuntimeServicesForProjectWorkspaces } from "./workspace-runtime.js";
|
||||||
import { parseProjectExecutionWorkspacePolicy } from "./execution-workspace-policy.js";
|
import { parseProjectExecutionWorkspacePolicy } from "./execution-workspace-policy.js";
|
||||||
|
import { resolveManagedProjectWorkspaceDir } from "../home-paths.js";
|
||||||
|
|
||||||
type ProjectRow = typeof projects.$inferSelect;
|
type ProjectRow = typeof projects.$inferSelect;
|
||||||
type ProjectWorkspaceRow = typeof projectWorkspaces.$inferSelect;
|
type ProjectWorkspaceRow = typeof projectWorkspaces.$inferSelect;
|
||||||
@@ -41,6 +43,7 @@ interface ProjectWithGoals extends Omit<ProjectRow, "executionWorkspacePolicy">
|
|||||||
goalIds: string[];
|
goalIds: string[];
|
||||||
goals: ProjectGoalRef[];
|
goals: ProjectGoalRef[];
|
||||||
executionWorkspacePolicy: ProjectExecutionWorkspacePolicy | null;
|
executionWorkspacePolicy: ProjectExecutionWorkspacePolicy | null;
|
||||||
|
codebase: ProjectCodebase;
|
||||||
workspaces: ProjectWorkspace[];
|
workspaces: ProjectWorkspace[];
|
||||||
primaryWorkspace: ProjectWorkspace | null;
|
primaryWorkspace: ProjectWorkspace | null;
|
||||||
}
|
}
|
||||||
@@ -135,7 +138,7 @@ function toWorkspace(
|
|||||||
projectId: row.projectId,
|
projectId: row.projectId,
|
||||||
name: row.name,
|
name: row.name,
|
||||||
sourceType: row.sourceType as ProjectWorkspace["sourceType"],
|
sourceType: row.sourceType as ProjectWorkspace["sourceType"],
|
||||||
cwd: row.cwd,
|
cwd: normalizeWorkspaceCwd(row.cwd),
|
||||||
repoUrl: row.repoUrl ?? null,
|
repoUrl: row.repoUrl ?? null,
|
||||||
repoRef: row.repoRef ?? null,
|
repoRef: row.repoRef ?? null,
|
||||||
defaultRef: row.defaultRef ?? row.repoRef ?? null,
|
defaultRef: row.defaultRef ?? row.repoRef ?? null,
|
||||||
@@ -153,6 +156,48 @@ function toWorkspace(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deriveRepoNameFromRepoUrl(repoUrl: string | null): string | null {
|
||||||
|
const raw = readNonEmptyString(repoUrl);
|
||||||
|
if (!raw) return null;
|
||||||
|
try {
|
||||||
|
const parsed = new URL(raw);
|
||||||
|
const cleanedPath = parsed.pathname.replace(/\/+$/, "");
|
||||||
|
const repoName = cleanedPath.split("/").filter(Boolean).pop()?.replace(/\.git$/i, "") ?? "";
|
||||||
|
return repoName || null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deriveProjectCodebase(input: {
|
||||||
|
companyId: string;
|
||||||
|
projectId: string;
|
||||||
|
primaryWorkspace: ProjectWorkspace | null;
|
||||||
|
fallbackWorkspaces: ProjectWorkspace[];
|
||||||
|
}): ProjectCodebase {
|
||||||
|
const primaryWorkspace = input.primaryWorkspace ?? input.fallbackWorkspaces[0] ?? null;
|
||||||
|
const repoUrl = primaryWorkspace?.repoUrl ?? null;
|
||||||
|
const repoName = deriveRepoNameFromRepoUrl(repoUrl);
|
||||||
|
const localFolder = primaryWorkspace?.cwd ?? null;
|
||||||
|
const managedFolder = resolveManagedProjectWorkspaceDir({
|
||||||
|
companyId: input.companyId,
|
||||||
|
projectId: input.projectId,
|
||||||
|
repoName,
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
workspaceId: primaryWorkspace?.id ?? null,
|
||||||
|
repoUrl,
|
||||||
|
repoRef: primaryWorkspace?.repoRef ?? null,
|
||||||
|
defaultRef: primaryWorkspace?.defaultRef ?? null,
|
||||||
|
repoName,
|
||||||
|
localFolder,
|
||||||
|
managedFolder,
|
||||||
|
effectiveLocalFolder: localFolder ?? managedFolder,
|
||||||
|
origin: localFolder ? "local_folder" : "managed_checkout",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function pickPrimaryWorkspace(
|
function pickPrimaryWorkspace(
|
||||||
rows: ProjectWorkspaceRow[],
|
rows: ProjectWorkspaceRow[],
|
||||||
runtimeServicesByWorkspaceId?: Map<string, WorkspaceRuntimeService[]>,
|
runtimeServicesByWorkspaceId?: Map<string, WorkspaceRuntimeService[]>,
|
||||||
@@ -203,10 +248,17 @@ async function attachWorkspaces(db: Db, rows: ProjectWithGoals[]): Promise<Proje
|
|||||||
sharedRuntimeServicesByWorkspaceId.get(workspace.id) ?? [],
|
sharedRuntimeServicesByWorkspaceId.get(workspace.id) ?? [],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
const primaryWorkspace = pickPrimaryWorkspace(projectWorkspaceRows, sharedRuntimeServicesByWorkspaceId);
|
||||||
return {
|
return {
|
||||||
...row,
|
...row,
|
||||||
|
codebase: deriveProjectCodebase({
|
||||||
|
companyId: row.companyId,
|
||||||
|
projectId: row.id,
|
||||||
|
primaryWorkspace,
|
||||||
|
fallbackWorkspaces: workspaces,
|
||||||
|
}),
|
||||||
workspaces,
|
workspaces,
|
||||||
primaryWorkspace: pickPrimaryWorkspace(projectWorkspaceRows, sharedRuntimeServicesByWorkspaceId),
|
primaryWorkspace,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ const projectStatuses = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
type WorkspaceSetup = "none" | "local" | "repo" | "both";
|
type WorkspaceSetup = "none" | "local" | "repo" | "both";
|
||||||
const REPO_ONLY_CWD_SENTINEL = "/__paperclip_repo_only__";
|
|
||||||
|
|
||||||
export function NewProjectDialog() {
|
export function NewProjectDialog() {
|
||||||
const { newProjectOpen, closeNewProject } = useDialog();
|
const { newProjectOpen, closeNewProject } = useDialog();
|
||||||
@@ -142,7 +141,7 @@ export function NewProjectDialog() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (repoRequired && !isGitHubRepoUrl(repoUrl)) {
|
if (repoRequired && !isGitHubRepoUrl(repoUrl)) {
|
||||||
setWorkspaceError("Repo workspace must use a valid GitHub repo URL.");
|
setWorkspaceError("Repo must use a valid GitHub repo URL.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +172,6 @@ export function NewProjectDialog() {
|
|||||||
} else if (repoRequired) {
|
} else if (repoRequired) {
|
||||||
workspacePayloads.push({
|
workspacePayloads.push({
|
||||||
name: deriveWorkspaceNameFromRepo(repoUrl),
|
name: deriveWorkspaceNameFromRepo(repoUrl),
|
||||||
cwd: REPO_ONLY_CWD_SENTINEL,
|
|
||||||
repoUrl,
|
repoUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -284,7 +282,7 @@ export function NewProjectDialog() {
|
|||||||
<div className="px-4 pb-3 space-y-3 border-t border-border">
|
<div className="px-4 pb-3 space-y-3 border-t border-border">
|
||||||
<div className="pt-3">
|
<div className="pt-3">
|
||||||
<p className="text-sm font-medium">Where will work be done on this project?</p>
|
<p className="text-sm font-medium">Where will work be done on this project?</p>
|
||||||
<p className="text-xs text-muted-foreground">Add local folder and/or GitHub repo workspace hints.</p>
|
<p className="text-xs text-muted-foreground">Add a repo and/or local folder for this project.</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid gap-2 sm:grid-cols-3">
|
<div className="grid gap-2 sm:grid-cols-3">
|
||||||
<button
|
<button
|
||||||
@@ -311,7 +309,7 @@ export function NewProjectDialog() {
|
|||||||
>
|
>
|
||||||
<div className="flex items-center gap-2 text-sm font-medium">
|
<div className="flex items-center gap-2 text-sm font-medium">
|
||||||
<Github className="h-4 w-4" />
|
<Github className="h-4 w-4" />
|
||||||
A github repo
|
A repo
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 text-xs text-muted-foreground">Paste a GitHub URL.</p>
|
<p className="mt-1 text-xs text-muted-foreground">Paste a GitHub URL.</p>
|
||||||
</button>
|
</button>
|
||||||
@@ -327,7 +325,7 @@ export function NewProjectDialog() {
|
|||||||
<GitBranch className="h-4 w-4" />
|
<GitBranch className="h-4 w-4" />
|
||||||
Both
|
Both
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 text-xs text-muted-foreground">Configure local + repo hints.</p>
|
<p className="mt-1 text-xs text-muted-foreground">Configure both repo and local folder.</p>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -347,7 +345,7 @@ export function NewProjectDialog() {
|
|||||||
)}
|
)}
|
||||||
{(workspaceSetup === "repo" || workspaceSetup === "both") && (
|
{(workspaceSetup === "repo" || workspaceSetup === "both") && (
|
||||||
<div className="rounded-md border border-border p-2">
|
<div className="rounded-md border border-border p-2">
|
||||||
<label className="mb-1 block text-xs text-muted-foreground">GitHub repo URL</label>
|
<label className="mb-1 block text-xs text-muted-foreground">Repo URL</label>
|
||||||
<input
|
<input
|
||||||
className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs outline-none"
|
className="w-full rounded border border-border bg-transparent px-2 py-1 text-xs outline-none"
|
||||||
value={workspaceRepoUrl}
|
value={workspaceRepoUrl}
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ export type ProjectConfigFieldKey =
|
|||||||
| "execution_workspace_provision_command"
|
| "execution_workspace_provision_command"
|
||||||
| "execution_workspace_teardown_command";
|
| "execution_workspace_teardown_command";
|
||||||
|
|
||||||
const REPO_ONLY_CWD_SENTINEL = "/__paperclip_repo_only__";
|
|
||||||
|
|
||||||
function SaveIndicator({ state }: { state: ProjectFieldSaveState }) {
|
function SaveIndicator({ state }: { state: ProjectFieldSaveState }) {
|
||||||
if (state === "saving") {
|
if (state === "saving") {
|
||||||
return (
|
return (
|
||||||
@@ -191,6 +189,9 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
|
|||||||
|
|
||||||
const availableGoals = (allGoals ?? []).filter((g) => !linkedGoalIds.includes(g.id));
|
const availableGoals = (allGoals ?? []).filter((g) => !linkedGoalIds.includes(g.id));
|
||||||
const workspaces = project.workspaces ?? [];
|
const workspaces = project.workspaces ?? [];
|
||||||
|
const codebase = project.codebase;
|
||||||
|
const primaryCodebaseWorkspace = project.primaryWorkspace ?? null;
|
||||||
|
const hasAdditionalLegacyWorkspaces = workspaces.some((workspace) => workspace.id !== primaryCodebaseWorkspace?.id);
|
||||||
const executionWorkspacePolicy = project.executionWorkspacePolicy ?? null;
|
const executionWorkspacePolicy = project.executionWorkspacePolicy ?? null;
|
||||||
const executionWorkspacesEnabled = executionWorkspacePolicy?.enabled === true;
|
const executionWorkspacesEnabled = executionWorkspacePolicy?.enabled === true;
|
||||||
const executionWorkspaceDefaultMode =
|
const executionWorkspaceDefaultMode =
|
||||||
@@ -268,37 +269,51 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const deriveWorkspaceNameFromPath = (value: string) => {
|
const formatRepoUrl = (value: string) => {
|
||||||
const normalized = value.trim().replace(/[\\/]+$/, "");
|
|
||||||
const segments = normalized.split(/[\\/]/).filter(Boolean);
|
|
||||||
return segments[segments.length - 1] ?? "Local folder";
|
|
||||||
};
|
|
||||||
|
|
||||||
const deriveWorkspaceNameFromRepo = (value: string) => {
|
|
||||||
try {
|
try {
|
||||||
const parsed = new URL(value);
|
const parsed = new URL(value);
|
||||||
const segments = parsed.pathname.split("/").filter(Boolean);
|
const segments = parsed.pathname.split("/").filter(Boolean);
|
||||||
const repo = segments[segments.length - 1]?.replace(/\.git$/i, "") ?? "";
|
if (segments.length < 2) return parsed.host;
|
||||||
return repo || "GitHub repo";
|
|
||||||
} catch {
|
|
||||||
return "GitHub repo";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const formatGitHubRepo = (value: string) => {
|
|
||||||
try {
|
|
||||||
const parsed = new URL(value);
|
|
||||||
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
||||||
if (segments.length < 2) return value;
|
|
||||||
const owner = segments[0];
|
const owner = segments[0];
|
||||||
const repo = segments[1]?.replace(/\.git$/i, "");
|
const repo = segments[1]?.replace(/\.git$/i, "");
|
||||||
if (!owner || !repo) return value;
|
if (!owner || !repo) return parsed.host;
|
||||||
return `${owner}/${repo}`;
|
return `${parsed.host}/${owner}/${repo}`;
|
||||||
} catch {
|
} catch {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const deriveSourceType = (cwd: string | null, repoUrl: string | null) => {
|
||||||
|
if (repoUrl) return "git_repo";
|
||||||
|
if (cwd) return "local_path";
|
||||||
|
return undefined;
|
||||||
|
};
|
||||||
|
|
||||||
|
const persistCodebase = (patch: { cwd?: string | null; repoUrl?: string | null }) => {
|
||||||
|
const nextCwd = patch.cwd !== undefined ? patch.cwd : codebase.localFolder;
|
||||||
|
const nextRepoUrl = patch.repoUrl !== undefined ? patch.repoUrl : codebase.repoUrl;
|
||||||
|
if (!nextCwd && !nextRepoUrl) {
|
||||||
|
if (primaryCodebaseWorkspace) {
|
||||||
|
removeWorkspace.mutate(primaryCodebaseWorkspace.id);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data: Record<string, unknown> = {
|
||||||
|
...(patch.cwd !== undefined ? { cwd: patch.cwd } : {}),
|
||||||
|
...(patch.repoUrl !== undefined ? { repoUrl: patch.repoUrl } : {}),
|
||||||
|
...(deriveSourceType(nextCwd, nextRepoUrl) ? { sourceType: deriveSourceType(nextCwd, nextRepoUrl) } : {}),
|
||||||
|
isPrimary: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (primaryCodebaseWorkspace) {
|
||||||
|
updateWorkspace.mutate({ workspaceId: primaryCodebaseWorkspace.id, data });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
createWorkspace.mutate(data);
|
||||||
|
};
|
||||||
|
|
||||||
const submitLocalWorkspace = () => {
|
const submitLocalWorkspace = () => {
|
||||||
const cwd = workspaceCwd.trim();
|
const cwd = workspaceCwd.trim();
|
||||||
if (!isAbsolutePath(cwd)) {
|
if (!isAbsolutePath(cwd)) {
|
||||||
@@ -306,59 +321,45 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setWorkspaceError(null);
|
setWorkspaceError(null);
|
||||||
createWorkspace.mutate({
|
persistCodebase({ cwd });
|
||||||
name: deriveWorkspaceNameFromPath(cwd),
|
|
||||||
cwd,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const submitRepoWorkspace = () => {
|
const submitRepoWorkspace = () => {
|
||||||
const repoUrl = workspaceRepoUrl.trim();
|
const repoUrl = workspaceRepoUrl.trim();
|
||||||
if (!isGitHubRepoUrl(repoUrl)) {
|
if (!isGitHubRepoUrl(repoUrl)) {
|
||||||
setWorkspaceError("Repo workspace must use a valid GitHub repo URL.");
|
setWorkspaceError("Repo must use a valid GitHub repo URL.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setWorkspaceError(null);
|
setWorkspaceError(null);
|
||||||
createWorkspace.mutate({
|
persistCodebase({ repoUrl });
|
||||||
name: deriveWorkspaceNameFromRepo(repoUrl),
|
|
||||||
cwd: REPO_ONLY_CWD_SENTINEL,
|
|
||||||
repoUrl,
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearLocalWorkspace = (workspace: Project["workspaces"][number]) => {
|
const clearLocalWorkspace = () => {
|
||||||
const confirmed = window.confirm(
|
const confirmed = window.confirm(
|
||||||
workspace.repoUrl
|
codebase.repoUrl
|
||||||
? "Clear local folder from this workspace?"
|
? "Clear local folder from this workspace?"
|
||||||
: "Delete this workspace local folder?",
|
: "Delete this workspace local folder?",
|
||||||
);
|
);
|
||||||
if (!confirmed) return;
|
if (!confirmed) return;
|
||||||
if (workspace.repoUrl) {
|
persistCodebase({ cwd: null });
|
||||||
updateWorkspace.mutate({
|
|
||||||
workspaceId: workspace.id,
|
|
||||||
data: { cwd: null },
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
removeWorkspace.mutate(workspace.id);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearRepoWorkspace = (workspace: Project["workspaces"][number]) => {
|
const clearRepoWorkspace = () => {
|
||||||
const hasLocalFolder = Boolean(workspace.cwd && workspace.cwd !== REPO_ONLY_CWD_SENTINEL);
|
const hasLocalFolder = Boolean(codebase.localFolder);
|
||||||
const confirmed = window.confirm(
|
const confirmed = window.confirm(
|
||||||
hasLocalFolder
|
hasLocalFolder
|
||||||
? "Clear GitHub repo from this workspace?"
|
? "Clear repo from this workspace?"
|
||||||
: "Delete this workspace repo?",
|
: "Delete this workspace repo?",
|
||||||
);
|
);
|
||||||
if (!confirmed) return;
|
if (!confirmed) return;
|
||||||
if (hasLocalFolder) {
|
if (primaryCodebaseWorkspace) {
|
||||||
updateWorkspace.mutate({
|
updateWorkspace.mutate({
|
||||||
workspaceId: workspace.id,
|
workspaceId: primaryCodebaseWorkspace.id,
|
||||||
data: { repoUrl: null, repoRef: null },
|
data: { repoUrl: null, repoRef: null, defaultRef: null, sourceType: deriveSourceType(codebase.localFolder, null) },
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
removeWorkspace.mutate(workspace.id);
|
persistCodebase({ repoUrl: null });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -494,68 +495,90 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
|
|||||||
<div className="space-y-1 py-4">
|
<div className="space-y-1 py-4">
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
<div className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||||
<span>Workspaces</span>
|
<span>Codebase</span>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="inline-flex h-4 w-4 items-center justify-center rounded-full border border-border text-[10px] text-muted-foreground hover:text-foreground"
|
className="inline-flex h-4 w-4 items-center justify-center rounded-full border border-border text-[10px] text-muted-foreground hover:text-foreground"
|
||||||
aria-label="Workspaces help"
|
aria-label="Codebase help"
|
||||||
>
|
>
|
||||||
?
|
?
|
||||||
</button>
|
</button>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="top">
|
<TooltipContent side="top">
|
||||||
Workspaces give your agents hints about where the work is
|
Repo identifies the source of truth. Local folder is the default place agents write code.
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
{workspaces.length === 0 ? (
|
<div className="space-y-2 rounded-md border border-border/70 p-3">
|
||||||
<p className="rounded-md border border-dashed border-border px-3 py-2 text-sm text-muted-foreground">
|
|
||||||
No workspace configured.
|
|
||||||
</p>
|
|
||||||
) : (
|
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
{workspaces.map((workspace) => (
|
<div className="text-[11px] uppercase tracking-wide text-muted-foreground">Repo</div>
|
||||||
<div key={workspace.id} className="space-y-1">
|
{codebase.repoUrl ? (
|
||||||
{workspace.cwd && workspace.cwd !== REPO_ONLY_CWD_SENTINEL ? (
|
<div className="flex items-center justify-between gap-2">
|
||||||
<div className="flex items-center justify-between gap-2 py-1">
|
|
||||||
<span className="min-w-0 truncate font-mono text-xs text-muted-foreground">{workspace.cwd}</span>
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
size="icon-xs"
|
|
||||||
onClick={() => clearLocalWorkspace(workspace)}
|
|
||||||
aria-label="Delete local folder"
|
|
||||||
>
|
|
||||||
<Trash2 className="h-3 w-3" />
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
) : null}
|
|
||||||
{workspace.repoUrl ? (
|
|
||||||
<div className="flex items-center justify-between gap-2 py-1">
|
|
||||||
<a
|
<a
|
||||||
href={workspace.repoUrl}
|
href={codebase.repoUrl}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className="inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground hover:underline"
|
className="inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground hover:underline"
|
||||||
>
|
>
|
||||||
<Github className="h-3 w-3 shrink-0" />
|
<Github className="h-3 w-3 shrink-0" />
|
||||||
<span className="truncate">{formatGitHubRepo(workspace.repoUrl)}</span>
|
<span className="truncate">{formatRepoUrl(codebase.repoUrl)}</span>
|
||||||
<ExternalLink className="h-3 w-3 shrink-0" />
|
<ExternalLink className="h-3 w-3 shrink-0" />
|
||||||
</a>
|
</a>
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon-xs"
|
size="icon-xs"
|
||||||
onClick={() => clearRepoWorkspace(workspace)}
|
onClick={clearRepoWorkspace}
|
||||||
aria-label="Delete workspace repo"
|
aria-label="Clear repo"
|
||||||
>
|
>
|
||||||
<Trash2 className="h-3 w-3" />
|
<Trash2 className="h-3 w-3" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : (
|
||||||
{workspace.runtimeServices && workspace.runtimeServices.length > 0 ? (
|
<div className="text-xs text-muted-foreground">Not set.</div>
|
||||||
<div className="space-y-1 pl-2">
|
)}
|
||||||
{workspace.runtimeServices.map((service) => (
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="text-[11px] uppercase tracking-wide text-muted-foreground">Local folder</div>
|
||||||
|
{codebase.localFolder ? (
|
||||||
|
<div className="flex items-center justify-between gap-2">
|
||||||
|
<span className="min-w-0 truncate font-mono text-xs text-muted-foreground">{codebase.localFolder}</span>
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon-xs"
|
||||||
|
onClick={clearLocalWorkspace}
|
||||||
|
aria-label="Clear local folder"
|
||||||
|
>
|
||||||
|
<Trash2 className="h-3 w-3" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<div className="text-xs text-muted-foreground">Not set.</div>
|
||||||
|
<div className="text-[11px] text-muted-foreground">Paperclip will use a managed checkout instead.</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="rounded-md border border-border/60 bg-muted/20 px-2.5 py-2">
|
||||||
|
<div className="text-[11px] uppercase tracking-wide text-muted-foreground">Effective working folder</div>
|
||||||
|
<div className="mt-1 break-all font-mono text-xs text-foreground">{codebase.effectiveLocalFolder}</div>
|
||||||
|
<div className="mt-1 text-[11px] text-muted-foreground">
|
||||||
|
{codebase.origin === "local_folder" ? "Using your local folder." : "Paperclip-managed folder."}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{hasAdditionalLegacyWorkspaces && (
|
||||||
|
<div className="text-[11px] text-muted-foreground">
|
||||||
|
Additional legacy workspace records exist on this project. Paperclip is using the primary workspace as the codebase view.
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{primaryCodebaseWorkspace?.runtimeServices && primaryCodebaseWorkspace.runtimeServices.length > 0 ? (
|
||||||
|
<div className="space-y-1">
|
||||||
|
{primaryCodebaseWorkspace.runtimeServices.map((service) => (
|
||||||
<div
|
<div
|
||||||
key={service.id}
|
key={service.id}
|
||||||
className="flex items-center justify-between gap-2 rounded-md border border-border/60 px-2 py-1"
|
className="flex items-center justify-between gap-2 rounded-md border border-border/60 px-2 py-1"
|
||||||
@@ -599,9 +622,6 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
|
|||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<div className="flex flex-col items-start gap-2">
|
<div className="flex flex-col items-start gap-2">
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -609,10 +629,11 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
|
|||||||
className="h-7 px-2.5"
|
className="h-7 px-2.5"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setWorkspaceMode("local");
|
setWorkspaceMode("local");
|
||||||
|
setWorkspaceCwd(codebase.localFolder ?? "");
|
||||||
setWorkspaceError(null);
|
setWorkspaceError(null);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Add workspace local folder
|
{codebase.localFolder ? "Change local folder" : "Set local folder"}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
@@ -620,10 +641,11 @@ export function ProjectProperties({ project, onUpdate, onFieldUpdate, getFieldSa
|
|||||||
className="h-7 px-2.5"
|
className="h-7 px-2.5"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setWorkspaceMode("repo");
|
setWorkspaceMode("repo");
|
||||||
|
setWorkspaceRepoUrl(codebase.repoUrl ?? "");
|
||||||
setWorkspaceError(null);
|
setWorkspaceError(null);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Add workspace repo
|
{codebase.repoUrl ? "Change repo" : "Set repo"}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
{workspaceMode === "local" && (
|
{workspaceMode === "local" && (
|
||||||
|
|||||||
Reference in New Issue
Block a user