evil-omo 3.16.0 → 3.16.1
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/LICENSE.md +82 -82
- package/README.ja.md +353 -353
- package/README.ko.md +347 -347
- package/README.md +51 -51
- package/README.ru.md +374 -374
- package/README.zh-cn.md +352 -352
- package/bin/evil-omo.js +201 -201
- package/bin/platform.d.ts +14 -14
- package/bin/platform.js +82 -82
- package/bin/platform.test.ts +218 -218
- package/dist/cli/index.js +103 -914
- package/dist/index.js +122 -325
- package/package.json +1 -1
- package/postinstall.mjs +133 -133
package/dist/index.js
CHANGED
|
@@ -11914,12 +11914,12 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
11914
11914
|
throw new Error(`Unknown format "${name}"`);
|
|
11915
11915
|
return f;
|
|
11916
11916
|
};
|
|
11917
|
-
function addFormats(ajv, list,
|
|
11917
|
+
function addFormats(ajv, list, fs18, exportName) {
|
|
11918
11918
|
var _a2;
|
|
11919
11919
|
var _b;
|
|
11920
11920
|
(_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== undefined || (_b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);
|
|
11921
11921
|
for (const f of list)
|
|
11922
|
-
ajv.addFormat(f,
|
|
11922
|
+
ajv.addFormat(f, fs18[f]);
|
|
11923
11923
|
}
|
|
11924
11924
|
module.exports = exports = formatsPlugin;
|
|
11925
11925
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -11930,7 +11930,7 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
11930
11930
|
var require_windows = __commonJS((exports, module) => {
|
|
11931
11931
|
module.exports = isexe;
|
|
11932
11932
|
isexe.sync = sync;
|
|
11933
|
-
var
|
|
11933
|
+
var fs18 = __require("fs");
|
|
11934
11934
|
function checkPathExt(path13, options) {
|
|
11935
11935
|
var pathext = options.pathExt !== undefined ? options.pathExt : process.env.PATHEXT;
|
|
11936
11936
|
if (!pathext) {
|
|
@@ -11955,12 +11955,12 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
11955
11955
|
return checkPathExt(path13, options);
|
|
11956
11956
|
}
|
|
11957
11957
|
function isexe(path13, options, cb) {
|
|
11958
|
-
|
|
11958
|
+
fs18.stat(path13, function(er, stat2) {
|
|
11959
11959
|
cb(er, er ? false : checkStat(stat2, path13, options));
|
|
11960
11960
|
});
|
|
11961
11961
|
}
|
|
11962
11962
|
function sync(path13, options) {
|
|
11963
|
-
return checkStat(
|
|
11963
|
+
return checkStat(fs18.statSync(path13), path13, options);
|
|
11964
11964
|
}
|
|
11965
11965
|
});
|
|
11966
11966
|
|
|
@@ -11968,14 +11968,14 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
11968
11968
|
var require_mode = __commonJS((exports, module) => {
|
|
11969
11969
|
module.exports = isexe;
|
|
11970
11970
|
isexe.sync = sync;
|
|
11971
|
-
var
|
|
11971
|
+
var fs18 = __require("fs");
|
|
11972
11972
|
function isexe(path13, options, cb) {
|
|
11973
|
-
|
|
11973
|
+
fs18.stat(path13, function(er, stat2) {
|
|
11974
11974
|
cb(er, er ? false : checkStat(stat2, options));
|
|
11975
11975
|
});
|
|
11976
11976
|
}
|
|
11977
11977
|
function sync(path13, options) {
|
|
11978
|
-
return checkStat(
|
|
11978
|
+
return checkStat(fs18.statSync(path13), options);
|
|
11979
11979
|
}
|
|
11980
11980
|
function checkStat(stat2, options) {
|
|
11981
11981
|
return stat2.isFile() && checkMode(stat2, options);
|
|
@@ -11997,7 +11997,7 @@ var require_mode = __commonJS((exports, module) => {
|
|
|
11997
11997
|
|
|
11998
11998
|
// node_modules/isexe/index.js
|
|
11999
11999
|
var require_isexe = __commonJS((exports, module) => {
|
|
12000
|
-
var
|
|
12000
|
+
var fs18 = __require("fs");
|
|
12001
12001
|
var core4;
|
|
12002
12002
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
12003
12003
|
core4 = require_windows();
|
|
@@ -12236,16 +12236,16 @@ var require_shebang_command = __commonJS((exports, module) => {
|
|
|
12236
12236
|
|
|
12237
12237
|
// node_modules/cross-spawn/lib/util/readShebang.js
|
|
12238
12238
|
var require_readShebang = __commonJS((exports, module) => {
|
|
12239
|
-
var
|
|
12239
|
+
var fs18 = __require("fs");
|
|
12240
12240
|
var shebangCommand = require_shebang_command();
|
|
12241
12241
|
function readShebang(command) {
|
|
12242
12242
|
const size = 150;
|
|
12243
12243
|
const buffer2 = Buffer.alloc(size);
|
|
12244
12244
|
let fd;
|
|
12245
12245
|
try {
|
|
12246
|
-
fd =
|
|
12247
|
-
|
|
12248
|
-
|
|
12246
|
+
fd = fs18.openSync(command, "r");
|
|
12247
|
+
fs18.readSync(fd, buffer2, 0, size, 0);
|
|
12248
|
+
fs18.closeSync(fd);
|
|
12249
12249
|
} catch (e) {}
|
|
12250
12250
|
return shebangCommand(buffer2.toString());
|
|
12251
12251
|
}
|
|
@@ -17241,210 +17241,8 @@ var BUILTIN_AGENT_NAMES = new Set([
|
|
|
17241
17241
|
"atlas",
|
|
17242
17242
|
"build"
|
|
17243
17243
|
]);
|
|
17244
|
-
function migrateAgentNames(agents) {
|
|
17245
|
-
const migrated = {};
|
|
17246
|
-
let changed = false;
|
|
17247
|
-
for (const [key, value] of Object.entries(agents)) {
|
|
17248
|
-
const newKey = AGENT_NAME_MAP[key.toLowerCase()] ?? AGENT_NAME_MAP[key] ?? key;
|
|
17249
|
-
if (newKey !== key) {
|
|
17250
|
-
changed = true;
|
|
17251
|
-
}
|
|
17252
|
-
migrated[newKey] = value;
|
|
17253
|
-
}
|
|
17254
|
-
return { migrated, changed };
|
|
17255
|
-
}
|
|
17256
|
-
// src/shared/migration/hook-names.ts
|
|
17257
|
-
var HOOK_NAME_MAP = {
|
|
17258
|
-
"anthropic-auto-compact": "anthropic-context-window-limit-recovery",
|
|
17259
|
-
"sisyphus-orchestrator": "atlas",
|
|
17260
|
-
"sisyphus-gpt-hephaestus-reminder": "no-sisyphus-gpt",
|
|
17261
|
-
"empty-message-sanitizer": null,
|
|
17262
|
-
"delegate-task-english-directive": null,
|
|
17263
|
-
"gpt-permission-continuation": null
|
|
17264
|
-
};
|
|
17265
|
-
function migrateHookNames(hooks) {
|
|
17266
|
-
const migrated = [];
|
|
17267
|
-
const removed = [];
|
|
17268
|
-
let changed = false;
|
|
17269
|
-
for (const hook of hooks) {
|
|
17270
|
-
const mapping = HOOK_NAME_MAP[hook];
|
|
17271
|
-
if (mapping === null) {
|
|
17272
|
-
removed.push(hook);
|
|
17273
|
-
changed = true;
|
|
17274
|
-
continue;
|
|
17275
|
-
}
|
|
17276
|
-
const newHook = mapping ?? hook;
|
|
17277
|
-
if (newHook !== hook) {
|
|
17278
|
-
changed = true;
|
|
17279
|
-
}
|
|
17280
|
-
migrated.push(newHook);
|
|
17281
|
-
}
|
|
17282
|
-
return { migrated, changed, removed };
|
|
17283
|
-
}
|
|
17284
|
-
// src/shared/migration/model-versions.ts
|
|
17285
|
-
var MODEL_VERSION_MAP = {
|
|
17286
|
-
"anthropic/claude-opus-4-5": "anthropic/claude-opus-4-6",
|
|
17287
|
-
"anthropic/claude-sonnet-4-5": "anthropic/claude-sonnet-4-6",
|
|
17288
|
-
"openai/gpt-5.3-codex": "openai/gpt-5.4"
|
|
17289
|
-
};
|
|
17290
|
-
function migrationKey(oldModel, newModel) {
|
|
17291
|
-
return `model-version:${oldModel}->${newModel}`;
|
|
17292
|
-
}
|
|
17293
|
-
function migrateModelVersions(configs, appliedMigrations) {
|
|
17294
|
-
const migrated = {};
|
|
17295
|
-
let changed = false;
|
|
17296
|
-
const newMigrations = [];
|
|
17297
|
-
for (const [key, value] of Object.entries(configs)) {
|
|
17298
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
17299
|
-
const config = value;
|
|
17300
|
-
if (typeof config.model === "string" && MODEL_VERSION_MAP[config.model]) {
|
|
17301
|
-
const oldModel = config.model;
|
|
17302
|
-
const newModel = MODEL_VERSION_MAP[oldModel];
|
|
17303
|
-
const mKey = migrationKey(oldModel, newModel);
|
|
17304
|
-
if (appliedMigrations?.has(mKey)) {
|
|
17305
|
-
migrated[key] = value;
|
|
17306
|
-
continue;
|
|
17307
|
-
}
|
|
17308
|
-
migrated[key] = { ...config, model: newModel };
|
|
17309
|
-
changed = true;
|
|
17310
|
-
newMigrations.push(mKey);
|
|
17311
|
-
continue;
|
|
17312
|
-
}
|
|
17313
|
-
}
|
|
17314
|
-
migrated[key] = value;
|
|
17315
|
-
}
|
|
17316
|
-
return { migrated, changed, newMigrations };
|
|
17317
|
-
}
|
|
17318
17244
|
// src/shared/migration/config-migration.ts
|
|
17319
17245
|
init_logger();
|
|
17320
|
-
import * as fs3 from "fs";
|
|
17321
|
-
|
|
17322
|
-
// src/shared/write-file-atomically.ts
|
|
17323
|
-
import { closeSync, fsyncSync, openSync, renameSync, writeFileSync } from "fs";
|
|
17324
|
-
function writeFileAtomically(filePath, content) {
|
|
17325
|
-
const tempPath = `${filePath}.tmp`;
|
|
17326
|
-
writeFileSync(tempPath, content, "utf-8");
|
|
17327
|
-
const tempFileDescriptor = openSync(tempPath, "r");
|
|
17328
|
-
try {
|
|
17329
|
-
fsyncSync(tempFileDescriptor);
|
|
17330
|
-
} finally {
|
|
17331
|
-
closeSync(tempFileDescriptor);
|
|
17332
|
-
}
|
|
17333
|
-
renameSync(tempPath, filePath);
|
|
17334
|
-
}
|
|
17335
|
-
|
|
17336
|
-
// src/shared/migration/config-migration.ts
|
|
17337
|
-
function migrateConfigFile(configPath, rawConfig) {
|
|
17338
|
-
const copy = structuredClone(rawConfig);
|
|
17339
|
-
let needsWrite = false;
|
|
17340
|
-
const existingMigrations = Array.isArray(copy._migrations) ? new Set(copy._migrations) : new Set;
|
|
17341
|
-
const allNewMigrations = [];
|
|
17342
|
-
if (copy.agents && typeof copy.agents === "object") {
|
|
17343
|
-
const { migrated, changed } = migrateAgentNames(copy.agents);
|
|
17344
|
-
if (changed) {
|
|
17345
|
-
copy.agents = migrated;
|
|
17346
|
-
needsWrite = true;
|
|
17347
|
-
}
|
|
17348
|
-
}
|
|
17349
|
-
if (copy.agents && typeof copy.agents === "object") {
|
|
17350
|
-
const { migrated, changed, newMigrations } = migrateModelVersions(copy.agents, existingMigrations);
|
|
17351
|
-
if (changed) {
|
|
17352
|
-
copy.agents = migrated;
|
|
17353
|
-
needsWrite = true;
|
|
17354
|
-
log("Migrated model versions in agents config");
|
|
17355
|
-
}
|
|
17356
|
-
allNewMigrations.push(...newMigrations);
|
|
17357
|
-
}
|
|
17358
|
-
if (copy.categories && typeof copy.categories === "object") {
|
|
17359
|
-
const { migrated, changed, newMigrations } = migrateModelVersions(copy.categories, existingMigrations);
|
|
17360
|
-
if (changed) {
|
|
17361
|
-
copy.categories = migrated;
|
|
17362
|
-
needsWrite = true;
|
|
17363
|
-
log("Migrated model versions in categories config");
|
|
17364
|
-
}
|
|
17365
|
-
allNewMigrations.push(...newMigrations);
|
|
17366
|
-
}
|
|
17367
|
-
if (allNewMigrations.length > 0) {
|
|
17368
|
-
const updatedMigrations = Array.from(existingMigrations);
|
|
17369
|
-
updatedMigrations.push(...allNewMigrations);
|
|
17370
|
-
copy._migrations = updatedMigrations;
|
|
17371
|
-
needsWrite = true;
|
|
17372
|
-
}
|
|
17373
|
-
if (copy.omo_agent) {
|
|
17374
|
-
copy.sisyphus_agent = copy.omo_agent;
|
|
17375
|
-
delete copy.omo_agent;
|
|
17376
|
-
needsWrite = true;
|
|
17377
|
-
}
|
|
17378
|
-
if (copy.experimental && typeof copy.experimental === "object") {
|
|
17379
|
-
const experimental = copy.experimental;
|
|
17380
|
-
if ("hashline_edit" in experimental) {
|
|
17381
|
-
if (copy.hashline_edit === undefined) {
|
|
17382
|
-
copy.hashline_edit = experimental.hashline_edit;
|
|
17383
|
-
}
|
|
17384
|
-
delete experimental.hashline_edit;
|
|
17385
|
-
if (Object.keys(experimental).length === 0) {
|
|
17386
|
-
delete copy.experimental;
|
|
17387
|
-
}
|
|
17388
|
-
needsWrite = true;
|
|
17389
|
-
}
|
|
17390
|
-
}
|
|
17391
|
-
if (copy.disabled_agents && Array.isArray(copy.disabled_agents)) {
|
|
17392
|
-
const migrated = [];
|
|
17393
|
-
let changed = false;
|
|
17394
|
-
for (const agent of copy.disabled_agents) {
|
|
17395
|
-
const newAgent = AGENT_NAME_MAP[agent.toLowerCase()] ?? AGENT_NAME_MAP[agent] ?? agent;
|
|
17396
|
-
if (newAgent !== agent) {
|
|
17397
|
-
changed = true;
|
|
17398
|
-
}
|
|
17399
|
-
migrated.push(newAgent);
|
|
17400
|
-
}
|
|
17401
|
-
if (changed) {
|
|
17402
|
-
copy.disabled_agents = migrated;
|
|
17403
|
-
needsWrite = true;
|
|
17404
|
-
}
|
|
17405
|
-
}
|
|
17406
|
-
if (copy.disabled_hooks && Array.isArray(copy.disabled_hooks)) {
|
|
17407
|
-
const { migrated, changed, removed } = migrateHookNames(copy.disabled_hooks);
|
|
17408
|
-
if (changed) {
|
|
17409
|
-
copy.disabled_hooks = migrated;
|
|
17410
|
-
needsWrite = true;
|
|
17411
|
-
}
|
|
17412
|
-
if (removed.length > 0) {
|
|
17413
|
-
log(`Removed obsolete hooks from disabled_hooks: ${removed.join(", ")} (these hooks no longer exist in v3.0.0)`);
|
|
17414
|
-
}
|
|
17415
|
-
}
|
|
17416
|
-
if (needsWrite) {
|
|
17417
|
-
const timestamp2 = new Date().toISOString().replace(/[:.]/g, "-");
|
|
17418
|
-
const backupPath = `${configPath}.bak.${timestamp2}`;
|
|
17419
|
-
let backupSucceeded = false;
|
|
17420
|
-
try {
|
|
17421
|
-
fs3.copyFileSync(configPath, backupPath);
|
|
17422
|
-
backupSucceeded = true;
|
|
17423
|
-
} catch {
|
|
17424
|
-
backupSucceeded = false;
|
|
17425
|
-
}
|
|
17426
|
-
let writeSucceeded = false;
|
|
17427
|
-
try {
|
|
17428
|
-
writeFileAtomically(configPath, JSON.stringify(copy, null, 2) + `
|
|
17429
|
-
`);
|
|
17430
|
-
writeSucceeded = true;
|
|
17431
|
-
} catch (err) {
|
|
17432
|
-
log(`Failed to write migrated config to ${configPath}:`, err);
|
|
17433
|
-
}
|
|
17434
|
-
for (const key of Object.keys(rawConfig)) {
|
|
17435
|
-
delete rawConfig[key];
|
|
17436
|
-
}
|
|
17437
|
-
Object.assign(rawConfig, copy);
|
|
17438
|
-
if (writeSucceeded) {
|
|
17439
|
-
const backupMessage = backupSucceeded ? ` (backup: ${backupPath})` : "";
|
|
17440
|
-
log(`Migrated config file: ${configPath}${backupMessage}`);
|
|
17441
|
-
} else {
|
|
17442
|
-
const backupMessage = backupSucceeded ? ` (backup: ${backupPath})` : "";
|
|
17443
|
-
log(`Applied migrated config in-memory for: ${configPath}${backupMessage}`);
|
|
17444
|
-
}
|
|
17445
|
-
}
|
|
17446
|
-
return needsWrite;
|
|
17447
|
-
}
|
|
17448
17246
|
// src/shared/opencode-config-dir.ts
|
|
17449
17247
|
import { existsSync as existsSync5, realpathSync as realpathSync3 } from "fs";
|
|
17450
17248
|
import { homedir as homedir4 } from "os";
|
|
@@ -17635,7 +17433,7 @@ function migrateAgentConfig(config) {
|
|
|
17635
17433
|
}
|
|
17636
17434
|
// src/shared/external-plugin-detector.ts
|
|
17637
17435
|
init_logger();
|
|
17638
|
-
import * as
|
|
17436
|
+
import * as fs3 from "fs";
|
|
17639
17437
|
import * as path3 from "path";
|
|
17640
17438
|
import * as os3 from "os";
|
|
17641
17439
|
var KNOWN_NOTIFICATION_PLUGINS = [
|
|
@@ -17672,9 +17470,9 @@ function loadOpencodePlugins(directory) {
|
|
|
17672
17470
|
const seenPluginEntries = new Set;
|
|
17673
17471
|
for (const configPath of getConfigPaths(directory)) {
|
|
17674
17472
|
try {
|
|
17675
|
-
if (!
|
|
17473
|
+
if (!fs3.existsSync(configPath))
|
|
17676
17474
|
continue;
|
|
17677
|
-
const content =
|
|
17475
|
+
const content = fs3.readFileSync(configPath, "utf-8");
|
|
17678
17476
|
const result = parseJsoncSafe(content);
|
|
17679
17477
|
const plugins = result.data?.plugin ?? [];
|
|
17680
17478
|
for (const rawPlugin of plugins) {
|
|
@@ -18770,7 +18568,7 @@ init_logger();
|
|
|
18770
18568
|
|
|
18771
18569
|
// src/shared/json-file-cache-store.ts
|
|
18772
18570
|
init_logger();
|
|
18773
|
-
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync
|
|
18571
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync } from "fs";
|
|
18774
18572
|
import { join as join11 } from "path";
|
|
18775
18573
|
function toLogLabel(cacheLabel) {
|
|
18776
18574
|
return cacheLabel.toLowerCase();
|
|
@@ -18817,7 +18615,7 @@ function createJsonFileCacheStore(options) {
|
|
|
18817
18615
|
ensureCacheDir2();
|
|
18818
18616
|
const cacheFile = getCacheFilePath();
|
|
18819
18617
|
try {
|
|
18820
|
-
|
|
18618
|
+
writeFileSync(cacheFile, options.serialize?.(value) ?? JSON.stringify(value, null, 2));
|
|
18821
18619
|
memoryValue = value;
|
|
18822
18620
|
log(`[${options.logPrefix}] ${options.cacheLabel} written`, options.describe(value));
|
|
18823
18621
|
} catch (error) {
|
|
@@ -60783,7 +60581,7 @@ function isAnyProviderConnected(providers, availableModels) {
|
|
|
60783
60581
|
return false;
|
|
60784
60582
|
}
|
|
60785
60583
|
// src/features/hook-message-injector/injector.ts
|
|
60786
|
-
import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync7, readdirSync as readdirSync2, writeFileSync as
|
|
60584
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync7, readdirSync as readdirSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
60787
60585
|
import { randomBytes } from "crypto";
|
|
60788
60586
|
import { join as join15 } from "path";
|
|
60789
60587
|
init_logger();
|
|
@@ -63232,7 +63030,7 @@ function checkForLegacyPluginEntry(overrideConfigDir) {
|
|
|
63232
63030
|
init_logger();
|
|
63233
63031
|
|
|
63234
63032
|
// src/shared/migrate-legacy-plugin-entry.ts
|
|
63235
|
-
import { closeSync
|
|
63033
|
+
import { closeSync, existsSync as existsSync22, fsyncSync, openSync, readFileSync as readFileSync15, renameSync, writeFileSync as writeFileSync3 } from "fs";
|
|
63236
63034
|
init_logger();
|
|
63237
63035
|
|
|
63238
63036
|
// src/shared/plugin-entry-migrator.ts
|
|
@@ -63291,14 +63089,14 @@ function migrateLegacyPluginEntry(configPath) {
|
|
|
63291
63089
|
if (!updated || updated === content)
|
|
63292
63090
|
return false;
|
|
63293
63091
|
const tempPath = `${configPath}.tmp`;
|
|
63294
|
-
|
|
63295
|
-
const tempFileDescriptor =
|
|
63092
|
+
writeFileSync3(tempPath, updated, "utf-8");
|
|
63093
|
+
const tempFileDescriptor = openSync(tempPath, "r");
|
|
63296
63094
|
try {
|
|
63297
|
-
|
|
63095
|
+
fsyncSync(tempFileDescriptor);
|
|
63298
63096
|
} finally {
|
|
63299
|
-
|
|
63097
|
+
closeSync(tempFileDescriptor);
|
|
63300
63098
|
}
|
|
63301
|
-
|
|
63099
|
+
renameSync(tempPath, configPath);
|
|
63302
63100
|
log("[migrateLegacyPluginEntry] Auto-migrated opencode.json plugin entry", {
|
|
63303
63101
|
configPath,
|
|
63304
63102
|
from: LEGACY_PLUGIN_NAME,
|
|
@@ -63371,7 +63169,7 @@ var FAILURE_RESET_WINDOW_MS = 5 * 60 * 1000;
|
|
|
63371
63169
|
// src/features/run-continuation-state/constants.ts
|
|
63372
63170
|
var CONTINUATION_MARKER_DIR = ".sisyphus/run-continuation";
|
|
63373
63171
|
// src/features/run-continuation-state/storage.ts
|
|
63374
|
-
import { existsSync as existsSync23, mkdirSync as mkdirSync5, readFileSync as readFileSync16, rmSync, writeFileSync as
|
|
63172
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync5, readFileSync as readFileSync16, rmSync, writeFileSync as writeFileSync4 } from "fs";
|
|
63375
63173
|
import { join as join26 } from "path";
|
|
63376
63174
|
function getMarkerPath(directory, sessionID) {
|
|
63377
63175
|
return join26(directory, CONTINUATION_MARKER_DIR, `${sessionID}.json`);
|
|
@@ -63407,7 +63205,7 @@ function setContinuationMarkerSource(directory, sessionID, source, state, reason
|
|
|
63407
63205
|
};
|
|
63408
63206
|
const markerPath = getMarkerPath(directory, sessionID);
|
|
63409
63207
|
mkdirSync5(join26(directory, CONTINUATION_MARKER_DIR), { recursive: true });
|
|
63410
|
-
|
|
63208
|
+
writeFileSync4(markerPath, JSON.stringify(next, null, 2), "utf-8");
|
|
63411
63209
|
return next;
|
|
63412
63210
|
}
|
|
63413
63211
|
function clearContinuationMarker(directory, sessionID) {
|
|
@@ -65329,7 +65127,7 @@ function messageHasContent(messageID) {
|
|
|
65329
65127
|
return parts.some(hasContent);
|
|
65330
65128
|
}
|
|
65331
65129
|
// src/hooks/session-recovery/storage/text-part-injector.ts
|
|
65332
|
-
import { existsSync as existsSync26, mkdirSync as mkdirSync6, writeFileSync as
|
|
65130
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync6, writeFileSync as writeFileSync5 } from "fs";
|
|
65333
65131
|
import { join as join29 } from "path";
|
|
65334
65132
|
function injectTextPart(sessionID, messageID, text) {
|
|
65335
65133
|
if (isSqliteBackend()) {
|
|
@@ -65350,7 +65148,7 @@ function injectTextPart(sessionID, messageID, text) {
|
|
|
65350
65148
|
synthetic: true
|
|
65351
65149
|
};
|
|
65352
65150
|
try {
|
|
65353
|
-
|
|
65151
|
+
writeFileSync5(join29(partDir, `${partId}.json`), JSON.stringify(part, null, 2));
|
|
65354
65152
|
return true;
|
|
65355
65153
|
} catch {
|
|
65356
65154
|
return false;
|
|
@@ -65407,7 +65205,7 @@ function findEmptyMessageByIndex(sessionID, targetIndex) {
|
|
|
65407
65205
|
return null;
|
|
65408
65206
|
}
|
|
65409
65207
|
// src/hooks/session-recovery/storage/empty-text.ts
|
|
65410
|
-
import { existsSync as existsSync27, readdirSync as readdirSync9, readFileSync as readFileSync19, writeFileSync as
|
|
65208
|
+
import { existsSync as existsSync27, readdirSync as readdirSync9, readFileSync as readFileSync19, writeFileSync as writeFileSync6 } from "fs";
|
|
65411
65209
|
import { join as join30 } from "path";
|
|
65412
65210
|
function replaceEmptyTextParts(messageID, replacementText) {
|
|
65413
65211
|
if (isSqliteBackend()) {
|
|
@@ -65430,7 +65228,7 @@ function replaceEmptyTextParts(messageID, replacementText) {
|
|
|
65430
65228
|
if (!textPart.text?.trim()) {
|
|
65431
65229
|
textPart.text = replacementText;
|
|
65432
65230
|
textPart.synthetic = true;
|
|
65433
|
-
|
|
65231
|
+
writeFileSync6(filePath, JSON.stringify(textPart, null, 2));
|
|
65434
65232
|
anyReplaced = true;
|
|
65435
65233
|
}
|
|
65436
65234
|
}
|
|
@@ -65549,7 +65347,7 @@ function findMessageByIndexNeedingThinking(sessionID, targetIndex) {
|
|
|
65549
65347
|
return firstIsThinking ? null : targetMessage.id;
|
|
65550
65348
|
}
|
|
65551
65349
|
// src/hooks/session-recovery/storage/thinking-prepend.ts
|
|
65552
|
-
import { existsSync as existsSync28, mkdirSync as mkdirSync7, writeFileSync as
|
|
65350
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync7, writeFileSync as writeFileSync7 } from "fs";
|
|
65553
65351
|
import { join as join31 } from "path";
|
|
65554
65352
|
var thinkingPrependDeps = {
|
|
65555
65353
|
isSqliteBackend,
|
|
@@ -65637,7 +65435,7 @@ function prependThinkingPart(sessionID, messageID, deps = thinkingPrependDeps) {
|
|
|
65637
65435
|
mkdirSync7(partDir, { recursive: true });
|
|
65638
65436
|
}
|
|
65639
65437
|
try {
|
|
65640
|
-
|
|
65438
|
+
writeFileSync7(join31(partDir, `${previousThinkingPart.id}.json`), JSON.stringify(previousThinkingPart, null, 2));
|
|
65641
65439
|
return true;
|
|
65642
65440
|
} catch {
|
|
65643
65441
|
return false;
|
|
@@ -79712,7 +79510,7 @@ var {spawn: spawn16 } = globalThis.Bun;
|
|
|
79712
79510
|
import { createRequire as createRequire2 } from "module";
|
|
79713
79511
|
import { dirname as dirname5, join as join34 } from "path";
|
|
79714
79512
|
import { existsSync as existsSync31 } from "fs";
|
|
79715
|
-
import * as
|
|
79513
|
+
import * as fs4 from "fs";
|
|
79716
79514
|
import { tmpdir as tmpdir4 } from "os";
|
|
79717
79515
|
|
|
79718
79516
|
// src/hooks/comment-checker/downloader.ts
|
|
@@ -79822,7 +79620,7 @@ function debugLog2(...args) {
|
|
|
79822
79620
|
if (DEBUG2) {
|
|
79823
79621
|
const msg = `[${new Date().toISOString()}] [comment-checker:cli] ${args.map((a) => typeof a === "object" ? JSON.stringify(a, null, 2) : String(a)).join(" ")}
|
|
79824
79622
|
`;
|
|
79825
|
-
|
|
79623
|
+
fs4.appendFileSync(DEBUG_FILE2, msg);
|
|
79826
79624
|
}
|
|
79827
79625
|
}
|
|
79828
79626
|
function getBinaryName2() {
|
|
@@ -80105,7 +79903,7 @@ function takePendingCall(callID) {
|
|
|
80105
79903
|
}
|
|
80106
79904
|
|
|
80107
79905
|
// src/hooks/comment-checker/hook.ts
|
|
80108
|
-
import * as
|
|
79906
|
+
import * as fs5 from "fs";
|
|
80109
79907
|
import { tmpdir as tmpdir5 } from "os";
|
|
80110
79908
|
import { join as join35 } from "path";
|
|
80111
79909
|
var ApplyPatchMetadataSchema = zod_default.object({
|
|
@@ -80123,7 +79921,7 @@ function debugLog3(...args) {
|
|
|
80123
79921
|
if (DEBUG3) {
|
|
80124
79922
|
const msg = `[${new Date().toISOString()}] [comment-checker:hook] ${args.map((a) => typeof a === "object" ? JSON.stringify(a, null, 2) : String(a)).join(" ")}
|
|
80125
79923
|
`;
|
|
80126
|
-
|
|
79924
|
+
fs5.appendFileSync(DEBUG_FILE3, msg);
|
|
80127
79925
|
}
|
|
80128
79926
|
}
|
|
80129
79927
|
function createCommentCheckerHooks(config2) {
|
|
@@ -80320,7 +80118,7 @@ import {
|
|
|
80320
80118
|
mkdirSync as mkdirSync8,
|
|
80321
80119
|
readFileSync as readFileSync21,
|
|
80322
80120
|
unlinkSync as unlinkSync3,
|
|
80323
|
-
writeFileSync as
|
|
80121
|
+
writeFileSync as writeFileSync8
|
|
80324
80122
|
} from "fs";
|
|
80325
80123
|
import { join as join38 } from "path";
|
|
80326
80124
|
function createInjectedPathsStorage(storageDir) {
|
|
@@ -80346,7 +80144,7 @@ function createInjectedPathsStorage(storageDir) {
|
|
|
80346
80144
|
injectedPaths: [...paths],
|
|
80347
80145
|
updatedAt: Date.now()
|
|
80348
80146
|
};
|
|
80349
|
-
|
|
80147
|
+
writeFileSync8(getStoragePath(sessionID), JSON.stringify(data, null, 2));
|
|
80350
80148
|
};
|
|
80351
80149
|
const clearInjectedPaths = (sessionID) => {
|
|
80352
80150
|
const filePath = getStoragePath(sessionID);
|
|
@@ -80850,7 +80648,7 @@ function incrementEmptyContentAttempt(autoCompactState, sessionID) {
|
|
|
80850
80648
|
}
|
|
80851
80649
|
|
|
80852
80650
|
// src/hooks/anthropic-context-window-limit-recovery/tool-result-storage.ts
|
|
80853
|
-
import { existsSync as existsSync37, readdirSync as readdirSync12, readFileSync as readFileSync24, writeFileSync as
|
|
80651
|
+
import { existsSync as existsSync37, readdirSync as readdirSync12, readFileSync as readFileSync24, writeFileSync as writeFileSync9 } from "fs";
|
|
80854
80652
|
import { join as join41 } from "path";
|
|
80855
80653
|
|
|
80856
80654
|
// src/hooks/anthropic-context-window-limit-recovery/message-storage-directory.ts
|
|
@@ -80928,7 +80726,7 @@ function truncateToolResult(partPath) {
|
|
|
80928
80726
|
part.state.time = { start: Date.now() };
|
|
80929
80727
|
}
|
|
80930
80728
|
part.state.time.compacted = Date.now();
|
|
80931
|
-
|
|
80729
|
+
writeFileSync9(partPath, JSON.stringify(part, null, 2));
|
|
80932
80730
|
return { success: true, toolName, originalSize };
|
|
80933
80731
|
} catch {
|
|
80934
80732
|
return { success: false };
|
|
@@ -83081,7 +82879,7 @@ ${USER_PROMPT_SUBMIT_TAG_CLOSE}`);
|
|
|
83081
82879
|
|
|
83082
82880
|
// src/hooks/claude-code-hooks/transcript.ts
|
|
83083
82881
|
import { join as join46 } from "path";
|
|
83084
|
-
import { mkdirSync as mkdirSync9, appendFileSync as appendFileSync5, existsSync as existsSync41, writeFileSync as
|
|
82882
|
+
import { mkdirSync as mkdirSync9, appendFileSync as appendFileSync5, existsSync as existsSync41, writeFileSync as writeFileSync10, unlinkSync as unlinkSync4 } from "fs";
|
|
83085
82883
|
import { tmpdir as tmpdir6 } from "os";
|
|
83086
82884
|
import { randomUUID } from "crypto";
|
|
83087
82885
|
var TRANSCRIPT_DIR = join46(getClaudeConfigDir(), "transcripts");
|
|
@@ -83208,7 +83006,7 @@ async function buildTranscriptFromSession(client, sessionId, directory, currentT
|
|
|
83208
83006
|
}
|
|
83209
83007
|
}
|
|
83210
83008
|
const tempPath = join46(tmpdir6(), `opencode-transcript-${sessionId}-${randomUUID()}.jsonl`);
|
|
83211
|
-
|
|
83009
|
+
writeFileSync10(tempPath, allEntries.join(`
|
|
83212
83010
|
`) + `
|
|
83213
83011
|
`);
|
|
83214
83012
|
const cacheEntry = transcriptCache.get(sessionId);
|
|
@@ -83222,7 +83020,7 @@ async function buildTranscriptFromSession(client, sessionId, directory, currentT
|
|
|
83222
83020
|
log("[transcript] failed to build transcript from session", { error: error48 });
|
|
83223
83021
|
try {
|
|
83224
83022
|
const tempPath = join46(tmpdir6(), `opencode-transcript-${sessionId}-${randomUUID()}.jsonl`);
|
|
83225
|
-
|
|
83023
|
+
writeFileSync10(tempPath, buildCurrentEntry(currentToolName, currentToolInput) + `
|
|
83226
83024
|
`);
|
|
83227
83025
|
return tempPath;
|
|
83228
83026
|
} catch (fallbackError) {
|
|
@@ -84120,7 +83918,7 @@ import {
|
|
|
84120
83918
|
existsSync as existsSync42,
|
|
84121
83919
|
mkdirSync as mkdirSync10,
|
|
84122
83920
|
readFileSync as readFileSync27,
|
|
84123
|
-
writeFileSync as
|
|
83921
|
+
writeFileSync as writeFileSync11,
|
|
84124
83922
|
unlinkSync as unlinkSync5
|
|
84125
83923
|
} from "fs";
|
|
84126
83924
|
import { join as join49 } from "path";
|
|
@@ -84179,7 +83977,7 @@ function saveInjectedRules(sessionID, data) {
|
|
|
84179
83977
|
injectedRealPaths: [...data.realPaths],
|
|
84180
83978
|
updatedAt: Date.now()
|
|
84181
83979
|
};
|
|
84182
|
-
|
|
83980
|
+
writeFileSync11(getStoragePath(sessionID), JSON.stringify(storageData, null, 2));
|
|
84183
83981
|
}
|
|
84184
83982
|
function clearInjectedRules(sessionID) {
|
|
84185
83983
|
const filePath = getStoragePath(sessionID);
|
|
@@ -84685,7 +84483,7 @@ function createBackgroundNotificationHook(manager) {
|
|
|
84685
84483
|
init_logger();
|
|
84686
84484
|
|
|
84687
84485
|
// src/hooks/auto-update-checker/checker/local-dev-path.ts
|
|
84688
|
-
import * as
|
|
84486
|
+
import * as fs6 from "fs";
|
|
84689
84487
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
84690
84488
|
|
|
84691
84489
|
// src/hooks/auto-update-checker/constants.ts
|
|
@@ -84751,9 +84549,9 @@ function stripJsonComments(json3) {
|
|
|
84751
84549
|
function getLocalDevPath(directory) {
|
|
84752
84550
|
for (const configPath of getConfigPaths2(directory)) {
|
|
84753
84551
|
try {
|
|
84754
|
-
if (!
|
|
84552
|
+
if (!fs6.existsSync(configPath))
|
|
84755
84553
|
continue;
|
|
84756
|
-
const content =
|
|
84554
|
+
const content = fs6.readFileSync(configPath, "utf-8");
|
|
84757
84555
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
84758
84556
|
const plugins = config2.plugin ?? [];
|
|
84759
84557
|
for (const entry of plugins) {
|
|
@@ -84772,20 +84570,20 @@ function getLocalDevPath(directory) {
|
|
|
84772
84570
|
return null;
|
|
84773
84571
|
}
|
|
84774
84572
|
// src/hooks/auto-update-checker/checker/local-dev-version.ts
|
|
84775
|
-
import * as
|
|
84573
|
+
import * as fs8 from "fs";
|
|
84776
84574
|
|
|
84777
84575
|
// src/hooks/auto-update-checker/checker/package-json-locator.ts
|
|
84778
|
-
import * as
|
|
84576
|
+
import * as fs7 from "fs";
|
|
84779
84577
|
import * as path7 from "path";
|
|
84780
84578
|
function findPackageJsonUp(startPath) {
|
|
84781
84579
|
try {
|
|
84782
|
-
const stat =
|
|
84580
|
+
const stat = fs7.statSync(startPath);
|
|
84783
84581
|
let dir = stat.isDirectory() ? startPath : path7.dirname(startPath);
|
|
84784
84582
|
for (let i2 = 0;i2 < 10; i2++) {
|
|
84785
84583
|
const pkgPath = path7.join(dir, "package.json");
|
|
84786
|
-
if (
|
|
84584
|
+
if (fs7.existsSync(pkgPath)) {
|
|
84787
84585
|
try {
|
|
84788
|
-
const content =
|
|
84586
|
+
const content = fs7.readFileSync(pkgPath, "utf-8");
|
|
84789
84587
|
const pkg = JSON.parse(content);
|
|
84790
84588
|
if (pkg.name === PACKAGE_NAME)
|
|
84791
84589
|
return pkgPath;
|
|
@@ -84809,7 +84607,7 @@ function getLocalDevVersion(directory) {
|
|
|
84809
84607
|
const pkgPath = findPackageJsonUp(localPath);
|
|
84810
84608
|
if (!pkgPath)
|
|
84811
84609
|
return null;
|
|
84812
|
-
const content =
|
|
84610
|
+
const content = fs8.readFileSync(pkgPath, "utf-8");
|
|
84813
84611
|
const pkg = JSON.parse(content);
|
|
84814
84612
|
return pkg.version ?? null;
|
|
84815
84613
|
} catch {
|
|
@@ -84817,15 +84615,15 @@ function getLocalDevVersion(directory) {
|
|
|
84817
84615
|
}
|
|
84818
84616
|
}
|
|
84819
84617
|
// src/hooks/auto-update-checker/checker/plugin-entry.ts
|
|
84820
|
-
import * as
|
|
84618
|
+
import * as fs9 from "fs";
|
|
84821
84619
|
var EXACT_SEMVER_REGEX = /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/;
|
|
84822
84620
|
var MATCH_PLUGIN_NAMES = [PACKAGE_NAME, PLUGIN_NAME, LEGACY_PLUGIN_NAME];
|
|
84823
84621
|
function findPluginEntry(directory) {
|
|
84824
84622
|
for (const configPath of getConfigPaths2(directory)) {
|
|
84825
84623
|
try {
|
|
84826
|
-
if (!
|
|
84624
|
+
if (!fs9.existsSync(configPath))
|
|
84827
84625
|
continue;
|
|
84828
|
-
const content =
|
|
84626
|
+
const content = fs9.readFileSync(configPath, "utf-8");
|
|
84829
84627
|
const config2 = JSON.parse(stripJsonComments(content));
|
|
84830
84628
|
const plugins = config2.plugin ?? [];
|
|
84831
84629
|
for (const entry of plugins) {
|
|
@@ -84848,13 +84646,13 @@ function findPluginEntry(directory) {
|
|
|
84848
84646
|
}
|
|
84849
84647
|
// src/hooks/auto-update-checker/checker/cached-version.ts
|
|
84850
84648
|
init_logger();
|
|
84851
|
-
import * as
|
|
84649
|
+
import * as fs10 from "fs";
|
|
84852
84650
|
import * as path8 from "path";
|
|
84853
84651
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
84854
84652
|
function getCachedVersion() {
|
|
84855
84653
|
try {
|
|
84856
|
-
if (
|
|
84857
|
-
const content =
|
|
84654
|
+
if (fs10.existsSync(INSTALLED_PACKAGE_JSON)) {
|
|
84655
|
+
const content = fs10.readFileSync(INSTALLED_PACKAGE_JSON, "utf-8");
|
|
84858
84656
|
const pkg = JSON.parse(content);
|
|
84859
84657
|
if (pkg.version)
|
|
84860
84658
|
return pkg.version;
|
|
@@ -84864,7 +84662,7 @@ function getCachedVersion() {
|
|
|
84864
84662
|
const currentDir = path8.dirname(fileURLToPath3(import.meta.url));
|
|
84865
84663
|
const pkgPath = findPackageJsonUp(currentDir);
|
|
84866
84664
|
if (pkgPath) {
|
|
84867
|
-
const content =
|
|
84665
|
+
const content = fs10.readFileSync(pkgPath, "utf-8");
|
|
84868
84666
|
const pkg = JSON.parse(content);
|
|
84869
84667
|
if (pkg.version)
|
|
84870
84668
|
return pkg.version;
|
|
@@ -84873,10 +84671,10 @@ function getCachedVersion() {
|
|
|
84873
84671
|
log("[auto-update-checker] Failed to resolve version from current directory:", err);
|
|
84874
84672
|
}
|
|
84875
84673
|
try {
|
|
84876
|
-
const execDir = path8.dirname(
|
|
84674
|
+
const execDir = path8.dirname(fs10.realpathSync(process.execPath));
|
|
84877
84675
|
const pkgPath = findPackageJsonUp(execDir);
|
|
84878
84676
|
if (pkgPath) {
|
|
84879
|
-
const content =
|
|
84677
|
+
const content = fs10.readFileSync(pkgPath, "utf-8");
|
|
84880
84678
|
const pkg = JSON.parse(content);
|
|
84881
84679
|
if (pkg.version)
|
|
84882
84680
|
return pkg.version;
|
|
@@ -84889,8 +84687,8 @@ function getCachedVersion() {
|
|
|
84889
84687
|
let dir = path8.dirname(currentFile);
|
|
84890
84688
|
for (let i2 = 0;i2 < 10; i2++) {
|
|
84891
84689
|
const pkgPath = path8.join(dir, "package.json");
|
|
84892
|
-
if (
|
|
84893
|
-
const content =
|
|
84690
|
+
if (fs10.existsSync(pkgPath)) {
|
|
84691
|
+
const content = fs10.readFileSync(pkgPath, "utf-8");
|
|
84894
84692
|
const pkg = JSON.parse(content);
|
|
84895
84693
|
if (pkg.version)
|
|
84896
84694
|
return pkg.version;
|
|
@@ -84954,13 +84752,13 @@ function extractChannel(version2) {
|
|
|
84954
84752
|
}
|
|
84955
84753
|
// src/hooks/auto-update-checker/checker/sync-package-json.ts
|
|
84956
84754
|
import * as crypto2 from "crypto";
|
|
84957
|
-
import * as
|
|
84755
|
+
import * as fs11 from "fs";
|
|
84958
84756
|
import * as path9 from "path";
|
|
84959
84757
|
init_logger();
|
|
84960
84758
|
var EXACT_SEMVER_REGEX2 = /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/;
|
|
84961
84759
|
function safeUnlink(filePath) {
|
|
84962
84760
|
try {
|
|
84963
|
-
|
|
84761
|
+
fs11.unlinkSync(filePath);
|
|
84964
84762
|
} catch (err) {
|
|
84965
84763
|
log(`[auto-update-checker] Failed to cleanup temp file: ${filePath}`, err);
|
|
84966
84764
|
}
|
|
@@ -84974,9 +84772,9 @@ function getIntentVersion(pluginInfo) {
|
|
|
84974
84772
|
function writeCachePackageJson(cachePackageJsonPath, pkgJson) {
|
|
84975
84773
|
const tmpPath = `${cachePackageJsonPath}.${crypto2.randomUUID()}`;
|
|
84976
84774
|
try {
|
|
84977
|
-
|
|
84978
|
-
|
|
84979
|
-
|
|
84775
|
+
fs11.mkdirSync(path9.dirname(cachePackageJsonPath), { recursive: true });
|
|
84776
|
+
fs11.writeFileSync(tmpPath, JSON.stringify(pkgJson, null, 2));
|
|
84777
|
+
fs11.renameSync(tmpPath, cachePackageJsonPath);
|
|
84980
84778
|
return { synced: true, error: null };
|
|
84981
84779
|
} catch (err) {
|
|
84982
84780
|
log("[auto-update-checker] Failed to write cache package.json:", err);
|
|
@@ -84987,7 +84785,7 @@ function writeCachePackageJson(cachePackageJsonPath, pkgJson) {
|
|
|
84987
84785
|
function syncCachePackageJsonToIntent(pluginInfo) {
|
|
84988
84786
|
const cachePackageJsonPath = path9.join(CACHE_DIR, "package.json");
|
|
84989
84787
|
const intentVersion = getIntentVersion(pluginInfo);
|
|
84990
|
-
if (!
|
|
84788
|
+
if (!fs11.existsSync(cachePackageJsonPath)) {
|
|
84991
84789
|
log("[auto-update-checker] Cache package.json missing, creating workspace package.json", { intentVersion });
|
|
84992
84790
|
return {
|
|
84993
84791
|
...writeCachePackageJson(cachePackageJsonPath, { dependencies: { [PACKAGE_NAME]: intentVersion } }),
|
|
@@ -84997,7 +84795,7 @@ function syncCachePackageJsonToIntent(pluginInfo) {
|
|
|
84997
84795
|
let content;
|
|
84998
84796
|
let pkgJson;
|
|
84999
84797
|
try {
|
|
85000
|
-
content =
|
|
84798
|
+
content = fs11.readFileSync(cachePackageJsonPath, "utf-8");
|
|
85001
84799
|
} catch (err) {
|
|
85002
84800
|
log("[auto-update-checker] Failed to read cache package.json:", err);
|
|
85003
84801
|
return { synced: false, error: "parse_error", message: "Failed to read cache package.json" };
|
|
@@ -85196,7 +84994,7 @@ async function runBunInstallWithDetails(options) {
|
|
|
85196
84994
|
init_logger();
|
|
85197
84995
|
|
|
85198
84996
|
// src/hooks/auto-update-checker/cache.ts
|
|
85199
|
-
import * as
|
|
84997
|
+
import * as fs12 from "fs";
|
|
85200
84998
|
import * as path10 from "path";
|
|
85201
84999
|
init_logger();
|
|
85202
85000
|
function stripTrailingCommas(json3) {
|
|
@@ -85204,11 +85002,11 @@ function stripTrailingCommas(json3) {
|
|
|
85204
85002
|
}
|
|
85205
85003
|
function removeFromTextBunLock(lockPath, packageName) {
|
|
85206
85004
|
try {
|
|
85207
|
-
const content =
|
|
85005
|
+
const content = fs12.readFileSync(lockPath, "utf-8");
|
|
85208
85006
|
const lock = JSON.parse(stripTrailingCommas(content));
|
|
85209
85007
|
if (lock.packages?.[packageName]) {
|
|
85210
85008
|
delete lock.packages[packageName];
|
|
85211
|
-
|
|
85009
|
+
fs12.writeFileSync(lockPath, JSON.stringify(lock, null, 2));
|
|
85212
85010
|
log(`[auto-update-checker] Removed from bun.lock: ${packageName}`);
|
|
85213
85011
|
return true;
|
|
85214
85012
|
}
|
|
@@ -85219,7 +85017,7 @@ function removeFromTextBunLock(lockPath, packageName) {
|
|
|
85219
85017
|
}
|
|
85220
85018
|
function deleteBinaryBunLock(lockPath) {
|
|
85221
85019
|
try {
|
|
85222
|
-
|
|
85020
|
+
fs12.unlinkSync(lockPath);
|
|
85223
85021
|
log(`[auto-update-checker] Removed bun.lockb to force re-resolution`);
|
|
85224
85022
|
return true;
|
|
85225
85023
|
} catch {
|
|
@@ -85229,10 +85027,10 @@ function deleteBinaryBunLock(lockPath) {
|
|
|
85229
85027
|
function removeFromBunLock(packageName) {
|
|
85230
85028
|
const textLockPath = path10.join(CACHE_DIR, "bun.lock");
|
|
85231
85029
|
const binaryLockPath = path10.join(CACHE_DIR, "bun.lockb");
|
|
85232
|
-
if (
|
|
85030
|
+
if (fs12.existsSync(textLockPath)) {
|
|
85233
85031
|
return removeFromTextBunLock(textLockPath, packageName);
|
|
85234
85032
|
}
|
|
85235
|
-
if (
|
|
85033
|
+
if (fs12.existsSync(binaryLockPath)) {
|
|
85236
85034
|
return deleteBinaryBunLock(binaryLockPath);
|
|
85237
85035
|
}
|
|
85238
85036
|
return false;
|
|
@@ -85247,8 +85045,8 @@ function invalidatePackage(packageName = PACKAGE_NAME) {
|
|
|
85247
85045
|
let packageRemoved = false;
|
|
85248
85046
|
let lockRemoved = false;
|
|
85249
85047
|
for (const pkgDir of pkgDirs) {
|
|
85250
|
-
if (
|
|
85251
|
-
|
|
85048
|
+
if (fs12.existsSync(pkgDir)) {
|
|
85049
|
+
fs12.rmSync(pkgDir, { recursive: true, force: true });
|
|
85252
85050
|
log(`[auto-update-checker] Package removed: ${pkgDir}`);
|
|
85253
85051
|
packageRemoved = true;
|
|
85254
85052
|
}
|
|
@@ -85621,7 +85419,7 @@ import {
|
|
|
85621
85419
|
existsSync as existsSync54,
|
|
85622
85420
|
mkdirSync as mkdirSync12,
|
|
85623
85421
|
readFileSync as readFileSync36,
|
|
85624
|
-
writeFileSync as
|
|
85422
|
+
writeFileSync as writeFileSync14,
|
|
85625
85423
|
unlinkSync as unlinkSync8
|
|
85626
85424
|
} from "fs";
|
|
85627
85425
|
import { join as join62 } from "path";
|
|
@@ -85692,7 +85490,7 @@ function saveAgentUsageState(state3) {
|
|
|
85692
85490
|
mkdirSync12(AGENT_USAGE_REMINDER_STORAGE, { recursive: true });
|
|
85693
85491
|
}
|
|
85694
85492
|
const filePath = getStoragePath2(state3.sessionID);
|
|
85695
|
-
|
|
85493
|
+
writeFileSync14(filePath, JSON.stringify(state3, null, 2));
|
|
85696
85494
|
}
|
|
85697
85495
|
function clearAgentUsageState(sessionID) {
|
|
85698
85496
|
const filePath = getStoragePath2(sessionID);
|
|
@@ -87152,7 +86950,7 @@ import {
|
|
|
87152
86950
|
existsSync as existsSync55,
|
|
87153
86951
|
mkdirSync as mkdirSync13,
|
|
87154
86952
|
readFileSync as readFileSync37,
|
|
87155
|
-
writeFileSync as
|
|
86953
|
+
writeFileSync as writeFileSync15,
|
|
87156
86954
|
unlinkSync as unlinkSync9
|
|
87157
86955
|
} from "fs";
|
|
87158
86956
|
import { join as join64 } from "path";
|
|
@@ -87199,7 +86997,7 @@ function saveInteractiveBashSessionState(state3) {
|
|
|
87199
86997
|
tmuxSessions: Array.from(state3.tmuxSessions),
|
|
87200
86998
|
updatedAt: state3.updatedAt
|
|
87201
86999
|
};
|
|
87202
|
-
|
|
87000
|
+
writeFileSync15(filePath, JSON.stringify(serialized, null, 2));
|
|
87203
87001
|
}
|
|
87204
87002
|
function clearInteractiveBashSessionState(sessionID) {
|
|
87205
87003
|
const filePath = getStoragePath3(sessionID);
|
|
@@ -87710,7 +87508,7 @@ var ULTRAWORK_MAX_ITERATIONS = 500;
|
|
|
87710
87508
|
var DEFAULT_COMPLETION_PROMISE = "DONE";
|
|
87711
87509
|
var ULTRAWORK_VERIFICATION_PROMISE = "VERIFIED";
|
|
87712
87510
|
// src/hooks/ralph-loop/storage.ts
|
|
87713
|
-
import { existsSync as existsSync56, readFileSync as readFileSync38, writeFileSync as
|
|
87511
|
+
import { existsSync as existsSync56, readFileSync as readFileSync38, writeFileSync as writeFileSync16, unlinkSync as unlinkSync10, mkdirSync as mkdirSync14 } from "fs";
|
|
87714
87512
|
import { dirname as dirname15, join as join65 } from "path";
|
|
87715
87513
|
function getStateFilePath(directory, customPath) {
|
|
87716
87514
|
return customPath ? join65(directory, customPath) : join65(directory, DEFAULT_STATE_FILE);
|
|
@@ -87792,7 +87590,7 @@ ${initialCompletionPromiseLine}${verificationAttemptLine}${verificationSessionLi
|
|
|
87792
87590
|
${sessionIdLine}${ultraworkLine}${verificationPendingLine}${strategyLine}${messageCountAtStartLine}---
|
|
87793
87591
|
${state3.prompt}
|
|
87794
87592
|
`;
|
|
87795
|
-
|
|
87593
|
+
writeFileSync16(filePath, content, "utf-8");
|
|
87796
87594
|
return true;
|
|
87797
87595
|
} catch {
|
|
87798
87596
|
return false;
|
|
@@ -88982,11 +88780,11 @@ function deduplicateSkillsByName(skills) {
|
|
|
88982
88780
|
}
|
|
88983
88781
|
|
|
88984
88782
|
// src/features/opencode-skill-loader/skill-directory-loader.ts
|
|
88985
|
-
import { promises as
|
|
88783
|
+
import { promises as fs15 } from "fs";
|
|
88986
88784
|
import { join as join67 } from "path";
|
|
88987
88785
|
|
|
88988
88786
|
// src/features/opencode-skill-loader/loaded-skill-from-path.ts
|
|
88989
|
-
import { promises as
|
|
88787
|
+
import { promises as fs14 } from "fs";
|
|
88990
88788
|
import { basename as basename6 } from "path";
|
|
88991
88789
|
|
|
88992
88790
|
// src/features/opencode-skill-loader/allowed-tools-parser.ts
|
|
@@ -89000,7 +88798,7 @@ function parseAllowedTools(allowedTools) {
|
|
|
89000
88798
|
}
|
|
89001
88799
|
|
|
89002
88800
|
// src/features/opencode-skill-loader/skill-mcp-config.ts
|
|
89003
|
-
import { promises as
|
|
88801
|
+
import { promises as fs13 } from "fs";
|
|
89004
88802
|
import { join as join66 } from "path";
|
|
89005
88803
|
function parseSkillMcpConfigFromFrontmatter(content) {
|
|
89006
88804
|
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
@@ -89019,7 +88817,7 @@ function parseSkillMcpConfigFromFrontmatter(content) {
|
|
|
89019
88817
|
async function loadMcpJsonFromDir(skillDir) {
|
|
89020
88818
|
const mcpJsonPath = join66(skillDir, "mcp.json");
|
|
89021
88819
|
try {
|
|
89022
|
-
const content = await
|
|
88820
|
+
const content = await fs13.readFile(mcpJsonPath, "utf-8");
|
|
89023
88821
|
const parsed = JSON.parse(content);
|
|
89024
88822
|
if (parsed && typeof parsed === "object" && "mcpServers" in parsed && parsed.mcpServers) {
|
|
89025
88823
|
return parsed.mcpServers;
|
|
@@ -89040,7 +88838,7 @@ async function loadMcpJsonFromDir(skillDir) {
|
|
|
89040
88838
|
async function loadSkillFromPath(options) {
|
|
89041
88839
|
const namePrefix = options.namePrefix ?? "";
|
|
89042
88840
|
try {
|
|
89043
|
-
const content = await
|
|
88841
|
+
const content = await fs14.readFile(options.skillPath, "utf-8");
|
|
89044
88842
|
const { data, body } = parseFrontmatter(content);
|
|
89045
88843
|
const frontmatterMcp = parseSkillMcpConfigFromFrontmatter(content);
|
|
89046
88844
|
const mcpJsonMcp = await loadMcpJsonFromDir(options.resolvedPath);
|
|
@@ -89101,7 +88899,7 @@ async function loadSkillsFromDir(options) {
|
|
|
89101
88899
|
const namePrefix = options.namePrefix ?? "";
|
|
89102
88900
|
const depth = options.depth ?? 0;
|
|
89103
88901
|
const maxDepth = options.maxDepth ?? 2;
|
|
89104
|
-
const entries = await
|
|
88902
|
+
const entries = await fs15.readdir(options.skillsDir, { withFileTypes: true }).catch(() => []);
|
|
89105
88903
|
const skillMap = new Map;
|
|
89106
88904
|
const directories = entries.filter((entry) => !entry.name.startsWith(".") && (entry.isDirectory() || entry.isSymbolicLink()));
|
|
89107
88905
|
const files = entries.filter((entry) => !entry.name.startsWith(".") && !entry.isDirectory() && !entry.isSymbolicLink() && isMarkdownFile(entry));
|
|
@@ -89111,7 +88909,7 @@ async function loadSkillsFromDir(options) {
|
|
|
89111
88909
|
const dirName = entry.name;
|
|
89112
88910
|
const skillMdPath = join67(resolvedPath, "SKILL.md");
|
|
89113
88911
|
try {
|
|
89114
|
-
await
|
|
88912
|
+
await fs15.access(skillMdPath);
|
|
89115
88913
|
const skill = await loadSkillFromPath({
|
|
89116
88914
|
skillPath: skillMdPath,
|
|
89117
88915
|
resolvedPath,
|
|
@@ -89126,7 +88924,7 @@ async function loadSkillsFromDir(options) {
|
|
|
89126
88924
|
} catch {}
|
|
89127
88925
|
const namedSkillMdPath = join67(resolvedPath, `${dirName}.md`);
|
|
89128
88926
|
try {
|
|
89129
|
-
await
|
|
88927
|
+
await fs15.access(namedSkillMdPath);
|
|
89130
88928
|
const skill = await loadSkillFromPath({
|
|
89131
88929
|
skillPath: namedSkillMdPath,
|
|
89132
88930
|
resolvedPath,
|
|
@@ -93078,7 +92876,7 @@ async function resolveMultipleSkillsAsync(skillNames, options) {
|
|
|
93078
92876
|
}
|
|
93079
92877
|
// src/features/opencode-skill-loader/config-source-discovery.ts
|
|
93080
92878
|
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
93081
|
-
import { promises as
|
|
92879
|
+
import { promises as fs16 } from "fs";
|
|
93082
92880
|
import { homedir as homedir14 } from "os";
|
|
93083
92881
|
import { dirname as dirname17, extname, isAbsolute as isAbsolute8, join as join69, relative as relative6 } from "path";
|
|
93084
92882
|
var MAX_RECURSIVE_DEPTH = 10;
|
|
@@ -93118,7 +92916,7 @@ async function loadSourcePath(options) {
|
|
|
93118
92916
|
return [];
|
|
93119
92917
|
}
|
|
93120
92918
|
const absolutePath = toAbsolutePath(options.sourcePath, options.configDir);
|
|
93121
|
-
const stat = await
|
|
92919
|
+
const stat = await fs16.stat(absolutePath).catch(() => null);
|
|
93122
92920
|
if (!stat)
|
|
93123
92921
|
return [];
|
|
93124
92922
|
if (stat.isFile()) {
|
|
@@ -95264,7 +95062,7 @@ var NOTEPAD_DIR = "notepads";
|
|
|
95264
95062
|
var NOTEPAD_BASE_PATH = `${BOULDER_DIR}/${NOTEPAD_DIR}`;
|
|
95265
95063
|
var PROMETHEUS_PLANS_DIR = ".sisyphus/plans";
|
|
95266
95064
|
// src/features/boulder-state/storage.ts
|
|
95267
|
-
import { existsSync as existsSync60, readFileSync as readFileSync43, writeFileSync as
|
|
95065
|
+
import { existsSync as existsSync60, readFileSync as readFileSync43, writeFileSync as writeFileSync17, mkdirSync as mkdirSync15, readdirSync as readdirSync17 } from "fs";
|
|
95268
95066
|
import { dirname as dirname19, join as join71, basename as basename8 } from "path";
|
|
95269
95067
|
var RESERVED_KEYS = new Set(["__proto__", "prototype", "constructor"]);
|
|
95270
95068
|
function getBoulderFilePath(directory) {
|
|
@@ -95308,7 +95106,7 @@ function writeBoulderState(directory, state3) {
|
|
|
95308
95106
|
if (!existsSync60(dir)) {
|
|
95309
95107
|
mkdirSync15(dir, { recursive: true });
|
|
95310
95108
|
}
|
|
95311
|
-
|
|
95109
|
+
writeFileSync17(filePath, JSON.stringify(state3, null, 2), "utf-8");
|
|
95312
95110
|
return true;
|
|
95313
95111
|
} catch {
|
|
95314
95112
|
return false;
|
|
@@ -99146,7 +98944,7 @@ var HOOK_NAME11 = "runtime-fallback";
|
|
|
99146
98944
|
init_logger();
|
|
99147
98945
|
|
|
99148
98946
|
// src/plugin-config.ts
|
|
99149
|
-
import * as
|
|
98947
|
+
import * as fs17 from "fs";
|
|
99150
98948
|
import * as path11 from "path";
|
|
99151
98949
|
var PARTIAL_STRING_ARRAY_KEYS = new Set([
|
|
99152
98950
|
"disabled_mcps",
|
|
@@ -99192,10 +98990,9 @@ function parseConfigPartially(rawConfig) {
|
|
|
99192
98990
|
}
|
|
99193
98991
|
function loadConfigFromPath2(configPath, _ctx) {
|
|
99194
98992
|
try {
|
|
99195
|
-
if (
|
|
99196
|
-
const content =
|
|
98993
|
+
if (fs17.existsSync(configPath)) {
|
|
98994
|
+
const content = fs17.readFileSync(configPath, "utf-8");
|
|
99197
98995
|
const rawConfig = parseJsonc(content);
|
|
99198
|
-
migrateConfigFile(configPath, rawConfig);
|
|
99199
98996
|
const result = OhMyOpenCodeConfigSchema.safeParse(rawConfig);
|
|
99200
98997
|
if (result.success) {
|
|
99201
98998
|
log(`Config loaded from ${configPath}`, { agents: result.data.agents });
|
|
@@ -103608,7 +103405,7 @@ function formatApplyResult(result) {
|
|
|
103608
103405
|
`);
|
|
103609
103406
|
}
|
|
103610
103407
|
// src/tools/lsp/workspace-edit.ts
|
|
103611
|
-
import { readFileSync as readFileSync51, writeFileSync as
|
|
103408
|
+
import { readFileSync as readFileSync51, writeFileSync as writeFileSync18 } from "fs";
|
|
103612
103409
|
function applyTextEditsToFile(filePath, edits) {
|
|
103613
103410
|
try {
|
|
103614
103411
|
let content = readFileSync51(filePath, "utf-8");
|
|
@@ -103636,7 +103433,7 @@ function applyTextEditsToFile(filePath, edits) {
|
|
|
103636
103433
|
`));
|
|
103637
103434
|
}
|
|
103638
103435
|
}
|
|
103639
|
-
|
|
103436
|
+
writeFileSync18(filePath, lines.join(`
|
|
103640
103437
|
`), "utf-8");
|
|
103641
103438
|
return { success: true, editCount: edits.length };
|
|
103642
103439
|
} catch (err) {
|
|
@@ -103667,7 +103464,7 @@ function applyWorkspaceEdit(edit) {
|
|
|
103667
103464
|
if (change.kind === "create") {
|
|
103668
103465
|
try {
|
|
103669
103466
|
const filePath = uriToPath(change.uri);
|
|
103670
|
-
|
|
103467
|
+
writeFileSync18(filePath, "", "utf-8");
|
|
103671
103468
|
result.filesModified.push(filePath);
|
|
103672
103469
|
} catch (err) {
|
|
103673
103470
|
result.success = false;
|
|
@@ -103678,7 +103475,7 @@ function applyWorkspaceEdit(edit) {
|
|
|
103678
103475
|
const oldPath = uriToPath(change.oldUri);
|
|
103679
103476
|
const newPath = uriToPath(change.newUri);
|
|
103680
103477
|
const content = readFileSync51(oldPath, "utf-8");
|
|
103681
|
-
|
|
103478
|
+
writeFileSync18(newPath, content, "utf-8");
|
|
103682
103479
|
__require("fs").unlinkSync(oldPath);
|
|
103683
103480
|
result.filesModified.push(newPath);
|
|
103684
103481
|
} catch (err) {
|
|
@@ -117049,8 +116846,8 @@ async function extractZip2(archivePath, destDir) {
|
|
|
117049
116846
|
if (foundPath) {
|
|
117050
116847
|
const destPath = join83(destDir, binaryName);
|
|
117051
116848
|
if (foundPath !== destPath) {
|
|
117052
|
-
const { renameSync:
|
|
117053
|
-
|
|
116849
|
+
const { renameSync: renameSync3 } = await import("fs");
|
|
116850
|
+
renameSync3(foundPath, destPath);
|
|
117054
116851
|
}
|
|
117055
116852
|
}
|
|
117056
116853
|
}
|
|
@@ -120686,7 +120483,7 @@ async function resolveMultimodalLookerAgentMetadata(ctx) {
|
|
|
120686
120483
|
|
|
120687
120484
|
// src/tools/look-at/image-converter.ts
|
|
120688
120485
|
import * as childProcess from "child_process";
|
|
120689
|
-
import { existsSync as existsSync79, mkdtempSync, readFileSync as readFileSync52, rmSync as rmSync3, unlinkSync as unlinkSync11, writeFileSync as
|
|
120486
|
+
import { existsSync as existsSync79, mkdtempSync, readFileSync as readFileSync52, rmSync as rmSync3, unlinkSync as unlinkSync11, writeFileSync as writeFileSync19 } from "fs";
|
|
120690
120487
|
import { tmpdir as tmpdir7 } from "os";
|
|
120691
120488
|
import { dirname as dirname25, join as join87 } from "path";
|
|
120692
120489
|
var SUPPORTED_FORMATS = new Set([
|
|
@@ -120802,7 +120599,7 @@ function convertBase64ImageToJpeg(base64Data, mimeType) {
|
|
|
120802
120599
|
try {
|
|
120803
120600
|
const cleanBase64 = base64Data.replace(/^data:[^;]+;base64,/, "");
|
|
120804
120601
|
const buffer2 = Buffer.from(cleanBase64, "base64");
|
|
120805
|
-
|
|
120602
|
+
writeFileSync19(inputPath, buffer2);
|
|
120806
120603
|
log(`[image-converter] Converting Base64 ${mimeType} to JPEG`);
|
|
120807
120604
|
const outputPath = convertImageToJpeg(inputPath, mimeType);
|
|
120808
120605
|
tempFiles.push(outputPath);
|
|
@@ -123190,7 +122987,7 @@ var TaskDeleteInputSchema = exports_external.object({
|
|
|
123190
122987
|
|
|
123191
122988
|
// src/features/claude-tasks/storage.ts
|
|
123192
122989
|
import { join as join88, dirname as dirname26, basename as basename11, isAbsolute as isAbsolute11 } from "path";
|
|
123193
|
-
import { existsSync as existsSync80, mkdirSync as mkdirSync16, readFileSync as readFileSync53, writeFileSync as
|
|
122990
|
+
import { existsSync as existsSync80, mkdirSync as mkdirSync16, readFileSync as readFileSync53, writeFileSync as writeFileSync20, renameSync as renameSync3, unlinkSync as unlinkSync12, readdirSync as readdirSync22 } from "fs";
|
|
123194
122991
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
123195
122992
|
function getTaskDir(config4 = {}) {
|
|
123196
122993
|
const tasksConfig = config4.sisyphus?.tasks;
|
|
@@ -123243,8 +123040,8 @@ function writeJsonAtomic(filePath, data) {
|
|
|
123243
123040
|
ensureDir(dir);
|
|
123244
123041
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
123245
123042
|
try {
|
|
123246
|
-
|
|
123247
|
-
|
|
123043
|
+
writeFileSync20(tempPath, JSON.stringify(data, null, 2), "utf-8");
|
|
123044
|
+
renameSync3(tempPath, filePath);
|
|
123248
123045
|
} catch (error92) {
|
|
123249
123046
|
try {
|
|
123250
123047
|
if (existsSync80(tempPath)) {
|
|
@@ -123262,7 +123059,7 @@ function acquireLock(dirPath) {
|
|
|
123262
123059
|
const lockPath = join88(dirPath, ".lock");
|
|
123263
123060
|
const lockId = randomUUID3();
|
|
123264
123061
|
const createLock = (timestamp2) => {
|
|
123265
|
-
|
|
123062
|
+
writeFileSync20(lockPath, JSON.stringify({ id: lockId, timestamp: timestamp2 }), {
|
|
123266
123063
|
encoding: "utf-8",
|
|
123267
123064
|
flag: "wx"
|
|
123268
123065
|
});
|
|
@@ -128540,7 +128337,7 @@ ${originalText}`;
|
|
|
128540
128337
|
}
|
|
128541
128338
|
}
|
|
128542
128339
|
// src/features/mcp-oauth/storage.ts
|
|
128543
|
-
import { chmodSync as chmodSync2, existsSync as existsSync82, mkdirSync as mkdirSync17, readFileSync as readFileSync55, renameSync as
|
|
128340
|
+
import { chmodSync as chmodSync2, existsSync as existsSync82, mkdirSync as mkdirSync17, readFileSync as readFileSync55, renameSync as renameSync4, unlinkSync as unlinkSync13, writeFileSync as writeFileSync21 } from "fs";
|
|
128544
128341
|
import { dirname as dirname27, join as join95 } from "path";
|
|
128545
128342
|
var STORAGE_FILE_NAME = "mcp-oauth.json";
|
|
128546
128343
|
function getMcpOauthStoragePath() {
|
|
@@ -128599,9 +128396,9 @@ function writeStore(store2) {
|
|
|
128599
128396
|
mkdirSync17(dir, { recursive: true });
|
|
128600
128397
|
}
|
|
128601
128398
|
const tempPath = `${filePath}.tmp.${Date.now()}`;
|
|
128602
|
-
|
|
128399
|
+
writeFileSync21(tempPath, JSON.stringify(store2, null, 2), { encoding: "utf-8", mode: 384 });
|
|
128603
128400
|
chmodSync2(tempPath, 384);
|
|
128604
|
-
|
|
128401
|
+
renameSync4(tempPath, filePath);
|
|
128605
128402
|
return true;
|
|
128606
128403
|
} catch {
|
|
128607
128404
|
return false;
|
|
@@ -144568,18 +144365,18 @@ async function applyAgentConfig(params) {
|
|
|
144568
144365
|
return agentResult;
|
|
144569
144366
|
}
|
|
144570
144367
|
// src/features/claude-code-command-loader/loader.ts
|
|
144571
|
-
import { promises as
|
|
144368
|
+
import { promises as fs18 } from "fs";
|
|
144572
144369
|
import { join as join98, basename as basename13 } from "path";
|
|
144573
144370
|
init_logger();
|
|
144574
144371
|
async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix = "") {
|
|
144575
144372
|
try {
|
|
144576
|
-
await
|
|
144373
|
+
await fs18.access(commandsDir);
|
|
144577
144374
|
} catch {
|
|
144578
144375
|
return [];
|
|
144579
144376
|
}
|
|
144580
144377
|
let realPath;
|
|
144581
144378
|
try {
|
|
144582
|
-
realPath = await
|
|
144379
|
+
realPath = await fs18.realpath(commandsDir);
|
|
144583
144380
|
} catch (error92) {
|
|
144584
144381
|
log(`Failed to resolve command directory: ${commandsDir}`, error92);
|
|
144585
144382
|
return [];
|
|
@@ -144590,7 +144387,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
144590
144387
|
visited.add(realPath);
|
|
144591
144388
|
let entries;
|
|
144592
144389
|
try {
|
|
144593
|
-
entries = await
|
|
144390
|
+
entries = await fs18.readdir(commandsDir, { withFileTypes: true });
|
|
144594
144391
|
} catch (error92) {
|
|
144595
144392
|
log(`Failed to read command directory: ${commandsDir}`, error92);
|
|
144596
144393
|
return [];
|
|
@@ -144612,7 +144409,7 @@ async function loadCommandsFromDir(commandsDir, scope, visited = new Set, prefix
|
|
|
144612
144409
|
const baseCommandName = basename13(entry.name, ".md");
|
|
144613
144410
|
const commandName = prefix ? `${prefix}/${baseCommandName}` : baseCommandName;
|
|
144614
144411
|
try {
|
|
144615
|
-
const content = await
|
|
144412
|
+
const content = await fs18.readFile(commandPath, "utf-8");
|
|
144616
144413
|
const { data, body } = parseFrontmatter(content);
|
|
144617
144414
|
const wrappedTemplate = `<command-instruction>
|
|
144618
144415
|
${body.trim()}
|