Skip to content

The open-source app everyone uses to manage agents at work

fix: auto-expand conflicting files and warn on agent overwrites during import

Dotta298cb4ab8adc
diff --git a/server/src/services/company-portability.ts b/server/src/services/company-portability.ts
index c974776e82..0ecb9ccb13 100644
--- a/server/src/services/company-portability.ts
+++ b/server/src/services/company-portability.ts
@@ -2042,6 +2042,20 @@ export function companyPortabilityService(db: Db) {
}
}
+ // Warn about agents that will be overwritten/updated
+ for (const ap of agentPlans) {
+ if (ap.action === "update") {
+ warnings.push(`Existing agent "${ap.plannedName}" (${ap.slug}) will be overwritten by import.`);
+ }
+ }
+
+ // Warn about projects that will be overwritten/updated
+ for (const pp of projectPlans) {
+ if (pp.action === "update") {
+ warnings.push(`Existing project "${pp.plannedName}" (${pp.slug}) will be overwritten by import.`);
+ }
+ }
+
if (include.issues) {
for (const manifestIssue of manifest.issues) {
issuePlans.push({
diff --git a/ui/src/pages/CompanyImport.tsx b/ui/src/pages/CompanyImport.tsx
index f2ef822c77..c4f0ff4f08 100644
--- a/ui/src/pages/CompanyImport.tsx
+++ b/ui/src/pages/CompanyImport.tsx
@@ -566,13 +566,25 @@ export function CompanyImport() {
// Check all files by default
const allFiles = new Set(Object.keys(result.files));
setCheckedFiles(allFiles);
- // Expand top-level dirs
- const tree = buildFileTree(result.files, buildActionMap(result));
- const topDirs = new Set<string>();
+ // Expand top-level dirs + all ancestor dirs of files with conflicts (update action)
+ const am = buildActionMap(result);
+ const tree = buildFileTree(result.files, am);
+ const dirsToExpand = new Set<string>();
for (const node of tree) {
- if (node.kind === "dir") topDirs.add(node.path);
+ if (node.kind === "dir") dirsToExpand.add(node.path);
}
- setExpandedDirs(topDirs);
+ // Auto-expand directories containing conflicting files so they're visible
+ for (const [filePath, action] of am) {
+ if (action === "update") {
+ const segments = filePath.split("/").filter(Boolean);
+ let current = "";
+ for (let i = 0; i < segments.length - 1; i++) {
+ current = current ? `${current}/${segments[i]}` : segments[i];
+ dirsToExpand.add(current);
+ }
+ }
+ }
+ setExpandedDirs(dirsToExpand);
// Select first file
const firstFile = Object.keys(result.files)[0];
if (firstFile) setSelectedFile(firstFile);