generatesaas 0.7.1 → 0.8.1
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/dist/index.js +404 -109
- package/dist/skill/content/SKILL.md +289 -173
- package/dist/skill/content/scripts/_helpers.js +3 -1
- package/dist/skill/content/scripts/classify-files.js +218 -17
- package/dist/skill/content/scripts/complete-update.js +69 -11
- package/dist/skill/content/scripts/prepare-update.js +17 -4
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: update
|
|
3
|
-
description: Update GenerateSaaS project to latest boilerplate version.
|
|
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
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -10,12 +10,55 @@ Update your project to the latest GenerateSaaS boilerplate version while preserv
|
|
|
10
10
|
|
|
11
11
|
## Core Principles
|
|
12
12
|
|
|
13
|
-
1. **User
|
|
14
|
-
2. **Never break user code** — If
|
|
15
|
-
3. **
|
|
16
|
-
4. **Track everything** — Every change is tracked in a checklist. Mark items as completed, skipped, or failed
|
|
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.
|
|
17
17
|
|
|
18
|
-
## 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.
|
|
19
62
|
|
|
20
63
|
### Step 1: Prepare Update Data
|
|
21
64
|
|
|
@@ -23,18 +66,25 @@ Update your project to the latest GenerateSaaS boilerplate version while preserv
|
|
|
23
66
|
node __SKILL_ROOT__/generatesaas-update/scripts/prepare-update.js
|
|
24
67
|
```
|
|
25
68
|
|
|
26
|
-
|
|
69
|
+
Creates:
|
|
27
70
|
- `references/changelog.md` — what changed and why
|
|
28
|
-
- `references/diffs/*.diff` — unified diffs for each
|
|
71
|
+
- `references/diffs/*.diff` — unified diffs for each changed file
|
|
29
72
|
- `references/update-manifest.json` — lists of added, modified, and removed files
|
|
30
73
|
|
|
31
|
-
### Step 2:
|
|
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"}
|
|
32
84
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- Bug fixes included
|
|
37
|
-
- Migration steps if any
|
|
85
|
+
Then ask: *"Ready to proceed with the file analysis?"*
|
|
86
|
+
|
|
87
|
+
Wait for the user to confirm before continuing.
|
|
38
88
|
|
|
39
89
|
### Step 3: Classify Files
|
|
40
90
|
|
|
@@ -42,23 +92,37 @@ Read `references/changelog.md` to understand:
|
|
|
42
92
|
node __SKILL_ROOT__/generatesaas-update/scripts/classify-files.js
|
|
43
93
|
```
|
|
44
94
|
|
|
45
|
-
|
|
95
|
+
Read `references/classification.json`. It contains:
|
|
46
96
|
|
|
47
|
-
- **unmodified** — file matches the original
|
|
48
|
-
- **modified** — user has customized this file, needs careful
|
|
49
|
-
- **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
|
|
50
100
|
- **new** — file doesn't exist locally, safe to create
|
|
51
|
-
- **removed** — file was removed upstream,
|
|
101
|
+
- **removed** — file was removed upstream, user decides whether to delete
|
|
102
|
+
- **crossDependencies** — import relationships between categories (if detected)
|
|
52
103
|
|
|
53
|
-
### Step 4:
|
|
104
|
+
### Step 4: Analyze Dependencies
|
|
54
105
|
|
|
55
|
-
|
|
106
|
+
This step prevents breaking the user's code through indirect effects.
|
|
56
107
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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.
|
|
60
118
|
|
|
61
|
-
|
|
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:
|
|
62
126
|
|
|
63
127
|
```markdown
|
|
64
128
|
# Update: {currentVersion} → {targetVersion}
|
|
@@ -66,242 +130,294 @@ The plan must follow this format:
|
|
|
66
130
|
Date: {YYYY-MM-DD}
|
|
67
131
|
|
|
68
132
|
## Summary
|
|
133
|
+
{Brief description based on changelog}
|
|
69
134
|
|
|
70
|
-
|
|
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}
|
|
71
138
|
|
|
72
|
-
##
|
|
139
|
+
## New Files ({count} files)
|
|
140
|
+
New in this version:
|
|
141
|
+
- [ ] `path/to/new-file.ts` — {what this file does}
|
|
73
142
|
|
|
74
|
-
|
|
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}
|
|
75
146
|
|
|
76
|
-
|
|
77
|
-
|
|
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}
|
|
78
150
|
|
|
79
|
-
##
|
|
151
|
+
## Skipped
|
|
152
|
+
{Empty — items move here during execution with reasons}
|
|
153
|
+
```
|
|
80
154
|
|
|
81
|
-
|
|
155
|
+
Then ask the user to choose their interaction level:
|
|
82
156
|
|
|
83
|
-
|
|
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.
|
|
84
162
|
|
|
85
|
-
|
|
163
|
+
**Wait for the user's choice.** Default to **Recommended** if they just say "proceed" or similar.
|
|
86
164
|
|
|
87
|
-
|
|
165
|
+
### Step 6: Apply Safe Auto-Updates
|
|
88
166
|
|
|
89
|
-
|
|
90
|
-
- [ ] `path/to/config.ts` — {description}
|
|
167
|
+
Based on the user's chosen mode:
|
|
91
168
|
|
|
92
|
-
|
|
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.
|
|
93
174
|
|
|
94
|
-
|
|
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?
|
|
95
178
|
|
|
96
|
-
|
|
179
|
+
If the user wants to review specific files, show them the diff for each requested file. Apply only after approval.
|
|
97
180
|
|
|
98
|
-
|
|
181
|
+
### Step 7: Review Modified Files
|
|
99
182
|
|
|
100
|
-
|
|
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:**
|
|
101
198
|
|
|
102
|
-
{empty until items are skipped during execution}
|
|
103
199
|
```
|
|
200
|
+
### `{file path}`
|
|
104
201
|
|
|
105
|
-
**
|
|
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}
|
|
106
206
|
|
|
107
|
-
|
|
207
|
+
{Explain risk: Low = changes don't overlap. Medium = some overlap but cleanly resolvable. High = significant structural conflict or the file was heavily rewritten.}
|
|
108
208
|
|
|
109
|
-
|
|
209
|
+
**My recommendation:** {one of the actions below}
|
|
110
210
|
|
|
111
|
-
|
|
112
|
-
node __SKILL_ROOT__/generatesaas-update/scripts/apply-auto.js
|
|
211
|
+
{If recommending a merge, show the proposed result with comments marking the source:}
|
|
113
212
|
```
|
|
114
213
|
|
|
115
|
-
|
|
116
|
-
- Unmodified files have no user changes to preserve
|
|
117
|
-
- New files don't conflict with anything
|
|
214
|
+
**Then present the user's options:**
|
|
118
215
|
|
|
119
|
-
|
|
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
|
|
120
222
|
|
|
121
|
-
|
|
223
|
+
**In Quick mode:** For **Low risk** files, apply the recommended merge automatically and report what was done. For **Medium/High risk**, always ask.
|
|
122
224
|
|
|
123
|
-
|
|
225
|
+
**In Recommended mode:** Present each file and wait for the user's decision.
|
|
124
226
|
|
|
125
|
-
|
|
126
|
-
2. Read the current local file
|
|
127
|
-
3. Understand what the user changed and why
|
|
128
|
-
4. Apply upstream changes that are compatible with the user's modifications
|
|
129
|
-
5. **Skip changes that would break user functionality** — move to Skipped section with explanation
|
|
130
|
-
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.
|
|
131
228
|
|
|
132
|
-
For
|
|
133
|
-
1. Check if the user depends on the file
|
|
134
|
-
2. If the user modified it or other files import it, move to Skipped with explanation
|
|
135
|
-
3. If truly unused, delete it and mark as `[x]`
|
|
229
|
+
#### For Removed Files
|
|
136
230
|
|
|
137
|
-
|
|
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.
|
|
138
232
|
|
|
139
|
-
|
|
233
|
+
```
|
|
234
|
+
### `{file path}` — Removed Upstream
|
|
140
235
|
|
|
141
|
-
|
|
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"}
|
|
142
239
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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:**
|
|
146
315
|
|
|
147
316
|
```bash
|
|
148
317
|
node __SKILL_ROOT__/generatesaas-update/scripts/complete-update.js
|
|
149
318
|
```
|
|
150
319
|
|
|
151
|
-
This
|
|
320
|
+
This updates `.generatesaas/manifest.json` to the new version, regenerates file hashes, and cleans up staging.
|
|
152
321
|
|
|
153
|
-
|
|
322
|
+
3. **Present the final summary:**
|
|
154
323
|
|
|
155
324
|
```markdown
|
|
156
325
|
## Result
|
|
157
326
|
|
|
158
|
-
- **Status
|
|
159
|
-
- **Files updated
|
|
160
|
-
- **Files
|
|
161
|
-
- **
|
|
162
|
-
- **
|
|
163
|
-
- **
|
|
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}
|
|
164
341
|
```
|
|
165
342
|
|
|
343
|
+
---
|
|
344
|
+
|
|
166
345
|
## Merge Strategies
|
|
167
346
|
|
|
347
|
+
Use these strategies when merging modified files. The goal is always: apply upstream improvements without losing user customizations.
|
|
348
|
+
|
|
168
349
|
### Config Files (`*.config.ts`, `config/index.ts`, `config/pricing.ts`)
|
|
169
350
|
|
|
170
|
-
Config files are the most commonly customized.
|
|
351
|
+
Config files are the most commonly customized.
|
|
171
352
|
|
|
172
353
|
- Preserve all user-set values
|
|
173
354
|
- Add new config keys with their default values
|
|
174
|
-
- 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
|
|
175
356
|
- Keep user's formatting preferences if they differ
|
|
357
|
+
- Present the merged config to the user for review
|
|
176
358
|
|
|
177
359
|
### Components (`.vue`, `.tsx`)
|
|
178
360
|
|
|
179
|
-
- Preserve user-added props, slots, and
|
|
180
|
-
- Apply upstream structural changes (new elements,
|
|
361
|
+
- Preserve user-added props, slots, event handlers, and custom logic
|
|
362
|
+
- Apply upstream structural changes (new elements, accessibility improvements, bug fixes)
|
|
181
363
|
- Keep user's custom CSS classes and styles
|
|
182
|
-
- If the component was significantly restructured upstream
|
|
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
|
|
183
365
|
|
|
184
366
|
### API Routes (`routes/*.ts`)
|
|
185
367
|
|
|
186
368
|
- Preserve user-added endpoints and middleware
|
|
187
|
-
- Apply upstream
|
|
369
|
+
- Apply upstream bug fixes and security patches to existing endpoints
|
|
188
370
|
- Keep user-added business logic intact
|
|
189
371
|
- Watch for new imports or dependency changes
|
|
190
372
|
|
|
191
373
|
### Database (schema, migrations)
|
|
192
374
|
|
|
193
|
-
- NEVER auto-merge schema files — always present
|
|
375
|
+
- NEVER auto-merge schema files — always present for user review
|
|
194
376
|
- New migration files can be added directly
|
|
195
|
-
-
|
|
377
|
+
- Warn about schema changes that may require new migrations
|
|
196
378
|
|
|
197
379
|
### Package Dependencies (`package.json`)
|
|
198
380
|
|
|
199
381
|
- Add new dependencies from upstream
|
|
200
|
-
- Update version ranges
|
|
382
|
+
- Update version ranges only for intentional upstream changes (security, breaking change requirements)
|
|
201
383
|
- Preserve user-added dependencies
|
|
202
|
-
- Never
|
|
384
|
+
- Never touch `pnpm-lock.yaml` — user runs `pnpm install` after
|
|
203
385
|
|
|
204
386
|
### Translation Files (`en.json`)
|
|
205
387
|
|
|
206
388
|
- Add new translation keys from upstream
|
|
207
389
|
- Preserve user-modified translation values
|
|
208
|
-
- Remove keys
|
|
390
|
+
- Remove keys deleted upstream (they correspond to removed features)
|
|
209
391
|
- Maintain alphabetical ordering within sections
|
|
210
392
|
|
|
211
393
|
### Environment Files (`.env.example`)
|
|
212
394
|
|
|
213
|
-
- Add new environment variables with their example values
|
|
395
|
+
- Add new environment variables with their example values and comments
|
|
214
396
|
- Preserve user-added variables
|
|
215
|
-
- Update comments for changed variables
|
|
216
397
|
- Never touch actual `.env` files
|
|
217
398
|
|
|
218
|
-
## When to Skip
|
|
399
|
+
## When to Skip
|
|
219
400
|
|
|
220
|
-
Move
|
|
401
|
+
Move items to the **Skipped** section with a clear reason when:
|
|
221
402
|
|
|
222
|
-
- The upstream change modifies code the user has significantly rewritten
|
|
403
|
+
- The upstream change modifies code the user has significantly rewritten
|
|
223
404
|
- The upstream fix addresses a bug the user already fixed differently
|
|
224
|
-
- A new feature conflicts with the user's custom implementation
|
|
225
|
-
- Applying the change would create
|
|
226
|
-
- The user explicitly
|
|
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
|
|
227
408
|
|
|
228
409
|
When skipping, always explain:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
## When to Ask the User
|
|
234
|
-
|
|
235
|
-
- Schema changes that might need migrations
|
|
236
|
-
- Removed files or features the user might depend on
|
|
237
|
-
- Config changes where the user's value conflicts with a new required format
|
|
238
|
-
- Component restructures where preserving user changes is ambiguous
|
|
239
|
-
- Any change where applying both upstream and user modifications would create invalid code
|
|
240
|
-
- When you're unsure whether a user's modification was intentional
|
|
241
|
-
|
|
242
|
-
## Examples
|
|
243
|
-
|
|
244
|
-
### Config merge
|
|
245
|
-
|
|
246
|
-
Upstream diff adds a new `analytics` field:
|
|
247
|
-
```diff
|
|
248
|
-
export default {
|
|
249
|
-
siteName: "My SaaS",
|
|
250
|
-
+ analytics: {
|
|
251
|
-
+ enabled: true,
|
|
252
|
-
+ provider: "plausible",
|
|
253
|
-
+ },
|
|
254
|
-
billing: {
|
|
255
|
-
scope: "organization",
|
|
256
|
-
},
|
|
257
|
-
};
|
|
258
|
-
```
|
|
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
|
|
259
413
|
|
|
260
|
-
|
|
261
|
-
```typescript
|
|
262
|
-
export default {
|
|
263
|
-
siteName: "Acme Corp", // user's value preserved
|
|
264
|
-
analytics: { // new field added with defaults
|
|
265
|
-
enabled: true,
|
|
266
|
-
provider: "plausible",
|
|
267
|
-
},
|
|
268
|
-
billing: {
|
|
269
|
-
scope: "user", // user's value preserved
|
|
270
|
-
},
|
|
271
|
-
};
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Translation merge
|
|
275
|
-
|
|
276
|
-
Upstream diff:
|
|
277
|
-
```diff
|
|
278
|
-
{
|
|
279
|
-
"dashboard": {
|
|
280
|
-
"title": "Dashboard",
|
|
281
|
-
- "old_metric": "Old Metric",
|
|
282
|
-
+ "new_metric": "New Metric",
|
|
283
|
-
+ "analytics": "Analytics"
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
User changed `dashboard.title` to `"Control Panel"`. Result:
|
|
289
|
-
```json
|
|
290
|
-
{
|
|
291
|
-
"dashboard": {
|
|
292
|
-
"title": "Control Panel",
|
|
293
|
-
"new_metric": "New Metric",
|
|
294
|
-
"analytics": "Analytics"
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
```
|
|
298
|
-
`old_metric` removed (upstream deleted it), `title` preserved (user customized it), new keys added.
|
|
414
|
+
## When to Always Ask
|
|
299
415
|
|
|
300
|
-
|
|
416
|
+
Even in Quick mode, always ask the user about:
|
|
301
417
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
-
|
|
307
|
-
|
|
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
|
};
|