@thinkingai/ae-cli 6.0.18 → 6.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +8 -10
  2. package/README.zh.md +9 -11
  3. package/dist/{auth-DYC2BGLM.js → auth-I2G7OAU2.js} +2 -4
  4. package/dist/{auth-GHBMJ5ZR.js → auth-RDN6D5HU.js} +32 -104
  5. package/dist/{chunk-5OC7CYCG.js → chunk-2W7HULUD.js} +14 -14
  6. package/dist/chunk-4EUZRJPO.js +163 -0
  7. package/dist/{chunk-DMMEPCST.js → chunk-5FBLRSMU.js} +25 -115
  8. package/dist/{chunk-BJX3GXWC.js → chunk-E34XH4GW.js} +2 -2
  9. package/dist/chunk-FPE5LGVU.js +105 -0
  10. package/dist/{chunk-I5CRVM2S.js → chunk-H52CSLJW.js} +44 -17
  11. package/dist/{chunk-RSHMZ3LG.js → chunk-U6QPKCN3.js} +6 -20
  12. package/dist/{chunk-6W4QOZAL.js → chunk-WPXHCP4A.js} +23 -13
  13. package/dist/{chunk-PN3OS34E.js → chunk-XE2PI5DS.js} +1 -1
  14. package/dist/{chunk-2DUEAXV3.js → chunk-YACCPUNQ.js} +1 -1
  15. package/dist/cli-token-6AGEDJF4.js +14 -0
  16. package/dist/{client-2UJ63MVQ.js → client-VTJMUZ4O.js} +3 -3
  17. package/dist/{config-NCUGK6NS.js → config-2SDTLGOC.js} +3 -3
  18. package/dist/index.js +314 -197
  19. package/dist/metadata-JZ2OTWBK.js +420 -0
  20. package/dist/{model-SJSOZTRS.js → model-ZYMRN4VS.js} +2 -2
  21. package/dist/{raw-7NVWSVJP.js → raw-NGYHAL3F.js} +4 -4
  22. package/dist/{sync-GRVO4K3U.js → sync-JVLX6TGW.js} +3 -3
  23. package/dist/{te-agent-KZRIEN4N.js → te-agent-QPZTLHPH.js} +545 -21
  24. package/dist/{te-analysis-VAR4KUOK.js → te-analysis-WWX3Z6RP.js} +352 -52
  25. package/dist/te-audience-UXGHUVBB.js +599 -0
  26. package/dist/{te-common-WNCZB7R7.js → te-common-7XXH73MF.js} +5 -4
  27. package/dist/{te-community-JEEFXPB3.js → te-community-QKE67HR2.js} +5 -4
  28. package/dist/te-dataops-6W7NNYST.js +1841 -0
  29. package/dist/{te-engage-4XHCTS6I.js → te-engage-NCFAQFX3.js} +5 -4
  30. package/dist/{te-kb-B62KFP2A.js → te-kb-K5BQYUCM.js} +50 -26
  31. package/dist/{te-meta-EPZGQN56.js → te-meta-LJZBOSMO.js} +48 -24
  32. package/dist/{te-team-YY24VORI.js → te-team-DHK5R7MV.js} +5 -6
  33. package/package.json +3 -2
  34. package/skills/ae-agent/SKILL.md +103 -4
  35. package/skills/ae-analysis/SKILL.md +75 -21
  36. package/skills/ae-analysis/references/build_attribution_analysis_qp.md +62 -0
  37. package/skills/ae-analysis/references/build_cluster_definition.md +62 -0
  38. package/skills/ae-analysis/references/build_distribution_analysis_qp.md +67 -0
  39. package/skills/ae-analysis/references/build_event_analysis_qp.md +2 -0
  40. package/skills/ae-analysis/references/build_funnel_analysis_qp.md +2 -0
  41. package/skills/ae-analysis/references/build_heat_map_analysis_qp.md +54 -0
  42. package/skills/ae-analysis/references/build_interval_analysis_qp.md +60 -0
  43. package/skills/ae-analysis/references/build_path_analysis_qp.md +53 -0
  44. package/skills/ae-analysis/references/build_prop_analysis_qp.md +2 -0
  45. package/skills/ae-analysis/references/build_rank_list_analysis_qp.md +63 -0
  46. package/skills/ae-analysis/references/build_retention_analysis_qp.md +2 -0
  47. package/skills/ae-analysis/references/build_tag_definition.md +65 -0
  48. package/skills/ae-analysis/references/cancel_query.md +2 -3
  49. package/skills/ae-analysis/references/copy_dashboard.md +33 -0
  50. package/skills/ae-analysis/references/create_id_cluster.md +40 -0
  51. package/skills/ae-analysis/references/create_id_tag.md +39 -0
  52. package/skills/ae-analysis/references/delete_alert.md +27 -0
  53. package/skills/ae-analysis/references/delete_cluster.md +27 -0
  54. package/skills/ae-analysis/references/delete_dashboard.md +30 -0
  55. package/skills/ae-analysis/references/delete_metric.md +27 -0
  56. package/skills/ae-analysis/references/delete_report.md +27 -0
  57. package/skills/ae-analysis/references/delete_tag.md +27 -0
  58. package/skills/ae-analysis/references/drilldown_user_events.md +4 -4
  59. package/skills/ae-analysis/references/drilldown_users.md +3 -3
  60. package/skills/ae-analysis/references/freeze_dashboards.md +29 -0
  61. package/skills/ae-analysis/references/get_table_columns.md +11 -12
  62. package/skills/ae-analysis/references/list_cluster_members.md +4 -4
  63. package/skills/ae-analysis/references/list_clusters.md +5 -3
  64. package/skills/ae-analysis/references/list_dashboards.md +3 -3
  65. package/skills/ae-analysis/references/list_entities.md +1 -1
  66. package/skills/ae-analysis/references/list_events.md +7 -4
  67. package/skills/ae-analysis/references/list_metrics.md +5 -3
  68. package/skills/ae-analysis/references/list_properties.md +6 -4
  69. package/skills/ae-analysis/references/list_reports.md +3 -3
  70. package/skills/ae-analysis/references/list_spaces.md +27 -0
  71. package/skills/ae-analysis/references/list_tag_members.md +4 -4
  72. package/skills/ae-analysis/references/list_tags.md +4 -2
  73. package/skills/ae-analysis/references/move_dashboard.md +33 -0
  74. package/skills/ae-analysis/references/query_adhoc.md +2 -2
  75. package/skills/ae-analysis/references/query_bi_panel_data.md +2 -2
  76. package/skills/ae-analysis/references/query_dashboard_report_data.md +4 -4
  77. package/skills/ae-analysis/references/query_entity_details.md +4 -4
  78. package/skills/ae-analysis/references/query_event_details.md +3 -3
  79. package/skills/ae-analysis/references/query_report_data.md +37 -3
  80. package/skills/ae-analysis/references/update_id_cluster.md +36 -0
  81. package/skills/ae-analysis/references/update_id_tag.md +37 -0
  82. package/skills/ae-analysis/references/update_report.md +35 -0
  83. package/skills/ae-analysis-intent/SKILL.md +1 -1
  84. package/skills/ae-dataops/SKILL.md +54 -522
  85. package/skills/ae-dataops/references/dataops-flow-create.md +78 -75
  86. package/skills/ae-dataops/references/dataops-flow-monitor.md +58 -51
  87. package/skills/ae-dataops/references/dataops-integration.md +80 -41
  88. package/skills/ae-dataops/references/dataops-query.md +54 -53
  89. package/skills/ae-dataops/references/dataops-table.md +28 -59
  90. package/skills/ae-generate-tracking-code/SKILL.md +68 -31
  91. package/skills/ae-generate-tracking-code/references/snippet-delivery.md +26 -1
  92. package/skills/ae-generate-tracking-code/references/te-api.md +47 -164
  93. package/skills/ae-generate-tracking-plan/SKILL.md +109 -32
  94. package/skills/ae-generate-tracking-plan/references/te-api.md +57 -27
  95. package/skills/ae-metadata/SKILL.md +90 -0
  96. package/skills/ae-metadata/references/metadata_data_table_csv_delete.md +15 -0
  97. package/skills/ae-metadata/references/metadata_data_table_csv_write.md +29 -0
  98. package/skills/ae-metadata/references/metadata_data_table_download.md +17 -0
  99. package/skills/ae-metadata/references/metadata_data_table_get.md +24 -0
  100. package/skills/ae-metadata/references/metadata_data_table_list.md +27 -0
  101. package/skills/ae-metadata/references/metadata_data_table_property_bindings_update.md +17 -0
  102. package/skills/ae-metadata/references/metadata_data_table_sql_delete.md +15 -0
  103. package/skills/ae-metadata/references/metadata_data_table_sql_write.md +31 -0
  104. package/skills/ae-metadata/references/metadata_event_get.md +52 -0
  105. package/skills/ae-metadata/references/metadata_input_file_upload.md +29 -0
  106. package/skills/ae-metadata/references/metadata_property_dimension_table_bind_existing.md +27 -0
  107. package/skills/ae-metadata/references/metadata_property_dimension_table_create_and_bind_csv.md +30 -0
  108. package/skills/ae-metadata/references/metadata_property_get.md +54 -0
  109. package/dist/te-audience-KMKYI2YJ.js +0 -400
  110. package/dist/te-dataops-GD3XBYCS.js +0 -1830
