Repository Public
1# Content manifest and import23> **Since Phase 4** the files below are the *snapshot shipped with the application*: the seed of the studio's database and what the public site serves until that database exists. Once the studio is in service, publication is decided there (immutable publications, see `INSTRUCTOR_STUDIO.md` and `ARCHITECTURE.md` §6), imports are made from the studio, and `content/publication.json` is no longer the editorial layer of the running site. The « How to… » table further down describes the snapshot workflow only.45## Files67| Path | Written by | Role |8|---|---|---|9| `content/course.manifest.json` | importer | Canonical manifest (`Manifest` schema). The site builds from it, with no access to the course repository. |10| `content/import/sessions/<id>/…` | importer | Imported sections: `quiz.json`, `glossary.json`, `figures.json` + `figures/*.svg`, `lab.md`, `script.md`, `bibliography.json`. |11| `content/import/report.json` | importer | Per-session status, warnings and the SHA-256 of every source file read. |12| `content/publication.json` | a human (later: the studio) | Editorial layer: publication state, visibility per section, slugs, licence, diagram visibility, redirects. **Never written by the importer.** |13| `content/paths.json` | a human | The four suggested learning paths (validated against prerequisites by tests). |14| `content/preview/overlay.json` | a human | Preview-only additions: the synthetic test capsule and the demonstration exercises. |1516Schemas: `src/modules/content-schema/schema.ts`. Example manifest: the committed `content/course.manifest.json` itself.1718## Import1920```bash21pnpm content:import --from /path/to/atlas-ai-mooc # or ATLAS_COURSE_REPO22pnpm content:import --from … --check # writes nothing; exit 1 if the snapshot is stale23```2425Adapter rules (`scripts/lib/importer.ts`, `src/modules/content-schema/adapter.ts`):2627- **Read-only** on the course repository. Nothing from it is executed, compiled or `import`ed: YAML is parsed with the core schema, BibTeX and Markdown tables with small readers.28- **Authority.** The course plan (`course.yaml`: titles, parts, levels, outcomes, prerequisites, tags) is imported for all sessions. A session's *material* is read only if its own `metadata.yaml` says `implemented` or `validated`. A missing, half-written or invalid `metadata.yaml` is a warning, not an error: other people may be writing that directory.29- **Path safety.** Every path is checked (`isSafeRelPath`), resolved inside the repository, and its real path re-checked, so `..` and symlinks pointing outside are refused. Reads are size-limited.30- **Solutions.** `labs/solution/` is never opened.31- **Figures.** Only SVG renders located inside the session directory, with a non-empty alt text, and passing `checkSvg` (no script, event handler, `foreignObject`, external reference or entity).32- **Quiz.** `choix-unique` → `single`, `vrai-faux` → `true-false` (also `choix-multiple`, `numérique` if they appear). Unknown types are skipped with a warning, never guessed.33- **Idempotent.** Same input → byte-identical output, no timestamps; a second run writes nothing. Stale files under `content/import/` are removed. Content hashes: per file, per session (`source.hash`), global (`import.sourceHash`).34- **Never publishes.** Defaults are `planned` (no material) or `draft` (material present) and every section `private`. Only `content/publication.json` can raise a state or a visibility; the report warns when it refers to something that was not imported.3536## Publication model3738States: `planned` · `draft` · `preview` · `published` · `archived`. Visibility of a section, capsule or resource: `private` · `preview` · `public`. Download: `download: true` + a licence (`publication.json` → `license`, or per resource) + not before `releaseAfter` (delayed release of solutions). The complete rule is `buildView` / `canSee` / `canDownload` in `publication.ts`; see `ARCHITECTURE.md` §3.3940### How to… (today, by editing `content/publication.json`, then rebuilding)4142| Task | Change |43|---|---|44| Show a session in preview | `"S02": { "publication": "preview", "sections": { "quiz": "preview", … } }` |45| **Publish a session** | `"publication": "published"` and each approved section `"public"`. Requires the instructor's review; nothing does this automatically. |46| Withdraw / roll back a publication | set the state back to `draft` (or `archived` to keep the URL with a notice), rebuild. Git history of `publication.json` is the audit trail until the studio exists. |47| Record the licence, enabling downloads | `"license": "CC BY-NC-SA 4.0"` (the owner's decision — not taken yet) |48| Rename a session URL | `"slug": "01-nouveau-slug", "aliases": ["01-ancien-slug"]` → permanent redirect from every alias |49| Add an arbitrary redirect | `"redirects": [{ "from": "/ancien", "to": "/nouveau" }]` |50| Publish a diagram | `"diagrams": { "tokenisation": "public" }` |51| Hide theme tags of unopened sessions | `"exposeTags": false` |5253Default slugs are derived from the course plan: two-digit number + slugified short title (`05-ingenierie-du-contexte`). The repository's English slug and `sNN` always redirect to it.5455### Adding a session5657Add it to the course repository's `course.yaml` (and its directory); run the import. The site needs no code change: routes, programme, map, search and sitemap are derived from the manifest. (The landing page's course map lays sessions out by part; very uneven parts would need a layout review.)5859## Interactive lessons (packs)6061Since the second request of 2026-11-22 a session can carry a `lesson` section (schema `Lesson` in `schema.ts`), built by `pnpm lessons:build` into a pack `SXX-lesson.json` (schema `LessonPack`: lesson + quiz + glossary + lab instructions + the SHA-256 of every source file read + a hash of the whole) and installed by `pnpm studio lessons-import`. Questions of the quiz format now carry `slides` (the course's `slides:` field, well-formed identifiers only). The committed snapshot under `content/` was **not** re-imported: it still holds the quizzes of S01–S08 without slide references; they are replaced in the studio by the packs. Commands, guarantees and what is never read: `INSTRUCTOR_STUDIO.md`, « Interactive lesson of a session ».6263## Not implemented6465Videos and downloadable resources are not imported from the course repository (none exist): they are uploaded in the studio. Manifest diff, conflict handling and scheduled publication exist in the studio (Phase 4).66