@invarn/cibuild 1.3.15 → 1.3.17

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 (242) hide show
  1. package/dist/cli.cjs +1 -1
  2. package/dist/src/cli.d.ts +3 -0
  3. package/dist/src/cli.d.ts.map +1 -0
  4. package/dist/src/cli.js +987 -0
  5. package/dist/src/commands/android-scanner.d.ts +32 -0
  6. package/dist/src/commands/android-scanner.d.ts.map +1 -0
  7. package/dist/src/commands/android-scanner.js +667 -0
  8. package/dist/src/commands/build.d.ts +5 -0
  9. package/dist/src/commands/build.d.ts.map +1 -0
  10. package/dist/src/commands/build.js +1096 -0
  11. package/dist/src/commands/edit.d.ts +3 -0
  12. package/dist/src/commands/edit.d.ts.map +1 -0
  13. package/dist/src/commands/edit.js +651 -0
  14. package/dist/src/commands/file-secret-collector.d.ts +37 -0
  15. package/dist/src/commands/file-secret-collector.d.ts.map +1 -0
  16. package/dist/src/commands/file-secret-collector.js +199 -0
  17. package/dist/src/commands/github-workflow.d.ts +5 -0
  18. package/dist/src/commands/github-workflow.d.ts.map +1 -0
  19. package/dist/src/commands/github-workflow.js +45 -0
  20. package/dist/src/commands/ios-scanner.d.ts +27 -0
  21. package/dist/src/commands/ios-scanner.d.ts.map +1 -0
  22. package/dist/src/commands/ios-scanner.js +337 -0
  23. package/dist/src/commands/reset.d.ts +7 -0
  24. package/dist/src/commands/reset.d.ts.map +1 -0
  25. package/dist/src/commands/reset.js +81 -0
  26. package/dist/src/commands/secrets-sync-workflow.d.ts +15 -0
  27. package/dist/src/commands/secrets-sync-workflow.d.ts.map +1 -0
  28. package/dist/src/commands/secrets-sync-workflow.js +255 -0
  29. package/dist/src/commands/secrets-upload.d.ts +21 -0
  30. package/dist/src/commands/secrets-upload.d.ts.map +1 -0
  31. package/dist/src/commands/secrets-upload.js +177 -0
  32. package/dist/src/commands/secrets-upload.test.d.ts +5 -0
  33. package/dist/src/commands/secrets-upload.test.d.ts.map +1 -0
  34. package/dist/src/commands/secrets-upload.test.js +60 -0
  35. package/dist/src/config.d.ts +3 -0
  36. package/dist/src/config.d.ts.map +1 -0
  37. package/dist/src/config.js +46 -0
  38. package/dist/src/envman/cli.d.ts +21 -0
  39. package/dist/src/envman/cli.d.ts.map +1 -0
  40. package/dist/src/envman/cli.js +240 -0
  41. package/dist/src/envman/envman.d.ts +83 -0
  42. package/dist/src/envman/envman.d.ts.map +1 -0
  43. package/dist/src/envman/envman.js +361 -0
  44. package/dist/src/envman/envman.test.d.ts +5 -0
  45. package/dist/src/envman/envman.test.d.ts.map +1 -0
  46. package/dist/src/envman/envman.test.js +236 -0
  47. package/dist/src/envman/index.d.ts +23 -0
  48. package/dist/src/envman/index.d.ts.map +1 -0
  49. package/dist/src/envman/index.js +23 -0
  50. package/dist/src/envman/types.d.ts +55 -0
  51. package/dist/src/envman/types.d.ts.map +1 -0
  52. package/dist/src/envman/types.js +12 -0
  53. package/dist/src/lib.d.ts +27 -0
  54. package/dist/src/lib.d.ts.map +1 -0
  55. package/dist/src/lib.js +32 -0
  56. package/dist/src/pipeline.d.ts +3 -0
  57. package/dist/src/pipeline.d.ts.map +1 -0
  58. package/dist/src/pipeline.js +57 -0
  59. package/dist/src/runner.d.ts +17 -0
  60. package/dist/src/runner.d.ts.map +1 -0
  61. package/dist/src/runner.js +234 -0
  62. package/dist/src/types.d.ts +57 -0
  63. package/dist/src/types.d.ts.map +1 -0
  64. package/dist/src/types.js +2 -0
  65. package/dist/src/yaml/bitrise-compat.d.ts +65 -0
  66. package/dist/src/yaml/bitrise-compat.d.ts.map +1 -0
  67. package/dist/src/yaml/bitrise-compat.js +206 -0
  68. package/dist/src/yaml/bitrise-compat.test.d.ts +5 -0
  69. package/dist/src/yaml/bitrise-compat.test.d.ts.map +1 -0
  70. package/dist/src/yaml/bitrise-compat.test.js +347 -0
  71. package/dist/src/yaml/converter.d.ts +33 -0
  72. package/dist/src/yaml/converter.d.ts.map +1 -0
  73. package/dist/src/yaml/converter.js +222 -0
  74. package/dist/src/yaml/converter.test.d.ts +5 -0
  75. package/dist/src/yaml/converter.test.d.ts.map +1 -0
  76. package/dist/src/yaml/converter.test.js +348 -0
  77. package/dist/src/yaml/e2e.test.d.ts +6 -0
  78. package/dist/src/yaml/e2e.test.d.ts.map +1 -0
  79. package/dist/src/yaml/e2e.test.js +446 -0
  80. package/dist/src/yaml/env-resolver.d.ts +120 -0
  81. package/dist/src/yaml/env-resolver.d.ts.map +1 -0
  82. package/dist/src/yaml/env-resolver.js +405 -0
  83. package/dist/src/yaml/env-resolver.test.d.ts +5 -0
  84. package/dist/src/yaml/env-resolver.test.d.ts.map +1 -0
  85. package/dist/src/yaml/env-resolver.test.js +502 -0
  86. package/dist/src/yaml/interactive-prompts.d.ts +71 -0
  87. package/dist/src/yaml/interactive-prompts.d.ts.map +1 -0
  88. package/dist/src/yaml/interactive-prompts.js +258 -0
  89. package/dist/src/yaml/missing-env-handler.d.ts +45 -0
  90. package/dist/src/yaml/missing-env-handler.d.ts.map +1 -0
  91. package/dist/src/yaml/missing-env-handler.js +64 -0
  92. package/dist/src/yaml/parser.d.ts +33 -0
  93. package/dist/src/yaml/parser.d.ts.map +1 -0
  94. package/dist/src/yaml/parser.js +145 -0
  95. package/dist/src/yaml/pipeline-with-secrets.d.ts +25 -0
  96. package/dist/src/yaml/pipeline-with-secrets.d.ts.map +1 -0
  97. package/dist/src/yaml/pipeline-with-secrets.js +76 -0
  98. package/dist/src/yaml/platform-detector.d.ts +83 -0
  99. package/dist/src/yaml/platform-detector.d.ts.map +1 -0
  100. package/dist/src/yaml/platform-detector.js +188 -0
  101. package/dist/src/yaml/platform-detector.test.d.ts +5 -0
  102. package/dist/src/yaml/platform-detector.test.d.ts.map +1 -0
  103. package/dist/src/yaml/platform-detector.test.js +414 -0
  104. package/dist/src/yaml/preflight-validation.d.ts +40 -0
  105. package/dist/src/yaml/preflight-validation.d.ts.map +1 -0
  106. package/dist/src/yaml/preflight-validation.js +152 -0
  107. package/dist/src/yaml/secrets-manager.d.ts +77 -0
  108. package/dist/src/yaml/secrets-manager.d.ts.map +1 -0
  109. package/dist/src/yaml/secrets-manager.js +219 -0
  110. package/dist/src/yaml/step-validator.d.ts +54 -0
  111. package/dist/src/yaml/step-validator.d.ts.map +1 -0
  112. package/dist/src/yaml/step-validator.js +403 -0
  113. package/dist/src/yaml/steps/android-sign.d.ts +35 -0
  114. package/dist/src/yaml/steps/android-sign.d.ts.map +1 -0
  115. package/dist/src/yaml/steps/android-sign.js +147 -0
  116. package/dist/src/yaml/steps/android-version.d.ts +26 -0
  117. package/dist/src/yaml/steps/android-version.d.ts.map +1 -0
  118. package/dist/src/yaml/steps/android-version.js +128 -0
  119. package/dist/src/yaml/steps/android-version.test.d.ts +5 -0
  120. package/dist/src/yaml/steps/android-version.test.d.ts.map +1 -0
  121. package/dist/src/yaml/steps/android-version.test.js +196 -0
  122. package/dist/src/yaml/steps/android.d.ts +95 -0
  123. package/dist/src/yaml/steps/android.d.ts.map +1 -0
  124. package/dist/src/yaml/steps/android.js +916 -0
  125. package/dist/src/yaml/steps/app-store-deploy.d.ts +48 -0
  126. package/dist/src/yaml/steps/app-store-deploy.d.ts.map +1 -0
  127. package/dist/src/yaml/steps/app-store-deploy.js +162 -0
  128. package/dist/src/yaml/steps/base.d.ts +238 -0
  129. package/dist/src/yaml/steps/base.d.ts.map +1 -0
  130. package/dist/src/yaml/steps/base.js +345 -0
  131. package/dist/src/yaml/steps/bitrise-android-tools.d.ts +26 -0
  132. package/dist/src/yaml/steps/bitrise-android-tools.d.ts.map +1 -0
  133. package/dist/src/yaml/steps/bitrise-android-tools.js +198 -0
  134. package/dist/src/yaml/steps/bitrise-android-tools.test.d.ts +5 -0
  135. package/dist/src/yaml/steps/bitrise-android-tools.test.d.ts.map +1 -0
  136. package/dist/src/yaml/steps/bitrise-android-tools.test.js +280 -0
  137. package/dist/src/yaml/steps/bitrise-apk-info.d.ts +22 -0
  138. package/dist/src/yaml/steps/bitrise-apk-info.d.ts.map +1 -0
  139. package/dist/src/yaml/steps/bitrise-apk-info.js +144 -0
  140. package/dist/src/yaml/steps/bitrise-apk-info.test.d.ts +5 -0
  141. package/dist/src/yaml/steps/bitrise-apk-info.test.d.ts.map +1 -0
  142. package/dist/src/yaml/steps/bitrise-apk-info.test.js +331 -0
  143. package/dist/src/yaml/steps/bitrise-slack.d.ts +49 -0
  144. package/dist/src/yaml/steps/bitrise-slack.d.ts.map +1 -0
  145. package/dist/src/yaml/steps/bitrise-slack.js +280 -0
  146. package/dist/src/yaml/steps/bitrise-slack.test.d.ts +5 -0
  147. package/dist/src/yaml/steps/bitrise-slack.test.d.ts.map +1 -0
  148. package/dist/src/yaml/steps/bitrise-slack.test.js +484 -0
  149. package/dist/src/yaml/steps/bitrise-ssh.d.ts +27 -0
  150. package/dist/src/yaml/steps/bitrise-ssh.d.ts.map +1 -0
  151. package/dist/src/yaml/steps/bitrise-ssh.js +134 -0
  152. package/dist/src/yaml/steps/bitrise-ssh.test.d.ts +5 -0
  153. package/dist/src/yaml/steps/bitrise-ssh.test.d.ts.map +1 -0
  154. package/dist/src/yaml/steps/bitrise-ssh.test.js +205 -0
  155. package/dist/src/yaml/steps/cache.d.ts +52 -0
  156. package/dist/src/yaml/steps/cache.d.ts.map +1 -0
  157. package/dist/src/yaml/steps/cache.js +351 -0
  158. package/dist/src/yaml/steps/fastlane.d.ts +27 -0
  159. package/dist/src/yaml/steps/fastlane.d.ts.map +1 -0
  160. package/dist/src/yaml/steps/fastlane.js +79 -0
  161. package/dist/src/yaml/steps/file.d.ts +27 -0
  162. package/dist/src/yaml/steps/file.d.ts.map +1 -0
  163. package/dist/src/yaml/steps/file.js +35 -0
  164. package/dist/src/yaml/steps/flutter.d.ts +63 -0
  165. package/dist/src/yaml/steps/flutter.d.ts.map +1 -0
  166. package/dist/src/yaml/steps/flutter.js +215 -0
  167. package/dist/src/yaml/steps/git-clone.d.ts +26 -0
  168. package/dist/src/yaml/steps/git-clone.d.ts.map +1 -0
  169. package/dist/src/yaml/steps/git-clone.js +111 -0
  170. package/dist/src/yaml/steps/google-play-deploy.d.ts +37 -0
  171. package/dist/src/yaml/steps/google-play-deploy.d.ts.map +1 -0
  172. package/dist/src/yaml/steps/google-play-deploy.js +193 -0
  173. package/dist/src/yaml/steps/google-play-deploy.test.d.ts +5 -0
  174. package/dist/src/yaml/steps/google-play-deploy.test.d.ts.map +1 -0
  175. package/dist/src/yaml/steps/google-play-deploy.test.js +310 -0
  176. package/dist/src/yaml/steps/index.d.ts +10 -0
  177. package/dist/src/yaml/steps/index.d.ts.map +1 -0
  178. package/dist/src/yaml/steps/index.js +1361 -0
  179. package/dist/src/yaml/steps/ios-deps.d.ts +43 -0
  180. package/dist/src/yaml/steps/ios-deps.d.ts.map +1 -0
  181. package/dist/src/yaml/steps/ios-deps.js +141 -0
  182. package/dist/src/yaml/steps/ios-deps.test.d.ts +5 -0
  183. package/dist/src/yaml/steps/ios-deps.test.d.ts.map +1 -0
  184. package/dist/src/yaml/steps/ios-deps.test.js +90 -0
  185. package/dist/src/yaml/steps/ios-signing.d.ts +31 -0
  186. package/dist/src/yaml/steps/ios-signing.d.ts.map +1 -0
  187. package/dist/src/yaml/steps/ios-signing.js +144 -0
  188. package/dist/src/yaml/steps/ios-version.d.ts +47 -0
  189. package/dist/src/yaml/steps/ios-version.d.ts.map +1 -0
  190. package/dist/src/yaml/steps/ios-version.js +151 -0
  191. package/dist/src/yaml/steps/linting.d.ts +47 -0
  192. package/dist/src/yaml/steps/linting.d.ts.map +1 -0
  193. package/dist/src/yaml/steps/linting.js +148 -0
  194. package/dist/src/yaml/steps/phase2.test.d.ts +6 -0
  195. package/dist/src/yaml/steps/phase2.test.d.ts.map +1 -0
  196. package/dist/src/yaml/steps/phase2.test.js +197 -0
  197. package/dist/src/yaml/steps/phase3.test.d.ts +5 -0
  198. package/dist/src/yaml/steps/phase3.test.d.ts.map +1 -0
  199. package/dist/src/yaml/steps/phase3.test.js +144 -0
  200. package/dist/src/yaml/steps/phase4.test.d.ts +5 -0
  201. package/dist/src/yaml/steps/phase4.test.d.ts.map +1 -0
  202. package/dist/src/yaml/steps/phase4.test.js +166 -0
  203. package/dist/src/yaml/steps/phase5.test.d.ts +6 -0
  204. package/dist/src/yaml/steps/phase5.test.d.ts.map +1 -0
  205. package/dist/src/yaml/steps/phase5.test.js +263 -0
  206. package/dist/src/yaml/steps/registry.d.ts +88 -0
  207. package/dist/src/yaml/steps/registry.d.ts.map +1 -0
  208. package/dist/src/yaml/steps/registry.js +125 -0
  209. package/dist/src/yaml/steps/registry.test.d.ts +5 -0
  210. package/dist/src/yaml/steps/registry.test.d.ts.map +1 -0
  211. package/dist/src/yaml/steps/registry.test.js +235 -0
  212. package/dist/src/yaml/steps/release.d.ts +50 -0
  213. package/dist/src/yaml/steps/release.d.ts.map +1 -0
  214. package/dist/src/yaml/steps/release.js +154 -0
  215. package/dist/src/yaml/steps/script.d.ts +23 -0
  216. package/dist/src/yaml/steps/script.d.ts.map +1 -0
  217. package/dist/src/yaml/steps/script.js +63 -0
  218. package/dist/src/yaml/steps/spec-validation.test.d.ts +6 -0
  219. package/dist/src/yaml/steps/spec-validation.test.d.ts.map +1 -0
  220. package/dist/src/yaml/steps/spec-validation.test.js +130 -0
  221. package/dist/src/yaml/steps/steps.test.d.ts +6 -0
  222. package/dist/src/yaml/steps/steps.test.d.ts.map +1 -0
  223. package/dist/src/yaml/steps/steps.test.js +474 -0
  224. package/dist/src/yaml/steps/test-config.d.ts +3 -0
  225. package/dist/src/yaml/steps/test-config.d.ts.map +1 -0
  226. package/dist/src/yaml/steps/test-config.js +16 -0
  227. package/dist/src/yaml/steps/xcode-new.test.d.ts +5 -0
  228. package/dist/src/yaml/steps/xcode-new.test.d.ts.map +1 -0
  229. package/dist/src/yaml/steps/xcode-new.test.js +211 -0
  230. package/dist/src/yaml/steps/xcode.d.ts +222 -0
  231. package/dist/src/yaml/steps/xcode.d.ts.map +1 -0
  232. package/dist/src/yaml/steps/xcode.js +999 -0
  233. package/dist/src/yaml/types.d.ts +68 -0
  234. package/dist/src/yaml/types.d.ts.map +1 -0
  235. package/dist/src/yaml/types.js +5 -0
  236. package/dist/src/yaml/validation-types.d.ts +96 -0
  237. package/dist/src/yaml/validation-types.d.ts.map +1 -0
  238. package/dist/src/yaml/validation-types.js +8 -0
  239. package/dist/src/yaml/yaml-updater.d.ts +24 -0
  240. package/dist/src/yaml/yaml-updater.d.ts.map +1 -0
  241. package/dist/src/yaml/yaml-updater.js +128 -0
  242. package/package.json +16 -4
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Platform detection logic for YAML pipelines
3
+ * Implements 3-tier priority detection: stack → platform → auto-detect from steps
4
+ */
5
+ import type { YAMLPipeline, YAMLWorkflow, Platform, MachineType, PlatformInfo } from './types.js';
6
+ export declare class PlatformDetectionError extends Error {
7
+ constructor(message: string);
8
+ }
9
+ /**
10
+ * PlatformDetector analyzes a YAML workflow and determines the target platform
11
+ */
12
+ export declare class PlatformDetector {
13
+ private pipeline;
14
+ private workflow;
15
+ private workflowName;
16
+ constructor(pipeline: YAMLPipeline, workflow: YAMLWorkflow, workflowName: string);
17
+ /**
18
+ * Detects the platform using 3-tier priority detection
19
+ * Priority 1: meta.cibuild.io.stack
20
+ * Priority 2: meta.platform
21
+ * Priority 3: auto-detect from workflow steps
22
+ *
23
+ * @returns Detected platform ('macos', 'linux', or 'windows')
24
+ * @throws PlatformDetectionError if detection fails or mixed platforms detected
25
+ */
26
+ getPlatform(): Platform;
27
+ /**
28
+ * Gets the full stack identifier if specified
29
+ * @returns Stack identifier (e.g., 'macos-xcode-26.4') or null
30
+ */
31
+ getStack(): string | null;
32
+ /**
33
+ * Gets the machine type if specified
34
+ * @returns Machine type ('standard' or 'performance') or null
35
+ */
36
+ getMachineType(): MachineType | null;
37
+ /**
38
+ * Gets complete platform information
39
+ * @returns PlatformInfo object with platform, stack, and machineType
40
+ */
41
+ getPlatformInfo(): PlatformInfo;
42
+ /**
43
+ * Extracts platform from stack name by parsing the prefix
44
+ * @param stack Stack identifier (e.g., 'macos-xcode-26.4')
45
+ * @returns Platform or null if pattern doesn't match
46
+ */
47
+ private extractPlatformFromStack;
48
+ /**
49
+ * Auto-detects platform by analyzing workflow steps
50
+ * @returns Detected platform, defaults to 'linux' for platform-agnostic steps
51
+ * @throws PlatformDetectionError if mixed platforms detected
52
+ */
53
+ private autoDetectFromSteps;
54
+ /**
55
+ * Extracts step names from workflow steps
56
+ * Parses step-name@version format to extract just the step name
57
+ * @returns Array of step names
58
+ */
59
+ private extractStepNames;
60
+ /**
61
+ * Parses step name from "step-name@version" or "step-name" format
62
+ * @param stepNameWithVersion Full step identifier (e.g., "git-clone@4.0.17")
63
+ * @returns Step name without version (e.g., "git-clone")
64
+ */
65
+ private parseStepName;
66
+ }
67
+ /**
68
+ * Helper function to detect platform for a specific workflow
69
+ * @param pipeline Parsed YAML pipeline
70
+ * @param workflowName Name of the workflow to analyze
71
+ * @returns Detected platform
72
+ * @throws Error if workflow doesn't exist
73
+ */
74
+ export declare function detectPlatform(pipeline: YAMLPipeline, workflowName: string): Platform;
75
+ /**
76
+ * Helper function to get complete platform information for a workflow
77
+ * @param pipeline Parsed YAML pipeline
78
+ * @param workflowName Name of the workflow to analyze
79
+ * @returns PlatformInfo object
80
+ * @throws Error if workflow doesn't exist
81
+ */
82
+ export declare function detectPlatformInfo(pipeline: YAMLPipeline, workflowName: string): PlatformInfo;
83
+ //# sourceMappingURL=platform-detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-detector.d.ts","sourceRoot":"","sources":["../../../src/yaml/platform-detector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAElG,qBAAa,sBAAuB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAI5B;AAMD;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,YAAY,CAAS;gBAEjB,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM;IAMhF;;;;;;;;OAQG;IACH,WAAW,IAAI,QAAQ;IAmBvB;;;OAGG;IACH,QAAQ,IAAI,MAAM,GAAG,IAAI;IAIzB;;;OAGG;IACH,cAAc,IAAI,WAAW,GAAG,IAAI;IAIpC;;;OAGG;IACH,eAAe,IAAI,YAAY;IAQ/B;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;IAchC;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAqC3B;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;;;OAIG;IACH,OAAO,CAAC,aAAa;CAOtB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,GAAG,QAAQ,CAQrF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,GAAG,YAAY,CAQ7F"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Platform detection logic for YAML pipelines
3
+ * Implements 3-tier priority detection: stack → platform → auto-detect from steps
4
+ */
5
+ export class PlatformDetectionError extends Error {
6
+ constructor(message) {
7
+ super(message);
8
+ this.name = 'PlatformDetectionError';
9
+ }
10
+ }
11
+ // Platform-specific step names
12
+ const MACOS_STEPS = new Set(['xcodebuild', 'xcode-test']);
13
+ const LINUX_STEPS = new Set(['gradle-build', 'android-lint', 'android-unit-test', 'set-java-version']);
14
+ /**
15
+ * PlatformDetector analyzes a YAML workflow and determines the target platform
16
+ */
17
+ export class PlatformDetector {
18
+ pipeline;
19
+ workflow;
20
+ workflowName;
21
+ constructor(pipeline, workflow, workflowName) {
22
+ this.pipeline = pipeline;
23
+ this.workflow = workflow;
24
+ this.workflowName = workflowName;
25
+ }
26
+ /**
27
+ * Detects the platform using 3-tier priority detection
28
+ * Priority 1: meta.cibuild.io.stack
29
+ * Priority 2: meta.platform
30
+ * Priority 3: auto-detect from workflow steps
31
+ *
32
+ * @returns Detected platform ('macos', 'linux', or 'windows')
33
+ * @throws PlatformDetectionError if detection fails or mixed platforms detected
34
+ */
35
+ getPlatform() {
36
+ // Priority 1: Extract from meta.cibuild.io.stack
37
+ if (this.pipeline.meta?.['cibuild.io']?.stack) {
38
+ const stack = this.pipeline.meta['cibuild.io'].stack;
39
+ const platform = this.extractPlatformFromStack(stack);
40
+ if (platform) {
41
+ return platform;
42
+ }
43
+ }
44
+ // Priority 2: Use meta.platform
45
+ if (this.pipeline.meta?.platform) {
46
+ return this.pipeline.meta.platform;
47
+ }
48
+ // Priority 3: Auto-detect from workflow steps
49
+ return this.autoDetectFromSteps();
50
+ }
51
+ /**
52
+ * Gets the full stack identifier if specified
53
+ * @returns Stack identifier (e.g., 'macos-xcode-26.4') or null
54
+ */
55
+ getStack() {
56
+ return this.pipeline.meta?.['cibuild.io']?.stack ?? null;
57
+ }
58
+ /**
59
+ * Gets the machine type if specified
60
+ * @returns Machine type ('standard' or 'performance') or null
61
+ */
62
+ getMachineType() {
63
+ return this.pipeline.meta?.['cibuild.io']?.machine_type ?? null;
64
+ }
65
+ /**
66
+ * Gets complete platform information
67
+ * @returns PlatformInfo object with platform, stack, and machineType
68
+ */
69
+ getPlatformInfo() {
70
+ return {
71
+ platform: this.getPlatform(),
72
+ stack: this.getStack() ?? undefined,
73
+ machineType: this.getMachineType() ?? undefined,
74
+ };
75
+ }
76
+ /**
77
+ * Extracts platform from stack name by parsing the prefix
78
+ * @param stack Stack identifier (e.g., 'macos-xcode-26.4')
79
+ * @returns Platform or null if pattern doesn't match
80
+ */
81
+ extractPlatformFromStack(stack) {
82
+ const parts = stack.split('-');
83
+ if (parts.length === 0) {
84
+ return null;
85
+ }
86
+ const platformPrefix = parts[0];
87
+ if (platformPrefix === 'macos' || platformPrefix === 'linux' || platformPrefix === 'windows') {
88
+ return platformPrefix;
89
+ }
90
+ return null;
91
+ }
92
+ /**
93
+ * Auto-detects platform by analyzing workflow steps
94
+ * @returns Detected platform, defaults to 'linux' for platform-agnostic steps
95
+ * @throws PlatformDetectionError if mixed platforms detected
96
+ */
97
+ autoDetectFromSteps() {
98
+ const stepNames = this.extractStepNames();
99
+ const macosStepNames = [];
100
+ const linuxStepNames = [];
101
+ for (const stepName of stepNames) {
102
+ if (MACOS_STEPS.has(stepName)) {
103
+ macosStepNames.push(stepName);
104
+ }
105
+ if (LINUX_STEPS.has(stepName)) {
106
+ linuxStepNames.push(stepName);
107
+ }
108
+ }
109
+ // Check for mixed platforms (FR-37)
110
+ if (macosStepNames.length > 0 && linuxStepNames.length > 0) {
111
+ throw new PlatformDetectionError(`Workflow '${this.workflowName}' contains steps for multiple platforms\n` +
112
+ ` macOS steps: ${macosStepNames.join(', ')}\n` +
113
+ ` Linux steps: ${linuxStepNames.join(', ')}\n` +
114
+ `Create separate workflows for each platform or use explicit meta.platform declaration.`);
115
+ }
116
+ // Return detected platform
117
+ if (macosStepNames.length > 0) {
118
+ return 'macos';
119
+ }
120
+ if (linuxStepNames.length > 0) {
121
+ return 'linux';
122
+ }
123
+ // Default to linux for platform-agnostic steps (script, git-clone, cache-*)
124
+ return 'linux';
125
+ }
126
+ /**
127
+ * Extracts step names from workflow steps
128
+ * Parses step-name@version format to extract just the step name
129
+ * @returns Array of step names
130
+ */
131
+ extractStepNames() {
132
+ const stepNames = [];
133
+ for (const stepObj of this.workflow.steps) {
134
+ // Each step is an object with one key: "step-name@version"
135
+ const stepKeys = Object.keys(stepObj);
136
+ if (stepKeys.length === 0) {
137
+ continue;
138
+ }
139
+ const stepNameWithVersion = stepKeys[0];
140
+ const stepName = this.parseStepName(stepNameWithVersion);
141
+ stepNames.push(stepName);
142
+ }
143
+ return stepNames;
144
+ }
145
+ /**
146
+ * Parses step name from "step-name@version" or "step-name" format
147
+ * @param stepNameWithVersion Full step identifier (e.g., "git-clone@4.0.17")
148
+ * @returns Step name without version (e.g., "git-clone")
149
+ */
150
+ parseStepName(stepNameWithVersion) {
151
+ const atIndex = stepNameWithVersion.indexOf('@');
152
+ if (atIndex === -1) {
153
+ return stepNameWithVersion;
154
+ }
155
+ return stepNameWithVersion.substring(0, atIndex);
156
+ }
157
+ }
158
+ /**
159
+ * Helper function to detect platform for a specific workflow
160
+ * @param pipeline Parsed YAML pipeline
161
+ * @param workflowName Name of the workflow to analyze
162
+ * @returns Detected platform
163
+ * @throws Error if workflow doesn't exist
164
+ */
165
+ export function detectPlatform(pipeline, workflowName) {
166
+ const workflow = pipeline.workflows[workflowName];
167
+ if (!workflow) {
168
+ throw new Error(`Workflow '${workflowName}' not found in pipeline`);
169
+ }
170
+ const detector = new PlatformDetector(pipeline, workflow, workflowName);
171
+ return detector.getPlatform();
172
+ }
173
+ /**
174
+ * Helper function to get complete platform information for a workflow
175
+ * @param pipeline Parsed YAML pipeline
176
+ * @param workflowName Name of the workflow to analyze
177
+ * @returns PlatformInfo object
178
+ * @throws Error if workflow doesn't exist
179
+ */
180
+ export function detectPlatformInfo(pipeline, workflowName) {
181
+ const workflow = pipeline.workflows[workflowName];
182
+ if (!workflow) {
183
+ throw new Error(`Workflow '${workflowName}' not found in pipeline`);
184
+ }
185
+ const detector = new PlatformDetector(pipeline, workflow, workflowName);
186
+ return detector.getPlatformInfo();
187
+ }
188
+ //# sourceMappingURL=platform-detector.js.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Unit tests for platform detection
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=platform-detector.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-detector.test.d.ts","sourceRoot":"","sources":["../../../src/yaml/platform-detector.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}