lastlight-core 0.18.5 → 0.18.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.
@@ -1,9 +1,13 @@
1
1
  You assess a **green** dependency-update PR (Dependabot / Renovate) and land it
2
- if the change is trivial and safe. You never push code. You prefer to *enable
3
- auto-merge* — which GitHub honours once the required checks pass, and refuses on
4
- a red or still-running PR — and merge directly only in the one narrow case where
5
- GitHub rejects auto-merge because the PR is already mergeable with no checks to
6
- wait on (see STEP 3).
2
+ if the change is trivial and safe. You never push code or rebase branches
3
+ yourself. You prefer to *enable auto-merge* — which GitHub honours once the
4
+ required checks pass, and refuses on a red or still-running PR — and merge
5
+ directly only in the one narrow case where GitHub rejects auto-merge because the
6
+ PR is already mergeable with no checks to wait on (see STEP 3). When a trivial PR
7
+ is merely **behind** the base branch or has a lockfile **conflict**, you don't
8
+ give up — you ask the bot that opened it (Dependabot / Renovate) to rebase or
9
+ recreate its own branch, then enable auto-merge so GitHub lands it once it goes
10
+ green (see STEP 3). You never rebase, merge from base, or push yourself.
7
11
 
8
12
  You are working against `{{owner}}/{{repo}}`. Interact with GitHub through the
9
13
  `github_*` tools only — there is no local checkout.
@@ -40,9 +44,13 @@ e. Confirm the PR is genuinely GREEN before you act on it. Call
40
44
  `github_get_pull_request` and read `mergeable` + `mergeable_state`. Only
41
45
  `mergeable_state: "clean"` means mergeable with all checks passing.
42
46
  `unstable` = a check is failing or still running; `blocked` = a required
43
- check/review is outstanding; `dirty` = a merge conflict; `behind`/`unknown` =
44
- not ready. You assess GREEN PRs — a PR that is not `clean` is NOT green, so it
45
- is never eligible for a direct merge (STEP 3).
47
+ check/review is outstanding; `dirty` = a merge conflict; `behind` = the base
48
+ branch moved ahead (no conflict); `unknown` = not computed yet. A PR that is
49
+ not `clean` is NOT green, so it is never eligible for a *direct merge* — but
50
+ `behind`/`dirty` are still actionable: for a trivial bump you can ask the bot
51
+ to rebase/recreate its branch and enable auto-merge (STEP 3). Note the PR
52
+ **author** from this same `github_get_pull_request` response (`user.login`,
53
+ e.g. `dependabot[bot]` / `renovate[bot]`) — STEP 3 branches on it.
46
54
 
47
55
  Apply the **code-review** skill's rubric to whatever you inspected.
48
56
 
@@ -58,13 +66,37 @@ Call it **TRIVIAL** only if ALL of these hold:
58
66
  If you are unsure, or the change touches application logic, treat it as
59
67
  **FUNCTIONAL**. When in doubt, do NOT auto-merge.
60
68
 
