gabriel / muse public
feat patch bridge dev
AI Agent gabriel · 144 days ago · Apr 26, 2026 · Diff

feat(bridge): Phase 1 — muse bridge namespace, BridgeState, init_repo_dirs

- Add muse/cli/commands/bridge.py: BridgeState TypedDict, read_bridge_state, write_bridge_state (sha256: prefix enforced), stub runners for git-import / git-export / git-status, full argparse registration - Register muse bridge in muse/cli/app.py (alphabetical, beside bundle) - Add init_repo_dirs(root) to muse/core/paths.py — canonical utility for creating the minimal .muse/ directory tree; idempotent, parents=True - tests/test_bridge_phase1.py: 41 tests across 7 tiers (unit, contract, integration, property/hypothesis, regression, security, stress) - tests/test_core_paths_init_repo_dirs.py: 34 tests across 7 tiers for init_repo_dirs (unit, integration, e2e CLI, stress, state integrity, security, performance)

sha256:1eb4fbb2238e33949cfa2e15b515fb441c13c8bf711e77d19e2f1dc0e94b08f3 sha
+106 ~118 symbols
sha256:cf44adb8de56a72004ca9a041f35cb6980edbeea37262985a4dc01306e76c477 snapshot
+106
symbols added
~118
symbols modified
0
dead code introduced
Semantic Changes 224 symbols
~ muse/cli/commands/bridge.py .py 28 symbols added
+ BridgeState class class BridgeState L103–120
+ _BRIDGE_STATE_FILENAME variable variable _BRIDGE_STATE_FILENAME L127–127
+ _BRIDGE_STATE_LOCK variable variable _BRIDGE_STATE_LOCK L128–128
+ _LastExportState class class _LastExportState L82–100
+ _LastImportState class class _LastImportState L59–79
+ _bridge_state_path function function _bridge_state_path L131–137
+ _dict_to_toml function function _dict_to_toml L233–256
+ _print_bridge_status_text function function _print_bridge_status_text L393–415
+ _register_git_export function function _register_git_export L560–660
+ _register_git_import function function _register_git_import L444–557
+ _register_git_status function function _register_git_status L663–688
+ Any import import Any L46–46
+ ExitCode import import ExitCode L48–48
+ TYPE_CHECKING import import TYPE_CHECKING L46–46
+ TypedDict import import TypedDict L46–46
+ annotations import import annotations L39–39
+ argparse import import argparse L41–41
+ json import import json L42–42
+ pathlib import import pathlib L43–43
+ split_id import import split_id L49–49
+ sys import import sys L44–44
+ threading import import threading L45–45
+ read_bridge_state function function read_bridge_state L144–177
+ register function function register L422–441
+ run_git_export function function run_git_export L306–353
+ run_git_import function function run_git_import L263–303
+ run_git_status function function run_git_status L356–390
+ write_bridge_state function function write_bridge_state L180–230
~ tests/test_bridge_phase1.py .py 57 symbols added
+ TestBridgeCliContract class class TestBridgeCliContract L200–213
+ test_bridge_help_shows_git_export method method test_bridge_help_shows_git_export L207–209
+ test_bridge_help_shows_git_import method method test_bridge_help_shows_git_import L203–205
+ test_bridge_help_shows_git_status method method test_bridge_help_shows_git_status L211–213
+ TestBridgeIntegration class class TestBridgeIntegration L256–275
+ test_git_export_no_git_dir_exits_user_error method method test_git_export_no_git_dir_exits_user_error L265–269
+ test_git_import_dry_run_no_source method method test_git_import_dry_run_no_source L259–263
+ test_git_status_no_repo_exits_cleanly method method test_git_status_no_repo_exits_cleanly L271–275
+ TestBridgeStateProperty class class TestBridgeStateProperty L288–313
+ test_import_state_round_trips method method test_import_state_round_trips L296–313
+ TestBridgeStateRegression class class TestBridgeStateRegression L320–344
+ test_empty_toml_file_returns_empty_state method method test_empty_toml_file_returns_empty_state L323–328
+ test_extra_unknown_keys_are_preserved method method test_extra_unknown_keys_are_preserved L337–344
+ test_no_last_import_section method method test_no_last_import_section L330–335
+ TestBridgeStateSecurity class class TestBridgeStateSecurity L351–379
+ test_muse_commit_id_without_prefix_raises method method test_muse_commit_id_without_prefix_raises L371–379
+ test_read_state_is_always_inside_muse method method test_read_state_is_always_inside_muse L354–361
+ test_write_state_stays_inside_muse method method test_write_state_stays_inside_muse L363–369
+ TestBridgeStateStress class class TestBridgeStateStress L386–439
+ test_concurrent_reads_are_safe method method test_concurrent_reads_are_safe L417–439
+ test_concurrent_writes_do_not_corrupt method method test_concurrent_writes_do_not_corrupt L389–415
+ TestBridgeStateTypedDict class class TestBridgeStateTypedDict L60–105
+ test_import_and_instantiate method method test_import_and_instantiate L63–86
+ test_muse_commit_id_is_prefixed method method test_muse_commit_id_is_prefixed L88–105
+ TestGitExportFlags class class TestGitExportFlags L229–239
+ test_flag_present method method test_flag_present L236–239
+ TestGitImportFlags class class TestGitImportFlags L216–226
+ test_flag_present method method test_flag_present L223–226
+ TestGitStatusFlags class class TestGitStatusFlags L242–249
+ test_flag_present method method test_flag_present L246–249
+ TestReadBridgeState class class TestReadBridgeState L108–144
+ test_existing_file_is_parsed method method test_existing_file_is_parsed L119–136
+ test_missing_file_returns_empty_state method method test_missing_file_returns_empty_state L111–117
+ test_partial_file_fills_missing_sections method method test_partial_file_fills_missing_sections L138–144
+ TestWriteBridgeState class class TestWriteBridgeState L147–193
+ test_muse_commit_id_preserves_prefix method method test_muse_commit_id_preserves_prefix L172–180
+ test_round_trip method method test_round_trip L182–193
+ test_writes_toml_file method method test_writes_toml_file L150–170
+ _SAFE_TEXT variable variable _SAFE_TEXT L282–286
+ _fake_muse_repo function function _fake_muse_repo L51–53
+ _invoke function function _invoke L36–37
+ _read_bs function function _read_bs L40–43
+ _write_bs function function _write_bs L46–48
+ CliRunner import import CliRunner L27–27
+ HealthCheck import import HealthCheck L22–22
+ annotations import import annotations L14–14
+ fake_id import import fake_id L26–26
+ given import import given L22–22
+ init_repo_dirs import import init_repo_dirs L25–25
+ patch import import patch L19–19
+ pathlib import import pathlib L16–16
+ pytest import import pytest L21–21
+ settings import import settings L22–22
+ st import import st L23–23
+ threading import import threading L17–17
+ tomllib import import tomllib L18–18
+ runner variable variable runner L29–29
+ TestInitRepoDirs class class TestInitRepoDirs L30–59
+ test_creates_root_if_missing method method test_creates_root_if_missing L55–59
+ test_idempotent method method test_idempotent L46–48
+ test_muse_dir_created method method test_muse_dir_created L34–36
+ test_no_files_written method method test_no_files_written L50–53
+ test_returns_root method method test_returns_root L31–32
+ test_subdirectory_created method method test_subdirectory_created L42–44
+ annotations import import annotations L11–11
+ commits_dir import import commits_dir L17–17
+ heads_dir import import heads_dir L17–17
+ init_repo_dirs import import init_repo_dirs L17–17
+ logs_dir import import logs_dir L17–17
+ muse_dir import import muse_dir L17–17
+ objects_dir import import objects_dir L17–17
+ pathlib import import pathlib L13–13
+ pytest import import pytest L15–15
+ remotes_dir import import remotes_dir L17–17
+ shelf_dir import import shelf_dir L17–17
+ snapshots_dir import import snapshots_dir L17–17
~ muse/core/paths.py .py 1 symbol added
+ init_repo_dirs function function init_repo_dirs L319–348
← Older Oldest on dev
All commits
Newer → Latest on dev

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:1eb4fbb2238e33949cfa2e15b515fb441c13c8bf711e77d19e2f1dc0e94b08f3 --body "your comment"