SQLite-backed local snapshot store

This commit is contained in:
2026-05-04 08:56:41 +02:00
parent 0d1ad21a9f
commit 36ff4cedab
7 changed files with 926 additions and 5 deletions

View File

@@ -51,7 +51,7 @@ directly and should report actual refresh work against the same categories.
```task
id: MKTT-WP-0007-T001
status: todo
status: done
priority: high
state_hub_task_id: "8894a9a4-586c-457b-b4e6-add8276ff5f2"
```
@@ -59,6 +59,10 @@ state_hub_task_id: "8894a9a4-586c-457b-b4e6-add8276ff5f2"
Persist parsed document snapshots and source metadata in a local cache
directory.
Implemented: `LocalSnapshotStore`, SQLite schema initialization, source-state
loading, parsed document JSON persistence, provenance envelope storage, and
relative path handling. See `docs/local-index-backend.md`.
Implementation hints:
- Persist `SnapshotState` fields in the snapshot/source tables.
@@ -71,7 +75,7 @@ Implementation hints:
```task
id: MKTT-WP-0007-T002
status: todo
status: done
priority: high
state_hub_task_id: "fb9eaa9d-5c20-49a9-a7a6-acae28ac5e20"
```
@@ -86,6 +90,9 @@ mkt ast stats <file>
Use the current parsed document and token model. Do not require cache presence
for single-file use.
Implemented: `mkt ast show <file>` and `mkt ast stats <file>` with JSON, YAML,
tree/text output modes.
## P7.3 - Add optional JSONPath query adapter
```task
@@ -102,7 +109,7 @@ shared query result envelope.
```task
id: MKTT-WP-0007-T004
status: todo
status: done
priority: medium
state_hub_task_id: "479f11a3-4ab4-451b-991c-7f143f2bffea"
```
@@ -121,6 +128,11 @@ Implementation hints:
- Preserve source spans and content-unit ids from WP-0010 reference/literate
layers.
Implemented: source, heading, section, block, dependency, and metadata tables;
document/frontmatter/metrics/provenance JSON payloads; hot-path indexes on
path, content hash, snapshot id, parser identity, unit path, and dependency
target.
## P7.5 - Add FTS5 section/block search
```task
@@ -137,7 +149,7 @@ relevance ranking.
```task
id: MKTT-WP-0007-T006
status: todo
status: done
priority: medium
state_hub_task_id: "7d9472e6-0716-435b-866c-d2c66ad786cf"
```
@@ -156,6 +168,11 @@ Implementation hints:
- Report planned vs actual counts for hash, parse, index, metadata update,
delete, and invalidation work.
Implemented first pass: `LocalSnapshotStore.build()` drives refresh from
`SnapshotRefreshPlan`, hashes metadata-changed files by default, skips
unchanged content, updates metadata-only rows, refreshes changed snapshots, and
deletes removed files.
## P7.7 - Add local index CLI
```task
@@ -174,6 +191,10 @@ mkt cache query <selector-or-query>
mkt search <text>
```
Partial implementation: `mkt cache init` initializes the local SQLite store and
`mkt cache index <path>` builds or refreshes it. Cache-backed query and FTS
search remain part of this task.
## Exit Criteria
- Legacy AST/JSONPath value is recovered as an optional backend.