@apet97/clockify-cli-115 6.0.0 → 8.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.
Files changed (48) hide show
  1. package/README.md +167 -21
  2. package/dist/client.js +30 -7
  3. package/dist/commands/api.js +44 -76
  4. package/dist/commands/approvals.js +2 -5
  5. package/dist/commands/auth.js +229 -0
  6. package/dist/commands/balanceAssignment.js +5 -12
  7. package/dist/commands/batch.js +226 -0
  8. package/dist/commands/clients.js +18 -79
  9. package/dist/commands/doctor.js +65 -66
  10. package/dist/commands/entries.js +5 -8
  11. package/dist/commands/expenses.js +29 -39
  12. package/dist/commands/helpers.js +68 -30
  13. package/dist/commands/invoices.js +3 -3
  14. package/dist/commands/leaf-command.js +7 -0
  15. package/dist/commands/manifest.js +63 -0
  16. package/dist/commands/operations.js +271 -0
  17. package/dist/commands/projects.js +17 -37
  18. package/dist/commands/reports.js +22 -7
  19. package/dist/commands/shared-report-body.js +14 -81
  20. package/dist/commands/sharedReports.js +8 -47
  21. package/dist/commands/skill.js +85 -0
  22. package/dist/commands/status.js +19 -13
  23. package/dist/commands/stop.js +3 -12
  24. package/dist/commands/tags.js +12 -21
  25. package/dist/commands/tasks.js +26 -134
  26. package/dist/commands/timeoff.js +1 -1
  27. package/dist/commands/users.js +4 -14
  28. package/dist/commands/webhook-delivery.js +331 -0
  29. package/dist/commands/webhooks.js +37 -110
  30. package/dist/completions.js +2 -1
  31. package/dist/config.js +166 -63
  32. package/dist/credentials.js +164 -0
  33. package/dist/failure.js +4 -9
  34. package/dist/flags.js +14 -4
  35. package/dist/generated/version.js +1 -1
  36. package/dist/index.js +38 -15
  37. package/dist/interrupts.js +28 -0
  38. package/dist/output.js +137 -48
  39. package/dist/receipt.js +2 -10
  40. package/dist/stdin.js +6 -0
  41. package/dist/stdout.js +38 -0
  42. package/dist/write-outcome.js +1 -1
  43. package/package.json +5 -3
  44. package/plugin/.claude-plugin/plugin.json +16 -0
  45. package/plugin/skills/clockify-cli/SKILL.md +88 -0
  46. package/plugin/skills/clockify-mcp/SKILL.md +48 -0
  47. package/plugin/skills/clockify-sdk/SKILL.md +85 -0
  48. package/dist/error-codes.js +0 -300
