sd-scheduler
Use when the user asks to fill, extend, edit or check the Service Desk duty schedule (sd.wb.ru scheduler / Планировщик) — e.g. "проставь расписание", "заполни график до конца месяца", "проставь смены 10-10". Automates shifts through the sd.wb.ru gateway API from the open browser page.
- License 许可
- MIT
- 最近更新
- 2026-10-30
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- sd-scheduler
- description
- Use when the user asks to fill, extend, edit or check the Service Desk duty schedule (sd.wb.ru scheduler / Планировщик) — e.g. "проставь расписание", "заполни график до конца месяца", "проставь смены 10-10". Automates shifts through the sd.wb.ru gateway API from the open browser page.
03 SKILL.md 正文
Service Desk scheduler automation
Manage duty shifts in the SD scheduler (https://sd.wb.ru) through its internal gateway API, executed from the already-authenticated browser page via the chrome-devtools MCP tools. Do not call the API from the shell — auth lives in browser session cookies.
Prerequisites
- The scheduler page must be open in Chrome:
https://sd.wb.ru/admin/ns/<NS>/scheduler/main(e.g. NS =BANK). Find it withlist_pages; if missing, open it withnew_page. - All API calls run inside
evaluate_scriptwithcredentials: "include"on that page. - Never print cookies or tokens captured from network requests.
Discover the scheduler id
namespaceId is a UUID, not the namespace code. Get it from the page network log: find any request matching /api/gateway/scheduler/<uuid> in list_network_requests (reload the page first if the log is empty). For the BANK namespace it is currently 4b8265f5-8f07-4c6d-94ad-9cde0dd49991, but always discover it dynamically.
API endpoints
All relative to https://sd.wb.ru, content-type: application/json;charset=utf-8.
- Shift types:
GET /api/gateway/scheduler/{namespaceId}/shift→{data: [{id, name, interval: {from, to}, type: "active"|"inactive", color}]}. Pick the type by itsname(e.g."10:00 - 09:59"), not by hard-coded id. - Load schedule:
POST /api/gateway/scheduler/{namespaceId}body:{"active":false,"interval":{"from":"YYYY-MM-DD","to":"YYYY-MM-DD"},"search":"","sortDir":"asc","team":[]}→{data: [{user: {id, login, lastName, firstName}, workShift: [{day: "YYYY-MM-DD", shift: {...}}]}]}. Returns the whole namespace (~300 users) regardless of UI filters — filter byloginclient-side. - Create shifts:
POST /api/gateway/scheduler/{namespaceId}/work-shiftbody is an array:[{"day":"YYYY-MM-DD","shiftId":"<uuid>","userId":"<uuid>"}]— batchable. - Delete shifts:
DELETE /api/gateway/scheduler/{namespaceId}/work-shift, same array body.
Execution rules
- One shot: do the whole read → compute → write → verify cycle in a single
evaluate_scriptcall. The SPA can reload and destroy the execution context between calls. - Idempotent: read current
workShiftfirst and create only missing days. Never blind-POST; re-running must not duplicate shifts. - Verify: after writing, re-load the schedule and check every day in the requested range has the expected coverage. Report gaps or overlaps explicitly.
- Reload the page and take a screenshot at the end so the user sees the result.
Rotation pattern
When asked to "continue" a schedule, infer the pattern from existing shifts instead of asking:
- Take the specialists that already have shifts in the month.
- Order them by the day of their first shift — that is the rotation order.
- Continue round-robin (period = number of specialists) with the same shift type to the end of the range.
- If existing shifts are contradictory or ambiguous, ask the user one concrete question.
Template
async () => {
const NS = "<namespaceId>";
const load = async () => (await (await fetch(`/api/gateway/scheduler/${NS}`, {
method: "POST", credentials: "include",
headers: { "content-type": "application/json;charset=utf-8" },
body: JSON.stringify({ active: false, interval: { from: FROM, to: TO }, search: "", sortDir: "asc", team: [] })
})).json()).data || [];
const types = (await (await fetch(`/api/gateway/scheduler/${NS}/shift`, { credentials: "include" })).json()).data;
const shiftId = types.find(t => t.name === "10:00 - 09:59").id;
const data = await load();
const byLogin = Object.fromEntries(LOGINS.map(login => {
const u = data.find(x => x.user.login === login);
return [login, { id: u.user.id, days: new Set(u.workShift.map(w => w.day)) }];
}));
const toAdd = [];
for (let d = 1; d <= DAYS_IN_MONTH; d++) {
const login = LOGINS[(d - 1) % LOGINS.length];
const day = `2026-11-${String(d).padStart(2, "0")}`;
if (!byLogin[login].days.has(day)) toAdd.push({ day, shiftId, userId: byLogin[login].id });
}
if (toAdd.length) {
const r = await fetch(`/api/gateway/scheduler/${NS}/work-shift`, {
method: "POST", credentials: "include",
headers: { "content-type": "application/json;charset=utf-8" },
body: JSON.stringify(toAdd)
});
if (!r.ok) return { error: r.status, body: (await r.text()).slice(0, 300) };
}
const after = await load();
// verify: every day in range covered exactly once by the rotation logins
const count = {};
for (const login of LOGINS) {
for (const w of after.find(x => x.user.login === login).workShift) count[w.day] = (count[w.day] || 0) + 1;
}
const gaps = [];
for (let d = 1; d <= DAYS_IN_MONTH; d++) {
const day = `2026-11-${String(d).padStart(2, "0")}`;
if (count[day] !== 1) gaps.push(`${day}: ${count[day] || 0}`);
}
return { added: toAdd.length, gaps };
}
04 同仓库更多 Skills
verify
Use when a change in __SERVICE__ must be checked before review
work-record
Use when you finished work on a tracker task and it must be recorded in the workspace through a merge request.
task-new
Use to create one story in a stream from the stream profile's story template, link it from its scope screens and open a merge request.
task-decompose
Use to split a stream at the decomposition stage into stories - list scope screens without a story, create the accepted stories and close the stage through a merge request.
task-context
Use to gather the context of a story key or a tracker id - its story, stream stage, scope screens, repositories, decisions, mockups and work records.
repos-sync
Use to update clones of your repositories under repos/ and see their branch, lag and uncommitted changes.