skillsets 0.4.4 → 0.4.6

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.
@@ -251,10 +251,27 @@ _Add any additional context for reviewers here._
251
251
  ---
252
252
  Submitted via \`npx skillsets submit\`
253
253
  `;
254
- const prResult = spawnSync('gh', ['pr', 'create', '--repo', REGISTRY_REPO, '--head', `${username}:${branchName}`, '--title', prTitle, '--body', prBody], {
254
+ // Check if PR already exists for this branch
255
+ const existingPr = spawnSync('gh', ['pr', 'list', '--repo', REGISTRY_REPO, '--head', `${username}:${branchName}`, '--json', 'url', '--jq', '.[0].url', '--state', 'open', '--limit', '1'], {
255
256
  cwd: tempDir,
256
257
  encoding: 'utf-8',
257
258
  });
259
+ let prResult;
260
+ if (existingPr.status === 0 && existingPr.stdout.trim()) {
261
+ // PR exists — force push already updated it, just edit title/body
262
+ prResult = spawnSync('gh', ['pr', 'edit', '--repo', REGISTRY_REPO, existingPr.stdout.trim(), '--title', prTitle, '--body', prBody], {
263
+ cwd: tempDir,
264
+ encoding: 'utf-8',
265
+ });
266
+ prResult.stdout = existingPr.stdout;
267
+ }
268
+ else {
269
+ // Create new PR
270
+ prResult = spawnSync('gh', ['pr', 'create', '--repo', REGISTRY_REPO, '--head', `${username}:${branchName}`, '--title', prTitle, '--body', prBody], {
271
+ cwd: tempDir,
272
+ encoding: 'utf-8',
273
+ });
274
+ }
258
275
  if (prResult.status !== 0) {
259
276
  throw new Error(prResult.stderr || 'Failed to create PR');
260
277
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillsets",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "CLI tool for discovering and installing verified skillsets",
5
5
  "type": "module",
6
6
  "bin": {