feat(sync): add gitignore-aware drawer prune (#1252)

Add `mempalace sync` CLI command and `mempalace_sync` MCP tool that
prune drawers whose source files are gitignored, deleted, or moved
out of the project. Reuses the existing GitignoreMatcher
infrastructure in mempalace/miner.py so the same gitignore rules
that block ingest also drive the corresponding cleanup.

Closes #1252.
This commit is contained in:
mvalentsev
2026-05-09 03:16:03 +05:00
parent 02dd6dc19e
commit 1d3eecbf9d
5 changed files with 1604 additions and 1 deletions
+15 -1
View File
@@ -1,6 +1,6 @@
# MCP Tools Reference
Detailed parameter schemas for all 29 MCP tools.
Detailed parameter schemas for all 30 MCP tools.
## Palace — Read Tools
@@ -114,6 +114,20 @@ Delete a drawer by ID. Irreversible.
---
### `mempalace_sync`
Prune drawers whose source files are gitignored, deleted, or moved. Returns a dry-run report by default; pass `apply=true` to commit deletions.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `project_dir` | string | No | Project root to scope the sync (auto-detected from drawer metadata if omitted) |
| `wing` | string | No | Limit to one wing |
| `apply` | boolean | No | Actually delete drawers; default is dry-run preview |
**Returns:** `{ scanned, kept, gitignored, missing, no_source, out_of_scope, removed_drawers, removed_closets, dry_run, by_source }`
---
### `mempalace_get_drawer`
Fetch a single drawer by ID — returns full content and metadata.