feat (bug-fix): enhance CLI scaffolding with new options and tests#5
Conversation
|
with this 544577b; it fixes Improvement: Flags Now Properly Bypass PromptsThis PR fixes an issue where CLI flags were not respected during project scaffolding. Previously, running: grit new my-saas --triple --vitewould still prompt the user to manually select options that were already provided via flags. Previous Behavior
Updated Behavior (This PR)With this change, flags are now properly honored:
ResultThis aligns the CLI behavior with standard expectations flags now act as true shortcuts, improving overall developer experience and efficiency. |
|
Thanks for this PR @mosespace — great work on the helper functions, tests, and Good news: The core functionality ( What this PR still adds that we'd love to merge:
Could you rebase this PR on the latest git fetch origin
git rebase origin/main
# Resolve conflicts, keeping the helper function approach
git push --force-with-leaseThanks for contributing! |
53d4c4e to
544577b
Compare
544577b to
bfb5dd5
Compare
|
@MUKE-coder Please confirm if no more conflicts!. |
|
Hey @mosespace — quick rebase guide to get this PR up to date with main: # 1. Make sure you're on your PR branch
git checkout grit/cmd_features
# 2. Fetch the latest changes from origin
git fetch origin
# 3. Rebase your branch on top of the latest main
git rebase origin/mainYou'll likely get conflicts in these 2 files:
For For # 4. After resolving conflicts in each file:
git add cmd/grit/main.go internal/scaffold/scaffold.go
git rebase --continue
# 5. Verify it builds
go build ./cmd/grit/
# 6. Run tests
go test ./internal/scaffold/ -count=1
# 7. Force push (safe since it's your branch)
git push --force-with-leaseIf the rebase gets messy, you can always abort and start over: git rebase --abortLet me know if you hit any issues! |
Post-merge cleanup from PR #5: - Replaced cmd.Flags().Changed() prompt check with simpler archFlag/frontendFlag direct value checks, which are more reliable across all flag sources (PreRunE sets these from shorthand bool flags like --single, --triple, --vite) - Added missing Force bool field to Options struct (lost during merge)


This pull request adds support for scaffolding new Grit projects directly into the current directory (in-place), with safety checks and a
--forceflag to allow operation in non-empty directories. It updates the CLI, internal scaffolding logic, documentation, and adds comprehensive tests for the new behaviors.CLI and User Experience Improvements:
grit new .andgrit new ./to scaffold into the current directory, inferring the project name from the folder. Introduced--here(in-place) and--forceflags for controlling directory usage and overwriting. The CLI now automatically detects when the current directory matches the project name and scaffolds in place. [1] [2] [3] [4] [5]Scaffolding Logic Enhancements:
resolveScaffoldRootandensureTargetDirectory, handling in-place scaffolding and force-overwrite semantics. Updated both multi-app and single-app scaffolding flows to use this logic. [1] [2] [3]User Feedback:
cdstep if scaffolding was done in-place.Testing:
Documentation:
README.mdto document the new in-place scaffolding commands and usage tips. [1] [2]