Nicolas Cantu b21ac2cf64 feat: anythingllm-devtools service, builazoo project, ssh-config example, docs
- Add services/anythingllm-devtools HTTP API (repos + AnythingLLM + RAG)
- Rename gitea-issues to git-issues across smart_ide agents and docs
- Add projects/builazoo, builazoo README, cron fragment, ssh-config.example
- Add ensure-ia-dev-project-link.sh; wrapper delegates smart_ide id
- Bump ia_dev submodule (git-issues rename, project symlinks)
- Align 4nkaiignore templates; update API index and project docs
2026-04-03 19:06:19 +02:00

28 lines
861 B
TypeScript

import { createWorkspace, listWorkspaces } from "./anythingllmClient.js";
import type { AnythingWorkspace } from "./types.js";
export interface EnsuredWorkspace {
readonly workspace: AnythingWorkspace;
readonly created: boolean;
}
export const ensureWorkspaceForRepoName = async (
baseUrl: string,
apiKey: string,
repoName: string,
): Promise<EnsuredWorkspace> => {
const key = repoName.trim();
if (key.length === 0) {
throw new Error("repo/workspace name is empty");
}
const all = await listWorkspaces(baseUrl, apiKey);
const byName = all.find((w) => w.name === key);
const bySlug = all.find((w) => w.slug === key);
const found = byName ?? bySlug;
if (found) {
return { workspace: found, created: false };
}
const created = await createWorkspace(baseUrl, apiKey, key);
return { workspace: created, created: true };
};