brainiac-github 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5541245a5dbeb29674e8d43c8cca5d63321f8c671b970e5bd240340839adfdc2
4
- data.tar.gz: 06f83b16e583224a4f174023435b1f9f674525ce1c48c45295a1fc4fcc204fc7
3
+ metadata.gz: b4606ec0c07107e122e51570364e05d20db3d0717e7a6679cdff85471f38e0b5
4
+ data.tar.gz: 73ad18ee4563e0e55d56a1cab2f8f8714484d3fee3bbc1c3763ec1e2886221eb
5
5
  SHA512:
6
- metadata.gz: 9d603efcbea95b3ce87d8d5675bf5e1590cc6ef813a4946cdec89ac6d890e0bc9bceffd13db64be35c454ed08664b5e5bb82c2977523c09ddd5296c60e00eea8
7
- data.tar.gz: c642f3900281f2fcf4ca0134e5153347ea1feefc1805a4bfda2ac740c508e74c34de7997a8e14b77f645dfaa5639bb93437814b04e1e6e94137ff1d597dea767
6
+ metadata.gz: 9c7240c8f7a3a1b57e72bc6245a50d7089c82736e6e0259c2944ca623fbb6839f564064b75788c3b8fc60489393b0fdc65ff932410da878b2bb19bc16327c801
7
+ data.tar.gz: 05405f8388fe9c817d4c2b59edde95f5ac6819112fa1f30f24d486a35a37c2dd417aad3f0c17f760e237f1d54681508e436cd1820f6b56eea5a1fc6ec77d1e96
@@ -301,13 +301,15 @@ module Brainiac
301
301
  project_key: project_key, comment_body: comment_body),
302
302
  agent_name: agent_name, channel: :github)
303
303
 
304
+ intent_ctx = fetch_pr_intent_context(pr_number, repo_name)
304
305
  pid, log_file = run_agent(prompt, project_config: project_config, chdir: worktree,
305
306
  log_name: "pr-comment-#{pr_number}",
306
307
  model: detect_model(project_config, text: comment_body),
307
308
  effort: detect_effort(project_config, text: comment_body),
308
309
  agent_name: agent_name, source: :github,
309
310
  source_context: { pr_number: pr_number, repo_name: repo_name, work_dir: worktree },
310
- message: comment_body, channel: "GitHub PR comment")
311
+ message: comment_body, channel: "GitHub PR comment",
312
+ context: intent_ctx)
311
313
  return unless pid
312
314
 
313
315
  register_session(card_key, pid, log_file: log_file, agent_name: agent_name)
@@ -345,7 +347,8 @@ module Brainiac
345
347
  agent_name: agent_name,
346
348
  source: :github,
347
349
  source_context: { pr_number: pr_number, repo_name: repo_name, work_dir: work_dir },
348
- message: review["body"], channel: "GitHub PR review")
350
+ message: review["body"], channel: "GitHub PR review",
351
+ context: fetch_pr_intent_context(pr_number, repo_name))
349
352
  return unless pid
350
353
 
351
354
  register_session(card_key, pid, log_file: log_file, agent_name: agent_name)
@@ -375,6 +378,20 @@ module Brainiac
375
378
  []
376
379
  end
377
380
 
381
+ # Lightweight recent PR comment context for intent classification.
382
+ # Returns "author: message" format (last 5 issue comments on the PR).
383
+ def fetch_pr_intent_context(pr_number, repo_name)
384
+ output = run_cmd("gh", "api", "/repos/#{repo_name}/issues/#{pr_number}/comments",
385
+ "--jq", ".[-5:] | .[] | \"\\(.user.login): \\(.body[0:200])\"",
386
+ chdir: PROJECTS.values.first&.dig("repo_path") || Dir.pwd)
387
+ return nil if output.strip.empty?
388
+
389
+ output.strip
390
+ rescue StandardError => e
391
+ LOG.warn "[GitHub] Could not fetch intent context for PR ##{pr_number}: #{e.message}" if defined?(LOG)
392
+ nil
393
+ end
394
+
378
395
  def close_uat_cards_after_deploy(project_key, project_config)
379
396
  results = Brainiac.emit(:production_deployed, project_key: project_key, project_config: project_config)
380
397
  closed_cards = results.flatten.compact
@@ -3,7 +3,7 @@
3
3
  module Brainiac
4
4
  module Plugins
5
5
  module Github
6
- VERSION = "0.0.5"
6
+ VERSION = "0.0.6"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brainiac-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Davis