> ## Documentation Index
> Fetch the complete documentation index at: https://better-pm.fdarian.com/llms.txt
> Use this file to discover all available pages before exploring further.

# pm up

> Update dependencies

## Overview

The `pm up` (or `pm update`) command updates dependencies in your project. It supports interactive mode and can update to the latest versions.

## Syntax

```bash theme={null}
pm up [packages...] [options]
pm update [packages...] [options]
```

## Arguments

<ParamField path="packages" type="string[]">
  Specific packages to update. If omitted, updates all dependencies.
</ParamField>

## Options

<ParamField path="-i" type="boolean" default="false">
  Interactive mode - prompts for each update
</ParamField>

<ParamField path="--latest" type="boolean" default="false">
  Update to the latest version (not restricted by semver range)
</ParamField>

## Examples

### Update All Dependencies

```bash theme={null}
pm up
```

```bash Output theme={null}
Running: pnpm update
```

### Update Specific Package

```bash theme={null}
pm up typescript
```

```bash Output theme={null}
Running: pnpm update typescript
```

### Update Multiple Packages

```bash theme={null}
pm up react react-dom
```

```bash Output theme={null}
Running: pnpm update react react-dom
```

### Interactive Update

```bash theme={null}
pm up -i
```

```bash Output theme={null}
Running: pnpm update -i

? Choose dependencies to update:
  ◯ typescript 5.0.0 → 5.1.0
  ◯ react 18.2.0 → 18.3.0
  ◯ vite 4.3.0 → 4.4.0
```

<Tip>
  Interactive mode (`-i`) is great for reviewing updates before applying them.
</Tip>

### Update to Latest

```bash theme={null}
pm up --latest
```

```bash Output theme={null}
Running: pnpm update --latest
```

### Combined Flags

```bash theme={null}
pm up -i --latest typescript
```

```bash Output theme={null}
Running: pnpm update -i --latest typescript
```

## How It Works

From `src/commands/up.ts:18-32`:

```typescript theme={null}
const updateHandler = (args: {
  i: boolean;
  latest: boolean;
  args: ReadonlyArray<string>;
}) =>
  Effect.gen(function* () {
    const pm = yield* PackageManagerService;
    const extraArgs: Array<string> = [];
    if (args.i) extraArgs.push('-i');
    if (args.latest) extraArgs.push('--latest');
    extraArgs.push(...Array.from(args.args));
    const cmd = ShellCommand.make(pm.name, 'update', ...extraArgs);
    yield* Console.log(`Running: ${pm.name} update ${extraArgs.join(' ')}`);
    yield* runShellCommand(cmd);
  }).pipe(Effect.provide(PackageManagerLayer));
```

The command:

1. Detects your package manager
2. Builds the update command with flags
3. Executes the update with all arguments

## Update Strategies

### Semantic Versioning

By default, updates respect semver ranges in `package.json`:

```json package.json theme={null}
{
  "dependencies": {
    "react": "^18.2.0"  // Updates to 18.x.x
  }
}
```

```bash theme={null}
pm up react
# Updates to latest 18.x.x version
```

### Latest Version

With `--latest`, ignores semver ranges:

```bash theme={null}
pm up --latest react
# Updates to latest version (e.g., 19.0.0)
```

### Interactive Selection

With `-i`, choose which updates to apply:

```bash theme={null}
pm up -i
# Shows interactive prompt for each available update
```

## Package Manager Compatibility

| Package Manager | Command       |
| --------------- | ------------- |
| pnpm            | `pnpm update` |
| bun             | `bun update`  |
| npm             | `npm update`  |

<Note>
  All package managers support `update`, but some features like `-i` may vary by package manager.
</Note>

## Common Use Cases

### Regular Maintenance

```bash theme={null}
# Update all dependencies within semver ranges
pm up
```

### Major Version Updates

```bash theme={null}
# Update to latest versions interactively
pm up -i --latest
```

### Single Package Update

```bash theme={null}
# Update specific package
pm up typescript
```

### Review Before Update

```bash theme={null}
# Interactive mode to see what will change
pm up -i
```

## Best Practices

<Steps>
  <Step title="Check Current Versions">
    Use `pm ls` to see current versions before updating

    ```bash theme={null}
    pm ls
    ```
  </Step>

  <Step title="Update Interactively">
    Use `-i` flag to review updates

    ```bash theme={null}
    pm up -i
    ```
  </Step>

  <Step title="Test After Updates">
    Run tests after updating dependencies

    ```bash theme={null}
    pm up && pm run test
    ```
  </Step>

  <Step title="Commit Lock File">
    Always commit the updated lock file

    ```bash theme={null}
    git add pnpm-lock.yaml
    git commit -m "chore: update dependencies"
    ```
  </Step>
</Steps>

## Related Commands

* [pm add](/commands/add) - Add new dependencies
* [pm remove](/commands/remove) - Remove dependencies
* [pm ls](/commands/ls) - List installed versions
