Skip to content

About

Multi-site shift coverage built with the AgentUI CLI — server-side coverage aggregation, open-shift assignment and an hourly coverage scan.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shift coverage across sites — an AgentUI app built from the terminal

Who is working where, which shifts nobody has picked up, and how coverage looks per site. Built on AgentUI and edited entirely as local files with @agentuiai/cli.

This is the tool that usually exists as a shared spreadsheet one person keeps in their head — the one that breaks the week they take holiday.

Build it

npm install -g @agentuiai/cli
agentui auth login
agentui project create --name "Shift Coverage"
cd shift-coverage

One command creates the project on the platform and scaffolds the local folder, AGENTS.md included. Copy entities/, pages/, components/ and functions/ from this repo, then:

agentui validate
agentui project push --dry-run
agentui project push
agentui build && agentui deploy

Keep the board fresh with an hourly scan:

agentui automation trigger set schedule "0 * * * *"
agentui functions invoke coverageScan
agentui functions logs coverageScan

What's in here

entities/Site.schema.json       code, timezone, minimum staffing
entities/Employee.schema.json   site, role, weekly hour cap
entities/Shift.schema.json      date, hours, role needed, assignment, status
pages/Coverage.jsx              coverage per site, grouped server-side
pages/OpenShifts.jsx            the gaps, with one-click assignment
components/                     CoverageBar, ShiftRow
functions/coverageScan.js       Deno function, recomputes is_uncovered hourly

Patterns worth copying

Coverage is counted by the platform, not the browser. Coverage.jsx runs two grouped Shift.aggregate() calls and subtracts. Listing shifts and counting in JavaScript would cap at 300 rows and quietly under-report a chain with more than a few sites.

is_uncovered is stored, not computed at read time. "Nobody assigned, or the assigned person no-showed" is a condition across two columns, which grouped aggregate filters cannot express. The hourly scan writes it down; the dashboard reads it back.

Dates and instants are different fields. shift_on is format: "date" and holds YYYY-MM-DD — a shift belongs to a calendar day at its own site, not to an instant. starts_at and ends_at are format: "date-time" and hold ISO instants, which is what you need when sites sit in different timezones.

A deliberate gap

OpenShifts.jsx assigns the first available person with the right role. It does not check weekly_hour_cap, and a real roster must — that check belongs in a serverless function where it can read the whole week's shifts without the 300-row cap biting. It is left out so the assignment flow stays readable.

Driving it with a coding agent

agentui --json project list
agentui --json project push --dry-run
agentui --json functions invoke coverageScan

Every subcommand takes --json and prints machine-parseable JSON on stdout, structured errors included.

Reference

MIT.

About

Multi-site shift coverage built with the AgentUI CLI — server-side coverage aggregation, open-shift assignment and an hourly coverage scan.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages