monomind 2.0.3 → 2.1.0
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 +9 -5
- package/packages/@monomind/cli/.claude/helpers/control-start.cjs +13 -20
- package/packages/@monomind/cli/.claude/helpers/event-logger.cjs +109 -6
- package/packages/@monomind/cli/.claude/helpers/graphify-freshen.cjs +19 -17
- package/packages/@monomind/cli/.claude/helpers/handlers/agent-start-handler.cjs +60 -28
- package/packages/@monomind/cli/.claude/helpers/handlers/capture-handler.cjs +75 -18
- package/packages/@monomind/cli/.claude/helpers/handlers/edit-handler.cjs +27 -9
- package/packages/@monomind/cli/.claude/helpers/handlers/gates-handler.cjs +16 -7
- package/packages/@monomind/cli/.claude/helpers/handlers/loops-status-handler.cjs +1 -1
- package/packages/@monomind/cli/.claude/helpers/handlers/route-handler.cjs +4 -4
- package/packages/@monomind/cli/.claude/helpers/handlers/session-handler.cjs +40 -22
- package/packages/@monomind/cli/.claude/helpers/handlers/session-restore-handler.cjs +0 -12
- package/packages/@monomind/cli/.claude/helpers/handlers/task-handler.cjs +53 -22
- package/packages/@monomind/cli/.claude/helpers/hook-handler.cjs +54 -4
- package/packages/@monomind/cli/.claude/helpers/intelligence.cjs +94 -15
- package/packages/@monomind/cli/.claude/helpers/session.cjs +6 -1
- package/packages/@monomind/cli/.claude/helpers/statusline.cjs +10 -10
- package/packages/@monomind/cli/.claude/helpers/token-tracker.cjs +3 -3
- package/packages/@monomind/cli/.claude/helpers/utils/agent-registrations.cjs +41 -0
- package/packages/@monomind/cli/.claude/helpers/utils/fs-helpers.cjs +183 -0
- package/packages/@monomind/cli/.claude/helpers/utils/micro-agents.cjs +10 -6
- package/packages/@monomind/cli/.claude/helpers/utils/telemetry.cjs +35 -19
- package/packages/@monomind/cli/bin/cli.js +10 -1
- package/packages/@monomind/cli/dist/src/commands/agent-ops.js +9 -15
- package/packages/@monomind/cli/dist/src/commands/cleanup.js +20 -4
- package/packages/@monomind/cli/dist/src/commands/completions.js +66 -261
- package/packages/@monomind/cli/dist/src/commands/doctor.js +7 -2
- package/packages/@monomind/cli/dist/src/commands/hooks-workers.js +7 -0
- package/packages/@monomind/cli/dist/src/commands/index.js +3 -0
- package/packages/@monomind/cli/dist/src/commands/mcp.js +11 -6
- package/packages/@monomind/cli/dist/src/commands/memory-admin.js +12 -6
- package/packages/@monomind/cli/dist/src/commands/memory-transfer.js +6 -13
- package/packages/@monomind/cli/dist/src/commands/monograph.js +3 -3
- package/packages/@monomind/cli/dist/src/commands/org.d.ts +3 -1
- package/packages/@monomind/cli/dist/src/commands/org.js +306 -129
- package/packages/@monomind/cli/dist/src/commands/start.js +142 -37
- package/packages/@monomind/cli/dist/src/commands/tokens.js +21 -3
- package/packages/@monomind/cli/dist/src/config-adapter.js +37 -17
- package/packages/@monomind/cli/dist/src/index.js +64 -28
- package/packages/@monomind/cli/dist/src/init/claudemd-generator.js +44 -11
- package/packages/@monomind/cli/dist/src/init/executor.js +63 -49
- package/packages/@monomind/cli/dist/src/mcp-client.d.ts +8 -3
- package/packages/@monomind/cli/dist/src/mcp-client.js +37 -3
- package/packages/@monomind/cli/dist/src/mcp-server.js +8 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.d.ts +20 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/agent-tools.js +10 -5
- package/packages/@monomind/cli/dist/src/mcp-tools/github-tools.js +30 -8
- package/packages/@monomind/cli/dist/src/mcp-tools/graphify-tools.js +11 -2
- package/packages/@monomind/cli/dist/src/mcp-tools/hive-mind-tools.js +51 -34
- package/packages/@monomind/cli/dist/src/mcp-tools/knowledge-tools.js +9 -1
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-compat.js +56 -14
- package/packages/@monomind/cli/dist/src/mcp-tools/monograph-tools.js +65 -43
- package/packages/@monomind/cli/dist/src/mcp-tools/swarm-tools.js +6 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/system-tools.js +4 -4
- package/packages/@monomind/cli/dist/src/mcp-tools/types.d.ts +20 -0
- package/packages/@monomind/cli/dist/src/mcp-tools/types.js +36 -1
- package/packages/@monomind/cli/dist/src/memory/hnsw-operations.d.ts +13 -1
- package/packages/@monomind/cli/dist/src/memory/hnsw-operations.js +66 -14
- package/packages/@monomind/cli/dist/src/memory/intelligence.js +99 -3
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.d.ts +7 -0
- package/packages/@monomind/cli/dist/src/memory/memory-bridge.js +20 -0
- package/packages/@monomind/cli/dist/src/orgrt/broker.d.ts +24 -0
- package/packages/@monomind/cli/dist/src/orgrt/broker.js +68 -0
- package/packages/@monomind/cli/dist/src/orgrt/daemon.d.ts +30 -0
- package/packages/@monomind/cli/dist/src/orgrt/daemon.js +96 -7
- package/packages/@monomind/cli/dist/src/orgrt/forwarder.d.ts +10 -5
- package/packages/@monomind/cli/dist/src/orgrt/forwarder.js +105 -8
- package/packages/@monomind/cli/dist/src/orgrt/live.html +56 -0
- package/packages/@monomind/cli/dist/src/orgrt/provider.js +1 -0
- package/packages/@monomind/cli/dist/src/orgrt/scheduler.d.ts +13 -0
- package/packages/@monomind/cli/dist/src/orgrt/scheduler.js +48 -0
- package/packages/@monomind/cli/dist/src/orgrt/server.d.ts +8 -0
- package/packages/@monomind/cli/dist/src/orgrt/server.js +72 -0
- package/packages/@monomind/cli/dist/src/orgrt/test-loop.d.ts +12 -0
- package/packages/@monomind/cli/dist/src/orgrt/test-loop.js +108 -0
- package/packages/@monomind/cli/dist/src/output.js +12 -5
- package/packages/@monomind/cli/dist/src/parser.d.ts +32 -0
- package/packages/@monomind/cli/dist/src/parser.js +130 -5
- package/packages/@monomind/cli/dist/src/routing/embed-worker.js +13 -1
- package/packages/@monomind/cli/dist/src/routing/route-layer-factory.js +31 -0
- package/packages/@monomind/cli/dist/src/services/config-file-manager.d.ts +21 -0
- package/packages/@monomind/cli/dist/src/services/config-file-manager.js +60 -7
- package/packages/@monomind/cli/dist/src/services/crash-reporter.js +2 -1
- package/packages/@monomind/cli/dist/src/ui/dashboard.html +40 -40
- package/packages/@monomind/cli/dist/src/ui/orgs.html +110 -11
- package/packages/@monomind/cli/dist/src/ui/server.mjs +304 -133
- package/packages/@monomind/cli/dist/src/utils/input-guards.d.ts +9 -0
- package/packages/@monomind/cli/dist/src/utils/input-guards.js +39 -5
- package/packages/@monomind/cli/package.json +6 -2
|
@@ -5,27 +5,37 @@
|
|
|
5
5
|
* github.com/monoes/monomind
|
|
6
6
|
*/
|
|
7
7
|
import { output } from '../output.js';
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
// Derive completion lists from the actual command registry (commands/index.ts)
|
|
9
|
+
// instead of hardcoding them here — hardcoded lists rot as commands are added,
|
|
10
|
+
// renamed, or removed (this file previously referenced 'claims', 'embeddings',
|
|
11
|
+
// 'workflow', 'hive-mind', none of which exist as top-level commands anymore,
|
|
12
|
+
// while omitting many real ones). A dynamic import (resolved at call time, in
|
|
13
|
+
// the async command actions below) avoids evaluating the circular import
|
|
14
|
+
// (index.ts -> completions.ts -> index.ts) at module-load time.
|
|
15
|
+
async function getRegistry() {
|
|
16
|
+
const { commands } = await import('./index.js');
|
|
17
|
+
return commands;
|
|
18
|
+
}
|
|
19
|
+
function topLevelCommandNames(commands) {
|
|
20
|
+
return [...commands.map(c => c.name), 'help', 'version'];
|
|
21
|
+
}
|
|
22
|
+
/** Map of command name (and aliases) -> subcommand names, for commands that have subcommands. */
|
|
23
|
+
function subcommandMap(commands) {
|
|
24
|
+
const map = {};
|
|
25
|
+
for (const cmd of commands) {
|
|
26
|
+
if (cmd.subcommands && cmd.subcommands.length > 0) {
|
|
27
|
+
map[cmd.name] = cmd.subcommands.map(s => s.name);
|
|
28
|
+
for (const alias of cmd.aliases ?? [])
|
|
29
|
+
map[alias] = map[cmd.name];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return map;
|
|
33
|
+
}
|
|
27
34
|
// Generate bash completion script
|
|
28
|
-
function generateBashCompletion() {
|
|
35
|
+
function generateBashCompletion(topLevel, subMap) {
|
|
36
|
+
const caseArms = Object.entries(subMap)
|
|
37
|
+
.map(([cmd, subs]) => ` ${cmd})\n COMPREPLY=( $(compgen -W "${subs.join(' ')}" -- "\${cur}") )\n return 0\n ;;`)
|
|
38
|
+
.join('\n');
|
|
29
39
|
return `# monomind bash completion
|
|
30
40
|
# Generated by monomind completions bash
|
|
31
41
|
# Add this to ~/.bashrc or ~/.bash_completion
|
|
@@ -34,61 +44,10 @@ _monomind_completions() {
|
|
|
34
44
|
local cur prev words cword
|
|
35
45
|
_init_completion -n : || return
|
|
36
46
|
|
|
37
|
-
local commands="${
|
|
38
|
-
|
|
39
|
-
# Subcommand completions
|
|
40
|
-
local swarm_commands="${SWARM_SUBCOMMANDS.join(' ')}"
|
|
41
|
-
local agent_commands="${AGENT_SUBCOMMANDS.join(' ')}"
|
|
42
|
-
local task_commands="${TASK_SUBCOMMANDS.join(' ')}"
|
|
43
|
-
local memory_commands="${MEMORY_SUBCOMMANDS.join(' ')}"
|
|
44
|
-
local hive_mind_commands="${HIVE_MIND_SUBCOMMANDS.join(' ')}"
|
|
45
|
-
local hooks_commands="${HOOKS_SUBCOMMANDS.join(' ')}"
|
|
47
|
+
local commands="${topLevel.join(' ')}"
|
|
46
48
|
|
|
47
49
|
case "\${words[1]}" in
|
|
48
|
-
|
|
49
|
-
COMPREPLY=( $(compgen -W "\${swarm_commands}" -- "\${cur}") )
|
|
50
|
-
return 0
|
|
51
|
-
;;
|
|
52
|
-
agent)
|
|
53
|
-
COMPREPLY=( $(compgen -W "\${agent_commands}" -- "\${cur}") )
|
|
54
|
-
return 0
|
|
55
|
-
;;
|
|
56
|
-
task)
|
|
57
|
-
COMPREPLY=( $(compgen -W "\${task_commands}" -- "\${cur}") )
|
|
58
|
-
return 0
|
|
59
|
-
;;
|
|
60
|
-
memory)
|
|
61
|
-
COMPREPLY=( $(compgen -W "\${memory_commands}" -- "\${cur}") )
|
|
62
|
-
return 0
|
|
63
|
-
;;
|
|
64
|
-
hive-mind|hive)
|
|
65
|
-
COMPREPLY=( $(compgen -W "\${hive_mind_commands}" -- "\${cur}") )
|
|
66
|
-
return 0
|
|
67
|
-
;;
|
|
68
|
-
hooks)
|
|
69
|
-
COMPREPLY=( $(compgen -W "\${hooks_commands}" -- "\${cur}") )
|
|
70
|
-
return 0
|
|
71
|
-
;;
|
|
72
|
-
security)
|
|
73
|
-
COMPREPLY=( $(compgen -W "scan cve audit secrets" -- "\${cur}") )
|
|
74
|
-
return 0
|
|
75
|
-
;;
|
|
76
|
-
performance)
|
|
77
|
-
COMPREPLY=( $(compgen -W "benchmark profile metrics bottleneck" -- "\${cur}") )
|
|
78
|
-
return 0
|
|
79
|
-
;;
|
|
80
|
-
claims)
|
|
81
|
-
COMPREPLY=( $(compgen -W "list check grant revoke roles policies" -- "\${cur}") )
|
|
82
|
-
return 0
|
|
83
|
-
;;
|
|
84
|
-
embeddings)
|
|
85
|
-
COMPREPLY=( $(compgen -W "generate search compare collections index providers" -- "\${cur}") )
|
|
86
|
-
return 0
|
|
87
|
-
;;
|
|
88
|
-
providers)
|
|
89
|
-
COMPREPLY=( $(compgen -W "list configure test models usage" -- "\${cur}") )
|
|
90
|
-
return 0
|
|
91
|
-
;;
|
|
50
|
+
${caseArms}
|
|
92
51
|
doctor)
|
|
93
52
|
COMPREPLY=( $(compgen -W "--fix --component --verbose" -- "\${cur}") )
|
|
94
53
|
return 0
|
|
@@ -106,7 +65,17 @@ complete -F _monomind_completions npx\\ @monomind/cli@v1alpha
|
|
|
106
65
|
`;
|
|
107
66
|
}
|
|
108
67
|
// Generate zsh completion script
|
|
109
|
-
function generateZshCompletion() {
|
|
68
|
+
function generateZshCompletion(commandList, subMap) {
|
|
69
|
+
const commandsBlock = commandList
|
|
70
|
+
.map(c => ` '${c.name}:${c.description.replace(/'/g, '')}'`)
|
|
71
|
+
.concat([` 'help:Show help'`, ` 'version:Show version'`])
|
|
72
|
+
.join('\n');
|
|
73
|
+
const caseArms = Object.entries(subMap)
|
|
74
|
+
.map(([cmd, subs]) => {
|
|
75
|
+
const subLines = subs.map(s => ` '${s}'`).join('\n');
|
|
76
|
+
return ` ${cmd})\n subcommands=(\n${subLines}\n )\n ;;`;
|
|
77
|
+
})
|
|
78
|
+
.join('\n');
|
|
110
79
|
return `#compdef monomind
|
|
111
80
|
# monomind zsh completion
|
|
112
81
|
# Generated by monomind completions zsh
|
|
@@ -117,24 +86,7 @@ _monomind() {
|
|
|
117
86
|
local -a subcommands
|
|
118
87
|
|
|
119
88
|
commands=(
|
|
120
|
-
|
|
121
|
-
'agent:Agent lifecycle management'
|
|
122
|
-
'task:Task creation and management'
|
|
123
|
-
'session:Session management'
|
|
124
|
-
'config:Configuration management'
|
|
125
|
-
'memory:Memory operations with LanceDB'
|
|
126
|
-
'workflow:Workflow automation'
|
|
127
|
-
'hive-mind:Queen-led consensus coordination'
|
|
128
|
-
'hooks:Self-learning automation hooks'
|
|
129
|
-
'security:Security scanning and CVE detection'
|
|
130
|
-
'performance:Performance profiling'
|
|
131
|
-
'providers:AI provider management'
|
|
132
|
-
'claims:Claims-based authorization'
|
|
133
|
-
'embeddings:Vector embeddings'
|
|
134
|
-
'doctor:System diagnostics'
|
|
135
|
-
'completions:Shell completion scripts'
|
|
136
|
-
'help:Show help'
|
|
137
|
-
'version:Show version'
|
|
89
|
+
${commandsBlock}
|
|
138
90
|
)
|
|
139
91
|
|
|
140
92
|
_arguments -C \\
|
|
@@ -148,124 +100,7 @@ _monomind() {
|
|
|
148
100
|
;;
|
|
149
101
|
subcommand)
|
|
150
102
|
case $words[2] in
|
|
151
|
-
|
|
152
|
-
subcommands=(
|
|
153
|
-
'init:Initialize swarm'
|
|
154
|
-
'status:Show swarm status'
|
|
155
|
-
'scale:Scale agent count'
|
|
156
|
-
'destroy:Shutdown swarm'
|
|
157
|
-
'monitor:Real-time monitoring'
|
|
158
|
-
)
|
|
159
|
-
;;
|
|
160
|
-
agent)
|
|
161
|
-
subcommands=(
|
|
162
|
-
'spawn:Create new agent'
|
|
163
|
-
'terminate:Stop agent'
|
|
164
|
-
'status:Check agent status'
|
|
165
|
-
'list:List all agents'
|
|
166
|
-
'pool:Manage agent pool'
|
|
167
|
-
'health:Health check'
|
|
168
|
-
'update:Update agent config'
|
|
169
|
-
)
|
|
170
|
-
;;
|
|
171
|
-
task)
|
|
172
|
-
subcommands=(
|
|
173
|
-
'create:Create new task'
|
|
174
|
-
'status:Check task status'
|
|
175
|
-
'list:List all tasks'
|
|
176
|
-
'complete:Mark task complete'
|
|
177
|
-
'cancel:Cancel task'
|
|
178
|
-
)
|
|
179
|
-
;;
|
|
180
|
-
memory)
|
|
181
|
-
subcommands=(
|
|
182
|
-
'store:Store data'
|
|
183
|
-
'retrieve:Retrieve data'
|
|
184
|
-
'search:Semantic search'
|
|
185
|
-
'list:List entries'
|
|
186
|
-
'delete:Delete entry'
|
|
187
|
-
'stats:Show statistics'
|
|
188
|
-
'configure:Configure backend'
|
|
189
|
-
'export:Export to file'
|
|
190
|
-
'import:Import from file'
|
|
191
|
-
)
|
|
192
|
-
;;
|
|
193
|
-
hive-mind|hive)
|
|
194
|
-
subcommands=(
|
|
195
|
-
'init:Initialize hive mind'
|
|
196
|
-
'spawn:Spawn worker agents'
|
|
197
|
-
'status:Show hive status'
|
|
198
|
-
'join:Join agent to hive'
|
|
199
|
-
'leave:Remove agent'
|
|
200
|
-
'consensus:Consensus management'
|
|
201
|
-
'broadcast:Broadcast message'
|
|
202
|
-
'memory:Shared memory'
|
|
203
|
-
'shutdown:Shutdown hive'
|
|
204
|
-
)
|
|
205
|
-
;;
|
|
206
|
-
hooks)
|
|
207
|
-
subcommands=(
|
|
208
|
-
'pre-edit:Before file editing'
|
|
209
|
-
'post-edit:After file editing'
|
|
210
|
-
'pre-command:Before command execution'
|
|
211
|
-
'post-command:After command execution'
|
|
212
|
-
'pre-task:Before task start'
|
|
213
|
-
'post-task:After task completion'
|
|
214
|
-
'route:Route task to agent'
|
|
215
|
-
'explain:Explain routing'
|
|
216
|
-
'pretrain:Bootstrap intelligence'
|
|
217
|
-
'build-agents:Generate agent configs'
|
|
218
|
-
'metrics:Show metrics'
|
|
219
|
-
'transfer:Transfer learning'
|
|
220
|
-
'list:List hooks'
|
|
221
|
-
'intelligence:Neural intelligence commands'
|
|
222
|
-
)
|
|
223
|
-
;;
|
|
224
|
-
security)
|
|
225
|
-
subcommands=(
|
|
226
|
-
'scan:Security scan'
|
|
227
|
-
'cve:CVE detection'
|
|
228
|
-
'audit:Security audit'
|
|
229
|
-
'secrets:Secrets scanning'
|
|
230
|
-
)
|
|
231
|
-
;;
|
|
232
|
-
performance)
|
|
233
|
-
subcommands=(
|
|
234
|
-
'benchmark:Run benchmarks'
|
|
235
|
-
'profile:Profile code'
|
|
236
|
-
'metrics:Show metrics'
|
|
237
|
-
'bottleneck:Find bottlenecks'
|
|
238
|
-
)
|
|
239
|
-
;;
|
|
240
|
-
claims)
|
|
241
|
-
subcommands=(
|
|
242
|
-
'list:List claims'
|
|
243
|
-
'check:Check permission'
|
|
244
|
-
'grant:Grant claim'
|
|
245
|
-
'revoke:Revoke claim'
|
|
246
|
-
'roles:Manage roles'
|
|
247
|
-
'policies:Manage policies'
|
|
248
|
-
)
|
|
249
|
-
;;
|
|
250
|
-
embeddings)
|
|
251
|
-
subcommands=(
|
|
252
|
-
'generate:Generate embeddings'
|
|
253
|
-
'search:Semantic search'
|
|
254
|
-
'compare:Compare vectors'
|
|
255
|
-
'collections:Manage collections'
|
|
256
|
-
'index:Index operations'
|
|
257
|
-
'providers:Embedding providers'
|
|
258
|
-
)
|
|
259
|
-
;;
|
|
260
|
-
providers)
|
|
261
|
-
subcommands=(
|
|
262
|
-
'list:List providers'
|
|
263
|
-
'configure:Configure provider'
|
|
264
|
-
'test:Test connection'
|
|
265
|
-
'models:Available models'
|
|
266
|
-
'usage:Usage statistics'
|
|
267
|
-
)
|
|
268
|
-
;;
|
|
103
|
+
${caseArms}
|
|
269
104
|
esac
|
|
270
105
|
_describe -t subcommands 'subcommands' subcommands
|
|
271
106
|
;;
|
|
@@ -276,7 +111,11 @@ _monomind "$@"
|
|
|
276
111
|
`;
|
|
277
112
|
}
|
|
278
113
|
// Generate fish completion script
|
|
279
|
-
function generateFishCompletion() {
|
|
114
|
+
function generateFishCompletion(topLevel, subMap) {
|
|
115
|
+
const subBlocks = Object.entries(subMap)
|
|
116
|
+
.map(([cmd, subs]) => `# ${cmd} subcommands\n` +
|
|
117
|
+
subs.map(sub => `complete -c monomind -n "__fish_seen_subcommand_from ${cmd}" -a "${sub}"`).join('\n'))
|
|
118
|
+
.join('\n\n');
|
|
280
119
|
return `# monomind fish completion
|
|
281
120
|
# Generated by monomind completions fish
|
|
282
121
|
# Save to ~/.config/fish/completions/monomind.fish
|
|
@@ -285,64 +124,26 @@ function generateFishCompletion() {
|
|
|
285
124
|
complete -c monomind -f
|
|
286
125
|
|
|
287
126
|
# Top-level commands
|
|
288
|
-
${
|
|
289
|
-
|
|
290
|
-
# Swarm subcommands
|
|
291
|
-
${SWARM_SUBCOMMANDS.map(sub => `complete -c monomind -n "__fish_seen_subcommand_from swarm" -a "${sub}"`).join('\n')}
|
|
292
|
-
|
|
293
|
-
# Agent subcommands
|
|
294
|
-
${AGENT_SUBCOMMANDS.map(sub => `complete -c monomind -n "__fish_seen_subcommand_from agent" -a "${sub}"`).join('\n')}
|
|
295
|
-
|
|
296
|
-
# Task subcommands
|
|
297
|
-
${TASK_SUBCOMMANDS.map(sub => `complete -c monomind -n "__fish_seen_subcommand_from task" -a "${sub}"`).join('\n')}
|
|
298
|
-
|
|
299
|
-
# Memory subcommands
|
|
300
|
-
${MEMORY_SUBCOMMANDS.map(sub => `complete -c monomind -n "__fish_seen_subcommand_from memory" -a "${sub}"`).join('\n')}
|
|
301
|
-
|
|
302
|
-
# Hive-mind subcommands
|
|
303
|
-
${HIVE_MIND_SUBCOMMANDS.map(sub => `complete -c monomind -n "__fish_seen_subcommand_from hive-mind hive" -a "${sub}"`).join('\n')}
|
|
304
|
-
|
|
305
|
-
# Hooks subcommands
|
|
306
|
-
${HOOKS_SUBCOMMANDS.map(sub => `complete -c monomind -n "__fish_seen_subcommand_from hooks" -a "${sub}"`).join('\n')}
|
|
307
|
-
|
|
308
|
-
# Security subcommands
|
|
309
|
-
complete -c monomind -n "__fish_seen_subcommand_from security" -a "scan cve audit secrets"
|
|
310
|
-
|
|
311
|
-
# Performance subcommands
|
|
312
|
-
complete -c monomind -n "__fish_seen_subcommand_from performance" -a "benchmark profile metrics bottleneck"
|
|
313
|
-
|
|
314
|
-
# Claims subcommands
|
|
315
|
-
complete -c monomind -n "__fish_seen_subcommand_from claims" -a "list check grant revoke roles policies"
|
|
316
|
-
|
|
317
|
-
# Embeddings subcommands
|
|
318
|
-
complete -c monomind -n "__fish_seen_subcommand_from embeddings" -a "generate search compare collections index providers"
|
|
127
|
+
${topLevel.map(cmd => `complete -c monomind -n "__fish_use_subcommand" -a "${cmd}"`).join('\n')}
|
|
319
128
|
|
|
320
|
-
|
|
321
|
-
complete -c monomind -n "__fish_seen_subcommand_from providers" -a "list configure test models usage"
|
|
129
|
+
${subBlocks}
|
|
322
130
|
`;
|
|
323
131
|
}
|
|
324
132
|
// Generate PowerShell completion script
|
|
325
|
-
function generatePowerShellCompletion() {
|
|
133
|
+
function generatePowerShellCompletion(topLevel, subMap) {
|
|
134
|
+
const subEntries = Object.entries(subMap)
|
|
135
|
+
.map(([cmd, subs]) => ` '${cmd}' = @('${subs.join("', '")}')`)
|
|
136
|
+
.join('\n');
|
|
326
137
|
return `# monomind PowerShell completion
|
|
327
138
|
# Generated by monomind completions powershell
|
|
328
139
|
# Add to $PROFILE or save to a separate file and dot-source it
|
|
329
140
|
|
|
330
141
|
$script:MonomindCommands = @(
|
|
331
|
-
'${
|
|
142
|
+
'${topLevel.join("',\n '")}'
|
|
332
143
|
)
|
|
333
144
|
|
|
334
145
|
$script:SubCommands = @{
|
|
335
|
-
|
|
336
|
-
'agent' = @('${AGENT_SUBCOMMANDS.join("', '")}')
|
|
337
|
-
'task' = @('${TASK_SUBCOMMANDS.join("', '")}')
|
|
338
|
-
'memory' = @('${MEMORY_SUBCOMMANDS.join("', '")}')
|
|
339
|
-
'hive-mind' = @('${HIVE_MIND_SUBCOMMANDS.join("', '")}')
|
|
340
|
-
'hive' = @('${HIVE_MIND_SUBCOMMANDS.join("', '")}')
|
|
341
|
-
'hooks' = @('${HOOKS_SUBCOMMANDS.join("', '")}')
|
|
342
|
-
'security' = @('scan', 'cve', 'audit', 'secrets')
|
|
343
|
-
'performance' = @('benchmark', 'profile', 'metrics', 'bottleneck')
|
|
344
|
-
'embeddings' = @('generate', 'search', 'compare', 'collections', 'index', 'providers')
|
|
345
|
-
'providers' = @('list', 'configure', 'test', 'models', 'usage')
|
|
146
|
+
${subEntries}
|
|
346
147
|
}
|
|
347
148
|
|
|
348
149
|
Register-ArgumentCompleter -Native -CommandName monomind -ScriptBlock {
|
|
@@ -371,7 +172,8 @@ const bashCommand = {
|
|
|
371
172
|
name: 'bash',
|
|
372
173
|
description: 'Generate bash completion script',
|
|
373
174
|
action: async (ctx) => {
|
|
374
|
-
const
|
|
175
|
+
const commandList = await getRegistry();
|
|
176
|
+
const script = generateBashCompletion(topLevelCommandNames(commandList), subcommandMap(commandList));
|
|
375
177
|
output.writeln(script);
|
|
376
178
|
return { success: true };
|
|
377
179
|
}
|
|
@@ -381,7 +183,8 @@ const zshCommand = {
|
|
|
381
183
|
name: 'zsh',
|
|
382
184
|
description: 'Generate zsh completion script',
|
|
383
185
|
action: async (ctx) => {
|
|
384
|
-
const
|
|
186
|
+
const commandList = await getRegistry();
|
|
187
|
+
const script = generateZshCompletion(commandList, subcommandMap(commandList));
|
|
385
188
|
output.writeln(script);
|
|
386
189
|
return { success: true };
|
|
387
190
|
}
|
|
@@ -391,7 +194,8 @@ const fishCommand = {
|
|
|
391
194
|
name: 'fish',
|
|
392
195
|
description: 'Generate fish completion script',
|
|
393
196
|
action: async (ctx) => {
|
|
394
|
-
const
|
|
197
|
+
const commandList = await getRegistry();
|
|
198
|
+
const script = generateFishCompletion(topLevelCommandNames(commandList), subcommandMap(commandList));
|
|
395
199
|
output.writeln(script);
|
|
396
200
|
return { success: true };
|
|
397
201
|
}
|
|
@@ -402,7 +206,8 @@ const powershellCommand = {
|
|
|
402
206
|
aliases: ['pwsh'],
|
|
403
207
|
description: 'Generate PowerShell completion script',
|
|
404
208
|
action: async (ctx) => {
|
|
405
|
-
const
|
|
209
|
+
const commandList = await getRegistry();
|
|
210
|
+
const script = generatePowerShellCompletion(topLevelCommandNames(commandList), subcommandMap(commandList));
|
|
406
211
|
output.writeln(script);
|
|
407
212
|
return { success: true };
|
|
408
213
|
}
|
|
@@ -23,7 +23,7 @@ export const doctorCommand = {
|
|
|
23
23
|
{ name: 'install', short: 'i', description: 'Auto-install missing dependencies (Claude Code CLI)', type: 'boolean', default: false },
|
|
24
24
|
{
|
|
25
25
|
name: 'component', short: 'c',
|
|
26
|
-
description: 'Check specific component (version, node, npm, config, memory, api, git, mcp, claude, disk, typescript, monograph, graph-freshness, memory-pkg, helpers, monoes, gates, gitignore, registry, monoes-tools, metrics-freshness, security-audit)',
|
|
26
|
+
description: 'Check specific component (version, node, npm, config, memory, api, git, mcp, claude, disk, typescript, monograph, graph-freshness, memory-pkg, helpers, monoes, gates, gitignore, registry, memory-proficiency, monoes-tools, metrics-freshness, security-audit)',
|
|
27
27
|
type: 'string',
|
|
28
28
|
},
|
|
29
29
|
{ name: 'verbose', short: 'v', description: 'Verbose output', type: 'boolean', default: false },
|
|
@@ -86,7 +86,12 @@ export const doctorCommand = {
|
|
|
86
86
|
'monoes-tools': checkMonoesTools,
|
|
87
87
|
'metrics-freshness': checkMetricsFreshness, 'security-audit': checkSecurityAuditFindings,
|
|
88
88
|
};
|
|
89
|
-
|
|
89
|
+
if (component && !componentMap[component]) {
|
|
90
|
+
output.writeln(output.error(`Unknown component: "${component}"`));
|
|
91
|
+
output.writeln(`Valid components: ${Object.keys(componentMap).sort().join(', ')}`);
|
|
92
|
+
return { success: false, exitCode: 1, data: { passed: 0, warnings: 0, failed: 1, results: [] } };
|
|
93
|
+
}
|
|
94
|
+
const checksToRun = component ? [componentMap[component]] : allChecks;
|
|
90
95
|
const results = [];
|
|
91
96
|
const fixes = [];
|
|
92
97
|
const spinner = output.createSpinner({ text: 'Running health checks in parallel...', spinner: 'dots' });
|
|
@@ -479,6 +479,13 @@ const workerRunCommand = {
|
|
|
479
479
|
return { success: false, exitCode: 1 };
|
|
480
480
|
}
|
|
481
481
|
const manager = hooks.createWorkerManager(process.cwd());
|
|
482
|
+
// `run` invokes a single worker standalone, outside the normal
|
|
483
|
+
// session-start path — runWorker() itself does not create
|
|
484
|
+
// .monomind/metrics/, so on a fresh project with no prior
|
|
485
|
+
// session-start hook run, workers that write metrics files fail with
|
|
486
|
+
// ENOENT. ensureMetricsDir() is the minimal piece of the manager's
|
|
487
|
+
// initialize() step this command actually needs (no state load/timers).
|
|
488
|
+
await manager.ensureMetricsDir();
|
|
482
489
|
const result = await manager.runWorker(name);
|
|
483
490
|
if (!result.success) {
|
|
484
491
|
spinner.fail(`Worker ${name} failed: ${result.error || 'unknown error'}`);
|
|
@@ -37,6 +37,7 @@ import { searchUniversalCommand } from './search-universal.js';
|
|
|
37
37
|
import { reportCrashCommand } from './report-crash.js';
|
|
38
38
|
import { crashReportingCommand } from './crash-reporting.js';
|
|
39
39
|
import { docCommand } from './doc.js';
|
|
40
|
+
import { orgCommand } from './org.js';
|
|
40
41
|
// Populate command cache
|
|
41
42
|
loadedCommands.set('init', initCommand);
|
|
42
43
|
loadedCommands.set('start', startCommand);
|
|
@@ -69,6 +70,7 @@ loadedCommands.set('search', searchUniversalCommand);
|
|
|
69
70
|
loadedCommands.set('report-crash', reportCrashCommand);
|
|
70
71
|
loadedCommands.set('crash-reporting', crashReportingCommand);
|
|
71
72
|
loadedCommands.set('doc', docCommand);
|
|
73
|
+
loadedCommands.set('org', orgCommand);
|
|
72
74
|
// =============================================================================
|
|
73
75
|
// Exports
|
|
74
76
|
// =============================================================================
|
|
@@ -106,6 +108,7 @@ export const commands = [
|
|
|
106
108
|
sessionCommand,
|
|
107
109
|
agentCommand,
|
|
108
110
|
swarmCommand,
|
|
111
|
+
orgCommand,
|
|
109
112
|
memoryCommand,
|
|
110
113
|
mcpCommand,
|
|
111
114
|
hooksCommand,
|
|
@@ -256,11 +256,15 @@ const statusCommand = {
|
|
|
256
256
|
action: async (ctx) => {
|
|
257
257
|
try {
|
|
258
258
|
let status = await getMCPServerStatus();
|
|
259
|
-
// If PID-based check says not running, detect stdio mode
|
|
259
|
+
// If PID-based check says not running, detect stdio mode.
|
|
260
|
+
// SECURITY/CORRECTNESS: must NOT use a TTY heuristic here — any
|
|
261
|
+
// non-interactive invocation (piped, CI, scripted) has
|
|
262
|
+
// `!process.stdin.isTTY === true`, which previously reported
|
|
263
|
+
// "running" even when nothing was actually running. Only the
|
|
264
|
+
// explicit stdio-transport env var counts as a real signal.
|
|
260
265
|
if (!status.running) {
|
|
261
|
-
const isStdio = !process.stdin.isTTY;
|
|
262
266
|
const envTransport = process.env.MONOMIND_MCP_TRANSPORT;
|
|
263
|
-
if (
|
|
267
|
+
if (envTransport === 'stdio') {
|
|
264
268
|
status = {
|
|
265
269
|
running: true,
|
|
266
270
|
pid: process.pid,
|
|
@@ -366,7 +370,7 @@ const toolsCommand = {
|
|
|
366
370
|
name: tool.name,
|
|
367
371
|
category: tool.category || 'uncategorized',
|
|
368
372
|
description: tool.description,
|
|
369
|
-
enabled:
|
|
373
|
+
enabled: tool.enabled
|
|
370
374
|
}));
|
|
371
375
|
}
|
|
372
376
|
else {
|
|
@@ -457,7 +461,7 @@ const toggleCommand = {
|
|
|
457
461
|
action: async (ctx) => {
|
|
458
462
|
const fs = await import('node:fs');
|
|
459
463
|
const path = await import('node:path');
|
|
460
|
-
const stateFile = path.join('.monomind', 'mcp-disabled-tools.json');
|
|
464
|
+
const stateFile = path.join(ctx.cwd, '.monomind', 'mcp-disabled-tools.json');
|
|
461
465
|
let disabled = [];
|
|
462
466
|
try {
|
|
463
467
|
disabled = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
|
|
@@ -485,7 +489,8 @@ const toggleCommand = {
|
|
|
485
489
|
fs.mkdirSync(path.dirname(stateFile), { recursive: true });
|
|
486
490
|
fs.writeFileSync(stateFile, JSON.stringify(disabled, null, 2) + '\n');
|
|
487
491
|
output.writeln(output.dim(`State saved to ${stateFile}. ${disabled.length} tool(s) disabled.`));
|
|
488
|
-
output.writeln(output.dim('
|
|
492
|
+
output.writeln(output.dim('Disabled tools are rejected immediately by direct CLI invocation.'));
|
|
493
|
+
output.writeln(output.dim('An external MCP server (mcp start) must be restarted to stop exposing disabled tools to MCP clients.'));
|
|
489
494
|
return { success: true };
|
|
490
495
|
}
|
|
491
496
|
};
|
|
@@ -178,20 +178,28 @@ export const statsCommand = {
|
|
|
178
178
|
action: async (ctx) => {
|
|
179
179
|
// Compute stats directly from the memory bridge (there is no memory_stats MCP tool)
|
|
180
180
|
try {
|
|
181
|
-
const { bridgeListEntries } = await import('../memory/memory-bridge.js');
|
|
181
|
+
const { bridgeListEntries, bridgeGetBackendStats, bridgeGetDbPath } = await import('../memory/memory-bridge.js');
|
|
182
182
|
const listed = await bridgeListEntries({ limit: 10000 });
|
|
183
183
|
if (!listed || !listed.success)
|
|
184
184
|
throw new Error('memory backend unavailable');
|
|
185
185
|
const entries = listed.entries;
|
|
186
186
|
const totalBytes = entries.reduce((s, e) => s + (e.content || '').length, 0);
|
|
187
187
|
const times = entries.map((e) => e.updatedAt || e.createdAt).filter(Boolean).sort();
|
|
188
|
+
// Real configured backend (falls back to the config default when unset).
|
|
189
|
+
const memoryConfig = configManager.get(ctx.cwd, 'memory');
|
|
190
|
+
const configuredBackend = memoryConfig?.backend || 'hybrid';
|
|
191
|
+
// The actual storage engine currently in use for reads/writes is always
|
|
192
|
+
// LanceDB (memory-bridge.ts) — report the real on-disk path, not the
|
|
193
|
+
// configured (but not-yet-wired) backend's path.
|
|
194
|
+
const backendStats = await bridgeGetBackendStats();
|
|
195
|
+
const realLocation = bridgeGetDbPath();
|
|
188
196
|
const statsResult = {
|
|
189
197
|
totalEntries: entries.length,
|
|
190
198
|
totalSize: totalBytes >= 1048576 ? `${(totalBytes / 1048576).toFixed(1)} MB`
|
|
191
199
|
: totalBytes >= 1024 ? `${(totalBytes / 1024).toFixed(1)} KB` : `${totalBytes} B`,
|
|
192
200
|
version: 'lancedb',
|
|
193
|
-
backend:
|
|
194
|
-
location:
|
|
201
|
+
backend: `LanceDB (configured: ${configuredBackend})`,
|
|
202
|
+
location: realLocation,
|
|
195
203
|
oldestEntry: times[0] ? new Date(times[0]).toISOString() : null,
|
|
196
204
|
newestEntry: times.length ? new Date(times[times.length - 1]).toISOString() : null,
|
|
197
205
|
};
|
|
@@ -199,7 +207,7 @@ export const statsCommand = {
|
|
|
199
207
|
backend: statsResult.backend,
|
|
200
208
|
entries: {
|
|
201
209
|
total: statsResult.totalEntries,
|
|
202
|
-
vectors:
|
|
210
|
+
vectors: backendStats?.totalEntries ?? statsResult.totalEntries,
|
|
203
211
|
text: statsResult.totalEntries
|
|
204
212
|
},
|
|
205
213
|
storage: {
|
|
@@ -243,8 +251,6 @@ export const statsCommand = {
|
|
|
243
251
|
{ metric: 'Newest Entry', value: stats.newestEntry || 'N/A' }
|
|
244
252
|
]
|
|
245
253
|
});
|
|
246
|
-
output.writeln();
|
|
247
|
-
output.printInfo('v1 Performance: O(log n) pure-JS HNSW vector search');
|
|
248
254
|
return { success: true, data: stats };
|
|
249
255
|
}
|
|
250
256
|
catch (error) {
|
|
@@ -18,32 +18,25 @@ export const exportCommand = {
|
|
|
18
18
|
{
|
|
19
19
|
name: 'format',
|
|
20
20
|
short: 'f',
|
|
21
|
-
description: 'Export format (
|
|
21
|
+
description: 'Export format (only okf is currently implemented)',
|
|
22
22
|
type: 'string',
|
|
23
|
-
choices: ['
|
|
24
|
-
default: '
|
|
23
|
+
choices: ['okf'],
|
|
24
|
+
default: 'okf'
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
27
|
name: 'namespace',
|
|
28
28
|
short: 'n',
|
|
29
29
|
description: 'Export specific namespace',
|
|
30
30
|
type: 'string'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
name: 'include-vectors',
|
|
34
|
-
description: 'Include vector embeddings',
|
|
35
|
-
type: 'boolean',
|
|
36
|
-
default: true
|
|
37
31
|
}
|
|
38
32
|
],
|
|
39
33
|
examples: [
|
|
40
|
-
{ command: 'monomind memory export -o ./backup
|
|
41
|
-
{ command: 'monomind memory export -o ./data.csv -f csv', description: 'Export to CSV' },
|
|
34
|
+
{ command: 'monomind memory export -o ./backup', description: 'Export all as OKF bundle (directory of .md files)' },
|
|
42
35
|
{ command: 'monomind memory export -o ./knowledge -f okf', description: 'Export as OKF bundle (directory of .md files)' }
|
|
43
36
|
],
|
|
44
37
|
action: async (ctx) => {
|
|
45
38
|
const outputPath = ctx.flags.output;
|
|
46
|
-
const format = ctx.flags.format || '
|
|
39
|
+
const format = ctx.flags.format || 'okf';
|
|
47
40
|
if (!outputPath) {
|
|
48
41
|
output.printError('Output path is required. Use --output or -o');
|
|
49
42
|
return { success: false, exitCode: 1 };
|
|
@@ -87,7 +80,7 @@ export const exportCommand = {
|
|
|
87
80
|
return { success: false, exitCode: 1 };
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
|
-
output.printError(`
|
|
83
|
+
output.printError(`Format '${format}' is not yet implemented. Use --format okf (the only supported format).`);
|
|
91
84
|
return { success: false, exitCode: 1 };
|
|
92
85
|
}
|
|
93
86
|
};
|
|
@@ -105,10 +105,10 @@ const buildCommand = {
|
|
|
105
105
|
const progressLines = [];
|
|
106
106
|
try {
|
|
107
107
|
const { buildAsync } = await import('@monoes/monograph');
|
|
108
|
-
// llmMaxSections is a UI variable only; not a valid BuildOptions key in @monoes/monograph@1.1.0
|
|
109
108
|
await buildAsync(root, {
|
|
110
109
|
codeOnly,
|
|
111
110
|
force,
|
|
111
|
+
llmMaxSections,
|
|
112
112
|
onProgress: (p) => {
|
|
113
113
|
const msg = `[${p.phase}] ${p.message ?? ''}`;
|
|
114
114
|
progressLines.push(msg);
|
|
@@ -200,10 +200,10 @@ const wikiCommand = {
|
|
|
200
200
|
const progressLines = [];
|
|
201
201
|
try {
|
|
202
202
|
const { buildAsync } = await import('@monoes/monograph');
|
|
203
|
-
// llmMaxSections is a UI variable only; not a valid BuildOptions key in @monoes/monograph@1.1.0
|
|
204
203
|
await buildAsync(root, {
|
|
205
204
|
codeOnly: false,
|
|
206
205
|
force,
|
|
206
|
+
llmMaxSections,
|
|
207
207
|
onProgress: (p) => {
|
|
208
208
|
const msg = `[${p.phase}] ${p.message ?? ''}`;
|
|
209
209
|
progressLines.push(msg);
|
|
@@ -408,7 +408,7 @@ const watchCommand = {
|
|
|
408
408
|
const watcher = new MonographWatcher(root);
|
|
409
409
|
watcher.on('monograph:updated', () => {
|
|
410
410
|
output.writeln(output.dim(' [watch] File change detected, rebuilding…'));
|
|
411
|
-
buildAsync(root, { codeOnly: false }).catch((err) => {
|
|
411
|
+
buildAsync(root, { codeOnly: false, llmMaxSections }).catch((err) => {
|
|
412
412
|
output.writeln(output.dim(` [watch] Rebuild error: ${err.message}`));
|
|
413
413
|
});
|
|
414
414
|
});
|