Skip to content

Instantly share code, notes, and snippets.

@dfinke
Created September 14, 2024 23:10
Show Gist options
  • Save dfinke/44098867413bff4926aa3fa6b5ebce22 to your computer and use it in GitHub Desktop.
Save dfinke/44098867413bff4926aa3fa6b5ebce22 to your computer and use it in GitHub Desktop.
PowerShell script lists recent files; AI analyzes your work—instantly see what you've accomplished!
param(
$daysOld = 7
)
$targetDir = $(
'D:\mygit\GPTIdeas\Experiments\Livestream-GPT\'
'D:\mygit\PowerShellAIAssistant-ScratchPad'
'D:\mygit\PSAI'
'D:\mygit\PSAIAgent-Stealth-2\'
'D:\temp\Camtasia\scratch\'
'D:\mygit\dfinke.github.io\'
'D:\mygit\\PSAIAgent-Custom\'
)
$ts = Get-Date -Format 'yyyyMMdd-HHmmss'
$xlFile = "$PSScriptRoot\WorkSummary-$ts.xlsx"
$mdFile = "$PSScriptRoot\WorkSummary-$ts.md"
Remove-Item $xlFile -ErrorAction SilentlyContinue
$summary = $targetDir | Get-WhatIWorkedOn -DaysOld $daysOld -Directory
$summary | Export-Excel -Path $xlFile -AutoSize -WorksheetName Summary -AutoFilter -TableName Summary
$allFilesWorkedOn = @()
foreach ($dir in $targetDir | Sort-Object) {
$sheetName = Split-Path $dir -Leaf
$details = Get-WhatIWorkedOn $dir -DaysOld $daysOld -File
$allFilesWorkedOn += $details
if ($details.Count -eq 0) {
$details = [pscustomobject]@{
DaysOld = $daysOld
FullName = "No files found"
LastWriteTime = (Get-Date)
}
}
$details | Export-Excel -Path $xlFile -AutoSize -WorksheetName $sheetName -AutoFilter -TableName $sheetName
}
$instructions = @"
you are a ars technica journalist, write a summary about the files worked on, the names of the files are a good indication of what was worked on. Look at files worked in the similar time framem, see if you can distill a connection if possible. make recommendations for future work.
"@
$AISummary = New-Agent -Instructions $instructions | Get-AgentResponse ($allFilesWorkedOn | Out-String)
$AISummary | Set-Content $mdFile
Invoke-Item $xlFile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment