@oal-sarl/code 6.0.2 → 6.0.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/dist/index.js +70 -48
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7566,6 +7566,25 @@ var init_skillLoader = __esm(() => {
|
|
|
7566
7566
|
MODULE_DIR = path17.dirname(fileURLToPath(import.meta.url));
|
|
7567
7567
|
});
|
|
7568
7568
|
|
|
7569
|
+
// src/productMeta.ts
|
|
7570
|
+
import fs16 from "fs";
|
|
7571
|
+
function readPackageVersion() {
|
|
7572
|
+
try {
|
|
7573
|
+
const raw = fs16.readFileSync(new URL("../package.json", import.meta.url), "utf-8");
|
|
7574
|
+
const parsed = JSON.parse(raw);
|
|
7575
|
+
if (typeof parsed.version === "string" && parsed.version.trim()) {
|
|
7576
|
+
return parsed.version.trim();
|
|
7577
|
+
}
|
|
7578
|
+
} catch {}
|
|
7579
|
+
return "0.0.0";
|
|
7580
|
+
}
|
|
7581
|
+
var PRODUCT_NAME = "Code", PRODUCT_VERSION, PRODUCT_MAJOR_LABEL, PRODUCT_SHELL_LABEL;
|
|
7582
|
+
var init_productMeta = __esm(() => {
|
|
7583
|
+
PRODUCT_VERSION = readPackageVersion();
|
|
7584
|
+
PRODUCT_MAJOR_LABEL = `v${PRODUCT_VERSION.split(".")[0] ?? "0"}`;
|
|
7585
|
+
PRODUCT_SHELL_LABEL = `${PRODUCT_NAME} ${PRODUCT_MAJOR_LABEL}`;
|
|
7586
|
+
});
|
|
7587
|
+
|
|
7569
7588
|
// src/ui/theme.ts
|
|
7570
7589
|
function getPhaseColor(phase) {
|
|
7571
7590
|
switch (phase) {
|
|
@@ -8951,11 +8970,11 @@ function Header({ model, env, sessionCount, skillCount }) {
|
|
|
8951
8970
|
/* @__PURE__ */ jsxDEV10(Text9, {
|
|
8952
8971
|
bold: true,
|
|
8953
8972
|
color: codeTheme.brandStrong,
|
|
8954
|
-
children:
|
|
8973
|
+
children: PRODUCT_NAME
|
|
8955
8974
|
}, undefined, false, undefined, this),
|
|
8956
8975
|
/* @__PURE__ */ jsxDEV10(Text9, {
|
|
8957
8976
|
color: codeTheme.muted,
|
|
8958
|
-
children:
|
|
8977
|
+
children: PRODUCT_MAJOR_LABEL
|
|
8959
8978
|
}, undefined, false, undefined, this),
|
|
8960
8979
|
/* @__PURE__ */ jsxDEV10(Text9, {
|
|
8961
8980
|
color: codeTheme.line,
|
|
@@ -9014,6 +9033,7 @@ function Header({ model, env, sessionCount, skillCount }) {
|
|
|
9014
9033
|
}
|
|
9015
9034
|
var init_Header = __esm(() => {
|
|
9016
9035
|
init_theme();
|
|
9036
|
+
init_productMeta();
|
|
9017
9037
|
});
|
|
9018
9038
|
|
|
9019
9039
|
// src/ui/HistoryBrowser.tsx
|
|
@@ -12265,14 +12285,14 @@ var init_sessionManager = __esm(() => {
|
|
|
12265
12285
|
});
|
|
12266
12286
|
|
|
12267
12287
|
// src/platform/multiAgent.ts
|
|
12268
|
-
import
|
|
12288
|
+
import fs17 from "fs/promises";
|
|
12269
12289
|
import os8 from "os";
|
|
12270
12290
|
import path18 from "path";
|
|
12271
12291
|
import lockfile from "proper-lockfile";
|
|
12272
12292
|
async function withProjectLock(projectDir, fn) {
|
|
12273
|
-
await
|
|
12293
|
+
await fs17.mkdir(LOCK_DIR, { recursive: true });
|
|
12274
12294
|
const lockTarget = path18.join(LOCK_DIR, Buffer.from(projectDir).toString("hex") + ".lock");
|
|
12275
|
-
await
|
|
12295
|
+
await fs17.writeFile(lockTarget, "", { flag: "a" });
|
|
12276
12296
|
const release = await lockfile.lock(lockTarget, { retries: { retries: 3, factor: 1.2, minTimeout: 50 } });
|
|
12277
12297
|
try {
|
|
12278
12298
|
return await fn();
|
|
@@ -12311,7 +12331,7 @@ var init_multiAgent = __esm(() => {
|
|
|
12311
12331
|
});
|
|
12312
12332
|
|
|
12313
12333
|
// src/platform/historyManager.ts
|
|
12314
|
-
import
|
|
12334
|
+
import fs18 from "fs/promises";
|
|
12315
12335
|
import os9 from "os";
|
|
12316
12336
|
import path19 from "path";
|
|
12317
12337
|
function projectHistoryDir(projectHash2) {
|
|
@@ -12322,7 +12342,7 @@ function sessionFile(projectHash2, sessionId) {
|
|
|
12322
12342
|
}
|
|
12323
12343
|
async function appendToHistory(projectHash2, sessionId, sessionName, message) {
|
|
12324
12344
|
const dir2 = projectHistoryDir(projectHash2);
|
|
12325
|
-
await
|
|
12345
|
+
await fs18.mkdir(dir2, { recursive: true });
|
|
12326
12346
|
const entry = {
|
|
12327
12347
|
timestamp: Date.now(),
|
|
12328
12348
|
role: message.role,
|
|
@@ -12330,13 +12350,13 @@ async function appendToHistory(projectHash2, sessionId, sessionName, message) {
|
|
|
12330
12350
|
sessionId,
|
|
12331
12351
|
sessionName
|
|
12332
12352
|
};
|
|
12333
|
-
await
|
|
12353
|
+
await fs18.appendFile(sessionFile(projectHash2, sessionId), JSON.stringify(entry) + `
|
|
12334
12354
|
`, "utf-8");
|
|
12335
12355
|
}
|
|
12336
12356
|
async function readSessionHistory(projectHash2, sessionId) {
|
|
12337
12357
|
const file = sessionFile(projectHash2, sessionId);
|
|
12338
12358
|
try {
|
|
12339
|
-
const raw = await
|
|
12359
|
+
const raw = await fs18.readFile(file, "utf-8");
|
|
12340
12360
|
return raw.split(`
|
|
12341
12361
|
`).filter(Boolean).map((line) => JSON.parse(line));
|
|
12342
12362
|
} catch {
|
|
@@ -12346,7 +12366,7 @@ async function readSessionHistory(projectHash2, sessionId) {
|
|
|
12346
12366
|
async function listProjectSessions(projectHash2) {
|
|
12347
12367
|
const dir2 = projectHistoryDir(projectHash2);
|
|
12348
12368
|
try {
|
|
12349
|
-
const files = await
|
|
12369
|
+
const files = await fs18.readdir(dir2);
|
|
12350
12370
|
const sessions = [];
|
|
12351
12371
|
for (const file of files.filter((f) => f.endsWith(".jsonl"))) {
|
|
12352
12372
|
const sessionId = file.replace(/\.jsonl$/, "");
|
|
@@ -12392,7 +12412,7 @@ var init_historyManager = __esm(() => {
|
|
|
12392
12412
|
});
|
|
12393
12413
|
|
|
12394
12414
|
// src/eval/evals/basic.ts
|
|
12395
|
-
import
|
|
12415
|
+
import fs19 from "fs/promises";
|
|
12396
12416
|
import path20 from "path";
|
|
12397
12417
|
var BASIC_EVAL_TASKS;
|
|
12398
12418
|
var init_basic = __esm(() => {
|
|
@@ -12404,7 +12424,7 @@ var init_basic = __esm(() => {
|
|
|
12404
12424
|
prompt: "Lis le fichier package.json et dis-moi le nom du projet",
|
|
12405
12425
|
expectedOutcome: "Nom du projet lu depuis package.json",
|
|
12406
12426
|
verifier: async (dir2) => {
|
|
12407
|
-
const pkg = JSON.parse(await
|
|
12427
|
+
const pkg = JSON.parse(await fs19.readFile(path20.join(dir2, "package.json"), "utf-8"));
|
|
12408
12428
|
return Boolean(pkg.name);
|
|
12409
12429
|
}
|
|
12410
12430
|
},
|
|
@@ -12416,7 +12436,7 @@ var init_basic = __esm(() => {
|
|
|
12416
12436
|
expectedOutcome: "HELLO.md cree avec le bon contenu",
|
|
12417
12437
|
verifier: async (dir2) => {
|
|
12418
12438
|
try {
|
|
12419
|
-
const content = await
|
|
12439
|
+
const content = await fs19.readFile(path20.join(dir2, "HELLO.md"), "utf-8");
|
|
12420
12440
|
return content.includes("# Hello from Code");
|
|
12421
12441
|
} catch {
|
|
12422
12442
|
return false;
|
|
@@ -12432,7 +12452,7 @@ var init_basic = __esm(() => {
|
|
|
12432
12452
|
expectedOutcome: "src/index.ts contient 'Hello Code'",
|
|
12433
12453
|
verifier: async (dir2) => {
|
|
12434
12454
|
try {
|
|
12435
|
-
const content = await
|
|
12455
|
+
const content = await fs19.readFile(path20.join(dir2, "src/index.ts"), "utf-8");
|
|
12436
12456
|
return content.includes("Hello Code");
|
|
12437
12457
|
} catch {
|
|
12438
12458
|
return false;
|
|
@@ -12443,7 +12463,7 @@ var init_basic = __esm(() => {
|
|
|
12443
12463
|
});
|
|
12444
12464
|
|
|
12445
12465
|
// src/eval/evals/refactor.ts
|
|
12446
|
-
import
|
|
12466
|
+
import fs20 from "fs/promises";
|
|
12447
12467
|
import path21 from "path";
|
|
12448
12468
|
var REFACTOR_EVAL_TASKS;
|
|
12449
12469
|
var init_refactor = __esm(() => {
|
|
@@ -12460,8 +12480,8 @@ var init_refactor = __esm(() => {
|
|
|
12460
12480
|
].join(" && "),
|
|
12461
12481
|
expectedOutcome: "legacyCompute n'existe plus, computeV2 existe et est utilisee",
|
|
12462
12482
|
verifier: async (dir2) => {
|
|
12463
|
-
const a = await
|
|
12464
|
-
const b = await
|
|
12483
|
+
const a = await fs20.readFile(path21.join(dir2, "src/lib/math.ts"), "utf-8");
|
|
12484
|
+
const b = await fs20.readFile(path21.join(dir2, "src/app/main.ts"), "utf-8");
|
|
12465
12485
|
return !a.includes("legacyCompute") && a.includes("computeV2") && b.includes("computeV2");
|
|
12466
12486
|
}
|
|
12467
12487
|
}
|
|
@@ -12469,7 +12489,7 @@ var init_refactor = __esm(() => {
|
|
|
12469
12489
|
});
|
|
12470
12490
|
|
|
12471
12491
|
// src/eval/evals/vision.ts
|
|
12472
|
-
import
|
|
12492
|
+
import fs21 from "fs/promises";
|
|
12473
12493
|
import path22 from "path";
|
|
12474
12494
|
var VISION_EVAL_TASKS;
|
|
12475
12495
|
var init_vision2 = __esm(() => {
|
|
@@ -12481,7 +12501,7 @@ var init_vision2 = __esm(() => {
|
|
|
12481
12501
|
prompt: "Analyse l'image fixtures/ui-button-shifted.png et decris le probleme d'alignement.",
|
|
12482
12502
|
setup: 'mkdir -p fixtures && echo "placeholder" > fixtures/ui-button-shifted.png',
|
|
12483
12503
|
expectedOutcome: "Le pipeline vision est appele sans erreur",
|
|
12484
|
-
verifier: async (dir2) =>
|
|
12504
|
+
verifier: async (dir2) => fs21.access(path22.join(dir2, "fixtures/ui-button-shifted.png")).then(() => true).catch(() => false)
|
|
12485
12505
|
}
|
|
12486
12506
|
];
|
|
12487
12507
|
});
|
|
@@ -12518,7 +12538,7 @@ __export(exports_benchmarkRunner, {
|
|
|
12518
12538
|
generateEvalReport: () => generateEvalReport,
|
|
12519
12539
|
ALL_EVAL_TASKS: () => ALL_EVAL_TASKS
|
|
12520
12540
|
});
|
|
12521
|
-
import
|
|
12541
|
+
import fs22 from "fs/promises";
|
|
12522
12542
|
import path23 from "path";
|
|
12523
12543
|
import os10 from "os";
|
|
12524
12544
|
async function applySetupSegment(segment, cwd) {
|
|
@@ -12528,7 +12548,7 @@ async function applySetupSegment(segment, cwd) {
|
|
|
12528
12548
|
const mkdirMatch = trimmed.match(/^mkdir\s+-p\s+(.+)$/i);
|
|
12529
12549
|
if (mkdirMatch) {
|
|
12530
12550
|
const dirs = mkdirMatch[1].split(/\s+/).map((part) => part.trim().replace(/^["']|["']$/g, "")).filter(Boolean);
|
|
12531
|
-
await Promise.all(dirs.map((dir2) =>
|
|
12551
|
+
await Promise.all(dirs.map((dir2) => fs22.mkdir(path23.resolve(cwd, dir2), { recursive: true })));
|
|
12532
12552
|
return;
|
|
12533
12553
|
}
|
|
12534
12554
|
const echoMatch = trimmed.match(/^echo\s+["']([\s\S]*)["']\s*>\s*(.+)$/i);
|
|
@@ -12536,8 +12556,8 @@ async function applySetupSegment(segment, cwd) {
|
|
|
12536
12556
|
const [, rawContent, rawTarget] = echoMatch;
|
|
12537
12557
|
const target = rawTarget.trim().replace(/^["']|["']$/g, "");
|
|
12538
12558
|
const resolved = path23.resolve(cwd, target);
|
|
12539
|
-
await
|
|
12540
|
-
await
|
|
12559
|
+
await fs22.mkdir(path23.dirname(resolved), { recursive: true });
|
|
12560
|
+
await fs22.writeFile(resolved, rawContent.replace(/\\"/g, '"'), "utf-8");
|
|
12541
12561
|
return;
|
|
12542
12562
|
}
|
|
12543
12563
|
const { bash: bash2 } = await Promise.resolve().then(() => (init_shell(), exports_shell));
|
|
@@ -12550,7 +12570,7 @@ async function runEvalSetup(setup, cwd) {
|
|
|
12550
12570
|
}
|
|
12551
12571
|
}
|
|
12552
12572
|
async function runEvalTask(task, runAgentFn) {
|
|
12553
|
-
const tempDir = await
|
|
12573
|
+
const tempDir = await fs22.mkdtemp(path23.join(os10.tmpdir(), "code-eval-"));
|
|
12554
12574
|
const start = Date.now();
|
|
12555
12575
|
try {
|
|
12556
12576
|
if (task.setup) {
|
|
@@ -12581,7 +12601,7 @@ async function runEvalTask(task, runAgentFn) {
|
|
|
12581
12601
|
error: error instanceof Error ? error.message : String(error)
|
|
12582
12602
|
};
|
|
12583
12603
|
} finally {
|
|
12584
|
-
await
|
|
12604
|
+
await fs22.rm(tempDir, { recursive: true, force: true });
|
|
12585
12605
|
}
|
|
12586
12606
|
}
|
|
12587
12607
|
async function generateEvalReport(results) {
|
|
@@ -12589,7 +12609,7 @@ async function generateEvalReport(results) {
|
|
|
12589
12609
|
const metrics = computeEvalMetrics(results);
|
|
12590
12610
|
let baseline;
|
|
12591
12611
|
try {
|
|
12592
|
-
const prevReport = JSON.parse(await
|
|
12612
|
+
const prevReport = JSON.parse(await fs22.readFile(path23.join(EVALS_DIR, "latest.json"), "utf-8"));
|
|
12593
12613
|
baseline = prevReport.totalScore;
|
|
12594
12614
|
} catch {}
|
|
12595
12615
|
const report = {
|
|
@@ -12601,9 +12621,9 @@ async function generateEvalReport(results) {
|
|
|
12601
12621
|
metrics,
|
|
12602
12622
|
baseline
|
|
12603
12623
|
};
|
|
12604
|
-
await
|
|
12605
|
-
await
|
|
12606
|
-
await
|
|
12624
|
+
await fs22.mkdir(EVALS_DIR, { recursive: true });
|
|
12625
|
+
await fs22.writeFile(path23.join(EVALS_DIR, `eval-${Date.now()}.json`), JSON.stringify(report, null, 2));
|
|
12626
|
+
await fs22.writeFile(path23.join(EVALS_DIR, "latest.json"), JSON.stringify(report, null, 2));
|
|
12607
12627
|
return report;
|
|
12608
12628
|
}
|
|
12609
12629
|
var EVALS_DIR, ALL_EVAL_TASKS;
|
|
@@ -12622,7 +12642,7 @@ __export(exports_App, {
|
|
|
12622
12642
|
});
|
|
12623
12643
|
import { useCallback, useEffect as useEffect4, useRef, useState as useState10 } from "react";
|
|
12624
12644
|
import { Box as Box30, Text as Text30, useApp, useInput as useInput16, useStdin as useStdin6 } from "ink";
|
|
12625
|
-
import
|
|
12645
|
+
import fs23 from "fs/promises";
|
|
12626
12646
|
import path24 from "path";
|
|
12627
12647
|
import { jsxDEV as jsxDEV31 } from "react/jsx-dev-runtime";
|
|
12628
12648
|
function createId(prefix) {
|
|
@@ -13467,10 +13487,10 @@ ${mem.modifiedFiles.slice(-10).join(`
|
|
|
13467
13487
|
const exportSessionId = result.slice("EXPORT_SESSION:".length).trim() || activeSessionId;
|
|
13468
13488
|
const markdown = await exportSessionMarkdown(projectHash2, exportSessionId);
|
|
13469
13489
|
const exportDir = path24.join(process.cwd(), ".code");
|
|
13470
|
-
await
|
|
13490
|
+
await fs23.mkdir(exportDir, { recursive: true });
|
|
13471
13491
|
const fileName = `session-${exportSessionId}-${shortId()}.md`;
|
|
13472
13492
|
const outputPath = path24.join(exportDir, fileName);
|
|
13473
|
-
await
|
|
13493
|
+
await fs23.writeFile(outputPath, markdown, "utf-8");
|
|
13474
13494
|
setMessages((prev) => [...prev, `[SYS] Session exportee: ${outputPath}`]);
|
|
13475
13495
|
return;
|
|
13476
13496
|
}
|
|
@@ -14298,7 +14318,7 @@ init_agent();
|
|
|
14298
14318
|
import { Command } from "commander";
|
|
14299
14319
|
import { createInterface } from "readline";
|
|
14300
14320
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
14301
|
-
import
|
|
14321
|
+
import fs24 from "fs/promises";
|
|
14302
14322
|
import path25 from "path";
|
|
14303
14323
|
|
|
14304
14324
|
// src/core/run-output.ts
|
|
@@ -14340,6 +14360,7 @@ init_logger();
|
|
|
14340
14360
|
// src/core/ciRunner.ts
|
|
14341
14361
|
init_agent();
|
|
14342
14362
|
init_logger();
|
|
14363
|
+
init_productMeta();
|
|
14343
14364
|
import readline from "readline";
|
|
14344
14365
|
async function runCI(task, context, opts = {}) {
|
|
14345
14366
|
const { failOnJudgeBelow = 80 } = opts;
|
|
@@ -14428,7 +14449,7 @@ async function runCI(task, context, opts = {}) {
|
|
|
14428
14449
|
}
|
|
14429
14450
|
async function runInteractive(context) {
|
|
14430
14451
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
14431
|
-
console.log(
|
|
14452
|
+
console.log(`${PRODUCT_SHELL_LABEL} - Mode non-TTY (Ctrl+D pour quitter)`);
|
|
14432
14453
|
const ask = () => {
|
|
14433
14454
|
rl.question(`
|
|
14434
14455
|
> `, async (input) => {
|
|
@@ -14470,13 +14491,14 @@ Au revoir !`);
|
|
|
14470
14491
|
}
|
|
14471
14492
|
|
|
14472
14493
|
// src/index.ts
|
|
14494
|
+
init_productMeta();
|
|
14473
14495
|
var program = new Command;
|
|
14474
14496
|
var VALID_MODELS = ["kimi", "mistral", "gemini-fast"];
|
|
14475
14497
|
function ensureApiKey() {
|
|
14476
14498
|
const apiKey = settings.getApiKey();
|
|
14477
14499
|
if (!apiKey || !apiKey.startsWith("pk_") && !apiKey.startsWith("sk_")) {
|
|
14478
14500
|
console.log([
|
|
14479
|
-
|
|
14501
|
+
`${PRODUCT_SHELL_LABEL} | OAL SARL`,
|
|
14480
14502
|
"",
|
|
14481
14503
|
"Cle API Pollinations manquante ou invalide.",
|
|
14482
14504
|
"1. https://enter.pollinations.ai",
|
|
@@ -14526,7 +14548,7 @@ async function tryOfflineTask(task, cwd) {
|
|
|
14526
14548
|
if (!requested)
|
|
14527
14549
|
return null;
|
|
14528
14550
|
const resolved = path25.resolve(cwd, requested);
|
|
14529
|
-
return
|
|
14551
|
+
return fs24.readFile(resolved, "utf-8");
|
|
14530
14552
|
}
|
|
14531
14553
|
async function resolveVisionSource() {
|
|
14532
14554
|
const current = settings.get("visionModel");
|
|
@@ -14550,7 +14572,7 @@ async function bootstrapContext(apiKey, taskForSkills = "") {
|
|
|
14550
14572
|
ctx.activeSkills = activeSkills;
|
|
14551
14573
|
return { config, env, memory, projectFiles, allSkills, ctx, platformDiagnostics };
|
|
14552
14574
|
}
|
|
14553
|
-
program.name("oal-code").description(
|
|
14575
|
+
program.name("oal-code").description(`${PRODUCT_SHELL_LABEL} Augmented | OAL SARL | Vision embarquee | Transactions | Judge`).version(PRODUCT_VERSION);
|
|
14554
14576
|
async function startChat(opts) {
|
|
14555
14577
|
const useInkUi = shouldUseInkUi();
|
|
14556
14578
|
const setupRequired = opts.setup || opts.config || !settings.isSetupCurrent() || !hasValidApiKey();
|
|
@@ -14602,7 +14624,7 @@ async function startChat(opts) {
|
|
|
14602
14624
|
${loaded.rawContent}` : `Projet: ${env.projectName} (${env.fileCount} fichiers, ${env.language}, ${env.framework ?? "framework non detecte"})`;
|
|
14603
14625
|
const startupNotice = buildStartupDiagnosticsNotice(platformDiagnostics);
|
|
14604
14626
|
if (!useInkUi) {
|
|
14605
|
-
console.log(
|
|
14627
|
+
console.log(`${PRODUCT_SHELL_LABEL} | OAL SARL | model:${settings.getDefaultModel()} | files:${env.fileCount} | skills:${allSkills.length}${memory ? " | memoire" : ""}`);
|
|
14606
14628
|
if (startupNotice) {
|
|
14607
14629
|
console.log(startupNotice);
|
|
14608
14630
|
}
|
|
@@ -14806,7 +14828,7 @@ program.command("run <task>").description("Executer une tache unique et quitter
|
|
|
14806
14828
|
});
|
|
14807
14829
|
program.command("eval").description("Gerer les benchmarks").command("run").option("--tasks <ids>", "IDs de taches separes par des virgules").action(async (opts) => {
|
|
14808
14830
|
const { ALL_EVAL_TASKS: ALL_EVAL_TASKS2, runEvalTask: runEvalTask2, generateEvalReport: generateEvalReport2 } = await Promise.resolve().then(() => (init_benchmarkRunner(), exports_benchmarkRunner));
|
|
14809
|
-
const
|
|
14831
|
+
const fs25 = await import("fs/promises");
|
|
14810
14832
|
const path26 = await import("path");
|
|
14811
14833
|
const selectedIds = opts.tasks?.split(",").map((item) => item.trim()).filter(Boolean) ?? [];
|
|
14812
14834
|
const tasks = selectedIds.length > 0 ? ALL_EVAL_TASKS2.filter((task) => selectedIds.includes(task.id)) : ALL_EVAL_TASKS2;
|
|
@@ -14821,25 +14843,25 @@ program.command("eval").description("Gerer les benchmarks").command("run").optio
|
|
|
14821
14843
|
const pkgPath = path26.join(projectDir, "package.json");
|
|
14822
14844
|
let pkg;
|
|
14823
14845
|
try {
|
|
14824
|
-
pkg = JSON.parse(await
|
|
14846
|
+
pkg = JSON.parse(await fs25.readFile(pkgPath, "utf-8"));
|
|
14825
14847
|
} catch {
|
|
14826
14848
|
pkg = { name: "code-eval-project", version: "1.0.0" };
|
|
14827
|
-
await
|
|
14849
|
+
await fs25.writeFile(pkgPath, JSON.stringify(pkg, null, 2), "utf-8");
|
|
14828
14850
|
toolCount += 1;
|
|
14829
14851
|
}
|
|
14830
14852
|
response = `Project name: ${String(pkg.name ?? "unknown")}`;
|
|
14831
14853
|
toolCount += 1;
|
|
14832
14854
|
}
|
|
14833
14855
|
if (/HELLO\.md/i.test(prompt)) {
|
|
14834
|
-
await
|
|
14856
|
+
await fs25.writeFile(path26.join(projectDir, "HELLO.md"), `# Hello from Code
|
|
14835
14857
|
`, "utf-8");
|
|
14836
14858
|
response = "HELLO.md created";
|
|
14837
14859
|
toolCount += 1;
|
|
14838
14860
|
}
|
|
14839
14861
|
if (/Hello World/i.test(prompt) && /Hello Code/i.test(prompt)) {
|
|
14840
14862
|
const indexPath = path26.join(projectDir, "src", "index.ts");
|
|
14841
|
-
const content = await
|
|
14842
|
-
await
|
|
14863
|
+
const content = await fs25.readFile(indexPath, "utf-8");
|
|
14864
|
+
await fs25.writeFile(indexPath, content.replace(/Hello World/g, "Hello Code"), "utf-8");
|
|
14843
14865
|
response = "src/index.ts updated";
|
|
14844
14866
|
toolCount += 2;
|
|
14845
14867
|
}
|
|
@@ -14847,12 +14869,12 @@ program.command("eval").description("Gerer les benchmarks").command("run").optio
|
|
|
14847
14869
|
const mathPath = path26.join(projectDir, "src", "lib", "math.ts");
|
|
14848
14870
|
const mainPath = path26.join(projectDir, "src", "app", "main.ts");
|
|
14849
14871
|
const [mathContent, mainContent] = await Promise.all([
|
|
14850
|
-
|
|
14851
|
-
|
|
14872
|
+
fs25.readFile(mathPath, "utf-8"),
|
|
14873
|
+
fs25.readFile(mainPath, "utf-8")
|
|
14852
14874
|
]);
|
|
14853
14875
|
await Promise.all([
|
|
14854
|
-
|
|
14855
|
-
|
|
14876
|
+
fs25.writeFile(mathPath, mathContent.replace(/legacyCompute/g, "computeV2"), "utf-8"),
|
|
14877
|
+
fs25.writeFile(mainPath, mainContent.replace(/legacyCompute/g, "computeV2"), "utf-8")
|
|
14856
14878
|
]);
|
|
14857
14879
|
response = "Symbol renamed in math.ts and main.ts";
|
|
14858
14880
|
toolCount += 2;
|