Skip to content

feat(docs): add MkDocs documentation site with showcase landing page - #91

Draft
oto-macenauer-absa wants to merge 3 commits into
masterfrom
feature/docs-showcase-site
Draft

feat(docs): add MkDocs documentation site with showcase landing page#91
oto-macenauer-absa wants to merge 3 commits into
masterfrom
feature/docs-showcase-site

Conversation

@oto-macenauer-absa

@oto-macenauer-absa oto-macenauer-absa commented Jul 27, 2026

Copy link
Copy Markdown

Release Notes

  • Added a documentation site built with MkDocs and a custom theme. It publishes a showcase landing page presenting the repository's reusable workflows, an overview page, and the Security Automation documentation.
  • Navigation is generated automatically from page frontmatter, so adding a Markdown page under docs/ is enough to publish it.
  • Documentation dependencies are isolated in requirements-docs.txt; the product requirements.txt gains only the types-PyYAML stubs needed by the type checker.
  • Absolute links in docs/security/security.md were broken both on GitHub and in the rendered site; they now resolve correctly.

Summary

Adds a self-contained documentation site to the repository, built with MkDocs and a custom Jinja2 theme (following the knowledge-base-docs-example template). The site presents Organizational Workflows as a collection of reusable workflows, with Security Automation as a spotlight section, and renders docs/security/security.md as a themed documentation page.

What is added

Path Purpose
mkdocs.yml / mkdocs-headless.yml Site config (docs_dir: docs, site_dir: dist/docs)
theme/main.html, theme/style.css Custom page template (top nav, sidebar, dark-mode toggle) + pre-built CSS
data/showcase.yml, showcase.css Landing page content and styles
docs/index.md Overview page
docs/assets/images/hero.png Hero background image
scripts/pack.py, scripts/pack.sh, run.js, package.json Build and packaging pipeline
marketplace.json Knowledge base manifest
requirements-docs.txt Docs-only dependencies (MkDocs, Jinja2)

Product requirements.txt is untouched — documentation dependencies are kept separate.

Landing page structure

Hero (repository description) → what this is (6 cards) → how adoption works (3 steps) → solutions catalogue → Security Automation spotlight (5-stage pipeline, benefits, links) → CTA → footer.

Build

python scripts/pack.py              # standalone build -> dist/ + dist.tar.gz
python scripts/pack.py --headless   # knowledge-base build (no top nav)
python scripts/pack.py --no-package # dist/ only
npm run dev                         # live-reload dev server

Navigation is auto-generated from page frontmatter (title, order, section) — no manual nav: maintenance.

Changes to existing files

  • .gitignore: ignores dist/, dist.tar.gz, generated build configs, node_modules/.
  • docs/security/security.md: frontmatter added (title, order). Content is otherwise unchanged apart from four absolute links (/src/security/README.md, /docs/security/aquasec-night-scan-example.yml, /README.md) that resolved to the site root and were broken both on GitHub and in the built site — they now point at GitHub blob URLs or site-relative paths.

