@thinkingai/ae-cli 1.0.1 → 1.0.15

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 (259) hide show
  1. package/README.md +38 -64
  2. package/README.zh.md +203 -0
  3. package/dist/{auth-JXELJNDS.js → auth-4GAHTBVH.js} +2 -2
  4. package/dist/{auth-L3G3A74I.js → auth-U2GHFMFY.js} +20 -6
  5. package/dist/{chunk-OVQOK35G.js → chunk-EBFUVWIZ.js} +25 -6
  6. package/dist/{chunk-3GM5LJZR.js → chunk-OQ4XEG77.js} +7 -4
  7. package/dist/{chunk-JD5DXMKL.js → chunk-TJIMDNAU.js} +10 -8
  8. package/dist/{chunk-RJNLN3KQ.js → chunk-UK6HO5O5.js} +7 -6
  9. package/dist/{client-5QSQBBDB.js → client-HU63573O.js} +3 -3
  10. package/dist/{config-Q7J3Z7Z2.js → config-OLF7RBPM.js} +5 -5
  11. package/dist/index.js +18 -17
  12. package/dist/{raw-ZNVURYMR.js → raw-GDO4IWNW.js} +8 -6
  13. package/dist/{te-analysis-7NN3SY3I.js → te-analysis-ZDJXMWZY.js} +64 -26
  14. package/dist/{te-audience-P43BWMHM.js → te-audience-T5B52EEB.js} +65 -25
  15. package/dist/{te-common-H3IPTI2I.js → te-common-BPTXXTHQ.js} +11 -38
  16. package/dist/{community-GMALVSRF.js → te-community-FPB5LH56.js} +59 -59
  17. package/dist/{te-dataops-WCGDBJLF.js → te-dataops-2NUJVG47.js} +3 -28
  18. package/dist/{te-engage-UTRVNTGU.js → te-engage-K3EANZ5P.js} +502 -520
  19. package/dist/{te-meta-HGYNXVGF.js → te-meta-JJMV75KB.js} +88 -20
  20. package/package.json +9 -7
  21. package/skills/ae-analysis/SKILL.md +229 -0
  22. package/skills/{te-meta/references/batch-create-metadata.md → ae-analysis/references/batch_create_metadata.md} +5 -5
  23. package/skills/{te-meta/references/batch-edit-metadata.md → ae-analysis/references/batch_edit_metadata.md} +4 -4
  24. package/skills/{te-analysis/references/build-entity-details-sql.md → ae-analysis/references/build_entity_details_sql.md} +14 -14
  25. package/skills/{te-analysis/references/build-event-details-sql.md → ae-analysis/references/build_event_details_sql.md} +14 -14
  26. package/skills/{te-analysis/references/create-alert.md → ae-analysis/references/create_alert.md} +7 -7
  27. package/skills/{te-audience/references/create-cluster.md → ae-analysis/references/create_cluster.md} +26 -22
  28. package/skills/{te-analysis/references/create-dashboard.md → ae-analysis/references/create_dashboard.md} +5 -5
  29. package/skills/{te-meta/references/create-metric.md → ae-analysis/references/create_metric.md} +16 -16
  30. package/skills/{te-analysis/references/create-or-update-dashboard-note.md → ae-analysis/references/create_or_update_dashboard_note.md} +5 -5
  31. package/skills/{te-meta/references/create-project-mark-time.md → ae-analysis/references/create_project_mark_time.md} +5 -5
  32. package/skills/{te-analysis/references/create-public-access-link.md → ae-analysis/references/create_public_access_link.md} +5 -5
  33. package/skills/{te-analysis/references/create-report.md → ae-analysis/references/create_report.md} +14 -14
  34. package/skills/{te-analysis/references/create-result-cluster.md → ae-analysis/references/create_result_cluster.md} +8 -8
  35. package/skills/{te-audience/references/create-tag.md → ae-analysis/references/create_tag.md} +18 -17
  36. package/skills/{te-meta/references/create-virtual-event.md → ae-analysis/references/create_virtual_event.md} +14 -14
  37. package/skills/{te-meta/references/create-virtual-property.md → ae-analysis/references/create_virtual_property.md} +11 -11
  38. package/skills/{te-meta/references/delete-project-mark-times.md → ae-analysis/references/delete_project_mark_times.md} +4 -4
  39. package/skills/{te-meta/references/delete-track-items.md → ae-analysis/references/delete_track_items.md} +4 -4
  40. package/skills/{te-analysis/references/drilldown-user-events.md → ae-analysis/references/drilldown_user_events.md} +11 -11
  41. package/skills/{te-analysis/references/drilldown-users.md → ae-analysis/references/drilldown_users.md} +12 -9
  42. package/skills/ae-analysis/references/generate_track_program.md +51 -0
  43. package/skills/ae-analysis/references/generate_track_sdk_sample.md +43 -0
  44. package/skills/{te-analysis/references/get-alert.md → ae-analysis/references/get_alert.md} +4 -4
  45. package/skills/{te-analysis/references/get-alert-definition-schema.md → ae-analysis/references/get_alert_definition_schema.md} +4 -4
  46. package/skills/ae-analysis/references/get_analysis_query_schema.md +61 -0
  47. package/skills/ae-analysis/references/get_cluster_definition_schema.md +53 -0
  48. package/skills/ae-analysis/references/get_clusters_by_name.md +69 -0
  49. package/skills/{te-analysis/references/get-filter-schema.md → ae-analysis/references/get_filter_schema.md} +4 -4
  50. package/skills/{te-analysis/references/get-groupby-schema.md → ae-analysis/references/get_groupby_schema.md} +4 -4
  51. package/skills/{te-meta/references/get-metric.md → ae-analysis/references/get_metric.md} +4 -4
  52. package/skills/{te-meta/references/get-project-config.md → ae-analysis/references/get_project_config.md} +4 -4
  53. package/skills/{te-analysis/references/get-report-definition.md → ae-analysis/references/get_report_definition.md} +4 -4
  54. package/skills/{te-common/references/get-resource-url.md → ae-analysis/references/get_resource_url.md} +7 -7
  55. package/skills/{te-analysis/references/get-table-columns.md → ae-analysis/references/get_table_columns.md} +4 -4
  56. package/skills/ae-analysis/references/get_tag_definition_schema.md +49 -0
  57. package/skills/ae-analysis/references/get_tags_by_name.md +69 -0
  58. package/skills/{te-meta/references/get-track-program.md → ae-analysis/references/get_track_program.md} +4 -4
  59. package/skills/{te-analysis/references/list-alerts.md → ae-analysis/references/list_alerts.md} +8 -5
  60. package/skills/{te-audience/references/list-cluster-members.md → ae-analysis/references/list_cluster_members.md} +13 -6
  61. package/skills/{te-audience/references/list-clusters.md → ae-analysis/references/list_clusters.md} +12 -6
  62. package/skills/{te-analysis/references/list-dashboards.md → ae-analysis/references/list_dashboards.md} +10 -6
  63. package/skills/{te-meta/references/list-entities.md → ae-analysis/references/list_entities.md} +12 -5
  64. package/skills/{te-meta/references/list-events.md → ae-analysis/references/list_events.md} +10 -7
  65. package/skills/ae-analysis/references/list_metrics.md +41 -0
  66. package/skills/ae-analysis/references/list_project_mark_times.md +42 -0
  67. package/skills/{te-meta/references/list-project-users.md → ae-analysis/references/list_project_users.md} +4 -4
  68. package/skills/{te-common/references/list-projects.md → ae-analysis/references/list_projects.md} +9 -7
  69. package/skills/{te-meta/references/list-properties.md → ae-analysis/references/list_properties.md} +11 -6
  70. package/skills/ae-analysis/references/list_public_access_links.md +41 -0
  71. package/skills/{te-analysis/references/list-reports.md → ae-analysis/references/list_reports.md} +10 -6
  72. package/skills/{te-audience/references/list-tag-members.md → ae-analysis/references/list_tag_members.md} +13 -6
  73. package/skills/{te-audience/references/list-tags.md → ae-analysis/references/list_tags.md} +12 -6
  74. package/skills/{te-analysis/references/load-filters.md → ae-analysis/references/load_filters.md} +5 -5
  75. package/skills/{te-analysis/references/query-adhoc.md → ae-analysis/references/query_adhoc.md} +19 -14
  76. package/skills/{te-analysis/references/query-dashboard-detail.md → ae-analysis/references/query_dashboard_detail.md} +4 -4
  77. package/skills/{te-analysis/references/query-dashboard-report-data.md → ae-analysis/references/query_dashboard_report_data.md} +13 -13
  78. package/skills/{te-analysis/references/query-entity-details.md → ae-analysis/references/query_entity_details.md} +15 -15
  79. package/skills/{te-analysis/references/query-event-details.md → ae-analysis/references/query_event_details.md} +17 -17
  80. package/skills/{te-analysis/references/query-report-data.md → ae-analysis/references/query_report_data.md} +16 -16
  81. package/skills/{te-audience/references/refresh-cluster.md → ae-analysis/references/refresh_cluster.md} +4 -4
  82. package/skills/{te-audience/references/refresh-tag.md → ae-analysis/references/refresh_tag.md} +4 -4
  83. package/skills/{te-meta/references/save-track-items.md → ae-analysis/references/save_track_items.md} +4 -4
  84. package/skills/{te-analysis/references/update-alert.md → ae-analysis/references/update_alert.md} +7 -7
  85. package/skills/{te-audience/references/update-cluster.md → ae-analysis/references/update_cluster.md} +17 -15
  86. package/skills/{te-analysis/references/update-dashboard.md → ae-analysis/references/update_dashboard.md} +5 -5
  87. package/skills/{te-meta/references/update-metric.md → ae-analysis/references/update_metric.md} +14 -14
  88. package/skills/{te-meta/references/update-project-mark-time.md → ae-analysis/references/update_project_mark_time.md} +5 -5
  89. package/skills/{te-analysis/references/update-public-access-link.md → ae-analysis/references/update_public_access_link.md} +5 -5
  90. package/skills/{te-audience/references/update-tag.md → ae-analysis/references/update_tag.md} +17 -16
  91. package/skills/ae-community/SKILL.md +305 -0
  92. package/skills/ae-community/references/community-activity-analysis.md +67 -0
  93. package/skills/ae-community/references/community-analyzing-official-content.md +71 -0
  94. package/skills/ae-community/references/community-analyzing-theme-comment.md +123 -0
  95. package/skills/ae-community/references/community-character-analysis.md +70 -0
  96. package/skills/ae-community/references/community-daily-report.md +84 -0
  97. package/skills/ae-community/references/community-hottopic-insight.md +113 -0
  98. package/skills/ae-community/references/community-weekly-report.md +84 -0
  99. package/skills/ae-community/references/get_channel_info.md +20 -0
  100. package/skills/ae-community/references/get_comment_tag_analysis.md +29 -0
  101. package/skills/ae-community/references/get_comments_summary.md +32 -0
  102. package/skills/ae-community/references/get_corpus_tags.md +20 -0
  103. package/skills/ae-community/references/get_daily_summary.md +22 -0
  104. package/skills/ae-community/references/get_hot_topics.md +25 -0
  105. package/skills/ae-community/references/get_livestream_analysis.md +22 -0
  106. package/skills/ae-community/references/get_livestream_detail.md +33 -0
  107. package/skills/ae-community/references/get_livestream_list.md +25 -0
  108. package/skills/ae-community/references/get_livestream_overview.md +24 -0
  109. package/skills/ae-community/references/get_livestream_room_metrics.md +25 -0
  110. package/skills/ae-community/references/get_livestream_rooms.md +25 -0
  111. package/skills/ae-community/references/get_overview_metrics.md +25 -0
  112. package/skills/ae-community/references/get_post_detail.md +37 -0
  113. package/skills/ae-community/references/get_risk_content.md +42 -0
  114. package/skills/ae-community/references/get_sentiment_overview.md +33 -0
  115. package/skills/ae-community/references/get_tag_trends.md +27 -0
  116. package/skills/ae-community/references/get_topic_detail.md +26 -0
  117. package/skills/ae-community/references/search_posts.md +47 -0
  118. package/skills/ae-dataops/SKILL.md +706 -0
  119. package/skills/ae-dataops/references/dataops-flow-create.md +163 -0
  120. package/skills/ae-dataops/references/dataops-flow-monitor.md +118 -0
  121. package/skills/ae-dataops/references/dataops-integration.md +251 -0
  122. package/skills/ae-dataops/references/dataops-query.md +111 -0
  123. package/skills/ae-dataops/references/dataops-table.md +122 -0
  124. package/skills/ae-engage/SKILL.md +311 -0
  125. package/skills/ae-engage/references/add-approver.md +24 -0
  126. package/skills/ae-engage/references/add-channel.md +74 -0
  127. package/skills/ae-engage/references/approver-list.md +19 -0
  128. package/skills/ae-engage/references/cancel-query-by-request-id.md +23 -0
  129. package/skills/ae-engage/references/channel-detail.md +52 -0
  130. package/skills/ae-engage/references/channel-list.md +41 -0
  131. package/skills/ae-engage/references/config-channel-detail.md +32 -0
  132. package/skills/ae-engage/references/config-channel-list.md +27 -0
  133. package/skills/ae-engage/references/config-item-analysis-report.md +34 -0
  134. package/skills/ae-engage/references/config-item-detail.md +30 -0
  135. package/skills/ae-engage/references/config-item-list.md +19 -0
  136. package/skills/ae-engage/references/config-item-strategy-comparison.md +25 -0
  137. package/skills/ae-engage/references/config-item-trigger-report.md +42 -0
  138. package/skills/ae-engage/references/copy-config-template.md +29 -0
  139. package/skills/ae-engage/references/delete-channel.md +24 -0
  140. package/skills/ae-engage/references/delete-config-channel.md +24 -0
  141. package/skills/ae-engage/references/delete-config-item.md +25 -0
  142. package/skills/ae-engage/references/delete-flow.md +24 -0
  143. package/skills/ae-engage/references/flow-ab-split-node-report.md +54 -0
  144. package/skills/ae-engage/references/flow-detail.md +79 -0
  145. package/skills/ae-engage/references/flow-list.md +19 -0
  146. package/skills/ae-engage/references/flow-node-config-schema.md +44 -0
  147. package/skills/ae-engage/references/flow-node-detail-report.md +55 -0
  148. package/skills/ae-engage/references/flow-node-overview-report.md +52 -0
  149. package/skills/ae-engage/references/flow-process-report.md +59 -0
  150. package/skills/ae-engage/references/manage-flow.md +94 -0
  151. package/skills/ae-engage/references/manage-strategy.md +74 -0
  152. package/skills/ae-engage/references/manage-task.md +37 -0
  153. package/skills/ae-engage/references/modify-flow-base-info.md +27 -0
  154. package/skills/ae-engage/references/save-flow.md +871 -0
  155. package/skills/ae-engage/references/strategy-detail.md +73 -0
  156. package/skills/ae-engage/references/strategy-list.md +21 -0
  157. package/skills/ae-engage/references/task-data-detail.md +74 -0
  158. package/skills/ae-engage/references/task-data-overview.md +42 -0
  159. package/skills/ae-engage/references/task-detail.md +61 -0
  160. package/skills/ae-engage/references/task-experiment-report.md +45 -0
  161. package/skills/ae-engage/references/task-list.md +91 -0
  162. package/skills/ae-engage/references/task-metric-detail.md +50 -0
  163. package/skills/ae-engage/references/task-stats.md +89 -0
  164. package/skills/ae-engage/references/update-channel-status.md +32 -0
  165. package/skills/ae-engage/references/update-config-channel-status.md +32 -0
  166. package/skills/ae-engage/references/validate-flow-node-config.md +52 -0
  167. package/skills/ae-engage/references/whitelist-list.md +19 -0
  168. package/skills/te-analysis/SKILL.md +0 -107
  169. package/skills/te-analysis/references/get-analysis-query-schema.md +0 -36
  170. package/skills/te-analysis/references/list-public-access-links.md +0 -31
  171. package/skills/te-audience/SKILL.md +0 -63
  172. package/skills/te-audience/references/get-cluster-definition-schema.md +0 -37
  173. package/skills/te-audience/references/get-clusters-by-name.md +0 -32
  174. package/skills/te-audience/references/get-tag-definition-schema.md +0 -32
  175. package/skills/te-audience/references/get-tags-by-name.md +0 -32
  176. package/skills/te-common/SKILL.md +0 -135
  177. package/skills/te-community/SKILL.md +0 -133
  178. package/skills/te-community/references/community-activity-analysis.md +0 -68
  179. package/skills/te-community/references/community-analyzing-official-content.md +0 -72
  180. package/skills/te-community/references/community-analyzing-theme-comment.md +0 -124
  181. package/skills/te-community/references/community-character-analysis.md +0 -71
  182. package/skills/te-community/references/community-daily-report.md +0 -82
  183. package/skills/te-community/references/community-hottopic-insight.md +0 -120
  184. package/skills/te-community/references/community-release-analysis.md +0 -79
  185. package/skills/te-community/references/community-weekly-report.md +0 -84
  186. package/skills/te-community/references/get_channel_info.md +0 -21
  187. package/skills/te-community/references/get_comment_tag_analysis.md +0 -30
  188. package/skills/te-community/references/get_comments_summary.md +0 -33
  189. package/skills/te-community/references/get_corpus_tags.md +0 -21
  190. package/skills/te-community/references/get_daily_summary.md +0 -23
  191. package/skills/te-community/references/get_hot_topics.md +0 -26
  192. package/skills/te-community/references/get_livestream_analysis.md +0 -23
  193. package/skills/te-community/references/get_livestream_detail.md +0 -34
  194. package/skills/te-community/references/get_livestream_list.md +0 -26
  195. package/skills/te-community/references/get_livestream_overview.md +0 -25
  196. package/skills/te-community/references/get_livestream_room_metrics.md +0 -26
  197. package/skills/te-community/references/get_livestream_rooms.md +0 -26
  198. package/skills/te-community/references/get_overview_metrics.md +0 -26
  199. package/skills/te-community/references/get_post_detail.md +0 -38
  200. package/skills/te-community/references/get_risk_content.md +0 -43
  201. package/skills/te-community/references/get_sentiment_overview.md +0 -34
  202. package/skills/te-community/references/get_tag_trends.md +0 -28
  203. package/skills/te-community/references/get_topic_detail.md +0 -27
  204. package/skills/te-community/references/search_posts.md +0 -48
  205. package/skills/te-dataops/SKILL.md +0 -645
  206. package/skills/te-dataops/references/dataops-flow-create.md +0 -163
  207. package/skills/te-dataops/references/dataops-flow-monitor.md +0 -118
  208. package/skills/te-dataops/references/dataops-integration.md +0 -246
  209. package/skills/te-dataops/references/dataops-operations.md +0 -107
  210. package/skills/te-dataops/references/dataops-query.md +0 -111
  211. package/skills/te-dataops/references/dataops-table.md +0 -122
  212. package/skills/te-engage/SKILL.md +0 -211
  213. package/skills/te-engage/references/add-approver.md +0 -24
  214. package/skills/te-engage/references/add-channel.md +0 -74
  215. package/skills/te-engage/references/approver-list.md +0 -19
  216. package/skills/te-engage/references/cancel-query-by-request-id.md +0 -23
  217. package/skills/te-engage/references/channel-detail.md +0 -52
  218. package/skills/te-engage/references/channel-list.md +0 -41
  219. package/skills/te-engage/references/config-channel-detail.md +0 -32
  220. package/skills/te-engage/references/config-channel-list.md +0 -27
  221. package/skills/te-engage/references/config-item-analysis-report.md +0 -34
  222. package/skills/te-engage/references/config-item-detail.md +0 -30
  223. package/skills/te-engage/references/config-item-list.md +0 -19
  224. package/skills/te-engage/references/config-item-strategy-comparison.md +0 -25
  225. package/skills/te-engage/references/config-item-trigger-report.md +0 -42
  226. package/skills/te-engage/references/copy-config-template.md +0 -29
  227. package/skills/te-engage/references/delete-channel.md +0 -24
  228. package/skills/te-engage/references/delete-config-channel.md +0 -24
  229. package/skills/te-engage/references/delete-config-item.md +0 -25
  230. package/skills/te-engage/references/delete-flow.md +0 -24
  231. package/skills/te-engage/references/flow-ab-split-node-report.md +0 -54
  232. package/skills/te-engage/references/flow-detail.md +0 -79
  233. package/skills/te-engage/references/flow-list.md +0 -19
  234. package/skills/te-engage/references/flow-node-config-schema.md +0 -44
  235. package/skills/te-engage/references/flow-node-detail-report.md +0 -55
  236. package/skills/te-engage/references/flow-node-overview-report.md +0 -52
  237. package/skills/te-engage/references/flow-process-report.md +0 -59
  238. package/skills/te-engage/references/manage-flow.md +0 -94
  239. package/skills/te-engage/references/manage-strategy.md +0 -74
  240. package/skills/te-engage/references/manage-task.md +0 -37
  241. package/skills/te-engage/references/modify-flow-base-info.md +0 -27
  242. package/skills/te-engage/references/save-flow.md +0 -870
  243. package/skills/te-engage/references/strategy-detail.md +0 -73
  244. package/skills/te-engage/references/strategy-list.md +0 -21
  245. package/skills/te-engage/references/task-data-detail.md +0 -81
  246. package/skills/te-engage/references/task-data-overview.md +0 -48
  247. package/skills/te-engage/references/task-detail.md +0 -61
  248. package/skills/te-engage/references/task-experiment-report.md +0 -51
  249. package/skills/te-engage/references/task-list.md +0 -91
  250. package/skills/te-engage/references/task-metric-detail.md +0 -56
  251. package/skills/te-engage/references/task-stats.md +0 -89
  252. package/skills/te-engage/references/update-channel-status.md +0 -32
  253. package/skills/te-engage/references/update-config-channel-status.md +0 -32
  254. package/skills/te-engage/references/validate-flow-node-config.md +0 -52
  255. package/skills/te-engage/references/whitelist-list.md +0 -19
  256. package/skills/te-meta/SKILL.md +0 -71
  257. package/skills/te-meta/references/list-metrics.md +0 -33
  258. package/skills/te-meta/references/list-project-mark-times.md +0 -33
  259. package/skills/te-shared/SKILL.md +0 -115
