Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
63fa1d0
Add GitHub Action to automate the creation of LLMs.txt
youssefea Sep 5, 2025
84337c2
Rename workflow to update llms.txt files
youssefea Sep 5, 2025
c767b17
test commit
youssefea Sep 5, 2025
e72fdc4
Modify GitHub Actions workflow for documentation updates
youssefea Sep 5, 2025
2c3298c
Update model version from gpt-4o to gpt-5
youssefea Sep 5, 2025
13da6cb
Refactor GitHub Actions workflow for documentation updates
youssefea Sep 5, 2025
2665fda
Update main.yml
youssefea Sep 5, 2025
64c6872
Refactor GitHub Actions workflow for LLM updates
youssefea Sep 5, 2025
abde586
Update main.yml
youssefea Sep 5, 2025
2d88dcc
docs: update llms summaries for PR #296
cursoragent Sep 5, 2025
9d5f95c
updates
youssefea Sep 5, 2025
91b6ad5
Restrict llms.txt updates and enhance logging
youssefea Sep 5, 2025
55bf3aa
update web react page to test llms.txt update
youssefea Sep 11, 2025
424ffaa
docs: update llms summaries for subdirectories (base-account)
cursoragent Sep 11, 2025
6407734
update automation name
youssefea Sep 11, 2025
91f6f3c
add llms txt automation
youssefea Sep 11, 2025
fe26c49
bring back react to test
youssefea Sep 11, 2025
c76d059
update llms automation
youssefea Sep 23, 2025
31fb64a
update github action
youssefea Sep 23, 2025
040508c
make trigger manual
youssefea Sep 23, 2025
5965cbe
update yml
youssefea Sep 23, 2025
cfe499e
update yml
youssefea Sep 23, 2025
b7ddc2d
update
youssefea Sep 23, 2025
3a425e7
update yml
youssefea Sep 23, 2025
ce88318
update flow
youssefea Sep 23, 2025
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
237 changes: 237 additions & 0 deletions .github/workflows/llms-txt-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
name: Update llms.txt and llms-full.txt

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to update LLM files for'
required: true
type: number

permissions:
contents: write
pull-requests: write

jobs:
update-llms:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check if should run
id: should-run
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "=== Manual trigger detected - will run ==="
echo "should_run=true" >> $GITHUB_OUTPUT
echo "pr_number=${{ github.event.inputs.pr_number }}" >> $GITHUB_OUTPUT
else
echo "=== PR trigger detected - will skip with instructions ==="
echo "should_run=false" >> $GITHUB_OUTPUT
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
fi

- name: Skip with instructions
if: steps.should-run.outputs.should_run == 'false'
run: |
echo "⏭️ This check is skipped by default."
echo ""
echo "To update LLM summary files:"
echo "1. Click 'Re-run jobs' above → 'Run workflow'"
echo "2. OR go to Actions tab → 'Update llms.txt and llms-full.txt' → 'Run workflow'"
echo ""
echo "This will update llms.txt and llms-full.txt files in subdirectories based on your documentation changes."
echo ""
echo "This is optional and not required for PR approval."

- name: Get PR information
if: steps.should-run.outputs.should_run == 'true'
id: pr-info
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ steps.should-run.outputs.pr_number }}
run: |
echo "=== Getting PR information ==="
pr_data=$(gh pr view $PR_NUMBER --json headRefName,baseRefName,state)
head_ref=$(echo "$pr_data" | jq -r '.headRefName')
base_ref=$(echo "$pr_data" | jq -r '.baseRefName')
state=$(echo "$pr_data" | jq -r '.state')

echo "PR #$PR_NUMBER:"
echo " Head: $head_ref"
echo " Base: $base_ref"
echo " State: $state"

if [ "$state" != "OPEN" ]; then
echo "Error: PR #$PR_NUMBER is not open"
exit 1
fi

echo "head_ref=$head_ref" >> $GITHUB_OUTPUT
echo "base_ref=$base_ref" >> $GITHUB_OUTPUT

