Skip to content

Add private gallery module page generation#394

Merged
PrzemyslawKlys merged 1 commit into
mainfrom
codex/portal-module-pages
May 24, 2026
Merged

Add private gallery module page generation#394
PrzemyslawKlys merged 1 commit into
mainfrom
codex/portal-module-pages

Conversation

@PrzemyslawKlys
Copy link
Copy Markdown
Member

Summary

  • add a reusable portal-module-pages pipeline task that turns private-gallery/feed JSON plus portal docs JSON into static Markdown module pages
  • generate module index/detail pages, install/update snippets, commands, dependencies, versions, and linked repository/package docs
  • document the task and cover generator + pipeline behavior with focused tests

Validation

  • dotnet test .\PowerForge.Tests\PowerForge.Tests.csproj -c Release --filter "PortalModulePagesTests|PortalDocsIndexTests"
  • dotnet build .\PowerForge.Web.Cli\PowerForge.Web.Cli.csproj -c Release --no-restore
  • PowerShellGalleryDemo local CI build with POWERFORGE_ROOT pointing at this branch
  • browser smoke on http://localhost:8091/modules/pspublishmodule/ and generated doc pages, no console errors

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cce3e68892

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +127 to +129
var slug = Slugify(package.Name);
var moduleDir = Path.Combine(outputDirectory, slug);
Directory.CreateDirectory(moduleDir);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Disambiguate module output directories

Generate uses Slugify(package.Name) as the module folder key, so two distinct package names that normalize to the same slug (for example Contoso.Tools and Contoso-Tools) will write to the same index.md path and silently overwrite one module page with the other. This causes broken/ambiguous module navigation in the generated site whenever a feed contains such names.

Useful? React with 👍 / 👎.

Comment on lines +186 to +188
var docSlug = Slugify(FirstNonEmpty(doc.Title, Path.GetFileNameWithoutExtension(doc.Path), doc.Id, "document")!);
var docDir = Path.Combine(outputDirectory, $"{moduleSlug}-{docSlug}");
Directory.CreateDirectory(docDir);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ensure generated doc page paths are unique per document

Document page directories are based only on moduleSlug plus a slugified title/path stem, so multiple module docs that share the same title (common with files like README.md or repeated headings) resolve to the same folder and overwrite each other. In that case the later document wins and earlier content becomes unreachable even though both entries are listed.

Useful? React with 👍 / 👎.

Comment on lines +11 to +15
var outputDirectory = ResolvePath(baseDir,
GetString(step, "out") ??
GetString(step, "output") ??
GetString(step, "outputDirectory") ??
GetString(step, "output-directory") ??
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Validate raw output path before resolving it

This resolves the configured output path before checking whether it was provided, so an explicit empty value like "out": "" resolves to baseDir instead of being rejected. The generator then calls ResetDirectory(outputDirectory), which recursively deletes that directory; with this input it can wipe the site/repo root rather than just generated module content.

Useful? React with 👍 / 👎.

Comment on lines +442 to +443
private static string EscapeYaml(string? value)
=> (value ?? string.Empty).Replace("\\", "\\\\", StringComparison.Ordinal).Replace("\"", "\\\"", StringComparison.Ordinal);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Escape newline characters in YAML front matter values

Front-matter fields are wrapped in double quotes, but EscapeYaml only escapes backslashes and quotes; it leaves raw \r/\n characters intact. If a module title/description contains line breaks (common in package metadata), the generated header becomes invalid YAML and page parsing can fail for that module.

Useful? React with 👍 / 👎.

@PrzemyslawKlys PrzemyslawKlys force-pushed the codex/portal-module-pages branch from cce3e68 to b0efba9 Compare May 24, 2026 10:57
@PrzemyslawKlys PrzemyslawKlys merged commit 080422f into main May 24, 2026
6 checks passed
@PrzemyslawKlys PrzemyslawKlys deleted the codex/portal-module-pages branch May 24, 2026 11:07
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.

1 participant