package/README.md CHANGED
@@ -1,3 +1,6 @@
1
+
2
+ [中文版](./README.zh.md) | [English](./README.md)
3
+
1
4
  # ae-cli
2
5
 
3
6
  CLI tool for ThinkingAI AgenticEngine (AE) platform. Designed for both AI Agent and human use.
@@ -16,7 +19,7 @@ npm install -g @thinkingai/ae-cli
16
19
  npx skills add ThinkingAIAgenticEngine/ae-cli -g -y
17
20
  ```
18
21
 
19
- This installs 8 skill packages into your AI coding agent (Claude Code, Trae, Cursor, etc.), enabling the agent to understand and call ae-cli commands.
22
+ This installs 4 skill packages into your AI coding agent (Claude Code, Trae, Cursor, etc.), enabling the agent to understand and call ae-cli commands.
20
23
 
21
24
  To update:
22
25
 
@@ -33,11 +36,11 @@ ae-cli config
33
36
  ```
34
37
 
35
38
  The `config` command opens an interactive terminal UI:
36
- - First run: prompts you to add a TE host URL and label, then auto-authenticates
39
+ - First run: prompts you to add a AE host URL and label, then auto-authenticates
37
40
  - Subsequent runs: shows all configured hosts, lets you switch, edit, delete, or add new ones
