Skip to main content
Glama
DependAgent
by Dmitry178
README.md
# DepAgent

DepAgent is a local CLI and MCP server for checking and updating
dependencies in polyglot repositories. It runs on the user's machine: there
is no hosted service, web interface, or database.

Supported manifests:

| Manifest         | Ecosystem | Registry        |
| ---------------- | --------- | --------------- |
| `package.json`   | npm       | npm Registry    |
| `pyproject.toml` | Python    | PyPI            |
| `go.mod`         | Go        | Go module proxy |
| `Cargo.toml`     | Rust      | crates.io       |

## Requirements

- Node.js 22 or newer
- Network access to the relevant registry for checks and updates
- The native package manager is optional for checks, but required when
  lockfile synchronization is enabled during an update

## Quick start

Run DepAgent from a published package:

```bash
npx depagent check
npx depagent update
```

The commands use the current directory by default. A path can be supplied:

```bash
depagent check ./my-project
depagent check ./my-project --json
depagent update --path services/api
```

`check` only reads files. `update` changes non-pinned dependencies within
their current major version and synchronizes the lockfile when possible.

The CLI command is `depagent`:

```bash
depagent check
```

Preview changes without writing:

```bash
npx depagent update --dry-run
```

Update selected packages or one manifest:

```bash
npx depagent update typescript zod
npx depagent update --manifest apps/web/package.json
npx depagent update --strategy current-major typescript
npx depagent update --major --strategy target-major --target-major 6 typescript
```

## CLI

Running `depagent` without arguments shows the version and available
commands.

Initialize the project before using the CLI check/update workflow:

```bash
depagent init
```

Refresh the saved dependency manifest index after adding or removing project
files:

```bash
depagent index
```

Project settings are stored in `.depagent/config.toml`. The generated
`.depagent/.gitignore` ignores the entire directory by default.

### Check for updates

```text
depagent check [path]
```

Useful options:

```text
--json                 Print structured JSON
--all                  Include manifests without available updates
--depth <number>       Maximum discovery depth (default: 5)
--ignore <glob>        Ignore a path; can be repeated
--no-cache             Refresh manifest discovery
```

`check` reads manifest paths from `.depagent/index.json`. Use `check --all` to
include indexed manifests without available updates.
The exit code is `3` when updates are available, `2` when no supported
manifests are found, and `0` when the check completes without updates.

### Example result

In a monorepository, results are grouped by the relative path of each
manifest. Regular updates, major updates, and pinned dependencies are shown
separately in the same report:

```text
Dependency manifests:
- apps/mobile/package.json
  - react: 18.3.1 -> 18.4.0
  - typescript: 5.6.3 -> 6.0.1 [major]
- services/api/pyproject.toml
  - httpx: 0.27.2 -> 0.28.1
  - pydantic: 2.8.2 -> 2.10.4
- services/worker/go.mod
  - golang.org/x/sync: v0.8.0 -> v0.10.0 [major]
- tools/desktop/Cargo.toml
  - serde: 1.0.210 -> 1.0.215 [pinned - skipped]

Warnings:
- Could not check npm package "example-package": request timed out
```

The MCP tools return the same information as structured data. A response is
organized around the operation and its manifest-scoped reports:

```json
{
	"projectPath": "/path/to/project",
	"discoveredManifests": 4,
	"manifests": [
		{
			"path": "apps/mobile/package.json",
			"ecosystem": "npm",
			"minor": [
				{
					"packageName": "react",
					"currentVersion": "18.3.1",
					"latestVersion": "18.4.0"
				}
			],
			"major": [],
			"pinned": []
		}
	],
	"changes": [],
	"warnings": []
}
```

### Update dependencies

```text
depagent update [packages...]
```

Useful options:

```text
--major                       Allow major updates
--major-strategy <next|latest> Choose a strategy for multi-major updates
--path <dir>                  Limit discovery to a directory
--manifest <file>             Limit the operation to one manifest
--dry-run                     Show changes without writing
--no-sync                     Skip lockfile synchronization
--depth <number>              Maximum discovery depth
--ignore <glob>               Ignore a path; can be repeated
--no-cache                    Refresh manifest discovery
--strategy <strategy>         current-major, next, latest, or target-major
--target-major <number>       Target major line
```

## Discovery and configuration

DepAgent recursively finds supported manifests, applies the root
`.gitignore`, skips common generated/vendor directories, and groups results by
relative manifest path. It also understands npm, pnpm, and Cargo workspaces.

Repository-specific settings are stored in `.depagent/config.toml` after
running `depagent init`:

```toml
max_depth = 5
ignore_patterns = ["examples/**"]

[[rules]]
manifest_path = "apps/web/package.json"
packages = ["typescript"]
strategy = "current-major"
```

Command and tool options take precedence over repository configuration.
Manifest paths must be relative to the project and remain inside it.

The project manifest index is stored in `.depagent/index.json`. Run
`depagent index` or use MCP's `index_dependencies` tool after adding or
removing dependency files. MCP also supports `refreshIndex: true`.

## Safety model

- Pinned versions are reported but never changed automatically.
- The default update mode never crosses a major version.
- Major updates require `--major` in the CLI.
- The MCP major-update tool requires explicit `confirmMajor: true`.
- Multi-major updates require either `next` (the next available major line) or
  `latest` (directly to the latest version).
- `check` and `--dry-run` do not write manifests or lockfiles.
- Lockfile failures are returned as warnings and do not undo a successful
  manifest update.

For Go modules, different `0.x` minor lines are treated as major-risk
updates:

```text
v0.38.0 -> v0.38.5  # regular update
v0.38.0 -> v0.39.4  # major-risk update
```

## MCP

Start the MCP server over stdio:

```bash
depagent mcp
```

The server exposes:

- `check_dependencies` – inspect dependencies without changing files;
- `update_minor_dependencies` – apply non-pinned updates within the current
  major version;
- `update_major_dependencies` – preview and, after confirmation, apply major
  updates.

The simplest client configuration is:

```json
{
	"mcpServers": {
		"depagent": {
			"command": "npx",
			"args": ["-y", "depagent", "mcp"]
		}
	}
}
```

For a local checkout, build the project and replace the command with
`node /absolute/path/to/depagent/dist/index.js`, keeping `mcp` as the
argument. Other MCP clients use the same command and argument fields in their
configuration.

## Development

```bash
npm ci
npm run typecheck
npm run lint
npm test
npm run build
```

The compiled executable is written to `dist/index.js`. To use the current
checkout as a global command:

```bash
npm link
depagent --version
```

## Documentation

- [Architecture](ARCHITECTURE.md)
- [CLI specification](docs/cli-spec.md)
- [MCP specification](docs/mcp-spec.md)
- [Adding ecosystems](docs/adding-ecosystems.md)
- [Product requirements](PRD.md)
- [Roadmap](ROADMAP.md)

## License

DepAgent is distributed under the [MIT License](LICENSE.md).