red64-cli 0.1.0 → 0.3.0

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 (125) hide show
  1. package/README.md +1 -2
  2. package/dist/cli/parseArgs.d.ts.map +1 -1
  3. package/dist/cli/parseArgs.js +5 -0
  4. package/dist/cli/parseArgs.js.map +1 -1
  5. package/dist/components/init/CompleteStep.d.ts.map +1 -1
  6. package/dist/components/init/CompleteStep.js +2 -2
  7. package/dist/components/init/CompleteStep.js.map +1 -1
  8. package/dist/components/init/TestCheckStep.d.ts +16 -0
  9. package/dist/components/init/TestCheckStep.d.ts.map +1 -0
  10. package/dist/components/init/TestCheckStep.js +120 -0
  11. package/dist/components/init/TestCheckStep.js.map +1 -0
  12. package/dist/components/init/index.d.ts +1 -0
  13. package/dist/components/init/index.d.ts.map +1 -1
  14. package/dist/components/init/index.js +1 -0
  15. package/dist/components/init/index.js.map +1 -1
  16. package/dist/components/init/types.d.ts +9 -0
  17. package/dist/components/init/types.d.ts.map +1 -1
  18. package/dist/components/screens/InitScreen.d.ts.map +1 -1
  19. package/dist/components/screens/InitScreen.js +69 -6
  20. package/dist/components/screens/InitScreen.js.map +1 -1
  21. package/dist/components/screens/ListScreen.d.ts.map +1 -1
  22. package/dist/components/screens/ListScreen.js +28 -3
  23. package/dist/components/screens/ListScreen.js.map +1 -1
  24. package/dist/components/screens/StartScreen.d.ts.map +1 -1
  25. package/dist/components/screens/StartScreen.js +212 -13
  26. package/dist/components/screens/StartScreen.js.map +1 -1
  27. package/dist/components/ui/ArtifactsSidebar.d.ts +19 -0
  28. package/dist/components/ui/ArtifactsSidebar.d.ts.map +1 -0
  29. package/dist/components/ui/ArtifactsSidebar.js +51 -0
  30. package/dist/components/ui/ArtifactsSidebar.js.map +1 -0
  31. package/dist/components/ui/FeatureSidebar.d.ts.map +1 -1
  32. package/dist/components/ui/FeatureSidebar.js +1 -1
  33. package/dist/components/ui/FeatureSidebar.js.map +1 -1
  34. package/dist/components/ui/index.d.ts +1 -0
  35. package/dist/components/ui/index.d.ts.map +1 -1
  36. package/dist/components/ui/index.js +1 -0
  37. package/dist/components/ui/index.js.map +1 -1
  38. package/dist/services/ClaudeErrorDetector.js +3 -3
  39. package/dist/services/ClaudeErrorDetector.js.map +1 -1
  40. package/dist/services/ConfigService.d.ts +1 -0
  41. package/dist/services/ConfigService.d.ts.map +1 -1
  42. package/dist/services/ConfigService.js.map +1 -1
  43. package/dist/services/ProjectDetector.d.ts +28 -0
  44. package/dist/services/ProjectDetector.d.ts.map +1 -0
  45. package/dist/services/ProjectDetector.js +236 -0
  46. package/dist/services/ProjectDetector.js.map +1 -0
  47. package/dist/services/TestRunner.d.ts +46 -0
  48. package/dist/services/TestRunner.d.ts.map +1 -0
  49. package/dist/services/TestRunner.js +85 -0
  50. package/dist/services/TestRunner.js.map +1 -0
  51. package/dist/services/index.d.ts +2 -0
  52. package/dist/services/index.d.ts.map +1 -1
  53. package/dist/services/index.js +2 -0
  54. package/dist/services/index.js.map +1 -1
  55. package/dist/types/index.d.ts +13 -0
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/index.js.map +1 -1
  58. package/framework/.red64/settings/templates/specs/gap-analysis.md +163 -0
  59. package/framework/agents/claude/.claude/agents/red64/spec-impl.md +131 -2
  60. package/framework/agents/claude/.claude/agents/red64/validate-gap.md +13 -7
  61. package/framework/agents/claude/.claude/commands/red64/spec-impl.md +24 -0
  62. package/framework/agents/claude/.claude/commands/red64/validate-gap.md +4 -0
  63. package/framework/agents/codex/.codex/agents/red64/spec-impl.md +131 -2
  64. package/framework/agents/codex/.codex/agents/red64/validate-gap.md +13 -7
  65. package/framework/agents/codex/.codex/commands/red64/spec-impl.md +24 -0
  66. package/framework/agents/codex/.codex/commands/red64/validate-gap.md +4 -0
  67. package/framework/stacks/generic/feedback.md +80 -0
  68. package/framework/stacks/nextjs/accessibility.md +437 -0
  69. package/framework/stacks/nextjs/api.md +431 -0
  70. package/framework/stacks/nextjs/coding-style.md +282 -0
  71. package/framework/stacks/nextjs/commenting.md +226 -0
  72. package/framework/stacks/nextjs/components.md +411 -0
  73. package/framework/stacks/nextjs/conventions.md +333 -0
  74. package/framework/stacks/nextjs/css.md +310 -0
  75. package/framework/stacks/nextjs/error-handling.md +442 -0
  76. package/framework/stacks/nextjs/feedback.md +124 -0
  77. package/framework/stacks/nextjs/migrations.md +332 -0
  78. package/framework/stacks/nextjs/models.md +362 -0
  79. package/framework/stacks/nextjs/queries.md +410 -0
  80. package/framework/stacks/nextjs/responsive.md +338 -0
  81. package/framework/stacks/nextjs/tech-stack.md +177 -0
  82. package/framework/stacks/nextjs/test-writing.md +475 -0
  83. package/framework/stacks/nextjs/validation.md +467 -0
  84. package/framework/stacks/python/api.md +468 -0
  85. package/framework/stacks/python/authentication.md +342 -0
  86. package/framework/stacks/python/code-quality.md +283 -0
  87. package/framework/stacks/python/code-refactoring.md +315 -0
  88. package/framework/stacks/python/coding-style.md +462 -0
  89. package/framework/stacks/python/conventions.md +399 -0
  90. package/framework/stacks/python/error-handling.md +512 -0
  91. package/framework/stacks/python/feedback.md +92 -0
  92. package/framework/stacks/python/implement-ai-llm.md +468 -0
  93. package/framework/stacks/python/migrations.md +388 -0
  94. package/framework/stacks/python/models.md +399 -0
  95. package/framework/stacks/python/python.md +232 -0
  96. package/framework/stacks/python/queries.md +451 -0
  97. package/framework/stacks/python/structure.md +245 -58
  98. package/framework/stacks/python/tech.md +92 -35
  99. package/framework/stacks/python/testing.md +380 -0
  100. package/framework/stacks/python/validation.md +471 -0
  101. package/framework/stacks/rails/authentication.md +176 -0
  102. package/framework/stacks/rails/code-quality.md +287 -0
  103. package/framework/stacks/rails/code-refactoring.md +299 -0
  104. package/framework/stacks/rails/feedback.md +130 -0
  105. package/framework/stacks/rails/implement-ai-llm-with-rubyllm.md +342 -0
  106. package/framework/stacks/rails/rails.md +301 -0
  107. package/framework/stacks/rails/rails8-best-practices.md +498 -0
  108. package/framework/stacks/rails/rails8-css.md +573 -0
  109. package/framework/stacks/rails/structure.md +140 -0
  110. package/framework/stacks/rails/tech.md +108 -0
  111. package/framework/stacks/react/code-quality.md +521 -0
  112. package/framework/stacks/react/components.md +625 -0
  113. package/framework/stacks/react/data-fetching.md +586 -0
  114. package/framework/stacks/react/feedback.md +110 -0
  115. package/framework/stacks/react/forms.md +694 -0
  116. package/framework/stacks/react/performance.md +640 -0
  117. package/framework/stacks/react/product.md +22 -9
  118. package/framework/stacks/react/state-management.md +472 -0
  119. package/framework/stacks/react/structure.md +351 -44
  120. package/framework/stacks/react/tech.md +219 -30
  121. package/framework/stacks/react/testing.md +690 -0
  122. package/package.json +1 -1
  123. package/framework/stacks/node/product.md +0 -27
  124. package/framework/stacks/node/structure.md +0 -82
  125. package/framework/stacks/node/tech.md +0 -63
