@lore-co/cli 0.1.2 → 0.1.3
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 +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +21 -0
- package/dist/cli.js.map +1 -1
- package/dist/demo.d.ts +24 -0
- package/dist/demo.d.ts.map +1 -0
- package/dist/demo.js +402 -0
- package/dist/demo.js.map +1 -0
- package/dist/generated-assets.d.ts +3 -3
- package/dist/generated-assets.js +3 -3
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +2 -4
- package/dist/github.js.map +1 -1
- package/dist/repository.d.ts +1 -0
- package/dist/repository.d.ts.map +1 -1
- package/dist/repository.js +6 -0
- package/dist/repository.js.map +1 -1
- package/dist/runtime.d.ts +8 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +266 -44
- package/dist/runtime.js.map +1 -1
- package/dist/update.js +3 -3
- package/package.json +3 -3
package/dist/demo.js
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { execFile as execFileCallback } from "node:child_process";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile, } from "node:fs/promises";
|
|
4
|
+
import { homedir, tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { LoreClient } from "@lore-co/sdk";
|
|
7
|
+
const CLAUDE_HOOK_EVENTS = [
|
|
8
|
+
"UserPromptSubmit",
|
|
9
|
+
"Stop",
|
|
10
|
+
"SessionEnd",
|
|
11
|
+
];
|
|
12
|
+
function isRecord(value) {
|
|
13
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
14
|
+
}
|
|
15
|
+
function isLoreHook(value) {
|
|
16
|
+
if (!isRecord(value) || typeof value.command !== "string") {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return (value.command.includes("/.lore/bin/lore-hook.mjs") ||
|
|
20
|
+
/(?:^|\s)--owner(?:=|\s+)lore(?:\s|$)/u.test(value.command));
|
|
21
|
+
}
|
|
22
|
+
export function isolateLoreClaudeHooks(settings) {
|
|
23
|
+
if (!isRecord(settings) || !isRecord(settings.hooks)) {
|
|
24
|
+
throw new Error("Claude Lore hooks are not installed");
|
|
25
|
+
}
|
|
26
|
+
const hooks = {};
|
|
27
|
+
for (const event of CLAUDE_HOOK_EVENTS) {
|
|
28
|
+
const groups = settings.hooks[event];
|
|
29
|
+
if (!Array.isArray(groups)) {
|
|
30
|
+
throw new Error(`Claude Lore ${event} hook is not installed`);
|
|
31
|
+
}
|
|
32
|
+
const isolatedGroups = groups.flatMap((group) => {
|
|
33
|
+
if (!isRecord(group) || !Array.isArray(group.hooks)) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
const isolatedHooks = group.hooks.filter(isLoreHook);
|
|
37
|
+
return isolatedHooks.length === 0
|
|
38
|
+
? []
|
|
39
|
+
: [{ ...group, hooks: isolatedHooks }];
|
|
40
|
+
});
|
|
41
|
+
if (isolatedGroups.length === 0) {
|
|
42
|
+
throw new Error(`Claude Lore ${event} hook is not installed`);
|
|
43
|
+
}
|
|
44
|
+
hooks[event] = isolatedGroups;
|
|
45
|
+
}
|
|
46
|
+
return { hooks };
|
|
47
|
+
}
|
|
48
|
+
async function installIsolatedClaudeHooks(directory) {
|
|
49
|
+
const settingsPath = join(homedir(), ".claude", "settings.json");
|
|
50
|
+
const settings = JSON.parse(await readFile(settingsPath, "utf8"));
|
|
51
|
+
const claudeDirectory = join(directory, ".claude");
|
|
52
|
+
await mkdir(claudeDirectory, { recursive: true });
|
|
53
|
+
await writeFile(join(claudeDirectory, "settings.local.json"), `${JSON.stringify(isolateLoreClaudeHooks(settings), null, 2)}\n`, "utf8");
|
|
54
|
+
}
|
|
55
|
+
const DEMO_HELP = `lore demo
|
|
56
|
+
Run the live Claude-to-Codex proof loop in a temporary repository.
|
|
57
|
+
|
|
58
|
+
Usage:
|
|
59
|
+
lore demo [options]
|
|
60
|
+
|
|
61
|
+
Options:
|
|
62
|
+
--timeout-ms <ms> Per-agent timeout, 10000-300000 (default: 120000)
|
|
63
|
+
--claude-model <name> Claude model (default: haiku)
|
|
64
|
+
--codex-model <name> Optional Codex model override
|
|
65
|
+
--keep Keep the fixture repository for inspection
|
|
66
|
+
--json Print machine-readable output
|
|
67
|
+
--help Show this command's help
|
|
68
|
+
|
|
69
|
+
Examples:
|
|
70
|
+
lore demo
|
|
71
|
+
lore demo --json --keep
|
|
72
|
+
`;
|
|
73
|
+
function valueAfter(args, index, flag) {
|
|
74
|
+
const value = args[index + 1];
|
|
75
|
+
if (value === undefined) {
|
|
76
|
+
throw new Error(`Missing value for ${flag}`);
|
|
77
|
+
}
|
|
78
|
+
return [value, index + 1];
|
|
79
|
+
}
|
|
80
|
+
function parseArguments(args) {
|
|
81
|
+
const parsed = {
|
|
82
|
+
json: false,
|
|
83
|
+
keep: false,
|
|
84
|
+
timeoutMs: 120_000,
|
|
85
|
+
claudeModel: "haiku",
|
|
86
|
+
};
|
|
87
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
88
|
+
const argument = args[index];
|
|
89
|
+
if (argument === "--help" || argument === "-h") {
|
|
90
|
+
process.stdout.write(DEMO_HELP);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
if (argument === "--json") {
|
|
94
|
+
parsed.json = true;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
if (argument === "--keep") {
|
|
98
|
+
parsed.keep = true;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (argument !== "--timeout-ms" &&
|
|
102
|
+
argument !== "--claude-model" &&
|
|
103
|
+
argument !== "--codex-model") {
|
|
104
|
+
throw new Error(`Unknown demo option: ${argument ?? ""}`);
|
|
105
|
+
}
|
|
106
|
+
const [value, valueIndex] = valueAfter(args, index, argument);
|
|
107
|
+
index = valueIndex;
|
|
108
|
+
if (argument === "--timeout-ms") {
|
|
109
|
+
const timeoutMs = Number(value);
|
|
110
|
+
if (!Number.isInteger(timeoutMs) ||
|
|
111
|
+
timeoutMs < 10_000 ||
|
|
112
|
+
timeoutMs > 300_000) {
|
|
113
|
+
throw new Error("--timeout-ms must be between 10000 and 300000");
|
|
114
|
+
}
|
|
115
|
+
parsed.timeoutMs = timeoutMs;
|
|
116
|
+
}
|
|
117
|
+
else if (argument === "--claude-model") {
|
|
118
|
+
parsed.claudeModel = value;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
parsed.codexModel = value;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return parsed;
|
|
125
|
+
}
|
|
126
|
+
async function run(executable, args, cwd, timeoutMs) {
|
|
127
|
+
try {
|
|
128
|
+
const result = await new Promise((resolve, reject) => {
|
|
129
|
+
const child = execFileCallback(executable, [...args], {
|
|
130
|
+
cwd,
|
|
131
|
+
encoding: "utf8",
|
|
132
|
+
env: { ...process.env, NO_COLOR: "1" },
|
|
133
|
+
timeout: timeoutMs,
|
|
134
|
+
killSignal: "SIGKILL",
|
|
135
|
+
maxBuffer: 4 * 1024 * 1024,
|
|
136
|
+
}, (error, stdout, stderr) => {
|
|
137
|
+
if (error !== null) {
|
|
138
|
+
Object.assign(error, { stdout, stderr });
|
|
139
|
+
reject(error);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
resolve({ stdout, stderr });
|
|
143
|
+
});
|
|
144
|
+
child.stdin?.end();
|
|
145
|
+
});
|
|
146
|
+
return {
|
|
147
|
+
stdout: result.stdout.trim(),
|
|
148
|
+
stderr: result.stderr.trim(),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
const details = typeof error === "object" &&
|
|
153
|
+
error !== null &&
|
|
154
|
+
"stderr" in error &&
|
|
155
|
+
typeof error.stderr === "string"
|
|
156
|
+
? error.stderr.trim()
|
|
157
|
+
: "";
|
|
158
|
+
throw new Error(`${executable} failed${details === "" ? "" : `:\n${details}`}`, { cause: error });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async function git(cwd, args, timeoutMs) {
|
|
162
|
+
await run("git", args, cwd, timeoutMs);
|
|
163
|
+
}
|
|
164
|
+
async function waitForLearning(client, marker, repository, timeoutMs) {
|
|
165
|
+
const deadline = Date.now() + timeoutMs;
|
|
166
|
+
while (Date.now() < deadline) {
|
|
167
|
+
const response = await client.listLearnings({
|
|
168
|
+
query: marker,
|
|
169
|
+
repo: repository,
|
|
170
|
+
status: "active",
|
|
171
|
+
limit: 20,
|
|
172
|
+
});
|
|
173
|
+
const learning = response.memories.find((memory) => memory.content.includes(marker));
|
|
174
|
+
if (learning !== undefined) {
|
|
175
|
+
return learning;
|
|
176
|
+
}
|
|
177
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
178
|
+
}
|
|
179
|
+
throw new Error("Claude correction was not captured before the timeout");
|
|
180
|
+
}
|
|
181
|
+
function activityTask(activity) {
|
|
182
|
+
const request = activity.event.payload.request;
|
|
183
|
+
if (typeof request !== "object" ||
|
|
184
|
+
request === null ||
|
|
185
|
+
!("task" in request) ||
|
|
186
|
+
typeof request.task !== "object" ||
|
|
187
|
+
request.task === null ||
|
|
188
|
+
!("task" in request.task) ||
|
|
189
|
+
typeof request.task.task !== "string") {
|
|
190
|
+
return "";
|
|
191
|
+
}
|
|
192
|
+
return request.task.task;
|
|
193
|
+
}
|
|
194
|
+
async function waitForDelivery(client, marker, timeoutMs) {
|
|
195
|
+
const deadline = Date.now() + timeoutMs;
|
|
196
|
+
while (Date.now() < deadline) {
|
|
197
|
+
const response = await client.listActivity({
|
|
198
|
+
type: "context_delivery",
|
|
199
|
+
agent: "codex",
|
|
200
|
+
limit: 50,
|
|
201
|
+
});
|
|
202
|
+
const activity = response.activities.find((item) => activityTask(item).includes(marker));
|
|
203
|
+
if (activity !== undefined) {
|
|
204
|
+
return activity;
|
|
205
|
+
}
|
|
206
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
207
|
+
}
|
|
208
|
+
throw new Error("Codex delivery receipt was not recorded before the timeout");
|
|
209
|
+
}
|
|
210
|
+
function claudeArgs(input) {
|
|
211
|
+
return [
|
|
212
|
+
"-p",
|
|
213
|
+
"--setting-sources",
|
|
214
|
+
"project,local",
|
|
215
|
+
...(input.sessionId === undefined
|
|
216
|
+
? []
|
|
217
|
+
: ["--session-id", input.sessionId]),
|
|
218
|
+
...(input.resumeSessionId === undefined
|
|
219
|
+
? []
|
|
220
|
+
: ["--resume", input.resumeSessionId]),
|
|
221
|
+
"--output-format",
|
|
222
|
+
"text",
|
|
223
|
+
"--max-budget-usd",
|
|
224
|
+
"0.50",
|
|
225
|
+
"--model",
|
|
226
|
+
input.model,
|
|
227
|
+
"--tools",
|
|
228
|
+
"",
|
|
229
|
+
"--permission-mode",
|
|
230
|
+
"dontAsk",
|
|
231
|
+
"--no-chrome",
|
|
232
|
+
"--disable-slash-commands",
|
|
233
|
+
input.prompt,
|
|
234
|
+
];
|
|
235
|
+
}
|
|
236
|
+
function codexArgs(input) {
|
|
237
|
+
return [
|
|
238
|
+
"exec",
|
|
239
|
+
"--json",
|
|
240
|
+
"--skip-git-repo-check",
|
|
241
|
+
"--dangerously-bypass-hook-trust",
|
|
242
|
+
"--sandbox",
|
|
243
|
+
input.writable ? "workspace-write" : "read-only",
|
|
244
|
+
"-c",
|
|
245
|
+
'model_reasoning_effort="low"',
|
|
246
|
+
...(input.model === undefined ? [] : ["--model", input.model]),
|
|
247
|
+
"--ephemeral",
|
|
248
|
+
"--output-last-message",
|
|
249
|
+
input.outputPath,
|
|
250
|
+
input.prompt,
|
|
251
|
+
];
|
|
252
|
+
}
|
|
253
|
+
export async function runDemoCommand(args, config) {
|
|
254
|
+
const options = parseArguments(args);
|
|
255
|
+
if (options === null) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
if (config === null) {
|
|
259
|
+
throw new Error("Lore is not connected. Run `lore connect` first.");
|
|
260
|
+
}
|
|
261
|
+
if (!config.agents.includes("claude") || !config.agents.includes("codex")) {
|
|
262
|
+
throw new Error("The proof loop requires both Claude and Codex hooks. Re-run `lore connect --agent claude --agent codex`.");
|
|
263
|
+
}
|
|
264
|
+
const startedAt = Date.now();
|
|
265
|
+
const directory = await mkdtemp(join(tmpdir(), "lore-proof-"));
|
|
266
|
+
const sourceDirectory = join(directory, "src");
|
|
267
|
+
const targetPath = join(sourceDirectory, "greeting.ts");
|
|
268
|
+
const unrelatedPath = join(sourceDirectory, "unrelated.ts");
|
|
269
|
+
const codexOutput = join(directory, "codex-output.txt");
|
|
270
|
+
const nonce = Date.now().toString(36).toUpperCase();
|
|
271
|
+
const marker = `LORE_GREETING_${nonce}`;
|
|
272
|
+
const relevantPromptMarker = `LORE_RELEVANT_${nonce}`;
|
|
273
|
+
const irrelevantPromptMarker = `LORE_IRRELEVANT_${nonce}`;
|
|
274
|
+
const repository = `lore-demo/claude-to-codex-${nonce.toLocaleLowerCase()}`;
|
|
275
|
+
const sessionId = randomUUID();
|
|
276
|
+
const client = new LoreClient({
|
|
277
|
+
baseUrl: config.apiUrl,
|
|
278
|
+
headers: { authorization: `Bearer ${config.token}` },
|
|
279
|
+
});
|
|
280
|
+
let learning;
|
|
281
|
+
let loreOverheadMs = 0;
|
|
282
|
+
try {
|
|
283
|
+
await mkdir(sourceDirectory, { recursive: true });
|
|
284
|
+
await writeFile(targetPath, 'export const greeting = "legacy-greeting";\n', "utf8");
|
|
285
|
+
await writeFile(unrelatedPath, "export const unrelated = true;\n", "utf8");
|
|
286
|
+
await installIsolatedClaudeHooks(directory);
|
|
287
|
+
await git(directory, ["init", "-q"], options.timeoutMs);
|
|
288
|
+
await git(directory, ["config", "user.email", "lore-demo@example.invalid"], options.timeoutMs);
|
|
289
|
+
await git(directory, ["config", "user.name", "Lore Demo"], options.timeoutMs);
|
|
290
|
+
await git(directory, [
|
|
291
|
+
"remote",
|
|
292
|
+
"add",
|
|
293
|
+
"origin",
|
|
294
|
+
`https://github.com/${repository}.git`,
|
|
295
|
+
], options.timeoutMs);
|
|
296
|
+
await git(directory, ["add", "."], options.timeoutMs);
|
|
297
|
+
await git(directory, ["commit", "-qm", "fixture"], options.timeoutMs);
|
|
298
|
+
await writeFile(targetPath, '// TODO: replace the legacy value\nexport const greeting = "legacy-greeting";\n', "utf8");
|
|
299
|
+
const incorrectClaudeResult = await run("claude", claudeArgs({
|
|
300
|
+
sessionId,
|
|
301
|
+
model: options.claudeModel,
|
|
302
|
+
prompt: 'Without reading files or using tools, write only a one-line TypeScript implementation for the greeting constant using the assumed legacy value "legacy-greeting".',
|
|
303
|
+
}), directory, options.timeoutMs);
|
|
304
|
+
if (!incorrectClaudeResult.stdout.includes("legacy-greeting") ||
|
|
305
|
+
incorrectClaudeResult.stdout.includes(marker)) {
|
|
306
|
+
throw new Error("Claude did not produce the expected observable wrong implementation");
|
|
307
|
+
}
|
|
308
|
+
await run("claude", claudeArgs({
|
|
309
|
+
resumeSessionId: sessionId,
|
|
310
|
+
model: options.claudeModel,
|
|
311
|
+
prompt: `No. The durable repository rule for src/greeting.ts is: set the greeting constant to the exact value ${marker}, never legacy-greeting.`,
|
|
312
|
+
}), directory, options.timeoutMs);
|
|
313
|
+
const captureStartedAt = Date.now();
|
|
314
|
+
learning = await waitForLearning(client, marker, repository, options.timeoutMs);
|
|
315
|
+
loreOverheadMs += Date.now() - captureStartedAt;
|
|
316
|
+
if (learning.scope.path !== "src/greeting.ts") {
|
|
317
|
+
throw new Error(`Expected a src/greeting.ts learning scope, received ${learning.scope.path ?? "repository-wide"}`);
|
|
318
|
+
}
|
|
319
|
+
await run("codex", codexArgs({
|
|
320
|
+
outputPath: codexOutput,
|
|
321
|
+
...(options.codexModel === undefined
|
|
322
|
+
? {}
|
|
323
|
+
: { model: options.codexModel }),
|
|
324
|
+
writable: true,
|
|
325
|
+
prompt: `${relevantPromptMarker}: Update src/greeting.ts so the greeting constant follows the remembered repository rule. Make the edit and briefly confirm.`,
|
|
326
|
+
}), directory, options.timeoutMs);
|
|
327
|
+
const relevantReceiptStartedAt = Date.now();
|
|
328
|
+
const relevantActivity = await waitForDelivery(client, relevantPromptMarker, options.timeoutMs);
|
|
329
|
+
loreOverheadMs += Date.now() - relevantReceiptStartedAt;
|
|
330
|
+
if (relevantActivity.receipt === null ||
|
|
331
|
+
relevantActivity.receipt.memoryIds.length !== 1 ||
|
|
332
|
+
relevantActivity.receipt.memoryIds[0] !== learning.id) {
|
|
333
|
+
throw new Error("The relevant Codex receipt did not contain exactly the intended learning");
|
|
334
|
+
}
|
|
335
|
+
const receiptHit = relevantActivity.receipt.hits[0];
|
|
336
|
+
if (receiptHit?.memoryId !== learning.id ||
|
|
337
|
+
!receiptHit.content.includes(marker) ||
|
|
338
|
+
!receiptHit.reasons.includes("path")) {
|
|
339
|
+
throw new Error("The relevant Codex receipt did not preserve exact match evidence");
|
|
340
|
+
}
|
|
341
|
+
const target = await readFile(targetPath, "utf8");
|
|
342
|
+
if (!target.includes(marker) || target.includes("legacy-greeting")) {
|
|
343
|
+
throw new Error("Codex received the turn but did not apply the learned rule");
|
|
344
|
+
}
|
|
345
|
+
await git(directory, ["add", targetPath], options.timeoutMs);
|
|
346
|
+
await git(directory, ["commit", "-qm", "apply learned greeting"], options.timeoutMs);
|
|
347
|
+
await writeFile(unrelatedPath, "export const unrelated = false;\n", "utf8");
|
|
348
|
+
await run("codex", codexArgs({
|
|
349
|
+
outputPath: codexOutput,
|
|
350
|
+
...(options.codexModel === undefined
|
|
351
|
+
? {}
|
|
352
|
+
: { model: options.codexModel }),
|
|
353
|
+
writable: false,
|
|
354
|
+
prompt: `${irrelevantPromptMarker}: Inspect only src/unrelated.ts and state its exported boolean. Do not modify files.`,
|
|
355
|
+
}), directory, options.timeoutMs);
|
|
356
|
+
const irrelevantReceiptStartedAt = Date.now();
|
|
357
|
+
const irrelevantActivity = await waitForDelivery(client, irrelevantPromptMarker, options.timeoutMs);
|
|
358
|
+
loreOverheadMs += Date.now() - irrelevantReceiptStartedAt;
|
|
359
|
+
if (irrelevantActivity.receipt !== null &&
|
|
360
|
+
irrelevantActivity.receipt.memoryIds.length > 0) {
|
|
361
|
+
throw new Error("Lore injected context into an unrelated file task");
|
|
362
|
+
}
|
|
363
|
+
const result = {
|
|
364
|
+
ok: true,
|
|
365
|
+
repository,
|
|
366
|
+
learningId: learning.id,
|
|
367
|
+
receiptId: relevantActivity.receipt.id,
|
|
368
|
+
durationMs: Date.now() - startedAt,
|
|
369
|
+
loreOverheadMs,
|
|
370
|
+
fixtureDirectory: options.keep ? directory : null,
|
|
371
|
+
checks: {
|
|
372
|
+
correctionCaptured: true,
|
|
373
|
+
pathScoped: true,
|
|
374
|
+
relevantReceipt: true,
|
|
375
|
+
codexFollowedRule: true,
|
|
376
|
+
irrelevantPromptSilent: true,
|
|
377
|
+
},
|
|
378
|
+
};
|
|
379
|
+
process.stdout.write(options.json
|
|
380
|
+
? `${JSON.stringify(result, null, 2)}\n`
|
|
381
|
+
: [
|
|
382
|
+
"Claude → Codex proof passed.",
|
|
383
|
+
`learning_id: ${result.learningId}`,
|
|
384
|
+
`receipt_id: ${result.receiptId}`,
|
|
385
|
+
`duration_ms: ${result.durationMs}`,
|
|
386
|
+
`lore_overhead_ms: ${result.loreOverheadMs}`,
|
|
387
|
+
...(result.fixtureDirectory === null
|
|
388
|
+
? []
|
|
389
|
+
: [`fixture: ${result.fixtureDirectory}`]),
|
|
390
|
+
"",
|
|
391
|
+
].join("\n"));
|
|
392
|
+
}
|
|
393
|
+
finally {
|
|
394
|
+
if (learning !== undefined) {
|
|
395
|
+
await client.forgetLearning(learning.id).catch(() => undefined);
|
|
396
|
+
}
|
|
397
|
+
if (!options.keep) {
|
|
398
|
+
await rm(directory, { recursive: true, force: true });
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
//# sourceMappingURL=demo.js.map
|
package/dist/demo.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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M,CAAC,UAAU,EAAE;gBACnC,eAAe,MAAM,CAAC,SAAS,EAAE;gBACjC,gBAAgB,MAAM,CAAC,UAAU,EAAE;gBACnC,qBAAqB,MAAM,CAAC,cAAc,EAAE;gBAC5C,GAAG,CAAC,MAAM,CAAC,gBAAgB,KAAK,IAAI;oBAClC,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,CAAC,YAAY,MAAM,CAAC,gBAAgB,EAAE,CAAC,CAAC;gBAC5C,EAAE;aACH,CAAC,IAAI,CAAC,IAAI,CAAC,CACjB,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const GITHUB_TEMPLATE_ASSETS: {
|
|
2
|
-
readonly "lore-codex-review.yml": "name: Lore Codex review\nrun-name: 'Lore Codex review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}'\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:codex-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
3
|
-
readonly "lore-devin-review.yml": "name: Lore Devin review\nrun-name: 'Lore Devin review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}'\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\nconcurrency:\n group: lore-devin-review-${{ github.repository }}-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:devin-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
4
|
-
readonly "lore-observe-correction.yml": "name: Lore review correction\nrun-name: 'Lore review correction comment #${{ github.event.comment.id }}'\n\non:\n issue_comment:\n types: [created]\n\njobs:\n observe:\n if: >-\n github.event.issue.pull_request &&\n startsWith(github.event.comment.body, '/lore correct ')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n issues: read\n pull-requests: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
2
|
+
readonly "lore-codex-review.yml": "name: Lore Codex review\nrun-name: 'Lore Codex review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}'\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:codex-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.3' }}\n outputs:\n final-message: ${{ steps.codex.outputs.final-message }}\n steps:\n - uses: actions/checkout@v5\n with:\n fetch-depth: 0\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://raw.githubusercontent.com/$LORE_CLI_REPOSITORY/$LORE_CLI_VERSION/scripts/install.sh\" | bash\n\n - name: Prepare Lore review context\n env:\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github prepare-review\n --provider codex\n --event \"$GITHUB_EVENT_PATH\"\n --checkout \"$GITHUB_WORKSPACE/review\"\n --prompt-out \"$GITHUB_WORKSPACE/.lore/codex-prompt.md\"\n --metadata-out \"$GITHUB_WORKSPACE/.lore/codex-metadata.json\"\n --schema-out \"$GITHUB_WORKSPACE/.lore/review-output.schema.json\"\n\n - uses: actions/upload-artifact@v4\n with:\n name: lore-codex-metadata\n path: .lore/codex-metadata.json\n retention-days: 1\n\n - name: Run Codex\n id: codex\n uses: openai/codex-action@52fe01ec70a42f454c9d2ebd47598f9fd6893d56 # v1\n with:\n openai-api-key: ${{ secrets.OPENAI_API_KEY }}\n prompt-file: .lore/codex-prompt.md\n output-schema-file: .lore/review-output.schema.json\n working-directory: review\n permission-profile: \":read-only\"\n safety-strategy: drop-sudo\n\n post:\n needs: review\n if: needs.review.outputs.final-message != ''\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.3' }}\n steps:\n - uses: actions/checkout@v5\n with:\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://raw.githubusercontent.com/$LORE_CLI_REPOSITORY/$LORE_CLI_VERSION/scripts/install.sh\" | bash\n\n - uses: actions/download-artifact@v4\n with:\n name: lore-codex-metadata\n path: .lore\n\n - name: Save review output\n env:\n CODEX_REVIEW: ${{ needs.review.outputs.final-message }}\n run: |\n mkdir -p .lore\n printf '%s' \"$CODEX_REVIEW\" > .lore/codex-output.json\n\n - name: Post or update Lore review\n env:\n GH_TOKEN: ${{ github.token }}\n run: >-\n lore github post-review\n --metadata .lore/codex-metadata.json\n --output .lore/codex-output.json\n";
|
|
3
|
+
readonly "lore-devin-review.yml": "name: Lore Devin review\nrun-name: 'Lore Devin review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}'\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\nconcurrency:\n group: lore-devin-review-${{ github.repository }}-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:devin-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.3' }}\n steps:\n - uses: actions/checkout@v5\n with:\n fetch-depth: 0\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://raw.githubusercontent.com/$LORE_CLI_REPOSITORY/$LORE_CLI_VERSION/scripts/install.sh\" | bash\n\n - name: Prepare Lore review context\n env:\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github prepare-review\n --provider devin\n --event \"$GITHUB_EVENT_PATH\"\n --checkout \"$GITHUB_WORKSPACE/review\"\n --prompt-out \"$GITHUB_WORKSPACE/.lore/devin-prompt.md\"\n --metadata-out \"$GITHUB_WORKSPACE/.lore/devin-metadata.json\"\n\n - name: Run Lore-enriched Devin review\n env:\n DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }}\n DEVIN_ORG_ID: ${{ vars.DEVIN_ORG_ID }}\n run: >-\n lore devin run-review\n --prompt .lore/devin-prompt.md\n --metadata .lore/devin-metadata.json\n --output .lore/devin-output.json\n\n - name: Post or update Lore review\n env:\n GH_TOKEN: ${{ github.token }}\n run: >-\n lore github post-review\n --metadata .lore/devin-metadata.json\n --output .lore/devin-output.json\n\n - name: Clean up Devin session\n if: always()\n continue-on-error: true\n env:\n DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }}\n DEVIN_ORG_ID: ${{ vars.DEVIN_ORG_ID }}\n run: |\n SESSION_ID=\"$(jq -r '.sessionId // empty' .lore/devin-metadata.json 2>/dev/null || true)\"\n if [ -n \"$SESSION_ID\" ]; then\n lore devin terminate --session \"$SESSION_ID\"\n fi\n";
|
|
4
|
+
readonly "lore-observe-correction.yml": "name: Lore review correction\nrun-name: 'Lore review correction comment #${{ github.event.comment.id }}'\n\non:\n issue_comment:\n types: [created]\n\njobs:\n observe:\n if: >-\n github.event.issue.pull_request &&\n startsWith(github.event.comment.body, '/lore correct ')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n issues: read\n pull-requests: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.3' }}\n steps:\n - uses: actions/checkout@v5\n with:\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://raw.githubusercontent.com/$LORE_CLI_REPOSITORY/$LORE_CLI_VERSION/scripts/install.sh\" | bash\n\n - name: Teach Lore from an authorized correction\n env:\n GH_TOKEN: ${{ github.token }}\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github observe-correction\n --event \"$GITHUB_EVENT_PATH\"\n";
|
|
5
5
|
readonly "review-output.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"summary\", \"findings\"],\n \"properties\": {\n \"summary\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"findings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"severity\", \"title\", \"body\", \"path\", \"line\"],\n \"properties\": {\n \"severity\": {\n \"enum\": [\"critical\", \"high\", \"medium\", \"low\"]\n },\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"body\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"path\": {\n \"type\": [\"string\", \"null\"],\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"line\": {\n \"type\": [\"integer\", \"null\"],\n \"minimum\": 1\n }\n }\n }\n }\n }\n}\n";
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=generated-assets.d.ts.map
|
package/dist/generated-assets.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Generated by scripts/generate-cli-assets.mjs. Do not edit directly.
|
|
2
2
|
export const GITHUB_TEMPLATE_ASSETS = {
|
|
3
|
-
"lore-codex-review.yml": "name: Lore Codex review\nrun-name: 'Lore Codex review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}'\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:codex-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
4
|
-
"lore-devin-review.yml": "name: Lore Devin review\nrun-name: 'Lore Devin review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}'\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\nconcurrency:\n group: lore-devin-review-${{ github.repository }}-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:devin-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
5
|
-
"lore-observe-correction.yml": "name: Lore review correction\nrun-name: 'Lore review correction comment #${{ github.event.comment.id }}'\n\non:\n issue_comment:\n types: [created]\n\njobs:\n observe:\n if: >-\n github.event.issue.pull_request &&\n startsWith(github.event.comment.body, '/lore correct ')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n issues: read\n pull-requests: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.
|
|
3
|
+
"lore-codex-review.yml": "name: Lore Codex review\nrun-name: 'Lore Codex review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}'\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:codex-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.3' }}\n outputs:\n final-message: ${{ steps.codex.outputs.final-message }}\n steps:\n - uses: actions/checkout@v5\n with:\n fetch-depth: 0\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://raw.githubusercontent.com/$LORE_CLI_REPOSITORY/$LORE_CLI_VERSION/scripts/install.sh\" | bash\n\n - name: Prepare Lore review context\n env:\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github prepare-review\n --provider codex\n --event \"$GITHUB_EVENT_PATH\"\n --checkout \"$GITHUB_WORKSPACE/review\"\n --prompt-out \"$GITHUB_WORKSPACE/.lore/codex-prompt.md\"\n --metadata-out \"$GITHUB_WORKSPACE/.lore/codex-metadata.json\"\n --schema-out \"$GITHUB_WORKSPACE/.lore/review-output.schema.json\"\n\n - uses: actions/upload-artifact@v4\n with:\n name: lore-codex-metadata\n path: .lore/codex-metadata.json\n retention-days: 1\n\n - name: Run Codex\n id: codex\n uses: openai/codex-action@52fe01ec70a42f454c9d2ebd47598f9fd6893d56 # v1\n with:\n openai-api-key: ${{ secrets.OPENAI_API_KEY }}\n prompt-file: .lore/codex-prompt.md\n output-schema-file: .lore/review-output.schema.json\n working-directory: review\n permission-profile: \":read-only\"\n safety-strategy: drop-sudo\n\n post:\n needs: review\n if: needs.review.outputs.final-message != ''\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.3' }}\n steps:\n - uses: actions/checkout@v5\n with:\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://raw.githubusercontent.com/$LORE_CLI_REPOSITORY/$LORE_CLI_VERSION/scripts/install.sh\" | bash\n\n - uses: actions/download-artifact@v4\n with:\n name: lore-codex-metadata\n path: .lore\n\n - name: Save review output\n env:\n CODEX_REVIEW: ${{ needs.review.outputs.final-message }}\n run: |\n mkdir -p .lore\n printf '%s' \"$CODEX_REVIEW\" > .lore/codex-output.json\n\n - name: Post or update Lore review\n env:\n GH_TOKEN: ${{ github.token }}\n run: >-\n lore github post-review\n --metadata .lore/codex-metadata.json\n --output .lore/codex-output.json\n",
|
|
4
|
+
"lore-devin-review.yml": "name: Lore Devin review\nrun-name: 'Lore Devin review [${{ github.event.action }}] PR #${{ github.event.pull_request.number }} @ ${{ github.event.pull_request.head.sha }}'\n\non:\n pull_request:\n types: [opened, synchronize, reopened, ready_for_review, labeled]\n\nconcurrency:\n group: lore-devin-review-${{ github.repository }}-${{ github.event.pull_request.number }}\n cancel-in-progress: true\n\njobs:\n review:\n if: >-\n !github.event.pull_request.draft &&\n github.event.pull_request.head.repo.full_name == github.repository &&\n contains(github.event.pull_request.labels.*.name, 'lore:devin-review')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n pull-requests: write\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.3' }}\n steps:\n - uses: actions/checkout@v5\n with:\n fetch-depth: 0\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://raw.githubusercontent.com/$LORE_CLI_REPOSITORY/$LORE_CLI_VERSION/scripts/install.sh\" | bash\n\n - name: Prepare Lore review context\n env:\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github prepare-review\n --provider devin\n --event \"$GITHUB_EVENT_PATH\"\n --checkout \"$GITHUB_WORKSPACE/review\"\n --prompt-out \"$GITHUB_WORKSPACE/.lore/devin-prompt.md\"\n --metadata-out \"$GITHUB_WORKSPACE/.lore/devin-metadata.json\"\n\n - name: Run Lore-enriched Devin review\n env:\n DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }}\n DEVIN_ORG_ID: ${{ vars.DEVIN_ORG_ID }}\n run: >-\n lore devin run-review\n --prompt .lore/devin-prompt.md\n --metadata .lore/devin-metadata.json\n --output .lore/devin-output.json\n\n - name: Post or update Lore review\n env:\n GH_TOKEN: ${{ github.token }}\n run: >-\n lore github post-review\n --metadata .lore/devin-metadata.json\n --output .lore/devin-output.json\n\n - name: Clean up Devin session\n if: always()\n continue-on-error: true\n env:\n DEVIN_API_KEY: ${{ secrets.DEVIN_API_KEY }}\n DEVIN_ORG_ID: ${{ vars.DEVIN_ORG_ID }}\n run: |\n SESSION_ID=\"$(jq -r '.sessionId // empty' .lore/devin-metadata.json 2>/dev/null || true)\"\n if [ -n \"$SESSION_ID\" ]; then\n lore devin terminate --session \"$SESSION_ID\"\n fi\n",
|
|
5
|
+
"lore-observe-correction.yml": "name: Lore review correction\nrun-name: 'Lore review correction comment #${{ github.event.comment.id }}'\n\non:\n issue_comment:\n types: [created]\n\njobs:\n observe:\n if: >-\n github.event.issue.pull_request &&\n startsWith(github.event.comment.body, '/lore correct ')\n runs-on: ubuntu-latest\n permissions:\n contents: read\n issues: read\n pull-requests: read\n env:\n LORE_CLI_REPOSITORY: ${{ vars.LORE_CLI_REPOSITORY || 'treadiehq/lore' }}\n LORE_CLI_VERSION: ${{ vars.LORE_CLI_VERSION || 'v0.1.3' }}\n steps:\n - uses: actions/checkout@v5\n with:\n persist-credentials: false\n path: review\n\n - name: Install Lore CLI\n run: |\n export LORE_REPO=\"$LORE_CLI_REPOSITORY\"\n export LORE_VERSION=\"$LORE_CLI_VERSION\"\n export LORE_BIN_DIR=\"$RUNNER_TEMP/lore/bin\"\n curl -fsSL \"https://raw.githubusercontent.com/$LORE_CLI_REPOSITORY/$LORE_CLI_VERSION/scripts/install.sh\" | bash\n\n - name: Teach Lore from an authorized correction\n env:\n GH_TOKEN: ${{ github.token }}\n LORE_API_URL: ${{ vars.LORE_API_URL }}\n LORE_WORKSPACE_TOKEN: ${{ secrets.LORE_WORKSPACE_TOKEN }}\n run: >-\n lore github observe-correction\n --event \"$GITHUB_EVENT_PATH\"\n",
|
|
6
6
|
"review-output.schema.json": "{\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"summary\", \"findings\"],\n \"properties\": {\n \"summary\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"findings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": false,\n \"required\": [\"severity\", \"title\", \"body\", \"path\", \"line\"],\n \"properties\": {\n \"severity\": {\n \"enum\": [\"critical\", \"high\", \"medium\", \"low\"]\n },\n \"title\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"body\": {\n \"type\": \"string\",\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"path\": {\n \"type\": [\"string\", \"null\"],\n \"minLength\": 1,\n \"pattern\": \"\\\\S\"\n },\n \"line\": {\n \"type\": [\"integer\", \"null\"],\n \"minimum\": 1\n }\n }\n }\n }\n }\n}\n"
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=generated-assets.js.map
|
package/dist/github.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":"AAgBA,KAAK,cAAc,GAAG,OAAO,GAAG,OAAO,CAAC;AA2BxC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,cAAc,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAoqBD,wBAAsB,aAAa,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA0C1E;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiB7E;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAM/D;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAE7D"}
|
package/dist/github.js
CHANGED
|
@@ -5,6 +5,7 @@ import { homedir } from "node:os";
|
|
|
5
5
|
import { dirname, resolve } from "node:path";
|
|
6
6
|
import { parseReviewOutput, } from "./review-output.js";
|
|
7
7
|
import { GITHUB_TEMPLATE_ASSETS } from "./generated-assets.js";
|
|
8
|
+
import { boundedUtf8Text } from "./repository.js";
|
|
8
9
|
const TEMPLATE_FILES = [
|
|
9
10
|
"lore-codex-review.yml",
|
|
10
11
|
"lore-devin-review.yml",
|
|
@@ -135,10 +136,7 @@ async function gitReviewEvidence(checkout, baseSha, headSha) {
|
|
|
135
136
|
runProcess("git", ["diff", "--no-ext-diff", "--unified=40", range], checkout),
|
|
136
137
|
runProcess("git", ["diff", "--name-only", range], checkout),
|
|
137
138
|
]);
|
|
138
|
-
const
|
|
139
|
-
const diff = diffBuffer.byteLength <= MAX_DIFF_BYTES
|
|
140
|
-
? rawDiff
|
|
141
|
-
: `${diffBuffer.subarray(0, MAX_DIFF_BYTES).toString("utf8")}\n\n[diff truncated by Lore]`;
|
|
139
|
+
const diff = boundedUtf8Text(rawDiff, MAX_DIFF_BYTES, "\n\n[diff truncated by Lore]");
|
|
142
140
|
return {
|
|
143
141
|
diff,
|
|
144
142
|
files: rawFiles
|