@actiondock/builder 2.0.12 → 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.
package/dist/types.d.ts CHANGED
@@ -1,4 +1,17 @@
1
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
+ }
2
15
  /**
3
16
  * Action 依赖描述。
4
17
  */
@@ -11,6 +24,8 @@ export interface ActionDependency {
11
24
  resolvedPath: string;
12
25
  /** 静态依赖的下游 Action ID 列表 */
13
26
  uses: string[];
27
+ /** 是否为来自外部依赖包中的 Action */
28
+ isExternal?: boolean;
14
29
  /** Action 功能描述 */
15
30
  description?: string;
16
31
  /** 入参校验模式 */
@@ -30,8 +45,8 @@ export interface AssetDependency {
30
45
  path: string;
31
46
  /** 资产绝对物理路径 */
32
47
  resolvedPath: string;
33
- /** 资产类型:静态资产、规程文档、配置文件或模块源码 */
34
- type: "asset" | "playbook" | "config" | "module";
48
+ /** 资产类型:静态资产、规程文档、配置文件或代码文件模块 */
49
+ type: "asset" | "playbook" | "config" | "module" | "file";
35
50
  }
36
51
  /**
37
52
  * 外部依赖描述。
@@ -44,6 +59,17 @@ export interface ExternalDependency {
44
59
  /** 是否为开发期依赖 */
45
60
  isDev?: boolean;
46
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
+ }
47
73
  /**
48
74
  * 构建规划中的依赖集合分类。
49
75
  */
@@ -90,16 +116,27 @@ export interface BuildPlan {
90
116
  dependencies: BuildPlanDependencies;
91
117
  /** 资产路径列表 */
92
118
  assets: string[];
119
+ /** 显式声明的代码文件列表 */
120
+ files?: string[];
93
121
  /** 声明的配置定义字典 */
94
122
  configDefs?: Record<string, unknown>;
123
+ /** 依赖闭包包含的外部已链接包项目根目录列表(去重) */
124
+ externalProjectRoots?: string[];
125
+ /** 检测到的锁文件信息 */
126
+ lockfile?: LockfileInfo;
95
127
  /** 规划元数据 */
96
128
  metadata: {
97
129
  plannedAt: string;
98
130
  schemaVersion: number;
99
131
  actionCount: number;
100
132
  playbookCount: number;
133
+ lockfileDigest?: string;
101
134
  };
102
135
  }
136
+ /**
137
+ * 声明式选择规划产物类型别名。
138
+ */
139
+ export type SelectionPlan = BuildPlan;
103
140
  /**
104
141
  * 构建规划器配置选项。
105
142
  */
@@ -107,110 +144,200 @@ export interface BuildPlannerOptions {
107
144
  /** 项目根目录绝对路径 */
108
145
  projectRoot: string;
109
146
  /** 显式传入的项目配置(若未提供则从 actiondock.json 读取) */
110
- config?: ProjectConfig;
111
- /** 显式传入的声明式清单(若未提供则从 actiondock.manifest.json 读取) */
112
- manifest?: ActionDockManifest;
147
+ config?: ProjectConfigWithDeclarations;
148
+ /** 显式传入的声明式清单(若未提供则从 actiondock.json 读取) */
149
+ manifest?: ActionDockManifest & {
150
+ files?: string[];
151
+ };
113
152
  /** 挑选的 Action ID 列表(用于依赖闭包裁剪) */
114
153
  actions?: string[];
115
154
  /** 挑选的 Playbook ID 列表(用于 Playbook 驱动的依赖闭包裁剪) */
116
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;
117
166
  }
118
167
  /**
119
- * 支持的 Bun 独立编译目标平台。
168
+ * 声明式选择规划器配置选项别名。
120
169
  */
121
- export type CompileTarget = "bun" | "host" | "bun-linux-x64" | "linux-x64" | "bun-linux-arm64" | "linux-arm64" | "bun-darwin-x64" | "darwin-x64" | "bun-darwin-arm64" | "darwin-arm64" | "bun-windows-x64" | "windows-x64" | "bun-linux-x64-baseline" | "linux-x64-baseline" | "bun-linux-x64-modern" | "linux-x64-modern";
170
+ export type SelectionPlannerOptions = BuildPlannerOptions;
122
171
  /**
123
- * Bun 独立编译器参数选项。
172
+ * 归档压缩格式。
124
173
  */