Deviations from the template

  • Mermaid rendering: the template has no mermaid support. The pymdownx.superfences approach requires a !!python/name: YAML tag, which breaks yaml.safe_load in scripts/pack.py. Fenced ```mermaid blocks are therefore converted client-side in theme/main.html; if the CDN is unreachable they degrade to readable code blocks.
  • scripts/pack.py path fix: the manifest generator produced a wrong path for pages in subdirectories (security/security.mddocs/security/index.html). It now uses the full relative path.
  • showcase.css additions: a .sc-btn--secondary variant (the existing .sc-btn--outline is white-on-dark and unreadable on light section backgrounds), spacing rules for sections that stack several blocks, and scroll-margin-top so in-page anchors clear the sticky nav.

Verification

Standalone build runs clean and was served locally: landing page, overview page, security page, stylesheets, and the hero asset all return 200. dist/marketplace.json lists both pages with correct paths.

Notes for reviewers

  • docs/assets/images/hero.png is a 1.4 MB binary — swap it for a lighter or repository-specific image if preferred.
  • No release workflow is included yet. The template publishes dist.tar.gz on v* tags; happy to add that in a follow-up if the knowledge base should consume this repository.
  • scripts/pack.py starts by removing dist/, so concurrent builds clobber each other.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ALSJV4Rt4tsGJnrRHuPN39

Summary by CodeRabbit

  • New Features

    • Added a branded documentation website with searchable pages, navigation, responsive layouts, dark mode, and Mermaid diagram support.
    • Added a showcase landing page highlighting features, solutions, workflows, and security automation.
    • Added standard, headless, preview, and development build modes.
    • Added marketplace metadata and packaged documentation output.
    • Added documentation covering project overview, repository layout, and security automation.
  • Chores

    • Added documentation build configuration and related tooling.
    • Updated ignore rules for generated documentation artifacts.

Adds a self-contained documentation site build alongside the existing Python
sources, following the knowledge-base-docs-example template: MkDocs with a
custom Jinja2 theme, a showcase landing page, and a packaged release artifact.

Site contents:
- Landing page (data/showcase.yml -> dist/index.html) presenting the repository
  as a collection of reusable workflows, with a spotlight section for the
  Security Automation solution.
- docs/index.md overview page, plus the existing docs/security/security.md
  rendered as a themed documentation page.
- Navigation is auto-generated from page frontmatter by scripts/pack.py.

Build:
  python scripts/pack.py              # standalone build -> dist/ + dist.tar.gz
  python scripts/pack.py --headless   # knowledge-base build (no top nav)
  npm run dev                         # live-reload dev server

Documentation dependencies live in requirements-docs.txt so the product
requirements.txt stays untouched.

Notable adjustments to the template:
- Mermaid diagrams render client-side in theme/main.html. The superfences
  approach needs a !!python/name YAML tag, which breaks the yaml.safe_load in
  scripts/pack.py, so fenced mermaid blocks are converted in the browser and
  degrade to plain code blocks if the CDN is unreachable.
- scripts/pack.py generated a wrong marketplace.json path for pages in
  subdirectories (security/security.md resolved to docs/security/index.html);
  it now uses the full relative path.
- showcase.css gains a .sc-btn--secondary variant. The existing .sc-btn--outline
  is white-on-dark and is unreadable on light section backgrounds.
- Absolute links in docs/security/security.md (/src/..., /docs/..., /README.md)
  resolved to the site root and were broken both on GitHub and in the built
  site; they now point at GitHub blob URLs or site-relative paths.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALSJV4Rt4tsGJnrRHuPN39
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds a MkDocs documentation site with generated navigation, a styled showcase page, Mermaid rendering, marketplace metadata generation, packaged build output, and Node-based build, preview, and development commands.

Changes

Documentation site delivery

Layer / File(s) Summary
Documentation content and build configuration
.gitignore, data/showcase.yml, docs/..., marketplace.json, mkdocs*.yml, requirements*.txt
Adds documentation content, showcase HTML, marketplace metadata, MkDocs configuration, dependency declarations, and build-output ignore patterns.
Python documentation build pipeline
scripts/pack.py
Generates navigation and build configs, builds documentation, renders showcase output, creates marketplace pages metadata, and packages the distribution.
Node build and preview entrypoints
package.json, run.js
Adds npm build commands plus standard, headless, preview, watch, and development execution modes.
Showcase and documentation theme
showcase.css, theme/*
Adds responsive showcase styling, branded documentation layout, theme switching, headless rendering, and Mermaid diagram handling.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant run.js
  participant scripts/pack.py
  participant MkDocs
  participant dist
  Developer->>run.js: run build or preview command
  run.js->>scripts/pack.py: invoke selected mode
  scripts/pack.py->>MkDocs: generate config and build docs
  MkDocs->>dist: write documentation pages
  scripts/pack.py->>dist: render showcase and marketplace manifest
  run.js->>dist: serve preview and watch source changes
Loading

Suggested reviewers: tmikula-dev, miroslavpojer

Poem

A rabbit hops through docs anew,
With pages bright and showcases blue.
MkDocs builds, manifests gleam,
Node watches every changing stream.
“Ship the site!” the bunny sings,
And packages it with fluttering wings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.53% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: adding a MkDocs docs site with a showcase landing page.
Description check ✅ Passed The description is mostly complete and covers overview, release notes, build details, and file changes, though it lacks the required Related issue reference.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/docs-showcase-site

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- Reformat scripts/pack.py with Black (line-length 120, per pyproject.toml).
- Type fixes for `mypy .`:
  * human_size divides the byte count, so start from a float instead of
    reassigning a float to an int-typed variable.
  * Annotate the nav accumulators in auto_generate_nav.
- Add types-PyYAML to requirements.txt so mypy resolves the yaml stubs used
  by scripts/pack.py.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALSJV4Rt4tsGJnrRHuPN39

@coderabbitai coderabbitai 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.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/pack.py (1)

1-326: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Black formatting check is failing.

CI reports that scripts/pack.py would be reformatted by Black. Run black scripts/pack.py before merge.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/pack.py` around lines 1 - 326, Run Black on scripts/pack.py and apply
its formatting changes throughout the file, preserving the behavior of functions
such as auto_generate_nav, generate_build_configs, render_showcase,
generate_marketplace_json, and main.

