Skip to content

Enhancement: Improve Modulus plugin development documentation #1

Enhancement: Improve Modulus plugin development documentation

Enhancement: Improve Modulus plugin development documentation #1

name: AI Manifest Validation
on:
push:
branches: [ main ]
paths:
- 'ai-manifest.yaml'
- 'docs/en-US/stories/**'
- 'docs/zh-CN/stories/**'
pull_request:
branches: [ main ]
paths:
- 'ai-manifest.yaml'
- 'docs/en-US/stories/**'
- 'docs/zh-CN/stories/**'
jobs:
validate-manifest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PowerShell
uses: PowerShell/PowerShell-Action@v1.1
with:
pwsh-version: 7.x
- name: Install YamlDotNet
shell: pwsh
run: Install-Module -Name powershell-yaml -Force -Scope CurrentUser
- name: Validate AI Manifest
shell: pwsh
run: |
# Check if ai-manifest.yaml exists
if (-not (Test-Path "ai-manifest.yaml")) {
Write-Host "::error::ai-manifest.yaml is missing in the root directory!"
exit 1
}
# Validate yaml syntax
try {
Import-Module powershell-yaml
Get-Content "ai-manifest.yaml" | ConvertFrom-Yaml -ErrorAction Stop
Write-Host "AI manifest validation passed!"
}
catch {
Write-Host "::error::ai-manifest.yaml contains invalid YAML syntax: $($_.Exception.Message)"
exit 1
}
# Check for required sections
$manifest = Get-Content "ai-manifest.yaml" | ConvertFrom-Yaml
$requiredSections = @(
"projectInfo",
"architecture",
"directoryStructure",
"namingConventions",
"roadmap",
"glossary"
)
$missingSections = @()
foreach ($section in $requiredSections) {
if (-not $manifest.ContainsKey($section)) {
$missingSections += $section
}
}
if ($missingSections.Count -gt 0) {
Write-Host "::error::ai-manifest.yaml is missing required sections: $($missingSections -join ', ')"
exit 1
}
Write-Host "AI manifest validation successful!"
- name: Check Story Documentation
shell: pwsh
run: |
$enStoryDir = "docs/en-US/stories"
$zhStoryDir = "docs/zh-CN/stories"
# Get list of English stories
if (Test-Path $enStoryDir) {
$enStories = Get-ChildItem -Path $enStoryDir -Filter "S-*.md" | ForEach-Object { $_.Name }
} else {
$enStories = @()
}
# Get list of Chinese stories
if (Test-Path $zhStoryDir) {
$zhStories = Get-ChildItem -Path $zhStoryDir -Filter "S-*.md" | ForEach-Object { $_.Name }
} else {
$zhStories = @()
}
# Find stories that don't have both language versions
$missingTranslations = @()
foreach ($story in $enStories) {
if ($zhStories -notcontains $story) {
$missingTranslations += "Chinese version of $story is missing"
}
}
foreach ($story in $zhStories) {
if ($enStories -notcontains $story) {
$missingTranslations += "English version of $story is missing"
}
}
if ($missingTranslations.Count -gt 0) {
Write-Host "::error::The following translations are missing: $($missingTranslations -join ', ')"
Write-Host "::error::All stories must have both English and Chinese versions!"
exit 1
}
Write-Host "Story documentation check passed!"