@@ -0,0 +1,85 @@
1
+ import { lstatSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { UsageError } from "../failure.js";
6
+ import { resolveFlags } from "../flags.js";
7
+ import { fixedColumns, printObject, printRecords } from "../output.js";
8
+ import { rootProgram } from "./helpers.js";
9
+ import { leafCommand } from "./leaf-command.js";
10
+ const SKILLS = fileURLToPath(new URL("../../plugin/skills/", import.meta.url));
11
+ const skillNames = () => readdirSync(SKILLS).sort();
12
+ function readSkill(name) {
13
+ if (!skillNames().includes(name))
14
+ throw new UsageError(`Unknown skill "${name}". Provide one of: ${skillNames().join(", ")}.`);
15
+ return readFileSync(path.join(SKILLS, name, "SKILL.md"), "utf8");
16
+ }
17
+ function installedText(file) {
18
+ try {
19
+ for (const target of [path.dirname(file), file]) {
20
+ if (lstatSync(target, { throwIfNoEntry: false })?.isSymbolicLink()) {
21
+ throw new Error(`${target} is a symbolic link; remove it, or pass another --dir.`);
22
+ }
23
+ }
24
+ return readFileSync(file, "utf8");
25
+ }
26
+ catch (err) {
27
+ if (err.code === "ENOENT")
28
+ return undefined;
29
+ throw new UsageError(`Nothing was written. ${err.message}`);
30
+ }
31
+ }
32
+ const description = (text) => /^description: (.*)$/m.exec(text)?.[1] ?? "";
33
+ export const registerSkillCommand = (program) => {
34
+ const skill = program.command("skill").description("Agent skills that come with this command line.");
35
+ leafCommand(skill, "list", "read")
36
+ .description("List the skills.")
37
+ .addHelpText("after", "\nExamples:\n $ clk115 skill list\n")
38
+ .action(function () {
39
+ const output = fixedColumns(["name", "description"], resolveFlags(rootProgram(this)));
40
+ printRecords(skillNames().map((name) => ({ name, description: description(readSkill(name)) })), output);
41
+ });
42
+ leafCommand(skill, "show <name>", "read")
43
+ .description("Print a skill.")
44
+ .addHelpText("after", "\nExamples:\n $ clk115 skill show clockify-cli\n")
45
+ .action(function (name) {
46
+ const output = fixedColumns(["name", "description", "text"], resolveFlags(rootProgram(this)));
47
+ const text = readSkill(name);
48
+ if (output.mode === "table")
49
+ process.stdout.write(text);
50
+ else
51
+ printObject({ name, description: description(text), text }, output);
52
+ });
53
+ leafCommand(skill, "install [names...]", "local")
54
+ .description("Copy skills into a directory an agent reads. Without names, all of them.")
55
+ .option("--dir <path>", "Target directory.", path.join(".claude", "skills"))
56
+ .option("--personal", "Install for every project of yours, in ~/.claude/skills.", false)
57
+ .option("--force", "Replace a skill that differs from the one that comes with this version.", false)
58
+ .addHelpText("after", "\nExamples:\n" +
59
+ " $ clk115 skill install\n" +
60
+ " $ clk115 skill install clockify-cli --personal\n" +
61
+ " $ clk115 skill install --dir .agents/skills --force\n")
62
+ .action(function (names, opts) {
63
+ const output = fixedColumns(["name", "state", "file"], resolveFlags(rootProgram(this)));
64
+ if (opts.personal && this.getOptionValueSource("dir") !== "default")
65
+ throw new UsageError("Provide only one of --personal and --dir.");
66
+ const root = opts.personal ? path.join(homedir(), ".claude", "skills") : opts.dir;
67
+ const planned = (names.length > 0 ? names : skillNames()).map((name) => {
68
+ const text = readSkill(name);
69
+ const file = path.resolve(root, name, "SKILL.md");
70
+ const before = installedText(file);
71
+ return { name, text, file, state: before === undefined ? "created" : before === text ? "unchanged" : "replaced" };
72
+ });
73
+ const differing = planned.filter(({ state }) => state === "replaced");
74
+ if (differing.length > 0 && !opts.force) {
75
+ throw new UsageError(`Nothing was written. ${differing.map(({ file }) => file).join(", ")} differs; pass --force to replace it.`);
76
+ }
77
+ for (const { file, text, state } of planned) {
78
+ if (state === "unchanged")
79
+ continue;
80
+ mkdirSync(path.dirname(file), { recursive: true });
81
+ writeFileSync(file, text);
82
+ }
83
+ printRecords(planned.map(({ name, state, file }) => ({ name, state, file })), output);
84
+ });
85
+ };
@@ -1,12 +1,25 @@
1
1
  import { entityId } from "clockify-sdk-ts-115/operation-receipt";
2
+ import { runningEntryOf } from "clockify-sdk-ts-115/timer";
2
3
  import { formatIsoDuration } from "../duration.js";
3
- import { printObject } from "../output.js";
4
- import { resolveBaseContext } from "./helpers.js";
4
+ import { resolveFlags } from "../flags.js";
5
+ import { fixedColumns, printObject } from "../output.js";
6
+ import { resolveBaseContext, rootProgram } from "./helpers.js";
5
7
  import { leafCommand } from "./leaf-command.js";
6
8
  const TIMER_UNAVAILABLE = {
7
9
  user_id_missing: "(timer lookup skipped: current user ID unavailable)",
8
10
  response_unrecognized: "(timer state unknown: unrecognized response to the timer lookup)",
9
11
  };
12
+ const STATUS_KEYS = [
13
+ "workspaceId",
14
+ "userId",
15
+ "email",
16
+ "name",
17
+ "timerState",
18
+ "timerStateReason",
19
+ "runningEntry",
20
+ "availableWorkspaces",
21
+ "hint",
22
+ ];
10
23
  export const registerStatusCommand = (program, services) => {
11
24
  leafCommand(program, "status", "read")
12
25
  .description("Show the configured workspace, current user, and running timer.")
@@ -14,11 +27,12 @@ export const registerStatusCommand = (program, services) => {
14
27
  " $ clk115 status\n" +
15
28
  " $ clk115 status --json\n")
16
29
  .action(async function () {
17
- const { client, config, output } = await resolveBaseContext(this, services);
30
+ const output = fixedColumns(STATUS_KEYS, resolveFlags(rootProgram(this)));
31
+ const { client, config } = await resolveBaseContext(this, services, output);
18
32
  const user = await client.users.getCurrentUser();
19
33
  let statusState;
20
34
  if (!config.workspaceId) {
21
- const workspaces = (await client.workspaces.list());
35
+ const workspaces = await client.workspaces.list();
22
36
  statusState = {
23
37
  kind: "workspace_unconfigured",
24
38
  availableWorkspaces: workspaces.map((w) => ({
@@ -37,7 +51,7 @@ export const registerStatusCommand = (program, services) => {
37
51
  "in-progress": true,
38
52
  "page-size": 1,
39
53
  }));
40
- const entry = entries?.find((candidate) => isOwn(candidate, user) && isRunning(candidate));
54
+ const entry = entries && runningEntryOf(entries, userId);
41
55
  if (entries === undefined) {
42
56
  statusState = { kind: "unavailable", workspaceId, reason: "response_unrecognized" };
43
57
  }
@@ -92,14 +106,6 @@ function normaliseEntries(resp) {
92
106
  }
93
107
  return undefined;
94
108
  }
95
- function isOwn(entry, user) {
96
- const entryUserId = entry.userId;
97
- const userId = entityId(user);
98
- return entryUserId !== undefined && userId !== undefined && entryUserId === userId;
99
- }
100
- function isRunning(entry) {
101
- return entry.timeInterval?.end == null;
102
- }
103
109
  function extractStart(entry) {
104
110
  const interval = entry.timeInterval;
105
111
  return interval?.start ?? "";
@@ -1,3 +1,4 @@
1
+ import { findRunningEntry } from "clockify-sdk-ts-115/timer";
1
2
  import { printReceipt } from "../receipt.js";
2
3
  import { dispatchedWrite } from "../write-outcome.js";
3
4
  import { requireCurrentUserId, resolveContext } from "./helpers.js";
@@ -11,18 +12,8 @@ export const registerStopCommand = (program, services) => {
11
12
  .action(async function () {
12
13
  const { client, workspaceId, output } = await resolveContext(this, services);
13
14
  const userId = await requireCurrentUserId(client);
14
- let timerState = { kind: "idle" };
15
- const entries = await client.timeEntries.listForUser({
16
- workspaceId,
17
- userId,
18
- "in-progress": true,
19
- "page-size": 1,
20
- });
21
- const running = entries.find((entry) => entry.userId === userId && entry.id && entry.timeInterval?.end == null);
22
- if (running?.id && running.userId) {
23
- timerState = { kind: "running", entry: { id: running.id, userId: running.userId } };
24
- }
25
- if (timerState.kind === "idle") {
15
+ const running = await findRunningEntry(client, { workspaceId, userId });
16
+ if (running === undefined) {
26
17
  printReceipt({
27
18
  ok: true,
28
19
  action: "timer.stop",
@@ -1,8 +1,9 @@
1
+ import { tagUpdate } from "clockify-sdk-ts-115/updates";
1
2
  import { UsageError } from "../failure.js";
2
3
  import { printObject, printRecords } from "../output.js";
3
4
  import { printReceipt } from "../receipt.js";
4
5
  import { dispatchedWrite } from "../write-outcome.js";
5
- import { clampPageSize, parseIntArg, resolveContext } from "./helpers.js";
6
+ import { clampPageSize, parseIntArg, printDeleted, resolveContext } from "./helpers.js";
6
7
  import { leafCommand } from "./leaf-command.js";
7
8
  export const registerTagsCommand = (program, services) => {
8
9
  const tags = program.command("tags").description("Manage tags.");
@@ -44,7 +45,7 @@ export const registerTagsCommand = (program, services) => {
44
45
  .action(async function (name) {
45
46
  const { client, workspaceId, output } = await resolveContext(this, services);
46
47
  const req = { workspaceId, body: { name } };
47
- const created = (await dispatchedWrite(this, client.tags.create(req)));
48
+ const created = await dispatchedWrite(this, client.tags.create(req));
48
49
  const data = { id: created.id ?? "", name: created.name ?? "" };
49
50
  printReceipt({
50
51
  ok: true,
@@ -81,15 +82,12 @@ export const registerTagsCommand = (program, services) => {
81
82
  throw new UsageError("tags.update needs a change: provide at least one tag field.");
82
83
  }
83
84
  const { client, workspaceId, output } = await resolveContext(this, services);
84
- const current = opts.name && opts.archived !== undefined
85
- ? {}
86
- : (await client.tags.get({ workspaceId, tagId: id }));
87
- const body = {
88
- name: opts.name ? opts.name : (current.name ?? ""),
89
- archived: opts.archived ?? current.archived ?? false,
90
- };
85
+ const patch = { name: opts.name || undefined, archived: opts.archived };
86
+ const complete = patch.name !== undefined && patch.archived !== undefined;
87
+ const current = complete ? {} : await client.tags.get({ workspaceId, tagId: id });
88
+ const body = tagUpdate.body(current, patch);
91
89
  const req = { workspaceId, tagId: id, body };
92
- const updated = (await dispatchedWrite(this, client.tags.update(req)));
90
+ const updated = await dispatchedWrite(this, client.tags.update(req));
93
91
  const data = { id: updated.id ?? id, name: updated.name ?? "" };
94
92
  printReceipt({
95
93
  ok: true,
@@ -108,19 +106,12 @@ export const registerTagsCommand = (program, services) => {
108
106
  .action(async function (id) {
109
107
  const { client, workspaceId, output } = await resolveContext(this, services);
110
108
  await dispatchedWrite(this, client.tags.delete({ workspaceId, tagId: id }));
111
- printReceipt({
112
- ok: true,
109
+ printDeleted(output, {
113
110
  action: "tags.delete",
114
111
  entity: "tag",
112
+ id,
115
113
  ids: { tagId: id },
116
- data: { id, deleted: true, message: `deleted tag ${id}` },
117
- changed: { deleted: [{ type: "tag", id }] },
118
- next: [
119
- {
120
- command: "clk115 tags list --json",
121
- reason: "Verify the tag no longer appears.",
122
- },
123
- ],
124
- }, output);
114
+ list: "tags list",
115
+ });
125
116
  });
126
117
  };
@@ -1,89 +1,17 @@
1
+ import { taskUpdate } from "clockify-sdk-ts-115/updates";
1
2
  import { PartialDeleteError, UsageError } from "../failure.js";
2
3
  import { printObject, printRecords } from "../output.js";
3
4
  import { printReceipt } from "../receipt.js";
4
5
  import { dispatchedWrite } from "../write-outcome.js";
5
- import { clampPageSize, parseIntArg, resolveContext } from "./helpers.js";
6
+ import { clampPageSize, parseIntArg, printDeleted, resolveContext } from "./helpers.js";
6
7
  import { leafCommand } from "./leaf-command.js";
7
- function requireTaskName(value, source) {
8
- if (typeof value !== "string" || value.trim() === "") {
9
- throw new Error(`${source} is missing the required task name; refusing to mutate.`);
10
- }
11
- return value;
12
- }
13
- function taskStatus(value, source, operatorInput = false) {
8
+ function taskStatus(value) {
14
9
  const status = String(value).toUpperCase();
15
10
  if (status !== "ACTIVE" && status !== "DONE") {
16
- const message = `${source} has unknown task status: ${String(value)}; provide ACTIVE or DONE`;
17
- throw operatorInput ? new UsageError(message) : new Error(message);
11
+ throw new UsageError(`Task update request has unknown task status: ${String(value)}; provide ACTIVE or DONE`);
18
12
  }
19
13
  return status;
20
14
  }
21
- function stringList(value, field) {
22
- if (value === undefined)
23
- return undefined;
24
- if (!Array.isArray(value) || value.some((item) => typeof item !== "string")) {
25
- throw new Error(`Current task has invalid ${field}; refusing to mutate.`);
26
- }
27
- return [...value];
28
- }
29
- function optionalTaskString(value, field) {
30
- if (value === undefined)
31
- return undefined;
32
- if (typeof value !== "string") {
33
- throw new Error(`Current task has invalid ${field}; refusing to mutate.`);
34
- }
35
- return value;
36
- }
37
- function optionalNullableTaskString(value, field) {
38
- if (value === null)
39
- return undefined;
40
- return optionalTaskString(value, field);
41
- }
42
- function requiredTaskBoolean(value, field) {
43
- if (typeof value !== "boolean") {
44
- throw new Error(`Current task has invalid or missing ${field}; refusing to mutate.`);
45
- }
46
- return value;
47
- }
48
- function optionalTaskInteger(value, field) {
49
- if (value === undefined)
50
- return undefined;
51
- if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value)) {
52
- throw new Error(`Current task has invalid ${field}; refusing to mutate.`);
53
- }
54
- return value;
55
- }
56
- function sameStringList(left, right) {
57
- return left !== undefined && left.length === right.length && left.every((item, i) => item === right[i]);
58
- }
59
- function reconstructTaskBody(current, suppliedName) {
60
- const body = {
61
- name: suppliedName !== undefined
62
- ? requireTaskName(suppliedName, "Task update request")
63
- : requireTaskName(current.name, "Current task"),
64
- };
65
- const assigneeId = optionalNullableTaskString(current.assigneeId, "assigneeId");
66
- if (assigneeId !== undefined)
67
- body.assigneeId = assigneeId;
68
- const assigneeIds = stringList(current.assigneeIds, "assigneeIds");
69
- if (assigneeIds !== undefined)
70
- body.assigneeIds = assigneeIds;
71
- body.billable = requiredTaskBoolean(current.billable, "billable");
72
- const budgetEstimate = optionalTaskInteger(current.budgetEstimate, "budgetEstimate");
73
- if (budgetEstimate !== undefined)
74
- body.budgetEstimate = budgetEstimate;
75
- const estimate = optionalTaskString(current.estimate, "estimate");
76
- if (estimate !== undefined)
77
- body.estimate = estimate;
78
- if (current.status === undefined) {
79
- throw new Error("Current task is missing the required status; refusing to mutate.");
80
- }
81
- body.status = taskStatus(current.status, "Current task");
82
- const userGroupIds = stringList(current.userGroupIds, "userGroupIds");
83
- if (userGroupIds !== undefined)
84
- body.userGroupIds = userGroupIds;
85
- return body;
86
- }
87
15
  export const registerTasksCommand = (program, services) => {
88
16
  const tasks = program.command("tasks").description("Manage tasks.");
89
17
  leafCommand(tasks, "list", "read")
@@ -129,7 +57,8 @@ export const registerTasksCommand = (program, services) => {
129
57
  " $ clk115 tasks create project_123 Design --billable --estimate PT8H\n")
130
58
  .action(async function (projectId, name, opts) {
131
59
  const { client, workspaceId, output } = await resolveContext(this, services);
132
- requireTaskName(name, "Task create request");
60
+ if (name.trim() === "")
61
+ throw new Error("Task create request is missing the required task name.");
133
62
  const body = { name };
134
63
  if (opts.billable !== undefined)
135
64
  body.billable = opts.billable;
@@ -142,7 +71,7 @@ export const registerTasksCommand = (program, services) => {
142
71
  projectId,
143
72
  body,
144
73
  };
145
- const created = (await dispatchedWrite(this, client.tasks.create(req)));
74
+ const created = await dispatchedWrite(this, client.tasks.create(req));
146
75
  const data = { id: created.id ?? "", name: created.name ?? name };
147
76
  printReceipt({
148
77
  ok: true,
@@ -191,34 +120,17 @@ export const registerTasksCommand = (program, services) => {
191
120
  if (!hasChanges) {
192
121
  throw new UsageError("tasks.update needs a change: provide at least one task field.");
193
122
  }
194
- const requestedStatus = opts.status === undefined
195
- ? undefined
196
- : taskStatus(opts.status, "Task update request", true);
123
+ const patch = {
124
+ name: opts.name,
125
+ estimate: opts.estimate,
126
+ billable: opts.billable,
127
+ assigneeIds: opts.assignee,
128
+ ...(opts.status === undefined ? {} : { status: taskStatus(opts.status) }),
129
+ };
197
130
  const { client, workspaceId, output } = await resolveContext(this, services);
198
- const current = (await client.tasks.get({
199
- workspaceId,
200
- projectId,
201
- taskId: id,
202
- }));
203
- const body = reconstructTaskBody(current, opts.name);
204
- let changed = opts.name !== undefined && opts.name !== current.name;
205
- if (requestedStatus !== undefined) {
206
- changed = changed || requestedStatus !== body.status;
207
- body.status = requestedStatus;
208
- }
209
- if (opts.estimate !== undefined) {
210
- changed = changed || opts.estimate !== body.estimate;
211
- body.estimate = opts.estimate;
212
- }
213
- if (opts.billable !== undefined) {
214
- changed = changed || opts.billable !== body.billable;
215
- body.billable = opts.billable;
216
- }
217
- if (Array.isArray(opts.assignee)) {
218
- changed = changed || !sameStringList(body.assigneeIds, opts.assignee);
219
- body.assigneeIds = opts.assignee;
220
- }
221
- if (!changed) {
131
+ const current = await client.tasks.get({ workspaceId, projectId, taskId: id });
132
+ const body = taskUpdate.body(current, patch);
133
+ if (taskUpdate.changed(current, patch).length === 0) {
222
134
  throw new Error("tasks.update values are unchanged; provide a different value.");
223
135
  }
224
136
  const req = {
@@ -227,7 +139,7 @@ export const registerTasksCommand = (program, services) => {
227
139
  taskId: id,
228
140
  body,
229
141
  };
230
- const updated = (await dispatchedWrite(this, client.tasks.update(req)));
142
+ const updated = await dispatchedWrite(this, client.tasks.update(req));
231
143
  const data = { id: updated.id ?? id, name: updated.name ?? body.name };
232
144
  printReceipt({
233
145
  ok: true,
@@ -251,24 +163,11 @@ export const registerTasksCommand = (program, services) => {
251
163
  .addHelpText("after", "\nExamples:\n" + " $ clk115 tasks delete project_123 task_456\n")
252
164
  .action(async function (projectId, id) {
253
165
  const { client, workspaceId, output } = await resolveContext(this, services);
254
- const current = (await client.tasks.get({
255
- workspaceId,
256
- projectId,
257
- taskId: id,
258
- }));
259
- const originalBody = reconstructTaskBody(current);
260
- if (originalBody.status === undefined) {
261
- throw new Error("Current task is missing the required status for safe delete.");
262
- }
263
- const changedStatus = originalBody.status !== "DONE";
166
+ const current = await client.tasks.get({ workspaceId, projectId, taskId: id });
167
+ const changedStatus = taskUpdate.changed(current, { status: "DONE" }).length > 0;
168
+ const body = taskUpdate.body(current, { status: "DONE" });
264
169
  if (changedStatus) {
265
- const doneRequest = {
266
- workspaceId,
267
- projectId,
268
- taskId: id,
269
- body: { ...originalBody, status: "DONE" },
270
- };
271
- await dispatchedWrite(this, client.tasks.update(doneRequest));
170
+ await dispatchedWrite(this, client.tasks.update({ workspaceId, projectId, taskId: id, body }));
272
171
  }
273
172
  try {
274
173
  await dispatchedWrite(this, client.tasks.delete({ workspaceId, projectId, taskId: id }));
@@ -279,19 +178,12 @@ export const registerTasksCommand = (program, services) => {
279
178
  }
280
179
  throw error;
281
180
  }
282
- printReceipt({
283
- ok: true,
181
+ printDeleted(output, {
284
182
  action: "tasks.delete",
285
183
  entity: "task",
184
+ id,
286
185
  ids: { projectId, taskId: id },
287
- data: { id, deleted: true, message: `deleted task ${id}` },
288
- changed: { deleted: [{ type: "task", id }] },
289
- next: [
290
- {
291
- command: `clk115 tasks list ${projectId} --json`,
292
- reason: "Verify the task no longer appears.",
293
- },
294
- ],
295
- }, output);
186
+ list: `tasks list ${projectId}`,
187
+ });
296
188
  });
297
189
  };
@@ -111,7 +111,7 @@ export const registerTimeOffCommand = (program, services) => {
111
111
  policyId: opts.policy,
112
112
  body,
113
113
  };
114
- const created = (await dispatchedWrite(this, client.timeOff.submit(req)));
114
+ const created = await dispatchedWrite(this, client.timeOff.submit(req));
115
115
  const data = {
116
116
  id: created.id ?? "",
117
117
  user: created.userId ?? "",
@@ -1,23 +1,13 @@
1
+ import { DAYS_OF_WEEK } from "clockify-sdk-ts-115/requests";
1
2
  import { UsageError } from "../failure.js";
2
3
  import { printObject, printRecords } from "../output.js";
3
4
  import { printReceipt } from "../receipt.js";
4
5
  import { dispatchedWrite } from "../write-outcome.js";
5
6
  import { clampPageSize, parseIntArg, resolveBaseContext, resolveContext } from "./helpers.js";
6
7
  import { leafCommand } from "./leaf-command.js";
7
- const USER_DAYS = [
8
- "MONDAY",
9
- "TUESDAY",
10
- "WEDNESDAY",
11
- "THURSDAY",
12
- "FRIDAY",
13
- "SATURDAY",
14
- "SUNDAY",
15
- ];
16
- const userDaysExhaustive = true;
17
- void userDaysExhaustive;
18
8
  function requireUserDay(value, message) {
19
9
  const day = String(value).toUpperCase();
20
- if (!USER_DAYS.includes(day)) {
10
+ if (!DAYS_OF_WEEK.includes(day)) {
21
11
  throw new UsageError(message);
22
12
  }
23
13
  return day;
@@ -123,14 +113,14 @@ export const registerUsersCommand = (program, services) => {
123
113
  if (opts.removeImage)
124
114
  body.removeProfileImage = true;
125
115
  if (opts.weekStart !== undefined) {
126
- body.weekStart = requireUserDay(opts.weekStart, `--week-start must be one of: ${USER_DAYS.join(", ")}.`);
116
+ body.weekStart = requireUserDay(opts.weekStart, `--week-start must be one of: ${DAYS_OF_WEEK.join(", ")}.`);
127
117
  }
128
118
  if (opts.workCapacity !== undefined)
129
119
  body.workCapacity = opts.workCapacity;
130
120
  if (Array.isArray(opts.workingDays) && opts.workingDays.length > 0) {
131
121
  const days = [];
132
122
  for (const raw of opts.workingDays) {
133
- days.push(requireUserDay(raw, `--working-days entries must be one of: ${USER_DAYS.join(", ")}.`));
123
+ days.push(requireUserDay(raw, `--working-days entries must be one of: ${DAYS_OF_WEEK.join(", ")}.`));
134
124
  }
135
125
  body.workingDays = days;
136
126
  }