@monoes/monomindcli 1.10.21 → 1.10.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "1.10.21",
3
+ "version": "1.10.23",
4
4
  "type": "module",
5
5
  "description": "Monomind CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
6
6
  "main": "dist/src/index.js",
@@ -153,12 +153,14 @@ const USE_CLAUDE_CLI = !ANTHROPIC_API_KEY && !!_detectClaudeCli();
153
153
 
154
154
  async function callClaudeViaCli(systemPrompt, userPrompt, maxTokens = 1024) {
155
155
  return new Promise((resolveP, reject) => {
156
+ // NOTE: do NOT pass --bare here. --bare disables OAuth/keychain reads
157
+ // and forces ANTHROPIC_API_KEY — which is exactly what we're avoiding.
158
+ // We want the CLI to use the user's logged-in Claude Code session.
156
159
  const args = [
157
160
  '-p',
158
161
  '--model', 'haiku',
159
162
  '--output-format', 'text',
160
- '--bare', // skip hooks/skills/auto-memory — we want a fast, clean call
161
- // Combine system + user into a single prompt argument
163
+ '--disable-slash-commands', // skip skill auto-resolution overhead
162
164
  `${systemPrompt}\n\n---\n\n${userPrompt}`,
163
165
  ];
164
166
  const child = spawn(_claudeCliPath, args, {
@@ -170,8 +172,8 @@ async function callClaudeViaCli(systemPrompt, userPrompt, maxTokens = 1024) {
170
172
  child.stderr.on('data', d => err += d.toString());
171
173
  const timeout = setTimeout(() => {
172
174
  child.kill('SIGKILL');
173
- reject(new Error('claude -p timed out after 60s'));
174
- }, 60000);
175
+ reject(new Error('claude -p timed out after 120s'));
176
+ }, 120000);
175
177
  child.on('close', code => {
176
178
  clearTimeout(timeout);
177
179
  if (code !== 0) return reject(new Error(`claude -p exited ${code}: ${err.slice(0, 200)}`));
@@ -697,11 +699,22 @@ async function main() {
697
699
  const batch = toAnalyze.slice(0, limit);
698
700
  console.log(`[understand] Analyzing ${batch.length} files (${toAnalyze.length - batch.length} skipped/already enriched)`);
699
701
 
700
- const llmPath = ANTHROPIC_API_KEY ? 'api' : (USE_CLAUDE_CLI ? 'claude-cli' : 'none');
702
+ // Prefer the CLI passthrough when available monomind is designed to run
703
+ // inside an authenticated Claude Code session and the CLI reuses that auth
704
+ // without prompting for an API key. Direct API only takes precedence when
705
+ // explicitly opted into (MONOMIND_PREFER_API=1).
706
+ const preferApi = process.env.MONOMIND_PREFER_API === '1';
707
+ const llmPath = (preferApi && ANTHROPIC_API_KEY) ? 'api'
708
+ : USE_CLAUDE_CLI ? 'claude-cli'
709
+ : ANTHROPIC_API_KEY ? 'api'
710
+ : 'none';
701
711
  if (llmPath === 'none' && !noLlm) {
702
- console.warn('[understand] No LLM path available (no ANTHROPIC_API_KEY and no `claude` CLI) falling back to --no-llm heuristic mode');
712
+ console.warn('[understand] No LLM path available `claude` CLI not found on PATH and ANTHROPIC_API_KEY not set. Running in heuristic mode.');
713
+ console.warn('[understand] Tip: install Claude Code or set ANTHROPIC_API_KEY to enable per-file summaries.');
703
714
  } else if (llmPath === 'claude-cli' && !noLlm) {
704
- console.log('[understand] Using `claude -p` CLI passthrough (no API key needed; reusing Claude Code auth)');
715
+ console.log('[understand] LLM path: `claude -p` CLI passthrough (reusing Claude Code session, no key needed)');
716
+ } else if (llmPath === 'api' && !noLlm) {
717
+ console.log('[understand] LLM path: direct Anthropic API (ANTHROPIC_API_KEY set)');
705
718
  }
706
719
  const useLlm = !noLlm && llmPath !== 'none';
707
720