Skip to content

Commit 40c462f

Browse files
author
Test User
committed
Add CI test for AGENTS.md AI rules feature
- Add new 'ai-rules' job to validate AGENTS.md generation - Test symlink creation for CLAUDE.md and GEMINI.md - Verify conditional symlink logic (enabled/disabled scenarios) - Validate AGENTS.md content and readability - Ensure extension integrity with AI rules enabled
1 parent a7e9fe9 commit 40c462f

File tree

1 file changed

+102
-0
lines changed

1 file changed

+102
-0
lines changed

.github/workflows/main.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,108 @@ jobs:
200200
popd
201201
rm -rf myextension
202202
203+
ai-rules:
204+
runs-on: ubuntu-latest
205+
strategy:
206+
matrix:
207+
# Test different combinations of AI rules settings
208+
include:
209+
- has_ai_rules: "y"
210+
create_claude_symlink: "y"
211+
create_gemini_symlink: "y"
212+
- has_ai_rules: "y"
213+
create_claude_symlink: "n"
214+
create_gemini_symlink: "y"
215+
216+
steps:
217+
- name: Checkout
218+
uses: actions/checkout@v4
219+
220+
- name: Base Setup
221+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
222+
223+
- name: Install dependencies
224+
run: |
225+
python -m pip install "copier>=9.2.0" jinja2-time
226+
227+
- name: Setup Git
228+
run: |
229+
git config --global user.name "github-actions[bot]"
230+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
231+
232+
- name: Create extension with AI rules
233+
run: |
234+
set -eux
235+
mkdir myextension
236+
python -m copier copy -l -d author_name="My Name" -d has_ai_rules=${{ matrix.has_ai_rules }} -d create_claude_symlink=${{ matrix.create_claude_symlink }} -d create_gemini_symlink=${{ matrix.create_gemini_symlink }} -d repository="https://github.com/test/lab-extension" --vcs-ref HEAD --UNSAFE . myextension
237+
cd myextension
238+
239+
- name: Verify AGENTS.md exists
240+
run: |
241+
set -eux
242+
cd myextension
243+
test -f AGENTS.md
244+
echo "✓ AGENTS.md exists"
245+
# Verify it has content
246+
test -s AGENTS.md
247+
echo "✓ AGENTS.md is not empty"
248+
# Check for expected content markers
249+
grep -q "JupyterLab Extension Development" AGENTS.md
250+
echo "✓ AGENTS.md contains expected content"
251+
252+
- name: Verify CLAUDE.md symlink (if enabled)
253+
if: matrix.create_claude_symlink == 'y'
254+
run: |
255+
set -eux
256+
cd myextension
257+
test -L CLAUDE.md
258+
echo "✓ CLAUDE.md is a symlink"
259+
# Verify it points to AGENTS.md
260+
readlink CLAUDE.md | grep -q "AGENTS.md"
261+
echo "✓ CLAUDE.md points to AGENTS.md"
262+
# Verify content is accessible through symlink
263+
test -s CLAUDE.md
264+
echo "✓ CLAUDE.md symlink is readable"
265+
266+
- name: Verify CLAUDE.md does not exist (if disabled)
267+
if: matrix.create_claude_symlink == 'n'
268+
run: |
269+
set -eux
270+
cd myextension
271+
if [ -f CLAUDE.md ]; then
272+
echo "✗ CLAUDE.md should not exist when create_claude_symlink=n"
273+
exit 1
274+
fi
275+
echo "✓ CLAUDE.md correctly not created"
276+
277+
- name: Verify GEMINI.md symlink (if enabled)
278+
if: matrix.create_gemini_symlink == 'y'
279+
run: |
280+
set -eux
281+
cd myextension
282+
test -L GEMINI.md
283+
echo "✓ GEMINI.md is a symlink"
284+
readlink GEMINI.md | grep -q "AGENTS.md"
285+
echo "✓ GEMINI.md points to AGENTS.md"
286+
test -s GEMINI.md
287+
echo "✓ GEMINI.md symlink is readable"
288+
289+
- name: Install and validate extension still works
290+
run: |
291+
set -eux
292+
cd myextension
293+
pip install "jupyterlab>=4.0.0,<5" setuptools
294+
YARN_ENABLE_IMMUTABLE_INSTALLS=false jlpm
295+
jlpm lint:check
296+
pip install -e .
297+
jupyter labextension develop . --overwrite
298+
jupyter labextension list
299+
jupyter labextension list 2>&1 | grep -ie "myextension.*OK"
300+
301+
- name: Cleanup
302+
if: always()
303+
run: rm -rf myextension
304+
203305
server:
204306
runs-on: ${{ matrix.os }}
205307
strategy:

0 commit comments

Comments
 (0)