The model is the one source for everything that the tool shows. It knows each node, its place in each tree, its tasks, and its progress.
How it works
src/model.js buildModel works in steps:
- Make a node for each file with an
id, and for the root. - Read each parent path. Make virtual nodes for groups and for ids inside longer paths. Report paths that do not agree.
- Find cycles.
- Calculate the state of each task and node.
- Calculate rollups as sets of tasks, so a task counts one time even when two routes reach it.
- Check links, and record which nodes link to which.
toJSON writes the model in the format of section 12 of the Specification.
Why it works this way
Rollups use sets, not sums. In trees other than the primary tree, a node can have two parents. With sums, a task under both parents would count two times at the top.
Tasks
- Make virtual nodes from paths and groups
- Report path mismatches, cycles, and missing parents
- Calculate rollups as sets