Skip to content

Commit 7720452

Browse files
committed
Cleanup AGENTS files
1 parent dc7eefe commit 7720452

File tree

3 files changed

+7
-78
lines changed

3 files changed

+7
-78
lines changed

AGENTS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ cd docs && npm run build # Build documentation
6464
- `backend/infrahub/core/protocols.py` – Protocol definitions
6565
- `frontend/app/src/shared/api/graphql/generated/` – GraphQL types
6666
- `frontend/app/src/shared/api/rest/types.generated.ts` – REST types
67+
- `schema/schema.graphql` - GraphQL schema of the Core Schema
68+
- `schema/openapi.json` - OpenAPI schema for the REST API
6769

6870
Regenerate with: `uv run invoke backend.generate` or `cd frontend/app && npm run codegen`
6971

@@ -89,7 +91,7 @@ When editing markdown files (enforced by markdownlint):
8991

9092
- Run formatters before committing (`uv run invoke format`, `npm run biome:fix`)
9193
- Write tests for new functionality
92-
- Use type hints (Python) and TypeScript types (frontend)
94+
- Use type hints for Python (backend) and TypeScript types (frontend)
9395

9496
### Ask First
9597

backend/AGENTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async def get_node(db: InfrahubDatabase, node_id: str) -> Node:
3838
await query.execute(db=db)
3939
return query.get_node()
4040

41-
# ❌ Bad - blocks event loop
41+
# ❌ Bad - blocks event loop, no type hints
4242
def get_node(db, node_id):
4343
return db.get(node_id)
4444
```
@@ -50,8 +50,8 @@ def get_node(db, node_id):
5050
from pydantic import BaseModel, Field
5151

5252
class BranchCreateInput(BaseModel):
53-
name: str = Field(..., min_length=1, max_length=250)
54-
description: str | None = None
53+
name: str = Field(..., min_length=1, max_length=250, description="name of the branch")
54+
description: str | None = Field(default=None, description="Description of the branch")
5555

5656
# ❌ Bad
5757
branch_data = {"name": "feature-x", "description": None}
@@ -102,7 +102,7 @@ class MyQuery(Query):
102102

103103
## Testing
104104

105-
- Unit tests: no external dependencies, mock everything
105+
- Unit tests: no external dependencies except database
106106
- Integration tests: require Neo4j via testcontainers
107107
- Test files mirror source: `infrahub/core/node.py``tests/unit/core/test_node.py`
108108
- Async tests auto-configured via pytest-asyncio

frontend/app/AGENTS.md

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -25,76 +25,3 @@ npm run test:e2e # E2E tests (Playwright)
2525
npm run biome:fix # Format and lint
2626
npm run codegen # Regenerate GraphQL types
2727
```
28-
29-
## Code Style
30-
31-
### Components
32-
33-
```typescript
34-
// ✅ Good - Typed props, functional component
35-
interface NodeCardProps {
36-
node: Node;
37-
onSelect: (id: string) => void;
38-
}
39-
40-
export function NodeCard({ node, onSelect }: NodeCardProps) {
41-
return (
42-
<div className="p-4 rounded-lg" onClick={() => onSelect(node.id)}>
43-
{node.display_label}
44-
</div>
45-
);
46-
}
47-
48-
// ❌ Bad - Untyped, inline styles
49-
export function NodeCard(props) {
50-
return <div style={{ padding: 16 }}>{props.node.display_label}</div>;
51-
}
52-
```
53-
54-
### GraphQL
55-
56-
```typescript
57-
// ✅ Good - Use generated types
58-
import type { GetNodesQuery } from "@/shared/api/graphql/generated";
59-
60-
const { data } = useQuery<GetNodesQuery>(GET_NODES);
61-
```
62-
63-
### Naming Conventions
64-
65-
- **Components:** `PascalCase.tsx`
66-
- **Hooks:** `useSomething.ts`
67-
- **Utilities:** `camelCase.ts`
68-
- **Constants:** `UPPER_SNAKE_CASE`
69-
70-
### Import Order (Biome enforced)
71-
72-
```typescript
73-
import { useState } from "react"; // React
74-
import { useQuery } from "@apollo/client"; // External packages
75-
import { useConfig } from "@/config"; // Internal aliases
76-
import { NodeCard } from "@/shared/..."; // Shared
77-
import { useNodeData } from "@/entities/..."; // Entities
78-
import "./styles.css"; // Local
79-
```
80-
81-
## Boundaries
82-
83-
### Always Do
84-
85-
- Run `npm run biome:fix` before committing
86-
- Use TypeScript types for all props and state
87-
- Use Tailwind classes (no inline styles)
88-
- Use generated GraphQL types
89-
90-
### Ask First
91-
92-
- New dependencies
93-
- New page routes
94-
- GraphQL query changes affecting multiple components
95-
96-
### Never Do
97-
98-
- Edit files in `src/shared/api/graphql/generated/`
99-
- Use `console.log` (use `console.error`, `warn`, `info`)
100-
- Use `any` type without justification

0 commit comments

Comments
 (0)