Coverage for lintro / tools / core / manifest_models.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-04-03 18:53 +0000

1"""Data classes for the tool manifest schema.""" 

2 

3from __future__ import annotations 

4 

5from dataclasses import dataclass, field 

6 

7 

8@dataclass(frozen=True) 

9class ManifestTool: 

10 """Single tool entry from manifest.json v2. 

11 

12 Attributes: 

13 name: Canonical tool name (e.g., "ruff", "hadolint"). 

14 version: Expected/minimum version string. 

15 install_type: Installation method (pip, npm, binary, cargo, rustup). 

16 install_package: Package name for pip/npm/cargo installs. 

17 install_bin: Binary name if different from package. 

18 install_component: Rustup component name (e.g., "clippy"). 

19 tier: Tool tier — "tools" (production) or "dev" (optional). 

20 category: Display grouping — "bundled", "npm", or "external". 

21 version_command: Command to check installed version. 

22 languages: Language/ecosystem tags for project detection. 

23 tags: Semantic tags (e.g., "formatter", "linter", "security"). 

24 """ 

25 

26 name: str 

27 version: str 

28 install_type: str 

29 install_package: str | None = None 

30 install_bin: str | None = None 

31 install_component: str | None = None 

32 tier: str = "tools" 

33 category: str = "external" 

34 version_command: tuple[str, ...] = field(default_factory=tuple) 

35 languages: tuple[str, ...] = field(default_factory=tuple) 

36 tags: tuple[str, ...] = field(default_factory=tuple) 

37 

38 

39@dataclass(frozen=True) 

40class ProfileDefinition: 

41 """Named tool profile from manifest.json. 

42 

43 Attributes: 

44 name: Profile identifier (e.g., "minimal", "recommended"). 

45 description: Human-readable description. 

46 strategy: Resolution strategy — "explicit", "auto-detect", "all", "filter". 

47 tools: Explicit tool list (for "explicit" strategy). 

48 exclude_types: Tool types to exclude (for "filter" strategy). 

49 """ 

50 

51 name: str 

52 description: str 

53 strategy: str = "explicit" 

54 tools: tuple[str, ...] = field(default_factory=tuple) 

55 exclude_types: tuple[str, ...] = field(default_factory=tuple)