generatesaas 0.7.0 → 0.8.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.
@@ -1,6 +1,7 @@
1
1
  ---
2
- name: generatesaas-update
3
- description: Update GenerateSaaS project to latest boilerplate version. Handles version checks, file classification, generates an update plan for user review, and applies changes while preserving user customizations.
2
+ name: update
3
+ description: Update GenerateSaaS project to latest boilerplate version. Interactive process that classifies files, analyzes dependencies, and applies changes while preserving user customizations — with the user in control of every decision.
4
+ disable-model-invocation: true
4
5
  ---
5
6
 
6
7
  # GenerateSaaS Update
@@ -9,12 +10,55 @@ Update your project to the latest GenerateSaaS boilerplate version while preserv
9
10
 
10
11
  ## Core Principles
11
12
 
12
- 1. **User changes always come first** — Every update must preserve the user's functionality, business logic, and intentional modifications. If an upstream change conflicts with something the user built, the user's version wins.
13
- 2. **Never break user code** — If applying an upstream change would break the user's customizations or doesn't make sense in the context of their modifications, skip it and document why.
14
- 3. **Plan before acting** — Generate a full update plan. The user reviews and approves before anything is applied.
15
- 4. **Track everything** — Every change is tracked in a checklist. Mark items as completed, skipped, or failed so the user knows exactly what happened.
13
+ 1. **User decides everything** — Present clear information and options. Never make decisions that affect user code without explicit approval. Every meaningful change requires the user's input.
14
+ 2. **Never break user code** — If an upstream change conflicts with user modifications, present the situation and let the user choose. When in doubt, keep the user's version and explain what was skipped.
15
+ 3. **Full transparency** — For every change, explain: what changed upstream, why it changed, and how it affects the user's code. The user should always know exactly what is happening.
16
+ 4. **Track everything** — Every change is tracked in a checklist. Mark items as completed, skipped, or failed with clear reasons.
16
17
 
17
- ## Workflow
18
+ ## Workflow Overview
19
+
20
+ ```
21
+ Step 0: Pre-flight safety checks
22
+ Step 1: Prepare update data (script)
23
+ Step 2: Present changelog to user
24
+ Step 3: Classify files (script)
25
+ Step 4: Analyze dependencies
26
+ Step 5: Present update plan — user chooses interaction mode
27
+ Step 6: Apply safe auto-updates (script)
28
+ Step 7: Review modified files with user — one by one
29
+ Step 8: Post-update validation
30
+ Step 9: Complete update (script)
31
+ ```
32
+
33
+ ---
34
+
35
+ ### Step 0: Pre-flight
36
+
37
+ Before starting the update:
38
+
39
+ 1. **Check git status.** Run `git status`. If there are ANY uncommitted changes (staged, unstaged, or untracked files in tracked directories), **STOP immediately**. Do NOT proceed with the update. Tell the user:
40
+
41
+ > You have uncommitted changes. The update cannot proceed until your working tree is clean — this ensures you have a safe rollback point if anything needs to be reverted.
42
+ >
43
+ > **What would you like to do?**
44
+ > 1. **I'll handle it myself** — Stop the update so you can commit, stash, or discard changes on your own terms, then re-run the update
45
+ > 2. **Help me commit** — I'll help you create a commit with your current changes, then we continue
46
+
47
+ **NEVER** commit, stash, reset, or alter git state without the user's explicit choice. The user may have intentionally reverted work or have changes they don't want committed. Wait for their decision.
48
+
49
+ If the user chooses option 2, assist them with the commit (show them what will be committed, let them write the message or approve yours), then verify the working tree is clean before continuing.
50
+
51
+ If the user chooses option 1, stop completely. Do not continue the update.
52
+
53
+ 2. **Check for incomplete previous update.** Look for an existing plan file at `.generatesaas/updates/update-*-to-*.md`. If one exists, a previous update was started but not completed. Tell the user:
54
+
55
+ > It looks like a previous update was started but not completed. The plan file shows progress from a prior attempt.
56
+ >
57
+ > **What would you like to do?**
58
+ > 1. **Start fresh** — Discard the old plan and begin the update from scratch
59
+ > 2. **Stop** — Let me review what happened before continuing
60
+
61
+ If starting fresh, delete the old plan file. Note: files that were auto-applied in the previous attempt may now have V2 content but template-hashes.json still has V1 hashes — these will be correctly classified as "modified" (since they differ from the V1 template hash) and the AI will see they match the staging file, making them trivial merges.
18
62
 
