repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
Vibe-Trading
agent/tests/test_runtime_liveness.py
.py
"""Tests for live-runtime runner liveness (src/live/runtime/liveness.py, SPEC.md §7.5 #3). Heartbeat write/read, the alive predicate against a staleness threshold, and the stale-runner reaper (borrowed from the swarm reaper shape). All time is injected via ``now_ms`` so the tests are deterministic and never sleep; the...
110
3,523
Vibe-Trading
agent/tests/test_openbb_bridge/test_cors_opt_in.py
.py
"""CORS regressions for the additive VIBE_TRADING_EXTRA_CORS_ORIGINS opt-in. The OpenBB Workspace bridge needs a browser origin the loopback defaults do not cover. It must be opt-in: CORS is installed globally with credentials, and in keyless dev mode safe GETs are admitted by local peer address, so an origin trusted ...
52
1,936
Vibe-Trading
agent/tests/test_openbb_bridge/test_event_mapper.py
.py
"""Unit tests for :class:`SSEEventMapper`.""" from __future__ import annotations import pytest pytest.importorskip("openbb_ai") from src.openbb_bridge.event_mapper import SSEEventMapper def test_text_delta_maps_to_single_message_chunk(): mapper = SSEEventMapper() out = mapper.map("text_delta", {"delta": "...
58
1,713
Vibe-Trading
agent/tests/test_openbb_bridge/test_routes.py
.py
"""Integration tests for the OpenBB Workspace bridge HTTP endpoints.""" from __future__ import annotations import pytest from fastapi.testclient import TestClient pytest.importorskip("openbb_ai") import api_server from openbb_ai.helpers import message_chunk from openbb_ai.models import LlmClientMessage, QueryReques...
162
5,218
Vibe-Trading
agent/tests/test_openbb_bridge/test_adapter.py
.py
"""Unit tests for :class:`OpenBBQueryAdapter`.""" from __future__ import annotations import asyncio from types import SimpleNamespace import pytest pytest.importorskip("openbb_ai") from src.openbb_bridge.adapter import OpenBBQueryAdapter class _FakeEvent: def __init__(self, event_type, data): self.ev...
214
7,065
Vibe-Trading
agent/tests/test_openbb_bridge/test_context_injector.py
.py
"""Unit tests for :class:`WorkspaceContextInjector`. The widget / dashboard / context cases are built from the real ``openbb_ai.models`` classes rather than stand-ins, so a field that the SDK does not actually have (``DashboardInfo`` has no ``description``, for example) shows up as a failing assertion instead of a sil...
218
6,455
Vibe-Trading
agent/tests/test_openbb_bridge/test_registration_guard.py
.py
"""Regressions for the optional-extra registration guard. ``openbb-ai`` lives in the optional ``openbb`` extra, so ``api_server`` must come up cleanly on a base install. These tests do not need the SDK — that is the point — so they deliberately skip the module-level ``importorskip`` the rest of the suite uses. """ fr...
69
2,364
Vibe-Trading
agent/tests/quantlib/test_factormodel.py
.py
"""Tests for src.quantlib.factormodel. The recoverability tests build a cross-section from known factor returns and check the regression gets them back. The standardisation tests pin the two conventions that make an exposure mean what it claims: cap-weighted centring and equal-weighted scaling. """ import numpy as np...
428
16,241
Vibe-Trading
agent/tests/quantlib/test_attribution.py
.py
"""Tests for Brinson-Fachler attribution and Carino multi-period linking. The four-sector fixture below is worked out by hand in the test itself: every expected effect is written as the literal arithmetic from the model definition, so a regression in the implementation cannot be absorbed by reusing the implementation'...
347
15,058
Vibe-Trading
agent/tests/quantlib/test_crossvalidation.py
.py
"""Tests for src.quantlib.crossvalidation. The central test is the one that shows a NAIVE split leaks and the purged split does not, over identical data. Asserting only that the purged splitter is clean would pass just as well if purging were a no-op. """ import math import numpy as np import pandas as pd import pyt...
314
10,561
Vibe-Trading
agent/tests/quantlib/test_fundmath.py
.py
"""Tests for src.quantlib.fundmath. Two rules the assertions here follow. *Roots are checked against a construction, not against the solver.* The XIRR tests build a schedule whose net present value at a chosen rate is zero by arithmetic, then ask the solver to find that rate back. The annual-spacing test goes further...
1,228
45,632
Vibe-Trading
agent/tests/quantlib/test_multipletesting.py
.py
"""Tests for src.quantlib.multipletesting. The load-bearing tests here are the ones that show a correction actually bites: a Sharpe that passes uncorrected and fails once the trial count is admitted, and a pure-noise strategy set whose PBO comes out near or above one half. """ import math import numpy as np import p...
343
11,876
Vibe-Trading
agent/tests/quantlib/test_impact.py
.py
"""Tests for the market-impact and slippage models. Two properties matter more than any single number and are asserted for all three price models: impact is monotone in order size, and it vanishes at zero size. """ from __future__ import annotations import itertools import math import pandas as pd import pytest fr...
248
10,492
Vibe-Trading
agent/tests/quantlib/test_performance.py
.py
"""Tests for client-cash-flow-aware performance measurement. The load-bearing property is the one TWR exists for: chain-linking must be invariant to the size and the date of an external contribution, while the money-weighted return must *not* be. Both are asserted against the same underlying return path, so a divergen...
408
15,640
Vibe-Trading
agent/tests/quantlib/test_risk.py
.py
"""Tests for src.quantlib.risk. The sign convention (a loss is a positive number) is asserted directly rather than assumed, because a flipped sign in this family of functions is silent: the number still looks plausible, it is just the wrong one. """ import numpy as np import pandas as pd import pytest from scipy.stat...
524
22,710
Vibe-Trading
agent/tests/quantlib/test_timeseries.py
.py
"""Tests for src.quantlib.timeseries. Every test builds its data from a seeded generator with a known ground truth, so an assertion failure means the estimator moved, not that the market did. The null-hypothesis cases are parametrised across eight seeds rather than run on one hand-picked seed, so a lucky draw cannot m...
841
31,286
Vibe-Trading
agent/tests/quantlib/test_eventstudy.py
.py
"""Tests for src.quantlib.eventstudy. Two-sided throughout: a sample with no event effect must NOT be called significant, and a sample with an injected effect must be. """ import numpy as np import pandas as pd import pytest from src.quantlib.eventstudy import ( DEFAULT_ESTIMATION_GAP, MIN_ESTIMATION_OBSERVA...
384
13,751
Vibe-Trading
agent/tests/quantlib/test_credit.py
.py
"""Tests for src.quantlib.credit. Note on the Altman references: what is pinned here are the *published coefficients and cut-offs* of the three variants (Altman 1968 Z, Z' for private firms, Z'' for non-manufacturers), with the arithmetic of each term written out term by term so the expected value is derivable by eye ...
499
19,686
Vibe-Trading
agent/tests/quantlib/test_fixedincome.py
.py
"""Tests for src.quantlib.fixedincome. Every sensitivity is checked against a finite-difference reprice of the pricing function itself, so a change to `bond_price` cannot leave duration/convexity quietly stale. """ import datetime as dt import numpy as np import pytest from src.quantlib.fixedincome import ( COM...
481
17,430
Vibe-Trading
agent/tests/quantlib/test_options.py
.py
"""Pin the Black-Scholes primitives in ``src.quantlib.options``. Three independent kinds of check, because each catches what the others miss: * Published reference values (Hull, *Options, Futures and Other Derivatives*). These catch a formula that is self-consistently wrong. * Structural identities -- put-cal...
502
22,622
Vibe-Trading
agent/tests/quantlib/test_var_backtest.py
.py
"""Tests for src.quantlib.var_backtest. Every guard here is two-sided: a well-calibrated model must NOT be rejected and a miscalibrated one MUST be. A one-sided guard can always be satisfied by making the test weaker, which is exactly the failure mode these tests exist to prevent. """ import numpy as np import pandas...
333
12,136
Vibe-Trading
agent/tests/quantlib/valuation/test_threestatement.py
.py
"""Tests for the linked three-statement projection. The flagship test (`test_three_period_projection_matches_hand_computation`) is the important one: it builds a three-period scenario where the revolver never moves (`minimum_cash` is set, period by period, to exactly the cash the model would land on with no draw or re...
601
27,068
Vibe-Trading
agent/tests/quantlib/valuation/test_dcf.py
.py
"""Tests for src.quantlib.valuation.dcf. Two rules the assertions here follow, matching the rest of ``tests/quantlib``. *The main worked example is computed by hand, not by calling the module.* :func:`test_full_worked_example_matches_hand_calculation` builds one clean input set, and every expected intermediate (WACC,...
999
36,081
Vibe-Trading
agent/tests/quantlib/valuation/test_comps.py
.py
"""Tests for src.quantlib.valuation.comps. The centerpiece is `test_full_hand_computed_example`: four peers and one target, worked out with LITERAL ARITHMETIC EXPRESSIONS (e.g. ``1130 / 160``, never a pre-rounded decimal typed by hand) so Python evaluates the same formula the module's docstring states, independently o...
779
34,657
Vibe-Trading
agent/tests/quantlib/valuation/test_artifact.py
.py
"""Tests for src.quantlib.valuation.artifact. Structured around the six things the artifact module promises: 1. The input hash is stable under dict-key reordering and int/float/``-0.0`` representation noise, and changes whenever any single input number changes (:class:`TestInputHashStability`). 2. The module ne...
933
40,336
Vibe-Trading
agent/tests/factors/test_lookahead.py
.py
"""Look-ahead guard: factor values at row ``t`` must not depend on rows > t. Strategy: for each registered alpha, 1. Build a synthetic OHLCV+volume+amount panel (300 rows × 10 symbols, reproducible random walk). The panel is long enough to cover the longest production windows we ship (≤252d for academic + Kakus...
197
7,169
Vibe-Trading
agent/tests/factors/test_alpha_compare.py
.py
"""Unit + integration tests for ``vibe-trading alpha compare``. Two layers are covered: 1. **``run_bench(only=...)`` filter** — the small backward-compatible rail that restricts a zoo's IC loop to a named subset, so ``compare`` benches just the handful of alphas asked for. Exercised with a registry-injected, pa...
353
14,214
Vibe-Trading
agent/tests/factors/test_bench_strict.py
.py
"""Unit + integration tests for ``bench_runner_strict``. The companion module adds a same-universe random control gate plus an optional train/test OOS split on top of the existing IC bench math. These tests pin the contract end-to-end: helpers, categorisation rules, the keyword-only ``random_control`` rail, and a smal...
622
23,042
Vibe-Trading
agent/tests/factors/test_alpha101_samples.py
.py
"""Numerical golden tests for a representative slice of the alpha101 zoo. Five alphas (#1, #5, #11, #41, #54) are pinned against pre-computed CSV fixtures in ``fixtures/goldens/``. The fixtures were generated from a ``np.random.RandomState(42)`` 30-row x 5-symbol panel; any change in the operator semantics or the alph...
138
4,325
Vibe-Trading
agent/tests/factors/test_registry.py
.py
"""Registry tests: scan, pydantic, lazy import, error isolation, sanity checks.""" from __future__ import annotations import sys import textwrap from pathlib import Path import numpy as np import pandas as pd import pytest from src.factors.registry import ( AlphaMeta, Registry, RegistryError, SkipAl...
257
8,372
Vibe-Trading
agent/tests/factors/test_korea_universe.py
.py
"""Korea (equity_kr) factor-universe coverage against the bundled zoo. Verifies that the ``equity_kr`` universe was wired end-to-end: - Alpha101 (OHLCV-generic) and QLib158 (multi-market) factors are listed for ``equity_kr``. - GTJA191 (China-scale, Tushare-specific) is NOT exposed for Korea. - A representat...
82
3,020
Vibe-Trading
agent/tests/factors/test_gtja191_part2_samples.py
.py
"""Golden-fixture regression tests for the GTJA-191 part-2 port (alphas 101-191). Five representative alphas spanning the 101-191 range are pinned against CSV goldens generated from a seeded synthetic panel. ``assert_allclose`` with ``rtol=1e-6, equal_nan=True`` detects any drift in either the operator algebra or the ...
119
3,633
Vibe-Trading
agent/tests/factors/test_factor_analysis_core.py
.py
"""Regression tests for factor analysis core helpers.""" from __future__ import annotations import json import tempfile from pathlib import Path import numpy as np import pandas as pd import pytest from src.factors.factor_analysis_core import compute_group_equity from src.tools.factor_analysis_tool import run_facto...
81
2,714
Vibe-Trading
agent/tests/factors/test_academic_samples.py
.py
"""Golden-output regression for ``zoo/academic`` factors. Generates the same seeded panel used to bake the golden CSVs in ``tests/factors/fixtures/goldens/academic_*.csv`` and asserts the live ``Registry.compute()`` output is numerically identical (``rtol=1e-6``, NaNs treated as equal). Three representative factors ar...
77
2,465
Vibe-Trading
agent/tests/factors/test_india_universe.py
.py
"""India (equity_in) factor-universe coverage against the bundled zoo. Verifies that the ``equity_in`` universe was wired end-to-end: - Alpha101 (OHLCV-generic) and QLib158 (multi-market) factors are listed for ``equity_in``. - GTJA191 (China-scale, Tushare-specific) is NOT exposed for India. - A representat...
81
2,977
Vibe-Trading
agent/tests/factors/test_base.py
.py
"""Operator unit tests — NaN propagation, divide-by-zero, warmup, lookahead ban.""" from __future__ import annotations import numpy as np import pandas as pd import pytest from src.factors.base import ( Alpha, AlphaCompute, Market, decay_linear, delta, rank, safe_div, scale, signe...
245
6,834
Vibe-Trading
agent/tests/factors/test_corr_rewire.py
.py
"""Semantic tests for ``zoo/academic/corr_rewire``. The AST purity gate and the look-ahead sentinel cover safety; these tests pin the factor's *meaning*: * an asset that decouples from its bloc must rank last (most negative factor value — it rewired the most, and the factor is stability-high); * columns with insuff...
109
3,999
Vibe-Trading
agent/tests/factors/test_gtja191_part1_samples.py
.py
"""Numerical regression for sampled GTJA Alpha 1-100 modules. Five alphas (1, 5, 17, 42, 80) cover the operator surface — log/rank/corr, ts_rank composition, signed_power, rolling std, and pure volume change — so a regression here catches most operator-mapping mistakes. The seeded panel and golden CSVs are reproducibl...
76
2,758
Vibe-Trading
agent/tests/factors/test_alpha_purity.py
.py
"""AST-based purity gate over ``agent/src/factors/zoo/**/*.py``. Enforces the Alpha-Zoo pure-function contract (see ``docs/alpha-zoo/spec.md`` §"Alpha 纯函数契约"): * Allowed imports (whitelist): ``pandas``, ``numpy``, ``scipy[.*]``, ``src.factors.base``, ``__future__``, ``typing``, ``math``, ``dataclasses``. * Forbidde...
279
9,990
Vibe-Trading
agent/tests/factors/test_qlib158_samples.py
.py
"""Golden-fixture regression tests for sampled qlib158 alphas. We pin 5 alphas across the family taxonomy (K-bar, momentum, momentum-std, volume-microstructure, volume-volatility) against CSV fixtures generated from a fixed-seed panel. Any algebraic drift in the operators, in ``safe_div``, or in a per-family formula w...
106
3,765
Vibe-Trading
agent/tests/factors/conftest.py
.py
"""Test isolation for ``agent/tests/factors/``. Two responsibilities: 1. **Network kill-switch** — alphas must be pure functions of the input panel. We disable all sockets during factor tests via ``pytest-socket``. If the package is not installed we skip silently (CI installs it from the ``dev`` extra in ``p...
35
1,397
Vibe-Trading
agent/tests/fixtures/fake_mcp_server.py
.py
"""Minimal fake MCP server for integration tests. Launched as a stdio subprocess by test_mcp_stdio_integration.py. Exposes two tools: - echo(message: str) -> str — returns "echo: <message>" - add(a: int, b: int) -> int — returns a + b Usage (called by pytest, not directly): python agent/tests/fixtures/fake...
48
931
Vibe-Trading
agent/tests/fixtures/fake_mcp_streamable_http_server.py
.py
"""Minimal FastMCP streamable HTTP server for integration tests. Launched as an HTTP subprocess by test_mcp_streamable_http_integration.py. Exposes two tools: - echo(message: str) -> str — returns "echo: <message>" - add(a: int, b: int) -> int — returns a + b Usage (called by pytest, not directly): pytho...
53
1,651
Vibe-Trading
agent/tests/fixtures/fake_mcp_sse_server.py
.py
"""Minimal FastMCP SSE server for integration tests. Launched as an HTTP subprocess by test_mcp_sse_integration.py. Exposes two tools: - echo(message: str) -> str — returns "echo: <message>" - add(a: int, b: int) -> int — returns a + b Usage (called by pytest, not directly): python agent/tests/fixtures/f...
54
1,565
Vibe-Trading
agent/tests/memory/test_compression.py
.py
"""Tests for CompressionPipeline: three-level memory compression (Tier 2).""" from __future__ import annotations import time from pathlib import Path import pytest from src.memory.compression import ( DAILY_THRESHOLD_DAYS, DIGEST_THRESHOLD_DAYS, LEVEL_DAILY, LEVEL_DIGEST, LEVEL_RAW, Compress...
235
9,425
Vibe-Trading
agent/tests/memory/test_semantic_links.py
.py
"""Tests for SemanticLinker: BM25-based memory linking (Tier 2).""" from __future__ import annotations from pathlib import Path import pytest from src.memory.semantic_links import ( SemanticLinker, _tokenize_for_bm25, compute_bm25_score, compute_idf, ) # -------------------------------------------...
209
8,224
Vibe-Trading
agent/tests/memory/test_hierarchy.py
.py
"""Tests for MemoryHierarchy: hierarchical directory routing (Tier 2).""" from __future__ import annotations from pathlib import Path import pytest from src.memory.hierarchy import CATEGORIES, MemoryHierarchy # --------------------------------------------------------------------------- # Helpers # ---------------...
184
7,109
Vibe-Trading
agent/tests/memory/test_memory_dedup.py
.py
"""Tests for content deduplication in PersistentMemory.""" from __future__ import annotations from pathlib import Path from unittest.mock import patch import pytest from src.memory.persistent import ( DEDUP_WINDOW_SECONDS, PersistentMemory, content_hash, ) class TestContentHash: """Unit tests for ...
171
7,520
Vibe-Trading
agent/tests/memory/test_tier2_integration.py
.py
"""Tier 2 end-to-end integration tests. Validates that enabling Tier 2 feature flags produces the expected hierarchical routing, semantic linking, FTS indexing, and compression behaviors through the real PersistentMemory / MemoryLifecycle / RememberTool stack. """ from __future__ import annotations import json impor...
580
23,066
Vibe-Trading
agent/tests/memory/test_search_index.py
.py
"""Tests for MemorySearchIndex: SQLite FTS5 full-text search (Tier 2).""" from __future__ import annotations import os from pathlib import Path import pytest from src.memory.search_index import MemorySearchIndex # --------------------------------------------------------------------------- # Tests: basic index and...
215
7,765
Vibe-Trading
agent/tests/memory/benchmarks/runner.py
.py
"""A/B comparison runner for memory retrieval evaluation. Simulates keyword-based retrieval with and without importance decay weighting, then computes P@5, MRR, NDCG@5 for both modes. Modes: - Baseline (flag=0): pure token-overlap relevance scoring - Treatment (flag=1): relevance × importance_weight (decay + qual...
480
16,180
Vibe-Trading
agent/tests/memory/benchmarks/test_tier2_benchmark.py
.py
"""Tier 2 Memory benchmark quality-gate tests. Validates four Tier 2 capabilities against the benchmark corpus: 1. FTS5 search quality parity with O(n) scan 2. Semantic link expansion benefit 3. Compression information retention 4. Hierarchical routing efficiency without regression This benchmark suite is NOT...
332
12,719
Vibe-Trading
agent/tests/memory/benchmarks/metrics.py
.py
"""Retrieval quality metrics: P@K, MRR, NDCG@K. All functions follow the convention: - `retrieved`: ordered list of memory IDs returned by the retrieval system - `expected`: list of relevant memory IDs (ground truth) - Higher is better for all metrics (range [0, 1]) """ from __future__ import annotations impor...
82
2,436
Vibe-Trading
agent/tests/memory/benchmarks/tier2_runner.py
.py
"""Tier 2 Memory evaluation runner: FTS5, semantic links, compression, hierarchy. Evaluates four Tier 2 capabilities against the shared benchmark corpus: 1. FTS5 full-text search quality and latency vs O(n) token-scan 2. Semantic link expansion recall improvement 3. Compression information retention and search q...
540
18,366
Vibe-Trading
agent/tests/memory/benchmarks/test_benchmark.py
.py
"""Pytest integration for P@5 evaluation benchmark. Tests validate that the Treatment mode (importance decay + quality scoring) delivers measurable improvement over the Baseline mode (pure relevance). This benchmark suite is NOT intended for CI. It requires corpus files (``tmp/benchmark_corpus/``) that are not versio...
215
7,966
Vibe-Trading
agent/tests/memory/benchmarks/conftest.py
.py
"""Shared fixtures for memory benchmark tests. Corpus files live outside version control (``tmp/benchmark_corpus/``). When they are absent the entire benchmark suite is skipped so CI stays green. The benchmark suite is designed to run locally after modifying the memory layer, not as part of the automated CI pipeline. ...
52
1,750
Vibe-Trading
agent/scripts/w4a_patch_blog.py
.py
"""W4.a blog patcher: fill TBD placeholders in alpha-191-in-2026.html. Reads ~/.vibe-trading/reports/bench_summary.json (produced by w4a_run_benches.py) and patches the HTML in place. Substitutions performed: - num-alive / num-reversed / num-dead spans in the two stat blocks - Theme survival table rows (count + survi...
251
9,634
Vibe-Trading
agent/scripts/bench_performance.py
.py
"""Performance benchmark: compare old vs new operator/equity paths. Development-only script — not included in the package. Run: python agent/scripts/bench_performance.py """ from __future__ import annotations import os import sys import time import numpy as np import pandas as pd sys.path.insert(0, os.path.join(os...
134
3,656
Vibe-Trading
agent/scripts/w4a_run_benches.py
.py
"""W4.a bench driver: run 4 zoo×universe combinations and emit summary JSON. Usage: cd agent && python scripts/w4a_run_benches.py Output: ~/.vibe-trading/reports/alpha_bench_*.html — per-run HTML reports ~/.vibe-trading/reports/bench_<zoo>_<uni>.json — per-run raw results ~/.vibe-trading/reports...
172
5,753
Vibe-Trading
agent/cli/_legacy.py
.py
#!/usr/bin/env python3 """Vibe-Trading CLI for natural-language finance research and backtesting. Usage: vibe-trading Interactive mode (default) vibe-trading -p "Backtest AAPL MACD" Single run vibe-trading serve --port 8899 Start API server vibe-trading chat ...
5,991
238,547
Vibe-Trading
agent/cli/main.py
.py
"""Interactive CLI front door for Vibe-Trading. Responsibilities: 1. Detect whether any provider `.env` candidate exists; if all are missing, run the onboarding wizard (:mod:`cli.onboard`) before doing anything else. 2. Render the startup banner (:mod:`cli.intro`) on interactive entry. 3. For interactive entry (no...
1,515
58,819
Vibe-Trading
agent/cli/completer.py
.py
"""FuzzyCompleter for slash commands. Returns completions only when the line starts with ``/`` so normal prose typing is not polluted by suggestions. Each completion advertises the command description in muted style with the command name in the brand primary color (sourced from :mod:`agent.cli.theme` when available; f...
116
4,344
Vibe-Trading
agent/cli/_version.py
.py
"""Single source of truth for the CLI version string. Reads ``vibe-trading-ai``'s installed package metadata when available (``pip install -e .`` is enough). For an un-installed checkout (e.g. running straight from a clone with ``PYTHONPATH=agent``) it falls back to reading the version straight out of ``pyproject.toml...
47
1,691
Vibe-Trading
agent/cli/__main__.py
.py
"""Allow ``python -m cli`` to run the CLI entrypoint.""" from cli.main import _entrypoint _entrypoint()
6
106
Vibe-Trading
agent/cli/__init__.py
.py
"""Vibe-Trading CLI package. The legacy single-file CLI has been preserved verbatim as ``cli/_legacy.py`` and is the source of truth for non-interactive subcommands (``serve``, ``run``, ``mcp``, ``sessions``, ``swarm`` ...). The front door (:mod:`cli.main`) shows the banner, runs the onboarding wizard when needed, the...
107
3,888
Vibe-Trading
agent/cli/input.py
.py
"""prompt_toolkit input editor + ``SafeFileHistory``. Wraps a :class:`PromptSession` with: * The slash :class:`~cli.completer.SlashCompleter` * Multi-line editing — Enter inserts a newline only when the buffer is mid-bracket; Alt+Enter / Esc-Enter inserts a newline unconditionally; a plain Enter on...
386
13,991
Vibe-Trading
agent/cli/intro.py
.py
"""Compatibility wrapper for the interactive startup banner.""" from cli.ui.banner import print_banner __all__ = ["print_banner"]
6
132
Vibe-Trading
agent/cli/onboard.py
.py
"""First-launch onboarding wizard. Triggered automatically when ``~/.vibe-trading/.env`` does not exist. Five back-steppable steps (provider → model → key → timeout → optional Tushare), matching §3.2 of the 2026-05-19 UI/UX design proposal. Each step persists immediately to ``~/.vibe-trading/.env.partial`` and the fi...
567
21,524
Vibe-Trading
agent/cli/stream.py
.py
"""Streaming renderer + thinking spinner for the interactive CLI. Single-agent mode (the only mode demoed in Parcel α): a short-lived ``Rich.Live`` with ``transient=True`` drives the spinner while the model thinks; tool events and the final answer are emitted as *static* prints so they persist on screen after the live...
346
12,847
Vibe-Trading
agent/cli/theme.py
.py
"""Centralised Rich Style table for the Vibe-Trading CLI. All visible colour decisions for the CLI live here so the look stays consistent with the web app (see ``frontend/src/index.css`` design tokens). The brand accent is the orange wordmark colour selected in the 2026-05-19 UI/UX design proposal (§1.3): * light ter...
242
8,218
Vibe-Trading
agent/cli/utils/format.py
.py
"""Pure formatting helpers for the CLI surface. These mirror the formatting conventions used in the web app (see ``frontend/src/lib/format.ts``) so a duration printed in the CLI reads the same as one printed in the chat bubble: * ``format_duration(ms_or_s)`` → ``"230ms" | "1.4s" | "4m 12s"`` * ``format_tokens(n)`` → ...
158
4,990
Vibe-Trading
agent/cli/utils/__init__.py
.py
"""Small, pure helpers shared across CLI components. Everything here is stateless and side-effect free — safe to import from any module in ``agent/cli``. Larger or stateful helpers belong in their own module (see ``cli/stream.py`` for the streaming renderer). """ from cli.utils.format import abbreviate_num, format_du...
17
507
Vibe-Trading
agent/cli/utils/thinking_verbs.py
.py
"""Random "thinking" verb for the streaming spinner. The status bar shows a verb while the agent is generating to communicate that work is happening even before the first token arrives. Borrowed from the dexter CLI: the verb is rerolled per agent turn so the user perceives variety across runs rather than a single hard...
42
1,126
Vibe-Trading
agent/cli/components/__init__.py
.py
"""Reusable CLI render components. Each component returns a Rich renderable (Text / Panel / Table) so callers can ``console.print`` or stuff it into a Live group. """ from .chat_log import render_history from .hint_bar import render_hint_bar from .tool_event import render_tool_event, render_tool_events from .working_...
19
487
Vibe-Trading
agent/cli/components/working_indicator.py
.py
"""Thinking spinner — picks a random verb on entry, hides on exit. Wraps :class:`rich.live.Live` with ``transient=True`` so the spinner erases itself once the context exits — leaving the answer print uncluttered (the bug called out in the reference StreamRenderer docstring: transient=True avoids the "ghost spinner" du...
145
4,653
Vibe-Trading
agent/cli/components/tool_event.py
.py
"""Single tool invocation render. Layout (matches design_proposal §3.5): ● Get Financials ("AAPL", quarterly, last 8 quarters) 1.4s · 8 quarters * ``●`` (U+25CF black circle) marker, color-coded by status: running → ``--warning`` amber (pulse via Rich style ``blink`` when the terminal a...
219
7,445
Vibe-Trading
agent/cli/components/chat_log.py
.py
"""Minimal chat-log renderer — stub for the demo. Iterates a list of turn dicts and prints user / assistant lines with the expected meta header. Defer the rich features (collapsible tool timeline, markdown rendering, action footer) to post-demo work — they belong in the Web bubble (Parcel C / D), not in the CLI replay...
78
2,409
Vibe-Trading
agent/cli/components/hint_bar.py
.py
"""Bottom hint bar — left + right aligned. Renders a single-line hint where the right-aligned segment hugs the terminal edge regardless of left-segment width. Mirrors dexter's ``hint-bar.ts``. Used to surface keyboard guidance ("Tab to complete · /help for commands") and ephemeral state ("input cleared", "cancelled")...
68
2,297
Vibe-Trading
agent/cli/commands/__init__.py
.py
"""Slash command implementations. Each command module exports a ``run(ctx, *args) -> int`` callable. Modules that own multiple commands (``chat``, ``show``, ``session``) also expose named ``cmd_<name>`` callables so the slash router can dispatch by command keyword. The :data:`SLASH_COMMANDS` registry lives in :mod:`....
19
510
Vibe-Trading
agent/cli/commands/research_playbook.py
.py
"""User-facing entry points for the scheduled-research playbook catalogue. The catalogue itself lives in :mod:`src.scheduled_research.playbooks` (markdown templates with a YAML frontmatter header). Until this module existed the only way to reach it was a Python import, so a shipped template was effectively invisible. ...
661
23,782
Vibe-Trading
agent/cli/commands/chat.py
.py
"""Chat-flow slash commands: ``/model``, ``/clear``, ``/journal``, ``/shadow``, ``/swarm``, ``/debug``, ``/quit``. ``/model`` renders the current configuration via the legacy ``_show_settings`` helper. ``/swarm`` dispatches to the legacy ``_handle_swarm_command`` so the existing presets keep working. ``/clear`` clears...
257
9,093
Vibe-Trading
agent/cli/commands/goal.py
.py
"""``/goal`` — manage the current finance research goal from the CLI.""" from __future__ import annotations import os from typing import Any from rich import box from rich.console import Console from rich.console import Group from rich.panel import Panel from rich.table import Table from rich.text import Text from ...
403
14,563
Vibe-Trading
agent/cli/commands/update.py
.py
"""Self-update support: ``vibe-trading update``. Checks PyPI for a newer ``vibe-trading-ai`` release than the currently installed one and, when one exists, upgrades in place through ``pip`` using the same interpreter that is running the CLI (``sys.executable -m pip``, never a bare ``pip`` — the upgrade must target the...
227
8,667
Vibe-Trading
agent/cli/commands/show.py
.py
"""``/show``, ``/skill``, ``/pine`` — read-only inspect commands. All three already exist as fully-featured ``cmd_*`` callables in ``cli._legacy``; this module is a thin shim so the slash router can dispatch by command name without importing the legacy module top-level (which is heavy — it pulls in providers, swarm, e...
87
2,553
Vibe-Trading
agent/cli/commands/session.py
.py
"""``/history``, ``/search``, ``/export`` — session lifecycle commands. * ``/history`` lists recent sessions (legacy ``cmd_sessions``). * ``/search <query>`` runs FTS5 across the session store via :class:`src.session.search.SessionSearchIndex`. * ``/export`` is a placeholder — the rich export lives in the Web bubble...
99
3,012
Vibe-Trading
agent/cli/commands/help.py
.py
"""``/help`` — Show the slash command list and keyboard shortcuts. Renders ``SLASH_COMMANDS`` as a two-column Rich table (name in primary color, description muted) plus a short keyboard-shortcuts panel. """ from __future__ import annotations from typing import Any from rich.console import Console from rich.table im...
65
1,846
Vibe-Trading
agent/cli/commands/slash_router.py
.py
"""Slash command registry + fuzzy matcher. Source of truth for the user-facing slash commands. The literal :data:`SLASH_COMMANDS` tuple below holds the base set; further groups append themselves through idempotent, name-checked registration functions — the institutional workflow cards and the scheduled-research ``/pla...
252
9,548
Vibe-Trading
agent/cli/commands/memory.py
.py
"""``/memory`` — list / show persistent memory snippets. Delegates to the legacy ``cmd_memory_list`` / ``cmd_memory_show`` / ``cmd_memory_search`` callables. ``/memory`` with no args lists; with a single arg shows one; with ``search <q>`` runs FTS; with ``forget <name>`` deletes one. """ from __future__ import annota...
68
1,882
Vibe-Trading
agent/cli/commands/institutional/playbooks.py
.py
"""Playbook definitions for the institutional research slash commands. Pure data — this module imports nothing from :mod:`cli`, so :mod:`cli.commands.slash_router` can pull the command specs at its own import time without a circular import. Each :class:`Playbook` carries four things that make the command more than a ...
655
35,233
Vibe-Trading
agent/cli/commands/institutional/screen.py
.py
"""``/screen`` — Systematic idea screen. Thin handler: the execution skeleton, the worked numeric example and the missing-data policy all live in :mod:`.playbooks`, and the render/dispatch logic in :mod:`.runner`. Running it produces hypothesis, hard thresholds, the full funnel count and a de-duplicated research queue...
30
793
Vibe-Trading
agent/cli/commands/institutional/attrib.py
.py
"""``/attrib`` — Brinson-Fachler performance attribution. Thin handler: the execution skeleton, the worked numeric example and the missing-data policy all live in :mod:`.playbooks`, and the render/dispatch logic in :mod:`.runner`. Running it produces allocation / selection / interaction per sector, reconciled to the t...
30
811
Vibe-Trading
agent/cli/commands/institutional/runner.py
.py
"""Shared rendering and dispatch for the institutional workflow commands. Every ``/comps``-style command funnels through :func:`run_playbook`: * no arguments (or ``help`` / ``-h`` / ``--help`` / ``?``) renders the full playbook card — objective, numbered execution skeleton, the worked numeric example, the data-ga...
210
8,278
Vibe-Trading
agent/cli/commands/institutional/__init__.py
.py
"""Institutional research workflow slash commands. This package turns five recurring sell-side / buy-side workflows into explicit, discoverable slash commands instead of prose buried in a swarm preset: ``/comps`` comparable company analysis ``/dcf`` discounted cash flow ``/attrib`` Brinson-Fachler per...
30
1,214
Vibe-Trading
agent/cli/commands/institutional/earnings.py
.py
"""``/earnings`` — Earnings review. Thin handler: the execution skeleton, the worked numeric example and the missing-data policy all live in :mod:`.playbooks`, and the render/dispatch logic in :mod:`.runner`. Running it produces a line-by-line surprise bridge from revenue to EPS, splitting the recurring beat from the ...
30
814
Vibe-Trading
agent/cli/commands/institutional/comps.py
.py
"""``/comps`` — Comparable company analysis. Thin handler: the execution skeleton, the worked numeric example and the missing-data policy all live in :mod:`.playbooks`, and the render/dispatch logic in :mod:`.runner`. Running it produces peer multiple table, the subject's premium or discount versus the peer median, an...
31
815
Vibe-Trading
agent/cli/commands/institutional/memo.py
.py
"""``/memo`` — Investment memo. Thin handler: the execution skeleton, the worked numeric example and the missing-data policy all live in :mod:`.playbooks`, and the render/dispatch logic in :mod:`.runner`. Running it produces thesis, variant view, probability-weighted scenarios, falsifiable kill criteria and a monitori...
31
795
Vibe-Trading
agent/cli/commands/institutional/dcf.py
.py
"""``/dcf`` — Discounted cash flow valuation. Thin handler: the execution skeleton, the worked numeric example and the missing-data policy all live in :mod:`.playbooks`, and the render/dispatch logic in :mod:`.runner`. Running it produces value per share, the terminal- value share of enterprise value, an exit-multiple...
31
831
Vibe-Trading
agent/cli/ui/transcript.py
.py
"""Transcript helpers for the interactive CLI.""" from __future__ import annotations import re import shutil from typing import Any from rich import box from rich.console import Group from rich.markdown import Markdown from rich.table import Table from rich.text import Text from cli.theme import Theme _PIPE_SEPARA...
182
5,640
Vibe-Trading
agent/cli/ui/__init__.py
.py
"""Visual building blocks for the interactive CLI.""" from cli.ui.banner import print_banner from cli.ui.rail import RailRunDashboard from cli.ui.transcript import render_answer, render_elapsed_status, render_prompt_footer, render_recap __all__ = [ "RailRunDashboard", "print_banner", "render_answer", ...
15
395
Vibe-Trading
agent/cli/ui/rail.py
.py
"""Codex-style rail renderer for agent activity.""" from __future__ import annotations import json import re import shutil import textwrap import threading import time from dataclasses import dataclass, field from pathlib import PureWindowsPath from typing import Any, Literal from urllib.parse import urlparse from r...
600
21,300