refactor: reduce complexity in cmdHelp and cmdAgentInfo functions (#1157)

Extract cmdHelp's 76-line help message into 6 modular helper functions
(getHelpUsageSection, getHelpExamplesSection, getHelpAuthSection,
getHelpInstallSection, getHelpTroubleshootingSection, getHelpEnvVarsSection,
getHelpFooterSection) to improve maintainability and allow reuse.

Extract cmdAgentInfo's cloud listing logic into printAgentCloudsList helper
to reduce the function's cognitive load and separate display concerns.

Both refactorings maintain identical user-facing behavior while reducing
code duplication and improving testability.

Agent: complexity-hunter

Co-authored-by: spawn-refactor-bot <refactor@openrouter.ai>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-02-14 17:45:44 -08:00 committed by GitHub
parent 4f7f840f53
commit a653549e83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 168 additions and 44 deletions

84
cli/package-lock.json generated Normal file
View file

@ -0,0 +1,84 @@
{
"name": "@openrouter/spawn",
"version": "0.2.82",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@openrouter/spawn",
"version": "0.2.82",
"dependencies": {
"@clack/prompts": "^1.0.0",
"picocolors": "^1.1.1"
},
"bin": {
"spawn": "cli.js"
},
"devDependencies": {
"@types/bun": "^1.3.8"
}
},
"node_modules/@clack/core": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@clack/core/-/core-1.0.1.tgz",
"integrity": "sha512-WKeyK3NOBwDOzagPR5H08rFk9D/WuN705yEbuZvKqlkmoLM2woKtXb10OO2k1NoSU4SFG947i2/SCYh+2u5e4g==",
"dependencies": {
"picocolors": "^1.0.0",
"sisteransi": "^1.0.5"
}
},
"node_modules/@clack/prompts": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@clack/prompts/-/prompts-1.0.1.tgz",
"integrity": "sha512-/42G73JkuYdyWZ6m8d/CJtBrGl1Hegyc7Fy78m5Ob+jF85TOUmLR5XLce/U3LxYAw0kJ8CT5aI99RIvPHcGp/Q==",
"dependencies": {
"@clack/core": "1.0.1",
"picocolors": "^1.0.0",
"sisteransi": "^1.0.5"
}
},
"node_modules/@types/bun": {
"version": "1.3.9",
"resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.3.9.tgz",
"integrity": "sha512-KQ571yULOdWJiMH+RIWIOZ7B2RXQGpL1YQrBtLIV3FqDcCu6FsbFUBwhdKUlCKUpS3PJDsHlJ1QKlpxoVR+xtw==",
"dev": true,
"dependencies": {
"bun-types": "1.3.9"
}
},
"node_modules/@types/node": {
"version": "25.2.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.3.tgz",
"integrity": "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ==",
"dev": true,
"dependencies": {
"undici-types": "~7.16.0"
}
},
"node_modules/bun-types": {
"version": "1.3.9",
"resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.3.9.tgz",
"integrity": "sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="
},
"node_modules/sisteransi": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
"integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg=="
},
"node_modules/undici-types": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
"dev": true
}
}
}