kist 0.0.0 → 0.1.31

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 (237) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +298 -3
  3. package/js/actions/CoreActions.d.ts +6 -0
  4. package/js/actions/CoreActions.js +47 -0
  5. package/js/actions/DirectoryCleanAction/DirectoryCleanAction.d.ts +36 -0
  6. package/js/actions/DirectoryCleanAction/DirectoryCleanAction.js +123 -0
  7. package/js/actions/DirectoryCleanAction/index.d.ts +2 -0
  8. package/js/actions/DirectoryCleanAction/index.js +8 -0
  9. package/js/actions/DirectoryCopyAction/DirectoryCopyAction.d.ts +42 -0
  10. package/js/actions/DirectoryCopyAction/DirectoryCopyAction.js +118 -0
  11. package/js/actions/DirectoryCopyAction/index.d.ts +2 -0
  12. package/js/actions/DirectoryCopyAction/index.js +8 -0
  13. package/js/actions/DirectoryCreateAction/DirectoryCreateAction.d.ts +30 -0
  14. package/js/actions/DirectoryCreateAction/DirectoryCreateAction.js +85 -0
  15. package/js/actions/DirectoryCreateAction/index.d.ts +2 -0
  16. package/js/actions/DirectoryCreateAction/index.js +8 -0
  17. package/js/actions/DocumentationAction/DocumentationAction.d.ts +23 -0
  18. package/js/actions/DocumentationAction/DocumentationAction.js +88 -0
  19. package/js/actions/DocumentationAction/index.d.ts +2 -0
  20. package/js/actions/DocumentationAction/index.js +8 -0
  21. package/js/actions/FileCopyAction/FileCopyAction.d.ts +42 -0
  22. package/js/actions/FileCopyAction/FileCopyAction.js +127 -0
  23. package/js/actions/FileCopyAction/index.d.ts +2 -0
  24. package/js/actions/FileCopyAction/index.js +8 -0
  25. package/js/actions/FileRenameAction/FileRenameAction.d.ts +30 -0
  26. package/js/actions/FileRenameAction/FileRenameAction.js +84 -0
  27. package/js/actions/FileRenameAction/index.d.ts +2 -0
  28. package/js/actions/FileRenameAction/index.js +8 -0
  29. package/js/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.d.ts +31 -0
  30. package/js/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.js +98 -0
  31. package/js/actions/JavaScriptMinifyAction/index.d.ts +2 -0
  32. package/js/actions/JavaScriptMinifyAction/index.js +8 -0
  33. package/js/actions/JavaScriptMinifyAction/terser.config.d.ts +27 -0
  34. package/js/actions/JavaScriptMinifyAction/terser.config.js +119 -0
  35. package/js/actions/LintAction/LintAction.d.ts +17 -0
  36. package/js/actions/LintAction/LintAction.js +63 -0
  37. package/js/actions/LintAction/index.d.ts +2 -0
  38. package/js/actions/LintAction/index.js +8 -0
  39. package/js/actions/PackageManagerAction/PackageManagerAction.d.ts +57 -0
  40. package/js/actions/PackageManagerAction/PackageManagerAction.js +161 -0
  41. package/js/actions/PackageManagerAction/index.d.ts +2 -0
  42. package/js/actions/PackageManagerAction/index.js +8 -0
  43. package/js/actions/PackageManagerAction/package.config.d.ts +16 -0
  44. package/js/actions/PackageManagerAction/package.config.js +91 -0
  45. package/js/actions/StyleProcessingAction/StyleProcessingAction.d.ts +34 -0
  46. package/js/actions/StyleProcessingAction/StyleProcessingAction.js +164 -0
  47. package/js/actions/StyleProcessingAction/index.d.ts +2 -0
  48. package/js/actions/StyleProcessingAction/index.js +8 -0
  49. package/js/actions/StyleProcessingAction/postcss.config.compressed.d.ts +10 -0
  50. package/js/actions/StyleProcessingAction/postcss.config.compressed.js +31 -0
  51. package/js/actions/StyleProcessingAction/postcss.config.expanded.d.ts +16 -0
  52. package/js/actions/StyleProcessingAction/postcss.config.expanded.js +45 -0
  53. package/js/actions/SvgPackagerAction/SvgPackagerAction.d.ts +68 -0
  54. package/js/actions/SvgPackagerAction/SvgPackagerAction.js +186 -0
  55. package/js/actions/SvgPackagerAction/index.d.ts +2 -0
  56. package/js/actions/SvgPackagerAction/index.js +8 -0
  57. package/js/actions/SvgReaderAction/SvgReaderAction.d.ts +32 -0
  58. package/js/actions/SvgReaderAction/SvgReaderAction.js +87 -0
  59. package/js/actions/SvgReaderAction/index.d.ts +2 -0
  60. package/js/actions/SvgReaderAction/index.js +8 -0
  61. package/js/actions/SvgSpriteAction/SvgSpriteAction.d.ts +37 -0
  62. package/js/actions/SvgSpriteAction/SvgSpriteAction.js +114 -0
  63. package/js/actions/SvgSpriteAction/index.d.ts +2 -0
  64. package/js/actions/SvgSpriteAction/index.js +8 -0
  65. package/js/actions/SvgSpriteAction/svgsprite.config.d.ts +3 -0
  66. package/js/actions/SvgSpriteAction/svgsprite.config.js +117 -0
  67. package/js/actions/SvgToPngAction/SvgToPngAction.d.ts +28 -0
  68. package/js/actions/SvgToPngAction/SvgToPngAction.js +108 -0
  69. package/js/actions/SvgToPngAction/index.d.ts +2 -0
  70. package/js/actions/SvgToPngAction/index.js +8 -0
  71. package/js/actions/TypeScriptCompilerAction/TypeScriptCompilerAction.d.ts +28 -0
  72. package/js/actions/TypeScriptCompilerAction/TypeScriptCompilerAction.js +96 -0
  73. package/js/actions/TypeScriptCompilerAction/index.d.ts +2 -0
  74. package/js/actions/TypeScriptCompilerAction/index.js +8 -0
  75. package/js/actions/VersionWriteAction/VersionWriteAction.d.ts +45 -0
  76. package/js/actions/VersionWriteAction/VersionWriteAction.js +147 -0
  77. package/js/actions/VersionWriteAction/index.d.ts +2 -0
  78. package/js/actions/VersionWriteAction/index.js +8 -0
  79. package/js/cli/ArgumentParser.d.ts +62 -0
  80. package/js/cli/ArgumentParser.js +118 -0
  81. package/js/cli.d.ts +6 -0
  82. package/js/cli.js +58 -0
  83. package/js/core/abstract/AbstractProcess.d.ts +62 -0
  84. package/js/core/abstract/AbstractProcess.js +96 -0
  85. package/js/core/abstract/AbstractValidator.d.ts +72 -0
  86. package/js/core/abstract/AbstractValidator.js +128 -0
  87. package/js/core/config/ConfigLoader.d.ts +47 -0
  88. package/js/core/config/ConfigLoader.js +130 -0
  89. package/js/core/config/ConfigStore.d.ts +53 -0
  90. package/js/core/config/ConfigStore.js +136 -0
  91. package/js/core/config/defaultConfig.d.ts +5 -0
  92. package/js/core/config/defaultConfig.js +131 -0
  93. package/js/core/pipeline/Action.d.ts +60 -0
  94. package/js/core/pipeline/Action.js +77 -0
  95. package/js/core/pipeline/ActionRegistry.d.ts +80 -0
  96. package/js/core/pipeline/ActionRegistry.js +180 -0
  97. package/js/core/pipeline/Pipeline.d.ts +42 -0
  98. package/js/core/pipeline/Pipeline.js +107 -0
  99. package/js/core/pipeline/PipelineManager.d.ts +55 -0
  100. package/js/core/pipeline/PipelineManager.js +164 -0
  101. package/js/core/pipeline/Stage.d.ts +45 -0
  102. package/js/core/pipeline/Stage.js +110 -0
  103. package/js/core/pipeline/Step.d.ts +26 -0
  104. package/js/core/pipeline/Step.js +85 -0
  105. package/js/core/validation/OptionsValidator.d.ts +43 -0
  106. package/js/core/validation/OptionsValidator.js +123 -0
  107. package/js/index.d.ts +3 -0
  108. package/js/index.js +36 -0
  109. package/js/interface/ActionInterface.d.ts +57 -0
  110. package/js/interface/ActionInterface.js +5 -0
  111. package/js/interface/ActionPlugin.d.ts +4 -0
  112. package/js/interface/ActionPlugin.js +5 -0
  113. package/js/interface/ConfigInterface.d.ts +43 -0
  114. package/js/interface/ConfigInterface.js +5 -0
  115. package/js/interface/LiveOptionsInterface.d.ts +42 -0
  116. package/js/interface/LiveOptionsInterface.js +2 -0
  117. package/js/interface/MetadataInterface.d.ts +95 -0
  118. package/js/interface/MetadataInterface.js +2 -0
  119. package/js/interface/OptionsInterface.d.ts +45 -0
  120. package/js/interface/OptionsInterface.js +5 -0
  121. package/js/interface/PipelineOptionsInterface.d.ts +66 -0
  122. package/js/interface/PipelineOptionsInterface.js +5 -0
  123. package/js/interface/StageInterface.d.ts +79 -0
  124. package/js/interface/StageInterface.js +5 -0
  125. package/js/interface/StepInterface.d.ts +66 -0
  126. package/js/interface/StepInterface.js +5 -0
  127. package/js/interface/StepOptionsInterface.d.ts +38 -0
  128. package/js/interface/StepOptionsInterface.js +21 -0
  129. package/js/interface/index.d.ts +7 -0
  130. package/js/interface/index.js +3 -0
  131. package/js/kist.d.ts +58 -0
  132. package/js/kist.js +145 -0
  133. package/js/live/LiveServer.d.ts +95 -0
  134. package/js/live/LiveServer.js +233 -0
  135. package/js/live/LiveWatcher.d.ts +45 -0
  136. package/js/live/LiveWatcher.js +140 -0
  137. package/js/logger/Logger.d.ts +94 -0
  138. package/js/logger/Logger.js +151 -0
  139. package/js/logger/LoggerStyles.d.ts +23 -0
  140. package/js/logger/LoggerStyles.js +30 -0
  141. package/js/types/ActionOptionsType.d.ts +8 -0
  142. package/js/types/ActionOptionsType.js +2 -0
  143. package/js/types/index.d.ts +1 -0
  144. package/js/types/index.js +3 -0
  145. package/package.json +93 -7
  146. package/ts/actions/CoreActions.ts +64 -0
  147. package/ts/actions/DirectoryCleanAction/DirectoryCleanAction.ts +121 -0
  148. package/ts/actions/DirectoryCleanAction/index.ts +11 -0
  149. package/ts/actions/DirectoryCopyAction/DirectoryCopyAction.ts +118 -0
  150. package/ts/actions/DirectoryCopyAction/index.ts +11 -0
  151. package/ts/actions/DirectoryCreateAction/DirectoryCreateAction.ts +81 -0
  152. package/ts/actions/DirectoryCreateAction/index.ts +11 -0
  153. package/ts/actions/DocumentationAction/DocumentationAction.ts +100 -0
  154. package/ts/actions/DocumentationAction/index.ts +11 -0
  155. package/ts/actions/FileCopyAction/FileCopyAction.ts +125 -0
  156. package/ts/actions/FileCopyAction/index.ts +11 -0
  157. package/ts/actions/FileRenameAction/FileRenameAction.ts +82 -0
  158. package/ts/actions/FileRenameAction/index.ts +11 -0
  159. package/ts/actions/JavaScriptMinifyAction/JavaScriptMinifyAction.ts +109 -0
  160. package/ts/actions/JavaScriptMinifyAction/index.ts +11 -0
  161. package/ts/actions/JavaScriptMinifyAction/terser.config.ts +177 -0
  162. package/ts/actions/LintAction/LintAction.ts +67 -0
  163. package/ts/actions/LintAction/index.ts +11 -0
  164. package/ts/actions/PackageManagerAction/PackageManagerAction.ts +176 -0
  165. package/ts/actions/PackageManagerAction/index.ts +11 -0
  166. package/ts/actions/PackageManagerAction/package.config.ts +94 -0
  167. package/ts/actions/SassDocAction/SassDocAction.ts +66 -0
  168. package/ts/actions/SassDocAction/index.ts +11 -0
  169. package/ts/actions/StyleProcessingAction/StyleProcessingAction.ts +142 -0
  170. package/ts/actions/StyleProcessingAction/index.ts +11 -0
  171. package/ts/actions/StyleProcessingAction/postcss.config.compressed.ts +31 -0
  172. package/ts/actions/StyleProcessingAction/postcss.config.expanded.ts +47 -0
  173. package/ts/actions/SvgPackagerAction/SvgPackagerAction.ts +187 -0
  174. package/ts/actions/SvgPackagerAction/index.ts +11 -0
  175. package/ts/actions/SvgReaderAction/SvgReaderAction.ts +77 -0
  176. package/ts/actions/SvgReaderAction/index.ts +11 -0
  177. package/ts/actions/SvgSpriteAction/SvgSpriteAction.ts +127 -0
  178. package/ts/actions/SvgSpriteAction/index.ts +11 -0
  179. package/ts/actions/SvgSpriteAction/svgsprite.config.ts +123 -0
  180. package/ts/actions/SvgToPngAction/SvgToPngAction.ts +113 -0
  181. package/ts/actions/SvgToPngAction/index.ts +11 -0
  182. package/ts/actions/TypeScriptCompilerAction/TypeScriptCompilerAction.ts +117 -0
  183. package/ts/actions/TypeScriptCompilerAction/index.ts +11 -0
  184. package/ts/actions/VersionWriteAction/VersionWriteAction.ts +174 -0
  185. package/ts/actions/VersionWriteAction/index.ts +11 -0
  186. package/ts/actions/index.ts +0 -0
  187. package/ts/cli/ArgumentParser.ts +150 -0
  188. package/ts/cli/index.ts +1 -0
  189. package/ts/cli.ts +56 -0
  190. package/ts/core/abstract/AbstractProcess.ts +109 -0
  191. package/ts/core/abstract/AbstractSingleton.ts +46 -0
  192. package/ts/core/abstract/AbstractValidator.ts +167 -0
  193. package/ts/core/abstract/index.ts +0 -0
  194. package/ts/core/config/ConfigLoader.ts +141 -0
  195. package/ts/core/config/ConfigStore copy.ts +201 -0
  196. package/ts/core/config/ConfigStore.ts +157 -0
  197. package/ts/core/config/defaultConfig.ts +154 -0
  198. package/ts/core/config/index.ts +0 -0
  199. package/ts/core/index.ts +34 -0
  200. package/ts/core/pipeline/Action.ts +101 -0
  201. package/ts/core/pipeline/ActionRegistry.ts +216 -0
  202. package/ts/core/pipeline/Pipeline.ts +121 -0
  203. package/ts/core/pipeline/PipelineManager.ts +170 -0
  204. package/ts/core/pipeline/Stage.ts +131 -0
  205. package/ts/core/pipeline/Step.ts +96 -0
  206. package/ts/core/pipeline/index.ts +0 -0
  207. package/ts/core/validation/ActionValidator.ts +97 -0
  208. package/ts/core/validation/ConfigValidator.ts +103 -0
  209. package/ts/core/validation/OptionsValidator.ts +179 -0
  210. package/ts/core/validation/StageValidator.ts +175 -0
  211. package/ts/core/validation/StepValidator.ts +203 -0
  212. package/ts/core/validation/index.ts +0 -0
  213. package/ts/index.ts +26 -0
  214. package/ts/interface/ActionInterface.ts +70 -0
  215. package/ts/interface/ActionPlugin.ts +14 -0
  216. package/ts/interface/ConfigInterface.ts +55 -0
  217. package/ts/interface/File.ts +24 -0
  218. package/ts/interface/LiveOptionsInterface.ts +46 -0
  219. package/ts/interface/MetadataInterface.ts +105 -0
  220. package/ts/interface/OptionsInterface.ts +58 -0
  221. package/ts/interface/PackageJson.ts +171 -0
  222. package/ts/interface/PipelineOptionsInterface.ts +74 -0
  223. package/ts/interface/SVG.ts +84 -0
  224. package/ts/interface/StageInterface.ts +96 -0
  225. package/ts/interface/StepInterface.ts +83 -0
  226. package/ts/interface/StepOptionsInterface.ts +57 -0
  227. package/ts/interface/index.ts +9 -0
  228. package/ts/kist.ts +161 -0
  229. package/ts/live/LiveServer.ts +311 -0
  230. package/ts/live/LiveWatcher.ts +150 -0
  231. package/ts/live/index.ts +11 -0
  232. package/ts/logger/Logger.ts +187 -0
  233. package/ts/logger/LoggerStyles.ts +28 -0
  234. package/ts/logger/index.ts +0 -0
  235. package/ts/types/ActionOptionsType.ts +10 -0
  236. package/ts/types/index.ts +3 -0
  237. package/index.js +0 -3
