(args: list[str])
| 549 | |
| 550 | |
| 551 | def _cmd_debug(args: list[str]) -> None: |
| 552 | flags, rest = _parse_flags(args, {"system-prompt": True}) |
| 553 | |
| 554 | prompt = " ".join(rest) |
| 555 | if not prompt: |
| 556 | print("Error: no prompt provided", file=sys.stderr) |
| 557 | sys.exit(1) |
| 558 | |
| 559 | system_prompt = str(flags["system-prompt"]) if "system-prompt" in flags else None |
| 560 | full_text = f"{system_prompt or ''} {prompt}".strip() |
| 561 | |
| 562 | result = classify(prompt, system_prompt) |
| 563 | |
| 564 | struct_dims = extract_structural_features(full_text) |
| 565 | unicode_blocks = extract_unicode_block_features(full_text) |
| 566 | |
| 567 | tier_str = result.tier.value if result.tier else "AMBIGUOUS" |
| 568 | print(f" Tier: {tier_str}") |
| 569 | print(f" Complexity: {result.complexity:.3f}") |
| 570 | print(f" Confidence: {result.confidence:.3f}") |
| 571 | print(f" Signals: {', '.join(result.signals)}") |
| 572 | print() |
| 573 | |
| 574 | print(" Structural Features:") |
| 575 | for d in struct_dims: |
| 576 | sig = f" [{d.signal}]" if d.signal else "" |
| 577 | print(f" {d.name:<28} {d.score:>7.3f}{sig}") |
| 578 | |
| 579 | print() |
| 580 | print(" Unicode Blocks:") |
| 581 | for name, prop in sorted(unicode_blocks.items(), key=lambda x: -x[1]): |
| 582 | if prop > 0.001: |
| 583 | print(f" {name:<28} {prop:>7.3f}") |
| 584 | |
| 585 | |
| 586 | def _cmd_serve(args: list[str]) -> None: |
nothing calls this directly
no test coverage detected