kist 0.1.45 → 0.1.58

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.
Files changed (38) hide show
  1. package/js/actions/DirectoryCleanAction/DirectoryCleanAction.js +2 -2
  2. package/js/actions/SvgPackagerAction/SvgPackagerAction.js +2 -2
  3. package/js/actions/TemplateRenderAction/TemplateRenderAction.js +1 -1
  4. package/js/actions/VersionWriteAction/VersionWriteAction.js +2 -2
  5. package/js/config/actions.config.d.ts +35 -0
  6. package/js/config/actions.config.js +119 -0
  7. package/js/core/config/ConfigLoader.js +1 -30
  8. package/js/core/pipeline/Action.d.ts +1 -1
  9. package/js/core/pipeline/Action.js +1 -1
  10. package/js/core/pipeline/ActionRegistry.d.ts +5 -1
  11. package/js/core/pipeline/ActionRegistry.js +18 -27
  12. package/js/core/pipeline/Step.js +1 -1
  13. package/js/core/plugin/PluginManager.d.ts +70 -0
  14. package/js/core/plugin/PluginManager.js +288 -0
  15. package/js/index.d.ts +7 -0
  16. package/js/index.js +14 -1
  17. package/js/interface/ActionPlugin.d.ts +43 -0
  18. package/js/interface/PluginMetadata.d.ts +33 -0
  19. package/js/interface/PluginMetadata.js +5 -0
  20. package/js/kist.js +25 -4
  21. package/package.json +17 -9
  22. package/ts/actions/DirectoryCleanAction/DirectoryCleanAction.ts +2 -2
  23. package/ts/actions/StyleProcessingAction/postcss.config.expanded.ts +0 -1
  24. package/ts/actions/SvgPackagerAction/SvgPackagerAction.ts +2 -2
  25. package/ts/actions/TemplateRenderAction/TemplateRenderAction.ts +1 -1
  26. package/ts/actions/VersionWriteAction/VersionWriteAction.ts +6 -2
  27. package/ts/config/actions.config.ts +137 -0
  28. package/ts/core/config/ConfigLoader.ts +1 -35
  29. package/ts/core/config/ConfigStore copy.ts +27 -1
  30. package/ts/core/pipeline/Action.ts +1 -1
  31. package/ts/core/pipeline/ActionRegistry.ts +22 -36
  32. package/ts/core/pipeline/Step.ts +1 -1
  33. package/ts/core/plugin/PluginManager.ts +310 -0
  34. package/ts/index.ts +25 -0
  35. package/ts/interface/ActionPlugin.ts +48 -1
  36. package/ts/interface/PluginMetadata.ts +43 -0
  37. package/ts/interface/SVG.ts +2 -0
  38. package/ts/kist.ts +25 -2
@@ -8,7 +8,54 @@ import { ActionInterface } from "./ActionInterface";
8
8
  // Interfaces
9
9
  // ============================================================================
10
10
 
11
- // ActionPlugin.ts
11
+ /**
12
+ * ActionPlugin defines the contract for kist plugins.
13
+ * Plugins can provide one or more actions to extend kist's functionality.
14
+ *
15
+ * Example plugin structure:
16
+ * ```typescript
17
+ * import { ActionPlugin, ActionInterface } from 'kist';
18
+ *
19
+ * export default {
20
+ * version: '1.0.0',
21
+ * description: 'My custom kist plugin',
22
+ * registerActions() {
23
+ * return {
24
+ * 'MyCustomAction': MyCustomAction
25
+ * };
26
+ * }
27
+ * } as ActionPlugin;
28
+ * ```
29
+ */
12
30
  export interface ActionPlugin {
31
+ /**
32
+ * Returns a record of action classes provided by this plugin.
33
+ * Keys are action names, values are action class constructors.
34
+ */
13
35
  registerActions(): Record<string, new () => ActionInterface>;
36
+
37
+ /**
38
+ * Optional: Plugin version (semantic versioning recommended)
39
+ */
40
+ version?: string;
41
+
42
+ /**
43
+ * Optional: Plugin description
44
+ */
45
+ description?: string;
46
+
47
+ /**
48
+ * Optional: Plugin author information
49
+ */
50
+ author?: string;
51
+
52
+ /**
53
+ * Optional: Plugin repository URL
54
+ */
55
+ repository?: string;
56
+
57
+ /**
58
+ * Optional: Keywords for plugin discoverability
59
+ */
60
+ keywords?: string[];
14
61
  }
