@thinkingai/ae-cli 6.1.17 → 6.1.19
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 +2 -0
- package/README.zh.md +6 -0
- package/dist/{auth-77BUFLGC.js → auth-QPEVVBKT.js} +20 -15
- package/dist/auth-UMJAA72O.js +15 -0
- package/dist/{capability-72DTW5M2.js → capability-ASI62I4A.js} +53 -15
- package/dist/{chunk-UW5UN47B.js → chunk-533JK3YX.js} +2 -0
- package/dist/{chunk-UOUS37JQ.js → chunk-6QK7SYYY.js} +5 -4
- package/dist/{chunk-TUKQZTMI.js → chunk-7K24F7T2.js} +2 -0
- package/dist/{chunk-OO6XR6LK.js → chunk-AMBFK2K3.js} +2 -0
- package/dist/{sync-DAVKYVMW.js → chunk-B5HMQAOM.js} +31 -540
- package/dist/{chunk-VR3LCBHW.js → chunk-DKEXH6Q5.js} +6 -5
- package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
- package/dist/{chunk-LYVNONC4.js → chunk-FR2EDAQM.js} +36 -0
- package/dist/{chunk-ILIU36SU.js → chunk-GJXRF7Y6.js} +6 -5
- package/dist/{chunk-DWO43OIB.js → chunk-JQ3ENZZH.js} +2 -0
- package/dist/chunk-JYMGHGCE.js +191 -0
- package/dist/{chunk-GT46FPXN.js → chunk-KEWVSO64.js} +18 -8
- package/dist/chunk-KZ6ZHF5J.js +294 -0
- package/dist/chunk-O6K2ODUE.js +318 -0
- package/dist/chunk-QL6R6TSK.js +25215 -0
- package/dist/{chunk-4SGZG4XY.js → chunk-RWXIXOZG.js} +28 -13
- package/dist/{chunk-YA6SMTXG.js → chunk-S5PONFBM.js} +5 -4
- package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
- package/dist/{chunk-PTE56QPL.js → chunk-TKHSULJT.js} +6 -0
- package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
- package/dist/{client-TKG4WBHN.js → client-N7NGZUNI.js} +6 -4
- package/dist/{community-report-client-FI4LNVYS.js → community-report-client-6OL6GBQW.js} +3 -3
- package/dist/{config-RE6CMGPK.js → config-XNMACCKX.js} +10 -8
- package/dist/{data-integration-XQYB4X4F.js → data-integration-4NZGZ45E.js} +2502 -272
- package/dist/index.js +137 -1245
- package/dist/{local-data-upload-client-BWHSUQQK.js → local-data-upload-client-EFHDLXFG.js} +3 -3
- package/dist/{memory-YK33G4T7.js → memory-HBJQ2GC5.js} +8 -7
- package/dist/{metadata-UILXHBWF.js → metadata-62EWBEIG.js} +12 -11
- package/dist/{model-NR3JHFSJ.js → model-BHLJ2QMT.js} +10 -9
- package/dist/personal-semantic-preference-JBVMAI7L.js +240 -0
- package/dist/project-semantic-BQ4MPUS5.js +1115 -0
- package/dist/sync-MUWPRM5I.js +522 -0
- package/dist/{te-agent-4BKBODMF.js → te-agent-WQZTMEK4.js} +12 -10
- package/dist/{te-analysis-O6DCO6BS.js → te-analysis-MNCG65LU.js} +534 -48
- package/dist/{te-community-HLC43QKH.js → te-community-BNE6KREL.js} +8 -7
- package/dist/{te-dataops-EJP56W3K.js → te-dataops-TXLKM2W6.js} +469 -68
- package/dist/{te-engage-FGBGQ4IY.js → te-engage-TPKLRVTL.js} +84 -10
- package/dist/{te-experiment-SO5MPDMJ.js → te-experiment-6BYKTCY7.js} +303 -12
- package/dist/{te-kb-SQCLHG6X.js → te-kb-BUD6N3NI.js} +312 -25
- package/dist/{te-system-YARIK4S5.js → te-system-44LZJDTQ.js} +573 -37
- package/dist/{te-team-EFKWYKMK.js → te-team-XMP47YXE.js} +10 -7
- package/dist/{update-OGPSZM5A.js → update-UODFOZ4P.js} +9 -7
- package/package.json +18 -9
- package/skills/ae-agent/SKILL.md +3 -4
- package/skills/ae-agent/references/edit-skill.md +3 -0
- package/skills/ae-agent/references/get-skill-content.md +1 -1
- package/skills/ae-agent/references/rescan-skills.md +15 -13
- package/skills/ae-agent/references/upload-skill.md +7 -4
- package/skills/ae-analysis/SKILL.md +45 -4
- package/skills/ae-analysis/metadata_resolution.md +38 -4
- package/skills/ae-analysis/references/analysis_data_retrieval.md +29 -0
- package/skills/ae-analysis/references/analysis_gateway_assets.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_export.md +22 -0
- package/skills/ae-analysis/references/asset_authentication_list.md +18 -14
- package/skills/ae-analysis/references/asset_authentication_update.md +29 -14
- package/skills/ae-analysis/references/audience_models.md +18 -0
- package/skills/ae-analysis/references/command_index.md +19 -11
- package/skills/ae-analysis/references/dashboard_get.md +18 -1
- package/skills/ae-analysis/references/dashboard_update.md +3 -0
- package/skills/ae-analysis/references/personal_semantic_preference_add.md +23 -0
- package/skills/ae-analysis/references/personal_semantic_preference_delete.md +17 -0
- package/skills/ae-analysis/references/personal_semantic_preference_get.md +19 -0
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +21 -0
- package/skills/ae-analysis/references/personal_semantic_preference_update.md +19 -0
- package/skills/ae-analysis/references/project_timezone_update.md +13 -4
- package/skills/ae-analysis/references/property_create.md +2 -0
- package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
- package/skills/ae-analysis/references/user_cluster_models.md +2 -0
- package/skills/ae-analysis/references/user_cluster_update.md +8 -4
- package/skills/ae-analysis/references/user_tag_create.md +7 -1
- package/skills/ae-analysis/references/user_tag_models.md +8 -2
- package/skills/ae-data-integration/SKILL.md +24 -4
- package/skills/ae-data-integration/references/custom-layer.md +93 -0
- package/skills/ae-data-integration/references/error-handling.md +145 -0
- package/skills/ae-data-integration/references/handoff.md +77 -18
- package/skills/ae-data-integration/references/local-analysis.md +1 -1
- package/skills/ae-data-integration/references/reuse.md +9 -5
- package/skills/ae-data-integration/references/sink-upload.md +1 -1
- package/skills/ae-data-integration/references/source-inspect.md +35 -13
- package/skills/ae-data-integration/references/tracking-plan.md +7 -5
- package/skills/ae-data-integration/references/transform.md +12 -10
- package/skills/ae-data-integration/references/ue-mapping.md +33 -11
- package/skills/ae-data-integration/references/ue-routing.md +23 -0
- package/skills/ae-dataops/SKILL.md +11 -1
- package/skills/ae-dataops/references/dataops-backfill.md +135 -0
- package/skills/ae-engage/SKILL.md +5 -0
- package/skills/ae-engage/references/build-task-save-guide.md +14 -1
- package/skills/ae-engage/references/save-flow.md +37 -1
- package/skills/ae-engage/references/save-task.md +88 -0
- package/skills/ae-experiment/SKILL.md +14 -4
- package/skills/ae-experiment/references/manage_feature_whitelist.md +66 -0
- package/skills/ae-experiment/references/manage_guardrail_metrics.md +26 -0
- package/skills/ae-experiment/references/save_experiment.md +1 -1
- package/skills/ae-experiment/references/save_metric.md +20 -8
- package/skills/ae-kb/SKILL.md +121 -10
- package/skills/ae-project-semantic/SKILL.md +193 -0
- package/skills/ae-project-semantic/references/query-routing-v5.md +165 -0
- package/skills/ae-project-semantic/references/recommendation-quality.md +68 -0
- package/skills/ae-system/SKILL.md +28 -30
- package/skills/ae-system/references/channel-management.md +303 -0
- package/dist/auth-2WTQOP77.js +0 -14
- package/dist/capability-PJHNI4GJ.js +0 -315
- package/dist/chunk-4KVPKXFX.js +0 -98
- package/dist/chunk-C4MGVGJW.js +0 -13
- package/dist/chunk-P3FGXJTU.js +0 -349
- package/dist/chunk-QGM4M3NI.js +0 -37
- package/dist/chunk-RGKJGKT7.js +0 -71
- package/dist/chunk-SAU3QFIQ.js +0 -556
- package/dist/chunk-VPKZ7I72.js +0 -509
- package/dist/chunk-ZZUOD757.js +0 -598
- package/dist/memory-CHRU2F7W.js +0 -893
- package/dist/metadata-XXR34N5P.js +0 -339
- package/dist/model-K3KLWIW6.js +0 -139
- package/dist/sync-FCKOVWWS.js +0 -10261
- package/dist/te-agent-HLW4VTQK.js +0 -3893
- package/dist/te-analysis-ZMNGOVNW.js +0 -8958
- package/dist/te-community-6HPBWJUZ.js +0 -1859
- package/dist/te-dataops-HDRUXY4K.js +0 -2208
- package/dist/te-engage-RAK5PESW.js +0 -4898
- package/dist/te-experiment-VZF7BT6G.js +0 -770
- package/dist/te-system-Z77IKZFN.js +0 -2213
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
normalizeRiskLevel,
|
|
3
|
-
requiresConfirmation
|
|
4
|
-
} from "./chunk-OO6XR6LK.js";
|
|
5
|
-
import {
|
|
6
|
-
findGatewayDomain,
|
|
7
|
-
resolveGatewayDomain
|
|
8
|
-
} from "./chunk-PTE56QPL.js";
|
|
9
|
-
import {
|
|
10
|
-
printError,
|
|
11
|
-
printOutput
|
|
12
|
-
} from "./chunk-GT46FPXN.js";
|
|
13
|
-
import {
|
|
14
|
-
CapabilityGatewayError,
|
|
15
|
-
dryRunCapability,
|
|
16
|
-
executeCapability,
|
|
17
|
-
inspectCapability,
|
|
18
|
-
listCapabilities,
|
|
19
|
-
validateCapability
|
|
20
|
-
} from "./chunk-ILIU36SU.js";
|
|
21
|
-
import "./chunk-6EIJSNBD.js";
|
|
22
|
-
import "./chunk-4SGZG4XY.js";
|
|
23
|
-
import {
|
|
24
|
-
SecureStoreAuthError,
|
|
25
|
-
resolveHost,
|
|
26
|
-
safeJsonParse
|
|
27
|
-
} from "./chunk-ZZUOD757.js";
|
|
28
|
-
import {
|
|
29
|
-
PermissionError
|
|
30
|
-
} from "./chunk-UW5UN47B.js";
|
|
31
|
-
import "./chunk-LYVNONC4.js";
|
|
32
|
-
import "./chunk-QGM4M3NI.js";
|
|
33
|
-
|
|
34
|
-
// src/commands/capability/index.ts
|
|
35
|
-
import * as readline from "readline";
|
|
36
|
-
|
|
37
|
-
// src/commands/capability/helpers.ts
|
|
38
|
-
import { readFileSync } from "fs";
|
|
39
|
-
var CapabilityCommandValidationError = class extends Error {
|
|
40
|
-
constructor(message, hint, code) {
|
|
41
|
-
super(message);
|
|
42
|
-
this.hint = hint;
|
|
43
|
-
this.code = code;
|
|
44
|
-
this.name = "CapabilityCommandValidationError";
|
|
45
|
-
}
|
|
46
|
-
hint;
|
|
47
|
-
code;
|
|
48
|
-
};
|
|
49
|
-
function capabilityNamespace(capabilityId) {
|
|
50
|
-
return capabilityId.split(".")[0] ?? "";
|
|
51
|
-
}
|
|
52
|
-
function resolveCapabilityGatewayDomain(capabilityId, domainOverride) {
|
|
53
|
-
const cliDomain = domainOverride?.trim() || capabilityNamespace(capabilityId);
|
|
54
|
-
return resolveCapabilityListDomain(cliDomain);
|
|
55
|
-
}
|
|
56
|
-
function resolveCapabilityListDomain(cliDomain) {
|
|
57
|
-
if (!cliDomain) {
|
|
58
|
-
throw new CapabilityCommandValidationError(
|
|
59
|
-
"Cannot determine the capability domain.",
|
|
60
|
-
"Pass --domain <domain>."
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
return resolveGatewayDomain(cliDomain, findGatewayDomain(cliDomain) ?? cliDomain);
|
|
64
|
-
}
|
|
65
|
-
function parseOptionalProjectId(raw) {
|
|
66
|
-
if (raw === void 0) {
|
|
67
|
-
return void 0;
|
|
68
|
-
}
|
|
69
|
-
const value = raw.trim();
|
|
70
|
-
if (!/^[1-9]\d*$/.test(value)) {
|
|
71
|
-
throw new CapabilityCommandValidationError(
|
|
72
|
-
"--project-id must be a positive integer.",
|
|
73
|
-
"Example: --project-id 1"
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
const projectId = Number(value);
|
|
77
|
-
if (!Number.isSafeInteger(projectId)) {
|
|
78
|
-
throw new CapabilityCommandValidationError(
|
|
79
|
-
"--project-id is outside the supported integer range.",
|
|
80
|
-
"Pass a positive safe integer."
|
|
81
|
-
);
|
|
82
|
-
}
|
|
83
|
-
return projectId;
|
|
84
|
-
}
|
|
85
|
-
function normalizeCapabilityList(value) {
|
|
86
|
-
if (!Array.isArray(value)) {
|
|
87
|
-
throw new Error("Capability gateway returned an invalid catalog: expected an array.");
|
|
88
|
-
}
|
|
89
|
-
return value.filter((item) => {
|
|
90
|
-
return item !== null && typeof item === "object" && typeof item.id === "string";
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
function filterCapabilities(capabilities, domain, query) {
|
|
94
|
-
const prefix = `${domain.toLowerCase()}.`;
|
|
95
|
-
const terms = query?.trim().toLowerCase().split(/\s+/).filter(Boolean) ?? [];
|
|
96
|
-
return capabilities.filter((capability) => {
|
|
97
|
-
if (!capability.id.toLowerCase().startsWith(prefix)) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
if (terms.length === 0) {
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
const searchable = `${capability.id} ${capability.description ?? ""}`.toLowerCase();
|
|
104
|
-
return terms.every((term) => searchable.includes(term));
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
function parseCapabilityInput(raw) {
|
|
108
|
-
if (!raw) {
|
|
109
|
-
return {};
|
|
110
|
-
}
|
|
111
|
-
const trimmed = raw.trim();
|
|
112
|
-
let parsed;
|
|
113
|
-
try {
|
|
114
|
-
if (trimmed === "-") {
|
|
115
|
-
parsed = safeJsonParse(readFileSync(0, "utf8"));
|
|
116
|
-
} else if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
117
|
-
parsed = safeJsonParse(trimmed);
|
|
118
|
-
} else {
|
|
119
|
-
const path = trimmed.startsWith("@") ? trimmed.slice(1) : trimmed;
|
|
120
|
-
parsed = safeJsonParse(readFileSync(path, "utf8"));
|
|
121
|
-
}
|
|
122
|
-
} catch (error) {
|
|
123
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
124
|
-
throw new CapabilityCommandValidationError(
|
|
125
|
-
`Invalid capability input: ${message}`,
|
|
126
|
-
"Pass an inline JSON object, a JSON file path, @<path>, or - for stdin."
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
130
|
-
throw new CapabilityCommandValidationError(
|
|
131
|
-
"Capability input must be a JSON object.",
|
|
132
|
-
`Example: --input '{"project_id":1}'`
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
const input = parsed;
|
|
136
|
-
if (Object.prototype.hasOwnProperty.call(input, "projectId")) {
|
|
137
|
-
throw new CapabilityCommandValidationError(
|
|
138
|
-
"Unsupported capability input field: projectId.",
|
|
139
|
-
"Use the canonical snake_case field project_id.",
|
|
140
|
-
"UNSUPPORTED_INPUT_FIELDS"
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
return input;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// src/commands/capability/index.ts
|
|
147
|
-
function registerCapability(program) {
|
|
148
|
-
const capability = program.command("capability").description("Discover and invoke capability gateway operations").action(() => {
|
|
149
|
-
printError("validation", "Missing subcommand.", "Run: ae-cli capability --help");
|
|
150
|
-
process.exitCode = 1;
|
|
151
|
-
});
|
|
152
|
-
capability.command("list").description("List capability summaries in a domain").requiredOption("--domain <domain>", "Capability namespace, such as analysis or metadata").option("--project-id <project-id>", "Filter by project membership, permissions, and enabled features").action(async (opts) => {
|
|
153
|
-
await executeAndPrint(program, async (host) => {
|
|
154
|
-
const gatewayDomain = resolveCapabilityListDomain(opts.domain);
|
|
155
|
-
const projectId = parseOptionalProjectId(opts.projectId);
|
|
156
|
-
const catalog = normalizeCapabilityList(await listCapabilities(host, gatewayDomain, projectId));
|
|
157
|
-
const capabilities = filterCapabilities(catalog, opts.domain);
|
|
158
|
-
return { domain: opts.domain, count: capabilities.length, capabilities };
|
|
159
|
-
});
|
|
160
|
-
}).addHelpText(
|
|
161
|
-
"after",
|
|
162
|
-
"\nExamples:\n ae-cli capability list --domain analysis\n ae-cli capability list --domain analysis --project-id 1"
|
|
163
|
-
);
|
|
164
|
-
capability.command("search").description("Search capability IDs and descriptions in a domain").argument("<query>", "Case-insensitive search terms").requiredOption(
|
|
165
|
-
"--domain <domain>",
|
|
166
|
-
"Capability namespace. One of: analysis, project, system, tracking, metadata, experiment, engage-flow, engage-task, engage-setting, engage-scene, engage-activity, engage-workbench, community"
|
|
167
|
-
).option("--project-id <project-id>", "Filter by project membership, permissions, and enabled features").action(async (query, opts) => {
|
|
168
|
-
await executeAndPrint(program, async (host) => {
|
|
169
|
-
const gatewayDomain = resolveCapabilityListDomain(opts.domain);
|
|
170
|
-
const projectId = parseOptionalProjectId(opts.projectId);
|
|
171
|
-
const catalog = normalizeCapabilityList(await listCapabilities(host, gatewayDomain, projectId));
|
|
172
|
-
const capabilities = filterCapabilities(catalog, opts.domain, query);
|
|
173
|
-
return { domain: opts.domain, query, count: capabilities.length, capabilities };
|
|
174
|
-
});
|
|
175
|
-
}).addHelpText(
|
|
176
|
-
"after",
|
|
177
|
-
'\nDomains (--domain):\n analysis, project, system, tracking, metadata,\n experiment, engage-flow, engage-task, engage-setting,\n engage-scene, engage-activity, engage-workbench, community\n\nExamples:\n ae-cli capability search "dashboard list" --domain analysis\n ae-cli capability search "dashboard list" --domain analysis --project-id 1\n ae-cli capability search "info list" --domain project\n ae-cli capability search "usage" --domain system\n ae-cli capability search "plan" --domain tracking\n ae-cli capability search "data_table" --domain metadata\n ae-cli capability search "report" --domain experiment\n ae-cli capability search "flow" --domain engage-flow\n ae-cli capability search "task" --domain engage-task\n ae-cli capability search "channel" --domain engage-setting\n ae-cli capability search "strategy" --domain engage-scene\n ae-cli capability search "topic" --domain engage-activity\n ae-cli capability search "workbench" --domain engage-workbench\n ae-cli capability search "post" --domain community'
|
|
178
|
-
);
|
|
179
|
-
capability.command("inspect").description("Inspect one capability schema, risk, auth, and output metadata").argument("<capability-id>", "Capability ID, such as analysis.report.list").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--project-id <project-id>", "Check availability in a project before returning metadata").action(async (capabilityId, opts) => {
|
|
180
|
-
await executeAndPrint(program, async (host) => {
|
|
181
|
-
const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
|
|
182
|
-
return inspectCapability(host, gatewayDomain, capabilityId, parseOptionalProjectId(opts.projectId));
|
|
183
|
-
});
|
|
184
|
-
}).addHelpText(
|
|
185
|
-
"after",
|
|
186
|
-
"\nExamples:\n ae-cli capability inspect analysis.dashboard.list\n ae-cli capability inspect analysis.dashboard.list --project-id 1"
|
|
187
|
-
);
|
|
188
|
-
capability.command("validate").description(
|
|
189
|
-
"Validate and normalize capability input only (schema/params). Does not execute business logic. Use when crafting complex payloads (nested objects, qp, share/member payloads) before dry-run/run. Success data: valid, capability_id, normalized_input. Unlike dry-run, does not return risk/output_mode/supports_cancel preview."
|
|
190
|
-
).argument("<capability-id>", "Capability ID, such as metadata.data_table.sql_write").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--input <json-or-path>", "Input JSON object, file path, @<path>, or - for stdin").action(async (capabilityId, opts) => {
|
|
191
|
-
await executeAndPrint(program, async (host) => {
|
|
192
|
-
const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
|
|
193
|
-
return validateCapability(host, gatewayDomain, capabilityId, parseCapabilityInput(opts.input));
|
|
194
|
-
});
|
|
195
|
-
}).addHelpText(
|
|
196
|
-
"after",
|
|
197
|
-
`
|
|
198
|
-
When to use:
|
|
199
|
-
Prefer validate while iterating complex input (required fields, types, qp shape), then run.
|
|
200
|
-
Prefer dry-run alone when you need risk / output mode / cancelability or a delete gate.
|
|
201
|
-
Motto: validate = fix params; dry-run = confirm ready to run.
|
|
202
|
-
Do not stack validate + dry-run on the same final input by default (dry-run already validates params).
|
|
203
|
-
Neither mutates business data. Curated gateway commands: global --validate / --dry-run.
|
|
204
|
-
|
|
205
|
-
Examples:
|
|
206
|
-
ae-cli capability validate metadata.data_table.sql_write --input '{"project_id":1,"operation":"create",...}'
|
|
207
|
-
ae-cli metadata data-table sql-write --project-id 1 ... --validate
|
|
208
|
-
ae-cli capability validate analysis.project_space.create --input input.json`
|
|
209
|
-
);
|
|
210
|
-
capability.command("dry-run").description(
|
|
211
|
-
"Full pre-execution confirmation without running business logic: validates/normalizes input and returns risk, output_mode, and supports_cancel. Use alone when you need that preview or a delete gate (do not stack after validate on the same final input by default). Global --dry-run on curated/capability run also hits this endpoint."
|
|
212
|
-
).argument("<capability-id>", "Capability ID, such as analysis.query.export").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--input <json-or-path>", "Input JSON object, file path, @<path>, or - for stdin").action(async (capabilityId, opts) => {
|
|
213
|
-
await executeAndPrint(program, async (host) => {
|
|
214
|
-
const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
|
|
215
|
-
return dryRunCapability(host, gatewayDomain, capabilityId, parseCapabilityInput(opts.input));
|
|
216
|
-
});
|
|
217
|
-
}).addHelpText(
|
|
218
|
-
"after",
|
|
219
|
-
`
|
|
220
|
-
Examples:
|
|
221
|
-
ae-cli capability dry-run analysis.dashboard.list --input '{"project_id":1}'
|
|
222
|
-
ae-cli capability dry-run analysis.dashboard.list --input input.json`
|
|
223
|
-
);
|
|
224
|
-
capability.command("run").description("Execute one capability by ID").argument("<capability-id>", "Capability ID, such as analysis.report.list").option("--domain <domain>", "Override the capability namespace used for gateway routing").option("--input <json-or-path>", "Input JSON object, file path, @<path>, or - for stdin").action(async (capabilityId, opts) => {
|
|
225
|
-
await executeAndPrint(program, async (host, globalOpts) => {
|
|
226
|
-
const gatewayDomain = resolveCapabilityGatewayDomain(capabilityId, opts.domain);
|
|
227
|
-
const input = parseCapabilityInput(opts.input);
|
|
228
|
-
if (globalOpts.validate && globalOpts.dryRun) {
|
|
229
|
-
throw new CapabilityCommandValidationError(
|
|
230
|
-
"Cannot combine --validate and --dry-run.",
|
|
231
|
-
"Use --validate to fix parameters; use --dry-run as the pre-execution confirmation."
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
if (globalOpts.validate) {
|
|
235
|
-
return validateCapability(host, gatewayDomain, capabilityId, input);
|
|
236
|
-
}
|
|
237
|
-
if (globalOpts.dryRun) {
|
|
238
|
-
return dryRunCapability(host, gatewayDomain, capabilityId, input);
|
|
239
|
-
}
|
|
240
|
-
if (!globalOpts.yes) {
|
|
241
|
-
const metadata = await inspectCapability(host, gatewayDomain, capabilityId);
|
|
242
|
-
const risk = normalizeRiskLevel(typeof metadata?.risk === "string" ? metadata.risk : void 0);
|
|
243
|
-
if (requiresConfirmation(risk)) {
|
|
244
|
-
const confirmed = await confirm(`This capability is marked ${risk} (${capabilityId}). Continue?`);
|
|
245
|
-
if (!confirmed) {
|
|
246
|
-
process.stderr.write("Aborted.\n");
|
|
247
|
-
return void 0;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
return executeCapability(host, gatewayDomain, capabilityId, input);
|
|
252
|
-
});
|
|
253
|
-
}).addHelpText(
|
|
254
|
-
"after",
|
|
255
|
-
`
|
|
256
|
-
Examples:
|
|
257
|
-
ae-cli capability run analysis.dashboard.list --input '{"project_id":1}'
|
|
258
|
-
ae-cli capability run analysis.dashboard.list --input input.json`
|
|
259
|
-
);
|
|
260
|
-
}
|
|
261
|
-
async function executeAndPrint(program, action) {
|
|
262
|
-
const globalOpts = program.opts();
|
|
263
|
-
const host = resolveHost(globalOpts.host);
|
|
264
|
-
if (!host) {
|
|
265
|
-
printError("config", "No AE host configured.", "Run: ae-cli config set-host <url>");
|
|
266
|
-
process.exitCode = 1;
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
try {
|
|
270
|
-
const result = await action(host, globalOpts);
|
|
271
|
-
if (result !== void 0) {
|
|
272
|
-
await printOutput(result, globalOpts.format ?? "json", globalOpts.jq);
|
|
273
|
-
}
|
|
274
|
-
} catch (error) {
|
|
275
|
-
if (error?.type === "validation" && String(error?.message || "").includes("--jq")) {
|
|
276
|
-
printError("validation", error.message, error.hint);
|
|
277
|
-
process.exitCode = 1;
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
printCapabilityError(error);
|
|
281
|
-
process.exitCode = 1;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
function printCapabilityError(error) {
|
|
285
|
-
if (error instanceof CapabilityCommandValidationError) {
|
|
286
|
-
printError("validation", error.message, error.hint, error.code);
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
if (error instanceof SecureStoreAuthError) {
|
|
290
|
-
printError("auth", error.message, "Run: ae-cli auth login");
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
if (error instanceof PermissionError) {
|
|
294
|
-
printError("permission", error.message, void 0, error.code);
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
if (error instanceof CapabilityGatewayError) {
|
|
298
|
-
printError("api", error.message, error.hint, error.code);
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
302
|
-
printError("api", message);
|
|
303
|
-
}
|
|
304
|
-
async function confirm(message) {
|
|
305
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stderr });
|
|
306
|
-
return new Promise((resolve) => {
|
|
307
|
-
rl.question(`${message} [y/N] `, (answer) => {
|
|
308
|
-
rl.close();
|
|
309
|
-
resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
export {
|
|
314
|
-
registerCapability
|
|
315
|
-
};
|
package/dist/chunk-4KVPKXFX.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getCliToken
|
|
3
|
-
} from "./chunk-4SGZG4XY.js";
|
|
4
|
-
import {
|
|
5
|
-
safeJsonParse
|
|
6
|
-
} from "./chunk-ZZUOD757.js";
|
|
7
|
-
import {
|
|
8
|
-
PermissionError
|
|
9
|
-
} from "./chunk-UW5UN47B.js";
|
|
10
|
-
|
|
11
|
-
// src/core/mcp-access.ts
|
|
12
|
-
function buildUrl(host, path, params = {}) {
|
|
13
|
-
const base = host.replace(/\/$/, "");
|
|
14
|
-
const p = path.startsWith("/") ? path : `/${path}`;
|
|
15
|
-
const url = new URL(`${base}${p}`);
|
|
16
|
-
for (const [key, value] of Object.entries(params)) {
|
|
17
|
-
if (value !== void 0 && value !== null) {
|
|
18
|
-
url.searchParams.set(key, String(value));
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return url.toString();
|
|
22
|
-
}
|
|
23
|
-
function parseKbResponse(resp, text) {
|
|
24
|
-
if (resp.status === 403) {
|
|
25
|
-
let msg = "Permission denied for this resource (HTTP 403)";
|
|
26
|
-
try {
|
|
27
|
-
const d = safeJsonParse(text);
|
|
28
|
-
const m = d && (typeof d.error === "string" ? d.error : d.error?.message || d.message);
|
|
29
|
-
if (m && typeof m === "string") msg = m;
|
|
30
|
-
} catch {
|
|
31
|
-
}
|
|
32
|
-
throw new PermissionError(msg);
|
|
33
|
-
}
|
|
34
|
-
if (resp.status === 401) {
|
|
35
|
-
throw new Error(
|
|
36
|
-
`KB API token auth failed: HTTP ${resp.status} ${resp.statusText}`
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
const data = safeJsonParse(text);
|
|
40
|
-
if (data.return_code === -1001) {
|
|
41
|
-
throw new Error(
|
|
42
|
-
`KB API token auth failed: ${data.return_message || "unauthorized"} (code: ${data.return_code})`
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
if (data.return_code !== 0 && data.return_code !== void 0) {
|
|
46
|
-
throw new Error(
|
|
47
|
-
`AE API error: ${data.return_message || "unknown"} (code: ${data.return_code})`
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
if (data && typeof data === "object" && typeof data.error === "string" && data.error.trim() && data.return_code === void 0 && data.success === void 0) {
|
|
51
|
-
throw new Error(data.error);
|
|
52
|
-
}
|
|
53
|
-
return data.data !== void 0 ? data.data : data;
|
|
54
|
-
}
|
|
55
|
-
async function fetchWithCliToken(input, init, cliToken) {
|
|
56
|
-
const headers = new Headers(init.headers);
|
|
57
|
-
headers.set("cli-token", cliToken);
|
|
58
|
-
const resp = await fetch(input, { ...init, headers });
|
|
59
|
-
return parseKbResponse(resp, await resp.text());
|
|
60
|
-
}
|
|
61
|
-
async function getAuthHeaders(ctx) {
|
|
62
|
-
const cliToken = await getCliToken(ctx.host());
|
|
63
|
-
return { "cli-token": cliToken };
|
|
64
|
-
}
|
|
65
|
-
async function kbApi(ctx, method, path, params = {}, body) {
|
|
66
|
-
const host = ctx.host();
|
|
67
|
-
const cliToken = await getCliToken(host);
|
|
68
|
-
const upperMethod = method.toUpperCase();
|
|
69
|
-
return fetchWithCliToken(
|
|
70
|
-
buildUrl(host, path, params),
|
|
71
|
-
{
|
|
72
|
-
method: upperMethod,
|
|
73
|
-
headers: {
|
|
74
|
-
"Content-Type": "application/json"
|
|
75
|
-
},
|
|
76
|
-
body: upperMethod === "GET" ? void 0 : JSON.stringify(body ?? {})
|
|
77
|
-
},
|
|
78
|
-
cliToken
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
async function kbUpload(ctx, path, form, params = {}) {
|
|
82
|
-
const host = ctx.host();
|
|
83
|
-
const cliToken = await getCliToken(host);
|
|
84
|
-
return fetchWithCliToken(
|
|
85
|
-
buildUrl(host, path, params),
|
|
86
|
-
{
|
|
87
|
-
method: "POST",
|
|
88
|
-
body: form
|
|
89
|
-
},
|
|
90
|
-
cliToken
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export {
|
|
95
|
-
getAuthHeaders,
|
|
96
|
-
kbApi,
|
|
97
|
-
kbUpload
|
|
98
|
-
};
|
package/dist/chunk-C4MGVGJW.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isAeSandboxRuntime
|
|
3
|
-
} from "./chunk-ZZUOD757.js";
|
|
4
|
-
|
|
5
|
-
// src/core/internal-call-source.ts
|
|
6
|
-
function internalCallSourceHeaders() {
|
|
7
|
-
const source = isAeSandboxRuntime() ? "te-agent" : "ae-cli";
|
|
8
|
-
return { "X-Source": source };
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
internalCallSourceHeaders
|
|
13
|
-
};
|