@cocos/cocos-cli-types 0.0.1-alpha.19.1 → 0.0.1-alpha.21.1

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/builder.d.ts CHANGED
@@ -5587,6 +5587,10 @@ declare namespace StatsQuery {
5587
5587
  * An internal constant to indicate whether we're using ui skew module.
5588
5588
  */
5589
5589
  USE_UI_SKEW: boolean;
5590
+ /**
5591
+ * An internal constant to indicate whether we're using sorting-2d module.
5592
+ */
5593
+ USE_SORTING_2D: boolean;
5590
5594
  }
5591
5595
  interface IPublicFlagConfig {
5592
5596
  DEBUG: boolean;
@@ -9,6 +9,8 @@ declare type EventEmitterMethods = Pick<EventEmitter, 'on' | 'off' | 'once' | 'e
9
9
 
10
10
  export declare function get<T>(key: string, scope?: ConfigurationScope): Promise<T>;
11
11
 
12
+ export declare function getMetadata(): Promise<ICocosConfigurationNode[]>;
13
+
12
14
  /**
13
15
  * 配置基类接口
14
16
  */
@@ -51,6 +53,36 @@ export declare interface IBaseConfiguration extends EventEmitterMethods {
51
53
  save(): Promise<boolean>;
52
54
  }
53
55
 
56
+ export declare interface ICocosConfigurationNode {
57
+ id: string;
58
+ title: string;
59
+ group: string;
60
+ order?: number;
61
+ properties: Record<string, ICocosConfigurationPropertySchema>;
62
+ }
63
+
64
+ /**
65
+ * Cocos 配置元数据定义。
66
+ *
67
+ * 基于 COCOS_CONFIG 类型(@types/cocos.config.d.ts)展开,
68
+ * 按 group(顶级模块) → node(二级字段) 组织。
69
+ *
70
+ * 供 Pink 配置面板渲染使用,通过 CocosHostConfiguration.getMetadata() 返回。
71
+ */
72
+ export declare interface ICocosConfigurationPropertySchema {
73
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array';
74
+ default?: unknown;
75
+ title?: string;
76
+ description?: string;
77
+ scope: string[];
78
+ enum?: any[];
79
+ enumDescriptions?: string[];
80
+ minimum?: number;
81
+ maximum?: number;
82
+ step?: number;
83
+ order?: number;
84
+ }
85
+
54
86
  /**
55
87
  * 配置的格式
56
88
  */
package/engine.d.ts CHANGED
@@ -352,4 +352,6 @@ export declare interface ModuleRenderConfig {
352
352
  migrationScript?: string;
353
353
  }
354
354
 
355
+ export declare function startEngineCompilation(force?: boolean): Promise<void>;
356
+
355
357
  export { };
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
 
3
+ import { ChunkInfo } from '@cocos/creator-programming-quick-pack/lib/loader';
3
4
  import { EventEmitter } from 'events';
4
5
 
5
6
  /** 动画剪辑资源的 userData */
@@ -100,6 +101,23 @@ declare interface AnimationImportSetting {
100
101
  /** 所有资源处理器类型的常量数组(用于 Zod enum 和 TypeScript type) */
101
102
  declare const ASSET_HANDLER_TYPES: string[];
102
103
 
104
+ declare enum AssetActionEnum {
105
+ 'add' = 0,
106
+ 'change' = 1,
107
+ 'delete' = 2,
108
+ 'none' = 3
109
+ }
110
+
111
+ declare interface AssetChangeInfo {
112
+ type: AssetChangeType;
113
+ uuid: string;
114
+ filePath: string;
115
+ importer: string;
116
+ userData: object;
117
+ }
118
+
119
+ declare type AssetChangeType = AssetActionEnum;
120
+
103
121
  /**
104
122
  * 资源数据库启动参数
105
123
  */
@@ -435,9 +453,12 @@ export declare namespace Configuration {
435
453
  set,
436
454
  remove,
437
455
  save,
456
+ getMetadata,
438
457
  IConfiguration,
439
458
  ConfigurationScope,
440
- IBaseConfiguration
459
+ IBaseConfiguration,
460
+ ICocosConfigurationNode,
461
+ ICocosConfigurationPropertySchema
441
462
  };
442
463
  }
443
464
 
@@ -524,6 +545,7 @@ export declare namespace Engine {
524
545
  getInfo,
525
546
  getConfig,
526
547
  initEngine,
548
+ startEngineCompilation,
527
549
  EngineInfo,
528
550
  IFlags,
529
551
  MakeRequired,
@@ -642,6 +664,18 @@ declare function getInfo(): Promise<EngineInfo>;
642
664
 
643
665
  declare function getInfo_2(): Promise<ProjectInfo>;
644
666
 
667
+ declare function getMetadata(): Promise<ICocosConfigurationNode[]>;
668
+
669
+ declare function getProgrammingFacet(): Promise<ProgrammingFacet>;
670
+
671
+ /**
672
+ * Get the MCP server status.
673
+ */
674
+ declare function getStatus(): {
675
+ running: boolean;
676
+ url?: string;
677
+ };
678
+
645
679
  /** glTF 动画资源的 userData */
646
680
  declare interface GltfAnimationAssetUserData {
647
681
  gltfIndex: number;
@@ -965,6 +999,36 @@ declare interface IChunkContent {
965
999
  clips: string[];
966
1000
  }
967
1001
 
1002
+ declare interface ICocosConfigurationNode {
1003
+ id: string;
1004
+ title: string;
1005
+ group: string;
1006
+ order?: number;
1007
+ properties: Record<string, ICocosConfigurationPropertySchema>;
1008
+ }
1009
+
1010
+ /**
1011
+ * Cocos 配置元数据定义。
1012
+ *
1013
+ * 基于 COCOS_CONFIG 类型(@types/cocos.config.d.ts)展开,
1014
+ * 按 group(顶级模块) → node(二级字段) 组织。
1015
+ *
1016
+ * 供 Pink 配置面板渲染使用,通过 CocosHostConfiguration.getMetadata() 返回。
1017
+ */
1018
+ declare interface ICocosConfigurationPropertySchema {
1019
+ type: 'string' | 'number' | 'boolean' | 'object' | 'array';
1020
+ default?: unknown;
1021
+ title?: string;
1022
+ description?: string;
1023
+ scope: string[];
1024
+ enum?: any[];
1025
+ enumDescriptions?: string[];
1026
+ minimum?: number;
1027
+ maximum?: number;
1028
+ step?: number;
1029
+ order?: number;
1030
+ }
1031
+
968
1032
  declare interface ICollisionMatrix {
969
1033
  [x: string]: number;
970
1034
  }
@@ -1077,6 +1141,25 @@ declare interface IEngineModuleConfig {
1077
1141
  noDeprecatedFeatures?: { value: boolean, version: string };
1078
1142
  }
1079
1143
 
1144
+ declare interface IEngineOptions {
1145
+ /**
1146
+ * 引擎仓库根目录。
1147
+ */
1148
+ root: string;
1149
+ /**
1150
+ * 引擎编译后的根目录。
1151
+ */
1152
+ distRoot: string;
1153
+ /**
1154
+ * 引擎基础 URL。
1155
+ */
1156
+ baseUrl: string;
1157
+ /**
1158
+ * 使用的引擎功能。
1159
+ */
1160
+ features: string[];
1161
+ }
1162
+
1080
1163
  declare interface IEngineProjectConfig extends Exclude<IEngineConfig, 'includeModules' | 'flags' | 'noDeprecatedFeatures'> {
1081
1164
  configs?: Record<string, IEngineModuleConfig>;
1082
1165
  globalConfigKey?: string;
@@ -1245,6 +1328,11 @@ declare type IModules = Record<string, IModuleItem>;
1245
1328
  */
1246
1329
  declare function importAsset(source: string, target: string, options?: AssetOperationOption): Promise<IAssetInfo[]>;
1247
1330
 
1331
+ declare interface ImportMap {
1332
+ imports?: Record<string, string>;
1333
+ scopes?: Record<string, Record<string, string>>;
1334
+ }
1335
+
1248
1336
  declare function init(): Promise<void>;
1249
1337
 
1250
1338
  declare function init_2(projectPath: string): Promise<void>;
@@ -1255,10 +1343,18 @@ declare function init_4(projectPath: string): Promise<void>;
1255
1343
 
1256
1344
  declare function init_5(projectPath: string): Promise<void>;
1257
1345
 
1258
- declare function init_6(projectPath: string): Promise<void>;
1346
+ /**
1347
+ * Initialize the scene module.
1348
+ * Registers the scene middleware and initializes scene config.
1349
+ */
1350
+ declare function init_6(): Promise<void>;
1351
+
1352
+ declare function init_7(projectPath: string): Promise<void>;
1259
1353
 
1260
1354
  declare function initEngine(enginePath: string, projectPath: string, serverURL?: string): Promise<void>;
1261
1355
 
1356
+ declare function initProgrammingFacet(): Promise<ProgrammingFacet>;
1357
+
1262
1358
  declare interface IPhysicsConfig {
1263
1359
  gravity: IVec3Like; // (0,-10, 0)
1264
1360
  allowSleep: boolean; // true
@@ -1504,6 +1600,14 @@ declare type MacroItem = {
1504
1600
 
1505
1601
  declare type MakeRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
1506
1602
 
1603
+ export declare namespace Mcp {
1604
+ export {
1605
+ startServer,
1606
+ stopServer,
1607
+ getStatus
1608
+ };
1609
+ }
1610
+
1507
1611
  declare interface MeshClusterOptions {
1508
1612
  enable: boolean;
1509
1613
  coneCluster?: boolean;
@@ -1768,6 +1872,43 @@ declare interface PrefabAssetUserData {
1768
1872
  syncNodeName?: string;
1769
1873
  }
1770
1874
 
1875
+ declare class ProgrammingFacet {
1876
+ private _packerDriverUpdateCount;
1877
+ private _asyncIteration;
1878
+ static create(engine: IEngineOptions, projectPath: string): Promise<ProgrammingFacet>;
1879
+ get engineRoot(): string;
1880
+ get engineDistRoot(): string;
1881
+ get systemJsHomeDir(): string;
1882
+ get systemJsIndexFile(): string;
1883
+ get engineImportMapURL(): string;
1884
+ get packImportMapURL(): string;
1885
+ get packResolutionDetailMapURL(): string;
1886
+ loadPackResource(url: string): Promise<{
1887
+ type: 'json';
1888
+ json: unknown;
1889
+ } | {
1890
+ type: 'chunk';
1891
+ chunk: ChunkInfo;
1892
+ }>;
1893
+ getGlobalImportMap(): Promise<ImportMap & {
1894
+ imports: NonNullable<ImportMap['imports']>;
1895
+ }>;
1896
+ private reload;
1897
+ notifyPackDriverUpdated(): Promise<any>;
1898
+ private _staticImportMap;
1899
+ private _engineRoot;
1900
+ private _engineDistRoot;
1901
+ private _systemJsHomeDir;
1902
+ private _systemJsBundleFileName;
1903
+ private _engineStatsQuery;
1904
+ private _quickPackLoader;
1905
+ private constructor();
1906
+ private _getQuickPackLoader;
1907
+ private _initialize;
1908
+ private _buildSystemJs;
1909
+ private _resetQuickPackLoader;
1910
+ }
1911
+
1771
1912
  export declare namespace Project {
1772
1913
  export {
1773
1914
  init_5 as init,
@@ -2014,9 +2155,19 @@ declare function save(force?: boolean): Promise<void>;
2014
2155
  */
2015
2156
  declare function saveAsset(pathOrUrlOrUUID: string, data: string | Buffer): Promise<IAssetInfo>;
2016
2157
 
2017
- export declare namespace Scripting {
2158
+ export declare namespace Scene {
2018
2159
  export {
2019
2160
  init_6 as init,
2161
+ startupWorker
2162
+ };
2163
+ }
2164
+
2165
+ export declare namespace Scripting {
2166
+ export {
2167
+ init_7 as init,
2168
+ initProgrammingFacet,
2169
+ getProgrammingFacet,
2170
+ startCompileScript,
2020
2171
  SharedSettings,
2021
2172
  IPluginScriptInfo,
2022
2173
  FilterPluginOptions
@@ -2130,6 +2281,51 @@ declare interface SpriteFrameVertices {
2130
2281
  */
2131
2282
  declare function start(): Promise<void>;
2132
2283
 
2284
+ /**
2285
+ * 在独立的子进程中运行项目脚本编译
2286
+ * 以避免阻塞主进程
2287
+ */
2288
+ declare function startCompileScript(assetChanges?: AssetChangeInfo[]): Promise<void>;
2289
+
2290
+ declare function startEngineCompilation(force?: boolean): Promise<void>;
2291
+
2292
+ /**
2293
+ * MCP Server Facade Module
2294
+ *
2295
+ * Called by the cocos-code utility process to start the MCP server
2296
+ * in an already-initialized environment.
2297
+ * Prerequisite: core modules (project/engine/assets/scripting/builder)
2298
+ * have been initialized via their respective lib modules.
2299
+ * This module only handles MCP-specific work: populating the toolRegistry,
2300
+ * starting Express, and registering MCP routes.
2301
+ */
2302
+ /**
2303
+ * Start the MCP server.
2304
+ *
2305
+ * Note: does NOT call CocosAPI.startup() / Launcher because
2306
+ * core modules are already initialized by the utility process.
2307
+ * This function only:
2308
+ * 1. Imports API modules to populate the toolRegistry (@tool decorator side-effects)
2309
+ * 2. Starts the Express HTTP server
2310
+ * 3. Creates McpMiddleware and registers routes
2311
+ *
2312
+ * @param port Optional port number; auto-selected if omitted
2313
+ * @returns MCP server URL (e.g. http://localhost:9527/mcp)
2314
+ */
2315
+ declare function startServer(port?: number): Promise<string>;
2316
+
2317
+ /**
2318
+ * Start the scene worker process.
2319
+ *
2320
+ * @param projectPath Path to the project directory
2321
+ */
2322
+ declare function startupWorker(projectPath: string): Promise<void>;
2323
+
2324
+ /**
2325
+ * Stop the MCP server.
2326
+ */
2327
+ declare function stopServer(): Promise<void>;
2328
+
2133
2329
  /** 支持创建的资源类型常量数组(用于 Zod enum 和 TypeScript type) */
2134
2330
  declare const SUPPORT_CREATE_TYPES: readonly ['animation-clip', 'typescript', 'auto-atlas', 'effect', 'scene', 'prefab', 'material', 'terrain', 'physics-material', 'label-atlas', 'render-texture', 'directory', 'effect-header'];
2135
2331
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@cocos/cocos-cli-types",
3
3
  "description": "types for cocos cli",
4
4
  "author": "cocos cli",
5
- "version": "0.0.1-alpha.19.1",
5
+ "version": "0.0.1-alpha.21.1",
6
6
  "main": "index.d.ts",
7
7
  "types": "index.d.ts",
8
8
  "exports": {
package/scripting.d.ts CHANGED
@@ -1,3 +1,24 @@
1
+ /// <reference types="node" />
2
+
3
+ import { ChunkInfo } from '@cocos/creator-programming-quick-pack/lib/loader';
4
+
5
+ declare enum AssetActionEnum {
6
+ 'add' = 0,
7
+ 'change' = 1,
8
+ 'delete' = 2,
9
+ 'none' = 3
10
+ }
11
+
12
+ declare interface AssetChangeInfo {
13
+ type: AssetChangeType;
14
+ uuid: string;
15
+ filePath: string;
16
+ importer: string;
17
+ userData: object;
18
+ }
19
+
20
+ declare type AssetChangeType = AssetActionEnum;
21
+
1
22
  export declare interface FilterPluginOptions {
2
23
  loadPluginInEditor?: boolean;
3
24
  loadPluginInWeb?: boolean;
@@ -5,8 +26,36 @@ export declare interface FilterPluginOptions {
5
26
  loadPluginInMiniGame?: boolean;
6
27
  }
7
28
 
29
+ export declare function getProgrammingFacet(): Promise<ProgrammingFacet>;
30
+
31
+ declare interface IEngineOptions {
32
+ /**
33
+ * 引擎仓库根目录。
34
+ */
35
+ root: string;
36
+ /**
37
+ * 引擎编译后的根目录。
38
+ */
39
+ distRoot: string;
40
+ /**
41
+ * 引擎基础 URL。
42
+ */
43
+ baseUrl: string;
44
+ /**
45
+ * 使用的引擎功能。
46
+ */
47
+ features: string[];
48
+ }
49
+
50
+ declare interface ImportMap {
51
+ imports?: Record<string, string>;
52
+ scopes?: Record<string, Record<string, string>>;
53
+ }
54
+
8
55
  export declare function init(projectPath: string): Promise<void>;
9
56
 
57
+ export declare function initProgrammingFacet(): Promise<ProgrammingFacet>;
58
+
10
59
  export declare interface IPluginScriptInfo extends PluginScriptInfo {
11
60
  url: string;
12
61
  }
@@ -19,6 +68,43 @@ declare interface PluginScriptInfo {
19
68
  uuid: string;
20
69
  }
21
70
 
71
+ declare class ProgrammingFacet {
72
+ private _packerDriverUpdateCount;
73
+ private _asyncIteration;
74
+ static create(engine: IEngineOptions, projectPath: string): Promise<ProgrammingFacet>;
75
+ get engineRoot(): string;
76
+ get engineDistRoot(): string;
77
+ get systemJsHomeDir(): string;
78
+ get systemJsIndexFile(): string;
79
+ get engineImportMapURL(): string;
80
+ get packImportMapURL(): string;
81
+ get packResolutionDetailMapURL(): string;
82
+ loadPackResource(url: string): Promise<{
83
+ type: 'json';
84
+ json: unknown;
85
+ } | {
86
+ type: 'chunk';
87
+ chunk: ChunkInfo;
88
+ }>;
89
+ getGlobalImportMap(): Promise<ImportMap & {
90
+ imports: NonNullable<ImportMap['imports']>;
91
+ }>;
92
+ private reload;
93
+ notifyPackDriverUpdated(): Promise<any>;
94
+ private _staticImportMap;
95
+ private _engineRoot;
96
+ private _engineDistRoot;
97
+ private _systemJsHomeDir;
98
+ private _systemJsBundleFileName;
99
+ private _engineStatsQuery;
100
+ private _quickPackLoader;
101
+ private constructor();
102
+ private _getQuickPackLoader;
103
+ private _initialize;
104
+ private _buildSystemJs;
105
+ private _resetQuickPackLoader;
106
+ }
107
+
22
108
  export declare interface SharedSettings {
23
109
  useDefineForClassFields: boolean;
24
110
  allowDeclareFields: boolean;
@@ -35,4 +121,10 @@ export declare interface SharedSettings {
35
121
  };
36
122
  }
37
123
 
124
+ /**
125
+ * 在独立的子进程中运行项目脚本编译
126
+ * 以避免阻塞主进程
127
+ */
128
+ export declare function startCompileScript(assetChanges?: AssetChangeInfo[]): Promise<void>;
129
+
38
130
  export { };