@@ -58,14 +58,14 @@ First, check if `.ae-cli/draft.json` exists and read existing configuration:
58
58
  |---|---|---|
59
59
  | AE projectId | `meta.project_id` | Has value → confirm; missing → ask |
60
60
  | AE web address | `meta.host` | Has value → confirm; missing → ask |
61
- | **SERVER_URL** | `meta.server_url` | **Must ask**. Data ingestion endpoint different from web address |
62
- | **APP_ID** | `meta.app_id` | **Must ask**. Obtained from AE Admin "Integration Config" |
61
+ | **SERVER_URL** | `meta.server_url` | Has value confirm; missing try lookup from project config, then ask if unavailable |
62
+ | **APP_ID** | `meta.app_id` | Has value confirm; missing → try lookup from accessible project list, then ask if unavailable |
63
63
  | SDK integration mode | `meta.sdk_integration_mode` | Has value → use directly |
64
64
  | Client SDK type | `meta.client_platforms` (preferred) or `meta.client_sdk_type` | Has value → use directly |
65
65
  | Server language | `meta.server_language` | Has value → use directly |
66
66
  | User identity system | `meta.user_identity` | Has value → use directly |
67
67
 
68
- **Important**: `project_id` ≠ `APP_ID`, and `host` ≠ `SERVER_URL`. Even if project_id and host are already set, SERVER_URL and APP_ID must still be asked separately.
68
+ **Important**: `project_id` ≠ `APP_ID`, and `host` ≠ `SERVER_URL`. Even if project_id and host are already set, SERVER_URL and APP_ID must still be resolved and confirmed separately. Prefer lookup first; ask the user only when lookup is unavailable or ambiguous.
69
69
 
