@icebreakers/monorepo 3.2.18 → 4.0.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/README.md +181 -52
- package/bin/mo.js +2 -0
- package/bin/rc.js +2 -0
- package/bin/repo.js +2 -0
- package/bin/repoctl.js +2 -0
- package/dist/cli.mjs +1074 -76
- package/dist/commands-ikcXv_mG.mjs +2744 -0
- package/dist/config-BGCo7USv.mjs +120 -0
- package/dist/create-flow-DDlO-uio.mjs +199 -0
- package/dist/index-DvZrxwOh.d.mts +1066 -0
- package/dist/index.d.mts +388 -714
- package/dist/index.mjs +6 -2
- package/dist/rolldown-runtime-twds-ZHy.mjs +14 -0
- package/dist/tooling-DyUe-eiv.mjs +427 -0
- package/dist/tooling-entry.d.mts +2 -0
- package/dist/tooling-entry.mjs +2 -0
- package/dist/types-CveZChKu.mjs +215 -0
- package/dist/workspace-DS6LAL71.mjs +118 -0
- package/package.json +43 -34
- package/resources/skills/icebreakers-monorepo-cli/SKILL.md +12 -10
- package/resources/skills/icebreakers-monorepo-cli/references/commands.md +166 -21
- package/resources/skills/icebreakers-monorepo-cli/references/config.md +13 -9
- package/resources/skills/icebreakers-monorepo-cli/references/templates.md +30 -5
- package/tsconfig.base.json +23 -0
- package/dist/cli.cjs +0 -116
- package/dist/cli.d.cts +0 -1
- package/dist/index.cjs +0 -82
- package/dist/index.d.cts +0 -918
- package/dist/upgrade-Beo3EoFO.cjs +0 -1850
- package/dist/upgrade-tD-PPMpL.mjs +0 -1513
package/dist/index.d.cts
DELETED
|
@@ -1,918 +0,0 @@
|
|
|
1
|
-
import { TemplateDefinition, assetsDir, isGitignoreFile, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath } from "@icebreakers/monorepo-templates";
|
|
2
|
-
import * as simple_git0 from "simple-git";
|
|
3
|
-
import { ConfigValues, SimpleGit, SimpleGitOptions } from "simple-git";
|
|
4
|
-
import * as git_url_parse0 from "git-url-parse";
|
|
5
|
-
import gitUrlParse from "git-url-parse";
|
|
6
|
-
import * as _pnpm_types0 from "@pnpm/types";
|
|
7
|
-
import * as consola from "consola";
|
|
8
|
-
import { writeFile } from "node:fs/promises";
|
|
9
|
-
import crypto from "node:crypto";
|
|
10
|
-
|
|
11
|
-
//#region src/types/cli.d.ts
|
|
12
|
-
/**
|
|
13
|
-
* CLI 公用参数,保证各命令对外暴露一致的行为。
|
|
14
|
-
*/
|
|
15
|
-
interface CliOpts {
|
|
16
|
-
/**
|
|
17
|
-
* 是否开启交互模式,开启后每一步都会提示用户确认。
|
|
18
|
-
* @default false
|
|
19
|
-
*/
|
|
20
|
-
interactive?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* 是否使用 core 版资产,只同步最精简的文件集合。
|
|
23
|
-
* @default false
|
|
24
|
-
*/
|
|
25
|
-
core?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* 输出目录(相对 `cwd`),用于放置生成或拷贝出来的文件。
|
|
28
|
-
* @default ''
|
|
29
|
-
*/
|
|
30
|
-
outDir?: string;
|
|
31
|
-
/**
|
|
32
|
-
* 命令执行的工作目录。
|
|
33
|
-
* @default process.cwd()
|
|
34
|
-
*/
|
|
35
|
-
cwd?: string;
|
|
36
|
-
/**
|
|
37
|
-
* 是否跳过已有文件的覆写;开启后保留旧文件不做对比。
|
|
38
|
-
* @default false
|
|
39
|
-
*/
|
|
40
|
-
skipOverwrite?: boolean;
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
//#region src/commands/ai.d.ts
|
|
44
|
-
type AgenticTemplateFormat = 'md' | 'json';
|
|
45
|
-
interface GenerateAgenticTemplateOptions {
|
|
46
|
-
cwd?: string;
|
|
47
|
-
output?: string;
|
|
48
|
-
force?: boolean;
|
|
49
|
-
format?: AgenticTemplateFormat;
|
|
50
|
-
/**
|
|
51
|
-
* 任务名,用于快速生成带目录与后缀的文件。
|
|
52
|
-
*/
|
|
53
|
-
name?: string;
|
|
54
|
-
/**
|
|
55
|
-
* 基础目录,配合 name 使用。
|
|
56
|
-
* @default 'agentic/prompts'
|
|
57
|
-
*/
|
|
58
|
-
baseDir?: string;
|
|
59
|
-
/**
|
|
60
|
-
* 自动生成目录时使用的自定义文件夹名称。
|
|
61
|
-
* @default 自动生成的时间戳
|
|
62
|
-
*/
|
|
63
|
-
folderName?: string;
|
|
64
|
-
}
|
|
65
|
-
type AgenticTemplateTask = string | (Omit<GenerateAgenticTemplateOptions, 'cwd'> & {
|
|
66
|
-
name?: string;
|
|
67
|
-
});
|
|
68
|
-
declare const defaultAgenticBaseDir = "agentic/prompts";
|
|
69
|
-
declare function createTimestampFolderName(date?: Date): string;
|
|
70
|
-
/**
|
|
71
|
-
* 生成 Agentic 任务提示词模板,默认写入 agentic/prompts/<timestamp>/prompt.md,可自定义输出路径。
|
|
72
|
-
*/
|
|
73
|
-
declare function generateAgenticTemplate(options?: GenerateAgenticTemplateOptions): Promise<string>;
|
|
74
|
-
declare function loadAgenticTasks(filePath: string, cwd: string): Promise<AgenticTemplateTask[]>;
|
|
75
|
-
declare function generateAgenticTemplates(tasks: AgenticTemplateTask[], defaults?: GenerateAgenticTemplateOptions): Promise<string[]>;
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/commands/create.d.ts
|
|
78
|
-
/**
|
|
79
|
-
* 内置模板映射表,source 指向 templates 根目录下的来源目录,target 为生成路径。
|
|
80
|
-
*/
|
|
81
|
-
declare const templateMap: {
|
|
82
|
-
readonly tsup: {
|
|
83
|
-
readonly source: "tsup";
|
|
84
|
-
readonly target: "packages/tsup";
|
|
85
|
-
};
|
|
86
|
-
readonly tsdown: {
|
|
87
|
-
readonly source: "tsdown";
|
|
88
|
-
readonly target: "packages/tsdown";
|
|
89
|
-
};
|
|
90
|
-
readonly unbuild: {
|
|
91
|
-
readonly source: "unbuild";
|
|
92
|
-
readonly target: "packages/unbuild";
|
|
93
|
-
};
|
|
94
|
-
readonly 'vue-lib': {
|
|
95
|
-
readonly source: "vue-lib";
|
|
96
|
-
readonly target: "packages/vue-lib";
|
|
97
|
-
};
|
|
98
|
-
readonly 'hono-server': {
|
|
99
|
-
readonly source: "server";
|
|
100
|
-
readonly target: "apps/server";
|
|
101
|
-
};
|
|
102
|
-
readonly 'vue-hono': {
|
|
103
|
-
readonly source: "client";
|
|
104
|
-
readonly target: "apps/client";
|
|
105
|
-
};
|
|
106
|
-
readonly vitepress: {
|
|
107
|
-
readonly source: "vitepress";
|
|
108
|
-
readonly target: "apps/website";
|
|
109
|
-
};
|
|
110
|
-
readonly cli: {
|
|
111
|
-
readonly source: "cli";
|
|
112
|
-
readonly target: "apps/cli";
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
type CreateNewProjectType = keyof typeof templateMap;
|
|
116
|
-
interface CreateNewProjectOptions {
|
|
117
|
-
name?: string;
|
|
118
|
-
cwd?: string;
|
|
119
|
-
renameJson?: boolean;
|
|
120
|
-
type?: CreateNewProjectType | string;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* 若配置中提供 choices 则优先使用,否则退回默认预设。
|
|
124
|
-
*/
|
|
125
|
-
declare function getCreateChoices(choices?: CreateChoiceOption[]): CreateChoiceOption[] | ({
|
|
126
|
-
readonly name: "unbuild 打包";
|
|
127
|
-
readonly value: "unbuild";
|
|
128
|
-
} | {
|
|
129
|
-
readonly name: "tsup 打包";
|
|
130
|
-
readonly value: "tsup";
|
|
131
|
-
} | {
|
|
132
|
-
readonly name: "tsdown 打包";
|
|
133
|
-
readonly value: "tsdown";
|
|
134
|
-
} | {
|
|
135
|
-
readonly name: "vue 组件";
|
|
136
|
-
readonly value: "vue-lib";
|
|
137
|
-
} | {
|
|
138
|
-
readonly name: "vue hono 全栈";
|
|
139
|
-
readonly value: "vue-hono";
|
|
140
|
-
} | {
|
|
141
|
-
readonly name: "hono 模板";
|
|
142
|
-
readonly value: "hono-server";
|
|
143
|
-
} | {
|
|
144
|
-
readonly name: "vitepress 文档";
|
|
145
|
-
readonly value: "vitepress";
|
|
146
|
-
} | {
|
|
147
|
-
readonly name: "cli 模板";
|
|
148
|
-
readonly value: "cli";
|
|
149
|
-
})[];
|
|
150
|
-
/**
|
|
151
|
-
* 合并内置与自定义模板映射,允许扩展新的模板类型。
|
|
152
|
-
*/
|
|
153
|
-
declare function getTemplateMap(extra?: Record<string, string | TemplateDefinition>): Record<string, TemplateDefinition>;
|
|
154
|
-
/**
|
|
155
|
-
* 根据提供的参数或配置生成新工程目录,并可自动改写 package.json。
|
|
156
|
-
*/
|
|
157
|
-
declare function createNewProject(options?: CreateNewProjectOptions): Promise<void>;
|
|
158
|
-
//#endregion
|
|
159
|
-
//#region src/types/workspace.d.ts
|
|
160
|
-
/**
|
|
161
|
-
* 工作区工具可接收的筛选选项。
|
|
162
|
-
*/
|
|
163
|
-
interface GetWorkspacePackagesOptions {
|
|
164
|
-
/**
|
|
165
|
-
* 是否在结果中排除 workspace 根包。
|
|
166
|
-
* @default true
|
|
167
|
-
*/
|
|
168
|
-
ignoreRootPackage?: boolean;
|
|
169
|
-
/**
|
|
170
|
-
* 是否过滤掉标记为 `private` 的包。
|
|
171
|
-
* @default true
|
|
172
|
-
*/
|
|
173
|
-
ignorePrivatePackage?: boolean;
|
|
174
|
-
/**
|
|
175
|
-
* 自定义 glob,覆盖 `pnpm-workspace.yaml` 的 `packages` 配置。
|
|
176
|
-
* @default workspace manifest `packages`
|
|
177
|
-
*/
|
|
178
|
-
patterns?: string[];
|
|
179
|
-
}
|
|
180
|
-
//#endregion
|
|
181
|
-
//#region src/types/config.d.ts
|
|
182
|
-
interface AiCommandConfig {
|
|
183
|
-
/**
|
|
184
|
-
* 默认输出路径,不填则自动创建 `agentic/prompts/<timestamp>/prompt.md` 文件夹与模板。
|
|
185
|
-
* @default undefined
|
|
186
|
-
*/
|
|
187
|
-
output?: string;
|
|
188
|
-
/**
|
|
189
|
-
* 默认存放目录,配合 name / tasks 批量生成时使用。
|
|
190
|
-
* @default 'agentic/prompts'
|
|
191
|
-
*/
|
|
192
|
-
baseDir?: string;
|
|
193
|
-
/**
|
|
194
|
-
* 是否允许覆盖已存在文件。
|
|
195
|
-
* @default false
|
|
196
|
-
*/
|
|
197
|
-
force?: boolean;
|
|
198
|
-
/**
|
|
199
|
-
* 模板格式。
|
|
200
|
-
* @default 'md'
|
|
201
|
-
*/
|
|
202
|
-
format?: AgenticTemplateFormat;
|
|
203
|
-
/**
|
|
204
|
-
* 任务清单文件路径(JSON 数组),用于批量生成。
|
|
205
|
-
* @default undefined
|
|
206
|
-
*/
|
|
207
|
-
tasksFile?: string;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* `monorepo new` 命令的配置项,允许外部覆写模板目录、模板清单等。
|
|
211
|
-
*/
|
|
212
|
-
interface CreateCommandConfig extends Partial<Omit<CreateNewProjectOptions, 'cwd'>> {
|
|
213
|
-
/**
|
|
214
|
-
* 自定义模板根目录。
|
|
215
|
-
* @default 内置模板所在的 `packages/monorepo/templates`
|
|
216
|
-
*/
|
|
217
|
-
templatesDir?: string;
|
|
218
|
-
/**
|
|
219
|
-
* 扩展模板映射表,key 为类型,value 为模板来源/目标路径。
|
|
220
|
-
* @default 内置 `templateMap`
|
|
221
|
-
*/
|
|
222
|
-
templateMap?: Record<string, string | TemplateDefinition>;
|
|
223
|
-
/**
|
|
224
|
-
* 自定义交互提示的选项列表。
|
|
225
|
-
* @default 内置 `baseChoices`
|
|
226
|
-
*/
|
|
227
|
-
choices?: CreateChoiceOption[];
|
|
228
|
-
/**
|
|
229
|
-
* 当未选择模板时使用的默认模板。
|
|
230
|
-
* @default 'unbuild'
|
|
231
|
-
*/
|
|
232
|
-
defaultTemplate?: CreateNewProjectOptions['type'];
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* CLI 交互式选择框的选项结构。
|
|
236
|
-
*/
|
|
237
|
-
interface CreateChoiceOption {
|
|
238
|
-
/**
|
|
239
|
-
* 唯一值,将回传给命令逻辑使用。
|
|
240
|
-
* @default undefined
|
|
241
|
-
*/
|
|
242
|
-
value: string;
|
|
243
|
-
/**
|
|
244
|
-
* 选项展示名称。
|
|
245
|
-
* @default value
|
|
246
|
-
*/
|
|
247
|
-
name?: string;
|
|
248
|
-
/**
|
|
249
|
-
* 选项描述信息。
|
|
250
|
-
* @default undefined
|
|
251
|
-
*/
|
|
252
|
-
description?: string;
|
|
253
|
-
/**
|
|
254
|
-
* 短名称,用于命令行紧凑展示。
|
|
255
|
-
* @default undefined
|
|
256
|
-
*/
|
|
257
|
-
short?: string;
|
|
258
|
-
/**
|
|
259
|
-
* 设置为 true 或字符串即可禁用该选项并显示原因。
|
|
260
|
-
* @default false
|
|
261
|
-
*/
|
|
262
|
-
disabled?: boolean | string;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* `monorepo clean` 命令配置,可控制自动选择、排除包等行为。
|
|
266
|
-
*/
|
|
267
|
-
interface CleanCommandConfig {
|
|
268
|
-
/**
|
|
269
|
-
* 是否跳过交互直接清理全部。
|
|
270
|
-
* @default false
|
|
271
|
-
*/
|
|
272
|
-
autoConfirm?: boolean;
|
|
273
|
-
/**
|
|
274
|
-
* 不允许被清理的包名列表。
|
|
275
|
-
* @default []
|
|
276
|
-
*/
|
|
277
|
-
ignorePackages?: string[];
|
|
278
|
-
/**
|
|
279
|
-
* 是否包含 private 包。
|
|
280
|
-
* @default true
|
|
281
|
-
*/
|
|
282
|
-
includePrivate?: boolean;
|
|
283
|
-
/**
|
|
284
|
-
* 强制写回的 @icebreakers/monorepo 版本。
|
|
285
|
-
* @default 当前依赖版本
|
|
286
|
-
*/
|
|
287
|
-
pinnedVersion?: string;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* `monorepo sync` 命令配置,可覆盖 workspace 过滤规则或同步命令模板。
|
|
291
|
-
*/
|
|
292
|
-
interface SyncCommandConfig extends Partial<GetWorkspacePackagesOptions> {
|
|
293
|
-
/**
|
|
294
|
-
* 并发执行同步命令的最大数量。
|
|
295
|
-
* @default os.cpus().length
|
|
296
|
-
*/
|
|
297
|
-
concurrency?: number;
|
|
298
|
-
/**
|
|
299
|
-
* 自定义执行的同步命令模板,使用 {name} 占位。
|
|
300
|
-
* @default 'cnpm sync {name}'
|
|
301
|
-
*/
|
|
302
|
-
command?: string;
|
|
303
|
-
/**
|
|
304
|
-
* 仅同步指定的包(按名称过滤)。
|
|
305
|
-
* @default 同步全部可见包
|
|
306
|
-
*/
|
|
307
|
-
packages?: string[];
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* `monorepo upgrade` 命令配置,覆盖脚本、目标文件等能力。
|
|
311
|
-
*/
|
|
312
|
-
interface UpgradeCommandConfig extends Partial<CliOpts> {
|
|
313
|
-
/**
|
|
314
|
-
* 额外需要写入的目标文件列表。
|
|
315
|
-
* @default []
|
|
316
|
-
*/
|
|
317
|
-
targets?: string[];
|
|
318
|
-
/**
|
|
319
|
-
* 是否与默认目标合并,false 表示完全覆盖。
|
|
320
|
-
* @default true
|
|
321
|
-
*/
|
|
322
|
-
mergeTargets?: boolean;
|
|
323
|
-
/**
|
|
324
|
-
* 需要写入 package.json 的脚本集合。
|
|
325
|
-
* @default {}
|
|
326
|
-
*/
|
|
327
|
-
scripts?: Record<string, string>;
|
|
328
|
-
/**
|
|
329
|
-
* 是否跳过生成 changeset markdown。
|
|
330
|
-
* @default true
|
|
331
|
-
*/
|
|
332
|
-
skipChangesetMarkdown?: boolean;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* `monorepo init` 命令配置,用于跳过部分初始化步骤。
|
|
336
|
-
*/
|
|
337
|
-
interface InitCommandConfig {
|
|
338
|
-
/**
|
|
339
|
-
* 是否跳过 README 生成。
|
|
340
|
-
* @default false
|
|
341
|
-
*/
|
|
342
|
-
skipReadme?: boolean;
|
|
343
|
-
/**
|
|
344
|
-
* 是否跳过 package.json 写入。
|
|
345
|
-
* @default false
|
|
346
|
-
*/
|
|
347
|
-
skipPkgJson?: boolean;
|
|
348
|
-
/**
|
|
349
|
-
* 是否跳过 changeset 的更新。
|
|
350
|
-
* @default false
|
|
351
|
-
*/
|
|
352
|
-
skipChangeset?: boolean;
|
|
353
|
-
/**
|
|
354
|
-
* 是否跳过 Issue 模版 discussions 链接的更新。
|
|
355
|
-
* @default false
|
|
356
|
-
*/
|
|
357
|
-
skipIssueTemplateConfig?: boolean;
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* `monorepo mirror` 命令配置,可增加额外的环境变量镜像。
|
|
361
|
-
*/
|
|
362
|
-
interface MirrorCommandConfig {
|
|
363
|
-
/**
|
|
364
|
-
* 需要注入的环境变量键值对。
|
|
365
|
-
* @default {}
|
|
366
|
-
*/
|
|
367
|
-
env?: Record<string, string>;
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* 项目级配置入口,按命令划分可插拔的配置块。
|
|
371
|
-
*/
|
|
372
|
-
interface MonorepoConfig {
|
|
373
|
-
/**
|
|
374
|
-
* 按命令分类的可选配置。
|
|
375
|
-
* @default {}
|
|
376
|
-
*/
|
|
377
|
-
commands?: {
|
|
378
|
-
ai?: AiCommandConfig;
|
|
379
|
-
create?: CreateCommandConfig;
|
|
380
|
-
clean?: CleanCommandConfig;
|
|
381
|
-
sync?: SyncCommandConfig;
|
|
382
|
-
upgrade?: UpgradeCommandConfig;
|
|
383
|
-
init?: InitCommandConfig;
|
|
384
|
-
mirror?: MirrorCommandConfig;
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
//#endregion
|
|
388
|
-
//#region ../../node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.d.mts
|
|
389
|
-
interface PackageJson {
|
|
390
|
-
/**
|
|
391
|
-
* The name is what your thing is called.
|
|
392
|
-
* Some rules:
|
|
393
|
-
* - The name must be less than or equal to 214 characters. This includes the scope for scoped packages.
|
|
394
|
-
* - The name can’t start with a dot or an underscore.
|
|
395
|
-
* - New packages must not have uppercase letters in the name.
|
|
396
|
-
* - The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can’t contain any non-URL-safe characters.
|
|
397
|
-
*/
|
|
398
|
-
name?: string;
|
|
399
|
-
/**
|
|
400
|
-
* Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.)
|
|
401
|
-
*/
|
|
402
|
-
version?: string;
|
|
403
|
-
/**
|
|
404
|
-
* Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`.
|
|
405
|
-
*/
|
|
406
|
-
description?: string;
|
|
407
|
-
/**
|
|
408
|
-
* Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`.
|
|
409
|
-
*/
|
|
410
|
-
keywords?: string[];
|
|
411
|
-
/**
|
|
412
|
-
* The url to the project homepage.
|
|
413
|
-
*/
|
|
414
|
-
homepage?: string;
|
|
415
|
-
/**
|
|
416
|
-
* The url to your project’s issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package.
|
|
417
|
-
*/
|
|
418
|
-
bugs?: string | {
|
|
419
|
-
url?: string;
|
|
420
|
-
email?: string;
|
|
421
|
-
};
|
|
422
|
-
/**
|
|
423
|
-
* You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it.
|
|
424
|
-
*/
|
|
425
|
-
license?: string;
|
|
426
|
-
/**
|
|
427
|
-
* Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the `npm docs` command will be able to find you.
|
|
428
|
-
* For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install:
|
|
429
|
-
*/
|
|
430
|
-
repository?: string | {
|
|
431
|
-
type: string;
|
|
432
|
-
url: string;
|
|
433
|
-
/**
|
|
434
|
-
* If the `package.json` for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives:
|
|
435
|
-
*/
|
|
436
|
-
directory?: string;
|
|
437
|
-
};
|
|
438
|
-
/**
|
|
439
|
-
* The `scripts` field is a dictionary containing script commands that are run at various times in the lifecycle of your package.
|
|
440
|
-
*/
|
|
441
|
-
scripts?: PackageJsonScripts;
|
|
442
|
-
/**
|
|
443
|
-
* If you set `"private": true` in your package.json, then npm will refuse to publish it.
|
|
444
|
-
*/
|
|
445
|
-
private?: boolean;
|
|
446
|
-
/**
|
|
447
|
-
* The “author” is one person.
|
|
448
|
-
*/
|
|
449
|
-
author?: PackageJsonPerson;
|
|
450
|
-
/**
|
|
451
|
-
* “contributors” is an array of people.
|
|
452
|
-
*/
|
|
453
|
-
contributors?: PackageJsonPerson[];
|
|
454
|
-
/**
|
|
455
|
-
* An object containing a URL that provides up-to-date information
|
|
456
|
-
* about ways to help fund development of your package,
|
|
457
|
-
* a string URL, or an array of objects and string URLs
|
|
458
|
-
*/
|
|
459
|
-
funding?: PackageJsonFunding | PackageJsonFunding[];
|
|
460
|
-
/**
|
|
461
|
-
* The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to `.gitignore`, but reversed: including a file, directory, or glob pattern (`*`, `**\/*`, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to `["*"]`, which means it will include all files.
|
|
462
|
-
*/
|
|
463
|
-
files?: string[];
|
|
464
|
-
/**
|
|
465
|
-
* The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module’s exports object will be returned.
|
|
466
|
-
* This should be a module ID relative to the root of your package folder.
|
|
467
|
-
* For most modules, it makes the most sense to have a main script and often not much else.
|
|
468
|
-
*/
|
|
469
|
-
main?: string;
|
|
470
|
-
/**
|
|
471
|
-
* If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window)
|
|
472
|
-
*/
|
|
473
|
-
browser?: string | Record<string, string | false>;
|
|
474
|
-
/**
|
|
475
|
-
* The `unpkg` field is used to specify the URL to a UMD module for your package. This is used by default in the unpkg.com CDN service.
|
|
476
|
-
*/
|
|
477
|
-
unpkg?: string;
|
|
478
|
-
/**
|
|
479
|
-
* A map of command name to local file name. On install, npm will symlink that file into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs.
|
|
480
|
-
*/
|
|
481
|
-
bin?: string | Record<string, string>;
|
|
482
|
-
/**
|
|
483
|
-
* Specify either a single file or an array of filenames to put in place for the `man` program to find.
|
|
484
|
-
*/
|
|
485
|
-
man?: string | string[];
|
|
486
|
-
/**
|
|
487
|
-
* Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.
|
|
488
|
-
*/
|
|
489
|
-
dependencies?: Record<string, string>;
|
|
490
|
-
/**
|
|
491
|
-
* If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use.
|
|
492
|
-
* In this case, it’s best to map these additional items in a `devDependencies` object.
|
|
493
|
-
*/
|
|
494
|
-
devDependencies?: Record<string, string>;
|
|
495
|
-
/**
|
|
496
|
-
* If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the `optionalDependencies` object. This is a map of package name to version or url, just like the `dependencies` object. The difference is that build failures do not cause installation to fail.
|
|
497
|
-
*/
|
|
498
|
-
optionalDependencies?: Record<string, string>;
|
|
499
|
-
/**
|
|
500
|
-
* In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.
|
|
501
|
-
*/
|
|
502
|
-
peerDependencies?: Record<string, string>;
|
|
503
|
-
/**
|
|
504
|
-
* TypeScript typings, typically ending by `.d.ts`.
|
|
505
|
-
*/
|
|
506
|
-
types?: string;
|
|
507
|
-
/**
|
|
508
|
-
* This field is synonymous with `types`.
|
|
509
|
-
*/
|
|
510
|
-
typings?: string;
|
|
511
|
-
/**
|
|
512
|
-
* Non-Standard Node.js alternate entry-point to main.
|
|
513
|
-
* An initial implementation for supporting CJS packages (from main), and use module for ESM modules.
|
|
514
|
-
*/
|
|
515
|
-
module?: string;
|
|
516
|
-
/**
|
|
517
|
-
* Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require"
|
|
518
|
-
*
|
|
519
|
-
* Docs:
|
|
520
|
-
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field
|
|
521
|
-
*
|
|
522
|
-
* @default 'commonjs'
|
|
523
|
-
* @since Node.js v14
|
|
524
|
-
*/
|
|
525
|
-
type?: "module" | "commonjs";
|
|
526
|
-
/**
|
|
527
|
-
* Alternate and extensible alternative to "main" entry point.
|
|
528
|
-
*
|
|
529
|
-
* When using `{type: "module"}`, any ESM module file MUST end with `.mjs` extension.
|
|
530
|
-
*
|
|
531
|
-
* Docs:
|
|
532
|
-
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar
|
|
533
|
-
*
|
|
534
|
-
* @since Node.js v12.7
|
|
535
|
-
*/
|
|
536
|
-
exports?: PackageJsonExports;
|
|
537
|
-
/**
|
|
538
|
-
* Docs:
|
|
539
|
-
* - https://nodejs.org/api/packages.html#imports
|
|
540
|
-
*/
|
|
541
|
-
imports?: Record<string, string | Record<string, string>>;
|
|
542
|
-
/**
|
|
543
|
-
* The field is used to define a set of sub-packages (or workspaces) within a monorepo.
|
|
544
|
-
*
|
|
545
|
-
* This field is an array of glob patterns or an object with specific configurations for managing
|
|
546
|
-
* multiple packages in a single repository.
|
|
547
|
-
*/
|
|
548
|
-
workspaces?: string[] | {
|
|
549
|
-
/**
|
|
550
|
-
* Workspace package paths. Glob patterns are supported.
|
|
551
|
-
*/
|
|
552
|
-
packages?: string[];
|
|
553
|
-
/**
|
|
554
|
-
* Packages to block from hoisting to the workspace root.
|
|
555
|
-
* Uses glob patterns to match module paths in the dependency tree.
|
|
556
|
-
*
|
|
557
|
-
* Docs:
|
|
558
|
-
* - https://classic.yarnpkg.com/blog/2018/02/15/nohoist/
|
|
559
|
-
*/
|
|
560
|
-
nohoist?: string[];
|
|
561
|
-
};
|
|
562
|
-
/**
|
|
563
|
-
* The field is used to specify different TypeScript declaration files for
|
|
564
|
-
* different versions of TypeScript, allowing for version-specific type definitions.
|
|
565
|
-
*/
|
|
566
|
-
typesVersions?: Record<string, Record<string, string[]>>;
|
|
567
|
-
/**
|
|
568
|
-
* You can specify which operating systems your module will run on:
|
|
569
|
-
* ```json
|
|
570
|
-
* {
|
|
571
|
-
* "os": ["darwin", "linux"]
|
|
572
|
-
* }
|
|
573
|
-
* ```
|
|
574
|
-
* You can also block instead of allowing operating systems, just prepend the blocked os with a '!':
|
|
575
|
-
* ```json
|
|
576
|
-
* {
|
|
577
|
-
* "os": ["!win32"]
|
|
578
|
-
* }
|
|
579
|
-
* ```
|
|
580
|
-
* The host operating system is determined by `process.platform`
|
|
581
|
-
* It is allowed to both block and allow an item, although there isn't any good reason to do this.
|
|
582
|
-
*/
|
|
583
|
-
os?: string[];
|
|
584
|
-
/**
|
|
585
|
-
* If your code only runs on certain cpu architectures, you can specify which ones.
|
|
586
|
-
* ```json
|
|
587
|
-
* {
|
|
588
|
-
* "cpu": ["x64", "ia32"]
|
|
589
|
-
* }
|
|
590
|
-
* ```
|
|
591
|
-
* Like the `os` option, you can also block architectures:
|
|
592
|
-
* ```json
|
|
593
|
-
* {
|
|
594
|
-
* "cpu": ["!arm", "!mips"]
|
|
595
|
-
* }
|
|
596
|
-
* ```
|
|
597
|
-
* The host architecture is determined by `process.arch`
|
|
598
|
-
*/
|
|
599
|
-
cpu?: string[];
|
|
600
|
-
/**
|
|
601
|
-
* This is a set of config values that will be used at publish-time.
|
|
602
|
-
*/
|
|
603
|
-
publishConfig?: {
|
|
604
|
-
/**
|
|
605
|
-
* The registry that will be used if the package is published.
|
|
606
|
-
*/
|
|
607
|
-
registry?: string;
|
|
608
|
-
/**
|
|
609
|
-
* The tag that will be used if the package is published.
|
|
610
|
-
*/
|
|
611
|
-
tag?: string;
|
|
612
|
-
/**
|
|
613
|
-
* The access level that will be used if the package is published.
|
|
614
|
-
*/
|
|
615
|
-
access?: "public" | "restricted";
|
|
616
|
-
/**
|
|
617
|
-
* **pnpm-only**
|
|
618
|
-
*
|
|
619
|
-
* By default, for portability reasons, no files except those listed in
|
|
620
|
-
* the bin field will be marked as executable in the resulting package
|
|
621
|
-
* archive. The executableFiles field lets you declare additional fields
|
|
622
|
-
* that must have the executable flag (+x) set even if
|
|
623
|
-
* they aren't directly accessible through the bin field.
|
|
624
|
-
*/
|
|
625
|
-
executableFiles?: string[];
|
|
626
|
-
/**
|
|
627
|
-
* **pnpm-only**
|
|
628
|
-
*
|
|
629
|
-
* You also can use the field `publishConfig.directory` to customize
|
|
630
|
-
* the published subdirectory relative to the current `package.json`.
|
|
631
|
-
*
|
|
632
|
-
* It is expected to have a modified version of the current package in
|
|
633
|
-
* the specified directory (usually using third party build tools).
|
|
634
|
-
*/
|
|
635
|
-
directory?: string;
|
|
636
|
-
/**
|
|
637
|
-
* **pnpm-only**
|
|
638
|
-
*
|
|
639
|
-
* When set to `true`, the project will be symlinked from the
|
|
640
|
-
* `publishConfig.directory` location during local development.
|
|
641
|
-
* @default true
|
|
642
|
-
*/
|
|
643
|
-
linkDirectory?: boolean;
|
|
644
|
-
} & Pick<PackageJson, "bin" | "main" | "exports" | "types" | "typings" | "module" | "browser" | "unpkg" | "typesVersions" | "os" | "cpu">;
|
|
645
|
-
/**
|
|
646
|
-
* See: https://nodejs.org/api/packages.html#packagemanager
|
|
647
|
-
* This field defines which package manager is expected to be used when working on the current project.
|
|
648
|
-
* Should be of the format: `<name>@<version>[#hash]`
|
|
649
|
-
*/
|
|
650
|
-
packageManager?: string;
|
|
651
|
-
[key: string]: any;
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* See: https://docs.npmjs.com/cli/v11/using-npm/scripts#pre--post-scripts
|
|
655
|
-
*/
|
|
656
|
-
type PackageJsonScriptWithPreAndPost<S extends string> = S | `${"pre" | "post"}${S}`;
|
|
657
|
-
/**
|
|
658
|
-
* See: https://docs.npmjs.com/cli/v11/using-npm/scripts#life-cycle-operation-order
|
|
659
|
-
*/
|
|
660
|
-
type PackageJsonNpmLifeCycleScripts = "dependencies" | "prepublishOnly" | PackageJsonScriptWithPreAndPost<"install" | "pack" | "prepare" | "publish" | "restart" | "start" | "stop" | "test" | "version">;
|
|
661
|
-
/**
|
|
662
|
-
* See: https://pnpm.io/scripts#lifecycle-scripts
|
|
663
|
-
*/
|
|
664
|
-
type PackageJsonPnpmLifeCycleScripts = "pnpm:devPreinstall";
|
|
665
|
-
type PackageJsonCommonScripts = "build" | "coverage" | "deploy" | "dev" | "format" | "lint" | "preview" | "release" | "typecheck" | "watch";
|
|
666
|
-
type PackageJsonScriptName = PackageJsonCommonScripts | PackageJsonNpmLifeCycleScripts | PackageJsonPnpmLifeCycleScripts | (string & {});
|
|
667
|
-
type PackageJsonScripts = { [P in PackageJsonScriptName]?: string };
|
|
668
|
-
/**
|
|
669
|
-
* A “person” is an object with a “name” field and optionally “url” and “email”. Or you can shorten that all into a single string, and npm will parse it for you.
|
|
670
|
-
*/
|
|
671
|
-
type PackageJsonPerson = string | {
|
|
672
|
-
name: string;
|
|
673
|
-
email?: string;
|
|
674
|
-
url?: string;
|
|
675
|
-
};
|
|
676
|
-
type PackageJsonFunding = string | {
|
|
677
|
-
url: string;
|
|
678
|
-
type?: string;
|
|
679
|
-
};
|
|
680
|
-
type PackageJsonExportKey = "." | "import" | "require" | "types" | "node" | "browser" | "default" | (string & {});
|
|
681
|
-
type PackageJsonExportsObject = { [P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject> };
|
|
682
|
-
type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
|
|
683
|
-
/**
|
|
684
|
-
* Defines a PackageJson structure.
|
|
685
|
-
* @param pkg - The `package.json` content as an object. See {@link PackageJson}.
|
|
686
|
-
* @returns the same `package.json` object.
|
|
687
|
-
*/
|
|
688
|
-
//#endregion
|
|
689
|
-
//#region src/commands/skills.d.ts
|
|
690
|
-
declare const skillTargets: readonly ["codex", "claude"];
|
|
691
|
-
type SkillTarget = typeof skillTargets[number];
|
|
692
|
-
interface SyncSkillsOptions {
|
|
693
|
-
cwd?: string;
|
|
694
|
-
targets?: SkillTarget[];
|
|
695
|
-
}
|
|
696
|
-
declare function getSkillTargetPaths(homeDir?: string): Record<SkillTarget, string>;
|
|
697
|
-
declare function syncSkills(options?: SyncSkillsOptions): Promise<{
|
|
698
|
-
target: SkillTarget;
|
|
699
|
-
dest: string;
|
|
700
|
-
}[]>;
|
|
701
|
-
//#endregion
|
|
702
|
-
//#region src/core/git.d.ts
|
|
703
|
-
/**
|
|
704
|
-
* 对 simple-git 的轻量封装,集中处理配置缓存与常用查询。
|
|
705
|
-
*/
|
|
706
|
-
declare class GitClient {
|
|
707
|
-
#private;
|
|
708
|
-
private readonly client;
|
|
709
|
-
constructor(options?: Partial<SimpleGitOptions>);
|
|
710
|
-
/**
|
|
711
|
-
* 读取 Git 的 config 列表,原样返回 simple-git 的结果。
|
|
712
|
-
*/
|
|
713
|
-
listConfig(): simple_git0.Response<simple_git0.ConfigListSummary>;
|
|
714
|
-
/**
|
|
715
|
-
* 初始化配置缓存,避免多次访问 Git 产生的性能损耗。
|
|
716
|
-
*/
|
|
717
|
-
init(): Promise<ConfigValues>;
|
|
718
|
-
/**
|
|
719
|
-
* 获取缓存的配置,若未初始化则自动触发 init。
|
|
720
|
-
*/
|
|
721
|
-
getConfig(): Promise<ConfigValues>;
|
|
722
|
-
/**
|
|
723
|
-
* 解析 remote.origin.url,返回 git-url-parse 的结构,便于获取仓库元信息。
|
|
724
|
-
*/
|
|
725
|
-
getGitUrl(): Promise<gitUrlParse.GitUrl | undefined>;
|
|
726
|
-
/**
|
|
727
|
-
* 组合 owner/name,生成常用的仓库名表达。
|
|
728
|
-
*/
|
|
729
|
-
getRepoName(): Promise<string | undefined>;
|
|
730
|
-
/**
|
|
731
|
-
* 从 Git 配置中提取用户信息,用于填充 package.json author 字段。
|
|
732
|
-
*/
|
|
733
|
-
getUser(): Promise<{
|
|
734
|
-
name: string | string[] | undefined;
|
|
735
|
-
email: string | string[] | undefined;
|
|
736
|
-
}>;
|
|
737
|
-
/**
|
|
738
|
-
* 获取当前仓库的顶层目录路径。
|
|
739
|
-
*/
|
|
740
|
-
getRepoRoot(): Promise<string | undefined>;
|
|
741
|
-
}
|
|
742
|
-
//#endregion
|
|
743
|
-
//#region src/core/workspace.d.ts
|
|
744
|
-
/**
|
|
745
|
-
* 读取 pnpm workspace 下的所有包,并根据配置过滤与补充字段。
|
|
746
|
-
*/
|
|
747
|
-
declare function getWorkspacePackages(workspaceDir: string, options?: GetWorkspacePackagesOptions): Promise<{
|
|
748
|
-
pkgJsonPath: string;
|
|
749
|
-
rootDir: _pnpm_types0.ProjectRootDir;
|
|
750
|
-
rootDirRealPath: _pnpm_types0.ProjectRootDirRealPath;
|
|
751
|
-
modulesDir?: string;
|
|
752
|
-
manifest: _pnpm_types0.ProjectManifest;
|
|
753
|
-
writeProjectManifest: (manifest: _pnpm_types0.ProjectManifest, force?: boolean | undefined) => Promise<void>;
|
|
754
|
-
}[]>;
|
|
755
|
-
/**
|
|
756
|
-
* 将工作区绝对路径、包列表与当前 cwd 打包返回,方便调用方一次获取所有信息。
|
|
757
|
-
*/
|
|
758
|
-
declare function getWorkspaceData(cwd: string, options?: GetWorkspacePackagesOptions): Promise<{
|
|
759
|
-
cwd: string;
|
|
760
|
-
workspaceDir: string;
|
|
761
|
-
packages: {
|
|
762
|
-
pkgJsonPath: string;
|
|
763
|
-
rootDir: _pnpm_types0.ProjectRootDir;
|
|
764
|
-
rootDirRealPath: _pnpm_types0.ProjectRootDirRealPath;
|
|
765
|
-
modulesDir?: string;
|
|
766
|
-
manifest: _pnpm_types0.ProjectManifest;
|
|
767
|
-
writeProjectManifest: (manifest: _pnpm_types0.ProjectManifest, force?: boolean | undefined) => Promise<void>;
|
|
768
|
-
}[];
|
|
769
|
-
}>;
|
|
770
|
-
//#endregion
|
|
771
|
-
//#region src/commands/clean.d.ts
|
|
772
|
-
/**
|
|
773
|
-
* 交互式清理被选中的包目录,同时重写根 package.json 中的 @icebreakers/monorepo 版本。
|
|
774
|
-
*/
|
|
775
|
-
declare function cleanProjects(cwd: string, overrides?: Partial<CleanCommandConfig>): Promise<void>;
|
|
776
|
-
//#endregion
|
|
777
|
-
//#region src/commands/init/index.d.ts
|
|
778
|
-
/**
|
|
779
|
-
* 初始化命令入口,根据配置逐步生成基础文件。
|
|
780
|
-
*/
|
|
781
|
-
declare function init(cwd: string): Promise<void>;
|
|
782
|
-
//#endregion
|
|
783
|
-
//#region src/commands/mirror/binaryMirror.d.ts
|
|
784
|
-
/**
|
|
785
|
-
* 根据中国大陆镜像源,自动向 VSCode settings.json 注入终端环境变量。
|
|
786
|
-
*/
|
|
787
|
-
declare function setVscodeBinaryMirror(cwd: string): Promise<void>;
|
|
788
|
-
//#endregion
|
|
789
|
-
//#region src/commands/sync.d.ts
|
|
790
|
-
/**
|
|
791
|
-
* 批量执行 `cnpm sync`(或自定义命令),将所有包同步到 npmmirror。
|
|
792
|
-
*/
|
|
793
|
-
declare function syncNpmMirror(cwd: string, options?: GetWorkspacePackagesOptions): Promise<void>;
|
|
794
|
-
//#endregion
|
|
795
|
-
//#region src/commands/upgrade/index.d.ts
|
|
796
|
-
/**
|
|
797
|
-
* 将 assets 目录的模版文件同步到工程中,实现一键升级脚手架能力。
|
|
798
|
-
*/
|
|
799
|
-
declare function upgradeMonorepo(opts: CliOpts): Promise<void>;
|
|
800
|
-
//#endregion
|
|
801
|
-
//#region package.json.d.ts
|
|
802
|
-
declare let name: string;
|
|
803
|
-
declare let version: string;
|
|
804
|
-
//#endregion
|
|
805
|
-
//#region src/constants.d.ts
|
|
806
|
-
/**
|
|
807
|
-
* @icebreakers/monorepo 包的根目录。
|
|
808
|
-
*/
|
|
809
|
-
declare const packageDir: string;
|
|
810
|
-
/**
|
|
811
|
-
* monorepo 根目录,方便需要跳出当前包的逻辑(例如定位工作区文件)。
|
|
812
|
-
*/
|
|
813
|
-
declare const rootDir: string;
|
|
814
|
-
//#endregion
|
|
815
|
-
//#region src/core/config.d.ts
|
|
816
|
-
/**
|
|
817
|
-
* 提供类型提示的辅助函数,供外部定义配置时使用。
|
|
818
|
-
*/
|
|
819
|
-
declare function defineMonorepoConfig(config: MonorepoConfig): MonorepoConfig;
|
|
820
|
-
/**
|
|
821
|
-
* 加载指定目录的 monorepo 配置,并利用缓存提升性能。
|
|
822
|
-
*/
|
|
823
|
-
declare function loadMonorepoConfig(cwd: string): Promise<MonorepoConfig>;
|
|
824
|
-
/**
|
|
825
|
-
* 获取命令对应的合并配置,若未配置则返回空对象,保证调用端逻辑简单。
|
|
826
|
-
*/
|
|
827
|
-
declare function resolveCommandConfig<Name extends keyof NonNullable<MonorepoConfig['commands']>>(name: Name, cwd: string): Promise<NonNullable<MonorepoConfig['commands']>[Name]>;
|
|
828
|
-
//#endregion
|
|
829
|
-
//#region src/core/context.d.ts
|
|
830
|
-
/**
|
|
831
|
-
* 构建命令执行上下文,封装常用的工作区、Git、配置等信息。
|
|
832
|
-
*/
|
|
833
|
-
declare function createContext(cwd: string): Promise<{
|
|
834
|
-
cwd: string;
|
|
835
|
-
git: GitClient;
|
|
836
|
-
gitUrl: git_url_parse0.GitUrl | undefined;
|
|
837
|
-
gitUser: {
|
|
838
|
-
name: string | string[] | undefined;
|
|
839
|
-
email: string | string[] | undefined;
|
|
840
|
-
};
|
|
841
|
-
workspaceDir: string;
|
|
842
|
-
workspaceFilepath: string;
|
|
843
|
-
packages: {
|
|
844
|
-
pkgJsonPath: string;
|
|
845
|
-
rootDir: _pnpm_types0.ProjectRootDir;
|
|
846
|
-
rootDirRealPath: _pnpm_types0.ProjectRootDirRealPath;
|
|
847
|
-
modulesDir?: string;
|
|
848
|
-
manifest: _pnpm_types0.ProjectManifest;
|
|
849
|
-
writeProjectManifest: (manifest: _pnpm_types0.ProjectManifest, force?: boolean | undefined) => Promise<void>;
|
|
850
|
-
}[];
|
|
851
|
-
config: MonorepoConfig;
|
|
852
|
-
}>;
|
|
853
|
-
/**
|
|
854
|
-
* 统一导出的上下文类型,方便下游函数准确获知可用字段。
|
|
855
|
-
*/
|
|
856
|
-
type Context = Awaited<ReturnType<typeof createContext>>;
|
|
857
|
-
//#endregion
|
|
858
|
-
//#region src/core/logger.d.ts
|
|
859
|
-
/**
|
|
860
|
-
* 统一的日志实例,便于在命令行中输出带有前缀和颜色的消息。
|
|
861
|
-
*/
|
|
862
|
-
declare const logger: consola.ConsolaInstance;
|
|
863
|
-
//#endregion
|
|
864
|
-
//#region src/utils/fs.d.ts
|
|
865
|
-
interface JsonWriteOptions {
|
|
866
|
-
spaces?: number;
|
|
867
|
-
}
|
|
868
|
-
declare function pathExists(targetPath: string): Promise<boolean>;
|
|
869
|
-
declare const exists: typeof pathExists;
|
|
870
|
-
declare function ensureDir(targetPath: string): Promise<void>;
|
|
871
|
-
declare function ensureFile(targetPath: string): Promise<void>;
|
|
872
|
-
declare function remove(targetPath: string): Promise<void>;
|
|
873
|
-
declare function copy(sourcePath: string, targetPath: string): Promise<void>;
|
|
874
|
-
declare function outputFile(targetPath: string, data: Parameters<typeof writeFile>[1], options?: Parameters<typeof writeFile>[2]): Promise<void>;
|
|
875
|
-
declare function readJson<T = any>(targetPath: string): Promise<T>;
|
|
876
|
-
declare const readJSON: typeof readJson;
|
|
877
|
-
declare function writeJson(targetPath: string, data: unknown, options?: JsonWriteOptions): Promise<void>;
|
|
878
|
-
declare const writeJSON: typeof writeJson;
|
|
879
|
-
declare function outputJson(targetPath: string, data: unknown, options?: JsonWriteOptions): Promise<void>;
|
|
880
|
-
declare const outputJSON: typeof outputJson;
|
|
881
|
-
/**
|
|
882
|
-
* 判断是否为可忽略的文件系统错误。
|
|
883
|
-
* - ENOENT: 文件已被删除
|
|
884
|
-
* - EBUSY: Windows 中资源被系统占用
|
|
885
|
-
*/
|
|
886
|
-
declare function isIgnorableFsError(error: unknown): error is NodeJS.ErrnoException;
|
|
887
|
-
//#endregion
|
|
888
|
-
//#region src/utils/github.d.ts
|
|
889
|
-
/**
|
|
890
|
-
* 将 Issue 模版里的 discussions 链接同步为当前仓库的 discussions 地址。
|
|
891
|
-
*/
|
|
892
|
-
declare function updateIssueTemplateConfig(source: string, repoName?: string): string;
|
|
893
|
-
//#endregion
|
|
894
|
-
//#region src/utils/hash.d.ts
|
|
895
|
-
/**
|
|
896
|
-
* 生成给定二进制内容的 md5 摘要,用于快速比较文件内容。
|
|
897
|
-
*/
|
|
898
|
-
declare function getFileHash(data: crypto.BinaryLike): string;
|
|
899
|
-
/**
|
|
900
|
-
* 对比两个文件的 md5,如果不一致则认为内容有变化。
|
|
901
|
-
*/
|
|
902
|
-
declare function isFileChanged(src: crypto.BinaryLike, dest: crypto.BinaryLike): boolean;
|
|
903
|
-
//#endregion
|
|
904
|
-
//#region src/utils/object.d.ts
|
|
905
|
-
type PathInput = readonly string[] | string;
|
|
906
|
-
declare function setByPath(target: Record<PropertyKey, any>, path: PathInput, value: unknown): Record<PropertyKey, any>;
|
|
907
|
-
//#endregion
|
|
908
|
-
//#region src/utils/regexp.d.ts
|
|
909
|
-
/**
|
|
910
|
-
* 逃逸正则表达式中所有特殊字符,避免被当做模式解析。
|
|
911
|
-
*/
|
|
912
|
-
declare function escapeStringRegexp(str: string): string;
|
|
913
|
-
/**
|
|
914
|
-
* 判断字符串是否命中任意一个正则,用于过滤要同步的资产文件。
|
|
915
|
-
*/
|
|
916
|
-
declare function isMatch(str: string, arr: RegExp[]): boolean;
|
|
917
|
-
//#endregion
|
|
918
|
-
export { AgenticTemplateFormat, AgenticTemplateTask, type AiCommandConfig, type CleanCommandConfig, type CliOpts, type ConfigValues, Context, type CreateChoiceOption, type CreateCommandConfig, CreateNewProjectOptions, GenerateAgenticTemplateOptions, type GetWorkspacePackagesOptions, GitClient, type InitCommandConfig, JsonWriteOptions, type MirrorCommandConfig, type MonorepoConfig, type PackageJson, type SimpleGit, type SimpleGitOptions, SkillTarget, type SyncCommandConfig, SyncSkillsOptions, type UpgradeCommandConfig, assetsDir, cleanProjects, copy, createContext, createNewProject, createTimestampFolderName, defaultAgenticBaseDir, defineMonorepoConfig, ensureDir, ensureFile, escapeStringRegexp, exists, generateAgenticTemplate, generateAgenticTemplates, getCreateChoices, getFileHash, getSkillTargetPaths, getTemplateMap, getWorkspaceData, getWorkspacePackages, init, isFileChanged, isGitignoreFile, isIgnorableFsError, isMatch, loadAgenticTasks, loadMonorepoConfig, logger, name, outputFile, outputJSON, outputJson, packageDir, pathExists, readJSON, readJson, remove, resolveCommandConfig, rootDir, setByPath, setVscodeBinaryMirror, skillTargets, syncNpmMirror, syncSkills, templateMap, templatesDir, toPublishGitignorePath, toWorkspaceGitignorePath, updateIssueTemplateConfig, upgradeMonorepo, version, writeJSON, writeJson };
|