@@ -4,62 +4,251 @@
4
4
 
5
5
  ## Architecture
6
6
 
7
- Component-based architecture with unidirectional data flow. React components handle UI rendering while hooks manage state and side effects.
7
+ Component-based architecture with unidirectional data flow. React components handle UI rendering while hooks manage state and side effects. Server state is separated from client state using dedicated libraries.
8
+
9
+ ---
8
10
 
9
11
  ## Core Technologies
10
12
 
11
- - **Language**: TypeScript 5.x (strict mode)
12
- - **Framework**: React 18+
13
- - **Runtime**: Node.js 20+ (development), Browser (production)
14
- - **Build Tool**: Vite / Create React App / Next.js
13
+ | Category | Choice | Rationale |
14
+ |----------|--------|-----------|
15
+ | **Language** | TypeScript 5.x (strict) | Type safety, better DX, catch errors at compile time |
16
+ | **Framework** | React 18+ | Concurrent rendering, automatic batching, Suspense |
17
+ | **Runtime** | Node.js 20+ (dev), Browser (prod) | Modern ESM support, native fetch |
18
+ | **Build Tool** | Vite 5+ | Fastest HMR, native ESM, optimized production builds |
19
+ | **Package Manager** | pnpm | Fast, disk-efficient, strict dependency resolution |
20
+
21
+ ---
15
22
 
