Skip to content

Commit a3fd6f0

Browse files
K-Misteleclaude
andcommitted
chore: publish as @humanlayer/react-hotkeys-hook
- Rename package to @humanlayer/react-hotkeys-hook - Add publish workflow (on push to main + workflow_dispatch) - Add version bump workflow for PRs - Set publishConfig.access to public Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b787496 commit a3fd6f0

3 files changed

Lines changed: 145 additions & 5 deletions

File tree

.github/workflows/publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish to npm
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- "package.json"
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- uses: actions/setup-node@v6
18+
with:
19+
node-version: 22.x
20+
registry-url: "https://registry.npmjs.org"
21+
22+
- name: Install dependencies
23+
run: npm install --frozen-lockfile
24+
25+
- name: Lint
26+
run: npm run lint
27+
28+
- name: Test
29+
run: npm run test
30+
env:
31+
CI: true
32+
33+
- name: Build
34+
run: npm run build
35+
36+
- name: Verify dist contents
37+
run: |
38+
echo "Contents of packages/react-hotkeys-hook/dist/:"
39+
ls -la packages/react-hotkeys-hook/dist/
40+
if [ ! -f packages/react-hotkeys-hook/dist/index.js ]; then
41+
echo "ERROR: dist/index.js not found"
42+
exit 1
43+
fi
44+
if [ ! -f packages/react-hotkeys-hook/dist/index.d.ts ]; then
45+
echo "ERROR: dist/index.d.ts not found"
46+
exit 1
47+
fi
48+
49+
- name: Publish to npm
50+
run: npm publish --tolerate-republish
51+
env:
52+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/version-bump.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Version Bump
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
paths:
7+
- "packages/react-hotkeys-hook/**"
8+
- ".github/workflows/publish.yml"
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
version-bump:
16+
runs-on: ubuntu-latest
17+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-version-bump') }}
18+
steps:
19+
- uses: actions/checkout@v6
20+
with:
21+
ref: ${{ github.head_ref }}
22+
fetch-depth: 0
23+
24+
- uses: actions/setup-node@v6
25+
with:
26+
node-version: 22.x
27+
28+
- name: Install Claude Code
29+
run: npm install -g @anthropic-ai/claude-code
30+
31+
- name: Run Claude Version Bump Analysis
32+
env:
33+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
run: |
36+
claude --dangerously-skip-permissions --model sonnet -p "
37+
You are analyzing PR #${{ github.event.pull_request.number }} for @humanlayer/react-hotkeys-hook version bump.
38+
39+
## Context
40+
- Package: root package.json (publishes from packages/react-hotkeys-hook/dist)
41+
- Package name: @humanlayer/react-hotkeys-hook
42+
- PR Title: ${{ github.event.pull_request.title }}
43+
44+
## Instructions
45+
46+
1. Read the PR diff using: gh pr diff ${{ github.event.pull_request.number }}
47+
2. Read the commit messages using: gh pr view ${{ github.event.pull_request.number }} --json commits
48+
3. Check the current version: cat package.json | jq -r '.version'
49+
4. Check if version differs from base branch: git show origin/${{ github.base_ref }}:package.json | jq -r '.version'
50+
51+
## Decision Logic
52+
53+
If the user ALREADY bumped the version (current != base):
54+
- Analyze whether you agree with their bump level
55+
- If you agree: explain why their choice is correct
56+
- If you disagree: explain what bump level you would recommend and why
57+
- DO NOT make any changes - just provide your analysis
58+
59+
If the user has NOT bumped the version (current == base):
60+
- Determine the appropriate bump level based on changes:
61+
- MAJOR: Breaking API changes, removed exports, changed hook signatures
62+
- MINOR: New features, new exports, new options (backwards compatible)
63+
- PATCH: Bug fixes, documentation, refactoring, dependency updates
64+
- Bump BOTH package.json files:
65+
- npm version <major|minor|patch> --no-git-tag-version
66+
- cd packages/react-hotkeys-hook && npm version <major|minor|patch> --no-git-tag-version
67+
- Commit: git add package.json packages/react-hotkeys-hook/package.json && git commit -m 'chore: bump @humanlayer/react-hotkeys-hook to <new-version>'
68+
- Push: git push
69+
70+
## Final Output
71+
72+
End your response with a clear summary formatted like:
73+
74+
## Version Bump Summary
75+
76+
**Package**: @humanlayer/react-hotkeys-hook
77+
**Action**: <bumped to X.Y.Z | agreed with user bump to X.Y.Z | recommend <type> instead of user's <type> | no changes needed>
78+
**Reasoning**: <brief explanation of why this bump level is appropriate based on the changes>
79+
" 2>&1 | tee CLAUDE_OUTPUT.md
80+
81+
- name: Comment on PR
82+
env:
83+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
run: |
85+
gh pr comment ${{ github.event.pull_request.number }} --body-file CLAUDE_OUTPUT.md

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "react-hotkeys-hook",
3-
"description": "React hook for handling keyboard shortcuts",
2+
"name": "@humanlayer/react-hotkeys-hook",
3+
"description": "React hook for handling keyboard shortcuts (HumanLayer fork)",
44
"version": "5.2.4",
55
"sideEffects": false,
66
"repository": {
77
"type": "git",
8-
"url": "https://github.com/JohannesKlauss/react-keymap-hook.git"
8+
"url": "https://github.com/humanlayer/react-hotkeys-hook.git"
99
},
10-
"homepage": "https://react-hotkeys-hook.vercel.app/",
10+
"homepage": "https://github.com/humanlayer/react-hotkeys-hook",
1111
"author": "Johannes Klauss",
1212
"type": "module",
1313
"main": "packages/react-hotkeys-hook/dist/index.js",
@@ -32,7 +32,7 @@
3232
"build": "npm run -w packages/react-hotkeys-hook build",
3333
"build:documentation": "npm run -w packages/documentation build",
3434
"test": "npm run -w packages/react-hotkeys-hook test",
35-
"prepublishOnly": "npm run test && npm run lint && npm run build",
35+
"prepack": "npm run build",
3636
"format": "npx @biomejs/biome format --write packages",
3737
"lint": "npx @biomejs/biome lint --write packages"
3838
},
@@ -43,6 +43,9 @@
4343
"react": ">=16.8.0",
4444
"react-dom": ">=16.8.0"
4545
},
46+
"publishConfig": {
47+
"access": "public"
48+
},
4649
"devDependencies": {
4750
"@biomejs/biome": "2.3.11"
4851
}

0 commit comments

Comments
 (0)