@thinkingai/ae-cli 6.0.37 → 6.0.39

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.
Files changed (200) hide show
  1. package/README.md +25 -3
  2. package/README.zh.md +25 -3
  3. package/dist/{auth-56Z45UVR.js → auth-GDV3H5I4.js} +18 -8
  4. package/dist/{auth-ENM3FE6L.js → auth-NN55553T.js} +3 -3
  5. package/dist/{capability-2H6PAOA3.js → capability-TPORIKRQ.js} +19 -15
  6. package/dist/{capability-YPOQX6PL.js → capability-VQNC5CF7.js} +19 -15
  7. package/dist/chunk-4NN5IWVN.js +26 -0
  8. package/dist/{chunk-DB4Q3ANU.js → chunk-6A2FUCIS.js} +3 -3
  9. package/dist/{chunk-PVBYJWC2.js → chunk-7KQWSBSL.js} +4 -4
  10. package/dist/{chunk-24BAVOX3.js → chunk-AXDXJTPC.js} +3 -1
  11. package/dist/{chunk-CPVTECJ3.js → chunk-DT6Y3TD7.js} +5 -5
  12. package/dist/{chunk-EGEIXA2Z.js → chunk-DWO43OIB.js} +0 -248
  13. package/dist/{chunk-V6FR6WTW.js → chunk-GJJA4CQZ.js} +34 -2
  14. package/dist/{chunk-RGXCNC4N.js → chunk-GS2P7LFD.js} +50 -17
  15. package/dist/{chunk-LYVNONC4.js → chunk-JHENBQ5B.js} +35 -0
  16. package/dist/{chunk-3P3562ZX.js → chunk-MVDZ7DBQ.js} +5 -5
  17. package/dist/{chunk-LCXU3AAT.js → chunk-NBPKWKRA.js} +2 -2
  18. package/dist/{chunk-HQ2A7ITL.js → chunk-RBNKI5ZW.js} +50 -17
  19. package/dist/{chunk-LHVM35J4.js → chunk-TS6BUGUY.js} +4 -4
  20. package/dist/chunk-TUKQZTMI.js +250 -0
  21. package/dist/{chunk-J7MZHDHQ.js → chunk-VKD5WQKN.js} +5 -5
  22. package/dist/{chunk-3KI3RRXX.js → chunk-VTXHDCBW.js} +3 -3
  23. package/dist/{chunk-KTYR3U6D.js → chunk-YTG6Q75E.js} +10 -6
  24. package/dist/{chunk-IR4ZLVPW.js → chunk-YV52FB5G.js} +25 -3
  25. package/dist/{chunk-E7UXXHO3.js → chunk-Z3OXWCIA.js} +3 -3
  26. package/dist/{cli-token-4SBMXAUK.js → cli-token-GL5MS5FK.js} +4 -4
  27. package/dist/{client-PP5FETMW.js → client-DAIPF7XN.js} +4 -4
  28. package/dist/{community-report-client-KK2QBANO.js → community-report-client-M2RW4MXD.js} +2 -2
  29. package/dist/config-4VZNLBKF.js +489 -0
  30. package/dist/index.js +96 -37
  31. package/dist/memory-RWJW4XFO.js +892 -0
  32. package/dist/memory-VO2ZJCRT.js +892 -0
  33. package/dist/{metadata-JIQ77HFY.js → metadata-YGTHR2XJ.js} +8 -8
  34. package/dist/{metadata-AN3YFZEV.js → metadata-ZRN2GHPN.js} +8 -8
  35. package/dist/{model-JASQVOFD.js → model-CLUIK3K5.js} +7 -5
  36. package/dist/{raw-XJCAT3HX.js → raw-52B4UKO4.js} +8 -7
  37. package/dist/sync-3REDHGY6.js +10259 -0
  38. package/dist/{te-agent-JHUG6DVV.js → te-agent-XNPELAKX.js} +580 -84
  39. package/dist/{te-analysis-IWQZO423.js → te-analysis-GJI5FZUL.js} +1611 -25
  40. package/dist/{te-analysis-X222IRYR.js → te-analysis-N2BRDJZ5.js} +1611 -25
  41. package/dist/{te-community-QOYIYEJI.js → te-community-SQXKE5OO.js} +7 -7
  42. package/dist/{te-community-UFKI6ONP.js → te-community-TYSNU3NQ.js} +7 -7
  43. package/dist/{te-dataops-PZQ5NQLY.js → te-dataops-5TM7WZDI.js} +370 -189
  44. package/dist/{te-dataops-XTWVTJCA.js → te-dataops-OWIADNSM.js} +370 -189
  45. package/dist/{te-engage-NLZUPSBK.js → te-engage-F7V55KVW.js} +333 -105
  46. package/dist/{te-engage-E7F4HTXU.js → te-engage-FMYAYCNV.js} +333 -105
  47. package/dist/{te-kb-E7NSCBRB.js → te-kb-VRMEY3D4.js} +6 -6
  48. package/dist/{te-meta-GBDTMPEL.js → te-meta-53BVXPFI.js} +7 -7
  49. package/dist/{te-meta-ZTLTSHXC.js → te-meta-TOCBPBXI.js} +7 -7
  50. package/dist/{te-system-AH7DMCAQ.js → te-system-XGS5EQIQ.js} +4 -4
  51. package/dist/{te-team-BQ3SKSZV.js → te-team-BZRDV2CM.js} +7 -7
  52. package/dist/{update-DKG6UXEM.js → update-HEDXGOJH.js} +8 -6
  53. package/package.json +5 -2
  54. package/skills/ae-agent/SKILL.md +178 -16
  55. package/skills/ae-agent/references/add-skill.md +22 -10
  56. package/skills/ae-agent/references/edit-skill.md +24 -14
  57. package/skills/ae-agent/references/find-archived-conversations.md +82 -0
  58. package/skills/ae-agent/references/restore-conversation.md +54 -0
  59. package/skills/ae-agent/references/upload-skill.md +24 -14
  60. package/skills/ae-analysis/SKILL.md +1 -1
  61. package/skills/ae-analysis/references/command_index.md +109 -42
  62. package/skills/ae-analysis/references/debug_data_list.md +28 -0
  63. package/skills/ae-analysis/references/debug_device_add.md +23 -0
  64. package/skills/ae-analysis/references/debug_device_list.md +19 -0
  65. package/skills/ae-analysis/references/debug_device_select.md +22 -0
  66. package/skills/ae-analysis/references/entity_id_import_options.md +1 -1
  67. package/skills/ae-analysis/references/plan_sync_display_names.md +28 -0
  68. package/skills/ae-analysis/references/project_access_detail_get.md +3 -3
  69. package/skills/ae-analysis/references/project_data_power_delete.md +3 -3
  70. package/skills/ae-analysis/references/project_data_power_get.md +3 -3
  71. package/skills/ae-analysis/references/project_data_power_list.md +3 -3
  72. package/skills/ae-analysis/references/project_data_power_upsert.md +3 -3
  73. package/skills/ae-analysis/references/project_entity_create.md +3 -3
  74. package/skills/ae-analysis/references/project_entity_delete.md +3 -3
  75. package/skills/ae-analysis/references/project_entity_event_list.md +3 -3
  76. package/skills/ae-analysis/references/project_entity_get.md +3 -3
  77. package/skills/ae-analysis/references/project_entity_list.md +3 -3
  78. package/skills/ae-analysis/references/project_entity_update.md +3 -3
  79. package/skills/ae-analysis/references/project_function_list.md +3 -3
  80. package/skills/ae-analysis/references/project_info_create.md +25 -0
  81. package/skills/ae-analysis/references/project_info_delete.md +24 -0
  82. package/skills/ae-analysis/references/project_info_get.md +3 -3
  83. package/skills/ae-analysis/references/project_info_list.md +3 -3
  84. package/skills/ae-analysis/references/project_info_update.md +3 -3
  85. package/skills/ae-analysis/references/project_mark_time_create.md +3 -3
  86. package/skills/ae-analysis/references/project_mark_time_delete.md +3 -3
  87. package/skills/ae-analysis/references/project_mark_time_list.md +3 -3
  88. package/skills/ae-analysis/references/project_mark_time_update.md +3 -3
  89. package/skills/ae-analysis/references/project_member_add.md +3 -3
  90. package/skills/ae-analysis/references/project_member_batch_update.md +3 -3
  91. package/skills/ae-analysis/references/project_member_candidate_list.md +3 -3
  92. package/skills/ae-analysis/references/project_member_handover_export.md +3 -3
  93. package/skills/ae-analysis/references/project_member_handover_run.md +3 -3
  94. package/skills/ae-analysis/references/project_member_import.md +3 -3
  95. package/skills/ae-analysis/references/project_member_list.md +3 -3
  96. package/skills/ae-analysis/references/project_member_receiver_list.md +3 -3
  97. package/skills/ae-analysis/references/project_member_remove.md +3 -3
  98. package/skills/ae-analysis/references/project_member_update.md +3 -3
  99. package/skills/ae-analysis/references/project_owner_update.md +3 -3
  100. package/skills/ae-analysis/references/project_permission_binding_list.md +3 -3
  101. package/skills/ae-analysis/references/project_receive_status_update.md +3 -3
  102. package/skills/ae-analysis/references/project_role_delete.md +3 -3
  103. package/skills/ae-analysis/references/project_role_function_list.md +3 -3
  104. package/skills/ae-analysis/references/project_role_get.md +3 -3
  105. package/skills/ae-analysis/references/project_role_list.md +3 -3
  106. package/skills/ae-analysis/references/project_role_upsert.md +3 -3
  107. package/skills/ae-analysis/references/project_role_user_list.md +3 -3
  108. package/skills/ae-analysis/references/project_space_list.md +1 -1
  109. package/skills/ae-analysis/references/project_timezone_get.md +3 -3
  110. package/skills/ae-analysis/references/project_timezone_overview.md +3 -3
  111. package/skills/ae-analysis/references/project_timezone_update.md +3 -3
  112. package/skills/ae-analysis/references/project_user_id_items_update.md +3 -3
  113. package/skills/ae-analysis/references/system_admin_function_list.md +22 -0
  114. package/skills/ae-analysis/references/system_admin_function_update.md +26 -0
  115. package/skills/ae-analysis/references/system_admin_list.md +21 -0
  116. package/skills/ae-analysis/references/system_admin_remove.md +25 -0
  117. package/skills/ae-analysis/references/system_admin_upsert.md +25 -0
  118. package/skills/ae-analysis/references/system_function_list.md +21 -0
  119. package/skills/ae-analysis/references/system_member_add.md +25 -0
  120. package/skills/ae-analysis/references/system_member_candidate_list.md +22 -0
  121. package/skills/ae-analysis/references/system_member_delete.md +25 -0
  122. package/skills/ae-analysis/references/system_member_list.md +24 -0
  123. package/skills/ae-analysis/references/system_member_mfa_unbind.md +25 -0
  124. package/skills/ae-analysis/references/system_member_password_reset.md +32 -0
  125. package/skills/ae-analysis/references/system_member_project_batch_update.md +27 -0
  126. package/skills/ae-analysis/references/system_member_status_update.md +26 -0
  127. package/skills/ae-analysis/references/system_member_update.md +23 -0
  128. package/skills/ae-analysis/references/system_mfa_get.md +21 -0
  129. package/skills/ae-analysis/references/system_mfa_update.md +25 -0
  130. package/skills/ae-analysis/references/system_node_monitor_list.md +24 -0
  131. package/skills/ae-analysis/references/system_oauth2_update.md +22 -0
  132. package/skills/ae-analysis/references/system_ops_alert_contact_delete.md +25 -0
  133. package/skills/ae-analysis/references/system_ops_alert_contact_list.md +23 -0
  134. package/skills/ae-analysis/references/system_ops_alert_contact_test.md +29 -0
  135. package/skills/ae-analysis/references/system_ops_alert_contact_upsert.md +39 -0
  136. package/skills/ae-analysis/references/system_preference_get.md +21 -0
  137. package/skills/ae-analysis/references/system_preference_update.md +22 -0
  138. package/skills/ae-analysis/references/system_project_usage_list.md +28 -0
  139. package/skills/ae-analysis/references/system_query_alert_rule_list.md +21 -0
  140. package/skills/ae-analysis/references/system_query_alert_rule_update.md +26 -0
  141. package/skills/ae-analysis/references/system_query_monitor_overview.md +26 -0
  142. package/skills/ae-analysis/references/system_query_task_cancel.md +25 -0
  143. package/skills/ae-analysis/references/system_query_task_export.md +49 -0
  144. package/skills/ae-analysis/references/system_query_task_get.md +23 -0
  145. package/skills/ae-analysis/references/system_query_task_list.md +35 -0
  146. package/skills/ae-analysis/references/system_query_task_options.md +27 -0
  147. package/skills/ae-analysis/references/system_receiver_address_delete.md +26 -0
  148. package/skills/ae-analysis/references/system_receiver_address_overview.md +21 -0
  149. package/skills/ae-analysis/references/system_receiver_address_project_list.md +21 -0
  150. package/skills/ae-analysis/references/system_receiver_address_promote.md +24 -0
  151. package/skills/ae-analysis/references/system_receiver_address_upsert.md +27 -0
  152. package/skills/ae-analysis/references/system_receiver_detection_get.md +22 -0
  153. package/skills/ae-analysis/references/system_receiver_detection_run.md +22 -0
  154. package/skills/ae-analysis/references/system_receiver_detection_update.md +25 -0
  155. package/skills/ae-analysis/references/system_role_delete.md +26 -0
  156. package/skills/ae-analysis/references/system_role_function_list.md +22 -0
  157. package/skills/ae-analysis/references/system_role_get.md +22 -0
  158. package/skills/ae-analysis/references/system_role_list.md +24 -0
  159. package/skills/ae-analysis/references/system_role_upsert.md +27 -0
  160. package/skills/ae-analysis/references/system_role_user_list.md +22 -0
  161. package/skills/ae-analysis/references/system_seat_list.md +25 -0
  162. package/skills/ae-analysis/references/system_seat_update.md +26 -0
  163. package/skills/ae-analysis/references/system_smtp_delete.md +24 -0
  164. package/skills/ae-analysis/references/system_smtp_get.md +21 -0
  165. package/skills/ae-analysis/references/system_smtp_test.md +22 -0
  166. package/skills/ae-analysis/references/system_smtp_upsert.md +31 -0
  167. package/skills/ae-analysis/references/system_third_party_login_disable.md +25 -0
  168. package/skills/ae-analysis/references/system_third_party_login_list.md +21 -0
  169. package/skills/ae-analysis/references/system_third_party_login_upsert.md +33 -0
  170. package/skills/ae-analysis/references/system_usage_overview.md +21 -0
  171. package/skills/ae-analysis/references/system_usage_trend_export.md +44 -0
  172. package/skills/ae-analysis/references/system_usage_trend_query.md +28 -0
  173. package/skills/ae-dataops/SKILL.md +1 -1
  174. package/skills/ae-dataops/references/dataops-flow-create.md +51 -16
  175. package/skills/ae-engage/SKILL.md +56 -26
  176. package/skills/ae-engage/references/activity-activity.md +3 -0
  177. package/skills/ae-engage/references/activity-approval.md +12 -4
  178. package/skills/ae-engage/references/activity-task.md +21 -6
  179. package/skills/ae-engage/references/activity-topic.md +31 -13
  180. package/skills/ae-engage/references/add-channel.md +170 -41
  181. package/skills/ae-engage/references/build-task-save-guide.md +40 -27
  182. package/skills/ae-engage/references/channel-update-config.md +3 -2
  183. package/skills/ae-engage/references/common-metric.md +48 -120
  184. package/skills/ae-engage/references/flow-detail.md +13 -0
  185. package/skills/ae-engage/references/preset-event.md +12 -32
  186. package/skills/ae-engage/references/save-flow.md +127 -64
  187. package/skills/ae-engage/references/save-task.md +197 -59
  188. package/skills/ae-engage/references/scene-config-metric.md +3 -0
  189. package/skills/ae-engage/references/scene-preset-metric.md +8 -37
  190. package/skills/ae-engage/references/scene-strategy-audience.md +51 -643
  191. package/skills/ae-engage/references/scene-strategy.md +6 -6
  192. package/skills/ae-engage/references/task-detail.md +10 -0
  193. package/skills/ae-engage/references/task-submit-approval.md +45 -0
  194. package/skills/ae-engage/references/validate-flow-node-config.md +1 -1
  195. package/skills/ae-generate-tracking-code/SKILL.md +24 -8
  196. package/skills/ae-generate-tracking-code/references/debug-script.md +46 -37
  197. package/skills/ae-generate-tracking-plan/SKILL.md +26 -1
  198. package/skills/ae-metadata/SKILL.md +1 -1
  199. package/dist/config-BSSALXEN.js +0 -128
  200. package/dist/sync-QFP4XFN3.js +0 -485
