@cnzgray/dsh-mattpocock-workflow 0.7.0 → 0.8.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.
package/lib/index.js CHANGED
@@ -374,6 +374,7 @@ async function patchTicketAt(root, workspaceRoot, ref, patch) {
374
374
  if (ticket === void 0) return false;
375
375
  const updated = {
376
376
  ...ticket,
377
+ ...patch.title === void 0 ? {} : { title: patch.title },
377
378
  ...patch.labels === void 0 ? {} : { labels: patch.labels },
378
379
  ...patch.state === void 0 ? {} : { state: patch.state }
379
380
  };
@@ -1909,7 +1910,10 @@ var PANEL_SKILLS = {
1909
1910
  wayfinder: "wayfinder",
1910
1911
  implement: "implement",
1911
1912
  codeReview: "code-review",
1912
- pr: "pr"
1913
+ pr: "pr",
1914
+ research: "research",
1915
+ codebaseDesign: "codebase-design",
1916
+ prototype: "prototype"
1913
1917
  };
1914
1918
  var REQUIRED_SKILLS = [
1915
1919
  PANEL_SKILLS.setup,
@@ -1974,6 +1978,8 @@ var RPC_METHODS = {
1974
1978
  ticketGet: "ticket.get",
1975
1979
  /** 应用一次工单变更;成功后界面重新读取详情并刷新列表快照。 */
1976
1980
  ticketUpdate: "ticket.update",
1981
+ /** 发表一条评论;成功后界面重新读取详情。 */
1982
+ ticketComment: "ticket.comment",
1977
1983
  /** 读取仓库的标签与可分配用户,供详情里添加标签、分配人时补全。 */
1978
1984
  ticketOptions: "ticket.options",
1979
1985
  /** 永久删除一张工单;必须带 `confirm: 'delete'`,宿主再按权限拒绝或执行。 */
@@ -2146,10 +2152,13 @@ function avatarBaseUrl(remoteUrl, host) {
2146
2152
  }
2147
2153
  return `https://${host}`;
2148
2154
  }
2149
- async function callGiteaApi(run, workspaceRoot, endpoint, method) {
2155
+ async function callGiteaApi(run, workspaceRoot, endpoint, method, options) {
2150
2156
  try {
2151
- const args = method === void 0 ? ["api", "--include", endpoint] : ["api", "--include", "--method", method, endpoint];
2152
- const output = await run("tea", args, { cwd: workspaceRoot });
2157
+ const args = method === void 0 ? ["api", "--include", endpoint] : ["api", "--include", "--method", method, ...options?.fields ?? [], endpoint];
2158
+ const output = await run("tea", args, {
2159
+ cwd: workspaceRoot,
2160
+ ...options?.stdin === void 0 ? {} : { stdin: options.stdin }
2161
+ });
2153
2162
  return parseApiResponse(output.stdout, output.stderr);
2154
2163
  } catch (error) {
2155
2164
  throw mapTeaError(error);
@@ -2168,9 +2177,9 @@ function ensureSuccess(response, action) {
2168
2177
  `${action}\u5931\u8D25\uFF1AGitea \u8FD4\u56DE HTTP ${String(response.status)}\u3002`
2169
2178
  );
2170
2179
  }
2171
- async function callTea(run, workspaceRoot, args) {
2180
+ async function callTea(run, workspaceRoot, args, options) {
2172
2181
  try {
2173
- return (await run("tea", args, { cwd: workspaceRoot })).stdout;
2182
+ return (await run("tea", args, { cwd: workspaceRoot, ...options })).stdout;
2174
2183
  } catch (error) {
2175
2184
  throw mapTeaError(error);
2176
2185
  }
@@ -2191,11 +2200,11 @@ function mapTeaError(error) {
2191
2200
  { cause: error }
2192
2201
  );
2193
2202
  }
2194
- return new TrackerError("fetch-failed", `\u8BFB\u53D6 Gitea \u5DE5\u5355\u5931\u8D25\uFF1A${commandFailureDetail(error)}`, {
2203
+ return new TrackerError("fetch-failed", `\u64CD\u4F5C Gitea \u5DE5\u5355\u5931\u8D25\uFF1A${commandFailureDetail(error)}`, {
2195
2204
  cause: error
2196
2205
  });
2197
2206
  }
2198
- return new TrackerError("fetch-failed", "\u8BFB\u53D6 Gitea \u5DE5\u5355\u5931\u8D25\u3002", { cause: error });
2207
+ return new TrackerError("fetch-failed", "\u64CD\u4F5C Gitea \u5DE5\u5355\u5931\u8D25\u3002", { cause: error });
2199
2208
  }
2200
2209
 
2201
2210
  // src/adapters/gitea/delete.ts
@@ -2275,6 +2284,17 @@ async function applyGiteaChanges(deps, workspaceRoot, reference, patch) {
2275
2284
  const number = requireTicketNumber(reference);
2276
2285
  const repository = await readRepository(deps.run, workspaceRoot);
2277
2286
  const current = await readIssue(deps, workspaceRoot, repository, number);
2287
+ const editArgs = [];
2288
+ if (patch.title !== void 0) editArgs.push("--title", patch.title);
2289
+ if (patch.body !== void 0) editArgs.push("--description-file", "-");
2290
+ if (editArgs.length > 0) {
2291
+ await callTea(
2292
+ deps.run,
2293
+ workspaceRoot,
2294
+ ["issues", "edit", String(number), ...editArgs],
2295
+ patch.body === void 0 ? void 0 : { stdin: patch.body }
2296
+ );
2297
+ }
2278
2298
  if (patch.labels !== void 0) {
2279
2299
  const diff = planSetChange(current.labels, patch.labels);
2280
2300
  if (!isEmptyDiff(diff)) {
@@ -2306,6 +2326,18 @@ async function applyGiteaChanges(deps, workspaceRoot, reference, patch) {
2306
2326
  ]);
2307
2327
  }
2308
2328
  }
2329
+ async function createGiteaComment(deps, workspaceRoot, reference, body) {
2330
+ const number = requireTicketNumber(reference);
2331
+ const repository = await readRepository(deps.run, workspaceRoot);
2332
+ const response = await callGiteaApi(
2333
+ deps.run,
2334
+ workspaceRoot,
2335
+ `/repos/${repository.owner}/${repository.name}/issues/${String(number)}/comments`,
2336
+ "POST",
2337
+ { fields: ["-F", "body=@-"], stdin: body }
2338
+ );
2339
+ ensureDetailSuccess(response, "\u53D1\u8868 Gitea \u8BC4\u8BBA");
2340
+ }
2309
2341
  async function readIssue(deps, workspaceRoot, repository, number) {
2310
2342
  const response = await callGiteaApi(
2311
2343
  deps.run,
@@ -2429,9 +2461,11 @@ function parseCommentsPage(body) {
2429
2461
  if (!isRecord(entry)) continue;
2430
2462
  const text = typeof entry.body === "string" ? entry.body : "";
2431
2463
  if (text.length === 0) continue;
2464
+ const id = typeof entry.id === "number" ? entry.id : null;
2432
2465
  comments.push({
2433
- id: typeof entry.id === "number" ? entry.id : null,
2466
+ id,
2434
2467
  comment: {
2468
+ id: id === null ? null : String(id),
2435
2469
  author: isRecord(entry.user) ? readOptionalString(entry.user.login) : null,
2436
2470
  body: text,
2437
2471
  createdAt: readOptionalString(entry.created_at)
@@ -2577,6 +2611,7 @@ function createGiteaTracker(deps) {
2577
2611
  },
2578
2612
  fetchDetail: (workspaceRoot, reference) => readGiteaDetail(detailDeps, workspaceRoot, reference),
2579
2613
  updateTicket: (workspaceRoot, reference, patch) => applyGiteaChanges(detailDeps, workspaceRoot, reference, patch),
2614
+ createComment: (workspaceRoot, reference, body) => createGiteaComment(detailDeps, workspaceRoot, reference, body),
2580
2615
  fetchOptions: (workspaceRoot) => readGiteaOptions(deps, workspaceRoot),
2581
2616
  canDeleteTickets: (workspaceRoot) => readGiteaDeletePermission(deps, workspaceRoot),
2582
2617
  deleteTicket: (workspaceRoot, reference) => deleteGiteaTicket(deps, workspaceRoot, reference)
@@ -2761,9 +2796,9 @@ async function readRepository2(run, workspaceRoot) {
2761
2796
  }
2762
2797
  return { owner, name: name2 };
2763
2798
  }
2764
- async function callGh(run, workspaceRoot, args) {
2799
+ async function callGh(run, workspaceRoot, args, options) {
2765
2800
  try {
2766
- return (await run("gh", args, { cwd: workspaceRoot })).stdout;
2801
+ return (await run("gh", args, { cwd: workspaceRoot, ...options })).stdout;
2767
2802
  } catch (error) {
2768
2803
  throw mapGhError(error);
2769
2804
  }
@@ -2805,11 +2840,11 @@ function mapGhError(error) {
2805
2840
  retryAfterMsOf(error.stderr)
2806
2841
  );
2807
2842
  }
2808
- return new TrackerError("fetch-failed", `\u8BFB\u53D6\u5DE5\u5355\u5931\u8D25\uFF1A${commandFailureDetail(error)}`, {
2843
+ return new TrackerError("fetch-failed", `\u64CD\u4F5C\u5DE5\u5355\u5931\u8D25\uFF1A${commandFailureDetail(error)}`, {
2809
2844
  cause: error
2810
2845
  });
2811
2846
  }
2812
- return new TrackerError("fetch-failed", "\u8BFB\u53D6\u5DE5\u5355\u5931\u8D25\u3002", { cause: error });
2847
+ return new TrackerError("fetch-failed", "\u64CD\u4F5C\u5DE5\u5355\u5931\u8D25\u3002", { cause: error });
2813
2848
  }
2814
2849
  function isAuthenticationFailure(stderr) {
2815
2850
  return /gh auth login|not logged in|authentication failed|bad credentials|HTTP 401|requires authentication/i.test(
@@ -2913,6 +2948,19 @@ async function applyGithubChanges(deps, workspaceRoot, reference, patch) {
2913
2948
  const repository = await readRepository2(deps.run, workspaceRoot);
2914
2949
  const repoArgs = ["--repo", repositoryLabel(repository)];
2915
2950
  const current = await readDetailWithRepository(deps, workspaceRoot, repository, reference);
2951
+ const editArgs = [];
2952
+ if (patch.title !== void 0) editArgs.push("--title", patch.title);
2953
+ if (patch.body !== void 0) editArgs.push("--body-file", "-");
2954
+ if (editArgs.length > 0) {
2955
+ await editIssue(
2956
+ deps.run,
2957
+ workspaceRoot,
2958
+ number,
2959
+ repoArgs,
2960
+ editArgs,
2961
+ patch.body === void 0 ? void 0 : { stdin: patch.body }
2962
+ );
2963
+ }
2916
2964
  if (patch.labels !== void 0) {
2917
2965
  const diff = planSetChange(current.labels, patch.labels);
2918
2966
  await editIssue(deps.run, workspaceRoot, number, repoArgs, [
@@ -2938,13 +2986,28 @@ function assigneeChange(current, patch) {
2938
2986
  }
2939
2987
  return planSetChange(current, patch.assignees, patch.assignSelf === true ? "@me" : null);
2940
2988
  }
2941
- async function editIssue(run, workspaceRoot, number, repoArgs, flags) {
2989
+ async function createGithubComment(deps, workspaceRoot, reference, body) {
2990
+ const number = requireTicketNumber(reference);
2991
+ const repository = await readRepository2(deps.run, workspaceRoot);
2992
+ await callGhDetail(
2993
+ deps.run,
2994
+ workspaceRoot,
2995
+ ["issue", "comment", String(number), "--body-file", "-", "--repo", repositoryLabel(repository)],
2996
+ { stdin: body }
2997
+ );
2998
+ }
2999
+ async function editIssue(run, workspaceRoot, number, repoArgs, flags, options) {
2942
3000
  if (flags.length === 0) return;
2943
- await callGhDetail(run, workspaceRoot, ["issue", "edit", String(number), ...flags, ...repoArgs]);
3001
+ await callGhDetail(
3002
+ run,
3003
+ workspaceRoot,
3004
+ ["issue", "edit", String(number), ...flags, ...repoArgs],
3005
+ options
3006
+ );
2944
3007
  }
2945
- async function callGhDetail(run, workspaceRoot, args) {
3008
+ async function callGhDetail(run, workspaceRoot, args, options) {
2946
3009
  try {
2947
- return await callGh(run, workspaceRoot, args);
3010
+ return await callGh(run, workspaceRoot, args, options);
2948
3011
  } catch (error) {
2949
3012
  if (error instanceof TrackerError && error.cause instanceof CommandError && NOT_FOUND5.test(error.cause.stderr)) {
2950
3013
  throw new TrackerError("ticket-not-found", "\u627E\u4E0D\u5230\u8FD9\u5F20\u5DE5\u5355\uFF0C\u5B83\u53EF\u80FD\u5DF2\u88AB\u5220\u9664\u3002", {
@@ -2993,6 +3056,7 @@ function readComments2(value) {
2993
3056
  const body = typeof entry.body === "string" ? entry.body : "";
2994
3057
  if (body.length === 0) continue;
2995
3058
  comments.push({
3059
+ id: readOptionalString(entry.id),
2996
3060
  author: isRecord(entry.author) ? readOptionalString(entry.author.login) : null,
2997
3061
  body,
2998
3062
  createdAt: readOptionalString(entry.createdAt)
@@ -3337,6 +3401,7 @@ function createGithubTracker(deps) {
3337
3401
  },
3338
3402
  fetchDetail: (workspaceRoot, reference) => readGithubDetail(deps, workspaceRoot, reference),
3339
3403
  updateTicket: (workspaceRoot, reference, patch) => applyGithubChanges(deps, workspaceRoot, reference, patch),
3404
+ createComment: (workspaceRoot, reference, body) => createGithubComment(deps, workspaceRoot, reference, body),
3340
3405
  fetchOptions: (workspaceRoot) => readGithubOptions(deps, workspaceRoot),
3341
3406
  canDeleteTickets: (workspaceRoot) => readGithubDeletePermission(deps, workspaceRoot),
3342
3407
  deleteTicket: (workspaceRoot, reference) => deleteGithubTicket(deps, workspaceRoot, reference)
@@ -3465,9 +3530,9 @@ async function callGlabApi(run, workspaceRoot, endpoint) {
3465
3530
  async function callGlabApiInclude(run, workspaceRoot, endpoint) {
3466
3531
  return callGlab(run, workspaceRoot, ["api", "--include", endpoint]);
3467
3532
  }
3468
- async function callGlab(run, workspaceRoot, args) {
3533
+ async function callGlab(run, workspaceRoot, args, options) {
3469
3534
  try {
3470
- return (await run("glab", args, { cwd: workspaceRoot })).stdout;
3535
+ return (await run("glab", args, { cwd: workspaceRoot, ...options })).stdout;
3471
3536
  } catch (error) {
3472
3537
  throw mapGlabError(error);
3473
3538
  }
@@ -3493,13 +3558,13 @@ function mapGlabError(error) {
3493
3558
  }
3494
3559
  return new TrackerError(
3495
3560
  "fetch-failed",
3496
- `\u8BFB\u53D6 GitLab \u5DE5\u5355\u5931\u8D25\uFF1A${commandFailureDetail(error)}`,
3561
+ `\u64CD\u4F5C GitLab \u5DE5\u5355\u5931\u8D25\uFF1A${commandFailureDetail(error)}`,
3497
3562
  {
3498
3563
  cause: error
3499
3564
  }
3500
3565
  );
3501
3566
  }
3502
- return new TrackerError("fetch-failed", "\u8BFB\u53D6 GitLab \u5DE5\u5355\u5931\u8D25\u3002", { cause: error });
3567
+ return new TrackerError("fetch-failed", "\u64CD\u4F5C GitLab \u5DE5\u5355\u5931\u8D25\u3002", { cause: error });
3503
3568
  }
3504
3569
  function isAuthenticationFailure2(stderr) {
3505
3570
  return /glab auth login|not logged in|no token|token.*(?:expired|invalid)|authentication failed|bad credentials|HTTP 401|Unauthorized/i.test(
@@ -3668,6 +3733,17 @@ async function applyGitlabChanges(deps, workspaceRoot, reference, patch) {
3668
3733
  const iid = requireTicketNumber(reference);
3669
3734
  const project = await readProjectPath(deps.run, workspaceRoot);
3670
3735
  const current = await readIssue2(deps, workspaceRoot, project, iid);
3736
+ const editArgs = [];
3737
+ if (patch.title !== void 0) editArgs.push("--title", patch.title);
3738
+ if (patch.body !== void 0) editArgs.push("--description-file", "-");
3739
+ if (editArgs.length > 0) {
3740
+ await callGlab(
3741
+ deps.run,
3742
+ workspaceRoot,
3743
+ ["issue", "update", String(iid), ...editArgs],
3744
+ patch.body === void 0 ? void 0 : { stdin: patch.body }
3745
+ );
3746
+ }
3671
3747
  if (patch.labels !== void 0) {
3672
3748
  const diff = planSetChange(current.labels, patch.labels);
3673
3749
  if (!isEmptyDiff(diff)) {
@@ -3692,6 +3768,14 @@ async function applyGitlabChanges(deps, workspaceRoot, reference, patch) {
3692
3768
  ]);
3693
3769
  }
3694
3770
  }
3771
+ async function createGitlabComment(deps, workspaceRoot, reference, body) {
3772
+ const iid = requireTicketNumber(reference);
3773
+ const project = await readProjectPath(deps.run, workspaceRoot);
3774
+ const endpoint = `${projectEndpoint(project)}/issues/${String(iid)}/notes`;
3775
+ await callGlab(deps.run, workspaceRoot, ["api", "--method", "POST", endpoint, "--input", "-"], {
3776
+ stdin: JSON.stringify({ body })
3777
+ });
3778
+ }
3695
3779
  async function updateAssignees(deps, workspaceRoot, iid, current, patch, self) {
3696
3780
  const target = resolveTargetSet(current, patch.assignees, self);
3697
3781
  const assigneeArgs = target.length > 0 ? ["--assignee", target.join(",")] : current.flatMap((username) => ["--assignee", `!${username}`]);
@@ -3771,6 +3855,7 @@ function parseNotesPage(output) {
3771
3855
  const body = typeof note.body === "string" ? note.body : "";
3772
3856
  if (body.length === 0) continue;
3773
3857
  comments.push({
3858
+ id: typeof note.id === "number" ? String(note.id) : null,
3774
3859
  author: isRecord(note.author) ? readOptionalString(note.author.username) : null,
3775
3860
  body,
3776
3861
  createdAt: readOptionalString(note.created_at)
@@ -4006,6 +4091,7 @@ function createGitlabTracker(deps) {
4006
4091
  },
4007
4092
  fetchDetail: (workspaceRoot, reference) => readGitlabDetail(detailDeps, workspaceRoot, reference),
4008
4093
  updateTicket: (workspaceRoot, reference, patch) => applyGitlabChanges(detailDeps, workspaceRoot, reference, patch),
4094
+ createComment: (workspaceRoot, reference, body) => createGitlabComment(detailDeps, workspaceRoot, reference, body),
4009
4095
  fetchOptions: (workspaceRoot) => readGitlabOptions(detailDeps, workspaceRoot),
4010
4096
  canDeleteTickets: (workspaceRoot) => readGitlabDeletePermission(deps, workspaceRoot),
4011
4097
  deleteTicket: (workspaceRoot, reference) => deleteGitlabTicket(deps, workspaceRoot, reference),
@@ -4289,6 +4375,7 @@ async function readMarkdownDetail(deps, workspaceRoot, reference) {
4289
4375
  labels: markdownLabels(content),
4290
4376
  assignees: [],
4291
4377
  comments: parsed.comments.map((body) => ({
4378
+ id: null,
4292
4379
  author: null,
4293
4380
  body,
4294
4381
  createdAt: null
@@ -4711,6 +4798,7 @@ var SNAPSHOT_STAGES = {
4711
4798
  var TICKET_ACTIONS = {
4712
4799
  get: "get",
4713
4800
  update: "update",
4801
+ comment: "comment",
4714
4802
  options: "options",
4715
4803
  delete: "delete",
4716
4804
  attachment: "attachment"
@@ -6408,6 +6496,8 @@ var BACKEND_LABELS = {
6408
6496
 
6409
6497
  // src/host/ticket-service.ts
6410
6498
  var PATCH_KEYS = {
6499
+ title: true,
6500
+ body: true,
6411
6501
  labels: true,
6412
6502
  assignees: true,
6413
6503
  assignSelf: true,
@@ -6418,6 +6508,7 @@ function createTicketService(deps) {
6418
6508
  handle(method, params) {
6419
6509
  if (method === RPC_METHODS.ticketGet) return getDetail(deps, params);
6420
6510
  if (method === RPC_METHODS.ticketUpdate) return update(deps, params);
6511
+ if (method === RPC_METHODS.ticketComment) return comment(deps, params);
6421
6512
  if (method === RPC_METHODS.ticketOptions) return readOptions(deps, params);
6422
6513
  if (method === RPC_METHODS.ticketDelete) return remove(deps, params);
6423
6514
  if (method === RPC_METHODS.ticketAttachment) return readAttachment(deps, params);
@@ -6489,6 +6580,36 @@ async function update(deps, params) {
6489
6580
  return failure3(mapped.code, mapped.message);
6490
6581
  }
6491
6582
  }
6583
+ async function comment(deps, params) {
6584
+ const target = readTicketParams(params);
6585
+ if (target === void 0) {
6586
+ return failure3(ERROR_CODES.invalidParams, "\u7F3A\u5C11 workspaceRoot\u3001ref \u6216 number \u53C2\u6570\u3002");
6587
+ }
6588
+ const body = readField(params, "body");
6589
+ if (typeof body !== "string" || body.trim().length === 0) {
6590
+ return failure3(ERROR_CODES.invalidParams, "\u8BC4\u8BBA\u6B63\u6587\u4E0D\u80FD\u4E3A\u7A7A\u3002");
6591
+ }
6592
+ const startedAt = deps.now();
6593
+ let kind;
6594
+ try {
6595
+ const resolved = await deps.resolve(target.workspaceRoot);
6596
+ kind = resolved.kind;
6597
+ const createComment = resolved.tracker.createComment;
6598
+ if (createComment === void 0) {
6599
+ return unsupported(kind, "\u53D1\u8868\u8BC4\u8BBA");
6600
+ }
6601
+ if (target.repository !== void 0) {
6602
+ return unsupported(kind, "\u5728\u8DE8\u4ED3\u5E93\u5DE5\u5355\u4E0A\u53D1\u8868\u8BC4\u8BBA");
6603
+ }
6604
+ await createComment(target.workspaceRoot, referenceOf(target), body);
6605
+ logResult(deps, "info", kind, "comment", startedAt);
6606
+ return { ok: true, result: { created: true } };
6607
+ } catch (error) {
6608
+ const mapped = mapError(error);
6609
+ logResult(deps, "warn", kind, "comment", startedAt, mapped.code);
6610
+ return failure3(mapped.code, mapped.message);
6611
+ }
6612
+ }
6492
6613
  async function readOptions(deps, params) {
6493
6614
  const workspaceRoot = readWorkspaceRoot2(params);
6494
6615
  if (workspaceRoot === void 0) {
@@ -6577,9 +6698,10 @@ async function readAttachment(deps, params) {
6577
6698
  async function syncCachedTicket(deps, workspaceRoot, ref, patch) {
6578
6699
  const store = deps.store;
6579
6700
  if (store === void 0) return;
6580
- if (patch.labels === void 0 && patch.state === void 0) return;
6701
+ if (patch.title === void 0 && patch.labels === void 0 && patch.state === void 0) return;
6581
6702
  try {
6582
6703
  await store.patchTicket(workspaceRoot, ref, {
6704
+ ...patch.title === void 0 ? {} : { title: patch.title },
6583
6705
  ...patch.labels === void 0 ? {} : { labels: patch.labels },
6584
6706
  ...patch.state === void 0 ? {} : { state: patch.state }
6585
6707
  });
@@ -6596,7 +6718,11 @@ async function removeCachedTicket(deps, workspaceRoot, ref) {
6596
6718
  }
6597
6719
  function withCapabilities(kind, tracker, detail, canDelete, readOnly) {
6598
6720
  const writable = !readOnly && tracker.updateTicket !== void 0;
6721
+ const commentable = !readOnly && tracker.createComment !== void 0;
6599
6722
  const capabilities = {
6723
+ title: writable,
6724
+ body: writable,
6725
+ comment: commentable,
6600
6726
  labels: writable,
6601
6727
  assignees: writable,
6602
6728
  state: writable,
@@ -6617,6 +6743,14 @@ function readPatch(value) {
6617
6743
  if (!isRecord(value)) return void 0;
6618
6744
  if (Object.keys(value).some((key) => !Object.hasOwn(PATCH_KEYS, key))) return void 0;
6619
6745
  const patch = {};
6746
+ if ("title" in value) {
6747
+ if (typeof value.title !== "string" || value.title.trim().length === 0) return void 0;
6748
+ patch.title = value.title;
6749
+ }
6750
+ if ("body" in value) {
6751
+ if (typeof value.body !== "string") return void 0;
6752
+ patch.body = value.body;
6753
+ }
6620
6754
  if ("labels" in value) {
6621
6755
  const labels = readNames(value.labels);
6622
6756
  if (labels === void 0) return void 0;
@@ -6686,6 +6820,9 @@ function failure3(code, message) {
6686
6820
  }
6687
6821
 
6688
6822
  // src/host/subprocess-runner.ts
6823
+ import { mkdtemp, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
6824
+ import { tmpdir as tmpdir2 } from "node:os";
6825
+ import { join as join3 } from "node:path";
6689
6826
  var STDOUT_LIMIT_BYTES = 8 * 1024 * 1024;
6690
6827
  var STDERR_LIMIT_BYTES = 256 * 1024;
6691
6828
  var COMMAND_TIMEOUT_MS = 3e4;
@@ -6697,6 +6834,8 @@ var EXECUTABLE_FALLBACKS = {
6697
6834
  sh: ["/bin/sh"]
6698
6835
  };
6699
6836
  var BASE64_PIPE_SCRIPT = '(set -o pipefail) 2>/dev/null && set -o pipefail; "$@" | base64';
6837
+ var STDIN_SCRIPT = '(set -o pipefail) 2>/dev/null && set -o pipefail; "$@" < "$0"';
6838
+ var STDIN_BASE64_SCRIPT = '(set -o pipefail) 2>/dev/null && set -o pipefail; "$@" < "$0" | base64';
6700
6839
  var QUIET_CLI_ENV = {
6701
6840
  GLAB_SEND_TELEMETRY: "false",
6702
6841
  GLAB_CHECK_UPDATE: "false"
@@ -6705,19 +6844,35 @@ function createCommandRunner(subprocess, timer) {
6705
6844
  return async (command, args, options) => {
6706
6845
  const executable = await resolveExecutable(subprocess, command);
6707
6846
  const base64 = options?.stdout === "base64";
6708
- const argv = base64 ? [
6709
- await resolveExecutable(subprocess, "sh"),
6710
- "-c",
6711
- BASE64_PIPE_SCRIPT,
6712
- "sh",
6713
- executable,
6714
- ...args
6715
- ] : [executable, ...args];
6716
6847
  const abort = new AbortController();
6717
6848
  const disposeTimeout = timer.timeout(() => {
6718
6849
  abort.abort();
6719
6850
  }, COMMAND_TIMEOUT_MS);
6851
+ let stdinDir;
6720
6852
  try {
6853
+ let argv;
6854
+ if (options?.stdin === void 0) {
6855
+ argv = base64 ? [
6856
+ await resolveExecutable(subprocess, "sh"),
6857
+ "-c",
6858
+ BASE64_PIPE_SCRIPT,
6859
+ "sh",
6860
+ executable,
6861
+ ...args
6862
+ ] : [executable, ...args];
6863
+ } else {
6864
+ stdinDir = await mkdtemp(join3(tmpdir2(), "dsh-mattpocock-workflow-"));
6865
+ const stdinPath = join3(stdinDir, "stdin.txt");
6866
+ await writeFile2(stdinPath, options.stdin, "utf8");
6867
+ argv = [
6868
+ await resolveExecutable(subprocess, "sh"),
6869
+ "-c",
6870
+ base64 ? STDIN_BASE64_SCRIPT : STDIN_SCRIPT,
6871
+ stdinPath,
6872
+ executable,
6873
+ ...args
6874
+ ];
6875
+ }
6721
6876
  const handle = subprocess.spawn({
6722
6877
  argv,
6723
6878
  cwd: options?.cwd ?? process.cwd(),
@@ -6742,6 +6897,9 @@ function createCommandRunner(subprocess, timer) {
6742
6897
  return { stdout, stderr, executable };
6743
6898
  } finally {
6744
6899
  disposeTimeout();
6900
+ if (stdinDir !== void 0) {
6901
+ await rm2(stdinDir, { recursive: true, force: true }).catch(() => void 0);
6902
+ }
6745
6903
  }
6746
6904
  };
6747
6905
  }
@@ -6812,6 +6970,11 @@ var INTAKE_COMMANDS = {
6812
6970
  nextSteps: ["triage", "toSpec", "grillWithDocs", "wayfinder"]
6813
6971
  }
6814
6972
  };
6973
+ var MANUAL_SKILLS = {
6974
+ research: { name: PANEL_SKILLS.research },
6975
+ codebaseDesign: { name: PANEL_SKILLS.codebaseDesign },
6976
+ prototype: { name: PANEL_SKILLS.prototype }
6977
+ };
6815
6978
 
6816
6979
  // src/host/workflow-commands.ts
6817
6980
  var INTAKE_COPY = {
@@ -7051,9 +7214,7 @@ function createRpcHandler(scope, run, timer, log) {
7051
7214
  if (method === RPC_METHODS.envCheck) return envCheck.handle(method, params);
7052
7215
  if (method === RPC_METHODS.snapshotCache) return snapshot.cache(params);
7053
7216
  if (method === RPC_METHODS.snapshotRefresh) return snapshot.refresh(params);
7054
- if (method === RPC_METHODS.ticketGet || method === RPC_METHODS.ticketUpdate || method === RPC_METHODS.ticketOptions || method === RPC_METHODS.ticketDelete || method === RPC_METHODS.ticketAttachment) {
7055
- return ticket.handle(method, params);
7056
- }
7217
+ if (method.startsWith("ticket.")) return ticket.handle(method, params);
7057
7218
  return snapshot.handle(method, params);
7058
7219
  }
7059
7220
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnzgray/dsh-mattpocock-workflow",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "在 DSH 里运行 mattpocock/skills 工作流的 MattWorkflow 任务面板插件。",
5
5
  "license": "MIT",
6
6
  "type": "module",