@skillctl/plugin-system 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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 skillctl contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,3 @@
1
+ export { loadPlugins, listInstalledPlugins, addPluginRecord, removePluginRecord, discoverPluginEntry, getPluginsDir, } from './loader.js';
2
+ export type { SkillctlPlugin, PluginAPI, PluginProgram, PluginCommand } from './types.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { loadPlugins, listInstalledPlugins, addPluginRecord, removePluginRecord, discoverPluginEntry, getPluginsDir, } from './loader.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GACd,MAAM,aAAa,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { RegistrySource } from '@skillctl/core';
2
+ import type { PluginProgram } from './types.js';
3
+ export declare function getPluginsDir(): string;
4
+ export declare function listInstalledPlugins(): Promise<Array<{
5
+ name: string;
6
+ path: string;
7
+ enabled: boolean;
8
+ }>>;
9
+ export declare function loadPlugins(program: PluginProgram, registryManager?: {
10
+ register: (s: RegistrySource) => void;
11
+ }): Promise<string[]>;
12
+ export declare function addPluginRecord(name: string, pluginPath: string): Promise<void>;
13
+ export declare function removePluginRecord(name: string): Promise<boolean>;
14
+ export declare function discoverPluginEntry(pluginDir: string): Promise<string | null>;
15
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAA6B,aAAa,EAAE,MAAM,YAAY,CAAC;AAI3E,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC,CAG7G;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,aAAa,EACtB,eAAe,CAAC,EAAE;IAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAA;CAAE,GAC1D,OAAO,CAAC,MAAM,EAAE,CAAC,CAiCnB;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrF;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CASvE;AAED,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUnF"}
package/dist/loader.js ADDED
@@ -0,0 +1,84 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { homedir } from 'node:os';
4
+ import { pathToFileURL } from 'node:url';
5
+ import { loadConfig, registerAdapter } from '@skillctl/core';
6
+ const PLUGINS_DIR = join(homedir(), '.skillctl', 'plugins');
7
+ export function getPluginsDir() {
8
+ return PLUGINS_DIR;
9
+ }
10
+ export async function listInstalledPlugins() {
11
+ const config = await loadConfig();
12
+ return config.plugins || [];
13
+ }
14
+ export async function loadPlugins(program, registryManager) {
15
+ const config = await loadConfig();
16
+ if (!config.experimental?.plugins)
17
+ return [];
18
+ const loaded = [];
19
+ const plugins = (config.plugins || []).filter((p) => p.enabled);
20
+ const api = {
21
+ registerCommand(cmd) {
22
+ program.addCommand(cmd);
23
+ },
24
+ registerAdapter(adapter) {
25
+ registerAdapter(adapter);
26
+ },
27
+ registerRegistrySource(source) {
28
+ registryManager?.register(source);
29
+ },
30
+ };
31
+ for (const plugin of plugins) {
32
+ try {
33
+ const mod = await import(pathToFileURL(plugin.path).href);
34
+ const pluginExport = mod.default || mod;
35
+ if (typeof pluginExport.register === 'function') {
36
+ await pluginExport.register(api);
37
+ loaded.push(plugin.name);
38
+ }
39
+ }
40
+ catch (e) {
41
+ console.warn(`[plugin] failed to load ${plugin.name}: ${e.message}`);
42
+ }
43
+ }
44
+ return loaded;
45
+ }
46
+ export async function addPluginRecord(name, pluginPath) {
47
+ const { loadConfig, saveConfig } = await import('@skillctl/core');
48
+ const config = await loadConfig();
49
+ const plugins = config.plugins || [];
50
+ const existing = plugins.findIndex((p) => p.name === name);
51
+ const record = { name, path: pluginPath, enabled: true };
52
+ if (existing >= 0)
53
+ plugins[existing] = record;
54
+ else
55
+ plugins.push(record);
56
+ config.plugins = plugins;
57
+ config.experimental = { ...config.experimental, plugins: true };
58
+ await saveConfig(config);
59
+ }
60
+ export async function removePluginRecord(name) {
61
+ const { loadConfig, saveConfig } = await import('@skillctl/core');
62
+ const config = await loadConfig();
63
+ const plugins = config.plugins || [];
64
+ const next = plugins.filter((p) => p.name !== name);
65
+ if (next.length === plugins.length)
66
+ return false;
67
+ config.plugins = next;
68
+ await saveConfig(config);
69
+ return true;
70
+ }
71
+ export async function discoverPluginEntry(pluginDir) {
72
+ try {
73
+ const pkgRaw = await readFile(join(pluginDir, 'package.json'), 'utf8');
74
+ const pkg = JSON.parse(pkgRaw);
75
+ const entry = pkg.skillctl?.plugin || pkg.main;
76
+ if (entry)
77
+ return join(pluginDir, entry);
78
+ }
79
+ catch {
80
+ // no package.json
81
+ }
82
+ return null;
83
+ }
84
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAI7D,MAAM,WAAW,G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,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACpD,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACjD,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;IACzB,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,SAAiB;IACzD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;QACvE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC;QAC/C,IAAI,KAAK;YAAE,OAAO,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAAC,MAAM,CAAC;QACP,kBAAkB;IACpB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { AgentAdapter, RegistrySource } from '@skillctl/core';
2
+ export interface PluginCommand {
3
+ name(): string;
4
+ description(str: string): PluginCommand;
5
+ action(fn: (...args: unknown[]) => void | Promise<void>): PluginCommand;
6
+ }
7
+ export interface PluginProgram {
8
+ addCommand(cmd: PluginCommand): void;
9
+ }
10
+ export interface PluginAPI {
11
+ registerCommand(cmd: PluginCommand): void;
12
+ registerAdapter(adapter: AgentAdapter): void;
13
+ registerRegistrySource(source: RegistrySource): void;
14
+ }
15
+ export interface SkillctlPlugin {
16
+ name: string;
17
+ version?: string;
18
+ register(api: PluginAPI): void | Promise<void>;
19
+ }
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEnE,MAAM,WAAW,aAAa;IAC5B,IAAI,IAAI,MAAM,CAAC;IACf,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;IACxC,MAAM,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC;CACzE;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,SAAS;IACxB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAAC;IAC1C,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7C,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;CACtD;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChD"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@skillctl/plugin-system",
3
+ "version": "0.2.0",
4
+ "description": "Experimental plugin loader for skillctl (commands, adapters, registries)",
5
+ "license": "MIT",
6
+ "author": "skillctl contributors",
7
+ "type": "module",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "dependencies": {
14
+ "@skillctl/core": "0.2.0"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^20.14.0",
18
+ "rimraf": "^5.0.7",
19
+ "typescript": "^5.6.3"
20
+ },
21
+ "engines": {
22
+ "node": ">=22.13"
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/xFurti/skillctl.git",
27
+ "directory": "packages/plugin-system"
28
+ },
29
+ "keywords": [
30
+ "plugins",
31
+ "extensibility",
32
+ "agent-skills",
33
+ "cli"
34
+ ],
35
+ "scripts": {
36
+ "build": "tsc -b",
37
+ "clean": "rimraf dist",
38
+ "lint": "tsc --noEmit",
39
+ "test": "echo 'plugin tests via cli fixture' && exit 0"
40
+ }
41
+ }