@actiondock/builder 2.0.11 → 2.2.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.
@@ -0,0 +1,442 @@
1
+ import type { ActionDockManifest, ProjectConfig } from "@actiondock/core";
2
+ /**
3
+ * 规划输入侧的项目配置扩展字段。
4
+ * actiondock.json 实际承载 uses、files、assets 等扩展声明,
5
+ * ProjectConfig 契约未显式列出的部分在此正式声明,替代类型擦除访问。
6
+ */
7
+ export interface ProjectConfigWithDeclarations extends ProjectConfig {
8
+ /** 当前包在清单中声明的顶层 uses 跨包依赖 */
9
+ uses?: string[];
10
+ /** 框架导出与分发边界文件列表 */
11
+ files?: string[];
12
+ /** 静态资产列表 */
13
+ assets?: string[];
14
+ }
15
+ /**
16
+ * Action 依赖描述。
17
+ */
18
+ export interface ActionDependency {
19
+ /** Action 唯一标识符 */
20
+ id: string;
21
+ /** Action 入口文件相对路径 */
22
+ entry: string;
23
+ /** Action 源码文件绝对路径 */
24
+ resolvedPath: string;
25
+ /** 静态依赖的下游 Action ID 列表 */
26
+ uses: string[];
27
+ /** 是否为来自外部依赖包中的 Action */
28
+ isExternal?: boolean;
29
+ /** Action 功能描述 */
30
+ description?: string;
31
+ /** 入参校验模式 */
32
+ inputSchema?: Record<string, unknown> | boolean;
33
+ /** 出参校验模式 */
34
+ outputSchema?: Record<string, unknown> | boolean;
35
+ /** 标签列表 */
36
+ tags?: string[];
37
+ /** 扩展注解 */
38
+ annotations?: Record<string, unknown>;
39
+ }
40
+ /**
41
+ * 资产或模块依赖描述。
42
+ */
43
+ export interface AssetDependency {
44
+ /** 资产相对路径 */
45
+ path: string;
46
+ /** 资产绝对物理路径 */
47
+ resolvedPath: string;
48
+ /** 资产类型:静态资产、规程文档、配置文件或代码文件模块 */
49
+ type: "asset" | "playbook" | "config" | "module" | "file";
50
+ }
51
+ /**
52
+ * 外部依赖描述。
53
+ */
54
+ export interface ExternalDependency {
55
+ /** 外部依赖包名 */
56
+ name: string;
57
+ /** 版本约束范围 */
58
+ versionRange?: string;
59
+ /** 是否为开发期依赖 */
60
+ isDev?: boolean;
61
+ }
62
+ /**
63
+ * 锁文件元数据描述。
64
+ */
65
+ export interface LockfileInfo {
66
+ /** 锁文件名(如 package-lock.json) */
67
+ name: string;
68
+ /** 锁文件物理绝对路径 */
69
+ path: string;
70
+ /** 锁文件内容的 SHA-256 校验摘要 */
71
+ sha256: string;
72
+ }
73
+ /**
74
+ * 构建规划中的依赖集合分类。
75
+ */
76
+ export interface BuildPlanDependencies {
77
+ /** Action 依赖闭包 */
78
+ actions: ActionDependency[];
79
+ /** 模块与资产依赖 */
80
+ modulesAndAssets: AssetDependency[];
81
+ /** 外部 npm 依赖 */
82
+ external: ExternalDependency[];
83
+ }
84
+ /**
85
+ * Playbook 规划项。
86
+ */
87
+ export interface PlaybookPlanEntry {
88
+ id: string;
89
+ filePath: string;
90
+ actions?: string[];
91
+ description?: string;
92
+ }
93
+ /**
94
+ * 构建规划产物结构。
95
+ */
96
+ export interface BuildPlan {
97
+ /** 所属 Package ID */
98
+ packageId: string;
99
+ /** 项目展示名称 */
100
+ packageName: string;
101
+ /** 版本号 */
102
+ version: string;
103
+ /** 描述信息 */
104
+ description?: string;
105
+ /** 项目根目录绝对路径 */
106
+ projectRoot: string;
107
+ /** actions 目录相对路径 */
108
+ actionsDir?: string;
109
+ /** playbooks 目录相对路径 */
110
+ playbooksDir?: string;
111
+ /** 参与构建的 Action 列表 */
112
+ actions: ActionDependency[];
113
+ /** 参与构建的 Playbook 列表 */
114
+ playbooks: PlaybookPlanEntry[];
115
+ /** 分类依赖明细 */
116
+ dependencies: BuildPlanDependencies;
117
+ /** 资产路径列表 */
118
+ assets: string[];
119
+ /** 显式声明的代码文件列表 */
120
+ files?: string[];
121
+ /** 声明的配置定义字典 */
122
+ configDefs?: Record<string, unknown>;
123
+ /** 依赖闭包包含的外部已链接包项目根目录列表(去重) */
124
+ externalProjectRoots?: string[];
125
+ /** 检测到的锁文件信息 */
126
+ lockfile?: LockfileInfo;
127
+ /** 规划元数据 */
128
+ metadata: {
129
+ plannedAt: string;
130
+ schemaVersion: number;
131
+ actionCount: number;
132
+ playbookCount: number;
133
+ lockfileDigest?: string;
134
+ };
135
+ }
136
+ /**
137
+ * 声明式选择规划产物类型别名。
138
+ */
139
+ export type SelectionPlan = BuildPlan;
140
+ /**
141
+ * 构建规划器配置选项。
142
+ */
143
+ export interface BuildPlannerOptions {
144
+ /** 项目根目录绝对路径 */
145
+ projectRoot: string;
146
+ /** 显式传入的项目配置(若未提供则从 actiondock.json 读取) */
147
+ config?: ProjectConfigWithDeclarations;
148
+ /** 显式传入的声明式清单(若未提供则从 actiondock.json 读取) */
149
+ manifest?: ActionDockManifest & {
150
+ files?: string[];
151
+ };
152
+ /** 挑选的 Action ID 列表(用于依赖闭包裁剪) */
153
+ actions?: string[];
154
+ /** 挑选的 Playbook ID 列表(用于 Playbook 驱动的依赖闭包裁剪) */
155
+ playbooks?: string[];
156
+ /** 显式声明包含的代码文件或目录列表 */
157
+ files?: string[];
158
+ /** 显式声明包含的资产文件或目录列表 */
159
+ assets?: string[];
160
+ /** 指定的锁文件路径(可选) */
161
+ lockfile?: string;
162
+ /** 期望的锁文件 SHA-256 摘要(若指定且不一致将报错拒绝) */
163
+ expectedLockfileDigest?: string;
164
+ /** 是否跳过本地相对依赖完整性校验(默认 false) */
165
+ skipDependencyValidation?: boolean;
166
+ }
167
+ /**
168
+ * 声明式选择规划器配置选项别名。
169
+ */
170
+ export type SelectionPlannerOptions = BuildPlannerOptions;
171
+ /**
172
+ * 归档压缩格式。
173
+ */
174
+ export type ArchiveFormat = "zip" | "tar.gz";
175
+ /**
176
+ * 基于 Node.js 的目录型交付产物生成选项。
177
+ */
178
+ export interface BuildOptions {
179
+ /** 目标项目根目录绝对路径 */
180
+ projectRoot: string;
181
+ /** 产物输出目录路径(默认输出至 dist 目录) */
182
+ outDir?: string;
183
+ /** 输出路径别名 */
184
+ outfile?: string;
185
+ /** 挑选参与构建的 Action ID 清单 */
186
+ actions?: string[];
187
+ /** 挑选参与构建的 Playbook ID 清单 */
188
+ playbooks?: string[];
189
+ /** 是否生成标准 zip 压缩归档交付产物 */
190
+ archive?: boolean;
191
+ /** 是否在干净暂存目录中物化锁定的生产依赖 */
192
+ vendorDeps?: boolean;
193
+ /** 是否允许执行依赖安装生命周期脚本(默认 false) */
194
+ allowInstallScripts?: boolean;
195
+ /** 是否强制要求构建可复现(默认 false) */
196
+ requireReproducible?: boolean;
197
+ /** 显式传入的项目配置(可选) */
198
+ config?: ProjectConfig;
199
+ /** 显式传入的声明式清单(可选) */
200
+ manifest?: ActionDockManifest;
201
+ /** 是否跳过本地相对依赖完整性校验(默认 false) */
202
+ skipDependencyValidation?: boolean;
203
+ /**
204
+ * 已移除的单文件二进制输出目标平台参数。
205
+ * 若传入将抛出 UNSUPPORTED_BUILD_MODE 错误。
206
+ */
207
+ target?: string;
208
+ /**
209
+ * 已移除的字节码预编译参数。
210
+ * 若传入将抛出 UNSUPPORTED_BUILD_MODE 错误。
211
+ */
212
+ bytecode?: boolean;
213
+ /**
214
+ * 代码混淆选项(历史遗留占位字段,目录型构建不再读取)。
215
+ */
216
+ minify?: boolean;
217
+ }
218
+ /**
219
+ * 目录型构建产物结果描述。
220
+ */
221
+ export interface BuildResult {
222
+ /** 所属 Package ID */
223
+ packageId: string;
224
+ /** 打包的项目版本号 */
225
+ version: string;
226
+ /** 构建产物输出目录路径 */
227
+ outputDir: string;
228
+ /** 生成的 zip 压缩归档文件路径(若指定 archive 选项) */
229
+ archivePath?: string;
230
+ /** 生成的 Node.js 启动入口绝对路径 */
231
+ entrypointPath: string;
232
+ /**
233
+ * 启动入口可执行文件绝对路径(entrypointPath 的等价别名)。
234
+ * @deprecated 历史兼容别名,请改用 entrypointPath,将在后续版本移除。
235
+ */
236
+ executablePath: string;
237
+ /** 生成的元数据文件路径 */
238
+ metadataPath: string;
239
+ /** 打包内置的 Action ID 列表 */
240
+ actions: string[];
241
+ /** 打包内置的 Playbook ID 列表 */
242
+ playbooks: string[];
243
+ /** 是否物化了依赖 */
244
+ vendorDeps: boolean;
245
+ /** 是否具备可复现性 */
246
+ reproducible: boolean;
247
+ /** 产物 SHA-256 校验摘要 */
248
+ sha256: string;
249
+ }
250
+ /**
251
+ * npm Action 包打包选项。
252
+ */
253
+ export interface PackOptions {
254
+ /** 目标项目根目录绝对路径 */
255
+ projectRoot: string;
256
+ /** 输出目录路径(默认当前工作目录或 dist 目录) */
257
+ outDir?: string;
258
+ /** 是否仅做预检与清单生成,不生成最终 tgz 压缩包 */
259
+ dryRun?: boolean;
260
+ /** 显式传入的清单(可选) */
261
+ manifest?: ActionDockManifest;
262
+ /** 显式传入的项目配置(可选) */
263
+ config?: ProjectConfig;
264
+ }
265
+ /**
266
+ * npm Action 包打包结果。
267
+ */
268
+ export interface PackResult {
269
+ /** 所属 Package ID */
270
+ packageId: string;
271
+ /** 项目展示名称 */
272
+ packageName: string;
273
+ /** 版本号 */
274
+ version: string;
275
+ /** 生成的 tgz 压缩包文件路径(dryRun 时未生成则为空) */
276
+ tarballPath?: string;
277
+ /** 生成的 tgz 压缩包文件名 */
278
+ tarballName: string;
279
+ /** 压缩包字节大小 */
280
+ sizeBytes: number;
281
+ /** 压缩包内容的 SHA-256 校验摘要 */
282
+ sha256: string;
283
+ /** 打包包含的文件相对路径清单 */
284
+ files: string[];
285
+ /** 清单摘要信息 */
286
+ manifestSummary: {
287
+ actionsCount: number;
288
+ actions: string[];
289
+ assetsCount: number;
290
+ filesCount: number;
291
+ };
292
+ }
293
+ /**
294
+ * Skill 导出选项。
295
+ */
296
+ export interface SkillExporterOptions {
297
+ /** 源码项目根目录绝对路径 */
298
+ projectRoot: string;
299
+ /** 导出模式:source 源码型 Skill 或 node 目录型 Skill(默认 source) */
300
+ mode?: "source" | "node";
301
+ /** 导出产物目标目录(默认输出至 dist 目录) */
302
+ outDir?: string;
303
+ /** 是否执行归档压缩,亦可直接指定归档格式 */
304
+ archive?: boolean | ArchiveFormat;
305
+ /** 归档压缩格式(zip 或 tar.gz) */
306
+ archiveFormat?: ArchiveFormat;
307
+ /** 挑选的 Playbook 列表 */
308
+ playbooks?: string[];
309
+ /** 挑选的 Action 列表 */
310
+ actions?: string[];
311
+ /** 预置的项目配置(可选) */
312
+ config?: ProjectConfig;
313
+ /** 预置的声明式清单(可选) */
314
+ manifest?: ActionDockManifest;
315
+ /** 是否跳过生成 SKILL.md */
316
+ skipSkillMd?: boolean;
317
+ /** 显式指定的已有 SKILL.md 文件路径 */
318
+ skillMdPath?: string;
319
+ /** 是否物化锁定依赖(供 node 模式或 source 模式使用) */
320
+ vendorDeps?: boolean;
321
+ /** 是否允许生命周期脚本 */
322
+ allowInstallScripts?: boolean;
323
+ /** 是否要求可复现 */
324
+ requireReproducible?: boolean;
325
+ /** 是否跳过本地相对依赖完整性校验(默认 false) */
326
+ skipDependencyValidation?: boolean;
327
+ /** 内部标识:是否作为复合套件子包导出(避免闭包再次触发嵌套 mini-workspace) */
328
+ _isSubpackage?: boolean;
329
+ /** 自定义复合技能说明书文件路径 */
330
+ customMdPath?: string;
331
+ /** 所属 Workspace 根目录(可选) */
332
+ workspaceRoot?: string;
333
+ /**
334
+ * 已废弃的独立单文件编译选项。
335
+ * 若传入将抛出替代方案提示或错误。
336
+ */
337
+ standalone?: boolean;
338
+ target?: string;
339
+ bytecode?: boolean;
340
+ minify?: boolean;
341
+ }
342
+ /**
343
+ * Skill 导出完成结果。
344
+ */
345
+ export interface SkillExportResult {
346
+ /** 所属 Package ID */
347
+ packageId: string;
348
+ /** 项目版本号 */
349
+ version: string;
350
+ /** 导出模式:source 源码型或 node 目录型 */
351
+ mode: "source" | "node";
352
+ /** 生成的 Skill 目录绝对路径 */
353
+ skillDir: string;
354
+ /** 生成的归档文件绝对路径(若开启压缩) */
355
+ archivePath?: string;
356
+ /** 导出的 Action 数量 */
357
+ actionsCount: number;
358
+ /** 导出的 Playbook 数量 */
359
+ playbooksCount: number;
360
+ /** 导出的 Action ID 列表 */
361
+ actions: string[];
362
+ /** 导出的 Playbook ID 列表 */
363
+ playbooks: string[];
364
+ /** 导出的文件相对路径清单 */
365
+ files: string[];
366
+ /** 若复用了已有的 SKILL.md 文件,返回该文件的绝对路径 */
367
+ usedExistingSkillMd?: string;
368
+ }
369
+ /**
370
+ * 批量 Skill 导出选项。
371
+ */
372
+ export interface BatchSkillExportOptions extends Omit<SkillExporterOptions, "projectRoot"> {
373
+ /** 待导出的项目根目录绝对路径列表 */
374
+ projectRoots: string[];
375
+ }
376
+ /**
377
+ * 批量 Skill 导出结果。
378
+ */
379
+ export interface BatchSkillExportResult {
380
+ /** 各包独立导出结果列表 */
381
+ results: SkillExportResult[];
382
+ /** 批量导出根目录 */
383
+ outDir: string;
384
+ /** 导出的总 Action 数量 */
385
+ totalActions: number;
386
+ /** 导出的总 Playbook 数量 */
387
+ totalPlaybooks: number;
388
+ }
389
+ /**
390
+ * 复合 Skill 套件导出选项。
391
+ */
392
+ export interface CompositeSkillExportOptions {
393
+ /** 复合技能套件名称 */
394
+ bundleName: string;
395
+ /** 参与聚合的项目根目录绝对路径列表 */
396
+ projectRoots: string[];
397
+ /** 复合套件输出目标目录(默认输出至 dist 目录) */
398
+ outDir?: string;
399
+ /** 复合技能描述信息 */
400
+ description?: string;
401
+ /** 是否执行归档压缩,亦可直接指定归档格式 */
402
+ archive?: boolean | ArchiveFormat;
403
+ /** 归档压缩格式(zip 或 tar.gz) */
404
+ archiveFormat?: ArchiveFormat;
405
+ /** 工作区根目录 */
406
+ workspaceRoot?: string;
407
+ /** 显式指定的已有 SKILL.md 文件路径 */
408
+ skillMdPath?: string;
409
+ /** 显式指定的自定义说明书(SKILL.custom.md)路径;缺省时自动发现工作区/当前目录下的同名文件 */
410
+ customMdPath?: string;
411
+ /** 仅生成复合 SKILL.md(始终重新生成,忽略已有 SKILL.md,不拷贝子包产物) */
412
+ skillMdOnly?: boolean;
413
+ }
414
+ /**
415
+ * 复合 Skill 套件导出结果。
416
+ */
417
+ export interface CompositeSkillExportResult {
418
+ /** 复合技能套件名称 */
419
+ bundleName: string;
420
+ /** 生成的复合 Skill 目录绝对路径 */
421
+ skillDir: string;
422
+ /** 生成的归档文件绝对路径(若开启压缩) */
423
+ archivePath?: string;
424
+ /** 包含的 Package 数量 */
425
+ packagesCount: number;
426
+ /** 包含的总 Action 数量 */
427
+ actionsCount: number;
428
+ /** 包含的总 Playbook 数量 */
429
+ playbooksCount: number;
430
+ /** 各包的摘要明细 */
431
+ packages: Array<{
432
+ packageId: string;
433
+ actions: string[];
434
+ playbooks: string[];
435
+ }>;
436
+ /** 生成的文件清单 */
437
+ files: string[];
438
+ /** 若复用了已有的 SKILL.md 文件,返回该文件的绝对路径 */
439
+ usedExistingSkillMd?: string;
440
+ /** skillMdOnly 模式下实际写出的 SKILL.md 文件绝对路径 */
441
+ skillMdFile?: string;
442
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,39 +1,37 @@
1
1
  {
2
2
  "name": "@actiondock/builder",
3
- "version": "2.0.11",
4
- "description": "ActionDock Build Planner, Bun standalone compiler, and Skill exporter",
3
+ "version": "2.2.0",
4
+ "description": "ActionDock Build Planner, distribution packaging, and Skill exporter",
5
5
  "type": "module",
6
- "main": "./src/index.ts",
7
- "module": "./src/index.ts",
8
- "types": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./src/index.ts",
12
- "types": "./src/index.ts"
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
13
14
  }
14
15
  },
15
16
  "files": [
16
- "src",
17
+ "dist",
17
18
  "README.md"
18
19
  ],
19
20
  "engines": {
20
- "node": ">=22.12.0"
21
+ "node": ">=24.12.0"
21
22
  },
22
23
  "publishConfig": {
23
24
  "access": "public",
24
25
  "registry": "https://registry.npmjs.org/"
25
26
  },
26
27
  "scripts": {
27
- "test": "bun test"
28
+ "build": "node ../../scripts/build.ts",
29
+ "test": "node ../../scripts/run-tests.ts"
28
30
  },
29
31
  "dependencies": {
30
- "@actiondock/core": "^2.0.11",
31
- "@actiondock/sdk": "^2.0.11",
32
- "yaml": "^2.7.0"
33
- },
34
- "devDependencies": {
35
- "@types/bun": "latest",
36
- "typescript": "^5.7.0"
32
+ "@actiondock/core": "^2.2.0",
33
+ "@actiondock/runtime-node": "^2.2.0",
34
+ "@actiondock/sdk": "^2.2.0"
37
35
  },
38
36
  "keywords": [
39
37
  "actiondock",