lastlight-core 0.23.4 → 0.23.6

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.
Files changed (46) hide show
  1. package/config/default.yaml +16 -0
  2. package/dist/admin/routes.d.ts +29 -0
  3. package/dist/admin/routes.js +136 -0
  4. package/dist/admin/routes.js.map +1 -1
  5. package/dist/config/config.d.ts +23 -0
  6. package/dist/config/config.js +25 -0
  7. package/dist/config/config.js.map +1 -1
  8. package/dist/cron/dependabot-discovery.d.ts +43 -4
  9. package/dist/cron/dependabot-discovery.js +47 -7
  10. package/dist/cron/dependabot-discovery.js.map +1 -1
  11. package/dist/engine/dispatcher.d.ts +5 -1
  12. package/dist/engine/dispatcher.js +88 -8
  13. package/dist/engine/dispatcher.js.map +1 -1
  14. package/dist/engine/fix-markers.d.ts +27 -0
  15. package/dist/engine/fix-markers.js +31 -0
  16. package/dist/engine/fix-markers.js.map +1 -1
  17. package/dist/engine/github/github.d.ts +1 -1
  18. package/dist/engine/github/github.js +1 -1
  19. package/dist/engine/pr-decisions.d.ts +71 -8
  20. package/dist/engine/pr-decisions.js +121 -24
  21. package/dist/engine/pr-decisions.js.map +1 -1
  22. package/dist/engine/pr-escalation.d.ts +112 -18
  23. package/dist/engine/pr-escalation.js +204 -31
  24. package/dist/engine/pr-escalation.js.map +1 -1
  25. package/dist/engine/pr-state.d.ts +152 -15
  26. package/dist/engine/pr-state.js +351 -94
  27. package/dist/engine/pr-state.js.map +1 -1
  28. package/dist/engine/router.js +116 -4
  29. package/dist/engine/router.js.map +1 -1
  30. package/dist/index.js +12 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/sandbox/index.js +41 -1
  33. package/dist/sandbox/index.js.map +1 -1
  34. package/dist/sandbox/k8s/init-clone.d.ts +7 -4
  35. package/dist/sandbox/k8s/init-clone.js +35 -5
  36. package/dist/sandbox/k8s/init-clone.js.map +1 -1
  37. package/dist/workflows/simple.d.ts +24 -1
  38. package/dist/workflows/simple.js +39 -7
  39. package/dist/workflows/simple.js.map +1 -1
  40. package/package.json +3 -3
  41. package/skills/fixing/SKILL.md +83 -11
  42. package/workflows/dependabot-ci-fix.yaml +47 -0
  43. package/workflows/pr-fix.yaml +13 -0
  44. package/workflows/prompts/dependabot-ci-fix.md +40 -19
  45. package/workflows/prompts/dependabot-pr-merge.md +16 -9
  46. package/workflows/prompts/pr-fix.md +15 -6
@@ -94,8 +94,21 @@ phases:
94
94
  # `dependabot-ci-fix.yaml` for the full story. Short version: `/bin/sh` is
95
95
  # dash, the agent writes `set -euo pipefail`, dash rejects `-o pipefail` and
96
96
  # exits 2 on line 2, and the gate was a constant red in milliseconds.
97
+ #
98
+ # `until:` short-circuits `until_bash` — again see `dependabot-ci-fix.yaml`
99
+ # for the full argument, since the two loops are one family and must not
100
+ # diverge. Short version: `outcome=pushed` means the commit is on the branch
101
+ # and GitHub's checks are now the better authority, so re-running a slower
102
+ # copy of them in a fresh container buys nothing and costs minutes. It fires
103
+ # on `pushed` only — `no-change` / `gave-up` pushed nothing, so no external
104
+ # check exists, the local gate is the only evidence there is, and its red
105
+ # verdict is what earns the agent the next iteration (short-circuiting those
106
+ # too would make `fix.localIterations` dead config). `tried=` is in the
107
+ # needle so a replayed `{{priorAttempts}}` line — which `renderAttemptLine`
108
+ # writes WITHOUT `tried=` — cannot match.
97
109
  generic_loop:
