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:
@@ -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,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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[]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user