@@ -24,9 +24,9 @@ ae-cli engage-scene strategy update --project-id <project_id> \
24
24
  # Query a strategy's log
25
25
  ae-cli engage-scene strategy log --project-id <project_id> --strategy-uuid <uuid>
26
26
 
27
- # Predict custom-audience size (mix QP)
27
+ # Predict custom-audience size
28
28
  ae-cli engage-scene strategy predict --project-id <project_id> \
29
- --qp '<targetClusterQp JSON string>' \
29
+ --definition-request '{"type":"condition","conditions":{...}}' \
30
30
  --zone-offset 8 \
31
31
  [--strategy-uuid <uuid>]
32
32
 
@@ -48,7 +48,7 @@ ae-cli engage-scene strategy manage --project-id <project_id> --config-id <confi
48
48
  | create | `--project-id`, `--payload` | payload = `ConfigStrategyAddDTO`. |
49
49
  | update | `--project-id`, `--payload` | payload = `ConfigStrategyModifyDTO` (`strategyUuid` + fields). |
50
50
  | log | `--project-id`, `--strategy-uuid` | read. |
51
- | predict | `--project-id`, `--qp`, `--zone-offset` | Optional `--strategy-uuid`, `--request-id`. read. |
51
+ | predict | `--project-id`, `--definition-request`, `--zone-offset` | Optional `--strategy-uuid`, `--request-id`. read. |
52
52
  | batch-copy | `--project-id`, `--config-id`, `--strategy-ids` | `--op-mode` optional (default `batch`). |
