tui-td 0.2.9 → 0.2.10

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: e0062b5242a5e1ec97546b733761ce7a7fe559ee85d2e413cdce25798fa0861d
4
- data.tar.gz: 2fbf22c11937739e51bc303d4ddbaedd6edb1015ef829046dc9d42bc5a1f2bf8
3
+ metadata.gz: 3eb2dc4db4af2ddbcbe377f8a3d6bddf8e1a45f3c78c85a25d8480d1e740e9f7
4
+ data.tar.gz: 31a65006ceb299ba4487446932bf74305ecb92d4241288f82d7d11a0283e6bf6
5
5
  SHA512:
6
- metadata.gz: 306311eefc1fc30811cd630ac23f35f02ce7d14250c9bdd1cc63a7508a199193af475947fed85bc24198b3060903ce38b392f056ddba326fc22741b3ba28568c
7
- data.tar.gz: 90bcfdd7d9f9f9357758deb5f7ebb8b3a7f20ca919f398909ecd03801106998fcf190c5341141324ec427618e9a32ad40cfbc117ae7bb474b5421e1677b4980e
6
+ metadata.gz: 706d849d8c35380fabf149bcf6cee5441d92a71b228d7ac4bc0bbba3852be4443496d9d6ae79afd15daa5217b9ede798d6ce2d15dee2cbeb5f6a0901b5269722
7
+ data.tar.gz: 9595ce52cd78959dfb49f314d3272d6cf2c065dd215467e204c862b48da2a88525ab8a9dad0ab98ccdd7b7fc142e700eab4ca65ea6a8c2b90d53aefbe8eca922
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.2.10
4
+
5
+ - Three new MCP tools: `tui_wait_for_exit` (wait for process to end), `tui_exit_status` (get exit code), `tui_find_text` (search terminal state for text/regex matches)
6
+ - Document `tui_html_render` MCP tool in README (was already implemented but missing from docs)
7
+ - Smoke test expanded to 63 assertions covering all 13 MCP tools including new ones
8
+
3
9
  ## 0.2.9
4
10
 
5
11
  - Fix: `wait_for_stable` uses parsed terminal grid comparison instead of raw byte arrival, preventing interactive TUIs that repaint cell-by-cell (e.g., glow) from timing out
data/README.md CHANGED
@@ -369,6 +369,10 @@ tui-td serve
369
369
  | `tui_state` | Get terminal state: AI-friendly compact mode (default), `full` grid, or `text` only. |
370
370
  | `tui_plain_text` | Get plain text content, ANSI stripped. |
371
371
  | `tui_screenshot` | Capture a PNG screenshot of the current terminal. |
372
+ | `tui_html_render` | Render terminal state as a self-contained HTML document. Returns HTML inline or saves to file. |
373
+ | `tui_wait_for_exit` | Wait until the TUI process exits. Returns exit status. |
374
+ | `tui_exit_status` | Get the exit status code (nil if still running). |
375
+ | `tui_find_text` | Search for text or regex in terminal state. Returns positions of all matches. |
372
376
  | `tui_close` | Close the TUI and clean up. |
373
377
 
374
378
  ### MCP configuration
@@ -407,7 +411,18 @@ Add to your MCP client configuration:
407
411
  // 6. Take screenshot if needed
408
412
  {"method": "tools/call", "params": {"name": "tui_screenshot", "arguments": {"path": "/tmp/proof.png"}}}
409
413
 
410
- // 7. Clean up
414
+ // 7. Render as HTML (save to file or get inline)
415
+ {"method": "tools/call", "params": {"name": "tui_html_render", "arguments": {"path": "/tmp/proof.html"}}}
416
+ // Or without path to get HTML inline:
417
+ // {"method": "tools/call", "params": {"name": "tui_html_render", "arguments": {}}}
418
+
419
+ // 8. Search for text in the terminal
420
+ {"method": "tools/call", "params": {"name": "tui_find_text", "arguments": {"pattern": "error|fail"}}}
421
+
422
+ // 9. Check exit status (or wait for exit)
423
+ {"method": "tools/call", "params": {"name": "tui_exit_status", "arguments": {}}}
424
+
425
+ // 10. Clean up
411
426
  {"method": "tools/call", "params": {"name": "tui_close", "arguments": {}}}
412
427
  ```
413
428
 
@@ -250,6 +250,36 @@ module TUITD
250
250
  }
251
251
  }
252
252
  },
253
+ {
254
+ name: "tui_wait_for_exit",
255
+ description: "Wait until the TUI process exits. Returns the exit status code (0 = success, non-zero = error).",
256
+ inputSchema: {
257
+ type: "object",
258
+ properties: {}
259
+ }
260
+ },
261
+ {
262
+ name: "tui_exit_status",
263
+ description: "Get the exit status of the TUI process. Returns nil if still running, otherwise the exit code.",
264
+ inputSchema: {
265
+ type: "object",
266
+ properties: {}
267
+ }
268
+ },
269
+ {
270
+ name: "tui_find_text",
271
+ description: "Search for text or regex pattern in the current terminal state. Returns positions of all matches with surrounding context.",
272
+ inputSchema: {
273
+ type: "object",
274
+ properties: {
275
+ pattern: {
276
+ type: "string",
277
+ description: "Text or regex pattern to search for (e.g., 'error', 'ERROR|FAIL')"
278
+ }
279
+ },
280
+ required: ["pattern"]
281
+ }
282
+ },
253
283
  {
254
284
  name: "tui_close",
255
285
  description: "Close the TUI application and clean up the PTY session. Call this when finished.",
@@ -278,6 +308,9 @@ module TUITD
278
308
  when "tui_plain_text" then call_tui_plain_text
279
309
  when "tui_screenshot" then call_tui_screenshot(args)
280
310
  when "tui_html_render" then call_tui_html_render(args)
311
+ when "tui_wait_for_exit" then call_tui_wait_for_exit
312
+ when "tui_exit_status" then call_tui_exit_status
313
+ when "tui_find_text" then call_tui_find_text(args)
281
314
  when "tui_close" then call_tui_close
282
315
  else
283
316
  return error_response(id, -32602, "Unknown tool: #{tool_name}")
@@ -416,6 +449,40 @@ module TUITD
416
449
  end
417
450
  end
418
451
 
452
+ def call_tui_wait_for_exit
453
+ ensure_driver!
454
+ @driver.wait_for_exit
455
+ status = @driver.exitstatus
456
+ "OK: Process exited with status #{status}"
457
+ end
458
+
459
+ def call_tui_exit_status
460
+ ensure_driver!
461
+ status = @driver.exitstatus
462
+ if status.nil?
463
+ "Process is still running"
464
+ else
465
+ "Exit status: #{status}"
466
+ end
467
+ end
468
+
469
+ def call_tui_find_text(args)
470
+ ensure_driver!
471
+ pattern = args["pattern"] or return "ERROR: 'pattern' argument is required"
472
+ state = TUITD::State.new(@driver.state_data)
473
+ matches = state.find_text(pattern)
474
+
475
+ if matches.empty?
476
+ "No matches found for: #{pattern}"
477
+ else
478
+ lines = ["Found #{matches.size} match(es) for: #{pattern}"]
479
+ matches.each do |m|
480
+ lines << " row #{m[:row]}, col #{m[:col]}: #{m[:full_line].strip}"
481
+ end
482
+ lines.join("\n")
483
+ end
484
+ end
485
+
419
486
  def call_tui_close
420
487
  @driver&.close
421
488
  @driver = nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TUITD
4
- VERSION = "0.2.9"
4
+ VERSION = "0.2.10"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tui-td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Haluk Durmus