nerdsystem 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nerdsystem",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "nerd: start, check, and deploy a web app on nerdsystem from the terminal or a coding agent.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,6 +26,7 @@
26
26
  "./gates": "./dist/gates/index.js",
27
27
  "./gates/text": "./dist/gates/text.js",
28
28
  "./gates/rules": "./dist/gates/rules.js",
29
+ "./snapshot": "./dist/snapshot.js",
29
30
  "./project": "./dist/project.js",
30
31
  "./api": "./dist/api.js",
31
32
  "./commands/check": "./dist/commands/check.js",
@@ -16,7 +16,7 @@ If this project still has the template's todo app (the `todos` table and `src/se
16
16
  3. Replace the todo example with that feature: schema, migration (`pnpm db:generate`), a router under `/api/...`, and the client screen. The template is a normal website: a public homepage at `/`, auth pages at `/login`, `/signup`, `/forgot-password`, `/reset-password`, and a signed-in area. Reshape it to the idea (a public landing page with sign-in in the header, a members-only area, an admin section) rather than forcing a login wall; the forms already work.
17
17
  4. Run `nerd check`. Then, unless the person asked to go straight to a live URL, run `nerd dev` and tell them to open the local URL, create an account, and try it. Fix what they report. When they want the live URL first, skip `nerd dev` and go to the next step; they can try it on the deployed app.
18
18
  5. Run `nerd deploy` and give them the live URL. Tell them to sign up on their own app first, then make themselves admin in the dashboard's Auth tab (the URL is printed after the deploy). Explain in two lines that every deploy is checked for leaked secrets and vulnerable dependencies, and that they can run `nerd check` any time.
19
- 6. Offer the next steps once, briefly: link the GitHub repo for previews on pull requests (`nerd github connect`), add a custom domain, or invite a teammate from the dashboard.
19
+ 6. Tell them their code is saved on nerdsystem with every deploy and every `nerd save`, and that work since the last save is only on this computer. Then offer the next steps once, briefly: putting the code on GitHub as well (`nerd github connect`; explain that it adds deploys on push and a preview URL for each pull request), a custom domain, or inviting a teammate from the dashboard.
20
20
 
21
21
  Throughout, show commands rather than describing them, and never ask the person to edit config files; the platform owns `wrangler.jsonc` and `nerd.json`.
22
22
 
@@ -36,11 +36,19 @@ Tell the person plainly what does not carry. Their users sign up again on the ne
36
36
  1. Make the change.
37
37
  2. `nerd check` (static rules, then typecheck). Fix anything it reports.
38
38
  3. `nerd dev` to run locally when you need to try it. The local app talks to the real auth service, so signup and login work exactly as in production.
39
- 4. `nerd deploy` when it is ready. It runs the checks, builds, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
39
+ 4. `nerd deploy` when it is ready. It runs the checks, builds, stores a copy of the code, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
40
40
  5. If something is wrong after deploying: `nerd logs` shows recent output from the deployed app (`--q` to search, `--pr 12` for a preview), `nerd deployments` shows status and errors, `nerd db query "..."` inspects production data.
41
41
 
42
42
  Run `nerd check --json` when you want a machine-readable list of problems. Its summary says how many gates ran and which were skipped (`skipped` in the JSON): semgrep and gitleaks only run locally when installed; git builds always run them in the builder.
43
43
 
44
+ ## Saving and restoring the code
45
+
46
+ Every `nerd deploy` stores a copy of the code with the deployment, and `nerd save` stores one without deploying. Run `nerd save` at the end of every working session so the person's work is kept even when it was not deployed; it prints "Nothing changed since the last save." when there is nothing new. Work since the last save or deploy exists only on this computer, so say that whenever you tell the person their work is saved.
47
+
48
+ On a new computer, or when the folder is lost: `nerd pull <org>/<project>`, then `pnpm install`, then `nerd dev`. `nerd pull` restores the newest saved copy into a new folder; `--deployment <id>` restores the code of a specific deploy. If `nerd deploy` stops because the live app was deployed from another copy of the code, run `nerd pull` to work from that copy, or `nerd deploy --force` only when the person confirms this copy should replace it.
49
+
50
+ GitHub is optional. The next section says what connecting it adds.
51
+
44
52
  ## Deploying from GitHub
