feat: add Press content mode and plugin-aware discovery - #523
Closed
Mohamed Mansour (mohamedmansour) wants to merge 3 commits into
Closed
feat: add Press content mode and plugin-aware discovery#523Mohamed Mansour (mohamedmansour) wants to merge 3 commits into
Mohamed Mansour (mohamedmansour) wants to merge 3 commits into
Conversation
Generate shell-free documentation without losing SSR and hydration. Keep native component names filename-based and resolve FAST packages through their manifests with ordinary HTML fallback. BREAKING CHANGE: default component discovery no longer derives names or template paths from CEM metadata or template/style exports. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep filename-only discovery free of package metadata parsing, hashing, and FAST export ownership analysis. Cover ordinary app-folder HTML under FAST 2 and FAST 3 and keep FAST package internals out of user-facing guides. BREAKING CHANGE: metadata-aware discovery plugins must opt into requires_package_metadata; PackageContext exposes optional manifest data instead of a package-wide ownership flag. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mohamed Mansour (mohamedmansour)
requested review from
Bang Lee (Qusic)
and
a lite review from Copilot
September 11, 2026 03:35
Copilot started reviewing on behalf of
Mohamed Mansour (mohamedmansour)
September 11, 2026 03:36
View session
Remove legacy compatibility guidance from the component and CLI references. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Four moderate discovery issues remain unresolved.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds shell-free Press content mode and plugin-aware npm component discovery while preserving SSR and hydration.
Changes:
- Adds
--show=all|content, themes, reload handling, and split shell/content styles. - Refactors native and FAST discovery, metadata loading, caching, and package resolution.
- Updates documentation, fixtures, and regression coverage.
File summaries
| File | Summary |
|---|---|
docs/guide/webui-press.md |
Documents Press content mode and regions. |
docs/guide/concepts/components/index.md |
Updates native package discovery guidance. |
docs/guide/cli/index.md |
Documents CLI and package rules. |
docs/ai.md |
Updates AI-facing guidance. |
DESIGN.md |
Documents Press and discovery contracts. |
crates/webui/src/tests/fast.rs |
Tests FAST app-folder discovery. |
crates/webui-press/tests/theme-mode.test.ts |
Tests themes, OS changes, and forced colors. |
crates/webui-press/tests/show-mode.test.ts |
Tests content/full rendering and hydration. |
crates/webui-press/tests/regions_build.rs |
Tests region behavior across modes. |
crates/webui-press/tests/native-fixture.ts |
Adds native discovery fixtures. |
crates/webui-press/template/shell.css |
Adds shell-specific layout styles. |
crates/webui-press/template/index.html |
Updates full-mode template behavior. |
crates/webui-press/template/docs.css |
Provides shared and content styling. |
crates/webui-press/template/content.html |
Adds the shell-free scaffold. |
crates/webui-press/src/types.rs |
Adds typed display-mode configuration. |
crates/webui-press/src/state.rs |
Updates shared render state. |
crates/webui-press/src/serve.rs |
Preserves show-mode overrides across reloads. |
crates/webui-press/src/main.rs |
Adds CLI handling and asset extraction. |
crates/webui-press/src/lib.rs |
Exposes show-mode APIs. |
crates/webui-press/src/content.rs |
Handles content-mode rendering. |
crates/webui-press/src/bundler.rs |
Updates aliases and bundling. |
crates/webui-press/src/build.rs |
Implements mode-specific builds. |
crates/webui-press/README.md |
Documents Press display modes. |
crates/webui-discovery/tests/scopes.rs |
Tests scoped package resolution. |
crates/webui-discovery/tests/metadata.rs |
Tests metadata isolation and caching. |
crates/webui-discovery/tests/catalog.rs |
Tests catalog discovery behavior. |
crates/webui-discovery/src/plugin/mod.rs |
Defines discovery plugin contracts. |
crates/webui-discovery/src/plugin/fast/tests.rs |
Tests FAST discovery behavior. |
crates/webui-discovery/src/plugin/fast/README.md |
Documents FAST discovery internals. |
crates/webui-discovery/src/plugin/fast.rs |
Moderate, 1 vote: validates declared exports before empty-CEM fallback; Moderate, 1 vote: prevents fallback entries from colliding with declared effective names. |
crates/webui-discovery/src/npm.rs |
Moderate, 1 vote: reports broken symlinked package entries instead of silently skipping them. |
crates/webui-discovery/src/lib.rs |
Exposes plugin-aware discovery APIs. |
crates/webui-discovery/src/catalog.rs |
Moderate, 2 votes: excludes reserved FAST template suffixes from native filename discovery. |
crates/webui-discovery/src/cache.rs |
Updates plugin-specific cache inputs. |
crates/webui-discovery/README.md |
Documents discovery behavior. |
crates/webui-cli/src/commands/build.rs |
Updates build integration. |
.gitignore |
Excludes Finder metadata. |
Review details
Suppressed comments (3)
crates/webui-discovery/src/npm.rs:156
path.is_dir()follows symlinks but returnsfalsefor a broken package symlink, so a scope request silently skips an entry such asnode_modules/@scope/pkg -> /missingand can succeed without reporting the declared member failure. Treat symlink entries as candidates and letresolve_single/canonicalizesurface the broken target, while continuing to skip ordinary non-directory files.
let path = entry.path();
if !path.is_dir() {
continue;
crates/webui-discovery/src/plugin/fast.rs:130
- When a FAST package has a
customElementsmanifest with an empty declaration list, this early return skipsexported_assets(). A malformed or escapingexports["./template.html"]is then silently ignored while ordinary HTML fallback succeeds, even though the FAST contract says invalid declared assets must be errors and an empty inventory only enables fallback. Validate the package-level export before taking this fallback path and add a regression for an empty CEM plus an invalid template export.
crates/webui-discovery/src/plugin/fast.rs:120 - The fallback inventory is filtered using the CEM
tagName, but FAST registration later replaces that key with the<f-template name>from the discovered template. If a package declaresfast-buttonwhile its template is namedcustom-buttonand also contains an ordinarycustom-button.html, both entries are returned here; parser registration then resolves them to the same tag and fails with a duplicate-component error instead of letting the declared component win as documented. Exclude fallback files using the declared templates' effective names (or resolve declared templates before collecting fallbacks), and add a regression for a CEM tag/name mismatch.
- Files reviewed: 36/37 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+25
to
+29
| pub(crate) fn template_tag(path: &Path) -> Option<&str> { | ||
| path.file_stem() | ||
| .and_then(|stem| stem.to_str()) | ||
| .filter(|stem| stem.contains('-')) | ||
| } |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Component galleries need a shell-free documentation view without losing server-rendered examples or hydration. This adds that presentation to native Press and makes component discovery follow the selected plugin's authoring conventions instead of assuming every npm package uses the same layout.
Approach
--show=all|contentto Press build and serve, defaulting toall. Content mode omits shell markup, scripts, and layout constraints before compilation while retaining metadata, authored examples, page modules, SSR, and hydration. The CLI override survives config reloads, including home/custom/404 pages.*.template.htmlresolution, with ordinary HTML fallback for undeclared components. Support symlinked packages, ancestor package/scope lookup, and npm collection spellings; report broken declared components instead of silently omitting them.Validation
cargo xtask checkAn optimized synthetic probe (7 rounds of 200 warm discoveries, one unchanged component) measured a metadata-heavy 377 KB package at roughly 1.2-1.5 ms before and 0.2-0.3 ms after the metadata opt-in change. These are shared-machine measurements, not a general throughput guarantee.