70
70
  **Multi-platform support**:
71
71
  - If `client_platforms` exists (array): multi-platform scenario — generate code for each platform
@@ -86,14 +86,21 @@ First, check if `.ae-cli/draft.json` exists and read existing configuration:
86
86
  - User says `yes` → use draft value
87
87
  - User enters new value → update draft.json and use new value
88
88
 
89
- ### Required configuration (must confirm each item)
89
+ ### Required configuration (must resolve and confirm each item)
90
90
 
91
- **⚠️ Key: SERVER_URL and APP_ID are independent config items. Even if draft.json has project_id and host, you MUST ask. `project_id` ≠ `APP_ID`, `host` ≠ `SERVER_URL`.**
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
- 1. **SERVER_URL** — Data ingestion endpoint (**different from web URL**; go to AE Admin → "Project Settings" → "Integration Config" → fill in "Public URL")
93
+ 1. **APP_ID** — Prefer automatic lookup before asking:
94
+ - If `meta.project_id` is known, run `ae-cli analysis_common +list_projects` once for the current host.
95
+ - Find the project whose `projectId` matches `meta.project_id`.
96
+ - If the matched project has `appId`, ask: **"I found APP_ID `<appId>` for project `<projectId>`. Use it? yes / enter new value"**
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
+ 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_meta +get_project_config --project_id <project_id>` once.
100
+ - Use the returned value only if the response explicitly contains a receiver URL field such as `serverUrl`, `pushUrl`, `push_url`, `receiverUrl`, `publicUrl`, or equivalent ingestion endpoint field.
101
+ - If a value is found, ask: **"I found SERVER_URL `<url>` for project `<projectId>`. Use it? yes / enter new value"**
94
102
  - ⚠️ "Public URL" only shows if previously filled in; if empty, this field won't display
95
103
  - Solution: ask ops for the URL, or **skip this step** (use `SERVER_URL` or `PUSH_URL` placeholder in code)
96
- 2. **APP_ID** — Go to AE Admin → "Project Settings" → "Integration Config" → copy "APP_ID"
97
104
 
98
105
  **host handling** (optional):
99
106
  - If you need to fetch plan from AE (no local draft.json) → ask for host
@@ -194,7 +201,7 @@ Ask in order, one item per message:
194
201
  - Account ID source: user_account / role_id / none
195
202
  - Visitor ID strategy: auto / device_id / custom
196
203
 
197
- 5. **SERVER_URL / APP_ID** (skip if already configured)
204
+ 5. **APP_ID / SERVER_URL**: resolve them with the lookup-first flow above, confirm any found values with the user, and ask only for values that cannot be found or are rejected by the user.
198
205
 
199
206
  **Step 4: Merge configuration and proceed to Phase 1**
200
207
 
@@ -224,26 +231,31 @@ Without `.ae-cli/draft.json` or `.ae-cli/remote-plan.json`:
224
231
 
225
232
  **Client platforms** (corresponding to client SDKs):
226
233
 
227
- | plan field | Platform | SDK | Document Path |
228
- |---|---|---|---|
229
- | `android` | Android | Android SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/client-sdk/android.md` |
230
- | `ios` | iOS | iOS SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/client-sdk/ios.md` |
231
- | `openharmony` | OpenHarmony | OpenHarmony SDK | `~/.ae-cli/wiki/te-docs/raw/客户端-sdk/openharmony.md` |
232
- | `javascript` | Web / H5 | JavaScript SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/client-sdk/javascript.md` |
233
- | `miniprogram` | Mini-program | Mini-program SDK | `~/.ae-cli/wiki/te-docs/raw/客户端-sdk/小程序小游戏.md` |
234
- | `unity` | Unity | Unity SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/client-sdk/game-engine/unity.md` |
235
- | `game_engine` | Game Engine | Cocos / Laya / Unreal | See `references/sdk-index.md` |
234
+ | plan field | Platform | SDK |
235
+ |---|---|---|
236
+ | `android` | Android | Android SDK |
237
+ | `ios` | iOS | iOS SDK |
238
+ | `openharmony` | OpenHarmony | OpenHarmony SDK |
239
+ | `javascript` | Web / H5 | JavaScript SDK |
240
+ | `miniprogram` | Mini-program | Mini-program SDK |
241
+ | `unity` | Unity | Unity SDK |
242
+ | `game_engine` | Game Engine | Cocos / Laya / Unreal |
236
243
 
237
244
  **Server languages** (corresponding to server SDKs):
238
245
 
239
- | plan field | Language | SDK | Document Path |
240
- |---|---|---|---|
241
- | `java` | Java | Java SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/server-sdk/java.md` |
242
- | `python` | Python | Python SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/server-sdk/python.md` |
243
- | `go` | Go | Go SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/server-sdk/golang.md` |
244
- | `nodejs` | Node.js | Node SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/server-sdk/nodejs.md` |
245
- | `php` | PHP | PHP SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/server-sdk/php.md` |
246
- | `csharp` | C# | C# SDK | `~/.ae-cli/wiki/te-docs/raw/data-ingestion-guide/server-sdk/c.md` |
246
+ | plan field | Language | SDK |
247
+ |---|---|---|
248
+ | `java` | Java | Java SDK |
249
+ | `python` | Python | Python SDK |
250
+ | `go` | Go | Go SDK |
251
+ | `nodejs` | Node.js | Node SDK |
252
+ | `php` | PHP | PHP SDK |
253
+ | `csharp` | C# | C# SDK |
254
+
255
+ **SDK document paths**:
256
+ - Do not use hard-coded wiki paths from this section.
257
+ - Always read `references/sdk-index.md` first and use the path listed there for the selected SDK.
258
+ - If the path from `references/sdk-index.md` does not exist in the local wiki mirror, search under `~/.ae-cli/wiki/te-docs/raw/` with SDK-specific keywords and use the best matching latest main document.
247
259
 
