Add .celestoignore support for excluding files during deployment#4
Merged
aniketmaurya merged 3 commits intoCelestoAI:mainfrom Feb 4, 2026
Merged
Conversation
Implement .celestoignore functionality to allow users to exclude files and directories from agent deployments, similar to how .gitignore works with Git. Changes: - Add pathspec>=0.11.0 dependency for gitignore-style pattern matching - Implement _load_ignore_patterns() method in Deployment class to parse .celestoignore files - Update deploy() to recursively walk directories and filter files/directories matching ignore patterns - Support both full-line comments (lines starting with #) and inline comments (text after # on pattern lines) - Add graceful error handling with stderr warnings if .celestoignore fails to load - Add comprehensive test suite with 6 tests covering comment handling, empty lines, and inline comments - Update README.md with .celestoignore usage examples - Add CLAUDE.md documentation file for AI assistant guidance - Include .celestoignore.example with common patterns for Python projects Key features: - Format identical to .gitignore (supports all gitignore patterns) - Inline comments supported: "*.pyc # Python compiled files" - Directories filtered before recursion for efficiency - Cross-platform path handling with forward slashes - Continues deployment with warning if .celestoignore has errors Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds .celestoignore functionality to the Celesto SDK, allowing users to exclude files and directories from agent deployments using pattern matching. The implementation uses the pathspec library to provide gitignore-style pattern support.
Changes:
- Added
pathspec>=0.11.0dependency for gitignore-style pattern matching - Implemented
_load_ignore_patterns()method in theDeploymentclass to parse.celestoignorefiles - Modified the
deploy()method to recursively walk directories and filter files/directories based on ignore patterns - Added comprehensive documentation in README.md, CLAUDE.md, and a
.celestoignore.examplefile - Created test suite with 6 tests covering comment handling, empty lines, and pattern matching
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| src/celesto/sdk/client.py | Implements .celestoignore loading and filtering logic in deployment workflow |
| pyproject.toml | Adds pathspec>=0.11.0 dependency for gitignore pattern matching |
| tests/test_celestoignore.py | Comprehensive test suite for .celestoignore functionality (6 tests) |
| README.md | User-facing documentation with .celestoignore usage examples |
| CLAUDE.md | AI assistant guide with detailed implementation notes and examples |
| .celestoignore.example | Example file with common ignore patterns for Python projects |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The previous implementation incorrectly stripped ANY # character from patterns, even when it should be treated as literal. Updated to follow gitignore spec where only ' #' (space followed by #) starts a comment. Changes: - Fix _load_ignore_patterns() to only strip inline comments when # is preceded by space - # without preceding space is now treated as literal character (e.g., file#name.txt) - Add comprehensive test suite (11 tests) in test_celestoignore_spec.py to verify spec compliance - Update CLAUDE.md documentation to accurately describe inline comment behavior Test cases now cover: - Patterns with # in the middle (literal) - Patterns ending with # (literal) - Wildcard patterns containing # (literal) - Inline comments with space before # (comment) - Patterns with both literal # and inline comments - Full-line comment variations - Trailing space handling - Negation patterns with comments All 20 tests pass (6 original + 11 spec compliance + 3 other tests). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes based on PR feedback: - Move os import to module level in test_celestoignore.py for consistency - Fix MockConnection in both test files to properly call base class __init__ - Add test for empty archive scenario when all files are ignored All 21 tests pass. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Contributor
Author
|
@aniketmaurya ready for another copilot pass |
aniketmaurya
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds
.celestoignorefunctionality to the Celesto SDK, allowing users to exclude files and directories from agent deployments using gitignore-style pattern matching.Features
.celestoignorefile in their agent folder to specify files/directories to exclude.gitignore(powered by thepathspeclibrary)*.pyc # Python compiled files#are treated as comments.celestoignorecan't be read/parsed, but continues deploymentChanges
Core Implementation
pathspec>=0.11.0dependency topyproject.toml_load_ignore_patterns()method inDeploymentclassdeploy()method to use recursive directory walking with pattern filteringDocumentation
README.mdwith.celestoignoreusage examplesCLAUDE.mdfile for AI assistant guidance.celestoignore.examplewith common patterns for Python projectsTesting
tests/test_celestoignore.pywith 6 tests:#) are properly ignored#are included (not excluded by comment syntax).celestoignorefile itself is not excludedAll tests pass (9/9).
Example Usage
Create a
.celestoignorefile in your agent folder:These files will be automatically excluded when deploying with
celesto deploy.Test Plan
.celestoignorefunctionality pass🤖 Generated with Claude Code