@mindfoldhq/trellis 0.1.9 → 0.2.2
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/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +12 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +684 -42
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/opencode.js +1 -1
- package/dist/configurators/opencode.js.map +1 -1
- package/dist/configurators/workflow.d.ts +4 -3
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +23 -20
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +29 -30
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +32 -35
- package/dist/constants/paths.js.map +1 -1
- package/dist/migrations/index.d.ts +35 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +124 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.9.json +30 -0
- package/dist/migrations/manifests/0.2.0.json +43 -0
- package/dist/templates/claude/agents/check.md +3 -3
- package/dist/templates/claude/agents/debug.md +1 -1
- package/dist/templates/claude/agents/dispatch.md +12 -12
- package/dist/templates/claude/agents/implement.md +6 -6
- package/dist/templates/claude/agents/plan.md +37 -37
- package/dist/templates/claude/agents/research.md +1 -1
- package/dist/templates/claude/commands/before-backend-dev.md +5 -5
- package/dist/templates/claude/commands/before-frontend-dev.md +5 -5
- package/dist/templates/claude/commands/break-loop.md +2 -2
- package/dist/templates/claude/commands/check-backend.md +6 -6
- package/dist/templates/claude/commands/check-cross-layer.md +5 -5
- package/dist/templates/claude/commands/check-frontend.md +6 -6
- package/dist/templates/claude/commands/create-command.md +3 -3
- package/dist/templates/claude/commands/finish-work.md +6 -6
- package/dist/templates/claude/commands/integrate-skill.md +11 -11
- package/dist/templates/claude/commands/{onboard-developer.md → onboard.md} +31 -28
- package/dist/templates/claude/commands/parallel.md +17 -17
- package/dist/templates/claude/commands/{record-agent-flow.md → record-session.md} +7 -7
- package/dist/templates/claude/commands/start.md +36 -36
- package/dist/templates/claude/hooks/inject-subagent-context.py +77 -76
- package/dist/templates/claude/hooks/ralph-loop.py +18 -18
- package/dist/templates/claude/hooks/session-start.py +4 -4
- package/dist/templates/cursor/commands/before-backend-dev.md +5 -5
- package/dist/templates/cursor/commands/before-frontend-dev.md +5 -5
- package/dist/templates/cursor/commands/break-loop.md +2 -2
- package/dist/templates/cursor/commands/check-backend.md +6 -6
- package/dist/templates/cursor/commands/check-cross-layer.md +5 -5
- package/dist/templates/cursor/commands/check-frontend.md +6 -6
- package/dist/templates/cursor/commands/create-command.md +3 -3
- package/dist/templates/cursor/commands/finish-work.md +6 -6
- package/dist/templates/cursor/commands/integrate-skill.md +11 -11
- package/dist/templates/cursor/commands/{onboard-developer.md → onboard.md} +31 -28
- package/dist/templates/cursor/commands/{record-agent-flow.md → record-session.md} +7 -7
- package/dist/templates/cursor/commands/start.md +25 -25
- package/dist/templates/extract.d.ts +2 -2
- package/dist/templates/extract.js +2 -2
- package/dist/templates/markdown/agents.md +2 -2
- package/dist/templates/markdown/gitignore.txt +2 -2
- package/dist/templates/markdown/index.d.ts +1 -0
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +4 -2
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/{agent-traces-index.md → workspace-index.md} +14 -14
- package/dist/templates/trellis/index.d.ts +7 -1
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +14 -2
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add-session.sh +26 -26
- package/dist/templates/trellis/scripts/common/developer.sh +20 -21
- package/dist/templates/trellis/scripts/common/git-context.sh +90 -115
- package/dist/templates/trellis/scripts/common/paths.sh +53 -63
- package/dist/templates/trellis/scripts/common/phase.sh +40 -40
- package/dist/templates/trellis/scripts/common/registry.sh +13 -13
- package/dist/templates/trellis/scripts/common/task-queue.sh +142 -0
- package/dist/templates/trellis/scripts/common/task-utils.sh +151 -0
- package/dist/templates/trellis/scripts/common/worktree.sh +3 -3
- package/dist/templates/trellis/scripts/create-bootstrap.sh +43 -42
- package/dist/templates/trellis/scripts/init-developer.sh +1 -1
- package/dist/templates/trellis/scripts/multi-agent/cleanup.sh +33 -33
- package/dist/templates/trellis/scripts/multi-agent/create-pr.sh +30 -30
- package/dist/templates/trellis/scripts/multi-agent/plan.sh +28 -28
- package/dist/templates/trellis/scripts/multi-agent/start.sh +56 -56
- package/dist/templates/trellis/scripts/multi-agent/status.sh +59 -59
- package/dist/templates/trellis/scripts/{feature.sh → task.sh} +235 -185
- package/dist/templates/trellis/workflow.md +71 -74
- package/dist/types/migration.d.ts +74 -0
- package/dist/types/migration.d.ts.map +1 -0
- package/dist/types/migration.js +8 -0
- package/dist/types/migration.js.map +1 -0
- package/dist/utils/template-hash.d.ts +78 -0
- package/dist/utils/template-hash.d.ts.map +1 -0
- package/dist/utils/template-hash.js +234 -0
- package/dist/utils/template-hash.js.map +1 -0
- package/package.json +1 -1
- package/dist/templates/trellis/scripts/common/backlog.sh +0 -220
- package/dist/templates/trellis/scripts/common/feature-utils.sh +0 -194
- /package/dist/templates/trellis/{backlog → tasks}/.gitkeep +0 -0
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
|
|
34
34
|
This creates:
|
|
35
35
|
- `.trellis/.developer` - Your identity file (gitignored, not committed)
|
|
36
|
-
- `.trellis/
|
|
36
|
+
- `.trellis/workspace/<your-name>/` - Your personal workspace directory
|
|
37
37
|
|
|
38
38
|
**Naming suggestions**:
|
|
39
39
|
- Human developers: Use your name, e.g., `john-doe`
|
|
40
|
-
- Cursor AI: `cursor-agent` or `cursor-<
|
|
41
|
-
- Claude Code: `claude-agent` or `claude-<
|
|
40
|
+
- Cursor AI: `cursor-agent` or `cursor-<task>`
|
|
41
|
+
- Claude Code: `claude-agent` or `claude-<task>`
|
|
42
42
|
|
|
43
43
|
### Step 1: Understand Current Context
|
|
44
44
|
|
|
@@ -48,7 +48,7 @@ This creates:
|
|
|
48
48
|
|
|
49
49
|
# Or check manually:
|
|
50
50
|
./.trellis/scripts/get-developer.sh # Your identity
|
|
51
|
-
./.trellis/scripts/
|
|
51
|
+
./.trellis/scripts/task.sh list # Active tasks
|
|
52
52
|
git status && git log --oneline -10 # Git state
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -58,10 +58,10 @@ git status && git log --oneline -10 # Git state
|
|
|
58
58
|
|
|
59
59
|
```bash
|
|
60
60
|
# Read frontend guidelines index (if applicable)
|
|
61
|
-
cat .trellis/
|
|
61
|
+
cat .trellis/spec/frontend/index.md
|
|
62
62
|
|
|
63
63
|
# Read backend guidelines index (if applicable)
|
|
64
|
-
cat .trellis/
|
|
64
|
+
cat .trellis/spec/backend/index.md
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
**Why read both?**
|
|
@@ -76,16 +76,16 @@ Based on your task, read the **detailed** guidelines:
|
|
|
76
76
|
|
|
77
77
|
**Frontend Task**:
|
|
78
78
|
```bash
|
|
79
|
-
cat .trellis/
|
|
80
|
-
cat .trellis/
|
|
81
|
-
cat .trellis/
|
|
79
|
+
cat .trellis/spec/frontend/hook-guidelines.md # For hooks
|
|
80
|
+
cat .trellis/spec/frontend/component-guidelines.md # For components
|
|
81
|
+
cat .trellis/spec/frontend/type-safety.md # For types
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
**Backend Task**:
|
|
85
85
|
```bash
|
|
86
|
-
cat .trellis/
|
|
87
|
-
cat .trellis/
|
|
88
|
-
cat .trellis/
|
|
86
|
+
cat .trellis/spec/backend/database-guidelines.md # For DB operations
|
|
87
|
+
cat .trellis/spec/backend/type-safety.md # For types
|
|
88
|
+
cat .trellis/spec/backend/logging-guidelines.md # For logging
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
---
|
|
@@ -95,10 +95,10 @@ cat .trellis/structure/backend/logging-guidelines.md # For logging
|
|
|
95
95
|
### Core Principles
|
|
96
96
|
|
|
97
97
|
1. **Read Before Write** - Understand context before starting
|
|
98
|
-
2. **Follow Standards** - [!] **MUST read `.trellis/
|
|
99
|
-
3. **Incremental Development** - Complete one
|
|
98
|
+
2. **Follow Standards** - [!] **MUST read `.trellis/spec/` guidelines before coding**
|
|
99
|
+
3. **Incremental Development** - Complete one task at a time
|
|
100
100
|
4. **Record Promptly** - Update tracking files immediately after completion
|
|
101
|
-
5. **Document Limits** - [!] **Max 2000 lines per
|
|
101
|
+
5. **Document Limits** - [!] **Max 2000 lines per journal document**
|
|
102
102
|
|
|
103
103
|
### File System
|
|
104
104
|
|
|
@@ -112,18 +112,18 @@ cat .trellis/structure/backend/logging-guidelines.md # For logging
|
|
|
112
112
|
| | \-- git-context.sh # Git context implementation
|
|
113
113
|
| |-- init-developer.sh # Initialize developer identity
|
|
114
114
|
| |-- get-developer.sh # Get current developer name
|
|
115
|
-
| |--
|
|
115
|
+
| |-- task.sh # Manage tasks
|
|
116
116
|
| |-- get-context.sh # Get session context
|
|
117
117
|
| \-- add-session.sh # One-click session recording
|
|
118
|
-
|--
|
|
119
|
-
| |-- index.md #
|
|
118
|
+
|-- workspace/ # Developer workspaces
|
|
119
|
+
| |-- index.md # Workspace index + Session template
|
|
120
120
|
| \-- {developer}/ # Per-developer directories
|
|
121
121
|
| |-- index.md # Personal index (with @@@auto markers)
|
|
122
|
-
|
|
|
123
|
-
|
|
124
|
-
|
|
|
125
|
-
| \--
|
|
126
|
-
|--
|
|
122
|
+
| \-- journal-N.md # Journal files (sequential numbering)
|
|
123
|
+
|-- tasks/ # Task tracking
|
|
124
|
+
| \-- {MM}-{DD}-{name}/
|
|
125
|
+
| \-- task.json
|
|
126
|
+
|-- spec/ # [!] MUST READ before coding
|
|
127
127
|
| |-- frontend/ # Frontend guidelines (if applicable)
|
|
128
128
|
| | |-- index.md # Start here - guidelines index
|
|
129
129
|
| | \-- *.md # Topic-specific docs
|
|
@@ -162,49 +162,49 @@ Based on what you'll develop, read the corresponding guidelines:
|
|
|
162
162
|
**Frontend Development** (if applicable):
|
|
163
163
|
```bash
|
|
164
164
|
# Read index first, then specific docs based on task
|
|
165
|
-
cat .trellis/
|
|
165
|
+
cat .trellis/spec/frontend/index.md
|
|
166
166
|
```
|
|
167
167
|
|
|
168
168
|
**Backend Development** (if applicable):
|
|
169
169
|
```bash
|
|
170
170
|
# Read index first, then specific docs based on task
|
|
171
|
-
cat .trellis/
|
|
171
|
+
cat .trellis/spec/backend/index.md
|
|
172
172
|
```
|
|
173
173
|
|
|
174
174
|
**Cross-Layer Features**:
|
|
175
175
|
```bash
|
|
176
176
|
# For features spanning multiple layers
|
|
177
|
-
cat .trellis/
|
|
177
|
+
cat .trellis/spec/guides/cross-layer-thinking-guide.md
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
-
### Step 3: Select
|
|
180
|
+
### Step 3: Select Task to Develop
|
|
181
181
|
|
|
182
|
-
Use the
|
|
182
|
+
Use the task management script:
|
|
183
183
|
|
|
184
184
|
```bash
|
|
185
|
-
# List active
|
|
186
|
-
./.trellis/scripts/
|
|
185
|
+
# List active tasks
|
|
186
|
+
./.trellis/scripts/task.sh list
|
|
187
187
|
|
|
188
|
-
# Create new
|
|
189
|
-
./.trellis/scripts/
|
|
188
|
+
# Create new task (creates directory with task.json)
|
|
189
|
+
./.trellis/scripts/task.sh create "<title>" --slug <task-name>
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
---
|
|
193
193
|
|
|
194
194
|
## Development Process
|
|
195
195
|
|
|
196
|
-
###
|
|
196
|
+
### Task Development Flow
|
|
197
197
|
|
|
198
198
|
```
|
|
199
|
-
1. Create or select
|
|
200
|
-
\-> ./.trellis/scripts/
|
|
199
|
+
1. Create or select task
|
|
200
|
+
\-> ./.trellis/scripts/task.sh create "<title>" --slug <name> or list
|
|
201
201
|
|
|
202
202
|
2. Write code according to guidelines
|
|
203
|
-
\-> Read .trellis/
|
|
204
|
-
\-> For cross-layer: read .trellis/
|
|
203
|
+
\-> Read .trellis/spec/ docs relevant to your task
|
|
204
|
+
\-> For cross-layer: read .trellis/spec/guides/
|
|
205
205
|
|
|
206
206
|
3. Self-test
|
|
207
|
-
\-> Run project's lint/test commands (see
|
|
207
|
+
\-> Run project's lint/test commands (see spec docs)
|
|
208
208
|
\-> Manual feature testing
|
|
209
209
|
|
|
210
210
|
4. Commit code
|
|
@@ -224,8 +224,8 @@ Use the feature management script:
|
|
|
224
224
|
- [OK] Manual feature testing passes
|
|
225
225
|
|
|
226
226
|
**Project-specific checks**:
|
|
227
|
-
- See `.trellis/
|
|
228
|
-
- See `.trellis/
|
|
227
|
+
- See `.trellis/spec/frontend/quality-guidelines.md` for frontend
|
|
228
|
+
- See `.trellis/spec/backend/quality-guidelines.md` for backend
|
|
229
229
|
|
|
230
230
|
---
|
|
231
231
|
|
|
@@ -243,7 +243,7 @@ After code is committed, use:
|
|
|
243
243
|
```
|
|
244
244
|
|
|
245
245
|
This automatically:
|
|
246
|
-
1. Detects current
|
|
246
|
+
1. Detects current journal file
|
|
247
247
|
2. Creates new file if 2000-line limit exceeded
|
|
248
248
|
3. Appends session content
|
|
249
249
|
4. Updates index.md (sessions count, history table)
|
|
@@ -255,40 +255,37 @@ Use `/finish-work` command to run through:
|
|
|
255
255
|
2. [OK] Session recorded via `add-session.sh`
|
|
256
256
|
3. [OK] No lint/test errors
|
|
257
257
|
4. [OK] Working directory clean (or WIP noted)
|
|
258
|
-
5. [OK]
|
|
258
|
+
5. [OK] Spec docs updated if needed
|
|
259
259
|
|
|
260
260
|
---
|
|
261
261
|
|
|
262
262
|
## File Descriptions
|
|
263
263
|
|
|
264
|
-
### 1.
|
|
264
|
+
### 1. workspace/ - Developer Workspaces
|
|
265
265
|
|
|
266
266
|
**Purpose**: Record each AI Agent session's work content
|
|
267
267
|
|
|
268
268
|
**Structure** (Multi-developer support):
|
|
269
269
|
```
|
|
270
|
-
|
|
270
|
+
workspace/
|
|
271
271
|
|-- index.md # Main index (Active Developers table)
|
|
272
272
|
\-- {developer}/ # Per-developer directory
|
|
273
273
|
|-- index.md # Personal index (with @@@auto markers)
|
|
274
|
-
|
|
275
|
-
| \-- {day}-{name}/ # Each feature is a directory
|
|
276
|
-
| \-- feature.json
|
|
277
|
-
\-- traces-N.md # Traces files (sequential: 1, 2, 3...)
|
|
274
|
+
\-- journal-N.md # Journal files (sequential: 1, 2, 3...)
|
|
278
275
|
```
|
|
279
276
|
|
|
280
277
|
**When to update**:
|
|
281
278
|
- [OK] End of each session
|
|
282
|
-
- [OK] Complete important
|
|
279
|
+
- [OK] Complete important task
|
|
283
280
|
- [OK] Fix important bug
|
|
284
281
|
|
|
285
|
-
### 2.
|
|
282
|
+
### 2. spec/ - Development Guidelines
|
|
286
283
|
|
|
287
284
|
**Purpose**: Documented standards for consistent development
|
|
288
285
|
|
|
289
286
|
**Structure** (Multi-doc format):
|
|
290
287
|
```
|
|
291
|
-
|
|
288
|
+
spec/
|
|
292
289
|
|-- frontend/ # Frontend docs (if applicable)
|
|
293
290
|
| |-- index.md # Start here
|
|
294
291
|
| \-- *.md # Topic-specific docs
|
|
@@ -305,26 +302,26 @@ structure/
|
|
|
305
302
|
- [OK] Bug fixed that reveals missing guidance
|
|
306
303
|
- [OK] New convention established
|
|
307
304
|
|
|
308
|
-
### 3.
|
|
305
|
+
### 3. Tasks - Task Tracking
|
|
309
306
|
|
|
310
|
-
Each
|
|
307
|
+
Each task is a directory containing `task.json`:
|
|
311
308
|
|
|
312
309
|
```
|
|
313
|
-
|
|
314
|
-
|--
|
|
315
|
-
| \--
|
|
310
|
+
tasks/
|
|
311
|
+
|-- 01-21-my-task/
|
|
312
|
+
| \-- task.json
|
|
316
313
|
\-- archive/
|
|
317
|
-
\--
|
|
318
|
-
\--
|
|
319
|
-
\--
|
|
314
|
+
\-- 2026-01/
|
|
315
|
+
\-- 01-15-old-task/
|
|
316
|
+
\-- task.json
|
|
320
317
|
```
|
|
321
318
|
|
|
322
319
|
**Commands**:
|
|
323
320
|
```bash
|
|
324
|
-
./.trellis/scripts/
|
|
325
|
-
./.trellis/scripts/
|
|
326
|
-
./.trellis/scripts/
|
|
327
|
-
./.trellis/scripts/
|
|
321
|
+
./.trellis/scripts/task.sh create "<title>" [--slug <name>] # Create task directory
|
|
322
|
+
./.trellis/scripts/task.sh archive <name> # Archive to archive/{year-month}/
|
|
323
|
+
./.trellis/scripts/task.sh list # List active tasks
|
|
324
|
+
./.trellis/scripts/task.sh list-archive # List archived tasks
|
|
328
325
|
```
|
|
329
326
|
|
|
330
327
|
---
|
|
@@ -335,12 +332,12 @@ features/
|
|
|
335
332
|
|
|
336
333
|
1. **Before session start**:
|
|
337
334
|
- Run `./.trellis/scripts/get-context.sh` for full context
|
|
338
|
-
- [!] **MUST read** relevant `.trellis/
|
|
335
|
+
- [!] **MUST read** relevant `.trellis/spec/` docs
|
|
339
336
|
|
|
340
337
|
2. **During development**:
|
|
341
|
-
- [!] **Follow** `.trellis/
|
|
338
|
+
- [!] **Follow** `.trellis/spec/` guidelines
|
|
342
339
|
- For cross-layer features, use `/check-cross-layer`
|
|
343
|
-
- Develop only one
|
|
340
|
+
- Develop only one task at a time
|
|
344
341
|
- Run lint and tests frequently
|
|
345
342
|
|
|
346
343
|
3. **After development complete**:
|
|
@@ -351,11 +348,11 @@ features/
|
|
|
351
348
|
|
|
352
349
|
### [X] DON'T - Should Not Do
|
|
353
350
|
|
|
354
|
-
1. [!] **Don't** skip reading `.trellis/
|
|
355
|
-
2. [!] **Don't** let
|
|
356
|
-
3. **Don't** develop multiple unrelated
|
|
351
|
+
1. [!] **Don't** skip reading `.trellis/spec/` guidelines
|
|
352
|
+
2. [!] **Don't** let journal single file exceed 2000 lines
|
|
353
|
+
3. **Don't** develop multiple unrelated tasks simultaneously
|
|
357
354
|
4. **Don't** commit code with lint/test errors
|
|
358
|
-
5. **Don't** forget to update
|
|
355
|
+
5. **Don't** forget to update spec docs after learning something
|
|
359
356
|
6. [!] **Don't** execute `git commit` - AI should not commit code
|
|
360
357
|
|
|
361
358
|
---
|
|
@@ -386,9 +383,9 @@ git commit -m "type(scope): description"
|
|
|
386
383
|
./.trellis/scripts/get-context.sh # Get full context
|
|
387
384
|
./.trellis/scripts/add-session.sh # Record session
|
|
388
385
|
|
|
389
|
-
#
|
|
390
|
-
./.trellis/scripts/
|
|
391
|
-
./.trellis/scripts/
|
|
386
|
+
# Task management
|
|
387
|
+
./.trellis/scripts/task.sh list # List tasks
|
|
388
|
+
./.trellis/scripts/task.sh create "<title>" # Create task
|
|
392
389
|
|
|
393
390
|
# Slash commands
|
|
394
391
|
/finish-work # Pre-commit checklist
|
|
@@ -404,7 +401,7 @@ Following this workflow ensures:
|
|
|
404
401
|
- [OK] Continuity across multiple sessions
|
|
405
402
|
- [OK] Consistent code quality
|
|
406
403
|
- [OK] Trackable progress
|
|
407
|
-
- [OK] Knowledge accumulation in
|
|
404
|
+
- [OK] Knowledge accumulation in spec docs
|
|
408
405
|
- [OK] Transparent team collaboration
|
|
409
406
|
|
|
410
407
|
**Core Philosophy**: Read before write, follow standards, record promptly, capture learnings
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Migration types for Trellis update command
|
|
3
|
+
*
|
|
4
|
+
* These types support intelligent migration during updates,
|
|
5
|
+
* handling file renames, deletions, and user modification detection.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* A single migration action (rename, rename-dir, or delete)
|
|
9
|
+
*/
|
|
10
|
+
export interface MigrationItem {
|
|
11
|
+
/** Type of migration action */
|
|
12
|
+
type: "rename" | "rename-dir" | "delete";
|
|
13
|
+
/** Source path (relative to project root) */
|
|
14
|
+
from: string;
|
|
15
|
+
/** Target path for renames (relative to project root) */
|
|
16
|
+
to?: string;
|
|
17
|
+
/** Human-readable description of the change */
|
|
18
|
+
description?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Migration manifest for a specific version
|
|
22
|
+
*/
|
|
23
|
+
export interface MigrationManifest {
|
|
24
|
+
/** Target version this migration upgrades to */
|
|
25
|
+
version: string;
|
|
26
|
+
/** List of migration actions */
|
|
27
|
+
migrations: MigrationItem[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Classification of how a migration should be handled
|
|
31
|
+
*/
|
|
32
|
+
export type MigrationClassification = "auto" | "confirm" | "conflict" | "skip";
|
|
33
|
+
/**
|
|
34
|
+
* Classified migration item with its determined action
|
|
35
|
+
*/
|
|
36
|
+
export interface ClassifiedMigrationItem extends MigrationItem {
|
|
37
|
+
classification: MigrationClassification;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Result of classifying all migrations
|
|
41
|
+
*/
|
|
42
|
+
export interface ClassifiedMigrations {
|
|
43
|
+
/** Unmodified files - safe to auto-migrate */
|
|
44
|
+
auto: MigrationItem[];
|
|
45
|
+
/** User-modified files - need confirmation */
|
|
46
|
+
confirm: MigrationItem[];
|
|
47
|
+
/** Conflict - both old and new exist */
|
|
48
|
+
conflict: MigrationItem[];
|
|
49
|
+
/** Skip - old file doesn't exist */
|
|
50
|
+
skip: MigrationItem[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Result of executing migrations
|
|
54
|
+
*/
|
|
55
|
+
export interface MigrationResult {
|
|
56
|
+
/** Number of files renamed */
|
|
57
|
+
renamed: number;
|
|
58
|
+
/** Number of files deleted */
|
|
59
|
+
deleted: number;
|
|
60
|
+
/** Number of files skipped (user choice or no action needed) */
|
|
61
|
+
skipped: number;
|
|
62
|
+
/** Number of conflicts encountered */
|
|
63
|
+
conflicts: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* User action choice for migration confirmation
|
|
67
|
+
*/
|
|
68
|
+
export type MigrationAction = "rename" | "backup-rename" | "skip" | "view-diff";
|
|
69
|
+
/**
|
|
70
|
+
* Template hashes storage structure
|
|
71
|
+
* Maps relative file paths to their SHA256 hashes
|
|
72
|
+
*/
|
|
73
|
+
export type TemplateHashes = Record<string, string>;
|
|
74
|
+
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../../src/types/migration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,IAAI,EAAE,QAAQ,GAAG,YAAY,GAAG,QAAQ,CAAC;IACzC,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,UAAU,EAAE,aAAa,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAC/B,MAAM,GACN,SAAS,GACT,UAAU,GACV,MAAM,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,aAAa;IAC5D,cAAc,EAAE,uBAAuB,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,8CAA8C;IAC9C,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,8CAA8C;IAC9C,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,wCAAwC;IACxC,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,oCAAoC;IACpC,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,eAAe,GACf,MAAM,GACN,WAAW,CAAC;AAEhB;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.js","sourceRoot":"","sources":["../../src/types/migration.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template hash utilities for detecting user modifications
|
|
3
|
+
*
|
|
4
|
+
* Stores SHA256 hashes of template files at install time.
|
|
5
|
+
* Used to determine if users have modified templates.
|
|
6
|
+
*/
|
|
7
|
+
import type { TemplateHashes } from "../types/migration.js";
|
|
8
|
+
/**
|
|
9
|
+
* Compute SHA256 hash of content
|
|
10
|
+
*/
|
|
11
|
+
export declare function computeHash(content: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Load stored template hashes
|
|
14
|
+
*/
|
|
15
|
+
export declare function loadHashes(cwd: string): TemplateHashes;
|
|
16
|
+
/**
|
|
17
|
+
* Save template hashes
|
|
18
|
+
*/
|
|
19
|
+
export declare function saveHashes(cwd: string, hashes: TemplateHashes): void;
|
|
20
|
+
/**
|
|
21
|
+
* Update hashes for specific files
|
|
22
|
+
*
|
|
23
|
+
* @param cwd - Working directory
|
|
24
|
+
* @param files - Map of relative paths to file contents
|
|
25
|
+
*/
|
|
26
|
+
export declare function updateHashes(cwd: string, files: Map<string, string>): void;
|
|
27
|
+
/**
|
|
28
|
+
* Update hash for a single file by reading its current content
|
|
29
|
+
*/
|
|
30
|
+
export declare function updateHashFromFile(cwd: string, relativePath: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Remove hash entry for a file (e.g., after deletion)
|
|
33
|
+
*/
|
|
34
|
+
export declare function removeHash(cwd: string, relativePath: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Rename hash entry (used after file rename)
|
|
37
|
+
*/
|
|
38
|
+
export declare function renameHash(cwd: string, oldPath: string, newPath: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Check if a template file has been modified by the user
|
|
41
|
+
*
|
|
42
|
+
* @param cwd - Working directory
|
|
43
|
+
* @param relativePath - Relative path to the file
|
|
44
|
+
* @param hashes - Stored template hashes
|
|
45
|
+
* @returns true if file has been modified from template, false otherwise
|
|
46
|
+
*/
|
|
47
|
+
export declare function isTemplateModified(cwd: string, relativePath: string, hashes: TemplateHashes): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Check if a file matches its original template content
|
|
50
|
+
* (Useful for determining if a file can be safely auto-migrated)
|
|
51
|
+
*
|
|
52
|
+
* @param cwd - Working directory
|
|
53
|
+
* @param relativePath - Relative path to the file
|
|
54
|
+
* @param originalContent - Original template content
|
|
55
|
+
* @returns true if file matches original template
|
|
56
|
+
*/
|
|
57
|
+
export declare function matchesOriginalTemplate(cwd: string, relativePath: string, originalContent: string): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Get modification status for multiple files
|
|
60
|
+
*
|
|
61
|
+
* @param cwd - Working directory
|
|
62
|
+
* @param relativePaths - Array of relative paths to check
|
|
63
|
+
* @param hashes - Stored template hashes
|
|
64
|
+
* @returns Map of path to modification status
|
|
65
|
+
*/
|
|
66
|
+
export declare function getModificationStatus(cwd: string, relativePaths: string[], hashes: TemplateHashes): Map<string, boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Initialize template hashes after init
|
|
69
|
+
*
|
|
70
|
+
* Scans all template directories and computes hashes for files.
|
|
71
|
+
* This should be called at the end of `trellis init` to enable
|
|
72
|
+
* modification detection on subsequent updates.
|
|
73
|
+
*
|
|
74
|
+
* @param cwd - Working directory
|
|
75
|
+
* @returns Number of files hashed
|
|
76
|
+
*/
|
|
77
|
+
export declare function initializeHashes(cwd: string): number;
|
|
78
|
+
//# sourceMappingURL=template-hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-hash.d.ts","sourceRoot":"","sources":["../../src/utils/template-hash.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAK5D;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AASD;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAYtD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAGpE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACzB,IAAI,CAQN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAU1E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAIlE;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,IAAI,CAON;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,cAAc,GACrB,OAAO,CAmBT;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,GACtB,OAAO,CAST;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,EAAE,EACvB,MAAM,EAAE,cAAc,GACrB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAQtB;AAsED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAoBpD"}
|