Commit Graph

4 Commits

Author SHA1 Message Date
Ashley Hunter 1b743f8019 test: migrate from jest to vitest with browser testing for brain/helm
Replace Jest with Vitest across the workspace. The brain and helm Angular suites
now run in a real browser (Playwright/Chromium via Vitest browser mode) so they
exercise real layout, focus, pointer events and computed styles that jsdom could
not. The cli, tools, mcp, registry and cli-smoke suites run on Vitest's node
environment.

- Add per-project vite configs and switch test targets to @nx/vitest:test
- Convert jest APIs to vi.* and jest module mocks to vi.mock with importOriginal
- Replace jest-axe with a browser-native axe-core helper and toHaveNoViolations
- Regenerate snapshots in vitest format (content unchanged, format-only)
- Remove all jest packages, configs, the preset and the @nx/jest target default
- Install Playwright Chromium in the CI unit job for the browser suites

Also fixes a brain avatar test that asserted inside a fire-and-forget setTimeout,
which passed vacuously under jsdom and only surfaced once a real browser loaded
the image.
2026-06-13 15:16:45 +01:00
Ashley Hunter c8d97abb42 fix(mcp): make the library publishable and harden the server
Make @spartan-ng/mcp publishable and runnable as an MCP server:
- align package metadata, bin, and publishConfig, and add a release target
- bump zod to ^3.25 so it satisfies the MCP SDK peer range, without which
  the server fails to start
- route cache and warmup logging to stderr so it never corrupts the stdio
  JSON-RPC channel
- validate cache keys to prevent path traversal and default the cache to a
  writable user directory
- fix component example rendering, meta tool ids, language detection, and
  peer-dependency analysis
- add unit tests and a documentation page for the MCP server
2026-06-03 21:02:33 +01:00
SOG-web de10eee885 fix(mcp): resolve lint errors, path traversal, and cross-platform issues
- Add public modifier to currentVersion (explicit-member-accessibility)
- Fix validateVersion to reject '.' and '..' path traversal
- Use pathToFileURL for cross-platform main-module check
- Remove unused variables and parameters
- Namespace block cache keys by format
- Remove redundant fetchContent call in docs.ts
- Rename private fields with underscore prefix (_cacheDir, _cacheMetadata)
- Add lint target to project.json
- Add missing dependency declarations to package.json
2026-05-28 11:56:27 +01:00
SOG-web fc90194a71 refactor(mcp): rename ui-mcp to mcp and apply code quality fixes
Rename the library from @spartan-ng/ui-mcp to @spartan-ng/mcp, move
libs/ui-mcp to libs/mcp, and update all workspace references. Add mcp
as a valid commitlint scope.

- Remove private flag so the package can be published
- Fix npm package extraction to preserve hyphenated names
- Run all analyzers when building accessibility overview score
- Branch blocks cache by format (text vs html) to prevent corruption
- Mark unused version parameters with underscore prefix
- Add explicit member accessibility modifiers to CacheManager fields
- Validate version strings in switchVersion to prevent path traversal
- Remove unused DOCUMENTATION_TOPICS import from docs.ts
- Key docs cache by topic+format to avoid cross-format responses
- Add AbortController timeouts to fetch calls in health.ts and utils.ts
- Remove irrelevant Brain API/Helm API copy from meta.ts instructions
- Replace collision-prone code ID with SHA-256 hash
- Relax preCodeRegex to allow whitespace between pre and code tags
2026-05-21 20:28:56 +01:00