Skip to content

Commit 50b7f2b

Browse files
authored
feat(ci): add updating skill and weekly-update workflow (#524)
* feat(ci): add updating skill and weekly-update workflow - Add updating skill for npm dependency updates - Add weekly-update.yml workflow for automated updates * fix(skill): update updating skill to use pnpm run update and check --all - Use `pnpm run update` instead of fallback to `pnpm update` - Add `pnpm run fix --all` before validation - Change `pnpm run check` to `pnpm run check --all` * fix(ci): update pnpm/action-setup to Node 24 (58e6119) * chore(deps): update @socketsecurity/lib to 5.11.2
1 parent ee4b540 commit 50b7f2b

6 files changed

Lines changed: 432 additions & 6 deletions

File tree

.claude/skills/updating/SKILL.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
---
2+
name: updating
3+
description: Updates all npm dependencies to their latest versions. Triggers when user asks to "update dependencies", "update packages", or prepare for a release.
4+
user-invocable: true
5+
allowed-tools: Bash, Read, Grep, Glob, Edit
6+
---
7+
8+
# updating
9+
10+
<task>
11+
Your task is to update all npm dependencies to their latest versions, ensuring all builds and tests pass.
12+
</task>
13+
14+
<context>
15+
**What is this?**
16+
This skill updates npm packages for security patches, bug fixes, and new features.
17+
18+
**Update Targets:**
19+
- npm packages via `pnpm run update`
20+
</context>
21+
22+
<constraints>
23+
**Requirements:**
24+
- Start with clean working directory (no uncommitted changes)
25+
26+
**CI Mode** (detected via `CI=true` or `GITHUB_ACTIONS`):
27+
- Create atomic commits, skip build validation (CI validates separately)
28+
- Workflow handles push and PR creation
29+
30+
**Interactive Mode** (default):
31+
- Validate updates with build/tests before proceeding
32+
- Report validation results to user
33+
34+
**Actions:**
35+
- Update npm packages
36+
- Create atomic commits
37+
- Report summary of changes
38+
</constraints>
39+
40+
<instructions>
41+
42+
## Process
43+
44+
### Phase 1: Validate Environment
45+
46+
<action>
47+
Check working directory is clean and detect CI mode:
48+
</action>
49+
50+
```bash
51+
# Detect CI mode
52+
if [ "$CI" = "true" ] || [ -n "$GITHUB_ACTIONS" ]; then
53+
CI_MODE=true
54+
echo "Running in CI mode - will skip build validation"
55+
else
56+
CI_MODE=false
57+
echo "Running in interactive mode - will validate builds"
58+
fi
59+
60+
# Check working directory is clean
61+
git status --porcelain
62+
```
63+
64+
<validation>
65+
- Working directory must be clean
66+
- CI_MODE detected for subsequent phases
67+
</validation>
68+
69+
---
70+
71+
### Phase 2: Update npm Packages
72+
73+
<action>
74+
Run pnpm run update to update npm dependencies:
75+
</action>
76+
77+
```bash
78+
# Update npm packages
79+
pnpm run update
80+
81+
# Check if there are changes
82+
if [ -n "$(git status --porcelain pnpm-lock.yaml package.json)" ]; then
83+
git add pnpm-lock.yaml package.json
84+
git commit -m "chore: update npm dependencies
85+
86+
Updated npm packages via pnpm run update."
87+
echo "npm packages updated"
88+
else
89+
echo "npm packages already up to date"
90+
fi
91+
```
92+
93+
---
94+
95+
### Phase 3: Final Validation
96+
97+
<action>
98+
Run build and test suite (skip in CI mode):
99+
</action>
100+
101+
```bash
102+
if [ "$CI_MODE" = "true" ]; then
103+
echo "CI mode: Skipping final validation (CI will run builds/tests separately)"
104+
echo "Commits created - ready for push by CI workflow"
105+
else
106+
echo "Interactive mode: Running full validation..."
107+
pnpm run fix --all
108+
pnpm run check --all
109+
pnpm test
110+
fi
111+
```
112+
113+
---
114+
115+
### Phase 4: Report Summary
116+
117+
<action>
118+
Generate update report:
119+
</action>
120+
121+
```
122+
## Update Complete
123+
124+
### Updates Applied:
125+
126+
| Category | Status |
127+
|----------|--------|
128+
| npm packages | Updated/Up to date |
129+
130+
### Commits Created:
131+
- [list commits if any]
132+
133+
### Validation:
134+
- Build: SUCCESS/SKIPPED (CI mode)
135+
- Tests: PASS/SKIPPED (CI mode)
136+
137+
### Next Steps:
138+
**Interactive mode:**
139+
1. Review changes: `git log --oneline -N`
140+
2. Push to remote: `git push origin main`
141+
142+
**CI mode:**
143+
1. Workflow will push branch and create PR
144+
2. CI will run full build/test validation
145+
3. Review PR when CI passes
146+
```
147+
148+
</instructions>
149+
150+
## Success Criteria
151+
152+
- All npm packages checked for updates
153+
- Full build and tests pass (interactive mode)
154+
- Summary report generated
155+
156+
## Context
157+
158+
This skill is useful for:
159+
160+
- Weekly maintenance (automated via weekly-update.yml)
161+
- Security patch rollout
162+
- Pre-release preparation
163+
164+
**Safety:** Updates are validated before committing. Failures stop the process.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# updating Reference Documentation
2+
3+
## Table of Contents
4+
5+
1. [How the Update Script Works](#how-the-update-script-works)
6+
2. [Files Changed After Update](#files-changed-after-update)
7+
3. [Validation Commands](#validation-commands)
8+
4. [Troubleshooting](#troubleshooting)
9+
10+
---
11+
12+
## How the Update Script Works
13+
14+
`pnpm run update` runs `scripts/update.mjs` which performs:
15+
16+
```bash
17+
# 1. Run taze recursively with write mode
18+
pnpm exec taze -r -w
19+
20+
# 2. Force-update Socket scoped packages (bypasses taze maturity period)
21+
pnpm update @socketsecurity/* @socketregistry/* @socketbin/* --latest -r
22+
23+
# 3. pnpm install runs automatically to reconcile lockfile
24+
```
25+
26+
### Repo Structure
27+
28+
- **Single package** (not a monorepo, no `packages/` directory)
29+
- Has both `dependencies` and `devDependencies` (published package)
30+
- Runtime deps: `@socketregistry/packageurl-js`, `@socketsecurity/lib`, `form-data`
31+
- Dependencies pinned to exact versions in `package.json`
32+
33+
---
34+
35+
## Files Changed After Update
36+
37+
- `package.json` - Dependency version pins (both deps and devDeps)
38+
- `pnpm-lock.yaml` - Lock file
39+
40+
---
41+
42+
## Validation Commands
43+
44+
```bash
45+
# Fix lint issues
46+
pnpm run fix --all
47+
48+
# Run all checks (lint + type check)
49+
pnpm run check --all
50+
51+
# Run tests
52+
pnpm test
53+
```
54+
55+
---
56+
57+
## Troubleshooting
58+
59+
### taze Fails to Detect Updates
60+
61+
**Cause:** taze has a maturity period for new releases.
62+
**Solution:** Socket packages are force-updated separately via `pnpm update --latest`.
63+
64+
### Lock File Conflicts
65+
66+
**Solution:**
67+
```bash
68+
rm pnpm-lock.yaml
69+
pnpm install
70+
```
71+
72+
### SDK Regeneration
73+
74+
If `@socketsecurity/lib` is updated, the generated SDK types may need
75+
regeneration via `pnpm run generate-sdk`. Check if API types in `types/`
76+
are still valid after updating.

0 commit comments

Comments
 (0)