16
23
  ## Key Libraries
17
24
 
18
- - **State Management**: React Context / Redux / Zustand
19
- - **Routing**: React Router / Next.js Router
20
- - **Styling**: Tailwind CSS / CSS Modules / Styled Components
21
- - **HTTP Client**: fetch / axios / TanStack Query
25
+ ### State Management
26
+ | Library | Use Case |
27
+ |---------|----------|
28
+ | **Zustand** | Client state (UI state, user preferences) |
29
+ | **TanStack Query** | Server state (API data, caching, sync) |
30
+ | **React Context** | Dependency injection (theme, auth context) |
31
+
32
+ ### Data Fetching
33
+ | Library | Use Case |
34
+ |---------|----------|
35
+ | **TanStack Query** | Server state, caching, background refetch |
36
+ | **ky** / **fetch** | HTTP client (ky for better DX, native fetch for simplicity) |
37
+ | **zod** | Runtime validation of API responses |
38
+
39
+ ### Routing
40
+ | Library | Use Case |
41
+ |---------|----------|
42
+ | **React Router 6+** | Client-side routing, nested routes, loaders |
43
+ | **TanStack Router** | Type-safe routing (alternative) |
44
+
45
+ ### Forms
46
+ | Library | Use Case |
47
+ |---------|----------|
48
+ | **React Hook Form** | Performant forms, minimal re-renders |
49
+ | **Zod** | Schema validation, type inference |
50
+ | **@hookform/resolvers** | Zod integration with RHF |
51
+
52
+ ### Styling
53
+ | Library | Use Case |
54
+ |---------|----------|
55
+ | **Tailwind CSS 3+** | Utility-first, design system, purged production CSS |
56
+ | **tailwind-merge** | Conditional class merging without conflicts |
57
+ | **clsx** | Conditional classNames |
58
+
59
+ ### UI Components
60
+ | Library | Use Case |
61
+ |---------|----------|
62
+ | **Radix UI** | Unstyled, accessible primitives |
63
+ | **shadcn/ui** | Copy-paste components built on Radix |
64
+ | **Lucide React** | Icon library |
65
+
66
+ ---
22
67
 
23
68
  ## Development Standards
24
69
 
