Scaffold kcolb CLI composing quoter, gas-oracle, depeg-monitor#2
Open
Pattermesh wants to merge 1 commit into
Open
Scaffold kcolb CLI composing quoter, gas-oracle, depeg-monitor#2Pattermesh wants to merge 1 commit into
Pattermesh wants to merge 1 commit into
Conversation
Zero-framework (stdlib + argparse) convenience CLI with one subcommand per
sibling toolkit:
- kcolb quote -> quoter (constant-spread bid/ask)
- kcolb gas -> gas-oracle (L2 gas prediction; TS toolkit, stub-only)
- kcolb depeg -> depeg-monitor (median-consensus depeg severity)
Each adapter imports the real toolkit when on PYTHONPATH and otherwise falls
back to a clearly-labelled, pure-stdlib stub that mirrors the toolkit's math,
so the CLI always runs standalone. Every payload carries a "source" field
("<toolkit>" or "stub"). All commands support --json.
Includes pyproject.toml (console_scripts: kcolb), README usage, and a pytest
suite (31 tests) covering arg parsing, each subcommand happy path, JSON output,
user-error exit codes, and the stub fallback seam.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Welcome to kcolbchain, @Pattermesh — glad you're here. 🌱 Here's what happens from this PR:
While you wait:
What happens after your first merge
Thanks for writing the code. We're building this to last. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Scaffolds
kcolb, a zero-framework (Python stdlib + argparse) convenience CLI that composes the existing on-disk kcolbchain DeFi toolkits. One subcommand per toolkit:kcolb quotequoterkcolb gasgas-oraclekcolb depegdepeg-monitorHow it composes the toolkits
Each adapter (
src/kcolb_cli/adapters/) imports the real toolkit when it is onPYTHONPATHand otherwise falls back to a clearly-labelled, pure-stdlib stub that mirrors the toolkit's core math — sokcolbalways runs standalone. Every payload carries asourcefield ("quoter"/"gas-oracle"/"depeg-monitor", or"stub").quote->src.strategies.constant_spread.compute_quotes(quoter)depeg->depeg_monitor.consensus.compute_consensus(depeg-monitor)gas-> gas-oracle is TypeScript (no Python binding), so it always serves the documented stub; a_load_gas_oracleseam is kept for a future binding.Verified end-to-end that with the real toolkits on
PYTHONPATHthesourceflips to"quoter"/"depeg-monitor"and the numbers match the stub.All commands support
--json. Exit codes:0ok,1user error,2no subcommand (usage printed).Included
pyproject.tomlwithconsole_scriptsentry pointkcolb = kcolb_cli.cli:entrypointREADME.mdwith usage + architecture, MITLICENSE,.gitignoretests/— pytest suite (31 tests): arg parsing + subcommand dispatch, each subcommand happy path,--jsonoutput, user-error exit codes, and the stub-fallback seam (monkeypatchedImportError)Tests
Also verified
pip install -e .exposeskcolbon PATH and the suite passes against the installed package.Base
mainwas seeded with LICENSE + README stub + .gitignore in a separate initial commit (the repo was empty).🤖 Generated with Claude Code