MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _display_path

Function _display_path

src/command_system/memory_command.py:39–52  ·  view source on GitHub ↗

``~``-abbreviated, else cwd-relative, else absolute (the TS ``getRelativeMemoryPath`` shape).

(path: str, cwd: str)

Source from the content-addressed store, hash-verified

37
38
39def _display_path(path: str, cwd: str) -> str:
40 """``~``-abbreviated, else cwd-relative, else absolute (the TS
41 ``getRelativeMemoryPath`` shape)."""
42 home = str(Path.home())
43 real = os.path.realpath(path)
44 try:
45 rel = os.path.relpath(real, os.path.realpath(cwd))
46 if not rel.startswith(".."):
47 return rel
48 except ValueError:
49 pass
50 if real.startswith(home + os.sep) or real == home:
51 return "~" + real[len(home):]
52 return real
53
54
55def _resolve_project_memory_path(files: list, cwd: str) -> str:

Callers 3

test_display_pathFunction · 0.90
build_memory_optionsFunction · 0.85
runMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_display_pathFunction · 0.72