Skip to content

Commit ebe5fbd

Browse files
authored
add trlc ai validator (#159)
1 parent 9a7c5f5 commit ebe5fbd

27 files changed

Lines changed: 4453 additions & 0 deletions

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ build --java_language_version=17
1111
build --tool_java_language_version=17
1212
build --java_runtime_version=remotejdk_17
1313
build --tool_java_runtime_version=remotejdk_17
14+
15+
# Import AI checker custom configuration
16+
try-import %workspace%/.bazelrc.ai_checker

.bazelrc.ai_checker

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
###############################################################################
2+
## GitHub Copilot SDK - Environment (config:copilot)
3+
###############################################################################
4+
# The Copilot CLI needs HOME (for stored OAuth credentials) and proxy vars
5+
# (to reach api.github.com behind a corporate proxy).
6+
#
7+
# These are scoped to --config=copilot so they don't affect other builds.
8+
# The AI checker BUILD target applies this config automatically via a
9+
# test --config=copilot line below.
10+
#
11+
# Auth docs: https://github.com/github/copilot-sdk/blob/main/docs/auth/index.md
12+
13+
# Auth
14+
build:copilot --action_env=HOME
15+
build:copilot --action_env=COPILOT_GITHUB_TOKEN
16+
build:copilot --action_env=GH_TOKEN
17+
build:copilot --action_env=GITHUB_TOKEN
18+
19+
# Proxy (Node.js checks both upper and lowercase)
20+
build:copilot --action_env=HTTP_PROXY
21+
build:copilot --action_env=HTTPS_PROXY
22+
build:copilot --action_env=NO_PROXY
23+
build:copilot --action_env=http_proxy
24+
build:copilot --action_env=https_proxy
25+
build:copilot --action_env=no_proxy

MODULE.bazel

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,26 @@ git_override(
238238
commit = "56881461f9d3fde2918d1731aa5937aaf64cd67c",
239239
remote = "https://github.com/bmw-software-engineering/lobster.git",
240240
)
241+
242+
###############################################################################
243+
# Dependencies for AI Checker
244+
###############################################################################
245+
246+
# Make the copilot CLI binary executable (rules_python strips +x from wheels)
247+
pip.whl_mods(
248+
copy_executables = {"site-packages/copilot/bin/copilot": "copilot_cli"},
249+
hub_name = "ai_checker_whl_mods",
250+
whl_name = "github_copilot_sdk",
251+
)
252+
use_repo(pip, "ai_checker_whl_mods")
253+
254+
# Core + LangChain + GitHub Copilot SDK dependencies
255+
pip.parse(
256+
hub_name = "pip_ai_checker",
257+
python_version = PYTHON_VERSION,
258+
requirements_lock = "//validation/ai_checker:requirements.txt",
259+
whl_modifications = {
260+
"@ai_checker_whl_mods//:github_copilot_sdk.json": "github-copilot-sdk",
261+
},
262+
)
263+
use_repo(pip, "pip_ai_checker")

defs.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ load(
3838
# --- starpls ---
3939
load("//starpls:starpls.bzl", _setup_starpls = "setup_starpls")
4040

41+
# --- ai_checker ---
42+
load(
43+
"//validation/ai_checker:ai_checker.bzl",
44+
_architecture_ai_test = "architecture_ai_test",
45+
_trlc_requirements_ai_test = "trlc_requirements_ai_test",
46+
)
47+
4148
score_virtualenv = _score_virtualenv
4249
score_py_pytest = _score_py_pytest
4350
dash_license_checker = _dash_license_checker
@@ -46,3 +53,5 @@ cli_helper = _cli_helper
4653
use_format_targets = _use_format_targets
4754
setup_starpls = _setup_starpls
4855
rust_coverage_report = _rust_coverage_report
56+
trlc_requirements_ai_test = _trlc_requirements_ai_test
57+
architecture_ai_test = _architecture_ai_test

validation/ai_checker/BUILD

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
load("@pip_ai_checker//:requirements.bzl", "requirement")
14+
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
15+
16+
exports_files(
17+
["src/ai_checker/orchestrator.py"],
18+
visibility = ["//visibility:public"],
19+
)
20+
21+
# Default requirements engineering guidelines
22+
filegroup(
23+
name = "default_guidelines",
24+
srcs = glob(["guidelines/*.md"]),
25+
visibility = ["//visibility:public"],
26+
)
27+
28+
# Core AI checker library (analysis framework)
29+
py_library(
30+
name = "ai_checker_core",
31+
srcs = glob(["src/ai_checker/*.py"]),
32+
imports = ["src"],
33+
visibility = ["//visibility:public"],
34+
deps = [
35+
"@trlc//trlc",
36+
requirement("bigtree"),
37+
requirement("pydantic"),
38+
requirement("pydot"),
39+
requirement("pyyaml"),
40+
],
41+
)
42+
43+
# LangChain adapter for GitHub Copilot SDK
44+
py_library(
45+
name = "copilot_langchain",
46+
srcs = [
47+
"src/copilot_adapter/__init__.py",
48+
"src/copilot_adapter/copilot_langchain.py",
49+
],
50+
imports = ["src"],
51+
visibility = ["//visibility:public"],
52+
deps = [
53+
requirement("langchain-core"),
54+
requirement("github-copilot-sdk"),
55+
requirement("pydantic"),
56+
],
57+
)
58+
59+
# Default orchestrator (uses GitHub Copilot SDK as default AI backend)
60+
py_binary(
61+
name = "orchestrator",
62+
srcs = ["src/ai_checker/orchestrator.py"],
63+
imports = ["src"],
64+
main = "src/ai_checker/orchestrator.py",
65+
visibility = ["//visibility:public"],
66+
deps = [
67+
":ai_checker_core",
68+
":copilot_langchain",
69+
requirement("langchain-core"),
70+
],
71+
)
72+
73+
# Run: bazel run //validation/ai_checker:requirements.update
74+
compile_pip_requirements(
75+
name = "requirements",
76+
src = "requirements.txt.in",
77+
requirements_txt = "requirements.txt",
78+
)

0 commit comments

Comments
 (0)