netxops/scripts/gen-preset-patch.mjs
oliver 6bf5268dfb Fix Desktop Netx Ops preset using host standard and workflow-ptc.
Prefer Desktop's standard.patch.yml / align CLI worker-thread rows to
workflow-ptc, and refuse compositions the host cannot resolve.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-10 04:53:11 +08:00

36 lines
1.6 KiB
JavaScript

/**
* Regenerate declarative + bundle artifacts from host `standard`.
*
* - `presets/netxops.preset.patch.yml` — Desktop 0.2 `@deepseek-ai/dsh-agent-preset`
* insert (also synced into profiles/desktop/cordis.patch.yml at Host apply).
* - `cordis.bundle.patch.yml` — host-only (web-safe). Desktop gets the
* declarative row via the profile patch sync, not the package bundle, so
* `dsh web` does not require `@deepseek-ai/dsh-agent-preset`.
*
* Usage: bun run scripts/gen-preset-patch.mjs
*/
import { writeFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { composeNetxopsPresetArtifacts } from '../src/agent-preset-install.ts'
import { readFileSync } from 'node:fs'
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
const artifacts = composeNetxopsPresetArtifacts()
const declarativePath = join(root, 'presets', 'netxops.preset.patch.yml')
writeFileSync(declarativePath, artifacts.declarativePatch)
console.log(
`wrote ${declarativePath} (${artifacts.declarativePatch.length} bytes) `
+ `from ${artifacts.standardKind}: ${artifacts.standardSource}`,
)
const host = readFileSync(join(root, 'cordis.patch.yml'), 'utf8')
const bundle = `# Host-only bundle patch (web-safe).
# Desktop Netx Ops preset is composed from standard and synced into
# profiles/desktop/cordis.patch.yml at Host apply — see src/agent-preset-install.ts.
${host.trimStart()}`
const bundlePath = join(root, 'cordis.bundle.patch.yml')
writeFileSync(bundlePath, bundle)
console.log(`wrote ${bundlePath} (${bundle.length} bytes) — host only`)