inquirex 0.6.0 → 0.7.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.
data/.relaxed_rubocop.yml DELETED
@@ -1,153 +0,0 @@
1
- # Relaxed.Ruby.Style
2
- ## Version 2.5
3
-
4
- Style/Alias:
5
- Enabled: false
6
- StyleGuide: https://relaxed.ruby.style/#stylealias
7
-
8
- Style/AsciiComments:
9
- Enabled: false
10
- StyleGuide: https://relaxed.ruby.style/#styleasciicomments
11
-
12
- Style/BeginBlock:
13
- Enabled: false
14
- StyleGuide: https://relaxed.ruby.style/#stylebeginblock
15
-
16
- Style/BlockDelimiters:
17
- Enabled: false
18
- StyleGuide: https://relaxed.ruby.style/#styleblockdelimiters
19
-
20
- Style/CommentAnnotation:
21
- Enabled: false
22
- StyleGuide: https://relaxed.ruby.style/#stylecommentannotation
23
-
24
- Style/Documentation:
25
- Enabled: false
26
- StyleGuide: https://relaxed.ruby.style/#styledocumentation
27
-
28
- Layout/DotPosition:
29
- Enabled: false
30
- StyleGuide: https://relaxed.ruby.style/#layoutdotposition
31
-
32
- Style/DoubleNegation:
33
- Enabled: false
34
- StyleGuide: https://relaxed.ruby.style/#styledoublenegation
35
-
36
- Style/EndBlock:
37
- Enabled: false
38
- StyleGuide: https://relaxed.ruby.style/#styleendblock
39
-
40
- Style/FormatString:
41
- Enabled: false
42
- StyleGuide: https://relaxed.ruby.style/#styleformatstring
43
-
44
- Style/IfUnlessModifier:
45
- Enabled: false
46
- StyleGuide: https://relaxed.ruby.style/#styleifunlessmodifier
47
-
48
- Style/Lambda:
49
- Enabled: false
50
- StyleGuide: https://relaxed.ruby.style/#stylelambda
51
-
52
- Style/ModuleFunction:
53
- Enabled: false
54
- StyleGuide: https://relaxed.ruby.style/#stylemodulefunction
55
-
56
- Style/MultilineBlockChain:
57
- Enabled: false
58
- StyleGuide: https://relaxed.ruby.style/#stylemultilineblockchain
59
-
60
- Style/NegatedIf:
61
- Enabled: false
62
- StyleGuide: https://relaxed.ruby.style/#stylenegatedif
63
-
64
- Style/NegatedWhile:
65
- Enabled: false
66
- StyleGuide: https://relaxed.ruby.style/#stylenegatedwhile
67
-
68
- Style/NumericPredicate:
69
- Enabled: false
70
- StyleGuide: https://relaxed.ruby.style/#stylenumericpredicate
71
-
72
- Style/ParallelAssignment:
73
- Enabled: false
74
- StyleGuide: https://relaxed.ruby.style/#styleparallelassignment
75
-
76
- Style/PercentLiteralDelimiters:
77
- Enabled: false
78
- StyleGuide: https://relaxed.ruby.style/#stylepercentliteraldelimiters
79
-
80
- Style/PerlBackrefs:
81
- Enabled: false
82
- StyleGuide: https://relaxed.ruby.style/#styleperlbackrefs
83
-
84
- Style/Semicolon:
85
- Enabled: false
86
- StyleGuide: https://relaxed.ruby.style/#stylesemicolon
87
-
88
- Style/SignalException:
89
- Enabled: false
90
- StyleGuide: https://relaxed.ruby.style/#stylesignalexception
91
-
92
- Style/SingleLineBlockParams:
93
- Enabled: false
94
- StyleGuide: https://relaxed.ruby.style/#stylesinglelineblockparams
95
-
96
- Style/SingleLineMethods:
97
- Enabled: false
98
- StyleGuide: https://relaxed.ruby.style/#stylesinglelinemethods
99
-
100
- Layout/SpaceBeforeBlockBraces:
101
- Enabled: false
102
- StyleGuide: https://relaxed.ruby.style/#layoutspacebeforeblockbraces
103
-
104
- Layout/SpaceInsideParens:
105
- Enabled: false
106
- StyleGuide: https://relaxed.ruby.style/#layoutspaceinsideparens
107
-
108
- Style/SpecialGlobalVars:
109
- Enabled: false
110
- StyleGuide: https://relaxed.ruby.style/#stylespecialglobalvars
111
-
112
- Style/StringLiterals:
113
- Enabled: false
114
- StyleGuide: https://relaxed.ruby.style/#stylestringliterals
115
-
116
- Style/TrailingCommaInArguments:
117
- Enabled: false
118
- StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarguments
119
-
120
- Style/TrailingCommaInArrayLiteral:
121
- Enabled: false
122
- StyleGuide: https://relaxed.ruby.style/#styletrailingcommainarrayliteral
123
-
124
- Style/TrailingCommaInHashLiteral:
125
- Enabled: false
126
- StyleGuide: https://relaxed.ruby.style/#styletrailingcommainhashliteral
127
-
128
- Style/SymbolArray:
129
- Enabled: false
130
- StyleGuide: http://relaxed.ruby.style/#stylesymbolarray
131
-
132
- Style/WhileUntilModifier:
133
- Enabled: false
134
- StyleGuide: https://relaxed.ruby.style/#stylewhileuntilmodifier
135
-
136
- Style/WordArray:
137
- Enabled: false
138
- StyleGuide: https://relaxed.ruby.style/#stylewordarray
139
-
140
- Lint/AmbiguousRegexpLiteral:
141
- Enabled: false
142
- StyleGuide: https://relaxed.ruby.style/#lintambiguousregexpliteral
143
-
144
- Lint/AssignmentInCondition:
145
- Enabled: false
146
- StyleGuide: https://relaxed.ruby.style/#lintassignmentincondition
147
-
148
- Layout/LineLength:
149
- Enabled: false
150
-
151
- Metrics:
152
- Enabled: false
153
-
data/.rub DELETED
File without changes
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 4.0.5
data/.secrets.baseline DELETED
@@ -1,127 +0,0 @@
1
- {
2
- "version": "1.5.0",
3
- "plugins_used": [
4
- {
5
- "name": "ArtifactoryDetector"
6
- },
7
- {
8
- "name": "AWSKeyDetector"
9
- },
10
- {
11
- "name": "AzureStorageKeyDetector"
12
- },
13
- {
14
- "name": "Base64HighEntropyString",
15
- "limit": 4.5
16
- },
17
- {
18
- "name": "BasicAuthDetector"
19
- },
20
- {
21
- "name": "CloudantDetector"
22
- },
23
- {
24
- "name": "DiscordBotTokenDetector"
25
- },
26
- {
27
- "name": "GitHubTokenDetector"
28
- },
29
- {
30
- "name": "GitLabTokenDetector"
31
- },
32
- {
33
- "name": "HexHighEntropyString",
34
- "limit": 3.0
35
- },
36
- {
37
- "name": "IbmCloudIamDetector"
38
- },
39
- {
40
- "name": "IbmCosHmacDetector"
41
- },
42
- {
43
- "name": "IPPublicDetector"
44
- },
45
- {
46
- "name": "JwtTokenDetector"
47
- },
48
- {
49
- "name": "KeywordDetector",
50
- "keyword_exclude": ""
51
- },
52
- {
53
- "name": "MailchimpDetector"
54
- },
55
- {
56
- "name": "NpmDetector"
57
- },
58
- {
59
- "name": "OpenAIDetector"
60
- },
61
- {
62
- "name": "PrivateKeyDetector"
63
- },
64
- {
65
- "name": "PypiTokenDetector"
66
- },
67
- {
68
- "name": "SendGridDetector"
69
- },
70
- {
71
- "name": "SlackDetector"
72
- },
73
- {
74
- "name": "SoftlayerDetector"
75
- },
76
- {
77
- "name": "SquareOAuthDetector"
78
- },
79
- {
80
- "name": "StripeDetector"
81
- },
82
- {
83
- "name": "TelegramBotTokenDetector"
84
- },
85
- {
86
- "name": "TwilioKeyDetector"
87
- }
88
- ],
89
- "filters_used": [
90
- {
91
- "path": "detect_secrets.filters.allowlist.is_line_allowlisted"
92
- },
93
- {
94
- "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
95
- "min_level": 2
96
- },
97
- {
98
- "path": "detect_secrets.filters.heuristic.is_indirect_reference"
99
- },
100
- {
101
- "path": "detect_secrets.filters.heuristic.is_likely_id_string"
102
- },
103
- {
104
- "path": "detect_secrets.filters.heuristic.is_lock_file"
105
- },
106
- {
107
- "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
108
- },
109
- {
110
- "path": "detect_secrets.filters.heuristic.is_potential_uuid"
111
- },
112
- {
113
- "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
114
- },
115
- {
116
- "path": "detect_secrets.filters.heuristic.is_sequential_string"
117
- },
118
- {
119
- "path": "detect_secrets.filters.heuristic.is_swagger_file"
120
- },
121
- {
122
- "path": "detect_secrets.filters.heuristic.is_templated_secret"
123
- }
124
- ],
125
- "results": {},
126
- "generated_at": "2026-04-13T21:29:03Z"
127
- }
data/Brewfile DELETED
@@ -1,7 +0,0 @@
1
- # Please run `brew bundle` before running `lefthook install`
2
-
3
- brew 'lefthook'
4
- brew 'codespell'
5
- brew 'mdformat'
6
- brew 'detect-secrets'
7
-
data/Rakefile DELETED
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rspec/core/rake_task"
5
- require "timeout"
6
- require "yard"
7
-
8
- def shell(*args)
9
- puts "running: #{args.join(" ")}"
10
- system(args.join(" "))
11
- end
12
-
13
- task :clean do
14
- shell("rm -rf pkg/ tmp/ coverage/ doc/ ")
15
- end
16
-
17
- task gem: [:build] do
18
- shell("gem install pkg/*")
19
- end
20
-
21
- task permissions: [:clean] do
22
- shell("chmod -v o+r,g+r * */* */*/* */*/*/* */*/*/*/* */*/*/*/*/*")
23
- shell("find . -type d -exec chmod o+x,g+x {} \\;")
24
- end
25
-
26
- task build: :permissions
27
-
28
- YARD::Rake::YardocTask.new(:doc) do |t|
29
- t.files = %w[lib/**/*.rb exe/*.rb - README.md LICENSE.txt CHANGELOG.md]
30
- t.options.unshift("--title", '"FlowEngine — DSL + AST for buildiong complex flows in Ruby."')
31
- t.after = -> { exec("open doc/index.html") } if RUBY_PLATFORM =~ /darwin/
32
- end
33
-
34
- RSpec::Core::RakeTask.new(:spec)
35
-
36
- task default: :spec
@@ -1,21 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <svg xmlns="http://www.w3.org/2000/svg" width="99" height="20">
3
- <linearGradient id="b" x2="0" y2="100%">
4
- <stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
5
- <stop offset="1" stop-opacity=".1"/>
6
- </linearGradient>
7
- <mask id="a">
8
- <rect width="99" height="20" rx="3" fill="#fff"/>
9
- </mask>
10
- <g mask="url(#a)">
11
- <path fill="#555" d="M0 0h63v20H0z"/>
12
- <path fill="#4c1" d="M63 0h36v20H63z"/>
13
- <path fill="url(#b)" d="M0 0h99v20H0z"/>
14
- </g>
15
- <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
16
- <text x="31.5" y="15" fill="#010101" fill-opacity=".3">coverage</text>
17
- <text x="31.5" y="14">coverage</text>
18
- <text x="80" y="15" fill="#010101" fill-opacity=".3">96%</text>
19
- <text x="80" y="14">96%</text>
20
- </g>
21
- </svg>
@@ -1,55 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "inquirex"
6
-
7
- DEFINITION = Inquirex.define id: "tax-intake-2025", version: "1.0.0" do
8
- meta title: "Tax Preparation Intake", subtitle: "Let's understand your situation"
9
- start :filing_status
10
-
11
- ask :filing_status do
12
- type :enum
13
- question "What is your filing status?"
14
- options single: "Single", married_jointly: "Married Filing Jointly"
15
- widget target: :desktop, type: :radio_group, columns: 2
16
- widget target: :mobile, type: :dropdown
17
- transition to: :dependents
18
- end
19
-
20
- ask :dependents do
21
- type :integer
22
- question "How many dependents?"
23
- default 0
24
- transition to: :business_income
25
- end
26
-
27
- confirm :business_income do
28
- question "Do you have business income?"
29
- transition to: :business_count, if_rule: equals(:business_income, true)
30
- transition to: :done
31
- end
32
-
33
- ask :business_count do
34
- type :integer
35
- question "How many businesses?"
36
- transition to: :done
37
- end
38
-
39
- say :done do
40
- text "Thanks for completing the intake."
41
- end
42
- end
43
-
44
- engine = Inquirex::Engine.new(DEFINITION)
45
-
46
- engine.answer("single") # filing_status
47
- engine.answer(2) # dependents
48
- engine.answer(false) # business_income
49
- engine.advance # done (display step)
50
- engine.finished? # => true
51
-
52
- if __FILE__ == $0
53
- require 'json'
54
- puts JSON.pretty_generate(DEFINITION.to_h)
55
- end
Binary file
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative '01_readme_example'
4
- require 'inquirex'
5
- require 'stringio'
6
-
7
- output = StringIO.new
8
- exporter = Inquirex::Graph::MermaidExporter.new(DEFINITION)
9
- output << exporter.export
10
-
11
- source = <<~HTML
12
- <html>
13
- <head>
14
- <meta charset="utf-8">
15
- </head>
16
- <body>
17
- <meta charset="utf-8">
18
- <div class="mermaid">
19
- #{output.string}
20
- </div>
21
- <script type="module">
22
- import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
23
- mermaid.initialize({ startOnLoad: true });
24
- </script>
25
- </html>
26
- HTML
27
-
28
- if __FILE__ == $0
29
- File.write('mermaid.html', source)
30
- system("open mermaid.html")
31
- sleep 10
32
-
33
- at_exit do
34
- File.delete('mermaid.html')
35
- end
36
- end
@@ -1,97 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- # Example 03: Post-completion actions building emails into the outbox.
5
- #
6
- # The `action` verb runs server-side after the flow finishes. send_email
7
- # builds Mail::Message objects — nothing is delivered here; a host Rails app
8
- # would iterate answers.outbox and deliver via its own ActionMailer config.
9
- #
10
- # Run:
11
- # bundle exec ruby examples/03_send_email_actions.rb
12
-
13
- require "bundler/setup"
14
- require "inquirex"
15
-
16
- DEFINITION = Inquirex.define id: "lead-intake", version: "1.0.0" do
17
- # Egress allowlist: webhook effects may only POST to these hosts.
18
- allowed_domains "*.agentica.group"
19
-
20
- meta title: "Lead Intake", subtitle: "Tell us about your project"
21
- start :name
22
-
23
- ask :name do
24
- type :string
25
- question "What is your name?"
26
- transition to: :email
27
- end
28
-
29
- ask :email do
30
- type :email
31
- question "Where can we reach you? (leave blank to skip the receipt)"
32
- transition to: :budget
33
- end
34
-
35
- ask :budget do
36
- type :currency
37
- question "What is your approximate budget?"
38
- end
39
-
40
- # Sent only when the visitor left an email address.
41
- action :client_receipt, if: not_empty(:email) do
42
- send_email to: "{{email}}",
43
- from: "forms@agentica.group",
44
- subject: "Thanks {{name}} — we got your inquiry",
45
- text: <<~TEXT,
46
- Hi {{name}},
47
-
48
- We received your answers and will reply within one business day.
49
-
50
- {{answers_summary}}
51
- TEXT
52
- html: <<~HTML
53
- <p>Hi {{name}},</p>
54
- <p>We received your answers and will reply within one business day.</p>
55
- {{answers_summary}}
56
- HTML
57
- end
58
-
59
- # Always notify the site owner, and demonstrate the Ruby escape hatch.
60
- action :admin_alert do
61
- send_email to: "owner@agentica.group",
62
- from: "forms@agentica.group",
63
- subject: "New lead: {{name}} (budget {{budget}})",
64
- html: "{{answers_summary}}"
65
- run { |answers, _outbox| puts ">> run{} saw budget: #{answers.budget}" }
66
- end
67
-
68
- # Webhook to an allowed_domains host. Gated by an always-false rule so this
69
- # example runs offline — it records :skipped instead of POSTing. Drop the
70
- # if: to exercise it for real.
71
- action :crm_push, if: equals(:name, "__network_demo__") do
72
- webhook url: "https://hooks.agentica.group/inquirex",
73
- headers: { "X-Api-Key" => "demo" }
74
- end
75
- end
76
-
77
- answers = Inquirex::Actions.run(
78
- DEFINITION,
79
- name: "Ada Lovelace",
80
- email: "ada@lovelace.io",
81
- budget: 12_500.00
82
- )
83
-
84
- puts "Built #{answers.outbox.size} message(s):"
85
- answers.outbox.each do |mail|
86
- puts "-" * 60
87
- puts "To: #{mail.to.join(", ")}"
88
- puts "Subject: #{mail.subject}"
89
- puts "Parts: #{mail.multipart? ? "text + html" : mail.content_type}"
90
- end
91
-
92
- puts "-" * 60
93
- puts "Results: #{answers.outbox.results.map { |r| "#{r.action_id}=#{r.status}" }.join(", ")}"
94
-
95
- # The definition (rules and all) round-trips through JSON — run{} is stripped:
96
- restored = Inquirex::Definition.from_json(DEFINITION.to_json)
97
- puts "Actions after JSON round-trip: #{restored.actions.map(&:id).inspect}"
data/examples/README.md DELETED
@@ -1,33 +0,0 @@
1
- # Examples
2
-
3
- This folder contains just a couple examples to demonstrate the API and the functionality.
4
-
5
- For a fuller list of more comprehensive examples, please see the [examples in the `inquirex-tty` gem](https://github.com/inquirex/inquirex-tty/tree/main/examples).
6
-
7
- ## Running Examples
8
-
9
- These examples are meant to be run as executables from the root level of the gem folder.
10
-
11
- ### First Example
12
-
13
- This example should print to stdout the DSL definition in JSON:
14
-
15
- ```bash
16
- # First example — creates a DSL definition and prints it to stdout in JSON format
17
- ./examples/01_readme_example.rb | jq
18
- ```
19
-
20
- ### Second Example
21
-
22
- This is a more interesting example. It builds on the first, takes that definition and uses the mermaid converter to write a tiny HTML file with a mermaid diagram inside, which represents the definition defined in the first file.
23
-
24
- ```bash
25
- # creates a mermaid.html file at the root of the project
26
- # opens the browser with the file and waits 10 seconds
27
- # deletes the HTML file and exits
28
- ./examples/02_readme_mermaid.rb
29
- ```
30
-
31
- The mermaid file generated should look like this:
32
-
33
- <img src="02_readme_mermaid.png" width="300px" text-align="left"></img>
data/justfile DELETED
@@ -1,70 +0,0 @@
1
- # Tell 'just' to run bash, source our setup script, then execute the recipe
2
- set shell := ["bash", "-c"]
3
-
4
- version := `grep VERSION lib/inquirex/version.rb | awk '{print $3}' | tr -d '"' | tr -d '\n'`
5
- rbenv := 'eval "$(rbenv init bash)"; bundle exec '
6
- repo := 'git@github.com:inquirex/inquirex.git'
7
-
8
- [no-exit-message]
9
- recipes:
10
- just --choose
11
-
12
- # Sync all dependencies
13
- install:
14
- bin/setup
15
-
16
- build: install
17
-
18
- # Lint and reformat files
19
- lint:
20
- {{ rbenv }} rubocop
21
-
22
- # Lint and reformat files (-a) — pass -A as an argument
23
- format *args:
24
- {{ rbenv }} rubocop -a {{ args }}
25
-
26
- # Run all the tests
27
- test *args:
28
- export ENVIRONMENT=test; {{ rbenv }} rspec {{args}}
29
-
30
- # Run tests with coverage
31
- test-coverage *args:
32
- export ENVIRONMENT=test; export COVERAGE=true; {{ rbenv }} rspec {{ args }}
33
-
34
- ci: lint test-coverage
35
-
36
- alias check-all := ci
37
-
38
- clean:
39
- #!/usr/bin/env bash
40
- @find . -name .DS_Store -delete -print || true
41
- @rm -rf tmp/*
42
-
43
- # Run all lefthook pre-commit hooks
44
- lefthook:
45
- {{ rbenv }} lefthook run pre-commit --all-files
46
-
47
- # Print current gem version
48
- version:
49
- @echo "{{ version }}"
50
-
51
- # Clobber
52
- clobber:
53
- {{ rbenv }} rake clobber
54
-
55
- # Generate documentation
56
- doc:
57
- #!/usr/bin/env bash
58
- {{ rbenv }} rake doc
59
-
60
- # Create
61
- publish: build
62
- {{ rbenv }} rake release[remote]
63
-
64
- # Tag v{{ version }}, publish the GH release, & refresh the Homebrew tap.
65
- release:
66
- git fetch --tags
67
- git tag -f "v{{ version }}"
68
- git push -f --tags
69
- gh release delete -y "v{{ version }}" --repo {{ repo }} 2>/dev/null || true
70
- gh release create "v{{ version }}" --generate-notes --repo {{ repo }}
data/lefthook.yml DELETED
@@ -1,35 +0,0 @@
1
- output:
2
- - summary
3
- - failure
4
-
5
- pre-commit:
6
- parallel: true
7
- jobs:
8
- - name: lint
9
- run: bundle exec rubocop -c .rubocop.yml {staged_files}
10
- glob: "*.{rb,Gemfile}"
11
- stage_fixed: true
12
-
13
- - name: check for conflict markers and whitespace issues
14
- run: git --no-pager diff --check
15
-
16
- # If tests take >1 second, move this (or just the long-running tests) to pre-push.
17
- - name: run tests
18
- run: just test
19
-
20
- - name: fix rubocop formatting issues
21
- run: bundle exec rubocop -a {staged_files}
22
- glob: "*.{rb,Gemfile,gemspec}"
23
- stage_fixed: true
24
-
25
- - name: spell check
26
- run: codespell {staged_files}
27
- glob: "*.{rb,md,gemspec}"
28
-
29
- - name: format markdown
30
- run: mdformat {staged_files}
31
- glob: "*.md"
32
- stage_fixed: true
33
-
34
- - name: scan for secrets
35
- run: detect-secrets-hook --baseline .secrets.baseline
data/sig/inquirex.rbs DELETED
@@ -1,4 +0,0 @@
1
- module Inquirex
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end