@cbnventures/nova 0.20.0 → 0.22.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.
- package/README.md +10 -0
- package/bin/nova.mjs +3 -3
- package/build/package.json +10 -8
- package/build/src/cli/generate/github/funding.js +2 -2
- package/build/src/cli/generate/github/funding.js.map +1 -1
- package/build/src/cli/generate/github/issue-template.js +2 -2
- package/build/src/cli/generate/github/issue-template.js.map +1 -1
- package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts +12 -0
- package/build/src/cli/generate/github/workflows-blueprint-validate.d.ts.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint-validate.js +535 -0
- package/build/src/cli/generate/github/workflows-blueprint-validate.js.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint-variables.d.ts +9 -0
- package/build/src/cli/generate/github/workflows-blueprint-variables.d.ts.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint-variables.js +117 -0
- package/build/src/cli/generate/github/workflows-blueprint-variables.js.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint.d.ts +60 -0
- package/build/src/cli/generate/github/workflows-blueprint.d.ts.map +1 -0
- package/build/src/cli/generate/github/workflows-blueprint.js +2285 -0
- package/build/src/cli/generate/github/workflows-blueprint.js.map +1 -0
- package/build/src/cli/generate/must-haves/agent-conventions.js +2 -2
- package/build/src/cli/generate/must-haves/agent-conventions.js.map +1 -1
- package/build/src/cli/generate/must-haves/dotenv.d.ts +1 -0
- package/build/src/cli/generate/must-haves/dotenv.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/dotenv.js +38 -11
- package/build/src/cli/generate/must-haves/dotenv.js.map +1 -1
- package/build/src/cli/generate/must-haves/editorconfig.js +2 -2
- package/build/src/cli/generate/must-haves/editorconfig.js.map +1 -1
- package/build/src/cli/generate/must-haves/gitignore.js +2 -2
- package/build/src/cli/generate/must-haves/gitignore.js.map +1 -1
- package/build/src/cli/generate/must-haves/license.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/license.js +4 -4
- package/build/src/cli/generate/must-haves/license.js.map +1 -1
- package/build/src/cli/generate/must-haves/read-me.d.ts +6 -2
- package/build/src/cli/generate/must-haves/read-me.d.ts.map +1 -1
- package/build/src/cli/generate/must-haves/read-me.js +103 -63
- package/build/src/cli/generate/must-haves/read-me.js.map +1 -1
- package/build/src/cli/index.js +108 -2
- package/build/src/cli/index.js.map +1 -1
- package/build/src/cli/recipe/github/sync-features.d.ts.map +1 -1
- package/build/src/cli/recipe/github/sync-features.js +5 -3
- package/build/src/cli/recipe/github/sync-features.js.map +1 -1
- package/build/src/cli/recipe/github/sync-identity.d.ts.map +1 -1
- package/build/src/cli/recipe/github/sync-identity.js +5 -3
- package/build/src/cli/recipe/github/sync-identity.js.map +1 -1
- package/build/src/cli/recipe/github/sync-policies.d.ts.map +1 -1
- package/build/src/cli/recipe/github/sync-policies.js +5 -3
- package/build/src/cli/recipe/github/sync-policies.js.map +1 -1
- package/build/src/cli/recipe/index.d.ts.map +1 -1
- package/build/src/cli/recipe/index.js +32 -0
- package/build/src/cli/recipe/index.js.map +1 -1
- package/build/src/cli/recipe/license/update-copyright.d.ts +7 -0
- package/build/src/cli/recipe/license/update-copyright.d.ts.map +1 -0
- package/build/src/cli/recipe/license/update-copyright.js +191 -0
- package/build/src/cli/recipe/license/update-copyright.js.map +1 -0
- package/build/src/cli/recipe/package-json/cleanup.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/cleanup.js +14 -13
- package/build/src/cli/recipe/package-json/cleanup.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-artifacts.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-artifacts.js +11 -6
- package/build/src/cli/recipe/package-json/normalize-artifacts.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-bundler.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-bundler.js +11 -6
- package/build/src/cli/recipe/package-json/normalize-bundler.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-dependencies.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-dependencies.js +19 -11
- package/build/src/cli/recipe/package-json/normalize-dependencies.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-modules.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-modules.js +11 -6
- package/build/src/cli/recipe/package-json/normalize-modules.js.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-tooling.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/normalize-tooling.js +12 -7
- package/build/src/cli/recipe/package-json/normalize-tooling.js.map +1 -1
- package/build/src/cli/recipe/package-json/sync-environment.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/sync-environment.js +46 -14
- package/build/src/cli/recipe/package-json/sync-environment.js.map +1 -1
- package/build/src/cli/recipe/package-json/sync-identity.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/sync-identity.js +74 -16
- package/build/src/cli/recipe/package-json/sync-identity.js.map +1 -1
- package/build/src/cli/recipe/package-json/sync-ownership.d.ts.map +1 -1
- package/build/src/cli/recipe/package-json/sync-ownership.js +18 -11
- package/build/src/cli/recipe/package-json/sync-ownership.js.map +1 -1
- package/build/src/cli/recipe/read-me/update-badges.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-badges.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-badges.js +115 -0
- package/build/src/cli/recipe/read-me/update-badges.js.map +1 -0
- package/build/src/cli/recipe/read-me/update-credits.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-credits.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-credits.js +115 -0
- package/build/src/cli/recipe/read-me/update-credits.js.map +1 -0
- package/build/src/cli/recipe/read-me/update-documentation.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-documentation.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-documentation.js +115 -0
- package/build/src/cli/recipe/read-me/update-documentation.js.map +1 -0
- package/build/src/cli/recipe/read-me/update-header.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-header.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-header.js +115 -0
- package/build/src/cli/recipe/read-me/update-header.js.map +1 -0
- package/build/src/cli/recipe/read-me/update-introduction.d.ts +6 -0
- package/build/src/cli/recipe/read-me/update-introduction.d.ts.map +1 -0
- package/build/src/cli/recipe/read-me/update-introduction.js +115 -0
- package/build/src/cli/recipe/read-me/update-introduction.js.map +1 -0
- package/build/src/cli/scaffold/starter/base.js +1 -1
- package/build/src/cli/scaffold/starter/base.js.map +1 -1
- package/build/src/cli/utility/changelog.d.ts.map +1 -1
- package/build/src/cli/utility/changelog.js +99 -21
- package/build/src/cli/utility/changelog.js.map +1 -1
- package/build/src/cli/utility/initialize.d.ts +6 -0
- package/build/src/cli/utility/initialize.d.ts.map +1 -1
- package/build/src/cli/utility/initialize.js +737 -130
- package/build/src/cli/utility/initialize.js.map +1 -1
- package/build/src/cli/utility/run-scripts.d.ts.map +1 -1
- package/build/src/cli/utility/run-scripts.js +16 -8
- package/build/src/cli/utility/run-scripts.js.map +1 -1
- package/build/src/cli/utility/transpile.d.ts.map +1 -1
- package/build/src/cli/utility/transpile.js +2 -1
- package/build/src/cli/utility/transpile.js.map +1 -1
- package/build/src/cli/utility/type-check.d.ts.map +1 -1
- package/build/src/cli/utility/type-check.js +2 -1
- package/build/src/cli/utility/type-check.js.map +1 -1
- package/build/src/cli/utility/version.js +1 -1
- package/build/src/cli/utility/version.js.map +1 -1
- package/build/src/lib/env-github.d.ts +5 -0
- package/build/src/lib/env-github.d.ts.map +1 -0
- package/build/src/lib/env-github.js +77 -0
- package/build/src/lib/env-github.js.map +1 -0
- package/build/src/lib/env-managed-set.d.ts +3 -0
- package/build/src/lib/env-managed-set.d.ts.map +1 -0
- package/build/src/lib/env-managed-set.js +108 -0
- package/build/src/lib/env-managed-set.js.map +1 -0
- package/build/src/lib/env-namespace.d.ts +3 -0
- package/build/src/lib/env-namespace.d.ts.map +1 -0
- package/build/src/lib/env-namespace.js +11 -0
- package/build/src/lib/env-namespace.js.map +1 -0
- package/build/src/lib/env-reconcile.d.ts +3 -0
- package/build/src/lib/env-reconcile.d.ts.map +1 -0
- package/build/src/lib/env-reconcile.js +109 -0
- package/build/src/lib/env-reconcile.js.map +1 -0
- package/build/src/lib/env-status.d.ts +3 -0
- package/build/src/lib/env-status.d.ts.map +1 -0
- package/build/src/lib/env-status.js +116 -0
- package/build/src/lib/env-status.js.map +1 -0
- package/build/src/lib/item.d.ts +2 -1
- package/build/src/lib/item.d.ts.map +1 -1
- package/build/src/lib/item.js +26 -0
- package/build/src/lib/item.js.map +1 -1
- package/build/src/lib/markdown-slug.js +1 -1
- package/build/src/lib/markdown-slug.js.map +1 -1
- package/build/src/lib/nova-config.d.ts +13 -4
- package/build/src/lib/nova-config.d.ts.map +1 -1
- package/build/src/lib/nova-config.js +514 -162
- package/build/src/lib/nova-config.js.map +1 -1
- package/build/src/lib/read-me-regions.d.ts +4 -0
- package/build/src/lib/read-me-regions.d.ts.map +1 -0
- package/build/src/lib/read-me-regions.js +33 -0
- package/build/src/lib/read-me-regions.js.map +1 -0
- package/build/src/lib/regex.d.ts +5 -0
- package/build/src/lib/regex.d.ts.map +1 -1
- package/build/src/lib/regex.js +5 -0
- package/build/src/lib/regex.js.map +1 -1
- package/build/src/lib/scaffold.d.ts.map +1 -1
- package/build/src/lib/scaffold.js +33 -14
- package/build/src/lib/scaffold.js.map +1 -1
- package/build/src/lib/type-declaration-engine.d.ts +2 -2
- package/build/src/lib/type-declaration-engine.d.ts.map +1 -1
- package/build/src/lib/type-declaration-engine.js +32 -6
- package/build/src/lib/type-declaration-engine.js.map +1 -1
- package/build/src/lib/utility.d.ts +2 -1
- package/build/src/lib/utility.d.ts.map +1 -1
- package/build/src/lib/utility.js +39 -7
- package/build/src/lib/utility.js.map +1 -1
- package/build/src/lib/workflow-templates.d.ts.map +1 -1
- package/build/src/lib/workflow-templates.js +86 -60
- package/build/src/lib/workflow-templates.js.map +1 -1
- package/build/src/presets/eslint/dx-code-style.d.ts.map +1 -1
- package/build/src/presets/eslint/dx-code-style.js +6 -0
- package/build/src/presets/eslint/dx-code-style.js.map +1 -1
- package/build/src/presets/eslint/fw-astro.d.ts +4 -0
- package/build/src/presets/eslint/fw-astro.d.ts.map +1 -0
- package/build/src/presets/eslint/fw-astro.js +13 -0
- package/build/src/presets/eslint/fw-astro.js.map +1 -0
- package/build/src/presets/eslint/index.d.ts +1 -0
- package/build/src/presets/eslint/index.d.ts.map +1 -1
- package/build/src/presets/eslint/index.js +1 -0
- package/build/src/presets/eslint/index.js.map +1 -1
- package/build/src/presets/tsconfig/fw-astro.json +15 -0
- package/build/src/rules/eslint/conventions/no-implicit-boolean.d.ts.map +1 -1
- package/build/src/rules/eslint/conventions/no-implicit-boolean.js +3 -2
- package/build/src/rules/eslint/conventions/no-implicit-boolean.js.map +1 -1
- package/build/src/rules/eslint/conventions/require-hash-private.js +1 -1
- package/build/src/rules/eslint/conventions/require-hash-private.js.map +1 -1
- package/build/src/rules/eslint/conventions/require-kebab-case-filename.d.ts.map +1 -1
- package/build/src/rules/eslint/conventions/require-kebab-case-filename.js +4 -1
- package/build/src/rules/eslint/conventions/require-kebab-case-filename.js.map +1 -1
- package/build/src/rules/eslint/conventions/require-node-protocol.d.ts +11 -0
- package/build/src/rules/eslint/conventions/require-node-protocol.d.ts.map +1 -0
- package/build/src/rules/eslint/conventions/require-node-protocol.js +76 -0
- package/build/src/rules/eslint/conventions/require-node-protocol.js.map +1 -0
- package/build/src/rules/eslint/formatting/no-raw-text-in-code.d.ts.map +1 -1
- package/build/src/rules/eslint/formatting/no-raw-text-in-code.js +2 -1
- package/build/src/rules/eslint/formatting/no-raw-text-in-code.js.map +1 -1
- package/build/src/rules/eslint/formatting/require-padding-lines.d.ts.map +1 -1
- package/build/src/rules/eslint/formatting/require-padding-lines.js +7 -3
- package/build/src/rules/eslint/formatting/require-padding-lines.js.map +1 -1
- package/build/src/rules/eslint/formatting/require-ternary-parens.d.ts.map +1 -1
- package/build/src/rules/eslint/formatting/require-ternary-parens.js +7 -17
- package/build/src/rules/eslint/formatting/require-ternary-parens.js.map +1 -1
- package/build/src/rules/eslint/index.d.ts +4 -0
- package/build/src/rules/eslint/index.d.ts.map +1 -1
- package/build/src/rules/eslint/index.js +4 -0
- package/build/src/rules/eslint/index.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-body.d.ts +3 -2
- package/build/src/rules/eslint/jsdoc/require-jsdoc-body.d.ts.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-body.js +22 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-body.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts +2 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.js +16 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-hierarchy.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-param-name.d.ts.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-param-name.js +8 -4
- package/build/src/rules/eslint/jsdoc/require-jsdoc-param-name.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.d.ts +12 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.d.ts.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.js +169 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-presence.js.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.d.ts +11 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.d.ts.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.js +80 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-returns.js.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-since.js +2 -2
- package/build/src/rules/eslint/jsdoc/require-jsdoc-since.js.map +1 -1
- package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.d.ts +15 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.d.ts.map +1 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.js +290 -0
- package/build/src/rules/eslint/jsdoc/require-jsdoc-tag-order.js.map +1 -0
- package/build/src/rules/eslint/patterns/no-await-in-loop.js +1 -1
- package/build/src/rules/eslint/patterns/no-await-in-loop.js.map +1 -1
- package/build/src/rules/eslint/patterns/no-bracket-method-call.d.ts.map +1 -1
- package/build/src/rules/eslint/patterns/no-bracket-method-call.js +4 -0
- package/build/src/rules/eslint/patterns/no-bracket-method-call.js.map +1 -1
- package/build/src/rules/eslint/typescript/no-inline-type-annotation.d.ts.map +1 -1
- package/build/src/rules/eslint/typescript/no-inline-type-annotation.js +4 -1
- package/build/src/rules/eslint/typescript/no-inline-type-annotation.js.map +1 -1
- package/build/src/rules/eslint/typescript/require-bracket-property-access.d.ts.map +1 -1
- package/build/src/rules/eslint/typescript/require-bracket-property-access.js +8 -1
- package/build/src/rules/eslint/typescript/require-bracket-property-access.js.map +1 -1
- package/build/src/rules/vitest/active-vitest.d.ts +5 -0
- package/build/src/rules/vitest/active-vitest.d.ts.map +1 -0
- package/build/src/rules/vitest/active-vitest.js +19 -0
- package/build/src/rules/vitest/active-vitest.js.map +1 -0
- package/build/src/rules/vitest/dotenv/register.d.ts.map +1 -1
- package/build/src/rules/vitest/dotenv/register.js +3 -2
- package/build/src/rules/vitest/dotenv/register.js.map +1 -1
- package/build/src/rules/vitest/dotenv/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/dotenv/rules.js +2 -2
- package/build/src/rules/vitest/dotenv/rules.js.map +1 -1
- package/build/src/rules/vitest/frontmatter/register.d.ts.map +1 -1
- package/build/src/rules/vitest/frontmatter/register.js +3 -2
- package/build/src/rules/vitest/frontmatter/register.js.map +1 -1
- package/build/src/rules/vitest/frontmatter/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/frontmatter/rules.js +13 -13
- package/build/src/rules/vitest/frontmatter/rules.js.map +1 -1
- package/build/src/rules/vitest/link/register.d.ts.map +1 -1
- package/build/src/rules/vitest/link/register.js +3 -2
- package/build/src/rules/vitest/link/register.js.map +1 -1
- package/build/src/rules/vitest/link/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/link/rules.js +8 -8
- package/build/src/rules/vitest/link/rules.js.map +1 -1
- package/build/src/rules/vitest/markdown-table/register.d.ts.map +1 -1
- package/build/src/rules/vitest/markdown-table/register.js +3 -2
- package/build/src/rules/vitest/markdown-table/register.js.map +1 -1
- package/build/src/rules/vitest/markdown-table/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/markdown-table/rules.js +3 -3
- package/build/src/rules/vitest/markdown-table/rules.js.map +1 -1
- package/build/src/rules/vitest/terminology/register.d.ts.map +1 -1
- package/build/src/rules/vitest/terminology/register.js +3 -2
- package/build/src/rules/vitest/terminology/register.js.map +1 -1
- package/build/src/rules/vitest/terminology/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/terminology/rules.js +8 -8
- package/build/src/rules/vitest/terminology/rules.js.map +1 -1
- package/build/src/rules/vitest/type-declarations/register.d.ts.map +1 -1
- package/build/src/rules/vitest/type-declarations/register.js +6 -3
- package/build/src/rules/vitest/type-declarations/register.js.map +1 -1
- package/build/src/rules/vitest/type-declarations/rules.d.ts +3 -1
- package/build/src/rules/vitest/type-declarations/rules.d.ts.map +1 -1
- package/build/src/rules/vitest/type-declarations/rules.js +82 -12
- package/build/src/rules/vitest/type-declarations/rules.js.map +1 -1
- package/build/src/toolkit/index.d.ts +1 -0
- package/build/src/toolkit/index.d.ts.map +1 -1
- package/build/src/toolkit/index.js +1 -0
- package/build/src/toolkit/index.js.map +1 -1
- package/build/src/toolkit/markdown-table.js +1 -1
- package/build/src/toolkit/markdown-table.js.map +1 -1
- package/build/src/toolkit/nova-identity.d.ts +21 -0
- package/build/src/toolkit/nova-identity.d.ts.map +1 -0
- package/build/src/toolkit/nova-identity.js +160 -0
- package/build/src/toolkit/nova-identity.js.map +1 -0
- package/build/src/types/cli/generate/github/funding.d.ts +4 -4
- package/build/src/types/cli/generate/github/issue-template.d.ts +11 -11
- package/build/src/types/cli/generate/github/workflows-blueprint-validate.d.ts +351 -0
- package/build/src/types/cli/generate/github/workflows-blueprint-variables.d.ts +131 -0
- package/build/src/types/cli/generate/github/workflows-blueprint.d.ts +1192 -0
- package/build/src/types/cli/generate/must-haves/agent-conventions.d.ts +4 -4
- package/build/src/types/cli/generate/must-haves/dotenv.d.ts +50 -13
- package/build/src/types/cli/generate/must-haves/editorconfig.d.ts +2 -2
- package/build/src/types/cli/generate/must-haves/gitignore.d.ts +8 -8
- package/build/src/types/cli/generate/must-haves/license.d.ts +5 -5
- package/build/src/types/cli/generate/must-haves/read-me.d.ts +136 -88
- package/build/src/types/cli/index.d.ts +14 -0
- package/build/src/types/cli/recipe/github/handle-gh-failure.d.ts +2 -2
- package/build/src/types/cli/recipe/github/sync-features.d.ts +19 -12
- package/build/src/types/cli/recipe/github/sync-identity.d.ts +18 -11
- package/build/src/types/cli/recipe/github/sync-policies.d.ts +22 -15
- package/build/src/types/cli/recipe/index.d.ts +7 -3
- package/build/src/types/cli/recipe/license/update-copyright.d.ts +142 -0
- package/build/src/types/cli/recipe/package-json/cleanup.d.ts +26 -22
- package/build/src/types/cli/recipe/package-json/normalize-artifacts.d.ts +22 -16
- package/build/src/types/cli/recipe/package-json/normalize-bundler.d.ts +20 -14
- package/build/src/types/cli/recipe/package-json/normalize-dependencies.d.ts +31 -19
- package/build/src/types/cli/recipe/package-json/normalize-modules.d.ts +20 -14
- package/build/src/types/cli/recipe/package-json/normalize-tooling.d.ts +20 -14
- package/build/src/types/cli/recipe/package-json/sync-environment.d.ts +46 -22
- package/build/src/types/cli/recipe/package-json/sync-identity.d.ts +58 -19
- package/build/src/types/cli/recipe/package-json/sync-ownership.d.ts +33 -23
- package/build/src/types/cli/recipe/read-me/update-badges.d.ts +77 -0
- package/build/src/types/cli/recipe/read-me/update-credits.d.ts +77 -0
- package/build/src/types/cli/recipe/read-me/update-documentation.d.ts +77 -0
- package/build/src/types/cli/recipe/read-me/update-header.d.ts +77 -0
- package/build/src/types/cli/recipe/read-me/update-introduction.d.ts +77 -0
- package/build/src/types/cli/scaffold/starter/base.d.ts +2 -2
- package/build/src/types/cli/utility/changelog.d.ts +106 -74
- package/build/src/types/cli/utility/initialize.d.ts +842 -384
- package/build/src/types/cli/utility/run-scripts.d.ts +3 -1
- package/build/src/types/cli/utility/transpile.d.ts +8 -3
- package/build/src/types/cli/utility/type-check.d.ts +9 -3
- package/build/src/types/cli/utility/version.d.ts +32 -32
- package/build/src/types/lib/env-github.d.ts +100 -0
- package/build/src/types/lib/env-managed-set.d.ts +90 -0
- package/build/src/types/lib/env-namespace.d.ts +22 -0
- package/build/src/types/lib/env-reconcile.d.ts +71 -0
- package/build/src/types/lib/env-status.d.ts +100 -0
- package/build/src/types/lib/item.d.ts +23 -0
- package/build/src/types/lib/nova-config.d.ts +478 -142
- package/build/src/types/lib/read-me-regions.d.ts +51 -0
- package/build/src/types/lib/scaffold.d.ts +43 -23
- package/build/src/types/lib/type-declaration-engine.d.ts +18 -2
- package/build/src/types/lib/utility.d.ts +38 -4
- package/build/src/types/lib/workflow-templates.d.ts +10 -74
- package/build/src/types/presets/eslint/fw-astro.d.ts +8 -0
- package/build/src/types/rules/eslint/conventions/no-implicit-boolean.d.ts +7 -0
- package/build/src/types/rules/eslint/conventions/require-naming-convention.d.ts +8 -4
- package/build/src/types/rules/eslint/conventions/require-node-protocol.d.ts +56 -0
- package/build/src/types/rules/eslint/formatting/require-padding-lines.d.ts +2 -0
- package/build/src/types/rules/eslint/formatting/require-ternary-parens.d.ts +8 -3
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-body.d.ts +16 -0
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-hierarchy.d.ts +17 -13
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-param-name.d.ts +3 -1
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-presence.d.ts +125 -0
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-returns.d.ts +48 -0
- package/build/src/types/rules/eslint/jsdoc/require-jsdoc-tag-order.d.ts +204 -0
- package/build/src/types/rules/eslint/patterns/no-await-in-loop.d.ts +1 -1
- package/build/src/types/rules/eslint/patterns/no-bracket-method-call.d.ts +1 -1
- package/build/src/types/rules/eslint/typescript/require-bracket-property-access.d.ts +19 -7
- package/build/src/types/rules/vitest/active-vitest.d.ts +31 -0
- package/build/src/types/rules/vitest/index.d.ts +21 -1
- package/build/src/types/rules/vitest/markdown-table/rules.d.ts +2 -2
- package/build/src/types/rules/vitest/type-declarations/rules.d.ts +74 -0
- package/build/src/types/shared.d.ts +796 -52
- package/build/src/types/tests/bin-git-tracked.test.d.ts +52 -0
- package/build/src/types/tests/cli/generate/github/funding.test.d.ts +14 -10
- package/build/src/types/tests/cli/generate/github/issue-template.test.d.ts +20 -16
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-generate.test.d.ts +199 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-parity.test.d.ts +75 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-publish-parity.test.d.ts +295 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-validate.test.d.ts +901 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint-variables.test.d.ts +144 -0
- package/build/src/types/tests/cli/generate/github/workflows-blueprint.test.d.ts +332 -0
- package/build/src/types/tests/cli/generate/must-haves/agent-conventions.test.d.ts +11 -7
- package/build/src/types/tests/cli/generate/must-haves/dotenv.test.d.ts +123 -43
- package/build/src/types/tests/cli/generate/must-haves/editorconfig.test.d.ts +12 -8
- package/build/src/types/tests/cli/generate/must-haves/gitignore.test.d.ts +11 -7
- package/build/src/types/tests/cli/generate/must-haves/read-me.test.d.ts +33 -10
- package/build/src/types/tests/cli/recipe/github/handle-gh-failure.test.d.ts +25 -21
- package/build/src/types/tests/cli/recipe/github/sync-features.test.d.ts +98 -94
- package/build/src/types/tests/cli/recipe/github/sync-identity.test.d.ts +133 -129
- package/build/src/types/tests/cli/recipe/github/sync-policies.test.d.ts +125 -121
- package/build/src/types/tests/cli/recipe/license/update-copyright.test.d.ts +617 -0
- package/build/src/types/tests/cli/recipe/package-json/normalize-dependencies.test.d.ts +27 -0
- package/build/src/types/tests/cli/recipe/package-json/sync-environment.test.d.ts +21 -0
- package/build/src/types/tests/cli/recipe/package-json/sync-identity.test.d.ts +185 -0
- package/build/src/types/tests/cli/recipe/read-me/update-badges.test.d.ts +258 -0
- package/build/src/types/tests/cli/recipe/read-me/update-credits.test.d.ts +258 -0
- package/build/src/types/tests/cli/recipe/read-me/update-documentation.test.d.ts +258 -0
- package/build/src/types/tests/cli/recipe/read-me/update-header.test.d.ts +258 -0
- package/build/src/types/tests/cli/recipe/read-me/update-introduction.test.d.ts +258 -0
- package/build/src/types/tests/cli/utility/changelog.test.d.ts +31 -0
- package/build/src/types/tests/cli/utility/initialize.test.d.ts +163 -111
- package/build/src/types/tests/lib/nova-config.test.d.ts +391 -208
- package/build/src/types/tests/lib/read-me-regions.test.d.ts +43 -0
- package/build/src/types/tests/lib/utility.test.d.ts +35 -0
- package/build/src/types/tests/lib/workflow-templates.test.d.ts +18 -2
- package/build/src/types/tests/rules/eslint/conventions/require-node-protocol.test.d.ts +8 -0
- package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-presence.test.d.ts +8 -0
- package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-returns.test.d.ts +8 -0
- package/build/src/types/tests/rules/eslint/jsdoc/require-jsdoc-tag-order.test.d.ts +8 -0
- package/build/src/types/tests/rules/vitest/active-vitest.test.d.ts +56 -0
- package/build/src/types/tests/rules/vitest/frontmatter.test.d.ts +14 -0
- package/build/src/types/tests/rules/vitest/terminology.test.d.ts +4 -0
- package/build/src/types/tests/toolkit/logger.test.d.ts +25 -5
- package/build/src/types/tests/toolkit/nova-identity.test.d.ts +220 -0
- package/build/src/types/tests/type-declarations.test.d.ts +14 -0
- package/build/src/types/toolkit/nova-identity.d.ts +355 -0
- package/build/templates/generators/github/workflows/publish/base.yml +2 -0
- package/build/templates/generators/github/workflows/publish/targets/cloudflare-workers.yml +36 -0
- package/build/templates/generators/must-haves/agent-conventions/conventions/typescript.md +12 -12
- package/build/templates/generators/must-haves/agent-conventions/conventions/universal.md +2 -0
- package/build/templates/scaffold/docs/docusaurus/docusaurus.config.ts +9 -3
- package/build/templates/scaffold/docs/docusaurus/package.json +5 -2
- package/build/templates/scaffold/docs/docusaurus/src/tests/frontmatter.test.ts +4 -0
- package/build/templates/scaffold/docs/docusaurus/src/tests/link.test.ts +2 -0
- package/build/templates/scaffold/docs/docusaurus/src/tests/markdown-table.test.ts +2 -0
- package/build/templates/scaffold/docs/docusaurus/src/tests/terminology.test.ts +2 -0
- package/build/templates/scaffold/docs/docusaurus/src/tests/type-declarations.test.ts +17 -0
- package/package.json +10 -8
- package/build/src/cli/generate/github/workflows.d.ts +0 -17
- package/build/src/cli/generate/github/workflows.d.ts.map +0 -1
- package/build/src/cli/generate/github/workflows.js +0 -856
- package/build/src/cli/generate/github/workflows.js.map +0 -1
- package/build/src/types/cli/generate/github/workflows.d.ts +0 -596
- package/build/src/types/tests/cli/generate/github/workflows-helpers.test.d.ts +0 -239
- package/build/src/types/tests/cli/generate/github/workflows.test.d.ts +0 -587
- package/build/templates/generators/github/workflows/publish/targets/aws-amplify-nextjs.yml +0 -32
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { promises as fs } from 'fs';
|
|
2
|
-
import { join, relative, sep } from 'path';
|
|
1
|
+
import { promises as fs } from 'node:fs';
|
|
2
|
+
import { join, relative, sep } from 'node:path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import prompts from 'prompts';
|
|
5
|
+
import { libEnvGithub } from '../../lib/env-github.js';
|
|
6
|
+
import { libEnvManagedSet } from '../../lib/env-managed-set.js';
|
|
7
|
+
import { libEnvNamespace } from '../../lib/env-namespace.js';
|
|
8
|
+
import { libEnvReconcile } from '../../lib/env-reconcile.js';
|
|
9
|
+
import { libEnvStatus } from '../../lib/env-status.js';
|
|
5
10
|
import { libItemAllowedAgents, libItemAllowedPoliciesByRole, libItemAllowedRecipes, libItemSyncRoles, libItemValidEntityRoles, } from '../../lib/item.js';
|
|
6
11
|
import { Runner as LibNovaConfig } from '../../lib/nova-config.js';
|
|
7
|
-
import { LIB_REGEX_PATTERN_EMAIL_SIMPLE, LIB_REGEX_PATTERN_SLUG_SCOPED, LIB_REGEX_PATTERN_SLUG_SIMPLE, LIB_REGEX_PATTERN_YML_EXTENSION, } from '../../lib/regex.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';
|
|
8
13
|
import { discoverPathsWithFile, pathExists, resolveTemplatePath } from '../../lib/utility.js';
|
|
9
14
|
import { libWorkflowTemplatesMetadata } from '../../lib/workflow-templates.js';
|
|
10
15
|
import { Logger } from '../../toolkit/index.js';
|
|
@@ -33,6 +38,10 @@ export class Runner {
|
|
|
33
38
|
}
|
|
34
39
|
const novaConfig = new LibNovaConfig();
|
|
35
40
|
const workingFile = await novaConfig.load();
|
|
41
|
+
if (options['status'] === true) {
|
|
42
|
+
await Runner.promptEnvironmentReconcile(workingFile, false);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
36
45
|
const promptFlowResult = await Runner.promptFlow(workingFile);
|
|
37
46
|
if (promptFlowResult === 'cancel') {
|
|
38
47
|
Logger.customize({
|
|
@@ -105,6 +114,11 @@ export class Runner {
|
|
|
105
114
|
description: 'Select the AI tools (Claude Code, Codex) to generate conventions for.',
|
|
106
115
|
handler: Runner['promptAgents'],
|
|
107
116
|
},
|
|
117
|
+
environment: {
|
|
118
|
+
label: 'Environment',
|
|
119
|
+
description: 'Manage environment variables and secrets, prefixes, and GitHub provisioning.',
|
|
120
|
+
handler: Runner['promptEnvironment'],
|
|
121
|
+
},
|
|
108
122
|
};
|
|
109
123
|
while (true) {
|
|
110
124
|
const categoryKeys = Object.keys(category);
|
|
@@ -898,10 +912,10 @@ export class Runner {
|
|
|
898
912
|
}
|
|
899
913
|
const repoOutputResult = repoOutput['result'];
|
|
900
914
|
const githubRepoInput = repoOutputResult.githubRepo.trim();
|
|
901
|
-
const existingRecipes =
|
|
902
|
-
const syncIdentityInitial = (existingRecipes !== undefined && existingRecipes['sync-identity'] !== undefined) ? existingRecipes['sync-identity'] : true;
|
|
903
|
-
const syncFeaturesInitial = (existingRecipes !== undefined && existingRecipes['sync-features'] !== undefined) ? existingRecipes['sync-features'] : false;
|
|
904
|
-
const syncPoliciesInitial = (existingRecipes !== undefined && existingRecipes['sync-policies'] !== undefined) ? existingRecipes['sync-policies'] : false;
|
|
915
|
+
const existingRecipes = (config['recipes'] !== undefined) ? config['recipes']['github'] : undefined;
|
|
916
|
+
const syncIdentityInitial = (existingRecipes !== undefined && existingRecipes['sync-identity'] !== undefined) ? existingRecipes['sync-identity']['enabled'] : true;
|
|
917
|
+
const syncFeaturesInitial = (existingRecipes !== undefined && existingRecipes['sync-features'] !== undefined) ? existingRecipes['sync-features']['enabled'] : false;
|
|
918
|
+
const syncPoliciesInitial = (existingRecipes !== undefined && existingRecipes['sync-policies'] !== undefined) ? existingRecipes['sync-policies']['enabled'] : false;
|
|
905
919
|
const recipesOutput = await Runner.promptWithCancel([
|
|
906
920
|
{
|
|
907
921
|
type: 'confirm',
|
|
@@ -927,9 +941,15 @@ export class Runner {
|
|
|
927
941
|
}
|
|
928
942
|
const recipesOutputResult = recipesOutput['result'];
|
|
929
943
|
const githubRecipesInput = {
|
|
930
|
-
'sync-identity':
|
|
931
|
-
|
|
932
|
-
|
|
944
|
+
'sync-identity': {
|
|
945
|
+
enabled: recipesOutputResult.githubRecipeSyncIdentity,
|
|
946
|
+
},
|
|
947
|
+
'sync-features': {
|
|
948
|
+
enabled: recipesOutputResult.githubRecipeSyncFeatures,
|
|
949
|
+
},
|
|
950
|
+
'sync-policies': {
|
|
951
|
+
enabled: recipesOutputResult.githubRecipeSyncPolicies,
|
|
952
|
+
},
|
|
933
953
|
};
|
|
934
954
|
const existingTopics = github['topics'];
|
|
935
955
|
const topicsHasExisting = (existingTopics !== undefined) && existingTopics.length > 0;
|
|
@@ -1303,7 +1323,7 @@ export class Runner {
|
|
|
1303
1323
|
githubPoliciesInput = {
|
|
1304
1324
|
...((githubPoliciesVisibilityValue !== 'skip') ? { visibility: githubPoliciesVisibilityValue } : {}),
|
|
1305
1325
|
...((githubPoliciesDefaultBranchValue !== 'skip') ? { defaultBranch: githubPoliciesDefaultBranchValue } : {}),
|
|
1306
|
-
...(githubPoliciesMergeMethodsInput !== undefined ? { mergeMethods: githubPoliciesMergeMethodsInput } : {}),
|
|
1326
|
+
...((githubPoliciesMergeMethodsInput !== undefined) ? { mergeMethods: githubPoliciesMergeMethodsInput } : {}),
|
|
1307
1327
|
...((githubPoliciesAutoDeleteValue !== 'skip') ? { autoDeleteHeadBranch: githubPoliciesAutoDeleteValue } : {}),
|
|
1308
1328
|
};
|
|
1309
1329
|
}
|
|
@@ -1385,13 +1405,15 @@ export class Runner {
|
|
|
1385
1405
|
const githubConfig = {
|
|
1386
1406
|
owner: githubOwnerInput,
|
|
1387
1407
|
repo: githubRepoInput,
|
|
1388
|
-
|
|
1389
|
-
...(
|
|
1390
|
-
...(
|
|
1391
|
-
...(
|
|
1392
|
-
...(issueTemplateInput !== undefined ? { issueTemplate: issueTemplateInput } : {}),
|
|
1408
|
+
...((githubTopicsInput !== undefined) ? { topics: githubTopicsInput } : {}),
|
|
1409
|
+
...((githubFeaturesInput !== undefined) ? { features: githubFeaturesInput } : {}),
|
|
1410
|
+
...((githubPoliciesInput !== undefined) ? { policies: githubPoliciesInput } : {}),
|
|
1411
|
+
...((issueTemplateInput !== undefined) ? { issueTemplate: issueTemplateInput } : {}),
|
|
1393
1412
|
};
|
|
1394
1413
|
Object.assign(config, { github: githubConfig });
|
|
1414
|
+
const recipesConfig = (config['recipes'] !== undefined) ? { ...(config['recipes']) } : {};
|
|
1415
|
+
recipesConfig.github = githubRecipesInput;
|
|
1416
|
+
Object.assign(config, { recipes: recipesConfig });
|
|
1395
1417
|
Logger.customize({
|
|
1396
1418
|
name: 'Runner.promptGithub',
|
|
1397
1419
|
purpose: 'updated',
|
|
@@ -1613,16 +1635,17 @@ export class Runner {
|
|
|
1613
1635
|
static async promptWorkflows(config) {
|
|
1614
1636
|
const workflows = [];
|
|
1615
1637
|
if (Array.isArray(config['workflows']) === true) {
|
|
1616
|
-
|
|
1638
|
+
const configWorkflows = config['workflows'];
|
|
1639
|
+
for (const configWorkflow of configWorkflows) {
|
|
1617
1640
|
const clonedWorkflow = { ...configWorkflow };
|
|
1618
1641
|
if (Array.isArray(configWorkflow['triggers']) === true) {
|
|
1619
1642
|
clonedWorkflow.triggers = [...configWorkflow['triggers']];
|
|
1620
1643
|
}
|
|
1621
|
-
if (configWorkflow['
|
|
1622
|
-
clonedWorkflow.
|
|
1644
|
+
if (configWorkflow['with'] !== undefined) {
|
|
1645
|
+
clonedWorkflow.with = { ...configWorkflow['with'] };
|
|
1623
1646
|
}
|
|
1624
1647
|
else {
|
|
1625
|
-
Reflect.deleteProperty(clonedWorkflow, '
|
|
1648
|
+
Reflect.deleteProperty(clonedWorkflow, 'with');
|
|
1626
1649
|
}
|
|
1627
1650
|
workflows.push(clonedWorkflow);
|
|
1628
1651
|
}
|
|
@@ -1634,17 +1657,11 @@ export class Runner {
|
|
|
1634
1657
|
if (Array.isArray(workflow['triggers']) === true && workflow['triggers'].length > 0) {
|
|
1635
1658
|
normalizedWorkflow.triggers = [...workflow['triggers']];
|
|
1636
1659
|
}
|
|
1637
|
-
if (
|
|
1638
|
-
|
|
1660
|
+
if (workflow['with'] !== undefined && Object.keys(workflow['with']).length > 0) {
|
|
1661
|
+
normalizedWorkflow.with = { ...workflow['with'] };
|
|
1639
1662
|
}
|
|
1640
1663
|
else {
|
|
1641
|
-
Reflect.deleteProperty(normalizedWorkflow, '
|
|
1642
|
-
}
|
|
1643
|
-
if (workflow['settings'] !== undefined && Object.keys(workflow['settings']).length > 0) {
|
|
1644
|
-
normalizedWorkflow.settings = { ...workflow['settings'] };
|
|
1645
|
-
}
|
|
1646
|
-
else {
|
|
1647
|
-
Reflect.deleteProperty(normalizedWorkflow, 'settings');
|
|
1664
|
+
Reflect.deleteProperty(normalizedWorkflow, 'with');
|
|
1648
1665
|
}
|
|
1649
1666
|
return normalizedWorkflow;
|
|
1650
1667
|
});
|
|
@@ -1663,8 +1680,8 @@ export class Runner {
|
|
|
1663
1680
|
if (templateCompare !== 0) {
|
|
1664
1681
|
return templateCompare;
|
|
1665
1682
|
}
|
|
1666
|
-
const suffixA = (a !== undefined && typeof a['
|
|
1667
|
-
const suffixB = (b !== undefined && typeof b['
|
|
1683
|
+
const suffixA = (a !== undefined && typeof a['name'] === 'string') ? a['name'] : '';
|
|
1684
|
+
const suffixB = (b !== undefined && typeof b['name'] === 'string') ? b['name'] : '';
|
|
1668
1685
|
return suffixA.localeCompare(suffixB);
|
|
1669
1686
|
});
|
|
1670
1687
|
const choices = [];
|
|
@@ -1674,8 +1691,9 @@ export class Runner {
|
|
|
1674
1691
|
continue;
|
|
1675
1692
|
}
|
|
1676
1693
|
const template = (typeof workflow['template'] === 'string') ? workflow['template'].trim() : '';
|
|
1677
|
-
const suffix = (typeof workflow['
|
|
1694
|
+
const suffix = (typeof workflow['name'] === 'string') ? workflow['name'].trim() : '';
|
|
1678
1695
|
const triggers = (Array.isArray(workflow['triggers']) === true) ? workflow['triggers'] : [];
|
|
1696
|
+
const triggerNames = triggers.map((trigger) => (typeof trigger === 'string') ? trigger : trigger['name']);
|
|
1679
1697
|
let label = `Workflow ${i + 1}`;
|
|
1680
1698
|
if (template !== '' && suffix !== '') {
|
|
1681
1699
|
label = `${template}-${suffix}`;
|
|
@@ -1683,7 +1701,7 @@ export class Runner {
|
|
|
1683
1701
|
else if (template !== '') {
|
|
1684
1702
|
label = template;
|
|
1685
1703
|
}
|
|
1686
|
-
const triggersLabel = (
|
|
1704
|
+
const triggersLabel = (triggerNames.length > 0) ? ` [${triggerNames.join(', ')}]` : '';
|
|
1687
1705
|
const outputFileName = (suffix !== '') ? `nova-${template}-${suffix}.yml` : `nova-${template}.yml`;
|
|
1688
1706
|
const description = (template !== '') ? `${outputFileName}${triggersLabel}` : 'Update this workflow.';
|
|
1689
1707
|
choices.push({
|
|
@@ -1777,7 +1795,7 @@ export class Runner {
|
|
|
1777
1795
|
continue;
|
|
1778
1796
|
}
|
|
1779
1797
|
const removeTemplate = (typeof workflowToRemove['template'] === 'string') ? workflowToRemove['template'].trim() : '';
|
|
1780
|
-
const removeSuffix = (typeof workflowToRemove['
|
|
1798
|
+
const removeSuffix = (typeof workflowToRemove['name'] === 'string') ? workflowToRemove['name'].trim() : '';
|
|
1781
1799
|
let workflowLabel = `Workflow ${removeWorkflowIndex + 1}`;
|
|
1782
1800
|
if (removeTemplate !== '' && removeSuffix !== '') {
|
|
1783
1801
|
workflowLabel = `${removeTemplate}-${removeSuffix}`;
|
|
@@ -1802,11 +1820,21 @@ export class Runner {
|
|
|
1802
1820
|
}
|
|
1803
1821
|
static async promptWorkflowsForm(workflow, mode, workflows, config) {
|
|
1804
1822
|
const existingTemplate = (workflow !== undefined && typeof workflow['template'] === 'string') ? workflow['template'] : '';
|
|
1805
|
-
const existingSuffix = (workflow !== undefined && typeof workflow['
|
|
1823
|
+
const existingSuffix = (workflow !== undefined && typeof workflow['name'] === 'string') ? workflow['name'] : '';
|
|
1806
1824
|
const existingTriggers = (workflow !== undefined && Array.isArray(workflow['triggers']) === true) ? workflow['triggers'] : [];
|
|
1807
|
-
const
|
|
1808
|
-
const
|
|
1809
|
-
|
|
1825
|
+
const existingTriggerNames = existingTriggers.map((trigger) => (typeof trigger === 'string') ? trigger : trigger['name']);
|
|
1826
|
+
const existingDependsOn = [];
|
|
1827
|
+
for (const trigger of existingTriggers) {
|
|
1828
|
+
if (typeof trigger !== 'string' && Array.isArray(trigger['workflows']) === true) {
|
|
1829
|
+
for (const upstream of trigger['workflows']) {
|
|
1830
|
+
if (existingDependsOn.includes(upstream) === false) {
|
|
1831
|
+
existingDependsOn.push(upstream);
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
const existingTargets = (workflow !== undefined && Array.isArray(workflow['deploy']) === true) ? workflow['deploy'] : [];
|
|
1837
|
+
const existingScopes = (workflow !== undefined && Array.isArray(workflow['build']) === true) ? workflow['build'] : [];
|
|
1810
1838
|
const templateChoices = libWorkflowTemplatesMetadata.map((entry) => ({
|
|
1811
1839
|
title: entry['name'],
|
|
1812
1840
|
description: entry['description'],
|
|
@@ -1836,12 +1864,12 @@ export class Runner {
|
|
|
1836
1864
|
const suffixOutput = await Runner.promptWithCancel({
|
|
1837
1865
|
type: 'text',
|
|
1838
1866
|
name: 'suffix',
|
|
1839
|
-
message: 'Workflow
|
|
1867
|
+
message: 'Workflow name (used in filename and workflow name)',
|
|
1840
1868
|
initial: existingSuffix,
|
|
1841
1869
|
validate: (value) => {
|
|
1842
1870
|
const trimmed = (typeof value === 'string') ? value.trim() : '';
|
|
1843
1871
|
if (trimmed === '') {
|
|
1844
|
-
return '
|
|
1872
|
+
return 'Name is required.';
|
|
1845
1873
|
}
|
|
1846
1874
|
const compositeKey = `${selectedTemplate}-${trimmed}`;
|
|
1847
1875
|
const editIndex = (workflow !== undefined) ? workflows.indexOf(workflow) : -1;
|
|
@@ -1849,11 +1877,11 @@ export class Runner {
|
|
|
1849
1877
|
if (i === editIndex) {
|
|
1850
1878
|
return false;
|
|
1851
1879
|
}
|
|
1852
|
-
const existingKey = `${w['template']}-${w['
|
|
1880
|
+
const existingKey = `${w['template']}-${w['name'] ?? ''}`;
|
|
1853
1881
|
return existingKey === compositeKey;
|
|
1854
1882
|
});
|
|
1855
1883
|
if (isDuplicate === true) {
|
|
1856
|
-
return 'A workflow with this template and
|
|
1884
|
+
return 'A workflow with this template and name already exists.';
|
|
1857
1885
|
}
|
|
1858
1886
|
return true;
|
|
1859
1887
|
},
|
|
@@ -1875,7 +1903,7 @@ export class Runner {
|
|
|
1875
1903
|
return {
|
|
1876
1904
|
title: triggerName,
|
|
1877
1905
|
value: triggerName,
|
|
1878
|
-
selected:
|
|
1906
|
+
selected: existingTriggerNames.includes(triggerName),
|
|
1879
1907
|
};
|
|
1880
1908
|
});
|
|
1881
1909
|
const triggersOutput = await Runner.promptWithCancel({
|
|
@@ -1911,7 +1939,7 @@ export class Runner {
|
|
|
1911
1939
|
&& typeof w['template'] === 'string'
|
|
1912
1940
|
&& w['template'].trim() !== '')
|
|
1913
1941
|
.map((w) => {
|
|
1914
|
-
const dependsOnKey = (typeof w['
|
|
1942
|
+
const dependsOnKey = (typeof w['name'] === 'string' && w['name'].trim() !== '') ? `${w['template']}-${w['name']}` : w['template'];
|
|
1915
1943
|
return {
|
|
1916
1944
|
title: dependsOnKey,
|
|
1917
1945
|
value: dependsOnKey,
|
|
@@ -1938,8 +1966,7 @@ export class Runner {
|
|
|
1938
1966
|
const workspaceKeys = Object.keys(config['workspaces'] ?? {});
|
|
1939
1967
|
const selectedTargets = [...existingTargets];
|
|
1940
1968
|
if (matchedMetadata !== undefined && matchedMetadata['supportsTargets'] === true) {
|
|
1941
|
-
const
|
|
1942
|
-
const availableTargetTypes = Object.keys(targetsMetadata);
|
|
1969
|
+
const availableTargetTypes = Object.keys(matchedMetadata['targets'] ?? {});
|
|
1943
1970
|
while (true) {
|
|
1944
1971
|
const targetMenuChoices = [];
|
|
1945
1972
|
for (let i = 0; i < selectedTargets.length; i += 1) {
|
|
@@ -1947,8 +1974,8 @@ export class Runner {
|
|
|
1947
1974
|
if (currentTarget === undefined) {
|
|
1948
1975
|
continue;
|
|
1949
1976
|
}
|
|
1950
|
-
const currentTargetType = currentTarget['
|
|
1951
|
-
const currentTargetWorkingDir = currentTarget['
|
|
1977
|
+
const currentTargetType = currentTarget['to'];
|
|
1978
|
+
const currentTargetWorkingDir = currentTarget['path'];
|
|
1952
1979
|
targetMenuChoices.push({
|
|
1953
1980
|
title: `${chalk.yellow.bold('[EDIT]')} ${currentTargetType} → ${currentTargetWorkingDir}`,
|
|
1954
1981
|
value: {
|
|
@@ -2002,7 +2029,7 @@ export class Runner {
|
|
|
2002
2029
|
if (targetMenuAction['kind'] === 'add' || targetMenuAction['kind'] === 'edit') {
|
|
2003
2030
|
const targetEditIndex = (targetMenuAction['kind'] === 'edit') ? targetMenuAction['index'] : -1;
|
|
2004
2031
|
const targetToEdit = (targetEditIndex >= 0) ? selectedTargets[targetEditIndex] : undefined;
|
|
2005
|
-
const targetTypeInitial = (targetToEdit !== undefined) ? availableTargetTypes.indexOf(targetToEdit['
|
|
2032
|
+
const targetTypeInitial = (targetToEdit !== undefined) ? availableTargetTypes.indexOf(targetToEdit['to']) : 0;
|
|
2006
2033
|
const targetTypeChoices = availableTargetTypes.map((availableTargetType) => ({
|
|
2007
2034
|
title: availableTargetType,
|
|
2008
2035
|
value: availableTargetType,
|
|
@@ -2019,7 +2046,7 @@ export class Runner {
|
|
|
2019
2046
|
}
|
|
2020
2047
|
const targetTypeOutputResultValue = targetTypeOutput['result'];
|
|
2021
2048
|
const selectedTargetType = targetTypeOutputResultValue.targetType;
|
|
2022
|
-
const targetWorkingDirInitial = (targetToEdit !== undefined) ? workspaceKeys.indexOf(targetToEdit['
|
|
2049
|
+
const targetWorkingDirInitial = (targetToEdit !== undefined) ? workspaceKeys.indexOf(targetToEdit['path']) : 0;
|
|
2023
2050
|
const targetWorkingDirChoices = workspaceKeys.map((workspaceKey) => ({
|
|
2024
2051
|
title: workspaceKey,
|
|
2025
2052
|
value: workspaceKey,
|
|
@@ -2040,7 +2067,7 @@ export class Runner {
|
|
|
2040
2067
|
if (selectedTargetIndex === targetEditIndex) {
|
|
2041
2068
|
return false;
|
|
2042
2069
|
}
|
|
2043
|
-
return selectedTarget['
|
|
2070
|
+
return selectedTarget['to'] === selectedTargetType && selectedTarget['path'] === selectedTargetWorkingDir;
|
|
2044
2071
|
});
|
|
2045
2072
|
if (targetIsDuplicate === true) {
|
|
2046
2073
|
Logger.customize({
|
|
@@ -2052,17 +2079,17 @@ export class Runner {
|
|
|
2052
2079
|
continue;
|
|
2053
2080
|
}
|
|
2054
2081
|
let selectedTargetNeeds = undefined;
|
|
2055
|
-
const targetToEditExistingNeeds = (targetToEdit !== undefined && Array.isArray(targetToEdit['
|
|
2082
|
+
const targetToEditExistingNeeds = (targetToEdit !== undefined && Array.isArray(targetToEdit['after']) === true) ? targetToEdit['after'] : [];
|
|
2056
2083
|
const targetNeedsChoices = selectedTargets
|
|
2057
2084
|
.filter((candidate, candidateIndex) => {
|
|
2058
|
-
return candidate['
|
|
2085
|
+
return candidate['to'] === selectedTargetType
|
|
2059
2086
|
&& candidateIndex !== targetEditIndex
|
|
2060
|
-
&& candidate['
|
|
2087
|
+
&& candidate['path'] !== selectedTargetWorkingDir;
|
|
2061
2088
|
})
|
|
2062
2089
|
.map((candidate) => ({
|
|
2063
|
-
title: candidate['
|
|
2064
|
-
value: candidate['
|
|
2065
|
-
selected: targetToEditExistingNeeds.includes(candidate['
|
|
2090
|
+
title: candidate['path'],
|
|
2091
|
+
value: candidate['path'],
|
|
2092
|
+
selected: targetToEditExistingNeeds.includes(candidate['path']),
|
|
2066
2093
|
}));
|
|
2067
2094
|
if (targetNeedsChoices.length > 0) {
|
|
2068
2095
|
const targetNeedsOutput = await Runner.promptWithCancel({
|
|
@@ -2078,11 +2105,11 @@ export class Runner {
|
|
|
2078
2105
|
selectedTargetNeeds = (Array.isArray(targetNeedsOutputResultValue.targetNeeds) === true && targetNeedsOutputResultValue.targetNeeds.length > 0) ? targetNeedsOutputResultValue.targetNeeds : undefined;
|
|
2079
2106
|
}
|
|
2080
2107
|
const newTarget = {
|
|
2081
|
-
|
|
2082
|
-
|
|
2108
|
+
to: selectedTargetType,
|
|
2109
|
+
path: selectedTargetWorkingDir,
|
|
2083
2110
|
};
|
|
2084
2111
|
if (selectedTargetNeeds !== undefined) {
|
|
2085
|
-
Reflect.set(newTarget, '
|
|
2112
|
+
Reflect.set(newTarget, 'after', selectedTargetNeeds);
|
|
2086
2113
|
}
|
|
2087
2114
|
if (targetEditIndex >= 0) {
|
|
2088
2115
|
Reflect.set(selectedTargets, targetEditIndex, newTarget);
|
|
@@ -2096,7 +2123,7 @@ export class Runner {
|
|
|
2096
2123
|
}
|
|
2097
2124
|
let selectedScopes = [];
|
|
2098
2125
|
if (matchedMetadata !== undefined && matchedMetadata['supportsScopes'] === true) {
|
|
2099
|
-
const lockedPaths = new Set(selectedTargets.map((selectedTarget) => selectedTarget['
|
|
2126
|
+
const lockedPaths = new Set(selectedTargets.map((selectedTarget) => selectedTarget['path']));
|
|
2100
2127
|
const extraWorkspaceKeys = workspaceKeys.filter((workspaceKey) => lockedPaths.has(workspaceKey) === false);
|
|
2101
2128
|
selectedScopes = [...lockedPaths];
|
|
2102
2129
|
if (extraWorkspaceKeys.length > 0) {
|
|
@@ -2130,8 +2157,8 @@ export class Runner {
|
|
|
2130
2157
|
const mergedVariables = { ...matchedMetadata['variables'] };
|
|
2131
2158
|
const variableNameToTargetWorkingDir = {};
|
|
2132
2159
|
for (const selectedTarget of selectedTargets) {
|
|
2133
|
-
const targetType = selectedTarget['
|
|
2134
|
-
const targetWorkingDir = selectedTarget['
|
|
2160
|
+
const targetType = selectedTarget['to'];
|
|
2161
|
+
const targetWorkingDir = selectedTarget['path'];
|
|
2135
2162
|
const targetMetadata = matchedMetadata['targets'] ?? {};
|
|
2136
2163
|
const targetVariables = (targetMetadata[targetType] !== undefined) ? targetMetadata[targetType]['variables'] : {};
|
|
2137
2164
|
const targetVarEntries = Object.entries(targetVariables);
|
|
@@ -2167,6 +2194,9 @@ export class Runner {
|
|
|
2167
2194
|
promptMessage = `Variable: ${variableName}`;
|
|
2168
2195
|
initialValue = (typeof variableConfig['default'] === 'string') ? variableConfig['default'] : '';
|
|
2169
2196
|
}
|
|
2197
|
+
if (variableName === 'ROOT_WORKING_DIR' && initialValue === '') {
|
|
2198
|
+
initialValue = './';
|
|
2199
|
+
}
|
|
2170
2200
|
const parts = [];
|
|
2171
2201
|
if (typeof variableConfig['description'] === 'string') {
|
|
2172
2202
|
parts.push(variableConfig['description']);
|
|
@@ -2184,9 +2214,9 @@ export class Runner {
|
|
|
2184
2214
|
promptMessage = `${promptMessage} (${parts.join(', ')})`;
|
|
2185
2215
|
}
|
|
2186
2216
|
if (workflow !== undefined
|
|
2187
|
-
&& workflow['
|
|
2188
|
-
&& typeof workflow['
|
|
2189
|
-
initialValue = workflow['
|
|
2217
|
+
&& workflow['with'] !== undefined
|
|
2218
|
+
&& typeof workflow['with'][variableName] === 'string') {
|
|
2219
|
+
initialValue = workflow['with'][variableName];
|
|
2190
2220
|
}
|
|
2191
2221
|
const settingsOutput = await Runner.promptWithCancel({
|
|
2192
2222
|
type: 'text',
|
|
@@ -2202,27 +2232,34 @@ export class Runner {
|
|
|
2202
2232
|
}
|
|
2203
2233
|
const settingsOutputResultValue = settingsOutput['result'];
|
|
2204
2234
|
const settingValue = (typeof settingsOutputResultValue.settingValue === 'string') ? settingsOutputResultValue.settingValue.trim().replaceAll('\\n', '\n') : '';
|
|
2205
|
-
|
|
2235
|
+
const isDefaultRootWorkingDir = variableName === 'ROOT_WORKING_DIR' && settingValue === './';
|
|
2236
|
+
if (settingValue !== '' && isDefaultRootWorkingDir === false) {
|
|
2206
2237
|
Reflect.set(settings, variableName, settingValue);
|
|
2207
2238
|
}
|
|
2208
2239
|
}
|
|
2209
2240
|
}
|
|
2241
|
+
const resolvedTriggers = selectedTriggers.map((trigger) => {
|
|
2242
|
+
if (trigger.startsWith('workflow-run') === true && selectedDependsOn !== undefined) {
|
|
2243
|
+
return {
|
|
2244
|
+
name: trigger,
|
|
2245
|
+
workflows: selectedDependsOn,
|
|
2246
|
+
};
|
|
2247
|
+
}
|
|
2248
|
+
return trigger;
|
|
2249
|
+
});
|
|
2210
2250
|
const resolvedWorkflow = {
|
|
2211
2251
|
template: selectedTemplate,
|
|
2212
|
-
|
|
2213
|
-
triggers:
|
|
2252
|
+
name: selectedSuffix,
|
|
2253
|
+
triggers: resolvedTriggers,
|
|
2214
2254
|
};
|
|
2215
|
-
if (
|
|
2216
|
-
Reflect.set(resolvedWorkflow, '
|
|
2255
|
+
if (selectedScopes.length > 0) {
|
|
2256
|
+
Reflect.set(resolvedWorkflow, 'build', selectedScopes);
|
|
2217
2257
|
}
|
|
2218
2258
|
if (selectedTargets.length > 0) {
|
|
2219
|
-
Reflect.set(resolvedWorkflow, '
|
|
2220
|
-
}
|
|
2221
|
-
if (selectedScopes.length > 0) {
|
|
2222
|
-
Reflect.set(resolvedWorkflow, 'scopes', selectedScopes);
|
|
2259
|
+
Reflect.set(resolvedWorkflow, 'deploy', selectedTargets);
|
|
2223
2260
|
}
|
|
2224
2261
|
if (Object.keys(settings).length > 0) {
|
|
2225
|
-
resolvedWorkflow.
|
|
2262
|
+
resolvedWorkflow.with = settings;
|
|
2226
2263
|
}
|
|
2227
2264
|
if (mode === 'create' && selectedTemplate.trim() === '') {
|
|
2228
2265
|
return {
|
|
@@ -2463,8 +2500,568 @@ export class Runner {
|
|
|
2463
2500
|
}
|
|
2464
2501
|
return result;
|
|
2465
2502
|
}
|
|
2503
|
+
static async promptEnvironment(config) {
|
|
2504
|
+
while (true) {
|
|
2505
|
+
const environment = (config['environment'] !== undefined) ? config['environment'] : {};
|
|
2506
|
+
const projectScope = environment['project'];
|
|
2507
|
+
const workspacesGroup = (environment['workspaces'] !== undefined) ? environment['workspaces'] : {};
|
|
2508
|
+
const workspaces = (config['workspaces'] !== undefined) ? config['workspaces'] : {};
|
|
2509
|
+
const appPaths = [];
|
|
2510
|
+
for (const workspaceEntry of Object.entries(workspaces)) {
|
|
2511
|
+
if ((workspaceEntry[1]['role'] === 'app'
|
|
2512
|
+
|| workspaceEntry[0] === './')
|
|
2513
|
+
&& appPaths.includes(workspaceEntry[0]) === false) {
|
|
2514
|
+
appPaths.push(workspaceEntry[0]);
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2517
|
+
for (const appPath of Object.keys(workspacesGroup)) {
|
|
2518
|
+
if (appPaths.includes(appPath) === false) {
|
|
2519
|
+
appPaths.push(appPath);
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
const choices = [];
|
|
2523
|
+
const projectVariables = (projectScope !== undefined && projectScope['variables'] !== undefined) ? projectScope['variables'] : [];
|
|
2524
|
+
const projectSummary = (projectScope !== undefined) ? `${projectScope['prefix']} · ${projectVariables.length} value(s)` : 'Not configured yet.';
|
|
2525
|
+
choices.push({
|
|
2526
|
+
title: 'Project keys',
|
|
2527
|
+
description: projectSummary,
|
|
2528
|
+
value: {
|
|
2529
|
+
kind: 'scope',
|
|
2530
|
+
scope: 'project',
|
|
2531
|
+
},
|
|
2532
|
+
});
|
|
2533
|
+
for (const appPath of appPaths) {
|
|
2534
|
+
const appScope = workspacesGroup[appPath];
|
|
2535
|
+
const appVariables = (appScope !== undefined && appScope['variables'] !== undefined) ? appScope['variables'] : [];
|
|
2536
|
+
const appSummary = (appScope !== undefined) ? `${appScope['prefix']} · ${appVariables.length} value(s)` : 'Not configured yet.';
|
|
2537
|
+
choices.push({
|
|
2538
|
+
title: appPath,
|
|
2539
|
+
description: appSummary,
|
|
2540
|
+
value: {
|
|
2541
|
+
kind: 'scope',
|
|
2542
|
+
scope: 'workspace',
|
|
2543
|
+
appPath,
|
|
2544
|
+
},
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2547
|
+
choices.push({
|
|
2548
|
+
title: 'View GitHub status',
|
|
2549
|
+
description: 'Read-only classification of every managed key on GitHub.',
|
|
2550
|
+
value: {
|
|
2551
|
+
kind: 'status',
|
|
2552
|
+
},
|
|
2553
|
+
});
|
|
2554
|
+
choices.push({
|
|
2555
|
+
title: 'Provision & reconcile on GitHub',
|
|
2556
|
+
description: 'Create missing, delete stale, and restore mismatched key names.',
|
|
2557
|
+
value: {
|
|
2558
|
+
kind: 'reconcile',
|
|
2559
|
+
},
|
|
2560
|
+
});
|
|
2561
|
+
choices.push({
|
|
2562
|
+
title: 'Back',
|
|
2563
|
+
description: 'Return to the category selection.',
|
|
2564
|
+
value: {
|
|
2565
|
+
kind: 'back',
|
|
2566
|
+
},
|
|
2567
|
+
});
|
|
2568
|
+
const menuOutput = await Runner.promptWithCancel({
|
|
2569
|
+
type: 'select',
|
|
2570
|
+
name: 'action',
|
|
2571
|
+
message: 'Select an environment namespace or action.',
|
|
2572
|
+
choices,
|
|
2573
|
+
});
|
|
2574
|
+
if (menuOutput['cancelled'] === true) {
|
|
2575
|
+
return 'back';
|
|
2576
|
+
}
|
|
2577
|
+
const menuOutputResultValue = menuOutput['result'];
|
|
2578
|
+
if (menuOutputResultValue.action === undefined
|
|
2579
|
+
|| menuOutputResultValue.action['kind'] === 'back') {
|
|
2580
|
+
return 'back';
|
|
2581
|
+
}
|
|
2582
|
+
if (menuOutputResultValue.action['kind'] === 'status') {
|
|
2583
|
+
await Runner.promptEnvironmentReconcile(config, false);
|
|
2584
|
+
continue;
|
|
2585
|
+
}
|
|
2586
|
+
if (menuOutputResultValue.action['kind'] === 'reconcile') {
|
|
2587
|
+
await Runner.promptEnvironmentReconcile(config, true);
|
|
2588
|
+
continue;
|
|
2589
|
+
}
|
|
2590
|
+
if (menuOutputResultValue.action['kind'] === 'scope') {
|
|
2591
|
+
await Runner.promptEnvironmentScope(config, {
|
|
2592
|
+
scope: menuOutputResultValue.action['scope'],
|
|
2593
|
+
appPath: menuOutputResultValue.action['appPath'],
|
|
2594
|
+
});
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
static async readLocalFilledKeys(config) {
|
|
2599
|
+
const environment = config['environment'] ?? {};
|
|
2600
|
+
const workspaces = environment['workspaces'] ?? {};
|
|
2601
|
+
const result = {};
|
|
2602
|
+
for (const appPath of Object.keys(workspaces)) {
|
|
2603
|
+
const filled = [];
|
|
2604
|
+
const envPath = join(process.cwd(), appPath, '.env');
|
|
2605
|
+
try {
|
|
2606
|
+
const raw = await fs.readFile(envPath, 'utf-8');
|
|
2607
|
+
for (const line of raw.split(LIB_REGEX_LINEBREAK_CRLF_OR_LF)) {
|
|
2608
|
+
const keyMatch = line.match(LIB_REGEX_PATTERN_ENV_VAR_KEY);
|
|
2609
|
+
if (keyMatch === null) {
|
|
2610
|
+
continue;
|
|
2611
|
+
}
|
|
2612
|
+
const separatorIndex = line.indexOf('=');
|
|
2613
|
+
const rawValue = line.slice(separatorIndex + 1).trim();
|
|
2614
|
+
let inner = rawValue;
|
|
2615
|
+
if ((inner.startsWith('"') === true
|
|
2616
|
+
&& inner.endsWith('"') === true)
|
|
2617
|
+
|| (inner.startsWith('\'') === true
|
|
2618
|
+
&& inner.endsWith('\'') === true)) {
|
|
2619
|
+
inner = inner.slice(1, -1);
|
|
2620
|
+
}
|
|
2621
|
+
if (inner.trim() !== '') {
|
|
2622
|
+
filled.push(keyMatch[1] ?? '');
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
}
|
|
2626
|
+
catch {
|
|
2627
|
+
}
|
|
2628
|
+
Reflect.set(result, appPath, filled);
|
|
2629
|
+
}
|
|
2630
|
+
return result;
|
|
2631
|
+
}
|
|
2632
|
+
static async promptEnvironmentReconcile(config, mutate) {
|
|
2633
|
+
const environment = (config['environment'] !== undefined) ? config['environment'] : {};
|
|
2634
|
+
const managedSet = libEnvManagedSet.compute(config);
|
|
2635
|
+
const githubState = await libEnvGithub.read();
|
|
2636
|
+
if (githubState['available'] === false) {
|
|
2637
|
+
Logger.customize({
|
|
2638
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2639
|
+
purpose: 'unavailable',
|
|
2640
|
+
padTop: 1,
|
|
2641
|
+
padBottom: 1,
|
|
2642
|
+
}).warn('The "gh" CLI is not installed or not authenticated. Install and run "gh auth login" to view or reconcile GitHub keys.');
|
|
2643
|
+
return;
|
|
2644
|
+
}
|
|
2645
|
+
const status = libEnvStatus.classify(managedSet, githubState, environment);
|
|
2646
|
+
const statusLines = status.map((entry) => `${entry['name']}: ${entry['state']}`);
|
|
2647
|
+
const localEnv = await Runner.readLocalFilledKeys(config);
|
|
2648
|
+
const localOrphanEntries = libEnvStatus.localOrphans(environment, localEnv);
|
|
2649
|
+
const localOrphanLines = localOrphanEntries.map((entry) => `${entry['name']}: ${entry['state']}`);
|
|
2650
|
+
const combinedLines = [
|
|
2651
|
+
...statusLines,
|
|
2652
|
+
...localOrphanLines,
|
|
2653
|
+
];
|
|
2654
|
+
const statusMessage = (combinedLines.length > 0) ? combinedLines.join('\n') : 'No managed keys were found on GitHub.';
|
|
2655
|
+
Logger.customize({
|
|
2656
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2657
|
+
purpose: 'status',
|
|
2658
|
+
padTop: 1,
|
|
2659
|
+
padBottom: 1,
|
|
2660
|
+
}).info(statusMessage);
|
|
2661
|
+
if (mutate === false) {
|
|
2662
|
+
return;
|
|
2663
|
+
}
|
|
2664
|
+
const plan = libEnvReconcile.plan(status);
|
|
2665
|
+
const secretByName = {};
|
|
2666
|
+
for (const managed of managedSet) {
|
|
2667
|
+
Reflect.set(secretByName, managed['name'], managed['secret']);
|
|
2668
|
+
}
|
|
2669
|
+
const applyResult = await libEnvReconcile.apply(plan, secretByName, Runner['promptEnvironmentReconcileConfirm']);
|
|
2670
|
+
if (applyResult['available'] === false) {
|
|
2671
|
+
Logger.customize({
|
|
2672
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2673
|
+
purpose: 'unavailable',
|
|
2674
|
+
padTop: 1,
|
|
2675
|
+
padBottom: 1,
|
|
2676
|
+
}).warn('The "gh" CLI became unavailable before changes could be applied.');
|
|
2677
|
+
return;
|
|
2678
|
+
}
|
|
2679
|
+
const resultMessage = `Reconcile complete. Applied ${applyResult['done'].length}, remaining ${applyResult['remaining'].length}.`;
|
|
2680
|
+
Logger.customize({
|
|
2681
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2682
|
+
purpose: 'applied',
|
|
2683
|
+
padTop: 1,
|
|
2684
|
+
padBottom: 1,
|
|
2685
|
+
}).info(resultMessage);
|
|
2686
|
+
const createdStubs = plan['create'].filter((createName) => applyResult['done'].includes(createName) === true);
|
|
2687
|
+
if (createdStubs.length > 0) {
|
|
2688
|
+
const stubNotice = [
|
|
2689
|
+
`Created placeholder stubs on GitHub: ${createdStubs.join(', ')}.`,
|
|
2690
|
+
'Set their real values in GitHub before deploying.',
|
|
2691
|
+
].join('\n');
|
|
2692
|
+
Logger.customize({
|
|
2693
|
+
name: 'Runner.promptEnvironmentReconcile',
|
|
2694
|
+
purpose: 'stub-notice',
|
|
2695
|
+
padTop: 1,
|
|
2696
|
+
padBottom: 1,
|
|
2697
|
+
}).warn(stubNotice);
|
|
2698
|
+
}
|
|
2699
|
+
return;
|
|
2700
|
+
}
|
|
2701
|
+
static async promptEnvironmentReconcileConfirm(pendingPlan) {
|
|
2702
|
+
const summary = `create ${pendingPlan['create'].length}, delete ${pendingPlan['delete'].length}, restore ${pendingPlan['restore'].length}`;
|
|
2703
|
+
const confirmOutput = await Runner.promptWithCancel({
|
|
2704
|
+
type: 'confirm',
|
|
2705
|
+
name: 'confirm',
|
|
2706
|
+
message: `Apply these GitHub changes (${summary})?`,
|
|
2707
|
+
initial: false,
|
|
2708
|
+
});
|
|
2709
|
+
if (confirmOutput['cancelled'] === true) {
|
|
2710
|
+
return false;
|
|
2711
|
+
}
|
|
2712
|
+
return confirmOutput['result'].confirm === true;
|
|
2713
|
+
}
|
|
2714
|
+
static async promptEnvironmentScope(config, options) {
|
|
2715
|
+
const isWorkspace = options['scope'] === 'workspace';
|
|
2716
|
+
const appPath = options['appPath'];
|
|
2717
|
+
const environment = (config['environment'] !== undefined) ? config['environment'] : {};
|
|
2718
|
+
const existingWorkspaces = (environment['workspaces'] !== undefined) ? environment['workspaces'] : {};
|
|
2719
|
+
const existingBlock = (isWorkspace === true && appPath !== undefined) ? existingWorkspaces[appPath] : environment['project'];
|
|
2720
|
+
let prefix = (existingBlock !== undefined) ? existingBlock['prefix'] : '';
|
|
2721
|
+
const variables = (existingBlock !== undefined && existingBlock['variables'] !== undefined) ? [...existingBlock['variables']] : [];
|
|
2722
|
+
const sync = () => {
|
|
2723
|
+
const hasContent = prefix !== '';
|
|
2724
|
+
const nextEnvironment = (config['environment'] !== undefined) ? config['environment'] : {};
|
|
2725
|
+
if (isWorkspace === true && appPath !== undefined) {
|
|
2726
|
+
const nextWorkspaces = (nextEnvironment['workspaces'] !== undefined) ? nextEnvironment['workspaces'] : {};
|
|
2727
|
+
if (hasContent === true) {
|
|
2728
|
+
const workspaceBlock = { prefix };
|
|
2729
|
+
if (variables.length > 0) {
|
|
2730
|
+
Object.assign(workspaceBlock, { variables: [...variables] });
|
|
2731
|
+
}
|
|
2732
|
+
Reflect.set(nextWorkspaces, appPath, workspaceBlock);
|
|
2733
|
+
}
|
|
2734
|
+
else {
|
|
2735
|
+
Reflect.deleteProperty(nextWorkspaces, appPath);
|
|
2736
|
+
}
|
|
2737
|
+
if (Object.keys(nextWorkspaces).length > 0) {
|
|
2738
|
+
Object.assign(nextEnvironment, { workspaces: nextWorkspaces });
|
|
2739
|
+
}
|
|
2740
|
+
else {
|
|
2741
|
+
Reflect.deleteProperty(nextEnvironment, 'workspaces');
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
else if (hasContent === true) {
|
|
2745
|
+
const projectBlock = { prefix };
|
|
2746
|
+
if (variables.length > 0) {
|
|
2747
|
+
Object.assign(projectBlock, { variables: [...variables] });
|
|
2748
|
+
}
|
|
2749
|
+
Object.assign(nextEnvironment, { project: projectBlock });
|
|
2750
|
+
}
|
|
2751
|
+
else {
|
|
2752
|
+
Reflect.deleteProperty(nextEnvironment, 'project');
|
|
2753
|
+
}
|
|
2754
|
+
if (Object.keys(nextEnvironment).length > 0) {
|
|
2755
|
+
Object.assign(config, { environment: nextEnvironment });
|
|
2756
|
+
}
|
|
2757
|
+
else {
|
|
2758
|
+
Reflect.deleteProperty(config, 'environment');
|
|
2759
|
+
}
|
|
2760
|
+
return;
|
|
2761
|
+
};
|
|
2762
|
+
while (true) {
|
|
2763
|
+
const choices = [];
|
|
2764
|
+
const prefixDisplay = (prefix !== '') ? prefix : '(unset)';
|
|
2765
|
+
choices.push({
|
|
2766
|
+
title: `${chalk.cyan.bold('[PREFIX]')} ${prefixDisplay}`,
|
|
2767
|
+
description: 'Set the GitHub name prefix for this namespace.',
|
|
2768
|
+
value: {
|
|
2769
|
+
kind: 'prefix',
|
|
2770
|
+
},
|
|
2771
|
+
});
|
|
2772
|
+
for (let i = 0; i < variables.length; i += 1) {
|
|
2773
|
+
const variable = variables[i];
|
|
2774
|
+
if (variable === undefined) {
|
|
2775
|
+
continue;
|
|
2776
|
+
}
|
|
2777
|
+
const variableKind = ('secret' in variable && variable['secret'] === true) ? 'secret' : 'variable';
|
|
2778
|
+
const variableLabel = `${variable['key']} (${variableKind})`;
|
|
2779
|
+
choices.push({
|
|
2780
|
+
title: `${chalk.yellow.bold('[EDIT]')} ${variableLabel}`,
|
|
2781
|
+
description: 'Update this value.',
|
|
2782
|
+
value: {
|
|
2783
|
+
kind: 'edit',
|
|
2784
|
+
index: i,
|
|
2785
|
+
},
|
|
2786
|
+
});
|
|
2787
|
+
choices.push({
|
|
2788
|
+
title: `${chalk.red.bold('[REMOVE]')} ${variableLabel}`,
|
|
2789
|
+
description: 'Delete this value.',
|
|
2790
|
+
value: {
|
|
2791
|
+
kind: 'remove',
|
|
2792
|
+
index: i,
|
|
2793
|
+
},
|
|
2794
|
+
});
|
|
2795
|
+
}
|
|
2796
|
+
choices.push({
|
|
2797
|
+
title: 'Add a value',
|
|
2798
|
+
description: 'Add a new environment value to this namespace.',
|
|
2799
|
+
value: {
|
|
2800
|
+
kind: 'add',
|
|
2801
|
+
},
|
|
2802
|
+
});
|
|
2803
|
+
choices.push({
|
|
2804
|
+
title: 'Back',
|
|
2805
|
+
description: 'Return to the environment menu.',
|
|
2806
|
+
value: {
|
|
2807
|
+
kind: 'back',
|
|
2808
|
+
},
|
|
2809
|
+
});
|
|
2810
|
+
const menuOutput = await Runner.promptWithCancel({
|
|
2811
|
+
type: 'select',
|
|
2812
|
+
name: 'action',
|
|
2813
|
+
message: (isWorkspace === true && appPath !== undefined) ? `Manage environment for "${appPath}".` : 'Manage the project environment namespace.',
|
|
2814
|
+
choices,
|
|
2815
|
+
});
|
|
2816
|
+
if (menuOutput['cancelled'] === true) {
|
|
2817
|
+
sync();
|
|
2818
|
+
return 'back';
|
|
2819
|
+
}
|
|
2820
|
+
const menuOutputResultValue = menuOutput['result'];
|
|
2821
|
+
if (menuOutputResultValue.action === undefined
|
|
2822
|
+
|| menuOutputResultValue.action['kind'] === 'back') {
|
|
2823
|
+
sync();
|
|
2824
|
+
return 'back';
|
|
2825
|
+
}
|
|
2826
|
+
if (menuOutputResultValue.action['kind'] === 'prefix') {
|
|
2827
|
+
const prefixOutput = await Runner.promptWithCancel({
|
|
2828
|
+
type: 'text',
|
|
2829
|
+
name: 'prefix',
|
|
2830
|
+
message: 'GitHub name prefix (e.g. "CBN_"):',
|
|
2831
|
+
initial: prefix,
|
|
2832
|
+
validate: Runner['isNonEmptyLiteralInput'],
|
|
2833
|
+
});
|
|
2834
|
+
if (prefixOutput['cancelled'] === true) {
|
|
2835
|
+
continue;
|
|
2836
|
+
}
|
|
2837
|
+
const prefixInput = prefixOutput['result'].prefix.trim().toUpperCase();
|
|
2838
|
+
if (prefixInput === '') {
|
|
2839
|
+
continue;
|
|
2840
|
+
}
|
|
2841
|
+
if (libEnvNamespace.isReservedPrefix(prefixInput) === true) {
|
|
2842
|
+
Logger.customize({
|
|
2843
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2844
|
+
purpose: 'reservedPrefix',
|
|
2845
|
+
padTop: 1,
|
|
2846
|
+
padBottom: 1,
|
|
2847
|
+
}).error(`The prefix "${prefixInput}" is reserved by GitHub. Choose a prefix that does not start with "GITHUB_".`);
|
|
2848
|
+
continue;
|
|
2849
|
+
}
|
|
2850
|
+
prefix = prefixInput;
|
|
2851
|
+
sync();
|
|
2852
|
+
Logger.customize({
|
|
2853
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2854
|
+
purpose: 'prefix',
|
|
2855
|
+
padTop: 1,
|
|
2856
|
+
padBottom: 1,
|
|
2857
|
+
}).info(`Set prefix to "${prefix}".`);
|
|
2858
|
+
continue;
|
|
2859
|
+
}
|
|
2860
|
+
if (menuOutputResultValue.action['kind'] === 'add') {
|
|
2861
|
+
if (prefix === '') {
|
|
2862
|
+
Logger.customize({
|
|
2863
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2864
|
+
purpose: 'prefixRequired',
|
|
2865
|
+
padTop: 1,
|
|
2866
|
+
padBottom: 1,
|
|
2867
|
+
}).error('Set a prefix for this namespace before adding values.');
|
|
2868
|
+
continue;
|
|
2869
|
+
}
|
|
2870
|
+
const addValue = await Runner.promptEnvironmentValueForm(undefined, isWorkspace);
|
|
2871
|
+
if (addValue === undefined) {
|
|
2872
|
+
continue;
|
|
2873
|
+
}
|
|
2874
|
+
variables.push(addValue);
|
|
2875
|
+
sync();
|
|
2876
|
+
Logger.customize({
|
|
2877
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2878
|
+
purpose: 'add',
|
|
2879
|
+
padTop: 1,
|
|
2880
|
+
padBottom: 1,
|
|
2881
|
+
}).info(`Added value "${addValue['key']}".`);
|
|
2882
|
+
continue;
|
|
2883
|
+
}
|
|
2884
|
+
if (menuOutputResultValue.action['kind'] === 'edit') {
|
|
2885
|
+
const editIndex = menuOutputResultValue.action['index'];
|
|
2886
|
+
if (editIndex < 0 || editIndex >= variables.length) {
|
|
2887
|
+
continue;
|
|
2888
|
+
}
|
|
2889
|
+
const editValue = await Runner.promptEnvironmentValueForm(variables[editIndex], isWorkspace);
|
|
2890
|
+
if (editValue === undefined) {
|
|
2891
|
+
continue;
|
|
2892
|
+
}
|
|
2893
|
+
Reflect.set(variables, editIndex, editValue);
|
|
2894
|
+
sync();
|
|
2895
|
+
Logger.customize({
|
|
2896
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2897
|
+
purpose: 'edit',
|
|
2898
|
+
padTop: 1,
|
|
2899
|
+
padBottom: 1,
|
|
2900
|
+
}).info(`Updated value "${editValue['key']}".`);
|
|
2901
|
+
continue;
|
|
2902
|
+
}
|
|
2903
|
+
if (menuOutputResultValue.action['kind'] === 'remove') {
|
|
2904
|
+
const removeIndex = menuOutputResultValue.action['index'];
|
|
2905
|
+
if (removeIndex < 0 || removeIndex >= variables.length) {
|
|
2906
|
+
continue;
|
|
2907
|
+
}
|
|
2908
|
+
const variableToRemove = variables[removeIndex];
|
|
2909
|
+
if (variableToRemove === undefined) {
|
|
2910
|
+
continue;
|
|
2911
|
+
}
|
|
2912
|
+
const removeOutput = await Runner.promptWithCancel({
|
|
2913
|
+
type: 'confirm',
|
|
2914
|
+
name: 'confirm',
|
|
2915
|
+
message: `Remove value "${variableToRemove['key']}"?`,
|
|
2916
|
+
initial: false,
|
|
2917
|
+
});
|
|
2918
|
+
if (removeOutput['cancelled'] === true) {
|
|
2919
|
+
continue;
|
|
2920
|
+
}
|
|
2921
|
+
if (removeOutput['result'].confirm !== true) {
|
|
2922
|
+
continue;
|
|
2923
|
+
}
|
|
2924
|
+
const dropLocalOutput = await Runner.promptWithCancel({
|
|
2925
|
+
type: 'confirm',
|
|
2926
|
+
name: 'dropLocal',
|
|
2927
|
+
message: `Also remove "${variableToRemove['key']}" from your local ".env" on the next dotenv run?`,
|
|
2928
|
+
initial: false,
|
|
2929
|
+
});
|
|
2930
|
+
if (dropLocalOutput['cancelled'] === false && dropLocalOutput['result'].dropLocal === true) {
|
|
2931
|
+
Logger.customize({
|
|
2932
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2933
|
+
purpose: 'dropLocal',
|
|
2934
|
+
padTop: 1,
|
|
2935
|
+
padBottom: 1,
|
|
2936
|
+
}).info(`To also drop "${variableToRemove['key']}" from your local ".env", run "generate must-haves dotenv --prune".`);
|
|
2937
|
+
}
|
|
2938
|
+
variables.splice(removeIndex, 1);
|
|
2939
|
+
sync();
|
|
2940
|
+
Logger.customize({
|
|
2941
|
+
name: 'Runner.promptEnvironmentScope',
|
|
2942
|
+
purpose: 'remove',
|
|
2943
|
+
padTop: 1,
|
|
2944
|
+
padBottom: 1,
|
|
2945
|
+
}).info(`Removed value "${variableToRemove['key']}".`);
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
static async promptEnvironmentValueForm(existing, isWorkspace) {
|
|
2950
|
+
const keyOutput = await Runner.promptWithCancel({
|
|
2951
|
+
type: 'text',
|
|
2952
|
+
name: 'key',
|
|
2953
|
+
message: 'Value key (SCREAMING_SNAKE_CASE, without the prefix):',
|
|
2954
|
+
initial: (existing !== undefined) ? existing['key'] : '',
|
|
2955
|
+
validate: Runner['isNonEmptyLiteralInput'],
|
|
2956
|
+
});
|
|
2957
|
+
if (keyOutput['cancelled'] === true) {
|
|
2958
|
+
return undefined;
|
|
2959
|
+
}
|
|
2960
|
+
const key = keyOutput['result'].key.trim().toUpperCase();
|
|
2961
|
+
if (libEnvNamespace.isGithubLegalName(key) === false) {
|
|
2962
|
+
Logger.customize({
|
|
2963
|
+
name: 'Runner.promptEnvironmentValueForm',
|
|
2964
|
+
purpose: 'illegalKey',
|
|
2965
|
+
padTop: 1,
|
|
2966
|
+
padBottom: 1,
|
|
2967
|
+
}).error(`The key "${key}" is not a legal GitHub name. Use letters, digits, and underscores, and do not start with a digit or "GITHUB_".`);
|
|
2968
|
+
return undefined;
|
|
2969
|
+
}
|
|
2970
|
+
let reach = 'managed';
|
|
2971
|
+
if (isWorkspace === true) {
|
|
2972
|
+
const reachValues = [
|
|
2973
|
+
'local',
|
|
2974
|
+
'managed',
|
|
2975
|
+
'build',
|
|
2976
|
+
'runtime',
|
|
2977
|
+
];
|
|
2978
|
+
let reachInitial = reachValues.indexOf('build');
|
|
2979
|
+
if (existing !== undefined) {
|
|
2980
|
+
const existingReachIndex = reachValues.indexOf(existing['reach']);
|
|
2981
|
+
if (existingReachIndex !== -1) {
|
|
2982
|
+
reachInitial = existingReachIndex;
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
const reachOutput = await Runner.promptWithCancel({
|
|
2986
|
+
type: 'select',
|
|
2987
|
+
name: 'reach',
|
|
2988
|
+
message: 'Where does this value travel?',
|
|
2989
|
+
choices: [
|
|
2990
|
+
{
|
|
2991
|
+
title: 'local (.env only, never GitHub)',
|
|
2992
|
+
value: 'local',
|
|
2993
|
+
},
|
|
2994
|
+
{
|
|
2995
|
+
title: 'managed (GitHub only, delivered nowhere)',
|
|
2996
|
+
value: 'managed',
|
|
2997
|
+
},
|
|
2998
|
+
{
|
|
2999
|
+
title: 'build (GitHub, baked into the build)',
|
|
3000
|
+
value: 'build',
|
|
3001
|
+
},
|
|
3002
|
+
{
|
|
3003
|
+
title: 'runtime (GitHub, synced to the server)',
|
|
3004
|
+
value: 'runtime',
|
|
3005
|
+
},
|
|
3006
|
+
],
|
|
3007
|
+
initial: reachInitial,
|
|
3008
|
+
});
|
|
3009
|
+
if (reachOutput['cancelled'] === true) {
|
|
3010
|
+
return undefined;
|
|
3011
|
+
}
|
|
3012
|
+
reach = reachOutput['result'].reach;
|
|
3013
|
+
}
|
|
3014
|
+
const isLocal = reach === 'local';
|
|
3015
|
+
let secret = false;
|
|
3016
|
+
if (isLocal === false) {
|
|
3017
|
+
let secretInitial = true;
|
|
3018
|
+
if (existing !== undefined && 'secret' in existing) {
|
|
3019
|
+
secretInitial = existing['secret'];
|
|
3020
|
+
}
|
|
3021
|
+
const secretOutput = await Runner.promptWithCancel({
|
|
3022
|
+
type: 'confirm',
|
|
3023
|
+
name: 'secret',
|
|
3024
|
+
message: 'Store as a GitHub Secret (encrypted)? Choose no for a Variable (plaintext).',
|
|
3025
|
+
initial: secretInitial,
|
|
3026
|
+
});
|
|
3027
|
+
if (secretOutput['cancelled'] === true) {
|
|
3028
|
+
return undefined;
|
|
3029
|
+
}
|
|
3030
|
+
secret = secretOutput['result'].secret === true;
|
|
3031
|
+
}
|
|
3032
|
+
const value = {
|
|
3033
|
+
key,
|
|
3034
|
+
reach,
|
|
3035
|
+
};
|
|
3036
|
+
if (isLocal === false) {
|
|
3037
|
+
Reflect.set(value, 'secret', secret);
|
|
3038
|
+
}
|
|
3039
|
+
if (reach !== 'managed' && secret === false) {
|
|
3040
|
+
let defaultValueInitial = '';
|
|
3041
|
+
if (existing !== undefined
|
|
3042
|
+
&& 'defaultValue' in existing
|
|
3043
|
+
&& existing['defaultValue'] !== undefined) {
|
|
3044
|
+
defaultValueInitial = existing['defaultValue'];
|
|
3045
|
+
}
|
|
3046
|
+
const defaultValueOutput = await Runner.promptWithCancel({
|
|
3047
|
+
type: 'text',
|
|
3048
|
+
name: 'defaultValue',
|
|
3049
|
+
message: 'Default value for the committed ".env.sample" (optional):',
|
|
3050
|
+
initial: defaultValueInitial,
|
|
3051
|
+
});
|
|
3052
|
+
if (defaultValueOutput['cancelled'] === false) {
|
|
3053
|
+
const defaultValue = defaultValueOutput['result'].defaultValue.trim();
|
|
3054
|
+
if (defaultValue !== '') {
|
|
3055
|
+
Reflect.set(value, 'defaultValue', defaultValue);
|
|
3056
|
+
}
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
return value;
|
|
3060
|
+
}
|
|
2466
3061
|
static async promptWorkspaces(config) {
|
|
2467
3062
|
const workspaces = (config['workspaces'] !== undefined) ? { ...(config['workspaces']) } : {};
|
|
3063
|
+
const recipes = (config['recipes'] !== undefined) ? { ...(config['recipes']) } : {};
|
|
3064
|
+
const packageJsonRecipes = (recipes['package-json'] !== undefined) ? { ...(recipes['package-json']) } : {};
|
|
2468
3065
|
const rawWorkspacePaths = await discoverPathsWithFile('package.json', 'forward');
|
|
2469
3066
|
const workspacePaths = rawWorkspacePaths.map((rawWorkspacePath) => {
|
|
2470
3067
|
const currentWorkingDirectory = process.cwd();
|
|
@@ -2520,6 +3117,7 @@ export class Runner {
|
|
|
2520
3117
|
const formResult = await Runner.promptWorkspacesForm({
|
|
2521
3118
|
workspacePath,
|
|
2522
3119
|
existingWorkspace: workspaces[workspacePath],
|
|
3120
|
+
existingPackageJsonRecipes: packageJsonRecipes[workspacePath],
|
|
2523
3121
|
projectSlug: (config['project'] !== undefined && config['project']['name'] !== undefined) ? config['project']['name']['slug'] : undefined,
|
|
2524
3122
|
});
|
|
2525
3123
|
if (formResult['action'] === 'back') {
|
|
@@ -2527,6 +3125,19 @@ export class Runner {
|
|
|
2527
3125
|
}
|
|
2528
3126
|
Reflect.set(workspaces, workspacePath, formResult['workspace']);
|
|
2529
3127
|
Object.assign(config, { workspaces });
|
|
3128
|
+
if (Object.keys(formResult['packageJsonRecipes']).length > 0) {
|
|
3129
|
+
Reflect.set(packageJsonRecipes, workspacePath, formResult['packageJsonRecipes']);
|
|
3130
|
+
}
|
|
3131
|
+
else {
|
|
3132
|
+
Reflect.deleteProperty(packageJsonRecipes, workspacePath);
|
|
3133
|
+
}
|
|
3134
|
+
if (Object.keys(packageJsonRecipes).length > 0) {
|
|
3135
|
+
Reflect.set(recipes, 'package-json', packageJsonRecipes);
|
|
3136
|
+
}
|
|
3137
|
+
else {
|
|
3138
|
+
Reflect.deleteProperty(recipes, 'package-json');
|
|
3139
|
+
}
|
|
3140
|
+
Object.assign(config, { recipes });
|
|
2530
3141
|
Logger.customize({
|
|
2531
3142
|
name: 'Runner.promptWorkspaces',
|
|
2532
3143
|
purpose: 'updated',
|
|
@@ -2658,33 +3269,15 @@ export class Runner {
|
|
|
2658
3269
|
action: 'back',
|
|
2659
3270
|
};
|
|
2660
3271
|
}
|
|
2661
|
-
const
|
|
2662
|
-
return Runner.normalizeText(workspaceDisplayNameValue, Infinity)['result'];
|
|
2663
|
-
};
|
|
2664
|
-
const displayNamePrompt = await Runner.promptWithCancel({
|
|
2665
|
-
type: 'text',
|
|
2666
|
-
name: 'workspaceDisplayName',
|
|
2667
|
-
message: 'Workspace display name (optional)',
|
|
2668
|
-
initial: (options['existingWorkspace'] !== undefined) ? options['existingWorkspace']['displayName'] ?? '' : '',
|
|
2669
|
-
validate: validateWorkspaceDisplayName,
|
|
2670
|
-
});
|
|
2671
|
-
if (displayNamePrompt['cancelled'] === true) {
|
|
2672
|
-
return {
|
|
2673
|
-
action: 'back',
|
|
2674
|
-
};
|
|
2675
|
-
}
|
|
2676
|
-
const workspaceDisplayNameInput = Runner.normalizeText(displayNamePrompt['result'].workspaceDisplayName, Infinity)['sanitized'];
|
|
2677
|
-
const existingRecipes = (options['existingWorkspace'] !== undefined && options['existingWorkspace']['recipes'] !== undefined) ? options['existingWorkspace']['recipes'] : undefined;
|
|
2678
|
-
const existingDotenv = (options['existingWorkspace'] !== undefined && options['existingWorkspace']['dotenv'] !== undefined) ? options['existingWorkspace']['dotenv'] : undefined;
|
|
3272
|
+
const existingRecipes = options['existingPackageJsonRecipes'];
|
|
2679
3273
|
const recipesPrompt = await Runner.promptWithCancel({
|
|
2680
3274
|
type: 'multiselect',
|
|
2681
3275
|
name: 'workspaceRecipes',
|
|
2682
3276
|
message: 'Select recipes to enable',
|
|
2683
3277
|
choices: libItemAllowedRecipes.map((recipe) => {
|
|
2684
|
-
const
|
|
2685
|
-
const recipeSelected = (
|
|
2686
|
-
&&
|
|
2687
|
-
&& recipeTuple[0] === true);
|
|
3278
|
+
const recipeEntry = (existingRecipes !== undefined) ? Reflect.get(existingRecipes, recipe) : undefined;
|
|
3279
|
+
const recipeSelected = (recipeEntry !== undefined
|
|
3280
|
+
&& recipeEntry['enabled'] === true);
|
|
2688
3281
|
return {
|
|
2689
3282
|
title: recipe,
|
|
2690
3283
|
value: recipe,
|
|
@@ -2700,9 +3293,8 @@ export class Runner {
|
|
|
2700
3293
|
const selectedRecipes = recipesPrompt['result'].workspaceRecipes;
|
|
2701
3294
|
const recipes = {};
|
|
2702
3295
|
for (const recipe of selectedRecipes) {
|
|
2703
|
-
const
|
|
2704
|
-
const
|
|
2705
|
-
const existingSettings = (existingTuple !== undefined && existingTuple.length > 1) ? existingTuple[1] : undefined;
|
|
3296
|
+
const existingEntry = (existingRecipes !== undefined) ? Reflect.get(existingRecipes, recipe) : undefined;
|
|
3297
|
+
const existingSettings = (existingEntry !== undefined) ? existingEntry['settings'] : undefined;
|
|
2706
3298
|
if (recipe === 'sync-identity' && selectedPolicy === 'distributable') {
|
|
2707
3299
|
const identitySettingsPrompt = await Runner.promptWithCancel({
|
|
2708
3300
|
type: 'multiselect',
|
|
@@ -2719,6 +3311,11 @@ export class Runner {
|
|
|
2719
3311
|
value: 'keywords',
|
|
2720
3312
|
selected: existingSettings !== undefined && existingSettings['keywords'] === true,
|
|
2721
3313
|
},
|
|
3314
|
+
{
|
|
3315
|
+
title: 'displayName',
|
|
3316
|
+
value: 'displayName',
|
|
3317
|
+
selected: existingSettings !== undefined && existingSettings['displayName'] === true,
|
|
3318
|
+
},
|
|
2722
3319
|
],
|
|
2723
3320
|
});
|
|
2724
3321
|
if (identitySettingsPrompt['cancelled'] === true) {
|
|
@@ -2732,13 +3329,15 @@ export class Runner {
|
|
|
2732
3329
|
for (const setting of identitySelectedSettings) {
|
|
2733
3330
|
Reflect.set(identitySettings, setting, true);
|
|
2734
3331
|
}
|
|
2735
|
-
Reflect.set(recipes, recipe,
|
|
2736
|
-
true,
|
|
2737
|
-
identitySettings,
|
|
2738
|
-
|
|
3332
|
+
Reflect.set(recipes, recipe, {
|
|
3333
|
+
enabled: true,
|
|
3334
|
+
settings: identitySettings,
|
|
3335
|
+
});
|
|
2739
3336
|
}
|
|
2740
3337
|
else {
|
|
2741
|
-
Reflect.set(recipes, recipe,
|
|
3338
|
+
Reflect.set(recipes, recipe, {
|
|
3339
|
+
enabled: true,
|
|
3340
|
+
});
|
|
2742
3341
|
}
|
|
2743
3342
|
}
|
|
2744
3343
|
else if (recipe === 'sync-ownership' && selectedPolicy === 'distributable') {
|
|
@@ -2790,13 +3389,15 @@ export class Runner {
|
|
|
2790
3389
|
for (const setting of ownershipSelectedSettings) {
|
|
2791
3390
|
Reflect.set(ownershipSettings, setting, true);
|
|
2792
3391
|
}
|
|
2793
|
-
Reflect.set(recipes, recipe,
|
|
2794
|
-
true,
|
|
2795
|
-
ownershipSettings,
|
|
2796
|
-
|
|
3392
|
+
Reflect.set(recipes, recipe, {
|
|
3393
|
+
enabled: true,
|
|
3394
|
+
settings: ownershipSettings,
|
|
3395
|
+
});
|
|
2797
3396
|
}
|
|
2798
3397
|
else {
|
|
2799
|
-
Reflect.set(recipes, recipe,
|
|
3398
|
+
Reflect.set(recipes, recipe, {
|
|
3399
|
+
enabled: true,
|
|
3400
|
+
});
|
|
2800
3401
|
}
|
|
2801
3402
|
}
|
|
2802
3403
|
else if (recipe === 'sync-environment') {
|
|
@@ -2821,13 +3422,15 @@ export class Runner {
|
|
|
2821
3422
|
for (const setting of environmentSelectedSettings) {
|
|
2822
3423
|
Reflect.set(environmentSettings, setting, true);
|
|
2823
3424
|
}
|
|
2824
|
-
Reflect.set(recipes, recipe,
|
|
2825
|
-
true,
|
|
2826
|
-
environmentSettings,
|
|
2827
|
-
|
|
3425
|
+
Reflect.set(recipes, recipe, {
|
|
3426
|
+
enabled: true,
|
|
3427
|
+
settings: environmentSettings,
|
|
3428
|
+
});
|
|
2828
3429
|
}
|
|
2829
3430
|
else {
|
|
2830
|
-
Reflect.set(recipes, recipe,
|
|
3431
|
+
Reflect.set(recipes, recipe, {
|
|
3432
|
+
enabled: true,
|
|
3433
|
+
});
|
|
2831
3434
|
}
|
|
2832
3435
|
}
|
|
2833
3436
|
else if (recipe === 'cleanup') {
|
|
@@ -2859,13 +3462,15 @@ export class Runner {
|
|
|
2859
3462
|
for (const setting of cleanupSelectedSettings) {
|
|
2860
3463
|
Reflect.set(cleanupSettings, setting, true);
|
|
2861
3464
|
}
|
|
2862
|
-
Reflect.set(recipes, recipe,
|
|
2863
|
-
true,
|
|
2864
|
-
cleanupSettings,
|
|
2865
|
-
|
|
3465
|
+
Reflect.set(recipes, recipe, {
|
|
3466
|
+
enabled: true,
|
|
3467
|
+
settings: cleanupSettings,
|
|
3468
|
+
});
|
|
2866
3469
|
}
|
|
2867
3470
|
else {
|
|
2868
|
-
Reflect.set(recipes, recipe,
|
|
3471
|
+
Reflect.set(recipes, recipe, {
|
|
3472
|
+
enabled: true,
|
|
3473
|
+
});
|
|
2869
3474
|
}
|
|
2870
3475
|
}
|
|
2871
3476
|
else if (recipe === 'normalize-dependencies') {
|
|
@@ -2897,29 +3502,31 @@ export class Runner {
|
|
|
2897
3502
|
for (const setting of dependenciesSelectedSettings) {
|
|
2898
3503
|
Reflect.set(dependenciesSettings, setting, true);
|
|
2899
3504
|
}
|
|
2900
|
-
Reflect.set(recipes, recipe,
|
|
2901
|
-
true,
|
|
2902
|
-
dependenciesSettings,
|
|
2903
|
-
|
|
3505
|
+
Reflect.set(recipes, recipe, {
|
|
3506
|
+
enabled: true,
|
|
3507
|
+
settings: dependenciesSettings,
|
|
3508
|
+
});
|
|
2904
3509
|
}
|
|
2905
3510
|
else {
|
|
2906
|
-
Reflect.set(recipes, recipe,
|
|
3511
|
+
Reflect.set(recipes, recipe, {
|
|
3512
|
+
enabled: true,
|
|
3513
|
+
});
|
|
2907
3514
|
}
|
|
2908
3515
|
}
|
|
2909
3516
|
else {
|
|
2910
|
-
Reflect.set(recipes, recipe,
|
|
3517
|
+
Reflect.set(recipes, recipe, {
|
|
3518
|
+
enabled: true,
|
|
3519
|
+
});
|
|
2911
3520
|
}
|
|
2912
3521
|
}
|
|
2913
3522
|
return {
|
|
2914
3523
|
action: 'apply',
|
|
2915
3524
|
workspace: {
|
|
2916
3525
|
name: resolvedName,
|
|
2917
|
-
...(workspaceDisplayNameInput !== undefined) ? { displayName: workspaceDisplayNameInput } : {},
|
|
2918
3526
|
role: selectedRole,
|
|
2919
3527
|
policy: selectedPolicy,
|
|
2920
|
-
...(Object.keys(recipes).length > 0) ? { recipes } : {},
|
|
2921
|
-
...(existingDotenv !== undefined) ? { dotenv: existingDotenv } : {},
|
|
2922
3528
|
},
|
|
3529
|
+
packageJsonRecipes: recipes,
|
|
2923
3530
|
};
|
|
2924
3531
|
}
|
|
2925
3532
|
static async promptWithCancel(questions) {
|