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:
@@ -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
|
||||
|
||||
@@ -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}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -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}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -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> = {
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user