Skip to content

fix: guard against running analyze/watch on home directory or root #115

@jonathanpopham

Description

@jonathanpopham

If a user runs `supermodel analyze` or `supermodel` (watch mode) from `~` or `/`, the CLI will:

  1. Zip the entire home directory or root filesystem
  2. Upload it to the API (potentially GBs of data including secrets, credentials, SSH keys)
  3. Write thousands of `.graph.*` shard files everywhere

The zip filter already blocks `.env`, `.key`, `.pem` etc, but there's no guard against accidentally running on a scope that's clearly wrong.

Fix: Before creating the zip, check if `repoDir` is:

  • `/` or `/root`
  • `$HOME` or `~`
  • A path with fewer than N source files and no `.git` directory (not a repo)

If so, print a warning and require `--force` to proceed:

```
Warning: You're about to analyze your home directory (/Users/jag).
This will upload all source files to the Supermodel API.
Run with --force if this is intentional, or cd into a project directory first.
```

Discovered during benchmarking when a script accidentally ran from `~`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions