@agentled/cli
Version:
CLI for Agentled — manage workflows, apps, and knowledge from the command line. Zero context-window cost for AI agents.
119 lines (118 loc) • 5.6 kB
TypeScript
/**
* Skills installer — copies the bundled Agentled Claude Code skills into the
* user's `~/.claude/skills/` (global) or `./.claude/skills/` (project) dir.
*
* Why: When an agent drives the CLI with a fresh Claude Code session, it does
* not have the Agentled skill loaded unless the skill is present on disk in a
* Claude-discoverable location. Without the skill, the LLM invents invalid
* step types (`type: "ai"`, `knowledge_graph_query`, …) — the exact class of
* silent CLI failure that MCP-025 is closing.
*
* The installer is version-aware:
* - Reads a `version:` frontmatter field from each `SKILL.md`
* - Leaves newer or hand-edited skills alone (unless --force)
* - Reports status so we can print a one-line summary after `auth login`
*
* Targets:
* - Claude Code / Claude Desktop → `~/.claude/skills/` (global) or
* `./.claude/skills/` (project) via the `global` option.
* - Codex → `~/.codex/skills/` via `targetDir` override (set by the
* `agentled setup` orchestrator after detecting a Codex install).
* - Cursor / Windsurf → not auto-installed (no native skills surface);
* the orchestrator skips this step and prints a hint.
*/
export type SkillInstallOutcome = 'installed' | 'updated' | 'up-to-date' | 'newer-local' | 'hand-edited' | 'forced';
export interface SkillInstallResult {
skill: string;
outcome: SkillInstallOutcome;
bundledVersion: string;
installedVersion: string | null;
targetPath: string;
}
export interface InstallSkillsOptions {
/** true = install to `~/.claude/skills/` (global); false = `./.claude/skills/` (project) */
global?: boolean;
/** overwrite regardless of version comparison or local edits */
force?: boolean;
/**
* Override the target directory entirely. Used by the orchestrator to
* route Codex installs to `~/.codex/skills/` and (in future) any
* other client-specific skill location.
*/
targetDir?: string;
}
export declare function resolveBundledSkillsDir(): string;
export declare function getSkillsTargetDir(global: boolean): string;
/** Codex's skill directory — separate from Claude's. */
export declare function getCodexSkillsDir(): string;
/** OpenClaw's managed/local skills directory (`~/.openclaw/skills/<skill>/SKILL.md`). */
export declare function getOpenClawSkillsDir(): string;
/**
* Hermes Agent's user skills directory. Hermes nests skills by category
* (`~/.hermes/skills/<category>/<skill>/SKILL.md`), so we install under an
* `automation` category.
*/
export declare function getHermesSkillsDir(): string;
export declare function installSkills(options?: InstallSkillsOptions): SkillInstallResult[];
export declare function describeSkillsInstall(results: SkillInstallResult[], targetDir: string): string;
/**
* Produce a short one-line hint for the `auth login` summary, e.g.
* "Skill installed: agentled v0.2.0 → ~/.claude/skills/"
* "Skill already installed (v0.1.0), latest is v0.2.0 — run `agentled skills update` to refresh."
*
* Returns null if there is nothing worth showing.
*/
export declare function summarizeForLoginBanner(results: SkillInstallResult[], targetDir: string): string | null;
export type SkillExportTarget = 'claude' | 'codex' | 'openclaw' | 'hermes' | 'cursor' | 'agents' | 'gemini' | 'codex-plugin';
/**
* Targets that read a directory of `SKILL.md` files (multi-file bundle: router
* + references/). We install the full bundle here, same as Claude/Codex.
*/
export declare const SKILL_DIR_TARGETS: SkillExportTarget[];
/**
* Targets that read a single markdown context file. We flatten the router +
* every reference into one self-contained file for these.
*/
export declare const NON_NATIVE_TARGETS: SkillExportTarget[];
/**
* Build one self-contained markdown document from a skill directory: the
* SKILL.md router body followed by every references/*.md, concatenated under
* dividers. No path resolution needed at read time — everything is inline.
*/
export declare function buildCombinedSkillMarkdown(skillDir: string): string;
interface SkillModuleInfo {
file: string;
title: string;
loadWhen: string;
}
/** Enumerate the composable reference modules of a skill for `agentled skills list`. */
export declare function listSkillModules(skillDir: string): SkillModuleInfo[];
export interface SkillExportResult {
target: SkillExportTarget;
path: string;
action: 'written' | 'written-sidecar' | 'skipped-exists';
}
/**
* Export the combined skill markdown for a non-native target. Non-destructive:
* if a conventional file (AGENTS.md / GEMINI.md) already exists, write a
* sidecar (`agentled.AGENTS.md`) and report it rather than clobbering the
* user's file. Cursor rules are agentled-owned, so they're always (re)written.
*/
export declare function exportSkillToTarget(target: SkillExportTarget, skillDir: string, projectDir: string, opts?: {
force?: boolean;
}): SkillExportResult;
export interface CodexPluginResult {
pluginDir: string;
manifestPath: string;
}
/**
* Scaffold a Codex *plugin* package (distinct from a bare `~/.codex/skills`
* drop): a directory with `.codex-plugin/plugin.json` and the full skill bundle
* under `skills/<name>/`. The manifest's `description` drives Codex's implicit
* skill invocation. The result is a local plugin the user installs via Codex's
* "Install plugin" flow or a local marketplace.
*
* Schema: https://developers.openai.com/codex/plugins/build
*/
export declare function buildCodexPlugin(skillDir: string, outDir: string): CodexPluginResult;
export {};