diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 120000 index 0000000..be77ac8 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1 @@ +../AGENTS.md \ No newline at end of file diff --git a/.goosehints b/.goosehints new file mode 120000 index 0000000..47dc3e3 --- /dev/null +++ b/.goosehints @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..232902c --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,22 @@ +# CLAUDE.md for + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +WARNING: read this closely as it gets a bit meta. + +This is a repo for a copier project intended to allow people to set up their github repo with AI github actions. + +- template files are in `template/` +- all other files are for this repo itself + +So for example + +- template/.github/workflows/claude.yml - A template that is copied into a users target repo to set up claude gh actions +- .github/workflows/claude.yml - The actual github actions for this repo itself. + +This repo eats its own dogfood! We will occasionally run + +`copier copy template .` + + + diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 232902c..0000000 --- a/CLAUDE.md +++ /dev/null @@ -1,22 +0,0 @@ -# CLAUDE.md for - -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - -WARNING: read this closely as it gets a bit meta. - -This is a repo for a copier project intended to allow people to set up their github repo with AI github actions. - -- template files are in `template/` -- all other files are for this repo itself - -So for example - -- template/.github/workflows/claude.yml - A template that is copied into a users target repo to set up claude gh actions -- .github/workflows/claude.yml - The actual github actions for this repo itself. - -This repo eats its own dogfood! We will occasionally run - -`copier copy template .` - - - diff --git a/CLAUDE.md b/CLAUDE.md new file mode 120000 index 0000000..47dc3e3 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/ai.just b/ai.just index 3d35238..dc76eac 100644 --- a/ai.just +++ b/ai.just @@ -1,12 +1,15 @@ +claude: + [ -f CLAUDE.md ] || ln -s AGENTS.md CLAUDE.md + goosehints: - [ -f .goosehints ] || ln -s CLAUDE.md .goosehints + [ -f .goosehints ] || ln -s AGENTS.md .goosehints copilot-instructions: - [ -f .github/copilot-instructions.md ] || cd .github && ln -s ../CLAUDE.md copilot-instructions.md + [ -f .github/copilot-instructions.md ] || cd .github && ln -s ../AGENTS.md copilot-instructions.md setup-ai: setup-ai-instructions setup-gh -setup-ai-instructions: goosehints copilot-instructions +setup-ai-instructions: claude goosehints copilot-instructions setup-gh: gh-add-topics gh-add-secrets @@ -14,9 +17,30 @@ gh-add-topics: gh repo edit --add-topic "monarchinitiative,ai4curation" gh-add-secrets: - gh secret set PAT_FOR_PR --body "$PAT_FOR_PR" - gh secret set ANTHROPIC_API_KEY --body "$ANTHROPIC_API_KEY" - gh secret set OPENAI_API_KEY --body "$OPENAI_API_KEY" - gh secret set CBORG_API_KEY --body "$CBORG_API_KEY" - gh secret set CLAUDE_CODE_OATH_TOKEN --body "$CLAUDE_CODE_OATH_TOKEN" + #!/usr/bin/env bash + set -euo pipefail + + # Function to set secret if env var exists + set_secret_if_exists() { + local secret_name="$1" + local gh_var="GH_$secret_name" + local plain_var="$secret_name" + + if [ -n "${!gh_var:-}" ]; then + echo "Setting $secret_name from $gh_var" + gh secret set "$secret_name" --body "${!gh_var}" + elif [ -n "${!plain_var:-}" ]; then + echo "Setting $secret_name from $plain_var" + gh secret set "$secret_name" --body "${!plain_var}" + else + echo "Skipping $secret_name (neither $gh_var nor $plain_var is set)" + fi + } + + # Set each secret if the corresponding env var exists + set_secret_if_exists "PAT_FOR_PR" + set_secret_if_exists "ANTHROPIC_API_KEY" + set_secret_if_exists "OPENAI_API_KEY" + set_secret_if_exists "CBORG_API_KEY" + set_secret_if_exists "CLAUDE_CODE_OAUTH_TOKEN"