@su-record/vibe 2.6.7 → 2.6.8

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.
@@ -221,6 +221,1202 @@ function seedInlineSkills(targetDir) {
221
221
  }
222
222
  }
223
223
  }
224
+ // Cursor 모델 매핑 (각 리뷰어 유형에 최적의 모델)
225
+ // 사용 가능: composer-1, claude-4.5-opus-high, claude-4.5-opus-high-thinking,
226
+ // claude-4.5-sonnet-thinking, gpt-5.2-codex, gpt-5.2, gpt-5.2-high,
227
+ // gemini-3-pro, gemini-3-flash
228
+ const CURSOR_MODEL_MAPPING = {
229
+ // 보안/아키텍처: 깊은 추론 필요 → thinking 모델
230
+ 'security-reviewer': 'claude-4.5-sonnet-thinking',
231
+ 'architecture-reviewer': 'claude-4.5-sonnet-thinking',
232
+ 'data-integrity-reviewer': 'claude-4.5-sonnet-thinking',
233
+ // 언어별 전문가: 코드 이해 필요 → codex
234
+ 'typescript-reviewer': 'gpt-5.2-codex',
235
+ 'python-reviewer': 'gpt-5.2-codex',
236
+ 'react-reviewer': 'gpt-5.2-codex',
237
+ 'rails-reviewer': 'gpt-5.2-codex',
238
+ // 빠른 패턴 체크: 경량 모델
239
+ 'performance-reviewer': 'gemini-3-flash',
240
+ 'complexity-reviewer': 'gemini-3-flash',
241
+ 'simplicity-reviewer': 'gemini-3-flash',
242
+ 'test-coverage-reviewer': 'gemini-3-flash',
243
+ 'git-history-reviewer': 'gemini-3-flash',
244
+ };
245
+ /**
246
+ * VIBE 에이전트를 Cursor 서브에이전트 형식으로 변환
247
+ */
248
+ function convertAgentToCursor(content, filename) {
249
+ // Windows CRLF → LF 정규화
250
+ const normalizedContent = content.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
251
+ const name = path.basename(filename, '.md');
252
+ const model = CURSOR_MODEL_MAPPING[name] || 'auto';
253
+ // 제목 추출
254
+ const titleMatch = normalizedContent.match(/^# (.+)$/m);
255
+ const title = titleMatch ? titleMatch[1].trim() : name;
256
+ // Role 섹션 추출 (## Role 다음 내용을 다음 ## 전까지)
257
+ const roleMatch = normalizedContent.match(/## Role\s*\n([\s\S]*?)(?=\n## )/);
258
+ const roleLines = roleMatch
259
+ ? roleMatch[1]
260
+ .split('\n')
261
+ .filter((line) => line.trim().startsWith('- '))
262
+ .map((line) => line.trim().replace(/^- /, '').trim())
263
+ .slice(0, 3)
264
+ : [];
265
+ // Checklist 섹션 추출 (## Checklist 다음 내용을 ## Output 전까지)
266
+ const checklistMatch = normalizedContent.match(/## Checklist\s*\n([\s\S]*?)(?=\n## Output)/);
267
+ const checklist = checklistMatch ? checklistMatch[1].trim() : '';
268
+ // Output Format 추출 (## Output Format 다음 내용을 끝 또는 ## 전까지)
269
+ const outputMatch = normalizedContent.match(/## Output Format\s*\n([\s\S]*?)(?=\n## |$)/);
270
+ const outputFormat = outputMatch ? outputMatch[1].trim() : '';
271
+ // Description 생성
272
+ const roleDesc = roleLines.join(', ');
273
+ const descriptions = {
274
+ 'security-reviewer': `Security vulnerability expert. ${roleDesc}. OWASP Top 10 verification. Use proactively after code changes involving authentication, user input, or data handling.`,
275
+ 'architecture-reviewer': `Architecture design expert. ${roleDesc}. Use proactively when modifying service layers, dependencies, or module structure.`,
276
+ 'performance-reviewer': `Performance optimization expert. ${roleDesc}. Use proactively after adding loops, database queries, or API calls.`,
277
+ 'complexity-reviewer': `Code complexity analyzer. ${roleDesc}. Use proactively to check function length, nesting depth, cyclomatic complexity.`,
278
+ 'simplicity-reviewer': `Code simplicity advocate. ${roleDesc}. Detects over-engineering. Use proactively after refactoring.`,
279
+ 'data-integrity-reviewer': `Data integrity expert. ${roleDesc}. Validates data flow and state management.`,
280
+ 'test-coverage-reviewer': `Test coverage analyzer. ${roleDesc}. Identifies missing tests. Use proactively after implementing new features.`,
281
+ 'git-history-reviewer': `Git history analyzer. ${roleDesc}. Reviews commit patterns and identifies risky changes.`,
282
+ 'python-reviewer': `Python code expert. ${roleDesc}. Type hints, PEP8 compliance. Use proactively for Python files.`,
283
+ 'typescript-reviewer': `TypeScript code expert. ${roleDesc}. Type safety, modern patterns. Use proactively for .ts/.tsx files.`,
284
+ 'rails-reviewer': `Rails framework expert. ${roleDesc}. MVC patterns, ActiveRecord best practices.`,
285
+ 'react-reviewer': `React framework expert. ${roleDesc}. Hooks, component patterns. Use proactively for React components.`,
286
+ };
287
+ const description = descriptions[name] || `${title}. ${roleDesc}. Use proactively after code edits.`;
288
+ // Next Steps 생성
289
+ const recommendations = {
290
+ 'security-reviewer': ['architecture-reviewer', 'data-integrity-reviewer'],
291
+ 'architecture-reviewer': ['complexity-reviewer', 'performance-reviewer'],
292
+ 'performance-reviewer': ['complexity-reviewer', 'test-coverage-reviewer'],
293
+ 'complexity-reviewer': ['simplicity-reviewer', 'test-coverage-reviewer'],
294
+ 'simplicity-reviewer': ['architecture-reviewer'],
295
+ 'data-integrity-reviewer': ['security-reviewer', 'test-coverage-reviewer'],
296
+ 'test-coverage-reviewer': ['security-reviewer'],
297
+ 'git-history-reviewer': ['security-reviewer', 'architecture-reviewer'],
298
+ 'python-reviewer': ['security-reviewer', 'test-coverage-reviewer'],
299
+ 'typescript-reviewer': ['security-reviewer', 'react-reviewer', 'test-coverage-reviewer'],
300
+ 'rails-reviewer': ['security-reviewer', 'performance-reviewer'],
301
+ 'react-reviewer': ['typescript-reviewer', 'performance-reviewer'],
302
+ };
303
+ const nextAgents = recommendations[name] || ['security-reviewer', 'test-coverage-reviewer'];
304
+ const nextStepsSection = nextAgents
305
+ .map((a) => `- For ${a.replace('-reviewer', '')} review: "Use ${a}"`)
306
+ .join('\n');
307
+ return `---
308
+ name: ${name}
309
+ model: ${model}
310
+ description: ${description}
311
+ ---
312
+
313
+ # ${title}
314
+
315
+ ## When Invoked
316
+
317
+ 1. Run \`git diff\` to see recent changes
318
+ 2. Focus on modified files relevant to this review type
319
+ 3. Begin review immediately without asking questions
320
+
321
+ ## Role
322
+
323
+ ${roleLines.map((r) => `- ${r}`).join('\n')}
324
+
325
+ ## Checklist
326
+
327
+ ${checklist}
328
+
329
+ ## Output Format
330
+
331
+ ${outputFormat}
332
+
333
+ ## Next Steps
334
+
335
+ Review complete. Consider these follow-up actions:
336
+
337
+ ${nextStepsSection}
338
+ - All reviews done: Ready to commit
339
+ `;
340
+ }
341
+ /**
342
+ * Cursor 프로젝트 룰 템플릿 생성 (VIBE 표준 기반)
343
+ */
344
+ function generateCursorRules(cursorRulesDir) {
345
+ ensureDir(cursorRulesDir);
346
+ const rules = [
347
+ {
348
+ filename: 'typescript-standards.mdc',
349
+ content: `---
350
+ description: TypeScript coding standards - complexity limits, type safety, error handling
351
+ globs: "**/*.ts,**/*.tsx"
352
+ alwaysApply: false
353
+ ---
354
+
355
+ # TypeScript Standards
356
+
357
+ ## Type Safety
358
+ - No \`any\` type → Use \`unknown\` + type guards
359
+ - No \`as any\` casting → Define proper interfaces
360
+ - No \`@ts-ignore\` → Fix type issues at root
361
+ - Explicit return types on all exported functions
362
+
363
+ ## Complexity Limits
364
+ | Metric | Limit |
365
+ |--------|-------|
366
+ | Function length | ≤30 lines (recommended), ≤50 lines (max) |
367
+ | Nesting depth | ≤3 levels |
368
+ | Parameters | ≤5 |
369
+ | Cyclomatic complexity | ≤10 |
370
+
371
+ ## Error Handling
372
+ - Always use try-catch for async operations
373
+ - Provide user-friendly error messages
374
+ - Handle loading states appropriately
375
+
376
+ ## Code Structure Order
377
+ 1. Import statements
378
+ 2. Type/Interface definitions
379
+ 3. Constants
380
+ 4. Helper functions
381
+ 5. Main component/function
382
+ 6. Sub-components (if React)
383
+
384
+ ## Example - Early Return Pattern
385
+ \`\`\`typescript
386
+ // ❌ Avoid nested conditions
387
+ function processUser(user: User) {
388
+ if (user.isActive) {
389
+ if (user.hasPermission) {
390
+ return process(user);
391
+ }
392
+ }
393
+ return null;
394
+ }
395
+
396
+ // ✅ Use early returns
397
+ function processUser(user: User) {
398
+ if (!user.isActive) return null;
399
+ if (!user.hasPermission) return null;
400
+ return process(user);
401
+ }
402
+ \`\`\`
403
+ `,
404
+ },
405
+ {
406
+ filename: 'react-patterns.mdc',
407
+ content: `---
408
+ description: React component patterns and best practices
409
+ globs: "**/*.tsx,**/*.jsx"
410
+ alwaysApply: false
411
+ ---
412
+
413
+ # React Patterns
414
+
415
+ ## Component Structure
416
+ 1. State & Refs declarations
417
+ 2. Custom hooks
418
+ 3. Event handlers
419
+ 4. Effects (useEffect)
420
+ 5. Early returns (loading, error states)
421
+ 6. Main JSX return
422
+
423
+ ## Best Practices
424
+ - Use functional components with hooks
425
+ - Extract custom hooks for reusable logic
426
+ - Keep components under 200 lines
427
+ - Colocate styles with components
428
+
429
+ ## Example - Component Order
430
+ \`\`\`tsx
431
+ function UserProfile({ userId }: Props) {
432
+ // 1. State
433
+ const [user, setUser] = useState<User | null>(null);
434
+
435
+ // 2. Custom hooks
436
+ const { isAuthenticated } = useAuth();
437
+
438
+ // 3. Event handlers
439
+ const handleSubmit = (e: FormEvent) => { /* ... */ };
440
+
441
+ // 4. Effects
442
+ useEffect(() => { /* fetch user */ }, [userId]);
443
+
444
+ // 5. Early returns
445
+ if (!user) return <Loading />;
446
+
447
+ // 6. Main JSX
448
+ return <div>{/* ... */}</div>;
449
+ }
450
+ \`\`\`
451
+ `,
452
+ },
453
+ {
454
+ filename: 'code-quality.mdc',
455
+ content: `---
456
+ description: General code quality rules for all files
457
+ alwaysApply: true
458
+ ---
459
+
460
+ # Code Quality Rules
461
+
462
+ ## Core Principles
463
+ - **Modify only requested scope** - Don't touch unrelated code
464
+ - **Preserve existing style** - Follow project conventions
465
+ - **Keep working code** - No unnecessary refactoring
466
+
467
+ ## Forbidden Patterns
468
+ - No \`console.log\` in production code (remove after debugging)
469
+ - No hardcoded strings/numbers → Extract to constants
470
+ - No commented-out code in commits
471
+ - No incomplete code without TODO marker
472
+
473
+ ## Naming Conventions
474
+ - Variables/functions: camelCase
475
+ - Classes/types: PascalCase
476
+ - Constants: UPPER_SNAKE_CASE
477
+ - Files: kebab-case or PascalCase (match project style)
478
+
479
+ ## Function Design
480
+ - Single responsibility per function
481
+ - Max 5 parameters (use object for more)
482
+ - Descriptive names (verb + noun)
483
+ - Document non-obvious behavior
484
+
485
+ ## Dependency Management
486
+ - Avoid circular dependencies
487
+ - Keep loose coupling (depend on interfaces)
488
+ - High cohesion (group related functions)
489
+ `,
490
+ },
491
+ {
492
+ filename: 'security-checklist.mdc',
493
+ content: `---
494
+ description: Security checklist for code changes
495
+ globs: "**/*.ts,**/*.tsx,**/*.js,**/*.jsx,**/*.py"
496
+ alwaysApply: false
497
+ ---
498
+
499
+ # Security Checklist
500
+
501
+ ## Input Validation
502
+ - [ ] Validate all user inputs
503
+ - [ ] Sanitize data before database queries
504
+ - [ ] Use parameterized queries (prevent SQL injection)
505
+
506
+ ## Authentication
507
+ - [ ] Secure password handling (never store plain text)
508
+ - [ ] Session management is secure
509
+ - [ ] Tokens have appropriate expiry
510
+
511
+ ## Data Protection
512
+ - [ ] Sensitive data is encrypted
513
+ - [ ] API keys not committed to code
514
+ - [ ] Error messages don't leak sensitive info
515
+
516
+ ## OWASP Top 10 Awareness
517
+ - Injection (SQL, XSS, Command)
518
+ - Broken authentication
519
+ - Sensitive data exposure
520
+ - XML external entities (XXE)
521
+ - Broken access control
522
+ - Security misconfiguration
523
+ - Cross-site scripting (XSS)
524
+ - Insecure deserialization
525
+ - Using components with known vulnerabilities
526
+ - Insufficient logging & monitoring
527
+ `,
528
+ },
529
+ {
530
+ filename: 'python-standards.mdc',
531
+ content: `---
532
+ description: Python coding standards - PEP8, type hints, async patterns
533
+ globs: "**/*.py"
534
+ alwaysApply: false
535
+ ---
536
+
537
+ # Python Standards
538
+
539
+ ## Type Hints (Required)
540
+ \`\`\`python
541
+ # ✅ Good
542
+ def process_user(user: User, options: dict[str, Any] | None = None) -> Result:
543
+ ...
544
+
545
+ # ❌ Avoid
546
+ def process_user(user, options=None):
547
+ ...
548
+ \`\`\`
549
+
550
+ ## PEP8 Compliance
551
+ - Max line length: 88 (Black formatter default)
552
+ - Use snake_case for functions/variables
553
+ - Use PascalCase for classes
554
+ - 2 blank lines before top-level definitions
555
+
556
+ ## Async Patterns
557
+ \`\`\`python
558
+ # ✅ Proper async/await
559
+ async def fetch_data(url: str) -> dict:
560
+ async with aiohttp.ClientSession() as session:
561
+ async with session.get(url) as response:
562
+ return await response.json()
563
+
564
+ # ❌ Avoid blocking calls in async
565
+ async def fetch_data(url: str) -> dict:
566
+ return requests.get(url).json() # Blocks event loop!
567
+ \`\`\`
568
+
569
+ ## Error Handling
570
+ \`\`\`python
571
+ # ✅ Specific exceptions
572
+ try:
573
+ result = process_data(data)
574
+ except ValidationError as e:
575
+ logger.error(f"Validation failed: {e}")
576
+ raise HTTPException(400, str(e))
577
+
578
+ # ❌ Bare except
579
+ try:
580
+ result = process_data(data)
581
+ except:
582
+ pass # Silent failure
583
+ \`\`\`
584
+ `,
585
+ },
586
+ ];
587
+ let updated = 0;
588
+ for (const rule of rules) {
589
+ const destPath = path.join(cursorRulesDir, rule.filename);
590
+ try {
591
+ fs.writeFileSync(destPath, rule.content, 'utf-8');
592
+ updated++;
593
+ }
594
+ catch {
595
+ // 무시 - 권한 문제 등
596
+ }
597
+ }
598
+ console.log(` 📏 Cursor rules template: ${updated}/${rules.length} updated`);
599
+ }
600
+ /**
601
+ * Cursor 서브에이전트 설치
602
+ */
603
+ function installCursorAgents(agentsSource, cursorAgentsDir) {
604
+ const reviewDir = path.join(agentsSource, 'review');
605
+ if (!fs.existsSync(reviewDir)) {
606
+ console.log(` ⚠️ agents/review not found: ${reviewDir}`);
607
+ return;
608
+ }
609
+ ensureDir(cursorAgentsDir);
610
+ const files = fs.readdirSync(reviewDir).filter((f) => f.endsWith('.md'));
611
+ let installed = 0;
612
+ for (const file of files) {
613
+ try {
614
+ const sourcePath = path.join(reviewDir, file);
615
+ const content = fs.readFileSync(sourcePath, 'utf-8');
616
+ const cursorContent = convertAgentToCursor(content, file);
617
+ const destPath = path.join(cursorAgentsDir, file);
618
+ fs.writeFileSync(destPath, cursorContent, 'utf-8');
619
+ installed++;
620
+ }
621
+ catch (err) {
622
+ console.warn(` ⚠️ Failed to convert ${file}: ${err.message}`);
623
+ }
624
+ }
625
+ console.log(` 📦 Cursor agents: ${installed}/${files.length} installed`);
626
+ }
627
+ /**
628
+ * Cursor Skills 생성 (VIBE 커맨드 → Cursor 스킬 변환)
629
+ * 설치 경로: ~/.cursor/skills/[skill-name]/SKILL.md
630
+ */
631
+ function generateCursorSkills(cursorSkillsDir) {
632
+ const skills = [
633
+ {
634
+ id: 'vibe-spec',
635
+ content: `---
636
+ name: vibe-spec
637
+ model: claude-4.5-sonnet-thinking
638
+ description: "SPEC document creation with parallel research. Use when starting new feature implementation."
639
+ ---
640
+
641
+ # /vibe.spec - SPEC Creation Skill
642
+
643
+ SPEC-driven feature development workflow. Creates AI-executable specification documents.
644
+
645
+ ## When to Use
646
+
647
+ - Starting new feature implementation
648
+ - Complex tasks requiring research and planning
649
+ - Features needing clear requirements documentation
650
+
651
+ ## Invocation
652
+
653
+ User says: "vibe spec [feature-name]" or "Create SPEC for [feature-name]"
654
+
655
+ ## Workflow
656
+
657
+ ### Phase 1: Requirements Gathering
658
+ 1. Ask user for feature requirements
659
+ 2. Clarify scope and constraints
660
+ 3. Identify tech stack and dependencies
661
+
662
+ ### Phase 2: Parallel Research (Manual)
663
+ Run these in parallel:
664
+ - "Use best-practices-agent for [feature]"
665
+ - "Use security-advisory-agent for [feature]"
666
+ - Search framework docs with context7
667
+
668
+ ### Phase 3: SPEC Document Generation
669
+ Create SPEC in PTCF format:
670
+ \`\`\`
671
+ <role> AI role definition
672
+ <context> Background, tech stack, related code
673
+ <task> Phase-by-phase task list
674
+ <constraints> Constraints
675
+ <output_format> Files to create/modify
676
+ <acceptance> Verification criteria
677
+ \`\`\`
678
+
679
+ ### Phase 4: Save SPEC
680
+ Save to \`.claude/vibe/specs/[feature-name]-spec.md\`
681
+
682
+ ## Output Format
683
+
684
+ \`\`\`markdown
685
+ # [Feature Name] SPEC
686
+
687
+ ## Overview
688
+ [1-2 sentence summary]
689
+
690
+ ## Requirements
691
+ - REQ-001: [Requirement]
692
+ - REQ-002: [Requirement]
693
+
694
+ ## Technical Approach
695
+ [Implementation strategy]
696
+
697
+ ## Phases
698
+ ### Phase 1: [Setup]
699
+ - [ ] Task 1
700
+ - [ ] Task 2
701
+
702
+ ### Phase 2: [Core Implementation]
703
+ ...
704
+
705
+ ## Acceptance Criteria
706
+ - [ ] Criterion 1
707
+ - [ ] Criterion 2
708
+ \`\`\`
709
+
710
+ ## Next Steps
711
+
712
+ After SPEC creation:
713
+ - "vibe spec review" - Review SPEC with external LLMs
714
+ - "vibe run [feature-name]" - Start implementation
715
+ `,
716
+ },
717
+ {
718
+ id: 'vibe-run',
719
+ content: `---
720
+ name: vibe-run
721
+ model: claude-4.5-opus-high
722
+ description: "Execute SPEC implementation with Scenario-Driven Development. Use after SPEC is approved."
723
+ ---
724
+
725
+ # /vibe.run - Implementation Execution Skill
726
+
727
+ Executes SPEC-based implementation using Scenario-Driven Development methodology.
728
+
729
+ ## When to Use
730
+
731
+ - After SPEC is created and approved
732
+ - When implementing features phase by phase
733
+ - For complex multi-file implementations
734
+
735
+ ## Invocation
736
+
737
+ User says: "vibe run [feature-name]" or "Implement [feature-name]"
738
+
739
+ ## Pre-requisites
740
+
741
+ 1. SPEC document exists at \`.claude/vibe/specs/[feature-name]-spec.md\`
742
+ 2. SPEC has been reviewed (optional but recommended)
743
+
744
+ ## Workflow
745
+
746
+ ### Step 1: Load SPEC
747
+ Read SPEC from \`.claude/vibe/specs/[feature-name]-spec.md\`
748
+
749
+ ### Step 2: For Each Phase in SPEC
750
+
751
+ #### 2a. Phase Planning
752
+ - List all tasks for current phase
753
+ - Identify file dependencies
754
+ - Check existing code patterns
755
+
756
+ #### 2b. Implementation
757
+ - Implement each task
758
+ - Follow existing code style
759
+ - Keep functions under complexity limits
760
+
761
+ #### 2c. Phase Verification
762
+ - Run relevant tests
763
+ - Check TypeScript compilation
764
+ - Verify no regressions
765
+
766
+ ### Step 3: Phase Completion
767
+ Mark phase complete, proceed to next phase
768
+
769
+ ## ULTRAWORK Mode
770
+
771
+ Add "ultrawork" or "ulw" for maximum performance:
772
+ - Parallel sub-agent exploration
773
+ - Auto-continue between phases
774
+ - Auto-retry on errors (max 3)
775
+
776
+ ## Output Format
777
+
778
+ Per phase:
779
+ \`\`\`
780
+ ## Phase [N]: [Name]
781
+
782
+ ### Completed Tasks
783
+ - [x] Task 1 - [file.ts]
784
+ - [x] Task 2 - [file.ts]
785
+
786
+ ### Files Modified
787
+ - src/feature/index.ts (new)
788
+ - src/feature/utils.ts (modified)
789
+
790
+ ### Verification
791
+ - ✅ TypeScript compilation
792
+ - ✅ Tests passing
793
+ \`\`\`
794
+
795
+ ## Next Steps
796
+
797
+ After implementation:
798
+ - "vibe review" - Run 12+ agent code review
799
+ - "vibe verify [feature-name]" - Verify against SPEC
800
+ - "vibe trace [feature-name]" - Generate traceability matrix
801
+ `,
802
+ },
803
+ {
804
+ id: 'vibe-review',
805
+ content: `---
806
+ name: vibe-review
807
+ model: auto
808
+ description: "Parallel code review with 12+ specialized agents. Use after code changes."
809
+ ---
810
+
811
+ # /vibe.review - Parallel Code Review Skill
812
+
813
+ Orchestrates 12+ specialized review agents for comprehensive code review.
814
+
815
+ ## When to Use
816
+
817
+ - After implementing new features
818
+ - Before creating pull requests
819
+ - After significant code changes
820
+
821
+ ## Invocation
822
+
823
+ User says: "vibe review" or "Review my code"
824
+
825
+ ## Available Review Agents
826
+
827
+ ### Security & Architecture (Thinking Models)
828
+ - **security-reviewer** - OWASP Top 10, authentication, data handling
829
+ - **architecture-reviewer** - Design patterns, dependencies, structure
830
+ - **data-integrity-reviewer** - Data flow, state management, persistence
831
+
832
+ ### Language Specialists (Codex Models)
833
+ - **typescript-reviewer** - Type safety, modern patterns
834
+ - **python-reviewer** - Type hints, PEP8, async patterns
835
+ - **react-reviewer** - Hooks, component patterns
836
+ - **rails-reviewer** - MVC, ActiveRecord best practices
837
+
838
+ ### Pattern Checkers (Flash Models)
839
+ - **performance-reviewer** - N+1 queries, loops, memory
840
+ - **complexity-reviewer** - Function length, nesting, cyclomatic
841
+ - **simplicity-reviewer** - Over-engineering detection
842
+ - **test-coverage-reviewer** - Missing tests, edge cases
843
+ - **git-history-reviewer** - Risk patterns, commit analysis
844
+
845
+ ## Workflow
846
+
847
+ ### Step 1: Analyze Changes
848
+ \`\`\`bash
849
+ git diff HEAD~1
850
+ \`\`\`
851
+
852
+ ### Step 2: Select Relevant Agents
853
+ Based on changed files:
854
+ - .ts/.tsx → typescript-reviewer, react-reviewer
855
+ - .py → python-reviewer
856
+ - Security-related → security-reviewer
857
+ - Architecture changes → architecture-reviewer
858
+
859
+ ### Step 3: Run Reviews (Parallel)
860
+ Invoke selected agents:
861
+ - "Use security-reviewer"
862
+ - "Use typescript-reviewer"
863
+ - (etc.)
864
+
865
+ ### Step 4: Consolidate Findings
866
+
867
+ ## Priority System
868
+
869
+ | Priority | Meaning | Action |
870
+ |----------|---------|--------|
871
+ | 🔴 P1 | Critical | Blocks merge, fix immediately |
872
+ | 🟡 P2 | Important | Fix recommended before merge |
873
+ | 🔵 P3 | Nice-to-have | Add to backlog |
874
+
875
+ ## Output Format
876
+
877
+ \`\`\`markdown
878
+ # Code Review Summary
879
+
880
+ ## 🔴 P1 - Critical (X issues)
881
+ - [Issue description] - [file:line]
882
+
883
+ ## 🟡 P2 - Important (X issues)
884
+ - [Issue description] - [file:line]
885
+
886
+ ## 🔵 P3 - Suggestions (X issues)
887
+ - [Issue description] - [file:line]
888
+
889
+ ## Reviewed By
890
+ - security-reviewer ✅
891
+ - typescript-reviewer ✅
892
+ - performance-reviewer ✅
893
+ \`\`\`
894
+
895
+ ## Next Steps
896
+
897
+ After review:
898
+ - Fix P1 issues immediately
899
+ - Address P2 issues before merge
900
+ - Track P3 in backlog
901
+ - Ready to commit when P1/P2 resolved
902
+ `,
903
+ },
904
+ {
905
+ id: 'vibe-analyze',
906
+ content: `---
907
+ name: vibe-analyze
908
+ model: claude-4.5-sonnet-thinking
909
+ description: "Project and feature analysis. Use when exploring codebase or planning changes."
910
+ ---
911
+
912
+ # /vibe.analyze - Analysis Skill
913
+
914
+ Comprehensive project and feature analysis for understanding codebases.
915
+
916
+ ## When to Use
917
+
918
+ - Exploring unfamiliar codebase
919
+ - Planning feature changes
920
+ - Understanding dependencies
921
+ - Identifying potential issues
922
+
923
+ ## Invocation
924
+
925
+ User says: "vibe analyze" or "Analyze [feature/path]"
926
+
927
+ ## Analysis Modes
928
+
929
+ ### 1. Project Analysis (Default)
930
+ Analyzes entire project structure and architecture.
931
+
932
+ ### 2. Feature Analysis
933
+ Analyzes specific feature or module.
934
+ \`\`\`
935
+ vibe analyze src/auth
936
+ vibe analyze "login feature"
937
+ \`\`\`
938
+
939
+ ### 3. Dependency Analysis
940
+ Maps dependencies and coupling.
941
+
942
+ ## Workflow
943
+
944
+ ### Step 1: Structure Scan
945
+ \`\`\`bash
946
+ # Find key files
947
+ ls -la
948
+ find . -name "*.ts" -o -name "*.tsx" | head -20
949
+ \`\`\`
950
+
951
+ ### Step 2: Entry Points
952
+ Identify main entry points:
953
+ - package.json scripts
954
+ - src/index.ts
955
+ - app/main.ts
956
+
957
+ ### Step 3: Architecture Mapping
958
+ - Module boundaries
959
+ - Data flow paths
960
+ - External dependencies
961
+
962
+ ### Step 4: Quality Assessment
963
+ - Complexity hotspots
964
+ - Test coverage gaps
965
+ - Security concerns
966
+
967
+ ## Output Format
968
+
969
+ \`\`\`markdown
970
+ # Project Analysis: [Name]
971
+
972
+ ## Overview
973
+ - Framework: [e.g., Next.js 14]
974
+ - Language: [e.g., TypeScript 5.x]
975
+ - Package Manager: [e.g., pnpm]
976
+
977
+ ## Architecture
978
+ ### Layers
979
+ 1. Presentation (src/components/)
980
+ 2. Business Logic (src/services/)
981
+ 3. Data Access (src/repositories/)
982
+
983
+ ### Key Modules
984
+ | Module | Purpose | Files |
985
+ |--------|---------|-------|
986
+ | auth | Authentication | 12 |
987
+ | api | API routes | 8 |
988
+
989
+ ## Dependencies
990
+ ### Internal
991
+ - auth → db, utils
992
+ - api → auth, services
993
+
994
+ ### External (Notable)
995
+ - next: ^14.0.0
996
+ - prisma: ^5.0.0
997
+
998
+ ## Quality Metrics
999
+ | Metric | Value | Status |
1000
+ |--------|-------|--------|
1001
+ | Avg Complexity | 8.2 | ✅ Good |
1002
+ | Test Coverage | 65% | ⚠️ Moderate |
1003
+ | Type Coverage | 95% | ✅ Good |
1004
+
1005
+ ## Recommendations
1006
+ 1. [Recommendation 1]
1007
+ 2. [Recommendation 2]
1008
+ \`\`\`
1009
+
1010
+ ## Next Steps
1011
+
1012
+ After analysis:
1013
+ - "vibe spec [feature]" - Create SPEC for changes
1014
+ - "vibe review" - Review existing code quality
1015
+ - Plan Mode - For simple modifications
1016
+ `,
1017
+ },
1018
+ {
1019
+ id: 'vibe-verify',
1020
+ content: `---
1021
+ name: vibe-verify
1022
+ model: claude-4.5-sonnet-thinking
1023
+ description: "Verify implementation against SPEC requirements. Use after implementation."
1024
+ ---
1025
+
1026
+ # /vibe.verify - Verification Skill
1027
+
1028
+ Verifies implementation completeness against SPEC requirements.
1029
+
1030
+ ## When to Use
1031
+
1032
+ - After completing implementation
1033
+ - Before marking feature as done
1034
+ - For requirement traceability
1035
+
1036
+ ## Invocation
1037
+
1038
+ User says: "vibe verify [feature-name]"
1039
+
1040
+ ## Pre-requisites
1041
+
1042
+ 1. SPEC exists at \`.claude/vibe/specs/[feature-name]-spec.md\`
1043
+ 2. Implementation is complete
1044
+
1045
+ ## Workflow
1046
+
1047
+ ### Step 1: Load SPEC
1048
+ Read SPEC and extract:
1049
+ - Requirements (REQ-XXX)
1050
+ - Acceptance criteria
1051
+ - Expected outputs
1052
+
1053
+ ### Step 2: Map Implementation
1054
+ For each requirement:
1055
+ - Find implementing code
1056
+ - Identify test coverage
1057
+ - Check acceptance criteria
1058
+
1059
+ ### Step 3: Gap Analysis
1060
+ Identify:
1061
+ - Unimplemented requirements
1062
+ - Untested features
1063
+ - Missing acceptance criteria
1064
+
1065
+ ### Step 4: Generate Report
1066
+
1067
+ ## Verification Levels
1068
+
1069
+ | Level | Meaning |
1070
+ |-------|---------|
1071
+ | ✅ Full | Code + Test + Verified |
1072
+ | ⚠️ Partial | Code exists, missing test or verification |
1073
+ | ❌ None | Not implemented |
1074
+
1075
+ ## Output Format
1076
+
1077
+ \`\`\`markdown
1078
+ # Verification Report: [Feature]
1079
+
1080
+ ## Summary
1081
+ - Total Requirements: 10
1082
+ - Fully Verified: 8 (80%)
1083
+ - Partial: 1 (10%)
1084
+ - Missing: 1 (10%)
1085
+
1086
+ ## Requirement Matrix
1087
+
1088
+ | ID | Requirement | Code | Test | Status |
1089
+ |----|-------------|------|------|--------|
1090
+ | REQ-001 | User login | ✅ | ✅ | ✅ Full |
1091
+ | REQ-002 | Password reset | ✅ | ❌ | ⚠️ Partial |
1092
+ | REQ-003 | MFA support | ❌ | ❌ | ❌ None |
1093
+
1094
+ ## Acceptance Criteria
1095
+
1096
+ | Criterion | Status | Evidence |
1097
+ |-----------|--------|----------|
1098
+ | Login < 2s | ✅ | Performance test |
1099
+ | No plain passwords | ✅ | Code review |
1100
+
1101
+ ## Gaps to Address
1102
+
1103
+ 1. **REQ-003**: MFA support not implemented
1104
+ 2. **REQ-002**: Missing test for password reset
1105
+
1106
+ ## Recommendation
1107
+ ⚠️ Address gaps before release
1108
+ \`\`\`
1109
+
1110
+ ## Next Steps
1111
+
1112
+ After verification:
1113
+ - Fix gaps if any
1114
+ - "vibe trace [feature]" - Full traceability matrix
1115
+ - "vibe review" - Final code review
1116
+ - Ready for release if all verified
1117
+ `,
1118
+ },
1119
+ {
1120
+ id: 'vibe-reason',
1121
+ content: `---
1122
+ name: vibe-reason
1123
+ model: claude-4.5-opus-high-thinking
1124
+ description: "Systematic 9-step reasoning framework. Use for complex problem solving."
1125
+ ---
1126
+
1127
+ # /vibe.reason - Reasoning Framework Skill
1128
+
1129
+ Applies systematic reasoning to complex problems and decisions.
1130
+
1131
+ ## When to Use
1132
+
1133
+ - Complex debugging scenarios
1134
+ - Architecture decisions
1135
+ - Trade-off analysis
1136
+ - Root cause analysis
1137
+
1138
+ ## Invocation
1139
+
1140
+ User says: "vibe reason [problem]" or "Reason about [problem]"
1141
+
1142
+ ## 9-Step Reasoning Framework
1143
+
1144
+ ### Step 1: Problem Definition
1145
+ - What exactly is the problem?
1146
+ - What are the symptoms?
1147
+ - What is the expected vs actual behavior?
1148
+
1149
+ ### Step 2: Context Gathering
1150
+ - What is the relevant code/system?
1151
+ - What changed recently?
1152
+ - What are the constraints?
1153
+
1154
+ ### Step 3: Hypothesis Generation
1155
+ Generate multiple hypotheses:
1156
+ - Hypothesis A: [Description]
1157
+ - Hypothesis B: [Description]
1158
+ - Hypothesis C: [Description]
1159
+
1160
+ ### Step 4: Evidence Collection
1161
+ For each hypothesis:
1162
+ - What evidence supports it?
1163
+ - What evidence contradicts it?
1164
+ - What additional info needed?
1165
+
1166
+ ### Step 5: Hypothesis Evaluation
1167
+ Score each hypothesis:
1168
+ | Hypothesis | Support | Contradict | Confidence |
1169
+ |------------|---------|------------|------------|
1170
+ | A | 3 | 1 | 75% |
1171
+ | B | 2 | 2 | 50% |
1172
+ | C | 1 | 3 | 25% |
1173
+
1174
+ ### Step 6: Deep Dive
1175
+ Focus on highest-confidence hypothesis:
1176
+ - Trace code paths
1177
+ - Check logs/metrics
1178
+ - Reproduce issue
1179
+
1180
+ ### Step 7: Solution Design
1181
+ Design solution addressing root cause:
1182
+ - Option 1: [Description] - Pros/Cons
1183
+ - Option 2: [Description] - Pros/Cons
1184
+
1185
+ ### Step 8: Risk Assessment
1186
+ | Risk | Impact | Probability | Mitigation |
1187
+ |------|--------|-------------|------------|
1188
+ | [Risk 1] | High | Medium | [Strategy] |
1189
+
1190
+ ### Step 9: Recommendation
1191
+ Final recommendation with:
1192
+ - Chosen solution
1193
+ - Implementation steps
1194
+ - Verification plan
1195
+
1196
+ ## Output Format
1197
+
1198
+ \`\`\`markdown
1199
+ # Reasoning Analysis: [Problem]
1200
+
1201
+ ## 1. Problem Definition
1202
+ [Clear statement of the problem]
1203
+
1204
+ ## 2. Context
1205
+ [Relevant background and constraints]
1206
+
1207
+ ## 3. Hypotheses
1208
+ 1. **H1**: [Description]
1209
+ 2. **H2**: [Description]
1210
+ 3. **H3**: [Description]
1211
+
1212
+ ## 4-5. Evidence & Evaluation
1213
+ | Hypothesis | Evidence For | Evidence Against | Confidence |
1214
+ |------------|--------------|------------------|------------|
1215
+ | H1 | [List] | [List] | 80% |
1216
+ | H2 | [List] | [List] | 40% |
1217
+
1218
+ ## 6. Deep Dive (H1)
1219
+ [Detailed analysis of most likely cause]
1220
+
1221
+ ## 7. Solutions
1222
+ ### Option A (Recommended)
1223
+ - Description: [...]
1224
+ - Pros: [...]
1225
+ - Cons: [...]
1226
+
1227
+ ### Option B
1228
+ - Description: [...]
1229
+ - Pros: [...]
1230
+ - Cons: [...]
1231
+
1232
+ ## 8. Risks
1233
+ | Risk | Mitigation |
1234
+ |------|------------|
1235
+ | [Risk] | [Strategy] |
1236
+
1237
+ ## 9. Recommendation
1238
+ **Proceed with Option A because:**
1239
+ 1. [Reason 1]
1240
+ 2. [Reason 2]
1241
+
1242
+ **Next Steps:**
1243
+ 1. [Step 1]
1244
+ 2. [Step 2]
1245
+ \`\`\`
1246
+
1247
+ ## Next Steps
1248
+
1249
+ After reasoning:
1250
+ - Implement chosen solution
1251
+ - "vibe spec [solution]" - If solution needs SPEC
1252
+ - "vibe verify" - Verify solution addresses problem
1253
+ `,
1254
+ },
1255
+ {
1256
+ id: 'vibe-ui',
1257
+ content: `---
1258
+ name: vibe-ui
1259
+ model: gpt-5.2-codex
1260
+ description: "UI preview and generation utilities. Use for UI component work."
1261
+ ---
1262
+
1263
+ # /vibe.ui - UI Utilities Skill
1264
+
1265
+ UI preview, generation, and refactoring utilities.
1266
+
1267
+ ## When to Use
1268
+
1269
+ - Creating new UI components
1270
+ - Previewing UI designs
1271
+ - Refactoring existing components
1272
+ - Generating component code from descriptions
1273
+
1274
+ ## Invocation
1275
+
1276
+ User says: "vibe ui [description]" or "Preview UI for [description]"
1277
+
1278
+ ## Modes
1279
+
1280
+ ### 1. UI Preview
1281
+ Generate visual preview of UI description.
1282
+ \`\`\`
1283
+ vibe ui "Login form with email, password, and remember me checkbox"
1284
+ \`\`\`
1285
+
1286
+ ### 2. Component Generation
1287
+ Generate component code from description.
1288
+ \`\`\`
1289
+ vibe ui generate "User profile card with avatar, name, and bio"
1290
+ \`\`\`
1291
+
1292
+ ### 3. UI Refactoring
1293
+ Refactor existing component for better patterns.
1294
+ \`\`\`
1295
+ vibe ui refactor src/components/UserCard.tsx
1296
+ \`\`\`
1297
+
1298
+ ## Workflow
1299
+
1300
+ ### UI Preview Mode
1301
+
1302
+ 1. **Parse Description**
1303
+ - Extract UI elements
1304
+ - Identify layout requirements
1305
+ - Note interactions
1306
+
1307
+ 2. **Generate Preview**
1308
+ - Create HTML/CSS mockup
1309
+ - Show component structure
1310
+ - Illustrate states (default, hover, active)
1311
+
1312
+ 3. **Output**
1313
+ - Visual description
1314
+ - Component hierarchy
1315
+ - Suggested implementation
1316
+
1317
+ ### Component Generation Mode
1318
+
1319
+ 1. **Analyze Requirements**
1320
+ - Component purpose
1321
+ - Props interface
1322
+ - State requirements
1323
+
1324
+ 2. **Generate Code**
1325
+ - TypeScript/React component
1326
+ - Styled with project's CSS approach
1327
+ - Include prop types
1328
+
1329
+ 3. **Output**
1330
+ - Complete component file
1331
+ - Usage example
1332
+ - Test suggestions
1333
+
1334
+ ### Refactoring Mode
1335
+
1336
+ 1. **Analyze Existing**
1337
+ - Current structure
1338
+ - Identified issues
1339
+ - Improvement opportunities
1340
+
1341
+ 2. **Plan Refactor**
1342
+ - Extract components
1343
+ - Improve patterns
1344
+ - Optimize performance
1345
+
1346
+ 3. **Apply Changes**
1347
+ - Preserve functionality
1348
+ - Improve readability
1349
+ - Add documentation
1350
+
1351
+ ## Output Format
1352
+
1353
+ ### Preview Output
1354
+ \`\`\`markdown
1355
+ # UI Preview: [Description]
1356
+
1357
+ ## Visual Structure
1358
+ \`\`\`
1359
+ ┌─────────────────────────────────┐
1360
+ │ [Header] │
1361
+ ├─────────────────────────────────┤
1362
+ │ 📧 Email: [_______________] │
1363
+ │ 🔒 Password: [_______________] │
1364
+ │ ☐ Remember me │
1365
+ │ │
1366
+ │ [ Login ] │
1367
+ └─────────────────────────────────┘
1368
+ \`\`\`
1369
+
1370
+ ## Component Hierarchy
1371
+ - LoginForm
1372
+ - FormField (email)
1373
+ - FormField (password)
1374
+ - Checkbox (remember)
1375
+ - Button (submit)
1376
+
1377
+ ## Suggested Props
1378
+ \`\`\`typescript
1379
+ interface LoginFormProps {
1380
+ onSubmit: (data: LoginData) => void;
1381
+ isLoading?: boolean;
1382
+ error?: string;
1383
+ }
1384
+ \`\`\`
1385
+ \`\`\`
1386
+
1387
+ ### Generation Output
1388
+ \`\`\`typescript
1389
+ // Complete component code with:
1390
+ // - TypeScript types
1391
+ // - React hooks
1392
+ // - Styled components or CSS classes
1393
+ // - Event handlers
1394
+ \`\`\`
1395
+
1396
+ ## Next Steps
1397
+
1398
+ After UI work:
1399
+ - "vibe review" - Review generated components
1400
+ - "vibe run [feature]" - Continue implementation
1401
+ - Add tests for new components
1402
+ `,
1403
+ },
1404
+ ];
1405
+ let updated = 0;
1406
+ for (const skill of skills) {
1407
+ const skillDir = path.join(cursorSkillsDir, skill.id);
1408
+ ensureDir(skillDir);
1409
+ const destPath = path.join(skillDir, 'SKILL.md');
1410
+ try {
1411
+ fs.writeFileSync(destPath, skill.content, 'utf-8');
1412
+ updated++;
1413
+ }
1414
+ catch {
1415
+ // 무시 - 권한 문제 등
1416
+ }
1417
+ }
1418
+ console.log(` 🎯 Cursor skills: ${updated}/${skills.length} updated`);
1419
+ }
224
1420
  /**
225
1421
  * postinstall 메인 함수
226
1422
  */
@@ -316,12 +1512,35 @@ function main() {
316
1512
  }
317
1513
  // 6. hooks는 프로젝트 레벨에서 관리 (vibe init/update에서 처리)
318
1514
  // 전역 설정에는 훅을 등록하지 않음 - 프로젝트별 .claude/settings.local.json 사용
1515
+ // 7. Cursor IDE 지원 - ~/.cursor/agents/에 변환된 서브에이전트 설치
1516
+ const cursorAgentsDir = path.join(os.homedir(), '.cursor', 'agents');
1517
+ installCursorAgents(agentsSource, cursorAgentsDir);
1518
+ // 8. Cursor 프로젝트 룰 템플릿 생성 - ~/.cursor/rules-template/
1519
+ // 프로젝트별로 .cursor/rules/에 복사해서 사용
1520
+ const cursorRulesTemplateDir = path.join(os.homedir(), '.cursor', 'rules-template');
1521
+ generateCursorRules(cursorRulesTemplateDir);
1522
+ // 9. Cursor Skills 생성 - ~/.cursor/skills/
1523
+ // VIBE 커맨드를 Cursor 스킬로 변환
1524
+ const cursorSkillsDir = path.join(os.homedir(), '.cursor', 'skills');
1525
+ generateCursorSkills(cursorSkillsDir);
319
1526
  console.log(`✅ vibe global setup complete: ${globalVibeDir}`);
1527
+ console.log(`✅ cursor agents installed: ${cursorAgentsDir}`);
1528
+ console.log(`✅ cursor rules template: ${cursorRulesTemplateDir}`);
1529
+ console.log(`✅ cursor skills installed: ${cursorSkillsDir}`);
320
1530
  }
321
1531
  catch (error) {
322
1532
  // postinstall 실패해도 설치는 계속 진행
323
1533
  console.warn('⚠️ vibe postinstall warning:', error.message);
324
1534
  }
325
1535
  }
326
- main();
1536
+ // Export functions for use in vibe init/update
1537
+ export { installCursorAgents, generateCursorRules, generateCursorSkills, getVibeConfigDir, };
1538
+ // CLI로 직접 실행할 때만 main() 호출 (ESM entry point detection)
1539
+ // import.meta.url과 process.argv[1]을 비교하여 직접 실행 여부 판단
1540
+ const currentUrl = import.meta.url;
1541
+ const isDirectRun = process.argv[1] && (currentUrl.includes(process.argv[1].replace(/\\/g, '/')) ||
1542
+ process.argv[1].includes('postinstall'));
1543
+ if (isDirectRun) {
1544
+ main();
1545
+ }
327
1546
  //# sourceMappingURL=postinstall.js.map