Compatibility checks now yield the refused packages as data instead of a profile-specific sentence. runProfilePnpm returns them as PackageResult.incompatible, and the plugin manager refuses with the incompatible-version code carrying the same records. Each surface renders them: the CLI prints the exact allow-version command for its profile, the Web plugin manager words them through its locale dictionary, and app-boot keeps one neutral English diagnostic for logs and startup stderr.
30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
/** Localizable rejections shared by profile management operations. */
|
|
import type { PluginCompatibility } from '@deepseek-ai/dsh-app-boot'
|
|
import type { IncompatiblePlugin, ManagementError } from './types.ts'
|
|
|
|
/** Expected management rejection; presentation belongs to the caller's locale. */
|
|
export class ManagementFailure extends Error {
|
|
/** Code rendered by the caller's locale dictionary. */
|
|
readonly code: ManagementError['code']
|
|
/** The packages an `incompatible-version` rejection names. */
|
|
readonly incompatible: IncompatiblePlugin[] | undefined
|
|
/**
|
|
* @param code Localizable management rejection.
|
|
* @param incompatible Packages the running DSH version rejects, for `incompatible-version`.
|
|
*/
|
|
constructor(code: ManagementError['code'], incompatible?: IncompatiblePlugin[]) {
|
|
super(code)
|
|
this.code = code
|
|
this.incompatible = incompatible
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Drop the exemption status from an unexempted compatibility result.
|
|
* @param issue Result whose exemption is not active.
|
|
* @returns The package, runtime, and rejected peer ranges.
|
|
*/
|
|
export function incompatiblePlugin(issue: PluginCompatibility): IncompatiblePlugin {
|
|
return { name: issue.name, version: issue.version, runtimeVersion: issue.runtimeVersion, peers: issue.peers }
|
|
}
|