terp-cli 0.2.0__tar.gz → 0.4.0__tar.gz

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.
@@ -0,0 +1,16 @@
1
+ Metadata-Version: 2.4
2
+ Name: terp-cli
3
+ Version: 0.4.0
4
+ Summary: Terp command-line tool — inspect, scaffolding, migrations, checks, api-docs.
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.13
7
+ Requires-Dist: terp-arch==0.4.0
8
+ Requires-Dist: terp-core==0.4.0
9
+ Requires-Dist: terp-migrations==0.4.0
10
+ Provides-Extra: jobs
11
+ Requires-Dist: terp-cap-outbox==0.4.0; extra == 'jobs'
12
+ Requires-Dist: terp-cap-scheduler-apscheduler==0.4.0; extra == 'jobs'
13
+ Provides-Extra: scheduler
14
+ Requires-Dist: terp-cap-scheduler-apscheduler==0.4.0; extra == 'scheduler'
15
+ Provides-Extra: worker
16
+ Requires-Dist: terp-cap-outbox==0.4.0; extra == 'worker'
@@ -4,29 +4,29 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "terp-cli"
7
- version = "0.2.0"
7
+ version = "0.4.0"
8
8
  description = "Terp command-line tool — inspect, scaffolding, migrations, checks, api-docs."
9
9
  requires-python = ">=3.13"
10
10
  license = "Apache-2.0"
11
11
  dependencies = [
12
- "terp-core==0.2.0",
12
+ "terp-core==0.4.0",
13
13
  # `terp migrate` delegates to terp-migrations (lazily imported), keeping Alembic
14
14
  # off the path for `terp inspect` / `terp guide` while making migrations work.
15
- "terp-migrations==0.2.0",
15
+ "terp-migrations==0.4.0",
16
16
  # `terp guide rules` projects the live rule registry; terp-arch is imported lazily
17
17
  # (only when that topic is rendered), so it stays off the common `terp guide` path.
18
- "terp-arch==0.2.0",
18
+ "terp-arch==0.4.0",
19
19
  ]
20
20
 
21
21
  # Job-process adapters stay optional: the base CLI must not install the table-owning outbox
22
22
  # or a scheduler engine into apps that only use inspect/check/migrate. Deployments can select
23
23
  # one process role, while `jobs` is the convenient complete jobs-process bundle.
24
24
  [project.optional-dependencies]
25
- worker = ["terp-cap-outbox==0.2.0"]
26
- scheduler = ["terp-cap-scheduler-apscheduler==0.2.0"]
25
+ worker = ["terp-cap-outbox==0.4.0"]
26
+ scheduler = ["terp-cap-scheduler-apscheduler==0.4.0"]
27
27
  jobs = [
28
- "terp-cap-outbox==0.2.0",
29
- "terp-cap-scheduler-apscheduler==0.2.0",
28
+ "terp-cap-outbox==0.4.0",
29
+ "terp-cap-scheduler-apscheduler==0.4.0",
30
30
  ]
31
31
 
32
32
  [project.scripts]
@@ -683,6 +683,25 @@ def guide(topic: str | None = None) -> str:
683
683
  return _render_rule_guide(topic)
684
684
 
685
685
 
686
+ def gate_root(root: str | pathlib.Path = ".", *, package: str = "app") -> pathlib.Path:
687
+ """Resolve the directory the architecture gate scans, from a CLI ``--root``.
688
+
689
+ The gate's unit of scope is the **app package** — the test harness calls
690
+ ``assert_app_clean("app")``, so ``app/`` is what the rules walk. A CLI ``--root``,
691
+ though, is naturally the *project* root (that is where every other ``terp``
692
+ command runs, and the default is ``.``), which also contains code the gate does
693
+ not govern: a standalone ``engine/``, ``conformance/``, tooling scripts. Scanning
694
+ that made the two entry points to the same gate disagree about scope.
695
+
696
+ So ``--root`` accepts either: if it contains the app package, the package dir is
697
+ the scan root; otherwise *root* is already the package dir and is used as-is.
698
+ Both spellings then hold the app to exactly the scope ``uv run pytest`` does.
699
+ """
700
+ path = pathlib.Path(root)
701
+ candidate = path / package
702
+ return candidate if candidate.is_dir() else path
703
+
704
+
686
705
  def check_report(
687
706
  root: str = ".", *, package: str = "app", budget_path: str | None = None
688
707
  ) -> dict[str, object]:
