@apet97/clockify-cli-115 1.0.0 → 3.0.0

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.
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  Command-line interface for [Clockify](https://clockify.me/), built on
4
4
  top of `clockify-sdk-ts-115`.
5
5
 
6
- Current release: `1.0.0`. Requires Node.js `>=22.13.0` and
7
- `clockify-sdk-ts-115 ^1`.
6
+ Current release: `3.0.0`. Requires Node.js `>=22.13.0` and
7
+ `clockify-sdk-ts-115 ^3`.
8
8
 
9
9
  Two binaries, identical behavior:
10
10
 
@@ -74,12 +74,13 @@ touching production credentials.
74
74
  `--select 0.name`) before emitting JSON or NDJSON.
75
75
 
76
76
  In `json` and `ndjson` modes, errors go to stderr as `{"ok": false, "error":
77
- "...", "code": "...", "recovery": "...", "retryable": true|false}`; success-only
78
- commands emit `{"ok": true, "message": "..."}`. `--no-color` disables ANSI
79
- codes, and the CLI also auto-disables color when stdout is not a TTY.
77
+ "...", "code": "...", "recovery": "...", "retryable": true|false}`.
80
78
  Successful write commands in JSON and NDJSON include receipt fields:
81
79
  `ok`, `action`, `entity`, `ids`, `changed`, `warnings`, and `next`.
82
80
  Legacy top-level fields such as `id` remain for simple shell scripts.
81
+ Read-only commands (e.g. `status`, `entries list`) print the requested
82
+ object or array directly, with no `ok` wrapper. `--no-color` disables
83
+ ANSI codes, and the CLI also auto-disables color when stdout is not a TTY.
83
84
 
84
85
  ## Commands
85
86
 
@@ -239,7 +240,7 @@ node dist/index.js status # smoke test (or invoke installed clk115/clockify11
239
240
  ```
240
241
 
241
242
  `clockify-sdk-ts-115` is workspace-linked for local development and is a
242
- `^1` peer dependency for published consumers.
243
+ `^3` peer dependency for published consumers.
243
244
 
244
245
  ## License
245
246
 
package/dist/client.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { requireApiKey } from "./config.js";
2
- const REGIONAL_PREFIXES = ["eu", "us", "uk", "au"];
3
- const KNOWN_REGIONS = ["global", ...REGIONAL_PREFIXES, "developer"];
2
+ export const REGIONAL_PREFIXES = ["eu", "us", "uk", "au"];
3
+ export const KNOWN_REGIONS = ["global", ...REGIONAL_PREFIXES, "developer"];
4
4
  export function buildRoutingOptions(region, subdomain) {
5
5
  if (region === undefined && subdomain === undefined)
6
6
  return undefined;
@@ -25,12 +25,21 @@ export function buildRoutingOptions(region, subdomain) {
25
25
  acknowledgeUnconfirmedRegion: true,
26
26
  };
27
27
  }
