Commit graph

25 commits

Author SHA1 Message Date
Ashwin Bhat
5256af2dac
Update publish.yml (#300) 2025-10-30 17:05:10 -07:00
Ashwin Bhat
edad138cb0
Limit CI examples to Python 3.13 only (#299)
Reduce CI job count by only running examples on Python 3.13 instead of
all Python versions (3.10-3.13). This reduces the combinatorial
explosion while still ensuring examples work on the latest Python
version.

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-30 17:05:01 -07:00
Ashwin Bhat
fd4e33d4b9
feat: add /generate-changelog slash command (#287)
Some checks failed
Lint / lint (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.10) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.11) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.12) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.13) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.10) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.11) (push) Has been cancelled
Test / test-examples (3.10) (push) Has been cancelled
Test / test-examples (3.11) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.12) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.13) (push) Has been cancelled
Test / test-examples (3.12) (push) Has been cancelled
Test / test-examples (3.13) (push) Has been cancelled
Move changelog generation prompt from publish.yml into a reusable slash
command at .claude/commands/generate-changelog.md. Update workflow to
call the command with version parameters.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-24 16:21:55 -07:00
Ashwin Bhat
9b8576158d
fix: fetch all git history including tags in publish workflow (#284)
The changelog generation step was failing to get the previous release
tag because the checkout action was doing a shallow clone. Adding
fetch-depth: 0 ensures all tags are available for git describe.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-23 15:03:41 -07:00
Ashwin Bhat
1f080748d4
Revert "chore: temporarily disable Windows CI in test-e2e workflow" (#241)
Reverts anthropics/claude-agent-sdk-python#234
2025-10-10 16:40:58 -07:00
Ashwin Bhat
e8d7e71a0a
Add missing hook output fields to match TypeScript SDK (#226)
Closes the gap between Python and TypeScript SDK hook output types by
adding:
- `reason` field for explaining decisions
- `continue_` field for controlling execution flow
- `suppressOutput` field for hiding stdout
- `stopReason` field for stop explanations
- `decision` now supports both "approve" and "block" (not just "block")
- `AsyncHookJSONOutput` type for deferred hook execution
- Proper typing for `hookSpecificOutput` with discriminated unions

Also adds comprehensive examples and tests:
- New examples in hooks.py demonstrating all new fields
- Unit tests in test_tool_callbacks.py for new output types
- E2E tests in e2e-tests/test_hooks.py with real API calls
- CI integration in .github/workflows/test.yml

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-09 18:13:23 -07:00
Ashwin Bhat
5bea2dc27d
chore: temporarily disable Windows CI in test-e2e workflow (#234)
Temporarily removes windows-latest from the test-e2e job matrix to
disable Windows end-to-end testing. Unit tests continue to run on
Windows.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-09 17:01:14 -07:00
Ashwin Bhat
71a85ac9aa
feat: automate changelog updates in release workflow (#231)
Replace GitHub API-based commits with local git workflow and integrate
claude-code-action to automatically generate changelog entries. The
workflow now:
- Creates release branch locally with version commits
- Uses Claude to review changes and update CHANGELOG.md
- Pushes complete branch with all commits together

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-09 10:36:54 -07:00
Ashwin Bhat
6793e40264
Add Windows support to test workflows (#222)
Some checks failed
Lint / lint (push) Has been cancelled
Test / test (macos-latest, 3.10) (push) Has been cancelled
Test / test (macos-latest, 3.11) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.10) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.11) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.12) (push) Has been cancelled
Test / test (macos-latest, 3.13) (push) Has been cancelled
Test / test (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test (windows-latest, 3.10) (push) Has been cancelled
Test / test (windows-latest, 3.11) (push) Has been cancelled
Test / test (windows-latest, 3.12) (push) Has been cancelled
Test / test (windows-latest, 3.13) (push) Has been cancelled
Test / test-e2e (macos-latest, 3.13) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.10) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.11) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.12) (push) Has been cancelled
Test / test-e2e (ubuntu-latest, 3.13) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.10) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.11) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.12) (push) Has been cancelled
Test / test-e2e (windows-latest, 3.13) (push) Has been cancelled
Test / test-examples (3.10) (push) Has been cancelled
Test / test-examples (3.11) (push) Has been cancelled
Test / test-examples (3.12) (push) Has been cancelled
Test / test-examples (3.13) (push) Has been cancelled
Add cross-platform testing for Windows alongside Linux across all test
jobs (unit tests, e2e tests, and examples). Uses native Windows
installation via PowerShell script and platform-specific timeout
handling for example scripts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-07 17:28:24 -07:00
Dickson Tsai
b3656b1765
Rename claude_code to claude_agent (#188) 2025-09-28 14:52:53 -07:00
Ashwin Bhat
233cefa3e1
feat: add version environment variable (#184)
Include the SDK version in the environment when spawning the Claude CLI
process.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-26 12:23:33 -07:00
Ashwin Bhat
12fdca9b1b
feat: improve GitHub release notes generation (#173)
Some checks failed
Lint / lint (push) Has been cancelled
Test / test (3.10) (push) Has been cancelled
Test / test (3.11) (push) Has been cancelled
Test / test (3.12) (push) Has been cancelled
Test / test (3.13) (push) Has been cancelled
Test / test-e2e (3.10) (push) Has been cancelled
Test / test-e2e (3.11) (push) Has been cancelled
Test / test-e2e (3.12) (push) Has been cancelled
Test / test-e2e (3.13) (push) Has been cancelled
Test / test-examples (3.10) (push) Has been cancelled
Test / test-examples (3.11) (push) Has been cancelled
Test / test-examples (3.12) (push) Has been cancelled
Test / test-examples (3.13) (push) Has been cancelled
Use `gh release create --generate-notes` to automatically include PR
titles, commits, and contributors in release notes instead of static
template text.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-17 20:09:35 -07:00
Ashwin Bhat
839300404f
Add custom tool callbacks and e2e tests (#157)
## Summary
This PR adds support for custom tool callbacks and comprehensive e2e
testing for MCP calculator functionality.

## Key Features Added
- **Custom tool permission callbacks** - Allow dynamic tool permission
control via `can_use_tool` callback
- **E2E test suite** - Real Claude API tests validating MCP tool
execution end-to-end
- **Fixed MCP calculator example** - Now properly uses `allowed_tools`
for permission management

## Changes
### Custom Callbacks
- Added `ToolPermissionContext` and `PermissionResult` types for tool
permission handling
- Implemented `can_use_tool` callback support in SDK client
- Added comprehensive tests in `tests/test_tool_callbacks.py`

### E2E Testing Infrastructure  
- Created `e2e-tests/` directory with pytest-based test suite
- `test_mcp_calculator.py` - Tests all calculator operations with real
API calls
- `conftest.py` - Pytest config with mandatory API key validation
- GitHub Actions workflow for automated e2e testing on main branch
- Comprehensive documentation in `e2e-tests/README.md`

### Bug Fixes
- Fixed MCP calculator example to use `allowed_tools` instead of
incorrect `permission_mode`
- Resolved tool permission issues preventing MCP tools from executing

## Testing
E2E tests require `ANTHROPIC_API_KEY` environment variable and will fail
without it.

Run locally:
```bash
export ANTHROPIC_API_KEY=your-key
python -m pytest e2e-tests/ -v -m e2e
```

Run unit tests including callback tests:
```bash
python -m pytest tests/test_tool_callbacks.py -v
```

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Kashyap Murali <kashyap@anthropic.com>
2025-09-08 08:51:40 -07:00
Ashwin Bhat
9377faa943
Standardize GitHub workflow triggers (#155)
Some checks failed
Lint / lint (push) Waiting to run
Test / test (3.10) (push) Waiting to run
Test / test (3.11) (push) Waiting to run
Test / test (3.12) (push) Waiting to run
Test / test (3.13) (push) Waiting to run
Claude Code E2E Test / integration-test (3.10) (push) Has been cancelled
Claude Code E2E Test / integration-test (3.11) (push) Has been cancelled
Claude Code E2E Test / integration-test (3.12) (push) Has been cancelled
Claude Code E2E Test / integration-test (3.13) (push) Has been cancelled
## Summary
- Standardized the trigger configuration across test, lint, and e2e
workflows
- All workflows now use consistent format with pull_request listed
before push
- E2E workflow now also runs on pushes to main branch

## Test plan
- [ ] Verify workflows trigger correctly on pull requests
- [ ] Verify workflows trigger correctly on pushes to main branch
- [ ] Check that e2e tests run successfully on main branch

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-07 18:31:38 -07:00
Ashwin Bhat
73f861235e
Add CI workflow for Claude Code SDK e2e testing (#154)
Some checks are pending
Lint / lint (push) Waiting to run
Test / test (3.10) (push) Waiting to run
Test / test (3.11) (push) Waiting to run
Test / test (3.12) (push) Waiting to run
Test / test (3.13) (push) Waiting to run
## Summary
- Added GitHub Actions workflow to test SDK integration with Claude Code
CLI
- Tests run on PR open/synchronize events across Python 3.10-3.13

## Test plan
- [x] Workflow triggers on PR events
- [x] Installs Claude Code CLI via official script
- [x] Runs quickstart example
- [x] Runs streaming_mode example

🤖 Generated with [Claude Code](https://claude.ai/code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-06 22:41:53 -07:00
Sam Fu
6bbe00cc15
fix pytest allowed tool (#117) 2025-08-06 16:03:30 -07:00
Sam Fu
58b5a41a15
allow claude gh action to lint, typecheck, and run tests (#115)
Co-authored-by: Ashwin Bhat <ashwin@anthropic.com>
2025-08-06 15:29:34 -07:00
Dickson Tsai
21428b4f4d
Fix "Publish to PyPI" workflow: Add commit signing and improve diff (#82)
* Adds commit signing
* Converts sed pattern matching to a script to ensure we don't update
version values unrelated to PyPI
* Remove the `Publish to Test PyPI first'` step since it no longer works
2025-07-21 09:53:24 -07:00
Lina Tawfik
7a9f606e5f
Add Claude issue triage workflow
- Uses claude-code-base-action for automated issue triage
- Analyzes new issues and applies appropriate labels
- Uses GitHub MCP server for issue operations
- Requires ANTHROPIC_API_KEY secret to be configured

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-03 11:15:41 -07:00
Duc Nguyen
c7630bb3c1
chore: cleanup 2025-06-29 14:35:44 +07:00
Duc Nguyen
1e20f633f1
fix: changelog comparison URL in release workflow 2025-06-29 14:27:08 +07:00
Lina Tawfik
149142c960
feat: automate version updates after PyPI release
- Update publish.yml to create PR after publishing
- Add create-release-tag.yml to tag releases when PR merges
- Eliminates manual version syncing between repo and PyPI
2025-06-27 16:56:01 -07:00
Lina Tawfik
7d488f47c0
Add Claude Code GitHub Workflow
This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.

Claude Code is an AI coding agent that can help with:
- Bug fixes and improvements
- Documentation updates
- Implementing new features
- Code reviews and suggestions
- Writing tests
- And more\!

Once merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 17:03:37 -07:00
Lina Tawfik
8c950a7457
Fix CI: Don't fail on Codecov upload errors
The tests are passing but CI was failing due to missing Codecov token.
Set fail_ci_if_error to false since coverage upload is optional.
2025-06-12 00:21:45 -07:00
Lina Tawfik
6ca3514261
Initial Python SDK import 2025-06-12 00:16:19 -07:00