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>
64 lines
2.8 KiB
Python
64 lines
2.8 KiB
Python
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
SCRIPTS = ROOT / 'shared/hooks/scripts'
|
|
SKILL = '---\nname: caveman\ndescription: Terse style.\n---\n\n# caveman\n\nRespond terse like smart caveman.\n'
|
|
|
|
|
|
def wrappers():
|
|
found = []
|
|
for name in ('pwsh', 'powershell'):
|
|
executable = shutil.which(name)
|
|
if executable:
|
|
found.append((name, [executable, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', str(SCRIPTS / 'Show-CavemanMode.ps1')]))
|
|
bash = shutil.which('bash')
|
|
if os.name == 'nt':
|
|
# System32\bash.exe is WSL; use Git Bash like the other Windows tests.
|
|
candidate = Path(os.environ.get('ProgramFiles', 'C:/Program Files')) / 'Git/bin/bash.exe'
|
|
bash = str(candidate) if candidate.exists() else None
|
|
if bash:
|
|
found.append(('bash', [bash, str(SCRIPTS / 'show-caveman-mode.sh')]))
|
|
return found
|
|
|
|
|
|
class CavemanHookTests(unittest.TestCase):
|
|
def run_hook(self, command, home, mode=None):
|
|
environment = dict(os.environ, HOME=str(home), USERPROFILE=str(home))
|
|
environment.pop('CAVEMAN_DEFAULT_MODE', None)
|
|
if mode:
|
|
environment['CAVEMAN_DEFAULT_MODE'] = mode
|
|
return subprocess.run(command, capture_output=True, encoding='utf-8', timeout=60, env=environment)
|
|
|
|
def test_prints_installed_skill_without_frontmatter_and_respects_off(self):
|
|
available = wrappers()
|
|
if not available:
|
|
self.skipTest('No supported shell is available.')
|
|
with tempfile.TemporaryDirectory() as directory:
|
|
home = Path(directory)
|
|
for name, command in available:
|
|
with self.subTest(shell=name, case='missing skill'):
|
|
result = self.run_hook(command, home)
|
|
self.assertEqual((0, ''), (result.returncode, result.stdout))
|
|
skill = home / '.agents/skills/caveman/SKILL.md'
|
|
skill.parent.mkdir(parents=True)
|
|
skill.write_text(SKILL, encoding='utf-8')
|
|
for name, command in available:
|
|
with self.subTest(shell=name, case='installed'):
|
|
result = self.run_hook(command, home)
|
|
self.assertEqual(0, result.returncode, result.stderr)
|
|
self.assertIn('CAVEMAN MODE ACTIVE (mode: caveman)', result.stdout)
|
|
self.assertIn('Respond terse like smart caveman.', result.stdout)
|
|
self.assertNotIn('description: Terse style.', result.stdout)
|
|
with self.subTest(shell=name, case='off'):
|
|
result = self.run_hook(command, home, 'off')
|
|
self.assertEqual((0, ''), (result.returncode, result.stdout))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|