Unify scoped development with ordinary Workspace authoring commands

This commit is contained in:
Timothy J. Aveni
2026-10-12 13:09:47 -07:00
parent ecf97173b4
commit bbf9056dfa
3 changed files with 32 additions and 3 deletions
@@ -16,8 +16,11 @@ export async function prepareDevelopmentSources(options: {
directory: string;
cacheDirectory: string;
locations?: Record<string, string>;
workspaceId?: string;
}) {
const source = workspaceSourcePin(options.source);
if (options.workspaceId !== undefined && !/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/.test(options.workspaceId))
throw Error("Development source binding requires a Workspace UUID");
const destination = path.resolve(options.directory);
const cache = path.resolve(options.cacheDirectory);
if (cache === destination || cache.startsWith(destination + path.sep))
@@ -43,7 +46,8 @@ export async function prepareDevelopmentSources(options: {
const parent = path.dirname(destination);
await mkdir(parent, { recursive: true });
const staging = await mkdtemp(path.join(parent, ".development-sources-"));
const workspaceId = randomUUID();
// This local association does not create or grant access to a hosted Graph.
const workspaceId = options.workspaceId ?? randomUUID();
try {
const resources = [];
for (const entry of closure.resources) {