-
Clone the repo:
git clone https://github.com/raghavvbiyani/xstitch.git && cd xstitch
-
Install in editable mode:
pip3 install -e . -
Run tests:
python3 -m pytest tests/ -q
-
Optional search dependencies:
pip3 install -e ".[search]"
xstitch/
├── xstitch/ # Main package
│ ├── core/ # Re-exports: models, store, capture, log
│ ├── search/ # Search engine: BM25, fuzzy, embeddings, index
│ ├── integrations/ # Re-exports: tool registry, discovery, enforcement
│ │ └── tools/ # Per-tool integration definitions
│ ├── mcp/ # Re-exports: MCP server, tools
│ ├── diagnostics/ # Re-exports: doctor, healthcheck
│ ├── automation/ # Re-exports: hooks, daemon, launchd
│ ├── models.py # Task, Snapshot, Decision dataclasses (canonical)
│ ├── store.py # Storage engine (canonical)
│ ├── mcp_server.py # MCP server with dual-protocol (canonical)
│ ├── global_setup.py # Tool registry + OOP hierarchy (canonical)
│ └── ... # Other canonical modules
├── tests/
│ ├── conftest.py # Shared fixtures
│ ├── unit/ # Fast, isolated tests
│ ├── integration/ # Tests requiring subprocess or filesystem
│ └── e2e/ # End-to-end cross-tool tests
├── docs/ # Architecture, search design, adding-tools guide
├── pyproject.toml # Build config, entry points, optional deps
└── README.md
The subpackages (core/, integrations/, mcp/, etc.) are re-export shims. Canonical code lives in the top-level files (e.g., xstitch/store.py, xstitch/models.py). This preserves unittest.mock.patch compatibility since patches target xstitch.store.X which is the actual module.
- Python 3.10+ (stdlib only for core, optional deps guarded)
- No external runtime dependencies
- Type hints encouraged
- Logging via
xstitch/log.pyto stderr (never pollute stdout, which is for MCP/CLI output) - Atomic file operations: write to temp file + rename
- Run all tests:
python3 -m pytest tests/ -q - Run only unit tests:
python3 -m pytest tests/unit/ -q - Run only integration tests:
python3 -m pytest tests/integration/ -q - New tests go in
tests/unit/ortests/integration/(NOTtest_robustness.py) - Follow existing naming:
test_<module>.py, classTest<Feature>, methodtest_<behavior> - Use
patch("xstitch.<module>.<name>")for mocking (target canonical modules)
See docs/adding-tools.md for the full guide. In short:
- Create
xstitch/integrations/tools/mytool.pysubclassingToolIntegration - Register via entry point in
pyproject.toml - Add detection, global config, and project injection logic
External packages can register tools without modifying Stitch core.
- All tests must pass
- Include tests for new functionality
- Don't break existing working code
- Backward compatibility is critical (re-export shims exist for this reason)