19
63
  ### Step 1: Prepare Update Data
20
64
 
@@ -22,18 +66,25 @@ Update your project to the latest GenerateSaaS boilerplate version while preserv
22
66
  node __SKILL_ROOT__/generatesaas-update/scripts/prepare-update.js
23
67
  ```
24
68
 
25
- Reads the staged update from `.generatesaas/staging/` and computes local diffs. Creates:
69
+ Creates:
26
70
  - `references/changelog.md` — what changed and why
27
- - `references/diffs/*.diff` — unified diffs for each modified file
71
+ - `references/diffs/*.diff` — unified diffs for each changed file
28
72
  - `references/update-manifest.json` — lists of added, modified, and removed files
29
73
 
30
- ### Step 2: Review Changelog
74
+ ### Step 2: Present Changelog
75
+
76
+ Read `references/changelog.md` and present a clear, organized summary:
77
+
78
+ > ## What's New in v{targetVersion}
79
+ >
80
+ > **Breaking changes:** {list or "None"}
81
+ > **New features:** {list}
82
+ > **Bug fixes:** {list}
83
+ > **Migration steps required:** {list or "None"}
31
84
 
32
- Read `references/changelog.md` to understand:
33
- - Breaking changes that need attention
34
- - New features being added
35
- - Bug fixes included
36
- - Migration steps if any
85
+ Then ask: *"Ready to proceed with the file analysis?"*
86
+
87
+ Wait for the user to confirm before continuing.
37
88
 
38
89
  ### Step 3: Classify Files
39
90
 
@@ -41,23 +92,37 @@ Read `references/changelog.md` to understand:
41
92
  node __SKILL_ROOT__/generatesaas-update/scripts/classify-files.js
42
93
  ```
43
94
 
44
- Compares local file hashes (from `.generatesaas/hashes.json`) against current files to determine which the user has customized. Outputs `references/classification.json` with categories:
95
+ Read `references/classification.json`. It contains:
45
96
 
46
- - **unmodified** — file matches the original hash, safe to auto-update
47
- - **modified** — user has customized this file, needs careful merge
48
- - **deleted** — user deleted this file, skip update
97
+ - **unmodified** — file matches the original template, safe to replace
98
+ - **modified** — user has customized this file, needs careful review
99
+ - **deleted** — user deleted this file, skip update for it
49
100
  - **new** — file doesn't exist locally, safe to create
50
- - **removed** — file was removed upstream, review before deleting
101
+ - **removed** — file was removed upstream, user decides whether to delete
102
+ - **crossDependencies** — import relationships between categories (if detected)
51
103
 
52
- ### Step 4: Generate Update Plan
104
+ ### Step 4: Analyze Dependencies
53
105
 
54
- **This is a critical step.** After classification, generate the update plan file at:
106
+ This step prevents breaking the user's code through indirect effects.
55
107
 
56
- ```
57
- .generatesaas/updates/update-{currentVersion}-to-{targetVersion}.md
58
- ```
108
+ 1. **Read `crossDependencies`** from classification.json (if present). This shows:
109
+ - `modifiedImportsUnmodified` — modified files that import from auto-apply files
110
+ - `unmodifiedImportsModified` — auto-apply files that import from modified files
111
+ - `newImportsModified` — new files that import from modified files
112
+
113
+ 2. **For each cross-dependency**, read the relevant diff at `references/diffs/<path>.diff`:
114
+ - If an auto-apply file's diff changes **exports, function signatures, types, or interfaces** that a modified file uses → promote it from `unmodified` to `modified` (it needs user review alongside its dependent)
115
+ - If an auto-apply file imports from a modified file → flag it as needing review after the modified file is handled
116
+
117
+ 3. **Update `references/classification.json`**: before making any changes, copy the file to `references/classification-original.json` as a backup. Then move any promoted files from the `unmodified` array to the `modified` array. This ensures `apply-auto.js` only touches truly safe files. If you need to redo the analysis, restore from the backup.
59
118
 
60
- The plan must follow this format:
119
+ 4. If there are no cross-dependencies or all cross-dependencies are safe (no API changes), no reclassification is needed.
120
+
121
+ ### Step 5: Present Update Plan and Choose Mode
122
+
123
+ Generate the plan file at `.generatesaas/updates/update-{currentVersion}-to-{targetVersion}.md`.
124
+
125
+ Present the plan organized by category:
61
126
 
62
127
  ```markdown
63
128
  # Update: {currentVersion} → {targetVersion}
@@ -65,242 +130,294 @@ The plan must follow this format:
65
130
  Date: {YYYY-MM-DD}
66
131
 
67
132
  ## Summary
133
+ {Brief description based on changelog}
68
134
 
69
- {Brief description of what this update includes based on the changelog}
135
+ ## Safe Auto-Updates ({count} files)
136
+ These files haven't been customized and will be updated automatically:
137
+ - [ ] `path/to/file.ts` — {brief description of change}
70
138
 
71
- ## Auto-Updates (Unmodified Files)
139
+ ## New Files ({count} files)
140
+ New in this version:
141
+ - [ ] `path/to/new-file.ts` — {what this file does}
72
142
 
73
- These files haven't been modified and will be updated automatically:
143
+ ## Files Needing Review ({count} files)
144
+ These files have your customizations. Each one will be presented for your decision:
145
+ - [ ] `path/to/modified.ts` — Risk: {Low/Medium/High} — {what changed}
74
146
 
75
- - [x] `path/to/file.ts` {brief description of change}
76
- - [x] `path/to/other.ts`{brief description of change}
147
+ ## Removed Upstream ({count} files)
148
+ Removed in the new version you decide whether to delete:
149
+ - [ ] `path/to/old-file.ts` — {why it was removed}
77
150
 
78
- ## New Files
151
+ ## Skipped
152
+ {Empty — items move here during execution with reasons}
153
+ ```
79
154
 
80
- These files are new in this version and will be created:
155
+ Then ask the user to choose their interaction level:
81
156
 
82
- - [x] `path/to/new-file.ts` {what this file does}
157
+ > **How would you like to handle this update?**
158
+ >
159
+ > 1. **Recommended** — Auto-apply safe files, then I'll walk you through each modified file with my recommendation. You approve or adjust each one.
160
+ > 2. **Careful** — I'll present every single change for your approval, including auto-updates. Nothing happens without your explicit OK.
161
+ > 3. **Quick** — Auto-apply safe files, auto-apply my recommended merges for low-risk files, and only ask you about medium/high-risk changes.
83
162
 
84
- ## Manual Merges (Modified Files)
163
+ **Wait for the user's choice.** Default to **Recommended** if they just say "proceed" or similar.
85
164
 
86
- These files have been customized. Changes will be merged preserving your modifications:
165
+ ### Step 6: Apply Safe Auto-Updates
87
166
 
88
- - [ ] `path/to/modified.ts` {what upstream changed vs what you changed}
89
- - [ ] `path/to/config.ts` — {description}
167
+ Based on the user's chosen mode:
90
168
 
91
- ## Removed Upstream
169
+ **Recommended / Quick mode:**
170
+ ```bash
171
+ node __SKILL_ROOT__/generatesaas-update/scripts/apply-auto.js
172
+ ```
173
+ Report what was applied. Mark all auto-update and new file items as `[x]` in the plan.
92
174
 
93
- These files were removed in the new version. Review before deleting:
175
+ **Careful mode:**
176
+ Present the list of safe auto-updates and new files to the user:
177
+ > These {N} files haven't been customized and can be safely replaced with the new version. {N} new files will be created. Want me to apply all of these, or would you like to review any specific ones first?
94
178
 
95
- - [ ] `path/to/old-file.ts` {why it was removed}
179
+ If the user wants to review specific files, show them the diff for each requested file. Apply only after approval.
96
180
 
97
- ## Skipped
181
+ ### Step 7: Review Modified Files
98
182
 
99
- Changes that were not applied (with reasons):
183
+ This is the most important step. Work through each file in the `modified` category.
184
+
185
+ #### For Each Modified File
186
+
187
+ For each file, you have three versions available for proper three-way merge context:
188
+
189
+ 1. **Old template:** `.generatesaas/template/<path>` — the original boilerplate version
190
+ 2. **New template:** `.generatesaas/staging/<path>` — the updated boilerplate version
191
+ 3. **User's version:** the current file on disk — their customized version
192
+
193
+ The diff at `references/diffs/<path>.diff` shows **pure upstream changes** (old template → new template), making it easy to see exactly what we changed and why.
194
+
195
+ If `.generatesaas/template/<path>` does not exist (backward compat), fall back to comparing the user's file against staging directly. If no diff file exists, read both files to understand the differences.
196
+
197
+ **Present the situation clearly:**
100
198
 
101
- {empty until items are skipped during execution}
102
199
  ```
200
+ ### `{file path}`
103
201
 
104
- **Present this plan to the user.** Explain the key changes and ask if they want to exclude anything. Wait for confirmation before proceeding.
202
+ **What changed upstream:** {describe changes from old template new template, referencing the diff and changelog}
203
+ **What you changed:** {describe changes from old template → user's file — compare the two to identify customizations}
204
+ **Overlap:** {None / Partial / Significant}
205
+ **Risk:** {Low / Medium / High}
105
206
 
106
- If the user wants to exclude items, move them to the **Skipped** section with the reason "Excluded by user".
207
+ {Explain risk: Low = changes don't overlap. Medium = some overlap but cleanly resolvable. High = significant structural conflict or the file was heavily rewritten.}
107
208
 
108
- ### Step 5: Apply Auto-Updates
209
+ **My recommendation:** {one of the actions below}
109
210
 
110
- ```bash
111
- node __SKILL_ROOT__/generatesaas-update/scripts/apply-auto.js
211
+ {If recommending a merge, show the proposed result with comments marking the source:}
112
212
  ```
113
213
 
114
- Automatically updates `unmodified` files and creates `new` files. These are safe because:
115
- - Unmodified files have no user changes to preserve
116
- - New files don't conflict with anything
214
+ **Then present the user's options:**
117
215
 
118
- After this completes, mark all auto-update and new file items as `[x]` in the plan.
216
+ > **What would you like to do?**
217
+ > 1. **Accept merge** — {brief description of the merged result}
218
+ > 2. **Keep my version** — Skip this upstream change entirely
219
+ > 3. **Use upstream version** — Replace with the new template version (your changes will be lost)
220
+ > 4. **Show me the diff** — Display the raw upstream diff so I can review it
221
+ > 5. **Let me customize** — Tell me exactly what you want
119
222
 
120
- ### Step 6: Manual Merge (Modified Files)
223
+ **In Quick mode:** For **Low risk** files, apply the recommended merge automatically and report what was done. For **Medium/High risk**, always ask.
121
224
 
122
- For each file in the `modified` category, work through the plan checklist one by one:
225
+ **In Recommended mode:** Present each file and wait for the user's decision.
123
226
 
124
- 1. Read the corresponding diff at `references/diffs/<path>.diff` (if no diff exists, the file was new upstream but already exists locally — read the staging copy at `.generatesaas/staging/<path>` instead)
125
- 2. Read the current local file
126
- 3. Understand what the user changed and why
127
- 4. Apply upstream changes that are compatible with the user's modifications
128
- 5. **Skip changes that would break user functionality** — move to Skipped section with explanation
129
- 6. Mark the item as `[x]` in the plan when done
227
+ **In Careful mode:** Present each file with the full proposed merged code shown, and wait for the user's decision.
130
228
 
131
- For `removed` files:
132
- 1. Check if the user depends on the file
133
- 2. If the user modified it or other files import it, move to Skipped with explanation
134
- 3. If truly unused, delete it and mark as `[x]`
229
+ #### For Removed Files
135
230
 
136
- **After each file, update the plan file** so progress is tracked in real-time.
231
+ Before presenting each removed file, **search the entire project** for imports of it. Use grep to find `import ... from` or `require(...)` statements referencing the file's path (check relative paths, aliases, and package paths). This is critical — the classification script only scans files in the update, not user-created files that may also depend on the removed file.
137
232
 
138
- ### Step 7: Complete Update
233
+ ```
234
+ ### `{file path}` — Removed Upstream
139
235
 
140
- After all items are processed:
236
+ **Why it was removed:** {reason from changelog}
237
+ **Your modifications:** {describe if the user modified it, or "None — file is unmodified"}
238
+ **Files that import this:** {list ALL files found by searching, or "None found"}
141
239
 
142
- 1. Review the plan verify every item is either `[x]` (completed) or listed in Skipped with a reason
143
- 2. If any items are still unchecked, address them or move to Skipped with explanation
144
- 3. Run the completion script:
240
+ > **What would you like to do?**
241
+ > 1. **Delete it** It's no longer needed upstream
242
+ > 2. **Keep it** I still use this file
243
+ ```
244
+
245
+ If ANY files import the removed file, always warn before deletion and explain what would break.
246
+
247
+ #### For Deleted-by-User Files
248
+
249
+ Files the user intentionally deleted — skip silently. Just note in the plan: "Skipped — user previously deleted this file."
250
+
251
+ #### After Each File
252
+
253
+ 1. Apply the user's chosen action immediately
254
+ 2. Mark the item as `[x]` (completed) or move to **Skipped** with the reason
255
+ 3. **Update the plan file** after every file so progress is saved
256
+
257
+ #### Cascade Awareness
258
+
259
+ After processing ALL modified files, review the results:
260
+
261
+ - If any modified files were **skipped** (user chose to keep their version), check if any already-auto-applied files depend on the skipped file's original structure
262
+ - If an auto-applied file imports from a skipped file and the auto-applied file's update expected the new version of that import: warn the user
263
+
264
+ > I auto-applied `{auto-file}` in Step 6, but it may depend on changes in `{skipped-file}` which you chose to keep as-is. The new version of `{auto-file}` might not be fully compatible.
265
+ >
266
+ > **Options:**
267
+ > 1. **Revert `{auto-file}`** to the previous version
268
+ > 2. **Keep it** — I'll check if it still works
269
+ > 3. **Let me look at both files** to decide
270
+
271
+ Similarly, if an auto-applied file changed its exports and a modified file that imports from it was merged — verify the merge accounts for the new API.
272
+
273
+ ### Step 8: Post-Update Validation
274
+
275
+ After all files are processed:
276
+
277
+ 1. **Check for obvious issues:**
278
+ - Scan merged files for syntax errors or broken imports
279
+ - If the project has TypeScript, suggest running type check
280
+ - Note: auto-applied files may have changed their exports/API in ways that affect **user-created files** (files not part of the template). The classification script only scans template files for cross-dependencies. A type check is the best way to catch breakage in user-created files.
281
+
282
+ > All changes have been applied. Would you like me to run a type check / build to verify nothing is broken? This is especially important since some auto-applied files may have changed their API, which could affect your custom files.
283
+
284
+ 2. If issues are found, present them:
285
+
286
+ > Found {N} issues after the update:
287
+ > - `{file}:{line}` — {description}
288
+ >
289
+ > These appear to be caused by the update. Want me to fix them?
290
+
291
+ 3. Fix any issues the user approves, then re-verify.
292
+
293
+ ### Step 9: Complete Update
294
+
295
+ 1. **Record held-back files.** Write `.generatesaas/held-back.json` with the list of files where the **template change was NOT applied** to the project. This tells the completion script to preserve old template hashes so the next update generates correct diffs that include the missed changes.
296
+
297
+ **Include** in held-back.json:
298
+ - Modified files where the user chose "Keep my version"
299
+ - Modified files that were skipped for any reason (couldn't merge, user excluded, etc.)
300
+ - Auto-apply files that were reverted in the cascade awareness step
301
+
302
+ **Do NOT include:**
303
+ - Files where the user accepted a merge or chose "Use upstream version" (template changes were applied)
304
+ - Removed files (not in staging — template-hashes handles these automatically)
305
+ - New files, whether created or rejected (handled correctly by staging presence)
306
+ - Any file where the template's intended change was successfully applied
307
+
308
+ ```json
309
+ ["path/to/skipped.ts", "path/to/another.ts"]
310
+ ```
311
+
312
+ If no files were held back, skip creating this file.
313
+
314
+ 2. **Run the completion script:**
145
315
 
146
316
  ```bash
147
317
  node __SKILL_ROOT__/generatesaas-update/scripts/complete-update.js
148
318
  ```
149
319
 
150
- This regenerates `.generatesaas/hashes.json` with fresh file hashes and updates the version in `.generatesaas/manifest.json`. Cleans up the `references/` directory.
320
+ This updates `.generatesaas/manifest.json` to the new version, regenerates file hashes, and cleans up staging.
151
321
 
152
- 4. Add a final status to the plan file:
322
+ 3. **Present the final summary:**
153
323
 
154
324
  ```markdown
155
325
  ## Result
156
326
 
157
- - **Status**: Completed
158
- - **Files updated**: {count}
159
- - **Files created**: {count}
160
- - **Files merged**: {count}
161
- - **Items skipped**: {count}
162
- - **Post-update steps**: {e.g., "Run pnpm install", "Run migrations", etc.}
327
+ - **Status:** Completed
328
+ - **Files auto-updated:** {count}
329
+ - **Files merged with your input:** {count}
330
+ - **New files created:** {count}
331
+ - **Changes skipped:** {count}
332
+ - **Issues fixed:** {count or "None"}
333
+
334
+ ### Post-update steps
335
+ - Run `pnpm install` if dependencies changed
336
+ - Run database migrations if schema was updated
337
+ - {any other steps from the changelog}
338
+
339
+ ### Skipped changes
340
+ {For each skipped item: what was skipped and why — so the user can revisit later}
163
341
  ```
164
342
 
343
+ ---
344
+
165
345
  ## Merge Strategies
166
346
 
347
+ Use these strategies when merging modified files. The goal is always: apply upstream improvements without losing user customizations.
348
+
167
349
  ### Config Files (`*.config.ts`, `config/index.ts`, `config/pricing.ts`)
168
350
 
169
- Config files are the most commonly customized. The upstream diff usually adds new options or changes defaults.
351
+ Config files are the most commonly customized.
170
352
 
171
353
  - Preserve all user-set values
172
354
  - Add new config keys with their default values
173
- - If a key was renamed upstream, migrate the user's value to the new key
355
+ - If a key was renamed upstream, migrate the user's value to the new key name
174
356
  - Keep user's formatting preferences if they differ
357
+ - Present the merged config to the user for review
175
358
 
176
359
  ### Components (`.vue`, `.tsx`)
177
360
 
178
- - Preserve user-added props, slots, and event handlers
179
- - Apply upstream structural changes (new elements, changed layouts)
361
+ - Preserve user-added props, slots, event handlers, and custom logic
362
+ - Apply upstream structural changes (new elements, accessibility improvements, bug fixes)
180
363
  - Keep user's custom CSS classes and styles
181
- - If the component was significantly restructured upstream, present both versions and ask
364
+ - If the component was significantly restructured upstream AND the user heavily modified it: present both versions side by side and let the user decide
182
365
 
183
366
  ### API Routes (`routes/*.ts`)
184
367
 
185
368
  - Preserve user-added endpoints and middleware
186
- - Apply upstream changes to existing endpoints (bug fixes, new validations)
369
+ - Apply upstream bug fixes and security patches to existing endpoints
187
370
  - Keep user-added business logic intact
188
371
  - Watch for new imports or dependency changes
189
372
 
190
373
  ### Database (schema, migrations)
191
374
 
192
- - NEVER auto-merge schema files — always present changes for review
375
+ - NEVER auto-merge schema files — always present for user review
193
376
  - New migration files can be added directly
194
- - Schema changes may require new migrations the user needs to create
377
+ - Warn about schema changes that may require new migrations
195
378
 
196
379
  ### Package Dependencies (`package.json`)
197
380
 
198
381
  - Add new dependencies from upstream
199
- - Update version ranges for existing dependencies only if the upstream change is intentional (security fix, breaking change requirement)
382
+ - Update version ranges only for intentional upstream changes (security, breaking change requirements)
200
383
  - Preserve user-added dependencies
201
- - Never modify `pnpm-lock.yaml` — user runs `pnpm install` after
384
+ - Never touch `pnpm-lock.yaml` — user runs `pnpm install` after
202
385
 
203
386
  ### Translation Files (`en.json`)
204
387
 
205
388
  - Add new translation keys from upstream
206
389
  - Preserve user-modified translation values
207
- - Remove keys that were deleted upstream (they're unused)
390
+ - Remove keys deleted upstream (they correspond to removed features)
208
391
  - Maintain alphabetical ordering within sections
209
392
 
210
393
  ### Environment Files (`.env.example`)
211
394
 
212
- - Add new environment variables with their example values
395
+ - Add new environment variables with their example values and comments
213
396
  - Preserve user-added variables
214
- - Update comments for changed variables
215
397
  - Never touch actual `.env` files
216
398
 
217
- ## When to Skip a Change
399
+ ## When to Skip
218
400
 
219
- Move the item to the **Skipped** section of the plan with a clear reason when:
401
+ Move items to the **Skipped** section with a clear reason when:
220
402
 
221
- - The upstream change modifies code the user has significantly rewritten — applying it would undo their work
403
+ - The upstream change modifies code the user has significantly rewritten
222
404
  - The upstream fix addresses a bug the user already fixed differently
223
- - A new feature conflicts with the user's custom implementation of the same thing
224
- - Applying the change would create invalid code, type errors, or runtime failures
225
- - The user explicitly asked to exclude it
405
+ - A new feature conflicts with the user's custom implementation
406
+ - Applying the change would create type errors or runtime failures
407
+ - The user explicitly chose to keep their version
226
408
 
227
409
  When skipping, always explain:
228
- - What the upstream change was trying to do
229
- - Why it was skipped
230
- - Whether the user should manually review it later
231
-
232
- ## When to Ask the User
233
-
234
- - Schema changes that might need migrations
235
- - Removed files or features the user might depend on
236
- - Config changes where the user's value conflicts with a new required format
237
- - Component restructures where preserving user changes is ambiguous
238
- - Any change where applying both upstream and user modifications would create invalid code
239
- - When you're unsure whether a user's modification was intentional
240
-
241
- ## Examples
242
-
243
- ### Config merge
244
-
245
- Upstream diff adds a new `analytics` field:
246
- ```diff
247
- export default {
248
- siteName: "My SaaS",
249
- + analytics: {
250
- + enabled: true,
251
- + provider: "plausible",
252
- + },
253
- billing: {
254
- scope: "organization",
255
- },
256
- };
257
- ```
410
+ 1. What the upstream change was trying to do
411
+ 2. Why it was skipped
412
+ 3. Whether the user should revisit it later
258
413
 
259
- User has customized `siteName` and `billing.scope`. Result:
260
- ```typescript
261
- export default {
262
- siteName: "Acme Corp", // user's value preserved
263
- analytics: { // new field added with defaults
264
- enabled: true,
265
- provider: "plausible",
266
- },
267
- billing: {
268
- scope: "user", // user's value preserved
269
- },
270
- };
271
- ```
272
-
273
- ### Translation merge
274
-
275
- Upstream diff:
276
- ```diff
277
- {
278
- "dashboard": {
279
- "title": "Dashboard",
280
- - "old_metric": "Old Metric",
281
- + "new_metric": "New Metric",
282
- + "analytics": "Analytics"
283
- }
284
- }
285
- ```
286
-
287
- User changed `dashboard.title` to `"Control Panel"`. Result:
288
- ```json
289
- {
290
- "dashboard": {
291
- "title": "Control Panel",
292
- "new_metric": "New Metric",
293
- "analytics": "Analytics"
294
- }
295
- }
296
- ```
297
- `old_metric` removed (upstream deleted it), `title` preserved (user customized it), new keys added.
414
+ ## When to Always Ask
298
415
 
299
- ### Skipped change example
416
+ Even in Quick mode, always ask the user about:
300
417
 
301
- Plan entry:
302
- ```markdown
303
- ## Skipped
304
-
305
- - `app/components/PricingTable.vue` Upstream restructured the pricing grid layout from CSS Grid to Flexbox. User has heavily customized this component with custom tier cards and comparison features. Applying the layout change would break the custom tier rendering. **User should review the diff manually if they want the new layout.**
306
- ```
418
+ - Database schema changes
419
+ - Files where user modifications are extensive (>30% of the file differs from template)
420
+ - Changes where upstream and user modifications touch the same code sections
421
+ - Removed files that other code depends on
422
+ - Config changes where user's value format conflicts with new requirements
423
+ - Any change where you're unsure about the right action
@@ -10,6 +10,7 @@ const INTERNAL_DIR = ".generatesaas";
10
10
  const MANIFEST_FILE = path.join(INTERNAL_DIR, "manifest.json");
11
11
  const HASHES_FILE = path.join(INTERNAL_DIR, "hashes.json");
12
12
  const TEMPLATE_HASHES_FILE = path.join(INTERNAL_DIR, "template-hashes.json");
13
+ const TEMPLATE_DIR = path.join(INTERNAL_DIR, "template");
13
14
  const STAGING_DIR = path.join(INTERNAL_DIR, "staging");
14
15
  const STAGING_META_FILE = path.join(INTERNAL_DIR, "staging.json");
15
16
 
@@ -43,7 +44,7 @@ function hashFile(filePath) {
43
44
  // exclusions.ts, so most of these only matter when walking the live project root.
44
45
  const WALK_EXCLUSIONS = new Set([
45
46
  ".git", "node_modules", ".pnpm-store", ".env", ".env.test",
46
- ".turbo", ".nuxt", ".output", ".data", "dist",
47
+ ".turbo", ".nuxt", ".output", ".data", "dist", "data",
47
48
  ".next", ".svelte-kit", ".netlify", ".wrangler",
48
49
  ".devcontainer", "playwright-report", "test-results",
49
50
  INTERNAL_DIR,
@@ -89,6 +90,7 @@ module.exports = {
89
90
  MANIFEST_FILE,
90
91
  HASHES_FILE,
91
92
  TEMPLATE_HASHES_FILE,
93
+ TEMPLATE_DIR,
92
94
  STAGING_DIR,
93
95
  STAGING_META_FILE,
94
96
  };