@monoes/monomindcli 1.10.1 → 1.10.2

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: monomind:understand
3
- description: "Monomind — Run semantic enrichment on the current project's monograph knowledge graph"
3
+ description: "Monomind — Run semantic enrichment on the current project's monograph knowledge graph. No external plugin needed — the analysis engine ships with monomind."
4
4
  ---
5
5
 
6
6
  # /monomind:understand — Semantic Enrichment
@@ -8,18 +8,25 @@ description: "Monomind — Run semantic enrichment on the current project's mono
8
8
  Enriches the current project's monograph knowledge graph with LLM-generated summaries,
9
9
  architectural layers, and semantic relationships.
10
10
 
11
- Parse `$ARGUMENTS` for the flags below.
11
+ The analysis engine is built into monomind — no external plugin installation required.
12
12
 
13
13
  ## Parse Arguments
14
14
 
15
15
  Parse `$ARGUMENTS` for these optional flags:
16
16
 
17
- - `--dir <path>` — project directory to analyze (default: current working directory)
18
- - `--db <path>` — path to monograph.db (default: `<dir>/.monomind/monograph.db`)
19
- - `--import` — import an existing graph.json only (skip running /understand)
20
- - `--graph <path>` — explicit path to a UA graph.json file to import
21
- - `--full` — force full re-analysis even if graph.json is recent
22
- - `--dry-run` show what would happen without writing to DB
17
+ - `--dir <path>` — project directory to analyze (default: current working directory)
18
+ - `--db <path>` — path to monograph.db (default: `<dir>/.monomind/monograph.db`)
19
+ - `--import` — import an existing graph.json only (skip analysis, run ua-import.mjs)
20
+ - `--graph <path>` — explicit path to a graph.json to import (implies `--import`)
21
+ - `--full` — force full re-analysis even if graph.json is recent
22
+ - `--no-llm` heuristic-only mode: detect layers from file paths, no API calls
23
+ - `--layers-only` — skip per-file analysis, only (re-)detect architectural layers
24
+ - `--incremental` — re-analyze only files changed since the last run (uses git diff)
25
+ - `--onboard` — generate an ONBOARDING.md guide from the enriched graph
26
+ - `--onboard-out <path>` — where to write the onboarding guide (default: `<dir>/ONBOARDING.md`)
27
+ - `--batch-size <N>` — files per LLM batch (default: 5, increase for faster analysis)
28
+ - `--max-files <N>` — stop after N files (0 = all)
29
+ - `--dry-run` — show what would happen without writing to DB
23
30
 
24
31
  If no flags, treat any bare path argument as `--dir`.
25
32
 
@@ -43,108 +50,142 @@ DB="${ARGUMENTS_db:-$DIR/.monomind/monograph.db}"
43
50
 
44
51
  ---
45
52
 
46
- ## Step 2: Check for existing UA graph.json
53
+ ## Step 2: Locate the built-in analysis engine
47
54
 
48
- Look for `$DIR/.understand/knowledge-graph.json`, `$DIR/.understand/graph.json`, and `$DIR/.ua/graph.json` (in that order).
55
+ The `understand-analyze.mjs` script ships with `@monomind/cli`. Find it:
49
56
 
50
- If `--graph <path>` was supplied, use that path instead.
57
+ ```bash
58
+ # Try npm root (global install / homebrew)
59
+ GLOBAL_ROOT=$(npm root -g 2>/dev/null)
60
+ SCRIPT="$GLOBAL_ROOT/@monomind/cli/scripts/understand-analyze.mjs"
61
+
62
+ # If not found globally, try npx resolve
63
+ if [ ! -f "$SCRIPT" ]; then
64
+ SCRIPT=$(node -e "try{console.log(require.resolve('@monomind/cli/scripts/understand-analyze.mjs'))}catch{}" 2>/dev/null)
65
+ fi
66
+
67
+ # Fallback: walk up from the running CLI's __dirname
68
+ if [ ! -f "$SCRIPT" ]; then
69
+ SCRIPT=$(node -e "
70
+ const {createRequire} = require('module');
71
+ const r = createRequire(require.resolve('monomind'));
72
+ try { console.log(r.resolve('@monomind/cli/scripts/understand-analyze.mjs')); } catch {}
73
+ " 2>/dev/null)
74
+ fi
75
+ ```
76
+
77
+ If the script is still not found:
78
+ > The built-in understand engine (understand-analyze.mjs) was not found.
79
+ > Update monomind: `npm install -g monomind@latest`
51
80
 
