summaryrefslogtreecommitdiff
path: root/cmd
AgeCommit message (Collapse)Author
2026-03-26fix modulePaul Buetow
2026-03-26refactor: move integration tests to ./integrationtests folderPaul Buetow
Integration tests that use the gt tool directly via exec.Command have been moved from cmd/gt/cli_test.go to integrationtests/cli_test.go. Unit tests in cmd/gt/main_test.go remain in place as they test internal functions (runCommand) rather than the binary. Package declaration changed from 'main' to 'integrationtests'.
2026-03-26fix: address code quality issues from golangci-lintPaul Buetow
- Fix error handling in test files by explicitly ignoring error returns - Remove trailing punctuation from error message in rpn_parse.go Test file changes: - cli_test.go: Use _ = os.Remove() in Cleanup function - concurrent_test.go: Use _, _ = runRPN() in concurrent goroutines Code change: - rpn_parse.go: Changed error message to end with 'colon' instead of ':'
2026-03-26feat: Support piping expressions via stdinPaul Buetow
2026-03-26feat: Add integration tests for variable assignments and fix RPN parser bugsPaul Buetow
2026-03-25rpn: Fix := and =: operators semanticsPaul Buetow
2026-03-25code-quality: Various improvements to code quality and thread safetyPaul Buetow
2026-03-25Rename calculator package to percPaul Buetow
Renamed internal/calculator directory to internal/perc, updated package name from 'calculator' to 'perc', and updated all import references.
2026-03-25chore: Clean up backup filePaul Buetow
2026-03-25refactor: Split internal/rpn/rpn.go into separate files for better SRPPaul Buetow
Created new files for better separation of concerns: - internal/rpn/mode.go: CalculationMode enum - internal/rpn/rpn_state.go: RPN struct and state management - internal/rpn/rpn_ops.go: Operator execution and evaluation - internal/rpn/rpn_parse.go: Parsing and assignment handling Original rpn.go now contains only the RPN struct and constructor. Benefits: - Better Single Responsibility Principle (SRP) - Improved code organization and readability - Easier to maintain and test individual components
2026-03-25docs: Add SPDX license headers to remaining .go filesPaul Buetow
- Added SPDX header to cmd/gt/cli_test.go - Added SPDX header to internal/rpn/boolean_test.go All 27 .go source files now have SPDX license headers with MIT license and copyright notice for Paul Buetow (c) 2026.
2026-03-25test: Add end-to-end CLI tests for gt version, percentage calculation, and RPNPaul Buetow
- Created cmd/gt/cli_test.go with end-to-end CLI tests - Tests: - TestCLIVersionOnly: Tests 'gt version' command - TestCLIPercentageCalculation: Tests percentage calculations - TestCLIRPNCalculation: Tests RPN calculations - TestCLIExitCode: Tests proper exit codes - TestCLIInvalidPercentage: Tests invalid percentage input - TestCLIInvalidRPN: Tests invalid RPN expressions All tests pass and build correctly.
2026-03-25docs: Add SPDX license headers to all .go source filesPaul Buetow
- Added 'SPDX-License-Identifier: MIT' and 'Copyright (c) 2026 Paul Buetow' headers - Files updated: 24 .go files across cmd/gt/, internal/calculator/, internal/repl/, internal/rpn/ The MIT license from LICENSE file is reflected in all source files.
2026-03-25cmd/gt: add comprehensive package documentationPaul Buetow
- Enhanced Package gt documentation with detailed usage examples for percentage calculations and RPN expressions - Added architecture overview section - Enhanced Package internal documentation with version format, build instructions, and usage examples - All tests pass and application builds correctly
2026-03-24feat: Add RPN mode, rational number support, and improve REPLPaul Buetow
- Add RPN (Reverse Polish Notation) calculator with stack-based operations - Support precise rational number calculations using *big.Rat - Implement chain of responsibility pattern for command handling - Add auto-completion for built-in commands - Add history persistence with configurable max entries - Support standard operators: +, -, *, /, ^, %, lg, log, ln - Support hyper operators: [+], [-], [*], [/], [^], [%], [lg], [log], [ln] - Support stack manipulation: dup, swap, pop, show - Support variable assignments and management - Add rat mode for switching between float64 and rational calculations - Refactor calculator to return Calculation struct with formatting - Add proper version support (v0.3.0) All changes follow Go best practices with comprehensive test coverage.
2026-03-23Update to gt binary name and refactor code quality improvementsPaul Buetow
- Renamed binary from perc to gt throughout the project - Refactored calculator.Parse to use registration pattern for parsing strategies - Refactored rpn.handleOperator to use operator registry instead of switch statements - Added panic recovery to REPL executor for better resilience - Improved code organization with OperatorRegistry and strategy registration All changes maintain full test compatibility and pass race detection tests.
2026-03-23Code quality audit fixes from comprehensive auditPaul Buetow
- Error wrapping improvements across multiple files - Thread-safe singleton initialization using sync.Once - Proper error handling for file close operations - Removed speculative complexity in history management - Fixed operator interface design Audit report: COMPLETE_AUDIT_REPORT.md
2026-03-23Fix error handling in cmd/perc/main.goPaul Buetow
2026-03-20refactor: update Operations to use VariableStore interfacePaul Buetow
- Changed Operations.vars from *Variables to VariableStore interface - Changed NewOperations to accept VariableStore interface - Changed RPN.vars from *Variables to VariableStore interface - Changed NewRPN to accept VariableStore interface - Removed type assertions in main.go and repl.go - Added FormatVariables to VariableStore interface - All tests pass, build successful
2026-03-20cmd/perc/main.go: try RPN parsing before percentage calculation in command modePaul Buetow
- Bare expressions like '1 2 +' now work without 'calc' prefix - Assignment format 'name value =' requires 'calc' subcommand prefix
2026-03-20cmd/perc: add unit tests with 86% coveragePaul Buetow
- 21 test functions covering version, calc, rpn subcommands - Tests for assignment, percentage calculations, error handling, repl mode - Coverage: runCommand 91.7%, runRPN 100%, printUsage 100%
2026-03-20cmd/perc: add unit tests with 76% coveragePaul Buetow
- Test version, calc, rpn subcommands - Test percentage calculations - Test error handling (missing expressions, division by zero, unknown tokens) - Test assignment with variables - Test printUsage function - Achieve 76% coverage of cmd/perc package
2026-03-20internal/rpn/cmd/perc: add calc/rpn subcommands and fix assignment handlingPaul Buetow
- Add calc and rpn subcommands to main.go - Support RPN expression evaluation via perc calc/rpn <expr> - Support variable assignment format: 'name value = expr...' - Fix assignment parsing to handle 'name value = expression' format - All tests pass, go vet passes
2026-03-16bump version to v0.2.0v0.2.0Paul Buetow
- Add REPL mode with vi keybindings - Add built-in commands (help, clear, quit/exit) - Add mage repl target Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2025-11-25Initial commit: perc v0.0.0 - percentage calculatorv0.0.0Paul Buetow
Amp-Thread-ID: https://ampcode.com/threads/T-e4f4a959-8cc6-4ac0-b6fb-2779867e8b2a Co-authored-by: Amp <amp@ampcode.com>