A deterministic greedy scheduler for deadline-bound tasks.
git clone https://github.com/youyong5/DeadlinePlan.git
cd DeadlinePlan
moon run examples/library_demo
moon run --target js cmd/deadlineplan -- examples/student-plan.v1.json
node demo/build.mjs
node demo/serve.mjs{
"schema_version": 1,
"availability": [{ "start": 29875680, "end": 29876220 }],
"fixed_events": [
{ "id": "morning-lecture", "start": 29875740, "end": 29875830 },
{ "id": "afternoon-lecture", "start": 29875980, "end": 29876070 },
{ "id": "biology-exam", "start": 29876160, "end": 29876220 }
],
"tasks": [
{ "id": "topic-announced", "duration_minutes": 1, "deadline": 29875681, "dependencies": [] },
{ "id": "calculus-homework", "duration_minutes": 60, "deadline": 29875980, "dependencies": ["topic-announced"], "earliest_start": 29875830 },
{ "id": "biology-review", "duration_minutes": 210, "deadline": 29876160, "dependencies": ["topic-announced"], "minimum_block_minutes": 60 },
{ "id": "exam-setup", "duration_minutes": 30, "deadline": 29876220, "dependencies": ["biology-review"] }
],
"completed": [{ "id": "topic-announced", "completed_at": 29875680 }],
"confirmed_blocks": [{ "task_id": "biology-review", "start": 29875680, "end": 29875740 }]
}moon run --target js cmd/deadlineplan -- examples/student-plan.v1.json
moon run --target js cmd/deadlineplan -- examples/project-plan.v1.json
moon run --target js cmd/deadlineplan -- --json examples/student-plan.v1.json
moon run --target js cmd/deadlineplan -- --helpScheduled blocks (5):
confirmed biology-review: [2026-10-21T00:00Z, 2026-10-21T01:00Z)
planned calculus-homework: [2026-10-21T02:30Z, 2026-10-21T03:30Z)
planned biology-review: [2026-10-21T03:30Z, 2026-10-21T05:00Z)
planned biology-review: [2026-10-21T06:30Z, 2026-10-21T07:30Z)
planned exam-setup: [2026-10-21T07:30Z, 2026-10-21T08:00Z)
Unscheduled tasks (0):node demo/build.mjs
node demo/serve.mjsnode demo/build.mjs
node tests/demo-browser-smoke.mjsmoon fmt
moon check --deny-warn
moon test
moon test --target js # also reads and schedules both JSON example files from disk
node demo/build.mjs
node tests/demo-browser-smoke.mjs
powershell -NoProfile -ExecutionPolicy Bypass -File tests/cli-smoke.ps1pub(all) suberror PlanJsonError {
JsonSyntax(String)
MissingField(String)
WrongType(String, String)
UnexpectedField(String)
UnsupportedSchemaVersion(Int)
InvalidPlanInput(String, ValidationError)
}pub(all) struct CompletedTask {
id : String
completed_at : Int
}pub(all) struct PlanDocument {
schema_version : Int
availability : Array[TimeWindow]
fixed_events : Array[FixedEvent]
tasks : Array[Task]
completed : Array[CompletedTask]
confirmed_blocks : Array[ScheduledBlock]
}pub(all) struct Task {
id : String
duration_minutes : Int
deadline : Int
dependencies : Array[String]
earliest_start : Int?
minimum_block_minutes : Int?
}pub(all) struct TimeWindow {
start : Int
end : Int
}pub(all) enum UnscheduledReason {
NoContinuousSlot
SplitWorkIncomplete(Int)
DependencyNotScheduled(String)
}pub(all) enum ValidationError {
InvalidWindow(String, String, Int, Int)
InvalidTaskDuration(String, Int)
InvalidEarliestStart(String, Int, Int)
InvalidMinimumBlock(String, Int, Int)
DuplicateTaskId(String)
UnknownDependency(String, String)
DependencyCycle
UnknownCompletedTaskId(String)
DuplicateCompletedTaskId(String)
UnknownConfirmedTaskId(String)
CompletedAndConfirmedTaskId(String)
InvalidConfirmedWindow(String, Int, Int)
ConfirmedOutsideAvailability(String, Int, Int)
ConfirmedBeforeEarliestStart(String, Int, Int)
ConfirmedAfterDeadline(String, Int, Int)
ConfirmedBlockTooShort(String, Int64, Int)
InvalidConfirmedBlockCount(String, Int)
ConfirmedDurationMismatch(String, Int64, Int)
ConfirmedOverlapsFixedEvent(String, String)
ConfirmedBlocksOverlap(String, String)
UnresolvedPriorDependency(String, String)
PriorDependencyFinishesLate(String, String, Int, Int)
}fn schedule(availability : Array[TimeWindow], fixed_events : Array[FixedEvent], tasks : Array[Task]) -> Result[Schedule, ValidationError]fn schedule_with_completed(availability : Array[TimeWindow], fixed_events : Array[FixedEvent], tasks : Array[Task], completed : Array[CompletedTask]) -> Result[Schedule, ValidationError]fn schedule_with_confirmed_blocks(availability : Array[TimeWindow], fixed_events : Array[FixedEvent], tasks : Array[Task], completed : Array[CompletedTask], confirmed_blocks : Array[ScheduledBlock]) -> Result[Schedule, ValidationError]Install
Download zipA deterministic greedy scheduler for deadline-bound tasks.