- name: Checkout repository
if: steps.should-run.outputs.should_run == 'true'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.pr-info.outputs.head_ref }}

- name: Install Cursor CLI
if: steps.should-run.outputs.should_run == 'true'
run: |
curl https://cursor.com/install -fsS | bash
echo "$HOME/.cursor/bin" >> $GITHUB_PATH

- name: Configure git
if: steps.should-run.outputs.should_run == 'true'
run: |
git config user.name "Cursor Agent"
git config user.email "[email protected]"

- name: Detect changed subdirectories
if: steps.should-run.outputs.should_run == 'true'
id: detect-changes
run: |
echo "=== Detecting changed subdirectories ==="

changed_files=$(git diff --name-only origin/${{ steps.pr-info.outputs.base_ref }}...HEAD -- docs/)
echo "Changed files in docs/:"
echo "$changed_files"

changed_subdirs=""
for file in $changed_files; do
subdir=$(echo "$file" | sed -n 's|^docs/\([^/]*\)/.*|\1|p')
if [ -n "$subdir" ] && [ -f "docs/$subdir/llms.txt" ] && [ -f "docs/$subdir/llms-full.txt" ]; then
if [[ ! "$changed_subdirs" =~ (^|[[:space:]])"$subdir"($|[[:space:]]) ]]; then
changed_subdirs="$changed_subdirs $subdir"
echo "Found subdirectory with llms files: $subdir"
fi
fi
done

changed_subdirs=$(echo "$changed_subdirs" | xargs)

echo "changed_subdirs=$changed_subdirs" >> $GITHUB_OUTPUT
echo "=== Final changed subdirectories: $changed_subdirs ==="

