一键导入
lunar-config
Edit `lunar-config.yml` — wire together components, domains, collectors, policies, catalogers, and initiatives for a Lunar deployment.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Edit `lunar-config.yml` — wire together components, domains, collectors, policies, catalogers, and initiatives for a Lunar deployment.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create Lunar cataloger plugins (Bash scripts) that build the software catalog — syncing components and domains from external systems, or classifying them from custom signals like repo files, CI config, or each component's Component JSON.
Create Lunar collector plugins that gather SDLC metadata for guardrail enforcement. Use when building collectors (Bash scripts) that collect data from repositories, CI pipelines, or external APIs and write to the Component JSON. Covers hook types (code, cron, ci-after-command), the `lunar collect` command, plugin structure, containerization, and best practices.
Create Lunar policy plugins that enforce engineering standards. Use when building policies (Python scripts) that evaluate Component JSON data and produce pass/fail checks. Covers the lunar_policy SDK (Check class, assertions, Node navigation), enforcement levels, handling missing data, plugin structure, and testing patterns.
Craft correct SQL queries against the Lunar data model. Use when querying Lunar's PostgreSQL SQL API to analyze components, checks, policies, domains, or PRs. Covers view schemas, join patterns, filtering by component/commit/PR, time series queries, and JSONB path expressions.
Write Earthfiles for repeatable, containerized builds. Use when creating build automation with Earthly - a tool combining Dockerfile and Makefile concepts. Covers targets, artifacts, caching, functions, imports, Docker-in-Docker, CI integration, and best practices.
| name | lunar-config |
| description | Edit `lunar-config.yml` — wire together components, domains, collectors, policies, catalogers, and initiatives for a Lunar deployment. |
Edit lunar-config.yml — the YAML file that defines a Lunar deployment.
references/ files first. If they are insufficient, use the hosted docs backup below to find the full lunar-config.yml schema.lunar-config.yml, the CI workflow that runs lunar hub pull, and the secrets layout already wired up.A single YAML file kept in its own repo. Minimal example:
version: 0
default_image: earthly/lunar-scripts:1.0.0
hub:
host: lunar.example.com
grpcPort: 443
httpPort: 443
components:
github.com/example/api:
owner: api-team@example.com
domain: engineering
tags: [backend, go]
collectors:
- uses: github://earthly/lunar-lib/collectors/readme@v1.1.0
on: ["domain:engineering"]
policies:
- uses: github://earthly/lunar-lib/policies/readme@v1.1.0
enforcement: report-pr
After a config repo commit, CI runs lunar hub pull <repo> to push the new config to the hub. The hub then applies it to every governed component.
| Section | Required | Purpose |
|---|---|---|
version | yes | Schema version (0) |
hub | yes | Hub connection (host, grpcPort, httpPort) |
default_image | no | Container image; overridable per type (default_image_collectors, default_image_policies, default_image_catalogers) |
domains | no | Hierarchical organization with owners |
components | no | Repos / subdirs under governance |
catalogers | no | Sync catalog data from external systems |
collectors | yes | Gather SDLC data into Component JSON |
initiatives | no | Group related policies for scoring |
policies | yes | Evaluate Component JSON, produce checks |
uses:)- uses: github://earthly/lunar-lib/collectors/golang@v1.1.0 # GitHub plugin, pinned
- uses: github://earthly/lunar-lib/collectors/python@main # Branch (testing only)
- uses: ./collectors/my-custom-collector # Local path
Inline alternatives: runBash / runPython / mainBash / mainPython instead of uses:. For per-type details, use the references/ files first; if needed, see the hosted documentation backup.
collectors:
- uses: github://earthly/lunar-lib/collectors/sonarqube@main
include: [api, config, github-app] # or `exclude: [...]`
with:
project_key: "myorg_backend"
If neither is set, all sub-plugins run.
on:Every collector / policy / initiative targets components by tags:
on: [backend, go] # array form (OR)
on: "domain:engineering AND NOT domain:engineering.experimental" # expression form
| Prefix | Meaning |
|---|---|
domain:foo | Component is in domain foo (or sub-domain) |
component:github.com/foo/bar | Specific component |
collector:foo | Same components as collector foo |
policy:foo | Same components as policy foo |
Custom tags come from components[*].tags or from catalogers (e.g., github-org auto-tags by language). For edge cases, use the references/ files first; if needed, see the hosted documentation backup.
runs_on: — PRs vs Default Branch- uses: ./collectors/expensive-scan
runs_on: [default-branch] # values: prs, default-branch (default: both)
Walk new policies up over weeks — never start at block-pr:
| Level | Effect |
|---|---|
draft | Invisible to teams (for testing) |
score | Contributes to score; no PR comments |
report-pr | Comments on PRs; doesn't block |
block-pr | Blocks PR merges |
block-release | Blocks releases (lunar policy ok-release) |
block-pr-and-release | Both |
@<branch> refs are fine for testing unmerged plugins, but must be cleaned up or the next lunar hub pull fails:
@main: revert to @main after testing.@main: remove the entry entirely; re-add after the lunar-lib PR merges.When the same component appears in multiple places, later wins:
lunar.yml files in component reposdomains: / components: in lunar-config.ymlSo bulk-import via a cataloger like github-org, then override owner / domain / tags in components: for bespoke cases.
Same plugin, two instances with distinct name: and with::
policies:
- uses: github://earthly/lunar-lib/policies/dependencies@v1.1.0
name: dependency-versions-go
on: [go]
with:
language: "go"
min_versions: '{"github.com/sirupsen/logrus": "1.9.0"}'
- uses: github://earthly/lunar-lib/policies/dependencies@v1.1.0
name: dependency-versions-java
on: [java]
with:
language: "java"
min_versions: '{"org.apache.commons:commons-text": "1.10.0"}'
lunar config validate # syntax + structure
lunar config show # merged plugin structure
lunar collector dev <name> --component github.com/org/repo # try a collector
lunar policy dev <name> --component-json path/to.json # try a policy
# End-to-end: pipe collector output into policy
lunar collector dev my-collector --component github.com/org/repo \
| lunar policy dev my-policy --component-json -
After merging a config-repo PR, verify the CI step that runs lunar hub pull succeeded. If it fails, the hub won't pick up the changes.
@v1.1.0) in production; reserve @main / @<branch> for short testing windows.lunar hub pull when the branch is deleted.draft → score → report-pr → block-pr.domain: tags over component lists — new components inherit automatically.initiative: so scoring rolls them up.lunar config validate before pushing.The references/ files are the primary source:
Only if references/ does not answer the question, fetch:
.../policies.md / .../catalogers.md — Plugin sectionsnative modeIf a page still lacks enough context, ask the docs a specific, self-contained question with ?ask=<question> on that page URL, for example:
GET https://docs-lunar.earthly.dev/configuration/lunar-config.md?ask=How%20do%20I%20configure%20collector%20and%20policy%20targeting%3F