1- import type { CategoryConfig , PluginMeta } from '@code-pushup/models' ;
1+ import type { PluginCodegenResult } from '@code-pushup/models' ;
22import type { MonorepoTool } from '@code-pushup/utils' ;
33
4+ export type {
5+ ImportDeclarationStructure ,
6+ PluginCodegenResult ,
7+ PluginPromptDescriptor ,
8+ PluginSetupBinding ,
9+ } from '@code-pushup/models' ;
10+
411export const CI_PROVIDERS = [ 'github' , 'gitlab' , 'none' ] as const ;
512export type CiProvider = ( typeof CI_PROVIDERS ) [ number ] ;
613
@@ -24,50 +31,6 @@ export type CliArgs = {
2431 [ key : string ] : unknown ;
2532} ;
2633
27- type PromptBase = {
28- key : string ;
29- message : string ;
30- } ;
31-
32- type PromptChoice < T extends string > = { name : string ; value : T } ;
33-
34- type InputPrompt = PromptBase & {
35- type : 'input' ;
36- default : string ;
37- } ;
38-
39- type SelectPrompt < T extends string = string > = PromptBase & {
40- type : 'select' ;
41- choices : PromptChoice < T > [ ] ;
42- default : T ;
43- } ;
44-
45- type CheckboxPrompt < T extends string = string > = PromptBase & {
46- type : 'checkbox' ;
47- choices : PromptChoice < T > [ ] ;
48- default : T [ ] ;
49- } ;
50-
51- /** Declarative prompt definition used to collect plugin-specific options. */
52- export type PluginPromptDescriptor =
53- | InputPrompt
54- | SelectPrompt
55- | CheckboxPrompt ;
56-
57- export type ImportDeclarationStructure = {
58- moduleSpecifier : string ;
59- defaultImport ?: string ;
60- namedImports ?: string [ ] ;
61- isTypeOnly ?: boolean ;
62- } ;
63-
64- /** Import declarations and plugin initialization code produced by `generateConfig`. */
65- export type PluginCodegenResult = {
66- imports : ImportDeclarationStructure [ ] ;
67- pluginInit : string ;
68- categories ?: CategoryConfig [ ] ;
69- } ;
70-
7134export type ScopedPluginResult = {
7235 scope : PluginScope ;
7336 result : PluginCodegenResult ;
@@ -79,27 +42,6 @@ export type ConfigContext = {
7942 tool : MonorepoTool | null ;
8043} ;
8144
82- /**
83- * Defines how a plugin integrates with the setup wizard.
84- *
85- * Each supported plugin provides a binding that controls:
86- * - Pre-selection: `isRecommended` detects if the plugin is relevant for the repository
87- * - Configuration: `prompts` collect plugin-specific options interactively
88- * - Code generation: `generateConfig` produces the import and initialization code
89- */
90- export type PluginSetupBinding = {
91- slug : PluginMeta [ 'slug' ] ;
92- title : PluginMeta [ 'title' ] ;
93- packageName : NonNullable < PluginMeta [ 'packageName' ] > ;
94- prompts ?: PluginPromptDescriptor [ ] ;
95- scope ?: PluginScope ;
96- isRecommended ?: ( targetDir : string ) => Promise < boolean > ;
97- generateConfig : (
98- answers : Record < string , string | string [ ] > ,
99- context : ConfigContext ,
100- ) => PluginCodegenResult ;
101- } ;
102-
10345/** A project discovered in a monorepo workspace. */
10446export type WizardProject = {
10547 name : string ;
0 commit comments