@speclife/cli 0.6.0 → 0.6.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.
@@ -0,0 +1,170 @@
1
+ ---
2
+ name: /speclife-sync
3
+ id: speclife-sync
4
+ category: SpecLife
5
+ description: Update current branch with latest changes from main.
6
+ ---
7
+ # /speclife sync
8
+
9
+ Update your branch with latest main. Handles conflicts with guidance.
10
+
11
+ ## ⚡ Execution
12
+
13
+ **When this command is invoked, IMMEDIATELY execute the workflow below.**
14
+
15
+ - Check prerequisites first (not on main, clean working directory)
16
+ - Default to rebase unless `--merge` is specified
17
+ - If conflicts occur, guide the user through resolution
18
+ - Push after successful sync
19
+
20
+ ## TL;DR
21
+
22
+ ```
23
+ /speclife sync # Rebase onto main (default)
24
+ /speclife sync --merge # Merge main into branch
25
+ ```
26
+
27
+ **Quick flow:**
28
+ 1. Check prerequisites (not on main, clean working dir)
29
+ 2. Fetch latest
30
+ 3. Rebase or merge
31
+ 4. Handle conflicts if any
32
+ 5. Force push (if rebased)
33
+
34
+ ## Prerequisites
35
+
36
+ - Not on main branch
37
+ - Working directory clean (commit or stash first)
38
+
39
+ ## Core Steps
40
+
41
+ ### 1. Check State
42
+ ```bash
43
+ BRANCH=$(git branch --show-current)
44
+ [[ "$BRANCH" == "main" ]] && echo "Already on main" && exit
45
+
46
+ # Check for uncommitted changes
47
+ [[ -n $(git status --porcelain) ]] && echo "Commit or stash changes first"
48
+ ```
49
+
50
+ ### 2. Fetch & Check
51
+ ```bash
52
+ git fetch origin main
53
+ BEHIND=$(git rev-list --count HEAD..origin/main)
54
+ [[ "$BEHIND" == "0" ]] && echo "Already up to date" && exit
55
+ ```
56
+
57
+ ### 3. Rebase (default) or Merge
58
+ ```bash
59
+ # Rebase (cleaner history)
60
+ git rebase origin/main
61
+
62
+ # Or merge (preserves history)
63
+ git merge origin/main
64
+ ```
65
+
66
+ ### 4. Handle Conflicts
67
+ If conflicts:
68
+ ```bash
69
+ # List conflicts
70
+ git diff --name-only --diff-filter=U
71
+ ```
72
+
73
+ Tell user:
74
+ ```
75
+ ⚠️ Conflicts in 3 files:
76
+ - src/auth/login.ts
77
+ - package.json
78
+
79
+ To resolve:
80
+ 1. Edit files, remove <<<<<<< ======= >>>>>>> markers
81
+ 2. git add <resolved-files>
82
+ 3. git rebase --continue
83
+
84
+ Or abort: git rebase --abort
85
+ ```
86
+
87
+ ### 5. Push
88
+ ```bash
89
+ # After rebase (force required)
90
+ git push --force-with-lease origin <branch>
91
+
92
+ # After merge (normal push)
93
+ git push origin <branch>
94
+ ```
95
+
96
+ ### 6. Report
97
+ ```
98
+ ✓ Rebased onto main (5 commits)
99
+ ✓ No conflicts
100
+ ✓ Pushed
101
+ ```
102
+
103
+ ---
104
+
105
+ <!-- REFERENCE SECTIONS - Read only when needed -->
106
+
107
+ ## Appendix: Conflict Resolution
108
+
109
+ **Conflict markers:**
110
+ ```
111
+ <<<<<<< HEAD (yours)
112
+ const timeout = 5000;
113
+ =======
114
+ const timeout = 10000;
115
+ >>>>>>> origin/main (theirs)
116
+ ```
117
+
118
+ **Resolution strategies:**
119
+ - Keep yours: delete their section + markers
120
+ - Keep theirs: delete your section + markers
121
+ - Combine: merge logic, delete markers
122
+
123
+ **Common conflicts:**
124
+ - `package.json` version → keep higher (main)
125
+ - Import conflicts → combine imports
126
+
127
+ ## Appendix: Error Handling
128
+
129
+ **On main:**
130
+ ```
131
+ ℹ️ Already on main - nothing to sync.
132
+ ```
133
+
134
+ **Uncommitted changes:**
135
+ ```
136
+ ⚠️ Uncommitted changes detected.
137
+ Commit or stash, then retry.
138
+ ```
139
+
140
+ **Rebase in progress:**
141
+ ```
142
+ ⚠️ Rebase already in progress.
143
+ Continue: git rebase --continue
144
+ Abort: git rebase --abort
145
+ ```
146
+
147
+ ## Appendix: Examples
148
+
149
+ **Clean sync:**
150
+ ```
151
+ User: /speclife sync
152
+
153
+ Agent:
154
+ ✓ Fetched latest
155
+ ℹ️ 3 commits behind main
156
+ ✓ Rebased - no conflicts
157
+ ✓ Force pushed
158
+ ```
159
+
160
+ **With conflicts:**
161
+ ```
162
+ User: /speclife sync
163
+
164
+ Agent:
165
+ ⚠️ Conflicts in 2 files:
166
+ - src/auth.ts
167
+ - package.json
168
+
169
+ [Offers to help resolve]
170
+ ```
@@ -0,0 +1,96 @@
1
+ # SpecLife Release Workflow
2
+ # Automatically creates GitHub releases when version changes are detected
3
+ # Triggered by version bump in package.json (from /speclife land)
4
+
5
+ name: Create Release
6
+
7
+ on:
8
+ push:
9
+ branches:
10
+ - main
11
+
12
+ jobs:
13
+ check-version:
14
+ runs-on: ubuntu-latest
15
+ outputs:
16
+ version_changed: ${{ steps.check.outputs.changed }}
17
+ new_version: ${{ steps.check.outputs.version }}
18
+
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+ with:
23
+ fetch-depth: 2
24
+
25
+ - name: Check for version change
26
+ id: check
27
+ run: |
28
+ # Get version from current commit
29
+ CURRENT_VERSION=$(node -p "require('./package.json').version")
30
+
31
+ # Get version from previous commit
32
+ git checkout HEAD~1 -- package.json 2>/dev/null || true
33
+ PREV_VERSION=$(node -p "require('./package.json').version" 2>/dev/null || echo "0.0.0")
34
+ git checkout HEAD -- package.json
35
+
36
+ echo "Previous version: $PREV_VERSION"
37
+ echo "Current version: $CURRENT_VERSION"
38
+
39
+ if [ "$CURRENT_VERSION" != "$PREV_VERSION" ]; then
40
+ echo "Version changed: $PREV_VERSION -> $CURRENT_VERSION"
41
+ echo "changed=true" >> $GITHUB_OUTPUT
42
+ echo "version=v$CURRENT_VERSION" >> $GITHUB_OUTPUT
43
+ else
44
+ echo "No version change"
45
+ echo "changed=false" >> $GITHUB_OUTPUT
46
+ fi
47
+
48
+ release:
49
+ needs: check-version
50
+ runs-on: ubuntu-latest
51
+ if: needs.check-version.outputs.version_changed == 'true'
52
+
53
+ permissions:
54
+ contents: write
55
+
56
+ steps:
57
+ - name: Checkout
58
+ uses: actions/checkout@v4
59
+
60
+ - name: Create and push tag
61
+ run: |
62
+ VERSION="${{ needs.check-version.outputs.new_version }}"
63
+ echo "Creating tag: $VERSION"
64
+
65
+ git config user.name "github-actions[bot]"
66
+ git config user.email "github-actions[bot]@users.noreply.github.com"
67
+ git tag "$VERSION"
68
+ git push origin "$VERSION"
69
+
70
+ - name: Create GitHub Release
71
+ uses: softprops/action-gh-release@v2
72
+ with:
73
+ tag_name: ${{ needs.check-version.outputs.new_version }}
74
+ generate_release_notes: true
75
+ body: |
76
+ ## What's Changed
77
+
78
+ See the [full changelog](https://github.com/${{ github.repository }}/compare/.../${{ needs.check-version.outputs.new_version }}) for details.
79
+
80
+ # Optional: Add publish job for npm/other registries
81
+ # Uncomment and configure as needed
82
+ #
83
+ # publish:
84
+ # needs: [check-version, release]
85
+ # if: ${{ always() && needs.release.result == 'success' }}
86
+ # runs-on: ubuntu-latest
87
+ # steps:
88
+ # - uses: actions/checkout@v4
89
+ # - uses: actions/setup-node@v4
90
+ # with:
91
+ # node-version: '20'
92
+ # registry-url: 'https://registry.npmjs.org'
93
+ # - run: npm ci
94
+ # - run: npm publish
95
+ # env:
96
+ # NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}