Skip to content

Commit eca37de

Browse files
committed
feat: mantis project can read text from a file
Add --file <path> so the text to project can come from a file instead of an inline argument. The positional is now optional ([text]); pass exactly one of text or --file (both → error, neither → the existing "provide text" error). Missing file reports a clean "File not found" rather than a raw ENOENT. File reading stays at the command layer; ProjectionService is unchanged (still receives text), so the `mantis use project` tool surface is unaffected. Bumps 3.5.0 -> 3.5.1.
1 parent 2e7bb29 commit eca37de

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ See the [Claude Code guide](https://mantis.csail.mit.edu/docs/mantis-cli/claude-
7979
| `mantis use <tool>` | Call any MCP tool (JSON output) |
8080
| `mantis create map <file>` | Build a map from a local CSV/XLSX |
8181
| `mantis create codebase [root]` | Index a repo into CSV; add `--create-map` to embed it |
82-
| `mantis project <text> --map-id <id>` | Project text onto a map; returns the new point's URI |
82+
| `mantis project <text\|--file f> --map-id <id>` | Project text (or a file's contents) onto a map; returns the new point's URI |
8383

8484
## The `mantis use` toolbox
8585

bin/mantis.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,17 +512,26 @@ addMapOptions(create
512512

513513

514514
program
515-
.command('project <text>')
515+
.command('project [text]')
516516
.description('Project text onto a map; persists a point and returns its URI')
517517
.requiredOption('--map-id <id>', 'target map (UUID or Mantis link)')
518+
.option('--file <path>', 'read the text to project from a file instead of an argument')
518519
.option('--embedding <json>', 'project a raw embedding instead of text (JSON array)')
519520
.option('--service-name <name>', 'embedding service override')
520521
.option('--model <name>', 'embedding model override')
521522
.option('--no-persist', 'preview coordinates only, without creating a point')
522523
.action(async (text, opts) => {
523524
try {
525+
if (text && opts.file) {
526+
throw new Error('Pass either a text argument or --file, not both.');
527+
}
528+
let source = text;
529+
if (opts.file) {
530+
if (!fs.existsSync(opts.file)) throw new Error(`File not found: ${opts.file}`);
531+
source = fs.readFileSync(opts.file, 'utf8');
532+
}
524533
const embedding = opts.embedding ? JSON.parse(opts.embedding) : undefined;
525-
const result = await projection.project(text, {
534+
const result = await projection.project(source, {
526535
mapId: opts.mapId,
527536
embedding,
528537
serviceName: opts.serviceName,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mantisai-cli",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"description": "Mantis CLI — spaces, maps, and MCP tools for AI coding agents",
55
"type": "module",
66
"license": "MIT",

0 commit comments

Comments
 (0)