@cbnventures/nova 0.38.0 → 0.39.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 (174) hide show
  1. package/build/package.json +1 -1
  2. package/build/scaffold-versions.json +20 -0
  3. package/build/src/api/app-store-connect.d.ts +17 -2
  4. package/build/src/api/app-store-connect.d.ts.map +1 -1
  5. package/build/src/api/app-store-connect.js +654 -171
  6. package/build/src/api/app-store-connect.js.map +1 -1
  7. package/build/src/api/github-runner-images.d.ts +13 -0
  8. package/build/src/api/github-runner-images.d.ts.map +1 -0
  9. package/build/src/api/github-runner-images.js +238 -0
  10. package/build/src/api/github-runner-images.js.map +1 -0
  11. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +2 -2
  12. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -1
  13. package/build/src/cli/generate/github/workflows-blueprint-validate.js +210 -3
  14. package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
  15. package/build/src/cli/generate/github/workflows-blueprint.d.ts +6 -4
  16. package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
  17. package/build/src/cli/generate/github/workflows-blueprint.js +685 -70
  18. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
  19. package/build/src/cli/generate/must-haves/agent-conventions.d.ts.map +1 -1
  20. package/build/src/cli/generate/must-haves/agent-conventions.js +1 -0
  21. package/build/src/cli/generate/must-haves/agent-conventions.js.map +1 -1
  22. package/build/src/cli/index.js +12 -1
  23. package/build/src/cli/index.js.map +1 -1
  24. package/build/src/cli/integration/app-store-connect.d.ts +10 -0
  25. package/build/src/cli/integration/app-store-connect.d.ts.map +1 -1
  26. package/build/src/cli/integration/app-store-connect.js +701 -80
  27. package/build/src/cli/integration/app-store-connect.js.map +1 -1
  28. package/build/src/cli/scaffold/package/pfsense.d.ts +3 -0
  29. package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
  30. package/build/src/cli/scaffold/package/pfsense.js +140 -6
  31. package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
  32. package/build/src/cli/scaffold/tool/serverless.d.ts +2 -0
  33. package/build/src/cli/scaffold/tool/serverless.d.ts.map +1 -1
  34. package/build/src/cli/scaffold/tool/serverless.js +35 -1
  35. package/build/src/cli/scaffold/tool/serverless.js.map +1 -1
  36. package/build/src/cli/utility/changelog.d.ts +7 -0
  37. package/build/src/cli/utility/changelog.d.ts.map +1 -1
  38. package/build/src/cli/utility/changelog.js +800 -7
  39. package/build/src/cli/utility/changelog.js.map +1 -1
  40. package/build/src/cli/utility/configure.d.ts +3 -1
  41. package/build/src/cli/utility/configure.d.ts.map +1 -1
  42. package/build/src/cli/utility/configure.js +196 -20
  43. package/build/src/cli/utility/configure.js.map +1 -1
  44. package/build/src/lib/docker-packaging.d.ts +1 -0
  45. package/build/src/lib/docker-packaging.d.ts.map +1 -1
  46. package/build/src/lib/docker-packaging.js +39 -2
  47. package/build/src/lib/docker-packaging.js.map +1 -1
  48. package/build/src/lib/env-namespace.d.ts.map +1 -1
  49. package/build/src/lib/env-namespace.js +2 -1
  50. package/build/src/lib/env-namespace.js.map +1 -1
  51. package/build/src/lib/item.d.ts +2 -1
  52. package/build/src/lib/item.d.ts.map +1 -1
  53. package/build/src/lib/item.js +18 -0
  54. package/build/src/lib/item.js.map +1 -1
  55. package/build/src/lib/nova-config.d.ts.map +1 -1
  56. package/build/src/lib/nova-config.js +46 -2
  57. package/build/src/lib/nova-config.js.map +1 -1
  58. package/build/src/lib/regex.d.ts +14 -0
  59. package/build/src/lib/regex.d.ts.map +1 -1
  60. package/build/src/lib/regex.js +14 -0
  61. package/build/src/lib/regex.js.map +1 -1
  62. package/build/src/lib/scaffold.d.ts +3 -3
  63. package/build/src/lib/scaffold.d.ts.map +1 -1
  64. package/build/src/lib/scaffold.js +111 -8
  65. package/build/src/lib/scaffold.js.map +1 -1
  66. package/build/src/lib/workflow-templates.d.ts +4 -1
  67. package/build/src/lib/workflow-templates.d.ts.map +1 -1
  68. package/build/src/lib/workflow-templates.js +60 -2
  69. package/build/src/lib/workflow-templates.js.map +1 -1
  70. package/build/src/types/api/app-store-connect.d.ts +476 -33
  71. package/build/src/types/api/github-runner-images.d.ts +199 -0
  72. package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +69 -8
  73. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +132 -9
  74. package/build/src/types/cli/integration/app-store-connect.d.ts +470 -6
  75. package/build/src/types/cli/scaffold/package/pfsense.d.ts +83 -0
  76. package/build/src/types/cli/scaffold/tool/serverless.d.ts +30 -0
  77. package/build/src/types/cli/utility/changelog.d.ts +327 -1
  78. package/build/src/types/cli/utility/configure.d.ts +92 -4
  79. package/build/src/types/lib/docker-packaging.d.ts +25 -1
  80. package/build/src/types/lib/env-namespace.d.ts +4 -1
  81. package/build/src/types/lib/item.d.ts +7 -0
  82. package/build/src/types/lib/nova-config.d.ts +24 -0
  83. package/build/src/types/lib/regex.d.ts +91 -0
  84. package/build/src/types/lib/scaffold.d.ts +48 -4
  85. package/build/src/types/lib/workflow-templates.d.ts +26 -0
  86. package/build/src/types/shared.d.ts +241 -2
  87. package/build/src/types/tests/api/app-store-connect.test.d.ts +162 -0
  88. package/build/src/types/tests/api/github-runner-images.test.d.ts +113 -0
  89. package/build/src/types/tests/cli/generate/github/workflows-blueprint-generate.test.d.ts +19 -0
  90. package/build/src/types/tests/cli/generate/github/workflows-blueprint-parity.test.d.ts +0 -9
  91. package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +109 -26
  92. package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +123 -30
  93. package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +45 -0
  94. package/build/src/types/tests/cli/generate/github/workflows-version-contract.test.d.ts +2 -2
  95. package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +2 -0
  96. package/build/src/types/tests/cli/integration/app-store-connect.test.d.ts +876 -0
  97. package/build/src/types/tests/cli/scaffold/tool/serverless.test.d.ts +21 -0
  98. package/build/src/types/tests/cli/utility/changelog-android.test.d.ts +14 -0
  99. package/build/src/types/tests/cli/utility/changelog-apple.test.d.ts +21 -0
  100. package/build/src/types/tests/cli/utility/changelog-fold.test.d.ts +350 -0
  101. package/build/src/types/tests/cli/utility/changelog.test.d.ts +50 -0
  102. package/build/src/types/tests/cli/utility/configure.test.d.ts +55 -0
  103. package/build/src/types/tests/lib/nova-config.test.d.ts +28 -0
  104. package/build/src/types/tests/lib/scaffold.test.d.ts +59 -2
  105. package/build/src/types/tests/scaffold-output-contract.test.d.ts +79 -0
  106. package/build/templates/generators/must-haves/agent-conventions/AGENTS.md +1 -0
  107. package/build/templates/generators/must-haves/agent-conventions/CLAUDE.md +1 -0
  108. package/build/templates/generators/must-haves/agent-conventions/conventions/pfsense.md +311 -0
  109. package/build/templates/scaffold/app/android/package.json +1 -1
  110. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-ios-1024.png +0 -0
  111. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128.png +0 -0
  112. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-128@2x.png +0 -0
  113. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16.png +0 -0
  114. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-16@2x.png +0 -0
  115. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256.png +0 -0
  116. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-256@2x.png +0 -0
  117. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32.png +0 -0
  118. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-32@2x.png +0 -0
  119. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512.png +0 -0
  120. package/build/templates/scaffold/app/apple/Sources/Assets.xcassets/AppIcon.appiconset/AppIcon-mac-512@2x.png +0 -0
  121. package/build/templates/scaffold/app/apple/package.json +1 -1
  122. package/build/templates/scaffold/app/astro/package.json +1 -1
  123. package/build/templates/scaffold/app/discord-bot/package.json +1 -1
  124. package/build/templates/scaffold/app/express/package.json +1 -1
  125. package/build/templates/scaffold/app/nextjs/package.json +1 -1
  126. package/build/templates/scaffold/app/vite/package.json +1 -1
  127. package/build/templates/scaffold/docs/docusaurus/package.json +2 -2
  128. package/build/templates/scaffold/package/github-action/package.json +1 -1
  129. package/build/templates/scaffold/package/homebridge/package.json +1 -1
  130. package/build/templates/scaffold/package/pfsense/package.json +1 -1
  131. package/build/templates/scaffold/package/pfsense/port/Makefile.template +16 -1
  132. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/FileLock.php +93 -0
  133. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/PackagePaths.php +40 -0
  134. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__]/UpdateManager.php +1667 -0
  135. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].inc +161 -13
  136. package/build/templates/scaffold/package/pfsense/port/files/usr/local/pkg/[__WORKSPACE_NAME__].xml +37 -0
  137. package/build/templates/scaffold/package/pfsense/port/files/usr/local/sbin/[__WORKSPACE_NAME__] +203 -8
  138. package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/logo.svg +12 -0
  139. package/build/templates/scaffold/package/pfsense/port/files/usr/local/share/pfSense-pkg-[__WORKSPACE_IDENTIFIER__]/release-signing.pub +9 -0
  140. package/build/templates/scaffold/package/pfsense/port/files/usr/local/www/[__WORKSPACE_NAME__]-about.php +437 -0
  141. package/build/templates/scaffold/package/pfsense/port/pkg-plist +6 -0
  142. package/build/templates/scaffold/package/pfsense/scripts/build-package.sh +54 -0
  143. package/build/templates/scaffold/package/pfsense/scripts/check-package.mjs +114 -1
  144. package/build/templates/scaffold/package/pfsense/scripts/regex.mjs +10 -0
  145. package/build/templates/scaffold/package/pfsense/tests/updates.php +695 -0
  146. package/build/templates/scaffold-options/app/android-native/app/src/main/res/drawable/ic_launcher_background.xml +1 -1
  147. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  148. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  149. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  150. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  151. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  152. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  153. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  154. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  155. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  156. package/build/templates/scaffold-options/app/android-native/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  157. package/build/templates/scaffold-options/docker-image/common/Dockerfile +7 -0
  158. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +1 -1
  159. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/index.test.d.ts +40 -2
  160. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/landing-page.d.ts +23 -0
  161. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.test.ts +119 -4
  162. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.ts +25 -3
  163. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/landing-page.ts +278 -0
  164. package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.test.ts +121 -6
  165. package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.ts +49 -12
  166. package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +3 -1
  167. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/function/landing-page.ts +278 -0
  168. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.d.ts +17 -2
  169. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.test.d.ts +40 -2
  170. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/function/landing-page.d.ts +23 -0
  171. package/build/templates/scaffold-options/tool/serverless/vercel-functions/tsconfig.functions.json +3 -1
  172. package/build/templates/scaffold-options/tool/serverless/vercel-functions/vercel.json +7 -1
  173. package/package.json +1 -1
  174. package/build/templates/scaffold/package/pfsense-root/.github/workflows/pfsense-[__WORKSPACE_NAME__].yml +0 -62