Source: Pipeline failures

🧹 Nitpick comments (7)
theme/style.css (2)

459-464: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Hardcoded brand hex duplicates --kb-primary, with unnecessary !important.

#77021E is already defined as --kb-primary (line 12), but that custom property is scoped to #showcase-root and unreachable from #topnav (under #docs-root). Consider hoisting shared brand colors to :root so both scopes reference one source of truth. Separately, !important here appears unneeded — this #topnav rule has identical specificity to, and comes after, the compiled Tailwind #topnav rule, so normal cascade order already wins.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@theme/style.css` around lines 459 - 464, Update the `#topnav` styling to use
the shared brand-color custom property instead of duplicating `#77021E`, making
that property available from a shared :root scope while preserving any
showcase-specific usage. Remove the unnecessary !important declarations from the
`#topnav` background and border rules, relying on the existing cascade order.

1-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Stylelint findings target generated Tailwind output — not worth hand-editing.

The flagged duplicate -webkit-text-decoration, deprecated buttonauto, and keyword-casing issues all live inside the compiled Tailwind CSS (line 2, per the tailwindcss v4.2.2 header). Hand-fixing generated/vendor output is fragile and will be overwritten on the next rebuild; consider excluding this file (or a /*! generated */-tagged pattern) from stylelint instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@theme/style.css` around lines 1 - 2, Exclude the generated Tailwind
stylesheet from Stylelint, using its generated-file/header pattern if supported,
so findings in the compiled output are ignored without modifying the CSS.
Preserve linting for authored stylesheets and ensure the exclusion applies to
future rebuilds of this generated file.

Source: Linters/SAST tools

theme/main.html (1)

104-104: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Mermaid CDN import pinned only to major version.

mermaid@11 allows any minor/patch within v11 to be served, with no integrity check. Pinning an exact version reduces the blast radius of a compromised or unexpectedly-breaking CDN release.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@theme/main.html` at line 104, Update the dynamic Mermaid import in the
relevant initialization flow to pin the CDN URL to an exact Mermaid 11 minor and
patch version instead of the floating `@11` range, preserving the existing module
import behavior.
scripts/pack.sh (1)

52-109: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Duplicated frontmatter/nav-generation logic across pack.py and pack.sh.

