This file instructs AI agents on how to understand, navigate, and contribute to this project correctly.
UIHTML Debugger Toolkit is an open-source MATLAB project containing two primary tools for uihtml development:
- Console Error Rerouter — Intercepts JavaScript
consolecalls and forwards them to the MATLAB Command Window. - UIHTML DevTools — Injects the Eruda dev tools into a
uihtmlcomponent for on-page inspection.
uihtml-debugger/
├── AGENTS.md ← you are here
├── README.md
├── LICENSE
├── uihtml-debugger.prj ← MATLAB Toolbox Project file
│
├── toolbox/ ← packageable toolbox content
│ ├── ConsoleErrorRerouter.m ← Rerouter class
│ ├── UIHTMLDevTools.m ← DevTools injector class
│ ├── Support/ ← Internal shims (e.g., shim_lines.js)
│ ├── vendor/ ← Third-party libraries (e.g., eruda.js)
│ └── examples/
│ ├── basic_usage.m
│ ├── custom_formatting.m
│ ├── devtools_usage.m ← Full toolkit demonstration
│ └── html/
│
└── tests/ ← unit tests
├── tConsoleErrorRerouter.m
├── tUIHTMLDevTools.m ← Combined DevTools tests
├── MockComponent.m ← Testing utility for handle mocks
└── html/
- Style: Follow MathWorks MATLAB style guidelines.
lowerCamelCasefor variables and function names.UpperCamelCasefor class names and properties.- Lines must not exceed 100 characters.
- Classes: Use
classdefwithpropertiesblocks. Document every public property and method. - Error IDs: Use namespaced error IDs in all
error()calls:error('uihtmlDebugger:badArgument', '...'). - Backward compatibility: Target MATLAB R2023a and later.
- ES5 compatible for shims to ensure maximum browser compatibility.
- Vendor libraries (like Eruda) are managed in
toolbox/vendor/.
| Member | Type | Description |
|---|---|---|
Enabled |
Property (logical) |
Toggles rerouting. |
ErrorLevels |
Property (string array) |
Levels to intercept ("error", "warn", etc.). |
FormatFcn |
Property (function_handle) |
Custom output formatter. |
| Member | Type | Description |
|---|---|---|
Enabled |
Property (logical) |
Toggles Eruda injection. |
- Add new methods or properties that are additive and backward-compatible.
- Add new tests to
tests/. - Add new example scripts under
examples/. - Improve inline documentation.
- Remove or rename public properties/methods listed above.
- Introduce new toolbox dependencies.
- Use
evalin MATLAB code.
Tests use the matlab.unittest framework.
Run all tests:
results = runtests('tests/');
disp(results);Coverage Target: Maintain at least 85% code coverage for classes in toolbox/.
The project uses GitHub Actions (.github/workflows/matlab-tests.yml) to:
- Run tests on every PR and push to
main. - Package the toolbox (
.mltbx) on every push tomain. - Create a GitHub Release when a version tag (e.g.,
v1.2.3) is pushed.