1- """CLI entry point for code-intelligence ."""
1+ """CLI entry point for OSSCodeIQ ."""
22
33from __future__ import annotations
44
1717)
1818console = Console ()
1919
20+ _GRAPH_DIR_NAME = ".code-intelligence"
21+ _KUZU_DB_NAME = "graph.kuzu"
22+ _SQLITE_DB_NAME = "graph.db"
23+
2024
2125def _get_version () -> str :
2226 """Get package version from metadata."""
2327 try :
2428 from importlib .metadata import version
25- return version ("code-intelligence " )
29+ return version ("osscodeiq " )
2630 except Exception :
2731 return "0.1.0"
2832
@@ -63,11 +67,11 @@ def analyze(
6367 cfg .analysis .incremental = incremental
6468 cfg .graph .backend = backend
6569 if backend in ("kuzu" , "sqlite" ):
66- graph_dir = path .resolve () / ".code-intelligence"
70+ graph_dir = path .resolve () / _GRAPH_DIR_NAME
6771 if backend == "kuzu" :
68- cfg .graph .path = str (graph_dir / "graph.kuzu" )
72+ cfg .graph .path = str (graph_dir / _KUZU_DB_NAME )
6973 elif backend == "sqlite" :
70- cfg .graph .path = str (graph_dir / "graph.db" )
74+ cfg .graph .path = str (graph_dir / _SQLITE_DB_NAME )
7175
7276 console .print ("🚀 Starting analysis…" )
7377 analyzer = Analyzer (cfg )
@@ -145,7 +149,7 @@ def graph(
145149 cache_path = path .resolve () / cfg .cache .directory / cfg .cache .db_name
146150
147151 if not cache_path .exists ():
148- console .print ("❌ No analysis cache found. Run 'code-intelligence analyze' first." )
152+ console .print ("❌ No analysis cache found. Run 'osscodeiq analyze' first." )
149153 raise typer .Exit (1 )
150154
151155 console .print ("💾 Loading analysis cache…" )
@@ -229,7 +233,7 @@ def query(
229233 cache_path = path .resolve () / cfg .cache .directory / cfg .cache .db_name
230234
231235 if not cache_path .exists ():
232- console .print ("❌ No analysis cache found. Run 'code-intelligence analyze' first." )
236+ console .print ("❌ No analysis cache found. Run 'osscodeiq analyze' first." )
233237 raise typer .Exit (1 )
234238
235239 console .print ("💾 Loading analysis cache…" )
@@ -302,7 +306,7 @@ def cache(
302306 console .print ("⚠️ No cache found." )
303307 elif action == "stats" :
304308 if not cache_path .exists ():
305- console .print ("⚠️ No cache found. Run 'code-intelligence analyze' first." )
309+ console .print ("⚠️ No cache found. Run 'osscodeiq analyze' first." )
306310 return
307311 console .print ("📊 Loading cache statistics…" )
308312 from osscodeiq .cache .store import CacheStore
@@ -362,11 +366,11 @@ def bundle(
362366 cfg .graph .backend = backend
363367
364368 # Set default path for file-based backends
365- graph_dir = path .resolve () / ".code-intelligence"
369+ graph_dir = path .resolve () / _GRAPH_DIR_NAME
366370 if backend == "kuzu" :
367- cfg .graph .path = str (graph_dir / "graph.kuzu" )
371+ cfg .graph .path = str (graph_dir / _KUZU_DB_NAME )
368372 elif backend == "sqlite" :
369- cfg .graph .path = str (graph_dir / "graph.db" )
373+ cfg .graph .path = str (graph_dir / _SQLITE_DB_NAME )
370374
371375 # Run analysis
372376 from osscodeiq .analyzer import Analyzer
@@ -432,17 +436,17 @@ def _load_graph_backend(path: Path, backend: str, config: Path | None = None):
432436 """Load a graph backend from a previously analyzed project."""
433437 from osscodeiq .graph .backends import create_backend
434438
435- graph_dir = path .resolve () / ".code-intelligence"
439+ graph_dir = path .resolve () / _GRAPH_DIR_NAME
436440 if backend == "kuzu" :
437- db_path = str (graph_dir / "graph.kuzu" )
441+ db_path = str (graph_dir / _KUZU_DB_NAME )
438442 elif backend == "sqlite" :
439- db_path = str (graph_dir / "graph.db" )
443+ db_path = str (graph_dir / _SQLITE_DB_NAME )
440444 else :
441445 # NetworkX ��� load from cache
442446 cfg = _load_config (config )
443447 cache_path = path .resolve () / cfg .cache .directory / cfg .cache .db_name
444448 if not cache_path .exists ():
445- console .print ("No analysis cache found. Run 'code-intelligence analyze' first." )
449+ console .print ("No analysis cache found. Run 'osscodeiq analyze' first." )
446450 raise typer .Exit (1 )
447451 from osscodeiq .cache .store import CacheStore
448452 cache = CacheStore (cache_path )
@@ -451,7 +455,7 @@ def _load_graph_backend(path: Path, backend: str, config: Path | None = None):
451455
452456 from pathlib import Path as P
453457 if not P (db_path ).exists ():
454- console .print (f"No graph database found at { db_path } . Run 'code-intelligence analyze --backend { backend } ' first." )
458+ console .print (f"No graph database found at { db_path } . Run 'osscodeiq analyze --backend { backend } ' first." )
455459 raise typer .Exit (1 )
456460
457461 from osscodeiq .graph .store import GraphStore
@@ -624,7 +628,7 @@ def _flow_fallback(store, node_id: str | None, hops: int) -> list[dict]:
624628 visited : set [str ] = set ()
625629 frontier = {node_id }
626630 results = []
627- for depth in range (1 , hops + 1 ):
631+ for _ in range (1 , hops + 1 ):
628632 next_frontier : set [str ] = set ()
629633 for nid in frontier :
630634 for neighbor in store .neighbors (nid , direction = "out" ):
@@ -700,7 +704,7 @@ def serve(
700704 import uvicorn
701705 from osscodeiq .server .app import create_app
702706
703- console .print (f "[bold]OSSCodeIQ Server[/bold]" )
707+ console .print ("[bold]OSSCodeIQ Server[/bold]" )
704708 console .print (f" Codebase: { path .resolve ()} " )
705709 console .print (f" Backend: { backend } " )
706710 console .print (f" API docs: http://{ host } :{ port } /docs" )
0 commit comments