RoyLee1224 commented on code in PR #69308:
URL: https://github.com/apache/airflow/pull/69308#discussion_r3523406129


##########
dev/skill-evals/eval.py:
##########
@@ -0,0 +1,350 @@
+#!/usr/bin/env python3
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# /// script
+# requires-python = ">=3.9"
+# ///
+"""Airflow skill-eval harness.
+
+Test whether AGENTS.md guidance affects agent decisions by comparing
+arms with and without the guidance. Each arm is a git worktree of the
+real repo — the agent sees actual source files.
+
+Usage:
+    uv run dev/skill-evals/eval.py                  Test AGENTS.md changes
+    uv run dev/skill-evals/eval.py --full            Add baseline arm (no 
AGENTS.md)
+    uv run dev/skill-evals/eval.py --repeat 3        Reduce nondeterminism
+
+Authentication: Claude Code session (claude /login) or ANTHROPIC_API_KEY.
+"""
+
+from __future__ import annotations
+
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+from pathlib import Path
+
+PROMPTFOO_VERSION = "0.121.17"
+
+REPO_ROOT = Path(__file__).resolve().parent.parent.parent
+SCRIPT_DIR = Path(__file__).resolve().parent
+AGENTS_SRC = REPO_ROOT / "AGENTS.md"
+
+OUTPUT_SCHEMA = """\
+      output_format:
+        type: json_schema
+        schema:
+          type: object
+          required: [should_create, rationale]
+          additionalProperties: false
+          properties:
+            should_create:
+              type: boolean
+            type:
+              type: string
+              enum: [bugfix, feature, improvement, doc, misc, significant]
+            rationale:
+              type: string"""
+
+
+def run(cmd: list[str], **kwargs) -> subprocess.CompletedProcess[str]:
+    return subprocess.run(cmd, capture_output=True, text=True, check=False, 
**kwargs)
+
+
+def check_prerequisites() -> None:
+    if not shutil.which("node"):
+        print("Error: Node.js not found. Install Node.js >=22.22.0", 
file=sys.stderr)
+        sys.exit(1)
+    if not shutil.which("npx"):
+        print("Error: npx not found.", file=sys.stderr)
+        sys.exit(1)

Review Comment:
   54d2eefc5de611764371508d7f6018e85e4ae30f added a `run-skill-eval` manual 
hook (`language: node`) so prek installs Node + promptfoo + SDK itself, and 
fa09f9257454f9e9ce6691966c5c7b3dc640216e made it the only entry point — the 
node/npx checks you commented on are gone:
   
         prek run run-skill-eval --hook-stage manual --all-files
   
   Options go through single-value env vars, e.g.:
   
         EVAL_REPEAT=3 prek run run-skill-eval --hook-stage manual --all-files
         EVAL_FULL=1 prek run run-skill-eval --hook-stage manual --all-files
         MODEL=claude-haiku-4-5-20251001 prek run run-skill-eval --hook-stage 
manual --all-files
         
   Not sure this is the best way to expose options through prek though — open 
to better ideas if you have any.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to