@cbnventures/nova 0.31.1 → 0.33.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 (501) hide show
  1. package/build/package.json +5 -6
  2. package/build/scaffold-versions.json +828 -0
  3. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -1
  4. package/build/src/cli/generate/github/workflows-blueprint-validate.js +20 -0
  5. package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -1
  6. package/build/src/cli/generate/github/workflows-blueprint.d.ts +3 -3
  7. package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -1
  8. package/build/src/cli/generate/github/workflows-blueprint.js +58 -69
  9. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -1
  10. package/build/src/cli/generate/must-haves/ignore-files.d.ts +5 -0
  11. package/build/src/cli/generate/must-haves/ignore-files.d.ts.map +1 -0
  12. package/build/src/cli/generate/must-haves/ignore-files.js +77 -0
  13. package/build/src/cli/generate/must-haves/ignore-files.js.map +1 -0
  14. package/build/src/cli/index.js +98 -114
  15. package/build/src/cli/index.js.map +1 -1
  16. package/build/src/cli/recipe/github/sync-rulesets.js +2 -2
  17. package/build/src/cli/recipe/github/sync-rulesets.js.map +1 -1
  18. package/build/src/cli/recipe/index.d.ts.map +1 -1
  19. package/build/src/cli/recipe/index.js +13 -1
  20. package/build/src/cli/recipe/index.js.map +1 -1
  21. package/build/src/cli/recipe/miscellaneous/fix-markdown-tables.d.ts.map +1 -1
  22. package/build/src/cli/recipe/miscellaneous/fix-markdown-tables.js +15 -1
  23. package/build/src/cli/recipe/miscellaneous/fix-markdown-tables.js.map +1 -1
  24. package/build/src/cli/recipe/miscellaneous/remove-operating-system-files.d.ts +9 -0
  25. package/build/src/cli/recipe/miscellaneous/remove-operating-system-files.d.ts.map +1 -0
  26. package/build/src/cli/recipe/miscellaneous/remove-operating-system-files.js +173 -0
  27. package/build/src/cli/recipe/miscellaneous/remove-operating-system-files.js.map +1 -0
  28. package/build/src/cli/recipe/nova-config/normalize-order.d.ts +5 -0
  29. package/build/src/cli/recipe/nova-config/normalize-order.d.ts.map +1 -0
  30. package/build/src/cli/recipe/nova-config/normalize-order.js +104 -0
  31. package/build/src/cli/recipe/nova-config/normalize-order.js.map +1 -0
  32. package/build/src/cli/recipe/package-json/normalize-tooling.d.ts.map +1 -1
  33. package/build/src/cli/recipe/package-json/normalize-tooling.js +66 -28
  34. package/build/src/cli/recipe/package-json/normalize-tooling.js.map +1 -1
  35. package/build/src/cli/scaffold/app/android.d.ts.map +1 -1
  36. package/build/src/cli/scaffold/app/android.js +4 -0
  37. package/build/src/cli/scaffold/app/android.js.map +1 -1
  38. package/build/src/cli/scaffold/app/apple.d.ts +5 -0
  39. package/build/src/cli/scaffold/app/apple.d.ts.map +1 -1
  40. package/build/src/cli/scaffold/app/apple.js +96 -0
  41. package/build/src/cli/scaffold/app/apple.js.map +1 -1
  42. package/build/src/cli/scaffold/app/astro.d.ts.map +1 -1
  43. package/build/src/cli/scaffold/app/astro.js +11 -5
  44. package/build/src/cli/scaffold/app/astro.js.map +1 -1
  45. package/build/src/cli/scaffold/app/discord-bot.d.ts.map +1 -1
  46. package/build/src/cli/scaffold/app/discord-bot.js +11 -2
  47. package/build/src/cli/scaffold/app/discord-bot.js.map +1 -1
  48. package/build/src/cli/scaffold/app/expressjs.d.ts.map +1 -1
  49. package/build/src/cli/scaffold/app/expressjs.js +11 -2
  50. package/build/src/cli/scaffold/app/expressjs.js.map +1 -1
  51. package/build/src/cli/scaffold/app/nextjs.d.ts.map +1 -1
  52. package/build/src/cli/scaffold/app/nextjs.js +7 -2
  53. package/build/src/cli/scaffold/app/nextjs.js.map +1 -1
  54. package/build/src/cli/scaffold/app/vite.d.ts.map +1 -1
  55. package/build/src/cli/scaffold/app/vite.js +18 -12
  56. package/build/src/cli/scaffold/app/vite.js.map +1 -1
  57. package/build/src/cli/scaffold/docs/docusaurus.d.ts.map +1 -1
  58. package/build/src/cli/scaffold/docs/docusaurus.js +7 -2
  59. package/build/src/cli/scaffold/docs/docusaurus.js.map +1 -1
  60. package/build/src/cli/scaffold/package/github-action.d.ts.map +1 -1
  61. package/build/src/cli/scaffold/package/github-action.js +1 -0
  62. package/build/src/cli/scaffold/package/github-action.js.map +1 -1
  63. package/build/src/cli/scaffold/package/homebridge.d.ts.map +1 -1
  64. package/build/src/cli/scaffold/package/homebridge.js +6 -1
  65. package/build/src/cli/scaffold/package/homebridge.js.map +1 -1
  66. package/build/src/cli/scaffold/package/pfsense.d.ts.map +1 -1
  67. package/build/src/cli/scaffold/package/pfsense.js +4 -0
  68. package/build/src/cli/scaffold/package/pfsense.js.map +1 -1
  69. package/build/src/cli/scaffold/starter/base.d.ts.map +1 -1
  70. package/build/src/cli/scaffold/starter/base.js +1 -1
  71. package/build/src/cli/scaffold/starter/base.js.map +1 -1
  72. package/build/src/cli/scaffold/tool/serverless.d.ts +6 -0
  73. package/build/src/cli/scaffold/tool/serverless.d.ts.map +1 -0
  74. package/build/src/cli/scaffold/tool/serverless.js +47 -0
  75. package/build/src/cli/scaffold/tool/serverless.js.map +1 -0
  76. package/build/src/cli/utility/changelog.d.ts.map +1 -1
  77. package/build/src/cli/utility/changelog.js +73 -5
  78. package/build/src/cli/utility/changelog.js.map +1 -1
  79. package/build/src/cli/utility/configure.d.ts +25 -1
  80. package/build/src/cli/utility/configure.d.ts.map +1 -1
  81. package/build/src/cli/utility/configure.js +2116 -221
  82. package/build/src/cli/utility/configure.js.map +1 -1
  83. package/build/src/cli/utility/run-recipes.d.ts.map +1 -1
  84. package/build/src/cli/utility/run-recipes.js +7 -26
  85. package/build/src/cli/utility/run-recipes.js.map +1 -1
  86. package/build/src/cli/utility/run-workspaces.d.ts +10 -0
  87. package/build/src/cli/utility/run-workspaces.d.ts.map +1 -0
  88. package/build/src/cli/utility/run-workspaces.js +48 -0
  89. package/build/src/cli/utility/run-workspaces.js.map +1 -0
  90. package/build/src/lib/constants.d.ts +2 -1
  91. package/build/src/lib/constants.d.ts.map +1 -1
  92. package/build/src/lib/constants.js +1 -0
  93. package/build/src/lib/constants.js.map +1 -1
  94. package/build/src/lib/corepack.d.ts +2 -1
  95. package/build/src/lib/corepack.d.ts.map +1 -1
  96. package/build/src/lib/corepack.js +21 -0
  97. package/build/src/lib/corepack.js.map +1 -1
  98. package/build/src/lib/docker-packaging.d.ts +7 -0
  99. package/build/src/lib/docker-packaging.d.ts.map +1 -0
  100. package/build/src/{cli/generate/docker-image/index.js → lib/docker-packaging.js} +22 -96
  101. package/build/src/lib/docker-packaging.js.map +1 -0
  102. package/build/src/lib/ignore-files.d.ts +5 -0
  103. package/build/src/lib/ignore-files.d.ts.map +1 -0
  104. package/build/src/lib/ignore-files.js +77 -0
  105. package/build/src/lib/ignore-files.js.map +1 -0
  106. package/build/src/lib/item.d.ts +3 -1
  107. package/build/src/lib/item.d.ts.map +1 -1
  108. package/build/src/lib/item.js +25 -0
  109. package/build/src/lib/item.js.map +1 -1
  110. package/build/src/lib/nova-config-order.d.ts +3 -0
  111. package/build/src/lib/nova-config-order.d.ts.map +1 -0
  112. package/build/src/lib/nova-config-order.js +38 -0
  113. package/build/src/lib/nova-config-order.js.map +1 -0
  114. package/build/src/lib/nova-config.d.ts +5 -3
  115. package/build/src/lib/nova-config.d.ts.map +1 -1
  116. package/build/src/lib/nova-config.js +211 -13
  117. package/build/src/lib/nova-config.js.map +1 -1
  118. package/build/src/lib/package-scripts.d.ts +11 -0
  119. package/build/src/lib/package-scripts.d.ts.map +1 -0
  120. package/build/src/lib/package-scripts.js +227 -0
  121. package/build/src/lib/package-scripts.js.map +1 -0
  122. package/build/src/lib/regex.d.ts +3 -1
  123. package/build/src/lib/regex.d.ts.map +1 -1
  124. package/build/src/lib/regex.js +5 -3
  125. package/build/src/lib/regex.js.map +1 -1
  126. package/build/src/lib/run-scripts.d.ts +0 -1
  127. package/build/src/lib/run-scripts.d.ts.map +1 -1
  128. package/build/src/lib/run-scripts.js +9 -12
  129. package/build/src/lib/run-scripts.js.map +1 -1
  130. package/build/src/lib/run-workspaces-cache.d.ts +7 -0
  131. package/build/src/lib/run-workspaces-cache.d.ts.map +1 -0
  132. package/build/src/lib/run-workspaces-cache.js +168 -0
  133. package/build/src/lib/run-workspaces-cache.js.map +1 -0
  134. package/build/src/lib/run-workspaces.d.ts +19 -0
  135. package/build/src/lib/run-workspaces.d.ts.map +1 -0
  136. package/build/src/lib/run-workspaces.js +792 -0
  137. package/build/src/lib/run-workspaces.js.map +1 -0
  138. package/build/src/lib/scaffold-presentation.d.ts.map +1 -1
  139. package/build/src/lib/scaffold-presentation.js.map +1 -1
  140. package/build/src/lib/scaffold-versions.d.ts +4 -0
  141. package/build/src/lib/scaffold-versions.d.ts.map +1 -0
  142. package/build/src/lib/scaffold-versions.js +17 -0
  143. package/build/src/lib/scaffold-versions.js.map +1 -0
  144. package/build/src/lib/scaffold.d.ts +3 -3
  145. package/build/src/lib/scaffold.d.ts.map +1 -1
  146. package/build/src/lib/scaffold.js +237 -135
  147. package/build/src/lib/scaffold.js.map +1 -1
  148. package/build/src/lib/transpile.d.ts.map +1 -1
  149. package/build/src/lib/transpile.js +4 -3
  150. package/build/src/lib/transpile.js.map +1 -1
  151. package/build/src/lib/type-check.d.ts +2 -1
  152. package/build/src/lib/type-check.d.ts.map +1 -1
  153. package/build/src/lib/type-check.js +22 -4
  154. package/build/src/lib/type-check.js.map +1 -1
  155. package/build/src/lib/type-declaration-engine.d.ts.map +1 -1
  156. package/build/src/lib/type-declaration-engine.js +57 -30
  157. package/build/src/lib/type-declaration-engine.js.map +1 -1
  158. package/build/src/lib/utility.d.ts +2 -2
  159. package/build/src/lib/utility.d.ts.map +1 -1
  160. package/build/src/lib/utility.js +28 -5
  161. package/build/src/lib/utility.js.map +1 -1
  162. package/build/src/presets/eslint/index.d.ts +1 -0
  163. package/build/src/presets/eslint/index.d.ts.map +1 -1
  164. package/build/src/presets/eslint/index.js +1 -0
  165. package/build/src/presets/eslint/index.js.map +1 -1
  166. package/build/src/presets/eslint/nova-rules.d.ts +4 -0
  167. package/build/src/presets/eslint/nova-rules.d.ts.map +1 -0
  168. package/build/src/{rules → presets}/eslint/nova-rules.js +48 -48
  169. package/build/src/presets/eslint/nova-rules.js.map +1 -0
  170. package/build/src/rules/eslint/index.d.ts +0 -1
  171. package/build/src/rules/eslint/index.d.ts.map +1 -1
  172. package/build/src/rules/eslint/index.js +0 -1
  173. package/build/src/rules/eslint/index.js.map +1 -1
  174. package/build/src/rules/eslint/jsdoc/require-jsdoc-body.d.ts.map +1 -1
  175. package/build/src/rules/eslint/jsdoc/require-jsdoc-body.js +2 -1
  176. package/build/src/rules/eslint/jsdoc/require-jsdoc-body.js.map +1 -1
  177. package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts.map +1 -1
  178. package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.js +7 -5
  179. package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.js.map +1 -1
  180. package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.d.ts.map +1 -1
  181. package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.js +3 -2
  182. package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.js.map +1 -1
  183. package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.d.ts +2 -1
  184. package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.d.ts.map +1 -1
  185. package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.js +87 -1
  186. package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.js.map +1 -1
  187. package/build/src/rules/vitest/dotenv/register.js +1 -1
  188. package/build/src/rules/vitest/dotenv/register.js.map +1 -1
  189. package/build/src/rules/vitest/dotenv/rules.js +2 -2
  190. package/build/src/rules/vitest/dotenv/rules.js.map +1 -1
  191. package/build/src/rules/vitest/frontmatter/register.js +1 -1
  192. package/build/src/rules/vitest/frontmatter/register.js.map +1 -1
  193. package/build/src/rules/vitest/frontmatter/rules.js +2 -2
  194. package/build/src/rules/vitest/frontmatter/rules.js.map +1 -1
  195. package/build/src/rules/vitest/index.d.ts +2 -1
  196. package/build/src/rules/vitest/index.d.ts.map +1 -1
  197. package/build/src/rules/vitest/index.js +1 -0
  198. package/build/src/rules/vitest/index.js.map +1 -1
  199. package/build/src/rules/vitest/internal/active-vitest.d.ts +5 -0
  200. package/build/src/rules/vitest/internal/active-vitest.d.ts.map +1 -0
  201. package/build/src/rules/vitest/internal/active-vitest.js.map +1 -0
  202. package/build/src/rules/vitest/internal/is-enabled.d.ts +3 -0
  203. package/build/src/rules/vitest/internal/is-enabled.d.ts.map +1 -0
  204. package/build/src/rules/vitest/{enable.js → internal/is-enabled.js} +1 -1
  205. package/build/src/rules/vitest/internal/is-enabled.js.map +1 -0
  206. package/build/src/rules/vitest/link/register.js +1 -1
  207. package/build/src/rules/vitest/link/register.js.map +1 -1
  208. package/build/src/rules/vitest/link/rules.js +2 -2
  209. package/build/src/rules/vitest/link/rules.js.map +1 -1
  210. package/build/src/rules/vitest/markdown-table/register.js +1 -1
  211. package/build/src/rules/vitest/markdown-table/register.js.map +1 -1
  212. package/build/src/rules/vitest/markdown-table/rules.js +2 -2
  213. package/build/src/rules/vitest/markdown-table/rules.js.map +1 -1
  214. package/build/src/rules/vitest/package-scripts/register.d.ts +3 -0
  215. package/build/src/rules/vitest/package-scripts/register.d.ts.map +1 -0
  216. package/build/src/rules/vitest/package-scripts/register.js +23 -0
  217. package/build/src/rules/vitest/package-scripts/register.js.map +1 -0
  218. package/build/src/rules/vitest/package-scripts/rules.d.ts +3 -0
  219. package/build/src/rules/vitest/package-scripts/rules.d.ts.map +1 -0
  220. package/build/src/rules/vitest/package-scripts/rules.js +28 -0
  221. package/build/src/rules/vitest/package-scripts/rules.js.map +1 -0
  222. package/build/src/rules/vitest/terminology/register.js +1 -1
  223. package/build/src/rules/vitest/terminology/register.js.map +1 -1
  224. package/build/src/rules/vitest/terminology/rules.js +2 -2
  225. package/build/src/rules/vitest/terminology/rules.js.map +1 -1
  226. package/build/src/rules/vitest/type-declarations/register.js +1 -1
  227. package/build/src/rules/vitest/type-declarations/register.js.map +1 -1
  228. package/build/src/rules/vitest/type-declarations/rules.d.ts.map +1 -1
  229. package/build/src/rules/vitest/type-declarations/rules.js +50 -21
  230. package/build/src/rules/vitest/type-declarations/rules.js.map +1 -1
  231. package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +4 -0
  232. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +7 -15
  233. package/build/src/types/cli/generate/must-haves/ignore-files.d.ts +56 -0
  234. package/build/src/types/cli/index.d.ts +7 -22
  235. package/build/src/types/cli/recipe/index.d.ts +4 -1
  236. package/build/src/types/cli/recipe/miscellaneous/fix-markdown-tables.d.ts +30 -4
  237. package/build/src/types/cli/recipe/miscellaneous/remove-operating-system-files.d.ts +134 -0
  238. package/build/src/types/cli/recipe/nova-config/normalize-order.d.ts +64 -0
  239. package/build/src/types/cli/recipe/package-json/normalize-tooling.d.ts +35 -17
  240. package/build/src/types/cli/scaffold/app/apple.d.ts +59 -0
  241. package/build/src/types/cli/scaffold/app/astro.d.ts +2 -3
  242. package/build/src/types/cli/scaffold/app/discord-bot.d.ts +1 -2
  243. package/build/src/types/cli/scaffold/app/expressjs.d.ts +2 -2
  244. package/build/src/types/cli/scaffold/app/nextjs.d.ts +2 -2
  245. package/build/src/types/cli/scaffold/app/vite.d.ts +2 -2
  246. package/build/src/types/cli/scaffold/docs/docusaurus.d.ts +4 -4
  247. package/build/src/types/cli/scaffold/package/homebridge.d.ts +1 -2
  248. package/build/src/types/cli/scaffold/tool/serverless.d.ts +51 -0
  249. package/build/src/types/cli/utility/changelog.d.ts +15 -3
  250. package/build/src/types/cli/utility/configure.d.ts +939 -78
  251. package/build/src/types/cli/utility/run-recipes.d.ts +1 -8
  252. package/build/src/types/cli/utility/run-workspaces.d.ts +57 -0
  253. package/build/src/types/lib/constants.d.ts +7 -0
  254. package/build/src/types/lib/corepack.d.ts +19 -0
  255. package/build/src/types/lib/docker-packaging.d.ts +69 -0
  256. package/build/src/types/lib/env-managed-set.d.ts +2 -2
  257. package/build/src/types/lib/env-status.d.ts +2 -2
  258. package/build/src/types/lib/ignore-files.d.ts +86 -0
  259. package/build/src/types/lib/item.d.ts +29 -1
  260. package/build/src/types/lib/nova-config-order.d.ts +31 -0
  261. package/build/src/types/lib/nova-config.d.ts +405 -102
  262. package/build/src/types/lib/package-scripts.d.ts +172 -0
  263. package/build/src/types/lib/regex.d.ts +7 -0
  264. package/build/src/types/lib/run-scripts.d.ts +10 -12
  265. package/build/src/types/lib/run-workspaces-cache.d.ts +259 -0
  266. package/build/src/types/lib/run-workspaces.d.ts +682 -0
  267. package/build/src/types/lib/scaffold-presentation.d.ts +6 -4
  268. package/build/src/types/lib/scaffold-versions.d.ts +30 -0
  269. package/build/src/types/lib/scaffold.d.ts +103 -37
  270. package/build/src/types/lib/transpile.d.ts +12 -4
  271. package/build/src/types/lib/type-check.d.ts +20 -3
  272. package/build/src/types/lib/type-declaration-engine.d.ts +54 -12
  273. package/build/src/types/lib/utility.d.ts +14 -0
  274. package/build/src/types/presets/eslint/nova-rules.d.ts +10 -0
  275. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-body.d.ts +2 -0
  276. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts +4 -0
  277. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-presence.d.ts +2 -0
  278. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-returns.d.ts +71 -0
  279. package/build/src/types/rules/vitest/index.d.ts +56 -0
  280. package/build/src/types/rules/vitest/internal/active-vitest.d.ts +31 -0
  281. package/build/src/types/rules/vitest/internal/is-enabled.d.ts +12 -0
  282. package/build/src/types/rules/vitest/package-scripts/register.d.ts +41 -0
  283. package/build/src/types/rules/vitest/package-scripts/rules.d.ts +24 -0
  284. package/build/src/types/rules/vitest/type-declarations/rules.d.ts +8 -0
  285. package/build/src/types/shared.d.ts +622 -155
  286. package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +8 -8
  287. package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +11 -0
  288. package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +13 -2
  289. package/build/src/types/tests/cli/generate/must-haves/ignore-files.test.d.ts +46 -0
  290. package/build/src/types/tests/cli/index.test.d.ts +57 -24
  291. package/build/src/types/tests/cli/recipe/miscellaneous/remove-operating-system-files.test.d.ts +84 -0
  292. package/build/src/types/tests/cli/recipe/nova-config/normalize-order.test.d.ts +31 -0
  293. package/build/src/types/tests/cli/recipe/package-json/normalize-tooling.test.d.ts +36 -0
  294. package/build/src/types/tests/cli/scaffold/app/apple.test.d.ts +99 -0
  295. package/build/src/types/tests/cli/scaffold/docs/docusaurus.test.d.ts +26 -0
  296. package/build/src/types/tests/cli/scaffold/starter/base.test.d.ts +9 -9
  297. package/build/src/types/tests/cli/scaffold/tool/serverless.test.d.ts +98 -0
  298. package/build/src/types/tests/cli/utility/changelog.test.d.ts +31 -27
  299. package/build/src/types/tests/cli/utility/configure.test.d.ts +268 -1
  300. package/build/src/types/tests/cli/utility/run-recipes.test.d.ts +7 -56
  301. package/build/src/types/tests/cli/utility/run-workspaces.test.d.ts +193 -0
  302. package/build/src/types/tests/cli/utility/type-check.test.d.ts +13 -0
  303. package/build/src/types/tests/lib/docker-packaging.test.d.ts +43 -0
  304. package/build/src/types/tests/lib/ignore-files.test.d.ts +69 -0
  305. package/build/src/types/tests/lib/item.test.d.ts +7 -0
  306. package/build/src/types/tests/lib/nova-config-ignore-files.test.d.ts +46 -0
  307. package/build/src/types/tests/lib/nova-config-run-workspaces-cache.test.d.ts +31 -0
  308. package/build/src/types/tests/lib/nova-config.test.d.ts +1 -29
  309. package/build/src/types/tests/lib/package-scripts.test.d.ts +32 -0
  310. package/build/src/types/tests/lib/scaffold.test.d.ts +19 -0
  311. package/build/src/types/tests/lib/utility.test.d.ts +23 -0
  312. package/build/src/types/tests/lib/workflow-templates.test.d.ts +0 -12
  313. package/build/src/types/tests/presets/eslint/nova-rules.test.d.ts +45 -0
  314. package/build/src/types/tests/rules/vitest/internal/active-vitest.test.d.ts +56 -0
  315. package/build/src/types/tests/rules/vitest/internal/is-enabled.test.d.ts +27 -0
  316. package/build/src/types/tests/rules/vitest/package-scripts.test.d.ts +6 -0
  317. package/build/src/types/tests/scaffold-output-contract.test.d.ts +52 -14
  318. package/build/src/types/tests/scaffold-version-catalog.test.d.ts +101 -0
  319. package/build/src/types/tests/scaffold-version-drift.test.d.ts +9 -3
  320. package/build/src/types/tests/since-version.test.d.ts +3 -1
  321. package/build/src/types/tests/tsconfig-presets.test.d.ts +6 -2
  322. package/build/src/types/tests/type-declarations.test.d.ts +198 -105
  323. package/build/templates/generators/must-haves/ignore-files/cloudflare-astro.assetsignore +5 -0
  324. package/build/templates/generators/must-haves/{gitignore → ignore-files}/gitignore +0 -5
  325. package/build/templates/scaffold/app/android/eslint.config.mts +1 -1
  326. package/build/templates/scaffold/app/android/package.json +10 -10
  327. package/build/templates/scaffold/app/android/vitest.config.mts +1 -0
  328. package/build/templates/scaffold/app/{docker-image → apple}/eslint.config.mts +4 -3
  329. package/build/templates/scaffold/app/apple/package.json +21 -12
  330. package/build/templates/scaffold/app/apple/project.yml +5 -6
  331. package/build/templates/scaffold/app/apple/scripts/run-apple.mjs +115 -0
  332. package/build/templates/scaffold/{package/node-cli/tsconfig.config.json → app/apple/tsconfig.scripts.json} +2 -2
  333. package/build/templates/scaffold/app/{docker-image → apple}/tsconfig.tests.json +2 -1
  334. package/build/templates/scaffold/app/{docker-image → apple}/vitest.config.mts +3 -2
  335. package/build/templates/scaffold/app/astro/eslint.config.mts +1 -1
  336. package/build/templates/scaffold/app/astro/package.json +15 -15
  337. package/build/templates/scaffold/app/astro/tsconfig.tests.json +2 -1
  338. package/build/templates/scaffold/app/astro/vitest.config.mts +1 -0
  339. package/build/templates/scaffold/app/discord-bot/eslint.config.mts +1 -1
  340. package/build/templates/scaffold/app/discord-bot/package.json +14 -14
  341. package/build/templates/scaffold/app/express/eslint.config.mts +1 -1
  342. package/build/templates/scaffold/app/express/package.json +15 -15
  343. package/build/templates/scaffold/app/nextjs/eslint.config.mts +1 -1
  344. package/build/templates/scaffold/app/nextjs/package.json +17 -17
  345. package/build/templates/scaffold/app/nextjs/tsconfig.tests.json +2 -1
  346. package/build/templates/scaffold/app/nextjs/vitest.config.mts +1 -0
  347. package/build/templates/scaffold/app/vite/eslint.config.mts +1 -1
  348. package/build/templates/scaffold/app/vite/package.json +13 -13
  349. package/build/templates/scaffold/app/vite/vitest.config.mts +1 -0
  350. package/build/templates/scaffold/docs/docusaurus/docusaurus.config.ts +2 -2
  351. package/build/templates/scaffold/docs/docusaurus/eslint.config.mts +1 -1
  352. package/build/templates/scaffold/docs/docusaurus/package.json +22 -22
  353. package/build/templates/scaffold/package/github-action/eslint.config.mts +1 -1
  354. package/build/templates/scaffold/package/github-action/package.json +15 -16
  355. package/build/templates/scaffold/package/homebridge/bin/repl.mjs +33 -0
  356. package/build/templates/scaffold/package/homebridge/bin/test-api.mjs +33 -0
  357. package/build/templates/scaffold/package/homebridge/eslint.config.mts +1 -1
  358. package/build/templates/scaffold/package/homebridge/package.json +23 -14
  359. package/build/templates/scaffold/package/homebridge/src/cli/presentation.ts +65 -0
  360. package/build/templates/scaffold/package/homebridge/src/cli/repl.ts +51 -0
  361. package/build/templates/scaffold/package/homebridge/src/cli/test-api.ts +134 -0
  362. package/build/templates/scaffold/package/homebridge/src/types/cli/presentation.d.ts +21 -0
  363. package/build/templates/scaffold/package/homebridge/src/types/cli/repl.d.ts +12 -0
  364. package/build/templates/scaffold/package/homebridge/src/types/cli/test-api.d.ts +38 -0
  365. package/build/templates/scaffold/package/homebridge/tsconfig.tests.json +2 -1
  366. package/build/templates/scaffold/package/homebridge/vitest.config.mts +1 -0
  367. package/build/templates/scaffold/package/pfsense/eslint.config.mts +1 -1
  368. package/build/templates/scaffold/package/pfsense/package.json +11 -11
  369. package/build/templates/scaffold/package/pfsense/vitest.config.mts +1 -0
  370. package/build/templates/scaffold/starter/base/eslint.config.mts +1 -1
  371. package/build/templates/scaffold/starter/base/tests/project.test.ts +8 -0
  372. package/build/templates/scaffold/{app/cloudflare-workers → tool/serverless}/vitest.config.mts +3 -2
  373. package/build/templates/scaffold-options/app/android-native/app/build.gradle.kts +3 -3
  374. package/build/templates/scaffold-options/app/android-native/gradle/libs.versions.toml +10 -10
  375. package/build/templates/scaffold-options/app/android-native/gradle/wrapper/gradle-wrapper.properties +2 -2
  376. package/build/templates/scaffold-options/app/android-native/settings.gradle.kts +1 -1
  377. package/build/templates/{generators → scaffold-options}/docker-image/astro-node/Dockerfile +2 -2
  378. package/build/templates/{generators → scaffold-options}/docker-image/container-native/Dockerfile +1 -1
  379. package/build/templates/{generators → scaffold-options}/docker-image/nextjs-standalone/Dockerfile +2 -2
  380. package/build/templates/{generators → scaffold-options}/docker-image/node/Dockerfile +2 -2
  381. package/build/templates/{generators → scaffold-options}/docker-image/static-site/Dockerfile +2 -2
  382. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/eslint.config.mts +66 -0
  383. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/package.json +67 -0
  384. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/index.d.ts +19 -0
  385. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/types/worker/index.test.d.ts +6 -0
  386. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.test.ts +23 -0
  387. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/src/worker/index.ts +28 -0
  388. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/tsconfig.cli.json +26 -0
  389. package/build/templates/{scaffold/app → scaffold-options/tool/serverless}/cloudflare-workers/tsconfig.tests.json +3 -4
  390. package/build/templates/{scaffold/app → scaffold-options/tool/serverless}/cloudflare-workers/tsconfig.worker.json +10 -3
  391. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/wrangler.build.toml +3 -0
  392. package/build/templates/scaffold-options/tool/serverless/cloudflare-workers/wrangler.toml +3 -0
  393. package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.test.ts +23 -0
  394. package/build/templates/scaffold-options/tool/serverless/vercel-functions/api/index.ts +20 -0
  395. package/build/templates/{scaffold/package/node-cli → scaffold-options/tool/serverless/vercel-functions}/eslint.config.mts +5 -3
  396. package/build/templates/scaffold-options/tool/serverless/vercel-functions/package.json +66 -0
  397. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.d.ts +8 -0
  398. package/build/templates/scaffold-options/tool/serverless/vercel-functions/src/types/api/index.test.d.ts +6 -0
  399. package/build/templates/scaffold-options/tool/serverless/vercel-functions/tsconfig.cli.json +26 -0
  400. package/build/templates/{scaffold/package/node-cli/tsconfig.source.json → scaffold-options/tool/serverless/vercel-functions/tsconfig.functions.json} +5 -3
  401. package/build/templates/{scaffold/package/node-cli → scaffold-options/tool/serverless/vercel-functions}/tsconfig.tests.json +1 -0
  402. package/build/templates/scaffold-options/tool/serverless/vercel-functions/vercel.json +3 -0
  403. package/package.json +5 -6
  404. package/build/src/cli/generate/docker-image/index.d.ts +0 -9
  405. package/build/src/cli/generate/docker-image/index.d.ts.map +0 -1
  406. package/build/src/cli/generate/docker-image/index.js.map +0 -1
  407. package/build/src/cli/generate/must-haves/gitignore.d.ts +0 -5
  408. package/build/src/cli/generate/must-haves/gitignore.d.ts.map +0 -1
  409. package/build/src/cli/generate/must-haves/gitignore.js +0 -61
  410. package/build/src/cli/generate/must-haves/gitignore.js.map +0 -1
  411. package/build/src/cli/scaffold/app/cloudflare-workers.d.ts +0 -5
  412. package/build/src/cli/scaffold/app/cloudflare-workers.d.ts.map +0 -1
  413. package/build/src/cli/scaffold/app/cloudflare-workers.js +0 -14
  414. package/build/src/cli/scaffold/app/cloudflare-workers.js.map +0 -1
  415. package/build/src/cli/scaffold/app/docker-image.d.ts +0 -6
  416. package/build/src/cli/scaffold/app/docker-image.d.ts.map +0 -1
  417. package/build/src/cli/scaffold/app/docker-image.js +0 -93
  418. package/build/src/cli/scaffold/app/docker-image.js.map +0 -1
  419. package/build/src/cli/scaffold/package/node-cli.d.ts +0 -5
  420. package/build/src/cli/scaffold/package/node-cli.d.ts.map +0 -1
  421. package/build/src/cli/scaffold/package/node-cli.js +0 -14
  422. package/build/src/cli/scaffold/package/node-cli.js.map +0 -1
  423. package/build/src/rules/eslint/nova-rules.d.ts +0 -4
  424. package/build/src/rules/eslint/nova-rules.d.ts.map +0 -1
  425. package/build/src/rules/eslint/nova-rules.js.map +0 -1
  426. package/build/src/rules/vitest/active-vitest.d.ts +0 -5
  427. package/build/src/rules/vitest/active-vitest.d.ts.map +0 -1
  428. package/build/src/rules/vitest/active-vitest.js.map +0 -1
  429. package/build/src/rules/vitest/enable.d.ts +0 -3
  430. package/build/src/rules/vitest/enable.d.ts.map +0 -1
  431. package/build/src/rules/vitest/enable.js.map +0 -1
  432. package/build/src/types/cli/generate/docker-image/index.d.ts +0 -105
  433. package/build/src/types/cli/generate/must-haves/gitignore.d.ts +0 -48
  434. package/build/src/types/cli/scaffold/app/cloudflare-workers.d.ts +0 -27
  435. package/build/src/types/cli/scaffold/app/docker-image.d.ts +0 -47
  436. package/build/src/types/cli/scaffold/package/node-cli.d.ts +0 -22
  437. package/build/src/types/rules/eslint/nova-rules.d.ts +0 -10
  438. package/build/src/types/rules/vitest/active-vitest.d.ts +0 -31
  439. package/build/src/types/rules/vitest/enable.d.ts +0 -12
  440. package/build/src/types/tests/cli/generate/docker-image.test.d.ts +0 -43
  441. package/build/src/types/tests/cli/generate/must-haves/gitignore.test.d.ts +0 -27
  442. package/build/src/types/tests/cli/scaffold/app/cloudflare-workers.test.d.ts +0 -85
  443. package/build/src/types/tests/rules/eslint/nova-rules.test.d.ts +0 -45
  444. package/build/src/types/tests/rules/vitest/active-vitest.test.d.ts +0 -56
  445. package/build/src/types/tests/rules/vitest/enable.test.d.ts +0 -27
  446. package/build/templates/generators/github/workflows/check-sponsor-gated-issues/base.yml +0 -54
  447. package/build/templates/generators/github/workflows/check-sponsor-gated-issues/triggers/issue-comment.yml +0 -5
  448. package/build/templates/generators/github/workflows/check-sponsor-gated-issues/triggers/issues.yml +0 -5
  449. package/build/templates/generators/github/workflows/lock-inactive-issues/base.yml +0 -45
  450. package/build/templates/generators/github/workflows/lock-inactive-issues/triggers/schedule-daily.yml +0 -5
  451. package/build/templates/generators/github/workflows/lock-inactive-issues/triggers/schedule-monthly.yml +0 -5
  452. package/build/templates/generators/github/workflows/lock-inactive-issues/triggers/schedule-weekly.yml +0 -5
  453. package/build/templates/generators/github/workflows/publish/base.yml +0 -61
  454. package/build/templates/generators/github/workflows/publish/targets/cloudflare-pages-docusaurus.yml +0 -29
  455. package/build/templates/generators/github/workflows/publish/targets/cloudflare-workers.yml +0 -36
  456. package/build/templates/generators/github/workflows/publish/targets/docker-hub.yml +0 -48
  457. package/build/templates/generators/github/workflows/publish/targets/ghcr.yml +0 -48
  458. package/build/templates/generators/github/workflows/publish/targets/github-action.yml +0 -122
  459. package/build/templates/generators/github/workflows/publish/targets/github-packages.yml +0 -85
  460. package/build/templates/generators/github/workflows/publish/targets/github-pages-docusaurus.yml +0 -44
  461. package/build/templates/generators/github/workflows/publish/targets/npm.yml +0 -61
  462. package/build/templates/generators/github/workflows/publish/targets/vercel-nextjs.yml +0 -45
  463. package/build/templates/generators/github/workflows/publish/triggers/release.yml +0 -5
  464. package/build/templates/generators/github/workflows/publish/triggers/workflow-run-any.yml +0 -7
  465. package/build/templates/generators/github/workflows/publish/triggers/workflow-run-failure.yml +0 -8
  466. package/build/templates/generators/github/workflows/publish/triggers/workflow-run-success.yml +0 -8
  467. package/build/templates/scaffold/app/android/tests/project.test.ts +0 -24
  468. package/build/templates/scaffold/app/astro/tests/project.test.ts +0 -24
  469. package/build/templates/scaffold/app/cloudflare-workers/eslint.config.mts +0 -42
  470. package/build/templates/scaffold/app/cloudflare-workers/package.json +0 -37
  471. package/build/templates/scaffold/app/cloudflare-workers/src/index.ts +0 -30
  472. package/build/templates/scaffold/app/cloudflare-workers/src/types/index.d.ts +0 -19
  473. package/build/templates/scaffold/app/cloudflare-workers/tests/project.test.ts +0 -24
  474. package/build/templates/scaffold/app/cloudflare-workers/wrangler.toml +0 -3
  475. package/build/templates/scaffold/app/discord-bot/tests/project.test.ts +0 -24
  476. package/build/templates/scaffold/app/docker-image/package.json +0 -33
  477. package/build/templates/scaffold/app/docker-image/tests/project.test.ts +0 -24
  478. package/build/templates/scaffold/app/express/tests/project.test.ts +0 -24
  479. package/build/templates/scaffold/app/nextjs/tests/project.test.ts +0 -24
  480. package/build/templates/scaffold/app/vite/tests/project.test.ts +0 -24
  481. package/build/templates/scaffold/package/homebridge/tests/project.test.ts +0 -24
  482. package/build/templates/scaffold/package/node-cli/package.json +0 -47
  483. package/build/templates/scaffold/package/node-cli/vitest.config.mts +0 -18
  484. package/build/templates/scaffold/package/pfsense/tests/project.test.ts +0 -56
  485. package/build/templates/scaffold/package/pfsense/tests/types/project.test.d.ts +0 -6
  486. /package/build/src/rules/vitest/{active-vitest.js → internal/active-vitest.js} +0 -0
  487. /package/build/templates/{generators → scaffold-options}/docker-image/astro-node/compose.yml +0 -0
  488. /package/build/templates/{generators → scaffold-options}/docker-image/background-service/compose.yml +0 -0
  489. /package/build/templates/{generators → scaffold-options}/docker-image/container-native/compose.yml +0 -0
  490. /package/build/templates/{generators → scaffold-options}/docker-image/http-service/compose.yml +0 -0
  491. /package/build/templates/{generators → scaffold-options}/docker-image/nextjs-standalone/compose.yml +0 -0
  492. /package/build/templates/{generators → scaffold-options}/docker-image/static-site/compose.yml +0 -0
  493. /package/build/templates/{scaffold/package/node-cli → scaffold-options/package/node-cli-core}/bin/cli.mjs +0 -0
  494. /package/build/templates/{scaffold/package/node-cli → scaffold-options/package/node-cli-core}/src/index.ts +0 -0
  495. /package/build/templates/{scaffold/package/node-cli → scaffold-options/package/node-cli-core}/src/program.ts +0 -0
  496. /package/build/templates/{scaffold/package/node-cli → scaffold-options/package/node-cli-core}/src/status.test.ts +0 -0
  497. /package/build/templates/{scaffold/package/node-cli → scaffold-options/package/node-cli-core}/src/status.ts +0 -0
  498. /package/build/templates/{scaffold/package/node-cli → scaffold-options/package/node-cli-core}/src/types/program.d.ts +0 -0
  499. /package/build/templates/{scaffold/package/node-cli → scaffold-options/package/node-cli-core}/src/types/status.d.ts +0 -0
  500. /package/build/templates/{scaffold/app → scaffold-options/tool/serverless}/cloudflare-workers/tsconfig.config.json +0 -0
  501. /package/build/templates/{scaffold/app/docker-image → scaffold-options/tool/serverless/vercel-functions}/tsconfig.config.json +0 -0