38
41
 
39
42
  ```
40
- TE Host Manager (↑↓ select · Enter switch · e edit label · d delete · a add · q quit)
43
+ AE Host Manager (↑↓ select · Enter switch · e edit label · d delete · a add · q quit)
41
44
 
42
45
  ❯ ● Production https://ta.thinkingdata.cn ✓
43
46
  ○ Staging https://ta-staging.example.com:8080 ✗
@@ -49,16 +52,19 @@ After selecting a host, ae-cli automatically checks if the token is valid. If no
49
52
  ## Usage
50
53
 
51
54
  ```bash
52
- # TE meta domain (metadata and governance)
53
- ae-cli te_meta +list_events --project_id 1
55
+ # AE meta domain (metadata and governance)
56
+ ae-cli analysis_meta +list_events --project_id 1
54
57
 
55
58
  # Table output
56
- ae-cli te_meta +list_events --project_id 1 --format table
59
+ ae-cli analysis_meta +list_events --project_id 1 --format table
60
+
61
+ # Raw API call
62
+ ae-cli api GET /v1/ta/event/catalog/listEvent --params '{"projectId": 1}'
57
63
  ```
58
64
 
59
65
  ## Authentication
60
66
 
61
- Authentication is handled per-host. Each TE host URL maintains its own token.
67
+ Authentication is handled per-host. Each AE host URL maintains its own token.
62
68
 
63
69
  ```bash
