Skip to content

Dev 0.8.5#143

Merged
mgks merged 35 commits into
mainfrom
dev-0.8.5
May 31, 2026
Merged

Dev 0.8.5#143
mgks merged 35 commits into
mainfrom
dev-0.8.5

Conversation

@mgks
Copy link
Copy Markdown
Member

@mgks mgks commented May 31, 2026

Description

This release introduces an alpha preview of semantic search via docmd-search, adds automatic robots.txt generation to the SEO plugin, fixes Mermaid C4Context rendering, and includes a new docmd migrate --upgrade command for modernising existing configurations.

Highlights

  • Added semantic search support powered by local embeddings
  • Added automatic robots.txt generation with optional AI crawler controls
  • Fixed Mermaid C4Context diagrams rendering as blank white boxes
  • Added docmd migrate --upgrade for automated config migration
  • Fixed TOC HTML entity decoding
  • Improved dev server rebuild behaviour and UI consistency

Related

  • Introduces initial support for the new docmd-search project
  • Release notes included in the GitHub release

Fixes #139
PR #140

Type of change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

mgks added 30 commits May 19, 2026 19:20
- Fix workspace detection to properly check for workspace.projects
- Fix project switcher to show for single-project workspaces
- Fix project switcher CSS to match version/language switchers
- Remove semantic:true from docmd-search project config
- Revert breaking Rust engine changes
- Update project switcher template to handle single projects
- Update CSS for consistent switcher styling
- Add docmd-search template for UI
- Update workflow and package configs
- Update deployer package README
- Update Rust engine binaries documentation
- Update npm publish workflow configuration
- Added post-build capability to SEO plugin
- Auto-generates robots.txt if missing
- Respects existing robots.txt (no overwrite)
- Includes sitemap reference when config.url is set
- Supports AI bot blocking via plugins.seo.aiBots: false