45
53
 
46
54
  Once the repo is linked (`nerd github connect`, then `nerd github link owner/repo`), every push to the production branch builds and deploys automatically, and every pull request gets a preview at its own URL, posted as a PR comment. `nerd builds` lists builds; `nerd builds show <id>` prints the log when one fails. A failing build reports the same `nerd check` problems you would see locally, so fix and push again. Every preview gets its own database and bucket, and pending migrations are applied to it on each preview build, so a PR that changes the schema can be tried end to end before it merges.
@@ -2,7 +2,7 @@
2
2
  description: How to build, run, and deploy this app on nerdsystem. Applies to server, database, auth, and deploy work.
3
3
  alwaysApply: true
4
4
  ---
5
- <!-- generated from .claude/skills/nerdsystem/SKILL.md (31894f024834); edit the skill, then run: nerd agents sync -->
5
+ <!-- generated from .claude/skills/nerdsystem/SKILL.md (0e64cbbdd978); edit the skill, then run: nerd agents sync -->
6
6
 
7
7
  # Building on nerdsystem
8
8
 
@@ -17,7 +17,7 @@ If this project still has the template's todo app (the `todos` table and `src/se
17
17
  3. Replace the todo example with that feature: schema, migration (`pnpm db:generate`), a router under `/api/...`, and the client screen. The template is a normal website: a public homepage at `/`, auth pages at `/login`, `/signup`, `/forgot-password`, `/reset-password`, and a signed-in area. Reshape it to the idea (a public landing page with sign-in in the header, a members-only area, an admin section) rather than forcing a login wall; the forms already work.
18
18
  4. Run `nerd check`. Then, unless the person asked to go straight to a live URL, run `nerd dev` and tell them to open the local URL, create an account, and try it. Fix what they report. When they want the live URL first, skip `nerd dev` and go to the next step; they can try it on the deployed app.
19
19
  5. Run `nerd deploy` and give them the live URL. Tell them to sign up on their own app first, then make themselves admin in the dashboard's Auth tab (the URL is printed after the deploy). Explain in two lines that every deploy is checked for leaked secrets and vulnerable dependencies, and that they can run `nerd check` any time.
20
- 6. Offer the next steps once, briefly: link the GitHub repo for previews on pull requests (`nerd github connect`), add a custom domain, or invite a teammate from the dashboard.
20
+ 6. Tell them their code is saved on nerdsystem with every deploy and every `nerd save`, and that work since the last save is only on this computer. Then offer the next steps once, briefly: putting the code on GitHub as well (`nerd github connect`; explain that it adds deploys on push and a preview URL for each pull request), a custom domain, or inviting a teammate from the dashboard.
21
21
 
22
22
  Throughout, show commands rather than describing them, and never ask the person to edit config files; the platform owns `wrangler.jsonc` and `nerd.json`.
23
23
 
@@ -37,11 +37,19 @@ Tell the person plainly what does not carry. Their users sign up again on the ne
37
37
  1. Make the change.
38
38
  2. `nerd check` (static rules, then typecheck). Fix anything it reports.
39
39
  3. `nerd dev` to run locally when you need to try it. The local app talks to the real auth service, so signup and login work exactly as in production.
40
- 4. `nerd deploy` when it is ready. It runs the checks, builds, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
40
+ 4. `nerd deploy` when it is ready. It runs the checks, builds, stores a copy of the code, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
41
41
  5. If something is wrong after deploying: `nerd logs` shows recent output from the deployed app (`--q` to search, `--pr 12` for a preview), `nerd deployments` shows status and errors, `nerd db query "..."` inspects production data.
42
42
 
43
43
  Run `nerd check --json` when you want a machine-readable list of problems. Its summary says how many gates ran and which were skipped (`skipped` in the JSON): semgrep and gitleaks only run locally when installed; git builds always run them in the builder.
44
44
 
