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
11 changes: 9 additions & 2 deletions skills/pgpm-boilerplates/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PGPM uses the `genomic` library to scaffold projects from templates. Templates a
```
my-boilerplates/
.boilerplates.json # Root config (points to default directory)
default/ # Default template variant
pgpm/ # Default template variant (PGPM)
module/
.boilerplate.json # Module template config
package.json # Template files with placeholders
Expand All @@ -37,7 +37,7 @@ The `.boilerplates.json` file at the repository root specifies the default templ

```json
{
"dir": "default"
"dir": "pgpm"
}
```

Expand Down Expand Up @@ -257,6 +257,13 @@ pgpm init workspace --repo myorg/my-boilerplates --from-branch develop

# Use a variant directory
pgpm init workspace --repo myorg/my-boilerplates --dir custom-variant

# Use the --template flag (recommended)
pgpm init --template pnpm/module --repo myorg/my-boilerplates
pgpm init -t custom-variant/module --repo myorg/my-boilerplates

# Create workspace + module in one command
pgpm init -t pnpm/module -w --repo myorg/my-boilerplates
```

## Best Practices
Expand Down
12 changes: 10 additions & 2 deletions skills/pgpm-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,16 @@ pgpm init workspace
# Create new module (inside workspace)
pgpm init

# Use custom template
pgpm init --repo https://github.com/org/templates.git --template-path my-template
# Use full template path (recommended)
pgpm init --template pnpm/module
pgpm init -t pgpm/workspace

# Create workspace + module in one command
pgpm init -w
pgpm init --template pnpm/module -w

# Use custom template repository
pgpm init --repo https://github.com/org/templates.git --template my-template
```

### Change Management
Expand Down
58 changes: 47 additions & 11 deletions skills/pgpm-init-templates/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ The `--boilerplate` flag enables interactive selection from all available templa

The default boilerplate repository (`constructive-io/pgpm-boilerplates`) provides these templates:

### Default Variant (PGPM)
### PGPM Variant (Default)

| Template | Command | Description |
|----------|---------|-------------|
| `default/workspace` | `pgpm init workspace` | PGPM workspace with pgpm.json, migrations support |
| `default/module` | `pgpm init` | PGPM module with pgpm.plan, .control file |
| `pgpm/workspace` | `pgpm init workspace` or `pgpm init -t pgpm/workspace` | PGPM workspace with pgpm.json, migrations support |
| `pgpm/module` | `pgpm init` or `pgpm init -t pgpm/module` | PGPM module with pgpm.plan, .control file |

### PNPM Variant (Pure TypeScript/JavaScript)

| Template | Command | Description |
|----------|---------|-------------|
| `pnpm/workspace` | `pgpm init workspace --dir pnpm` | Pure PNPM workspace (no pgpm files) |
| `pnpm/module` | `pgpm init --dir pnpm` | Pure PNPM package (no pgpm.plan/.control) |
| `pnpm/workspace` | `pgpm init workspace --dir pnpm` or `pgpm init -t pnpm/workspace` | Pure PNPM workspace (no pgpm files) |
| `pnpm/module` | `pgpm init --dir pnpm` or `pgpm init -t pnpm/module` | Pure PNPM package (no pgpm.plan/.control) |

## Using --boilerplate

Expand All @@ -42,18 +42,48 @@ pgpm init pnpm/workspace --boilerplate
pgpm init pnpm/module --boilerplate
```

## Using --template (Recommended)

The `--template` flag (or `-t`) provides a cleaner syntax for specifying templates:

```bash
# Create PNPM workspace
pgpm init --template pnpm/workspace
pgpm init -t pnpm/workspace

# Create PNPM module
pgpm init --template pnpm/module
pgpm init -t pnpm/module

# Create PGPM workspace
pgpm init -t pgpm/workspace

# Create workspace + module in one command
pgpm init -t pnpm/module -w
```

The `--template` flag parses the path by splitting on `/`:
- `pnpm/module` → dir=`pnpm`, type=`module`
- `pgpm/workspace` → dir=`pgpm`, type=`workspace`

## Template Variants

### PGPM Templates (default/)
### PGPM Templates (pgpm/)

Use for PostgreSQL extension development with migrations:

