Skip to content

feat(web): export static wiki artifacts - #418

Merged
fishmingyu merged 4 commits into
mainfrom
feat/static-wiki-export
Aug 5, 2026
Merged

feat(web): export static wiki artifacts#418
fishmingyu merged 4 commits into
mainfrom
feat/static-wiki-export

Conversation

@fishmingyu

@fishmingyu fishmingyu commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

Add a versioned, deterministic static Wiki export for an existing manifest-backed repository.

The export targets GitHub Pages and other serverless hosts. It preserves repository and view provenance while exposing only capabilities with a real browser-side implementation. Closes #416 and advances H1 of #415.

Changes

  • Add codenib export <repo> with output and Pages mount-path options
  • Write codenib-static.json with repository identity, commit, source fingerprint, source-location semantics, view provenance, generation metadata, and per-file SHA-256 digests
  • Load only the views required to construct pages, without initializing an embedding provider
  • Embed page citation snippets and precompute available page-level graph payloads
  • Reject checkout/manifest mismatches, unsafe source paths, unrelated output directories, symlinked frontend assets, configured credentials, and raw or JSON-escaped build paths
  • Add a static frontend data adapter, mount-aware routing, 404 route recovery, and honest capability gating
  • Preserve query and fragment links without a global HTML base, and disambiguate repository routes whose first segment matches the Pages mount
  • Document the static serving boundary and CLI flow

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Performance improvement
  • Tests

Testing

  • Tests pass locally

  • Added new tests for the changes

  • unit tier: 2546 passed, 10 skipped

  • static export: 17 passed after the final restack

  • frontend: 19 passed; production build completed

  • strict MkDocs build

  • pre-commit run --all-files

  • real pallets/itsdangerous@672971d6 export mounted at /itsdangerous: Playwright loaded the overview route at /itsdangerous/itsdangerous with no console or resource errors

  • desktop and 390px mobile captures plus direct deep-link smoke

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented code where the behavior is not self-explanatory
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Copilot AI lite review requested due to automatic review settings August 5, 2026 04:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 5, 2026 04:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Copy link
Copy Markdown

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: 2ed166d0a7

ℹ️ 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 thread web/index.html Outdated
<!doctype html>
<html lang="en" data-theme="light">
<head>
<base href="/" />

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 Keep relative links scoped to the active repo

With this global <base href="/">, any wiki content link that is intentionally relative to the current repo route stops resolving against /<repoId>. For example, WikiBuilder emits module links like ?p=mod__..., and the right-rail uses #heading; after this tag those resolve to /?p=... or /#heading (or the static mount root) instead of the current wiki page, so clicking generated module or in-page navigation links drops the user onto the landing/root route rather than switching sections.

Useful? React with 👍 / 👎.

Comment thread codenib/web/static_export.py Outdated
forbidden_paths: Iterable[Path],
environ: Mapping[str, str],
) -> None:
forbidden = [str(path.resolve()).encode("utf-8") for path in forbidden_paths]

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 Reject JSON-escaped Windows paths too

When exporting on Windows, forbidden checkout paths contain backslashes, but all page and manifest JSON is written via json.dumps, which serializes those backslashes as escaped characters. This scan only searches for the raw path bytes, so a citation snippet or metadata field containing a drive-letter checkout path can pass _assert_publishable and still be published despite the no build-machine-path guarantee; include the JSON-escaped form or inspect decoded JSON before accepting the export.

Useful? React with 👍 / 👎.

Copilot AI review requested due to automatic review settings August 5, 2026 08:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added type/docs Documentation type/test Test-related labels Aug 5, 2026
Copilot AI review requested due to automatic review settings August 5, 2026 08:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Mount only document startup assets at the Pages base path so generated query and hash links keep browser-relative semantics. Detect JSON-escaped build paths during publication validation.
Copilot AI review requested due to automatic review settings August 5, 2026 08:39
@fishmingyu
fishmingyu force-pushed the feat/static-wiki-export branch from 047c3c4 to d11e97b Compare August 5, 2026 08:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@fishmingyu
fishmingyu merged commit 0a9503f into main Aug 5, 2026
4 of 5 checks passed
@fishmingyu
fishmingyu deleted the feat/static-wiki-export branch August 5, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/docs Documentation type/test Test-related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(web): export a versioned static Wiki artifact

2 participants