@hardkas/query-store 0.7.10-alpha → 0.7.12-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/dist/migrations.d.ts +1 -1
- package/dist/migrations.js +1 -1
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# `@hardkas/query-store`
|
|
2
|
+
|
|
3
|
+
The Query Store is a rebuildable, heavily indexed SQLite projection of the `.hardkas/` workspace. It provides fast reads for CLI and Dashboard interactions without scanning thousands of JSON files.
|
|
4
|
+
|
|
5
|
+
## 1. Indexing Architecture
|
|
6
|
+
|
|
7
|
+
The query store relies *entirely* on the filesystem (`artifacts/` and `events.jsonl`). The SQLite database itself is treated as ephemeral and rebuildable.
|
|
8
|
+
|
|
9
|
+
### Flow: Incremental Sync (`hardkas query store sync`)
|
|
10
|
+
1. The engine queries the current `MAX(eventId)` in the SQLite `events` table.
|
|
11
|
+
2. It opens `events.jsonl` and streams only lines where `id > MAX`.
|
|
12
|
+
3. It batch-inserts the new events in a single SQLite transaction to prevent corruption on crash.
|
|
13
|
+
4. It scans `artifacts/` for files newer than the last sync timestamp and updates the `artifacts` table.
|
|
14
|
+
|
|
15
|
+
### Variant: Full Rebuild (`hardkas rebuild --from-artifacts`)
|
|
16
|
+
If the SQLite file is deleted, corrupted, or schema migrations fail:
|
|
17
|
+
1. The SQLite file is purged.
|
|
18
|
+
2. `events.jsonl` is streamed from line 1.
|
|
19
|
+
3. `artifacts/` is traversed deeply.
|
|
20
|
+
4. The database is rebuilt from scratch, proving the mathematical determinism of the runtime.
|
|
21
|
+
|
|
22
|
+
## 2. Diagnostic Flows
|
|
23
|
+
|
|
24
|
+
Because the SQLite file is an ephemeral projection, it can diverge from the artifacts layer if a process is violently killed.
|
|
25
|
+
|
|
26
|
+
### Flow: Store Doctor (`hardkas query store doctor`)
|
|
27
|
+
1. Verifies the SQLite schema version against the current SDK version.
|
|
28
|
+
2. Runs `PRAGMA integrity_check`.
|
|
29
|
+
3. Counts rows in SQLite and compares them against the line count in `events.jsonl`.
|
|
30
|
+
4. If discrepancies are found, it prompts the user to run `sync` or `rebuild`.
|
|
31
|
+
|
|
32
|
+
### Variant: Silent Migration (`--migrate`)
|
|
33
|
+
If the schema is outdated (e.g., v3 to v4 after updating the HardKAS package), the `--migrate` flag triggers deterministic SQL `ALTER TABLE` statements. If a migration fails mid-way, the transaction rolls back, and the `Store Doctor` automatically triggers a Full Rebuild to ensure consistency.
|
package/dist/migrations.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare class MigrationRunner {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Registry of all query-store migrations.
|
|
39
|
-
* Version 1: Initial schema (Baseline 0.7.
|
|
39
|
+
* Version 1: Initial schema (Baseline 0.7.12-alpha).
|
|
40
40
|
*/
|
|
41
41
|
export declare const MIGRATIONS: Migration[];
|
|
42
42
|
//# sourceMappingURL=migrations.d.ts.map
|
package/dist/migrations.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hardkas/query-store",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12-alpha",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@hardkas/
|
|
15
|
-
"@hardkas/
|
|
14
|
+
"@hardkas/artifacts": "0.7.12-alpha",
|
|
15
|
+
"@hardkas/core": "0.7.12-alpha"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^22.10.0",
|