@thinkingai/ae-cli 6.0.37 → 6.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -3
- package/README.zh.md +25 -3
- package/dist/{auth-56Z45UVR.js → auth-GDV3H5I4.js} +18 -8
- package/dist/{auth-ENM3FE6L.js → auth-NN55553T.js} +3 -3
- package/dist/{capability-2H6PAOA3.js → capability-TPORIKRQ.js} +19 -15
- package/dist/{capability-YPOQX6PL.js → capability-VQNC5CF7.js} +19 -15
- package/dist/chunk-4NN5IWVN.js +26 -0
- package/dist/{chunk-DB4Q3ANU.js → chunk-6A2FUCIS.js} +3 -3
- package/dist/{chunk-PVBYJWC2.js → chunk-7KQWSBSL.js} +4 -4
- package/dist/{chunk-24BAVOX3.js → chunk-AXDXJTPC.js} +3 -1
- package/dist/{chunk-CPVTECJ3.js → chunk-DT6Y3TD7.js} +5 -5
- package/dist/{chunk-EGEIXA2Z.js → chunk-DWO43OIB.js} +0 -248
- package/dist/{chunk-V6FR6WTW.js → chunk-GJJA4CQZ.js} +34 -2
- package/dist/{chunk-RGXCNC4N.js → chunk-GS2P7LFD.js} +50 -17
- package/dist/{chunk-LYVNONC4.js → chunk-JHENBQ5B.js} +35 -0
- package/dist/{chunk-3P3562ZX.js → chunk-MVDZ7DBQ.js} +5 -5
- package/dist/{chunk-LCXU3AAT.js → chunk-NBPKWKRA.js} +2 -2
- package/dist/{chunk-HQ2A7ITL.js → chunk-RBNKI5ZW.js} +50 -17
- package/dist/{chunk-LHVM35J4.js → chunk-TS6BUGUY.js} +4 -4
- package/dist/chunk-TUKQZTMI.js +250 -0
- package/dist/{chunk-J7MZHDHQ.js → chunk-VKD5WQKN.js} +5 -5
- package/dist/{chunk-3KI3RRXX.js → chunk-VTXHDCBW.js} +3 -3
- package/dist/{chunk-KTYR3U6D.js → chunk-YTG6Q75E.js} +10 -6
- package/dist/{chunk-IR4ZLVPW.js → chunk-YV52FB5G.js} +25 -3
- package/dist/{chunk-E7UXXHO3.js → chunk-Z3OXWCIA.js} +3 -3
- package/dist/{cli-token-4SBMXAUK.js → cli-token-GL5MS5FK.js} +4 -4
- package/dist/{client-PP5FETMW.js → client-DAIPF7XN.js} +4 -4
- package/dist/{community-report-client-KK2QBANO.js → community-report-client-M2RW4MXD.js} +2 -2
- package/dist/config-4VZNLBKF.js +489 -0
- package/dist/index.js +96 -37
- package/dist/memory-RWJW4XFO.js +892 -0
- package/dist/memory-VO2ZJCRT.js +892 -0
- package/dist/{metadata-JIQ77HFY.js → metadata-YGTHR2XJ.js} +8 -8
- package/dist/{metadata-AN3YFZEV.js → metadata-ZRN2GHPN.js} +8 -8
- package/dist/{model-JASQVOFD.js → model-CLUIK3K5.js} +7 -5
- package/dist/{raw-XJCAT3HX.js → raw-52B4UKO4.js} +8 -7
- package/dist/sync-3REDHGY6.js +10259 -0
- package/dist/{te-agent-JHUG6DVV.js → te-agent-XNPELAKX.js} +580 -84
- package/dist/{te-analysis-IWQZO423.js → te-analysis-GJI5FZUL.js} +1611 -25
- package/dist/{te-analysis-X222IRYR.js → te-analysis-N2BRDJZ5.js} +1611 -25
- package/dist/{te-community-QOYIYEJI.js → te-community-SQXKE5OO.js} +7 -7
- package/dist/{te-community-UFKI6ONP.js → te-community-TYSNU3NQ.js} +7 -7
- package/dist/{te-dataops-PZQ5NQLY.js → te-dataops-5TM7WZDI.js} +370 -189
- package/dist/{te-dataops-XTWVTJCA.js → te-dataops-OWIADNSM.js} +370 -189
- package/dist/{te-engage-NLZUPSBK.js → te-engage-F7V55KVW.js} +333 -105
- package/dist/{te-engage-E7F4HTXU.js → te-engage-FMYAYCNV.js} +333 -105
- package/dist/{te-kb-E7NSCBRB.js → te-kb-VRMEY3D4.js} +6 -6
- package/dist/{te-meta-GBDTMPEL.js → te-meta-53BVXPFI.js} +7 -7
- package/dist/{te-meta-ZTLTSHXC.js → te-meta-TOCBPBXI.js} +7 -7
- package/dist/{te-system-AH7DMCAQ.js → te-system-XGS5EQIQ.js} +4 -4
- package/dist/{te-team-BQ3SKSZV.js → te-team-BZRDV2CM.js} +7 -7
- package/dist/{update-DKG6UXEM.js → update-HEDXGOJH.js} +8 -6
- package/package.json +5 -2
- package/skills/ae-agent/SKILL.md +178 -16
- package/skills/ae-agent/references/add-skill.md +22 -10
- package/skills/ae-agent/references/edit-skill.md +24 -14
- package/skills/ae-agent/references/find-archived-conversations.md +82 -0
- package/skills/ae-agent/references/restore-conversation.md +54 -0
- package/skills/ae-agent/references/upload-skill.md +24 -14
- package/skills/ae-analysis/SKILL.md +1 -1
- package/skills/ae-analysis/references/command_index.md +109 -42
- package/skills/ae-analysis/references/debug_data_list.md +28 -0
- package/skills/ae-analysis/references/debug_device_add.md +23 -0
- package/skills/ae-analysis/references/debug_device_list.md +19 -0
- package/skills/ae-analysis/references/debug_device_select.md +22 -0
- package/skills/ae-analysis/references/entity_id_import_options.md +1 -1
- package/skills/ae-analysis/references/plan_sync_display_names.md +28 -0
- package/skills/ae-analysis/references/project_access_detail_get.md +3 -3
- package/skills/ae-analysis/references/project_data_power_delete.md +3 -3
- package/skills/ae-analysis/references/project_data_power_get.md +3 -3
- package/skills/ae-analysis/references/project_data_power_list.md +3 -3
- package/skills/ae-analysis/references/project_data_power_upsert.md +3 -3
- package/skills/ae-analysis/references/project_entity_create.md +3 -3
- package/skills/ae-analysis/references/project_entity_delete.md +3 -3
- package/skills/ae-analysis/references/project_entity_event_list.md +3 -3
- package/skills/ae-analysis/references/project_entity_get.md +3 -3
- package/skills/ae-analysis/references/project_entity_list.md +3 -3
- package/skills/ae-analysis/references/project_entity_update.md +3 -3
- package/skills/ae-analysis/references/project_function_list.md +3 -3
- package/skills/ae-analysis/references/project_info_create.md +25 -0
- package/skills/ae-analysis/references/project_info_delete.md +24 -0
- package/skills/ae-analysis/references/project_info_get.md +3 -3
- package/skills/ae-analysis/references/project_info_list.md +3 -3
- package/skills/ae-analysis/references/project_info_update.md +3 -3
- package/skills/ae-analysis/references/project_mark_time_create.md +3 -3
- package/skills/ae-analysis/references/project_mark_time_delete.md +3 -3
- package/skills/ae-analysis/references/project_mark_time_list.md +3 -3
- package/skills/ae-analysis/references/project_mark_time_update.md +3 -3
- package/skills/ae-analysis/references/project_member_add.md +3 -3
- package/skills/ae-analysis/references/project_member_batch_update.md +3 -3
- package/skills/ae-analysis/references/project_member_candidate_list.md +3 -3
- package/skills/ae-analysis/references/project_member_handover_export.md +3 -3
- package/skills/ae-analysis/references/project_member_handover_run.md +3 -3
- package/skills/ae-analysis/references/project_member_import.md +3 -3
- package/skills/ae-analysis/references/project_member_list.md +3 -3
- package/skills/ae-analysis/references/project_member_receiver_list.md +3 -3
- package/skills/ae-analysis/references/project_member_remove.md +3 -3
- package/skills/ae-analysis/references/project_member_update.md +3 -3
- package/skills/ae-analysis/references/project_owner_update.md +3 -3
- package/skills/ae-analysis/references/project_permission_binding_list.md +3 -3
- package/skills/ae-analysis/references/project_receive_status_update.md +3 -3
- package/skills/ae-analysis/references/project_role_delete.md +3 -3
- package/skills/ae-analysis/references/project_role_function_list.md +3 -3
- package/skills/ae-analysis/references/project_role_get.md +3 -3
- package/skills/ae-analysis/references/project_role_list.md +3 -3
- package/skills/ae-analysis/references/project_role_upsert.md +3 -3
- package/skills/ae-analysis/references/project_role_user_list.md +3 -3
- package/skills/ae-analysis/references/project_space_list.md +1 -1
- package/skills/ae-analysis/references/project_timezone_get.md +3 -3
- package/skills/ae-analysis/references/project_timezone_overview.md +3 -3
- package/skills/ae-analysis/references/project_timezone_update.md +3 -3
- package/skills/ae-analysis/references/project_user_id_items_update.md +3 -3
- package/skills/ae-analysis/references/system_admin_function_list.md +22 -0
- package/skills/ae-analysis/references/system_admin_function_update.md +26 -0
- package/skills/ae-analysis/references/system_admin_list.md +21 -0
- package/skills/ae-analysis/references/system_admin_remove.md +25 -0
- package/skills/ae-analysis/references/system_admin_upsert.md +25 -0
- package/skills/ae-analysis/references/system_function_list.md +21 -0
- package/skills/ae-analysis/references/system_member_add.md +25 -0
- package/skills/ae-analysis/references/system_member_candidate_list.md +22 -0
- package/skills/ae-analysis/references/system_member_delete.md +25 -0
- package/skills/ae-analysis/references/system_member_list.md +24 -0
- package/skills/ae-analysis/references/system_member_mfa_unbind.md +25 -0
- package/skills/ae-analysis/references/system_member_password_reset.md +32 -0
- package/skills/ae-analysis/references/system_member_project_batch_update.md +27 -0
- package/skills/ae-analysis/references/system_member_status_update.md +26 -0
- package/skills/ae-analysis/references/system_member_update.md +23 -0
- package/skills/ae-analysis/references/system_mfa_get.md +21 -0
- package/skills/ae-analysis/references/system_mfa_update.md +25 -0
- package/skills/ae-analysis/references/system_node_monitor_list.md +24 -0
- package/skills/ae-analysis/references/system_oauth2_update.md +22 -0
- package/skills/ae-analysis/references/system_ops_alert_contact_delete.md +25 -0
- package/skills/ae-analysis/references/system_ops_alert_contact_list.md +23 -0
- package/skills/ae-analysis/references/system_ops_alert_contact_test.md +29 -0
- package/skills/ae-analysis/references/system_ops_alert_contact_upsert.md +39 -0
- package/skills/ae-analysis/references/system_preference_get.md +21 -0
- package/skills/ae-analysis/references/system_preference_update.md +22 -0
- package/skills/ae-analysis/references/system_project_usage_list.md +28 -0
- package/skills/ae-analysis/references/system_query_alert_rule_list.md +21 -0
- package/skills/ae-analysis/references/system_query_alert_rule_update.md +26 -0
- package/skills/ae-analysis/references/system_query_monitor_overview.md +26 -0
- package/skills/ae-analysis/references/system_query_task_cancel.md +25 -0
- package/skills/ae-analysis/references/system_query_task_export.md +49 -0
- package/skills/ae-analysis/references/system_query_task_get.md +23 -0
- package/skills/ae-analysis/references/system_query_task_list.md +35 -0
- package/skills/ae-analysis/references/system_query_task_options.md +27 -0
- package/skills/ae-analysis/references/system_receiver_address_delete.md +26 -0
- package/skills/ae-analysis/references/system_receiver_address_overview.md +21 -0
- package/skills/ae-analysis/references/system_receiver_address_project_list.md +21 -0
- package/skills/ae-analysis/references/system_receiver_address_promote.md +24 -0
- package/skills/ae-analysis/references/system_receiver_address_upsert.md +27 -0
- package/skills/ae-analysis/references/system_receiver_detection_get.md +22 -0
- package/skills/ae-analysis/references/system_receiver_detection_run.md +22 -0
- package/skills/ae-analysis/references/system_receiver_detection_update.md +25 -0
- package/skills/ae-analysis/references/system_role_delete.md +26 -0
- package/skills/ae-analysis/references/system_role_function_list.md +22 -0
- package/skills/ae-analysis/references/system_role_get.md +22 -0
- package/skills/ae-analysis/references/system_role_list.md +24 -0
- package/skills/ae-analysis/references/system_role_upsert.md +27 -0
- package/skills/ae-analysis/references/system_role_user_list.md +22 -0
- package/skills/ae-analysis/references/system_seat_list.md +25 -0
- package/skills/ae-analysis/references/system_seat_update.md +26 -0
- package/skills/ae-analysis/references/system_smtp_delete.md +24 -0
- package/skills/ae-analysis/references/system_smtp_get.md +21 -0
- package/skills/ae-analysis/references/system_smtp_test.md +22 -0
- package/skills/ae-analysis/references/system_smtp_upsert.md +31 -0
- package/skills/ae-analysis/references/system_third_party_login_disable.md +25 -0
- package/skills/ae-analysis/references/system_third_party_login_list.md +21 -0
- package/skills/ae-analysis/references/system_third_party_login_upsert.md +33 -0
- package/skills/ae-analysis/references/system_usage_overview.md +21 -0
- package/skills/ae-analysis/references/system_usage_trend_export.md +44 -0
- package/skills/ae-analysis/references/system_usage_trend_query.md +28 -0
- package/skills/ae-dataops/SKILL.md +1 -1
- package/skills/ae-dataops/references/dataops-flow-create.md +51 -16
- package/skills/ae-engage/SKILL.md +56 -26
- package/skills/ae-engage/references/activity-activity.md +3 -0
- package/skills/ae-engage/references/activity-approval.md +12 -4
- package/skills/ae-engage/references/activity-task.md +21 -6
- package/skills/ae-engage/references/activity-topic.md +31 -13
- package/skills/ae-engage/references/add-channel.md +170 -41
- package/skills/ae-engage/references/build-task-save-guide.md +40 -27
- package/skills/ae-engage/references/channel-update-config.md +3 -2
- package/skills/ae-engage/references/common-metric.md +48 -120
- package/skills/ae-engage/references/flow-detail.md +13 -0
- package/skills/ae-engage/references/preset-event.md +12 -32
- package/skills/ae-engage/references/save-flow.md +127 -64
- package/skills/ae-engage/references/save-task.md +197 -59
- package/skills/ae-engage/references/scene-config-metric.md +3 -0
- package/skills/ae-engage/references/scene-preset-metric.md +8 -37
- package/skills/ae-engage/references/scene-strategy-audience.md +51 -643
- package/skills/ae-engage/references/scene-strategy.md +6 -6
- package/skills/ae-engage/references/task-detail.md +10 -0
- package/skills/ae-engage/references/task-submit-approval.md +45 -0
- package/skills/ae-engage/references/validate-flow-node-config.md +1 -1
- package/skills/ae-generate-tracking-code/SKILL.md +24 -8
- package/skills/ae-generate-tracking-code/references/debug-script.md +46 -37
- package/skills/ae-generate-tracking-plan/SKILL.md +26 -1
- package/skills/ae-metadata/SKILL.md +1 -1
- package/dist/config-BSSALXEN.js +0 -128
- package/dist/sync-QFP4XFN3.js +0 -485
|
@@ -1,39 +1,69 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCapabilityCommand
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7KQWSBSL.js";
|
|
4
4
|
import {
|
|
5
5
|
registerCapabilityGatewayRoute,
|
|
6
6
|
resolveGatewayDomain
|
|
7
7
|
} from "./chunk-PTE56QPL.js";
|
|
8
|
+
import {
|
|
9
|
+
withOutputMetadata
|
|
10
|
+
} from "./chunk-YTG6Q75E.js";
|
|
8
11
|
import {
|
|
9
12
|
CapabilityGatewayError,
|
|
10
13
|
buildCapabilityGatewayUrl,
|
|
11
14
|
dryRunCapability,
|
|
15
|
+
executeCapability,
|
|
12
16
|
executeCapabilityWithEnvelope,
|
|
13
17
|
fetchCapabilityGateway,
|
|
14
18
|
requestCapabilityGateway,
|
|
15
19
|
requestCapabilityGatewayWithEnvelope,
|
|
16
20
|
uploadInputFile,
|
|
17
21
|
validateCapability
|
|
18
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-RBNKI5ZW.js";
|
|
23
|
+
import "./chunk-Z3OXWCIA.js";
|
|
24
|
+
import "./chunk-YV52FB5G.js";
|
|
25
|
+
import "./chunk-GJJA4CQZ.js";
|
|
19
26
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-IR4ZLVPW.js";
|
|
24
|
-
import "./chunk-V6FR6WTW.js";
|
|
25
|
-
import "./chunk-24BAVOX3.js";
|
|
26
|
-
import "./chunk-LYVNONC4.js";
|
|
27
|
+
CliValidationError
|
|
28
|
+
} from "./chunk-AXDXJTPC.js";
|
|
29
|
+
import "./chunk-JHENBQ5B.js";
|
|
27
30
|
|
|
28
31
|
// src/commands/te-analysis/capability-shared.ts
|
|
32
|
+
var ANALYSIS_GATEWAY_CLI_SERVICES = /* @__PURE__ */ new Set(["project", "system"]);
|
|
29
33
|
var analysisDataRunRoutingHelp = "Routing: use run only for analysis data that fits <=1000 inline rows and <=180s; use export for full, unknown-size, >1000-row, or long-running data.";
|
|
30
34
|
var analysisDataExportRoutingHelp = "Routing: use export for full, unknown-size, >1000-row, or long-running analysis data; inspect/download by run_id/artifact_id; use run only for <=1000-row inline previews.";
|
|
31
35
|
function createAnalysisCapabilityCommand(config) {
|
|
36
|
+
const cliPath = resolveAnalysisGatewayCliPath(config);
|
|
32
37
|
return createCapabilityCommand({
|
|
33
38
|
...config,
|
|
34
|
-
|
|
39
|
+
...cliPath,
|
|
40
|
+
gatewayDomain: "analysis"
|
|
35
41
|
});
|
|
36
42
|
}
|
|
43
|
+
function resolveAnalysisGatewayCliPath(config) {
|
|
44
|
+
const [capabilityService, capabilityResource, capabilityAction, ...extraSegments] = config.capabilityId.split(".");
|
|
45
|
+
if (!ANALYSIS_GATEWAY_CLI_SERVICES.has(capabilityService)) {
|
|
46
|
+
return {
|
|
47
|
+
cliService: "analysis",
|
|
48
|
+
resource: config.resource,
|
|
49
|
+
command: config.command
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (!capabilityResource || !capabilityAction || extraSegments.length > 0) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
`Capability '${config.capabilityId}' must have exactly three segments for direct CLI registration.`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
const resource = capabilityResource.replaceAll("_", "-");
|
|
58
|
+
const command = capabilityAction.replaceAll("_", "-");
|
|
59
|
+
const expectedLegacyResource = `${capabilityService} ${resource}`;
|
|
60
|
+
if (config.resource !== expectedLegacyResource || config.command !== command) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Capability '${config.capabilityId}' must map to ae-cli ${capabilityService} ${resource} ${command}.`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return { cliService: capabilityService, resource, command };
|
|
66
|
+
}
|
|
37
67
|
function createAnalysisMetaCapabilityCommand(config) {
|
|
38
68
|
return createCapabilityCommand({
|
|
39
69
|
...config,
|
|
@@ -5038,6 +5068,43 @@ var commands47 = [
|
|
|
5038
5068
|
];
|
|
5039
5069
|
var function_default = commands47;
|
|
5040
5070
|
|
|
5071
|
+
// src/commands/te-analysis/project/info/create.ts
|
|
5072
|
+
var projectInfoCreate = createAnalysisCapabilityCommand({
|
|
5073
|
+
resource: "project info",
|
|
5074
|
+
command: "create",
|
|
5075
|
+
capabilityId: "project.info.create",
|
|
5076
|
+
description: "Create a project without exposing unsupported avatar fields.",
|
|
5077
|
+
flags: [
|
|
5078
|
+
{ name: "company-id", type: "number", required: true, min: 1, desc: "Company ID." },
|
|
5079
|
+
{ name: "project-name", type: "string", required: true, minLength: 1, maxLength: 80, desc: "Project name." },
|
|
5080
|
+
{ name: "load-history", type: "boolean", required: false, desc: "Load historical data. Default: false." },
|
|
5081
|
+
{ name: "owner-user-id", type: "number", required: false, min: 1, desc: "Optional owner user ID." },
|
|
5082
|
+
{ name: "project-remark", type: "string", required: false, maxLength: 200, desc: "Optional project remark." }
|
|
5083
|
+
],
|
|
5084
|
+
risk: "write",
|
|
5085
|
+
buildInput: (ctx) => compactInput({
|
|
5086
|
+
company_id: ctx.num("company-id"),
|
|
5087
|
+
project_name: ctx.str("project-name"),
|
|
5088
|
+
load_history: ctx.str("load-history") === "" ? false : ctx.bool("load-history"),
|
|
5089
|
+
owner_user_id: optionalNumber(ctx, "owner-user-id"),
|
|
5090
|
+
project_remark: optionalString(ctx, "project-remark")
|
|
5091
|
+
})
|
|
5092
|
+
});
|
|
5093
|
+
|
|
5094
|
+
// src/commands/te-analysis/project/info/delete.ts
|
|
5095
|
+
var projectInfoDelete = createAnalysisCapabilityCommand({
|
|
5096
|
+
resource: "project info",
|
|
5097
|
+
command: "delete",
|
|
5098
|
+
capabilityId: "project.info.delete",
|
|
5099
|
+
description: "Delete a project and flush its receiver cache.",
|
|
5100
|
+
flags: [projectIdFlag],
|
|
5101
|
+
risk: "high-risk-write",
|
|
5102
|
+
buildInput: (ctx) => compactInput({
|
|
5103
|
+
project_id: ctx.num("project-id"),
|
|
5104
|
+
yes: true
|
|
5105
|
+
})
|
|
5106
|
+
});
|
|
5107
|
+
|
|
5041
5108
|
// src/commands/te-analysis/project/info/get.ts
|
|
5042
5109
|
var projectInfoGet = createAnalysisCapabilityCommand({
|
|
5043
5110
|
resource: "project info",
|
|
@@ -5095,6 +5162,8 @@ var projectInfoUpdate = createAnalysisCapabilityCommand({
|
|
|
5095
5162
|
|
|
5096
5163
|
// src/commands/te-analysis/project/info/index.ts
|
|
5097
5164
|
var commands48 = [
|
|
5165
|
+
projectInfoCreate,
|
|
5166
|
+
projectInfoDelete,
|
|
5098
5167
|
projectInfoGet,
|
|
5099
5168
|
projectInfoList,
|
|
5100
5169
|
projectInfoUpdate
|
|
@@ -5860,6 +5929,24 @@ var dataTypeFlag = {
|
|
|
5860
5929
|
required: false,
|
|
5861
5930
|
desc: "Live data type: normal (default) or error."
|
|
5862
5931
|
};
|
|
5932
|
+
var debugDeviceIdFlag = {
|
|
5933
|
+
name: "device-id",
|
|
5934
|
+
type: "string",
|
|
5935
|
+
required: true,
|
|
5936
|
+
desc: "Debug device ID reported by the SDK as #device_id."
|
|
5937
|
+
};
|
|
5938
|
+
var debugDeviceNameFlag = {
|
|
5939
|
+
name: "device-name",
|
|
5940
|
+
type: "string",
|
|
5941
|
+
required: true,
|
|
5942
|
+
desc: "Human-readable name for the Debug device."
|
|
5943
|
+
};
|
|
5944
|
+
var eventNameFlag = {
|
|
5945
|
+
name: "event-name",
|
|
5946
|
+
type: "string",
|
|
5947
|
+
required: false,
|
|
5948
|
+
desc: "Optional event name filter."
|
|
5949
|
+
};
|
|
5863
5950
|
var eventNamesFlag = {
|
|
5864
5951
|
name: "event-names",
|
|
5865
5952
|
type: "json",
|
|
@@ -6086,6 +6173,323 @@ var trackingPlanSyncFromMeta = createTrackingCapabilityCommand({
|
|
|
6086
6173
|
buildInput: projectInput2
|
|
6087
6174
|
});
|
|
6088
6175
|
|
|
6176
|
+
// src/commands/te-analysis/tracking/plan/sync-display-names.ts
|
|
6177
|
+
import { existsSync as existsSync3 } from "fs";
|
|
6178
|
+
import { readFile } from "fs/promises";
|
|
6179
|
+
|
|
6180
|
+
// src/tracking/plan/display-name-sync.ts
|
|
6181
|
+
function buildDisplayNameSyncPlan(draft, metadata) {
|
|
6182
|
+
return {
|
|
6183
|
+
event: buildGroup(
|
|
6184
|
+
"event",
|
|
6185
|
+
eventDefinitions(draft.events),
|
|
6186
|
+
existingDefinitions(metadata.events, "event_name", "event_desc")
|
|
6187
|
+
),
|
|
6188
|
+
event_property: buildGroup(
|
|
6189
|
+
"event_property",
|
|
6190
|
+
propertyDefinitions([
|
|
6191
|
+
...draft.common_event_properties,
|
|
6192
|
+
...draft.event_properties
|
|
6193
|
+
]),
|
|
6194
|
+
existingDefinitions(metadata.eventProperties, "prop_name", "prop_desc")
|
|
6195
|
+
),
|
|
6196
|
+
user_property: buildGroup(
|
|
6197
|
+
"user_property",
|
|
6198
|
+
propertyDefinitions(draft.user_properties),
|
|
6199
|
+
existingDefinitions(metadata.userProperties, "prop_name", "prop_desc")
|
|
6200
|
+
)
|
|
6201
|
+
};
|
|
6202
|
+
}
|
|
6203
|
+
function assertTrackingDraft(value) {
|
|
6204
|
+
if (!isRecord(value)) {
|
|
6205
|
+
throw new Error("Tracking draft must be a JSON object.");
|
|
6206
|
+
}
|
|
6207
|
+
for (const field of [
|
|
6208
|
+
"events",
|
|
6209
|
+
"event_properties",
|
|
6210
|
+
"common_event_properties",
|
|
6211
|
+
"user_properties"
|
|
6212
|
+
]) {
|
|
6213
|
+
if (!Array.isArray(value[field])) {
|
|
6214
|
+
throw new Error(`Tracking draft field "${field}" must be an array.`);
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6217
|
+
}
|
|
6218
|
+
function eventDefinitions(events) {
|
|
6219
|
+
return definitions(
|
|
6220
|
+
events.map((event) => ({
|
|
6221
|
+
name: event.event_name,
|
|
6222
|
+
displayName: event.display_name
|
|
6223
|
+
})),
|
|
6224
|
+
"event"
|
|
6225
|
+
);
|
|
6226
|
+
}
|
|
6227
|
+
function propertyDefinitions(properties) {
|
|
6228
|
+
return definitions(
|
|
6229
|
+
properties.map((property) => ({
|
|
6230
|
+
name: property.name,
|
|
6231
|
+
displayName: property.display_name
|
|
6232
|
+
})),
|
|
6233
|
+
"property"
|
|
6234
|
+
);
|
|
6235
|
+
}
|
|
6236
|
+
function definitions(candidates, kind) {
|
|
6237
|
+
const byName = /* @__PURE__ */ new Map();
|
|
6238
|
+
const missing = /* @__PURE__ */ new Set();
|
|
6239
|
+
for (const candidate of candidates) {
|
|
6240
|
+
const name = nonEmptyString(candidate.name);
|
|
6241
|
+
if (!name) continue;
|
|
6242
|
+
const displayName = nonEmptyString(candidate.displayName);
|
|
6243
|
+
if (!displayName) {
|
|
6244
|
+
if (!byName.has(name)) missing.add(name);
|
|
6245
|
+
continue;
|
|
6246
|
+
}
|
|
6247
|
+
const previous = byName.get(name);
|
|
6248
|
+
if (previous && previous !== displayName) {
|
|
6249
|
+
throw new Error(
|
|
6250
|
+
`Tracking draft maps ${kind} "${name}" to conflicting display names: "${previous}" and "${displayName}".`
|
|
6251
|
+
);
|
|
6252
|
+
}
|
|
6253
|
+
byName.set(name, displayName);
|
|
6254
|
+
missing.delete(name);
|
|
6255
|
+
}
|
|
6256
|
+
return {
|
|
6257
|
+
definitions: [...byName.entries()].map(([name, displayName]) => ({
|
|
6258
|
+
name,
|
|
6259
|
+
displayName
|
|
6260
|
+
})),
|
|
6261
|
+
missing: [...missing]
|
|
6262
|
+
};
|
|
6263
|
+
}
|
|
6264
|
+
function existingDefinitions(value, nameField, displayNameField) {
|
|
6265
|
+
if (!Array.isArray(value)) return [];
|
|
6266
|
+
const rows = [];
|
|
6267
|
+
for (const item of value) {
|
|
6268
|
+
if (!isRecord(item)) continue;
|
|
6269
|
+
const name = nonEmptyString(item[nameField]);
|
|
6270
|
+
if (!name) continue;
|
|
6271
|
+
rows.push({
|
|
6272
|
+
name,
|
|
6273
|
+
displayName: nonEmptyString(item[displayNameField])
|
|
6274
|
+
});
|
|
6275
|
+
}
|
|
6276
|
+
return rows;
|
|
6277
|
+
}
|
|
6278
|
+
function buildGroup(type, source, existing) {
|
|
6279
|
+
const existingByName = new Map(
|
|
6280
|
+
existing.map((item) => [item.name, item.displayName])
|
|
6281
|
+
);
|
|
6282
|
+
const items = [];
|
|
6283
|
+
const skippedExisting = [];
|
|
6284
|
+
const missingInMetadata = [];
|
|
6285
|
+
for (const definition of source.definitions) {
|
|
6286
|
+
if (!existingByName.has(definition.name)) {
|
|
6287
|
+
missingInMetadata.push(definition.name);
|
|
6288
|
+
continue;
|
|
6289
|
+
}
|
|
6290
|
+
if (existingByName.get(definition.name)) {
|
|
6291
|
+
skippedExisting.push(definition.name);
|
|
6292
|
+
continue;
|
|
6293
|
+
}
|
|
6294
|
+
items.push(
|
|
6295
|
+
type === "event" ? { event_name: definition.name, event_desc: definition.displayName } : { prop_name: definition.name, prop_desc: definition.displayName }
|
|
6296
|
+
);
|
|
6297
|
+
}
|
|
6298
|
+
return {
|
|
6299
|
+
type,
|
|
6300
|
+
items,
|
|
6301
|
+
skippedExisting,
|
|
6302
|
+
missingInMetadata,
|
|
6303
|
+
missingInDraft: source.missing
|
|
6304
|
+
};
|
|
6305
|
+
}
|
|
6306
|
+
function nonEmptyString(value) {
|
|
6307
|
+
if (typeof value !== "string") return void 0;
|
|
6308
|
+
const trimmed = value.trim();
|
|
6309
|
+
return trimmed ? trimmed : void 0;
|
|
6310
|
+
}
|
|
6311
|
+
function isRecord(value) {
|
|
6312
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6313
|
+
}
|
|
6314
|
+
|
|
6315
|
+
// src/commands/te-analysis/tracking/plan/sync-display-names.ts
|
|
6316
|
+
var GATEWAY_DOMAIN = "analysis";
|
|
6317
|
+
var LIST_CAPABILITIES = {
|
|
6318
|
+
events: "metadata.event.list",
|
|
6319
|
+
eventProperties: "metadata.property.list",
|
|
6320
|
+
userProperties: "metadata.property.list"
|
|
6321
|
+
};
|
|
6322
|
+
var EDIT_CAPABILITY = "metadata.super_metadata.batch_edit";
|
|
6323
|
+
var MAX_BATCH_SIZE = 200;
|
|
6324
|
+
var trackingPlanSyncDisplayNames = {
|
|
6325
|
+
service: "tracking",
|
|
6326
|
+
resource: "plan",
|
|
6327
|
+
command: "sync-display-names",
|
|
6328
|
+
description: "Fill blank event and property metadata display names from a local tracking-plan draft. Existing non-empty display names are never overwritten.",
|
|
6329
|
+
flags: [
|
|
6330
|
+
projectIdFlag,
|
|
6331
|
+
{
|
|
6332
|
+
name: "draft",
|
|
6333
|
+
type: "string",
|
|
6334
|
+
required: true,
|
|
6335
|
+
desc: "Local tracking-plan draft.json containing event/property display_name values."
|
|
6336
|
+
}
|
|
6337
|
+
],
|
|
6338
|
+
risk: "write",
|
|
6339
|
+
validate: (ctx) => {
|
|
6340
|
+
if (!existsSync3(ctx.str("draft"))) {
|
|
6341
|
+
throw new Error(
|
|
6342
|
+
"--draft must reference a readable tracking-plan JSON file."
|
|
6343
|
+
);
|
|
6344
|
+
}
|
|
6345
|
+
},
|
|
6346
|
+
dryRun: async (ctx) => {
|
|
6347
|
+
const draft = await readDraft(ctx.str("draft"));
|
|
6348
|
+
return {
|
|
6349
|
+
project_id: ctx.num("project-id"),
|
|
6350
|
+
draft: ctx.str("draft"),
|
|
6351
|
+
source_counts: sourceCounts(draft),
|
|
6352
|
+
behavior: "Fill blank metadata display names only; preserve all existing non-empty display names.",
|
|
6353
|
+
steps: [
|
|
6354
|
+
...Object.values(LIST_CAPABILITIES).map((capabilityId) => ({
|
|
6355
|
+
method: "POST",
|
|
6356
|
+
url: buildCapabilityGatewayUrl(
|
|
6357
|
+
ctx.host(),
|
|
6358
|
+
GATEWAY_DOMAIN,
|
|
6359
|
+
`capabilities/${capabilityId}/execute`
|
|
6360
|
+
)
|
|
6361
|
+
})),
|
|
6362
|
+
{
|
|
6363
|
+
method: "POST",
|
|
6364
|
+
url: buildCapabilityGatewayUrl(
|
|
6365
|
+
ctx.host(),
|
|
6366
|
+
GATEWAY_DOMAIN,
|
|
6367
|
+
`capabilities/${EDIT_CAPABILITY}/execute`
|
|
6368
|
+
),
|
|
6369
|
+
note: "Called only for non-empty update groups, in batches of at most 200 items."
|
|
6370
|
+
}
|
|
6371
|
+
]
|
|
6372
|
+
};
|
|
6373
|
+
},
|
|
6374
|
+
execute: async (ctx) => {
|
|
6375
|
+
const projectId = ctx.num("project-id");
|
|
6376
|
+
const draftPath = ctx.str("draft");
|
|
6377
|
+
const draft = await readDraft(draftPath);
|
|
6378
|
+
const [eventResult, eventPropertyResult, userPropertyResult] = await Promise.all([
|
|
6379
|
+
executeCapability(
|
|
6380
|
+
ctx.host(),
|
|
6381
|
+
GATEWAY_DOMAIN,
|
|
6382
|
+
LIST_CAPABILITIES.events,
|
|
6383
|
+
{
|
|
6384
|
+
project_id: projectId,
|
|
6385
|
+
fields: ["event_name", "event_desc"]
|
|
6386
|
+
}
|
|
6387
|
+
),
|
|
6388
|
+
executeCapability(
|
|
6389
|
+
ctx.host(),
|
|
6390
|
+
GATEWAY_DOMAIN,
|
|
6391
|
+
LIST_CAPABILITIES.eventProperties,
|
|
6392
|
+
{
|
|
6393
|
+
project_id: projectId,
|
|
6394
|
+
table_type: "event",
|
|
6395
|
+
fields: ["prop_name", "prop_desc"]
|
|
6396
|
+
}
|
|
6397
|
+
),
|
|
6398
|
+
executeCapability(
|
|
6399
|
+
ctx.host(),
|
|
6400
|
+
GATEWAY_DOMAIN,
|
|
6401
|
+
LIST_CAPABILITIES.userProperties,
|
|
6402
|
+
{
|
|
6403
|
+
project_id: projectId,
|
|
6404
|
+
table_type: "user",
|
|
6405
|
+
fields: ["prop_name", "prop_desc"]
|
|
6406
|
+
}
|
|
6407
|
+
)
|
|
6408
|
+
]);
|
|
6409
|
+
const plan = buildDisplayNameSyncPlan(draft, {
|
|
6410
|
+
events: eventResult?.events,
|
|
6411
|
+
eventProperties: eventPropertyResult?.properties,
|
|
6412
|
+
userProperties: userPropertyResult?.properties
|
|
6413
|
+
});
|
|
6414
|
+
const updateResults = {};
|
|
6415
|
+
for (const group of Object.values(plan)) {
|
|
6416
|
+
updateResults[group.type] = await executeUpdates(ctx, projectId, group);
|
|
6417
|
+
}
|
|
6418
|
+
return {
|
|
6419
|
+
project_id: projectId,
|
|
6420
|
+
draft: draftPath,
|
|
6421
|
+
policy: "blank_only",
|
|
6422
|
+
updated: counts(plan, (group) => group.items.length),
|
|
6423
|
+
skipped_existing: counts(plan, (group) => group.skippedExisting.length),
|
|
6424
|
+
missing_in_metadata: counts(
|
|
6425
|
+
plan,
|
|
6426
|
+
(group) => group.missingInMetadata.length
|
|
6427
|
+
),
|
|
6428
|
+
missing_display_name_in_draft: counts(
|
|
6429
|
+
plan,
|
|
6430
|
+
(group) => group.missingInDraft.length
|
|
6431
|
+
),
|
|
6432
|
+
details: {
|
|
6433
|
+
missing_in_metadata: Object.fromEntries(
|
|
6434
|
+
Object.values(plan).map((group) => [
|
|
6435
|
+
group.type,
|
|
6436
|
+
group.missingInMetadata
|
|
6437
|
+
])
|
|
6438
|
+
),
|
|
6439
|
+
missing_display_name_in_draft: Object.fromEntries(
|
|
6440
|
+
Object.values(plan).map((group) => [
|
|
6441
|
+
group.type,
|
|
6442
|
+
group.missingInDraft
|
|
6443
|
+
])
|
|
6444
|
+
)
|
|
6445
|
+
},
|
|
6446
|
+
batches: updateResults
|
|
6447
|
+
};
|
|
6448
|
+
}
|
|
6449
|
+
};
|
|
6450
|
+
async function readDraft(filePath) {
|
|
6451
|
+
let value;
|
|
6452
|
+
try {
|
|
6453
|
+
value = JSON.parse(await readFile(filePath, "utf8"));
|
|
6454
|
+
} catch (error) {
|
|
6455
|
+
throw new Error(
|
|
6456
|
+
`Unable to read tracking draft "${filePath}": ${error instanceof Error ? error.message : String(error)}`
|
|
6457
|
+
);
|
|
6458
|
+
}
|
|
6459
|
+
assertTrackingDraft(value);
|
|
6460
|
+
return value;
|
|
6461
|
+
}
|
|
6462
|
+
async function executeUpdates(ctx, projectId, group) {
|
|
6463
|
+
const results = [];
|
|
6464
|
+
for (let offset = 0; offset < group.items.length; offset += MAX_BATCH_SIZE) {
|
|
6465
|
+
const items = group.items.slice(offset, offset + MAX_BATCH_SIZE);
|
|
6466
|
+
results.push(
|
|
6467
|
+
await executeCapability(ctx.host(), GATEWAY_DOMAIN, EDIT_CAPABILITY, {
|
|
6468
|
+
project_id: projectId,
|
|
6469
|
+
type: group.type,
|
|
6470
|
+
items
|
|
6471
|
+
})
|
|
6472
|
+
);
|
|
6473
|
+
}
|
|
6474
|
+
return results;
|
|
6475
|
+
}
|
|
6476
|
+
function sourceCounts(draft) {
|
|
6477
|
+
return {
|
|
6478
|
+
event: draft.events.length,
|
|
6479
|
+
event_property: new Set(
|
|
6480
|
+
[...draft.common_event_properties, ...draft.event_properties].map(
|
|
6481
|
+
(property) => property.name
|
|
6482
|
+
)
|
|
6483
|
+
).size,
|
|
6484
|
+
user_property: draft.user_properties.length
|
|
6485
|
+
};
|
|
6486
|
+
}
|
|
6487
|
+
function counts(plan, value) {
|
|
6488
|
+
return Object.fromEntries(
|
|
6489
|
+
Object.values(plan).map((group) => [group.type, value(group)])
|
|
6490
|
+
);
|
|
6491
|
+
}
|
|
6492
|
+
|
|
6089
6493
|
// src/commands/te-analysis/tracking/plan/index.ts
|
|
6090
6494
|
var commands63 = [
|
|
6091
6495
|
trackingPlanGet,
|
|
@@ -6094,7 +6498,8 @@ var commands63 = [
|
|
|
6094
6498
|
trackingPlanGenerate,
|
|
6095
6499
|
trackingPlanExport,
|
|
6096
6500
|
trackingPlanImportExcel,
|
|
6097
|
-
trackingPlanSyncFromMeta
|
|
6501
|
+
trackingPlanSyncFromMeta,
|
|
6502
|
+
trackingPlanSyncDisplayNames
|
|
6098
6503
|
];
|
|
6099
6504
|
var plan_default = commands63;
|
|
6100
6505
|
|
|
@@ -6329,8 +6734,116 @@ var commands70 = [
|
|
|
6329
6734
|
];
|
|
6330
6735
|
var event_blacklist_default = commands70;
|
|
6331
6736
|
|
|
6332
|
-
// src/commands/te-analysis/tracking/
|
|
6737
|
+
// src/commands/te-analysis/tracking/debug-device/add.ts
|
|
6738
|
+
var trackingDebugDeviceAdd = createTrackingCapabilityCommand({
|
|
6739
|
+
resource: "debug-device",
|
|
6740
|
+
command: "add",
|
|
6741
|
+
capabilityId: "tracking.debug_device.add",
|
|
6742
|
+
description: "Create or update a Debug device for an AE project.",
|
|
6743
|
+
flags: [projectIdFlag, debugDeviceIdFlag, debugDeviceNameFlag],
|
|
6744
|
+
risk: "write",
|
|
6745
|
+
buildInput: (ctx) => ({
|
|
6746
|
+
...projectInput2(ctx),
|
|
6747
|
+
device_id: ctx.str("device-id"),
|
|
6748
|
+
device_name: ctx.str("device-name")
|
|
6749
|
+
})
|
|
6750
|
+
});
|
|
6751
|
+
|
|
6752
|
+
// src/commands/te-analysis/tracking/debug-device/list.ts
|
|
6753
|
+
var trackingDebugDeviceList = createTrackingCapabilityCommand({
|
|
6754
|
+
resource: "debug-device",
|
|
6755
|
+
command: "list",
|
|
6756
|
+
capabilityId: "tracking.debug_device.list",
|
|
6757
|
+
description: "List Debug devices and the device selected by the current CLI user.",
|
|
6758
|
+
flags: [projectIdFlag],
|
|
6759
|
+
risk: "read",
|
|
6760
|
+
buildInput: projectInput2
|
|
6761
|
+
});
|
|
6762
|
+
|
|
6763
|
+
// src/commands/te-analysis/tracking/debug-device/select.ts
|
|
6764
|
+
var trackingDebugDeviceSelect = createTrackingCapabilityCommand({
|
|
6765
|
+
resource: "debug-device",
|
|
6766
|
+
command: "select",
|
|
6767
|
+
capabilityId: "tracking.debug_device.select",
|
|
6768
|
+
description: "Select the active Debug device for the current CLI user.",
|
|
6769
|
+
flags: [projectIdFlag, debugDeviceIdFlag],
|
|
6770
|
+
risk: "write",
|
|
6771
|
+
buildInput: (ctx) => ({
|
|
6772
|
+
...projectInput2(ctx),
|
|
6773
|
+
device_id: ctx.str("device-id")
|
|
6774
|
+
})
|
|
6775
|
+
});
|
|
6776
|
+
|
|
6777
|
+
// src/commands/te-analysis/tracking/debug-device/index.ts
|
|
6333
6778
|
var commands71 = [
|
|
6779
|
+
trackingDebugDeviceList,
|
|
6780
|
+
trackingDebugDeviceAdd,
|
|
6781
|
+
trackingDebugDeviceSelect
|
|
6782
|
+
];
|
|
6783
|
+
var debug_device_default = commands71;
|
|
6784
|
+
|
|
6785
|
+
// src/commands/te-analysis/tracking/debug-data/list.ts
|
|
6786
|
+
var debugStartTimeFlag = {
|
|
6787
|
+
name: "start-time",
|
|
6788
|
+
type: "string",
|
|
6789
|
+
required: false,
|
|
6790
|
+
desc: "Query start time in YYYY-MM-DD HH:mm:ss local time. Defaults to one hour ago."
|
|
6791
|
+
};
|
|
6792
|
+
var trackingDebugDataList = createTrackingCapabilityCommand({
|
|
6793
|
+
resource: "debug-data",
|
|
6794
|
+
command: "list",
|
|
6795
|
+
capabilityId: "tracking.debug_data.list",
|
|
6796
|
+
description: "List Debug data received from one device.",
|
|
6797
|
+
flags: [projectIdFlag, debugDeviceIdFlag, debugStartTimeFlag, eventNameFlag],
|
|
6798
|
+
risk: "read",
|
|
6799
|
+
buildInput: (ctx) => compactInput({
|
|
6800
|
+
...projectInput2(ctx),
|
|
6801
|
+
device_id: ctx.str("device-id"),
|
|
6802
|
+
start_time: optionalString(ctx, "start-time") ?? formatLocalTime(new Date(Date.now() - 60 * 60 * 1e3)),
|
|
6803
|
+
event_name: optionalString(ctx, "event-name")
|
|
6804
|
+
}),
|
|
6805
|
+
postProcess: (result, input) => {
|
|
6806
|
+
const data = isRecord2(result) ? result : {};
|
|
6807
|
+
const eventList = Array.isArray(data.event_list) ? data.event_list : [];
|
|
6808
|
+
const deviceDataList = Array.isArray(data.device_data_list) ? data.device_data_list : [];
|
|
6809
|
+
return {
|
|
6810
|
+
device_id: input.device_id,
|
|
6811
|
+
start_time: input.start_time,
|
|
6812
|
+
...input.event_name ? { event_name: input.event_name } : {},
|
|
6813
|
+
has_data: deviceDataList.length > 0,
|
|
6814
|
+
event_count: eventList.length,
|
|
6815
|
+
data_count: deviceDataList.length,
|
|
6816
|
+
event_list: eventList,
|
|
6817
|
+
device_data_list: deviceDataList
|
|
6818
|
+
};
|
|
6819
|
+
}
|
|
6820
|
+
});
|
|
6821
|
+
function formatLocalTime(value) {
|
|
6822
|
+
const pad = (part) => String(part).padStart(2, "0");
|
|
6823
|
+
return [
|
|
6824
|
+
value.getFullYear(),
|
|
6825
|
+
"-",
|
|
6826
|
+
pad(value.getMonth() + 1),
|
|
6827
|
+
"-",
|
|
6828
|
+
pad(value.getDate()),
|
|
6829
|
+
" ",
|
|
6830
|
+
pad(value.getHours()),
|
|
6831
|
+
":",
|
|
6832
|
+
pad(value.getMinutes()),
|
|
6833
|
+
":",
|
|
6834
|
+
pad(value.getSeconds())
|
|
6835
|
+
].join("");
|
|
6836
|
+
}
|
|
6837
|
+
function isRecord2(value) {
|
|
6838
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6839
|
+
}
|
|
6840
|
+
|
|
6841
|
+
// src/commands/te-analysis/tracking/debug-data/index.ts
|
|
6842
|
+
var commands72 = [trackingDebugDataList];
|
|
6843
|
+
var debug_data_default = commands72;
|
|
6844
|
+
|
|
6845
|
+
// src/commands/te-analysis/tracking/index.ts
|
|
6846
|
+
var commands73 = [
|
|
6334
6847
|
...plan_default,
|
|
6335
6848
|
...sdk_sample_default,
|
|
6336
6849
|
...plan_change_log_default,
|
|
@@ -6338,9 +6851,11 @@ var commands71 = [
|
|
|
6338
6851
|
...ingest_default,
|
|
6339
6852
|
...ingest_error_default,
|
|
6340
6853
|
...live_data_default,
|
|
6341
|
-
...event_blacklist_default
|
|
6854
|
+
...event_blacklist_default,
|
|
6855
|
+
...debug_device_default,
|
|
6856
|
+
...debug_data_default
|
|
6342
6857
|
];
|
|
6343
|
-
var tracking_default =
|
|
6858
|
+
var tracking_default = commands73;
|
|
6344
6859
|
|
|
6345
6860
|
// src/commands/te-analysis/alert/shared.ts
|
|
6346
6861
|
var alertIdFlag = {
|
|
@@ -6460,7 +6975,7 @@ var analysisAlertStop = createAnalysisCapabilityCommand({
|
|
|
6460
6975
|
});
|
|
6461
6976
|
|
|
6462
6977
|
// src/commands/te-analysis/alert/index.ts
|
|
6463
|
-
var
|
|
6978
|
+
var commands74 = [
|
|
6464
6979
|
analysisAlertList,
|
|
6465
6980
|
analysisAlertGet,
|
|
6466
6981
|
analysisAlertCreate,
|
|
@@ -6469,7 +6984,7 @@ var commands72 = [
|
|
|
6469
6984
|
analysisAlertStart,
|
|
6470
6985
|
analysisAlertStop
|
|
6471
6986
|
];
|
|
6472
|
-
var alert_default =
|
|
6987
|
+
var alert_default = commands74;
|
|
6473
6988
|
|
|
6474
6989
|
// src/commands/te-analysis/alert-detail/list.ts
|
|
6475
6990
|
var analysisAlertDetailList = createAnalysisCapabilityCommand({
|
|
@@ -6483,10 +6998,10 @@ var analysisAlertDetailList = createAnalysisCapabilityCommand({
|
|
|
6483
6998
|
});
|
|
6484
6999
|
|
|
6485
7000
|
// src/commands/te-analysis/alert-detail/index.ts
|
|
6486
|
-
var
|
|
7001
|
+
var commands75 = [
|
|
6487
7002
|
analysisAlertDetailList
|
|
6488
7003
|
];
|
|
6489
|
-
var alert_detail_default =
|
|
7004
|
+
var alert_detail_default = commands75;
|
|
6490
7005
|
|
|
6491
7006
|
// src/commands/te-analysis/alert-job/list.ts
|
|
6492
7007
|
var analysisAlertJobList = createAnalysisCapabilityCommand({
|
|
@@ -6500,10 +7015,10 @@ var analysisAlertJobList = createAnalysisCapabilityCommand({
|
|
|
6500
7015
|
});
|
|
6501
7016
|
|
|
6502
7017
|
// src/commands/te-analysis/alert-job/index.ts
|
|
6503
|
-
var
|
|
7018
|
+
var commands76 = [
|
|
6504
7019
|
analysisAlertJobList
|
|
6505
7020
|
];
|
|
6506
|
-
var alert_job_default =
|
|
7021
|
+
var alert_job_default = commands76;
|
|
6507
7022
|
|
|
6508
7023
|
// src/commands/te-analysis/alert-notice-config/list.ts
|
|
6509
7024
|
var analysisAlertNoticeConfigList = createAnalysisCapabilityCommand({
|
|
@@ -6517,13 +7032,1083 @@ var analysisAlertNoticeConfigList = createAnalysisCapabilityCommand({
|
|
|
6517
7032
|
});
|
|
6518
7033
|
|
|
6519
7034
|
// src/commands/te-analysis/alert-notice-config/index.ts
|
|
6520
|
-
var
|
|
7035
|
+
var commands77 = [
|
|
6521
7036
|
analysisAlertNoticeConfigList
|
|
6522
7037
|
];
|
|
6523
|
-
var alert_notice_config_default =
|
|
7038
|
+
var alert_notice_config_default = commands77;
|
|
7039
|
+
|
|
7040
|
+
// src/commands/te-analysis/system/shared.ts
|
|
7041
|
+
import { readFileSync, statSync as statSync2 } from "fs";
|
|
7042
|
+
var secretValues = /* @__PURE__ */ new WeakMap();
|
|
7043
|
+
var companyIdField = {
|
|
7044
|
+
flag: "company-id",
|
|
7045
|
+
input: "company_id",
|
|
7046
|
+
type: "number",
|
|
7047
|
+
required: true,
|
|
7048
|
+
min: 1,
|
|
7049
|
+
desc: "Company ID."
|
|
7050
|
+
};
|
|
7051
|
+
var queryField = {
|
|
7052
|
+
flag: "query",
|
|
7053
|
+
type: "string",
|
|
7054
|
+
desc: "Optional keyword filter."
|
|
7055
|
+
};
|
|
7056
|
+
var limitField = {
|
|
7057
|
+
flag: "limit",
|
|
7058
|
+
type: "number",
|
|
7059
|
+
min: 1,
|
|
7060
|
+
max: 200,
|
|
7061
|
+
desc: "Page size. Default and maximum depend on the capability schema."
|
|
7062
|
+
};
|
|
7063
|
+
var offsetField = {
|
|
7064
|
+
flag: "offset",
|
|
7065
|
+
type: "number",
|
|
7066
|
+
min: 0,
|
|
7067
|
+
desc: "Zero-based result offset."
|
|
7068
|
+
};
|
|
7069
|
+
var fieldsField = {
|
|
7070
|
+
flag: "fields",
|
|
7071
|
+
type: "json",
|
|
7072
|
+
array: true,
|
|
7073
|
+
desc: "Optional snake_case result field projection JSON array."
|
|
7074
|
+
};
|
|
7075
|
+
function defineSystemCommand(spec) {
|
|
7076
|
+
const fields = [companyIdField, ...spec.fields ?? []];
|
|
7077
|
+
const secrets = spec.secrets ?? [];
|
|
7078
|
+
return createAnalysisCapabilityCommand({
|
|
7079
|
+
resource: `system ${spec.resource}`,
|
|
7080
|
+
command: spec.command,
|
|
7081
|
+
capabilityId: spec.capabilityId,
|
|
7082
|
+
description: spec.description,
|
|
7083
|
+
flags: [
|
|
7084
|
+
...fields.map(fieldFlag),
|
|
7085
|
+
...secrets.flatMap(secretFlags)
|
|
7086
|
+
],
|
|
7087
|
+
risk: spec.risk,
|
|
7088
|
+
validate: (ctx) => {
|
|
7089
|
+
validateSecretSources(ctx, secrets);
|
|
7090
|
+
const input = buildSystemInput(ctx, fields, [], spec.risk);
|
|
7091
|
+
for (const secret of secrets) {
|
|
7092
|
+
if (ctx.str(`${secret.flag}-file`) || ctx.bool(`${secret.flag}-stdin`)) {
|
|
7093
|
+
input[secret.input] = "<provided>";
|
|
7094
|
+
}
|
|
7095
|
+
}
|
|
7096
|
+
validateFields(fields, input);
|
|
7097
|
+
spec.validate?.(ctx, input);
|
|
7098
|
+
},
|
|
7099
|
+
buildInput: (ctx) => {
|
|
7100
|
+
const input = buildSystemInput(ctx, fields, secrets, spec.risk);
|
|
7101
|
+
validateFields(fields, input);
|
|
7102
|
+
validateSecretSources(ctx, secrets);
|
|
7103
|
+
spec.validate?.(ctx, input);
|
|
7104
|
+
return input;
|
|
7105
|
+
}
|
|
7106
|
+
});
|
|
7107
|
+
}
|
|
7108
|
+
function fieldFlag(field) {
|
|
7109
|
+
return {
|
|
7110
|
+
name: field.flag,
|
|
7111
|
+
type: field.type,
|
|
7112
|
+
required: field.required,
|
|
7113
|
+
desc: field.desc,
|
|
7114
|
+
min: field.min,
|
|
7115
|
+
max: field.max,
|
|
7116
|
+
pattern: field.pattern
|
|
7117
|
+
};
|
|
7118
|
+
}
|
|
7119
|
+
function secretFlags(secret) {
|
|
7120
|
+
const requirement = secret.required ? ` One of --${secret.flag}-file or --${secret.flag}-stdin is required.` : "";
|
|
7121
|
+
return [
|
|
7122
|
+
{
|
|
7123
|
+
name: `${secret.flag}-file`,
|
|
7124
|
+
type: "string",
|
|
7125
|
+
required: false,
|
|
7126
|
+
desc: `${secret.desc} Read from a local permission-protected file; the value is never accepted directly on argv.${requirement}`
|
|
7127
|
+
},
|
|
7128
|
+
{
|
|
7129
|
+
name: `${secret.flag}-stdin`,
|
|
7130
|
+
type: "boolean",
|
|
7131
|
+
required: false,
|
|
7132
|
+
sensitive: true,
|
|
7133
|
+
desc: `${secret.desc} Read from stdin; do not combine with --${secret.flag}-file.${requirement}`
|
|
7134
|
+
}
|
|
7135
|
+
];
|
|
7136
|
+
}
|
|
7137
|
+
function buildSystemInput(ctx, fields, secrets, risk) {
|
|
7138
|
+
const input = {};
|
|
7139
|
+
for (const field of fields) {
|
|
7140
|
+
const value = fieldValue(ctx, field);
|
|
7141
|
+
if (value !== void 0) input[field.input ?? kebabToSnake(field.flag)] = value;
|
|
7142
|
+
}
|
|
7143
|
+
for (const secret of secrets) {
|
|
7144
|
+
const value = secretValue(ctx, secret);
|
|
7145
|
+
if (value !== void 0) input[secret.input] = secret.transform ? secret.transform(value) : value;
|
|
7146
|
+
}
|
|
7147
|
+
if (risk === "high-risk-write") input.yes = true;
|
|
7148
|
+
return compactInput(input);
|
|
7149
|
+
}
|
|
7150
|
+
function fieldValue(ctx, field) {
|
|
7151
|
+
const raw = ctx.str(field.flag);
|
|
7152
|
+
if (raw === "") return void 0;
|
|
7153
|
+
if (field.type === "string") return raw;
|
|
7154
|
+
if (field.type === "number") return Number(raw);
|
|
7155
|
+
if (field.type === "boolean") return ctx.bool(field.flag);
|
|
7156
|
+
return ctx.json(field.flag);
|
|
7157
|
+
}
|
|
7158
|
+
function validateFields(fields, input) {
|
|
7159
|
+
for (const field of fields) {
|
|
7160
|
+
const inputName = field.input ?? kebabToSnake(field.flag);
|
|
7161
|
+
const value = input[inputName];
|
|
7162
|
+
if (field.required && value === void 0) {
|
|
7163
|
+
throw validation(`--${field.flag} is required.`);
|
|
7164
|
+
}
|
|
7165
|
+
if (value === void 0) continue;
|
|
7166
|
+
if (field.array && !Array.isArray(value)) {
|
|
7167
|
+
throw validation(`--${field.flag} must be a JSON array.`);
|
|
7168
|
+
}
|
|
7169
|
+
if (field.allowed && !field.allowed.includes(value)) {
|
|
7170
|
+
throw validation(`--${field.flag} must be one of: ${field.allowed.join(", ")}.`);
|
|
7171
|
+
}
|
|
7172
|
+
}
|
|
7173
|
+
}
|
|
7174
|
+
function validateSecretSources(ctx, secrets) {
|
|
7175
|
+
let stdinSources = 0;
|
|
7176
|
+
for (const secret of secrets) {
|
|
7177
|
+
const file = ctx.str(`${secret.flag}-file`);
|
|
7178
|
+
const stdin = ctx.bool(`${secret.flag}-stdin`);
|
|
7179
|
+
if (file && stdin) {
|
|
7180
|
+
throw validation(`Use only one of --${secret.flag}-file and --${secret.flag}-stdin.`);
|
|
7181
|
+
}
|
|
7182
|
+
if (secret.required && !file && !stdin) {
|
|
7183
|
+
throw validation(`Provide --${secret.flag}-file or --${secret.flag}-stdin.`);
|
|
7184
|
+
}
|
|
7185
|
+
if (stdin) stdinSources += 1;
|
|
7186
|
+
}
|
|
7187
|
+
if (stdinSources > 1) {
|
|
7188
|
+
throw validation("Only one secret value may be read from stdin in a single invocation; use protected files for the others.");
|
|
7189
|
+
}
|
|
7190
|
+
}
|
|
7191
|
+
function secretValue(ctx, secret) {
|
|
7192
|
+
let values = secretValues.get(ctx);
|
|
7193
|
+
if (!values) {
|
|
7194
|
+
values = /* @__PURE__ */ new Map();
|
|
7195
|
+
secretValues.set(ctx, values);
|
|
7196
|
+
}
|
|
7197
|
+
if (values.has(secret.flag)) {
|
|
7198
|
+
return values.get(secret.flag);
|
|
7199
|
+
}
|
|
7200
|
+
let value;
|
|
7201
|
+
const file = ctx.str(`${secret.flag}-file`);
|
|
7202
|
+
if (file) {
|
|
7203
|
+
const stat = statSync2(file);
|
|
7204
|
+
if (!stat.isFile()) throw validation(`--${secret.flag}-file must reference a regular file.`);
|
|
7205
|
+
if ((stat.mode & 63) !== 0) {
|
|
7206
|
+
throw validation(`--${secret.flag}-file must not be readable or writable by group/others (use chmod 600).`);
|
|
7207
|
+
}
|
|
7208
|
+
value = nonEmptySecret(readFileSync(file, "utf8"), secret.flag);
|
|
7209
|
+
} else if (ctx.bool(`${secret.flag}-stdin`)) {
|
|
7210
|
+
value = nonEmptySecret(readFileSync(0, "utf8"), secret.flag);
|
|
7211
|
+
}
|
|
7212
|
+
values.set(secret.flag, value);
|
|
7213
|
+
return value;
|
|
7214
|
+
}
|
|
7215
|
+
function nonEmptySecret(value, flag) {
|
|
7216
|
+
const normalized = value.replace(/\r?\n$/, "");
|
|
7217
|
+
if (normalized.length === 0) throw validation(`Secret input for --${flag} must not be empty.`);
|
|
7218
|
+
return normalized;
|
|
7219
|
+
}
|
|
7220
|
+
function requireAtLeastOne(input, names, message) {
|
|
7221
|
+
const present = names.some((name) => {
|
|
7222
|
+
const value = input[name];
|
|
7223
|
+
return Array.isArray(value) ? value.length > 0 : value !== void 0 && value !== "";
|
|
7224
|
+
});
|
|
7225
|
+
if (!present) throw validation(message);
|
|
7226
|
+
}
|
|
7227
|
+
function requireArrayObjects(input, name, requiredKeys) {
|
|
7228
|
+
const value = input[name];
|
|
7229
|
+
if (value === void 0) return;
|
|
7230
|
+
if (!Array.isArray(value)) throw validation(`${snakeToFlag(name)} must be a JSON array.`);
|
|
7231
|
+
value.forEach((item, index) => {
|
|
7232
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) {
|
|
7233
|
+
throw validation(`${snakeToFlag(name)} item ${index + 1} must be an object.`);
|
|
7234
|
+
}
|
|
7235
|
+
for (const key of requiredKeys) {
|
|
7236
|
+
if (!(key in item)) {
|
|
7237
|
+
throw validation(`${snakeToFlag(name)} item ${index + 1} is missing ${key}.`);
|
|
7238
|
+
}
|
|
7239
|
+
}
|
|
7240
|
+
});
|
|
7241
|
+
}
|
|
7242
|
+
function validation(message) {
|
|
7243
|
+
return new CliValidationError(message, { code: "INVALID_SYSTEM_CAPABILITY_INPUT" });
|
|
7244
|
+
}
|
|
7245
|
+
function kebabToSnake(value) {
|
|
7246
|
+
return value.replaceAll("-", "_");
|
|
7247
|
+
}
|
|
7248
|
+
function snakeToFlag(value) {
|
|
7249
|
+
return `--${value.replaceAll("_", "-")}`;
|
|
7250
|
+
}
|
|
7251
|
+
|
|
7252
|
+
// src/commands/te-analysis/system/configuration.ts
|
|
7253
|
+
var addressUrl = { flag: "address-url", type: "string", required: true, desc: "Receiver address URL." };
|
|
7254
|
+
var addressType = {
|
|
7255
|
+
flag: "address-type",
|
|
7256
|
+
type: "string",
|
|
7257
|
+
required: true,
|
|
7258
|
+
desc: "Receiver address type.",
|
|
7259
|
+
allowed: ["public", "private"]
|
|
7260
|
+
};
|
|
7261
|
+
var loginType = {
|
|
7262
|
+
flag: "login-type",
|
|
7263
|
+
type: "string",
|
|
7264
|
+
required: true,
|
|
7265
|
+
desc: "Third-party login type.",
|
|
7266
|
+
allowed: ["wecom", "dingtalk", "feishu"]
|
|
7267
|
+
};
|
|
7268
|
+
var systemConfigurationCommands = [
|
|
7269
|
+
defineSystemCommand({
|
|
7270
|
+
resource: "preference",
|
|
7271
|
+
command: "get",
|
|
7272
|
+
capabilityId: "system.preference.get",
|
|
7273
|
+
description: "Get typed company preferences exposed to CLI.",
|
|
7274
|
+
risk: "read"
|
|
7275
|
+
}),
|
|
7276
|
+
defineSystemCommand({
|
|
7277
|
+
resource: "preference",
|
|
7278
|
+
command: "update",
|
|
7279
|
+
capabilityId: "system.preference.update",
|
|
7280
|
+
description: "Update typed company navigation preference.",
|
|
7281
|
+
risk: "write",
|
|
7282
|
+
fields: [
|
|
7283
|
+
{ flag: "navigation-permission-hide", type: "boolean", required: true, desc: "Hide navigation entries without permission." }
|
|
7284
|
+
]
|
|
7285
|
+
}),
|
|
7286
|
+
defineSystemCommand({
|
|
7287
|
+
resource: "smtp",
|
|
7288
|
+
command: "get",
|
|
7289
|
+
capabilityId: "system.smtp.get",
|
|
7290
|
+
description: "Get sanitized company SMTP configuration.",
|
|
7291
|
+
risk: "read"
|
|
7292
|
+
}),
|
|
7293
|
+
defineSystemCommand({
|
|
7294
|
+
resource: "smtp",
|
|
7295
|
+
command: "upsert",
|
|
7296
|
+
capabilityId: "system.smtp.upsert",
|
|
7297
|
+
description: "Create or update company SMTP configuration using a protected password source.",
|
|
7298
|
+
risk: "write",
|
|
7299
|
+
fields: [
|
|
7300
|
+
{ flag: "server-host", type: "string", required: true, desc: "SMTP server host." },
|
|
7301
|
+
{ flag: "server-port", type: "number", required: true, min: 1, max: 65535, desc: "SMTP server port." },
|
|
7302
|
+
{ flag: "has-encrypt", type: "number", allowed: [0, 1, 2], desc: "Encryption mode: 0, 1, or 2." },
|
|
7303
|
+
{ flag: "sender-address", type: "string", required: true, desc: "Sender email address." },
|
|
7304
|
+
{ flag: "sender-name", type: "string", required: true, desc: "Sender display name." },
|
|
7305
|
+
{ flag: "subject-prefix", type: "string", desc: "Optional subject prefix." }
|
|
7306
|
+
],
|
|
7307
|
+
secrets: [
|
|
7308
|
+
{ input: "password", flag: "password", required: true, desc: "SMTP password." }
|
|
7309
|
+
]
|
|
7310
|
+
}),
|
|
7311
|
+
defineSystemCommand({
|
|
7312
|
+
resource: "smtp",
|
|
7313
|
+
command: "test",
|
|
7314
|
+
capabilityId: "system.smtp.test",
|
|
7315
|
+
description: "Send one SMTP test using the saved configuration.",
|
|
7316
|
+
risk: "write",
|
|
7317
|
+
fields: [
|
|
7318
|
+
{ flag: "receiver", type: "string", required: true, desc: "Test email receiver." }
|
|
7319
|
+
]
|
|
7320
|
+
}),
|
|
7321
|
+
defineSystemCommand({
|
|
7322
|
+
resource: "smtp",
|
|
7323
|
+
command: "delete",
|
|
7324
|
+
capabilityId: "system.smtp.delete",
|
|
7325
|
+
description: "Delete company SMTP configuration.",
|
|
7326
|
+
risk: "high-risk-write"
|
|
7327
|
+
}),
|
|
7328
|
+
defineSystemCommand({
|
|
7329
|
+
resource: "receiver-address",
|
|
7330
|
+
command: "overview",
|
|
7331
|
+
capabilityId: "system.receiver_address.overview",
|
|
7332
|
+
description: "Get company receiver-address overview.",
|
|
7333
|
+
risk: "read"
|
|
7334
|
+
}),
|
|
7335
|
+
defineSystemCommand({
|
|
7336
|
+
resource: "receiver-address",
|
|
7337
|
+
command: "project-list",
|
|
7338
|
+
capabilityId: "system.receiver_address.project_list",
|
|
7339
|
+
description: "List project receiver-address overrides.",
|
|
7340
|
+
risk: "read"
|
|
7341
|
+
}),
|
|
7342
|
+
defineSystemCommand({
|
|
7343
|
+
resource: "receiver-address",
|
|
7344
|
+
command: "upsert",
|
|
7345
|
+
capabilityId: "system.receiver_address.upsert",
|
|
7346
|
+
description: "Create or update a typed receiver address.",
|
|
7347
|
+
risk: "write",
|
|
7348
|
+
fields: [
|
|
7349
|
+
{ flag: "scope", type: "string", required: true, desc: "Receiver scope.", allowed: ["global", "project"] },
|
|
7350
|
+
addressUrl,
|
|
7351
|
+
addressType,
|
|
7352
|
+
{ flag: "project-ids", type: "json", array: true, desc: "Project ID JSON array; required for project scope." },
|
|
7353
|
+
{ flag: "original-address-url", type: "string", desc: "Original URL when changing an existing address." },
|
|
7354
|
+
{ flag: "original-address-type", type: "string", desc: "Original address type.", allowed: ["public", "private"] }
|
|
7355
|
+
],
|
|
7356
|
+
validate: (_ctx, input) => {
|
|
7357
|
+
if (input.scope === "project" && (!Array.isArray(input.project_ids) || input.project_ids.length === 0)) {
|
|
7358
|
+
throw validation("--project-ids is required when --scope project.");
|
|
7359
|
+
}
|
|
7360
|
+
}
|
|
7361
|
+
}),
|
|
7362
|
+
defineSystemCommand({
|
|
7363
|
+
resource: "receiver-address",
|
|
7364
|
+
command: "promote",
|
|
7365
|
+
capabilityId: "system.receiver_address.promote",
|
|
7366
|
+
description: "Promote a receiver address to company scope.",
|
|
7367
|
+
risk: "write",
|
|
7368
|
+
fields: [
|
|
7369
|
+
addressUrl,
|
|
7370
|
+
addressType,
|
|
7371
|
+
{ flag: "remove-project-custom", type: "boolean", desc: "Remove matching project overrides after promotion." }
|
|
7372
|
+
]
|
|
7373
|
+
}),
|
|
7374
|
+
defineSystemCommand({
|
|
7375
|
+
resource: "receiver-address",
|
|
7376
|
+
command: "delete",
|
|
7377
|
+
capabilityId: "system.receiver_address.delete",
|
|
7378
|
+
description: "Delete a receiver address.",
|
|
7379
|
+
risk: "high-risk-write",
|
|
7380
|
+
fields: [addressUrl, addressType]
|
|
7381
|
+
}),
|
|
7382
|
+
defineSystemCommand({
|
|
7383
|
+
resource: "receiver-detection",
|
|
7384
|
+
command: "get",
|
|
7385
|
+
capabilityId: "system.receiver_detection.get",
|
|
7386
|
+
description: "Get receiver-address detection configuration.",
|
|
7387
|
+
risk: "read",
|
|
7388
|
+
fields: [addressUrl]
|
|
7389
|
+
}),
|
|
7390
|
+
defineSystemCommand({
|
|
7391
|
+
resource: "receiver-detection",
|
|
7392
|
+
command: "update",
|
|
7393
|
+
capabilityId: "system.receiver_detection.update",
|
|
7394
|
+
description: "Update typed receiver-address detection configuration.",
|
|
7395
|
+
risk: "write",
|
|
7396
|
+
fields: [
|
|
7397
|
+
addressUrl,
|
|
7398
|
+
{ flag: "execute-type", type: "string", required: true, desc: "Detection execution scope.", allowed: ["ta_cluster", "all"] },
|
|
7399
|
+
{ flag: "schedule-type", type: "string", required: true, desc: "Detection schedule.", allowed: ["minutes", "hour", "day", "disabled"] },
|
|
7400
|
+
{ flag: "allow-notification", type: "boolean", required: true, desc: "Allow detection notifications." }
|
|
7401
|
+
]
|
|
7402
|
+
}),
|
|
7403
|
+
defineSystemCommand({
|
|
7404
|
+
resource: "receiver-detection",
|
|
7405
|
+
command: "run",
|
|
7406
|
+
capabilityId: "system.receiver_detection.run",
|
|
7407
|
+
description: "Run receiver-address detection now.",
|
|
7408
|
+
risk: "write",
|
|
7409
|
+
fields: [addressUrl]
|
|
7410
|
+
}),
|
|
7411
|
+
defineSystemCommand({
|
|
7412
|
+
resource: "third-party-login",
|
|
7413
|
+
command: "list",
|
|
7414
|
+
capabilityId: "system.third_party_login.list",
|
|
7415
|
+
description: "List sanitized third-party login configurations.",
|
|
7416
|
+
risk: "read"
|
|
7417
|
+
}),
|
|
7418
|
+
defineSystemCommand({
|
|
7419
|
+
resource: "third-party-login",
|
|
7420
|
+
command: "upsert",
|
|
7421
|
+
capabilityId: "system.third_party_login.upsert",
|
|
7422
|
+
description: "Create or update a third-party login configuration using protected secret sources.",
|
|
7423
|
+
risk: "write",
|
|
7424
|
+
fields: [
|
|
7425
|
+
loginType,
|
|
7426
|
+
{ flag: "app-id", type: "string", required: true, desc: "Provider application ID." },
|
|
7427
|
+
{ flag: "corp-id", type: "string", desc: "Provider corporation ID." },
|
|
7428
|
+
{ flag: "agent-id", type: "string", desc: "Provider agent ID." },
|
|
7429
|
+
{ flag: "dd-scan-app-id", type: "string", desc: "DingTalk scan-login application ID." }
|
|
7430
|
+
],
|
|
7431
|
+
secrets: [
|
|
7432
|
+
{ input: "app_secret", flag: "app-secret", required: true, desc: "Provider application secret." },
|
|
7433
|
+
{ input: "dd_scan_app_secret", flag: "dd-scan-app-secret", desc: "DingTalk scan-login application secret." }
|
|
7434
|
+
],
|
|
7435
|
+
validate: (_ctx, input) => {
|
|
7436
|
+
if (input.login_type === "wecom" && !input.corp_id) {
|
|
7437
|
+
throw validation("--corp-id is required for wecom.");
|
|
7438
|
+
}
|
|
7439
|
+
if (input.login_type === "dingtalk") {
|
|
7440
|
+
requireAtLeastOne(input, ["corp_id"], "--corp-id is required for dingtalk.");
|
|
7441
|
+
for (const name of ["agent_id", "dd_scan_app_id", "dd_scan_app_secret"]) {
|
|
7442
|
+
if (!input[name]) throw validation(`--${name.replaceAll("_", "-")} is required for dingtalk.`);
|
|
7443
|
+
}
|
|
7444
|
+
}
|
|
7445
|
+
}
|
|
7446
|
+
}),
|
|
7447
|
+
defineSystemCommand({
|
|
7448
|
+
resource: "third-party-login",
|
|
7449
|
+
command: "disable",
|
|
7450
|
+
capabilityId: "system.third_party_login.disable",
|
|
7451
|
+
description: "Disable a third-party login provider.",
|
|
7452
|
+
risk: "high-risk-write",
|
|
7453
|
+
fields: [loginType]
|
|
7454
|
+
}),
|
|
7455
|
+
defineSystemCommand({
|
|
7456
|
+
resource: "oauth2",
|
|
7457
|
+
command: "update",
|
|
7458
|
+
capabilityId: "system.oauth2.update",
|
|
7459
|
+
description: "Enable or disable company OAuth2 login.",
|
|
7460
|
+
risk: "write",
|
|
7461
|
+
fields: [
|
|
7462
|
+
{ flag: "enable-oauth2", type: "boolean", required: true, desc: "Target OAuth2 login state." }
|
|
7463
|
+
]
|
|
7464
|
+
})
|
|
7465
|
+
];
|
|
7466
|
+
|
|
7467
|
+
// src/commands/te-analysis/system/identity.ts
|
|
7468
|
+
var roleName = { flag: "role-name", type: "string", required: true, desc: "Role name." };
|
|
7469
|
+
var targetOpenId = { flag: "target-open-id", type: "string", required: true, desc: "Target member open ID." };
|
|
7470
|
+
var systemIdentityCommands = [
|
|
7471
|
+
defineSystemCommand({
|
|
7472
|
+
resource: "member",
|
|
7473
|
+
command: "list",
|
|
7474
|
+
capabilityId: "system.member.list",
|
|
7475
|
+
description: "List company members.",
|
|
7476
|
+
risk: "read",
|
|
7477
|
+
fields: [queryField, limitField, offsetField]
|
|
7478
|
+
}),
|
|
7479
|
+
defineSystemCommand({
|
|
7480
|
+
resource: "member-candidate",
|
|
7481
|
+
command: "list",
|
|
7482
|
+
capabilityId: "system.member_candidate.list",
|
|
7483
|
+
description: "Resolve candidate company members by login name.",
|
|
7484
|
+
risk: "read",
|
|
7485
|
+
fields: [{ flag: "login-names", type: "json", required: true, array: true, desc: "Login-name JSON array." }]
|
|
7486
|
+
}),
|
|
7487
|
+
defineSystemCommand({
|
|
7488
|
+
resource: "member",
|
|
7489
|
+
command: "add",
|
|
7490
|
+
capabilityId: "system.member.add",
|
|
7491
|
+
description: "Add company members atomically.",
|
|
7492
|
+
risk: "write",
|
|
7493
|
+
fields: [
|
|
7494
|
+
{ flag: "members", type: "json", required: true, array: true, desc: "Member array with login_name and user_name." }
|
|
7495
|
+
],
|
|
7496
|
+
validate: (_ctx, input) => {
|
|
7497
|
+
requireAtLeastOne(input, ["members"], "Provide a non-empty --members array.");
|
|
7498
|
+
requireArrayObjects(input, "members", ["login_name", "user_name"]);
|
|
7499
|
+
}
|
|
7500
|
+
}),
|
|
7501
|
+
defineSystemCommand({
|
|
7502
|
+
resource: "member",
|
|
7503
|
+
command: "update",
|
|
7504
|
+
capabilityId: "system.member.update",
|
|
7505
|
+
description: "Update a company member display name.",
|
|
7506
|
+
risk: "write",
|
|
7507
|
+
fields: [
|
|
7508
|
+
targetOpenId,
|
|
7509
|
+
{ flag: "user-name", type: "string", required: true, desc: "New display name." }
|
|
7510
|
+
]
|
|
7511
|
+
}),
|
|
7512
|
+
defineSystemCommand({
|
|
7513
|
+
resource: "member-status",
|
|
7514
|
+
command: "update",
|
|
7515
|
+
capabilityId: "system.member_status.update",
|
|
7516
|
+
description: "Lock or reactivate a company member.",
|
|
7517
|
+
risk: "high-risk-write",
|
|
7518
|
+
fields: [
|
|
7519
|
+
targetOpenId,
|
|
7520
|
+
{ flag: "status", type: "string", required: true, desc: "Target status.", allowed: ["locked", "active"] }
|
|
7521
|
+
]
|
|
7522
|
+
}),
|
|
7523
|
+
defineSystemCommand({
|
|
7524
|
+
resource: "member-project",
|
|
7525
|
+
command: "batch-update",
|
|
7526
|
+
capabilityId: "system.member_project.batch_update",
|
|
7527
|
+
description: "Batch update and remove a member project assignments.",
|
|
7528
|
+
risk: "high-risk-write",
|
|
7529
|
+
fields: [
|
|
7530
|
+
targetOpenId,
|
|
7531
|
+
{ flag: "project-updates", type: "json", array: true, desc: "Project update array: project_id, role_names, and optional data_power_id." },
|
|
7532
|
+
{ flag: "project-removals", type: "json", array: true, desc: "Project removal and handover array." }
|
|
7533
|
+
],
|
|
7534
|
+
validate: (_ctx, input) => {
|
|
7535
|
+
requireAtLeastOne(input, ["project_updates", "project_removals"], "Provide a non-empty --project-updates or --project-removals array.");
|
|
7536
|
+
requireArrayObjects(input, "project_updates", ["project_id", "role_names"]);
|
|
7537
|
+
requireArrayObjects(input, "project_removals", ["project_id", "handover_type"]);
|
|
7538
|
+
}
|
|
7539
|
+
}),
|
|
7540
|
+
defineSystemCommand({
|
|
7541
|
+
resource: "member",
|
|
7542
|
+
command: "delete",
|
|
7543
|
+
capabilityId: "system.member.delete",
|
|
7544
|
+
description: "Delete a company member after all project memberships and assets are cleared.",
|
|
7545
|
+
risk: "high-risk-write",
|
|
7546
|
+
fields: [
|
|
7547
|
+
{ flag: "target-user-id", type: "number", required: true, min: 1, desc: "Target member user ID." }
|
|
7548
|
+
]
|
|
7549
|
+
}),
|
|
7550
|
+
defineSystemCommand({
|
|
7551
|
+
resource: "admin",
|
|
7552
|
+
command: "list",
|
|
7553
|
+
capabilityId: "system.admin.list",
|
|
7554
|
+
description: "List company system administrators.",
|
|
7555
|
+
risk: "read"
|
|
7556
|
+
}),
|
|
7557
|
+
defineSystemCommand({
|
|
7558
|
+
resource: "admin",
|
|
7559
|
+
command: "upsert",
|
|
7560
|
+
capabilityId: "system.admin.upsert",
|
|
7561
|
+
description: "Create or update company system-administrator assignments.",
|
|
7562
|
+
risk: "high-risk-write",
|
|
7563
|
+
fields: [
|
|
7564
|
+
{ flag: "admins", type: "json", required: true, array: true, desc: "Administrator array with target_user_id and function_names." }
|
|
7565
|
+
],
|
|
7566
|
+
validate: (_ctx, input) => requireArrayObjects(input, "admins", ["target_user_id", "function_names"])
|
|
7567
|
+
}),
|
|
7568
|
+
defineSystemCommand({
|
|
7569
|
+
resource: "admin-function",
|
|
7570
|
+
command: "list",
|
|
7571
|
+
capabilityId: "system.admin_function.list",
|
|
7572
|
+
description: "List functions assigned to a system administrator.",
|
|
7573
|
+
risk: "read",
|
|
7574
|
+
fields: [targetOpenId]
|
|
7575
|
+
}),
|
|
7576
|
+
defineSystemCommand({
|
|
7577
|
+
resource: "admin-function",
|
|
7578
|
+
command: "update",
|
|
7579
|
+
capabilityId: "system.admin_function.update",
|
|
7580
|
+
description: "Replace functions assigned to a system administrator.",
|
|
7581
|
+
risk: "high-risk-write",
|
|
7582
|
+
fields: [
|
|
7583
|
+
targetOpenId,
|
|
7584
|
+
{ flag: "function-names", type: "json", required: true, array: true, desc: "Complete function-name JSON array." }
|
|
7585
|
+
],
|
|
7586
|
+
validate: (_ctx, input) => requireAtLeastOne(input, ["function_names"], "--function-names must contain at least one function.")
|
|
7587
|
+
}),
|
|
7588
|
+
defineSystemCommand({
|
|
7589
|
+
resource: "admin",
|
|
7590
|
+
command: "remove",
|
|
7591
|
+
capabilityId: "system.admin.remove",
|
|
7592
|
+
description: "Remove a company-scoped system administrator role.",
|
|
7593
|
+
risk: "high-risk-write",
|
|
7594
|
+
fields: [targetOpenId]
|
|
7595
|
+
}),
|
|
7596
|
+
defineSystemCommand({
|
|
7597
|
+
resource: "role",
|
|
7598
|
+
command: "list",
|
|
7599
|
+
capabilityId: "system.role.list",
|
|
7600
|
+
description: "List company roles.",
|
|
7601
|
+
risk: "read",
|
|
7602
|
+
fields: [queryField, limitField, offsetField]
|
|
7603
|
+
}),
|
|
7604
|
+
defineSystemCommand({
|
|
7605
|
+
resource: "role",
|
|
7606
|
+
command: "get",
|
|
7607
|
+
capabilityId: "system.role.get",
|
|
7608
|
+
description: "Get one company role.",
|
|
7609
|
+
risk: "read",
|
|
7610
|
+
fields: [roleName]
|
|
7611
|
+
}),
|
|
7612
|
+
defineSystemCommand({
|
|
7613
|
+
resource: "role",
|
|
7614
|
+
command: "upsert",
|
|
7615
|
+
capabilityId: "system.role.upsert",
|
|
7616
|
+
description: "Create or update a company role and its function set.",
|
|
7617
|
+
risk: "high-risk-write",
|
|
7618
|
+
fields: [
|
|
7619
|
+
{ ...roleName, required: false, desc: "Existing role name for update; omit when creating." },
|
|
7620
|
+
{ flag: "role-desc", type: "string", required: true, desc: "Role description." },
|
|
7621
|
+
{ flag: "function-names", type: "json", required: true, array: true, desc: "Complete function-name JSON array." }
|
|
7622
|
+
],
|
|
7623
|
+
validate: (_ctx, input) => requireAtLeastOne(input, ["function_names"], "--function-names must contain at least one function.")
|
|
7624
|
+
}),
|
|
7625
|
+
defineSystemCommand({
|
|
7626
|
+
resource: "role",
|
|
7627
|
+
command: "delete",
|
|
7628
|
+
capabilityId: "system.role.delete",
|
|
7629
|
+
description: "Delete a company role and optionally migrate its users.",
|
|
7630
|
+
risk: "high-risk-write",
|
|
7631
|
+
fields: [
|
|
7632
|
+
roleName,
|
|
7633
|
+
{ flag: "new-role-name", type: "string", desc: "Replacement role for affected users." }
|
|
7634
|
+
]
|
|
7635
|
+
}),
|
|
7636
|
+
defineSystemCommand({
|
|
7637
|
+
resource: "role-function",
|
|
7638
|
+
command: "list",
|
|
7639
|
+
capabilityId: "system.role_function.list",
|
|
7640
|
+
description: "List functions assigned to a company role.",
|
|
7641
|
+
risk: "read",
|
|
7642
|
+
fields: [roleName]
|
|
7643
|
+
}),
|
|
7644
|
+
defineSystemCommand({
|
|
7645
|
+
resource: "role-user",
|
|
7646
|
+
command: "list",
|
|
7647
|
+
capabilityId: "system.role_user.list",
|
|
7648
|
+
description: "List users assigned to a company role.",
|
|
7649
|
+
risk: "read",
|
|
7650
|
+
fields: [roleName]
|
|
7651
|
+
}),
|
|
7652
|
+
defineSystemCommand({
|
|
7653
|
+
resource: "function",
|
|
7654
|
+
command: "list",
|
|
7655
|
+
capabilityId: "system.function.list",
|
|
7656
|
+
description: "List company-level system functions available for role assignment.",
|
|
7657
|
+
risk: "read"
|
|
7658
|
+
}),
|
|
7659
|
+
defineSystemCommand({
|
|
7660
|
+
resource: "seat",
|
|
7661
|
+
command: "list",
|
|
7662
|
+
capabilityId: "system.seat.list",
|
|
7663
|
+
description: "List company seat assignments.",
|
|
7664
|
+
risk: "read",
|
|
7665
|
+
fields: [
|
|
7666
|
+
queryField,
|
|
7667
|
+
limitField,
|
|
7668
|
+
offsetField,
|
|
7669
|
+
{ flag: "seat-type", type: "string", desc: "Optional seat type.", allowed: ["manage", "view", "empty"] }
|
|
7670
|
+
]
|
|
7671
|
+
}),
|
|
7672
|
+
defineSystemCommand({
|
|
7673
|
+
resource: "seat",
|
|
7674
|
+
command: "update",
|
|
7675
|
+
capabilityId: "system.seat.update",
|
|
7676
|
+
description: "Assign or remove BI seats under serialized company quota enforcement.",
|
|
7677
|
+
risk: "high-risk-write",
|
|
7678
|
+
fields: [
|
|
7679
|
+
{ flag: "seat-type", type: "string", required: true, desc: "Seat type; empty removes seats.", allowed: ["manage", "view", "empty"] },
|
|
7680
|
+
{ flag: "open-ids", type: "json", required: true, array: true, desc: "Company member open-ID JSON array." }
|
|
7681
|
+
],
|
|
7682
|
+
validate: (_ctx, input) => requireAtLeastOne(input, ["open_ids"], "--open-ids must contain at least one company member.")
|
|
7683
|
+
})
|
|
7684
|
+
];
|
|
7685
|
+
|
|
7686
|
+
// src/commands/te-analysis/system/monitoring.ts
|
|
7687
|
+
var monitorScopeFields = [
|
|
7688
|
+
{ flag: "project-ids", type: "json", array: true, desc: "Project ID JSON array." },
|
|
7689
|
+
{ flag: "space-codes", type: "json", array: true, desc: "Project space-code JSON array." }
|
|
7690
|
+
];
|
|
7691
|
+
var monitorTimeFields = [
|
|
7692
|
+
{
|
|
7693
|
+
flag: "start-time",
|
|
7694
|
+
type: "string",
|
|
7695
|
+
required: true,
|
|
7696
|
+
pattern: "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",
|
|
7697
|
+
desc: "Inclusive query range start, yyyy-MM-dd HH:mm:ss."
|
|
7698
|
+
},
|
|
7699
|
+
{
|
|
7700
|
+
flag: "end-time",
|
|
7701
|
+
type: "string",
|
|
7702
|
+
required: true,
|
|
7703
|
+
pattern: "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",
|
|
7704
|
+
desc: "Inclusive query range end, yyyy-MM-dd HH:mm:ss."
|
|
7705
|
+
}
|
|
7706
|
+
];
|
|
7707
|
+
function validateTaskQueryInput(input) {
|
|
7708
|
+
validateMonitorScope(input);
|
|
7709
|
+
for (const name of ["status_codes", "content_codes", "task_type_codes"]) {
|
|
7710
|
+
requireAtLeastOne(input, [name], `--${name.replaceAll("_", "-")} must be a non-empty JSON array.`);
|
|
7711
|
+
}
|
|
7712
|
+
}
|
|
7713
|
+
function validateMonitorScope(input) {
|
|
7714
|
+
requireAtLeastOne(
|
|
7715
|
+
input,
|
|
7716
|
+
["project_ids", "space_codes"],
|
|
7717
|
+
"Provide a non-empty --project-ids or --space-codes array."
|
|
7718
|
+
);
|
|
7719
|
+
}
|
|
7720
|
+
var contactWebhookSecrets = [
|
|
7721
|
+
{ input: "dingding_webhook", flag: "dingding-webhook", desc: "DingTalk webhook." },
|
|
7722
|
+
{ input: "wechat_webhook", flag: "wechat-webhook", desc: "WeCom webhook." },
|
|
7723
|
+
{ input: "feishu_webhook", flag: "feishu-webhook", desc: "Feishu webhook." },
|
|
7724
|
+
{ input: "slack_webhook", flag: "slack-webhook", desc: "Slack webhook." },
|
|
7725
|
+
{ input: "kim_webhook", flag: "kim-webhook", desc: "KIM webhook." }
|
|
7726
|
+
];
|
|
7727
|
+
var systemMonitoringCommands = [
|
|
7728
|
+
defineSystemCommand({
|
|
7729
|
+
resource: "query-monitor",
|
|
7730
|
+
command: "overview",
|
|
7731
|
+
capabilityId: "system.query_monitor.overview",
|
|
7732
|
+
description: "Get bounded query queue and resource-monitor charts.",
|
|
7733
|
+
risk: "read",
|
|
7734
|
+
fields: [
|
|
7735
|
+
{ flag: "duration-minutes", type: "number", min: 1, max: 1440, desc: "Monitoring duration in minutes. Default: 60." },
|
|
7736
|
+
...monitorScopeFields,
|
|
7737
|
+
{ flag: "cluster-names", type: "json", required: true, array: true, desc: "Query cluster-name JSON array." },
|
|
7738
|
+
{ flag: "point-interval-seconds", type: "number", min: 5, max: 300, desc: "Chart sample interval seconds. Default: 5." }
|
|
7739
|
+
],
|
|
7740
|
+
validate: (_ctx, input) => validateMonitorScope(input)
|
|
7741
|
+
}),
|
|
7742
|
+
defineSystemCommand({
|
|
7743
|
+
resource: "query-task",
|
|
7744
|
+
command: "options",
|
|
7745
|
+
capabilityId: "system.query_task.options",
|
|
7746
|
+
description: "List valid query-task filter codes and cluster names before list or export.",
|
|
7747
|
+
risk: "read"
|
|
7748
|
+
}),
|
|
7749
|
+
defineSystemCommand({
|
|
7750
|
+
resource: "query-task",
|
|
7751
|
+
command: "list",
|
|
7752
|
+
capabilityId: "system.query_task.list",
|
|
7753
|
+
description: "List query-monitor tasks; run query-task options first to discover filter codes.",
|
|
7754
|
+
risk: "read",
|
|
7755
|
+
fields: [
|
|
7756
|
+
...monitorTimeFields,
|
|
7757
|
+
...monitorScopeFields,
|
|
7758
|
+
{ flag: "status-codes", type: "json", required: true, array: true, desc: "Task status-code JSON array." },
|
|
7759
|
+
{ flag: "content-codes", type: "json", required: true, array: true, desc: "Query content-code JSON array." },
|
|
7760
|
+
{ flag: "task-type-codes", type: "json", required: true, array: true, desc: "Query task-type-code JSON array." },
|
|
7761
|
+
{ flag: "cluster-names", type: "json", array: true, desc: "Optional cluster-name JSON array." },
|
|
7762
|
+
{ flag: "limit", type: "number", min: 1, max: 1e3, desc: "Maximum returned tasks. Default: 100, max: 1000." },
|
|
7763
|
+
offsetField,
|
|
7764
|
+
fieldsField
|
|
7765
|
+
],
|
|
7766
|
+
validate: (_ctx, input) => validateTaskQueryInput(input)
|
|
7767
|
+
}),
|
|
7768
|
+
defineSystemCommand({
|
|
7769
|
+
resource: "query-task",
|
|
7770
|
+
command: "get",
|
|
7771
|
+
capabilityId: "system.query_task.get",
|
|
7772
|
+
description: "Get a sanitized query-monitor task detail.",
|
|
7773
|
+
risk: "read",
|
|
7774
|
+
fields: [
|
|
7775
|
+
{ flag: "task-id", type: "string", required: true, desc: "Query-monitor task ID." },
|
|
7776
|
+
{ flag: "sql-max-chars", type: "number", min: 0, max: 1e5, desc: "Maximum returned SQL characters." }
|
|
7777
|
+
]
|
|
7778
|
+
}),
|
|
7779
|
+
defineSystemCommand({
|
|
7780
|
+
resource: "query-task",
|
|
7781
|
+
command: "cancel",
|
|
7782
|
+
capabilityId: "system.query_task.cancel",
|
|
7783
|
+
description: "Cancel one running query-monitor task by task_id.",
|
|
7784
|
+
risk: "high-risk-write",
|
|
7785
|
+
fields: [
|
|
7786
|
+
{ flag: "task-id", type: "string", required: true, desc: "Query-monitor task ID, not a CLI run_id." }
|
|
7787
|
+
]
|
|
7788
|
+
}),
|
|
7789
|
+
defineSystemCommand({
|
|
7790
|
+
resource: "query-task",
|
|
7791
|
+
command: "export",
|
|
7792
|
+
capabilityId: "system.query_task.export",
|
|
7793
|
+
description: "Export query tasks; run query-task options first to discover filter codes.",
|
|
7794
|
+
risk: "read",
|
|
7795
|
+
fields: [
|
|
7796
|
+
...monitorTimeFields,
|
|
7797
|
+
...monitorScopeFields,
|
|
7798
|
+
{ flag: "status-codes", type: "json", required: true, array: true, desc: "Task status-code JSON array." },
|
|
7799
|
+
{ flag: "content-codes", type: "json", required: true, array: true, desc: "Query content-code JSON array." },
|
|
7800
|
+
{ flag: "task-type-codes", type: "json", required: true, array: true, desc: "Query task-type-code JSON array." },
|
|
7801
|
+
{ flag: "cluster-names", type: "json", array: true, desc: "Optional cluster-name JSON array." },
|
|
7802
|
+
{ flag: "download-columns", type: "json", array: true, desc: "Optional CSV column JSON array." },
|
|
7803
|
+
{
|
|
7804
|
+
flag: "request-id",
|
|
7805
|
+
type: "string",
|
|
7806
|
+
pattern: "^cli_[0-9a-f]{32}$",
|
|
7807
|
+
desc: "Optional caller-supplied cli_<32 lowercase hex> lifecycle ID; ae-cli generates one before dispatch when omitted."
|
|
7808
|
+
},
|
|
7809
|
+
{
|
|
7810
|
+
flag: "timeout-seconds",
|
|
7811
|
+
type: "number",
|
|
7812
|
+
min: 1,
|
|
7813
|
+
max: 21600,
|
|
7814
|
+
desc: "Maximum export runtime in seconds. Default and max: 21600."
|
|
7815
|
+
}
|
|
7816
|
+
],
|
|
7817
|
+
validate: (_ctx, input) => validateTaskQueryInput(input)
|
|
7818
|
+
}),
|
|
7819
|
+
defineSystemCommand({
|
|
7820
|
+
resource: "node-monitor",
|
|
7821
|
+
command: "list",
|
|
7822
|
+
capabilityId: "system.node_monitor.list",
|
|
7823
|
+
description: "List sanitized cluster node usage.",
|
|
7824
|
+
risk: "read",
|
|
7825
|
+
fields: [
|
|
7826
|
+
{ flag: "limit", type: "number", min: 1, max: 200, desc: "Page size. Default: 50, max: 200." },
|
|
7827
|
+
offsetField,
|
|
7828
|
+
fieldsField
|
|
7829
|
+
]
|
|
7830
|
+
}),
|
|
7831
|
+
defineSystemCommand({
|
|
7832
|
+
resource: "query-alert-rule",
|
|
7833
|
+
command: "list",
|
|
7834
|
+
capabilityId: "system.query_alert_rule.list",
|
|
7835
|
+
description: "List query-monitor alert rules and metric definitions.",
|
|
7836
|
+
risk: "read"
|
|
7837
|
+
}),
|
|
7838
|
+
defineSystemCommand({
|
|
7839
|
+
resource: "query-alert-rule",
|
|
7840
|
+
command: "update",
|
|
7841
|
+
capabilityId: "system.query_alert_rule.update",
|
|
7842
|
+
description: "Batch upsert and delete query-monitor alert rules.",
|
|
7843
|
+
risk: "high-risk-write",
|
|
7844
|
+
fields: [
|
|
7845
|
+
{ flag: "upserts", type: "json", array: true, desc: "Rule upsert JSON array." },
|
|
7846
|
+
{ flag: "delete-ids", type: "json", array: true, desc: "Positive rule-ID JSON array to delete." }
|
|
7847
|
+
],
|
|
7848
|
+
validate: (_ctx, input) => {
|
|
7849
|
+
requireAtLeastOne(input, ["upserts", "delete_ids"], "Provide a non-empty --upserts or --delete-ids array.");
|
|
7850
|
+
requireArrayObjects(input, "upserts", ["metric_content", "wheel_minutes", "wheel_interval", "threshold"]);
|
|
7851
|
+
const deleteIds = input.delete_ids;
|
|
7852
|
+
if (deleteIds?.some((id) => !Number.isInteger(id) || Number(id) <= 0)) {
|
|
7853
|
+
throw validation("--delete-ids must contain positive integers.");
|
|
7854
|
+
}
|
|
7855
|
+
const upserts = input.upserts;
|
|
7856
|
+
for (const [index, item] of (upserts ?? []).entries()) {
|
|
7857
|
+
const metric = Number(item.metric_content);
|
|
7858
|
+
const wheelMinutes = Number(item.wheel_minutes);
|
|
7859
|
+
const wheelInterval = Number(item.wheel_interval);
|
|
7860
|
+
const threshold = Number(item.threshold);
|
|
7861
|
+
if (![1, 2, 3].includes(metric) || !Number.isInteger(wheelMinutes) || wheelMinutes < 1 || wheelMinutes > 1440 || !Number.isInteger(wheelInterval) || wheelInterval < 1 || wheelInterval > 1e3 || !Number.isFinite(threshold) || threshold < 0) {
|
|
7862
|
+
throw validation(`--upserts item ${index + 1} contains an invalid metric/window/threshold.`);
|
|
7863
|
+
}
|
|
7864
|
+
}
|
|
7865
|
+
const deleted = new Set((deleteIds ?? []).map(Number));
|
|
7866
|
+
if ((upserts ?? []).some((item) => item.rule_id !== void 0 && deleted.has(Number(item.rule_id)))) {
|
|
7867
|
+
throw validation("The same rule_id cannot appear in both --upserts and --delete-ids.");
|
|
7868
|
+
}
|
|
7869
|
+
}
|
|
7870
|
+
}),
|
|
7871
|
+
defineSystemCommand({
|
|
7872
|
+
resource: "ops-alert-contact",
|
|
7873
|
+
command: "list",
|
|
7874
|
+
capabilityId: "system.ops_alert_contact.list",
|
|
7875
|
+
description: "List sanitized operations-alert contacts.",
|
|
7876
|
+
risk: "read",
|
|
7877
|
+
fields: [
|
|
7878
|
+
{ flag: "limit", type: "number", min: 1, max: 200, desc: "Page size. Default: 50, max: 200." },
|
|
7879
|
+
offsetField
|
|
7880
|
+
]
|
|
7881
|
+
}),
|
|
7882
|
+
defineSystemCommand({
|
|
7883
|
+
resource: "ops-alert-contact",
|
|
7884
|
+
command: "upsert",
|
|
7885
|
+
capabilityId: "system.ops_alert_contact.upsert",
|
|
7886
|
+
description: "Create or update an operations-alert contact without exposing webhooks on argv.",
|
|
7887
|
+
risk: "write",
|
|
7888
|
+
fields: [
|
|
7889
|
+
{ flag: "contact-id", type: "number", min: 1, desc: "Existing contact ID; omit to create." },
|
|
7890
|
+
{ flag: "name", type: "string", desc: "Contact name." },
|
|
7891
|
+
{ flag: "mail-address", type: "string", desc: "Email delivery target." },
|
|
7892
|
+
{ flag: "mobile", type: "string", desc: "Mobile delivery target." },
|
|
7893
|
+
{ flag: "on-status", type: "number", allowed: [0, 1], desc: "Enable state: 0 or 1; required on create." }
|
|
7894
|
+
],
|
|
7895
|
+
secrets: contactWebhookSecrets,
|
|
7896
|
+
validate: (_ctx, input) => {
|
|
7897
|
+
if (input.contact_id === void 0) {
|
|
7898
|
+
if (!input.name) throw validation("--name is required when creating a contact.");
|
|
7899
|
+
if (input.on_status === void 0) throw validation("--on-status is required when creating a contact.");
|
|
7900
|
+
requireAtLeastOne(
|
|
7901
|
+
input,
|
|
7902
|
+
["mail_address", "mobile", ...contactWebhookSecrets.map((item) => item.input)],
|
|
7903
|
+
"Provide at least one delivery target when creating a contact."
|
|
7904
|
+
);
|
|
7905
|
+
}
|
|
7906
|
+
}
|
|
7907
|
+
}),
|
|
7908
|
+
defineSystemCommand({
|
|
7909
|
+
resource: "ops-alert-contact",
|
|
7910
|
+
command: "delete",
|
|
7911
|
+
capabilityId: "system.ops_alert_contact.delete",
|
|
7912
|
+
description: "Delete an operations-alert contact.",
|
|
7913
|
+
risk: "high-risk-write",
|
|
7914
|
+
fields: [
|
|
7915
|
+
{ flag: "contact-id", type: "number", required: true, min: 1, desc: "Contact ID to delete." }
|
|
7916
|
+
]
|
|
7917
|
+
}),
|
|
7918
|
+
defineSystemCommand({
|
|
7919
|
+
resource: "ops-alert-contact",
|
|
7920
|
+
command: "test",
|
|
7921
|
+
capabilityId: "system.ops_alert_contact.test",
|
|
7922
|
+
description: "Send one rate-limited external alert test to a constrained target.",
|
|
7923
|
+
risk: "write",
|
|
7924
|
+
fields: [
|
|
7925
|
+
{
|
|
7926
|
+
flag: "channel",
|
|
7927
|
+
type: "string",
|
|
7928
|
+
required: true,
|
|
7929
|
+
desc: "Test channel.",
|
|
7930
|
+
allowed: ["email", "sms", "dingding", "wechat", "feishu", "slack"]
|
|
7931
|
+
}
|
|
7932
|
+
],
|
|
7933
|
+
secrets: [
|
|
7934
|
+
{ input: "target", flag: "target", required: true, desc: "Sensitive test destination." }
|
|
7935
|
+
]
|
|
7936
|
+
})
|
|
7937
|
+
];
|
|
7938
|
+
|
|
7939
|
+
// src/core/ta-password-encryption.ts
|
|
7940
|
+
import { constants, publicEncrypt } from "crypto";
|
|
7941
|
+
var TA_PASSWORD_PUBLIC_KEY = [
|
|
7942
|
+
"-----BEGIN PUBLIC KEY-----",
|
|
7943
|
+
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCT+JeQB4oij4007Kslmma0sfFo",
|
|
7944
|
+
"dahq1olOpWJoZR+aimyNuYUSTmbK1/bArGkIb0CxIPUGQIrARpY6apQNncORutdmB",
|
|
7945
|
+
"HonFkn7r7XpktL7bxZhDUKeLjIdjaEB1lh1tFxLl3cP0siHwuc1aAaEOWAjuCu2f",
|
|
7946
|
+
"9+FgY7WCEJla9Qa/QIDAQAB",
|
|
7947
|
+
"-----END PUBLIC KEY-----"
|
|
7948
|
+
].join("\n");
|
|
7949
|
+
function encryptTaPassword(plaintext) {
|
|
7950
|
+
return publicEncrypt(
|
|
7951
|
+
{
|
|
7952
|
+
key: TA_PASSWORD_PUBLIC_KEY,
|
|
7953
|
+
padding: constants.RSA_PKCS1_PADDING
|
|
7954
|
+
},
|
|
7955
|
+
Buffer.from(plaintext, "utf8")
|
|
7956
|
+
).toString("base64");
|
|
7957
|
+
}
|
|
7958
|
+
|
|
7959
|
+
// src/commands/te-analysis/system/security.ts
|
|
7960
|
+
var systemSecurityCommands = [
|
|
7961
|
+
defineSystemCommand({
|
|
7962
|
+
resource: "mfa",
|
|
7963
|
+
command: "get",
|
|
7964
|
+
capabilityId: "system.mfa.get",
|
|
7965
|
+
description: "Get the company MFA enforcement state.",
|
|
7966
|
+
risk: "read"
|
|
7967
|
+
}),
|
|
7968
|
+
defineSystemCommand({
|
|
7969
|
+
resource: "mfa",
|
|
7970
|
+
command: "update",
|
|
7971
|
+
capabilityId: "system.mfa.update",
|
|
7972
|
+
description: "Enable or disable company MFA enforcement.",
|
|
7973
|
+
risk: "high-risk-write",
|
|
7974
|
+
fields: [
|
|
7975
|
+
{ flag: "enabled", type: "boolean", required: true, desc: "Target MFA enforcement state." }
|
|
7976
|
+
]
|
|
7977
|
+
}),
|
|
7978
|
+
defineSystemCommand({
|
|
7979
|
+
resource: "member-mfa",
|
|
7980
|
+
command: "unbind",
|
|
7981
|
+
capabilityId: "system.member_mfa.unbind",
|
|
7982
|
+
description: "Unbind one member MFA enrollment.",
|
|
7983
|
+
risk: "high-risk-write",
|
|
7984
|
+
fields: [
|
|
7985
|
+
{ flag: "login-name", type: "string", required: true, desc: "Target member login name." }
|
|
7986
|
+
]
|
|
7987
|
+
}),
|
|
7988
|
+
defineSystemCommand({
|
|
7989
|
+
resource: "member-password",
|
|
7990
|
+
command: "reset",
|
|
7991
|
+
capabilityId: "system.member_password.reset",
|
|
7992
|
+
description: "Reset one member password after local TA-compatible RSA encryption.",
|
|
7993
|
+
risk: "high-risk-write",
|
|
7994
|
+
fields: [
|
|
7995
|
+
{ flag: "target-user-id", type: "number", required: true, min: 1, desc: "Target member user ID." }
|
|
7996
|
+
],
|
|
7997
|
+
secrets: [
|
|
7998
|
+
{
|
|
7999
|
+
input: "encrypted_password",
|
|
8000
|
+
flag: "password",
|
|
8001
|
+
required: true,
|
|
8002
|
+
desc: "New member password.",
|
|
8003
|
+
transform: encryptTaPassword
|
|
8004
|
+
}
|
|
8005
|
+
]
|
|
8006
|
+
})
|
|
8007
|
+
];
|
|
8008
|
+
|
|
8009
|
+
// src/commands/te-analysis/system/usage.ts
|
|
8010
|
+
var dateFields = [
|
|
8011
|
+
{ flag: "start-time", type: "string", required: true, desc: "Inclusive ISO date/time lower bound." },
|
|
8012
|
+
{ flag: "end-time", type: "string", required: true, desc: "Inclusive ISO date/time upper bound." }
|
|
8013
|
+
];
|
|
8014
|
+
var systemUsageCommands = [
|
|
8015
|
+
defineSystemCommand({
|
|
8016
|
+
resource: "usage",
|
|
8017
|
+
command: "overview",
|
|
8018
|
+
capabilityId: "system.usage.overview",
|
|
8019
|
+
description: "Get the current company system-usage summary.",
|
|
8020
|
+
risk: "read"
|
|
8021
|
+
}),
|
|
8022
|
+
defineSystemCommand({
|
|
8023
|
+
resource: "project-usage",
|
|
8024
|
+
command: "list",
|
|
8025
|
+
capabilityId: "system.project_usage.list",
|
|
8026
|
+
description: "List project storage and usage statistics in a bounded time range.",
|
|
8027
|
+
risk: "read",
|
|
8028
|
+
fields: [
|
|
8029
|
+
...dateFields,
|
|
8030
|
+
fieldsField,
|
|
8031
|
+
limitField,
|
|
8032
|
+
offsetField,
|
|
8033
|
+
{ flag: "sort-by", type: "string", desc: "Sort field.", allowed: ["data_num", "project_id", "project_name", "status"] },
|
|
8034
|
+
{ flag: "sort-order", type: "string", desc: "Sort direction.", allowed: ["asc", "desc"] }
|
|
8035
|
+
]
|
|
8036
|
+
}),
|
|
8037
|
+
defineSystemCommand({
|
|
8038
|
+
resource: "usage-trend",
|
|
8039
|
+
command: "query",
|
|
8040
|
+
capabilityId: "system.usage_trend.query",
|
|
8041
|
+
description: "Query a bounded company or project usage trend.",
|
|
8042
|
+
risk: "read",
|
|
8043
|
+
fields: [
|
|
8044
|
+
...dateFields,
|
|
8045
|
+
{ flag: "metric", type: "string", required: true, desc: "Supported usage metric; apollo_token is not available." },
|
|
8046
|
+
{ flag: "time-granularity", type: "string", required: true, desc: "Aggregation granularity.", allowed: ["day", "week", "month"] },
|
|
8047
|
+
{ flag: "scope", type: "string", desc: "Aggregation scope.", allowed: ["company", "project"] },
|
|
8048
|
+
{ flag: "project-ids", type: "json", array: true, desc: "Project ID JSON array; required for project scope." },
|
|
8049
|
+
{ flag: "data-type", type: "string", desc: "Optional event-volume data type.", allowed: ["all", "event", "user"] }
|
|
8050
|
+
],
|
|
8051
|
+
validate: (_ctx, input) => {
|
|
8052
|
+
if (input.metric === "apollo_token") {
|
|
8053
|
+
throw validation("--metric apollo_token is not implemented by the current service.");
|
|
8054
|
+
}
|
|
8055
|
+
if (input.scope === "project" && (!Array.isArray(input.project_ids) || input.project_ids.length === 0)) {
|
|
8056
|
+
throw validation("--project-ids is required when --scope project.");
|
|
8057
|
+
}
|
|
8058
|
+
}
|
|
8059
|
+
}),
|
|
8060
|
+
defineSystemCommand({
|
|
8061
|
+
resource: "usage-trend",
|
|
8062
|
+
command: "export",
|
|
8063
|
+
capabilityId: "system.usage_trend.export",
|
|
8064
|
+
description: "Export a bounded usage trend as a cancellable run-scoped gzip JSONL artifact.",
|
|
8065
|
+
risk: "read",
|
|
8066
|
+
fields: [
|
|
8067
|
+
...dateFields,
|
|
8068
|
+
{ flag: "metric", type: "string", required: true, desc: "Supported usage metric; apollo_token is not available." },
|
|
8069
|
+
{ flag: "time-granularity", type: "string", required: true, desc: "Aggregation granularity.", allowed: ["day", "week", "month"] },
|
|
8070
|
+
{ flag: "scope", type: "string", desc: "Aggregation scope.", allowed: ["company", "project"] },
|
|
8071
|
+
{ flag: "project-ids", type: "json", array: true, desc: "Project ID JSON array; required for project scope." },
|
|
8072
|
+
{ flag: "data-type", type: "string", desc: "Optional event-volume data type.", allowed: ["all", "event", "user"] },
|
|
8073
|
+
{
|
|
8074
|
+
flag: "request-id",
|
|
8075
|
+
type: "string",
|
|
8076
|
+
pattern: "^cli_[0-9a-f]{32}$",
|
|
8077
|
+
desc: "Optional caller-supplied cli_<32 lowercase hex> lifecycle ID; ae-cli generates one before dispatch when omitted."
|
|
8078
|
+
},
|
|
8079
|
+
{
|
|
8080
|
+
flag: "timeout-seconds",
|
|
8081
|
+
type: "number",
|
|
8082
|
+
min: 1,
|
|
8083
|
+
max: 21600,
|
|
8084
|
+
desc: "Maximum export runtime in seconds. Default and max: 21600."
|
|
8085
|
+
}
|
|
8086
|
+
],
|
|
8087
|
+
validate: (_ctx, input) => {
|
|
8088
|
+
if (input.metric === "apollo_token") {
|
|
8089
|
+
throw validation("--metric apollo_token is not implemented by the current service.");
|
|
8090
|
+
}
|
|
8091
|
+
if (input.scope === "project" && (!Array.isArray(input.project_ids) || input.project_ids.length === 0)) {
|
|
8092
|
+
throw validation("--project-ids is required when --scope project.");
|
|
8093
|
+
}
|
|
8094
|
+
}
|
|
8095
|
+
})
|
|
8096
|
+
];
|
|
8097
|
+
|
|
8098
|
+
// src/commands/te-analysis/system/index.ts
|
|
8099
|
+
var commands78 = [
|
|
8100
|
+
...systemUsageCommands,
|
|
8101
|
+
...systemIdentityCommands,
|
|
8102
|
+
...systemSecurityCommands,
|
|
8103
|
+
...systemMonitoringCommands,
|
|
8104
|
+
...systemConfigurationCommands
|
|
8105
|
+
];
|
|
8106
|
+
var system_default = commands78;
|
|
6524
8107
|
|
|
6525
8108
|
// src/commands/te-analysis/index.ts
|
|
6526
8109
|
registerCapabilityGatewayRoute("analysis", { gatewayDomain: "analysis" });
|
|
8110
|
+
registerCapabilityGatewayRoute("project", { gatewayDomain: "analysis" });
|
|
8111
|
+
registerCapabilityGatewayRoute("system", { gatewayDomain: "analysis" });
|
|
6527
8112
|
registerCapabilityGatewayRoute("tracking", { gatewayDomain: "analysis" });
|
|
6528
8113
|
var baseCommands = [
|
|
6529
8114
|
...meta_default,
|
|
@@ -6564,10 +8149,11 @@ var baseCommands = [
|
|
|
6564
8149
|
...alert_default,
|
|
6565
8150
|
...alert_detail_default,
|
|
6566
8151
|
...alert_job_default,
|
|
6567
|
-
...alert_notice_config_default
|
|
8152
|
+
...alert_notice_config_default,
|
|
8153
|
+
...system_default
|
|
6568
8154
|
];
|
|
6569
|
-
var
|
|
6570
|
-
var te_analysis_default =
|
|
8155
|
+
var commands79 = [...baseCommands];
|
|
8156
|
+
var te_analysis_default = commands79;
|
|
6571
8157
|
export {
|
|
6572
8158
|
baseCommands,
|
|
6573
8159
|
te_analysis_default as default
|