52
- **If a graph.json is found AND `--full` was NOT set:**
81
+ And STOP.
82
+
83
+ ---
53
84
 
54
- Report the file age:
85
+ ## Step 3: Check for existing graph.json (unless `--full`)
86
+
87
+ Look for (in order):
88
+ - `$DIR/.understand/knowledge-graph.json`
89
+ - `$DIR/.understand/graph.json`
90
+ - `$DIR/.ua/graph.json`
91
+
92
+ If `--graph <path>` was supplied, use that path directly.
93
+
94
+ **If a recent graph.json is found AND `--full` was NOT set:**
95
+
96
+ Report the file age and jump to **Step 5: Import**:
55
97
  ```
56
98
  Found graph.json (X hours old) — importing into monograph…
57
99
  ```
58
100
 
59
- Jump to **Step 4: Import**.
60
-
61
- **If no graph.json is found OR `--full` was set:**
101
+ **If `--import` or `--graph` was set:**
102
+ Jump directly to **Step 5: Import**.
62
103
 
63
- Proceed to **Step 3: Run understand analysis**.
104
+ **Otherwise:**
105
+ Proceed to **Step 4: Run analysis**.
64
106
 
65
107
  ---
66
108
 
67
- ## Step 3: Run understand analysis
109
+ ## Step 4: Run built-in analysis
68
110
 
69
- Locate the understand plugin. Check these paths in order:
70
- 1. `$UA_PLUGIN_DIR` (if set)
71
- 2. `$HOME/tools/understand-anything/understand-anything-plugin`
72
- 3. Sibling directory: `../understand-anything/understand-anything-plugin` relative to the project root
111
+ Run the built-in engine. Build the command from parsed flags:
73
112
 
74
- If the plugin is NOT found, tell the user:
75
- > understand plugin not found. Set `UA_PLUGIN_DIR` to its location, or clone it:
76
- > ```bash
77
- > git clone https://github.com/nicholasgasior/understand-anything \
78
- > ~/tools/understand-anything
79
- > export UA_PLUGIN_DIR=~/tools/understand-anything/understand-anything-plugin
80
- > ```
81
- And STOP.
82
-
83
- **If found:**
113
+ ```bash
114
+ node "$SCRIPT" \
115
+ --dir "$DIR" \
116
+ --db "$DB" \
117
+ [--no-llm] # if --no-llm was set
118
+ [--layers-only] # if --layers-only was set
119
+ [--incremental] # if --incremental was set
120
+ [--onboard] # if --onboard was set
121
+ [--onboard-out PATH] # if --onboard-out was set
122
+ [--dry-run] # if --dry-run was set
123
+ [--batch-size N] # if --batch-size was set
124
+ [--max-files N] # if --max-files was set
125
+ ```
84
126
 
85
- Use the Agent tool to run the `/understand` skill on `$DIR`.
86
- The skill produces `.understand/graph.json` in the target directory.
127
+ The script will:
128
+ 1. Read all file nodes from the monograph DB
129
+ 2. For each file, call the Anthropic API (via `ANTHROPIC_API_KEY`) to get summaries, tags, and complexity
130
+ 3. Detect architectural layers (LLM-based if API key available, heuristic fallback otherwise)
131
+ 4. Write enrichment data back to `monograph.db` (community_id + properties JSON)
132
+ 5. Emit a `graph.json` to `$DIR/.understand/knowledge-graph.json`
87
133
 
