Add --print-rules-info CLI flag for host cache freshness lookup
This commit is contained in:
@@ -409,6 +409,10 @@ def main():
|
||||
"using the current ID extraction rules. No rclone calls — "
|
||||
"fast path for picking up rule changes without re-scanning. "
|
||||
"Outputs JSON when --format json, plain otherwise.")
|
||||
ap.add_argument("--print-rules-info", action="store_true",
|
||||
help="Print cache contract version constants and current "
|
||||
"rules signature as JSON, then exit. Used by the native-"
|
||||
"messaging host to surface cache freshness in the UI.")
|
||||
ap.add_argument("--basic", action="store_true",
|
||||
help="Plain text output, no rich tables/panels/progress bars. "
|
||||
"Useful for piping or low-bandwidth terminals.")
|
||||
@@ -485,6 +489,18 @@ def main():
|
||||
args.catalog = list(DEFAULT_CATALOG)
|
||||
|
||||
# --library-issues: read-only cache scan for non-canonical filenames.
|
||||
# --print-rules-info: report current cache contract constants + rules signature.
|
||||
if args.print_rules_info:
|
||||
from rcjav.cache import CACHE_SCHEMA_VERSION, ID_RULES_VERSION
|
||||
from rcjav.ids import current_rules_signature
|
||||
print(json.dumps({
|
||||
"ok": True,
|
||||
"cache_schema": CACHE_SCHEMA_VERSION,
|
||||
"id_rules": ID_RULES_VERSION,
|
||||
"id_rules_signature": current_rules_signature(),
|
||||
}))
|
||||
sys.exit(0)
|
||||
|
||||
# --reextract: rebuild jav_id values from current rules without re-scanning.
|
||||
if args.reextract:
|
||||
from rcjav.ids import current_rules_signature
|
||||
|
||||
Reference in New Issue
Block a user