girb 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2d2144162ffe9fabd66b1a4eebab7854ad593e210d3dda57714dec1ba3e4ae6
4
- data.tar.gz: 81ef617d448595e2d83367ae3799680b178b7e6d2967997806715990b441972e
3
+ metadata.gz: cdae8b7956a4924603ee3edfcebdf3835ed6d994037847eed0d432d078dec400
4
+ data.tar.gz: 270cf95c4e39728de8cfb5ca5153139951c94b4f94d9255d250d6a47e527813e
5
5
  SHA512:
6
- metadata.gz: e8e3cb78423ffe5b22af0c3bcbf94d8e12af8f2b537be73a3b53c1d68e0e30886ea06ff4ceaa49985049d5056a6858120a3e897163e7e5bd0e0ccdf3f0c1628f
7
- data.tar.gz: 6cf65282ab7d1aa93097ce6e6cf7f9f9f55d113d8a34d35b44859caf48757f9dc241835de1e0f15de4933e5b17ef2d1061986cce6fed1ada15291ec3e7f70cfb
6
+ metadata.gz: ea1a35c4aaf70ce1a4a8a28ad9a1b12fc33ef8b15e01e257ac9a94b2cbbef60d290e0d6aff426bc95b88da9257c1f0b6d76549be350bfe92bb81bd3398e349c8
7
+ data.tar.gz: 4c0738e997b5796c26d331c38ec60b782186c41803f1858ec1553d7a577d226ec38d3a794f1bfef008b8aa1a5c452494428d4bf55ad38b08c123fcf144e9b723
data/CHANGELOG.md CHANGED
@@ -1,11 +1,16 @@
1
1
  # Changelog
2
2
 
3
- ## [0.3.1] - 2026-02-07
3
+ ## [0.3.2] - 2026-02-08
4
4
 
5
5
  ### Added
6
6
 
7
+ - Show real-time progress feedback during tool execution (AI now explains each step as it works)
7
8
  - Generic `metadata` field for tool calls to support provider-specific data pass-through (e.g. Gemini 3 `thought_signature`)
8
9
 
10
+ ### Changed
11
+
12
+ - Improved breakpoint tracking pattern: self-initializing `$tracked ||= []` in conditions to prevent nil errors
13
+
9
14
  ### Fixed
10
15
 
11
16
  - Fix process crash when pressing Ctrl+C during AI API call in debug mode
@@ -181,9 +181,9 @@ module Girb
181
181
  end
182
182
 
183
183
  if response.function_call?
184
- # Accumulate text that comes with function calls
184
+ # Print progress text immediately (don't accumulate for re-display at the end)
185
185
  if response.text && !response.text.empty?
186
- accumulated_text << response.text
186
+ puts response.text
187
187
  end
188
188
 
189
189
  debug_command_called = false
@@ -24,6 +24,9 @@ module Girb
24
24
  - Keep responses concise and practical
25
25
  - Read patterns and intentions; handle hypothetical questions
26
26
  - Code examples should use variables and objects from the current context and be directly executable
27
+ - When calling tools, ALWAYS include a brief one-line comment explaining what you're about to do
28
+ (e.g., "ソースファイルを確認します", "ループを実行してxの値を追跡します")
29
+ This gives users real-time visibility into your investigation process.
27
30
 
28
31
  ## Debugging Support on Errors
29
32
  When users encounter errors, actively support debugging.
@@ -59,11 +62,6 @@ module Girb
59
62
  - When asked to track variables, run the actual code and report real results
60
63
  - NEVER invent or substitute code - always use what's in the file
61
64
 
62
- ### Example: User says "run this loop and track x"
63
- 1. Read the source file to see the actual loop code
64
- 2. Execute that exact code using evaluate_code
65
- 3. Report the actual results
66
-
67
65
  ### WRONG approach:
68
66
  - Guessing what the code might do
69
67
  - Writing your own version of the code
@@ -76,11 +74,72 @@ module Girb
76
74
  - `continue` / `c`: Continue execution
