summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2026-05-25bump version to v0.5.1v0.5.1mainPaul Buetow
2026-05-25style(repl): use map[string]struct{} for sets instead of map[string]boolPaul Buetow
Idiomatic Go uses struct{} for zero-allocation sets. Two locations: - GetCompletionTopics: seen deduplication map - init(): seenCat category deduplication map
2026-05-25refactor(repl): register 'categories' as HelpTopic with custom RenderPaul Buetow
Add a Render func() string field to HelpTopic that overrides the default formatTopic rendering. Use it to register 'categories' as a normal HelpTopic entry instead of a hardcoded if-branch in GetHelp. - Remove hardcoded if topic == "categories" from GetHelp - Remove hardcoded 'categories' from GetCompletionTopics - Remove dead getCategoriesHelp function from help.go - 'categories' now discovered through normal helpByTopic lookup
2026-05-25refactor(repl): split help.go into data (help_topics.go) and logic (help.go)Paul Buetow
The original help.go was 657 lines mixing data, indexing, and lookup logic. Split into: - help_topics.go (489 lines): HelpTopic struct, helpTopics data slice, index variables, and init() that builds the lookup maps. - help.go (171 lines): GetHelp, GetAllTopics, GetCompletionTopics, getGeneralHelp, getCategoriesHelp, and formatTopic. All tests pass. No behavioral changes.
2026-05-25fix(fish): prevent file completions and glob expansion in gt.fishPaul Buetow
- Add -f (--no-files) flag to all complete entries to block file/path completions for the gt command - Escape ** and * arguments to prevent fish from glob-expanding them into recursive file matches - Add Shell Completions section and completions row to README.md
2026-05-25fix(completion): suppress file/path completions with -f -a emptyPaul Buetow
2026-05-25fix(completion): suppress fish file/path completions with -k flagPaul Buetow
2026-05-25fix: return readline suffixes instead of full matchesPaul Buetow
Per the readline AutoCompleter docs, Do() should return suffixes (the characters AFTER the common prefix), not full matches. The length parameter indicates how many characters are shared. This fixes the bug where readline appended the full match to the typed input (e.g. 'he' + 'help' = 'hehelp') because commonLen was 0 and readline had no idea what to replace. Now 'he<TAB>' returns suffix 'lp' with commonLen=2, so readline correctly replaces 'he' with 'help'.
2026-05-25Revert "style(completion): remove -d descriptions to save screen space"Paul Buetow
This reverts commit 45b1157a2a7234fe865df1e8ff836f58ca6ff448.
2026-05-25style(completion): remove -d descriptions to save screen spacePaul Buetow
2026-05-25fix(completion): remove >, <, >=, <= operators that fish cannot completePaul Buetow
2026-05-25fix(completion): use __fish_use_subcommand instead of non-standard ↵Paul Buetow
__fish_seen_command_argument
2026-05-25fix: don't offer exact-match completions to prevent readline duplicationPaul Buetow
When the typed word already exactly matches a command (e.g. 'help'), return no completions. Readline would append the match, producing 'helphelp'. Partial matches still work normally (e.g. 'he' → 'help').
2026-05-25fix: help <TAB> offers operator topics, not 'help help'Paul Buetow
When user types 'help ' (with trailing space), the completer now offers help topic completions (+, dup, swap, etc.). Just 'help' without a space still completes the command normally. Also skip 'help' itself from GetCompletionTopics to avoid suggesting 'help help'.
2026-05-25fix: exclude 'help' from help topic completionsPaul Buetow
'help <TAB>' was suggesting 'help help'. Skip 'help' itself in GetCompletionTopics so tab completion offers actual topics.
2026-05-25feat: inline help system with per-operator topics and auto-completionPaul Buetow
Replace the old static help text with a data-driven help system that provides one help entry per operator, function, or REPL command, each with category, description, usage, and examples. - help.go: 35+ help topics covering all operators (arithmetic, comparison, stack, hyper, variables, constants, REPL commands) - GetHelp(topic) returns formatted help; GetHelp("") returns overview - help categories lists all topics grouped by category - Aliases supported (e.g. help gt shows help for > operator) - Auto-completion for help topics when typing 'help <TAB>' - REPL entries take priority in helpByTopic (e.g. 'help clear' shows screen clear, not RPN variable clear) - Comprehensive tests for all public functions
2026-05-24bump version to v0.5.0v0.5.0Paul Buetow
2026-05-24docs: de-LLM all .md files - remove corporate language, over-explanation, ↵Paul Buetow
and LLM patterns
2026-05-24fix(rpn): change variadic NewRPN/NewOperations to single optional ↵Paul Buetow
MetricReader (task ok)
2026-05-24fix(rpn): define OperatorRegistryProvider interface to fix DIP violation ↵Paul Buetow
(task nk)
2026-05-24fix(rpn): delegate Modulo to binaryMetricOp (task gk)Paul Buetow
2026-05-24fix(rpn): embed existing interfaces in VariableOpProvider and ↵Paul Buetow
CommandOpProvider (task fk)
2026-05-24fix(rpn): complete DIP for MetricRegistry — use MetricReader/MetricWriter ↵Paul Buetow
interfaces (task ek)
2026-05-24docs: update README.mdPaul Buetow
2026-05-24fix(rpn): extract setVariableResult helper for assignment paths (task bk)Paul Buetow
2026-05-24fix(rpn): use correct subcommand name in metric error messages (task ak)Paul Buetow
2026-05-24fix(rpn): remove unused IsBool/IsString/IsSymbol from StackValue (task 8k)Paul Buetow
2026-05-24fix(rpn): introduce MetricReader interface for testability (task 7k)Paul Buetow
2026-05-24fix(rpn): consolidate extractVarName into rpn_parse.go (task 6k)Paul Buetow
2026-05-24fix(rpn): replace assignmentHandler strategy pattern with if/else chain ↵Paul Buetow
(task 5k)
2026-05-24fix(repl): add looksLikeRPN guard to prevent swallowing non-RPN input (task 4k)Paul Buetow
2026-05-24fix(rpn): narrow OperatorProvider with focused registration interfaces (task 3k)Paul Buetow
2026-05-24fix(rpn): restrict isValidIdentifier to letters and underscore only (task 2k)Paul Buetow
2026-05-24fix(rpn): remove dead number-parse check from handleOperator (task 1k)Paul Buetow
2026-05-24fix(rpn): remove SetConstants from OperationsProvider (ISP violation, task 0k)Paul Buetow
2026-05-24fix(rpn): replace parseCategory iota loop with O(1) map lookup (task zj)Paul Buetow
2026-05-24fix(rpn): widen RPN.consts to ConstantsProvider, remove unsafe type ↵Paul Buetow
assertion (task yj)
2026-05-24repl: remove redundant ToLower on single-token operator lookup (gj)Paul Buetow
All operator registry keys are lowercase, so strings.ToLower(token) was a no-op. Removing the unnecessary lowercasing and the unused op variable, passing the original token directly to IsStandardOperator/IsHyperOperator/EvalOperator.
2026-05-24fix(rpn): extract var-name type switch into helper (tj)Paul Buetow
Extract the duplicated type switch on StackValue in AssignLeft() and AssignRight() into a single extractVarName() helper, closing the OCP violation — adding a new StackValue subtype as a valid variable name now only requires editing one function.
2026-05-24refactor(rpn): delegate Divide() to binaryMetricOp via preCheck (oj)Paul Buetow
Add variadic preChecks parameter to binaryMetricOp, allowing callers to run a validation on the right operand before metric resolution. This eliminates the full pipeline duplication in Divide() — it now delegates to binaryMetricOp with a preCheck that guards against division by zero.
2026-05-24Add compile-time interface satisfaction checks (xj)Paul Buetow
Add var _ Interface assertions to verify implementations at compile time: - internal/rpn/variables.go: assert *Variables against VariableReader, VariableWriter, VariablePersistence, and VariableStore - internal/repl/handlers.go: assert *BuiltInCommandHandler, *RPNHandler, *PercentageHandler, and *ErrorHandler against CommandHandler (BaseHandler intentionally excluded as it lacks a Handle method and is only meant for embedding) - internal/repl/completer.go: assert *AutoCompleteAdapter against readline.AutoCompleter (adds readline import) Note: internal/rpn/constants.go already had assertions in place.
2026-05-24refactor: split runCommand() into focused helpers (mj)Paul Buetow
Extract runCommand() in cmd/gt/main.go into separate helpers following SRP: - parseFlags(): extract --log flag parsing - dispatchInput(): route by arg count/content (version, stdin, args) - handleNoInput(): TTY→REPL or stdin→parse path - startREPL(): REPL launch with optional log file - tryParse(): RPN-first with percentage fallback runCommand() is now a 3-line orchestrator delegating to parseFlags() and dispatchInput(). No behavioral change; all tests pass.
2026-05-24refactor(repl): extract RPN prefixes to data-driven slice (task uj)Paul Buetow
Replace the hardcoded strings.HasPrefix check for "rpn " and "calc " with a loop over a package-level rpnPrefixes slice. Adding a new prefix now only requires appending to the slice, satisfying the Open/Closed Principle.
2026-05-24fix(rpn): extract builtInConstants map, eliminate loadBuiltInConstants dual ↵Paul Buetow
responsibility (sj) Move built-in constants into a package-level builtInConstants map so loadBuiltInConstants() only copies from it (no return value). Reload and Clear now simply clear and copy from the source map, removing the maps.DeleteFunc dance and the unused maps import.
2026-05-24fix: replace Category.String() switch with data-driven slice (qj)Paul Buetow
OCP violation: adding a new Category required editing the String() method. Use a parallel categoryNames slice indexed by Category value instead, so adding a new category only requires appending to the slice. _sentinel already bounds the range.
2026-05-24refactor(rpn): extract 'd' operator into Delete method (pj)Paul Buetow
Move the inline logic for the 'd' (delete variable) operator into a proper Operations.Delete method, following the same registration pattern as all other operators. Adds Delete to the StackOperator interface.
2026-05-24fix(rpn): DIP violation — NewOperatorRegistry accepts OperatorProvider ↵Paul Buetow
interface (nj) Accept the OperatorProvider interface instead of concrete *Operations in NewOperatorRegistry() and all register* methods. OperatorProvider embeds ArithmeticOperator, PowerIntOperator, LogarithmicOperator, BooleanOperator, StackOperator, VariableOperator, ConstantOperator, MetricOperator, and HyperOperator, allowing mocking or alternative implementations.
2026-05-24refactor(rpn): split ConstantsProvider into Reader/Writer/Admin ↵Paul Buetow
sub-interfaces (#wj) Follows the same ISP-compliant pattern as VariableStore (VariableReader, VariableWriter, VariablePersistence). The fat 7-method ConstantsProvider is now split into: - ConstantsReader: GetConstant, ListConstants, Count, HasConstant - ConstantsWriter: SetConstant - ConstantsAdmin: ClearConstants, ReloadBuiltInConstants - ConstantsProvider: embeds all three for convenience RPN.consts narrowed to ConstantsReader since RPN only reads constants; GetConstants() asserts to ConstantsProvider for callers that need full access. Added compile-time satisfaction checks for all sub-interfaces.
2026-05-24fix(rpn): restore stack values in popAll on partial failure (lj)Paul Buetow
If stack.Pop() errors midway through the loop, already-popped values are pushed back in reverse order before returning the error, preventing stack corruption from concurrent modification or unexpected failures.
2026-05-24fix(rpn): extract metric inference rules into data-driven maps (task kj)Paul Buetow
Replace hardcoded switch statements in resultMetricForMul and resultMetricForDiv with package-level maps (multiplicationInference, divisionInference). Adding new category pairs now only requires appending to the maps instead of editing control flow, satisfying OCP.