@applift/core 0.4.0 → 0.6.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/index.d.mts +225 -7
- package/dist/index.mjs +1173 -54
- package/dist/{plugin-DzhwzVfu.d.mts → plugin-B2GGlI_2.d.mts} +50 -31
- package/dist/plugins/index.d.mts +2 -2
- package/package.json +4 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as electronAdapter, A as ReleaseConfigSchema, B as ChannelCapabilities, C as CredentialsProfile, D as ProjectConfig, E as GlobalConfigSchema, F as VersionCodeConfig, G as ReviewStatus, H as ChannelEvent, I as VersionCodeConfigSchema, J as BundleIds, K as StageResult, L as VersionConfig, M as StoreConfigSchema, N as Stores, O as ProjectConfigSchema, P as StoresSchema, Q as detectFramework, R as VersionConfigSchema, S as CredentialsFileSchema, T as GlobalConfig, U as ChannelRegistry, V as ChannelContext, W as ReleasePlanEntry, X as Platform, Y as FrameworkAdapter, Z as detectBundleIds, _ as appendEntry, a as PluginHost, at as rnAdapter, b as BetaConfigSchema, c as PipelineInput, d as runStage, et as findArtifacts, f as runSubmit, g as HistoryQuery, h as HistoryEvent, i as PluginHookName, it as nativeIosAdapter, j as StoreConfig, k as ReleaseConfig, l as PipelineSummary, m as HistoryEntry, n as AppliftUserConfig, nt as nativeAndroidAdapter, o as defineConfig, ot as tauriAdapter, p as HISTORY_PATH, q as SubmitResult, r as HookContext, rt as nativeHarmonyAdapter, s as resolvePlugins, t as AppliftPlugin, tt as flutterAdapter, u as PipelineSummaryEntry, v as readEntries, w as CredentialsProfileSchema, x as CredentialsFile, y as BetaConfig, z as Channel } from "./plugin-B2GGlI_2.mjs";
|
|
2
2
|
//#region src/registry.d.ts
|
|
3
3
|
export declare class DefaultChannelRegistry implements ChannelRegistry {
|
|
4
4
|
private readonly channels;
|
|
@@ -30,8 +30,13 @@ export declare function loadCredentials(filePath?: string): CredentialsFile;
|
|
|
30
30
|
* knownKeys 提供时其裸键名(如 PGYER_API_KEY)也认(向后兼容),未提供的裸大写键不捡(避免误吸无关变量)。
|
|
31
31
|
*/
|
|
32
32
|
export declare function resolveProfile(creds: CredentialsFile, profile: string, knownKeys?: string[]): Record<string, string>;
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
export interface GlobalConfigLoadResult {
|
|
34
|
+
config: GlobalConfig;
|
|
35
|
+
/** 配置文件损坏降级默认值时的警告(调用方决定呈现方式;core 保持 headless 不写 stderr) */
|
|
36
|
+
warning?: string;
|
|
37
|
+
}
|
|
38
|
+
/** 全局配置装载(缺失/损坏降级默认值;警告经返回值交给调用方,不阻断) */
|
|
39
|
+
export declare function loadGlobalConfig(filePath?: string): GlobalConfigLoadResult;
|
|
35
40
|
/** 写凭据(目录自动创建,文件强制 0600) */
|
|
36
41
|
export declare function saveCredentials(data: CredentialsFile, filePath?: string): void;
|
|
37
42
|
//#endregion
|
|
@@ -42,7 +47,7 @@ export interface LoadedProjectConfig {
|
|
|
42
47
|
* c12 原始配置(保留 plugins 等 schema 外键)——插件发现(resolvePlugins)用;
|
|
43
48
|
* 业务字段一律以 config(zod 解析后)为准。
|
|
44
49
|
*/
|
|
45
|
-
raw:
|
|
50
|
+
raw: AppliftUserConfig;
|
|
46
51
|
/** 配置文件所在目录(解析相对路径用),无配置文件时为 cwd */
|
|
47
52
|
cwd: string;
|
|
48
53
|
}
|
|
@@ -80,6 +85,10 @@ export declare class PgyerChannel implements Channel {
|
|
|
80
85
|
readonly id = "pgyer";
|
|
81
86
|
readonly label = "蒲公英";
|
|
82
87
|
readonly capabilities: ChannelCapabilities;
|
|
88
|
+
/** 平台错误码 → 人话(1247:源码注释已证 = buildKey 尚未就绪/COS 仍在入库) */
|
|
89
|
+
readonly errorHints: {
|
|
90
|
+
"1247": string;
|
|
91
|
+
};
|
|
83
92
|
plan(ctx: ChannelContext): Promise<ReleasePlanEntry>;
|
|
84
93
|
stage(ctx: ChannelContext): Promise<StageResult>;
|
|
85
94
|
submit(): Promise<SubmitResult>;
|
|
@@ -172,6 +181,11 @@ export declare class XiaomiChannel implements Channel {
|
|
|
172
181
|
readonly id = "xiaomi";
|
|
173
182
|
readonly label = "小米应用商店";
|
|
174
183
|
readonly capabilities: ChannelCapabilities;
|
|
184
|
+
/** 平台错误码 → 人话(result 码:依据为本仓测试已固化的真实失败路径文案) */
|
|
185
|
+
readonly errorHints: {
|
|
186
|
+
"401": string;
|
|
187
|
+
"1005": string;
|
|
188
|
+
};
|
|
175
189
|
plan(_ctx: ChannelContext): Promise<ReleasePlanEntry>;
|
|
176
190
|
/** 小米不支持只传包:push 接口上传即提审 */
|
|
177
191
|
stage(_ctx: ChannelContext): Promise<StageResult>;
|
|
@@ -286,6 +300,10 @@ export declare class YybChannel implements Channel {
|
|
|
286
300
|
readonly id = "yyb";
|
|
287
301
|
readonly label = "腾讯应用宝";
|
|
288
302
|
readonly capabilities: ChannelCapabilities;
|
|
303
|
+
/** 平台错误码 → 人话(ret 码:依据为本仓测试已固化的真实失败路径) */
|
|
304
|
+
readonly errorHints: {
|
|
305
|
+
"10010": string;
|
|
306
|
+
};
|
|
289
307
|
/** stage 产物暂存(serial_number + md5),submit 按 appId 取回 */
|
|
290
308
|
private readonly staged;
|
|
291
309
|
private required;
|
|
@@ -384,11 +402,24 @@ export declare class GooglePlayChannel implements Channel {
|
|
|
384
402
|
readonly id = "googleplay";
|
|
385
403
|
readonly label = "Google Play";
|
|
386
404
|
readonly capabilities: ChannelCapabilities;
|
|
405
|
+
/** 平台错误码 → 人话(HTTP 状态:依据为本仓测试已固化的失败路径) */
|
|
406
|
+
readonly errorHints: {
|
|
407
|
+
"403": string;
|
|
408
|
+
};
|
|
387
409
|
plan(_ctx: ChannelContext): Promise<ReleasePlanEntry>;
|
|
388
410
|
stage(ctx: ChannelContext): Promise<StageResult>;
|
|
389
|
-
submit(ctx: ChannelContext): Promise<SubmitResult>;
|
|
411
|
+
submit(ctx: ChannelContext, stagedRef?: string): Promise<SubmitResult>;
|
|
412
|
+
/** 复用 stage 已上传的 versionCode:开新 edit(仍需 auth)→ 部署 production → commit,跳过上传 */
|
|
413
|
+
private assignExisting;
|
|
390
414
|
/** 上传 + 部署到指定轨道 + commit,返回 `editId:versionCode` */
|
|
391
415
|
private uploadAndAssign;
|
|
416
|
+
/**
|
|
417
|
+
* 部署 versionCode 到指定轨道并 commit:
|
|
418
|
+
* 先 GET 轨道现有 releases 再合并 PUT——目标 release(同 status=completed 配置)追加新 versionCode,
|
|
419
|
+
* 其余 releases 原样保留(status/userFraction 不变),避免整轨覆盖把旧版本从轨道剔除;
|
|
420
|
+
* :commit 冒号语法(对拍 apkgo googleplay.go 权威;对 production 含提交审核语义,internal 即生效)
|
|
421
|
+
*/
|
|
422
|
+
private deployAndCommit;
|
|
392
423
|
status(ctx: Pick<ChannelContext, "credentials" | "target">): Promise<ReviewStatus>;
|
|
393
424
|
private requirePkgName;
|
|
394
425
|
}
|
|
@@ -400,10 +431,197 @@ export declare function sha256File(filePath: string): string;
|
|
|
400
431
|
//#region src/channels/shared/error-codes.d.ts
|
|
401
432
|
/**
|
|
402
433
|
* 错误码人话化:消费各渠道自带 errorHints(平台内聚——表与渠道实现同文件)。
|
|
434
|
+
* 网络类故障(AbortSignal 超时/断连/DNS)渠道层不转译,统一在此兜底提示。
|
|
403
435
|
*/
|
|
404
436
|
export declare function humanizeError(hints: Record<string, string> | undefined, message: string): string;
|
|
405
437
|
//#endregion
|
|
406
|
-
//#region src/
|
|
438
|
+
//#region src/channels/shared/redact.d.ts
|
|
439
|
+
/**
|
|
440
|
+
* 文本脱敏(三层层叠,逐层尝试):
|
|
441
|
+
* 1) http(s) URL 带 query/userinfo → query 按名脱敏 + 剥 userinfo
|
|
442
|
+
* 2) { / [ 开头且整串为合法 JSON → 递归按键名脱敏
|
|
443
|
+
* 3) 其余 → name=value 正则扫(错误消息等无结构文本)
|
|
444
|
+
*/
|
|
445
|
+
export declare function redactText(v: string): string;
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/version/project.d.ts
|
|
448
|
+
export type VersionFileKind = "gradle" | "pbxproj" | "app-json5" | "pubspec" | "package-json" | "tauri" | "expo-app-json";
|
|
449
|
+
export interface PlatformVersionInfo {
|
|
450
|
+
platform: string;
|
|
451
|
+
versionName?: string;
|
|
452
|
+
versionCode?: string;
|
|
453
|
+
file: string;
|
|
454
|
+
kind: VersionFileKind;
|
|
455
|
+
/** 非标准形态说明(读出但不代写,提示改造) */
|
|
456
|
+
problem?: string;
|
|
457
|
+
}
|
|
458
|
+
export interface VersionWrite {
|
|
459
|
+
platform: string;
|
|
460
|
+
versionName: string;
|
|
461
|
+
versionCode: number;
|
|
462
|
+
}
|
|
463
|
+
/** 各端版本实况(按框架布局;未识别框架时尝试全部标准位置) */
|
|
464
|
+
export declare function readProjectVersions(cwd: string, framework: FrameworkAdapter | null): PlatformVersionInfo[];
|
|
465
|
+
/**
|
|
466
|
+
* 写回各端版本(多端 versionName 同步、versionCode 各端独立)。
|
|
467
|
+
* 返回实际改动的文件列表(commit 范围)。problem 端跳过并在返回中列出(不阻断其他端)。
|
|
468
|
+
*/
|
|
469
|
+
export declare function writeProjectVersions(cwd: string, framework: FrameworkAdapter | null, writes: VersionWrite[]): {
|
|
470
|
+
changed: string[];
|
|
471
|
+
skipped: Array<{
|
|
472
|
+
platform: string;
|
|
473
|
+
reason: string;
|
|
474
|
+
}>;
|
|
475
|
+
};
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/version/infer.d.ts
|
|
478
|
+
export type BumpLevel = "major" | "minor" | "patch";
|
|
479
|
+
export interface InferResult {
|
|
480
|
+
level: BumpLevel;
|
|
481
|
+
/** 展示用判定说明(中文,CLI 直接输出) */
|
|
482
|
+
reason: string;
|
|
483
|
+
total: number;
|
|
484
|
+
breaking: number;
|
|
485
|
+
feat: number;
|
|
486
|
+
fix: number;
|
|
487
|
+
}
|
|
488
|
+
/** conventional commits → bump level:BREAKING > feat(minor) > fix(patch);无可识别提交 → patch */
|
|
489
|
+
export declare function inferBumpLevel(messages: string[]): InferResult;
|
|
490
|
+
export interface DecideOptions {
|
|
491
|
+
/** 显式 level:major | minor | patch | prerelease */
|
|
492
|
+
level?: string;
|
|
493
|
+
/** prerelease 标识(beta | rc…),与 level 组合或延续当前 */
|
|
494
|
+
pre?: string;
|
|
495
|
+
}
|
|
496
|
+
export interface DecideResult {
|
|
497
|
+
/** 完整 semver(可含 prerelease,tag 与 changelog 用) */
|
|
498
|
+
next: string;
|
|
499
|
+
/** 判定说明 */
|
|
500
|
+
reason: string;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* 从当前版本决定下一版本(纯函数)。
|
|
504
|
+
* - 显式 level:semver.inc;当前是 prerelease 且不带 --pre → 剥离转正式(4.0.0-beta.3 + patch → 4.0.0)
|
|
505
|
+
* - 无 level:用 infer 结果
|
|
506
|
+
* - prerelease level:当前有 pre → 同基线递进(beta.3 → beta.4);无 pre → 报错(应使用 --pre 进入)
|
|
507
|
+
* - --pre:从 level 出发挂 prerelease(4.0.0 + minor + beta → 4.1.0-beta.1)
|
|
508
|
+
* current 非 semver 时抛错(调用方要求显式指定或先手动规范化)。
|
|
509
|
+
*/
|
|
510
|
+
export declare function decideNextVersion(current: string, opts: DecideOptions, infer?: InferResult): DecideResult;
|
|
511
|
+
/** 工程文件写入用的三段数字 versionName(prerelease 只留在 tag,不进商店) */
|
|
512
|
+
export declare function storeVersionName(full: string): string;
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/version/bump.d.ts
|
|
515
|
+
export interface BumpOptions {
|
|
516
|
+
cwd: string;
|
|
517
|
+
framework: FrameworkAdapter | null;
|
|
518
|
+
/** major | minor | patch | prerelease | <semver>;缺省走推断 */
|
|
519
|
+
level?: string;
|
|
520
|
+
/** prerelease 标识(beta | rc…) */
|
|
521
|
+
pre?: string;
|
|
522
|
+
versionCode?: VersionCodeConfig;
|
|
523
|
+
/** 仅限端(缺省全端);平台名 = android/ios/harmony/flutter/js/tauri/expo */
|
|
524
|
+
platforms?: string[];
|
|
525
|
+
}
|
|
526
|
+
export interface BumpPlan {
|
|
527
|
+
anchorTag?: string;
|
|
528
|
+
/** 疑似失败重跑(HEAD 是 release commit 且锚点后无新业务提交)——CLI 在 --yes 且无显式 level 时拒绝 */
|
|
529
|
+
suspectRerun?: boolean;
|
|
530
|
+
/** 基线版本(多端中最大 semver) */
|
|
531
|
+
base: string;
|
|
532
|
+
currentVersions: PlatformVersionInfo[];
|
|
533
|
+
/** 完整 semver(tag/changelog 用,可含 prerelease) */
|
|
534
|
+
nextVersion: string;
|
|
535
|
+
/** 商店 versionName(三段数字,工程文件用) */
|
|
536
|
+
storeName: string;
|
|
537
|
+
reason: string;
|
|
538
|
+
infer?: InferResult;
|
|
539
|
+
commits: string[];
|
|
540
|
+
writes: VersionWrite[];
|
|
541
|
+
versionCodeNote: string;
|
|
542
|
+
}
|
|
543
|
+
export declare function planBump(opts: BumpOptions): BumpPlan;
|
|
544
|
+
export interface ApplyOptions {
|
|
545
|
+
/** 代 commit(默认 true;--no-commit 跳过) */
|
|
546
|
+
commit: boolean;
|
|
547
|
+
/** 代打 tag(默认 true;--no-tag 跳过) */
|
|
548
|
+
tag: boolean;
|
|
549
|
+
}
|
|
550
|
+
export interface ApplyResult {
|
|
551
|
+
changedFiles: string[];
|
|
552
|
+
skipped: Array<{
|
|
553
|
+
platform: string;
|
|
554
|
+
reason: string;
|
|
555
|
+
}>;
|
|
556
|
+
changelogFile?: string;
|
|
557
|
+
committed: boolean;
|
|
558
|
+
tagged: boolean;
|
|
559
|
+
/** commit/tag 失败原因(降级不阻断:文件已写好,提示用户手动收尾) */
|
|
560
|
+
warnings: string[];
|
|
561
|
+
}
|
|
562
|
+
export declare function applyBump(cwd: string, plan: BumpPlan, framework: FrameworkAdapter | null, opts: ApplyOptions): ApplyResult;
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region src/version/version-code.d.ts
|
|
565
|
+
/**
|
|
566
|
+
* versionCode 计算:默认递增 +1;可配公式(如 major*1000000+minor*1000+patch)。
|
|
567
|
+
* 实际写入 = max(公式值, 现值+1)——公式在同 versionName 重发时算出同值,
|
|
568
|
+
* +1 兜底保证单调(AGC 同版本不能重复提交 / Google Play 单调 / App Store 单调)。
|
|
569
|
+
*/
|
|
570
|
+
/** 公式白名单求值(仅支持 + - * ( ) 数字 与 major/minor/patch 变量;不 eval) */
|
|
571
|
+
export declare function evalVersionCodeFormula(formula: string, v: {
|
|
572
|
+
major: number;
|
|
573
|
+
minor: number;
|
|
574
|
+
patch: number;
|
|
575
|
+
}): number | undefined;
|
|
576
|
+
/**
|
|
577
|
+
* 下一 versionCode:max(公式值, 现值+1)。
|
|
578
|
+
* - 无现值(首接工程无该字段):公式值,否则 1
|
|
579
|
+
* - 有现值:至少现值+1(吞 3052/4000000 等任意历史值,首次 bump 即归一)
|
|
580
|
+
*/
|
|
581
|
+
export declare function nextVersionCode(current: number | undefined, formulaValue: number | undefined): number;
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region src/version/changelog.d.ts
|
|
584
|
+
export interface ChangelogEntry {
|
|
585
|
+
type: string;
|
|
586
|
+
scope?: string;
|
|
587
|
+
subject: string;
|
|
588
|
+
breaking: boolean;
|
|
589
|
+
hash?: string;
|
|
590
|
+
}
|
|
591
|
+
/** raw commit messages → 结构化条目(feat/fix/BREAKING 之外的 type 也保留,渲染时归类) */
|
|
592
|
+
export declare function toChangelogEntries(messages: string[]): ChangelogEntry[];
|
|
593
|
+
/** 渲染单个版本段落(## [4.1.0] - 2026-10-17) */
|
|
594
|
+
export declare function renderChangelogSection(version: string, date: string, entries: ChangelogEntry[]): string;
|
|
595
|
+
/**
|
|
596
|
+
* 插入/替换 CHANGELOG.md 的版本段落(幂等):
|
|
597
|
+
* - 已有 `## [version]` → 整段替换为最新渲染
|
|
598
|
+
* - 否则插到首个 # Changelog 标题之后;无标题/无文件 → 新建带标题
|
|
599
|
+
* 返回写入路径;entries 为空也写入 heading(bump 闭环保持 tag ↔ changelog 对齐)。
|
|
600
|
+
*/
|
|
601
|
+
export declare function upsertChangelog(cwd: string, version: string, section: string): string;
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region src/version/git.d.ts
|
|
604
|
+
export interface GitResult {
|
|
605
|
+
ok: boolean;
|
|
606
|
+
stdout: string;
|
|
607
|
+
stderr: string;
|
|
608
|
+
}
|
|
609
|
+
export declare function git(cwd: string, args: string[]): GitResult;
|
|
610
|
+
export declare function isGitRepo(cwd: string): boolean;
|
|
611
|
+
/** 宽松 semver 解析(可选 v/前缀,如 v4.1.0 / 4.1.0-beta.3 / release-4.1.0 里取 semver 部分) */
|
|
612
|
+
export declare function looseSemver(tag: string): string | undefined;
|
|
613
|
+
/**
|
|
614
|
+
* 最新 semver tag(按版本序取最大,非创建时间——修复补打旧版本 tag 的场景更稳)。
|
|
615
|
+
* 无 tag / 非 git 仓库返回 undefined。
|
|
616
|
+
*/
|
|
617
|
+
export declare function latestSemverTag(cwd: string): string | undefined;
|
|
618
|
+
/** 锚点 tag..HEAD 的完整 commit messages(%B 含 footer,NUL 分隔——body 内建换行安全) */
|
|
619
|
+
export declare function commitsSince(cwd: string, ref?: string): string[];
|
|
620
|
+
/** 工作区状态(--porcelain)。注意:不走通用 git()——其 stdout.trim() 会剥掉首行前导空格,
|
|
621
|
+
* 破坏 porcelain 的两列状态位(" M file" → "M file"),此处保留原始行仅去行尾。 */
|
|
622
|
+
export declare function statusShort(cwd: string): string[];
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region src/version/artifact.d.ts
|
|
407
625
|
export interface ArtifactVersion {
|
|
408
626
|
versionName?: string;
|
|
409
627
|
versionCode?: string;
|
|
@@ -412,4 +630,4 @@ export interface ArtifactVersion {
|
|
|
412
630
|
}
|
|
413
631
|
export declare function readArtifactVersion(artifactPath: string): ArtifactVersion | undefined;
|
|
414
632
|
//#endregion
|
|
415
|
-
export { BetaConfig, BetaConfigSchema, BundleIds, Channel, ChannelCapabilities, ChannelContext, ChannelEvent, ChannelRegistry, CredentialsFile, CredentialsFileSchema, CredentialsProfile, CredentialsProfileSchema, FrameworkAdapter, GlobalConfig, GlobalConfigSchema, HISTORY_PATH, HistoryEntry, HistoryEvent, HistoryQuery, HookContext, PipelineInput, PipelineSummary, PipelineSummaryEntry, Platform, PluginHookName, PluginHost, ProjectConfig, ProjectConfigSchema,
|
|
633
|
+
export { AppliftPlugin, AppliftUserConfig, BetaConfig, BetaConfigSchema, BundleIds, Channel, ChannelCapabilities, ChannelContext, ChannelEvent, ChannelRegistry, CredentialsFile, CredentialsFileSchema, CredentialsProfile, CredentialsProfileSchema, FrameworkAdapter, GlobalConfig, GlobalConfigSchema, HISTORY_PATH, HistoryEntry, HistoryEvent, HistoryQuery, HookContext, PipelineInput, PipelineSummary, PipelineSummaryEntry, Platform, PluginHookName, PluginHost, ProjectConfig, ProjectConfigSchema, ReleaseConfig, ReleaseConfigSchema, ReleasePlanEntry, ReviewStatus, StageResult, StoreConfig, StoreConfigSchema, Stores, StoresSchema, SubmitResult, VersionCodeConfig, VersionCodeConfigSchema, VersionConfig, VersionConfigSchema, appendEntry, defineConfig, detectBundleIds, detectFramework, electronAdapter, findArtifacts, flutterAdapter, nativeAndroidAdapter, nativeHarmonyAdapter, nativeIosAdapter, readEntries, resolvePlugins, rnAdapter, runStage, runSubmit, tauriAdapter };
|