Skip to content

MAI-58: honour --dry-run in commits-only mode (no add/commit/push)#20

Merged
vsmash merged 2 commits into
developfrom
bug/MAI-58_dryrun-commits-only
May 24, 2026
Merged

MAI-58: honour --dry-run in commits-only mode (no add/commit/push)#20
vsmash merged 2 commits into
developfrom
bug/MAI-58_dryrun-commits-only

Conversation

@vsmash
Copy link
Copy Markdown
Owner

@vsmash vsmash commented May 24, 2026

Summary

In commits-only mode (-c / -ac), --dry-run (-d) was silently ignored: it performed a REAL git add + git commit, and with -ac a REAL git push. dryRun was parsed and threaded only into version management, never into the commit phase.

Fix

  • Thread dryRun from runMaiassPipelinehandleCommitWorkflowcommitThishandleStagedCommit (lib/maiass-pipeline.js, lib/commit.js).
  • Guard every real git mutation in the commit phase (git add -A, git commit -F, git push --set-upstream) so that when dryRun is true the command is NOT executed and a clear preview line is printed instead.
  • In a forced dry run nothing is actually staged, so handleStagedCommit previews the working-tree diff (git diff HEAD --name-status) and labels it "Changes that would be committed:".
  • Commits-only completion line now reflects the dry run ("Commits-only mode dry run completed (no changes made)").
  • Preview lines use console.log(colors.BBlue(...)) to match the existing version-management dry-run UX (always visible, not filtered by brief verbosity).

Preview wording

  • Dry run - would stage all changes (git add -A)
  • Dry run - would commit with message: "<first line>"
  • Dry run - would push to origin <branch> (git push --set-upstream origin <branch>)

Verification (isolated sandbox: file:// bare origin, throwaway identity)

  • -ac --dry-run (AI off): HEAD unchanged, index empty, origin branch not created; all three previews printed.
  • -ac (no --dry-run): still really commits and pushes — happy path intact.

Tests

  • Added test/unit/commit-dryrun.test.js: builds a real temp repo with a bare origin, asserts dry-run does NOT move HEAD / stage / push, and that a normal run does commit + push.
  • npm run test:unit (60 tests) and npm test (10 e2e) both pass.

Parity note

This changes the commit-phase behaviour only on the --dry-run path; the normal commit/push flow is unchanged. Flagging for bash-cli-specialist to confirm bashmaiass honours --dry-run in commits-only mode equivalently.

Jira: https://velvary.atlassian.net/browse/MAI-58

Tyler Durton added 2 commits May 25, 2026 07:58
  - thread dryRun through runMaiassPipeline to handleCommitWorkflow, commitThis, handleStagedCommit
  - guard git add/commit/push so dry-run previews instead of mutating
  - add commit-dryrun regression test (temp repo + bare origin)
@vsmash vsmash merged commit 97b3e87 into develop May 24, 2026
8 checks passed
@vsmash vsmash deleted the bug/MAI-58_dryrun-commits-only branch May 24, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant