Skip to content

Comments

feat(create-cli): setup wizard architecture#1248

Open
hanna-skryl wants to merge 5 commits intomainfrom
setup-wizard-architecture
Open

feat(create-cli): setup wizard architecture#1248
hanna-skryl wants to merge 5 commits intomainfrom
setup-wizard-architecture

Conversation

@hanna-skryl
Copy link
Collaborator

@hanna-skryl hanna-skryl commented Feb 17, 2026

Closes #1240

Break create-cli's dependency on nx-plugin and rebuild the package around a modular setup wizard. Uses ts-morph for AST-based config generation, @inquirer/prompts for interactive input, and a virtual Tree for buffered file writes with dry-run support.

@github-actions github-actions bot added 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🛠️ tooling 🧩 create-cli labels Feb 17, 2026
@nx-cloud
Copy link

nx-cloud bot commented Feb 17, 2026

View your CI Pipeline Execution ↗ for commit 875ff60

Command Status Duration Result
nx affected -t e2e-test --parallel=1 ❌ Failed 12m 40s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-23 18:42:03 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 17, 2026

Open in StackBlitz

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1248

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1248

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1248

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1248

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1248

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1248

@code-pushup/axe-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/axe-plugin@1248

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1248

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1248

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1248

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1248

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1248

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1248

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1248

commit: 875ff60

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit d1f33c6 with previous commit 4c80af5.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Performance 🔴 33 🔴 37 ↑ +3.9
Documentation 🟡 53 🟡 51 ↓ −2
Updates 🟡 72 🟡 73 ↑ +0.8
Code coverage 🟢 93 🟢 93 ↑ +0.1
Bug prevention 🟡 75 🟡 75 ↓ −0.1
Axe Accessibility 🟡 88 🟡 88 ↓ −0.1
Code style 🟢 100 🟢 100
Security 🔴 0 🔴 0
Type Safety 🟡 67 🟡 67
Miscellaneous 🟡 67 🟡 67
Accessibility 🟢 92 🟢 92
Best Practices 🟢 97 🟢 97
SEO 🟢 92 🟢 92
👍 3 groups improved, 👎 1 group regressed, 👍 9 audits improved, 👎 5 audits regressed, 14 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Lighthouse Performance 🔴 33 🔴 37 ↑ +3.9
JSDocs coverage Documentation coverage 🟡 53 🟡 51 ↓ −2
JS packages npm outdated dependencies 🟡 72 🟡 73 ↑ +0.8
Code coverage Code coverage metrics 🟢 93 🟢 93 ↑ +0.1

30 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse First Contentful Paint 🟥 3.4 s 🟥 3.0 s ↓ −9.9 %
Lighthouse Total Blocking Time 🟥 2,750 ms 🟥 1,650 ms ↓ −40 %
JSDocs coverage Methods coverage 🟨 10 undocumented methods 🟨 14 undocumented methods ↑ +40 %
Lighthouse Speed Index 🟥 7.0 s 🟥 6.6 s ↓ −5.6 %
JSDocs coverage Classes coverage 🟨 5 undocumented classes 🟨 6 undocumented classes ↑ +20 %
Lighthouse Time to Interactive 🟥 14.4 s 🟥 14.0 s ↓ −2.4 %
JS packages Outdated npm prod dependencies. 🟨 21 outdated package versions (7 major, 11 minor, 3 patch) 🟨 22 outdated package versions (7 major, 12 minor, 3 patch) ↑ +4.8 %
JSDocs coverage Properties coverage 🟥 43 undocumented properties 🟥 45 undocumented properties ↑ +4.7 %
JSDocs coverage Types coverage 🟥 264 undocumented types 🟥 275 undocumented types ↑ +4.2 %
JSDocs coverage Functions coverage 🟥 585 undocumented functions 🟥 590 undocumented functions ↑ +0.9 %
JSDocs coverage Variables coverage 🟥 273 undocumented variables 🟥 271 undocumented variables ↓ −0.7 %
Code coverage Function coverage 🟩 94.4 % 🟩 94.5 % ↑ +0.1 %
Code coverage Branch coverage 🟨 89.2 % 🟨 89.2 % ↑ +0.1 %
Code coverage Line coverage 🟩 92.7 % 🟩 92.7 % ↑ +0.1 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,136 KiB 🟩 Total size was 2,129 KiB ↓ −0.3 %
Lighthouse Minimizes main-thread work 🟥 13.9 s 🟥 10.4 s ↓ −25.2 %
Lighthouse JavaScript execution time 🟥 5.5 s 🟥 3.1 s ↓ −42.4 %
Lighthouse Largest Contentful Paint 🟥 11.6 s 🟥 10.3 s ↓ −10.8 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 31 resources found ↑ +0.1 %
Lighthouse Max Potential First Input Delay 🟥 1,650 ms 🟥 1,000 ms ↓ −39.4 %
Lighthouse Server Backend Latencies 🟩 1,280 ms 🟩 710 ms ↓ −44.7 %
Lighthouse Metrics 🟩 100% 🟩 100% ↓ −2.4 %
Lighthouse Network Round Trip Times 🟩 60 ms 🟩 30 ms ↓ −50.8 %
Lighthouse Initial server response time was short 🟩 Root document took 500 ms 🟩 Root document took 480 ms ↓ −3.8 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 255 KiB 🟥 Potential savings of 256 KiB ↑ +0.8 %
Lighthouse Remove duplicate modules in JavaScript bundles 🟥 Potential savings of 80 KiB 🟥 Potential savings of 80 KiB ↑ +3.2 %
TypeScript Semantic errors 🟥 37 errors 🟥 38 errors ↑ +2.7 %
Lighthouse Avoids an excessive DOM size 🟥 2,360 elements 🟥 2,359 elements ↓ −0.1 %

