On this page
Detect whether a Python project uses strictcli by scanning pyproject.toml dependencies and extract its script entry point for schema dumping.
#rlsbl.strictcli_detect
#rlsbl.strictcli_detect
Detect whether a project uses strictcli and extract its entry point.
#detect_strictcli
def detect_strictcli(project_dir: str='.') -> tuple[str, str] | NoneCheck if a project uses strictcli and return its entry point info.
First checks Python (pyproject.toml). If not found, checks Go (go.mod).
For Python: if the project depends on strictcli and has a [project.scripts] entry, returns (entry_point_name, "python").
For Go: if go.mod requires github.com/smm-h/strictcli, detects the entry point (root main.go or cmd/*/main.go) and returns (package_path, "go").
Args:
project_dir: path to the project root (default: current directory).
Returns:
- A tuple (entry_point, language) if strictcli is detected, else None.
#_detect_python_strictcli
def _detect_python_strictcli(project_dir: str) -> tuple[str, str] | NoneDetect strictcli in a Python project via pyproject.toml.
#_go_mod_has_strictcli
def _go_mod_has_strictcli(project_dir: str) -> boolReturn True if go.mod requires a strictcli module.
#_go_file_imports_strictcli
def _go_file_imports_strictcli(filepath: str) -> boolReturn True if a Go source file imports a strictcli package.
Uses tree-sitter via lint/go_ast.scan_imports for accurate parsing.
#_detect_go_strictcli
def _detect_go_strictcli(project_dir: str) -> tuple[str, str] | NoneDetect strictcli in a Go project via go.mod.
Detection order:
- Root main.go that imports strictcli -> return (".", "go")
- Single cmd/*/main.go -> return ("./cmd/
/", "go") - Multiple cmd/*/main.go -> scan each for strictcli imports,
return the one that imports it