-
-
Notifications
You must be signed in to change notification settings - Fork 241
feat: Add lefthook to addons #711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 19 commits
a76e423
0356aa6
9630225
25de9d6
a255b0f
2d8916f
8a2e864
74ef0e5
a38915d
6fc2f40
f5ebc14
d48afc9
2c6c649
4e53c72
6015238
8b87414
5000e14
3877c38
fb8c776
11aaae9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ import pc from "picocolors"; | |
|
|
||
| import type { ProjectConfig } from "../../types"; | ||
|
|
||
| import { addPackageDependency } from "../../utils/add-package-deps"; | ||
| import { exitCancelled } from "../../utils/errors"; | ||
| import { getPackageExecutionArgs } from "../../utils/package-runner"; | ||
| import { setupBiome } from "./addons-setup"; | ||
|
|
@@ -132,7 +131,7 @@ function getFrameworksFromFrontend(frontend: string[]): string[] { | |
| return Array.from(frameworks); | ||
| } | ||
|
|
||
| export async function setupUltracite(config: ProjectConfig, hasHusky: boolean) { | ||
| export async function setupUltracite(config: ProjectConfig, gitHooks: string[]) { | ||
| const { packageManager, projectDir, frontend } = config; | ||
|
|
||
| try { | ||
|
|
@@ -199,8 +198,11 @@ export async function setupUltracite(config: ProjectConfig, hasHusky: boolean) { | |
| ultraciteArgs.push("--hooks", ...hooks); | ||
| } | ||
|
|
||
| if (hasHusky) { | ||
| ultraciteArgs.push("--integrations", "husky", "lint-staged"); | ||
| if (gitHooks.length > 0) { | ||
| ultraciteArgs.push("--integrations", gitHooks.join(" ")); | ||
therealsamyak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (gitHooks.includes("husky")) { | ||
| ultraciteArgs.push("lint-staged"); | ||
| } | ||
| } | ||
|
Comment on lines
+201
to
206
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -name "ultracite-setup.ts" -type fRepository: AmanVarshney01/create-better-t-stack Length of output: 128 🏁 Script executed: cat -n ./apps/cli/src/helpers/addons/ultracite-setup.ts | head -220 | tail -50Repository: AmanVarshney01/create-better-t-stack Length of output: 1793 🏁 Script executed: cat -n ./apps/cli/src/helpers/addons/ultracite-setup.ts | sed -n '182,210p'Repository: AmanVarshney01/create-better-t-stack Length of output: 1126 Use spread operator for All other Ultracite CLI flags (lines 185, 189, 193, 197) use the spread operator to expand array elements as separate arguments. Line 201 should follow the same pattern: change 🤖 Prompt for AI Agents
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it didn't work when i tried that, but this worked i tested it
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @therealsamyak, thank you for testing and clarifying! I appreciate you verifying the implementation. If Ultracite's ✏️ Learnings added
🧠 Learnings used
Comment on lines
+201
to
206
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Search for Ultracite CLI documentation or comments
rg -i "ultracite|--integrations" --type ts --type tsx -B 2 -A 2 | head -100Repository: AmanVarshney01/create-better-t-stack Length of output: 107 🏁 Script executed: # Look for test files related to ultracite-setup
fd -e test -e spec | grep -i ultraciteRepository: AmanVarshney01/create-better-t-stack Length of output: 62 🏁 Script executed: # Search for any README or documentation about Ultracite CLI
fd -e md -e txt | xargs rg -l "ultracite" -i 2>/dev/nullRepository: AmanVarshney01/create-better-t-stack Length of output: 108 🏁 Script executed: # Look for ultracite package.json or dependencies
rg -r "ultracite" package.jsonRepository: AmanVarshney01/create-better-t-stack Length of output: 5094 🏁 Script executed: # Read the ultracite-setup.ts file to see the full context
cat -n apps/cli/src/helpers/addons/ultracite-setup.ts | head -250Repository: AmanVarshney01/create-better-t-stack Length of output: 6769 🏁 Script executed: # Search for other usages of --integrations in the codebase
rg "\-\-integrations" --type ts -B 3 -A 3Repository: AmanVarshney01/create-better-t-stack Length of output: 601 🏁 Script executed: # Look at the CLI README for documentation
cat -n apps/cli/README.mdRepository: AmanVarshney01/create-better-t-stack Length of output: 12774 🏁 Script executed: # Search for tests related to ultracite-setup
fd -type f -name "*.test.*" -o -name "*.spec.*" | xargs rg -l "ultracite" 2>/dev/nullRepository: AmanVarshney01/create-better-t-stack Length of output: 670 🏁 Script executed: # Search for any comments or documentation about the integrations flag
rg "integrations" --type ts -B 5 -A 5Repository: AmanVarshney01/create-better-t-stack Length of output: 871 🏁 Script executed: # Look for Ultracite documentation or example usage
fd -type f \( -name "*.md" -o -name "*.txt" \) -exec rg -l "integrations" {} \;Repository: AmanVarshney01/create-better-t-stack Length of output: 250 🏁 Script executed: # Check if there's any external documentation link or reference
rg -i "ultracite.*cli\|ultracite.*doc" --type ts -B 2 -A 2Repository: AmanVarshney01/create-better-t-stack Length of output: 62 🏁 Script executed: # Check the test file for ultracite usage patterns
cat -n apps/cli/test/addons.test.ts | grep -A 30 -B 5 ultraciteRepository: AmanVarshney01/create-better-t-stack Length of output: 1469 🏁 Script executed: # Search in the addons.ts prompts file
cat -n apps/cli/src/prompts/addons.ts | grep -A 10 -B 10 -i "git\|hook"Repository: AmanVarshney01/create-better-t-stack Length of output: 4482 🏁 Script executed: # Look at the actual command construction logic more carefully
rg "ultraciteArgs\|ultraciteInit" -B 3 -A 3Repository: AmanVarshney01/create-better-t-stack Length of output: 62 🏁 Script executed: # Search for any Ultracite CLI documentation or references in the web content
cat -n apps/web/content/docs/cli/options.mdx | head -100Repository: AmanVarshney01/create-better-t-stack Length of output: 2889 🏁 Script executed: # Look for any git hook related tests or examples
rg "git.*hook\|husky\|lefthook" apps/cli/test/ -A 5 -B 5Repository: AmanVarshney01/create-better-t-stack Length of output: 62 🏁 Script executed: # Check if there's any config or setup files that show ultracite usage
fd -name "ultracite*" -o -name "*ultracite*"Repository: AmanVarshney01/create-better-t-stack Length of output: 310 🏁 Script executed: # Search for any comments about lint-staged or integrations flag
rg "lint-staged\|integrations" apps/cli/src/helpers/addons/ -B 5 -A 5Repository: AmanVarshney01/create-better-t-stack Length of output: 62 🏁 Script executed: # Look for any Ultracite package references or documentation links
rg "ultracite" apps/cli/src/ -lRepository: AmanVarshney01/create-better-t-stack Length of output: 273 🏁 Script executed: # Check if there's any commented out code or alternative approaches
rg "integrations|lint-staged" apps/cli/ -B 2 -A 2Repository: AmanVarshney01/create-better-t-stack Length of output: 2698 🏁 Script executed: # Look for how git hooks are configured in the project
rg "husky\|lefthook" apps/cli/src/helpers/addons/ -B 3 -A 3Repository: AmanVarshney01/create-better-t-stack Length of output: 62 🏁 Script executed: # Check if there are any examples or configurations showing ultracite init usage
rg "ultracite.*init\|init.*ultracite" apps/cli/ -B 2 -A 2Repository: AmanVarshney01/create-better-t-stack Length of output: 62 🏁 Script executed: # Search for any PR or commit messages that might explain the lint-staged logic
git log --oneline --all | head -50Repository: AmanVarshney01/create-better-t-stack Length of output: 2527 🏁 Script executed: # Look for the commit that added ultracite setup
git log --oneline --all | grep -i ultraciteRepository: AmanVarshney01/create-better-t-stack Length of output: 764 🏁 Script executed: # Check the PR #711 or related commits for context
git log --oneline --all | head -100 | grep -i "ultracite\|711"Repository: AmanVarshney01/create-better-t-stack Length of output: 275 🏁 Script executed: # Search for any integration related to the actual ultracite command
rg "getPackageExecutionCommand" apps/cli/src/helpers/addons/ultracite-setup.ts -B 10 -A 10Repository: AmanVarshney01/create-better-t-stack Length of output: 1229 🏁 Script executed: # Look at what the final command string looks like
rg "ultraciteArgsString\|commandWithArgs" apps/cli/src/helpers/addons/ultracite-setup.ts -B 5 -A 5Repository: AmanVarshney01/create-better-t-stack Length of output: 62 🏁 Script executed: # Check the specific commit that mentions ultracite setup arguments
git show b2d33a8 --statRepository: AmanVarshney01/create-better-t-stack Length of output: 476 🏁 Script executed: # Look at the hooks flag fix commit
git show 94e96e2 --statRepository: AmanVarshney01/create-better-t-stack Length of output: 404 🏁 Script executed: # Let's check if there's any test that shows the expected command format
cat -n apps/cli/test/addons.test.ts | grep -A 50 -B 5 "ultracite"Repository: AmanVarshney01/create-better-t-stack Length of output: 1561 🏁 Script executed: # Check the full diff from commit 94e96e2 that added hooks flag
git show 94e96e2Repository: AmanVarshney01/create-better-t-stack Length of output: 2155 🏁 Script executed: # Also check the earlier commit b2d33a8
git show b2d33a8Repository: AmanVarshney01/create-better-t-stack Length of output: 1386 🏁 Script executed: # Let's trace how the function is called to understand gitHooks parameter
rg "setupUltracite" apps/cli/src/ -B 3 -A 3Repository: AmanVarshney01/create-better-t-stack Length of output: 1726 🏁 Script executed: # Check how gitHooks array is constructed before being passed
rg "gitHooks" apps/cli/src/helpers/ -B 2 -A 2Repository: AmanVarshney01/create-better-t-stack Length of output: 1552 lint-staged should be included in the --integrations string, not pushed as a separate argument. The current code results in 🤖 Prompt for AI Agents
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong i tested it and it worked this way
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @therealsamyak, thank you for confirming! I appreciate you testing this and verifying the behavior. If the Ultracite CLI accepts I've noted this for future reference to avoid similar confusion. ✏️ Learnings added
🧠 Learnings used |
||
|
|
||
| const ultraciteArgsString = ultraciteArgs.join(" "); | ||
|
|
@@ -212,13 +214,6 @@ export async function setupUltracite(config: ProjectConfig, hasHusky: boolean) { | |
|
|
||
| await $({ cwd: projectDir, env: { CI: "true" } })`${args}`; | ||
|
|
||
| if (hasHusky) { | ||
| await addPackageDependency({ | ||
| devDependencies: ["husky", "lint-staged"], | ||
| projectDir, | ||
| }); | ||
| } | ||
|
|
||
| s.stop("Ultracite setup successfully!"); | ||
| } catch (error) { | ||
| log.error(pc.red("Failed to set up Ultracite")); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| pre-commit: | ||
| commands: | ||
| {{#if (includes addons "biome")}} | ||
| biome-check: | ||
| run: biome check --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files} | ||
therealsamyak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| stage_fixed: true | ||
| {{else if (includes addons "oxlint")}} | ||
| oxlint-fix: | ||
| run: oxlint --fix {staged_files} | ||
therealsamyak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| stage_fixed: true | ||
| {{else}} | ||
| info: | ||
| run: echo "Go to https://lefthook.dev/ for more information on configuring hooks!" | ||
| {{/if}} | ||
Uh oh!
There was an error while loading. Please reload this page.