proxyctl 0.3.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {proxyctl-0.3.0 → proxyctl-0.3.1}/PKG-INFO +1 -1
- {proxyctl-0.3.0 → proxyctl-0.3.1}/pyproject.toml +1 -1
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/__init__.py +1 -1
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/cli.py +10 -1
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/core/plugin.py +18 -1
- {proxyctl-0.3.0 → proxyctl-0.3.1}/.gitignore +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/LICENSE +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/README.md +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/man/proxyctl.1 +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/_io.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/audit.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/builtin_plugins/__init__.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/builtin_plugins/connectivity_basic.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/builtin_plugins/corp_network.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/check.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/completion.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/core/__init__.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/engine/__init__.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/engine/base.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/engine/mihomo.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/engine/singbox.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/explain.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/status.py +0 -0
- {proxyctl-0.3.0 → proxyctl-0.3.1}/src/proxyctl/trace.py +0 -0
|
@@ -1361,7 +1361,16 @@ def _read_log_lines(path: str, tail_n: int | None) -> list:
|
|
|
1361
1361
|
|
|
1362
1362
|
# ── 帮助 ──────────────────────────────────────────────────────────────────────
|
|
1363
1363
|
|
|
1364
|
-
|
|
1364
|
+
def _read_version() -> str:
|
|
1365
|
+
"""单一事实来源:pyproject.toml 的 [project] version。"""
|
|
1366
|
+
try:
|
|
1367
|
+
from importlib.metadata import version
|
|
1368
|
+
return version("proxyctl")
|
|
1369
|
+
except Exception:
|
|
1370
|
+
return "unknown"
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
VERSION = _read_version()
|
|
1365
1374
|
|
|
1366
1375
|
|
|
1367
1376
|
# Help 输出按 group 分块的顺序(避免依赖 dict 插入顺序变化)
|
|
@@ -148,6 +148,20 @@ class Plugin:
|
|
|
148
148
|
return []
|
|
149
149
|
|
|
150
150
|
|
|
151
|
+
# ── 内部工具 ─────────────────────────────────────────────────────────────────
|
|
152
|
+
|
|
153
|
+
def _apply_color_policy(modname: str) -> None:
|
|
154
|
+
"""插件模块加载后立刻调用:若当前是关色态,把模块自定义的 RED/GREEN/...
|
|
155
|
+
常量抹空。解决用户插件(如 sb_private.py)在 cli.main() 的 set_no_color
|
|
156
|
+
之后加载,导致硬编码 ANSI 字面量泄漏到管道输出的问题。"""
|
|
157
|
+
try:
|
|
158
|
+
from proxyctl import _io
|
|
159
|
+
_io.maybe_disable_module_colors(modname)
|
|
160
|
+
except Exception:
|
|
161
|
+
# 插件加载链路不应被色彩策略阻断
|
|
162
|
+
pass
|
|
163
|
+
|
|
164
|
+
|
|
151
165
|
# ── Registry ─────────────────────────────────────────────────────────────────
|
|
152
166
|
|
|
153
167
|
class PluginRegistry:
|
|
@@ -171,7 +185,9 @@ class PluginRegistry:
|
|
|
171
185
|
if modname.startswith("_"):
|
|
172
186
|
continue
|
|
173
187
|
try:
|
|
174
|
-
|
|
188
|
+
full_name = f"proxyctl.builtin_plugins.{modname}"
|
|
189
|
+
mod = importlib.import_module(full_name)
|
|
190
|
+
_apply_color_policy(full_name)
|
|
175
191
|
self._discover_in_module(mod, config, source=f"builtin/{modname}")
|
|
176
192
|
except Exception as e:
|
|
177
193
|
self.errors.append((f"builtin/{modname}", _fmt_err(e)))
|
|
@@ -192,6 +208,7 @@ class PluginRegistry:
|
|
|
192
208
|
mod = importlib.util.module_from_spec(spec)
|
|
193
209
|
sys.modules[mod_name] = mod
|
|
194
210
|
spec.loader.exec_module(mod)
|
|
211
|
+
_apply_color_policy(mod_name)
|
|
195
212
|
self._discover_in_module(mod, config, source=f"user/{fname}")
|
|
196
213
|
except Exception as e:
|
|
197
214
|
self.errors.append((f"user/{fname}", _fmt_err(e)))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|