@skill-map/cli 0.5.0 → 0.6.0

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.
@@ -6,7 +6,7 @@
6
6
  CREATE TABLE scan_nodes (
7
7
  path TEXT PRIMARY KEY,
8
8
  kind TEXT NOT NULL,
9
- adapter TEXT NOT NULL,
9
+ provider TEXT NOT NULL,
10
10
  title TEXT,
11
11
  description TEXT,
12
12
  stability TEXT,
@@ -29,7 +29,7 @@ CREATE TABLE scan_nodes (
29
29
  CONSTRAINT ck_scan_nodes_stability CHECK (stability IS NULL OR stability IN ('experimental','stable','deprecated'))
30
30
  );
31
31
  CREATE INDEX ix_scan_nodes_kind ON scan_nodes(kind);
32
- CREATE INDEX ix_scan_nodes_adapter ON scan_nodes(adapter);
32
+ CREATE INDEX ix_scan_nodes_provider ON scan_nodes(provider);
33
33
  CREATE INDEX ix_scan_nodes_body_hash ON scan_nodes(body_hash);
34
34
 
35
35
  CREATE TABLE scan_links (
@@ -116,7 +116,7 @@ CREATE TABLE state_executions (
116
116
  tokens_out INTEGER,
117
117
  report_path TEXT,
118
118
  job_id TEXT,
119
- CONSTRAINT ck_state_executions_kind CHECK (kind IN ('action','audit')),
119
+ CONSTRAINT ck_state_executions_kind CHECK (kind IN ('action')),
120
120
  CONSTRAINT ck_state_executions_status CHECK (status IN ('completed','failed','cancelled'))
121
121
  );
122
122
  CREATE INDEX ix_state_executions_extension_id ON state_executions(extension_id);
@@ -183,3 +183,80 @@ CREATE TABLE config_schema_versions (
183
183
  PRIMARY KEY (scope, owner_id, version),
184
184
  CONSTRAINT ck_config_schema_versions_scope CHECK (scope IN ('kernel','plugin'))
185
185
  );
186
+
187
+ -- --- Scan meta envelope ----------------------------------------------------
188
+ -- Persists scan-result metadata so `loadScanResult` returns real values for
189
+ -- `scope`, `roots`, `scannedAt`, `scannedBy`, `providers`, and the non-derivable
190
+ -- `stats` fields (filesWalked / filesSkipped / durationMs) instead of a
191
+ -- synthetic envelope. Single-row table (CHECK id = 1); replaced atomically
192
+ -- with the rest of the scan_* zone on every `sm scan` via
193
+ -- `persistScanResult`. Originally landed at Step 5.1 as migration 002 and
194
+ -- folded back into the initial migration pre-1.0 (no released DBs to migrate
195
+ -- forward).
196
+
197
+ CREATE TABLE scan_meta (
198
+ id INTEGER PRIMARY KEY,
199
+ scope TEXT NOT NULL,
200
+ roots_json TEXT NOT NULL,
201
+ scanned_at INTEGER NOT NULL,
202
+ scanned_by_name TEXT NOT NULL,
203
+ scanned_by_version TEXT NOT NULL,
204
+ scanned_by_spec_version TEXT NOT NULL,
205
+ providers_json TEXT NOT NULL,
206
+ stats_files_walked INTEGER NOT NULL,
207
+ stats_files_skipped INTEGER NOT NULL,
208
+ stats_duration_ms INTEGER NOT NULL,
209
+ CONSTRAINT ck_scan_meta_singleton CHECK (id = 1),
210
+ CONSTRAINT ck_scan_meta_scope CHECK (scope IN ('project','global'))
211
+ );
212
+
213
+ -- --- Fine-grained scan cache ----------------------------------------------
214
+ -- Phase 4 / A.9 — per-(node, extractor) cache breadcrumbs. Lets the
215
+ -- orchestrator skip rerunning extractors against an unchanged body when the
216
+ -- same extractor already ran against that body_hash, and — critically —
217
+ -- detect when a NEW extractor was registered between scans (no row yet for
218
+ -- that pair) so the new extractor runs over the cached node without
219
+ -- requiring a full cache invalidation. Replace-all on every persist:
220
+ -- obsolete rows (extractor uninstalled since the last scan) disappear
221
+ -- automatically and cannot mask a stale cache hit.
222
+
223
+ CREATE TABLE scan_extractor_runs (
224
+ node_path TEXT NOT NULL,
225
+ extractor_id TEXT NOT NULL,
226
+ body_hash_at_run TEXT NOT NULL,
227
+ ran_at INTEGER NOT NULL,
228
+ PRIMARY KEY (node_path, extractor_id)
229
+ );
230
+ CREATE INDEX ix_scan_extractor_runs_node ON scan_extractor_runs(node_path);
231
+ CREATE INDEX ix_scan_extractor_runs_extractor ON scan_extractor_runs(extractor_id);
232
+
233
+ -- --- Universal enrichment layer --------------------------------------------
234
+ -- Phase 4 / A.8 — stores `ctx.enrichNode(partial)` outputs separately from
235
+ -- the author-supplied frontmatter (which remains immutable from Extractors).
236
+ -- Layer separation is universal: deterministic and probabilistic Extractors
237
+ -- both write here. Only probabilistic enrichments need stale tracking
238
+ -- (`is_probabilistic = 1`); when a node body changes between scans, those
239
+ -- rows are flagged `stale = 1` (NOT deleted, preserving the LLM cost).
240
+ -- Deterministic enrichments regenerate via the A.9 fine-grained cache and
241
+ -- simply pisar the prior row via PRIMARY KEY conflict on the next scan.
242
+ --
243
+ -- Read-side `node.merged` view (helper `mergeNodeWithEnrichments`):
244
+ -- author frontmatter + non-stale enrichments ordered by enriched_at ASC,
245
+ -- last-write-wins per field. Rules / `sm check` / `sm export` consume the
246
+ -- author frontmatter by default (CI-safe deterministic baseline);
247
+ -- enrichment consumption is opt-in.
248
+
249
+ CREATE TABLE node_enrichments (
250
+ node_path TEXT NOT NULL,
251
+ extractor_id TEXT NOT NULL,
252
+ body_hash_at_enrichment TEXT NOT NULL,
253
+ value_json TEXT NOT NULL,
254
+ stale INTEGER NOT NULL DEFAULT 0,
255
+ enriched_at INTEGER NOT NULL,
256
+ is_probabilistic INTEGER NOT NULL DEFAULT 0,
257
+ PRIMARY KEY (node_path, extractor_id),
258
+ CONSTRAINT ck_node_enrichments_stale CHECK (stale IN (0, 1)),
259
+ CONSTRAINT ck_node_enrichments_is_probabilistic CHECK (is_probabilistic IN (0, 1))
260
+ );
261
+ CREATE INDEX ix_node_enrichments_node ON node_enrichments(node_path);
262
+ CREATE INDEX ix_node_enrichments_stale ON node_enrichments(stale);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skill-map/cli",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "skill-map reference implementation — kernel + CLI + adapters.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,22 +0,0 @@
1
- -- Step 5.1 — Persist scan-result metadata so `loadScanResult` returns real
2
- -- values for `scope`, `roots`, `scannedAt`, `scannedBy`, `adapters`, and the
3
- -- non-derivable `stats` fields (filesWalked / filesSkipped / durationMs)
4
- -- instead of the synthetic envelope it has been returning since Step 0c.
5
- -- Single-row table (CHECK id = 1); replaced atomically with the rest of
6
- -- the scan_* zone on every `sm scan` via `persistScanResult`.
7
-
8
- CREATE TABLE scan_meta (
9
- id INTEGER PRIMARY KEY,
10
- scope TEXT NOT NULL,
11
- roots_json TEXT NOT NULL,
12
- scanned_at INTEGER NOT NULL,
13
- scanned_by_name TEXT NOT NULL,
14
- scanned_by_version TEXT NOT NULL,
15
- scanned_by_spec_version TEXT NOT NULL,
16
- adapters_json TEXT NOT NULL,
17
- stats_files_walked INTEGER NOT NULL,
18
- stats_files_skipped INTEGER NOT NULL,
19
- stats_duration_ms INTEGER NOT NULL,
20
- CONSTRAINT ck_scan_meta_singleton CHECK (id = 1),
21
- CONSTRAINT ck_scan_meta_scope CHECK (scope IN ('project','global'))
22
- );