lens-content-processor 0.95.0 → 0.97.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,117 @@
1
+ import type { ContentError, QuestionSegment } from "./index.js";
2
+ import type { ContentFiles } from "./engine/reader.js";
3
+ export declare const IDEAS_DIR = "Context Accelerator LOs";
4
+ /** A file of the ideas folder, `_Template.md` and other `_` files included. */
5
+ export declare function isIdeasFolderPath(path: string): boolean;
6
+ /** A file that is one idea: in the folder, and its name does not start with `_`. */
7
+ export declare function isIdeaPath(path: string): boolean;
8
+ export type IdeaPriority = "high" | "medium" | "low";
9
+ /** A wikilink to another idea, in `Requires` or `Helpful first`. */
10
+ export interface IdeaLink {
11
+ /** The target's file path, `.md` included. */
12
+ path: string;
13
+ line: number;
14
+ }
15
+ /** A wikilink to a lens in `Lenses`, or to a course in `courses`. */
16
+ export interface IdeaFileLink {
17
+ /** The link as written, brackets included. */
18
+ raw: string;
19
+ /** The target's path as resolved from the idea file, extension unknown. */
20
+ path: string;
21
+ display?: string;
22
+ line: number;
23
+ }
24
+ /** One idea file as parsed, before its links to other files are checked. */
25
+ export interface ParsedIdea {
26
+ file: string;
27
+ name: string;
28
+ slug: string;
29
+ id?: string;
30
+ priority: IdeaPriority;
31
+ courseLinks: IdeaFileLink[];
32
+ /** What a learner can do once they have the idea. */
33
+ outcome: string;
34
+ requires: IdeaLink[];
35
+ helpfulFirst: IdeaLink[];
36
+ whyItMatters: string;
37
+ framingVideo: FramingVideo | null;
38
+ /** The `Lenses` lines as written. */
39
+ learn: string;
40
+ learnLinks: IdeaFileLink[];
41
+ questions: QuestionSegment[];
42
+ /** The creator's own time for the idea (`duration_minutes`, or
43
+ * `reading_minutes`/`tutor_minutes`), as on a lens. */
44
+ durationMinutes?: number;
45
+ readingMinutes?: number;
46
+ tutorMinutes?: number;
47
+ }
48
+ /** An idea whose lens and course links are resolved. */
49
+ export interface ResolvedIdea extends Omit<ParsedIdea, "courseLinks" | "learnLinks"> {
50
+ /** The course files the idea lists. */
51
+ courseFiles: string[];
52
+ }
53
+ /** A short video of a team member saying, unscripted, why the idea matters:
54
+ * a YouTube link alone on a line under `## Why it matters`. A `/shorts/` link
55
+ * plays portrait. */
56
+ export interface FramingVideo {
57
+ videoId: string;
58
+ isShort: boolean;
59
+ }
60
+ /** Split the framing video's line out of the `Why it matters` text. */
61
+ export declare function splitWhyItMatters(text: string): {
62
+ whyItMatters: string;
63
+ framingVideo: FramingVideo | null;
64
+ };
65
+ export interface ConceptMapIdea {
66
+ id: string;
67
+ slug: string;
68
+ name: string;
69
+ file: string;
70
+ priority: IdeaPriority;
71
+ /** The slugs of the courses the idea lists under `courses`. */
72
+ courses: string[];
73
+ outcome: string;
74
+ /** Slugs of ideas, or of placeholders (not written yet). */
75
+ requires: string[];
76
+ helpfulFirst: string[];
77
+ whyItMatters: string;
78
+ framingVideo: FramingVideo | null;
79
+ /** Markdown; each lens link is a link to the lens's page (`/lens/<slug>`). */
80
+ learn: string;
81
+ questions: QuestionSegment[];
82
+ }
83
+ export interface ConceptMap {
84
+ ideas: ConceptMapIdea[];
85
+ /** Ideas that are named as a requirement and have no file yet. */
86
+ placeholders: {
87
+ slug: string;
88
+ name: string;
89
+ }[];
90
+ }
91
+ /**
92
+ * Parse one idea file. The text is the published text: pending CriticMarkup
93
+ * suggestions are rejected and `%% comments %%` are removed, as for every
94
+ * other content file (authoring-markup.ts).
95
+ */
96
+ export declare function parseIdea(content: string, file: string): {
97
+ idea: ParsedIdea | null;
98
+ errors: ContentError[];
99
+ };
100
+ /**
101
+ * Check an idea's links to other files: each `Lenses` link must name a lens
102
+ * that exists, each `courses` entry a file that exists. The `Lenses` lines
103
+ * come back with every lens link turned into a Markdown link to the lens's
104
+ * page.
105
+ */
106
+ export declare function resolveIdeaLinks(idea: ParsedIdea, files: ContentFiles): {
107
+ idea: ResolvedIdea;
108
+ errors: ContentError[];
109
+ };
110
+ /**
111
+ * Join every idea into the concept map. `courseSlugByFile` maps a course
112
+ * file to its course's slug.
113
+ */
114
+ export declare function buildConceptMap(resolved: Iterable<ResolvedIdea>, courseSlugByFile: ReadonlyMap<string, string>): {
115
+ conceptMap: ConceptMap;
116
+ errors: ContentError[];
117
+ };
@@ -0,0 +1,514 @@
1
+ // src/concept-map.ts
2
+ //
3
+ // The concept map: the ideas of `Context Accelerator LOs/`, one Markdown file
4
+ // per idea, and the requirement links between them. `parseIdea` reads one
5
+ // file; `resolveIdeaLinks` checks its links to lenses and courses against the
6
+ // other files; `buildConceptMap` joins every idea into the map the backend
7
+ // serves (/api/concept-map).
8
+ //
9
+ // This is not `Concepts/` (src/concepts.ts), which holds one file per term of
10
+ // the skill tree.
11
+ import { stripAuthoringMarkup, stripAuthoringMarkupForValidation, usePublishedStrings, } from "./authoring-markup.js";
12
+ import { componentOf } from "./concepts.js";
13
+ import { fileStem } from "./dropped.js";
14
+ import { makeFenceTracker } from "./parser/code-fence.js";
15
+ import { parseFrontmatter } from "./parser/frontmatter.js";
16
+ import { parseLensTimeFields } from "./parser/lens.js";
17
+ import { convertSegment, validateRawSegment, } from "./parser/lens.js";
18
+ import { toFlattenedResponseSegment } from "./parser/response-segments.js";
19
+ import { LENS_SEGMENT_TYPES, parseSegments } from "./parser/sections.js";
20
+ import { findFileWithExtension, findSimilarFiles, findWikilinks, formatSuggestion, parseWikilink, resolveWikilinkPath, } from "./parser/wikilink.js";
21
+ import { extractVideoFromUrl } from "./utils/youtube.js";
22
+ import { fileNameToSlug } from "./utils/slug.js";
23
+ import { isValidUuid } from "./validator/uuid.js";
24
+ export const IDEAS_DIR = "Context Accelerator LOs";
25
+ /** A file of the ideas folder, `_Template.md` and other `_` files included. */
26
+ export function isIdeasFolderPath(path) {
27
+ return path.startsWith(IDEAS_DIR + "/") && path.endsWith(".md");
28
+ }
29
+ /** A file that is one idea: in the folder, and its name does not start with `_`. */
30
+ export function isIdeaPath(path) {
31
+ return isIdeasFolderPath(path) && !fileStem(path).startsWith("_");
32
+ }
33
+ const PRIORITIES = ["high", "medium", "low"];
34
+ /** Split the framing video's line out of the `Why it matters` text. */
35
+ export function splitWhyItMatters(text) {
36
+ const lines = text.split("\n");
37
+ const i = lines.findIndex((line) => /^\s*https?:\/\/\S+\s*$/.test(line) && extractVideoFromUrl(line));
38
+ if (i < 0)
39
+ return { whyItMatters: text, framingVideo: null };
40
+ const framingVideo = extractVideoFromUrl(lines[i]);
41
+ lines.splice(i, 1);
42
+ return { whyItMatters: lines.join("\n").trim(), framingVideo };
43
+ }
44
+ const SECTION_NAMES = [
45
+ "requires",
46
+ "helpful first",
47
+ "why it matters",
48
+ "lenses",
49
+ "tests",
50
+ ];
51
+ /**
52
+ * Split an idea's body at its `## ` headings. Lines inside a code fence are
53
+ * text; a fence that never closes would swallow every heading after it, so
54
+ * it is reported (as parseSections does).
55
+ */
56
+ function splitBody(body, bodyStartLine, file, errors) {
57
+ const sections = new Map();
58
+ const outcome = [];
59
+ let current = null;
60
+ const fence = makeFenceTracker();
61
+ let fenceOpenedAt = 0;
62
+ let fenceInTests = false;
63
+ body.split("\n").forEach((line, index) => {
64
+ const lineNumber = bodyStartLine + index;
65
+ if (fence.step(line) && fence.inside) {
66
+ fenceOpenedAt = lineNumber;
67
+ fenceInTests = current?.name === "tests";
68
+ }
69
+ const heading = fence.inside ? null : /^##[ \t]+(.+?)[ \t]*$/.exec(line);
70
+ if (!heading) {
71
+ (current ? current.lines : outcome).push(line);
72
+ return;
73
+ }
74
+ const name = heading[1].replace(/:$/, "").trim().toLowerCase();
75
+ if (!SECTION_NAMES.includes(name)) {
76
+ errors.push({
77
+ file,
78
+ line: lineNumber,
79
+ message: `Unknown section '## ${heading[1]}' in an idea file`,
80
+ suggestion: "The sections are: Requires, Helpful first, Why it matters, Lenses, Tests. This section is ignored",
81
+ severity: "warning",
82
+ });
83
+ current = { name: null, lines: [] };
84
+ return;
85
+ }
86
+ const known = name;
87
+ if (sections.has(known)) {
88
+ errors.push({
89
+ file,
90
+ line: lineNumber,
91
+ message: `Section '## ${heading[1]}' is in this idea file twice`,
92
+ suggestion: "Merge the two sections. The second one is ignored",
93
+ severity: "warning",
94
+ });
95
+ current = { name: null, lines: [] };
96
+ return;
97
+ }
98
+ current = { name: known, lines: [] };
99
+ const lines = current.lines;
100
+ sections.set(known, {
101
+ get text() {
102
+ return lines.join("\n");
103
+ },
104
+ line: lineNumber,
105
+ });
106
+ });
107
+ // One left open in the Tests section is reported where its questions are
108
+ // parsed (parseQuestions), not twice.
109
+ if (fence.inside && !fenceInTests) {
110
+ errors.push({
111
+ file,
112
+ line: fenceOpenedAt,
113
+ message: "Code fence is never closed: every heading after it is read as code",
114
+ suggestion: "Close the fence with a matching ``` line, or remove it",
115
+ severity: "error",
116
+ });
117
+ }
118
+ return { outcome: outcome.join("\n").trim(), sections };
119
+ }
120
+ /** Every wikilink of a section, with the line it is on. */
121
+ function sectionLinks(section, file, errors) {
122
+ if (!section)
123
+ return [];
124
+ const links = [];
125
+ section.text.split("\n").forEach((text, index) => {
126
+ const line = section.line + 1 + index;
127
+ for (const { raw } of findWikilinks(text)) {
128
+ const parts = parseWikilink(raw, file);
129
+ if (!parts || parts.error || !parts.path) {
130
+ errors.push({
131
+ file,
132
+ line,
133
+ message: `Invalid wikilink: ${raw}`,
134
+ suggestion: parts?.error ?? "Write the link as [[Name]] or [[Name|words]]",
135
+ severity: "error",
136
+ });
137
+ continue;
138
+ }
139
+ links.push({
140
+ raw,
141
+ path: resolveWikilinkPath(parts.path, file),
142
+ ...(parts.display ? { display: parts.display } : {}),
143
+ line,
144
+ });
145
+ }
146
+ });
147
+ return links;
148
+ }
149
+ function ideaLinks(links) {
150
+ const seen = new Set();
151
+ const result = [];
152
+ for (const link of links) {
153
+ const path = /\.md$/i.test(link.path) ? link.path : link.path + ".md";
154
+ if (seen.has(path))
155
+ continue;
156
+ seen.add(path);
157
+ result.push({ path, line: link.line });
158
+ }
159
+ return result;
160
+ }
161
+ function parseQuestions(section, file, errors) {
162
+ if (!section)
163
+ return [];
164
+ const { segments, errors: segmentErrors } = parseSegments(section.text, 2, LENS_SEGMENT_TYPES, file, section.line);
165
+ errors.push(...segmentErrors);
166
+ const questions = [];
167
+ for (const raw of segments) {
168
+ if (raw.type !== "question") {
169
+ errors.push({
170
+ file,
171
+ line: raw.line,
172
+ message: `'#### ${raw.rawType}' is not a question: the Tests section of an idea holds questions only`,
173
+ suggestion: "Use '#### Question: Open', 'Choice', 'FillBlank' or 'Ranking'. This segment is ignored",
174
+ severity: "warning",
175
+ });
176
+ continue;
177
+ }
178
+ if (!raw.title) {
179
+ errors.push({
180
+ file,
181
+ line: raw.line,
182
+ message: "A bare '#### Question' is not allowed in an idea file: the question needs a type",
183
+ suggestion: "Write '#### Question: Open', 'Choice', 'FillBlank' or 'Ranking'",
184
+ severity: "error",
185
+ });
186
+ continue;
187
+ }
188
+ errors.push(...validateRawSegment(raw, file));
189
+ const converted = convertSegment(raw, "lens", file);
190
+ errors.push(...converted.errors);
191
+ if (converted.segment?.type === "question") {
192
+ questions.push(toFlattenedResponseSegment(converted.segment));
193
+ }
194
+ }
195
+ return questions;
196
+ }
197
+ function parsePrepared(source, file) {
198
+ const errors = [];
199
+ const { frontmatter, body, bodyStartLine, error } = parseFrontmatter(source, file);
200
+ if (error)
201
+ return { idea: null, errors: [error] };
202
+ // An id that is no UUID counts as missing: the backend stores progress
203
+ // under it as a UUID.
204
+ const rawId = typeof frontmatter.id === "string" ? frontmatter.id.trim() : "";
205
+ const id = isValidUuid(rawId) ? rawId.toLowerCase() : undefined;
206
+ if (!id) {
207
+ errors.push({
208
+ file,
209
+ line: 2,
210
+ message: "Idea file has no 'id' in its frontmatter",
211
+ suggestion: "Add 'id: <a new UUID>'. A learner's progress is stored under it, so the idea is left out of the concept map until it has one",
212
+ severity: "error",
213
+ });
214
+ }
215
+ let priority = "medium";
216
+ const rawPriority = typeof frontmatter.priority === "string"
217
+ ? frontmatter.priority.trim().toLowerCase()
218
+ : frontmatter.priority;
219
+ if (typeof rawPriority === "string" && PRIORITIES.includes(rawPriority)) {
220
+ priority = rawPriority;
221
+ }
222
+ else {
223
+ errors.push({
224
+ file,
225
+ line: 2,
226
+ message: rawPriority === undefined || rawPriority === null
227
+ ? "Idea file has no 'priority' in its frontmatter"
228
+ : `Idea priority '${String(rawPriority)}' is not high, medium or low`,
229
+ suggestion: "Write 'priority: high', 'medium' or 'low'. The idea counts as medium until then",
230
+ severity: "warning",
231
+ });
232
+ }
233
+ const courseLinks = [];
234
+ const rawCourses = frontmatter.courses ?? [];
235
+ const courseValues = Array.isArray(rawCourses) ? rawCourses : [rawCourses];
236
+ for (const value of courseValues) {
237
+ const parts = typeof value === "string" ? parseWikilink(value.trim(), file) : null;
238
+ if (!parts || parts.error || !parts.path) {
239
+ errors.push({
240
+ file,
241
+ line: 2,
242
+ message: `'courses' entry is not a wikilink to a course file: ${String(value)}`,
243
+ suggestion: 'Write each entry as "[[../courses/<folder>/<Course file>]]"',
244
+ severity: "error",
245
+ });
246
+ continue;
247
+ }
248
+ courseLinks.push({
249
+ raw: String(value).trim(),
250
+ path: resolveWikilinkPath(parts.path, file),
251
+ line: 2,
252
+ });
253
+ }
254
+ const { outcome, sections } = splitBody(body, bodyStartLine, file, errors);
255
+ if (!outcome) {
256
+ errors.push({
257
+ file,
258
+ line: bodyStartLine,
259
+ message: "Idea file has no outcome sentence",
260
+ suggestion: "Write what a learner can do, between the frontmatter and the first '## ' heading",
261
+ severity: "warning",
262
+ });
263
+ }
264
+ const learn = sections.get("lenses");
265
+ return {
266
+ idea: {
267
+ file,
268
+ name: fileStem(file),
269
+ slug: fileNameToSlug(file),
270
+ ...(id ? { id } : {}),
271
+ priority,
272
+ courseLinks,
273
+ outcome,
274
+ requires: ideaLinks(sectionLinks(sections.get("requires"), file, errors)),
275
+ helpfulFirst: ideaLinks(sectionLinks(sections.get("helpful first"), file, errors)),
276
+ ...splitWhyItMatters((sections.get("why it matters")?.text ?? "").trim()),
277
+ learn: (learn?.text ?? "").trim(),
278
+ learnLinks: sectionLinks(learn, file, errors),
279
+ questions: parseQuestions(sections.get("tests"), file, errors),
280
+ ...parseLensTimeFields((field) => frontmatter[field], file, 2, errors),
281
+ },
282
+ errors,
283
+ };
284
+ }
285
+ /**
286
+ * Parse one idea file. The text is the published text: pending CriticMarkup
287
+ * suggestions are rejected and `%% comments %%` are removed, as for every
288
+ * other content file (authoring-markup.ts).
289
+ */
290
+ export function parseIdea(content, file) {
291
+ const validationSource = stripAuthoringMarkupForValidation(content);
292
+ const result = parsePrepared(validationSource, file);
293
+ const publishedSource = stripAuthoringMarkup(content);
294
+ if (publishedSource === validationSource)
295
+ return result;
296
+ const published = parsePrepared(publishedSource, file);
297
+ if (!published.idea)
298
+ return result;
299
+ if (!result.idea)
300
+ return published;
301
+ return usePublishedStrings(result.idea, published.idea) ? result : published;
302
+ }
303
+ /** The title a lens link shows when it has no alias. */
304
+ function lensTitle(lensPath, files) {
305
+ const { frontmatter } = parseFrontmatter(files.get(lensPath) ?? "", lensPath);
306
+ const title = frontmatter.title;
307
+ return typeof title === "string" && title.trim()
308
+ ? title.trim()
309
+ : fileStem(lensPath);
310
+ }
311
+ /** Text safe inside the square brackets of a Markdown link. */
312
+ function linkText(text) {
313
+ return text.replace(/([\\[\]])/g, "\\$1");
314
+ }
315
+ /**
316
+ * Check an idea's links to other files: each `Lenses` link must name a lens
317
+ * that exists, each `courses` entry a file that exists. The `Lenses` lines
318
+ * come back with every lens link turned into a Markdown link to the lens's
319
+ * page.
320
+ */
321
+ export function resolveIdeaLinks(idea, files) {
322
+ const errors = [];
323
+ const { courseLinks, learnLinks, ...rest } = idea;
324
+ let learn = idea.learn;
325
+ for (const link of learnLinks) {
326
+ const lensPath = findFileWithExtension(link.path, files);
327
+ const isLens = lensPath !== null &&
328
+ (lensPath.startsWith("Lenses/") || lensPath.includes("/Lenses/"));
329
+ if (!lensPath || !isLens) {
330
+ errors.push({
331
+ file: idea.file,
332
+ line: link.line,
333
+ message: lensPath
334
+ ? `Lenses link is not to a lens: ${link.raw}`
335
+ : `Lenses link to a lens that does not exist: ${link.raw}`,
336
+ suggestion: (lensPath
337
+ ? null
338
+ : formatSuggestion(findSimilarFiles(link.path, files, "Lenses"), idea.file)) ??
339
+ "Link a file of the Lenses folder: [[../Lenses/<Lens name>]]",
340
+ severity: "error",
341
+ });
342
+ // The words stay; the link is gone.
343
+ learn = learn.split(link.raw).join(link.display ?? fileStem(link.path));
344
+ continue;
345
+ }
346
+ const shown = link.display ?? lensTitle(lensPath, files);
347
+ learn = learn
348
+ .split(link.raw)
349
+ .join(`[${linkText(shown)}](/lens/${fileNameToSlug(lensPath)})`);
350
+ }
351
+ const courseFiles = [];
352
+ for (const link of courseLinks) {
353
+ const coursePath = findFileWithExtension(link.path, files);
354
+ if (!coursePath) {
355
+ errors.push({
356
+ file: idea.file,
357
+ line: link.line,
358
+ message: `'courses' names a file that does not exist: ${link.raw}`,
359
+ suggestion: formatSuggestion(findSimilarFiles(link.path, files, "courses"), idea.file) ?? "Link the course file: [[../courses/<folder>/<Course file>]]",
360
+ severity: "error",
361
+ });
362
+ continue;
363
+ }
364
+ if (!courseFiles.includes(coursePath))
365
+ courseFiles.push(coursePath);
366
+ }
367
+ return { idea: { ...rest, learn, courseFiles }, errors };
368
+ }
369
+ /** The ideas on a `Requires` cycle: every member of a strongly connected
370
+ * component of two or more ideas, or an idea that requires itself. */
371
+ function requirementCycles(requires) {
372
+ const written = (slug) => (requires.get(slug) ?? []).filter((target) => requires.has(target));
373
+ const seen = new Set();
374
+ const cycles = [];
375
+ for (const slug of requires.keys()) {
376
+ if (seen.has(slug))
377
+ continue;
378
+ const component = componentOf(slug, written);
379
+ for (const member of component)
380
+ seen.add(member);
381
+ if (component.size > 1 || written(slug).includes(slug)) {
382
+ cycles.push([...component].sort());
383
+ }
384
+ }
385
+ return cycles;
386
+ }
387
+ /**
388
+ * Join every idea into the concept map. `courseSlugByFile` maps a course
389
+ * file to its course's slug.
390
+ */
391
+ export function buildConceptMap(resolved, courseSlugByFile) {
392
+ const errors = [];
393
+ const sorted = [...resolved].sort((a, b) => (a.file < b.file ? -1 : 1));
394
+ const byFile = new Map();
395
+ const slugs = new Map();
396
+ const ids = new Set();
397
+ for (const idea of sorted) {
398
+ // No id: parseIdea reported it. A second use of an id: the UUID check
399
+ // reports it (validator/uuid.ts); the first file keeps the id.
400
+ if (!idea.id || ids.has(idea.id.toLowerCase()))
401
+ continue;
402
+ const taken = slugs.get(idea.slug);
403
+ if (taken) {
404
+ errors.push({
405
+ file: idea.file,
406
+ message: `Idea '${idea.name}' has the same web address as '${taken}' (${idea.slug})`,
407
+ suggestion: "Rename one of the two files so that their names differ in more than capitals and punctuation",
408
+ severity: "error",
409
+ });
410
+ continue;
411
+ }
412
+ ids.add(idea.id.toLowerCase());
413
+ slugs.set(idea.slug, idea.name);
414
+ byFile.set(idea.file, idea);
415
+ }
416
+ const placeholders = new Map();
417
+ const targetSlugs = (idea, links, section, warnUnwritten) => {
418
+ const result = [];
419
+ for (const link of links) {
420
+ const target = byFile.get(link.path);
421
+ if (target) {
422
+ if (!result.includes(target.slug))
423
+ result.push(target.slug);
424
+ continue;
425
+ }
426
+ if (!isIdeaPath(link.path)) {
427
+ errors.push({
428
+ file: idea.file,
429
+ line: link.line,
430
+ message: `'${section}' links a file that is not an idea: ${link.path}`,
431
+ suggestion: `Link ideas of '${IDEAS_DIR}/' by name: [[Name of the idea]]. This link is ignored`,
432
+ severity: "warning",
433
+ });
434
+ continue;
435
+ }
436
+ const name = fileStem(link.path);
437
+ const slug = fileNameToSlug(link.path);
438
+ // An idea left out above (no id, id or address taken) is not shown twice.
439
+ if (slugs.has(slug)) {
440
+ if (!result.includes(slug))
441
+ result.push(slug);
442
+ continue;
443
+ }
444
+ if (warnUnwritten) {
445
+ errors.push({
446
+ file: idea.file,
447
+ line: link.line,
448
+ message: `'${section}' names an idea that is not written yet: ${name}`,
449
+ suggestion: `The learning outcome's page shows '${name}' as not written yet until '${link.path}' exists`,
450
+ severity: "warning",
451
+ });
452
+ }
453
+ if (!placeholders.has(slug))
454
+ placeholders.set(slug, name);
455
+ if (!result.includes(slug))
456
+ result.push(slug);
457
+ }
458
+ return result;
459
+ };
460
+ const ideas = [...byFile.values()].map((idea) => {
461
+ const courses = [];
462
+ for (const file of idea.courseFiles) {
463
+ const slug = courseSlugByFile.get(file);
464
+ if (slug === undefined) {
465
+ errors.push({
466
+ file: idea.file,
467
+ line: 2,
468
+ message: `'courses' names a file that is not a course: ${file}`,
469
+ suggestion: "Link a course file that has no errors. The idea is not shown in this course until then",
470
+ severity: "warning",
471
+ });
472
+ }
473
+ else if (!courses.includes(slug)) {
474
+ courses.push(slug);
475
+ }
476
+ }
477
+ return {
478
+ id: idea.id,
479
+ slug: idea.slug,
480
+ name: idea.name,
481
+ file: idea.file,
482
+ priority: idea.priority,
483
+ courses,
484
+ outcome: idea.outcome,
485
+ requires: targetSlugs(idea, idea.requires, "Requires", true),
486
+ helpfulFirst: targetSlugs(idea, idea.helpfulFirst, "Helpful first", false),
487
+ whyItMatters: idea.whyItMatters,
488
+ framingVideo: idea.framingVideo,
489
+ learn: idea.learn,
490
+ questions: idea.questions,
491
+ };
492
+ });
493
+ const bySlug = new Map(ideas.map((idea) => [idea.slug, idea]));
494
+ const cycles = requirementCycles(new Map(ideas.map((idea) => [idea.slug, idea.requires])));
495
+ for (const cycle of cycles) {
496
+ const members = cycle.map((slug) => bySlug.get(slug));
497
+ errors.push({
498
+ file: members[0].file,
499
+ message: `Ideas require each other in a circle: ${members.map((m) => m.name).join(", ")}`,
500
+ suggestion: "Remove one 'Requires' link of the circle, or move it to 'Helpful first'. A circle gives no order to learn these ideas in",
501
+ severity: "error",
502
+ });
503
+ }
504
+ return {
505
+ conceptMap: {
506
+ ideas,
507
+ placeholders: [...placeholders]
508
+ .map(([slug, name]) => ({ slug, name }))
509
+ .sort((a, b) => (a.slug < b.slug ? -1 : 1)),
510
+ },
511
+ errors,
512
+ };
513
+ }
514
+ //# sourceMappingURL=concept-map.js.map
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CAAyC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACzF,UAAU,EACR,0HAA0H;YAC5H,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,UAAU,EAAE;YACV,KAAK;YACL,YAAY,EAAE,CAAC,GAAG,YAAY,CAAC;iBAC5B,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;iBACvC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAC9C;QACD,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -38,6 +38,9 @@ export declare function conceptStructure(body: string, bodyStartLine: number, pa
38
38
  /** A concept file's own checks: its frontmatter, its place in the concept
39
39
  * graph, and its rows. */
40
40
  export declare function checkConceptFile(content: string, path: string, files: ContentFiles): ContentError[];
41
+ /** The strongly connected component of `start` (Tarjan), reading only the
42
+ * files reachable from it. */
43
+ export declare function componentOf(start: string, parents: (p: string) => string[]): Set<string>;
41
44
  /** The `id` of a concept file, when it is a non-empty string: it joins the
42
45
  * vault-wide uuid checks. */
43
46
  export declare function conceptId(content: string, path: string): string | undefined;