The parse_frontmatter/auto_generate_nav logic here is a byte-for-byte port of scripts/pack.py's implementation. Any future bug fix (e.g. the mypy/edge-case fixes flagged in scripts/pack.py) must be applied twice to keep the two entrypoints in sync.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/pack.sh` around lines 52 - 109, Remove the duplicated
parse_frontmatter and auto_generate_nav implementations from
generate_build_configs in scripts/pack.sh. Reuse the shared implementation from
scripts/pack.py or invoke that entrypoint to generate the navigation, while
preserving the existing mkdocs-build.yml and headless configuration outputs.
requirements-docs.txt (1)

1-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Pin PyYAML explicitly; consider a mypy stub for yaml.

scripts/pack.py and scripts/pack.sh both import yaml directly, but it's only pulled in transitively via mkdocs. Declaring it here avoids relying on mkdocs' own dependency graph, and adding types-PyYAML (as a dev-only stub) would resolve the CI mypy failure Library stubs not installed for "yaml" at scripts/pack.py:121.

📦 Proposed fix
 mkdocs==1.6.1
 jinja2>=3.1
+pyyaml>=6.0
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@requirements-docs.txt` around lines 1 - 2, Update the requirements
declarations used by scripts/pack.py and scripts/pack.sh to explicitly include
PyYAML rather than relying on mkdocs transitively, and add the types-PyYAML
development stub so mypy can type-check the yaml import.

Source: Pipeline failures

scripts/pack.py (2)

126-126: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Minor: prefer next(iter(...)) over a single-element slice.

🧹 Proposed fix
-    print(f"  Auto-generated nav with {sum(len(v) if isinstance(v, dict) and isinstance(list(v.values())[0], list) else 1 for v in nav)} page(s)")
+    print(f"  Auto-generated nav with {sum(len(v) if isinstance(v, dict) and isinstance(next(iter(v.values())), list) else 1 for v in nav)} page(s)")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/pack.py` at line 126, Update the page-count expression in the
navigation summary print statement to inspect the first dictionary value using
next(iter(v.values())) instead of materializing all values with
list(v.values())[0]. Preserve the existing list-type check and page-count
behavior.

Source: Linters/SAST tools


43-326: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Add type hints/docstrings and use logging instead of print.

Per coding guidelines: public functions (auto_generate_nav, generate_build_configs, render_showcase, generate_marketplace_json, main, run) are missing return/parameter type hints and Google-style docstrings, and the file uses print() throughout instead of logging.getLogger(__name__) with lazy % formatting. As per coding guidelines, "Use type hints for public functions and classes in Python 3.14", "Use logging.getLogger(__name__) instead of print statements", and "Use Google-style docstrings for public functions and classes."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/pack.py` around lines 43 - 326, Update the public functions run,
auto_generate_nav, generate_build_configs, render_showcase,
generate_marketplace_json, and main with complete Python 3.14 parameter and
return type hints plus Google-style docstrings. Replace all print-based status,
warning, and error output in this module with a module logger created via
logging.getLogger(__name__), using lazy %-style formatting; preserve existing
exit behavior and messages.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/index.md`:
- Around line 20-28: Update the fenced repository-layout code block in
docs/index.md to declare the text language, preserving its existing contents.

In `@run.js`:
- Around line 66-77: Update the watchTargets array to replace the incorrect
main.py entry with scripts/pack.py, ensuring preview mode watches the build
script invoked by run.js.

In `@scripts/pack.py`:
- Around line 119-121: Add PyYAML type stubs to the type-checking dependencies
used by CI so the yaml import inside generate_build_configs passes mypy;
alternatively configure mypy to ignore missing imports for yaml, using the
project’s existing dependency or mypy configuration mechanism.
- Around line 58-64: Update human_size so the size variable is explicitly typed
to permit the float produced by division, or use a separate float variable
initialized from path.stat().st_size. Preserve the existing unit iteration,
rounding, and returned formatting while satisfying mypy’s type checking.
- Around line 98-101: In the initialization block for top_level, sections, and
section_min_order, add explicit type annotations to sections and
section_min_order that match the key and value types used throughout the script,
ensuring mypy can infer their intended dictionary shapes.

