@agentplugins/core 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,178 @@
1
+ /**
2
+ * AgentPlugins Universal Store
3
+ *
4
+ * Manages the universal plugin store at ~/.agents/plugins/<name>/.
5
+ * Clones plugins from GitHub, symlinks them into every detected agent harness.
6
+ * Skills.sh compatible — reads SKILL.md and scans ~/.agents/skills/.
7
+ */
8
+ export interface AgentPathEntry {
9
+ name: string;
10
+ displayName: string;
11
+ skillPath: string;
12
+ binary: string;
13
+ manifestPath: string;
14
+ }
15
+ export interface PluginMeta {
16
+ /** Canonical plugin name (from manifest) */
17
+ name: string;
18
+ /** Source URL (normalized GitHub URL) */
19
+ source: string;
20
+ /** Git commit hash at install time */
21
+ commit: string;
22
+ /** ISO timestamp of initial install */
23
+ installedAt: string;
24
+ /** ISO timestamp of last update */
25
+ updatedAt: string;
26
+ /** Relative path to manifest within the store dir */
27
+ manifestPath: string;
28
+ /** Plugin version from manifest */
29
+ version: string;
30
+ }
31
+ export interface DetectedAgent {
32
+ name: string;
33
+ displayName: string;
34
+ /** Absolute path to the agent's skill/plugin directory */
35
+ skillPath: string;
36
+ /** Binary name to check */
37
+ binary: string;
38
+ /** Whether the binary was found on PATH */
39
+ binaryFound: boolean;
40
+ /** Whether the skillPath directory exists */
41
+ skillPathExists: boolean;
42
+ /** Path to the agent's config/manifest file */
43
+ manifestPath: string;
44
+ }
45
+ export interface SymlinkInfo {
46
+ agent: string;
47
+ agentDisplayName: string;
48
+ /** Path of the symlink */
49
+ linkPath: string;
50
+ /** Resolved target of the symlink */
51
+ targetPath: string;
52
+ /** Whether the symlink is valid (points to existing target) */
53
+ valid: boolean;
54
+ }
55
+ export interface InstalledPlugin {
56
+ meta: PluginMeta;
57
+ /** Absolute path in the store */
58
+ path: string;
59
+ /** Parsed manifest (best-effort) */
60
+ manifest: Record<string, unknown> | null;
61
+ /** Symlinks across detected agents */
62
+ symlinks: SymlinkInfo[];
63
+ }
64
+ export interface ManifestFindResult {
65
+ /** Relative path to the manifest file within the dir */
66
+ path: string;
67
+ /** Parsed manifest object */
68
+ manifest: Record<string, unknown>;
69
+ /** Type of manifest found */
70
+ type: 'json' | 'skill-md';
71
+ }
72
+ export declare const AGENT_PATHS: readonly AgentPathEntry[];
73
+ /** Expand ~ to the home directory */
74
+ export declare function expandHome(p: string): string;
75
+ /** Universal plugin store path: ~/.agents/plugins */
76
+ export declare function getStorePath(): string;
77
+ /** Skills.sh compatibility path: ~/.agents/skills */
78
+ export declare function getSkillsCompatPath(): string;
79
+ /** Path for a specific plugin in the store */
80
+ export declare function getPluginStorePath(name: string): string;
81
+ /** Path to the meta file for a plugin */
82
+ export declare function getMetaPath(name: string): string;
83
+ export declare function getAgentPaths(): readonly AgentPathEntry[];
84
+ /**
85
+ * Detect installed agent harnesses.
86
+ * An agent is "detected" if its binary is on PATH or its skillPath exists.
87
+ */
88
+ export declare function detectAgents(): DetectedAgent[];
89
+ /** Get only agents that are actually installed (binary or skill path) */
90
+ export declare function getDetectedAgents(): DetectedAgent[];
91
+ /**
92
+ * Normalize a plugin source URL.
93
+ * Accepts: https://github.com/u/r, git@github.com:u/r.git, u/r
94
+ */
95
+ export declare function normalizeSource(source: string): string;
96
+ /** Extract the repo name from a GitHub URL */
97
+ export declare function extractRepoName(source: string): string;
98
+ /** Ensure the store and skills-compat directories exist */
99
+ export declare function initStore(): void;
100
+ /**
101
+ * Clone a git repository to a destination directory.
102
+ * Returns the commit hash.
103
+ * Throws on failure.
104
+ */
105
+ export declare function cloneRepo(source: string, dest: string): string;
106
+ /** Pull latest changes in a repo directory. Returns new commit hash. */
107
+ export declare function pullRepo(dir: string): string;
108
+ /**
109
+ * Find and parse a JSON manifest in a directory.
110
+ * Does NOT handle TypeScript configs (callers should use jiti for those).
111
+ * Falls back to SKILL.md synthesis for Skills.sh compatibility.
112
+ */
113
+ export declare function findManifestInDir(dir: string): ManifestFindResult | null;
114
+ /** Read the meta file for a plugin */
115
+ export declare function readMeta(name: string): PluginMeta | null;
116
+ /** Write the meta file for a plugin */
117
+ export declare function writeMeta(meta: PluginMeta): void;
118
+ export interface InstallOptions {
119
+ /** Source URL */
120
+ source: string;
121
+ /** Canonical plugin name (from manifest) */
122
+ name: string;
123
+ /** Commit hash */
124
+ commit: string;
125
+ /** Relative path to manifest within the plugin dir */
126
+ manifestPath: string;
127
+ /** Version from manifest */
128
+ version: string;
129
+ /** Whether to symlink into detected agents (default: true) */
130
+ symlink?: boolean;
131
+ }
132
+ export interface InstallResult {
133
+ meta: PluginMeta;
134
+ symlinks: SymlinkInfo[];
135
+ }
136
+ /**
137
+ * Install a plugin into the store from a cloned directory.
138
+ * Moves the directory to the store, writes meta, creates symlinks.
139
+ */
140
+ export declare function installPlugin(cloneDir: string, opts: InstallOptions): InstallResult;
141
+ /**
142
+ * Full add flow: clone from source, find manifest, install.
143
+ * Returns null if no manifest is found (caller can try TS loading).
144
+ */
145
+ export declare function addPluginFromSource(source: string): InstallResult | null;
146
+ /** Remove a plugin: unlink all symlinks, delete from store */
147
+ export declare function removePlugin(name: string): void;
148
+ /** List all installed plugins */
149
+ export declare function listPlugins(): InstalledPlugin[];
150
+ /** Get detailed info about a single plugin */
151
+ export declare function getPluginInfo(name: string): InstalledPlugin | null;
152
+ /** Update a plugin: git pull + update meta + refresh symlinks */
153
+ export declare function updatePlugin(name: string): PluginMeta;
154
+ /**
155
+ * Create a symlink from agent's skillPath to the plugin store dir.
156
+ * Returns null if the agent's skillPath doesn't exist.
157
+ */
158
+ export declare function symlinkPlugin(pluginName: string, agent: DetectedAgent): SymlinkInfo | null;
159
+ /** Remove a plugin's symlink from an agent's skillPath */
160
+ export declare function unlinkPluginSymlink(pluginName: string, agent: DetectedAgent): void;
161
+ /** Get all symlinks for a plugin across agents */
162
+ export declare function getSymlinks(pluginName: string, agents?: DetectedAgent[]): SymlinkInfo[];
163
+ export interface DoctorResult {
164
+ storePath: string;
165
+ storeExists: boolean;
166
+ skillsCompatPath: string;
167
+ skillsCompatExists: boolean;
168
+ agents: DetectedAgent[];
169
+ plugins: InstalledPlugin[];
170
+ issues: DoctorIssue[];
171
+ }
172
+ export interface DoctorIssue {
173
+ level: 'error' | 'warning' | 'info';
174
+ message: string;
175
+ }
176
+ /** Run diagnostics on the store, agents, and symlinks */
177
+ export declare function runDoctor(): DoctorResult;
178
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAqBH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,YAAY,EAAE,MAAM,CAAC;IACrB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,W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