Skip to content

Commit 6fcb5c2

Browse files
authored
Merge pull request #102 from INCATools/ai-integrations
i Adding AI integrations
2 parents 0997864 + 3e2b976 commit 6fcb5c2

File tree

17 files changed

+1031
-0
lines changed

17 files changed

+1031
-0
lines changed

.claude/.mcp.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"mcpServers": {
3+
"ols-mcp": {
4+
"type": "stdio",
5+
"command": "uvx",
6+
"args": [
7+
"ols-mcp"
8+
],
9+
"env": {}
10+
},
11+
"pubmed": {
12+
"type": "http",
13+
"url": "https://pubmed.mcp.claude.com/mcp"
14+
}
15+
}
16+
}

.claude/settings.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(*)",
5+
"Edit",
6+
"MultiEdit",
7+
"NotebookEdit",
8+
"FileEdit",
9+
"WebFetch",
10+
"WebSearch",
11+
"Write"
12+
]
13+
}
14+
}
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
name: "Claude Code Action"
2+
description: "Run Claude Code in GitHub Actions workflows"
3+
4+
inputs:
5+
github_token:
6+
description: "GitHub token with repo and issues permissions"
7+
required: true
8+
anthropic_api_key:
9+
description: "Anthropic API key"
10+
required: false
11+
cborg_api_key:
12+
description: "CBORG API key"
13+
required: false
14+
claude_code_oauth_token:
15+
description: "Claude Code OAuth token"
16+
required: false
17+
prompt:
18+
description: "The prompt to send to Claude Code"
19+
required: false
20+
default: ""
21+
prompt_file:
22+
description: "Path to a file containing the prompt to send to Claude Code"
23+
required: false
24+
default: ""
25+
allowed_tools:
26+
description: "Comma-separated list of allowed tools for Claude Code to use"
27+
required: false
28+
default: ""
29+
output_file:
30+
description: "File to save Claude Code output to (optional)"
31+
required: false
32+
default: ""
33+
timeout_minutes:
34+
description: "Timeout in minutes for Claude Code execution"
35+
required: false
36+
default: "10"
37+
install_github_mcp:
38+
description: "Whether to install the GitHub MCP server"
39+
required: false
40+
default: "false"
41+
install_artl_mcp:
42+
description: "Whether to install the ARTL MCP server"
43+
required: false
44+
default: "false"
45+
46+
47+
runs:
48+
using: "composite"
49+
steps:
50+
- name: Install uvx
51+
shell: bash
52+
run: |
53+
curl -LsSf https://astral.sh/uv/install.sh | sh
54+
source $HOME/.cargo/env
55+
which uvx || echo "uvx not found in PATH, installing via pip"
56+
pip install uv || true
57+
58+
- name: Install Claude Code
59+
shell: bash
60+
run: npm install -g @anthropic-ai/claude-code
61+
62+
- name: Install GitHub MCP Server
63+
if: inputs.install_github_mcp == 'true'
64+
shell: bash
65+
run: |
66+
claude mcp add-json github '{
67+
"command": "docker",
68+
"args": [
69+
"run",
70+
"-i",
71+
"--rm",
72+
"-e",
73+
"GITHUB_PERSONAL_ACCESS_TOKEN",
74+
"ghcr.io/github/github-mcp-server:sha-ff3036d"
75+
],
76+
"env": {
77+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${{ inputs.GITHUB_TOKEN }}"
78+
}
79+
}'
80+
81+
- name: Install ARTL MCP Server
82+
if: inputs.install_artl_mcp == 'true'
83+
shell: bash
84+
run: |
85+
claude mcp add-json artl '{
86+
"command": "uvx",
87+
"args": [
88+
"artl-mcp"
89+
]
90+
}'
91+
92+
- name: Prepare Prompt File
93+
shell: bash
94+
id: prepare_prompt
95+
run: |
96+
97+
# Check if either prompt or prompt_file is provided
98+
if [ -z "${{ inputs.prompt }}" ] && [ -z "${{ inputs.prompt_file }}" ]; then
99+
echo "::error::Neither 'prompt' nor 'prompt_file' was provided. At least one is required."
100+
exit 1
101+
fi
102+
103+
# Determine which prompt source to use
104+
if [ ! -z "${{ inputs.prompt_file }}" ]; then
105+
# Check if the prompt file exists
106+
if [ ! -f "${{ inputs.prompt_file }}" ]; then
107+
echo "::error::Prompt file '${{ inputs.prompt_file }}' does not exist."
108+
exit 1
109+
fi
110+
111+
# Use the provided prompt file
112+
PROMPT_PATH="${{ inputs.prompt_file }}"
113+
else
114+
mkdir -p /tmp/claude-action
115+
PROMPT_PATH="/tmp/claude-action/prompt.txt"
116+
echo "${{ inputs.prompt }}" > "$PROMPT_PATH"
117+
fi
118+
119+
# Verify the prompt file is not empty
120+
if [ ! -s "$PROMPT_PATH" ]; then
121+
echo "::error::Prompt is empty. Please provide a non-empty prompt."
122+
exit 1
123+
fi
124+
125+
# Save the prompt path for the next step
126+
echo "PROMPT_PATH=$PROMPT_PATH" >> $GITHUB_ENV
127+
128+
- name: Run Claude Code
129+
shell: bash
130+
id: run_claude
131+
run: |
132+
133+
if [ ! -z "${{ inputs.claude_code_oauth_token }}" ]; then
134+
echo CLAUDE AUTH TOKEN IS NOT SET
135+
else
136+
echo CLAUDE AUTH TOKEN IS SET
137+
export ANTHROPIC_API_KEY=
138+
fi
139+
140+
ALLOWED_TOOLS_ARG=""
141+
if [ ! -z "${{ inputs.allowed_tools }}" ]; then
142+
ALLOWED_TOOLS_ARG="--allowedTools ${{ inputs.allowed_tools }}"
143+
fi
144+
145+
# Set a timeout to ensure the command doesn't run indefinitely
146+
timeout_seconds=$((${{ inputs.timeout_minutes }} * 60))
147+
148+
if [ -z "${{ inputs.output_file }}" ]; then
149+
# Run Claude Code and output to console
150+
claude \
151+
-p \
152+
--verbose \
153+
--output-format stream-json \
154+
"$(cat ${{ env.PROMPT_PATH }})" \
155+
${{ inputs.allowed_tools != '' && format('--allowedTools "{0}"', inputs.allowed_tools) || '' }}
156+
else
157+
# Run Claude Code and tee output to console and file
158+
claude \
159+
-p \
160+
--verbose \
161+
--output-format stream-json \
162+
"$(cat ${{ env.PROMPT_PATH }})" \
163+
${{ inputs.allowed_tools != '' && format('--allowedTools "{0}"', inputs.allowed_tools) || '' }} | tee output.txt
164+
165+
# Process output.txt into JSON in a separate step
166+
jq -s '.' output.txt > output.json
167+
168+
# Extract the result from the last item in the array (system message)
169+
jq -r '.[-1].result' output.json > "${{ inputs.output_file }}"
170+
171+
echo "Complete output saved to output.json, final response saved to ${{ inputs.output_file }}"
172+
fi
173+
174+
env:
175+
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
176+
# ANTHROPIC_AUTH_TOKEN: ${{ inputs.cborg_api_key }}
177+
CLAUDE_CODE_OAUTH_TOKEN: ${{ inputs.claude_code_oauth_token }}
178+
GITHUB_TOKEN: ${{ inputs.github_token }}
179+
# ANTHROPIC_BASE_URL: "https://api.cborg.lbl.gov"
180+
# DISABLE_NON_ESSENTIAL_MODEL_CALLS: "1"
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: "Claude Issue summarize Action"
2+
description: "Automatically Summarize GitHub issues using Claude Code"
3+
4+
inputs:
5+
timeout_minutes:
6+
description: "Timeout in minutes for execution"
7+
required: false
8+
default: "5"
9+
anthropic_api_key:
10+
description: "Anthropic API key"
11+
required: false
12+
cborg_api_key:
13+
description: "CBORG API key"
14+
required: false
15+
claude_code_oauth_token:
16+
description: "Claude Code OAuth token"
17+
required: false
18+
github_token:
19+
description: "GitHub token with repo and issues permissions"
20+
required: true
21+
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: Checkout repository code
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.ref }}
29+
30+
- name: Create prompt file
31+
shell: bash
32+
run: |
33+
mkdir -p /tmp/claude-prompts
34+
cat > /tmp/claude-prompts/claude-issue-summarize-prompt.txt << 'EOF'
35+
You're an Summarization assistant for GitHub issues. Your task is to analyze the issue, look up related issues, and summarize the issue.
36+
37+
Remember that this repo is primarily a note-taking and memory device for Chris Mungall, so anything you can do to enhance and enrich that would be helpful.
38+
39+
IMPORTANT: Don't make any PRs. You should ONLY post a response, IN THE SAME ISSUE.
40+
41+
Issue Information:
42+
- REPO: ${{ github.repository }}
43+
- ISSUE_NUMBER: ${{ github.event.issue.number }}
44+
45+
TASK OVERVIEW:
46+
47+
1. First, use your judgement to determine the course of action.
48+
- If the issue is an epic or has links to other issues, read those issues, and summarize them. Summarize their status etc. Given an overall summary.
49+
- If the issue is an idea or a vague high level description, run with the idea, do deep research, give heloful suggestions with links to relevant papers etc.
50+
- If there are links in the issue to websites, database entities, etc, then look these up.
51+
- If there are links or references to papers, then looks these up and summarize (don't guess content - if you can't access the paper, then say "I can't access the paper")
52+
- Try using artl-mcp to get paper fulltext.
53+
- If you want a more powerful AI agent to take on this one and make a PR, use this magic phrase: `@dragon-ai-agent please <INSTRUCTIONS>`
54+
55+
2. Next, use the GitHub tools to get context about the issue:
56+
- You have access to these github tools:
57+
- mcp__github__get_issue: Use this to retrieve the current issue's details including title, description, and existing labels
58+
- mcp__github__get_issue_comments: Use this to read any discussion or additional context provided in the comments
59+
- mcp__github__update_issue: Use this to apply labels to the issue (do not use this for commenting)
60+
- mcp__github__search_issues: Use this to find similar issues that might provide context for proper categorization and to identify potential duplicate issues
61+
- mcp__github__list_issues: Use this to understand patterns in how other issues are labeled
62+
- You can also use web searching and fetching.
63+
64+
- It's okay to not add any information if the issue is not clear.
65+
EOF
66+
67+
- name: Run Claude Code
68+
uses: ./.github/actions/claude-code-action
69+
with:
70+
prompt_file: /tmp/claude-prompts/claude-issue-summarize-prompt.txt
71+
allowed_tools: "Bash(gh label list),WebFetch,Fetch,LS,mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue,mcp__github__add_issue_comment,mcp__github__search_issues,mcp__github__list_issues"
72+
install_github_mcp: "true"
73+
install_artl_mcp: "true"
74+
timeout_minutes: ${{ inputs.timeout_minutes }}
75+
anthropic_api_key: ${{ inputs.anthropic_api_key }}
76+
claude_code_oauth_token: ${{ inputs.claude_code_oauth_token }}
77+
cborg_api_key: ${{ inputs.cborg_api_key }}
78+
github_token: ${{ inputs.github_token }}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: "Claude Issue Triage Action"
2+
description: "Automatically triage GitHub issues using Claude Code"
3+
4+
inputs:
5+
timeout_minutes:
6+
description: "Timeout in minutes for execution"
7+
required: false
8+
default: "5"
9+
anthropic_api_key:
10+
description: "Anthropic API key"
11+
required: false
12+
claude_code_oauth_token:
13+
description: "Claude Code OAuth token"
14+
required: false
15+
cborg_api_key:
16+
description: "CBORG API key"
17+
required: true
18+
github_token:
19+
description: "GitHub token with repo and issues permissions"
20+
required: true
21+
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: Checkout repository code
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ github.ref }}
29+
30+
- name: Create prompt file
31+
shell: bash
32+
run: |
33+
mkdir -p /tmp/claude-prompts
34+
cat > /tmp/claude-prompts/claude-issue-triage-prompt.txt << 'EOF'
35+
You're an issue triage assistant for GitHub issues. Your task is to analyze the issue and select appropriate labels from the provided list.
36+
37+
IMPORTANT: Don't post any comments or messages to the issue. Your only action should be to apply labels.
38+
39+
Issue Information:
40+
- REPO: ${{ github.repository }}
41+
- ISSUE_NUMBER: ${{ github.event.issue.number }}
42+
43+
TASK OVERVIEW:
44+
45+
1. First, fetch the list of labels available in this repository by running: `gh label list`. Run exactly this command with nothing else.
46+
47+
2. Next, use the GitHub tools to get context about the issue:
48+
- You have access to these tools:
49+
- mcp__github__get_issue: Use this to retrieve the current issue's details including title, description, and existing labels
50+
- mcp__github__get_issue_comments: Use this to read any discussion or additional context provided in the comments
51+
- mcp__github__update_issue: Use this to apply labels to the issue (do not use this for commenting)
52+
- mcp__github__search_issues: Use this to find similar issues that might provide context for proper categorization and to identify potential duplicate issues
53+
- mcp__github__list_issues: Use this to understand patterns in how other issues are labeled
54+
- Start by using mcp__github__get_issue to get the issue details
55+
56+
3. Analyze the issue content, considering:
57+
- The issue title and description
58+
- The type of issue (bug report, feature request, question, etc.)
59+
- Technical areas mentioned
60+
- Severity or priority indicators
61+
- User impact
62+
- Components affected
63+
64+
4. Select appropriate labels from the available labels list provided above:
65+
- Choose labels that accurately reflect the issue's nature
66+
- Be specific but comprehensive
67+
- Select priority labels if you can determine urgency (high-priority, med-priority, or low-priority)
68+
- Consider platform labels (android, ios) if applicable
69+
- If you find similar issues using mcp__github__search_issues, consider using a "duplicate" label if appropriate. Only do so if the issue is a duplicate of another OPEN issue.
70+
71+
5. Apply the selected labels:
72+
- Use mcp__github__update_issue to apply your selected labels
73+
- DO NOT post any comments explaining your decision
74+
- DO NOT communicate directly with users
75+
- If no labels are clearly applicable, do not apply any labels
76+
77+
IMPORTANT GUIDELINES:
78+
- Be thorough in your analysis
79+
- Only select labels from the provided list above
80+
- DO NOT post any comments to the issue
81+
- Your ONLY action should be to apply labels using mcp__github__update_issue
82+
- It's okay to not add any labels if none are clearly applicable
83+
EOF
84+
85+
- name: Run Claude Code
86+
uses: ./.github/actions/claude-code-action
87+
with:
88+
prompt_file: /tmp/claude-prompts/claude-issue-triage-prompt.txt
89+
allowed_tools: "Bash(gh label list),mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue,mcp__github__search_issues,mcp__github__list_issues"
90+
install_github_mcp: "true"
91+
timeout_minutes: ${{ inputs.timeout_minutes }}
92+
anthropic_api_key: ${{ inputs.anthropic_api_key }}
93+
claude_code_oauth_token: ${{ inputs.claude_code_oauth_token }}
94+
cborg_api_key: ${{ inputs.cborg_api_key }}
95+
github_token: ${{ inputs.github_token }}

.github/ai-controllers.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
["cmungall"]

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../AGENTS.md

0 commit comments

Comments
 (0)