mirror of
https://github.com/Louis-CFM/coucou.git
synced 2026-12-07 07:32:35 +09:00
A repo Mochi can now be Autonomous (editor › What it may do): it does what is safe and can be undone on its own — opens the draft PR, posts the review as a comment, replies on the issue — and tells you after. It never merges, pushes to main, approves or sends a mail; a mail Mochi only drafts and only a repo Mochi can be autonomous. - brain: level "autonome"; runMochi posts with the user's git and gh right away and records it on the run (auto: applied + url, or failed + error). A post GitHub refuses waits for the click instead. A Cloud Mochi's level goes to the Cloud when it is saved. - Worker: mochis.autonomous and runs.auto; when a run is collected, an autonomous Mochi's review is posted at once. The columns are added to the existing database by the Worker itself, no command to run. - Notch: "PR Reviewer posted its review on PR #12" with Open, nothing to click. Results: "Posted its review on PR #12 on its own" with Open. - Cloud page: the Mochis as small tiles (a switch each, Soon for the others, the level shown); the refresh button is gone, the page refreshes itself every minute while open; a run posted on its own says so, with Open. 12 new strings in the 16 languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LJm3SRL9k3gBPaVtfPhwcT
21 lines
1005 B
TypeScript
21 lines
1005 B
TypeScript
/** Just enough of D1 for the tests, over SQLite in memory. */
|
|
import Database from "better-sqlite3";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
export function memoryD1(schema = fs.readFileSync(path.join(__dirname, "..", "schema.sql"), "utf8")): D1Database {
|
|
const db = new Database(":memory:");
|
|
db.exec(schema);
|
|
const statement = (sql: string, args: unknown[] = []): any => ({
|
|
bind: (...a: unknown[]) => statement(sql, a),
|
|
first: async <T>() => (db.prepare(sql).get(...(args as any[])) as T) ?? null,
|
|
all: async <T>() => ({ results: db.prepare(sql).all(...(args as any[])) as T[], success: true }),
|
|
run: async () => { const r = db.prepare(sql).run(...(args as any[])); return { success: true, meta: { changes: r.changes } }; },
|
|
_exec: () => db.prepare(sql).run(...(args as any[])),
|
|
});
|
|
return {
|
|
prepare: (sql: string) => statement(sql),
|
|
batch: async (stmts: any[]) => db.transaction(() => stmts.map(s => s._exec()))(),
|
|
} as unknown as D1Database;
|
|
}
|