loki-mode 11.144.0 → 11.145.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/.github/actions/issue-to-pr/action.yml +18 -6
- package/README.md +2 -2
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/autonomy/hooks/validate-bash.sh +122 -2
- package/dashboard/__init__.py +1 -1
- package/docs/CLI-REFERENCE.md +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/docs/dev/architecture-reference.md +19 -0
- package/docs/environment-variables.md +6 -1
- package/docs/examples/loki-issue-to-pr.yml.example +39 -194
- package/docs/v10/GUIDE.md +26 -1
- package/loki-ts/dist/loki.js +2262 -2114
- package/mcp/__init__.py +1 -1
- package/mcp/requirements.txt +1 -1
- package/package.json +2 -2
- package/packages/control-plane/dist/server.js +9584 -7790
- package/plugins/loki-mode/.claude-plugin/plugin.json +1 -1
- package/web-app/dist/assets/{AdminPage-DbH5UGUB.js → AdminPage-Dtrte_9h.js} +1 -1
- package/web-app/dist/assets/{Avatar-DDDRreMf.js → Avatar-BqDxz5Iw.js} +1 -1
- package/web-app/dist/assets/{Badge-keUySv6q.js → Badge-BGX45Lnh.js} +1 -1
- package/web-app/dist/assets/{Button-B0VwDcEe.js → Button-DVr538c3.js} +1 -1
- package/web-app/dist/assets/{CockpitPage-xhnfgUs9.js → CockpitPage-CIODjzWx.js} +1 -1
- package/web-app/dist/assets/{ComparePage-S8wqTiHb.js → ComparePage-DSaexpQe.js} +1 -1
- package/web-app/dist/assets/{ErrorBoundary-C7kcvRwe.js → ErrorBoundary-CnkNmsIK.js} +1 -1
- package/web-app/dist/assets/{EvidenceReceiptPanel-pEiN-C4u.js → EvidenceReceiptPanel-BOYje705.js} +1 -1
- package/web-app/dist/assets/{GitHubIssuesPanel-DTIMWNDX.js → GitHubIssuesPanel-D-obZbg0.js} +1 -1
- package/web-app/dist/assets/{GitHubPRsPanel-Brzi3w1V.js → GitHubPRsPanel-BDP6UPrV.js} +1 -1
- package/web-app/dist/assets/{HomePage-Cy3z6Qn8.js → HomePage-CyuUJmkD.js} +2 -2
- package/web-app/dist/assets/{LoginPage-CUE-CwkD.js → LoginPage-CwzpHE77.js} +1 -1
- package/web-app/dist/assets/{MagicPage-CqtINBPy.js → MagicPage-B-2U-xDs.js} +1 -1
- package/web-app/dist/assets/{MetricsPage-DQCWeFlA.js → MetricsPage-cNfnAqIP.js} +1 -1
- package/web-app/dist/assets/{NotFoundPage-BA1MqN6l.js → NotFoundPage-Bnja4u7t.js} +1 -1
- package/web-app/dist/assets/{ProjectPage-Cxcx0V8O.js → ProjectPage-DxKwokda.js} +3 -3
- package/web-app/dist/assets/{ProjectsPage-DdUdvtjK.js → ProjectsPage-D0HElwG2.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-I7PVb5wn.js → SettingsPage-cKZTmoDV.js} +1 -1
- package/web-app/dist/assets/{ShowcasePage-DHrNop3J.js → ShowcasePage-COCzMSj2.js} +1 -1
- package/web-app/dist/assets/{SystemSettingsPage-CNVdXQOz.js → SystemSettingsPage-DpEdU35g.js} +1 -1
- package/web-app/dist/assets/{TeamsPage-BJ1hSoZz.js → TeamsPage-CRa-oR3c.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-DuCIT8M9.js → TemplatesPage-CqVQ2RrJ.js} +1 -1
- package/web-app/dist/assets/{TerminalOutput-CKew5YmS.js → TerminalOutput-77EBpy6w.js} +1 -1
- package/web-app/dist/assets/{activity-X_sIluZD.js → activity-CwYJMGXJ.js} +1 -1
- package/web-app/dist/assets/{bell-1x4qAMba.js → bell-D7tpnhHd.js} +1 -1
- package/web-app/dist/assets/{bot-D2DF_VYf.js → bot-BGEMExhD.js} +1 -1
- package/web-app/dist/assets/{check-Qht2HACJ.js → check-DXYfUB9x.js} +1 -1
- package/web-app/dist/assets/{chevron-left-_uYpkUq-.js → chevron-left-fmjoQGhm.js} +1 -1
- package/web-app/dist/assets/{circle-alert-YPaRiMsJ.js → circle-alert-Bg5XeK2P.js} +1 -1
- package/web-app/dist/assets/{clock-Cwk21p0_.js → clock-CsKyZSPS.js} +1 -1
- package/web-app/dist/assets/{cloud-DhHbq4bj.js → cloud-Bd60jog4.js} +1 -1
- package/web-app/dist/assets/{code-xml-DS3Em8bd.js → code-xml-Ctl0DdWZ.js} +1 -1
- package/web-app/dist/assets/{database-BIa54kdE.js → database-ziASlG1B.js} +1 -1
- package/web-app/dist/assets/{dollar-sign-BalXn2oH.js → dollar-sign-Bo2f3aLO.js} +1 -1
- package/web-app/dist/assets/{file-code-corner-amORiznL.js → file-code-corner-BZCY8u6u.js} +1 -1
- package/web-app/dist/assets/{file-plus-DHJBZCsC.js → file-plus-DZX_AwtZ.js} +1 -1
- package/web-app/dist/assets/{globe-CeOKEwI7.js → globe-BqP4Lntz.js} +1 -1
- package/web-app/dist/assets/{hammer-C7vs3Bds.js → hammer-KMjpooTk.js} +1 -1
- package/web-app/dist/assets/{index-BtO8IJSL.js → index-B_8pnUwl.js} +3 -3
- package/web-app/dist/assets/{layers-Dycr1A4N.js → layers-Bdkz5DFw.js} +1 -1
- package/web-app/dist/assets/{loader-circle-OP-zgDuf.js → loader-circle-BV_0L7bg.js} +1 -1
- package/web-app/dist/assets/{lock-5bs89wOo.js → lock-DhK1z1dB.js} +1 -1
- package/web-app/dist/assets/{package-EhRpZQ-4.js → package-De8MCdUa.js} +1 -1
- package/web-app/dist/assets/{plus-Dy5O2_nt.js → plus-BQbDrNgm.js} +1 -1
- package/web-app/dist/assets/{refresh-cw-BUMYlYZm.js → refresh-cw-BQ2ezlqR.js} +1 -1
- package/web-app/dist/assets/{rotate-ccw-CGRS25sv.js → rotate-ccw-EuVYh2XK.js} +1 -1
- package/web-app/dist/assets/{scroll-text-8Wgg1Lbl.js → scroll-text-BcrL2UnM.js} +1 -1
- package/web-app/dist/assets/{server-COT4dK2-.js → server-dpdGPXDc.js} +1 -1
- package/web-app/dist/assets/{shield-alert-9IDjzX-A.js → shield-alert-B2AnkpV_.js} +1 -1
- package/web-app/dist/assets/{thumbs-up-qETqqDxw.js → thumbs-up-Zock-j5_.js} +1 -1
- package/web-app/dist/assets/{trash-2-DUncVSUn.js → trash-2-B9zGFCn0.js} +1 -1
- package/web-app/dist/assets/{trending-down-DDYwKmCB.js → trending-down-DWQW56VW.js} +1 -1
- package/web-app/dist/assets/{trending-up-CFw4DBaE.js → trending-up--6mzkyyP.js} +1 -1
- package/web-app/dist/assets/{upload-CL55EDB7.js → upload-CNxdXaU0.js} +1 -1
- package/web-app/dist/assets/{usePolling-DnTTT7O0.js → usePolling-CVHCrC_t.js} +1 -1
- package/web-app/dist/assets/{user-C5FKVYyb.js → user-CuL3zj1a.js} +1 -1
- package/web-app/dist/index.html +1 -1
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
# Example workflow for users: copy it to .github/workflows/loki-issue-to-pr.yml in your own repository.
|
|
2
2
|
# It is not run by this repository CI.
|
|
3
|
-
#
|
|
3
|
+
# Label an issue, get a pull request.
|
|
4
4
|
#
|
|
5
|
-
# Label an issue `loki` (or comment `/loki` as a repository owner, member or
|
|
6
|
-
#
|
|
7
|
-
#
|
|
5
|
+
# Label an issue `loki` (or comment `/loki` on it as a repository owner, member or collaborator). Loki
|
|
6
|
+
# opens ONE pull request for the issue and writes ONE comment on the issue with the result label
|
|
7
|
+
# (VERIFIED, PARTIAL, ...), the proof in numbers, the cost and the link. Adding the label again runs
|
|
8
|
+
# it again: the new run opens a new pull request on a new branch, links the earlier open one for you to
|
|
9
|
+
# close (Loki never closes, edits or deletes a pull request or branch), and edits the comment in place.
|
|
10
|
+
# A large issue that Loki splits into slices gets no pull request from this workflow; the comment lists
|
|
11
|
+
# the slices and their results.
|
|
8
12
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
13
|
+
# Setup, once per repository:
|
|
14
|
+
# 1. Settings > Secrets and variables > Actions: add ANTHROPIC_API_KEY.
|
|
15
|
+
# 2. Settings > Actions > General > Workflow permissions: turn on
|
|
16
|
+
# "Allow GitHub Actions to create and approve pull requests" (off by default on a new repository).
|
|
17
|
+
# 3. Create the label `loki` (Issues > Labels).
|
|
18
|
+
# If step 1 or 2 is missing, the comment on the issue says which one.
|
|
11
19
|
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
# A patch that touches .github/workflows/ cannot be pushed with this token
|
|
19
|
-
#
|
|
20
|
-
#
|
|
20
|
+
# The `loki` job below is the whole issue-to-PR path; the smallest working file is this header's `on:
|
|
21
|
+
# issues` trigger plus that one job (see README "Label an issue, get a pull request"). The work happens
|
|
22
|
+
# in the reusable workflow asklokesh/loki-mode/.github/workflows/loki-issue-to-pr.yml: an agent job
|
|
23
|
+
# with a read-only token produces a patch, and a separate publish job that runs no agent opens the
|
|
24
|
+
# pull request (Rule of Two: issue text is untrusted, so the agent never holds a write token). The
|
|
25
|
+
# job must grant the three permissions below; a called workflow cannot raise them itself.
|
|
26
|
+
# A patch that touches .github/workflows/ cannot be pushed with this token; the comment says so.
|
|
27
|
+
# GitHub documents that events made with the workflow token (GITHUB_TOKEN) do not start other workflows,
|
|
28
|
+
# so a pull request this workflow opens does not start your pull_request CI by itself.
|
|
29
|
+
# This workflow is checked offline (a local mirror, a stub model and a stub gh); it has not yet been run
|
|
30
|
+
# on GitHub.
|
|
21
31
|
#
|
|
22
|
-
# PR comment commands (a collaborator with write access comments on a PR):
|
|
32
|
+
# The pr-* jobs are optional: PR comment commands (a collaborator with write access comments on a PR):
|
|
23
33
|
# /loki fix <text> an agent applies the request on the PR branch as ONE new commit
|
|
24
34
|
# /loki explain replies with the clause matrix (verdict, criteria, checks), <= 60 lines
|
|
25
35
|
# /loki reseal re-runs the proof and sets the loki/receipt commit status on the PR head
|
|
@@ -31,6 +41,7 @@
|
|
|
31
41
|
# `explain` and `reseal` run the PR code only in the verify-pr container sandbox:
|
|
32
42
|
# set the repository variable LOKI_VPR_IMAGE (see scripts/verify-pr-sandbox.sh).
|
|
33
43
|
# /loki fix cannot push to a fork PR; it replies and stops.
|
|
44
|
+
# Delete the pr-* jobs and the issue_comment trigger if you only want label-to-PR.
|
|
34
45
|
name: Loki - Issue to PR
|
|
35
46
|
|
|
36
47
|
on:
|
|
@@ -54,184 +65,18 @@ on:
|
|
|
54
65
|
permissions: {}
|
|
55
66
|
|
|
56
67
|
jobs:
|
|
57
|
-
|
|
58
|
-
concurrency:
|
|
59
|
-
group: loki-issue-${{ github.event.issue.number || inputs.issue }}
|
|
60
|
-
cancel-in-progress: false
|
|
61
|
-
# Gate on an explicit signal so the agent never fires on unrelated
|
|
62
|
-
# activity. A label needs triage access; a `/loki` comment must come from
|
|
63
|
-
# someone with write-level association, not any GitHub user.
|
|
64
|
-
if: >-
|
|
65
|
-
(github.event_name == 'issues' && github.event.label.name == 'loki') ||
|
|
66
|
-
(github.event_name == 'issue_comment' && !github.event.issue.pull_request && startsWith(github.event.comment.body, '/loki') &&
|
|
67
|
-
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)) ||
|
|
68
|
-
github.event_name == 'workflow_dispatch'
|
|
69
|
-
runs-on: ubuntu-latest
|
|
70
|
-
timeout-minutes: 45
|
|
71
|
-
permissions:
|
|
72
|
-
contents: read # checkout
|
|
73
|
-
issues: read # Loki reads the issue
|
|
74
|
-
steps:
|
|
75
|
-
- uses: actions/checkout@v4
|
|
76
|
-
with:
|
|
77
|
-
fetch-depth: 0 # the agent branches and diffs; a shallow clone breaks both
|
|
78
|
-
persist-credentials: false # leave no token in .git/config for the agent
|
|
79
|
-
|
|
80
|
-
- uses: actions/setup-node@v4
|
|
81
|
-
with:
|
|
82
|
-
node-version: '20'
|
|
83
|
-
|
|
84
|
-
- name: Fail fast without a model key
|
|
85
|
-
env:
|
|
86
|
-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
87
|
-
run: |
|
|
88
|
-
if [ -z "${ANTHROPIC_API_KEY:-}" ]; then
|
|
89
|
-
echo "::error::ANTHROPIC_API_KEY is not set in repository secrets. Add it under Settings > Secrets and variables > Actions."
|
|
90
|
-
exit 1
|
|
91
|
-
fi
|
|
92
|
-
|
|
93
|
-
- name: Install Loki Mode
|
|
94
|
-
run: npm install -g loki-mode
|
|
95
|
-
|
|
96
|
-
- name: Resolve the issue (no write access)
|
|
97
|
-
env:
|
|
98
|
-
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
99
|
-
# Read-only in this job (contents: read, issues: read). Loki uses it
|
|
100
|
-
# to fetch the issue and withholds it from the agent session.
|
|
101
|
-
GH_TOKEN: ${{ github.token }}
|
|
102
|
-
ISSUE: ${{ github.event.issue.number || inputs.issue }}
|
|
103
|
-
# engine10 reads no cost or iteration cap; its only cap is wall time.
|
|
104
|
-
LOKI_E10_CAP_S: '2400'
|
|
105
|
-
LOKI_BUDGET_LIMIT: '10.00' # not read by engine10; kept for the legacy path
|
|
106
|
-
LOKI_MAX_ITERATIONS: '20' # not read by engine10; kept for the legacy path
|
|
107
|
-
# Never push or open a PR from here; the publish job does that.
|
|
108
|
-
LOKI_DELEGATE_PR: '0'
|
|
109
|
-
run: |
|
|
110
|
-
set -uo pipefail
|
|
111
|
-
case "$ISSUE" in
|
|
112
|
-
''|*[!0-9]*) echo "::error::Issue number must be digits, got '$ISSUE'."; exit 1 ;;
|
|
113
|
-
esac
|
|
114
|
-
|
|
115
|
-
# git identity: Loki commits the session's work on its own branch.
|
|
116
|
-
git config user.name "${GITHUB_ACTOR:-loki-mode}"
|
|
117
|
-
git config user.email "${GITHUB_ACTOR:-loki-mode}@users.noreply.github.com"
|
|
118
|
-
|
|
119
|
-
RC=0
|
|
120
|
-
# Loki 10 issue entry. --no-pr is required: engine10 ignores
|
|
121
|
-
# LOKI_DELEGATE_PR, and this job's read-only token cannot push, open a
|
|
122
|
-
# PR or comment (supervisor.ts main: noPr drops opts.pr and opts.comment).
|
|
123
|
-
# The run commits on branch loki/<runId> checked out in this very
|
|
124
|
-
# checkout (stages/intake.ts ensureBranch), so HEAD carries the change.
|
|
125
|
-
loki "${GITHUB_REPOSITORY}#${ISSUE}" --no-pr || RC=$?
|
|
126
|
-
|
|
127
|
-
OUT="$RUNNER_TEMP/loki-out"
|
|
128
|
-
mkdir -p "$OUT"
|
|
129
|
-
# The deliverable is what the session committed on top of the commit
|
|
130
|
-
# this run started from. .loki/ is run state, never part of the change.
|
|
131
|
-
git diff --binary "$GITHUB_SHA" HEAD -- . ':(exclude).loki' > "$OUT/loki.patch"
|
|
132
|
-
|
|
133
|
-
# PR body: the Loki 10 receipt this run sealed under .loki/runs/e10-*/.
|
|
134
|
-
# Rendered from the run's own receipt.md; the digest comes from receipt.json.
|
|
135
|
-
RUN_DIR="$(ls -d .loki/runs/e10-* 2>/dev/null | sort | tail -n 1)"
|
|
136
|
-
{
|
|
137
|
-
echo "Resolves #${ISSUE}."
|
|
138
|
-
echo ""
|
|
139
|
-
if [ -n "$RUN_DIR" ] && [ -f "$RUN_DIR/receipt.md" ]; then
|
|
140
|
-
head -c 20000 "$RUN_DIR/receipt.md"
|
|
141
|
-
cp "$RUN_DIR/receipt.json" "$OUT/receipt.json" 2>/dev/null || true
|
|
142
|
-
SHA="$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1])).get("receipt_sha256",""))' "$RUN_DIR/receipt.json" 2>/dev/null || true)"
|
|
143
|
-
echo ""
|
|
144
|
-
echo "Receipt digest (sha256): ${SHA:-unavailable}"
|
|
145
|
-
echo "Check it: download the loki-patch artifact of this run and run \`loki verify receipt.json\`."
|
|
146
|
-
else
|
|
147
|
-
echo "Evidence Receipt: unavailable for this run (no receipt under .loki/runs/)."
|
|
148
|
-
fi
|
|
149
|
-
} > "$OUT/pr-body.md"
|
|
150
|
-
|
|
151
|
-
if [ -s "$OUT/loki.patch" ]; then
|
|
152
|
-
echo "Loki produced a change; the publish job opens the pull request."
|
|
153
|
-
else
|
|
154
|
-
echo "::warning::Loki produced no committed change, so no pull request will be opened."
|
|
155
|
-
fi
|
|
156
|
-
exit "$RC"
|
|
157
|
-
|
|
158
|
-
- name: Hand the patch to the publish job
|
|
159
|
-
uses: actions/upload-artifact@v4
|
|
160
|
-
with:
|
|
161
|
-
name: loki-patch
|
|
162
|
-
path: ${{ runner.temp }}/loki-out/
|
|
163
|
-
if-no-files-found: error
|
|
164
|
-
retention-days: 7
|
|
165
|
-
|
|
166
|
-
publish:
|
|
167
|
-
# Runs only after the agent job succeeded. Everything it reads from that
|
|
168
|
-
# job is attacker-controllable data: no job outputs, no `${{ }}` of agent
|
|
169
|
-
# values in a script, nothing from the artifact is executed.
|
|
170
|
-
needs: agent
|
|
171
|
-
# Own group: GitHub keeps one running and one pending run per group and a newer
|
|
172
|
-
# pending run replaces an older one, so sharing the agent group could drop a queued publish.
|
|
173
|
-
concurrency:
|
|
174
|
-
group: loki-issue-publish-${{ github.event.issue.number || inputs.issue }}
|
|
175
|
-
cancel-in-progress: false
|
|
176
|
-
runs-on: ubuntu-latest
|
|
177
|
-
timeout-minutes: 10
|
|
68
|
+
loki:
|
|
178
69
|
permissions:
|
|
179
70
|
contents: write # push the branch
|
|
180
|
-
pull-requests: write # open the
|
|
181
|
-
issues: write #
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
with:
|
|
190
|
-
name: loki-patch
|
|
191
|
-
path: ${{ runner.temp }}/loki-out
|
|
192
|
-
|
|
193
|
-
- name: Open the pull request
|
|
194
|
-
env:
|
|
195
|
-
GH_TOKEN: ${{ github.token }}
|
|
196
|
-
ISSUE: ${{ github.event.issue.number || inputs.issue }}
|
|
197
|
-
BASE: ${{ github.ref_name }}
|
|
198
|
-
run: |
|
|
199
|
-
set -euo pipefail
|
|
200
|
-
case "$ISSUE" in
|
|
201
|
-
''|*[!0-9]*) echo "::error::Issue number must be digits, got '$ISSUE'."; exit 1 ;;
|
|
202
|
-
esac
|
|
203
|
-
|
|
204
|
-
PATCH="$RUNNER_TEMP/loki-out/loki.patch"
|
|
205
|
-
BODY="$RUNNER_TEMP/loki-out/pr-body.md"
|
|
206
|
-
if [ ! -s "$PATCH" ]; then
|
|
207
|
-
echo "The agent produced no change; nothing to open."
|
|
208
|
-
exit 0
|
|
209
|
-
fi
|
|
210
|
-
[ -s "$BODY" ] || echo "Resolves #${ISSUE}." > "$BODY"
|
|
211
|
-
|
|
212
|
-
BRANCH="loki/issue-${ISSUE}-${GITHUB_RUN_ID}"
|
|
213
|
-
git config user.name "github-actions[bot]"
|
|
214
|
-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
215
|
-
git switch -c "$BRANCH"
|
|
216
|
-
git apply --index "$PATCH"
|
|
217
|
-
git commit -q -m "Loki: resolve #${ISSUE}"
|
|
218
|
-
gh auth setup-git
|
|
219
|
-
git push origin "HEAD:refs/heads/${BRANCH}"
|
|
220
|
-
|
|
221
|
-
PR_URL="$(gh pr create --base "$BASE" --head "$BRANCH" \
|
|
222
|
-
--title "Loki: resolve #${ISSUE}" --body-file "$BODY")"
|
|
223
|
-
echo "Pull request: $PR_URL"
|
|
224
|
-
|
|
225
|
-
# Build the comment in a file: a blank line inside an inline YAML
|
|
226
|
-
# string terminates the block scalar and breaks the workflow parse.
|
|
227
|
-
{
|
|
228
|
-
echo "Loki opened a pull request: $PR_URL"
|
|
229
|
-
echo ""
|
|
230
|
-
echo "The PR body carries an evidence receipt stating what was verified,"
|
|
231
|
-
echo "what was skipped, and what is degraded. Check it rather than taking"
|
|
232
|
-
echo "the result on trust."
|
|
233
|
-
} > "$RUNNER_TEMP/loki-issue-comment.md"
|
|
234
|
-
gh issue comment "$ISSUE" --body-file "$RUNNER_TEMP/loki-issue-comment.md" || true
|
|
71
|
+
pull-requests: write # open the pull request
|
|
72
|
+
issues: write # comment the result on the issue
|
|
73
|
+
# A release tag, and the same loki-mode version: never main, never npm latest.
|
|
74
|
+
uses: asklokesh/loki-mode/.github/workflows/loki-issue-to-pr.yml@v11.142.0
|
|
75
|
+
with:
|
|
76
|
+
issue: ${{ inputs.issue }} # only set by workflow_dispatch; an issue event names its own issue
|
|
77
|
+
version: '11.142.0'
|
|
78
|
+
secrets:
|
|
79
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
235
80
|
|
|
236
81
|
pr-command:
|
|
237
82
|
# Comments on a pull request. Runs for any `/loki` comment so a user without
|
|
@@ -346,7 +191,7 @@ jobs:
|
|
|
346
191
|
path: ${{ runner.temp }}/loki-cmd
|
|
347
192
|
|
|
348
193
|
- name: Install Loki Mode
|
|
349
|
-
run: npm install -g loki-mode
|
|
194
|
+
run: npm install -g loki-mode@11.142.0
|
|
350
195
|
|
|
351
196
|
- name: Apply the request (model key, no GitHub token)
|
|
352
197
|
env:
|
|
@@ -444,7 +289,7 @@ jobs:
|
|
|
444
289
|
node-version: '20'
|
|
445
290
|
|
|
446
291
|
- name: Install Loki Mode
|
|
447
|
-
run: npm install -g loki-mode
|
|
292
|
+
run: npm install -g loki-mode@11.142.0
|
|
448
293
|
|
|
449
294
|
- name: Prove the PR and report
|
|
450
295
|
env:
|
package/docs/v10/GUIDE.md
CHANGED
|
@@ -395,7 +395,32 @@ is that function's real output, not a mockup.
|
|
|
395
395
|
|
|
396
396
|
Both run on your own GitHub Actions minutes; there is no hosted service.
|
|
397
397
|
|
|
398
|
-
-
|
|
398
|
+
- Label an issue, get a pull request. Save this as `.github/workflows/loki.yml` in your repository:
|
|
399
|
+
|
|
400
|
+
```yaml
|
|
401
|
+
name: Loki
|
|
402
|
+
on:
|
|
403
|
+
issues:
|
|
404
|
+
types: [labeled]
|
|
405
|
+
jobs:
|
|
406
|
+
loki:
|
|
407
|
+
permissions:
|
|
408
|
+
contents: write
|
|
409
|
+
pull-requests: write
|
|
410
|
+
issues: write
|
|
411
|
+
uses: asklokesh/loki-mode/.github/workflows/loki-issue-to-pr.yml@v11.142.0
|
|
412
|
+
with:
|
|
413
|
+
version: '11.142.0'
|
|
414
|
+
secrets:
|
|
415
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Then, once per repository: add the `ANTHROPIC_API_KEY` secret (Settings > Secrets and variables > Actions), turn on "Allow GitHub Actions to create and approve pull requests" (Settings > Actions > General > Workflow permissions; it is off by default on a new repository), and create a label named `loki`. Put that label on an issue. Loki runs `loki owner/repo#N --no-pr` and you get:
|
|
419
|
+
- one pull request for the issue, on a branch `loki/issue-<number>-<run id>-<run attempt>`, whose body is the evidence receipt. The title carries the result when it is not VERIFIED, and only a VERIFIED result says "Resolves #N". A large issue that Loki splits into slices gets no pull request from this workflow: the comment lists the slices and their results and says that no single pull request was opened.
|
|
420
|
+
- one comment on the issue: the result label (VERIFIED, PARTIAL, ...), how many checks passed outside the model and how many items are not proven, the cost, the receipt digest and the link to the pull request and the run log.
|
|
421
|
+
- if the secret or the setting is missing, the same comment says which one and where to set it. The job must grant the three permissions above: a called workflow cannot raise them.
|
|
422
|
+
|
|
423
|
+
Put the label on again (remove it, add it back) to run again: the new run opens a new pull request on a new branch, and its body and the comment link the earlier open Loki pull request for you to close. Loki never closes, edits or deletes a pull request or branch. The comment is edited in place. The agent job holds a read-only token; a separate job that runs no agent applies its patch and opens the pull request. A change that touches `.github/workflows/` cannot be pushed with the workflow token; the comment says so. GitHub documents that events made with the workflow token do not start other workflows, so a pull request this workflow opens does not start your `pull_request` CI by itself. Keep the tag (`@v11.142.0`) and `with: version:` (the loki-mode npm version, an exact release) the same; `with: label:` changes the label. The workflow is checked offline (its own scripts against a local mirror with a stub model and a stub `gh`); it has not yet been run on GitHub. [docs/examples/loki-issue-to-pr.yml.example](../examples/loki-issue-to-pr.yml.example) adds the `/loki` comment trigger, a manual trigger and the `/loki fix`, `/loki explain` and `/loki reseal` pull request commands.
|
|
399
424
|
- Nightly backlog: add a workflow in `.github/workflows/`. Its `schedule:` trigger runs `loki backlog owner/repo --label loki`, one Loki 10 run per labeled open issue:
|
|
400
425
|
|
|
401
426
|
```yaml
|