248
260
  ---
249
261
 
@@ -437,7 +449,7 @@ test -z "$(git status --porcelain)" || echo "uncommitted changes present"
437
449
  **Only generate events where `platform === "client"` or `platform === "both"`**
438
450
 
439
451
  **⚠️ Hard rule: Never guess SDK imports**
440
- - Before generating, MUST read the corresponding SDK wiki document (see `references/sdk-index.md`)
452
+ - Before generating, MUST read `references/sdk-index.md`, resolve the corresponding SDK wiki main document, verify the path exists, and then read that main document
441
453
  - **MUST copy import statements and package names from the wiki main document**, never guess
442
454
  - Example: JavaScript SDK npm package is `thinkingdata-browser`, import variable is `ta`
443
455
  - If generated code doesn't match wiki docs (e.g. `TDAnalytics`/`te`/`@thinkingdata/web-sdk`), re-read wiki and fix
@@ -460,7 +472,7 @@ test -z "$(git status --porcelain)" || echo "uncommitted changes present"
460
472
  - **Always provide LogBus2 official docs link**: https://docs-v2.thinkingdata.cn/?version=latest&code=logbus2_installation&lan=en-US
461
473
 
462
474
  **⚠️ Hard rule: Never guess SDK imports**
463
- - Before generating, MUST read the corresponding SDK wiki document (see `references/sdk-index.md`)
475
+ - Before generating, MUST read `references/sdk-index.md`, resolve the corresponding SDK wiki main document, verify the path exists, and then read that main document
464
476
  - **MUST copy import statements and package names from the wiki main document**, never guess
