skillsets 0.4.6 → 0.4.7

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.
@@ -204,13 +204,25 @@ export async function submit() {
204
204
  if (pushResult.status !== 0) {
205
205
  throw new Error(pushResult.stderr || 'Failed to push to fork');
206
206
  }
207
- // Create PR
208
- spinner.text = 'Creating pull request...';
209
- const prTitle = isUpdate
210
- ? `Update ${skillsetId} to v${skillset.version}`
211
- : `Add ${skillsetId}`;
212
- const prBody = isUpdate
213
- ? `## Skillset Update
207
+ // Check if PR already exists for this branch (force push already updated it)
208
+ spinner.text = 'Checking for existing pull request...';
209
+ const existingPr = spawnSync('gh', ['pr', 'list', '--repo', REGISTRY_REPO, '--head', `${username}:${branchName}`, '--json', 'url', '--jq', '.[0].url', '--state', 'open', '--limit', '1'], {
210
+ cwd: tempDir,
211
+ encoding: 'utf-8',
212
+ });
213
+ let prUrl;
214
+ if (existingPr.status === 0 && existingPr.stdout.trim()) {
215
+ // PR exists — force push already updated the branch, nothing else to do
216
+ prUrl = existingPr.stdout.trim();
217
+ }
218
+ else {
219
+ // Create new PR
220
+ spinner.text = 'Creating pull request...';
221
+ const prTitle = isUpdate
222
+ ? `Update ${skillsetId} to v${skillset.version}`
223
+ : `Add ${skillsetId}`;
224
+ const prBody = isUpdate
225
+ ? `## Skillset Update
214
226
 
215
227
  **Skillset:** ${skillsetId}
216
228
  **Version:** ${existingVersion} → ${skillset.version}
@@ -230,7 +242,7 @@ _Describe what changed in this version._
230
242
  ---
231
243
  Submitted via \`npx skillsets submit\`
232
244
  `
233
- : `## New Skillset Submission
245
+ : `## New Skillset Submission
234
246
 
235
247
  **Skillset:** ${skillsetId}
236
248
  **Version:** ${skillset.version}
@@ -251,36 +263,20 @@ _Add any additional context for reviewers here._
251
263
  ---
252
264
  Submitted via \`npx skillsets submit\`
253
265
  `;
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'], {
256
- cwd: tempDir,
257
- encoding: 'utf-8',
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], {
266
+ const prResult = spawnSync('gh', ['pr', 'create', '--repo', REGISTRY_REPO, '--head', `${username}:${branchName}`, '--title', prTitle, '--body', prBody], {
263
267
  cwd: tempDir,
264
268
  encoding: 'utf-8',
265
269
  });
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
- }
275
- if (prResult.status !== 0) {
276
- throw new Error(prResult.stderr || 'Failed to create PR');
270
+ if (prResult.status !== 0) {
271
+ throw new Error(prResult.stderr || 'Failed to create PR');
272
+ }
273
+ prUrl = (prResult.stdout || '').trim();
277
274
  }
278
275
  // Cleanup
279
276
  spinner.text = 'Cleaning up...';
280
277
  rmSync(tempDir, { recursive: true, force: true });
281
- spinner.succeed('Pull request created');
282
- // Extract PR URL from result
283
- const prUrl = (prResult.stdout || '').trim();
278
+ const prExisted = existingPr.status === 0 && existingPr.stdout.trim();
279
+ spinner.succeed(prExisted ? 'Pull request updated' : 'Pull request created');
284
280
  console.log(chalk.green(`\n✓ ${isUpdate ? 'Update' : 'Submission'} complete!\n`));
285
281
  console.log(` Skillset: ${chalk.bold(skillsetId)}`);
286
282
  if (isUpdate) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillsets",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "CLI tool for discovering and installing verified skillsets",
5
5
  "type": "module",
6
6
  "bin": {