64
70
  # Auto-login for active host (macOS, extracts token from Chrome)
@@ -80,20 +86,20 @@ ae-cli auth logout
80
86
 
81
87
  | Domain | Commands | Description |
82
88
  |--------|----------|-------------|
83
- | `te_analysis` | 31 | Analysis workflows: alerts, reports, dashboards, ad-hoc/drilldown, clusters/tags, metadata/metrics, project tools, entity details, analysis schema |
84
- | `te_audience` | 14 | Audience operations: clusters, tags, and cluster/tag definition schema |
85
- | `te_meta` | 20 | Metadata governance: events/properties, metrics, virtual metadata, project config, tracking plan, mark times, resource links |
86
- | `te_engage` | 40+ | Hermes Engage MCP: channels, tasks, configs, flows, strategies |
89
+ | `analysis` | 31 | Analysis workflows: alerts, reports, dashboards, ad-hoc/drilldown, clusters/tags, metadata/metrics, project tools, entity details, analysis schema |
90
+ | `analysis_audience` | 14 | Audience operations: clusters, tags, and cluster/tag definition schema |
91
+ | `analysis_meta` | 20 | Metadata governance: events/properties, metrics, virtual metadata, project config, tracking plan, mark times, resource links |
92
+ | `engage` | 40+ | Hermes Engage MCP: channels, tasks, configs, flows, strategies |
87
93
  | `te_dataops` | 50+ | Data warehouse management: repos, datatables, flows, IDE queries, integration, operations |
88
94
  | `te_community` | 30+ | Community analysis: posts search, sentiment analysis, topic trends, livestream data |
89
- | `te_common` | 2 | Cross-module common constraints: resource link completion, project ID gate |
95
+ | `analysis_common` | 2 | Cross-module common constraints: resource link completion, project ID gate |
90
96
  | `operation` | 11 | Tasks, flows, channels, space navigation |
91
97
 
92
98
  ### Global Options
93
99
 
94
100
  | Option | Description | Default |
95
101
  |--------|-------------|---------|
96
- | `--host <url>` | Override active TE host URL | from config |
102
+ | `--host <url>` | Override active AE host URL | from config |
97
103
  | `--format <json\|table>` | Output format | json |
98
104
  | `--jq <expr>` | Filter expression | - |
99
105
  | `--dry-run` | Preview request | false |
@@ -101,18 +107,14 @@ ae-cli auth logout
101
107
 
102
108
  ## Skills