53
53
  | manage | `--project-id`, `--config-id`, `--action` | Lifecycle actions require `--strategy-uuid-list`; review actions require `--strategy-list`; write. |
54
54
 
@@ -67,10 +67,10 @@ ae-cli engage-scene strategy manage --project-id <project_id> --config-id <confi
67
67
  - Discover real strategy UUIDs / config IDs first; never invent IDs.
68
68
  - **Custom audience (`targetClusterType=1`)** — follow [`scene-strategy-audience.md`](scene-strategy-audience.md) end-to-end:
69
69
  1. Preflight every **用户满足** user property and **用户行为** event via `analysis-meta property get` / `event get`; if missing, **stop** and list available properties — never invent or drop.
70
- 2. Assemble mix QP with **two-block layout**: `totalCFilter.filts[0]` = 用户满足, `totalCFilter.filts[1]` = 用户行为; `totalCFilter.relation` = 且/或 between them. **Never** nest `event` inside user-side `COMPOUND`.
71
- 3. `JSON.stringify` `targetClusterQp`; then `strategy create|update`.
70
+ 2. Build an Analysis-compatible semantic condition in `payload.definitionRequest`.
71
+ 3. Reuse the same definition with `strategy predict --definition-request`.
72
72
  4. **Do not** call `analysis user-cluster create` unless the user explicitly asks for an existing/named cluster.