@@ -7,11 +7,12 @@ import { libEnvManagedSet } from '../../lib/env-managed-set.js';
7
7
  import { libEnvNamespace } from '../../lib/env-namespace.js';
8
8
  import { libEnvReconcile } from '../../lib/env-reconcile.js';
9
9
  import { libEnvStatus } from '../../lib/env-status.js';
10
- import { libItemAllowedAgents, libItemAllowedPoliciesByRole, libItemAllowedRecipes, libItemSyncRoles, libItemValidEntityRoles, } from '../../lib/item.js';
10
+ import { getSupportedIgnoreFileBundles, isSupportedIgnoreFileConfigPath, } from '../../lib/ignore-files.js';
11
+ import { libItemAllowedAgents, libItemAllowedPoliciesByRole, libItemAllowedRecipes, libItemOperatingSystemFilePatterns, libItemOperatingSystemFilesByPlatform, libItemRecipesByCategory, libItemSyncRoles, libItemValidEntityRoles, } from '../../lib/item.js';
11
12
  import { Runner as LibNovaConfig } from '../../lib/nova-config.js';
12
- import { LIB_REGEX_LINEBREAK_CRLF_OR_LF, LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REGEX_PATTERN_ENV_VAR_KEY, LIB_REGEX_PATTERN_SLUG_SCOPED, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PATTERN_YML_EXTENSION, } from '../../lib/regex.js';
13
+ import { LIB_REGEX_LINEBREAK_CRLF_OR_LF, LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REGEX_PATTERN_ENV_VAR_KEY, LIB_REGEX_PATTERN_GITHUB_LABEL_COLOR, LIB_REGEX_PATTERN_SLUG_SCOPED, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PATTERN_YML_EXTENSION, } from '../../lib/regex.js';
13
14
  import { Runner as LibReleaseHistory } from '../../lib/release-history.js';
