@thinkingai/ae-cli 6.0.20 → 6.0.22
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 +1 -4
- package/README.zh.md +1 -4
- package/dist/{auth-DYC2BGLM.js → auth-I2G7OAU2.js} +2 -4
- package/dist/{auth-GHBMJ5ZR.js → auth-RDN6D5HU.js} +32 -104
- package/dist/{chunk-5OC7CYCG.js → chunk-2W7HULUD.js} +14 -14
- package/dist/chunk-4EUZRJPO.js +163 -0
- package/dist/{chunk-DMMEPCST.js → chunk-5FBLRSMU.js} +25 -115
- package/dist/{chunk-BJX3GXWC.js → chunk-E34XH4GW.js} +2 -2
- package/dist/chunk-FPE5LGVU.js +105 -0
- package/dist/{chunk-I5CRVM2S.js → chunk-H52CSLJW.js} +44 -17
- package/dist/{chunk-RSHMZ3LG.js → chunk-U6QPKCN3.js} +6 -20
- package/dist/{chunk-6W4QOZAL.js → chunk-WPXHCP4A.js} +23 -13
- package/dist/{chunk-PN3OS34E.js → chunk-XE2PI5DS.js} +1 -1
- package/dist/{chunk-2DUEAXV3.js → chunk-YACCPUNQ.js} +1 -1
- package/dist/cli-token-6AGEDJF4.js +14 -0
- package/dist/{client-2UJ63MVQ.js → client-VTJMUZ4O.js} +3 -3
- package/dist/{config-NCUGK6NS.js → config-2SDTLGOC.js} +3 -3
- package/dist/index.js +309 -197
- package/dist/metadata-JZ2OTWBK.js +420 -0
- package/dist/{model-SJSOZTRS.js → model-ZYMRN4VS.js} +2 -2
- package/dist/{raw-7NVWSVJP.js → raw-NGYHAL3F.js} +4 -4
- package/dist/{sync-GRVO4K3U.js → sync-JVLX6TGW.js} +3 -3
- package/dist/{te-agent-CYZUC4US.js → te-agent-QPZTLHPH.js} +2 -2
- package/dist/{te-analysis-HJ22TUAA.js → te-analysis-WWX3Z6RP.js} +46 -24
- package/dist/{te-audience-MYDE5WEH.js → te-audience-UXGHUVBB.js} +27 -18
- package/dist/{te-common-WNCZB7R7.js → te-common-7XXH73MF.js} +5 -4
- package/dist/{te-community-JEEFXPB3.js → te-community-QKE67HR2.js} +5 -4
- package/dist/{te-dataops-ZTS7XMXM.js → te-dataops-6W7NNYST.js} +4 -5
- package/dist/{te-engage-4XHCTS6I.js → te-engage-NCFAQFX3.js} +5 -4
- package/dist/{te-kb-OWM3RQRH.js → te-kb-K5BQYUCM.js} +4 -5
- package/dist/{te-meta-JVO4QJBH.js → te-meta-LJZBOSMO.js} +26 -19
- package/dist/{te-team-YY24VORI.js → te-team-DHK5R7MV.js} +5 -6
- package/package.json +3 -2
- package/skills/ae-analysis/SKILL.md +9 -2
- package/skills/ae-analysis/references/build_attribution_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_cluster_definition.md +2 -0
- package/skills/ae-analysis/references/build_distribution_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_event_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_funnel_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_heat_map_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_interval_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_path_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_prop_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_rank_list_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_retention_analysis_qp.md +2 -0
- package/skills/ae-analysis/references/build_tag_definition.md +2 -0
- package/skills/ae-analysis/references/list_clusters.md +3 -1
- package/skills/ae-analysis/references/list_events.md +5 -2
- package/skills/ae-analysis/references/list_metrics.md +4 -2
- package/skills/ae-analysis/references/list_properties.md +4 -2
- package/skills/ae-analysis/references/list_tags.md +3 -1
- package/skills/ae-generate-tracking-code/SKILL.md +68 -31
- package/skills/ae-generate-tracking-code/references/snippet-delivery.md +26 -1
- package/skills/ae-generate-tracking-code/references/te-api.md +47 -164
- package/skills/ae-generate-tracking-plan/SKILL.md +109 -32
- package/skills/ae-generate-tracking-plan/references/te-api.md +57 -27
- package/skills/ae-metadata/SKILL.md +90 -0
- package/skills/ae-metadata/references/metadata_data_table_csv_delete.md +15 -0
- package/skills/ae-metadata/references/metadata_data_table_csv_write.md +29 -0
- package/skills/ae-metadata/references/metadata_data_table_download.md +17 -0
- package/skills/ae-metadata/references/metadata_data_table_get.md +24 -0
- package/skills/ae-metadata/references/metadata_data_table_list.md +27 -0
- package/skills/ae-metadata/references/metadata_data_table_property_bindings_update.md +17 -0
- package/skills/ae-metadata/references/metadata_data_table_sql_delete.md +15 -0
- package/skills/ae-metadata/references/metadata_data_table_sql_write.md +31 -0
- package/skills/ae-metadata/references/metadata_event_get.md +52 -0
- package/skills/ae-metadata/references/metadata_input_file_upload.md +29 -0
- package/skills/ae-metadata/references/metadata_property_dimension_table_bind_existing.md +27 -0
- package/skills/ae-metadata/references/metadata_property_dimension_table_create_and_bind_csv.md +30 -0
- package/skills/ae-metadata/references/metadata_property_get.md +54 -0
package/dist/index.js
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TeAgentApiError,
|
|
3
3
|
TeAgentCredentialsError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-H52CSLJW.js";
|
|
5
5
|
import {
|
|
6
6
|
printError,
|
|
7
7
|
printOutput
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YACCPUNQ.js";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
executeCapability,
|
|
11
|
+
uploadInputFileBytes
|
|
12
|
+
} from "./chunk-4EUZRJPO.js";
|
|
12
13
|
import {
|
|
13
14
|
PermissionError
|
|
14
15
|
} from "./chunk-NOO24N7W.js";
|
|
16
|
+
import {
|
|
17
|
+
clearCliToken,
|
|
18
|
+
getCliToken
|
|
19
|
+
} from "./chunk-FPE5LGVU.js";
|
|
15
20
|
import {
|
|
16
21
|
SecureStoreAuthError,
|
|
17
|
-
getToken,
|
|
18
22
|
resolveHost
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-U6QPKCN3.js";
|
|
20
24
|
import {
|
|
21
25
|
getActiveHost,
|
|
22
26
|
getConfigDir,
|
|
23
27
|
logger,
|
|
24
28
|
safeJsonParse
|
|
25
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-WPXHCP4A.js";
|
|
26
30
|
|
|
27
31
|
// src/index.ts
|
|
28
32
|
import { Command as CommanderCommand } from "commander";
|
|
@@ -33,13 +37,13 @@ import * as readline from "readline";
|
|
|
33
37
|
async function runCommand(cmd, opts, globalOpts) {
|
|
34
38
|
try {
|
|
35
39
|
const ctx = createRuntimeContext(cmd, opts, globalOpts);
|
|
36
|
-
const cmdName = `${cmd.service} ${cmd.command}`;
|
|
40
|
+
const cmdName = cmd.resource ? `${cmd.service} ${cmd.resource} ${cmd.command}` : `${cmd.service} ${cmd.command}`;
|
|
37
41
|
logger.command(cmdName, opts);
|
|
38
42
|
for (const flag of cmd.flags) {
|
|
39
43
|
if (flag.required) {
|
|
40
44
|
const val = opts[camelCase(flag.name)];
|
|
41
45
|
if (val === void 0 || val === null || val === "") {
|
|
42
|
-
printError("validation", `Missing required flag: --${flag.name}`, `Usage: ae-cli ${
|
|
46
|
+
printError("validation", `Missing required flag: --${flag.name}`, `Usage: ae-cli ${cmdName} --${flag.name} <value>`);
|
|
43
47
|
process.exit(1);
|
|
44
48
|
}
|
|
45
49
|
}
|
|
@@ -71,7 +75,7 @@ async function runCommand(cmd, opts, globalOpts) {
|
|
|
71
75
|
return;
|
|
72
76
|
}
|
|
73
77
|
if (cmd.risk === "write" && !globalOpts.yes) {
|
|
74
|
-
const confirmed = await confirm(`This is a write operation (${
|
|
78
|
+
const confirmed = await confirm(`This is a write operation (${cmdName}). Continue?`);
|
|
75
79
|
if (!confirmed) {
|
|
76
80
|
process.stderr.write("Aborted.\n");
|
|
77
81
|
process.exit(0);
|
|
@@ -113,7 +117,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
113
117
|
let _clientModule = null;
|
|
114
118
|
async function getClient() {
|
|
115
119
|
if (!_clientModule) {
|
|
116
|
-
_clientModule = await import("./client-
|
|
120
|
+
_clientModule = await import("./client-VTJMUZ4O.js");
|
|
117
121
|
}
|
|
118
122
|
return _clientModule;
|
|
119
123
|
}
|
|
@@ -161,8 +165,8 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
161
165
|
return client.queryReportData(projectId, reportId, qp, eventModel, options, ctx.host());
|
|
162
166
|
},
|
|
163
167
|
async token() {
|
|
164
|
-
const { getToken
|
|
165
|
-
return
|
|
168
|
+
const { getToken } = await import("./auth-I2G7OAU2.js");
|
|
169
|
+
return getToken(ctx.host());
|
|
166
170
|
},
|
|
167
171
|
host() {
|
|
168
172
|
if (globalOpts.host) return globalOpts.host;
|
|
@@ -185,10 +189,10 @@ function camelCase(str) {
|
|
|
185
189
|
}
|
|
186
190
|
async function confirm(message) {
|
|
187
191
|
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
188
|
-
return new Promise((
|
|
192
|
+
return new Promise((resolve3) => {
|
|
189
193
|
rl.question(`${message} [y/N] `, (answer) => {
|
|
190
194
|
rl.close();
|
|
191
|
-
|
|
195
|
+
resolve3(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
192
196
|
});
|
|
193
197
|
});
|
|
194
198
|
}
|
|
@@ -207,7 +211,15 @@ function registerCommands(program2, commands) {
|
|
|
207
211
|
serviceCmd = program2.command(service).description(`${service} domain commands`);
|
|
208
212
|
}
|
|
209
213
|
for (const cmd of cmds) {
|
|
210
|
-
|
|
214
|
+
let parent = serviceCmd;
|
|
215
|
+
if (cmd.resource) {
|
|
216
|
+
let resourceCmd = serviceCmd.commands.find((c) => c.name() === cmd.resource);
|
|
217
|
+
if (!resourceCmd) {
|
|
218
|
+
resourceCmd = serviceCmd.command(cmd.resource).description(`${cmd.resource} commands`);
|
|
219
|
+
}
|
|
220
|
+
parent = resourceCmd;
|
|
221
|
+
}
|
|
222
|
+
const sub = parent.command(cmd.command).description(cmd.description);
|
|
211
223
|
for (const flag of cmd.flags) {
|
|
212
224
|
const flagStr = buildFlagString(flag);
|
|
213
225
|
if (flag.type === "boolean") {
|
|
@@ -403,7 +415,7 @@ function notifyIfUpdateAvailable(pkg2) {
|
|
|
403
415
|
|
|
404
416
|
// src/commands/tracking/plan.ts
|
|
405
417
|
import { readFile, writeFile, cp } from "fs/promises";
|
|
406
|
-
import path3, { resolve } from "path";
|
|
418
|
+
import path3, { resolve as resolve2 } from "path";
|
|
407
419
|
|
|
408
420
|
// src/tracking/xlsx/write.ts
|
|
409
421
|
import ExcelJS from "exceljs";
|
|
@@ -1016,30 +1028,13 @@ async function writeDraftXlsx(d, outPath, locale = "zh") {
|
|
|
1016
1028
|
await workbook.xlsx.writeFile(outPath);
|
|
1017
1029
|
}
|
|
1018
1030
|
|
|
1019
|
-
// src/tracking/i18n/ae-locale.ts
|
|
1020
|
-
function aeLocaleToCli(raw) {
|
|
1021
|
-
const normalized = raw.trim().replace("-", "_").toLowerCase();
|
|
1022
|
-
if (normalized.startsWith("zh")) return "zh";
|
|
1023
|
-
if (normalized.startsWith("en")) return "en";
|
|
1024
|
-
if (normalized.startsWith("ja")) return "ja";
|
|
1025
|
-
if (normalized.startsWith("ko")) return "ko";
|
|
1026
|
-
return null;
|
|
1027
|
-
}
|
|
1028
|
-
function cliLocaleToAE(locale) {
|
|
1029
|
-
switch (locale) {
|
|
1030
|
-
case "zh":
|
|
1031
|
-
return "zh_CN";
|
|
1032
|
-
case "en":
|
|
1033
|
-
return "en_US";
|
|
1034
|
-
case "ja":
|
|
1035
|
-
return "ja_JP";
|
|
1036
|
-
case "ko":
|
|
1037
|
-
return "ko_KR";
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
1031
|
// src/core/tracking-client.ts
|
|
1042
1032
|
var DEBUG_BASE = "/v1/ta/bury/manage/debug";
|
|
1033
|
+
var TRACK_CAPABILITY_DOMAIN = "analysis";
|
|
1034
|
+
var TRACK_PROGRAM_QUERY = "track.program.query";
|
|
1035
|
+
var TRACK_PROGRAM_DELETE = "track.program.delete";
|
|
1036
|
+
var TRACK_PROGRAM_EXCEL_SAVE = "track.program.excel_save";
|
|
1037
|
+
var TRACK_PROGRAM_XLSX_PURPOSE = "track.program.xlsx";
|
|
1043
1038
|
function buildUrl(host, modulePath, params = {}) {
|
|
1044
1039
|
const base = host.replace(/\/$/, "");
|
|
1045
1040
|
const p = modulePath.startsWith("/") ? modulePath : `/${modulePath}`;
|
|
@@ -1049,89 +1044,185 @@ function buildUrl(host, modulePath, params = {}) {
|
|
|
1049
1044
|
}
|
|
1050
1045
|
return url.toString();
|
|
1051
1046
|
}
|
|
1052
|
-
function
|
|
1047
|
+
function record(value) {
|
|
1048
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
1049
|
+
}
|
|
1050
|
+
function pick(source, camelKey, snakeKey) {
|
|
1051
|
+
return source[camelKey] ?? source[snakeKey];
|
|
1052
|
+
}
|
|
1053
|
+
function stringArray(value) {
|
|
1054
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
1055
|
+
}
|
|
1056
|
+
function mapArray(value, mapper) {
|
|
1057
|
+
return Array.isArray(value) ? value.map(record).filter((item) => item !== null).map(mapper) : [];
|
|
1058
|
+
}
|
|
1059
|
+
function normalizeProperty(value) {
|
|
1060
|
+
return {
|
|
1061
|
+
name: value.name,
|
|
1062
|
+
displayName: pick(value, "displayName", "display_name"),
|
|
1063
|
+
type: value.type,
|
|
1064
|
+
desc: value.desc,
|
|
1065
|
+
createTime: pick(value, "createTime", "create_time"),
|
|
1066
|
+
creator: value.creator,
|
|
1067
|
+
lastUpdateAuth: pick(value, "lastUpdateAuth", "last_update_auth"),
|
|
1068
|
+
lastUpdateTime: pick(value, "lastUpdateTime", "last_update_time"),
|
|
1069
|
+
hasReported: pick(value, "hasReported", "has_reported")
|
|
1070
|
+
};
|
|
1071
|
+
}
|
|
1072
|
+
function normalizeUserProperty(value) {
|
|
1073
|
+
return {
|
|
1074
|
+
...normalizeProperty(value),
|
|
1075
|
+
propTag: pick(value, "propTag", "prop_tag"),
|
|
1076
|
+
updateType: pick(value, "updateType", "update_type") ?? "user_set",
|
|
1077
|
+
updateTypeName: pick(value, "updateTypeName", "update_type_name")
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
function normalizeEvent(value) {
|
|
1081
|
+
return {
|
|
1082
|
+
eventName: pick(value, "eventName", "event_name") ?? "",
|
|
1083
|
+
displayName: pick(value, "displayName", "display_name"),
|
|
1084
|
+
eventDesc: pick(value, "eventDesc", "event_desc"),
|
|
1085
|
+
eventTag: pick(value, "eventTag", "event_tag"),
|
|
1086
|
+
createTime: pick(value, "createTime", "create_time"),
|
|
1087
|
+
creator: value.creator,
|
|
1088
|
+
lastUpdateAuth: pick(value, "lastUpdateAuth", "last_update_auth"),
|
|
1089
|
+
lastUpdateTime: pick(value, "lastUpdateTime", "last_update_time"),
|
|
1090
|
+
hasReported: pick(value, "hasReported", "has_reported"),
|
|
1091
|
+
props: stringArray(value.props),
|
|
1092
|
+
propInfosOnEvent: pick(value, "propInfosOnEvent", "prop_infos_on_event")
|
|
1093
|
+
};
|
|
1094
|
+
}
|
|
1095
|
+
function normalizeProgram(value) {
|
|
1096
|
+
const data = record(value);
|
|
1053
1097
|
if (!data) return null;
|
|
1054
|
-
|
|
1055
|
-
|
|
1098
|
+
return {
|
|
1099
|
+
projectId: pick(data, "projectId", "project_id") ?? 0,
|
|
1100
|
+
createTime: pick(data, "createTime", "create_time"),
|
|
1101
|
+
events: mapArray(data.events, normalizeEvent),
|
|
1102
|
+
eventProps: mapArray(pick(data, "eventProps", "event_props"), normalizeProperty),
|
|
1103
|
+
commonEventProps: mapArray(pick(data, "commonEventProps", "common_event_props"), normalizeProperty),
|
|
1104
|
+
userProps: mapArray(pick(data, "userProps", "user_props"), normalizeUserProperty)
|
|
1105
|
+
};
|
|
1106
|
+
}
|
|
1107
|
+
function normalizeUploadError(value) {
|
|
1108
|
+
return {
|
|
1109
|
+
errorType: pick(value, "errorType", "error_type") ?? "",
|
|
1110
|
+
errorTypeDesc: pick(value, "errorTypeDesc", "error_type_desc") ?? "",
|
|
1111
|
+
cellName: pick(value, "cellName", "cell_name") ?? "",
|
|
1112
|
+
row: Number(value.row ?? 0),
|
|
1113
|
+
value: String(value.value ?? "")
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
function normalizeUploadErrorMap(value) {
|
|
1117
|
+
const data = record(value);
|
|
1118
|
+
if (!data) return void 0;
|
|
1119
|
+
const result = {};
|
|
1120
|
+
for (const [key, items] of Object.entries(data)) {
|
|
1121
|
+
result[key] = mapArray(items, normalizeUploadError);
|
|
1122
|
+
}
|
|
1123
|
+
return result;
|
|
1124
|
+
}
|
|
1125
|
+
function normalizeUploadResponse(value) {
|
|
1126
|
+
const data = record(value);
|
|
1127
|
+
if (!data) return { return_code: 0, return_message: "success" };
|
|
1128
|
+
const responseData = record(data.data);
|
|
1129
|
+
const uploadErrors = record(pick(data, "uploadErrors", "upload_errors")) ?? record(pick(responseData ?? {}, "uploadErrors", "upload_errors"));
|
|
1130
|
+
const errorSource = uploadErrors ?? responseData ?? data;
|
|
1131
|
+
const eventErrorMap = normalizeUploadErrorMap(pick(errorSource, "eventErrorMap", "event_error_map"));
|
|
1132
|
+
const userErrorMap = normalizeUploadErrorMap(pick(errorSource, "userErrorMap", "user_error_map"));
|
|
1133
|
+
const hasErrors = Boolean(
|
|
1134
|
+
eventErrorMap && Object.keys(eventErrorMap).length > 0 || userErrorMap && Object.keys(userErrorMap).length > 0
|
|
1135
|
+
);
|
|
1136
|
+
return {
|
|
1137
|
+
return_code: typeof data.return_code === "number" ? data.return_code : 0,
|
|
1138
|
+
return_message: typeof data.return_message === "string" ? data.return_message : hasErrors ? "validation errors" : "success",
|
|
1139
|
+
data: hasErrors ? { eventErrorMap, userErrorMap } : void 0
|
|
1140
|
+
};
|
|
1056
1141
|
}
|
|
1057
1142
|
var TrackingClient = class {
|
|
1058
|
-
constructor(host,
|
|
1143
|
+
constructor(host, cliToken) {
|
|
1059
1144
|
this.host = host;
|
|
1060
|
-
this.
|
|
1145
|
+
this.cliToken = cliToken;
|
|
1061
1146
|
}
|
|
1062
1147
|
host;
|
|
1063
|
-
|
|
1064
|
-
async
|
|
1065
|
-
return this.
|
|
1148
|
+
cliToken;
|
|
1149
|
+
async resolveCliToken() {
|
|
1150
|
+
return this.cliToken ?? getCliToken(this.host);
|
|
1151
|
+
}
|
|
1152
|
+
async requestJson(modulePath, params = {}, body, method = body === void 0 ? "GET" : "POST", retry = true) {
|
|
1153
|
+
const token = await this.resolveCliToken();
|
|
1154
|
+
const url = buildUrl(this.host, modulePath, params);
|
|
1155
|
+
const headers = {
|
|
1156
|
+
"cli-token": token,
|
|
1157
|
+
accept: "application/json"
|
|
1158
|
+
};
|
|
1159
|
+
const init = { method, headers };
|
|
1160
|
+
if (body !== void 0 && method !== "GET") {
|
|
1161
|
+
headers["content-type"] = "application/json";
|
|
1162
|
+
init.body = JSON.stringify(body);
|
|
1163
|
+
}
|
|
1164
|
+
const resp = await fetch(url, init);
|
|
1165
|
+
const env = safeJsonParse(await resp.text());
|
|
1166
|
+
logger.api(method, url, resp.status, body, env);
|
|
1167
|
+
if (resp.status === 401 && retry) {
|
|
1168
|
+
clearCliToken(this.host);
|
|
1169
|
+
this.cliToken = await getCliToken(this.host);
|
|
1170
|
+
return this.requestJson(modulePath, params, body, method, false);
|
|
1171
|
+
}
|
|
1172
|
+
if (resp.status === 403) {
|
|
1173
|
+
throw new Error(env?.return_message || "Permission denied");
|
|
1174
|
+
}
|
|
1175
|
+
if (!resp.ok) {
|
|
1176
|
+
throw new Error(`AE API HTTP error: ${resp.status} ${resp.statusText}`);
|
|
1177
|
+
}
|
|
1178
|
+
if (env?.return_code === -1001 && retry) {
|
|
1179
|
+
clearCliToken(this.host);
|
|
1180
|
+
this.cliToken = await getCliToken(this.host);
|
|
1181
|
+
return this.requestJson(modulePath, params, body, method, false);
|
|
1182
|
+
}
|
|
1183
|
+
if (env?.return_code !== 0 && env?.return_code !== void 0) {
|
|
1184
|
+
throw new Error(env.return_message || `AE API error (code: ${env.return_code})`);
|
|
1185
|
+
}
|
|
1186
|
+
return env?.data;
|
|
1066
1187
|
}
|
|
1067
1188
|
async getProgram(projectId) {
|
|
1068
|
-
const data = await
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
);
|
|
1073
|
-
return data ?? null;
|
|
1189
|
+
const data = await executeCapability(this.host, TRACK_CAPABILITY_DOMAIN, TRACK_PROGRAM_QUERY, {
|
|
1190
|
+
project_id: projectId
|
|
1191
|
+
});
|
|
1192
|
+
return normalizeProgram(data);
|
|
1074
1193
|
}
|
|
1075
1194
|
async deleteProgram(projectId) {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
projectId,
|
|
1079
|
-
"@t": Date.now()
|
|
1195
|
+
await executeCapability(this.host, TRACK_CAPABILITY_DOMAIN, TRACK_PROGRAM_DELETE, {
|
|
1196
|
+
project_id: projectId
|
|
1080
1197
|
});
|
|
1081
|
-
|
|
1082
|
-
method: "GET",
|
|
1083
|
-
headers: {
|
|
1084
|
-
authorization: `bearer ${token}`,
|
|
1085
|
-
accept: "application/json"
|
|
1086
|
-
}
|
|
1087
|
-
});
|
|
1088
|
-
const env = safeJsonParse(await resp.text());
|
|
1089
|
-
if (env.return_code !== 0) {
|
|
1090
|
-
throw new Error(env.return_message || `AE API error (code: ${env.return_code})`);
|
|
1091
|
-
}
|
|
1092
|
-
return { return_code: env.return_code, return_message: env.return_message };
|
|
1198
|
+
return { return_code: 0, return_message: "success" };
|
|
1093
1199
|
}
|
|
1094
1200
|
async uploadProgramExcel(args) {
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1201
|
+
const inputFile = await uploadInputFileBytes(
|
|
1202
|
+
this.host,
|
|
1203
|
+
TRACK_CAPABILITY_DOMAIN,
|
|
1204
|
+
args.projectId,
|
|
1205
|
+
TRACK_PROGRAM_XLSX_PURPOSE,
|
|
1206
|
+
args.file,
|
|
1207
|
+
args.filename,
|
|
1208
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
1103
1209
|
);
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
const
|
|
1210
|
+
const inputFileId = inputFile?.input_file_id ?? inputFile?.inputFileId ?? inputFile?.id;
|
|
1211
|
+
if (!inputFileId) {
|
|
1212
|
+
throw new Error("Capability gateway input-file upload did not return input_file_id");
|
|
1213
|
+
}
|
|
1214
|
+
const data = await executeCapability(this.host, TRACK_CAPABILITY_DOMAIN, TRACK_PROGRAM_EXCEL_SAVE, {
|
|
1215
|
+
project_id: args.projectId,
|
|
1216
|
+
input_file_id: inputFileId
|
|
1217
|
+
});
|
|
1218
|
+
const env = normalizeUploadResponse(data);
|
|
1109
1219
|
if (env.return_code !== 0 && env.return_code !== void 0 && !env.data?.eventErrorMap && !env.data?.userErrorMap) {
|
|
1110
1220
|
logger.error(`Upload failed: ${env.return_message || `AE API error (code: ${env.return_code})`}`);
|
|
1111
1221
|
}
|
|
1112
1222
|
return env;
|
|
1113
1223
|
}
|
|
1114
|
-
async getUserAutoConfig() {
|
|
1115
|
-
const data = await httpGet(
|
|
1116
|
-
"/v1/ta/auto/config/getUserAutoConfig",
|
|
1117
|
-
{ "@t": Date.now() },
|
|
1118
|
-
this.host
|
|
1119
|
-
);
|
|
1120
|
-
if (data && typeof data === "object") {
|
|
1121
|
-
return data;
|
|
1122
|
-
}
|
|
1123
|
-
return null;
|
|
1124
|
-
}
|
|
1125
|
-
async getServerLang() {
|
|
1126
|
-
const config = await this.getUserAutoConfig();
|
|
1127
|
-
return extractLangFromConfig(config);
|
|
1128
|
-
}
|
|
1129
|
-
/** lang format: zh_CN, en_US, ja_JP, ko_KR */
|
|
1130
|
-
async saveUserAutoConfig(langCode) {
|
|
1131
|
-
await httpGet("/v1/ta/auto/config/getUserAutoConfig", { "@t": Date.now(), lang: langCode }, this.host);
|
|
1132
|
-
}
|
|
1133
1224
|
async debugGet(path5, params) {
|
|
1134
|
-
const data = await
|
|
1225
|
+
const data = await this.requestJson(`${DEBUG_BASE}${path5}`, { ...params, "@t": Date.now() });
|
|
1135
1226
|
return data;
|
|
1136
1227
|
}
|
|
1137
1228
|
async listDevice(projectId) {
|
|
@@ -1157,8 +1248,7 @@ var TrackingClient = class {
|
|
|
1157
1248
|
}
|
|
1158
1249
|
};
|
|
1159
1250
|
async function createTrackingClient(host) {
|
|
1160
|
-
|
|
1161
|
-
return new TrackingClient(host, token);
|
|
1251
|
+
return new TrackingClient(host);
|
|
1162
1252
|
}
|
|
1163
1253
|
|
|
1164
1254
|
// src/tracking/te-plan/fetch.ts
|
|
@@ -1746,23 +1836,70 @@ function formatConflictReport(result, existingSummary) {
|
|
|
1746
1836
|
}
|
|
1747
1837
|
|
|
1748
1838
|
// src/commands/tracking/plan.ts
|
|
1839
|
+
import { existsSync as existsSync5 } from "fs";
|
|
1840
|
+
|
|
1841
|
+
// src/tracking/templates.ts
|
|
1749
1842
|
import { readdir } from "fs/promises";
|
|
1750
|
-
import { existsSync as
|
|
1843
|
+
import { existsSync as existsSync3 } from "fs";
|
|
1844
|
+
import { resolve } from "path";
|
|
1845
|
+
function getTemplateDirs() {
|
|
1846
|
+
return [
|
|
1847
|
+
resolve(getPackageRoot(), "tracking-plan-template"),
|
|
1848
|
+
resolve(getConfigDir(), "templates")
|
|
1849
|
+
];
|
|
1850
|
+
}
|
|
1851
|
+
async function listTrackingTemplates() {
|
|
1852
|
+
const found = [];
|
|
1853
|
+
for (const dir of getTemplateDirs()) {
|
|
1854
|
+
if (!existsSync3(dir)) continue;
|
|
1855
|
+
let entries = [];
|
|
1856
|
+
try {
|
|
1857
|
+
entries = await readdir(dir);
|
|
1858
|
+
} catch {
|
|
1859
|
+
continue;
|
|
1860
|
+
}
|
|
1861
|
+
for (const f of entries) {
|
|
1862
|
+
if (!f.endsWith(".xlsx")) continue;
|
|
1863
|
+
const base = f.replace(/\.xlsx$/i, "");
|
|
1864
|
+
const mdPath = resolve(dir, base + ".md");
|
|
1865
|
+
const hasMd = existsSync3(mdPath);
|
|
1866
|
+
found.push({
|
|
1867
|
+
path: hasMd ? mdPath : resolve(dir, f),
|
|
1868
|
+
name: base,
|
|
1869
|
+
hasMd
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
return found;
|
|
1874
|
+
}
|
|
1875
|
+
async function resolveTrackingTemplateByName(name) {
|
|
1876
|
+
const normalized = name.trim().replace(/\.(md|xlsx)$/i, "");
|
|
1877
|
+
const templates = await listTrackingTemplates();
|
|
1878
|
+
const template = templates.find((item) => item.name === normalized);
|
|
1879
|
+
if (!template) {
|
|
1880
|
+
const available = templates.map((item) => item.name).join(", ");
|
|
1881
|
+
throw new Error(
|
|
1882
|
+
available ? `Template not found: ${name}. Available templates: ${available}` : `Template not found: ${name}. No tracking plan templates are available.`
|
|
1883
|
+
);
|
|
1884
|
+
}
|
|
1885
|
+
return template;
|
|
1886
|
+
}
|
|
1751
1887
|
|
|
1752
1888
|
// src/commands/tracking/shared.ts
|
|
1753
|
-
import { existsSync as
|
|
1889
|
+
import { existsSync as existsSync4, statSync } from "fs";
|
|
1754
1890
|
var HOST_OPTION_DESC = "Override active AE host URL";
|
|
1755
1891
|
function resolveTrackingHost(program2, opts) {
|
|
1756
1892
|
const root = program2.root ?? program2;
|
|
1757
1893
|
const globalHost = root.opts()?.host;
|
|
1758
|
-
const
|
|
1894
|
+
const explicitHost = opts.host || globalHost;
|
|
1895
|
+
const host = resolveHost(explicitHost);
|
|
1759
1896
|
if (!host) {
|
|
1760
1897
|
throw new Error("No active AE host configured. Run: ae-cli auth login");
|
|
1761
1898
|
}
|
|
1762
1899
|
return host;
|
|
1763
1900
|
}
|
|
1764
1901
|
function isExistingDirectory(path5) {
|
|
1765
|
-
if (!
|
|
1902
|
+
if (!existsSync4(path5)) return false;
|
|
1766
1903
|
try {
|
|
1767
1904
|
return statSync(path5).isDirectory();
|
|
1768
1905
|
} catch {
|
|
@@ -1778,7 +1915,7 @@ function assertOutputFilePath(path5, optionName = "--out") {
|
|
|
1778
1915
|
}
|
|
1779
1916
|
function assertInputFilePath(path5, optionName = "--in") {
|
|
1780
1917
|
const trimmed = path5.trim();
|
|
1781
|
-
if (!
|
|
1918
|
+
if (!existsSync4(trimmed)) {
|
|
1782
1919
|
console.error(t("error.input_path_not_found", { path: trimmed, option: optionName }));
|
|
1783
1920
|
process.exit(1);
|
|
1784
1921
|
}
|
|
@@ -1790,10 +1927,6 @@ function assertInputFilePath(path5, optionName = "--in") {
|
|
|
1790
1927
|
|
|
1791
1928
|
// src/commands/tracking/plan.ts
|
|
1792
1929
|
var MAX_FIX_RETRIES = 3;
|
|
1793
|
-
var TEMPLATE_DIRS = [
|
|
1794
|
-
resolve(getPackageRoot(), "tracking-plan-template"),
|
|
1795
|
-
resolve(getConfigDir(), "templates")
|
|
1796
|
-
];
|
|
1797
1930
|
function registerPlan(cmd, rootProgram) {
|
|
1798
1931
|
cmd.description("manage AE tracking plans");
|
|
1799
1932
|
cmd.command("draft").description("Generate xlsx from draft.json (inject autotrack events; use --fix to auto-repair validation errors)").requiredOption("--in <path>", "draft JSON input").requiredOption("--out <path>", "xlsx output").option("--fix", "auto fix validation errors", false).action(async (opts) => {
|
|
@@ -1871,27 +2004,12 @@ function registerPlan(cmd, rootProgram) {
|
|
|
1871
2004
|
}
|
|
1872
2005
|
}
|
|
1873
2006
|
});
|
|
1874
|
-
cmd.command("upload").description("Upload xlsx tracking plan to AE (conflict check, auto-fix retry
|
|
2007
|
+
cmd.command("upload").description("Upload xlsx tracking plan to AE (conflict check, auto-fix retry)").requiredOption("-p, --project <id>", "AE projectId", (v) => parseInt(v, 10)).requiredOption("--xlsx <path>", "xlsx file").requiredOption("--draft <path>", "draft JSON (for auto-fix)").option("--host <url>", HOST_OPTION_DESC).option("--lang <locale>", "xlsx language: zh / en / ja / ko").option("--replace", "delete existing plan first", false).option("--auto-fix", "auto fix upload errors and retry", true).action(async (opts) => {
|
|
1875
2008
|
assertInputFilePath(opts.draft, "--draft");
|
|
1876
2009
|
assertInputFilePath(opts.xlsx, "--xlsx");
|
|
1877
2010
|
const host = resolveTrackingHost(rootProgram, opts);
|
|
1878
2011
|
let client = await createTrackingClient(host);
|
|
1879
2012
|
const draftPre = JSON.parse(await readFile(opts.draft, "utf8"));
|
|
1880
|
-
const xlsxLocale = opts.lang ?? draftPre.meta.lang ?? detectCliLocale();
|
|
1881
|
-
const aeLocale = await client.getServerLang();
|
|
1882
|
-
if (aeLocale && aeLocale !== xlsxLocale) {
|
|
1883
|
-
console.log("\n" + t("plan.ae_lang_mismatch", { aeLang: aeLocale, xlsxLang: xlsxLocale }));
|
|
1884
|
-
if (opts.switchLang) {
|
|
1885
|
-
const aeLangCode = cliLocaleToAE(xlsxLocale);
|
|
1886
|
-
await client.saveUserAutoConfig(aeLangCode);
|
|
1887
|
-
console.log(t("plan.ae_lang_switched", { aeLang: aeLangCode }));
|
|
1888
|
-
await new Promise((r) => setTimeout(r, 2e3));
|
|
1889
|
-
client = await createTrackingClient(host);
|
|
1890
|
-
} else {
|
|
1891
|
-
console.log(t("plan.ae_lang_switch_hint"));
|
|
1892
|
-
process.exit(13);
|
|
1893
|
-
}
|
|
1894
|
-
}
|
|
1895
2013
|
if (!opts.replace) {
|
|
1896
2014
|
console.log(t("plan.checking_conflicts"));
|
|
1897
2015
|
try {
|
|
@@ -1931,7 +2049,7 @@ function registerPlan(cmd, rootProgram) {
|
|
|
1931
2049
|
if (opts.replace) {
|
|
1932
2050
|
const del = await client.deleteProgram(opts.project);
|
|
1933
2051
|
console.log(t("plan.deleted_existing_plan", { message: del.return_message }));
|
|
1934
|
-
await new Promise((
|
|
2052
|
+
await new Promise((resolve3) => setTimeout(resolve3, 5e3));
|
|
1935
2053
|
}
|
|
1936
2054
|
let retryCount = 0;
|
|
1937
2055
|
let draft = JSON.parse(await readFile(opts.draft, "utf8"));
|
|
@@ -1979,8 +2097,8 @@ function registerPlan(cmd, rootProgram) {
|
|
|
1979
2097
|
const msg = lastRes?.return_message ?? "";
|
|
1980
2098
|
const isLangMismatch = msg.includes("\u65E0\u6CD5\u8BC6\u522B\u8868\u683C\u5185\u5BB9") || msg.includes("The content of the form cannot be recognized") || msg.includes("\u30C6\u30FC\u30D6\u30EB\u306E\u5185\u5BB9\u3092\u8A8D\u8B58\u3067\u304D\u307E\u305B\u3093") || msg.includes("\uD2B8\uB798\uD0B9 \uBC29\uC548\uC744 \uC2E4\uBCC4 \uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
1981
2099
|
if (lastRes && lastRes.return_code !== 0 && isLangMismatch) {
|
|
1982
|
-
const
|
|
1983
|
-
console.log("\n" + t("plan.language_mismatch_hint", { locale:
|
|
2100
|
+
const xlsxLocale = opts.lang ?? draft.meta.lang ?? detectCliLocale();
|
|
2101
|
+
console.log("\n" + t("plan.language_mismatch_hint", { locale: xlsxLocale }));
|
|
1984
2102
|
}
|
|
1985
2103
|
});
|
|
1986
2104
|
cmd.command("fetch").description("Fetch tracking plan from AE and output draft.json").requiredOption("-p, --project <id>", "AE projectId", (v) => parseInt(v, 10)).option("--host <url>", HOST_OPTION_DESC).option("--out <path>", "write to file instead of stdout").action(async (opts) => {
|
|
@@ -1992,12 +2110,12 @@ function registerPlan(cmd, rootProgram) {
|
|
|
1992
2110
|
await writeFile(opts.out, s, "utf8");
|
|
1993
2111
|
} else process.stdout.write(s);
|
|
1994
2112
|
});
|
|
1995
|
-
cmd.command("archive").description("Copy draft.xlsx to plans/ and record archive metadata in draft.json").requiredOption("--draft <path>", "draft.json path").requiredOption("--xlsx <path>", "draft.xlsx path").requiredOption("--name <name>", "plan name for filename").option("--plans-dir <dir>", "plans output directory",
|
|
2113
|
+
cmd.command("archive").description("Copy draft.xlsx to plans/ and record archive metadata in draft.json").requiredOption("--draft <path>", "draft.json path").requiredOption("--xlsx <path>", "draft.xlsx path").requiredOption("--name <name>", "plan name for filename").option("--plans-dir <dir>", "plans output directory", resolve2(process.cwd(), "plans")).action(async (opts) => {
|
|
1996
2114
|
assertInputFilePath(opts.draft, "--draft");
|
|
1997
2115
|
assertInputFilePath(opts.xlsx, "--xlsx");
|
|
1998
2116
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
1999
|
-
const dest =
|
|
2000
|
-
if (
|
|
2117
|
+
const dest = resolve2(opts.plansDir, `${stamp}-${opts.name}.xlsx`);
|
|
2118
|
+
if (existsSync5(dest)) {
|
|
2001
2119
|
console.error(t("plan.archive_exists", { path: dest }));
|
|
2002
2120
|
console.error(t("plan.remove_or_rename"));
|
|
2003
2121
|
return;
|
|
@@ -2025,30 +2143,14 @@ function registerPlan(cmd, rootProgram) {
|
|
|
2025
2143
|
const res = await client.deleteProgram(opts.project);
|
|
2026
2144
|
console.log(JSON.stringify(res, null, 2));
|
|
2027
2145
|
});
|
|
2028
|
-
cmd.command("list-templates").description("List bundled and user tracking plan templates (xlsx/md)").action(async () => {
|
|
2029
|
-
const found =
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
try {
|
|
2034
|
-
entries = await readdir(dir);
|
|
2035
|
-
} catch {
|
|
2036
|
-
continue;
|
|
2037
|
-
}
|
|
2038
|
-
for (const f of entries) {
|
|
2039
|
-
if (!f.endsWith(".xlsx")) continue;
|
|
2040
|
-
const base = f.replace(/\.xlsx$/i, "");
|
|
2041
|
-
const mdPath = resolve(dir, base + ".md");
|
|
2042
|
-
const hasMd = existsSync4(mdPath);
|
|
2043
|
-
found.push({
|
|
2044
|
-
path: hasMd ? mdPath : resolve(dir, f),
|
|
2045
|
-
name: base,
|
|
2046
|
-
hasMd
|
|
2047
|
-
});
|
|
2048
|
-
}
|
|
2146
|
+
cmd.command("list-templates").description("List bundled and user tracking plan templates (xlsx/md)").option("--json", "print machine-readable template list", false).action(async (opts) => {
|
|
2147
|
+
const found = await listTrackingTemplates();
|
|
2148
|
+
if (opts.json) {
|
|
2149
|
+
console.log(JSON.stringify(found, null, 2));
|
|
2150
|
+
return;
|
|
2049
2151
|
}
|
|
2050
2152
|
if (found.length === 0) {
|
|
2051
|
-
console.log(t("plan.no_templates_found", { dirs:
|
|
2153
|
+
console.log(t("plan.no_templates_found", { dirs: getTemplateDirs().join(", ") }));
|
|
2052
2154
|
return;
|
|
2053
2155
|
}
|
|
2054
2156
|
console.log(t("plan.templates_found", { count: found.length }) + "\n");
|
|
@@ -2742,10 +2844,17 @@ function inferSdkMode(events) {
|
|
|
2742
2844
|
}
|
|
2743
2845
|
function registerCode(cmd) {
|
|
2744
2846
|
cmd.description("tooling for ae-generate-tracking-code skill");
|
|
2745
|
-
const importTemplateCmd = cmd.command("import-template").description("Import a template file (md or xlsx) to draft.json, inferring sdk_integration_mode from events").
|
|
2746
|
-
|
|
2847
|
+
const importTemplateCmd = cmd.command("import-template").description("Import a template file (md or xlsx) to draft.json, inferring sdk_integration_mode from events").option("--template <path>", "Path to template file (.md or .xlsx)").option("--template-name <name>", "Built-in or user template name from tracking plan list-templates").requiredOption("--out <path>", "Output path for draft.json").option("--sdk-type <type>", "Client SDK type (android/ios/openharmony/javascript/etc.)").option("--languages <langs>", "Client languages comma-separated (e.g., java,kotlin for android)").option("--server <lang>", "Server language (java/python/go/etc.)").action(async (opts) => {
|
|
2848
|
+
if (!opts.template && !opts.templateName) {
|
|
2849
|
+
throw new Error("Either --template or --template-name is required");
|
|
2850
|
+
}
|
|
2851
|
+
if (opts.template && opts.templateName) {
|
|
2852
|
+
throw new Error("Use only one of --template or --template-name");
|
|
2853
|
+
}
|
|
2747
2854
|
assertOutputFilePath(opts.out, "--out");
|
|
2748
|
-
const
|
|
2855
|
+
const templatePath = opts.templateName ? (await resolveTrackingTemplateByName(opts.templateName)).path : opts.template;
|
|
2856
|
+
assertInputFilePath(templatePath, opts.templateName ? "--template-name" : "--template");
|
|
2857
|
+
const draft = templatePath.endsWith(".md") ? await readTemplateMd(templatePath) : await readTemplateXlsx(templatePath);
|
|
2749
2858
|
const inferredMode = inferSdkMode(draft.events);
|
|
2750
2859
|
if (inferredMode) {
|
|
2751
2860
|
draft.meta.sdk_integration_mode = inferredMode;
|
|
@@ -2803,12 +2912,12 @@ function registerCode(cmd) {
|
|
|
2803
2912
|
}
|
|
2804
2913
|
|
|
2805
2914
|
// src/tracking/wiki-query/query.ts
|
|
2806
|
-
import { readFileSync as readFileSync3, existsSync as
|
|
2915
|
+
import { readFileSync as readFileSync3, existsSync as existsSync6 } from "fs";
|
|
2807
2916
|
import { join as join4 } from "path";
|
|
2808
2917
|
var WIKI_ROOT = join4(getPackageRoot(), "wiki/te-docs");
|
|
2809
2918
|
function searchIndex(keyword) {
|
|
2810
2919
|
const indexPath = join4(WIKI_ROOT, "index.md");
|
|
2811
|
-
if (!
|
|
2920
|
+
if (!existsSync6(indexPath)) return [];
|
|
2812
2921
|
const lines = readFileSync3(indexPath, "utf8").split("\n");
|
|
2813
2922
|
const kw = keyword.toLowerCase();
|
|
2814
2923
|
const hits = [];
|
|
@@ -2840,36 +2949,34 @@ function registerWiki(cmd) {
|
|
|
2840
2949
|
// src/commands/tracking/lang.ts
|
|
2841
2950
|
var SUPPORTED = ["zh", "en", "ja", "ko"];
|
|
2842
2951
|
var SUPPORTED_LABELS = {
|
|
2843
|
-
zh: "
|
|
2952
|
+
zh: "Chinese",
|
|
2844
2953
|
en: "English",
|
|
2845
|
-
ja: "
|
|
2846
|
-
ko: "
|
|
2954
|
+
ja: "Japanese",
|
|
2955
|
+
ko: "Korean"
|
|
2847
2956
|
};
|
|
2848
|
-
function registerLang(cmd,
|
|
2849
|
-
cmd.description("manage
|
|
2850
|
-
cmd.command("
|
|
2957
|
+
function registerLang(cmd, _rootProgram) {
|
|
2958
|
+
cmd.description("manage local language hints for tracking commands");
|
|
2959
|
+
cmd.command("status").description("show local language settings for tracking commands").action(() => {
|
|
2960
|
+
const aeLang = process.env.AE_LANG?.trim() || "(unset)";
|
|
2961
|
+
const lang = process.env.LANG?.trim() || "(unset)";
|
|
2962
|
+
console.log("CLI language settings:");
|
|
2963
|
+
console.log(`- AE_LANG: ${aeLang}`);
|
|
2964
|
+
console.log(`- LANG: ${lang}`);
|
|
2965
|
+
console.log(`- resolved: ${detectCliLocale()}`);
|
|
2966
|
+
});
|
|
2967
|
+
cmd.command("set").description("print the AE_LANG value to use for subsequent commands").argument("<locale>", "language code: zh / en / ja / ko").action((locale) => {
|
|
2851
2968
|
const normalized = locale.trim().toLowerCase();
|
|
2852
2969
|
if (!SUPPORTED.includes(normalized)) {
|
|
2853
2970
|
console.error(`Unsupported language: "${locale}"`);
|
|
2854
2971
|
console.error("Supported languages:");
|
|
2855
2972
|
for (const code of SUPPORTED) {
|
|
2856
|
-
console.error(` ${code}
|
|
2973
|
+
console.error(` ${code} - ${SUPPORTED_LABELS[code]}`);
|
|
2857
2974
|
}
|
|
2858
2975
|
process.exit(1);
|
|
2859
2976
|
}
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
await client.saveUserAutoConfig(aeCode);
|
|
2864
|
-
process.stderr.write(`[ae-cli] Server language saved: ${aeCode}
|
|
2865
|
-
`);
|
|
2866
|
-
const config = await client.getUserAutoConfig();
|
|
2867
|
-
if (config) {
|
|
2868
|
-
const serverLang = config.lang ?? config.umi_locale ?? config.locale;
|
|
2869
|
-
console.log(`Server response: ${JSON.stringify({ lang: serverLang })}`);
|
|
2870
|
-
} else {
|
|
2871
|
-
console.log("Server response: (empty)");
|
|
2872
|
-
}
|
|
2977
|
+
console.log("Use this environment variable for subsequent commands:");
|
|
2978
|
+
console.log(`export AE_LANG=${normalized}`);
|
|
2979
|
+
console.log(`AE_LANG=${normalized} ae-cli tracking plan draft --in .ae-cli/draft.json --out .ae-cli/draft.xlsx`);
|
|
2873
2980
|
});
|
|
2874
2981
|
}
|
|
2875
2982
|
|
|
@@ -2891,88 +2998,93 @@ program.name("ae-cli").version(version).description("CLI tool for ThinkingAI (AE
|
|
|
2891
2998
|
async function loadCommands() {
|
|
2892
2999
|
const commands = [];
|
|
2893
3000
|
try {
|
|
2894
|
-
const teAnalysis = await import("./te-analysis-
|
|
3001
|
+
const teAnalysis = await import("./te-analysis-WWX3Z6RP.js");
|
|
2895
3002
|
commands.push(...teAnalysis.default);
|
|
2896
3003
|
} catch {
|
|
2897
3004
|
}
|
|
2898
3005
|
try {
|
|
2899
|
-
const teAudience = await import("./te-audience-
|
|
3006
|
+
const teAudience = await import("./te-audience-UXGHUVBB.js");
|
|
2900
3007
|
commands.push(...teAudience.default);
|
|
2901
3008
|
} catch {
|
|
2902
3009
|
}
|
|
2903
3010
|
try {
|
|
2904
|
-
const teMeta = await import("./te-meta-
|
|
3011
|
+
const teMeta = await import("./te-meta-LJZBOSMO.js");
|
|
2905
3012
|
commands.push(...teMeta.default);
|
|
2906
3013
|
} catch {
|
|
2907
3014
|
}
|
|
2908
3015
|
try {
|
|
2909
|
-
const teCommon = await import("./te-common-
|
|
3016
|
+
const teCommon = await import("./te-common-7XXH73MF.js");
|
|
2910
3017
|
commands.push(...teCommon.default);
|
|
2911
3018
|
} catch {
|
|
2912
3019
|
}
|
|
2913
3020
|
try {
|
|
2914
|
-
const engage = await import("./te-engage-
|
|
3021
|
+
const engage = await import("./te-engage-NCFAQFX3.js");
|
|
2915
3022
|
commands.push(...engage.default);
|
|
2916
3023
|
} catch {
|
|
2917
3024
|
}
|
|
2918
3025
|
try {
|
|
2919
|
-
const community = await import("./te-community-
|
|
3026
|
+
const community = await import("./te-community-QKE67HR2.js");
|
|
2920
3027
|
commands.push(...community.default);
|
|
2921
3028
|
} catch {
|
|
2922
3029
|
}
|
|
2923
3030
|
try {
|
|
2924
|
-
const dataops = await import("./te-dataops-
|
|
3031
|
+
const dataops = await import("./te-dataops-6W7NNYST.js");
|
|
2925
3032
|
commands.push(...dataops.default);
|
|
2926
3033
|
} catch {
|
|
2927
3034
|
}
|
|
2928
3035
|
try {
|
|
2929
|
-
const teKb = await import("./te-kb-
|
|
3036
|
+
const teKb = await import("./te-kb-K5BQYUCM.js");
|
|
2930
3037
|
commands.push(...teKb.default);
|
|
2931
3038
|
} catch {
|
|
2932
3039
|
}
|
|
2933
3040
|
try {
|
|
2934
|
-
const teTeam = await import("./te-team-
|
|
3041
|
+
const teTeam = await import("./te-team-DHK5R7MV.js");
|
|
2935
3042
|
commands.push(...teTeam.default);
|
|
2936
3043
|
} catch {
|
|
2937
3044
|
}
|
|
2938
3045
|
try {
|
|
2939
|
-
const teAgent = await import("./te-agent-
|
|
3046
|
+
const teAgent = await import("./te-agent-QPZTLHPH.js");
|
|
2940
3047
|
commands.push(...teAgent.default);
|
|
2941
3048
|
} catch {
|
|
2942
3049
|
}
|
|
3050
|
+
try {
|
|
3051
|
+
const metadata = await import("./metadata-JZ2OTWBK.js");
|
|
3052
|
+
commands.push(...metadata.default);
|
|
3053
|
+
} catch {
|
|
3054
|
+
}
|
|
2943
3055
|
return commands;
|
|
2944
3056
|
}
|
|
2945
3057
|
async function registerAuthCommands() {
|
|
2946
3058
|
try {
|
|
2947
|
-
const { registerAuth } = await import("./auth-
|
|
3059
|
+
const { registerAuth } = await import("./auth-RDN6D5HU.js");
|
|
2948
3060
|
registerAuth(program);
|
|
2949
3061
|
} catch {
|
|
2950
3062
|
}
|
|
2951
3063
|
}
|
|
2952
3064
|
async function registerConfigCommands() {
|
|
2953
3065
|
try {
|
|
2954
|
-
const { registerConfig } = await import("./config-
|
|
3066
|
+
const { registerConfig } = await import("./config-2SDTLGOC.js");
|
|
2955
3067
|
registerConfig(program);
|
|
2956
3068
|
} catch {
|
|
2957
3069
|
}
|
|
2958
3070
|
}
|
|
2959
3071
|
async function registerApiCommand() {
|
|
2960
3072
|
try {
|
|
2961
|
-
const { registerApi } = await import("./raw-
|
|
3073
|
+
const { registerApi } = await import("./raw-NGYHAL3F.js");
|
|
2962
3074
|
registerApi(program);
|
|
2963
3075
|
} catch {
|
|
2964
3076
|
}
|
|
2965
3077
|
}
|
|
2966
3078
|
async function registerSyncCommand() {
|
|
2967
3079
|
try {
|
|
2968
|
-
const { registerSync } = await import("./sync-
|
|
3080
|
+
const { registerSync } = await import("./sync-JVLX6TGW.js");
|
|
2969
3081
|
registerSync(program);
|
|
2970
3082
|
} catch {
|
|
2971
3083
|
}
|
|
2972
3084
|
}
|
|
2973
3085
|
async function registerModelCommand() {
|
|
2974
3086
|
try {
|
|
2975
|
-
const { registerModel } = await import("./model-
|
|
3087
|
+
const { registerModel } = await import("./model-ZYMRN4VS.js");
|
|
2976
3088
|
registerModel(program);
|
|
2977
3089
|
} catch {
|
|
2978
3090
|
}
|