Skip to content

Conversation

@bobzhang
Copy link
Contributor

@bobzhang bobzhang commented Oct 15, 2025

This PR adds comprehensive, executable documentation for the HTTP and Process packages in the form of README.mbt.md files.

Changes

  • Added HTTP package README.mbt.md with 19 executable test examples
  • Added Process package README.mbt.md with 24 executable test examples
  • Created README.md symlinks for both packages
  • All tests passing (43/43 README tests, 49/49 total http+process tests)

HTTP Package Coverage

The HTTP documentation includes comprehensive examples for:

HTTP Client Usage

  • Quick Start: Simple GET requests with and without custom headers
  • One-Shot Requests: GET, POST, and PUT operations for single-use connections
  • Persistent Connections: Connection reuse, HTTPS support, custom ports
  • Request Methods: Detailed examples for GET, POST, PUT operations
  • Custom Headers: Persistent headers on client and per-request headers
  • Request/Response Bodies: Manual body sending, reading headers, skipping bodies

Reference Documentation

  • Types Reference: Protocol enum and Response structure
  • Error Handling: Examples for invalid URLs and connection errors
  • Best Practices: Guidelines for proper connection management and error handling

Process Package Coverage

The Process documentation includes comprehensive examples for:

Process Management

  • Quick Start: Simple command execution and exit code handling
  • Output Collection: Collect stdout, stderr, both streams, or merged output
  • I/O with Pipes: Reading from and writing to processes
  • File Redirection: Input from files, output to files, file-to-file operations
  • Environment Variables: Setting custom env vars, isolated environments
  • Working Directory: Changing process working directory
  • Async Management: Spawn and wait, orphan processes with delayed waiting
  • Advanced Usage: Merge output streams, multiple processes sharing pipes

Reference Documentation

  • Types Reference: ProcessInput and ProcessOutput traits
  • Best Practices: Guidelines for pipe management and error handling
  • Error Handling: Examples for command failures and exit codes

Testing

All code examples are executable and verified with:

  • moon check for type checking
  • moon test for runtime verification
  • Black-box testing approach using @http and @process notation

This follows the same documentation approach as the fs package README.

- Add README.mbt.md with 19 executable test examples
- Cover HTTP client usage: one-shot requests, persistent connections
- Document request methods (GET, POST, PUT)
- Include examples for custom headers and body handling
- Add types reference for Protocol and Response
- Include error handling examples
- Create README.md symlink to README.mbt.md
- All tests passing (19/19 README tests, 30/30 total http tests)
- Add README.mbt.md with 24 executable test examples
- Cover process spawning, I/O pipes, file redirection
- Document environment variables and working directory control
- Include examples for async process management
- Add types reference for ProcessInput and ProcessOutput
- Include best practices and error handling examples
- Create README.md symlink to README.mbt.md
- Update existing test snapshots to include new README files
- All tests passing (24/24 README tests, 41/41 total process tests)
@bobzhang bobzhang changed the title Add comprehensive README.mbt.md documentation for HTTP package Add comprehensive README.mbt.md documentation for HTTP and Process packages Oct 15, 2025
@Guest0x0
Copy link
Collaborator

Is the process part the same as #125?

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.

3 participants