foobara 0.0.125 → 0.0.126
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +86 -19
- data/projects/command/src/command/concerns/shortcut_for_run.rb +2 -0
- data/projects/command/src/command_pattern_implementation/concerns/subcommands.rb +2 -0
- data/projects/command_connectors/src/command_connector.rb +5 -0
- data/projects/nested_transactionable/lib/foobara/nested_transactionable.rb +4 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d3daa4a78757b936511e8ed15cf5226c243d0fcb1c8cc28e7dafd466127bff0
|
4
|
+
data.tar.gz: 7c58b71185cb2ccffed937aa922170f70186295933e65586f57b1c8429d0875f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1a61199416081a65ae3dda56809859fc0d036818d817bdc2885f627742ec81db2f31c3b599e8aad0de4dbb7a139b027e51e3a77e897013c2d4e2ca2391267bb
|
7
|
+
data.tar.gz: 6e245ef28b841f54e9f84353cf4b689fc29edee3b41ab997436788835676299bd6f78a9708643f1cab2293edfbb6a53bd6841bf5bfbe61668c5950c2229d23f0
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
-
Foobara is a software framework
|
2
|
-
|
3
|
-
|
1
|
+
Foobara is a software framework to help you encapsulate your high-level
|
2
|
+
domain operations in commands, and automatically expose machine-readable formal metadata about those
|
3
|
+
commands so that integration code can be decoupled and abstracted away.
|
4
|
+
|
5
|
+
This, as well as some other features of foobara, help manage domain complexity and produce
|
6
|
+
more flexible systems with better management of domain complexity.
|
4
7
|
|
5
8
|
You can watch a video that gives a good overview of what Foobara is and its goals here:
|
6
9
|
[Introduction to the Foobara software framework](https://youtu.be/SSOmQqjNSVY)
|
@@ -24,6 +27,7 @@ You can watch a video that gives a good overview of what Foobara is and its goal
|
|
24
27
|
* [HTTP Command Connectors](#http-command-connectors)
|
25
28
|
* [Rack Connector](#rack-connector)
|
26
29
|
* [Rails Connector](#rails-connector)
|
30
|
+
* [MCP Command Connector](#mcp-command-connector)
|
27
31
|
* [Async Command Connectors](#async-command-connectors)
|
28
32
|
* [Scheduler Command Connectors](#scheduler-command-connectors)
|
29
33
|
* [Intermediate Foobara](#intermediate-foobara)
|
@@ -51,6 +55,7 @@ You can watch a video that gives a good overview of what Foobara is and its goal
|
|
51
55
|
* [Namespaces](#namespaces)
|
52
56
|
* [Value processors](#value-processors)
|
53
57
|
* [Additional learning materials/Documentation](#additional-learning-materialsdocumentation)
|
58
|
+
* [Help](#help)
|
54
59
|
* [Contributing](#contributing)
|
55
60
|
* [Developing locally](#developing-locally)
|
56
61
|
* [Monorepo Structure](#monorepo-structure)
|
@@ -67,7 +72,7 @@ You can watch a video that gives a good overview of what Foobara is and its goal
|
|
67
72
|
|
68
73
|
## Discoverability
|
69
74
|
|
70
|
-
* This means there is a formal machine-readable description of the systems/subsystems
|
75
|
+
* This means there is a formal, machine-readable, description of the systems/subsystems
|
71
76
|
* The implication of this is that integration code can be abstracted away.
|
72
77
|
|
73
78
|
## Implications of command-centric + discoverability
|
@@ -75,6 +80,7 @@ You can watch a video that gives a good overview of what Foobara is and its goal
|
|
75
80
|
* The system better communicates the mental model of the problem and the chosen solution
|
76
81
|
* Engineers are able to spend more time writing code relevant to the domain and less time
|
77
82
|
writing code related to specific tech-stack, software pattern, or architecture decisions.
|
83
|
+
* Engineers are much less likely to harmfully couple domain logic to integration logic.
|
78
84
|
* Engineers can spend more time operating within a specific mental model at a time instead of
|
79
85
|
multiple mental models all at once.
|
80
86
|
|
@@ -86,14 +92,14 @@ You can watch a video that gives a good overview of what Foobara is and its goal
|
|
86
92
|
* Domains are namespaces of Commands, types, and errors
|
87
93
|
* Domains (and commands) have explicit, unidirectional dependencies on other domains
|
88
94
|
* Organizations are namespaces of Domains
|
89
|
-
* Domain mappers
|
90
|
-
* These can map a concept from one domain to another
|
91
|
-
* This separation of concerns leads to commands that have code
|
92
|
-
that reflects the domain they belong to as opposed to logic from many different domains
|
93
95
|
* Remote commands
|
94
96
|
* These have the same interface as commands that live in other systems and act as a proxy to them
|
95
97
|
* This allows rearchitecting of systems without changing interfaces and so reducing refactoring/testing required
|
96
98
|
* These currently exist for both Ruby and Typescript
|
99
|
+
* Domain mappers
|
100
|
+
* These can map a concept from one domain to another
|
101
|
+
* This separation of concerns leads to commands that have code
|
102
|
+
that reflects the domain they belong to as opposed to logic from many different domains
|
97
103
|
* Code generators
|
98
104
|
* Similar to remote commands, discoverability enables other types of tooling, including code generators,
|
99
105
|
documentation tools, etc
|
@@ -107,8 +113,6 @@ You can watch a video that gives a good overview of what Foobara is and its goal
|
|
107
113
|
# Installation
|
108
114
|
|
109
115
|
To add foobara to an existing project, you can add `foobara` gem to your Gemfile or .gemspec as you normally would.
|
110
|
-
You can also `gem install foobara` and whatever additional foobara gems you need and use them in
|
111
|
-
scripts by requiring them.
|
112
116
|
|
113
117
|
You could also use a generator to create a new Ruby Foobara project using the `foob` gem with `gem install foob` and
|
114
118
|
then run `foob generate ruby-project --name your-org/your-new-project-name`
|
@@ -344,7 +348,7 @@ We have so far seen one Foobara type which is `integer` but there are many other
|
|
344
348
|
We used :integer to type the operands of our Add command. There are many ways to express types in Foobara
|
345
349
|
but in this case we used the attributes DSL. It has the form:
|
346
350
|
|
347
|
-
`<
|
351
|
+
`<attribute_name> <type_symbol> [processors] [description]`
|
348
352
|
|
349
353
|
We used a processor `:required` but there are many others and you can create your own.
|
350
354
|
|
@@ -830,6 +834,67 @@ end
|
|
830
834
|
|
831
835
|
This has the same effect as the previous code and is just a stylistic alternative.
|
832
836
|
|
837
|
+
### MCP Command Connector
|
838
|
+
|
839
|
+
We can have an MCP server for free for our commands. Let's try it!
|
840
|
+
|
841
|
+
Let's simulate some bad data and expose some commands over MCP and ask an
|
842
|
+
MCP client like Claude Code to find/fix the bad data.
|
843
|
+
|
844
|
+
```ruby
|
845
|
+
CreateCapybara.run!(name: "Fumiko", year_of_birth: 2020)
|
846
|
+
# Simulate a year accidentally entered with a 2-digit format where a 4-digit format was expected:
|
847
|
+
CreateCapybara.run!(name: "Barbara", year_of_birth: 19)
|
848
|
+
CreateCapybara.run!(name: "Basil", year_of_birth: 2021)
|
849
|
+
|
850
|
+
mcp_connector = Foobara::McpConnector.new
|
851
|
+
|
852
|
+
mcp_connector.connect(FindAllCapybaras)
|
853
|
+
mcp_connector.connect(UpdateCapybara)
|
854
|
+
|
855
|
+
mcp_connector.run_stdio_server
|
856
|
+
```
|
857
|
+
|
858
|
+
Oh whoops, somebody entered Barbara's year of birth as 19 instead of 2019, whoops!
|
859
|
+
Let's ask Claude Code to find/fix the bad record:
|
860
|
+
|
861
|
+
```
|
862
|
+
$ claude
|
863
|
+
> Hi! There's a Capybara whose birth year was entered incorrectly. Can you find which one
|
864
|
+
and fix it? Thanks!
|
865
|
+
● I'll help find and fix the capybara with the incorrect birth year. Let me search for the
|
866
|
+
capybaras first.
|
867
|
+
● mcp-test:FindAllCapybaras (MCP)()…
|
868
|
+
⎿ [
|
869
|
+
{
|
870
|
+
"name": "Fumiko",
|
871
|
+
"year_of_birth": 2020,
|
872
|
+
"id": 1
|
873
|
+
|
874
|
+
… +7 lines (ctrl+r to expand)
|
875
|
+
|
876
|
+
"name": "Basil",
|
877
|
+
"year_of_birth": 2021,
|
878
|
+
"id": 3
|
879
|
+
}
|
880
|
+
]
|
881
|
+
● It looks like Barbara (id 2) has an incorrect birth year of 19, which is too low. Let me
|
882
|
+
fix that to 2019.
|
883
|
+
● mcp-test:UpdateCapybara (MCP)(id: 2, year_of_birth: 2019)…
|
884
|
+
⎿ {
|
885
|
+
"name": "Barbara",
|
886
|
+
"year_of_birth": 2019,
|
887
|
+
"id": 2
|
888
|
+
}
|
889
|
+
● Fixed! Barbara's birth year has been updated from 19 to 2019.
|
890
|
+
> Great! Thanks!
|
891
|
+
● You're welcome!
|
892
|
+
```
|
893
|
+
Record fixed! A benefit of encapsulating your high-level domain operations behind commands that have machine-readable
|
894
|
+
formal manifests describing them is easy tooling like this.
|
895
|
+
|
896
|
+
See https://github.com/foobara/mcp-connector for details on how to do this if interested.
|
897
|
+
|
833
898
|
#### Async Command Connectors
|
834
899
|
|
835
900
|
Let's connect a command to some sort of async job solution. We'll connect our IncrementAge command to Resque:
|
@@ -2041,17 +2106,19 @@ TODO: give some code examples
|
|
2041
2106
|
* All docs combined: https://docs.foobara.com/all/
|
2042
2107
|
* Per-repository docs: https://foobara.com/docs
|
2043
2108
|
|
2044
|
-
#
|
2109
|
+
# Help
|
2045
2110
|
|
2046
|
-
|
2047
|
-
forms of help. We could pair on what you have in mind and you could drive or at least we can make sure
|
2048
|
-
it's a good use of time. I can be reached at azimux@gmail.com
|
2111
|
+
Are you actually trying to build something with Foobara? Happy to help! miles@foobara.com
|
2049
2112
|
|
2050
|
-
|
2113
|
+
# Contributing
|
2051
2114
|
|
2052
|
-
|
2115
|
+
There are many ways you could help! There are tasks in the codebase for all skill levels including absolute beginner.
|
2116
|
+
There's also much need for improved documentation. If you're interested in helping but don't know how, then
|
2117
|
+
please reach out! miles@foobara.com
|
2053
2118
|
|
2054
|
-
|
2119
|
+
You are welcome to also contribute via a github pull request or open issues for bugs.
|
2120
|
+
Make sure the test suite and linter pass locally before opening a pull request as
|
2121
|
+
the build will fail if test coverage is below 100%.
|
2055
2122
|
|
2056
2123
|
## Developing locally
|
2057
2124
|
|
@@ -2068,7 +2135,7 @@ And if the tests/linter pass then you could dive into modifying the code
|
|
2068
2135
|
|
2069
2136
|
## Monorepo Structure
|
2070
2137
|
|
2071
|
-
Foobara is split up into many projects
|
2138
|
+
Foobara is split up into many, many projects
|
2072
2139
|
|
2073
2140
|
Many are in separate repositories which you can see at: https://github.com/orgs/foobara/repositories
|
2074
2141
|
|
@@ -19,6 +19,8 @@ module Foobara
|
|
19
19
|
|
20
20
|
module ClassMethods
|
21
21
|
def define_command_named_function
|
22
|
+
return if name.nil?
|
23
|
+
|
22
24
|
command_class = self
|
23
25
|
convenience_method_name = Foobara::Util.non_full_name(command_class)
|
24
26
|
containing_module = Foobara::Util.module_for(command_class) || Object
|
@@ -644,5 +644,10 @@ module Foobara
|
|
644
644
|
|
645
645
|
command_registry.foobara_all_command(mode: Namespace::LookupMode::ABSOLUTE)
|
646
646
|
end
|
647
|
+
|
648
|
+
def all_exposed_type_names
|
649
|
+
# TODO: cache this or better yet cache #foobara_manifest
|
650
|
+
foobara_manifest[:type].keys.sort.map(&:to_s)
|
651
|
+
end
|
647
652
|
end
|
648
653
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.126
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 2025-05-21 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bigdecimal
|
@@ -528,7 +528,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
528
528
|
- !ruby/object:Gem::Version
|
529
529
|
version: '0'
|
530
530
|
requirements: []
|
531
|
-
rubygems_version: 3.6.
|
531
|
+
rubygems_version: 3.6.2
|
532
532
|
specification_version: 4
|
533
533
|
summary: A command-centric and discoverable software framework with a focus on domain
|
534
534
|
concepts and abstracting away integration code
|