mantisai-cli 2.0.1 → 3.0.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/README.md +26 -99
- package/bin/mantis.js +406 -23
- package/lib/constants.js +13 -0
- package/lib/container.js +63 -0
- package/lib/impl/claude-skills-service.js +13 -0
- package/lib/impl/fast-glob-codebase-indexer.js +114 -0
- package/lib/impl/file-config-store.js +38 -0
- package/lib/impl/fs-csv-reader.js +12 -0
- package/lib/impl/http-mantis-client.js +108 -0
- package/lib/impl/inquirer-ui-service.js +73 -0
- package/lib/impl/mcp-client-service.js +64 -0
- package/lib/impl/opencode-skills-service.js +17 -0
- package/lib/impl/space-repository.js +72 -0
- package/lib/interfaces/codebase-indexer.js +5 -0
- package/lib/interfaces/config-store.js +11 -0
- package/lib/interfaces/csv-reader.js +5 -0
- package/lib/interfaces/index.js +7 -0
- package/lib/interfaces/mantis-client.js +13 -0
- package/lib/interfaces/mcp-client.js +6 -0
- package/lib/interfaces/space-repository.js +13 -0
- package/lib/interfaces/ui.js +13 -0
- package/lib/services/context-service.js +22 -0
- package/lib/services/map-service.js +114 -0
- package/lib/services/query-service.js +50 -0
- package/lib/services/selection-service.js +174 -0
- package/lib/services/setup-service.js +81 -0
- package/lib/services/tool-service.js +26 -0
- package/lib/types.js +30 -0
- package/lib/utils/cli-args.js +29 -0
- package/lib/utils/package-root.js +7 -0
- package/lib/utils/skills-sync.js +43 -0
- package/lib/{space-id.js → utils/space-id.js} +0 -1
- package/lib/utils/threads.js +12 -0
- package/lib/utils/tool-args.js +38 -0
- package/lib/utils/url.js +33 -0
- package/package.json +4 -7
- package/skills/codebase/SKILL.md +8 -6
- package/skills/connect/SKILL.md +10 -26
- package/skills/createmap/SKILL.md +5 -3
- package/skills/mantis/SKILL.md +48 -32
- package/skills/select/SKILL.md +12 -9
- package/skills/space/SKILL.md +10 -47
- package/skills/status/SKILL.md +4 -9
- package/skills/thread/SKILL.md +15 -27
- package/.claude-plugin/marketplace.json +0 -14
- package/.claude-plugin/plugin.json +0 -18
- package/.mcp.json +0 -11
- package/bin/mantis-list-spaces.js +0 -32
- package/bin/mantis-list-threads.js +0 -32
- package/bin/mantis-mcp-headers.js +0 -9
- package/bin/mantis-pick-space.js +0 -5
- package/bin/mantis-pick-thread.js +0 -5
- package/bin/mantis-resolve-space.js +0 -25
- package/bin/mantis-select.js +0 -7
- package/bin/mantis-set-space.js +0 -31
- package/bin/mantis-set-thread.js +0 -34
- package/bin/mantis-setup.js +0 -59
- package/bin/mantis-status.js +0 -15
- package/lib/api.js +0 -100
- package/lib/claude-plugin.js +0 -150
- package/lib/codebase-csv.js +0 -115
- package/lib/config.js +0 -65
- package/lib/csv.js +0 -10
- package/lib/fetch.js +0 -36
- package/lib/list-cli.js +0 -55
- package/lib/map-create.js +0 -148
- package/lib/mcp-config.js +0 -50
- package/lib/picker.js +0 -150
- package/lib/spaces.js +0 -48
- package/lib/ui.js +0 -73
- /package/lib/{fields.js → utils/fields.js} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mantisai-cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Mantis
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Mantis CLI — spaces, maps, and MCP tools for AI coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "AnasMaar",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@inquirer/prompts": "^7.5.1",
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
21
22
|
"commander": "^13.1.0",
|
|
22
23
|
"csv-parse": "^6.2.1",
|
|
23
24
|
"csv-stringify": "^6.7.0",
|
|
@@ -27,9 +28,6 @@
|
|
|
27
28
|
"mantis": "bin/mantis.js"
|
|
28
29
|
},
|
|
29
30
|
"files": [
|
|
30
|
-
".claude-plugin",
|
|
31
|
-
".claude-plugin/marketplace.json",
|
|
32
|
-
".mcp.json",
|
|
33
31
|
"skills",
|
|
34
32
|
"bin",
|
|
35
33
|
"lib",
|
|
@@ -43,7 +41,6 @@
|
|
|
43
41
|
"mantis",
|
|
44
42
|
"cli",
|
|
45
43
|
"mcp",
|
|
46
|
-
"
|
|
47
|
-
"plugin"
|
|
44
|
+
"ai-agents"
|
|
48
45
|
]
|
|
49
46
|
}
|
package/skills/codebase/SKILL.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Index a local codebase into a CSV for Mantis
|
|
2
|
+
description: Index a local codebase into a CSV for Mantis. Run `mantis use get_space_context` first when Mantis is mentioned.
|
|
3
3
|
argument-hint: [repo-path]
|
|
4
4
|
allowed-tools: Bash, AskUserQuestion
|
|
5
5
|
disable-model-invocation: true
|
|
@@ -7,6 +7,8 @@ disable-model-invocation: true
|
|
|
7
7
|
|
|
8
8
|
# Create Codebase CSV
|
|
9
9
|
|
|
10
|
+
First: `mantis use get_space_context` (unless you just ran it this turn).
|
|
11
|
+
|
|
10
12
|
Use `mantis create codebase`. This command is local-first: it scans files on the user's machine and writes a CSV. It can optionally continue into `mantis create map`.
|
|
11
13
|
|
|
12
14
|
## CSV-only Flow
|
|
@@ -52,15 +54,15 @@ The command uses good defaults for codebase maps:
|
|
|
52
54
|
- `categoric`: `language,kind,extension`
|
|
53
55
|
- `numeric`: `loc,bytes`
|
|
54
56
|
|
|
55
|
-
## After
|
|
57
|
+
## After activation
|
|
56
58
|
|
|
57
|
-
If `--activate` was used,
|
|
59
|
+
If `--activate` was used, the new thread is active immediately. Explore with:
|
|
58
60
|
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
+
```bash
|
|
62
|
+
mantis use get_space_context
|
|
61
63
|
```
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
Example follow-up questions:
|
|
64
66
|
|
|
65
67
|
```text
|
|
66
68
|
What are the main architectural zones in this codebase?
|
package/skills/connect/SKILL.md
CHANGED
|
@@ -1,42 +1,26 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Run
|
|
3
|
-
disable-model-invocation: true
|
|
2
|
+
description: Run mantis setup to connect API key, space, and thread. Use when the user wants to connect to Mantis or fix auth issues. After setup, run `mantis use get_space_context`.
|
|
4
3
|
---
|
|
5
4
|
|
|
6
|
-
# Connect Mantis
|
|
5
|
+
# Connect to Mantis
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
If already configured, run `mantis use get_space_context` first. Otherwise:
|
|
9
8
|
|
|
10
9
|
```bash
|
|
11
10
|
mantis setup
|
|
12
11
|
```
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
Setup only prompts for space/thread if they are not already configured.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/mantis.js" setup
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
The wizard will:
|
|
21
|
-
|
|
22
|
-
1. Ask for Mantis API URL and Developer API key (`live_…` from the Mantis Developer portal).
|
|
23
|
-
2. List accessible spaces — owned, shared, and public (most recent first).
|
|
24
|
-
3. Pick or create a **space state** (thread).
|
|
25
|
-
4. Save config for MCP headers (`X-Space-State-ID`).
|
|
26
|
-
|
|
27
|
-
After setup, switch context with **`/mantis:space`** and **`/mantis:thread`** (Claude Code **AskUserQuestion** menu with arrow keys). Terminal: `mantis select space` / `mantis select thread`.
|
|
28
|
-
|
|
29
|
-
If they have not run **`mantis setup`** yet, tell them:
|
|
15
|
+
Then verify:
|
|
30
16
|
|
|
31
17
|
```bash
|
|
32
|
-
|
|
33
|
-
mantis
|
|
18
|
+
mantis status
|
|
19
|
+
mantis use get_space_context
|
|
34
20
|
```
|
|
35
21
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Then: **`/reload-plugins`** in Claude Code (if already open). Confirm **API URL** when prompted (default `https://kellis-h200-1.csail.mit.edu`; use `http://localhost:8000` for local Docker). API keys: https://mantis.csail.mit.edu/developer/#keys
|
|
22
|
+
First-time Claude Code users: `mantis setup claude` installs skills to `~/.claude/skills/`.
|
|
39
23
|
|
|
40
|
-
|
|
24
|
+
API keys: https://mantis.csail.mit.edu/developer/#keys
|
|
41
25
|
|
|
42
|
-
|
|
26
|
+
If `mantis use` fails with "No thread configured", run `mantis select thread`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Create a Mantis map from a local CSV or XLSX file using the mantis CLI.
|
|
2
|
+
description: Create a Mantis map from a local CSV or XLSX file using the mantis CLI. Run `mantis use get_space_context` first when Mantis is mentioned.
|
|
3
3
|
argument-hint: [csv-or-xlsx-path]
|
|
4
4
|
allowed-tools: Bash, AskUserQuestion
|
|
5
5
|
disable-model-invocation: true
|
|
@@ -7,6 +7,8 @@ disable-model-invocation: true
|
|
|
7
7
|
|
|
8
8
|
# Create Mantis Map
|
|
9
9
|
|
|
10
|
+
First: `mantis use get_space_context` (unless you just ran it this turn).
|
|
11
|
+
|
|
10
12
|
Use the local `mantis create map` CLI. Prefer passing arguments explicitly so this works for agents and humans.
|
|
11
13
|
|
|
12
14
|
## Steps
|
|
@@ -53,10 +55,10 @@ mantis create map "./dataset.csv" \
|
|
|
53
55
|
--semantic-column "summary,content"
|
|
54
56
|
```
|
|
55
57
|
|
|
56
|
-
5. Report the created space link and map id from the JSON output.
|
|
58
|
+
5. Report the created space link and map id from the JSON output.
|
|
57
59
|
|
|
58
60
|
## Notes
|
|
59
61
|
|
|
60
62
|
- If the user wants a fully interactive human flow, run only `mantis create map "./dataset.csv"`.
|
|
61
|
-
- If
|
|
63
|
+
- If an agent is driving the flow, avoid interactive prompts by passing flags.
|
|
62
64
|
- Use `mantis setup` first if the CLI says API key or URL is missing.
|
package/skills/mantis/SKILL.md
CHANGED
|
@@ -1,52 +1,68 @@
|
|
|
1
1
|
---
|
|
2
|
+
name: mantis
|
|
3
|
+
description: Work with MIT Mantis spaces, maps, clusters, and notebooks via the mantis CLI. Use whenever the user mentions Mantis. Always run `mantis use get_space_context` first before any other Mantis action.
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
description: Work with MIT Mantis spaces, maps, clusters, and notebooks via MCP. Use when the user mentions Mantis, spaces, maps, embeddings, clusters, bags, or wants to explore/visualize data in their workspace.
|
|
6
|
+
# Mantis
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
Mantis is a spatial data workspace: **spaces** contain **maps**, **clusters**, **bags**, and **notebooks**.
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
## First step
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
Run this **before any other Mantis command or tool** (skip only if you already ran it this turn):
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
4. After changing space/thread: `mantis select` then ask the user to run `**/reload-plugins**`.
|
|
14
|
+
```bash
|
|
15
|
+
mantis use get_space_context
|
|
16
|
+
```
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
If it fails with no thread configured, run `mantis setup` or `mantis select thread`, then retry.
|
|
18
19
|
|
|
20
|
+
## Setup
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
```bash
|
|
23
|
+
mantis setup # API key + space + thread (only prompts what's missing)
|
|
24
|
+
mantis status
|
|
25
|
+
mantis select space
|
|
26
|
+
mantis select thread
|
|
27
|
+
```
|
|
25
28
|
|
|
29
|
+
Config lives at `~/.mantis/config.json`.
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
Install editor skills (CLI-only workflow, no MCP plugin):
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
```bash
|
|
34
|
+
mantis setup claude # ~/.claude/skills/
|
|
35
|
+
mantis setup opencode # ~/.config/opencode/skills/ + .opencode/skills/
|
|
36
|
+
```
|
|
30
37
|
|
|
31
|
-
|
|
38
|
+
## MCP tools via CLI
|
|
32
39
|
|
|
33
|
-
|
|
40
|
+
Every Mantis MCP tool is available through the CLI — no editor MCP plugin required:
|
|
34
41
|
|
|
35
|
-
|
|
42
|
+
```bash
|
|
43
|
+
mantis tools
|
|
44
|
+
mantis use get_space_context
|
|
45
|
+
mantis use get_cluster_children --map-id <uuid> --cluster-id <id>
|
|
46
|
+
mantis use general_search --query "your search"
|
|
47
|
+
```
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
Use `--args '{"key":"value"}'` for complex arguments. Kebab flags map to snake_case (`--map-id` → `map_id`).
|
|
50
|
+
|
|
51
|
+
Use map IDs, field types, and cluster names from the `get_space_context` output — do not guess them.
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
- Maps belong to a space; pick `primary_map_id` from space list API or `get_space_context`.
|
|
41
|
-
- Notebooks can bootstrap from `X-Space-State-ID` alone; file uploads still need a chat session when applicable.
|
|
42
|
-
- Default API URL: `https://kellis-h200-1.csail.mit.edu` (local: `http://localhost:8000`). API keys: https://mantis.csail.mit.edu/developer/#keys
|
|
53
|
+
## REST via CLI (setup & resources)
|
|
43
54
|
|
|
44
|
-
|
|
55
|
+
| Task | Command |
|
|
56
|
+
|------|---------|
|
|
57
|
+
| Setup | `mantis setup` |
|
|
58
|
+
| Status | `mantis status` |
|
|
59
|
+
| List spaces | `mantis spaces list --filter "query"` |
|
|
60
|
+
| Create map from CSV | `mantis create map file.csv` |
|
|
61
|
+
| Index codebase | `mantis create codebase . --create-map` |
|
|
45
62
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
- Terminal pickers: `mantis select space` / `mantis select thread` if the in-chat menu fails
|
|
50
|
-
- `/mantis:status` — show current space/thread
|
|
63
|
+
API keys: https://mantis.csail.mit.edu/developer/#keys
|
|
64
|
+
|
|
65
|
+
## Conventions
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
- Refer to spaces and maps by **name** in user-facing text; use UUIDs in tool arguments.
|
|
68
|
+
- After `mantis select space` or `mantis select thread`, the next `mantis use` picks up the new context automatically — no reload step.
|
package/skills/select/SKILL.md
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
3
|
-
disable-model-invocation: true
|
|
2
|
+
description: Switch active Mantis space and thread via the CLI. Run `mantis use get_space_context` first when Mantis is mentioned.
|
|
4
3
|
---
|
|
5
4
|
|
|
6
|
-
# Select
|
|
5
|
+
# Select space and thread
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
First: `mantis use get_space_context` (unless you just ran it this turn).
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
```bash
|
|
10
|
+
mantis select space
|
|
11
|
+
mantis select thread
|
|
12
|
+
```
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
Or both:
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
```bash
|
|
17
|
+
mantis select
|
|
18
|
+
```
|
|
16
19
|
|
|
17
|
-
|
|
20
|
+
After selection, run `mantis use get_space_context` again.
|
package/skills/space/SKILL.md
CHANGED
|
@@ -1,62 +1,25 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Select
|
|
2
|
+
description: Select the active Mantis space using the CLI or list/search helpers. Run `mantis use get_space_context` first when Mantis is mentioned.
|
|
3
3
|
argument-hint: [filter]
|
|
4
|
-
allowed-tools:
|
|
5
|
-
disable-model-invocation: true
|
|
4
|
+
allowed-tools: Bash, AskUserQuestion
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# Select Mantis space
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
First: `mantis use get_space_context` (unless you just ran it this turn).
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
1. If `$ARGUMENTS` looks like a Mantis space URL (`/space/{uuid}`) or a UUID, resolve it first:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/mantis-resolve-space.js" $ARGUMENTS
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
If JSON has `space`, run `mantis-set-space.js` with that id and name, then stop (skip browse). On `error`, explain and offer browse.
|
|
21
|
-
|
|
22
|
-
2. Otherwise run (search text or empty for recent page):
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/mantis-list-spaces.js" --filter "$ARGUMENTS"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Parse the JSON. On `error`, tell the user to run `mantis setup` in a terminal.
|
|
29
|
-
|
|
30
|
-
3. **AskUserQuestion** (max 4 options per call):
|
|
31
|
-
- If the user pasted a link in chat, pass it as `$ARGUMENTS` or run step 1 with that URL.
|
|
32
|
-
- `header`: `Space`
|
|
33
|
-
- `question`: `Which Mantis space should Claude use?`
|
|
34
|
-
- For each item in `spaces`, one option:
|
|
35
|
-
- `label`: space `name` (short)
|
|
36
|
-
- `description`: full `id` + map count if present
|
|
37
|
-
- If `hasMore` is true, use the 3rd slot for the best match and the 4th option:
|
|
38
|
-
- `label`: `More spaces…`
|
|
39
|
-
- `description`: `Show next page (${total} total)`
|
|
40
|
-
- On "More spaces…", re-run with `--offset` increased by `limit` (same filter), then AskUserQuestion again.
|
|
41
|
-
|
|
42
|
-
4. After the user picks a space (not "More"), run:
|
|
11
|
+
Interactive:
|
|
43
12
|
|
|
44
13
|
```bash
|
|
45
|
-
|
|
14
|
+
mantis select space
|
|
46
15
|
```
|
|
47
16
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
5. If `needThread` or `threadCleared`, run **`/mantis:thread`** next in this session (user must pick a thread for the new space).
|
|
51
|
-
|
|
52
|
-
6. After space or thread changes, tell the user to run **`/reload-plugins`** so MCP reconnects with the updated `X-Space-State-ID` header. Do not try to invoke `/reload-plugins` as a Skill tool.
|
|
53
|
-
|
|
54
|
-
## Terminal fallback
|
|
55
|
-
|
|
56
|
-
If AskUserQuestion does not appear (known CC bug in some versions), tell the user to run in a separate terminal:
|
|
17
|
+
Scriptable (for agent menus):
|
|
57
18
|
|
|
58
19
|
```bash
|
|
59
|
-
mantis
|
|
20
|
+
mantis spaces list --filter "$ARGUMENTS"
|
|
21
|
+
mantis spaces resolve "$ARGUMENTS"
|
|
22
|
+
mantis spaces set <uuid> "<name>"
|
|
60
23
|
```
|
|
61
24
|
|
|
62
|
-
|
|
25
|
+
If space changed and thread was cleared, run `mantis select thread` next, then `mantis use get_space_context`.
|
package/skills/status/SKILL.md
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Show
|
|
3
|
-
disable-model-invocation: true
|
|
2
|
+
description: Show current Mantis space, thread, and MCP URL from CLI config. Run `mantis use get_space_context` first when Mantis is mentioned.
|
|
4
3
|
---
|
|
5
4
|
|
|
6
5
|
# Mantis status
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
First: `mantis use get_space_context` (unless you just ran it this turn).
|
|
9
8
|
|
|
10
9
|
```bash
|
|
11
10
|
mantis status
|
|
12
11
|
```
|
|
13
12
|
|
|
14
|
-
Or
|
|
13
|
+
Or JSON-friendly check via config path printed by status.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
node "${CLAUDE_PLUGIN_ROOT}/bin/mantis.js" status
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Report the output to the user. If no thread is set, tell them to run `/mantis:connect` or `mantis setup`, then `/reload-plugins`.
|
|
15
|
+
If no thread is set: `mantis setup` or `mantis select thread`.
|
package/skills/thread/SKILL.md
CHANGED
|
@@ -1,43 +1,31 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Select
|
|
2
|
+
description: Select the active Mantis thread (space state) using the CLI. Run `mantis use get_space_context` first when Mantis is mentioned.
|
|
3
3
|
argument-hint: [filter]
|
|
4
|
-
allowed-tools:
|
|
5
|
-
disable-model-invocation: true
|
|
4
|
+
allowed-tools: Bash, AskUserQuestion
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# Select Mantis thread
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
First: `mantis use get_space_context` (unless you just ran it this turn).
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
1. Run:
|
|
11
|
+
Interactive:
|
|
15
12
|
|
|
16
13
|
```bash
|
|
17
|
-
|
|
14
|
+
mantis select thread
|
|
18
15
|
```
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
2. **AskUserQuestion**:
|
|
23
|
-
- `header`: `Thread`
|
|
24
|
-
- `question`: `Which thread in this space?`
|
|
25
|
-
- One option per thread (`label`: name, `description`: full `id`)
|
|
26
|
-
- Always include (if room under 4 options):
|
|
27
|
-
- `label`: `New thread`
|
|
28
|
-
- `description`: `Create a new space state for Claude Code`
|
|
29
|
-
- If `hasMore`, add `More threads…` like `/mantis:space` (paginate with `--offset`)
|
|
30
|
-
|
|
31
|
-
3. On selection:
|
|
32
|
-
- **New thread** → `node "${CLAUDE_PLUGIN_ROOT}/bin/mantis-set-thread.js" --new "Claude Code"`
|
|
33
|
-
- Otherwise → `node "${CLAUDE_PLUGIN_ROOT}/bin/mantis-set-thread.js" <uuid> "<name>"`
|
|
34
|
-
|
|
35
|
-
4. After a successful `mantis-set-thread.js`, tell the user to run **`/reload-plugins`**. Claude Code exposes `/reload-plugins` as a user command, not a Skill tool, so do not try to invoke it yourself.
|
|
17
|
+
Scriptable:
|
|
36
18
|
|
|
37
|
-
|
|
19
|
+
```bash
|
|
20
|
+
mantis threads list --filter "$ARGUMENTS"
|
|
21
|
+
mantis threads new "Thread name"
|
|
22
|
+
mantis threads set <uuid> "<name>"
|
|
23
|
+
```
|
|
38
24
|
|
|
39
|
-
|
|
25
|
+
Then refresh context:
|
|
40
26
|
|
|
41
27
|
```bash
|
|
42
|
-
mantis
|
|
28
|
+
mantis use get_space_context
|
|
43
29
|
```
|
|
30
|
+
|
|
31
|
+
Context is read from `~/.mantis/config.json` on each invocation — no reload step.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "mantis",
|
|
3
|
-
"description": "Connect Claude Code to Mantis MCP — explore maps, clusters, and notebooks in your spaces",
|
|
4
|
-
"version": "1.0.15",
|
|
5
|
-
"author": {
|
|
6
|
-
"name": "MIT Mantis"
|
|
7
|
-
},
|
|
8
|
-
"homepage": "https://mantis.csail.mit.edu",
|
|
9
|
-
"userConfig": {
|
|
10
|
-
"api_base_url": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"title": "Mantis API URL",
|
|
13
|
-
"description": "Base URL only (no path). Default is the CSAIL H200 API; use http://localhost:8000 for local Docker.",
|
|
14
|
-
"default": "https://kellis-h200-1.csail.mit.edu",
|
|
15
|
-
"required": true
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
package/.mcp.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spacesForPrompt } from '../lib/list-cli.js';
|
|
3
|
-
|
|
4
|
-
const args = process.argv.slice(2);
|
|
5
|
-
let filter = '';
|
|
6
|
-
let offset = 0;
|
|
7
|
-
let limit = 4;
|
|
8
|
-
for (let i = 0; i < args.length; i++) {
|
|
9
|
-
const a = args[i];
|
|
10
|
-
if (a === '--offset') {
|
|
11
|
-
offset = parseInt(args[++i], 10) || 0;
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
if (a === '--limit') {
|
|
15
|
-
limit = parseInt(args[++i], 10) || 4;
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
if (a === '--filter') {
|
|
19
|
-
filter = args[++i] ?? '';
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
filter = args.slice(i).join(' ').trim();
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const data = await spacesForPrompt(filter, { limit, offset });
|
|
28
|
-
process.stdout.write(JSON.stringify(data));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
console.error(JSON.stringify({ error: e.message }));
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { threadsForPrompt } from '../lib/list-cli.js';
|
|
3
|
-
|
|
4
|
-
const args = process.argv.slice(2);
|
|
5
|
-
let filter = '';
|
|
6
|
-
let offset = 0;
|
|
7
|
-
let limit = 4;
|
|
8
|
-
for (let i = 0; i < args.length; i++) {
|
|
9
|
-
const a = args[i];
|
|
10
|
-
if (a === '--offset') {
|
|
11
|
-
offset = parseInt(args[++i], 10) || 0;
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
if (a === '--limit') {
|
|
15
|
-
limit = parseInt(args[++i], 10) || 4;
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
if (a === '--filter') {
|
|
19
|
-
filter = args[++i] ?? '';
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
filter = args.slice(i).join(' ').trim();
|
|
23
|
-
break;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
const data = await threadsForPrompt(filter, { limit, offset });
|
|
28
|
-
process.stdout.write(JSON.stringify(data));
|
|
29
|
-
} catch (e) {
|
|
30
|
-
console.error(JSON.stringify({ error: e.message }));
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
package/bin/mantis-pick-space.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { loadConfig } from '../lib/config.js';
|
|
3
|
-
import { resolveSpaceFromInput } from '../lib/spaces.js';
|
|
4
|
-
|
|
5
|
-
const input = process.argv.slice(2).join(' ').trim();
|
|
6
|
-
if (!input) {
|
|
7
|
-
console.error(JSON.stringify({ error: 'Provide a space link or UUID' }));
|
|
8
|
-
process.exit(1);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
const cfg = loadConfig();
|
|
13
|
-
if (!cfg.apiKey || !cfg.apiBaseUrl) {
|
|
14
|
-
throw new Error('Run mantis setup first (API key + URL).');
|
|
15
|
-
}
|
|
16
|
-
const space = await resolveSpaceFromInput(cfg.apiBaseUrl, cfg.apiKey, input);
|
|
17
|
-
if (!space) {
|
|
18
|
-
console.error(JSON.stringify({ error: 'Space not found or no access' }));
|
|
19
|
-
process.exit(1);
|
|
20
|
-
}
|
|
21
|
-
process.stdout.write(JSON.stringify({ space, threadCleared: true }));
|
|
22
|
-
} catch (e) {
|
|
23
|
-
console.error(JSON.stringify({ error: e.message }));
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
package/bin/mantis-select.js
DELETED
package/bin/mantis-set-space.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { loadConfig, saveConfig } from '../lib/config.js';
|
|
3
|
-
import { syncMcpConfigs } from '../lib/mcp-config.js';
|
|
4
|
-
|
|
5
|
-
const id = process.argv[2];
|
|
6
|
-
const name = process.argv[3] || '';
|
|
7
|
-
if (!id) {
|
|
8
|
-
console.error('Usage: mantis-set-space <space-uuid> [name]');
|
|
9
|
-
process.exit(1);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const cfg = loadConfig();
|
|
13
|
-
const changed = cfg.spaceId !== id;
|
|
14
|
-
const next = {
|
|
15
|
-
...cfg,
|
|
16
|
-
spaceId: id,
|
|
17
|
-
spaceName: name || cfg.spaceName,
|
|
18
|
-
...(changed ? { spaceStateId: undefined, spaceStateName: undefined } : {}),
|
|
19
|
-
};
|
|
20
|
-
saveConfig(next);
|
|
21
|
-
syncMcpConfigs(next);
|
|
22
|
-
console.log(
|
|
23
|
-
JSON.stringify({
|
|
24
|
-
ok: true,
|
|
25
|
-
spaceId: id,
|
|
26
|
-
spaceName: name,
|
|
27
|
-
threadCleared: changed,
|
|
28
|
-
needThread: changed,
|
|
29
|
-
needReloadPlugins: true,
|
|
30
|
-
}),
|
|
31
|
-
);
|