mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 20:53:15 +00:00
Some checks are pending
CI / Lint (push) Waiting to run
CI / Format check (push) Waiting to run
CI / Unit tests (push) Waiting to run
CI / Playwright E2E (push) Waiting to run
CI / Docker build smoke (push) Waiting to run
CI / Triage ledger up to date (push) Waiting to run
CI / ui bun.lock in sync (push) Waiting to run
Refs: #114 Co-authored-by: amoussa1229 <166072409+amoussa1229@users.noreply.github.com>
57 lines
1.8 KiB
Text
57 lines
1.8 KiB
Text
# AGENTS.md — SAM conventions
|
|
|
|
Supplement to `AGENTS.md.aws`. Merge into the repo root `AGENTS.md` alongside
|
|
the AWS base conventions.
|
|
|
|
## Directory layout
|
|
|
|
```
|
|
.
|
|
├── template.yaml # SAM template (single-file or entrypoint)
|
|
├── .aws-sam/ # SAM build artifacts (git-ignored)
|
|
├── src/
|
|
│ └── <function-name>/
|
|
│ ├── app.py # Lambda handler
|
|
│ └── requirements.txt # Per-function dependencies
|
|
├── layers/
|
|
│ └── <layer-name>/
|
|
│ ├── requirements.txt
|
|
│ └── (source files)
|
|
├── events/ # Test event payloads
|
|
├── samconfig.toml # SAM CLI configuration
|
|
└── Makefile # Build/deploy shortcuts
|
|
```
|
|
|
|
## Layer `BuildMethod` nesting gotcha
|
|
|
|
When a Lambda layer's `ContentUri` points to a directory that contains a
|
|
`requirements.txt`, SAM's `python3.12` build method nests the installed
|
|
packages under `python/` inside the layer. Do **not** create an extra
|
|
`python/` directory inside the layer source — let SAM handle it. That is:
|
|
|
|
```
|
|
# Correct — SAM creates python/ for you
|
|
MyLayer:
|
|
Type: AWS::Serverless::LayerVersion
|
|
Properties:
|
|
ContentUri: layers/my-layer/
|
|
CompatibleRuntimes: [python3.12]
|
|
Metadata:
|
|
BuildMethod: python3.12
|
|
|
|
# Wrong — double-nesting breaks imports
|
|
MyLayer:
|
|
...
|
|
ContentUri: layers/my-layer/python/ # DON'T do this
|
|
```
|
|
|
|
## Build & validate
|
|
|
|
```bash
|
|
sam build # Build all functions and layers
|
|
sam validate # Validate the template
|
|
sam local invoke ... # Test a single function locally
|
|
```
|
|
|
|
- Run `sam build && sam validate` before pushing. Do not commit `.aws-sam/`.
|
|
- If the repo has a `Makefile` wrapping these, use the Makefile targets.
|