gabriel / muse public
feat patch init task/init-dir-arg #1 / 1
AI Agent gabriel · 161 days ago · Apr 18, 2026 · Diff

feat(init): accept optional directory argument (muse init <dir>)

Mirrors git init <dir> ergonomics. When a DIRECTORY positional argument is given, muse init resolves the path, creates it (including any missing parents) with mkdir -p semantics, chdirs into it, and runs the standard init logic there. CWD is not initialised. No-argument behaviour is unchanged.

13 new tests cover absolute paths, relative paths, dot, deeply-nested nonexistent paths, --force, --bare, --json, and a full status round-trip.

sha256:3064dd96a6fbacf69d865af404dcc6b8177abbb98cd1859c10841f44eef03f04 sha
+15 ~2 symbols
sha256:2ed5cc0e3a2b321d257eec03f0b27963bf4ce37124c2ad4f8a8ad618648d8f90 snapshot
+15
symbols added
~2
symbols modified
0
dead code introduced
Semantic Changes 17 symbols
~ muse/cli/commands/init.py .py 2 symbols modified
~ tests/test_cmd_init.py .py 15 symbols added
+ TestDirectoryArgument class class TestDirectoryArgument L1451–1561
+ test_absolute_path_creates_dir_and_inits method method test_absolute_path_creates_dir_and_inits L1454–1459
+ test_bare_flag_with_dir_arg method method test_bare_flag_with_dir_arg L1541–1546
+ test_cwd_is_not_initialised_when_dir_arg_given method method test_cwd_is_not_initialised_when_dir_arg_given L1479–1484
+ test_deeply_nested_nonexistent_path_created method method test_deeply_nested_nonexistent_path_created L1486–1490
+ test_dir_arg_human_output_shows_target_muse_dir method method test_dir_arg_human_output_shows_target_muse_dir L1521–1526
+ test_dir_arg_with_all_flags method method test_dir_arg_with_all_flags L1508–1519
+ test_dir_arg_with_json_output method method test_dir_arg_with_json_output L1500–1506
+ test_dot_is_equivalent_to_no_arg method method test_dot_is_equivalent_to_no_arg L1466–1470
+ test_existing_empty_dir_is_used method method test_existing_empty_dir_is_used L1472–1477
+ test_force_flag_with_dir_arg method method test_force_flag_with_dir_arg L1528–1539
+ test_json_path_reflects_target_dir method method test_json_path_reflects_target_dir L1492–1498
+ test_relative_path_creates_dir_and_inits method method test_relative_path_creates_dir_and_inits L1461–1464
+ test_status_works_after_dir_arg_init method method test_status_works_after_dir_arg_init L1548–1561
+ _init_from function function _init_from L1434–1448
← Older Oldest on task/init-dir-arg
All commits
Newer → Latest on task/init-dir-arg

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:3064dd96a6fbacf69d865af404dcc6b8177abbb98cd1859c10841f44eef03f04 --body "your comment"