45
+ ## Saving and restoring the code
46
+
47
+ Every `nerd deploy` stores a copy of the code with the deployment, and `nerd save` stores one without deploying. Run `nerd save` at the end of every working session so the person's work is kept even when it was not deployed; it prints "Nothing changed since the last save." when there is nothing new. Work since the last save or deploy exists only on this computer, so say that whenever you tell the person their work is saved.
48
+
49
+ On a new computer, or when the folder is lost: `nerd pull <org>/<project>`, then `pnpm install`, then `nerd dev`. `nerd pull` restores the newest saved copy into a new folder; `--deployment <id>` restores the code of a specific deploy. If `nerd deploy` stops because the live app was deployed from another copy of the code, run `nerd pull` to work from that copy, or `nerd deploy --force` only when the person confirms this copy should replace it.
50
+
51
+ GitHub is optional. The next section says what connecting it adds.
52
+
45
53
  ## Deploying from GitHub
46
54
 
47
55
  Once the repo is linked (`nerd github connect`, then `nerd github link owner/repo`), every push to the production branch builds and deploys automatically, and every pull request gets a preview at its own URL, posted as a PR comment. `nerd builds` lists builds; `nerd builds show <id>` prints the log when one fails. A failing build reports the same `nerd check` problems you would see locally, so fix and push again. Every preview gets its own database and bucket, and pending migrations are applied to it on each preview build, so a PR that changes the schema can be tried end to end before it merges.
@@ -1,4 +1,4 @@
1
- <!-- generated from .claude/skills/nerdsystem/SKILL.md (31894f024834); edit the skill, then run: nerd agents sync -->
1
+ <!-- generated from .claude/skills/nerdsystem/SKILL.md (0e64cbbdd978); edit the skill, then run: nerd agents sync -->
2
2
 
3
3
  # Building on nerdsystem
4
4
 
@@ -13,7 +13,7 @@ If this project still has the template's todo app (the `todos` table and `src/se
13
13
  3. Replace the todo example with that feature: schema, migration (`pnpm db:generate`), a router under `/api/...`, and the client screen. The template is a normal website: a public homepage at `/`, auth pages at `/login`, `/signup`, `/forgot-password`, `/reset-password`, and a signed-in area. Reshape it to the idea (a public landing page with sign-in in the header, a members-only area, an admin section) rather than forcing a login wall; the forms already work.
14
14
  4. Run `nerd check`. Then, unless the person asked to go straight to a live URL, run `nerd dev` and tell them to open the local URL, create an account, and try it. Fix what they report. When they want the live URL first, skip `nerd dev` and go to the next step; they can try it on the deployed app.
15
15
  5. Run `nerd deploy` and give them the live URL. Tell them to sign up on their own app first, then make themselves admin in the dashboard's Auth tab (the URL is printed after the deploy). Explain in two lines that every deploy is checked for leaked secrets and vulnerable dependencies, and that they can run `nerd check` any time.
16
- 6. Offer the next steps once, briefly: link the GitHub repo for previews on pull requests (`nerd github connect`), add a custom domain, or invite a teammate from the dashboard.
16
+ 6. Tell them their code is saved on nerdsystem with every deploy and every `nerd save`, and that work since the last save is only on this computer. Then offer the next steps once, briefly: putting the code on GitHub as well (`nerd github connect`; explain that it adds deploys on push and a preview URL for each pull request), a custom domain, or inviting a teammate from the dashboard.
17
17
 
18
18
  Throughout, show commands rather than describing them, and never ask the person to edit config files; the platform owns `wrangler.jsonc` and `nerd.json`.
19
19
 
@@ -33,11 +33,19 @@ Tell the person plainly what does not carry. Their users sign up again on the ne
33
33
  1. Make the change.
34
34
  2. `nerd check` (static rules, then typecheck). Fix anything it reports.
35
35
  3. `nerd dev` to run locally when you need to try it. The local app talks to the real auth service, so signup and login work exactly as in production.
36
- 4. `nerd deploy` when it is ready. It runs the checks, builds, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
36
+ 4. `nerd deploy` when it is ready. It runs the checks, builds, stores a copy of the code, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
37
37
  5. If something is wrong after deploying: `nerd logs` shows recent output from the deployed app (`--q` to search, `--pr 12` for a preview), `nerd deployments` shows status and errors, `nerd db query "..."` inspects production data.
