feat(model): add optional start/end plan span

Optional top-level `start`/`end` dates widen the plan's week range with
lead-in / trailing columns. They only extend the auto-fitted range, never
narrowing it or clipping a Feature, so a momentarily-tight bound can't hide
work in progress.
This commit is contained in:
Julien Calixte
2026-06-17 01:40:29 +02:00
parent f37122eea1
commit d95f0a78c7
3 changed files with 8 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ export function parseMacroplan(source: string): RawPlan {
return { return {
title: data.title != null ? String(data.title) : 'Untitled Macroplan', title: data.title != null ? String(data.title) : 'Untitled Macroplan',
start: data.start != null ? toYmdOr('plan', 'start', data.start) : undefined,
end: data.end != null ? toYmdOr('plan', 'end', data.end) : undefined,
features, features,
milestones, milestones,
} }

View File

@@ -25,7 +25,11 @@ export function buildPlan(raw: RawPlan, today: Date | string = new Date()): Plan
}) })
// Range: earliest start to last marker/milestone (CONTEXT.md). Empty weeks drawn. // Range: earliest start to last marker/milestone (CONTEXT.md). Empty weeks drawn.
// Optional authored `start`/`end` widen this span with lead-in / trailing weeks;
// they only ever extend it — a Feature or marker outside them is never clipped.
const allWeeks: WeekId[] = [] const allWeeks: WeekId[] = []
if (raw.start != null) allWeeks.push(mondayOf(raw.start))
if (raw.end != null) allWeeks.push(mondayOf(raw.end))
for (const r of rows) { for (const r of rows) {
allWeeks.push(r.startWeek, r.barEndWeek) allWeeks.push(r.startWeek, r.barEndWeek)
for (const mk of r.markers) allWeeks.push(mk.week) for (const mk of r.markers) allWeeks.push(mk.week)

View File

@@ -23,6 +23,8 @@ export interface RawMilestone {
export interface RawPlan { export interface RawPlan {
title: string title: string
start?: string // yyyy-mm-dd — optional authored left edge of the plan's span
end?: string // yyyy-mm-dd — optional authored right edge of the plan's span
features: RawFeature[] features: RawFeature[]
milestones: RawMilestone[] milestones: RawMilestone[]
} }