Skip to content

[Feat]: CLI discoverability, PATH docs, python -m skillware, and unified help #135

@rosspeili

Description

@rosspeili

Feature Description

Make the skillware CLI easy to run and easy to discover after pip install "skillware[cli]", on Windows and Unix, with or without Python on PATH.

A. Documentation, installation and PATH

Update docs/usage/cli.md (and README Quick Start if needed):

  • After pip install "skillware[cli]", the skillware command lives in Python's Scripts directory (e.g. %LOCALAPPDATA%\Programs\Python\Python313\Scripts\ on Windows).
  • If skillware is not recognized, add both Python3x\ and Python3x\Scripts\ to PATH, or use fallbacks (see B).
  • Document Windows: py -3.13 -m pip install "skillware[cli]", verify with where skillware.
  • Document Unix: python3 -m pip install "skillware[cli]", verify with which skillware.
  • Clarify: core-only pip install skillware does not install rich; CLI requires [cli] extra.

B. Run without PATH (industry standard)

Add skillware/__main__.py so this works everywhere Python can import the package:

python -m skillware
python -m skillware list
python -m skillware list --category compliance
python -m skillware --help

Delegate to skillware.cli:main. Matches common Python packaging (pytest, pip, black, etc.). Console script entry point in pyproject.toml stays as primary when Scripts is on PATH.

Optional: one-line hint on ImportError / first run if someone tries -m skillware before this lands (not required once __main__.py exists).

C. Unified help (fix menu item 4 + expand --help)

Bug: Interactive menu 4 / help calls parser.print_help() (stderr, minimal). Users expect the same content as docs.

Fix:

  • Add cmd_help(console) that prints rich, user-facing help to the same console as the menu (stdout via Rich).
  • Wire menu help and top-level skillware --help / -h to cmd_help (or shared helper), not raw argparse stderr only.
  • Include in help output:

Keep skillware list --help for flag-level detail (argparse subparser help is fine there).

D. CLI robustness (small, same PR if trivial)

  • Add --version / -V at top level (print installed skillware version; useful for support).
  • Ensure cmd_interactive always receives help helper (no branch that prints "Run skillware --help" only).
  • Tests in tests/test_cli.py:
    • python -m skillware equivalent (import skillware.__main__ or run main with argv)
    • Interactive help / 4 prints expected sections (category example, issuer example)
    • --version output
  • Update docs/usage/cli.md menu table: help item behavior matches implementation.

Out of scope (existing or separate issues)

Rationale

Contributors and users hit friction right after install: skillware not found (Scripts not on PATH), python -m skillware failing, and help that only lists {list} while filters and examples live in docs only. Fixing discoverability and help in one pass reduces support burden and matches expectations set by tools like pip, pytest, and ollama-style CLIs (command on PATH + module fallback).

Implementation Idea

Files: skillware/__main__.py (new), skillware/cli.py, docs/usage/cli.md, README.md (Quick Start PATH note), tests/test_cli.py

  1. skillware/__main__.py

    from skillware.cli import main
    if __name__ == "__main__":
        main()
  2. cmd_help(console) in cli.py

    • Rich-formatted sections: Usage, Commands, Examples, Install, Docs link
    • Reuse strings or a small constant block; avoid duplicating all of cli.md
  3. main()

    • parser.add_argument("--version", "-V", action="version", version=...)
    • On -h / --help with no subcommand: call cmd_help(Console()) then return (do not enter interactive menu)
    • cmd_interactive(parser=parser) → pass help_fn=cmd_help instead of relying on parser.print_help()
  4. Docs

    • New subsection Running the CLI under Installation in cli.md: PATH, fallbacks, Windows py launcher
  5. Tests

    • test_main_module_invocation (subprocess or importlib)
    • test_cmd_help_includes_list_examples
    • test_interactive_help_dispatches_to_cmd_help

Acceptance Criteria

  • docs/usage/cli.md documents PATH (Python + Scripts), [cli] extra, and fallbacks (python -m skillware, full path to skillware.exe)
  • python -m skillware and python -m skillware list work when package is installed
  • skillware --help and interactive menu 4 / help show the same rich help (commands, flags, examples for category/issuer/root)
  • skillware list --category / --issuer / --skills-root still work; examples appear in top-level help
  • --version prints installed version
  • tests/test_cli.py covers __main__, help content, and interactive help
  • pytest tests/test_cli.py and flake8 pass

Affected Pages

skillware/__main__.py (new), skillware/cli.py, docs/usage/cli.md, README.md, tests/test_cli.py

Related

#81 (paths), #83 (test), #130 / #131 (polish done), #132 (version advisory, separate)

Metadata

Metadata

Assignees

Labels

core frameworkChanges to loader, env, or base classes.documentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomers
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions