Skip to content

Commit 293ad33

Browse files
committed
Switching to AGENTS.md (this repo, not the copier template)
This follows #9, we apply the template to ourself to get the changes that affect AI usage for this repo itself.
1 parent 07e2442 commit 293ad33

5 files changed

Lines changed: 57 additions & 30 deletions

File tree

.github/copilot-instructions.md

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

.goosehints

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

AGENTS.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# CLAUDE.md for
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
WARNING: read this closely as it gets a bit meta.
6+
7+
This is a repo for a copier project intended to allow people to set up their github repo with AI github actions.
8+
9+
- template files are in `template/`
10+
- all other files are for this repo itself
11+
12+
So for example
13+
14+
- template/.github/workflows/claude.yml - A template that is copied into a users target repo to set up claude gh actions
15+
- .github/workflows/claude.yml - The actual github actions for this repo itself.
16+
17+
This repo eats its own dogfood! We will occasionally run
18+
19+
`copier copy template .`
20+
21+
22+

CLAUDE.md

Lines changed: 0 additions & 22 deletions
This file was deleted.

CLAUDE.md

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

ai.just

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,46 @@
1+
claude:
2+
[ -f CLAUDE.md ] || ln -s AGENTS.md CLAUDE.md
3+
14
goosehints:
2-
[ -f .goosehints ] || ln -s CLAUDE.md .goosehints
5+
[ -f .goosehints ] || ln -s AGENTS.md .goosehints
36

47
copilot-instructions:
5-
[ -f .github/copilot-instructions.md ] || cd .github && ln -s ../CLAUDE.md copilot-instructions.md
8+
[ -f .github/copilot-instructions.md ] || cd .github && ln -s ../AGENTS.md copilot-instructions.md
69

710
setup-ai: setup-ai-instructions setup-gh
811

9-
setup-ai-instructions: goosehints copilot-instructions
12+
setup-ai-instructions: claude goosehints copilot-instructions
1013

1114
setup-gh: gh-add-topics gh-add-secrets
1215

1316
gh-add-topics:
1417
gh repo edit --add-topic "monarchinitiative,ai4curation"
1518

1619
gh-add-secrets:
17-
gh secret set PAT_FOR_PR --body "$PAT_FOR_PR"
18-
gh secret set ANTHROPIC_API_KEY --body "$ANTHROPIC_API_KEY"
19-
gh secret set OPENAI_API_KEY --body "$OPENAI_API_KEY"
20-
gh secret set CBORG_API_KEY --body "$CBORG_API_KEY"
21-
gh secret set CLAUDE_CODE_OATH_TOKEN --body "$CLAUDE_CODE_OATH_TOKEN"
20+
#!/usr/bin/env bash
21+
set -euo pipefail
22+
23+
# Function to set secret if env var exists
24+
set_secret_if_exists() {
25+
local secret_name="$1"
26+
local gh_var="GH_$secret_name"
27+
local plain_var="$secret_name"
28+
29+
if [ -n "${!gh_var:-}" ]; then
30+
echo "Setting $secret_name from $gh_var"
31+
gh secret set "$secret_name" --body "${!gh_var}"
32+
elif [ -n "${!plain_var:-}" ]; then
33+
echo "Setting $secret_name from $plain_var"
34+
gh secret set "$secret_name" --body "${!plain_var}"
35+
else
36+
echo "Skipping $secret_name (neither $gh_var nor $plain_var is set)"
37+
fi
38+
}
39+
40+
# Set each secret if the corresponding env var exists
41+
set_secret_if_exists "PAT_FOR_PR"
42+
set_secret_if_exists "ANTHROPIC_API_KEY"
43+
set_secret_if_exists "OPENAI_API_KEY"
44+
set_secret_if_exists "CBORG_API_KEY"
45+
set_secret_if_exists "CLAUDE_CODE_OAUTH_TOKEN"
2246

0 commit comments

Comments
 (0)