@empline/preflight 1.1.48 → 1.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/bin/init.d.ts +18 -0
  2. package/dist/bin/init.d.ts.map +1 -0
  3. package/dist/bin/init.js +369 -0
  4. package/dist/bin/init.js.map +1 -0
  5. package/dist/bin/preflight.js +201 -0
  6. package/dist/bin/preflight.js.map +1 -1
  7. package/dist/bin/preinstall.js +7 -0
  8. package/dist/bin/preinstall.js.map +1 -1
  9. package/dist/checks/react/vercel-react-best-practices.d.ts +38 -0
  10. package/dist/checks/react/vercel-react-best-practices.d.ts.map +1 -0
  11. package/dist/checks/react/vercel-react-best-practices.js +547 -0
  12. package/dist/checks/react/vercel-react-best-practices.js.map +1 -0
  13. package/dist/checks/system/preflight-actionable-output.d.ts +18 -0
  14. package/dist/checks/system/preflight-actionable-output.d.ts.map +1 -0
  15. package/dist/checks/system/preflight-actionable-output.js +216 -0
  16. package/dist/checks/system/preflight-actionable-output.js.map +1 -0
  17. package/dist/checks/ui/web-design-guidelines.d.ts +37 -0
  18. package/dist/checks/ui/web-design-guidelines.d.ts.map +1 -0
  19. package/dist/checks/ui/web-design-guidelines.js +545 -0
  20. package/dist/checks/ui/web-design-guidelines.js.map +1 -0
  21. package/dist/lib/activation.d.ts +18 -0
  22. package/dist/lib/activation.d.ts.map +1 -0
  23. package/dist/lib/activation.js +283 -0
  24. package/dist/lib/activation.js.map +1 -0
  25. package/dist/lib/ai-commands.d.ts +72 -0
  26. package/dist/lib/ai-commands.d.ts.map +1 -0
  27. package/dist/lib/ai-commands.js +393 -0
  28. package/dist/lib/ai-commands.js.map +1 -0
  29. package/dist/runner.d.ts +18 -0
  30. package/dist/runner.d.ts.map +1 -1
  31. package/dist/runner.js +66 -8
  32. package/dist/runner.js.map +1 -1
  33. package/dist/utils/console-chars.d.ts +6 -6
  34. package/package.json +2 -1
  35. package/templates/domain-specific/trading-card-system/missing-page-layout.ts +377 -0
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Preflight Init Command
4
+ *
5
+ * Interactive setup for @empline/preflight that prompts users about their stack.
6
+ *
7
+ * Usage:
8
+ * npx preflight init
9
+ * npx preflight-init
10
+ *
11
+ * This command:
12
+ * - Prompts for CSS framework (recommends Tailwind)
13
+ * - Prompts for hosting platform
14
+ * - Installs additional dependencies based on selection
15
+ * - Creates preflight.config.json with project configuration
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/bin/init.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;GAcG"}
@@ -0,0 +1,369 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * Preflight Init Command
5
+ *
6
+ * Interactive setup for @empline/preflight that prompts users about their stack.
7
+ *
8
+ * Usage:
9
+ * npx preflight init
10
+ * npx preflight-init
11
+ *
12
+ * This command:
13
+ * - Prompts for CSS framework (recommends Tailwind)
14
+ * - Prompts for hosting platform
15
+ * - Installs additional dependencies based on selection
16
+ * - Creates preflight.config.json with project configuration
17
+ */
18
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
25
+ }) : (function(o, m, k, k2) {
26
+ if (k2 === undefined) k2 = k;
27
+ o[k2] = m[k];
28
+ }));
29
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
30
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
31
+ }) : function(o, v) {
32
+ o["default"] = v;
33
+ });
34
+ var __importStar = (this && this.__importStar) || (function () {
35
+ var ownKeys = function(o) {
36
+ ownKeys = Object.getOwnPropertyNames || function (o) {
37
+ var ar = [];
38
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
39
+ return ar;
40
+ };
41
+ return ownKeys(o);
42
+ };
43
+ return function (mod) {
44
+ if (mod && mod.__esModule) return mod;
45
+ var result = {};
46
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
47
+ __setModuleDefault(result, mod);
48
+ return result;
49
+ };
50
+ })();
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ const fs = __importStar(require("node:fs"));
53
+ const path = __importStar(require("node:path"));
54
+ const readline = __importStar(require("node:readline"));
55
+ const node_child_process_1 = require("node:child_process");
56
+ // =============================================================================
57
+ // CONSTANTS
58
+ // =============================================================================
59
+ const CONFIG_FILENAME = "preflight.config.json";
60
+ // ANSI colors
61
+ const c = {
62
+ red: "\x1b[31m",
63
+ yellow: "\x1b[33m",
64
+ green: "\x1b[32m",
65
+ cyan: "\x1b[36m",
66
+ blue: "\x1b[34m",
67
+ magenta: "\x1b[35m",
68
+ gray: "\x1b[90m",
69
+ reset: "\x1b[0m",
70
+ bold: "\x1b[1m",
71
+ dim: "\x1b[2m",
72
+ };
73
+ // =============================================================================
74
+ // PROMPTING UTILITIES
75
+ // =============================================================================
76
+ function createPrompt() {
77
+ return readline.createInterface({
78
+ input: process.stdin,
79
+ output: process.stdout,
80
+ });
81
+ }
82
+ async function askQuestion(rl, question) {
83
+ return new Promise((resolve) => {
84
+ rl.question(question, (answer) => {
85
+ resolve(answer.trim());
86
+ });
87
+ });
88
+ }
89
+ async function selectOption(rl, question, options) {
90
+ console.log(`\n${c.cyan}${c.bold}${question}${c.reset}\n`);
91
+ options.forEach((opt, i) => {
92
+ const num = `${i + 1}`;
93
+ const recommended = opt.recommended ? ` ${c.green}(Recommended)${c.reset}` : "";
94
+ const warning = opt.warning ? ` ${c.yellow}${opt.warning}${c.reset}` : "";
95
+ console.log(` ${c.bold}${num}.${c.reset} ${opt.label}${recommended}${warning}`);
96
+ });
97
+ console.log();
98
+ while (true) {
99
+ const answer = await askQuestion(rl, `${c.gray}Enter number (1-${options.length}):${c.reset} `);
100
+ const num = parseInt(answer, 10);
101
+ if (num >= 1 && num <= options.length) {
102
+ const selected = options[num - 1];
103
+ // Show warning if MUI is selected
104
+ if (selected.value === "mui") {
105
+ console.log(`\n${c.yellow}${c.bold}Warning:${c.reset} ${c.yellow}MUI adds significant bundle size and complexity.${c.reset}`);
106
+ console.log(`${c.yellow}Consider migrating to Tailwind CSS for better performance and developer experience.${c.reset}`);
107
+ console.log(`${c.gray}See: https://tailwindcss.com/docs/installation${c.reset}\n`);
108
+ const confirm = await askQuestion(rl, `${c.yellow}Continue with MUI? (y/N):${c.reset} `);
109
+ if (confirm.toLowerCase() !== "y") {
110
+ continue;
111
+ }
112
+ }
113
+ return selected.value;
114
+ }
115
+ console.log(`${c.red}Invalid selection. Please enter a number between 1 and ${options.length}.${c.reset}`);
116
+ }
117
+ }
118
+ // =============================================================================
119
+ // PACKAGE MANAGER DETECTION
120
+ // =============================================================================
121
+ function detectPackageManager() {
122
+ const cwd = process.cwd();
123
+ if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml")))
124
+ return "pnpm";
125
+ if (fs.existsSync(path.join(cwd, "bun.lockb")))
126
+ return "bun";
127
+ if (fs.existsSync(path.join(cwd, "yarn.lock")))
128
+ return "yarn";
129
+ if (fs.existsSync(path.join(cwd, "package-lock.json")))
130
+ return "npm";
131
+ // Check for global availability
132
+ try {
133
+ (0, node_child_process_1.execSync)("pnpm --version", { stdio: "ignore" });
134
+ return "pnpm";
135
+ }
136
+ catch {
137
+ return "npm";
138
+ }
139
+ }
140
+ // =============================================================================
141
+ // DEPENDENCY INSTALLATION
142
+ // =============================================================================
143
+ async function installDependency(packageManager, packageName, dev = true) {
144
+ console.log(`${c.cyan}Installing ${packageName}...${c.reset}`);
145
+ const installCmd = {
146
+ pnpm: dev ? `pnpm add -D ${packageName}` : `pnpm add ${packageName}`,
147
+ npm: dev ? `npm install -D ${packageName}` : `npm install ${packageName}`,
148
+ yarn: dev ? `yarn add -D ${packageName}` : `yarn add ${packageName}`,
149
+ bun: dev ? `bun add -d ${packageName}` : `bun add ${packageName}`,
150
+ }[packageManager] || `npm install -D ${packageName}`;
151
+ return new Promise((resolve) => {
152
+ const child = (0, node_child_process_1.spawn)(installCmd, {
153
+ shell: true,
154
+ stdio: "inherit",
155
+ cwd: process.cwd(),
156
+ });
157
+ child.on("close", (code) => {
158
+ if (code === 0) {
159
+ console.log(`${c.green}Installed ${packageName}${c.reset}`);
160
+ resolve(true);
161
+ }
162
+ else {
163
+ console.log(`${c.yellow}Failed to install ${packageName} (code ${code})${c.reset}`);
164
+ resolve(false);
165
+ }
166
+ });
167
+ child.on("error", (err) => {
168
+ console.log(`${c.yellow}Failed to install ${packageName}: ${err.message}${c.reset}`);
169
+ resolve(false);
170
+ });
171
+ });
172
+ }
173
+ async function installAgentSkills_exec() {
174
+ console.log(`${c.cyan}Installing vercel-labs/agent-skills...${c.reset}`);
175
+ console.log(`${c.gray}This installs React best practices and web design guidelines for AI agents.${c.reset}`);
176
+ return new Promise((resolve) => {
177
+ const child = (0, node_child_process_1.spawn)("npx add-skill vercel-labs/agent-skills --all", {
178
+ shell: true,
179
+ stdio: "inherit",
180
+ cwd: process.cwd(),
181
+ });
182
+ child.on("close", (code) => {
183
+ if (code === 0) {
184
+ console.log(`${c.green}Installed vercel-labs/agent-skills${c.reset}`);
185
+ resolve(true);
186
+ }
187
+ else {
188
+ console.log(`${c.yellow}Failed to install agent-skills (code ${code})${c.reset}`);
189
+ console.log(`${c.gray}You can manually install later with: npx add-skill vercel-labs/agent-skills --all${c.reset}`);
190
+ resolve(false);
191
+ }
192
+ });
193
+ child.on("error", (err) => {
194
+ console.log(`${c.yellow}Failed to install agent-skills: ${err.message}${c.reset}`);
195
+ console.log(`${c.gray}You can manually install later with: npx add-skill vercel-labs/agent-skills --all${c.reset}`);
196
+ resolve(false);
197
+ });
198
+ });
199
+ }
200
+ // =============================================================================
201
+ // CONFIG FILE MANAGEMENT
202
+ // =============================================================================
203
+ function loadExistingConfig() {
204
+ const configPath = path.join(process.cwd(), CONFIG_FILENAME);
205
+ if (!fs.existsSync(configPath))
206
+ return null;
207
+ try {
208
+ return JSON.parse(fs.readFileSync(configPath, "utf-8"));
209
+ }
210
+ catch {
211
+ return null;
212
+ }
213
+ }
214
+ function saveConfig(config) {
215
+ const configPath = path.join(process.cwd(), CONFIG_FILENAME);
216
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
217
+ console.log(`${c.green}Created ${CONFIG_FILENAME}${c.reset}`);
218
+ }
219
+ // =============================================================================
220
+ // MAIN
221
+ // =============================================================================
222
+ async function main() {
223
+ console.log();
224
+ console.log(`${c.blue}${c.bold}${"=".repeat(60)}${c.reset}`);
225
+ console.log(`${c.blue}${c.bold} PREFLIGHT SETUP${c.reset}`);
226
+ console.log(`${c.blue}${c.bold}${"=".repeat(60)}${c.reset}`);
227
+ console.log();
228
+ console.log(`${c.gray}This wizard will configure @empline/preflight for your project.${c.reset}`);
229
+ console.log(`${c.gray}Your selections help us provide relevant preflights and recommendations.${c.reset}`);
230
+ // Check for existing config
231
+ const existingConfig = loadExistingConfig();
232
+ if (existingConfig) {
233
+ console.log(`\n${c.yellow}Found existing ${CONFIG_FILENAME}${c.reset}`);
234
+ console.log(`${c.gray}Current stack: ${existingConfig.stack.framework} + ${existingConfig.stack.cssFramework}${c.reset}`);
235
+ }
236
+ const rl = createPrompt();
237
+ const installedExtensions = [];
238
+ const recommendations = [];
239
+ try {
240
+ // Detect package manager
241
+ const packageManager = detectPackageManager();
242
+ console.log(`\n${c.gray}Detected package manager: ${c.cyan}${packageManager}${c.reset}`);
243
+ // ==========================================================================
244
+ // CSS Framework Selection
245
+ // ==========================================================================
246
+ const cssFramework = await selectOption(rl, "Which CSS framework are you using?", [
247
+ { value: "tailwind", label: "Tailwind CSS", recommended: true },
248
+ { value: "css-modules", label: "CSS Modules" },
249
+ { value: "styled-components", label: "Styled Components" },
250
+ { value: "chakra", label: "Chakra UI" },
251
+ { value: "mui", label: "Material UI (MUI)", warning: "- Not recommended (large bundle)" },
252
+ { value: "other", label: "Other / Custom" },
253
+ ]);
254
+ if (cssFramework === "tailwind") {
255
+ recommendations.push("Enable Tailwind-specific preflights for class consistency");
256
+ }
257
+ else if (cssFramework !== "mui") {
258
+ recommendations.push("Consider migrating to Tailwind CSS for improved performance and DX");
259
+ }
260
+ // ==========================================================================
261
+ // Framework Selection
262
+ // ==========================================================================
263
+ const framework = await selectOption(rl, "Which framework are you using?", [
264
+ { value: "nextjs", label: "Next.js", recommended: true },
265
+ { value: "remix", label: "Remix" },
266
+ { value: "astro", label: "Astro" },
267
+ { value: "vite", label: "Vite (React/Vue/Svelte)" },
268
+ { value: "cra", label: "Create React App", warning: "- Consider migrating to Vite" },
269
+ { value: "other", label: "Other" },
270
+ ]);
271
+ // ==========================================================================
272
+ // Hosting Platform Selection
273
+ // ==========================================================================
274
+ const hostingPlatform = await selectOption(rl, "Where will you deploy?", [
275
+ { value: "vercel", label: "Vercel", recommended: true },
276
+ { value: "netlify", label: "Netlify" },
277
+ { value: "cloudflare", label: "Cloudflare Pages/Workers" },
278
+ { value: "aws", label: "AWS (Amplify, Lambda, etc.)" },
279
+ { value: "railway", label: "Railway" },
280
+ { value: "self-hosted", label: "Self-hosted / Docker" },
281
+ { value: "other", label: "Other" },
282
+ ]);
283
+ // Install Vercel agent-skills if Vercel is selected
284
+ if (hostingPlatform === "vercel") {
285
+ console.log(`\n${c.cyan}${c.bold}Vercel detected!${c.reset}`);
286
+ console.log(`${c.gray}Vercel agent-skills provides React/Next.js best practices and web design guidelines for AI agents.${c.reset}`);
287
+ const installAgentSkills = await askQuestion(rl, `\n${c.cyan}Install vercel-labs/agent-skills? (Y/n):${c.reset} `);
288
+ if (installAgentSkills.toLowerCase() !== "n") {
289
+ const installed = await installAgentSkills_exec();
290
+ if (installed) {
291
+ installedExtensions.push("vercel-labs/agent-skills (vercel-react-best-practices, web-design-guidelines)");
292
+ recommendations.push("Agent skills installed - AI agents now have access to React/Next.js best practices");
293
+ }
294
+ }
295
+ }
296
+ // ==========================================================================
297
+ // Database Selection
298
+ // ==========================================================================
299
+ const database = await selectOption(rl, "Which database are you using?", [
300
+ { value: "postgresql", label: "PostgreSQL", recommended: true },
301
+ { value: "supabase", label: "Supabase" },
302
+ { value: "planetscale", label: "PlanetScale" },
303
+ { value: "mysql", label: "MySQL" },
304
+ { value: "mongodb", label: "MongoDB" },
305
+ { value: "sqlite", label: "SQLite" },
306
+ { value: "none", label: "None / Not yet decided" },
307
+ { value: "other", label: "Other" },
308
+ ]);
309
+ // ==========================================================================
310
+ // Create Configuration
311
+ // ==========================================================================
312
+ const config = {
313
+ version: 1,
314
+ initialized: new Date().toISOString(),
315
+ stack: {
316
+ cssFramework,
317
+ hostingPlatform,
318
+ database,
319
+ framework,
320
+ packageManager,
321
+ },
322
+ recommendations,
323
+ installedExtensions,
324
+ };
325
+ saveConfig(config);
326
+ // ==========================================================================
327
+ // Summary
328
+ // ==========================================================================
329
+ console.log();
330
+ console.log(`${c.green}${c.bold}${"=".repeat(60)}${c.reset}`);
331
+ console.log(`${c.green}${c.bold} SETUP COMPLETE${c.reset}`);
332
+ console.log(`${c.green}${c.bold}${"=".repeat(60)}${c.reset}`);
333
+ console.log();
334
+ console.log(`${c.cyan}Your stack:${c.reset}`);
335
+ console.log(` Framework: ${c.bold}${framework}${c.reset}`);
336
+ console.log(` CSS: ${c.bold}${cssFramework}${c.reset}`);
337
+ console.log(` Hosting: ${c.bold}${hostingPlatform}${c.reset}`);
338
+ console.log(` Database: ${c.bold}${database}${c.reset}`);
339
+ console.log(` Pkg Manager: ${c.bold}${packageManager}${c.reset}`);
340
+ if (installedExtensions.length > 0) {
341
+ console.log();
342
+ console.log(`${c.cyan}Installed extensions:${c.reset}`);
343
+ installedExtensions.forEach((ext) => {
344
+ console.log(` ${c.green}+${c.reset} ${ext}`);
345
+ });
346
+ }
347
+ if (recommendations.length > 0) {
348
+ console.log();
349
+ console.log(`${c.cyan}Recommendations:${c.reset}`);
350
+ recommendations.forEach((rec) => {
351
+ console.log(` ${c.yellow}*${c.reset} ${rec}`);
352
+ });
353
+ }
354
+ console.log();
355
+ console.log(`${c.cyan}Next steps:${c.reset}`);
356
+ console.log(` 1. Run preflights: ${c.bold}npx preflight${c.reset}`);
357
+ console.log(` 2. View available checks: ${c.bold}npx preflight list-checks${c.reset}`);
358
+ console.log(` 3. Add to CI: ${c.bold}npx preflight --ci${c.reset}`);
359
+ console.log();
360
+ }
361
+ finally {
362
+ rl.close();
363
+ }
364
+ }
365
+ main().catch((error) => {
366
+ console.error(`${c.red}Setup failed:${c.reset}`, error.message);
367
+ process.exit(1);
368
+ });
369
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/bin/init.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4CAA8B;AAC9B,gDAAkC;AAClC,wDAA0C;AAC1C,2DAAqD;AAErD,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEhD,cAAc;AACd,MAAM,CAAC,GAAG;IACR,GAAG,EAAE,UAAU;IACf,MAAM,EAAE,UAAU;IAClB,KAAK,EAAE,UAAU;IACjB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;CACf,CAAC;AAsBF,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAEhF,SAAS,YAAY;IACnB,OAAO,Q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CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -57,6 +57,8 @@ const path = __importStar(require("node:path"));
57
57
  const crypto = __importStar(require("node:crypto"));
