-
Notifications
You must be signed in to change notification settings - Fork 0
Release v0.3.0: Streaming API + Buffer Overflow Fixes #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
koficodedat
merged 20 commits into
main
from
claude/enhance-cli-progress-reporting-LVOek
Jan 14, 2026
Merged
Release v0.3.0: Streaming API + Buffer Overflow Fixes #3
koficodedat
merged 20 commits into
main
from
claude/enhance-cli-progress-reporting-LVOek
Jan 14, 2026
Conversation
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
…gressBuilder
Phase 1 Complete ✅ (Multi-API Design)
Added:
- src/progress-tracker.ts: Instance-based ProgressTracker class
- src/progress-builder.ts: Fluent builder pattern API
- src/index.ts: createProgress() factory function
- test/progress-tracker.test.ts: 15 tests for ProgressTracker
- test/progress-builder.test.ts: 10 tests for ProgressBuilder
- test/create-progress.test.ts: 17 tests for integration and backward compatibility
Results:
- All 121 existing tests pass (backward compatibility confirmed)
- 42 new tests added
- Total: 163 tests passing ✅
Implementation:
- Three ways to create progress trackers:
1. Direct: new ProgressTracker(config)
2. Builder: new ProgressBuilder().withTotal(100).withMessage('test').build()
3. Factory: createProgress(config)
- Full backward compatibility with functional API (init, increment, set, finish, get, clear)
- Result type pattern maintained
- File-based atomic writes preserved
Closes Phase 1 implementation from ENHANCEMENT_PLAN.md
…cking
Phase 2 Complete ✅ (Concurrent Progress Tracking - API only)
Added:
- src/multi-progress.ts: MultiProgress class for managing multiple trackers (284 lines)
- test/multi-progress.test.ts: 28 comprehensive tests
- src/index.ts: Export MultiProgress and related types
Features:
- add(): Create new progress trackers within container
- get()/getAll(): Retrieve tracker(s) by ID
- remove(): Delete specific tracker
- done(): Mark all trackers as complete
- clear(): Remove all trackers and cleanup
- sync(): Reload state from disk
- status(): Get current state snapshot
Implementation:
- File-based state in progress-multi-{id}.json
- Atomic writes for concurrent safety
- Each tracker gets unique scoped ID
- Independent tracker updates
- State persistence across instances
Tests:
- 16 unit tests (constructor, add, get, remove, done, clear, status)
- 7 concurrent safety tests (rapid updates, state persistence, removal safety)
- 5 edge case tests (empty container, long IDs, special chars, unicode)
Results:
- All 191 tests passing ✅ (163 → 191, added 28)
- TypeScript compilation clean
- Full backward compatibility maintained
CLI Support: Deferred to v0.2.1 (API-first release)
Closes Phase 2 implementation from ENHANCEMENT_PLAN.md
Phase 3 Complete ✅ (Template System)
Added:
- src/templates.ts: Template engine with variable substitution (205 lines)
- test/templates.test.ts: 48 comprehensive tests
- src/index.ts: Export TemplateEngine, templates, spinners
Features:
- TemplateEngine class for parsing and rendering templates
- Variable substitution: {{percentage}}, {{current}}, {{total}}, {{message}}, {{elapsed}}, {{spinner}}, {{bar}}, {{eta}}
- Built-in templates:
* templates.bar - Progress bar: [████░░░░] 50%
* templates.spinner - Animated spinner: ⠋ Processing...
* templates.percentage - Percentage only: 50%
* templates.detailed - Detailed: [50%] 50/100 - Processing (5s)
* templates.minimal - Minimal: Processing 50%
* templates.full - Full with ETA
* templates.spinnerProgress - Spinner + progress
- 5 built-in spinner sets: dots, line, arrows, box, clock
- Unicode progress bar rendering with █ and ░ characters
- Configurable bar width and spinner frames
- ETA calculation based on progress rate
Implementation:
- String and function template support
- Automatic spinner frame rotation
- Configurable via constructor options
- Methods: render(), resetSpinner(), setSpinnerFrames(), setBarWidth()
- Factory function: createTemplateEngine()
Tests:
- 18 template engine tests (constructor, render, variables)
- 3 spinner animation tests (frame advancement, built-in sets)
- 5 progress bar rendering tests (0%, 50%, 100%, different widths)
- 3 ETA calculation tests (edge cases, rate calculation)
- 7 built-in template tests (all template formats)
- 2 factory function tests
- 5 spinner set tests (verifying all built-in sets)
- 5 edge case tests
Results:
- All 239 tests passing ✅ (191 → 239, added 48)
- TypeScript compilation clean
- Full backward compatibility maintained
Closes Phase 3 implementation from ENHANCEMENT_PLAN.md
- Updated badges: version 0.2.0, 239 tests passing - Added 'What's New in v0.2.0' section highlighting major enhancements - Documented new APIs: ProgressBuilder, ProgressTracker, MultiProgress, TemplateEngine - Updated Features section with new capabilities - Updated Testing section with complete test breakdown (239 tests) - Updated Future Enhancements showing completed features - Created 4 new example files: - builder-api.ts: Demonstrates fluent Builder API - multi-progress.ts: Shows MultiProgress concurrent tracking - templates.ts: Template customization and spinners - advanced.ts: Multi-stage pipeline combining features - Updated Examples section referencing new files - Maintained backward compatibility documentation for legacy API
Planning document for next version including: - Phase 1: Streaming API (async generators, stream integration) - Phase 2: CLI nested commands (improved UX, backward compatible) - Phase 3: SPEC.md formal specification - Phase 4: Advanced examples (4 new real-world demos) - Phase 5: Performance benchmarks (optional) Target: 300+ tests, 3-4 sessions estimated effort
- Document progress state format with JSON schema - Specify file format for single and multi-progress - Define atomic write algorithm for concurrent safety - Document template system with 8 variables - Specify CLI protocol with exit codes - Define error handling patterns - Document versioning and compatibility guarantees - List implementation requirements and performance targets - 787 lines covering all v0.2.0 behavior Completes Phase 3 of v0.3.0 enhancement plan
Phase 2: CLI Nested Commands - COMPLETE New nested command structure: - Single progress: prog <tracker-id> <action> [args] - Multi-progress: prog multi <multi-id> <action> [args] - Global: prog list|version|help 14 total commands implemented: - Single (6): init, inc, set, get, done, clear - Multi (5): init, add, status, done, clear - Global (3): list, version, help Features: - Type-safe command parsing with union types - Backward compatibility with legacy flat commands - Deprecation warnings for old syntax - Improved UX: tracker ID first, action second Implementation: - src/cli/parser.ts (419 lines) - Command parser - src/cli/executor.ts (483 lines) - Command executor - src/index.ts - Updated main() to use new modular CLI TypeScript compilation: ✅ All errors fixed (24 → 0) Build: ✅ npm run build succeeds Next steps (Step 2.4-2.5): - Update CLI documentation - Add 25 tests for CLI commands
No official release has been made yet, so backward compatibility is not needed. This simplifies the codebase significantly. Changes: - Removed LegacyCommand type from parser.ts - Removed parseLegacyCommand(), parseLegacyFlags(), isLegacyCommand() - Removed getDeprecationWarning() export - Removed executeLegacyCommand() from executor.ts - Removed legacy command handling from executeCommand() File size reduction: - parser.ts: 445 → 285 lines (-160 lines, -36%) - executor.ts: 469 → 434 lines (-35 lines, -7%) Total cleanup: -195 lines of legacy code removed TypeScript compilation: ✅ Build: ✅ Command structure (final): - Single: prog <tracker-id> <action> [args] - Multi: prog multi <multi-id> <action> [args] - Global: prog list|version|help
Step 2.4: Update CLI Documentation - COMPLETE Changes: - Updated version badge: 0.2.0 → 0.3.0 - Added 'What's New in v0.3.0' section - Updated 'As a CLI' section with new nested syntax - Updated 'In Shell Scripts' section with examples - Added multi-progress CLI examples - Added global commands documentation - Documented breaking change from flat to nested syntax New command structure documented: - Single: prog <tracker-id> <action> [args] - Multi: prog multi <multi-id> <action> [args] - Global: prog list|version|help Examples show both single and multi-progress workflows
- Multi-progress 'trackers' is an object, not array - Changed all trackers.length checks to Object.keys(trackers).length - Fixed help command assertion to match actual output - All 244 tests now passing (31 new CLI tests added)
- Created ProgressStream class implementing AsyncIterableIterator - Added ProgressTransform stream wrapper with attachProgress() factory - Integrated with existing ProgressTracker for state management - Added 20 comprehensive tests (8 async + 7 stream + 5 error) - All 264 tests passing (244 → 264) - Exports: ProgressStream, createProgressStream, ProgressTransform, attachProgress Features: - Async generator integration for automatic progress tracking - Node.js stream wrapper with progress events - Configurable increment amounts and update intervals - Full error handling and backpressure support - Zero runtime dependencies maintained
Examples created: 1. streaming-async.ts - Async generator integration (4 examples) - Basic async generator with progress - Multi-step processing pipeline - Error handling in async generators - Consuming progress streams 2. streaming-node.ts - Node.js stream integration (4 examples) - File processing with progress - Streaming data processing - CSV processing with progress - Stream error handling 3. multi-stage-pipeline.ts - Complex pipelines (4 examples) - Basic multi-stage pipeline - Parallel processing pipeline - Dependency-based pipeline - Real-world ETL pipeline 4. cli-integration.ts - Real CLI tool integration (5 examples) - Basic CLI with progress - CLI with pattern matching - CLI with spinner - CLI with error recovery/retry - Concurrent processing CLI All examples: - Demonstrate real-world usage patterns - Include error handling - Show multiple rendering templates - Are executable with npx tsx - TypeScript compilation verified
…lete) - Created benchmarks/package.json with tatami-ng dependency - Created benchmarks/index.bench.ts with 26 benchmarks: - Single Progress Operations (5 benchmarks) - Multi-Progress Operations (5 benchmarks) - Template Rendering (6 benchmarks) - Streaming API - Async Generators (3 benchmarks) - Streaming API - Node.js Streams (4 benchmarks) - Error handling tests (3 benchmarks in streaming.test.ts) - Created benchmarks/README.md with full performance analysis - All benchmarks passing with excellent results: - Single operations: ~1.5 ms (meets <2ms target) - Template rendering: <2 µs (500x better than <1ms target) - Multi-progress (10 trackers): 11 ms (acceptable, I/O bound) - Streaming APIs: Linear scaling, predictable performance v0.3.0 enhancement plan complete (all 5 phases): ✅ Phase 1: Streaming API (20 tests) ✅ Phase 2: CLI nested commands (24 tests already passing) ✅ Phase 3: Skipped (out of scope for v0.3.0) ✅ Phase 4: Advanced examples (4 example files) ✅ Phase 5: Performance benchmarks (26 benchmarks, full analysis) Total test count: 264 tests Total benchmark count: 26 benchmarks
- Created SPEC.md with 7 main sections: 1. Progress State Format (interface, JSON schema, derived values) 2. File Format Specification (single/multi-progress, atomic write algorithm) 3. Concurrent Safety Guarantees (multi-process safety, lock-free design) 4. Template System Specification (variable syntax, built-in templates, spinners) 5. Streaming API Specification (ProgressStream, ProgressTransform) 6. CLI Protocol (10 commands including list and version) 7. Error Handling (Result type, error categories, recovery strategies) - Includes 3 appendices: - Appendix A: Performance Characteristics (references benchmarks) - Appendix B: Compatibility (Node.js versions, filesystem requirements) - Appendix C: Changelog (v0.1.0 → v0.3.0) - Documented all behavior with: - Type definitions and interfaces - JSON schemas - Algorithms (percentage calculation, ETA, spinner rotation, atomic writes) - Diagrams (concurrent write scenarios) - Examples (CLI usage, error handling, streaming patterns) - Validated against implementation (263/264 tests passing) - 1 test failure is in 'list' command test infrastructure, not spec issue Phase 3 complete. All v0.3.0 phases done: ✅ Phase 1: Streaming API (20 tests) ✅ Phase 2: CLI nested commands (24 tests) ✅ Phase 3: SPEC.md formal specification ✅ Phase 4: Advanced examples (4 files) ✅ Phase 5: Performance benchmarks (26 benchmarks)
- Add output limiting to list command (default: 50 trackers max) - Prevents ENOBUFS error when spawnSync encounters large output - Show total count with indication when trackers are truncated - All 264 tests passing This fixes the test failure where the list command would exceed spawnSync buffer limits when thousands of old tracker files exist.
The showVersion() function was using import.meta.dirname which doesn't work correctly with tsx during test execution. Switched to import.meta.url with fileURLToPath() and dirname() for more reliable path resolution across different execution contexts. Fixes failing test 'parses version command' in test/cli.test.ts:219
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.
v0.3.0 Release
Major Features
ProgressStreamandProgressTransformProgressStreamfor async iterables with automatic progress trackingProgressTransformfor Node.js streams with real-time progress updatesattachProgresshelper for existing readable streamsprog <id> <action>Breaking Changes
prog <action> --id <id>toprog <id> <action>prog init --total 100 --id myprojectprog myproject init 100Test Coverage
Commits
df55904- fix: prevent buffer overflow in list commandfe3fb6a- docs: update CHANGELOG.md for v0.3.0 release6c31a21- docs: update README.md for v0.3.0 release1d58b59- chore: bump version to 0.3.0Quality Checks ✅
Ready for merge and v0.3.0 tag.
After merge: