Imported from erdemhalil/atlassian-client (
AGENTS.md). Install upstream withnpx skills add erdemhalil/atlassian-client. Copyright stays with the author.
AGENTS.md
Guidance for coding agents working in this repository.
1) Project Snapshot
- Language: Python 3.10+
- Package:
atlassian-client - Core libs:
httpx,pydanticv2 - Products currently implemented: Bitbucket, Confluence, Jira
- Tooling:
uv,pytest,ruff,ty,unasyncd
Always run tools through uv.
2) Ground Rules
- Prefer surgical changes; avoid unrelated refactors.
- Treat generated files as generated. Fix root causes in generators/scripts when possible.
- Keep
atlassian/core/product-agnostic and reusable. - Preserve backward compatibility unless explicitly asked to break APIs.
3) Source of Truth
Generated artifacts
- Specs:
specs/<product>/openapi.json - Models:
atlassian/<product>/models.py(fromscripts/sync.py) - Endpoints/resources: generated by
scripts/generate_resources.py
Hand-maintained artifacts
- Core transport/auth/error abstractions in
atlassian/core/ - Product client facades (notably grouped aliases in Confluence client)
- Post-processing sync fixups in
scripts/fix_sync_imports.py
4) Common Workflows
A) Refresh OpenAPI + models
uv run python scripts/sync.py bitbucketuv run python scripts/sync.py confluenceuv run python scripts/sync.py jira
B) Regenerate endpoints/resources
uv run python scripts/generate_resources.py bitbucketuv run python scripts/generate_resources.py confluenceuv run python scripts/generate_resources.py jira
C) Regenerate sync (non-async) files
uv run unasyncduv run python scripts/fix_sync_imports.py
D) Verify
uv run python -m pytest tests/ -quv run ruff formatuv run ruff checkuv run ty check
E) Format-only pass
uv run ruff format
Run this after large code generation changes or before final verification.
5) Architecture Notes
Core
atlassian/core/async_client.py→ generated sync counterpartcore/client.pyatlassian/core/resource.pyholds generic async/sync resource base classesatlassian/core/pagination.pyholds generic iterators/page model for Bitbucket-like pagination
Pagination behavior
- Bitbucket:
values/isLastPage/nextPageStart - Confluence:
results/_links.next - Jira: offset-style
startAt/maxResults/totaland non-offset link-stylenextPage/nextwithisLastPage - Confluence cursor endpoints (e.g., scan-style) are intentionally treated differently than offset paging.
6) Generator Expectations
scripts/generate_resources.py is multi-product and line-length aware.
- Uses
ProductConfigper product. - Must only import models/endpoints for emitted resources.
- Should keep short signatures/calls one-line and wrap only when needed.
- Respect current Ruff line length from
pyproject.toml.
If generated output looks wrong, fix generator logic first, then regenerate.
7) Sync Pipeline Caveats
unasyncd does not handle every import/module-path rewrite perfectly.
- Always run
scripts/fix_sync_imports.pyafterunasyncd. - Keep
tool.unasyncd.add_replacementsinpyproject.tomlup to date for renamed Async→Sync symbols. scripts/fix_sync_imports.pyalready runs Ruff check+format on sync targets; still run a repo-level formatter/check pass afterward when multiple files changed.
8) Testing Guidance
- Prefer
uv run python -m pytest ...for stable import resolution. - Add regression tests when fixing generator or pagination bugs.
- For pagination fixes, verify both:
- multi-page continuation
- stop condition when no next page
- for Jira non-offset shapes, continuation by following server
nextPage/nextquery params
9) Known Pitfalls
- Paged non-GET endpoints (notably in Confluence) must preserve HTTP verb and request body.
- Jira
nextPagemay be absolute (often includes/rest/...); normalize against client base path to avoid/rest/rest/...requests. - Do not route product-specific behavior into
coreunless truly generic. - Avoid stale
unasyncdmappings pointing to non-existent files.
10) Suggested Agent Routine
- Read relevant source + generator/script before editing generated files.
- Implement minimal root fix.
- Regenerate affected artifacts.
- Run sync pipeline if async sources changed.
- Run formatter (
ruff format) and lint (ruff check). - Run tests + type checks.
- Summarize changed files and behavior impact clearly.