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
10 changes: 5 additions & 5 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const sidebars = {
{ label: 'Start here', items: ['minimalapi/getting-started', 'minimalapi/guides/run-locally'] },
{
label: 'Guides',
items: ['minimalapi/guides/make-it-yours', 'minimalapi/guides/add-an-endpoint', 'minimalapi/guides/test-your-changes', 'minimalapi/guides/database', 'minimalapi/guides/secure-the-api', 'minimalapi/guides/ship-the-container', 'minimalapi/guides/set-up-ci', 'minimalapi/guides/work-with-a-coding-agent'],
items: ['minimalapi/guides/make-it-yours', 'minimalapi/guides/add-an-endpoint', 'minimalapi/guides/test-your-changes', 'minimalapi/guides/database', 'minimalapi/guides/secure-the-api', 'minimalapi/guides/ship-the-container', 'minimalapi/guides/set-up-ci', 'minimalapi/guides/upgrade', 'minimalapi/guides/work-with-a-coding-agent'],
},
{ label: 'Reference', items: [{ autogenerate: { directory: 'minimalapi/reference' } }] },
{
Expand All @@ -29,7 +29,7 @@ const sidebars = {
{ label: 'Start here', items: ['webapi/getting-started', 'webapi/guides/run-locally'] },
{
label: 'Guides',
items: ['webapi/guides/make-it-yours', 'webapi/guides/add-an-endpoint', 'webapi/guides/test-your-changes', 'webapi/guides/database', 'webapi/guides/secure-the-api', 'webapi/guides/ship-the-container', 'webapi/guides/set-up-ci', 'webapi/guides/work-with-a-coding-agent'],
items: ['webapi/guides/make-it-yours', 'webapi/guides/add-an-endpoint', 'webapi/guides/test-your-changes', 'webapi/guides/database', 'webapi/guides/secure-the-api', 'webapi/guides/ship-the-container', 'webapi/guides/set-up-ci', 'webapi/guides/upgrade', 'webapi/guides/work-with-a-coding-agent'],
},
{ label: 'Reference', items: [{ autogenerate: { directory: 'webapi/reference' } }] },
{
Expand All @@ -41,7 +41,7 @@ const sidebars = {
{ label: 'Start here', items: ['graphql/getting-started', 'graphql/guides/run-locally'] },
{
label: 'Guides',
items: ['graphql/guides/make-it-yours', 'graphql/guides/add-a-field', 'graphql/guides/test-your-changes', 'graphql/guides/database', 'graphql/guides/secure-the-api', 'graphql/guides/ship-the-container', 'graphql/guides/set-up-ci', 'graphql/guides/work-with-a-coding-agent'],
items: ['graphql/guides/make-it-yours', 'graphql/guides/add-a-field', 'graphql/guides/test-your-changes', 'graphql/guides/database', 'graphql/guides/secure-the-api', 'graphql/guides/ship-the-container', 'graphql/guides/set-up-ci', 'graphql/guides/upgrade', 'graphql/guides/work-with-a-coding-agent'],
},
{ label: 'Reference', items: [{ autogenerate: { directory: 'graphql/reference' } }] },
{
Expand All @@ -53,7 +53,7 @@ const sidebars = {
{ label: 'Start here', items: ['mcp/getting-started', 'mcp/guides/run-locally', 'mcp/guides/connect-a-client'] },
{
label: 'Guides',
items: ['mcp/guides/make-it-yours', 'mcp/guides/add-a-tool', 'mcp/guides/test-your-changes', 'mcp/guides/database', 'mcp/guides/secure-the-server', 'mcp/guides/ship-the-container', 'mcp/guides/set-up-ci', 'mcp/guides/work-with-a-coding-agent'],
items: ['mcp/guides/make-it-yours', 'mcp/guides/add-a-tool', 'mcp/guides/test-your-changes', 'mcp/guides/database', 'mcp/guides/secure-the-server', 'mcp/guides/ship-the-container', 'mcp/guides/set-up-ci', 'mcp/guides/upgrade', 'mcp/guides/work-with-a-coding-agent'],
},
{ label: 'Reference', items: [{ autogenerate: { directory: 'mcp/reference' } }] },
{
Expand All @@ -65,7 +65,7 @@ const sidebars = {
{ label: 'Start here', items: ['lambda/getting-started', 'lambda/guides/run-locally'] },
{
label: 'Guides',
items: ['lambda/guides/make-it-yours', 'lambda/guides/add-a-function', 'lambda/guides/test-your-changes', 'lambda/guides/database', 'lambda/guides/secure-the-function', 'lambda/guides/deploy-to-aws', 'lambda/guides/set-up-ci', 'lambda/guides/work-with-a-coding-agent'],
items: ['lambda/guides/make-it-yours', 'lambda/guides/add-a-function', 'lambda/guides/test-your-changes', 'lambda/guides/database', 'lambda/guides/secure-the-function', 'lambda/guides/deploy-to-aws', 'lambda/guides/set-up-ci', 'lambda/guides/upgrade', 'lambda/guides/work-with-a-coding-agent'],
},
{ label: 'Reference', items: [{ autogenerate: { directory: 'lambda/reference' } }] },
{
Expand Down
134 changes: 134 additions & 0 deletions src/content/docs/graphql/guides/upgrade.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
---
title: "Upgrade your solution"
description: "Bring a new template release into a solution you already made. Generate the old and new releases, diff them, and let git merge the difference in around your own changes."
sidebar:
order: 8
---

import { Steps, Aside } from '@astrojs/starlight/components';

`dotnet new` hands you a solution and never looks back. `dotnet new update` updates the template, but the solution you made last month stays exactly as it was, which is how you'd want it. Nobody wants a template rewriting their code while they sleep.

Still, a new release lands on the 1st of each month, and sometimes it has something you want: a package bump, a fix, a better skill for your coding agent. This guide gets it in without a copy-and-paste marathon. Generate the release you started from and the latest one, with the same name and options, and diff the two. That diff is only what the template changed, none of yours. Then git applies it to your solution and merges it with your own changes, the way it merges a branch.

## Before you start

You need the .NET 10 SDK, git, and your solution committed with nothing waiting in `git status`. If the upgrade goes sideways, `git reset --hard` puts everything back.

## Find your release and options

Every solution made since the January 2027 release has a `.lmca.json` at the root, recording the release and options that made it:

```json title=".lmca.json"
{
"template": "lmca-graphql",
"version": "2027.01.01.412",
"options": {
"name": "WorksOnMyMachine.Movies",
"authorName": "Jane Citizen",
"authentication": {
"Authority": "https://login.example.com",
"Audience": ""
}
}
}
```

Each option is a `dotnet new` option:

| In `.lmca.json` | Option |
| --- | --- |
| `name` | `--name` |
| `authorName` | `--authorName` |
| `authentication` | `--include-auth`, with `--authority` and `--audience` from inside it. Leave all three off when it's `null` |

<Aside type="note" title="No .lmca.json?">
Your solution came from the December 2026 release or earlier. Releases come once a month, so the date of your first commit tells you which one: `git log --reverse --format=%cs | head -1`, then pick the last release on or before that date from the [releases page](https://github.com/LeanMeanCleanApps/CleanGraphQLApi/releases). The options are in the solution too:

- **Name**: your `.slnx` file's name, without the extension.
- **Author name**: `<Authors>` in `src/Presentation/Presentation.csproj`. Skip it if that still says Stephen Walsh, and thanks for the credit.
- **Authentication**: you used `--include-auth` if `src/Presentation/Authentication` exists. The authority and audience are under `Authentication` in `src/Presentation/appsettings.json`, as they were when you started.

The tag on the releases page, such as `2026.12.02.374`, works as the version below. NuGet shows the same version as `2026.12.2.374`.
</Aside>

## Upgrade

The commands run from your solution's folder and put their work in an `upgrade` folder next to it. Swap in your own version and options from `.lmca.json`.

<Steps>

1. Generate a copy of the release you started from:

```bash
dotnet new install CleanGraphQLApi.Template::2027.01.01.412
dotnet new cleangraphqlapi --name WorksOnMyMachine.Movies --authorName "Jane Citizen" --include-auth --authority https://login.example.com --output ../upgrade/old --no-restore
```

2. Go back to the latest release and generate a copy of that, with the same options:

```bash
dotnet new update
dotnet new cleangraphqlapi --name WorksOnMyMachine.Movies --authorName "Jane Citizen" --include-auth --authority https://login.example.com --output ../upgrade/new --no-restore
```

3. Diff the two copies into a patch:

```bash
(cd ../upgrade && git diff --no-index --binary old new > template.patch)
```

An empty patch means the template hasn't changed anything that touches your solution. You're up to date; go and have a coffee.

4. Apply the patch:

```bash
git apply --3way -p2 ../upgrade/template.patch
```

`-p2` drops the `a/old/` and `b/new/` from the paths in the patch, so they line up with your solution.

Files you never touched just take the new version. Files you changed get merged with the template's changes. Where you both changed the same lines, git leaves conflict markers, exactly like a merge, and `git status` lists the file as both modified. Sort each one out, then `git add` it.

Git says "Falling back to direct application" for files the template added. That's fine; there was nothing to merge them with. The patch updates `.lmca.json` too, so the next upgrade starts from here.

5. Build, test and check the format, as CI would:

```bash
dotnet build
dotnet test
dotnet format --verify-no-changes
```

6. Commit, and clear up:

```bash
git commit -m "Upgrade to template release 2027.02.01.430"
rm -rf ../upgrade
```

</Steps>

<Aside type="caution" title="Repository lacks the necessary blob">
To merge a file, git needs the version you started from in your history. If you never committed the solution as `dotnet new` made it, git can't find it, and the whole apply stops without changing anything. Run it again with `--reject` instead of `--3way`. Git applies every change that fits and leaves the rest in `.rej` files next to the files they belong to, for you to bring in by hand.
</Aside>

## Take only what you want

The patch is yours to edit. Skip whole folders with `--exclude`, or take only some with `--include`:

```bash
git apply --3way -p2 --exclude='.agents/*' ../upgrade/template.patch
```

Or open `template.patch` and read it first. Anything in `src/Application` and `src/Infrastructure` is the same in all five templates, so a fix there is usually worth having. Anything in `src/Presentation` is the API itself, where your own changes most likely live.

Coding agents are good at this. Ask yours to apply the patch, resolve the conflicts so it keeps your changes and the template's, and run the checks. It works as Jacques, so it already knows those checks from `AGENTS.md`.

## What changed in each release

Each release's notes on GitHub link here. Each release gets a few lines below on what's worth bringing in and anything that needs care, newest first.

### 2026.12.02.374

The release we launched with. Solutions made from it don't have a `.lmca.json`; see [Find your release and options](#find-your-release-and-options).
128 changes: 128 additions & 0 deletions src/content/docs/lambda/guides/upgrade.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
---
title: "Upgrade your solution"
description: "Bring a new template release into a solution you already made. Generate the old and new releases, diff them, and let git merge the difference in around your own changes."
sidebar:
order: 8
---

import { Steps, Aside } from '@astrojs/starlight/components';

`dotnet new` hands you a solution and never looks back. `dotnet new update` updates the template, but the solution you made last month stays exactly as it was, which is how you'd want it. Nobody wants a template rewriting their code while they sleep.

Still, a new release lands on the 1st of each month, and sometimes it has something you want: a package bump, a fix, a better skill for your coding agent. This guide gets it in without a copy-and-paste marathon. Generate the release you started from and the latest one, with the same name and options, and diff the two. That diff is only what the template changed, none of yours. Then git applies it to your solution and merges it with your own changes, the way it merges a branch.

## Before you start

You need the .NET 10 SDK, git, and your solution committed with nothing waiting in `git status`. If the upgrade goes sideways, `git reset --hard` puts everything back.

## Find your release and options

Every solution made since the January 2027 release has a `.lmca.json` at the root, recording the release and options that made it:

```json title=".lmca.json"
{
"template": "lmca-lambda",
"version": "2027.01.01.412",
"options": {
"name": "WorksOnMyMachine.Reviews",
"authorName": "Jane Citizen"
}
}
```

Each option is a `dotnet new` option:

| In `.lmca.json` | Option |
| --- | --- |
| `name` | `--name` |
| `authorName` | `--authorName` |

<Aside type="note" title="No .lmca.json?">
Your solution came from the December 2026 release or earlier. Releases come once a month, so the date of your first commit tells you which one: `git log --reverse --format=%cs | head -1`, then pick the last release on or before that date from the [releases page](https://github.com/LeanMeanCleanApps/CleanLambdaFunction/releases). The options are in the solution too:

- **Name**: your `.slnx` file's name, without the extension.
- **Author name**: `<Authors>` in `src/Presentation/Presentation.csproj`. Skip it if that still says Stephen Walsh, and thanks for the credit.

The tag on the releases page, such as `2026.12.02.374`, works as the version below. NuGet shows the same version as `2026.12.2.374`.
</Aside>

## Upgrade

The commands run from your solution's folder and put their work in an `upgrade` folder next to it. Swap in your own version and options from `.lmca.json`.

<Steps>

1. Generate a copy of the release you started from:

```bash
dotnet new install CleanLambdaFunction.Template::2027.01.01.412
dotnet new cleanlambdafunction --name WorksOnMyMachine.Reviews --authorName "Jane Citizen" --output ../upgrade/old --no-restore
```

2. Go back to the latest release and generate a copy of that, with the same options:

```bash
dotnet new update
dotnet new cleanlambdafunction --name WorksOnMyMachine.Reviews --authorName "Jane Citizen" --output ../upgrade/new --no-restore
```

3. Diff the two copies into a patch:

```bash
(cd ../upgrade && git diff --no-index --binary old new > template.patch)
```

An empty patch means the template hasn't changed anything that touches your solution. You're up to date; go and have a coffee.

4. Apply the patch:

```bash
git apply --3way -p2 ../upgrade/template.patch
```

`-p2` drops the `a/old/` and `b/new/` from the paths in the patch, so they line up with your solution.

Files you never touched just take the new version. Files you changed get merged with the template's changes. Where you both changed the same lines, git leaves conflict markers, exactly like a merge, and `git status` lists the file as both modified. Sort each one out, then `git add` it.

Git says "Falling back to direct application" for files the template added. That's fine; there was nothing to merge them with. The patch updates `.lmca.json` too, so the next upgrade starts from here.

5. Build, test and check the format, as CI would:

```bash
dotnet build
dotnet test
dotnet format --verify-no-changes
```

6. Commit, and clear up:

```bash
git commit -m "Upgrade to template release 2027.02.01.430"
rm -rf ../upgrade
```

</Steps>

<Aside type="caution" title="Repository lacks the necessary blob">
To merge a file, git needs the version you started from in your history. If you never committed the solution as `dotnet new` made it, git can't find it, and the whole apply stops without changing anything. Run it again with `--reject` instead of `--3way`. Git applies every change that fits and leaves the rest in `.rej` files next to the files they belong to, for you to bring in by hand.
</Aside>

## Take only what you want

The patch is yours to edit. Skip whole folders with `--exclude`, or take only some with `--include`:

```bash
git apply --3way -p2 --exclude='.agents/*' ../upgrade/template.patch
```

Or open `template.patch` and read it first. Anything in `src/Application` and `src/Infrastructure` is the same in all five templates, so a fix there is usually worth having. Anything in `src/Presentation` is the function itself, where your own changes most likely live.

Coding agents are good at this. Ask yours to apply the patch, resolve the conflicts so it keeps your changes and the template's, and run the checks. It works as Jacques, so it already knows those checks from `AGENTS.md`.

## What changed in each release

Each release's notes on GitHub link here. Each release gets a few lines below on what's worth bringing in and anything that needs care, newest first.

### 2026.12.02.374

The release we launched with. Solutions made from it don't have a `.lmca.json`; see [Find your release and options](#find-your-release-and-options).
Loading