Repository navigation
docs/agents md #205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
KomanRudden
wants to merge
4
commits into
main
Choose a base branch
from
docs/agents-md
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
docs/agents md #205
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
36d9103
Add Cursor Cloud dev environment setup notes
cursoragent c94613f
Expand AGENTS.md into general agent guidance
KomanRudden 049dcb9
Clarify /login env vars in AGENTS.md
KomanRudden e19ad55
docs: set PYTHONPATH in the Flask example run command
KomanRudden File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # AGENTS.md | ||
|
|
||
| Instructions for coding agents working in this repository. | ||
|
|
||
| This is the **Kinde Python SDK**: a client library plus optional `kinde_fastapi` and `kinde_flask` integrations. It is not a standalone server. There are **no long-running services** required for development. The automated test suite (`testv2/`) is fully mocked and needs no network, database, or Kinde account. | ||
|
|
||
| ## Repo map | ||
|
|
||
| - `kinde_sdk/auth/`, `kinde_sdk/core/` — hand-written auth, storage, session, and framework glue. Prefer editing here. | ||
| - `kinde_sdk/management/` — Management API. Mostly OpenAPI-generated. Hand-written wrappers: `management_client.py`, `management_token_manager.py`. | ||
| - `kinde_sdk/frontend/` — Frontend/Account API. Almost entirely OpenAPI-generated. | ||
| - `kinde_sdk/docs/`, `kinde_sdk/test/` — generated artifacts. `kinde_sdk/test/` is **not** collected by pytest. | ||
| - `kinde_fastapi/`, `kinde_flask/` — framework integrations and example apps. | ||
| - `testv2/` — the real test suite (`testv2_auth`, `testv2_core`, `testv2_management`, `testv2_framework`, `testv2_expected_behavior`). | ||
| - `generate_management_sdk.py`, `generate_frontend_sdk.py` — regenerate OpenAPI clients from Kinde's public specs. | ||
|
|
||
| ## Environment | ||
|
|
||
| - Python `>=3.9` (CI matrix: 3.9–3.13). Use the virtualenv at `.venv/`. | ||
| - On Cursor Cloud (Ubuntu, PEP 668 externally-managed Python), the startup update script already creates `.venv` from `requirements.txt`. Recreate it locally with: | ||
|
|
||
| ``` | ||
| python3 -m venv .venv | ||
| .venv/bin/pip install -r requirements.txt | ||
| ``` | ||
|
|
||
| - Run tools via the venv without activating it: `.venv/bin/pytest`, `.venv/bin/python`, `.venv/bin/black`, `.venv/bin/flake8`. | ||
| - `requirements.txt` is the source of truth for dev installs (matches CI). `pip install -e ".[fastapi,flask,dev]"` also works. Do **not** add a `poetry.lock`; Poetry is not the supported install path (see `.gitignore`). | ||
| - CI does not install the package editable. Import `kinde_sdk` from the repo root and run pytest from the repo root. | ||
|
|
||
| ## Tests, lint, verification | ||
|
|
||
| - Default command: `.venv/bin/pytest` (`pytest.ini`: `testpaths=testv2`, coverage, 30s per-test timeout). After a focused change, run the matching `testv2/` file first, then the full suite. | ||
| - The merge gate is `.github/workflows/ci.yml`: `pip install -r requirements.txt` then `pytest --cov=kinde_sdk --cov-branch --cov-report=xml` on Python 3.9–3.13. CI does **not** run Black or flake8. | ||
| - Black and flake8 are available locally. Pre-commit pins Black **22.12.0** while `requirements.txt` installs a newer Black, so `black --check` reports many pre-existing diffs. Do not reformat the tree to satisfy the newer Black unless the task is specifically a format change. | ||
| - Add or update tests in `testv2/` for behavior you change. Do not add tests under `kinde_sdk/test/`. | ||
|
|
||
| ## Conventions | ||
|
|
||
| - **Version:** bump only `kinde_sdk/_version.py`. `pyproject.toml` and the generated sub-package `__init__.py` files derive from it. Keep `packageVersion` as the placeholder `"SDK_VERSION"` in OpenAPI generator configs. `testv2/testv2_core/test_version_sync.py` enforces this. | ||
| - **Generated code:** do not hand-edit files marked `Generated by OpenAPI Generator` / `Do not edit the class manually` (especially `kinde_sdk/management/{api,models}/` and `kinde_sdk/frontend/{api,models}/`). Change the spec or a generator wrapper, then regenerate. The management generator preserves the hand-written wrappers listed above. | ||
| - **Regeneration:** `python3 generate_management_sdk.py` and `python3 generate_frontend_sdk.py` need Node/`npx`, `@openapitools/openapi-generator-cli`, and network access to `api-spec.kinde.com`. Only run these when the task is to refresh generated clients. | ||
| - **OAuth env vars** (`kinde_sdk/auth/oauth.py`): `KINDE_CLIENT_ID`, `KINDE_CLIENT_SECRET`, `KINDE_REDIRECT_URI`, `KINDE_HOST` (full URL, e.g. `https://your-domain.kinde.com`). **Management** credentials use `KINDE_DOMAIN` (hostname only, e.g. `your-domain.kinde.com`) plus `KINDE_MANAGEMENT_CLIENT_ID` / `KINDE_MANAGEMENT_CLIENT_SECRET`. Some READMEs mix these names; trust the code. | ||
| - Never commit `.env` files or secrets. | ||
|
|
||
| ## Example apps (manual E2E) | ||
|
|
||
| From the repo root: | ||
|
|
||
| - FastAPI: `.venv/bin/python -m uvicorn kinde_fastapi.examples.example_app:app --host 127.0.0.1 --port 8000` | ||
| - Flask: `PYTHONPATH=. .venv/bin/python kinde_flask/examples/example_app.py` (port 5000). Running the script puts only its own folder on `sys.path`, so `PYTHONPATH=.` (POSIX shells) is needed for `import kinde_sdk` unless the package is installed. | ||
|
|
||
| Each app loads a `.env` beside the example script. Only `KINDE_CLIENT_ID` is required to boot. `KINDE_REDIRECT_URI` is required for a valid `/login` authorization request; `KINDE_HOST` defaults to `https://app.kinde.com`, and `KINDE_CLIENT_SECRET` is optional for PKCE. With placeholder credentials, `/login` still builds a valid OAuth2/OIDC + PKCE redirect to `${KINDE_HOST}/oauth2/auth?...`. Completing an actual login requires a real Kinde application whose allowed callback URLs include the configured redirect URI; otherwise Kinde returns "Invalid callback URL" (expected with placeholders). | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.