Retained files
When you switch chapters, source files in the learning folder are replaced by that chapter’s snapshot. The snapshot is copied in place, then paths that are not in the snapshot are deleted. The two chapters are not merged.
retain in course.jsonc lists .gitignore-style patterns. Matching uses the same rules as .gitignore, evaluated from the learning folder root:
node_moduleskeeps everynode_modulesdirectory anywhere in the tree/node_moduleskeeps only the rootnode_modulesnode_modules/matches directories only*.logmatches that suffix in any directory!important.txtun-ignores a path (gitignore negation)
When retain is omitted, node_modules is kept. An explicit [] keeps no extra project paths.
The learning copy at .learn/course/course.jsonc also adds .git, .learn, .gitignore, and *.code-workspace. Do not add those yourself.
The workspace .gitignore still tells git what not to commit. It does not decide which files stay when you switch chapters — that is only retain.
Notes
- Files that are in the snapshot are still overwritten, even when a
retainpattern matches them. - A gitignored folder such as
dist/is deleted unless aretainpattern matches it.