Guidance for agentic coding assistants working in plugin.video.jacktook.
- Project type: Kodi video addon (
plugin.video.jacktook) - Main language: Python
- Runtime target: Kodi Python runtime (
xbmc.python3.00.0 inaddon.xml) - Practical local interpreter:
python3(thepythoncommand is not available here) - Primary entry points:
jacktook.py(plugin source entry)service.py(background service entry)
lib/core addon codelib/router.pyaction dispatcher with lazy importslib/navigation.pymenu/actions wiringlib/clients/integrations (Jackett, Stremio, debrid providers, etc.)lib/api/API wrapperslib/utils/utility functions, Kodi helpers, parsing, playback helperslib/gui/Kodi windows/dialogslib/domain/domain models (example:TorrentStream)
resources/settings XML, localization strings, skins, artworktests/pytest tests + manual scriptsscripts/utility scripts (release packaging, label conversion, py37 compatibility)
- Checked for Cursor rules:
.cursor/rules/-> not present.cursorrules-> not present
- Checked for GitHub Copilot instructions:
.github/copilot-instructions.md-> not present
- Therefore: no repository-specific Cursor/Copilot rule files are currently defined.
Use python3 commands from repo root.
python3 -m pip install -r requirements-test.txtOptional editable-style convenience for local imports is not required because tests already adjust sys.path in tests/conftest.py.
There is no traditional compile/build pipeline. Packaging is done via script:
python3 scripts/create_release.pyNotes:
scripts/create_release.pyuses hard-coded absolute paths for source and destination.- It creates a zip artifact under
/home/spider/Desktop/jacktook/releases/plugin.video.jacktook.zip. - It excludes
.git,.venv,.agent,.worktrees,__pycache__,.pytest_cache, and*.pyc.
Run tests from repository root.
python3 -m pytest -qpython3 -m pytest tests/unit/test_jackett.py -qpython3 -m pytest tests/unit/test_general_utils.py::test_is_url -qpython3 -m pytest -k "jackett and search_movie" tests/unit -qpython3 -m pytest --cov=lib --cov-report=term-missingpython3 -m pytest --collect-only -qpython3 tests/manual_easynews_test.py
python3 tests/verify_debrid.pyNotes:
- These manual scripts require credentials/tokens and are not CI-safe.
- Kodi modules are mocked in tests via
tests/conftest.pyand per-test stubs.
No dedicated linter config (pyproject.toml, setup.cfg, tox.ini, pytest.ini) is present.
Recommended lightweight checks:
python3 -m py_compile jacktook.py service.py
python3 scripts/check_py37_compat.py .scripts/check_py37_compat.py scans for syntax/features that break Python 3.7 compatibility assumptions.
- In this environment,
python3 -m pytest -qcurrently has one failing test:tests/unit/test_general_utils.py::test_supported_video_extensions
- Root cause is environment/mocking behavior of
xbmc.getSupportedMedia(returns empty without specific mock setup). - If touching video extension logic, ensure deterministic mocking of
getSupportedMedia.
Follow existing codebase conventions first; avoid style-only churn.
- Prefer grouped imports in this order:
- Standard library
- Third-party
- Local
lib.* - Kodi modules (
xbmc,xbmcgui,xbmcplugin, etc.)
- Keep import names explicit; avoid wildcard imports.
- Lazy-import heavy modules inside functions when startup cost matters (see
lib/router.py).
- 4-space indentation, no tabs.
- Keep functions focused; extract helpers for repeated routing/action maps.
- Preserve readability over strict line-length refactors (project has mixed line widths).
- Avoid large reformat-only diffs.
- Type hints are used but not universally enforced; add hints for new/edited public helpers when practical.
- Use
typingcompatibility style seen in repo (List,Dict,Optional) for consistency. - Preserve existing payload field names where external APIs demand them (e.g.,
infoHash,isPack). - Use dataclasses for small structured models (see
lib/domain/torrent.py).
- Functions/variables:
snake_case - Classes:
PascalCase - Constants:
UPPER_SNAKE_CASE - Keep compatibility with existing action names and query params used by router/navigation.
- Fail gracefully in UI/user-facing paths; avoid crashing Kodi navigation.
- Wrap network/IO boundaries with defensive error handling.
- Use Kodi-friendly messaging/logging patterns:
notification(...)for user-visible failureskodilog(...)for diagnostics
- Prefer specific exceptions when practical; broad
exceptis tolerated only where Kodi API instability requires resilience.
- Respect addon flow: build list items, set content type/category, then close directory correctly.
- Use utility wrappers in
lib.utils.kodi.utilsinstead of duplicating Kodi API calls. - Be careful with module-level side effects due to Kodi imports; tests rely on pre-import mocks.
- For pure logic, add/extend pytest unit tests in
tests/unit/. - Mock Kodi modules before importing code under test when required.
- Prefer deterministic fixtures over live network calls.
- For debrid/provider behavior, keep unit tests isolated and use manual scripts for credentialed checks.
- Make minimal, targeted changes.
- Do not rewrite unrelated files for style consistency.
- When changing routing/action names, update all call sites and query param builders.
- Run relevant tests first (single-test command), then broader suite when feasible.
- If tests fail due to known environment stubs, document clearly in your handoff.
- NEVER run
git commitautomatically on behalf of the user. - NEVER use
git commit --amendwithout explicit user request. - The user decides when and how to commit changes.
- If the user says "commit", confirm the message and scope before executing.
- Present changes with
git diff --statorgit statusand wait for explicit approval. - Exception: if the user explicitly asks "commit this" or "make a commit", then proceed.