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.
Files changed (71) hide show
  1. package/README.md +26 -99
  2. package/bin/mantis.js +406 -23
  3. package/lib/constants.js +13 -0
  4. package/lib/container.js +63 -0
  5. package/lib/impl/claude-skills-service.js +13 -0
  6. package/lib/impl/fast-glob-codebase-indexer.js +114 -0
  7. package/lib/impl/file-config-store.js +38 -0
  8. package/lib/impl/fs-csv-reader.js +12 -0
  9. package/lib/impl/http-mantis-client.js +108 -0
  10. package/lib/impl/inquirer-ui-service.js +73 -0
  11. package/lib/impl/mcp-client-service.js +64 -0
  12. package/lib/impl/opencode-skills-service.js +17 -0
  13. package/lib/impl/space-repository.js +72 -0
  14. package/lib/interfaces/codebase-indexer.js +5 -0
  15. package/lib/interfaces/config-store.js +11 -0
  16. package/lib/interfaces/csv-reader.js +5 -0
  17. package/lib/interfaces/index.js +7 -0
  18. package/lib/interfaces/mantis-client.js +13 -0
  19. package/lib/interfaces/mcp-client.js +6 -0
  20. package/lib/interfaces/space-repository.js +13 -0
  21. package/lib/interfaces/ui.js +13 -0
  22. package/lib/services/context-service.js +22 -0
  23. package/lib/services/map-service.js +114 -0
  24. package/lib/services/query-service.js +50 -0
  25. package/lib/services/selection-service.js +174 -0
  26. package/lib/services/setup-service.js +81 -0
  27. package/lib/services/tool-service.js +26 -0
  28. package/lib/types.js +30 -0
  29. package/lib/utils/cli-args.js +29 -0
  30. package/lib/utils/package-root.js +7 -0
  31. package/lib/utils/skills-sync.js +43 -0
  32. package/lib/{space-id.js → utils/space-id.js} +0 -1
  33. package/lib/utils/threads.js +12 -0
  34. package/lib/utils/tool-args.js +38 -0
  35. package/lib/utils/url.js +33 -0
  36. package/package.json +4 -7
  37. package/skills/codebase/SKILL.md +8 -6
  38. package/skills/connect/SKILL.md +10 -26
  39. package/skills/createmap/SKILL.md +5 -3
  40. package/skills/mantis/SKILL.md +48 -32
  41. package/skills/select/SKILL.md +12 -9
  42. package/skills/space/SKILL.md +10 -47
  43. package/skills/status/SKILL.md +4 -9
  44. package/skills/thread/SKILL.md +15 -27
  45. package/.claude-plugin/marketplace.json +0 -14
  46. package/.claude-plugin/plugin.json +0 -18
  47. package/.mcp.json +0 -11
  48. package/bin/mantis-list-spaces.js +0 -32
  49. package/bin/mantis-list-threads.js +0 -32
  50. package/bin/mantis-mcp-headers.js +0 -9
  51. package/bin/mantis-pick-space.js +0 -5
  52. package/bin/mantis-pick-thread.js +0 -5
  53. package/bin/mantis-resolve-space.js +0 -25
  54. package/bin/mantis-select.js +0 -7
  55. package/bin/mantis-set-space.js +0 -31
  56. package/bin/mantis-set-thread.js +0 -34
  57. package/bin/mantis-setup.js +0 -59
  58. package/bin/mantis-status.js +0 -15
  59. package/lib/api.js +0 -100
  60. package/lib/claude-plugin.js +0 -150
  61. package/lib/codebase-csv.js +0 -115
  62. package/lib/config.js +0 -65
  63. package/lib/csv.js +0 -10
  64. package/lib/fetch.js +0 -36
  65. package/lib/list-cli.js +0 -55
  66. package/lib/map-create.js +0 -148
  67. package/lib/mcp-config.js +0 -50
  68. package/lib/picker.js +0 -150
  69. package/lib/spaces.js +0 -48
  70. package/lib/ui.js +0 -73
  71. /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": "2.0.1",
