> For the complete documentation index, see [llms.txt](https://docs-lunar.earthly.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-lunar.earthly.dev/configuration/lunar-config/cataloger-hooks.md).

# catalogers/hooks

Configure cataloger hooks in lunar-config.yml — triggers like cron schedules or repository events that determine when catalogers run.

* `lunar-config.yml -> catalogers.<cataloger-index>.hook`
* `lunar-config.yml -> catalogers.<cataloger-index>.hooks`
* `lunar-cataloger.yml -> catalogers.<cataloger-index>.hook`
* `lunar-cataloger.yml -> catalogers.<cataloger-index>.hooks`
* Type: `object` (singular `hook`) or `array` (plural `hooks`)
* Form:

  ```yaml
  hook:
    type: <hook-type>
    <options>
  ```

  or

  ```yaml
  hooks:
    - type: <hook-type>
      <options>
    - type: <hook-type>
      <options>
    - ...
  ```

A cataloger hook defines a trigger point for when a cataloger should run. Catalogers can be triggered by various events such as code changes, or cron schedules. Both `hook` (singular) and `hooks` (plural array) are supported. Using `hook` is equivalent to using a single hook in the `hooks` field.

A hook has different configuration options depending on the type of event it is triggered by.

## Hook types

### `cron`

* Form:

  ```yaml
  type: cron
  schedule: <cron-schedule>
  ```

The `cron` type triggers the cataloger on a specified schedule. The schedule is defined using a cron expression.

### `repo`

* Form:

  ```yaml
  type: repo
  repo: github://<org>/<repo>
  # or, on GitLab:
  repo: gitlab://<host>/<namespace>/<project>
  ```

The `repo` type triggers the cataloger when a commit is made to a specified repository, named in the same URL format used elsewhere in the config. This cataloger type is most useful for centralized repositories that contain information about domains and/or components.

### `component-repo`

* Form:

  ```yaml
  type: component-repo
  clone-code: true # optional
  ```

The `component-repo` type triggers the cataloger when a commit is made to a component repository. This cataloger type is most useful when additional information about components is available in each of the respective repositories.

Although this cataloger type cannot be used to define new components, it can be used to augment the metadata (such as owner, description and tags) associated with existing components.

Set `clone-code: true` to have the component's repository checked out before the cataloger runs, so it reads repo-resident files (for example `catalog-info.yaml`, `CODEOWNERS`, or `lunar.yml`) directly from a working tree rather than fetching them through an API. The checkout is taken at the pushed commit for pushes to a branch the component tracks — the branch named by its `branch:` field, or the repository's default branch when it names none. That is the authoritative state the cataloger augments component metadata from; pushes to other branches (and branch deletions) run the cataloger without a checkout. Without `clone-code` the cataloger receives only the component identifier and no checkout.

### `component-cron`

* Form:

  ```yaml
  type: component-cron
  schedule: <cron-schedule>
  clone-code: true # optional
  ```

The `component-cron` type triggers a cataloger run for each component, on a specified schedule. Although this cataloger type cannot be used to define new components, it can be used to augment the metadata (such as owner, description and tags) based on its component JSON.

Set `clone-code: true` to have each component's repository checked out at the current HEAD of the branch it tracks (its `branch:` field, or the repository’s default branch when it names none) before the cataloger runs, so it reads repo-resident files (for example `catalog-info.yaml`, `CODEOWNERS`, or `lunar.yml`) directly from a working tree rather than fetching them through an API. A component whose repository isn't tracked yet, or has no commit ingested, runs without a checkout. Without `clone-code` the cataloger receives only the component identifier and no checkout.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-lunar.earthly.dev/configuration/lunar-config/cataloger-hooks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