58
58
  const glob_1 = require("glob");
59
59
  const runner_1 = require("../runner");
60
+ const activation_1 = require("../lib/activation");
61
+ const ai_commands_1 = require("../lib/ai-commands");
60
62
  const args = process.argv.slice(2);
61
63
  const command = args[0];
62
64
  // ANSI colors
@@ -121,8 +123,15 @@ async function checkDrift() {
121
123
  }
122
124
  }
123
125
  async function run() {
126
+ // Check activation before any operation
127
+ await (0, activation_1.checkActivation)();
124
128
  // Handle subcommands
125
129
  switch (command) {
130
+ case "init": {
131
+ // Dynamic import to avoid loading init dependencies unless needed
132
+ await Promise.resolve().then(() => __importStar(require("./init")));
133
+ break;
134
+ }
126
135
  case "submit": {
127
136
  const { submit } = await Promise.resolve().then(() => __importStar(require("./submit")));
128
137
  const options = {
@@ -175,8 +184,200 @@ async function run() {
175
184
  await approve(options);
176
185
  break;
177
186
  }
187
+ // =========================================================================
188
+ // AI-FRIENDLY COMMANDS
189
+ // =========================================================================
190
+ case "list-categories":
191
+ case "categories": {
192
+ const jsonOutput = args.includes("--json") || args.includes("--ai");
193
+ const checksRoot = path.dirname(__dirname);
194
+ const appRoot = process.cwd();
195
+ const checks = await (0, ai_commands_1.discoverAllChecks)(checksRoot, appRoot);
196
+ const categories = (0, ai_commands_1.groupByCategory)(checks);
197
+ if (jsonOutput) {
198
+ console.log(JSON.stringify((0, ai_commands_1.formatCategoryListAI)(categories), null, 2));
199
+ }
200
+ else {
201
+ console.log((0, ai_commands_1.formatCategoryListHuman)(categories));
202
+ }
203
+ break;
204
+ }
205
+ case "list-checks":
206
+ case "checks": {
207
+ const jsonOutput = args.includes("--json") || args.includes("--ai");
208
+ const categoryFilter = args.find((a) => a.startsWith("--category="))?.split("=")[1];
209
+ const checksRoot = path.dirname(__dirname);
210
+ const appRoot = process.cwd();
211
+ let checks = await (0, ai_commands_1.discoverAllChecks)(checksRoot, appRoot);
212
+ if (categoryFilter) {
213
+ checks = checks.filter(c => c.category.toLowerCase() === categoryFilter.toLowerCase());
214
+ }
215
+ if (jsonOutput) {
216
+ console.log(JSON.stringify((0, ai_commands_1.formatCheckListAI)(checks), null, 2));
217
+ }
218
+ else {
219
+ console.log((0, ai_commands_1.formatCheckListHuman)(checks));
220
+ }
221
+ break;
222
+ }
223
+ case "explain": {
224
+ const checkName = args.slice(1).filter(a => !a.startsWith("-")).join(" ");
225
+ if (!checkName) {
226
+ console.log("Usage: preflight explain <check-name>");
227
+ console.log("Example: preflight explain 'Cart Quantity Validation'");
228
+ process.exit(1);
229
+ }
230
+ const jsonOutput = args.includes("--json") || args.includes("--ai");
231
+ const checksRoot = path.dirname(__dirname);
232
+ const appRoot = process.cwd();
233
+ const checks = await (0, ai_commands_1.discoverAllChecks)(checksRoot, appRoot);
234
+ const check = (0, ai_commands_1.findCheck)(checks, checkName);
235
+ if (!check) {
236
+ console.error(`${c.red}Check not found: "${checkName}"${c.reset}`);
237
+ console.error(`\nTry: npx preflight list-checks | grep -i "${checkName}"`);
238
+ process.exit(1);
239
+ }
240
+ if (jsonOutput) {
241
+ console.log(JSON.stringify((0, ai_commands_1.formatExplainAI)(check), null, 2));
242
+ }
243
+ else {
244
+ console.log((0, ai_commands_1.formatExplainHuman)(check));
245
+ }
246
+ break;
247
+ }
178
248
  default: {
249
+ // Handle --list-categories, --list-checks, --check, --explain as flags
250
+ const listCategories = args.includes("--list-categories");
251
+ const listChecks = args.includes("--list-checks");
252
+ const checkArg = args.find((a) => a.startsWith("--check="))?.split("=")[1] ||
253
+ (args.includes("--check") ? args[args.indexOf("--check") + 1] : undefined);
254
+ const recheckArg = args.find((a) => a.startsWith("--recheck="))?.split("=")[1] ||
255
+ (args.includes("--recheck") ? args[args.indexOf("--recheck") + 1] : undefined);
256
+ const explainArg = args.find((a) => a.startsWith("--explain="))?.split("=")[1] ||
257
+ (args.includes("--explain") ? args[args.indexOf("--explain") + 1] : undefined);
258
+ const jsonOutput = args.includes("--json") || args.includes("--ai");
259
+ const checksRoot = path.dirname(__dirname);
260
+ const appRoot = process.cwd();
261
+ // Handle --list-categories flag
262
+ if (listCategories) {
263
+ const checks = await (0, ai_commands_1.discoverAllChecks)(checksRoot, appRoot);
264
+ const categories = (0, ai_commands_1.groupByCategory)(checks);
265
+ if (jsonOutput) {
266
+ console.log(JSON.stringify((0, ai_commands_1.formatCategoryListAI)(categories), null, 2));
267
+ }
268
+ else {
269
+ console.log((0, ai_commands_1.formatCategoryListHuman)(categories));
270
+ }
271
+ break;
272
+ }
273
+ // Handle --list-checks flag
274
+ if (listChecks) {
275
+ const categoryFilter = args.find((a) => a.startsWith("--category="))?.split("=")[1];
276
+ let checks = await (0, ai_commands_1.discoverAllChecks)(checksRoot, appRoot);
277
+ if (categoryFilter) {
278
+ checks = checks.filter(c => c.category.toLowerCase() === categoryFilter.toLowerCase());
279
+ }
280
+ if (jsonOutput) {
281
+ console.log(JSON.stringify((0, ai_commands_1.formatCheckListAI)(checks), null, 2));
282
+ }
283
+ else {
284
+ console.log((0, ai_commands_1.formatCheckListHuman)(checks));
285
+ }
286
+ break;
287
+ }
288
+ // Handle --explain flag
289
+ if (explainArg) {
290
+ const checks = await (0, ai_commands_1.discoverAllChecks)(checksRoot, appRoot);
291
+ const check = (0, ai_commands_1.findCheck)(checks, explainArg);
292
+ if (!check) {
293
+ console.error(`${c.red}Check not found: "${explainArg}"${c.reset}`);
294
+ process.exit(1);
295
+ }
296
+ if (jsonOutput) {
297
+ console.log(JSON.stringify((0, ai_commands_1.formatExplainAI)(check), null, 2));
298
+ }
299
+ else {
300
+ console.log((0, ai_commands_1.formatExplainHuman)(check));
301
+ }
302
+ break;
303
+ }
304
+ // Handle --check or --recheck flag (run single check)
305
+ const singleCheckName = checkArg || recheckArg;
306
+ if (singleCheckName) {
307
+ const checks = await (0, ai_commands_1.discoverAllChecks)(checksRoot, appRoot);
308
+ const check = (0, ai_commands_1.findCheck)(checks, singleCheckName);
309
+ if (!check) {
310
+ console.error(`${c.red}Check not found: "${singleCheckName}"${c.reset}`);
311
+ console.error(`\nAvailable checks matching "${singleCheckName}":`);
312
+ const matches = checks.filter(c => c.name.toLowerCase().includes(singleCheckName.toLowerCase()) ||
313
+ c.id.toLowerCase().includes(singleCheckName.toLowerCase())).slice(0, 5);
314
+ for (const m of matches) {
315
+ console.error(` - ${m.name} (${m.category})`);
316
+ }
317
+ process.exit(1);
318
+ }
319
+ console.log(`\n${c.cyan}Running single check: ${check.name}${c.reset}`);
320
+ console.log(`Category: ${check.category} | Blocking: ${check.blocking ? "Yes" : "No"}`);
321
+ console.log("─".repeat(60));
322
+ const result = await (0, runner_1.runSingleCheck)(check.filePath, check.name, check.blocking);
323
+ if (jsonOutput) {
324
+ console.log(JSON.stringify(result, null, 2));
325
+ }
326
+ else {
327
+ const icon = result.passed ? "✅" : "❌";
328
+ console.log(`\n${icon} ${result.name}: ${result.passed ? "PASSED" : "FAILED"}`);
329
+ console.log(` Duration: ${result.duration.toFixed(2)}s`);
330
+ if (result.findings?.length) {
331
+ console.log(` Findings:`);
332
+ for (const f of result.findings.slice(0, 10)) {
333
+ const fIcon = f.severity === "error" ? "🔴" : f.severity === "warning" ? "🟡" : "🔵";
334
+ console.log(` ${fIcon} ${f.message}`);
335
+ if (f.file)
336
+ console.log(` File: ${f.file}${f.line ? `:${f.line}` : ""}`);
337
+ if (f.suggestion)
338
+ console.log(` Fix: ${f.suggestion}`);
339
+ }
340
+ if (result.findings.length > 10) {
341
+ console.log(` ... and ${result.findings.length - 10} more`);
342
+ }
343
+ }
344
+ }
345
+ process.exit(result.passed ? 0 : 1);
346
+ }
347
+ // Standard preflight execution continues below...
179
348
  const skipDrift = args.includes("--skip-drift") || args.includes("--no-drift");
349
+ const hasCategory = args.includes("--category") || args.some((a) => a.startsWith("--category="));
350
+ const hasJsonOutput = args.includes("--json") || args.includes("--ai");
351
+ const hasPipeWarningBypass = args.includes("--yes-run-all") || args.includes("-y");
352
+ // Check for help flag and AI commands early - these should always bypass pipe warning
353
+ const wantsHelp = args.includes("--help") || args.includes("-h");
354
+ const hasAiCommand = listCategories || listChecks || explainArg || singleCheckName;
355
+ // Detect if output is being piped (not a TTY) without category filtering
356
+ // This suggests the user might be trying to grep/filter output, which still runs ALL checks
357
+ if (!process.stdout.isTTY && !hasCategory && !hasJsonOutput && !hasPipeWarningBypass && !wantsHelp && !hasAiCommand) {
358
+ console.error("");
359
+ console.error(`${c.yellow}${c.bold}╔═══════════════════════════════════════════════════════════╗${c.reset}`);
360
+ console.error(`${c.yellow}${c.bold}║ ⚠️ PIPED OUTPUT DETECTED ║${c.reset}`);
361
+ console.error(`${c.yellow}${c.bold}╠═══════════════════════════════════════════════════════════╣${c.reset}`);
362
+ console.error(`${c.yellow}${c.bold}║${c.reset} Piping to grep/filter still runs ALL checks! ${c.yellow}${c.bold}║${c.reset}`);
363
+ console.error(`${c.yellow}${c.bold}║${c.reset} This is slow and wastes resources. ${c.yellow}${c.bold}║${c.reset}`);
364
+ console.error(`${c.yellow}${c.bold}╚═══════════════════════════════════════════════════════════╝${c.reset}`);
365
+ console.error("");
366
+ console.error(`${c.cyan}${c.bold}To run only specific categories (RECOMMENDED):${c.reset}`);
367
+ console.error(` npx preflight --category checkout --category cart`);
368
+ console.error("");
369
+ console.error(`${c.cyan}${c.bold}For AI-friendly JSON output:${c.reset}`);
370
+ console.error(` npx preflight --ai`);
371
+ console.error("");
372
+ console.error(`${c.cyan}${c.bold}Available categories:${c.reset}`);
373
+ console.error(` security, typescript, runtime, database, ui, quality,`);
374
+ console.error(` performance, testing, organization, business, auth,`);
375
+ console.error(` cart, checkout, api, architecture, code-hygiene, ...`);
376
+ console.error("");
377
+ console.error(`${c.yellow}To run all checks anyway, add ${c.cyan}--yes-run-all${c.yellow} or ${c.cyan}-y${c.reset}`);
378
+ console.error("");
379
+ process.exit(1);
380
+ }
180
381
  // Check for drift before running preflights
181
382
  const drift = await checkDrift();
182
383
  if (drift.hasDrift) {