mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-12 06:50:48 +08:00
完成运行时与启动链路的全面相对路径整改,统一以仓库根为路径基准并移除 oclaw 双层硬编码。
同时补齐路径回归测试与开源自检文档,确保从非仓库 cwd 启动时 workspace 根、配置和 wiki 路径仍稳定可用。 Made-with: Cursor
This commit is contained in:
parent
dbbe3add6a
commit
9d2900db02
40 changed files with 223 additions and 82 deletions
|
|
@ -90,3 +90,24 @@ def test_main_hooks_list_invocation(tmp_path, monkeypatch) -> None:
|
|||
assert code == 0
|
||||
obj = json.loads(buf.getvalue())
|
||||
assert "hooks" in obj
|
||||
|
||||
|
||||
def test_resolve_cli_workspace_uses_env_over_cwd(tmp_path, monkeypatch) -> None:
|
||||
monkeypatch.chdir(tmp_path)
|
||||
expected = tmp_path / "repo-root"
|
||||
expected.mkdir(parents=True)
|
||||
monkeypatch.setenv("OCLAW_WORKSPACE", str(expected))
|
||||
from oclaw.runtime.operations.hooks_cmd import _resolve_cli_workspace
|
||||
|
||||
ns = argparse.Namespace(workspace="")
|
||||
assert _resolve_cli_workspace(ns) == str(expected)
|
||||
|
||||
|
||||
def test_resolve_cli_workspace_falls_back_to_workspace_root(tmp_path, monkeypatch) -> None:
|
||||
monkeypatch.chdir(tmp_path)
|
||||
monkeypatch.delenv("OCLAW_WORKSPACE", raising=False)
|
||||
monkeypatch.setenv("OPS_WORKSPACE_ROOT", str(tmp_path))
|
||||
from oclaw.runtime.operations.hooks_cmd import _resolve_cli_workspace
|
||||
|
||||
ns = argparse.Namespace(workspace="")
|
||||
assert _resolve_cli_workspace(ns) == str(tmp_path.resolve())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue