@cleocode/adapters 2026.5.37 → 2026.5.40
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 +165 -292
- package/dist/index.js.map +2 -2
- package/dist/providers/codex/install.d.ts +6 -11
- package/dist/providers/codex/install.d.ts.map +1 -1
- package/dist/providers/gemini-cli/install.d.ts +9 -14
- package/dist/providers/gemini-cli/install.d.ts.map +1 -1
- package/dist/providers/kimi/install.d.ts +3 -8
- package/dist/providers/kimi/install.d.ts.map +1 -1
- package/dist/providers/openai-sdk/install.d.ts +4 -8
- package/dist/providers/openai-sdk/install.d.ts.map +1 -1
- package/dist/providers/opencode/install.d.ts +6 -10
- package/dist/providers/opencode/install.d.ts.map +1 -1
- package/dist/providers/pi/install.d.ts +6 -13
- package/dist/providers/pi/install.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/opencode-adapter.test.ts +10 -9
- package/src/providers/codex/install.ts +30 -67
- package/src/providers/gemini-cli/install.ts +28 -55
- package/src/providers/kimi/install.ts +19 -46
- package/src/providers/openai-sdk/__tests__/openai-sdk-spawn.test.ts +27 -6
- package/src/providers/openai-sdk/install.ts +19 -41
- package/src/providers/opencode/__tests__/adapter.test.ts +14 -0
- package/src/providers/opencode/install.ts +30 -67
- package/src/providers/pi/install.ts +47 -99
package/dist/index.js
CHANGED
|
@@ -28833,9 +28833,9 @@ var init_hooks2 = __esm({
|
|
|
28833
28833
|
});
|
|
28834
28834
|
|
|
28835
28835
|
// packages/adapters/src/providers/cursor/install.ts
|
|
28836
|
-
import { existsSync as
|
|
28836
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "node:fs";
|
|
28837
28837
|
import { join as join16 } from "node:path";
|
|
28838
|
-
import { ensureProviderInstructionFile as
|
|
28838
|
+
import { ensureProviderInstructionFile as ensureProviderInstructionFile3 } from "@cleocode/caamp";
|
|
28839
28839
|
var CursorInstallProvider;
|
|
28840
28840
|
var init_install2 = __esm({
|
|
28841
28841
|
"packages/adapters/src/providers/cursor/install.ts"() {
|
|
@@ -28854,7 +28854,7 @@ var init_install2 = __esm({
|
|
|
28854
28854
|
const installedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
28855
28855
|
let instructionFileUpdated = false;
|
|
28856
28856
|
const details = {};
|
|
28857
|
-
const instructionResult = await
|
|
28857
|
+
const instructionResult = await ensureProviderInstructionFile3("cursor", projectDir, {});
|
|
28858
28858
|
const cursorFilesUpdated = this.updateInstructionFiles(projectDir);
|
|
28859
28859
|
instructionFileUpdated = instructionResult.action !== "intact" || cursorFilesUpdated;
|
|
28860
28860
|
if (instructionFileUpdated) {
|
|
@@ -28885,13 +28885,13 @@ var init_install2 = __esm({
|
|
|
28885
28885
|
*/
|
|
28886
28886
|
async isInstalled() {
|
|
28887
28887
|
const mdcPath = join16(process.cwd(), ".cursor", "rules", "cleo.mdc");
|
|
28888
|
-
if (
|
|
28888
|
+
if (existsSync11(mdcPath)) {
|
|
28889
28889
|
return true;
|
|
28890
28890
|
}
|
|
28891
28891
|
const rulesPath = join16(process.cwd(), ".cursorrules");
|
|
28892
|
-
if (
|
|
28892
|
+
if (existsSync11(rulesPath)) {
|
|
28893
28893
|
try {
|
|
28894
|
-
const content =
|
|
28894
|
+
const content = readFileSync7(rulesPath, "utf-8");
|
|
28895
28895
|
const injectionRef = `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`;
|
|
28896
28896
|
if (content.includes(injectionRef) || content.includes("@.cleo/memory-bridge.md")) {
|
|
28897
28897
|
return true;
|
|
@@ -28910,7 +28910,7 @@ var init_install2 = __esm({
|
|
|
28910
28910
|
* @param projectDir - Project root directory
|
|
28911
28911
|
*/
|
|
28912
28912
|
async ensureInstructionReferences(projectDir) {
|
|
28913
|
-
await
|
|
28913
|
+
await ensureProviderInstructionFile3("cursor", projectDir, {});
|
|
28914
28914
|
this.updateInstructionFiles(projectDir);
|
|
28915
28915
|
}
|
|
28916
28916
|
/**
|
|
@@ -28941,10 +28941,10 @@ var init_install2 = __esm({
|
|
|
28941
28941
|
*/
|
|
28942
28942
|
updateLegacyRules(projectDir) {
|
|
28943
28943
|
const rulesPath = join16(projectDir, ".cursorrules");
|
|
28944
|
-
if (!
|
|
28944
|
+
if (!existsSync11(rulesPath)) {
|
|
28945
28945
|
return false;
|
|
28946
28946
|
}
|
|
28947
|
-
let content =
|
|
28947
|
+
let content = readFileSync7(rulesPath, "utf-8");
|
|
28948
28948
|
const cursorRefs = [
|
|
28949
28949
|
`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
|
|
28950
28950
|
"@.cleo/memory-bridge.md"
|
|
@@ -28955,7 +28955,7 @@ var init_install2 = __esm({
|
|
|
28955
28955
|
}
|
|
28956
28956
|
const separator = content.endsWith("\n") ? "" : "\n";
|
|
28957
28957
|
content = content + separator + missingRefs.join("\n") + "\n";
|
|
28958
|
-
|
|
28958
|
+
writeFileSync4(rulesPath, content, "utf-8");
|
|
28959
28959
|
return true;
|
|
28960
28960
|
}
|
|
28961
28961
|
/**
|
|
@@ -28984,14 +28984,14 @@ var init_install2 = __esm({
|
|
|
28984
28984
|
...cursorRefs,
|
|
28985
28985
|
""
|
|
28986
28986
|
].join("\n");
|
|
28987
|
-
if (
|
|
28988
|
-
const existing =
|
|
28987
|
+
if (existsSync11(mdcPath)) {
|
|
28988
|
+
const existing = readFileSync7(mdcPath, "utf-8");
|
|
28989
28989
|
if (existing === expectedContent) {
|
|
28990
28990
|
return false;
|
|
28991
28991
|
}
|
|
28992
28992
|
}
|
|
28993
28993
|
mkdirSync4(rulesDir, { recursive: true });
|
|
28994
|
-
|
|
28994
|
+
writeFileSync4(mdcPath, expectedContent, "utf-8");
|
|
28995
28995
|
return true;
|
|
28996
28996
|
}
|
|
28997
28997
|
/**
|
|
@@ -28999,7 +28999,7 @@ var init_install2 = __esm({
|
|
|
28999
28999
|
*/
|
|
29000
29000
|
getUpdatedFileList(projectDir) {
|
|
29001
29001
|
const files = [];
|
|
29002
|
-
if (
|
|
29002
|
+
if (existsSync11(join16(projectDir, ".cursorrules"))) {
|
|
29003
29003
|
files.push(join16(projectDir, ".cursorrules"));
|
|
29004
29004
|
}
|
|
29005
29005
|
files.push(join16(projectDir, ".cursor", "rules", "cleo.mdc"));
|
|
@@ -29059,9 +29059,9 @@ var init_install2 = __esm({
|
|
|
29059
29059
|
registerPreCompactHook(projectDir, shimPath) {
|
|
29060
29060
|
const hooksJsonPath = join16(projectDir, ".cursor", "hooks.json");
|
|
29061
29061
|
let config2 = {};
|
|
29062
|
-
if (
|
|
29062
|
+
if (existsSync11(hooksJsonPath)) {
|
|
29063
29063
|
try {
|
|
29064
|
-
config2 = JSON.parse(
|
|
29064
|
+
config2 = JSON.parse(readFileSync7(hooksJsonPath, "utf-8"));
|
|
29065
29065
|
} catch {
|
|
29066
29066
|
}
|
|
29067
29067
|
}
|
|
@@ -29081,7 +29081,7 @@ var init_install2 = __esm({
|
|
|
29081
29081
|
hooks.preCompact = entries;
|
|
29082
29082
|
config2.hooks = hooks;
|
|
29083
29083
|
mkdirSync4(join16(projectDir, ".cursor"), { recursive: true });
|
|
29084
|
-
|
|
29084
|
+
writeFileSync4(hooksJsonPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
29085
29085
|
return true;
|
|
29086
29086
|
}
|
|
29087
29087
|
};
|
|
@@ -29089,7 +29089,7 @@ var init_install2 = __esm({
|
|
|
29089
29089
|
});
|
|
29090
29090
|
|
|
29091
29091
|
// packages/adapters/src/providers/cursor/adapter.ts
|
|
29092
|
-
import { existsSync as
|
|
29092
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
29093
29093
|
import { join as join17 } from "node:path";
|
|
29094
29094
|
var CursorAdapter;
|
|
29095
29095
|
var init_adapter2 = __esm({
|
|
@@ -29185,13 +29185,13 @@ var init_adapter2 = __esm({
|
|
|
29185
29185
|
let configExists = false;
|
|
29186
29186
|
if (this.projectDir) {
|
|
29187
29187
|
const cursorConfigDir = join17(this.projectDir, ".cursor");
|
|
29188
|
-
configExists =
|
|
29188
|
+
configExists = existsSync12(cursorConfigDir);
|
|
29189
29189
|
details.configDirExists = configExists;
|
|
29190
29190
|
}
|
|
29191
29191
|
const editorEnvSet = process.env.CURSOR_EDITOR !== void 0;
|
|
29192
29192
|
details.editorEnvSet = editorEnvSet;
|
|
29193
29193
|
if (this.projectDir) {
|
|
29194
|
-
const legacyRulesExist =
|
|
29194
|
+
const legacyRulesExist = existsSync12(join17(this.projectDir, ".cursorrules"));
|
|
29195
29195
|
details.legacyRulesExist = legacyRulesExist;
|
|
29196
29196
|
}
|
|
29197
29197
|
const healthy = configExists || editorEnvSet;
|
|
@@ -29395,18 +29395,15 @@ var init_hooks3 = __esm({
|
|
|
29395
29395
|
});
|
|
29396
29396
|
|
|
29397
29397
|
// packages/adapters/src/providers/opencode/install.ts
|
|
29398
|
-
import { existsSync as
|
|
29398
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync5, readFileSync as readFileSync10, writeFileSync as writeFileSync5 } from "node:fs";
|
|
29399
29399
|
import { join as join23 } from "node:path";
|
|
29400
|
-
|
|
29400
|
+
import { ensureProviderInstructionFile as ensureProviderInstructionFile6 } from "@cleocode/caamp";
|
|
29401
|
+
var OpenCodeInstallProvider;
|
|
29401
29402
|
var init_install3 = __esm({
|
|
29402
29403
|
"packages/adapters/src/providers/opencode/install.ts"() {
|
|
29403
29404
|
"use strict";
|
|
29404
29405
|
init_hook_template_installer();
|
|
29405
29406
|
init_paths2();
|
|
29406
|
-
INSTRUCTION_REFERENCES4 = [
|
|
29407
|
-
`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
|
|
29408
|
-
"@.cleo/memory-bridge.md"
|
|
29409
|
-
];
|
|
29410
29407
|
OpenCodeInstallProvider = class {
|
|
29411
29408
|
/**
|
|
29412
29409
|
* Install CLEO into an OpenCode project.
|
|
@@ -29417,11 +29414,14 @@ var init_install3 = __esm({
|
|
|
29417
29414
|
async install(options) {
|
|
29418
29415
|
const { projectDir } = options;
|
|
29419
29416
|
const installedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
29420
|
-
let instructionFileUpdated = false;
|
|
29421
29417
|
const details = {};
|
|
29422
|
-
|
|
29418
|
+
const instructResult = await ensureProviderInstructionFile6("opencode", projectDir, {
|
|
29419
|
+
scope: "project",
|
|
29420
|
+
references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"]
|
|
29421
|
+
});
|
|
29422
|
+
const instructionFileUpdated = instructResult.action !== "intact";
|
|
29423
29423
|
if (instructionFileUpdated) {
|
|
29424
|
-
details.instructionFile = join23(projectDir,
|
|
29424
|
+
details.instructionFile = join23(projectDir, instructResult.instructFile);
|
|
29425
29425
|
}
|
|
29426
29426
|
const hookResult = this.installHookTemplates(projectDir);
|
|
29427
29427
|
if (hookResult) {
|
|
@@ -29444,57 +29444,34 @@ var init_install3 = __esm({
|
|
|
29444
29444
|
/**
|
|
29445
29445
|
* Check whether CLEO is installed in the current environment.
|
|
29446
29446
|
*
|
|
29447
|
-
*
|
|
29447
|
+
* Delegates to CAAMP's instruction-file check.
|
|
29448
29448
|
*/
|
|
29449
29449
|
async isInstalled() {
|
|
29450
|
-
|
|
29451
|
-
|
|
29452
|
-
|
|
29453
|
-
|
|
29454
|
-
|
|
29455
|
-
|
|
29456
|
-
|
|
29457
|
-
}
|
|
29458
|
-
|
|
29450
|
+
try {
|
|
29451
|
+
const result = await ensureProviderInstructionFile6("opencode", process.cwd(), {
|
|
29452
|
+
scope: "project",
|
|
29453
|
+
references: [
|
|
29454
|
+
`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
|
|
29455
|
+
"@.cleo/memory-bridge.md"
|
|
29456
|
+
]
|
|
29457
|
+
});
|
|
29458
|
+
return result.action === "intact";
|
|
29459
|
+
} catch {
|
|
29460
|
+
return false;
|
|
29459
29461
|
}
|
|
29460
|
-
return false;
|
|
29461
29462
|
}
|
|
29462
29463
|
/**
|
|
29463
29464
|
* Ensure AGENTS.md contains @-references to CLEO instruction files.
|
|
29464
29465
|
*
|
|
29465
|
-
*
|
|
29466
|
+
* Delegates to CAAMP's canonical {@link ensureProviderInstructionFile}.
|
|
29466
29467
|
*
|
|
29467
29468
|
* @param projectDir - Project root directory
|
|
29468
29469
|
*/
|
|
29469
29470
|
async ensureInstructionReferences(projectDir) {
|
|
29470
|
-
|
|
29471
|
-
|
|
29472
|
-
|
|
29473
|
-
|
|
29474
|
-
*
|
|
29475
|
-
* @returns true if the file was created or modified
|
|
29476
|
-
*/
|
|
29477
|
-
updateInstructionFile(projectDir) {
|
|
29478
|
-
const agentsMdPath = join23(projectDir, "AGENTS.md");
|
|
29479
|
-
let content = "";
|
|
29480
|
-
let existed = false;
|
|
29481
|
-
if (existsSync18(agentsMdPath)) {
|
|
29482
|
-
content = readFileSync11(agentsMdPath, "utf-8");
|
|
29483
|
-
existed = true;
|
|
29484
|
-
}
|
|
29485
|
-
const missingRefs = INSTRUCTION_REFERENCES4.filter((ref) => !content.includes(ref));
|
|
29486
|
-
if (missingRefs.length === 0) {
|
|
29487
|
-
return false;
|
|
29488
|
-
}
|
|
29489
|
-
const refsBlock = missingRefs.join("\n");
|
|
29490
|
-
if (existed) {
|
|
29491
|
-
const separator = content.endsWith("\n") ? "" : "\n";
|
|
29492
|
-
content = content + separator + refsBlock + "\n";
|
|
29493
|
-
} else {
|
|
29494
|
-
content = refsBlock + "\n";
|
|
29495
|
-
}
|
|
29496
|
-
writeFileSync8(agentsMdPath, content, "utf-8");
|
|
29497
|
-
return true;
|
|
29471
|
+
await ensureProviderInstructionFile6("opencode", projectDir, {
|
|
29472
|
+
scope: "project",
|
|
29473
|
+
references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"]
|
|
29474
|
+
});
|
|
29498
29475
|
}
|
|
29499
29476
|
/**
|
|
29500
29477
|
* Install the CLEO PreCompact hook templates for OpenCode (T1013).
|
|
@@ -29580,16 +29557,16 @@ var init_install3 = __esm({
|
|
|
29580
29557
|
"}",
|
|
29581
29558
|
""
|
|
29582
29559
|
].join("\n");
|
|
29583
|
-
if (
|
|
29560
|
+
if (existsSync17(pluginPath)) {
|
|
29584
29561
|
try {
|
|
29585
|
-
if (
|
|
29562
|
+
if (readFileSync10(pluginPath, "utf-8") === generated) {
|
|
29586
29563
|
return false;
|
|
29587
29564
|
}
|
|
29588
29565
|
} catch {
|
|
29589
29566
|
}
|
|
29590
29567
|
}
|
|
29591
29568
|
mkdirSync5(pluginsDir, { recursive: true });
|
|
29592
|
-
|
|
29569
|
+
writeFileSync5(pluginPath, generated, "utf-8");
|
|
29593
29570
|
return true;
|
|
29594
29571
|
}
|
|
29595
29572
|
};
|
|
@@ -29790,7 +29767,7 @@ var init_spawn3 = __esm({
|
|
|
29790
29767
|
|
|
29791
29768
|
// packages/adapters/src/providers/opencode/adapter.ts
|
|
29792
29769
|
import { exec as exec10 } from "node:child_process";
|
|
29793
|
-
import { existsSync as
|
|
29770
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
29794
29771
|
import { join as join25 } from "node:path";
|
|
29795
29772
|
import { promisify as promisify11 } from "node:util";
|
|
29796
29773
|
var execAsync10, OpenCodeAdapter;
|
|
@@ -29904,7 +29881,7 @@ var init_adapter3 = __esm({
|
|
|
29904
29881
|
}
|
|
29905
29882
|
if (this.projectDir) {
|
|
29906
29883
|
const openCodeConfigDir = join25(this.projectDir, ".opencode");
|
|
29907
|
-
const configExists =
|
|
29884
|
+
const configExists = existsSync18(openCodeConfigDir);
|
|
29908
29885
|
details.configDirExists = configExists;
|
|
29909
29886
|
}
|
|
29910
29887
|
const versionEnvSet = process.env.OPENCODE_VERSION !== void 0;
|
|
@@ -30113,31 +30090,16 @@ var init_hooks4 = __esm({
|
|
|
30113
30090
|
});
|
|
30114
30091
|
|
|
30115
30092
|
// packages/adapters/src/providers/pi/install.ts
|
|
30116
|
-
import { existsSync as existsSync20, mkdirSync as mkdirSync6, readFileSync as readFileSync12, writeFileSync as writeFileSync9 } from "node:fs";
|
|
30117
|
-
import { homedir as homedir14 } from "node:os";
|
|
30118
30093
|
import { join as join26 } from "node:path";
|
|
30119
|
-
|
|
30120
|
-
|
|
30121
|
-
|
|
30122
|
-
if (env === "~") return homedir14();
|
|
30123
|
-
if (env.startsWith("~/")) return join26(homedir14(), env.slice(2));
|
|
30124
|
-
return env;
|
|
30125
|
-
}
|
|
30126
|
-
const piHome = process.env["PI_HOME"];
|
|
30127
|
-
if (piHome !== void 0 && piHome.length > 0) {
|
|
30128
|
-
return join26(piHome, "agent");
|
|
30129
|
-
}
|
|
30130
|
-
return join26(homedir14(), ".pi", "agent");
|
|
30094
|
+
import { ensureProviderInstructionFile as ensureProviderInstructionFile7 } from "@cleocode/caamp";
|
|
30095
|
+
function getCleoReferences() {
|
|
30096
|
+
return [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"];
|
|
30131
30097
|
}
|
|
30132
|
-
var
|
|
30098
|
+
var PiInstallProvider;
|
|
30133
30099
|
var init_install4 = __esm({
|
|
30134
30100
|
"packages/adapters/src/providers/pi/install.ts"() {
|
|
30135
30101
|
"use strict";
|
|
30136
30102
|
init_paths2();
|
|
30137
|
-
INSTRUCTION_REFERENCES5 = [
|
|
30138
|
-
`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
|
|
30139
|
-
"@.cleo/memory-bridge.md"
|
|
30140
|
-
];
|
|
30141
30103
|
PiInstallProvider = class {
|
|
30142
30104
|
/**
|
|
30143
30105
|
* Install CLEO into a Pi coding agent project.
|
|
@@ -30149,16 +30111,23 @@ var init_install4 = __esm({
|
|
|
30149
30111
|
const { projectDir } = options;
|
|
30150
30112
|
const installedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
30151
30113
|
const details = {};
|
|
30152
|
-
const
|
|
30114
|
+
const projectResult = await ensureProviderInstructionFile7("pi", projectDir, {
|
|
30115
|
+
scope: "project",
|
|
30116
|
+
references: getCleoReferences()
|
|
30117
|
+
});
|
|
30118
|
+
const projectUpdated = projectResult.action !== "intact";
|
|
30153
30119
|
if (projectUpdated) {
|
|
30154
|
-
details.instructionFile = join26(projectDir,
|
|
30120
|
+
details.instructionFile = join26(projectDir, projectResult.instructFile);
|
|
30155
30121
|
}
|
|
30156
30122
|
let globalUpdated = false;
|
|
30157
30123
|
try {
|
|
30158
|
-
const
|
|
30159
|
-
|
|
30124
|
+
const globalResult = await ensureProviderInstructionFile7("pi", projectDir, {
|
|
30125
|
+
scope: "global",
|
|
30126
|
+
references: getCleoReferences()
|
|
30127
|
+
});
|
|
30128
|
+
globalUpdated = globalResult.action !== "intact";
|
|
30160
30129
|
if (globalUpdated) {
|
|
30161
|
-
details.globalInstructionFile =
|
|
30130
|
+
details.globalInstructionFile = globalResult.filePath;
|
|
30162
30131
|
}
|
|
30163
30132
|
} catch {
|
|
30164
30133
|
}
|
|
@@ -30180,27 +30149,23 @@ var init_install4 = __esm({
|
|
|
30180
30149
|
/**
|
|
30181
30150
|
* Check whether CLEO is installed in the current environment.
|
|
30182
30151
|
*
|
|
30183
|
-
*
|
|
30152
|
+
* Delegates to CAAMP's instruction-file check for project and global scopes.
|
|
30184
30153
|
*/
|
|
30185
30154
|
async isInstalled() {
|
|
30186
|
-
|
|
30187
|
-
|
|
30188
|
-
|
|
30189
|
-
|
|
30190
|
-
|
|
30191
|
-
|
|
30192
|
-
|
|
30193
|
-
} catch {
|
|
30194
|
-
}
|
|
30155
|
+
try {
|
|
30156
|
+
const result = await ensureProviderInstructionFile7("pi", process.cwd(), {
|
|
30157
|
+
scope: "project",
|
|
30158
|
+
references: getCleoReferences()
|
|
30159
|
+
});
|
|
30160
|
+
if (result.action === "intact") return true;
|
|
30161
|
+
} catch {
|
|
30195
30162
|
}
|
|
30196
30163
|
try {
|
|
30197
|
-
const
|
|
30198
|
-
|
|
30199
|
-
|
|
30200
|
-
|
|
30201
|
-
|
|
30202
|
-
}
|
|
30203
|
-
}
|
|
30164
|
+
const result = await ensureProviderInstructionFile7("pi", process.cwd(), {
|
|
30165
|
+
scope: "global",
|
|
30166
|
+
references: getCleoReferences()
|
|
30167
|
+
});
|
|
30168
|
+
if (result.action === "intact") return true;
|
|
30204
30169
|
} catch {
|
|
30205
30170
|
}
|
|
30206
30171
|
return false;
|
|
@@ -30208,42 +30173,15 @@ var init_install4 = __esm({
|
|
|
30208
30173
|
/**
|
|
30209
30174
|
* Ensure AGENTS.md contains @-references to CLEO instruction files.
|
|
30210
30175
|
*
|
|
30211
|
-
*
|
|
30176
|
+
* Delegates to CAAMP's canonical {@link ensureProviderInstructionFile}.
|
|
30212
30177
|
*
|
|
30213
30178
|
* @param projectDir - Project root directory
|
|
30214
30179
|
*/
|
|
30215
30180
|
async ensureInstructionReferences(projectDir) {
|
|
30216
|
-
|
|
30217
|
-
|
|
30218
|
-
|
|
30219
|
-
|
|
30220
|
-
*
|
|
30221
|
-
* @param dir - Directory containing the instruction file
|
|
30222
|
-
* @param filename - Name of the instruction file (e.g. "AGENTS.md")
|
|
30223
|
-
* @returns true if the file was created or modified
|
|
30224
|
-
*/
|
|
30225
|
-
updateInstructionFile(dir, filename) {
|
|
30226
|
-
const filePath = join26(dir, filename);
|
|
30227
|
-
let content = "";
|
|
30228
|
-
let existed = false;
|
|
30229
|
-
if (existsSync20(filePath)) {
|
|
30230
|
-
content = readFileSync12(filePath, "utf-8");
|
|
30231
|
-
existed = true;
|
|
30232
|
-
}
|
|
30233
|
-
const missingRefs = INSTRUCTION_REFERENCES5.filter((ref) => !content.includes(ref));
|
|
30234
|
-
if (missingRefs.length === 0) {
|
|
30235
|
-
return false;
|
|
30236
|
-
}
|
|
30237
|
-
const refsBlock = missingRefs.join("\n");
|
|
30238
|
-
if (existed) {
|
|
30239
|
-
const separator = content.endsWith("\n") ? "" : "\n";
|
|
30240
|
-
content = content + separator + refsBlock + "\n";
|
|
30241
|
-
} else {
|
|
30242
|
-
mkdirSync6(dir, { recursive: true });
|
|
30243
|
-
content = refsBlock + "\n";
|
|
30244
|
-
}
|
|
30245
|
-
writeFileSync9(filePath, content, "utf-8");
|
|
30246
|
-
return true;
|
|
30181
|
+
await ensureProviderInstructionFile7("pi", projectDir, {
|
|
30182
|
+
scope: "project",
|
|
30183
|
+
references: getCleoReferences()
|
|
30184
|
+
});
|
|
30247
30185
|
}
|
|
30248
30186
|
};
|
|
30249
30187
|
}
|
|
@@ -30402,22 +30340,22 @@ var init_spawn4 = __esm({
|
|
|
30402
30340
|
|
|
30403
30341
|
// packages/adapters/src/providers/pi/adapter.ts
|
|
30404
30342
|
import { exec as exec12 } from "node:child_process";
|
|
30405
|
-
import { existsSync as
|
|
30406
|
-
import { homedir as
|
|
30343
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
30344
|
+
import { homedir as homedir14 } from "node:os";
|
|
30407
30345
|
import { join as join27 } from "node:path";
|
|
30408
30346
|
import { promisify as promisify13 } from "node:util";
|
|
30409
|
-
function
|
|
30347
|
+
function getPiAgentDir() {
|
|
30410
30348
|
const env = process.env["PI_CODING_AGENT_DIR"];
|
|
30411
30349
|
if (env !== void 0 && env.length > 0) {
|
|
30412
|
-
if (env === "~") return
|
|
30413
|
-
if (env.startsWith("~/")) return join27(
|
|
30350
|
+
if (env === "~") return homedir14();
|
|
30351
|
+
if (env.startsWith("~/")) return join27(homedir14(), env.slice(2));
|
|
30414
30352
|
return env;
|
|
30415
30353
|
}
|
|
30416
30354
|
const piHome = process.env["PI_HOME"];
|
|
30417
30355
|
if (piHome !== void 0 && piHome.length > 0) {
|
|
30418
30356
|
return join27(piHome, "agent");
|
|
30419
30357
|
}
|
|
30420
|
-
return join27(
|
|
30358
|
+
return join27(homedir14(), ".pi", "agent");
|
|
30421
30359
|
}
|
|
30422
30360
|
var execAsync12, PiAdapter;
|
|
30423
30361
|
var init_adapter4 = __esm({
|
|
@@ -30534,13 +30472,13 @@ var init_adapter4 = __esm({
|
|
|
30534
30472
|
} catch {
|
|
30535
30473
|
details.cliAvailable = false;
|
|
30536
30474
|
}
|
|
30537
|
-
const agentDir =
|
|
30538
|
-
const agentDirExists =
|
|
30475
|
+
const agentDir = getPiAgentDir();
|
|
30476
|
+
const agentDirExists = existsSync19(agentDir);
|
|
30539
30477
|
details.agentDirExists = agentDirExists;
|
|
30540
30478
|
details.agentDir = agentDir;
|
|
30541
30479
|
if (this.projectDir) {
|
|
30542
30480
|
const projectPiDir = join27(this.projectDir, ".pi");
|
|
30543
|
-
details.projectPiDirExists =
|
|
30481
|
+
details.projectPiDirExists = existsSync19(projectPiDir);
|
|
30544
30482
|
}
|
|
30545
30483
|
details.piCodingAgentDirSet = process.env["PI_CODING_AGENT_DIR"] !== void 0;
|
|
30546
30484
|
details.piHomeSet = process.env["PI_HOME"] !== void 0;
|
|
@@ -30752,7 +30690,7 @@ function createAdapter2() {
|
|
|
30752
30690
|
|
|
30753
30691
|
// packages/adapters/src/providers/codex/adapter.ts
|
|
30754
30692
|
import { exec as exec3 } from "node:child_process";
|
|
30755
|
-
import { existsSync as
|
|
30693
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
30756
30694
|
import { homedir as homedir10 } from "node:os";
|
|
30757
30695
|
import { join as join15 } from "node:path";
|
|
30758
30696
|
import { promisify as promisify4 } from "node:util";
|
|
@@ -30884,12 +30822,8 @@ var CodexHookProvider = class {
|
|
|
30884
30822
|
|
|
30885
30823
|
// packages/adapters/src/providers/codex/install.ts
|
|
30886
30824
|
init_paths2();
|
|
30887
|
-
import { existsSync as existsSync10, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "node:fs";
|
|
30888
30825
|
import { join as join14 } from "node:path";
|
|
30889
|
-
|
|
30890
|
-
`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
|
|
30891
|
-
"@.cleo/memory-bridge.md"
|
|
30892
|
-
];
|
|
30826
|
+
import { ensureProviderInstructionFile as ensureProviderInstructionFile2 } from "@cleocode/caamp";
|
|
30893
30827
|
var CodexInstallProvider = class {
|
|
30894
30828
|
/**
|
|
30895
30829
|
* Install CLEO into a Codex CLI environment.
|
|
@@ -30901,11 +30835,14 @@ var CodexInstallProvider = class {
|
|
|
30901
30835
|
async install(options) {
|
|
30902
30836
|
const { projectDir } = options;
|
|
30903
30837
|
const installedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
30904
|
-
let instructionFileUpdated = false;
|
|
30905
30838
|
const details = {};
|
|
30906
|
-
|
|
30839
|
+
const result = await ensureProviderInstructionFile2("codex", projectDir, {
|
|
30840
|
+
scope: "project",
|
|
30841
|
+
references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"]
|
|
30842
|
+
});
|
|
30843
|
+
const instructionFileUpdated = result.action !== "intact";
|
|
30907
30844
|
if (instructionFileUpdated) {
|
|
30908
|
-
details.instructionFile = join14(projectDir,
|
|
30845
|
+
details.instructionFile = join14(projectDir, result.instructFile);
|
|
30909
30846
|
}
|
|
30910
30847
|
return {
|
|
30911
30848
|
success: true,
|
|
@@ -30925,60 +30862,36 @@ var CodexInstallProvider = class {
|
|
|
30925
30862
|
/**
|
|
30926
30863
|
* Check whether CLEO is installed in the Codex CLI environment.
|
|
30927
30864
|
*
|
|
30928
|
-
*
|
|
30865
|
+
* Delegates to CAAMP's instruction-file check.
|
|
30929
30866
|
* @task T162
|
|
30930
30867
|
*/
|
|
30931
30868
|
async isInstalled() {
|
|
30932
|
-
|
|
30933
|
-
|
|
30934
|
-
|
|
30935
|
-
|
|
30936
|
-
|
|
30937
|
-
|
|
30938
|
-
|
|
30939
|
-
}
|
|
30940
|
-
|
|
30869
|
+
try {
|
|
30870
|
+
const result = await ensureProviderInstructionFile2("codex", process.cwd(), {
|
|
30871
|
+
scope: "project",
|
|
30872
|
+
references: [
|
|
30873
|
+
`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
|
|
30874
|
+
"@.cleo/memory-bridge.md"
|
|
30875
|
+
]
|
|
30876
|
+
});
|
|
30877
|
+
return result.action === "intact";
|
|
30878
|
+
} catch {
|
|
30879
|
+
return false;
|
|
30941
30880
|
}
|
|
30942
|
-
return false;
|
|
30943
30881
|
}
|
|
30944
30882
|
/**
|
|
30945
30883
|
* Ensure AGENTS.md contains @-references to CLEO instruction files.
|
|
30946
30884
|
*
|
|
30947
|
-
*
|
|
30885
|
+
* Delegates to CAAMP's canonical {@link ensureProviderInstructionFile}.
|
|
30948
30886
|
*
|
|
30949
30887
|
* @param projectDir - Project root directory
|
|
30950
30888
|
* @task T162
|
|
30951
30889
|
*/
|
|
30952
30890
|
async ensureInstructionReferences(projectDir) {
|
|
30953
|
-
|
|
30954
|
-
|
|
30955
|
-
|
|
30956
|
-
|
|
30957
|
-
*
|
|
30958
|
-
* @param projectDir - Project root directory
|
|
30959
|
-
* @returns true if the file was created or modified
|
|
30960
|
-
*/
|
|
30961
|
-
updateInstructionFile(projectDir) {
|
|
30962
|
-
const agentsMdPath = join14(projectDir, "AGENTS.md");
|
|
30963
|
-
let content = "";
|
|
30964
|
-
let existed = false;
|
|
30965
|
-
if (existsSync10(agentsMdPath)) {
|
|
30966
|
-
content = readFileSync7(agentsMdPath, "utf-8");
|
|
30967
|
-
existed = true;
|
|
30968
|
-
}
|
|
30969
|
-
const missingRefs = INSTRUCTION_REFERENCES.filter((ref) => !content.includes(ref));
|
|
30970
|
-
if (missingRefs.length === 0) {
|
|
30971
|
-
return false;
|
|
30972
|
-
}
|
|
30973
|
-
const refsBlock = missingRefs.join("\n");
|
|
30974
|
-
if (existed) {
|
|
30975
|
-
const separator = content.endsWith("\n") ? "" : "\n";
|
|
30976
|
-
content = content + separator + refsBlock + "\n";
|
|
30977
|
-
} else {
|
|
30978
|
-
content = refsBlock + "\n";
|
|
30979
|
-
}
|
|
30980
|
-
writeFileSync4(agentsMdPath, content, "utf-8");
|
|
30981
|
-
return true;
|
|
30891
|
+
await ensureProviderInstructionFile2("codex", projectDir, {
|
|
30892
|
+
scope: "project",
|
|
30893
|
+
references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"]
|
|
30894
|
+
});
|
|
30982
30895
|
}
|
|
30983
30896
|
};
|
|
30984
30897
|
|
|
@@ -31068,7 +30981,7 @@ var CodexAdapter = class {
|
|
|
31068
30981
|
details.cliAvailable = false;
|
|
31069
30982
|
}
|
|
31070
30983
|
const codexConfigDir = join15(homedir10(), ".codex");
|
|
31071
|
-
const configExists =
|
|
30984
|
+
const configExists = existsSync10(codexConfigDir);
|
|
31072
30985
|
details.configDirExists = configExists;
|
|
31073
30986
|
const healthy = cliAvailable;
|
|
31074
30987
|
details.cliAvailable = cliAvailable;
|
|
@@ -31110,7 +31023,7 @@ init_cursor();
|
|
|
31110
31023
|
|
|
31111
31024
|
// packages/adapters/src/providers/gemini-cli/adapter.ts
|
|
31112
31025
|
import { exec as exec5 } from "node:child_process";
|
|
31113
|
-
import { existsSync as
|
|
31026
|
+
import { existsSync as existsSync14 } from "node:fs";
|
|
31114
31027
|
import { homedir as homedir12 } from "node:os";
|
|
31115
31028
|
import { join as join20 } from "node:path";
|
|
31116
31029
|
import { promisify as promisify6 } from "node:util";
|
|
@@ -31200,9 +31113,10 @@ var GeminiCliHookProvider = class {
|
|
|
31200
31113
|
};
|
|
31201
31114
|
|
|
31202
31115
|
// packages/adapters/src/providers/gemini-cli/install.ts
|
|
31203
|
-
|
|
31116
|
+
init_paths2();
|
|
31117
|
+
import { existsSync as existsSync13, readFileSync as readFileSync8 } from "node:fs";
|
|
31204
31118
|
import { join as join19 } from "node:path";
|
|
31205
|
-
|
|
31119
|
+
import { ensureProviderInstructionFile as ensureProviderInstructionFile4 } from "@cleocode/caamp";
|
|
31206
31120
|
var GeminiCliInstallProvider = class {
|
|
31207
31121
|
/**
|
|
31208
31122
|
* Install CLEO into a Gemini CLI environment.
|
|
@@ -31214,11 +31128,14 @@ var GeminiCliInstallProvider = class {
|
|
|
31214
31128
|
async install(options) {
|
|
31215
31129
|
const { projectDir } = options;
|
|
31216
31130
|
const installedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
31217
|
-
let instructionFileUpdated = false;
|
|
31218
31131
|
const details = {};
|
|
31219
|
-
|
|
31132
|
+
const result = await ensureProviderInstructionFile4("gemini-cli", projectDir, {
|
|
31133
|
+
references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"],
|
|
31134
|
+
scope: "project"
|
|
31135
|
+
});
|
|
31136
|
+
const instructionFileUpdated = result.action !== "intact";
|
|
31220
31137
|
if (instructionFileUpdated) {
|
|
31221
|
-
details.instructionFile =
|
|
31138
|
+
details.instructionFile = result.filePath;
|
|
31222
31139
|
}
|
|
31223
31140
|
return {
|
|
31224
31141
|
success: true,
|
|
@@ -31230,7 +31147,7 @@ var GeminiCliInstallProvider = class {
|
|
|
31230
31147
|
/**
|
|
31231
31148
|
* Uninstall CLEO from the Gemini CLI environment.
|
|
31232
31149
|
*
|
|
31233
|
-
* Does not remove
|
|
31150
|
+
* Does not remove GEMINI.md references (they are harmless if CLEO is not present).
|
|
31234
31151
|
* @task T161
|
|
31235
31152
|
*/
|
|
31236
31153
|
async uninstall() {
|
|
@@ -31238,15 +31155,16 @@ var GeminiCliInstallProvider = class {
|
|
|
31238
31155
|
/**
|
|
31239
31156
|
* Check whether CLEO is installed in the Gemini CLI environment.
|
|
31240
31157
|
*
|
|
31241
|
-
* Checks for CLEO references in
|
|
31158
|
+
* Checks for CLEO references in GEMINI.md.
|
|
31242
31159
|
* @task T161
|
|
31243
31160
|
*/
|
|
31244
31161
|
async isInstalled() {
|
|
31245
|
-
const
|
|
31246
|
-
|
|
31162
|
+
const instructionRef = `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`;
|
|
31163
|
+
const geminiMdPath = join19(process.cwd(), "GEMINI.md");
|
|
31164
|
+
if (existsSync13(geminiMdPath)) {
|
|
31247
31165
|
try {
|
|
31248
|
-
const content =
|
|
31249
|
-
if (
|
|
31166
|
+
const content = readFileSync8(geminiMdPath, "utf-8");
|
|
31167
|
+
if (content.includes(instructionRef)) {
|
|
31250
31168
|
return true;
|
|
31251
31169
|
}
|
|
31252
31170
|
} catch {
|
|
@@ -31255,43 +31173,18 @@ var GeminiCliInstallProvider = class {
|
|
|
31255
31173
|
return false;
|
|
31256
31174
|
}
|
|
31257
31175
|
/**
|
|
31258
|
-
* Ensure
|
|
31176
|
+
* Ensure GEMINI.md contains @-references to CLEO instruction files.
|
|
31259
31177
|
*
|
|
31260
|
-
* Creates
|
|
31178
|
+
* Creates GEMINI.md if it does not exist. Appends any missing references.
|
|
31261
31179
|
*
|
|
31262
31180
|
* @param projectDir - Project root directory
|
|
31263
31181
|
* @task T161
|
|
31264
31182
|
*/
|
|
31265
31183
|
async ensureInstructionReferences(projectDir) {
|
|
31266
|
-
|
|
31267
|
-
|
|
31268
|
-
|
|
31269
|
-
|
|
31270
|
-
*
|
|
31271
|
-
* @param projectDir - Project root directory
|
|
31272
|
-
* @returns true if the file was created or modified
|
|
31273
|
-
*/
|
|
31274
|
-
updateInstructionFile(projectDir) {
|
|
31275
|
-
const agentsMdPath = join19(projectDir, "AGENTS.md");
|
|
31276
|
-
let content = "";
|
|
31277
|
-
let existed = false;
|
|
31278
|
-
if (existsSync14(agentsMdPath)) {
|
|
31279
|
-
content = readFileSync9(agentsMdPath, "utf-8");
|
|
31280
|
-
existed = true;
|
|
31281
|
-
}
|
|
31282
|
-
const missingRefs = INSTRUCTION_REFERENCES2.filter((ref) => !content.includes(ref));
|
|
31283
|
-
if (missingRefs.length === 0) {
|
|
31284
|
-
return false;
|
|
31285
|
-
}
|
|
31286
|
-
const refsBlock = missingRefs.join("\n");
|
|
31287
|
-
if (existed) {
|
|
31288
|
-
const separator = content.endsWith("\n") ? "" : "\n";
|
|
31289
|
-
content = content + separator + refsBlock + "\n";
|
|
31290
|
-
} else {
|
|
31291
|
-
content = refsBlock + "\n";
|
|
31292
|
-
}
|
|
31293
|
-
writeFileSync6(agentsMdPath, content, "utf-8");
|
|
31294
|
-
return true;
|
|
31184
|
+
await ensureProviderInstructionFile4("gemini-cli", projectDir, {
|
|
31185
|
+
references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"],
|
|
31186
|
+
scope: "project"
|
|
31187
|
+
});
|
|
31295
31188
|
}
|
|
31296
31189
|
};
|
|
31297
31190
|
|
|
@@ -31392,7 +31285,7 @@ var GeminiCliAdapter = class {
|
|
|
31392
31285
|
details.cliAvailable = false;
|
|
31393
31286
|
}
|
|
31394
31287
|
const geminiConfigDir = join20(homedir12(), ".gemini");
|
|
31395
|
-
const configExists =
|
|
31288
|
+
const configExists = existsSync14(geminiConfigDir);
|
|
31396
31289
|
details.configDirExists = configExists;
|
|
31397
31290
|
const healthy = cliAvailable;
|
|
31398
31291
|
details.cliAvailable = cliAvailable;
|
|
@@ -31431,7 +31324,7 @@ function createAdapter5() {
|
|
|
31431
31324
|
|
|
31432
31325
|
// packages/adapters/src/providers/kimi/adapter.ts
|
|
31433
31326
|
import { exec as exec7 } from "node:child_process";
|
|
31434
|
-
import { existsSync as
|
|
31327
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
31435
31328
|
import { homedir as homedir13 } from "node:os";
|
|
31436
31329
|
import { join as join22 } from "node:path";
|
|
31437
31330
|
import { promisify as promisify8 } from "node:util";
|
|
@@ -31492,9 +31385,10 @@ var KimiHookProvider = class {
|
|
|
31492
31385
|
};
|
|
31493
31386
|
|
|
31494
31387
|
// packages/adapters/src/providers/kimi/install.ts
|
|
31495
|
-
|
|
31388
|
+
init_paths2();
|
|
31389
|
+
import { existsSync as existsSync15, readFileSync as readFileSync9 } from "node:fs";
|
|
31496
31390
|
import { join as join21 } from "node:path";
|
|
31497
|
-
|
|
31391
|
+
import { ensureProviderInstructionFile as ensureProviderInstructionFile5 } from "@cleocode/caamp";
|
|
31498
31392
|
var KimiInstallProvider = class {
|
|
31499
31393
|
/**
|
|
31500
31394
|
* Install CLEO into a Kimi environment.
|
|
@@ -31506,11 +31400,14 @@ var KimiInstallProvider = class {
|
|
|
31506
31400
|
async install(options) {
|
|
31507
31401
|
const { projectDir } = options;
|
|
31508
31402
|
const installedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
31509
|
-
let instructionFileUpdated = false;
|
|
31510
31403
|
const details = {};
|
|
31511
|
-
|
|
31404
|
+
const result = await ensureProviderInstructionFile5("kimi", projectDir, {
|
|
31405
|
+
references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"],
|
|
31406
|
+
scope: "project"
|
|
31407
|
+
});
|
|
31408
|
+
const instructionFileUpdated = result.action !== "intact";
|
|
31512
31409
|
if (instructionFileUpdated) {
|
|
31513
|
-
details.instructionFile =
|
|
31410
|
+
details.instructionFile = result.filePath;
|
|
31514
31411
|
}
|
|
31515
31412
|
return {
|
|
31516
31413
|
success: true,
|
|
@@ -31534,11 +31431,12 @@ var KimiInstallProvider = class {
|
|
|
31534
31431
|
* @task T163
|
|
31535
31432
|
*/
|
|
31536
31433
|
async isInstalled() {
|
|
31434
|
+
const instructionRef = `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`;
|
|
31537
31435
|
const agentsMdPath = join21(process.cwd(), "AGENTS.md");
|
|
31538
|
-
if (
|
|
31436
|
+
if (existsSync15(agentsMdPath)) {
|
|
31539
31437
|
try {
|
|
31540
|
-
const content =
|
|
31541
|
-
if (
|
|
31438
|
+
const content = readFileSync9(agentsMdPath, "utf-8");
|
|
31439
|
+
if (content.includes(instructionRef)) {
|
|
31542
31440
|
return true;
|
|
31543
31441
|
}
|
|
31544
31442
|
} catch {
|
|
@@ -31555,35 +31453,10 @@ var KimiInstallProvider = class {
|
|
|
31555
31453
|
* @task T163
|
|
31556
31454
|
*/
|
|
31557
31455
|
async ensureInstructionReferences(projectDir) {
|
|
31558
|
-
|
|
31559
|
-
|
|
31560
|
-
|
|
31561
|
-
|
|
31562
|
-
*
|
|
31563
|
-
* @param projectDir - Project root directory
|
|
31564
|
-
* @returns true if the file was created or modified
|
|
31565
|
-
*/
|
|
31566
|
-
updateInstructionFile(projectDir) {
|
|
31567
|
-
const agentsMdPath = join21(projectDir, "AGENTS.md");
|
|
31568
|
-
let content = "";
|
|
31569
|
-
let existed = false;
|
|
31570
|
-
if (existsSync16(agentsMdPath)) {
|
|
31571
|
-
content = readFileSync10(agentsMdPath, "utf-8");
|
|
31572
|
-
existed = true;
|
|
31573
|
-
}
|
|
31574
|
-
const missingRefs = INSTRUCTION_REFERENCES3.filter((ref) => !content.includes(ref));
|
|
31575
|
-
if (missingRefs.length === 0) {
|
|
31576
|
-
return false;
|
|
31577
|
-
}
|
|
31578
|
-
const refsBlock = missingRefs.join("\n");
|
|
31579
|
-
if (existed) {
|
|
31580
|
-
const separator = content.endsWith("\n") ? "" : "\n";
|
|
31581
|
-
content = content + separator + refsBlock + "\n";
|
|
31582
|
-
} else {
|
|
31583
|
-
content = refsBlock + "\n";
|
|
31584
|
-
}
|
|
31585
|
-
writeFileSync7(agentsMdPath, content, "utf-8");
|
|
31586
|
-
return true;
|
|
31456
|
+
await ensureProviderInstructionFile5("kimi", projectDir, {
|
|
31457
|
+
references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, "@.cleo/memory-bridge.md"],
|
|
31458
|
+
scope: "project"
|
|
31459
|
+
});
|
|
31587
31460
|
}
|
|
31588
31461
|
};
|
|
31589
31462
|
|
|
@@ -31671,7 +31544,7 @@ var KimiAdapter = class {
|
|
|
31671
31544
|
details.cliAvailable = false;
|
|
31672
31545
|
}
|
|
31673
31546
|
const kimiConfigDir = join22(homedir13(), ".kimi");
|
|
31674
|
-
const configExists =
|
|
31547
|
+
const configExists = existsSync16(kimiConfigDir);
|
|
31675
31548
|
details.configDirExists = configExists;
|
|
31676
31549
|
const healthy = cliAvailable;
|
|
31677
31550
|
details.cliAvailable = cliAvailable;
|
|
@@ -31713,7 +31586,7 @@ init_opencode();
|
|
|
31713
31586
|
init_hook_template_installer();
|
|
31714
31587
|
|
|
31715
31588
|
// packages/adapters/src/registry.ts
|
|
31716
|
-
import { readFileSync as
|
|
31589
|
+
import { readFileSync as readFileSync11 } from "node:fs";
|
|
31717
31590
|
import { dirname as dirname4, join as join28, resolve as resolve2 } from "node:path";
|
|
31718
31591
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
31719
31592
|
var PROVIDER_IDS = ["claude-code", "opencode", "cursor", "pi"];
|
|
@@ -31723,7 +31596,7 @@ function getProviderManifests() {
|
|
|
31723
31596
|
for (const providerId of PROVIDER_IDS) {
|
|
31724
31597
|
try {
|
|
31725
31598
|
const manifestPath = join28(baseDir, providerId, "manifest.json");
|
|
31726
|
-
const raw =
|
|
31599
|
+
const raw = readFileSync11(manifestPath, "utf-8");
|
|
31727
31600
|
manifests.push(JSON.parse(raw));
|
|
31728
31601
|
} catch {
|
|
31729
31602
|
}
|