You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+76-1Lines changed: 76 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,8 +62,83 @@ This guide helps AI agents quickly navigate the Constructive monorepo. Construct
62
62
- Generate types/SDK: `cnc codegen`
63
63
- Export schema SDL: `cnc get-graphql-schema`
64
64
65
+
## Best Practices
66
+
67
+
### Environment Configuration
68
+
69
+
Always use the unified environment configuration system — never read `process.env` directly for config values.
70
+
71
+
-**PGPM packages** (`pgpm/*`): `import { getEnvOptions } from '@pgpmjs/env'`
72
+
-**GraphQL/Constructive packages** (`graphql/*`, `packages/cli`): `import { getEnvOptions } from '@constructive-io/graphql-env'`
73
+
-**PostgreSQL tools** (`postgres/*`): `import { getPgEnvOptions } from 'pg-env'` or `@pgpmjs/env`
74
+
75
+
The system provides typed defaults, config file discovery (`pgpm.json`), env var parsing, and a clean merge hierarchy: **defaults → config file → env vars → runtime overrides**.
Constructive provides a layered testing framework stack. **Always use the appropriate framework** — never manually create `pg.Pool` or `pg.Client` instances in tests.
90
+
91
+
#### Which Framework to Use
92
+
93
+
| Scenario | Framework | Import |
94
+
|----------|-----------|--------|
95
+
| Raw SQL, RLS policies, database functions |`pgsql-test`|`import { getConnections } from 'pgsql-test'`|
0 commit comments