@codegame.dev/careerflow-mcp 1.9.0 → 2.1.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 +215 -119
- package/dist/capabilities.js +37 -8
- package/dist/capabilities.js.map +1 -1
- package/dist/client.js +48 -13
- package/dist/client.js.map +1 -1
- package/dist/helpers.js +87 -33
- package/dist/helpers.js.map +1 -1
- package/dist/index.js +134 -55
- package/dist/index.js.map +1 -1
- package/dist/prompts.js +38 -0
- package/dist/prompts.js.map +1 -0
- package/dist/setup.js +139 -16
- package/dist/setup.js.map +1 -1
- package/dist/tools/kanban-extra.js +39 -3
- package/dist/tools/kanban-extra.js.map +1 -1
- package/dist/tools/tasks.js +85 -24
- package/dist/tools/tasks.js.map +1 -1
- package/dist/tools/time.js +1 -7
- package/dist/tools/time.js.map +1 -1
- package/dist/tools/worklog.js +375 -0
- package/dist/tools/worklog.js.map +1 -0
- package/dist/workspaces.js +58 -0
- package/dist/workspaces.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { companyIdSchema, currentUserId, editTask, extractList, formatApiDate, resolveCompanyId, safeHandler, textResult, withBoardHint } from "../helpers.js";
|
|
3
|
+
import { findWorkspace, saveWorkspace } from "../workspaces.js";
|
|
4
|
+
const itemSchema = z.object({
|
|
5
|
+
title: z.string().min(1),
|
|
6
|
+
description: z.string().optional(),
|
|
7
|
+
minutes: z.number().int().min(1).optional().describe("Time spent, logged against the task."),
|
|
8
|
+
done: z.boolean().optional().describe("Mark the task complete. Defaults to true — the work is finished."),
|
|
9
|
+
date: z.string().optional().describe("When the work happened, YYYY-MM-DD or YYYY-MM-DD HH:MM:SS. Defaults to now.")
|
|
10
|
+
});
|
|
11
|
+
/** "YYYY-MM-DD" gets the current time of day; a full timestamp passes through. */
|
|
12
|
+
function workDate(date) {
|
|
13
|
+
const now = formatApiDate(new Date());
|
|
14
|
+
if (!date)
|
|
15
|
+
return now;
|
|
16
|
+
const trimmed = date.trim();
|
|
17
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(trimmed))
|
|
18
|
+
return `${trimmed} ${now.slice(11)}`;
|
|
19
|
+
return trimmed;
|
|
20
|
+
}
|
|
21
|
+
const targetSchema = {
|
|
22
|
+
project: z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("Project name as shown in the UI (a 'board' or 'project' there). Alternative to project_id."),
|
|
26
|
+
project_id: z.number().int().optional(),
|
|
27
|
+
board: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Override: name of the list (API board) every task goes to. Only when the user names a list; " +
|
|
31
|
+
"otherwise the list is picked per task."),
|
|
32
|
+
board_id: z.number().int().optional(),
|
|
33
|
+
done_board: z.string().optional().describe("Override: name of the list (API board) finished tasks go to."),
|
|
34
|
+
done_board_id: z.number().int().optional(),
|
|
35
|
+
workspace: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Absolute path of the repo the work was done in. Pass it when the server's own working " +
|
|
39
|
+
"directory is not the repo (some clients start servers from $HOME).")
|
|
40
|
+
};
|
|
41
|
+
const norm = (value) => String(value ?? "")
|
|
42
|
+
.trim()
|
|
43
|
+
.replace(/\s+/g, " ")
|
|
44
|
+
.toLowerCase();
|
|
45
|
+
/** Picks one row by exact name, else by a unique partial match; otherwise explains the choices. */
|
|
46
|
+
function pickByName(rows, name, kind, where) {
|
|
47
|
+
const label = (r) => r.title ?? r.name;
|
|
48
|
+
const exact = rows.filter((r) => norm(label(r)) === norm(name));
|
|
49
|
+
const partial = exact.length ? exact : rows.filter((r) => norm(label(r)).includes(norm(name)));
|
|
50
|
+
if (partial.length === 1)
|
|
51
|
+
return partial[0];
|
|
52
|
+
const options = (partial.length ? partial : rows)
|
|
53
|
+
.slice(0, 25)
|
|
54
|
+
.map((r) => `${r.id} '${label(r)}'`)
|
|
55
|
+
.join(", ");
|
|
56
|
+
throw new Error(partial.length
|
|
57
|
+
? `More than one ${kind} matches '${name}'${where}: ${options}. Ask the user which one.`
|
|
58
|
+
: `No ${kind} named '${name}'${where}. Options: ${options || "none visible to this token"}.`);
|
|
59
|
+
}
|
|
60
|
+
const listName = (list) => (list ? String(list.name ?? list.title ?? "") : "");
|
|
61
|
+
const DONE_LIST = /\b(done|completed?|finished|closed)\b|انجام[\s\u200c]*شده|تمام[\s\u200c]*شده|تکمیل[\s\u200c]*شده/i;
|
|
62
|
+
const OPEN_LIST = /\b(in[\s-]*progress|doing|wip)\b|در[\s\u200c]*حال[\s\u200c]*انجام/i;
|
|
63
|
+
/**
|
|
64
|
+
* The list a task goes to. A repo maps to a project, and lists are stages of
|
|
65
|
+
* that project's workflow, so the list follows the task: finished work goes to
|
|
66
|
+
* the list named like "Done" (else the last list), unfinished work to the one
|
|
67
|
+
* named like "In progress" (else the first list). Overrides win.
|
|
68
|
+
*/
|
|
69
|
+
function pickList(target, done) {
|
|
70
|
+
const byId = (id) => id === undefined ? undefined : target.lists.find((b) => Number(b.id) === id);
|
|
71
|
+
const override = done ? (byId(target.doneBoardId) ?? byId(target.boardId)) : byId(target.boardId);
|
|
72
|
+
if (override)
|
|
73
|
+
return override;
|
|
74
|
+
const lists = target.lists;
|
|
75
|
+
if (done)
|
|
76
|
+
return lists.find((b) => DONE_LIST.test(listName(b))) ?? lists[lists.length - 1];
|
|
77
|
+
return lists.find((b) => OPEN_LIST.test(listName(b))) ?? lists[0];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Turns names or ids (or the folder's saved entry) into a validated target.
|
|
81
|
+
* Users know projects and lists by name, never by id, so names are resolved
|
|
82
|
+
* here; ids are still accepted. List overrides are checked against the
|
|
83
|
+
* project's active lists — a list from another project was the most common
|
|
84
|
+
* mistake in the logs.
|
|
85
|
+
*/
|
|
86
|
+
async function resolveTarget(client, companyId, args, entry, dir) {
|
|
87
|
+
const explicitProject = args.project_id !== undefined || args.project !== undefined;
|
|
88
|
+
const explicitBoard = args.board_id !== undefined || args.board !== undefined;
|
|
89
|
+
const explicitDone = args.done_board_id !== undefined || args.done_board !== undefined;
|
|
90
|
+
const explicit = explicitProject || explicitBoard || explicitDone;
|
|
91
|
+
let projectId = args.project_id ?? (explicitProject ? undefined : entry.project_id);
|
|
92
|
+
let projectTitle = explicitProject ? undefined : entry.project_title;
|
|
93
|
+
if (projectId === undefined && args.project !== undefined) {
|
|
94
|
+
const myId = await currentUserId(client);
|
|
95
|
+
const query = { company_id: companyId, search: args.project, limit: 50 };
|
|
96
|
+
let response = await client.get("projects/search", {
|
|
97
|
+
...query,
|
|
98
|
+
user_id: myId
|
|
99
|
+
});
|
|
100
|
+
let { items } = extractList(response.data, "projects");
|
|
101
|
+
if (!items.length) {
|
|
102
|
+
try {
|
|
103
|
+
response = await client.get("projects/search", query);
|
|
104
|
+
items = extractList(response.data, "projects").items;
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// not permitted company-wide; fall through to the "no project" error
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const project = pickByName(items.filter((p) => !Number(p.is_archived)), args.project, "project", "");
|
|
111
|
+
projectId = Number(project.id);
|
|
112
|
+
projectTitle = project.title ?? project.name;
|
|
113
|
+
}
|
|
114
|
+
if (projectId === undefined) {
|
|
115
|
+
throw new Error(`No project is saved for ${dir}. Ask the user which board or project (as the UI calls it) to ` +
|
|
116
|
+
"log work on, then pass it as project by name.");
|
|
117
|
+
}
|
|
118
|
+
const sameProject = Number(projectId) === Number(entry.project_id);
|
|
119
|
+
if (sameProject && !explicitProject)
|
|
120
|
+
projectTitle ??= entry.project_title;
|
|
121
|
+
const saved = (value) => value === null || value === undefined ? undefined : Number(value);
|
|
122
|
+
let boardId = args.board_id ?? (sameProject && !explicitBoard ? saved(entry.board_id) : undefined);
|
|
123
|
+
let doneBoardId = args.done_board_id ?? (sameProject && !explicitDone ? saved(entry.done_board_id) : undefined);
|
|
124
|
+
const response = await client.get("kanbans/boards/all", {
|
|
125
|
+
company_id: companyId,
|
|
126
|
+
project_id: projectId
|
|
127
|
+
});
|
|
128
|
+
const lists = extractList(response.data, "boards")
|
|
129
|
+
.items.filter((b) => !Number(b.is_archived))
|
|
130
|
+
.sort((a, b) => Number(a.num ?? 0) - Number(b.num ?? 0));
|
|
131
|
+
const where = ` in project ${projectId}${projectTitle ? ` '${projectTitle}'` : ""}`;
|
|
132
|
+
if (!lists.length)
|
|
133
|
+
throw new Error(`Project ${projectId}${projectTitle ? ` '${projectTitle}'` : ""} has no active list.`);
|
|
134
|
+
if (boardId === undefined && args.board !== undefined) {
|
|
135
|
+
boardId = Number(pickByName(lists, args.board, "list", where).id);
|
|
136
|
+
}
|
|
137
|
+
if (doneBoardId === undefined && args.done_board !== undefined) {
|
|
138
|
+
doneBoardId = Number(pickByName(lists, args.done_board, "list", where).id);
|
|
139
|
+
}
|
|
140
|
+
for (const id of [boardId, doneBoardId].filter((v) => v !== undefined)) {
|
|
141
|
+
if (!lists.some((b) => Number(b.id) === id)) {
|
|
142
|
+
const options = lists.map((b) => `${b.id} '${listName(b)}'`).join(", ");
|
|
143
|
+
throw new Error(`board_id ${id} is not an active list${where}. Its lists: ${options}.`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return { projectId: Number(projectId), projectTitle, boardId, doneBoardId, lists, explicit };
|
|
147
|
+
}
|
|
148
|
+
/** What a saved entry keeps: the project, plus list overrides only when the user chose them. */
|
|
149
|
+
function entryFor(companyId, target) {
|
|
150
|
+
const name = (id) => listName(target.lists.find((b) => Number(b.id) === id)) || undefined;
|
|
151
|
+
return {
|
|
152
|
+
company_id: companyId,
|
|
153
|
+
project_id: target.projectId,
|
|
154
|
+
project_title: target.projectTitle,
|
|
155
|
+
...(target.boardId !== undefined ? { board_id: target.boardId, board_name: name(target.boardId) } : {}),
|
|
156
|
+
...(target.doneBoardId !== undefined ? { done_board_id: target.doneBoardId } : {})
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const normaliseTitle = (title) => title.trim().replace(/\s+/g, " ").toLowerCase();
|
|
160
|
+
/**
|
|
161
|
+
* record_work — the one-call path for the main use of this server: after
|
|
162
|
+
* finishing coding work in a repo, record it as tasks on that repo's board, log
|
|
163
|
+
* the time, and close them. Replaces discovery + create_task + log_time +
|
|
164
|
+
* complete_task (4–9 calls per task) with one call per batch.
|
|
165
|
+
*/
|
|
166
|
+
export function registerWorklogTools(server, client) {
|
|
167
|
+
server.registerTool("record_work", {
|
|
168
|
+
title: "Record finished work",
|
|
169
|
+
description: "Record finished work as tasks in one call: for each item, create the task (assigned to " +
|
|
170
|
+
"you), log its minutes, and mark it complete. The project defaults to this folder's saved " +
|
|
171
|
+
"one; without one, pass project by name as the user says it (what the UI calls a board or " +
|
|
172
|
+
"project) and it is saved for this folder. The list is picked per task: finished work goes " +
|
|
173
|
+
"to the list named like 'Done' (else the last), unfinished to 'In progress' (else the " +
|
|
174
|
+
"first). Pass board / done_board (UI lists) only when the user names a list. An open task " +
|
|
175
|
+
"in the project with the same title is reused instead of duplicated. Each item reports " +
|
|
176
|
+
"its own status, so one failure does not stop the rest.",
|
|
177
|
+
inputSchema: {
|
|
178
|
+
tasks: z.array(itemSchema).min(1).max(30),
|
|
179
|
+
company_id: companyIdSchema,
|
|
180
|
+
...targetSchema,
|
|
181
|
+
remember: z
|
|
182
|
+
.boolean()
|
|
183
|
+
.optional()
|
|
184
|
+
.describe("Save the target as this folder's default. Defaults to true when the folder has no " +
|
|
185
|
+
"saved project yet or a target was passed, false otherwise.")
|
|
186
|
+
}
|
|
187
|
+
}, safeHandler(async (args) => {
|
|
188
|
+
const dir = args.workspace || process.cwd();
|
|
189
|
+
const mapped = findWorkspace(dir);
|
|
190
|
+
const entry = mapped?.entry ?? {};
|
|
191
|
+
const companyId = resolveCompanyId(client, args.company_id ?? entry.company_id);
|
|
192
|
+
const target = await resolveTarget(client, companyId, args, entry, dir);
|
|
193
|
+
const { projectId } = target;
|
|
194
|
+
const remember = args.remember ?? (!mapped || target.explicit);
|
|
195
|
+
const myId = await currentUserId(client);
|
|
196
|
+
const results = [];
|
|
197
|
+
let projectTitle = target.projectTitle;
|
|
198
|
+
for (const item of args.tasks) {
|
|
199
|
+
const result = { title: item.title };
|
|
200
|
+
results.push(result);
|
|
201
|
+
const done = item.done ?? true;
|
|
202
|
+
const list = pickList(target, done);
|
|
203
|
+
const listId = Number(list.id);
|
|
204
|
+
result.list = listName(list);
|
|
205
|
+
const warn = (step, error) => {
|
|
206
|
+
;
|
|
207
|
+
(result.warnings ??= []).push(`${step}: ${error.message ?? String(error)}`);
|
|
208
|
+
};
|
|
209
|
+
let ref;
|
|
210
|
+
let task;
|
|
211
|
+
try {
|
|
212
|
+
// duplicate guard: reuse an open task with the same title. `title` is
|
|
213
|
+
// an exact-match filter; backends without it ignore it and the LIKE
|
|
214
|
+
// `search` plus the comparison below do the same job
|
|
215
|
+
const search = await client.get("kanbans/tasks/search", {
|
|
216
|
+
company_id: companyId,
|
|
217
|
+
project_id: projectId,
|
|
218
|
+
search: item.title.trim(),
|
|
219
|
+
title: item.title.trim(),
|
|
220
|
+
is_completed: 0,
|
|
221
|
+
limit: 20
|
|
222
|
+
});
|
|
223
|
+
const { items: found } = extractList(search.data, "tasks");
|
|
224
|
+
const match = found.find((t) => normaliseTitle(String(t.title ?? "")) === normaliseTitle(item.title));
|
|
225
|
+
if (match) {
|
|
226
|
+
task = match;
|
|
227
|
+
result.matched_existing = true;
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
// is_completed / duration_minutes / date are ignored by backends that
|
|
231
|
+
// do not take them on create; the follow-up steps below check the
|
|
232
|
+
// returned row and only run what the backend did not already do
|
|
233
|
+
const body = {
|
|
234
|
+
company_id: companyId,
|
|
235
|
+
project_id: projectId,
|
|
236
|
+
board_id: listId,
|
|
237
|
+
title: item.title,
|
|
238
|
+
description: item.description,
|
|
239
|
+
assigned_user_id: myId,
|
|
240
|
+
is_completed: done ? 1 : undefined,
|
|
241
|
+
duration_minutes: item.minutes,
|
|
242
|
+
date: item.minutes ? workDate(item.date) : undefined
|
|
243
|
+
};
|
|
244
|
+
const create = async (payload) => (await client.post("kanbans/tasks/create", payload)).data
|
|
245
|
+
?.task;
|
|
246
|
+
try {
|
|
247
|
+
task = await create(body);
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
// not an accepted member of the project: create unassigned
|
|
251
|
+
if (/assigned_user_id/.test(error.message)) {
|
|
252
|
+
task = await create({ ...body, assigned_user_id: undefined });
|
|
253
|
+
result.warnings = ["not assigned: you are not an accepted member of this project"];
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
throw withBoardHint(error, listId, projectId);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (!task || task.id === undefined)
|
|
261
|
+
throw new Error("the API returned no task");
|
|
262
|
+
ref = {
|
|
263
|
+
id: Number(task.id),
|
|
264
|
+
project_id: Number(task.project_id ?? projectId),
|
|
265
|
+
board_id: Number(task.board_id ?? listId),
|
|
266
|
+
title: task.title
|
|
267
|
+
};
|
|
268
|
+
result.id = ref.id;
|
|
269
|
+
projectTitle ??= task.project_title || task.project_name || undefined;
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
result.error = error.message;
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
if (item.minutes) {
|
|
276
|
+
const alreadyLogged = !result.matched_existing && Number(task.time_minutes) > 0;
|
|
277
|
+
if (alreadyLogged) {
|
|
278
|
+
result.minutes = item.minutes;
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
try {
|
|
282
|
+
await client.post("kanbans/tasks/times/add", {
|
|
283
|
+
company_id: companyId,
|
|
284
|
+
project_id: ref.project_id,
|
|
285
|
+
board_id: ref.board_id,
|
|
286
|
+
task_id: ref.id,
|
|
287
|
+
user_id: myId,
|
|
288
|
+
duration_minutes: item.minutes,
|
|
289
|
+
date: workDate(item.date)
|
|
290
|
+
});
|
|
291
|
+
result.minutes = item.minutes;
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
warn("log time", error);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (done) {
|
|
299
|
+
if (Number(task.is_completed) && !result.matched_existing) {
|
|
300
|
+
result.done = true;
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
try {
|
|
304
|
+
await editTask(client, companyId, ref, { is_completed: 1 });
|
|
305
|
+
result.done = true;
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
warn("complete", error);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
// a reused task finished now follows the same rule as a new one
|
|
313
|
+
if (done && result.matched_existing && listId !== ref.board_id) {
|
|
314
|
+
try {
|
|
315
|
+
await client.post("kanbans/tasks/move", {
|
|
316
|
+
company_id: companyId,
|
|
317
|
+
source_project_id: ref.project_id,
|
|
318
|
+
source_board_id: ref.board_id,
|
|
319
|
+
task_id: ref.id,
|
|
320
|
+
destination_project_id: ref.project_id,
|
|
321
|
+
destination_board_id: listId,
|
|
322
|
+
destination_num: 999999,
|
|
323
|
+
destination_global_num: 999999
|
|
324
|
+
});
|
|
325
|
+
result.moved = true;
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
warn("move", error);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
let remembered;
|
|
333
|
+
// only after at least one item went through, so a wrong target is not saved
|
|
334
|
+
if (remember && results.some((r) => r.id !== undefined)) {
|
|
335
|
+
remembered = saveWorkspace(mapped && !args.workspace ? mapped.path : dir, entryFor(companyId, { ...target, projectTitle }));
|
|
336
|
+
}
|
|
337
|
+
return textResult({
|
|
338
|
+
project_id: projectId,
|
|
339
|
+
project: projectTitle,
|
|
340
|
+
remembered_for: remembered,
|
|
341
|
+
failed: results.filter((r) => r.error).length || undefined,
|
|
342
|
+
tasks: results
|
|
343
|
+
});
|
|
344
|
+
}));
|
|
345
|
+
server.registerTool("set_workspace_project", {
|
|
346
|
+
title: "Set this folder's project",
|
|
347
|
+
description: "Save which project this folder's work is logged on, so record_work needs no target. Takes " +
|
|
348
|
+
"the name as the user says it (project = what the UI calls a board or project); ids work " +
|
|
349
|
+
"too. board / done_board (UI lists) are optional overrides of the per-task list choice. " +
|
|
350
|
+
"Call with no arguments to see the saved target.",
|
|
351
|
+
inputSchema: {
|
|
352
|
+
company_id: companyIdSchema,
|
|
353
|
+
...targetSchema
|
|
354
|
+
}
|
|
355
|
+
}, safeHandler(async (args) => {
|
|
356
|
+
const dir = args.workspace || process.cwd();
|
|
357
|
+
const mapped = findWorkspace(dir);
|
|
358
|
+
const entry = mapped?.entry ?? {};
|
|
359
|
+
const explicit = ["project", "project_id", "board", "board_id", "done_board", "done_board_id"].some((key) => args[key] !== undefined);
|
|
360
|
+
if (!explicit) {
|
|
361
|
+
return textResult(mapped ? { folder: mapped.path, ...mapped.entry } : { folder: dir, saved: false });
|
|
362
|
+
}
|
|
363
|
+
const companyId = resolveCompanyId(client, args.company_id ?? entry.company_id);
|
|
364
|
+
const target = await resolveTarget(client, companyId, args, entry, dir);
|
|
365
|
+
const saved = entryFor(companyId, target);
|
|
366
|
+
const folder = saveWorkspace(mapped && !args.workspace ? mapped.path : dir, saved);
|
|
367
|
+
return textResult({
|
|
368
|
+
saved: true,
|
|
369
|
+
folder,
|
|
370
|
+
...saved,
|
|
371
|
+
lists: target.lists.map((b) => `${b.id} '${listName(b)}'`).join(", ")
|
|
372
|
+
});
|
|
373
|
+
}));
|
|
374
|
+
}
|
|
375
|
+
//# sourceMappingURL=worklog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worklog.js","sourceRoot":"","sources":["../../src/tools/worklog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,E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C;YACjB,KAAK,EAAE,IAAI;YACX,MAAM;YACN,GAAG,KAAK;YACR,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SACrE,CAAC,CAAA;IACH,CAAC,CAAC,CACF,CAAA;AACF,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
export function workspacesFile() {
|
|
5
|
+
const base = process.env.XDG_CONFIG_HOME?.trim() || join(homedir(), ".config");
|
|
6
|
+
return join(base, "careerflow-mcp", "workspaces.json");
|
|
7
|
+
}
|
|
8
|
+
export function loadWorkspaces() {
|
|
9
|
+
const file = workspacesFile();
|
|
10
|
+
if (!existsSync(file))
|
|
11
|
+
return {};
|
|
12
|
+
try {
|
|
13
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
14
|
+
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
console.error(`careerflow-mcp: ignoring unreadable ${file} (${error.message})`);
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** The entry for `dir` or its closest mapped ancestor. */
|
|
22
|
+
export function findWorkspace(dir) {
|
|
23
|
+
const map = loadWorkspaces();
|
|
24
|
+
let current = resolve(dir);
|
|
25
|
+
for (;;) {
|
|
26
|
+
const entry = map[current];
|
|
27
|
+
if (entry && Number.isFinite(Number(entry.project_id))) {
|
|
28
|
+
return { path: current, entry };
|
|
29
|
+
}
|
|
30
|
+
const parent = dirname(current);
|
|
31
|
+
if (parent === current)
|
|
32
|
+
return null;
|
|
33
|
+
current = parent;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function saveWorkspace(dir, entry) {
|
|
37
|
+
const file = workspacesFile();
|
|
38
|
+
const map = loadWorkspaces();
|
|
39
|
+
const key = resolve(dir);
|
|
40
|
+
map[key] = entry;
|
|
41
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
42
|
+
// write-then-rename so a crash mid-write cannot leave a truncated file
|
|
43
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
44
|
+
writeFileSync(tmp, JSON.stringify(map, null, 2) + "\n", { mode: 0o600 });
|
|
45
|
+
renameSync(tmp, file);
|
|
46
|
+
return key;
|
|
47
|
+
}
|
|
48
|
+
/** One line for the server instructions, or null when this folder has no mapping. */
|
|
49
|
+
export function describeWorkspace(found) {
|
|
50
|
+
if (!found)
|
|
51
|
+
return null;
|
|
52
|
+
const { entry } = found;
|
|
53
|
+
const project = entry.project_title
|
|
54
|
+
? `project ${entry.project_id} '${entry.project_title}'`
|
|
55
|
+
: `project ${entry.project_id}`;
|
|
56
|
+
return `This folder logs work to ${project} — record_work uses it by default.`;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=workspaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../src/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACxF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA4BlD,MAAM,UAAU,cAAc;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAA;IAC9E,OAAO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