103
109
 
104
- 8 AI Agent skill packages are included in the `skills/` directory:
110
+ 5 AI Agent skill packages are included in the `skills/` directory:
105
111
 
106
112
  | Skill | Description |
107
113
  |-------|-------------|
108
- | `te-shared` | Authentication, configuration, global options |
109
- | `te-analysis` | Alerts, reports, dashboards, ad-hoc/drilldown, entity details, analysis schema |
110
- | `te-audience` | Cluster and tag lifecycle management |
111
- | `te-meta` | Metadata governance, project config, tracking plan, and resource link operations |
112
- | `te-engage` | Hermes Engage MCP: channels, tasks, configs, flows, strategies |
113
- | `te-dataops` | Data warehouse management, task flows, IDE queries, integration, operations |
114
- | `te-community` | Community analysis: posts, comments, topics, livestreams |
115
- | `te-common` | Cross-module constraints: project ID gate, resource link completion |
114
+ | `ae-analysis` | Unified analysis skill: analysis + audience + metadata + common constraints (project gate/resource links) |
115
+ | `ae-engage` | Hermes Engage MCP: channels, tasks, configs, flows, strategies |
116
+ | `ae-dataops` | Data warehouse management, task flows, IDE queries, integration, operations |
117
+ | `ae-community` | Community analysis: posts, comments, topics, livestreams |
116
118
 
117
119
  Install them with:
118
120
 
@@ -122,32 +124,19 @@ npx skills add ThinkingAIAgenticEngine/ae-cli -g -y
122
124
 
123
125
  ## Skill Details
124
126
 
125
- ### te-analysis (31 tools)
127
+ ### ae-analysis (67 tools)
126
128
 
127
- Analysis query and visualization capabilities:
129
+ Unified AE analysis capabilities:
128
130
  - **Alerts**: view, create, update alert definitions
129
131
  - **Reports & Dashboards**: create, query, update reports and dashboards
130
132
  - **Model Analysis**: event analysis, retention analysis, funnel analysis, SQL analysis, user property analysis, distribution analysis, interval analysis, path analysis, attribution analysis
133
+ - **Audience**: cluster and tag lifecycle management, plus definition schema tools
134
+ - **Metadata Governance**: events/properties, metrics, virtual metadata, project config, tracking plans, mark times, entity catalog
135
+ - **Common Constraints**: mandatory project ID gate and post-write resource-link completion
131
136
  - **Entity/Event Details**: query details, generate analysis SQL
132
137
  - **Schema Helpers**: analysis query schema, filter schema, groupby schema
133
138
 
134
- ### te-audience (14 tools)
135
-
136
- Audience operations and targeting:
137
- - **Clusters**: create, update, query, member inspection, recomputation
138
- - **Tags**: create, update, query, member inspection, recomputation
139
- - **Schema Definitions**: cluster/tag definition schemas
140
-
141
- ### te-meta (20 tools)
142
-
143
- Metadata and tracking-plan governance:
144
- - **Metadata Governance**: events/properties, metrics, virtual metadata
145
- - **Project Configuration**: project config, project users
146
- - **Tracking Plans**: track program management
147
- - **Mark Times**: date markers management
148
- - **Entity Catalog**: entity listing
149
-
150
- ### te-engage (40+ tools)
139
+ ### engage (40+ tools)
151
140
 
152
141
  Hermes Engage MCP capabilities:
153
142
  - **Channels**: channel management, config channels, approval management
@@ -155,7 +144,7 @@ Hermes Engage MCP capabilities:
155
144
  - **Configs**: config items, strategies, strategy comparison, trigger/analysis reports
156
145
  - **Flows**: flow creation, node config, flow reports, flow validation
157
146
 
158
- ### te-dataops (50+ tools)
147
+ ### ae-dataops (50+ tools)
159
148
 
160
149
  Data warehouse management:
161
150
  - **Repo Management**: spaces, catalogs, schemas, members
@@ -165,7 +154,7 @@ Data warehouse management:
165
154
  - **Integration**: datasource management, sync solutions, data synchronization
166
155
  - **Operations**: flow instances, task instances, backfill jobs
167
156
 
168
- ### te-community (30+ tools)
157
+ ### ae-community (30+ tools)
169
158
 
170
159
  Community social media analysis:
171
160
  - **Posts**: search, detail, corpus tags
@@ -174,21 +163,6 @@ Community social media analysis:
174
163
  - **Livestreams**: rooms, sessions, analysis, metrics
175
164
  - **Advanced Analysis**: activity analysis, character analysis, weekly reports, release analysis
176
165
 
177
- ### te-common (2 tools)
178
-
179
- Cross-module common constraints:
180
- - **Project ID Gate**: mandatory project verification before execution
181
- - **Resource Link Completion**: post-write link generation for dashboards, reports, metrics, alerts, clusters, tags
182
-
183
- ## Development
184
-
185
- ```bash
186
- git clone https://github.com/ThinkingAIAgenticEngine/ae-cli.git
187
- cd ae-cli
188
- npm install
189
- npx tsx src/index.ts --help
190
- ```
191
-
192
166
  ## Architecture
193
167
 
194
168
  ae-cli is built with:
@@ -211,19 +185,19 @@ src/
211
185
  ├── te-meta/
212
186
  ├── te-engage/
213
187
  ├── te-dataops/
214
- ├── community/
188
+ ├── te-community/
215
189
  └── te-common/
216
190
  ```
217
191
 
218
192
  ## Verification Scripts
219
193
 
220
194
  ```bash
