tlnt-cli 1.5.1__tar.gz → 1.5.2__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.
Files changed (56) hide show
  1. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/PKG-INFO +1 -2
  2. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/pyproject.toml +1 -2
  3. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/pyproject.toml.orig +1 -2
  4. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/browser/login.py +2 -3
  5. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/browser/oauth.py +2 -2
  6. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/browser/scripted.py +2 -2
  7. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/attendance.py +4 -12
  8. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/calendar.py +1 -3
  9. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/login.py +3 -4
  10. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/logout.py +1 -2
  11. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/notifications.py +1 -4
  12. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/profile.py +1 -2
  13. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/setup.py +1 -2
  14. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/status.py +1 -2
  15. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/timeoff.py +98 -83
  16. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/main.py +31 -31
  17. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/options.py +14 -10
  18. {tlnt_cli-1.5.1/src/tlnt/core/clients/mekari → tlnt_cli-1.5.2/src/tlnt/core}/client.py +57 -88
  19. tlnt_cli-1.5.1/src/tlnt/core/clients/mekari/constants.py → tlnt_cli-1.5.2/src/tlnt/core/mekari.py +1 -1
  20. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/models.py +16 -4
  21. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/services/__init__.py +1 -1
  22. tlnt_cli-1.5.2/src/tlnt/core/services/attendance.py +211 -0
  23. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/services/calendar.py +1 -1
  24. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/services/login.py +5 -33
  25. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/services/logout.py +1 -12
  26. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/services/notifications.py +1 -1
  27. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/services/profile.py +1 -1
  28. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/services/setup.py +1 -1
  29. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/services/timeoff.py +1 -1
  30. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/session.py +2 -24
  31. tlnt_cli-1.5.1/src/tlnt/core/clients/mekari/__init__.py +0 -0
  32. tlnt_cli-1.5.1/src/tlnt/core/services/attendance.py +0 -213
  33. tlnt_cli-1.5.1/src/tlnt/mcp/__init__.py +0 -0
  34. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/LICENSE +0 -0
  35. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/README.md +0 -0
  36. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/__init__.py +0 -0
  37. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/__main__.py +0 -0
  38. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/browser/__init__.py +0 -0
  39. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/__init__.py +0 -0
  40. {tlnt_cli-1.5.1/src/tlnt/cli/commands → tlnt_cli-1.5.2/src/tlnt/cli}/approvals.py +0 -0
  41. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/avatars.py +0 -0
  42. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/__init__.py +0 -0
  43. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/mcp.py +0 -0
  44. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/update.py +0 -0
  45. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/commands/version.py +0 -0
  46. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/output.py +0 -0
  47. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/cli/prompts.py +0 -0
  48. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/__init__.py +0 -0
  49. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/config.py +0 -0
  50. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/http_client.py +0 -0
  51. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/logs.py +0 -0
  52. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/play_store.py +0 -0
  53. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/services/status.py +0 -0
  54. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/core/user_agent.py +0 -0
  55. {tlnt_cli-1.5.1/src/tlnt/core/clients → tlnt_cli-1.5.2/src/tlnt/mcp}/__init__.py +0 -0
  56. {tlnt_cli-1.5.1 → tlnt_cli-1.5.2}/src/tlnt/mcp/main.py +0 -0
@@ -1,12 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tlnt-cli
3
- Version: 1.5.1
3
+ Version: 1.5.2
4
4
  Summary: CLI wrapper for HRIS attendance and employment workflows.
5
5
  Author: Fathiraz Arthuro
6
6
  License-Expression: MIT
7
7
  License-File: LICENSE
8
8
  Requires-Dist: httpx>=0.28,<0.29
9
- Requires-Dist: keyring>=25,<26
10
9
  Requires-Dist: loguru>=0.7,<1
11
10
  Requires-Dist: mcp>=2.0,<3
12
11
  Requires-Dist: platformdirs>=4.3,<5
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "tlnt-cli"
7
- version = "1.5.1"
7
+ version = "1.5.2"
8
8
  description = "CLI wrapper for HRIS attendance and employment workflows."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -12,7 +12,6 @@ license-files = ["LICENSE"]
12
12
  requires-python = ">=3.11,<3.15"
