claudex-setup 1.2.0 → 1.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.
- package/package.json +1 -1
- package/src/setup.js +79 -10
- package/src/techniques.js +2 -0
package/package.json
CHANGED
package/src/setup.js
CHANGED
|
@@ -96,10 +96,47 @@ function detectDependencies(ctx) {
|
|
|
96
96
|
guidelines.push('- Use Playwright for E2E tests. Keep tests in tests/ or e2e/');
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// tRPC
|
|
100
|
+
if (allDeps['@trpc/server'] || allDeps['@trpc/client']) {
|
|
101
|
+
guidelines.push('- Use tRPC for type-safe API calls. Define routers in server, use client hooks in components');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Stripe
|
|
105
|
+
if (allDeps['stripe']) {
|
|
106
|
+
guidelines.push('- Use Stripe SDK for payments. Always verify webhooks with stripe.webhooks.constructEvent()');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Resend
|
|
110
|
+
if (allDeps['resend']) {
|
|
111
|
+
guidelines.push('- Use Resend for transactional email. Define templates as React components');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Express security
|
|
115
|
+
if (allDeps['helmet']) {
|
|
116
|
+
guidelines.push('- Helmet is configured — ensure all middleware is applied before routes');
|
|
117
|
+
}
|
|
118
|
+
if (allDeps['jsonwebtoken']) {
|
|
119
|
+
guidelines.push('- Use JWT for authentication. Always verify tokens with the correct secret/algorithm');
|
|
120
|
+
}
|
|
121
|
+
if (allDeps['bcrypt']) {
|
|
122
|
+
guidelines.push('- Use bcrypt for password hashing. Never store plaintext passwords');
|
|
123
|
+
}
|
|
124
|
+
if (allDeps['cors']) {
|
|
125
|
+
guidelines.push('- CORS is configured — restrict origins to known domains in production');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Monorepo
|
|
129
|
+
if (allDeps['turbo'] || allDeps['turborepo']) {
|
|
130
|
+
guidelines.push('- Turborepo monorepo — use `turbo run` for all tasks. Respect package boundaries');
|
|
131
|
+
}
|
|
132
|
+
if (allDeps['nx']) {
|
|
133
|
+
guidelines.push('- Nx monorepo — use `nx affected` for incremental builds and tests');
|
|
134
|
+
}
|
|
135
|
+
|
|
99
136
|
// Python
|
|
100
137
|
const reqTxt = ctx.fileContent('requirements.txt') || '';
|
|
101
138
|
if (reqTxt.includes('sqlalchemy')) {
|
|
102
|
-
guidelines.push('- Use SQLAlchemy for
|
|
139
|
+
guidelines.push('- Use SQLAlchemy for database operations. Define models in models/');
|
|
103
140
|
}
|
|
104
141
|
if (reqTxt.includes('pydantic')) {
|
|
105
142
|
guidelines.push('- Use Pydantic for data validation and serialization');
|
|
@@ -107,6 +144,15 @@ function detectDependencies(ctx) {
|
|
|
107
144
|
if (reqTxt.includes('pytest')) {
|
|
108
145
|
guidelines.push('- Use pytest for testing. Run with `python -m pytest`');
|
|
109
146
|
}
|
|
147
|
+
if (reqTxt.includes('alembic')) {
|
|
148
|
+
guidelines.push('- Use Alembic for database migrations. Run `alembic upgrade head` after model changes');
|
|
149
|
+
}
|
|
150
|
+
if (reqTxt.includes('celery')) {
|
|
151
|
+
guidelines.push('- Use Celery for background tasks. Define tasks in tasks/ or services/');
|
|
152
|
+
}
|
|
153
|
+
if (reqTxt.includes('redis')) {
|
|
154
|
+
guidelines.push('- Redis is available for caching and task queues');
|
|
155
|
+
}
|
|
110
156
|
|
|
111
157
|
return guidelines;
|
|
112
158
|
}
|
|
@@ -342,18 +388,29 @@ function getFrameworkInstructions(stacks) {
|
|
|
342
388
|
|
|
343
389
|
if (stackKeys.includes('rust')) {
|
|
344
390
|
sections.push(`### Rust
|
|
345
|
-
-
|
|
346
|
-
-
|
|
347
|
-
-
|
|
348
|
-
-
|
|
391
|
+
- Use Result<T, E> for error handling, avoid unwrap() in production code
|
|
392
|
+
- Prefer &str over String for function parameters
|
|
393
|
+
- Use clippy: \`cargo clippy -- -D warnings\`
|
|
394
|
+
- Structure: src/lib.rs for library, src/main.rs for binary`);
|
|
349
395
|
}
|
|
350
396
|
|
|
351
397
|
if (stackKeys.includes('go')) {
|
|
352
398
|
sections.push(`### Go
|
|
353
|
-
- Follow standard project layout
|
|
354
|
-
-
|
|
355
|
-
-
|
|
356
|
-
-
|
|
399
|
+
- Follow standard Go project layout (cmd/, internal/, pkg/)
|
|
400
|
+
- Use interfaces for dependency injection and testability
|
|
401
|
+
- Handle all errors explicitly — never ignore err returns
|
|
402
|
+
- Use context.Context for cancellation and timeouts
|
|
403
|
+
- Prefer table-driven tests
|
|
404
|
+
- Run \`go vet\` and \`golangci-lint\` before committing`);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (stackKeys.includes('terraform')) {
|
|
408
|
+
sections.push(`### Terraform
|
|
409
|
+
- Use modules for reusable infrastructure components
|
|
410
|
+
- Always run \`terraform plan\` before \`terraform apply\`
|
|
411
|
+
- Store state remotely (S3 + DynamoDB, or Terraform Cloud)
|
|
412
|
+
- Use variables.tf for all configurable values
|
|
413
|
+
- Tag all resources consistently`);
|
|
357
414
|
}
|
|
358
415
|
|
|
359
416
|
const hasJS = stackKeys.some(k => ['react', 'vue', 'angular', 'nextjs', 'node', 'svelte'].includes(k));
|
|
@@ -726,8 +783,10 @@ Fix the GitHub issue: $ARGUMENTS
|
|
|
726
783
|
const rules = {};
|
|
727
784
|
const hasTS = stacks.some(s => s.key === 'typescript');
|
|
728
785
|
const hasPython = stacks.some(s => s.key === 'python');
|
|
786
|
+
const hasFrontend = stacks.some(s => ['react', 'vue', 'angular', 'svelte', 'nextjs'].includes(s.key));
|
|
787
|
+
const hasBackend = stacks.some(s => ['go', 'python', 'django', 'fastapi', 'rust', 'java'].includes(s.key));
|
|
729
788
|
|
|
730
|
-
if (
|
|
789
|
+
if (hasFrontend || (hasTS && !hasBackend)) {
|
|
731
790
|
rules['frontend.md'] = `When editing JavaScript/TypeScript files (*.ts, *.tsx, *.js, *.jsx, *.vue):
|
|
732
791
|
- Use functional components with hooks (React/Vue 3)
|
|
733
792
|
- Add TypeScript interfaces for all props and function params
|
|
@@ -735,6 +794,16 @@ Fix the GitHub issue: $ARGUMENTS
|
|
|
735
794
|
- Use named exports over default exports
|
|
736
795
|
- Handle errors explicitly — no empty catch blocks
|
|
737
796
|
- Keep component files under 200 lines; extract sub-components
|
|
797
|
+
`;
|
|
798
|
+
}
|
|
799
|
+
if (hasBackend) {
|
|
800
|
+
rules['backend.md'] = `When editing backend code:
|
|
801
|
+
- Handle all errors explicitly — never swallow exceptions silently
|
|
802
|
+
- Validate all external input at API boundaries
|
|
803
|
+
- Use dependency injection for testability
|
|
804
|
+
- Keep route handlers thin — delegate to service/business logic layers
|
|
805
|
+
- Log errors with sufficient context for debugging
|
|
806
|
+
- Never hardcode secrets or credentials
|
|
738
807
|
`;
|
|
739
808
|
}
|
|
740
809
|
if (hasPython) {
|
package/src/techniques.js
CHANGED
|
@@ -953,6 +953,8 @@ const STACKS = {
|
|
|
953
953
|
java: { files: ['pom.xml'], content: {}, label: 'Java' },
|
|
954
954
|
kotlin: { files: ['build.gradle.kts'], content: {}, label: 'Kotlin' },
|
|
955
955
|
swift: { files: ['Package.swift'], content: {}, label: 'Swift' },
|
|
956
|
+
terraform: { files: ['main.tf', 'terraform'], content: {}, label: 'Terraform' },
|
|
957
|
+
kubernetes: { files: ['k8s', 'kubernetes', 'helm'], content: {}, label: 'Kubernetes' },
|
|
956
958
|
};
|
|
957
959
|
|
|
958
960
|
module.exports = { TECHNIQUES, STACKS };
|