diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..7f363e6 --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "libmentor": { + "version": "0.1.0", + "commands": [ + "libmentor" + ], + "rollForward": false + } + } +} diff --git a/.github/actions/libmentor/action.yml b/.github/actions/libmentor/action.yml new file mode 100644 index 0000000..39b61a0 --- /dev/null +++ b/.github/actions/libmentor/action.yml @@ -0,0 +1,19 @@ +name: Generate LibMentor documentation +description: Build validated AI documentation from a versioned source snapshot +runs: + using: composite + steps: + - uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + - name: Restore pinned CLI + shell: bash + working-directory: ${{ github.workspace }} + run: dotnet tool restore + - name: Generate and verify + shell: bash + working-directory: ${{ github.workspace }} + run: | + version="$(python3 .github/scripts/libmentor-version.py)" + dotnet tool run libmentor -- generate --revision "$GITHUB_SHA" --library-version "$version" + dotnet tool run libmentor -- generate --check --revision "$GITHUB_SHA" --library-version "$version" diff --git a/.github/scripts/libmentor-version.py b/.github/scripts/libmentor-version.py new file mode 100644 index 0000000..cbb471a --- /dev/null +++ b/.github/scripts/libmentor-version.py @@ -0,0 +1,11 @@ +import json +import os +from pathlib import Path +import xml.etree.ElementTree as ET + +version = ET.parse("BlazorJS/BlazorJS.csproj").findtext(".//VersionPrefix") +if not version: + raise SystemExit("Library version could not be resolved.") +revision = os.environ.get("GITHUB_SHA", "local")[:12] +base = version.split("+", 1)[0] +print(base + (".source." if "-" in base else "-source.") + revision) diff --git a/.github/workflows/libmentor-pages.yml b/.github/workflows/libmentor-pages.yml new file mode 100644 index 0000000..c5a4f92 --- /dev/null +++ b/.github/workflows/libmentor-pages.yml @@ -0,0 +1,35 @@ +name: Documentation Pages +on: + push: + branches: [master] + workflow_dispatch: +permissions: + contents: read +concurrency: + group: pages + cancel-in-progress: true +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/libmentor + - name: Assemble documentation site + run: | + cp -R docs site + cp -R .libmentor site/ai + - uses: actions/upload-pages-artifact@v3 + with: + path: site + deploy: + needs: build + runs-on: ubuntu-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/libmentor.yml b/.github/workflows/libmentor.yml new file mode 100644 index 0000000..82d8fb1 --- /dev/null +++ b/.github/workflows/libmentor.yml @@ -0,0 +1,19 @@ +name: LibMentor validation +on: + pull_request: + push: + branches: [master] + workflow_dispatch: +permissions: + contents: read +jobs: + validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/libmentor + - uses: actions/upload-artifact@v4 + with: + name: libmentor-documentation + path: .libmentor + include-hidden-files: true diff --git a/.gitignore b/.gitignore index 59b0819..7534b7c 100644 --- a/.gitignore +++ b/.gitignore @@ -349,3 +349,6 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ /.idea + +.libmentor/ +.libmentor-inputs/ diff --git a/LIBMENTOR.md b/LIBMENTOR.md new file mode 100644 index 0000000..0ddc15b --- /dev/null +++ b/LIBMENTOR.md @@ -0,0 +1,11 @@ +# AI documentation + +LibMentor generates versioned documentation from this repository. Restore the pinned tool with `dotnet tool restore`, then run `dotnet tool run libmentor -- generate`. + +CI resolves the library version from its existing metadata and adds a source revision suffix. This describes the source snapshot, rather than claiming that a package with the same version has already been released. Files are generated under `.libmentor/`; repository contributor instructions are preserved. + +The consumer entry point after deployment is [llms.txt](https://fgilde.github.io/BlazorJS/ai/llms.txt). The same output is available as the `libmentor-documentation` workflow artifact. The first LibMentor 0.1.0 NuGet release must exist before tool restore can succeed. + +The published skill is under `ai/skills/`. Copy the complete library folder, including its references, to your client's skills directory. + +Generation validates local Markdown links and explicit API-symbol links. C# source declarations are parsed without a project build; see extraction evidence in `knowledge.json`. Compiled Razor APIs require compiler XML input. Markdown code fences are not compiled automatically. diff --git a/libmentor.json b/libmentor.json new file mode 100644 index 0000000..d205ff1 --- /dev/null +++ b/libmentor.json @@ -0,0 +1,29 @@ +{ + "schemaVersion": 1, + "name": "BlazorJS", + "repository": "https://github.com/fgilde/BlazorJS", + "revision": "master", + "output": ".libmentor", + "exclude": [ + "**/*.de.md", + "docs/de/**", + "**/node_modules/**" + ], + "examples": [], + "guidance": [ + "This is a source snapshot. Check the installed package version and API evidence before suggesting code." + ], + "description": "JavaScript loading, unloading and dynamic invocation for Blazor.", + "version": "2.3.0-source", + "documents": [ + "README.md", + "docs/index.html" + ], + "sources": [ + "BlazorJS/**/*.cs" + ], + "packages": [ + "BlazorJS" + ], + "baseUrl": "https://fgilde.github.io/BlazorJS/ai" +}