650 other audits are unchanged.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit d1f33c6 with previous commit 4c80af5.

💼 Project create-cli

🤨 Code PushUp report has both improvements and regressions.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Documentation 🟡 64 🔴 19 ↓ −44.8
Code coverage 🟢 96 🟢 98 ↑ +1.8

4 other categories are unchanged.

👍 1 group improved, 👎 1 group regressed, 👍 3 audits improved, 👎 3 audits regressed, 2 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
JSDocs coverage Documentation coverage 🟡 64 🔴 19 ↓ −44.8
Code coverage Code coverage metrics 🟢 96 🟢 98 ↑ +1.8

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
JSDocs coverage Methods coverage 🟩 0 undocumented methods 🟥 4 undocumented methods ↑ +∞ %
JSDocs coverage Properties coverage 🟩 0 undocumented properties 🟥 2 undocumented properties ↑ +∞ %
JSDocs coverage Classes coverage 🟩 0 undocumented classes 🟥 1 undocumented classes ↑ +∞ %
JSDocs coverage Types coverage 🟥 1 undocumented types 🟥 12 undocumented types ↑ +1100 %
Code coverage Branch coverage 🟨 87.5 % 🟩 93.2 % ↑ +6.5 %
Code coverage Line coverage 🟩 97 % 🟩 98.5 % ↑ +1.5 %
JSDocs coverage Functions coverage 🟥 6 undocumented functions 🟥 11 undocumented functions ↑ +83.3 %
JSDocs coverage Variables coverage 🟥 5 undocumented variables 🟥 3 undocumented variables ↓ −40 %

435 other audits are unchanged.

💼 Project utils

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Documentation 🟡 60 🟡 60 ↑ +0.1

5 other categories are unchanged.

👍 1 group improved

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
JSDocs coverage Documentation coverage 🟡 60 🟡 60 ↑ +0.1

14 other groups are unchanged.

🛡️ Audits

All of 444 audits are unchanged.


12 other projects are unchanged.

@hanna-skryl hanna-skryl marked this pull request as ready for review February 17, 2026 18:33
Copy link
Collaborator

@matejchalk matejchalk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really promising 🙂

Comment on lines 19 to 22
function buildExportStatement(plugins: PluginCodegenResult[]): string {
const items = plugins.map(({ pluginInit }) => pluginInit).join(', ');
return `export default { plugins: [${items}] } satisfies CoreConfig;`;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using StatementStructures? It seems a bit more robust than concatenating strings. The plugins could also register their init code as an AST.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided to drop the dependency on ts-morph. @BioPhoton is right to question this choice: it adds unnecessary complexity. I replaced it with a small CodeBuilder class that should suffice for the current and future use cases.

Comment on lines 7 to 11
[
"import type { CoreConfig } from '@code-pushup/models';",
'export default { plugins: [] } satisfies CoreConfig;',
'',
].join('\n'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be more readable to have a separator line between the imports and the config export. 🙏

Comment on lines 59 to 67
expect(generateConfigSource(plugins)).toBe(
[
"import type { CoreConfig } from '@code-pushup/models';",
"import eslintPlugin from '@code-pushup/eslint-plugin';",
"import coveragePlugin from '@code-pushup/coverage-plugin';",
"export default { plugins: [await eslintPlugin(), await coveragePlugin({ reports: [{ resultsPath: 'coverage/lcov.info', pathToProject: '' }] })] } satisfies CoreConfig;",
'',
].join('\n'),
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generates quite a long line. Does ts-morph not wrap long lines? If not, we could run prettier on the output.

@BioPhoton
Copy link
Collaborator

As a nit pick question I want to understand if we could choose another library that ts-morph to achieve the same goal.

The library is old and slow and I thought nowadays must be a more performant lib on the market.

What I can say about ts-morph is,
ts-morph adds:
• heavy TS compiler dependency
• performance cost
• complexity
• unnecessary type-checking

Instead we could write a small typed builder:

generateConfig({
  imports: [...],
  plugins: [...],
  categories: [...]
})

Or use @swc/core AST builder:
• Extremely fast
• No type-checker
• Pure syntax
• Lightweight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧩 create-cli 📖 Project documentation improvements or additions to the project documentation 🔬 testing writing tests 🛠️ tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Architecture for setup wizard

3 participants