@@ -76,6 +76,37 @@ function commandExists(cmd) {
7676 }
7777}
7878
79+ function writeHermesConfig ( hermesHome , mode ) {
80+ const configPath = join ( hermesHome , 'cli-config.yaml' ) ;
81+ if ( existsSync ( configPath ) ) {
82+ log ( `cli-config.yaml already exists — skipping (delete it to regenerate)` ) ;
83+ return ;
84+ }
85+ const baseUrl =
86+ mode === 'docker'
87+ ? 'http://host.docker.internal:11434/v1'
88+ : 'http://localhost:11434/v1' ;
89+ const content = [
90+ '# Hermes Agent configuration — generated by scripts/setup-hermes.mjs' ,
91+ '# Edit this file to customise your LLM provider and model.' ,
92+ '# Full reference: https://github.com/NousResearch/hermes-agent/blob/main/cli-config.yaml.example' ,
93+ '' ,
94+ 'model:' ,
95+ ' # Default model (override with --model flag or HERMES_MODEL env var).' ,
96+ ' default: "qwen3.6:35b"' ,
97+ '' ,
98+ ' # "ollama" is an alias for "custom" — any OpenAI-compatible local endpoint.' ,
99+ ' # Other options: "openrouter", "anthropic", "openai", "gemini", etc.' ,
100+ ' provider: "ollama"' ,
101+ '' ,
102+ ` # Ollama OpenAI-compatible endpoint.` ,
103+ ` # Docker mode uses host.docker.internal so the container can reach the host.` ,
104+ ` base_url: "${ baseUrl } "` ,
105+ ] . join ( '\n' ) + '\n' ;
106+ writeFileSync ( configPath , content ) ;
107+ log ( `wrote ${ rel ( configPath ) } ` ) ;
108+ }
109+
79110function main ( ) {
80111 const args = parseArgs ( process . argv . slice ( 2 ) ) ;
81112 if ( args . help ) {
@@ -108,6 +139,7 @@ function main() {
108139 HERMES_BIN : bin ,
109140 HERMES_HOME : hermesHome ,
110141 } ) ;
142+ writeHermesConfig ( hermesHome , 'system' ) ;
111143 } else if ( args . mode === 'docker' ) {
112144 const image = args . image ?? 'hermes-agent:latest' ;
113145 if ( ! commandExists ( 'docker' ) ) {
@@ -131,6 +163,7 @@ function main() {
131163 DOCKER_AGENT_IMAGE : image ,
132164 HERMES_HOME : hermesHome ,
133165 } ) ;
166+ writeHermesConfig ( hermesHome , 'docker' ) ;
134167 } else {
135168 console . error ( `Unknown --mode "${ args . mode } ". Use "system" or "docker".` ) ;
136169 process . exit ( 1 ) ;
0 commit comments