@brainervirus/workit-mcp 2.1.2 → 2.1.3

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 (2) hide show
  1. package/dist/index.js +18 -70
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -22835,7 +22835,6 @@ var LOCALE_RE = /^[a-z]{2,3}(-(?:[A-Z]{2}|[0-9]{3}))?$/;
22835
22835
  var DEFAULTS = {
22836
22836
  locale: "en",
22837
22837
  localeOptions: ["en", "es-CL", "es-MX", "es-AR", "pt-BR"],
22838
- timezone: "America/Santiago",
22839
22838
  branchPolicy: {
22840
22839
  preset: "gitflow",
22841
22840
  allowed: [...PRESETS.gitflow.allowed],
@@ -22873,7 +22872,6 @@ var parseConfigResult = (raw, file) => {
22873
22872
  config: {
22874
22873
  locale,
22875
22874
  localeOptions: Array.isArray(input.localeOptions) ? input.localeOptions : DEFAULTS.localeOptions,
22876
- timezone: input.timezone ?? DEFAULTS.timezone,
22877
22875
  branchPolicy: mergePreset(preset, {
22878
22876
  allowed: Array.isArray(input.branchPolicy?.allowed) ? input.branchPolicy.allowed : undefined,
22879
22877
  protectedNames: Array.isArray(input.branchPolicy?.protected) ? input.branchPolicy.protected : undefined
@@ -28310,56 +28308,19 @@ var readYouTrackContextConfig = () => {
28310
28308
  return { error: "YouTrack configuration is unavailable" };
28311
28309
  return { data: readOnlyYouTrackConfig(parsed) };
28312
28310
  };
28313
- function tzParts(date, tz) {
28314
- const parts = new Intl.DateTimeFormat("en-GB", {
28315
- timeZone: tz,
28316
- year: "numeric",
28317
- month: "2-digit",
28318
- day: "2-digit",
28319
- hour: "2-digit",
28320
- minute: "2-digit",
28321
- hourCycle: "h23"
28322
- }).formatToParts(date);
28323
- const map = Object.fromEntries(parts.map((p) => [p.type, p.value]));
28324
- return { y: map.year, m: map.month, d: map.day, hour: map.hour, minute: map.minute };
28325
- }
28326
- function youTrackGreeting(configOverride) {
28327
- const cfgPath = configOverride ?? youTrackConfigPath();
28328
- let parsed;
28329
- try {
28330
- parsed = JSON.parse(fs9.readFileSync(cfgPath, "utf8"));
28331
- } catch {
28332
- return {
28333
- stdout: "",
28334
- exitCode: 1,
28335
- stderr: fs9.existsSync(cfgPath) ? `${cfgPath} is not valid JSON` : `missing youtrack.json: ${cfgPath}`
28336
- };
28337
- }
28338
- if (!isConfigObject(parsed)) {
28339
- return { stdout: "", exitCode: 1, stderr: `${cfgPath} is not a JSON object` };
28340
- }
28341
- const config = parsed;
28342
- try {
28343
- const tz = String(config.timezone ?? "America/Santiago");
28344
- const now = new Date;
28345
- const { y, m, d, hour, minute } = tzParts(now, tz);
28346
- const cutoff = String(config.greetingCutoff ?? "12:00").split(":");
28347
- const cutoffHour = Number(cutoff[0]);
28348
- const cutoffMinute = Number(cutoff[1] ?? 0);
28349
- const greetings = config.greetings ?? {};
28350
- const isMorning = Number(hour) < cutoffHour || Number(hour) === cutoffHour && Number(minute) < cutoffMinute;
28351
- const greeting = isMorning ? greetings.morning ?? "buenos días" : greetings.afternoon ?? "buenas tardes";
28352
- const mention = String(config.defaultMention ?? "Alejandra.Flores");
28353
- return { stdout: `@${mention} Hola, ${greeting}.
28354
- `, exitCode: 0, stderr: "" };
28355
- } catch (err) {
28356
- return {
28357
- stdout: "",
28358
- exitCode: 1,
28359
- stderr: err instanceof Error ? err.message : "greeting failed"
28360
- };
28361
- }
28362
- }
28311
+ var processTimezone = () => Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
28312
+ var effectiveWorkTimezone = (cfg) => {
28313
+ const configured = cfg?.timezone;
28314
+ return typeof configured === "string" && configured.trim() ? { timezone: configured.trim(), source: "youtrack.json" } : { timezone: processTimezone(), source: "process" };
28315
+ };
28316
+ var DEFAULT_MEETING_WORK_ITEM_TEXT = "Meetings";
28317
+ var meetingWorkItemText = (cfg, item) => {
28318
+ if (typeof item?.workItemText === "string" && item.workItemText)
28319
+ return item.workItemText;
28320
+ if (typeof cfg?.meetingWorkItemText === "string" && cfg.meetingWorkItemText)
28321
+ return cfg.meetingWorkItemText;
28322
+ return DEFAULT_MEETING_WORK_ITEM_TEXT;
28323
+ };
28363
28324
  function youTrackParseDuration(text) {
28364
28325
  const lower = String(text).toLowerCase().trim();
28365
28326
  let total = 0;
@@ -28436,7 +28397,6 @@ function parseIssueRef(input) {
28436
28397
  }
28437
28398
  var contextScripts = {
28438
28399
  config: readYouTrackContextConfig,
28439
- greeting: () => youTrackGreeting(youTrackReadOnlyConfigPath()),
28440
28400
  parseDuration: (text) => youTrackParseDuration(text),
28441
28401
  api: () => ({ error: "YouTrack context is read-only" })
28442
28402
  };
@@ -28465,7 +28425,7 @@ function meetingOptionsFromConfig(cfg) {
28465
28425
  key,
28466
28426
  issue: item.issue,
28467
28427
  label: item.label ?? item.issue,
28468
- workItemText: item.workItemText ?? "Reuniones",
28428
+ workItemText: meetingWorkItemText(cfg, item),
28469
28429
  url: item.url ?? (base && item.issue ? `${base}/issue/${item.issue}` : null)
28470
28430
  }));
28471
28431
  }
@@ -28475,7 +28435,7 @@ function meetingOptionsFromConfig(cfg) {
28475
28435
  key: "general",
28476
28436
  issue,
28477
28437
  label: "General meetings",
28478
- workItemText: "Reuniones",
28438
+ workItemText: meetingWorkItemText(cfg),
28479
28439
  url: base && issue ? `${base}/issue/${issue}` : null
28480
28440
  }
28481
28441
  ];
@@ -28497,17 +28457,9 @@ var readOnlyYouTrackConfig = (cfg) => {
28497
28457
  const baseUrl = publicUrl(cfg.baseUrl);
28498
28458
  if (baseUrl)
28499
28459
  safe.baseUrl = baseUrl;
28500
- for (const key of ["timezone", "greetingCutoff", "defaultMention", "meetingIssue"])
28460
+ for (const key of ["timezone", "meetingIssue", "meetingWorkItemText"])
28501
28461
  if (typeof cfg[key] === "string")
28502
28462
  safe[key] = cfg[key];
28503
- if (cfg.greetings && typeof cfg.greetings === "object" && !Array.isArray(cfg.greetings)) {
28504
- const greetings = {};
28505
- for (const key of ["morning", "afternoon"])
28506
- if (typeof cfg.greetings[key] === "string")
28507
- greetings[key] = cfg.greetings[key];
28508
- if (Object.keys(greetings).length)
28509
- safe.greetings = greetings;
28510
- }
28511
28463
  if (cfg.meetingIssues && typeof cfg.meetingIssues === "object" && !Array.isArray(cfg.meetingIssues)) {
28512
28464
  safe.meetingIssues = Object.fromEntries(Object.entries(cfg.meetingIssues).flatMap(([key, value]) => {
28513
28465
  if (!value || typeof value !== "object" || Array.isArray(value))
@@ -28537,16 +28489,12 @@ function context({
28537
28489
  const cfg = scripts.config();
28538
28490
  if (cfg.error)
28539
28491
  return { error: cfg.error };
28540
- const greeting = scripts.greeting();
28541
- if (greeting.exitCode !== 0) {
28542
- return { error: (greeting.stderr || greeting.stdout || "greeting failed").trim() };
28543
- }
28544
28492
  const safeConfig = readOnlyYouTrackConfig(cfg.data);
28545
28493
  const meetingOptions = meetingOptionsFromConfig(safeConfig);
28546
28494
  if (mode === "meetings" && !issue_id && !issue_url && !issue_ref) {
28547
28495
  return {
28548
28496
  config: safeConfig,
28549
- greeting: greeting.stdout.trim(),
28497
+ workTimezone: effectiveWorkTimezone(safeConfig),
28550
28498
  mode: "meetings",
28551
28499
  requiresMeetingChoice: true,
28552
28500
  meetingOptions,
@@ -28575,7 +28523,7 @@ function context({
28575
28523
  const selectedMeeting = meetingOptions.find((m) => m.issue === issue);
28576
28524
  return {
28577
28525
  config: safeConfig,
28578
- greeting: greeting.stdout.trim(),
28526
+ workTimezone: effectiveWorkTimezone(safeConfig),
28579
28527
  issueId: issue,
28580
28528
  issueUrl,
28581
28529
  mode: mode ?? (selectedMeeting ? "meetings" : "task"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-mcp",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "private": false,
5
5
  "description": "Workit shared MCP transport for the eight task and policy operation families",
6
6
  "keywords": [
@@ -42,7 +42,7 @@
42
42
  "build": "bun scripts/build.ts"
43
43
  },
44
44
  "dependencies": {
45
- "@brainervirus/workit-core": "^2.1.2",
45
+ "@brainervirus/workit-core": "^2.1.3",
46
46
  "@modelcontextprotocol/sdk": "1.30.0",
47
47
  "zod": "4.5.4"
48
48
  },