From 06379343306e0c52882daed6b1d2a1d172b5e3bc Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 16 Dec 2025 17:49:30 +0000
Subject: [PATCH 01/11] Initial plan
From b4d81e5ce7cb407df9afdf2d5ef75419b125cab7 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 16 Dec 2025 18:04:29 +0000
Subject: [PATCH 02/11] Add base URL injection script and update PR preview
workflow
Co-authored-by: bronius <2348390+bronius@users.noreply.github.com>
---
.github/workflows/preview.yml | 8 +++++---
inject-base-url.sh | 36 +++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 3 deletions(-)
create mode 100755 inject-base-url.sh
diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml
index e916ae7..5c6a910 100644
--- a/.github/workflows/preview.yml
+++ b/.github/workflows/preview.yml
@@ -32,10 +32,12 @@ jobs:
- name: Build mdBook site
run: mdbook build
if: github.event.action != 'closed'
- env:
- MDBOOK_OUTPUT__HTML__SITE_URL: /pr-preview/pr-${{ github.event.number }}/
+
+ - name: Inject base URL for PR preview
+ run: ./inject-base-url.sh "/pr-preview/pr-${{ github.event.number }}/" "./book"
+ if: github.event.action != 'closed'
- name: Deploy preview
- uses: rossjrw/pr-preview-action@v1
+ uses: rossjrw/pr-preview-action@v1.6.3
with:
source-dir: ./book/
diff --git a/inject-base-url.sh b/inject-base-url.sh
new file mode 100755
index 0000000..db5ac1c
--- /dev/null
+++ b/inject-base-url.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# Script to inject tag into mdBook HTML output
+# Usage: ./inject-base-url.sh
+
+set -e
+
+if [ $# -ne 2 ]; then
+ echo "Usage: $0 "
+ echo "Example: $0 /pr-preview/pr-123/ ./book"
+ exit 1
+fi
+
+BASE_URL="$1"
+BOOK_DIR="$2"
+
+# Validate inputs
+if [ ! -d "$BOOK_DIR" ]; then
+ echo "Error: Book directory '$BOOK_DIR' does not exist"
+ exit 1
+fi
+
+# Find all HTML files and inject/update base tag
+find "$BOOK_DIR" -name "*.html" -type f | while read -r html_file; do
+ # Check if base tag already exists
+ if grep -q '
Date: Tue, 16 Dec 2025 18:09:44 +0000
Subject: [PATCH 03/11] Fix inject-base-url script to properly convert relative
to absolute paths
Co-authored-by: bronius <2348390+bronius@users.noreply.github.com>
---
inject-base-url.sh | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/inject-base-url.sh b/inject-base-url.sh
index db5ac1c..c8dd89e 100755
--- a/inject-base-url.sh
+++ b/inject-base-url.sh
@@ -13,24 +13,33 @@ fi
BASE_URL="$1"
BOOK_DIR="$2"
+# Remove trailing slash for consistency in replacements
+BASE_URL="${BASE_URL%/}"
+
# Validate inputs
if [ ! -d "$BOOK_DIR" ]; then
echo "Error: Book directory '$BOOK_DIR' does not exist"
exit 1
fi
-# Find all HTML files and inject/update base tag
+# Find all HTML files and prepend base URL to relative asset paths
find "$BOOK_DIR" -name "*.html" -type f | while read -r html_file; do
- # Check if base tag already exists
- if grep -q '
Date: Tue, 16 Dec 2025 18:12:03 +0000
Subject: [PATCH 04/11] Add support for ./ relative image paths in
inject-base-url script
Co-authored-by: bronius <2348390+bronius@users.noreply.github.com>
---
inject-base-url.sh | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/inject-base-url.sh b/inject-base-url.sh
index c8dd89e..e5e244c 100755
--- a/inject-base-url.sh
+++ b/inject-base-url.sh
@@ -24,12 +24,28 @@ fi
# Find all HTML files and prepend base URL to relative asset paths
find "$BOOK_DIR" -name "*.html" -type f | while read -r html_file; do
+ # Get the directory of the current HTML file relative to book root
+ # This is needed for resolving ./ paths correctly
+ rel_dir=$(dirname "${html_file#$BOOK_DIR/}")
+
# Convert ../ relative paths to absolute paths with base URL
# This handles paths like: href="../../css/style.css"
sed -i -E "s|href=\"(\.\./)+|href=\"${BASE_URL}/|g" "$html_file"
sed -i -E "s|src=\"(\.\./)+|src=\"${BASE_URL}/|g" "$html_file"
- # Convert simple relative paths (no ../) to absolute paths with base URL
+ # Convert ./ relative paths to absolute paths with base URL
+ # This handles paths like: src="./image.png"
+ if [ "$rel_dir" = "." ]; then
+ # File is in root directory
+ sed -i -E "s|href=\"\./|href=\"${BASE_URL}/|g" "$html_file"
+ sed -i -E "s|src=\"\./|src=\"${BASE_URL}/|g" "$html_file"
+ else
+ # File is in subdirectory, need to include the subdirectory path
+ sed -i -E "s|href=\"\./|href=\"${BASE_URL}/${rel_dir}/|g" "$html_file"
+ sed -i -E "s|src=\"\./|src=\"${BASE_URL}/${rel_dir}/|g" "$html_file"
+ fi
+
+ # Convert simple relative paths (no ../ or ./) to absolute paths with base URL
# This handles paths like: href="css/style.css" or href="index.html" or href="cloud/index.html"
# But avoid converting:
# - already absolute paths (starting with /)
From 5d0ab08386dc006c18c85ddb764c03d86170267f Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 16 Dec 2025 18:18:00 +0000
Subject: [PATCH 05/11] Fix regex patterns and add better documentation to
inject-base-url script
Co-authored-by: bronius <2348390+bronius@users.noreply.github.com>
---
inject-base-url.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/inject-base-url.sh b/inject-base-url.sh
index e5e244c..38980f3 100755
--- a/inject-base-url.sh
+++ b/inject-base-url.sh
@@ -47,15 +47,16 @@ find "$BOOK_DIR" -name "*.html" -type f | while read -r html_file; do
# Convert simple relative paths (no ../ or ./) to absolute paths with base URL
# This handles paths like: href="css/style.css" or href="index.html" or href="cloud/index.html"
+ # Also handles paths with anchors: href="page.html#section" → href="/base/page.html#section"
# But avoid converting:
# - already absolute paths (starting with /)
# - URLs with schemes (http://, https://, mailto:, etc.) - they contain ":"
- # - anchors (starting with #)
- # Match only paths that start with a letter or number and don't contain a colon
+ # - standalone anchors (starting with #) - these don't start with letter/number
+ # Match paths that start with a letter or number and don't contain a colon
sed -i -E "s|href=\"([a-zA-Z0-9][^\":]*)\"|href=\"${BASE_URL}/\1\"|g" "$html_file"
sed -i -E "s|src=\"([a-zA-Z0-9][^\":]*)\"|src=\"${BASE_URL}/\1\"|g" "$html_file"
- echo "Converted paths in $(basename $html_file)"
+ echo "Converted paths in $(basename "$html_file")"
done
echo "Done! Prepended base URL '${BASE_URL}' to relative paths in '${BOOK_DIR}'"
From 12c0746122474cabd8e1078b0b25d904372c36fa Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Tue, 16 Dec 2025 20:20:40 +0000
Subject: [PATCH 06/11] Fix relative links in markdown and improve path
resolution in inject-base-url.sh
Co-authored-by: bronius <2348390+bronius@users.noreply.github.com>
---
inject-base-url.sh | 35 ++++++++++++++++++++++++----
src/kion/features/getting_started.md | 4 ++--
2 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/inject-base-url.sh b/inject-base-url.sh
index 38980f3..a004cce 100755
--- a/inject-base-url.sh
+++ b/inject-base-url.sh
@@ -29,10 +29,15 @@ find "$BOOK_DIR" -name "*.html" -type f | while read -r html_file; do
rel_dir=$(dirname "${html_file#$BOOK_DIR/}")
# Convert ../ relative paths to absolute paths with base URL
- # This handles paths like: href="../../css/style.css"
+ # This handles paths like: href="../../css/style.css" and href=".././theme/css/style.css"
sed -i -E "s|href=\"(\.\./)+|href=\"${BASE_URL}/|g" "$html_file"
sed -i -E "s|src=\"(\.\./)+|src=\"${BASE_URL}/|g" "$html_file"
+ # Clean up any remaining ./ that may have been left after ../ conversion
+ # This handles cases like ".././theme" which becomes "/base/./theme" and needs to be "/base/theme"
+ sed -i -E "s|href=\"${BASE_URL}/\./|href=\"${BASE_URL}/|g" "$html_file"
+ sed -i -E "s|src=\"${BASE_URL}/\./|src=\"${BASE_URL}/|g" "$html_file"
+
# Convert ./ relative paths to absolute paths with base URL
# This handles paths like: src="./image.png"
if [ "$rel_dir" = "." ]; then
@@ -46,15 +51,35 @@ find "$BOOK_DIR" -name "*.html" -type f | while read -r html_file; do
fi
# Convert simple relative paths (no ../ or ./) to absolute paths with base URL
- # This handles paths like: href="css/style.css" or href="index.html" or href="cloud/index.html"
+ # We need to distinguish between:
+ # 1. Root-relative paths (contain /): cloud/index.html → /base/cloud/index.html
+ # 2. File-relative paths (no /): migrating.html → /base/subdir/migrating.html
# Also handles paths with anchors: href="page.html#section" → href="/base/page.html#section"
# But avoid converting:
# - already absolute paths (starting with /)
# - URLs with schemes (http://, https://, mailto:, etc.) - they contain ":"
# - standalone anchors (starting with #) - these don't start with letter/number
- # Match paths that start with a letter or number and don't contain a colon
- sed -i -E "s|href=\"([a-zA-Z0-9][^\":]*)\"|href=\"${BASE_URL}/\1\"|g" "$html_file"
- sed -i -E "s|src=\"([a-zA-Z0-9][^\":]*)\"|src=\"${BASE_URL}/\1\"|g" "$html_file"
+
+ # First, handle root-relative paths (paths that contain at least one /)
+ # These are paths like "cloud/index.html" or "kion/features/getting_started.html"
+ sed -i -E "s|href=\"([a-zA-Z0-9][^\":]*)/([^\"]*)\"|href=\"${BASE_URL}/\1/\2\"|g" "$html_file"
+ sed -i -E "s|src=\"([a-zA-Z0-9][^\":]*)/([^\"]*)\"|src=\"${BASE_URL}/\1/\2\"|g" "$html_file"
+
+ # Then, handle file-relative paths (simple filenames without /)
+ # Match paths that start with a letter or number, don't contain a colon or slash
+ if [ "$rel_dir" = "." ]; then
+ # File is in root directory
+ sed -i -E "s|href=\"([a-zA-Z0-9][^\"/:]*)\"|href=\"${BASE_URL}/\1\"|g" "$html_file"
+ sed -i -E "s|src=\"([a-zA-Z0-9][^\"/:]*)\"|src=\"${BASE_URL}/\1\"|g" "$html_file"
+ else
+ # File is in subdirectory, prepend the subdirectory path
+ sed -i -E "s|href=\"([a-zA-Z0-9][^\"/:]*)\"|href=\"${BASE_URL}/${rel_dir}/\1\"|g" "$html_file"
+ sed -i -E "s|src=\"([a-zA-Z0-9][^\"/:]*)\"|src=\"${BASE_URL}/${rel_dir}/\1\"|g" "$html_file"
+ fi
+
+ # Final cleanup: remove any remaining ./ in the middle of paths
+ # This handles cases like "/base/kion/features/./features/" which should be "/base/kion/features/features/"
+ sed -i -E "s|/\./|/|g" "$html_file"
echo "Converted paths in $(basename "$html_file")"
done
diff --git a/src/kion/features/getting_started.md b/src/kion/features/getting_started.md
index 4ccaf2d..3d0a7b2 100644
--- a/src/kion/features/getting_started.md
+++ b/src/kion/features/getting_started.md
@@ -6,7 +6,7 @@ The first thing you will see when you log into Kion is a dashboard. From here, y
## Access your Cloud Accounts
-The most common use for Kion is to access your cloud accounts. You will have one or more [Cloud Access Roles](./features/access_roles.md) assigned to each cloud account. These roles allow you to access the cloud account with various levels of permissions. It is best practice to always use the least-privileged role that allows you to perform the necessary actions.
+The most common use for Kion is to access your cloud accounts. You will have one or more [Cloud Access Roles](./access_roles.md) assigned to each cloud account. These roles allow you to access the cloud account with various levels of permissions. It is best practice to always use the least-privileged role that allows you to perform the necessary actions.
You can access your accounts from many places in Kion, including the dashboard, the projects page, and the accounts page. Look for dropdown menus with a cloud icon to select the account and role you want to access.
@@ -42,7 +42,7 @@ When you select a project, you will have several options at the top of the page
- **Financials** - This tab shows you the budget and spending status for the project. You can manage your budgets and generate reports and graphs.
- **Savings Opportunities** - This tab shows you ways to save money on your cloud spending. It will show you recommendations for Reserved Instances and other cost-saving opportunities.
- **Enforcements** - This tab shows you and enforcements that are in place for the project. Enforcements are alerts or actions triggered by spending conditions, such as a budget being exceeded.
-- **Cloud Management** - This tab allows you to find more information about the Cloud Rules, [Cloud Access Roles](./features/access_roles.md), and related resources that are applied to the project.
+- **Cloud Management** - This tab allows you to find more information about the Cloud Rules, [Cloud Access Roles](./access_roles.md), and related resources that are applied to the project.
- **Compliance** - This tab shows you the compliance posture of the project. It will show you any findings that are present, and give you recommendations on how to fix or suppress them.
- **Users** - This tab shows you the users and groups that have access to the project. This access is separate from any Cloud Access Roles that are assigned to the accounts in the project.
- **Permissions** - This tab shows you the permissions that users and groups have to the project, based on the settings in the Users tab.
From 2bc448fb1059a1f5df6297054cc1527a70031337 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 17 Dec 2025 15:39:47 +0000
Subject: [PATCH 07/11] Fix navigation active/expanded classes by updating
toc.js paths
Co-authored-by: bronius <2348390+bronius@users.noreply.github.com>
---
inject-base-url.sh | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/inject-base-url.sh b/inject-base-url.sh
index a004cce..8c9c09e 100755
--- a/inject-base-url.sh
+++ b/inject-base-url.sh
@@ -84,4 +84,24 @@ find "$BOOK_DIR" -name "*.html" -type f | while read -r html_file; do
echo "Converted paths in $(basename "$html_file")"
done
+# Also process toc.js file which dynamically generates navigation
+if [ -f "$BOOK_DIR/toc.js" ]; then
+ echo "Processing toc.js navigation..."
+ # The hrefs in toc.js are in a JavaScript string, so we need to be careful
+ # We're looking for patterns like:
+ # And converting them to:
+
+ # Convert root-relative paths (paths with /)
+ sed -i -E "s|||g" "$BOOK_DIR/toc.js"
+
+ # Convert simple file paths (no /)
+ sed -i -E "s|||g" "$BOOK_DIR/toc.js"
+
+ # Fix the href check in toc.js to skip absolute paths (those starting with /)
+ # We need to add a check for !href.startsWith("/") before the regex test
+ sed -i 's/!href\.startsWith("#")/!href.startsWith("#") \&\& !href.startsWith("\/")/g' "$BOOK_DIR/toc.js"
+
+ echo "Converted paths in toc.js"
+fi
+
echo "Done! Prepended base URL '${BASE_URL}' to relative paths in '${BOOK_DIR}'"
From 70338d385c96e230429eae87fb8fa4257c6456fc Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 17 Dec 2025 16:23:56 +0000
Subject: [PATCH 08/11] Add navigation active/expanded logic to theme to fix
mdBook 0.4.52 issue
Co-authored-by: bronius <2348390+bronius@users.noreply.github.com>
---
theme/index.hbs | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/theme/index.hbs b/theme/index.hbs
index bb1ffb3..c861967 100644
--- a/theme/index.hbs
+++ b/theme/index.hbs
@@ -488,5 +488,42 @@
{{/if}}
{{/if}}
+
+
+