@tenonhq/sincronia-core 0.0.59 → 0.0.62

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 (42) hide show
  1. package/dist/{core/src/index.js → index.js} +0 -0
  2. package/package.json +1 -1
  3. package/dist/clickup/src/client.js +0 -370
  4. package/dist/clickup/src/formatter.js +0 -176
  5. package/dist/clickup/src/index.js +0 -43
  6. package/dist/clickup/src/parser.js +0 -79
  7. package/dist/clickup/src/types.js +0 -15
  8. package/dist/schema/src/fetcher.js +0 -157
  9. package/dist/schema/src/index.js +0 -47
  10. package/dist/schema/src/organizer.js +0 -129
  11. package/dist/schema/src/types.js +0 -12
  12. /package/dist/{core/src/FileLogger.js → FileLogger.js} +0 -0
  13. /package/dist/{core/src/FileUtils.js → FileUtils.js} +0 -0
  14. /package/dist/{core/src/Logger.js → Logger.js} +0 -0
  15. /package/dist/{core/src/MultiScopeWatcher.js → MultiScopeWatcher.js} +0 -0
  16. /package/dist/{core/src/PluginManager.js → PluginManager.js} +0 -0
  17. /package/dist/{core/src/Watcher.js → Watcher.js} +0 -0
  18. /package/dist/{core/src/allScopesCommands.js → allScopesCommands.js} +0 -0
  19. /package/dist/{core/src/appUtils.js → appUtils.js} +0 -0
  20. /package/dist/{core/src/bootstrap.js → bootstrap.js} +0 -0
  21. /package/dist/{core/src/claudeCommand.js → claudeCommand.js} +0 -0
  22. /package/dist/{core/src/clickupCommands.js → clickupCommands.js} +0 -0
  23. /package/dist/{core/src/clickupPushHelper.js → clickupPushHelper.js} +0 -0
  24. /package/dist/{core/src/commander.js → commander.js} +0 -0
  25. /package/dist/{core/src/commands.js → commands.js} +0 -0
  26. /package/dist/{core/src/config.js → config.js} +0 -0
  27. /package/dist/{core/src/constants.js → constants.js} +0 -0
  28. /package/dist/{core/src/createRecordCommand.js → createRecordCommand.js} +0 -0
  29. /package/dist/{core/src/dashboardCommand.js → dashboardCommand.js} +0 -0
  30. /package/dist/{core/src/defaultOptions.js → defaultOptions.js} +0 -0
  31. /package/dist/{core/src/deleteRecordCommand.js → deleteRecordCommand.js} +0 -0
  32. /package/dist/{core/src/genericUtils.js → genericUtils.js} +0 -0
  33. /package/dist/{core/src/gitUtils.js → gitUtils.js} +0 -0
  34. /package/dist/{core/src/logMessages.js → logMessages.js} +0 -0
  35. /package/dist/{core/src/schemaCommand.js → schemaCommand.js} +0 -0
  36. /package/dist/{core/src/snClient.js → snClient.js} +0 -0
  37. /package/dist/{core/src/tests → tests}/cred.test.js +0 -0
  38. /package/dist/{core/src/tests → tests}/example.test.js +0 -0
  39. /package/dist/{core/src/tests → tests}/multi-scope-watcher.test.js +0 -0
  40. /package/dist/{core/src/tests → tests}/watcher.test.js +0 -0
  41. /package/dist/{core/src/updateSetCommands.js → updateSetCommands.js} +0 -0
  42. /package/dist/{core/src/wizard.js → wizard.js} +0 -0
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenonhq/sincronia-core",
3
- "version": "0.0.59",
3
+ "version": "0.0.62",
4
4
  "description": "Next-gen file syncer",
5
5
  "license": "GPL-3.0",
6
6
  "main": "./dist/index.js",