25
- ### Type Safety
70
+ ### TypeScript Configuration
71
+
72
+ ```json
73
+ {
74
+ "compilerOptions": {
75
+ "target": "ES2022",
76
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
77
+ "module": "ESNext",
78
+ "moduleResolution": "bundler",
79
+ "strict": true,
80
+ "noUncheckedIndexedAccess": true,
81
+ "noImplicitOverride": true,
82
+ "noUnusedLocals": true,
83
+ "noUnusedParameters": true,
84
+ "exactOptionalPropertyTypes": true,
85
+ "forceConsistentCasingInFileNames": true,
86
+ "skipLibCheck": true,
87
+ "jsx": "react-jsx",
88
+ "baseUrl": ".",
89
+ "paths": {
90
+ "@/*": ["./src/*"]
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ ### Type Safety Rules
26
97
  - TypeScript strict mode enabled
27
- - No `any` types except for third-party library edge cases
98
+ - No `any` types except for third-party library edge cases (use `unknown` instead)
28
99
  - Explicit return types for exported functions
29
- - Interface over type for object shapes
100
+ - Prefer `interface` over `type` for object shapes (better error messages, extendable)
101
+ - Use discriminated unions for state machines
102
+ - Validate external data with Zod at runtime
103
+
104
+ ---
105
+
106
+ ## Code Quality
107
+
108
+ | Tool | Purpose |
109
+ |------|---------|
110
+ | **ESLint** | Linting with React and TypeScript rules |
111
+ | **Prettier** | Code formatting (single source of truth) |
112
+ | **Husky** | Git hooks for pre-commit checks |
113
+ | **lint-staged** | Run checks only on staged files |
114
+
115
+ ### ESLint Configuration
116
+
117
+ ```javascript
118
+ // eslint.config.js (flat config)
119
+ import js from '@eslint/js';
120
+ import typescript from '@typescript-eslint/eslint-plugin';
121
+ import tsParser from '@typescript-eslint/parser';
122
+ import react from 'eslint-plugin-react';
123
+ import reactHooks from 'eslint-plugin-react-hooks';
124
+ import jsxA11y from 'eslint-plugin-jsx-a11y';
125
+
126
+ export default [
127
+ js.configs.recommended,
128
+ {
129
+ files: ['**/*.{ts,tsx}'],
130
+ languageOptions: {
131
+ parser: tsParser,
132
+ parserOptions: { project: './tsconfig.json' },
133
+ },
134
+ plugins: {
135
+ '@typescript-eslint': typescript,
136
+ 'react': react,
137
+ 'react-hooks': reactHooks,
138
+ 'jsx-a11y': jsxA11y,
139
+ },
140
+ rules: {
141
+ 'react-hooks/rules-of-hooks': 'error',
142
+ 'react-hooks/exhaustive-deps': 'warn',
143
+ '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
144
+ '@typescript-eslint/no-explicit-any': 'error',
145
+ '@typescript-eslint/consistent-type-imports': 'error',
146
+ },
147
+ },
148
+ ];
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Testing
30
154
 
31
- ### Code Quality
32
- - ESLint with recommended React rules
33
- - Prettier for formatting
34
- - Husky pre-commit hooks
155
+ | Tool | Purpose |
156
+ |------|---------|
157
+ | **Vitest** | Unit and integration tests (native Vite integration, fastest) |
158
+ | **React Testing Library** | Component testing (user-centric) |
159
+ | **MSW** | API mocking (Mock Service Worker) |
160
+ | **Playwright** | End-to-end testing |
161
+ | **@testing-library/user-event** | Realistic user interactions |
35
162
 
36
- ### Testing
37
- - Vitest / Jest for unit tests
38
- - React Testing Library for component tests
39
- - Playwright / Cypress for E2E tests
40
- - Minimum 80% coverage for business logic
163
+ ### Coverage Requirements
164
+ - Minimum 80% coverage for business logic (hooks, utils)
165
+ - Critical user flows must have E2E tests
166
+ - Components tested for user interactions, not implementation details
167
+
168
+ ---
41
169
 
42
170
  ## Development Environment
43
171
 
