UNPKG

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

124 lines 5.2 kB
/** * Scope resolver — `--scope user|project` per ADR-4. * * The CLI flag `--scope user` redirects deploys to home-rooted paths * (`~/.<provider>/...`) instead of project-relative paths. This module * holds the per-provider user-scope path map and the helper to detect * the flag in command-line args. * * Per ADR-4 §2 path map. Per ADR-4 §1: `--scope user` and `--scope * project` are mutually exclusive; default is `project`. */ export type Scope = 'project' | 'user'; /** * User-scope deploy paths per provider per ADR-4 §2. Each path is absolute * (rooted in os.homedir()) so the orchestrator's existing path-join logic * (which calls `path.join(target, relativePath)`) treats them as authoritative * and bypasses the project-relative join. * * `.agents/skills/` and `~/.agents/skills/` deliberately appear for multiple * providers — that's the cross-provider canonical user-scope target. Per * ADR-4 §5 reference counting prevents one provider's removal from breaking * another's deploy at the shared path. */ export declare const USER_SCOPE_PATHS: Record<string, { agents: string; skills: string; commands: string; rules: string; behaviors: string; }>; /** * Detect the `--scope` flag in a command-line arg list. Returns the resolved * scope; defaults to 'project'. Throws when both `--scope user` and `--scope * project` appear (mutually exclusive per ADR-4 §1). */ export declare function detectScope(args: ReadonlyArray<string>): Scope; /** * The path to the user-scope aiwg.config per ADR-4 §4. Each operator has * one of these per-machine; it tracks user-global deployments. */ export declare function userScopeConfigPath(): string; /** * Resolve the deploy paths for a (provider, scope) pair. For project scope, * returns the project-relative paths from PROVIDER_PATHS (the caller resolves * them against the project dir). For user scope, returns the absolute home- * rooted paths from USER_SCOPE_PATHS. */ export declare function resolveScopePaths(provider: string, scope: Scope, projectScopePaths: { agents: string; skills: string; commands: string; rules: string; behaviors: string; }): { agents: string; skills: string; commands: string; rules: string; behaviors: string; }; /** * Mirror skills deployed under the project-scope skills directory to the * user-scope target. Per ADR-4 §2 the cross-agent canonical user-scope * skills target is `~/.agents/skills/` for codex/copilot/warp/opencode/ * factory; for other providers the user-scope skills dir is per-provider. * * This is an additive copy — the project-scope deploy stays in place; the * user-scope copy is created alongside. Operators get the skills available * across all their projects without re-running aiwg use per project. * * Returns the count of skills mirrored, or 0 when nothing was found. */ export declare function mirrorSkillsToUserScope(provider: string, projectSkillsDir: string): Promise<{ count: number; targetDir: string; }>; /** * Per-artifact-type mirror result. `entries` are the top-level directory or * file names that were successfully copied — these become the entries in the * per-user registry's `artifactEntries` map and let `aiwg remove --scope user` * delete only what this deploy created (rather than wiping shared dirs). */ export interface ArtifactMirrorResult { count: number; targetDir: string; entries: string[]; } /** * #1156 Phase 1 — Mirror the full per-provider artifact set (agents, commands, * skills, rules) from project scope to the user-scope target. Additive: the * project-scope deploy stays in place; user-scope copies are created alongside * so the framework is available across every project on the machine. * * `projectPaths` are the relative or absolute paths the caller already resolved * for project-scope deployment. Each one whose user-scope counterpart is * non-empty gets mirrored. Returns per-artifact-type counts, the resolved * user-scope target directories, and the list of entry names that were copied * (so callers can record them in a per-framework manifest for precise remove). */ export declare function mirrorToUserScope(provider: string, projectPaths: { agents: string; skills: string; commands: string; rules: string; behaviors: string; }): Promise<{ agents: ArtifactMirrorResult; skills: ArtifactMirrorResult; commands: ArtifactMirrorResult; rules: ArtifactMirrorResult; behaviors: ArtifactMirrorResult; }>; /** * #1156 Phase 1 — OpenClaw is exclusively user-scope. `--scope project` against * OpenClaw is meaningless because all OpenClaw paths are already home-rooted; * silently accepting it would create the false impression that project-scope * deploys are tracked. This helper is called by the use/list/remove handlers * to fail fast with a clear message on `--scope project --provider openclaw`. * * `--scope user --provider openclaw` is a no-op: that's already what OpenClaw * does without the flag. */ export declare function rejectOpenClawProjectScope(provider: string, scope: Scope): void; //# sourceMappingURL=scope-resolver.d.ts.map