221
- npm run verify:te-analysis-tools
222
- npm run verify:te-audience-tools
223
- npm run verify:te-meta-tools
224
- npm run verify:te-common-tools
195
+ npm run verify:analysis-tools
196
+ npm run verify:analysis-audience-tools
197
+ npm run verify:analysis-meta-tools
198
+ npm run verify:analysis-common-tools
225
199
  ```
226
200
 
227
201
  ## License
228
202
 
229
- MIT
203
+ MIT
package/README.zh.md ADDED
@@ -0,0 +1,203 @@
1
+
2
+ [中文版](./README.zh.md) | [English](./README.md)
3
+
4
+ # ae-cli
5
+
6
+ ThinkingAI AgenticEngine (AE) 平台的 CLI 工具。专为 AI Agent 和人类用户设计。
7
+
8
+ ## 安装
9
+
10
+ **第一步:安装 ae-cli**
11
+
12
+ ```bash
13
+ npm install -g @thinkingai/ae-cli
14
+ ```
15
+
16
+ **第二步:安装 AI Agent Skills**
17
+
18
+ ```bash
19
+ npx skills add ThinkingAIAgenticEngine/ae-cli -g -y
20
+ ```
21
+
22
+ 这将安装 4 个技能包到您的 AI 编程助手(Claude Code、Trae、Cursor 等)中,使助手能够理解并调用 ae-cli 命令。
23
+
24
+ 更新方式:
25
+
26
+ ```bash
27
+ npm cache clean --force && npm install -g @thinkingai/ae-cli
28
+ npx skills add ThinkingAIAgenticEngine/ae-cli -g -y
29
+ ```
30
+
31
+ ## 快速开始
32
+
33
+ ```bash
34
+ # 首次运行 — 交互式主机配置 + 自动登录
35
+ ae-cli config
36
+ ```
37
+
38
+ `config` 命令会打开一个交互式终端界面:
39
+ - 首次运行:提示您添加 AE 主机 URL 和标签,然后自动进行身份验证
40
+ - 后续运行:显示所有已配置的主机,可以切换、编辑、删除或添加新主机
41
+
42
+ ```
43
+ AE Host Manager (↑↓ 选择 · Enter 切换 · e 编辑标签 · d 删除 · a 添加 · q 退出)
44
+
45
+ ❯ ● Production https://ta.thinkingdata.cn ✓
46
+ ○ Staging https://ta-staging.example.com:8080 ✗
47
+ + Add new host...
48
+ ```
49
+
50
+ 选择主机后,ae-cli 会自动检查 token 是否有效。如果无效,会自动触发 `auth login`。
51
+
52
+ ## 使用方法
53
+
54
+ ```bash
55
+ # AE 元数据域(元数据和治理)
56
+ ae-cli analysis_meta +list_events --project_id 1
57
+
58
+ # 表格输出
59
+ ae-cli analysis_meta +list_events --project_id 1 --format table
60
+
61
+ # 原始 API 调用
62
+ ae-cli api GET /v1/ta/event/catalog/listEvent --params '{"projectId": 1}'
63
+ ```
64
+
65
+ ## 身份验证
66
+
67
+ 每个 AE 主机 URL 维护独立的身份验证 token。
68
+
69
+ ```bash
70
+ # 自动登录当前主机(macOS,从 Chrome 提取 token)
71
+ ae-cli auth login
72
+
73
+ # 手动设置 token
74
+ ae-cli auth set-token <your-token>
75
+
76
+ # 检查状态
77
+ ae-cli auth status
78
+
79
+ # 登出
80
+ ae-cli auth logout
81
+ ```
82
+
83
+ ## 命令
84
+
85
+ ### 域
86
+
87
+ | 域 | 命令数 | 描述 |
88
+ |---|---|---|
89
+ | `analysis` | 31 | 分析工作流:告警、报表、仪表板、即时分析/下钻、分群/标签、元数据/指标、项目工具、实体详情、分析模型 |
90
+ | `analysis_audience` | 14 | 受众运营:分群、标签及其定义模型 |
91
+ | `analysis_meta` | 20 | 元数据治理:事件/属性、指标、虚拟元数据、项目配置、埋点方案、标记时间、资源链接 |
92
+ | `engage` | 40+ | Hermes Engage MCP:渠道、任务、配置、流程、策略 |
93
+ | `te_dataops` | 50+ | 数仓管理:仓库、数据表、任务流、IDE 查询、数据集成、运维管理 |
94
+ | `te_community` | 30+ | 社区分析:帖子搜索、情感分析、话题趋势、直播数据 |
95
+ | `analysis_common` | 2 | 跨模块通用约束:资源链接补全、项目 ID 门控 |
96
+ | `operation` | 11 | 任务、流程、渠道、空间导航 |
97
+
98
+ ### 全局选项
99
+
100
+ | 选项 | 描述 | 默认值 |
101
+ |---|---|---|
102
+ | `--host <url>` | 覆盖当前 AE 主机 URL | 从配置读取 |
103
+ | `--format <json\|table>` | 输出格式 | json |
104
+ | `--jq <expr>` | 过滤表达式 | - |
105
+ | `--dry-run` | 预览请求 | false |
106
+ | `--yes` | 跳过确认 | false |
107
+
108
+ ## Skills
109
+
110
+ `skills/` 目录包含 4 个 AI Agent 技能包:
111
+
112
+ | Skill | 描述 |
113
+ |---|---|
114
+ | `ae-analysis` | 统一分析技能:analysis + audience + metadata + 通用约束(项目门控/资源链接) |
115
+ | `ae-engage` | Hermes Engage MCP:渠道、任务、配置、流程、策略 |
116
+ | `ae-dataops` | 数仓管理、任务流、IDE 查询、数据集成、运维管理 |
117
+ | `ae-community` | 社区分析:帖子、评论、话题、直播 |
118
+
119
+ 安装方式:
120
+
121
+ ```bash
122
+ npx skills add ThinkingAIAgenticEngine/ae-cli -g -y
123
+ ```
124
+
125
+ ## Skill 详情
126
+
127
+ ### ae-analysis(67 个工具)
128
+
129
+ 统一的 AE 分析能力:
130
+ - **告警**:查看、创建、更新告警定义
131
+ - **报表和仪表板**:创建、查询、更新报表和仪表板
132
+ - **模型分析**:事件分析、留存分析、漏斗分析、SQL 分析、用户属性分析、分布分析、间隔分析、路径分析、归因分析
133
+ - **受众**:分群和标签生命周期管理,以及定义模型工具
134
+ - **元数据治理**:事件/属性、指标、虚拟元数据、项目配置、埋点方案、标记时间、实体目录
135
+ - **通用约束**:强制的项目 ID 门控和写入后资源链接补全
136
+ - **实体/事件详情**:查询详情、生成分析 SQL
137
+ - **模型辅助**:分析查询模型、过滤模型、分组模型
138
+
139
+ ### engage(40+ 个工具)
140
+
141
+ Hermes Engage MCP 能力:
142
+ - **渠道**:渠道管理、配置渠道、审批管理
143
+ - **任务**:任务列表、任务详情、任务数据/指标概览、实验报告
144
+ - **配置**:配置项、策略、策略对比、触发/分析报告
145
+ - **流程**:流程创建、节点配置、流程报告、流程验证
146
+
147
+ ### ae-dataops(50+ 个工具)
148
+
149
+ 数仓管理:
150
+ - **仓库管理**:空间、目录、模式、成员
151
+ - **数据表**:表创建、视图、批量操作、数据字典
152
+ - **任务流**:流程创建、任务节点、调度、执行、监控
153
+ - **IDE 查询**:元数据浏览、SQL 执行、查询管理
154
+ - **数据集成**:数据源管理、同步方案、数据同步
155
+ - **运维管理**:流程实例、任务实例、补数据任务
156
+
157
+ ### ae-community(30+ 个工具)
158
+
159
+ 社区社媒分析:
160
+ - **帖子**:搜索、详情、语料标签
161
+ - **评论**:情感分析、标签分析、摘要
162
+ - **话题**:热门话题、趋势、每日摘要
163
+ - **直播**:直播间、场次、分析、指标
164
+ - **高级分析**:活动分析、角色分析、周报、发布分析
165
+
166
+ ## 架构
167
+
168
+ ae-cli 基于:
169
+ - **TypeScript**(约 8000 行代码)
170
+ - **Commander.js** 作为 CLI 框架
171
+ - **WebSocket** 用于 MCP 服务器集成
172
+ - **Node.js** 运行时(v18+)
173
+
174
+ 项目结构:
175
+ ```
176
+ src/
177
+ ├── core/ # 核心模块:auth, config, client, mcp
178
+ ├── framework/ # 框架:types, register, runner, output
179
+ ├── api/ # 原始 API 访问
180
+ └── commands/ # 领域特定命令
181
+ ├── auth.ts
182
+ ├── config.ts
183
+ ├── te-analysis/
184
+ ├── te-audience/
185
+ ├── te-meta/
186
+ ├── te-engage/
187
+ ├── te-dataops/
188
+ ├── te-community/
189
+ └── te-common/
190
+ ```
191
+
192
+ ## 验证脚本
193
+
194
+ ```bash
195
+ npm run verify:analysis-tools
196
+ npm run verify:analysis-audience-tools
197
+ npm run verify:analysis-meta-tools
198
+ npm run verify:analysis-common-tools
199
+ ```
200
+
201
+ ## 许可证
202
+
203
+ MIT
@@ -6,8 +6,8 @@ import {
6
6
  resolveHost,
7
7
  saveToken,
8
8
  setTokenManual
9
- } from "./chunk-RJNLN3KQ.js";
10
- import "./chunk-OVQOK35G.js";
9
+ } from "./chunk-UK6HO5O5.js";
10
+ import "./chunk-EBFUVWIZ.js";
11
11
  export {
12
12
  clearToken,
13
13
  getAuthStatus,
@@ -8,16 +8,19 @@ import {
8
8
  getToken,
9
9
  resolveHost,
10
10
  setTokenManual
11
- } from "./chunk-RJNLN3KQ.js";
12
- import "./chunk-OVQOK35G.js";
11
+ } from "./chunk-UK6HO5O5.js";
12
+ import {
13
+ loadConfig,
14
+ saveConfig
15
+ } from "./chunk-EBFUVWIZ.js";
13
16
 
14
17
  // src/commands/auth.ts
15
18
  function registerAuth(program) {
16
19
  const auth = program.command("auth").description("Authentication management");
17
- auth.command("login").description("Login to TE (auto-extract token from Chrome on macOS)").action(async () => {
20
+ auth.command("login").description("Login to AE (auto-extract token from Chrome on macOS)").action(async () => {
18
21
  const host = resolveHost(program.opts().host);
19
22
  if (!host) {
20
- printError("config", "No TE host configured.", "Run: ae-cli config set-host");
23
+ printError("config", "No AE host configured.", "Run: ae-cli config set-host");
21
24
  process.exit(1);
22
25
  }
23
26
  try {
@@ -33,9 +36,20 @@ function registerAuth(program) {
33
36
  auth.command("set-token <token>").description("Manually set authentication token for active host").action((token) => {
34
37
  const host = resolveHost(program.opts().host);
35
38
  if (!host) {
36
- printError("config", "No TE host configured.", "Run: ae-cli config set-host");
39
+ printError("config", "No AE host configured.", "Run: ae-cli config set-host");
37
40
  process.exit(1);
38
41
  }
42
+ const config = loadConfig();
43
+ if (!config.hosts[host]) {
44
+ config.hosts[host] = { label: host };
45
+ if (!config.activeHost) {
46
+ config.activeHost = host;
47
+ }
48
+ saveConfig(config);
49
+ process.stderr.write(`[ae-cli] Config saved for ${host}
50
+ `);
51
+ printOutput({ saved: true, config }, program.opts().format || "json");
52
+ }
39
53
  setTokenManual(token, host);
40
54
  process.stderr.write(`[ae-cli] Token saved for ${host}
