netxops/scripts/gen-preset-patch.mjs
oliver 2d86f55bf9 Compose Netx Ops preset from host standard instead of embedding it.
Drop the declarative @deepseek-ai/dsh-agent-preset patch (and the huge flat standard copy) so web/CLI boot no longer needs that package; install copies shipped standard then overlays persona/tools/skills.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-09 23:35:52 +08:00

32 lines
1.3 KiB
JavaScript

/**
* Legacy entrypoint kept for `bun run gen:preset-patch`.
*
* Declarative `@deepseek-ai/dsh-agent-preset` patches were removed: Netx Ops
* now composes `$DSH_HOME/.agent-presets/netxops` from the host `standard`
* preset at apply time (see src/agent-preset-install.ts).
*
* Regenerates `cordis.bundle.patch.yml` as a copy of `cordis.patch.yml` so
* `dsh.bundle.patch` stays a single string path for CLI compatibility.
*/
import { readFileSync, writeFileSync, unlinkSync, existsSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
const root = join(dirname(fileURLToPath(import.meta.url)), '..')
const host = join(root, 'cordis.patch.yml')
const bundle = join(root, 'cordis.bundle.patch.yml')
const legacyDeclarative = join(root, 'presets', 'netxops.preset.patch.yml')
const text = readFileSync(host, 'utf8')
const out = `# Alias of cordis.patch.yml for dsh.bundle.patch (single string).
# Agent preset is composed from host \`standard\` at install — see
# src/agent-preset-install.ts (no @deepseek-ai/dsh-agent-preset row).
${text.trimStart()}`
writeFileSync(bundle, out)
if (existsSync(legacyDeclarative)) {
unlinkSync(legacyDeclarative)
console.log(`removed obsolete ${legacyDeclarative}`)
}
console.log(`wrote ${bundle} (${out.length} bytes) — host-only; no declarative preset patch`)