Updated for v3.0.0 | Agent instructions:
AGENTS.md| Persona routing:specs/team/TEAM_SELECTION.md| Coding standards:specs/ARCHITECTURE.md
This guide provides detailed information for developers working on the TestOps Copilot project.
For installation and setup instructions, see the Quick Start Guide.
- ESLint
- Prettier
- Docker
- GitLens
- Jest Runner
- Mermaid Preview
testops-copilot/
├── backend/ # Backend application
│ ├── src/
│ │ ├── config/ # Configuration files
│ │ ├── controllers/ # Request handlers
│ │ ├── database/ # Database setup and models
│ │ ├── middleware/ # Express middleware
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic
│ │ ├── types/ # TypeScript type definitions
│ │ └── utils/ # Utility functions
│ ├── tests/ # Test files
│ └── prisma/ # Database schema and migrations
│
├── frontend/ # Frontend application
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── contexts/ # React contexts
│ │ ├── hooks/ # Custom React hooks
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ ├── styles/ # Global styles
│ │ ├── types/ # TypeScript type definitions
│ │ └── utils/ # Utility functions
│ └── tests/ # Test files
│
└── docs/ # Documentation
- Use TypeScript for all new code
- Enable strict mode
- Define interfaces for all data structures
- Use enums for fixed sets of values
- Avoid using
anytype - Use type inference when possible
// Good
interface User {
id: string;
name: string;
role: UserRole;
}
enum UserRole {
Admin = 'admin',
User = 'user',
}
// Bad
const user: any = { id: 1, name: 'John' };- Use functional components with hooks
- Implement proper error boundaries
- Use TypeScript for props definitions
- Implement proper loading states
- Handle edge cases and errors
interface Props {
user: User;
onUpdate: (user: User) => Promise<void>;
}
const UserProfile: React.FC<Props> = ({ user, onUpdate }) => {
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<Error | null>(null);
// Component implementation
};- Use RESTful conventions
- Implement proper error handling
- Include request validation
- Document all endpoints
- Include rate limiting
- Implement proper security measures
router.post('/users',
validateInput(createUserSchema),
rateLimit({ windowMs: 15 * 60 * 1000, max: 5 }),
async (req, res, next) => {
try {
const user = await userService.create(req.body);
res.status(201).json(user);
} catch (error) {
next(error);
}
}
);- Write unit tests for all services
- Write integration tests for API endpoints
- Use Jest for testing
- Aim for high test coverage
describe('UserService', () => {
it('should create a new user', async () => {
const userData = {
email: 'test@example.com',
password: 'password123',
};
const user = await userService.create(userData);
expect(user).toHaveProperty('id');
expect(user.email).toBe(userData.email);
});
});- Write unit tests for components
- Write integration tests for pages
- Use React Testing Library
- Implement E2E tests with Cypress
describe('LoginPage', () => {
it('should log in successfully', () => {
render(<LoginPage />);
fireEvent.change(screen.getByLabelText(/email/i), {
target: { value: 'test@example.com' },
});
fireEvent.change(screen.getByLabelText(/password/i), {
target: { value: 'password123' },
});
fireEvent.click(screen.getByRole('button', { name: /login/i }));
expect(screen.getByText(/welcome/i)).toBeInTheDocument();
});
});- Create a feature branch:
git checkout -b feature/new-feature- Make changes and commit:
git add .
git commit -m "feat: add new feature"- Keep branch updated:
git fetch origin
git rebase origin/main- Push changes:
git push origin feature/new-feature- Create pull request
Follow the Conventional Commits specification:
type(scope): description
[optional body]
[optional footer]
Types:
- feat: New feature
- fix: Bug fix
- docs: Documentation
- style: Code style changes
- refactor: Code refactoring
- test: Adding tests
- chore: Maintenance
cd backend
npm run migrate:dev -- --name add_user_rolenpm run migrate- Document all new features
- Update API documentation
- Include JSDoc comments
- Update README when needed
- Document breaking changes
- Implement proper caching
- Optimize database queries
- Use pagination for lists
- Implement proper indexing
- Monitor performance metrics
- Follow OWASP guidelines
- Implement proper authentication
- Use input validation
- Implement rate limiting
- Use secure headers
- Keep dependencies updated
- Use VS Code debugger:
{
"type": "node",
"request": "launch",
"name": "Debug Backend",
"program": "${workspaceFolder}/backend/src/server.ts",
"preLaunchTask": "tsc: build - backend/tsconfig.json",
"outFiles": ["${workspaceFolder}/backend/dist/**/*.js"]
}- Use React Developer Tools
- Use browser developer tools
- Use debug logging:
const debug = require('debug')('app:component:name');
debug('Debugging information');- Use structured logging
- Implement proper error tracking
- Monitor performance metrics
- Set up alerts for issues
- Maintain audit logs
- All tests must pass
- Code coverage requirements
- Linting requirements
- Type checking
- Security scanning
- Performance testing
- Check existing issues
- Create detailed bug reports
- Include reproduction steps
- Provide relevant logs
- Use issue templates