41
55
  `);
@@ -53,7 +67,7 @@ function registerAuth(program) {
53
67
  auth.command("logout").description("Clear stored token for active host").action(() => {
54
68
  const host = resolveHost(program.opts().host);
55
69
  if (!host) {
56
- printError("config", "No TE host configured.", "Run: ae-cli config set-host");
70
+ printError("config", "No AE host configured.", "Run: ae-cli config set-host");
57
71
  process.exit(1);
58
72
  }
59
73
  clearToken(host);
@@ -1,15 +1,29 @@
1
- // src/core/config.ts
1
+ // src/core/json-utils.ts
2
2
  import fs from "fs";
3
+ import { createRequire } from "module";
4
+ var require2 = createRequire(import.meta.url);
5
+ var JSONbig = require2("json-bigint");
6
+ var jsonParser = JSONbig({ storeAsString: true });
7
+ function safeJsonParse(text) {
8
+ return jsonParser.parse(text);
9
+ }
10
+ function safeReadJsonFile(filePath) {
11
+ const content = fs.readFileSync(filePath, "utf-8");
12
+ return safeJsonParse(content);
13
+ }
14
+
15
+ // src/core/config.ts
16
+ import fs2 from "fs";
3
17
  import path from "path";
4
18
  var CONFIG_DIR = path.join(process.env.HOME || "", ".ae-cli");
5
19
  var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
6
20
  function ensureDir() {
7
- if (!fs.existsSync(CONFIG_DIR)) fs.mkdirSync(CONFIG_DIR, { recursive: true });
21
+ if (!fs2.existsSync(CONFIG_DIR)) fs2.mkdirSync(CONFIG_DIR, { recursive: true });
8
22
  }
9
23
  function loadConfig() {
10
24
  try {
11
- if (fs.existsSync(CONFIG_FILE)) {
12
- const raw = JSON.parse(fs.readFileSync(CONFIG_FILE, "utf-8"));
25
+ if (fs2.existsSync(CONFIG_FILE)) {
26
+ const raw = safeReadJsonFile(CONFIG_FILE);
13
27
  if (raw.defaultHost && !raw.activeHost) {
14
28
  const migrated = migrateConfig(raw);
15
29
  saveConfig(migrated);
@@ -17,7 +31,8 @@ function loadConfig() {
17
31
  }
18
32
  return raw;
19
33
  }
20
- } catch {
34
+ } catch (err) {
35
+ console.error(`Error loading config: ${err.message}`);
21
36
  }
22
37
  return { activeHost: "", hosts: {} };
23
38
  }
@@ -38,7 +53,7 @@ function migrateConfig(old) {
38
53
  }
39
54
  function saveConfig(config) {
40
55
  ensureDir();
41
- fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
56
+ fs2.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
42
57
  }
43
58
  function getActiveHost() {
44
59
  const config = loadConfig();
@@ -97,6 +112,10 @@ function extractHostname(fullUrl) {
97
112
  }
98
113
 
99
114
  export {
115
+ safeJsonParse,
116
+ safeReadJsonFile,
117
+ loadConfig,
118
+ saveConfig,
100
119
  getActiveHost,
101
120
  setActiveHost,
102
121
  addHost,
@@ -2,7 +2,10 @@ import {
2
2
  clearToken,
3
3
  getToken,
4
4
  resolveHost
5
- } from "./chunk-RJNLN3KQ.js";
5
+ } from "./chunk-UK6HO5O5.js";
6
+ import {
7
+ safeJsonParse
8
+ } from "./chunk-EBFUVWIZ.js";
6
9
 
7
10
  // src/core/client.ts
8
11
  import WebSocket from "ws";
@@ -40,13 +43,13 @@ async function request(method, modulePath, params = {}, body = null, retry = tru
40
43
  clearToken(resolvedHost);
41
44
  return request(method, modulePath, params, body, false, resolvedHost);
42
45
  }
43
- const data = await resp.json();
46
+ const data = safeJsonParse(await resp.text());
44
47
  if (data.return_code === -1001 && retry) {
45
48
  clearToken(resolvedHost);
46
49
  return request(method, modulePath, params, body, false, resolvedHost);
47
50
  }
48
51
  if (data.return_code !== 0 && data.return_code !== void 0) {
49
- throw new Error(`TE API error: ${data.return_message || "unknown"} (code: ${data.return_code})`);
52
+ throw new Error(`AE API error: ${data.return_message || "unknown"} (code: ${data.return_code})`);
50
53
  }
51
54
  return data.data !== void 0 ? data.data : data;
52
55
  }
@@ -79,7 +82,7 @@ async function wsQueryOnce(projectId, requestId, qp, eventModel, options = {}, t
79
82
  });
80
83
  ws.on("message", (raw) => {
81
84
  try {
82
- const msg = JSON.parse(raw.toString());
85
+ const msg = safeJsonParse(raw.toString());
83
86
  if (Array.isArray(msg) && msg.length >= 2) {
84
87
  const data = msg[1];
85
88
  if (data.requestId === requestId && data.progress === 100) {
@@ -1,10 +1,12 @@
1
1
  import {
2
2
  getToken
3
- } from "./chunk-RJNLN3KQ.js";
3
+ } from "./chunk-UK6HO5O5.js";
4
4
  import {
5
5
  getActiveHost,
6
- getConfigDir
7
- } from "./chunk-OVQOK35G.js";
6
+ getConfigDir,
7
+ safeJsonParse,
8
+ safeReadJsonFile
9
+ } from "./chunk-EBFUVWIZ.js";
8
10
 
9
11
  // src/core/mcp.ts
10
12
  import fs from "fs";
@@ -12,7 +14,7 @@ import path from "path";
12
14
  var MCP_PROTOCOL_VERSION = "2025-11-25";
13
15
  var JSONRPC_VERSION = "2.0";
14
16
  var serviceMappingMap = /* @__PURE__ */ new Map();
15
- registerMcpMapping("te_analysis", {
17
+ registerMcpMapping("analysis", {
16
18
  componentName: "analysis",
17
19
  mappingPath: "analysis"
18
20
  });
@@ -55,7 +57,7 @@ var MCP_TOKEN_GENERATE_PATH = "/v1/ta/mcp/token/generate";
55
57
  function loadMcpTokenStore() {
56
58
  try {
57
59
  if (fs.existsSync(MCP_TOKEN_FILE)) {
58
- return JSON.parse(fs.readFileSync(MCP_TOKEN_FILE, "utf-8"));
60
+ return safeReadJsonFile(MCP_TOKEN_FILE);
59
61
  }
60
62
  } catch {
61
63
  }
@@ -79,7 +81,7 @@ async function generateMcpToken(hostUrl) {
79
81
  if (!resp.ok) {
80
82
  throw new Error(`MCP token generate HTTP error: ${resp.status} ${resp.statusText}`);
81
83
  }
82
- const data = await resp.json();
84
+ const data = safeJsonParse(await resp.text());
83
85
  if (data.return_code !== 0) {
84
86
  throw new Error(`MCP token generate error: ${data.return_message || "unknown"} (code: ${data.return_code})`);
85
87
  }
@@ -127,7 +129,7 @@ async function mcpRequest(url, method, params = {}, hostOverride) {
127
129
  if (!resp.ok) {
128
130
  throw new Error(`MCP HTTP error: ${resp.status} ${resp.statusText}`);
129
131
  }
130
- const data = await resp.json();
132
+ const data = safeJsonParse(await resp.text());
131
133
  if (data.error) {
132
134
  throw new Error(`MCP error: ${data.error.message || JSON.stringify(data.error)}`);
133
135
  }
@@ -156,7 +158,7 @@ function parseMcpResult(result) {
156
158
  if (result.content.length > 0 && result.content[0].type === "text") {
157
159
  const text = result.content[0].text || "";
158
160
  try {
159
- return JSON.parse(text);
161
+ return safeJsonParse(text);
160
162
  } catch {
161
163
  return text;
162
164
  }
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  extractHostname,
3
3
  getActiveHost,
4
- getConfigDir
5
- } from "./chunk-OVQOK35G.js";
4
+ getConfigDir,
5
+ safeReadJsonFile
6
+ } from "./chunk-EBFUVWIZ.js";
6
7
 
7
8
  // src/core/auth.ts
8
9
  import fs from "fs";
@@ -25,7 +26,7 @@ function loadAllTokens() {
25
26
  try {
26
27
  const legacyTokens = path.join(LEGACY_DIR, "tokens.json");
27
28
  if (fs.existsSync(legacyTokens) && !fs.existsSync(TOKENS_FILE)) {
28
- const data = JSON.parse(fs.readFileSync(legacyTokens, "utf-8"));
29
+ const data = safeReadJsonFile(legacyTokens);
29
30
  const migrated = {};
30
31
  for (const [key, val] of Object.entries(data)) {
31
32
  const url = key.startsWith("http") ? key : `https://${key}`;
