@thinkingai/ae-cli 6.0.58 → 6.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -5
- package/README.zh.md +10 -5
- package/bin/ai-monitor.js +2 -0
- package/dist/ai-monitor-FCXSLHAP.js +32 -0
- package/dist/ai-monitor.js +135 -0
- package/dist/{auth-A5OO4VS4.js → auth-ATK2SLEV.js} +10 -9
- package/dist/{automation-FD2QZUP6.js → automation-FLCPFMN4.js} +4 -4
- package/dist/{capability-SKI4GHF4.js → capability-6KTSOI7L.js} +31 -35
- package/dist/{chunk-UYJMEHAF.js → chunk-2ETRY2CU.js} +15 -15
- package/dist/{chunk-QWSA3EOD.js → chunk-5E7MTTFN.js} +2 -2
- package/dist/{chunk-JSBLCLFE.js → chunk-5M5LBRR3.js} +1 -1
- package/dist/chunk-6M7ZEDT2.js +182 -0
- package/dist/{chunk-KPQY44JQ.js → chunk-AWW2T2WL.js} +3 -0
- package/dist/chunk-AXTO4FTM.js +1285 -0
- package/dist/{chunk-HQCY3QCA.js → chunk-BEYLCUZX.js} +17 -12
- package/dist/chunk-CF6JTT2U.js +64 -0
- package/dist/{chunk-VDICGXCY.js → chunk-F2VFZUGG.js} +2 -2
- package/dist/{chunk-K2Z7QHDR.js → chunk-HSZAIPUX.js} +47 -12
- package/dist/{chunk-SOSFRU3O.js → chunk-HTZ2MLYA.js} +47 -21
- package/dist/{chunk-AWVZTN2B.js → chunk-HVMCPKOZ.js} +1 -1
- package/dist/{chunk-E25OSZLJ.js → chunk-KTJXD27G.js} +2 -2
- package/dist/{chunk-GBSACKFB.js → chunk-LOR4IA26.js} +564 -314
- package/dist/{chunk-YVG6QD3V.js → chunk-P7QDCWJ6.js} +98 -7
- package/dist/{chunk-EEARZNHE.js → chunk-SDKW6LYE.js} +88 -36
- package/dist/{chunk-WMDO53YK.js → chunk-VJUXKVRE.js} +1 -1
- package/dist/chunk-VRMGHQKE.js +556 -0
- package/dist/{compat-check-WFEKVLTH.js → compat-check-XD2U7PZ2.js} +2 -2
- package/dist/{config-U4I7X25P.js → config-U3GDWU6E.js} +25 -12
- package/dist/{context-CDB5H5PD.js → context-YAQG6YQC.js} +2 -2
- package/dist/{evaluation-LR4YDYWL.js → evaluation-2JSF4V47.js} +13 -158
- package/dist/index.js +84 -579
- package/dist/{memory-SNFR5M23.js → memory-WEB27VI6.js} +7 -7
- package/dist/{metadata-6QM6EED5.js → metadata-7FYE4234.js} +7 -7
- package/dist/{model-KEVCEXWD.js → model-T7H7Q6BG.js} +2 -2
- package/dist/{personal-semantic-preference-7VXQPP2N.js → personal-semantic-preference-O6VXM74A.js} +6 -6
- package/dist/{project-semantic-PSEPYH2L.js → project-semantic-2GGFJWW6.js} +15 -13
- package/dist/{sync-22ACDK5Z.js → sync-ULBB7WO5.js} +4 -4
- package/dist/{te-agent-BJ36B4QI.js → te-agent-6RMF7LUV.js} +5 -5
- package/dist/{te-analysis-WQ6D6YG4.js → te-analysis-HSYC7GNV.js} +382 -193
- package/dist/{te-community-VRWMFGI6.js → te-community-FLKZGQKB.js} +9 -9
- package/dist/{te-dataops-YTLFTTW7.js → te-dataops-OQQGTCUA.js} +3 -3
- package/dist/{te-engage-V2QW7TIC.js → te-engage-RIEBHL5T.js} +9 -9
- package/dist/{te-kb-4AQLISDR.js → te-kb-4HG2FMHJ.js} +18 -9
- package/dist/{te-system-CYWSK3UN.js → te-system-AL4B4XZL.js} +2 -2
- package/dist/{te-team-6ELNGBWT.js → te-team-5O4UVUWE.js} +5 -5
- package/dist/{things-HFWLGCUH.js → things-TSJ64GBT.js} +5 -5
- package/dist/{update-3CRVVHV5.js → update-Q5LURAWV.js} +3 -3
- package/dist/{workspace-2CKQX2XL.js → workspace-FF2HXJGR.js} +4 -4
- package/package.json +8 -6
- package/skills/ae-ai-monitor/SKILL.md +179 -0
- package/skills/ae-ai-monitor/references/read-commands.md +866 -0
- package/skills/ae-analysis/SKILL.md +10 -4
- package/skills/ae-analysis/references/adhoc_export.md +3 -1
- package/skills/ae-analysis/references/ai_models.md +1 -0
- package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
- package/skills/ae-analysis/references/asset_search.md +1 -1
- package/skills/ae-analysis/references/bad_case_begin.md +12 -0
- package/skills/ae-analysis/references/bad_case_get.md +12 -0
- package/skills/ae-analysis/references/bad_case_history.md +12 -0
- package/skills/ae-analysis/references/bad_case_list.md +12 -0
- package/skills/ae-analysis/references/bad_case_review.md +51 -0
- package/skills/ae-analysis/references/bad_case_run.md +12 -0
- package/skills/ae-analysis/references/bad_case_submit.md +12 -0
- package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
- package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
- package/skills/ae-analysis/references/bi_panel_list.md +1 -1
- package/skills/ae-analysis/references/bi_panel_share.md +3 -1
- package/skills/ae-analysis/references/catalog_list.md +2 -0
- package/skills/ae-analysis/references/command_index.md +38 -29
- package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
- package/skills/ae-analysis/references/dashboard_handover.md +3 -1
- package/skills/ae-analysis/references/dashboard_list.md +3 -3
- package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
- package/skills/ae-analysis/references/dashboard_share.md +3 -1
- package/skills/ae-analysis/references/dashboard_update.md +3 -2
- package/skills/ae-analysis/references/filter_value_list.md +2 -0
- package/skills/ae-analysis/references/folder_share.md +8 -2
- package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
- package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
- package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
- package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
- package/skills/ae-analysis/references/project_member_add.md +3 -1
- package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
- package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
- package/skills/ae-analysis/references/project_member_update.md +3 -1
- package/skills/ae-analysis/references/project_owner_update.md +3 -1
- package/skills/ae-analysis/references/project_role_upsert.md +5 -3
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
- package/skills/ae-analysis/references/project_space_share.md +8 -2
- package/skills/ae-analysis/references/property_get.md +2 -0
- package/skills/ae-analysis/references/public_link_list.md +3 -1
- package/skills/ae-analysis/references/query_cancel.md +4 -1
- package/skills/ae-analysis/references/report_data_run.md +1 -1
- package/skills/ae-analysis/references/report_list.md +3 -3
- package/skills/ae-analysis/references/scenario_append.md +2 -2
- package/skills/ae-analysis/references/scenario_collect.md +15 -4
- package/skills/ae-analysis/references/scenario_list.md +2 -1
- package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
- package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
- package/skills/ae-analysis/references/user_tag_create.md +4 -1
- package/skills/ae-analysis/references/user_tag_get.md +2 -0
- package/skills/ae-analysis/references/user_tag_models.md +8 -2
- package/skills/ae-analysis/references/user_tag_update.md +5 -2
- package/skills/ae-analysis/references/virtual_property_create.md +12 -1
- package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
- package/skills/ae-automation/SKILL.md +4 -2
- package/skills/ae-capability/SKILL.md +9 -5
- package/skills/ae-community/SKILL.md +1 -0
- package/skills/ae-dataops/SKILL.md +1 -0
- package/skills/ae-engage/SKILL.md +1 -0
- package/skills/ae-evaluation/SKILL.md +17 -2
- package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
- package/skills/ae-kb/SKILL.md +5 -3
- package/skills/ae-kb/references/analysis-workflow.md +11 -2
- package/skills/ae-kb/references/query-workflow.md +3 -1
- package/skills/ae-kb/references/versions.md +1 -1
- package/skills/ae-metadata/SKILL.md +1 -0
- package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
- package/skills/ae-team/SKILL.md +1 -1
- package/skills/ae-tracking-matrix/SKILL.md +170 -0
- package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
- package/skills/ae-tracking-matrix/i18n.yaml +12 -0
- package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
- package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
- package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
- package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
- package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
- package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
- package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
- package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
- package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
- package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
- package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
- package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
- package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
- package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
- package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
- package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
- package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
- package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
- package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
- package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
- package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
- package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
- package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
- package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
- package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
- package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
- package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
- package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
- package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
- package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
- package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
- package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
- package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
- package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
- package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
- package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
- package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
- package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
- package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
- package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
- package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
- package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
- package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
- package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
- package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
- package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
- package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
- package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
- package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
- package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
- package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
- package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
- package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
- package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
- package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
- package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
- package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
- package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
- package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
- package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
- package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
- package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
- package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
- package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
- package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
- package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
- package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
- package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
- package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
- package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
- package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
- package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
- package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
- package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
- package/dist/chunk-AMBFK2K3.js +0 -28
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
confirmHighRiskWrite,
|
|
4
|
+
requiresConfirmation
|
|
5
|
+
} from "./chunk-CF6JTT2U.js";
|
|
6
|
+
import {
|
|
7
|
+
TeAgentApiError,
|
|
8
|
+
TeAgentCredentialsError
|
|
9
|
+
} from "./chunk-5M5LBRR3.js";
|
|
10
|
+
import {
|
|
11
|
+
EvalApiError
|
|
12
|
+
} from "./chunk-P7QDCWJ6.js";
|
|
13
|
+
import {
|
|
14
|
+
printError,
|
|
15
|
+
printOutput
|
|
16
|
+
} from "./chunk-VJUXKVRE.js";
|
|
17
|
+
import {
|
|
18
|
+
CapabilityGatewayError
|
|
19
|
+
} from "./chunk-2ETRY2CU.js";
|
|
20
|
+
import {
|
|
21
|
+
BusinessDisabledError,
|
|
22
|
+
assertBusinessEnabled,
|
|
23
|
+
businessForCommand,
|
|
24
|
+
formatCapabilityMissCompatHint,
|
|
25
|
+
readCurrentBusinessConfig
|
|
26
|
+
} from "./chunk-LOR4IA26.js";
|
|
27
|
+
import {
|
|
28
|
+
CredentialStoreUnreadableError,
|
|
29
|
+
SecureStoreAuthError
|
|
30
|
+
} from "./chunk-HTZ2MLYA.js";
|
|
31
|
+
import {
|
|
32
|
+
getActiveHost,
|
|
33
|
+
safeJsonParse
|
|
34
|
+
} from "./chunk-4PSTYEG5.js";
|
|
35
|
+
import {
|
|
36
|
+
CliApiError,
|
|
37
|
+
CliValidationError,
|
|
38
|
+
CommunityReportError,
|
|
39
|
+
ExternalCliTokenError,
|
|
40
|
+
LocalDataUploadError,
|
|
41
|
+
PermissionError,
|
|
42
|
+
logger,
|
|
43
|
+
readKbExecutionContext
|
|
44
|
+
} from "./chunk-Z3Q2AEIN.js";
|
|
45
|
+
|
|
46
|
+
// src/framework/business-filter.ts
|
|
47
|
+
import { Help } from "commander";
|
|
48
|
+
function commandPath(command) {
|
|
49
|
+
const result = [];
|
|
50
|
+
for (let current = command; current?.parent; current = current.parent) {
|
|
51
|
+
result.unshift(current.name());
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
function configureBusinessCommands(program, options = {}) {
|
|
56
|
+
const readStates = options.readStates ?? (() => readCurrentBusinessConfig(options.hostOverride));
|
|
57
|
+
const commandBusiness = (command) => businessForCommand([...options.commandPrefix ?? [], ...commandPath(command)]);
|
|
58
|
+
const isVisible = (command) => {
|
|
59
|
+
const business = commandBusiness(command);
|
|
60
|
+
return !business || readStates()[business] !== false;
|
|
61
|
+
};
|
|
62
|
+
const helpConfiguration = {
|
|
63
|
+
visibleCommands(command) {
|
|
64
|
+
return Help.prototype.visibleCommands.call(this, command).filter(isVisible);
|
|
65
|
+
},
|
|
66
|
+
formatHelp(command, helper) {
|
|
67
|
+
if (!isVisible(command)) {
|
|
68
|
+
const business = commandBusiness(command);
|
|
69
|
+
return `The '${business}' business is not enabled for the current environment.
|
|
70
|
+
Run: ae-cli config refresh
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
return Help.prototype.formatHelp.call(this, command, helper);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const configureHelp = (command) => {
|
|
77
|
+
command.configureHelp(helpConfiguration);
|
|
78
|
+
command.commands.forEach(configureHelp);
|
|
79
|
+
};
|
|
80
|
+
configureHelp(program);
|
|
81
|
+
program.on("beforeAllHelp", (context) => {
|
|
82
|
+
if (isVisible(context.command)) return;
|
|
83
|
+
const business = commandBusiness(context.command);
|
|
84
|
+
context.write(`The '${business}' business is not enabled for the current environment.
|
|
85
|
+
Run: ae-cli config refresh
|
|
86
|
+
`);
|
|
87
|
+
context.write = () => {
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
program.hook("preAction", async (_root, actionCommand) => {
|
|
91
|
+
const business = commandBusiness(actionCommand);
|
|
92
|
+
if (!business) return;
|
|
93
|
+
const opts = actionCommand.optsWithGlobals();
|
|
94
|
+
await (options.assertEnabled ?? assertBusinessEnabled)(business, opts.host ?? options.hostOverride);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/framework/program-lifecycle.ts
|
|
99
|
+
async function parseProgram(program, argv = process.argv) {
|
|
100
|
+
try {
|
|
101
|
+
await program.parseAsync(normalizeSubcommandVersionOption(program, argv));
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (error instanceof BusinessDisabledError) {
|
|
104
|
+
printError("permission", error.message, error.hint, error.code);
|
|
105
|
+
process.exitCode = 1;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (!(error instanceof CredentialStoreUnreadableError) && !(error instanceof ExternalCliTokenError)) throw error;
|
|
109
|
+
printError("config", error.message, error.hint, error.code);
|
|
110
|
+
process.exitCode = 1;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function normalizeSubcommandVersionOption(program, argv) {
|
|
114
|
+
const normalized = [...argv];
|
|
115
|
+
let current = program;
|
|
116
|
+
for (let index = 2; index < normalized.length; index += 1) {
|
|
117
|
+
const token = normalized[index];
|
|
118
|
+
if (token === "--") {
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
if (token.startsWith("-")) {
|
|
122
|
+
if (token === "--version" && current !== program && hasRequiredVersionOption(current)) {
|
|
123
|
+
const value = normalized[index + 1];
|
|
124
|
+
if (value && !value.startsWith("-")) {
|
|
125
|
+
normalized.splice(index, 2, `--version=${value}`);
|
|
126
|
+
} else {
|
|
127
|
+
normalized[index] = "--version=";
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (!token.includes("=")) {
|
|
132
|
+
const option = findOption(current, token);
|
|
133
|
+
if (option?.required) {
|
|
134
|
+
index += 1;
|
|
135
|
+
} else if (option?.optional) {
|
|
136
|
+
const value = normalized[index + 1];
|
|
137
|
+
if (value && !value.startsWith("-")) {
|
|
138
|
+
index += 1;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
const child = current.commands.find(
|
|
145
|
+
(command) => command.name() === token || command.aliases().includes(token)
|
|
146
|
+
);
|
|
147
|
+
if (child) {
|
|
148
|
+
current = child;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return normalized;
|
|
152
|
+
}
|
|
153
|
+
function hasRequiredVersionOption(command) {
|
|
154
|
+
return command.options.some((option) => option.long === "--version" && option.required);
|
|
155
|
+
}
|
|
156
|
+
function findOption(command, flag) {
|
|
157
|
+
let current = command;
|
|
158
|
+
while (current) {
|
|
159
|
+
const option = current.options.find((candidate) => candidate.long === flag || candidate.short === flag);
|
|
160
|
+
if (option) {
|
|
161
|
+
return option;
|
|
162
|
+
}
|
|
163
|
+
current = current.parent;
|
|
164
|
+
}
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// src/framework/runner.ts
|
|
169
|
+
function missingRequiredFlagsError(cmdName, missing) {
|
|
170
|
+
const names = missing.map((flag) => `--${flag.name}`);
|
|
171
|
+
const message = missing.length === 1 ? `Missing required flag: ${names[0]}` : `Missing required flags: ${names.join(", ")}`;
|
|
172
|
+
const hintParts = missing.map((flag) => flag.hint?.trim()).filter((hint2) => Boolean(hint2));
|
|
173
|
+
const hint = hintParts.length > 0 ? hintParts.join(" ") : `Usage: ae-cli ${cmdName} ${names.map((name) => `${name} <value>`).join(" ")}`;
|
|
174
|
+
return { message, hint };
|
|
175
|
+
}
|
|
176
|
+
function readSkillCurrentVersion(body) {
|
|
177
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) return void 0;
|
|
178
|
+
const currentVersion = body.currentVersion;
|
|
179
|
+
if (typeof currentVersion !== "string") return void 0;
|
|
180
|
+
return /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(currentVersion) ? currentVersion : void 0;
|
|
181
|
+
}
|
|
182
|
+
function teAgentApiErrorPresentation(err) {
|
|
183
|
+
if (err.code === "SKILL_VERSION_CONFLICT") {
|
|
184
|
+
const currentVersion = readSkillCurrentVersion(err.body);
|
|
185
|
+
return {
|
|
186
|
+
message: "The Skill content changed, and the new version must be greater than the current version.",
|
|
187
|
+
code: err.code,
|
|
188
|
+
hint: currentVersion ? `Retry with --version set to a major.minor version greater than ${currentVersion}.` : "Retry with --version set to a major.minor version greater than the current Skill version.",
|
|
189
|
+
...currentVersion ? { meta: { currentVersion } } : {}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
if (err.code === "SKILL_HISTORY_CONFLICT") {
|
|
193
|
+
return {
|
|
194
|
+
message: "The Skill cannot be safely updated right now.",
|
|
195
|
+
code: err.code,
|
|
196
|
+
hint: "The Skill cannot be safely updated right now. Please contact your administrator."
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
return {};
|
|
200
|
+
}
|
|
201
|
+
async function runCommand(cmd, opts, globalOpts) {
|
|
202
|
+
try {
|
|
203
|
+
const ctx = createRuntimeContext(cmd, opts, globalOpts);
|
|
204
|
+
const cmdName = cmd.resource ? `${cmd.service} ${cmd.resource} ${cmd.command}` : `${cmd.service} ${cmd.command}`;
|
|
205
|
+
logger.command(
|
|
206
|
+
cmdName,
|
|
207
|
+
opts,
|
|
208
|
+
cmd.flags.filter((flag) => flag.sensitive).map((flag) => flag.name)
|
|
209
|
+
);
|
|
210
|
+
const missingRequired = cmd.flags.filter((flag) => {
|
|
211
|
+
if (!flag.required) return false;
|
|
212
|
+
const val = opts[camelCase(flag.name)];
|
|
213
|
+
if (flag.variadic) return !Array.isArray(val) || val.length === 0;
|
|
214
|
+
return val === void 0 || val === null || val === "";
|
|
215
|
+
});
|
|
216
|
+
if (missingRequired.length > 0) {
|
|
217
|
+
const { message, hint } = missingRequiredFlagsError(cmdName, missingRequired);
|
|
218
|
+
printError("validation", message, hint);
|
|
219
|
+
process.exit(1);
|
|
220
|
+
}
|
|
221
|
+
if (cmd.validate && cmd.service !== "community") {
|
|
222
|
+
cmd.validate(ctx);
|
|
223
|
+
}
|
|
224
|
+
const LIMIT_FLAG_PATTERNS = [/limit/i, /page_size/i, /pagesize/i, /row_limit/i, /block_limit/i, /top[-_]?k/i];
|
|
225
|
+
for (const flag of cmd.flags) {
|
|
226
|
+
const val = opts[camelCase(flag.name)];
|
|
227
|
+
if (flag.variadic) continue;
|
|
228
|
+
if (flag.type === "boolean") {
|
|
229
|
+
if (val !== void 0 && typeof val !== "boolean") {
|
|
230
|
+
printError("validation", `Invalid boolean for --${flag.name}: ${val}. Use true/false.`);
|
|
231
|
+
process.exit(1);
|
|
232
|
+
}
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
if (flag.type === "int64") {
|
|
236
|
+
if (val === void 0 || val === null || val === "") continue;
|
|
237
|
+
const raw = String(val);
|
|
238
|
+
if (!/^-?(?:0|[1-9]\d*)$/.test(raw)) {
|
|
239
|
+
printError("validation", `--${flag.name} must be a base-10 integer (got: ${val})`);
|
|
240
|
+
process.exit(1);
|
|
241
|
+
}
|
|
242
|
+
const parsed = BigInt(raw);
|
|
243
|
+
const minInt64 = -(1n << 63n);
|
|
244
|
+
const maxInt64 = (1n << 63n) - 1n;
|
|
245
|
+
if (parsed < minInt64 || parsed > maxInt64) {
|
|
246
|
+
printError("validation", `--${flag.name} must fit in a signed 64-bit integer (got: ${val})`);
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
|
249
|
+
if (flag.min !== void 0 && parsed < BigInt(flag.min)) {
|
|
250
|
+
printError("validation", `--${flag.name} must be at least ${flag.min} (got: ${val})`);
|
|
251
|
+
process.exit(1);
|
|
252
|
+
}
|
|
253
|
+
if (flag.max !== void 0 && parsed > BigInt(flag.max)) {
|
|
254
|
+
printError("validation", `--${flag.name} must be at most ${flag.max} (got: ${val})`);
|
|
255
|
+
process.exit(1);
|
|
256
|
+
}
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
if (flag.type !== "number") continue;
|
|
260
|
+
if (flag.variadic) continue;
|
|
261
|
+
if (val === void 0 || val === null || val === "") continue;
|
|
262
|
+
const num = Number(val);
|
|
263
|
+
if (!Number.isFinite(num)) {
|
|
264
|
+
printError("validation", `--${flag.name} must be a number (got: ${val})`);
|
|
265
|
+
process.exit(1);
|
|
266
|
+
}
|
|
267
|
+
const isLimitFlag = LIMIT_FLAG_PATTERNS.some((p) => p.test(flag.name)) || cmd.service === "community" && /page[-_]?(?:size|num)|row[-_]?limit/i.test(flag.name);
|
|
268
|
+
if (isLimitFlag) {
|
|
269
|
+
const min = flag.min ?? 1;
|
|
270
|
+
const max = flag.max ?? 1e4;
|
|
271
|
+
if (!Number.isInteger(num) || num < min || num > max) {
|
|
272
|
+
printError("validation", `--${flag.name} must be an integer between ${min} and ${max} (got: ${val})`);
|
|
273
|
+
process.exit(1);
|
|
274
|
+
}
|
|
275
|
+
} else if (flag.min !== void 0 || flag.max !== void 0) {
|
|
276
|
+
const min = flag.min ?? Number.NEGATIVE_INFINITY;
|
|
277
|
+
const max = flag.max ?? Number.POSITIVE_INFINITY;
|
|
278
|
+
if (num < min || num > max) {
|
|
279
|
+
const lower = flag.min === void 0 ? "-Infinity" : String(min);
|
|
280
|
+
const upper = flag.max === void 0 ? "Infinity" : String(max);
|
|
281
|
+
printError("validation", `--${flag.name} must be a number between ${lower} and ${upper} (got: ${val})`);
|
|
282
|
+
process.exit(1);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
for (const flag of cmd.flags) {
|
|
287
|
+
if (flag.type !== "string") continue;
|
|
288
|
+
if (flag.variadic) continue;
|
|
289
|
+
const val = opts[camelCase(flag.name)];
|
|
290
|
+
if (val === void 0 || val === null || val === "") continue;
|
|
291
|
+
const error = stringFlagValidationError(flag, String(val));
|
|
292
|
+
if (error) {
|
|
293
|
+
printError("validation", error.message, error.hint);
|
|
294
|
+
process.exit(1);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (cmd.validate && cmd.service === "community") {
|
|
298
|
+
cmd.validate(ctx);
|
|
299
|
+
}
|
|
300
|
+
if (globalOpts.validate && globalOpts.dryRun) {
|
|
301
|
+
printError(
|
|
302
|
+
"validation",
|
|
303
|
+
"Cannot combine --validate and --dry-run.",
|
|
304
|
+
"Use --validate to fix parameters; use --dry-run as the pre-execution confirmation."
|
|
305
|
+
);
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
if (globalOpts.validate) {
|
|
309
|
+
if (cmd.validateInput) {
|
|
310
|
+
const validateResult = await cmd.validateInput(ctx);
|
|
311
|
+
await printOutput(validateResult, globalOpts.format, globalOpts.jq);
|
|
312
|
+
} else if (cmd.service === "community") {
|
|
313
|
+
throw new CliValidationError(`--validate is not supported for ${cmdName}`, {
|
|
314
|
+
hint: "Run without --validate, or inspect the underlying capability for server validation."
|
|
315
|
+
});
|
|
316
|
+
} else {
|
|
317
|
+
await printOutput(
|
|
318
|
+
{ message: "No --validate implementation for this command (capability gateway commands only)" },
|
|
319
|
+
globalOpts.format
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
if (globalOpts.dryRun) {
|
|
325
|
+
if (cmd.dryRun) {
|
|
326
|
+
const dryResult = await cmd.dryRun(ctx);
|
|
327
|
+
await printOutput(dryResult, globalOpts.format, globalOpts.jq);
|
|
328
|
+
} else if (cmd.service === "community") {
|
|
329
|
+
throw new CliValidationError(`--dry-run is not supported for ${cmdName}`, {
|
|
330
|
+
hint: "Run the read-only command without --dry-run; this command has no request preview."
|
|
331
|
+
});
|
|
332
|
+
} else {
|
|
333
|
+
await printOutput({ message: "No dry-run implementation for this command" }, globalOpts.format);
|
|
334
|
+
}
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if (requiresConfirmation(cmd.risk)) {
|
|
338
|
+
cmd.preflight?.(ctx);
|
|
339
|
+
if (!globalOpts.yes) {
|
|
340
|
+
const confirmed = await confirmHighRiskWrite(`This is a high-risk-write operation (${cmdName}). Continue?`);
|
|
341
|
+
if (!confirmed) {
|
|
342
|
+
process.stderr.write("Aborted.\n");
|
|
343
|
+
process.exit(0);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
const result = await cmd.execute(ctx);
|
|
348
|
+
await ctx.out(result);
|
|
349
|
+
} catch (err) {
|
|
350
|
+
if (err?.type === "validation" && typeof err?.hint === "string" && String(err.message || "").includes("--jq")) {
|
|
351
|
+
printError("validation", err.message, err.hint, err.code);
|
|
352
|
+
process.exit(1);
|
|
353
|
+
}
|
|
354
|
+
const message = err.message || String(err);
|
|
355
|
+
if (!(err instanceof CommunityReportError) && !(err instanceof EvalApiError)) {
|
|
356
|
+
if (!(err instanceof LocalDataUploadError)) logger.error(`Command failed: ${message}`);
|
|
357
|
+
}
|
|
358
|
+
if (err instanceof CliValidationError) {
|
|
359
|
+
printError(
|
|
360
|
+
"validation",
|
|
361
|
+
message,
|
|
362
|
+
err.hint,
|
|
363
|
+
err.code,
|
|
364
|
+
err.location ? { location: err.location } : void 0
|
|
365
|
+
);
|
|
366
|
+
} else if (err instanceof TeAgentCredentialsError) {
|
|
367
|
+
printError("config", message, err.hint);
|
|
368
|
+
} else if (err instanceof PermissionError) {
|
|
369
|
+
printError("permission", message, err.hint, err.code, err.meta, { details: err.details });
|
|
370
|
+
} else if (err instanceof CliApiError) {
|
|
371
|
+
printError("api", message, err.hint, err.code, err.meta);
|
|
372
|
+
} else if (err instanceof CapabilityGatewayError) {
|
|
373
|
+
printError(err.type, message, err.hint ?? capabilityGatewayHint(err), err.code, err.meta);
|
|
374
|
+
} else if (err instanceof CommunityReportError) {
|
|
375
|
+
printError("api", message, err.hint, err.code, err.meta, { log: false });
|
|
376
|
+
} else if (err instanceof LocalDataUploadError) {
|
|
377
|
+
printError("api", message, err.hint, err.code, err.meta, { log: false });
|
|
378
|
+
} else if (err instanceof CredentialStoreUnreadableError || err instanceof ExternalCliTokenError) {
|
|
379
|
+
printError("config", message, err.hint, err.code);
|
|
380
|
+
} else if (err instanceof EvalApiError) {
|
|
381
|
+
printError("api", message, err.hint, err.code, void 0, {
|
|
382
|
+
log: false,
|
|
383
|
+
// Only locally constructed guidance is public; remote details retain their existing privacy boundary.
|
|
384
|
+
details: err.onboarding ? { onboarding: err.onboarding } : void 0
|
|
385
|
+
});
|
|
386
|
+
} else if (err instanceof SecureStoreAuthError) {
|
|
387
|
+
printError("auth", message, "Run: ae-cli auth login", err.code);
|
|
388
|
+
} else if (err instanceof TeAgentApiError) {
|
|
389
|
+
if (err.status === 403) {
|
|
390
|
+
printError("permission", message, err.hint, err.code, void 0, { details: err.details });
|
|
391
|
+
} else if (err.status === 401) {
|
|
392
|
+
printError("auth", message, err.hint ?? "Run: ae-cli auth login", err.code, void 0, { details: err.details });
|
|
393
|
+
} else {
|
|
394
|
+
const presentation = teAgentApiErrorPresentation(err);
|
|
395
|
+
printError(
|
|
396
|
+
err.errorType,
|
|
397
|
+
presentation.message ?? message,
|
|
398
|
+
presentation.hint ?? err.hint,
|
|
399
|
+
presentation.code ?? err.code,
|
|
400
|
+
presentation.meta,
|
|
401
|
+
{ details: err.details }
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
} else if (looksLikeAuthFailure(message)) {
|
|
405
|
+
printError("auth", message, "Run: ae-cli auth login");
|
|
406
|
+
} else {
|
|
407
|
+
printError("api", message);
|
|
408
|
+
}
|
|
409
|
+
process.exit(1);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
function stringFlagValidationError(flag, value) {
|
|
413
|
+
if (flag.type !== "string") return void 0;
|
|
414
|
+
if (flag.minLength !== void 0 && value.length < flag.minLength) {
|
|
415
|
+
return { message: `--${flag.name} must contain at least ${flag.minLength} characters` };
|
|
416
|
+
}
|
|
417
|
+
if (flag.maxLength !== void 0 && value.length > flag.maxLength) {
|
|
418
|
+
return { message: `--${flag.name} must not exceed ${flag.maxLength} characters (got: ${value.length})` };
|
|
419
|
+
}
|
|
420
|
+
if (flag.pattern !== void 0 && !new RegExp(flag.pattern).test(value)) {
|
|
421
|
+
return { message: `--${flag.name} has an invalid format`, hint: `Expected pattern: ${flag.pattern}` };
|
|
422
|
+
}
|
|
423
|
+
return void 0;
|
|
424
|
+
}
|
|
425
|
+
function capabilityGatewayHint(err) {
|
|
426
|
+
if (err.code === "UPLOAD_NOT_EXIST" && (err.meta?.capability_id === "engage-setting.config-table.save" || err.meta?.capability_id === "engage-setting.config-table.update-data")) {
|
|
427
|
+
return "Run config-table upload first with the same --project-id and --request-id, then retry this command within 10 minutes. The upload cache is consumed after a successful save/update.";
|
|
428
|
+
}
|
|
429
|
+
const compatExtra = formatCapabilityMissCompatHint();
|
|
430
|
+
if (err.code === "CAPABILITY_NOT_FOUND") {
|
|
431
|
+
const base = "The current host does not expose this capability. Do not retry with different parameters; use a supported command path or ask the platform/backend owner to enable the capability.";
|
|
432
|
+
return compatExtra ? `${base}
|
|
433
|
+
${compatExtra}` : base;
|
|
434
|
+
}
|
|
435
|
+
if (err.httpStatus === 404 && !err.code) {
|
|
436
|
+
const base = "The current host returned 404 for this capability route. Do not keep retrying the same command; verify the backend route/capability deployment.";
|
|
437
|
+
return compatExtra ? `${base}
|
|
438
|
+
${compatExtra}` : base;
|
|
439
|
+
}
|
|
440
|
+
return void 0;
|
|
441
|
+
}
|
|
442
|
+
function looksLikeAuthFailure(message) {
|
|
443
|
+
const m = message.toLowerCase();
|
|
444
|
+
if (m.includes("403") || m.includes("forbidden") || m.includes("permission")) return false;
|
|
445
|
+
return m.includes("401") || m.includes("unauthorized") || m.includes("session expired") || m.includes("invalid access token") || m.includes("-1001") || m.includes("\u767B\u5F55") || m.includes("ae-cli auth login");
|
|
446
|
+
}
|
|
447
|
+
function createRuntimeContext(cmd, opts, globalOpts) {
|
|
448
|
+
let _communityReportModule = null;
|
|
449
|
+
async function getCommunityReportClient() {
|
|
450
|
+
if (!_communityReportModule) {
|
|
451
|
+
_communityReportModule = await import("./community-report-client-TJVCLZ3K.js");
|
|
452
|
+
}
|
|
453
|
+
return _communityReportModule;
|
|
454
|
+
}
|
|
455
|
+
let _localDataUploadModule = null;
|
|
456
|
+
async function getLocalDataUploadClient() {
|
|
457
|
+
if (!_localDataUploadModule) {
|
|
458
|
+
_localDataUploadModule = await import("./local-data-upload-client-KCMG6J62.js");
|
|
459
|
+
}
|
|
460
|
+
return _localDataUploadModule;
|
|
461
|
+
}
|
|
462
|
+
const ctx = {
|
|
463
|
+
has(name) {
|
|
464
|
+
return Object.prototype.hasOwnProperty.call(opts, camelCase(name));
|
|
465
|
+
},
|
|
466
|
+
str(name) {
|
|
467
|
+
return String(opts[camelCase(name)] ?? "");
|
|
468
|
+
},
|
|
469
|
+
num(name) {
|
|
470
|
+
const val = opts[camelCase(name)];
|
|
471
|
+
return val !== void 0 ? Number(val) : 0;
|
|
472
|
+
},
|
|
473
|
+
optionalNum(name) {
|
|
474
|
+
const val = opts[camelCase(name)];
|
|
475
|
+
if (val === void 0 || val === null || val === "") return void 0;
|
|
476
|
+
return Number(val);
|
|
477
|
+
},
|
|
478
|
+
int64(name) {
|
|
479
|
+
const val = opts[camelCase(name)];
|
|
480
|
+
if (val === void 0 || val === null || val === "") return 0n;
|
|
481
|
+
return BigInt(String(val));
|
|
482
|
+
},
|
|
483
|
+
optionalInt64(name) {
|
|
484
|
+
const val = opts[camelCase(name)];
|
|
485
|
+
if (val === void 0 || val === null || val === "") return void 0;
|
|
486
|
+
return BigInt(String(val));
|
|
487
|
+
},
|
|
488
|
+
bool(name) {
|
|
489
|
+
return Boolean(opts[camelCase(name)]);
|
|
490
|
+
},
|
|
491
|
+
optionalBool(name) {
|
|
492
|
+
const val = opts[camelCase(name)];
|
|
493
|
+
return typeof val === "boolean" ? val : void 0;
|
|
494
|
+
},
|
|
495
|
+
json(name) {
|
|
496
|
+
const val = opts[camelCase(name)];
|
|
497
|
+
if (val === void 0 || val === null) return void 0;
|
|
498
|
+
if (typeof val === "object") return val;
|
|
499
|
+
try {
|
|
500
|
+
return safeJsonParse(String(val));
|
|
501
|
+
} catch {
|
|
502
|
+
if (cmd.flags.some((flag) => flag.name === name && flag.sensitive)) {
|
|
503
|
+
throw new CliValidationError(`Invalid JSON for --${name}.`, {
|
|
504
|
+
hint: "Provide valid JSON with quoted keys and strings. Sensitive input is omitted from diagnostics."
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
printError("validation", `Invalid JSON for --${name}: ${val}`);
|
|
508
|
+
process.exit(1);
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
list(name) {
|
|
512
|
+
const val = opts[camelCase(name)];
|
|
513
|
+
if (Array.isArray(val)) return val.map(String);
|
|
514
|
+
if (val === void 0 || val === null) return [];
|
|
515
|
+
return [String(val)];
|
|
516
|
+
},
|
|
517
|
+
async communityReport(endpoint, rawBody) {
|
|
518
|
+
const client = await getCommunityReportClient();
|
|
519
|
+
return client.communityReport(endpoint, rawBody);
|
|
520
|
+
},
|
|
521
|
+
async localDataUpload(endpoint, rawBody, options) {
|
|
522
|
+
const client = await getLocalDataUploadClient();
|
|
523
|
+
return client.localDataUpload(endpoint, rawBody, options);
|
|
524
|
+
},
|
|
525
|
+
hostOverride() {
|
|
526
|
+
return globalOpts.host;
|
|
527
|
+
},
|
|
528
|
+
host() {
|
|
529
|
+
if (cmd.service === "kb" && ["+list", "+index", "+grep", "+read"].includes(cmd.command)) {
|
|
530
|
+
const context = readKbExecutionContext();
|
|
531
|
+
if (context) return globalOpts.host || context.origin;
|
|
532
|
+
}
|
|
533
|
+
if (globalOpts.host) return globalOpts.host;
|
|
534
|
+
return getActiveHost();
|
|
535
|
+
},
|
|
536
|
+
mcpUrl() {
|
|
537
|
+
return globalOpts.mcpUrl;
|
|
538
|
+
},
|
|
539
|
+
service() {
|
|
540
|
+
return cmd.service;
|
|
541
|
+
},
|
|
542
|
+
async out(data) {
|
|
543
|
+
await printOutput(data, globalOpts.format, globalOpts.jq, { redactErrors: cmd.sensitiveOutput });
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
return ctx;
|
|
547
|
+
}
|
|
548
|
+
function camelCase(str) {
|
|
549
|
+
return str.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
export {
|
|
553
|
+
runCommand,
|
|
554
|
+
configureBusinessCommands,
|
|
555
|
+
parseProgram
|
|
556
|
+
};
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
shouldNotifyCompat,
|
|
13
13
|
shouldSkipAutoSync,
|
|
14
14
|
shouldSkipCompatCheck
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-LOR4IA26.js";
|
|
16
|
+
import "./chunk-HTZ2MLYA.js";
|
|
17
17
|
import "./chunk-4PSTYEG5.js";
|
|
18
18
|
import "./chunk-Z3Q2AEIN.js";
|
|
19
19
|
export {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
environmentRefreshOutput,
|
|
3
4
|
invalidateBusinessSkillSynchronization,
|
|
4
5
|
refreshEnvironmentAfterLogin,
|
|
5
6
|
refreshEnvironmentConfig
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HSZAIPUX.js";
|
|
7
8
|
import {
|
|
8
9
|
MultiselectCancelled,
|
|
9
10
|
promptSingleSelect
|
|
@@ -15,15 +16,15 @@ import {
|
|
|
15
16
|
import {
|
|
16
17
|
printError,
|
|
17
18
|
printOutput
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-VJUXKVRE.js";
|
|
19
20
|
import {
|
|
20
21
|
fetchCliConfig,
|
|
21
22
|
readCurrentBusinessConfig,
|
|
22
23
|
resolveKbAutoDiscoveryFeature
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-LOR4IA26.js";
|
|
24
25
|
import {
|
|
25
26
|
peekCliToken
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-HTZ2MLYA.js";
|
|
27
28
|
import {
|
|
28
29
|
addHost,
|
|
29
30
|
getActiveHost,
|
|
@@ -80,7 +81,7 @@ Already active: \x1B[1m${item.host.label}\x1B[0m
|
|
|
80
81
|
}
|
|
81
82
|
invalidateBusinessSkillSynchronization();
|
|
82
83
|
setActiveHost(item.host.url);
|
|
83
|
-
await refreshEnvironmentAfterLogin(item.host.url);
|
|
84
|
+
await refreshEnvironmentAfterLogin(item.host.url, { onlyIfChanged: true, progress: refreshProgress });
|
|
84
85
|
process.stderr.write(`
|
|
85
86
|
\x1B[32m\u2713\x1B[0m Active environment: \x1B[1m${item.host.label}\x1B[0m ${item.host.url}
|
|
86
87
|
`);
|
|
@@ -123,7 +124,7 @@ async function promptAddEnvironment() {
|
|
|
123
124
|
`
|
|
124
125
|
);
|
|
125
126
|
if (active) {
|
|
126
|
-
await refreshEnvironmentAfterLogin(url);
|
|
127
|
+
await refreshEnvironmentAfterLogin(url, { onlyIfChanged: true, progress: refreshProgress });
|
|
127
128
|
process.stderr.write(` Authenticate if needed: ae-cli auth login --host ${url}
|
|
128
129
|
`);
|
|
129
130
|
}
|
|
@@ -174,13 +175,17 @@ async function promptRemoveEnvironment(host) {
|
|
|
174
175
|
process.stderr.write(`\x1B[32m\u2713\x1B[0m Removed: ${host.label}
|
|
175
176
|
`);
|
|
176
177
|
if (replacement) {
|
|
177
|
-
await refreshEnvironmentAfterLogin(replacement.url);
|
|
178
|
+
await refreshEnvironmentAfterLogin(replacement.url, { onlyIfChanged: true, progress: refreshProgress });
|
|
178
179
|
process.stderr.write(` Active environment: ${replacement.label} ${replacement.url}
|
|
179
180
|
`);
|
|
180
181
|
} else if (listHosts().length === 0) {
|
|
181
182
|
process.stderr.write(" No AE environments remain.\n");
|
|
182
183
|
}
|
|
183
184
|
}
|
|
185
|
+
function refreshProgress(message) {
|
|
186
|
+
if (process.stderr.isTTY) process.stderr.write(`[ae-cli] ${message}
|
|
187
|
+
`);
|
|
188
|
+
}
|
|
184
189
|
function promptEnvironmentAction(items, initialIndex) {
|
|
185
190
|
const stdin = process.stdin;
|
|
186
191
|
const stderr = process.stderr;
|
|
@@ -271,6 +276,10 @@ async function confirm(question) {
|
|
|
271
276
|
}
|
|
272
277
|
|
|
273
278
|
// src/commands/config.ts
|
|
279
|
+
function refreshProgress2(message) {
|
|
280
|
+
if (process.stderr.isTTY) process.stderr.write(`[ae-cli] ${message}
|
|
281
|
+
`);
|
|
282
|
+
}
|
|
274
283
|
function registerConfig(program) {
|
|
275
284
|
const configCmd = program.command("config").description("Manage AE host environments and read configuration values").action(async () => {
|
|
276
285
|
if (!process.stdin.isTTY || !process.stderr.isTTY) {
|
|
@@ -294,8 +303,10 @@ function registerConfig(program) {
|
|
|
294
303
|
failConfig("No active AE environment configured.", missingAeHostHint());
|
|
295
304
|
return;
|
|
296
305
|
}
|
|
297
|
-
const result = await refreshEnvironmentConfig(host, {
|
|
298
|
-
|
|
306
|
+
const result = await refreshEnvironmentConfig(host, {
|
|
307
|
+
synchronizeSkills: !program.opts().host
|
|
308
|
+
});
|
|
309
|
+
await printOutput(environmentRefreshOutput(program, result), program.opts().format || "json", program.opts().jq);
|
|
299
310
|
if (result.source === "unavailable" || ["failed", "partial", "busy"].includes(result.skills.status)) process.exitCode = 1;
|
|
300
311
|
});
|
|
301
312
|
configCmd.command("show").description("Show effective configuration for the selected AE host and account").action(async () => {
|
|
@@ -332,7 +343,7 @@ function registerConfig(program) {
|
|
|
332
343
|
invalidateBusinessSkillSynchronization();
|
|
333
344
|
addHost(normalized, label);
|
|
334
345
|
setActiveHost(normalized);
|
|
335
|
-
await refreshEnvironmentAfterLogin(normalized);
|
|
346
|
+
await refreshEnvironmentAfterLogin(normalized, { onlyIfChanged: true, progress: refreshProgress2 });
|
|
336
347
|
await printOutput(
|
|
337
348
|
{ activeHost: normalized, label: label.trim() },
|
|
338
349
|
program.opts().format || "json",
|
|
@@ -382,7 +393,7 @@ async function useConfigEnv(program, env) {
|
|
|
382
393
|
}
|
|
383
394
|
invalidateBusinessSkillSynchronization();
|
|
384
395
|
setActiveHost(target.host.url);
|
|
385
|
-
await refreshEnvironmentAfterLogin(target.host.url);
|
|
396
|
+
await refreshEnvironmentAfterLogin(target.host.url, { onlyIfChanged: true, progress: refreshProgress2 });
|
|
386
397
|
await printOutput({ activeHost: target.host.url, label: target.host.label }, program.opts().format || "json", program.opts().jq);
|
|
387
398
|
}
|
|
388
399
|
async function addConfigEnv(program, url, opts) {
|
|
@@ -399,7 +410,9 @@ async function addConfigEnv(program, url, opts) {
|
|
|
399
410
|
invalidateBusinessSkillSynchronization();
|
|
400
411
|
addHost(normalized, opts.label);
|
|
401
412
|
if (opts.use) setActiveHost(normalized);
|
|
402
|
-
if (getActiveHost() === normalized)
|
|
413
|
+
if (getActiveHost() === normalized) {
|
|
414
|
+
await refreshEnvironmentAfterLogin(normalized, { onlyIfChanged: true, progress: refreshProgress2 });
|
|
415
|
+
}
|
|
403
416
|
const saved = loadConfig();
|
|
404
417
|
await printOutput(
|
|
405
418
|
{
|
|
@@ -2,9 +2,9 @@ import { createRequire as __createRequire } from 'node:module'; const require =
|
|
|
2
2
|
import {
|
|
3
3
|
TeAgentApiError,
|
|
4
4
|
getFromMainApp
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5M5LBRR3.js";
|
|
6
6
|
import "./chunk-Y74WTIKJ.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-HTZ2MLYA.js";
|
|
8
8
|
import {
|
|
9
9
|
safeJsonParse
|
|
10
10
|
} from "./chunk-4PSTYEG5.js";
|