Skip to content

Commit b5393f0

Browse files
dugshubclaude
andcommitted
feat(core): export complete type system from core module (CLI-4, CLI-5)
Implements public API for CLI-4 and CLI-5 type system. Exports Added: From types.py: - Core semantic types: BranchId, ActionId, OptionKey, MenuId, StateValue - Factory functions: make_branch_id, make_action_id, make_option_key, make_menu_id - Type guards: is_branch_id, is_action_id, is_option_key, is_menu_id - Collection types: BranchList, BranchSet, ActionList, ActionSet, OptionDict, MenuList From models.py: - Base: StrictModel, BaseConfig - Actions: BashActionConfig, PythonActionConfig, ActionConfigUnion - Options: StringOptionConfig, SelectOptionConfig, PathOptionConfig, NumberOptionConfig, BooleanOptionConfig, OptionConfigUnion - Navigation: MenuConfig, BranchConfig, WizardConfig - State: SessionState, StateValue - Results: ActionResult, CollectionResult, NavigationResult From protocols.py: - Core protocols: WizardConfig, BranchConfig, SessionState - Execution protocols: ActionExecutor, OptionCollector, NavigationController Benefits: - Clean public API surface - Single import point: from cli_patterns.core import ... - Clear separation of public vs internal APIs - Complete type system available to consumers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2dbfd53 commit b5393f0

File tree

1 file changed

+116
-1
lines changed

1 file changed

+116
-1
lines changed

src/cli_patterns/core/__init__.py

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,116 @@
1-
"""Core types and protocols for CLI Patterns."""
1+
"""Core types and protocols for CLI Patterns.
2+
3+
This module provides the foundational type system for the CLI Patterns framework:
4+
5+
Types:
6+
- Semantic types: BranchId, ActionId, OptionKey, MenuId
7+
- State value types: StateValue (JSON-serializable)
8+
- Type guards and factory functions
9+
10+
Models:
11+
- Configuration models: WizardConfig, BranchConfig, MenuConfig
12+
- Action models: BashActionConfig, PythonActionConfig
13+
- Option models: StringOptionConfig, SelectOptionConfig, etc.
14+
- State models: SessionState
15+
- Result models: ActionResult, CollectionResult, NavigationResult
16+
17+
Protocols:
18+
- ActionExecutor: For executing actions
19+
- OptionCollector: For collecting option values
20+
- NavigationController: For navigation control
21+
"""
22+
23+
# Semantic types and utilities
24+
# Configuration models
25+
from cli_patterns.core.models import (
26+
ActionConfigUnion,
27+
ActionResult,
28+
BaseConfig,
29+
BashActionConfig,
30+
BooleanOptionConfig,
31+
BranchConfig,
32+
CollectionResult,
33+
MenuConfig,
34+
NavigationResult,
35+
NumberOptionConfig,
36+
OptionConfigUnion,
37+
PathOptionConfig,
38+
PythonActionConfig,
39+
SelectOptionConfig,
40+
SessionState,
41+
StringOptionConfig,
42+
WizardConfig,
43+
)
44+
45+
# Protocols
46+
from cli_patterns.core.protocols import (
47+
ActionExecutor,
48+
NavigationController,
49+
OptionCollector,
50+
)
51+
from cli_patterns.core.types import (
52+
ActionId,
53+
ActionList,
54+
ActionSet,
55+
BranchId,
56+
BranchList,
57+
BranchSet,
58+
MenuId,
59+
MenuList,
60+
OptionDict,
61+
OptionKey,
62+
StateValue,
63+
is_action_id,
64+
is_branch_id,
65+
is_menu_id,
66+
is_option_key,
67+
make_action_id,
68+
make_branch_id,
69+
make_menu_id,
70+
make_option_key,
71+
)
72+
73+
__all__ = [
74+
# Types
75+
"ActionId",
76+
"ActionList",
77+
"ActionSet",
78+
"BranchId",
79+
"BranchList",
80+
"BranchSet",
81+
"MenuId",
82+
"MenuList",
83+
"OptionDict",
84+
"OptionKey",
85+
"StateValue",
86+
"is_action_id",
87+
"is_branch_id",
88+
"is_menu_id",
89+
"is_option_key",
90+
"make_action_id",
91+
"make_branch_id",
92+
"make_menu_id",
93+
"make_option_key",
94+
# Models
95+
"ActionConfigUnion",
96+
"ActionResult",
97+
"BaseConfig",
98+
"BashActionConfig",
99+
"BooleanOptionConfig",
100+
"BranchConfig",
101+
"CollectionResult",
102+
"MenuConfig",
103+
"NavigationResult",
104+
"NumberOptionConfig",
105+
"OptionConfigUnion",
106+
"PathOptionConfig",
107+
"PythonActionConfig",
108+
"SelectOptionConfig",
109+
"SessionState",
110+
"StringOptionConfig",
111+
"WizardConfig",
112+
# Protocols
113+
"ActionExecutor",
114+
"NavigationController",
115+
"OptionCollector",
116+
]

0 commit comments

Comments
 (0)