coursecode 0.1.31 → 0.1.32

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` — Build-Time Only
666
666
 
667
- The MCP `coursecode_lint` tool runs the build linter (config validation, CSS class verification, structure checks). It does NOT include runtime errors. For runtime errors, contrast warnings, and other dynamic issues, use `coursecode_state` which returns `frameworkLogs` and `errors` from the preview server.
667
+ The MCP `coursecode_lint` tool runs the build linter (config validation, CSS class verification, structure checks). It does NOT include runtime errors. For runtime errors and contrast warnings, use `coursecode_errors` (lightweight just errors and console logs) or `coursecode_state` (full state snapshot including errors).
668
668
 
669
669
  ### Shared Rules (`lib/validation-rules.js`)
670
670
 
@@ -873,6 +873,7 @@ If the preview is not running, runtime tools fail fast with a clear error messag
873
873
  | Tool | Purpose | Returns |
874
874
  |------|---------|--------|
875
875
  | `coursecode_state` | Full course snapshot | `{slide, toc, interactions, engagement, lmsState, apiLog, errors, frameworkLogs, consoleLogs}` |
876
+ | `coursecode_errors` | Errors + console logs only | `{errors, consoleLogs, count, clean}` — same error sources as `coursecode_state`, without the state payload |
876
877
  | `coursecode_navigate` | Go to slide by ID | `{slide, interactions, engagement, accessibility}` |
877
878
  | `coursecode_interact` | Set response + evaluate | `{interactionId, response}` → `{correct, score, feedback}` |
878
879
  | `coursecode_screenshot` | Visual capture (JPEG) | Optional `slideId` to navigate first, `fullPage` for scroll capture |
@@ -34,6 +34,29 @@ Returns:
34
34
  - consoleLogs: browser console warnings/errors [{type, text, time}]
35
35
 
36
36
  Use this first to understand the course state before taking actions.
37
+ For error checking only (after file edits), prefer coursecode_errors — same error sources, smaller payload.
38
+ Requires preview server to be running.`,
39
+ inputSchema: {
40
+ type: 'object',
41
+ properties: {},
42
+ required: []
43
+ },
44
+ annotations: {
45
+ readOnlyHint: true,
46
+ idempotentHint: true
47
+ }
48
+ },
49
+ {
50
+ name: 'coursecode_errors',
51
+ description: `Get runtime errors and warnings from the live preview. Uses the same error sources as coursecode_state (preview server errors + browser console) but without the heavyweight state payload.
52
+
53
+ Returns:
54
+ - errors: [{type, message, hint?, isWarning?}] — preview server errors and warnings
55
+ - consoleLogs: [{type, text, time}] — browser console warnings/errors
56
+ - count: total number of errors + console logs
57
+ - clean: true if no errors, warnings, or console issues
58
+
59
+ Use after making file changes to check for breakage without the overhead of coursecode_state.
37
60
  Requires preview server to be running.`,
38
61
  inputSchema: {
39
62
  type: 'object',
@@ -406,7 +429,6 @@ Use to discover available icons before authoring slides or configuring menus.`,
406
429
  readOnlyHint: true,
407
430
  idempotentHint: true
408
431
  }
409
- },
410
432
 
411
433
  ];
412
434
 
package/lib/mcp-server.js CHANGED
@@ -231,6 +231,30 @@ export async function startMcpServer(options = {}) {
231
231
  }
232
232
  break;
233
233
 
234
+ case 'coursecode_errors': {
235
+ // Same error-gathering mechanism as coursecode_state,
236
+ // but without the heavyweight state payload (TOC, interactions, etc.)
237
+ await ensureHeadless(port);
238
+ let errors = [];
239
+ try {
240
+ const errResp = await fetch(`http://localhost:${port}/__lms/errors`);
241
+ if (errResp.ok) {
242
+ const errData = await errResp.json();
243
+ errors = [...(errData.errors || []), ...(errData.warnings || [])];
244
+ }
245
+ } catch {
246
+ // Preview server unreachable — errors array stays empty
247
+ }
248
+ const consoleLogs = headless.getConsoleLogs();
249
+ result = {
250
+ errors,
251
+ consoleLogs,
252
+ count: errors.length + consoleLogs.length,
253
+ clean: errors.length === 0 && consoleLogs.length === 0
254
+ };
255
+ break;
256
+ }
257
+
234
258
  // === Workflow & build tools ===
235
259
  case 'coursecode_workflow_status':
236
260
  result = await getWorkflowStatusWithInstructions(port);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coursecode",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
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": {