/** * Human-facing `dsh-harness-check` command for DeepSeek Harness. * * Re-runs the bundle contract self-check on demand and prints one line per * feature. Mirrors `command-role.js`: the same object-form * `commands.register`, the same `{ kind, text }` result shape. */ export function registerCheckCommand({ commands, collect, logger }) { commands.register({ name: 'dsh-harness-check', description: 'Проверить контракт DSH, на который опирается dsh-harness', handler: async () => { let report try { report = collect() } catch (error) { logger?.warn?.('[dsh-harness] dsh-harness-check failed: %s', error?.message ?? error) return { kind: 'error', text: String(error?.message ?? error) } } const problems = report.filter((entry) => !entry.ok) const lines = report.map((entry) => entry.ok ? `${entry.feature}: ok` : `${entry.feature}: not-ok — ${entry.detail}`, ) const headline = problems.length === 0 ? 'dsh-harness self-check: all ok' : `dsh-harness self-check: ${problems.length} problem(s)` return { kind: 'success', text: [headline, ...lines].join('\n') } }, }) }