73
- - Full QP spec + examples A/B/C: [`scene-strategy-audience.md`](scene-strategy-audience.md).
73
+ - Semantic contract and examples: [`scene-strategy-audience.md`](scene-strategy-audience.md).
74
74
  - **`create` requires an enabled template** on the same config item. Enable workflow: `config-param batch-add` → `template create` → `template update` (non-empty `config[]` with real `paramId`) → `template update-status --status 1`. Otherwise `create` returns `TEMPLATE_ENABLE`.
75
75
  - `create` output field is `data.strategy_uuid` (not `strategy_id`).
76
76
  - `manage` supports `online`, `offline`, `suspend`, `delete`, `approve`, `deny`, and `cancel`; it is a write operation.
@@ -5,6 +5,16 @@ Query the details of a single task.
5
5
 
6
6
  Mapped command: `ae-cli engage-task task get`
7
7
 
8
+ For a custom target audience, the response hides persisted `qp` and returns:
9
+
10
+ - `definition_status`: `AVAILABLE`, `UNAVAILABLE`, or `NOT_APPLICABLE`
11
+ - `definition_request`: the Analysis-compatible semantic audience definition when available
12
+ - `definition_unavailable_reason`: present only when a historical QP cannot be reversed
13
+
14
+ Reuse `definition_request` as `req.targetConfig.definitionRequest` when updating a task.
15
+ Soft-deleted tasks are treated as unavailable and return `TASK_NOT_FOUND`, matching task-list
16
+ visibility.
17
+
8
18
  ## Flags
9
19
 
10
20
  | Flag | Type | Required | Description |
@@ -0,0 +1,45 @@
1
+ # engage-task task submit-approval
2
+
3
+ Submit an existing draft engagement task for approval. The legacy full save-and-submit request remains supported.
4
+ This is a regular write operation.
5
+
6
+ > Capability id: `engage-task.task.submit-approval` · Domain: `engage`.
7
+
8
+ ```bash
9
+ ae-cli engage-task task submit-approval --project-id <project_id> --task-id <task_id>
10
+ ```
11
+
12
+ ## Parameters
13
+
14
+ | Flag | Required | Notes |
15
+ |---|---|---|
16
+ | `--project-id` / `-p` | yes | Numeric project ID. |
17
+ | `--task-id` | conditional | Existing draft task ID. Recommended after `task save`. |
18
+ | `--request` | conditional | Legacy `ApprovalSaveAndSubmitDTO` / `OperationTaskOpDTO` JSON (camelCase or snake_case). |
19
+
20
+ Provide exactly one of `--task-id` or `--request`.
21
+
22
+ ## Output
23
+
24
+ - `data.task_id`
25
+
26
+ ## Request notes
27
+
28
+ - Prefer `task save` followed by `submit-approval --task-id`. The server loads the persisted draft, validates its
29
+ trigger rule, and reuses the existing save-and-submit approval workflow.
30
+ - Do not reconstruct or pass `trigger_rule`. It is an internal persisted field.
31
+ - The legacy `--request` mode remains available for existing callers.
32
+ - Required body fields (server validates): `task_name`, `channel_type`, `channel_id`, `group_content_list`, `target_cluster_type`, `trigger_type`, `completion_indicator_def`, `frequency_limits`, `enable_channel_touch_limits`, `group_id`, `trigger_time_strategy`.
33
+ - Missing `expConfig` is auto-filled as `{"enableExp":false}` (same as activity task create/update).
34
+ - TEXT channel params missing `config` are auto-filled with Slate.js JSON from `value`.
35
+ - For schedule-single (`triggerType=0`), include a future `triggerTime` (and `tzOffset` / `triggerTimeStrategy` as needed).
36
+ - Prefer save → submit by task ID; do not invent `taskId` / `channelId`.
37
+
38
+ ## Common Errors
39
+
40
+ | code | when |
41
+ |---|---|
42
+ | `APPROVAL_INPUT_INVALID` | neither or both of `task_id` and `request` supplied |
43
+ | `REQUEST_REQUIRED` | `--request` missing or not an object |
44
+ | `REQUEST_FIELDS_REQUIRED` | required body fields absent/blank |
45
+ | `CAPABILITY_EXECUTION_FAILED` | unmapped domain failure; check `invocation_id` / Hermes logs |
@@ -30,7 +30,7 @@ Use `--operation-mode save_flow` for the current exposed MCP protocol. Use `save
30
30
  Important current rules:
31
31
 
32
32
  - `event_trigger` / `event_judge` A segment: use `periodStart`, `periodEnd`, `periodTimeSymbol`; do not use branch-style `delayTime`.
33
- - `event_split_flow` branch segment: use `delayTime`, `delayTimeSymbol`, `targetClusterType`; omit `triggerRule` on default branches.
33
+ - `event_split_flow` branch segment: use `delayTime`, `delayTimeSymbol`, `targetClusterType`; omit `triggerDefinition` on default branches.
34
34
  - `event_trigger targetUserType=2` is invalid.
35
35
  - Push `OBJ_ARRAY.value` must be a JSON array, not a stringified array.
36
36
  - Push `contentList[].content` should be a JSON array, but a JSON-stringified array is accepted for compatibility.
@@ -91,12 +91,12 @@ First, check if `.ae-cli/draft.json` exists and read existing configuration:
91
91
  **⚠️ Key: SERVER_URL and APP_ID are independent config items. Even if draft.json has project_id and host, you MUST resolve and confirm them. `project_id` ≠ `APP_ID`, `host` ≠ `SERVER_URL`.**
92
92
 
93
93
  1. **APP_ID** — Prefer automatic lookup before asking:
94
- - If `meta.project_id` is known, run `ae-cli analysis project info list` once for the current host.
94
+ - If `meta.project_id` is known, run `ae-cli project info list` once for the current host.
95
95
  - Find the project whose `projectId` matches `meta.project_id`.
96
96
  - If the matched project has `appId`, ask: **"I found APP_ID `<appId>` for project `<projectId>`. Use it? yes / enter new value"**
97
97
  - If the project is missing, ambiguous, or has no `appId`, ask the user to copy APP_ID from AE Admin → "Project Settings" → "Integration Config".
98
98
  2. **SERVER_URL** — Data ingestion endpoint (**different from web URL**; go to AE Admin → "Project Settings" → "Integration Config" → fill in "Public URL")
99
- - If `meta.project_id` is known, you may try `ae-cli analysis project info get --project-id <project_id>` once.
99
+ - If `meta.project_id` is known, you may try `ae-cli project info get --project-id <project_id>` once.
100
100
  - Use the returned value only if the response explicitly contains a receiver URL field such as `serverUrl`, `pushUrl`, `push_url`, `receiverUrl`, `publicUrl`, `publicReceiverAddress`, `privateReceiverAddress`, or equivalent ingestion endpoint field.
101
101
  - If both `publicReceiverAddress` and `privateReceiverAddress` are present, prefer `publicReceiverAddress` as `SERVER_URL` for generated snippets unless the user explicitly needs an internal/private-network receiver.
102
102
  - If a value is found, ask: **"I found SERVER_URL `<url>` for project `<projectId>`. Use it? yes / enter new value"**
@@ -105,7 +105,9 @@ First, check if `.ae-cli/draft.json` exists and read existing configuration:
105
105
 
106
106
  **host handling** (optional):
107
107
  - If you need to fetch plan from AE (no local draft.json) → ask for host
108
- - If local draft.json exists → host is not required; only hint user to open AE Debug page during validation phase
108
+ - If local draft.json exists → host is not required for code generation
109
+ - Before Debug validation, run `ae-cli config current` and confirm the active host matches the target AE environment; if it does not, run `ae-cli config set-host <AE_HOST>`
110
+ - Complete Debug validation with `ae-cli tracking debug-device` and `ae-cli tracking debug-data` by default; only hint the user to open the AE Debug page when those CLI capabilities are unavailable
109
111
 
110
112
  ### If only xlsx file exists (no draft.json)
111
113
 
@@ -605,16 +607,30 @@ Provide validation guidance based on selected platforms:
605
607
 
606
608
  ```
