@myspec/mcp-server 1.1.1-next.167 → 1.1.1-next.169

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 (2) hide show
  1. package/dist/index.js +57 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2314,12 +2314,12 @@ function transformProjectResponse(raw) {
2314
2314
  org: raw.org,
2315
2315
  ownerId: raw.owner_id,
2316
2316
  name: raw.name,
2317
- description: raw.description,
2317
+ description: raw.description ?? "",
2318
2318
  status: raw.status,
2319
2319
  archivedAt: raw.archived_at ? new Date(raw.archived_at) : void 0,
2320
2320
  archivedBy: raw.archived_by || void 0,
2321
2321
  projectType: toProjectType(raw.project_type),
2322
- metadata: raw.metadata,
2322
+ metadata: raw.metadata ?? {},
2323
2323
  createdAt: new Date(raw.created_at),
2324
2324
  updatedAt: new Date(raw.updated_at),
2325
2325
  deletedAt: raw.deleted_at ? new Date(raw.deleted_at) : void 0,
@@ -2368,7 +2368,9 @@ var TASK_LIMITS = {
2368
2368
  /** The most tasks one page of a listing holds. */
2369
2369
  maxPageSize: 500,
2370
2370
  /** The most tasks.md files one board lists (and the most expected_versions a status change takes). */
2371
- maxBoardFiles: 500
2371
+ maxBoardFiles: 500,
2372
+ /** The largest body a batch of task changes may have, in bytes. */
2373
+ maxBatchBodyBytes: 512 * 1024
2372
2374
  };
2373
2375
  function parseTimestamp(raw) {
2374
2376
  if (!raw) return null;
@@ -2448,6 +2450,14 @@ function toTaskListQueryString(query) {
2448
2450
  const qs = params.toString();
2449
2451
  return qs ? `?${qs}` : "";
2450
2452
  }
2453
+ function transformFileWrites(raw) {
2454
+ return (raw ?? []).map((f) => ({
2455
+ specFileId: f.spec_file_id,
2456
+ contentVersion: f.content_version,
2457
+ written: f.written,
2458
+ ...f.error ? { error: f.error } : {}
2459
+ }));
2460
+ }
2451
2461
  function transformSetTaskStatusResult(raw) {
2452
2462
  return {
2453
2463
  results: (raw.results ?? []).map((r) => ({
@@ -2455,12 +2465,19 @@ function transformSetTaskStatusResult(raw) {
2455
2465
  outcome: toOutcome(r.outcome),
2456
2466
  ...r.error ? { error: r.error } : {}
2457
2467
  })),
2458
- files: (raw.files ?? []).map((f) => ({
2459
- specFileId: f.spec_file_id,
2460
- contentVersion: f.content_version,
2461
- written: f.written,
2462
- ...f.error ? { error: f.error } : {}
2468
+ files: transformFileWrites(raw.files),
2469
+ tasks: (raw.tasks ?? []).map(transformProjectTask)
2470
+ };
2471
+ }
2472
+ function transformApplyTaskChangesResult(raw) {
2473
+ return {
2474
+ results: (raw.results ?? []).map((r) => ({
2475
+ taskId: r.task_id,
2476
+ ...r.planning === "updated" || r.planning === "unchanged" ? { planning: r.planning } : {},
2477
+ ...r.status ? { status: toOutcome(r.status) } : {},
2478
+ ...r.error ? { error: r.error } : {}
2463
2479
  })),
2480
+ files: transformFileWrites(raw.files),
2464
2481
  tasks: (raw.tasks ?? []).map(transformProjectTask)
2465
2482
  };
2466
2483
  }
@@ -2476,6 +2493,12 @@ function transformTaskAssigneeList(raw) {
2476
2493
  };
2477
2494
  }
2478
2495
  function toRawUpdateTasksRequest(taskIds, patch) {
2496
+ const body = { task_ids: taskIds, set: toRawPlanningSet(patch) };
2497
+ if (patch.addLabels?.length) body.add_labels = patch.addLabels;
2498
+ if (patch.removeLabels?.length) body.remove_labels = patch.removeLabels;
2499
+ return body;
2500
+ }
2501
+ function toRawPlanningSet(patch) {
2479
2502
  const set = {};
2480
2503
  if ("assigneeUserId" in patch) set.assignee_user_id = patch.assigneeUserId ?? null;
2481
2504
  if ("priority" in patch) set.priority = patch.priority ?? null;
@@ -2483,9 +2506,23 @@ function toRawUpdateTasksRequest(taskIds, patch) {
2483
2506
  if ("cycle" in patch) set.cycle = patch.cycle ?? null;
2484
2507
  if ("startAt" in patch) set.start_at = patch.startAt ? patch.startAt.toISOString() : null;
2485
2508
  if ("endAt" in patch) set.end_at = patch.endAt ? patch.endAt.toISOString() : null;
2486
- const body = { task_ids: taskIds, set };
2487
- if (patch.addLabels?.length) body.add_labels = patch.addLabels;
2488
- if (patch.removeLabels?.length) body.remove_labels = patch.removeLabels;
2509
+ return set;
2510
+ }
2511
+ function toRawTaskChange(change) {
2512
+ const raw = { task_id: change.taskId };
2513
+ if (change.status) raw.status = change.status;
2514
+ const patch = change.patch;
2515
+ if (patch) {
2516
+ const set = toRawPlanningSet(patch);
2517
+ if (Object.keys(set).length > 0) raw.set = set;
2518
+ if (patch.addLabels?.length) raw.add_labels = patch.addLabels;
2519
+ if (patch.removeLabels?.length) raw.remove_labels = patch.removeLabels;
2520
+ }
2521
+ return raw;
2522
+ }
2523
+ function toRawApplyTaskChangesRequest(changes, expectedVersions) {
2524
+ const body = { changes: changes.map(toRawTaskChange) };
2525
+ if (expectedVersions && Object.keys(expectedVersions).length > 0) body.expected_versions = expectedVersions;
2489
2526
  return body;
2490
2527
  }
2491
2528
 
@@ -3370,6 +3407,15 @@ var HttpProjectTaskClient = class {
3370
3407
  );
3371
3408
  return transformSetTaskStatusResult(raw);
3372
3409
  }
3410
+ async applyProjectTaskChanges(projectId, changes, jwtToken, opts) {
3411
+ const raw = await this.httpClient.post(
3412
+ `${tasksPath(projectId)}/batch`,
3413
+ toRawApplyTaskChangesRequest(changes, opts?.expectedVersions),
3414
+ jwtToken,
3415
+ opts?.actorKind ? { headers: { [HEADER_ACTOR_KIND3]: opts.actorKind } } : {}
3416
+ );
3417
+ return transformApplyTaskChangesResult(raw);
3418
+ }
3373
3419
  };
3374
3420
 
3375
3421
  // ../../packages/platform-client/artifact/types/artifact.types.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myspec/mcp-server",
3
- "version": "1.1.1-next.167",
3
+ "version": "1.1.1-next.169",
4
4
  "description": "MySpec MCP server — exposes MySpec platform projects, files and attachments to MCP-aware clients via OAuth-authenticated access tokens.",
5
5
  "type": "module",
6
6
  "repository": {