Roast Room is installed as a managed Git clone under ~/.my-ai-configuration/roast-room, shared by Claude and Codex. A personal launcher skill runs it from any folder, starts its live room when needed, and only runs when invoked by name (/roast-room, $roast-room). Codex now gets what was Claude-only before: the Caveman skill with a SessionStart hook that keeps it on, PreCompact and session-pointer hooks, execpolicy deny rules mirroring Claude's permissions.deny, and Impeccable's custom agents registered in ~/.codex/agents. The command-safety hook checks both shell dialects for Codex on Windows, where PowerShell text arrives as Bash, in both the PowerShell and Bash packages. Audit fixes: - command-safety blocks git checkout -- / restore / push --force / stash clear and find -delete, and treats heredoc bodies as text - removing a clone clears read-only Git files, git errors no longer abort the extension sync, and a lock left by a dead process is replaced - with-credential passes child flags such as -k or -d through unchanged and resolves commands from PATH - uninstall strips only owned hooks from settings.json and config.toml and keeps the selection while another client is installed; update keeps CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY; Bash merges write the same bytes as PowerShell - qmd no longer trusts a stale daemon.json after a lost start race and prunes collections of deleted repositories - Bash scripts avoid GNU-only find -printf Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
97 lines
7.5 KiB
PowerShell
97 lines
7.5 KiB
PowerShell
[CmdletBinding()]
|
|
param([switch]$Summary)
|
|
$ErrorActionPreference = 'Stop'
|
|
$root = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent
|
|
function Write-Host { param($Object) if (-not $Summary) { Microsoft.PowerShell.Utility\Write-Host $Object } }
|
|
. (Join-Path $root 'scripts/lib/plugins.ps1')
|
|
|
|
$script:answers = [System.Collections.Generic.Queue[string]]::new()
|
|
$script:answers.Enqueue('1')
|
|
$script:answers.Enqueue('2')
|
|
$script:answers.Enqueue('done')
|
|
function Read-Host { param($Prompt) $answers.Dequeue() }
|
|
|
|
$result = Read-PluginToggleSelection -Names @('A','B','C') -Checked @($true, $false, $true)
|
|
if ($result[0] -ne $false) { throw 'Toggling checked entry 1 must uncheck it.' }
|
|
if ($result[1] -ne $true) { throw 'Toggling unchecked entry 2 must check it.' }
|
|
if ($result[2] -ne $true) { throw 'Entry 3 was never toggled and must stay unchanged.' }
|
|
|
|
$script:answers.Enqueue('')
|
|
$confirmed = @(Read-PluginToggleSelection -Names @('A') -Checked @($true))
|
|
if ($confirmed.Count -ne 1 -or -not $confirmed[0]) { throw 'Enter must confirm without changing the selection.' }
|
|
function Test-PluginOutput {
|
|
param([string]$Mode)
|
|
Write-Output 'download progress'
|
|
Write-Output 'WARN test warning'
|
|
$global:LASTEXITCODE = if ($Mode -eq 'fail') { 7 } else { 0 }
|
|
}
|
|
$compact = @(Invoke-PluginCommand -Command Test-PluginOutput -Arguments @('success') -Summary)
|
|
if ($compact.Count -ne 1 -or $compact[0] -ne 'WARN test warning') { throw 'Plugin summary must retain warnings and suppress progress.' }
|
|
$detailed = @(Invoke-PluginCommand -Command Test-PluginOutput -Arguments @('success'))
|
|
if ($detailed.Count -ne 2 -or $detailed[0] -ne 'download progress') { throw 'Detailed output must retain progress.' }
|
|
$diagnostics = [System.Collections.Generic.List[string]]::new()
|
|
$failed = $false
|
|
$env:AI_CONFIG_VERBOSE = $null
|
|
try { Invoke-PluginCommand -Command Test-PluginOutput -Arguments @('fail') -Summary | ForEach-Object { $diagnostics.Add("$_") } }
|
|
catch { $failed = $true }
|
|
$env:AI_CONFIG_VERBOSE = $null
|
|
if (-not $failed -or $diagnostics -notcontains 'download progress' -or $diagnostics -notcontains 'WARN test warning') { throw 'Plugin failure must retain full diagnostics and fail.' }
|
|
$global:LASTEXITCODE = 0
|
|
$script:codexInventory = '{"installed":[{"pluginId":"ponytail@ponytail"},{"pluginId":"i-have-adhd@i-have-adhd"},{"pluginId":"superpowers@openai-curated-remote"},{"pluginId":"context7@context7-marketplace"}],"available":[]}'
|
|
function codex { $script:observedCodexHome = $env:CODEX_HOME; $script:observedProfile = $env:USERPROFILE; $script:codexInventory }
|
|
$testHome = Join-Path ([System.IO.Path]::GetTempPath()) 'ai-config-plugin-test-home'
|
|
$previousCodexHome = [Environment]::GetEnvironmentVariable('CODEX_HOME', 'Process')
|
|
$previousProfile = [Environment]::GetEnvironmentVariable('USERPROFILE', 'Process')
|
|
$null = Get-InstalledPlugins -Client Codex -HomePath $testHome
|
|
if ($observedCodexHome -ne (Join-Path $testHome '.codex') -or $observedProfile -ne $testHome) { throw 'Plugin inspection must use the requested user home.' }
|
|
if ([Environment]::GetEnvironmentVariable('CODEX_HOME', 'Process') -ne $previousCodexHome -or [Environment]::GetEnvironmentVariable('USERPROFILE', 'Process') -ne $previousProfile) { throw 'Plugin inspection must restore the process environment.' }
|
|
$script:answers.Enqueue('done')
|
|
$selection = Select-ConfiguredPlugins -RepositoryRoot (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -Client Codex -Mode Update
|
|
if (@($selection.Selected | Where-Object { $_.codex_method -eq 'plugin' }).Count -ne 4) { throw 'All installed Codex plugins must start checked when updating.' }
|
|
if (@($selection.Selected + $selection.Deselected | Where-Object { $_.name -in @('Caveman', 'Roast Room') }).Count -ne 2) { throw 'Caveman and Roast Room must be offered for Codex too.' }
|
|
$script:answers.Enqueue('4')
|
|
$script:answers.Enqueue('done')
|
|
$selection = Select-ConfiguredPlugins -RepositoryRoot (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -Client Codex -Mode Update
|
|
if (@($selection.Deselected | Where-Object { $_.name -eq 'Context7' }).Count -ne 1) { throw 'Only the explicitly unchecked installed plugin must be deselected.' }
|
|
$mcporterHome = Join-Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) ('.context7-test-' + [Guid]::NewGuid())
|
|
try {
|
|
$configPath = Join-Path $mcporterHome '.mcporter/mcporter.json'
|
|
New-Item (Split-Path $configPath) -ItemType Directory -Force | Out-Null
|
|
[System.IO.File]::WriteAllText($configPath, '{"mcpServers":{"context7":{"baseUrl":"https://mcp.context7.com/mcp"}}}')
|
|
$script:codexInventory = '{"installed":[],"available":[]}'
|
|
$script:answers.Enqueue('done')
|
|
$selection = Select-ConfiguredPlugins -RepositoryRoot $root -Client Codex -Mode Update -HomePath $mcporterHome
|
|
if (@($selection.Selected | Where-Object { $_.name -eq 'Context7' }).Count -ne 1) { throw 'MCPorter Context7 must start checked when updating.' }
|
|
[System.IO.File]::WriteAllText($configPath, '{"mcpServers":{"context7":{"baseUrl":"https://example.invalid/mcp"}}}')
|
|
$script:answers.Enqueue('done')
|
|
$selection = Select-ConfiguredPlugins -RepositoryRoot $root -Client Codex -Mode Update -HomePath $mcporterHome
|
|
if (@($selection.Deselected | Where-Object { $_.name -eq 'Context7' }).Count -ne 1) { throw 'A different MCPorter server must not select Context7.' }
|
|
} finally { Remove-Item -LiteralPath $mcporterHome -Recurse -Force -ErrorAction SilentlyContinue }
|
|
$npmPrefix = Join-Path $root ('.npm-test-' + [Guid]::NewGuid())
|
|
$cliName = 'ai-config-test-cli-' + [Guid]::NewGuid().ToString('N')
|
|
try {
|
|
New-Item (Join-Path $npmPrefix 'bin') -ItemType Directory -Force | Out-Null
|
|
function npm { $npmPrefix }
|
|
if (Test-CliCommand -Name $cliName) { throw 'A missing CLI must not be detected.' }
|
|
New-Item (Join-Path $npmPrefix "$cliName.cmd") -ItemType File | Out-Null
|
|
New-Item (Join-Path $npmPrefix "bin/$cliName") -ItemType File | Out-Null
|
|
if (-not (Test-CliCommand -Name $cliName)) { throw 'A CLI in the npm global prefix must be detected when it is not on PATH.' }
|
|
} finally {
|
|
Remove-Item function:npm -ErrorAction SilentlyContinue
|
|
Remove-Item -LiteralPath $npmPrefix -Recurse -Force -ErrorAction SilentlyContinue
|
|
}
|
|
$script:managedArguments = @()
|
|
function Invoke-Python { $script:managedArguments = @($args); $global:LASTEXITCODE = 0 }
|
|
$entry = [pscustomobject]@{ name = 'Test'; codex_method = 'plugin'; codex_marketplace = '-'; codex_plugin = 'test@market' }
|
|
Sync-ConfiguredPlugins -RepositoryRoot (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -Client Codex -HomePath $testHome -Update -Summary -Entries @($entry)
|
|
if ($managedArguments -notcontains 'sync' -or $managedArguments -notcontains '--update' -or $managedArguments -notcontains 'Test' -or $managedArguments -notcontains $testHome) { throw 'Managed reconciliation must receive selection, home, and update mode.' }
|
|
Sync-ConfiguredPlugins -RepositoryRoot (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -Client Codex -Entries @()
|
|
if ($managedArguments[-1] -ne '--selected') { throw 'Empty selection must reach reconciliation for managed cleanup.' }
|
|
function Get-InstalledPlugins { throw 'Empty selection must not query installed plugins.' }
|
|
function Invoke-PluginCommand { throw 'Empty selection must not run plugin commands.' }
|
|
Install-ConfiguredPlugins -RepositoryRoot (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -Client Both -Entries @()
|
|
Uninstall-DeselectedPlugins -Client Both -Entries @()
|
|
|
|
if ($Summary) { Write-Output 'Tests: PASS | plugin selection' } else { Write-Output 'PASS plugin toggle selection: toggle and confirm' }
|
|
exit 0
|