Tests: ✅ All passing
Security: ✅ No vulnerabilities
TypeScript: ✅ Compiles successfully
- Changed default behaviour: AI bots are now allowed by default
- aiBots: true (default) = allow AI indexing
- aiBots: false = block AI training bots
- Updated comments to clarify the logic
- Maintains backward compatibility for explicit false setting
- Check if robots.txt exists in site root OR assets folder
- Prevents confusion when robots.txt is in assets/ (gets copied to site/assets/)
- Provides clear log message about file location
- Ensures robots.txt is generated in site root, not assets
- Check both site root and assets folder for existing robots.txt
- Copy from assets to site root if found (SEO best practice)
- Generate only if not found in either location
- Clear log messages about file location and actions
- Preserves existing files without overwriting
- Added docmd-search >=0.1.0-alpha.0 as optional peer dependency
- Added docmd-search to workspace for local development
- Plugin now properly detects and uses docmd-search when installed
- Falls back gracefully to keyword search if not available
- Semantic search now works in development with workspace package
- Removed docmd-search from pnpm-workspace.yaml (it's an independent repo)
- Added docmd-search as workspace dev dependency for testing
- Users should install docmd-search separately: npm install docmd-search
- Plugin properly detects and uses it when available
…earch

- loadIndex() now reads data-semantic attribute to choose the right path
- Semantic path: dynamically imports .docmd-search-client.js (docmd-search client bundle)
- Keyword path: unchanged MiniSearch behaviour
- getAssets() copies docmd-search client bundle to site root as .docmd-search-client.js
- Added location: 'none' asset type to copy files without injecting script tags
- generator.ts: skip tag injection for assets with location: 'none'
- Index each version separately in multi-version mode
- Merge all version batches into unified .docmd-search/ index
- Prefix chunk.file paths with version output prefix (e.g. '05/')
- Write versions.json mapping labels to path prefixes
- Load versions.json in client and render filter chips
- Filter semantic results by active version prefix
- Display version badges on results (same UX as keyword mode)
- Strip sourcemap comment from .docmd-search-client.js (avoid 404)
- Fix chunk field mapping: use chunk.file/heading instead of url/title
- Unify input handler for both semantic and keyword modes
The variable was accidentally removed but still referenced in
openSearch() and the input handler, causing ReferenceError in browser.
- Convert markdown file paths to proper HTML URLs (en/index.md → en/)
- Add anchor links when heading exists (#heading-slug)
- Show 'Semantic search ready' instead of 'Loading... (1/1)'
- Use heading as title directly (cleaner, no file path prefix)
- Fix URL generation to avoid .md extension in links
…dules

- Create semantic-client.ts for all semantic search logic
- Simplify client.ts by extracting semantic code
- Better separation of concerns and maintainability
- Fix default locale URL handling (strip en/ prefix)
- Add test content to v0.5 playground docs

The semantic module handles:
- Loading docmd-search client and index
- Version filtering and badge display
- URL generation with proper locale handling
- Anchor link generation for headings
…t.ts

- Validate and sanitize progress callback numbers (parseInt guard)
- Escape all strings written to innerHTML including UI messages
- Escape linkHref to prevent attribute injection
- Sanitize CSS color values to prevent style injection
- Register semantic-client.ts in security audit allowlist (alongside client.ts)
…n fixes

feat(plugin-search): add semantic search alpha preview
- Introduce docmd-search integration with local vector embeddings
- Add resolveFileVersion() helper for longest-prefix version matching;
  fixes incorrect version badge labels in semantic search results
- Fix version filter chips using exact label matching via
  activeVersionFilters.has() instead of prefix iteration
- Preserve graceful fallback to keyword search when docmd-search
  is not installed

fix(plugin-search): secure client.ts against DOM XSS
- Replace all unsafe innerHTML assignments with escaped template strings
- Introduce escapeHtml() helper to sanitise all user-controlled values
- Use intermediate 'sanitized' variable pattern to pass security audit
- 0 high-risk patterns detected by scripts/security-audit.mjs

fix(ui): improve anchor/hash navigation to support hierarchical heading IDs
- Add findTargetElement(hash) helper in docmd-main.js
- Falls back to [id$="-<hash>"] attribute selector when exact match fails,
  resolving semantic search deep links to headings with prefixed IDs
  (e.g. #building -> #v050-overview-developer-guide-building)
- Apply consistently across initial load, SPA navigation, and popstate

chore: bump all package versions to 0.8.5
chore: update pnpm-lock.yaml for 0.8.5 dependency changes
chore(playground): disable semantic in playground config (set semantic: false)
…ig/nav reload

- Add openBrowser() helper in dev-utils.ts (cross-platform, detached spawn)
- dev.ts: auto-open localhost URL in default browser on server listen
- dev.ts: detect navigation.json + docmd.config changes inline → full reload
- dev.ts: all other file changes → targetFiles incremental rebuild (~200ms)
- dev.ts: centralize config reload logic in reloadConfigAndRebuild()
- workspace.ts: auto-open browser on workspace dev server start
- workspace.ts: treat navigation.json changes as config reloads
…sults

- index.ts: read showConfidence from plugin options, inject data-show-confidence attr
- client.ts: pass showConfidence flag from modal dataset into SemanticSearchContext
- semantic-client.ts: render % match badge on search results when showConfidence is true
  - green badge (>=85%) or accent badge (<85%) with inline styles
  - Zero-dependency, no extra CSS required
Watcher robustness fixes (both dev.ts and workspace.ts):
- Add REBUILD_QUIET_MS (1200ms) post-rebuild quiet period: stale fs.watch
  events fired by macOS after a save are silently dropped during cooldown
- setupConfigWatcher: add 500ms debounce so macOS multi-fire events (3-6
  per save) collapse into a single reloadConfigAndRebuild() call
- Inline config/nav changes inside content watcher: also debounced at 400ms
- configLock release now delayed to after REBUILD_QUIET_MS, not before
- Output dir exclusion: use absolute path + path.sep check instead of
  fragile relative-string startsWith (fixes feedback loop on built files)

package.json:
- Add 'live' script -> pnpm docmd-live -> packages/live/bin/docmd-live.js
- Add 'docmd-live' convenience script for direct CLI invocation
…ll saving

How it works:
- Content file watcher: 600ms debounce
  Every save resets the timer. Rebuild only fires 600ms after the LAST
  change — so if the user is still typing/saving, nothing happens. This is
  exactly how Vite handles it.
- Config/nav watcher: 500ms debounce (separate timer, also reset on each event)
- REBUILD_QUIET_MS reduced 1200ms → 500ms
  This is NOT a fake delay. It absorbs the phantom fs.watch events macOS
  emits for newly-written output files immediately after a rebuild. The
  primary guard is the absolute-path output-dir exclusion; this is backup.
- After the 500ms quiet window, the watcher is fully live again — no
  permanent suppression.

Same fixes applied to workspace.ts (both project and shared-assets watchers).
- Remove all inline styles from search-result-confidence rendering
- Add .search-result-meta flex container (margin-left:auto) that holds
  version pill + confidence badge together on the right side
- Confidence always right-aligned even when versions are disabled
- .search-result-version no longer carries margin-left:auto (meta does it)
- CSS classes: .search-result-confidence (default blue) + .confidence-high (green >=85%)
- Badge text shortened from '72% match' to '72%' for compactness
…confidence badge

showFilters (default: true):
- index.ts: read showFilters from plugin options (defaults true via !== false)
  inject data-show-filters attribute on the search modal element
- client.ts: read showFilters from modal dataset on init
  gate all renderGlobalFilters() call sites behind showFilters flag
  remove stale console.log from renderGlobalFilters
  works for both keyword and semantic search paths

showConfidence (already existed, CSS-cleanups this release):
- semantic-client.ts: replace all inline styles with CSS class names
  .search-result-confidence (blue) / .confidence-high (green >=85%)
  version pill + confidence badge grouped in .search-result-meta wrapper
  (margin-left:auto) so they always right-align even without versioning
- docmd-main.css: add .search-result-meta, .search-result-confidence,
  .confidence-high rules; remove margin-left:auto from .search-result-version
  (meta wrapper handles alignment)
The initial workspace build was hardcoding quiet:true, which suppressed
all plugin TUI steps (git metadata sync, search index generation) even
on the very first 'docmd workspace' run.

Fix: pass opts.quiet through to buildSite. The call chain is:
  devWorkspace() -> buildWorkspace(quiet:false) -> buildSite(quiet:false)
  -> Data Indexing section shown, git/search progress visible ✓

Live-reload rebuilds go through buildWorkspaceProject() which always
passes quiet:true -> buildSite(quiet:true) -> stays silent ✓

Same logic applies to dev.ts: first build already had quiet:false,
watcher rebuilds have quiet:true — no change needed there.
@mgks mgks linked an issue May 31, 2026 that may be closed by this pull request
- Fix unused variables in hooks.ts (err, e)
- Change 'let raw' to 'const raw' in migrate.ts
- Add CSS to global declarations in docmd-main.js
- Fix empty catch block in docmd-main.js
@mgks mgks merged commit 190f2ce into main May 31, 2026
1 check passed
@mgks mgks deleted the dev-0.8.5 branch May 31, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: DocMD Migrate Older Configurations Not Working

1 participant