54c66efe9b
- Changed CLI usage instructions from `dart run cursor_gen` to `cursor_gen` for global activation. - Updated project-brief.yaml example and README to reflect new command usage. - Added app_context section in project-brief.yaml for theme variants and RBAC roles. - Fixed bundled template resolution for local and global installs to prevent 'Template not found' errors. - Version bump to 1.0.1 with corresponding updates in CHANGELOG and pubspec.yaml.
33 lines
1.1 KiB
Cheetah
33 lines
1.1 KiB
Cheetah
#!/usr/bin/env ts-node
|
|
// flutter-analyze.ts — Pre-commit hook: runs dart analyze and dart format check
|
|
import { execSync } from 'child_process';
|
|
|
|
const RED = '\x1b[31m';
|
|
const GREEN = '\x1b[32m';
|
|
const RESET = '\x1b[0m';
|
|
|
|
function run(cmd: string): { stdout: string; code: number } {
|
|
try {
|
|
const stdout = execSync(cmd, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] });
|
|
return { stdout, code: 0 };
|
|
} catch (e: any) {
|
|
return { stdout: e.stdout ?? e.message, code: e.status ?? 1 };
|
|
}
|
|
}
|
|
|
|
console.log('🔍 Running flutter analyze...');
|
|
const analyze = run('flutter analyze --no-congratulate');
|
|
if (analyze.code !== 0) {
|
|
console.error(`${RED}✘ flutter analyze failed:\n${analyze.stdout}${RESET}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log('🎨 Checking dart format...');
|
|
const format = run('dart format --output=none --set-exit-if-changed lib/ test/');
|
|
if (format.code !== 0) {
|
|
console.error(`${RED}✘ Unformatted files detected. Run: dart format lib/ test/${RESET}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log(`${GREEN}✔ flutter analyze + dart format passed${RESET}`);
|