@apet97/clockify-cli-115 7.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.
- package/README.md +1 -1
- package/dist/commands/auth.js +1 -1
- package/dist/commands/balanceAssignment.js +5 -12
- package/dist/commands/clients.js +7 -14
- package/dist/commands/entries.js +5 -8
- package/dist/commands/expenses.js +9 -16
- package/dist/commands/helpers.js +23 -29
- package/dist/commands/invoices.js +3 -3
- package/dist/commands/projects.js +7 -14
- package/dist/commands/shared-report-body.js +12 -1
- package/dist/commands/sharedReports.js +7 -26
- package/dist/commands/status.js +1 -1
- package/dist/commands/tags.js +7 -14
- package/dist/commands/tasks.js +7 -14
- package/dist/commands/timeoff.js +1 -1
- package/dist/commands/webhooks.js +6 -13
- package/dist/generated/version.js +1 -1
- package/dist/index.js +0 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Command-line interface for [Clockify](https://clockify.me/), built on
|
|
4
4
|
top of `clockify-sdk-ts-115`.
|
|
5
5
|
|
|
6
|
-
Version in this checkout: `
|
|
6
|
+
Version in this checkout: `8.0.0`. Requires Node.js `>=22.13.0` and
|
|
7
7
|
`clockify-sdk-ts-115 ^7.0.0`.
|
|
8
8
|
|
|
9
9
|
Two binaries, identical behavior:
|
package/dist/commands/auth.js
CHANGED
|
@@ -15,7 +15,7 @@ async function keychain(services) {
|
|
|
15
15
|
return { ...credentials, store: services.credentials ?? credentials.systemCredentialStore };
|
|
16
16
|
}
|
|
17
17
|
async function reachableWorkspace(client, wanted) {
|
|
18
|
-
const workspaces =
|
|
18
|
+
const workspaces = await client.workspaces.list();
|
|
19
19
|
const found = workspaces.find(({ id }) => id === wanted);
|
|
20
20
|
if (found?.id !== undefined)
|
|
21
21
|
return { id: found.id, name: found.name ?? "" };
|
|
@@ -2,7 +2,7 @@ import { UsageError } from "../failure.js";
|
|
|
2
2
|
import { printRecords } from "../output.js";
|
|
3
3
|
import { printReceipt } from "../receipt.js";
|
|
4
4
|
import { dispatchedWrite } from "../write-outcome.js";
|
|
5
|
-
import { parseSignedFloatArg, requireCalendarDate, resolveContext, splitList, } from "./helpers.js";
|
|
5
|
+
import { parseSignedFloatArg, printDeleted, requireCalendarDate, resolveContext, splitList, } from "./helpers.js";
|
|
6
6
|
import { leafCommand } from "./leaf-command.js";
|
|
7
7
|
function dateRange(opts) {
|
|
8
8
|
if (opts.start === undefined && opts.end === undefined)
|
|
@@ -147,19 +147,12 @@ export function registerBalanceAssignmentCommands(timeoff, services) {
|
|
|
147
147
|
balanceAssignmentId: opts.id,
|
|
148
148
|
body: { note: opts.note },
|
|
149
149
|
}));
|
|
150
|
-
|
|
151
|
-
ok: true,
|
|
150
|
+
printDeleted(output, {
|
|
152
151
|
action: "timeoff.balance-assignment.delete",
|
|
153
152
|
entity: "balance_assignment",
|
|
153
|
+
id: opts.id,
|
|
154
154
|
ids: { balanceAssignmentId: opts.id, userId: opts.user, policyId: opts.policy },
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
next: [
|
|
158
|
-
{
|
|
159
|
-
command: `clk115 timeoff balance-assignment list --user ${opts.user} --policy ${opts.policy} --json`,
|
|
160
|
-
reason: "Verify the assignment no longer appears.",
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
}, output);
|
|
155
|
+
list: `timeoff balance-assignment list --user ${opts.user} --policy ${opts.policy}`,
|
|
156
|
+
});
|
|
164
157
|
});
|
|
165
158
|
}
|
package/dist/commands/clients.js
CHANGED
|
@@ -4,7 +4,7 @@ import { PartialDeleteError, UsageError } from "../failure.js";
|
|
|
4
4
|
import { printObject, printRecords } from "../output.js";
|
|
5
5
|
import { printReceipt } from "../receipt.js";
|
|
6
6
|
import { dispatchedWrite } from "../write-outcome.js";
|
|
7
|
-
import { clampPageSize, parseIntArg, resolveContext } from "./helpers.js";
|
|
7
|
+
import { clampPageSize, parseIntArg, printDeleted, resolveContext } from "./helpers.js";
|
|
8
8
|
import { leafCommand } from "./leaf-command.js";
|
|
9
9
|
function quoteShellArgument(value) {
|
|
10
10
|
return `'${value.replaceAll("'", "'\"'\"'")}'`;
|
|
@@ -56,7 +56,7 @@ export const registerClientsCommand = (program, services) => {
|
|
|
56
56
|
workspaceId,
|
|
57
57
|
body: { name, ...(opts.note !== undefined ? { note: opts.note } : {}) },
|
|
58
58
|
};
|
|
59
|
-
const created =
|
|
59
|
+
const created = await dispatchedWrite(this, client.clients.create(req));
|
|
60
60
|
const data = { id: created.id ?? "", name: created.name ?? "" };
|
|
61
61
|
printReceipt({
|
|
62
62
|
ok: true,
|
|
@@ -118,7 +118,7 @@ export const registerClientsCommand = (program, services) => {
|
|
|
118
118
|
clientId: id,
|
|
119
119
|
body,
|
|
120
120
|
};
|
|
121
|
-
const updated =
|
|
121
|
+
const updated = await dispatchedWrite(this, client.clients.update(req));
|
|
122
122
|
const data = { id: updated.id ?? id, name: updated.name ?? body.name };
|
|
123
123
|
printReceipt({
|
|
124
124
|
ok: true,
|
|
@@ -165,19 +165,12 @@ export const registerClientsCommand = (program, services) => {
|
|
|
165
165
|
},
|
|
166
166
|
},
|
|
167
167
|
});
|
|
168
|
-
|
|
169
|
-
ok: true,
|
|
168
|
+
printDeleted(output, {
|
|
170
169
|
action: "clients.delete",
|
|
171
170
|
entity: "client",
|
|
171
|
+
id,
|
|
172
172
|
ids: { clientId: id },
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
next: [
|
|
176
|
-
{
|
|
177
|
-
command: "clk115 clients list --json",
|
|
178
|
-
reason: "Verify the client no longer appears.",
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
}, output);
|
|
173
|
+
list: "clients list",
|
|
174
|
+
});
|
|
182
175
|
});
|
|
183
176
|
};
|
package/dist/commands/entries.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { UsageError } from "../failure.js";
|
|
2
2
|
import { printRecords } from "../output.js";
|
|
3
|
-
import { printReceipt } from "../receipt.js";
|
|
4
3
|
import { dispatchedWrite } from "../write-outcome.js";
|
|
5
|
-
import { clampPageSize, parseIntArg, parseTimeViewMode, promoteDateBoundary, requireCurrentUserId, resolveContext, splitList, TIME_VIEW_MODE_HELP, } from "./helpers.js";
|
|
4
|
+
import { clampPageSize, parseIntArg, parseTimeViewMode, printDeleted, promoteDateBoundary, requireCurrentUserId, resolveContext, splitList, TIME_VIEW_MODE_HELP, } from "./helpers.js";
|
|
6
5
|
import { leafCommand } from "./leaf-command.js";
|
|
7
6
|
export const registerEntriesCommand = (program, services) => {
|
|
8
7
|
const entries = program.command("entries").description("Manage time entries.");
|
|
@@ -100,14 +99,12 @@ export const registerEntriesCommand = (program, services) => {
|
|
|
100
99
|
.action(async function (id) {
|
|
101
100
|
const { client, workspaceId, output } = await resolveContext(this, services);
|
|
102
101
|
await dispatchedWrite(this, client.timeEntries.delete({ workspaceId, timeEntryId: id }));
|
|
103
|
-
|
|
104
|
-
ok: true,
|
|
102
|
+
printDeleted(output, {
|
|
105
103
|
action: "entries.delete",
|
|
106
104
|
entity: "time_entry",
|
|
105
|
+
id,
|
|
107
106
|
ids: { entryId: id },
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
next: [{ command: "clk115 entries list --json", reason: "Verify the entry no longer appears." }],
|
|
111
|
-
}, output);
|
|
107
|
+
list: "entries list",
|
|
108
|
+
});
|
|
112
109
|
});
|
|
113
110
|
};
|
|
@@ -7,7 +7,7 @@ import { resolveFlags } from "../flags.js";
|
|
|
7
7
|
import { pickFields, printObject, printRecords, printWarning, warnUnknownFields } from "../output.js";
|
|
8
8
|
import { printReceipt } from "../receipt.js";
|
|
9
9
|
import { dispatchedWrite } from "../write-outcome.js";
|
|
10
|
-
import { clampPageSize, parseFloatArg, parseIntArg, printScan, promoteDateBoundary, requireCurrentUserId, resolveContext, rootProgram, } from "./helpers.js";
|
|
10
|
+
import { clampPageSize, parseFloatArg, parseIntArg, printDeleted, printScan, promoteDateBoundary, requireCurrentUserId, resolveContext, rootProgram, } from "./helpers.js";
|
|
11
11
|
import { leafCommand } from "./leaf-command.js";
|
|
12
12
|
function parseExpenseAmount(value) {
|
|
13
13
|
const amount = parseFloatArg(value);
|
|
@@ -136,11 +136,11 @@ export const registerExpensesCommand = (program, services) => {
|
|
|
136
136
|
fields.notes = opts.notes;
|
|
137
137
|
if (opts.billable !== undefined)
|
|
138
138
|
fields.billable = opts.billable;
|
|
139
|
-
const created =
|
|
139
|
+
const created = await dispatchedWrite(this, client.expenses.create({
|
|
140
140
|
...fields,
|
|
141
141
|
userId,
|
|
142
142
|
workspaceId,
|
|
143
|
-
}))
|
|
143
|
+
}));
|
|
144
144
|
const data = { id: created.id ?? "" };
|
|
145
145
|
printReceipt({
|
|
146
146
|
ok: true,
|
|
@@ -196,13 +196,13 @@ export const registerExpensesCommand = (program, services) => {
|
|
|
196
196
|
fields.notes = opts.notes;
|
|
197
197
|
if (opts.billable !== undefined)
|
|
198
198
|
fields.billable = opts.billable;
|
|
199
|
-
const updated =
|
|
199
|
+
const updated = await dispatchedWrite(this, client.expenses.update({
|
|
200
200
|
...fields,
|
|
201
201
|
changeFields: expenseChangeFields(fields),
|
|
202
202
|
userId: opts.user,
|
|
203
203
|
expenseId: id,
|
|
204
204
|
workspaceId,
|
|
205
|
-
}))
|
|
205
|
+
}));
|
|
206
206
|
const data = { id: updated.id ?? id };
|
|
207
207
|
printReceipt({
|
|
208
208
|
ok: true,
|
|
@@ -226,19 +226,12 @@ export const registerExpensesCommand = (program, services) => {
|
|
|
226
226
|
.action(async function (id) {
|
|
227
227
|
const { client, workspaceId, output } = await resolveContext(this, services);
|
|
228
228
|
await dispatchedWrite(this, client.expenses.delete({ workspaceId, expenseId: id }));
|
|
229
|
-
|
|
230
|
-
ok: true,
|
|
229
|
+
printDeleted(output, {
|
|
231
230
|
action: "expenses.delete",
|
|
232
231
|
entity: "expense",
|
|
232
|
+
id,
|
|
233
233
|
ids: { expenseId: id },
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
next: [
|
|
237
|
-
{
|
|
238
|
-
command: "clk115 expenses list --json",
|
|
239
|
-
reason: "Verify the expense no longer appears.",
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
}, output);
|
|
234
|
+
list: "expenses list",
|
|
235
|
+
});
|
|
243
236
|
});
|
|
244
237
|
};
|
package/dist/commands/helpers.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
+
import { parseWeeklyDateTime } from "clockify-sdk-ts-115/dates";
|
|
2
3
|
import { entityId } from "clockify-sdk-ts-115/operation-receipt";
|
|
3
4
|
import { InvalidArgumentError } from "commander";
|
|
4
5
|
import { requireWorkspaceId } from "../config.js";
|
|
5
6
|
import { UsageError } from "../failure.js";
|
|
6
7
|
import { globalFlags, resolveFlags } from "../flags.js";
|
|
7
8
|
import { printWarning } from "../output.js";
|
|
9
|
+
import { printReceipt } from "../receipt.js";
|
|
8
10
|
import { readStdin } from "../stdin.js";
|
|
9
11
|
function parseStrictNumber(value) {
|
|
10
12
|
const trimmed = value.trim();
|
|
@@ -89,39 +91,17 @@ export function parseJson(text, flag, alternative) {
|
|
|
89
91
|
throw new UsageError(`${flag} is not valid JSON (${detail}); provide valid JSON${alternative === undefined ? "." : `, or ${alternative}.`}`);
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
|
-
const BARE_DATE_PATTERN =
|
|
93
|
-
const RFC3339_TIMESTAMP_PATTERN =
|
|
94
|
-
function hasValidCalendarDate(yearText, monthText, dayText) {
|
|
95
|
-
const year = Number(yearText);
|
|
96
|
-
const month = Number(monthText);
|
|
97
|
-
const day = Number(dayText);
|
|
98
|
-
const probe = new Date(0);
|
|
99
|
-
probe.setUTCFullYear(year, month - 1, day);
|
|
100
|
-
probe.setUTCHours(0, 0, 0, 0);
|
|
101
|
-
return (probe.getUTCFullYear() === year &&
|
|
102
|
-
probe.getUTCMonth() === month - 1 &&
|
|
103
|
-
probe.getUTCDate() === day);
|
|
104
|
-
}
|
|
94
|
+
const BARE_DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
95
|
+
const RFC3339_TIMESTAMP_PATTERN = /^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[Zz]|[+-](\d{2}):(\d{2}))$/;
|
|
105
96
|
function isRfc3339Timestamp(value) {
|
|
106
97
|
const match = RFC3339_TIMESTAMP_PATTERN.exec(value);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const minute = Number(match[5]);
|
|
112
|
-
const second = Number(match[6]);
|
|
113
|
-
const offsetHour = match[7] === undefined ? 0 : Number(match[7]);
|
|
114
|
-
const offsetMinute = match[8] === undefined ? 0 : Number(match[8]);
|
|
115
|
-
return (hour <= 23 &&
|
|
116
|
-
minute <= 59 &&
|
|
117
|
-
second <= 59 &&
|
|
118
|
-
offsetHour <= 23 &&
|
|
119
|
-
offsetMinute <= 59 &&
|
|
120
|
-
!Number.isNaN(Date.parse(value)));
|
|
98
|
+
return (match !== null &&
|
|
99
|
+
parseWeeklyDateTime(value.slice(0, 19)) !== undefined &&
|
|
100
|
+
Number(match[1] ?? 0) <= 23 &&
|
|
101
|
+
Number(match[2] ?? 0) <= 59);
|
|
121
102
|
}
|
|
122
103
|
export function requireCalendarDate(value, flag) {
|
|
123
|
-
|
|
124
|
-
if (match === null || !hasValidCalendarDate(match[1], match[2], match[3])) {
|
|
104
|
+
if (parseWeeklyDateTime(`${value}T00:00:00`) === undefined) {
|
|
125
105
|
throw new UsageError(`--${flag} ${JSON.stringify(value)} is not a valid calendar date (YYYY-MM-DD); provide a real calendar date`);
|
|
126
106
|
}
|
|
127
107
|
return value;
|
|
@@ -180,3 +160,17 @@ export async function requireCurrentUserId(client, hint) {
|
|
|
180
160
|
}
|
|
181
161
|
return userId;
|
|
182
162
|
}
|
|
163
|
+
export function printDeleted(output, target) {
|
|
164
|
+
const { action, entity, id, ids, list } = target;
|
|
165
|
+
const noun = entity.replaceAll("_", " ");
|
|
166
|
+
const kind = entity.slice(entity.lastIndexOf("_") + 1);
|
|
167
|
+
printReceipt({
|
|
168
|
+
ok: true,
|
|
169
|
+
action,
|
|
170
|
+
entity,
|
|
171
|
+
ids,
|
|
172
|
+
data: { id, deleted: true, message: `deleted ${noun} ${id}` },
|
|
173
|
+
changed: { deleted: [{ type: entity, id }] },
|
|
174
|
+
next: [{ command: `clk115 ${list} --json`, reason: `Verify the ${kind} no longer appears.` }],
|
|
175
|
+
}, output);
|
|
176
|
+
}
|
|
@@ -12,11 +12,11 @@ export const registerInvoicesCommand = (program, services) => {
|
|
|
12
12
|
.option("--page <n>", "Page number.", parseIntArg, 1)
|
|
13
13
|
.action(async function (opts) {
|
|
14
14
|
const { client, workspaceId, output } = await resolveContext(this, services);
|
|
15
|
-
const response =
|
|
15
|
+
const response = await client.invoices.list({
|
|
16
16
|
workspaceId,
|
|
17
17
|
page: opts.page,
|
|
18
18
|
"page-size": clampPageSize(opts.limit, 200),
|
|
19
|
-
})
|
|
19
|
+
});
|
|
20
20
|
const items = response.invoices ?? [];
|
|
21
21
|
const rows = items.map((raw) => {
|
|
22
22
|
const inv = raw;
|
|
@@ -60,7 +60,7 @@ export const registerInvoicesCommand = (program, services) => {
|
|
|
60
60
|
body.timeViewMode = parseTimeViewMode(opts.timeViewMode);
|
|
61
61
|
const { client, workspaceId, output } = await resolveContext(this, services);
|
|
62
62
|
const req = { workspaceId, body };
|
|
63
|
-
const created =
|
|
63
|
+
const created = await dispatchedWrite(this, client.invoices.create(req));
|
|
64
64
|
const data = {
|
|
65
65
|
id: created.id ?? "",
|
|
66
66
|
number: created.number ?? "",
|
|
@@ -4,7 +4,7 @@ import { PartialDeleteError, UsageError } from "../failure.js";
|
|
|
4
4
|
import { printObject, printRecords } from "../output.js";
|
|
5
5
|
import { printReceipt } from "../receipt.js";
|
|
6
6
|
import { dispatchedWrite } from "../write-outcome.js";
|
|
7
|
-
import { clampPageSize, parseIntArg, resolveContext } from "./helpers.js";
|
|
7
|
+
import { clampPageSize, parseIntArg, printDeleted, resolveContext } from "./helpers.js";
|
|
8
8
|
import { leafCommand } from "./leaf-command.js";
|
|
9
9
|
export const registerProjectsCommand = (program, services) => {
|
|
10
10
|
const projects = program.command("projects").description("Manage projects.");
|
|
@@ -65,7 +65,7 @@ export const registerProjectsCommand = (program, services) => {
|
|
|
65
65
|
...(opts.billable ? { billable: true } : {}),
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
|
-
const created =
|
|
68
|
+
const created = await dispatchedWrite(this, client.projects.create(req));
|
|
69
69
|
const data = {
|
|
70
70
|
id: created.id ?? "",
|
|
71
71
|
name: created.name ?? "",
|
|
@@ -131,7 +131,7 @@ export const registerProjectsCommand = (program, services) => {
|
|
|
131
131
|
archived: opts.archived,
|
|
132
132
|
});
|
|
133
133
|
const req = { workspaceId, projectId: id, body };
|
|
134
|
-
const updated =
|
|
134
|
+
const updated = await dispatchedWrite(this, client.projects.update(req));
|
|
135
135
|
const data = { id: updated.id ?? id, name: updated.name ?? "" };
|
|
136
136
|
printReceipt({
|
|
137
137
|
ok: true,
|
|
@@ -181,19 +181,12 @@ export const registerProjectsCommand = (program, services) => {
|
|
|
181
181
|
},
|
|
182
182
|
},
|
|
183
183
|
});
|
|
184
|
-
|
|
185
|
-
ok: true,
|
|
184
|
+
printDeleted(output, {
|
|
186
185
|
action: "projects.delete",
|
|
187
186
|
entity: "project",
|
|
187
|
+
id,
|
|
188
188
|
ids: { projectId: id },
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
next: [
|
|
192
|
-
{
|
|
193
|
-
command: "clk115 projects list --json",
|
|
194
|
-
reason: "Verify the project no longer appears.",
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
}, output);
|
|
189
|
+
list: "projects list",
|
|
190
|
+
});
|
|
198
191
|
});
|
|
199
192
|
};
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { defined, SHARED_REPORT_TYPES, } from "clockify-sdk-ts-115/requests";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { UsageError } from "../failure.js";
|
|
4
|
-
|
|
4
|
+
const SHARED_REPORT_FILTER_EXPORT_TYPES = ["JSON_V1", "JSON", "CSV", "XLSX", "PDF"];
|
|
5
|
+
const SUMMARY_GROUPS = [
|
|
6
|
+
"CLIENT",
|
|
7
|
+
"PROJECT",
|
|
8
|
+
"TASK",
|
|
9
|
+
"DATE",
|
|
10
|
+
"WEEK",
|
|
11
|
+
"MONTH",
|
|
12
|
+
"TIMEENTRY",
|
|
13
|
+
"USER",
|
|
14
|
+
"TAG",
|
|
15
|
+
];
|
|
5
16
|
const nonEmptyStringSchema = z
|
|
6
17
|
.string()
|
|
7
18
|
.refine((value) => value.trim() !== "", "must be a non-empty string.");
|
|
@@ -3,7 +3,7 @@ import { UsageError } from "../failure.js";
|
|
|
3
3
|
import { printObject, printRecords } from "../output.js";
|
|
4
4
|
import { printReceipt } from "../receipt.js";
|
|
5
5
|
import { dispatchedWrite } from "../write-outcome.js";
|
|
6
|
-
import { parseTimeViewMode, resolveBaseContext, resolveContext, TIME_VIEW_MODE_HELP } from "./helpers.js";
|
|
6
|
+
import { parseTimeViewMode, printDeleted, resolveBaseContext, resolveContext, TIME_VIEW_MODE_HELP, } from "./helpers.js";
|
|
7
7
|
import { leafCommand } from "./leaf-command.js";
|
|
8
8
|
async function readReportBody(response) {
|
|
9
9
|
const buffer = await response.arrayBuffer();
|
|
@@ -21,19 +21,7 @@ async function readReportBody(response) {
|
|
|
21
21
|
return { body: text };
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
export const SHARED_REPORT_FILTER_EXPORT_TYPES = ["JSON_V1", "JSON", "CSV", "XLSX", "PDF"];
|
|
25
24
|
const SHARED_REPORT_VIEW_EXPORT_TYPES = ["JSON_V1", "JSON", "CSV"];
|
|
26
|
-
export const SUMMARY_GROUPS = [
|
|
27
|
-
"CLIENT",
|
|
28
|
-
"PROJECT",
|
|
29
|
-
"TASK",
|
|
30
|
-
"DATE",
|
|
31
|
-
"WEEK",
|
|
32
|
-
"MONTH",
|
|
33
|
-
"TIMEENTRY",
|
|
34
|
-
"USER",
|
|
35
|
-
"TAG",
|
|
36
|
-
];
|
|
37
25
|
export const registerSharedReportsCommand = (program, services) => {
|
|
38
26
|
const shared = program
|
|
39
27
|
.command("shared-reports")
|
|
@@ -94,7 +82,7 @@ export const registerSharedReportsCommand = (program, services) => {
|
|
|
94
82
|
const body = parseSharedReportBody(opts, "shared-reports.create");
|
|
95
83
|
const { client, workspaceId, output } = await resolveContext(this, services);
|
|
96
84
|
const request = { workspaceId, body };
|
|
97
|
-
const created =
|
|
85
|
+
const created = await dispatchedWrite(this, client.sharedReports.create(request));
|
|
98
86
|
const data = { id: created.id ?? "", name: created.name ?? opts.name };
|
|
99
87
|
printReceipt({
|
|
100
88
|
ok: true,
|
|
@@ -131,7 +119,7 @@ export const registerSharedReportsCommand = (program, services) => {
|
|
|
131
119
|
sharedReportId: id,
|
|
132
120
|
body,
|
|
133
121
|
};
|
|
134
|
-
const updated =
|
|
122
|
+
const updated = await dispatchedWrite(this, client.sharedReports.update(request));
|
|
135
123
|
const data = { id: updated.id ?? id, name: updated.name ?? opts.name };
|
|
136
124
|
printReceipt({
|
|
137
125
|
ok: true,
|
|
@@ -155,19 +143,12 @@ export const registerSharedReportsCommand = (program, services) => {
|
|
|
155
143
|
.action(async function (id) {
|
|
156
144
|
const { client, workspaceId, output } = await resolveContext(this, services);
|
|
157
145
|
await dispatchedWrite(this, client.sharedReports.delete({ workspaceId, sharedReportId: id }));
|
|
158
|
-
|
|
159
|
-
ok: true,
|
|
146
|
+
printDeleted(output, {
|
|
160
147
|
action: "shared-reports.delete",
|
|
161
148
|
entity: "shared_report",
|
|
149
|
+
id,
|
|
162
150
|
ids: { sharedReportId: id },
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
next: [
|
|
166
|
-
{
|
|
167
|
-
command: "clk115 shared-reports list --json",
|
|
168
|
-
reason: "Verify the report no longer appears.",
|
|
169
|
-
},
|
|
170
|
-
],
|
|
171
|
-
}, output);
|
|
151
|
+
list: "shared-reports list",
|
|
152
|
+
});
|
|
172
153
|
});
|
|
173
154
|
};
|
package/dist/commands/status.js
CHANGED
|
@@ -32,7 +32,7 @@ export const registerStatusCommand = (program, services) => {
|
|
|
32
32
|
const user = await client.users.getCurrentUser();
|
|
33
33
|
let statusState;
|
|
34
34
|
if (!config.workspaceId) {
|
|
35
|
-
const workspaces =
|
|
35
|
+
const workspaces = await client.workspaces.list();
|
|
36
36
|
statusState = {
|
|
37
37
|
kind: "workspace_unconfigured",
|
|
38
38
|
availableWorkspaces: workspaces.map((w) => ({
|
package/dist/commands/tags.js
CHANGED
|
@@ -3,7 +3,7 @@ import { UsageError } from "../failure.js";
|
|
|
3
3
|
import { printObject, printRecords } from "../output.js";
|
|
4
4
|
import { printReceipt } from "../receipt.js";
|
|
5
5
|
import { dispatchedWrite } from "../write-outcome.js";
|
|
6
|
-
import { clampPageSize, parseIntArg, resolveContext } from "./helpers.js";
|
|
6
|
+
import { clampPageSize, parseIntArg, printDeleted, resolveContext } from "./helpers.js";
|
|
7
7
|
import { leafCommand } from "./leaf-command.js";
|
|
8
8
|
export const registerTagsCommand = (program, services) => {
|
|
9
9
|
const tags = program.command("tags").description("Manage tags.");
|
|
@@ -45,7 +45,7 @@ export const registerTagsCommand = (program, services) => {
|
|
|
45
45
|
.action(async function (name) {
|
|
46
46
|
const { client, workspaceId, output } = await resolveContext(this, services);
|
|
47
47
|
const req = { workspaceId, body: { name } };
|
|
48
|
-
const created =
|
|
48
|
+
const created = await dispatchedWrite(this, client.tags.create(req));
|
|
49
49
|
const data = { id: created.id ?? "", name: created.name ?? "" };
|
|
50
50
|
printReceipt({
|
|
51
51
|
ok: true,
|
|
@@ -87,7 +87,7 @@ export const registerTagsCommand = (program, services) => {
|
|
|
87
87
|
const current = complete ? {} : await client.tags.get({ workspaceId, tagId: id });
|
|
88
88
|
const body = tagUpdate.body(current, patch);
|
|
89
89
|
const req = { workspaceId, tagId: id, body };
|
|
90
|
-
const updated =
|
|
90
|
+
const updated = await dispatchedWrite(this, client.tags.update(req));
|
|
91
91
|
const data = { id: updated.id ?? id, name: updated.name ?? "" };
|
|
92
92
|
printReceipt({
|
|
93
93
|
ok: true,
|
|
@@ -106,19 +106,12 @@ export const registerTagsCommand = (program, services) => {
|
|
|
106
106
|
.action(async function (id) {
|
|
107
107
|
const { client, workspaceId, output } = await resolveContext(this, services);
|
|
108
108
|
await dispatchedWrite(this, client.tags.delete({ workspaceId, tagId: id }));
|
|
109
|
-
|
|
110
|
-
ok: true,
|
|
109
|
+
printDeleted(output, {
|
|
111
110
|
action: "tags.delete",
|
|
112
111
|
entity: "tag",
|
|
112
|
+
id,
|
|
113
113
|
ids: { tagId: id },
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
next: [
|
|
117
|
-
{
|
|
118
|
-
command: "clk115 tags list --json",
|
|
119
|
-
reason: "Verify the tag no longer appears.",
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
}, output);
|
|
114
|
+
list: "tags list",
|
|
115
|
+
});
|
|
123
116
|
});
|
|
124
117
|
};
|
package/dist/commands/tasks.js
CHANGED
|
@@ -3,7 +3,7 @@ import { PartialDeleteError, UsageError } from "../failure.js";
|
|
|
3
3
|
import { printObject, printRecords } from "../output.js";
|
|
4
4
|
import { printReceipt } from "../receipt.js";
|
|
5
5
|
import { dispatchedWrite } from "../write-outcome.js";
|
|
6
|
-
import { clampPageSize, parseIntArg, resolveContext } from "./helpers.js";
|
|
6
|
+
import { clampPageSize, parseIntArg, printDeleted, resolveContext } from "./helpers.js";
|
|
7
7
|
import { leafCommand } from "./leaf-command.js";
|
|
8
8
|
function taskStatus(value) {
|
|
9
9
|
const status = String(value).toUpperCase();
|
|
@@ -71,7 +71,7 @@ export const registerTasksCommand = (program, services) => {
|
|
|
71
71
|
projectId,
|
|
72
72
|
body,
|
|
73
73
|
};
|
|
74
|
-
const created =
|
|
74
|
+
const created = await dispatchedWrite(this, client.tasks.create(req));
|
|
75
75
|
const data = { id: created.id ?? "", name: created.name ?? name };
|
|
76
76
|
printReceipt({
|
|
77
77
|
ok: true,
|
|
@@ -139,7 +139,7 @@ export const registerTasksCommand = (program, services) => {
|
|
|
139
139
|
taskId: id,
|
|
140
140
|
body,
|
|
141
141
|
};
|
|
142
|
-
const updated =
|
|
142
|
+
const updated = await dispatchedWrite(this, client.tasks.update(req));
|
|
143
143
|
const data = { id: updated.id ?? id, name: updated.name ?? body.name };
|
|
144
144
|
printReceipt({
|
|
145
145
|
ok: true,
|
|
@@ -178,19 +178,12 @@ export const registerTasksCommand = (program, services) => {
|
|
|
178
178
|
}
|
|
179
179
|
throw error;
|
|
180
180
|
}
|
|
181
|
-
|
|
182
|
-
ok: true,
|
|
181
|
+
printDeleted(output, {
|
|
183
182
|
action: "tasks.delete",
|
|
184
183
|
entity: "task",
|
|
184
|
+
id,
|
|
185
185
|
ids: { projectId, taskId: id },
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
next: [
|
|
189
|
-
{
|
|
190
|
-
command: `clk115 tasks list ${projectId} --json`,
|
|
191
|
-
reason: "Verify the task no longer appears.",
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
}, output);
|
|
186
|
+
list: `tasks list ${projectId}`,
|
|
187
|
+
});
|
|
195
188
|
});
|
|
196
189
|
};
|
package/dist/commands/timeoff.js
CHANGED
|
@@ -111,7 +111,7 @@ export const registerTimeOffCommand = (program, services) => {
|
|
|
111
111
|
policyId: opts.policy,
|
|
112
112
|
body,
|
|
113
113
|
};
|
|
114
|
-
const created =
|
|
114
|
+
const created = await dispatchedWrite(this, client.timeOff.submit(req));
|
|
115
115
|
const data = {
|
|
116
116
|
id: created.id ?? "",
|
|
117
117
|
user: created.userId ?? "",
|
|
@@ -7,7 +7,7 @@ import { UsageError } from "../failure.js";
|
|
|
7
7
|
import { printRecords } from "../output.js";
|
|
8
8
|
import { printReceipt } from "../receipt.js";
|
|
9
9
|
import { dispatchedWrite } from "../write-outcome.js";
|
|
10
|
-
import { resolveContext, splitList } from "./helpers.js";
|
|
10
|
+
import { printDeleted, resolveContext, splitList } from "./helpers.js";
|
|
11
11
|
import { leafCommand } from "./leaf-command.js";
|
|
12
12
|
import { registerWebhookDeliveryCommands } from "./webhook-delivery.js";
|
|
13
13
|
const WEBHOOK_LIST_TYPES = ["USER_CREATED", "SYSTEM", "ADDON"];
|
|
@@ -107,7 +107,7 @@ export const registerWebhooksCommand = (program, services) => {
|
|
|
107
107
|
triggerSource,
|
|
108
108
|
};
|
|
109
109
|
const request = { workspaceId, body };
|
|
110
|
-
const created =
|
|
110
|
+
const created = await dispatchedWrite(this, client.webhooks.create(request));
|
|
111
111
|
const data = {
|
|
112
112
|
id: created.id ?? "",
|
|
113
113
|
name: created.name ?? "",
|
|
@@ -137,20 +137,13 @@ export const registerWebhooksCommand = (program, services) => {
|
|
|
137
137
|
.action(async function (id) {
|
|
138
138
|
const { client, workspaceId, output } = await resolveContext(this, services);
|
|
139
139
|
await dispatchedWrite(this, client.webhooks.delete({ workspaceId, webhookId: id }));
|
|
140
|
-
|
|
141
|
-
ok: true,
|
|
140
|
+
printDeleted(output, {
|
|
142
141
|
action: "webhooks.delete",
|
|
143
142
|
entity: "webhook",
|
|
143
|
+
id,
|
|
144
144
|
ids: { webhookId: id },
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
next: [
|
|
148
|
-
{
|
|
149
|
-
command: "clk115 webhooks list --json",
|
|
150
|
-
reason: "Verify the webhook no longer appears.",
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
}, output);
|
|
145
|
+
list: "webhooks list",
|
|
146
|
+
});
|
|
154
147
|
});
|
|
155
148
|
registerWebhookDeliveryCommands(webhooks, services);
|
|
156
149
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PACKAGE_VERSION = "
|
|
1
|
+
export const PACKAGE_VERSION = "8.0.0";
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,6 @@ import { parseFields, parseOutputMode, resolveFlags, resolveFlagsSafe } from "./
|
|
|
38
38
|
import { PACKAGE_VERSION } from "./generated/version.js";
|
|
39
39
|
import { printData } from "./output.js";
|
|
40
40
|
import { outputWasAbandoned, writeFilesInFull } from "./stdout.js";
|
|
41
|
-
export { globalFlags, resolveFlags } from "./flags.js";
|
|
42
41
|
const defaultServices = {
|
|
43
42
|
loadConfig,
|
|
44
43
|
buildClient,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apet97/clockify-cli-115",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
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
6
|
"author": "Aleksandar Petkovi\u0107 <petkovic.aleksandar037@gmail.com>",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clockify115",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Unofficial Clockify skills for the clk115 command line, the TypeScript SDK and the MCP server.",
|
|
5
5
|
"author": { "name": "apet97", "url": "https://github.com/apet97/clockify-ts-sdk" },
|
|
6
6
|
"homepage": "https://github.com/apet97/clockify-ts-sdk",
|