- name: Update LLM summary files
if: steps.should-run.outputs.should_run == 'true' && steps.detect-changes.outputs.changed_subdirs != ''
env:
MODEL: gpt-5
CURSOR_API_KEY: ${{ secrets.CURSOR_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHANGED_SUBDIRS: ${{ steps.detect-changes.outputs.changed_subdirs }}
run: |
echo "=== Starting LLM summary files update ==="
echo "Processing subdirectories: $CHANGED_SUBDIRS"

cursor-agent -p "You are updating documentation summary files in a GitHub Actions runner.

IMPORTANT: Do NOT create branches, commit, push, or post PR comments. Only modify files in the working directory as needed.

# Context:
- Repo: ${{ github.repository }}
- PR Number: ${{ steps.should-run.outputs.pr_number }}
- Base Ref: ${{ steps.pr-info.outputs.base_ref }}
- Head Ref: ${{ steps.pr-info.outputs.head_ref }}
- Changed Subdirectories: $CHANGED_SUBDIRS

# Your Task:
Update llms.txt and llms-full.txt files in the changed subdirectories based on documentation changes in this PR.

# Step-by-Step Process (print each step):
1. Print 'STEP 1: Getting PR diff'
2. Get PR changes: \`gh pr diff ${{ steps.should-run.outputs.pr_number }}\`
3. Print 'STEP 2: Processing subdirectories: $CHANGED_SUBDIRS'
4. For each subdirectory in CHANGED_SUBDIRS:
a. Print 'STEP 3a: Reading docs/[subdirectory]/llms.txt'
b. Print 'STEP 3b: Reading docs/[subdirectory]/llms-full.txt'
c. Print 'STEP 3c: Analyzing changes for [subdirectory]'
d. If updates needed: Print 'STEP 3d: Updating files for [subdirectory]' and modify files
e. If no updates needed: Print 'STEP 3e: No updates needed for [subdirectory]'
5. Print 'STEP 4: File modifications complete'
6. Print 'TASK_FINISHED'

# File Requirements:
- Only modify docs/[subdirectory]/llms.txt and docs/[subdirectory]/llms-full.txt files
- Do NOT modify root-level llms.txt or llms-full.txt files
- llms.txt should be a concise summary/index of subdirectory documentation
- llms-full.txt should be a comprehensive guide with code examples
- Maintain existing format and style
- Only update files that need changes based on PR content

# Restrictions:
- NO git operations (no commit, push, branch creation)
- NO PR comments or API calls except gh pr diff
- Only file modifications in working directory
- Print progress steps as you go
- End with 'TASK_FINISHED'

Begin now and print each step clearly.
" --force --model "$MODEL" --output-format=text

echo "=== Cursor agent completed ==="

- name: Commit changes to PR branch
if: steps.should-run.outputs.should_run == 'true' && steps.detect-changes.outputs.changed_subdirs != ''
id: commit_changes
run: |
echo "=== Checking for changes ==="

git add -A

if git diff --staged --quiet; then
echo "No changes to commit"
echo "changes_committed=false" >> $GITHUB_OUTPUT
exit 0
fi

echo "Changes detected:"
git diff --staged --name-only

COMMIT_MSG="docs: update llms summaries for subdirectories (${{ steps.detect-changes.outputs.changed_subdirs }})"
git commit -m "$COMMIT_MSG"
git push origin ${{ steps.pr-info.outputs.head_ref }}

echo "changes_committed=true" >> $GITHUB_OUTPUT
echo "=== Changes committed successfully ==="

- name: Post PR comment about updates
if: steps.commit_changes.outputs.changes_committed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ steps.should-run.outputs.pr_number }}
run: |
echo "=== Posting PR comment about updates ==="

changed_files=$(git diff HEAD~1 --name-only | grep -E "llms(-full)?\.txt$" | head -10)

COMMENT_FILE="${RUNNER_TEMP}/llms-update-comment.md"
{
echo "✅ **LLM summary files updated successfully!**"
echo ""
echo "Updated documentation summary files based on changes in subdirectories: \`${{ steps.detect-changes.outputs.changed_subdirs }}\`"
echo ""
echo "**Files updated:**"
for file in $changed_files; do
echo "- \`$file\`"
done
echo ""
echo "_These files help AI assistants provide better guidance about your documentation._"
echo ""
echo "<!-- auto-update-llms -->"
} > "$COMMENT_FILE"

gh pr comment "$PR_NUMBER" --body-file "$COMMENT_FILE"
echo "=== PR comment posted successfully ==="

- name: Report no changes needed
if: steps.should-run.outputs.should_run == 'true' && steps.detect-changes.outputs.changed_subdirs == ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ steps.should-run.outputs.pr_number }}
run: |
echo "ℹ️ No subdirectories with LLM summary files were changed in this PR." | \
gh pr comment "$PR_NUMBER" --body-file -
56 changes: 56 additions & 0 deletions .github/workflows/llms-txt-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: LLM Files Update Available

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
pull-requests: write

jobs:
post-instruction:
if: ${{ !startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Post instruction comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
# Check if instruction comment already exists
existing_comment=$(gh pr view $PR_NUMBER --json comments --jq '.comments[] | select(.body | contains("<!-- llms-instruction -->")) | .id' || echo "")

INSTRUCTION_FILE="${RUNNER_TEMP}/instruction-comment.md"
{
echo "⏭️ **LLM Summary Files Update Available**"
echo ""
echo "This PR can automatically update \`llms.txt\` and \`llms-full.txt\` files in subdirectories based on your documentation changes."
echo ""
echo "**To trigger the automation:**"
echo ""
echo "**Option 1: From PR checks below** ⬇️"
echo "- Find \"Update llms.txt and llms-full.txt\" in the checks list below"
echo "- Click \"Details\" → \"Re-run jobs\" → \"Run workflow\""
echo ""
echo "**Option 2: From Actions tab**"
echo "- Go to [Actions tab](https://github.com/${{ github.repository }}/actions/workflows/llms-txt-automation.yml)"
echo "- Click \"Run workflow\" → Enter PR #$PR_NUMBER"
echo ""
echo "**What it does:**"
echo "- Detects which subdirectories have documentation changes"
echo "- Updates the corresponding \`llms.txt\` and \`llms-full.txt\` summary files"
echo "- Commits the changes directly to this PR branch"
echo ""
echo "_This automation is optional and not required for PR approval._"
echo ""
echo "<!-- llms-instruction -->"
} > "$INSTRUCTION_FILE"

if [ -n "$existing_comment" ]; then
echo "Updating existing instruction comment"
gh api repos/${{ github.repository }}/issues/comments/$existing_comment \
-X PATCH -f body="$(cat $INSTRUCTION_FILE)"
else
echo "Posting new instruction comment"
gh pr comment $PR_NUMBER --body-file "$INSTRUCTION_FILE"
fi
16 changes: 6 additions & 10 deletions docs/base-account/llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ const { status } = await getPaymentStatus({ id })
- [What is Base Account?](https://docs.base.org/base-account/overview/what-is-base-account.md) — Overview

### Quickstart
- [Web (Next.js)](https://docs.base.org/base-account/quickstart/web.md) — Web integration
- [Web (React)](https://docs.base.org/base-account/quickstart/web-react.md) — React example
- [Web (Next.js)](https://docs.base.org/base-account/quickstart/web-react.md) — Next.js integration
- [React Native Integration](https://docs.base.org/base-account/quickstart/mobile-integration.md) — Mobile

### Guides
Expand Down Expand Up @@ -77,23 +76,20 @@ const { status } = await getPaymentStatus({ id })

## Quickstart (excerpts)

Source: `https://docs.base.org/base-account/quickstart/web.md`
Source: `https://docs.base.org/base-account/quickstart/web-react.md`

Base Account lets you add a passkey‑secured ERC‑4337 smart account to your app, with sponsored gas, batch transactions, spend permissions, and sub‑accounts.

Install and initialize:

```bash
npm install @base-org/account
npm install @base-org/account @base-org/account-ui
```

```ts
import { createBaseAccount } from '@base-org/account'
import { createBaseAccountSDK } from '@base-org/account'

const account = await createBaseAccount({
owner: '0xYourEOA',
chain: 'base-sepolia'
})
const provider = createBaseAccountSDK().getProvider()
```

Send a payment with Base Pay (testnet):
Expand All @@ -108,7 +104,7 @@ const { status } = await getPaymentStatus({ id })
Batch two calls in one user operation:

```ts
const result = await account.provider.request({
const result = await provider.request({
method: 'wallet_sendCalls',
params: [{
calls: [
Expand Down
2 changes: 1 addition & 1 deletion docs/base-account/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [What is Base Account?](https://docs.base.org/base-account/overview/what-is-base-account.md) — Core concepts and benefits

## Quickstart
- [Web (Next.js)](https://docs.base.org/base-account/quickstart/web.md) — Add Base Account to a web app
- [Web (Next.js)](https://docs.base.org/base-account/quickstart/web-react.md) — Add Base Account to a Next.js app
- [React Native Integration](https://docs.base.org/base-account/quickstart/mobile-integration.md) — Mobile setup and flows

## Guides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ Future versions of Base Account may support it.
You can use a factory contract or a transaction with the `CREATE2` opcode to deploy a smart contract.
</Tip>

## Solidity's Builtin `transfer` function

The `transfer` function is a built-in member of the `address` type in Solidity that can be used to send ETH to an address. Base Account wallets cannot receive ETH using this function.
This function has long been considered deprecated in favor of `call` by the Solidity community, but some older contracts still use it.

The reason for this is that `transfer` only forwards 2300 gas to the `transfer` call, a protective mechanism that was designed to prevent reentrancy attacks by limiting the amount of
gas available to a smart contract that might reenter the caller.
In the modern world of smart contract wallets (including for Base Account), this is often not enough gas for the smart contract's `receive` or `fallback` functions to complete their work,
causing the transaction to revert.

### Known affected contracts

- The [WETH9 contract](https://basescan.org/token/0x4200000000000000000000000000000000000006) uses `transfer` to send ETH to the user's wallet and therefore Base Accounts cannot directly unwrap ETH from it.
Expand Down
Loading
Loading