@cbnventures/nova 0.19.0 → 0.21.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 (536) hide show
  1. package/README.md +10 -0
  2. package/bin/nova.mjs +3 -3
  3. package/build/package.json +14 -10
  4. package/build/src/cli/generate/github/funding.js +2 -2
  5. package/build/src/cli/generate/github/funding.js.map +1 -1
  6. package/build/src/cli/generate/github/issue-template.d.ts.map +1 -1
  7. package/build/src/cli/generate/github/issue-template.js +6 -95
  8. package/build/src/cli/generate/github/issue-template.js.map +1 -1
  9. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +12 -0
  10. package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -0
  11. package/build/src/cli/generate/github/workflows-blueprint-validate.js +535 -0
  12. package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -0
  13. package/build/src/cli/generate/github/workflows-blueprint-variables.d.ts +9 -0
  14. package/build/src/cli/generate/github/workflows-blueprint-variables.d.ts.map +1 -0
  15. package/build/src/cli/generate/github/workflows-blueprint-variables.js +117 -0
  16. package/build/src/cli/generate/github/workflows-blueprint-variables.js.map +1 -0
  17. package/build/src/cli/generate/github/workflows-blueprint.d.ts +60 -0
  18. package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -0
  19. package/build/src/cli/generate/github/workflows-blueprint.js +2251 -0
  20. package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -0
  21. package/build/src/cli/generate/must-haves/agent-conventions.d.ts.map +1 -1
  22. package/build/src/cli/generate/must-haves/agent-conventions.js +14 -5
  23. package/build/src/cli/generate/must-haves/agent-conventions.js.map +1 -1
  24. package/build/src/cli/generate/must-haves/dotenv.d.ts +5 -7
  25. package/build/src/cli/generate/must-haves/dotenv.d.ts.map +1 -1
  26. package/build/src/cli/generate/must-haves/dotenv.js +146 -417
  27. package/build/src/cli/generate/must-haves/dotenv.js.map +1 -1
  28. package/build/src/cli/generate/must-haves/editorconfig.js +2 -2
  29. package/build/src/cli/generate/must-haves/editorconfig.js.map +1 -1
  30. package/build/src/cli/generate/must-haves/gitignore.d.ts +0 -8
  31. package/build/src/cli/generate/must-haves/gitignore.d.ts.map +1 -1
  32. package/build/src/cli/generate/must-haves/gitignore.js +9 -397
  33. package/build/src/cli/generate/must-haves/gitignore.js.map +1 -1
  34. package/build/src/cli/generate/must-haves/license.d.ts.map +1 -1
  35. package/build/src/cli/generate/must-haves/license.js +4 -4
  36. package/build/src/cli/generate/must-haves/license.js.map +1 -1
  37. package/build/src/cli/generate/must-haves/read-me.d.ts +6 -2
  38. package/build/src/cli/generate/must-haves/read-me.d.ts.map +1 -1
  39. package/build/src/cli/generate/must-haves/read-me.js +103 -63
  40. package/build/src/cli/generate/must-haves/read-me.js.map +1 -1
  41. package/build/src/cli/index.js +108 -2
  42. package/build/src/cli/index.js.map +1 -1
  43. package/build/src/cli/recipe/github/sync-features.d.ts.map +1 -1
  44. package/build/src/cli/recipe/github/sync-features.js +5 -3
  45. package/build/src/cli/recipe/github/sync-features.js.map +1 -1
  46. package/build/src/cli/recipe/github/sync-identity.d.ts.map +1 -1
  47. package/build/src/cli/recipe/github/sync-identity.js +6 -4
  48. package/build/src/cli/recipe/github/sync-identity.js.map +1 -1
  49. package/build/src/cli/recipe/github/sync-policies.d.ts.map +1 -1
  50. package/build/src/cli/recipe/github/sync-policies.js +13 -4
  51. package/build/src/cli/recipe/github/sync-policies.js.map +1 -1
  52. package/build/src/cli/recipe/index.d.ts.map +1 -1
  53. package/build/src/cli/recipe/index.js +32 -0
  54. package/build/src/cli/recipe/index.js.map +1 -1
  55. package/build/src/cli/recipe/license/update-copyright.d.ts +7 -0
  56. package/build/src/cli/recipe/license/update-copyright.d.ts.map +1 -0
  57. package/build/src/cli/recipe/license/update-copyright.js +191 -0
  58. package/build/src/cli/recipe/license/update-copyright.js.map +1 -0
  59. package/build/src/cli/recipe/package-json/cleanup.d.ts.map +1 -1
  60. package/build/src/cli/recipe/package-json/cleanup.js +14 -13
  61. package/build/src/cli/recipe/package-json/cleanup.js.map +1 -1
  62. package/build/src/cli/recipe/package-json/normalize-artifacts.d.ts.map +1 -1
  63. package/build/src/cli/recipe/package-json/normalize-artifacts.js +11 -6
  64. package/build/src/cli/recipe/package-json/normalize-artifacts.js.map +1 -1
  65. package/build/src/cli/recipe/package-json/normalize-bundler.d.ts.map +1 -1
  66. package/build/src/cli/recipe/package-json/normalize-bundler.js +11 -6
  67. package/build/src/cli/recipe/package-json/normalize-bundler.js.map +1 -1
  68. package/build/src/cli/recipe/package-json/normalize-dependencies.d.ts.map +1 -1
  69. package/build/src/cli/recipe/package-json/normalize-dependencies.js +18 -10
  70. package/build/src/cli/recipe/package-json/normalize-dependencies.js.map +1 -1
  71. package/build/src/cli/recipe/package-json/normalize-modules.d.ts.map +1 -1
  72. package/build/src/cli/recipe/package-json/normalize-modules.js +11 -6
  73. package/build/src/cli/recipe/package-json/normalize-modules.js.map +1 -1
  74. package/build/src/cli/recipe/package-json/normalize-tooling.d.ts.map +1 -1
  75. package/build/src/cli/recipe/package-json/normalize-tooling.js +12 -7
  76. package/build/src/cli/recipe/package-json/normalize-tooling.js.map +1 -1
  77. package/build/src/cli/recipe/package-json/sync-environment.d.ts.map +1 -1
  78. package/build/src/cli/recipe/package-json/sync-environment.js +46 -14
  79. package/build/src/cli/recipe/package-json/sync-environment.js.map +1 -1
  80. package/build/src/cli/recipe/package-json/sync-identity.d.ts.map +1 -1
  81. package/build/src/cli/recipe/package-json/sync-identity.js +29 -16
  82. package/build/src/cli/recipe/package-json/sync-identity.js.map +1 -1
  83. package/build/src/cli/recipe/package-json/sync-ownership.d.ts.map +1 -1
  84. package/build/src/cli/recipe/package-json/sync-ownership.js +18 -11
  85. package/build/src/cli/recipe/package-json/sync-ownership.js.map +1 -1
  86. package/build/src/cli/recipe/read-me/update-badges.d.ts +6 -0
  87. package/build/src/cli/recipe/read-me/update-badges.d.ts.map +1 -0
  88. package/build/src/cli/recipe/read-me/update-badges.js +115 -0
  89. package/build/src/cli/recipe/read-me/update-badges.js.map +1 -0
  90. package/build/src/cli/recipe/read-me/update-credits.d.ts +6 -0
  91. package/build/src/cli/recipe/read-me/update-credits.d.ts.map +1 -0
  92. package/build/src/cli/recipe/read-me/update-credits.js +115 -0
  93. package/build/src/cli/recipe/read-me/update-credits.js.map +1 -0
  94. package/build/src/cli/recipe/read-me/update-documentation.d.ts +6 -0
  95. package/build/src/cli/recipe/read-me/update-documentation.d.ts.map +1 -0
  96. package/build/src/cli/recipe/read-me/update-documentation.js +115 -0
  97. package/build/src/cli/recipe/read-me/update-documentation.js.map +1 -0
  98. package/build/src/cli/recipe/read-me/update-header.d.ts +6 -0
  99. package/build/src/cli/recipe/read-me/update-header.d.ts.map +1 -0
  100. package/build/src/cli/recipe/read-me/update-header.js +115 -0
  101. package/build/src/cli/recipe/read-me/update-header.js.map +1 -0
  102. package/build/src/cli/recipe/read-me/update-introduction.d.ts +6 -0
  103. package/build/src/cli/recipe/read-me/update-introduction.d.ts.map +1 -0
  104. package/build/src/cli/recipe/read-me/update-introduction.js +115 -0
  105. package/build/src/cli/recipe/read-me/update-introduction.js.map +1 -0
  106. package/build/src/cli/scaffold/starter/base.js +1 -1
  107. package/build/src/cli/scaffold/starter/base.js.map +1 -1
  108. package/build/src/cli/utility/changelog.d.ts +2 -0
  109. package/build/src/cli/utility/changelog.d.ts.map +1 -1
  110. package/build/src/cli/utility/changelog.js +159 -3
  111. package/build/src/cli/utility/changelog.js.map +1 -1
  112. package/build/src/cli/utility/initialize.d.ts +9 -0
  113. package/build/src/cli/utility/initialize.d.ts.map +1 -1
  114. package/build/src/cli/utility/initialize.js +978 -111
  115. package/build/src/cli/utility/initialize.js.map +1 -1
  116. package/build/src/cli/utility/run-scripts.d.ts.map +1 -1
  117. package/build/src/cli/utility/run-scripts.js +4 -4
  118. package/build/src/cli/utility/run-scripts.js.map +1 -1
  119. package/build/src/cli/utility/transpile.js +1 -1
  120. package/build/src/cli/utility/transpile.js.map +1 -1
  121. package/build/src/cli/utility/type-check.js +1 -1
  122. package/build/src/cli/utility/type-check.js.map +1 -1
  123. package/build/src/cli/utility/version.js +1 -1
  124. package/build/src/cli/utility/version.js.map +1 -1
  125. package/build/src/lib/dotenv.d.ts +3 -0
  126. package/build/src/lib/dotenv.d.ts.map +1 -0
  127. package/build/src/lib/dotenv.js +66 -0
  128. package/build/src/lib/dotenv.js.map +1 -0
  129. package/build/src/lib/env-github.d.ts +4 -0
  130. package/build/src/lib/env-github.d.ts.map +1 -0
  131. package/build/src/lib/env-github.js +57 -0
  132. package/build/src/lib/env-github.js.map +1 -0
  133. package/build/src/lib/env-managed-set.d.ts +3 -0
  134. package/build/src/lib/env-managed-set.d.ts.map +1 -0
  135. package/build/src/lib/env-managed-set.js +102 -0
  136. package/build/src/lib/env-managed-set.js.map +1 -0
  137. package/build/src/lib/env-namespace.d.ts +3 -0
  138. package/build/src/lib/env-namespace.d.ts.map +1 -0
  139. package/build/src/lib/env-namespace.js +11 -0
  140. package/build/src/lib/env-namespace.js.map +1 -0
  141. package/build/src/lib/env-reconcile.d.ts +3 -0
  142. package/build/src/lib/env-reconcile.d.ts.map +1 -0
  143. package/build/src/lib/env-reconcile.js +109 -0
  144. package/build/src/lib/env-reconcile.js.map +1 -0
  145. package/build/src/lib/env-status.d.ts +3 -0
  146. package/build/src/lib/env-status.d.ts.map +1 -0
  147. package/build/src/lib/env-status.js +113 -0
  148. package/build/src/lib/env-status.js.map +1 -0
  149. package/build/src/lib/file-discovery.d.ts +3 -0
  150. package/build/src/lib/file-discovery.d.ts.map +1 -0
  151. package/build/src/lib/file-discovery.js +32 -0
  152. package/build/src/lib/file-discovery.js.map +1 -0
  153. package/build/src/lib/item.d.ts +4 -1
  154. package/build/src/lib/item.d.ts.map +1 -1
  155. package/build/src/lib/item.js +35 -0
  156. package/build/src/lib/item.js.map +1 -1
  157. package/build/src/lib/markdown-slug.d.ts +4 -0
  158. package/build/src/lib/markdown-slug.d.ts.map +1 -0
  159. package/build/src/lib/markdown-slug.js +25 -0
  160. package/build/src/lib/markdown-slug.js.map +1 -0
  161. package/build/src/lib/nova-config.d.ts +14 -2
  162. package/build/src/lib/nova-config.d.ts.map +1 -1
  163. package/build/src/lib/nova-config.js +507 -78
  164. package/build/src/lib/nova-config.js.map +1 -1
  165. package/build/src/lib/read-me-regions.d.ts +4 -0
  166. package/build/src/lib/read-me-regions.d.ts.map +1 -0
  167. package/build/src/lib/read-me-regions.js +33 -0
  168. package/build/src/lib/read-me-regions.js.map +1 -0
  169. package/build/src/lib/regex.d.ts +73 -0
  170. package/build/src/lib/regex.d.ts.map +1 -1
  171. package/build/src/lib/regex.js +75 -2
  172. package/build/src/lib/regex.js.map +1 -1
  173. package/build/src/lib/scaffold.d.ts.map +1 -1
  174. package/build/src/lib/scaffold.js +33 -14
  175. package/build/src/lib/scaffold.js.map +1 -1
  176. package/build/src/lib/type-declaration-engine.d.ts +32 -0
  177. package/build/src/lib/type-declaration-engine.d.ts.map +1 -0
  178. package/build/src/lib/type-declaration-engine.js +796 -0
  179. package/build/src/lib/type-declaration-engine.js.map +1 -0
  180. package/build/src/lib/utility.d.ts +2 -1
  181. package/build/src/lib/utility.d.ts.map +1 -1
  182. package/build/src/lib/utility.js +47 -15
  183. package/build/src/lib/utility.js.map +1 -1
  184. package/build/src/lib/workflow-templates.d.ts.map +1 -1
  185. package/build/src/lib/workflow-templates.js +86 -60
  186. package/build/src/lib/workflow-templates.js.map +1 -1
  187. package/build/src/presets/eslint/dx-code-style.d.ts.map +1 -1
  188. package/build/src/presets/eslint/dx-code-style.js +6 -0
  189. package/build/src/presets/eslint/dx-code-style.js.map +1 -1
  190. package/build/src/presets/eslint/fw-astro.d.ts +4 -0
  191. package/build/src/presets/eslint/fw-astro.d.ts.map +1 -0
  192. package/build/src/presets/eslint/fw-astro.js +13 -0
  193. package/build/src/presets/eslint/fw-astro.js.map +1 -0
  194. package/build/src/presets/eslint/index.d.ts +1 -0
  195. package/build/src/presets/eslint/index.d.ts.map +1 -1
  196. package/build/src/presets/eslint/index.js +1 -0
  197. package/build/src/presets/eslint/index.js.map +1 -1
  198. package/build/src/presets/tsconfig/fw-astro.json +15 -0
  199. package/build/src/rules/eslint/conventions/no-implicit-boolean.d.ts.map +1 -1
  200. package/build/src/rules/eslint/conventions/no-implicit-boolean.js +3 -2
  201. package/build/src/rules/eslint/conventions/no-implicit-boolean.js.map +1 -1
  202. package/build/src/rules/eslint/conventions/require-hash-private.js +1 -1
  203. package/build/src/rules/eslint/conventions/require-hash-private.js.map +1 -1
  204. package/build/src/rules/eslint/conventions/require-kebab-case-filename.d.ts.map +1 -1
  205. package/build/src/rules/eslint/conventions/require-kebab-case-filename.js +4 -1
  206. package/build/src/rules/eslint/conventions/require-kebab-case-filename.js.map +1 -1
  207. package/build/src/rules/eslint/conventions/require-node-protocol.d.ts +11 -0
  208. package/build/src/rules/eslint/conventions/require-node-protocol.d.ts.map +1 -0
  209. package/build/src/rules/eslint/conventions/require-node-protocol.js +76 -0
  210. package/build/src/rules/eslint/conventions/require-node-protocol.js.map +1 -0
  211. package/build/src/rules/eslint/formatting/no-raw-text-in-code.d.ts.map +1 -1
  212. package/build/src/rules/eslint/formatting/no-raw-text-in-code.js +2 -1
  213. package/build/src/rules/eslint/formatting/no-raw-text-in-code.js.map +1 -1
  214. package/build/src/rules/eslint/formatting/require-padding-lines.d.ts.map +1 -1
  215. package/build/src/rules/eslint/formatting/require-padding-lines.js +7 -3
  216. package/build/src/rules/eslint/formatting/require-padding-lines.js.map +1 -1
  217. package/build/src/rules/eslint/formatting/require-ternary-parens.d.ts.map +1 -1
  218. package/build/src/rules/eslint/formatting/require-ternary-parens.js +7 -17
  219. package/build/src/rules/eslint/formatting/require-ternary-parens.js.map +1 -1
  220. package/build/src/rules/eslint/index.d.ts +4 -0
  221. package/build/src/rules/eslint/index.d.ts.map +1 -1
  222. package/build/src/rules/eslint/index.js +4 -0
  223. package/build/src/rules/eslint/index.js.map +1 -1
  224. package/build/src/rules/eslint/jsdoc/require-jsdoc-body.d.ts +3 -2
  225. package/build/src/rules/eslint/jsdoc/require-jsdoc-body.d.ts.map +1 -1
  226. package/build/src/rules/eslint/jsdoc/require-jsdoc-body.js +22 -0
  227. package/build/src/rules/eslint/jsdoc/require-jsdoc-body.js.map +1 -1
  228. package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts +2 -1
  229. package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts.map +1 -1
  230. package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.js +19 -4
  231. package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.js.map +1 -1
  232. package/build/src/rules/eslint/jsdoc/require-jsdoc-param-alignment.d.ts.map +1 -1
  233. package/build/src/rules/eslint/jsdoc/require-jsdoc-param-alignment.js +3 -2
  234. package/build/src/rules/eslint/jsdoc/require-jsdoc-param-alignment.js.map +1 -1
  235. package/build/src/rules/eslint/jsdoc/require-jsdoc-param-name.d.ts.map +1 -1
  236. package/build/src/rules/eslint/jsdoc/require-jsdoc-param-name.js +10 -6
  237. package/build/src/rules/eslint/jsdoc/require-jsdoc-param-name.js.map +1 -1
  238. package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.d.ts +12 -0
  239. package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.d.ts.map +1 -0
  240. package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.js +169 -0
  241. package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.js.map +1 -0
  242. package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.d.ts +11 -0
  243. package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.d.ts.map +1 -0
  244. package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.js +80 -0
  245. package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.js.map +1 -0
  246. package/build/src/rules/eslint/jsdoc/require-jsdoc-since.d.ts +1 -1
  247. package/build/src/rules/eslint/jsdoc/require-jsdoc-since.d.ts.map +1 -1
  248. package/build/src/rules/eslint/jsdoc/require-jsdoc-since.js +102 -6
  249. package/build/src/rules/eslint/jsdoc/require-jsdoc-since.js.map +1 -1
  250. package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.d.ts +15 -0
  251. package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.d.ts.map +1 -0
  252. package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.js +290 -0
  253. package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.js.map +1 -0
  254. package/build/src/rules/eslint/patterns/no-await-in-loop.js +1 -1
  255. package/build/src/rules/eslint/patterns/no-await-in-loop.js.map +1 -1
  256. package/build/src/rules/eslint/patterns/no-bracket-method-call.d.ts.map +1 -1
  257. package/build/src/rules/eslint/patterns/no-bracket-method-call.js +4 -0
  258. package/build/src/rules/eslint/patterns/no-bracket-method-call.js.map +1 -1
  259. package/build/src/rules/eslint/regex/no-regex-literals.d.ts +1 -0
  260. package/build/src/rules/eslint/regex/no-regex-literals.d.ts.map +1 -1
  261. package/build/src/rules/eslint/regex/no-regex-literals.js +39 -1
  262. package/build/src/rules/eslint/regex/no-regex-literals.js.map +1 -1
  263. package/build/src/rules/eslint/typescript/no-inline-type-annotation.d.ts.map +1 -1
  264. package/build/src/rules/eslint/typescript/no-inline-type-annotation.js +4 -1
  265. package/build/src/rules/eslint/typescript/no-inline-type-annotation.js.map +1 -1
  266. package/build/src/rules/eslint/typescript/require-bracket-property-access.d.ts.map +1 -1
  267. package/build/src/rules/eslint/typescript/require-bracket-property-access.js +8 -1
  268. package/build/src/rules/eslint/typescript/require-bracket-property-access.js.map +1 -1
  269. package/build/src/rules/eslint/typescript/require-type-naming.js +2 -2
  270. package/build/src/rules/eslint/typescript/require-type-naming.js.map +1 -1
  271. package/build/src/rules/vitest/active-vitest.d.ts +5 -0
  272. package/build/src/rules/vitest/active-vitest.d.ts.map +1 -0
  273. package/build/src/rules/vitest/active-vitest.js +19 -0
  274. package/build/src/rules/vitest/active-vitest.js.map +1 -0
  275. package/build/src/rules/vitest/dotenv/register.d.ts +3 -0
  276. package/build/src/rules/vitest/dotenv/register.d.ts.map +1 -0
  277. package/build/src/rules/vitest/dotenv/register.js +22 -0
  278. package/build/src/rules/vitest/dotenv/register.js.map +1 -0
  279. package/build/src/rules/vitest/dotenv/rules.d.ts +3 -0
  280. package/build/src/rules/vitest/dotenv/rules.d.ts.map +1 -0
  281. package/build/src/rules/vitest/dotenv/rules.js +32 -0
  282. package/build/src/rules/vitest/dotenv/rules.js.map +1 -0
  283. package/build/src/rules/vitest/enable.d.ts +3 -0
  284. package/build/src/rules/vitest/enable.d.ts.map +1 -0
  285. package/build/src/rules/vitest/enable.js +7 -0
  286. package/build/src/rules/vitest/enable.js.map +1 -0
  287. package/build/src/rules/vitest/frontmatter/register.d.ts +3 -0
  288. package/build/src/rules/vitest/frontmatter/register.d.ts.map +1 -0
  289. package/build/src/rules/vitest/frontmatter/register.js +52 -0
  290. package/build/src/rules/vitest/frontmatter/register.js.map +1 -0
  291. package/build/src/rules/vitest/frontmatter/rules.d.ts +15 -0
  292. package/build/src/rules/vitest/frontmatter/rules.d.ts.map +1 -0
  293. package/build/src/rules/vitest/frontmatter/rules.js +498 -0
  294. package/build/src/rules/vitest/frontmatter/rules.js.map +1 -0
  295. package/build/src/rules/vitest/index.d.ts +8 -0
  296. package/build/src/rules/vitest/index.d.ts.map +1 -0
  297. package/build/src/rules/vitest/index.js +7 -0
  298. package/build/src/rules/vitest/index.js.map +1 -0
  299. package/build/src/rules/vitest/link/register.d.ts +3 -0
  300. package/build/src/rules/vitest/link/register.d.ts.map +1 -0
  301. package/build/src/rules/vitest/link/register.js +44 -0
  302. package/build/src/rules/vitest/link/register.js.map +1 -0
  303. package/build/src/rules/vitest/link/rules.d.ts +12 -0
  304. package/build/src/rules/vitest/link/rules.d.ts.map +1 -0
  305. package/build/src/rules/vitest/link/rules.js +313 -0
  306. package/build/src/rules/vitest/link/rules.js.map +1 -0
  307. package/build/src/rules/vitest/markdown-table/register.d.ts +3 -0
  308. package/build/src/rules/vitest/markdown-table/register.d.ts.map +1 -0
  309. package/build/src/rules/vitest/markdown-table/register.js +26 -0
  310. package/build/src/rules/vitest/markdown-table/register.js.map +1 -0
  311. package/build/src/rules/vitest/markdown-table/rules.d.ts +3 -0
  312. package/build/src/rules/vitest/markdown-table/rules.d.ts.map +1 -0
  313. package/build/src/rules/vitest/markdown-table/rules.js +99 -0
  314. package/build/src/rules/vitest/markdown-table/rules.js.map +1 -0
  315. package/build/src/rules/vitest/terminology/register.d.ts +3 -0
  316. package/build/src/rules/vitest/terminology/register.d.ts.map +1 -0
  317. package/build/src/rules/vitest/terminology/register.js +39 -0
  318. package/build/src/rules/vitest/terminology/register.js.map +1 -0
  319. package/build/src/rules/vitest/terminology/rules.d.ts +10 -0
  320. package/build/src/rules/vitest/terminology/rules.d.ts.map +1 -0
  321. package/build/src/rules/vitest/terminology/rules.js +202 -0
  322. package/build/src/rules/vitest/terminology/rules.js.map +1 -0
  323. package/build/src/rules/vitest/type-declarations/register.d.ts +3 -0
  324. package/build/src/rules/vitest/type-declarations/register.d.ts.map +1 -0
  325. package/build/src/rules/vitest/type-declarations/register.js +33 -0
  326. package/build/src/rules/vitest/type-declarations/register.js.map +1 -0
  327. package/build/src/rules/vitest/type-declarations/rules.d.ts +13 -0
  328. package/build/src/rules/vitest/type-declarations/rules.d.ts.map +1 -0
  329. package/build/src/rules/vitest/type-declarations/rules.js +736 -0
  330. package/build/src/rules/vitest/type-declarations/rules.js.map +1 -0
  331. package/build/src/toolkit/index.d.ts +1 -0
  332. package/build/src/toolkit/index.d.ts.map +1 -1
  333. package/build/src/toolkit/index.js +1 -0
  334. package/build/src/toolkit/index.js.map +1 -1
  335. package/build/src/toolkit/logger.d.ts.map +1 -1
  336. package/build/src/toolkit/logger.js +3 -1
  337. package/build/src/toolkit/logger.js.map +1 -1
  338. package/build/src/toolkit/markdown-table.js +1 -1
  339. package/build/src/toolkit/markdown-table.js.map +1 -1
  340. package/build/src/toolkit/nova-identity.d.ts +19 -0
  341. package/build/src/toolkit/nova-identity.d.ts.map +1 -0
  342. package/build/src/toolkit/nova-identity.js +141 -0
  343. package/build/src/toolkit/nova-identity.js.map +1 -0
  344. package/build/src/types/cli/generate/github/funding.d.ts +4 -4
  345. package/build/src/types/cli/generate/github/issue-template.d.ts +15 -35
  346. package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +351 -0
  347. package/build/src/types/cli/generate/github/workflows-blueprint-variables.d.ts +131 -0
  348. package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +1180 -0
  349. package/build/src/types/cli/generate/must-haves/agent-conventions.d.ts +9 -2
  350. package/build/src/types/cli/generate/must-haves/dotenv.d.ts +101 -314
  351. package/build/src/types/cli/generate/must-haves/editorconfig.d.ts +2 -2
  352. package/build/src/types/cli/generate/must-haves/gitignore.d.ts +13 -343
  353. package/build/src/types/cli/generate/must-haves/license.d.ts +5 -5
  354. package/build/src/types/cli/generate/must-haves/read-me.d.ts +136 -88
  355. package/build/src/types/cli/index.d.ts +14 -0
  356. package/build/src/types/cli/recipe/github/handle-gh-failure.d.ts +2 -2
  357. package/build/src/types/cli/recipe/github/sync-features.d.ts +20 -13
  358. package/build/src/types/cli/recipe/github/sync-identity.d.ts +20 -13
  359. package/build/src/types/cli/recipe/github/sync-policies.d.ts +24 -15
  360. package/build/src/types/cli/recipe/index.d.ts +7 -3
  361. package/build/src/types/cli/recipe/license/update-copyright.d.ts +142 -0
  362. package/build/src/types/cli/recipe/package-json/cleanup.d.ts +26 -22
  363. package/build/src/types/cli/recipe/package-json/normalize-artifacts.d.ts +22 -16
  364. package/build/src/types/cli/recipe/package-json/normalize-bundler.d.ts +20 -14
  365. package/build/src/types/cli/recipe/package-json/normalize-dependencies.d.ts +31 -19
  366. package/build/src/types/cli/recipe/package-json/normalize-modules.d.ts +20 -14
  367. package/build/src/types/cli/recipe/package-json/normalize-tooling.d.ts +20 -14
  368. package/build/src/types/cli/recipe/package-json/sync-environment.d.ts +46 -22
  369. package/build/src/types/cli/recipe/package-json/sync-identity.d.ts +36 -19
  370. package/build/src/types/cli/recipe/package-json/sync-ownership.d.ts +33 -23
  371. package/build/src/types/cli/recipe/read-me/update-badges.d.ts +77 -0
  372. package/build/src/types/cli/recipe/read-me/update-credits.d.ts +77 -0
  373. package/build/src/types/cli/recipe/read-me/update-documentation.d.ts +77 -0
  374. package/build/src/types/cli/recipe/read-me/update-header.d.ts +77 -0
  375. package/build/src/types/cli/recipe/read-me/update-introduction.d.ts +77 -0
  376. package/build/src/types/cli/scaffold/starter/base.d.ts +2 -2
  377. package/build/src/types/cli/utility/changelog.d.ts +165 -73
  378. package/build/src/types/cli/utility/initialize.d.ts +1007 -350
  379. package/build/src/types/cli/utility/run-scripts.d.ts +1 -1
  380. package/build/src/types/cli/utility/transpile.d.ts +8 -3
  381. package/build/src/types/cli/utility/type-check.d.ts +9 -3
  382. package/build/src/types/cli/utility/version.d.ts +32 -32
  383. package/build/src/types/lib/constants.d.ts +1 -1
  384. package/build/src/types/lib/dotenv.d.ts +67 -0
  385. package/build/src/types/lib/env-github.d.ts +67 -0
  386. package/build/src/types/lib/env-managed-set.d.ts +90 -0
  387. package/build/src/types/lib/env-namespace.d.ts +22 -0
  388. package/build/src/types/lib/env-reconcile.d.ts +71 -0
  389. package/build/src/types/lib/env-status.d.ts +102 -0
  390. package/build/src/types/lib/file-discovery.d.ts +40 -0
  391. package/build/src/types/lib/item.d.ts +42 -0
  392. package/build/src/types/lib/markdown-slug.d.ts +25 -0
  393. package/build/src/types/lib/nova-config.d.ts +455 -68
  394. package/build/src/types/lib/read-me-regions.d.ts +51 -0
  395. package/build/src/types/lib/regex.d.ts +193 -18
  396. package/build/src/types/lib/scaffold.d.ts +43 -23
  397. package/build/src/types/lib/type-declaration-engine.d.ts +1052 -0
  398. package/build/src/types/lib/utility.d.ts +40 -6
  399. package/build/src/types/lib/workflow-templates.d.ts +11 -75
  400. package/build/src/types/presets/eslint/fw-astro.d.ts +8 -0
  401. package/build/src/types/rules/eslint/conventions/no-implicit-boolean.d.ts +7 -0
  402. package/build/src/types/rules/eslint/conventions/require-naming-convention.d.ts +8 -4
  403. package/build/src/types/rules/eslint/conventions/require-node-protocol.d.ts +56 -0
  404. package/build/src/types/rules/eslint/formatting/require-padding-lines.d.ts +2 -0
  405. package/build/src/types/rules/eslint/formatting/require-ternary-parens.d.ts +8 -3
  406. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-body.d.ts +16 -0
  407. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts +19 -15
  408. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-param-name.d.ts +3 -1
  409. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-presence.d.ts +125 -0
  410. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-returns.d.ts +48 -0
  411. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-since.d.ts +71 -1
  412. package/build/src/types/rules/eslint/jsdoc/require-jsdoc-tag-order.d.ts +204 -0
  413. package/build/src/types/rules/eslint/patterns/no-await-in-loop.d.ts +1 -1
  414. package/build/src/types/rules/eslint/patterns/no-bracket-method-call.d.ts +1 -1
  415. package/build/src/types/rules/eslint/regex/no-regex-literals.d.ts +44 -0
  416. package/build/src/types/rules/eslint/typescript/require-bracket-property-access.d.ts +19 -7
  417. package/build/src/types/rules/eslint/typescript/require-type-naming.d.ts +3 -3
  418. package/build/src/types/rules/vitest/active-vitest.d.ts +31 -0
  419. package/build/src/types/rules/vitest/dotenv/register.d.ts +31 -0
  420. package/build/src/types/rules/vitest/dotenv/rules.d.ts +29 -0
  421. package/build/src/types/rules/vitest/enable.d.ts +12 -0
  422. package/build/src/types/rules/vitest/frontmatter/register.d.ts +63 -0
  423. package/build/src/types/rules/vitest/frontmatter/rules.d.ts +430 -0
  424. package/build/src/types/rules/vitest/index.d.ts +419 -0
  425. package/build/src/types/rules/vitest/link/register.d.ts +79 -0
  426. package/build/src/types/rules/vitest/link/rules.d.ts +368 -0
  427. package/build/src/types/rules/vitest/markdown-table/register.d.ts +33 -0
  428. package/build/src/types/rules/vitest/markdown-table/rules.d.ts +55 -0
  429. package/build/src/types/rules/vitest/terminology/register.d.ts +48 -0
  430. package/build/src/types/rules/vitest/terminology/rules.d.ts +190 -0
  431. package/build/src/types/rules/vitest/type-declarations/register.d.ts +46 -0
  432. package/build/src/types/rules/vitest/type-declarations/rules.d.ts +894 -0
  433. package/build/src/types/shared.d.ts +727 -26
  434. package/build/src/types/tests/cli/generate/github/funding.test.d.ts +14 -10
  435. package/build/src/types/tests/cli/generate/github/issue-template.test.d.ts +38 -17
  436. package/build/src/types/tests/cli/generate/github/workflows-blueprint-generate.test.d.ts +199 -0
  437. package/build/src/types/tests/cli/generate/github/workflows-blueprint-parity.test.d.ts +75 -0
  438. package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +295 -0
  439. package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +901 -0
  440. package/build/src/types/tests/cli/generate/github/workflows-blueprint-variables.test.d.ts +144 -0
  441. package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +332 -0
  442. package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +83 -11
  443. package/build/src/types/tests/cli/generate/must-haves/dotenv.test.d.ts +142 -12
  444. package/build/src/types/tests/cli/generate/must-haves/editorconfig.test.d.ts +12 -8
  445. package/build/src/types/tests/cli/generate/must-haves/gitignore.test.d.ts +14 -19
  446. package/build/src/types/tests/cli/generate/must-haves/read-me.test.d.ts +33 -10
  447. package/build/src/types/tests/cli/recipe/github/handle-gh-failure.test.d.ts +28 -24
  448. package/build/src/types/tests/cli/recipe/github/sync-features.test.d.ts +115 -111
  449. package/build/src/types/tests/cli/recipe/github/sync-identity.test.d.ts +192 -142
  450. package/build/src/types/tests/cli/recipe/github/sync-policies.test.d.ts +199 -126
  451. package/build/src/types/tests/cli/recipe/license/update-copyright.test.d.ts +617 -0
  452. package/build/src/types/tests/cli/recipe/package-json/normalize-dependencies.test.d.ts +27 -0
  453. package/build/src/types/tests/cli/recipe/package-json/sync-environment.test.d.ts +21 -0
  454. package/build/src/types/tests/cli/recipe/package-json/sync-identity.test.d.ts +52 -0
  455. package/build/src/types/tests/cli/recipe/read-me/update-badges.test.d.ts +258 -0
  456. package/build/src/types/tests/cli/recipe/read-me/update-credits.test.d.ts +258 -0
  457. package/build/src/types/tests/cli/recipe/read-me/update-documentation.test.d.ts +258 -0
  458. package/build/src/types/tests/cli/recipe/read-me/update-header.test.d.ts +258 -0
  459. package/build/src/types/tests/cli/recipe/read-me/update-introduction.test.d.ts +258 -0
  460. package/build/src/types/tests/cli/scaffold/docs/docusaurus.test.d.ts +4 -0
  461. package/build/src/types/tests/cli/utility/changelog.test.d.ts +293 -0
  462. package/build/src/types/tests/cli/utility/initialize.test.d.ts +148 -1
  463. package/build/src/types/tests/lib/dotenv.test.d.ts +95 -0
  464. package/build/src/types/tests/lib/file-discovery.test.d.ts +37 -0
  465. package/build/src/types/tests/lib/item.test.d.ts +21 -0
  466. package/build/src/types/tests/lib/markdown-slug.test.d.ts +24 -0
  467. package/build/src/types/tests/lib/nova-config.test.d.ts +503 -83
  468. package/build/src/types/tests/lib/read-me-regions.test.d.ts +43 -0
  469. package/build/src/types/tests/lib/regex.test.d.ts +252 -0
  470. package/build/src/types/tests/lib/utility.test.d.ts +35 -0
  471. package/build/src/types/tests/lib/workflow-templates.test.d.ts +18 -2
  472. package/build/src/types/tests/rules/eslint/conventions/require-node-protocol.test.d.ts +8 -0
  473. package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-presence.test.d.ts +8 -0
  474. package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-returns.test.d.ts +8 -0
  475. package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-since.test.d.ts +18 -0
  476. package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-tag-order.test.d.ts +8 -0
  477. package/build/src/types/tests/rules/vitest/active-vitest.test.d.ts +56 -0
  478. package/build/src/types/tests/rules/vitest/dotenv.test.d.ts +19 -0
  479. package/build/src/types/tests/rules/vitest/enable.test.d.ts +27 -0
  480. package/build/src/types/tests/rules/vitest/frontmatter.test.d.ts +22 -0
  481. package/build/src/types/tests/rules/vitest/link.test.d.ts +74 -0
  482. package/build/src/types/tests/rules/vitest/markdown-table.test.d.ts +28 -0
  483. package/build/src/types/tests/rules/vitest/terminology.test.d.ts +43 -0
  484. package/build/src/types/tests/rules/vitest/type-declarations.test.d.ts +10 -0
  485. package/build/src/types/tests/scaffold-version-drift.test.d.ts +42 -0
  486. package/build/src/types/tests/since-version.test.d.ts +137 -0
  487. package/build/src/types/tests/toolkit/logger.test.d.ts +70 -5
  488. package/build/src/types/tests/toolkit/nova-identity.test.d.ts +118 -0
  489. package/build/src/types/tests/type-declarations.test.d.ts +40 -1813
  490. package/build/src/types/toolkit/logger.d.ts +4 -0
  491. package/build/src/types/toolkit/nova-identity.d.ts +313 -0
  492. package/build/templates/generators/github/workflows/check-sponsor-gated-issues/base.yml +1 -1
  493. package/build/templates/generators/github/workflows/publish/base.yml +3 -1
  494. package/build/templates/generators/github/workflows/publish/targets/cloudflare-pages-docusaurus.yml +1 -1
  495. package/build/templates/generators/github/workflows/publish/targets/cloudflare-workers.yml +36 -0
  496. package/build/templates/generators/github/workflows/publish/targets/docker-hub.yml +1 -1
  497. package/build/templates/generators/github/workflows/publish/targets/ghcr.yml +1 -1
  498. package/build/templates/generators/github/workflows/publish/targets/github-action.yml +1 -1
  499. package/build/templates/generators/github/workflows/publish/targets/github-packages.yml +1 -1
  500. package/build/templates/generators/github/workflows/publish/targets/github-pages-docusaurus.yml +4 -4
  501. package/build/templates/generators/github/workflows/publish/targets/npm.yml +1 -1
  502. package/build/templates/generators/github/workflows/publish/targets/vercel-nextjs.yml +1 -1
  503. package/build/templates/generators/must-haves/agent-conventions/AGENTS.md +1 -2
  504. package/build/templates/generators/must-haves/agent-conventions/CLAUDE.md +1 -2
  505. package/build/templates/generators/must-haves/agent-conventions/conventions/java.md +5 -5
  506. package/build/templates/generators/must-haves/agent-conventions/conventions/kotlin.md +4 -4
  507. package/build/templates/generators/must-haves/agent-conventions/conventions/php.md +2 -2
  508. package/build/templates/generators/must-haves/agent-conventions/conventions/typescript.md +6 -6
  509. package/build/templates/generators/must-haves/agent-conventions/conventions/universal.md +2 -0
  510. package/build/templates/generators/must-haves/dotenv/env +5 -2
  511. package/build/templates/generators/must-haves/dotenv/env.sample +6 -3
  512. package/build/templates/generators/must-haves/gitignore/gitignore +6 -0
  513. package/build/templates/scaffold/app/express/package.json +5 -5
  514. package/build/templates/scaffold/app/nextjs/package.json +7 -7
  515. package/build/templates/scaffold/app/vite/package.json +3 -3
  516. package/build/templates/scaffold/app/workers/package.json +3 -3
  517. package/build/templates/scaffold/docs/docusaurus/docs/intro.md +6 -0
  518. package/build/templates/scaffold/docs/docusaurus/docusaurus.config.ts +9 -3
  519. package/build/templates/scaffold/docs/docusaurus/package.json +14 -7
  520. package/build/templates/scaffold/docs/docusaurus/src/tests/frontmatter.test.ts +25 -0
  521. package/build/templates/scaffold/docs/docusaurus/src/tests/link.test.ts +16 -0
  522. package/build/templates/scaffold/docs/docusaurus/src/tests/markdown-table.test.ts +16 -0
  523. package/build/templates/scaffold/docs/docusaurus/src/tests/terminology.test.ts +16 -0
  524. package/build/templates/scaffold/docs/docusaurus/src/tests/type-declarations.test.ts +17 -0
  525. package/build/templates/scaffold/docs/docusaurus/vitest.config.ts +22 -0
  526. package/build/templates/scaffold/docs/docusaurus/vitest.setup.ts +26 -0
  527. package/package.json +14 -10
  528. package/build/src/cli/generate/github/workflows.d.ts +0 -17
  529. package/build/src/cli/generate/github/workflows.d.ts.map +0 -1
  530. package/build/src/cli/generate/github/workflows.js +0 -856
  531. package/build/src/cli/generate/github/workflows.js.map +0 -1
  532. package/build/src/types/cli/generate/github/workflows.d.ts +0 -596
  533. package/build/src/types/tests/cli/generate/github/workflows-helpers.test.d.ts +0 -239
  534. package/build/src/types/tests/cli/generate/github/workflows.test.d.ts +0 -587
  535. package/build/templates/generators/github/workflows/publish/targets/aws-amplify-nextjs.yml +0 -32
  536. package/build/templates/generators/must-haves/agent-conventions/cursorrules +0 -55
