kist 0.1.44 → 0.1.57
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/js/actions/DirectoryCleanAction/DirectoryCleanAction.js +2 -2
- package/js/actions/SvgPackagerAction/SvgPackagerAction.js +2 -2
- package/js/actions/TemplateRenderAction/TemplateRenderAction.js +1 -1
- package/js/actions/VersionWriteAction/VersionWriteAction.js +2 -2
- package/js/config/actions.config.d.ts +35 -0
- package/js/config/actions.config.js +119 -0
- package/js/core/config/ConfigLoader.js +1 -30
- package/js/core/pipeline/Action.d.ts +1 -1
- package/js/core/pipeline/Action.js +1 -1
- package/js/core/pipeline/ActionRegistry.d.ts +5 -1
- package/js/core/pipeline/ActionRegistry.js +18 -27
- package/js/core/pipeline/Step.js +1 -1
- package/js/core/plugin/PluginManager.d.ts +70 -0
- package/js/core/plugin/PluginManager.js +288 -0
- package/js/index.d.ts +7 -0
- package/js/index.js +14 -1
- package/js/interface/ActionPlugin.d.ts +43 -0
- package/js/interface/PluginMetadata.d.ts +33 -0
- package/js/interface/PluginMetadata.js +5 -0
- package/js/kist.js +25 -4
- package/package.json +17 -9
- package/ts/actions/DirectoryCleanAction/DirectoryCleanAction.ts +2 -2
- package/ts/actions/StyleProcessingAction/postcss.config.expanded.ts +0 -1
- package/ts/actions/SvgPackagerAction/SvgPackagerAction.ts +2 -2
- package/ts/actions/TemplateRenderAction/TemplateRenderAction.ts +1 -1
- package/ts/actions/VersionWriteAction/VersionWriteAction.ts +6 -2
- package/ts/config/actions.config.ts +137 -0
- package/ts/core/config/ConfigLoader.ts +1 -35
- package/ts/core/config/ConfigStore copy.ts +27 -1
- package/ts/core/pipeline/Action.ts +1 -1
- package/ts/core/pipeline/ActionRegistry.ts +22 -36
- package/ts/core/pipeline/Step.ts +1 -1
- package/ts/core/plugin/PluginManager.ts +310 -0
- package/ts/index.ts +25 -0
- package/ts/interface/ActionPlugin.ts +48 -1
- package/ts/interface/PluginMetadata.ts +43 -0
- package/ts/interface/SVG.ts +2 -0
- package/ts/kist.ts +25 -2
|
@@ -88,7 +88,7 @@ class DirectoryCleanAction extends Action_1.Action {
|
|
|
88
88
|
const stat = yield fs_1.default.promises.lstat(curPath);
|
|
89
89
|
if (stat.isDirectory()) {
|
|
90
90
|
// Recursively clean subdirectory
|
|
91
|
-
yield fs_1.default.promises.
|
|
91
|
+
yield fs_1.default.promises.rm(curPath, { recursive: true });
|
|
92
92
|
this.logInfo(`Deleted directory: ${relativePath}`);
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
@@ -108,7 +108,7 @@ class DirectoryCleanAction extends Action_1.Action {
|
|
|
108
108
|
* @returns A string description of the action.
|
|
109
109
|
*/
|
|
110
110
|
describe() {
|
|
111
|
-
|
|
111
|
+
const description = `
|
|
112
112
|
Cleans a directory by deleting all its contents while retaining
|
|
113
113
|
files and directories matching specified glob patterns. If the
|
|
114
114
|
directory does not exist, the action will skip gracefully.
|
|
@@ -49,7 +49,7 @@ exports.SvgPackagerAction = void 0;
|
|
|
49
49
|
const fs = __importStar(require("fs/promises"));
|
|
50
50
|
const glob = __importStar(require("glob"));
|
|
51
51
|
const path = __importStar(require("path"));
|
|
52
|
-
const svgo_1 =
|
|
52
|
+
const svgo_1 = require("svgo");
|
|
53
53
|
const Action_1 = require("../../core/pipeline/Action");
|
|
54
54
|
// ============================================================================
|
|
55
55
|
// Classes
|
|
@@ -117,7 +117,7 @@ class SvgPackagerAction extends Action_1.Action {
|
|
|
117
117
|
optimizeSvg(svgoConfigPath, svgContent) {
|
|
118
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
119
119
|
const config = yield (0, svgo_1.loadConfig)(svgoConfigPath);
|
|
120
|
-
const result = yield svgo_1.
|
|
120
|
+
const result = yield (0, svgo_1.optimize)(svgContent, Object.assign({}, config));
|
|
121
121
|
return result.data.trim();
|
|
122
122
|
});
|
|
123
123
|
}
|
|
@@ -60,7 +60,7 @@ class TemplateRenderAction extends Action_1.Action {
|
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
|
-
renderTemplate(template, outputFile, context,
|
|
63
|
+
renderTemplate(template, outputFile, context, _templatesDir) {
|
|
64
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
65
65
|
this.logInfo(`Rendering: ${template} → ${outputFile}`);
|
|
66
66
|
const content = nunjucks_1.default.render(template, context);
|
|
@@ -118,7 +118,7 @@ class VersionWriteAction extends Action_1.Action {
|
|
|
118
118
|
}
|
|
119
119
|
return line;
|
|
120
120
|
});
|
|
121
|
-
yield fs_1.promises.writeFile(filePath, updatedLines.join("\n"), "utf8");
|
|
121
|
+
yield fs_1.promises.writeFile(filePath, updatedLines.join("\n") + "\n", "utf8");
|
|
122
122
|
this.logInfo(`Version replaced in file "${filePath}" for key "${key}".`);
|
|
123
123
|
}
|
|
124
124
|
catch (error) {
|
|
@@ -132,7 +132,7 @@ class VersionWriteAction extends Action_1.Action {
|
|
|
132
132
|
* @returns A string description of the action.
|
|
133
133
|
*/
|
|
134
134
|
describe() {
|
|
135
|
-
|
|
135
|
+
const description = `
|
|
136
136
|
Replaces a version string in one or more specified files based on
|
|
137
137
|
a key and pattern. Can retrieve the version from package.json or
|
|
138
138
|
set it manually.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines which actions are considered "core" and will remain in the main
|
|
3
|
+
* kist package. All other actions should be moved to separate plugin packages.
|
|
4
|
+
*
|
|
5
|
+
* Core Actions (Lightweight essentials):
|
|
6
|
+
* - Directory operations (create, copy, clean)
|
|
7
|
+
* - File operations (copy, rename)
|
|
8
|
+
* - Version management
|
|
9
|
+
* - Template rendering (lightweight)
|
|
10
|
+
*
|
|
11
|
+
* Plugin Actions (Move to separate repos):
|
|
12
|
+
* - StyleProcessingAction -> @kist/action-sass
|
|
13
|
+
* - TypeScriptCompilerAction -> @kist/action-typescript
|
|
14
|
+
* - JavaScriptMinifyAction -> @kist/action-terser
|
|
15
|
+
* - SvgPackagerAction -> @kist/action-svg
|
|
16
|
+
* - SvgSpriteAction -> @kist/action-svg
|
|
17
|
+
* - SvgToPngAction -> @kist/action-svg
|
|
18
|
+
* - SvgReaderAction -> @kist/action-svg
|
|
19
|
+
* - LintAction -> @kist/action-lint
|
|
20
|
+
* - DocumentationAction -> @kist/action-docs
|
|
21
|
+
* - PackageManagerAction -> @kist/action-package-manager
|
|
22
|
+
* - RunScriptAction -> @kist/action-scripts
|
|
23
|
+
*/
|
|
24
|
+
export declare const CORE_ACTIONS: readonly ["DirectoryCleanAction", "DirectoryCopyAction", "DirectoryCreateAction", "FileCopyAction", "FileRenameAction", "TemplateRenderAction", "VersionWriteAction"];
|
|
25
|
+
export declare const PLUGIN_ACTIONS: readonly ["StyleProcessingAction", "TypeScriptCompilerAction", "JavaScriptMinifyAction", "SvgPackagerAction", "SvgReaderAction", "SvgSpriteAction", "SvgToPngAction", "LintAction", "DocumentationAction", "PackageManagerAction", "RunScriptAction"];
|
|
26
|
+
export type CoreActionName = (typeof CORE_ACTIONS)[number];
|
|
27
|
+
export type PluginActionName = (typeof PLUGIN_ACTIONS)[number];
|
|
28
|
+
/**
|
|
29
|
+
* Plugin package mappings for migration guide
|
|
30
|
+
*/
|
|
31
|
+
export declare const PLUGIN_PACKAGES: Record<PluginActionName, {
|
|
32
|
+
package: string;
|
|
33
|
+
npm: string;
|
|
34
|
+
github: string;
|
|
35
|
+
}>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Core Actions Configuration
|
|
4
|
+
// ============================================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PLUGIN_PACKAGES = exports.PLUGIN_ACTIONS = exports.CORE_ACTIONS = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Defines which actions are considered "core" and will remain in the main
|
|
9
|
+
* kist package. All other actions should be moved to separate plugin packages.
|
|
10
|
+
*
|
|
11
|
+
* Core Actions (Lightweight essentials):
|
|
12
|
+
* - Directory operations (create, copy, clean)
|
|
13
|
+
* - File operations (copy, rename)
|
|
14
|
+
* - Version management
|
|
15
|
+
* - Template rendering (lightweight)
|
|
16
|
+
*
|
|
17
|
+
* Plugin Actions (Move to separate repos):
|
|
18
|
+
* - StyleProcessingAction -> @kist/action-sass
|
|
19
|
+
* - TypeScriptCompilerAction -> @kist/action-typescript
|
|
20
|
+
* - JavaScriptMinifyAction -> @kist/action-terser
|
|
21
|
+
* - SvgPackagerAction -> @kist/action-svg
|
|
22
|
+
* - SvgSpriteAction -> @kist/action-svg
|
|
23
|
+
* - SvgToPngAction -> @kist/action-svg
|
|
24
|
+
* - SvgReaderAction -> @kist/action-svg
|
|
25
|
+
* - LintAction -> @kist/action-lint
|
|
26
|
+
* - DocumentationAction -> @kist/action-docs
|
|
27
|
+
* - PackageManagerAction -> @kist/action-package-manager
|
|
28
|
+
* - RunScriptAction -> @kist/action-scripts
|
|
29
|
+
*/
|
|
30
|
+
exports.CORE_ACTIONS = [
|
|
31
|
+
"DirectoryCleanAction",
|
|
32
|
+
"DirectoryCopyAction",
|
|
33
|
+
"DirectoryCreateAction",
|
|
34
|
+
"FileCopyAction",
|
|
35
|
+
"FileRenameAction",
|
|
36
|
+
"TemplateRenderAction",
|
|
37
|
+
"VersionWriteAction",
|
|
38
|
+
];
|
|
39
|
+
exports.PLUGIN_ACTIONS = [
|
|
40
|
+
// @kist/action-sass
|
|
41
|
+
"StyleProcessingAction",
|
|
42
|
+
// @kist/action-typescript
|
|
43
|
+
"TypeScriptCompilerAction",
|
|
44
|
+
// @kist/action-terser
|
|
45
|
+
"JavaScriptMinifyAction",
|
|
46
|
+
// @kist/action-svg
|
|
47
|
+
"SvgPackagerAction",
|
|
48
|
+
"SvgReaderAction",
|
|
49
|
+
"SvgSpriteAction",
|
|
50
|
+
"SvgToPngAction",
|
|
51
|
+
// @kist/action-lint
|
|
52
|
+
"LintAction",
|
|
53
|
+
// @kist/action-docs
|
|
54
|
+
"DocumentationAction",
|
|
55
|
+
// @kist/action-package-manager
|
|
56
|
+
"PackageManagerAction",
|
|
57
|
+
// @kist/action-scripts
|
|
58
|
+
"RunScriptAction",
|
|
59
|
+
];
|
|
60
|
+
/**
|
|
61
|
+
* Plugin package mappings for migration guide
|
|
62
|
+
*/
|
|
63
|
+
exports.PLUGIN_PACKAGES = {
|
|
64
|
+
StyleProcessingAction: {
|
|
65
|
+
package: "@kist/action-sass",
|
|
66
|
+
npm: "npm install --save-dev @kist/action-sass",
|
|
67
|
+
github: "https://github.com/getkist/action-sass",
|
|
68
|
+
},
|
|
69
|
+
TypeScriptCompilerAction: {
|
|
70
|
+
package: "@kist/action-typescript",
|
|
71
|
+
npm: "npm install --save-dev @kist/action-typescript",
|
|
72
|
+
github: "https://github.com/getkist/action-typescript",
|
|
73
|
+
},
|
|
74
|
+
JavaScriptMinifyAction: {
|
|
75
|
+
package: "@kist/action-terser",
|
|
76
|
+
npm: "npm install --save-dev @kist/action-terser",
|
|
77
|
+
github: "https://github.com/getkist/action-terser",
|
|
78
|
+
},
|
|
79
|
+
SvgPackagerAction: {
|
|
80
|
+
package: "@kist/action-svg",
|
|
81
|
+
npm: "npm install --save-dev @kist/action-svg",
|
|
82
|
+
github: "https://github.com/getkist/action-svg",
|
|
83
|
+
},
|
|
84
|
+
SvgReaderAction: {
|
|
85
|
+
package: "@kist/action-svg",
|
|
86
|
+
npm: "npm install --save-dev @kist/action-svg",
|
|
87
|
+
github: "https://github.com/getkist/action-svg",
|
|
88
|
+
},
|
|
89
|
+
SvgSpriteAction: {
|
|
90
|
+
package: "@kist/action-svg",
|
|
91
|
+
npm: "npm install --save-dev @kist/action-svg",
|
|
92
|
+
github: "https://github.com/getkist/action-svg",
|
|
93
|
+
},
|
|
94
|
+
SvgToPngAction: {
|
|
95
|
+
package: "@kist/action-svg",
|
|
96
|
+
npm: "npm install --save-dev @kist/action-svg",
|
|
97
|
+
github: "https://github.com/getkist/action-svg",
|
|
98
|
+
},
|
|
99
|
+
LintAction: {
|
|
100
|
+
package: "@kist/action-lint",
|
|
101
|
+
npm: "npm install --save-dev @kist/action-lint",
|
|
102
|
+
github: "https://github.com/getkist/action-lint",
|
|
103
|
+
},
|
|
104
|
+
DocumentationAction: {
|
|
105
|
+
package: "@kist/action-docs",
|
|
106
|
+
npm: "npm install --save-dev @kist/action-docs",
|
|
107
|
+
github: "https://github.com/getkist/action-docs",
|
|
108
|
+
},
|
|
109
|
+
PackageManagerAction: {
|
|
110
|
+
package: "@kist/action-package-manager",
|
|
111
|
+
npm: "npm install --save-dev @kist/action-package-manager",
|
|
112
|
+
github: "https://github.com/getkist/action-package-manager",
|
|
113
|
+
},
|
|
114
|
+
RunScriptAction: {
|
|
115
|
+
package: "@kist/action-scripts",
|
|
116
|
+
npm: "npm install --save-dev @kist/action-scripts",
|
|
117
|
+
github: "https://github.com/getkist/action-scripts",
|
|
118
|
+
},
|
|
119
|
+
};
|
|
@@ -68,7 +68,7 @@ class ConfigLoader extends AbstractProcess_1.AbstractProcess {
|
|
|
68
68
|
this.logDebug(`Configuration file found: ${resolvedPath}`);
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
catch (
|
|
71
|
+
catch (_error) {
|
|
72
72
|
this.logDebug(`File not accessible: ${resolvedPath}`);
|
|
73
73
|
// ❗ If user explicitly provided --config and it fails, stop immediately
|
|
74
74
|
if (cliPath) {
|
|
@@ -79,35 +79,6 @@ class ConfigLoader extends AbstractProcess_1.AbstractProcess {
|
|
|
79
79
|
this.logWarn("No configuration file found. Proceeding with default settings.");
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
// public async initialize(): Promise<void> {
|
|
83
|
-
// const parser = new ArgumentParser();
|
|
84
|
-
// const cliFlags = parser.getAllFlags();
|
|
85
|
-
// const cliPath =
|
|
86
|
-
// typeof cliFlags.config === "string" ? cliFlags.config : undefined;
|
|
87
|
-
// const searchPaths = cliPath ? [cliPath] : this.defaultFilenames;
|
|
88
|
-
// this.logDebug(`Current working directory: ${process.cwd()}`);
|
|
89
|
-
// this.logDebug(
|
|
90
|
-
// `Searching for config file${cliPath ? ` from --config=${cliPath}` : ""}...`,
|
|
91
|
-
// );
|
|
92
|
-
// for (const fileName of searchPaths) {
|
|
93
|
-
// const resolvedPath = path.resolve(process.cwd(), fileName);
|
|
94
|
-
// this.logDebug(`Checking: ${resolvedPath}`);
|
|
95
|
-
// try {
|
|
96
|
-
// await fs.promises.access(
|
|
97
|
-
// resolvedPath,
|
|
98
|
-
// fs.constants.F_OK | fs.constants.R_OK,
|
|
99
|
-
// );
|
|
100
|
-
// this.configPath = resolvedPath;
|
|
101
|
-
// this.logDebug(`Configuration file found: ${resolvedPath}`);
|
|
102
|
-
// return;
|
|
103
|
-
// } catch (error) {
|
|
104
|
-
// this.logDebug(`File not accessible: ${resolvedPath}`);
|
|
105
|
-
// }
|
|
106
|
-
// }
|
|
107
|
-
// this.logWarn(
|
|
108
|
-
// "No configuration file found. Proceeding with default settings.",
|
|
109
|
-
// );
|
|
110
|
-
// }
|
|
111
82
|
/**
|
|
112
83
|
* Loads and validates the configuration file.
|
|
113
84
|
*
|
|
@@ -28,7 +28,7 @@ export declare abstract class Action extends AbstractProcess implements ActionIn
|
|
|
28
28
|
* @returns A boolean indicating whether the options are valid. Default
|
|
29
29
|
* implementation always returns true.
|
|
30
30
|
*/
|
|
31
|
-
validateOptions(
|
|
31
|
+
validateOptions(_options: ActionOptionsType): boolean;
|
|
32
32
|
/**
|
|
33
33
|
* Abstract method that must be implemented by derived classes to perform
|
|
34
34
|
* the action"s main logic.
|
|
@@ -45,7 +45,7 @@ class Action extends AbstractProcess_1.AbstractProcess {
|
|
|
45
45
|
* @returns A boolean indicating whether the options are valid. Default
|
|
46
46
|
* implementation always returns true.
|
|
47
47
|
*/
|
|
48
|
-
validateOptions(
|
|
48
|
+
validateOptions(_options) {
|
|
49
49
|
// Default validation: always returns true, can be overridden in
|
|
50
50
|
// derived classes
|
|
51
51
|
return true;
|
|
@@ -71,7 +71,11 @@ export declare class ActionRegistry extends AbstractProcess {
|
|
|
71
71
|
* actions as needed.
|
|
72
72
|
*/
|
|
73
73
|
private registerCoreActions;
|
|
74
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Registers actions from loaded plugins via PluginManager.
|
|
76
|
+
* This method integrates the plugin system with the action registry.
|
|
77
|
+
*/
|
|
78
|
+
private registerPluginActions;
|
|
75
79
|
/**
|
|
76
80
|
* Clears all registered actions in the registry.
|
|
77
81
|
* Useful for testing or resetting the pipeline.
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
// ============================================================================
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ActionRegistry = void 0;
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const path_1 = require("path");
|
|
9
7
|
const CoreActions_1 = require("../../actions/CoreActions");
|
|
10
8
|
const AbstractProcess_1 = require("../abstract/AbstractProcess");
|
|
9
|
+
const PluginManager_1 = require("../plugin/PluginManager");
|
|
11
10
|
// ============================================================================
|
|
12
11
|
// Class
|
|
13
12
|
// ============================================================================
|
|
@@ -30,7 +29,8 @@ class ActionRegistry extends AbstractProcess_1.AbstractProcess {
|
|
|
30
29
|
this.registry = new Map();
|
|
31
30
|
// Automatically register core actions
|
|
32
31
|
this.registerCoreActions();
|
|
33
|
-
|
|
32
|
+
// Register plugin actions via PluginManager
|
|
33
|
+
this.registerPluginActions();
|
|
34
34
|
this.logInfo("ActionRegistry initialized.");
|
|
35
35
|
}
|
|
36
36
|
// Singleton Methods
|
|
@@ -135,32 +135,23 @@ class ActionRegistry extends AbstractProcess_1.AbstractProcess {
|
|
|
135
135
|
});
|
|
136
136
|
this.logInfo("Core actions registered successfully.");
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const actions = plugin.registerActions();
|
|
153
|
-
for (const [name, actionClass] of Object.entries(actions)) {
|
|
154
|
-
this.registerAction(actionClass);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
138
|
+
/**
|
|
139
|
+
* Registers actions from loaded plugins via PluginManager.
|
|
140
|
+
* This method integrates the plugin system with the action registry.
|
|
141
|
+
*/
|
|
142
|
+
registerPluginActions() {
|
|
143
|
+
const pluginManager = PluginManager_1.PluginManager.getInstance();
|
|
144
|
+
const pluginActions = pluginManager.getPluginActions();
|
|
145
|
+
for (const [actionName, actionClass] of pluginActions.entries()) {
|
|
146
|
+
try {
|
|
147
|
+
this.registerAction(actionClass);
|
|
148
|
+
this.logDebug(`Registered plugin action: ${actionName}`);
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
this.logError(`Failed to register plugin action ${actionName}:`, error);
|
|
158
152
|
}
|
|
159
|
-
this.logInfo("Plugins loaded successfully.");
|
|
160
|
-
}
|
|
161
|
-
catch (error) {
|
|
162
|
-
this.logError("Failed to discover plugins.", error);
|
|
163
153
|
}
|
|
154
|
+
this.logInfo(`Registered ${pluginActions.size} actions from plugins.`);
|
|
164
155
|
}
|
|
165
156
|
/**
|
|
166
157
|
* Clears all registered actions in the registry.
|
package/js/core/pipeline/Step.js
CHANGED
|
@@ -44,7 +44,7 @@ class Step extends AbstractProcess_1.AbstractProcess {
|
|
|
44
44
|
// const ActionClass = actionRegistry.getAction(step.action.name);
|
|
45
45
|
const ActionClass = actionRegistry.getAction(String(step.action));
|
|
46
46
|
if (!ActionClass) {
|
|
47
|
-
|
|
47
|
+
const msg = `
|
|
48
48
|
Unknown action "${step.action}" for step "${this.name}".
|
|
49
49
|
Ensure the action is registered in the registry.
|
|
50
50
|
`;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ActionInterface } from "../../interface/ActionInterface";
|
|
2
|
+
import { ActionPlugin } from "../../interface/ActionPlugin";
|
|
3
|
+
import { PluginMetadata } from "../../interface/PluginMetadata";
|
|
4
|
+
import { AbstractProcess } from "../abstract/AbstractProcess";
|
|
5
|
+
/**
|
|
6
|
+
* PluginManager handles discovery, loading, and lifecycle of kist plugins.
|
|
7
|
+
* Supports both npm-installed plugins (@kist/plugin-*) and local plugins.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PluginManager extends AbstractProcess {
|
|
10
|
+
private static instance;
|
|
11
|
+
private loadedPlugins;
|
|
12
|
+
private pluginActions;
|
|
13
|
+
private constructor();
|
|
14
|
+
static getInstance(): PluginManager;
|
|
15
|
+
static resetInstance(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Discovers and loads all available plugins from:
|
|
18
|
+
* - node_modules/@kist/plugin-*
|
|
19
|
+
* - node_modules/kist-plugin-*
|
|
20
|
+
* - Local plugins directory (if configured)
|
|
21
|
+
*/
|
|
22
|
+
discoverPlugins(options?: {
|
|
23
|
+
localPluginsPath?: string;
|
|
24
|
+
pluginPrefixes?: string[];
|
|
25
|
+
}): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Discovers plugins installed via npm with specified prefixes
|
|
28
|
+
*/
|
|
29
|
+
private discoverNpmPlugins;
|
|
30
|
+
/**
|
|
31
|
+
* Discovers plugins in scoped packages (@kist/*)
|
|
32
|
+
*/
|
|
33
|
+
private discoverScopedPlugins;
|
|
34
|
+
/**
|
|
35
|
+
* Discovers plugins from a local directory
|
|
36
|
+
*/
|
|
37
|
+
private discoverLocalPlugins;
|
|
38
|
+
/**
|
|
39
|
+
* Loads a single plugin from the specified path
|
|
40
|
+
*/
|
|
41
|
+
private loadPlugin;
|
|
42
|
+
/**
|
|
43
|
+
* Manually register a plugin programmatically
|
|
44
|
+
*/
|
|
45
|
+
registerPlugin(plugin: ActionPlugin, name: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Gets all actions from loaded plugins
|
|
48
|
+
*/
|
|
49
|
+
getPluginActions(): Map<string, new () => ActionInterface>;
|
|
50
|
+
/**
|
|
51
|
+
* Gets metadata for all loaded plugins
|
|
52
|
+
*/
|
|
53
|
+
getLoadedPlugins(): PluginMetadata[];
|
|
54
|
+
/**
|
|
55
|
+
* Gets metadata for a specific plugin
|
|
56
|
+
*/
|
|
57
|
+
getPluginMetadata(name: string): PluginMetadata | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Checks if a specific plugin is loaded
|
|
60
|
+
*/
|
|
61
|
+
isPluginLoaded(name: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Lists all action names from plugins
|
|
64
|
+
*/
|
|
65
|
+
listPluginActions(): string[];
|
|
66
|
+
/**
|
|
67
|
+
* Clears all loaded plugins and their actions
|
|
68
|
+
*/
|
|
69
|
+
clearPlugins(): void;
|
|
70
|
+
}
|