mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-05 15:09:42 +02:00
Review fixes on top of the `codeman doctor` checker: - Node minVersion 18.0.0 -> 22.0.0. package.json engines is ">=22.0.0" and the docs/CI require Node 22+, so doctor was green-lighting Node 18-21 (a false pass). - Remove the phantom `gemini` registry entry. Codeman has no Gemini backend (SessionMode = 'claude' | 'shell' | 'opencode' | 'codex'); the entry advertised a dependency that nothing uses. - Add `pdftoppm` (poppler) to the office group. document-thumbnailer.ts calls pdftoppm with no fallback as the sole PDF/Office first-page thumbnail renderer, yet it was absent from the registry, so doctor never reported it missing. - Fix the `--category` mismatch: the help advertised `documents|media` categories that the ToolCategory type/registry never defined, and an unknown category silently produced an empty "all healthy" table. Introduce TOOL_CATEGORIES as the single source of truth (type + help + validation); an invalid `--category` now errors with the valid list and exits 2. Verified: tsc, lint, format:check all clean; both dependency tests pass (20); `doctor` runs correctly (Node 22.22 ok, pdftoppm detected, no gemini), `--category media` errors with exit 2, `--category office` lists libreoffice/pdftoppm/msoffice. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
141 lines
4.4 KiB
TypeScript
141 lines
4.4 KiB
TypeScript
/**
|
|
* @fileoverview Static registry of downstream tool dependencies probed by
|
|
* `codeman doctor`. Each entry declares per-environment resolvers and the
|
|
* skills that use it. EXTENSION POINT: skill-manifest-driven discovery
|
|
* (COD follow-up) will merge dynamically-found entries into this list.
|
|
*
|
|
* @module config/dependency-registry
|
|
*/
|
|
|
|
export type ProbeEnvironment = 'linux' | 'darwin' | 'win32' | 'wsl';
|
|
|
|
/** The valid `--category` filter values; single source of truth for the type, the CLI
|
|
* help text, and CLI input validation. */
|
|
export const TOOL_CATEGORIES = ['core', 'office', 'other'] as const;
|
|
export type ToolCategory = (typeof TOOL_CATEGORIES)[number];
|
|
|
|
/** Resolve a binary on the PATH and read its version. */
|
|
export interface PathResolver {
|
|
kind: 'path';
|
|
bins: string[];
|
|
versionArg?: string; // default '--version'
|
|
versionRegex?: RegExp; // default matches first \d+.\d+(.\d+)?
|
|
}
|
|
|
|
/** Resolve a Windows-installed app reachable from win32 or WSL. */
|
|
export interface WindowsSideResolver {
|
|
kind: 'windows-side';
|
|
appDirs: string[]; // relative to a Program Files root
|
|
exes: string[]; // candidate executables; first found wins
|
|
}
|
|
|
|
export interface ResolverSpec {
|
|
match: ProbeEnvironment[];
|
|
resolver: PathResolver | WindowsSideResolver;
|
|
}
|
|
|
|
export interface ToolDependency {
|
|
id: string;
|
|
label: string;
|
|
category: ToolCategory;
|
|
required: boolean;
|
|
usedBy?: string[];
|
|
minVersion?: string;
|
|
resolvers: ResolverSpec[];
|
|
installHint?: Partial<Record<ProbeEnvironment, string>>;
|
|
}
|
|
|
|
const ALL: ProbeEnvironment[] = ['linux', 'darwin', 'wsl', 'win32'];
|
|
|
|
export const DEPENDENCY_REGISTRY: ToolDependency[] = [
|
|
{
|
|
id: 'node',
|
|
label: 'Node.js',
|
|
category: 'core',
|
|
required: true,
|
|
minVersion: '22.0.0',
|
|
resolvers: [{ match: ALL, resolver: { kind: 'path', bins: ['node'], versionArg: '--version' } }],
|
|
installHint: { linux: 'https://nodejs.org', darwin: 'brew install node', wsl: 'https://nodejs.org' },
|
|
},
|
|
{
|
|
id: 'claude',
|
|
label: 'Claude CLI',
|
|
category: 'core',
|
|
required: false,
|
|
usedBy: ['Claude Code sessions (default backend)'],
|
|
resolvers: [{ match: ALL, resolver: { kind: 'path', bins: ['claude'], versionArg: '--version' } }],
|
|
installHint: { linux: 'https://docs.claude.com/claude-code', darwin: 'https://docs.claude.com/claude-code' },
|
|
},
|
|
{
|
|
id: 'tmux',
|
|
label: 'tmux',
|
|
category: 'core',
|
|
required: true,
|
|
resolvers: [{ match: ['linux', 'darwin', 'wsl'], resolver: { kind: 'path', bins: ['tmux'], versionArg: '-V' } }],
|
|
installHint: { linux: 'sudo apt install tmux', darwin: 'brew install tmux', wsl: 'sudo apt install tmux' },
|
|
},
|
|
{
|
|
id: 'opencode',
|
|
label: 'OpenCode CLI',
|
|
category: 'core',
|
|
required: false,
|
|
usedBy: ['OpenCode sessions'],
|
|
resolvers: [{ match: ALL, resolver: { kind: 'path', bins: ['opencode'], versionArg: '--version' } }],
|
|
},
|
|
{
|
|
id: 'codex',
|
|
label: 'Codex CLI',
|
|
category: 'core',
|
|
required: false,
|
|
usedBy: ['Codex sessions'],
|
|
resolvers: [{ match: ALL, resolver: { kind: 'path', bins: ['codex'], versionArg: '--version' } }],
|
|
},
|
|
{
|
|
id: 'libreoffice',
|
|
label: 'LibreOffice',
|
|
category: 'office',
|
|
required: false,
|
|
usedBy: ['document preview', 'thumbnails'],
|
|
resolvers: [
|
|
{
|
|
match: ['linux', 'darwin', 'wsl'],
|
|
resolver: { kind: 'path', bins: ['libreoffice', 'soffice'], versionArg: '--version' },
|
|
},
|
|
],
|
|
installHint: { linux: 'sudo apt install libreoffice', darwin: 'brew install --cask libreoffice' },
|
|
},
|
|
{
|
|
id: 'pdftoppm',
|
|
label: 'pdftoppm',
|
|
category: 'office',
|
|
required: false,
|
|
usedBy: ['document preview', 'PDF/Office first-page thumbnails'],
|
|
// poppler's pdftoppm prints its version to stderr; presence is what matters here.
|
|
resolvers: [
|
|
{ match: ['linux', 'darwin', 'wsl'], resolver: { kind: 'path', bins: ['pdftoppm'], versionArg: '-v' } },
|
|
],
|
|
installHint: {
|
|
linux: 'sudo apt install poppler-utils',
|
|
darwin: 'brew install poppler',
|
|
wsl: 'sudo apt install poppler-utils',
|
|
},
|
|
},
|
|
{
|
|
id: 'msoffice',
|
|
label: 'MS Office',
|
|
category: 'office',
|
|
required: false,
|
|
usedBy: ['document preview', 'thumbnails'],
|
|
resolvers: [
|
|
{
|
|
match: ['wsl', 'win32'],
|
|
resolver: {
|
|
kind: 'windows-side',
|
|
appDirs: ['Microsoft Office/root/Office16'],
|
|
exes: ['WINWORD.EXE', 'POWERPNT.EXE', 'EXCEL.EXE'],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
];
|