465
477
  - **Re-read docs before every code generation**, never rely on "remembered" code
466
478
 
@@ -478,6 +490,25 @@ test -z "$(git status --porcelain)" || echo "uncommitted changes present"
478
490
 
479
491
  Show deliverables based on selected output modes:
480
492
 
493
+ ### Attachment upload
494
+
495
+ After all `.ae-cli/output/` files are generated, upload every generated output file to the Agent attachment library so the user can download them from the file/attachment management entry.
496
+
497
+ Use the existing attachment command:
498
+
499
+ ```bash
500
+ ae-cli agent +add-attachment --yes --files '<json-array-of-generated-output-files>'
501
+ ```
502
+
503
+ Upload list rules:
504
+ - Include all generated snippet files under `.ae-cli/output/`.
505
+ - Include generated server config files such as `.ae-cli/output/daemon.json` and LogBus README files.
506
+ - Include `.ae-cli/output/README.md`.
507
+ - Include generated debug scripts if the user selected the debug option.
508
+ - Do not upload files inserted directly into the user's project; only upload generated output artifacts.
509
+
510
+ If upload succeeds, include the attachment upload result in the final response and tell the user the files are available from the file/attachment management entry. If upload fails because Agent attachment credentials are unavailable, keep the local `.ae-cli/output/` files and tell the user the upload did not complete.
511
+
481
512
  ### All snippets
482
513
 
483
514
  ```
@@ -496,6 +527,8 @@ Standalone:
496
527
  - .ae-cli/output/te-debug.java (validation script)
497
528
 
498
529
  README: .ae-cli/output/README.md (usage instructions)
530
+
531
+ Attachment upload: uploaded generated output files to the file/attachment management entry
499
532
  ```
500
533
 
501
534
  ### Mixed (some insert + some snippet)
@@ -514,6 +547,8 @@ LogBus2 official docs: https://docs-v2.thinkingdata.cn/?version=latest&code=logb
514
547
 
515
548
  Standalone:
516
549
  - .ae-cli/output/te-debug.java (validation script)
