|
@@ -97,6 +97,22 @@ def main() -> None:
|
|
|
args = parser.parse_args()
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
db_path = str(args.db)
|
|
db_path = str(args.db)
|
|
|
|
|
+ if not Path(db_path).exists():
|
|
|
|
|
+ print(f"ERROR: database file not found: {db_path}")
|
|
|
|
|
+ print("Check NEWS_MCP_DB_PATH env var or pass --db /path/to/db")
|
|
|
|
|
+ sys.exit(1)
|
|
|
|
|
+
|
|
|
|
|
+ # Quick check: does the clusters table exist?
|
|
|
|
|
+ with sqlite3.connect(db_path) as probe:
|
|
|
|
|
+ tables = {row[0] for row in probe.execute(
|
|
|
|
|
+ "SELECT name FROM sqlite_master WHERE type='table'"
|
|
|
|
|
+ ).fetchall()}
|
|
|
|
|
+ if "clusters" not in tables:
|
|
|
|
|
+ print(f"ERROR: 'clusters' table not found in {db_path}")
|
|
|
|
|
+ print(f" Tables present: {sorted(tables) or '(none)'}")
|
|
|
|
|
+ print(" This may not be the correct database file.")
|
|
|
|
|
+ sys.exit(1)
|
|
|
|
|
+
|
|
|
print(f"Database: {db_path}")
|
|
print(f"Database: {db_path}")
|
|
|
print(f"Dry run: {args.dry_run}")
|
|
print(f"Dry run: {args.dry_run}")
|
|
|
|
|
|