In `@scripts/pack.sh`:
- Around line 139-145: The scripts/pack.sh showcase packaging path still reads
the removed showcase.html instead of rendering data/showcase.yml. In
scripts/pack.sh lines 139-145 and 217-218, port the wrapped-HTML rendering
behavior from scripts/pack.py’s render_showcase(), including copying
showcase.css and admin/. In run.js lines 66-77, remove showcase.html from
watchTargets or replace it with the existing data watch entry.

In `@theme/main.html`:
- Around line 92-123: The Mermaid rendering flow currently falls back all
collected graphs when any render fails. Update the logic around mermaid.run and
the graphs collection to render diagrams independently or identify only failed
nodes, and replace plain code only for those failed diagram holders while
preserving successfully rendered diagrams.
- Around line 31-38: Adjust the fallback _home_href calculation in the page URL
block to remove the extra parent-directory traversal: multiply '../' by _parts
length rather than _parts length plus one, while preserving the existing
empty-URL handling and showcase_url override.

In `@theme/style.css`:
- Around line 11-441: Remove the duplicated `#showcase-root` design-system block
from theme/style.css (lines 11-441); retain showcase.css lines 455-505 as the
sole authoritative copy of the showcase additions, with no direct changes
required there unless needed to preserve those rules.

---

Outside diff comments:
In `@scripts/pack.py`:
- Around line 1-326: Run Black on scripts/pack.py and apply its formatting
changes throughout the file, preserving the behavior of functions such as
auto_generate_nav, generate_build_configs, render_showcase,
generate_marketplace_json, and main.

---

Nitpick comments:
In `@requirements-docs.txt`:
- Around line 1-2: Update the requirements declarations used by scripts/pack.py
and scripts/pack.sh to explicitly include PyYAML rather than relying on mkdocs
transitively, and add the types-PyYAML development stub so mypy can type-check
the yaml import.

In `@scripts/pack.py`:
- Line 126: Update the page-count expression in the navigation summary print
statement to inspect the first dictionary value using next(iter(v.values()))
instead of materializing all values with list(v.values())[0]. Preserve the
existing list-type check and page-count behavior.
- Around line 43-326: Update the public functions run, auto_generate_nav,
generate_build_configs, render_showcase, generate_marketplace_json, and main
with complete Python 3.14 parameter and return type hints plus Google-style
docstrings. Replace all print-based status, warning, and error output in this
module with a module logger created via logging.getLogger(__name__), using lazy
%-style formatting; preserve existing exit behavior and messages.

In `@scripts/pack.sh`:
- Around line 52-109: Remove the duplicated parse_frontmatter and
auto_generate_nav implementations from generate_build_configs in
scripts/pack.sh. Reuse the shared implementation from scripts/pack.py or invoke
that entrypoint to generate the navigation, while preserving the existing
mkdocs-build.yml and headless configuration outputs.

In `@theme/main.html`:
- Line 104: Update the dynamic Mermaid import in the relevant initialization
flow to pin the CDN URL to an exact Mermaid 11 minor and patch version instead
of the floating `@11` range, preserving the existing module import behavior.

In `@theme/style.css`:
- Around line 459-464: Update the `#topnav` styling to use the shared brand-color
custom property instead of duplicating `#77021E`, making that property available
from a shared :root scope while preserving any showcase-specific usage. Remove
the unnecessary !important declarations from the `#topnav` background and border
rules, relying on the existing cascade order.
- Around line 1-2: Exclude the generated Tailwind stylesheet from Stylelint,
using its generated-file/header pattern if supported, so findings in the
compiled output are ignored without modifying the CSS. Preserve linting for
authored stylesheets and ensure the exclusion applies to future rebuilds of this
generated file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4472d907-d10e-432d-ad0e-62475ca7da63