@@ -36,7 +37,7 @@ function loadAllTokens() {
36
37
  return migrated;
37
38
  }
38
39
  if (fs.existsSync(TOKENS_FILE)) {
39
- const data = JSON.parse(fs.readFileSync(TOKENS_FILE, "utf-8"));
40
+ const data = safeReadJsonFile(TOKENS_FILE);
40
41
  let needsMigration = false;
41
42
  const migrated = {};
42
43
  for (const [key, val] of Object.entries(data)) {
@@ -129,7 +130,7 @@ function extractTokenViaOsascript(hostUrl) {
129
130
  }
130
131
  }
131
132
  async function requestTokenViaOsascript(hostUrl) {
132
- process.stderr.write(`[ae-cli] No TE tab found in Chrome. Opening ${hostUrl} ...
133
+ process.stderr.write(`[ae-cli] No AE tab found in Chrome. Opening ${hostUrl} ...
133
134
  `);
134
135
  process.stderr.write(`[ae-cli] Please login, then your token will be captured automatically.
135
136
  `);
@@ -167,7 +168,7 @@ async function requestTokenViaOsascript(hostUrl) {
167
168
  async function getToken(hostUrl) {
168
169
  if (!hostUrl) {
169
170
  throw new Error(
170
- `No TE host configured.
171
+ `No AE host configured.
171
172
  Run: ae-cli config set-host`
172
173
  );
173
174
  }