# lpm init (/docs/packages/init)



```bash
lpm init [-y]
```

Generates a minimal `package.json` for a new LPM package, plus a `.gitattributes` entry that marks `lpm.lockb` as binary (so git doesn't try to text-merge it later).

In an interactive terminal, prompts for owner, package name, version, and description. With `-y`, skips every prompt and uses defaults. Refuses to overwrite an existing `package.json`.

The interactive **owner** prompt is pre-filled from your `lpm whoami` profile username (with a 3-second timeout to keep `lpm init` from blocking on the network). If you're offline or not logged in, the placeholder is the literal string `username` — change it before publishing.

Successful human output is a short status transcript:

```text
✓ Wrote package.json
✓ Added lpm.lockb binary to .gitattributes
✓ Done · initialized @lpm.dev/<owner>.<name>
```

## Examples [#examples]

```bash
mkdir my-pkg && cd my-pkg
lpm init             # interactive walk
lpm init -y          # accept all defaults
```

## What it writes [#what-it-writes]

```json title="package.json"
{
  "name": "@lpm.dev/<owner>.<name>",
  "version": "1.0.0",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "type": "module",
  "license": "MIT",
  "files": ["dist"]
}
```

Plus an entry in `.gitattributes`:

```text title=".gitattributes"
lpm.lockb binary
```

## Package name format [#package-name-format]

LPM publishes under `@lpm.dev/<owner>.<name>`. `init` constructs the full name from your `owner` and `name` answers. You can publish under any owner you've claimed on lpm.dev — see [`lpm publish`](/docs/packages/publish) for the upload flow.

If you're going to publish to npm or another registry instead, you can rename the `name` field after `init` finishes (or pass `--npm` to `lpm publish` and configure `publish.npm.name` in `lpm.json`).

## Defaults under `-y` [#defaults-under--y]

| Field         | Value                                                                                      |
| ------------- | ------------------------------------------------------------------------------------------ |
| `owner`       | Your `lpm whoami` profile username, or the literal `"username"` if not logged in / offline |
| `name`        | `"package"` (literal — not the directory name)                                             |
| `version`     | `1.0.0`                                                                                    |
| `description` | (empty)                                                                                    |

Rename the manifest's `name` field if those placeholder defaults aren't what you want.

## Flags [#flags]

| Flag          | Effect                     |
| ------------- | -------------------------- |
| `-y`, `--yes` | Skip prompts, use defaults |

Plus the [global flags](/docs/commands#global-flags). `--json` emits a brief envelope confirming what was created: `{success, name, version, path}`.

## See also [#see-also]

* [`lpm publish`](/docs/packages/publish) — push to lpm.dev or another registry
* [`package.json` "lpm" key](/docs/reference/package-json-lpm) — what to add for advanced config
* [Project setup](/docs/project-setup) — broader walkthrough
