feat(mkrep): add directory + git-repo scaffolding command #142

Merged
rootiest merged 1 commits from feat/mkrep-command into main 2026-09-10 01:01:38 +00:00
Owner

Summary

Adds mkrep, extending mkcd's create-and-cd behavior with git repo init and optional remote handling, in its own file per the one-function-per-file convention.

  • Creates the target directory (parents included), cds into it, and runs git init — all three on by default, each with a --no-* flag to skip it and a same-named flag to force it back on (--no- wins if both are given).
  • --clean removes an existing target directory first; --strict refuses to proceed if it already exists. The two compose: --clean runs first, so --clean --strict together is not a contradiction.
  • --template <path> / --branch <name> pass straight through to git init --template= / -b (no custom logic — git already does this).
  • --remote <url> links an already-existing remote (git remote add origin <url>).
  • --new-remote[=<cmd>] creates a remote first by running a shell command template in the new repo directory (falls back to $MKREP_REMOTE_CMD with no value given). {name} and {user} are substituted in the template, so the actual host logic (gh/tea/glab, auth, visibility) stays entirely in the user's own configured command rather than being reimplemented here. Starter templates for GitHub/GitLab/Gitea are in the function's doc header.
  • -v/--verbose, -s/--silent (silent wins), and -h/--help.

Two small private helpers (_mkrep_say, _mkrep_verbose) factor out the silent/verbose output-suppression logic shared across every step.

Testing

  • python3 docs/verify-manual.py: 76/76 passed
  • fish tests/run-tests.fish: 453/453 assertions passed (229/229 files lint clean), including 36 new tests/test-mkrep.fish assertions covering the flag matrix — defaults, each --no-* override, --clean/--strict composition, negative-flag precedence, silent mode, remote linking, remote creation via command template (including the env-var fallback), and --help.

No README changes needed — function docs are owned by the doc-header SSOT (docs/manual/), not README's function listing.

## Summary Adds `mkrep`, extending `mkcd`'s create-and-cd behavior with git repo init and optional remote handling, in its own file per the one-function-per-file convention. - Creates the target directory (parents included), cds into it, and runs `git init` — all three on by default, each with a `--no-*` flag to skip it and a same-named flag to force it back on (`--no-` wins if both are given). - `--clean` removes an existing target directory first; `--strict` refuses to proceed if it already exists. The two compose: `--clean` runs first, so `--clean --strict` together is not a contradiction. - `--template <path>` / `--branch <name>` pass straight through to `git init --template=` / `-b` (no custom logic — git already does this). - `--remote <url>` links an already-existing remote (`git remote add origin <url>`). - `--new-remote[=<cmd>]` creates a remote first by running a shell command template in the new repo directory (falls back to `$MKREP_REMOTE_CMD` with no value given). `{name}` and `{user}` are substituted in the template, so the actual host logic (gh/tea/glab, auth, visibility) stays entirely in the user's own configured command rather than being reimplemented here. Starter templates for GitHub/GitLab/Gitea are in the function's doc header. - `-v`/`--verbose`, `-s`/`--silent` (silent wins), and `-h`/`--help`. Two small private helpers (`_mkrep_say`, `_mkrep_verbose`) factor out the silent/verbose output-suppression logic shared across every step. ## Testing - `python3 docs/verify-manual.py`: 76/76 passed - `fish tests/run-tests.fish`: 453/453 assertions passed (229/229 files lint clean), including 36 new `tests/test-mkrep.fish` assertions covering the flag matrix — defaults, each `--no-*` override, `--clean`/`--strict` composition, negative-flag precedence, silent mode, remote linking, remote creation via command template (including the env-var fallback), and `--help`. No README changes needed — function docs are owned by the doc-header SSOT (`docs/manual/`), not README's function listing.
rootiest added the Kind/FeatureArea/Functions labels 2026-09-10 00:40:32 +00:00
rootiest added 1 commit 2026-09-10 00:40:33 +00:00
mkcd's create-and-cd behavior plus git init, remote linking, and
optional remote creation via a user-configured command template
($MKREP_REMOTE_CMD, {name}/{user} placeholders).
rootiest merged commit d93cb286ef into main 2026-09-10 01:01:38 +00:00
rootiest deleted branch feat/mkrep-command 2026-09-10 01:01:39 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rootiest/fish-config#142