4
- "description": "Mantis developer CLI — create maps, manage spaces and threads, configure Claude Code, and connect agents to Mantis MCP.",
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
- "claude-code",
47
- "plugin"
44
+ "ai-agents"
48
45
  ]
49
46
  }
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Index a local codebase into a CSV for Mantis, optionally creating and activating a Mantis codebase map. Use when the user wants Claude Code to map a repository or create a codebase CSV.
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 Activation
57
+ ## After activation
56
58
 
57
- If `--activate` was used, tell the user to run:
59
+ If `--activate` was used, the new thread is active immediately. Explore with:
58
60
 
59
- ```text
60
- /reload-plugins
61
+ ```bash
62
+ mantis use get_space_context
61
63
  ```
62
64
 
63
- Then suggest prompts like:
65
+ Example follow-up questions:
64
66
 
65
67
  ```text
66
68
  What are the main architectural zones in this codebase?
@@ -1,42 +1,26 @@
1
1
  ---
2
- description: Run the Mantis MCP setup wizard (API key, space, thread). Use when the user wants to connect Claude Code to Mantis or fix MCP connection issues.
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 MCP
5
+ # Connect to Mantis
7
6
 
8
- Run the interactive setup in the user's terminal:
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
- If the plugin is not on PATH, use:
13
+ Setup only prompts for space/thread if they are not already configured.
15
14
 
16
- ```bash
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
- npm install -g mantisai-cli
33
- mantis setup
18
+ mantis status
19
+ mantis use get_space_context
34
20
  ```
35
21
 
36
- That installs the **mantis@mantis-plugins** Claude Code plugin and saves API/space/thread config.
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
- If `/plugin` shows **Disabled** or *not installed*: run `claude plugin install mantis@mantis-plugins`, enable it, then `/reload-plugins`. If update fails, uninstall and reinstall the plugin (stale `installed_plugins.json` / orphaned cache).
24
+ API keys: https://mantis.csail.mit.edu/developer/#keys
41
25
 
42
- For connection errors: URL must end with `/mcp_integrated/`; avoid `/mcp/mcp` unless their deployment uses it.
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. Use when the user wants to upload a dataset, configure field types, or turn a CSV into a Mantis map.
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. If `--activate` was used, tell the user to run `/reload-plugins`.
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 Claude Code is driving the flow, avoid interactive prompts by passing flags.
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.
@@ -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
- ## name: mantis
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
- # Mantis (Claude Code)
8
+ Mantis is a spatial data workspace: **spaces** contain **maps**, **clusters**, **bags**, and **notebooks**.
7
9
 
8
- Mantis is a spatial data workspace: **spaces** contain **maps** (embeddings of datasets), **clusters**, **bags**, and **notebooks**.
10
+ ## First step
9
11
 
10
- ## Connection
12
+ Run this **before any other Mantis command or tool** (skip only if you already ran it this turn):
11
13
 
12
- 1. User runs `mantis setup` (or `/mantis:connect`) with a Developer API key from the Mantis portal.
13
- 2. MCP endpoint: `{api_base_url}/mcp_integrated/` (trailing slash required).
14
- 3. Required header on every MCP request: `**X-Space-State-ID`** = thread UUID from setup (setup writes this into the plugin MCP config).
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
- ## REST (setup only)
18
+ If it fails with no thread configured, run `mantis setup` or `mantis select thread`, then retry.
18
19
 
20
+ ## Setup
19
21
 
20
- | Endpoint | Purpose |
21
- | --------------------------------------------- | ----------------------------------- |
22
- | `GET /api/v1/me/spaces/?scope=accessible&limit=100` | List owned, shared, and public spaces |
23
- | `GET /api/v1/me/space-states/?space_id=` | List threads |
24
- | `POST /api/v1/me/space-states/` | Create thread `{ space_id, name? }` |
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
- Auth: `Authorization: Bearer live_…` key must be linked to a Mantis user.
31
+ Install editor skills (CLI-only workflow, no MCP plugin):
28
32
 
