@fusedashlabs/ui9000-workspace
Version:
UI9000 workspace MCP. One tool, show_workspace, draws a chart from your table. Set TYPESAFE_API_KEY to let Jev choose the chart.
69 lines (68 loc) • 2.05 kB
JavaScript
/**
* Column names (normalized) that describe a schedule: one row per task, with
* the day it starts and the day it ends, plus optional phase, dependencies,
* assignee, progress and effort.
*
* Shared by the family gate in discuss-chart (names only) and the payload
* builder (names and values), so the two cannot drift apart. A task, a start
* and an end are all needed: a table with only a date, or a start and no end,
* is a series over time, not a plan.
*/
import { normalizeName } from './table.js';
export const TASK_KEYS = new Set([
'task',
'taskname',
'tasktitle',
'activity',
'activityname',
'workitem',
'milestone',
'step',
'name',
'title',
]);
export const START_KEYS = new Set([
'start',
'startdate',
'startson',
'begin',
'begindate',
'planstart',
'plannedstart',
]);
export const END_KEYS = new Set([
'end',
'enddate',
'endson',
'finish',
'finishdate',
'due',
'duedate',
'deadline',
'planend',
'plannedend',
]);
export const PHASE_KEYS = new Set(['phase', 'stage', 'workstream', 'workpackage', 'epic', 'group', 'project']);
export const DEPENDS_KEYS = new Set([
'dependson',
'dependencies',
'dependency',
'predecessor',
'predecessors',
'after',
'blockedby',
'waitsfor',
'prerequisite',
'prerequisites',
]);
export const ASSIGNEE_KEYS = new Set(['assignee', 'assignedto', 'owner', 'responsible']);
export const PROGRESS_KEYS = new Set(['progress', 'percentcomplete', 'complete', 'completion', 'percentdone', 'done']);
export const EFFORT_KEYS = new Set(['effort', 'efforthours', 'hours', 'estimate', 'estimatehours', 'eh']);
/** The first column of `keys` whose normalized name is in `set`. */
export function pickKey(keys, set) {
return keys.find((key) => set.has(normalizeName(key)));
}
/** A task, a start and an end are named. */
export function namesSchedule(keys) {
return !!pickKey(keys, TASK_KEYS) && !!pickKey(keys, START_KEYS) && !!pickKey(keys, END_KEYS);
}