@@ -2,6 +2,7 @@ import { promises as fs } from 'node:fs';
2
2
  import { join, relative, sep } from 'node:path';
3
3
  import chalk from 'chalk';
4
4
  import prompts from 'prompts';
5
+ import { GITHUB_RUNNER_IMAGES_README_URL, Runner as GithubRunnerImages, } from '../../api/github-runner-images.js';
5
6
  import { libEnvGithub } from '../../lib/env-github.js';
6
7
  import { libEnvManagedSet } from '../../lib/env-managed-set.js';
7
8
  import { libEnvNamespace } from '../../lib/env-namespace.js';
@@ -15,7 +16,7 @@ import { LIB_REGEX_LINEBREAK_CRLF_OR_LF, LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REG
15
16
  import { Runner as LibReleaseHistory } from '../../lib/release-history.js';
16
17
  import { discoverPathsWithFile, isPlainObject, pathExists, resolveTemplatePath, } from '../../lib/utility.js';
17
18
  import { Runner as LibVersionStrategyMigration } from '../../lib/version-strategy-migration.js';
18
- import { libWorkflowTemplatesMetadata } from '../../lib/workflow-templates.js';
19
+ import { libWorkflowStepKinds, libWorkflowTemplatesMetadata, } from '../../lib/workflow-templates.js';
19
20
  import { Logger } from '../../toolkit/index.js';
20
21
  export class Runner {
21
22
  static async run(options) {
@@ -184,6 +185,16 @@ export class Runner {
184
185
  }
185
186
  return true;
186
187
  }
188
+ static isEnvironmentPrefixInput(value) {
189
+ if (typeof value !== 'string') {
190
+ return 'Use one uppercase word containing only letters or digits, starting with a letter, followed by "_" (for example, "CBN_").';
191
+ }
192
+ const trimmed = value.trim();
193
+ if (libEnvNamespace.isValidPrefix(trimmed) === false) {
194
+ return 'Use one uppercase word containing only letters or digits, starting with a letter, followed by "_" (for example, "CBN_").';
195
+ }
196
+ return true;
197
+ }
187
198
  static isIgnoreFilePathInput(value) {
188
199
  if (typeof value !== 'string') {
189
200
  return 'Enter a project-relative ignore-file path.';
@@ -233,6 +244,41 @@ export class Runner {
233
244
  }
234
245
  return true;
235
246
  }
247
+ static isWorkflowStepTimeoutInput(value) {
248
+ if (typeof value !== 'string') {
249
+ return 'Enter a JSON object keyed by a supported step kind, or leave the field blank.';
250
+ }
251
+ const trimmed = value.trim();
252
+ if (trimmed === '') {
253
+ return true;
254
+ }
255
+ try {
256
+ const parsed = JSON.parse(trimmed);
257
+ if (isPlainObject(parsed) === false) {
258
+ return 'Enter a JSON object keyed by a supported step kind.';
259
+ }
260
+ const entries = Object.entries(parsed);
261
+ for (const entry of entries) {
262
+ const typedEntry = entry;
263
+ const entryKind = typedEntry[0];
264
+ const entryValue = typedEntry[1];
265
+ const isKnownKind = libWorkflowStepKinds.some((stepKind) => stepKind === entryKind);
266
+ if (isKnownKind === false) {
267
+ return `Unknown step kind "${entryKind}". Allowed kinds: ${libWorkflowStepKinds.join(', ')}.`;
268
+ }
269
+ if (typeof entryValue !== 'number'
270
+ || Number.isInteger(entryValue) === false
271
+ || entryValue < 1
272
+ || entryValue > 360) {
273
+ return `Enter a whole number from 1 through 360 for "${entryKind}".`;
274
+ }
275
+ }
276
+ }
277
+ catch {
278
+ return 'Enter valid JSON, for example {"install":10,"deploy":15}.';
279
+ }
280
+ return true;
281
+ }
236
282
  static isPositiveIntegerRecordInput(value) {
237
283
  if (typeof value !== 'string') {
238
284
  return 'Enter a JSON object with positive integer values.';
@@ -3729,9 +3775,44 @@ export class Runner {
3729
3775
  }
3730
3776
  }
3731
3777
  static async promptWorkflowsForm(workflow, mode, workflows, config) {
3778
+ const runnerImages = await GithubRunnerImages.fetchRunnerImages();
3779
+ if (runnerImages === undefined) {
3780
+ Logger.customize({
3781
+ name: 'Runner.promptWorkflowsForm',
3782
+ purpose: 'runners',
3783
+ }).error(`Could not read GitHub's runner list from ${GITHUB_RUNNER_IMAGES_README_URL}.`);
3784
+ return {
3785
+ action: 'back',
3786
+ };
3787
+ }
3788
+ const selectableRunnerLabels = GithubRunnerImages.selectableLabels(runnerImages);
3789
+ const existingRunsOn = (workflow !== undefined && typeof workflow['runsOn'] === 'string') ? workflow['runsOn'] : '';
3790
+ const runnerChoices = selectableRunnerLabels.map((entry) => {
3791
+ const paidSuffix = (entry['paid'] === true) ? ' (paid)' : '';
3792
+ return {
3793
+ title: `${entry['label']}${paidSuffix}`,
3794
+ description: `${entry['imageName']}, ${entry['architecture']}`,
3795
+ value: entry['label'],
3796
+ };
3797
+ });
3798
+ let runnerInitialIndex = selectableRunnerLabels.findIndex((entry) => entry['label'] === existingRunsOn);
3799
+ if (runnerInitialIndex === -1) {
3800
+ runnerInitialIndex = selectableRunnerLabels.findIndex((entry) => entry['label'].startsWith('ubuntu-') === true && entry['architecture'] === 'x64');
3801
+ }
3802
+ if (runnerInitialIndex === -1) {
3803
+ Logger.customize({
3804
+ name: 'Runner.promptWorkflowsForm',
3805
+ purpose: 'runners',
3806
+ }).error('GitHub\'s runner list does not contain an available pinned Ubuntu x64 label.');
3807
+ return {
3808
+ action: 'back',
3809
+ };
3810
+ }
3732
3811
  const existingTemplate = (workflow !== undefined && typeof workflow['template'] === 'string') ? workflow['template'] : '';
3733
3812
  const existingSuffix = (workflow !== undefined && typeof workflow['name'] === 'string') ? workflow['name'] : '';
3734
3813
  const existingTimeoutMinutes = (workflow !== undefined && typeof workflow['timeoutMinutes'] === 'number') ? workflow['timeoutMinutes'] : undefined;
3814
+ const existingBuildTimeoutMinutes = (workflow !== undefined && typeof workflow['buildTimeoutMinutes'] === 'number') ? workflow['buildTimeoutMinutes'] : undefined;
3815
+ const existingStepTimeoutMinutes = (workflow !== undefined) ? workflow['stepTimeoutMinutes'] : undefined;
3735
3816
  const existingEnvironmentSelection = (workflow !== undefined) ? workflow['environmentSelection'] : undefined;
3736
3817
  const existingContainerPlatforms = (workflow !== undefined
3737
3818
  && Array.isArray(workflow['containerPlatforms']) === true
@@ -3813,11 +3894,8 @@ export class Runner {
3813
3894
  type: 'select',
3814
3895
  name: 'runsOn',
3815
3896
  message: 'GitHub-hosted runner',
3816
- choices: [{
3817
- title: 'ubuntu-latest',
3818
- value: 'ubuntu-latest',
3819
- }],
3820
- initial: 0,
3897
+ choices: runnerChoices,
3898
+ initial: runnerInitialIndex,
3821
3899
  },
3822
3900
  {
3823
3901
  type: 'text',
@@ -3826,6 +3904,20 @@ export class Runner {
3826
3904
  initial: (existingTimeoutMinutes === undefined) ? '' : `${existingTimeoutMinutes}`,
3827
3905
  validate: Runner['isOptionalWorkflowTimeoutInput'],
3828
3906
  },
3907
+ ...((selectedTemplate === 'publish') ? [{
3908
+ type: 'text',
3909
+ name: 'buildTimeoutMinutes',
3910
+ message: 'Publish build job timeout in minutes (1-360; blank inherits the workflow timeout)',
3911
+ initial: (existingBuildTimeoutMinutes === undefined) ? '' : `${existingBuildTimeoutMinutes}`,
3912
+ validate: Runner['isOptionalWorkflowTimeoutInput'],
3913
+ }] : []),
3914
+ {
3915
+ type: 'text',
3916
+ name: 'stepTimeoutMinutes',
3917
+ message: `Step timeouts as JSON (${libWorkflowStepKinds.join(', ')}; blank keeps defaults)`,
3918
+ initial: (existingStepTimeoutMinutes === undefined) ? '' : JSON.stringify(existingStepTimeoutMinutes),
3919
+ validate: Runner['isWorkflowStepTimeoutInput'],
3920
+ },
3829
3921
  ]);
3830
3922
  if (executionOutput['cancelled'] === true) {
3831
3923
  return {
@@ -3833,9 +3925,13 @@ export class Runner {
3833
3925
  };
3834
3926
  }
3835
3927
  const executionOutputResultValue = executionOutput['result'];
3836
- const selectedRunsOn = (executionOutputResultValue.runsOn === 'ubuntu-latest') ? executionOutputResultValue.runsOn : 'ubuntu-latest';
3928
+ const selectedRunsOn = executionOutputResultValue['runsOn'];
3837
3929
  const timeoutMinutesRaw = (typeof executionOutputResultValue.timeoutMinutes === 'string') ? executionOutputResultValue.timeoutMinutes.trim() : '';
3838
3930
  const selectedTimeoutMinutes = (timeoutMinutesRaw === '') ? undefined : Number.parseInt(timeoutMinutesRaw, 10);
3931
+ const buildTimeoutMinutesRaw = (typeof executionOutputResultValue.buildTimeoutMinutes === 'string') ? executionOutputResultValue.buildTimeoutMinutes.trim() : '';
3932
+ const selectedBuildTimeoutMinutes = (buildTimeoutMinutesRaw === '') ? undefined : Number.parseInt(buildTimeoutMinutesRaw, 10);
3933
+ const stepTimeoutMinutesRaw = (typeof executionOutputResultValue.stepTimeoutMinutes === 'string') ? executionOutputResultValue.stepTimeoutMinutes.trim() : '';
3934
+ const selectedStepTimeoutMinutes = (stepTimeoutMinutesRaw === '') ? undefined : JSON.parse(stepTimeoutMinutesRaw);
3839
3935
  const triggersDir = join(resolveTemplatePath(import.meta.url, 'generators/github/workflows'), selectedTemplate, 'triggers');
3840
3936
  const triggersDirExists = await pathExists(triggersDir);
3841
3937
  const triggerChoices = [];
@@ -3976,7 +4072,22 @@ export class Runner {
3976
4072
  if ((matchedMetadata !== undefined
3977
4073
  && matchedMetadata['supportsTargets'] === true)
3978
4074
  || selectedTargets.length > 0) {
3979
- const availableTargetTypes = (matchedMetadata !== undefined) ? Object.keys(matchedMetadata['targets'] ?? {}) : [];
4075
+ const availableTargetTypes = (matchedMetadata !== undefined) ? Object.keys(matchedMetadata['targets'] ?? {}).filter((availableTargetType) => {
4076
+ const availableTargetMetadata = (matchedMetadata['targets'] !== undefined) ? matchedMetadata['targets'][availableTargetType] : undefined;
4077
+ if (availableTargetMetadata === undefined
4078
+ || (availableTargetMetadata['workspaceRole'] === undefined
4079
+ && availableTargetMetadata['workspaceNamePrefix'] === undefined)) {
4080
+ return true;
4081
+ }
4082
+ return workspaceKeys.some((workspaceKey) => {
4083
+ const availableTargetWorkspace = (config['workspaces'] !== undefined) ? config['workspaces'][workspaceKey] : undefined;
4084
+ return (availableTargetWorkspace !== undefined
4085
+ && (availableTargetMetadata['workspaceRole'] === undefined
4086
+ || availableTargetWorkspace['role'] === availableTargetMetadata['workspaceRole'])
4087
+ && (availableTargetMetadata['workspaceNamePrefix'] === undefined
4088
+ || availableTargetWorkspace['name'].startsWith(availableTargetMetadata['workspaceNamePrefix']) === true));
4089
+ });
4090
+ }) : [];
3980
4091
  const existingTargetTypes = selectedTargets.map((target) => target['to']);
3981
4092
  const hasContainerTargetInAnotherWorkflow = workflows.some((candidate) => {
3982
4093
  if (candidate === workflow || Array.isArray(candidate['deploy']) === false) {
@@ -4100,8 +4211,20 @@ export class Runner {
4100
4211
  const isContainerTarget = selectedTargetType === 'docker-hub' || selectedTargetType === 'ghcr';
4101
4212
  let selectedTargetWorkingDir = './';
4102
4213
  if (isContainerTarget === false) {
4103
- const targetWorkingDirInitial = (targetToEdit !== undefined) ? workspaceKeys.indexOf(targetToEdit['path']) : 0;
4104
- const targetWorkingDirChoices = workspaceKeys.map((workspaceKey) => ({
4214
+ const targetPathMetadata = (matchedMetadata !== undefined
4215
+ && matchedMetadata['targets'] !== undefined) ? matchedMetadata['targets'][selectedTargetType] : undefined;
4216
+ const targetWorkspaceKeys = workspaceKeys.filter((workspaceKey) => {
4217
+ const targetPathWorkspace = (config['workspaces'] !== undefined) ? config['workspaces'][workspaceKey] : undefined;
4218
+ return (targetPathWorkspace !== undefined
4219
+ && (targetPathMetadata === undefined
4220
+ || targetPathMetadata['workspaceRole'] === undefined
4221
+ || targetPathWorkspace['role'] === targetPathMetadata['workspaceRole'])
4222
+ && (targetPathMetadata === undefined
4223
+ || targetPathMetadata['workspaceNamePrefix'] === undefined
4224
+ || targetPathWorkspace['name'].startsWith(targetPathMetadata['workspaceNamePrefix']) === true));
4225
+ });
4226
+ const targetWorkingDirInitial = (targetToEdit !== undefined) ? targetWorkspaceKeys.indexOf(targetToEdit['path']) : 0;
4227
+ const targetWorkingDirChoices = targetWorkspaceKeys.map((workspaceKey) => ({
4105
4228
  title: workspaceKey,
4106
4229
  value: workspaceKey,
4107
4230
  }));
@@ -4165,16 +4288,27 @@ export class Runner {
4165
4288
  const targetNeedsOutputResultValue = targetNeedsOutput['result'];
4166
4289
  selectedTargetNeeds = (Array.isArray(targetNeedsOutputResultValue.targetNeeds) === true && targetNeedsOutputResultValue.targetNeeds.length > 0) ? targetNeedsOutputResultValue.targetNeeds : undefined;
4167
4290
  }
4168
- const targetSettingsOutput = await Runner.promptWithCancel({
4169
- type: 'text',
4170
- name: 'targetSettings',
4171
- message: 'Target settings as a JSON object (blank unsets)',
4172
- initial: (targetToEdit !== undefined && targetToEdit['with'] !== undefined) ? JSON.stringify(targetToEdit['with']) : '',
4173
- validate: Runner['isStringRecordInput'],
4174
- });
4291
+ const targetSettingsOutput = await Runner.promptWithCancel([
4292
+ {
4293
+ type: 'text',
4294
+ name: 'targetTimeoutMinutes',
4295
+ message: 'Target job timeout in minutes (1-360; blank inherits the workflow timeout)',
4296
+ initial: (targetToEdit !== undefined && targetToEdit['timeoutMinutes'] !== undefined) ? `${targetToEdit['timeoutMinutes']}` : '',
4297
+ validate: Runner['isOptionalWorkflowTimeoutInput'],
4298
+ },
4299
+ {
4300
+ type: 'text',
4301
+ name: 'targetSettings',
4302
+ message: 'Target settings as a JSON object (blank unsets)',
4303
+ initial: (targetToEdit !== undefined && targetToEdit['with'] !== undefined) ? JSON.stringify(targetToEdit['with']) : '',
4304
+ validate: Runner['isStringRecordInput'],
4305
+ },
4306
+ ]);
4175
4307
  if (targetSettingsOutput['cancelled'] === true) {
4176
4308
  continue;
4177
4309
  }
4310
+ const targetTimeoutMinutesRaw = (typeof targetSettingsOutput['result'].targetTimeoutMinutes === 'string') ? targetSettingsOutput['result'].targetTimeoutMinutes.trim() : '';
4311
+ const selectedTargetTimeoutMinutes = (targetTimeoutMinutesRaw === '') ? undefined : Number.parseInt(targetTimeoutMinutesRaw, 10);
4178
4312
  const targetSettings = Runner.parseStringRecordInput(targetSettingsOutput['result'].targetSettings);
4179
4313
  const selectedTargetMetadata = (matchedMetadata === undefined || matchedMetadata['targets'] === undefined) ? undefined : matchedMetadata['targets'][selectedTargetType];
4180
4314
  const targetRequiredLiterals = (selectedTargetMetadata === undefined || selectedTargetMetadata['requiredLiterals'] === undefined) ? {} : selectedTargetMetadata['requiredLiterals'];
@@ -4209,6 +4343,9 @@ export class Runner {
4209
4343
  to: selectedTargetType,
4210
4344
  path: selectedTargetWorkingDir,
4211
4345
  };
4346
+ if (selectedTargetTimeoutMinutes !== undefined) {
4347
+ Reflect.set(newTarget, 'timeoutMinutes', selectedTargetTimeoutMinutes);
4348
+ }
4212
4349
  if (selectedTargetNeeds !== undefined) {
4213
4350
  Reflect.set(newTarget, 'after', selectedTargetNeeds);
4214
4351
  }
@@ -4481,6 +4618,12 @@ export class Runner {
4481
4618
  if (selectedTimeoutMinutes !== undefined) {
4482
4619
  Reflect.set(resolvedWorkflow, 'timeoutMinutes', selectedTimeoutMinutes);
4483
4620
  }
4621
+ if (selectedBuildTimeoutMinutes !== undefined) {
4622
+ Reflect.set(resolvedWorkflow, 'buildTimeoutMinutes', selectedBuildTimeoutMinutes);
4623
+ }
4624
+ if (selectedStepTimeoutMinutes !== undefined) {
4625
+ Reflect.set(resolvedWorkflow, 'stepTimeoutMinutes', selectedStepTimeoutMinutes);
4626
+ }
4484
4627
  if (selectedEnvironmentSelection !== undefined) {
4485
4628
  Reflect.set(resolvedWorkflow, 'environmentSelection', selectedEnvironmentSelection);
4486
4629
  }
@@ -5025,8 +5168,14 @@ export class Runner {
5025
5168
  const prefixOutput = await Runner.promptWithCancel({
5026
5169
  type: 'text',
5027
5170
  name: 'prefix',
5028
- message: `Prefix for workflow "${workflowName}" (blank removes it)`,
5171
+ message: `Prefix for workflow "${workflowName}" (e.g. "CBN_", blank removes it):`,
5029
5172
  initial: (existing !== undefined) ? existing['prefix'] : '',
5173
+ validate: (value) => {
5174
+ if (typeof value === 'string' && value.trim() === '') {
5175
+ return true;
5176
+ }
5177
+ return Runner.isEnvironmentPrefixInput(value);
5178
+ },
5030
5179
  });
5031
5180
  if (prefixOutput['cancelled'] === true) {
5032
5181
  return 'back';
@@ -5035,6 +5184,24 @@ export class Runner {
5035
5184
  if (prefix === '') {
5036
5185
  Reflect.deleteProperty(workflows, workflowName);
5037
5186
  }
5187
+ else if (libEnvNamespace.isValidPrefix(prefix) === false) {
5188
+ Logger.customize({
5189
+ name: 'Runner.promptEnvironmentWorkflow',
5190
+ purpose: 'prefixFormat',
5191
+ padTop: 1,
5192
+ padBottom: 1,
5193
+ }).error('Use one uppercase word containing only letters or digits, starting with a letter, followed by "_" (for example, "CBN_").');
5194
+ return 'back';
5195
+ }
5196
+ else if (libEnvNamespace.isReservedPrefix(prefix) === true) {
5197
+ Logger.customize({
5198
+ name: 'Runner.promptEnvironmentWorkflow',
5199
+ purpose: 'reservedPrefix',
5200
+ padTop: 1,
5201
+ padBottom: 1,
5202
+ }).error(`The prefix "${prefix}" is reserved by GitHub. Choose a prefix that does not start with "GITHUB_".`);
5203
+ return 'back';
5204
+ }
5038
5205
  else {
5039
5206
  Reflect.set(workflows, workflowName, { prefix });
5040
5207
  }
@@ -5291,15 +5458,24 @@ export class Runner {
5291
5458
  name: 'prefix',
5292
5459
  message: 'GitHub name prefix (e.g. "CBN_"):',
5293
5460
  initial: prefix,
5294
- validate: Runner['isNonEmptyLiteralInput'],
5461
+ validate: Runner['isEnvironmentPrefixInput'],
5295
5462
  });
5296
5463
  if (prefixOutput['cancelled'] === true) {
5297
5464
  continue;
5298
5465
  }
5299
- const prefixInput = prefixOutput['result'].prefix.trim().toUpperCase();
5466
+ const prefixInput = prefixOutput['result'].prefix.trim();
5300
5467
  if (prefixInput === '') {
5301
5468
  continue;
5302
5469
  }
5470
+ if (libEnvNamespace.isValidPrefix(prefixInput) === false) {
5471
+ Logger.customize({
5472
+ name: 'Runner.promptEnvironmentScope',
5473
+ purpose: 'prefixFormat',
5474
+ padTop: 1,
5475
+ padBottom: 1,
5476
+ }).error('Use one uppercase word containing only letters or digits, starting with a letter, followed by "_" (for example, "CBN_").');
5477
+ continue;
5478
+ }
5303
5479
  if (libEnvNamespace.isReservedPrefix(prefixInput) === true) {
5304
5480
  Logger.customize({
5305
5481
  name: 'Runner.promptEnvironmentScope',