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
84 lines • 3.12 kB
TypeScript
/**
* Package Registry Coordinator
*
* Orchestrates resolution and fetching across all PackageRegistryAdapters.
* Priority order: local-cache lookup → gitea shorthand → github shorthand → git URL
*
* @implements #557
*/
import type { PackageRef, PackageSource, PackageRegistryAdapter, FetchOptions, PackageInfo } from './types.js';
/**
* Parse a raw reference string into a PackageRef
*
* Supported formats:
* owner/name → gitea shorthand
* owner/name@v1.2.0 → gitea shorthand with version
* github:owner/name → github shorthand
* github:owner/name@v1.2.0 → github shorthand with version
* https://... → direct git URL
* git@host:owner/name.git → direct SSH URL
*/
export declare function parseRef(raw: string): PackageRef;
/**
* Resolve a ref to a PackageSource using the appropriate adapter
*/
export declare function resolveRef(ref: PackageRef): Promise<{
source: PackageSource;
adapter: PackageRegistryAdapter;
} | null>;
/**
* Read the namespace for a cached package.
*
* Resolution order:
* 1. `namespace` field in `manifest.json` (explicit — highest priority)
* 2. Owner segment parsed from `registryKey` (e.g. `roko/ring-methodology` → `roko`)
* Also handles scheme-prefixed keys: `clawhub:author/name` → `author`,
* `github:thirdparty/repo` → `thirdparty`.
* 3. `"third-party"` — safe fallback when the key cannot be parsed.
*
* AIWG-owned packages (owner = `aiwg`) return `"aiwg"` which is the default
* namespace used by the AIWG deploy pipeline.
*
* @param cachePath - Absolute path to the cloned/cached package directory
* @param registryKey - The key stored in packages.yaml, e.g. `"owner/name"` or
* `"github:owner/name"` or `"clawhub:owner/name"`
*/
export declare function readPackageNamespace(cachePath: string, registryKey: string): Promise<string>;
/**
* Install a package from a ref string
*
* 1. Parse ref
* 2. Resolve to PackageSource via adapters
* 3. Fetch (clone/pull) to local cache
* 4. Register in ~/.aiwg/packages.yaml
*
* Returns the cache path and resolved namespace.
*/
export declare function installPackage(rawRef: string, options?: FetchOptions & {
configDir?: string;
}): Promise<{
cachePath: string;
key: string;
type: string;
namespace: string;
}>;
/**
* Refresh all registered remote packages (used by `aiwg sync`)
*/
export declare function refreshAllPackages(options?: {
configDir?: string;
}): Promise<string[]>;
/**
* List all installed packages
*/
export declare function listInstalledPackages(configDir?: string): Promise<PackageInfo[]>;
/**
* Remove a package from the registry (does not delete cache)
*/
export declare function uninstallPackage(key: string, configDir?: string): Promise<boolean>;
/**
* Look up the cache path for an installed package by name
* (used by `aiwg use` to resolve local packages before bundled npm)
*/
export declare function resolveInstalledPackage(name: string): Promise<string | undefined>;
//# sourceMappingURL=registry.d.ts.map