```bash
# Create PGPM workspace
pgpm init workspace
pgpm init -t pgpm/workspace

# Create PGPM module (inside workspace)
pgpm init
pgpm init -t pgpm/module

# Create workspace + module in one command
pgpm init -w
pgpm init -t pgpm/module -w
```

**Creates:**
Expand All @@ -69,9 +99,14 @@ Use for pure TypeScript/JavaScript packages without PostgreSQL:
```bash
# Create PNPM workspace
pgpm init workspace --dir pnpm
pgpm init -t pnpm/workspace

# Create PNPM package (inside workspace)
pgpm init --dir pnpm
pgpm init -t pnpm/module

# Create workspace + module in one command
pgpm init -t pnpm/module -w
```

**Creates:**
Expand Down Expand Up @@ -165,8 +200,9 @@ pgpm init --boilerplate --repo myorg/my-boilerplates

## Best Practices

1. Use `--dir pnpm` for pure TypeScript/JavaScript packages
2. Use default templates for PostgreSQL extension development
3. Use `--boilerplate` when exploring available templates
4. Always specify template path with `--boilerplate` in CI/CD
5. Create organization-specific boilerplates for standardized project setup
1. Use `--template pnpm/module` (or `-t pnpm/module`) for pure TypeScript/JavaScript packages
2. Use default templates (`pgpm init`) for PostgreSQL extension development
3. Use `--boilerplate` when exploring available templates interactively
4. Use `-w` flag to create workspace + module in one command when starting fresh
5. Always specify template path with `--template` or `--boilerplate` in CI/CD
6. Create organization-specific boilerplates for standardized project setup
51 changes: 51 additions & 0 deletions skills/pgpm-init/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ pgpm init
pgpm init module
```

### Create Workspace + Module in One Command

```bash
# Create workspace first, then module inside it
pgpm init -w

# With a specific template variant
pgpm init --dir pnpm -w
pgpm init --template pnpm/module -w
```

The `-w` (or `--create-workspace`) flag creates a workspace first, then automatically creates the module inside it. This is useful when starting from scratch outside any workspace.

Creates a new PGPM module with:
- `pgpm.plan` for migrations
- `.control` file for PostgreSQL extension metadata
Expand Down Expand Up @@ -123,6 +136,28 @@ pgpm init workspace --dir pnpm
pgpm init module --dir pnpm
```

### Use the --template Flag (Recommended)

The `--template` flag (or `-t`) provides a cleaner syntax by combining the directory variant and template type into a single path:

```bash
# These are equivalent:
pgpm init workspace --dir pnpm
pgpm init --template pnpm/workspace

# These are equivalent:
pgpm init module --dir pnpm
pgpm init --template pnpm/module

# Short form with -t alias
pgpm init -t pgpm/module
pgpm init -t pnpm/workspace
```

The `--template` flag parses the path by splitting on the first `/`:
- Everything before the slash becomes the `--dir` value
- Everything after becomes the template type (workspace/module)

## CLI Options

| Option | Description |
Expand All @@ -132,9 +167,13 @@ pgpm init module --dir pnpm
| `--repo <repo>` | Template repository (default: constructive-io/pgpm-boilerplates) |
| `--from-branch <branch>` | Branch/tag to use when cloning repo |
| `--dir <variant>` | Template variant directory (e.g., pnpm, supabase) |
| `--template, -t <path>` | Full template path (e.g., pnpm/module) - combines dir and type |
| `--boilerplate` | Prompt to select from available boilerplates |
| `--create-workspace, -w` | Create a workspace first, then create the module inside it |
| `--no-tty` | Run in non-interactive mode |

Note: The `-W` flag is used for the interactive workspace recovery prompt (when you run `pgpm init` outside a workspace and it asks if you want to create one).

## Workflow Examples

### Starting a New Project
Expand All @@ -155,6 +194,18 @@ pgpm add my_first_change
pgpm deploy --createdb
```

### Quick Start with -w Flag

```bash
# Create workspace + module in one command
pgpm init -w
# Prompts for workspace name, then module name
# Creates workspace and module inside packages/

# With PNPM template variant
pgpm init --template pnpm/module -w
```

### CI/CD Pipeline Setup

```yaml
Expand Down