@stagepass/cli 2.4.1 → 2.5.0

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/README.md CHANGED
@@ -6,7 +6,7 @@ The CLI sets up and manages the local Stagepass infrastructure (`.sp` domains, C
6
6
 
7
7
  ## Install
8
8
 
9
- Published CLI 2.4.0 requires Node.js **20.17+** (`engines.node`: `>=20.17.0`) on **macOS** with Homebrew, because `@inquirer/prompts@8` requires it. Node 18 is no longer supported; stay on `@stagepass/cli@2.2.7` if you must remain on Node 18. Development and CI use Node 22 or 24.
9
+ Published CLI 2.4.1 requires Node.js **20.17+** (`engines.node`: `>=20.17.0`) on **macOS** with Homebrew, because `@inquirer/prompts@8` requires it. Node 18 is no longer supported; stay on `@stagepass/cli@2.2.7` if you must remain on Node 18. Development and CI use Node 22 or 24.
10
10
 
11
11
  ```bash
12
12
  npm install -g @stagepass/cli@2
@@ -21,7 +21,7 @@ npx @stagepass/cli@2 setup
21
21
  ## Requirements
22
22
 
23
23
  - **macOS** (system commands refuse other platforms with exit code 1; this is not a breaking change because those commands never worked off macOS)
24
- - Published CLI 2.4.0: Node.js `>=20.17.0`. Use Node 22 or 24 for local development and CI
24
+ - Published CLI 2.4.1: Node.js `>=20.17.0`. Use Node 22 or 24 for local development and CI
25
25
  - Homebrew
26
26
 
27
27
  `stagepass --version` and `stagepass --help` work on any platform. For tests/CI only, set `STAGEPASS_SKIP_PLATFORM_CHECK=1` to bypass the macOS guard (not for production use).
@@ -65,8 +65,8 @@ Linked: https://my-project.sp -> /absolute/path/to/project
65
65
  | `stagepass new [name]` | Scaffold a lean Webflow project (TypeScript + SCSS by default). |
66
66
  | `stagepass build` | Run `npm run build` in the current project (forwards exit code). |
67
67
  | `stagepass watch` | Run `npm run watch` in the current project (forwards exit code). If Stagepass is not running, asks to start it (TTY) or prints a `stagepass start` hint (non-TTY / CI); warns with `stagepass link` when the cwd is not linked. |
68
- | `stagepass dev` | Like `stagepass watch`, plus live reload on the linked `.sp` domain (CSS can swap without a full reload). Same running check as watch; requires `stagepass link` (hard error if unlinked). |
69
- | `stagepass upgrade` | Bump `@stagepass/*`, sync declared modules, `AGENTS.md`, the Cursor rule and `types`, print Webflow snippets. Since 2.4.1, writes a missing PHP `.htaccess` when `"php": true`. |
68
+ | `stagepass dev` | Like `stagepass watch`, plus live reload on the linked `.sp` domain (CSS can swap without a full reload). Same running check as watch; requires `stagepass link` (hard error if unlinked). When `stagepass.json` has `"php": true`, also watches `api/` and `.php/` (same SSE stream and debounce; ignores `.env`, `.php/.env`, `.php/rate-limit/`, logs, pid files, key and certificate files, and editor temp files). A missing folder does not stop the command. |
69
+ | `stagepass upgrade` | Bump `@stagepass/*`, sync declared modules, `AGENTS.stagepass.md`, the short pointer in `AGENTS.md`, the Cursor rule and editor types (`types` or `stagepass.d.ts`), print Webflow snippets. Since 2.4.1, writes a missing PHP `.htaccess` when `"php": true`. |
70
70
 
71
71
  All commands support `-v, --verbose` where applicable.
72
72
 
@@ -120,11 +120,12 @@ Scaffold a project with flags for every choice (interactive prompts only on a TT
120
120
  | `--link` / `--no-link` | After scaffolding, run `stagepass link` (macOS only). Default: off; interactive macOS may offer it. |
121
121
  | `--git` / `--no-git` | `git init` (default: yes). |
122
122
  | `--remote <url>` | Set `origin` after git init (rejects URLs with embedded credentials). |
123
+ | `--cursor-rule` | Write `.cursor/rules/stagepass.mdc` even when the target has no `.cursor/` directory. Without this flag the rule is written only if `.cursor/` already exists. |
123
124
  | `--install` / `--no-install` | Run `npm install` (default: no). |
124
125
  | `-y, --yes` | Non-interactive; use defaults for omitted flags. |
125
126
  | `--dry-run` | Print the file plan without writing. |
126
127
 
127
- The name must be DNS-safe (lowercase `a-z`, `0-9`, hyphens; 1 to 63 chars; no leading/trailing hyphen). Existing files are never overwritten. Generated projects include `scripts/build.mjs` (content-hashed `dist/` + SRI `integrity` in `manifest.json`), scripts `build` / `watch` / `dev` (`dev` aliases `watch`), Webflow head/footer snippets (jsDelivr `@2`, loader plus the declared modules), `stagepass.json`, an `AGENTS.md` with the full `sp` API reference, `.cursor/rules/stagepass.mdc`, and a `.gitignore`. `@stagepass/loader` / `@stagepass/modules` are added as `^2` (same major as the CDN pin `@2`; npm installs the newest published 2.x). Per-module types are written only when the published or installed `@stagepass/modules` ships them (2.2.0 and later); otherwise `types` lists the umbrella `@stagepass/modules`.
128
+ The name must be DNS-safe (lowercase `a-z`, `0-9`, hyphens; 1 to 63 chars; no leading/trailing hyphen). Existing files are never overwritten. Generated projects include `scripts/build.mjs` (content-hashed `dist/` + SRI `integrity` in `manifest.json`), scripts `build` / `watch` / `dev` (`dev` aliases `watch`), Webflow head/footer snippets (jsDelivr `@2`, loader plus the declared modules), `stagepass.json`, `AGENTS.stagepass.md` (the CLI-owned guide), a short pointer in `AGENTS.md`, and a `.gitignore`. `.cursor/rules/stagepass.mdc` (`alwaysApply: true`, pointer to `@AGENTS.stagepass.md`) is written only when the target already has a `.cursor/` directory or you pass `--cursor-rule`. `@stagepass/loader` / `@stagepass/modules` are added as `^2` (same major as the CDN pin `@2`; npm installs the newest published 2.x). Per-module types are written only when the published or installed `@stagepass/modules` ships them (2.2.0 and later); otherwise `types` lists the umbrella `@stagepass/modules`.
128
129
 
129
130
  Interactively (macOS), `new` runs a read-only `doctor` preflight and can offer `stagepass setup` if the local stack looks incomplete (never automatic, never under `--yes` / no-TTY, never sudo by itself). Without a TTY (or with `--yes`) it uses `--site-modules`, then `--site` detection, else `[]` with a hint. The interactive wizard always asks whether to enable PHP unless `--php` / `--no-php` was passed. Staging / production prompts, `--staging` detection, and `link` reading `origin` / `production` from `stagepass.json` are part of this release.
130
131
 
@@ -132,7 +133,7 @@ Interactively (macOS), `new` runs a read-only `doctor` preflight and can offer `
132
133
 
133
134
  `--php` writes a plain PHP 8.2 boilerplate: `api/action.php` is the only public entry, actions are an allowlist in `api/actions.php`, and `.php/config.php` sits in the same folder as `api/`. That folder is the document root (the project root locally, `dist/` after `stagepass build`). Copy `api/.env.example` to `.env` in the project root (or use `.php/.env`) and set `ALLOWED_ORIGINS` (include `https://<name>.sp`). There is no mail. `load_config()` reads that project-root `.env` and `.php/.env`. It never reads `api/.env`.
134
135
 
135
- Caddy already returns 404 for any path segment that starts with `.` (`/.env`, `/api/.env`, `/.php/`). Since 2.4.1, `stagepass new --php` ships a web-root `.htaccess` with the Apache rule below, and `stagepass build` copies it into `dist/` when the project has one. Published CLI 2.4.0 does not ship that file. `stagepass new` refuses to overwrite an existing `.htaccess`. nginx does not read `.htaccess`; add the snippet below in the server block before `location ~ \.php$`. Prefer real environment variables so a `.env` file is not required in the web root.
136
+ Caddy already returns 404 for any path segment that starts with `.` (`/.env`, `/api/.env`, `/.php/`). Since 2.4.1, `stagepass new --php` ships a web-root `.htaccess` with the Apache rule below, and `stagepass build` copies it into `dist/` when the project has one. CLI 2.4.0 and older do not ship that file. `stagepass new` refuses to overwrite an existing `.htaccess`. nginx does not read `.htaccess`; add the snippet below in the server block before `location ~ \.php$`. Prefer real environment variables so a `.env` file is not required in the web root.
136
137
 
137
138
  `stagepass new` and `doctor` warn when `php` is missing, older than 8.2, or has no `php-fpm` / `php-cgi` (`brew install php` on macOS). `stagepass dev` and `stagepass watch` on a `"php": true` project do the same check and start Homebrew php-fpm (`brew services start php`, and `brew services restart php` only if start fails), the same helper `stagepass start` has used since 2.3. The JS build still runs. `stagepass build` copies `api/` to `dist/api/`, `.php/config.php` to `dist/.php/config.php`, and a project-root `.htaccess` to `dist/.htaccess` when `"php": true` and the file exists. It does not copy `.env`, `.php/.env`, or `.php/rate-limit/`. The copy also skips logs, pid files, and key, certificate, or database files (`.pem`, `.key`, `.p12`, `.pfx`, `.crt`, `.cer`, `.sqlite`, `.db`). It keeps `.htaccess` and `.env.example`. A `dist/.htaccess` already on disk stays when the project has none. Upload `dist/` (the folder that contains `api/`). That folder is the web root, so `.php/` is public on Apache and nginx unless hidden paths are denied. The public URL stays `/api/action.php`.
138
139
 
@@ -156,9 +157,9 @@ location ~* /\.(?!well-known\/) {
156
157
  }
157
158
  ```
158
159
 
159
- Both rules were tested on 12 November 2026 on php:8.2-apache (`AllowOverride All`, `a2enmod rewrite`) and on nginx 1.27 with php:8.2-fpm. `/.env`, `/.php/config.php`, `/api/.env.example`, and `/.git/HEAD` returned HTTP 403, with no secret or config leak. `/api/action.php?action=ping` returned HTTP 200, `{"status":"success","data":{"pong":true},"message":null}`. `/.well-known/test.txt` returned HTTP 200, body `well-known-ok`. `/.well-known/` as a directory with no index file returned HTTP 403 on both servers (no DirectoryIndex). Visible files under `/.well-known/` stay reachable. Published CLI 2.4.0 still needs these rules added by hand. Since 2.4.1 the Apache rule ships in the PHP scaffold, and `stagepass upgrade` writes a missing project `.htaccess` when `"php": true` ([quYArF43](https://trello.com/c/quYArF43)). nginx still needs the snippet on the host.
160
+ Both rules were tested on 12 November 2026 on php:8.2-apache (`AllowOverride All`, `a2enmod rewrite`) and on nginx 1.27 with php:8.2-fpm. `/.env`, `/.php/config.php`, `/api/.env.example`, and `/.git/HEAD` returned HTTP 403, with no secret or config leak. `/api/action.php?action=ping` returned HTTP 200, `{"status":"success","data":{"pong":true},"message":null}`. `/.well-known/test.txt` returned HTTP 200, body `well-known-ok`. `/.well-known/` as a directory with no index file returned HTTP 403 on both servers (no DirectoryIndex). Visible files under `/.well-known/` stay reachable. CLI 2.4.0 and older still need these rules added by hand. Since 2.4.1 the Apache rule ships in the PHP scaffold, and `stagepass upgrade` writes a missing project `.htaccess` when `"php": true` ([quYArF43](https://trello.com/c/quYArF43)). nginx still needs the snippet on the host.
160
161
 
161
- `stagepass dev` / `watch` serve PHP from the project root, so edits show up on the next request. From the folder that contains `api/`, `php -S 127.0.0.1:8080 -t .` matches `/api/action.php`. `php -S` does not apply Caddy's hidden-path 404. Do not point it at a folder that already contains a real `.env`. Prefer `stagepass dev` or the linked `.sp` domain. `sp.resolveLocalUrl` returns a URL only during an active `.sp` session. On Webflow, `window.location.origin` is the Webflow host, which does not run PHP. Fetch the absolute PHP host, for example `https://php.example.com/api/action.php`. `rate_limit_allows()` is fail-open and `client_ip()` uses only `REMOTE_ADDR`, never `X-Forwarded-For` (do not trust that header without a proxy allowlist). Behind a reverse proxy every visitor can share one counter. Still open: [sgt7wKlT](https://trello.com/c/sgt7wKlT). `stagepass upgrade` does not add the `api/` or `.php/` boilerplate. When `"php": true` and the project root has no `.htaccess`, it writes the shipped template (same bytes as `stagepass new --php`). An existing `.htaccess` is left unchanged. If that file has no `RewriteRule "(^|/)\." - [F]` line, upgrade prints a hint and still exits 0. Published CLI 2.4.0 does not write that file. The website guide is live at [https://stagepass.one/docs/php/](https://stagepass.one/docs/php/) (source outline: [docs/php.md](https://github.com/arobertherz/stagepass/blob/master/docs/php.md)).
162
+ `stagepass dev` / `watch` serve PHP from the project root, so edits show up on the next request. When `"php": true`, `stagepass dev` also watches `api/` and `.php/` and reloads the browser on that same live-reload stream and debounce as `dist/`. It ignores `.env`, `.php/.env`, `.php/rate-limit/`, logs, pid files, key, certificate, and database files (`.pem`, `.key`, `.p12`, `.pfx`, `.crt`, `.cer`, `.sqlite`, `.db`), and editor temp files (`~`, `.swp`, `.DS_Store`). A missing `api/` or `.php/` does not stop the command. The start log names those directories. Without `"php": true` live reload stays on the output directory. From the folder that contains `api/`, `php -S 127.0.0.1:8080 -t .` matches `/api/action.php`. `php -S` does not apply Caddy's hidden-path 404. Do not point it at a folder that already contains a real `.env`. Prefer `stagepass dev` or the linked `.sp` domain. `sp.resolveLocalUrl` returns a URL only during an active `.sp` session. On Webflow, `window.location.origin` is the Webflow host, which does not run PHP. Fetch the absolute PHP host, for example `https://php.example.com/api/action.php`. `rate_limit_allows()` logs storage faults (directory, file, `flock`, or a thrown error). The response is HTTP 503, JSend `error`, `Retry-After: 60`, and no internals, unless `APP_ENV` is `local`, `development`, or `dev` (trimmed, any case). Empty, unset, and every other value stay closed. A limit hit stays HTTP 429. `client_ip()` uses `REMOTE_ADDR` unless that peer is in `TRUSTED_PROXIES`, then reads `TRUSTED_PROXY_HEADER` (`x-forwarded-for` or RFC 7239 `forwarded`) from right to left. This applies to projects created with CLI 2.5.0. CLI 2.4.1 and older stay fail-open and use only `REMOTE_ADDR`. `stagepass upgrade` does not change `api/`. Copy `api/lib/security.php`, `api/lib/request.php`, `api/lib/config.php`, `.php/config.php`, and `api/action.php` from a new scaffold, or re-scaffold. [sgt7wKlT](https://trello.com/c/sgt7wKlT). `stagepass upgrade` does not add the `api/` or `.php/` boilerplate. When `"php": true` and the project root has no `.htaccess`, it writes the shipped template (same bytes as `stagepass new --php`). An existing `.htaccess` is left unchanged. If that file has no `RewriteRule "(^|/)\." - [F]` line, upgrade prints a hint and still exits 0. CLI 2.4.0 and older do not write that file. The website guide is live at [https://stagepass.one/docs/php/](https://stagepass.one/docs/php/) (source outline: [docs/php.md](https://github.com/arobertherz/stagepass/blob/master/docs/php.md)).
162
163
 
163
164
  ### Declared modules (`stagepass.json`)
164
165
 
@@ -168,8 +169,9 @@ Both rules were tested on 12 November 2026 on php:8.2-apache (`AllowOverride All
168
169
 
169
170
  `modules` is `[]` (loader only), a list of `inject`, `cookies`, `maintenance`, or `["all"]`. It must match what your Webflow site loads. From it the CLI generates:
170
171
 
171
- - the managed block in `AGENTS.md` (between `<!-- stagepass:begin -->` and `<!-- stagepass:end -->`): loader API always, full sections for declared modules, a "not available; enable by …" line for the others, and the rule never to use undeclared `sp.<module>`;
172
- - `.cursor/rules/stagepass.mdc` (globs `src/**`) with the same content;
172
+ - `AGENTS.stagepass.md` (CLI-owned): feature set, safe rules, local workflow, editor types, the loader API, full sections for declared modules, a "not available; enable by …" line for the others, and the rule never to use undeclared `sp.<module>`. When `stagepass.json` has `"php": true` and `api/lib/` is present, it also documents the PHP helpers. The first line is `<!-- stagepass:managed cli=<version> sha256=<body> -->`. Do not edit it by hand. `stagepass upgrade` rewrites it. Your notes belong in `AGENTS.md`.
173
+ - a short pointer in `AGENTS.md` (between `<!-- stagepass:begin -->` and `<!-- stagepass:end -->`) that tells agents to read `AGENTS.stagepass.md`;
174
+ - `.cursor/rules/stagepass.mdc` with `alwaysApply: true` and a pointer to `@AGENTS.stagepass.md`, only when `.cursor/` already exists or `--cursor-rule` is set (`AGENTS.md` stays the tool-neutral guide);
173
175
  - `compilerOptions.types` in `tsconfig.json` / `jsconfig.json`: `@stagepass/loader` plus `@stagepass/modules/<module>` for each declared module (`@stagepass/modules` for `all`), so undeclared modules are type errors. Published `@stagepass/loader` 2.5.0 `global.d.ts` augments `Window` with `sp` and `stagepass` (both `StagepassAPI`) and declares global `var sp` / `var stagepass`. The scaffold `src/main.ts` still narrows `sp` to `log` for the ready line. The official types are wider.
174
176
 
175
177
  The legacy boolean `"modules": true|false` is still read; `upgrade` replaces it with a list (`true` becomes `["all"]` without a TTY).
@@ -191,17 +193,30 @@ Still not recognised: tags without `src`, `data-src` only, other hosts without a
191
193
  | `--site <host>` | Live site to detect modules from (default: the origin linked in `~/.stagepass/projects.json` for this folder). Stored in `stagepass.json` when given. |
192
194
  | `--site-modules <list>` | Set the modules list directly (`none`, `all`, or a comma list). |
193
195
  | `--skip-site` | Do not fetch the live site. |
194
- | `-y, --yes` | Accept the detected or existing list without asking. With `--yes`, CLI 2.4.0 also replaces an unmodified `scripts/build.mjs`. |
196
+ | `-y, --yes` | Accept the detected or existing list without asking. Also replaces an unmodified `scripts/build.mjs`, and a hand-edited `AGENTS.stagepass.md`. Required for those replacements when there is no TTY. |
195
197
  | `--dry-run` | Print every planned change; write no file. |
198
+ | `--cursor-rule` | Write `.cursor/rules/stagepass.mdc` even when the project has no `.cursor/` directory. |
196
199
 
197
200
  `upgrade` bumps `@stagepass/*` in `package.json`, then resolves the modules list (`--site-modules`, else live detection, confirmed interactively; if the site is unreachable or no origin is known it asks; without a TTY it keeps the existing list or `[]` and prints a hint). It then syncs the project:
198
201
 
199
202
  - `stagepass.json`: writes the `modules` list.
200
- - `AGENTS.md`: created if missing, otherwise only the managed block is replaced (or appended when there is none). Your own text stays. Broken markers are left alone with a hint.
201
- - `.cursor/rules/stagepass.mdc`: created if missing, otherwise only its managed block is refreshed.
202
- - `tsconfig.json` / `jsconfig.json`: only `compilerOptions.types` changes, the rest of the JSON is preserved. Files with comments, or without a `types` array, are skipped with a hint.
203
- - `scripts/build.mjs`: CLI 2.4.0 replaces it when it is still an unmodified scaffold from an earlier CLI (line endings ignored; `src/main.js` / `src/main.ts` and `src/styles.css` / `src/styles.scss` still count). The interactive prompt defaults to yes. Without a TTY, and with `--yes`, the file is replaced. `--dry-run` writes nothing. An edited script is left unchanged and the CLI prints what `stagepass build`, `stagepass watch` and `stagepass dev` do now. A missing script stays missing. Published CLI 2.3.1 does not replace that file.
204
- - `.htaccess`: since 2.4.1, when `stagepass.json` has `"php": true` and the project root has no `.htaccess`, upgrade writes the shipped template (same bytes as `stagepass new --php`). An existing file is not modified. If it has no `RewriteRule "(^|/)\." - [F]` line, a hint points at https://stagepass.one/docs/php/ and `api/README.md` and the command still exits 0. A symlink or directory at that name is left in place. Projects without `"php": true` are unchanged. `--dry-run` writes nothing. Published CLI 2.4.0 does not write this file.
203
+ - `AGENTS.stagepass.md`: created when missing. Rewritten when the managed hash still matches and the generated text changed. A hand edit (hash mismatch, or no `stagepass:managed` header) is replaced only with `--yes` or a TTY confirmation (default yes). Without a TTY and without `--yes`, the file stays and the CLI prints a hint that names `--yes`. A second run writes nothing when the file is already current. A symlink is left unchanged.
204
+ - `AGENTS.md`: created if missing (title plus the short pointer). Otherwise only the pointer between the markers is replaced, or appended when there are none. Text outside the markers stays byte for byte, including older generated sections. Upgrade prints a hint when those older sections are still outside the markers. Broken markers are left alone with a hint.
205
+ - `.cursor/rules/stagepass.mdc`: not created unless `.cursor/` already exists or `--cursor-rule` is set. An existing rule is never deleted. With stagepass markers, only the managed block is refreshed (`alwaysApply: true`, pointer to `@AGENTS.stagepass.md`). The previous generated frontmatter (`globs: src/**`, `alwaysApply: false`) is updated when it is still unchanged. A rule without markers is left alone. `stagepass doctor` does not warn about a missing rule when `.cursor/` is absent. When `.cursor/` exists, a missing or stale rule is a warning.
206
+ - `CLAUDE.md`: when the file already exists, the same short pointer is inserted or refreshed. The file is not created.
207
+ - `tsconfig.json` / `jsconfig.json`: a plain JSON file that already has `compilerOptions.types` is updated in place. The rest of the JSON is preserved. Comments, invalid JSON, and a missing `types` array are not edited. See [Types in existing projects](#types-in-existing-projects).
208
+ - `scripts/build.mjs`: replaced when it is still an unmodified scaffold from an earlier CLI (line endings ignored; `src/main.js` / `src/main.ts` and `src/styles.css` / `src/styles.scss` still count). The TTY prompt defaults to yes. `--yes` replaces it without asking, including when there is no TTY. Without a TTY and without `--yes`, the file stays and the CLI prints a hint that names `--yes`. `--dry-run` writes nothing. An edited script is left unchanged and the CLI prints what `stagepass build`, `stagepass watch` and `stagepass dev` do now. A missing script stays missing. Published CLI 2.3.1 does not replace that file. CLI 2.4.1 and older replace it even without a TTY and without `--yes`.
209
+
210
+ Those two replacements (`scripts/build.mjs` when it is still a known scaffold, and `AGENTS.stagepass.md` when it was edited by hand or has no managed header) are the upgrade writes that wait for a TTY answer or `--yes`. A managed `AGENTS.stagepass.md` whose hash still matches is refreshed without asking. The others stay non-interactive, with or without a TTY: `package.json` range updates, missing `@stagepass/loader` and `@stagepass/modules` devDependencies (an existing spec is not removed), `stagepass.d.ts` when the file is missing or already has the `// @stagepass-types` marker, and a missing `.htaccess` when `"php": true`. Those do not replace a hand-edited source file. A custom `scripts/build.mjs`, a `stagepass.d.ts` without the marker, and an existing `.htaccess` stay as they are. `upgrade --json` matches CLI 2.4.0 and later: the flag is unknown, stdout is empty, and nothing is written. There is no JSON object on that command.
211
+ - `.htaccess`: since 2.4.1, when `stagepass.json` has `"php": true` and the project root has no `.htaccess`, upgrade writes the shipped template (same bytes as `stagepass new --php`). An existing file is not modified. If it has no `RewriteRule "(^|/)\." - [F]` line, a hint points at https://stagepass.one/docs/php/ and `api/README.md` and the command still exits 0. A symlink or directory at that name is left in place. Projects without `"php": true` are unchanged. `--dry-run` writes nothing. CLI 2.4.0 and older do not write this file.
212
+
213
+ ### Types in existing projects
214
+
215
+ Since 2.5.0, when the editor reports `Cannot find name 'sp'` and the page still runs, run `stagepass upgrade`. CLI 2.4.1 and older only update a plain `compilerOptions.types` array. Upgrade writes `package.json` only. It does not run `npm install`.
216
+
217
+ 1. `stagepass upgrade` (`--dry-run` prints the plan and writes nothing). `@stagepass/loader` is added to `devDependencies` when it is missing. `@stagepass/modules` is added only when the declared module list is not empty. A plain `tsconfig.json` or `jsconfig.json` that already has a `types` array is updated. Otherwise upgrade writes `stagepass.d.ts` (first line `// @stagepass-types`) with `/// <reference types="..." />` lines, at the project root when that path is included, or under a directory `include` already covers. A config with comments or invalid JSON is not edited. If `include` or `files` would not cover the reference file, upgrade reports that and leaves the config unchanged. A `stagepass.d.ts` without the marker is left unchanged. With no `tsconfig.json` or `jsconfig.json`, the reference file is still written at the project root. Upgrade does not create a config. Editors load `stagepass.d.ts` only as part of a project, so the command prints a note (also on `--dry-run`): add a `jsconfig.json` or `tsconfig.json` that includes your sources, for example `{"include": ["src", "stagepass.d.ts"]}`, then run `stagepass upgrade` again. A missing `stagepass.json` does not skip this step.
218
+ 2. `npm install`
219
+ 3. In the editor command palette: `TypeScript: Restart TS Server`.
205
220
 
206
221
  Every change is printed as `file: action` (unchanged files are not listed; skipped files appear as hints). `npm install` is printed, not run. Snippets use the major pin `@2` plus an optional exact pin note.
207
222
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stagepass/cli",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "Local Development Orchestrator for Webflow",
5
5
  "type": "module",
6
6
  "main": "bin/index.js",
package/src/cli.js CHANGED
@@ -326,10 +326,11 @@ export function createProgram(deps = {}) {
326
326
  'Bump @stagepass/*, sync project files, replace an unmodified scripts/build.mjs, add a missing PHP .htaccess, print Webflow snippets'
327
327
  )
328
328
  .option('--dry-run', 'Show changes without writing any file')
329
+ .option('--cursor-rule', 'Write .cursor/rules/stagepass.mdc even when .cursor/ is absent')
329
330
  .option('--site <host>', 'Live Webflow site to detect loaded modules from (https)')
330
331
  .option('--site-modules <list>', 'Modules the site loads: none, all, or inject,cookies,maintenance')
331
332
  .option('--skip-site', 'Do not fetch the live site')
332
- .option('-y, --yes', 'Non-interactive; accept detected or existing modules and an unmodified scripts/build.mjs')
333
+ .option('-y, --yes', 'Non-interactive; accept detected or existing modules and replace an unmodified scripts/build.mjs')
333
334
  .option(
334
335
  '--target <version>',
335
336
  'Target version, range or dist-tag; must be published on npm (default: ^<latest published 2.x>, ^2 offline)'
@@ -397,6 +398,7 @@ export function createProgram(deps = {}) {
397
398
  .option('--git', 'Initialize a git repository')
398
399
  .option('--no-git', 'Do not initialize git')
399
400
  .option('--remote <url>', 'Git remote URL (requires git)')
401
+ .option('--cursor-rule', 'Write .cursor/rules/stagepass.mdc even when .cursor/ is absent')
400
402
  .option('--install', 'Run npm install after scaffolding')
401
403
  .option('--no-install', 'Do not run npm install (default)')
402
404
  .option('-y, --yes', 'Non-interactive; accept defaults for omitted flags')
@@ -15,8 +15,8 @@ import {
15
15
  clearStaleDevPorts,
16
16
  } from '../lib/projects.js';
17
17
  import { applySiteBlock } from '../lib/apply-site-block.js';
18
- import { createLiveServer, resolveOutputDir } from '../lib/live-server.js';
19
- import { readStagepassJson } from '../lib/project-sync.js';
18
+ import { createLiveServer, resolveOutputDir, PHP_WATCH_DIRS } from '../lib/live-server.js';
19
+ import { phpFromStagepassConfig, readStagepassJson } from '../lib/project-sync.js';
20
20
  import { getCaddyfilePath, getProjectsPath, validateRoot } from '../lib/paths.js';
21
21
  import { isPidAlive, isValidDevPort } from '../lib/dev-port.js';
22
22
  import { ensureStagepassReady } from '../lib/ensure-running.js';
@@ -159,6 +159,7 @@ export async function dev(options = {}, deps = {}) {
159
159
  /** @type {NodeJS.Signals | null} */
160
160
  let stopSignal = null;
161
161
  let setupDone = false;
162
+ let phpLive = false;
162
163
 
163
164
  try {
164
165
  let project = await getProject(domain, projectsPath);
@@ -205,6 +206,9 @@ export async function dev(options = {}, deps = {}) {
205
206
  return 1;
206
207
  }
207
208
 
209
+ const stagepass = await readStagepassJson(cwd, fse);
210
+ phpLive = phpFromStagepassConfig(stagepass.data) === true;
211
+
208
212
  if (options.verbose) {
209
213
  log(chalk.dim(`Live reload watching ${outDir.rel}/ → https://${domain}/__stagepass/live`));
210
214
  }
@@ -213,6 +217,7 @@ export async function dev(options = {}, deps = {}) {
213
217
  const server = createServer({
214
218
  projectRoot: rootCheck.path,
215
219
  outDir: outDir.rel,
220
+ php: phpLive,
216
221
  log: options.verbose ? (m) => log(chalk.dim(m)) : () => {},
217
222
  });
218
223
  live = await server.listen(0);
@@ -343,6 +348,10 @@ export async function dev(options = {}, deps = {}) {
343
348
  });
344
349
 
345
350
  log(chalk.green(`Live reload on https://${domain}/__stagepass/live (127.0.0.1:${live.port})`));
351
+ if (phpLive) {
352
+ const names = PHP_WATCH_DIRS.map((dir) => `${dir}/`).join(' and ');
353
+ log(chalk.dim(`Live reload also watching ${names}`));
354
+ }
346
355
  if (options.verbose) {
347
356
  log(chalk.dim('Running: npm run watch'));
348
357
  }
@@ -20,8 +20,9 @@ import {
20
20
  printWebflowSnippets,
21
21
  } from '../lib/snippets.js';
22
22
 
23
- import { STAGEPASS_PACKAGES_VERSION } from '../lib/versions.js';
23
+ import { SNIPPET_LOADER_VERSION } from '../lib/cdn-base.js';
24
24
  import { formatModules, normalizeModulesList } from '../lib/project-modules.js';
25
+ import { cursorDirPresent } from '../lib/project-sync.js';
25
26
  import { describeDetection, detectSite, normalizeSiteUrl } from '../lib/site-detect.js';
26
27
  import {
27
28
  PACKAGES_MAJOR_RANGE,
@@ -438,8 +439,8 @@ export async function resolveNewOptions(nameArg, options = {}, deps = {}) {
438
439
  remote: remoteCheck.remote,
439
440
  install,
440
441
  dryRun: options.dryRun === true,
441
- loaderVersion:
442
- deps.packagesVersion || deps.cliVersion || STAGEPASS_PACKAGES_VERSION,
442
+ cursorRule: options.cursorRule === true,
443
+ loaderVersion: deps.packagesVersion || SNIPPET_LOADER_VERSION,
443
444
  },
444
445
  };
445
446
  }
@@ -653,6 +654,9 @@ export async function createNew(nameArg, options = {}, deps = {}) {
653
654
  const targetDir = path.isAbsolute(config.dir)
654
655
  ? config.dir
655
656
  : path.resolve(cwd, config.dir);
657
+ if (config.cursorRule !== true) {
658
+ config.cursorRule = await cursorDirPresent(targetDir, fse);
659
+ }
656
660
 
657
661
  const templatesRootResolved = path.resolve(templatesRoot);
658
662
  const readTemplate = async (rel) => {
@@ -847,6 +851,9 @@ export async function createNew(nameArg, options = {}, deps = {}) {
847
851
  const snippets = buildWebflowSnippets({
848
852
  version: config.loaderVersion,
849
853
  moduleList: config.siteModules,
854
+ gitRemote: config.git ? config.remote || '' : '',
855
+ gitBranch: config.git ? 'main' : '',
856
+ projectName: config.name,
850
857
  });
851
858
  printWebflowSnippets(snippets, log);
852
859
 
@@ -26,8 +26,24 @@ import {
26
26
  LAUNCH_AGENT_LABEL,
27
27
  } from '../lib/autostart.js';
28
28
  import { ensurePhpFpm } from '../lib/php-fpm.js';
29
+ import { buildOfficialHeadSnippets, printWebflowHeadSnippets } from '../lib/snippets.js';
30
+ import { declaredModules, readStagepassJson } from '../lib/project-sync.js';
29
31
  import { certsTrust, certsRenew } from './certs.js';
30
32
 
33
+ /**
34
+ * Loader plus the modules declared in this project's stagepass.json.
35
+ * @param {string} cwd
36
+ */
37
+ async function printStartHeadSnippets(cwd) {
38
+ const sp = await readStagepassJson(cwd);
39
+ const declared = declaredModules(sp.data);
40
+ const moduleList = Array.isArray(declared) ? declared : [];
41
+ printWebflowHeadSnippets(buildOfficialHeadSnippets({ moduleList }));
42
+ if (moduleList.length === 0) {
43
+ console.log('No modules are declared in stagepass.json.');
44
+ }
45
+ }
46
+
31
47
  const PORT_IGNORE = ['Google Chrome', 'Chrome Helper', 'OneDrive', 'Music', 'Safari', 'caddy'];
32
48
 
33
49
  /**
@@ -412,6 +428,7 @@ export async function start(options = {}) {
412
428
  return 1;
413
429
  }
414
430
  }
431
+ let kickstarted = false;
415
432
  try {
416
433
  await exec('launchctl', buildLaunchctlKickstartArgs(uid));
417
434
  if (!options.verbose) {
@@ -426,7 +443,7 @@ export async function start(options = {}) {
426
443
  chalk.green(`✔ kickstart gui/${uid}/${LAUNCH_AGENT_LABEL}`)
427
444
  );
428
445
  }
429
- return 0;
446
+ kickstarted = true;
430
447
  } catch (error) {
431
448
  if (!options.verbose) spinner.fail('launchctl kickstart failed.');
432
449
  console.log(
@@ -435,6 +452,10 @@ export async function start(options = {}) {
435
452
  console.log(chalk.dim('Falling back to direct caddy start...'));
436
453
  if (!options.verbose) spinner.start('Booting background services...');
437
454
  }
455
+ if (kickstarted) {
456
+ await printStartHeadSnippets(options.cwd || process.cwd());
457
+ return 0;
458
+ }
438
459
  }
439
460
 
440
461
  // Direct caddy start (no LaunchAgent)
@@ -454,6 +475,7 @@ export async function start(options = {}) {
454
475
  } else {
455
476
  console.log(chalk.green('✔ Stagepass is active.'));
456
477
  }
478
+ await printStartHeadSnippets(options.cwd || process.cwd());
457
479
  return 0;
458
480
  } catch (error) {
459
481
  if (!options.verbose) spinner.fail('Failed to start.');
@@ -5,11 +5,12 @@ import { defaultExec } from '../lib/exec.js';
5
5
  import {
6
6
  buildWebflowSnippets,
7
7
  printWebflowSnippets,
8
+ readSnippetGitRef,
8
9
  } from '../lib/snippets.js';
9
10
 
10
11
  import readline from 'node:readline/promises';
11
12
  import { stdin as input, stdout as output } from 'node:process';
12
- import { STAGEPASS_PACKAGES_VERSION } from '../lib/versions.js';
13
+ import { SNIPPET_LOADER_VERSION } from '../lib/cdn-base.js';
13
14
  import {
14
15
  PACKAGES_MAJOR_RANGE,
15
16
  fetchPublished,
@@ -169,12 +170,56 @@ export function applyStagepassVersions(pkg, target) {
169
170
  return { next, changes };
170
171
  }
171
172
 
173
+ function packageHas(pkg, name) {
174
+ for (const section of ['dependencies', 'devDependencies']) {
175
+ const block = pkg?.[section];
176
+ if (block && typeof block === 'object' && !Array.isArray(block) && Object.prototype.hasOwnProperty.call(block, name)) {
177
+ return true;
178
+ }
179
+ }
180
+ return false;
181
+ }
182
+
183
+ /**
184
+ * Add type packages the project does not already depend on.
185
+ * Loader is always required. `@stagepass/modules` only when the declared list is non-empty.
186
+ * Does not run npm install.
187
+ * @param {object} pkg
188
+ * @param {string[]} modules normalized declared list
189
+ * @param {Record<string, string>} specs name to version spec
190
+ * @returns {{ next: object, added: { name: string, to: string, section: 'devDependencies' }[] }}
191
+ */
192
+ export function ensureTypeDevDependencies(pkg, modules, specs) {
193
+ const next = structuredClone(pkg);
194
+ /** @type {{ name: string, to: string, section: 'devDependencies' }[]} */
195
+ const added = [];
196
+ const names = ['@stagepass/loader'];
197
+ if (Array.isArray(modules) && modules.length > 0) names.push('@stagepass/modules');
198
+ for (const name of names) {
199
+ if (packageHas(next, name)) continue;
200
+ const to = specs?.[name];
201
+ if (!to) continue;
202
+ if (next.devDependencies == null) next.devDependencies = {};
203
+ if (typeof next.devDependencies !== 'object' || Array.isArray(next.devDependencies)) continue;
204
+ next.devDependencies[name] = to;
205
+ added.push({ name, to, section: 'devDependencies' });
206
+ }
207
+ return { next, added };
208
+ }
209
+
172
210
  /**
173
211
  * Upgrade @stagepass/* deps in the current project's package.json and sync
174
- * the declared modules into stagepass.json, AGENTS.md, the Cursor rule and
175
- * tsconfig/jsconfig types. Replaces scripts/build.mjs when it is still an
176
- * unmodified scaffold from an earlier CLI. When stagepass.json has `"php": true`
212
+ * the declared modules into stagepass.json, AGENTS.stagepass.md, the short
213
+ * pointer in AGENTS.md, the Cursor rule and editor types (a plain `types`
214
+ * array, or stagepass.d.ts). Adds missing `@stagepass/loader` and, when
215
+ * modules are declared, `@stagepass/modules` devDependencies. Replaces
216
+ * scripts/build.mjs when it is still an unmodified scaffold from an earlier
217
+ * CLI, and replaces a hand-edited AGENTS.stagepass.md, when the user passed
218
+ * `--yes` or confirmed on a TTY. Without a TTY and without `--yes`, prints
219
+ * a hint and leaves that file. A managed AGENTS.stagepass.md is refreshed
220
+ * without asking. When stagepass.json has `"php": true`
177
221
  * and the project root has no `.htaccess`, writes the shipped template.
222
+ * It does not copy `api/` when that boilerplate is missing.
178
223
  *
179
224
  * @param {object} [options]
180
225
  * @param {boolean} [options.dryRun]
@@ -238,40 +283,23 @@ export async function upgrade(options = {}, deps = {}) {
238
283
  log(chalk.yellow(`npm registry not reachable: using ${PACKAGES_MAJOR_RANGE} (resolves to the newest published 2.x).`));
239
284
  }
240
285
 
241
- const { next, changes } = applyStagepassVersions(pkg, specs);
286
+ let { next, changes } = applyStagepassVersions(pkg, specs);
242
287
 
243
- if (changes.length === 0) {
244
- if (names.length === 0) {
245
- log(chalk.yellow('No @stagepass/* packages found in package.json.'));
246
- } else {
247
- log(chalk.green('@stagepass/* already at the newest published ranges.'));
248
- }
249
- } else {
288
+ if (changes.length > 0) {
250
289
  log(chalk.bold('Upgrade @stagepass/* (published versions only)'));
251
290
  for (const change of changes) {
252
291
  log(` ${change.name}: ${change.from} → ${change.to} (${change.section})`);
253
292
  }
254
- }
255
-
256
- // Per-module types need @stagepass/modules >= 2.2.0 resolvable from the range.
257
- /** @type {boolean | undefined} */
258
- let perModuleTypes;
259
- const modulesSpec =
260
- next?.dependencies?.['@stagepass/modules'] || next?.devDependencies?.['@stagepass/modules'];
261
- if (modulesSpec) {
262
- const fromRegistry = rangeHasPerModuleTypes(
263
- published['@stagepass/modules'] ? published['@stagepass/modules'].versions : null,
264
- String(modulesSpec)
265
- );
266
- perModuleTypes =
267
- fromRegistry != null ? fromRegistry : (await installedHasPerModuleTypes(cwd, fse)) === true;
293
+ } else if (names.length > 0) {
294
+ log(chalk.green('@stagepass/* already at the newest published ranges.'));
268
295
  }
269
296
 
270
297
  // Declared modules: live site first, then stagepass.json, then ask.
271
298
  const sp = await readStagepassJson(cwd, fse);
272
299
  if (sp.error) log(chalk.yellow(sp.error));
273
300
  const isTty = deps.isTTY != null ? Boolean(deps.isTTY) : Boolean(input.isTTY && output.isTTY);
274
- const interactive = isTty && options.yes !== true;
301
+ const assumeYes = options.yes === true;
302
+ const interactive = isTty && !assumeYes;
275
303
  /** @type {import('node:readline/promises').Interface | null} */
276
304
  let rl = null;
277
305
  const getRl = () => {
@@ -315,6 +343,53 @@ export async function upgrade(options = {}, deps = {}) {
315
343
  return 1;
316
344
  }
317
345
 
346
+ const typeNames = ['@stagepass/loader'];
347
+ if (resolved.modules.length > 0) typeNames.push('@stagepass/modules');
348
+ const missingTypes = typeNames.filter((name) => !packageHas(next, name));
349
+ /** @type {{ name: string, to: string, section: 'devDependencies' }[]} */
350
+ let added = [];
351
+ if (missingTypes.length > 0) {
352
+ let extra;
353
+ try {
354
+ extra = await resolveUpgradeTargets(options.version, missingTypes, {
355
+ exec: deps.exec || defaultExec,
356
+ fetchPublished: deps.fetchPublished,
357
+ });
358
+ } catch (error) {
359
+ log(chalk.red(error instanceof Error ? error.message : String(error)));
360
+ return 1;
361
+ }
362
+ Object.assign(published, extra.published);
363
+ const typeSpecs = Object.fromEntries(Object.entries(extra.targets).map(([name, target]) => [name, target.spec]));
364
+ const ensured = ensureTypeDevDependencies(next, resolved.modules, typeSpecs);
365
+ next = ensured.next;
366
+ added = ensured.added;
367
+ const alreadyOffline = Object.values(targets).some((target) => target.offline);
368
+ if (!alreadyOffline && Object.values(extra.targets).some((target) => target.offline)) {
369
+ log(chalk.yellow(`npm registry not reachable: using ${PACKAGES_MAJOR_RANGE} (resolves to the newest published 2.x).`));
370
+ }
371
+ }
372
+ if (added.length > 0) {
373
+ log(chalk.bold('Type packages (devDependencies)'));
374
+ for (const item of added) log(` ${item.name}: add ${item.to} (${item.section})`);
375
+ } else if (names.length === 0 && changes.length === 0) {
376
+ log(chalk.yellow('No @stagepass/* packages found in package.json.'));
377
+ }
378
+
379
+ // Per-module types need @stagepass/modules >= 2.2.0 resolvable from the range.
380
+ /** @type {boolean | undefined} */
381
+ let perModuleTypes;
382
+ const modulesSpec =
383
+ next?.dependencies?.['@stagepass/modules'] || next?.devDependencies?.['@stagepass/modules'];
384
+ if (modulesSpec) {
385
+ const fromRegistry = rangeHasPerModuleTypes(
386
+ published['@stagepass/modules'] ? published['@stagepass/modules'].versions : null,
387
+ String(modulesSpec)
388
+ );
389
+ perModuleTypes =
390
+ fromRegistry != null ? fromRegistry : (await installedHasPerModuleTypes(cwd, fse)) === true;
391
+ }
392
+
318
393
  const plan = await planProjectSync(
319
394
  {
320
395
  cwd,
@@ -322,6 +397,10 @@ export async function upgrade(options = {}, deps = {}) {
322
397
  origin: options.site ? resolved.origin : null,
323
398
  pkg: next,
324
399
  perModuleTypes,
400
+ interactive,
401
+ assumeYes,
402
+ confirm: confirmFn,
403
+ cursorRule: options.cursorRule === true,
325
404
  },
326
405
  fse
327
406
  );
@@ -366,6 +445,7 @@ export async function upgrade(options = {}, deps = {}) {
366
445
  cwd,
367
446
  currentSource: currentBuild,
368
447
  interactive,
448
+ assumeYes,
369
449
  confirm: confirmFn,
370
450
  fse,
371
451
  });
@@ -398,7 +478,7 @@ export async function upgrade(options = {}, deps = {}) {
398
478
  }
399
479
 
400
480
  log(chalk.bold(`\nProject files for modules: ${resolved.modules.length ? resolved.modules.join(', ') : 'none'}`));
401
- if (plan.writes.length === 0) {
481
+ if (plan.writes.length === 0 && buildUpgrade.action !== 'hint') {
402
482
  log(' Everything is up to date.');
403
483
  }
404
484
  for (const w of plan.writes) {
@@ -410,7 +490,11 @@ export async function upgrade(options = {}, deps = {}) {
410
490
  if (buildUpgrade.action === 'custom') {
411
491
  log(chalk.yellow(buildUpgrade.note));
412
492
  } else if (buildUpgrade.action !== 'update' && buildUpgrade.note) {
413
- const warn = buildUpgrade.action === 'declined' || buildUpgrade.action === 'symlink' || buildUpgrade.action === 'unreadable';
493
+ const warn =
494
+ buildUpgrade.action === 'declined' ||
495
+ buildUpgrade.action === 'symlink' ||
496
+ buildUpgrade.action === 'unreadable' ||
497
+ buildUpgrade.action === 'hint';
414
498
  const line = ` ${buildUpgrade.note}`;
415
499
  log(warn ? chalk.yellow(line) : line);
416
500
  }
@@ -422,11 +506,36 @@ export async function upgrade(options = {}, deps = {}) {
422
506
  );
423
507
  }
424
508
 
509
+ if (!snippetVersion) {
510
+ snippetVersion = await resolveSnippetLoaderVersion({
511
+ published: await getLoaderPub(),
512
+ cwd,
513
+ bundled: SNIPPET_LOADER_VERSION,
514
+ fse,
515
+ });
516
+ }
517
+ let snippets;
518
+ try {
519
+ const readGitRef = deps.readGitRef || readSnippetGitRef;
520
+ const gitRef = await readGitRef(cwd);
521
+ snippets = buildWebflowSnippets({
522
+ version: snippetVersion,
523
+ moduleList: resolved.modules,
524
+ gitRemote: gitRef && gitRef.gitRemote,
525
+ gitBranch: gitRef && gitRef.gitBranch,
526
+ projectName: pkg.name,
527
+ });
528
+ } catch (err) {
529
+ log(chalk.red(err instanceof Error ? err.message : String(err)));
530
+ return 1;
531
+ }
532
+
425
533
  if (options.dryRun) {
426
534
  log(chalk.dim('\nDry run: no files were modified.'));
427
535
  } else {
428
536
  try {
429
- if (changes.length > 0) {
537
+ const pkgChanged = changes.length > 0 || added.length > 0;
538
+ if (pkgChanged) {
430
539
  try {
431
540
  if ((await fse.lstat(pkgPath)).isSymbolicLink()) {
432
541
  log(chalk.red('package.json is a symlink; refusing to write.'));
@@ -445,7 +554,7 @@ export async function upgrade(options = {}, deps = {}) {
445
554
  } catch (err) {
446
555
  // Restore package.json if project-sync failed after the pkg write.
447
556
  try {
448
- if (changes.length > 0) await fse.writeFile(pkgPath, raw, 'utf8');
557
+ if (changes.length > 0 || added.length > 0) await fse.writeFile(pkgPath, raw, 'utf8');
449
558
  } catch {
450
559
  /* best effort */
451
560
  }
@@ -455,22 +564,16 @@ export async function upgrade(options = {}, deps = {}) {
455
564
  }
456
565
  }
457
566
 
458
- if (!snippetVersion) {
459
- snippetVersion = await resolveSnippetLoaderVersion({
460
- published: await getLoaderPub(),
461
- cwd,
462
- bundled: STAGEPASS_PACKAGES_VERSION,
463
- fse,
464
- });
465
- }
466
- const snippets = buildWebflowSnippets({
467
- version: snippetVersion,
468
- moduleList: resolved.modules,
469
- });
470
567
  printWebflowSnippets(snippets, log);
471
568
 
472
569
  log(chalk.bold('\nNext step (not run automatically):'));
473
570
  log(' npm install');
571
+ const typesTouched =
572
+ added.length > 0 ||
573
+ plan.writes.some(
574
+ (item) => item.file === 'tsconfig.json' || item.file === 'jsconfig.json' || item.file.endsWith('stagepass.d.ts')
575
+ );
576
+ if (typesTouched) log(' TypeScript: Restart TS Server');
474
577
 
475
578
  return 0;
476
579
  }