125
- export interface BunCompilerOptions {
126
- /** 编译入口文件绝对路径 */
127
- entrypoint: string;
128
- /** 目标二进制文件输出路径 */
129
- outfile: string;
130
- /** 编译目标平台架构(默认 host) */
131
- target?: CompileTarget | string;
132
- /** 是否开启代码压缩混淆(默认 true) */
133
- minify?: boolean;
134
- /** 是否启用字节码预编译(默认 true) */
135
- bytecode?: boolean;
136
- /** 构建工作目录(默认入口文件所在根目录) */
137
- cwd?: string;
138
- /** 自定义环境变量 */
139
- env?: Record<string, string>;
140
- /** 所属 Package ID(写入元数据用) */
141
- packageId?: string;
142
- /** 所属版本号(写入元数据用) */
143
- version?: string;
144
- /** 包含的 Action ID 列表(写入元数据用) */
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 清单 */
145
186
  actions?: string[];
146
- /** 是否生成 artifact.json 元数据文件(默认 true) */
147
- emitMetadata?: boolean;
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;
148
217
  }
149
218
  /**
150
- * Bun 独立编译器输出结果。
219
+ * 目录型构建产物结果描述。
151
220
  */
152
- export interface BunCompilerResult {
221
+ export interface BuildResult {
153
222
  /** 所属 Package ID */
154
- packageId?: string;
155
- /** 版本号 */
156
- version?: string;
157
- /** 编译目标架构 */
158
- target: string;
159
- /** 独立二进制文件绝对路径 */
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
+ */
160
236
  executablePath: string;
161
- /** 独立二进制文件字节大小 */
162
- sizeBytes: number;
163
- /** 独立二进制文件的 SHA-256 校验和 */
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 校验摘要 */
164
248
  sha256: string;
165
- /** 生成的元数据文件绝对路径(若生成) */
166
- metadataPath?: string;
167
- /** 编译是否开启混淆 */
168
- minify: boolean;
169
- /** 编译是否启用字节码 */
170
- bytecode: boolean;
171
- /** 编译耗时(毫秒) */
172
- durationMs: number;
173
- /** 编译完成时间戳 */
174
- compiledAt: string;
175
249
  }
176
250
  /**
177
- * 归档压缩格式。
251
+ * npm Action 包打包选项。
178
252
  */
179
- export type ArchiveFormat = "zip" | "tar.gz";
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
+ }
180
293
  /**
181
294
  * Skill 导出选项。
182
295
  */
183
296
  export interface SkillExporterOptions {
184
297
  /** 源码项目根目录绝对路径 */
185
298
  projectRoot: string;
186
- /** 导出模式:source 源码模式 或 standalone 独立二进制模式(默认 source) */
187
- mode?: "source" | "standalone";
188
- /** 是否开启独立二进制模式(简写选项) */
189
- standalone?: boolean;
190
- /** 二进制编译目标架构(仅在独立二进制模式生效,默认 host) */
191
- target?: CompileTarget | string;
299
+ /** 导出模式:source 源码型 Skill 或 node 目录型 Skill(默认 source) */
300
+ mode?: "source" | "node";
192
301
  /** 导出产物目标目录(默认输出至 dist 目录) */
193
302
  outDir?: string;
194
303
  /** 是否执行归档压缩,亦可直接指定归档格式 */
195
304
  archive?: boolean | ArchiveFormat;
196
305
  /** 归档压缩格式(zip 或 tar.gz) */
197
306
  archiveFormat?: ArchiveFormat;
198
- /** 挑选的 Playbook 列表(用于 Playbook 驱动的依赖闭包裁剪) */
307
+ /** 挑选的 Playbook 列表 */
199
308
  playbooks?: string[];
200
- /** 挑选的 Action 列表(用于 Action 驱动的依赖闭包裁剪) */
309
+ /** 挑选的 Action 列表 */
201
310
  actions?: string[];
202
- /** 独立二进制模式下是否开启代码混淆(默认 true) */
203
- minify?: boolean;
204
- /** 独立二进制模式下是否编译为字节码(默认 true) */
205
- bytecode?: boolean;
206
311
  /** 预置的项目配置(可选) */
207
312
  config?: ProjectConfig;
208
313
  /** 预置的声明式清单(可选) */
209
314
  manifest?: ActionDockManifest;
210
- /** 是否跳过生成 SKILL.md(多包聚合时避免子包重复生成,对外保持唯一定义) */
315
+ /** 是否跳过生成 SKILL.md */
211
316
  skipSkillMd?: boolean;
212
- /** 显式指定的已有 SKILL.md 文件路径(若提供或存在则直接使用,不再动态生成) */
317
+ /** 显式指定的已有 SKILL.md 文件路径 */
213
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;
214
341
  }