38
38
 
39
39
  Run `nerd check --json` when you want a machine-readable list of problems. Its summary says how many gates ran and which were skipped (`skipped` in the JSON): semgrep and gitleaks only run locally when installed; git builds always run them in the builder.
40
40
 
41
+ ## Saving and restoring the code
42
+
43
+ Every `nerd deploy` stores a copy of the code with the deployment, and `nerd save` stores one without deploying. Run `nerd save` at the end of every working session so the person's work is kept even when it was not deployed; it prints "Nothing changed since the last save." when there is nothing new. Work since the last save or deploy exists only on this computer, so say that whenever you tell the person their work is saved.
44
+
45
+ On a new computer, or when the folder is lost: `nerd pull <org>/<project>`, then `pnpm install`, then `nerd dev`. `nerd pull` restores the newest saved copy into a new folder; `--deployment <id>` restores the code of a specific deploy. If `nerd deploy` stops because the live app was deployed from another copy of the code, run `nerd pull` to work from that copy, or `nerd deploy --force` only when the person confirms this copy should replace it.
46
+
47
+ GitHub is optional. The next section says what connecting it adds.
48
+
41
49
  ## Deploying from GitHub
42
50
 
43
51
  Once the repo is linked (`nerd github connect`, then `nerd github link owner/repo`), every push to the production branch builds and deploys automatically, and every pull request gets a preview at its own URL, posted as a PR comment. `nerd builds` lists builds; `nerd builds show <id>` prints the log when one fails. A failing build reports the same `nerd check` problems you would see locally, so fix and push again. Every preview gets its own database and bucket, and pending migrations are applied to it on each preview build, so a PR that changes the schema can be tried end to end before it merges.
@@ -1,4 +1,4 @@
1
- <!-- generated from .claude/skills/nerdsystem/SKILL.md (31894f024834); edit the skill, then run: nerd agents sync -->
1
+ <!-- generated from .claude/skills/nerdsystem/SKILL.md (0e64cbbdd978); edit the skill, then run: nerd agents sync -->
2
2
 
3
3
  # Building on nerdsystem
4
4
 
@@ -13,7 +13,7 @@ If this project still has the template's todo app (the `todos` table and `src/se
13
13
  3. Replace the todo example with that feature: schema, migration (`pnpm db:generate`), a router under `/api/...`, and the client screen. The template is a normal website: a public homepage at `/`, auth pages at `/login`, `/signup`, `/forgot-password`, `/reset-password`, and a signed-in area. Reshape it to the idea (a public landing page with sign-in in the header, a members-only area, an admin section) rather than forcing a login wall; the forms already work.
14
14
  4. Run `nerd check`. Then, unless the person asked to go straight to a live URL, run `nerd dev` and tell them to open the local URL, create an account, and try it. Fix what they report. When they want the live URL first, skip `nerd dev` and go to the next step; they can try it on the deployed app.
15
15
  5. Run `nerd deploy` and give them the live URL. Tell them to sign up on their own app first, then make themselves admin in the dashboard's Auth tab (the URL is printed after the deploy). Explain in two lines that every deploy is checked for leaked secrets and vulnerable dependencies, and that they can run `nerd check` any time.
16
- 6. Offer the next steps once, briefly: link the GitHub repo for previews on pull requests (`nerd github connect`), add a custom domain, or invite a teammate from the dashboard.
16
+ 6. Tell them their code is saved on nerdsystem with every deploy and every `nerd save`, and that work since the last save is only on this computer. Then offer the next steps once, briefly: putting the code on GitHub as well (`nerd github connect`; explain that it adds deploys on push and a preview URL for each pull request), a custom domain, or inviting a teammate from the dashboard.
17
17
 
18
18
  Throughout, show commands rather than describing them, and never ask the person to edit config files; the platform owns `wrangler.jsonc` and `nerd.json`.
19
19
 
@@ -33,11 +33,19 @@ Tell the person plainly what does not carry. Their users sign up again on the ne
33
33
  1. Make the change.