13
13
  dependencies = [
14
14
  "httpx>=0.28,<0.29",
15
- "keyring>=25,<26",
16
15
  "loguru>=0.7,<1",
17
16
  "mcp>=2.0,<3",
18
17
  "platformdirs>=4.3,<5",
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "tlnt-cli"
7
- version = "1.5.1"
7
+ version = "1.5.2"
8
8
  description = "CLI wrapper for HRIS attendance and employment workflows."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -13,7 +13,6 @@ authors = [{ name = "Fathiraz Arthuro" }]
13
13
  requires-python = ">=3.11,<3.15"
14
14
  dependencies = [
15
15
  "httpx>=0.28,<0.29",
16
- "keyring>=25,<26",
17
16
  "loguru>=0.7,<1",
18
17
  "mcp>=2.0,<3",
19
18
  "platformdirs>=4.3,<5",
@@ -16,8 +16,8 @@ from playwright.sync_api import TimeoutError as PlaywrightTimeoutError
16
16
  from playwright.sync_api import sync_playwright
17
17
 
18
18
  from tlnt.browser.oauth import authorize_url, code_from_url, pkce_pair
19
- from tlnt.core.clients.mekari.client import MekariClient
20
- from tlnt.core.clients.mekari.constants import (
19
+ from tlnt.core.client import MekariClient
20
+ from tlnt.core.mekari import (
21
21
  DASHBOARD_TALENTA_URL,
22
22
  MEKARI_DOMAIN,
23
23
  STATIC_ASSET_SUFFIXES,
@@ -404,7 +404,6 @@ class BrowserLogin:
404
404
  session = SessionState(
405
405
  version=1,
406
406
  saved_at=datetime.now().astimezone().isoformat(),
407
- web_storage={},
408
407
  profile=profile,
409
408
  mobile=mobile,
410
409
  )
@@ -7,8 +7,8 @@ import hashlib
7
7
  import secrets
8
8
  from urllib.parse import parse_qsl, urlencode, urlsplit
9
9
 
10
- from tlnt.core.clients.mekari import constants
11
- from tlnt.core.clients.mekari.constants import (
10
+ from tlnt.core import mekari as constants
11
+ from tlnt.core.mekari import (
12
12
  OAUTH_AUTHORIZE_URL,
13
13
  OAUTH_SCOPE,
14
14
  TOKEN_REDIRECT_URL,
@@ -20,8 +20,8 @@ from tlnt.browser.login import (
20
20
  _OAuthSink,
21
21
  )
22
22
  from tlnt.browser.oauth import authorize_url, pkce_pair
23
- from tlnt.core.clients.mekari.client import MekariClient
24
- from tlnt.core.clients.mekari.constants import DASHBOARD_TALENTA_URL
23
+ from tlnt.core.client import MekariClient
24
+ from tlnt.core.mekari import DASHBOARD_TALENTA_URL
25
25
  from tlnt.core.logs import logger
26
26
  from tlnt.core.models import MobileToken, Profile
27
27
 
@@ -8,17 +8,16 @@ from typing import Annotated
8
8
  import typer
9
9
 
10
10
  from tlnt.cli import prompts
11
- from tlnt.cli.commands.approvals import run_approval
11
+ from tlnt.cli.approvals import run_approval
12
12
  from tlnt.cli.output import action_banner, confirm, emit, spinner
13
13
  from tlnt.cli.options import (
14
14
  AvatarsOption,
15
15
  InteractiveOption,
16
16
  JsonOption,
17
- TableOption,
18
17
  VerboseOption,
19
18
  )
20
19
  from tlnt.core.config import get_setting
21
- from tlnt.core.models import Result
20
+ from tlnt.core.models import Result, iso_date
22
21
  from tlnt.core.services import positive_id
23
22
  from tlnt.core.services.attendance import (
24
23
  clock as clock_action,
@@ -165,7 +164,6 @@ def _clock_command(event_type: str, label: str, doc: str) -> Callable[..., None]
165
164
  ] = None,
166
165
  interactive: InteractiveOption = False,
167
166
  json_output: JsonOption = False,
168
- table: TableOption = False,
169
167
  avatars: AvatarsOption = False,
170
168
  verbose: VerboseOption = False,
171
169
  ) -> None:
@@ -199,11 +197,8 @@ attendance_clockout = _clock_command(
199
197
  def _attendance_date(value: str | None) -> date:
200
198
  if value is None:
201
199
  return date.today()
202
- try:
203
- selected_date = date.fromisoformat(value)
204
- except ValueError as error:
205
- raise typer.BadParameter("date must be YYYY-MM-DD") from error
206
- if selected_date.isoformat() != value:
200
+ selected_date = iso_date(value)
201
+ if selected_date is None:
207
202
  raise typer.BadParameter("date must be YYYY-MM-DD")
208
203
  return selected_date
209
204
 
@@ -214,7 +209,6 @@ def attendance_summary_list(
214
209
  typer.Option("--date", help="Attendance date (YYYY-MM-DD)."),
215
210
  ] = None,
216
211
  json_output: JsonOption = False,
217
- table: TableOption = False,
218
212
  verbose: VerboseOption = False,
219
213
  ) -> None:
220
214
  """Read attendance summaries for a date."""
@@ -227,7 +221,6 @@ def attendance_summary_metrics(
227
221
  typer.Option("--date", help="Attendance date (YYYY-MM-DD)."),
228
222
  ] = None,
229
223
  json_output: JsonOption = False,
230
- table: TableOption = False,
231
224
  verbose: VerboseOption = False,
232
225
  ) -> None:
233
226
  """Read attendance summary metrics for a date."""
@@ -262,7 +255,6 @@ def attendance_approve(
262
255
  ] = "",
263
256
  interactive: InteractiveOption = False,
264
257
  json_output: JsonOption = False,
265
- table: TableOption = False,
266
258
  verbose: VerboseOption = False,
267
259
  ) -> None:
268
260
  """Approve a live attendance request after confirmation."""
@@ -5,7 +5,7 @@ from typing import Annotated, Any
5
5
 
6
6
  import typer
7
7
 
8
- from tlnt.cli.options import JsonOption, TableOption, VerboseOption
8
+ from tlnt.cli.options import JsonOption, VerboseOption
9
9
  from tlnt.cli.output import run
10
10
  from tlnt.core.services import calendar as calendar_service
11
11
 
@@ -63,7 +63,6 @@ def _filtered_command(name: str, label: str, doc: str) -> Callable[..., None]:
63
63
  date: Annotated[str | None, typer.Option("--date")] = None,
64
64
  user_id: Annotated[str | None, typer.Option("--user-id")] = None,
65
65
  json_output: JsonOption = False,
66
- table: TableOption = False,
67
66
  verbose: VerboseOption = False,
68
67
  ) -> None:
69
68
  params = _calendar_params(
@@ -96,7 +95,6 @@ calendar_activity = _filtered_command(
96
95
 
97
96
  def calendar_my_birthday(
98
97
  json_output: JsonOption = False,
99
- table: TableOption = False,
100
98
  verbose: VerboseOption = False,
101
99
  ) -> None:
102
100
  """Read your birthday date."""
@@ -17,10 +17,10 @@ from tlnt.browser.login import (
17
17
  from tlnt.browser.scripted import LABELS
18
18
  from tlnt.cli import prompts
19
19
  from tlnt.cli.output import banner, deadline_bar, emit
20
- from tlnt.cli.options import JsonOption, TableOption, VerboseOption
20
+ from tlnt.cli.options import JsonOption, VerboseOption
21
21
  from tlnt.core import config
22
- from tlnt.core.clients.mekari import constants as mekari_constants
23
- from tlnt.core.clients.mekari.constants import DASHBOARD_TALENTA_URL
22
+ from tlnt.core import mekari as mekari_constants
23
+ from tlnt.core.mekari import DASHBOARD_TALENTA_URL
24
24
  from tlnt.core.models import Result
25
25
  from tlnt.core.services.login import login as login_action
26
26
  from tlnt.core.services.status import status as status_action
@@ -100,7 +100,6 @@ def _credentials(email: str) -> Credentials | Result:
100
100
 
101
101
  def login(
102
102
  json_output: JsonOption = False,
103
- table: TableOption = False,
104
103
  store_password: Annotated[
105
104
  bool,
106
105
  typer.Option("--store-password", hidden=True),
@@ -1,11 +1,10 @@
1
1
  from tlnt.cli.output import run
2
- from tlnt.cli.options import JsonOption, TableOption, VerboseOption
2
+ from tlnt.cli.options import JsonOption, VerboseOption
3
3
  from tlnt.core.services.logout import logout as logout_action
4
4
 
5
5
 
6
6
  def logout(
7
7
  json_output: JsonOption = False,
8
- table: TableOption = False,
9
8
  verbose: VerboseOption = False,
10
9
  ) -> None:
11
10
  """Log out of Talenta and remove the saved session."""
@@ -4,7 +4,7 @@ from typing import Annotated
4
4
  import typer
5
5
 
6
6
  from tlnt.cli.output import run
7
- from tlnt.cli.options import AvatarsOption, JsonOption, TableOption, VerboseOption
7
+ from tlnt.cli.options import AvatarsOption, JsonOption, VerboseOption
8
8
  from tlnt.core.models import Result
9
9
  from tlnt.core.services.notifications import (
10
10
  notification_attendance_list as notification_attendance_list_action,
@@ -17,7 +17,6 @@ from tlnt.core.services.notifications import (
17
17
 
18
18
  def notification_count(
19
19
  json_output: JsonOption = False,
20
- table: TableOption = False,
21
20
  verbose: VerboseOption = False,
22
21
  ) -> None:
23
22
  """Read Talenta notification counts."""
@@ -43,7 +42,6 @@ def _inbox_list_command(
43
42
  typer.Option("--status", help="Talenta notification status filter."),
44
43
  ] = 3,
45
44
  json_output: JsonOption = False,
46
- table: TableOption = False,
47
45
  avatars: AvatarsOption = False,
48
46
  verbose: VerboseOption = False,
49
47
  ) -> None:
@@ -86,7 +84,6 @@ def notification_detail(
86
84
  typer.Argument(help="Talenta inbox ID."),
87
85
  ],
88
86
  json_output: JsonOption = False,
89
- table: TableOption = False,
90
87
  avatars: AvatarsOption = False,
91
88
  verbose: VerboseOption = False,
92
89
  ) -> None:
@@ -1,11 +1,10 @@
1
1
  from tlnt.cli.output import run
2
- from tlnt.cli.options import AvatarsOption, JsonOption, TableOption, VerboseOption
2
+ from tlnt.cli.options import AvatarsOption, JsonOption, VerboseOption
3
3
  from tlnt.core.services.profile import profile as profile_action
4
4
 
5
5
 
6
6
  def profile(
7
7
  json_output: JsonOption = False,
8
- table: TableOption = False,
9
8
  avatars: AvatarsOption = False,
10
9
  verbose: VerboseOption = False,
11
10
  ) -> None:
@@ -1,11 +1,10 @@
1
1
  from tlnt.cli.output import run
2
- from tlnt.cli.options import JsonOption, TableOption, VerboseOption
2
+ from tlnt.cli.options import JsonOption, VerboseOption
3
3
  from tlnt.core.services.setup import setup as setup_action
4
4
 
5
5
 
6
6
  def setup(
7
7
  json_output: JsonOption = False,
8
- table: TableOption = False,
9
8
  verbose: VerboseOption = False,
10
9
  ) -> None:
11
10
  """Create config.json, or add new keys to it and drop old ones."""
@@ -1,11 +1,10 @@
1
1
  from tlnt.cli.output import run
2
- from tlnt.cli.options import JsonOption, TableOption, VerboseOption
2
+ from tlnt.cli.options import JsonOption, VerboseOption
3
3
  from tlnt.core.services.status import status as status_action
4
4
 
5
5
 
6
6
  def status(
7
7
  json_output: JsonOption = False,
8
- table: TableOption = False,
9
8
  verbose: VerboseOption = False,
10
9
  ) -> None:
11
10
  """Check the saved Talenta session and mobile token."""
@@ -8,10 +8,10 @@ import typer
8
8
  from rich.prompt import Prompt
9
9
 
10
10
  from tlnt.cli import prompts
11
- from tlnt.cli.commands.approvals import run_approval
12
- from tlnt.cli.options import InteractiveOption, JsonOption, TableOption, VerboseOption
11
+ from tlnt.cli.approvals import run_approval
12
+ from tlnt.cli.options import InteractiveOption, JsonOption, VerboseOption
13
13
  from tlnt.cli.output import action_banner, confirm, console, dig, emit, run
14
- from tlnt.core.models import Result
14
+ from tlnt.core.models import Result, iso_date
15
15
  from tlnt.core.services import positive_id
16
16
  from tlnt.core.services import timeoff as timeoff_service
17
17
  from tlnt.core.services.notifications import (
@@ -23,7 +23,6 @@ from tlnt.core.services.notifications import (
23
23
 
24
24
  def timeoff_types_list(
25
25
  json_output: JsonOption = False,
26
- table: TableOption = False,
27
26
  verbose: VerboseOption = False,
28
27
  ) -> None:
29
28
  """Read available time-off types."""
@@ -65,7 +64,6 @@ def timeoff_balance(
65
64
  typer.Option("--show-special-leave", help="Include special leave balances."),
66
65
  ] = False,
67
66
  json_output: JsonOption = False,
68
- table: TableOption = False,
69
67
  verbose: VerboseOption = False,
70
68
  ) -> None:
71
69
  """Read the signed-in user's time-off balances."""
@@ -95,7 +93,6 @@ def timeoff_delegation_list(
95
93
  typer.Option("--search", help="Search for a delegate."),
96
94
  ] = "",
97
95
  json_output: JsonOption = False,
98
- table: TableOption = False,
99
96
  verbose: VerboseOption = False,
100
97
  ) -> None:
101
98
  """Search employees available for time-off delegation."""
@@ -143,7 +140,6 @@ def timeoff_list(
143
140
  typer.Option("--show-metrics", help="Include request metrics."),
144
141
  ] = False,
145
142
  json_output: JsonOption = False,
146
- table: TableOption = False,
147
143
  verbose: VerboseOption = False,
148
144
  ) -> None:
149
145
  """Read time-off requests."""
@@ -174,7 +170,6 @@ def timeoff_detail(
174
170
  typer.Argument(help="Time-off request ID."),
175
171
  ],
176
172
  json_output: JsonOption = False,
177
- table: TableOption = False,
178
173
  verbose: VerboseOption = False,
179
174
  ) -> None:
180
175
  """Read one time-off request."""
@@ -200,6 +195,94 @@ def _valid_schedule_time(value: str) -> bool:
200
195
  )
201
196
 
202
197
 
198
+ def _prompt_missing(
199
+ date: str | None,
200
+ policy_id: str | None,
201
+ reason: str | None,
202
+ half_day: str | None,
203
+ schedule_in: str,
204
+ schedule_out: str,
205
+ file_path: Path | None,
206
+ ) -> tuple[str, str, str, str | None, str, str, Path | None] | Result:
207
+ """Ask for each value the flags left out; a failed policy lookup is returned."""
208
+ if policy_id is None:
209
+ policies = timeoff_service.timeoff_types_list()
210
+ if not policies.ok:
211
+ return policies
212
+ rows = dig(policies.data, "timeOffPolicies")
213
+ if not rows:
214
+ raise typer.BadParameter("No time-off policies available.")
215
+ selected = prompts.pick(rows, ("id", "policy_name"), "Select a policy")
216
+ policy_id = str(selected["id"])
217
+ date = prompts.ask_required(
218
+ "Date (YYYY-MM-DD)", date or "", default=date_type.today().isoformat()
219
+ )
220
+ reason = prompts.ask_required("Reason", reason or "")
221
+ if half_day is None:
222
+ leave_type = Prompt.ask(
223
+ "Leave type",
224
+ choices=["full", "before", "after"],
225
+ default="full",
226
+ console=console,
227
+ )
228
+ half_day = None if leave_type == "full" else leave_type
229
+ if half_day:
230
+ schedule_in = prompts.ask_required("Schedule start (HH:MM)", schedule_in)
231
+ schedule_out = prompts.ask_required("Schedule end (HH:MM)", schedule_out)
232
+ file_path = prompts.ask_path("Attachment path (optional)", file_path)
233
+ return date, policy_id, reason, half_day, schedule_in, schedule_out, file_path
234
+
235
+
236
+ def _check_request(
237
+ date: str | None,
238
+ policy_id: str | None,
239
+ reason: str | None,
240
+ half_day: str | None,
241
+ schedule_in: str,
242
+ schedule_out: str,
243
+ ) -> None:
244
+ """Raise a usage error for the first missing or invalid request option."""
245
+ if date is None:
246
+ raise typer.BadParameter("Missing option '--date'.", param_hint="--date")
247
+ if policy_id is None:
248
+ raise typer.BadParameter("Missing option '--policy-id'.", param_hint="--policy-id")
249
+ if reason is None:
250
+ raise typer.BadParameter("Missing option '--reason'.", param_hint="--reason")
251
+
252
+ if iso_date(date) is None:
253
+ raise typer.BadParameter("date must use YYYY-MM-DD format", param_hint="--date")
254
+ if not policy_id.strip():
255
+ raise typer.BadParameter("policy_id must not be empty", param_hint="--policy-id")
256
+ if not reason.strip():
257
+ raise typer.BadParameter("reason must not be empty", param_hint="--reason")
258
+ if half_day not in {None, "before", "after"}:
259
+ raise typer.BadParameter(
260
+ "half-day must be before or after",
261
+ param_hint="--half-day",
262
+ )
263
+ if half_day:
264
+ if not schedule_in or not schedule_out:
265
+ raise typer.BadParameter(
266
+ "both schedule times are required for half-day leave",
267
+ param_hint="--schedule-in and --schedule-out",
268
+ )
269
+ if not _valid_schedule_time(schedule_in):
270
+ raise typer.BadParameter(
271
+ "schedule-in must use 24-hour HH:MM format",
272
+ param_hint="--schedule-in",
273
+ )
274
+ if not _valid_schedule_time(schedule_out):
275
+ raise typer.BadParameter(
276
+ "schedule-out must use 24-hour HH:MM format",
277
+ param_hint="--schedule-out",
278
+ )
279
+ elif schedule_in or schedule_out:
280
+ raise typer.BadParameter(
281
+ "schedule times require --half-day",
282
+ param_hint="--half-day",
283
+ )
284
+
285
+
203
286
  def timeoff_request(
204
287
  date: Annotated[
205
288
  str | None,
@@ -244,7 +327,6 @@ def timeoff_request(
244
327
  ] = None,
245
328
  interactive: InteractiveOption = False,
246
329
  json_output: JsonOption = False,
247
- table: TableOption = False,
248
330
  verbose: VerboseOption = False,
249
331
  ) -> None:
250
332
  """Request a full-day or half-day time off."""
@@ -253,79 +335,14 @@ def timeoff_request(
253
335
  if unavailable is not None:
254
336
  emit(unavailable, json_output)
255
337
  return
256
- if policy_id is None:
257
- policies = timeoff_service.timeoff_types_list()
258
- if not policies.ok:
259
- emit(policies, json_output)
260
- return
261
- rows = dig(policies.data, "timeOffPolicies")
262
- if not rows:
263
- raise typer.BadParameter("No time-off policies available.")
264
- selected = prompts.pick(rows, ("id", "policy_name"), "Select a policy")
265
- policy_id = str(selected["id"])
266
- date = prompts.ask_required(
267
- "Date (YYYY-MM-DD)", date or "", default=date_type.today().isoformat()
268
- )
269
- reason = prompts.ask_required("Reason", reason or "")
270
- if half_day is None:
271
- leave_type = Prompt.ask(
272
- "Leave type",
273
- choices=["full", "before", "after"],
274
- default="full",
275
- console=console,
276
- )
277
- half_day = None if leave_type == "full" else leave_type
278
- if half_day:
279
- schedule_in = prompts.ask_required("Schedule start (HH:MM)", schedule_in)
280
- schedule_out = prompts.ask_required("Schedule end (HH:MM)", schedule_out)
281
- file_path = prompts.ask_path("Attachment path (optional)", file_path)
282
-
283
- if date is None:
284
- raise typer.BadParameter("Missing option '--date'.", param_hint="--date")
285
- if policy_id is None:
286
- raise typer.BadParameter("Missing option '--policy-id'.", param_hint="--policy-id")
287
- if reason is None:
288
- raise typer.BadParameter("Missing option '--reason'.", param_hint="--reason")
289
-
290
- try:
291
- parsed_date = date_type.fromisoformat(date)
292
- except ValueError as error:
293
- raise typer.BadParameter(
294
- "date must use YYYY-MM-DD format",
295
- param_hint="--date",
296
- ) from error
297
- if parsed_date.isoformat() != date:
298
- raise typer.BadParameter("date must use YYYY-MM-DD format", param_hint="--date")
299
- if not policy_id.strip():
300
- raise typer.BadParameter("policy_id must not be empty", param_hint="--policy-id")
301
- if not reason.strip():
302
- raise typer.BadParameter("reason must not be empty", param_hint="--reason")
303
- if half_day not in {None, "before", "after"}:
304
- raise typer.BadParameter(
305
- "half-day must be before or after",
306
- param_hint="--half-day",
307
- )
308
- if half_day:
309
- if not schedule_in or not schedule_out:
310
- raise typer.BadParameter(
311
- "both schedule times are required for half-day leave",
312
- param_hint="--schedule-in and --schedule-out",
313
- )
314
- if not _valid_schedule_time(schedule_in):
315
- raise typer.BadParameter(
316
- "schedule-in must use 24-hour HH:MM format",
317
- param_hint="--schedule-in",
318
- )
319
- if not _valid_schedule_time(schedule_out):
320
- raise typer.BadParameter(
321
- "schedule-out must use 24-hour HH:MM format",
322
- param_hint="--schedule-out",
323
- )
324
- elif schedule_in or schedule_out:
325
- raise typer.BadParameter(
326
- "schedule times require --half-day",
327
- param_hint="--half-day",
338
+ asked = _prompt_missing(
339
+ date, policy_id, reason, half_day, schedule_in, schedule_out, file_path
328
340
  )
341
+ if isinstance(asked, Result):
342
+ emit(asked, json_output)
343
+ return
344
+ date, policy_id, reason, half_day, schedule_in, schedule_out, file_path = asked
345
+ _check_request(date, policy_id, reason, half_day, schedule_in, schedule_out)
329
346
 
330
347
  request_period = (
331
348
  f"{half_day}-break half-day from {schedule_in} to {schedule_out}"
@@ -371,7 +388,6 @@ def timeoff_cancel(
371
388
  ] = "1002",
372
389
  interactive: InteractiveOption = False,
373
390
  json_output: JsonOption = False,
374
- table: TableOption = False,
375
391
  verbose: VerboseOption = False,
376
392
  ) -> None:
377
393
  """Cancel a time-off request after confirmation."""
@@ -470,7 +486,6 @@ def timeoff_approve(
470
486
  ] = "",
471
487
  interactive: InteractiveOption = False,
472
488
  json_output: JsonOption = False,
473
- table: TableOption = False,
474
489
  verbose: VerboseOption = False,
475
490
  ) -> None:
476
491
  """Approve a time-off request after confirmation."""
@@ -48,9 +48,9 @@ from tlnt.cli.commands.status import status
48
48
  from tlnt.cli.commands import update as update_command
49
49
  from tlnt.cli.commands.update import update
50
50
  from tlnt.cli.commands.version import print_version
51
- from tlnt.cli.options import VerboseOption
51
+ from tlnt.cli.options import TlntCommand, VerboseOption
52
52
  from tlnt.core import config, play_store
53
- from tlnt.core.clients.mekari import constants as mekari_constants
53
+ from tlnt.core import mekari as mekari_constants
54
54
  from tlnt.core.logs import configure_logging
55
55
  from tlnt.core.logs import logger
56
56
 
@@ -73,46 +73,46 @@ timeoff_app = typer.Typer(no_args_is_help=True, help="Manage time-off data and r
73
73
  calendar_app = typer.Typer(no_args_is_help=True, help="Read calendar data.")
74
74
 
75
75
  # Add root commands to the main app
76
- app.command(rich_help_panel="Session")(setup)
77
- app.command(rich_help_panel="Session")(login)
78
- app.command(rich_help_panel="Session")(logout)
79
- app.command(rich_help_panel="Session")(status)
80
- app.command(rich_help_panel="Session")(profile)
76
+ app.command(rich_help_panel="Session", cls=TlntCommand)(setup)
77
+ app.command(rich_help_panel="Session", cls=TlntCommand)(login)
78
+ app.command(rich_help_panel="Session", cls=TlntCommand)(logout)
79
+ app.command(rich_help_panel="Session", cls=TlntCommand)(status)
80
+ app.command(rich_help_panel="Session", cls=TlntCommand)(profile)
81
81
  app.command(rich_help_panel="Session")(update)
82
82
  app.command(rich_help_panel="Integrations")(mcp)
83
83
 
84
84
  # Add commands to the attendance sub-app
85
- attendance_app.command(name="clock-in")(attendance_clockin)
86
- attendance_app.command(name="clock-out")(attendance_clockout)
87
- attendance_app.command(name="summary-list")(attendance_summary_list)
88
- attendance_app.command(name="summary-metrics")(attendance_summary_metrics)
89
- attendance_app.command(name="approve")(attendance_approve)
85
+ attendance_app.command(name="clock-in", cls=TlntCommand)(attendance_clockin)
86
+ attendance_app.command(name="clock-out", cls=TlntCommand)(attendance_clockout)
87
+ attendance_app.command(name="summary-list", cls=TlntCommand)(attendance_summary_list)
88
+ attendance_app.command(name="summary-metrics", cls=TlntCommand)(attendance_summary_metrics)
89
+ attendance_app.command(name="approve", cls=TlntCommand)(attendance_approve)
90
90
  app.add_typer(attendance_app, name="attendance", rich_help_panel="Workflows")
91
91
 
92
92
  # Add commands to the notification sub-app
93
- notification_app.command(name="count")(notification_count)
94
- notification_app.command(name="list")(notification_list)
95
- notification_app.command(name="attendance-list")(notification_attendance_list)
96
- notification_app.command(name="timeoff-list")(notification_timeoff_list)
97
- notification_app.command(name="detail")(notification_detail)
93
+ notification_app.command(name="count", cls=TlntCommand)(notification_count)
94
+ notification_app.command(name="list", cls=TlntCommand)(notification_list)
95
+ notification_app.command(name="attendance-list", cls=TlntCommand)(notification_attendance_list)
96
+ notification_app.command(name="timeoff-list", cls=TlntCommand)(notification_timeoff_list)
97
+ notification_app.command(name="detail", cls=TlntCommand)(notification_detail)
98
98
  app.add_typer(notification_app, name="notification", rich_help_panel="Workflows")
99
99
 
100
- timeoff_app.command(name="types-list")(timeoff_types_list)
101
- timeoff_app.command(name="balance")(timeoff_balance)
102
- timeoff_app.command(name="delegation-list")(timeoff_delegation_list)
103
- timeoff_app.command(name="list")(timeoff_list)
104
- timeoff_app.command(name="detail")(timeoff_detail)
105
- timeoff_app.command(name="request")(timeoff_request)
106
- timeoff_app.command(name="cancel")(timeoff_cancel)
107
- timeoff_app.command(name="approve")(timeoff_approve)
100
+ timeoff_app.command(name="types-list", cls=TlntCommand)(timeoff_types_list)
101
+ timeoff_app.command(name="balance", cls=TlntCommand)(timeoff_balance)
102
+ timeoff_app.command(name="delegation-list", cls=TlntCommand)(timeoff_delegation_list)
103
+ timeoff_app.command(name="list", cls=TlntCommand)(timeoff_list)
104
+ timeoff_app.command(name="detail", cls=TlntCommand)(timeoff_detail)
105
+ timeoff_app.command(name="request", cls=TlntCommand)(timeoff_request)
106
+ timeoff_app.command(name="cancel", cls=TlntCommand)(timeoff_cancel)
107
+ timeoff_app.command(name="approve", cls=TlntCommand)(timeoff_approve)
108
108
  app.add_typer(timeoff_app, name="timeoff", rich_help_panel="Workflows")
109
109
 
110
- calendar_app.command(name="holiday")(calendar_holiday)
111
- calendar_app.command(name="timeoff")(calendar_timeoff)
112
- calendar_app.command(name="index")(calendar_index)
113
- calendar_app.command(name="my-birthday")(calendar_my_birthday)
114
- calendar_app.command(name="birthday")(calendar_birthday)
115
- calendar_app.command(name="activity")(calendar_activity)
110
+ calendar_app.command(name="holiday", cls=TlntCommand)(calendar_holiday)
111
+ calendar_app.command(name="timeoff", cls=TlntCommand)(calendar_timeoff)
112
+ calendar_app.command(name="index", cls=TlntCommand)(calendar_index)
113
+ calendar_app.command(name="my-birthday", cls=TlntCommand)(calendar_my_birthday)
114
+ calendar_app.command(name="birthday", cls=TlntCommand)(calendar_birthday)
115
+ calendar_app.command(name="activity", cls=TlntCommand)(calendar_activity)
116
116
  app.add_typer(calendar_app, name="calendar", rich_help_panel="Workflows")
117
117
 
118
118