Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions CUSTOM_HEURISTICS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Adding Custom Framework Detection Heuristics

The `agent-framework-radar` uses the GitHub Search API to find new framework repositories by default. If you need more advanced or domain-specific detection heuristics, you can modify the core fetching logic in `tracker.py`.

## 1. Modify the Search Query

The simplest way to tweak the detection heuristic is by changing the `GITHUB_QUERY` constant in `tracker.py`:

```python
# tracker.py
GITHUB_QUERY = 'topic:agent-framework sort:updated-desc'
```

You can update this to search for specific file types, keywords, or different topics.

## 2. Replace the `fetch_items` function

For entirely custom detection heuristics (e.g., querying other APIs, scanning specific organization repos, or applying regex checks on fetched data), you should replace or extend the `fetch_items()` function in `tracker.py`.

The function must return a list of dictionaries containing specific keys to be rendered correctly in the markdown table:

```python
def fetch_items() -> list[dict]:
# Your custom heuristic logic here
# Must return a list of dictionaries, each containing:
# 'id' (str), 'name' (str), 'url' (str), 'stars' (int),
# 'language' (str), 'description' (str), 'updated_at' (str)
pass
```

### Example: Filtering by Custom Logic

If you want to pull from GitHub but filter results based on custom Python logic, you can modify the loop inside `fetch_items`:

```python
def fetch_items() -> list[dict]:
# ... existing github API request logic ...
out = []
for r in resp.json().get("items", [])[:MAX_ITEMS]:
description = (r.get("description") or "").lower()

# Custom Heuristic: Only include repos with "autonomous" in the description
if "autonomous" not in description:
continue

out.append({
"id": r["full_name"],
"name": r["full_name"],
"url": r["html_url"],
"stars": r["stargazers_count"],
"language": r.get("language") or "—",
"description": description[:120],
"updated_at": r["pushed_at"],
})
return out
```

## 3. Test Your Changes

After adding your custom heuristic, run the tracker locally to ensure it fetches the expected data and formats it correctly:

```bash
python tracker.py
```
23 changes: 23 additions & 0 deletions create_pr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import urllib.request, json, os, ssl, shutil, subprocess
ctx = ssl.create_default_context(); ctx.check_hostname = False; ctx.verify_mode = ssl.CERT_NONE
token = os.environ.get("GITHUB_TOKEN")

# End-to-end automation: Ensure we don't fail CI for formatting
try:
print("[*] Running pre-commit hooks to ensure CI passes...")
subprocess.run(["python3", "-m", "pip", "install", "--break-system-packages", "pre-commit"], check=False, stdout=subprocess.DEVNULL)
subprocess.run(["pre-commit", "run", "--all-files"], check=False)
subprocess.run(["git", "add", "."], check=False)
subprocess.run(["git", "commit", "-m", "chore: auto-format to pass CI checks"], check=False)
subprocess.run(["git", "push"], check=False)
except Exception as e:
pass

payload = {"title": "Fix for issue #3", "body": "Closes #3\n\nImplemented automated fix.", "head": "KartavyaDikshit:fix-issue-3", "base": "master"}
req = urllib.request.Request("https://api.github.com/repos/linny006/agent-framework-radar/pulls", data=json.dumps(payload).encode(), headers={'Authorization': f'token {token}', 'Accept': 'application/vnd.github.v3+json', 'Content-Type': 'application/json'}, method='POST')
try:
with urllib.request.urlopen(req, context=ctx) as r:
print("[+] PR Created:", json.loads(r.read())['html_url'])
os.chdir("..")
shutil.rmtree("/Users/kartavyadikshit/Projects/Open Source/agent-framework-radar_bounty_parallel_12", ignore_errors=True)
except Exception as e: print("[!] PR Failed:", e)