File tree Expand file tree Collapse file tree
plugins/boostdba/.github/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,11 +11,44 @@ Set-Location $root
1111
1212$jsonLog = ' .github/reports/token-usage-history.json'
1313
14- powershell - ExecutionPolicy Bypass - File .github/ scripts/ token- usage- report.ps1 `
14+ function Get-LatestCopilotTranscript {
15+ $roots = @ ()
16+
17+ if (-not [string ]::IsNullOrWhiteSpace($env: APPDATA )) {
18+ $roots += (Join-Path $env: APPDATA ' Code\User\workspaceStorage' )
19+ }
20+ if (-not [string ]::IsNullOrWhiteSpace($env: HOME )) {
21+ $roots += (Join-Path $env: HOME ' .config/Code/User/workspaceStorage' )
22+ }
23+
24+ $roots = @ ($roots | Where-Object { -not [string ]::IsNullOrWhiteSpace($_ ) -and (Test-Path $_ ) } | Select-Object - Unique)
25+ foreach ($workspaceRoot in $roots ) {
26+ $latest = Get-ChildItem - Path $workspaceRoot - Recurse - File - Filter ' *.jsonl' - ErrorAction SilentlyContinue |
27+ Where-Object { $_.FullName -match ' GitHub\.copilot-chat[\\/]transcripts' } |
28+ Sort-Object LastWriteTime - Descending |
29+ Select-Object - First 1
30+
31+ if ($latest ) {
32+ return $latest.FullName
33+ }
34+ }
35+
36+ return $null
37+ }
38+
39+ $transcriptPath = Get-LatestCopilotTranscript
40+ if (-not $transcriptPath ) {
41+ Write-Output ' No Copilot transcript found. Skipping daily token close without failing.'
42+ exit 0
43+ }
44+
45+ & .github/ scripts/ token- usage- report.ps1 `
46+ - TranscriptPath $transcriptPath `
1547 - IncludeDebugLogs `
1648 - JsonPath $jsonLog `
1749 - AppendHistory `
1850 - AppendDailyAggregateMarkdown `
51+ - DailyCloseMode `
1952 - DailyAggregateMdPath " .github/reports/token-usage-daily-aggregate.md" `
2053 - ModelName $ModelName `
2154 - InputCostPer1M $InputCostPer1M `
Original file line number Diff line number Diff line change @@ -11,11 +11,44 @@ Set-Location $root
1111
1212$jsonLog = ' .github/reports/token-usage-history.json'
1313
14- powershell - ExecutionPolicy Bypass - File .github/ scripts/ token- usage- report.ps1 `
14+ function Get-LatestCopilotTranscript {
15+ $roots = @ ()
16+
17+ if (-not [string ]::IsNullOrWhiteSpace($env: APPDATA )) {
18+ $roots += (Join-Path $env: APPDATA ' Code\User\workspaceStorage' )
19+ }
20+ if (-not [string ]::IsNullOrWhiteSpace($env: HOME )) {
21+ $roots += (Join-Path $env: HOME ' .config/Code/User/workspaceStorage' )
22+ }
23+
24+ $roots = @ ($roots | Where-Object { -not [string ]::IsNullOrWhiteSpace($_ ) -and (Test-Path $_ ) } | Select-Object - Unique)
25+ foreach ($workspaceRoot in $roots ) {
26+ $latest = Get-ChildItem - Path $workspaceRoot - Recurse - File - Filter ' *.jsonl' - ErrorAction SilentlyContinue |
27+ Where-Object { $_.FullName -match ' GitHub\.copilot-chat[\\/]transcripts' } |
28+ Sort-Object LastWriteTime - Descending |
29+ Select-Object - First 1
30+
31+ if ($latest ) {
32+ return $latest.FullName
33+ }
34+ }
35+
36+ return $null
37+ }
38+
39+ $transcriptPath = Get-LatestCopilotTranscript
40+ if (-not $transcriptPath ) {
41+ Write-Output ' No Copilot transcript found. Skipping daily token close without failing.'
42+ exit 0
43+ }
44+
45+ & .github/ scripts/ token- usage- report.ps1 `
46+ - TranscriptPath $transcriptPath `
1547 - IncludeDebugLogs `
1648 - JsonPath $jsonLog `
1749 - AppendHistory `
1850 - AppendDailyAggregateMarkdown `
51+ - DailyCloseMode `
1952 - DailyAggregateMdPath " .github/reports/token-usage-daily-aggregate.md" `
2053 - ModelName $ModelName `
2154 - InputCostPer1M $InputCostPer1M `
You can’t perform that action at this time.
0 commit comments