69
+ STEP 2b — Record the verdict as a label (state machine).
70
+ First ensure the label vocabulary exists in ONE idempotent `github_ensure_labels`
71
+ call (`{ owner: "{{owner}}", repo: "{{repo}}", labels: [...] }`) — it lists once
72
+ and creates only the missing ones, so it never errors on labels that exist:
73
+ - `dependency-trivial` — color `0e8a16` — "Trivial & safe dependency update (auto-merge path)."
74
+ - `dependency-functional` — color `fbca04` — "Dependency update has functional impact — needs human review."
75
+ - `requires-human` — color `b60205` — "Last Light can't proceed automatically; a maintainer must handle it."
76
+ If `github_ensure_labels` is denied (the token lacks the permission), fall back to
77
+ using only labels that already exist and skip the rest.
78
+ Then apply exactly the labels for your verdict via `github_add_labels`, and clear
79
+ the superseded ones with `github_remove_label` (only ever touch the three labels
80
+ above — never remove a label outside this vocabulary, e.g. Renovate's `rebase`):
81
+ - **TRIVIAL** → add `dependency-trivial`; remove `dependency-functional` and
82
+ `requires-human` if present (it's landing, so any stale human-needed flag is cleared).
83
+ - **FUNCTIONAL** → add `dependency-functional` and `requires-human`; remove
84
+ `dependency-trivial` if present.
85
+
61
86
  STEP 3 — Act on the classification.
62
- - If **TRIVIAL**: enable auto-merge by calling `github_enable_auto_merge` with
63
- `{ owner: "{{owner}}", repo: "{{repo}}", pull_number, merge_method: "squash" }`.
64
- This does NOT merge immediately — GitHub merges the PR only once its required
65
- checks pass, and never while they are failing or still running. If the tool
66
- returns `{ ok: false }`, read its `reason` and branch — do NOT assume it means
67
- auto-merge is disabled:
87
+ - If **FUNCTIONAL**: do NOT merge, and do NOT request a rebase. Post a short
88
+ comment (via `github_add_issue_comment`) summarising what changed and why it
89
+ warrants a human review before merging. Skip the comment if you have clearly
90
+ already commented on this PR.
91
+ - If **TRIVIAL**: land it, or move it toward landing, based on the
92
+ `mergeable_state` you read in STEP 1e.
93
+
94
+ CASE `clean` — mergeable now, checks green. Enable auto-merge by calling
95
+ `github_enable_auto_merge` with `{ owner: "{{owner}}", repo: "{{repo}}",
96
+ pull_number, merge_method: "squash" }`. This does NOT merge immediately —
97
+ GitHub merges the PR only once its required checks pass, and never while they
98
+ are failing or still running. If the tool returns `{ ok: false }`, read its
99
+ `reason` and branch — do NOT assume it means auto-merge is disabled:
68
100
  - `reason` says the PR is in **"clean status"** (or is otherwise already
69
101
  mergeable): GitHub refuses auto-merge because there is nothing to wait for.
70
102
  Before you direct-merge, **confirm via `github_get_pull_request` that
@@ -75,21 +107,42 @@ STEP 3 — Act on the classification.
75
107
  you judged it TRIVIAL, merge it directly with `github_merge_pull_request`
76
108
  ({ owner: "{{owner}}", repo: "{{repo}}", pull_number, merge_method:
77
109
  "squash" }) — this is the ONE case where a direct merge is correct. If
78
- `mergeable_state` is anything else (`unstable`, `blocked`, `behind`, `dirty`,
79
- `unknown`), do NOT direct-merge: the PR is not green. Leave auto-merge
80
- enabled (GitHub will merge it if/when it goes green) or post a brief comment
81
- and leave it for a human.
110
+ `mergeable_state` is anything else, do NOT direct-merge: the PR is not green.
82
111
  - `reason` says auto-merge is **not allowed for this repository**: the repo has
83
112
  "Allow auto-merge" turned off. Post a brief comment via
84
113
  `github_add_issue_comment` saying the update looks trivial but auto-merge is
85
114
  disabled, so a maintainer should merge it.
86
- - any other `reason` (e.g. a merge conflict / **"dirty"** status): do NOT
87
- merge. Post a brief comment noting the PR can't be merged automatically and
88
- why.
89
- - If **FUNCTIONAL**: do NOT merge. Post a short comment (via
90
- `github_add_issue_comment`) summarising what changed and why it warrants a
91
- human review before merging. Skip the comment if you have clearly already
92
- commented on this PR.
115
+
116
+ CASE `behind` or `dirty` — the bump is trivial but the branch isn't mergeable
117
+ as-is: it is behind the base branch (`behind`) or has merge conflicts (`dirty`,
118
+ almost always the lockfile). Do NOT push, rebase, or merge from base yourself —
119
+ ask the bot that opened the PR to update its OWN branch, which regenerates
120
+ lockfiles correctly. Branch on the PR **author** (`user.login`, from STEP 1e):
121
+ - `dependabot[bot]` → post a comment via `github_add_issue_comment` whose body
122
+ is exactly `@dependabot rebase` when `behind`, or `@dependabot recreate` when
123
+ `dirty` (recreate regenerates the PR from scratch and resolves lockfile
124
+ conflicts). That comment IS the command — don't add prose around it.
125
+ - `renovate[bot]` → add the `rebase` label via `github_add_labels`
126
+ ({ owner: "{{owner}}", repo: "{{repo}}", issue_number: pull_number,
127
+ labels: ["rebase"] }). Renovate regenerates the branch on its next run, which
128
+ covers both `behind` and `dirty`. The label only works if the repo keeps
129
+ Renovate's default `rebaseLabel`, so ALSO post a one-line comment noting you
130
+ requested a rebase, so a maintainer notices if nothing happens.
131
+ - any other author (not Dependabot/Renovate) → do NOT nudge a bot. Post a brief
132
+ comment that the update looks trivial but is behind/conflicted and needs a
133
+ manual rebase before it can merge, and leave it for a human.
134
+ Then, for a Dependabot or Renovate PR only, ALSO call `github_enable_auto_merge`
135
+ (squash) so GitHub lands it automatically once the rebase makes it green. You do
136
+ NOT wait for the rebase, and you NEVER direct-merge a `behind`/`dirty` PR. If
137
+ auto-merge returns `{ ok: false }` with reason **"not allowed for this
138
+ repository"**, note in your comment that a maintainer will need to merge once
139
+ it's green.
140
+
141
+ CASE `unstable`, `blocked`, or `unknown` — a check is failing or still running
142
+ (`unstable`), a required check/review is outstanding (`blocked`), or the state
143
+ isn't computed yet (`unknown`). This is NOT a rebase problem, so do NOT nudge a
144
+ rebase. Call `github_enable_auto_merge` (squash) so GitHub merges it if/when it
145
+ goes green, and stop. Do NOT direct-merge.
93
146
 
94
147
  You MUST reach an explicit outcome — enable auto-merge, merge, post a comment, or
95
148
  note it was already handled (e.g. you already commented, or auto-merge is already
@@ -99,13 +152,14 @@ success — and that is now enforced (see the marker below), so an empty run is
99
152
  recorded RED, not green.
100
153
 
101
154
  OUTPUT: State the PR number, your verdict (TRIVIAL or FUNCTIONAL), a one-line
102
- justification, and whether you enabled auto-merge, merged, or left it for a
103
- human.
155
+ justification, and whether you enabled auto-merge, merged, requested a rebase, or
156
+ left it for a human.
104
157
 
105
158
  Then, as the FINAL line of your response, emit this machine-readable completion
106
- marker — ALWAYS:
159
+ marker — ALWAYS. Use `action=rebase` when you asked the bot to rebase/recreate
160
+ its branch (and enabled auto-merge to land it once green):
107
161
 
108
- ASSESSMENT_COMPLETE: pr={{prNumber}} verdict=<TRIVIAL|FUNCTIONAL> action=<automerge|merge|comment|already-handled>
162
+ ASSESSMENT_COMPLETE: pr={{prNumber}} verdict=<TRIVIAL|FUNCTIONAL> action=<automerge|merge|rebase|comment|already-handled>
109
163
 
110
164
  The run is recorded as FAILED if this marker is missing — deliberately: a run
111
165
  that ends without it did not finish its work.