Skip to content

Commit 5b2e683

Browse files
brettstackclaude
andcommitted
fix(event-sources): prevent static resource path from being stripped without custom domain
getDefaultStripBasePath incorrectly used event.resource as stripBasePath when no custom domain basePathMatched was set, causing the full path to be stripped and Express to receive "/" instead of the actual route. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2c5653c commit 5b2e683

File tree

5 files changed

+147
-1
lines changed

5 files changed

+147
-1
lines changed

.agents/skills/git-commit/SKILL.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
---
2+
name: git-commit
3+
description: 'Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping'
4+
license: MIT
5+
allowed-tools: Bash
6+
---
7+
8+
# Git Commit with Conventional Commits
9+
10+
## Overview
11+
12+
Create standardized, semantic git commits using the Conventional Commits specification. Analyze the actual diff to determine appropriate type, scope, and message.
13+
14+
## Conventional Commit Format
15+
16+
```
17+
<type>[optional scope]: <description>
18+
19+
[optional body]
20+
21+
[optional footer(s)]
22+
```
23+
24+
## Commit Types
25+
26+
| Type | Purpose |
27+
| ---------- | ------------------------------ |
28+
| `feat` | New feature |
29+
| `fix` | Bug fix |
30+
| `docs` | Documentation only |
31+
| `style` | Formatting/style (no logic) |
32+
| `refactor` | Code refactor (no feature/fix) |
33+
| `perf` | Performance improvement |
34+
| `test` | Add/update tests |
35+
| `build` | Build system/dependencies |
36+
| `ci` | CI/config changes |
37+
| `chore` | Maintenance/misc |
38+
| `revert` | Revert commit |
39+
40+
## Breaking Changes
41+
42+
```
43+
# Exclamation mark after type/scope
44+
feat!: remove deprecated endpoint
45+
46+
# BREAKING CHANGE footer
47+
feat: allow config to extend other configs
48+
49+
BREAKING CHANGE: `extends` key behavior changed
50+
```
51+
52+
## Workflow
53+
54+
### 1. Analyze Diff
55+
56+
```bash
57+
# If files are staged, use staged diff
58+
git diff --staged
59+
60+
# If nothing staged, use working tree diff
61+
git diff
62+
63+
# Also check status
64+
git status --porcelain
65+
```
66+
67+
### 2. Stage Files (if needed)
68+
69+
If nothing is staged or you want to group changes differently:
70+
71+
```bash
72+
# Stage specific files
73+
git add path/to/file1 path/to/file2
74+
75+
# Stage by pattern
76+
git add *.test.*
77+
git add src/components/*
78+
79+
# Interactive staging
80+
git add -p
81+
```
82+
83+
**Never commit secrets** (.env, credentials.json, private keys).
84+
85+
### 3. Generate Commit Message
86+
87+
Analyze the diff to determine:
88+
89+
- **Type**: What kind of change is this?
90+
- **Scope**: What area/module is affected?
91+
- **Description**: One-line summary of what changed (present tense, imperative mood, <72 chars)
92+
93+
### 4. Execute Commit
94+
95+
```bash
96+
# Single line
97+
git commit -m "<type>[scope]: <description>"
98+
99+
# Multi-line with body/footer
100+
git commit -m "$(cat <<'EOF'
101+
<type>[scope]: <description>
102+
103+
<optional body>
104+
105+
<optional footer>
106+
EOF
107+
)"
108+
```
109+
110+
## Best Practices
111+
112+
- One logical change per commit
113+
- Present tense: "add" not "added"
114+
- Imperative mood: "fix bug" not "fixes bug"
115+
- Reference issues: `Closes #123`, `Refs #456`
116+
- Keep description under 72 characters
117+
118+
## Git Safety Protocol
119+
120+
- NEVER update git config
121+
- NEVER run destructive commands (--force, hard reset) without explicit request
122+
- NEVER skip hooks (--no-verify) unless user asks
123+
- NEVER force push to main/master
124+
- If commit fails due to hooks, fix and create NEW commit (don't amend)

.claude/skills/git-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.agents/skills/git-commit

__tests__/unit.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ test('getPathWithQueryStringParams: pathParameters.proxy', () => {
8181
expect(pathWithQueryStringParams).toEqual('/123')
8282
})
8383

84+
test('getPathWithQueryStringParams: static resource without custom domain', () => {
85+
const event = {
86+
resource: '/service/endpoint',
87+
path: '/service/endpoint',
88+
pathParameters: null
89+
}
90+
const pathWithQueryStringParams = serverlessExpressEventSourcesUtils.getPathWithQueryStringParams({ event })
91+
expect(pathWithQueryStringParams).toEqual('/service/endpoint')
92+
})
93+
8494
test('getPathWithQueryStringParams: customDomain and no path parameters', () => {
8595
const event = {
8696
resource: '/foo',

skills-lock.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"version": 1,
3+
"skills": {
4+
"git-commit": {
5+
"source": "github/awesome-copilot",
6+
"sourceType": "github",
7+
"computedHash": "2607fc60629b82b257136dd2a7a373f0a4466c0b49df7746d845d59313c99b21"
8+
}
9+
}
10+
}

src/event-sources/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ const url = require('url')
22

33
function getDefaultStripBasePath (event) {
44
const basePathMatched = event?.requestContext?.customDomain?.basePathMatched || ''
5+
if (!basePathMatched) return ''
56
const resource = event?.pathParameters?.proxy ? '' : event.resource
6-
return basePathMatched ? `/${basePathMatched}${resource}` : resource
7+
return `/${basePathMatched}${resource}`
78
}
89

910
function getPathWithQueryStringParams ({

0 commit comments

Comments
 (0)