mirror of
https://github.com/lllin000/PaperForge.git
synced 2026-07-22 06:50:53 +00:00
Changes: - Add paper-lookup, content-discovery, scoped-fetch to command registry - Add unit_kind column to body_units schema (DEFAULT 'body') - Replace object_units schema: object_role -> object_kind, object_label, caption_text, nearby_body_text; drop unit_text, drop object_role - Bump schema version to 3 with deterministic drop/recreate migration for derived tables (body_units, body_units_fts, object_units) - Update _upsert_body_units / _upsert_object_units for new columns - Update build_object_units to emit object_kind, object_label, caption_text, nearby_body_text fields - Add vector secondary arm to _run_compat_content_discovery: runs paper_fts primary, conditionally adds vector_retrieve secondary when vector is healthy - Add/fix tests for schema columns, builder output, registry, and compat content-discovery vector-secondary path
38 lines
1.5 KiB
Python
38 lines
1.5 KiB
Python
"""paperforge.commands — shared command implementations for CLI and Agent."""
|
|
|
|
# Command registry for dynamic dispatch
|
|
_COMMAND_REGISTRY: dict[str, str] = {
|
|
"sync": "paperforge.commands.sync",
|
|
"ocr": "paperforge.commands.ocr",
|
|
"deep": "paperforge.commands.deep",
|
|
"repair": "paperforge.commands.repair",
|
|
"status": "paperforge.commands.status",
|
|
"context": "paperforge.commands.context",
|
|
"dashboard": "paperforge.commands.dashboard",
|
|
"finalize": "paperforge.commands.finalize",
|
|
"memory": "paperforge.commands.memory",
|
|
"embed": "paperforge.commands.embed",
|
|
"retrieve": "paperforge.commands.retrieve",
|
|
"query-plan": "paperforge.commands.query_plan",
|
|
"paper-status": "paperforge.commands.paper_status",
|
|
"agent-context": "paperforge.commands.agent_context",
|
|
"prune": "paperforge.commands.prune",
|
|
"paper-navigation": "paperforge.commands.paper_navigation",
|
|
"reading-log": "paperforge.commands.reading_log",
|
|
"paper-lookup": "paperforge.commands.paper_lookup",
|
|
"content-discovery": "paperforge.commands.content_discovery",
|
|
"scoped-fetch": "paperforge.commands.scoped_fetch",
|
|
}
|
|
|
|
|
|
def get_command_module(name: str):
|
|
"""Dynamically import a command module by name."""
|
|
import importlib
|
|
|
|
module_path = _COMMAND_REGISTRY.get(name)
|
|
if module_path is None:
|
|
raise ValueError(f"Unknown command: {name}")
|
|
return importlib.import_module(module_path)
|
|
|
|
|
|
__all__ = ["get_command_module", "_COMMAND_REGISTRY"]
|