fix(plugins): update installed QMD without reinstalling

This commit is contained in:
Julian lechner committed 2026-09-30 12:44:35 +02:00
1 parent 756b8fe59e
commit 6361e81915
2 files changed
+9 -1

No files matched your search

+1 -1
View File
@@ -429,7 +429,7 @@ class Manager:
if record is None and installed and not self.summary:
print(f'PASS Preserving pre-existing global package: {package}')
if (record is not None or not installed) and (not installed or (self.update and package not in self.updated_packages)):
self.command(['npm', 'install', '--global', package])
self.command(['npm', 'update' if installed else 'install', '--global', package])
self.global_packages().add(package)
self.updated_packages.add(package)
if record is None:
+8
View File
@@ -274,6 +274,14 @@ class ManagedExtensionTests(unittest.TestCase):
self.assertIn(['claude', 'plugin', 'install', 'qmd@qmd', '--scope', 'user'], self.commands)
self.assertNotIn(['codex', 'mcp', 'add', 'qmd', '--', 'qmd', 'mcp'], self.commands)
def test_owned_qmd_uses_npm_update_instead_of_reinstalling(self):
entry = dict(name='QMD', codex_method='qmd', codex_source='@tobilu/qmd', codex_skill='qmd', codex_plugin='-', codex_marketplace='-', claude_plugin='qmd@qmd', claude_marketplace='tobi/qmd')
self.manager().sync([entry], ['codex'], {'QMD'})
self.commands.clear()
with patch.object(extensions.Manager, 'global_packages', return_value={'@tobilu/qmd'}):
self.manager(update=True).sync([entry], ['codex'], {'QMD'})
self.assertEqual([['npm', 'update', '--global', '@tobilu/qmd']], self.commands)
def test_managed_mcporter_updates_when_requested(self):
self.manager().sync([mcporter()], ['codex'], {'MCPorter'})
self.commands.clear()