@@ -0,0 +1,95 @@
1
+ /**
2
+ * MetadataInterface provides contextual information about the pipeline
3
+ * configuration. This metadata is useful for tracking changes, documentation,
4
+ * and integration with external systems.
5
+ */
6
+ export interface MetadataInterface {
7
+ /**
8
+ * A human-readable name for the pipeline.
9
+ * Used for identification and reporting purposes.
10
+ *
11
+ * @example "Data Processing Pipeline"
12
+ */
13
+ name?: string;
14
+ /**
15
+ * The semantic version of the pipeline configuration.
16
+ * Helps in tracking changes, maintaining compatibility, and managing
17
+ * different setups.
18
+ *
19
+ * @example "1.0.0"
20
+ */
21
+ version?: string;
22
+ /**
23
+ * A detailed description outlining the pipeline's purpose, objectives,
24
+ * or key features.
25
+ * Useful for providing context to users and maintainers.
26
+ *
27
+ * @example "A pipeline for processing and analyzing large datasets,
28
+ * including ETL operations."
29
+ */
30
+ description?: string;
31
+ /**
32
+ * The author or owner of the pipeline configuration.
33
+ * Can include details such as name, email, or organization.
34
+ *
35
+ * @example "John Doe <john.doe@example.com>"
36
+ */
37
+ author?: string;
38
+ /**
39
+ * A collection of arbitrary key-value pairs to further describe the
40
+ * pipeline configuration. This can be used for categorization or
41
+ * custom metadata.
42
+ *
43
+ * @example { category: "ETL", team: "Data Engineering" }
44
+ */
45
+ tags?: Record<string, string>;
46
+ /**
47
+ * A timestamp indicating when the configuration was created or last
48
+ * updated. Should follow the ISO 8601 format (e.g.,
49
+ * "2024-01-01T12:00:00Z").
50
+ *
51
+ * @example "2024-01-01T12:00:00Z"
52
+ */
53
+ timestamp?: string;
54
+ /**
55
+ * The license under which the pipeline configuration is shared or used.
56
+ * This defines the terms and conditions for using the configuration.
57
+ *
58
+ * @example "MIT"
59
+ * @example "GPL-3.0"
60
+ */
61
+ license?: string;
62
+ /**
63
+ * A URL pointing to documentation or additional resources related to
64
+ * the pipeline.
65
+ * Can include links to GitHub repos, wikis, or help pages.
66
+ *
67
+ * @example "https://github.com/username/repo"
68
+ */
69
+ documentation?: string;
70
+ /**
71
+ * Contact information for questions or support regarding the pipeline
72
+ * configuration.
73
+ * This can include an email address, a support page URL, or a
74
+ * team/organization name.
75
+ *
76
+ * @example "support@example.com"
77
+ * @example "https://example.com/support"
78
+ */
79
+ contact?: string;
80
+ /**
81
+ * Dependencies or related systems required by the pipeline configuration.
82
+ * Useful for tracking external systems or tools that interact with this
83
+ * pipeline.
84
+ *
85
+ * @example ["Node.js >=14.0", "Docker >=20.10"]
86
+ */
87
+ dependencies?: string[];
88
+ /**
89
+ * A list of intended runtime environment(s) for the pipeline.
90
+ * This helps clarify where the pipeline is designed to be executed.
91
+ *
92
+ * @example ["local", "CI/CD", "staging", "production"]
93
+ */
94
+ environments?: string[];
95
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,45 @@
1
+ import { LiveOptionsInterface } from "./LiveOptionsInterface";
2
+ import { PipelineOptionsInterface } from "./PipelineOptionsInterface";
3
+ /**
4
+ * OptionsInterface represents the global configuration options that
5
+ * apply to the entire pipeline. These settings provide overarching controls
6
+ * that affect how all stages and steps within the pipeline operate.
7
+ */
8
+ export interface OptionsInterface {
9
+ /**
10
+ * Configuration settings for live reload functionality, enabling
11
+ * real-time updates during development.
12
+ */
13
+ live?: LiveOptionsInterface;
14
+ /**
15
+ * Pipeline-specific configuration options.
16
+ */
17
+ pipeline?: PipelineOptionsInterface;
18
+ /**
19
+ * Path to the configuration file. This can be used to override default
20
+ * or automatically located configuration files.
21
+ *
22
+ * @example "./config/pack.yaml"
23
+ */
24
+ configPath?: string;
25
+ /**
26
+ * Specifies the level of logging to be used throughout the pipeline.
27
+ *
28
+ * The available levels are:
29
+ * - "debug": Provides detailed logging, useful for debugging and
30
+ * tracing execution flow.
31
+ * - "info": Standard logging level, providing key information about
32
+ * pipeline progress and outcomes.
33
+ * - "warn": Logs only warnings and errors, useful for highlighting
34
+ * potential issues without excessive details.
35
+ * - "error": Logs only errors, minimizing output to essential problem
36
+ * notifications. Default is "info".
37
+ *
38
+ * @default "info"
39
+ */
40
+ logLevel?: "debug" | "info" | "warn" | "error";
41
+ /**
42
+ * Additional properties can be included dynamically.
43
+ */
44
+ [key: string]: unknown;
45
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,66 @@
1
+ /**
2
+ * PipelineOptionsInterface defines settings for managing the pipeline's
3
+ * execution behavior, including timeouts, failure handling, concurrency,
4
+ * and retry strategies.
5
+ */
6
+ export interface PipelineOptionsInterface {
7
+ /**
8
+ * Default timeout in milliseconds for each step within the pipeline.
9
+ *
10
+ * If a step exceeds this duration, it will be forcibly terminated to
11
+ * prevent blocking the pipeline. This setting helps manage steps that
12
+ * might hang or take longer than expected.
13
+ *
14
+ * @default 30000
15
+ * @example 15000
16
+ */
17
+ stepTimeout?: number;
18
+ /**
19
+ * Specifies whether to halt the entire pipeline if a step fails.
20
+ * - true: The pipeline will stop execution immediately upon encountering
21
+ * a failed step.
22
+ * - false: The pipeline will continue executing subsequent steps and
23
+ * stages despite errors.
24
+ *
25
+ * Default is true (halt on failure), ensuring the pipeline stops at the
26
+ * first sign of trouble.
27
+ *
28
+ * @default true
29
+ */
30
+ haltOnFailure?: boolean;
31
+ /**
32
+ * Specifies the maximum number of concurrent stages allowed to run in
33
+ * parallel. This setting controls resource usage and can help prevent
34
+ * overloading the system.
35
+ *
36
+ * - `0` or `undefined`: No limit, all stages run in parallel (as allowed
37
+ * by their dependencies).
38
+ * - A positive integer: Limits the number of stages that can run
39
+ * simultaneously.
40
+ *
41
+ * @default undefined
42
+ */
43
+ maxConcurrentStages?: number;
44
+ /**
45
+ * Specifies a retry strategy for steps that fail.
46
+ *
47
+ * - `retries`: Number of retry attempts before marking a step as failed.
48
+ * - `delay`: Time in milliseconds between retry attempts.
49
+ *
50
+ * This allows automatic retries for temporary failures, improving
51
+ * pipeline robustness.
52
+ *
53
+ * @default { retries: 0, delay: 0 }
54
+ * @example { retries: 3, delay: 1000 }
55
+ */
56
+ retryStrategy?: {
57
+ /**
58
+ * Number of retry attempts before marking a step as failed.
59
+ */
60
+ retries: number;
61
+ /**
62
+ * Time in milliseconds between retry attempts.
63
+ */
64
+ delay: number;
65
+ };
66
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Interfaces
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,79 @@
1
+ import { StepInterface } from "./StepInterface";
2
+ /**
3
+ * StageInterface represents a stage in the packaging pipeline, consisting of
4
+ * multiple steps. Each stage serves as a logical grouping of related steps,
5
+ * providing a structured way to organize the pipeline execution flow. Stages
6
+ * can have dependencies on other stages, allowing for complex sequencing of
7
+ * actions within the pipeline.
8
+ */
9
+ export interface StageInterface {
10
+ /**
11
+ * A unique identifier for the stage, used for logging, tracking, and
12
+ * reporting purposes. The name should be descriptive enough to clearly
13
+ * convey the purpose of the stage.
14
+ */
15
+ name: string;
16
+ /**
17
+ * An ordered array of steps that comprise the stage.
18
+ * Steps are executed consecutively within the stage, following the order
19
+ * they are defined in. Each step is expected to implement the
20
+ * StepInterface, providing specific actions to be performed.
21
+ */
22
+ steps: StepInterface[];
23
+ /**
24
+ * An optional list of stage names that this stage depends on.
25
+ * The current stage will not begin execution until all specified dependent
26
+ * stages have completed successfully. This allows for orchestrating
27
+ * complex dependencies and ensuring proper sequencing of stages in the
28
+ * pipeline.
29
+ */
30
+ dependsOn?: string[];
31
+ /**
32
+ * An optional description of the stage, providing additional context and
33
+ * details about what the stage is intended to accomplish. Useful for
34
+ * documentation, logging, and understanding the overall pipeline flow.
35
+ */
36
+ description?: string;
37
+ /**
38
+ * An optional flag to control whether the stage should be executed.
39
+ * This can be used to conditionally skip stages based on dynamic criteria,
40
+ * such as environment settings or previous results.
41
+ * Default is true (stage will be executed).
42
+ */
43
+ enabled?: boolean;
44
+ /**
45
+ * Optional timeout for the entire stage, specified in milliseconds.
46
+ * If the stage exceeds this duration, it will be forcibly terminated to
47
+ * prevent blocking the pipeline indefinitely. Helps manage long-running
48
+ * stages and ensures the pipeline maintains predictable execution times.
49
+ */
50
+ timeout?: number;
51
+ /**
52
+ * Priority level for the stage, used to influence execution order in
53
+ * concurrent scenarios. Higher priority stages may execute before lower
54
+ * priority ones when multiple stages are eligible to run simultaneously.
55
+ * Default: `'normal'`.
56
+ * - `'low'`: Lower execution priority.
57
+ * - `'normal'`: Default execution priority.
58
+ * - `'high'`: Higher execution priority.
59
+ */
60
+ priority?: "low" | "normal" | "high";
61
+ /**
62
+ * Optional tags to attach metadata or labels to the stage. Tags can be
63
+ * used for filtering, reporting, or integration with external tools that
64
+ * require context or categorization.
65
+ */
66
+ tags?: Record<string, string>;
67
+ /**
68
+ * Optional hooks that allow custom logic to be executed before or after
69
+ * the stage.
70
+ * Useful for injecting custom behavior or performing additional
71
+ * setup/cleanup tasks.
72
+ * - `before`: Function to run before the stage starts.
73
+ * - `after`: Function to run after the stage completes.
74
+ */
75
+ hooks?: {
76
+ before?: () => Promise<void> | void;
77
+ after?: () => Promise<void> | void;
78
+ };
79
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,66 @@
1
+ import { ActionInterface } from "./ActionInterface";
2
+ import { StepOptionsInterface } from "./StepOptionsInterface";
3
+ /**
4
+ * StepInterface defines a single executable unit within a pipeline stage.
5
+ * Each step encapsulates a specific action to be performed, along with
6
+ * configuration options that tailor its behavior. Steps are executed in
7
+ * sequence within their respective stages.
8
+ */
9
+ export interface StepInterface {
10
+ /**
11
+ * A unique identifier for the step, used for logging, debugging, and
12
+ * reporting. This name should be descriptive and clearly indicate the
13
+ * purpose of the step.
14
+ */
15
+ name: string;
16
+ /**
17
+ * The action that this step will perform, represented by a class
18
+ * implementing the ActionInterface. This action defines the core
19
+ * functionality of the step, such as building, testing, or deploying.
20
+ * The action is responsible for executing the main logic associated with
21
+ * the step.
22
+ */
23
+ action: ActionInterface;
24
+ /**
25
+ * Optional configuration options specific to the step.
26
+ * These options allow customization of the step's behavior, providing
27
+ * flexibility to adapt the action to different contexts or requirements.
28
+ * For example, build steps might accept options for minification or target
29
+ * environments.
30
+ */
31
+ options?: StepOptionsInterface;
32
+ /**
33
+ * An optional flag to enable or disable this step dynamically.
34
+ * - `true`: Step will be executed (default behavior).
35
+ * - `false`: Step will be skipped during execution.
36
+ */
37
+ enabled?: boolean;
38
+ /**
39
+ * Optional timeout for this step, specified in milliseconds.
40
+ * If the step exceeds this duration, it will be forcibly terminated,
41
+ * ensuring the pipeline remains predictable and responsive.
42
+ */
43
+ timeout?: number;
44
+ /**
45
+ * An optional description providing additional context or details about
46
+ * the step. Useful for documentation, reporting, or explaining the
47
+ * purpose of the step to maintainers.
48
+ */
49
+ description?: string;
50
+ /**
51
+ * An optional set of tags to provide metadata for the step.
52
+ * Tags can be used for logging, filtering, or integrating with external
53
+ * tools and systems that require context.
54
+ */
55
+ tags?: Record<string, string>;
56
+ /**
57
+ * Optional hooks to execute custom logic before or after the step.
58
+ * Hooks can be used for additional setup, teardown, or condition checks.
59
+ * - `before`: Function executed before the step runs.
60
+ * - `after`: Function executed after the step completes.
61
+ */
62
+ hooks?: {
63
+ before?: () => Promise<void> | void;
64
+ after?: () => Promise<void> | void;
65
+ };
66
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,38 @@
1
+ /**
2
+ * StepOptionsInterface represents the configuration options for a step,
3
+ * allowing customization of the step's behavior through specific parameters
4
+ * and settings. This interface can be extended for action-specific options,
5
+ * providing type safety and clarity for different configurations used within
6
+ * the packaging pipeline.
7
+ */
8
+ export interface StepOptionsInterface {
9
+ /**
10
+ * An optional description of the step, useful for logging, debugging, and
11
+ * reporting. This provides additional context about the step's purpose and
12
+ * configuration.
13
+ */
14
+ description?: string;
15
+ /**
16
+ * Specifies whether the step should be enabled or skipped.
17
+ * This can be used to conditionally execute steps based on dynamic
18
+ * criteria.
19
+ * Default is true (enabled).
20
+ */
21
+ enabled?: boolean;
22
+ }
23
+ /**
24
+ * Recommendations for Extending StepOptionsInterface:
25
+ * - For specific actions, extend `StepOptionsInterface` to add detailed types
26
+ * and enforce stricter validation.
27
+ *
28
+ * Example:
29
+ * ```typescript
30
+ * export interface BuildStepOptions extends StepOptionsInterface {
31
+ * minify?: boolean;
32
+ * target?: 'es5' | 'es6' | 'es2020';
33
+ * sourceMap?: boolean;
34
+ * }
35
+ * ```
36
+ *
37
+ * This approach ensures type safety while maintaining flexibility for general steps.
38
+ */
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Interfaces
4
+ // ============================================================================
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /**
7
+ * Recommendations for Extending StepOptionsInterface:
8
+ * - For specific actions, extend `StepOptionsInterface` to add detailed types
9
+ * and enforce stricter validation.
10
+ *
11
+ * Example:
12
+ * ```typescript
13
+ * export interface BuildStepOptions extends StepOptionsInterface {
14
+ * minify?: boolean;
15
+ * target?: 'es5' | 'es6' | 'es2020';
16
+ * sourceMap?: boolean;
17
+ * }
18
+ * ```
19
+ *
20
+ * This approach ensures type safety while maintaining flexibility for general steps.
21
+ */
@@ -0,0 +1,7 @@
1
+ export { ActionInterface } from "./ActionInterface";
2
+ export { ConfigInterface } from "./ConfigInterface";
3
+ export { LiveOptionsInterface } from "./LiveOptionsInterface";
4
+ export { OptionsInterface } from "./OptionsInterface";
5
+ export { StageInterface } from "./StageInterface";
6
+ export { StepInterface } from "./StepInterface";
7
+ export { StepOptionsInterface } from "./StepOptionsInterface";
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // Exporting all interfaces from the interfaces directory
3
+ Object.defineProperty(exports, "__esModule", { value: true });
package/js/kist.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ import { AbstractProcess } from "./core/abstract/AbstractProcess";
2
+ /**
3
+ * The Kist class encapsulates the kist CLI functionality.
4
+ * It manages the pipeline execution, configuration loading, and live reload.
5
+ */
6
+ export declare class Kist extends AbstractProcess {
7
+ /**
8
+ * Constructs the Kist class instance and initializes necessary components.
9
+ */
10
+ constructor();
11
+ /**
12
+ * Executes the Kist workflow.
13
+ *
14
+ * This method orchestrates the execution of the Kist pipeline, starting
15
+ * from initializing the ActionRegistry, loading configuration settings,
16
+ * running the pipeline stages through the `PipelineManager`, and
17
+ * optionally enabling live reload for real-time updates.
18
+ *
19
+ * @returns {Promise<void>} Resolves when the workflow completes successfully.
20
+ * @example
21
+ * const Kist = new Kist();
22
+ * Kist.run().then(() => console.log("Pipeline execution complete."));
23
+ */
24
+ run(): Promise<void>;
25
+ /**
26
+ * Initializes the ActionRegistry with available actions.
27
+ * Automatically registers core actions and discovers external plugins.
28
+ */
29
+ private initializeActionRegistry;
30
+ /**
31
+ * Sets up live reload functionality.
32
+ * Monitors file changes and restarts the pipeline when updates are detected.
33
+ *
34
+ * @param pipelineManager - The manager responsible for the pipeline process.
35
+ * @param liveReloadServer - The server for live reload connections.
36
+ */
37
+ private setupLiveReload;
38
+ /**
39
+ * Registers handlers for graceful shutdown signals.
40
+ *
41
+ * @param pipelineManager - The manager responsible for the pipeline process.
42
+ * @param liveReloadServer - The server for live reload connections.
43
+ */
44
+ private registerShutdownHandlers;
45
+ /**
46
+ * Handles graceful shutdown of the pipeline and live reload server.
47
+ *
48
+ * @param pipelineManager - The manager responsible for the pipeline process.
49
+ * @param liveReloadServer - The server for live reload connections.
50
+ */
51
+ private handleShutdown;
52
+ /**
53
+ * Handles errors occurring during the execution of the Kist workflow.
54
+ *
55
+ * @param error - The error object to log and handle.
56
+ */
57
+ private handleError;
58
+ }
package/js/kist.js ADDED
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ // ============================================================================
3
+ // Import
4
+ // ============================================================================
5
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
6
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7
+ return new (P || (P = Promise))(function (resolve, reject) {
8
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
9
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12
+ });
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.Kist = void 0;
16
+ const AbstractProcess_1 = require("./core/abstract/AbstractProcess");
17
+ const ConfigStore_1 = require("./core/config/ConfigStore");
18
+ const ActionRegistry_1 = require("./core/pipeline/ActionRegistry");
19
+ const PipelineManager_1 = require("./core/pipeline/PipelineManager");
20
+ const LiveServer_1 = require("./live/LiveServer");
21
+ const LiveWatcher_1 = require("./live/LiveWatcher");
22
+ // ============================================================================
23
+ // Class
24
+ // ============================================================================
25
+ /**
26
+ * The Kist class encapsulates the kist CLI functionality.
27
+ * It manages the pipeline execution, configuration loading, and live reload.
28
+ */
29
+ class Kist extends AbstractProcess_1.AbstractProcess {
30
+ // Constructor
31
+ // ========================================================================
32
+ /**
33
+ * Constructs the Kist class instance and initializes necessary components.
34
+ */
35
+ constructor() {
36
+ super();
37
+ this.logDebug("Kist initialized.");
38
+ }
39
+ // Methods
40
+ // ========================================================================
41
+ /**
42
+ * Executes the Kist workflow.
43
+ *
44
+ * This method orchestrates the execution of the Kist pipeline, starting
45
+ * from initializing the ActionRegistry, loading configuration settings,
46
+ * running the pipeline stages through the `PipelineManager`, and
47
+ * optionally enabling live reload for real-time updates.
48
+ *
49
+ * @returns {Promise<void>} Resolves when the workflow completes successfully.
50
+ * @example
51
+ * const Kist = new Kist();
52
+ * Kist.run().then(() => console.log("Pipeline execution complete."));
53
+ */
54
+ run() {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ this.logInfo("Starting Kist workflow...");
57
+ try {
58
+ // Initialize the ActionRegistry with available actions
59
+ this.initializeActionRegistry();
60
+ // Create and run the PipelineManager
61
+ const liveReloadEnabled = ConfigStore_1.ConfigStore.getInstance().get("options.live.enabled");
62
+ const liveReloadServer = liveReloadEnabled
63
+ ? new LiveServer_1.LiveServer()
64
+ : null;
65
+ const pipelineManager = new PipelineManager_1.PipelineManager(liveReloadServer);
66
+ yield pipelineManager.runPipeline();
67
+ // Setup live reload if enabled
68
+ if (liveReloadEnabled) {
69
+ this.setupLiveReload(pipelineManager, liveReloadServer);
70
+ }
71
+ }
72
+ catch (error) {
73
+ this.handleError(error);
74
+ }
75
+ });
76
+ }
77
+ /**
78
+ * Initializes the ActionRegistry with available actions.
79
+ * Automatically registers core actions and discovers external plugins.
80
+ */
81
+ initializeActionRegistry() {
82
+ this.logInfo("Initializing ActionRegistry...");
83
+ ActionRegistry_1.ActionRegistry.initialize();
84
+ this.logInfo("ActionRegistry initialized successfully.");
85
+ }
86
+ /**
87
+ * Sets up live reload functionality.
88
+ * Monitors file changes and restarts the pipeline when updates are detected.
89
+ *
90
+ * @param pipelineManager - The manager responsible for the pipeline process.
91
+ * @param liveReloadServer - The server for live reload connections.
92
+ */
93
+ setupLiveReload(pipelineManager, liveReloadServer) {
94
+ this.logInfo("Enabling live reload functionality...");
95
+ new LiveWatcher_1.LiveWatcher((filePath) => {
96
+ this.logInfo(`Detected change in: ${filePath}. Restarting pipeline...`);
97
+ pipelineManager.restartPipelineWithDelay(500);
98
+ });
99
+ pipelineManager.restartPipeline();
100
+ this.registerShutdownHandlers(pipelineManager, liveReloadServer);
101
+ }
102
+ /**
103
+ * Registers handlers for graceful shutdown signals.
104
+ *
105
+ * @param pipelineManager - The manager responsible for the pipeline process.
106
+ * @param liveReloadServer - The server for live reload connections.
107
+ */
108
+ registerShutdownHandlers(pipelineManager, liveReloadServer) {
109
+ process.on("SIGINT", () => this.handleShutdown(pipelineManager, liveReloadServer));
110
+ process.on("SIGTERM", () => this.handleShutdown(pipelineManager, liveReloadServer));
111
+ }
112
+ /**
113
+ * Handles graceful shutdown of the pipeline and live reload server.
114
+ *
115
+ * @param pipelineManager - The manager responsible for the pipeline process.
116
+ * @param liveReloadServer - The server for live reload connections.
117
+ */
118
+ handleShutdown(pipelineManager, liveReloadServer) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ this.logInfo("Shutdown signal received. Shutting down...");
121
+ try {
122
+ yield pipelineManager.stopPipeline();
123
+ yield liveReloadServer.shutdown();
124
+ this.logInfo("Shutdown completed successfully.");
125
+ }
126
+ catch (error) {
127
+ this.logError("Error during shutdown.", error);
128
+ }
129
+ finally {
130
+ process.exit(0);
131
+ }
132
+ });
133
+ }
134
+ /**
135
+ * Handles errors occurring during the execution of the Kist workflow.
136
+ *
137
+ * @param error - The error object to log and handle.
138
+ */
139
+ handleError(error) {
140
+ const errorMessage = error instanceof Error ? error.message : String(error);
141
+ this.logError(`An error occurred: ${errorMessage}`, error);
142
+ process.exit(1);
143
+ }
144
+ }
145
+ exports.Kist = Kist;