77
75
  - `finish`: Run until current method returns
78
76
  - `break <file>:<line>`: Set a breakpoint
77
+ - `break <file>:<line> if: <condition>`: Conditional breakpoint (use `if:` with colon)
79
78
  - `backtrace` / `bt`: Show call stack
80
79
  - `info`: Show local variables
81
80
 
82
- When the user asks for step-by-step execution, use `run_debug_command` with `auto_continue: true`
83
- to step through the code and be re-invoked to see the results.
81
+ ### CRITICAL: Autonomous Debugging Act, Don't Ask
82
+ When the user asks to track variables, find conditions, or debug behavior, you MUST:
83
+ 1. Read the source file with `read_file` to understand the code
84
+ 2. Set up tracking and breakpoints using tools
85
+ 3. Execute — don't ask the user for file names, line numbers, or code
86
+
87
+ ### Variable Persistence Across Frames
88
+ Local variables created via `evaluate_code` do NOT persist after `step`, `next`, or `continue`.
89
+ To track values across frames, use global variables: `$tracked = []`
90
+
91
+ ### Breakpoint Line Placement Rules
92
+ - NEVER place a breakpoint on a block header line (`do |...|`, `.each`, `.map`, etc.) — it only hits once
93
+ - ALWAYS place breakpoints on a line INSIDE the block body
94
+ - Example:
95
+ ```
96
+ 10: data.each_with_index do |val, i| # BAD: hits only once
97
+ 11: x = (x * val + i * 3) % 100 # GOOD: hits every iteration
98
+ 12: end
99
+ ```
100
+
101
+ ### Efficient Variable Tracking Patterns
102
+ **Pattern A: evaluate_code loop (PREFERRED — safe and reliable)**
103
+ Read the source file, reconstruct the loop, and execute it directly.
104
+ This always returns results even if the condition is never met.
105
+ ```ruby
106
+ evaluate_code <<~RUBY
107
+ $tracked = [x]
108
+ catch(:girb_stop) do
109
+ data.each_with_index do |val, i|
110
+ x = (x * val + i * 3) % 100
111
+ $tracked << x
112
+ throw(:girb_stop) if x == 1
113
+ end
114
+ end
115
+ { tracked_values: $tracked, final_x: x, stopped: (x == 1) }
116
+ RUBY
117
+ ```
118
+ IMPORTANT: Always report whether the condition was met or not.
119
+
120
+ **Pattern B: Conditional breakpoint with tracking**
121
+ Use ONLY when you need to interact with the actual stopped program state
122
+ (e.g., inspect complex objects, check call stack at the breakpoint).
123
+ WARNING: If the condition is never met, the program runs to completion and ALL tracked data is lost.
124
+ 1. `run_debug_command("break file.rb:11 if: ($tracked ||= []; $tracked << x; x == 1)")` — self-initializing tracking, stop on condition
125
+ 2. `run_debug_command("c", auto_continue: true)` — continue and be re-invoked when it stops
126
+ 3. When re-invoked: `evaluate_code("$tracked")` — retrieve and report results
127
+
128
+ Steps 1 and 2 MUST happen in the same turn.
129
+
130
+ ### Interactive Debugging with auto_continue
131
+ Use `run_debug_command` with `auto_continue: true` when you need to execute a command
132
+ AND see the result before deciding your next action. After the command executes, you will be
133
+ automatically re-invoked with the updated context.
134
+
135
+ Use `auto_continue: true` when:
136
+ - Stepping through code to find where a variable changes
137
+ - Continuing to a breakpoint and then analyzing the state
138
+ - Any scenario where you need to see the result of a navigation command
139
+
140
+ ### Response Guidelines
141
+ - When a task is complete, ALWAYS report the results — don't just execute and stop
142
+ - NEVER repeat the same failed action. Analyze the error and try a different approach
84
143
  PROMPT
85
144
 
86
145
  # Prompt specific to interactive IRB mode (girb command)
data/lib/girb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Girb
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: girb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rira100000000