Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | 4x 4x 4x 4x 9x 55x 9x 9x 55x 55x 6x 9x 14x 14x 1x 8x 1x 4x 4x 4x 4x 4x 3x 4x 4x 41x 4x 11x 4x 5x | type HelpOptionId =
| 'cwd'
| 'help'
| 'version'
| 'skill'
| 'config'
| 'model'
| 'json'
| 'output'
| 'failOn'
| 'reportOn'
| 'minConfidence'
| 'fix'
| 'parallel'
| 'failFast'
| 'staged'
| 'git'
| 'offline'
| 'quiet'
| 'verbose'
| 'debug'
| 'log'
| 'color'
| 'force'
| 'list'
| 'remote'
| 'regenerate'
| 'prompt'
| 'org'
| 'port'
| 'timeout'
| 'name'
| 'noOpen'
| 'follow'
| 'all';
export type HelpTarget =
| 'run'
| 'init'
| 'add'
| 'sync'
| 'build'
| 'improve'
| 'setup-app'
| 'runs'
| 'runs:list'
| 'runs:show'
| 'runs:follow'
| 'runs:gc';
interface HelpOptionSpec {
label: string;
description: string;
continuation?: string;
}
interface HelpArgumentSpec {
label: string;
description: string;
}
interface HelpCommandSpec {
summary: string;
description: string;
usage: string[];
aliases?: string[];
arguments?: HelpArgumentSpec[];
options?: HelpOptionId[];
examples?: string[];
subcommands?: { label: string; summary: string }[];
}
const HELP_OPTIONS: Record<HelpOptionId, HelpOptionSpec> = {
cwd: {
label: '-C, --cwd <path>',
description: 'Run as if invoked from this directory',
},
help: {
label: '-h, --help',
description: 'Show help for this command',
},
version: {
label: '-V, --version',
description: 'Show version number',
},
skill: {
label: '--skill <name|path>',
description: 'Run only this skill by name or path; names fall back to built-ins',
},
config: {
label: '--config <path>',
description: 'Path to warden.toml',
},
model: {
label: '-m, --model <model>',
description: 'Model fallback when config does not specify one',
},
json: {
label: '--json',
description: 'Output results as JSON',
},
output: {
label: '-o, --output <path>',
description: 'Write full run output to a JSONL file',
},
failOn: {
label: '--fail-on <severity>',
description: 'Exit with code 1 if findings meet this severity',
},
reportOn: {
label: '--report-on <severity>',
description: 'Only show findings at or above this severity',
},
minConfidence: {
label: '--min-confidence <level>',
description: 'Only show findings at or above this confidence',
},
fix: {
label: '--fix',
description: 'Automatically apply all suggested fixes',
},
parallel: {
label: '--parallel <n>',
description: 'Max concurrent file analyses across running skills',
},
failFast: {
label: '-x, --fail-fast',
description: 'Stop after the first finding',
},
staged: {
label: '--staged',
description: 'Analyze only staged changes',
},
git: {
label: '--git',
description: 'Force ambiguous targets to be treated as git refs',
},
offline: {
label: '--offline',
description: 'Use cached remote skills without network access',
},
quiet: {
label: '--quiet',
description: 'Errors and final summary only',
},
verbose: {
label: '-v, --verbose',
description: 'Increase verbosity',
continuation: 'Repeat as -vv or combine with --debug for more detail',
},
debug: {
label: '--debug',
description: 'Enable debug output',
},
log: {
label: '--log',
description: 'Use log output mode',
},
color: {
label: '--color / --no-color',
description: 'Override color detection',
},
force: {
label: '-f, --force',
description: 'Overwrite existing files or bypass caches',
},
list: {
label: '--list',
description: 'List available skills',
},
remote: {
label: '--remote <ref>',
description: 'Remote repository reference',
},
regenerate: {
label: '--regenerate',
description: 'Ignore cached generated skill artifacts and build again',
},
prompt: {
label: '-p, --prompt <value>',
description: 'Generated skill prompt or improvement brief',
continuation: 'Prefix with @ to read the prompt from a file',
},
org: {
label: '--org <name>',
description: 'Create under an organization instead of a personal account',
},
port: {
label: '--port <number>',
description: 'Local server port',
},
timeout: {
label: '--timeout <seconds>',
description: 'Callback timeout in seconds',
},
name: {
label: '--name <string>',
description: 'Custom GitHub App name',
},
noOpen: {
label: '--no-open',
description: 'Print the URL instead of opening a browser',
},
follow: {
label: '--follow',
description: 'Follow a run instead of showing it once',
},
all: {
label: '--all',
description: 'Include zero-file sessions in runs list output',
},
};
const SHARED_COMMAND_OPTIONS: HelpOptionId[] = [
'quiet',
'verbose',
'debug',
'log',
'color',
'help',
];
const HELP_COMMANDS: Record<HelpTarget, HelpCommandSpec> = {
run: {
summary: 'Analyze files, git refs, or current branch changes',
description: 'Run Warden analysis against explicit targets or the current branch by default.',
usage: [
'warden [targets...] [options]',
'warden run [targets...] [options]',
],
arguments: [
{ label: 'targets...', description: 'Files, globs, git refs, or @files containing target lists' },
],
options: [
'cwd',
'skill',
'config',
'model',
'json',
'output',
'failOn',
'reportOn',
'minConfidence',
'fix',
'parallel',
'failFast',
'staged',
'git',
'offline',
...SHARED_COMMAND_OPTIONS,
],
examples: [
'warden src/auth.ts',
'warden @targets.txt --skill security-review',
'warden "src/**/*.ts" --skill security-review',
'warden HEAD~3',
'warden --staged --fix',
],
},
init: {
summary: 'Initialize Warden configuration',
description: 'Create a starter warden.toml and GitHub workflow in the current repository.',
usage: ['warden init [options]'],
options: ['cwd', 'force', ...SHARED_COMMAND_OPTIONS],
examples: [
'warden init',
'warden init --force',
],
},
add: {
summary: 'Add a skill trigger to warden.toml',
description: 'Add a skill trigger to the repository configuration.',
usage: ['warden add [skill] [options]'],
arguments: [
{ label: 'skill', description: 'Skill name to add' },
],
options: ['cwd', 'list', 'remote', 'force', ...SHARED_COMMAND_OPTIONS],
examples: [
'warden add',
'warden add security-review',
'warden add code-review',
'warden add --remote your-org/warden-skills --skill api-review',
],
},
sync: {
summary: 'Update cached remote skills',
description: 'Refresh cached remote skill repositories to their latest revision.',
usage: ['warden sync [remote] [options]'],
arguments: [
{ label: 'remote', description: 'Remote repository reference to sync' },
],
options: ['cwd', 'remote', ...SHARED_COMMAND_OPTIONS],
examples: [
'warden sync',
'warden sync getsentry/skills',
],
},
build: {
summary: 'Build a repo-local generated skill',
description: 'Create or refresh one generated skill. A name resolves through .warden/skills, .agents/skills, then .claude/skills; use a path for other roots.',
usage: [
'warden build <skill> [options]',
],
arguments: [
{ label: 'skill', description: 'Generated skill name or skill root path' },
],
options: [
'cwd',
'config',
'model',
'json',
'regenerate',
'prompt',
...SHARED_COMMAND_OPTIONS,
],
examples: [
'warden build security --regenerate',
'warden build security -p @prompt.md',
'warden build ./skills/security -p @prompt.md',
'warden build sentry-security --json',
],
},
improve: {
summary: 'Improve a repo-local generated skill',
description: 'Revise an existing generated skill from an improvement brief using the generated-skill reviewer loop.',
usage: [
'warden improve <skill> [options]',
],
arguments: [
{ label: 'skill', description: 'Generated skill name or skill root path' },
],
options: [
'cwd',
'config',
'model',
'json',
'prompt',
...SHARED_COMMAND_OPTIONS,
],
examples: [
'warden improve security -p "Deepen source provenance and reference routing"',
'warden improve security -p @feedback.md',
'warden improve ./skills/security -p @feedback.md',
],
},
'setup-app': {
summary: 'Create a GitHub App via manifest flow',
description: 'Walk through the GitHub App manifest flow and print the credentials to install.',
usage: ['warden setup-app [options]'],
options: ['cwd', 'org', 'port', 'timeout', 'name', 'noOpen', ...SHARED_COMMAND_OPTIONS],
examples: [
'warden setup-app',
'warden setup-app --org my-org --port 8080',
],
},
runs: {
summary: 'Inspect saved sessions and run logs',
description: 'Browse, show, follow, and clean up saved Warden run logs.',
usage: [
'warden runs [list] [options]',
'warden runs show <files...> [options]',
'warden runs follow [run] [options]',
'warden runs gc [options]',
],
options: ['cwd', 'follow', 'all', 'json', ...SHARED_COMMAND_OPTIONS],
subcommands: [
{ label: 'list', summary: 'List saved runs' },
{ label: 'show <files...>', summary: 'Show results from saved logs or run IDs' },
{ label: 'follow [run]', summary: 'Tail a live or completed session' },
{ label: 'gc', summary: 'Remove expired session logs' },
],
examples: [
'warden runs',
'warden runs show deadbeef',
'warden runs follow',
],
},
'runs:list': {
summary: 'List saved runs',
description: 'List saved run logs in reverse chronological order.',
usage: ['warden runs [list] [options]'],
options: ['cwd', 'all', 'json', ...SHARED_COMMAND_OPTIONS],
examples: [
'warden runs',
'warden runs list --all',
],
},
'runs:show': {
summary: 'Show results from saved logs or run IDs',
description: 'Render findings from one or more saved JSONL logs or short run IDs.',
usage: ['warden runs show <files...> [options]'],
arguments: [
{ label: 'files...', description: 'JSONL paths or short run IDs' },
],
options: ['cwd', 'json', 'reportOn', 'minConfidence', ...SHARED_COMMAND_OPTIONS],
examples: [
'warden runs show deadbeef',
'warden runs show .warden/logs/a1b2c3d4-2026-04-25T13-00-00-000Z.jsonl',
],
},
'runs:follow': {
summary: 'Tail a live or completed session',
description: 'Follow a session as skill records arrive, or replay the latest completed run.',
usage: [
'warden runs follow [run] [options]',
'warden runs --follow [run] [options]',
],
arguments: [
{ label: 'run', description: 'Optional short run ID or JSONL path' },
],
options: ['cwd', 'json', ...SHARED_COMMAND_OPTIONS],
examples: [
'warden runs follow',
'warden runs --follow deadbeef',
],
},
'runs:gc': {
summary: 'Remove expired session logs',
description: 'Delete saved run logs that are older than the configured retention window.',
usage: ['warden runs gc [options]'],
options: ['cwd', 'json', ...SHARED_COMMAND_OPTIONS],
examples: [
'warden runs gc',
],
},
};
const ROOT_COMMANDS: { label: string; summary: string }[] = [
{ label: 'run [targets...]', summary: 'Analyze files, git refs, or current branch changes' },
{ label: 'init', summary: 'Initialize Warden configuration' },
{ label: 'add [skill]', summary: 'Add a skill trigger to warden.toml' },
{ label: 'sync [remote]', summary: 'Update cached remote skills to latest' },
{ label: 'build <skill>', summary: 'Build a repo-local generated skill' },
{ label: 'runs', summary: 'Inspect saved sessions and run logs' },
{ label: 'setup-app', summary: 'Create a GitHub App via manifest flow' },
{ label: 'help [command]', summary: 'Show help for a command' },
];
function renderTable(
items: { label: string; description: string; continuation?: string }[],
): string[] {
Iif (items.length === 0) return [];
const width = Math.max(...items.map((item) => item.label.length));
const lines: string[] = [];
for (const item of items) {
lines.push(` ${item.label.padEnd(width)} ${item.description}`);
if (item.continuation) {
lines.push(` ${' '.repeat(width)} ${item.continuation}`);
}
}
return lines;
}
function renderSection(title: string, lines: string[]): string[] {
Iif (lines.length === 0) return [];
return [title, ...lines, ''];
}
function renderRootHelp(): string {
const lines: string[] = [
'Usage:',
' warden [targets...] [options]',
' warden <command> [options]',
'',
'Warden watches over your code.',
'',
...renderSection('Commands:', renderTable(ROOT_COMMANDS.map((command) => ({
label: command.label,
description: command.summary,
})))),
...renderSection('Global Options:', renderTable([
{ label: HELP_OPTIONS.cwd.label, description: HELP_OPTIONS.cwd.description },
{ label: HELP_OPTIONS.help.label, description: HELP_OPTIONS.help.description },
{ label: HELP_OPTIONS.version.label, description: HELP_OPTIONS.version.description },
])),
...renderSection('Examples:', [
' warden src/auth.ts',
' warden HEAD~3 --skill security-review',
' warden build security --regenerate',
' warden help runs show',
]),
];
return lines.join('\n').trimEnd();
}
function renderCommandHelp(target: HelpTarget): string {
const spec = HELP_COMMANDS[target];
const lines: string[] = [
'Usage:',
...spec.usage.map((usage) => ` ${usage}`),
'',
spec.description,
'',
];
Iif (spec.aliases && spec.aliases.length > 0) {
lines.push(`Aliases: ${spec.aliases.join(', ')}`);
lines.push('');
}
if (spec.arguments && spec.arguments.length > 0) {
lines.push(...renderSection('Arguments:', renderTable(spec.arguments.map((argument) => ({
label: argument.label,
description: argument.description,
})))));
}
Iif (spec.subcommands && spec.subcommands.length > 0) {
lines.push(...renderSection('Subcommands:', renderTable(spec.subcommands.map((command) => ({
label: command.label,
description: command.summary,
})))));
}
Eif (spec.options && spec.options.length > 0) {
lines.push(...renderSection('Options:', renderTable(spec.options.map((option) => ({
label: HELP_OPTIONS[option].label,
description: HELP_OPTIONS[option].description,
continuation: HELP_OPTIONS[option].continuation,
})))));
}
Eif (spec.examples && spec.examples.length > 0) {
lines.push(...renderSection('Examples:', spec.examples.map((example) => ` ${example}`)));
}
return lines.join('\n').trimEnd();
}
export function renderHelp(target?: HelpTarget): string {
return target ? renderCommandHelp(target) : renderRootHelp();
}
export function showHelp(target?: HelpTarget): void {
console.log(renderHelp(target));
}
|