aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
155 lines • 4.55 kB
TypeScript
/**
* Ops Workspace Registry
*
* Manages the ops.yaml file in the user config directory.
* Tracks workspace definitions, repo locations, and cross-repo wiring.
*
* @implements #544
*/
/**
* Ops workspace repo entry
*/
export interface OpsRepoEntry {
path: string;
remote?: string;
extensions: string[];
}
/**
* Ops workspace definition
*/
export interface OpsWorkspace {
home: string;
mode: 'single-repo' | 'multi-repo';
repos: Record<string, OpsRepoEntry>;
}
/**
* Full ops registry structure
*/
export interface OpsRegistryData {
apiVersion: string;
kind: string;
defaultWorkspace: string;
workspaces: Record<string, OpsWorkspace>;
}
/**
* Init options for creating a new workspace
*/
export interface InitOptions {
name: string;
home?: string;
mode: 'single-repo' | 'multi-repo';
extensions: string[];
prefix?: string;
provider?: string;
silent?: boolean;
/**
* If set, clone this git URL into the target repo instead of running
* `git init`. Only valid for single-repo mode or multi-repo with
* exactly one extension (otherwise the URL would map ambiguously).
*/
from?: string;
}
/**
* Adopt options for registering an existing local clone
*/
export interface AdoptOptions {
/** Target workspace bucket. Defaults to "default". */
workspace?: string;
/** Extensions to record on the adopted repo entry. */
extensions?: string[];
/** Repo name override (defaults to basename of path). */
name?: string;
/** Suppress informational logging. */
silent?: boolean;
}
/**
* Result of a single discovered ops-workspace candidate
*/
export interface DiscoveredCandidate {
/** Absolute path to the workspace root */
path: string;
/** Inferred workspace name (basename) */
name: string;
/** Git remote URL if a `.git` directory is present, else undefined */
remote?: string;
/** True if the path matches an entry in any registered workspace */
alreadyRegistered: boolean;
/** Marker that triggered detection (for transparency) */
marker: 'OpsInventory.yaml';
}
/**
* Options for discovery
*/
export interface DiscoverOptions {
/** Roots to scan. Defaults to [homedir()]. */
roots?: string[];
/** Maximum directory depth from each root. Default 3. */
maxDepth?: number;
}
/**
* Ops workspace registry manager
*/
export declare class OpsRegistry {
private readonly configDir;
private readonly registryPath;
constructor(configDirOverride?: string);
/**
* Load the ops registry, creating defaults if missing
*/
load(): Promise<OpsRegistryData>;
/**
* Save the ops registry
*/
save(data: OpsRegistryData): Promise<void>;
/**
* Initialize a new ops workspace
*/
initWorkspace(opts: InitOptions): Promise<void>;
/**
* Show workspace status
*/
showStatus(showAll: boolean): Promise<void>;
/**
* Switch active workspace
*/
switchWorkspace(name: string): Promise<void>;
/**
* List all registered workspaces
*/
listWorkspaces(): Promise<void>;
/**
* Adopt an existing local clone as a repo entry under a workspace.
*
* Detects the git remote, seeds OpsInventory.yaml only if missing
* (never overwrites an existing inventory), and registers the repo.
* Refuses to register a path nested inside another registered repo.
*/
adoptRepo(repoPath: string, opts?: AdoptOptions): Promise<{
workspace: string;
repoName: string;
}>;
/**
* Walk the given roots looking for ops-workspace candidates.
*
* A candidate is any directory containing `OpsInventory.yaml`. Skips
* `node_modules`, `.git`, and other obvious noise. Candidates nested
* inside another candidate are dropped (siblings-only by design — see
* #935).
*/
discoverWorkspaces(opts?: DiscoverOptions): Promise<DiscoveredCandidate[]>;
/**
* Register discovered candidates as a workspace in the registry.
*
* Creates a single multi-repo workspace and adds each candidate as a
* repo entry. Skips candidates whose path is already registered.
*/
registerDiscovered(workspaceName: string, candidates: DiscoveredCandidate[]): Promise<{
added: number;
skipped: number;
}>;
/**
* Push workspace repos to remote (always private)
*/
pushWorkspace(workspaceName?: string): Promise<void>;
}
//# sourceMappingURL=registry.d.ts.map