studylife-cli 1.3.0__tar.gz → 1.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,10 @@
1
+ # [1.4.0](https://github.com/lukislp/studylife-cli/compare/v1.3.0...v1.4.0) (2026-08-30)
2
+
3
+
4
+ ### Features
5
+
6
+ * add whoami command ([ddf3aeb](https://github.com/lukislp/studylife-cli/commit/ddf3aeb783b44065c4334e22159e2d03b90c4e32))
7
+
1
8
  # [1.3.0](https://github.com/lukislp/studylife-cli/compare/v1.2.0...v1.3.0) (2026-08-30)
2
9
 
3
10
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: studylife-cli
3
- Version: 1.3.0
3
+ Version: 1.4.0
4
4
  Summary: Command-line client for StudyLife (self-hosted study organizer) - notes, sessions, course goals, and webhooks from your terminal.
5
5
  License-File: LICENSE
6
6
  Requires-Python: >=3.12
@@ -20,10 +20,10 @@ and shells welcome.
20
20
  ## Install
21
21
 
22
22
  ```bash
23
- pip install git+https://github.com/lukislp/studylife-cli
23
+ pip install studylife-cli
24
24
  ```
25
25
 
26
- (PyPI publishing is planned; until then, install straight from GitHub.)
26
+ (or `pipx install studylife-cli` to keep it in its own isolated environment)
27
27
 
28
28
  ## Register the CLI on your instance
29
29
 
@@ -7,10 +7,10 @@ and shells welcome.
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- pip install git+https://github.com/lukislp/studylife-cli
10
+ pip install studylife-cli
11
11
  ```
12
12
 
13
- (PyPI publishing is planned; until then, install straight from GitHub.)
13
+ (or `pipx install studylife-cli` to keep it in its own isolated environment)
14
14
 
15
15
  ## Register the CLI on your instance
16
16
 
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.3.0'
22
- __version_tuple__ = version_tuple = (1, 3, 0)
21
+ __version__ = version = '1.4.0'
22
+ __version_tuple__ = version_tuple = (1, 4, 0)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -186,6 +186,19 @@ def logout() -> None:
186
186
  console.print("Logged out.")
187
187
 
188
188
 
189
+ @app.command()
190
+ def whoami(ctx: typer.Context, as_json: bool = JSON_OPTION) -> None:
191
+ """Show which StudyLife account and instance the stored credential belongs to."""
192
+ result = _run(ctx, lambda c: c.whoami())
193
+ credentials = load_credentials()
194
+ payload = {
195
+ "instance_url": credentials.instance_url if credentials else None,
196
+ "user_id": result.user_id,
197
+ "credential": result.credential,
198
+ }
199
+ _print(_use_json(ctx, as_json), [payload], "Whoami")
200
+
201
+
189
202
  # -- Notes --------------------------------------------------------------------------
190
203
 
191
204
 
@@ -19,6 +19,7 @@ from studylife_cli.models import (
19
19
  StudyProgramSummary,
20
20
  TimerState,
21
21
  Webhook,
22
+ Whoami,
22
23
  )
23
24
 
24
25
 
@@ -48,6 +49,9 @@ class StudyLifeClient:
48
49
  def __exit__(self, *exc_info: object) -> None:
49
50
  self.close()
50
51
 
52
+ def whoami(self) -> Whoami:
53
+ return Whoami.model_validate(self._request("GET", "/api/auth/whoami").json())
54
+
51
55
  def _request(self, method: str, path: str, **kwargs: object) -> httpx.Response:
52
56
  response = self._http.request(method, path, **kwargs)
53
57
  if response.status_code >= 400:
@@ -99,6 +99,14 @@ class StudyProgramDetail(StudyLifeModel):
99
99
  group_ects_quotas: dict[str, int] = {}
100
100
 
101
101
 
102
+ class Whoami(StudyLifeModel):
103
+ """GET /api/auth/whoami - resolves the real AuthUserId behind whatever credential is in use,
104
+ and which one matched (the session, or the API key slot's ClientId)."""
105
+
106
+ user_id: int
107
+ credential: str
108
+
109
+
102
110
  class Webhook(StudyLifeModel):
103
111
  """studylife-webhooks' own WebhookOut shape (id is a string there, not an int) - the server's
104
112
  WebhooksProxyController is a pure, un-typed reverse proxy for this, so it never appears in
File without changes
File without changes
File without changes