feat(plugins): discover packages and persist state

This commit is contained in:
2026-06-16 11:40:31 +08:00
parent 7020f2d67f
commit 41b45e0423
15 changed files with 1127 additions and 0 deletions

View File

@ -47,6 +47,46 @@ def test_load_config_reads_current_instance_shape(tmp_path) -> None:
assert target["extra_headers"] == {"X-Test": "1"}
def test_config_loader_reads_plugin_config(tmp_path) -> None:
config_path = tmp_path / "config.json"
config_path.write_text(
json.dumps(
{
"plugins": {
"searchPaths": [str(tmp_path / "plugins"), ""],
"autoSync": False,
}
}
),
encoding="utf-8",
)
config = load_config(config_path=config_path)
assert config.plugins.search_paths == [str(tmp_path / "plugins")]
assert config.plugins.auto_sync is False
def test_config_loader_accepts_snake_case_plugin_config(tmp_path) -> None:
config_path = tmp_path / "config.json"
config_path.write_text(
json.dumps(
{
"plugins": {
"search_paths": [str(tmp_path / "external")],
"auto_sync": True,
}
}
),
encoding="utf-8",
)
config = load_config(config_path=config_path)
assert config.plugins.search_paths == [str(tmp_path / "external")]
assert config.plugins.auto_sync is True
def test_config_loader_reads_channels(tmp_path) -> None:
config_path = tmp_path / "config.json"
config_path.write_text(