550
+
551
+ Attachment upload: uploaded generated output files to the file/attachment management entry
517
552
  ```
518
553
 
519
554
  ### Markdown code snippet display
@@ -623,7 +658,9 @@ All output mode rules are in `references/*.md`. This SKILL.md only handles phase
623
658
  - `~/.ae-cli/wiki/te-docs/synthesis/` — LLM-synthesized overview documents
624
659
 
625
660
  **Document reading order during code generation**:
626
- 1. Read `references/sdk-index.md` to find the SDK's wiki document path
627
- 2. Read wiki main doc (initialization, basic API)
628
- 3. Read wiki advanced guide (LoggerConsumer, user properties, etc.)
629
- 4. Check advanced guide sub-documents if needed
661
+ 1. Read `references/sdk-index.md` to find the selected SDK's main document and advanced guide paths.
662
+ 2. Verify the main document path exists in the local wiki mirror before reading it.
663
+ 3. If the indexed path is missing, search under `~/.ae-cli/wiki/te-docs/raw/` with SDK-specific keywords such as SDK name, platform name, language name, and `main doc`; choose the latest main document, not historical/versioned documents.
664
+ 4. Read the wiki main doc first (initialization, imports, package names, basic API).
665
+ 5. Read the advanced guide only after the main doc (LoggerConsumer, user properties, auto-track, preset properties, etc.).
666
+ 6. Check advanced guide sub-documents if needed.
@@ -4,9 +4,10 @@
4
4
 
5
5
  ## Deliverables
6
6
 
7
- Two outputs:
7
+ Three outputs:
8
8
  1. **Markdown response**: code snippets grouped by platform (for reading)
9
9
  2. **Code files**: `.ae-cli/output/<platform>-sdk.<ext>` (for copy-paste use)
10
+ 3. **Attachment library upload**: generated files uploaded with `ae-cli agent +add-attachment` so the user can download them from the file/attachment management entry
10
11
 
11
12
  ---
12
13
 
@@ -230,6 +231,26 @@ AE Debug mode requires the device ID to be added in AE Admin before data can be
230
231
 
231
232
  ---
232
233
 
234
+ ## Attachment Library Upload
235
+
236
+ After all snippet output files are written, upload generated output artifacts to the Agent attachment library:
237
+
238
+ ```bash
239
+ ae-cli agent +add-attachment --yes --files '<json-array-of-generated-output-files>'
240
+ ```
241
+
242
+ Upload list must include:
243
+ - Every generated platform snippet file under `.ae-cli/output/`
244
+ - `.ae-cli/output/README.md`
245
+ - Server-side config files, including `.ae-cli/output/daemon.json` and related README files
246
+ - Generated debug scripts, if any
247
+
248
+ Only upload generated output artifacts. Do not upload files inserted directly into the user's project.
249
+
250
+ If upload succeeds, report that the files are available from the file/attachment management entry. If upload fails because Agent attachment credentials are unavailable, preserve the local output files and report the upload failure separately.
251
+
252
+ ---
253
+
233
254
  ## Generation Workflow
234
255
 
235
256
  ### ⚠️ Mandatory Pre-checks (do not skip)
@@ -302,6 +323,10 @@ After generation, perform language style checks on each output file:
302
323
  1. Additionally generate `daemon.json` for server-side
303
324
  2. **Must always provide LogBus2 official documentation link**
304
325
 
326
+ #### Step 5: Upload Generated Artifacts
327
+
328
+ Upload all generated `.ae-cli/output/` artifacts to the Agent attachment library using `ae-cli agent +add-attachment --yes --files '<json-array>'`.
329
+
305
330
  ---
306
331
 
307
332
  ## Code Style
@@ -1,181 +1,64 @@
1
- # AE Plan Query API (captured 2026-04-15)
1
+ # AE Plan Query Capability API
2
2
 
3
- ## Endpoint
3
+ This reference is for `ae-cli` maintainers. Skill users should call CLI commands, not backend APIs.
4
4
 
5
- - **Method**: GET
6
- - **URL**: `https://web-ta-demo.thinkingdata.cn/v1/ta/bury/manage/program/query?@t={timestamp}&projectId={projectId}`
7
- - **Auth**: header `authorization: bearer {token}` — token value read from `localStorage['ACCESS_TOKEN']` (JSON-encoded string) on the AE web app, also cached in `~/.ae-cli/tokens.json`
8
- - **Additional required headers**:
9
- - `x-requested-with: XMLHttpRequest`
10
- - `accept: application/json`
11
- - **Request body**: none (GET)
5
+ The code-generation skill reads the current tracking plan through the capability gateway. The CLI
6
+ must not call the legacy common-service tracking-program URL directly.
12
7
 
13
- ### URL parameters
8
+ ## Authentication
14
9
 
15
- | Param | Required | Notes |
16
- |---|---|---|
17
- | `@t` | yes (de-facto) | Unix timestamp ms cache-buster; the server likely accepts any value |
18
- | `projectId` | yes | AE project ID, e.g. `1603` |
10
+ - Header: `cli-token: <token>`
11
+ - Do not send `authorization: bearer ...`.
12
+ - Do not read `ACCESS_TOKEN` from browser localStorage.
19
13
 
20
- ---
14
+ ## Query Capability
21
15
 
22
- ## Response shape (truncated to 2 events / 2 props each)
16
+ - Capability: `track.program.query`
17
+ - Method: `POST`
18
+ - URL: `/api/cli/analysis/v1/capabilities/track.program.query/execute`
19
+ - Input:
20
+
21
+ ```json
22
+ { "project_id": 1603 }
23
+ ```
24
+
25
+ ## Response Shape
26
+
27
+ The gateway response keeps the standard AE envelope:
23
28
 
24
29
  ```json
25
30
  {
26
31
  "return_code": 0,
27
- "return_message": "ok",
32
+ "return_message": "success",
28
33
  "showStackMessage": null,
29
34
  "data": {
30
35
  "projectId": 1603,
31
- "createTime": "2026-04-15 15:45:17",
32
-
33
- "events": [
34
- {
35
- "eventName": "admin_skill_review",
36
- "displayName": "管理员审核",
37
- "eventDesc": "管理员通过/驳回/归档 skill",
38
- "eventTag": "admin",
39
- "creator": "周津",
40
- "createTime": "2026-04-15 15:45:17",
41
- "lastUpdateAuth": "周津",
42
- "lastUpdateTime": "2026-04-15 15:45:17",
43
- "hasReported": false,
44
- "props": ["review_action", "review_reason", "skill_id", "skill_name"],
45
- "propInfosOnEvent": [
46
- { "name": "review_action", "hasReported": false },
47
- { "name": "review_reason", "hasReported": false }
48
- ]
49
- },
50
- {
51
- "eventName": "page_view",
52
- "displayName": "页面浏览",
53
- "eventDesc": "任意页面打开",
54
- "eventTag": "common",
55
- "creator": "周津",
56
- "createTime": "2026-04-15 15:45:17",
57
- "lastUpdateAuth": "周津",
58
- "lastUpdateTime": "2026-04-15 15:45:17",
59
- "hasReported": false
60
- // props / propInfosOnEvent absent when event has no bound properties
61
- }
62
- ],
63
-
64
- "eventProps": [
65
- {
66
- "name": "login_method",
67
- "displayName": "登录方式",
68
- "type": "string",
69
- "desc": "feishu_sso",
70
- "creator": "周津",
71
- "createTime": "2026-04-15 15:45:17",
72
- "lastUpdateAuth": "周津",
73
- "lastUpdateTime": "2026-04-15 15:45:17"
74
- // NOTE: no hasReported field on eventProps items
75
- },
76
- {
77
- "name": "session_duration_ms",
78
- "displayName": "会话时长毫秒",
79
- "type": "number",
80
- "desc": "登出时本次会话累计时长",
81
- "creator": "周津",
82
- "createTime": "2026-04-15 15:45:17",
83
- "lastUpdateAuth": "周津",
84
- "lastUpdateTime": "2026-04-15 15:45:17"
85
- }
86
- ],
87
-
88
- "commonEventProps": [
89
- {
90
- "name": "is_embed",
91
- "displayName": "是否嵌入模式",
92
- "type": "bool",
93
- "desc": "是否在 CRM iframe 嵌入中访问",
94
- "creator": "周津",
95
- "createTime": "2026-04-15 15:45:17",
96
- "lastUpdateAuth": "周津",
97
- "lastUpdateTime": "2026-04-15 15:45:17",
98
- "hasReported": false
99
- },
100
- {
101
- "name": "page_name",
102
- "displayName": "页面名称",
103
- "type": "string",
104
- "desc": "当前页面标识,如 home/submit/detail/admin",
105
- "creator": "周津",
106
- "createTime": "2026-04-15 15:45:17",
107
- "lastUpdateAuth": "周津",
108
- "lastUpdateTime": "2026-04-15 15:45:17",
109
- "hasReported": false
110
- }
111
- ],
112
-
113
- "userProps": [
114
- {
115
- "name": "admin_review_count",
116
- "displayName": "审核处理数",
117
- "type": "number",
118
- "desc": "管理员累计审核的 skill 数",
119
- "updateType": "user_add",
120
- "updateTypeName": "user_add",
121
- "propTag": "",
122
- "creator": "周津",
123
- "createTime": "2026-04-15 15:45:17",
124
- "lastUpdateAuth": "周津",
125
- "lastUpdateTime": "2026-04-15 15:45:17",
126
- "hasReported": false
127
- }
128
- ]
36
+ "events": [],
37
+ "eventProps": [],
38
+ "commonEventProps": [],
39
+ "userProps": []
129
40
  }
130
41
  }
131
42
  ```
132
43
 
133
- ---
134
-
135
- ## Field mapping to Draft
136
-
137
- The planned `normalize()` function assumes `data.event_properties[]`, `data.common_event_properties[]`, `data.user_properties[]`. **Reality differs** — see caveats below.
138
-
139
- | AE response field | Draft field (src/plan/types.ts) | Notes |
140
- |---|---|---|
141
- | `data.events[].eventName` | `events[].event_name` | camelCase → snake_case |
142
- | `data.events[].displayName` | `events[].display_name` | camelCase → snake_case |
143
- | `data.events[].eventDesc` | `events[].event_desc` | camelCase → snake_case |
144
- | `data.events[].eventTag` | `events[].event_tag` | camelCase → snake_case |
145
- | `data.events[].props[]` | `events[].properties[]` | array of property name strings |
146
- | `data.events[].propInfosOnEvent[]` | `events[].property_infos[]` | array of `{name, hasReported}` |
147
- | `data.eventProps[].name` | `event_properties[].name` | key rename: `eventProps` → `event_properties` |
148
- | `data.eventProps[].type` | `event_properties[].type` | same |
149
- | `data.eventProps[].displayName` | `event_properties[].display_name` | camelCase → snake_case |
150
- | `data.eventProps[].desc` | `event_properties[].description` | key rename |
151
- | `data.commonEventProps[].name` | `common_event_properties[].name` | key rename: `commonEventProps` → `common_event_properties` |
152
- | `data.userProps[].name` | `user_properties[].name` | key rename: `userProps` → `user_properties` |
153
- | `data.userProps[].updateType` | `user_properties[].update_type` | user property specific |
154
- | `data.userProps[].propTag` | `user_properties[].prop_tag` | user property specific |
155
- | `return_code` | — | top-level; `0` = success |
156
- | `return_message` | — | top-level; `"ok"` on success |
157
-
158
- ---
159
-
160
- ## Caveats
161
-
162
- 1. **Key naming is camelCase throughout** — all field names in the response use camelCase (`eventName`, `displayName`, `eventProps`, etc.). The draft plan assumed snake_case keys like `event_name`. `normalize()` must do a full camelCase → snake_case conversion, or map fields explicitly.
163
-
164
- 2. **Array key name mismatches vs plan assumption**:
165
- - Response uses `eventProps` (not `event_properties`)
166
- - Response uses `commonEventProps` (not `common_event_properties`)
167
- - Response uses `userProps` (not `user_properties`)
168
-
169
- 3. **`eventProps` are global, not scoped per event** — all event properties live in one flat `data.eventProps[]` array. Per-event bindings are in `data.events[].props` (name strings) and `data.events[].propInfosOnEvent` (`{name, hasReported}` objects). Events with no bound properties omit both `props` and `propInfosOnEvent` fields entirely.
170
-
171
- 4. **`hasReported` field inconsistency** — `commonEventProps` and `userProps` items include `hasReported`; `eventProps` items do NOT include this field.
172
-
173
- 5. **`@t` cache-buster** — the `@t` query param is a Unix timestamp in milliseconds. It appears to be required (the page always sends it) but likely just busts CDN/proxy caching. Use `Date.now()` when constructing requests.
174
-
175
- 6. **No pagination observed** — the single request returns all 17 events, 21 event props, 6 common props, 9 user props in one shot. No pagination headers or page/limit params were observed.
176
-
177
- 7. **`userProps[].updateType` and `updateTypeName`** — both fields are present on user properties (e.g., `"user_add"`). The xlsx schema's `更新方式` column maps to this.
178
-
179
- 8. **`propTag`** — present on `userProps` items (maps to xlsx `属性标签` column), absent on event/common props.
180
-
181
- 9. **`eventProps` lack `hasReported`** — unlike events and common/user props, individual event property definitions in `eventProps[]` do not carry `hasReported`. The flag does appear inside `propInfosOnEvent[]` on the event object itself.
44
+ The CLI normalizes the capability output before converting it to the tracking draft shape.
45
+
46
+ ## Field Mapping to Draft
47
+
48
+ | AE response field | Draft field |
49
+ |---|---|
50
+ | `data.events[].eventName` | `events[].event_name` |
51
+ | `data.events[].displayName` | `events[].display_name` |
52
+ | `data.events[].eventDesc` | `events[].event_desc` |
53
+ | `data.events[].eventTag` | `events[].event_tag` |
54
+ | `data.events[].props[]` | `events[].properties[]` |
55
+ | `data.events[].propInfosOnEvent[]` | `events[].property_infos[]` |
56
+ | `data.eventProps[].name` | `event_properties[].name` |
57
+ | `data.eventProps[].displayName` | `event_properties[].display_name` |
58
+ | `data.eventProps[].desc` | `event_properties[].description` |
59
+ | `data.commonEventProps[].name` | `common_event_properties[].name` |
60
+ | `data.userProps[].name` | `user_properties[].name` |
61
+ | `data.userProps[].updateType` | `user_properties[].update_type` |
62
+ | `data.userProps[].propTag` | `user_properties[].prop_tag` |
63
+
64
+ Empty projects may return a success envelope without `data`; treat that as an empty plan.