@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.
Files changed (126) hide show
  1. package/README.md +2 -0
  2. package/README.zh.md +6 -0
  3. package/dist/{auth-77BUFLGC.js → auth-QPEVVBKT.js} +20 -15
  4. package/dist/auth-UMJAA72O.js +15 -0
  5. package/dist/{capability-72DTW5M2.js → capability-ASI62I4A.js} +53 -15
  6. package/dist/{chunk-UW5UN47B.js → chunk-533JK3YX.js} +2 -0
  7. package/dist/{chunk-UOUS37JQ.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-DAVKYVMW.js → chunk-B5HMQAOM.js} +31 -540
  11. package/dist/{chunk-VR3LCBHW.js → chunk-DKEXH6Q5.js} +6 -5
  12. package/dist/{chunk-VTWMIC5L.js → chunk-E2JKXMVO.js} +2 -0
  13. package/dist/{chunk-LYVNONC4.js → chunk-FR2EDAQM.js} +36 -0
  14. package/dist/{chunk-ILIU36SU.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-GT46FPXN.js → chunk-KEWVSO64.js} +18 -8
  18. package/dist/chunk-KZ6ZHF5J.js +294 -0
  19. package/dist/chunk-O6K2ODUE.js +318 -0
  20. package/dist/chunk-QL6R6TSK.js +25215 -0
  21. package/dist/{chunk-4SGZG4XY.js → chunk-RWXIXOZG.js} +28 -13
  22. package/dist/{chunk-YA6SMTXG.js → chunk-S5PONFBM.js} +5 -4
  23. package/dist/{chunk-4NN5IWVN.js → chunk-T6OSFQZD.js} +2 -0
  24. package/dist/{chunk-PTE56QPL.js → chunk-TKHSULJT.js} +6 -0
  25. package/dist/{chunk-6EIJSNBD.js → chunk-Y74WTIKJ.js} +2 -0
  26. package/dist/{client-TKG4WBHN.js → client-N7NGZUNI.js} +6 -4
  27. package/dist/{community-report-client-FI4LNVYS.js → community-report-client-6OL6GBQW.js} +3 -3
  28. package/dist/{config-RE6CMGPK.js → config-XNMACCKX.js} +10 -8
  29. package/dist/{data-integration-XQYB4X4F.js → data-integration-4NZGZ45E.js} +2502 -272
  30. package/dist/index.js +137 -1245
  31. package/dist/{local-data-upload-client-BWHSUQQK.js → local-data-upload-client-EFHDLXFG.js} +3 -3
  32. package/dist/{memory-YK33G4T7.js → memory-HBJQ2GC5.js} +8 -7
  33. package/dist/{metadata-UILXHBWF.js → metadata-62EWBEIG.js} +12 -11
  34. package/dist/{model-NR3JHFSJ.js → model-BHLJ2QMT.js} +10 -9
  35. package/dist/personal-semantic-preference-JBVMAI7L.js +240 -0
  36. package/dist/project-semantic-BQ4MPUS5.js +1115 -0
  37. package/dist/sync-MUWPRM5I.js +522 -0
  38. package/dist/{te-agent-4BKBODMF.js → te-agent-WQZTMEK4.js} +12 -10
  39. package/dist/{te-analysis-O6DCO6BS.js → te-analysis-MNCG65LU.js} +534 -48
  40. package/dist/{te-community-HLC43QKH.js → te-community-BNE6KREL.js} +8 -7
  41. package/dist/{te-dataops-EJP56W3K.js → te-dataops-TXLKM2W6.js} +469 -68
  42. package/dist/{te-engage-FGBGQ4IY.js → te-engage-TPKLRVTL.js} +84 -10
  43. package/dist/{te-experiment-SO5MPDMJ.js → te-experiment-6BYKTCY7.js} +303 -12
  44. package/dist/{te-kb-SQCLHG6X.js → te-kb-BUD6N3NI.js} +312 -25
  45. package/dist/{te-system-YARIK4S5.js → te-system-44LZJDTQ.js} +573 -37
  46. package/dist/{te-team-EFKWYKMK.js → te-team-XMP47YXE.js} +10 -7
  47. package/dist/{update-OGPSZM5A.js → update-UODFOZ4P.js} +9 -7
  48. package/package.json +18 -9
  49. package/skills/ae-agent/SKILL.md +3 -4
  50. package/skills/ae-agent/references/edit-skill.md +3 -0
  51. package/skills/ae-agent/references/get-skill-content.md +1 -1
  52. package/skills/ae-agent/references/rescan-skills.md +15 -13
  53. package/skills/ae-agent/references/upload-skill.md +7 -4
  54. package/skills/ae-analysis/SKILL.md +45 -4
  55. package/skills/ae-analysis/metadata_resolution.md +38 -4
  56. package/skills/ae-analysis/references/analysis_data_retrieval.md +29 -0
  57. package/skills/ae-analysis/references/analysis_gateway_assets.md +1 -1
  58. package/skills/ae-analysis/references/asset_authentication_export.md +22 -0
  59. package/skills/ae-analysis/references/asset_authentication_list.md +18 -14
  60. package/skills/ae-analysis/references/asset_authentication_update.md +29 -14
  61. package/skills/ae-analysis/references/audience_models.md +18 -0
  62. package/skills/ae-analysis/references/command_index.md +19 -11
  63. package/skills/ae-analysis/references/dashboard_get.md +18 -1
  64. package/skills/ae-analysis/references/dashboard_update.md +3 -0
  65. package/skills/ae-analysis/references/personal_semantic_preference_add.md +23 -0
  66. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +17 -0
  67. package/skills/ae-analysis/references/personal_semantic_preference_get.md +19 -0
  68. package/skills/ae-analysis/references/personal_semantic_preference_list.md +21 -0
  69. package/skills/ae-analysis/references/personal_semantic_preference_update.md +19 -0
  70. package/skills/ae-analysis/references/project_timezone_update.md +13 -4
  71. package/skills/ae-analysis/references/property_create.md +2 -0
  72. package/skills/ae-analysis/references/super_metadata_batch_create.md +2 -0
  73. package/skills/ae-analysis/references/user_cluster_models.md +2 -0
  74. package/skills/ae-analysis/references/user_cluster_update.md +8 -4
  75. package/skills/ae-analysis/references/user_tag_create.md +7 -1
  76. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  77. package/skills/ae-data-integration/SKILL.md +24 -4
  78. package/skills/ae-data-integration/references/custom-layer.md +93 -0
  79. package/skills/ae-data-integration/references/error-handling.md +145 -0
  80. package/skills/ae-data-integration/references/handoff.md +77 -18
  81. package/skills/ae-data-integration/references/local-analysis.md +1 -1
  82. package/skills/ae-data-integration/references/reuse.md +9 -5
  83. package/skills/ae-data-integration/references/sink-upload.md +1 -1
  84. package/skills/ae-data-integration/references/source-inspect.md +35 -13
  85. package/skills/ae-data-integration/references/tracking-plan.md +7 -5
  86. package/skills/ae-data-integration/references/transform.md +12 -10
  87. package/skills/ae-data-integration/references/ue-mapping.md +33 -11
  88. package/skills/ae-data-integration/references/ue-routing.md +23 -0
  89. package/skills/ae-dataops/SKILL.md +11 -1
  90. package/skills/ae-dataops/references/dataops-backfill.md +135 -0
  91. package/skills/ae-engage/SKILL.md +5 -0
  92. package/skills/ae-engage/references/build-task-save-guide.md +14 -1
  93. package/skills/ae-engage/references/save-flow.md +37 -1
  94. package/skills/ae-engage/references/save-task.md +88 -0
  95. package/skills/ae-experiment/SKILL.md +14 -4
  96. package/skills/ae-experiment/references/manage_feature_whitelist.md +66 -0
  97. package/skills/ae-experiment/references/manage_guardrail_metrics.md +26 -0
  98. package/skills/ae-experiment/references/save_experiment.md +1 -1
  99. package/skills/ae-experiment/references/save_metric.md +20 -8
  100. package/skills/ae-kb/SKILL.md +121 -10
  101. package/skills/ae-project-semantic/SKILL.md +193 -0
  102. package/skills/ae-project-semantic/references/query-routing-v5.md +165 -0
  103. package/skills/ae-project-semantic/references/recommendation-quality.md +68 -0
  104. package/skills/ae-system/SKILL.md +28 -30
  105. package/skills/ae-system/references/channel-management.md +303 -0
  106. package/dist/auth-2WTQOP77.js +0 -14
  107. package/dist/capability-PJHNI4GJ.js +0 -315
  108. package/dist/chunk-4KVPKXFX.js +0 -98
  109. package/dist/chunk-C4MGVGJW.js +0 -13
  110. package/dist/chunk-P3FGXJTU.js +0 -349
  111. package/dist/chunk-QGM4M3NI.js +0 -37
  112. package/dist/chunk-RGKJGKT7.js +0 -71
  113. package/dist/chunk-SAU3QFIQ.js +0 -556
  114. package/dist/chunk-VPKZ7I72.js +0 -509
  115. package/dist/chunk-ZZUOD757.js +0 -598
  116. package/dist/memory-CHRU2F7W.js +0 -893
  117. package/dist/metadata-XXR34N5P.js +0 -339
  118. package/dist/model-K3KLWIW6.js +0 -139
  119. package/dist/sync-FCKOVWWS.js +0 -10261
  120. package/dist/te-agent-HLW4VTQK.js +0 -3893
  121. package/dist/te-analysis-ZMNGOVNW.js +0 -8958
  122. package/dist/te-community-6HPBWJUZ.js +0 -1859
  123. package/dist/te-dataops-HDRUXY4K.js +0 -2208
  124. package/dist/te-engage-RAK5PESW.js +0 -4898
  125. package/dist/te-experiment-VZF7BT6G.js +0 -770
  126. package/dist/te-system-Z77IKZFN.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-VPKZ7I72.js";
13
+ } from "./chunk-6QK7SYYY.js";
13
14
  import {
14
15
  buildCapabilityGatewayUrl,
15
16
  callCapabilityApi
16
- } from "./chunk-ILIU36SU.js";
17
- import "./chunk-6EIJSNBD.js";
18
- import "./chunk-4SGZG4XY.js";
19
- import "./chunk-ZZUOD757.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";
20
22
  import {
21
23
  CliValidationError
22
- } from "./chunk-UW5UN47B.js";
23
- import "./chunk-LYVNONC4.js";
24
- import "./chunk-QGM4M3NI.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) {
@@ -2080,7 +2081,8 @@ var uploadSkill = {
2080
2081
  var rescanSkills = {
2081
2082
  service: "agent",
2082
2083
  command: "+rescan-skills",
2083
- description: "Rescan Skill files and sync to database (root only)",
2084
+ hidden: true,
2085
+ description: "Compatibility-only Skill inventory synchronization (system scope)",
2084
2086
  flags: [],
2085
2087
  risk: "write",
2086
2088
  dryRun: () => ({