addRemote
uses node:path
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import type { RemoteConfig } from "#codebase/tcmts/cli/sync"; import path from "node:path"; export function addRemote(cb: Codebase, name: string, url: string, token?: string, fingerprint?: string) { if (!/^[\w.-]+$/.test(name)) throw new Error(`invalid remote name '${name}'`); const resolved = /^https?:\/\//.test(url) ? url : path.resolve(url); if (fingerprint && !resolved.startsWith("https://")) throw new Error("--fingerprint needs an https:// URL"); cb.store.setSetting(`remote.${name}`, JSON.stringify({ url: resolved, token, fingerprint } satisfies RemoteConfig)); }