@thinkingai/ae-cli 1.0.27 → 1.0.28
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/dist/auth-5NSDQFQB.js +454 -0
- package/dist/{auth-TXFJHPXU.js → auth-H2376DEF.js} +2 -3
- package/dist/chunk-AD5V3ZPJ.js +217 -0
- package/dist/chunk-CAQYQA4R.js +399 -0
- package/dist/{chunk-B4UL2VIJ.js → chunk-CLJF7MQA.js} +1 -1
- package/dist/chunk-GSJGPNKK.js +49 -0
- package/dist/{chunk-6T7245YE.js → chunk-IMBKVXKY.js} +8 -8
- package/dist/chunk-KAEZTSXN.js +99 -0
- package/dist/{chunk-VT6VC4PA.js → chunk-LU7SXK4Q.js} +24 -11
- package/dist/chunk-OJDNO5QY.js +63 -0
- package/dist/chunk-SRJIAOBN.js +244 -0
- package/dist/{chunk-2NGWYMLB.js → chunk-WCHI7725.js} +45 -50
- package/dist/{client-IU2E5IOL.js → client-FCMK3XEK.js} +3 -4
- package/dist/config-64G36TJL.js +130 -0
- package/dist/index.js +28 -23
- package/dist/{model-CC7U5XOJ.js → model-EZ6K7FXI.js} +15 -12
- package/dist/{raw-TUHZQ4UB.js → raw-VEF3D6UD.js} +11 -7
- package/dist/{sync-EVEDS7YE.js → sync-NRODEVNH.js} +36 -34
- package/dist/{te-agent-FLTDYV3L.js → te-agent-7U7JLJKU.js} +25 -23
- package/dist/{te-analysis-CMXADIJM.js → te-analysis-A2OSGHQ4.js} +59 -13
- package/dist/{te-audience-LPZFFSXM.js → te-audience-LI67PPGO.js} +5 -5
- package/dist/{te-common-BXQFKTB3.js → te-common-35WVU3C5.js} +19 -9
- package/dist/{te-community-K5S3VOZY.js → te-community-LEAP6PWT.js} +4 -4
- package/dist/{te-dataops-567IMCQG.js → te-dataops-N2LGZBOX.js} +4 -4
- package/dist/{te-engage-TBUTGW5F.js → te-engage-H7C72Z46.js} +4 -4
- package/dist/{te-kb-XHVBWP5E.js → te-kb-I2OKTBAI.js} +5 -5
- package/dist/{te-meta-NQ4U3VJW.js → te-meta-HBTIEDRO.js} +4 -4
- package/dist/{te-team-556APRIU.js → te-team-EM5OWRQL.js} +7 -7
- package/package.json +6 -2
- package/skills/ae-agent/SKILL.md +1 -0
- package/skills/ae-analysis/SKILL.md +1 -1
- package/skills/ae-analysis/references/list_clusters.md +4 -2
- package/skills/ae-analysis-global/SKILL.md +51 -0
- package/skills/ae-analysis-global/references/list_query_clusters.md +67 -0
- package/skills/ae-community/SKILL.md +2 -3
- package/skills/ae-dataops/SKILL.md +1 -2
- package/skills/ae-engage/SKILL.md +1 -0
- package/skills/ae-engage/references/add-approver.md +0 -1
- package/skills/ae-engage/references/add-channel.md +0 -1
- package/skills/ae-engage/references/approver-list.md +0 -1
- package/skills/ae-engage/references/cancel-query-by-request-id.md +0 -1
- package/skills/ae-engage/references/channel-detail.md +0 -1
- package/skills/ae-engage/references/channel-list.md +0 -1
- package/skills/ae-engage/references/config-channel-detail.md +0 -1
- package/skills/ae-engage/references/config-channel-list.md +0 -1
- package/skills/ae-engage/references/config-item-analysis-report.md +0 -1
- package/skills/ae-engage/references/config-item-detail.md +0 -1
- package/skills/ae-engage/references/config-item-list.md +0 -1
- package/skills/ae-engage/references/config-item-strategy-comparison.md +0 -1
- package/skills/ae-engage/references/config-item-trigger-report.md +0 -1
- package/skills/ae-engage/references/copy-config-template.md +0 -1
- package/skills/ae-engage/references/delete-channel.md +0 -1
- package/skills/ae-engage/references/delete-config-channel.md +0 -1
- package/skills/ae-engage/references/delete-config-item.md +0 -1
- package/skills/ae-engage/references/delete-flow.md +0 -1
- package/skills/ae-engage/references/flow-ab-split-node-report.md +0 -1
- package/skills/ae-engage/references/flow-detail.md +0 -1
- package/skills/ae-engage/references/flow-list.md +0 -1
- package/skills/ae-engage/references/flow-node-config-schema.md +0 -1
- package/skills/ae-engage/references/flow-node-detail-report.md +0 -1
- package/skills/ae-engage/references/flow-node-overview-report.md +0 -1
- package/skills/ae-engage/references/flow-process-report.md +0 -1
- package/skills/ae-engage/references/manage-flow.md +0 -1
- package/skills/ae-engage/references/manage-strategy.md +0 -1
- package/skills/ae-engage/references/manage-task.md +0 -1
- package/skills/ae-engage/references/modify-flow-base-info.md +0 -1
- package/skills/ae-engage/references/strategy-detail.md +0 -1
- package/skills/ae-engage/references/strategy-list.md +0 -1
- package/skills/ae-engage/references/task-data-detail.md +0 -1
- package/skills/ae-engage/references/task-data-overview.md +0 -1
- package/skills/ae-engage/references/task-detail.md +0 -1
- package/skills/ae-engage/references/task-experiment-report.md +0 -1
- package/skills/ae-engage/references/task-list.md +0 -1
- package/skills/ae-engage/references/task-metric-detail.md +0 -1
- package/skills/ae-engage/references/task-stats.md +0 -1
- package/skills/ae-engage/references/update-channel-status.md +0 -1
- package/skills/ae-engage/references/update-config-channel-status.md +0 -1
- package/skills/ae-engage/references/validate-flow-node-config.md +0 -1
- package/skills/ae-engage/references/whitelist-list.md +0 -1
- package/skills/ae-kb/SKILL.md +1 -0
- package/skills/ae-team/SKILL.md +1 -1
- package/dist/auth-W2JZ3DKA.js +0 -170
- package/dist/chunk-BI5ZVD6T.js +0 -186
- package/dist/chunk-MNHE6SSI.js +0 -79
- package/dist/chunk-MWWYGZ76.js +0 -130
- package/dist/chunk-SRRUNQIM.js +0 -312
- package/dist/chunk-TG64AQV4.js +0 -262
- package/dist/config-WH3R3IRY.js +0 -258
package/dist/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TeAgentCredentialsError
|
|
3
|
+
} from "./chunk-KAEZTSXN.js";
|
|
1
4
|
import {
|
|
2
5
|
printError,
|
|
3
6
|
printOutput
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CLJF7MQA.js";
|
|
5
8
|
import {
|
|
6
9
|
getActiveHost,
|
|
10
|
+
logger,
|
|
7
11
|
safeJsonParse
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import {
|
|
10
|
-
logger
|
|
11
|
-
} from "./chunk-MNHE6SSI.js";
|
|
12
|
+
} from "./chunk-SRJIAOBN.js";
|
|
12
13
|
|
|
13
14
|
// src/index.ts
|
|
14
15
|
import { Command as CommanderCommand } from "commander";
|
|
@@ -54,7 +55,9 @@ async function runCommand(cmd, opts, globalOpts) {
|
|
|
54
55
|
} catch (err) {
|
|
55
56
|
const message = err.message || String(err);
|
|
56
57
|
logger.error(`Command failed: ${message}`);
|
|
57
|
-
if (
|
|
58
|
+
if (err instanceof TeAgentCredentialsError) {
|
|
59
|
+
printError("config", message, err.hint);
|
|
60
|
+
} else if (message.includes("token") || message.includes("auth") || message.includes("401") || message.includes("403")) {
|
|
58
61
|
printError("auth", message, "Run: ae-cli auth login");
|
|
59
62
|
} else if (message.includes("AE API error")) {
|
|
60
63
|
printError("api", message);
|
|
@@ -68,7 +71,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
68
71
|
let _clientModule = null;
|
|
69
72
|
async function getClient() {
|
|
70
73
|
if (!_clientModule) {
|
|
71
|
-
_clientModule = await import("./client-
|
|
74
|
+
_clientModule = await import("./client-FCMK3XEK.js");
|
|
72
75
|
}
|
|
73
76
|
return _clientModule;
|
|
74
77
|
}
|
|
@@ -111,7 +114,7 @@ function createRuntimeContext(cmd, opts, globalOpts) {
|
|
|
111
114
|
return client.queryReportData(projectId, reportId, qp, eventModel, options, ctx.host());
|
|
112
115
|
},
|
|
113
116
|
async token() {
|
|
114
|
-
const { getToken } = await import("./auth-
|
|
117
|
+
const { getToken } = await import("./auth-H2376DEF.js");
|
|
115
118
|
return getToken(ctx.host());
|
|
116
119
|
},
|
|
117
120
|
host() {
|
|
@@ -168,8 +171,10 @@ function registerCommands(program2, commands) {
|
|
|
168
171
|
sub.option(flagStr, flag.desc);
|
|
169
172
|
}
|
|
170
173
|
}
|
|
174
|
+
sub.option("--host <url>", "Override active AE host URL for this command");
|
|
171
175
|
sub.action(async (opts) => {
|
|
172
176
|
const globalOpts = extractGlobalOptions(program2);
|
|
177
|
+
if (opts.host) globalOpts.host = opts.host;
|
|
173
178
|
await runCommand(cmd, opts, globalOpts);
|
|
174
179
|
});
|
|
175
180
|
}
|
|
@@ -358,52 +363,52 @@ program.name("ae-cli").version(version).description("CLI tool for ThinkingAI (AE
|
|
|
358
363
|
async function loadCommands() {
|
|
359
364
|
const commands = [];
|
|
360
365
|
try {
|
|
361
|
-
const teAnalysis = await import("./te-analysis-
|
|
366
|
+
const teAnalysis = await import("./te-analysis-A2OSGHQ4.js");
|
|
362
367
|
commands.push(...teAnalysis.default);
|
|
363
368
|
} catch {
|
|
364
369
|
}
|
|
365
370
|
try {
|
|
366
|
-
const teAudience = await import("./te-audience-
|
|
371
|
+
const teAudience = await import("./te-audience-LI67PPGO.js");
|
|
367
372
|
commands.push(...teAudience.default);
|
|
368
373
|
} catch {
|
|
369
374
|
}
|
|
370
375
|
try {
|
|
371
|
-
const teMeta = await import("./te-meta-
|
|
376
|
+
const teMeta = await import("./te-meta-HBTIEDRO.js");
|
|
372
377
|
commands.push(...teMeta.default);
|
|
373
378
|
} catch {
|
|
374
379
|
}
|
|
375
380
|
try {
|
|
376
|
-
const teCommon = await import("./te-common-
|
|
381
|
+
const teCommon = await import("./te-common-35WVU3C5.js");
|
|
377
382
|
commands.push(...teCommon.default);
|
|
378
383
|
} catch {
|
|
379
384
|
}
|
|
380
385
|
try {
|
|
381
|
-
const engage = await import("./te-engage-
|
|
386
|
+
const engage = await import("./te-engage-H7C72Z46.js");
|
|
382
387
|
commands.push(...engage.default);
|
|
383
388
|
} catch {
|
|
384
389
|
}
|
|
385
390
|
try {
|
|
386
|
-
const community = await import("./te-community-
|
|
391
|
+
const community = await import("./te-community-LEAP6PWT.js");
|
|
387
392
|
commands.push(...community.default);
|
|
388
393
|
} catch {
|
|
389
394
|
}
|
|
390
395
|
try {
|
|
391
|
-
const dataops = await import("./te-dataops-
|
|
396
|
+
const dataops = await import("./te-dataops-N2LGZBOX.js");
|
|
392
397
|
commands.push(...dataops.default);
|
|
393
398
|
} catch {
|
|
394
399
|
}
|
|
395
400
|
try {
|
|
396
|
-
const teKb = await import("./te-kb-
|
|
401
|
+
const teKb = await import("./te-kb-I2OKTBAI.js");
|
|
397
402
|
commands.push(...teKb.default);
|
|
398
403
|
} catch {
|
|
399
404
|
}
|
|
400
405
|
try {
|
|
401
|
-
const teTeam = await import("./te-team-
|
|
406
|
+
const teTeam = await import("./te-team-EM5OWRQL.js");
|
|
402
407
|
commands.push(...teTeam.default);
|
|
403
408
|
} catch {
|
|
404
409
|
}
|
|
405
410
|
try {
|
|
406
|
-
const teAgent = await import("./te-agent-
|
|
411
|
+
const teAgent = await import("./te-agent-7U7JLJKU.js");
|
|
407
412
|
commands.push(...teAgent.default);
|
|
408
413
|
} catch {
|
|
409
414
|
}
|
|
@@ -411,35 +416,35 @@ async function loadCommands() {
|
|
|
411
416
|
}
|
|
412
417
|
async function registerAuthCommands() {
|
|
413
418
|
try {
|
|
414
|
-
const { registerAuth } = await import("./auth-
|
|
419
|
+
const { registerAuth } = await import("./auth-5NSDQFQB.js");
|
|
415
420
|
registerAuth(program);
|
|
416
421
|
} catch {
|
|
417
422
|
}
|
|
418
423
|
}
|
|
419
424
|
async function registerConfigCommands() {
|
|
420
425
|
try {
|
|
421
|
-
const { registerConfig } = await import("./config-
|
|
426
|
+
const { registerConfig } = await import("./config-64G36TJL.js");
|
|
422
427
|
registerConfig(program);
|
|
423
428
|
} catch {
|
|
424
429
|
}
|
|
425
430
|
}
|
|
426
431
|
async function registerApiCommand() {
|
|
427
432
|
try {
|
|
428
|
-
const { registerApi } = await import("./raw-
|
|
433
|
+
const { registerApi } = await import("./raw-VEF3D6UD.js");
|
|
429
434
|
registerApi(program);
|
|
430
435
|
} catch {
|
|
431
436
|
}
|
|
432
437
|
}
|
|
433
438
|
async function registerSyncCommand() {
|
|
434
439
|
try {
|
|
435
|
-
const { registerSync } = await import("./sync-
|
|
440
|
+
const { registerSync } = await import("./sync-NRODEVNH.js");
|
|
436
441
|
registerSync(program);
|
|
437
442
|
} catch {
|
|
438
443
|
}
|
|
439
444
|
}
|
|
440
445
|
async function registerModelCommand() {
|
|
441
446
|
try {
|
|
442
|
-
const { registerModel } = await import("./model-
|
|
447
|
+
const { registerModel } = await import("./model-EZ6K7FXI.js");
|
|
443
448
|
registerModel(program);
|
|
444
449
|
} catch {
|
|
445
450
|
}
|
|
@@ -2,14 +2,17 @@ import {
|
|
|
2
2
|
MultiselectCancelled,
|
|
3
3
|
getCurrentWorkspace,
|
|
4
4
|
promptSingleCheckboxSelect
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IMBKVXKY.js";
|
|
6
6
|
import {
|
|
7
7
|
TeAgentApiError,
|
|
8
|
-
TeAgentCredentialsError,
|
|
9
|
-
getClaudeConfigDir,
|
|
10
8
|
getSandboxModels,
|
|
11
9
|
postSandboxModelSelection
|
|
12
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AD5V3ZPJ.js";
|
|
11
|
+
import {
|
|
12
|
+
TeAgentCredentialsError,
|
|
13
|
+
getClaudeConfigDir
|
|
14
|
+
} from "./chunk-KAEZTSXN.js";
|
|
15
|
+
import "./chunk-SRJIAOBN.js";
|
|
13
16
|
|
|
14
17
|
// src/commands/model/index.ts
|
|
15
18
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -50,7 +53,7 @@ async function runModelPicker() {
|
|
|
50
53
|
const current = readCurrentModelSelection();
|
|
51
54
|
const models = await getSandboxModels();
|
|
52
55
|
if (models.length === 0) {
|
|
53
|
-
process.stderr.write("\
|
|
56
|
+
process.stderr.write("No models visible to the current user\n");
|
|
54
57
|
return;
|
|
55
58
|
}
|
|
56
59
|
const sorted = models.slice().sort((a, b) => {
|
|
@@ -63,32 +66,32 @@ async function runModelPicker() {
|
|
|
63
66
|
return scopeDiff !== 0 ? scopeDiff : a.name.localeCompare(b.name);
|
|
64
67
|
});
|
|
65
68
|
const picked = await promptSingleCheckboxSelect({
|
|
66
|
-
title: "
|
|
69
|
+
title: "Select a model to use",
|
|
67
70
|
items: sorted.map((model) => {
|
|
68
71
|
const isCurrent = isCurrentModel(model, current);
|
|
69
72
|
return {
|
|
70
73
|
value: model,
|
|
71
74
|
label: `${model.name} ${model.scope}`,
|
|
72
|
-
hint: isCurrent ? "(
|
|
75
|
+
hint: isCurrent ? "(current)" : void 0,
|
|
73
76
|
preselected: isCurrent
|
|
74
77
|
};
|
|
75
78
|
})
|
|
76
79
|
});
|
|
77
80
|
const workspace = getCurrentWorkspace();
|
|
78
81
|
if (!workspace) {
|
|
79
|
-
process.stderr.write("
|
|
82
|
+
process.stderr.write("Please run ae-cli model from within a te-agent workspace directory\n");
|
|
80
83
|
process.exitCode = 1;
|
|
81
84
|
return;
|
|
82
85
|
}
|
|
83
86
|
if (isCurrentModel(picked, current)) {
|
|
84
|
-
process.stdout.write("\
|
|
87
|
+
process.stdout.write("This model is already active\n");
|
|
85
88
|
return;
|
|
86
89
|
}
|
|
87
90
|
await postSandboxModelSelection({
|
|
88
91
|
workspacePath: workspace.name,
|
|
89
92
|
modelId: picked.id
|
|
90
93
|
});
|
|
91
|
-
process.stdout.write(
|
|
94
|
+
process.stdout.write(`Switched to ${picked.name}
|
|
92
95
|
`);
|
|
93
96
|
}
|
|
94
97
|
function registerModel(program) {
|
|
@@ -102,7 +105,7 @@ function registerModel(program) {
|
|
|
102
105
|
}
|
|
103
106
|
function handleError(err) {
|
|
104
107
|
if (err instanceof MultiselectCancelled) {
|
|
105
|
-
process.stderr.write("\
|
|
108
|
+
process.stderr.write("Cancelled\n");
|
|
106
109
|
return;
|
|
107
110
|
}
|
|
108
111
|
if (err instanceof TeAgentCredentialsError) {
|
|
@@ -114,7 +117,7 @@ function handleError(err) {
|
|
|
114
117
|
return;
|
|
115
118
|
}
|
|
116
119
|
if (err instanceof TeAgentApiError) {
|
|
117
|
-
process.stderr.write(`\u2717
|
|
120
|
+
process.stderr.write(`\u2717 Main app error (${err.status}${err.code ? " " + err.code : ""}): ${err.message}
|
|
118
121
|
`);
|
|
119
122
|
process.exitCode = 1;
|
|
120
123
|
return;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
printError,
|
|
3
3
|
printOutput
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CLJF7MQA.js";
|
|
5
5
|
import {
|
|
6
6
|
httpGet,
|
|
7
7
|
httpPost
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-LU7SXK4Q.js";
|
|
9
9
|
import {
|
|
10
|
+
SecureStoreAuthError,
|
|
10
11
|
resolveHost
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CAQYQA4R.js";
|
|
12
13
|
import {
|
|
13
14
|
safeJsonParse
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-MNHE6SSI.js";
|
|
15
|
+
} from "./chunk-SRJIAOBN.js";
|
|
16
16
|
|
|
17
17
|
// src/api/raw.ts
|
|
18
18
|
function registerApi(program) {
|
|
@@ -22,7 +22,7 @@ function registerApi(program) {
|
|
|
22
22
|
const format = globalOpts.format || "json";
|
|
23
23
|
const jq = globalOpts.jq;
|
|
24
24
|
if (!host) {
|
|
25
|
-
printError("config", "No AE host configured.", "Run: ae-cli config set-host");
|
|
25
|
+
printError("config", "No AE host configured.", "Run: ae-cli config set-host <url>");
|
|
26
26
|
process.exit(1);
|
|
27
27
|
}
|
|
28
28
|
try {
|
|
@@ -52,7 +52,11 @@ function registerApi(program) {
|
|
|
52
52
|
}
|
|
53
53
|
printOutput(result, format, jq);
|
|
54
54
|
} catch (err) {
|
|
55
|
-
|
|
55
|
+
if (err instanceof SecureStoreAuthError) {
|
|
56
|
+
printError("auth", err.message, "Run: ae-cli auth login");
|
|
57
|
+
} else {
|
|
58
|
+
printError("api", err.message);
|
|
59
|
+
}
|
|
56
60
|
process.exit(1);
|
|
57
61
|
}
|
|
58
62
|
});
|
|
@@ -9,18 +9,20 @@ import {
|
|
|
9
9
|
scanMcps,
|
|
10
10
|
scanSkills,
|
|
11
11
|
writeSkillManifestEntries
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-IMBKVXKY.js";
|
|
13
13
|
import {
|
|
14
14
|
TeAgentApiError,
|
|
15
|
-
TeAgentCredentialsError,
|
|
16
15
|
getSandboxSyncPullCandidates,
|
|
17
16
|
postSandboxSyncPull,
|
|
18
17
|
postToMainApp
|
|
19
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-AD5V3ZPJ.js";
|
|
19
|
+
import {
|
|
20
|
+
TeAgentCredentialsError
|
|
21
|
+
} from "./chunk-KAEZTSXN.js";
|
|
20
22
|
import {
|
|
21
23
|
printError
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-CLJF7MQA.js";
|
|
25
|
+
import "./chunk-SRJIAOBN.js";
|
|
24
26
|
|
|
25
27
|
// src/commands/sync/index.ts
|
|
26
28
|
import Table from "cli-table3";
|
|
@@ -38,11 +40,11 @@ import path from "path";
|
|
|
38
40
|
var SKILL_SLUG_RE = /^[a-z0-9-]+$/;
|
|
39
41
|
function updateSkillManifestForSource(sourceDir, slug) {
|
|
40
42
|
if (!SKILL_SLUG_RE.test(slug)) {
|
|
41
|
-
throw new Error(
|
|
43
|
+
throw new Error(`Invalid Skill slug: ${slug}`);
|
|
42
44
|
}
|
|
43
45
|
const sourceAbs = path.resolve(sourceDir);
|
|
44
46
|
if (!statSync(sourceAbs).isDirectory()) {
|
|
45
|
-
throw new Error(`Skill
|
|
47
|
+
throw new Error(`Skill source path is not a directory: ${sourceDir}`);
|
|
46
48
|
}
|
|
47
49
|
const manifestPath = path.join(path.dirname(sourceAbs), SKILL_MANIFEST_FILE);
|
|
48
50
|
const manifest = readSkillManifestEntries(manifestPath);
|
|
@@ -62,14 +64,14 @@ function updateSkillManifestForSource(sourceDir, slug) {
|
|
|
62
64
|
}
|
|
63
65
|
function copySkillPackageToTarget(args) {
|
|
64
66
|
if (!SKILL_SLUG_RE.test(args.slug)) {
|
|
65
|
-
throw new Error(
|
|
67
|
+
throw new Error(`Invalid Skill slug: ${args.slug}`);
|
|
66
68
|
}
|
|
67
69
|
if (!path.isAbsolute(args.targetRoot)) {
|
|
68
|
-
throw new Error(`skillTargetRoot
|
|
70
|
+
throw new Error(`skillTargetRoot must be an absolute path: ${args.targetRoot}`);
|
|
69
71
|
}
|
|
70
72
|
const sourceReal = realpathSync(args.sourceDir);
|
|
71
73
|
if (!statSync(sourceReal).isDirectory()) {
|
|
72
|
-
throw new Error(`Skill
|
|
74
|
+
throw new Error(`Skill source path is not a directory: ${args.sourceDir}`);
|
|
73
75
|
}
|
|
74
76
|
const targetDir = path.join(args.targetRoot, args.slug);
|
|
75
77
|
const targetAbs = path.resolve(targetDir);
|
|
@@ -134,7 +136,7 @@ function mcpToItem(m, includeSecrets) {
|
|
|
134
136
|
async function selectSkills() {
|
|
135
137
|
const all = scanSkills();
|
|
136
138
|
if (all.length === 0) {
|
|
137
|
-
process.stderr.write("
|
|
139
|
+
process.stderr.write("No Skills found (scanned current workspace .claude/skills)\n");
|
|
138
140
|
return [];
|
|
139
141
|
}
|
|
140
142
|
all.sort((a, b) => {
|
|
@@ -147,13 +149,13 @@ async function selectSkills() {
|
|
|
147
149
|
group: describeSource(s),
|
|
148
150
|
hint: s.isSymlink ? "(symlink)" : void 0
|
|
149
151
|
}));
|
|
150
|
-
const picked = await promptMultiselect({ title: "
|
|
152
|
+
const picked = await promptMultiselect({ title: "Select Skills to push to the main app", items });
|
|
151
153
|
return picked.map(skillToItem);
|
|
152
154
|
}
|
|
153
155
|
async function selectMcps(includeSecrets) {
|
|
154
156
|
const all = scanMcps();
|
|
155
157
|
if (all.length === 0) {
|
|
156
|
-
process.stderr.write("
|
|
158
|
+
process.stderr.write("No MCPs found (scanned current workspace .mcp.json / .claude/.claude.json and global ~/.claude.json)\n");
|
|
157
159
|
return [];
|
|
158
160
|
}
|
|
159
161
|
all.sort((a, b) => {
|
|
@@ -164,9 +166,9 @@ async function selectMcps(includeSecrets) {
|
|
|
164
166
|
value: m,
|
|
165
167
|
label: m.slug,
|
|
166
168
|
group: describeSource(m),
|
|
167
|
-
hint: m.hasSecrets && !includeSecrets ? "(env
|
|
169
|
+
hint: m.hasSecrets && !includeSecrets ? "(env redacted)" : void 0
|
|
168
170
|
}));
|
|
169
|
-
const picked = await promptMultiselect({ title: "
|
|
171
|
+
const picked = await promptMultiselect({ title: "Select MCPs to push to the main app", items });
|
|
170
172
|
return picked.map((m) => mcpToItem(m, includeSecrets));
|
|
171
173
|
}
|
|
172
174
|
function renderResults(results) {
|
|
@@ -178,7 +180,7 @@ function renderResults(results) {
|
|
|
178
180
|
const failed = results.filter((r) => r.status === "failed").length;
|
|
179
181
|
if (failed > 0) {
|
|
180
182
|
process.stderr.write(`
|
|
181
|
-
\u2717
|
|
183
|
+
\u2717 ${failed} item(s) failed
|
|
182
184
|
`);
|
|
183
185
|
}
|
|
184
186
|
}
|
|
@@ -193,7 +195,7 @@ async function selectPullResources(args) {
|
|
|
193
195
|
return scopeDiff !== 0 ? scopeDiff : a.name.localeCompare(b.name);
|
|
194
196
|
});
|
|
195
197
|
if (all.length === 0) {
|
|
196
|
-
process.stderr.write(`${args.title}
|
|
198
|
+
process.stderr.write(`${args.title}: no candidates available to sync
|
|
197
199
|
`);
|
|
198
200
|
return [];
|
|
199
201
|
}
|
|
@@ -245,7 +247,7 @@ function copySyncedSkillPackages(skillItems, resp) {
|
|
|
245
247
|
if (!item) continue;
|
|
246
248
|
if (!resp.skillTargetRoot) {
|
|
247
249
|
result.status = "failed";
|
|
248
|
-
result.message = "
|
|
250
|
+
result.message = "Main app response is missing skillTargetRoot; cannot copy Skill package";
|
|
249
251
|
continue;
|
|
250
252
|
}
|
|
251
253
|
try {
|
|
@@ -256,34 +258,34 @@ function copySyncedSkillPackages(skillItems, resp) {
|
|
|
256
258
|
});
|
|
257
259
|
updateSkillManifestForSource(item.dirPath, item.slug);
|
|
258
260
|
if (copied.skipped) {
|
|
259
|
-
result.message = "
|
|
261
|
+
result.message = "Source directory is already the target directory; local copy skipped";
|
|
260
262
|
}
|
|
261
263
|
} catch (err) {
|
|
262
264
|
result.status = "failed";
|
|
263
|
-
result.message =
|
|
265
|
+
result.message = `Local copy failed: ${err?.message ?? String(err)}`;
|
|
264
266
|
}
|
|
265
267
|
}
|
|
266
268
|
}
|
|
267
269
|
async function selectDirection(optsDirection) {
|
|
268
270
|
if (optsDirection === "push" || optsDirection === "pull") return optsDirection;
|
|
269
271
|
if (optsDirection) {
|
|
270
|
-
throw new Error("--direction
|
|
272
|
+
throw new Error("--direction must be push or pull");
|
|
271
273
|
}
|
|
272
274
|
return promptSingleSelect({
|
|
273
|
-
title: "
|
|
275
|
+
title: "Sync direction?",
|
|
274
276
|
items: [
|
|
275
|
-
{ value: "push", label: "
|
|
276
|
-
{ value: "pull", label: "
|
|
277
|
+
{ value: "push", label: "Workspace -> Main app" },
|
|
278
|
+
{ value: "pull", label: "Main app -> Workspace" }
|
|
277
279
|
]
|
|
278
280
|
});
|
|
279
281
|
}
|
|
280
282
|
async function selectKind(optsKind) {
|
|
281
283
|
if (optsKind === "skill" || optsKind === "mcp" || optsKind === "both") return optsKind;
|
|
282
284
|
if (optsKind) {
|
|
283
|
-
throw new Error("--kind
|
|
285
|
+
throw new Error("--kind must be skill, mcp, or both");
|
|
284
286
|
}
|
|
285
287
|
return promptSingleSelect({
|
|
286
|
-
title: "
|
|
288
|
+
title: "Which resource type to sync?",
|
|
287
289
|
items: [
|
|
288
290
|
{ value: "skill", label: "Skills" },
|
|
289
291
|
{ value: "mcp", label: "MCPs" },
|
|
@@ -295,10 +297,10 @@ async function runPush(kind, includeSecrets) {
|
|
|
295
297
|
const skillItems = kind !== "mcp" ? await selectSkills() : [];
|
|
296
298
|
const mcpItems = kind !== "skill" ? await selectMcps(includeSecrets) : [];
|
|
297
299
|
if (skillItems.length === 0 && mcpItems.length === 0) {
|
|
298
|
-
process.stderr.write("\
|
|
300
|
+
process.stderr.write("Nothing selected, exiting\n");
|
|
299
301
|
return;
|
|
300
302
|
}
|
|
301
|
-
process.stderr.write(
|
|
303
|
+
process.stderr.write(`Pushing ${skillItems.length} Skill(s) / ${mcpItems.length} MCP(s) ...
|
|
302
304
|
`);
|
|
303
305
|
const allResults = [];
|
|
304
306
|
if (skillItems.length > 0) {
|
|
@@ -323,25 +325,25 @@ function pullResultRows(resp) {
|
|
|
323
325
|
async function runPull(kind) {
|
|
324
326
|
const workspace = getCurrentWorkspace();
|
|
325
327
|
if (!workspace) {
|
|
326
|
-
throw new Error("
|
|
328
|
+
throw new Error("Current workspace not recognized; please run from within /home/ta/workspaces/<workspace>");
|
|
327
329
|
}
|
|
328
330
|
const candidates = await getSandboxSyncPullCandidates({
|
|
329
331
|
workspacePath: workspace.name,
|
|
330
332
|
kind
|
|
331
333
|
});
|
|
332
334
|
const skillItems = kind !== "mcp" ? await selectPullResources({
|
|
333
|
-
title: "
|
|
335
|
+
title: "Select Skills to sync to workspace",
|
|
334
336
|
candidates: candidates.skills ?? []
|
|
335
337
|
}) : [];
|
|
336
338
|
const mcpItems = kind !== "skill" ? await selectPullResources({
|
|
337
|
-
title: "
|
|
339
|
+
title: "Select MCPs to sync to workspace",
|
|
338
340
|
candidates: candidates.mcp ?? []
|
|
339
341
|
}) : [];
|
|
340
342
|
if (skillItems.length === 0 && mcpItems.length === 0) {
|
|
341
|
-
process.stderr.write("\
|
|
343
|
+
process.stderr.write("Nothing selected, exiting\n");
|
|
342
344
|
return;
|
|
343
345
|
}
|
|
344
|
-
process.stderr.write(
|
|
346
|
+
process.stderr.write(`Syncing to workspace: ${skillItems.length} Skill(s) / ${mcpItems.length} MCP(s) ...
|
|
345
347
|
`);
|
|
346
348
|
const resp = await postSandboxSyncPull({
|
|
347
349
|
workspacePath: workspace.name,
|
|
@@ -361,7 +363,7 @@ function registerSync(program) {
|
|
|
361
363
|
else await runPull(kind);
|
|
362
364
|
} catch (err) {
|
|
363
365
|
if (err instanceof MultiselectCancelled) {
|
|
364
|
-
process.stderr.write("\
|
|
366
|
+
process.stderr.write("Cancelled\n");
|
|
365
367
|
return;
|
|
366
368
|
}
|
|
367
369
|
if (err instanceof TeAgentCredentialsError) {
|
|
@@ -4,7 +4,9 @@ import {
|
|
|
4
4
|
patchToMainApp,
|
|
5
5
|
postToMainApp,
|
|
6
6
|
uploadToMainApp
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AD5V3ZPJ.js";
|
|
8
|
+
import "./chunk-KAEZTSXN.js";
|
|
9
|
+
import "./chunk-SRJIAOBN.js";
|
|
8
10
|
|
|
9
11
|
// src/commands/te-agent/models.ts
|
|
10
12
|
var BASE_PATH = "/api/sandbox/agent/models";
|
|
@@ -19,7 +21,7 @@ var listModels = {
|
|
|
19
21
|
validate: (ctx) => {
|
|
20
22
|
const scope = ctx.str("scope");
|
|
21
23
|
if (scope && !["personal", "company", "system"].includes(scope)) {
|
|
22
|
-
throw new Error("--scope
|
|
24
|
+
throw new Error("--scope must be personal, company, or system");
|
|
23
25
|
}
|
|
24
26
|
},
|
|
25
27
|
dryRun: (ctx) => {
|
|
@@ -52,7 +54,7 @@ var addModel = {
|
|
|
52
54
|
try {
|
|
53
55
|
new URL(baseUrl);
|
|
54
56
|
} catch {
|
|
55
|
-
throw new Error("--base-url
|
|
57
|
+
throw new Error("--base-url must be a valid URL");
|
|
56
58
|
}
|
|
57
59
|
},
|
|
58
60
|
dryRun: (ctx) => ({
|
|
@@ -131,7 +133,7 @@ var listMcps = {
|
|
|
131
133
|
validate: (ctx) => {
|
|
132
134
|
const scope = ctx.str("scope");
|
|
133
135
|
if (scope && !["personal", "company", "system"].includes(scope)) {
|
|
134
|
-
throw new Error("--scope
|
|
136
|
+
throw new Error("--scope must be personal, company, or system");
|
|
135
137
|
}
|
|
136
138
|
},
|
|
137
139
|
dryRun: (ctx) => {
|
|
@@ -161,22 +163,22 @@ var addMcp = {
|
|
|
161
163
|
validate: (ctx) => {
|
|
162
164
|
const name = ctx.str("name");
|
|
163
165
|
if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name)) {
|
|
164
|
-
throw new Error("--name
|
|
166
|
+
throw new Error("--name must start with a letter and contain only letters, digits, _, or -");
|
|
165
167
|
}
|
|
166
168
|
if (name.length < 2 || name.length > 64) {
|
|
167
|
-
throw new Error("--name
|
|
169
|
+
throw new Error("--name length must be between 2 and 64");
|
|
168
170
|
}
|
|
169
171
|
try {
|
|
170
172
|
new URL(ctx.str("url"));
|
|
171
173
|
} catch {
|
|
172
|
-
throw new Error("--url
|
|
174
|
+
throw new Error("--url must be a valid URL");
|
|
173
175
|
}
|
|
174
176
|
if (!/^https?:\/\//i.test(ctx.str("url"))) {
|
|
175
|
-
throw new Error("--url
|
|
177
|
+
throw new Error("--url only supports http:// or https:// protocols");
|
|
176
178
|
}
|
|
177
179
|
const transport = ctx.str("transport");
|
|
178
180
|
if (transport && !["sse", "http"].includes(transport)) {
|
|
179
|
-
throw new Error("--transport
|
|
181
|
+
throw new Error("--transport must be sse or http");
|
|
180
182
|
}
|
|
181
183
|
},
|
|
182
184
|
dryRun: (ctx) => ({
|
|
@@ -249,7 +251,7 @@ async function resolveInstructions(raw) {
|
|
|
249
251
|
chunks.push(chunk);
|
|
250
252
|
}
|
|
251
253
|
const text = Buffer.concat(chunks).toString("utf8").trim();
|
|
252
|
-
if (!text) throw new Error("stdin
|
|
254
|
+
if (!text) throw new Error("stdin is empty; cannot read instructions");
|
|
253
255
|
return text;
|
|
254
256
|
}
|
|
255
257
|
return raw;
|
|
@@ -265,7 +267,7 @@ var listSkills = {
|
|
|
265
267
|
validate: (ctx) => {
|
|
266
268
|
const scope = ctx.str("scope");
|
|
267
269
|
if (scope && !["personal", "company", "system"].includes(scope)) {
|
|
268
|
-
throw new Error("--scope
|
|
270
|
+
throw new Error("--scope must be personal, company, or system");
|
|
269
271
|
}
|
|
270
272
|
},
|
|
271
273
|
dryRun: (ctx) => {
|
|
@@ -293,7 +295,7 @@ var addSkill = {
|
|
|
293
295
|
validate: (ctx) => {
|
|
294
296
|
const name = ctx.str("name");
|
|
295
297
|
if (name.length < 1 || name.length > 80) {
|
|
296
|
-
throw new Error("--name
|
|
298
|
+
throw new Error("--name length must be between 1 and 80");
|
|
297
299
|
}
|
|
298
300
|
},
|
|
299
301
|
dryRun: (ctx) => ({
|
|
@@ -388,21 +390,21 @@ function resolveFilePaths(ctx) {
|
|
|
388
390
|
const file = ctx.str("file");
|
|
389
391
|
const files = ctx.str("files");
|
|
390
392
|
if (file && files) {
|
|
391
|
-
throw new Error("--file
|
|
393
|
+
throw new Error("--file and --files cannot be used together");
|
|
392
394
|
}
|
|
393
395
|
if (!file && !files) {
|
|
394
|
-
throw new Error("
|
|
396
|
+
throw new Error("Either --file or --files must be specified");
|
|
395
397
|
}
|
|
396
398
|
if (file) return [file];
|
|
397
399
|
try {
|
|
398
400
|
const parsed = JSON.parse(files);
|
|
399
|
-
if (!Array.isArray(parsed)) throw new Error("--files
|
|
401
|
+
if (!Array.isArray(parsed)) throw new Error("--files must be a JSON array");
|
|
400
402
|
return parsed.map((p) => {
|
|
401
|
-
if (typeof p !== "string") throw new Error("--files
|
|
403
|
+
if (typeof p !== "string") throw new Error("--files array elements must be strings");
|
|
402
404
|
return p;
|
|
403
405
|
});
|
|
404
406
|
} catch (err) {
|
|
405
|
-
if (err instanceof SyntaxError) throw new Error("--files
|
|
407
|
+
if (err instanceof SyntaxError) throw new Error("--files must be a valid JSON array");
|
|
406
408
|
throw err;
|
|
407
409
|
}
|
|
408
410
|
}
|
|
@@ -411,7 +413,7 @@ async function uploadFiles(filePaths) {
|
|
|
411
413
|
for (const filePath of filePaths) {
|
|
412
414
|
const resolved = resolve(filePath);
|
|
413
415
|
if (!existsSync(resolved)) {
|
|
414
|
-
throw new Error(
|
|
416
|
+
throw new Error(`File not found: ${resolved}`);
|
|
415
417
|
}
|
|
416
418
|
const buffer = readFileSync(resolved);
|
|
417
419
|
const mimeType = guessMimeType(resolved);
|
|
@@ -434,7 +436,7 @@ var listAttachments = {
|
|
|
434
436
|
validate: (ctx) => {
|
|
435
437
|
const type = ctx.str("type");
|
|
436
438
|
if (type && !["image", "document"].includes(type)) {
|
|
437
|
-
throw new Error("--type
|
|
439
|
+
throw new Error("--type must be image or document");
|
|
438
440
|
}
|
|
439
441
|
},
|
|
440
442
|
dryRun: (ctx) => {
|
|
@@ -496,22 +498,22 @@ var delAttachment = {
|
|
|
496
498
|
|
|
497
499
|
// src/commands/te-agent/index.ts
|
|
498
500
|
var commands = [
|
|
499
|
-
//
|
|
501
|
+
// Model management
|
|
500
502
|
listModels,
|
|
501
503
|
addModel,
|
|
502
504
|
delModel,
|
|
503
505
|
toggleModel,
|
|
504
|
-
// MCP
|
|
506
|
+
// MCP server management
|
|
505
507
|
listMcps,
|
|
506
508
|
addMcp,
|
|
507
509
|
delMcp,
|
|
508
510
|
toggleMcp,
|
|
509
|
-
// Skill
|
|
511
|
+
// Skill management
|
|
510
512
|
listSkills,
|
|
511
513
|
addSkill,
|
|
512
514
|
delSkill,
|
|
513
515
|
toggleSkill,
|
|
514
|
-
//
|
|
516
|
+
// Attachment library management
|
|
515
517
|
listAttachments,
|
|
516
518
|
addAttachment,
|
|
517
519
|
delAttachment
|