@anraktech/sync 0.13.0 → 0.13.1
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/cli.js +64 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -821,6 +821,28 @@ var TOOLS = [
|
|
|
821
821
|
description: "Re-scan the watch folder for new or changed files and sync them.",
|
|
822
822
|
parameters: { type: "object", properties: {} }
|
|
823
823
|
}
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
type: "function",
|
|
827
|
+
function: {
|
|
828
|
+
name: "manage_watch_folders",
|
|
829
|
+
description: "Add, remove, or list watch folders. Use when user wants to watch a new folder, stop watching a folder, or see which folders are being watched.",
|
|
830
|
+
parameters: {
|
|
831
|
+
type: "object",
|
|
832
|
+
properties: {
|
|
833
|
+
action: {
|
|
834
|
+
type: "string",
|
|
835
|
+
enum: ["add", "remove", "list"],
|
|
836
|
+
description: "Action to perform: 'add' a new folder, 'remove' an existing one, or 'list' all watched folders."
|
|
837
|
+
},
|
|
838
|
+
folderPath: {
|
|
839
|
+
type: "string",
|
|
840
|
+
description: "Absolute path to the folder (required for add/remove). Use full absolute paths like /Users/name/Desktop."
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
required: ["action"]
|
|
844
|
+
}
|
|
845
|
+
}
|
|
824
846
|
}
|
|
825
847
|
];
|
|
826
848
|
function buildSystemPrompt(config) {
|
|
@@ -834,11 +856,12 @@ Server: ${config.apiUrl}
|
|
|
834
856
|
Home directory: ${HOME}
|
|
835
857
|
Platform: ${IS_MAC ? "macOS" : platform()}
|
|
836
858
|
|
|
837
|
-
You can browse local folders, scan & sync files, list cases, show sync status, and more.
|
|
859
|
+
You can browse local folders, scan & sync files, list cases, show sync status, manage watch folders, and more.
|
|
838
860
|
|
|
839
861
|
Rules:
|
|
840
862
|
- Be concise. This is a terminal \u2014 1-3 lines unless showing a list.
|
|
841
863
|
- Do NOT use markdown. Plain text only.
|
|
864
|
+
- WATCH FOLDERS: When user asks to "watch", "add", or "also sync" a folder, use manage_watch_folders with action "add". When they say "stop watching" or "remove" a folder, use action "remove".
|
|
842
865
|
- IMPORTANT: When user mentions a folder like "downloads" or "desktop", ALWAYS use the full absolute path. Examples:
|
|
843
866
|
"downloads" or "my downloads" \u2192 ${join2(HOME, "Downloads")}
|
|
844
867
|
"desktop" \u2192 ${join2(HOME, "Desktop")}
|
|
@@ -1076,6 +1099,46 @@ async function executeTool(name, args, ctx) {
|
|
|
1076
1099
|
pending: stats.pending
|
|
1077
1100
|
});
|
|
1078
1101
|
}
|
|
1102
|
+
case "manage_watch_folders": {
|
|
1103
|
+
const action = args.action;
|
|
1104
|
+
const rawFolder = args.folderPath;
|
|
1105
|
+
if (action === "list") {
|
|
1106
|
+
const folders = getWatchFolders(ctx.config);
|
|
1107
|
+
return JSON.stringify({
|
|
1108
|
+
folders: folders.map((f, i) => ({
|
|
1109
|
+
path: f,
|
|
1110
|
+
primary: f === ctx.config.watchFolder,
|
|
1111
|
+
index: i + 1
|
|
1112
|
+
})),
|
|
1113
|
+
total: folders.length
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
if (action === "add") {
|
|
1117
|
+
if (!rawFolder) return JSON.stringify({ error: "Missing folderPath" });
|
|
1118
|
+
const folderPath = normalizePath(rawFolder);
|
|
1119
|
+
if (!ctx.addWatchFolder) {
|
|
1120
|
+
return JSON.stringify({ error: "Watch folder management not available" });
|
|
1121
|
+
}
|
|
1122
|
+
const result = await ctx.addWatchFolder(folderPath);
|
|
1123
|
+
if (result.added) {
|
|
1124
|
+
return JSON.stringify({ success: true, added: result.path || folderPath, total: getWatchFolders(ctx.config).length });
|
|
1125
|
+
}
|
|
1126
|
+
return JSON.stringify({ error: result.error || "Could not add folder" });
|
|
1127
|
+
}
|
|
1128
|
+
if (action === "remove") {
|
|
1129
|
+
if (!rawFolder) return JSON.stringify({ error: "Missing folderPath" });
|
|
1130
|
+
const folderPath = normalizePath(rawFolder);
|
|
1131
|
+
if (!ctx.removeWatchFolder) {
|
|
1132
|
+
return JSON.stringify({ error: "Watch folder management not available" });
|
|
1133
|
+
}
|
|
1134
|
+
const result = ctx.removeWatchFolder(folderPath);
|
|
1135
|
+
if (result.removed) {
|
|
1136
|
+
return JSON.stringify({ success: true, removed: folderPath, total: getWatchFolders(ctx.config).length });
|
|
1137
|
+
}
|
|
1138
|
+
return JSON.stringify({ error: result.error || "Could not remove folder" });
|
|
1139
|
+
}
|
|
1140
|
+
return JSON.stringify({ error: `Unknown action: ${action}. Use add, remove, or list.` });
|
|
1141
|
+
}
|
|
1079
1142
|
default:
|
|
1080
1143
|
return JSON.stringify({ error: `Unknown tool: ${name}` });
|
|
1081
1144
|
}
|