@monoes/monomindcli 1.10.22 → 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.
|
@@ -126,14 +126,18 @@ node "$SCRIPT" \
|
|
|
126
126
|
|
|
127
127
|
The script will:
|
|
128
128
|
1. Read all file nodes from the monograph DB
|
|
129
|
-
2.
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
129
|
+
2. Pick the best available LLM path automatically (no env vars to set):
|
|
130
|
+
- `claude -p` CLI passthrough — reuses the active Claude Code authentication
|
|
131
|
+
- direct Anthropic API — if `ANTHROPIC_API_KEY` happens to be set (faster for bulk runs)
|
|
132
|
+
- heuristic-only fallback — if neither is reachable
|
|
133
|
+
3. For each file, generate summaries, tags, and complexity
|
|
134
|
+
4. Detect architectural layers
|
|
135
|
+
5. Write enrichment data back to `monograph.db` (community_id + properties JSON)
|
|
136
|
+
6. Emit a `graph.json` to `$DIR/.understand/knowledge-graph.json`
|
|
137
|
+
|
|
138
|
+
Wait for the script to complete before proceeding. Do NOT pre-check or advise about
|
|
139
|
+
`ANTHROPIC_API_KEY` — the script picks its path silently and prints the chosen mode
|
|
140
|
+
on stdout. Report only what the script actually reports.
|
|
137
141
|
|
|
138
142
|
---
|
|
139
143
|
|
|
@@ -173,17 +177,19 @@ Then tell the user:
|
|
|
173
177
|
> Open the Monomind control panel and click **Monograph → GRAPH** to see multi-color layers.
|
|
174
178
|
> Each color represents an architectural layer (API, Service, Data, UI, etc.).
|
|
175
179
|
>
|
|
176
|
-
>
|
|
177
|
-
>
|
|
178
|
-
>
|
|
179
|
-
>
|
|
180
|
-
>
|
|
180
|
+
> Common follow-ups:
|
|
181
|
+
> - `/monomind:understand --full` — full re-analysis from scratch
|
|
182
|
+
> - `/monomind:understand --layers-only` — refresh only layer detection
|
|
183
|
+
> - `/monomind:understand --incremental` — re-analyze only changed files
|
|
184
|
+
> - `/monomind:understand --onboard` — generate an onboarding guide
|
|
181
185
|
|
|
182
186
|
---
|
|
183
187
|
|
|
184
188
|
## Error Handling
|
|
185
189
|
|
|
186
|
-
-
|
|
190
|
+
- The script auto-selects an LLM path (`claude -p` CLI → API key → heuristic). Do not
|
|
191
|
+
prompt the user to set `ANTHROPIC_API_KEY`. Monomind is designed to run inside an
|
|
192
|
+
authenticated Claude Code session — the CLI passthrough is the default path.
|
|
187
193
|
- If the script exits non-zero, show stderr and suggest `npm install -g monomind@latest`.
|
|
188
194
|
- If monograph.db has no file nodes, tell the user to run `npx monomind monograph build` first.
|
|
189
195
|
- All errors are non-fatal to the main session — report and return cleanly.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoes/monomindcli",
|
|
3
|
-
"version": "1.10.
|
|
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
|
-
'--
|
|
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
|
|
174
|
-
},
|
|
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
|
-
|
|
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
|
|
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]
|
|
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
|
|