@grifhinz/logics-manager 2.0.4 → 2.0.5
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.
- package/README.md +2 -2
- package/VERSION +1 -1
- package/logics_manager/assist.py +366 -0
- package/logics_manager/cli.py +106 -38
- package/logics_manager/flow.py +570 -1
- package/logics_manager/sync.py +138 -0
- package/logics_manager/termstyle.py +75 -0
- package/package.json +2 -1
- package/pyproject.toml +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/AlexAgo83/logics-manager/actions/workflows/ci.yml)
|
|
4
4
|
[](LICENSE)
|
|
5
|
-

|
|
6
6
|

|
|
7
7
|

|
|
8
8
|

|
|
@@ -166,7 +166,7 @@ Windows notes:
|
|
|
166
166
|
|
|
167
167
|
### Install from Marketplace
|
|
168
168
|
|
|
169
|
-
https://marketplace.visualstudio.com/items?itemName=cdx-logics.logics-
|
|
169
|
+
https://marketplace.visualstudio.com/items?itemName=cdx-logics.cdx-logics-vscode
|
|
170
170
|
|
|
171
171
|
### Install from VSIX (recommended for users)
|
|
172
172
|
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0.
|
|
1
|
+
2.0.5
|
package/logics_manager/assist.py
CHANGED
|
@@ -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)
|
package/logics_manager/cli.py
CHANGED
|
@@ -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,91 @@ 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
|
+
"self-update",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _build_root_help() -> str:
|
|
39
|
+
sections = [
|
|
40
|
+
"Logics Manager CLI",
|
|
41
|
+
"Canonical CLI for workflow, validation, and runtime ops.",
|
|
42
|
+
"",
|
|
43
|
+
"Usage:",
|
|
44
|
+
" logics-manager <command> [args...]",
|
|
45
|
+
" logics-manager config show [options]",
|
|
46
|
+
"",
|
|
47
|
+
"Top-level options:",
|
|
48
|
+
" -h, --help Show this help message and exit.",
|
|
49
|
+
" --version Print the installed version.",
|
|
50
|
+
"",
|
|
51
|
+
"Commands:",
|
|
52
|
+
" bootstrap",
|
|
53
|
+
" Prepare or check the workflow tree and generated instructions.",
|
|
54
|
+
" Options: --check, --format {text,json}",
|
|
55
|
+
"",
|
|
56
|
+
" flow",
|
|
57
|
+
" Create and manage workflow docs.",
|
|
58
|
+
" Subcommands: new, list, companion, promote, split, close, finish",
|
|
59
|
+
" Key flags: --title, --slug, --from-version, --understanding, --confidence, --status, --complexity, --theme, --progress, --format {text,json}, --dry-run",
|
|
60
|
+
"",
|
|
61
|
+
" sync",
|
|
62
|
+
" Synchronize workflow transitions and exports.",
|
|
63
|
+
" Subcommands: close-eligible-requests, refresh-mermaid-signatures, schema-status, context-pack, export-graph",
|
|
64
|
+
"",
|
|
65
|
+
" assist",
|
|
66
|
+
" Inspect runtime signals and build context bundles.",
|
|
67
|
+
" 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",
|
|
68
|
+
"",
|
|
69
|
+
" audit",
|
|
70
|
+
" Audit request, backlog, and task consistency.",
|
|
71
|
+
" 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",
|
|
72
|
+
"",
|
|
73
|
+
" index",
|
|
74
|
+
" Generate `logics/INDEX.md` from the workflow corpus.",
|
|
75
|
+
" Options: --out, --format {text,json}",
|
|
76
|
+
"",
|
|
77
|
+
" lint",
|
|
78
|
+
" Lint workflow documents for filenames, headings, and indicators.",
|
|
79
|
+
" Options: --require-status, --format {text,json}",
|
|
80
|
+
"",
|
|
81
|
+
" config show",
|
|
82
|
+
" Render the merged runtime config.",
|
|
83
|
+
" Options: --format {text,json}",
|
|
84
|
+
"",
|
|
85
|
+
" doctor",
|
|
86
|
+
" Check required workflow directories and schema metadata.",
|
|
87
|
+
" Options: --format {text,json}",
|
|
88
|
+
"",
|
|
89
|
+
" self-update",
|
|
90
|
+
" Update the installed Python or npm package.",
|
|
91
|
+
" Options: --manager {auto,pip,npm}, --package, --python-package, --dry-run",
|
|
92
|
+
"",
|
|
93
|
+
"Examples:",
|
|
94
|
+
' logics-manager flow new request --title "My request"',
|
|
95
|
+
" logics-manager audit",
|
|
96
|
+
" logics-manager config show --format json",
|
|
97
|
+
]
|
|
98
|
+
return "\n".join(sections)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _print_help(text: str) -> None:
|
|
102
|
+
print(colorize_help(text))
|
|
23
103
|
|
|
24
104
|
|
|
25
105
|
def get_cli_version() -> str:
|
|
@@ -41,34 +121,22 @@ def get_cli_version() -> str:
|
|
|
41
121
|
def main(argv: list[str] | None = None) -> int:
|
|
42
122
|
if argv is None:
|
|
43
123
|
argv = sys.argv[1:]
|
|
44
|
-
|
|
45
|
-
|
|
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()
|
|
124
|
+
if not argv:
|
|
125
|
+
_print_help(_build_root_help())
|
|
68
126
|
return 1
|
|
127
|
+
if argv[0] in ("-h", "--help"):
|
|
128
|
+
_print_help(_build_root_help())
|
|
129
|
+
return 0
|
|
130
|
+
if argv[0] == "--version":
|
|
131
|
+
print(f"logics-manager {get_cli_version()}")
|
|
132
|
+
return 0
|
|
133
|
+
|
|
134
|
+
command = argv[0]
|
|
135
|
+
if command not in ROOT_COMMANDS:
|
|
136
|
+
raise SystemExit(f"Unsupported command: {command}")
|
|
69
137
|
|
|
70
138
|
rest = argv[1:]
|
|
71
|
-
if
|
|
139
|
+
if command == "config":
|
|
72
140
|
if not rest or rest[0] != "show":
|
|
73
141
|
raise SystemExit("Usage: logics-manager config show [args...]")
|
|
74
142
|
config_args = rest[1:]
|
|
@@ -82,7 +150,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
82
150
|
raise SystemExit(str(exc)) from exc
|
|
83
151
|
print(output)
|
|
84
152
|
return 0
|
|
85
|
-
if
|
|
153
|
+
if command == "doctor":
|
|
86
154
|
doctor_args = rest
|
|
87
155
|
parser = argparse.ArgumentParser(prog="logics-manager doctor", add_help=False)
|
|
88
156
|
parser.add_argument("--format", choices=("text", "json"), default="text")
|
|
@@ -94,7 +162,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
94
162
|
raise SystemExit(str(exc)) from exc
|
|
95
163
|
print(output)
|
|
96
164
|
return 0
|
|
97
|
-
if
|
|
165
|
+
if command == "bootstrap":
|
|
98
166
|
parser = argparse.ArgumentParser(prog="logics-manager bootstrap", add_help=False)
|
|
99
167
|
parser.add_argument("--check", action="store_true")
|
|
100
168
|
parser.add_argument("--format", choices=("text", "json"), default="text")
|
|
@@ -106,7 +174,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
106
174
|
payload = bootstrap_payload(repo_root, check=parsed.check)
|
|
107
175
|
print(render_bootstrap(payload, output_format=parsed.format))
|
|
108
176
|
return 0 if payload["ok"] else 1
|
|
109
|
-
if
|
|
177
|
+
if command == "self-update":
|
|
110
178
|
parser = argparse.ArgumentParser(prog="logics-manager self-update", add_help=False)
|
|
111
179
|
parser.add_argument("--manager", choices=("auto", "pip", "npm"), default="auto")
|
|
112
180
|
parser.add_argument("--package", default=DEFAULT_SELF_UPDATE_PACKAGE)
|
|
@@ -141,21 +209,21 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
141
209
|
target = parsed.python_package if manager == "pip" else parsed.package
|
|
142
210
|
print(f"Updated {target} via {manager}.")
|
|
143
211
|
return result.returncode
|
|
144
|
-
if
|
|
212
|
+
if command == "flow" and (rest[:1] in (["new"], ["list"], ["companion"], ["promote"], ["split"], ["close"], ["finish"]) or rest[:1] in HELP_ARGV):
|
|
145
213
|
from .flow import main as flow_main
|
|
146
214
|
|
|
147
215
|
return flow_main(rest)
|
|
148
|
-
if
|
|
149
|
-
if rest[:1] not in (["close-eligible-requests"], ["refresh-mermaid-signatures"], ["schema-status"], ["context-pack"], ["export-graph"]):
|
|
216
|
+
if command == "sync":
|
|
217
|
+
if rest[:1] not in (["close-eligible-requests"], ["refresh-mermaid-signatures"], ["schema-status"], ["context-pack"], ["export-graph"]) and rest[:1] not in HELP_ARGV:
|
|
150
218
|
raise SystemExit("Unsupported sync subcommand for the native CLI slice.")
|
|
151
219
|
from .sync import main as sync_main
|
|
152
220
|
|
|
153
221
|
return sync_main(rest)
|
|
154
|
-
if
|
|
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"]):
|
|
222
|
+
if command == "assist":
|
|
223
|
+
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
224
|
raise SystemExit("Unsupported assist subcommand for the native CLI slice.")
|
|
157
225
|
return assist_main(rest)
|
|
158
|
-
if
|
|
226
|
+
if command == "audit":
|
|
159
227
|
audit_parser = build_audit_parser()
|
|
160
228
|
parsed, _unknown = audit_parser.parse_known_args(rest)
|
|
161
229
|
repo_root = find_repo_root(Path.cwd())
|
|
@@ -195,7 +263,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
195
263
|
raise SystemExit(str(exc)) from exc
|
|
196
264
|
print(output)
|
|
197
265
|
return 0 if payload["ok"] else 1
|
|
198
|
-
if
|
|
266
|
+
if command == "index":
|
|
199
267
|
parser = argparse.ArgumentParser(prog="logics-manager index", add_help=False)
|
|
200
268
|
parser.add_argument("--out", default="logics/INDEX.md")
|
|
201
269
|
parser.add_argument("--format", choices=("text", "json"), default="text")
|
|
@@ -208,7 +276,7 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
208
276
|
output = render_index(repo_root, out=parsed.out, output_format=parsed.format) if parsed.format == "json" else f"Wrote {payload['output_path']}"
|
|
209
277
|
print(output)
|
|
210
278
|
return 0 if payload["ok"] else 1
|
|
211
|
-
if
|
|
279
|
+
if command == "lint":
|
|
212
280
|
parser = argparse.ArgumentParser(prog="logics-manager lint", add_help=False)
|
|
213
281
|
parser.add_argument("--require-status", action="store_true")
|
|
214
282
|
parser.add_argument("--format", choices=("text", "json"), default="text")
|
|
@@ -221,4 +289,4 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
221
289
|
raise SystemExit(str(exc)) from exc
|
|
222
290
|
print(output)
|
|
223
291
|
return 0 if payload["ok"] else 1
|
|
224
|
-
raise SystemExit(f"Unsupported command: {
|
|
292
|
+
raise SystemExit(f"Unsupported command: {command}")
|