cgcardona / muse public
app.py python
155 lines 8.4 KB
b69599f3 feat(code): Phase 7 — semantic versioning metadata on StructuredDelta +… Gabriel Cardona <gabriel@tellurstori.com> 1d ago
1 """Muse CLI — entry point for the ``muse`` console script.
2
3 Core VCS commands::
4
5 init status log commit diff
6 show branch checkout merge reset
7 revert stash cherry-pick tag domains
8
9 Music-domain semantic commands (impossible in Git)::
10
11 notes list every note in a MIDI track as musical notation
12 note-log note-level commit history for a track
13 note-blame per-bar attribution — which commit wrote these notes?
14 harmony chord analysis and key detection
15 piano-roll ASCII piano roll visualization
16 note-hotspots bar-level churn leaderboard
17 velocity-profile dynamic range and velocity histogram
18 transpose transpose all notes by N semitones (agent command)
19 mix combine two MIDI tracks into one (agent command)
20
21 Code-domain semantic commands — Phase 1 (impossible in Git)::
22
23 symbols list every semantic symbol in a snapshot
24 symbol-log track a single symbol through commit history
25 detect-refactor report semantic refactoring operations across commits
26
27 Code-domain semantic commands — Phase 2 (paradigm shift)::
28
29 grep search the symbol graph by name / kind / language
30 blame show which commit last touched a specific symbol
31 hotspots symbol churn leaderboard — which functions change most
32 stable symbol stability leaderboard — your bedrock
33 coupling file co-change analysis — hidden dependencies
34 compare semantic comparison between any two historical snapshots
35 languages language and symbol-type breakdown
36 patch surgical semantic patch — modify exactly one symbol (all-language validation)
37 query symbol graph predicate DSL — SQL for your codebase (--all-commits mode)
38
39 Code-domain semantic commands — Phase 3 (gap-closers)::
40
41 deps import graph + Python call-graph with --reverse
42 find-symbol cross-commit, cross-branch content_id / name search
43
44 Code-domain semantic commands — Phase 4 (call-graph tier)::
45
46 impact transitive blast-radius — what breaks if this function changes?
47 dead dead code detection — symbols with no callers and no importers
48 coverage class interface call-coverage — which methods are actually used?
49 """
50 from __future__ import annotations
51
52 import typer
53
54 from muse.cli.commands import (
55 attributes,
56 blame,
57 branch,
58 cherry_pick,
59 checkout,
60 commit,
61 compare,
62 coupling,
63 coverage,
64 dead,
65 deps,
66 detect_refactor,
67 diff,
68 domains,
69 find_symbol,
70 grep,
71 harmony,
72 hotspots,
73 impact,
74 init,
75 languages,
76 log,
77 merge,
78 mix,
79 note_blame,
80 note_hotspots,
81 note_log,
82 notes,
83 patch,
84 piano_roll,
85 query,
86 reset,
87 revert,
88 show,
89 stable,
90 stash,
91 status,
92 symbol_log,
93 symbols,
94 tag,
95 transpose,
96 velocity_profile,
97 )
98
99 cli = typer.Typer(
100 name="muse",
101 help="Muse — domain-agnostic version control for multidimensional state.",
102 no_args_is_help=True,
103 )
104
105 # Core VCS
106 cli.add_typer(attributes.app, name="attributes", help="Display .museattributes merge-strategy rules.")
107 cli.add_typer(init.app, name="init", help="Initialise a new Muse repository.")
108 cli.add_typer(commit.app, name="commit", help="Record the current working tree as a new version.")
109 cli.add_typer(status.app, name="status", help="Show working-tree drift against HEAD.")
110 cli.add_typer(log.app, name="log", help="Display commit history.")
111 cli.add_typer(diff.app, name="diff", help="Compare working tree against HEAD, or two commits.")
112 cli.add_typer(show.app, name="show", help="Inspect a commit: metadata, diff, files.")
113 cli.add_typer(branch.app, name="branch", help="List, create, or delete branches.")
114 cli.add_typer(checkout.app, name="checkout", help="Switch branches or restore working tree from a commit.")
115 cli.add_typer(merge.app, name="merge", help="Three-way merge a branch into the current branch.")
116 cli.add_typer(reset.app, name="reset", help="Move HEAD to a prior commit.")
117 cli.add_typer(revert.app, name="revert", help="Create a new commit that undoes a prior commit.")
118 cli.add_typer(cherry_pick.app, name="cherry-pick", help="Apply a specific commit's changes on top of HEAD.")
119 cli.add_typer(stash.app, name="stash", help="Shelve and restore uncommitted changes.")
120 cli.add_typer(tag.app, name="tag", help="Attach and query semantic tags on commits.")
121 cli.add_typer(domains.app, name="domains", help="Domain plugin dashboard — list capabilities and scaffold new domains.")
122
123 # Music-domain commands
124 cli.add_typer(notes.app, name="notes", help="[music] List every note in a MIDI track as musical notation.")
125 cli.add_typer(note_log.app, name="note-log", help="[music] Note-level commit history — which notes were added or removed in each commit.")
126 cli.add_typer(note_blame.app, name="note-blame", help="[music] Per-bar attribution — which commit introduced the notes in this bar?")
127 cli.add_typer(harmony.app, name="harmony", help="[music] Chord analysis and key detection from MIDI note content.")
128 cli.add_typer(piano_roll.app, name="piano-roll", help="[music] ASCII piano roll visualization of a MIDI track.")
129 cli.add_typer(note_hotspots.app, name="note-hotspots", help="[music] Bar-level churn leaderboard — which bars change most across commits.")
130 cli.add_typer(velocity_profile.app, name="velocity-profile", help="[music] Dynamic range and velocity histogram for a MIDI track.")
131 cli.add_typer(transpose.app, name="transpose", help="[music] Transpose all notes in a MIDI track by N semitones.")
132 cli.add_typer(mix.app, name="mix", help="[music] Combine notes from two MIDI tracks into a single output track.")
133
134 # Code-domain commands
135 cli.add_typer(symbols.app, name="symbols", help="[code] List every semantic symbol (function, class, method…) in a snapshot.")
136 cli.add_typer(symbol_log.app, name="symbol-log", help="[code] Track a single symbol through the full commit history.")
137 cli.add_typer(detect_refactor.app, name="detect-refactor", help="[code] Detect semantic refactoring operations (renames, moves, extractions) across commits.")
138 cli.add_typer(grep.app, name="grep", help="[code] Search the symbol graph by name, kind, or language — not file text.")
139 cli.add_typer(blame.app, name="blame", help="[code] Show which commit last touched a specific symbol (function, class, method).")
140 cli.add_typer(hotspots.app, name="hotspots", help="[code] Symbol churn leaderboard — which functions change most often.")
141 cli.add_typer(stable.app, name="stable", help="[code] Symbol stability leaderboard — the bedrock of your codebase.")
142 cli.add_typer(coupling.app, name="coupling", help="[code] File co-change analysis — discover hidden semantic dependencies.")
143 cli.add_typer(compare.app, name="compare", help="[code] Deep semantic comparison between any two historical snapshots.")
144 cli.add_typer(languages.app, name="languages", help="[code] Language and symbol-type breakdown of a snapshot.")
145 cli.add_typer(patch.app, name="patch", help="[code] Surgical semantic patch — modify exactly one named symbol (all-language syntax validation).")
146 cli.add_typer(query.app, name="query", help="[code] Symbol graph predicate DSL — SQL for your codebase (--all-commits for temporal search).")
147 cli.add_typer(deps.app, name="deps", help="[code] Import graph + Python call-graph; --reverse for callers/importers.")
148 cli.add_typer(find_symbol.app, name="find-symbol", help="[code] Cross-commit, cross-branch symbol search by hash, name, or kind.")
149 cli.add_typer(impact.app, name="impact", help="[code] Transitive blast-radius — every caller affected if this symbol changes.")
150 cli.add_typer(dead.app, name="dead", help="[code] Dead code candidates — symbols with no callers and no importers.")
151 cli.add_typer(coverage.app, name="coverage", help="[code] Class interface call-coverage — which methods are actually called?")
152
153
154 if __name__ == "__main__":
155 cli()