inquirex-tty 0.4.0 → 0.5.0

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: a6f66f76d0bdbb832d621d44dd67b254f8446ec6d25adb347d56acbfdc28e42e
4
- data.tar.gz: b67f9e36a3cd224bb4d984cd15b3b0b0a85b1621eea4e12cb8963ce61780ca31
3
+ metadata.gz: 5d2a11293b1ac438c2ccd3b25cf1b18782e9b49e9b3e1d4d344e84216403cca9
4
+ data.tar.gz: d4001771880c748982dbaa765a390f910d4d0e71772259981bb317af0c2696c7
5
5
  SHA512:
6
- metadata.gz: 5ec9cc3a54069162b6fddc87479182d52ca9fb2ee526592d75a628d0575521966dd71693d9b19becb9fe43ac0e6173d4eb9df8038cf51f4e3072624d9152923a
7
- data.tar.gz: 385036c78a800d1aa60ccff6a360b320dab1295dcba865a0918ca8761a89a042468a1be0f751710b2b08b6d44f07d37d10b1a260cc8442c82f1179979cdac32f
6
+ metadata.gz: '085bb14fd6cd73b341108763e61989b882ad4936f7b70ffd2a45089bd5bc930887ab7e7d85b8e2c15e682c77bdb8ba7384971a102199ae74038f2696c0af71dd'
7
+ data.tar.gz: c6c92ee9cd25e7b23b1a0d6a839f7df0f92bc6a6a36c385a33ee2be4bd01004261c476bb4cf2a5689a2eca10afca1cfd23334546c4c12da7c4e89e42602ebc8f
data/README.md CHANGED
@@ -6,12 +6,6 @@ Terminal adapter for the [Inquirex](https://github.com/inquirex/inquirex) questi
6
6
 
7
7
  Ships as a CLI (`inquirex`) with commands to run flows interactively, validate definitions, and export Mermaid diagrams.
8
8
 
9
- ## Status
10
-
11
- - Version: `0.2.1`
12
- - Ruby: `>= 4.0.0`
13
- - Depends on: `inquirex`, `tty-prompt`, `tty-box`, `tty-font`, `pastel`, `dry-cli`
14
-
15
9
  ## Installation
16
10
 
17
11
  ```ruby
@@ -12,8 +12,7 @@
12
12
  # 2. :extracted — clarify step; LLM returns structured fields
13
13
  # 3. :filing_status, :dependents, :income_types, :state_filing, :client_contact
14
14
  # — asked only when the LLM left the field blank
15
- # 4. :summary LLM produces a complexity / fee summary over everything
16
- # 5. :done — farewell
15
+ # 4. :done farewell
17
16
  #
18
17
  # Run:
19
18
  # bundle exec exe/inquirex-tty run examples/09_tax_preparer_llm.rb
@@ -38,10 +37,10 @@ Inquirex.define id: "tax-preparer-llm-2025", version: "1.0.0" do
38
37
  "(W-2, business, rental, investments, crypto), and your state.\n" \
39
38
  "Do NOT include SSN or home address."
40
39
  widget target: :tty, type: :multiline
41
- transition to: :extracted
40
+ transition to: :summary
42
41
  end
43
42
 
44
- clarify :extracted do
43
+ extract :summary do
45
44
  from :describe
46
45
  prompt <<~PROMPT
47
46
  You are a tax-prep intake assistant. Extract structured information from
@@ -75,7 +74,8 @@ Inquirex.define id: "tax-preparer-llm-2025", version: "1.0.0" do
75
74
  IMPORTANT: Only include a value when the client's text gives you concrete
76
75
  evidence. Do NOT infer or guess. Use null / "" / [] liberally.
77
76
  PROMPT
78
- schema filing_status: :string,
77
+ schema \
78
+ filing_status: :string,
79
79
  dependents: :integer,
80
80
  income_types: :multi_enum,
81
81
  state_filing: :string
@@ -129,19 +129,6 @@ Inquirex.define id: "tax-preparer-llm-2025", version: "1.0.0" do
129
129
  type :string
130
130
  question "Your name and email (so we can send the quote)?"
131
131
  widget target: :tty, type: :text_input
132
- transition to: :summary
133
- end
134
-
135
- summarize :summary do
136
- from_all
137
- prompt <<~PROMPT
138
- Based on the collected answers, produce a concise JSON object with:
139
- - complexity: "simple" | "moderate" | "complex"
140
- - fee_estimate_low: integer USD
141
- - fee_estimate_high: integer USD
142
- - red_flags: array of short strings (empty array if none)
143
- - notes: one-sentence summary for the preparer
144
- PROMPT
145
132
  transition to: :done
146
133
  end
147
134
 
@@ -0,0 +1,53 @@
1
+ require 'inquirex-llm'
2
+
3
+ Inquirex.define id: "llm-test", version: "1.0.0" do
4
+ meta title: "Test of Extract Keyword",
5
+ subtitle: "This form extracts structured data from an unstructured text description."
6
+
7
+ start :describe
8
+
9
+ ask :describe do
10
+ type :text
11
+ question "Describe your 2025 tax situation."
12
+ transition to: :summary
13
+ end
14
+
15
+ extract :summary do
16
+ from :describe
17
+ prompt "Extract: filing_status, dependents, income_types, state_filing."
18
+ schema filing_status: :string,
19
+ dependents: :integer,
20
+ income_types: :multi_enum,
21
+ state_filing: :string
22
+ model :claude_sonnet
23
+ transition to: :filing_status
24
+ end
25
+
26
+ ask :filing_status do
27
+ type :enum
28
+ question "Filing status?"
29
+ options %w[single married_filing_jointly head_of_household]
30
+ skip_if not_empty(:filing_status) # ← the whole trick
31
+ transition to: :dependents
32
+ end
33
+
34
+ ask :dependents do
35
+ type :integer
36
+ question "How many dependents?"
37
+ skip_if not_empty(:dependents)
38
+ transition to: :income_types
39
+ end
40
+
41
+ ask :income_types do
42
+ type :multi_enum
43
+ question "Select all income types that apply to you in 2025."
44
+ options %w[W2 1099 Business Investment Rental Retirement]
45
+ widget target: :tty, type: :multi_select
46
+ skip_if not_empty(:income_types)
47
+ transition to: :thanks
48
+ end
49
+
50
+ say :thanks do
51
+ text "Thanks for filling this out! Have a great day!"
52
+ end
53
+ end
data/justfile CHANGED
@@ -1,33 +1,43 @@
1
1
  # © 2026 Konstantin Gredeskoul
2
2
 
3
- set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
3
+ set shell := ["bash", "-c"]
4
4
 
5
5
  repo := 'git@github.com:inquirex/inquirex-tty.git'
6
6
  version := `grep VERSION lib/inquirex/tty/version.rb | awk '{print $3}' | tr -d '"' | tr -d '\n'`
7
+ rbenv := 'eval "$(rbenv init bash)"; bundle exec '
8
+
9
+ [no-exit-message]
10
+ recipes:
11
+ just --choose
12
+
13
+ install:
14
+ bundle check || bundle install -j 12
15
+
16
+ build: install
7
17
 
8
18
  # Run full test suite with coverage
9
- test:
10
- bundle exec rspec --format documentation
19
+ test *args: install
20
+ {{ rbenv }} rspec {{ args }}
11
21
 
12
22
  # Run RuboCop linter
13
23
  lint:
14
- bundle exec rubocop
24
+ {{ rbenv }} rubocop
15
25
 
16
26
  # Auto-correct RuboCop offenses
17
27
  format:
18
- bundle exec rubocop -A
28
+ {{ rbenv }} rubocop -A
19
29
 
20
30
  # Run a flow interactively
21
31
  run flow_file:
22
- bundle exec exe/inquirex-tty run {{flow_file}}
32
+ {{ rbenv }} exe/inquirex-tty run {{flow_file}}
23
33
 
24
34
  # Validate a flow definition
25
35
  validate flow_file:
26
- bundle exec exe/inquirex-tty validate {{flow_file}}
36
+ {{ rbenv }} exe/inquirex-tty validate {{flow_file}}
27
37
 
28
38
  # Export a flow as a Mermaid diagram (stdout)
29
39
  graph flow_file:
30
- bundle exec exe/inquirex-tty graph {{flow_file}}
40
+ {{ rbenv }} exe/inquirex-tty graph {{flow_file}}
31
41
 
32
42
  # Validate all examples
33
43
  examples:
@@ -35,7 +45,7 @@ examples:
35
45
  set -e
36
46
  for f in examples/*.rb; do
37
47
  echo "=== $f ==="
38
- bundle exec exe/inquirex-tty validate "$f"
48
+ {{ rbenv }} exe/inquirex validate "$f"
39
49
  echo ""
40
50
  done
41
51
 
@@ -44,6 +54,15 @@ ci: test lint
44
54
 
45
55
  alias check-all := ci
46
56
 
57
+ clean:
58
+ #!/usr/bin/env bash
59
+ /usr/bin/find . -name .DS_Store -delete -print || true
60
+ rm -rf tmp/*
61
+
62
+ # Create
63
+ publish: build
64
+ {{ rbenv }} rake release[remote]
65
+
47
66
  version:
48
67
  @echo "{{ version }}"
49
68
 
@@ -54,3 +73,4 @@ release:
54
73
  git push -f --tags
55
74
  gh release delete -y "v{{ version }}" --repo {{ repo }} 2>/dev/null || true
56
75
  gh release create "v{{ version }}" --generate-notes --repo {{ repo }}
76
+
@@ -62,15 +62,16 @@ module Inquirex
62
62
  engine
63
63
  end
64
64
 
65
- # Calls the LLM adapter for a clarify/describe/summarize/detour step,
66
- # stores the result as the step's answer, and for clarify verbs splats
67
- # extracted fields into top-level answers via Engine#prefill! so that
68
- # downstream `skip_if not_empty(:key)` rules will fire.
65
+ # Calls the LLM adapter for an LLM step, stores the result as the step's
66
+ # answer, and for extract verbs splats the extracted fields into top-level
67
+ # answers via Engine#prefill! so that downstream `skip_if not_empty(:key)`
68
+ # rules will fire. `clarify` is a DSL alias for `extract`, so a node built
69
+ # by either verb reports :extract.
69
70
  def run_llm_step(engine, step, adapter, renderer)
70
71
  renderer.thinking("🧠 Thinking — asking #{adapter_label(adapter)} to extract structured data…")
71
72
  result = adapter.call(step, engine.answers)
72
73
  engine.answer(result)
73
- if step.verb == :clarify && result.is_a?(Hash)
74
+ if step.verb == :extract && result.is_a?(Hash)
74
75
  engine.prefill!(result)
75
76
  renderer.show_extraction(result)
76
77
  else
@@ -108,8 +108,8 @@ module Inquirex
108
108
  # @param node [Inquirex::Node]
109
109
  # @return [void]
110
110
  def render_header(node)
111
- font = ::TTY::Font.new(:doom)
112
- title_text = node.text.upcase
111
+ font = ::TTY::Font.new(:standard)
112
+ title_text = node.text.downcase
113
113
  title_text.split.each do |_word|
114
114
  title = font.write(node.text.upcase)
115
115
  puts pastel.yellow(title)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Inquirex
4
4
  module TTY
5
- VERSION = "0.4.0"
5
+ VERSION = "0.5.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inquirex-tty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
@@ -29,28 +29,28 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '0.3'
32
+ version: '0.5'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.3'
39
+ version: '0.5'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: inquirex-llm
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.1'
46
+ version: '0.5'
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '0.1'
53
+ version: '0.5'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: pastel
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -151,6 +151,7 @@ files:
151
151
  - examples/09_tax_preparer_llm.rb
152
152
  - examples/10_answers.json
153
153
  - examples/10_real_tax_preparer.rb
154
+ - examples/11_llm_keywords.rb
154
155
  - examples/README.md
155
156
  - exe/inquirex
156
157
  - justfile