98
110
  max_iterations: { from: fix.localIterations, default: 2 }
111
+ until: "output.contains('outcome=pushed tried=')"
99
112
  until_bash: "if [ -f .git/lastlight-verify.sh ]; then bash .git/lastlight-verify.sh; else echo 'no .git/lastlight-verify.sh — gate=skipped, treated as RED'; exit 1; fi"
100
113
  fresh_context: false
101
114
  messages:
@@ -14,6 +14,12 @@ CONTEXT:
14
14
  branch out of date with base; `dirty` = merge conflict; `blocked` = a required
15
15
  gate is unmet). CI may already be green — bringing the branch up to date (step
16
16
  1) is often the whole fix.{{/if}}
17
+ - Checks: **{{checksState}}** — {{settledCheckCount}} settled check(s). Read the
18
+ count, not just the state: a suspiciously low one usually means GitHub has
19
+ stopped building this PR at all (it cannot compute a merge ref for a `dirty`
20
+ PR, so no `pull_request` workflow is even created) and the one thing still
21
+ reporting is a commit-status app keying off the push. That is a green with no
22
+ CI behind it — treat it as unknown, not as passing.
17
23
  - This is an automated dependency update (Dependabot / Renovate). The dependency
18
24
  bump itself is already committed on this branch — do NOT revert it. Your job is
19
25
  to make the update pass CI and mergeable.
@@ -62,7 +68,10 @@ one slow or unreproducible check. Run tests cheaply per the **building** skill
62
68
  current base and a `behind` PR is made mergeable (so the merge step later sees
63
69
  a `clean` PR, not `behind`). Merge — do NOT rebase or force-push:
64
70
  - `git fetch origin {{baseBranch}}`
65
- - `git merge --no-edit origin/{{baseBranch}}`
71
+ - `git merge --no-edit FETCH_HEAD` — merge what you just fetched, NOT
72
+ `origin/{{baseBranch}}`. In a shallow single-branch clone that
73
+ remote-tracking ref may not have moved, and merging it silently lands a
74
+ base that is already superseded.
66
75
  If the merge conflicts (almost always the lockfile), resolve it by
67
76
  **regenerating** the lockfile with the repo's package manager, then
68
77
  `git add -A && git commit --no-edit` to complete the merge — never hand-edit a
@@ -75,11 +84,13 @@ one slow or unreproducible check. Run tests cheaply per the **building** skill
75
84
  above is `dirty` (conflict), `behind` or `blocked`. CI is not red; the PR
76
85
  simply cannot merge. So completing the merge and pushing it is the whole
77
86
  repair, and there was no failure to diagnose. Do not hunt for a broken test
78
- to justify the run. Land the merge, let the gate confirm the tree still
79
- builds, push, and report `outcome=pushed`. A `dirty` PR whose conflict you
80
- resolved is a SUCCESS even if the only file you changed was the lockfile. If
81
- the gate then comes back red, you have a real failure and step 2 onwards
82
- applies.
87
+ to justify the run, and do not stand up a CI-sized gate for a lockfile.
88
+ Land the merge, let a small gate confirm the repair is coherent (no conflict
89
+ markers left, the lockfile installs), push, and report `outcome=pushed`. CI
90
+ is what tells you the branch is green, and it runs on the commit you push
91
+ without being asked. A `dirty` PR whose conflict you resolved is a SUCCESS
92
+ even if the only file you changed was the lockfile. If the gate then comes
93
+ back red, you have a real failure and step 2 onwards applies.
83
94
  {{/if}}
