@sfdxy/mule-build 1.0.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.
Files changed (82) hide show
  1. package/README.md +301 -0
  2. package/dist/bin/mule-build.d.ts +8 -0
  3. package/dist/bin/mule-build.d.ts.map +1 -0
  4. package/dist/bin/mule-build.js +12 -0
  5. package/dist/bin/mule-build.js.map +1 -0
  6. package/dist/src/api/enforce.d.ts +11 -0
  7. package/dist/src/api/enforce.d.ts.map +1 -0
  8. package/dist/src/api/enforce.js +58 -0
  9. package/dist/src/api/enforce.js.map +1 -0
  10. package/dist/src/api/index.d.ts +12 -0
  11. package/dist/src/api/index.d.ts.map +1 -0
  12. package/dist/src/api/index.js +12 -0
  13. package/dist/src/api/index.js.map +1 -0
  14. package/dist/src/api/package.d.ts +15 -0
  15. package/dist/src/api/package.d.ts.map +1 -0
  16. package/dist/src/api/package.js +242 -0
  17. package/dist/src/api/package.js.map +1 -0
  18. package/dist/src/api/release.d.ts +11 -0
  19. package/dist/src/api/release.d.ts.map +1 -0
  20. package/dist/src/api/release.js +102 -0
  21. package/dist/src/api/release.js.map +1 -0
  22. package/dist/src/api/run.d.ts +11 -0
  23. package/dist/src/api/run.d.ts.map +1 -0
  24. package/dist/src/api/run.js +44 -0
  25. package/dist/src/api/run.js.map +1 -0
  26. package/dist/src/api/strip.d.ts +11 -0
  27. package/dist/src/api/strip.d.ts.map +1 -0
  28. package/dist/src/api/strip.js +57 -0
  29. package/dist/src/api/strip.js.map +1 -0
  30. package/dist/src/cli.d.ts +15 -0
  31. package/dist/src/cli.d.ts.map +1 -0
  32. package/dist/src/cli.js +174 -0
  33. package/dist/src/cli.js.map +1 -0
  34. package/dist/src/config/ConfigLoader.d.ts +19 -0
  35. package/dist/src/config/ConfigLoader.d.ts.map +1 -0
  36. package/dist/src/config/ConfigLoader.js +84 -0
  37. package/dist/src/config/ConfigLoader.js.map +1 -0
  38. package/dist/src/config/SystemChecker.d.ts +29 -0
  39. package/dist/src/config/SystemChecker.d.ts.map +1 -0
  40. package/dist/src/config/SystemChecker.js +85 -0
  41. package/dist/src/config/SystemChecker.js.map +1 -0
  42. package/dist/src/config/defaults.d.ts +17 -0
  43. package/dist/src/config/defaults.d.ts.map +1 -0
  44. package/dist/src/config/defaults.js +37 -0
  45. package/dist/src/config/defaults.js.map +1 -0
  46. package/dist/src/engine/LocalRuntime.d.ts +41 -0
  47. package/dist/src/engine/LocalRuntime.d.ts.map +1 -0
  48. package/dist/src/engine/LocalRuntime.js +132 -0
  49. package/dist/src/engine/LocalRuntime.js.map +1 -0
  50. package/dist/src/engine/MavenBuilder.d.ts +49 -0
  51. package/dist/src/engine/MavenBuilder.d.ts.map +1 -0
  52. package/dist/src/engine/MavenBuilder.js +126 -0
  53. package/dist/src/engine/MavenBuilder.js.map +1 -0
  54. package/dist/src/engine/PomParser.d.ts +53 -0
  55. package/dist/src/engine/PomParser.d.ts.map +1 -0
  56. package/dist/src/engine/PomParser.js +175 -0
  57. package/dist/src/engine/PomParser.js.map +1 -0
  58. package/dist/src/engine/XmlProcessor.d.ts +47 -0
  59. package/dist/src/engine/XmlProcessor.d.ts.map +1 -0
  60. package/dist/src/engine/XmlProcessor.js +213 -0
  61. package/dist/src/engine/XmlProcessor.js.map +1 -0
  62. package/dist/src/index.d.ts +11 -0
  63. package/dist/src/index.d.ts.map +1 -0
  64. package/dist/src/index.js +13 -0
  65. package/dist/src/index.js.map +1 -0
  66. package/dist/src/types/index.d.ts +209 -0
  67. package/dist/src/types/index.d.ts.map +1 -0
  68. package/dist/src/types/index.js +16 -0
  69. package/dist/src/types/index.js.map +1 -0
  70. package/dist/src/utils/exec.d.ts +20 -0
  71. package/dist/src/utils/exec.d.ts.map +1 -0
  72. package/dist/src/utils/exec.js +57 -0
  73. package/dist/src/utils/exec.js.map +1 -0
  74. package/dist/src/utils/git.d.ts +26 -0
  75. package/dist/src/utils/git.d.ts.map +1 -0
  76. package/dist/src/utils/git.js +71 -0
  77. package/dist/src/utils/git.js.map +1 -0
  78. package/dist/src/utils/logger.d.ts +21 -0
  79. package/dist/src/utils/logger.d.ts.map +1 -0
  80. package/dist/src/utils/logger.js +59 -0
  81. package/dist/src/utils/logger.js.map +1 -0
  82. package/package.json +80 -0
