fix(install): handle 8.3 source paths, bound plugin delegation, check skill contracts
Sync-ManagedDestination and Copy-Directory cut relative paths by the length of $Source. With an 8.3 short path such as JULIAN~1, Get-ChildItem returned long paths, so files landed under a truncated directory name. Both now expand $Source with Get-Item first. PowerShell tests now pass -ExecutionPolicy Bypass, tolerate non-UTF-8 console output, and give the Git Bash quick update 300 seconds. The orchestration rule now covers plugin workflows. A plugin default alone never authorizes subagents, per-task reviews stay proportional, parallel writers get disjoint files, and plugin agents keep to their specialty inside the shared handoff format. doctor warns when an installed Impeccable or Apple Design skill no longer names the commands and sections plugin-workflow relies on. Prompt budget baselines are refreshed to the current values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abc9ae8e1b
commit
b8b4438275
15 files changed
+146
-28
No files matched your search
@@ -243,7 +243,7 @@ class InstallOptionsTests(unittest.TestCase):
|
||||
environment = dict(os.environ, OPTION_SOURCE=str(source), OPTION_DESTINATION=str(destination))
|
||||
for enabled in (False, True):
|
||||
if kind == 'powershell':
|
||||
command = [executable, '-NoProfile', '-Command',
|
||||
command = [executable, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
|
||||
"$ErrorActionPreference='Stop'; . ./scripts/lib/manifest.ps1; "
|
||||
"Sync-ManagedDestination -Source $env:OPTION_SOURCE -Destination $env:OPTION_DESTINATION "
|
||||
"-Stamp test -AiConfigRoot root -ShellCommand bash -PowerShellCommand pwsh "
|
||||
@@ -254,7 +254,7 @@ class InstallOptionsTests(unittest.TestCase):
|
||||
'sync_managed_destination "$OPTION_SOURCE" "$OPTION_DESTINATION" test root bash pwsh false true '
|
||||
+ str(enabled).lower()]
|
||||
environment.update(OPTION_SOURCE=source.as_posix(), OPTION_DESTINATION=destination.as_posix())
|
||||
result = subprocess.run(command, cwd=ROOT, env=environment, capture_output=True, text=True, timeout=20)
|
||||
result = subprocess.run(command, cwd=ROOT, env=environment, capture_output=True, text=True, errors='replace', timeout=20)
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
installed = json.loads((destination / 'settings.json').read_text(encoding='utf-8-sig'))
|
||||
self.assertEqual('Stop' in installed['hooks'], enabled)
|
||||
@@ -315,11 +315,11 @@ class InstallOptionsTests(unittest.TestCase):
|
||||
environment = dict(os.environ, HOME=home.as_posix(), TEST_INSTALL_HOME=str(home))
|
||||
for name, quick, answers in [('install', False, 'n\nn\nn\n'), ('update', True, '')]:
|
||||
entry = str(commands / (name + '.' + suffix))
|
||||
command = ([executable, '-NoProfile', '-File', entry, '-Shell', 'Bash', '-Client', 'Both', '-Summary']
|
||||
command = ([executable, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', entry, '-Shell', 'Bash', '-Client', 'Both', '-Summary']
|
||||
if kind == 'powershell' else [executable, entry, '--shell', 'bash', '--client', 'both', '--summary'])
|
||||
if quick:
|
||||
command.append('-Quick' if kind == 'powershell' else '--quick')
|
||||
result = subprocess.run(command, env=environment, input=answers, capture_output=True, text=True, timeout=25)
|
||||
result = subprocess.run(command, env=environment, input=answers, capture_output=True, text=True, errors='replace', timeout=25)
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
self.assertNotIn('CLI-MOCK', result.stdout)
|
||||
if quick:
|
||||
|
||||
@@ -118,7 +118,7 @@ class PersonalInstructionTests(unittest.TestCase):
|
||||
def sync(client, dry=False):
|
||||
self.environment['TEST_CLIENT'] = client
|
||||
if shell == 'powershell':
|
||||
return self.run_command(str(executable), '-NoProfile', '-Command',
|
||||
return self.run_command(str(executable), '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
|
||||
". ./scripts/lib/manifest.ps1; Sync-ManagedDestination -Source $env:TEST_SOURCE "
|
||||
"-Destination (Join-Path $env:TEST_HOME ('.' + $env:TEST_CLIENT)) -Stamp test -Summary "
|
||||
+ ('-DryRun' if dry else ''))
|
||||
@@ -129,7 +129,7 @@ class PersonalInstructionTests(unittest.TestCase):
|
||||
|
||||
def change(action):
|
||||
if shell == 'powershell':
|
||||
self.run_command(str(executable), '-NoProfile', '-File', str(ROOT / f'scripts/commands/{action}-instruction.ps1'),
|
||||
self.run_command(str(executable), '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', str(ROOT / f'scripts/commands/{action}-instruction.ps1'),
|
||||
'-Client', 'Both', '-Instruction', 'Use English.', '-HomePath', str(self.home))
|
||||
else:
|
||||
self.run_command(str(executable), '-c',
|
||||
|
||||
@@ -114,7 +114,7 @@ class SelectionTests(unittest.TestCase):
|
||||
if not shell:
|
||||
self.skipTest('PowerShell unavailable')
|
||||
environment = dict(os.environ, TEST_SELECTION_HOME=str(self.home), TEST_REPOSITORY_ROOT=str(ROOT))
|
||||
save = subprocess.run([shell, '-NoProfile', '-Command',
|
||||
save = subprocess.run([shell, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
|
||||
"$ErrorActionPreference = 'Stop'; . (Join-Path $env:TEST_REPOSITORY_ROOT 'scripts/lib/selection-state.ps1'); "
|
||||
"Save-UpdateSelection -HomePath $env:TEST_SELECTION_HOME -RepositoryRoot $env:TEST_REPOSITORY_ROOT "
|
||||
"-Shell PowerShell -Client Both -Flashbang $false -StatusLine $false -Plugins @{ Selected = @([pscustomobject]@{name='Superpowers'}); Deselected = @() }"],
|
||||
@@ -128,15 +128,15 @@ class SelectionTests(unittest.TestCase):
|
||||
stream.write(source)
|
||||
entry = Path(stream.name)
|
||||
self.addCleanup(entry.unlink)
|
||||
result = subprocess.run([shell, '-NoProfile', '-File', str(entry), '-Quick', '-DryRun'],
|
||||
env=environment, stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=90)
|
||||
result = subprocess.run([shell, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', str(entry), '-Quick', '-DryRun'],
|
||||
env=environment, stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=300) # Git Bash on Windows needs ~3 min
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
self.assertNotIn('Select plugins', result.stdout)
|
||||
self.assertIn('DRYRUN ensure codex plugin: Superpowers', result.stdout)
|
||||
self.assertNotIn('DRYRUN ensure codex plugin: Context7', result.stdout)
|
||||
self.assertEqual(self.path.read_bytes(), original)
|
||||
self.assertFalse((self.home / '.codex').exists())
|
||||
failed = subprocess.run([shell, '-NoProfile', '-File', str(entry), '-Quick'], env=environment,
|
||||
failed = subprocess.run([shell, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', str(entry), '-Quick'], env=environment,
|
||||
stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=10)
|
||||
self.assertNotEqual(failed.returncode, 0)
|
||||
self.assertEqual(self.path.read_bytes(), original)
|
||||
@@ -158,7 +158,7 @@ class SelectionTests(unittest.TestCase):
|
||||
original = self.path.read_bytes()
|
||||
environment = dict(os.environ, HOME=self.home.as_posix())
|
||||
result = subprocess.run([shell, str(ROOT / 'scripts/commands/update.sh'), '--quick', '--dry-run'],
|
||||
env=environment, stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=90)
|
||||
env=environment, stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=300) # Git Bash on Windows needs ~3 min
|
||||
self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
|
||||
self.assertNotIn('Select plugins', result.stdout)
|
||||
self.assertIn('DRYRUN ensure codex plugin: Superpowers', result.stdout)
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
SPEC = importlib.util.spec_from_file_location('contracts', ROOT / 'scripts/lib/skill-contracts.py')
|
||||
CONTRACTS = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(CONTRACTS)
|
||||
|
||||
|
||||
class SkillContractTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
directory = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(directory.cleanup)
|
||||
self.home = Path(directory.name)
|
||||
|
||||
def write(self, relative, text):
|
||||
path = self.home / relative
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(text, encoding='utf-8')
|
||||
|
||||
def test_reports_nothing_when_skills_are_absent(self):
|
||||
self.assertEqual([], CONTRACTS.check(self.home))
|
||||
|
||||
def test_passes_complete_skill_and_warns_on_missing_names(self):
|
||||
self.write('.claude/skills/apple-design/SKILL.md', ' '.join(CONTRACTS.CONTRACTS['apple-design'][1]))
|
||||
self.write('.agents/skills/impeccable/SKILL.md', 'critique audit')
|
||||
results = dict((message.split(' at ')[0], status) for status, message in CONTRACTS.check(self.home))
|
||||
self.assertEqual({'Apple Design': 'PASS', 'Impeccable': 'WARN'}, results)
|
||||
|
||||
def test_uses_highest_cached_plugin_version(self):
|
||||
tokens = ' '.join(CONTRACTS.CONTRACTS['impeccable'][1])
|
||||
self.write('.claude/plugins/cache/impeccable/impeccable/4.10.0/skills/impeccable/SKILL.md', tokens)
|
||||
self.write('.claude/plugins/cache/impeccable/impeccable/4.9.2/skills/impeccable/SKILL.md', 'old')
|
||||
[(status, message)] = CONTRACTS.check(self.home)
|
||||
self.assertEqual('PASS', status)
|
||||
self.assertIn('4.10.0', message)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user