88
- Instruct the spawned agent:
89
- - Project directory: `$DIR`
90
- - Run the full `/understand` pipeline (project-scanner → file-analyzer → architecture-analyzer → tour-builder)
91
- - Save the resulting graph.json to `$DIR/.understand/graph.json`
92
- - Report back when done with node/edge/layer counts
134
+ If `ANTHROPIC_API_KEY` is not set, the script automatically falls back to `--no-llm` mode — heuristic layer detection from file paths, no per-file summaries. Tell the user this happened.
93
135
 
94
- Wait for completion before proceeding.
136
+ Wait for the script to complete before proceeding.
95
137
 
96
138
  ---
97
139
 
98
- ## Step 4: Import graph.json into monograph DB
140
+ ## Step 5: Import (only when using an existing graph.json)
99
141
 
100
- Run the import script:
142
+ If jumping here from Step 3 (existing graph.json found):
101
143
 
102
144
  ```bash
103
145
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
104
- node "$REPO_ROOT/scripts/ua-import.mjs" "$GRAPH_JSON" "$DB"
146
+ IMPORT_SCRIPT="$REPO_ROOT/scripts/ua-import.mjs"
147
+ # fallback: alongside understand-analyze.mjs
148
+ [ ! -f "$IMPORT_SCRIPT" ] && IMPORT_SCRIPT="$(dirname $SCRIPT)/../../../scripts/ua-import.mjs"
149
+ node "$IMPORT_SCRIPT" "$GRAPH_JSON" "$DB"
105
150
  ```
106
151
 
107
- Where:
108
- - `$GRAPH_JSON` is the graph.json path (found in Step 2 or produced in Step 3)
109
- - `$DB` is the monograph.db path
110
-
111
- If `--dry-run` was set, instead read graph.json and report what WOULD be written:
112
- - Number of nodes to enrich / insert
113
- - Number of edges to add
114
- - Layers that would become communities
115
- Do NOT write to the DB.
152
+ If `--dry-run` was set, report what would be imported without writing to the DB.
116
153
 
117
154
  ---
118
155
 
119
- ## Step 5: Report results
156
+ ## Step 6: Report results
120
157
 
121
- After import completes, show a summary table:
158
+ After the analysis or import completes, show a summary:
122
159
 
123
160
  ```
124
- ╔══════════════════════════════════════════╗
125
- ║ /monomind:understand — Enrichment Done
126
- ╠══════════════════════════════════════════╣
127
- ║ DB: .monomind/monograph.db
128
- ║ Nodes enriched: <N>
129
- Nodes inserted: <N>
130
- Edges added: <N>
131
- ║ Communities: <N> (from UA layers) ║
132
- ╚══════════════════════════════════════════╝
161
+ ╔══════════════════════════════════════════════════╗
162
+ ║ /monomind:understand — Enrichment Done
163
+ ╠══════════════════════════════════════════════════╣
164
+ ║ DB: .monomind/monograph.db
165
+ ║ Nodes enriched: <N>
166
+ Communities: <N> (layers detected)
167
+ graph.json: .understand/knowledge-graph.json
168
+ ╚══════════════════════════════════════════════════╝
133
169
  ```
134
170
 
135
171
  Then tell the user:
136
172
  > The monograph graph is now enriched with semantic summaries and architectural layers.
137
173
  > Open the Monomind control panel and click **Monograph → GRAPH** to see multi-color layers.
138
- > Each color now represents an architectural layer (API, Service, Data, UI, etc.).
139
-
140
- If any nodes were skipped (unresolved edges), report the count but do NOT treat it as an error.
141
-
142
- To repeat this command on a schedule, wrap it with `/monomind:repeat`.
174
+ > Each color represents an architectural layer (API, Service, Data, UI, etc.).
175
+ >
176
+ > To re-run with full LLM analysis: `/monomind:understand --full`
177
+ > To only refresh layer detection: `/monomind:understand --layers-only`
178
+ > To run without API calls: `/monomind:understand --no-llm`
179
+ > To re-analyze only changed files: `/monomind:understand --incremental`
180
+ > To generate an onboarding guide: `/monomind:understand --onboard`
143
181
 
144
182
  ---
145
183
 
146
184
  ## Error Handling
147
185
 