@@ -1,7 +1,8 @@
1
- import { promises as fs } from 'fs';
2
- import { join } from 'path';
1
+ import { promises as fs } from 'node:fs';
2
+ import { join } from 'node:path';
3
3
  import prompts from 'prompts';
4
- import { LIB_REGEX_PATTERN_DOUBLE_QUOTED_STRING_CAPTURE, LIB_REGEX_PATTERN_ENV_VAR_KEY, LIB_REGEX_PATTERN_ENV_VAR_KEY_SCREAMING_SNAKE, LIB_REGEX_PATTERN_LEADING_DOT, } from '../../../lib/regex.js';
4
+ import { Runner as LibNovaConfig } from '../../../lib/nova-config.js';
5
+ import { LIB_REGEX_LINEBREAK_CRLF_OR_LF, LIB_REGEX_PATTERN_ENV_VAR_KEY, LIB_REGEX_PATTERN_LEADING_DOT } from '../../../lib/regex.js';
5
6
  import { isProjectRoot, resolveTemplatePath, saveGeneratedFile, } from '../../../lib/utility.js';
6
7
  import { Logger } from '../../../toolkit/index.js';
7
8
  export class Runner {
@@ -14,6 +15,7 @@ export class Runner {
14
15
  }
15
16
  const isDryRun = options['dryRun'] === true;
16
17
  const isReplaceFile = options['replaceFile'] === true;
18
+ const isPrune = options['prune'] === true;
17
19
  if (isDryRun === true) {
18
20
  Logger.customize({
19
21
  name: 'Runner.run',
@@ -27,168 +29,79 @@ export class Runner {
27
29
  purpose: 'options',
28
30
  }).warn(`Replace file enabled. ${replaceFileNotice}`);
29
31
  }
30
- const templateDirectory = resolveTemplatePath(import.meta.url, 'generators/must-haves/dotenv');
31
- const envPath = join(currentDirectory, '.env');
32
- const envSamplePath = join(currentDirectory, '.env.sample');
33
- let envPathExists = false;
34
- let envSamplePathExists = false;
35
- try {
36
- await fs.access(envPath);
37
- envPathExists = true;
38
- }
39
- catch {
40
- }
41
- try {
42
- await fs.access(envSamplePath);
43
- envSamplePathExists = true;
44
- }
45
- catch {
32
+ const workingFile = await new LibNovaConfig().load();
33
+ const environment = workingFile['environment'] ?? {};
34
+ const apps = environment['apps'] ?? {};
35
+ let generatedCount = 0;
36
+ for (const appEntry of Object.entries(apps)) {
37
+ const appPath = appEntry[0];
38
+ const app = appEntry[1];
39
+ const variables = app['variables'] ?? [];
40
+ generatedCount += 1;
41
+ await Runner.generateForTarget({
42
+ targetDirectory: join(currentDirectory, appPath),
43
+ variables,
44
+ isDryRun,
45
+ isReplaceFile,
46
+ isPrune,
47
+ });
46
48
  }
47
- if (envPathExists === true || envSamplePathExists === true) {
48
- while (true) {
49
- const modeChoices = [
50
- {
51
- title: 'Manage existing variables',
52
- value: 'manage',
53
- },
54
- {
55
- title: 'Regenerate from template',
56
- value: 'regenerate',
57
- },
58
- ];
59
- const modeOutput = await Runner.promptWithCancel({
60
- type: 'select',
61
- name: 'mode',
62
- message: 'Existing .env file(s) found. What would you like to do?',
63
- choices: modeChoices,
64
- initial: 0,
65
- });
66
- if (modeOutput['cancelled'] === true) {
67
- return 'cancelled';
68
- }
69
- const modeOutputResult = modeOutput['result'];
70
- const selectedMode = modeOutputResult.mode;
71
- if (selectedMode === undefined) {
72
- return 'cancelled';
73
- }
74
- if (selectedMode === 'manage') {
75
- const manageResult = await Runner.promptManageMenu({
76
- templateDirectory,
77
- envPath,
78
- envSamplePath,
79
- isDryRun,
80
- isReplaceFile,
81
- });
82
- if (manageResult === 'exit') {
83
- return 'completed';
84
- }
85
- continue;
86
- }
87
- const loopResult = await Runner.promptRegenerate({
88
- templateDirectory,
89
- currentDirectory,
90
- isDryRun,
91
- isReplaceFile,
92
- });
93
- if (loopResult === 'cancelled') {
94
- continue;
95
- }
96
- return 'completed';
97
- }
49
+ if (generatedCount === 0) {
50
+ Logger.customize({
51
+ name: 'Runner.run',
52
+ purpose: 'environment',
53
+ }).warn('No apps declare environment variables. Nothing to generate.');
98
54
  }
99
- const result = await Runner.promptRegenerate({
100
- templateDirectory,
101
- currentDirectory,
102
- isDryRun,
103
- isReplaceFile,
104
- });
105
- return (result === 'cancelled') ? 'cancelled' : 'completed';
55
+ return 'completed';
106
56
  }
107
- static async promptRegenerate(options) {
108
- const templateDirectory = options['templateDirectory'];
109
- const currentDirectory = options['currentDirectory'];
57
+ static async generateForTarget(options) {
58
+ const targetDirectory = options['targetDirectory'];
59
+ const variables = options['variables'];
110
60
  const isDryRun = options['isDryRun'];
111
61
  const isReplaceFile = options['isReplaceFile'];
62
+ const isPrune = options['isPrune'];
63
+ const templateDirectory = resolveTemplatePath(import.meta.url, 'generators/must-haves/dotenv');
112
64
  const files = [
113
65
  '.env',
114
66
  '.env.sample',
115
67
  ];
116
- const envVars = [];
117
- let addMore = true;
118
- let cancelled = false;
119
- while (addMore === true) {
120
- const keyOutput = await Runner.promptWithCancel({
121
- type: 'text',
122
- name: 'key',
123
- message: 'Variable name (leave empty to finish):',
124
- validate: (value) => {
125
- if (typeof value !== 'string' || value.trim() === '') {
126
- return true;
127
- }
128
- const trimmedValue = value.trim();
129
- if (LIB_REGEX_PATTERN_ENV_VAR_KEY_SCREAMING_SNAKE.test(trimmedValue) !== true) {
130
- return 'Use SCREAMING_SNAKE_CASE (e.g. API_KEY).';
131
- }
132
- return true;
133
- },
134
- });
135
- if (keyOutput['cancelled'] === true) {
136
- cancelled = true;
137
- break;
138
- }
139
- const keyOutputResult = keyOutput['result'];
140
- if (keyOutputResult.key === undefined || keyOutputResult.key.trim() === '') {
141
- addMore = false;
142
- continue;
143
- }
144
- const defaultValueOutput = await Runner.promptWithCancel({
145
- type: 'text',
146
- name: 'defaultValue',
147
- message: 'Default value (leave empty for none):',
148
- initial: '',
149
- });
150
- if (defaultValueOutput['cancelled'] === true) {
151
- cancelled = true;
152
- break;
153
- }
154
- const defaultValueOutputResult = defaultValueOutput['result'];
155
- if (defaultValueOutputResult.defaultValue === undefined) {
156
- cancelled = true;
157
- break;
68
+ const baselineKeys = new Set();
69
+ try {
70
+ const baselineTemplate = await fs.readFile(join(templateDirectory, 'env'), 'utf-8');
71
+ const baselineTemplateLines = baselineTemplate.split(LIB_REGEX_LINEBREAK_CRLF_OR_LF);
72
+ for (const baselineTemplateLine of baselineTemplateLines) {
73
+ const baselineKeyMatch = baselineTemplateLine.match(LIB_REGEX_PATTERN_ENV_VAR_KEY);
74
+ if (baselineKeyMatch !== null) {
75
+ baselineKeys.add(baselineKeyMatch[1] ?? '');
76
+ }
158
77
  }
159
- envVars.push({
160
- key: keyOutputResult.key.trim(),
161
- defaultValue: defaultValueOutputResult.defaultValue.trim(),
162
- });
163
78
  }
164
- if (cancelled === true) {
165
- return 'cancelled';
79
+ catch {
166
80
  }
167
- let customSection = '';
168
- let customSectionSample = '';
169
- if (envVars.length > 0) {
170
- const envLines = [];
171
- for (const envVar of envVars) {
172
- envLines.push(`${envVar['key']}=""`);
173
- }
174
- customSection = envLines.join('\n');
175
- const sampleLines = [];
176
- for (const envVar of envVars) {
177
- sampleLines.push(`${envVar['key']}="${envVar['defaultValue']}"`);
81
+ const envLines = [];
82
+ const sampleLines = [];
83
+ for (const variable of variables) {
84
+ if (baselineKeys.has(variable['key']) === true) {
85
+ continue;
178
86
  }
179
- customSectionSample = sampleLines.join('\n');
87
+ envLines.push(`${variable['key']}=""`);
88
+ sampleLines.push(`${variable['key']}="${Runner.escapeSampleValue(variable['defaultValue'] ?? '')}"`);
180
89
  }
90
+ const customSection = envLines.join('\n');
91
+ const customSectionSample = sampleLines.join('\n');
92
+ const existingEnvPath = join(targetDirectory, '.env');
93
+ const existingEnv = await Runner.parseExistingEnv(existingEnvPath);
181
94
  for (const fileName of files) {
182
95
  const templateFileName = fileName.replace(LIB_REGEX_PATTERN_LEADING_DOT, '');
183
96
  const templatePath = join(templateDirectory, templateFileName);
184
- const targetPath = join(currentDirectory, fileName);
97
+ const targetPath = join(targetDirectory, fileName);
185
98
  let content = undefined;
186
99
  try {
187
100
  content = await fs.readFile(templatePath, 'utf-8');
188
101
  }
189
102
  catch {
190
103
  Logger.customize({
191
- name: 'Runner.promptRegenerate',
104
+ name: 'Runner.generateForTarget',
192
105
  purpose: 'read',
193
106
  }).error(`Failed to read template "${templatePath}". Skipping ...`);
194
107
  continue;
@@ -197,6 +110,35 @@ export class Runner {
197
110
  if (appendSection !== '') {
198
111
  content = `${content}${appendSection}\n`;
199
112
  }
113
+ if (fileName === '.env' && existingEnv.size > 0) {
114
+ const contentLines = content.split('\n');
115
+ const seenKeys = new Set();
116
+ const preservedLines = contentLines.map((contentLine) => {
117
+ const keyMatch = contentLine.match(LIB_REGEX_PATTERN_ENV_VAR_KEY);
118
+ if (keyMatch === null) {
119
+ return contentLine;
120
+ }
121
+ const contentLineKey = keyMatch[1] ?? '';
122
+ seenKeys.add(contentLineKey);
123
+ const originalLine = existingEnv.get(contentLineKey);
124
+ if (originalLine === undefined) {
125
+ return contentLine;
126
+ }
127
+ return originalLine;
128
+ });
129
+ content = preservedLines.join('\n');
130
+ const orphanKeys = [...existingEnv.keys()].filter((existingKey) => seenKeys.has(existingKey) === false);
131
+ if (orphanKeys.length > 0) {
132
+ let isPruneConfirmed = false;
133
+ if (isPrune === true && isDryRun === false) {
134
+ isPruneConfirmed = await Runner.confirmPrune(existingEnvPath, orphanKeys);
135
+ }
136
+ if (isPruneConfirmed === false) {
137
+ const orphanLines = orphanKeys.map((orphanKey) => existingEnv.get(orphanKey) ?? '');
138
+ content = `${content}${orphanLines.join('\n')}\n`;
139
+ }
140
+ }
141
+ }
200
142
  if (isDryRun === true) {
201
143
  continue;
202
144
  }
@@ -206,298 +148,85 @@ export class Runner {
206
148
  mode: (fileName === '.env') ? 'fillable' : 'strict',
207
149
  });
208
150
  }
209
- return 'completed';
210
- }
211
- static parseEnvFile(content) {
212
- const entries = [];
213
- for (const line of content.split('\n')) {
214
- const match = line.match(LIB_REGEX_PATTERN_ENV_VAR_KEY);
215
- if (match !== null && match[1] !== undefined) {
216
- const key = match[1];
217
- const rawValue = line.slice(line.indexOf('=') + 1);
218
- const value = rawValue.replace(LIB_REGEX_PATTERN_DOUBLE_QUOTED_STRING_CAPTURE, '$1');
219
- entries.push({
220
- key,
221
- value,
222
- });
223
- }
224
- }
225
- return entries;
226
- }
227
- static updateEnvLine(content, key, newValue) {
228
- const lines = content.split('\n');
229
- return lines.map((line) => {
230
- const match = line.match(LIB_REGEX_PATTERN_ENV_VAR_KEY);
231
- if (match !== null && match[1] === key) {
232
- return `${key}="${newValue}"`;
233
- }
234
- return line;
235
- }).join('\n');
236
- }
237
- static deleteEnvLine(content, key) {
238
- const lines = content.split('\n');
239
- return lines.filter((line) => {
240
- const match = line.match(LIB_REGEX_PATTERN_ENV_VAR_KEY);
241
- return !(match !== null && match[1] === key);
242
- }).join('\n');
151
+ return;
243
152
  }
244
- static addEnvLine(content, key, value) {
245
- const endsWithNewline = content.endsWith('\n');
246
- const newLine = `${key}="${value}"`;
247
- return (endsWithNewline === true) ? `${content}${newLine}\n` : [
248
- `${content}\n`,
249
- `${newLine}\n`,
250
- ].join('');
153
+ static async confirmPrune(filePath, keys) {
154
+ const response = await prompts({
155
+ type: 'confirm',
156
+ name: 'confirm',
157
+ message: `Remove undeclared keys from "${filePath}"? ${keys.join(', ')}`,
158
+ initial: false,
159
+ }, {
160
+ onCancel: () => false,
161
+ });
162
+ return response['confirm'] === true;
251
163
  }
252
- static async promptManageMenu(options) {
253
- const templateDirectory = options['templateDirectory'];
254
- const envPath = options['envPath'];
255
- const envSamplePath = options['envSamplePath'];
256
- const isDryRun = options['isDryRun'];
257
- const isReplaceFile = options['isReplaceFile'];
258
- const templateFilePath = join(templateDirectory, 'env');
259
- const templateContent = await fs.readFile(templateFilePath, 'utf-8');
260
- const reservedKeys = new Set(Runner.parseEnvFile(templateContent).map((entry) => entry['key']));
261
- let bufferEnv = '';
262
- let bufferEnvSample = '';
164
+ static async parseExistingEnv(filePath) {
165
+ const existing = new Map();
166
+ let raw = '';
263
167
  try {
264
- bufferEnv = await fs.readFile(envPath, 'utf-8');
168
+ raw = await fs.readFile(filePath, 'utf-8');
265
169
  }
266
170
  catch {
267
- try {
268
- bufferEnv = await fs.readFile(join(templateDirectory, 'env'), 'utf-8');
269
- }
270
- catch {
271
- }
272
- }
273
- try {
274
- bufferEnvSample = await fs.readFile(envSamplePath, 'utf-8');
275
- }
276
- catch {
277
- try {
278
- bufferEnvSample = await fs.readFile(join(templateDirectory, 'env.sample'), 'utf-8');
171
+ return existing;
172
+ }
173
+ const lines = raw.split(LIB_REGEX_LINEBREAK_CRLF_OR_LF);
174
+ let lineIndex = 0;
175
+ while (lineIndex < lines.length) {
176
+ const line = lines[lineIndex] ?? '';
177
+ const keyMatch = line.match(LIB_REGEX_PATTERN_ENV_VAR_KEY);
178
+ if (keyMatch === null) {
179
+ lineIndex += 1;
180
+ continue;
279
181
  }
280
- catch {
182
+ const lineKey = keyMatch[1] ?? '';
183
+ const valuePortion = line.slice(keyMatch[0].length);
184
+ const blockLines = [line];
185
+ let isValueOpen = Runner.isQuoteOpen(valuePortion, false);
186
+ while (isValueOpen === true && lineIndex + 1 < lines.length) {
187
+ lineIndex += 1;
188
+ const continuationLine = lines[lineIndex] ?? '';
189
+ blockLines.push(continuationLine);
190
+ isValueOpen = Runner.isQuoteOpen(continuationLine, true);
281
191
  }
192
+ existing.set(lineKey, blockLines.join('\n'));
193
+ lineIndex += 1;
282
194
  }
283
- let hasPendingChanges = false;
284
- while (true) {
285
- const envContent = bufferEnv;
286
- const envSampleContent = bufferEnvSample;
287
- const envEntries = Runner.parseEnvFile(envContent);
288
- const envSampleEntries = Runner.parseEnvFile(envSampleContent);
289
- const deletableEntries = envEntries.filter((entry) => reservedKeys.has(entry['key']) !== true);
290
- const choices = [{
291
- title: 'Add a variable',
292
- description: 'Add a new environment variable to both files',
293
- value: 'add',
294
- }];
295
- if (envEntries.length > 0) {
296
- choices.push({
297
- title: 'Edit a variable',
298
- description: 'Update the value of an existing variable',
299
- value: 'edit',
300
- });
301
- }
302
- if (deletableEntries.length > 0) {
303
- choices.push({
304
- title: 'Delete a variable',
305
- description: 'Remove a variable from both files',
306
- value: 'delete',
307
- });
308
- }
309
- choices.push({
310
- title: 'Save & Exit',
311
- description: 'Save changes and exit',
312
- value: 'exit',
313
- });
314
- choices.push({
315
- title: 'Back',
316
- description: 'Return to the previous menu',
317
- value: 'back',
318
- });
319
- const menuOutput = await Runner.promptWithCancel({
320
- type: 'select',
321
- name: 'action',
322
- message: 'Select an action.',
323
- choices,
324
- });
325
- if (menuOutput['cancelled'] === true) {
326
- return 'back';
327
- }
328
- const action = menuOutput['result'].action;
329
- if (action === undefined || action === 'back') {
330
- return 'back';
331
- }
332
- if (action === 'exit') {
333
- if (hasPendingChanges === true && isDryRun !== true) {
334
- await saveGeneratedFile(envPath, bufferEnv, isReplaceFile, {
335
- command: 'nova generate must-haves dotenv',
336
- docsSlug: 'cli/generators/must-haves/dotenv',
337
- mode: 'fillable',
338
- });
339
- await saveGeneratedFile(envSamplePath, bufferEnvSample, isReplaceFile, {
340
- command: 'nova generate must-haves dotenv',
341
- docsSlug: 'cli/generators/must-haves/dotenv',
342
- mode: 'strict',
343
- });
344
- }
345
- return 'exit';
346
- }
347
- if (action === 'add') {
348
- const addExistingKeys = new Set(envEntries.map((entry) => entry['key']));
349
- const addKeyOutput = await Runner.promptWithCancel({
350
- type: 'text',
351
- name: 'key',
352
- message: 'Variable name (e.g. API_KEY):',
353
- validate: (value) => {
354
- if (typeof value !== 'string' || value.trim() === '') {
355
- return 'Enter a variable name.';
356
- }
357
- const addTrimmedValue = value.trim();
358
- if (LIB_REGEX_PATTERN_ENV_VAR_KEY_SCREAMING_SNAKE.test(addTrimmedValue) !== true) {
359
- return 'Use SCREAMING_SNAKE_CASE (e.g. API_KEY).';
360
- }
361
- if (addExistingKeys.has(addTrimmedValue) === true) {
362
- return `"${addTrimmedValue}" already exists.`;
363
- }
364
- if (reservedKeys.has(addTrimmedValue) === true) {
365
- return `"${addTrimmedValue}" is a reserved variable and cannot be added.`;
366
- }
367
- return true;
368
- },
369
- });
370
- if (addKeyOutput['cancelled'] === true) {
371
- continue;
372
- }
373
- const addKeyName = addKeyOutput['result'].key;
374
- if (addKeyName === undefined) {
375
- continue;
376
- }
377
- const addDefaultValueOutput = await Runner.promptWithCancel({
378
- type: 'text',
379
- name: 'defaultValue',
380
- message: 'Default value for .env.sample (leave empty for none):',
381
- initial: '',
382
- });
383
- if (addDefaultValueOutput['cancelled'] === true) {
384
- continue;
385
- }
386
- const addDefaultValue = addDefaultValueOutput['result'].defaultValue ?? '';
387
- const addTrimmedKeyName = addKeyName.trim();
388
- const addTrimmedDefaultValue = addDefaultValue.trim();
389
- const addUpdatedEnv = Runner.addEnvLine(envContent, addTrimmedKeyName, '');
390
- const addUpdatedSample = Runner.addEnvLine(envSampleContent, addTrimmedKeyName, addTrimmedDefaultValue);
391
- bufferEnv = addUpdatedEnv;
392
- bufferEnvSample = addUpdatedSample;
393
- hasPendingChanges = true;
394
- Logger.customize({
395
- name: 'Runner.promptManageMenu',
396
- purpose: 'add',
397
- }).info(`Added "${addKeyName.trim()}" to both files.`);
195
+ return existing;
196
+ }
197
+ static isQuoteOpen(text, startOpen) {
198
+ let inQuote = startOpen;
199
+ let escaped = false;
200
+ for (const character of text) {
201
+ if (escaped === true) {
202
+ escaped = false;
398
203
  continue;
399
204
  }
400
- if (action === 'edit') {
401
- const editChoices = envEntries.map((entry) => ({
402
- title: entry['key'],
403
- description: `Current value: "${entry['value']}"`,
404
- value: entry['key'],
405
- }));
406
- const editSelectOutput = await Runner.promptWithCancel({
407
- type: 'select',
408
- name: 'variable',
409
- message: 'Select a variable to edit.',
410
- choices: editChoices,
411
- });
412
- if (editSelectOutput['cancelled'] === true) {
413
- continue;
414
- }
415
- const editSelectedKey = editSelectOutput['result'].variable;
416
- if (editSelectedKey === undefined) {
417
- continue;
418
- }
419
- const editCurrentEnvEntry = envEntries.find((entry) => entry['key'] === editSelectedKey);
420
- const editCurrentSampleEntry = envSampleEntries.find((entry) => entry['key'] === editSelectedKey);
421
- const editEnvValueOutput = await Runner.promptWithCancel({
422
- type: 'text',
423
- name: 'value',
424
- message: `New value for .env (${editSelectedKey}):`,
425
- initial: (editCurrentEnvEntry !== undefined) ? editCurrentEnvEntry['value'] : '',
426
- });
427
- if (editEnvValueOutput['cancelled'] === true) {
428
- continue;
429
- }
430
- const editNewEnvValue = editEnvValueOutput['result'].value ?? '';
431
- const editSampleValueOutput = await Runner.promptWithCancel({
432
- type: 'text',
433
- name: 'defaultValue',
434
- message: `New default value for .env.sample (${editSelectedKey}):`,
435
- initial: (editCurrentSampleEntry !== undefined) ? editCurrentSampleEntry['value'] : '',
436
- });
437
- if (editSampleValueOutput['cancelled'] === true) {
438
- continue;
205
+ if (character === '\\') {
206
+ if (inQuote === true) {
207
+ escaped = true;
439
208
  }
440
- const editNewSampleValue = editSampleValueOutput['result'].defaultValue ?? '';
441
- const editUpdatedEnv = Runner.updateEnvLine(envContent, editSelectedKey, editNewEnvValue);
442
- const editUpdatedSample = Runner.updateEnvLine(envSampleContent, editSelectedKey, editNewSampleValue);
443
- bufferEnv = editUpdatedEnv;
444
- bufferEnvSample = editUpdatedSample;
445
- hasPendingChanges = true;
446
- Logger.customize({
447
- name: 'Runner.promptManageMenu',
448
- purpose: 'edit',
449
- }).info(`Updated "${editSelectedKey}" in both files.`);
450
209
  continue;
451
210
  }
452
- if (action === 'delete') {
453
- const deleteChoices = deletableEntries.map((entry) => ({
454
- title: entry['key'],
455
- description: `Current value: "${entry['value']}"`,
456
- value: entry['key'],
457
- }));
458
- const deleteSelectOutput = await Runner.promptWithCancel({
459
- type: 'select',
460
- name: 'variable',
461
- message: 'Select a variable to delete.',
462
- choices: deleteChoices,
463
- });
464
- if (deleteSelectOutput['cancelled'] === true) {
465
- continue;
466
- }
467
- const deleteSelectedKey = deleteSelectOutput['result'].variable;
468
- if (deleteSelectedKey === undefined) {
469
- continue;
470
- }
471
- const deleteUpdatedEnv = Runner.deleteEnvLine(envContent, deleteSelectedKey);
472
- const deleteUpdatedSample = Runner.deleteEnvLine(envSampleContent, deleteSelectedKey);
473
- bufferEnv = deleteUpdatedEnv;
474
- bufferEnvSample = deleteUpdatedSample;
475
- hasPendingChanges = true;
476
- Logger.customize({
477
- name: 'Runner.promptManageMenu',
478
- purpose: 'delete',
479
- }).info(`Deleted "${deleteSelectedKey}" from both files.`);
480
- continue;
211
+ if (character === '"') {
212
+ inQuote = inQuote === false;
481
213
  }
482
214
  }
215
+ return inQuote;
483
216
  }
484
- static async promptWithCancel(questions) {
485
- let cancelled = false;
486
- const result = await prompts(questions, {
487
- onCancel: () => false,
488
- });
489
- if (Object.keys(result).length === 0) {
490
- cancelled = true;
491
- }
492
- if (cancelled === true) {
493
- return {
494
- cancelled: true,
495
- };
217
+ static escapeSampleValue(value) {
218
+ let result = '';
219
+ for (const character of value) {
220
+ if (character < ' ' || character === '\x7f') {
221
+ continue;
222
+ }
223
+ if (character === '"') {
224
+ result += '\\"';
225
+ continue;
226
+ }
227
+ result += character;
496
228
  }
497
- return {
498
- cancelled: false,
499
- result,
500
- };
229
+ return result;
501
230
  }
502
231
  }
503
232
  //# sourceMappingURL=dotenv.js.map