84
95
  2. {{#if phaseOutputs.diagnosis}}Work from the diagnosis above. It already names
85
96
  the cause and which checks can't be reproduced here — don't re-derive either.
@@ -93,17 +104,26 @@ one slow or unreproducible check. Run tests cheaply per the **building** skill
93
104
  - a breaking change in the new version needs call sites / types updated,
94
105
  - a peer-dependency or engines constraint needs a matching bump.
95
106
  3. Write the gate script: `{{verifyScript}}` — a path relative to your cwd,
96
- which is the checkout — holding the exact build + test + lint + typecheck
97
- commands CI runs, with the package manager taken from the lockfile. Exit 0
98
- means green. It is not there yet — the harness clears it at the start of
99
- every attempt (see the **fixing** skill). Write it before you start
100
- repairing, so the repair has something to verify against.
107
+ which is the checkout — holding the **narrowest** command that would have
108
+ failed before your fix and passes after it: one test file, one lint rule, one
109
+ build target, or, for a lockfile you regenerated, the install itself. Exit 0
110
+ means green. NOT the repo's CI pipeline: CI runs on the commit you push and
111
+ is the authority, so a gate that mirrors it delays the push and tells you
112
+ nothing new — aim for under two minutes, skip anything you already watched
113
+ pass this session, and never try to start docker or a database (there is
114
+ none here). If step 1's merge was the whole repair and nothing was ever
115
+ failing, gate on the repair being coherent — no conflict markers left, and
116
+ the lockfile installs — rather than leaving the script unwritten: a missing
117
+ script is `gate=skipped`, which counts as RED and would throw a correct
118
+ resolution away. The script is not there yet — the harness clears it at the
119
+ start of every attempt. Write it before you start repairing. See the
120
+ **fixing** skill's "The gate" for the full shape.
101
121
  4. Make the **smallest** change that makes CI pass, per the **fixing** skill.
102
122
  Prefer a lockfile regeneration or a mechanical call-site/type update over a
103
123
  behavioural change. Do NOT widen the scope beyond making this update green.
104
- 5. Follow the **building** skill: install dependencies with the repo's package
105
- manager, then run the full gate (mirror CI — build + test + lint + typecheck). Do NOT commit until
106
- it all passes locally.
124
+ 5. Follow the **building** skill for the install: the repo's package manager,
125
+ taken from the lockfile. Then run your gate script and require it to pass
126
+ before you commit. Breadth is CI's job — don't also run the full suite here.
107
127
 
108
128
  AFTER FIXING:
109
129
  1. git add -A && git commit -m "fix(deps): make #{{prNumber}} mergeable"
@@ -136,11 +156,12 @@ name: "requires-human", color: "b60205", description: "Last Light can't proceed
136
156
  automatically; a maintainer must handle it." }] }`), then add it with
137
157
  `github_add_labels` (`{ owner: "{{owner}}", repo: "{{repo}}", issue_number:
138
158
  {{prNumber}}, labels: ["requires-human"] }`), and say so in your summary. If
139
- label writes are denied, just say so in your summary. (This isn't permanent, and
140
- nobody has to remove it by hand: the harness reads the label as OURS, applied at
141
- this head, so any commit pushed by someone else re-arms the loop. It is also
142
- cleared by `dependabot-pr-merge` once a later fix turns the checks green on a
143
- trivial update.)
159
+ label writes are denied, just say so in your summary. (It is a NOTIFICATION, not
160
+ a stop: nothing in the harness reads this label, so it neither holds the PR nor
161
+ needs removing by hand. It is also cleared by `dependabot-pr-merge` once a later
162
+ fix turns the checks green on a trivial update. The label that DOES hold a PR is
163
+ `lastlight-ignore`, which only a maintainer applies — never apply or remove it
164
+ yourself.)
144
165
 
145
166
  OUTPUT: A brief summary of the root cause, exactly what you changed, the
146
167
  local test/lint/typecheck results, and any checks you couldn't reproduce in the
@@ -171,19 +171,26 @@ and creates only the missing ones, so it never errors on labels that exist:
171
171
  - `dependency-major-low` — color `0e8a16` — "Major version bump, low impact."
172
172
  - `dependency-major-medium` — color `fbca04` — "Major version bump, medium impact."
173
173
  - `dependency-major-high` — color `b60205` — "Major version bump, high impact — needs human review."
174
+ - `lastlight-ignore` — color `24292f` — "Last Light will not act on this issue or pull request."
174
175
  If `github_ensure_labels` is denied (the token lacks the permission), fall back to
175
176
  using only labels that already exist and skip the rest.
176
177
 
177
- When YOU apply `requires-human`, it is not a permanent stop and nobody has to
178
- remove it by hand: the harness reads a label on a PR it has worked as OURS,
179
- applied at this head, so any commit pushed by someone else re-arms the loop.
180
- Never tell a maintainer in a comment that they must delete the label — ask them
181
- for the decision or the merge, not for label housekeeping.
178
+ `lastlight-ignore` is created here and **never applied or removed by you**. It is
179
+ a maintainer's instruction to the harness — "stay off this" — and a PR carrying
180
+ it never reaches you at all, because the dispatch gate refuses before any run
181
+ starts. Creating it is the whole job: a maintainer can only reach for a label
182
+ that exists in the repo's picker.
183
+
184
+ When YOU apply `requires-human`, it is a NOTIFICATION, not a stop: nothing in the
185
+ harness reads it, so it neither holds this PR nor needs removing by hand. It
186
+ means "I stopped and a human should look". Never tell a maintainer in a comment
187
+ that they must delete the label — ask them for the decision or the merge, not for
188
+ label housekeeping.
182
189
  Then apply exactly the labels for your verdict via `github_add_labels`, and clear
183
- the superseded ones with `github_remove_label`. **Only ever touch the six labels
184
- above** — never add or remove a label outside this vocabulary (Renovate's
185
- `rebase` label, a maintainer's `blocked`, a release label: all must survive
186
- untouched).
190
+ the superseded ones with `github_remove_label`. **Only ever touch the six
191
+ verdict labels above** — never `lastlight-ignore`, and never a label outside this
192
+ vocabulary (Renovate's `rebase` label, a maintainer's `blocked`, a release label:
193
+ all must survive untouched).
187
194
  - **TRIVIAL** → add `dependency-trivial`; remove `dependency-functional` if
188
195
  present. Also remove `requires-human` for now — the default trivial path lands
189
196
  automatically. (STEP 3 re-adds `requires-human` in the ONE case where a trivial
@@ -48,14 +48,23 @@ INSTRUCTIONS:
48
48
  the cause is. If reproducing contradicts the diagnosis, trust what you
49
49
  observe — and say so in your summary.
50
50
  2. Write the gate script FIRST: `{{verifyScript}}` — a path relative to your
51
- cwd, which is the checkout — holding the exact build + test + lint +
52
- typecheck commands CI runs, with the package manager taken from the
53
- lockfile. Exit 0 means green. It is not there yet — the harness clears it at
54
- the start of every attempt (see the **fixing** skill).
51
+ cwd, which is the checkout — holding the **narrowest** command that would
52
+ have failed before your fix and passes after it: one test file, one lint
53
+ rule, one build target, one install. Exit 0 means green. NOT the repo's CI
54
+ pipeline: CI runs on the commit you push and is the authority, so a gate that
55
+ mirrors it delays the push and tells you nothing new — aim for under two
56
+ minutes, skip anything you already watched pass this session, and never try
57
+ to start docker or a database (there is none here). If the diagnosed problem
58
+ has no reproducible check at all, gate on the repair being coherent rather
59
+ than leaving the script unwritten: a missing script is `gate=skipped`, which
60
+ counts as RED and never authorises a push. It is not there yet — the harness
61
+ clears it at the start of every attempt. See the **fixing** skill's "The
62
+ gate" for the full shape.
55
63
  3. Read the relevant code and make the fix — per the **fixing** skill, the
56
64
  smallest change that addresses the diagnosed cause. Don't widen the scope.
57
- 4. Follow the **building** skill: install dependencies, then run the full
58
- gate (mirror CI — build + test + lint + typecheck) — do NOT commit until it all passes
65
+ 4. Follow the **building** skill for the install, then run your gate script and
66
+ require it to pass — do NOT commit until it does. Breadth is CI's job; don't
67
+ also run the full suite here
59
68
 
60
69
  AFTER FIXING:
61
70
  1. git add -A && git commit -m "fix: address feedback on PR #{{prNumber}}