148
- - If `ua-import.mjs` exits non-zero, show stderr and suggest running `pnpm install` from the monomind root.
149
- - If graph.json is malformed JSON, report the parse error and suggest re-running `/understand`.
186
+ - If `ANTHROPIC_API_KEY` is not set, automatically use heuristic mode report this clearly but do NOT stop.
187
+ - If the script exits non-zero, show stderr and suggest `npm install -g monomind@latest`.
188
+ - If monograph.db has no file nodes, tell the user to run `npx monomind monograph build` first.
150
189
  - All errors are non-fatal to the main session — report and return cleanly.
190
+
191
+ To repeat this command on a schedule, wrap it with `/monomind:repeat`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
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",
@@ -69,6 +69,7 @@
69
69
  "bin",
70
70
  ".claude",
71
71
  "bundled-graph",
72
+ "scripts",
72
73
  "README.md"
73
74
  ],
74
75
  "scripts": {
@@ -111,4 +112,4 @@
111
112
  "access": "public",
112
113
  "tag": "latest"
113
114
  }
114
- }
115
+ }
@@ -0,0 +1,153 @@
1
+ #!/bin/bash
2
+ #
3
+ # Deploy IPFS Node to Google Cloud
4
+ # Provides free IPFS pinning for your users
5
+ #
6
+ # Usage:
7
+ # ./deploy-ipfs-node.sh [PROJECT_ID] [ZONE]
8
+ #
9
+ # Example:
10
+ # ./deploy-ipfs-node.sh my-project us-central1-a
11
+ #
12
+
13
+ set -e
14
+
15
+ PROJECT_ID="${1:-$(gcloud config get-value project)}"
16
+ ZONE="${2:-us-central1-a}"
17
+ INSTANCE_NAME="ipfs-node"
18
+ MACHINE_TYPE="e2-medium" # $25/month, use e2-small for $8/month
19
+ DISK_SIZE="100GB"
20
+
21
+ echo "╔══════════════════════════════════════════════════════════════╗"
22
+ echo "║ IPFS Node Deployment for Monomind ║"
23
+ echo "╚══════════════════════════════════════════════════════════════╝"
24
+ echo ""
25
+ echo "Project: $PROJECT_ID"
26
+ echo "Zone: $ZONE"
27
+ echo "Machine: $MACHINE_TYPE"
28
+ echo "Disk: $DISK_SIZE"
29
+ echo ""
30
+
31
+ # Create firewall rules
32
+ echo "▶ Creating firewall rules..."
33
+ gcloud compute firewall-rules create ipfs-swarm \
34
+ --project="$PROJECT_ID" \
35
+ --allow=tcp:4001,udp:4001 \
36
+ --target-tags=ipfs-node \
37
+ --description="IPFS swarm connections" \
38
+ 2>/dev/null || echo " (firewall rule already exists)"
39
+
40
+ gcloud compute firewall-rules create ipfs-api \
41
+ --project="$PROJECT_ID" \
42
+ --allow=tcp:5001 \
43
+ --target-tags=ipfs-node \
44
+ --source-ranges="0.0.0.0/0" \
45
+ --description="IPFS API (consider restricting)" \
46
+ 2>/dev/null || echo " (firewall rule already exists)"
47
+
48
+ gcloud compute firewall-rules create ipfs-gateway \
49
+ --project="$PROJECT_ID" \
50
+ --allow=tcp:8080 \
51
+ --target-tags=ipfs-node \
52
+ --description="IPFS Gateway" \
53
+ 2>/dev/null || echo " (firewall rule already exists)"
54
+
55
+ # Create startup script
56
+ STARTUP_SCRIPT='#!/bin/bash
57
+ set -e
58
+
59
+ # Install IPFS
60
+ echo "Installing IPFS..."
61
+ wget -q https://dist.ipfs.tech/kubo/v0.24.0/kubo_v0.24.0_linux-amd64.tar.gz
62
+ tar xzf kubo_v0.24.0_linux-amd64.tar.gz
63
+ cd kubo && sudo bash install.sh
64
+ cd .. && rm -rf kubo kubo_v0.24.0_linux-amd64.tar.gz
65
+
66
+ # Create ipfs user
67
+ sudo useradd -m -s /bin/bash ipfs || true
68
+
69
+ # Initialize IPFS
70
+ sudo -u ipfs IPFS_PATH=/home/ipfs/.ipfs ipfs init --profile=server
71
+
72
+ # Configure IPFS for server use
73
+ sudo -u ipfs IPFS_PATH=/home/ipfs/.ipfs ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
74
+ sudo -u ipfs IPFS_PATH=/home/ipfs/.ipfs ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
75
+ sudo -u ipfs IPFS_PATH=/home/ipfs/.ipfs ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"*\"]"
76
+ sudo -u ipfs IPFS_PATH=/home/ipfs/.ipfs ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"POST\", \"GET\"]"
77
+
78
+ # Set storage limits (adjust as needed)
79
+ sudo -u ipfs IPFS_PATH=/home/ipfs/.ipfs ipfs config Datastore.StorageMax 80GB
80
+
81
+ # Create systemd service
82
+ cat > /etc/systemd/system/ipfs.service << EOF
83
+ [Unit]
84
+ Description=IPFS Daemon
85
+ After=network.target
86
+
87
+ [Service]
88
+ Type=simple
89
+ User=ipfs
90
+ Environment=IPFS_PATH=/home/ipfs/.ipfs
91
+ ExecStart=/usr/local/bin/ipfs daemon --migrate=true
92
+ Restart=on-failure
93
+ RestartSec=10
94
+
95
+ [Install]
96
+ WantedBy=multi-user.target
97
+ EOF
98
+
99
+ # Start IPFS
100
+ systemctl daemon-reload
101
+ systemctl enable ipfs
102
+ systemctl start ipfs
103
+
104
+ echo "IPFS node started successfully!"
105
+ '
106
+
107
+ # Create instance
108
+ echo "▶ Creating VM instance..."
109
+ gcloud compute instances create "$INSTANCE_NAME" \
110
+ --project="$PROJECT_ID" \
111
+ --zone="$ZONE" \
112
+ --machine-type="$MACHINE_TYPE" \
113
+ --image-family=ubuntu-2204-lts \
114
+ --image-project=ubuntu-os-cloud \
115
+ --boot-disk-size="$DISK_SIZE" \
116
+ --boot-disk-type=pd-ssd \
117
+ --tags=ipfs-node \
118
+ --metadata=startup-script="$STARTUP_SCRIPT"
119
+
120
+ # Get external IP
121
+ echo ""
122
+ echo "▶ Waiting for instance to start..."
123
+ sleep 30
124
+
125
+ EXTERNAL_IP=$(gcloud compute instances describe "$INSTANCE_NAME" \
126
+ --project="$PROJECT_ID" \
127
+ --zone="$ZONE" \
128
+ --format='get(networkInterfaces[0].accessConfigs[0].natIP)')
129
+
130
+ echo ""
131
+ echo "═══════════════════════════════════════════════════════════════"
132
+ echo " DEPLOYMENT COMPLETE"
133
+ echo "═══════════════════════════════════════════════════════════════"
134
+ echo ""
135
+ echo " IPFS Node IP: $EXTERNAL_IP"
136
+ echo ""
137
+ echo " Endpoints:"
138
+ echo " API: http://$EXTERNAL_IP:5001"
139
+ echo " Gateway: http://$EXTERNAL_IP:8080"
140
+ echo " Swarm: /ip4/$EXTERNAL_IP/tcp/4001"
141
+ echo ""
142
+ echo " Test commands:"
143
+ echo " curl http://$EXTERNAL_IP:5001/api/v0/id"
144
+ echo " curl http://$EXTERNAL_IP:8080/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme"
145
+ echo ""
146
+ echo " Configure Monomind CLI:"
147
+ echo " export IPFS_API_URL=http://$EXTERNAL_IP:5001"
148
+ echo ""
149
+ echo " SSH into node:"
150
+ echo " gcloud compute ssh $INSTANCE_NAME --zone=$ZONE"
151
+ echo ""
152
+ echo " Monthly cost estimate: ~\$25-54 depending on usage"
153
+ echo ""