34
34
  2. `nerd check` (static rules, then typecheck). Fix anything it reports.
35
35
  3. `nerd dev` to run locally when you need to try it. The local app talks to the real auth service, so signup and login work exactly as in production.
36
- 4. `nerd deploy` when it is ready. It runs the checks, builds, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
36
+ 4. `nerd deploy` when it is ready. It runs the checks, builds, stores a copy of the code, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
37
37
  5. If something is wrong after deploying: `nerd logs` shows recent output from the deployed app (`--q` to search, `--pr 12` for a preview), `nerd deployments` shows status and errors, `nerd db query "..."` inspects production data.
38
38
 
39
39
  Run `nerd check --json` when you want a machine-readable list of problems. Its summary says how many gates ran and which were skipped (`skipped` in the JSON): semgrep and gitleaks only run locally when installed; git builds always run them in the builder.
40
40
 
41
+ ## Saving and restoring the code
42
+
43
+ Every `nerd deploy` stores a copy of the code with the deployment, and `nerd save` stores one without deploying. Run `nerd save` at the end of every working session so the person's work is kept even when it was not deployed; it prints "Nothing changed since the last save." when there is nothing new. Work since the last save or deploy exists only on this computer, so say that whenever you tell the person their work is saved.
44
+
45
+ On a new computer, or when the folder is lost: `nerd pull <org>/<project>`, then `pnpm install`, then `nerd dev`. `nerd pull` restores the newest saved copy into a new folder; `--deployment <id>` restores the code of a specific deploy. If `nerd deploy` stops because the live app was deployed from another copy of the code, run `nerd pull` to work from that copy, or `nerd deploy --force` only when the person confirms this copy should replace it.
46
+
47
+ GitHub is optional. The next section says what connecting it adds.
48
+
41
49
  ## Deploying from GitHub
42
50
 
43
51
  Once the repo is linked (`nerd github connect`, then `nerd github link owner/repo`), every push to the production branch builds and deploys automatically, and every pull request gets a preview at its own URL, posted as a PR comment. `nerd builds` lists builds; `nerd builds show <id>` prints the log when one fails. A failing build reports the same `nerd check` problems you would see locally, so fix and push again. Every preview gets its own database and bucket, and pending migrations are applied to it on each preview build, so a PR that changes the schema can be tried end to end before it merges.
@@ -6,7 +6,8 @@ nerdsystem deploys this app to Cloudflare and provides authentication and author
6
6
 
7
7
  - `nerd dev` starts the app locally with a real session flow against the platform auth service.
8
8
  - `nerd check` typechecks both sides and verifies the platform rules below. Run it before `nerd deploy`.
9
- - `nerd deploy` builds, applies pending migrations to the production database, and ships the app. Prints the URL.
9
+ - `nerd deploy` builds, stores a copy of the code, applies pending migrations to the production database, and ships the app. Prints the URL.
10
+ - `nerd save` keeps a copy of the code on nerdsystem without deploying; `nerd pull <org>/<project>` restores it on another computer.
10
11
  - `nerd db query "select ..."` runs SQL against the production database. `nerd deployments` lists recent deploys.
11
12
  - With a linked GitHub repo, pushes to the production branch and pull requests deploy automatically. `nerd builds` and `nerd builds show <id>` show what happened.
12
13
  - `pnpm db:generate` creates a migration after editing `src/server/db/schema.ts`. Never edit the database by hand.
@@ -1,4 +1,4 @@
1
- <!-- generated from .claude/skills/nerdsystem/SKILL.md (31894f024834); edit the skill, then run: nerd agents sync -->
1
+ <!-- generated from .claude/skills/nerdsystem/SKILL.md (0e64cbbdd978); edit the skill, then run: nerd agents sync -->
2
2
 
3
3
  # Building on nerdsystem
4
4
 
@@ -13,7 +13,7 @@ If this project still has the template's todo app (the `todos` table and `src/se
13
13
  3. Replace the todo example with that feature: schema, migration (`pnpm db:generate`), a router under `/api/...`, and the client screen. The template is a normal website: a public homepage at `/`, auth pages at `/login`, `/signup`, `/forgot-password`, `/reset-password`, and a signed-in area. Reshape it to the idea (a public landing page with sign-in in the header, a members-only area, an admin section) rather than forcing a login wall; the forms already work.
