@tobisk/codesafari 1.0.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.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +215 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.js +78 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/export.d.ts +16 -0
  7. package/dist/commands/export.js +68 -0
  8. package/dist/commands/export.js.map +1 -0
  9. package/dist/commands/paths.d.ts +7 -0
  10. package/dist/commands/paths.js +25 -0
  11. package/dist/commands/paths.js.map +1 -0
  12. package/dist/commands/validate.d.ts +8 -0
  13. package/dist/commands/validate.js +51 -0
  14. package/dist/commands/validate.js.map +1 -0
  15. package/dist/content/frontmatter.d.ts +15 -0
  16. package/dist/content/frontmatter.js +35 -0
  17. package/dist/content/frontmatter.js.map +1 -0
  18. package/dist/content/loadContent.d.ts +20 -0
  19. package/dist/content/loadContent.js +188 -0
  20. package/dist/content/loadContent.js.map +1 -0
  21. package/dist/content/walk.d.ts +12 -0
  22. package/dist/content/walk.js +34 -0
  23. package/dist/content/walk.js.map +1 -0
  24. package/dist/ignore/ignore.d.ts +21 -0
  25. package/dist/ignore/ignore.js +60 -0
  26. package/dist/ignore/ignore.js.map +1 -0
  27. package/dist/index.d.ts +9 -0
  28. package/dist/index.js +9 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/manifest/build.d.ts +21 -0
  31. package/dist/manifest/build.js +316 -0
  32. package/dist/manifest/build.js.map +1 -0
  33. package/dist/model/types.d.ts +178 -0
  34. package/dist/model/types.js +11 -0
  35. package/dist/model/types.js.map +1 -0
  36. package/dist/parser/comments.d.ts +43 -0
  37. package/dist/parser/comments.js +215 -0
  38. package/dist/parser/comments.js.map +1 -0
  39. package/dist/parser/ordering.d.ts +19 -0
  40. package/dist/parser/ordering.js +52 -0
  41. package/dist/parser/ordering.js.map +1 -0
  42. package/dist/parser/resolveTarget.d.ts +34 -0
  43. package/dist/parser/resolveTarget.js +155 -0
  44. package/dist/parser/resolveTarget.js.map +1 -0
  45. package/dist/server/devServer.d.ts +10 -0
  46. package/dist/server/devServer.js +170 -0
  47. package/dist/server/devServer.js.map +1 -0
  48. package/package.json +95 -0
  49. package/viewer-dist/assets/abnfDiagram-VRR7QNED-D3fx4JHm.js +1 -0
  50. package/viewer-dist/assets/arc-CDTQlIOl.js +1 -0
  51. package/viewer-dist/assets/architectureDiagram-ZJ3FMSHR-Bc-C9AOz.js +36 -0
  52. package/viewer-dist/assets/blockDiagram-677ZJIJ3-ZChUq7oC.js +132 -0
  53. package/viewer-dist/assets/c4Diagram-LMCZKHZV-Bh84Wvzw.js +10 -0
  54. package/viewer-dist/assets/channel-c5yLhzg_.js +1 -0
  55. package/viewer-dist/assets/chunk-2Q5K7J3B-BL2GPise.js +1 -0
  56. package/viewer-dist/assets/chunk-32BRIVSS-C8J4_0PY.js +1 -0
  57. package/viewer-dist/assets/chunk-5VM5RSS4-BEPuob2j.js +15 -0
  58. package/viewer-dist/assets/chunk-EX3LRPZG-C8dshNGY.js +231 -0
  59. package/viewer-dist/assets/chunk-JWPE2WC7-DB3UPcb9.js +1 -0
  60. package/viewer-dist/assets/chunk-MOJQB5TN-CoW82BtI.js +88 -0
  61. package/viewer-dist/assets/chunk-RYQCIY6F-BSkOviuC.js +1 -0
  62. package/viewer-dist/assets/chunk-V7JOEXUC-C3uhoOMH.js +206 -0
  63. package/viewer-dist/assets/chunk-VR4S4FIN-IAlLBWOE.js +1 -0
  64. package/viewer-dist/assets/chunk-XXDRQBXY-BZ2dkDjb.js +1 -0
  65. package/viewer-dist/assets/classDiagram-OUVF2IWQ-t57CRPeZ.js +1 -0
  66. package/viewer-dist/assets/classDiagram-v2-EOCWNBFH-t57CRPeZ.js +1 -0
  67. package/viewer-dist/assets/cose-bilkent-JH36ORCC-qThT2S0A.js +1 -0
  68. package/viewer-dist/assets/cynefin-VYW2F7L2-DMuuSzID.js +178 -0
  69. package/viewer-dist/assets/cynefinDiagram-TSTJHNR4-58B-tzsV.js +62 -0
  70. package/viewer-dist/assets/cytoscape.esm-CUqq0XTU.js +331 -0
  71. package/viewer-dist/assets/dagre-VKFMJZFB-DD2dvjEA.js +4 -0
  72. package/viewer-dist/assets/defaultLocale-DX6XiGOO.js +1 -0
  73. package/viewer-dist/assets/diagram-FQU43EPY-BwhXWJOe.js +3 -0
  74. package/viewer-dist/assets/diagram-G47NLZAW-Bvw3coaF.js +24 -0
  75. package/viewer-dist/assets/diagram-NH7WQ7WH-Cug3_TDj.js +24 -0
  76. package/viewer-dist/assets/diagram-OA4YK3LP-COuB13FS.js +30 -0
  77. package/viewer-dist/assets/diagram-WEI45ONY-Cs9bIVJ-.js +41 -0
  78. package/viewer-dist/assets/ebnfDiagram-CCIWWBDH-DNxW5fFn.js +1 -0
  79. package/viewer-dist/assets/erDiagram-Q63AITRT-CoxCZQYq.js +85 -0
  80. package/viewer-dist/assets/flowDiagram-23GEKE2U-DDOkOM11.js +156 -0
  81. package/viewer-dist/assets/ganttDiagram-NO4QXBWP-BMIv-Vup.js +292 -0
  82. package/viewer-dist/assets/gitGraphDiagram-IHSO6WYX-CaYRI7Ti.js +106 -0
  83. package/viewer-dist/assets/graph-C2PyVmSI.js +1 -0
  84. package/viewer-dist/assets/index-DPa56qLF.js +430 -0
  85. package/viewer-dist/assets/index-sJB3TFqL.css +1 -0
  86. package/viewer-dist/assets/infoDiagram-FWYZ7A6U-CG1-XeBO.js +2 -0
  87. package/viewer-dist/assets/init-Gi6I4Gst.js +1 -0
  88. package/viewer-dist/assets/ishikawaDiagram-FXEZZL3T-BAaIgDfG.js +70 -0
  89. package/viewer-dist/assets/journeyDiagram-5HDEW3XC-oPpLTcMj.js +139 -0
  90. package/viewer-dist/assets/kanban-definition-HUTT4EX6-wplcQi9I.js +89 -0
  91. package/viewer-dist/assets/katex-C5jXJg4s.js +257 -0
  92. package/viewer-dist/assets/layout-HEHzrzvT.js +1 -0
  93. package/viewer-dist/assets/linear-3o0ZqjSV.js +1 -0
  94. package/viewer-dist/assets/map-BQHxRNoK.js +1 -0
  95. package/viewer-dist/assets/mindmap-definition-LN4V7U3C-FkdX9xoS.js +96 -0
  96. package/viewer-dist/assets/ordinal-Cboi1Yqb.js +1 -0
  97. package/viewer-dist/assets/pegDiagram-2B236MQR-UcxUgXaX.js +1 -0
  98. package/viewer-dist/assets/pieDiagram-ENE6RG2P-BEujiO1u.js +39 -0
  99. package/viewer-dist/assets/quadrantDiagram-ABIIQ3AL-BsWx4RNa.js +7 -0
  100. package/viewer-dist/assets/railroadDiagram-RFXS5EU6-CaiR8155.js +1 -0
  101. package/viewer-dist/assets/requirementDiagram-TGXJPOKE-B7WepZjB.js +84 -0
  102. package/viewer-dist/assets/sankeyDiagram-HTMAVEWB-D2ys-GcR.js +40 -0
  103. package/viewer-dist/assets/sequenceDiagram-DBY2YBRQ-BCx5Lqm4.js +162 -0
  104. package/viewer-dist/assets/sizeCapture-X5ZJPWSS-CdyWDUKU.js +1 -0
  105. package/viewer-dist/assets/stateDiagram-2N3HPSRC-CKjHd02p.js +1 -0
  106. package/viewer-dist/assets/stateDiagram-v2-6OUMAXLB-oQDdTlVJ.js +1 -0
  107. package/viewer-dist/assets/swimlanes-5IMT3BWC-wE7K0Eo8.js +2 -0
  108. package/viewer-dist/assets/swimlanesDiagram-G3AALYLV-Axc7yQiy.js +8 -0
  109. package/viewer-dist/assets/timeline-definition-FHXFAJF6-B9iZKy9Y.js +120 -0
  110. package/viewer-dist/assets/vennDiagram-L72KCM5P-CIMukQYN.js +34 -0
  111. package/viewer-dist/assets/wardleyDiagram-EHGQE667-JZnnBRHP.js +78 -0
  112. package/viewer-dist/assets/xychartDiagram-FW5EYKEG-BphHZiLL.js +7 -0
  113. package/viewer-dist/index.html +15 -0
