MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / main

Function main

pkg/pypi/src/codebase_memory_mcp/_cli.py:1420–1463  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1418
1419
1420def main() -> None:
1421 version = _version()
1422 bin_path = _bin_path(version)
1423 mutation = _runtime_mutation_action(sys.argv[1:])
1424 if mutation == "update":
1425 print(
1426 "This PyPI copy is maintained by pip. Update it with "
1427 '"python -m pip install --upgrade codebase-memory-mcp". '
1428 "For a managed standalone installation, run "
1429 '"codebase-memory-mcp install --yes".',
1430 file=sys.stderr,
1431 )
1432 raise SystemExit(2)
1433
1434 cache_ready = _runtime_set_ready_locked(version)
1435 if not cache_ready:
1436 bin_path = _download(version)
1437
1438 execution_path = _execution_path(bin_path, sys.platform)
1439
1440 # args is a list (not a shell string), so exec/subprocess treat each
1441 # element as a discrete argv entry — no shell interpretation, no
1442 # injection vector. sys.argv forwarding is the whole point of this
1443 # shim, so tainted-input suppression is intentional.
1444 forwarded = _native_args(sys.argv[1:])
1445 args = [str(execution_path)] + forwarded
1446
1447 if mutation in ("install", "uninstall"):
1448 result = _run_cache_sensitive_mutation(version, execution_path, forwarded)
1449 if sys.platform == "win32" and result != 0 and mutation == "uninstall":
1450 print(
1451 'This PyPI Windows copy is portable. Use '
1452 '"python -m pip uninstall codebase-memory-mcp" for package maintenance. '
1453 "To create or repair a managed standalone installation, run "
1454 '"codebase-memory-mcp install --yes".',
1455 file=sys.stderr,
1456 )
1457 raise SystemExit(result)
1458
1459 if sys.platform != "win32":
1460 os.execv(str(execution_path), args) # noqa: S606 — list form, no shell
1461 else:
1462 result = subprocess.run(args) # noqa: S603 — list form, no shell=True
1463 sys.exit(result.returncode)
1464
1465
1466def _runtime_mutation_action(args):

Callers

nothing calls this directly

Calls 10

_versionFunction · 0.85
_bin_pathFunction · 0.85
_runtime_mutation_actionFunction · 0.85
_downloadFunction · 0.85
_execution_pathFunction · 0.85
_native_argsFunction · 0.85
strFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected