---
title: "@vltpkg/init: Reference — vlt docs"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/client/api-reference/init/reference"
image: "https://docs.vlt.io/og/client/api-reference/init/reference"
lang: "en"
---

# Reference

## Type Aliases

### CustomizableInitOptions

```ts
type CustomizableInitOptions = object;
```

Defined in: index.ts:31

#### Type declaration

| Name     | Type     |
| -------- | -------- |
| `author` | `string` |
| `name`   | `string` |

---

### GitignoreFileInfo

```ts
type GitignoreFileInfo = IgnoreFileInfo;
```

Defined in: index.ts:54

---

### IgnoreFileInfo

```ts
type IgnoreFileInfo = object;
```

Defined in: index.ts:50

#### Type declaration

| Name   | Type     |
| ------ | -------- |
| `path` | `string` |

---

### InitFileResults

```ts
type InitFileResults = object;
```

Defined in: index.ts:56

#### Type declaration

| Name         | Type                                                                                                                                                                                               |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gitignore`? | [`IgnoreFileInfo`](https://docs.vlt.io/client/api-reference/init/reference.md#ignorefileinfo)                                                                                                      |
| `manifest`?  | [`JSONFileInfo`](https://docs.vlt.io/client/api-reference/init/reference.md#jsonfileinfot)<[`NormalizedManifest`](https://docs.vlt.io/client/api-reference/types/reference.md#normalizedmanifest)> |
| `npmignore`? | [`IgnoreFileInfo`](https://docs.vlt.io/client/api-reference/init/reference.md#ignorefileinfo)                                                                                                      |

---

### InitOptions

```ts
type InitOptions = object;
```

Defined in: index.ts:20

#### Type declaration

| Name           | Type                                                                                            | Description                                                                                                                        |
| -------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `author`?      | `string`                                                                                        | -                                                                                                                                  |
| `cwd`?         | `string`                                                                                        | -                                                                                                                                  |
| `logger`?      | (...`a`) => `void`                                                                              | -                                                                                                                                  |
| `packageJson`? | [`PackageJson`](https://docs.vlt.io/client/api-reference/package-json/reference.md#packagejson) | PackageJson instance to read and write through, so callers that share one (such as the CLI) see the written manifest in its cache. |

---

### InitSkillOptions

```ts
type InitSkillOptions = object;
```

Defined in: skill.ts:20

#### Type declaration

| Name    | Type     | Description                                      |
| ------- | -------- | ------------------------------------------------ |
| `cwd`?  | `string` | the package dir, default `process.cwd()`         |
| `name`? | `string` | unset: a root `SKILL.md` named after the package |

---

### InitSkillResult

```ts
type InitSkillResult = object;
```

Defined in: skill.ts:27

#### Type declaration

| Name             | Type     | Description                                          |
| ---------------- | -------- | ---------------------------------------------------- |
| `exists`?        | `true`   | `SKILL.md` was already there: nothing changed        |
| `manifest`?      | `object` | the `package.json` and the `files` entry added to it |
| `manifest.added` | `string` | -                                                    |
| `manifest.path`  | `string` | -                                                    |
| `package`?       | `string` | the `package.json` name                              |
| `skill`          | `object` | the skill name and its `SKILL.md` path               |
| `skill.name`     | `string` | -                                                    |
| `skill.path`     | `string` | -                                                    |

---

### JSONFileInfo\<T>

```ts
type JSONFileInfo<T> = object;
```

Defined in: index.ts:45

#### Type Parameters

| Type Parameter                                                                                             | Default type                                                                                 |
| ---------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `T` _extends_ [`JSONObj`](https://docs.vlt.io/client/api-reference/registry-client/cache-entry.md#jsonobj) | [`JSONObj`](https://docs.vlt.io/client/api-reference/registry-client/cache-entry.md#jsonobj) |

#### Type declaration

| Name   | Type     |
| ------ | -------- |
| `data` | `T`      |
| `path` | `string` |

## Functions

### ensureGitignore()

```ts
function ensureGitignore(cwd): undefined | IgnoreFileInfo
```

Defined in: index.ts:70

Create or update a `.gitignore` file ensuring `node_modules` is listed. Returns `{ path }` of the file that was written, or `undefined` if the file already contained the entry and no changes were needed.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `cwd`     | `string` |

#### Returns

`undefined` | [`IgnoreFileInfo`](https://docs.vlt.io/client/api-reference/init/reference.md#ignorefileinfo)

---

### ensureNpmignore()

```ts
function ensureNpmignore(cwd): undefined | IgnoreFileInfo
```

Defined in: index.ts:98

Create or update a `.npmignore` file ensuring `vlt.json` is listed. Returns `{ path }` of the file that was written, or `undefined` if the file already contained the entry and no changes were needed.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `cwd`     | `string` |

#### Returns

`undefined` | [`IgnoreFileInfo`](https://docs.vlt.io/client/api-reference/init/reference.md#ignorefileinfo)

---

### getAuthorFromGitUser()

```ts
function getAuthorFromGitUser(user?): string
```

Defined in: get-author-from-git-user.ts:3

#### Parameters

| Parameter | Type                                                                           |
| --------- | ------------------------------------------------------------------------------ |
| `user`?   | [`GitUser`](https://docs.vlt.io/client/api-reference/git/reference.md#gituser) |

#### Returns

`string`

---

### init()

```ts
function init(__namedParameters): Promise<InitFileResults>
```

Defined in: index.ts:120

#### Parameters

| Parameter           | Type                                                                                    |
| ------------------- | --------------------------------------------------------------------------------------- |
| `__namedParameters` | [`InitOptions`](https://docs.vlt.io/client/api-reference/init/reference.md#initoptions) |

#### Returns

`Promise`<[`InitFileResults`](https://docs.vlt.io/client/api-reference/init/reference.md#initfileresults)>

---

### initSkill()

```ts
function initSkill(__namedParameters): InitSkillResult
```

Defined in: skill.ts:74

Create a starter `skills/<name>/SKILL.md` in the package at `cwd`, or a root `SKILL.md` named after the package when no `name` is given. Never overwrites. Adds the skill to `package.json` `files` if it has one that doesn't cover it.

#### Parameters

| Parameter           | Type                                                                                              |
| ------------------- | ------------------------------------------------------------------------------------------------- |
| `__namedParameters` | [`InitSkillOptions`](https://docs.vlt.io/client/api-reference/init/reference.md#initskilloptions) |

#### Returns

[`InitSkillResult`](https://docs.vlt.io/client/api-reference/init/reference.md#initskillresult)

---

### isSkillName()

```ts
function isSkillName(name): boolean
```

Defined in: skill.ts:17

A valid agent skill `name` (<https://agentskills.io/specification>): 1-64 lowercase letters, digits and single hyphens, no leading or trailing hyphen. Shared with skill discovery.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `name`    | `string` |

#### Returns

`boolean`
