Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .agents/skills/constructive-monorepo-setup/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Constructive Monorepo Setup

Set up the Constructive monorepo for local development and testing.

## Prerequisites

- Node.js 20+
- pnpm 9+
- Docker (for PostgreSQL)
- pgpm CLI (`npm install -g pgpm`)

## Quick Start

```bash
# 1. Install dependencies
pnpm install

# 2. Start PostgreSQL via pgpm Docker
pgpm docker start --image docker.io/constructiveio/postgres-plus:18 --recreate

# 3. Load environment variables
eval "$(pgpm env)"

# 4. Bootstrap admin users for testing
pgpm admin-users bootstrap --yes
pgpm admin-users add --test --yes

# 5. Build the monorepo
pnpm build

# 6. Run tests in a specific package
cd packages/<yourmodule>
pnpm test
```

## Docker Image

Use `docker.io/constructiveio/postgres-plus:18` which includes PostgreSQL with PostGIS, pgvector, pg_textsearch, pg_trgm, btree_gin, and uuid-ossp extensions.

For detailed Docker and pgpm usage, see the [pgpm skill](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/pgpm) in the public skills repo.

## Monorepo Navigation

See [AGENTS.md](../../AGENTS.md) at the repo root for the full navigation guide covering:
- Package layout (`packages/*`, `pgpm/*`, `graphql/*`, `postgres/*`, `graphile/*`)
- Entry points (PGPM CLI, Constructive CLI, GraphQL Server)
- Environment configuration patterns
- Testing framework selection guide

## Code Generation (SDK)

To regenerate the GraphQL SDK after schema changes:

```bash
# Generate types, hooks, ORM, and CLI from a running GraphQL endpoint
cnc codegen
```

Skills are auto-generated to `.agents/skills/` when `docs.skills: true` is set in the codegen config.

For detailed codegen configuration, see the [constructive-graphql skill](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql) — specifically the [codegen.md reference](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql/references/codegen.md).

## Graphile Plugin Development

Graphile plugins live under `graphile/*`. For PostGIS plugin development and testing, see the [constructive-graphql skill](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql) — specifically the [search-postgis.md reference](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql/references/search-postgis.md).

## Testing

See [AGENTS.md](../../AGENTS.md) for the testing framework selection guide. For comprehensive database testing patterns, see the [constructive-testing skill](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-testing).

## Related Skills

- [pgpm](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/pgpm) — Docker, migrations, deploy/verify/revert
- [constructive-graphql](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-graphql) — Codegen, search, PostGIS
- [constructive-testing](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-testing) — pgsql-test, drizzle-orm-test
- [constructive-tooling](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-tooling) — pnpm workspace, makage builds
- [constructive-setup](https://github.com/constructive-io/constructive-skills/tree/main/.agents/skills/constructive-setup) — Full setup guide (public skills repo)
2 changes: 1 addition & 1 deletion graphql/codegen/src/core/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function resolveSkillsOutputDir(
: path.resolve(workspaceRoot, config.skillsPath);
}

return path.resolve(workspaceRoot, 'skills');
return path.resolve(workspaceRoot, '.agents/skills');
}

export async function generate(
Expand Down
2 changes: 1 addition & 1 deletion graphql/codegen/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ export interface GraphQLSDKConfigTarget {
/**
* Custom path for generated skill files.
* When set, skills are written to this directory.
* When undefined (default), skills are written to {workspaceRoot}/skills/
* When undefined (default), skills are written to {workspaceRoot}/.agents/skills/
* where workspaceRoot is auto-detected by walking up from the output directory
* looking for pnpm-workspace.yaml, lerna.json, or package.json with workspaces.
*/
Expand Down
Loading