Skip to content

Commit 1c188b2

Browse files
fix(init): sync wizard feature metadata with supported flags (#451)
1 parent 77603fc commit 1c188b2

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

src/commands/init.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ export const initCommand = buildCommand<
185185
features: {
186186
kind: "parsed",
187187
parse: String,
188-
brief: "Features to enable: errors,tracing,logs,replay,metrics",
188+
brief:
189+
"Features to enable: errors,tracing,logs,replay,metrics,profiling,sourcemaps,crons,ai-monitoring,user-feedback",
189190
variadic: true,
190191
optional: true,
191192
},

src/lib/init/clack-utils.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ const FEATURE_INFO: Record<string, { label: string; hint: string }> = {
4848
label: "Source Maps",
4949
hint: "See original source code in production errors",
5050
},
51+
crons: {
52+
label: "Crons",
53+
hint: "Monitor scheduled and recurring jobs",
54+
},
55+
aiMonitoring: {
56+
label: "AI Monitoring",
57+
hint: "Track AI model calls, latency, and failures",
58+
},
59+
userFeedback: {
60+
label: "User Feedback",
61+
hint: "Collect in-app user feedback and reports",
62+
},
5163
};
5264

5365
export function featureLabel(id: string): string {
@@ -66,6 +78,9 @@ const FEATURE_DISPLAY_ORDER = [
6678
"metrics",
6779
"profiling",
6880
"sourceMaps",
81+
"crons",
82+
"aiMonitoring",
83+
"userFeedback",
6984
];
7085

7186
/** Sort features into canonical display order for the multi-select prompt. */

test/lib/init/clack-utils.test.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
abortIfCancelled,
1010
featureHint,
1111
featureLabel,
12+
sortFeatures,
1213
WizardCancelledError,
1314
} from "../../../src/lib/init/clack-utils.js";
1415

@@ -49,6 +50,9 @@ describe("featureLabel", () => {
4950
"Performance Monitoring (Tracing)"
5051
);
5152
expect(featureLabel("logs")).toBe("Logging");
53+
expect(featureLabel("crons")).toBe("Crons");
54+
expect(featureLabel("aiMonitoring")).toBe("AI Monitoring");
55+
expect(featureLabel("userFeedback")).toBe("User Feedback");
5256
});
5357

5458
test("returns id as passthrough for unknown feature", () => {
@@ -60,9 +64,46 @@ describe("featureHint", () => {
6064
test("returns hint for known feature", () => {
6165
expect(featureHint("errorMonitoring")).toBe("Error and crash reporting");
6266
expect(featureHint("sessionReplay")).toBe("Visual replay of user sessions");
67+
expect(featureHint("crons")).toBe("Monitor scheduled and recurring jobs");
68+
expect(featureHint("aiMonitoring")).toBe(
69+
"Track AI model calls, latency, and failures"
70+
);
71+
expect(featureHint("userFeedback")).toBe(
72+
"Collect in-app user feedback and reports"
73+
);
6374
});
6475

6576
test("returns undefined for unknown feature", () => {
6677
expect(featureHint("unknownFeature")).toBeUndefined();
6778
});
6879
});
80+
81+
describe("sortFeatures", () => {
82+
test("orders known features by canonical display order", () => {
83+
expect(
84+
sortFeatures([
85+
"userFeedback",
86+
"logs",
87+
"errorMonitoring",
88+
"sourceMaps",
89+
"crons",
90+
"aiMonitoring",
91+
])
92+
).toEqual([
93+
"errorMonitoring",
94+
"logs",
95+
"sourceMaps",
96+
"crons",
97+
"aiMonitoring",
98+
"userFeedback",
99+
]);
100+
});
101+
102+
test("keeps unknown features after known ones", () => {
103+
expect(sortFeatures(["unknown", "metrics", "another"])).toEqual([
104+
"metrics",
105+
"unknown",
106+
"another",
107+
]);
108+
});
109+
});

0 commit comments

Comments
 (0)