feat: add --describe flag to strategy-builder CLI#2548
feat: add --describe flag to strategy-builder CLI#2548hardyjosh wants to merge 32 commits intographite-base/2548from
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR rebrands the orderbook's "GUI" architecture to an "order builder" architecture, moving core builder logic from the WASM-only Changes
Sequence Diagram(s)The changes do not introduce new feature flows that would benefit from sequence diagram visualization. The primary modifications are architectural refactoring (moving logic between crates, renaming types) and terminology updates (GUI→builder), rather than changes to control flow or inter-component interaction patterns. The new CLI interactive wizard is a straightforward user-input loop that exists within a single module boundary. Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
dc1130d to
0e03e5d
Compare
0e03e5d to
d4ce402
Compare
042f0ae to
c36d2a8
Compare
d4ce402 to
9b601f8
Compare
9b601f8 to
a5aa217
Compare
a5aa217 to
d7e2d0f
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Guided deployment flow mirroring the webapp: 1. Fuzzy-select strategy from registry (shows name + description) 2. Pick deployment (shows name + description) 3. Select tokens with search across available token lists 4. Fill required fields with preset selection or custom input 5. Optional deposits with preset amounts 6. Enter owner address 7. Generate calldata — print to stdout or save to .calldata file Usage: raindex strategy-builder -i --registry <url> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ments - Add bold/dim/underlined styling via console crate - Structured headings and separators between sections - Ask for owner address first (needed for balance display) - Show token symbol/name instead of raw key in deposit prompts - Show token balance when prompting for deposits - Remove stox-specific language from output hints — describe the format (address:calldata lines) so any submitter can consume it - Improve preset display with bold labels and dim values Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add max_length(10) to all Select/FuzzySelect prompts so they scroll within a fixed window instead of reprinting the full list on every keystroke. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Long descriptions were wrapping to multiple lines, making each list item 2-3 rows tall and causing the display to scroll erratically. Now truncates all display strings to fit within the terminal width. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The core issue was dialoguer redrawing the list on every keystroke, wiping lines printed above it. Fix: keep list items short (just keys or names), then show the full name + description AFTER the user makes their choice. This way dialoguer only redraws its own compact list. Also: "Generating Calldata" is now a status message, not a heading. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
FuzzySelect redraws on every keystroke, which with long token lists causes severe terminal corruption. Replace with a printed list of all available tokens, then a text input that matches by symbol, name substring, or raw address. Shows disambiguation when multiple tokens match a partial query. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
✅ Actions performedReview triggered.
|
- RAII TerminalGuard restores raw mode/alt screen/cursor on panic - Explicit 0 => arm + unreachable! for output_choice match - saturating_sub for cursor position u16 cast to avoid underflow
`raindex strategy-builder --tokens --strategy <key> --deployment <key> --registry <url>` emits a markdown table of all tokens registered for that specific deployment (symbol, name, address, decimals). This avoids bloating --describe output with potentially hundreds of tokens per deployment. --describe will reference this command so an agent only fetches the token list for the deployment it actually needs.
When a template path resolves to a missing token field (select-token
not yet selected) and a fallback literal is supplied, substitute the
literal instead of leaving the placeholder raw or erroring.
Syntax:
${path} — current behaviour
${path || 'fallback'} — new: substitute literal on missing token
${path || "fallback"} — double quotes also accepted
Backwards-compatible: existing templates without `||` behave identically.
The fallback only kicks in on PropertyNotFound("token") (i.e. unresolved
select-token), not on other resolution errors.
This unblocks --describe emitting readable field names/descriptions when
no token has been selected yet.
Emits a full markdown dump of a registry: strategies, their deployments, fields (with presets and defaults), select-tokens, deposits, plus usage documentation and the address:calldata output format. Intended use: an AI agent or human can run once to learn everything needed to construct a non-interactive deploy command for the registry. The output includes example commands for each deployment with all required flags filled in as placeholders.
Extend the usage section with: - cast send pipe example for signing without the stox CLI - Explicit note that approvals only appear when depositing - Explanation of how to pick token addresses (block explorer / token list) since these are not in the registry itself - Clarification that --owner must be a signing address Goal: minimize the upfront context a calling agent needs before running --describe. Most of what a user would otherwise need to explain in the prompt is now emitted by the tool itself.
Each deployment with select-tokens now includes a code block showing how to fetch the actual valid token addresses for that deployment via raindex strategy-builder --tokens. Avoids inlining hundreds of token entries in describe output.
- Mark each field as (required) or (optional, default: X) - Add a units convention note to the usage section - Add a build-once guidance section (run binary directly, avoid the npm install noise from the nix develop shellHook) - Label calldata stdout lines with # comment headers describing each tx - Update the cast-send pipe example to skip # comment lines and blank lines - Document the # comment convention in the output format section The # comment lines are safe for any submitter that skips lines not matching <address>:<hex> — cast-loop example shows the idiom. The stox submit parser will be updated in a follow-up PR to do the same.
20e9783 to
b525203
Compare
|
closing to retrigger CI |
|
Superseded by #2552 (GitHub stopped firing pull_request events on this branch after excessive force-pushes — recreated with identical commits on a fresh branch). |

Caution
Stacks on #2551. Merge that first.
The registry-side companion work that uses the template-fallback operator (#2551) to produce readable
--describeoutput for existing strategies is in ST0x-Technology/st0x.registry#9 — describe works fine without it, but strategy field names will contain raw${...}placeholders until that PR lands.Motivation
CLI users and AI agents need a way to learn a registry's full configuration without reading the underlying
.rainYAML files or running the interactive wizard. That discovery loop is currently:curlthe registry file → resolve the settings URL →curleach strategy → parse the YAML by hand. Every agent we tested (6/6) burned 4+ tool calls just discovering token addresses.Solution
Add
--describe— emits a full markdown dump of the registry: every strategy, its deployments, required/optional fields (with presets and defaults), select-tokens, deposits, plus usage documentation and theaddress:calldataoutput format.Intended as a self-generating skill. An agent can run once against a registry and have everything it needs to construct non-interactive deploy commands from a natural-language request. Each deployment includes an Example command with the exact flags and placeholders pre-filled.
Also bundled in this PR (small polish items):
(required)or(optional, default: X)so it is obvious which flags are mandatorystrategy-builderstdout lines are now labelled with#comment headers describing what each transaction does (approve / deploy / meta emission). Safe forcast sendpipelines (with a one-line skip) and forstox submit(updated in feat: skip # comment lines in cli submit input ST0x-Technology/st0x.liquidity#578)#comment convention, the--tokenscompanion, the cast-send pipe idiom (with comment-skip), the units convention (human-readable decimal), and the build-once guidance for running the binary directly withoutnix developnoiseChecks
Summary by CodeRabbit
New Features
strategy-builderCLI command with interactive, describe, and tokens modes for deploying order strategies from registry configurations.Bug Fixes
logoURIfield optional in remote token configurations.Documentation
gui:sections withbuilder:throughout codebase.