📥 Commits

Reviewing files that changed from the base of the PR and between abae613 and 6fba4ce.

⛔ Files ignored due to path filters (1)
  • docs/assets/images/hero.png is excluded by !**/*.png
📒 Files selected for processing (15)
  • .gitignore
  • data/showcase.yml
  • docs/index.md
  • docs/security/security.md
  • marketplace.json
  • mkdocs-headless.yml
  • mkdocs.yml
  • package.json
  • requirements-docs.txt
  • run.js
  • scripts/pack.py
  • scripts/pack.sh
  • showcase.css
  • theme/main.html
  • theme/style.css

Comment thread docs/index.md Outdated
Comment thread run.js
Comment thread scripts/pack.py
Comment thread scripts/pack.py Outdated
Comment thread scripts/pack.py
Comment on lines +119 to +121
# ── Generate build configs ────────────────────────────────────────────────────
def generate_build_configs():
import yaml

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Missing type stubs for yaml break the mypy CI job.

mypy currently fails with "Library stubs not installed for yaml" here. Add types-PyYAML to the type-checking toolchain (or configure ignore_missing_imports for yaml in the mypy config) to unblock CI.

🧰 Tools
🪛 GitHub Actions: Python Check / 0_Mypy Type Check.txt

[error] 121-121: mypy: Library stubs not installed for "yaml". [import-untyped] (Hint: "python3 -m pip install types-PyYAML" or run "mypy --install-types")

🪛 GitHub Actions: Python Check / Mypy Type Check

[error] 121-121: mypy: Library stubs not installed for "yaml". [import-untyped] (Hint: "python3 -m pip install types-PyYAML" or run "mypy --install-types")

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/pack.py` around lines 119 - 121, Add PyYAML type stubs to the
type-checking dependencies used by CI so the yaml import inside
generate_build_configs passes mypy; alternatively configure mypy to ignore
missing imports for yaml, using the project’s existing dependency or mypy
configuration mechanism.

Source: Pipeline failures

Comment thread scripts/pack.sh Outdated
Comment thread theme/main.html
Comment on lines +31 to +38
{%- if not config.extra.headless -%}
{%- if config.extra.showcase_url -%}
{%- set _home_href = config.extra.showcase_url -%}
{%- else -%}
{%- set _url_trimmed = (page.url | default('') | trim('/')) -%}
{%- set _parts = _url_trimmed.split('/') if _url_trimmed else [] -%}
{%- set _home_href = ('../' * (_parts | length + 1)) ~ 'index.html' -%}
{%- endif -%}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## candidate files"
git ls-files | rg '(^|/)(theme/main\.html|mkdocs(\-headless)?\.yml|mkdocs(\-headless)?\.yaml)$' || true

echo
echo "## theme/main.html excerpt"
if [ -f theme/main.html ]; then
  nl -ba theme/main.html | sed -n '1,120p'
fi

echo
echo "## mkdocs URL settings"
for f in mkdocs.yml mkdocs.yaml mkdocs-headless.yml mkdocs-headless.yaml; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    rg -n "site_url|site_name|use_directory_urls|config|extra:" "$f" -A8 -B4 || true
  fi
done

echo
echo "## repo docs for relevant nested page names"
git ls-files docs | rg '(\.md)$' | sed -n '1,80p'

echo
echo "## formula probe for MkDocs-style directory URL paths"
python3 - <<'PY'
from pathlib import PurePosixPath

cases = [
    ("docs/index.md", "index.html"),
    ("docs/a.md", "a/index.html"),
    ("docs/a/b.md", "a/b/index.html"),
    ("docs/docs/security/security.md", "docs/security/security/index.html"),
]

def mkdocs_html_for_relative_docs_file(path):
    # Use_directory_URL convention: docs/a.md -> a/
    pure = PurePosixPath(path)
    # project-relative file path including docs/
    parts = pure.parts
    try:
        idx = parts.index('docs')
        rel = parts[idx+1:]
    except ValueError:
        rel = parts
    base = "/".join(rel)
    if base:
        return base + "/index.html"
    return "index.html"

for path, expected_href in cases:
    url = expected_href.rstrip("/").split("/")
    trimmed = url[0] if url else ""
    parts = trimmed.split("/") if trimmed else []
    current = ("../" * (len(parts) + 1)) + "index.html"
    proposed = ("../" * (len(parts))) + "index.html"
    print(f"{path}: expected={expected_href}: current={current}: proposed={proposed}: current_levels={len(parts)+1}: proposed_levels={len(parts)}")
PY

Repository: AbsaOSS/organizational-workflows

Length of output: 305


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## theme/main.html excerpt"
sed -n '1,120p' theme/main.html | awk '{printf "%6d\t%s\n", NR, $0}'

echo
echo "## mkdocs URL/config settings"
for f in mkdocs.yml mkdocs.yaml mkdocs-headless.yml mkdocs-headless.yaml; do
  if [ -f "$f" ]; then
    echo "--- $f ---"
    rg -n "site_url|site_name|use_directory_urls|extra|theme:|markdown_extensions:|plugins:" "$f" -A6 -B4 || true
  fi
done

echo
echo "## formula probe for MkDocs-style directory URL paths"
python3 - <<'PY'
from pathlib import PurePosixPath

cases = [
    ("docs/index.md", "index.html"),
    ("docs/a.md", "a/index.html"),
    ("docs/a/b.md", "a/b/index.html"),
    ("docs/docs/security/security.md", "docs/security/security/index.html"),
]

expected_hrefs = {
    "docs/index.md": "index.html",
    "docs/a.md": "a/index.html",
    "docs/a/b.md": "a/b/index.html",
    "docs/docs/security/security.md": "docs/security/security/index.html",
}

for path, expected_href in cases:
    url = expected_href.rstrip("/").split("/")
    trimmed = url[0] if url else ""
    parts = trimmed.split("/") if trimmed else []
    current = ("../" * (len(parts) + 1)) + "index.html"
    proposed = ("../" * (len(parts))) + "index.html"
    print(f"{path}: expected={expected_href}: current={current}: proposed={proposed}: current_levels={len(parts)+1}: proposed_levels={len(parts)}")
PY

Repository: AbsaOSS/organizational-workflows

Length of output: 7686


Remove the extra ../ from the computed home-link fallback.

With MkDocs directory URLs enabled by default, nested pages receive URLs like a/b/, so the rendered file is under a/b/ and the logo/Home link should compute ../.. //index.html from two URL segments, not three. The current count goes one level too far and makes the home link leave the built site root.

🐛 Proposed fix
-    {%- set _home_href = ('../' * (_parts | length + 1)) ~ 'index.html' -%}
+    {%- set _home_href = ('../' * (_parts | length)) ~ 'index.html' -%}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{%- if not config.extra.headless -%}
{%- if config.extra.showcase_url -%}
{%- set _home_href = config.extra.showcase_url -%}
{%- else -%}
{%- set _url_trimmed = (page.url | default('') | trim('/')) -%}
{%- set _parts = _url_trimmed.split('/') if _url_trimmed else [] -%}
{%- set _home_href = ('../' * (_parts | length + 1)) ~ 'index.html' -%}
{%- endif -%}
{%- if not config.extra.headless -%}
{%- if config.extra.showcase_url -%}
{%- set _home_href = config.extra.showcase_url -%}
{%- else -%}
{%- set _url_trimmed = (page.url | default('') | trim('/')) -%}
{%- set _parts = _url_trimmed.split('/') if _url_trimmed else [] -%}
{%- set _home_href = ('../' * (_parts | length)) ~ 'index.html' -%}
{%- endif -%}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@theme/main.html` around lines 31 - 38, Adjust the fallback _home_href
calculation in the page URL block to remove the extra parent-directory
traversal: multiply '../' by _parts length rather than _parts length plus one,
while preserving the existing empty-URL handling and showcase_url override.

Comment thread theme/main.html
Comment thread theme/style.css Outdated
- run.js: watch scripts/pack.py (the real build entrypoint) instead of the
  nonexistent main.py; drop the stale showcase.html target (data/showcase.yml
  is already covered by the "data" entry).
- scripts/pack.sh: remove. It duplicated scripts/pack.py, was referenced by
  nothing, and had drifted out of sync — it still read the removed
  showcase.html and derived wrong output paths for pages in subdirectories.
- theme/main.html: render Mermaid diagrams with suppressErrors so one bad
  diagram no longer reverts every diagram on the page to plain code; only
  holders left without an SVG fall back.
- theme/style.css: drop the duplicated #showcase-root block. Doc pages have no
  showcase markup, and the showcase page loads showcase.css, which carries the
  authoritative copy. Doc-page rules (topnav, nav sections) are kept.
- docs/index.md: add a language hint to the repository-layout fence (MD040).

Not changed: the home-link fallback in theme/main.html. With site_dir
dist/docs, the showcase entry point lives one level above the MkDocs output,
so the extra "../" is required. Verified against the built site — dist/docs/
index.html resolves to ../index.html and dist/docs/security/security/
index.html to ../../../index.html, both dist/index.html.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HiWDmb8CeaexLg6CsbXACi

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/pack.py`:
- Around line 130-132: Replace the inline print in the navigation-generation
flow with the module logger from logging.getLogger(__name__), using the
appropriate domain prefix and lazy % formatting. Compute the page count in a
separate variable before logging it, preserving the existing count calculation
and message content.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8b248688-3c21-4413-a90b-315165734dc4

📥 Commits

Reviewing files that changed from the base of the PR and between 6fba4ce and f739db3.

📒 Files selected for processing (6)
  • docs/index.md
  • requirements.txt
  • run.js
  • scripts/pack.py
  • theme/main.html
  • theme/style.css
💤 Files with no reviewable changes (1)
  • theme/style.css
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/index.md
  • theme/main.html
  • run.js

Comment thread scripts/pack.py
Comment on lines +130 to +132
print(
f" Auto-generated nav with {sum(len(v) if isinstance(v, dict) and isinstance(list(v.values())[0], list) else 1 for v in nav)} page(s)"
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Files named pack.py:"
fd -a 'pack\.py$' . || true

echo
echo "Relevant scripts/pack.py excerpt:"
if [ -f scripts/pack.py ]; then
  sed -n '1,180p' scripts/pack.py | nl -ba
fi

Repository: AbsaOSS/organizational-workflows

Length of output: 302


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "scripts/pack.py outline and relevant excerpt:"
wc -l scripts/pack.py
sed -n '1,180p' scripts/pack.py

echo
echo "Logging/getLogger references in scripts/pack.py:"
grep -nE 'import logging|logging\.getLogger|logger =|print\(' scripts/pack.py || true

Repository: AbsaOSS/organizational-workflows

Length of output: 7515


Use the configured logger for build output.

Python files should use logging.getLogger(__name__), lazy % formatting, and a domain prefix instead of inline print statements. For this line, compute the page count separately and log it instead.

🧰 Tools
🪛 Ruff (0.15.21)

[warning] 131-131: Prefer next(iter(v.values())) over single element slice

Replace with next(iter(v.values()))

(RUF015)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/pack.py` around lines 130 - 132, Replace the inline print in the
navigation-generation flow with the module logger from
logging.getLogger(__name__), using the appropriate domain prefix and lazy %
formatting. Compute the page count in a separate variable before logging it,
preserving the existing count calculation and message content.

Source: Coding guidelines

@oto-macenauer-absa
oto-macenauer-absa marked this pull request as draft July 28, 2026 12:46
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