wiggum-cli 0.1.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.
- package/LICENSE +21 -0
- package/README.md +341 -0
- package/bin/ralph.js +8 -0
- package/dist/ai/enhancer.d.ts +100 -0
- package/dist/ai/enhancer.d.ts.map +1 -0
- package/dist/ai/enhancer.js +233 -0
- package/dist/ai/enhancer.js.map +1 -0
- package/dist/ai/index.d.ts +8 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +11 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/ai/prompts.d.ts +26 -0
- package/dist/ai/prompts.d.ts.map +1 -0
- package/dist/ai/prompts.js +201 -0
- package/dist/ai/prompts.js.map +1 -0
- package/dist/ai/providers.d.ts +35 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +104 -0
- package/dist/ai/providers.js.map +1 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +196 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/init.d.ts +16 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +124 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/monitor.d.ts +17 -0
- package/dist/commands/monitor.d.ts.map +1 -0
- package/dist/commands/monitor.js +342 -0
- package/dist/commands/monitor.js.map +1 -0
- package/dist/commands/new.d.ts +19 -0
- package/dist/commands/new.d.ts.map +1 -0
- package/dist/commands/new.js +272 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/run.d.ts +16 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +175 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/generator/config.d.ts +59 -0
- package/dist/generator/config.d.ts.map +1 -0
- package/dist/generator/config.js +68 -0
- package/dist/generator/config.js.map +1 -0
- package/dist/generator/index.d.ts +64 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +147 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/templates.d.ts +70 -0
- package/dist/generator/templates.d.ts.map +1 -0
- package/dist/generator/templates.js +296 -0
- package/dist/generator/templates.js.map +1 -0
- package/dist/generator/writer.d.ts +93 -0
- package/dist/generator/writer.d.ts.map +1 -0
- package/dist/generator/writer.js +213 -0
- package/dist/generator/writer.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/scanner/detectors/core/framework.d.ts +11 -0
- package/dist/scanner/detectors/core/framework.d.ts.map +1 -0
- package/dist/scanner/detectors/core/framework.js +275 -0
- package/dist/scanner/detectors/core/framework.js.map +1 -0
- package/dist/scanner/detectors/core/packageManager.d.ts +11 -0
- package/dist/scanner/detectors/core/packageManager.d.ts.map +1 -0
- package/dist/scanner/detectors/core/packageManager.js +74 -0
- package/dist/scanner/detectors/core/packageManager.js.map +1 -0
- package/dist/scanner/detectors/core/styling.d.ts +12 -0
- package/dist/scanner/detectors/core/styling.d.ts.map +1 -0
- package/dist/scanner/detectors/core/styling.js +230 -0
- package/dist/scanner/detectors/core/styling.js.map +1 -0
- package/dist/scanner/detectors/core/testing.d.ts +12 -0
- package/dist/scanner/detectors/core/testing.d.ts.map +1 -0
- package/dist/scanner/detectors/core/testing.js +190 -0
- package/dist/scanner/detectors/core/testing.js.map +1 -0
- package/dist/scanner/detectors/data/api.d.ts +12 -0
- package/dist/scanner/detectors/data/api.d.ts.map +1 -0
- package/dist/scanner/detectors/data/api.js +261 -0
- package/dist/scanner/detectors/data/api.js.map +1 -0
- package/dist/scanner/detectors/data/database.d.ts +12 -0
- package/dist/scanner/detectors/data/database.d.ts.map +1 -0
- package/dist/scanner/detectors/data/database.js +213 -0
- package/dist/scanner/detectors/data/database.js.map +1 -0
- package/dist/scanner/detectors/data/orm.d.ts +12 -0
- package/dist/scanner/detectors/data/orm.d.ts.map +1 -0
- package/dist/scanner/detectors/data/orm.js +160 -0
- package/dist/scanner/detectors/data/orm.js.map +1 -0
- package/dist/scanner/detectors/frontend/formHandling.d.ts +12 -0
- package/dist/scanner/detectors/frontend/formHandling.d.ts.map +1 -0
- package/dist/scanner/detectors/frontend/formHandling.js +211 -0
- package/dist/scanner/detectors/frontend/formHandling.js.map +1 -0
- package/dist/scanner/detectors/frontend/stateManagement.d.ts +12 -0
- package/dist/scanner/detectors/frontend/stateManagement.d.ts.map +1 -0
- package/dist/scanner/detectors/frontend/stateManagement.js +221 -0
- package/dist/scanner/detectors/frontend/stateManagement.js.map +1 -0
- package/dist/scanner/detectors/frontend/uiComponents.d.ts +12 -0
- package/dist/scanner/detectors/frontend/uiComponents.d.ts.map +1 -0
- package/dist/scanner/detectors/frontend/uiComponents.js +285 -0
- package/dist/scanner/detectors/frontend/uiComponents.js.map +1 -0
- package/dist/scanner/detectors/infra/deployment.d.ts +12 -0
- package/dist/scanner/detectors/infra/deployment.d.ts.map +1 -0
- package/dist/scanner/detectors/infra/deployment.js +301 -0
- package/dist/scanner/detectors/infra/deployment.js.map +1 -0
- package/dist/scanner/detectors/infra/monorepo.d.ts +12 -0
- package/dist/scanner/detectors/infra/monorepo.d.ts.map +1 -0
- package/dist/scanner/detectors/infra/monorepo.js +219 -0
- package/dist/scanner/detectors/infra/monorepo.js.map +1 -0
- package/dist/scanner/detectors/mcp/mcpProject.d.ts +12 -0
- package/dist/scanner/detectors/mcp/mcpProject.d.ts.map +1 -0
- package/dist/scanner/detectors/mcp/mcpProject.js +154 -0
- package/dist/scanner/detectors/mcp/mcpProject.js.map +1 -0
- package/dist/scanner/detectors/mcp/mcpServers.d.ts +17 -0
- package/dist/scanner/detectors/mcp/mcpServers.d.ts.map +1 -0
- package/dist/scanner/detectors/mcp/mcpServers.js +193 -0
- package/dist/scanner/detectors/mcp/mcpServers.js.map +1 -0
- package/dist/scanner/detectors/services/analytics.d.ts +12 -0
- package/dist/scanner/detectors/services/analytics.d.ts.map +1 -0
- package/dist/scanner/detectors/services/analytics.js +236 -0
- package/dist/scanner/detectors/services/analytics.js.map +1 -0
- package/dist/scanner/detectors/services/auth.d.ts +12 -0
- package/dist/scanner/detectors/services/auth.d.ts.map +1 -0
- package/dist/scanner/detectors/services/auth.js +217 -0
- package/dist/scanner/detectors/services/auth.js.map +1 -0
- package/dist/scanner/detectors/services/email.d.ts +12 -0
- package/dist/scanner/detectors/services/email.d.ts.map +1 -0
- package/dist/scanner/detectors/services/email.js +211 -0
- package/dist/scanner/detectors/services/email.js.map +1 -0
- package/dist/scanner/detectors/services/payments.d.ts +12 -0
- package/dist/scanner/detectors/services/payments.d.ts.map +1 -0
- package/dist/scanner/detectors/services/payments.js +185 -0
- package/dist/scanner/detectors/services/payments.js.map +1 -0
- package/dist/scanner/detectors/utils.d.ts +160 -0
- package/dist/scanner/detectors/utils.d.ts.map +1 -0
- package/dist/scanner/detectors/utils.js +222 -0
- package/dist/scanner/detectors/utils.js.map +1 -0
- package/dist/scanner/index.d.ts +42 -0
- package/dist/scanner/index.d.ts.map +1 -0
- package/dist/scanner/index.js +282 -0
- package/dist/scanner/index.js.map +1 -0
- package/dist/scanner/registry.d.ts +43 -0
- package/dist/scanner/registry.d.ts.map +1 -0
- package/dist/scanner/registry.js +243 -0
- package/dist/scanner/registry.js.map +1 -0
- package/dist/scanner/types.d.ts +112 -0
- package/dist/scanner/types.d.ts.map +1 -0
- package/dist/scanner/types.js +6 -0
- package/dist/scanner/types.js.map +1 -0
- package/dist/templates/config/ralph.config.js.tmpl +38 -0
- package/dist/templates/guides/AGENTS.md.tmpl +100 -0
- package/dist/templates/guides/FRONTEND.md.tmpl +523 -0
- package/dist/templates/guides/PERFORMANCE.md.tmpl +264 -0
- package/dist/templates/guides/SECURITY.md.tmpl +100 -0
- package/dist/templates/prompts/PROMPT.md.tmpl +77 -0
- package/dist/templates/prompts/PROMPT_e2e.md.tmpl +234 -0
- package/dist/templates/prompts/PROMPT_feature.md.tmpl +83 -0
- package/dist/templates/prompts/PROMPT_review.md.tmpl +167 -0
- package/dist/templates/prompts/PROMPT_verify.md.tmpl +72 -0
- package/dist/templates/root/.gitignore.tmpl +5 -0
- package/dist/templates/root/LEARNINGS.md.tmpl +24 -0
- package/dist/templates/root/README.md.tmpl +61 -0
- package/dist/templates/scripts/feature-loop.sh.tmpl +267 -0
- package/dist/templates/scripts/loop.sh.tmpl +59 -0
- package/dist/templates/scripts/ralph-monitor.sh.tmpl +244 -0
- package/dist/templates/specs/README.md.tmpl +57 -0
- package/dist/templates/specs/_example.md.tmpl +71 -0
- package/dist/utils/config.d.ts +95 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +148 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/header.d.ts +5 -0
- package/dist/utils/header.d.ts.map +1 -0
- package/dist/utils/header.js +15 -0
- package/dist/utils/header.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +24 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +44 -0
- package/src/ai/enhancer.ts +350 -0
- package/src/ai/index.ts +38 -0
- package/src/ai/prompts.ts +217 -0
- package/src/ai/providers.ts +136 -0
- package/src/cli.ts +255 -0
- package/src/commands/init.ts +149 -0
- package/src/commands/monitor.ts +412 -0
- package/src/commands/new.ts +312 -0
- package/src/commands/run.ts +214 -0
- package/src/generator/config.ts +116 -0
- package/src/generator/index.ts +227 -0
- package/src/generator/templates.ts +412 -0
- package/src/generator/writer.ts +293 -0
- package/src/index.ts +41 -0
- package/src/scanner/detectors/core/framework.ts +332 -0
- package/src/scanner/detectors/core/packageManager.ts +91 -0
- package/src/scanner/detectors/core/styling.ts +261 -0
- package/src/scanner/detectors/core/testing.ts +221 -0
- package/src/scanner/detectors/data/api.ts +303 -0
- package/src/scanner/detectors/data/database.ts +245 -0
- package/src/scanner/detectors/data/orm.ts +180 -0
- package/src/scanner/detectors/frontend/formHandling.ts +244 -0
- package/src/scanner/detectors/frontend/stateManagement.ts +261 -0
- package/src/scanner/detectors/frontend/uiComponents.ts +328 -0
- package/src/scanner/detectors/infra/deployment.ts +343 -0
- package/src/scanner/detectors/infra/monorepo.ts +251 -0
- package/src/scanner/detectors/mcp/mcpProject.ts +176 -0
- package/src/scanner/detectors/mcp/mcpServers.ts +237 -0
- package/src/scanner/detectors/services/analytics.ts +273 -0
- package/src/scanner/detectors/services/auth.ts +254 -0
- package/src/scanner/detectors/services/email.ts +244 -0
- package/src/scanner/detectors/services/payments.ts +213 -0
- package/src/scanner/detectors/utils.ts +251 -0
- package/src/scanner/index.ts +354 -0
- package/src/scanner/registry.ts +301 -0
- package/src/scanner/types.ts +152 -0
- package/src/templates/config/ralph.config.js.tmpl +38 -0
- package/src/templates/guides/AGENTS.md.tmpl +100 -0
- package/src/templates/guides/FRONTEND.md.tmpl +523 -0
- package/src/templates/guides/PERFORMANCE.md.tmpl +264 -0
- package/src/templates/guides/SECURITY.md.tmpl +100 -0
- package/src/templates/prompts/PROMPT.md.tmpl +77 -0
- package/src/templates/prompts/PROMPT_e2e.md.tmpl +234 -0
- package/src/templates/prompts/PROMPT_feature.md.tmpl +83 -0
- package/src/templates/prompts/PROMPT_review.md.tmpl +167 -0
- package/src/templates/prompts/PROMPT_verify.md.tmpl +72 -0
- package/src/templates/root/.gitignore.tmpl +5 -0
- package/src/templates/root/LEARNINGS.md.tmpl +24 -0
- package/src/templates/root/README.md.tmpl +61 -0
- package/src/templates/scripts/feature-loop.sh.tmpl +267 -0
- package/src/templates/scripts/loop.sh.tmpl +59 -0
- package/src/templates/scripts/ralph-monitor.sh.tmpl +244 -0
- package/src/templates/specs/README.md.tmpl +57 -0
- package/src/templates/specs/_example.md.tmpl +71 -0
- package/src/utils/config.ts +221 -0
- package/src/utils/header.ts +15 -0
- package/src/utils/logger.ts +28 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scanner Types
|
|
3
|
+
* Type definitions for the project scanner system
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Result of detecting a single technology/tool
|
|
8
|
+
*/
|
|
9
|
+
export interface DetectionResult {
|
|
10
|
+
/** Name of the detected technology (e.g., "Next.js", "pnpm") */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Version if detectable from package.json */
|
|
13
|
+
version?: string;
|
|
14
|
+
/** Variant or additional context (e.g., "app-router" for Next.js) */
|
|
15
|
+
variant?: string;
|
|
16
|
+
/** Confidence score from 0-100 */
|
|
17
|
+
confidence: number;
|
|
18
|
+
/** Evidence that led to this detection (files found, deps matched) */
|
|
19
|
+
evidence: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* MCP detection result
|
|
24
|
+
*/
|
|
25
|
+
export interface MCPStack {
|
|
26
|
+
/** Detected MCP servers from config */
|
|
27
|
+
detected?: DetectionResult[];
|
|
28
|
+
/** Recommended MCP servers based on stack */
|
|
29
|
+
recommended?: string[];
|
|
30
|
+
/** Is this an MCP server project */
|
|
31
|
+
isProject?: boolean;
|
|
32
|
+
/** MCP project detection result (if it's an MCP server project) */
|
|
33
|
+
projectInfo?: DetectionResult;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Complete detected tech stack for a project
|
|
38
|
+
*/
|
|
39
|
+
export interface DetectedStack {
|
|
40
|
+
// ============ Core ============
|
|
41
|
+
/** Web framework (Next.js, React, Vue, etc.) */
|
|
42
|
+
framework?: DetectionResult;
|
|
43
|
+
/** Package manager (pnpm, yarn, npm, bun) */
|
|
44
|
+
packageManager?: DetectionResult;
|
|
45
|
+
/** Testing frameworks */
|
|
46
|
+
testing?: {
|
|
47
|
+
unit?: DetectionResult;
|
|
48
|
+
e2e?: DetectionResult;
|
|
49
|
+
};
|
|
50
|
+
/** Styling approach (Tailwind, CSS Modules, etc.) */
|
|
51
|
+
styling?: DetectionResult;
|
|
52
|
+
|
|
53
|
+
// ============ Data Layer ============
|
|
54
|
+
/** Database (Supabase, Firebase, MongoDB, PostgreSQL) */
|
|
55
|
+
database?: DetectionResult;
|
|
56
|
+
/** ORM (Prisma, Drizzle) */
|
|
57
|
+
orm?: DetectionResult;
|
|
58
|
+
/** API patterns (tRPC, GraphQL, TanStack Query, REST) - can have multiple */
|
|
59
|
+
api?: DetectionResult[];
|
|
60
|
+
|
|
61
|
+
// ============ Frontend ============
|
|
62
|
+
/** State management (Redux, Zustand, Jotai, Pinia, etc.) */
|
|
63
|
+
stateManagement?: DetectionResult;
|
|
64
|
+
/** UI component libraries (shadcn, Radix, MUI, etc.) - can have multiple */
|
|
65
|
+
uiComponents?: DetectionResult[];
|
|
66
|
+
/** Form handling and validation (React Hook Form, Zod, etc.) - can have multiple */
|
|
67
|
+
formHandling?: DetectionResult[];
|
|
68
|
+
|
|
69
|
+
// ============ Services ============
|
|
70
|
+
/** Auth provider (NextAuth, Clerk, Auth0, Supabase Auth) */
|
|
71
|
+
auth?: DetectionResult;
|
|
72
|
+
/** Analytics (PostHog, Mixpanel, Vercel Analytics, etc.) - can have multiple */
|
|
73
|
+
analytics?: DetectionResult[];
|
|
74
|
+
/** Payment provider (Stripe, Lemon Squeezy, Paddle) */
|
|
75
|
+
payments?: DetectionResult;
|
|
76
|
+
/** Email provider (Resend, SendGrid, Nodemailer) */
|
|
77
|
+
email?: DetectionResult;
|
|
78
|
+
|
|
79
|
+
// ============ Infrastructure ============
|
|
80
|
+
/** Deployment targets (Vercel, Netlify, Railway, Docker) - can have multiple */
|
|
81
|
+
deployment?: DetectionResult[];
|
|
82
|
+
/** Monorepo tools (Turborepo, Nx, pnpm workspaces, Lerna) */
|
|
83
|
+
monorepo?: DetectionResult;
|
|
84
|
+
|
|
85
|
+
// ============ MCP ============
|
|
86
|
+
/** MCP (Model Context Protocol) related detection */
|
|
87
|
+
mcp?: MCPStack;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Category of detector
|
|
92
|
+
*/
|
|
93
|
+
export type DetectorCategory =
|
|
94
|
+
// Core
|
|
95
|
+
| 'framework'
|
|
96
|
+
| 'packageManager'
|
|
97
|
+
| 'testing'
|
|
98
|
+
| 'styling'
|
|
99
|
+
// Data Layer
|
|
100
|
+
| 'database'
|
|
101
|
+
| 'orm'
|
|
102
|
+
| 'api'
|
|
103
|
+
// Frontend
|
|
104
|
+
| 'stateManagement'
|
|
105
|
+
| 'uiComponents'
|
|
106
|
+
| 'formHandling'
|
|
107
|
+
// Services
|
|
108
|
+
| 'auth'
|
|
109
|
+
| 'analytics'
|
|
110
|
+
| 'payments'
|
|
111
|
+
| 'email'
|
|
112
|
+
// Infrastructure
|
|
113
|
+
| 'deployment'
|
|
114
|
+
| 'monorepo'
|
|
115
|
+
// MCP
|
|
116
|
+
| 'mcp';
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Interface for a detector function
|
|
120
|
+
*/
|
|
121
|
+
export interface Detector {
|
|
122
|
+
/** Category this detector belongs to */
|
|
123
|
+
category: DetectorCategory;
|
|
124
|
+
/** Human-readable name */
|
|
125
|
+
name: string;
|
|
126
|
+
/** Run detection on a project directory */
|
|
127
|
+
detect: (projectRoot: string) => Promise<DetectionResult | DetectionResult[] | null>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Options for the scanner
|
|
132
|
+
*/
|
|
133
|
+
export interface ScannerOptions {
|
|
134
|
+
/** Whether to include low-confidence results */
|
|
135
|
+
includeLowConfidence?: boolean;
|
|
136
|
+
/** Minimum confidence threshold (0-100) */
|
|
137
|
+
minConfidence?: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Result of a full project scan
|
|
142
|
+
*/
|
|
143
|
+
export interface ScanResult {
|
|
144
|
+
/** Path that was scanned */
|
|
145
|
+
projectRoot: string;
|
|
146
|
+
/** Detected tech stack */
|
|
147
|
+
stack: DetectedStack;
|
|
148
|
+
/** Time taken to scan in milliseconds */
|
|
149
|
+
scanTime: number;
|
|
150
|
+
/** Any errors encountered during scanning */
|
|
151
|
+
errors?: string[];
|
|
152
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
name: '{{projectName}}',
|
|
3
|
+
stack: {
|
|
4
|
+
framework: {
|
|
5
|
+
name: '{{framework}}',
|
|
6
|
+
version: '{{frameworkVersion}}',
|
|
7
|
+
variant: '{{frameworkVariant}}',
|
|
8
|
+
},
|
|
9
|
+
packageManager: '{{packageManager}}',
|
|
10
|
+
testing: {
|
|
11
|
+
unit: '{{unitTest}}',
|
|
12
|
+
e2e: '{{e2eTest}}',
|
|
13
|
+
},
|
|
14
|
+
styling: '{{styling}}',
|
|
15
|
+
},
|
|
16
|
+
commands: {
|
|
17
|
+
dev: '{{devCommand}}',
|
|
18
|
+
build: '{{buildCommand}}',
|
|
19
|
+
test: '{{testCommand}}',
|
|
20
|
+
lint: '{{lintCommand}}',
|
|
21
|
+
typecheck: '{{typecheckCommand}}',
|
|
22
|
+
},
|
|
23
|
+
paths: {
|
|
24
|
+
root: '.ralph',
|
|
25
|
+
prompts: '.ralph/prompts',
|
|
26
|
+
guides: '.ralph/guides',
|
|
27
|
+
specs: '.ralph/specs',
|
|
28
|
+
scripts: '.ralph/scripts',
|
|
29
|
+
learnings: '.ralph/LEARNINGS.md',
|
|
30
|
+
agents: '.ralph/AGENTS.md',
|
|
31
|
+
},
|
|
32
|
+
loop: {
|
|
33
|
+
maxIterations: 10,
|
|
34
|
+
maxE2eAttempts: 5,
|
|
35
|
+
defaultModel: 'sonnet',
|
|
36
|
+
planningModel: 'opus',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Stack
|
|
4
|
+
{{framework}}{{#if frameworkVersion}} {{frameworkVersion}}{{/if}}{{#if frameworkVariant}} ({{frameworkVariant}}){{/if}}, TypeScript, {{styling || css}}{{#if unitTest}}, {{unitTest}}{{/if}}{{#if e2eTest}}, {{e2eTest}}{{/if}}
|
|
5
|
+
|
|
6
|
+
## Commands
|
|
7
|
+
All commands run from `{{appDir}}/` directory:
|
|
8
|
+
|
|
9
|
+
| Action | Command |
|
|
10
|
+
|--------|---------|
|
|
11
|
+
| Dev | `cd {{appDir}} && {{devCommand}}` |
|
|
12
|
+
| Build | `cd {{appDir}} && {{buildCommand}}` |
|
|
13
|
+
| Lint | `cd {{appDir}} && {{lintCommand}}` |
|
|
14
|
+
| Lint fix | `cd {{appDir}} && {{lintCommand}} -- --fix` |
|
|
15
|
+
| Format | `cd {{appDir}} && {{formatCommand}}` |
|
|
16
|
+
| Typecheck | `cd {{appDir}} && {{typecheckCommand}}` |
|
|
17
|
+
{{#if unitTest}}| Test | `cd {{appDir}} && {{testCommand}}` |
|
|
18
|
+
| Test watch | `cd {{appDir}} && {{testCommand}} -- --watch` |{{/if}}
|
|
19
|
+
|
|
20
|
+
## Validation (run before commit)
|
|
21
|
+
```bash
|
|
22
|
+
cd {{appDir}} && {{lintCommand}} -- --fix && {{typecheckCommand}}{{#if unitTest}} && {{testCommand}}{{/if}} && {{buildCommand}}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Security Review (run before commit)
|
|
26
|
+
```bash
|
|
27
|
+
cd {{appDir}} && {{packageManager}} audit # Check vulnerable dependencies
|
|
28
|
+
```
|
|
29
|
+
Then review changes against @.ralph/guides/SECURITY.md checklist.
|
|
30
|
+
Use `mcp__supabase__get_advisors` with type "security" to check RLS policies.
|
|
31
|
+
|
|
32
|
+
## Patterns
|
|
33
|
+
- Pages: `{{appDir}}/app/` - Next.js App Router
|
|
34
|
+
- Components: `{{appDir}}/components/` - see ui/, ai-elements/, survey-editor/
|
|
35
|
+
- API: `{{appDir}}/app/api/` - streaming endpoints with tool calling
|
|
36
|
+
- Store: `{{appDir}}/store/` - State management
|
|
37
|
+
- Server Actions: `{{appDir}}/app/actions.ts` and `{{appDir}}/app/actions/`
|
|
38
|
+
- Libs: `{{appDir}}/lib/` - utilities and integrations
|
|
39
|
+
|
|
40
|
+
## Search Tools
|
|
41
|
+
- **Codebase search**: Use `mgrep "query"` (preferred over Grep/Glob)
|
|
42
|
+
- **Documentation lookup**: Use Context7 MCP for library/framework docs
|
|
43
|
+
- **Web search**: Use `mgrep --web "query"` for general web lookups
|
|
44
|
+
|
|
45
|
+
## Code Rules
|
|
46
|
+
- Explicit return types on functions
|
|
47
|
+
- No `any` - use `unknown` if truly unknown
|
|
48
|
+
- Early returns over nested conditionals
|
|
49
|
+
- Named exports, not default exports
|
|
50
|
+
- Path alias `@/` maps to `{{appDir}}/` root
|
|
51
|
+
- Follow patterns in existing components
|
|
52
|
+
- 2-space indentation, single quotes
|
|
53
|
+
- PascalCase for components, `use` prefix for hooks
|
|
54
|
+
- kebab-case for folder names (e.g., `survey-editor`)
|
|
55
|
+
|
|
56
|
+
{{#if unitTest}}## Testing
|
|
57
|
+
- Framework: {{unitTest}}{{#if unitTestVersion}} {{unitTestVersion}}{{/if}}
|
|
58
|
+
- Test location: next to component as `*.test.tsx` or in `__tests__/`
|
|
59
|
+
- Run: `cd {{appDir}} && {{testCommand}}`
|
|
60
|
+
- Each feature task should include tests
|
|
61
|
+
- Validation fails if tests fail
|
|
62
|
+
{{/if}}
|
|
63
|
+
|
|
64
|
+
## Secrets
|
|
65
|
+
- Use `.env.local` for secrets, never commit API keys
|
|
66
|
+
- Use `process.env.*` for all secrets
|
|
67
|
+
|
|
68
|
+
## Git
|
|
69
|
+
- Commits: `type(scope): description` (conventional commits)
|
|
70
|
+
- Types: feat, fix, docs, refactor, test, chore
|
|
71
|
+
- After changes: validate, commit, push
|
|
72
|
+
|
|
73
|
+
## MCP Servers Available
|
|
74
|
+
- **Supabase**: Query DB, manage migrations, generate types
|
|
75
|
+
- **PostHog**: Analytics, feature flags, experiments
|
|
76
|
+
- **Playwright**: Browser automation for E2E testing
|
|
77
|
+
- Navigate: `browser_navigate`, `browser_snapshot`
|
|
78
|
+
- Interact: `browser_click`, `browser_type`, `browser_fill_form`
|
|
79
|
+
- Verify: `browser_wait_for`, `browser_console_messages`
|
|
80
|
+
- Debug: `browser_take_screenshot`
|
|
81
|
+
- **Codex CLI** (shell command, not MCP): PR review
|
|
82
|
+
- Command: `echo "prompt" | codex exec --full-auto -`
|
|
83
|
+
- For reviews: `codex review --base main` (interactive mode)
|
|
84
|
+
- Location: `/opt/homebrew/bin/codex`
|
|
85
|
+
- Use for: code review, PR feedback before merge
|
|
86
|
+
- **Context7**: Documentation lookup for libraries/frameworks
|
|
87
|
+
|
|
88
|
+
## Quick Triggers
|
|
89
|
+
| Keywords | Action |
|
|
90
|
+
|----------|--------|
|
|
91
|
+
| type error, ts | Run typecheck |
|
|
92
|
+
| lint, format | Run lint --fix and prettier |
|
|
93
|
+
| deploy, build | Run full build |
|
|
94
|
+
| error, debug | Check PostHog logs or console |
|
|
95
|
+
| database, table | Use Supabase MCP |
|
|
96
|
+
| e2e, browser test | Use Playwright MCP |
|
|
97
|
+
|
|
98
|
+
## Detailed Docs
|
|
99
|
+
- Architecture: `{{appDir}}/.claude/CLAUDE.md` - comprehensive codebase details
|
|
100
|
+
- Frontend: `.ralph/guides/FRONTEND.md` - design patterns, component usage, quality checklist
|