Skip to content
rlsbl.strictcli_detect
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.

#StrictcliDetectError

The project requires strictcli but its entry point cannot be determined -- callers must treat this as a hard error, never as 'project does not use strictcli'.

#detect_strictcli

python
def detect_strictcli(project_dir: str='.') -> tuple[str, str] | None

Check if a project uses strictcli and return its entry point info.

Checks Python (pyproject.toml), then Go (go.mod), then TypeScript (package.json) -- one branch per strictcli implementation.

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, enumerates main packages via the go toolchain (go_introspect) and returns (package_path, "go") -- see _detect_go_strictcli for the resolution rules (single main, or the one main whose dir imports strictcli).

For TypeScript: if package.json depends on the strictcli npm package and declares a bin, returns (bin_script_path, "typescript").

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

python
def _detect_python_strictcli(project_dir: str) -> tuple[str, str] | None

Detect strictcli in a Python project via pyproject.toml.

#_detect_ts_strictcli

python
def _detect_ts_strictcli(project_dir: str) -> tuple[str, str] | None

Detect strictcli in a TypeScript/npm project via package.json.

A strictcli TS app depends on the strictcli npm package and declares a bin. The entry point is the bin's SCRIPT PATH (not its command name): the dump runs it with node directly, so it does not depend on the package having been installed or linked first.

bin takes two shapes -- a bare string (the package's own name is the command) or a map of command name to path. A map with several commands is resolved the way the Go branch resolves several main packages: it is not resolvable, so it is a hard error rather than a silent "no strictcli here".

#_is_strictcli_module_path

python
def _is_strictcli_module_path(path: str) -> bool

Return True if a Go module path is strictcli or a sub-path of it (e.g. github.com/smm-h/strictcli/go), not a mere string prefix (e.g. github.com/smm-h/strictcli-extras).

#_go_mod_has_strictcli

python
def _go_mod_has_strictcli(project_dir: str) -> bool

Return True if go.mod has a require directive for a strictcli module.

Only require directives count -- both the single-line form (require path version) and the block form (require ( ... )). The module declaration is never a match: the strictcli library's own go.mod declares module github.com/smm-h/strictcli/go, and treating that as a dependency made rlsbl demand a strictcli entry point from the strictcli library itself.

#_go_file_imports_strictcli

python
def _go_file_imports_strictcli(filepath: str) -> bool

Return True if a Go source file imports a strictcli package.

Uses tree-sitter via lint/go_ast.scan_imports for accurate parsing.

The containment question is the shared one (:mod:rlsbl.module_paths), not a bare startswith: this used to read an import of an unrelated github.com/smm-h/strictcli-extras/... as an import of strictcli, and this function is the tie-breaker that picks a repo's CLI entry point when several main packages exist.

#_go_package_imports_strictcli

python
def _go_package_imports_strictcli(project_dir: str, rel_dir: str) -> bool

Return True if any .go file in the package dir imports strictcli.

#_entry_point_path

python
def _entry_point_path(rel_dir: str) -> str

Format a main-package rel_dir as a go run entry point path.

#_detect_go_strictcli

python
def _detect_go_strictcli(project_dir: str) -> tuple[str, str] | None

Detect strictcli in a Go project via go.mod and go list.

Main packages are enumerated with the go toolchain (go_introspect), which handles entry files not named main.go, _test.go files in package main, and broken-root layouts.

Resolution:

  1. Exactly one main package -> that's the entry point (the strictcli

import may be indirect via an internal package).

  1. Multiple main packages -> the one whose dir directly imports

strictcli.

  1. Anything else -> StrictcliDetectError: go.mod requires strictcli,

so failing to find the entry point is a hard error, never a silent 'no strictcli here'.

More tools from this site

  • claudestream Drive Claude Code from Python: run it as a subprocess and read its output as typed events, with async and sync sessions, sandbox policies, and tools you define in Python
  • claudewheel A TUI Claude Code Launcher that lets you have more than one profile, manage sessions lifecycle, pick the exact CC version, model to use (even older unlisted ones), pick which GitHub account to use, etc.
  • dirstat Fast, single-binary directory statistics CLI: every file under a tree grouped by format, with counts, sizes, and lines of code, as a colored terminal table or as JSON
  • fastware A batteries-included ASGI framework: msgspec JSON, a managed Granian server, dependency injection, SSE, WebSockets, auth, and a test client
  • go-toml-edit Zero-dep TOML editing library for Go with comment preservation
  • howmuchleft The fastest Claude Code statusline: context window, 5-hour, and weekly limit usage as three customizable gradient bars, rendering in about 6 ms
  • orxtra
  • pgdesign
  • predraw Declarative rendering pipeline: describe a scene in JSON and get SVG, PNG and WebP out, with light and dark style tokens, reusable components and text converted to path outlines
  • reposummary Turn a git repository's history into a Markdown journal: pick a time window or revision range and get a readable digest of what changed, optionally narrated by an LLM
  • safegit git wrapper CLI that gives each commit its own temporary index and retries ref updates on conflict, so concurrent agents share one repository
  • saferm Command-line replacement for rm that archives every deletion with a mandatory reason and the context it ran in, so deleted files can be listed, inspected and restored
  • selfdoc Static Site Generator that builds a project's documentation site directly from its source code, so the docs can never drift from the code they describe, with SEO/AEO, first-class blog, search, and cross-project linking built in
  • strictcli
  • stricttest An always-on test-isolation floor: a pytest plugin and a Go env-hygiene module that make a test suite structurally unable to reach real credentials, the real HOME, the network, or the development repository.
  • wesktop A Python framework that turns an ASGI web app into a desktop application, serving it from a local Granian server and displaying it in a native OS window via pywebview
Search