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 +4 -4
- data/lib/brainiac/plugins/github/handler.rb +19 -2
- data/lib/brainiac/plugins/github/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b4606ec0c07107e122e51570364e05d20db3d0717e7a6679cdff85471f38e0b5
|
|
4
|
+
data.tar.gz: 73ad18ee4563e0e55d56a1cab2f8f8714484d3fee3bbc1c3763ec1e2886221eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|