trakt-tools 1.6.0 → 1.7.0

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.
@@ -2,7 +2,7 @@
2
2
  "id": "trakt-tools",
3
3
  "name": "Trakt",
4
4
  "description": "Track movies and TV shows using trakt.tv",
5
- "version": "1.6.0",
5
+ "version": "1.7.0",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trakt-tools",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "OpenClaw plugin for Trakt.tv - track movies and TV shows",
5
5
  "type": "module",
6
6
  "openclaw": {
package/src/index.ts CHANGED
@@ -96,6 +96,24 @@ const TOOLS: ToolDef[] = [
96
96
  page: Type.Optional(Type.Number({ description: 'Page number' })),
97
97
  }),
98
98
  },
99
+ {
100
+ name: 'trakt_watchlist_add',
101
+ command: 'watchlist',
102
+ subcommand: 'add',
103
+ description:
104
+ 'Add movies or shows to the Trakt.tv watchlist. Searches by title and queues matches in one sync call. Accepts multiple titles. Items already on the list are reported under `existing_*` counts.',
105
+ parameters: Type.Object({
106
+ titles: Type.Array(Type.String(), {
107
+ description: 'Title(s) to add to the watchlist',
108
+ minItems: 1,
109
+ }),
110
+ type: Type.Optional(
111
+ Type.Union([Type.Literal('movie'), Type.Literal('show')], {
112
+ description: 'Content type (default: show)',
113
+ })
114
+ ),
115
+ }),
116
+ },
99
117
  {
100
118
  name: 'trakt_progress',
101
119
  command: 'progress',
@@ -208,6 +226,21 @@ function buildCliArgs(
208
226
  }
209
227
  }
210
228
 
229
+ // watchlist add: same title-array shape as history add, minus watched_at
230
+ // (the watchlist API has no "added at" field — Trakt assigns listed_at
231
+ // server-side at sync time).
232
+ if (command === 'watchlist' && subcommand === 'add') {
233
+ const titles = params.titles as string[] | undefined;
234
+ if (titles) {
235
+ if (params.type) args.push('--type', String(params.type));
236
+ for (const title of titles) {
237
+ args.push(title);
238
+ }
239
+ args.push('--json');
240
+ return args;
241
+ }
242
+ }
243
+
211
244
  const skipKeys = new Set(['query', 'titles']);
212
245
  for (const [key, value] of Object.entries(params)) {
213
246
  if (skipKeys.has(key) || value === undefined || value === null || value === false) continue;
@@ -278,10 +311,17 @@ export default definePluginEntry({
278
311
 
279
312
  try {
280
313
  const args = buildCliArgs(tool.command, tool.subcommand, params, config);
314
+ // 30s was too tight for `progress`, which iterates ~50 API calls
315
+ // (watchlist + watched + N× GetShowProgress) and empirically runs
316
+ // 35-45s for users with substantial watch history. 120s gives
317
+ // generous headroom. maxBuffer bumped to 4MB to fit the full
318
+ // progress --all response (completed + in_progress + not_started).
319
+ // Follow-up: parallelize GetShowProgress loop or add a --filter
320
+ // flag so per-show progress checks don't hammer 50 API calls.
281
321
  const { stdout } = await execFileAsync(cliPath, args, {
282
322
  encoding: 'utf8',
283
- timeout: 30_000,
284
- maxBuffer: 1024 * 1024,
323
+ timeout: 120_000,
324
+ maxBuffer: 4 * 1024 * 1024,
285
325
  });
286
326
 
287
327
  let result: unknown;