@@ -0,0 +1,43 @@
1
+ // ============================================================================
2
+ // Interface
3
+ // ============================================================================
4
+
5
+ /**
6
+ * Metadata for a loaded plugin
7
+ */
8
+ export interface PluginMetadata {
9
+ /**
10
+ * The unique name of the plugin
11
+ */
12
+ name: string;
13
+
14
+ /**
15
+ * The version of the plugin
16
+ */
17
+ version: string;
18
+
19
+ /**
20
+ * Optional description of the plugin
21
+ */
22
+ description?: string;
23
+
24
+ /**
25
+ * List of action names provided by this plugin
26
+ */
27
+ actions: string[];
28
+
29
+ /**
30
+ * Optional author information
31
+ */
32
+ author?: string;
33
+
34
+ /**
35
+ * Optional repository URL
36
+ */
37
+ repository?: string;
38
+
39
+ /**
40
+ * Optional keywords for discoverability
41
+ */
42
+ keywords?: string[];
43
+ }
@@ -62,6 +62,7 @@ interface SvgPath {
62
62
  /**
63
63
  * Example usage of the Svg interface.
64
64
  */
65
+ /*
65
66
  const exampleSvg: Svg = {
66
67
  metadata: {
67
68
  name: "Example SVG",
@@ -82,3 +83,4 @@ const exampleSvg: Svg = {
82
83
  },
83
84
  ],
84
85
  };
86
+ */
package/ts/kist.ts CHANGED
@@ -6,6 +6,7 @@ import { AbstractProcess } from "./core/abstract/AbstractProcess";
6
6
  import { ConfigStore } from "./core/config/ConfigStore";
7
7
  import { ActionRegistry } from "./core/pipeline/ActionRegistry";
8
8
  import { PipelineManager } from "./core/pipeline/PipelineManager";
9
+ import { PluginManager } from "./core/plugin/PluginManager";
9
10
  import { LiveServer } from "./live/LiveServer";
10
11
  import { LiveWatcher } from "./live/LiveWatcher";
11
12
 
@@ -50,7 +51,7 @@ export class Kist extends AbstractProcess {
50
51
 
51
52
  try {
52
53
  // Initialize the ActionRegistry with available actions
53
- this.initializeActionRegistry();
54
+ await this.initializeActionRegistry();
54
55
 
55
56
  // Create and run the PipelineManager
56
57
  const liveReloadEnabled = ConfigStore.getInstance().get<boolean>(
@@ -76,7 +77,29 @@ export class Kist extends AbstractProcess {
76
77
  * Initializes the ActionRegistry with available actions.
77
78
  * Automatically registers core actions and discovers external plugins.
78
79
  */
79
- private initializeActionRegistry(): void {
80
+ private async initializeActionRegistry(): Promise<void> {
81
+ this.logInfo("Initializing plugin system...");
82
+
83
+ // Initialize and discover plugins first
84
+ const pluginManager = PluginManager.getInstance();
85
+ await pluginManager.discoverPlugins({
86
+ pluginPrefixes: ["@getkist/action-", "kist-plugin-"],
87
+ });
88
+
89
+ // Log loaded plugins
90
+ const plugins = pluginManager.getLoadedPlugins();
91
+ if (plugins.length > 0) {
92
+ this.logInfo(`Loaded ${plugins.length} plugin(s):`);
93
+ plugins.forEach((plugin) => {
94
+ this.logInfo(
95
+ ` - ${plugin.name} v${plugin.version} (${plugin.actions.length} actions)`,
96
+ );
97
+ });
98
+ } else {
99
+ this.logDebug("No external plugins found.");
100
+ }
101
+
102
+ // Initialize ActionRegistry (will register core + plugin actions)
80
103
  this.logInfo("Initializing ActionRegistry...");
81
104
  ActionRegistry.initialize();
82
105
  this.logInfo("ActionRegistry initialized successfully.");