opencode-pilot 0.18.2 → 0.18.3

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/AGENTS.md CHANGED
@@ -61,13 +61,14 @@ npx opencode-pilot status
61
61
 
62
62
  ## Configuration
63
63
 
64
- Config file: `~/.config/opencode-pilot/config.yaml`
64
+ Config file: `~/.config/opencode/pilot/config.yaml`
65
65
 
66
66
  Configuration has these sections:
67
- - `tools` - field mappings for MCP servers
68
- - `sources` - polling sources with generic MCP tool references
69
- - `repos` - per-repository settings (use YAML anchors to share config)
67
+ - `defaults` - default values applied to all sources
68
+ - `repos_dir` - directory to auto-discover repos via git remotes
69
+ - `sources` - polling sources with presets, shorthand, or full MCP tool config
70
+ - `tools` - field mappings to normalize different MCP APIs
70
71
 
71
- Template files: `~/.config/opencode-pilot/templates/*.md`
72
+ Template files: `~/.config/opencode/pilot/templates/*.md`
72
73
 
73
74
  See [examples/config.yaml](examples/config.yaml) for a complete example.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-pilot",
3
- "version": "0.18.2",
3
+ "version": "0.18.3",
4
4
  "type": "module",
5
5
  "main": "plugin/index.js",
6
6
  "description": "Automation daemon for OpenCode - polls for work and spawns sessions",
package/service/poller.js CHANGED
@@ -379,9 +379,7 @@ export async function pollGenericSource(source, options = {}) {
379
379
  /**
380
380
  * Fetch issue comments using gh CLI
381
381
  *
382
- * The GitHub MCP server doesn't have a tool to list issue comments,
383
- * so we use gh CLI directly. This fetches the conversation thread
384
- * where bots like Linear post their comments.
382
+ * Fetches the conversation thread where bots like Linear post their comments.
385
383
  *
386
384
  * @param {string} owner - Repository owner
387
385
  * @param {string} repo - Repository name
@@ -409,19 +407,50 @@ async function fetchIssueCommentsViaCli(owner, repo, number, timeout) {
409
407
  }
410
408
  }
411
409
 
410
+ /**
411
+ * Fetch PR review comments using gh CLI
412
+ *
413
+ * Fetches inline code review comments on a PR.
414
+ *
415
+ * @param {string} owner - Repository owner
416
+ * @param {string} repo - Repository name
417
+ * @param {number} number - PR number
418
+ * @param {number} timeout - Timeout in ms
419
+ * @returns {Promise<Array>} Array of comment objects
420
+ */
421
+ async function fetchPrReviewCommentsViaCli(owner, repo, number, timeout) {
422
+ const { exec } = await import('child_process');
423
+ const { promisify } = await import('util');
424
+ const execAsync = promisify(exec);
425
+
426
+ try {
427
+ const { stdout } = await Promise.race([
428
+ execAsync(`gh api repos/${owner}/${repo}/pulls/${number}/comments`),
429
+ createTimeout(timeout, "gh api call for PR comments"),
430
+ ]);
431
+
432
+ const comments = JSON.parse(stdout);
433
+ return Array.isArray(comments) ? comments : [];
434
+ } catch (err) {
435
+ console.error(`[poller] Error fetching PR review comments via gh: ${err.message}`);
436
+ return [];
437
+ }
438
+ }
439
+
412
440
  /**
413
441
  * Fetch comments for a GitHub issue/PR and enrich the item
414
442
  *
415
- * Fetches BOTH types of comments:
416
- * 1. PR review comments (inline code comments) via MCP github_get_pull_request_comments
417
- * 2. Issue comments (conversation thread) via gh CLI
443
+ * Fetches BOTH types of comments using gh CLI:
444
+ * 1. PR review comments (inline code comments) via gh api pulls/{number}/comments
445
+ * 2. Issue comments (conversation thread) via gh api issues/{number}/comments
418
446
  *
419
- * This is necessary because bots like Linear post to issue comments, not PR review comments.
447
+ * This is necessary because:
448
+ * - Bots like Linear post to issue comments, not PR review comments
449
+ * - Human reviewers post inline feedback as PR review comments
420
450
  *
421
- * @param {object} item - Item with owner, repo_short, and number fields
451
+ * @param {object} item - Item with repository_full_name and number fields
422
452
  * @param {object} [options] - Options
423
453
  * @param {number} [options.timeout] - Timeout in ms (default: 30000)
424
- * @param {string} [options.opencodeConfigPath] - Path to opencode.json for MCP config
425
454
  * @returns {Promise<Array>} Array of comment objects (merged from both endpoints)
426
455
  */
427
456
  export async function fetchGitHubComments(item, options = {}) {
@@ -443,61 +472,20 @@ export async function fetchGitHubComments(item, options = {}) {
443
472
  return [];
444
473
  }
445
474
 
446
- let mcpConfig;
447
475
  try {
448
- mcpConfig = getMcpConfig("github", options.opencodeConfigPath);
449
- } catch {
450
- console.error("[poller] GitHub MCP not configured, cannot fetch comments");
451
- return [];
452
- }
453
-
454
- const client = new Client({ name: "opencode-pilot", version: "1.0.0" });
455
-
456
- try {
457
- const transport = await createTransport(mcpConfig);
458
-
459
- await Promise.race([
460
- client.connect(transport),
461
- createTimeout(timeout, "MCP connection for comments"),
462
- ]);
463
-
464
- // Fetch both PR review comments (via MCP) AND issue comments (via gh CLI) in parallel
465
- const [prCommentsResult, issueComments] = await Promise.all([
466
- // PR review comments via MCP (may not be available on all MCP servers)
467
- client.callTool({
468
- name: "github_get_pull_request_comments",
469
- arguments: { owner, repo, pull_number: number }
470
- }).catch(() => null), // Gracefully handle if tool doesn't exist
471
- // Issue comments via gh CLI (conversation thread where Linear bot posts)
476
+ // Fetch both PR review comments AND issue comments in parallel via gh CLI
477
+ const [prComments, issueComments] = await Promise.all([
478
+ // PR review comments (inline code comments from reviewers)
479
+ fetchPrReviewCommentsViaCli(owner, repo, number, timeout),
480
+ // Issue comments (conversation thread where Linear bot posts)
472
481
  fetchIssueCommentsViaCli(owner, repo, number, timeout),
473
482
  ]);
474
483
 
475
- // Parse PR review comments
476
- let prComments = [];
477
- const prText = prCommentsResult?.content?.[0]?.text;
478
- if (prText) {
479
- try {
480
- const parsed = JSON.parse(prText);
481
- prComments = Array.isArray(parsed) ? parsed : [];
482
- } catch {
483
- // Ignore parse errors
484
- }
485
- }
486
-
487
484
  // Return merged comments from both sources
488
485
  return [...prComments, ...issueComments];
489
486
  } catch (err) {
490
487
  console.error(`[poller] Error fetching comments: ${err.message}`);
491
488
  return [];
492
- } finally {
493
- try {
494
- await Promise.race([
495
- client.close(),
496
- new Promise(resolve => setTimeout(resolve, 3000)),
497
- ]);
498
- } catch {
499
- // Ignore close errors
500
- }
501
489
  }
502
490
  }
503
491