flu-cli-core 1.0.4 → 1.1.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 +22 -17
- package/dist/chunk-BGYZU6TU.js +466 -0
- package/dist/chunk-QGM4M3NI.js +37 -0
- package/dist/factory-LM2CTHPW.js +7 -0
- package/dist/factory-P6ABQFH3.js +7 -0
- package/dist/index.cjs +18901 -3313
- package/dist/index.d.cts +833 -72
- package/dist/index.d.ts +833 -72
- package/dist/index.js +18569 -3132
- package/dist/upgrade_snippets-BJ6CQY5Q.js +9 -0
- package/package.json +9 -4
- package/templates/README.md +12 -0
- package/templates/core_files/auth/auth_middleware.dart.template +33 -0
- package/templates/core_files/auth/auth_service.dart.template +22 -0
- package/templates/core_files/auth/auth_viewmodel_mixin.dart.template +9 -0
- package/templates/core_files/auth/index.dart.template +4 -0
- package/templates/core_files/base/base_service.dart.template +12 -0
- package/templates/core_files/base/index.dart.template +3 -0
- package/templates/core_files/config/agreement_document_page.dart.template +220 -0
- package/templates/core_files/config/app_agreement.dart.template +297 -0
- package/templates/core_files/config/app_config.dart.template +81 -22
- package/templates/core_files/config/app_env.dart.template +107 -0
- package/templates/core_files/config/app_initializer.dart.template +16 -23
- package/templates/core_files/config/index.dart.template +4 -1
- package/templates/core_files/config/privacy_dialog.dart.template +158 -0
- package/templates/core_files/index.dart.template +3 -0
- package/templates/core_files/mixins/page/keep_alive_mixin.dart.template +6 -0
- package/templates/core_files/mixins/page/scroll_controller_mixin.dart.template +7 -0
- package/templates/core_files/mixins/service/request_guard_mixin.dart.template +18 -0
- package/templates/core_files/mixins/viewmodel/debounce_mixin.dart.template +18 -0
- package/templates/core_files/network/app_http.dart.template +19 -4
- package/templates/core_files/network/index.dart.template +4 -0
- package/templates/core_files/network/interceptors/global_params_interceptor.dart.template +77 -0
- package/templates/core_files/network/interceptors/index.dart.template +3 -0
- package/templates/core_files/network/network_monitor.dart.template +18 -0
- package/templates/core_files/network/response_adapter.dart.template +8 -19
- package/templates/core_files/router/app_routes.dart.template +3 -6
- package/templates/core_files/storage/storage_keys.dart.template +6 -0
- package/templates/core_files/theme/app_color_config.dart.template +32 -0
- package/templates/core_files/theme/app_text_size_config.dart.template +22 -0
- package/templates/core_files/theme/app_text_style_config.dart.template +139 -0
- package/templates/core_files/theme/app_theme.dart.template +72 -12
- package/templates/core_files/theme/index.dart.template +3 -0
- package/templates/core_files/utils/loading_util.dart.template +1 -1
- package/templates/examples/eg_list_page.dart.template +1 -2
- package/templates/examples/eg_service.dart.template +27 -4
- package/templates/examples/home_feed_service.dart.template +37 -0
- package/templates/helper_examples/image_picker_example_page.dart.template +289 -0
- package/templates/helper_examples/index.dart.template +4 -0
- package/templates/helper_examples/payment_shell_example_page.dart.template +67 -0
- package/templates/helper_examples/permission_example_page.dart.template +365 -0
- package/templates/helper_examples/webview_example_page.dart.template +44 -0
- package/templates/helpers/image_picker/README.md.template +30 -0
- package/templates/helpers/image_picker/index.dart.template +73 -0
- package/templates/helpers/payment/README.md.template +29 -0
- package/templates/helpers/payment/index.dart.template +66 -0
- package/templates/helpers/permission/README.md.template +30 -0
- package/templates/helpers/permission/index.dart.template +67 -0
- package/templates/helpers/webview/README.md.template +29 -0
- package/templates/helpers/webview/index.dart.template +88 -0
- package/templates/snippets/flu-cli.code-snippets +35 -26
- package/templates/starter_project/.env.dev.template +14 -0
- package/templates/starter_project/.env.prod.example.template +14 -0
- package/templates/starter_project/.env.staging.template +14 -0
- package/templates/starter_project/.vscode/launch.json.template +54 -0
- package/templates/starter_project/DEVELOPER_GUIDE.md.template +150 -0
- package/templates/starter_project/README.md.template +99 -0
- package/templates/starter_project/analysis_options.yaml.template +28 -0
- package/templates/starter_project/lib/app.dart.template +22 -0
- package/templates/starter_project/lib/main.dart.template +34 -0
- package/templates/starter_project/lib/pages/splash_page.dart.template +154 -0
- package/templates/template_clean/lib/features/home/data/datasources/index.dart +1 -0
- package/templates/template_clean/lib/features/home/data/models/index.dart +1 -0
- package/templates/template_clean/lib/features/home/domain/index.dart +1 -0
- package/templates/template_clean/lib/features/home/presentation/pages/home_page.dart +290 -0
- package/templates/template_clean/lib/features/home/presentation/pages/index.dart +2 -0
- package/templates/template_clean/lib/features/home/presentation/pages/splash_page.dart +154 -0
- package/templates/template_clean/lib/features/home/presentation/viewmodels/home_viewmodel.dart +17 -0
- package/templates/template_clean/lib/features/index.dart +2 -0
- package/templates/template_clean/lib/features/user/data/datasources/home_feed_service.dart +37 -0
- package/templates/template_clean/lib/features/user/data/datasources/index.dart +4 -0
- package/templates/template_clean/lib/features/user/data/models/index.dart +3 -0
- package/templates/template_clean/lib/features/user/data/models/user.dart +15 -0
- package/templates/template_clean/lib/features/user/domain/index.dart +1 -0
- package/templates/template_clean/lib/features/user/presentation/pages/index.dart +1 -0
- package/templates/template_clean/lib/features/user/presentation/pages/user_list_page.dart +27 -0
- package/templates/template_clean/lib/features/user/presentation/viewmodels/user_list_viewmodel.dart +88 -0
- package/templates/template_clean/lib/features/user/presentation/widgets/user_item_card.dart +24 -0
- package/templates/template_clean/lib/shared/extensions/index.dart +1 -0
- package/templates/template_clean/lib/shared/widgets/index.dart +1 -0
- package/templates/template_lite/lib/models/index.dart +1 -0
- package/templates/template_lite/lib/pages/home_page.dart +290 -0
- package/templates/template_lite/lib/pages/index.dart +3 -0
- package/templates/template_lite/lib/pages/splash_page.dart +154 -0
- package/templates/template_lite/lib/pages/user_list_page.dart +29 -0
- package/templates/template_lite/lib/services/home_feed_service.dart +37 -0
- package/templates/template_lite/lib/services/index.dart +5 -0
- package/templates/template_lite/lib/utils/index.dart +1 -0
- package/templates/template_lite/lib/viewmodels/home_viewmodel.dart +34 -0
- package/templates/template_lite/lib/viewmodels/index.dart +2 -0
- package/templates/template_lite/lib/viewmodels/user_list_viewmodel.dart +103 -0
- package/templates/template_lite/lib/widgets/index.dart +1 -0
- package/templates/template_lite/lib/widgets/user_item_widget.dart +57 -0
- package/templates/template_modular/lib/features/home/index.dart +2 -0
- package/templates/template_modular/lib/features/home/models/index.dart +1 -0
- package/templates/template_modular/lib/features/home/pages/home_page.dart +290 -0
- package/templates/template_modular/lib/features/home/pages/index.dart +2 -0
- package/templates/template_modular/lib/features/home/pages/splash_page.dart +154 -0
- package/templates/template_modular/lib/features/home/services/index.dart +1 -0
- package/templates/template_modular/lib/features/home/viewmodels/home_viewmodel.dart +17 -0
- package/templates/template_modular/lib/features/index.dart +2 -0
- package/templates/template_modular/lib/features/user/index.dart +6 -0
- package/templates/template_modular/lib/features/user/pages/user_list_page.dart +26 -0
- package/templates/template_modular/lib/features/user/services/home_feed_service.dart +37 -0
- package/templates/template_modular/lib/features/user/viewmodels/user_list_viewmodel.dart +103 -0
- package/templates/template_modular/lib/features/user/widgets/user_item_widget.dart +24 -0
- package/templates/template_modular/lib/shared/utils/index.dart +1 -0
- package/templates/template_modular/lib/shared/widgets/index.dart +1 -0
package/dist/index.d.ts
CHANGED
|
@@ -25,6 +25,8 @@ declare const logger: ConsoleLogger;
|
|
|
25
25
|
/**
|
|
26
26
|
* 转换为 PascalCase
|
|
27
27
|
* home_page -> HomePage
|
|
28
|
+
* homePage -> HomePage(保留已有 camelCase 单词边界)
|
|
29
|
+
* refreshToken -> RefreshToken
|
|
28
30
|
*/
|
|
29
31
|
declare function toPascalCase(str: string): string;
|
|
30
32
|
/**
|
|
@@ -101,6 +103,232 @@ declare function loadProjectSnippets(projectDir: string): any;
|
|
|
101
103
|
declare function renderSnippet(bodyLines: string[] | string, variables: Record<string, any>): string;
|
|
102
104
|
declare function getSnippetContent(projectDir: string, key: string, variables: Record<string, any>): string | null;
|
|
103
105
|
|
|
106
|
+
type GeneratorType = 'page' | 'viewModel' | 'widget' | 'component' | 'model' | 'service';
|
|
107
|
+
interface ResolveGeneratorDirOptions {
|
|
108
|
+
projectRoot: string;
|
|
109
|
+
type: GeneratorType;
|
|
110
|
+
feature?: string | null;
|
|
111
|
+
name?: string;
|
|
112
|
+
clickedPath?: string | null;
|
|
113
|
+
}
|
|
114
|
+
interface MirrorDirOptions {
|
|
115
|
+
sourceBaseDir: string;
|
|
116
|
+
sourceTargetDir: string;
|
|
117
|
+
targetBaseDir: string;
|
|
118
|
+
}
|
|
119
|
+
interface ResolveImportOptions {
|
|
120
|
+
configuredImport?: string | null;
|
|
121
|
+
fromFile: string;
|
|
122
|
+
projectRoot: string;
|
|
123
|
+
fallbackImport?: string | null;
|
|
124
|
+
}
|
|
125
|
+
declare function resolveGeneratorBaseDir(options: ResolveGeneratorDirOptions): string;
|
|
126
|
+
declare function resolveGeneratorTargetDir(options: ResolveGeneratorDirOptions): string;
|
|
127
|
+
declare function mirrorNestedTargetDir(options: MirrorDirOptions): string;
|
|
128
|
+
declare function resolveConfiguredImport(options: ResolveImportOptions): string | null;
|
|
129
|
+
declare function calculateRelativeImport(fromFile: string, toFile: string): string;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* 项目配置管理器
|
|
133
|
+
* 职责:读取和管理项目级别的 .flu-cli.json 配置文件
|
|
134
|
+
*/
|
|
135
|
+
/**
|
|
136
|
+
* 架构模式
|
|
137
|
+
* - `inherit` / `mixin`:旧值,保留向后兼容,不注入职责约定
|
|
138
|
+
* - `mvvm` / `bloc` / `clean` / `native`:v2 架构模式,可配合 contracts 注入 AI 规则
|
|
139
|
+
*/
|
|
140
|
+
type ArchitectureMode = 'inherit' | 'mixin' | 'mvvm' | 'bloc' | 'clean' | 'native';
|
|
141
|
+
interface ArchitectureContracts {
|
|
142
|
+
/** Service 层禁止直接发 HTTP 请求给 ViewModel/Bloc(默认 false) */
|
|
143
|
+
forbidHttpInStateLayer?: boolean;
|
|
144
|
+
/** Service 层禁止返回 dynamic / Map<String,dynamic> 给状态层(默认 false) */
|
|
145
|
+
forbidDynamicReturn?: boolean;
|
|
146
|
+
/** 错误处理约定:result(Result<T>)/ exception(抛异常)/ either(Either/Failure) */
|
|
147
|
+
errorHandling?: 'result' | 'exception' | 'either';
|
|
148
|
+
}
|
|
149
|
+
interface ArchitectureConfig {
|
|
150
|
+
mode?: ArchitectureMode;
|
|
151
|
+
contracts?: ArchitectureContracts;
|
|
152
|
+
}
|
|
153
|
+
type StateManagement = 'provider' | 'riverpod' | 'bloc' | 'getx' | 'mobx' | 'none';
|
|
154
|
+
type RouterPackage = 'go_router' | 'auto_route' | 'getx' | 'navigator' | 'none';
|
|
155
|
+
type DiPackage = 'get_it' | 'injectable' | 'riverpod' | 'getx' | 'none';
|
|
156
|
+
interface NetworkConfig {
|
|
157
|
+
package?: 'dio' | 'http' | string;
|
|
158
|
+
/** 响应包装类型,如 `BaseResponse<T>`;为空则不强制包装 */
|
|
159
|
+
responseWrapper?: string;
|
|
160
|
+
}
|
|
161
|
+
/** 顶层模型生成约定(区别于 generators.model 的生成器路径配置) */
|
|
162
|
+
interface TopLevelModelConfig {
|
|
163
|
+
/** 模型生成方式:手写 / freezed / json_serializable */
|
|
164
|
+
strategy?: 'manual' | 'freezed' | 'json_serializable';
|
|
165
|
+
/** 是否需要 build_runner(strategy 为 freezed/json_serializable 时自动为 true) */
|
|
166
|
+
buildRunner?: boolean;
|
|
167
|
+
/** *.g.dart / *.freezed.dart 是否纳入版本库 */
|
|
168
|
+
commitGeneratedFiles?: boolean;
|
|
169
|
+
}
|
|
170
|
+
interface LintConfig {
|
|
171
|
+
/** minimal:仅 flutter_lints;strict:团队增强规则集 */
|
|
172
|
+
preset?: 'minimal' | 'strict';
|
|
173
|
+
}
|
|
174
|
+
interface UiStyleConfig {
|
|
175
|
+
/** 优先使用增量包裹风格(body = Wrapper(child: body)),而非直接嵌套 */
|
|
176
|
+
incrementalWrap?: boolean;
|
|
177
|
+
/** 单个 build 方法内最大嵌套层数(超出建议拆 Widget) */
|
|
178
|
+
maxNestingDepth?: number;
|
|
179
|
+
}
|
|
180
|
+
interface UiConfig {
|
|
181
|
+
style?: UiStyleConfig;
|
|
182
|
+
}
|
|
183
|
+
interface GeneratorSelectableOption$1 {
|
|
184
|
+
name: string;
|
|
185
|
+
import: string;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* 生成器配置接口
|
|
189
|
+
*/
|
|
190
|
+
interface GeneratorConfig {
|
|
191
|
+
path?: string;
|
|
192
|
+
allowSubDir?: boolean;
|
|
193
|
+
defaultType?: 'stateful' | 'stateless';
|
|
194
|
+
fileSuffix?: string;
|
|
195
|
+
fileName?: string;
|
|
196
|
+
policy?: GeneratorFieldPolicy;
|
|
197
|
+
baseOptionDirs?: string[];
|
|
198
|
+
mixinOptionDirs?: string[];
|
|
199
|
+
baseOptions?: GeneratorSelectableOption$1[];
|
|
200
|
+
mixinOptions?: GeneratorSelectableOption$1[];
|
|
201
|
+
native?: boolean;
|
|
202
|
+
mixins?: string[];
|
|
203
|
+
mixinImports?: string[];
|
|
204
|
+
withBasePage?: boolean;
|
|
205
|
+
basePageClass?: string;
|
|
206
|
+
baseListPageClass?: string;
|
|
207
|
+
basePageImport?: string;
|
|
208
|
+
withViewModel?: boolean;
|
|
209
|
+
viewModelPath?: string;
|
|
210
|
+
withBaseViewModel?: boolean;
|
|
211
|
+
baseViewModelClass?: string;
|
|
212
|
+
baseListViewModelClass?: string;
|
|
213
|
+
baseViewModelImport?: string;
|
|
214
|
+
withBaseWidget?: boolean;
|
|
215
|
+
baseWidgetClass?: string;
|
|
216
|
+
baseWidgetImport?: string;
|
|
217
|
+
withBaseModel?: boolean;
|
|
218
|
+
baseModelClass?: string;
|
|
219
|
+
baseModelImport?: string;
|
|
220
|
+
template?: 'network' | 'simple' | 'auto' | string;
|
|
221
|
+
snippetKey?: string;
|
|
222
|
+
mockLevel?: 'global' | 'instance';
|
|
223
|
+
baseServiceClass?: string;
|
|
224
|
+
baseServiceImport?: string;
|
|
225
|
+
serviceConstructor?: 'const' | 'normal';
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* 项目配置接口(`.flu-cli.json` 的完整类型)
|
|
229
|
+
*/
|
|
230
|
+
interface ProjectConfig {
|
|
231
|
+
/**
|
|
232
|
+
* 项目最初使用的脚手架类型(lite / modular / clean 等),**仅作文档与元数据**。
|
|
233
|
+
* 不参与 generators 默认值的推断;生效约定以 `generators` 与磁盘上的完整配置为准。
|
|
234
|
+
*/
|
|
235
|
+
template?: 'lite' | 'modular' | 'clean' | string;
|
|
236
|
+
architecture?: ArchitectureConfig;
|
|
237
|
+
packageName?: string;
|
|
238
|
+
/** 状态管理框架 */
|
|
239
|
+
stateManagement?: StateManagement;
|
|
240
|
+
/** 路由/导航方案 */
|
|
241
|
+
router?: RouterPackage;
|
|
242
|
+
/** 网络层约定 */
|
|
243
|
+
network?: NetworkConfig;
|
|
244
|
+
/** 依赖注入方案 */
|
|
245
|
+
di?: DiPackage;
|
|
246
|
+
/** 顶层模型生成约定(区别于 generators.model 路径配置) */
|
|
247
|
+
model?: TopLevelModelConfig;
|
|
248
|
+
/** Lint 级别 */
|
|
249
|
+
lint?: LintConfig;
|
|
250
|
+
/** UI 编码风格约定 */
|
|
251
|
+
ui?: UiConfig;
|
|
252
|
+
generators?: {
|
|
253
|
+
page?: GeneratorConfig;
|
|
254
|
+
viewModel?: GeneratorConfig;
|
|
255
|
+
widget?: GeneratorConfig;
|
|
256
|
+
model?: GeneratorConfig;
|
|
257
|
+
component?: GeneratorConfig;
|
|
258
|
+
service?: GeneratorConfig;
|
|
259
|
+
module?: {
|
|
260
|
+
path?: string;
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
type ProjectConfigSource = 'disk' | 'inferred' | 'builtin';
|
|
265
|
+
type GeneratorPolicyMode = 'locked' | 'default';
|
|
266
|
+
type GeneratorFieldPolicy = Partial<Record<string, GeneratorPolicyMode>>;
|
|
267
|
+
interface ResolvedProjectConfig {
|
|
268
|
+
source: ProjectConfigSource;
|
|
269
|
+
config: ProjectConfig;
|
|
270
|
+
diagnostics: string[];
|
|
271
|
+
hasDiskConfig: boolean;
|
|
272
|
+
}
|
|
273
|
+
type GeneratorConfigType = 'page' | 'viewModel' | 'widget' | 'model' | 'component' | 'service';
|
|
274
|
+
/**
|
|
275
|
+
* 项目配置管理器
|
|
276
|
+
*/
|
|
277
|
+
declare class ProjectConfigManager {
|
|
278
|
+
private static CONFIG_FILE_NAME;
|
|
279
|
+
/**
|
|
280
|
+
* 加载项目配置
|
|
281
|
+
* @param projectDir 项目目录
|
|
282
|
+
* @returns 配置对象,如果不存在则返回 null
|
|
283
|
+
*/
|
|
284
|
+
static loadConfig(projectDir: string): ProjectConfig | null;
|
|
285
|
+
/**
|
|
286
|
+
* 检查项目是否有配置文件
|
|
287
|
+
* @param projectDir 项目目录
|
|
288
|
+
* @returns 是否存在配置文件
|
|
289
|
+
*/
|
|
290
|
+
static hasConfig(projectDir: string): boolean;
|
|
291
|
+
/**
|
|
292
|
+
* 解析运行时生效配置。
|
|
293
|
+
* 无 `.flu-cli.json` 时使用「custom」最小默认 generators,不再按目录结构套用 lite/modular/clean 全套预设;
|
|
294
|
+
* `template` 字段仅作元数据写入,不驱动合并基准。
|
|
295
|
+
*/
|
|
296
|
+
static resolveEffectiveConfig(projectDir: string): ResolvedProjectConfig;
|
|
297
|
+
/**
|
|
298
|
+
* 获取指定生成器的配置
|
|
299
|
+
* @param projectDir 项目目录
|
|
300
|
+
* @param generatorType 生成器类型
|
|
301
|
+
* @returns 生成器配置,如果不存在则返回 null
|
|
302
|
+
*/
|
|
303
|
+
static getGeneratorConfig(projectDir: string, generatorType: GeneratorConfigType): GeneratorConfig | null;
|
|
304
|
+
/**
|
|
305
|
+
* 仅根据目录结构推断模板类型。
|
|
306
|
+
*/
|
|
307
|
+
static inferTemplateFromStructure(projectDir: string): 'lite' | 'modular' | 'clean' | null;
|
|
308
|
+
/**
|
|
309
|
+
* 获取默认配置模板
|
|
310
|
+
* @param templateType 模板类型
|
|
311
|
+
* @returns 配置模板对象
|
|
312
|
+
*/
|
|
313
|
+
static getDefaultConfigTemplate(templateType: 'lite' | 'modular' | 'clean' | 'custom' | string): ProjectConfig;
|
|
314
|
+
private static readPackageName;
|
|
315
|
+
}
|
|
316
|
+
declare function getArchitectureMode(config?: ProjectConfig | null): ArchitectureMode;
|
|
317
|
+
declare function getGeneratorFieldPolicy(config: ProjectConfig | null | undefined, generatorType: GeneratorConfigType, field: string): GeneratorPolicyMode | null;
|
|
318
|
+
declare function isGeneratorFieldLocked(config: ProjectConfig | null | undefined, generatorType: GeneratorConfigType, field: string): boolean;
|
|
319
|
+
|
|
320
|
+
interface GeneratorSelectableOptionsReport {
|
|
321
|
+
ok: boolean;
|
|
322
|
+
projectDir: string;
|
|
323
|
+
target: GeneratorConfigType;
|
|
324
|
+
diagnostics: string[];
|
|
325
|
+
scannedBaseDirs: string[];
|
|
326
|
+
scannedMixinDirs: string[];
|
|
327
|
+
bases: GeneratorSelectableOption$1[];
|
|
328
|
+
mixins: GeneratorSelectableOption$1[];
|
|
329
|
+
}
|
|
330
|
+
declare function listGeneratorSelectableOptions(projectDir: string, target: GeneratorConfigType): GeneratorSelectableOptionsReport;
|
|
331
|
+
|
|
104
332
|
/**
|
|
105
333
|
* 模板生成器
|
|
106
334
|
* 负责生成各种类型的代码内容,供 Generator 和 Snippets 复用
|
|
@@ -117,11 +345,16 @@ declare class TemplateGenerator {
|
|
|
117
345
|
coreImportPath?: string;
|
|
118
346
|
baseClass?: string;
|
|
119
347
|
extraImports?: string[];
|
|
348
|
+
mixins?: string[];
|
|
349
|
+
mixinImports?: string[];
|
|
120
350
|
}): string;
|
|
121
351
|
/**
|
|
122
352
|
* 生成 Simple Stateful Page
|
|
123
353
|
*/
|
|
124
|
-
static generateSimpleStatefulPage(namePascal: string, nameTitle: string
|
|
354
|
+
static generateSimpleStatefulPage(namePascal: string, nameTitle: string, options?: {
|
|
355
|
+
mixins?: string[];
|
|
356
|
+
mixinImports?: string[];
|
|
357
|
+
}): string;
|
|
125
358
|
/**
|
|
126
359
|
* 生成 Simple Stateless Page
|
|
127
360
|
*/
|
|
@@ -133,6 +366,25 @@ declare class TemplateGenerator {
|
|
|
133
366
|
coreImportPath?: string;
|
|
134
367
|
baseClass?: string;
|
|
135
368
|
extraImports?: string[];
|
|
369
|
+
mixins?: string[];
|
|
370
|
+
mixinImports?: string[];
|
|
371
|
+
}): string;
|
|
372
|
+
static generateListViewModel(namePascal: string, modelName: string, options?: {
|
|
373
|
+
coreImportPath?: string;
|
|
374
|
+
modelImportPath?: string;
|
|
375
|
+
baseClass?: string;
|
|
376
|
+
extraImports?: string[];
|
|
377
|
+
mixins?: string[];
|
|
378
|
+
mixinImports?: string[];
|
|
379
|
+
}): string;
|
|
380
|
+
static generateListPageWithBase(namePascal: string, nameTitle: string, modelName: string, options?: {
|
|
381
|
+
vmImportPath?: string;
|
|
382
|
+
modelImportPath?: string;
|
|
383
|
+
coreImportPath?: string;
|
|
384
|
+
baseClass?: string;
|
|
385
|
+
extraImports?: string[];
|
|
386
|
+
mixins?: string[];
|
|
387
|
+
mixinImports?: string[];
|
|
136
388
|
}): string;
|
|
137
389
|
/**
|
|
138
390
|
* 生成 Service
|
|
@@ -158,6 +410,8 @@ declare class TemplateGenerator {
|
|
|
158
410
|
* 生成 Model
|
|
159
411
|
*/
|
|
160
412
|
static generateModel(namePascal: string): string;
|
|
413
|
+
private static sortImports;
|
|
414
|
+
private static getImportSortKey;
|
|
161
415
|
}
|
|
162
416
|
|
|
163
417
|
/**
|
|
@@ -170,16 +424,175 @@ declare class TemplateGenerator {
|
|
|
170
424
|
* @param {string} fileName - 要添加的文件名
|
|
171
425
|
*/
|
|
172
426
|
declare function updateIndexFile(dirPath: string, fileName: string): boolean;
|
|
427
|
+
/**
|
|
428
|
+
* 为嵌套目录级联更新 index.dart
|
|
429
|
+
* 例如:
|
|
430
|
+
* - pages/test/test_page.dart -> pages/test/index.dart export 'test_page.dart'
|
|
431
|
+
* - pages/index.dart -> export 'test/index.dart'
|
|
432
|
+
*/
|
|
433
|
+
declare function updateNestedIndexExports(rootDir: string, targetDir: string, fileName: string): boolean;
|
|
173
434
|
|
|
174
435
|
declare function getTemplatesRootDir(): string;
|
|
175
436
|
declare function getCoreFilesDir(): string;
|
|
176
437
|
declare function getNetworkDir(): string;
|
|
438
|
+
declare function getHelpersDir(): string;
|
|
439
|
+
declare function getCoreMixinsDir(): string;
|
|
440
|
+
declare function getHelperExamplesDir(): string;
|
|
441
|
+
declare function getStarterProjectDir(): string;
|
|
177
442
|
|
|
443
|
+
type ProjectStructureType = 'lite' | 'modular' | 'clean' | 'native' | string;
|
|
444
|
+
type StateManagerType = 'default' | 'provider' | 'getx' | 'bloc' | 'riverpod' | string;
|
|
445
|
+
type FlutterSdkMode = 'system' | 'fvm' | 'custom';
|
|
446
|
+
type CompositionProfile = 'base' | 'base_mixins' | 'pure_mixins' | 'pure';
|
|
447
|
+
type ProjectArchitectureMode = 'mvvm' | 'native';
|
|
448
|
+
type ProjectExampleId = 'networkGallery' | 'webviewBasic' | 'permissionBasic' | 'imagePickerBasic' | 'paymentShell' | string;
|
|
449
|
+
interface GeneratorSelectableOption {
|
|
450
|
+
name: string;
|
|
451
|
+
import: string;
|
|
452
|
+
}
|
|
453
|
+
interface ProjectCompositionConfig {
|
|
454
|
+
/** 当前真实架构模式:MVVM 标准架构或原生 Flutter。 */
|
|
455
|
+
architectureMode: ProjectArchitectureMode;
|
|
456
|
+
/** 是否准备 mixin 候选目录;不代表默认注入 mixin。 */
|
|
457
|
+
enableMixinOptions: boolean;
|
|
458
|
+
profile: CompositionProfile;
|
|
459
|
+
pageMixins: GeneratorSelectableOption[];
|
|
460
|
+
viewModelMixins: GeneratorSelectableOption[];
|
|
461
|
+
serviceMixins: GeneratorSelectableOption[];
|
|
462
|
+
}
|
|
463
|
+
interface FlutterSdkConfig {
|
|
464
|
+
mode: FlutterSdkMode;
|
|
465
|
+
version?: string;
|
|
466
|
+
flutterBin?: string;
|
|
467
|
+
}
|
|
468
|
+
interface ProjectCoreConfig {
|
|
469
|
+
enabled: boolean;
|
|
470
|
+
modules: {
|
|
471
|
+
boot: boolean;
|
|
472
|
+
config: boolean;
|
|
473
|
+
base: boolean;
|
|
474
|
+
list: boolean;
|
|
475
|
+
router: boolean;
|
|
476
|
+
theme: boolean;
|
|
477
|
+
storage: boolean;
|
|
478
|
+
utils: boolean;
|
|
479
|
+
widgets: boolean;
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
interface NetworkCapabilityConfig {
|
|
483
|
+
enabled: boolean;
|
|
484
|
+
client: 'dio' | string;
|
|
485
|
+
monitor: boolean;
|
|
486
|
+
/** 旧 network.examples 兼容字段;正式协议已上移到顶层 examples。 */
|
|
487
|
+
examples: boolean;
|
|
488
|
+
}
|
|
489
|
+
interface StorageCapabilityConfig {
|
|
490
|
+
enabled: boolean;
|
|
491
|
+
package: 'shared_preferences' | string;
|
|
492
|
+
}
|
|
493
|
+
interface SerializationCapabilityConfig {
|
|
494
|
+
enabled: boolean;
|
|
495
|
+
strategy: 'manual' | 'json_serializable' | 'freezed' | string;
|
|
496
|
+
buildRunner: boolean;
|
|
497
|
+
}
|
|
498
|
+
interface AuthCapabilityConfig {
|
|
499
|
+
enabled: boolean;
|
|
500
|
+
mode: 'basic' | string;
|
|
501
|
+
}
|
|
502
|
+
interface ProjectCapabilitiesConfig {
|
|
503
|
+
network: NetworkCapabilityConfig;
|
|
504
|
+
storage: StorageCapabilityConfig;
|
|
505
|
+
serialization: SerializationCapabilityConfig;
|
|
506
|
+
auth: AuthCapabilityConfig;
|
|
507
|
+
}
|
|
508
|
+
interface ProjectHelpersConfig {
|
|
509
|
+
payment: boolean;
|
|
510
|
+
webview: boolean;
|
|
511
|
+
permission: boolean;
|
|
512
|
+
imagePicker: boolean;
|
|
513
|
+
}
|
|
514
|
+
interface ProjectPlatformConfig {
|
|
515
|
+
platforms: string[];
|
|
516
|
+
flutterCreatePlatforms: string[];
|
|
517
|
+
flutterSdk: FlutterSdkConfig;
|
|
518
|
+
}
|
|
519
|
+
interface ProjectStackConfig {
|
|
520
|
+
stateManagement: StateManagerType;
|
|
521
|
+
network: {
|
|
522
|
+
enabled: boolean;
|
|
523
|
+
client: 'dio' | 'http' | 'none' | string;
|
|
524
|
+
};
|
|
525
|
+
serialization: SerializationCapabilityConfig;
|
|
526
|
+
router: 'go_router' | 'auto_route' | 'getx' | 'navigator' | 'none' | string;
|
|
527
|
+
di: 'get_it' | 'injectable' | 'riverpod' | 'getx' | 'none' | string;
|
|
528
|
+
lint: 'strict' | 'minimal' | string;
|
|
529
|
+
}
|
|
530
|
+
interface ProjectCreateConfig {
|
|
531
|
+
version: 2;
|
|
532
|
+
projectName: string;
|
|
533
|
+
packageName?: string;
|
|
534
|
+
templateType: ProjectStructureType;
|
|
535
|
+
stateManager: StateManagerType;
|
|
536
|
+
architectureMode: ProjectArchitectureMode;
|
|
537
|
+
enableMixinOptions: boolean;
|
|
538
|
+
/**
|
|
539
|
+
* 创建期顶层示例协议。
|
|
540
|
+
* 只用于本次创建时决定示例目录、首页演示和示例路由,不写入 .flu-cli.json。
|
|
541
|
+
*/
|
|
542
|
+
examples: ProjectExampleId[];
|
|
543
|
+
composition: ProjectCompositionConfig;
|
|
544
|
+
stack: ProjectStackConfig;
|
|
545
|
+
core: ProjectCoreConfig;
|
|
546
|
+
capabilities: ProjectCapabilitiesConfig;
|
|
547
|
+
helpers: ProjectHelpersConfig;
|
|
548
|
+
platform: ProjectPlatformConfig;
|
|
549
|
+
legacy: {
|
|
550
|
+
templateType?: string;
|
|
551
|
+
includeNetworkLayer?: unknown;
|
|
552
|
+
includeNetwork?: unknown;
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
type DeepPartial<T> = {
|
|
556
|
+
[K in keyof T]?: T[K] extends Array<unknown> ? T[K] : T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
557
|
+
};
|
|
558
|
+
type ProjectCreateConfigInput = DeepPartial<ProjectCreateConfig>;
|
|
559
|
+
interface NormalizeProjectCreateConfigOptions {
|
|
560
|
+
projectName?: string;
|
|
561
|
+
packageName?: string;
|
|
562
|
+
templateType?: string;
|
|
563
|
+
template?: string;
|
|
564
|
+
stateManager?: string;
|
|
565
|
+
architectureMode?: string;
|
|
566
|
+
enableMixinOptions?: boolean;
|
|
567
|
+
includeNetworkLayer?: unknown;
|
|
568
|
+
includeNetwork?: unknown;
|
|
569
|
+
examples?: ProjectExampleId[] | string;
|
|
570
|
+
platforms?: string[];
|
|
571
|
+
flutterSdk?: Partial<FlutterSdkConfig>;
|
|
572
|
+
composition?: DeepPartial<ProjectCompositionConfig>;
|
|
573
|
+
stack?: DeepPartial<ProjectStackConfig>;
|
|
574
|
+
projectCreate?: ProjectCreateConfigInput;
|
|
575
|
+
capabilities?: DeepPartial<ProjectCapabilitiesConfig>;
|
|
576
|
+
helpers?: Partial<ProjectHelpersConfig>;
|
|
577
|
+
}
|
|
578
|
+
declare function normalizeProjectCreateConfig(options?: NormalizeProjectCreateConfigOptions): ProjectCreateConfig;
|
|
579
|
+
declare function normalizeTemplateType(templateType: string): ProjectStructureType;
|
|
580
|
+
declare function normalizeNetworkEnabled(value: unknown): boolean;
|
|
581
|
+
declare function normalizePlatforms(platforms?: string[]): string[];
|
|
582
|
+
declare function normalizeFlutterCreatePlatform(platform: string): string;
|
|
583
|
+
declare function normalizeFlutterCreatePlatforms(platforms: string[]): string[];
|
|
584
|
+
declare function normalizeCompositionProfile(value: string): CompositionProfile;
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* 复制默认 Core 模板。
|
|
588
|
+
* vNext 优先读取 projectConfig;旧 includeNetworkLayer/templateType 继续保留兼容。
|
|
589
|
+
*/
|
|
178
590
|
declare function copyCoreFiles(projectPath: string, options?: {
|
|
179
591
|
includeNetworkLayer?: boolean;
|
|
180
592
|
templateType?: 'lite' | 'modular' | 'clean';
|
|
181
593
|
projectName?: string;
|
|
182
594
|
stateManager?: string;
|
|
595
|
+
projectConfig?: ProjectCreateConfig;
|
|
183
596
|
}): Promise<void>;
|
|
184
597
|
declare function copyNetworkFiles(projectPath: string, options?: {
|
|
185
598
|
targetDir?: string;
|
|
@@ -187,11 +600,33 @@ declare function copyNetworkFiles(projectPath: string, options?: {
|
|
|
187
600
|
}): Promise<void>;
|
|
188
601
|
declare function copyInfrastructure(projectPath: string, includeExamples?: boolean, includeNetworkLayer?: boolean, templateType?: 'lite' | 'modular' | 'clean'): Promise<void>;
|
|
189
602
|
|
|
603
|
+
/**
|
|
604
|
+
* 复制 project helpers。
|
|
605
|
+
* helpers 不属于 Core,本函数只负责把启用的 helper 投影到 lib/helpers 下。
|
|
606
|
+
*/
|
|
607
|
+
declare function copyHelperFiles(projectPath: string, projectConfig: ProjectCreateConfig): Promise<void>;
|
|
608
|
+
|
|
609
|
+
declare function copyCoreMixins(projectPath: string, options: {
|
|
610
|
+
projectConfig: ProjectCreateConfig;
|
|
611
|
+
renderData: Record<string, any>;
|
|
612
|
+
}): Promise<void>;
|
|
613
|
+
|
|
614
|
+
declare function copyStarterProjectScaffold(projectPath: string, projectConfig: ProjectCreateConfig, renderData: Record<string, any>): Promise<void>;
|
|
615
|
+
|
|
190
616
|
declare function copyTemplate(templatePath: string, targetPath: string, options?: {
|
|
191
617
|
excludes?: string[];
|
|
192
618
|
}): Promise<boolean>;
|
|
193
619
|
declare function copyCustomTemplate(templatePath: string, targetPath: string): Promise<boolean>;
|
|
194
620
|
declare function ensurePubspecName(projectDir: string, projectName: string): Promise<void>;
|
|
621
|
+
declare function ensurePubspecDescription(projectDir: string, description: string): Promise<void>;
|
|
622
|
+
/**
|
|
623
|
+
* 清理 flutter create 写入的默认英文说明注释。
|
|
624
|
+
*
|
|
625
|
+
* 这些注释更适合作为 Flutter 官方脚手架提示,不适合作为最终交付给用户的
|
|
626
|
+
* Starter 工程内容。这里仅移除默认英文说明,不会删除我们后续可能新增的
|
|
627
|
+
* 简短中文注释或业务注释。
|
|
628
|
+
*/
|
|
629
|
+
declare function sanitizePubspecComments(projectDir: string): Promise<void>;
|
|
195
630
|
declare function cleanupTemplateFiles(projectDir: string): Promise<void>;
|
|
196
631
|
|
|
197
632
|
declare function injectNetworkExamples(projectPath: string, contextData?: any): Promise<void>;
|
|
@@ -264,6 +699,122 @@ declare function generateService(name: string, options?: any, customLogger?: any
|
|
|
264
699
|
*/
|
|
265
700
|
declare function generateModule(name: string, options?: any, logger?: Logger): Promise<boolean>;
|
|
266
701
|
|
|
702
|
+
/**
|
|
703
|
+
* flu-blueprint.yaml Schema 类型定义
|
|
704
|
+
*
|
|
705
|
+
* 描述"要生成什么结构"——与 .flu-cli.json 描述"怎么生成"相互独立。
|
|
706
|
+
*/
|
|
707
|
+
type BlueprintPageType = 'page' | 'list-page';
|
|
708
|
+
interface BlueprintPage {
|
|
709
|
+
/** 页面名称,PascalCase 或 snake_case 均可,内部统一转换 */
|
|
710
|
+
name: string;
|
|
711
|
+
/** 页面类型:普通页面 / 列表页面(默认 page) */
|
|
712
|
+
type?: BlueprintPageType;
|
|
713
|
+
/** 是否生成配套 ViewModel(默认 true) */
|
|
714
|
+
withVM?: boolean;
|
|
715
|
+
/** list-page 专用:关联的 Model 名称(如 "Order") */
|
|
716
|
+
model?: string;
|
|
717
|
+
/** 额外备注(仅供人阅读,不影响生成) */
|
|
718
|
+
note?: string;
|
|
719
|
+
}
|
|
720
|
+
type BlueprintHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
721
|
+
interface BlueprintEndpoint {
|
|
722
|
+
/** 接口名称,用于生成方法名(如 "fetchOrders") */
|
|
723
|
+
name: string;
|
|
724
|
+
/** HTTP 方法(默认 GET) */
|
|
725
|
+
method?: BlueprintHttpMethod;
|
|
726
|
+
/** 接口路径(如 "/api/orders") */
|
|
727
|
+
path?: string;
|
|
728
|
+
/** 接口响应的 JSON 示例对象,用于自动推断并生成 Model */
|
|
729
|
+
responseExample?: Record<string, unknown>;
|
|
730
|
+
/** 接口响应 data 字段内部的 JSON 示例(优先级高于 responseExample) */
|
|
731
|
+
dataExample?: Record<string, unknown>;
|
|
732
|
+
/** 额外备注 */
|
|
733
|
+
note?: string;
|
|
734
|
+
}
|
|
735
|
+
interface BlueprintFeature {
|
|
736
|
+
/** 功能模块名(snake_case 或 camelCase,内部统一转 snake_case) */
|
|
737
|
+
name: string;
|
|
738
|
+
/** 该模块下的页面列表 */
|
|
739
|
+
pages?: BlueprintPage[];
|
|
740
|
+
/** 需要生成的 Service 名称列表(如 ["OrderService", "UserService"]) */
|
|
741
|
+
services?: string[];
|
|
742
|
+
/** 需要生成的 Model 名称列表(如 ["OrderModel"])—— 不含接口推断的 Model */
|
|
743
|
+
models?: string[];
|
|
744
|
+
/** 接口定义列表:endpoint → 自动生成 Service 方法 + Model */
|
|
745
|
+
endpoints?: BlueprintEndpoint[];
|
|
746
|
+
/** 额外备注 */
|
|
747
|
+
note?: string;
|
|
748
|
+
}
|
|
749
|
+
interface Blueprint {
|
|
750
|
+
/**
|
|
751
|
+
* Schema 版本,当前为 "1"
|
|
752
|
+
* 便于后续平滑升级,解析时可做版本迁移
|
|
753
|
+
*/
|
|
754
|
+
version?: string;
|
|
755
|
+
/**
|
|
756
|
+
* 功能模块列表(模块模式)
|
|
757
|
+
* 若不填 features,则允许使用根级 pages/endpoints/services/models(简单 App 模式)
|
|
758
|
+
*/
|
|
759
|
+
features?: BlueprintFeature[];
|
|
760
|
+
/**
|
|
761
|
+
* 简单 App 模式(不写 features)
|
|
762
|
+
* 将自动映射为隐式 feature:`name: "app"`
|
|
763
|
+
*/
|
|
764
|
+
pages?: BlueprintPage[];
|
|
765
|
+
services?: string[];
|
|
766
|
+
models?: string[];
|
|
767
|
+
endpoints?: BlueprintEndpoint[];
|
|
768
|
+
}
|
|
769
|
+
interface BlueprintGenerateResult {
|
|
770
|
+
ok: boolean;
|
|
771
|
+
/** 生成的文件路径列表 */
|
|
772
|
+
generated: string[];
|
|
773
|
+
/** 跳过的文件(已存在) */
|
|
774
|
+
skipped: string[];
|
|
775
|
+
/** 每步的诊断消息 */
|
|
776
|
+
diagnostics: string[];
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Blueprint 批量生成器
|
|
781
|
+
*
|
|
782
|
+
* 读取 flu-blueprint.yaml,按 features → pages / services / models / endpoints
|
|
783
|
+
* 顺序调用现有各单体 Generator,汇总生成结果。
|
|
784
|
+
*
|
|
785
|
+
* 所有基类 / Mixin / 路径约束来自 .flu-cli.json(generators 配置),
|
|
786
|
+
* Blueprint 只描述"要什么",不重复配置"怎么写"。
|
|
787
|
+
*/
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* 从指定目录读取 flu-blueprint.yaml,批量生成所有节点。
|
|
791
|
+
*
|
|
792
|
+
* @param projectDir Flutter 项目根目录(含 .flu-cli.json)
|
|
793
|
+
* @param blueprintPath Blueprint 文件路径(默认 <projectDir>/flu-blueprint.yaml)
|
|
794
|
+
*/
|
|
795
|
+
declare function generateFromBlueprint(projectDir: string, blueprintPath?: string, logger?: Logger): Promise<BlueprintGenerateResult>;
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* OpenAPI 3 → Blueprint 转换器
|
|
799
|
+
*
|
|
800
|
+
* 将 OpenAPI 3 规范(JSON 或 YAML 字符串/对象)解析为 flu-blueprint.yaml 结构。
|
|
801
|
+
*
|
|
802
|
+
* 映射规则:
|
|
803
|
+
* - paths[path][method] → BlueprintEndpoint(按 tag 分组到 feature)
|
|
804
|
+
* - components/schemas → dataExample(内联到 endpoint,供生成器推断 Model)
|
|
805
|
+
* - tags → feature.name(无 tag 归入 "common")
|
|
806
|
+
*
|
|
807
|
+
* 原则:Blueprint 永远独立可用,本工具只是可选的"填充来源"。
|
|
808
|
+
*/
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* 将 OpenAPI 3 文档转换为 Blueprint 结构。
|
|
812
|
+
*
|
|
813
|
+
* @param input OpenAPI 3 文档(JSON 字符串 / YAML 字符串 / 已解析对象)
|
|
814
|
+
* @returns Blueprint 对象,可直接写入 flu-blueprint.yaml
|
|
815
|
+
*/
|
|
816
|
+
declare function parseOpenApiToBlueprint(input: string | object): Blueprint;
|
|
817
|
+
|
|
267
818
|
/**
|
|
268
819
|
* 升级项目中的 snippets 文件
|
|
269
820
|
*/
|
|
@@ -280,6 +831,70 @@ declare function upgradeSnippets(options?: {
|
|
|
280
831
|
*/
|
|
281
832
|
declare function checkSnippetsVersion(projectDir?: string): 'up-to-date' | 'outdated' | 'missing';
|
|
282
833
|
|
|
834
|
+
/**
|
|
835
|
+
* sync-rules 命令核心引擎(AI Skill 投影器)
|
|
836
|
+
*
|
|
837
|
+
* 职责:读取 .flu-cli.json,将架构约束投影为 AI 规则文件:
|
|
838
|
+
* - .cursor/rules/flu-project.mdc (Cursor AI)
|
|
839
|
+
* - CLAUDE.md (Claude Code / Antigravity)
|
|
840
|
+
* - AI_RULES.md (人机共读)
|
|
841
|
+
* - .agent/skills/<包名>/SKILL.md (通用 Agent Skill)
|
|
842
|
+
*/
|
|
843
|
+
|
|
844
|
+
declare function syncRules(projectDir?: string): Promise<boolean>;
|
|
845
|
+
interface SyncRulesWriteOutput {
|
|
846
|
+
filePath: string;
|
|
847
|
+
changed: boolean;
|
|
848
|
+
}
|
|
849
|
+
interface SyncRulesReport {
|
|
850
|
+
ok: boolean;
|
|
851
|
+
projectDir: string;
|
|
852
|
+
blocked?: boolean;
|
|
853
|
+
error?: string;
|
|
854
|
+
source?: string;
|
|
855
|
+
template?: string;
|
|
856
|
+
diagnostics?: string[];
|
|
857
|
+
outputs?: SyncRulesWriteOutput[];
|
|
858
|
+
}
|
|
859
|
+
declare function syncRulesWithReport(projectDir?: string, options?: {
|
|
860
|
+
logger?: Logger;
|
|
861
|
+
}): Promise<SyncRulesReport>;
|
|
862
|
+
|
|
863
|
+
type InitAiBaseStarter = 'minimal' | 'lite' | 'modular' | 'clean' | 'native' | 'custom';
|
|
864
|
+
declare function validateProjectId(projectId: string): string | null;
|
|
865
|
+
declare function normalizeProjectIdToPackageName(projectId: string): string;
|
|
866
|
+
declare function buildInitAiBaseConfig(starter: InitAiBaseStarter, packageName: string): ProjectConfig;
|
|
867
|
+
declare function parseFluCliJsonFromPath(filePath: string): ProjectConfig | null;
|
|
868
|
+
interface RunInitAiBaseOptions {
|
|
869
|
+
projectDir: string;
|
|
870
|
+
projectId: string;
|
|
871
|
+
/** 仅在项目根不存在 `.flu-cli.json` 时使用 */
|
|
872
|
+
starter: InitAiBaseStarter;
|
|
873
|
+
/** `starter === 'custom'` 时尝试从此路径导入;失败则兜底 minimal */
|
|
874
|
+
customImportPath?: string;
|
|
875
|
+
}
|
|
876
|
+
interface RunInitAiBaseResult {
|
|
877
|
+
ok: boolean;
|
|
878
|
+
diagnostics: string[];
|
|
879
|
+
packageName: string;
|
|
880
|
+
skillSlug: string;
|
|
881
|
+
createdNewConfig: boolean;
|
|
882
|
+
usedStarter: InitAiBaseStarter;
|
|
883
|
+
fellBackToMinimal: boolean;
|
|
884
|
+
}
|
|
885
|
+
declare function runInitAiBase(opts: RunInitAiBaseOptions): Promise<RunInitAiBaseResult>;
|
|
886
|
+
interface RunInitAiBaseReport extends RunInitAiBaseResult {
|
|
887
|
+
syncRules?: SyncRulesReport;
|
|
888
|
+
}
|
|
889
|
+
declare function runInitAiBaseWithReport(opts: RunInitAiBaseOptions, options?: {
|
|
890
|
+
logger?: Logger;
|
|
891
|
+
}): Promise<RunInitAiBaseReport>;
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* 与 `sync_rules` 写入 `.agent/skills/<slug>/SKILL.md` 的目录名规则一致。
|
|
895
|
+
*/
|
|
896
|
+
declare function slugForAgentSkill(packageName: string): string;
|
|
897
|
+
|
|
283
898
|
interface CustomTemplate {
|
|
284
899
|
id: string;
|
|
285
900
|
name: string;
|
|
@@ -296,6 +911,9 @@ interface ProjectPreset {
|
|
|
296
911
|
templateType: string;
|
|
297
912
|
stateManager: string;
|
|
298
913
|
includeNetworkLayer: boolean;
|
|
914
|
+
/** 创建期顶层示例协议,允许 preset 复用,但不写入 .flu-cli.json。 */
|
|
915
|
+
examples?: string[];
|
|
916
|
+
networkMonitorEnabled?: boolean;
|
|
299
917
|
platforms: string[];
|
|
300
918
|
assetStrategy?: 'manual' | 'skip';
|
|
301
919
|
triggerAssetWizard?: boolean;
|
|
@@ -352,12 +970,17 @@ interface ProjectOptions {
|
|
|
352
970
|
packageName: string;
|
|
353
971
|
outputDir: string;
|
|
354
972
|
includeNetworkLayer?: boolean;
|
|
973
|
+
examples?: string[];
|
|
974
|
+
createProjectConfig?: boolean;
|
|
355
975
|
}
|
|
356
976
|
/**
|
|
357
977
|
* ProjectGenerator (V6.0)
|
|
358
978
|
* 采用 Task Pipeline 架构,极简核心,逻辑拆分至各原子 Task。
|
|
359
979
|
*/
|
|
360
980
|
declare class ProjectGenerator {
|
|
981
|
+
lastError: string;
|
|
982
|
+
lastSdkBindingWarning: string;
|
|
983
|
+
lastBootstrapWarning: string;
|
|
361
984
|
/**
|
|
362
985
|
* 生成项目
|
|
363
986
|
* @param {string} name 项目名称
|
|
@@ -365,91 +988,165 @@ declare class ProjectGenerator {
|
|
|
365
988
|
* @param {Logger} logger 日志工具
|
|
366
989
|
*/
|
|
367
990
|
generate(name: string, options?: any, logger?: Logger): Promise<boolean>;
|
|
991
|
+
private runAutomaticPubGetIfNeeded;
|
|
368
992
|
/**
|
|
369
993
|
* 检查项目目录是否存在
|
|
370
994
|
*/
|
|
371
995
|
checkProjectExists(projectPath: string): boolean;
|
|
996
|
+
/**
|
|
997
|
+
* Native 项目在 flutter create 之后按 vNext 配置做后置增强。
|
|
998
|
+
*
|
|
999
|
+
* 与 lite 管线共用 HelperEnrich 等任务,不复制骨架模板、默认不注入 Core。
|
|
1000
|
+
* 示例入口注入依赖 lib/core/router,纯 Native 无路由基座时会由任务自行跳过。
|
|
1001
|
+
*/
|
|
1002
|
+
enrichNativeProjectAfterSkeleton(name: string, options: any, projectPath: string, logger?: Logger): Promise<boolean>;
|
|
1003
|
+
private reapplyIosPodfilePermissionMacrosIfNeeded;
|
|
1004
|
+
private generateNativeProject;
|
|
372
1005
|
}
|
|
373
1006
|
|
|
374
1007
|
/**
|
|
375
|
-
*
|
|
376
|
-
* 职责:读取和管理项目级别的 .flu-cli.json 配置文件
|
|
1008
|
+
* 任务执行上下文
|
|
377
1009
|
*/
|
|
1010
|
+
interface TaskContext {
|
|
1011
|
+
/** 项目根路径 */
|
|
1012
|
+
projectPath: string;
|
|
1013
|
+
/** 项目名称 */
|
|
1014
|
+
projectName: string;
|
|
1015
|
+
/** Dart package 名(合法标识符,用于 pubspec/package import) */
|
|
1016
|
+
dartPackageName: string;
|
|
1017
|
+
/** 模板类型 */
|
|
1018
|
+
templateType: ProjectStructureType;
|
|
1019
|
+
/** 是否包含网络层 */
|
|
1020
|
+
includeNetworkLayer: boolean;
|
|
1021
|
+
/** 状态管理框架 */
|
|
1022
|
+
stateManager: StateManagerType;
|
|
1023
|
+
/** vNext 统一项目创建配置 */
|
|
1024
|
+
projectConfig: ProjectCreateConfig;
|
|
1025
|
+
/** 用户选项 */
|
|
1026
|
+
options: any;
|
|
1027
|
+
/** 全局变量字典(用于模板替换) */
|
|
1028
|
+
variables: Record<string, string>;
|
|
1029
|
+
/** 日志记录器 */
|
|
1030
|
+
logger: Logger;
|
|
1031
|
+
/** 附加元数据 */
|
|
1032
|
+
[key: string]: any;
|
|
1033
|
+
}
|
|
378
1034
|
/**
|
|
379
|
-
*
|
|
1035
|
+
* 项目生成任务接口
|
|
380
1036
|
*/
|
|
381
|
-
interface
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
withBasePage?: boolean;
|
|
387
|
-
basePageClass?: string;
|
|
388
|
-
basePageImport?: string;
|
|
389
|
-
withViewModel?: boolean;
|
|
390
|
-
viewModelPath?: string;
|
|
391
|
-
withBaseViewModel?: boolean;
|
|
392
|
-
baseViewModelClass?: string;
|
|
393
|
-
baseViewModelImport?: string;
|
|
394
|
-
withBaseWidget?: boolean;
|
|
395
|
-
baseWidgetClass?: string;
|
|
396
|
-
baseWidgetImport?: string;
|
|
397
|
-
withBaseModel?: boolean;
|
|
398
|
-
baseModelClass?: string;
|
|
399
|
-
baseModelImport?: string;
|
|
400
|
-
template?: 'network' | 'simple' | 'auto' | string;
|
|
401
|
-
snippetKey?: string;
|
|
402
|
-
mockLevel?: 'global' | 'instance';
|
|
1037
|
+
interface IProjectTask {
|
|
1038
|
+
/** 任务名称 */
|
|
1039
|
+
name: string;
|
|
1040
|
+
/** 执行任务 */
|
|
1041
|
+
run(context: TaskContext): Promise<void>;
|
|
403
1042
|
}
|
|
404
1043
|
/**
|
|
405
|
-
*
|
|
1044
|
+
* 创建初始上下文
|
|
406
1045
|
*/
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
service?: GeneratorConfig;
|
|
417
|
-
module?: {
|
|
418
|
-
path?: string;
|
|
419
|
-
};
|
|
420
|
-
};
|
|
1046
|
+
declare function createDefaultContext(projectPath: string, projectName: string, options?: any, logger?: Logger): TaskContext;
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* 变量落地任务
|
|
1050
|
+
* 负责替换项目中的 {{projectName}}, {{packageName}} 等占位符
|
|
1051
|
+
*/
|
|
1052
|
+
declare class VariablesReplaceTask implements IProjectTask {
|
|
1053
|
+
name: string;
|
|
1054
|
+
run(context: TaskContext): Promise<void>;
|
|
421
1055
|
}
|
|
1056
|
+
|
|
422
1057
|
/**
|
|
423
|
-
*
|
|
1058
|
+
* 项目清理与修复任务
|
|
1059
|
+
* 负责环境兼容性修复、权限补丁及冗余文件清理
|
|
424
1060
|
*/
|
|
425
|
-
declare class
|
|
426
|
-
|
|
1061
|
+
declare class CleanupTask implements IProjectTask {
|
|
1062
|
+
name: string;
|
|
1063
|
+
run(context: TaskContext): Promise<void>;
|
|
427
1064
|
/**
|
|
428
|
-
*
|
|
429
|
-
* @param projectDir 项目目录
|
|
430
|
-
* @returns 配置对象,如果不存在则返回 null
|
|
1065
|
+
* 启用 Dio / network capability 时,自动确保 Android 主 Manifest 具备联网权限。
|
|
431
1066
|
*/
|
|
432
|
-
|
|
1067
|
+
private patchAndroidInternetPermission;
|
|
433
1068
|
/**
|
|
434
|
-
*
|
|
435
|
-
* @param projectDir 项目目录
|
|
436
|
-
* @returns 是否存在配置文件
|
|
1069
|
+
* 自动修复 macOS 网络权限 (避免 SocketException)
|
|
437
1070
|
*/
|
|
438
|
-
|
|
1071
|
+
private patchMacOSEntitlements;
|
|
439
1072
|
/**
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
* @returns 生成器配置,如果不存在则返回 null
|
|
1073
|
+
* 修复默认测试文件中的导入路径。
|
|
1074
|
+
*
|
|
1075
|
+
* lite/modular/clean 使用 Starter 的 app.dart;native 只有 main.dart + MyApp。
|
|
444
1076
|
*/
|
|
445
|
-
|
|
1077
|
+
private fixTestFile;
|
|
1078
|
+
private buildNativeWidgetTest;
|
|
1079
|
+
private buildStarterWidgetTest;
|
|
446
1080
|
/**
|
|
447
|
-
*
|
|
448
|
-
* @param templateType 模板类型
|
|
449
|
-
* @returns 配置模板对象
|
|
1081
|
+
* 修复残留的旧路径引用
|
|
450
1082
|
*/
|
|
451
|
-
|
|
1083
|
+
private fixLegacyImports;
|
|
1084
|
+
/**
|
|
1085
|
+
* 将 index.dart 顶部的 `///` library doc 改为普通注释。
|
|
1086
|
+
* Dart analyzer 会把没有 `library;` 指令的顶层文档注释判成 dangling library doc,
|
|
1087
|
+
* 新项目首次打开时容易出现一串低价值 warning。
|
|
1088
|
+
*/
|
|
1089
|
+
private normalizeIndexFileComments;
|
|
1090
|
+
private downgradeTopLevelDocComments;
|
|
1091
|
+
private removeEmptyDartFiles;
|
|
1092
|
+
private removeBaseResidue;
|
|
1093
|
+
private removeLegacyUserListResidue;
|
|
1094
|
+
private removeNetworkGalleryResidue;
|
|
1095
|
+
private getNetworkResidueTargets;
|
|
1096
|
+
private getLegacyUserListTargets;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* 项目配置任务
|
|
1101
|
+
* 职责:初始化项目的 .flu-cli.json 配置文件,实现模板自描述
|
|
1102
|
+
*/
|
|
1103
|
+
declare class ProjectConfigTask implements IProjectTask {
|
|
1104
|
+
name: string;
|
|
1105
|
+
run(context: TaskContext): Promise<void>;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
/**
|
|
1109
|
+
* Starter Scaffold 任务。
|
|
1110
|
+
* 负责写入项目级入口文件、说明文档、环境样板和 VSCode 调试配置。
|
|
1111
|
+
*/
|
|
1112
|
+
declare class StarterScaffoldTask implements IProjectTask {
|
|
1113
|
+
name: string;
|
|
1114
|
+
run(context: TaskContext): Promise<void>;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
declare function buildProjectRenderData(context: TaskContext): Record<string, any>;
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Helper 依赖策略。
|
|
1121
|
+
*
|
|
1122
|
+
* 这里集中维护 helper 与 pubspec 依赖的关系,避免 HelperEnrichTask 里散落平台判断。
|
|
1123
|
+
*/
|
|
1124
|
+
type HelperName = keyof ProjectHelpersConfig;
|
|
1125
|
+
interface HelperDependencyPlan {
|
|
1126
|
+
dependencies: string[];
|
|
1127
|
+
devDependencies: string[];
|
|
1128
|
+
warnings: string[];
|
|
1129
|
+
platformProfile: 'standard' | 'harmony';
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* 计算 helper 需要注入的 pubspec 依赖。
|
|
1133
|
+
*
|
|
1134
|
+
* 包含 ohos 平台时仍保留普通 Flutter 依赖,保证 Android/iOS/Web 先可用;
|
|
1135
|
+
* Harmony 原生插件源与版本只给提示,不在 CLI 中维护内置矩阵。
|
|
1136
|
+
*/
|
|
1137
|
+
declare function resolveHelperDependencyPlan(projectConfig: ProjectCreateConfig): HelperDependencyPlan;
|
|
1138
|
+
/**
|
|
1139
|
+
* 将 schema 中的 imagePicker 映射到模板目录 image_picker。
|
|
1140
|
+
*/
|
|
1141
|
+
declare function getEnabledHelperTemplateDirs(projectConfig: ProjectCreateConfig): string[];
|
|
1142
|
+
|
|
1143
|
+
interface CapabilityDependencyPlan {
|
|
1144
|
+
dependencies: string[];
|
|
1145
|
+
devDependencies: string[];
|
|
1146
|
+
warnings: string[];
|
|
1147
|
+
platformProfile: 'standard' | 'harmony';
|
|
452
1148
|
}
|
|
1149
|
+
declare function resolveCapabilityDependencyPlan(projectConfig: ProjectCreateConfig): CapabilityDependencyPlan;
|
|
453
1150
|
|
|
454
1151
|
/**
|
|
455
1152
|
* 应用资源选择接口
|
|
@@ -475,7 +1172,7 @@ declare class AppAssetsManager {
|
|
|
475
1172
|
* @param assets 资源配置
|
|
476
1173
|
* @param logger 日志工具
|
|
477
1174
|
*/
|
|
478
|
-
setupAppAssets(projectPath: string, assets: AppAssetConfig, logger: Logger): Promise<boolean>;
|
|
1175
|
+
setupAppAssets(projectPath: string, assets: AppAssetConfig, logger: Logger, flutterSdk?: FlutterSdkConfig): Promise<boolean>;
|
|
479
1176
|
/**
|
|
480
1177
|
* 复制文件(当源路径与目标路径相同时跳过)
|
|
481
1178
|
*/
|
|
@@ -540,6 +1237,7 @@ declare class TemplateManager {
|
|
|
540
1237
|
* @param isCustom 是否为自定义模板
|
|
541
1238
|
*/
|
|
542
1239
|
getTemplatePath(templateName: string, isCustom?: boolean): string;
|
|
1240
|
+
getBuiltinTemplateIds(): string[];
|
|
543
1241
|
/**
|
|
544
1242
|
* 准备模板(确保已缓存且为最新)
|
|
545
1243
|
*
|
|
@@ -549,6 +1247,20 @@ declare class TemplateManager {
|
|
|
549
1247
|
* 3. 内置模板 (lite/modular/clean)
|
|
550
1248
|
*/
|
|
551
1249
|
prepareTemplate(templateId: string, logger?: Logger, forceUpdate?: boolean): Promise<string | undefined>;
|
|
1250
|
+
refreshBuiltinTemplateCache(templateId: string, logger?: Logger): Promise<string | undefined>;
|
|
1251
|
+
refreshAllBuiltinTemplateCaches(logger?: Logger): Promise<string[]>;
|
|
1252
|
+
cleanBuiltinTemplateCache(logger?: Logger): Promise<number>;
|
|
1253
|
+
private ensureBuiltinTemplateCached;
|
|
1254
|
+
private isBuiltinCacheManagedTemplate;
|
|
1255
|
+
private isBuiltinTemplateCacheStale;
|
|
1256
|
+
private writeBuiltinTemplateMeta;
|
|
1257
|
+
private computeDirectorySignature;
|
|
1258
|
+
private resolveBundledBuiltinTemplatePath;
|
|
1259
|
+
private getBundledTemplateRootCandidates;
|
|
1260
|
+
private resolveInstalledCoreTemplatesRoot;
|
|
1261
|
+
private resolveRuntimeEntryTemplatesRoot;
|
|
1262
|
+
private getBuiltinCacheAliasPaths;
|
|
1263
|
+
private removeLegacyBuiltinCacheAliases;
|
|
552
1264
|
/**
|
|
553
1265
|
* 通用 Git 仓库缓存逻辑
|
|
554
1266
|
*/
|
|
@@ -585,6 +1297,27 @@ declare const t: (key: string, params?: Record<string, any>) => string;
|
|
|
585
1297
|
* Flutter 辅助工具
|
|
586
1298
|
* 职责:封装 flutter create/pub get/版本检测等命令调用
|
|
587
1299
|
*/
|
|
1300
|
+
|
|
1301
|
+
declare const HARMONY_FVM_SETUP_DOC_URL = "http://huozhiye.cn/flu-cli/";
|
|
1302
|
+
interface FlutterCreateResult {
|
|
1303
|
+
success: boolean;
|
|
1304
|
+
reason: 'ok' | 'unsupported_platform' | 'command_failed';
|
|
1305
|
+
command: string;
|
|
1306
|
+
unsupportedPlatforms: string[];
|
|
1307
|
+
missingPlatforms: string[];
|
|
1308
|
+
errorMessage?: string;
|
|
1309
|
+
}
|
|
1310
|
+
interface FlutterCreateExecutionPlan {
|
|
1311
|
+
flutterCommand: string;
|
|
1312
|
+
prepareCommands: string[];
|
|
1313
|
+
optionalPrepareCommands: string[];
|
|
1314
|
+
createCommand: string;
|
|
1315
|
+
createCwd?: string;
|
|
1316
|
+
command: string;
|
|
1317
|
+
usesFvmWorkflow?: boolean;
|
|
1318
|
+
fvmVersionFile?: string;
|
|
1319
|
+
workspaceFvmSdkRoot?: string;
|
|
1320
|
+
}
|
|
588
1321
|
/**
|
|
589
1322
|
* 运行 flutter create 命令
|
|
590
1323
|
* @param {string} projectDir - 项目目录
|
|
@@ -601,13 +1334,40 @@ declare const t: (key: string, params?: Record<string, any>) => string;
|
|
|
601
1334
|
* @param {string[]} platforms - 目标平台 (ios, android, web, windows, macos, linux, ohos)
|
|
602
1335
|
* @returns {Promise<boolean>} 是否成功
|
|
603
1336
|
*/
|
|
604
|
-
declare function runFlutterCreate(projectDir: string, projectName: string, packageName: string, flutterTemplate?: string, platforms?: string[]): Promise<
|
|
1337
|
+
declare function runFlutterCreate(projectDir: string, projectName: string, packageName: string, flutterTemplate?: string, platforms?: string[], flutterSdk?: FlutterSdkConfig): Promise<FlutterCreateResult>;
|
|
1338
|
+
/**
|
|
1339
|
+
* 根据项目创建配置解析真正要调用的 Flutter 命令。
|
|
1340
|
+
* 这里保留最小入口:system / fvm / custom flutterBin。
|
|
1341
|
+
*/
|
|
1342
|
+
/** system 模式:使用本机默认 Flutter,创建链路直接执行 flutter create。 */
|
|
1343
|
+
declare function isSystemFlutterSdk(flutterSdk?: FlutterSdkConfig): boolean;
|
|
1344
|
+
declare function resolveFlutterCommand(flutterSdk?: FlutterSdkConfig): string;
|
|
1345
|
+
/**
|
|
1346
|
+
* VSCode Extension Host 不一定继承用户交互终端的 PATH。
|
|
1347
|
+
* system 模式仍代表“使用本机默认 Flutter”,但执行时优先落到可验证的绝对 flutterBin,
|
|
1348
|
+
* 避免插件创建链路在 `/bin/zsh -lc` 中找不到 `flutter`。
|
|
1349
|
+
*/
|
|
1350
|
+
declare function resolveSystemFlutterBin(): string | undefined;
|
|
1351
|
+
declare function resolveFlutterCreateExecutionPlan(projectDir: string, projectName: string, packageName: string, flutterTemplate?: string, platforms?: string[], flutterSdk?: FlutterSdkConfig): FlutterCreateExecutionPlan;
|
|
1352
|
+
declare function validateFvmVersionInput(flutterSdk?: FlutterSdkConfig): string | null;
|
|
1353
|
+
declare function parseFlutterCreateSupportedPlatforms(helpText: string): string[];
|
|
1354
|
+
declare function findMissingFlutterPlatformDirs(projectDir: string, platforms: string[]): string[];
|
|
1355
|
+
declare function bindProjectFlutterSdk(projectDir: string, flutterSdk?: FlutterSdkConfig): Promise<{
|
|
1356
|
+
bound: boolean;
|
|
1357
|
+
message?: string;
|
|
1358
|
+
warning?: string;
|
|
1359
|
+
}>;
|
|
605
1360
|
/**
|
|
606
1361
|
* 运行 flutter pub get
|
|
607
1362
|
* @param {string} projectDir - 项目目录
|
|
608
1363
|
* @returns {Promise<boolean>} 是否成功
|
|
609
1364
|
*/
|
|
610
|
-
declare function runFlutterPubGet(projectDir: string
|
|
1365
|
+
declare function runFlutterPubGet(projectDir: string, flutterSdk?: FlutterSdkConfig, options?: {
|
|
1366
|
+
timeoutMs?: number;
|
|
1367
|
+
}): Promise<boolean>;
|
|
1368
|
+
declare function resolveProjectFlutterCommand(_projectDir: string, flutterSdk?: FlutterSdkConfig): string;
|
|
1369
|
+
declare function resolveProjectFlutterCliCommand(projectDir: string, flutterSdk?: FlutterSdkConfig): string;
|
|
1370
|
+
declare function resolveProjectFlutterCliCommandForAutomation(projectDir: string, flutterSdk?: FlutterSdkConfig): string;
|
|
611
1371
|
/**
|
|
612
1372
|
* 检查 Flutter 是否安装
|
|
613
1373
|
* @returns {Promise<boolean>} 是否已安装
|
|
@@ -619,7 +1379,14 @@ declare function checkFlutterInstalled(): Promise<boolean>;
|
|
|
619
1379
|
*/
|
|
620
1380
|
declare function getFlutterVersion(): Promise<string | null>;
|
|
621
1381
|
|
|
622
|
-
|
|
1382
|
+
/**
|
|
1383
|
+
* 规范化 Dart package 名。
|
|
1384
|
+
* 目录名可保留连字符,但 pubspec name、package: import、flutter create --project-name
|
|
1385
|
+
* 都必须使用合法的 Dart package 标识符。
|
|
1386
|
+
*/
|
|
1387
|
+
declare function normalizeDartPackageName(projectName: string): string;
|
|
1388
|
+
|
|
1389
|
+
type BuildPlatform = 'android' | 'ios' | 'harmony';
|
|
623
1390
|
declare class BuildManager {
|
|
624
1391
|
static build(platform: BuildPlatform, buildConfig: NonNullable<UploadConfig['build']>, projectDir?: string): Promise<BuildResult>;
|
|
625
1392
|
}
|
|
@@ -666,12 +1433,6 @@ declare class AndroidBuilder {
|
|
|
666
1433
|
* @param projectDir 项目目录
|
|
667
1434
|
*/
|
|
668
1435
|
static build(config: NonNullable<UploadConfig['build']>['android'], projectDir?: string): Promise<BuildResult>;
|
|
669
|
-
/**
|
|
670
|
-
* 查找构建产物
|
|
671
|
-
* @param projectDir 项目目录
|
|
672
|
-
* @param type 类型 (apk/appbundle)
|
|
673
|
-
* @param flavor 风味
|
|
674
|
-
*/
|
|
675
1436
|
private static findArtifact;
|
|
676
1437
|
}
|
|
677
1438
|
|
|
@@ -702,4 +1463,4 @@ declare function fixAndroidPackageName(projectDir: string, packageName: string,
|
|
|
702
1463
|
*/
|
|
703
1464
|
declare function fixIosBundleIdentifier(projectDir: string, bundleId: string, logger?: Logger): Promise<void>;
|
|
704
1465
|
|
|
705
|
-
export { AndroidBuilder, type AppAssetConfig, AppAssetsManager, BUILTIN_TEMPLATES, BuildManager, ConfigManager, ConsoleLogger, type CustomTemplate, type FluConfig, type GeneratorConfig, I18nManager, IOSBuilder, type Logger, type ProjectConfig, ProjectConfigManager, ProjectContextService, ProjectGenerator, type ProjectOptions, type ProjectPreset, type ProjectTemplate, TemplateGenerator, TemplateManager, TemplatePresetService, type TemplateType, checkFlutterInstalled, checkSnippetsVersion, cleanupTemplateFiles, copyCoreFiles, copyCustomTemplate, copyInfrastructure, copyNetworkFiles, copyTemplate, detectProjectTemplate, ensurePubspecName, fixAndroidPackageName, fixIosBundleIdentifier, generateComponent, generateIndexFile, generateModel, generateModule, generatePage, generateService, generateViewModel, generateWidget, getCoreFilesDir, getFlutterVersion, getModelPath, getNetworkDir, getPagePath, getRelativeImportPath, getServicePath, getSnippetContent, getStateManager, getTemplatesRootDir, getViewModelPath, getWidgetPath, injectNetworkExamples, isCustomTemplateProject, loadProjectSnippets, logger, removeTemplateSuffix, renderSnippet, replaceVariables, runFlutterCreate, runFlutterPubGet, t, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toTitleCase, updateIndexFile, upgradeSnippets };
|
|
1466
|
+
export { AndroidBuilder, type AppAssetConfig, AppAssetsManager, type ArchitectureConfig, type ArchitectureMode, type AuthCapabilityConfig, BUILTIN_TEMPLATES, type Blueprint, type BlueprintEndpoint, type BlueprintFeature, type BlueprintGenerateResult, type BlueprintHttpMethod, type BlueprintPage, type BlueprintPageType, BuildManager, type CapabilityDependencyPlan, CleanupTask, type CompositionProfile, ConfigManager, ConsoleLogger, type CustomTemplate, type FluConfig, type FlutterCreateExecutionPlan, type FlutterCreateResult, type FlutterSdkConfig, type FlutterSdkMode, type GeneratorConfig, type GeneratorConfigType, type GeneratorFieldPolicy, type GeneratorPolicyMode, type GeneratorSelectableOption, type GeneratorSelectableOptionsReport, type GeneratorType, HARMONY_FVM_SETUP_DOC_URL, type HelperDependencyPlan, type HelperName, I18nManager, IOSBuilder, type InitAiBaseStarter, type Logger, type NetworkCapabilityConfig, type NormalizeProjectCreateConfigOptions, type ProjectCapabilitiesConfig, type ProjectCompositionConfig, type ProjectConfig, ProjectConfigManager, type ProjectConfigSource, ProjectConfigTask, ProjectContextService, type ProjectCoreConfig, type ProjectCreateConfig, ProjectGenerator, type ProjectHelpersConfig, type ProjectOptions, type ProjectPlatformConfig, type ProjectPreset, type ProjectStackConfig, type ProjectStructureType, type ProjectTemplate, type ResolvedProjectConfig, type RunInitAiBaseOptions, type RunInitAiBaseReport, type RunInitAiBaseResult, type SerializationCapabilityConfig, StarterScaffoldTask, type StateManagerType, type StorageCapabilityConfig, TemplateGenerator, TemplateManager, TemplatePresetService, type TemplateType, VariablesReplaceTask, bindProjectFlutterSdk, buildInitAiBaseConfig, buildProjectRenderData, calculateRelativeImport, checkFlutterInstalled, checkSnippetsVersion, cleanupTemplateFiles, copyCoreFiles, copyCoreMixins, copyCustomTemplate, copyHelperFiles, copyInfrastructure, copyNetworkFiles, copyStarterProjectScaffold, copyTemplate, createDefaultContext, detectProjectTemplate, ensurePubspecDescription, ensurePubspecName, findMissingFlutterPlatformDirs, fixAndroidPackageName, fixIosBundleIdentifier, generateComponent, generateFromBlueprint, generateIndexFile, generateModel, generateModule, generatePage, generateService, generateViewModel, generateWidget, getArchitectureMode, getCoreFilesDir, getCoreMixinsDir, getEnabledHelperTemplateDirs, getFlutterVersion, getGeneratorFieldPolicy, getHelperExamplesDir, getHelpersDir, getModelPath, getNetworkDir, getPagePath, getRelativeImportPath, getServicePath, getSnippetContent, getStarterProjectDir, getStateManager, getTemplatesRootDir, getViewModelPath, getWidgetPath, injectNetworkExamples, isCustomTemplateProject, isGeneratorFieldLocked, isSystemFlutterSdk, listGeneratorSelectableOptions, loadProjectSnippets, logger, mirrorNestedTargetDir, normalizeCompositionProfile, normalizeDartPackageName, normalizeFlutterCreatePlatform, normalizeFlutterCreatePlatforms, normalizeNetworkEnabled, normalizePlatforms, normalizeProjectCreateConfig, normalizeProjectIdToPackageName, normalizeTemplateType, parseFluCliJsonFromPath, parseFlutterCreateSupportedPlatforms, parseOpenApiToBlueprint, removeTemplateSuffix, renderSnippet, replaceVariables, resolveCapabilityDependencyPlan, resolveConfiguredImport, resolveFlutterCommand, resolveFlutterCreateExecutionPlan, resolveGeneratorBaseDir, resolveGeneratorTargetDir, resolveHelperDependencyPlan, resolveProjectFlutterCliCommand, resolveProjectFlutterCliCommandForAutomation, resolveProjectFlutterCommand, resolveSystemFlutterBin, runFlutterCreate, runFlutterPubGet, runInitAiBase, runInitAiBaseWithReport, sanitizePubspecComments, slugForAgentSkill, syncRules, syncRulesWithReport, t, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toTitleCase, updateIndexFile, updateNestedIndexExports, upgradeSnippets, validateFvmVersionInput, validateProjectId };
|