44
172
  ### Required Tools
45
173
  - Node.js 20+
46
- - npm / yarn / pnpm
47
- - VS Code with React extensions
174
+ - pnpm 8+ (or npm/yarn)
175
+ - VS Code with extensions:
176
+ - ESLint
177
+ - Prettier
178
+ - Tailwind CSS IntelliSense
179
+ - TypeScript Vue Plugin (Volar) for better TS support
48
180
 
49
181
  ### Common Commands
182
+
50
183
  ```bash
51
- # Dev: npm run dev
52
- # Build: npm run build
53
- # Test: npm test
54
- # Lint: npm run lint
184
+ # Development
185
+ pnpm dev # Start dev server with HMR
186
+ pnpm build # Production build
187
+ pnpm preview # Preview production build
188
+
189
+ # Testing
190
+ pnpm test # Run Vitest in watch mode
191
+ pnpm test:run # Run tests once
192
+ pnpm test:coverage # Run with coverage report
193
+ pnpm test:e2e # Run Playwright E2E tests
194
+
195
+ # Code Quality
196
+ pnpm lint # ESLint check
197
+ pnpm lint:fix # Auto-fix ESLint issues
198
+ pnpm format # Prettier format
199
+ pnpm typecheck # TypeScript type checking
55
200
  ```
56
201
 
202
+ ---
203
+
57
204
  ## Key Technical Decisions
58
205
 
206
+ ### Component Patterns
59
207
  - **Functional Components**: Always use functional components with hooks
60
- - **Custom Hooks**: Extract reusable logic into custom hooks
208
+ - **Custom Hooks**: Extract reusable logic into custom hooks (prefix with `use`)
61
209
  - **Composition**: Prefer composition over inheritance
62
- - **Immutability**: Never mutate state directly
210
+ - **Render Props / HOCs**: Avoid unless library requires it
211
+
212
+ ### State Patterns
213
+ - **Server vs Client State**: Separate concerns using TanStack Query (server) and Zustand (client)
214
+ - **Immutability**: Never mutate state directly; use immer if complex updates needed
215
+ - **Colocation**: Keep state as close to where it's used as possible
216
+ - **Lift State Up**: Only when multiple components need the same state
217
+
218
+ ### Performance Defaults
219
+ - **Code Splitting**: Use `React.lazy()` for route-level splitting
220
+ - **Memoization**: Use `useMemo`/`useCallback` only when profiler shows need
221
+ - **Virtualization**: Use `@tanstack/react-virtual` for long lists (1000+ items)
222
+
223
+ ### Error Handling
224
+ - **Error Boundaries**: Wrap feature sections, not individual components
225
+ - **API Errors**: Handle with TanStack Query's built-in error states
226
+ - **Form Errors**: Inline validation with React Hook Form + Zod
63
227
 
64
228
  ---
65
- _Document standards and patterns, not every dependency_
229
+
230
+ ## Project Initialization
231
+
232
+ ```bash
233
+ # Create new project with Vite
234
+ pnpm create vite@latest my-app --template react-ts
235
+ cd my-app
236
+
237
+ # Install core dependencies
238
+ pnpm add @tanstack/react-query zustand react-router-dom zod react-hook-form @hookform/resolvers
239
+
240
+ # Install UI dependencies
241
+ pnpm add tailwindcss postcss autoprefixer clsx tailwind-merge lucide-react
242
+ pnpm add -D @radix-ui/react-* # Add specific primitives as needed
243
+
244
+ # Install dev dependencies
245
+ pnpm add -D vitest @testing-library/react @testing-library/jest-dom @testing-library/user-event
246
+ pnpm add -D msw playwright @playwright/test
247
+ pnpm add -D eslint prettier eslint-plugin-react-hooks eslint-plugin-jsx-a11y
248
+ pnpm add -D @typescript-eslint/parser @typescript-eslint/eslint-plugin
249
+ pnpm add -D husky lint-staged
250
+ ```
251
+
252
+ ---
253
+
254
+ _Document standards and patterns, not every dependency. Keep this current as the stack evolves._