@@ -0,0 +1,213 @@
1
+ /**
2
+ * XML Processor Engine
3
+ *
4
+ * Handles safe modification of MuleSoft XML configuration files.
5
+ * Uses regex-based approach to preserve formatting and comments.
6
+ */
7
+ import { readFileSync, writeFileSync, readdirSync, statSync, existsSync } from 'fs';
8
+ import { join, relative } from 'path';
9
+ import { ok, err, } from '../types/index.js';
10
+ import { logger } from '../utils/logger.js';
11
+ /**
12
+ * Regex patterns for secure property detection and modification
13
+ */
14
+ const PATTERNS = {
15
+ // Matches ${secure::property.name} format
16
+ securePropertyBraces: /\$\{secure::([^}]+)\}/g,
17
+ // Matches Mule::p('secure::property.name') DataWeave format
18
+ securePropertyDataWeave: /Mule::p\('secure::([^']+)'\)/g,
19
+ // Matches any ${...} property reference
20
+ anyProperty: /\$\{([^}]+)\}/g,
21
+ // Matches Mule::p('...') DataWeave property reference
22
+ anyDataWeaveProperty: /Mule::p\('([^']+)'\)/g,
23
+ };
24
+ /**
25
+ * Default sensitive property patterns that should be secured
26
+ */
27
+ const DEFAULT_SENSITIVE_PATTERNS = [
28
+ 'password',
29
+ 'secret',
30
+ 'key',
31
+ 'token',
32
+ 'credential',
33
+ 'apikey',
34
+ 'api-key',
35
+ 'api_key',
36
+ 'consumerKey',
37
+ 'consumerSecret',
38
+ 'tokenId',
39
+ 'tokenSecret',
40
+ ];
41
+ /**
42
+ * Strip secure:: prefixes from XML content
43
+ * Preserves file formatting and comments
44
+ */
45
+ export function stripSecureFromContent(content) {
46
+ let count = 0;
47
+ // Replace ${secure::prop} -> ${prop}
48
+ let result = content.replace(PATTERNS.securePropertyBraces, (_match, prop) => {
49
+ count++;
50
+ return `\${${prop}}`;
51
+ });
52
+ // Replace Mule::p('secure::prop') -> Mule::p('prop')
53
+ result = result.replace(PATTERNS.securePropertyDataWeave, (_match, prop) => {
54
+ count++;
55
+ return `Mule::p('${prop}')`;
56
+ });
57
+ return { result, count };
58
+ }
59
+ /**
60
+ * Check content for unsecured sensitive properties
61
+ */
62
+ export function findUnsecuredProperties(content, sensitivePatterns = DEFAULT_SENSITIVE_PATTERNS) {
63
+ const violations = [];
64
+ const lines = content.split('\n');
65
+ const sensitiveRegex = new RegExp(sensitivePatterns.join('|'), 'i');
66
+ lines.forEach((line, index) => {
67
+ // Check ${prop} format (not already secured)
68
+ const braceMatches = line.matchAll(PATTERNS.anyProperty);
69
+ for (const match of braceMatches) {
70
+ const fullMatch = match[0];
71
+ const propName = match[1];
72
+ // Skip if already secured
73
+ if (propName.startsWith('secure::'))
74
+ continue;
75
+ // Check if property name contains sensitive pattern
76
+ if (sensitiveRegex.test(propName)) {
77
+ violations.push({
78
+ property: propName,
79
+ line: index + 1,
80
+ value: fullMatch,
81
+ });
82
+ }
83
+ }
84
+ // Check Mule::p('prop') format (not already secured)
85
+ const dwMatches = line.matchAll(PATTERNS.anyDataWeaveProperty);
86
+ for (const match of dwMatches) {
87
+ const fullMatch = match[0];
88
+ const propName = match[1];
89
+ // Skip if already secured
90
+ if (propName.startsWith('secure::'))
91
+ continue;
92
+ // Check if property name contains sensitive pattern
93
+ if (sensitiveRegex.test(propName)) {
94
+ violations.push({
95
+ property: propName,
96
+ line: index + 1,
97
+ value: fullMatch,
98
+ });
99
+ }
100
+ }
101
+ });
102
+ return violations;
103
+ }
104
+ /**
105
+ * Get all XML files in a directory recursively
106
+ */
107
+ export function getXmlFiles(directory) {
108
+ const files = [];
109
+ if (!existsSync(directory)) {
110
+ return files;
111
+ }
112
+ function walk(dir) {
113
+ const entries = readdirSync(dir);
114
+ for (const entry of entries) {
115
+ const fullPath = join(dir, entry);
116
+ const stat = statSync(fullPath);
117
+ if (stat.isDirectory()) {
118
+ walk(fullPath);
119
+ }
120
+ else if (entry.endsWith('.xml')) {
121
+ files.push(fullPath);
122
+ }
123
+ }
124
+ }
125
+ walk(directory);
126
+ return files;
127
+ }
128
+ /**
129
+ * Strip secure:: prefixes from files
130
+ */
131
+ export async function stripSecure(target, options = {}) {
132
+ const cwd = options.cwd ?? process.cwd();
133
+ const dryRun = options.dryRun ?? false;
134
+ try {
135
+ const stat = statSync(target);
136
+ const files = stat.isDirectory() ? getXmlFiles(target) : [target];
137
+ const changes = [];
138
+ const filesProcessed = [];
139
+ let totalReplacements = 0;
140
+ for (const file of files) {
141
+ const content = readFileSync(file, 'utf-8');
142
+ const { result, count } = stripSecureFromContent(content);
143
+ if (count > 0) {
144
+ filesProcessed.push(relative(cwd, file));
145
+ totalReplacements += count;
146
+ if (dryRun) {
147
+ changes.push({
148
+ file: relative(cwd, file),
149
+ before: content.substring(0, 200) + '...',
150
+ after: result.substring(0, 200) + '...',
151
+ });
152
+ }
153
+ else {
154
+ writeFileSync(file, result);
155
+ logger.success(`Stripped ${count} secure:: prefix(es) from ${relative(cwd, file)}`);
156
+ }
157
+ }
158
+ }
159
+ return ok({
160
+ filesProcessed,
161
+ replacementCount: totalReplacements,
162
+ changes,
163
+ });
164
+ }
165
+ catch (error) {
166
+ return err(error instanceof Error ? error : new Error(String(error)));
167
+ }
168
+ }
169
+ /**
170
+ * Enforce secure:: prefixes for sensitive properties
171
+ */
172
+ export async function enforceSecure(target, options = {}) {
173
+ const cwd = options.cwd ?? process.cwd();
174
+ const sensitivePatterns = options.sensitivePatterns ?? DEFAULT_SENSITIVE_PATTERNS;
175
+ try {
176
+ const stat = statSync(target);
177
+ const files = stat.isDirectory() ? getXmlFiles(target) : [target];
178
+ const violations = [];
179
+ const filesChecked = [];
180
+ for (const file of files) {
181
+ const content = readFileSync(file, 'utf-8');
182
+ filesChecked.push(relative(cwd, file));
183
+ const fileViolations = findUnsecuredProperties(content, sensitivePatterns);
184
+ for (const v of fileViolations) {
185
+ violations.push({
186
+ file: relative(cwd, file),
187
+ line: v.line,
188
+ value: v.value,
189
+ suggestion: v.value.includes("Mule::p('")
190
+ ? `Mule::p('secure::${v.property}')`
191
+ : `\${secure::${v.property}}`,
192
+ });
193
+ }
194
+ }
195
+ return ok({
196
+ valid: violations.length === 0,
197
+ filesChecked,
198
+ violations,
199
+ });
200
+ }
201
+ catch (error) {
202
+ return err(error instanceof Error ? error : new Error(String(error)));
203
+ }
204
+ }
205
+ /**
206
+ * Remove secure-properties:config element from XML content
207
+ * Uses regex to preserve formatting
208
+ */
209
+ export function removeSecurePropertiesConfig(content) {
210
+ // Remove the entire <secure-properties:config>...</secure-properties:config> block
211
+ return content.replace(/<secure-properties:config[^>]*>[\s\S]*?<\/secure-properties:config>/gm, '');
212
+ }
213
+ //# sourceMappingURL=XmlProcessor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XmlProcessor.js","sourceRoot":"","sources":["../../../src/engine/XmlProcessor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACpF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAEL,EAAE,EACF,GAAG,GAKJ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C;;GAEG;AACH,MAAM,QAAQ,GAAG;IACf,0CAA0C;IAC1C,oBAAoB,EAAE,wBAAwB;IAC9C,4DAA4D;IAC5D,uBAAuB,EAAE,+BAA+B;IACxD,wCAAwC;IACxC,WAAW,EAAE,gBAAgB;IAC7B,sDAAsD;IACtD,oBAAoB,EAAE,uBAAuB;CAC9C,CAAC;AAEF;;GAEG;AACH,MAAM,0BAA0B,GAAG;IACjC,UAAU;IACV,QAAQ;IACR,KAAK;IACL,OAAO;IACP,YAAY;IACZ,QAAQ;IACR,SAAS;IACT,SAAS;IACT,aAAa;IACb,gBAAgB;IAChB,S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C1D,mFAAmF;IACnF,OAAO,OAAO,CAAC,OAAO,CACpB,uEAAuE,EACvE,EAAE,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Mule-Build Package Entry Point
3
+ *
4
+ * Exports all public APIs for programmatic usage.
5
+ */
6
+ export { packageProject, runLocal, releaseVersion, stripSecure, enforceSecure, } from './api/index.js';
7
+ export type { PackageOptions, PackageResult, RunOptions, RunResult, ReleaseOptions, ReleaseResult, StripOptions, StripResult, EnforceOptions, EnforceResult, DeploymentInfo, BuildEnvironment, BumpType, MuleBuildConfig, ProfileConfig, Result, } from './types/index.js';
8
+ export { ok, err } from './types/index.js';
9
+ export { logger, setLogLevel } from './utils/logger.js';
10
+ export { createProgram, run as runCli } from './cli.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,cAAc,EACd,QAAQ,EACR,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,cAAc,EACd,aAAa,EACb,UAAU,EACV,SAAS,EACT,cAAc,EACd,aAAa,EACb,YAAY,EACZ,WAAW,EACX,cAAc,EACd,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,eAAe,EACf,aAAa,EACb,MAAM,GACP,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Mule-Build Package Entry Point
3
+ *
4
+ * Exports all public APIs for programmatic usage.
5
+ */
6
+ // Public API functions
7
+ export { packageProject, runLocal, releaseVersion, stripSecure, enforceSecure, } from './api/index.js';
8
+ // Utility exports for advanced usage
9
+ export { ok, err } from './types/index.js';
10
+ export { logger, setLogLevel } from './utils/logger.js';
11
+ // CLI (for programmatic CLI invocation)
12
+ export { createProgram, run as runCli } from './cli.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uBAAuB;AACvB,OAAO,EACL,cAAc,EACd,QAAQ,EACR,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,gBAAgB,CAAC;AAsBxB,qCAAqC;AACrC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAExD,wCAAwC;AACxC,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Core type definitions for mule-build
3
+ */
4
+ export type BuildEnvironment = 'production';
5
+ export type BumpType = 'major' | 'minor' | 'patch';
6
+ export type ProcessMode = 'strip' | 'enforce';
7
+ /**
8
+ * Result type for operations that can fail
9
+ */
10
+ export interface Result<T, E = Error> {
11
+ success: boolean;
12
+ data?: T;
13
+ error?: E;
14
+ }
15
+ /**
16
+ * Creates a successful result
17
+ */
18
+ export declare function ok<T>(data: T): Result<T>;
19
+ /**
20
+ * Creates a failed result
21
+ */
22
+ export declare function err<E = Error>(error: E): Result<never, E>;
23
+ /**
24
+ * Package command options
25
+ */
26
+ export interface PackageOptions {
27
+ /** Target environment: production (triggers enforcement) */
28
+ environment?: BuildEnvironment;
29
+ /** Strip secure:: prefixes for local development (explicit opt-in) */
30
+ stripSecure?: boolean;
31
+ /** Include source code in package (for Studio import) */
32
+ withSource?: boolean;
33
+ /** Skip MUnit tests */
34
+ skipTests?: boolean;
35
+ /** Override version */
36
+ version?: string;
37
+ /** Working directory (defaults to cwd) */
38
+ cwd?: string;
39
+ }
40
+ /**
41
+ * Package command result
42
+ */
43
+ export interface PackageResult {
44
+ /** Path to the generated JAR file */
45
+ jarPath: string;
46
+ /** Deployment information */
47
+ deploymentInfo: DeploymentInfo;
48
+ }
49
+ /**
50
+ * Deployment information generated during packaging
51
+ */
52
+ export interface DeploymentInfo {
53
+ environment?: BuildEnvironment;
54
+ packageName: string;
55
+ version: string;
56
+ buildDate: string;
57
+ builtBy: string;
58
+ machine: string;
59
+ configChanges: string[];
60
+ }
61
+ /**
62
+ * Run command options
63
+ */
64
+ export interface RunOptions {
65
+ /** Enable remote debugging on port 5005 */
66
+ debug?: boolean;
67
+ /** Run mvn clean before building */
68
+ clean?: boolean;
69
+ /** Working directory (defaults to cwd) */
70
+ cwd?: string;
71
+ }
72
+ /**
73
+ * Run command result
74
+ */
75
+ export interface RunResult {
76
+ /** Whether the deployment was successful */
77
+ deployed: boolean;
78
+ /** Path to the deployed JAR */
79
+ jarPath: string;
80
+ /** Message from the runtime */
81
+ message: string;
82
+ }
83
+ /**
84
+ * Release command options
85
+ */
86
+ export interface ReleaseOptions {
87
+ /** Version bump type */
88
+ bump: BumpType;
89
+ /** Create git tag (default: true) */
90
+ tag?: boolean;
91
+ /** Push to remote (default: true) */
92
+ push?: boolean;
93
+ /** Working directory (defaults to cwd) */
94
+ cwd?: string;
95
+ }
96
+ /**
97
+ * Release command result
98
+ */
99
+ export interface ReleaseResult {
100
+ /** Old version */
101
+ previousVersion: string;
102
+ /** New version */
103
+ newVersion: string;
104
+ /** Git tag name (if created) */
105
+ tagName?: string;
106
+ /** Whether changes were pushed */
107
+ pushed: boolean;
108
+ }
109
+ /**
110
+ * Strip command options
111
+ */
112
+ export interface StripOptions {
113
+ /** Process a single file */
114
+ file?: string;
115
+ /** Process all XML files in directory */
116
+ directory?: string;
117
+ /** Show changes without modifying files */
118
+ dryRun?: boolean;
119
+ /** Working directory (defaults to cwd) */
120
+ cwd?: string;
121
+ }
122
+ /**
123
+ * Strip command result
124
+ */
125
+ export interface StripResult {
126
+ /** Files that were processed */
127
+ filesProcessed: string[];
128
+ /** Number of replacements made */
129
+ replacementCount: number;
130
+ /** Changes made (for dry-run) */
131
+ changes: FileChange[];
132
+ }
133
+ /**
134
+ * Enforce command options
135
+ */
136
+ export interface EnforceOptions {
137
+ /** Check a single file */
138
+ file?: string;
139
+ /** Check all XML files in directory */
140
+ directory?: string;
141
+ /** Custom sensitive property patterns */
142
+ sensitivePatterns?: string[];
143
+ /** Working directory (defaults to cwd) */
144
+ cwd?: string;
145
+ }
146
+ /**
147
+ * Enforce command result
148
+ */
149
+ export interface EnforceResult {
150
+ /** Whether all sensitive properties are secured */
151
+ valid: boolean;
152
+ /** Files that were checked */
153
+ filesChecked: string[];
154
+ /** Violations found */
155
+ violations: SecurityViolation[];
156
+ }
157
+ /**
158
+ * Security violation found during enforce check
159
+ */
160
+ export interface SecurityViolation {
161
+ /** File where violation was found */
162
+ file: string;
163
+ /** Line number (if available) */
164
+ line?: number;
165
+ /** The unsecured property value */
166
+ value: string;
167
+ /** Suggested fix */
168
+ suggestion: string;
169
+ }
170
+ /**
171
+ * File change for dry-run reporting
172
+ */
173
+ export interface FileChange {
174
+ file: string;
175
+ before: string;
176
+ after: string;
177
+ line?: number;
178
+ }
179
+ /**
180
+ * Mule-build configuration file structure
181
+ */
182
+ export interface MuleBuildConfig {
183
+ project?: {
184
+ name?: string;
185
+ };
186
+ profiles?: {
187
+ [key: string]: ProfileConfig;
188
+ };
189
+ }
190
+ /**
191
+ * Profile configuration
192
+ */
193
+ export interface ProfileConfig {
194
+ description?: string;
195
+ mavenProfile?: string;
196
+ secureProperties?: ProcessMode;
197
+ includeSource?: boolean;
198
+ enforceGitClean?: boolean;
199
+ }
200
+ /**
201
+ * POM.xml project information
202
+ */
203
+ export interface PomInfo {
204
+ name?: string;
205
+ artifactId?: string;
206
+ groupId?: string;
207
+ version?: string;
208
+ }
209
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAG5C,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAGnD,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,CAAC,CAAC;CACX;AAED;;GAEG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAExC;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAEzD;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,4DAA4D;IAC5D,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,sEAAsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yDAAyD;IACzD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,uBAAuB;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uBAAuB;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,6BAA6B;IAC7B,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;GAEG;AACH,M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AQ,CAAC,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC;KAC9B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Core type definitions for mule-build
3
+ */
4
+ /**
5
+ * Creates a successful result
6
+ */
7
+ export function ok(data) {
8
+ return { success: true, data };
9
+ }
10
+ /**
11
+ * Creates a failed result
12
+ */
13
+ export function err(error) {
14
+ return { success: false, error };
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAoBH;;GAEG;AACH,MAAM,UAAU,EAAE,CAAI,IAAO;IAC3B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,GAAG,CAAY,KAAQ;IACrC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACnC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { SpawnOptions } from 'child_process';
2
+ import { Result } from '../types/index.js';
3
+ export interface ExecResult {
4
+ stdout: string;
5
+ stderr: string;
6
+ exitCode: number;
7
+ }
8
+ /**
9
+ * Execute a command and return the result
10
+ */
11
+ export declare function exec(command: string, args: string[], options?: SpawnOptions): Promise<Result<ExecResult>>;
12
+ /**
13
+ * Execute a command and stream output to console
14
+ */
15
+ export declare function execWithOutput(command: string, args: string[], options?: SpawnOptions): Promise<Result<number>>;
16
+ /**
17
+ * Check if a command exists
18
+ */
19
+ export declare function commandExists(command: string): Promise<boolean>;
20
+ //# sourceMappingURL=exec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,YAAY,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAgC7B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAgBzB;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGrE"}
@@ -0,0 +1,57 @@
1
+ import { spawn } from 'child_process';
2
+ import { ok, err } from '../types/index.js';
3
+ /**
4
+ * Execute a command and return the result
5
+ */
6
+ export async function exec(command, args, options = {}) {
7
+ return new Promise((resolve) => {
8
+ const proc = spawn(command, args, {
9
+ ...options,
10
+ shell: true,
11
+ });
12
+ let stdout = '';
13
+ let stderr = '';
14
+ proc.stdout?.on('data', (data) => {
15
+ stdout += data.toString();
16
+ });
17
+ proc.stderr?.on('data', (data) => {
18
+ stderr += data.toString();
19
+ });
20
+ proc.on('error', (error) => {
21
+ resolve(err(new Error(`Failed to execute ${command}: ${error.message}`)));
22
+ });
23
+ proc.on('close', (code) => {
24
+ resolve(ok({
25
+ stdout,
26
+ stderr,
27
+ exitCode: code ?? 0,
28
+ }));
29
+ });
30
+ });
31
+ }
32
+ /**
33
+ * Execute a command and stream output to console
34
+ */
35
+ export async function execWithOutput(command, args, options = {}) {
36
+ return new Promise((resolve) => {
37
+ const proc = spawn(command, args, {
38
+ ...options,
39
+ stdio: 'inherit',
40
+ shell: true,
41
+ });
42
+ proc.on('error', (error) => {
43
+ resolve(err(new Error(`Failed to execute ${command}: ${error.message}`)));
44
+ });
45
+ proc.on('close', (code) => {
46
+ resolve(ok(code ?? 0));
47
+ });
48
+ });
49
+ }
50
+ /**
51
+ * Check if a command exists
52
+ */
53
+ export async function commandExists(command) {
54
+ const result = await exec('which', [command]);
55
+ return result.success && result.data?.exitCode === 0;
56
+ }
57
+ //# sourceMappingURL=exec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec.js","sourceRoot":"","sources":["../../../src/utils/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACpD,OAAO,EAAU,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAQpD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,OAAe,EACf,IAAc,EACd,UAAwB,EAAE;IAE1B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE;YAChC,GAAG,OAAO;YACV,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;QAEH,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,IAAI,CAAC,MAAM,EA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I,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACxB,OAAO,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,EAAE,QAAQ,KAAK,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Result } from '../types/index.js';
2
+ /**
3
+ * Check if the current directory is a git repository
4
+ */
5
+ export declare function isGitRepo(cwd?: string): Promise<boolean>;
6
+ /**
7
+ * Check if the git working tree is clean
8
+ */
9
+ export declare function isWorkingTreeClean(cwd?: string): Promise<boolean>;
10
+ /**
11
+ * Get the current git branch
12
+ */
13
+ export declare function getCurrentBranch(cwd?: string): Promise<Result<string>>;
14
+ /**
15
+ * Create a git commit
16
+ */
17
+ export declare function commit(message: string, cwd?: string): Promise<Result<string>>;
18
+ /**
19
+ * Create a git tag
20
+ */
21
+ export declare function createTag(tagName: string, message?: string, cwd?: string): Promise<Result<void>>;
22
+ /**
23
+ * Push to remote including tags
24
+ */
25
+ export declare function pushWithTags(cwd?: string): Promise<Result<void>>;
26
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../src/utils/git.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAEpD;;GAEG;AACH,wBAAsB,SAAS,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,CAG7E;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,CAMtF;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAM3F;AAED;;GAEG;AACH,wBAAsB,MAAM,CAC1B,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAczB;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CASvB;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAYrF"}