29
- ## MCP tools (read-focused)
33
+ ```bash
34
+ mantis setup claude # ~/.claude/skills/
35
+ mantis setup opencode # ~/.config/opencode/skills/ + .opencode/skills/
36
+ ```
30
37
 
31
- Call `**get_space_context**` first when you need map IDs, field types, cluster names, or point counts.
38
+ ## MCP tools via CLI
32
39
 
33
- Other useful tools: `get_tree_status`, `get_cluster_children`, `get_bags_from_map`, `get_bag_contents`, `get_point_details`, `get_selected_points`, `get_available_dimensions`.
40
+ Every Mantis MCP tool is available through the CLI — no editor MCP plugin required:
34
41
 
35
- Space management tools (`create_space`, `create_map_from_url`, etc.) need session or space-state context.
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
- ## Conventions
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
- - Refer to spaces and maps by **name** in user-facing text; use UUIDs only in tool arguments.
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
- ## Slash commands in this plugin
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
- - `/mantis:connect` — first-time setup (API key)
47
- - `/mantis:space` — pick space via **AskUserQuestion** (↑↓ in Claude UI; optional filter: `/mantis:space atlas`)
48
- - `/mantis:thread` — pick thread the same way
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
- After **`/mantis:thread`** only, run `/reload-plugins` once (MCP headers are fixed at connect time). Space-only changes do not need a reload until a thread is set.
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.
@@ -1,17 +1,20 @@
1
1
  ---
2
- description: Change the active Mantis space or thread (space state) for MCP. Use when the user wants to switch workspace or conversation context.
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 Mantis space / thread
5
+ # Select space and thread
7
6
 
8
- Prefer the interactive slash commands (arrow keys + filter as you type):
7
+ First: `mantis use get_space_context` (unless you just ran it this turn).
9
8
 
10
- - **`/mantis:space`** — pick a space
11
- - **`/mantis:thread`** pick a thread (after space)
9
+ ```bash
10
+ mantis select space
11
+ mantis select thread
12
+ ```
12
13
 
13
- CLI fallback: `mantis select` or `node "${CLAUDE_PLUGIN_ROOT}/bin/mantis.js" select`.
14
+ Or both:
14
15
 
15
- After a change, run **`/reload-plugins`**.
16
+ ```bash
17
+ mantis select
18
+ ```
16
19
 
17
- Optional argument from user (not passed to CLI automatically): if they give a **thread UUID**, they can paste it during setup or edit `~/.mantis/claude-code/config.json` (or `${CLAUDE_PLUGIN_DATA}/config.json`) and set `spaceStateId`.
20
+ After selection, run `mantis use get_space_context` again.
@@ -1,62 +1,25 @@
1
1
  ---
2
- description: Select your Mantis space (arrow-key menu in Claude Code). Use when switching workspace for MCP.
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: AskUserQuestion, Bash
5
- disable-model-invocation: true
4
+ allowed-tools: Bash, AskUserQuestion
6
5
  ---
7
6
 
8
7
  # Select Mantis space
9
8
 
10
- Slash-command `!` blocks cannot use an interactive terminal (no arrow keys). Use **AskUserQuestion** that is the native Claude Code picker UI.
9
+ First: `mantis use get_space_context` (unless you just ran it this turn).
11
10
 
12
- ## Steps
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
- node "${CLAUDE_PLUGIN_ROOT}/bin/mantis-set-space.js" <uuid-from-description> "<name>"
14
+ mantis select space
46
15
  ```
47
16
 
48
- Use the UUID from the selected option's **description**, not the label.
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 select space
20
+ mantis spaces list --filter "$ARGUMENTS"
21
+ mantis spaces resolve "$ARGUMENTS"
22
+ mantis spaces set <uuid> "<name>"
60
23
  ```
