netxops/scripts/gen-preset-patch.mjs
oliver 7a289cf409 Restore Desktop Netx Ops preset via dual-path install.
Compose from host standard for web directories and sync a correctly indented declarative insert into the desktop profile patch (0.1.48).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-10 00:12:31 +08:00

33 lines
1.5 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.standardDir}`)
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`)