coursecode 0.1.25 → 0.1.26

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.
@@ -664,7 +664,7 @@ Runs **in Node.js** during build (via `vite.framework-dev.config.js` `closeBundl
664
664
 
665
665
  ### MCP `coursecode_lint` — Unified Results
666
666
 
667
- The MCP `coursecode_lint` tool always runs the build linter. When the preview server is running and the headless browser is connected, it also merges runtime lint results (contrast, touch targets, spacing, layout) into the same response. Runtime-sourced items are tagged with `source: 'runtime'` and `rule: 'runtime-lint'`. The `runtimeLintIncluded` flag in the response indicates whether runtime checks were included. This gives AI agents a single, low-token-cost tool for all lint results without needing to pull the full course state via `coursecode_state`.
667
+ The MCP `coursecode_lint` tool always runs the build linter. When the preview server is running and the headless browser is connected, it also merges runtime errors from the preview server's error log into the same response. These are the same errors shown in the debug panel's Errors tab and returned by `coursecode_state` — LMS API misuse, console errors, uncaught exceptions, and data limit warnings. Runtime-sourced items are tagged with `source: 'runtime'` and `rule: 'runtime-error'`. The `runtimeLintIncluded` flag in the response indicates whether runtime errors were included. This gives AI agents a single tool for both static lint and runtime errors without needing a separate `coursecode_state` call.
668
668
 
669
669
  ### Shared Rules (`lib/validation-rules.js`)
670
670
 
@@ -308,13 +308,13 @@ Use to discover available interactions before creating assessments.`,
308
308
  name: 'coursecode_lint',
309
309
  description: `Run the course linter and get structured results.
310
310
 
311
- Always runs build-time lint (config, CSS classes, structure). When the preview server is running and the headless browser is connected, also includes runtime lint results (contrast, touch targets, spacing, layout).
311
+ Always runs build-time lint (config, CSS classes, structure). When the preview server is running and the headless browser is connected, also includes runtime errors from the preview server (same errors shown in coursecode_state and the debug panel Errors tab).
312
312
 
313
313
  Returns:
314
314
  - errors: [{slideId?, rule, message, severity, source?, hint?}]
315
315
  - warnings: [{slideId?, rule, message, severity, source?, class?, suggestion?, hint?}]
316
316
  - passed: boolean
317
- - runtimeLintIncluded: boolean (true when runtime checks were included)
317
+ - runtimeLintIncluded: boolean (true when runtime errors were included)
318
318
 
319
319
  Build-time rules (always checked):
320
320
  - undefined-css-class: hallucinated or stale class names (with fix suggestions)
@@ -325,11 +325,11 @@ Build-time rules (always checked):
325
325
  - assessment-id-mismatch: config ID doesn't match assessment ID
326
326
  - invalid-gating: bad gating condition configuration
327
327
 
328
- Runtime rules (included when preview is running, source='runtime'):
329
- - Contrast ratio violations
330
- - Touch target size violations
331
- - Spacing issues (missing gap, margin, padding)
332
- - Text proximity to borders, element overlap, styled lists
328
+ Runtime errors (included when preview is running, source='runtime'):
329
+ - LMS API misuse (GetValue before Initialize, SetValue after Terminate, etc.)
330
+ - Console errors and warnings from the course
331
+ - Uncaught exceptions and unhandled promise rejections
332
+ - Suspend data size warnings
333
333
 
334
334
  Suppression: Add data-lint-ignore to any HTML element to suppress warnings for it and children.
335
335
  data-lint-ignore — suppress all warnings
package/lib/mcp-server.js CHANGED
@@ -247,12 +247,13 @@ export async function startMcpServer(options = {}) {
247
247
  break;
248
248
  case 'coursecode_lint':
249
249
  result = await lintCourse();
250
- // Merge runtime lint errors if headless browser is already connected
250
+ // Merge runtime errors if headless browser is already connected
251
251
  if (headless.isRunning()) {
252
252
  try {
253
253
  const runtimeErrors = await headless.evaluateParent(() => {
254
254
  return window._stubPlayerState?.errorLog || [];
255
255
  });
256
+ result.runtimeLintIncluded = true;
256
257
  if (runtimeErrors.length > 0) {
257
258
  const runtimeWarnings = runtimeErrors.filter(e => e.isWarning);
258
259
  const runtimeErrs = runtimeErrors.filter(e => !e.isWarning);
@@ -260,9 +261,10 @@ export async function startMcpServer(options = {}) {
260
261
  result.warnings = (result.warnings || []).concat(
261
262
  runtimeWarnings.map(e => ({
262
263
  severity: 'warning',
264
+ type: e.type,
263
265
  message: e.message,
264
266
  hint: e.hint,
265
- rule: 'runtime-lint',
267
+ rule: 'runtime-error',
266
268
  source: 'runtime'
267
269
  }))
268
270
  );
@@ -272,16 +274,16 @@ export async function startMcpServer(options = {}) {
272
274
  result.errors = (result.errors || []).concat(
273
275
  runtimeErrs.map(e => ({
274
276
  severity: 'error',
277
+ type: e.type,
275
278
  message: e.message,
276
279
  hint: e.hint,
277
- rule: 'runtime-lint',
280
+ rule: 'runtime-error',
278
281
  source: 'runtime'
279
282
  }))
280
283
  );
281
284
  result.errorCount = result.errors.length;
282
285
  result.passed = result.errors.length === 0;
283
286
  }
284
- result.runtimeLintIncluded = true;
285
287
  }
286
288
  } catch {
287
289
  // Headless browser may have disconnected — non-fatal, build lint still valid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coursecode",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "description": "Multi-format course authoring framework with CLI tools (SCORM 2004, SCORM 1.2, cmi5, LTI 1.3)",
5
5
  "type": "module",
6
6
  "bin": {