Compare commits

...

8 Commits

Author SHA1 Message Date
Atif Ali 524d0a206f Merge branch 'main' into add-api-docs-linter 2025-11-24 20:17:38 +05:00
blink-so[bot] 2b41dce010 fix: use instead of 2025-11-24 12:40:27 +00:00
Danny Kopping 4e888dd797 chore: splitting into own workflow
Signed-off-by: Danny Kopping <danny@coder.com>
2025-11-24 10:36:09 +02:00
Danny Kopping 1f29f0babe chore: add missing entries
Signed-off-by: Danny Kopping <danny@coder.com>
2025-11-24 10:31:56 +02:00
Danny Kopping 9793ca0aad chore: add gh action
Signed-off-by: Danny Kopping <danny@coder.com>
2025-11-24 10:31:45 +02:00
Danny Kopping b20e59d579 chore: fix script
Signed-off-by: Danny Kopping <danny@coder.com>
2025-11-24 10:31:34 +02:00
blink-so[bot] 343f98ebe6 fix: format linter script with shfmt 2025-11-24 08:20:05 +00:00
blink-so[bot] b68dd8becb Add API documentation linter script
Adds a bash script that validates API documentation files in
docs/reference/api/ are properly listed in docs/manifest.json
under the REST API node.

The linter:
- Scans docs/reference/api/ for all .md files (except index.md)
- Extracts REST API paths from docs/manifest.json
- Reports files missing from manifest
- Reports manifest entries with missing files

Requires: jq for JSON parsing

Usage: ./scripts/api-docs-linter.sh

Currently identifies 6 API documentation files that are missing
from the manifest:
- aibridge.md
- experimental.md
- initscript.md
- notifications.md
- prebuilds.md
- provisioning.md

A GitHub Actions workflow should be added separately to run this
automatically on PRs and pushes.
2025-11-24 08:16:16 +00:00
3 changed files with 146 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
name: API Docs Linter
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Run API docs linter
run: ./scripts/api-docs-linter.sh
+8
View File
@@ -1138,6 +1138,10 @@
"title": "Agents",
"path": "./reference/api/agents.md"
},
{
"title": "AIBridge",
"path": "./reference/api/aibridge.md"
},
{
"title": "Applications",
"path": "./reference/api/applications.md"
@@ -1186,6 +1190,10 @@
"title": "Insights",
"path": "./reference/api/insights.md"
},
{
"title": "InitScript",
"path": "./reference/api/initscript.md"
},
{
"title": "Members",
"path": "./reference/api/members.md"
+112
View File
@@ -0,0 +1,112 @@
#!/bin/bash
set -euo pipefail
# Linter to check for missing API docs files in manifest.json
# Cross-references docs/reference/api directory with manifest.json REST API node
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
API_DIR="docs/reference/api"
MANIFEST="docs/manifest.json"
echo "API Documentation Linter"
echo "========================"
echo ""
if [[ ! -d "$API_DIR" ]]; then
echo -e "${RED}Error: API directory not found: $API_DIR${NC}"
exit 1
fi
if [[ ! -f "$MANIFEST" ]]; then
echo -e "${RED}Error: Manifest file not found: $MANIFEST${NC}"
exit 1
fi
# Get all .md files in the API directory (excluding index.md)
echo "Scanning $API_DIR for markdown files..."
mapfile -t API_FILES < <(find "$API_DIR" -name "*.md" -not -name "index.md" -type f | sed 's|docs/|./|' | sort)
echo "Found ${#API_FILES[@]} API documentation files"
echo ""
# Extract paths from manifest.json REST API node
echo "Extracting paths from $MANIFEST (REST API node)..."
mapfile -t MANIFEST_PATHS < <(jq -r '.routes[] | select(.title == "Reference") | .children[] | select(.title == "REST API") | .children[] | .path' "$MANIFEST" | sort)
echo "Found ${#MANIFEST_PATHS[@]} entries in manifest"
echo ""
# Check for files in API dir that are missing from manifest
MISSING_FROM_MANIFEST=()
for file in "${API_FILES[@]}"; do
found=false
for manifest_path in "${MANIFEST_PATHS[@]}"; do
if [[ "$manifest_path" == "$file" ]]; then
found=true
break
fi
done
if [[ "$found" == "false" ]]; then
MISSING_FROM_MANIFEST+=("$file")
fi
done
# Check for manifest entries that don't have corresponding files
MISSING_FILES=()
for manifest_path in "${MANIFEST_PATHS[@]}"; do
# Convert manifest path format (./reference/api/...) to filesystem path (docs/reference/api/...)
fs_path="docs/${manifest_path#./}"
if [[ ! -f "$fs_path" ]]; then
MISSING_FILES+=("$manifest_path")
fi
done
# Report results
ERROR_COUNT=0
if [[ ${#MISSING_FROM_MANIFEST[@]} -gt 0 ]]; then
echo -e "${RED}✗ Files in $API_DIR missing from manifest.json:${NC}"
for file in "${MISSING_FROM_MANIFEST[@]}"; do
echo -e " ${RED}- $file${NC}"
ERROR_COUNT=$((ERROR_COUNT + 1))
done
echo ""
else
echo -e "${GREEN}✓ All API files are listed in manifest.json${NC}"
echo ""
fi
if [[ ${#MISSING_FILES[@]} -gt 0 ]]; then
echo -e "${YELLOW}⚠ Manifest entries without corresponding files:${NC}"
for path in "${MISSING_FILES[@]}"; do
echo -e " ${YELLOW}- $path${NC}"
ERROR_COUNT=$((ERROR_COUNT + 1))
done
echo ""
else
echo -e "${GREEN}✓ All manifest entries have corresponding files${NC}"
echo ""
fi
# Summary
echo "Summary"
echo "-------"
echo "API files: ${#API_FILES[@]}"
echo "Manifest entries: ${#MANIFEST_PATHS[@]}"
echo "Missing from manifest: ${#MISSING_FROM_MANIFEST[@]}"
echo "Missing files: ${#MISSING_FILES[@]}"
echo ""
if [[ $ERROR_COUNT -gt 0 ]]; then
echo -e "${RED}Linter found ${ERROR_COUNT} issue(s)${NC}"
exit 1
else
echo -e "${GREEN}✓ All checks passed!${NC}"
exit 0
fi