Skip to content

feat(vfs): add text_file and readonly_text builder methods - #103

Merged
chaliy merged 1 commit into
mainfrom
claude/add-readonly-text-feature-vtPPm
Feb 3, 2026
Merged

feat(vfs): add text_file and readonly_text builder methods#103
chaliy merged 1 commit into
mainfrom
claude/add-readonly-text-feature-vtPPm

Conversation

@chaliy

@chaliy chaliy commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add text_file(path, content) and readonly_text(path, content) convenience methods to BashBuilder
  • Add InMemoryFs::add_file() for synchronous file creation during setup with automatic parent directory creation
  • Update VFS spec (003-vfs.md) with documentation for the new feature

Details

These methods make it easy to pre-populate the virtual filesystem during Bash construction without needing async code:

let mut bash = Bash::builder()
    .text_file("/config/app.conf", "debug=true\nport=8080\n")
    .readonly_text("/etc/version", "1.2.3")
    .build();

Use cases:

  • Configuration files for scripts to read
  • Reference data that shouldn't be modified
  • Pre-seeding test fixtures
  • Simulating system files like /etc/passwd

Test plan

  • 12 new unit tests covering all functionality
  • Tests verify file creation, permissions (0o644 vs 0o444), parent directory creation
  • All 541 existing tests continue to pass
  • New example text_files.rs demonstrates usage patterns

https://claude.ai/code/session_019zbW5sGDfV1uSjRp9RRRSR

Add convenience methods to BashBuilder for pre-populating the virtual
filesystem with text files during construction:

- `text_file(path, content)` - Creates writable file (mode 0o644)
- `readonly_text(path, content)` - Creates readonly file (mode 0o444)

Also adds `InMemoryFs::add_file()` for synchronous file creation during
setup, with automatic parent directory creation.

Features:
- Parent directories created automatically
- Works with default InMemoryFs
- Full test coverage (12 new tests)
- Example demonstrating usage patterns

https://claude.ai/code/session_019zbW5sGDfV1uSjRp9RRRSR
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@chaliy
chaliy merged commit e7443ea into main Feb 3, 2026
7 checks passed
@chaliy
chaliy deleted the claude/add-readonly-text-feature-vtPPm branch February 3, 2026 04:24
chaliy added a commit that referenced this pull request May 30, 2026
## Summary
- Add `text_file(path, content)` and `readonly_text(path, content)`
convenience methods to `BashBuilder`
- Add `InMemoryFs::add_file()` for synchronous file creation during
setup with automatic parent directory creation
- Update VFS spec (003-vfs.md) with documentation for the new feature

## Details

These methods make it easy to pre-populate the virtual filesystem during
Bash construction without needing async code:

```rust
let mut bash = Bash::builder()
    .text_file("/config/app.conf", "debug=true\nport=8080\n")
    .readonly_text("/etc/version", "1.2.3")
    .build();
```

**Use cases:**
- Configuration files for scripts to read
- Reference data that shouldn't be modified
- Pre-seeding test fixtures
- Simulating system files like `/etc/passwd`

## Test plan
- [x] 12 new unit tests covering all functionality
- [x] Tests verify file creation, permissions (0o644 vs 0o444), parent
directory creation
- [x] All 541 existing tests continue to pass
- [x] New example `text_files.rs` demonstrates usage patterns

https://claude.ai/code/session_019zbW5sGDfV1uSjRp9RRRSR

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants