@thinkingai/ae-cli 6.1.18 → 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.
Files changed (96) hide show
  1. package/README.md +2 -0
  2. package/README.zh.md +6 -0
  3. package/dist/{auth-ROB2EDYV.js → auth-QPEVVBKT.js} +13 -7
  4. package/dist/auth-UMJAA72O.js +15 -0
  5. package/dist/{capability-DKMYUTLC.js → capability-ASI62I4A.js} +11 -10
  6. package/dist/{chunk-UW5UN47B.js → chunk-533JK3YX.js} +2 -0
  7. package/dist/{chunk-4XXOWOTA.js → chunk-6QK7SYYY.js} +5 -4
  8. package/dist/{chunk-TUKQZTMI.js → chunk-7K24F7T2.js} +2 -0
  9. package/dist/{chunk-OO6XR6LK.js → chunk-AMBFK2K3.js} +2 -0
  10. package/dist/{sync-HKIOZXQE.js → chunk-B5HMQAOM.js} +31 -540
  11. package/dist/{chunk-Y3LOALAV.js → chunk-DKEXH6Q5.js} +4 -3
  12. package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
  13. package/dist/{chunk-JHENBQ5B.js → chunk-FR2EDAQM.js} +1 -0
  14. package/dist/{chunk-ZQ47LWTI.js → chunk-GJXRF7Y6.js} +6 -5
  15. package/dist/{chunk-DWO43OIB.js → chunk-JQ3ENZZH.js} +2 -0
  16. package/dist/chunk-JYMGHGCE.js +191 -0
  17. package/dist/{chunk-BYYS3ANB.js → chunk-KEWVSO64.js} +5 -4
  18. package/dist/{chunk-3FY3RJ26.js → chunk-KZ6ZHF5J.js} +2 -1
  19. package/dist/{chunk-ZQKDZXDO.js → chunk-O6K2ODUE.js} +3 -2
  20. package/dist/chunk-QL6R6TSK.js +25215 -0
  21. package/dist/{chunk-J2DEBMRF.js → chunk-RWXIXOZG.js} +22 -9
  22. package/dist/{chunk-QZ3AS4KK.js → chunk-S5PONFBM.js} +5 -4
  23. package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
  24. package/dist/{chunk-3KWQYGYI.js → chunk-TKHSULJT.js} +2 -0
  25. package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
  26. package/dist/{client-L2YDMHQ6.js → client-N7NGZUNI.js} +4 -3
  27. package/dist/{community-report-client-C7WDGET3.js → community-report-client-6OL6GBQW.js} +3 -2
  28. package/dist/{config-BMYZX2UE.js → config-XNMACCKX.js} +8 -7
  29. package/dist/{data-integration-QEKDWQDY.js → data-integration-4NZGZ45E.js} +913 -92
  30. package/dist/index.js +38 -36
  31. package/dist/{local-data-upload-client-4YYHSYD6.js → local-data-upload-client-EFHDLXFG.js} +3 -2
  32. package/dist/{memory-I2WXDTV2.js → memory-HBJQ2GC5.js} +8 -7
  33. package/dist/{metadata-I4C2EWUN.js → metadata-62EWBEIG.js} +12 -11
  34. package/dist/{model-HLHIEFMU.js → model-BHLJ2QMT.js} +10 -9
  35. package/dist/{personal-semantic-preference-LIPACBDX.js → personal-semantic-preference-JBVMAI7L.js} +11 -10
  36. package/dist/{project-semantic-RT3R2VQD.js → project-semantic-BQ4MPUS5.js} +12 -11
  37. package/dist/sync-MUWPRM5I.js +522 -0
  38. package/dist/{te-agent-BR6VDBNX.js → te-agent-WQZTMEK4.js} +10 -9
  39. package/dist/{te-analysis-7VUNUYWZ.js → te-analysis-MNCG65LU.js} +107 -20
  40. package/dist/{te-community-5DMNKJWY.js → te-community-BNE6KREL.js} +8 -7
  41. package/dist/{te-dataops-6P5IKWNJ.js → te-dataops-TXLKM2W6.js} +467 -67
  42. package/dist/{te-engage-KZPR5R22.js → te-engage-TPKLRVTL.js} +84 -10
  43. package/dist/{te-experiment-6BITX4RD.js → te-experiment-6BYKTCY7.js} +85 -12
  44. package/dist/{te-kb-RCLSSH2Q.js → te-kb-BUD6N3NI.js} +311 -24
  45. package/dist/{te-system-FXITO2JG.js → te-system-44LZJDTQ.js} +573 -37
  46. package/dist/{te-team-ADOC2ROP.js → te-team-XMP47YXE.js} +10 -7
  47. package/dist/{update-YCYCKJOO.js → update-UODFOZ4P.js} +7 -6
  48. package/package.json +18 -9
  49. package/skills/ae-analysis/references/analysis_gateway_assets.md +1 -1
  50. package/skills/ae-analysis/references/audience_models.md +18 -0
  51. package/skills/ae-analysis/references/command_index.md +2 -2
  52. package/skills/ae-analysis/references/project_timezone_update.md +13 -4
  53. package/skills/ae-analysis/references/property_create.md +2 -0
  54. package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
  55. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  56. package/skills/ae-analysis/references/user_cluster_update.md +8 -4
  57. package/skills/ae-analysis/references/user_tag_create.md +7 -1
  58. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  59. package/skills/ae-data-integration/SKILL.md +1 -0
  60. package/skills/ae-data-integration/references/error-handling.md +54 -1
  61. package/skills/ae-data-integration/references/source-inspect.md +18 -2
  62. package/skills/ae-data-integration/references/transform.md +3 -1
  63. package/skills/ae-data-integration/references/ue-routing.md +23 -0
  64. package/skills/ae-dataops/SKILL.md +11 -1
  65. package/skills/ae-dataops/references/dataops-backfill.md +135 -0
  66. package/skills/ae-engage/SKILL.md +5 -0
  67. package/skills/ae-engage/references/build-task-save-guide.md +5 -1
  68. package/skills/ae-engage/references/save-flow.md +37 -1
  69. package/skills/ae-engage/references/save-task.md +6 -0
  70. package/skills/ae-experiment/SKILL.md +6 -2
  71. package/skills/ae-experiment/references/save_metric.md +20 -8
  72. package/skills/ae-kb/SKILL.md +120 -9
  73. package/skills/ae-system/SKILL.md +28 -30
  74. package/skills/ae-system/references/channel-management.md +303 -0
  75. package/dist/auth-GBMV6TEJ.js +0 -14
  76. package/dist/capability-HYVVPG25.js +0 -352
  77. package/dist/chunk-EFH4XWYC.js +0 -556
  78. package/dist/chunk-JRJY5DMJ.js +0 -71
  79. package/dist/chunk-OMPRXM3V.js +0 -349
  80. package/dist/chunk-QNOLN2LJ.js +0 -509
  81. package/dist/chunk-RJDU7NYP.js +0 -1198
  82. package/dist/chunk-RNAALWJK.js +0 -98
  83. package/dist/chunk-SERWF6G5.js +0 -13
  84. package/dist/memory-3ORCR7JH.js +0 -893
  85. package/dist/metadata-VUOQJE26.js +0 -339
  86. package/dist/model-UGRDX4MW.js +0 -139
  87. package/dist/personal-semantic-preference-OEISBRHM.js +0 -239
  88. package/dist/project-semantic-FFPWFPIW.js +0 -1114
  89. package/dist/sync-TFHU2UTG.js +0 -10261
  90. package/dist/te-agent-VLYOV7S4.js +0 -3894
  91. package/dist/te-analysis-4YGQL5RC.js +0 -9357
  92. package/dist/te-community-ISDQWJU7.js +0 -1859
  93. package/dist/te-dataops-CVULXNVB.js +0 -2209
  94. package/dist/te-engage-N5WI32H6.js +0 -4898
  95. package/dist/te-experiment-UVR4HLND.js +0 -988
  96. package/dist/te-system-K2GYMCTB.js +0 -2213