607
609
  Validation steps:
608
- 1. Run validation script:
610
+ 1. Confirm the active AE environment:
611
+ ae-cli config current
612
+
613
+ 2. List existing Debug devices:
614
+ ae-cli tracking debug-device list --project-id <project_id>
615
+
616
+ 3. Create the script's stable device ID if it is missing, then select it:
617
+ ae-cli tracking debug-device add --project-id <project_id> --device-id <device_id> --device-name <name>
618
+ ae-cli tracking debug-device select --project-id <project_id> --device-id <device_id>
619
+
620
+ 4. Run validation script:
609
621
  - Client: run .ae-cli/output/te-debug-client.<ext>
610
622
  - Server: run .ae-cli/output/te-debug-server.<ext>
611
623
 
612
- 2. Open AE Debug page:
613
- https://<host>/#/data/debug
624
+ 5. Query the most recent hour of Debug data:
625
+ ae-cli tracking debug-data list --project-id <project_id> --device-id <device_id>
626
+
627
+ 6. Confirm has_data=true, then inspect event names, property structures, and error fields.
628
+ If needed, add --event-name <event_name> or --start-time "YYYY-MM-DD HH:mm:ss".
614
629
 
615
- 3. Filter by distinct_id=claude-test to view uploaded data
630
+ 7. Only if the CLI capability is unavailable, open the AE Debug page:
631
+ https://<host>/#/data/debug
616
632
 
617
- 4. For LogBus2:
633
+ 8. For LogBus2:
618
634
  - Copy daemon.json to LogBus2 conf/ directory
619
635
  - Start: ./logbus start
620
636
  - Official docs: https://docs-v2.thinkingdata.cn/?version=latest&code=logbus2_installation&lan=en-US
@@ -3,28 +3,33 @@
3
3
  > **Terminology**: 校验脚本 = validation/debug script | 设备绑定 = device binding | Debug 模式 = debug mode | TDDebugConsumer = debug mode consumer (validates data format, does NOT persist to production) | 实时调试 = real-time debugging | 代表业务事件 = representative business events | SDK 日志打印 = SDK log printing
4
4
 
5
5
  ## Deliverable
6
+
6
7
  `te-debug.<ext>` single file; used to quickly verify SDK configuration is correct.
7
8
 
8
9
  ---
9
10
 
10
11
  ## Debug Mode Verification
11
12
 
12
- When using debug mode, you must add the debug device ID in AE Admin before data will appear on the AE **Debug Data** page.
13
+ When using debug mode, register and select the debug device with `ae-cli` before sending events. The Agent can then query the received Debug data directly, without asking the user to return to the AE page.
13
14
 
14
15
  ### Verification Steps
15
16
 
16
- | Step | Action |
17
- |---|---|
18
- | 1 | Add debug device ID in AE Admin: Tracking Management Debug Data → Add Device |
19
- | 2 | Run debug script to send test events |
20
- | 3 | Open AE Debug page: `https://<host>/#/data/debug` |
21
- | 4 | Filter by `distinct_id` or `device_id` to view uploaded data |
17
+ | Step | Action |
18
+ | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
19
+ | 1 | List devices: `ae-cli tracking debug-device list --project-id <project_id>` |
20
+ | 2 | Add the script's device ID when missing: `ae-cli tracking debug-device add --project-id <project_id> --device-id <device_id> --device-name <name>` |
21
+ | 3 | Select it: `ae-cli tracking debug-device select --project-id <project_id> --device-id <device_id>` |
22
+ | 4 | Run the debug script to send test events |
23
+ | 5 | Query received data: `ae-cli tracking debug-data list --project-id <project_id> --device-id <device_id>` |
24
+ | 6 | If needed, filter one event with `--event-name <event_name>` or inspect it in AE at `https://<host>/#/data/debug` |
22
25
 
23
26
  ### Common Notes for Client and Server SDKs
24
27
 
