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
209 changes: 175 additions & 34 deletions .claude/commands/pr.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,197 @@
# Open PR for current branch
- $ARGUMENTS
- PR title must follow the format: `<type>(<scope>): <description>`
- Valid values for `<type>` are:
- feat
- fix
- docs
- refactor
- test
- chore
- ci
- `<scope>` is optional. Valid values for `<scope>` are:
- host
- envelopes
- abstractions
- opentelemetry
- source-generators
- deps
- build
- ci
- github
- core
- docs
- testing
- tests
- Use this template for the PR:
# Open PR for Current Branch

## Overview
Creates a pull request for the current Git branch with strict conventional commit format validation.

**Usage:** When the user asks to "open a PR", "create a pull request", or similar.

**Additional Instructions:** $ARGUMENTS

---

## Workflow

### 1. Pre-flight Checks
Run these checks in parallel:
- Current branch is NOT `main`, `master`, or `develop`
- Branch has commits that aren't on the base branch
- No PR already exists for this branch (check with `gh pr list --head <branch>`)

If branch is not pushed to remote, push it automatically (git will prompt for confirmation if needed).

### 2. Determine PR Title
Be autonomous about title selection:

1. **If the most recent commit follows conventional format** β†’ Use it automatically
2. **If commits are unclear** β†’ Analyze the diff and suggest a title
3. **Only ask the user if there's genuine ambiguity** (e.g., changes span multiple scopes)

**Validate title format** before proceeding (see format rules below)

### 3. Create the PR Body
Analyze the changes and create appropriate PR body content:
- For simple PRs (1-2 commits, single file): Use minimal template
- For complex PRs (multiple commits, many files): Use full template with all sections

### 4. Create the PR
Use heredoc to avoid creating temporary files:

```bash
gh pr create \
--title "<validated-title>" \
--base main \
--body "$(cat <<'EOF'
# πŸš€ Pull Request

## πŸ“‹ Summary

> Briefly describe what this PR does and why it's needed.
[Your analysis of what changed and why]

---

## βœ… Checklist

- [ ] My changes build cleanly
- [ ] I’ve added/updated relevant tests
- [ ] I’ve added/updated documentation or README
- [ ] I’ve followed the coding style for this project
- [ ] I’ve tested the changes locally (if applicable)
- [x] My changes build cleanly
- [x] I've added/updated relevant tests
- [ ] I've added/updated documentation or README
- [x] I've followed the coding style for this project
- [x] I've tested the changes locally (if applicable)

---

## πŸ§ͺ Related Issues or PRs

Closes #...
[If applicable: Closes #...]

---

## πŸ’¬ Notes for Reviewers

> Any specific areas to look at, known issues, or follow-up work.
[Any specific areas to look at, or remove this section]
EOF
)"
```

---

## PR Title Format (STRICT VALIDATION)

**Format:** `<type>(<scope>): <description>`

- **Type**: REQUIRED - Must be one of the valid types below
- **Scope**: OPTIONAL - If used, must be one of the valid scopes below
- **Description**: REQUIRED - Brief summary in imperative mood

⚠️ **CI will fail if the title format is incorrect**

### Valid Types (REQUIRED)

- `feat` - New feature
- `fix` - Bug fix
- `docs` - Documentation changes
- `refactor` - Code refactoring
- `test` - Test changes
- `chore` - Maintenance tasks
- `ci` - CI/CD changes

### Valid Scopes (OPTIONAL)

The `<scope>` is OPTIONAL. If included, it MUST be one of these exact values:

- `host` - Core Lambda hosting functionality
- `envelopes` - Lambda envelope/event handling
- `abstractions` - Abstractions package
- `opentelemetry` - OpenTelemetry integration
- `source-generators` - Source generator code
- `deps` - Dependency updates
- `build` - Build system changes
- `ci` - CI/CD configuration
- `github` - GitHub-specific files
- `core` - Core library changes
- `docs` - Documentation changes
- `testing` - Test infrastructure
- `tests` - Test files

### Scope Rules (CRITICAL)

❌ **DO NOT** use:
- Class names as scopes (e.g., `test(DefaultLambdaCancellationFactory)`)
- Method names as scopes (e.g., `fix(CreateHandler)`)
- Arbitrary text as scopes (e.g., `feat(new-thing)`)
- File names as scopes (e.g., `fix(Program.cs)`)

βœ… **DO** use:
- One of the predefined scopes above (e.g., `test(testing)`)
- No scope at all if none fit (e.g., `test: add failing test`)

### Title Examples

**Valid:**
- `feat(host): add new Lambda handler support`
- `fix(abstractions): resolve dependency issue`
- `test(testing): add intentionally failing test`
- `docs: update README with examples` ← no scope is fine
- `refactor: improve code organization` ← no scope is fine
- `chore(deps): update NuGet packages`
- `ci: add build caching`

