You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,11 @@ Guidance for coding agents working in this repository.
4
4
5
5
## Project summary
6
6
7
-
- This is a TypeScript SDK and CLI for the Librus family portal flow.
8
-
- The supported path is `portal.librus.pl` authentication plus child-scoped `https://api.librus.pl/3.0` requests.
7
+
- This is a TypeScript SDK and CLI for Librus family portal and Gateway API 2.0 flows.
8
+
- Supported backends are:
9
+
-`api_v3`: `portal.librus.pl` authentication plus child-scoped `https://api.librus.pl/3.0` requests.
10
+
-`gateway_api_20`: school-issued login/password authentication plus cookie-backed `https://synergia.librus.pl/gateway/api/2.0` requests.
11
+
-`api_v3` is multi-child. `gateway_api_20` is already scoped to one account and must not pretend to support Portal-style child switching.
9
12
- Do not reintroduce the legacy `synergia.librus.pl` HTML-scraping approach.
10
13
- The package exposes both an SDK entrypoint and a CLI binary named `librus`.
11
14
@@ -49,6 +52,9 @@ npm run cli -- grades list --child <id-or-login>
49
52
## Environment and secrets
50
53
51
54
- Runtime credentials come from `LIBRUS_PORTAL_EMAIL` and `LIBRUS_PORTAL_PASSWORD`.
55
+
- Gateway API 2.0 credentials come from `LIBRUS_GATEWAY_LOGIN` and `LIBRUS_GATEWAY_PASSWORD`.
56
+
- Backend selection uses `LIBRUS_API_BACKEND=api_v3|gateway_api_20` when explicit; otherwise complete Portal credentials win, then complete Gateway credentials, then `api_v3` default errors.
57
+
-`LIBRUS_CHILD` is an optional default child selector for `api_v3` only. CLI `--child` wins over `LIBRUS_CHILD`; explicit `--child` is unsupported for `gateway_api_20`.
52
58
-`LIBRUS_EMAIL` and `LIBRUS_PASSWORD` are kept as compatibility fallbacks.
53
59
- Never hardcode credentials, tokens, or session cookies.
54
60
- Keep CLI and SDK errors secret-safe. Do not leak passwords, bearer tokens, or raw cookie values in output, logs, tests, or thrown error messages.
@@ -60,7 +66,8 @@ npm run cli -- grades list --child <id-or-login>
60
66
- Preserve the JSON-first CLI behavior: normal results go to stdout, structured errors go to stderr, and commands should return non-zero exit codes on failure.
-`LibrusSession` orchestrates login, child discovery, and child selection.
69
+
-`GatewayApi20AuthClient` handles Gateway API 2.0 login/session concerns.
70
+
-`LibrusSession` orchestrates backend selection, login, child discovery, and child selection.
64
71
-`SynergiaApiClient` handles authenticated API calls for a specific child account.
65
72
- Keep compatibility with Node 22+. Node 22 is the supported runtime floor for
66
73
SDK, CLI, CI, and dependency updates.
@@ -73,7 +80,7 @@ npm run cli -- grades list --child <id-or-login>
73
80
74
81
## Change guidance
75
82
76
-
- Preserve the current portal-based flow unless the task explicitly requires architectural change.
83
+
- Preserve existing `api_v3` behavior unless the task explicitly requires architectural change, and keep `gateway_api_20` feature support limited to what the upstream JSON API actually provides.
77
84
- All code and documentation changes should be made outside `master`. Prefer one worktree per active feature and one branch per mergeable change. Prefer branches cut from an up-to-date `master`, but allow short-lived dependent branches when the work is intentionally stacked.
78
85
- Keep public SDK exports intentional and update `README.md` when user-facing CLI or SDK behavior changes.
79
86
- Update `CHANGELOG.md` for notable user-facing changes.
0 commit comments