25
28
  - Both use **TDDebugConsumer** (or the platform's equivalent debug mode API)
26
- - Both require adding device ID in AE Admin to view data on the Debug page
29
+ - Both require registering the same device ID with `ae-cli tracking debug-device add`
27
30
  - On validation failure, the SDK prints error logs or throws exceptions (behavior varies by language)
31
+ - `debug-data list` defaults to the most recent hour and returns `has_data`, `event_count`, `data_count`, and the raw Debug records
32
+ - Treat `has_data: true` as evidence that the receiver got Debug data; also inspect each record's error fields before declaring validation successful
28
33
 
29
34
  ---
30
35
 
@@ -32,32 +37,32 @@ When using debug mode, you must add the debug device ID in AE Admin before data
32
37
 
33
38
  ### Client SDK
34
39
 
35
- | SDK | Debug Mode API | Reference Doc |
36
- |---|---|---|
37
- | Unity SDK | `TDConfig config = new TDConfig(appId, serverUrl); config.mode = TDMode.DEBUG; TDAnalytics.Init(config);` | `data-ingestion-guide/client-sdk/game-engine/unity/unity-advanced/debugging-and-logging.md` |
38
- | Android SDK | `TDConfig config = new TDConfig(this, serverUrl, appId); config.setMode(TDConfig.Mode.DEBUG); TDAnalytics.init(this, config);` | `data-ingestion-guide/client-sdk/android/android-advanced/debugging-and-logging.md` |
39
- | iOS SDK | `TDConfig *config = [[TDConfig alloc] initWithAppId:appId serverUrl:serverUrl]; config.mode = TDModeDebug; [TDAnalytics startWithConfig:config];` | `data-ingestion-guide/client-sdk/ios/ios-advanced/debugging-and-logging.md` |
40
- | JavaScript SDK | `ta.init({ appId: appId, server_url: serverUrl, debug: true });` | `data-ingestion-guide/client-sdk/javascript/javascript-advanced/debugging-and-logging.md` |
41
- | Mini Program SDK | `ta.init({ appId: appId, server_url: serverUrl, debug: true });` | `客户端-sdk/小程序小游戏/进阶指南/实时调试.md` |
42
- | CocosCreator | See doc | `data-ingestion-guide/client-sdk/game-engine/cocoscreator/cocoscreator-advance/debugging-and-logging.md` |
43
- | Cocos2d-x | See doc | `data-ingestion-guide/client-sdk/game-engine/cocos2d-x/cocos2d-x-advanced/debugging-and-logging.md` |
44
- | Unreal SDK | See doc | `data-ingestion-guide/client-sdk/game-engine/unreal/unreal-advanced/debugging-and-logging.md` |
45
- | Flutter SDK | See doc | `data-ingestion-guide/client-sdk/cross-platform/flutter/flutter-advanced/debugging-and-logging.md` |
46
- | React Native | See doc | `data-ingestion-guide/client-sdk/cross-platform/react-native/reactnative-advanced/debugging-and-logging.md` |
40
+ | SDK | Debug Mode API | Reference Doc |
41
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
42
+ | Unity SDK | `TDConfig config = new TDConfig(appId, serverUrl); config.mode = TDMode.DEBUG; TDAnalytics.Init(config);` | `data-ingestion-guide/client-sdk/game-engine/unity/unity-advanced/debugging-and-logging.md` |
43
+ | Android SDK | `TDConfig config = new TDConfig(this, serverUrl, appId); config.setMode(TDConfig.Mode.DEBUG); TDAnalytics.init(this, config);` | `data-ingestion-guide/client-sdk/android/android-advanced/debugging-and-logging.md` |
44
+ | iOS SDK | `TDConfig *config = [[TDConfig alloc] initWithAppId:appId serverUrl:serverUrl]; config.mode = TDModeDebug; [TDAnalytics startWithConfig:config];` | `data-ingestion-guide/client-sdk/ios/ios-advanced/debugging-and-logging.md` |
45
+ | JavaScript SDK | `ta.init({ appId: appId, server_url: serverUrl, debug: true });` | `data-ingestion-guide/client-sdk/javascript/javascript-advanced/debugging-and-logging.md` |
46
+ | Mini Program SDK | `ta.init({ appId: appId, server_url: serverUrl, debug: true });` | `客户端-sdk/小程序小游戏/进阶指南/实时调试.md` |
47
+ | CocosCreator | See doc | `data-ingestion-guide/client-sdk/game-engine/cocoscreator/cocoscreator-advance/debugging-and-logging.md` |
48
+ | Cocos2d-x | See doc | `data-ingestion-guide/client-sdk/game-engine/cocos2d-x/cocos2d-x-advanced/debugging-and-logging.md` |
49
+ | Unreal SDK | See doc | `data-ingestion-guide/client-sdk/game-engine/unreal/unreal-advanced/debugging-and-logging.md` |
50
+ | Flutter SDK | See doc | `data-ingestion-guide/client-sdk/cross-platform/flutter/flutter-advanced/debugging-and-logging.md` |
51
+ | React Native | See doc | `data-ingestion-guide/client-sdk/cross-platform/react-native/reactnative-advanced/debugging-and-logging.md` |
47
52
 
48
53
  ### Server SDK
49
54
 
50
- | Language | DebugConsumer API | Reference Doc |
51
- |---|---|---|
52
- | Java | `new TDDebugConsumer(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/java/java-advanced/debugging-and-logging.md` |
53
- | Python | `TDDebugConsumer(serverUrl, appId, device_id="...")` | `data-ingestion-guide/server-sdk/python/python-advanced/debugging-and-logging.md` |
54
- | Go | `NewDebugConsumerWithDeviceId(serverUrl, appId, false, deviceId)` | `data-ingestion-guide/server-sdk/golang/golang-advanced/debugging-and-logging.md` |
55
- | Node.js | `ThinkingData.initWithDebugMode(appId, serverUrl, { deviceId: "..." })` | `data-ingestion-guide/server-sdk/nodejs/nodejs-advanced/debugging-and-logging.md` |
56
- | PHP | `new TDDebugConsumer(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/php/php-advanced/debugging-and-logging.md` |
57
- | Ruby | `TDDebugConsumer.new(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/ruby/ruby-advanced/debugging-and-logging.md` |
58
- | Erlang | `tddebug_consumer:new(ServerUrl, AppId, DeviceId)` | `data-ingestion-guide/server-sdk/erlang/erlang-advanced/debugging-and-logging.md` |
59
- | Lua | `TDDebugConsumer.new(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/lua/lua-advanced/debugging-and-logging.md` |
60
- | C | `td_debug_consumer_new(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/c/c-advanced/debugging-and-logging.md` |
55
+ | Language | DebugConsumer API | Reference Doc |
56
+ | -------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
57
+ | Java | `new TDDebugConsumer(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/java/java-advanced/debugging-and-logging.md` |
58
+ | Python | `TDDebugConsumer(serverUrl, appId, device_id="...")` | `data-ingestion-guide/server-sdk/python/python-advanced/debugging-and-logging.md` |
59
+ | Go | `NewDebugConsumerWithDeviceId(serverUrl, appId, false, deviceId)` | `data-ingestion-guide/server-sdk/golang/golang-advanced/debugging-and-logging.md` |
60
+ | Node.js | `ThinkingData.initWithDebugMode(appId, serverUrl, { deviceId: "..." })` | `data-ingestion-guide/server-sdk/nodejs/nodejs-advanced/debugging-and-logging.md` |
61
+ | PHP | `new TDDebugConsumer(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/php/php-advanced/debugging-and-logging.md` |
62
+ | Ruby | `TDDebugConsumer.new(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/ruby/ruby-advanced/debugging-and-logging.md` |
63
+ | Erlang | `tddebug_consumer:new(ServerUrl, AppId, DeviceId)` | `data-ingestion-guide/server-sdk/erlang/erlang-advanced/debugging-and-logging.md` |
64
+ | Lua | `TDDebugConsumer.new(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/lua/lua-advanced/debugging-and-logging.md` |
65
+ | C | `td_debug_consumer_new(serverUrl, appId, deviceId)` | `data-ingestion-guide/server-sdk/c/c-advanced/debugging-and-logging.md` |
61
66
 
62
67
  ---
63
68
 
@@ -67,7 +72,7 @@ When generating a debug script, the skill must:
67
72
 
68
73
  1. **First read the corresponding SDK's "Real-time Debug" doc** (see reference doc paths below) to confirm the SDK's debug mode API and usage (the table above is an index reference only; actual usage may differ)
69
74
  2. Use the corresponding platform's **TDDebugConsumer** or debug mode API
70
- 3. Set `deviceId` (e.g. `claude-test-device`) for AE Admin device registration
75
+ 3. Set a stable `deviceId` (e.g. `agent-debug-<project_id>`) and register it with `ae-cli tracking debug-device add`
71
76
  4. Read `SERVER_URL` and `appId` from plan (NOT web host)
72
77
  5. Pick 3 representative business events from plan (if object array properties exist, construct them fully)
73
78
  6. Recommend enabling SDK log printing (for easier troubleshooting)
@@ -76,6 +81,7 @@ When generating a debug script, the skill must:
76
81
  ### Post-delivery Prompt
77
82
 
78
83
  **Platform filtering notes**:
84
+
79
85
  - xlsx "Platform" column values map to `platform` field:
80
86
  - `客户端` / `client` → `platform: "client"`
81
87
  - `服务端` / `server` → `platform: "server"`
@@ -86,16 +92,19 @@ When generating a debug script, the skill must:
86
92
 
87
93
  ```
88
94
  Verification steps:
89
- 1. Add debug device ID in AE Admin: Tracking Management → Debug Data → Add Device (enter deviceId)
90
- 2. Run debug script
91
- 3. Open AE Debug page: https://<host>/#/data/debug
92
- 4. Filter by distinct_id or device_id to view uploaded data
93
- 5. Check event property structure correctness (especially object array properties)
95
+ 1. Run `ae-cli tracking debug-device list --project-id <project_id>`.
96
+ 2. If needed, run `ae-cli tracking debug-device add --project-id <project_id> --device-id <device_id> --device-name <name>`.
97
+ 3. Run `ae-cli tracking debug-device select --project-id <project_id> --device-id <device_id>`.
98
+ 4. Run the debug script.
99
+ 5. Run `ae-cli tracking debug-data list --project-id <project_id> --device-id <device_id>`.
100
+ 6. Confirm `has_data` is true and inspect error fields and event property structures.
101
+ 7. If no data appears, retry with an explicit `--start-time "YYYY-MM-DD HH:mm:ss"` and verify that the script reports the exact same device ID.
94
102
  ```
95
103
 
96
104
  ### Reference Doc Paths
97
105
 
98
106
  All SDK debug/logging docs are located at:
107
+
99
108
  - `~/.ae-cli/wiki/raw/data-ingestion-guide/client-sdk/<sdk>/<sdk>-advanced/debugging-and-logging.md`
100
109
  - `~/.ae-cli/wiki/raw/data-ingestion-guide/server-sdk/<language>/<language>-advanced/debugging-and-logging.md`
101
110
 
@@ -72,6 +72,8 @@ Phase 0 → 1 → 2 → 3 → 4, do not skip steps.
72
72
  >
73
73
  > **Language rules**: For newly generated content, user-facing fields in draft.json (`display_name`, `event_desc`, `event_tag`,
74
74
  > property `display_name`, property `desc`, etc.) should be generated in the **user's input language**.
75
+ > Every event, event property, common event property, and user property must have a non-empty `display_name`.
76
+ > A canonical snake_case identifier is not a substitute for a user-facing display name.
75
77
  > For imported templates, do NOT translate those fields manually. Template sheet names, headers, property type display values,
76
78
  > CLI messages, and auto-track/i18n-owned labels must come from `src/tracking/i18n` via `AE_LANG=<user_lang>` and `draft.meta.lang`.
77
79
  > When a localized label is needed, inspect `src/tracking/i18n` and use the existing resource key/value; do not invent translations from the model.
@@ -969,6 +971,7 @@ User ok → **immediately execute archive command**, then proceed to Phase 3.
969
971
  - [ ] Do event/property names contain only letters, digits, and underscores (no Chinese, no spaces)?
970
972
  - [ ] Are there duplicate event names or synonymous events coexisting (e.g. `order_create` and `create_order`)?
971
973
  - [ ] Does the same property name map to multiple display names or types?
974
+ - [ ] Does every event, event property, common event property, and user property have a non-empty `display_name` in the user's language?
972
975
 
973
976
  ### Revenue Model Required Events Check
974
977
 
@@ -1251,6 +1254,26 @@ AE_LANG=<user_lang> ae-cli tracking plan upload --project <projectId> --xlsx .ae
1251
1254
 
1252
1255
  On successful upload, prompt user to verify in AE Admin. **Provide the full URL** (tracking plan page URL format: `https://<host>/#/data/plan`).
1253
1256
 
1257
+ Then read the uploaded plan back through ae-cli and synchronize its display names to any event/property metadata
1258
+ that already exists in the project:
1259
+
1260
+ ```bash
1261
+ AE_LANG=<user_lang> ae-cli tracking plan get --project-id <projectId> --host <host>
1262
+ AE_LANG=<user_lang> ae-cli tracking plan sync-display-names \
1263
+ --project-id <projectId> \
1264
+ --draft .ae-cli/draft.json \
1265
+ --host <host>
1266
+ ```
1267
+
1268
+ `sync-display-names` is intentionally safe to rerun:
1269
+
1270
+ - It fills only blank event/property metadata display names.
1271
+ - It never overwrites a non-empty display name already maintained in AE.
1272
+ - `missing_in_metadata` means that the event/property has not appeared in project metadata yet; it is not an upload failure.
1273
+ Report those names and rerun the same command after the first Debug or production data reaches AE.
1274
+ - `missing_display_name_in_draft` means the generated plan is incomplete. Add the missing localized `display_name`,
1275
+ regenerate/validate the xlsx, and rerun the upload/synchronization flow.
1276
+
1254
1277
  ---
1255
1278
 
1256
1279
  ### 4.4 Upload Failure Handling and Auto-fix
@@ -1289,7 +1312,9 @@ Fixed: Fixed object array sub-property inconsistency, Fixed display name duplica
1289
1312
 
1290
1313
  ### 4.5 Post-success Actions
1291
1314
 
1292
- After successful upload, prompt user to verify in AE Admin. **Provide the full URL** (tracking plan page URL format: `https://<host>/#/data/plan`)
1315
+ After successful upload and display-name synchronization, prompt user to verify in AE Admin. **Provide the full URL**
1316
+ (tracking plan page URL format: `https://<host>/#/data/plan`). Include a short synchronization summary:
1317
+ updated counts, preserved existing counts, and any names still missing from project metadata.
1293
1318
 
1294
1319
  **Ask about generating tracking code**:
1295
1320
 
@@ -53,7 +53,7 @@ ae-cli metadata property <dimension-table-action> [options]
53
53
 
54
54
  ## PROJECT_ID_GATE
55
55
 
56
- Same rules as `ae-analysis`: reuse verified project context in one conversation; otherwise `ae-cli analysis project info list` (or `ae-analysis` skill) to resolve `project_id`.
56
+ Same rules as `ae-analysis`: reuse verified project context in one conversation; otherwise `ae-cli project info list` (or `ae-analysis` skill) to resolve `project_id`.
57
57
 
58
58
  ## Commands (10)
59
59
 
@@ -1,128 +0,0 @@
1
- import {
2
- GLOBAL_QUERY_CONFIG_KEY,
3
- getAnalysisMappingPathForClusterMode,
4
- getClusterInfoFilePath,
5
- isGlobalQueryModeEnabled,
6
- setGlobalQueryModeEnabled
7
- } from "./chunk-LCXU3AAT.js";
8
- import {
9
- printError,
10
- printOutput
11
- } from "./chunk-KTYR3U6D.js";
12
- import "./chunk-E7UXXHO3.js";
13
- import "./chunk-IR4ZLVPW.js";
14
- import {
15
- addHost,
16
- loadConfig,
17
- normalizeUrl,
18
- setActiveHost
19
- } from "./chunk-V6FR6WTW.js";
20
- import "./chunk-LYVNONC4.js";
21
-
22
- // src/commands/config.ts
23
- function registerConfig(program) {
24
- const configCmd = program.command("config").description("AE host and environment configuration").action(() => {
25
- printError("config", "Missing subcommand.", "Run: ae-cli config --help");
26
- process.exit(1);
27
- });
28
- configCmd.command("list").description("List configured AE environments").action(async () => {
29
- await printConfigList(program);
30
- });
31
- configCmd.command("current").description("Show the active AE environment").action(async () => {
32
- await printCurrentConfig(program);
33
- });
34
- configCmd.command("use <env>").description("Switch active AE environment by exact URL or unique label").action(async (env) => {
35
- await useConfigEnv(program, env);
36
- });
37
- configCmd.command("set-host <url>").description("Set the active AE host non-interactively (adds it if not already configured)").option("--label <label>", "Display label for this host (defaults to the host URL)").action(async (url, opts) => {
38
- const normalized = normalizeUrl(url);
39
- const label = opts.label || normalized;
40
- addHost(normalized, label);
41
- setActiveHost(normalized);
42
- await printOutput({ activeHost: normalized, label }, program.opts().format || "json");
43
- });
44
- const clusterMode = configCmd.command("cluster-mode").description("Manage local multi-cluster analysis MCP mode").action(async () => {
45
- await printClusterModeStatus(program);
46
- });
47
- clusterMode.command("status").description("Show local multi-cluster analysis MCP mode").action(async () => {
48
- await printClusterModeStatus(program);
49
- });
50
- clusterMode.command("enable").description("Enable local multi-cluster analysis MCP mode").action(async () => {
51
- setGlobalQueryModeEnabled(true);
52
- await printClusterModeStatus(program);
53
- });
54
- clusterMode.command("disable").description("Disable local multi-cluster analysis MCP mode").action(async () => {
55
- setGlobalQueryModeEnabled(false);
56
- await printClusterModeStatus(program);
57
- });
58
- }
59
- async function printClusterModeStatus(program) {
60
- const enabled = isGlobalQueryModeEnabled();
61
- await printOutput({
62
- [GLOBAL_QUERY_CONFIG_KEY]: enabled,
63
- path: getClusterInfoFilePath(),
64
- analysisMappingPath: getAnalysisMappingPathForClusterMode(enabled)
65
- }, program.opts().format || "json", program.opts().jq);
66
- }
67
- function readHostViews() {
68
- const config = loadConfig();
69
- const hosts = Object.entries(config.hosts).map(([url, entry]) => ({
70
- url,
71
- label: entry.label,
72
- active: url === config.activeHost
73
- }));
74
- return { activeHost: config.activeHost, hosts };
75
- }
76
- async function printConfigList(program) {
77
- const { activeHost, hosts } = readHostViews();
78
- await printOutput({ activeHost, hosts }, program.opts().format || "json", program.opts().jq);
79
- }
80
- async function printCurrentConfig(program) {
81
- const { activeHost, hosts } = readHostViews();
82
- const current = hosts.find((h) => h.url === activeHost);
83
- if (!current) {
84
- failConfig("No active AE environment configured.", "Run: ae-cli config use <env> or ae-cli config list");
85
- return;
86
- }
87
- await printOutput({ activeHost: current.url, label: current.label }, program.opts().format || "json", program.opts().jq);
88
- }
89
- async function useConfigEnv(program, env) {
90
- const target = resolveHost(env);
91
- if (target.status === "not-found") {
92
- failConfig(
93
- `No AE environment matched: ${env}`,
94
- target.hosts.length > 0 ? `Available environments: ${formatHostOptions(target.hosts)}` : "Run: ae-cli config list"
95
- );
96
- return;
97
- }
98
- if (target.status === "duplicate-label") {
99
- failConfig(
100
- `Duplicate label: ${env}`,
101
- `Rename duplicate labels first. Run: ae-cli config list \u2014 ${formatHostOptions(target.matches)}`
102
- );
103
- return;
104
- }
105
- setActiveHost(target.host.url);
106
- await printOutput({ activeHost: target.host.url, label: target.host.label }, program.opts().format || "json", program.opts().jq);
107
- }
108
- function resolveHost(env) {
109
- const raw = env.trim();
110
- const selector = raw.startsWith("http://") || raw.startsWith("https://") ? normalizeUrl(raw) : raw;
111
- const { hosts } = readHostViews();
112
- const byUrl = hosts.find((h) => h.url === selector);
113
- if (byUrl) return { status: "found", host: byUrl };
114
- const byLabel = hosts.filter((h) => h.label === raw);
115
- if (byLabel.length === 1) return { status: "found", host: byLabel[0] };
116
- if (byLabel.length > 1) return { status: "duplicate-label", matches: byLabel };
117
- return { status: "not-found", hosts };
118
- }
119
- function formatHostOptions(hosts) {
120
- return hosts.map((h) => `${h.label} (${h.url})`).join(", ");
121
- }
122
- function failConfig(message, hint) {
123
- printError("config", message, hint);
124
- process.exitCode = 1;
125
- }
126
- export {
127
- registerConfig
128
- };