feat: company portability — export/import companies and agents

Add company export, import preview, and import endpoints with manifest-
based bundle format. Includes URL key utilities for agents and projects,
collision detection/rename strategies, and secret requirement tracking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Forgotten
2026-03-02 09:06:58 -06:00
parent 79a9dffc80
commit cc2c724ad2
10 changed files with 1197 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
const PROJECT_URL_KEY_DELIM_RE = /[^a-z0-9]+/g;
const PROJECT_URL_KEY_TRIM_RE = /^-+|-+$/g;
export function normalizeProjectUrlKey(value: string | null | undefined): string | null {
if (typeof value !== "string") return null;
const normalized = value
.trim()
.toLowerCase()
.replace(PROJECT_URL_KEY_DELIM_RE, "-")
.replace(PROJECT_URL_KEY_TRIM_RE, "");
return normalized.length > 0 ? normalized : null;
}
export function deriveProjectUrlKey(name: string | null | undefined, fallback?: string | null): string {
return normalizeProjectUrlKey(name) ?? normalizeProjectUrlKey(fallback) ?? "project";
}