@@ -0,0 +1,316 @@
1
+ /**
2
+ * Assemble a {@link Manifest} from authored content and inline source comments.
3
+ *
4
+ * Pipeline:
5
+ * 1. Load `.tour/` content (project, components, tours, glossary).
6
+ * 2. Walk included source files and scan them for `@tour` comments.
7
+ * 3. Resolve each step's highlight range and attach steps to their tours.
8
+ * 4. Collect non-step callouts.
9
+ * 5. Validate cross-references (tour slugs, component links, glossary links).
10
+ * 6. Optionally bundle source-file content for offline export.
11
+ */
12
+ import { promises as fs } from 'node:fs';
13
+ import path from 'node:path';
14
+ import { MANIFEST_VERSION } from '../model/types.js';
15
+ import { IgnoreMatcher } from '../ignore/ignore.js';
16
+ import { collect, walk } from '../content/walk.js';
17
+ import { loadContent } from '../content/loadContent.js';
18
+ import { scanComments } from '../parser/comments.js';
19
+ import { languageForPath, resolveTarget, } from '../parser/resolveTarget.js';
20
+ import { sortByOrder } from '../parser/ordering.js';
21
+ /** File extensions scanned for inline `@tour` comments in v1. */
22
+ const SOURCE_EXTENSIONS = new Set([
23
+ '.ts',
24
+ '.tsx',
25
+ '.mts',
26
+ '.cts',
27
+ '.js',
28
+ '.jsx',
29
+ '.rs',
30
+ '.py',
31
+ ]);
32
+ const rel = (root, abs) => path.relative(root, abs).split(path.sep).join('/');
33
+ // @tour pipeline:3 Assembling the manifest
34
+ // The orchestrator. In order: load `.tour/` content, walk the non-ignored
35
+ // source files, scan each for `@tour` comments, resolve every step's highlight
36
+ // range, sort steps, validate cross-references, and (for export) bundle source.
37
+ // The next few steps zoom into the pieces this function calls.
38
+ export async function buildManifest(root, options = {}) {
39
+ const content = await loadContent(root);
40
+ const diagnostics = [...content.diagnostics];
41
+ const ignore = await IgnoreMatcher.load(root);
42
+ // 1. Seed one empty tour per authored tour file, keyed by slug.
43
+ const tourBySlug = new Map();
44
+ for (const base of content.tours) {
45
+ tourBySlug.set(base.slug, { ...base, steps: [] });
46
+ }
47
+ // 2–3. Scan source comments: attach steps to tours, collect callouts + details.
48
+ const scan = await scanSources(root, ignore, tourBySlug, content.project.defaultSnippetLines, diagnostics);
49
+ // 4. Nest each detail under its enclosing step, sort/validate tours, then
50
+ // scope each callout to the step section it falls under.
51
+ const tours = [...tourBySlug.values()];
52
+ assignDetails(scan.pendingDetails, tours, diagnostics);
53
+ finalizeTours(tours, diagnostics);
54
+ scopeCallouts(scan.callouts, tours);
55
+ // 5. Validate cross-references.
56
+ validateReferences(content, tours, diagnostics);
57
+ // 6. Bundle source content when exporting.
58
+ const files = options.bundleSources
59
+ ? await bundleSources(root, scan.allSourceFiles, diagnostics)
60
+ : [];
61
+ const manifest = {
62
+ version: MANIFEST_VERSION,
63
+ project: content.project,
64
+ components: content.components,
65
+ tours,
66
+ glossary: content.glossary,
67
+ callouts: scan.callouts,
68
+ examples: [],
69
+ files,
70
+ diagrams: [],
71
+ };
72
+ return { manifest, diagnostics };
73
+ }
74
+ /**
75
+ * Walk the non-ignored source files, scan each for `@tour` comments, and route
76
+ * every comment: steps are resolved and pushed onto their tour, callouts and
77
+ * details are collected for the caller to place.
78
+ */
79
+ async function scanSources(root, ignore, tourBySlug, projectDefault, diagnostics) {
80
+ const result = {
81
+ callouts: [],
82
+ pendingDetails: [],
83
+ allSourceFiles: new Set(),
84
+ };
85
+ const sourceFiles = await collect(walk(root, {
86
+ ignore,
87
+ filter: (p) => SOURCE_EXTENSIONS.has(path.extname(p)),
88
+ }));
89
+ for (const abs of sourceFiles.sort()) {
90
+ const relPath = rel(root, abs);
91
+ result.allSourceFiles.add(relPath);
92
+ const source = await readSource(abs, relPath, diagnostics);
93
+ if (source === null)
94
+ continue;
95
+ const lines = source.split('\n');
96
+ const language = languageForPath(relPath);
97
+ for (const comment of scanComments(source)) {
98
+ if (comment.kind === 'callout') {
99
+ result.callouts.push({
100
+ title: comment.title,
101
+ body: comment.body,
102
+ file: relPath,
103
+ line: comment.startLine,
104
+ sectionLine: null, // resolved by scopeCallouts once steps are known
105
+ });
106
+ }
107
+ else if (comment.kind === 'detail') {
108
+ result.pendingDetails.push({
109
+ file: relPath,
110
+ detail: toDetail(comment, lines, language, projectDefault),
111
+ });
112
+ }
113
+ else {
114
+ attachStep(comment, relPath, lines, language, projectDefault, tourBySlug, diagnostics);
115
+ }
116
+ }
117
+ }
118
+ return result;
119
+ }
120
+ /** Read a source file, recording a warning and returning null on failure. */
121
+ async function readSource(abs, relPath, diagnostics) {
122
+ try {
123
+ return await fs.readFile(abs, 'utf8');
124
+ }
125
+ catch (err) {
126
+ diagnostics.push({
127
+ severity: 'warning',
128
+ file: relPath,
129
+ message: `Cannot read source file: ${err.message}`,
130
+ });
131
+ return null;
132
+ }
133
+ }
134
+ /** Build a detail sub-step from its comment, resolving the block it zooms to. */
135
+ function toDetail(comment, lines, language, projectDefault) {
136
+ const resolved = resolveTarget(lines, comment.nextCodeLine, comment.startLine, projectDefault, language);
137
+ return {
138
+ title: comment.title,
139
+ body: comment.body,
140
+ highlight: resolved.highlight,
141
+ commentLine: comment.startLine,
142
+ anchor: resolved.anchor,
143
+ };
144
+ }
145
+ /** Resolve a step comment's highlight range and push it onto its tour. */
146
+ function attachStep(comment, relPath, lines, language, projectDefault, tourBySlug, diagnostics) {
147
+ const tour = tourBySlug.get(comment.tourSlug);
148
+ if (!tour) {
149
+ diagnostics.push({
150
+ severity: 'error',
151
+ file: relPath,
152
+ line: comment.startLine,
153
+ message: `Step references unknown tour "${comment.tourSlug}".`,
154
+ });
155
+ return;
156
+ }
157
+ const snippetLines = tour.defaultSnippetLines ?? projectDefault;
158
+ const { highlight, anchor } = resolveTarget(lines, comment.nextCodeLine, comment.startLine, snippetLines, language);
159
+ tour.steps.push({
160
+ tourSlug: tour.slug,
161
+ order: comment.order,
162
+ title: comment.title,
163
+ body: comment.body,
164
+ file: relPath,
165
+ highlight,
166
+ commentLine: comment.startLine,
167
+ anchor,
168
+ details: [],
169
+ });
170
+ }
171
+ /** Sort each tour's steps, warn on duplicate order keys, and flag empty tours. */
172
+ function finalizeTours(tours, diagnostics) {
173
+ for (const tour of tours) {
174
+ tour.steps = sortByOrder(tour.steps, (s) => s.order);
175
+ warnDuplicateOrders(tour, diagnostics);
176
+ if (tour.steps.length === 0) {
177
+ diagnostics.push({
178
+ severity: 'warning',
179
+ file: tour.sourcePath,
180
+ message: `Tour "${tour.slug}" has no steps (no matching @tour comments).`,
181
+ });
182
+ }
183
+ }
184
+ }
185
+ /**
186
+ * Assign each callout to the step section it belongs to: the nearest step in the
187
+ * same file whose comment precedes it. Callouts before every step in their file
188
+ * keep `sectionLine: null` and so apply file-wide.
189
+ */
190
+ function scopeCallouts(callouts, tours) {
191
+ const stepLinesByFile = new Map();
192
+ for (const tour of tours) {
193
+ for (const step of tour.steps) {
194
+ const lines = stepLinesByFile.get(step.file) ?? [];
195
+ lines.push(step.commentLine);
196
+ stepLinesByFile.set(step.file, lines);
197
+ }
198
+ }
199
+ for (const callout of callouts) {
200
+ const preceding = (stepLinesByFile.get(callout.file) ?? []).filter((line) => line < callout.line);
201
+ callout.sectionLine = preceding.length > 0 ? Math.max(...preceding) : null;
202
+ }
203
+ }
204
+ /** Warn once per step whose order key duplicates an earlier step in the tour. */
205
+ function warnDuplicateOrders(tour, diagnostics) {
206
+ const seen = new Set();
207
+ for (const step of tour.steps) {
208
+ if (seen.has(step.order)) {
209
+ diagnostics.push({
210
+ severity: 'warning',
211
+ file: step.file,
212
+ line: step.commentLine,
213
+ message: `Duplicate step order "${step.order}" in tour "${tour.slug}".`,
214
+ });
215
+ }
216
+ seen.add(step.order);
217
+ }
218
+ }
219
+ /**
220
+ * Attach each `@tour:detail` sub-step to the step whose highlight range encloses
221
+ * it. When several steps in the same file enclose a detail (e.g. a class step
222
+ * and a method step), the innermost — smallest — range wins. Orphan details
223
+ * (inside no step) become warnings. Details are kept in file order.
224
+ */
225
+ function assignDetails(pending, tours, diagnostics) {
226
+ const stepsByFile = new Map();
227
+ for (const tour of tours) {
228
+ for (const step of tour.steps) {
229
+ const list = stepsByFile.get(step.file) ?? [];
230
+ list.push(step);
231
+ stepsByFile.set(step.file, list);
232
+ }
233
+ }
234
+ for (const { file, detail } of pending) {
235
+ const candidates = (stepsByFile.get(file) ?? []).filter((step) => detail.commentLine >= step.highlight.start &&
236
+ detail.commentLine <= step.highlight.end);
237
+ if (candidates.length === 0) {
238
+ diagnostics.push({
239
+ severity: 'warning',
240
+ file,
241
+ line: detail.commentLine,
242
+ message: `@tour:detail "${detail.title}" is not inside any step's range; ignored.`,
243
+ });
244
+ continue;
245
+ }
246
+ // Innermost enclosing step: the smallest highlight span.
247
+ const span = (s) => s.highlight.end - s.highlight.start;
248
+ const owner = candidates.reduce((a, b) => (span(b) < span(a) ? b : a));
249
+ owner.details.push(detail);
250
+ }
251
+ for (const list of stepsByFile.values()) {
252
+ for (const step of list) {
253
+ step.details.sort((a, b) => a.commentLine - b.commentLine);
254
+ }
255
+ }
256
+ }
257
+ // @tour pipeline:4 Checking cross-references
258
+ // With steps attached, the builder verifies the graph holds together: tours
259
+ // reference real components, and every `glossary:<slug>` link across all
260
+ // Markdown bodies resolves to a defined concept. Broken links become warnings,
261
+ // which is exactly what `validate` surfaces.
262
+ function validateReferences(content, tours, diagnostics) {
263
+ const componentSlugs = new Set(content.components.map((c) => c.slug));
264
+ const glossarySlugs = new Set(content.glossary.map((g) => g.slug));
265
+ for (const tour of tours) {
266
+ for (const comp of tour.components) {
267
+ if (!componentSlugs.has(comp)) {
268
+ diagnostics.push({
269
+ severity: 'warning',
270
+ file: tour.sourcePath,
271
+ message: `Tour "${tour.slug}" references unknown component "${comp}".`,
272
+ });
273
+ }
274
+ }
275
+ }
276
+ // Check `glossary:<slug>` links across all Markdown bodies.
277
+ const bodies = [
278
+ { text: content.project.body, file: '.tour/index.md' },
279
+ ...content.components.map((c) => ({ text: c.body, file: c.sourcePath })),
280
+ ...content.glossary.map((g) => ({ text: g.body, file: g.sourcePath })),
281
+ ...tours.flatMap((t) => [
282
+ { text: t.body, file: t.sourcePath },
283
+ ...t.steps.map((s) => ({ text: s.body, file: s.file })),
284
+ ]),
285
+ ];
286
+ const linkRe = /\]\(glossary:([A-Za-z0-9._-]+)\)/g;
287
+ for (const { text, file } of bodies) {
288
+ for (const match of text.matchAll(linkRe)) {
289
+ if (!glossarySlugs.has(match[1])) {
290
+ diagnostics.push({
291
+ severity: 'warning',
292
+ file,
293
+ message: `Broken glossary link "glossary:${match[1]}".`,
294
+ });
295
+ }
296
+ }
297
+ }
298
+ }
299
+ async function bundleSources(root, paths, diagnostics) {
300
+ const files = [];
301
+ for (const relPath of [...paths].sort()) {
302
+ try {
303
+ const content = await fs.readFile(path.join(root, relPath), 'utf8');
304
+ files.push({ path: relPath, language: languageForPath(relPath), content });
305
+ }
306
+ catch (err) {
307
+ diagnostics.push({
308
+ severity: 'warning',
309
+ file: relPath,
310
+ message: `Cannot bundle source file: ${err.message}`,
311
+ });
312
+ }
313
+ }
314
+ return files;
315
+ }
316
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/manifest/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAU7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAuB,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EACL,eAAe,EACf,aAAa,GAEd,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,iEAAiE;AACjE,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,KAAK;CACN,CAAC,CAAC;AAYH,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,GAAW,EAA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H,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa,CAC1B,IAAY,EACZ,KAAkB,EAClB,WAAyB;IAEzB,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,KAAK,MAAM,OAAO,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;QACxC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;YACpE,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7E,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,WAAW,CAAC,IAAI,CAAC;gBACf,QAAQ,EAAE,SAAS;gBACnB,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,8BAA+B,GAAa,CAAC,OAAO,EAAE;aAChE,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,178 @@
1
+ /**
2
+ * The renderer-neutral content model for a CodeSafari project.
3
+ *
4
+ * These types are the contract between the CLI (which parses `.tour/` content
5
+ * and inline `@tour` comments) and the React viewer (which renders the
6
+ * manifest). They are intentionally free of any Node or DOM dependency so the
7
+ * same declarations can be shared by both sides.
8
+ */
9
+ /** Semver-ish version stamped into every manifest for forward compatibility. */
10
+ export declare const MANIFEST_VERSION: 1;
11
+ /** Project-level metadata and landing-page body, from `.tour/index.md`. */
12
+ export interface ProjectMeta {
13
+ title: string;
14
+ description: string;
15
+ /** Fallback number of source lines to show when a step has no code block. */
16
+ defaultSnippetLines: number;
17
+ /** Optional link back to the project's repository. */
18
+ repositoryUrl?: string;
19
+ /** Markdown body of the landing page. */
20
+ body: string;
21
+ }
22
+ /** A software component, from `.tour/components/*.md`. */
23
+ export interface Component {
24
+ slug: string;
25
+ title: string;
26
+ summary?: string;
27
+ order?: number;
28
+ /** Markdown description. */
29
+ body: string;
30
+ /** Source path of the authoring file, relative to project root. */
31
+ sourcePath: string;
32
+ }
33
+ /** A single navigable step within a tour, sourced from an inline comment. */
34
+ export interface TourStep {
35
+ /** Tour this step belongs to. */
36
+ tourSlug: string;
37
+ /** Dot-aware order key, e.g. "12.34". Sorts numerically per dot segment. */
38
+ order: string;
39
+ title: string;
40
+ /** Markdown body (the rest of the comment block). */
41
+ body: string;
42
+ /** File the anchoring comment lives in, relative to project root. */
43
+ file: string;
44
+ /** The code range the step highlights/scrolls to (1-based, inclusive). */
45
+ highlight: LineRange;
46
+ /** 1-based line of the comment's first line, for diagnostics. */
47
+ commentLine: number;
48
+ /**
49
+ * How the highlight range was resolved — useful for diagnostics and viewer
50
+ * affordances.
51
+ */
52
+ anchor: StepAnchorKind;
53
+ /**
54
+ * Sub-steps authored with `@tour:detail` inside this step's highlight range.
55
+ * Each zooms the highlight to a specific block within the step, in file
56
+ * order. Navigable as nested steps in the viewer.
57
+ */
58
+ details: StepDetail[];
59
+ }
60
+ /** A sub-step of a {@link TourStep}, from a `@tour:detail` comment. */
61
+ export interface StepDetail {
62
+ title: string;
63
+ /** Markdown body (the rest of the comment block). */
64
+ body: string;
65
+ /** The block this detail zooms to (1-based, inclusive). Same file as parent. */
66
+ highlight: LineRange;
67
+ /** 1-based line of the detail comment's first line. */
68
+ commentLine: number;
69
+ anchor: StepAnchorKind;
70
+ }
71
+ export type StepAnchorKind = 'class' | 'function' | 'method' | 'block' | 'snippet';
72
+ export interface LineRange {
73
+ /** 1-based, inclusive. */
74
+ start: number;
75
+ /** 1-based, inclusive. */
76
+ end: number;
77
+ }
78
+ /** A non-navigable styled annotation, from `@tour comment <title>`. */
79
+ export interface SourceCallout {
80
+ title: string;
81
+ body: string;
82
+ file: string;
83
+ line: number;
84
+ /**
85
+ * The `commentLine` of the tour step this callout falls under — the nearest
86
+ * step whose comment precedes it in the same file. `null` when the callout
87
+ * comes before every step in its file, in which case it applies file-wide.
88
+ * The viewer uses this to scope a callout to its section rather than the
89
+ * whole file.
90
+ */
91
+ sectionLine: number | null;
92
+ }
93
+ /** A tour entry page, from `.tour/tours/**\/*.md`, plus its resolved steps. */
94
+ export interface Tour {
95
+ slug: string;
96
+ title: string;
97
+ components: string[];
98
+ order?: number;
99
+ /** Overrides project `defaultSnippetLines` for this tour's steps. */
100
+ defaultSnippetLines?: number;
101
+ /** Markdown intro shown before "Start tour". */
102
+ body: string;
103
+ sourcePath: string;
104
+ /** Steps sorted by dot-aware order. */
105
+ steps: TourStep[];
106
+ }
107
+ /** A glossary concept, addressable via `glossary:<slug>` links. */
108
+ export interface GlossaryConcept {
109
+ slug: string;
110
+ title: string;
111
+ /** Markdown body for this concept. */
112
+ body: string;
113
+ /** File the concept was defined in, relative to project root. */
114
+ sourcePath: string;
115
+ }
116
+ /** A source file whose content is bundled for the viewer. */
117
+ export interface SourceFile {
118
+ /** Path relative to project root. */
119
+ path: string;
120
+ language: string;
121
+ content: string;
122
+ }
123
+ /** A rendered Mermaid diagram, keyed by a stable content hash. */
124
+ export interface DiagramAsset {
125
+ id: string;
126
+ /** Rendered SVG markup, or absent if rendering failed. */
127
+ svg?: string;
128
+ /** Present when rendering failed. */
129
+ error?: string;
130
+ }
131
+ /**
132
+ * v1.5: a small self-contained code walkthrough, from `.tour/examples`.
133
+ * Included in the model now so the manifest shape is stable; population is a
134
+ * v1.5 concern.
135
+ */
136
+ export interface Example {
137
+ slug: string;
138
+ title: string;
139
+ summary?: string;
140
+ order?: number;
141
+ language?: string;
142
+ defaultStep?: number;
143
+ tours: string[];
144
+ components: string[];
145
+ concepts: string[];
146
+ sourcePath: string;
147
+ steps: ExampleStep[];
148
+ }
149
+ export interface ExampleStep {
150
+ order: number;
151
+ title?: string;
152
+ /** Complete, assembled code for this state. */
153
+ code: string;
154
+ /** Focused line ranges (1-based, inclusive). */
155
+ focus: LineRange[];
156
+ }
157
+ /** A validation problem discovered while building the manifest. */
158
+ export interface Diagnostic {
159
+ severity: 'error' | 'warning';
160
+ message: string;
161
+ /** File the problem relates to, relative to project root, if known. */
162
+ file?: string;
163
+ /** 1-based line, if known. */
164
+ line?: number;
165
+ }
166
+ /** The complete, frozen description of a CodeSafari project. */
167
+ export interface Manifest {
168
+ version: typeof MANIFEST_VERSION;
169
+ project: ProjectMeta;
170
+ components: Component[];
171
+ tours: Tour[];
172
+ glossary: GlossaryConcept[];
173
+ callouts: SourceCallout[];
174
+ examples: Example[];
175
+ /** Included source files, present in exported manifests. */
176
+ files: SourceFile[];
177
+ diagrams: DiagramAsset[];
178
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The renderer-neutral content model for a CodeSafari project.
3
+ *
4
+ * These types are the contract between the CLI (which parses `.tour/` content
5
+ * and inline `@tour` comments) and the React viewer (which renders the
6
+ * manifest). They are intentionally free of any Node or DOM dependency so the
7
+ * same declarations can be shared by both sides.
8
+ */
9
+ /** Semver-ish version stamped into every manifest for forward compatibility. */
10
+ export const MANIFEST_VERSION = 1;
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/model/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAU,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Extract `@tour` comment blocks from source text.
3
+ *
4
+ * A "comment block" is a run of consecutive comment lines with nothing but
5
+ * comment markers and whitespace between them. Two block flavours are handled:
6
+ *
7
+ * - Line comments (`//`, `#`) on consecutive lines form one block.
8
+ * - A single block comment (`/* ... *\/`) forms one block.
9
+ * - A single triple-quoted block (`""" ... """` or `''' ... '''`, i.e. a
10
+ * Python docstring) forms one block.
11
+ *
12
+ * The first line of a block may declare a tour step or a callout:
13
+ *
14
+ * @tour <tour-slug>:<step-order> <Step title>
15
+ * @tour comment <Title>
16
+ *
17
+ * The remaining lines are the Markdown body. This module is language-agnostic
18
+ * and regex-based; precise highlight-range resolution (class vs. function vs.
19
+ * snippet) is layered on top by the target resolver.
20
+ */
21
+ export interface RawTourComment {
22
+ kind: 'step' | 'callout' | 'detail';
23
+ /** For steps: the tour slug. Absent for callouts and details. */
24
+ tourSlug?: string;
25
+ /** For steps: the dot-aware order key. Absent for callouts and details. */
26
+ order?: string;
27
+ title: string;
28
+ /** Markdown body assembled from the block's remaining lines. */
29
+ body: string;
30
+ /** 1-based line of the block's first line. */
31
+ startLine: number;
32
+ /** 1-based line of the block's last comment line. */
33
+ endLine: number;
34
+ /**
35
+ * 1-based line of the first line of code AFTER the comment block, or null if
36
+ * the block is at end of file. Used by the target resolver.
37
+ */
38
+ nextCodeLine: number | null;
39
+ }
40
+ /**
41
+ * Scan source text and return every `@tour` comment it contains, in file order.
42
+ */
43
+ export declare function scanComments(source: string): RawTourComment[];