fix: pass scope to writeWindsurfBundle and fix skill name casing

- Fix resolve-pr-parallel SKILL.md name from underscores to hyphens
  (must match directory name per Windsurf spec)
- Add scope parameter to TargetHandler.write signature
- Pass resolvedScope through to writer in convert.ts and install.ts
- Windsurf writer uses global_workflows/ for global scope, workflows/
  for workspace scope

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Ryan Burnham
2026-02-26 20:29:40 +08:00
parent 6fe51a0602
commit e081e32a30
5 changed files with 11 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
---
name: resolve_pr_parallel
name: resolve-pr-parallel
description: Resolve all PR comments using parallel processing. Use when addressing PR review feedback, resolving review threads, or batch-fixing PR comments.
argument-hint: "[optional: PR number or current PR]"
disable-model-invocation: true

View File

@@ -108,7 +108,7 @@ export default defineCommand({
throw new Error(`Target ${targetName} did not return a bundle.`)
}
await target.write(primaryOutputRoot, bundle)
await target.write(primaryOutputRoot, bundle, resolvedScope)
console.log(`Converted ${plugin.manifest.name} to ${targetName} at ${primaryOutputRoot}`)
const extraTargets = parseExtraTargets(args.also)
@@ -136,7 +136,7 @@ export default defineCommand({
hasExplicitOutput,
scope: handler.defaultScope,
})
await handler.write(extraRoot, extraBundle)
await handler.write(extraRoot, extraBundle, handler.defaultScope)
console.log(`Converted ${plugin.manifest.name} to ${extra} at ${extraRoot}`)
}

View File

@@ -111,7 +111,7 @@ export default defineCommand({
hasExplicitOutput,
scope: resolvedScope,
})
await target.write(primaryOutputRoot, bundle)
await target.write(primaryOutputRoot, bundle, resolvedScope)
console.log(`Installed ${plugin.manifest.name} to ${primaryOutputRoot}`)
const extraTargets = parseExtraTargets(args.also)
@@ -139,7 +139,7 @@ export default defineCommand({
hasExplicitOutput,
scope: handler.defaultScope,
})
await handler.write(extraRoot, extraBundle)
await handler.write(extraRoot, extraBundle, handler.defaultScope)
console.log(`Installed ${plugin.manifest.name} to ${extraRoot}`)
}

View File

@@ -58,7 +58,7 @@ export type TargetHandler<TBundle = unknown> = {
/** Valid scope values. If absent, the --scope flag is rejected for this target. */
supportedScopes?: TargetScope[]
convert: (plugin: ClaudePlugin, options: ClaudeToOpenCodeOptions) => TBundle | null
write: (outputRoot: string, bundle: TBundle) => Promise<void>
write: (outputRoot: string, bundle: TBundle, scope?: TargetScope) => Promise<void>
}
export const targets: Record<string, TargetHandler> = {

View File

@@ -2,6 +2,7 @@ import path from "path"
import { backupFile, copyDir, ensureDir, pathExists, readJson, writeJsonSecure, writeText } from "../utils/files"
import { formatFrontmatter } from "../utils/frontmatter"
import type { WindsurfBundle } from "../types/windsurf"
import type { TargetScope } from "./index"
/**
* Write a WindsurfBundle directly into outputRoot.
@@ -9,7 +10,7 @@ import type { WindsurfBundle } from "../types/windsurf"
* Unlike other target writers, this writer expects outputRoot to be the final
* resolved directory — the CLI handles scope-based nesting (global vs workspace).
*/
export async function writeWindsurfBundle(outputRoot: string, bundle: WindsurfBundle): Promise<void> {
export async function writeWindsurfBundle(outputRoot: string, bundle: WindsurfBundle, scope?: TargetScope): Promise<void> {
await ensureDir(outputRoot)
// Write agent skills (before pass-through copies so pass-through takes precedence on collision)
@@ -31,9 +32,10 @@ export async function writeWindsurfBundle(outputRoot: string, bundle: WindsurfBu
}
}
// Write command workflows (flat in workflows/, per spec)
// Write command workflows (flat in global_workflows/ for global scope, workflows/ for workspace)
if (bundle.commandWorkflows.length > 0) {
const workflowsDir = path.join(outputRoot, "workflows")
const workflowsDirName = scope === "global" ? "global_workflows" : "workflows"
const workflowsDir = path.join(outputRoot, workflowsDirName)
await ensureDir(workflowsDir)
for (const workflow of bundle.commandWorkflows) {
validatePathSafe(workflow.name, "command workflow")