Skip to content

Commit 94e96e2

Browse files
fix(cli): Update ultracite setup with hooks flag (#674)
1 parent 605b715 commit 94e96e2

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

apps/cli/src/helpers/addons/ultracite-setup.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ type UltraciteAgent =
3333
| "goose"
3434
| "roo-code";
3535

36+
type UltraciteHook = "cursor" | "claude";
37+
3638
const EDITORS = {
3739
vscode: {
3840
label: "VSCode / Cursor / Windsurf",
@@ -99,6 +101,15 @@ const AGENTS = {
99101
},
100102
} as const;
101103

104+
const HOOKS = {
105+
cursor: {
106+
label: "Cursor",
107+
},
108+
claude: {
109+
label: "Claude",
110+
},
111+
} as const;
112+
102113
function getFrameworksFromFrontend(frontend: string[]): string[] {
103114
const frameworkMap: Record<string, string> = {
104115
"tanstack-router": "react",
@@ -151,6 +162,14 @@ export async function setupUltracite(config: ProjectConfig, hasHusky: boolean) {
151162
})),
152163
required: true,
153164
}),
165+
hooks: () =>
166+
autocompleteMultiselect<UltraciteHook>({
167+
message: "Choose hooks",
168+
options: Object.entries(HOOKS).map(([key, hook]) => ({
169+
value: key as UltraciteHook,
170+
label: hook.label,
171+
})),
172+
}),
154173
},
155174
{
156175
onCancel: () => {
@@ -161,7 +180,7 @@ export async function setupUltracite(config: ProjectConfig, hasHusky: boolean) {
161180

162181
const editors = result.editors as UltraciteEditor[];
163182
const agents = result.agents as UltraciteAgent[];
164-
183+
const hooks = result.hooks as UltraciteHook[];
165184
const frameworks = getFrameworksFromFrontend(frontend);
166185

167186
const ultraciteArgs = ["init", "--pm", packageManager];
@@ -178,6 +197,10 @@ export async function setupUltracite(config: ProjectConfig, hasHusky: boolean) {
178197
ultraciteArgs.push("--agents", ...agents);
179198
}
180199

200+
if (hooks.length > 0) {
201+
ultraciteArgs.push("--hooks", ...hooks);
202+
}
203+
181204
if (hasHusky) {
182205
ultraciteArgs.push("--integrations", "husky", "lint-staged");
183206
}

0 commit comments

Comments
 (0)