61
24
 
62
- Then `/reload-plugins`.
25
+ If space changed and thread was cleared, run `mantis select thread` next, then `mantis use get_space_context`.
@@ -1,20 +1,15 @@
1
1
  ---
2
- description: Show the current Mantis space, thread, and MCP URL from plugin config. Use when checking whether Claude Code is connected to Mantis.
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
- Run in the terminal:
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
- ```bash
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`.
@@ -1,43 +1,31 @@
1
1
  ---
2
- description: Select your Mantis thread / space state (arrow-key menu in Claude Code). Use after /mantis:space.
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: AskUserQuestion, Bash
5
- disable-model-invocation: true
4
+ allowed-tools: Bash, AskUserQuestion
6
5
  ---
7
6
 
8
7
  # Select Mantis thread
9
8
 
10
- Use **AskUserQuestion** for the arrow-key menu inside Claude Code (shell pickers have no TTY in slash commands).
9
+ First: `mantis use get_space_context` (unless you just ran it this turn).
11
10
 
12
- ## Steps
13
-
14
- 1. Run:
11
+ Interactive:
15
12
 
16
13
  ```bash
17
- node "${CLAUDE_PLUGIN_ROOT}/bin/mantis-list-threads.js" $ARGUMENTS
14
+ mantis select thread
18
15
  ```
19
16
 
20
- If error mentions space, tell user to run **`/mantis:space`** first.
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
- 5. Confirm with one line: space name, thread name, and that MCP is ready after `/reload-plugins`.
19
+ ```bash
20
+ mantis threads list --filter "$ARGUMENTS"
21
+ mantis threads new "Thread name"
22
+ mantis threads set <uuid> "<name>"
23
+ ```
38
24
 
39
- ## Terminal fallback
25
+ Then refresh context:
40
26
 
41
27
  ```bash
42
- mantis select thread
28
+ mantis use get_space_context
43
29
  ```
30
+
31
+ Context is read from `~/.mantis/config.json` on each invocation — no reload step.
@@ -1,14 +0,0 @@
1
- {
2
- "name": "mantis-plugins",
3
- "owner": {
4
- "name": "Kellis Lab"
5
- },
6
- "plugins": [
7
- {
8
- "name": "mantis",
9
- "description": "Mantis MCP: spaces, threads, and map context for Claude Code",
10
- "version": "1.0.15",
11
- "source": "./"
12
- }
13
- ]
14
- }
@@ -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,11 +0,0 @@
1
- {
2
- "mcpServers": {
3
- "mantis": {
4
- "type": "http",
5
- "url": "http://localhost:8000/mcp_integrated/",
6
- "headers": {
7
- "X-Space-State-ID": "51e4a4c2-1510-4456-afe9-ccbd422c7646"
8
- }
9
- }
10
- }
11
- }
@@ -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
- }
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import { loadConfig } from '../lib/config.js';
3
-
4
- const cfg = loadConfig();
5
- const headers = {};
6
- if (cfg.spaceStateId) {
7
- headers['X-Space-State-ID'] = String(cfg.spaceStateId);
8
- }
9
- process.stdout.write(JSON.stringify(headers));
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { pickSpace } from '../lib/picker.js';
3
-
4
- const filter = process.argv.slice(2).join(' ').trim();
5
- await pickSpace(filter);
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import { pickThread } from '../lib/picker.js';
3
-
4
- const filter = process.argv.slice(2).join(' ').trim();
5
- await pickThread(filter);
@@ -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
- }
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import { pickSpace, pickThread } from '../lib/picker.js';
3
- import { banner } from '../lib/ui.js';
4
-
5
- banner('Mantis — switch space / thread');
6
- await pickSpace();
7
- await pickThread();
@@ -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
- );