@@ -706,9 +725,10 @@ def check_report(
706
725
  from terp.arch import check_app, guide_topic_for, ungoverned_marker_violations
707
726
  from terp.arch.rules import GUIDE_TOPIC_BY_RULE
708
727
 
709
- violations = list(check_app(root, package=package, budget_path=budget_path))
728
+ scan_root = gate_root(root, package=package)
729
+ violations = list(check_app(scan_root, package=package, budget_path=budget_path))
710
730
  if budget_path is None:
711
- violations.extend(ungoverned_marker_violations(root, package=package))
731
+ violations.extend(ungoverned_marker_violations(scan_root, package=package))
712
732
  violations.sort(key=lambda violation: (violation.path, violation.line, violation.rule))
713
733
  rules = set(GUIDE_TOPIC_BY_RULE)
714
734
  if budget_path is None:
@@ -1349,7 +1369,12 @@ def _build_parser() -> argparse.ArgumentParser:
1349
1369
  )
1350
1370
 
1351
1371
  check_parser = subcommands.add_parser("check", help="Run the architecture gate locally")
1352
- check_parser.add_argument("--root", default=".", help="App root (default: .)")
1372
+ check_parser.add_argument(
1373
+ "--root",
1374
+ default=".",
1375
+ help="Project root, or the app package itself; the gate scans the app package "
1376
+ "(default: .)",
1377
+ )
1353
1378
  check_parser.add_argument("--package", default="app", help="App package (default: app)")
1354
1379
  check_parser.add_argument(
1355
1380
  "--budget", default=None, help="Escape-hatch budget JSON (governs # arch-allow markers)"
@@ -1569,7 +1594,11 @@ def main(argv: Sequence[str] | None = None) -> None:
1569
1594
  return
1570
1595
  from terp.arch import assert_app_clean
1571
1596
 
1572
- assert_app_clean(args.root, package=args.package, budget_path=args.budget)
1597
+ assert_app_clean(
1598
+ gate_root(args.root, package=args.package),
1599
+ package=args.package,
1600
+ budget_path=args.budget,
1601
+ )
1573
1602
  print("terp.arch: app is clean")
1574
1603
  return
1575
1604
  if args.command == "verify":
@@ -1613,6 +1642,7 @@ __all__ = [
1613
1642
  "create_user_command",
1614
1643
  "dev_plan",
1615
1644
  "export_openapi",
1645
+ "gate_root",
1616
1646
  "guide",
1617
1647
  "guide_topics",
1618
1648
  "guide_choices",
terp_cli-0.2.0/PKG-INFO DELETED
@@ -1,16 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: terp-cli
3
- Version: 0.2.0
4
- Summary: Terp command-line tool — inspect, scaffolding, migrations, checks, api-docs.
5
- License-Expression: Apache-2.0
6
- Requires-Python: >=3.13
7
- Requires-Dist: terp-arch==0.2.0
8
- Requires-Dist: terp-core==0.2.0
9
- Requires-Dist: terp-migrations==0.2.0
10
- Provides-Extra: jobs
11
- Requires-Dist: terp-cap-outbox==0.2.0; extra == 'jobs'
12
- Requires-Dist: terp-cap-scheduler-apscheduler==0.2.0; extra == 'jobs'
13
- Provides-Extra: scheduler
14
- Requires-Dist: terp-cap-scheduler-apscheduler==0.2.0; extra == 'scheduler'
15
- Provides-Extra: worker
16
- Requires-Dist: terp-cap-outbox==0.2.0; extra == 'worker'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes