@guanlin4924/devflow-pi 0.1.77 → 0.1.78

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.
@@ -2,6 +2,7 @@ import sqlite3
2
2
  import os
3
3
  from pathlib import Path
4
4
 
5
+ from adapters.capabilities import confidence_for_parser
5
6
  from core.schema import json_dumps
6
7
 
7
8
 
@@ -31,6 +32,7 @@ CREATE TABLE IF NOT EXISTS symbols (
31
32
  language TEXT NOT NULL,
32
33
  content_hash TEXT NOT NULL,
33
34
  visibility TEXT,
35
+ parser TEXT NOT NULL,
34
36
  metadata_json TEXT
35
37
  );
36
38
 
@@ -113,6 +115,7 @@ CREATE TABLE IF NOT EXISTS feature_bindings (
113
115
  confidence TEXT NOT NULL,
114
116
  source_path TEXT,
115
117
  line_start INTEGER,
118
+ extractor TEXT NOT NULL,
116
119
  PRIMARY KEY(snapshot_id, feature_id, entity_id)
117
120
  );
118
121
 
@@ -207,19 +210,27 @@ def write_sqlite(path: Path, files, symbols, relations, diagnostics, snapshot_id
207
210
  parsed_count = sum(1 for item in files if item.get("path") not in parse_failed_paths)
208
211
  conn.execute(
209
212
  "INSERT INTO analysis_snapshots(snapshot_id, schema_version, source_revision, content_manifest_hash, extractor_set_hash, created_at, status) VALUES(?,?,?,?,?,?,?)",
210
- (snapshot_id, 2, workspace_state.get("repositoryRevision", ""), workspace_state.get("contentManifestHash", ""),
213
+ (snapshot_id, 3, workspace_state.get("repositoryRevision", ""), workspace_state.get("contentManifestHash", ""),
211
214
  workspace_state.get("extractorSetHash", ""), workspace_state.get("generatedAt", ""), "current"),
212
215
  )
213
216
  # Structural symbols and files are first-class graph nodes as well.
214
217
  # This prevents semantic flows and feature bindings from dangling when
215
218
  # a framework linker points at an existing code symbol.
216
- structural_entities = [
217
- {"id": item["id"], "entity_type": item.get("kind", "symbol"), "name": item.get("name", item["id"]),
218
- "codebase": item.get("codebase"), "path": item.get("path"), "line_start": item.get("line_start"),
219
- "line_end": item.get("line_end"), "content_hash": item.get("content_hash"), "confidence": "exact",
220
- "extractor": item.get("parser", "index"), "metadata": item.get("metadata", {})}
221
- for item in [*files, *symbols]
222
- ]
219
+ parser_by_path = {item.get("path"): item.get("parser", "unknown") for item in files}
220
+ structural_entities = []
221
+ for item in [*files, *symbols]:
222
+ is_file = "size_bytes" in item
223
+ metadata = dict(item.get("metadata", {}))
224
+ parser = item.get("parser") or metadata.get("parser") or parser_by_path.get(item.get("path"), "unknown")
225
+ metadata.setdefault("parser", parser)
226
+ structural_entities.append({
227
+ "id": item["id"], "entity_type": item.get("kind", "file" if is_file else "symbol"),
228
+ "name": item.get("name", item.get("path", item["id"])), "codebase": item.get("codebase"),
229
+ "path": item.get("path"), "line_start": item.get("line_start", 1 if is_file else None),
230
+ "line_end": item.get("line_end", 1 if is_file else None), "content_hash": item.get("content_hash"),
231
+ "confidence": confidence_for_parser(parser, "file" if is_file else "symbol"),
232
+ "extractor": parser, "metadata": metadata,
233
+ })
223
234
  by_id = {item["id"]: item for item in semantic_entities}
224
235
  for item in structural_entities:
225
236
  by_id.setdefault(item["id"], item)
@@ -247,8 +258,8 @@ def write_sqlite(path: Path, files, symbols, relations, diagnostics, snapshot_id
247
258
  [(snapshot_id, item["source_id"], item["target_id"], item["flow_type"], item.get("source_path"), item.get("line_start"), item["confidence"], item.get("evidence_level", "static_source"), item.get("extractor", "unknown"), json_dumps(item.get("metadata", {}))) for item in semantic_flows],
248
259
  )
249
260
  conn.executemany(
250
- "INSERT INTO feature_bindings(snapshot_id, feature_id, entity_id, binding_type, confidence, source_path, line_start) VALUES(?,?,?,?,?,?,?)",
251
- [(snapshot_id, item["feature_id"], item["entity_id"], item["binding_type"], item["confidence"], item.get("source_path"), item.get("line_start")) for item in feature_bindings],
261
+ "INSERT INTO feature_bindings(snapshot_id, feature_id, entity_id, binding_type, confidence, source_path, line_start, extractor) VALUES(?,?,?,?,?,?,?,?)",
262
+ [(snapshot_id, item["feature_id"], item["entity_id"], item["binding_type"], item["confidence"], item.get("source_path"), item.get("line_start"), item.get("extractor", "unknown")) for item in feature_bindings],
252
263
  )
253
264
  conn.execute(
254
265
  "INSERT INTO coverage_metrics(snapshot_id, files_scanned, files_parsed, diagnostics, semantic_entities, semantic_flows, dynamic_limitations, metadata_json) VALUES(?,?,?,?,?,?,?,?)",
@@ -264,9 +275,9 @@ def write_sqlite(path: Path, files, symbols, relations, diagnostics, snapshot_id
264
275
  conn.executemany(
265
276
  """
266
277
  INSERT INTO symbols(id, codebase, kind, name, qualified_name, container_id, path, line_start, line_end,
267
- signature, language, content_hash, visibility, metadata_json)
278
+ signature, language, content_hash, visibility, parser, metadata_json)
268
279
  VALUES(:id, :codebase, :kind, :name, :qualified_name, :container_id, :path, :line_start, :line_end,
269
- :signature, :language, :content_hash, :visibility, :metadata_json)
280
+ :signature, :language, :content_hash, :visibility, :parser, :metadata_json)
270
281
  """,
271
282
  [_symbol_row(record) for record in symbols],
272
283
  )
@@ -302,7 +313,9 @@ def write_sqlite(path: Path, files, symbols, relations, diagnostics, snapshot_id
302
313
 
303
314
  def _symbol_row(record):
304
315
  row = dict(record)
305
- row["metadata_json"] = json_dumps(row.pop("metadata", {}))
316
+ metadata = row.pop("metadata", {})
317
+ row["parser"] = row.get("parser") or metadata.get("parser") or "unknown"
318
+ row["metadata_json"] = json_dumps(metadata)
306
319
  return row
307
320
 
308
321
 
package/src/constants.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const PRODUCT_NAME = "Devflow Pi";
2
- export const PRODUCT_VERSION = "0.1.77";
2
+ export const PRODUCT_VERSION = "0.1.78";
3
3
  export const PROJECT_SCHEMA_VERSION = 1;
4
4
  export const OMP_RUNTIME_VERSION = "17.2.7";
5
5