On 03/08/26 at 23:46 +0200, Lucas Nussbaum wrote:
> Package: lintian
> Version: 2.138.0
> Tags: patch
> 
> Hi,
> 
> The attached patch adds a new classification tag
> 'agent-instructions-exists' that is issued when the upstream sources
> ship an instructions file consumed by an AI coding agent. The following
> files are detected: AGENTS.md, CLAUDE.md, GEMINI.md, .cursorrules,
> .windsurfrules, .github/copilot-instructions.md, and files under
> .cursor/rules/.
> 
> I plan to use it in trends.debian.net, to track AI adoption among
> Debian's upstreams.

I attached a new version of the patch, dropping the namespace from the
emmitted tag.

let me know if you prefer a MR (but I'm not allowed to push MRs to
lintian/lintian, probably because I'm not a member of the project).

Lucas
commit dfb912ab76e54880d9fd71c7c5d5b4c81db71086
Author: Lucas Nussbaum <[email protected]>
Date:   Mon Aug 3 18:49:51 2026 +0000

    new tag 'agent-instructions-exists'
    
    Add a new classification tag 'agent-instructions-exists' that is issued
    when the upstream sources ship an instructions file consumed by an AI
    coding agent. The following files are detected:
    AGENTS.md, CLAUDE.md, GEMINI.md, .cursorrules, .windsurfrules,
    .github/copilot-instructions.md, and files under .cursor/rules/.
    
    A new check 'upstream/agent-instructions' is added, which walks the
    patched source files and emits one hint per match. The naming follows
    the existing 'upstream-metadata-exists' convention.
    
    A test recipe is added that places AGENTS.md, .cursorrules and a file
    under .cursor/rules/ in the upstream source and verifies the expected
    hints.
    
    Assisted-By: AI (OpenCode+LLM 5.2)

diff --git a/lib/Lintian/Check/Upstream/AgentInstructions.pm b/lib/Lintian/Check/Upstream/AgentInstructions.pm
new file mode 100644
index 000000000..44c522810
--- /dev/null
+++ b/lib/Lintian/Check/Upstream/AgentInstructions.pm
@@ -0,0 +1,71 @@
+# upstream/agent-instructions -- lintian check script -*- perl -*-
+
+# Copyright (C) 2026 Lucas Nussbaum <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, you can find it on the World Wide
+# Web at https://www.gnu.org/copyleft/gpl.html, or write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Lintian::Check::Upstream::AgentInstructions;
+
+use v5.20;
+use warnings;
+use utf8;
+
+use List::SomeUtils qw(any);
+
+use Moo;
+use namespace::clean;
+
+with 'Lintian::Check';
+
+# Files consumed by AI coding agents and shipped by upstream.
+# Matched against the file name (relative to the patched source tree root).
+my @KNOWN_FILES = qw(
+  AGENTS.md
+  CLAUDE.md
+  GEMINI.md
+  .cursorrules
+  .windsurfrules
+  .github/copilot-instructions.md
+);
+
+# Glob match for files under .cursor/rules/.
+my $CURSOR_RULES_RE = qr{^\.cursor/rules/[^/]+\.mdc$};
+
+sub visit_patched_files {
+    my ($self, $item) = @_;
+
+    return
+      unless $item->is_file;
+
+    my $matched = any { $item->name eq $_ } @KNOWN_FILES;
+    $matched ||= $item->name =~ $CURSOR_RULES_RE;
+
+    return
+      unless $matched;
+
+    $self->pointed_hint('agent-instructions-exists', $item->pointer);
+
+    return;
+}
+
+1;
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et
diff --git a/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/fill-values b/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/fill-values
new file mode 100644
index 000000000..085058c2f
--- /dev/null
+++ b/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/fill-values
@@ -0,0 +1,3 @@
+Skeleton: source-native
+Testname: agent-instructions
+Description: Upstream sources provide AI coding-agent instructions files.
diff --git a/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/orig/.cursor/rules/copilot.mdc b/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/orig/.cursor/rules/copilot.mdc
new file mode 100644
index 000000000..9b91ea1a8
--- /dev/null
+++ b/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/orig/.cursor/rules/copilot.mdc
@@ -0,0 +1 @@
+# Cursor managed rules
diff --git a/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/orig/.cursorrules b/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/orig/.cursorrules
new file mode 100644
index 000000000..dc5b04160
--- /dev/null
+++ b/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/orig/.cursorrules
@@ -0,0 +1 @@
+# Cursor rules
diff --git a/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/orig/AGENTS.md b/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/orig/AGENTS.md
new file mode 100644
index 000000000..7d2dfc7c9
--- /dev/null
+++ b/t/recipes/checks/upstream/agent-instructions/agent-instructions/build-spec/orig/AGENTS.md
@@ -0,0 +1 @@
+# Upstream agent instructions
diff --git a/t/recipes/checks/upstream/agent-instructions/agent-instructions/eval/desc b/t/recipes/checks/upstream/agent-instructions/agent-instructions/eval/desc
new file mode 100644
index 000000000..1edebc739
--- /dev/null
+++ b/t/recipes/checks/upstream/agent-instructions/agent-instructions/eval/desc
@@ -0,0 +1,2 @@
+Testname: agent-instructions
+Check: upstream/agent-instructions
diff --git a/t/recipes/checks/upstream/agent-instructions/agent-instructions/eval/hints b/t/recipes/checks/upstream/agent-instructions/agent-instructions/eval/hints
new file mode 100644
index 000000000..5cb2033d0
--- /dev/null
+++ b/t/recipes/checks/upstream/agent-instructions/agent-instructions/eval/hints
@@ -0,0 +1,3 @@
+agent-instructions (source): agent-instructions-exists [.cursor/rules/copilot.mdc]
+agent-instructions (source): agent-instructions-exists [.cursorrules]
+agent-instructions (source): agent-instructions-exists [AGENTS.md]
diff --git a/tags/upstream/agent-instructions/agent-instructions-exists.tag b/tags/upstream/agent-instructions/agent-instructions-exists.tag
new file mode 100644
index 000000000..9c13265e8
--- /dev/null
+++ b/tags/upstream/agent-instructions/agent-instructions-exists.tag
@@ -0,0 +1,8 @@
+Tag: agent-instructions-exists
+Severity: classification
+Check: upstream/agent-instructions
+Explanation: The upstream sources ship an instructions file consumed by an
+ AI coding agent, such as <code>AGENTS.md</code>, <code>CLAUDE.md</code>,
+ <code>GEMINI.md</code>, <code>.cursorrules</code>,
+ <code>.windsurfrules</code>, <code>.github/copilot-instructions.md</code>,
+ or a file under <code>.cursor/rules/</code>.

Reply via email to