215
342
  /**
216
343
  * Skill 导出完成结果。
@@ -220,10 +347,8 @@ export interface SkillExportResult {
220
347
  packageId: string;
221
348
  /** 项目版本号 */
222
349
  version: string;
223
- /** 导出模式 */
224
- mode: "source" | "standalone";
225
- /** 目标平台架构 */
226
- target: string;
350
+ /** 导出模式:source 源码型或 node 目录型 */
351
+ mode: "source" | "node";
227
352
  /** 生成的 Skill 目录绝对路径 */
228
353
  skillDir: string;
229
354
  /** 生成的归档文件绝对路径(若开启压缩) */
@@ -277,10 +402,14 @@ export interface CompositeSkillExportOptions {
277
402
  archive?: boolean | ArchiveFormat;
278
403
  /** 归档压缩格式(zip 或 tar.gz) */
279
404
  archiveFormat?: ArchiveFormat;
280
- /** 工作区根目录(用于检索工作区现有的 SKILL.md 等资产,默认基于 cwd 与项目目录推导) */
405
+ /** 工作区根目录 */
281
406
  workspaceRoot?: string;
282
- /** 显式指定的已有 SKILL.md 文件路径(若存在则直接使用,不再动态生成) */
407
+ /** 显式指定的已有 SKILL.md 文件路径 */
283
408
  skillMdPath?: string;
409
+ /** 显式指定的自定义说明书(SKILL.custom.md)路径;缺省时自动发现工作区/当前目录下的同名文件 */
410
+ customMdPath?: string;
411
+ /** 仅生成复合 SKILL.md(始终重新生成,忽略已有 SKILL.md,不拷贝子包产物) */
412
+ skillMdOnly?: boolean;
284
413
  }
285
414
  /**
286
415
  * 复合 Skill 套件导出结果。
@@ -308,4 +437,6 @@ export interface CompositeSkillExportResult {
308
437
  files: string[];
309
438
  /** 若复用了已有的 SKILL.md 文件,返回该文件的绝对路径 */
310
439
  usedExistingSkillMd?: string;
440
+ /** skillMdOnly 模式下实际写出的 SKILL.md 文件绝对路径 */
441
+ skillMdFile?: string;
311
442
  }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@actiondock/builder",
3
- "version": "2.0.12",
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
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -18,21 +18,20 @@
18
18
  "README.md"
19
19
  ],
20
20
  "engines": {
21
- "node": ">=22.13.0"
21
+ "node": ">=24.12.0"
22
22
  },
23
23
  "publishConfig": {
24
24
  "access": "public",
25
25
  "registry": "https://registry.npmjs.org/"
26
26
  },
27
27
  "scripts": {
28
- "build": "bun run ../../scripts/build.ts",
29
- "test": "bun test"
28
+ "build": "node ../../scripts/build.ts",
29
+ "test": "node ../../scripts/run-tests.ts"
30
30
  },
31
31
  "dependencies": {
32
- "@actiondock/core": "^2.0.12",
33
- "@actiondock/sdk": "^2.0.12",
34
- "typescript": "^5.7.0",
35
- "yaml": "^2.7.0"
32
+ "@actiondock/core": "^2.2.0",
33
+ "@actiondock/runtime-node": "^2.2.0",
34
+ "@actiondock/sdk": "^2.2.0"
36
35
  },
37
36
  "keywords": [
38
37
  "actiondock",
@@ -1,22 +0,0 @@
1
- import type { BunCompilerOptions, BunCompilerResult } from "./types";
2
- /**
3
- * Bun 独立二进制编译器。
4
- * 封装 bun build --compile 调用,提前校验选项组合,收集构建产物与元数据。
5
- */
6
- export declare class BunCompiler {
7
- /**
8
- * 执行独立二进制编译。
9
- *
10
- * @param options 编译参数
11
- * @returns 编译产物元数据结果
12
- */
13
- compile(options: BunCompilerOptions): Promise<BunCompilerResult>;
14
- /**
15
- * 静态辅助调用方法。
16
- */
17
- static compile(options: BunCompilerOptions): Promise<BunCompilerResult>;
18
- }
19
- /**
20
- * 快捷独立二进制编译函数。
21
- */
22
- export declare function compileBinary(options: BunCompilerOptions): Promise<BunCompilerResult>;