14
- import { discoverPathsWithFile, pathExists, resolveTemplatePath } from '../../lib/utility.js';
15
+ import { discoverPathsWithFile, isPlainObject, pathExists, resolveTemplatePath, } from '../../lib/utility.js';
15
16
  import { libWorkflowTemplatesMetadata } from '../../lib/workflow-templates.js';
16
17
  import { Logger } from '../../toolkit/index.js';
17
18
  export class Runner {
@@ -73,12 +74,180 @@ export class Runner {
73
74
  await novaConfig.save(isReplaceFile);
74
75
  return;
75
76
  }
77
+ static getOptionalBooleanInitial(value) {
78
+ if (value === undefined) {
79
+ return 0;
80
+ }
81
+ return (value === true) ? 1 : 2;
82
+ }
83
+ static isBooleanRecordInput(value) {
84
+ if (typeof value !== 'string') {
85
+ return 'Enter a JSON object with boolean values.';
86
+ }
87
+ const trimmed = value.trim();
88
+ if (trimmed === '') {
89
+ return true;
90
+ }
91
+ try {
92
+ const parsed = JSON.parse(trimmed);
93
+ if (isPlainObject(parsed) === false
94
+ || Object.values(parsed).some((entry) => typeof entry !== 'boolean') === true) {
95
+ return 'Enter a JSON object whose values are true or false.';
96
+ }
97
+ }
98
+ catch {
99
+ return 'Enter valid JSON, for example {"displayName":true}.';
100
+ }
101
+ return true;
102
+ }
103
+ static isIgnoreFilePathInput(value) {
104
+ if (typeof value !== 'string') {
105
+ return 'Enter a project-relative ignore-file path.';
106
+ }
107
+ const trimmed = value.trim();
108
+ if (isSupportedIgnoreFileConfigPath(trimmed) === false) {
109
+ return 'Use a project-relative path ending in .gitignore, .dockerignore, or .assetsignore.';
110
+ }
111
+ return true;
112
+ }
76
113
  static isNonEmptyLiteralInput(value) {
77
114
  if (typeof value === 'string' && value.trim() !== '') {
78
115
  return true;
79
116
  }
80
117
  return 'This field is required.';
81
118
  }
119
+ static isOptionalNonnegativeIntegerInput(value) {
120
+ if (typeof value !== 'string') {
121
+ return 'Enter a whole number or leave the field blank.';
122
+ }
123
+ const trimmed = value.trim();
124
+ if (trimmed === '') {
125
+ return true;
126
+ }
127
+ const parsed = Number.parseInt(trimmed, 10);
128
+ if (Number.isInteger(parsed) === false
129
+ || parsed < 0
130
+ || `${parsed}` !== trimmed) {
131
+ return 'Enter a whole number greater than or equal to zero.';
132
+ }
133
+ return true;
134
+ }
135
+ static isOptionalWorkflowTimeoutInput(value) {
136
+ if (typeof value !== 'string') {
137
+ return 'Enter a whole number from 1 through 360, or leave the field blank.';
138
+ }
139
+ const trimmed = value.trim();
140
+ if (trimmed === '') {
141
+ return true;
142
+ }
143
+ const parsed = Number.parseInt(trimmed, 10);
144
+ if (Number.isInteger(parsed) === false
145
+ || parsed < 1
146
+ || parsed > 360
147
+ || `${parsed}` !== trimmed) {
148
+ return 'Enter a whole number from 1 through 360, or leave the field blank.';
149
+ }
150
+ return true;
151
+ }
152
+ static isPositiveIntegerRecordInput(value) {
153
+ if (typeof value !== 'string') {
154
+ return 'Enter a JSON object with positive integer values.';
155
+ }
156
+ const trimmed = value.trim();
157
+ if (trimmed === '') {
158
+ return true;
159
+ }
160
+ try {
161
+ const parsed = JSON.parse(trimmed);
162
+ if (isPlainObject(parsed) === false) {
163
+ return 'Enter a JSON object with positive integer values.';
164
+ }
165
+ const entries = Object.entries(parsed);
166
+ if (entries.some((entry) => {
167
+ const typedEntry = entry;
168
+ const entryKey = typedEntry[0].trim();
169
+ const entryValue = typedEntry[1];
170
+ return (entryKey.length === 0
171
+ || typeof entryValue !== 'number'
172
+ || Number.isInteger(entryValue) === false
173
+ || entryValue < 1);
174
+ }) === true) {
175
+ return 'Enter non-empty script names with whole-number limits greater than zero.';
176
+ }
177
+ }
178
+ catch {
179
+ return 'Enter valid JSON, for example {"build":2,"check":2}.';
180
+ }
181
+ return true;
182
+ }
183
+ static isStringArrayInput(value) {
184
+ if (typeof value !== 'string') {
185
+ return 'Enter a JSON array of strings.';
186
+ }
187
+ const trimmed = value.trim();
188
+ if (trimmed === '') {
189
+ return true;
190
+ }
191
+ try {
192
+ const parsed = JSON.parse(trimmed);
193
+ if (Array.isArray(parsed) === false
194
+ || parsed.some((entry) => typeof entry !== 'string') === true) {
195
+ return 'Enter a JSON array whose entries are strings.';
196
+ }
197
+ }
198
+ catch {
199
+ return 'Enter valid JSON, for example ["main","release/*"].';
200
+ }
201
+ return true;
202
+ }
203
+ static isStringRecordInput(value) {
204
+ if (typeof value !== 'string') {
205
+ return 'Enter a JSON object with string values.';
206
+ }
207
+ const trimmed = value.trim();
208
+ if (trimmed === '') {
209
+ return true;
210
+ }
211
+ try {
212
+ const parsed = JSON.parse(trimmed);
213
+ if (isPlainObject(parsed) === false
214
+ || Object.values(parsed).some((entry) => typeof entry !== 'string') === true) {
215
+ return 'Enter a JSON object whose values are strings.';
216
+ }
217
+ }
218
+ catch {
219
+ return 'Enter valid JSON, for example {"NODE_VERSION":"24"}.';
220
+ }
221
+ return true;
222
+ }
223
+ static parseBooleanRecordInput(value) {
224
+ const trimmed = value.trim();
225
+ if (trimmed === '') {
226
+ return {};
227
+ }
228
+ return JSON.parse(trimmed);
229
+ }
230
+ static parsePositiveIntegerRecordInput(value) {
231
+ const trimmed = value.trim();
232
+ if (trimmed === '') {
233
+ return {};
234
+ }
235
+ return JSON.parse(trimmed);
236
+ }
237
+ static parseStringArrayInput(value) {
238
+ const trimmed = value.trim();
239
+ if (trimmed === '') {
240
+ return [];
241
+ }
242
+ return JSON.parse(trimmed);
243
+ }
244
+ static parseStringRecordInput(value) {
245
+ const trimmed = value.trim();
246
+ if (trimmed === '') {
247
+ return {};
248
+ }
249
+ return JSON.parse(trimmed);
250
+ }
82
251
  static async promptFlow(config) {
83
252
  const category = {
84
253
  project: {
@@ -99,7 +268,7 @@ export class Runner {
99
268
  github: {
100
269
  label: 'GitHub',
101
270
  description: 'Configure GitHub repository settings, recipes, and policies.',
102
- handler: Runner['promptGithub'],
271
+ handler: Runner['promptGithubMenu'],
103
272
  },
104
273
  workflows: {
105
274
  label: 'Workflows',
@@ -121,16 +290,21 @@ export class Runner {
121
290
  description: 'Review workspace packages, assigning roles and policies.',
122
291
  handler: Runner['promptWorkspaces'],
123
292
  },
124
- gitignore: {
125
- label: 'Ignores',
126
- description: 'Manage project-specific .gitignore excludes.',
127
- handler: Runner['promptGitignore'],
293
+ ignoreFiles: {
294
+ label: 'Ignore Files',
295
+ description: 'Manage project-specific physical ignore-file patterns.',
296
+ handler: Runner['promptIgnoreFiles'],
128
297
  },
129
298
  agents: {
130
299
  label: 'AI Tools',
131
300
  description: 'Select the AI tools (Claude Code, Codex) to generate conventions for.',
132
301
  handler: Runner['promptAgents'],
133
302
  },
303
+ recipes: {
304
+ label: 'Recipes',
305
+ description: 'Configure every recipe category, toggle, and recipe-specific setting.',
306
+ handler: Runner['promptRecipes'],
307
+ },
134
308
  environment: {
135
309
  label: 'Environment',
136
310
  description: 'Manage environment variables and secrets, prefixes, and GitHub provisioning.',
@@ -351,6 +525,16 @@ export class Runner {
351
525
  value: 'swift',
352
526
  selected: existingProjectPlatforms !== undefined && existingProjectPlatforms.includes('swift') === true,
353
527
  },
528
+ {
529
+ title: 'iOS',
530
+ value: 'ios',
531
+ selected: existingProjectPlatforms !== undefined && existingProjectPlatforms.includes('ios') === true,
532
+ },
533
+ {
534
+ title: 'visionOS',
535
+ value: 'visionos',
536
+ selected: existingProjectPlatforms !== undefined && existingProjectPlatforms.includes('visionos') === true,
537
+ },
354
538
  {
355
539
  title: 'Android',
356
540
  value: 'android',
@@ -396,6 +580,11 @@ export class Runner {
396
580
  value: 'windows',
397
581
  selected: existingProjectPlatforms !== undefined && existingProjectPlatforms.includes('windows') === true,
398
582
  },
583
+ {
584
+ title: 'Discord',
585
+ value: 'discord',
586
+ selected: existingProjectPlatforms !== undefined && existingProjectPlatforms.includes('discord') === true,
587
+ },
399
588
  {
400
589
  title: 'Homebridge',
401
590
  value: 'homebridge',
@@ -1017,74 +1206,47 @@ export class Runner {
1017
1206
  const recipesOutputResult = recipesOutput['result'];
1018
1207
  const githubRecipesInput = {
1019
1208
  'sync-actions': {
1209
+ ...((existingRecipes !== undefined && existingRecipes['sync-actions'] !== undefined) ? existingRecipes['sync-actions'] : {}),
1020
1210
  enabled: recipesOutputResult.githubRecipeSyncActions,
1021
1211
  },
1022
1212
  'sync-features': {
1213
+ ...((existingRecipes !== undefined && existingRecipes['sync-features'] !== undefined) ? existingRecipes['sync-features'] : {}),
1023
1214
  enabled: recipesOutputResult.githubRecipeSyncFeatures,
1024
1215
  },
1025
1216
  'sync-identity': {
1217
+ ...((existingRecipes !== undefined && existingRecipes['sync-identity'] !== undefined) ? existingRecipes['sync-identity'] : {}),
1026
1218
  enabled: recipesOutputResult.githubRecipeSyncIdentity,
1027
1219
  },
1028
1220
  'sync-labels': {
1221
+ ...((existingRecipes !== undefined && existingRecipes['sync-labels'] !== undefined) ? existingRecipes['sync-labels'] : {}),
1029
1222
  enabled: recipesOutputResult.githubRecipeSyncLabels,
1030
1223
  },
1031
1224
  'sync-policies': {
1225
+ ...((existingRecipes !== undefined && existingRecipes['sync-policies'] !== undefined) ? existingRecipes['sync-policies'] : {}),
1032
1226
  enabled: recipesOutputResult.githubRecipeSyncPolicies,
1033
1227
  },
1034
1228
  'sync-rulesets': {
1229
+ ...((existingRecipes !== undefined && existingRecipes['sync-rulesets'] !== undefined) ? existingRecipes['sync-rulesets'] : {}),
1035
1230
  enabled: recipesOutputResult.githubRecipeSyncRulesets,
1036
1231
  },
1037
1232
  'sync-security': {
1233
+ ...((existingRecipes !== undefined && existingRecipes['sync-security'] !== undefined) ? existingRecipes['sync-security'] : {}),
1038
1234
  enabled: recipesOutputResult.githubRecipeSyncSecurity,
1039
1235
  },
1040
1236
  };
1041
1237
  const existingTopics = github['topics'];
1042
- const topicsHasExisting = (existingTopics !== undefined) && existingTopics.length > 0;
1043
- const topicsTitle = (existingTopics !== undefined && topicsHasExisting === true) ? `Keep existing: ${existingTopics.join(', ')}` : 'Enter topics (comma-separated)';
1044
- const topicsValue = (existingTopics !== undefined) ? existingTopics : [];
1045
- const topicsInitial = (existingTopics !== undefined) ? 1 : 0;
1046
- const topicsOutput = await Runner.promptWithCancel({
1047
- type: 'select',
1238
+ const topicsTextOutput = await Runner.promptWithCancel({
1239
+ type: 'text',
1048
1240
  name: 'githubTopics',
1049
- message: 'GitHub topics (sync this field?)',
1050
- choices: [
1051
- {
1052
- title: 'Skip (don\'t sync this field)',
1053
- value: 'skip',
1054
- },
1055
- {
1056
- title: topicsTitle,
1057
- value: topicsValue,
1058
- },
1059
- ],
1060
- initial: topicsInitial,
1241
+ message: 'GitHub topics (comma-separated; blank unsets)',
1242
+ initial: (existingTopics !== undefined) ? existingTopics.join(', ') : '',
1061
1243
  });
1062
- if (topicsOutput['cancelled'] === true) {
1244
+ if (topicsTextOutput['cancelled'] === true) {
1063
1245
  return 'back';
1064
1246
  }
1065
- const topicsOutputResult = topicsOutput['result'];
1066
- let githubTopicsInput = undefined;
1067
- if (topicsOutputResult.githubTopics !== 'skip') {
1068
- if (existingTopics !== undefined && existingTopics.length > 0) {
1069
- githubTopicsInput = existingTopics;
1070
- }
1071
- else {
1072
- const topicsTextOutput = await Runner.promptWithCancel({
1073
- type: 'text',
1074
- name: 'githubOwner',
1075
- message: 'Topics (comma-separated)',
1076
- initial: '',
1077
- });
1078
- if (topicsTextOutput['cancelled'] === true) {
1079
- return 'back';
1080
- }
1081
- const rawTopics = topicsTextOutput['result'].githubOwner;
1082
- const parsedTopics = rawTopics.split(',').map((t) => t.trim()).filter((t) => t !== '');
1083
- if (parsedTopics.length > 0) {
1084
- githubTopicsInput = parsedTopics;
1085
- }
1086
- }
1087
- }
1247
+ const rawTopics = topicsTextOutput['result'].githubTopics;
1248
+ const parsedTopics = rawTopics.split(',').map((topic) => topic.trim()).filter((topic) => topic !== '');
1249
+ const githubTopicsInput = (parsedTopics.length > 0) ? parsedTopics : undefined;
1088
1250
  const existingFeatures = github['features'];
1089
1251
  let featuresIssuesInitial = 0;
1090
1252
  if (existingFeatures !== undefined && existingFeatures['issues'] !== undefined) {
@@ -1456,8 +1618,13 @@ export class Runner {
1456
1618
  suggestedBugReportFields.push('nodejs');
1457
1619
  }
1458
1620
  const hasSwiftPlatform = configuredPlatforms !== undefined && configuredPlatforms.includes('swift') === true;
1621
+ const hasIosPlatform = configuredPlatforms !== undefined && configuredPlatforms.includes('ios') === true;
1459
1622
  const hasMacosPlatform = configuredPlatforms !== undefined && configuredPlatforms.includes('macos') === true;
1460
- if (hasSwiftPlatform === true || hasMacosPlatform === true) {
1623
+ const hasVisionosPlatform = configuredPlatforms !== undefined && configuredPlatforms.includes('visionos') === true;
1624
+ if (hasSwiftPlatform === true
1625
+ || hasIosPlatform === true
1626
+ || hasMacosPlatform === true
1627
+ || hasVisionosPlatform === true) {
1461
1628
  suggestedBugReportFields.push('apple');
1462
1629
  }
1463
1630
  const hasAndroidPlatform = configuredPlatforms !== undefined && configuredPlatforms.includes('android') === true;
@@ -1587,68 +1754,1072 @@ export class Runner {
1587
1754
  }).info('GitHub settings updated.');
1588
1755
  return 'back';
1589
1756
  }
1590
- static async promptReadMe(config) {
1591
- const existingReadMe = config['readme'];
1592
- const existingBadges = (existingReadMe !== undefined) ? (existingReadMe['badges'] ?? []) : [];
1593
- const hasExplicitBadges = (existingReadMe !== undefined) ? existingReadMe['badges'] !== undefined : false;
1594
- const suggestedBadges = [];
1595
- const project = config['project'];
1596
- const platforms = (project !== undefined) ? project['platforms'] : undefined;
1597
- const urls = config['urls'];
1598
- const github = config['github'];
1599
- const fundSources = (urls !== undefined) ? (urls['fundSources'] ?? []) : [];
1600
- if (platforms !== undefined && platforms.includes('homebridge') === true) {
1601
- suggestedBadges.push('homebridge');
1757
+ static async promptGithubActions(config) {
1758
+ const github = config['github'] ?? {};
1759
+ const existing = github['actions'] ?? {};
1760
+ const output = await Runner.promptWithCancel([
1761
+ {
1762
+ type: 'select',
1763
+ name: 'enabled',
1764
+ message: 'Enable GitHub Actions?',
1765
+ choices: [
1766
+ {
1767
+ title: 'Unset',
1768
+ value: 'unset',
1769
+ },
1770
+ {
1771
+ title: 'Enable',
1772
+ value: true,
1773
+ },
1774
+ {
1775
+ title: 'Disable',
1776
+ value: false,
1777
+ },
1778
+ ],
1779
+ initial: Runner.getOptionalBooleanInitial(existing['enabled']),
1780
+ },
1781
+ {
1782
+ type: 'select',
1783
+ name: 'allowedActions',
1784
+ message: 'Which actions may workflows use?',
1785
+ choices: [
1786
+ {
1787
+ title: 'Unset',
1788
+ value: 'unset',
1789
+ },
1790
+ {
1791
+ title: 'All actions',
1792
+ value: 'all',
1793
+ },
1794
+ {
1795
+ title: 'Local actions only',
1796
+ value: 'local-only',
1797
+ },
1798
+ {
1799
+ title: 'Selected actions',
1800
+ value: 'selected',
1801
+ },
1802
+ ],
1803
+ initial: (existing['allowedActions'] === undefined) ? 0 : ([
1804
+ 'all',
1805
+ 'local-only',
1806
+ 'selected',
1807
+ ].indexOf(existing['allowedActions']) + 1),
1808
+ },
1809
+ {
1810
+ type: 'select',
1811
+ name: 'shaPinningRequired',
1812
+ message: 'Require actions to use full commit SHAs?',
1813
+ choices: [
1814
+ {
1815
+ title: 'Unset',
1816
+ value: 'unset',
1817
+ },
1818
+ {
1819
+ title: 'Require',
1820
+ value: true,
1821
+ },
1822
+ {
1823
+ title: 'Do not require',
1824
+ value: false,
1825
+ },
1826
+ ],
1827
+ initial: Runner.getOptionalBooleanInitial(existing['shaPinningRequired']),
1828
+ },
1829
+ {
1830
+ type: 'select',
1831
+ name: 'selectedActionsGithubOwned',
1832
+ message: 'Allow GitHub-owned actions?',
1833
+ choices: [
1834
+ {
1835
+ title: 'Unset',
1836
+ value: 'unset',
1837
+ },
1838
+ {
1839
+ title: 'Allow',
1840
+ value: true,
1841
+ },
1842
+ {
1843
+ title: 'Do not allow',
1844
+ value: false,
1845
+ },
1846
+ ],
1847
+ initial: Runner.getOptionalBooleanInitial((existing['selectedActions'] !== undefined) ? existing['selectedActions']['githubOwned'] : undefined),
1848
+ },
1849
+ {
1850
+ type: 'select',
1851
+ name: 'selectedActionsVerified',
1852
+ message: 'Allow verified Marketplace actions?',
1853
+ choices: [
1854
+ {
1855
+ title: 'Unset',
1856
+ value: 'unset',
1857
+ },
1858
+ {
1859
+ title: 'Allow',
1860
+ value: true,
1861
+ },
1862
+ {
1863
+ title: 'Do not allow',
1864
+ value: false,
1865
+ },
1866
+ ],
1867
+ initial: Runner.getOptionalBooleanInitial((existing['selectedActions'] !== undefined) ? existing['selectedActions']['verified'] : undefined),
1868
+ },
1869
+ {
1870
+ type: 'text',
1871
+ name: 'selectedActionsPatterns',
1872
+ message: 'Additional allowed action patterns (comma-separated; blank unsets)',
1873
+ initial: (existing['selectedActions'] !== undefined && existing['selectedActions']['patterns'] !== undefined) ? existing['selectedActions']['patterns'].join(', ') : '',
1874
+ },
1875
+ {
1876
+ type: 'select',
1877
+ name: 'defaultWorkflowPermissions',
1878
+ message: 'Default workflow token permissions',
1879
+ choices: [
1880
+ {
1881
+ title: 'Unset',
1882
+ value: 'unset',
1883
+ },
1884
+ {
1885
+ title: 'Read',
1886
+ value: 'read',
1887
+ },
1888
+ {
1889
+ title: 'Write',
1890
+ value: 'write',
1891
+ },
1892
+ ],
1893
+ initial: (existing['defaultWorkflowPermissions'] === undefined) ? 0 : ([
1894
+ 'read',
1895
+ 'write',
1896
+ ].indexOf(existing['defaultWorkflowPermissions']) + 1),
1897
+ },
1898
+ {
1899
+ type: 'select',
1900
+ name: 'canApprovePullRequestReviews',
1901
+ message: 'Allow workflows to approve pull requests?',
1902
+ choices: [
1903
+ {
1904
+ title: 'Unset',
1905
+ value: 'unset',
1906
+ },
1907
+ {
1908
+ title: 'Allow',
1909
+ value: true,
1910
+ },
1911
+ {
1912
+ title: 'Do not allow',
1913
+ value: false,
1914
+ },
1915
+ ],
1916
+ initial: Runner.getOptionalBooleanInitial(existing['canApprovePullRequestReviews']),
1917
+ },
1918
+ {
1919
+ type: 'text',
1920
+ name: 'artifactRetentionDays',
1921
+ message: 'Artifact retention days (blank unsets)',
1922
+ initial: (existing['artifactRetentionDays'] !== undefined) ? `${existing['artifactRetentionDays']}` : '',
1923
+ validate: Runner['isOptionalNonnegativeIntegerInput'],
1924
+ },
1925
+ ]);
1926
+ if (output['cancelled'] === true) {
1927
+ return 'back';
1602
1928
  }
1603
- if (urls !== undefined && urls['npm'] !== undefined) {
1604
- suggestedBadges.push('npm-version', 'npm-downloads');
1929
+ const outputResult = output['result'];
1930
+ const selectedActions = {};
1931
+ if (typeof outputResult.selectedActionsGithubOwned === 'boolean') {
1932
+ selectedActions.githubOwned = outputResult.selectedActionsGithubOwned;
1605
1933
  }
1606
- if (urls !== undefined && urls['docker'] !== undefined) {
1607
- suggestedBadges.push('docker-pulls', 'docker-image-size');
1934
+ if (typeof outputResult.selectedActionsVerified === 'boolean') {
1935
+ selectedActions.verified = outputResult.selectedActionsVerified;
1608
1936
  }
1609
- if (github !== undefined) {
1610
- if (github['owner'] !== undefined && github['repo'] !== undefined) {
1611
- suggestedBadges.push('github-release', 'github-top-language', 'github-license');
1612
- }
1937
+ const patterns = (typeof outputResult.selectedActionsPatterns === 'string') ? outputResult.selectedActionsPatterns.split(',').map((pattern) => pattern.trim()).filter((pattern) => pattern !== '') : [];
1938
+ if (patterns.length > 0) {
1939
+ selectedActions.patterns = patterns;
1613
1940
  }
1614
- if (fundSources.length > 0) {
1615
- suggestedBadges.push('funding');
1941
+ const artifactRetentionDaysRaw = (typeof outputResult.artifactRetentionDays === 'string') ? outputResult.artifactRetentionDays.trim() : '';
1942
+ const actions = {};
1943
+ if (typeof outputResult.enabled === 'boolean') {
1944
+ actions.enabled = outputResult.enabled;
1616
1945
  }
1617
- const selectedBadges = (hasExplicitBadges === true) ? existingBadges : suggestedBadges;
1618
- const badgesOutput = await Runner.promptWithCancel({
1619
- type: 'multiselect',
1620
- name: 'readMeBadges',
1621
- message: 'README badges in generated order (space to select)',
1622
- choices: [
1623
- {
1624
- title: 'Homebridge Verified',
1625
- value: 'homebridge-verified',
1626
- selected: selectedBadges.includes('homebridge-verified'),
1627
- },
1628
- {
1629
- title: 'Homebridge',
1630
- value: 'homebridge',
1631
- selected: selectedBadges.includes('homebridge'),
1632
- },
1633
- {
1634
- title: 'npm Version (requires urls.npm)',
1635
- value: 'npm-version',
1636
- selected: selectedBadges.includes('npm-version'),
1637
- },
1638
- {
1639
- title: 'npm Downloads (requires urls.npm)',
1640
- value: 'npm-downloads',
1641
- selected: selectedBadges.includes('npm-downloads'),
1642
- },
1643
- {
1644
- title: 'Docker Pulls (requires urls.docker)',
1645
- value: 'docker-pulls',
1646
- selected: selectedBadges.includes('docker-pulls'),
1647
- },
1648
- {
1649
- title: 'Docker Image Size (requires urls.docker)',
1650
- value: 'docker-image-size',
1651
- selected: selectedBadges.includes('docker-image-size'),
1946
+ if (outputResult.allowedActions === 'all'
1947
+ || outputResult.allowedActions === 'local-only'
1948
+ || outputResult.allowedActions === 'selected') {
1949
+ actions.allowedActions = outputResult.allowedActions;
1950
+ }
1951
+ if (typeof outputResult.shaPinningRequired === 'boolean') {
1952
+ actions.shaPinningRequired = outputResult.shaPinningRequired;
1953
+ }
1954
+ if (Object.keys(selectedActions).length > 0) {
1955
+ actions.selectedActions = selectedActions;
1956
+ }
1957
+ if (outputResult.defaultWorkflowPermissions === 'read' || outputResult.defaultWorkflowPermissions === 'write') {
1958
+ actions.defaultWorkflowPermissions = outputResult.defaultWorkflowPermissions;
1959
+ }
1960
+ if (typeof outputResult.canApprovePullRequestReviews === 'boolean') {
1961
+ actions.canApprovePullRequestReviews = outputResult.canApprovePullRequestReviews;
1962
+ }
1963
+ if (artifactRetentionDaysRaw !== '') {
1964
+ const artifactRetentionDays = Number.parseInt(artifactRetentionDaysRaw, 10);
1965
+ actions.artifactRetentionDays = artifactRetentionDays;
1966
+ }
1967
+ if (Object.keys(actions).length > 0) {
1968
+ github.actions = actions;
1969
+ }
1970
+ else {
1971
+ Reflect.deleteProperty(github, 'actions');
1972
+ }
1973
+ Object.assign(config, { github });
1974
+ return 'back';
1975
+ }
1976
+ static async promptGithubLabels(config) {
1977
+ const labels = (config['github'] !== undefined && config['github']['labels'] !== undefined) ? config['github']['labels'].map((label) => ({ ...label })) : [];
1978
+ while (true) {
1979
+ const choices = [];
1980
+ for (let labelIndex = 0; labelIndex < labels.length; labelIndex += 1) {
1981
+ const choiceLabel = labels[labelIndex];
1982
+ if (choiceLabel === undefined) {
1983
+ continue;
1984
+ }
1985
+ const description = (choiceLabel['description'] === undefined) ? `#${choiceLabel['color']}` : `#${choiceLabel['color']} — ${choiceLabel['description']}`;
1986
+ choices.push({
1987
+ title: `${chalk.yellow.bold('[EDIT]')} ${choiceLabel['name']}`,
1988
+ description,
1989
+ value: `edit:${labelIndex}`,
1990
+ });
1991
+ if (labelIndex > 0) {
1992
+ choices.push({
1993
+ title: `${chalk.blue.bold('[MOVE UP]')} ${choiceLabel['name']}`,
1994
+ description: 'Move this label earlier in the generated order.',
1995
+ value: `move-up:${labelIndex}`,
1996
+ });
1997
+ }
1998
+ if (labelIndex < labels.length - 1) {
1999
+ choices.push({
2000
+ title: `${chalk.blue.bold('[MOVE DOWN]')} ${choiceLabel['name']}`,
2001
+ description: 'Move this label later in the generated order.',
2002
+ value: `move-down:${labelIndex}`,
2003
+ });
2004
+ }
2005
+ choices.push({
2006
+ title: `${chalk.red.bold('[REMOVE]')} ${choiceLabel['name']}`,
2007
+ description: 'Delete this managed label.',
2008
+ value: `remove:${labelIndex}`,
2009
+ });
2010
+ }
2011
+ choices.push({
2012
+ title: 'Add a label',
2013
+ description: 'Append a managed repository label.',
2014
+ value: 'add',
2015
+ });
2016
+ choices.push({
2017
+ title: 'Back',
2018
+ description: 'Return to GitHub settings.',
2019
+ value: 'back',
2020
+ });
2021
+ const menuOutput = await Runner.promptWithCancel({
2022
+ type: 'select',
2023
+ name: 'action',
2024
+ message: (labels.length > 0) ? 'Select a label to manage.' : 'No labels configured. Choose an option.',
2025
+ choices,
2026
+ });
2027
+ if (menuOutput['cancelled'] === true || menuOutput['result'].action === 'back') {
2028
+ const github = config['github'] ?? {};
2029
+ github.labels = labels;
2030
+ Object.assign(config, { github });
2031
+ return 'back';
2032
+ }
2033
+ const action = menuOutput['result'].action;
2034
+ if (action.startsWith('move-up:') === true || action.startsWith('move-down:') === true) {
2035
+ const actionPrefix = (action.startsWith('move-up:') === true) ? 'move-up:' : 'move-down:';
2036
+ const moveLabelIndex = Number.parseInt(action.slice(actionPrefix.length), 10);
2037
+ const destinationIndex = (actionPrefix === 'move-up:') ? moveLabelIndex - 1 : moveLabelIndex + 1;
2038
+ const moveLabel = labels[moveLabelIndex];
2039
+ if (moveLabel !== undefined
2040
+ && destinationIndex >= 0
2041
+ && destinationIndex < labels.length) {
2042
+ labels.splice(moveLabelIndex, 1);
2043
+ labels.splice(destinationIndex, 0, moveLabel);
2044
+ }
2045
+ continue;
2046
+ }
2047
+ if (action === 'add' || action.startsWith('edit:') === true) {
2048
+ const editLabelIndex = (action === 'add') ? -1 : Number.parseInt(action.slice('edit:'.length), 10);
2049
+ const editableLabel = (editLabelIndex >= 0) ? labels[editLabelIndex] : undefined;
2050
+ const formOutput = await Runner.promptWithCancel([
2051
+ {
2052
+ type: 'text',
2053
+ name: 'name',
2054
+ message: 'Label name',
2055
+ initial: (editableLabel !== undefined) ? editableLabel['name'] : '',
2056
+ validate: Runner['isNonEmptyLiteralInput'],
2057
+ },
2058
+ {
2059
+ type: 'text',
2060
+ name: 'color',
2061
+ message: 'Label color (six hexadecimal characters, without #)',
2062
+ initial: (editableLabel !== undefined) ? editableLabel['color'] : '',
2063
+ validate: (value) => (typeof value === 'string' && LIB_REGEX_PATTERN_GITHUB_LABEL_COLOR.test(value.trim()) === true) ? true : 'Enter exactly six hexadecimal characters.',
2064
+ },
2065
+ {
2066
+ type: 'text',
2067
+ name: 'description',
2068
+ message: 'Label description (blank unsets)',
2069
+ initial: (editableLabel !== undefined && editableLabel['description'] !== undefined) ? editableLabel['description'] : '',
2070
+ validate: (value) => (typeof value === 'string' && value.length <= 100) ? true : 'Use 100 characters or fewer.',
2071
+ },
2072
+ ]);
2073
+ if (formOutput['cancelled'] === true) {
2074
+ continue;
2075
+ }
2076
+ const label = {
2077
+ name: formOutput['result'].name.trim(),
2078
+ color: formOutput['result'].color.trim(),
2079
+ ...((formOutput['result'].description.trim() !== '') ? { description: formOutput['result'].description.trim() } : {}),
2080
+ };
2081
+ if (editLabelIndex >= 0) {
2082
+ Reflect.set(labels, editLabelIndex, label);
2083
+ }
2084
+ else {
2085
+ labels.push(label);
2086
+ }
2087
+ continue;
2088
+ }
2089
+ if (action.startsWith('remove:') === true) {
2090
+ const removeLabelIndex = Number.parseInt(action.slice('remove:'.length), 10);
2091
+ const removeLabel = labels[removeLabelIndex];
2092
+ if (removeLabel === undefined) {
2093
+ continue;
2094
+ }
2095
+ const removeOutput = await Runner.promptWithCancel({
2096
+ type: 'confirm',
2097
+ name: 'confirm',
2098
+ message: `Remove label "${removeLabel['name']}"?`,
2099
+ initial: false,
2100
+ });
2101
+ if (removeOutput['cancelled'] === false && removeOutput['result'].confirm === true) {
2102
+ labels.splice(removeLabelIndex, 1);
2103
+ }
2104
+ }
2105
+ }
2106
+ }
2107
+ static async promptGithubMenu(config) {
2108
+ const choices = [
2109
+ {
2110
+ title: 'Identity, features, issue fields, and recipe toggles',
2111
+ description: 'Edit repository identity and the common guided fields.',
2112
+ value: 'basics',
2113
+ },
2114
+ {
2115
+ title: 'Actions',
2116
+ description: 'Edit action permissions, allow-lists, and retention.',
2117
+ value: 'actions',
2118
+ },
2119
+ {
2120
+ title: 'Labels',
2121
+ description: 'Add, edit, remove, and order repository labels.',
2122
+ value: 'labels',
2123
+ },
2124
+ {
2125
+ title: 'Policies',
2126
+ description: 'Edit merge behavior and repository-wide policies.',
2127
+ value: 'policies',
2128
+ },
2129
+ {
2130
+ title: 'Rulesets',
2131
+ description: 'Edit the complete default-branch ruleset.',
2132
+ value: 'rulesets',
2133
+ },
2134
+ {
2135
+ title: 'Security',
2136
+ description: 'Edit repository security feature toggles.',
2137
+ value: 'security',
2138
+ },
2139
+ {
2140
+ title: 'Back',
2141
+ description: 'Return to the category selection.',
2142
+ value: 'back',
2143
+ },
2144
+ ];
2145
+ while (true) {
2146
+ const output = await Runner.promptWithCancel({
2147
+ type: 'select',
2148
+ name: 'section',
2149
+ message: 'Select GitHub settings to manage.',
2150
+ choices,
2151
+ });
2152
+ if (output['cancelled'] === true || output['result'].section === 'back') {
2153
+ return 'back';
2154
+ }
2155
+ const section = output['result'].section;
2156
+ if (section === 'basics') {
2157
+ await Runner.promptGithub(config);
2158
+ }
2159
+ else if (section === 'actions') {
2160
+ await Runner.promptGithubActions(config);
2161
+ }
2162
+ else if (section === 'labels') {
2163
+ await Runner.promptGithubLabels(config);
2164
+ }
2165
+ else if (section === 'policies') {
2166
+ await Runner.promptGithubPolicies(config);
2167
+ }
2168
+ else if (section === 'rulesets') {
2169
+ await Runner.promptGithubRulesets(config);
2170
+ }
2171
+ else if (section === 'security') {
2172
+ await Runner.promptGithubSecurity(config);
2173
+ }
2174
+ }
2175
+ }
2176
+ static async promptGithubPolicies(config) {
2177
+ const github = config['github'] ?? {};
2178
+ const existing = github['policies'] ?? {};
2179
+ const output = await Runner.promptWithCancel([
2180
+ {
2181
+ type: 'select',
2182
+ name: 'visibility',
2183
+ message: 'Repository visibility',
2184
+ choices: [
2185
+ {
2186
+ title: 'Unset',
2187
+ value: 'unset',
2188
+ },
2189
+ {
2190
+ title: 'Public',
2191
+ value: 'public',
2192
+ },
2193
+ {
2194
+ title: 'Private',
2195
+ value: 'private',
2196
+ },
2197
+ {
2198
+ title: 'Internal',
2199
+ value: 'internal',
2200
+ },
2201
+ ],
2202
+ initial: (existing['visibility'] === undefined) ? 0 : ([
2203
+ 'public',
2204
+ 'private',
2205
+ 'internal',
2206
+ ].indexOf(existing['visibility']) + 1),
2207
+ },
2208
+ {
2209
+ type: 'text',
2210
+ name: 'defaultBranch',
2211
+ message: 'Default branch (blank unsets)',
2212
+ initial: existing['defaultBranch'] ?? '',
2213
+ },
2214
+ {
2215
+ type: 'select',
2216
+ name: 'merge',
2217
+ message: 'Allow merge commits?',
2218
+ choices: [
2219
+ {
2220
+ title: 'Unset',
2221
+ value: 'unset',
2222
+ },
2223
+ {
2224
+ title: 'Allow',
2225
+ value: true,
2226
+ },
2227
+ {
2228
+ title: 'Do not allow',
2229
+ value: false,
2230
+ },
2231
+ ],
2232
+ initial: Runner.getOptionalBooleanInitial((existing['mergeMethods'] !== undefined) ? existing['mergeMethods']['merge'] : undefined),
2233
+ },
2234
+ {
2235
+ type: 'select',
2236
+ name: 'squash',
2237
+ message: 'Allow squash merges?',
2238
+ choices: [
2239
+ {
2240
+ title: 'Unset',
2241
+ value: 'unset',
2242
+ },
2243
+ {
2244
+ title: 'Allow',
2245
+ value: true,
2246
+ },
2247
+ {
2248
+ title: 'Do not allow',
2249
+ value: false,
2250
+ },
2251
+ ],
2252
+ initial: Runner.getOptionalBooleanInitial((existing['mergeMethods'] !== undefined) ? existing['mergeMethods']['squash'] : undefined),
2253
+ },
2254
+ {
2255
+ type: 'select',
2256
+ name: 'rebase',
2257
+ message: 'Allow rebase merges?',
2258
+ choices: [
2259
+ {
2260
+ title: 'Unset',
2261
+ value: 'unset',
2262
+ },
2263
+ {
2264
+ title: 'Allow',
2265
+ value: true,
2266
+ },
2267
+ {
2268
+ title: 'Do not allow',
2269
+ value: false,
2270
+ },
2271
+ ],
2272
+ initial: Runner.getOptionalBooleanInitial((existing['mergeMethods'] !== undefined) ? existing['mergeMethods']['rebase'] : undefined),
2273
+ },
2274
+ {
2275
+ type: 'select',
2276
+ name: 'mergeCommitTitle',
2277
+ message: 'Merge-commit title source',
2278
+ choices: [
2279
+ {
2280
+ title: 'Unset',
2281
+ value: 'unset',
2282
+ },
2283
+ {
2284
+ title: 'Pull request title',
2285
+ value: 'pull-request-title',
2286
+ },
2287
+ {
2288
+ title: 'Merge message',
2289
+ value: 'merge-message',
2290
+ },
2291
+ ],
2292
+ initial: (existing['mergeCommit'] === undefined || existing['mergeCommit']['title'] === undefined) ? 0 : ([
2293
+ 'pull-request-title',
2294
+ 'merge-message',
2295
+ ].indexOf(existing['mergeCommit']['title']) + 1),
2296
+ },
2297
+ {
2298
+ type: 'select',
2299
+ name: 'mergeCommitMessage',
2300
+ message: 'Merge-commit message source',
2301
+ choices: [
2302
+ {
2303
+ title: 'Unset',
2304
+ value: 'unset',
2305
+ },
2306
+ {
2307
+ title: 'Pull request body',
2308
+ value: 'pull-request-body',
2309
+ },
2310
+ {
2311
+ title: 'Pull request title',
2312
+ value: 'pull-request-title',
2313
+ },
2314
+ {
2315
+ title: 'Blank',
2316
+ value: 'blank',
2317
+ },
2318
+ ],
2319
+ initial: (existing['mergeCommit'] === undefined || existing['mergeCommit']['message'] === undefined) ? 0 : ([
2320
+ 'pull-request-body',
2321
+ 'pull-request-title',
2322
+ 'blank',
2323
+ ].indexOf(existing['mergeCommit']['message']) + 1),
2324
+ },
2325
+ {
2326
+ type: 'select',
2327
+ name: 'squashMergeTitle',
2328
+ message: 'Squash-merge title source',
2329
+ choices: [
2330
+ {
2331
+ title: 'Unset',
2332
+ value: 'unset',
2333
+ },
2334
+ {
2335
+ title: 'Pull request title',
2336
+ value: 'pull-request-title',
2337
+ },
2338
+ {
2339
+ title: 'Commit or pull request title',
2340
+ value: 'commit-or-pull-request-title',
2341
+ },
2342
+ ],
2343
+ initial: (existing['squashMerge'] === undefined || existing['squashMerge']['title'] === undefined) ? 0 : ([
2344
+ 'pull-request-title',
2345
+ 'commit-or-pull-request-title',
2346
+ ].indexOf(existing['squashMerge']['title']) + 1),
2347
+ },
2348
+ {
2349
+ type: 'select',
2350
+ name: 'squashMergeMessage',
2351
+ message: 'Squash-merge message source',
2352
+ choices: [
2353
+ {
2354
+ title: 'Unset',
2355
+ value: 'unset',
2356
+ },
2357
+ {
2358
+ title: 'Pull request body',
2359
+ value: 'pull-request-body',
2360
+ },
2361
+ {
2362
+ title: 'Commit messages',
2363
+ value: 'commit-messages',
2364
+ },
2365
+ {
2366
+ title: 'Blank',
2367
+ value: 'blank',
2368
+ },
2369
+ ],
2370
+ initial: (existing['squashMerge'] === undefined || existing['squashMerge']['message'] === undefined) ? 0 : ([
2371
+ 'pull-request-body',
2372
+ 'commit-messages',
2373
+ 'blank',
2374
+ ].indexOf(existing['squashMerge']['message']) + 1),
2375
+ },
2376
+ ...[
2377
+ 'autoDeleteHeadBranch',
2378
+ 'autoMerge',
2379
+ 'allowUpdateBranch',
2380
+ 'webCommitSignoffRequired',
2381
+ ].map((name) => ({
2382
+ type: 'select',
2383
+ name,
2384
+ message: ({
2385
+ autoDeleteHeadBranch: 'Automatically delete merged head branches?',
2386
+ autoMerge: 'Allow automatic merging?',
2387
+ allowUpdateBranch: 'Allow updating pull request branches?',
2388
+ webCommitSignoffRequired: 'Require signoff for web commits?',
2389
+ })[name],
2390
+ choices: [
2391
+ {
2392
+ title: 'Unset',
2393
+ value: 'unset',
2394
+ },
2395
+ {
2396
+ title: 'Enable',
2397
+ value: true,
2398
+ },
2399
+ {
2400
+ title: 'Disable',
2401
+ value: false,
2402
+ },
2403
+ ],
2404
+ initial: Runner.getOptionalBooleanInitial(existing[name]),
2405
+ })),
2406
+ ]);
2407
+ if (output['cancelled'] === true) {
2408
+ return 'back';
2409
+ }
2410
+ const outputResult = output['result'];
2411
+ const mergeMethods = {};
2412
+ const mergeCommit = {};
2413
+ const squashMerge = {};
2414
+ const policies = {};
2415
+ if (outputResult.visibility === 'public'
2416
+ || outputResult.visibility === 'private'
2417
+ || outputResult.visibility === 'internal') {
2418
+ policies.visibility = outputResult.visibility;
2419
+ }
2420
+ if (typeof outputResult.defaultBranch === 'string' && outputResult.defaultBranch.trim() !== '') {
2421
+ policies.defaultBranch = outputResult.defaultBranch.trim();
2422
+ }
2423
+ if (typeof outputResult.merge === 'boolean') {
2424
+ mergeMethods.merge = outputResult.merge;
2425
+ }
2426
+ if (typeof outputResult.squash === 'boolean') {
2427
+ mergeMethods.squash = outputResult.squash;
2428
+ }
2429
+ if (typeof outputResult.rebase === 'boolean') {
2430
+ mergeMethods.rebase = outputResult.rebase;
2431
+ }
2432
+ if (Object.keys(mergeMethods).length > 0) {
2433
+ policies.mergeMethods = mergeMethods;
2434
+ }
2435
+ if (outputResult.mergeCommitTitle === 'pull-request-title' || outputResult.mergeCommitTitle === 'merge-message') {
2436
+ mergeCommit.title = outputResult.mergeCommitTitle;
2437
+ }
2438
+ if (outputResult.mergeCommitMessage === 'pull-request-body'
2439
+ || outputResult.mergeCommitMessage === 'pull-request-title'
2440
+ || outputResult.mergeCommitMessage === 'blank') {
2441
+ mergeCommit.message = outputResult.mergeCommitMessage;
2442
+ }
2443
+ if (Object.keys(mergeCommit).length > 0) {
2444
+ policies.mergeCommit = mergeCommit;
2445
+ }
2446
+ if (outputResult.squashMergeTitle === 'pull-request-title' || outputResult.squashMergeTitle === 'commit-or-pull-request-title') {
2447
+ squashMerge.title = outputResult.squashMergeTitle;
2448
+ }
2449
+ if (outputResult.squashMergeMessage === 'pull-request-body'
2450
+ || outputResult.squashMergeMessage === 'commit-messages'
2451
+ || outputResult.squashMergeMessage === 'blank') {
2452
+ squashMerge.message = outputResult.squashMergeMessage;
2453
+ }
2454
+ if (Object.keys(squashMerge).length > 0) {
2455
+ policies.squashMerge = squashMerge;
2456
+ }
2457
+ if (typeof outputResult.autoDeleteHeadBranch === 'boolean') {
2458
+ policies.autoDeleteHeadBranch = outputResult.autoDeleteHeadBranch;
2459
+ }
2460
+ if (typeof outputResult.autoMerge === 'boolean') {
2461
+ policies.autoMerge = outputResult.autoMerge;
2462
+ }
2463
+ if (typeof outputResult.allowUpdateBranch === 'boolean') {
2464
+ policies.allowUpdateBranch = outputResult.allowUpdateBranch;
2465
+ }
2466
+ if (typeof outputResult.webCommitSignoffRequired === 'boolean') {
2467
+ policies.webCommitSignoffRequired = outputResult.webCommitSignoffRequired;
2468
+ }
2469
+ if (Object.keys(policies).length > 0) {
2470
+ github.policies = policies;
2471
+ }
2472
+ else {
2473
+ Reflect.deleteProperty(github, 'policies');
2474
+ }
2475
+ Object.assign(config, { github });
2476
+ return 'back';
2477
+ }
2478
+ static async promptGithubRulesets(config) {
2479
+ const github = config['github'] ?? {};
2480
+ const existingRulesets = github['rulesets'] ?? {};
2481
+ const existing = existingRulesets['defaultBranch'] ?? {};
2482
+ const output = await Runner.promptWithCancel([
2483
+ {
2484
+ type: 'select',
2485
+ name: 'enforcement',
2486
+ message: 'Default-branch ruleset enforcement',
2487
+ choices: [
2488
+ {
2489
+ title: 'Unset',
2490
+ value: 'unset',
2491
+ },
2492
+ {
2493
+ title: 'Active',
2494
+ value: 'active',
2495
+ },
2496
+ {
2497
+ title: 'Disabled',
2498
+ value: 'disabled',
2499
+ },
2500
+ {
2501
+ title: 'Evaluate',
2502
+ value: 'evaluate',
2503
+ },
2504
+ ],
2505
+ initial: (existing['enforcement'] === undefined) ? 0 : ([
2506
+ 'active',
2507
+ 'disabled',
2508
+ 'evaluate',
2509
+ ].indexOf(existing['enforcement']) + 1),
2510
+ },
2511
+ ...[
2512
+ 'blockDeletions',
2513
+ 'blockForcePushes',
2514
+ 'requireLinearHistory',
2515
+ 'requireSignedCommits',
2516
+ 'requirePullRequest',
2517
+ ].map((name) => ({
2518
+ type: 'select',
2519
+ name,
2520
+ message: ({
2521
+ blockDeletions: 'Block branch deletions?',
2522
+ blockForcePushes: 'Block force pushes?',
2523
+ requireLinearHistory: 'Require linear history?',
2524
+ requireSignedCommits: 'Require signed commits?',
2525
+ requirePullRequest: 'Require pull requests?',
2526
+ })[name],
2527
+ choices: [
2528
+ {
2529
+ title: 'Unset',
2530
+ value: 'unset',
2531
+ },
2532
+ {
2533
+ title: 'Enable',
2534
+ value: true,
2535
+ },
2536
+ {
2537
+ title: 'Disable',
2538
+ value: false,
2539
+ },
2540
+ ],
2541
+ initial: Runner.getOptionalBooleanInitial(existing[name]),
2542
+ })),
2543
+ {
2544
+ type: 'multiselect',
2545
+ name: 'allowedMergeMethods',
2546
+ message: 'Allowed pull-request merge methods',
2547
+ choices: [
2548
+ {
2549
+ title: 'Merge',
2550
+ value: 'merge',
2551
+ selected: existing['allowedMergeMethods'] !== undefined && existing['allowedMergeMethods'].includes('merge'),
2552
+ },
2553
+ {
2554
+ title: 'Squash',
2555
+ value: 'squash',
2556
+ selected: existing['allowedMergeMethods'] !== undefined && existing['allowedMergeMethods'].includes('squash'),
2557
+ },
2558
+ {
2559
+ title: 'Rebase',
2560
+ value: 'rebase',
2561
+ selected: existing['allowedMergeMethods'] !== undefined && existing['allowedMergeMethods'].includes('rebase'),
2562
+ },
2563
+ ],
2564
+ hint: '- Space to select. Return to submit. Selecting none unsets the field',
2565
+ },
2566
+ ...[
2567
+ 'dismissStaleReviews',
2568
+ 'requireCodeOwnerReview',
2569
+ 'requireLastPushApproval',
2570
+ ].map((name) => ({
2571
+ type: 'select',
2572
+ name,
2573
+ message: ({
2574
+ dismissStaleReviews: 'Dismiss stale pull-request reviews?',
2575
+ requireCodeOwnerReview: 'Require code-owner review?',
2576
+ requireLastPushApproval: 'Require approval after the latest push?',
2577
+ })[name],
2578
+ choices: [
2579
+ {
2580
+ title: 'Unset',
2581
+ value: 'unset',
2582
+ },
2583
+ {
2584
+ title: 'Enable',
2585
+ value: true,
2586
+ },
2587
+ {
2588
+ title: 'Disable',
2589
+ value: false,
2590
+ },
2591
+ ],
2592
+ initial: Runner.getOptionalBooleanInitial(existing[name]),
2593
+ })),
2594
+ {
2595
+ type: 'text',
2596
+ name: 'requiredApprovals',
2597
+ message: 'Required approving reviews (blank unsets)',
2598
+ initial: (existing['requiredApprovals'] === undefined) ? '' : `${existing['requiredApprovals']}`,
2599
+ validate: Runner['isOptionalNonnegativeIntegerInput'],
2600
+ },
2601
+ {
2602
+ type: 'select',
2603
+ name: 'requireConversationResolution',
2604
+ message: 'Require conversation resolution?',
2605
+ choices: [
2606
+ {
2607
+ title: 'Unset',
2608
+ value: 'unset',
2609
+ },
2610
+ {
2611
+ title: 'Enable',
2612
+ value: true,
2613
+ },
2614
+ {
2615
+ title: 'Disable',
2616
+ value: false,
2617
+ },
2618
+ ],
2619
+ initial: Runner.getOptionalBooleanInitial(existing['requireConversationResolution']),
2620
+ },
2621
+ {
2622
+ type: 'text',
2623
+ name: 'requiredStatusChecks',
2624
+ message: 'Required status checks (comma-separated; blank unsets)',
2625
+ initial: (existing['requiredStatusChecks'] === undefined) ? '' : existing['requiredStatusChecks'].join(', '),
2626
+ },
2627
+ {
2628
+ type: 'select',
2629
+ name: 'requireBranchesToBeUpToDate',
2630
+ message: 'Require branches to be up to date?',
2631
+ choices: [
2632
+ {
2633
+ title: 'Unset',
2634
+ value: 'unset',
2635
+ },
2636
+ {
2637
+ title: 'Enable',
2638
+ value: true,
2639
+ },
2640
+ {
2641
+ title: 'Disable',
2642
+ value: false,
2643
+ },
2644
+ ],
2645
+ initial: Runner.getOptionalBooleanInitial(existing['requireBranchesToBeUpToDate']),
2646
+ },
2647
+ ]);
2648
+ if (output['cancelled'] === true) {
2649
+ return 'back';
2650
+ }
2651
+ const outputResult = output['result'];
2652
+ const allowedMergeMethods = [];
2653
+ const defaultBranch = {};
2654
+ if (outputResult.enforcement === 'active'
2655
+ || outputResult.enforcement === 'disabled'
2656
+ || outputResult.enforcement === 'evaluate') {
2657
+ defaultBranch.enforcement = outputResult.enforcement;
2658
+ }
2659
+ for (const mergeMethod of ((Array.isArray(outputResult.allowedMergeMethods) === true) ? outputResult.allowedMergeMethods : [])) {
2660
+ if (mergeMethod === 'merge'
2661
+ || mergeMethod === 'squash'
2662
+ || mergeMethod === 'rebase') {
2663
+ allowedMergeMethods.push(mergeMethod);
2664
+ }
2665
+ }
2666
+ for (const booleanKey of [
2667
+ 'blockDeletions',
2668
+ 'blockForcePushes',
2669
+ 'requireLinearHistory',
2670
+ 'requireSignedCommits',
2671
+ 'requirePullRequest',
2672
+ 'dismissStaleReviews',
2673
+ 'requireCodeOwnerReview',
2674
+ 'requireLastPushApproval',
2675
+ 'requireConversationResolution',
2676
+ 'requireBranchesToBeUpToDate',
2677
+ ]) {
2678
+ if (typeof outputResult[booleanKey] === 'boolean') {
2679
+ Reflect.set(defaultBranch, booleanKey, outputResult[booleanKey]);
2680
+ }
2681
+ }
2682
+ if (allowedMergeMethods.length > 0) {
2683
+ defaultBranch.allowedMergeMethods = allowedMergeMethods;
2684
+ }
2685
+ const requiredApprovalsRaw = (typeof outputResult.requiredApprovals === 'string') ? outputResult.requiredApprovals.trim() : '';
2686
+ if (requiredApprovalsRaw !== '') {
2687
+ const requiredApprovals = Number.parseInt(requiredApprovalsRaw, 10);
2688
+ defaultBranch.requiredApprovals = requiredApprovals;
2689
+ }
2690
+ const requiredStatusChecks = (typeof outputResult.requiredStatusChecks === 'string') ? outputResult.requiredStatusChecks.split(',').map((statusCheck) => statusCheck.trim()).filter((statusCheck) => statusCheck !== '') : [];
2691
+ if (requiredStatusChecks.length > 0) {
2692
+ defaultBranch.requiredStatusChecks = requiredStatusChecks;
2693
+ }
2694
+ if (Object.keys(defaultBranch).length > 0) {
2695
+ const rulesets = { defaultBranch };
2696
+ github.rulesets = rulesets;
2697
+ }
2698
+ else {
2699
+ Reflect.deleteProperty(github, 'rulesets');
2700
+ }
2701
+ Object.assign(config, { github });
2702
+ return 'back';
2703
+ }
2704
+ static async promptGithubSecurity(config) {
2705
+ const github = config['github'] ?? {};
2706
+ const existing = github['security'] ?? {};
2707
+ const output = await Runner.promptWithCancel([
2708
+ 'vulnerabilityAlerts',
2709
+ 'dependabotSecurityUpdates',
2710
+ 'secretScanning',
2711
+ 'pushProtection',
2712
+ ].map((name) => ({
2713
+ type: 'select',
2714
+ name,
2715
+ message: ({
2716
+ vulnerabilityAlerts: 'Enable dependency vulnerability alerts?',
2717
+ dependabotSecurityUpdates: 'Enable Dependabot security updates?',
2718
+ secretScanning: 'Enable secret scanning?',
2719
+ pushProtection: 'Enable secret-scanning push protection?',
2720
+ })[name],
2721
+ choices: [
2722
+ {
2723
+ title: 'Unset',
2724
+ value: 'unset',
2725
+ },
2726
+ {
2727
+ title: 'Enable',
2728
+ value: true,
2729
+ },
2730
+ {
2731
+ title: 'Disable',
2732
+ value: false,
2733
+ },
2734
+ ],
2735
+ initial: Runner.getOptionalBooleanInitial(existing[name]),
2736
+ })));
2737
+ if (output['cancelled'] === true) {
2738
+ return 'back';
2739
+ }
2740
+ const outputResult = output['result'];
2741
+ const security = {};
2742
+ for (const securityKey of [
2743
+ 'vulnerabilityAlerts',
2744
+ 'dependabotSecurityUpdates',
2745
+ 'secretScanning',
2746
+ 'pushProtection',
2747
+ ]) {
2748
+ if (typeof outputResult[securityKey] === 'boolean') {
2749
+ Reflect.set(security, securityKey, outputResult[securityKey]);
2750
+ }
2751
+ }
2752
+ if (Object.keys(security).length > 0) {
2753
+ github.security = security;
2754
+ }
2755
+ else {
2756
+ Reflect.deleteProperty(github, 'security');
2757
+ }
2758
+ Object.assign(config, { github });
2759
+ return 'back';
2760
+ }
2761
+ static async promptReadMe(config) {
2762
+ const existingReadMe = config['readme'];
2763
+ const existingBadges = (existingReadMe !== undefined) ? (existingReadMe['badges'] ?? []) : [];
2764
+ const hasExplicitBadges = (existingReadMe !== undefined) ? existingReadMe['badges'] !== undefined : false;
2765
+ const suggestedBadges = [];
2766
+ const project = config['project'];
2767
+ const platforms = (project !== undefined) ? project['platforms'] : undefined;
2768
+ const urls = config['urls'];
2769
+ const github = config['github'];
2770
+ const fundSources = (urls !== undefined) ? (urls['fundSources'] ?? []) : [];
2771
+ if (platforms !== undefined && platforms.includes('homebridge') === true) {
2772
+ suggestedBadges.push('homebridge');
2773
+ }
2774
+ if (urls !== undefined && urls['npm'] !== undefined) {
2775
+ suggestedBadges.push('npm-version', 'npm-downloads');
2776
+ }
2777
+ if (urls !== undefined && urls['docker'] !== undefined) {
2778
+ suggestedBadges.push('docker-pulls', 'docker-image-size');
2779
+ }
2780
+ if (github !== undefined) {
2781
+ if (github['owner'] !== undefined && github['repo'] !== undefined) {
2782
+ suggestedBadges.push('github-release', 'github-top-language', 'github-license');
2783
+ }
2784
+ }
2785
+ if (fundSources.length > 0) {
2786
+ suggestedBadges.push('funding');
2787
+ }
2788
+ const selectedBadges = (hasExplicitBadges === true) ? existingBadges : suggestedBadges;
2789
+ const badgesOutput = await Runner.promptWithCancel({
2790
+ type: 'multiselect',
2791
+ name: 'readMeBadges',
2792
+ message: 'README badges in generated order (space to select)',
2793
+ choices: [
2794
+ {
2795
+ title: 'Homebridge Verified',
2796
+ value: 'homebridge-verified',
2797
+ selected: selectedBadges.includes('homebridge-verified'),
2798
+ },
2799
+ {
2800
+ title: 'Homebridge',
2801
+ value: 'homebridge',
2802
+ selected: selectedBadges.includes('homebridge'),
2803
+ },
2804
+ {
2805
+ title: 'npm Version (requires urls.npm)',
2806
+ value: 'npm-version',
2807
+ selected: selectedBadges.includes('npm-version'),
2808
+ },
2809
+ {
2810
+ title: 'npm Downloads (requires urls.npm)',
2811
+ value: 'npm-downloads',
2812
+ selected: selectedBadges.includes('npm-downloads'),
2813
+ },
2814
+ {
2815
+ title: 'Docker Pulls (requires urls.docker)',
2816
+ value: 'docker-pulls',
2817
+ selected: selectedBadges.includes('docker-pulls'),
2818
+ },
2819
+ {
2820
+ title: 'Docker Image Size (requires urls.docker)',
2821
+ value: 'docker-image-size',
2822
+ selected: selectedBadges.includes('docker-image-size'),
1652
2823
  },
1653
2824
  {
1654
2825
  title: 'GitHub Release (requires github owner and repo)',
@@ -1676,17 +2847,240 @@ export class Runner {
1676
2847
  if (badgesOutput['cancelled'] === true) {
1677
2848
  return 'back';
1678
2849
  }
1679
- const badges = badgesOutput['result'].readMeBadges ?? [];
1680
- Object.assign(config, {
1681
- readme: { badges },
1682
- });
1683
- Logger.customize({
1684
- name: 'Runner.promptReadMe',
1685
- purpose: 'updated',
1686
- padTop: 1,
1687
- padBottom: 1,
1688
- }).info('README settings updated.');
1689
- return 'back';
2850
+ const badges = badgesOutput['result'].readMeBadges ?? [];
2851
+ Object.assign(config, {
2852
+ readme: { badges },
2853
+ });
2854
+ Logger.customize({
2855
+ name: 'Runner.promptReadMe',
2856
+ purpose: 'updated',
2857
+ padTop: 1,
2858
+ padBottom: 1,
2859
+ }).info('README settings updated.');
2860
+ return 'back';
2861
+ }
2862
+ static async promptMiscellaneousRecipes(entries) {
2863
+ const existingFixMarkdownTables = (entries !== undefined) ? entries['fix-markdown-tables'] : undefined;
2864
+ const existingRemoveOperatingSystemFiles = (entries !== undefined) ? entries['remove-operating-system-files'] : undefined;
2865
+ const promptEntries = {
2866
+ 'fix-markdown-tables': existingFixMarkdownTables ?? { enabled: false },
2867
+ 'remove-operating-system-files': {
2868
+ enabled: (existingRemoveOperatingSystemFiles !== undefined) ? existingRemoveOperatingSystemFiles['enabled'] : false,
2869
+ },
2870
+ };
2871
+ const selectedEntries = await Runner.promptRecipeEntries(promptEntries, libItemRecipesByCategory['miscellaneous'], 'Miscellaneous', ['fix-markdown-tables']);
2872
+ if (selectedEntries === undefined) {
2873
+ return undefined;
2874
+ }
2875
+ const selectedFixMarkdownTables = selectedEntries['fix-markdown-tables'] ?? { enabled: false };
2876
+ const selectedRemoveOperatingSystemFiles = selectedEntries['remove-operating-system-files'] ?? { enabled: false };
2877
+ const settings = {};
2878
+ const platforms = Object.keys(libItemOperatingSystemFilesByPlatform);
2879
+ for (const platform of platforms) {
2880
+ const existingPlatformSettings = (existingRemoveOperatingSystemFiles !== undefined && existingRemoveOperatingSystemFiles['settings'] !== undefined) ? existingRemoveOperatingSystemFiles['settings'][platform] : undefined;
2881
+ const supportedFileNames = libItemOperatingSystemFilesByPlatform[platform];
2882
+ const fileSettings = {};
2883
+ if (supportedFileNames.length === 0) {
2884
+ Reflect.set(settings, platform, fileSettings);
2885
+ continue;
2886
+ }
2887
+ const selectedFileNames = supportedFileNames.filter((supportedFileName) => existingPlatformSettings !== undefined && Reflect.get(existingPlatformSettings, supportedFileName) === true);
2888
+ const fileOutput = await Runner.promptWithCancel({
2889
+ type: 'multiselect',
2890
+ name: 'fileNames',
2891
+ message: `${platform} files to remove (space to select)`,
2892
+ choices: supportedFileNames.map((supportedFileName) => ({
2893
+ title: libItemOperatingSystemFilePatterns[supportedFileName],
2894
+ description: supportedFileName,
2895
+ value: supportedFileName,
2896
+ selected: selectedFileNames.includes(supportedFileName),
2897
+ })),
2898
+ hint: '- Space to select. Return to submit',
2899
+ });
2900
+ if (fileOutput['cancelled'] === true) {
2901
+ return undefined;
2902
+ }
2903
+ for (const supportedFileName of supportedFileNames) {
2904
+ Reflect.set(fileSettings, supportedFileName, fileOutput['result'].fileNames.includes(supportedFileName));
2905
+ }
2906
+ Reflect.set(settings, platform, fileSettings);
2907
+ }
2908
+ const fixMarkdownTables = {
2909
+ ...selectedFixMarkdownTables,
2910
+ };
2911
+ const removeOperatingSystemFiles = {
2912
+ enabled: selectedRemoveOperatingSystemFiles['enabled'],
2913
+ settings,
2914
+ };
2915
+ return {
2916
+ 'fix-markdown-tables': fixMarkdownTables,
2917
+ 'remove-operating-system-files': removeOperatingSystemFiles,
2918
+ };
2919
+ }
2920
+ static async promptRecipeEntries(entries, allowedRecipeNames, label, settingsRecipeNames) {
2921
+ const existingEntries = entries ?? {};
2922
+ const allowedSettingsRecipeNames = settingsRecipeNames ?? allowedRecipeNames;
2923
+ const enabledRecipes = allowedRecipeNames.filter((recipeName) => existingEntries[recipeName] !== undefined && existingEntries[recipeName]['enabled'] === true);
2924
+ const enabledOutput = await Runner.promptWithCancel({
2925
+ type: 'multiselect',
2926
+ name: 'enabledRecipes',
2927
+ message: `${label} recipes to enable (space to select)`,
2928
+ choices: allowedRecipeNames.map((recipeName) => ({
2929
+ title: recipeName,
2930
+ value: recipeName,
2931
+ selected: enabledRecipes.includes(recipeName),
2932
+ })),
2933
+ hint: '- Space to select. Return to submit',
2934
+ });
2935
+ if (enabledOutput['cancelled'] === true) {
2936
+ return undefined;
2937
+ }
2938
+ const settingsRecipes = allowedSettingsRecipeNames.filter((recipeName) => existingEntries[recipeName] !== undefined && existingEntries[recipeName]['settings'] !== undefined);
2939
+ const settingsOutput = await Runner.promptWithCancel({
2940
+ type: 'multiselect',
2941
+ name: 'settingsRecipes',
2942
+ message: `${label} recipes with custom settings (space to select)`,
2943
+ choices: allowedSettingsRecipeNames.map((recipeName) => ({
2944
+ title: recipeName,
2945
+ value: recipeName,
2946
+ selected: settingsRecipes.includes(recipeName),
2947
+ })),
2948
+ hint: '- Space to select. Return to submit',
2949
+ });
2950
+ if (settingsOutput['cancelled'] === true) {
2951
+ return undefined;
2952
+ }
2953
+ const settingsByRecipe = {};
2954
+ for (const recipeName of settingsOutput['result'].settingsRecipes) {
2955
+ const existingSettings = (existingEntries[recipeName] !== undefined && existingEntries[recipeName]['settings'] !== undefined) ? existingEntries[recipeName]['settings'] : {};
2956
+ const recipeSettingsOutput = await Runner.promptWithCancel({
2957
+ type: 'text',
2958
+ name: 'recipeSettings',
2959
+ message: `${recipeName} boolean settings as JSON`,
2960
+ initial: JSON.stringify(existingSettings),
2961
+ validate: Runner['isBooleanRecordInput'],
2962
+ });
2963
+ if (recipeSettingsOutput['cancelled'] === true) {
2964
+ return undefined;
2965
+ }
2966
+ Reflect.set(settingsByRecipe, recipeName, Runner.parseBooleanRecordInput(recipeSettingsOutput['result'].recipeSettings));
2967
+ }
2968
+ const nextEntries = {};
2969
+ for (const recipeName of allowedRecipeNames) {
2970
+ const entry = {
2971
+ enabled: enabledOutput['result'].enabledRecipes.includes(recipeName),
2972
+ };
2973
+ const recipeSettings = settingsByRecipe[recipeName] ?? {};
2974
+ if (Object.keys(recipeSettings).length > 0) {
2975
+ entry.settings = recipeSettings;
2976
+ }
2977
+ Reflect.set(nextEntries, recipeName, entry);
2978
+ }
2979
+ return nextEntries;
2980
+ }
2981
+ static async promptRecipes(config) {
2982
+ const recipes = (config['recipes'] !== undefined) ? { ...config['recipes'] } : {};
2983
+ const packageJsonRecipes = (recipes['package-json'] !== undefined) ? { ...recipes['package-json'] } : {};
2984
+ const targetPaths = Object.keys(config['workspaces'] ?? {});
2985
+ for (const workspacePath of Object.keys(packageJsonRecipes)) {
2986
+ if (targetPaths.includes(workspacePath) === false) {
2987
+ targetPaths.push(workspacePath);
2988
+ }
2989
+ }
2990
+ targetPaths.sort((pathA, pathB) => pathA.localeCompare(pathB));
2991
+ while (true) {
2992
+ const choices = [
2993
+ {
2994
+ title: 'GitHub',
2995
+ description: 'Repository synchronization recipes.',
2996
+ value: 'github',
2997
+ },
2998
+ {
2999
+ title: 'License',
3000
+ description: 'License-file recipes.',
3001
+ value: 'license',
3002
+ },
3003
+ {
3004
+ title: 'Miscellaneous',
3005
+ description: 'Project cleanup recipes.',
3006
+ value: 'miscellaneous',
3007
+ },
3008
+ {
3009
+ title: 'Nova Config',
3010
+ description: 'Nova configuration-file recipes.',
3011
+ value: 'nova-config',
3012
+ },
3013
+ {
3014
+ title: 'README',
3015
+ description: 'README generation recipes.',
3016
+ value: 'read-me',
3017
+ },
3018
+ ];
3019
+ for (const workspacePath of targetPaths) {
3020
+ choices.push({
3021
+ title: `Package JSON: ${workspacePath}`,
3022
+ description: 'Package metadata and normalization recipes.',
3023
+ value: `package-json:${workspacePath}`,
3024
+ });
3025
+ }
3026
+ choices.push({
3027
+ title: 'Back',
3028
+ description: 'Return to the category selection.',
3029
+ value: 'back',
3030
+ });
3031
+ const menuOutput = await Runner.promptWithCancel({
3032
+ type: 'select',
3033
+ name: 'target',
3034
+ message: 'Select a recipe category to manage.',
3035
+ choices,
3036
+ });
3037
+ if (menuOutput['cancelled'] === true || menuOutput['result'].target === 'back') {
3038
+ Reflect.set(recipes, 'package-json', packageJsonRecipes);
3039
+ Object.assign(config, { recipes });
3040
+ return 'back';
3041
+ }
3042
+ const target = menuOutput['result'].target;
3043
+ let entries = recipes['read-me'];
3044
+ let allowedRecipeNames = libItemRecipesByCategory['read-me'];
3045
+ let label = 'README';
3046
+ if (target.startsWith('package-json:') === true) {
3047
+ const workspacePath = target.slice('package-json:'.length);
3048
+ entries = packageJsonRecipes[workspacePath];
3049
+ allowedRecipeNames = libItemRecipesByCategory['package-json'];
3050
+ label = `Package JSON (${workspacePath})`;
3051
+ const workspaceEntries = await Runner.promptRecipeEntries(entries, allowedRecipeNames, label);
3052
+ if (workspaceEntries !== undefined) {
3053
+ Reflect.set(packageJsonRecipes, workspacePath, workspaceEntries);
3054
+ }
3055
+ continue;
3056
+ }
3057
+ if (target === 'miscellaneous') {
3058
+ const miscellaneousEntries = await Runner.promptMiscellaneousRecipes(recipes['miscellaneous']);
3059
+ if (miscellaneousEntries !== undefined) {
3060
+ Reflect.set(recipes, 'miscellaneous', miscellaneousEntries);
3061
+ }
3062
+ continue;
3063
+ }
3064
+ if (target === 'github') {
3065
+ entries = recipes['github'];
3066
+ allowedRecipeNames = libItemRecipesByCategory['github'];
3067
+ label = 'GitHub';
3068
+ }
3069
+ else if (target === 'license') {
3070
+ entries = recipes['license'];
3071
+ allowedRecipeNames = libItemRecipesByCategory['license'];
3072
+ label = 'License';
3073
+ }
3074
+ else if (target === 'nova-config') {
3075
+ entries = recipes['nova-config'];
3076
+ allowedRecipeNames = libItemRecipesByCategory['nova-config'];
3077
+ label = 'Nova Config';
3078
+ }
3079
+ const categoryEntries = await Runner.promptRecipeEntries(entries, allowedRecipeNames, label);
3080
+ if (categoryEntries !== undefined) {
3081
+ Reflect.set(recipes, target, categoryEntries);
3082
+ }
3083
+ }
1690
3084
  }
1691
3085
  static async promptUrls(config) {
1692
3086
  const existingUrls = config['urls'];
@@ -1905,7 +3299,40 @@ export class Runner {
1905
3299
  for (const configWorkflow of configWorkflows) {
1906
3300
  const clonedWorkflow = { ...configWorkflow };
1907
3301
  if (Array.isArray(configWorkflow['triggers']) === true) {
1908
- clonedWorkflow.triggers = [...configWorkflow['triggers']];
3302
+ clonedWorkflow.triggers = configWorkflow['triggers'].map((trigger) => {
3303
+ if (typeof trigger === 'string') {
3304
+ return trigger;
3305
+ }
3306
+ const clonedTrigger = { ...trigger };
3307
+ if (trigger['branches'] !== undefined) {
3308
+ clonedTrigger.branches = [...trigger['branches']];
3309
+ }
3310
+ if (trigger['paths'] !== undefined) {
3311
+ clonedTrigger.paths = [...trigger['paths']];
3312
+ }
3313
+ if (trigger['tags'] !== undefined) {
3314
+ clonedTrigger.tags = [...trigger['tags']];
3315
+ }
3316
+ if (trigger['workflows'] !== undefined) {
3317
+ clonedTrigger.workflows = [...trigger['workflows']];
3318
+ }
3319
+ return clonedTrigger;
3320
+ });
3321
+ }
3322
+ if (configWorkflow['build'] !== undefined) {
3323
+ clonedWorkflow.build = [...configWorkflow['build']];
3324
+ }
3325
+ if (configWorkflow['deploy'] !== undefined) {
3326
+ clonedWorkflow.deploy = configWorkflow['deploy'].map((target) => {
3327
+ const clonedTarget = { ...target };
3328
+ if (target['after'] !== undefined) {
3329
+ clonedTarget.after = [...target['after']];
3330
+ }
3331
+ if (target['with'] !== undefined) {
3332
+ clonedTarget.with = { ...target['with'] };
3333
+ }
3334
+ return clonedTarget;
3335
+ });
1909
3336
  }
1910
3337
  if (configWorkflow['with'] !== undefined) {
1911
3338
  clonedWorkflow.with = { ...configWorkflow['with'] };
@@ -1921,7 +3348,46 @@ export class Runner {
1921
3348
  const normalizedWorkflows = workflows.map((workflow) => {
1922
3349
  const normalizedWorkflow = { ...workflow };
1923
3350
  if (Array.isArray(workflow['triggers']) === true && workflow['triggers'].length > 0) {
1924
- normalizedWorkflow.triggers = [...workflow['triggers']];
3351
+ normalizedWorkflow.triggers = workflow['triggers'].map((trigger) => {
3352
+ if (typeof trigger === 'string') {
3353
+ return trigger;
3354
+ }
3355
+ const clonedTrigger = { ...trigger };
3356
+ if (trigger['branches'] !== undefined) {
3357
+ clonedTrigger.branches = [...trigger['branches']];
3358
+ }
3359
+ if (trigger['paths'] !== undefined) {
3360
+ clonedTrigger.paths = [...trigger['paths']];
3361
+ }
3362
+ if (trigger['tags'] !== undefined) {
3363
+ clonedTrigger.tags = [...trigger['tags']];
3364
+ }
3365
+ if (trigger['workflows'] !== undefined) {
3366
+ clonedTrigger.workflows = [...trigger['workflows']];
3367
+ }
3368
+ return clonedTrigger;
3369
+ });
3370
+ }
3371
+ if (workflow['build'] !== undefined && workflow['build'].length > 0) {
3372
+ normalizedWorkflow.build = [...workflow['build']];
3373
+ }
3374
+ else {
3375
+ Reflect.deleteProperty(normalizedWorkflow, 'build');
3376
+ }
3377
+ if (workflow['deploy'] !== undefined && workflow['deploy'].length > 0) {
3378
+ normalizedWorkflow.deploy = workflow['deploy'].map((target) => {
3379
+ const clonedTarget = { ...target };
3380
+ if (target['after'] !== undefined) {
3381
+ clonedTarget.after = [...target['after']];
3382
+ }
3383
+ if (target['with'] !== undefined) {
3384
+ clonedTarget.with = { ...target['with'] };
3385
+ }
3386
+ return clonedTarget;
3387
+ });
3388
+ }
3389
+ else {
3390
+ Reflect.deleteProperty(normalizedWorkflow, 'deploy');
1925
3391
  }
1926
3392
  if (workflow['with'] !== undefined && Object.keys(workflow['with']).length > 0) {
1927
3393
  normalizedWorkflow.with = { ...workflow['with'] };
@@ -2087,18 +3553,9 @@ export class Runner {
2087
3553
  static async promptWorkflowsForm(workflow, mode, workflows, config) {
2088
3554
  const existingTemplate = (workflow !== undefined && typeof workflow['template'] === 'string') ? workflow['template'] : '';
2089
3555
  const existingSuffix = (workflow !== undefined && typeof workflow['name'] === 'string') ? workflow['name'] : '';
3556
+ const existingTimeoutMinutes = (workflow !== undefined && typeof workflow['timeoutMinutes'] === 'number') ? workflow['timeoutMinutes'] : undefined;
2090
3557
  const existingTriggers = (workflow !== undefined && Array.isArray(workflow['triggers']) === true) ? workflow['triggers'] : [];
2091
3558
  const existingTriggerNames = existingTriggers.map((trigger) => (typeof trigger === 'string') ? trigger : trigger['name']);
2092
- const existingUpstreamWorkflows = [];
2093
- for (const trigger of existingTriggers) {
2094
- if (typeof trigger !== 'string' && Array.isArray(trigger['workflows']) === true) {
2095
- for (const upstream of trigger['workflows']) {
2096
- if (existingUpstreamWorkflows.includes(upstream) === false) {
2097
- existingUpstreamWorkflows.push(upstream);
2098
- }
2099
- }
2100
- }
2101
- }
2102
3559
  const existingTargets = (workflow !== undefined && Array.isArray(workflow['deploy']) === true) ? workflow['deploy'] : [];
2103
3560
  const existingScopes = (workflow !== undefined && Array.isArray(workflow['build']) === true) ? workflow['build'] : [];
2104
3561
  const templateChoices = libWorkflowTemplatesMetadata.map((entry) => ({
@@ -2106,6 +3563,13 @@ export class Runner {
2106
3563
  description: entry['description'],
2107
3564
  value: entry['name'],
2108
3565
  }));
3566
+ if (existingTemplate !== '' && templateChoices.some((choice) => choice['value'] === existingTemplate) === false) {
3567
+ templateChoices.unshift({
3568
+ title: existingTemplate,
3569
+ description: 'Keep the existing custom workflow template.',
3570
+ value: existingTemplate,
3571
+ });
3572
+ }
2109
3573
  let templateInitialIndex = 0;
2110
3574
  if (existingTemplate !== '') {
2111
3575
  const foundIndex = templateChoices.findIndex((choice) => choice['value'] === existingTemplate);
@@ -2159,19 +3623,59 @@ export class Runner {
2159
3623
  }
2160
3624
  const suffixOutputResultValue = suffixOutput['result'];
2161
3625
  const selectedSuffix = (typeof suffixOutputResultValue.suffix === 'string') ? suffixOutputResultValue.suffix.trim() : '';
3626
+ const executionOutput = await Runner.promptWithCancel([
3627
+ {
3628
+ type: 'select',
3629
+ name: 'runsOn',
3630
+ message: 'GitHub-hosted runner',
3631
+ choices: [{
3632
+ title: 'ubuntu-latest',
3633
+ value: 'ubuntu-latest',
3634
+ }],
3635
+ initial: 0,
3636
+ },
3637
+ {
3638
+ type: 'text',
3639
+ name: 'timeoutMinutes',
3640
+ message: 'Job timeout in minutes (1-360; blank keeps template defaults)',
3641
+ initial: (existingTimeoutMinutes === undefined) ? '' : `${existingTimeoutMinutes}`,
3642
+ validate: Runner['isOptionalWorkflowTimeoutInput'],
3643
+ },
3644
+ ]);
3645
+ if (executionOutput['cancelled'] === true) {
3646
+ return {
3647
+ action: 'back',
3648
+ };
3649
+ }
3650
+ const executionOutputResultValue = executionOutput['result'];
3651
+ const selectedRunsOn = (executionOutputResultValue.runsOn === 'ubuntu-latest') ? executionOutputResultValue.runsOn : 'ubuntu-latest';
3652
+ const timeoutMinutesRaw = (typeof executionOutputResultValue.timeoutMinutes === 'string') ? executionOutputResultValue.timeoutMinutes.trim() : '';
3653
+ const selectedTimeoutMinutes = (timeoutMinutesRaw === '') ? undefined : Number.parseInt(timeoutMinutesRaw, 10);
2162
3654
  const triggersDir = join(resolveTemplatePath(import.meta.url, 'generators/github/workflows'), selectedTemplate, 'triggers');
2163
3655
  const triggersDirExists = await pathExists(triggersDir);
3656
+ const triggerChoices = [];
2164
3657
  let selectedTriggers = [];
2165
3658
  if (triggersDirExists === true) {
2166
3659
  const triggersFiles = (await fs.readdir(triggersDir)).filter((file) => file.endsWith('.yml'));
2167
- const triggerChoices = triggersFiles.map((file) => {
3660
+ triggerChoices.push(...triggersFiles.map((file) => {
2168
3661
  const triggerName = file.replace(LIB_REGEX_PATTERN_YML_EXTENSION, '');
2169
3662
  return {
2170
3663
  title: triggerName,
2171
3664
  value: triggerName,
2172
3665
  selected: existingTriggerNames.includes(triggerName),
2173
3666
  };
2174
- });
3667
+ }));
3668
+ }
3669
+ for (const existingTriggerName of existingTriggerNames) {
3670
+ if (triggerChoices.some((choice) => choice['value'] === existingTriggerName) === false) {
3671
+ triggerChoices.push({
3672
+ title: existingTriggerName,
3673
+ value: existingTriggerName,
3674
+ selected: true,
3675
+ });
3676
+ }
3677
+ }
3678
+ if (triggerChoices.length > 0) {
2175
3679
  const triggersOutput = await Runner.promptWithCancel({
2176
3680
  type: 'multiselect',
2177
3681
  name: 'triggers',
@@ -2198,41 +3702,101 @@ export class Runner {
2198
3702
  };
2199
3703
  }
2200
3704
  }
2201
- let selectedUpstreamWorkflows = undefined;
2202
- if (selectedTriggers.some((trigger) => trigger.startsWith('workflow-run')) === true) {
2203
- const upstreamWorkflowChoices = workflows
2204
- .filter((w) => w !== workflow
2205
- && typeof w['template'] === 'string'
2206
- && w['template'].trim() !== '')
2207
- .map((w) => {
2208
- const upstreamWorkflowKey = (typeof w['name'] === 'string' && w['name'].trim() !== '') ? `${w['template']}-${w['name']}` : w['template'];
3705
+ const advancedTriggerChoices = selectedTriggers.map((triggerName) => ({
3706
+ title: triggerName,
3707
+ value: triggerName,
3708
+ selected: existingTriggers.some((trigger) => typeof trigger !== 'string' && trigger['name'] === triggerName),
3709
+ }));
3710
+ let advancedTriggerNames = [];
3711
+ if (advancedTriggerChoices.length > 0) {
3712
+ const advancedTriggersOutput = await Runner.promptWithCancel({
3713
+ type: 'multiselect',
3714
+ name: 'advancedTriggers',
3715
+ message: 'Select triggers that need branch, path, tag, or workflow filters.',
3716
+ choices: advancedTriggerChoices,
3717
+ hint: '- Space to select. Return to submit',
3718
+ });
3719
+ if (advancedTriggersOutput['cancelled'] === true) {
2209
3720
  return {
2210
- title: upstreamWorkflowKey,
2211
- value: upstreamWorkflowKey,
2212
- selected: existingUpstreamWorkflows.includes(upstreamWorkflowKey),
3721
+ action: 'back',
3722
+ };
3723
+ }
3724
+ const advancedTriggersOutputResultValue = advancedTriggersOutput['result'];
3725
+ advancedTriggerNames = advancedTriggersOutputResultValue.advancedTriggers;
3726
+ }
3727
+ const resolvedTriggers = [];
3728
+ for (const selectedTrigger of selectedTriggers) {
3729
+ if (advancedTriggerNames.includes(selectedTrigger) === false) {
3730
+ resolvedTriggers.push(selectedTrigger);
3731
+ continue;
3732
+ }
3733
+ const existingTrigger = existingTriggers.find((trigger) => typeof trigger !== 'string' && trigger['name'] === selectedTrigger);
3734
+ const triggerFilterOutput = await Runner.promptWithCancel([
3735
+ {
3736
+ type: 'text',
3737
+ name: 'branches',
3738
+ message: `${selectedTrigger} branch filters as a JSON array (blank unsets)`,
3739
+ initial: (existingTrigger !== undefined && existingTrigger['branches'] !== undefined) ? JSON.stringify(existingTrigger['branches']) : '',
3740
+ validate: Runner['isStringArrayInput'],
3741
+ },
3742
+ {
3743
+ type: 'text',
3744
+ name: 'paths',
3745
+ message: `${selectedTrigger} path filters as a JSON array (blank unsets)`,
3746
+ initial: (existingTrigger !== undefined && existingTrigger['paths'] !== undefined) ? JSON.stringify(existingTrigger['paths']) : '',
3747
+ validate: Runner['isStringArrayInput'],
3748
+ },
3749
+ {
3750
+ type: 'text',
3751
+ name: 'tags',
3752
+ message: `${selectedTrigger} tag filters as a JSON array (blank unsets)`,
3753
+ initial: (existingTrigger !== undefined && existingTrigger['tags'] !== undefined) ? JSON.stringify(existingTrigger['tags']) : '',
3754
+ validate: Runner['isStringArrayInput'],
3755
+ },
3756
+ {
3757
+ type: 'text',
3758
+ name: 'workflows',
3759
+ message: `${selectedTrigger} upstream workflows as a JSON array (blank unsets)`,
3760
+ initial: (existingTrigger !== undefined && existingTrigger['workflows'] !== undefined) ? JSON.stringify(existingTrigger['workflows']) : '',
3761
+ validate: Runner['isStringArrayInput'],
3762
+ },
3763
+ ]);
3764
+ if (triggerFilterOutput['cancelled'] === true) {
3765
+ return {
3766
+ action: 'back',
2213
3767
  };
2214
- });
2215
- if (upstreamWorkflowChoices.length > 0) {
2216
- const upstreamWorkflowsOutput = await Runner.promptWithCancel({
2217
- type: 'multiselect',
2218
- name: 'upstreamWorkflows',
2219
- message: 'Select upstream workflows that can start this workflow.',
2220
- choices: upstreamWorkflowChoices,
2221
- });
2222
- if (upstreamWorkflowsOutput['cancelled'] === true) {
2223
- return {
2224
- action: 'back',
2225
- };
2226
- }
2227
- const upstreamWorkflowsOutputResultValue = upstreamWorkflowsOutput['result'];
2228
- selectedUpstreamWorkflows = (Array.isArray(upstreamWorkflowsOutputResultValue.upstreamWorkflows) === true && upstreamWorkflowsOutputResultValue.upstreamWorkflows.length > 0) ? upstreamWorkflowsOutputResultValue.upstreamWorkflows : undefined;
2229
3768
  }
3769
+ const triggerFilterOutputResult = triggerFilterOutput['result'];
3770
+ const branches = Runner.parseStringArrayInput(triggerFilterOutputResult.branches);
3771
+ const paths = Runner.parseStringArrayInput(triggerFilterOutputResult.paths);
3772
+ const tags = Runner.parseStringArrayInput(triggerFilterOutputResult.tags);
3773
+ const triggerWorkflows = Runner.parseStringArrayInput(triggerFilterOutputResult.workflows);
3774
+ const triggerObject = {
3775
+ name: selectedTrigger,
3776
+ ...((branches.length > 0) ? { branches } : {}),
3777
+ ...((paths.length > 0) ? { paths } : {}),
3778
+ ...((tags.length > 0) ? { tags } : {}),
3779
+ ...((triggerWorkflows.length > 0) ? { workflows: triggerWorkflows } : {}),
3780
+ };
3781
+ resolvedTriggers.push(triggerObject);
2230
3782
  }
2231
3783
  const matchedMetadata = libWorkflowTemplatesMetadata.find((entry) => entry['name'] === selectedTemplate);
2232
3784
  const workspaceKeys = Object.keys(config['workspaces'] ?? {});
2233
- const selectedTargets = [...existingTargets];
2234
- if (matchedMetadata !== undefined && matchedMetadata['supportsTargets'] === true) {
2235
- const availableTargetTypes = Object.keys(matchedMetadata['targets'] ?? {});
3785
+ const selectedTargets = existingTargets.map((target) => ({
3786
+ ...target,
3787
+ ...((target['after'] !== undefined) ? { after: [...target['after']] } : {}),
3788
+ ...((target['with'] !== undefined) ? { with: { ...target['with'] } } : {}),
3789
+ }));
3790
+ if ((matchedMetadata !== undefined
3791
+ && matchedMetadata['supportsTargets'] === true)
3792
+ || selectedTargets.length > 0) {
3793
+ const availableTargetTypes = (matchedMetadata !== undefined) ? Object.keys(matchedMetadata['targets'] ?? {}) : [];
3794
+ const existingTargetTypes = selectedTargets.map((target) => target['to']);
3795
+ for (const existingTargetType of existingTargetTypes) {
3796
+ if (availableTargetTypes.includes(existingTargetType) === false) {
3797
+ availableTargetTypes.push(existingTargetType);
3798
+ }
3799
+ }
2236
3800
  while (true) {
2237
3801
  const targetMenuChoices = [];
2238
3802
  for (let i = 0; i < selectedTargets.length; i += 1) {
@@ -2317,6 +3881,12 @@ export class Runner {
2317
3881
  title: workspaceKey,
2318
3882
  value: workspaceKey,
2319
3883
  }));
3884
+ if (targetToEdit !== undefined && targetWorkingDirChoices.some((choice) => choice['value'] === targetToEdit['path']) === false) {
3885
+ targetWorkingDirChoices.unshift({
3886
+ title: targetToEdit['path'],
3887
+ value: targetToEdit['path'],
3888
+ });
3889
+ }
2320
3890
  const targetWorkingDirOutput = await Runner.promptWithCancel({
2321
3891
  type: 'select',
2322
3892
  name: 'targetWorkingDir',
@@ -2370,6 +3940,17 @@ export class Runner {
2370
3940
  const targetNeedsOutputResultValue = targetNeedsOutput['result'];
2371
3941
  selectedTargetNeeds = (Array.isArray(targetNeedsOutputResultValue.targetNeeds) === true && targetNeedsOutputResultValue.targetNeeds.length > 0) ? targetNeedsOutputResultValue.targetNeeds : undefined;
2372
3942
  }
3943
+ const targetSettingsOutput = await Runner.promptWithCancel({
3944
+ type: 'text',
3945
+ name: 'targetSettings',
3946
+ message: 'Target settings as a JSON object (blank unsets)',
3947
+ initial: (targetToEdit !== undefined && targetToEdit['with'] !== undefined) ? JSON.stringify(targetToEdit['with']) : '',
3948
+ validate: Runner['isStringRecordInput'],
3949
+ });
3950
+ if (targetSettingsOutput['cancelled'] === true) {
3951
+ continue;
3952
+ }
3953
+ const targetSettings = Runner.parseStringRecordInput(targetSettingsOutput['result'].targetSettings);
2373
3954
  const newTarget = {
2374
3955
  to: selectedTargetType,
2375
3956
  path: selectedTargetWorkingDir,
@@ -2377,6 +3958,9 @@ export class Runner {
2377
3958
  if (selectedTargetNeeds !== undefined) {
2378
3959
  Reflect.set(newTarget, 'after', selectedTargetNeeds);
2379
3960
  }
3961
+ if (Object.keys(targetSettings).length > 0) {
3962
+ newTarget.with = targetSettings;
3963
+ }
2380
3964
  if (targetEditIndex >= 0) {
2381
3965
  Reflect.set(selectedTargets, targetEditIndex, newTarget);
2382
3966
  }
@@ -2387,10 +3971,16 @@ export class Runner {
2387
3971
  }
2388
3972
  }
2389
3973
  }
2390
- let selectedScopes = [];
3974
+ let selectedScopes = [...existingScopes];
2391
3975
  if (matchedMetadata !== undefined && matchedMetadata['supportsScopes'] === true) {
2392
3976
  const lockedPaths = new Set(selectedTargets.map((selectedTarget) => selectedTarget['path']));
2393
- const extraWorkspaceKeys = workspaceKeys.filter((workspaceKey) => lockedPaths.has(workspaceKey) === false);
3977
+ const scopeCandidates = [...workspaceKeys];
3978
+ for (const existingScope of existingScopes) {
3979
+ if (scopeCandidates.includes(existingScope) === false) {
3980
+ scopeCandidates.push(existingScope);
3981
+ }
3982
+ }
3983
+ const extraWorkspaceKeys = scopeCandidates.filter((workspaceKey) => lockedPaths.has(workspaceKey) === false);
2394
3984
  selectedScopes = [...lockedPaths];
2395
3985
  if (extraWorkspaceKeys.length > 0) {
2396
3986
  const scopeChoices = extraWorkspaceKeys.map((workspaceKey) => ({
@@ -2418,7 +4008,7 @@ export class Runner {
2418
4008
  }
2419
4009
  }
2420
4010
  }
2421
- const settings = {};
4011
+ const settings = (workflow !== undefined && workflow['with'] !== undefined) ? { ...workflow['with'] } : {};
2422
4012
  if (matchedMetadata !== undefined) {
2423
4013
  const mergedVariables = { ...matchedMetadata['variables'] };
2424
4014
  const variableNameToTargetWorkingDir = {};
@@ -2502,22 +4092,37 @@ export class Runner {
2502
4092
  if (settingValue !== '' && isDefaultRootWorkingDir === false) {
2503
4093
  Reflect.set(settings, variableName, settingValue);
2504
4094
  }
4095
+ else {
4096
+ Reflect.deleteProperty(settings, variableName);
4097
+ }
2505
4098
  }
2506
4099
  }
2507
- const resolvedTriggers = selectedTriggers.map((trigger) => {
2508
- if (trigger.startsWith('workflow-run') === true && selectedUpstreamWorkflows !== undefined) {
2509
- return {
2510
- name: trigger,
2511
- workflows: selectedUpstreamWorkflows,
2512
- };
2513
- }
2514
- return trigger;
4100
+ const reviewedSettingsOutput = await Runner.promptWithCancel({
4101
+ type: 'text',
4102
+ name: 'reviewedSettings',
4103
+ message: 'Review all workflow settings as a JSON object (blank unsets)',
4104
+ initial: (Object.keys(settings).length > 0) ? JSON.stringify(settings) : '',
4105
+ validate: Runner['isStringRecordInput'],
2515
4106
  });
4107
+ if (reviewedSettingsOutput['cancelled'] === true) {
4108
+ return {
4109
+ action: 'back',
4110
+ };
4111
+ }
4112
+ const reviewedSettings = Runner.parseStringRecordInput(reviewedSettingsOutput['result'].reviewedSettings);
4113
+ for (const settingName of Object.keys(settings)) {
4114
+ Reflect.deleteProperty(settings, settingName);
4115
+ }
4116
+ Object.assign(settings, reviewedSettings);
2516
4117
  const resolvedWorkflow = {
2517
4118
  template: selectedTemplate,
2518
4119
  name: selectedSuffix,
2519
4120
  triggers: resolvedTriggers,
4121
+ runsOn: selectedRunsOn,
2520
4122
  };
4123
+ if (selectedTimeoutMinutes !== undefined) {
4124
+ Reflect.set(resolvedWorkflow, 'timeoutMinutes', selectedTimeoutMinutes);
4125
+ }
2521
4126
  if (selectedScopes.length > 0) {
2522
4127
  Reflect.set(resolvedWorkflow, 'build', selectedScopes);
2523
4128
  }
@@ -2550,24 +4155,23 @@ export class Runner {
2550
4155
  const confirmOutputResult = confirmOutput['result'];
2551
4156
  return confirmOutputResult.confirm;
2552
4157
  }
2553
- static async promptGitignore(config) {
2554
- const existing = config['gitignore'];
2555
- const excludes = (existing !== undefined && Array.isArray(existing['projectExcludes']) === true) ? [...existing['projectExcludes']] : [];
2556
- if (excludes.length === 0) {
4158
+ static async promptGitignore(config, targetPath) {
4159
+ const existingIgnoreFiles = config['ignoreFiles'] ?? {};
4160
+ const existing = existingIgnoreFiles[targetPath];
4161
+ const bundles = (existing === undefined) ? getSupportedIgnoreFileBundles(targetPath) : existing['bundles'];
4162
+ const excludes = (existing === undefined || existing['patterns'] === undefined) ? [] : [...existing['patterns']];
4163
+ if (existing === undefined && targetPath === './.gitignore') {
2557
4164
  const imported = await Runner.importGitignoreExcludes();
2558
4165
  excludes.push(...imported);
2559
4166
  }
2560
4167
  const sync = () => {
2561
- if (excludes.length > 0) {
2562
- Object.assign(config, {
2563
- gitignore: {
2564
- projectExcludes: [...excludes],
2565
- },
2566
- });
2567
- }
2568
- else {
2569
- Reflect.deleteProperty(config, 'gitignore');
2570
- }
4168
+ Reflect.set(existingIgnoreFiles, targetPath, {
4169
+ bundles: [...bundles],
4170
+ patterns: [...excludes],
4171
+ });
4172
+ Object.assign(config, {
4173
+ ignoreFiles: existingIgnoreFiles,
4174
+ });
2571
4175
  return;
2572
4176
  };
2573
4177
  while (true) {
@@ -2596,7 +4200,7 @@ export class Runner {
2596
4200
  }
2597
4201
  choices.push({
2598
4202
  title: 'Add a pattern',
2599
- description: 'Add a new ".gitignore" exclude.',
4203
+ description: `Add a new pattern to "${targetPath}".`,
2600
4204
  value: {
2601
4205
  kind: 'add',
2602
4206
  },
@@ -2716,6 +4320,133 @@ export class Runner {
2716
4320
  }
2717
4321
  }
2718
4322
  }
4323
+ static async promptIgnoreFileBundles(config, targetPath) {
4324
+ const ignoreFiles = config['ignoreFiles'] ?? {};
4325
+ const existing = ignoreFiles[targetPath];
4326
+ const supportedBundles = getSupportedIgnoreFileBundles(targetPath);
4327
+ const output = await Runner.promptWithCancel({
4328
+ type: 'multiselect',
4329
+ name: 'bundles',
4330
+ message: `Nova bundles for "${targetPath}" (space to select)`,
4331
+ choices: supportedBundles.map((bundle) => ({
4332
+ title: bundle,
4333
+ value: bundle,
4334
+ selected: (existing === undefined) ? true : existing['bundles'].includes(bundle),
4335
+ })),
4336
+ hint: '- Space to select. Return to submit',
4337
+ });
4338
+ if (output['cancelled'] === true) {
4339
+ return false;
4340
+ }
4341
+ const selectedBundles = output['result'].bundles;
4342
+ Reflect.set(ignoreFiles, targetPath, {
4343
+ bundles: selectedBundles,
4344
+ ...((existing !== undefined && existing['patterns'] !== undefined) ? { patterns: [...existing['patterns']] } : {}),
4345
+ });
4346
+ Object.assign(config, { ignoreFiles });
4347
+ return true;
4348
+ }
4349
+ static async promptIgnoreFiles(config) {
4350
+ const ignoreFiles = config['ignoreFiles'] ?? {};
4351
+ Object.assign(config, { ignoreFiles });
4352
+ while (true) {
4353
+ const paths = Object.keys(ignoreFiles).sort((pathA, pathB) => pathA.localeCompare(pathB));
4354
+ const choices = [];
4355
+ for (const path of paths) {
4356
+ const entry = ignoreFiles[path];
4357
+ if (entry === undefined) {
4358
+ continue;
4359
+ }
4360
+ const patternCount = (entry['patterns'] !== undefined) ? entry['patterns'].length : 0;
4361
+ choices.push({
4362
+ title: `${chalk.cyan.bold('[BUNDLES]')} ${path}`,
4363
+ description: entry['bundles'].join(', ') || 'No Nova bundles selected.',
4364
+ value: `bundles:${path}`,
4365
+ });
4366
+ choices.push({
4367
+ title: `${chalk.yellow.bold('[PATTERNS]')} ${path}`,
4368
+ description: `${patternCount} project pattern(s).`,
4369
+ value: `patterns:${path}`,
4370
+ });
4371
+ choices.push({
4372
+ title: `${chalk.red.bold('[REMOVE]')} ${path}`,
4373
+ description: 'Stop generating this physical ignore file.',
4374
+ value: `remove:${path}`,
4375
+ });
4376
+ }
4377
+ choices.push({
4378
+ title: 'Add an ignore file',
4379
+ description: 'Add a project-relative .gitignore, .dockerignore, or .assetsignore path.',
4380
+ value: 'add',
4381
+ });
4382
+ choices.push({
4383
+ title: 'Back',
4384
+ description: 'Return to the category selection.',
4385
+ value: 'back',
4386
+ });
4387
+ const menuOutput = await Runner.promptWithCancel({
4388
+ type: 'select',
4389
+ name: 'action',
4390
+ message: (paths.length > 0) ? 'Select an ignore file to manage.' : 'No ignore files configured. Choose an option.',
4391
+ choices,
4392
+ });
4393
+ if (menuOutput['cancelled'] === true || menuOutput['result'].action === 'back') {
4394
+ if (Object.keys(ignoreFiles).length === 0) {
4395
+ Reflect.deleteProperty(config, 'ignoreFiles');
4396
+ }
4397
+ return 'back';
4398
+ }
4399
+ const action = menuOutput['result'].action;
4400
+ if (action === 'add') {
4401
+ const pathOutput = await Runner.promptWithCancel({
4402
+ type: 'text',
4403
+ name: 'path',
4404
+ message: 'Project-relative ignore-file path',
4405
+ initial: './.gitignore',
4406
+ validate: Runner['isIgnoreFilePathInput'],
4407
+ });
4408
+ if (pathOutput['cancelled'] === true) {
4409
+ continue;
4410
+ }
4411
+ const addedTargetPath = pathOutput['result'].path.trim();
4412
+ if (ignoreFiles[addedTargetPath] !== undefined) {
4413
+ Logger.customize({
4414
+ name: 'Runner.promptIgnoreFiles',
4415
+ purpose: 'duplicate',
4416
+ padTop: 1,
4417
+ padBottom: 1,
4418
+ }).error(`Ignore file "${addedTargetPath}" is already configured.`);
4419
+ continue;
4420
+ }
4421
+ await Runner.promptIgnoreFileBundles(config, addedTargetPath);
4422
+ continue;
4423
+ }
4424
+ const separatorIndex = action.indexOf(':');
4425
+ const selectedTargetPath = (separatorIndex >= 0) ? action.slice(separatorIndex + 1) : '';
4426
+ if (selectedTargetPath === '' || ignoreFiles[selectedTargetPath] === undefined) {
4427
+ continue;
4428
+ }
4429
+ if (action.startsWith('bundles:') === true) {
4430
+ await Runner.promptIgnoreFileBundles(config, selectedTargetPath);
4431
+ continue;
4432
+ }
4433
+ if (action.startsWith('patterns:') === true) {
4434
+ await Runner.promptGitignore(config, selectedTargetPath);
4435
+ continue;
4436
+ }
4437
+ if (action.startsWith('remove:') === true) {
4438
+ const removeOutput = await Runner.promptWithCancel({
4439
+ type: 'confirm',
4440
+ name: 'confirm',
4441
+ message: `Remove ignore file "${selectedTargetPath}"?`,
4442
+ initial: false,
4443
+ });
4444
+ if (removeOutput['cancelled'] === false && removeOutput['result'].confirm === true) {
4445
+ Reflect.deleteProperty(ignoreFiles, selectedTargetPath);
4446
+ }
4447
+ }
4448
+ }
4449
+ }
2719
4450
  static async promptAgents(config) {
2720
4451
  const existing = (Array.isArray(config['agents']) === true) ? config['agents'] : [];
2721
4452
  const choices = libItemAllowedAgents.map((allowedAgent) => ({
@@ -2728,7 +4459,6 @@ export class Runner {
2728
4459
  name: 'agents',
2729
4460
  message: 'AI tools to generate conventions for',
2730
4461
  choices,
2731
- min: 1,
2732
4462
  });
2733
4463
  if (agentsOutput['cancelled'] === true) {
2734
4464
  return 'back';
@@ -2771,12 +4501,11 @@ export class Runner {
2771
4501
  const environment = (config['environment'] !== undefined) ? config['environment'] : {};
2772
4502
  const projectScope = environment['project'];
2773
4503
  const workspacesGroup = (environment['workspaces'] !== undefined) ? environment['workspaces'] : {};
4504
+ const workflowsGroup = (environment['workflows'] !== undefined) ? environment['workflows'] : {};
2774
4505
  const workspaces = (config['workspaces'] !== undefined) ? config['workspaces'] : {};
2775
4506
  const appPaths = [];
2776
4507
  for (const workspaceEntry of Object.entries(workspaces)) {
2777
- if ((workspaceEntry[1]['role'] === 'app'
2778
- || workspaceEntry[0] === './')
2779
- && appPaths.includes(workspaceEntry[0]) === false) {
4508
+ if (appPaths.includes(workspaceEntry[0]) === false) {
2780
4509
  appPaths.push(workspaceEntry[0]);
2781
4510
  }
2782
4511
  }
@@ -2810,6 +4539,30 @@ export class Runner {
2810
4539
  },
2811
4540
  });
2812
4541
  }
4542
+ const workflowNames = [];
4543
+ for (const workflow of config['workflows'] ?? []) {
4544
+ if (workflowNames.includes(workflow['name']) === false) {
4545
+ workflowNames.push(workflow['name']);
4546
+ }
4547
+ }
4548
+ for (const workflowName of Object.keys(workflowsGroup)) {
4549
+ if (workflowNames.includes(workflowName) === false) {
4550
+ workflowNames.push(workflowName);
4551
+ }
4552
+ }
4553
+ for (const workflowName of workflowNames) {
4554
+ const workflowScope = workflowsGroup[workflowName];
4555
+ const workflowSummary = (workflowScope !== undefined) ? workflowScope['prefix'] : 'Not configured yet.';
4556
+ choices.push({
4557
+ title: `Workflow: ${workflowName}`,
4558
+ description: workflowSummary,
4559
+ value: {
4560
+ kind: 'scope',
4561
+ scope: 'workflow',
4562
+ workflowName,
4563
+ },
4564
+ });
4565
+ }
2813
4566
  choices.push({
2814
4567
  title: 'View GitHub status',
2815
4568
  description: 'Read-only classification of every managed key on GitHub.',
@@ -2854,6 +4607,13 @@ export class Runner {
2854
4607
  continue;
2855
4608
  }
2856
4609
  if (menuOutputResultValue.action['kind'] === 'scope') {
4610
+ if (menuOutputResultValue.action['scope'] === 'workflow') {
4611
+ const workflowName = menuOutputResultValue.action['workflowName'] ?? '';
4612
+ if (workflowName !== '') {
4613
+ await Runner.promptEnvironmentWorkflow(config, workflowName);
4614
+ }
4615
+ continue;
4616
+ }
2857
4617
  await Runner.promptEnvironmentScope(config, {
2858
4618
  scope: menuOutputResultValue.action['scope'],
2859
4619
  appPath: menuOutputResultValue.action['appPath'],
@@ -2861,6 +4621,43 @@ export class Runner {
2861
4621
  }
2862
4622
  }
2863
4623
  }
4624
+ static async promptEnvironmentWorkflow(config, workflowName) {
4625
+ const environment = config['environment'] ?? {};
4626
+ const workflows = environment['workflows'] ?? {};
4627
+ const existing = workflows[workflowName];
4628
+ const prefixOutput = await Runner.promptWithCancel({
4629
+ type: 'text',
4630
+ name: 'prefix',
4631
+ message: `Prefix for workflow "${workflowName}" (blank removes it)`,
4632
+ initial: (existing !== undefined) ? existing['prefix'] : '',
4633
+ });
4634
+ if (prefixOutput['cancelled'] === true) {
4635
+ return 'back';
4636
+ }
4637
+ const prefix = prefixOutput['result'].prefix.trim();
4638
+ if (prefix === '') {
4639
+ Reflect.deleteProperty(workflows, workflowName);
4640
+ }
4641
+ else {
4642
+ Reflect.set(workflows, workflowName, { prefix });
4643
+ }
4644
+ const nextEnvironment = {
4645
+ ...environment,
4646
+ };
4647
+ if (Object.keys(workflows).length > 0) {
4648
+ nextEnvironment.workflows = workflows;
4649
+ }
4650
+ else {
4651
+ Reflect.deleteProperty(nextEnvironment, 'workflows');
4652
+ }
4653
+ if (Object.keys(nextEnvironment).length > 0) {
4654
+ Object.assign(config, { environment: nextEnvironment });
4655
+ }
4656
+ else {
4657
+ Reflect.deleteProperty(config, 'environment');
4658
+ }
4659
+ return 'back';
4660
+ }
2864
4661
  static async readLocalFilledKeys(config) {
2865
4662
  const environment = config['environment'] ?? {};
2866
4663
  const workspaces = environment['workspaces'] ?? {};
@@ -3339,54 +5136,152 @@ export class Runner {
3339
5136
  }).error((error instanceof Error) ? error.message : 'Unable to validate the configured version strategy.');
3340
5137
  return 'back';
3341
5138
  }
5139
+ let strategyInput = currentStrategy;
3342
5140
  if (lockedStrategy !== undefined) {
3343
5141
  Logger.customize({
3344
5142
  name: 'Runner.promptSettings',
3345
5143
  purpose: 'locked',
3346
5144
  }).info(`Version strategy cannot be changed — this repo has existing "${lockedStrategy}" release history.`);
5145
+ }
5146
+ else {
5147
+ const strategyChoices = [
5148
+ {
5149
+ title: 'SemVer',
5150
+ description: 'Semantic versioning (major.minor.patch).',
5151
+ value: 'semver',
5152
+ },
5153
+ {
5154
+ title: 'CalVer',
5155
+ description: 'Calendar versioning (YYYY.MM.MICRO).',
5156
+ value: 'calver',
5157
+ },
5158
+ ];
5159
+ const strategyInitial = strategyChoices.findIndex((choice) => choice['value'] === currentStrategy);
5160
+ const strategyOutput = await Runner.promptWithCancel({
5161
+ type: 'select',
5162
+ name: 'versionStrategy',
5163
+ message: 'Select version strategy.',
5164
+ choices: strategyChoices,
5165
+ initial: (strategyInitial !== -1) ? strategyInitial : 0,
5166
+ });
5167
+ if (strategyOutput['cancelled'] === true) {
5168
+ return 'back';
5169
+ }
5170
+ const strategyOutputResult = strategyOutput['result'];
5171
+ strategyInput = strategyOutputResult.versionStrategy;
5172
+ }
5173
+ const lockStepVersioningInitial = settings['lockStepVersioning'] ?? false;
5174
+ const lockStepVersioningOutput = await Runner.promptWithCancel({
5175
+ type: 'confirm',
5176
+ name: 'lockStepVersioning',
5177
+ message: 'Keep every non-freezable workspace on one shared version?',
5178
+ initial: lockStepVersioningInitial,
5179
+ });
5180
+ if (lockStepVersioningOutput['cancelled'] === true) {
3347
5181
  return 'back';
3348
5182
  }
3349
- const strategyChoices = [
3350
- {
3351
- title: 'SemVer',
3352
- description: 'Semantic versioning (major.minor.patch).',
3353
- value: 'semver',
5183
+ const lockStepVersioningOutputResult = lockStepVersioningOutput['result'];
5184
+ const runWorkspacesSettings = settings['runWorkspaces'];
5185
+ const existingConcurrency = (runWorkspacesSettings === undefined || runWorkspacesSettings['concurrency'] === undefined) ? {} : runWorkspacesSettings['concurrency'];
5186
+ const concurrencyInitial = JSON.stringify(existingConcurrency);
5187
+ const concurrencyOutput = await Runner.promptWithCancel({
5188
+ type: 'text',
5189
+ name: 'concurrency',
5190
+ message: 'Workspace concurrency limits by script as JSON (blank unsets):',
5191
+ initial: concurrencyInitial,
5192
+ validate: Runner['isPositiveIntegerRecordInput'],
5193
+ });
5194
+ if (concurrencyOutput['cancelled'] === true) {
5195
+ return 'back';
5196
+ }
5197
+ const concurrencyOutputResult = concurrencyOutput['result'];
5198
+ const concurrency = Runner.parsePositiveIntegerRecordInput(concurrencyOutputResult.concurrency);
5199
+ const existingCache = (runWorkspacesSettings === undefined || runWorkspacesSettings['cache'] === undefined) ? {} : runWorkspacesSettings['cache'];
5200
+ const cacheEnabledInitial = existingCache['enabled'] ?? true;
5201
+ const cacheEnabledOutput = await Runner.promptWithCancel({
5202
+ type: 'confirm',
5203
+ name: 'cacheEnabled',
5204
+ message: 'Use verified local caching for workspace tasks?',
5205
+ initial: cacheEnabledInitial,
5206
+ });
5207
+ if (cacheEnabledOutput['cancelled'] === true) {
5208
+ return 'back';
5209
+ }
5210
+ const cacheEnabledOutputResult = cacheEnabledOutput['result'];
5211
+ const cacheDirectoryInitial = existingCache['directory'] ?? './node_modules/.cache/nova/run-workspaces';
5212
+ const cacheDirectoryOutput = await Runner.promptWithCancel({
5213
+ type: 'text',
5214
+ name: 'cacheDirectory',
5215
+ message: 'Project-relative workspace cache directory:',
5216
+ initial: cacheDirectoryInitial,
5217
+ validate: (value) => {
5218
+ if (typeof value === 'string' && value.trim().length > 0) {
5219
+ return true;
5220
+ }
5221
+ return 'Enter a project-relative cache directory.';
3354
5222
  },
3355
- {
3356
- title: 'CalVer',
3357
- description: 'Calendar versioning (YYYY.MM.MICRO).',
3358
- value: 'calver',
5223
+ });
5224
+ if (cacheDirectoryOutput['cancelled'] === true) {
5225
+ return 'back';
5226
+ }
5227
+ const cacheDirectoryOutputResult = cacheDirectoryOutput['result'];
5228
+ const cacheDirectory = cacheDirectoryOutputResult.cacheDirectory.trim();
5229
+ const cacheScriptsInitial = (existingCache['scripts'] ?? [
5230
+ 'build',
5231
+ 'check',
5232
+ ]).join(', ');
5233
+ const cacheScriptsOutput = await Runner.promptWithCancel({
5234
+ type: 'text',
5235
+ name: 'cacheScripts',
5236
+ message: 'Cacheable workspace scripts (comma-separated):',
5237
+ initial: cacheScriptsInitial,
5238
+ validate: (value) => {
5239
+ if (typeof value === 'string'
5240
+ && value.split(',').some((script) => script.trim().length > 0) === true) {
5241
+ return true;
5242
+ }
5243
+ return 'Enter at least one script name.';
3359
5244
  },
3360
- ];
3361
- const strategyInitial = strategyChoices.findIndex((choice) => choice['value'] === currentStrategy);
3362
- const strategyOutput = await Runner.promptWithCancel({
3363
- type: 'select',
3364
- name: 'versionStrategy',
3365
- message: 'Select version strategy.',
3366
- choices: strategyChoices,
3367
- initial: (strategyInitial !== -1) ? strategyInitial : 0,
3368
5245
  });
3369
- if (strategyOutput['cancelled'] === true) {
5246
+ if (cacheScriptsOutput['cancelled'] === true) {
3370
5247
  return 'back';
3371
5248
  }
3372
- const strategyOutputResult = strategyOutput['result'];
3373
- const strategyInput = strategyOutputResult.versionStrategy;
3374
- if (strategyInput !== undefined) {
3375
- const updatedSettings = {
3376
- ...settings,
3377
- versionStrategy: strategyInput,
3378
- };
3379
- Object.assign(config, {
3380
- settings: updatedSettings,
3381
- });
5249
+ const cacheScriptsOutputResult = cacheScriptsOutput['result'];
5250
+ const cacheScripts = [...new Set(cacheScriptsOutputResult.cacheScripts.split(',').map((script) => script.trim()).filter((script) => script.length > 0))].sort();
5251
+ const runWorkspaces = {
5252
+ ...settings['runWorkspaces'],
5253
+ cache: {
5254
+ ...existingCache,
5255
+ directory: cacheDirectory,
5256
+ enabled: cacheEnabledOutputResult.cacheEnabled,
5257
+ scripts: cacheScripts,
5258
+ },
5259
+ };
5260
+ if (Object.keys(concurrency).length > 0) {
5261
+ runWorkspaces.concurrency = concurrency;
5262
+ }
5263
+ else {
5264
+ Reflect.deleteProperty(runWorkspaces, 'concurrency');
3382
5265
  }
5266
+ const updatedSettings = {
5267
+ ...settings,
5268
+ lockStepVersioning: lockStepVersioningOutputResult.lockStepVersioning,
5269
+ runWorkspaces,
5270
+ versionStrategy: strategyInput,
5271
+ };
5272
+ Object.assign(config, {
5273
+ settings: updatedSettings,
5274
+ });
3383
5275
  return 'back';
3384
5276
  }
3385
5277
  static async promptWorkspaces(config) {
3386
5278
  const workspaces = (config['workspaces'] !== undefined) ? { ...(config['workspaces']) } : {};
3387
5279
  const recipes = (config['recipes'] !== undefined) ? { ...(config['recipes']) } : {};
3388
5280
  const packageJsonRecipes = (recipes['package-json'] !== undefined) ? { ...(recipes['package-json']) } : {};
3389
- const rawWorkspacePaths = await discoverPathsWithFile('package.json', 'forward');
5281
+ const scaffoldTemplateRoot = resolveTemplatePath(import.meta.url, 'scaffold');
5282
+ const rawWorkspacePaths = await discoverPathsWithFile('package.json', 'forward', {
5283
+ excludeRoots: [scaffoldTemplateRoot],
5284
+ });
3390
5285
  const workspacePaths = rawWorkspacePaths.map((rawWorkspacePath) => {
3391
5286
  const currentWorkingDirectory = process.cwd();
3392
5287
  const relativePath = relative(currentWorkingDirectory, rawWorkspacePath);