@@ -0,0 +1,522 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ SKILL_MANIFEST_FILE,
4
+ assertValidMcpName,
5
+ assertValidSkillSlug,
6
+ describeSource,
7
+ getCurrentWorkspace,
8
+ readSkillManifestEntries,
9
+ scanMcps,
10
+ scanSkills,
11
+ splitPushableMcps,
12
+ writeSkillManifestEntries
13
+ } from "./chunk-JQ3ENZZH.js";
14
+ import {
15
+ MultiselectCancelled,
16
+ promptMultiselect,
17
+ promptSingleSelect
18
+ } from "./chunk-7K24F7T2.js";
19
+ import {
20
+ assertSkillDocumentSize
21
+ } from "./chunk-T6OSFQZD.js";
22
+ import {
23
+ require_lib
24
+ } from "./chunk-B5HMQAOM.js";
25
+ import {
26
+ TeAgentApiError,
27
+ TeAgentCredentialsError,
28
+ getSandboxSyncPullCandidates,
29
+ postSandboxSyncPull,
30
+ postToMainApp,
31
+ uploadToMainApp
32
+ } from "./chunk-6QK7SYYY.js";
33
+ import {
34
+ printError
35
+ } from "./chunk-KEWVSO64.js";
36
+ import "./chunk-Y74WTIKJ.js";
37
+ import "./chunk-RWXIXOZG.js";
38
+ import "./chunk-O6K2ODUE.js";
39
+ import "./chunk-KZ6ZHF5J.js";
40
+ import "./chunk-533JK3YX.js";
41
+ import {
42
+ __toESM
43
+ } from "./chunk-FR2EDAQM.js";
44
+
45
+ // src/commands/sync/index.ts
46
+ var import_jszip = __toESM(require_lib(), 1);
47
+ import Table from "cli-table3";
48
+ import { lstatSync, readFileSync as readFileSync2, readdirSync } from "fs";
49
+ import { join, relative } from "path";
50
+
51
+ // src/commands/sync/local-copy.ts
52
+ import { existsSync, readFileSync, statSync, writeFileSync } from "fs";
53
+ import path from "path";
54
+ var MCP_MANIFEST_FILE = ".mcp-manifest.json";
55
+ function isMcpScope(value) {
56
+ return value === "personal" || value === "company" || value === "system";
57
+ }
58
+ function uniqueMcpEntries(entries) {
59
+ const seen = /* @__PURE__ */ new Set();
60
+ const out = [];
61
+ for (const entry of entries) {
62
+ if (seen.has(entry.name)) continue;
63
+ seen.add(entry.name);
64
+ out.push(entry);
65
+ }
66
+ return out;
67
+ }
68
+ function readMcpManifestEntries(manifestPath) {
69
+ if (!existsSync(manifestPath)) return [];
70
+ let parsed;
71
+ try {
72
+ parsed = JSON.parse(readFileSync(manifestPath, "utf8"));
73
+ } catch {
74
+ return [];
75
+ }
76
+ if (!Array.isArray(parsed)) return [];
77
+ const entries = [];
78
+ for (const item of parsed) {
79
+ if (!item || typeof item !== "object") continue;
80
+ const entry = item;
81
+ if (typeof entry.name !== "string" || !isMcpScope(entry.scope)) continue;
82
+ entries.push({ name: entry.name, scope: entry.scope });
83
+ }
84
+ return uniqueMcpEntries(entries);
85
+ }
86
+ function writeMcpManifestEntries(manifestPath, entries) {
87
+ writeFileSync(
88
+ manifestPath,
89
+ JSON.stringify(uniqueMcpEntries(entries), null, 2) + "\n",
90
+ "utf8"
91
+ );
92
+ }
93
+ function updateSkillManifestForSource(sourceDir, slug) {
94
+ assertValidSkillSlug(slug);
95
+ const sourceAbs = path.resolve(sourceDir);
96
+ if (!statSync(sourceAbs).isDirectory()) {
97
+ throw new Error(`Skill source path is not a directory: ${sourceDir}`);
98
+ }
99
+ const manifestPath = path.join(path.dirname(sourceAbs), SKILL_MANIFEST_FILE);
100
+ const manifest = readSkillManifestEntries(manifestPath);
101
+ const nextEntry = { dirName: slug, scope: "personal" };
102
+ const existingIndex = manifest.findIndex((entry) => entry.dirName === slug);
103
+ if (existingIndex >= 0 && manifest[existingIndex].scope === nextEntry.scope) {
104
+ return { manifestPath, changed: false };
105
+ }
106
+ const nextManifest = manifest.slice();
107
+ if (existingIndex >= 0) {
108
+ nextManifest[existingIndex] = nextEntry;
109
+ } else {
110
+ nextManifest.push(nextEntry);
111
+ }
112
+ writeSkillManifestEntries(manifestPath, nextManifest);
113
+ return { manifestPath, changed: true };
114
+ }
115
+ function updateMcpManifestForProjectSource(workspaceDir, name) {
116
+ assertValidMcpName(name);
117
+ const workspaceAbs = path.resolve(workspaceDir);
118
+ if (!statSync(workspaceAbs).isDirectory()) {
119
+ throw new Error(`MCP workspace path is not a directory: ${workspaceDir}`);
120
+ }
121
+ const manifestPath = path.join(workspaceAbs, MCP_MANIFEST_FILE);
122
+ const manifest = readMcpManifestEntries(manifestPath);
123
+ const nextEntry = { name, scope: "personal" };
124
+ const existingIndex = manifest.findIndex((entry) => entry.name === name);
125
+ if (existingIndex >= 0 && manifest[existingIndex].scope === nextEntry.scope) {
126
+ return { manifestPath, changed: false };
127
+ }
128
+ const nextManifest = manifest.slice();
129
+ if (existingIndex >= 0) {
130
+ nextManifest[existingIndex] = nextEntry;
131
+ } else {
132
+ nextManifest.push(nextEntry);
133
+ }
134
+ writeMcpManifestEntries(manifestPath, nextManifest);
135
+ return { manifestPath, changed: true };
136
+ }
137
+
138
+ // src/commands/sync/index.ts
139
+ function redactEnv(env) {
140
+ if (!env) return void 0;
141
+ const out = {};
142
+ for (const [k, v] of Object.entries(env)) {
143
+ if (/TOKEN|SECRET|KEY|PASSWORD/i.test(k)) {
144
+ out[k] = "***";
145
+ } else {
146
+ out[k] = v;
147
+ }
148
+ }
149
+ return out;
150
+ }
151
+ var SOURCE_ORDER = {
152
+ global: 0,
153
+ workspace: 1,
154
+ project: 0,
155
+ local: 1,
156
+ user: 2
157
+ };
158
+ function skillToItem(s) {
159
+ return {
160
+ kind: "skill",
161
+ slug: s.slug,
162
+ scope: "personal",
163
+ source: s.source,
164
+ workspacePath: s.workspacePath,
165
+ event: "upsert",
166
+ dirPath: s.dirPath,
167
+ content: s.content,
168
+ checksum: s.checksum,
169
+ mtime: s.mtime
170
+ };
171
+ }
172
+ function mcpToItem(m, includeSecrets) {
173
+ return {
174
+ kind: "mcp",
175
+ slug: m.slug,
176
+ scope: "personal",
177
+ source: m.source,
178
+ workspacePath: m.workspacePath,
179
+ workspaceDir: m.workspaceDir,
180
+ event: "upsert",
181
+ transport: m.transport,
182
+ url: m.url,
183
+ command: m.command,
184
+ args: m.args,
185
+ env: includeSecrets ? m.env : redactEnv(m.env),
186
+ headers: m.headers
187
+ };
188
+ }
189
+ async function selectSkills() {
190
+ const all = scanSkills();
191
+ if (all.length === 0) {
192
+ process.stderr.write("No Skills found (scanned current workspace .claude/skills)\n");
193
+ return [];
194
+ }
195
+ all.sort((a, b) => {
196
+ if (a.source !== b.source) return SOURCE_ORDER[a.source] - SOURCE_ORDER[b.source];
197
+ return a.slug.localeCompare(b.slug);
198
+ });
199
+ const items = all.map((s) => ({
200
+ value: s,
201
+ label: s.slug,
202
+ group: describeSource(s),
203
+ hint: s.isSymlink ? "(symlink)" : void 0
204
+ }));
205
+ const picked = await promptMultiselect({
206
+ title: "Select Skills to push to the main app",
207
+ items
208
+ });
209
+ return picked.map(skillToItem);
210
+ }
211
+ async function selectMcps(includeSecrets) {
212
+ const all = scanMcps();
213
+ if (all.length === 0) {
214
+ process.stderr.write(
215
+ "No MCPs found (scanned current workspace .mcp.json / .claude/.claude.json and global ~/.claude.json)\n"
216
+ );
217
+ return [];
218
+ }
219
+ const { supported, unsupportedStdio } = splitPushableMcps(all);
220
+ if (unsupportedStdio.length > 0) {
221
+ const names = unsupportedStdio.map((m) => m.slug).sort().join(", ");
222
+ process.stderr.write(`ae-cli sync push only supports http/sse MCPs; skipped stdio MCPs: ${names}
223
+ `);
224
+ }
225
+ if (supported.length === 0) {
226
+ process.stderr.write("No syncable MCPs found. ae-cli sync push only supports http/sse.\n");
227
+ return [];
228
+ }
229
+ supported.sort((a, b) => {
230
+ if (a.source !== b.source) return SOURCE_ORDER[a.source] - SOURCE_ORDER[b.source];
231
+ return a.slug.localeCompare(b.slug);
232
+ });
233
+ const items = supported.map((m) => ({
234
+ value: m,
235
+ label: m.slug,
236
+ group: describeSource(m),
237
+ hint: m.hasSecrets && !includeSecrets ? "(env redacted)" : void 0
238
+ }));
239
+ const picked = await promptMultiselect({
240
+ title: "Select MCPs to push to the main app",
241
+ items
242
+ });
243
+ return picked.map((m) => mcpToItem(m, includeSecrets));
244
+ }
245
+ function renderResults(results) {
246
+ const table = new Table({
247
+ head: ["kind", "slug", "status", "message"],
248
+ wordWrap: true
249
+ });
250
+ for (const r of results) {
251
+ table.push([r.kind, r.slug, r.status, r.message ?? ""]);
252
+ }
253
+ process.stdout.write(table.toString() + "\n");
254
+ const failed = results.filter((r) => r.status === "failed").length;
255
+ if (failed > 0) {
256
+ process.stderr.write(`
257
+ \u2717 ${failed} item(s) failed
258
+ `);
259
+ }
260
+ }
261
+ async function selectPullResources(args) {
262
+ const all = args.candidates.filter((candidate) => candidate.selected).sort((a, b) => {
263
+ const scopeOrder = {
264
+ system: 0,
265
+ company: 1,
266
+ personal: 2
267
+ };
268
+ const scopeDiff = scopeOrder[a.scope] - scopeOrder[b.scope];
269
+ return scopeDiff !== 0 ? scopeDiff : a.name.localeCompare(b.name);
270
+ });
271
+ if (all.length === 0) {
272
+ process.stderr.write(`${args.title}: no candidates available to sync
273
+ `);
274
+ return [];
275
+ }
276
+ const items = all.map((candidate) => ({
277
+ value: candidate,
278
+ label: `${candidate.name} ${candidate.scope}`,
279
+ preselected: true
280
+ }));
281
+ return promptMultiselect({ title: args.title, items });
282
+ }
283
+ function toHttpItems(items) {
284
+ return items.map((item) => {
285
+ if (item.kind === "skill") {
286
+ const { kind: _kind2, dirPath: _dirPath, ...rest2 } = item;
287
+ return rest2;
288
+ }
289
+ const { kind: _kind, workspaceDir: _workspaceDir, ...rest } = item;
290
+ return rest;
291
+ });
292
+ }
293
+ async function pushItems(kind, items) {
294
+ if (items.length === 0) return { results: [] };
295
+ try {
296
+ const resp = await postToMainApp("/api/sandbox/sync/push", {
297
+ kind,
298
+ items: toHttpItems(items)
299
+ });
300
+ return { results: resp.results ?? [] };
301
+ } catch (err) {
302
+ if (err instanceof TeAgentApiError) {
303
+ return {
304
+ results: items.map((it) => ({
305
+ kind: it.kind,
306
+ slug: it.slug,
307
+ status: "failed",
308
+ message: `${err.code ?? err.status} ${err.message}`
309
+ }))
310
+ };
311
+ }
312
+ throw err;
313
+ }
314
+ }
315
+ function readSkillVersion(content) {
316
+ const frontmatter = /^---\r?\n([\s\S]*?)\r?\n---/.exec(content)?.[1];
317
+ if (!frontmatter) return void 0;
318
+ const matches = [...frontmatter.matchAll(/^version\s*:\s*(.+?)\s*(?:#.*)?$/gm)];
319
+ if (matches.length !== 1) return void 0;
320
+ const value = matches[0][1].trim().replace(/^(['"])(.*)\1$/, "$2");
321
+ return /^(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(value) ? value : void 0;
322
+ }
323
+ async function buildSkillZip(dirPath) {
324
+ const zip = new import_jszip.default();
325
+ const visit = (dir) => {
326
+ for (const name of readdirSync(dir)) {
327
+ if (name === ".DS_Store") continue;
328
+ const absolute = join(dir, name);
329
+ const stat = lstatSync(absolute);
330
+ if (stat.isSymbolicLink()) {
331
+ throw new Error(`Skill package contains a symlink: ${relative(dirPath, absolute)}`);
332
+ }
333
+ if (stat.isDirectory()) visit(absolute);
334
+ else if (stat.isFile()) {
335
+ const content = readFileSync2(absolute);
336
+ if (relative(dirPath, absolute).replaceAll("\\", "/") === "SKILL.md") {
337
+ assertSkillDocumentSize(content);
338
+ }
339
+ zip.file(relative(dirPath, absolute).replaceAll("\\", "/"), content);
340
+ }
341
+ }
342
+ };
343
+ visit(dirPath);
344
+ return zip.generateAsync({ type: "nodebuffer", compression: "DEFLATE" });
345
+ }
346
+ var defaultPushSkillDependencies = {
347
+ upload: (path2, formData) => uploadToMainApp(path2, formData),
348
+ updateManifest: updateSkillManifestForSource
349
+ };
350
+ async function pushSkillItems(items, dependencies = defaultPushSkillDependencies) {
351
+ const results = [];
352
+ for (const item of items) {
353
+ try {
354
+ const buffer = await buildSkillZip(item.dirPath);
355
+ const formData = new FormData();
356
+ formData.append("file", new Blob([new Uint8Array(buffer)], { type: "application/zip" }), `${item.slug}.zip`);
357
+ formData.append("slug", item.slug);
358
+ formData.append("source", item.source);
359
+ if (item.workspacePath) formData.append("workspacePath", item.workspacePath);
360
+ const version = readSkillVersion(item.content);
361
+ if (version) formData.append("version", version);
362
+ const response = await dependencies.upload("/api/sandbox/sync/push/skill", formData);
363
+ dependencies.updateManifest(item.dirPath, item.slug);
364
+ results.push({
365
+ kind: "skill",
366
+ slug: item.slug,
367
+ status: "synced",
368
+ ...!response.workspaceEnabled && item.source === "workspace" ? {
369
+ message: "Skill synced, but it was not enabled in the current workspace"
370
+ } : {}
371
+ });
372
+ } catch (err) {
373
+ const message = err instanceof TeAgentApiError ? `${err.code ?? err.status} ${err.message}` : err?.message ?? String(err);
374
+ results.push({
375
+ kind: "skill",
376
+ slug: item.slug,
377
+ status: "failed",
378
+ message
379
+ });
380
+ }
381
+ }
382
+ return { results };
383
+ }
384
+ function updateSyncedProjectMcpManifest(mcpItems, resp) {
385
+ if (mcpItems.length === 0) return;
386
+ const bySlug = new Map(mcpItems.map((item) => [item.slug, item]));
387
+ for (const result of resp.results) {
388
+ if (result.kind !== "mcp" || result.status !== "synced") continue;
389
+ const item = bySlug.get(result.slug);
390
+ if (!item || item.source !== "project") continue;
391
+ if (!item.workspaceDir) {
392
+ result.status = "failed";
393
+ result.message = "Main app synced the MCP, but local MCP manifest update failed: missing workspaceDir";
394
+ continue;
395
+ }
396
+ try {
397
+ updateMcpManifestForProjectSource(item.workspaceDir, item.slug);
398
+ } catch (err) {
399
+ result.status = "failed";
400
+ result.message = `Main app synced the MCP, but local MCP manifest update failed: ${err?.message ?? String(err)}`;
401
+ }
402
+ }
403
+ }
404
+ async function selectDirection(optsDirection) {
405
+ if (optsDirection === "push" || optsDirection === "pull") return optsDirection;
406
+ if (optsDirection) {
407
+ throw new Error("--direction must be push or pull");
408
+ }
409
+ return promptSingleSelect({
410
+ title: "Sync direction?",
411
+ items: [
412
+ { value: "push", label: "Workspace -> Main app" },
413
+ { value: "pull", label: "Main app -> Workspace" }
414
+ ]
415
+ });
416
+ }
417
+ async function selectKind(optsKind) {
418
+ if (optsKind === "skill" || optsKind === "mcp" || optsKind === "both") return optsKind;
419
+ if (optsKind) {
420
+ throw new Error("--kind must be skill, mcp, or both");
421
+ }
422
+ return promptSingleSelect({
423
+ title: "Which resource type to sync?",
424
+ items: [
425
+ { value: "skill", label: "Skills" },
426
+ { value: "mcp", label: "MCPs" },
427
+ { value: "both", label: "Skills + MCPs" }
428
+ ]
429
+ });
430
+ }
431
+ async function runPush(kind, includeSecrets) {
432
+ const skillItems = kind !== "mcp" ? await selectSkills() : [];
433
+ const mcpItems = kind !== "skill" ? await selectMcps(includeSecrets) : [];
434
+ if (skillItems.length === 0 && mcpItems.length === 0) {
435
+ process.stderr.write("Nothing selected, exiting\n");
436
+ return;
437
+ }
438
+ process.stderr.write(`Pushing ${skillItems.length} Skill(s) / ${mcpItems.length} MCP(s) ...
439
+ `);
440
+ const allResults = [];
441
+ if (skillItems.length > 0) {
442
+ const skillResp = await pushSkillItems(skillItems);
443
+ allResults.push(...skillResp.results);
444
+ }
445
+ if (mcpItems.length > 0) {
446
+ const mcpResp = await pushItems("mcp", mcpItems);
447
+ updateSyncedProjectMcpManifest(mcpItems, mcpResp);
448
+ allResults.push(...mcpResp.results);
449
+ }
450
+ renderResults(allResults);
451
+ }
452
+ function pullResultRows(resp) {
453
+ return (resp.results ?? []).map((result) => ({
454
+ kind: result.kind,
455
+ slug: result.name,
456
+ status: result.status,
457
+ message: result.message
458
+ }));
459
+ }
460
+ async function runPull(kind) {
461
+ const workspace = getCurrentWorkspace();
462
+ if (!workspace) {
463
+ throw new Error("Current workspace not recognized; please run from within /home/ta/workspaces/<workspace>");
464
+ }
465
+ const candidates = await getSandboxSyncPullCandidates({
466
+ workspacePath: workspace.name,
467
+ kind
468
+ });
469
+ const skillItems = kind !== "mcp" ? await selectPullResources({
470
+ title: "Select Skills to sync to workspace",
471
+ candidates: (candidates.skills ?? []).filter((candidate) => candidate.scope !== "system")
472
+ }) : [];
473
+ const mcpItems = kind !== "skill" ? await selectPullResources({
474
+ title: "Select MCPs to sync to workspace",
475
+ candidates: candidates.mcp ?? []
476
+ }) : [];
477
+ if (skillItems.length === 0 && mcpItems.length === 0) {
478
+ process.stderr.write("Nothing selected, exiting\n");
479
+ return;
480
+ }
481
+ process.stderr.write(`Syncing to workspace: ${skillItems.length} Skill(s) / ${mcpItems.length} MCP(s) ...
482
+ `);
483
+ const resp = await postSandboxSyncPull({
484
+ workspacePath: workspace.name,
485
+ kind,
486
+ skills: skillItems.map((item) => item.id),
487
+ mcp: mcpItems.map((item) => item.id)
488
+ });
489
+ renderResults(pullResultRows(resp));
490
+ }
491
+ function registerSync(program) {
492
+ program.command("sync").description("Sync Skills / MCPs between current workspace and te-claude main app").option("--direction <direction>", "push | pull (skip interactive direction picker)").option("--include-secrets", "Include MCP env secrets (TOKEN/SECRET/KEY) in push", false).option("--kind <kind>", "skill | mcp | both (skip interactive picker)").action(async (opts) => {
493
+ try {
494
+ const direction = await selectDirection(opts.direction);
495
+ const kind = await selectKind(opts.kind);
496
+ if (direction === "push") await runPush(kind, !!opts.includeSecrets);
497
+ else await runPull(kind);
498
+ } catch (err) {
499
+ if (err instanceof MultiselectCancelled) {
500
+ process.stderr.write("Cancelled\n");
501
+ return;
502
+ }
503
+ if (err instanceof TeAgentCredentialsError) {
504
+ printError("config", err.message, err.hint);
505
+ process.exit(1);
506
+ }
507
+ if (err instanceof TeAgentApiError) {
508
+ printError("api", err.message, err.code);
509
+ process.exit(1);
510
+ }
511
+ const e = err;
512
+ printError("api", e?.message ?? String(err));
513
+ process.exit(1);
514
+ }
515
+ });
516
+ }
517
+ export {
518
+ buildSkillZip,
519
+ pushSkillItems,
520
+ readSkillVersion,
521
+ registerSync
522
+ };
@@ -1,6 +1,7 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
1
2
  import {
2
3
  assertValidSkillVersion
3
- } from "./chunk-4NN5IWVN.js";
4
+ } from "./chunk-T6OSFQZD.js";
4
5
  import {
5
6
  deleteFromMainApp,
6
7
  getBufferFromMainApp,
@@ -9,19 +10,19 @@ import {
9
10
  postToMainApp,
10
11
  putToMainApp,
11
12
  uploadToMainApp
12
- } from "./chunk-4XXOWOTA.js";
13
+ } from "./chunk-6QK7SYYY.js";
13
14
  import {
14
15
  buildCapabilityGatewayUrl,
15
16
  callCapabilityApi
16
- } from "./chunk-ZQ47LWTI.js";
17
- import "./chunk-SERWF6G5.js";
18
- import "./chunk-J2DEBMRF.js";
19
- import "./chunk-ZQKDZXDO.js";
20
- import "./chunk-3FY3RJ26.js";
17
+ } from "./chunk-GJXRF7Y6.js";
18
+ import "./chunk-Y74WTIKJ.js";
19
+ import "./chunk-RWXIXOZG.js";
20
+ import "./chunk-O6K2ODUE.js";
21
+ import "./chunk-KZ6ZHF5J.js";
21
22
  import {
22
23
  CliValidationError
23
- } from "./chunk-UW5UN47B.js";
24
- import "./chunk-JHENBQ5B.js";
24
+ } from "./chunk-533JK3YX.js";
25
+ import "./chunk-FR2EDAQM.js";
25
26
 
26
27
  // src/commands/te-agent/api-client.ts
27
28
  function getAgentApi(ctx, path) {