@ligeti/shell 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/bin-resolve.d.ts +5 -0
- package/dist/bin-resolve.d.ts.map +1 -1
- package/dist/bin-resolve.js +12 -3
- package/dist/bin-resolve.js.map +1 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +2 -3
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/installed-versions.d.ts +9 -0
- package/dist/cli/installed-versions.d.ts.map +1 -0
- package/dist/cli/installed-versions.js +50 -0
- package/dist/cli/installed-versions.js.map +1 -0
- package/dist/cli/plugin.d.ts +13 -0
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +188 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/pre-push.d.ts +12 -0
- package/dist/cli/pre-push.d.ts.map +1 -0
- package/dist/cli/pre-push.js +56 -0
- package/dist/cli/pre-push.js.map +1 -0
- package/dist/cli/share-dir.d.ts +3 -0
- package/dist/cli/share-dir.d.ts.map +1 -0
- package/dist/cli/share-dir.js +13 -0
- package/dist/cli/share-dir.js.map +1 -0
- package/dist/cli/steps.d.ts +16 -0
- package/dist/cli/steps.d.ts.map +1 -0
- package/dist/cli/steps.js +102 -0
- package/dist/cli/steps.js.map +1 -0
- package/dist/cli/version.d.ts +6 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +14 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +36 -4
- package/dist/cli.js.map +1 -1
- package/dist/installed-steps.d.ts +8 -0
- package/dist/installed-steps.d.ts.map +1 -0
- package/dist/installed-steps.js +90 -0
- package/dist/installed-steps.js.map +1 -0
- package/dist/settings.d.ts +1 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +4 -0
- package/dist/settings.js.map +1 -1
- package/dist/workers.d.ts +4 -1
- package/dist/workers.d.ts.map +1 -1
- package/dist/workers.js +59 -3
- package/dist/workers.js.map +1 -1
- package/package.json +10 -9
- package/share/.claude-plugin/marketplace.json +14 -0
- package/share/plugins/ligeti/.claude-plugin/plugin.json +6 -0
- package/share/plugins/ligeti/README.md +31 -0
- package/share/plugins/ligeti/docs/attestation.md +590 -0
- package/share/plugins/ligeti/docs/shell.md +442 -0
- package/share/plugins/ligeti/docs/troubleshooting.md +28 -0
- package/share/plugins/ligeti/references/rules.md +93 -0
- package/share/plugins/ligeti/skills/authoring-steps/SKILL.md +149 -0
- package/share/plugins/ligeti/skills/authoring-workflows/SKILL.md +146 -0
- package/share/plugins/ligeti/skills/installing-workflows/SKILL.md +121 -0
- package/share/plugins/ligeti/skills/onboard/SKILL.md +290 -0
- package/share/plugins/ligeti/skills/onboard/assets/ligeti-verify-attestation.github.yml +66 -0
- package/share/plugins/ligeti/skills/onboard/assets/ligeti-verify-attestation.yml +69 -0
- package/share/plugins/ligeti/skills/onboard/assets/pre-push.sh +11 -0
- package/share/plugins/ligeti/skills/scheduling-workflows/SKILL.md +102 -0
- package/share/plugins/ligeti/skills/troubleshooting/SKILL.md +94 -0
- package/share/plugins/ligeti/templates/step/.prettierignore +3 -0
- package/share/plugins/ligeti/templates/step/README.md +52 -0
- package/share/plugins/ligeti/templates/step/eslint.config.js +105 -0
- package/share/plugins/ligeti/templates/step/package.json +52 -0
- package/share/plugins/ligeti/templates/step/src/index.ts +3 -0
- package/share/plugins/ligeti/templates/step/src/settings.ts +27 -0
- package/share/plugins/ligeti/templates/step/src/tool-version.ts +61 -0
- package/share/plugins/ligeti/templates/step/test/rules.test.ts +144 -0
- package/share/plugins/ligeti/templates/step/test/settings.test.ts +30 -0
- package/share/plugins/ligeti/templates/step/test/tool-version.feature +32 -0
- package/share/plugins/ligeti/templates/step/tsconfig.build.json +26 -0
- package/share/plugins/ligeti/templates/step/tsconfig.json +21 -0
- package/share/plugins/ligeti/templates/workflow/.prettierignore +3 -0
- package/share/plugins/ligeti/templates/workflow/README.md +56 -0
- package/share/plugins/ligeti/templates/workflow/eslint.config.js +99 -0
- package/share/plugins/ligeti/templates/workflow/package.json +46 -0
- package/share/plugins/ligeti/templates/workflow/src/workflow.ts +72 -0
- package/share/plugins/ligeti/templates/workflow/test/__snapshots__/workflow.test.ts.snap +132 -0
- package/share/plugins/ligeti/templates/workflow/test/rules.test.ts +160 -0
- package/share/plugins/ligeti/templates/workflow/test/template-workflow.feature +31 -0
- package/share/plugins/ligeti/templates/workflow/test/workflow.test.ts +64 -0
- package/share/plugins/ligeti/templates/workflow/tsconfig.build.json +26 -0
- package/share/plugins/ligeti/templates/workflow/tsconfig.json +21 -0
- package/share/scripts/pre-push-gate.sh +308 -0
- package/share/scripts/pre-push-lib.sh +64 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: onboard
|
|
3
|
+
description: Use when a GitLab or GitHub repository should adopt Ligeti's local-verification gate — writing its `.ligeti/gate.json`, installing the pre-push hook that gates every push, and changing its CI so GitLab merge request pipelines only verify the attestation (GitHub gets a verify workflow and keeps its existing ones). Also use for any one of those three on its own.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Onboarding a repository to Ligeti's gate
|
|
7
|
+
|
|
8
|
+
You are working **in the target repository**, not in Ligeti. The outcome is a merge request against
|
|
9
|
+
the target repository that adds:
|
|
10
|
+
|
|
11
|
+
1. `.ligeti/gate.json` — the gate config: which public keys may attest, and which checks the gate runs;
|
|
12
|
+
2. a pre-push hook that gates each pushed commit through the installed Ligeti and a local Ligeti shell;
|
|
13
|
+
3. a CI change: on GitLab, merge request pipelines run **only** `ligeti-verify-attestation`, every
|
|
14
|
+
other job keeps running exactly where it ran before (default branch, tags, schedules). On GitHub, a
|
|
15
|
+
`verify-attestation` workflow is added for pull requests, and the repository's existing workflows
|
|
16
|
+
are left alone.
|
|
17
|
+
|
|
18
|
+
Ligeti's own reference is `${CLAUDE_PLUGIN_ROOT}/docs/attestation.md`. Read it before you start. When
|
|
19
|
+
this skill and that document disagree, the document wins. Tell the user about the mismatch.
|
|
20
|
+
|
|
21
|
+
Do the phases in order, and confirm each phase with the user before you start it. Every action that
|
|
22
|
+
changes a GitLab or GitHub project (labels, allow-lists, settings) is outward-facing, so ask before each one.
|
|
23
|
+
|
|
24
|
+
## Phase 0 — Preconditions
|
|
25
|
+
|
|
26
|
+
Stop and report if any of these fail:
|
|
27
|
+
|
|
28
|
+
- The target repository is a git repository whose push remote is GitLab or GitHub. Note which: it
|
|
29
|
+
decides the CI path (Phase 4) and the attestation store (below). Any other forge is not supported;
|
|
30
|
+
do not improvise an adapter.
|
|
31
|
+
- The attestation store follows the remote's host, per `${CLAUDE_PLUGIN_ROOT}/docs/attestation.md` ("Where attestations are
|
|
32
|
+
stored"): `gitlab.com` uses the project's GitLab package registry, every other host (GitHub, a
|
|
33
|
+
self-hosted GitLab) uses git notes on `refs/notes/ligeti-attestations`. Tell the user which applies.
|
|
34
|
+
- The working tree is clean. Ask how to handle uncommitted work, then create a branch such as
|
|
35
|
+
`ligeti-gate`.
|
|
36
|
+
- `ligeti --version` succeeds. If `ligeti` is not on `PATH`, tell the user to run
|
|
37
|
+
`npm install -g @ligeti/shell`, and continue once it works. Note the `@ligeti/attest` version it
|
|
38
|
+
prints: the keygen command below pins it.
|
|
39
|
+
- **Never read Ligeti's `.env`** or print any private key. You only ever need the public half of the
|
|
40
|
+
signing key.
|
|
41
|
+
|
|
42
|
+
## Phase 1 — Inventory the existing CI
|
|
43
|
+
|
|
44
|
+
On GitHub, read every workflow under `.github/workflows/`, and treat each job as a row. On GitLab, read
|
|
45
|
+
`.gitlab-ci.yml` and every file it includes (`include: local`, `project`, `template`, `component`,
|
|
46
|
+
`remote`). Build a table with one row per job. Columns:
|
|
47
|
+
|
|
48
|
+
| Column | What to record |
|
|
49
|
+
| --------- | --------------------------------------------------------------------------- |
|
|
50
|
+
| Job | the job's name |
|
|
51
|
+
| Kind | check (lint, test, build, typecheck…) or delivery (deploy, release, pages…) |
|
|
52
|
+
| Commands | what the job's `script` runs |
|
|
53
|
+
| Needs | image, services (Postgres, Redis…), variables, binaries |
|
|
54
|
+
| Runs when | its `rules` / `only` / `except`, or "always" |
|
|
55
|
+
|
|
56
|
+
Show the table to the user. The **check** jobs become gate checks in Phase 2. Every job, check or
|
|
57
|
+
delivery, gets the merge request exclusion in Phase 4.
|
|
58
|
+
|
|
59
|
+
## Phase 2 — The gate config
|
|
60
|
+
|
|
61
|
+
### Attestor
|
|
62
|
+
|
|
63
|
+
The attestor is the public half of the key the user's Ligeti shell signs with
|
|
64
|
+
(`LIGETI_ATTEST_KEY_FILE`). Ask the user for that key file's path. Do not look it up yourself. Derive
|
|
65
|
+
the entry without printing the private key:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
node -e '
|
|
69
|
+
const { createPrivateKey, createPublicKey, createHash } = require("node:crypto");
|
|
70
|
+
const pub = createPublicKey(createPrivateKey(require("node:fs").readFileSync(process.argv[1])));
|
|
71
|
+
const keyid = createHash("sha256").update(pub.export({ format: "der", type: "spki" })).digest("hex");
|
|
72
|
+
console.log(JSON.stringify({ keyid, publicKey: pub.export({ format: "pem", type: "spki" }) }));
|
|
73
|
+
' "<key file>"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
If the user has no key yet, they generate one, with `<version>` the `@ligeti/attest` version
|
|
77
|
+
`ligeti --version` printed:
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
npx --yes --package=@ligeti/attest@<version> ligeti-attest keygen --out ~/.ligeti/attest-key.pem
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Then they configure `LIGETI_ATTEST_KEY_FILE` and `LIGETI_ATTEST_SECRET` for their shell
|
|
84
|
+
(`${CLAUDE_PLUGIN_ROOT}/docs/attestation.md`, "Setting it up"). Ask the user for the
|
|
85
|
+
attestor's `name`, for example the machine name.
|
|
86
|
+
|
|
87
|
+
### Checks
|
|
88
|
+
|
|
89
|
+
Write one check per check job from Phase 1:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"version": 1,
|
|
94
|
+
"attestors": [{ "name": "…", "keyid": "…", "publicKey": "-----BEGIN PUBLIC KEY-----\n…" }],
|
|
95
|
+
"maxAgeHours": 24,
|
|
96
|
+
"checks": [
|
|
97
|
+
{
|
|
98
|
+
"id": "lint",
|
|
99
|
+
"description": "npm run lint -- eslint and prettier --check",
|
|
100
|
+
"command": ["npm", "run", "lint"],
|
|
101
|
+
"required": true,
|
|
102
|
+
"timeoutSeconds": 600
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The rules that are easy to get wrong:
|
|
109
|
+
|
|
110
|
+
- **`command` is an argv array and runs without a shell.** Pipes, `&&`, redirects, globs and `$VAR` do
|
|
111
|
+
not work. If a CI job's script is several commands, ask the user whether to run one script the
|
|
112
|
+
repository already has (a package script, a `Makefile` target). The other option is a new script
|
|
113
|
+
committed to the repository. Do not write `["bash", "-c", "…"]` unless the user asks for it.
|
|
114
|
+
- **Checks run in order, in a fresh clone** with no ignored or untracked files. Ligeti only runs
|
|
115
|
+
`pnpm install --frozen-lockfile` itself, and only when the commit has a `pnpm-lock.yaml`. Any other
|
|
116
|
+
ecosystem needs its own install check first, for example `["npm", "ci"]`, `["uv", "sync", "--frozen"]`
|
|
117
|
+
or `["bundle", "install"]`. A build step that later checks depend on comes next.
|
|
118
|
+
- **The environment is minimal.** A check sees only `PATH`, `HOME`, the locale variables and exactly the
|
|
119
|
+
names in its `requires.env`. Those variables must be set **where `ligeti serve` runs**. Exporting them
|
|
120
|
+
in the terminal that runs `git push` has no effect. CI services become local prerequisites. A
|
|
121
|
+
Postgres service, for example, turns into a database the developer runs plus a URL variable listed in
|
|
122
|
+
`requires.env`.
|
|
123
|
+
- **List every tool a check needs in `requires.binaries`**, beyond what is always on the developer
|
|
124
|
+
machine. A required check whose prerequisites are missing reports `skipped_unmet_prerequisites`, and that **fails** the
|
|
125
|
+
gate.
|
|
126
|
+
- `required: false` is only for advisory checks. Agree each one with the user.
|
|
127
|
+
- Give each check a `timeoutSeconds` well above its CI duration. The local machine may be slower or
|
|
128
|
+
faster, and the gate checkout always starts cold.
|
|
129
|
+
|
|
130
|
+
Write the file to `.ligeti/gate.json` and show it to the user.
|
|
131
|
+
|
|
132
|
+
## Phase 3 — The pre-push hook
|
|
133
|
+
|
|
134
|
+
The hook is `${CLAUDE_PLUGIN_ROOT}/skills/onboard/assets/pre-push.sh`. It checks that `ligeti` is on
|
|
135
|
+
`PATH`, then runs `ligeti pre-push "$@"`. That command runs the gate, which verifies each pushed
|
|
136
|
+
commit's attestation. If none is fresh, it asks the local shell to run `attest-and-publish`. Every
|
|
137
|
+
developer who pushes needs `npm install -g @ligeti/shell`.
|
|
138
|
+
|
|
139
|
+
Find out how the repository manages hooks, then install the hook to match:
|
|
140
|
+
|
|
141
|
+
| What the repository has | Install |
|
|
142
|
+
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
143
|
+
| nothing | Copy the hook to `.githooks/pre-push` (executable) and commit it. Run `git config core.hooksPath .githooks`; every developer runs this once. |
|
|
144
|
+
| `core.hooksPath` pointing at a committed directory | Copy the hook there as `pre-push`. If a `pre-push` already exists, ask the user how to chain the two. Never overwrite it. |
|
|
145
|
+
| husky (`.husky/`) | Commit the hook as `.githooks/ligeti-pre-push` and call it from `.husky/pre-push` with `"$@"`. It reads the push lines on stdin, so nothing may consume them first. |
|
|
146
|
+
| lefthook, pre-commit or another manager | Commit the hook as `.githooks/ligeti-pre-push` and register it as a `pre-push` hook through the manager. Pass the hook's arguments and stdin through unchanged. |
|
|
147
|
+
| only an uncommitted `.git/hooks/pre-push` | Ask the user. Their local hook is personal, and committing over it is not your call. |
|
|
148
|
+
|
|
149
|
+
Whichever way the hook is installed, run `chmod +x` on the installed file, because the asset ships
|
|
150
|
+
without its execute bit and git silently skips a hook that is not executable.
|
|
151
|
+
|
|
152
|
+
With the registry store the hook also needs a GitLab token that can read the project's package
|
|
153
|
+
registry. It looks in `GITLAB_TOKEN`, then `GITLAB_ACCESS_TOKEN`, then `glab`'s stored token. With the
|
|
154
|
+
notes store it needs no token: it reads and pushes `refs/notes/ligeti-attestations` over the same git
|
|
155
|
+
access as the push itself. The hook publishes that notes ref automatically, so nothing extra is
|
|
156
|
+
pushed by hand, but the push must name its remote (`git push origin`, not `git push <url>`).
|
|
157
|
+
`LIGETI_ATTESTATION_STORE` overrides the host rule; for a `gitlab.com` remote behind an SSH host alias,
|
|
158
|
+
see "The pre-push hook" in `${CLAUDE_PLUGIN_ROOT}/docs/attestation.md`. The hook needs the shell at
|
|
159
|
+
the address `ligeti run` uses: `LIGETI_PUBLIC_BASE_URL`, else `LIGETI_HOST` and `LIGETI_PORT` (default
|
|
160
|
+
`http://127.0.0.1:8100`), from the environment or the user's `.env`. Tell the user. Do not set tokens yourself.
|
|
161
|
+
|
|
162
|
+
## Phase 4 — CI: merge requests only verify
|
|
163
|
+
|
|
164
|
+
### GitLab
|
|
165
|
+
|
|
166
|
+
1. Copy `${CLAUDE_PLUGIN_ROOT}/skills/onboard/assets/ligeti-verify-attestation.yml` to `.gitlab/ci/ligeti-verify-attestation.yml` and add it
|
|
167
|
+
to `.gitlab-ci.yml`:
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
170
|
+
include:
|
|
171
|
+
- local: .gitlab/ci/ligeti-verify-attestation.yml
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Its `stage: test` must name a stage the pipeline has. If `stages:` is declared without `test`, change
|
|
175
|
+
the job's stage to one of the declared stages. Do not use `.pre` or `.post`: a pipeline whose only
|
|
176
|
+
job is in those stages is not created. `LIGETI_ATTEST_VERSION` pins the verifier, which the job
|
|
177
|
+
installs from npmjs.org. Keep the pin unless the user asks for another version.
|
|
178
|
+
|
|
179
|
+
If the target's host is not exactly `gitlab.com`, set the job's `LIGETI_ATTESTATION_STORE` variable
|
|
180
|
+
to `git-notes` (the template defaults to `gitlab-registry`), matching the host rule.
|
|
181
|
+
|
|
182
|
+
2. Exclude **every other job** from merge request pipelines. Prepend this rule to each job's `rules`
|
|
183
|
+
and keep the job's existing rules after it:
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
rules:
|
|
187
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
188
|
+
when: never
|
|
189
|
+
- …the job's existing rules…
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
- A job with no `rules`, `only` or `except` gets the exclusion followed by `- when: on_success`.
|
|
193
|
+
Otherwise adding `rules` would change when it runs.
|
|
194
|
+
- A job that uses `only`/`except` must be converted to the equivalent `rules`, because GitLab
|
|
195
|
+
rejects a job that mixes the two. Show the user each conversion.
|
|
196
|
+
- For a job built with `extends`, put the rules on the concrete job unless every extending job shares
|
|
197
|
+
the base's rules. A job's own `rules` replace the inherited ones; they are not merged.
|
|
198
|
+
- A job from an `include` you cannot edit (a template, a component, another project) has to be
|
|
199
|
+
overridden by redefining it under the same name with the combined `rules`. Copy the included
|
|
200
|
+
job's own rules after the exclusion, because the override replaces them.
|
|
201
|
+
|
|
202
|
+
3. Check `workflow:rules`. Without them, pushing to a branch with an open merge request creates both a
|
|
203
|
+
branch pipeline (all the checks) and a merge request pipeline (only the verification). If the
|
|
204
|
+
project has no `workflow:rules`, propose GitLab's standard pair and ask before adding it:
|
|
205
|
+
|
|
206
|
+
```yaml
|
|
207
|
+
workflow:
|
|
208
|
+
rules:
|
|
209
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
210
|
+
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
|
|
211
|
+
when: never
|
|
212
|
+
- when: always
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
If the project already has `workflow:rules`, make sure they let merge request pipelines through.
|
|
216
|
+
|
|
217
|
+
4. Validate with `glab ci lint` and fix everything it reports.
|
|
218
|
+
|
|
219
|
+
### GitHub
|
|
220
|
+
|
|
221
|
+
1. Copy `${CLAUDE_PLUGIN_ROOT}/skills/onboard/assets/ligeti-verify-attestation.github.yml` to `.github/workflows/verify-attestation.yml`.
|
|
222
|
+
It runs on pull requests, fetches `refs/notes/ligeti-attestations`, reads the head commit's note and
|
|
223
|
+
verifies it with `@ligeti/attest` from npmjs.org. `LIGETI_ATTEST_VERSION` pins the verifier: keep the
|
|
224
|
+
pin unless the user asks for another version, and never leave it unpinned. The workflow reads the
|
|
225
|
+
pull request's labels live, so a `gate-config-reviewed` label added after a run is seen on re-run.
|
|
226
|
+
2. Do not edit the repository's other workflows: unlike GitLab, nothing needs excluding. If
|
|
227
|
+
the repository uses actions pinned by commit sha, keep the template's pins.
|
|
228
|
+
3. Tell the user that GitHub does not display notes, so the only visible signal is the
|
|
229
|
+
`verify-attestation` check.
|
|
230
|
+
|
|
231
|
+
## Phase 5 — Forge settings
|
|
232
|
+
|
|
233
|
+
Ask before each of these. Each changes a GitLab or GitHub project.
|
|
234
|
+
|
|
235
|
+
### GitLab
|
|
236
|
+
|
|
237
|
+
- **Create the review label** `gate-config-reviewed` in the target project. The drift guard fails a
|
|
238
|
+
merge request that changes `.ligeti/gate.json` unless the merge request carries this label.
|
|
239
|
+
|
|
240
|
+
### GitHub
|
|
241
|
+
|
|
242
|
+
- **Create the review label** `gate-config-reviewed` (`gh label create gate-config-reviewed`). The drift
|
|
243
|
+
guard fails a pull request that changes `.ligeti/gate.json` unless it carries this label.
|
|
244
|
+
- Suggest a branch protection rule on the default branch that requires the `verify-attestation` check,
|
|
245
|
+
since otherwise the verification can be bypassed.
|
|
246
|
+
- No allow-list or package access is needed: the verifier comes from public npmjs.org and the
|
|
247
|
+
attestation from the repository itself.
|
|
248
|
+
|
|
249
|
+
### Both
|
|
250
|
+
|
|
251
|
+
- Suggest a `CODEOWNERS` entry for `.ligeti/gate.json` and any agent-instruction files (`CLAUDE.md`,
|
|
252
|
+
`AGENTS.md`).
|
|
253
|
+
- Suggest a protected default branch with "Pipelines must succeed", since otherwise the verification
|
|
254
|
+
job can be bypassed. With the registry store, also make sure no cleanup job deletes
|
|
255
|
+
`ligeti-attestation` packages: a missing attestation fails the merge request.
|
|
256
|
+
|
|
257
|
+
## Phase 6 — The Ligeti shell
|
|
258
|
+
|
|
259
|
+
The user configures this side in their own Ligeti setup. Never edit or read their `.env`. Tell them:
|
|
260
|
+
|
|
261
|
+
- `attest-and-publish` is one of the default workflows, so `ligeti serve` offers it while
|
|
262
|
+
`LIGETI_WORKFLOWS` is unset. If they have set `LIGETI_WORKFLOWS`, the list replaces the defaults,
|
|
263
|
+
so it must also name attest-and-publish's directory as an absolute path (a relative entry resolves
|
|
264
|
+
against the config directory); `ligeti config get LIGETI_WORKFLOWS` shows the current list.
|
|
265
|
+
- With the registry store, the shell's `GITLAB_TOKEN` must be able to write the target project's
|
|
266
|
+
package registry. With the notes store the shell's worker pushes the note using the environment
|
|
267
|
+
`ligeti serve` was started with: `SSH_AUTH_SOCK` and git credential helpers reached through `HOME`.
|
|
268
|
+
`GITLAB_TOKEN` and `GITHUB_TOKEN` are not passed to git, so HTTPS needs a credential helper that
|
|
269
|
+
does not rely on an env-only token, or SSH.
|
|
270
|
+
- If a Ligeti workflow pushes to this repository and the repository uses Ligeti's pre-push hook with
|
|
271
|
+
the registry store, set `LIGETI_STEP_GIT_PUSH_ENV=GITLAB_TOKEN,LIGETI_PUBLIC_BASE_URL` where
|
|
272
|
+
`ligeti serve` runs (see [the git-worktree step's README](https://gitlab.com/nagyv-projects/ligeti/-/blob/main/steps/git-worktree/README.md)).
|
|
273
|
+
- Someone who may push to the repository cannot forge an attestation, since a rewritten note fails
|
|
274
|
+
verification and the next push re-gates and replaces it. They can delete or replace notes, which
|
|
275
|
+
forces a re-gate.
|
|
276
|
+
- Pull requests from forks fail verification with the notes store: the note is pushed to the
|
|
277
|
+
contributor's fork, and the verify job reads `origin`.
|
|
278
|
+
- Every variable listed in a check's `requires.env` must be set for `ligeti serve`, and every binary in
|
|
279
|
+
`requires.binaries` must be on its `PATH`. Restart the shell after changing either.
|
|
280
|
+
|
|
281
|
+
## Phase 7 — The onboarding merge request
|
|
282
|
+
|
|
283
|
+
1. Commit the gate config, the hook and the CI change on the onboarding branch.
|
|
284
|
+
2. Push it. The new hook gates this push. If the gate fails, fix the failing check (usually a missing
|
|
285
|
+
prerequisite or an argv that needed a shell) and push again.
|
|
286
|
+
3. Open the merge request (pull request on GitHub). The drift guard treats a gate config that does not
|
|
287
|
+
exist on the target branch as changed, so **it needs the `gate-config-reviewed` label**. Add the label
|
|
288
|
+
after the user has reviewed `.ligeti/gate.json`, then re-run the pipeline or check.
|
|
289
|
+
4. Report the result: the merge request link, which jobs no longer run in merge request pipelines, and
|
|
290
|
+
anything from Phases 5–6 still left for the user to do.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# ABOUTME: Pull request workflow that reads this commit's DSSE gate attestation from the git note on
|
|
2
|
+
# ABOUTME: refs/notes/ligeti-attestations and verifies it with the pinned, published `@ligeti/attest`.
|
|
3
|
+
|
|
4
|
+
name: verify-attestation
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
types: [opened, synchronize, reopened, labeled, unlabeled]
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
pull-requests: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
verify-attestation:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
env:
|
|
18
|
+
LIGETI_ATTEST_VERSION: "2.0.0"
|
|
19
|
+
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
|
|
20
|
+
BASE_REF: ${{ github.event.pull_request.base.ref }}
|
|
21
|
+
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
22
|
+
GH_TOKEN: ${{ github.token }}
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
|
25
|
+
with:
|
|
26
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
27
|
+
fetch-depth: 0
|
|
28
|
+
filter: blob:none
|
|
29
|
+
|
|
30
|
+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
|
31
|
+
with:
|
|
32
|
+
node-version: 22
|
|
33
|
+
|
|
34
|
+
- name: Verify the attestation
|
|
35
|
+
run: |
|
|
36
|
+
set -e
|
|
37
|
+
echo "verify-attestation: verifying commit ${COMMIT_SHA}"
|
|
38
|
+
|
|
39
|
+
git fetch --filter=blob:none origin "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"
|
|
40
|
+
|
|
41
|
+
NOTES_REF="refs/notes/ligeti-attestations"
|
|
42
|
+
if ! git fetch --depth 1 origin "+${NOTES_REF}:${NOTES_REF}"; then
|
|
43
|
+
echo "verify-attestation: cannot fetch ${NOTES_REF} from origin; has the attestation been published?" >&2
|
|
44
|
+
exit 1
|
|
45
|
+
fi
|
|
46
|
+
ENVELOPE_FILE="${RUNNER_TEMP}/attestation.json"
|
|
47
|
+
if ! git notes --ref=ligeti-attestations show "$COMMIT_SHA" > "$ENVELOPE_FILE"; then
|
|
48
|
+
echo "verify-attestation: no attestation note for commit ${COMMIT_SHA} on ${NOTES_REF}" >&2
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
set -- --repo "$GITHUB_WORKSPACE" --commit "$COMMIT_SHA" \
|
|
53
|
+
--target-ref "refs/remotes/origin/${BASE_REF}" --base "refs/remotes/origin/${BASE_REF}" \
|
|
54
|
+
--envelope-file "$ENVELOPE_FILE"
|
|
55
|
+
# QUIRK(github-actions): a re-run reuses the original event payload, so labels are read live from the API https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/re-running-workflows-and-jobs
|
|
56
|
+
PR_LABELS="$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json labels --jq '.labels[].name')"
|
|
57
|
+
while IFS= read -r label; do
|
|
58
|
+
if [ -n "$label" ]; then
|
|
59
|
+
set -- "$@" --label "$label"
|
|
60
|
+
fi
|
|
61
|
+
done <<LABELS
|
|
62
|
+
$PR_LABELS
|
|
63
|
+
LABELS
|
|
64
|
+
|
|
65
|
+
cd "$(mktemp -d)"
|
|
66
|
+
npx --yes --package="@ligeti/attest@${LIGETI_ATTEST_VERSION}" ligeti-attest verify "$@"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# ABOUTME: Merge request job that fetches this commit's gate attestation from the project's own generic
|
|
2
|
+
# ABOUTME: package registry or a git note and verifies it with the pinned `@ligeti/attest` from npmjs.org.
|
|
3
|
+
|
|
4
|
+
ligeti-verify-attestation:
|
|
5
|
+
stage: test
|
|
6
|
+
image: node:22
|
|
7
|
+
rules:
|
|
8
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
9
|
+
cache: []
|
|
10
|
+
variables:
|
|
11
|
+
LIGETI_ATTEST_VERSION: "2.0.0"
|
|
12
|
+
LIGETI_ATTESTATION_STORE: "gitlab-registry"
|
|
13
|
+
script:
|
|
14
|
+
- |
|
|
15
|
+
set -e
|
|
16
|
+
|
|
17
|
+
# QUIRK(gitlab): CI_MERGE_REQUEST_SOURCE_BRANCH_SHA is set only in merged results pipelines, where CI_COMMIT_SHA is an ephemeral merge commit https://docs.gitlab.com/ci/variables/predefined_variables/
|
|
18
|
+
SOURCE_BRANCH_HEAD_SHA="${CI_MERGE_REQUEST_SOURCE_BRANCH_SHA:-$CI_COMMIT_SHA}"
|
|
19
|
+
echo "ligeti-verify-attestation: verifying commit ${SOURCE_BRANCH_HEAD_SHA}"
|
|
20
|
+
|
|
21
|
+
# QUIRK(gitlab): the default CI clone is shallow, so history must be deepened and the target branch fetched explicitly https://docs.gitlab.com/ci/pipelines/settings/
|
|
22
|
+
if [ "$(git rev-parse --is-shallow-repository)" = "true" ]; then
|
|
23
|
+
git fetch --filter=blob:none --unshallow origin
|
|
24
|
+
fi
|
|
25
|
+
# QUIRK(gitlab): a fork merge request's head commit is reachable only from refs/merge-requests/<iid>/head, so its history may stay shallow after --unshallow, and a fork project's own pipeline has no such ref on origin https://docs.gitlab.com/ci/pipelines/merge_request_pipelines/
|
|
26
|
+
git fetch --filter=blob:none origin \
|
|
27
|
+
"+refs/merge-requests/${CI_MERGE_REQUEST_IID}/head:refs/merge-requests/${CI_MERGE_REQUEST_IID}/head" \
|
|
28
|
+
|| echo "ligeti-verify-attestation: cannot fetch the merge request head from origin; the verifier fails closed if the merge-base is missing" >&2
|
|
29
|
+
git fetch --filter=blob:none origin \
|
|
30
|
+
"+${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}:refs/remotes/origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}"
|
|
31
|
+
TARGET_REF="refs/remotes/origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}"
|
|
32
|
+
|
|
33
|
+
case "$LIGETI_ATTESTATION_STORE" in
|
|
34
|
+
gitlab-registry)
|
|
35
|
+
ATTESTATION_URL="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/ligeti-attestation/${SOURCE_BRANCH_HEAD_SHA}/attestation.json"
|
|
36
|
+
|
|
37
|
+
curl --fail --show-error --location \
|
|
38
|
+
--header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
|
|
39
|
+
--output "$CI_PROJECT_DIR/ligeti-attestation.json" \
|
|
40
|
+
"$ATTESTATION_URL"
|
|
41
|
+
;;
|
|
42
|
+
git-notes)
|
|
43
|
+
NOTES_REF="refs/notes/ligeti-attestations"
|
|
44
|
+
if ! git fetch --depth 1 origin "+${NOTES_REF}:${NOTES_REF}"; then
|
|
45
|
+
echo "ligeti-verify-attestation: cannot fetch ${NOTES_REF} from origin; has the attestation been published?" >&2
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
48
|
+
if ! git notes --ref=ligeti-attestations show "$SOURCE_BRANCH_HEAD_SHA" > "$CI_PROJECT_DIR/ligeti-attestation.json"; then
|
|
49
|
+
echo "ligeti-verify-attestation: no attestation note for commit ${SOURCE_BRANCH_HEAD_SHA} on ${NOTES_REF}" >&2
|
|
50
|
+
exit 1
|
|
51
|
+
fi
|
|
52
|
+
;;
|
|
53
|
+
*)
|
|
54
|
+
echo "ligeti-verify-attestation: unknown LIGETI_ATTESTATION_STORE '${LIGETI_ATTESTATION_STORE}' (expected gitlab-registry or git-notes)" >&2
|
|
55
|
+
exit 1
|
|
56
|
+
;;
|
|
57
|
+
esac
|
|
58
|
+
|
|
59
|
+
set -- --repo "$CI_PROJECT_DIR" --commit "$SOURCE_BRANCH_HEAD_SHA" --target-ref "$TARGET_REF" \
|
|
60
|
+
--base "$TARGET_REF" --envelope-file "$CI_PROJECT_DIR/ligeti-attestation.json"
|
|
61
|
+
OLD_IFS=$IFS
|
|
62
|
+
IFS=','
|
|
63
|
+
for label in $CI_MERGE_REQUEST_LABELS; do
|
|
64
|
+
set -- "$@" --label "$label"
|
|
65
|
+
done
|
|
66
|
+
IFS=$OLD_IFS
|
|
67
|
+
|
|
68
|
+
cd "$(mktemp -d)"
|
|
69
|
+
npx --yes --package="@ligeti/attest@${LIGETI_ATTEST_VERSION}" ligeti-attest verify "$@"
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ABOUTME: A target repository's pre-push hook: hands the push to the installed Ligeti through
|
|
3
|
+
# ABOUTME: `ligeti pre-push`, which runs the gate with the caller's environment.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
if ! command -v ligeti >/dev/null 2>&1; then
|
|
7
|
+
echo "pre-push: ligeti is not on PATH -- install Ligeti with \`npm install -g @ligeti/shell\` and push again" >&2
|
|
8
|
+
exit 1
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
exec ligeti pre-push "$@"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scheduling-workflows
|
|
3
|
+
description: Use when running a Ligeti workflow on a schedule, adding, changing, pausing or removing a cron entry, or when a cron entry does not fire or fires at the wrong time.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scheduling a workflow
|
|
7
|
+
|
|
8
|
+
A cron entry runs a configured workflow on a schedule. The file format and every rule are in
|
|
9
|
+
`${CLAUDE_PLUGIN_ROOT}/docs/shell.md`, section "Cron entries"; this file is the procedure.
|
|
10
|
+
|
|
11
|
+
## Do not
|
|
12
|
+
|
|
13
|
+
- Never read `.env`; configure only through `ligeti config`.
|
|
14
|
+
- Do not restart the shell yourself. Changes apply only when `ligeti serve` starts, so ask the
|
|
15
|
+
operator to restart it.
|
|
16
|
+
|
|
17
|
+
## Add or change an entry
|
|
18
|
+
|
|
19
|
+
1. **Find the file.** `ligeti config get LIGETI_CRON_FILE`. It exits `1` when unset, which means
|
|
20
|
+
`<config directory>/cron.yaml`; that file may not exist yet, and you create it. Run
|
|
21
|
+
`ligeti cron check` to learn the path: with no file it prints `no cron file at <path>`. (The
|
|
22
|
+
shell's `/config` page also shows the config directory.) Set
|
|
23
|
+
`LIGETI_CRON_FILE` only when the operator asks to move the file, and only after creating it: a
|
|
24
|
+
file named explicitly must exist or startup fails.
|
|
25
|
+
2. **Check the workflow fits a schedule.** Read its README (the workflow's package directory under
|
|
26
|
+
`LIGETI_WORKFLOWS`, or `node_modules/<package>/README.md` in its install directory). Warn the
|
|
27
|
+
operator when it does not say the workflow is meant for a schedule, meaning that it finds its own
|
|
28
|
+
work on each tick and serialises overlapping ticks. Two further facts to state: ticks missed
|
|
29
|
+
while the shell is down are not backfilled, and a frequent schedule costs a full run, and an
|
|
30
|
+
agent session if the workflow starts agents, per tick.
|
|
31
|
+
3. **Write the entry.** The file is a map from a free-text name (not blank, at most 100
|
|
32
|
+
characters) to an entry:
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
nightly-report:
|
|
36
|
+
workflow: <name of a configured workflow>
|
|
37
|
+
schedule: "0 6 * * 1-5"
|
|
38
|
+
timezone: Europe/Budapest # optional
|
|
39
|
+
input: # optional, defaults to {}
|
|
40
|
+
<field>: <value>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The only keys are `workflow`, `schedule`, `input` and `timezone`; any other key fails. There is
|
|
44
|
+
no "disabled" flag (see Pause). The input is the same on every tick. Get the input fields from
|
|
45
|
+
`ligeti schema <workflow>`.
|
|
46
|
+
|
|
47
|
+
4. **Say which time zone applies.** The expression is read in the entry's `timezone` when set
|
|
48
|
+
(an IANA name; an offset is rejected), otherwise in the shell's `TZ`, otherwise in the system
|
|
49
|
+
time zone. State the zone for each entry you write. When the operator means a wall-clock time
|
|
50
|
+
("6 am at the office"), write an explicit `timezone` rather than relying on the host. Daylight
|
|
51
|
+
saving: a local time that does not exist that day is skipped and one that occurs twice runs
|
|
52
|
+
twice.
|
|
53
|
+
5. **Check after every edit, before asking for a restart.**
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
ligeti cron check
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
It prints one line per problem, each starting with the file's path, and exits `0` only when
|
|
60
|
+
there is none. It checks the file's shape, each entry's keys and name and the cron expression
|
|
61
|
+
offline; from the running shell it also checks that each workflow is configured and not
|
|
62
|
+
`blocked` and that each input matches the schema the worker registered. A shell that cannot be
|
|
63
|
+
reached skips those checks with a notice on stderr: start the shell or pass `--url <base>`
|
|
64
|
+
before trusting a clean result. Fix every problem and rerun.
|
|
65
|
+
|
|
66
|
+
`cron check` does not cover:
|
|
67
|
+
- A workflow that has not registered yet: its input is left unchecked (a notice on stderr).
|
|
68
|
+
Validate the input against `ligeti schema <workflow>` yourself, once the workflow shows as
|
|
69
|
+
`registered` in `ligeti workflows`.
|
|
70
|
+
- Whether the entry name collides with a schedule another application owns; only startup
|
|
71
|
+
detects that, and it then fails naming the entry and the owner. Choose a distinctive name.
|
|
72
|
+
|
|
73
|
+
6. **Apply.** Ask the operator to restart `ligeti serve`, then confirm the shell is listening
|
|
74
|
+
(`ligeti workflows` answers). An invalid file fails startup and leaves the stored schedules as
|
|
75
|
+
they were; its stderr names the file or the entry at fault, so go back to step 5.
|
|
76
|
+
7. **Verify.**
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
ligeti runs --cron
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
It prints one line per entry (name, workflow, schedule, time zone, `last fired …` or
|
|
83
|
+
`never fired`), then the cron runs. Confirm the entry is listed with the expected schedule and
|
|
84
|
+
zone. The Cron runs tab, `/cron-runs` on the shell's base URL, shows the same. `never fired` is
|
|
85
|
+
normal until the first tick.
|
|
86
|
+
|
|
87
|
+
## Pause, resume, remove
|
|
88
|
+
|
|
89
|
+
- **Pause** by removing the entry from the file; **resume** by adding it back. Run
|
|
90
|
+
`ligeti cron check`, then ask for a restart.
|
|
91
|
+
- **Remove** the same way. An entry removed from the file has its schedule deleted at the next
|
|
92
|
+
start, so it stops firing.
|
|
93
|
+
- An empty map, `{}`, stops every schedule of every configured workflow. Say so before writing it.
|
|
94
|
+
- Until the restart, the old schedules keep firing.
|
|
95
|
+
|
|
96
|
+
## When a tick fails or does not fire
|
|
97
|
+
|
|
98
|
+
- A run that ended in error goes to the `troubleshooting` skill. `ligeti trace latest-failed`
|
|
99
|
+
covers cron runs.
|
|
100
|
+
- No tick at all: confirm the entry in `ligeti runs --cron`, the zone it is read in, that the
|
|
101
|
+
shell was running at the scheduled time (missed ticks are not backfilled), and that the
|
|
102
|
+
workflow's worker is `running` on `/workers`.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: troubleshooting
|
|
3
|
+
description: Use when a Ligeti run failed, hung or produced a wrong result and you need to find out why — diagnosing a failed run, reading a step's output or error, reading what an agent attempt did, or finding runs by status, workflow or time.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnosing a failed run
|
|
7
|
+
|
|
8
|
+
Use the shell's read tooling. It answers from the same data you would otherwise dig for by hand,
|
|
9
|
+
already joined and truncated. The reference for every command and route is
|
|
10
|
+
`${CLAUDE_PLUGIN_ROOT}/docs/shell.md` (section `ligeti runs / trace / transcript`);
|
|
11
|
+
this file is only the order to use them in.
|
|
12
|
+
|
|
13
|
+
## Do not
|
|
14
|
+
|
|
15
|
+
- Do not query Postgres `dbos.*` tables. The only deliberate exception is the SQL of the Grafana
|
|
16
|
+
dashboards in [`analytics/`](https://gitlab.com/nagyv-projects/ligeti/-/tree/main/analytics), which reads them through a read-only
|
|
17
|
+
role for aggregate analytics; it is not a way for an agent to diagnose a run.
|
|
18
|
+
- Do not hunt through the state directory or `~/.claude/projects/`. The trace names every attempt file and the
|
|
19
|
+
files route serves them.
|
|
20
|
+
- Never read `.env`.
|
|
21
|
+
|
|
22
|
+
## Prerequisite
|
|
23
|
+
|
|
24
|
+
`ligeti serve` must be running. The commands find it by `--url <base>`, then
|
|
25
|
+
`$LIGETI_PUBLIC_BASE_URL`, then `http://<LIGETI_HOST>:<LIGETI_PORT>`. Exit code `3` means the shell is
|
|
26
|
+
unreachable; `2` means the run, attempt or failed run does not exist.
|
|
27
|
+
|
|
28
|
+
Invoke the CLI as `ligeti <command>`.
|
|
29
|
+
|
|
30
|
+
## Playbook
|
|
31
|
+
|
|
32
|
+
1. **Start from the newest failure.**
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
ligeti trace latest-failed
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or `ligeti trace <runId>` for a run you already know. Add `--json` for the full structure.
|
|
39
|
+
`latest-failed` matches only status `ERROR`, launched or cron; for a run that ended otherwise, find it with
|
|
40
|
+
`ligeti runs --status CANCELLED` (or `MAX_RECOVERY_ATTEMPTS_EXCEEDED`) and trace its id; add `--cron` to list cron runs.
|
|
41
|
+
|
|
42
|
+
2. **Read the `agent failed:` and `failed at:` lines at the end.** An `agent failed:` line names a
|
|
43
|
+
run, attempt and step whose agent ended in error, with the transcript command to run. A workflow
|
|
44
|
+
may handle that failure and finish `SUCCESS`, so a run that looks fine can still carry one; those
|
|
45
|
+
attempts are marked `FAILED` in the attempts list. `failed at:` names the deepest failed step and its error. If
|
|
46
|
+
that is a step that started a child run (`→ child <id>`), the cause is usually inside it; the
|
|
47
|
+
trace already nests child runs, so read down the indentation.
|
|
48
|
+
|
|
49
|
+
3. **Fetch a truncated output in full.** A step output over 2000 characters shows a preview and
|
|
50
|
+
names the route:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
curl -s -H 'Accept: application/json' "$BASE/runs/<runId>/steps/<functionId>"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`$BASE` is the same base URL as above. Use the run id that owns the step, not the root's.
|
|
57
|
+
|
|
58
|
+
4. **For an agent step, read what the agent did.** The trace lists agent attempts under their run,
|
|
59
|
+
with attempt id, kind, session id and the files present.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
ligeti transcript <runId> # newest attempt in the run's tree
|
|
63
|
+
ligeti transcript <runId> --attempt <attemptId>
|
|
64
|
+
ligeti transcript <runId> --attempt <attemptId> --raw # full JSONL
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The digest truncates tool inputs and results; use `--raw` when it cuts off what you need.
|
|
68
|
+
|
|
69
|
+
5. **Read an attempt file** (`prompt.txt`, `output.json`, `agent.log`, ...) through the files route,
|
|
70
|
+
using a name from the attempt's file list:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
curl -s "$BASE/runs/<runId>/attempts/<attemptId>/files/agent.log"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`agent.log` holds only the wrapper's lifecycle lines, not the conversation. A hook-decided
|
|
77
|
+
failure is usually explained in `output.json` and `agent.log`.
|
|
78
|
+
|
|
79
|
+
6. **Find other runs.**
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
ligeti runs --status ERROR --workflow <name> --since 2026-01-01T00:00:00Z
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`--status` and `--workflow` repeat. Only root runs are listed unless you add `--children`.
|
|
86
|
+
|
|
87
|
+
## Not covered
|
|
88
|
+
|
|
89
|
+
- Worker log lines are not in the trace. They are in `$LIGETI_STATE_DIR/logs/<workflow name>.log` (the `LIGETI_STATE_DIR` row of `$BASE/config` shows the running shell's directory, resolved against the Config directory at the top of that page when relative;
|
|
90
|
+
`ligeti config get LIGETI_STATE_DIR` agrees only with the same `LIGETI_CONFIG_DIR` as `ligeti serve`); read that file
|
|
91
|
+
only after the trace has told you which workflow and roughly when.
|
|
92
|
+
- A transcript exists only once the agent finished or the Stop hook ran. A killed attempt may have
|
|
93
|
+
none; then `agent.log` is what you have.
|
|
94
|
+
- dbos-argus (`LIGETI_ARGUS_URL`) is an optional link for a human in the browser. Do not depend on it.
|