14
14
  4. Run `nerd check`. Then, unless the person asked to go straight to a live URL, run `nerd dev` and tell them to open the local URL, create an account, and try it. Fix what they report. When they want the live URL first, skip `nerd dev` and go to the next step; they can try it on the deployed app.
15
15
  5. Run `nerd deploy` and give them the live URL. Tell them to sign up on their own app first, then make themselves admin in the dashboard's Auth tab (the URL is printed after the deploy). Explain in two lines that every deploy is checked for leaked secrets and vulnerable dependencies, and that they can run `nerd check` any time.
16
- 6. Offer the next steps once, briefly: link the GitHub repo for previews on pull requests (`nerd github connect`), add a custom domain, or invite a teammate from the dashboard.
16
+ 6. Tell them their code is saved on nerdsystem with every deploy and every `nerd save`, and that work since the last save is only on this computer. Then offer the next steps once, briefly: putting the code on GitHub as well (`nerd github connect`; explain that it adds deploys on push and a preview URL for each pull request), a custom domain, or inviting a teammate from the dashboard.
17
17
 
18
18
  Throughout, show commands rather than describing them, and never ask the person to edit config files; the platform owns `wrangler.jsonc` and `nerd.json`.
19
19
 
@@ -33,11 +33,19 @@ Tell the person plainly what does not carry. Their users sign up again on the ne
33
33
  1. Make the change.
34
34
  2. `nerd check` (static rules, then typecheck). Fix anything it reports.
35
35
  3. `nerd dev` to run locally when you need to try it. The local app talks to the real auth service, so signup and login work exactly as in production.
36
- 4. `nerd deploy` when it is ready. It runs the checks, builds, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
36
+ 4. `nerd deploy` when it is ready. It runs the checks, builds, stores a copy of the code, applies pending migrations, uploads, prints the URL, and probes the live URL (headers and the sign-in routes). With `--json` the output carries `probes`, the same shape as a check result, with `status: "skip"` and the reason when it did not run; probe findings never fail the deploy.
37
37
  5. If something is wrong after deploying: `nerd logs` shows recent output from the deployed app (`--q` to search, `--pr 12` for a preview), `nerd deployments` shows status and errors, `nerd db query "..."` inspects production data.
38
38
 
39
39
  Run `nerd check --json` when you want a machine-readable list of problems. Its summary says how many gates ran and which were skipped (`skipped` in the JSON): semgrep and gitleaks only run locally when installed; git builds always run them in the builder.
40
40
 
41
+ ## Saving and restoring the code
42
+
43
+ Every `nerd deploy` stores a copy of the code with the deployment, and `nerd save` stores one without deploying. Run `nerd save` at the end of every working session so the person's work is kept even when it was not deployed; it prints "Nothing changed since the last save." when there is nothing new. Work since the last save or deploy exists only on this computer, so say that whenever you tell the person their work is saved.
44
+
45
+ On a new computer, or when the folder is lost: `nerd pull <org>/<project>`, then `pnpm install`, then `nerd dev`. `nerd pull` restores the newest saved copy into a new folder; `--deployment <id>` restores the code of a specific deploy. If `nerd deploy` stops because the live app was deployed from another copy of the code, run `nerd pull` to work from that copy, or `nerd deploy --force` only when the person confirms this copy should replace it.
46
+
47
+ GitHub is optional. The next section says what connecting it adds.
48
+
41
49
  ## Deploying from GitHub
42
50
 
43
51
  Once the repo is linked (`nerd github connect`, then `nerd github link owner/repo`), every push to the production branch builds and deploys automatically, and every pull request gets a preview at its own URL, posted as a PR comment. `nerd builds` lists builds; `nerd builds show <id>` prints the log when one fails. A failing build reports the same `nerd check` problems you would see locally, so fix and push again. Every preview gets its own database and bucket, and pending migrations are applied to it on each preview build, so a PR that changes the schema can be tried end to end before it merges.