@grifhinz/logics-manager 2.0.4 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ from typing import Any
14
14
  from .config import ConfigError, find_repo_root, load_repo_config
15
15
  from .doctor import doctor_payload
16
16
  from .lint import lint_payload
17
+ from .termstyle import colorize_help
17
18
 
18
19
 
19
20
  DEFAULT_HYBRID_AUDIT_LOG = "logics/.cache/hybrid_assist_audit.jsonl"
@@ -21,6 +22,7 @@ DEFAULT_HYBRID_MEASUREMENT_LOG = "logics/.cache/hybrid_assist_measurements.jsonl
21
22
  DEFAULT_HYBRID_ROI_RECENT_LIMIT = 8
22
23
  DEFAULT_HYBRID_ROI_WINDOW_DAYS = 14
23
24
  DEFAULT_ESTIMATED_REMOTE_TOKENS_PER_LOCAL_RUN = 1200
25
+ HELP_FLAGS = ("-h", "--help")
24
26
 
25
27
 
26
28
  CLAUDE_BRIDGE_VARIANTS: tuple[dict[str, object], ...] = (
@@ -1347,6 +1349,364 @@ def build_parser() -> argparse.ArgumentParser:
1347
1349
  return parser
1348
1350
 
1349
1351
 
1352
+ def _build_help() -> str:
1353
+ return "\n".join(
1354
+ [
1355
+ "Logics Assist CLI",
1356
+ "Inspect runtime signals and build context bundles.",
1357
+ "",
1358
+ "Usage:",
1359
+ " logics-manager assist <command> [args...]",
1360
+ "",
1361
+ "Runtime and diagnostics:",
1362
+ " runtime-status",
1363
+ " Report local assist runtime readiness.",
1364
+ " Flags: --backend, --model-profile, --model, --ollama-host, --timeout, --format {text,json}, --out, --dry-run",
1365
+ " diff-risk",
1366
+ " Classify the current git diff using deterministic heuristics.",
1367
+ " Flags: --format {text,json}, --dry-run",
1368
+ " commit-plan",
1369
+ " Draft a minimal commit plan from the current git diff.",
1370
+ " Flags: --format {text,json}, --dry-run",
1371
+ " changed-surface-summary",
1372
+ " Summarize the current changed repository surface.",
1373
+ " Flags: --format {text,json}, --dry-run",
1374
+ "",
1375
+ "Review and governance:",
1376
+ " doc-consistency",
1377
+ " Review workflow docs for consistency issues without mutating them.",
1378
+ " Flags: --format {text,json}, --dry-run",
1379
+ " review-checklist",
1380
+ " Generate a bounded review checklist for the current change surface.",
1381
+ " Flags: --format {text,json}, --dry-run",
1382
+ " validation-checklist",
1383
+ " Generate a deterministic validation checklist from the current change surface.",
1384
+ " Flags: --format {text,json}, --dry-run",
1385
+ " validation-summary",
1386
+ " Summarize lint, doctor, and validation impact signals.",
1387
+ " Flags: --format {text,json}, --dry-run",
1388
+ " test-impact-summary",
1389
+ " Summarize the likely test impact of the current change surface.",
1390
+ " Flags: --format {text,json}, --dry-run",
1391
+ " roi-report",
1392
+ " Summarize hybrid assist ROI from local audit and measurement logs.",
1393
+ " Flags: --audit-log, --measurement-log, --recent-limit, --window-days, --format {text,json}, --out, --dry-run",
1394
+ "",
1395
+ "Context and prompts:",
1396
+ " claude-bridges",
1397
+ " Render the canonical Claude runtime publication manifest and prompts.",
1398
+ " Flags: --format {text,json}, --dry-run",
1399
+ " context <flow_name> [ref]",
1400
+ " Build a shared assist context bundle for a flow.",
1401
+ " Flags: --context-mode {summary-only,diff-first,full}, --profile {tiny,normal,deep}, --include-graph, --include-registry, --include-doctor, --format {text,json}, --out, --dry-run",
1402
+ " claude-instructions",
1403
+ " Render the canonical assistant instructions derived from the integrated runtime.",
1404
+ " Flags: --format {text,json}, --dry-run",
1405
+ " next-step [ref]",
1406
+ " Suggest the next bounded Logics step for a target doc.",
1407
+ " Flags: --format {text,json}, --dry-run",
1408
+ " request-draft",
1409
+ " Draft a bounded request doc from an intent.",
1410
+ " Flags: --intent, --format {text,json}, --execution-mode {suggestion-only,execute}, --dry-run",
1411
+ " spec-first-pass <ref>",
1412
+ " Draft a first-pass spec outline from a backlog item.",
1413
+ " Flags: --format {text,json}, --execution-mode {suggestion-only,execute}, --dry-run",
1414
+ " backlog-groom <ref>",
1415
+ " Draft a bounded backlog proposal from a request doc.",
1416
+ " Flags: --format {text,json}, --execution-mode {suggestion-only,execute}, --dry-run",
1417
+ " closure-summary [ref]",
1418
+ " Summarize a delivered request, backlog item, or task.",
1419
+ " Flags: --format {text,json}, --dry-run",
1420
+ "",
1421
+ "Examples:",
1422
+ " logics-manager assist runtime-status --format json",
1423
+ " logics-manager assist context request req_001_my_request --profile deep",
1424
+ " logics-manager assist request-draft --intent \"Improve onboarding\"",
1425
+ ]
1426
+ )
1427
+
1428
+
1429
+ def _build_command_help(command: str) -> str:
1430
+ if command == "runtime-status":
1431
+ return "\n".join(
1432
+ [
1433
+ "Logics Assist Runtime Status",
1434
+ "Report local assist runtime readiness.",
1435
+ "",
1436
+ "Usage:",
1437
+ " logics-manager assist runtime-status [args...]",
1438
+ "",
1439
+ "Flags:",
1440
+ " --backend",
1441
+ " --model-profile",
1442
+ " --model",
1443
+ " --ollama-host",
1444
+ " --timeout",
1445
+ " --format {text,json}",
1446
+ " --out",
1447
+ " --dry-run",
1448
+ ]
1449
+ )
1450
+ if command == "context":
1451
+ return "\n".join(
1452
+ [
1453
+ "Logics Assist Context",
1454
+ "Build a shared assist context bundle for a flow.",
1455
+ "",
1456
+ "Usage:",
1457
+ " logics-manager assist context <flow_name> [ref] [args...]",
1458
+ "",
1459
+ "Flags:",
1460
+ " --context-mode {summary-only,diff-first,full}",
1461
+ " --profile {tiny,normal,deep}",
1462
+ " --include-graph",
1463
+ " --include-registry",
1464
+ " --include-doctor",
1465
+ " --format {text,json}",
1466
+ " --out",
1467
+ " --dry-run",
1468
+ ]
1469
+ )
1470
+ if command == "request-draft":
1471
+ return "\n".join(
1472
+ [
1473
+ "Logics Assist Request Draft",
1474
+ "Draft a bounded request doc from an intent.",
1475
+ "",
1476
+ "Usage:",
1477
+ " logics-manager assist request-draft [args...]",
1478
+ "",
1479
+ "Flags:",
1480
+ " --intent",
1481
+ " --format {text,json}",
1482
+ " --execution-mode {suggestion-only,execute}",
1483
+ " --dry-run",
1484
+ ]
1485
+ )
1486
+ if command == "spec-first-pass":
1487
+ return "\n".join(
1488
+ [
1489
+ "Logics Assist Spec First Pass",
1490
+ "Draft a first-pass spec outline from a backlog item.",
1491
+ "",
1492
+ "Usage:",
1493
+ " logics-manager assist spec-first-pass <ref> [args...]",
1494
+ "",
1495
+ "Flags:",
1496
+ " --format {text,json}",
1497
+ " --execution-mode {suggestion-only,execute}",
1498
+ " --dry-run",
1499
+ ]
1500
+ )
1501
+ if command == "backlog-groom":
1502
+ return "\n".join(
1503
+ [
1504
+ "Logics Assist Backlog Groom",
1505
+ "Draft a bounded backlog proposal from a request doc.",
1506
+ "",
1507
+ "Usage:",
1508
+ " logics-manager assist backlog-groom <ref> [args...]",
1509
+ "",
1510
+ "Flags:",
1511
+ " --format {text,json}",
1512
+ " --execution-mode {suggestion-only,execute}",
1513
+ " --dry-run",
1514
+ ]
1515
+ )
1516
+ if command == "closure-summary":
1517
+ return "\n".join(
1518
+ [
1519
+ "Logics Assist Closure Summary",
1520
+ "Summarize a delivered request, backlog item, or task.",
1521
+ "",
1522
+ "Usage:",
1523
+ " logics-manager assist closure-summary [ref] [args...]",
1524
+ "",
1525
+ "Flags:",
1526
+ " --format {text,json}",
1527
+ " --dry-run",
1528
+ ]
1529
+ )
1530
+ if command == "roi-report":
1531
+ return "\n".join(
1532
+ [
1533
+ "Logics Assist ROI Report",
1534
+ "Summarize hybrid assist ROI from local audit and measurement logs.",
1535
+ "",
1536
+ "Usage:",
1537
+ " logics-manager assist roi-report [args...]",
1538
+ "",
1539
+ "Flags:",
1540
+ " --audit-log",
1541
+ " --measurement-log",
1542
+ " --recent-limit",
1543
+ " --window-days",
1544
+ " --format {text,json}",
1545
+ " --out",
1546
+ " --dry-run",
1547
+ ]
1548
+ )
1549
+ if command == "diff-risk":
1550
+ return "\n".join(
1551
+ [
1552
+ "Logics Assist Diff Risk",
1553
+ "Classify the current git diff using deterministic heuristics.",
1554
+ "",
1555
+ "Usage:",
1556
+ " logics-manager assist diff-risk [args...]",
1557
+ "",
1558
+ "Flags:",
1559
+ " --format {text,json}",
1560
+ " --dry-run",
1561
+ ]
1562
+ )
1563
+ if command == "commit-plan":
1564
+ return "\n".join(
1565
+ [
1566
+ "Logics Assist Commit Plan",
1567
+ "Draft a minimal commit plan from the current git diff.",
1568
+ "",
1569
+ "Usage:",
1570
+ " logics-manager assist commit-plan [args...]",
1571
+ "",
1572
+ "Flags:",
1573
+ " --format {text,json}",
1574
+ " --dry-run",
1575
+ ]
1576
+ )
1577
+ if command == "changed-surface-summary":
1578
+ return "\n".join(
1579
+ [
1580
+ "Logics Assist Changed Surface Summary",
1581
+ "Summarize the current changed repository surface.",
1582
+ "",
1583
+ "Usage:",
1584
+ " logics-manager assist changed-surface-summary [args...]",
1585
+ "",
1586
+ "Flags:",
1587
+ " --format {text,json}",
1588
+ " --dry-run",
1589
+ ]
1590
+ )
1591
+ if command == "doc-consistency":
1592
+ return "\n".join(
1593
+ [
1594
+ "Logics Assist Doc Consistency",
1595
+ "Review workflow docs for consistency issues without mutating them.",
1596
+ "",
1597
+ "Usage:",
1598
+ " logics-manager assist doc-consistency [args...]",
1599
+ "",
1600
+ "Flags:",
1601
+ " --format {text,json}",
1602
+ " --dry-run",
1603
+ ]
1604
+ )
1605
+ if command == "review-checklist":
1606
+ return "\n".join(
1607
+ [
1608
+ "Logics Assist Review Checklist",
1609
+ "Generate a bounded review checklist for the current change surface.",
1610
+ "",
1611
+ "Usage:",
1612
+ " logics-manager assist review-checklist [args...]",
1613
+ "",
1614
+ "Flags:",
1615
+ " --format {text,json}",
1616
+ " --dry-run",
1617
+ ]
1618
+ )
1619
+ if command == "validation-checklist":
1620
+ return "\n".join(
1621
+ [
1622
+ "Logics Assist Validation Checklist",
1623
+ "Generate a deterministic validation checklist from the current change surface.",
1624
+ "",
1625
+ "Usage:",
1626
+ " logics-manager assist validation-checklist [args...]",
1627
+ "",
1628
+ "Flags:",
1629
+ " --format {text,json}",
1630
+ " --dry-run",
1631
+ ]
1632
+ )
1633
+ if command == "validation-summary":
1634
+ return "\n".join(
1635
+ [
1636
+ "Logics Assist Validation Summary",
1637
+ "Summarize lint, doctor, and validation impact signals.",
1638
+ "",
1639
+ "Usage:",
1640
+ " logics-manager assist validation-summary [args...]",
1641
+ "",
1642
+ "Flags:",
1643
+ " --format {text,json}",
1644
+ " --dry-run",
1645
+ ]
1646
+ )
1647
+ if command == "test-impact-summary":
1648
+ return "\n".join(
1649
+ [
1650
+ "Logics Assist Test Impact Summary",
1651
+ "Summarize the likely test impact of the current change surface.",
1652
+ "",
1653
+ "Usage:",
1654
+ " logics-manager assist test-impact-summary [args...]",
1655
+ "",
1656
+ "Flags:",
1657
+ " --format {text,json}",
1658
+ " --dry-run",
1659
+ ]
1660
+ )
1661
+ if command == "claude-bridges":
1662
+ return "\n".join(
1663
+ [
1664
+ "Logics Assist Claude Bridges",
1665
+ "Render the canonical Claude runtime publication manifest and prompts.",
1666
+ "",
1667
+ "Usage:",
1668
+ " logics-manager assist claude-bridges [args...]",
1669
+ "",
1670
+ "Flags:",
1671
+ " --format {text,json}",
1672
+ " --dry-run",
1673
+ ]
1674
+ )
1675
+ if command == "claude-instructions":
1676
+ return "\n".join(
1677
+ [
1678
+ "Logics Assist Claude Instructions",
1679
+ "Render the canonical assistant instructions derived from the integrated runtime.",
1680
+ "",
1681
+ "Usage:",
1682
+ " logics-manager assist claude-instructions [args...]",
1683
+ "",
1684
+ "Flags:",
1685
+ " --format {text,json}",
1686
+ " --dry-run",
1687
+ ]
1688
+ )
1689
+ if command == "next-step":
1690
+ return "\n".join(
1691
+ [
1692
+ "Logics Assist Next Step",
1693
+ "Suggest the next bounded Logics step for a target doc.",
1694
+ "",
1695
+ "Usage:",
1696
+ " logics-manager assist next-step [ref] [args...]",
1697
+ "",
1698
+ "Flags:",
1699
+ " --format {text,json}",
1700
+ " --dry-run",
1701
+ ]
1702
+ )
1703
+ return _build_help()
1704
+
1705
+
1706
+ def _print_help(text: str) -> None:
1707
+ print(colorize_help(text))
1708
+
1709
+
1350
1710
  def _get_global_claude_home() -> Path:
1351
1711
  return Path(os.environ.get("LOGICS_CLAUDE_GLOBAL_HOME") or (Path.home() / ".claude")).resolve()
1352
1712
 
@@ -2213,6 +2573,12 @@ def cmd_context(args: argparse.Namespace) -> dict[str, object]:
2213
2573
 
2214
2574
 
2215
2575
  def main(argv: list[str]) -> int:
2576
+ if not argv or argv[0] in HELP_FLAGS:
2577
+ _print_help(_build_help())
2578
+ return 0
2579
+ if argv[0] in {"runtime-status", "context", "request-draft", "spec-first-pass", "backlog-groom", "closure-summary", "roi-report", "diff-risk", "commit-plan", "changed-surface-summary", "doc-consistency", "review-checklist", "validation-checklist", "validation-summary", "test-impact-summary", "claude-bridges", "claude-instructions", "next-step"} and len(argv) > 1 and argv[1] in HELP_FLAGS:
2580
+ _print_help(_build_command_help(argv[0]))
2581
+ return 0
2216
2582
  parser = build_parser()
2217
2583
  args = parser.parse_args(argv)
2218
2584
  payload = args.func(args)
@@ -6,7 +6,6 @@ import subprocess
6
6
  import sys
7
7
  from shutil import which
8
8
  from pathlib import Path
9
- from textwrap import dedent
10
9
 
11
10
  from .bootstrap import bootstrap_payload, render_bootstrap
12
11
  from .assist import main as assist_main
@@ -16,10 +15,97 @@ from .config import ConfigError, find_repo_root, render_config_show
16
15
  from .index import index_payload, render_index
17
16
  from .lint import lint_payload, render_lint
18
17
  from .doctor import render_doctor
18
+ from .termstyle import colorize_help
19
19
 
20
20
 
21
21
  DEFAULT_SELF_UPDATE_PY_PACKAGE = "logics-manager"
22
22
  DEFAULT_SELF_UPDATE_PACKAGE = "@grifhinz/logics-manager"
23
+ HELP_ARGV = (["-h"], ["--help"])
24
+ ROOT_COMMANDS = (
25
+ "bootstrap",
26
+ "flow",
27
+ "sync",
28
+ "assist",
29
+ "audit",
30
+ "index",
31
+ "lint",
32
+ "config",
33
+ "doctor",
34
+ "mcp",
35
+ "self-update",
36
+ )
37
+
38
+
39
+ def _build_root_help() -> str:
40
+ sections = [
41
+ "Logics Manager CLI",
42
+ "Canonical CLI for workflow, validation, and runtime ops.",
43
+ "",
44
+ "Usage:",
45
+ " logics-manager <command> [args...]",
46
+ " logics-manager config show [options]",
47
+ "",
48
+ "Top-level options:",
49
+ " -h, --help Show this help message and exit.",
50
+ " -v, --version Print the installed version.",
51
+ " --version Print the installed version.",
52
+ "",
53
+ "Commands:",
54
+ " bootstrap",
55
+ " Prepare or check the workflow tree and generated instructions.",
56
+ " Options: --check, --format {text,json}",
57
+ "",
58
+ " flow",
59
+ " Create and manage workflow docs.",
60
+ " Subcommands: new, list, companion, promote, split, close, finish",
61
+ " Key flags: --title, --slug, --from-version, --understanding, --confidence, --status, --complexity, --theme, --progress, --format {text,json}, --dry-run",
62
+ "",
63
+ " sync",
64
+ " Synchronize workflow transitions and exports.",
65
+ " Subcommands: close-eligible-requests, refresh-mermaid-signatures, schema-status, read-doc, list-docs, search-docs, update-indicators, append-note, context-pack, export-graph",
66
+ "",
67
+ " assist",
68
+ " Inspect runtime signals and build context bundles.",
69
+ " Subcommands: runtime-status, diff-risk, commit-plan, changed-surface-summary, doc-consistency, review-checklist, validation-checklist, validation-summary, test-impact-summary, roi-report, claude-bridges, context, claude-instructions, next-step, request-draft, spec-first-pass, backlog-groom, closure-summary",
70
+ "",
71
+ " audit",
72
+ " Audit request, backlog, and task consistency.",
73
+ " Options: --stale-days, --skip-ac-traceability, --skip-gates, --legacy-cutoff-version, --format {text,json}, --group-by-doc, --autofix-ac-traceability, --paths, --refs, --since-version, --token-hygiene, --autofix-structure, --governance-profile",
74
+ "",
75
+ " index",
76
+ " Generate `logics/INDEX.md` from the workflow corpus.",
77
+ " Options: --out, --format {text,json}",
78
+ "",
79
+ " lint",
80
+ " Lint workflow documents for filenames, headings, and indicators.",
81
+ " Options: --require-status, --format {text,json}",
82
+ "",
83
+ " config show",
84
+ " Render the merged runtime config.",
85
+ " Options: --format {text,json}",
86
+ "",
87
+ " doctor",
88
+ " Check required workflow directories and schema metadata.",
89
+ " Options: --format {text,json}",
90
+ "",
91
+ " mcp",
92
+ " Expose bounded Logics tools for MCP clients.",
93
+ " Subcommands: serve, serve-http, connect, tools, call",
94
+ "",
95
+ " self-update",
96
+ " Update the installed Python or npm package.",
97
+ " Options: --manager {auto,pip,npm}, --package, --python-package, --dry-run",
98
+ "",
99
+ "Examples:",
100
+ ' logics-manager flow new request --title "My request"',
101
+ " logics-manager audit",
102
+ " logics-manager config show --format json",
103
+ ]
104
+ return "\n".join(sections)
105
+
106
+
107
+ def _print_help(text: str) -> None:
108
+ print(colorize_help(text))
23
109
 
24
110
 
25
111
  def get_cli_version() -> str:
@@ -41,34 +127,22 @@ def get_cli_version() -> str:
41
127
  def main(argv: list[str] | None = None) -> int:
42
128
  if argv is None:
43
129
  argv = sys.argv[1:]
44
- parser = argparse.ArgumentParser(
45
- prog="logics-manager",
46
- description="Canonical Logics CLI for workflow, validation, and runtime operations.",
47
- formatter_class=argparse.RawDescriptionHelpFormatter,
48
- epilog=dedent(
49
- """
50
- Examples:
51
- logics-manager flow new request --title "My request"
52
- logics-manager audit
53
- logics-manager config show --format json
54
- """
55
- ).strip(),
56
- )
57
- parser.add_argument("--version", action="version", version=f"logics-manager {get_cli_version()}")
58
- parser.add_argument(
59
- "command",
60
- nargs="?",
61
- choices=("bootstrap", "flow", "sync", "assist", "audit", "index", "lint", "config", "doctor", "self-update"),
62
- )
63
- parser.add_argument("rest", nargs=argparse.REMAINDER)
64
- args = parser.parse_args(argv[:1])
65
-
66
- if args.command is None:
67
- parser.print_help()
130
+ if not argv:
131
+ _print_help(_build_root_help())
68
132
  return 1
133
+ if argv[0] in ("-h", "--help"):
134
+ _print_help(_build_root_help())
135
+ return 0
136
+ if argv[0] in {"-v", "--version"}:
137
+ print(f"logics-manager {get_cli_version()}")
138
+ return 0
139
+
140
+ command = argv[0]
141
+ if command not in ROOT_COMMANDS:
142
+ raise SystemExit(f"Unsupported command: {command}")
69
143
 
70
144
  rest = argv[1:]
71
- if args.command == "config":
145
+ if command == "config":
72
146
  if not rest or rest[0] != "show":
73
147
  raise SystemExit("Usage: logics-manager config show [args...]")
74
148
  config_args = rest[1:]
@@ -82,7 +156,7 @@ def main(argv: list[str] | None = None) -> int:
82
156
  raise SystemExit(str(exc)) from exc
83
157
  print(output)
84
158
  return 0
85
- if args.command == "doctor":
159
+ if command == "doctor":
86
160
  doctor_args = rest
87
161
  parser = argparse.ArgumentParser(prog="logics-manager doctor", add_help=False)
88
162
  parser.add_argument("--format", choices=("text", "json"), default="text")
@@ -94,7 +168,7 @@ def main(argv: list[str] | None = None) -> int:
94
168
  raise SystemExit(str(exc)) from exc
95
169
  print(output)
96
170
  return 0
97
- if args.command == "bootstrap":
171
+ if command == "bootstrap":
98
172
  parser = argparse.ArgumentParser(prog="logics-manager bootstrap", add_help=False)
99
173
  parser.add_argument("--check", action="store_true")
100
174
  parser.add_argument("--format", choices=("text", "json"), default="text")
@@ -106,7 +180,7 @@ def main(argv: list[str] | None = None) -> int:
106
180
  payload = bootstrap_payload(repo_root, check=parsed.check)
107
181
  print(render_bootstrap(payload, output_format=parsed.format))
108
182
  return 0 if payload["ok"] else 1
109
- if args.command == "self-update":
183
+ if command == "self-update":
110
184
  parser = argparse.ArgumentParser(prog="logics-manager self-update", add_help=False)
111
185
  parser.add_argument("--manager", choices=("auto", "pip", "npm"), default="auto")
112
186
  parser.add_argument("--package", default=DEFAULT_SELF_UPDATE_PACKAGE)
@@ -141,21 +215,25 @@ def main(argv: list[str] | None = None) -> int:
141
215
  target = parsed.python_package if manager == "pip" else parsed.package
142
216
  print(f"Updated {target} via {manager}.")
143
217
  return result.returncode
144
- if args.command == "flow" and rest[:1] in (["new"], ["companion"], ["promote"], ["split"], ["close"], ["finish"]):
218
+ if command == "flow" and (rest[:1] in (["new"], ["list"], ["companion"], ["promote"], ["split"], ["close"], ["finish"]) or rest[:1] in HELP_ARGV):
145
219
  from .flow import main as flow_main
146
220
 
147
221
  return flow_main(rest)
148
- if args.command == "sync":
149
- if rest[:1] not in (["close-eligible-requests"], ["refresh-mermaid-signatures"], ["schema-status"], ["context-pack"], ["export-graph"]):
222
+ if command == "sync":
223
+ if rest[:1] not in (["close-eligible-requests"], ["refresh-mermaid-signatures"], ["schema-status"], ["read-doc"], ["list-docs"], ["search-docs"], ["update-indicators"], ["append-note"], ["context-pack"], ["export-graph"]) and rest[:1] not in HELP_ARGV:
150
224
  raise SystemExit("Unsupported sync subcommand for the native CLI slice.")
151
225
  from .sync import main as sync_main
152
226
 
153
227
  return sync_main(rest)
154
- if args.command == "assist":
155
- if rest[:1] not in (["runtime-status"], ["diff-risk"], ["commit-plan"], ["changed-surface-summary"], ["doc-consistency"], ["review-checklist"], ["validation-checklist"], ["validation-summary"], ["test-impact-summary"], ["roi-report"], ["next-step"], ["claude-bridges"], ["claude-instructions"], ["request-draft"], ["spec-first-pass"], ["backlog-groom"], ["closure-summary"], ["context"]):
228
+ if command == "assist":
229
+ if rest[:1] not in (["runtime-status"], ["diff-risk"], ["commit-plan"], ["changed-surface-summary"], ["doc-consistency"], ["review-checklist"], ["validation-checklist"], ["validation-summary"], ["test-impact-summary"], ["roi-report"], ["next-step"], ["claude-bridges"], ["claude-instructions"], ["request-draft"], ["spec-first-pass"], ["backlog-groom"], ["closure-summary"], ["context"]) and rest[:1] not in HELP_ARGV:
156
230
  raise SystemExit("Unsupported assist subcommand for the native CLI slice.")
157
231
  return assist_main(rest)
158
- if args.command == "audit":
232
+ if command == "mcp":
233
+ from .mcp import main as mcp_main
234
+
235
+ return mcp_main(rest)
236
+ if command == "audit":
159
237
  audit_parser = build_audit_parser()
160
238
  parsed, _unknown = audit_parser.parse_known_args(rest)
161
239
  repo_root = find_repo_root(Path.cwd())
@@ -195,7 +273,7 @@ def main(argv: list[str] | None = None) -> int:
195
273
  raise SystemExit(str(exc)) from exc
196
274
  print(output)
197
275
  return 0 if payload["ok"] else 1
198
- if args.command == "index":
276
+ if command == "index":
199
277
  parser = argparse.ArgumentParser(prog="logics-manager index", add_help=False)
200
278
  parser.add_argument("--out", default="logics/INDEX.md")
201
279
  parser.add_argument("--format", choices=("text", "json"), default="text")
@@ -208,7 +286,7 @@ def main(argv: list[str] | None = None) -> int:
208
286
  output = render_index(repo_root, out=parsed.out, output_format=parsed.format) if parsed.format == "json" else f"Wrote {payload['output_path']}"
209
287
  print(output)
210
288
  return 0 if payload["ok"] else 1
211
- if args.command == "lint":
289
+ if command == "lint":
212
290
  parser = argparse.ArgumentParser(prog="logics-manager lint", add_help=False)
213
291
  parser.add_argument("--require-status", action="store_true")
214
292
  parser.add_argument("--format", choices=("text", "json"), default="text")
@@ -221,4 +299,4 @@ def main(argv: list[str] | None = None) -> int:
221
299
  raise SystemExit(str(exc)) from exc
222
300
  print(output)
223
301
  return 0 if payload["ok"] else 1
224
- raise SystemExit(f"Unsupported command: {args.command}")
302
+ raise SystemExit(f"Unsupported command: {command}")