Add a copy-out button that formats a report as a pasteable issue

This commit is contained in:
Gmer4Lfe
2026-08-05 21:12:40 -04:00
parent 2f8af3a1b7
commit 657ee435d1
2 changed files with 60 additions and 0 deletions
+13
View File
@@ -824,10 +824,23 @@ function vv_ai_bug_write(string $component, string $summary, string $evidence, a
if ($component === '' || $summary === '' || $evidence === '') return ['ok' => false];
if (!vv_ai_scope_ok($component)) return ['ok' => false];
// The commit as it was when the fault was seen, not when the report is read. "Is this already
// fixed" is the first question any maintainer asks, and a version captured later answers a
// different question. Slot id (host1/host2) rather than the hostname — this text is written
// to be pasted into a public issue.
$commit = '';
$head = @file_get_contents(SCRIPTS_DIR . '/.git/HEAD');
if (is_string($head) && preg_match('#^ref:\s*(\S+)#', trim($head), $hm)) {
$commit = substr(trim((string)@file_get_contents(SCRIPTS_DIR . '/.git/' . $hm[1])), 0, 12);
} elseif (is_string($head)) {
$commit = substr(trim($head), 0, 12);
}
$rec = [
'component' => mb_substr($component, 0, 120),
'summary' => mb_substr($summary, 0, 300),
'evidence' => mb_substr($evidence, 0, 2000),
'commit' => $commit,
'host' => vv_detect_host(),
'first' => time(),
'last' => time(),