# import

Analyze and safely import one repository into a Megamono host


## When to use it

Analysis is the default. Review source identity, destination, history policy, and conflicts before execute=true. Import changes Git history and repository files; use a clean branch and preserve recoverable history.

## Usage

Configure an Nx target on the owning project, then invoke it with `npm exec -- nx run <project>:<target>`. The executor identifier is not a standalone CLI command.

```json
{
  "targets": {
    "reviewed-action": {
      "executor": "@megamono/plugin:import",
      "options": {
        "source": "<source>",
        "name": "<name>"
      }
    }
  }
}
```

This target is a configuration example. Supply required values and review side effects before invoking it.

## Options

Use these options with `@megamono/plugin:import`. Nx uses the camelCase names shown here; the [CLI reference](/docs/cli) describes command-line aliases. Some options are required only for particular choices.

| Option | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `monorepo` | No | object | — | Opt-in reviewed multi-project import. Every static source project root must be mapped to import (name, optional packageName, complete configuration) or reuse (host project). Requires subtree and verify=build. |
| `source` | Yes | string | — | Local Git repository path or credential-free Git URL. |
| `ref` | No | string | "HEAD" | Source branch, tag, or commit to resolve. |
| `expectedSourceSha` | No | string | — | Full immutable source SHA approved during analysis. |
| `name` | Yes | string | — | Imported Nx project name. |
| `destination` | No | string | — | Safe, non-reserved workspace-relative destination; defaults to apps/<name>. |
| `history` | No | string | — | Explicit history strategy required for execution. Allowed: "subtree", "filter-repo", "squash". |
| `verify` | No | string | "config" | Requested post-integration verification depth. Allowed: "none", "config", "build". |
| `execute` | No | boolean | false | Request mutation after every execution gate passes. |
| `allowHistoryLoss` | No | boolean | false | Explicitly acknowledge history loss for squash imports. |
| `resolutions` | No | object | {} | — |

## Next steps

Review changed files and run the affected project's checks. For options that accept structured values, run the generator's `--help` or consult the schema in the installed package.

- [All actions](/docs/actions)
- [CLI overview](/docs/cli)
- [Adopt an existing workspace](/docs/workflows/adoption)