28
+ export function unconfirmedRegionNotice(routing) {
29
+ if (routing === undefined || routing.profile === "global")
30
+ return undefined;
31
+ const host = routing.profile === "subdomain" ? `${routing.subdomain} (${routing.region})` : routing.profile;
32
+ return `clk115: using the unconfirmed "${host}" Clockify profile. Only the global profile is live-confirmed; drop --region/--subdomain (and CLOCKIFY_REGION/CLOCKIFY_SUBDOMAIN or the rc-file entry) to route to api.clockify.me.`;
33
+ }
28
34
  export async function buildClient(config) {
29
35
  const apiKey = requireApiKey(config);
30
36
  const routing = buildRoutingOptions(config.region, config.subdomain);
31
37
  if (routing !== undefined && config.baseUrl !== undefined) {
32
38
  throw new Error("clk115: --region/--subdomain and --base-url configure the same thing two different ways; provide only one of them.");
33
39
  }
40
+ const notice = unconfirmedRegionNotice(routing);
41
+ if (notice !== undefined)
42
+ process.stderr.write(`${notice}\n`);
34
43
  const { createClockifyClient } = await import("clockify-sdk-ts-115");
35
44
  if (routing !== undefined) {
36
45
  return createClockifyClient({ apiKey, allowNonClockifyHttpsHost: false, routing });
@@ -1,22 +1,29 @@
1
1
  import { InvalidArgumentError } from "commander";
2
2
  import { requireWorkspaceId } from "../config.js";
3
3
  import { globalFlags, resolveFlags } from "../index.js";
4
+ function parseStrictNumber(value) {
5
+ const trimmed = value.trim();
6
+ if (trimmed === "" || /^[+-]?0[xXoObB]/.test(trimmed)) {
7
+ return Number.NaN;
8
+ }
9
+ return Number(trimmed);
10
+ }
4
11
  export function parseIntArg(value) {
5
- const parsed = Number.parseInt(value, 10);
12
+ const parsed = parseStrictNumber(value);
6
13
  if (!Number.isInteger(parsed) || parsed <= 0) {
7
14
  throw new InvalidArgumentError("must be a positive integer.");
8
15
  }
9
16
  return parsed;
10
17
  }
11
18
  export function parseFloatArg(value) {
12
- const parsed = Number.parseFloat(value);
19
+ const parsed = parseStrictNumber(value);
13
20
  if (!Number.isFinite(parsed) || parsed <= 0) {
14
21
  throw new InvalidArgumentError("must be a positive number.");
15
22
  }
16
23
  return parsed;
17
24
  }
18
25
  export function parseSignedFloatArg(value) {
19
- const parsed = Number.parseFloat(value);
26
+ const parsed = parseStrictNumber(value);
20
27
  if (!Number.isFinite(parsed)) {
21
28
  throw new InvalidArgumentError("must be a number.");
22
29
  }
@@ -207,8 +207,8 @@ export const CLOCKIFY_ERROR_CODES = [
207
207
  "cli",
208
208
  "mcp"
209
209
  ],
210
- "meaning": "A project, tag, or client name stayed reserved briefly after deletion, so an immediate recreate with the same name was rejected.",
211
- "recovery": "Wait for the reservation window, reuse the existing object when present, or create the new entity with a distinct name.",
210
+ "meaning": "A project, tag, or client with that name already exists. Archived entities keep holding their name, so the conflict is often with something the list call hides by default. (Live probe 2026-08-07: deleting an entity releases its name immediately, so the code's own name is a misnomer kept for compatibility.)",
211
+ "recovery": "List the entity type including archived rows to find the holder, then reuse it, rename it, or delete it. Waiting does not help — the name is held for as long as the entity exists.",
212
212
  "reachable": false
213
213
  },
214
214
  {
@@ -245,6 +245,9 @@ export function errorCodeForMessage(message) {
245
245
  return "not_found";
246
246
  if (/(unauthorized|forbidden|permission|api[\s_-]?key|addon[\s_-]?token|CLOCKIFY_API_KEY|CLOCKIFY_ADDON_TOKEN|workspace id not set)/i.test(message))
247
247
  return "auth_or_permission";
248
+ if (/(upstream|gateway|bad gateway|service unavailable|internal server error)/i.test(message)) {
249
+ return "clockify_upstream_error";
250
+ }
248
251
  if (/(required|provide|missing|invalid|unknown option|unknown command|could not parse|not valid|must use|must not|confirmation token)/i.test(message)) {
249
252
  return "invalid_request";
250
253
  }
@@ -1 +1 @@
1
- export const PACKAGE_VERSION = "1.0.0";
1
+ export const PACKAGE_VERSION = "3.0.0";
package/dist/output.js CHANGED
@@ -42,18 +42,6 @@ export function printObject(obj, opts) {
42
42
  }
43
43
  console.log(table.toString());
44
44
  }
45
- export function printSuccess(message, opts) {
46
- if (opts.mode === "ndjson") {
47
- printNdjson({ ok: true, message }, opts);
48
- return;
49
- }
50
- if (opts.mode === "json") {
51
- printJson({ ok: true, message }, opts);
52
- return;
53
- }
54
- const prefix = opts.color ? pc.green("OK") : "OK";
55
- console.log(`${prefix} ${message}`);
56
- }
57
45
  export function printError(message, opts, statusCode) {
58
46
  const messageCode = errorCodeForMessage(message);
59
47
  const code = messageCode === "not_found" && statusCode === 400
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@apet97/clockify-cli-115",
3
- "version": "1.0.0",
4
- "description": "Unofficial, community-built — not affiliated with CAKE.com or Clockify. Command-line interface for Clockify, built on clockify-sdk-ts-115.",
3
+ "version": "3.0.0",
4
+ "description": "Unofficial, community-built \u2014 not affiliated with CAKE.com or Clockify. Command-line interface for Clockify, built on clockify-sdk-ts-115.",
5
5
  "license": "MIT",
6
- "author": "Aleksandar Petković <petkovic.aleksandar037@gmail.com>",
6
+ "author": "Aleksandar Petkovi\u0107 <petkovic.aleksandar037@gmail.com>",
7
7
  "homepage": "https://github.com/apet97/clockify-ts-sdk/tree/main/cli",
8
8
  "repository": {
9
9
  "type": "git",
@@ -54,7 +54,7 @@
54
54
  "zod": "^4.4.3"
55
55
  },
56
56
  "peerDependencies": {
57
- "clockify-sdk-ts-115": "^1"
57
+ "clockify-sdk-ts-115": "^3"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/node": "^22",