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

@@ -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")