SIGN IN SIGN UP

perf(cli): lazy-load server, pathspec, and protocol imports (#164)

Cuts `ccc status` cold-cache startup from ~0.5-0.9s to ~0.15s.

- `cocoindex_code/__init__.py`: replace eager `from .server import main`
  with a PEP 562 `__getattr__` so importing the package no longer pulls
  `mcp.server.fastmcp` (~300ms). The `cocoindex-code = "cocoindex_code:main"`
  console script still resolves.
- `settings.py`: defer `from pathspec import GitIgnoreSpec` into
  `load_gitignore_spec()` (only called by indexer/daemon).
- `cli.py`: move protocol type-only imports under `TYPE_CHECKING`
  (safe with `from __future__ import annotations`); lazy-import
  `DaemonStartError` inside the wrapper and `DoctorCheckResult` next to
  the existing lazy `client` import.

Also drops a stale paragraph from CLAUDE.md.
J
Jiangzhou committed
d429632c5eb9e2cfe8b0e02487fe5fa966082057
Parent: efd1273
Committed by GitHub <noreply@github.com> on 5/8/2026, 4:25:15 PM