@thinkingai/ae-cli 6.0.37 → 6.0.38
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.js +1 -1
- package/dist/{te-analysis-X222IRYR.js → te-analysis-ITKTO6JS.js} +461 -14
- package/dist/{te-analysis-IWQZO423.js → te-analysis-RAC67YYD.js} +461 -14
- package/package.json +2 -2
- package/skills/ae-analysis/references/command_index.md +5 -0
- package/skills/ae-analysis/references/debug_data_list.md +28 -0
- package/skills/ae-analysis/references/debug_device_add.md +23 -0
- package/skills/ae-analysis/references/debug_device_list.md +19 -0
- package/skills/ae-analysis/references/debug_device_select.md +22 -0
- package/skills/ae-analysis/references/plan_sync_display_names.md +28 -0
- package/skills/ae-generate-tracking-code/SKILL.md +22 -6
- package/skills/ae-generate-tracking-code/references/debug-script.md +46 -37
- package/skills/ae-generate-tracking-plan/SKILL.md +26 -1
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
CapabilityGatewayError,
|
|
10
10
|
buildCapabilityGatewayUrl,
|
|
11
11
|
dryRunCapability,
|
|
12
|
+
executeCapability,
|
|
12
13
|
executeCapabilityWithEnvelope,
|
|
13
14
|
fetchCapabilityGateway,
|
|
14
15
|
requestCapabilityGateway,
|
|
@@ -5860,6 +5861,24 @@ var dataTypeFlag = {
|
|
|
5860
5861
|
required: false,
|
|
5861
5862
|
desc: "Live data type: normal (default) or error."
|
|
5862
5863
|
};
|
|
5864
|
+
var debugDeviceIdFlag = {
|
|
5865
|
+
name: "device-id",
|
|
5866
|
+
type: "string",
|
|
5867
|
+
required: true,
|
|
5868
|
+
desc: "Debug device ID reported by the SDK as #device_id."
|
|
5869
|
+
};
|
|
5870
|
+
var debugDeviceNameFlag = {
|
|
5871
|
+
name: "device-name",
|
|
5872
|
+
type: "string",
|
|
5873
|
+
required: true,
|
|
5874
|
+
desc: "Human-readable name for the Debug device."
|
|
5875
|
+
};
|
|
5876
|
+
var eventNameFlag = {
|
|
5877
|
+
name: "event-name",
|
|
5878
|
+
type: "string",
|
|
5879
|
+
required: false,
|
|
5880
|
+
desc: "Optional event name filter."
|
|
5881
|
+
};
|
|
5863
5882
|
var eventNamesFlag = {
|
|
5864
5883
|
name: "event-names",
|
|
5865
5884
|
type: "json",
|
|
@@ -6086,6 +6105,323 @@ var trackingPlanSyncFromMeta = createTrackingCapabilityCommand({
|
|
|
6086
6105
|
buildInput: projectInput2
|
|
6087
6106
|
});
|
|
6088
6107
|
|
|
6108
|
+
// src/commands/te-analysis/tracking/plan/sync-display-names.ts
|
|
6109
|
+
import { existsSync as existsSync3 } from "fs";
|
|
6110
|
+
import { readFile } from "fs/promises";
|
|
6111
|
+
|
|
6112
|
+
// src/tracking/plan/display-name-sync.ts
|
|
6113
|
+
function buildDisplayNameSyncPlan(draft, metadata) {
|
|
6114
|
+
return {
|
|
6115
|
+
event: buildGroup(
|
|
6116
|
+
"event",
|
|
6117
|
+
eventDefinitions(draft.events),
|
|
6118
|
+
existingDefinitions(metadata.events, "event_name", "event_desc")
|
|
6119
|
+
),
|
|
6120
|
+
event_property: buildGroup(
|
|
6121
|
+
"event_property",
|
|
6122
|
+
propertyDefinitions([
|
|
6123
|
+
...draft.common_event_properties,
|
|
6124
|
+
...draft.event_properties
|
|
6125
|
+
]),
|
|
6126
|
+
existingDefinitions(metadata.eventProperties, "prop_name", "prop_desc")
|
|
6127
|
+
),
|
|
6128
|
+
user_property: buildGroup(
|
|
6129
|
+
"user_property",
|
|
6130
|
+
propertyDefinitions(draft.user_properties),
|
|
6131
|
+
existingDefinitions(metadata.userProperties, "prop_name", "prop_desc")
|
|
6132
|
+
)
|
|
6133
|
+
};
|
|
6134
|
+
}
|
|
6135
|
+
function assertTrackingDraft(value) {
|
|
6136
|
+
if (!isRecord(value)) {
|
|
6137
|
+
throw new Error("Tracking draft must be a JSON object.");
|
|
6138
|
+
}
|
|
6139
|
+
for (const field of [
|
|
6140
|
+
"events",
|
|
6141
|
+
"event_properties",
|
|
6142
|
+
"common_event_properties",
|
|
6143
|
+
"user_properties"
|
|
6144
|
+
]) {
|
|
6145
|
+
if (!Array.isArray(value[field])) {
|
|
6146
|
+
throw new Error(`Tracking draft field "${field}" must be an array.`);
|
|
6147
|
+
}
|
|
6148
|
+
}
|
|
6149
|
+
}
|
|
6150
|
+
function eventDefinitions(events) {
|
|
6151
|
+
return definitions(
|
|
6152
|
+
events.map((event) => ({
|
|
6153
|
+
name: event.event_name,
|
|
6154
|
+
displayName: event.display_name
|
|
6155
|
+
})),
|
|
6156
|
+
"event"
|
|
6157
|
+
);
|
|
6158
|
+
}
|
|
6159
|
+
function propertyDefinitions(properties) {
|
|
6160
|
+
return definitions(
|
|
6161
|
+
properties.map((property) => ({
|
|
6162
|
+
name: property.name,
|
|
6163
|
+
displayName: property.display_name
|
|
6164
|
+
})),
|
|
6165
|
+
"property"
|
|
6166
|
+
);
|
|
6167
|
+
}
|
|
6168
|
+
function definitions(candidates, kind) {
|
|
6169
|
+
const byName = /* @__PURE__ */ new Map();
|
|
6170
|
+
const missing = /* @__PURE__ */ new Set();
|
|
6171
|
+
for (const candidate of candidates) {
|
|
6172
|
+
const name = nonEmptyString(candidate.name);
|
|
6173
|
+
if (!name) continue;
|
|
6174
|
+
const displayName = nonEmptyString(candidate.displayName);
|
|
6175
|
+
if (!displayName) {
|
|
6176
|
+
if (!byName.has(name)) missing.add(name);
|
|
6177
|
+
continue;
|
|
6178
|
+
}
|
|
6179
|
+
const previous = byName.get(name);
|
|
6180
|
+
if (previous && previous !== displayName) {
|
|
6181
|
+
throw new Error(
|
|
6182
|
+
`Tracking draft maps ${kind} "${name}" to conflicting display names: "${previous}" and "${displayName}".`
|
|
6183
|
+
);
|
|
6184
|
+
}
|
|
6185
|
+
byName.set(name, displayName);
|
|
6186
|
+
missing.delete(name);
|
|
6187
|
+
}
|
|
6188
|
+
return {
|
|
6189
|
+
definitions: [...byName.entries()].map(([name, displayName]) => ({
|
|
6190
|
+
name,
|
|
6191
|
+
displayName
|
|
6192
|
+
})),
|
|
6193
|
+
missing: [...missing]
|
|
6194
|
+
};
|
|
6195
|
+
}
|
|
6196
|
+
function existingDefinitions(value, nameField, displayNameField) {
|
|
6197
|
+
if (!Array.isArray(value)) return [];
|
|
6198
|
+
const rows = [];
|
|
6199
|
+
for (const item of value) {
|
|
6200
|
+
if (!isRecord(item)) continue;
|
|
6201
|
+
const name = nonEmptyString(item[nameField]);
|
|
6202
|
+
if (!name) continue;
|
|
6203
|
+
rows.push({
|
|
6204
|
+
name,
|
|
6205
|
+
displayName: nonEmptyString(item[displayNameField])
|
|
6206
|
+
});
|
|
6207
|
+
}
|
|
6208
|
+
return rows;
|
|
6209
|
+
}
|
|
6210
|
+
function buildGroup(type, source, existing) {
|
|
6211
|
+
const existingByName = new Map(
|
|
6212
|
+
existing.map((item) => [item.name, item.displayName])
|
|
6213
|
+
);
|
|
6214
|
+
const items = [];
|
|
6215
|
+
const skippedExisting = [];
|
|
6216
|
+
const missingInMetadata = [];
|
|
6217
|
+
for (const definition of source.definitions) {
|
|
6218
|
+
if (!existingByName.has(definition.name)) {
|
|
6219
|
+
missingInMetadata.push(definition.name);
|
|
6220
|
+
continue;
|
|
6221
|
+
}
|
|
6222
|
+
if (existingByName.get(definition.name)) {
|
|
6223
|
+
skippedExisting.push(definition.name);
|
|
6224
|
+
continue;
|
|
6225
|
+
}
|
|
6226
|
+
items.push(
|
|
6227
|
+
type === "event" ? { event_name: definition.name, event_desc: definition.displayName } : { prop_name: definition.name, prop_desc: definition.displayName }
|
|
6228
|
+
);
|
|
6229
|
+
}
|
|
6230
|
+
return {
|
|
6231
|
+
type,
|
|
6232
|
+
items,
|
|
6233
|
+
skippedExisting,
|
|
6234
|
+
missingInMetadata,
|
|
6235
|
+
missingInDraft: source.missing
|
|
6236
|
+
};
|
|
6237
|
+
}
|
|
6238
|
+
function nonEmptyString(value) {
|
|
6239
|
+
if (typeof value !== "string") return void 0;
|
|
6240
|
+
const trimmed = value.trim();
|
|
6241
|
+
return trimmed ? trimmed : void 0;
|
|
6242
|
+
}
|
|
6243
|
+
function isRecord(value) {
|
|
6244
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6245
|
+
}
|
|
6246
|
+
|
|
6247
|
+
// src/commands/te-analysis/tracking/plan/sync-display-names.ts
|
|
6248
|
+
var GATEWAY_DOMAIN = "analysis";
|
|
6249
|
+
var LIST_CAPABILITIES = {
|
|
6250
|
+
events: "metadata.event.list",
|
|
6251
|
+
eventProperties: "metadata.property.list",
|
|
6252
|
+
userProperties: "metadata.property.list"
|
|
6253
|
+
};
|
|
6254
|
+
var EDIT_CAPABILITY = "metadata.super_metadata.batch_edit";
|
|
6255
|
+
var MAX_BATCH_SIZE = 200;
|
|
6256
|
+
var trackingPlanSyncDisplayNames = {
|
|
6257
|
+
service: "tracking",
|
|
6258
|
+
resource: "plan",
|
|
6259
|
+
command: "sync-display-names",
|
|
6260
|
+
description: "Fill blank event and property metadata display names from a local tracking-plan draft. Existing non-empty display names are never overwritten.",
|
|
6261
|
+
flags: [
|
|
6262
|
+
projectIdFlag,
|
|
6263
|
+
{
|
|
6264
|
+
name: "draft",
|
|
6265
|
+
type: "string",
|
|
6266
|
+
required: true,
|
|
6267
|
+
desc: "Local tracking-plan draft.json containing event/property display_name values."
|
|
6268
|
+
}
|
|
6269
|
+
],
|
|
6270
|
+
risk: "write",
|
|
6271
|
+
validate: (ctx) => {
|
|
6272
|
+
if (!existsSync3(ctx.str("draft"))) {
|
|
6273
|
+
throw new Error(
|
|
6274
|
+
"--draft must reference a readable tracking-plan JSON file."
|
|
6275
|
+
);
|
|
6276
|
+
}
|
|
6277
|
+
},
|
|
6278
|
+
dryRun: async (ctx) => {
|
|
6279
|
+
const draft = await readDraft(ctx.str("draft"));
|
|
6280
|
+
return {
|
|
6281
|
+
project_id: ctx.num("project-id"),
|
|
6282
|
+
draft: ctx.str("draft"),
|
|
6283
|
+
source_counts: sourceCounts(draft),
|
|
6284
|
+
behavior: "Fill blank metadata display names only; preserve all existing non-empty display names.",
|
|
6285
|
+
steps: [
|
|
6286
|
+
...Object.values(LIST_CAPABILITIES).map((capabilityId) => ({
|
|
6287
|
+
method: "POST",
|
|
6288
|
+
url: buildCapabilityGatewayUrl(
|
|
6289
|
+
ctx.host(),
|
|
6290
|
+
GATEWAY_DOMAIN,
|
|
6291
|
+
`capabilities/${capabilityId}/execute`
|
|
6292
|
+
)
|
|
6293
|
+
})),
|
|
6294
|
+
{
|
|
6295
|
+
method: "POST",
|
|
6296
|
+
url: buildCapabilityGatewayUrl(
|
|
6297
|
+
ctx.host(),
|
|
6298
|
+
GATEWAY_DOMAIN,
|
|
6299
|
+
`capabilities/${EDIT_CAPABILITY}/execute`
|
|
6300
|
+
),
|
|
6301
|
+
note: "Called only for non-empty update groups, in batches of at most 200 items."
|
|
6302
|
+
}
|
|
6303
|
+
]
|
|
6304
|
+
};
|
|
6305
|
+
},
|
|
6306
|
+
execute: async (ctx) => {
|
|
6307
|
+
const projectId = ctx.num("project-id");
|
|
6308
|
+
const draftPath = ctx.str("draft");
|
|
6309
|
+
const draft = await readDraft(draftPath);
|
|
6310
|
+
const [eventResult, eventPropertyResult, userPropertyResult] = await Promise.all([
|
|
6311
|
+
executeCapability(
|
|
6312
|
+
ctx.host(),
|
|
6313
|
+
GATEWAY_DOMAIN,
|
|
6314
|
+
LIST_CAPABILITIES.events,
|
|
6315
|
+
{
|
|
6316
|
+
project_id: projectId,
|
|
6317
|
+
fields: ["event_name", "event_desc"]
|
|
6318
|
+
}
|
|
6319
|
+
),
|
|
6320
|
+
executeCapability(
|
|
6321
|
+
ctx.host(),
|
|
6322
|
+
GATEWAY_DOMAIN,
|
|
6323
|
+
LIST_CAPABILITIES.eventProperties,
|
|
6324
|
+
{
|
|
6325
|
+
project_id: projectId,
|
|
6326
|
+
table_type: "event",
|
|
6327
|
+
fields: ["prop_name", "prop_desc"]
|
|
6328
|
+
}
|
|
6329
|
+
),
|
|
6330
|
+
executeCapability(
|
|
6331
|
+
ctx.host(),
|
|
6332
|
+
GATEWAY_DOMAIN,
|
|
6333
|
+
LIST_CAPABILITIES.userProperties,
|
|
6334
|
+
{
|
|
6335
|
+
project_id: projectId,
|
|
6336
|
+
table_type: "user",
|
|
6337
|
+
fields: ["prop_name", "prop_desc"]
|
|
6338
|
+
}
|
|
6339
|
+
)
|
|
6340
|
+
]);
|
|
6341
|
+
const plan = buildDisplayNameSyncPlan(draft, {
|
|
6342
|
+
events: eventResult?.events,
|
|
6343
|
+
eventProperties: eventPropertyResult?.properties,
|
|
6344
|
+
userProperties: userPropertyResult?.properties
|
|
6345
|
+
});
|
|
6346
|
+
const updateResults = {};
|
|
6347
|
+
for (const group of Object.values(plan)) {
|
|
6348
|
+
updateResults[group.type] = await executeUpdates(ctx, projectId, group);
|
|
6349
|
+
}
|
|
6350
|
+
return {
|
|
6351
|
+
project_id: projectId,
|
|
6352
|
+
draft: draftPath,
|
|
6353
|
+
policy: "blank_only",
|
|
6354
|
+
updated: counts(plan, (group) => group.items.length),
|
|
6355
|
+
skipped_existing: counts(plan, (group) => group.skippedExisting.length),
|
|
6356
|
+
missing_in_metadata: counts(
|
|
6357
|
+
plan,
|
|
6358
|
+
(group) => group.missingInMetadata.length
|
|
6359
|
+
),
|
|
6360
|
+
missing_display_name_in_draft: counts(
|
|
6361
|
+
plan,
|
|
6362
|
+
(group) => group.missingInDraft.length
|
|
6363
|
+
),
|
|
6364
|
+
details: {
|
|
6365
|
+
missing_in_metadata: Object.fromEntries(
|
|
6366
|
+
Object.values(plan).map((group) => [
|
|
6367
|
+
group.type,
|
|
6368
|
+
group.missingInMetadata
|
|
6369
|
+
])
|
|
6370
|
+
),
|
|
6371
|
+
missing_display_name_in_draft: Object.fromEntries(
|
|
6372
|
+
Object.values(plan).map((group) => [
|
|
6373
|
+
group.type,
|
|
6374
|
+
group.missingInDraft
|
|
6375
|
+
])
|
|
6376
|
+
)
|
|
6377
|
+
},
|
|
6378
|
+
batches: updateResults
|
|
6379
|
+
};
|
|
6380
|
+
}
|
|
6381
|
+
};
|
|
6382
|
+
async function readDraft(filePath) {
|
|
6383
|
+
let value;
|
|
6384
|
+
try {
|
|
6385
|
+
value = JSON.parse(await readFile(filePath, "utf8"));
|
|
6386
|
+
} catch (error) {
|
|
6387
|
+
throw new Error(
|
|
6388
|
+
`Unable to read tracking draft "${filePath}": ${error instanceof Error ? error.message : String(error)}`
|
|
6389
|
+
);
|
|
6390
|
+
}
|
|
6391
|
+
assertTrackingDraft(value);
|
|
6392
|
+
return value;
|
|
6393
|
+
}
|
|
6394
|
+
async function executeUpdates(ctx, projectId, group) {
|
|
6395
|
+
const results = [];
|
|
6396
|
+
for (let offset = 0; offset < group.items.length; offset += MAX_BATCH_SIZE) {
|
|
6397
|
+
const items = group.items.slice(offset, offset + MAX_BATCH_SIZE);
|
|
6398
|
+
results.push(
|
|
6399
|
+
await executeCapability(ctx.host(), GATEWAY_DOMAIN, EDIT_CAPABILITY, {
|
|
6400
|
+
project_id: projectId,
|
|
6401
|
+
type: group.type,
|
|
6402
|
+
items
|
|
6403
|
+
})
|
|
6404
|
+
);
|
|
6405
|
+
}
|
|
6406
|
+
return results;
|
|
6407
|
+
}
|
|
6408
|
+
function sourceCounts(draft) {
|
|
6409
|
+
return {
|
|
6410
|
+
event: draft.events.length,
|
|
6411
|
+
event_property: new Set(
|
|
6412
|
+
[...draft.common_event_properties, ...draft.event_properties].map(
|
|
6413
|
+
(property) => property.name
|
|
6414
|
+
)
|
|
6415
|
+
).size,
|
|
6416
|
+
user_property: draft.user_properties.length
|
|
6417
|
+
};
|
|
6418
|
+
}
|
|
6419
|
+
function counts(plan, value) {
|
|
6420
|
+
return Object.fromEntries(
|
|
6421
|
+
Object.values(plan).map((group) => [group.type, value(group)])
|
|
6422
|
+
);
|
|
6423
|
+
}
|
|
6424
|
+
|
|
6089
6425
|
// src/commands/te-analysis/tracking/plan/index.ts
|
|
6090
6426
|
var commands63 = [
|
|
6091
6427
|
trackingPlanGet,
|
|
@@ -6094,7 +6430,8 @@ var commands63 = [
|
|
|
6094
6430
|
trackingPlanGenerate,
|
|
6095
6431
|
trackingPlanExport,
|
|
6096
6432
|
trackingPlanImportExcel,
|
|
6097
|
-
trackingPlanSyncFromMeta
|
|
6433
|
+
trackingPlanSyncFromMeta,
|
|
6434
|
+
trackingPlanSyncDisplayNames
|
|
6098
6435
|
];
|
|
6099
6436
|
var plan_default = commands63;
|
|
6100
6437
|
|
|
@@ -6329,8 +6666,116 @@ var commands70 = [
|
|
|
6329
6666
|
];
|
|
6330
6667
|
var event_blacklist_default = commands70;
|
|
6331
6668
|
|
|
6332
|
-
// src/commands/te-analysis/tracking/
|
|
6669
|
+
// src/commands/te-analysis/tracking/debug-device/add.ts
|
|
6670
|
+
var trackingDebugDeviceAdd = createTrackingCapabilityCommand({
|
|
6671
|
+
resource: "debug-device",
|
|
6672
|
+
command: "add",
|
|
6673
|
+
capabilityId: "tracking.debug_device.add",
|
|
6674
|
+
description: "Create or update a Debug device for an AE project.",
|
|
6675
|
+
flags: [projectIdFlag, debugDeviceIdFlag, debugDeviceNameFlag],
|
|
6676
|
+
risk: "write",
|
|
6677
|
+
buildInput: (ctx) => ({
|
|
6678
|
+
...projectInput2(ctx),
|
|
6679
|
+
device_id: ctx.str("device-id"),
|
|
6680
|
+
device_name: ctx.str("device-name")
|
|
6681
|
+
})
|
|
6682
|
+
});
|
|
6683
|
+
|
|
6684
|
+
// src/commands/te-analysis/tracking/debug-device/list.ts
|
|
6685
|
+
var trackingDebugDeviceList = createTrackingCapabilityCommand({
|
|
6686
|
+
resource: "debug-device",
|
|
6687
|
+
command: "list",
|
|
6688
|
+
capabilityId: "tracking.debug_device.list",
|
|
6689
|
+
description: "List Debug devices and the device selected by the current CLI user.",
|
|
6690
|
+
flags: [projectIdFlag],
|
|
6691
|
+
risk: "read",
|
|
6692
|
+
buildInput: projectInput2
|
|
6693
|
+
});
|
|
6694
|
+
|
|
6695
|
+
// src/commands/te-analysis/tracking/debug-device/select.ts
|
|
6696
|
+
var trackingDebugDeviceSelect = createTrackingCapabilityCommand({
|
|
6697
|
+
resource: "debug-device",
|
|
6698
|
+
command: "select",
|
|
6699
|
+
capabilityId: "tracking.debug_device.select",
|
|
6700
|
+
description: "Select the active Debug device for the current CLI user.",
|
|
6701
|
+
flags: [projectIdFlag, debugDeviceIdFlag],
|
|
6702
|
+
risk: "write",
|
|
6703
|
+
buildInput: (ctx) => ({
|
|
6704
|
+
...projectInput2(ctx),
|
|
6705
|
+
device_id: ctx.str("device-id")
|
|
6706
|
+
})
|
|
6707
|
+
});
|
|
6708
|
+
|
|
6709
|
+
// src/commands/te-analysis/tracking/debug-device/index.ts
|
|
6333
6710
|
var commands71 = [
|
|
6711
|
+
trackingDebugDeviceList,
|
|
6712
|
+
trackingDebugDeviceAdd,
|
|
6713
|
+
trackingDebugDeviceSelect
|
|
6714
|
+
];
|
|
6715
|
+
var debug_device_default = commands71;
|
|
6716
|
+
|
|
6717
|
+
// src/commands/te-analysis/tracking/debug-data/list.ts
|
|
6718
|
+
var debugStartTimeFlag = {
|
|
6719
|
+
name: "start-time",
|
|
6720
|
+
type: "string",
|
|
6721
|
+
required: false,
|
|
6722
|
+
desc: "Query start time in YYYY-MM-DD HH:mm:ss local time. Defaults to one hour ago."
|
|
6723
|
+
};
|
|
6724
|
+
var trackingDebugDataList = createTrackingCapabilityCommand({
|
|
6725
|
+
resource: "debug-data",
|
|
6726
|
+
command: "list",
|
|
6727
|
+
capabilityId: "tracking.debug_data.list",
|
|
6728
|
+
description: "List Debug data received from one device.",
|
|
6729
|
+
flags: [projectIdFlag, debugDeviceIdFlag, debugStartTimeFlag, eventNameFlag],
|
|
6730
|
+
risk: "read",
|
|
6731
|
+
buildInput: (ctx) => compactInput({
|
|
6732
|
+
...projectInput2(ctx),
|
|
6733
|
+
device_id: ctx.str("device-id"),
|
|
6734
|
+
start_time: optionalString(ctx, "start-time") ?? formatLocalTime(new Date(Date.now() - 60 * 60 * 1e3)),
|
|
6735
|
+
event_name: optionalString(ctx, "event-name")
|
|
6736
|
+
}),
|
|
6737
|
+
postProcess: (result, input) => {
|
|
6738
|
+
const data = isRecord2(result) ? result : {};
|
|
6739
|
+
const eventList = Array.isArray(data.event_list) ? data.event_list : [];
|
|
6740
|
+
const deviceDataList = Array.isArray(data.device_data_list) ? data.device_data_list : [];
|
|
6741
|
+
return {
|
|
6742
|
+
device_id: input.device_id,
|
|
6743
|
+
start_time: input.start_time,
|
|
6744
|
+
...input.event_name ? { event_name: input.event_name } : {},
|
|
6745
|
+
has_data: deviceDataList.length > 0,
|
|
6746
|
+
event_count: eventList.length,
|
|
6747
|
+
data_count: deviceDataList.length,
|
|
6748
|
+
event_list: eventList,
|
|
6749
|
+
device_data_list: deviceDataList
|
|
6750
|
+
};
|
|
6751
|
+
}
|
|
6752
|
+
});
|
|
6753
|
+
function formatLocalTime(value) {
|
|
6754
|
+
const pad = (part) => String(part).padStart(2, "0");
|
|
6755
|
+
return [
|
|
6756
|
+
value.getFullYear(),
|
|
6757
|
+
"-",
|
|
6758
|
+
pad(value.getMonth() + 1),
|
|
6759
|
+
"-",
|
|
6760
|
+
pad(value.getDate()),
|
|
6761
|
+
" ",
|
|
6762
|
+
pad(value.getHours()),
|
|
6763
|
+
":",
|
|
6764
|
+
pad(value.getMinutes()),
|
|
6765
|
+
":",
|
|
6766
|
+
pad(value.getSeconds())
|
|
6767
|
+
].join("");
|
|
6768
|
+
}
|
|
6769
|
+
function isRecord2(value) {
|
|
6770
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6771
|
+
}
|
|
6772
|
+
|
|
6773
|
+
// src/commands/te-analysis/tracking/debug-data/index.ts
|
|
6774
|
+
var commands72 = [trackingDebugDataList];
|
|
6775
|
+
var debug_data_default = commands72;
|
|
6776
|
+
|
|
6777
|
+
// src/commands/te-analysis/tracking/index.ts
|
|
6778
|
+
var commands73 = [
|
|
6334
6779
|
...plan_default,
|
|
6335
6780
|
...sdk_sample_default,
|
|
6336
6781
|
...plan_change_log_default,
|
|
@@ -6338,9 +6783,11 @@ var commands71 = [
|
|
|
6338
6783
|
...ingest_default,
|
|
6339
6784
|
...ingest_error_default,
|
|
6340
6785
|
...live_data_default,
|
|
6341
|
-
...event_blacklist_default
|
|
6786
|
+
...event_blacklist_default,
|
|
6787
|
+
...debug_device_default,
|
|
6788
|
+
...debug_data_default
|
|
6342
6789
|
];
|
|
6343
|
-
var tracking_default =
|
|
6790
|
+
var tracking_default = commands73;
|
|
6344
6791
|
|
|
6345
6792
|
// src/commands/te-analysis/alert/shared.ts
|
|
6346
6793
|
var alertIdFlag = {
|
|
@@ -6460,7 +6907,7 @@ var analysisAlertStop = createAnalysisCapabilityCommand({
|
|
|
6460
6907
|
});
|
|
6461
6908
|
|
|
6462
6909
|
// src/commands/te-analysis/alert/index.ts
|
|
6463
|
-
var
|
|
6910
|
+
var commands74 = [
|
|
6464
6911
|
analysisAlertList,
|
|
6465
6912
|
analysisAlertGet,
|
|
6466
6913
|
analysisAlertCreate,
|
|
@@ -6469,7 +6916,7 @@ var commands72 = [
|
|
|
6469
6916
|
analysisAlertStart,
|
|
6470
6917
|
analysisAlertStop
|
|
6471
6918
|
];
|
|
6472
|
-
var alert_default =
|
|
6919
|
+
var alert_default = commands74;
|
|
6473
6920
|
|
|
6474
6921
|
// src/commands/te-analysis/alert-detail/list.ts
|
|
6475
6922
|
var analysisAlertDetailList = createAnalysisCapabilityCommand({
|
|
@@ -6483,10 +6930,10 @@ var analysisAlertDetailList = createAnalysisCapabilityCommand({
|
|
|
6483
6930
|
});
|
|
6484
6931
|
|
|
6485
6932
|
// src/commands/te-analysis/alert-detail/index.ts
|
|
6486
|
-
var
|
|
6933
|
+
var commands75 = [
|
|
6487
6934
|
analysisAlertDetailList
|
|
6488
6935
|
];
|
|
6489
|
-
var alert_detail_default =
|
|
6936
|
+
var alert_detail_default = commands75;
|
|
6490
6937
|
|
|
6491
6938
|
// src/commands/te-analysis/alert-job/list.ts
|
|
6492
6939
|
var analysisAlertJobList = createAnalysisCapabilityCommand({
|
|
@@ -6500,10 +6947,10 @@ var analysisAlertJobList = createAnalysisCapabilityCommand({
|
|
|
6500
6947
|
});
|
|
6501
6948
|
|
|
6502
6949
|
// src/commands/te-analysis/alert-job/index.ts
|
|
6503
|
-
var
|
|
6950
|
+
var commands76 = [
|
|
6504
6951
|
analysisAlertJobList
|
|
6505
6952
|
];
|
|
6506
|
-
var alert_job_default =
|
|
6953
|
+
var alert_job_default = commands76;
|
|
6507
6954
|
|
|
6508
6955
|
// src/commands/te-analysis/alert-notice-config/list.ts
|
|
6509
6956
|
var analysisAlertNoticeConfigList = createAnalysisCapabilityCommand({
|
|
@@ -6517,10 +6964,10 @@ var analysisAlertNoticeConfigList = createAnalysisCapabilityCommand({
|
|
|
6517
6964
|
});
|
|
6518
6965
|
|
|
6519
6966
|
// src/commands/te-analysis/alert-notice-config/index.ts
|
|
6520
|
-
var
|
|
6967
|
+
var commands77 = [
|
|
6521
6968
|
analysisAlertNoticeConfigList
|
|
6522
6969
|
];
|
|
6523
|
-
var alert_notice_config_default =
|
|
6970
|
+
var alert_notice_config_default = commands77;
|
|
6524
6971
|
|
|
6525
6972
|
// src/commands/te-analysis/index.ts
|
|
6526
6973
|
registerCapabilityGatewayRoute("analysis", { gatewayDomain: "analysis" });
|
|
@@ -6566,8 +7013,8 @@ var baseCommands = [
|
|
|
6566
7013
|
...alert_job_default,
|
|
6567
7014
|
...alert_notice_config_default
|
|
6568
7015
|
];
|
|
6569
|
-
var
|
|
6570
|
-
var te_analysis_default =
|
|
7016
|
+
var commands78 = [...baseCommands];
|
|
7017
|
+
var te_analysis_default = commands78;
|
|
6571
7018
|
export {
|
|
6572
7019
|
baseCommands,
|
|
6573
7020
|
te_analysis_default as default
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thinkingai/ae-cli",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.38",
|
|
4
4
|
"description": "CLI tool for ThinkingAI (AE) analytics platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"verify:agent-tools": "node scripts/verify-agent-tools.mjs && npm run verify:sandbox-tools",
|
|
42
42
|
"verify:system-tools": "node scripts/verify-system-tools.mjs && npx tsx tests/system-domain.test.ts && npx tsx tests/sandbox-tool-package.test.ts",
|
|
43
43
|
"verify:sandbox-tools": "tsx test/sandbox-tools.test.ts",
|
|
44
|
-
"verify:tracking-tools": "
|
|
44
|
+
"verify:tracking-tools": "tsx test/tracking-client.test.mjs && tsx test/tracking-skill-flow.test.mjs && node test/tracking-commands.test.mjs && tsx tests/tracking-display-name-sync.test.ts",
|
|
45
45
|
"verify:self-check-overlay": "node test/self-check-overlay.test.mjs",
|
|
46
46
|
"verify:update-check": "npx tsx test/update-check.test.mjs",
|
|
47
47
|
"verify:version-sync": "npx tsx tests/version-sync.test.ts",
|
|
@@ -239,6 +239,10 @@ This is the exhaustive command and flag inventory for the analysis skill. Read t
|
|
|
239
239
|
| `ae-cli tracking check list` | tracking.check.list | read | `--project-id` (number; required) — Numeric project ID. | [check_list.md](check_list.md) |
|
|
240
240
|
| `ae-cli tracking check retry` | tracking.check.retry | write | `--project-id` (number; required) — Numeric project ID.<br>`--uuid` (string; required) — Tracking check task UUID.<br>`--request-id` (string; optional) — Optional caller-supplied cli_<32 lowercase hex> lifecycle ID. ae-cli generates and prints one before dispatch when omitted.<br>`--timeout-seconds` (number; optional) — Optional capability execution timeout in seconds. | [check_retry.md](check_retry.md) |
|
|
241
241
|
| `ae-cli tracking check run` | tracking.check.run | write | `--project-id` (number; required) — Numeric project ID.<br>`--check-scope` (json; required) — Tracking check scope JSON object.<br>`--result-scope` (json; optional) — Optional tracking check result scope JSON object. | [check_run.md](check_run.md) |
|
|
242
|
+
| `ae-cli tracking debug-data list` | tracking.debug_data.list | read | `--project-id` (number; required) — Numeric project ID.<br>`--device-id` (string; required) — Debug device ID reported by the SDK as #device_id.<br>`--start-time` (string; optional) — Query start time in YYYY-MM-DD HH:mm:ss local time. Defaults to one hour ago.<br>`--event-name` (string; optional) — Optional event name filter. | [debug_data_list.md](debug_data_list.md) |
|
|
243
|
+
| `ae-cli tracking debug-device add` | tracking.debug_device.add | write | `--project-id` (number; required) — Numeric project ID.<br>`--device-id` (string; required) — Debug device ID reported by the SDK as #device_id.<br>`--device-name` (string; required) — Human-readable name for the Debug device. | [debug_device_add.md](debug_device_add.md) |
|
|
244
|
+
| `ae-cli tracking debug-device list` | tracking.debug_device.list | read | `--project-id` (number; required) — Numeric project ID. | [debug_device_list.md](debug_device_list.md) |
|
|
245
|
+
| `ae-cli tracking debug-device select` | tracking.debug_device.select | write | `--project-id` (number; required) — Numeric project ID.<br>`--device-id` (string; required) — Debug device ID reported by the SDK as #device_id. | [debug_device_select.md](debug_device_select.md) |
|
|
242
246
|
| `ae-cli tracking event-blacklist add` | tracking.event_blacklist.add | write | `--project-id` (number; required) — Numeric project ID.<br>`--event-names` (json; required) — JSON array of event names. | [event_blacklist_add.md](event_blacklist_add.md) |
|
|
243
247
|
| `ae-cli tracking event-blacklist list` | tracking.event_blacklist.list | read | `--project-id` (number; required) — Numeric project ID. | [event_blacklist_list.md](event_blacklist_list.md) |
|
|
244
248
|
| `ae-cli tracking event-blacklist update` | tracking.event_blacklist.update | write | `--project-id` (number; required) — Numeric project ID.<br>`--event-names` (json; required) — JSON array of event names.<br>`--type` (number; required) — Blacklist event config type: 0 or 1. | [event_blacklist_update.md](event_blacklist_update.md) |
|
|
@@ -252,6 +256,7 @@ This is the exhaustive command and flag inventory for the analysis skill. Read t
|
|
|
252
256
|
| `ae-cli tracking plan get` | tracking.plan.get | read | `--project-id` (number; required) — Numeric project ID. | [plan_get.md](plan_get.md) |
|
|
253
257
|
| `ae-cli tracking plan import-excel` | tracking.plan.import_excel | write | `--project-id` (number; required) — Numeric project ID.<br>`--input-file` (string; optional) — Local tracking-plan XLSX path. The CLI uploads it with purpose track.program.xlsx before import.<br>`--input-file-id` (string; optional) — Existing input_file_id returned by `analysis input-file upload --purpose track.program.xlsx`.<br>`--lang` (string; optional) — Excel language: zh, en, ja, ko, zh_CN, en_US, ja_JP, or ko_KR. | [plan_import_excel.md](plan_import_excel.md) |
|
|
254
258
|
| `ae-cli tracking plan save-items` | tracking.plan.save_items | write | `--project-id` (number; required) — Numeric project ID.<br>`--events` (json; optional) — Optional JSON array of tracking events.<br>`--event-props` (json; optional) — Optional JSON array of tracking event properties.<br>`--user-props` (json; optional) — Optional JSON array of tracking user properties.<br>`--common-event-props` (json; optional) — Optional JSON array of common tracking event properties. | [plan_save_items.md](plan_save_items.md) |
|
|
259
|
+
| `ae-cli tracking plan sync-display-names` | gateway lifecycle | write | `--project-id` (number; required) — Numeric project ID.<br>`--draft` (string; required) — Local tracking-plan draft.json containing event/property display_name values. | [plan_sync_display_names.md](plan_sync_display_names.md) |
|
|
255
260
|
| `ae-cli tracking plan sync-from-meta` | tracking.plan.sync_from_meta | write | `--project-id` (number; required) — Numeric project ID. | [plan_sync_from_meta.md](plan_sync_from_meta.md) |
|
|
256
261
|
| `ae-cli tracking plan-change-log export` | tracking.plan_change_log.export | read | `--project-id` (number; required) — Numeric project ID.<br>`--log-id` (number; required) — Tracking plan change log ID.<br>`--request-id` (string; optional) — Optional caller-supplied cli_<32 lowercase hex> lifecycle ID. ae-cli generates and prints one before dispatch when omitted.<br>`--timeout-seconds` (number; optional, min=1, max=21600) — Async runtime in seconds. Default and max: 21600 (6 hours); cancel earlier with analysis query cancel --run-id <run_id>. | [plan_change_log_export.md](plan_change_log_export.md) |
|
|
257
262
|
| `ae-cli tracking plan-change-log list` | tracking.plan_change_log.list | read | `--project-id` (number; required) — Numeric project ID. | [plan_change_log_list.md](plan_change_log_list.md) |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# tracking debug-data list
|
|
2
|
+
|
|
3
|
+
Use this command to query Debug data received from one device and verify an SDK reporting flow.
|
|
4
|
+
|
|
5
|
+
Command:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
ae-cli tracking debug-data list \
|
|
9
|
+
--project-id <project_id> \
|
|
10
|
+
--device-id <device_id> \
|
|
11
|
+
--start-time "YYYY-MM-DD HH:mm:ss" \
|
|
12
|
+
[--event-name <event_name>]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Capability id: `tracking.debug_data.list`.
|
|
16
|
+
|
|
17
|
+
Input sends `project_id`, `device_id`, `start_time`, and optional `event_name`. When omitted, `start_time` defaults to one hour ago in local time.
|
|
18
|
+
|
|
19
|
+
The normalized result includes `has_data`, `event_count`, `data_count`, `event_list`, and `device_data_list`. Treat validation as successful only when `has_data` is true and the returned event names, property structures, and error fields are correct.
|
|
20
|
+
|
|
21
|
+
## Parameters
|
|
22
|
+
|
|
23
|
+
| Parameter | Required | Description |
|
|
24
|
+
| -------------- | -------- | -------------------------------------------------------------------------- |
|
|
25
|
+
| `--project-id` | Yes | Numeric AE project ID. |
|
|
26
|
+
| `--device-id` | Yes | Debug device ID used by the reporting client. |
|
|
27
|
+
| `--start-time` | No | Query start time in local `YYYY-MM-DD HH:mm:ss`; defaults to one hour ago. |
|
|
28
|
+
| `--event-name` | No | Exact event name filter. |
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# tracking debug-device add
|
|
2
|
+
|
|
3
|
+
Use this command to create or update a Debug device for one AE project.
|
|
4
|
+
Do not use it to select the active device or query Debug data; use `debug-device select` and `debug-data list` for those actions.
|
|
5
|
+
|
|
6
|
+
Command:
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
ae-cli tracking debug-device add --project-id <project_id> --device-id <device_id> --device-name <device_name>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Capability id: `tracking.debug_device.add`.
|
|
13
|
+
|
|
14
|
+
Input sends `project_id`, `device_id`, and `device_name`. Prefer a stable device ID that the validation script can reuse. After creation, select the same device with `tracking debug-device select`.
|
|
15
|
+
The result confirms that the device was created or updated; use `debug-device list` to verify the saved device before selecting it.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Required | Description |
|
|
20
|
+
| --------------- | -------- | ---------------------------------------------------- |
|
|
21
|
+
| `--project-id` | Yes | Numeric AE project ID. |
|
|
22
|
+
| `--device-id` | Yes | Stable Debug device ID used by the reporting client. |
|
|
23
|
+
| `--device-name` | Yes | Human-readable Debug device name. |
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# tracking debug-device list
|
|
2
|
+
|
|
3
|
+
Use this command to list Debug devices for one AE project and identify the device selected by the current CLI user.
|
|
4
|
+
|
|
5
|
+
Command:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
ae-cli tracking debug-device list --project-id <project_id>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Capability id: `tracking.debug_device.list`.
|
|
12
|
+
|
|
13
|
+
Input sends `project_id`. The result contains the available Debug devices and current selection. Use the returned device IDs for `debug-device select` and `debug-data list`; do not invent an ID.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Required | Description |
|
|
18
|
+
| -------------- | -------- | ---------------------- |
|
|
19
|
+
| `--project-id` | Yes | Numeric AE project ID. |
|