@@ -1,370 +0,0 @@
1
- var __importDefault = (this && this.__importDefault) || function (mod) {
2
- return (mod && mod.__esModule) ? mod : { "default": mod };
3
- };
4
- (function (factory) {
5
- if (typeof module === "object" && typeof module.exports === "object") {
6
- var v = factory(require, exports);
7
- if (v !== undefined) module.exports = v;
8
- }
9
- else if (typeof define === "function" && define.amd) {
10
- define(["require", "exports", "axios"], factory);
11
- }
12
- })(function (require, exports) {
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.createClient = createClient;
16
- exports.getAuthorizedUser = getAuthorizedUser;
17
- exports.getTask = getTask;
18
- exports.listMyTasks = listMyTasks;
19
- exports.createTask = createTask;
20
- exports.updateTask = updateTask;
21
- exports.updateTaskStatus = updateTaskStatus;
22
- exports.deleteTask = deleteTask;
23
- exports.addComment = addComment;
24
- exports.getTeams = getTeams;
25
- exports.getSpaces = getSpaces;
26
- exports.getFolders = getFolders;
27
- exports.getLists = getLists;
28
- exports.createClickUpApi = createClickUpApi;
29
- const axios_1 = __importDefault(require("axios"));
30
- var CLICKUP_BASE_URL = "https://api.clickup.com";
31
- /**
32
- * @description Creates a configured axios instance for the ClickUp API v2.
33
- * @param config - Client configuration with token and optional base URL.
34
- * @returns Configured axios instance.
35
- */
36
- function createClient(config) {
37
- var baseURL = config.baseUrl || CLICKUP_BASE_URL;
38
- return axios_1.default.create({
39
- baseURL: baseURL,
40
- headers: {
41
- "Authorization": config.token,
42
- "Content-Type": "application/json",
43
- },
44
- });
45
- }
46
- // --- Error Handling ---
47
- function handleApiError(error, context) {
48
- if (axios_1.default.isAxiosError(error)) {
49
- var response = error.response;
50
- if (response) {
51
- if (response.status === 401) {
52
- throw new Error("ClickUp authentication failed. Check your CLICKUP_API_TOKEN. " +
53
- "Run 'sinc clickup setup' or verify your .env file.");
54
- }
55
- if (response.status === 404) {
56
- throw new Error("ClickUp " + context + " not found. Verify the ID.");
57
- }
58
- if (response.status === 429) {
59
- throw new Error("ClickUp API rate limit exceeded. Wait a moment and try again.");
60
- }
61
- var message = response.data && typeof response.data === "object" && "err" in response.data
62
- ? String(response.data.err)
63
- : "HTTP " + response.status;
64
- throw new Error("ClickUp API error (" + context + "): " + message);
65
- }
66
- }
67
- throw error;
68
- }
69
- // --- User ---
70
- /**
71
- * @description Gets the authenticated user from the API token.
72
- * @param params - Object with the axios client.
73
- * @returns The authenticated ClickUp user.
74
- */
75
- async function getAuthorizedUser(params) {
76
- try {
77
- var response = await params.client.get("/api/v2/user");
78
- return response.data.user;
79
- }
80
- catch (error) {
81
- return handleApiError(error, "user");
82
- }
83
- }
84
- // --- Tasks ---
85
- /**
86
- * @description Fetches a single ClickUp task by ID.
87
- * @param params - Object with client and taskId.
88
- * @returns The ClickUp task.
89
- */
90
- async function getTask(params) {
91
- try {
92
- var response = await params.client.get("/api/v2/task/" + params.taskId);
93
- return response.data;
94
- }
95
- catch (error) {
96
- return handleApiError(error, "task '" + params.taskId + "'");
97
- }
98
- }
99
- /**
100
- * @description Lists tasks assigned to the authenticated user, grouped by status.
101
- * @param params - Object with client, teamId, and optional status filters.
102
- * @returns Tasks grouped by status with totals.
103
- */
104
- async function listMyTasks(params) {
105
- try {
106
- // Get the authenticated user's ID
107
- var user = await getAuthorizedUser({ client: params.client });
108
- var queryParams = {
109
- "assignees[]": user.id,
110
- "include_closed": false,
111
- "subtasks": true,
112
- "order_by": "updated",
113
- "reverse": true,
114
- };
115
- // Add status filters if provided
116
- if (params.statuses && params.statuses.length > 0) {
117
- queryParams["statuses[]"] = params.statuses;
118
- }
119
- var response = await params.client.get("/api/v2/team/" + params.teamId + "/task", { params: queryParams });
120
- var tasks = response.data.tasks || [];
121
- // Group by status
122
- var byStatus = {};
123
- for (var i = 0; i < tasks.length; i++) {
124
- var task = tasks[i];
125
- var statusName = task.status && task.status.status ? task.status.status : "unknown";
126
- if (!byStatus[statusName]) {
127
- byStatus[statusName] = [];
128
- }
129
- byStatus[statusName].push(task);
130
- }
131
- return {
132
- tasks: tasks,
133
- byStatus: byStatus,
134
- total: tasks.length,
135
- };
136
- }
137
- catch (error) {
138
- return handleApiError(error, "tasks for team '" + params.teamId + "'");
139
- }
140
- }
141
- /**
142
- * @description Creates a new task in a ClickUp list.
143
- * @param params - Object with client, listId, name, and optional fields.
144
- * @returns The created task.
145
- */
146
- async function createTask(params) {
147
- try {
148
- var body = {
149
- name: params.name,
150
- };
151
- if (params.description !== undefined) {
152
- body.description = params.description;
153
- }
154
- if (params.assignees !== undefined) {
155
- body.assignees = params.assignees;
156
- }
157
- if (params.status !== undefined) {
158
- body.status = params.status;
159
- }
160
- if (params.priority !== undefined) {
161
- body.priority = params.priority;
162
- }
163
- var response = await params.client.post("/api/v2/list/" + params.listId + "/task", body);
164
- return response.data;
165
- }
166
- catch (error) {
167
- return handleApiError(error, "creating task in list '" + params.listId + "'");
168
- }
169
- }
170
- /**
171
- * @description Updates an existing ClickUp task.
172
- * @param params - Object with client, taskId, and fields to update.
173
- * @returns The updated task.
174
- */
175
- async function updateTask(params) {
176
- try {
177
- var body = {};
178
- if (params.name !== undefined) {
179
- body.name = params.name;
180
- }
181
- if (params.description !== undefined) {
182
- body.description = params.description;
183
- }
184
- if (params.status !== undefined) {
185
- body.status = params.status;
186
- }
187
- if (params.assignees !== undefined) {
188
- body.assignees = params.assignees;
189
- }
190
- if (params.priority !== undefined) {
191
- body.priority = params.priority;
192
- }
193
- var response = await params.client.put("/api/v2/task/" + params.taskId, body);
194
- return response.data;
195
- }
196
- catch (error) {
197
- return handleApiError(error, "updating task '" + params.taskId + "'");
198
- }
199
- }
200
- /**
201
- * @description Convenience function to update only a task's status.
202
- * @param params - Object with client, taskId, and new status.
203
- * @returns The updated task.
204
- */
205
- async function updateTaskStatus(params) {
206
- return updateTask({
207
- client: params.client,
208
- taskId: params.taskId,
209
- status: params.status,
210
- });
211
- }
212
- /**
213
- * @description Deletes a ClickUp task.
214
- * @param params - Object with client and taskId.
215
- */
216
- async function deleteTask(params) {
217
- try {
218
- await params.client.delete("/api/v2/task/" + params.taskId);
219
- }
220
- catch (error) {
221
- return handleApiError(error, "deleting task '" + params.taskId + "'");
222
- }
223
- }
224
- // --- Comments ---
225
- /**
226
- * @description Adds a comment to a ClickUp task.
227
- * @param params - Object with client, taskId, and comment text.
228
- * @returns The created comment.
229
- */
230
- async function addComment(params) {
231
- try {
232
- var response = await params.client.post("/api/v2/task/" + params.taskId + "/comment", { comment_text: params.commentText });
233
- return response.data;
234
- }
235
- catch (error) {
236
- return handleApiError(error, "adding comment to task '" + params.taskId + "'");
237
- }
238
- }
239
- // --- Workspace / Hierarchy ---
240
- /**
241
- * @description Lists all teams (workspaces) accessible to the authenticated user.
242
- * @param params - Object with the axios client.
243
- * @returns Array of ClickUp teams.
244
- */
245
- async function getTeams(params) {
246
- try {
247
- var response = await params.client.get("/api/v2/team");
248
- return response.data.teams || [];
249
- }
250
- catch (error) {
251
- return handleApiError(error, "teams");
252
- }
253
- }
254
- /**
255
- * @description Lists all spaces in a team/workspace.
256
- * @param params - Object with client and teamId.
257
- * @returns Array of ClickUp spaces.
258
- */
259
- async function getSpaces(params) {
260
- try {
261
- var response = await params.client.get("/api/v2/team/" + params.teamId + "/space");
262
- return response.data.spaces || [];
263
- }
264
- catch (error) {
265
- return handleApiError(error, "spaces for team '" + params.teamId + "'");
266
- }
267
- }
268
- /**
269
- * @description Lists all folders in a space.
270
- * @param params - Object with client and spaceId.
271
- * @returns Array of ClickUp folders.
272
- */
273
- async function getFolders(params) {
274
- try {
275
- var response = await params.client.get("/api/v2/space/" + params.spaceId + "/folder");
276
- return response.data.folders || [];
277
- }
278
- catch (error) {
279
- return handleApiError(error, "folders for space '" + params.spaceId + "'");
280
- }
281
- }
282
- /**
283
- * @description Lists all lists in a folder.
284
- * @param params - Object with client and folderId.
285
- * @returns Array of ClickUp lists.
286
- */
287
- async function getLists(params) {
288
- try {
289
- var response = await params.client.get("/api/v2/folder/" + params.folderId + "/list");
290
- return response.data.lists || [];
291
- }
292
- catch (error) {
293
- return handleApiError(error, "lists for folder '" + params.folderId + "'");
294
- }
295
- }
296
- /**
297
- * @description Creates a ClickUp API object with all functions pre-bound to a client.
298
- * @param config - Client configuration with token and optional base URL.
299
- * @returns Object with all ClickUp API functions.
300
- */
301
- function createClickUpApi(config) {
302
- var client = createClient(config);
303
- return {
304
- getAuthorizedUser: function () {
305
- return getAuthorizedUser({ client: client });
306
- },
307
- getTask: function (params) {
308
- return getTask({ client: client, taskId: params.taskId });
309
- },
310
- listMyTasks: function (params) {
311
- return listMyTasks({
312
- client: client,
313
- teamId: params.teamId,
314
- statuses: params.statuses,
315
- });
316
- },
317
- createTask: function (params) {
318
- return createTask({
319
- client: client,
320
- listId: params.listId,
321
- name: params.name,
322
- description: params.description,
323
- assignees: params.assignees,
324
- status: params.status,
325
- priority: params.priority,
326
- });
327
- },
328
- updateTask: function (params) {
329
- return updateTask({
330
- client: client,
331
- taskId: params.taskId,
332
- name: params.name,
333
- description: params.description,
334
- status: params.status,
335
- assignees: params.assignees,
336
- priority: params.priority,
337
- });
338
- },
339
- updateTaskStatus: function (params) {
340
- return updateTaskStatus({
341
- client: client,
342
- taskId: params.taskId,
343
- status: params.status,
344
- });
345
- },
346
- deleteTask: function (params) {
347
- return deleteTask({ client: client, taskId: params.taskId });
348
- },
349
- addComment: function (params) {
350
- return addComment({
351
- client: client,
352
- taskId: params.taskId,
353
- commentText: params.commentText,
354
- });
355
- },
356
- getTeams: function () {
357
- return getTeams({ client: client });
358
- },
359
- getSpaces: function (params) {
360
- return getSpaces({ client: client, teamId: params.teamId });
361
- },
362
- getFolders: function (params) {
363
- return getFolders({ client: client, spaceId: params.spaceId });
364
- },
365
- getLists: function (params) {
366
- return getLists({ client: client, folderId: params.folderId });
367
- },
368
- };
369
- }
370
- });
@@ -1,176 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.formatForClaude = formatForClaude;
13
- exports.formatTaskDetail = formatTaskDetail;
14
- exports.formatTaskSummary = formatTaskSummary;
15
- /**
16
- * @description Formats a list of tasks as markdown grouped by status, optimized for LLM consumption.
17
- * @param params - Object with tasks array.
18
- * @returns Markdown-formatted string.
19
- */
20
- function formatForClaude(params) {
21
- var tasks = params.tasks;
22
- if (tasks.length === 0) {
23
- return "## ClickUp Tasks\n\nNo tasks found.";
24
- }
25
- // Group by status
26
- var byStatus = {};
27
- for (var i = 0; i < tasks.length; i++) {
28
- var task = tasks[i];
29
- var statusName = task.status && task.status.status ? task.status.status : "unknown";
30
- if (!byStatus[statusName]) {
31
- byStatus[statusName] = [];
32
- }
33
- byStatus[statusName].push(task);
34
- }
35
- var lines = [];
36
- lines.push("## ClickUp Tasks (" + tasks.length + " total)");
37
- lines.push("");
38
- var statusNames = Object.keys(byStatus);
39
- for (var s = 0; s < statusNames.length; s++) {
40
- var status = statusNames[s];
41
- var statusTasks = byStatus[status];
42
- lines.push("### " + capitalize(status) + " (" + statusTasks.length + ")");
43
- lines.push("");
44
- for (var t = 0; t < statusTasks.length; t++) {
45
- var tsk = statusTasks[t];
46
- var idLabel = tsk.custom_id ? tsk.custom_id : tsk.id;
47
- var priorityLabel = tsk.priority && tsk.priority.priority
48
- ? " (Priority: " + capitalize(tsk.priority.priority) + ")"
49
- : "";
50
- lines.push("- **[" + idLabel + "] " + tsk.name + "**" + priorityLabel);
51
- var assigneeNames = getAssigneeNames(tsk);
52
- if (assigneeNames.length > 0) {
53
- lines.push(" Assignees: " + assigneeNames.join(", "));
54
- }
55
- if (tsk.list && tsk.list.name) {
56
- lines.push(" List: " + tsk.list.name);
57
- }
58
- if (tsk.url) {
59
- lines.push(" URL: " + tsk.url);
60
- }
61
- lines.push("");
62
- }
63
- }
64
- return lines.join("\n");
65
- }
66
- /**
67
- * @description Formats a single task as a detailed markdown view.
68
- * @param params - Object with the task.
69
- * @returns Markdown-formatted string.
70
- */
71
- function formatTaskDetail(params) {
72
- var task = params.task;
73
- var lines = [];
74
- lines.push("## Task: " + task.name);
75
- lines.push("");
76
- lines.push("- **ID:** " + task.id);
77
- if (task.custom_id) {
78
- lines.push("- **Custom ID:** " + task.custom_id);
79
- }
80
- var statusLabel = task.status && task.status.status ? capitalize(task.status.status) : "Unknown";
81
- lines.push("- **Status:** " + statusLabel);
82
- if (task.priority && task.priority.priority) {
83
- lines.push("- **Priority:** " + capitalize(task.priority.priority));
84
- }
85
- var assigneeNames = getAssigneeNames(task);
86
- if (assigneeNames.length > 0) {
87
- lines.push("- **Assignees:** " + assigneeNames.join(", "));
88
- }
89
- if (task.list && task.list.name) {
90
- lines.push("- **List:** " + task.list.name);
91
- }
92
- if (task.folder && task.folder.name) {
93
- lines.push("- **Folder:** " + task.folder.name);
94
- }
95
- if (task.due_date) {
96
- lines.push("- **Due:** " + formatTimestamp(task.due_date));
97
- }
98
- if (task.start_date) {
99
- lines.push("- **Start:** " + formatTimestamp(task.start_date));
100
- }
101
- lines.push("- **Created:** " + formatTimestamp(task.date_created));
102
- lines.push("- **Updated:** " + formatTimestamp(task.date_updated));
103
- if (task.url) {
104
- lines.push("- **URL:** " + task.url);
105
- }
106
- if (task.tags && task.tags.length > 0) {
107
- var tagNames = task.tags.map(function (tag) {
108
- return tag.name;
109
- });
110
- lines.push("- **Tags:** " + tagNames.join(", "));
111
- }
112
- if (task.description && task.description.trim() !== "") {
113
- lines.push("");
114
- lines.push("### Description");
115
- lines.push("");
116
- lines.push(task.description);
117
- }
118
- return lines.join("\n");
119
- }
120
- /**
121
- * @description Generates a brief one-line summary of a task, suitable for update set descriptions.
122
- * @param params - Object with the task.
123
- * @returns A concise summary string.
124
- */
125
- function formatTaskSummary(params) {
126
- var task = params.task;
127
- var summary = task.name;
128
- // Add a truncated description if available
129
- if (task.description && task.description.trim() !== "") {
130
- var desc = task.description.trim();
131
- // Take first sentence or first 150 chars
132
- var firstSentenceEnd = desc.indexOf(".");
133
- if (firstSentenceEnd > 0 && firstSentenceEnd < 150) {
134
- summary = summary + " — " + desc.substring(0, firstSentenceEnd + 1);
135
- }
136
- else if (desc.length > 150) {
137
- summary = summary + " — " + desc.substring(0, 147) + "...";
138
- }
139
- else {
140
- summary = summary + " — " + desc;
141
- }
142
- }
143
- return summary;
144
- }
145
- // --- Helpers ---
146
- function getAssigneeNames(task) {
147
- if (!task.assignees || task.assignees.length === 0) {
148
- return [];
149
- }
150
- return task.assignees.map(function (assignee) {
151
- return assignee.username || assignee.email || String(assignee.id);
152
- });
153
- }
154
- function formatTimestamp(ts) {
155
- if (!ts) {
156
- return "Unknown";
157
- }
158
- try {
159
- // ClickUp returns timestamps as Unix milliseconds
160
- var date = new Date(parseInt(ts, 10));
161
- if (isNaN(date.getTime())) {
162
- return ts;
163
- }
164
- return date.toLocaleDateString() + " " + date.toLocaleTimeString();
165
- }
166
- catch (e) {
167
- return ts;
168
- }
169
- }
170
- function capitalize(str) {
171
- if (!str || str.length === 0) {
172
- return str;
173
- }
174
- return str.charAt(0).toUpperCase() + str.slice(1);
175
- }
176
- });
@@ -1,43 +0,0 @@
1
- /**
2
- * @tenonhq/sincronia-clickup
3
- *
4
- * ClickUp API v2 client for Sincronia.
5
- * Provides task management, workspace navigation, and formatting utilities.
6
- */
7
- (function (factory) {
8
- if (typeof module === "object" && typeof module.exports === "object") {
9
- var v = factory(require, exports);
10
- if (v !== undefined) module.exports = v;
11
- }
12
- else if (typeof define === "function" && define.amd) {
13
- define(["require", "exports", "./client", "./formatter", "./parser"], factory);
14
- }
15
- })(function (require, exports) {
16
- "use strict";
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.parseClickUpIdentifier = exports.formatTaskSummary = exports.formatTaskDetail = exports.formatForClaude = exports.getLists = exports.getFolders = exports.getSpaces = exports.getTeams = exports.addComment = exports.deleteTask = exports.updateTaskStatus = exports.updateTask = exports.createTask = exports.listMyTasks = exports.getTask = exports.getAuthorizedUser = exports.createClickUpApi = exports.createClient = void 0;
19
- // Client and API functions
20
- var client_1 = require("./client");
21
- Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return client_1.createClient; } });
22
- Object.defineProperty(exports, "createClickUpApi", { enumerable: true, get: function () { return client_1.createClickUpApi; } });
23
- Object.defineProperty(exports, "getAuthorizedUser", { enumerable: true, get: function () { return client_1.getAuthorizedUser; } });
24
- Object.defineProperty(exports, "getTask", { enumerable: true, get: function () { return client_1.getTask; } });
25
- Object.defineProperty(exports, "listMyTasks", { enumerable: true, get: function () { return client_1.listMyTasks; } });
26
- Object.defineProperty(exports, "createTask", { enumerable: true, get: function () { return client_1.createTask; } });
27
- Object.defineProperty(exports, "updateTask", { enumerable: true, get: function () { return client_1.updateTask; } });
28
- Object.defineProperty(exports, "updateTaskStatus", { enumerable: true, get: function () { return client_1.updateTaskStatus; } });
29
- Object.defineProperty(exports, "deleteTask", { enumerable: true, get: function () { return client_1.deleteTask; } });
30
- Object.defineProperty(exports, "addComment", { enumerable: true, get: function () { return client_1.addComment; } });
31
- Object.defineProperty(exports, "getTeams", { enumerable: true, get: function () { return client_1.getTeams; } });
32
- Object.defineProperty(exports, "getSpaces", { enumerable: true, get: function () { return client_1.getSpaces; } });
33
- Object.defineProperty(exports, "getFolders", { enumerable: true, get: function () { return client_1.getFolders; } });
34
- Object.defineProperty(exports, "getLists", { enumerable: true, get: function () { return client_1.getLists; } });
35
- // Formatting utilities
36
- var formatter_1 = require("./formatter");
37
- Object.defineProperty(exports, "formatForClaude", { enumerable: true, get: function () { return formatter_1.formatForClaude; } });
38
- Object.defineProperty(exports, "formatTaskDetail", { enumerable: true, get: function () { return formatter_1.formatTaskDetail; } });
39
- Object.defineProperty(exports, "formatTaskSummary", { enumerable: true, get: function () { return formatter_1.formatTaskSummary; } });
40
- // URL/ID parsing
41
- var parser_1 = require("./parser");
42
- Object.defineProperty(exports, "parseClickUpIdentifier", { enumerable: true, get: function () { return parser_1.parseClickUpIdentifier; } });
43
- });
@@ -1,79 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.parseClickUpIdentifier = parseClickUpIdentifier;
13
- /**
14
- * @description Parses a ClickUp task identifier from a URL or raw ID.
15
- * @param input - A ClickUp task URL or raw task ID.
16
- * @returns Parsed identifier with the extracted taskId.
17
- *
18
- * @example
19
- * parseClickUpIdentifier("abc123def")
20
- * // => { taskId: "abc123def", raw: "abc123def" }
21
- *
22
- * parseClickUpIdentifier("https://app.clickup.com/t/abc123def")
23
- * // => { taskId: "abc123def", raw: "https://app.clickup.com/t/abc123def" }
24
- */
25
- function parseClickUpIdentifier(input) {
26
- if (!input || input.trim() === "") {
27
- throw new Error("ClickUp identifier is empty. Provide a task ID or ClickUp URL.");
28
- }
29
- var cleaned = input.trim();
30
- // Strip leading # if present (e.g., "#abc123")
31
- if (cleaned.charAt(0) === "#") {
32
- cleaned = cleaned.substring(1);
33
- }
34
- // Handle URLs
35
- if (cleaned.indexOf("http") === 0) {
36
- return parseUrl(cleaned, input);
37
- }
38
- // Raw task ID — validate it's alphanumeric
39
- if (/^[a-zA-Z0-9_-]+$/.test(cleaned)) {
40
- return { taskId: cleaned, raw: input };
41
- }
42
- throw new Error("Could not parse ClickUp identifier: '" +
43
- input +
44
- "'. Expected a task ID (alphanumeric) or ClickUp URL.");
45
- }
46
- function parseUrl(url, raw) {
47
- var parsed;
48
- try {
49
- parsed = new URL(url);
50
- }
51
- catch (e) {
52
- throw new Error("Invalid ClickUp URL: '" +
53
- url +
54
- "'. Expected a URL like https://app.clickup.com/t/<task-id>");
55
- }
56
- var segments = parsed.pathname
57
- .split("/")
58
- .filter(function (s) {
59
- return s !== "";
60
- });
61
- // Short URL format: https://app.clickup.com/t/<task-id>
62
- var tIndex = segments.indexOf("t");
63
- if (tIndex !== -1 && tIndex + 1 < segments.length) {
64
- return { taskId: segments[tIndex + 1], raw: raw };
65
- }
66
- // Long URL format: https://app.clickup.com/<team-id>/v/dc/<list-id>/<task-id>
67
- // The task ID is the last segment
68
- if (segments.length > 0) {
69
- var lastSegment = segments[segments.length - 1];
70
- // ClickUp task IDs in long URLs can contain alphanumeric chars and hyphens
71
- if (/^[a-zA-Z0-9_-]+$/.test(lastSegment)) {
72
- return { taskId: lastSegment, raw: raw };
73
- }
74
- }
75
- throw new Error("Could not extract task ID from ClickUp URL: '" +
76
- url +
77
- "'. Expected a URL containing /t/<task-id> or ending with a task ID.");
78
- }
79
- });
@@ -1,15 +0,0 @@
1
- /**
2
- * ClickUp API v2 type definitions for Sincronia integration.
3
- */
4
- (function (factory) {
5
- if (typeof module === "object" && typeof module.exports === "object") {
6
- var v = factory(require, exports);
7
- if (v !== undefined) module.exports = v;
8
- }
9
- else if (typeof define === "function" && define.amd) {
10
- define(["require", "exports"], factory);
11
- }
12
- })(function (require, exports) {
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- });
@@ -1,157 +0,0 @@
1
- var __importDefault = (this && this.__importDefault) || function (mod) {
2
- return (mod && mod.__esModule) ? mod : { "default": mod };
3
- };
4
- (function (factory) {
5
- if (typeof module === "object" && typeof module.exports === "object") {
6
- var v = factory(require, exports);
7
- if (v !== undefined) module.exports = v;
8
- }
9
- else if (typeof define === "function" && define.amd) {
10
- define(["require", "exports", "axios", "chalk"], factory);
11
- }
12
- })(function (require, exports) {
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.fetchSchema = fetchSchema;
16
- const axios_1 = __importDefault(require("axios"));
17
- const chalk_1 = __importDefault(require("chalk"));
18
- function createClient(options) {
19
- const baseURL = options.instance.startsWith("https://")
20
- ? options.instance
21
- : `https://${options.instance}`;
22
- return axios_1.default.create({
23
- baseURL: baseURL.endsWith("/") ? baseURL : baseURL + "/",
24
- auth: {
25
- username: options.username,
26
- password: options.password,
27
- },
28
- headers: {
29
- "Content-Type": "application/json",
30
- "Accept": "application/json",
31
- },
32
- });
33
- }
34
- async function getTablesForScope(options) {
35
- const { client, scope } = options;
36
- const response = await client.get("api/now/table/sys_db_object", {
37
- params: {
38
- sysparm_query: `nameSTARTSWITH${scope}_`,
39
- sysparm_fields: "name,label,super_class",
40
- },
41
- });
42
- return response.data.result || [];
43
- }
44
- async function getTableHierarchy(options) {
45
- const { client, tableName } = options;
46
- const visited = options.visited || new Set();
47
- if (visited.has(tableName)) {
48
- return [];
49
- }
50
- visited.add(tableName);
51
- try {
52
- const response = await client.get("api/now/table/sys_db_object", {
53
- params: {
54
- sysparm_query: `name=${tableName}`,
55
- sysparm_fields: "name,super_class,label",
56
- },
57
- });
58
- if (response.data.result && response.data.result.length > 0) {
59
- const table = response.data.result[0];
60
- const hierarchy = [tableName];
61
- if (table.super_class && table.super_class.value) {
62
- const parentResponse = await client.get(`api/now/table/sys_db_object/${table.super_class.value}`, {
63
- params: { sysparm_fields: "name" },
64
- });
65
- if (parentResponse.data.result && parentResponse.data.result.name) {
66
- const parentHierarchy = await getTableHierarchy({
67
- client,
68
- tableName: parentResponse.data.result.name,
69
- visited,
70
- });
71
- hierarchy.push(...parentHierarchy);
72
- }
73
- }
74
- return hierarchy;
75
- }
76
- }
77
- catch (error) {
78
- console.error(chalk_1.default.yellow(` Warning: Error getting hierarchy for ${tableName}: ${error.message}`));
79
- }
80
- return [tableName];
81
- }
82
- async function getTableFields(options) {
83
- const { client, tableName } = options;
84
- try {
85
- const query = `internal_type!=collection^ORinternal_type=NULL^name=${tableName}`;
86
- const response = await client.get("api/now/table/sys_dictionary", {
87
- params: {
88
- sysparm_query: query,
89
- sysparm_fields: "element,column_label,internal_type,max_length,mandatory,reference,default_value",
90
- },
91
- });
92
- if (response.data.result) {
93
- return response.data.result.map((field) => ({
94
- name: field.element,
95
- label: field.column_label,
96
- type: field.internal_type && field.internal_type.value
97
- ? field.internal_type.value
98
- : field.internal_type || "",
99
- max_length: field.max_length || "",
100
- mandatory: field.mandatory === "true",
101
- reference: field.reference || "",
102
- default_value: field.default_value || "",
103
- inherited_from: null,
104
- }));
105
- }
106
- }
107
- catch (error) {
108
- console.error(chalk_1.default.yellow(` Warning: Error getting fields for ${tableName}: ${error.message}`));
109
- }
110
- return [];
111
- }
112
- async function fetchSchema(options) {
113
- const { scopes } = options;
114
- const client = createClient({
115
- instance: options.instance,
116
- username: options.username,
117
- password: options.password,
118
- });
119
- console.log(chalk_1.default.blue(`Fetching table schemas for ${scopes.length} scopes...\n`));
120
- const schema = {};
121
- for (const scope of scopes) {
122
- console.log(chalk_1.default.blue(`\nScope: ${scope}`));
123
- const tables = await getTablesForScope({ client, scope });
124
- if (tables.length === 0) {
125
- console.log(chalk_1.default.yellow(` No tables found for scope ${scope}`));
126
- continue;
127
- }
128
- console.log(chalk_1.default.green(` Found ${tables.length} tables`));
129
- for (const table of tables) {
130
- console.log(` Processing: ${chalk_1.default.cyan(table.name)} (${table.label})`);
131
- const hierarchy = await getTableHierarchy({ client, tableName: table.name });
132
- console.log(chalk_1.default.gray(` Hierarchy: ${hierarchy.join(" -> ")}`));
133
- const allFields = new Map();
134
- for (let i = hierarchy.length - 1; i >= 0; i--) {
135
- const hierarchyTableName = hierarchy[i];
136
- const fields = await getTableFields({ client, tableName: hierarchyTableName });
137
- for (const field of fields) {
138
- allFields.set(field.name, {
139
- ...field,
140
- inherited_from: i > 0 ? hierarchyTableName : null,
141
- });
142
- }
143
- }
144
- schema[table.name] = {
145
- label: table.label,
146
- scope,
147
- parent: hierarchy.length > 1 ? hierarchy[1] : null,
148
- hierarchy,
149
- fields: Array.from(allFields.values()),
150
- };
151
- console.log(chalk_1.default.gray(` ${allFields.size} fields (including inherited)`));
152
- }
153
- }
154
- console.log(chalk_1.default.green(`\nFetched schema for ${Object.keys(schema).length} tables across ${scopes.length} scopes`));
155
- return schema;
156
- }
157
- });
@@ -1,47 +0,0 @@
1
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
- if (k2 === undefined) k2 = k;
3
- var desc = Object.getOwnPropertyDescriptor(m, k);
4
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
- desc = { enumerable: true, get: function() { return m[k]; } };
6
- }
7
- Object.defineProperty(o, k2, desc);
8
- }) : (function(o, m, k, k2) {
9
- if (k2 === undefined) k2 = k;
10
- o[k2] = m[k];
11
- }));
12
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
13
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
14
- };
15
- (function (factory) {
16
- if (typeof module === "object" && typeof module.exports === "object") {
17
- var v = factory(require, exports);
18
- if (v !== undefined) module.exports = v;
19
- }
20
- else if (typeof define === "function" && define.amd) {
21
- define(["require", "exports", "./fetcher", "./organizer", "./fetcher", "./organizer", "./types"], factory);
22
- }
23
- })(function (require, exports) {
24
- "use strict";
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.groupByApplication = exports.organizeSchema = exports.fetchSchema = void 0;
27
- exports.pullSchema = pullSchema;
28
- const fetcher_1 = require("./fetcher");
29
- const organizer_1 = require("./organizer");
30
- var fetcher_2 = require("./fetcher");
31
- Object.defineProperty(exports, "fetchSchema", { enumerable: true, get: function () { return fetcher_2.fetchSchema; } });
32
- var organizer_2 = require("./organizer");
33
- Object.defineProperty(exports, "organizeSchema", { enumerable: true, get: function () { return organizer_2.organizeSchema; } });
34
- Object.defineProperty(exports, "groupByApplication", { enumerable: true, get: function () { return organizer_2.groupByApplication; } });
35
- __exportStar(require("./types"), exports);
36
- async function pullSchema(options) {
37
- const schema = await (0, fetcher_1.fetchSchema)(options);
38
- const instanceName = options.instance.replace(/^https?:\/\//, "").replace(/\/$/, "");
39
- const index = await (0, organizer_1.organizeSchema)({
40
- schema,
41
- outputDir: options.outputDir,
42
- instance: instanceName,
43
- scopes: options.scopes,
44
- });
45
- return index;
46
- }
47
- });
@@ -1,129 +0,0 @@
1
- var __importDefault = (this && this.__importDefault) || function (mod) {
2
- return (mod && mod.__esModule) ? mod : { "default": mod };
3
- };
4
- (function (factory) {
5
- if (typeof module === "object" && typeof module.exports === "object") {
6
- var v = factory(require, exports);
7
- if (v !== undefined) module.exports = v;
8
- }
9
- else if (typeof define === "function" && define.amd) {
10
- define(["require", "exports", "fs", "path", "chalk"], factory);
11
- }
12
- })(function (require, exports) {
13
- "use strict";
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.groupByApplication = groupByApplication;
16
- exports.organizeSchema = organizeSchema;
17
- const fs_1 = require("fs");
18
- const path_1 = __importDefault(require("path"));
19
- const chalk_1 = __importDefault(require("chalk"));
20
- function getAppName(scope) {
21
- // Extract the app short name from the scope identifier.
22
- // Pattern: x_{vendor}_{app} -> {app}
23
- // Examples:
24
- // x_cadso_work -> work
25
- // x_cadso_ti_agile -> ti_agile
26
- // x_nuvo_sinc -> sinc
27
- const parts = scope.split("_");
28
- // First two parts are the vendor prefix (x, vendor)
29
- if (parts.length > 2) {
30
- return parts.slice(2).join("_");
31
- }
32
- return scope;
33
- }
34
- function groupByApplication(options) {
35
- const { schema } = options;
36
- const tablesByApp = {};
37
- for (const [tableName, tableData] of Object.entries(schema)) {
38
- const appName = getAppName(tableData.scope);
39
- if (!tablesByApp[appName]) {
40
- tablesByApp[appName] = {};
41
- }
42
- tablesByApp[appName][tableName] = tableData;
43
- }
44
- return tablesByApp;
45
- }
46
- async function ensureDir(dirPath) {
47
- try {
48
- await fs_1.promises.mkdir(dirPath, { recursive: true });
49
- }
50
- catch (e) {
51
- if (e.code !== "EEXIST") {
52
- throw e;
53
- }
54
- }
55
- }
56
- async function writeTableFiles(options) {
57
- const { appDir, tables } = options;
58
- for (const [tableName, tableData] of Object.entries(tables)) {
59
- const enhancedData = {
60
- table_name: tableName,
61
- label: tableData.label,
62
- scope: tableData.scope,
63
- parent: tableData.parent,
64
- hierarchy: tableData.hierarchy,
65
- created_at: new Date().toISOString(),
66
- field_count: tableData.fields.length,
67
- fields: tableData.fields,
68
- };
69
- const filePath = path_1.default.join(appDir, `${tableName}.json`);
70
- await fs_1.promises.writeFile(filePath, JSON.stringify(enhancedData, null, 2));
71
- }
72
- }
73
- async function writeSummary(options) {
74
- const { appDir, appName, tables } = options;
75
- const summary = {
76
- application: appName,
77
- table_count: Object.keys(tables).length,
78
- tables: Object.keys(tables).map((tableName) => ({
79
- name: tableName,
80
- label: tables[tableName].label,
81
- field_count: tables[tableName].fields.length,
82
- has_parent: !!tables[tableName].parent,
83
- })),
84
- generated_at: new Date().toISOString(),
85
- };
86
- const summaryPath = path_1.default.join(appDir, "_summary.json");
87
- await fs_1.promises.writeFile(summaryPath, JSON.stringify(summary, null, 2));
88
- }
89
- async function writeIndex(options) {
90
- const { outputDir, tablesByApp, instance, scopes, totalTables } = options;
91
- const index = {
92
- instance,
93
- generated_at: new Date().toISOString(),
94
- total_tables: totalTables,
95
- scopes,
96
- applications: Object.keys(tablesByApp).map((appName) => ({
97
- name: appName,
98
- table_count: Object.keys(tablesByApp[appName]).length,
99
- tables: Object.keys(tablesByApp[appName]),
100
- })),
101
- };
102
- const indexPath = path_1.default.join(outputDir, "index.json");
103
- await fs_1.promises.writeFile(indexPath, JSON.stringify(index, null, 2));
104
- return index;
105
- }
106
- async function organizeSchema(options) {
107
- const { schema, outputDir, instance, scopes } = options;
108
- await ensureDir(outputDir);
109
- const tablesByApp = groupByApplication({ schema });
110
- const totalTables = Object.keys(schema).length;
111
- console.log(chalk_1.default.blue(`\nOrganizing ${totalTables} tables into ${Object.keys(tablesByApp).length} applications...\n`));
112
- for (const [appName, tables] of Object.entries(tablesByApp)) {
113
- const appDir = path_1.default.join(outputDir, appName);
114
- await ensureDir(appDir);
115
- await writeTableFiles({ appDir, tables });
116
- await writeSummary({ appDir, appName, tables });
117
- console.log(` ${chalk_1.default.cyan(appName)}: ${Object.keys(tables).length} tables`);
118
- }
119
- const index = await writeIndex({
120
- outputDir,
121
- tablesByApp,
122
- instance,
123
- scopes,
124
- totalTables,
125
- });
126
- console.log(chalk_1.default.green(`\nSchema organized into ${outputDir}`));
127
- return index;
128
- }
129
- });
@@ -1,12 +0,0 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- });
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes