@learnosity/lib-qti-converter 0.10.4 → 0.12.1

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.
@@ -71,6 +71,11 @@ Import the converter directly into your Node.js or TypeScript project:
71
71
  import { convertQtiToLearnosity, convertLearnosityToQti } from '@learnosity/lib-qti-converter';
72
72
  ```
73
73
 
74
+ The package has **two entry points**:
75
+
76
+ - `@learnosity/lib-qti-converter` — in-memory conversion (strings / JSON). Contains no `node:*` dependencies, so it is **browser-safe** and bundles with no polyfills.
77
+ - `@learnosity/lib-qti-converter/node` — everything above **plus** filesystem/ZIP helpers (package & bundle load/save, disk-based package conversion). Node.js only.
78
+
74
79
  ### Convert QTI XML to Learnosity JSON
75
80
 
76
81
  ```typescript
@@ -119,6 +124,47 @@ console.log(result.output); // Converted QTI XML string
119
124
  console.log(result.diagnostics); // Array of Diagnostic objects
120
125
  ```
121
126
 
127
+ ### Convert Packages (Node.js)
128
+
129
+ Package- and bundle-level conversions read/write the filesystem and ZIP archives, so they are imported from the `/node` entry point:
130
+
131
+ ```typescript
132
+ import {
133
+ convertQtiPackageToLearnosity, // QTI Content Package (dir or .zip) → Learnosity bundle
134
+ convertLearnosityToQtiPackage, // Learnosity bundle → QTI Content Package
135
+ nodeFileAccess,
136
+ } from '@learnosity/lib-qti-converter/node';
137
+
138
+ // QTI package on disk → in-memory Learnosity bundle
139
+ const { bundle, diagnostics } = await convertQtiPackageToLearnosity({ inputPath: './qti-package' });
140
+
141
+ // Learnosity bundle directory → QTI package written to disk
142
+ const result = convertLearnosityToQtiPackage({ inputPath: './bundle', outputPath: './out.zip' });
143
+ ```
144
+
145
+ To resolve external passage HTML and sibling LOM metadata files **from disk** during single-item conversion, inject `nodeFileAccess`:
146
+
147
+ ```typescript
148
+ import { convertQtiToLearnosity } from '@learnosity/lib-qti-converter';
149
+ import { nodeFileAccess } from '@learnosity/lib-qti-converter/node';
150
+
151
+ const { output } = await convertQtiToLearnosity(qtiXml, {
152
+ qtiVersion: '2.2',
153
+ inputPath: './items/item.xml',
154
+ fileAccess: nodeFileAccess, // opt in to disk reads for passages/LOM
155
+ });
156
+ ```
157
+
158
+ ### Browser Usage
159
+
160
+ The root entry is free of Node built-ins and works in the browser. In-memory, single-item conversion runs both directions with no polyfills:
161
+
162
+ ```typescript
163
+ import { convertQtiToLearnosity, convertLearnosityToQti } from '@learnosity/lib-qti-converter';
164
+ ```
165
+
166
+ Filesystem and ZIP-package operations are Node-only (the `/node` entry) and are not available in the browser.
167
+
122
168
  See [Examples](./EXAMPLES.md#library-usage) for more programmatic usage scenarios including package conversion and handling diagnostics.
123
169
 
124
170
  ## CLI Options
@@ -335,19 +381,55 @@ lcon learnosity-to-qti-package \
335
381
 
336
382
  **How it works:**
337
383
 
338
- - Scans the input directory for immediate subdirectories (not nested)
384
+ - Scans the input directory tree at any depth, stopping at each directory that is a package
339
385
  - Auto-detects package type (QTI packages have `imsmanifest.xml`, Learnosity bundles have `manifest.json`)
340
386
  - Converts each package independently
341
- - Creates matching output folder structure
387
+ - Writes each package to its input-relative path under `--out`, so nested folders are mirrored and same-named packages in different subtrees don't collide
342
388
  - Shows progress and summary report
343
389
 
344
390
  **Limitations:**
345
391
 
346
- - Only processes immediate subdirectories (depth = 1)
347
392
  - Cannot be used with ZIP input (directory input only)
348
393
  - Files in the root directory are ignored
349
394
 
350
- See [Examples - Batch Processing](EXAMPLES.md#8-batch-processing-with-recursive-flag) for detailed examples.
395
+ See [Examples - Batch Processing](EXAMPLES.md#10-batch-processing-with-recursive-flag) for detailed examples.
396
+
397
+ ### `--concurrency <number>`
398
+
399
+ _Available for: `qti-package-to-learnosity`, `learnosity-to-qti-package` (with `--recursive`)_
400
+
401
+ Convert packages in parallel across worker threads. Defaults to `1` (serial). Set it higher to use multiple CPU cores when converting many packages — each package is converted on its own worker thread, so a large batch scales with the core count:
402
+
403
+ ```bash
404
+ lcon qti-package-to-learnosity \
405
+ --in ./qti-packages \
406
+ --out ./learnosity-bundles \
407
+ --organisation_id 12345 \
408
+ --recursive \
409
+ --concurrency 8
410
+ ```
411
+
412
+ The batch summary is identical to serial mode (aggregated in package order); only per-package progress lines may appear out of order as workers finish. Per-package `diagnostics.json` files are still written.
413
+
414
+ ### `--truncate-tags`
415
+
416
+ _Available for: `qti-to-learnosity`, `qti-package-to-learnosity`_
417
+
418
+ Truncate tag types and names to 255 characters instead of failing the conversion when a tag exceeds that limit.
419
+
420
+ ```bash
421
+ lcon qti-to-learnosity --in item.xml --out item.json --truncate-tags
422
+ ```
423
+
424
+ ### `--fail-on-warn`
425
+
426
+ _Available for: `learnosity-to-qti`, `learnosity-to-qti-package`, `qti-package-to-learnosity`_
427
+
428
+ Exit with error code 1 if any warnings are produced during conversion (default: false). Useful for enforcing warning-free output in CI pipelines.
429
+
430
+ ```bash
431
+ lcon learnosity-to-qti --in item.json --out item.xml --fail-on-warn
432
+ ```
351
433
 
352
434
  ## Basic Workflow
353
435
 
@@ -378,7 +460,7 @@ lcon qti-package-to-learnosity --in package.zip --out output.json
378
460
  - Converter version and timestamp
379
461
  - All configuration options used (organisation ID, asset URL settings, item reference source)
380
462
 
381
- See [Learnosity Bundle Format](LEARNOSITY_BUNDLE_FORMAT.md#diagnostics-section) for details.
463
+ See [Learnosity Bundle Format](LEARNOSITY_BUNDLE_FORMAT.md#manifestjson) for details.
382
464
 
383
465
  ### 3. Review Diagnostics
384
466
 
@@ -400,6 +482,8 @@ Diagnostics are displayed after conversion:
400
482
 
401
483
  Create `lrn-converter.config.json` in your working directory to set default options:
402
484
 
485
+ > **Note:** All four commands load `lrn-converter.config.json` (and honour `--config` / `--no-config`). Each command applies only the keys relevant to its conversion direction — e.g. `organisationId`, `mediaVault`, `customAssetUrl`, `itemReferenceSource` for QTI → Learnosity; `qtiVersion` for Learnosity → QTI — and ignores the rest.
486
+
403
487
  ```json
404
488
  {
405
489
  "qtiVersion": "2.2",
@@ -430,7 +514,8 @@ All options are optional. CLI flags override config file values.
430
514
  | `output` | `string` | `"-"` | Default output directory for interactive mode |
431
515
  | `organisationId` | `number` | - | Organisation ID for Learnosity CDN asset URLs |
432
516
  | `mediaVault` | `boolean` | `false` | Use `media-vault` subdomain instead of `assets` for CDN URLs |
433
- | `customAssetUrl` | `string` | - | Custom base URL for assets (overrides default Learnosity CDN) |
517
+ | `customAssetUrl` | `string` | - | Custom base URL for assets (overrides the default Learnosity CDN and `mediaVault`) |
518
+ | `truncateTags` | `boolean` | `false` | Truncate tag types and names to 255 characters instead of failing |
434
519
  | `itemReferenceSource` | `"sourceFilename"` \| `"qti"` \| `"uuid"` | `"sourceFilename"` | How to generate item references (QTI → Learnosity only) |
435
520
  | `itemFilenameSource` | `"sourceFilename"` \| `"qti"` | Same as `itemReferenceSource` | How to name output JSON files. Defaults to the resolved `itemReferenceSource` value if omitted |
436
521
 
@@ -12,9 +12,9 @@ A Learnosity bundle is a directory containing content exported from the [Learnos
12
12
  bundle/
13
13
  ├── manifest.json # Required - Bundle manifest with references
14
14
  ├── activities/ # Optional - Activity JSON files
15
- │ └── <hash>.json
15
+ │ └── <reference>.json
16
16
  ├── items/ # Required - Item JSON files (must have content)
17
- │ └── <hash>.json
17
+ │ └── <reference>.json
18
18
  └── assets/ # Optional - Media assets (images, audio, etc.)
19
19
  └── <hash>_<original_filename>
20
20
  ```
@@ -44,75 +44,29 @@ The manifest file defines the structure of the bundle and maps activities to the
44
44
  ```json
45
45
  {
46
46
  "diagnostics": {
47
- "version": "0.8.0",
47
+ "version": "0.11.1",
48
48
  "timestamp": "2026-03-10T04:53:50.368Z",
49
49
  "configuration": {
50
50
  "organisationId": 12345,
51
51
  "mediaVault": false,
52
52
  "customAssetUrl": "https://cdn.example.com/assets",
53
- "itemReferenceSource": "sourceFilename",
54
- "itemFilenameSource": "qti"
53
+ "itemReferenceSource": "sourceFilename"
55
54
  }
56
55
  },
57
- "items": [
58
- {
59
- "id": "item_001",
60
- "reference": "item_001",
61
- "organisation_id": 12345
62
- },
63
- {
64
- "id": "item_002",
65
- "reference": "item_002",
66
- "organisation_id": 12345
67
- }
68
- ],
56
+ "items": ["item_001", "item_002"],
69
57
  "activities": {
70
58
  "activity_001": {
71
59
  "items": [
72
- {
73
- "id": "item_001",
74
- "reference": "item_001",
75
- "organisation_id": 12345
76
- },
77
- {
78
- "id": "item_002",
79
- "reference": "item_002",
80
- "organisation_id": 12345
81
- }
82
- ],
83
- "intro": {
84
- "id": "intro_item",
85
- "reference": "intro_item",
86
- "organisation_id": 12345
87
- }
60
+ { "reference": "item_001", "id": "item_001" },
61
+ { "reference": "item_002", "id": "item_002" }
62
+ ]
88
63
  }
89
64
  },
90
65
  "assets": {
91
- "activities": {
92
- "<activity_reference>": [
93
- {
94
- "url": "<original_cdn_url>",
95
- "replacement": "<local_path>"
96
- }
97
- ]
98
- },
99
66
  "items": {
100
- "<item_reference>": {
67
+ "item_001": {
101
68
  "questions": {
102
- "<question_uuid>": [
103
- {
104
- "url": "<original_cdn_url>",
105
- "replacement": "<local_path>"
106
- }
107
- ]
108
- },
109
- "features": {
110
- "<feature_uuid>": [
111
- {
112
- "url": "<original_cdn_url>",
113
- "replacement": "<local_path>"
114
- }
115
- ]
69
+ "<question_uuid>": []
116
70
  }
117
71
  }
118
72
  }
@@ -120,51 +74,72 @@ The manifest file defines the structure of the bundle and maps activities to the
120
74
  }
121
75
  ```
122
76
 
77
+ ### Field Notes
78
+
79
+ - **`items`** is a sorted array of item-reference **strings** (the converter writes
80
+ `Array.from(items.keys()).sort()`). The loader tolerates an array of objects for
81
+ compatibility, but does not use this field as an index (`types.ts`: `items?: unknown`,
82
+ "not used as index"), so producers should emit strings.
83
+ - **`diagnostics.configuration`** only ever contains `organisationId`, `mediaVault`,
84
+ `customAssetUrl`, and `itemReferenceSource`. There is no `itemFilenameSource` key in
85
+ the emitted manifest.
86
+ - **`assets`** is optional metadata only — the loader never requires it. The producer
87
+ writes exactly one shape: `assets.items.<item_reference>.questions`, where each entry
88
+ maps a question reference to an **empty array**. There is no `activities` key, no
89
+ `features` key, and no `{ url, replacement }` objects.
90
+ - **Auto-created default activity** — when `manifest.activities` is empty but the
91
+ `items/` folder contains files, the loader synthesizes a single `default_activity`
92
+ containing all discovered items (diagnostic `LRN_BUNDLE_AUTO_ACTIVITY_CREATED`).
93
+
123
94
  ## activities/ Folder
124
95
 
125
- Contains JSON files for each activity. File names are MD5 hashes of the activity reference.
96
+ Contains one JSON file per activity. Files are written under the activity's **direct
97
+ reference name** (`activities/<reference>.json`). When loading, the reader first tries
98
+ that direct name and only falls back to an MD5 hash (`md5(reference)`) if the direct
99
+ file is absent — MD5 is a reader fallback, not the write convention.
126
100
 
127
101
  ### Activity JSON Structure
128
102
 
103
+ The converter emits a **flat** activity object (no `data` wrapper):
104
+
129
105
  ```json
130
106
  {
131
107
  "reference": "ACTIVITY_REFERENCE",
132
- "data": {
133
- "reference": "Activity Title",
134
- "description": "Activity description",
135
- "status": "published",
136
- "rendering_type": "assess",
137
- "items": [
138
- {
139
- "id": "<org_id>::<item_reference>",
140
- "reference": "<item_reference>",
141
- "organisation_id": <number>
142
- }
143
- ],
144
- "config": {
145
- "regions": { ... },
146
- "navigation": {
147
- "show_intro": true,
148
- "intro_item": { ... },
149
- "show_title": true,
150
- "show_outro": true,
151
- "show_prev": true,
152
- "show_next": true
153
- },
154
- "time": { ... },
155
- "configuration": {
156
- "stylesheet": "<path_to_css>"
157
- }
158
- }
108
+ "rendering_type": "assess",
109
+ "items": [
110
+ { "reference": "<item_reference>", "id": "<item_reference>" }
111
+ ],
112
+ "config": {
113
+ "navigation": {
114
+ "show_intro": true,
115
+ "show_outro": true
116
+ },
117
+ "regions": "main"
118
+ },
119
+ "tags": {
120
+ "<tag_type>": ["<tag_value>"]
159
121
  }
160
122
  }
161
123
  ```
162
124
 
125
+ Notes:
126
+
127
+ - `config.regions` is a **string** (`"main"`), not an object.
128
+ - Each item `id` equals its `reference` — there is no `<org_id>::` prefix.
129
+ - `tags` is omitted entirely when the activity has no tags.
130
+
131
+ The reader also accepts a `data`-wrapped form with a `data.sections` array (item
132
+ references nested inside sections). This is the **Learnosity Data API input**
133
+ convention that the loader tolerates on read — it is **not** what this tool emits.
134
+
163
135
  ---
164
136
 
165
137
  ## items/ Folder
166
138
 
167
- Contains JSON files for each item. File names are MD5 hashes of the item reference.
139
+ Contains one JSON file per item, written under the item's **direct reference name**
140
+ (`items/<reference>.json`). On load, the reader tries the direct name first, then falls
141
+ back to `md5(reference)`, then to `md5(id)` — the MD5 forms are read-time fallbacks, not
142
+ the write convention.
168
143
 
169
144
  **This folder must contain at least one file.**
170
145
 
@@ -313,7 +288,7 @@ If no `--activity` is specified, all activities in the bundle are converted.
313
288
  ### Library
314
289
 
315
290
  ```typescript
316
- import { convertLearnosityToQtiPackage } from '@learnosity/lib-qti-converter';
291
+ import { convertLearnosityToQtiPackage } from '@learnosity/lib-qti-converter/node';
317
292
 
318
293
  const result = convertLearnosityToQtiPackage({
319
294
  inputPath: './path/to/bundle',
@@ -100,7 +100,12 @@ When converting to QTI, these sections map to:
100
100
 
101
101
  ## QTI Output Example
102
102
 
103
- The above Learnosity activity converts to the following QTI structure:
103
+ The above Learnosity activity converts to the following QTI structure. In the
104
+ generated package this assessmentTest is written to
105
+ `tests/<sanitized-folder>/assessmentTest.xml` (two levels deep), so its
106
+ `assessmentItemRef` hrefs are rewritten to `../../items/…` to resolve against the
107
+ package root. (A bare `href="items/item_001.xml"` is the pre-merge serializer
108
+ output, before the test is relocated into the package.)
104
109
 
105
110
  ```xml
106
111
  <?xml version="1.0" encoding="UTF-8"?>
@@ -119,8 +124,8 @@ The above Learnosity activity converts to the following QTI structure:
119
124
  <assessmentSection identifier="section_1"
120
125
  title="Multi-Section Assessment - Section 1"
121
126
  visible="true">
122
- <assessmentItemRef identifier="item_001" href="items/item_001.xml"/>
123
- <assessmentItemRef identifier="item_002" href="items/item_002.xml"/>
127
+ <assessmentItemRef identifier="item_001" href="../../items/item_001.xml"/>
128
+ <assessmentItemRef identifier="item_002" href="../../items/item_002.xml"/>
124
129
  </assessmentSection>
125
130
 
126
131
  <!-- Section 2: Shuffled items with hard time limit -->
@@ -129,8 +134,8 @@ The above Learnosity activity converts to the following QTI structure:
129
134
  visible="true"
130
135
  shuffle="true">
131
136
  <timeLimits maxTime="300" allowLateSubmission="false"/>
132
- <assessmentItemRef identifier="item_003" href="items/item_003.xml"/>
133
- <assessmentItemRef identifier="item_004" href="items/item_004.xml"/>
137
+ <assessmentItemRef identifier="item_003" href="../../items/item_003.xml"/>
138
+ <assessmentItemRef identifier="item_004" href="../../items/item_004.xml"/>
134
139
  </assessmentSection>
135
140
 
136
141
  <!-- Section 3: Soft time limit -->
@@ -138,7 +143,7 @@ The above Learnosity activity converts to the following QTI structure:
138
143
  title="Multi-Section Assessment - Section 3"
139
144
  visible="true">
140
145
  <timeLimits maxTime="600" allowLateSubmission="true"/>
141
- <assessmentItemRef identifier="item_005" href="items/item_005.xml"/>
146
+ <assessmentItemRef identifier="item_005" href="../../items/item_005.xml"/>
142
147
  </assessmentSection>
143
148
 
144
149
  </testPart>
@@ -255,24 +260,30 @@ learnosity-bundle/
255
260
  ├── activities/
256
261
  │ └── {activity_id}.json # Activity JSON with sections array
257
262
  └── items/
258
- ├── {item_hash}.json # Item files (MD5 hash of item ID)
263
+ ├── {reference}.json # Item files (direct filename tried first; see below)
259
264
  └── ...
260
265
  ```
261
266
 
262
- ### Important: Item File Naming
267
+ ### Important: Item File Lookup Order
263
268
 
264
- Item files are named using the **MD5 hash of the item reference** (without organization prefix):
269
+ When locating an item's JSON file, the loader tries three strategies **in this
270
+ order**, using the first one that exists on disk:
265
271
 
266
- - Item reference: `"item_001"`
267
- - Filename: `md5("item_001").json` → `a1b2c3d4e5f6...json`
272
+ 1. **Direct filename** - `items/{reference}.json`
273
+ 2. **MD5 hash of the reference** - `items/{md5(reference)}.json`
274
+ 3. **MD5 hash of the id** - `items/{md5(id)}.json` (only if the manifest supplies
275
+ an `id` for that reference)
268
276
 
269
- **Note**: Even though the manifest may include a full item ID with an organization prefix (e.g., `"1::item_001"`), the filename is always based on the `reference` field only.
277
+ **Note**: The manifest may include a full item ID with an organization prefix
278
+ (e.g., `"1::item_001"`) alongside the `reference` (e.g., `"item_001"`). Strategies
279
+ 1 and 2 key off the `reference`; strategy 3 is a last-resort fallback that hashes
280
+ the `id` instead.
270
281
 
271
282
  The converter automatically handles this by:
272
283
 
273
284
  1. Extracting item references from activity sections or manifest
274
- 2. Using the reference for MD5 hashing when locating files
275
- 3. Falling back to direct filename match if MD5 file doesn't exist
285
+ 2. Trying the direct `items/{reference}.json` filename first
286
+ 3. Falling back to `md5(reference)`, then `md5(id)`, if the direct file is absent
276
287
 
277
288
  ## Conversion Behavior
278
289
 
@@ -366,8 +377,8 @@ The converter supports both formats:
366
377
 
367
378
  The generated QTI is compatible with:
368
379
 
369
- - **QTI 2.1** - All features supported
370
- - **QTI 2.2** - All features supported (default output version)
380
+ - **QTI 2.1** - All features supported (default for the library function `convertLearnosityToQtiPackage` when `qtiVersion` is omitted)
381
+ - **QTI 2.2** - All features supported (default for the CLI `learnosity-to-qti-package`)
371
382
 
372
383
  Both versions support:
373
384
 
@@ -16,7 +16,12 @@ Both formats can be present in the same QTI package, and tags from both sources
16
16
  The converter searches for metadata in two locations:
17
17
 
18
18
  1. **Manifest metadata** - `<metadata>` blocks within each `<resource>` element in `imsmanifest.xml`
19
- 2. **Standalone LOM files** - Files named `*.lom.xml` located alongside the item XML files
19
+ 2. **Standalone LOM files** - Files named `<itemId>.lom.xml` located in a `metadata/` folder resolved relative to the item XML (not alongside the item file). The finder checks, in order:
20
+ - `items/<id>.xml` → `metadata/<id>.lom.xml` (sibling `metadata/` beside the `items/` folder)
21
+ - `<dir>/<id>.xml` → `<dir>/metadata/<id>.lom.xml`
22
+ - `<dir>/<id>.xml` → `<dir>/../metadata/<id>.lom.xml`
23
+
24
+ When both sources are present, **manifest tags take priority** over standalone-LOM tags: the converter merges via `mergeTagObjects(existingTags, tagResult.tags)`, where the manifest-derived tags are the base that wins on any conflicting tag type.
20
25
 
21
26
  ## LOM (Learning Object Metadata)
22
27
 
@@ -81,6 +86,11 @@ The converter searches for metadata in two locations:
81
86
  - Tag type names come from `<imsmd:source>` elements
82
87
  - Tag values come from `<imsmd:taxon>/<imsmd:entry>` elements
83
88
 
89
+ > **Note on casing:** the parser accepts both `taxonPath`/`taxonpath` and
90
+ > `langstring`/`langString`. When the converter *emits* LOM (Learnosity → QTI),
91
+ > it always writes the lowercase IMS MD v1.2 element names — `imsmd:taxonpath`
92
+ > and `imsmd:langstring`.
93
+
84
94
  ## Common Cartridge Curriculum Standards Metadata
85
95
 
86
96
  In addition to LOM metadata, the converter also supports **Common Cartridge curriculum standards metadata** found in `<metadata>` blocks within `imsmanifest.xml`.
@@ -125,7 +135,12 @@ In addition to LOM metadata, the converter also supports **Common Cartridge curr
125
135
  ### Mapping
126
136
 
127
137
  - `<csm:label>` → tag type
128
- - `<csm:GUID>` → tag name
138
+ - `<csm:GUID>` → tag value
139
+
140
+ > Both metadata formats populate the same output slot: the LOM `<imsmd:taxon>/<imsmd:entry>`
141
+ > and the Common Cartridge `<csm:GUID>` each become a **tag value** in the `tags` object
142
+ > (the string(s) in each type's array). "Tag value" and Learnosity's "tag name" refer to
143
+ > this same slot.
129
144
 
130
145
  ### Features
131
146
 
@@ -210,10 +225,8 @@ qti-package-to-learnosity --in package.zip --out bundle.zip --truncate-tags
210
225
  **Library:**
211
226
 
212
227
  ```typescript
213
- import {
214
- convertQtiToLearnosity,
215
- convertQtiPackageToLearnosity,
216
- } from '@learnosity/lib-qti-converter';
228
+ import { convertQtiToLearnosity } from '@learnosity/lib-qti-converter';
229
+ import { convertQtiPackageToLearnosity } from '@learnosity/lib-qti-converter/node';
217
230
 
218
231
  // Single-item conversion
219
232
  const result = await convertQtiToLearnosity(qtiXml, {
@@ -92,13 +92,18 @@ The `<assessmentTest>` element represents a complete test or assessment containi
92
92
  <assessmentTest identifier="test_001" title="Sample Test">
93
93
  <testPart identifier="part1" navigationMode="linear" submissionMode="simultaneous">
94
94
  <assessmentSection identifier="section1" title="Section 1" visible="true">
95
- <assessmentItemRef identifier="item_001" href="items/item_001.xml"/>
96
- <assessmentItemRef identifier="item_002" href="items/item_002.xml"/>
95
+ <assessmentItemRef identifier="item_001" href="../../items/item_001.xml"/>
96
+ <assessmentItemRef identifier="item_002" href="../../items/item_002.xml"/>
97
97
  </assessmentSection>
98
98
  </testPart>
99
99
  </assessmentTest>
100
100
  ```
101
101
 
102
+ > **Packaged href form:** In a generated package the assessmentTest is written to
103
+ > `tests/<sanitized-folder>/assessmentTest.xml` (two levels deep), so its item,
104
+ > stimulus, and stylesheet hrefs are rewritten to `../../items/...`,
105
+ > `../../stimuli/...`, and `../../assets/...` to resolve against the package root.
106
+
102
107
  ---
103
108
 
104
109
  ## `<assessmentSection>` - Logical Groupings
@@ -113,7 +118,7 @@ The `<assessmentSection>` element groups related items together within a test. S
113
118
  - **Section titles** - Human-readable names for each section
114
119
  - **Item shuffling** - `shuffle="true"` attribute to randomize item order
115
120
  - **Section-level time limits** - `<timeLimits>` on individual sections
116
- - **Visibility control** - `visible` attribute to show/hide sections
121
+ - **Visibility** - sections are always emitted with `visible="true"`; there is no Learnosity input path to hide a section
117
122
 
118
123
  ### Mapping to Learnosity
119
124
 
@@ -130,8 +135,8 @@ Learnosity Activities can have **sections** that map directly to QTI `<assessmen
130
135
  ```xml
131
136
  <assessmentSection identifier="section1" title="Multiple Choice Questions" visible="true" shuffle="false">
132
137
  <timeLimits maxTime="1800" allowLateSubmission="false"/>
133
- <assessmentItemRef identifier="item_001" href="items/item_001.xml"/>
134
- <assessmentItemRef identifier="item_002" href="items/item_002.xml"/>
138
+ <assessmentItemRef identifier="item_001" href="../../items/item_001.xml"/>
139
+ <assessmentItemRef identifier="item_002" href="../../items/item_002.xml"/>
135
140
  </assessmentSection>
136
141
  ```
137
142
 
@@ -170,7 +175,7 @@ When converting **Learnosity → QTI**, the converter automatically creates a si
170
175
  ```xml
171
176
  <testPart identifier="part1" navigationMode="linear" submissionMode="simultaneous">
172
177
  <assessmentSection identifier="section1" title="Section 1" visible="true">
173
- <assessmentItemRef identifier="item_001" href="items/item_001.xml"/>
178
+ <assessmentItemRef identifier="item_001" href="../../items/item_001.xml"/>
174
179
  </assessmentSection>
175
180
  </testPart>
176
181
  ```
@@ -182,9 +187,12 @@ When converting **Learnosity → QTI**, the converter automatically creates a si
182
187
  A complete QTI package is a ZIP file containing:
183
188
 
184
189
  1. **`imsmanifest.xml`** - Package manifest listing all resources
185
- 2. **`<assessmentTest>` XML files** (optional) - Test definitions
190
+ 2. **`<assessmentTest>` XML files** (optional) - Test definitions. When generated by this converter the test is written to `tests/<sanitized-folder>/assessmentTest.xml`
186
191
  3. **`<assessmentItem>` XML files** (required) - Individual questions
187
- 4. **Asset files** (optional) - Images, audio, video, etc.
192
+ 4. **`assets/css/lrn-normalize.css`** (always present in generated packages) - Utility stylesheet for converter-introduced normalization classes
193
+ 5. **Metadata files** (conditional) - `metadata/<ref>.lom.xml`, emitted only for items that carry LOM tags
194
+ 6. **Stimulus files** (conditional, QTI 2.2 only) - `stimuli/stimulus_<ref>.html` for shared passages
195
+ 7. **Asset files** (optional) - Images, audio, video, etc.
188
196
 
189
197
  ### Package Types Supported
190
198
 
@@ -214,11 +222,20 @@ A package containing both `<assessmentTest>` and `<assessmentItem>` files.
214
222
  ```
215
223
  package.zip
216
224
  ├── imsmanifest.xml
217
- ├── test.xml (assessmentTest)
218
- └── items/
219
- ├── item_001.xml
220
- ├── item_002.xml
221
- └── item_003.xml
225
+ ├── tests/
226
+ │ └── <sanitized-folder>/
227
+ │ └── assessmentTest.xml (assessmentTest; item/stimulus/asset hrefs rewritten to ../../items/, ../../stimuli/, ../../assets/)
228
+ ├── items/
229
+ │ ├── item_001.xml
230
+ │ ├── item_002.xml
231
+ │ └── item_003.xml
232
+ ├── assets/
233
+ │ └── css/
234
+ │ └── lrn-normalize.css (always present)
235
+ ├── metadata/ (conditional: only for items with LOM tags)
236
+ │ └── item_001.lom.xml
237
+ └── stimuli/ (conditional, QTI 2.2 only: shared passages)
238
+ └── stimulus_passage_1.html
222
239
  ```
223
240
 
224
241
  **Use Case:** Complete assessments with structure
@@ -312,11 +329,38 @@ $ lcon learnosity-to-qti-package --in learnosity-bundle/ --out qti-package.zip
312
329
  ```
313
330
  qti-package.zip
314
331
  ├── imsmanifest.xml
315
- ├── test.xml (assessmentTest)
316
- └── items/
317
- ├── item_001.xml
318
- ├── item_002.xml
319
- └── item_003.xml
332
+ ├── tests/
333
+ │ └── <sanitized-folder>/
334
+ │ └── assessmentTest.xml (hrefs rewritten to ../../items/…)
335
+ ├── items/
336
+ │ ├── item_001.xml
337
+ │ ├── item_002.xml
338
+ │ └── item_003.xml
339
+ └── assets/
340
+ └── css/
341
+ └── lrn-normalize.css (always present)
342
+ ```
343
+
344
+ **Manifest dependency wiring:** the test resource declares ordered dependencies
345
+ (normalize CSS first, then stimuli, then items), and every item resource depends
346
+ on the normalize CSS resource. Resource identifiers are `test_<activityRef>`,
347
+ `item_<reference>`, `stimulus_<reference>`, and `asset_lrn_normalize_css`:
348
+
349
+ ```xml
350
+ <resource identifier="test_test_001" type="imsqti_test_xmlv2p1"
351
+ href="tests/sample-test/assessmentTest.xml">
352
+ <file href="tests/sample-test/assessmentTest.xml"/>
353
+ <dependency identifierref="asset_lrn_normalize_css"/>
354
+ <dependency identifierref="item_item_001"/>
355
+ <dependency identifierref="item_item_002"/>
356
+ </resource>
357
+ <resource identifier="item_item_001" type="imsqti_item_xmlv2p1" href="items/item_001.xml">
358
+ <file href="items/item_001.xml"/>
359
+ <dependency identifierref="asset_lrn_normalize_css"/>
360
+ </resource>
361
+ <resource identifier="asset_lrn_normalize_css" type="webcontent" href="assets/css/lrn-normalize.css">
362
+ <file href="assets/css/lrn-normalize.css"/>
363
+ </resource>
320
364
  ```
321
365
 
322
366
  **Library:**
@@ -329,6 +373,11 @@ const result = convertLearnosityToQtiPackage({
329
373
  });
330
374
  ```
331
375
 
376
+ > **Default QTI version differs by entry point:** the CLI
377
+ > (`learnosity-to-qti-package`) defaults to **2.2**, while the library function
378
+ > `convertLearnosityToQtiPackage` defaults to **2.1** when `qtiVersion` is
379
+ > omitted. Pass `qtiVersion` explicitly to avoid ambiguity.
380
+
332
381
  **Result:** The Learnosity Activity becomes an `<assessmentTest>`, and each Item becomes an `<assessmentItem>`.
333
382
 
334
383
  ---