**Invalid (will fail CI):**
- `test(DefaultLambdaCancellationFactory): add test` ← class name not allowed
- `fix(SomeMethod): fix bug` ← method name not allowed
- `feat(cool-feature): add feature` ← arbitrary scope not allowed
- `Add new feature` ← missing type
- `feat(core) add handler` ← missing colon
- `FEAT(core): add handler` ← type must be lowercase

### Handling Type/Scope Overlap

When a type and scope have the same name (e.g., `docs`, `ci`):
- `docs: update README` ← Use when it's ONLY documentation changes
- `feat(docs): add documentation generator` ← Use when it's a feature that affects docs
- `ci: update GitHub Actions workflow` ← Use when it's ONLY CI changes
- `fix(ci): correct build script path` ← Use when fixing something in the CI scope

---

## Additional Template Sections (for complex PRs)

For complex PRs with many changes, add these optional sections:

```markdown
## πŸ”„ Changes

- Change 1
- Change 2
- Change 3

---

## πŸ§‘β€πŸ’» Testing

Describe how the changes were tested, specific test cases run, or manual testing performed.
```

Add these sections AFTER the Summary but BEFORE the Checklist when appropriate.

---

## Title Validation Process

Before creating the PR, validate the title:

1. **Check format**: Must match `<type>(<scope>): <description>` or `<type>: <description>`
2. **Validate type**: Must be one of: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `ci`
3. **Validate scope** (if present): Must be one of the predefined scopes listed above
4. **Check description**: Must be present and not empty

If validation fails, explain the error and ask for a corrected title.

---

## Tips

- **Auto-suggest titles**: If the most recent commit message follows conventional format, use it automatically
- **Infer scope**: Based on which files were changed, suggest an appropriate scope
- **Draft PRs**: Add `--draft` flag if the user mentions the PR is work-in-progress
- **Reviewers**: Add `--reviewer <username>` if the user specifies reviewers
- **Labels**: Add `--label <label>` if the user mentions specific labels
124 changes: 61 additions & 63 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,77 @@
</PropertyGroup>
<ItemGroup>
<!-- Packages for all targets -->
<PackageVersion Include="Amazon.Lambda.CloudWatchLogsEvents" Version="2.2.1" />
<PackageVersion Include="Amazon.Lambda.Core" Version="2.8.0" />
<PackageVersion Include="Amazon.Lambda.KafkaEvents" Version="2.1.1" />
<PackageVersion Include="Amazon.Lambda.KinesisEvents" Version="3.0.1" />
<PackageVersion Include="Amazon.Lambda.KinesisFirehoseEvents" Version="2.3.1" />
<PackageVersion Include="Amazon.Lambda.RuntimeSupport" Version="1.14.1" />
<PackageVersion Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.5" />
<PackageVersion Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageVersion Include="AutoFixture.AutoNSubstitute" Version="4.18.1" />
<PackageVersion Include="AutoFixture.Xunit3" Version="4.19.0" />
<PackageVersion Include="AWSSDK.Core" Version="4.0.3.9" />
<PackageVersion Include="Basic.Reference.Assemblies.Net100" Version="1.8.4" />
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.8.4" />
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="LayeredCraft.SourceGeneratorTools.Generator" Version="0.1.0-beta.10" />
<PackageVersion Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.9" />
<PackageVersion Include="Microsoft.AspNetCore.Routing" Version="2.3.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="10.0.2" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="10.0.2" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Amazon.Lambda.CloudWatchLogsEvents" Version="2.2.1"/>
<PackageVersion Include="Amazon.Lambda.Core" Version="2.8.0"/>
<PackageVersion Include="Amazon.Lambda.KafkaEvents" Version="2.1.1"/>
<PackageVersion Include="Amazon.Lambda.KinesisEvents" Version="3.0.1"/>
<PackageVersion Include="Amazon.Lambda.KinesisFirehoseEvents" Version="2.3.1"/>
<PackageVersion Include="Amazon.Lambda.RuntimeSupport" Version="1.14.1"/>
<PackageVersion Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.5"/>
<PackageVersion Include="Autofac.Extensions.DependencyInjection" Version="10.0.0"/>
<PackageVersion Include="AutoFixture.AutoNSubstitute" Version="4.18.1"/>
<PackageVersion Include="AutoFixture.Xunit3" Version="4.19.0"/>
<PackageVersion Include="AWSSDK.Core" Version="4.0.3.9"/>
<PackageVersion Include="Basic.Reference.Assemblies.Net100" Version="1.8.4"/>
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.8.4"/>
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8"/>
<PackageVersion Include="LayeredCraft.SourceGeneratorTools.Generator" Version="0.1.0-beta.10"/>
<PackageVersion Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.3.9"/>
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.9"/>
<PackageVersion Include="Microsoft.AspNetCore.Routing" Version="2.3.9"/>
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="10.0.2"/>
<PackageVersion Include="Microsoft.Extensions.Http" Version="10.0.2"/>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0"/>
<!-- Source Gen Libraries -->
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0" />
<PackageVersion Include="Microsoft.CodeAnalysis" Version="5.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="5.0.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0" />
<PackageVersion
Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing"
Version="1.1.3" />
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17" />
<PackageVersion Include="OpenTelemetry.Exporter.InMemory" Version="1.14.0" />
<PackageVersion Include="PolySharp" Version="1.15.0" />
<PackageVersion Include="Scriban" Version="6.5.2" />
<PackageVersion Include="Microsoft.CSharp" Version="4.7.0"/>
<PackageVersion Include="Microsoft.CodeAnalysis" Version="5.0.0"/>
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="4.14.0"/>
<PackageVersion Include="Microsoft.CodeAnalysis.Common" Version="5.0.0"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="5.0.0"/>
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing" Version="1.1.3"/>
<PackageVersion Include="NSubstitute.Analyzers.CSharp" Version="1.0.17"/>
<PackageVersion Include="OpenTelemetry.Exporter.InMemory" Version="1.14.0"/>
<PackageVersion Include="PolySharp" Version="1.15.0"/>
<PackageVersion Include="Scriban" Version="6.5.2"/>
<!-- OTEL Libraries -->
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.14.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0" />
<PackageVersion Include="NSubstitute" Version="5.3.0"/>
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.14.0"/>
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0"/>
<!-- Testing Libraries -->
<PackageVersion Include="AwesomeAssertions" Version="9.3.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net90" Version="1.8.4" />
<PackageVersion Include="JetBrains.Annotations" Version="2025.2.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.0.4" />
<PackageVersion Include="System.Formats.Asn1" Version="6.0.1" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.5.0" />
<PackageVersion Include="Verify.XunitV3" Version="31.9.4" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="xunit.v3" Version="3.2.2" />
<PackageVersion Include="AutoFixture" Version="4.18.1" />
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.1" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="10.2.0" />
<PackageVersion Include="AwesomeAssertions" Version="9.3.0"/>
<PackageVersion Include="Basic.Reference.Assemblies.Net90" Version="1.8.4"/>
<PackageVersion Include="JetBrains.Annotations" Version="2025.2.4"/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1"/>
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.0.4"/>
<PackageVersion Include="System.Formats.Asn1" Version="6.0.1"/>
<PackageVersion Include="System.Net.Http" Version="4.3.4"/>
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1"/>
<PackageVersion Include="Verify.SourceGenerators" Version="2.5.0"/>
<PackageVersion Include="Verify.XunitV3" Version="31.9.4"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5"/>
<PackageVersion Include="xunit.v3" Version="3.2.2"/>
<PackageVersion Include="AutoFixture" Version="4.18.1"/>
<PackageVersion Include="AutoFixture.Xunit2" Version="4.18.1"/>
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="10.2.0"/>
<!-- Lambda Event Libraries -->
<PackageVersion Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.3" />
<PackageVersion Include="Amazon.Lambda.ApplicationLoadBalancerEvents" Version="2.2.1" />
<PackageVersion Include="Amazon.Lambda.SNSEvents" Version="2.1.1" />
<PackageVersion Include="Amazon.Lambda.SQSEvents" Version="2.2.1" />
<PackageVersion Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.3"/>
<PackageVersion Include="Amazon.Lambda.ApplicationLoadBalancerEvents" Version="2.2.1"/>
<PackageVersion Include="Amazon.Lambda.SNSEvents" Version="2.1.1"/>
<PackageVersion Include="Amazon.Lambda.SQSEvents" Version="2.2.1"/>
</ItemGroup>
<!-- Conditional versions based on target framework -->
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1"/>
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.10" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.10" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AWSLambda" Version="1.14.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="9.0.10"/>
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.10"/>
<PackageVersion Include="OpenTelemetry.Instrumentation.AWSLambda" Version="1.14.2"/>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AWSLambda" Version="1.12.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.1"/>
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.1"/>
<PackageVersion Include="OpenTelemetry.Instrumentation.AWSLambda" Version="1.12.1"/>
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion tasks/FormattingTasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ tasks:
--settings="MinimalLambda.sln.DotSettings" \
--profile="Built-in: Reformat Code" \
--verbosity=FATAL \
--no-build
--no-build \
--exclude="**.props"
- echo "βœ… CleanupCode completed successfully!"

csharpier:
Expand Down
Loading