@cleocode/adapters 2026.4.88 → 2026.4.92

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 CHANGED
@@ -20752,6 +20752,45 @@ var init_hooks = __esm({
20752
20752
  }
20753
20753
  });
20754
20754
 
20755
+ // packages/adapters/src/providers/shared/paths.ts
20756
+ import { homedir as homedir6 } from "node:os";
20757
+ import { join as join7 } from "node:path";
20758
+ function getAdapterCleoHome() {
20759
+ if (process.env["CLEO_HOME"]) {
20760
+ return process.env["CLEO_HOME"];
20761
+ }
20762
+ const home = homedir6();
20763
+ if (process.platform === "darwin") {
20764
+ return join7(home, "Library", "Application Support", "cleo");
20765
+ }
20766
+ if (process.platform === "win32") {
20767
+ const localAppData = process.env["LOCALAPPDATA"];
20768
+ if (localAppData) {
20769
+ return join7(localAppData, "cleo", "Data");
20770
+ }
20771
+ return join7(home, "AppData", "Local", "cleo", "Data");
20772
+ }
20773
+ const xdgData = process.env["XDG_DATA_HOME"];
20774
+ if (xdgData) {
20775
+ return join7(xdgData, "cleo");
20776
+ }
20777
+ return join7(home, ".local", "share", "cleo");
20778
+ }
20779
+ function getCleoTemplatesTildePath() {
20780
+ const absPath = join7(getAdapterCleoHome(), "templates");
20781
+ const home = homedir6();
20782
+ if (absPath.startsWith(home)) {
20783
+ const relative = absPath.slice(home.length).replace(/\\/g, "/");
20784
+ return `~${relative}`;
20785
+ }
20786
+ return absPath;
20787
+ }
20788
+ var init_paths2 = __esm({
20789
+ "packages/adapters/src/providers/shared/paths.ts"() {
20790
+ "use strict";
20791
+ }
20792
+ });
20793
+
20755
20794
  // packages/adapters/src/providers/claude-code/install.ts
20756
20795
  import {
20757
20796
  copyFileSync as copyFileSync2,
@@ -20761,18 +20800,22 @@ import {
20761
20800
  readFileSync as readFileSync6,
20762
20801
  writeFileSync as writeFileSync3
20763
20802
  } from "node:fs";
20764
- import { homedir as homedir6 } from "node:os";
20765
- import { dirname as dirname2, join as join7 } from "node:path";
20803
+ import { homedir as homedir7 } from "node:os";
20804
+ import { dirname as dirname2, join as join8 } from "node:path";
20766
20805
  import { fileURLToPath } from "node:url";
20767
20806
  function getAdapterCommandsDir() {
20768
20807
  const thisDir = dirname2(fileURLToPath(import.meta.url));
20769
- return join7(thisDir, "commands");
20808
+ return join8(thisDir, "commands");
20770
20809
  }
20771
20810
  var INSTRUCTION_REFERENCES, ClaudeCodeInstallProvider;
20772
20811
  var init_install = __esm({
20773
20812
  "packages/adapters/src/providers/claude-code/install.ts"() {
20774
20813
  "use strict";
20775
- INSTRUCTION_REFERENCES = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
20814
+ init_paths2();
20815
+ INSTRUCTION_REFERENCES = [
20816
+ `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
20817
+ "@.cleo/memory-bridge.md"
20818
+ ];
20776
20819
  ClaudeCodeInstallProvider = class {
20777
20820
  /**
20778
20821
  * Install CLEO into a Claude Code project.
@@ -20787,7 +20830,7 @@ var init_install = __esm({
20787
20830
  const details = {};
20788
20831
  instructionFileUpdated = this.updateInstructionFile(projectDir);
20789
20832
  if (instructionFileUpdated) {
20790
- details.instructionFile = join7(projectDir, "CLAUDE.md");
20833
+ details.instructionFile = join8(projectDir, "CLAUDE.md");
20791
20834
  }
20792
20835
  const commandsInstalled = this.installCommands(projectDir);
20793
20836
  if (commandsInstalled.length > 0) {
@@ -20817,7 +20860,7 @@ var init_install = __esm({
20817
20860
  * Checks for plugin enabled in ~/.claude/settings.json.
20818
20861
  */
20819
20862
  async isInstalled() {
20820
- const settingsPath = join7(homedir6(), ".claude", "settings.json");
20863
+ const settingsPath = join8(homedir7(), ".claude", "settings.json");
20821
20864
  if (existsSync7(settingsPath)) {
20822
20865
  try {
20823
20866
  const settings = JSON.parse(readFileSync6(settingsPath, "utf-8"));
@@ -20846,7 +20889,7 @@ var init_install = __esm({
20846
20889
  * @returns true if the file was created or modified
20847
20890
  */
20848
20891
  updateInstructionFile(projectDir) {
20849
- const claudeMdPath = join7(projectDir, "CLAUDE.md");
20892
+ const claudeMdPath = join8(projectDir, "CLAUDE.md");
20850
20893
  let content = "";
20851
20894
  let existed = false;
20852
20895
  if (existsSync7(claudeMdPath)) {
@@ -20881,13 +20924,13 @@ var init_install = __esm({
20881
20924
  if (!existsSync7(adapterCommandsDir)) {
20882
20925
  return [];
20883
20926
  }
20884
- const targetDir = join7(projectDir, ".claude", "commands");
20927
+ const targetDir = join8(projectDir, ".claude", "commands");
20885
20928
  mkdirSync3(targetDir, { recursive: true });
20886
20929
  const installed = [];
20887
20930
  const files = readdirSync3(adapterCommandsDir).filter((f6) => f6.endsWith(".md"));
20888
20931
  for (const file of files) {
20889
- const src = join7(adapterCommandsDir, file);
20890
- const dest = join7(targetDir, file);
20932
+ const src = join8(adapterCommandsDir, file);
20933
+ const dest = join8(targetDir, file);
20891
20934
  copyFileSync2(src, dest);
20892
20935
  installed.push(file);
20893
20936
  }
@@ -20899,8 +20942,8 @@ var init_install = __esm({
20899
20942
  * @returns Description of what was registered, or null if no change needed
20900
20943
  */
20901
20944
  registerPlugin() {
20902
- const home = homedir6();
20903
- const settingsPath = join7(home, ".claude", "settings.json");
20945
+ const home = homedir7();
20946
+ const settingsPath = join8(home, ".claude", "settings.json");
20904
20947
  let settings = {};
20905
20948
  if (existsSync7(settingsPath)) {
20906
20949
  try {
@@ -20918,7 +20961,7 @@ var init_install = __esm({
20918
20961
  }
20919
20962
  enabledPlugins[pluginKey] = true;
20920
20963
  settings.enabledPlugins = enabledPlugins;
20921
- mkdirSync3(join7(home, ".claude"), { recursive: true });
20964
+ mkdirSync3(join8(home, ".claude"), { recursive: true });
20922
20965
  writeFileSync3(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
20923
20966
  return `Enabled ${pluginKey} in ~/.claude/settings.json`;
20924
20967
  }
@@ -21088,7 +21131,7 @@ var init_spawn2 = __esm({
21088
21131
 
21089
21132
  // packages/adapters/src/providers/claude-code/task-sync.ts
21090
21133
  import { readFile as readFile2, stat } from "node:fs/promises";
21091
- import { join as join8 } from "node:path";
21134
+ import { join as join9 } from "node:path";
21092
21135
  function parseTaskId(content) {
21093
21136
  const match = content.match(/^\[T(\d+)\]/);
21094
21137
  return match ? `T${match[1]}` : null;
@@ -21109,7 +21152,7 @@ function mapStatus(twStatus) {
21109
21152
  }
21110
21153
  }
21111
21154
  function getTodoWriteFilePath(projectDir) {
21112
- return join8(projectDir, ".cleo", "sync", "todowrite-state.json");
21155
+ return join9(projectDir, ".cleo", "sync", "todowrite-state.json");
21113
21156
  }
21114
21157
  var ClaudeCodeTaskSyncProvider;
21115
21158
  var init_task_sync = __esm({
@@ -21182,8 +21225,8 @@ var init_transport = __esm({
21182
21225
  // packages/adapters/src/providers/claude-code/adapter.ts
21183
21226
  import { exec as exec2 } from "node:child_process";
21184
21227
  import { existsSync as existsSync8 } from "node:fs";
21185
- import { homedir as homedir7 } from "node:os";
21186
- import { join as join9 } from "node:path";
21228
+ import { homedir as homedir8 } from "node:os";
21229
+ import { join as join10 } from "node:path";
21187
21230
  import { promisify as promisify3 } from "node:util";
21188
21231
  var execAsync2, ClaudeCodeAdapter;
21189
21232
  var init_adapter = __esm({
@@ -21340,7 +21383,7 @@ var init_adapter = __esm({
21340
21383
  } catch {
21341
21384
  details.cliAvailable = false;
21342
21385
  }
21343
- const claudeConfigDir = join9(homedir7(), ".claude");
21386
+ const claudeConfigDir = join10(homedir8(), ".claude");
21344
21387
  const configExists = existsSync8(claudeConfigDir);
21345
21388
  details.configDirExists = configExists;
21346
21389
  const entrypointSet = process.env.CLAUDE_CODE_ENTRYPOINT !== void 0;
@@ -21371,10 +21414,10 @@ var init_adapter = __esm({
21371
21414
 
21372
21415
  // packages/adapters/src/providers/claude-code/statusline.ts
21373
21416
  import { existsSync as existsSync9, readFileSync as readFileSync7 } from "node:fs";
21374
- import { homedir as homedir8 } from "node:os";
21375
- import { join as join10 } from "node:path";
21417
+ import { homedir as homedir9 } from "node:os";
21418
+ import { join as join11 } from "node:path";
21376
21419
  function getClaudeSettingsPath() {
21377
- return process.env["CLAUDE_SETTINGS"] ?? join10(process.env["CLAUDE_HOME"] ?? join10(homedir8(), ".claude"), "settings.json");
21420
+ return process.env["CLAUDE_SETTINGS"] ?? join11(process.env["CLAUDE_HOME"] ?? join11(homedir9(), ".claude"), "settings.json");
21378
21421
  }
21379
21422
  function checkStatuslineIntegration() {
21380
21423
  const settingsPath = getClaudeSettingsPath();
@@ -21388,7 +21431,7 @@ function checkStatuslineIntegration() {
21388
21431
  if (cmd.includes("context-monitor.sh") || cmd.includes("cleo-statusline") || cmd.includes(".context-state.json") || cmd.includes("context-states")) {
21389
21432
  return "configured";
21390
21433
  }
21391
- const scriptPath = cmd.startsWith("~") ? cmd.replace("~", homedir8()) : cmd;
21434
+ const scriptPath = cmd.startsWith("~") ? cmd.replace("~", homedir9()) : cmd;
21392
21435
  if (existsSync9(scriptPath)) {
21393
21436
  try {
21394
21437
  const content = readFileSync7(scriptPath, "utf-8");
@@ -21405,7 +21448,7 @@ function getStatuslineConfig(cleoHome) {
21405
21448
  return {
21406
21449
  statusLine: {
21407
21450
  type: "command",
21408
- command: join10(cleoHome, "lib", "session", "context-monitor.sh")
21451
+ command: join11(cleoHome, "lib", "session", "context-monitor.sh")
21409
21452
  }
21410
21453
  };
21411
21454
  }
@@ -21617,12 +21660,16 @@ var init_hooks2 = __esm({
21617
21660
 
21618
21661
  // packages/adapters/src/providers/cursor/install.ts
21619
21662
  import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync9, writeFileSync as writeFileSync5 } from "node:fs";
21620
- import { join as join15 } from "node:path";
21663
+ import { join as join16 } from "node:path";
21621
21664
  var INSTRUCTION_REFERENCES3, CursorInstallProvider;
21622
21665
  var init_install2 = __esm({
21623
21666
  "packages/adapters/src/providers/cursor/install.ts"() {
21624
21667
  "use strict";
21625
- INSTRUCTION_REFERENCES3 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
21668
+ init_paths2();
21669
+ INSTRUCTION_REFERENCES3 = [
21670
+ `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
21671
+ "@.cleo/memory-bridge.md"
21672
+ ];
21626
21673
  CursorInstallProvider = class {
21627
21674
  /**
21628
21675
  * Install CLEO into a Cursor project.
@@ -21659,11 +21706,11 @@ var init_install2 = __esm({
21659
21706
  * Checks for .cursor/rules/cleo.mdc or .cursorrules with CLEO references.
21660
21707
  */
21661
21708
  async isInstalled() {
21662
- const mdcPath = join15(process.cwd(), ".cursor", "rules", "cleo.mdc");
21709
+ const mdcPath = join16(process.cwd(), ".cursor", "rules", "cleo.mdc");
21663
21710
  if (existsSync12(mdcPath)) {
21664
21711
  return true;
21665
21712
  }
21666
- const rulesPath = join15(process.cwd(), ".cursorrules");
21713
+ const rulesPath = join16(process.cwd(), ".cursorrules");
21667
21714
  if (existsSync12(rulesPath)) {
21668
21715
  try {
21669
21716
  const content = readFileSync9(rulesPath, "utf-8");
@@ -21709,7 +21756,7 @@ var init_install2 = __esm({
21709
21756
  * @returns true if the file was modified
21710
21757
  */
21711
21758
  updateLegacyRules(projectDir) {
21712
- const rulesPath = join15(projectDir, ".cursorrules");
21759
+ const rulesPath = join16(projectDir, ".cursorrules");
21713
21760
  if (!existsSync12(rulesPath)) {
21714
21761
  return false;
21715
21762
  }
@@ -21732,8 +21779,8 @@ var init_install2 = __esm({
21732
21779
  * @returns true if the file was created or modified
21733
21780
  */
21734
21781
  updateModernRules(projectDir) {
21735
- const rulesDir = join15(projectDir, ".cursor", "rules");
21736
- const mdcPath = join15(rulesDir, "cleo.mdc");
21782
+ const rulesDir = join16(projectDir, ".cursor", "rules");
21783
+ const mdcPath = join16(rulesDir, "cleo.mdc");
21737
21784
  const expectedContent = [
21738
21785
  "---",
21739
21786
  "description: CLEO task management protocol references",
@@ -21759,10 +21806,10 @@ var init_install2 = __esm({
21759
21806
  */
21760
21807
  getUpdatedFileList(projectDir) {
21761
21808
  const files = [];
21762
- if (existsSync12(join15(projectDir, ".cursorrules"))) {
21763
- files.push(join15(projectDir, ".cursorrules"));
21809
+ if (existsSync12(join16(projectDir, ".cursorrules"))) {
21810
+ files.push(join16(projectDir, ".cursorrules"));
21764
21811
  }
21765
- files.push(join15(projectDir, ".cursor", "rules", "cleo.mdc"));
21812
+ files.push(join16(projectDir, ".cursor", "rules", "cleo.mdc"));
21766
21813
  return files;
21767
21814
  }
21768
21815
  };
@@ -21771,7 +21818,7 @@ var init_install2 = __esm({
21771
21818
 
21772
21819
  // packages/adapters/src/providers/cursor/adapter.ts
21773
21820
  import { existsSync as existsSync13 } from "node:fs";
21774
- import { join as join16 } from "node:path";
21821
+ import { join as join17 } from "node:path";
21775
21822
  var CursorAdapter;
21776
21823
  var init_adapter2 = __esm({
21777
21824
  "packages/adapters/src/providers/cursor/adapter.ts"() {
@@ -21865,14 +21912,14 @@ var init_adapter2 = __esm({
21865
21912
  }
21866
21913
  let configExists = false;
21867
21914
  if (this.projectDir) {
21868
- const cursorConfigDir = join16(this.projectDir, ".cursor");
21915
+ const cursorConfigDir = join17(this.projectDir, ".cursor");
21869
21916
  configExists = existsSync13(cursorConfigDir);
21870
21917
  details.configDirExists = configExists;
21871
21918
  }
21872
21919
  const editorEnvSet = process.env.CURSOR_EDITOR !== void 0;
21873
21920
  details.editorEnvSet = editorEnvSet;
21874
21921
  if (this.projectDir) {
21875
- const legacyRulesExist = existsSync13(join16(this.projectDir, ".cursorrules"));
21922
+ const legacyRulesExist = existsSync13(join17(this.projectDir, ".cursorrules"));
21876
21923
  details.legacyRulesExist = legacyRulesExist;
21877
21924
  }
21878
21925
  const healthy = configExists || editorEnvSet;
@@ -22077,12 +22124,16 @@ var init_hooks3 = __esm({
22077
22124
 
22078
22125
  // packages/adapters/src/providers/opencode/install.ts
22079
22126
  import { existsSync as existsSync18, readFileSync as readFileSync12, writeFileSync as writeFileSync8 } from "node:fs";
22080
- import { join as join22 } from "node:path";
22127
+ import { join as join23 } from "node:path";
22081
22128
  var INSTRUCTION_REFERENCES6, OpenCodeInstallProvider;
22082
22129
  var init_install3 = __esm({
22083
22130
  "packages/adapters/src/providers/opencode/install.ts"() {
22084
22131
  "use strict";
22085
- INSTRUCTION_REFERENCES6 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
22132
+ init_paths2();
22133
+ INSTRUCTION_REFERENCES6 = [
22134
+ `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
22135
+ "@.cleo/memory-bridge.md"
22136
+ ];
22086
22137
  OpenCodeInstallProvider = class {
22087
22138
  /**
22088
22139
  * Install CLEO into an OpenCode project.
@@ -22097,7 +22148,7 @@ var init_install3 = __esm({
22097
22148
  const details = {};
22098
22149
  instructionFileUpdated = this.updateInstructionFile(projectDir);
22099
22150
  if (instructionFileUpdated) {
22100
- details.instructionFile = join22(projectDir, "AGENTS.md");
22151
+ details.instructionFile = join23(projectDir, "AGENTS.md");
22101
22152
  }
22102
22153
  return {
22103
22154
  success: true,
@@ -22119,7 +22170,7 @@ var init_install3 = __esm({
22119
22170
  * Checks for CLEO references in AGENTS.md.
22120
22171
  */
22121
22172
  async isInstalled() {
22122
- const agentsMdPath = join22(process.cwd(), "AGENTS.md");
22173
+ const agentsMdPath = join23(process.cwd(), "AGENTS.md");
22123
22174
  if (existsSync18(agentsMdPath)) {
22124
22175
  try {
22125
22176
  const content = readFileSync12(agentsMdPath, "utf-8");
@@ -22147,7 +22198,7 @@ var init_install3 = __esm({
22147
22198
  * @returns true if the file was created or modified
22148
22199
  */
22149
22200
  updateInstructionFile(projectDir) {
22150
- const agentsMdPath = join22(projectDir, "AGENTS.md");
22201
+ const agentsMdPath = join23(projectDir, "AGENTS.md");
22151
22202
  let content = "";
22152
22203
  let existed = false;
22153
22204
  if (existsSync18(agentsMdPath)) {
@@ -22175,7 +22226,7 @@ var init_install3 = __esm({
22175
22226
  // packages/adapters/src/providers/opencode/spawn.ts
22176
22227
  import { exec as exec9, spawn as nodeSpawn4 } from "node:child_process";
22177
22228
  import { mkdir as mkdir2, readFile as readFile4, writeFile as writeFile2 } from "node:fs/promises";
22178
- import { join as join23 } from "node:path";
22229
+ import { join as join24 } from "node:path";
22179
22230
  import { promisify as promisify10 } from "node:util";
22180
22231
  function buildOpenCodeAgentMarkdown(description, instructions) {
22181
22232
  const normalizedDesc = description.replace(/\s+/g, " ").trim();
@@ -22191,8 +22242,8 @@ function buildOpenCodeAgentMarkdown(description, instructions) {
22191
22242
  ].join("\n");
22192
22243
  }
22193
22244
  async function ensureSubagentDefinition(workingDirectory, enrichedInstructions) {
22194
- const agentDir = join23(workingDirectory, ".opencode", "agent");
22195
- const agentPath = join23(agentDir, `${OPENCODE_SUBAGENT_NAME}.md`);
22245
+ const agentDir = join24(workingDirectory, ".opencode", "agent");
22246
+ const agentPath = join24(agentDir, `${OPENCODE_SUBAGENT_NAME}.md`);
22196
22247
  const description = "CLEO task executor with protocol compliance and CANT context.";
22197
22248
  const instructions = enrichedInstructions ?? [
22198
22249
  "# CLEO Subagent",
@@ -22200,7 +22251,7 @@ async function ensureSubagentDefinition(workingDirectory, enrichedInstructions)
22200
22251
  "You are a CLEO subagent executing a delegated task.",
22201
22252
  "Follow the CLEO protocol and complete the assigned work.",
22202
22253
  "",
22203
- "@~/.cleo/templates/CLEO-INJECTION.md"
22254
+ `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`
22204
22255
  ].join("\n");
22205
22256
  const content = buildOpenCodeAgentMarkdown(description, instructions);
22206
22257
  await mkdir2(agentDir, { recursive: true });
@@ -22219,6 +22270,7 @@ var execAsync9, OPENCODE_SUBAGENT_NAME, OPENCODE_FALLBACK_AGENT, OpenCodeSpawnPr
22219
22270
  var init_spawn3 = __esm({
22220
22271
  "packages/adapters/src/providers/opencode/spawn.ts"() {
22221
22272
  "use strict";
22273
+ init_paths2();
22222
22274
  execAsync9 = promisify10(exec9);
22223
22275
  OPENCODE_SUBAGENT_NAME = "cleo-subagent";
22224
22276
  OPENCODE_FALLBACK_AGENT = "general";
@@ -22366,7 +22418,7 @@ var init_spawn3 = __esm({
22366
22418
  // packages/adapters/src/providers/opencode/adapter.ts
22367
22419
  import { exec as exec10 } from "node:child_process";
22368
22420
  import { existsSync as existsSync19 } from "node:fs";
22369
- import { join as join24 } from "node:path";
22421
+ import { join as join25 } from "node:path";
22370
22422
  import { promisify as promisify11 } from "node:util";
22371
22423
  var execAsync10, OpenCodeAdapter;
22372
22424
  var init_adapter3 = __esm({
@@ -22478,7 +22530,7 @@ var init_adapter3 = __esm({
22478
22530
  details.cliAvailable = false;
22479
22531
  }
22480
22532
  if (this.projectDir) {
22481
- const openCodeConfigDir = join24(this.projectDir, ".opencode");
22533
+ const openCodeConfigDir = join25(this.projectDir, ".opencode");
22482
22534
  const configExists = existsSync19(openCodeConfigDir);
22483
22535
  details.configDirExists = configExists;
22484
22536
  }
@@ -22689,26 +22741,30 @@ var init_hooks4 = __esm({
22689
22741
 
22690
22742
  // packages/adapters/src/providers/pi/install.ts
22691
22743
  import { existsSync as existsSync20, mkdirSync as mkdirSync5, readFileSync as readFileSync13, writeFileSync as writeFileSync9 } from "node:fs";
22692
- import { homedir as homedir14 } from "node:os";
22693
- import { join as join25 } from "node:path";
22744
+ import { homedir as homedir15 } from "node:os";
22745
+ import { join as join26 } from "node:path";
22694
22746
  function getPiAgentDir() {
22695
22747
  const env = process.env["PI_CODING_AGENT_DIR"];
22696
22748
  if (env !== void 0 && env.length > 0) {
22697
- if (env === "~") return homedir14();
22698
- if (env.startsWith("~/")) return join25(homedir14(), env.slice(2));
22749
+ if (env === "~") return homedir15();
22750
+ if (env.startsWith("~/")) return join26(homedir15(), env.slice(2));
22699
22751
  return env;
22700
22752
  }
22701
22753
  const piHome = process.env["PI_HOME"];
22702
22754
  if (piHome !== void 0 && piHome.length > 0) {
22703
- return join25(piHome, "agent");
22755
+ return join26(piHome, "agent");
22704
22756
  }
22705
- return join25(homedir14(), ".pi", "agent");
22757
+ return join26(homedir15(), ".pi", "agent");
22706
22758
  }
22707
22759
  var INSTRUCTION_REFERENCES7, PiInstallProvider;
22708
22760
  var init_install4 = __esm({
22709
22761
  "packages/adapters/src/providers/pi/install.ts"() {
22710
22762
  "use strict";
22711
- INSTRUCTION_REFERENCES7 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
22763
+ init_paths2();
22764
+ INSTRUCTION_REFERENCES7 = [
22765
+ `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
22766
+ "@.cleo/memory-bridge.md"
22767
+ ];
22712
22768
  PiInstallProvider = class {
22713
22769
  /**
22714
22770
  * Install CLEO into a Pi coding agent project.
@@ -22722,14 +22778,14 @@ var init_install4 = __esm({
22722
22778
  const details = {};
22723
22779
  const projectUpdated = this.updateInstructionFile(projectDir, "AGENTS.md");
22724
22780
  if (projectUpdated) {
22725
- details.instructionFile = join25(projectDir, "AGENTS.md");
22781
+ details.instructionFile = join26(projectDir, "AGENTS.md");
22726
22782
  }
22727
22783
  let globalUpdated = false;
22728
22784
  try {
22729
22785
  const globalDir = getPiAgentDir();
22730
22786
  globalUpdated = this.updateInstructionFile(globalDir, "AGENTS.md");
22731
22787
  if (globalUpdated) {
22732
- details.globalInstructionFile = join25(globalDir, "AGENTS.md");
22788
+ details.globalInstructionFile = join26(globalDir, "AGENTS.md");
22733
22789
  }
22734
22790
  } catch {
22735
22791
  }
@@ -22754,7 +22810,7 @@ var init_install4 = __esm({
22754
22810
  * Checks for CLEO references in the project AGENTS.md.
22755
22811
  */
22756
22812
  async isInstalled() {
22757
- const agentsMdPath = join25(process.cwd(), "AGENTS.md");
22813
+ const agentsMdPath = join26(process.cwd(), "AGENTS.md");
22758
22814
  if (existsSync20(agentsMdPath)) {
22759
22815
  try {
22760
22816
  const content = readFileSync13(agentsMdPath, "utf-8");
@@ -22765,7 +22821,7 @@ var init_install4 = __esm({
22765
22821
  }
22766
22822
  }
22767
22823
  try {
22768
- const globalPath = join25(getPiAgentDir(), "AGENTS.md");
22824
+ const globalPath = join26(getPiAgentDir(), "AGENTS.md");
22769
22825
  if (existsSync20(globalPath)) {
22770
22826
  const content = readFileSync13(globalPath, "utf-8");
22771
22827
  if (INSTRUCTION_REFERENCES7.some((ref) => content.includes(ref))) {
@@ -22794,7 +22850,7 @@ var init_install4 = __esm({
22794
22850
  * @returns true if the file was created or modified
22795
22851
  */
22796
22852
  updateInstructionFile(dir, filename) {
22797
- const filePath = join25(dir, filename);
22853
+ const filePath = join26(dir, filename);
22798
22854
  let content = "";
22799
22855
  let existed = false;
22800
22856
  if (existsSync20(filePath)) {
@@ -22974,21 +23030,21 @@ var init_spawn4 = __esm({
22974
23030
  // packages/adapters/src/providers/pi/adapter.ts
22975
23031
  import { exec as exec12 } from "node:child_process";
22976
23032
  import { existsSync as existsSync21 } from "node:fs";
22977
- import { homedir as homedir15 } from "node:os";
22978
- import { join as join26 } from "node:path";
23033
+ import { homedir as homedir16 } from "node:os";
23034
+ import { join as join27 } from "node:path";
22979
23035
  import { promisify as promisify13 } from "node:util";
22980
23036
  function getPiAgentDir2() {
22981
23037
  const env = process.env["PI_CODING_AGENT_DIR"];
22982
23038
  if (env !== void 0 && env.length > 0) {
22983
- if (env === "~") return homedir15();
22984
- if (env.startsWith("~/")) return join26(homedir15(), env.slice(2));
23039
+ if (env === "~") return homedir16();
23040
+ if (env.startsWith("~/")) return join27(homedir16(), env.slice(2));
22985
23041
  return env;
22986
23042
  }
22987
23043
  const piHome = process.env["PI_HOME"];
22988
23044
  if (piHome !== void 0 && piHome.length > 0) {
22989
- return join26(piHome, "agent");
23045
+ return join27(piHome, "agent");
22990
23046
  }
22991
- return join26(homedir15(), ".pi", "agent");
23047
+ return join27(homedir16(), ".pi", "agent");
22992
23048
  }
22993
23049
  var execAsync12, PiAdapter;
22994
23050
  var init_adapter4 = __esm({
@@ -23110,7 +23166,7 @@ var init_adapter4 = __esm({
23110
23166
  details.agentDirExists = agentDirExists;
23111
23167
  details.agentDir = agentDir;
23112
23168
  if (this.projectDir) {
23113
- const projectPiDir = join26(this.projectDir, ".pi");
23169
+ const projectPiDir = join27(this.projectDir, ".pi");
23114
23170
  details.projectPiDirExists = existsSync21(projectPiDir);
23115
23171
  }
23116
23172
  details.piCodingAgentDirSet = process.env["PI_CODING_AGENT_DIR"] !== void 0;
@@ -23179,17 +23235,17 @@ init_tool_bridge();
23179
23235
  // packages/adapters/src/providers/codex/adapter.ts
23180
23236
  import { exec as exec3 } from "node:child_process";
23181
23237
  import { existsSync as existsSync11 } from "node:fs";
23182
- import { homedir as homedir10 } from "node:os";
23183
- import { join as join14 } from "node:path";
23238
+ import { homedir as homedir11 } from "node:os";
23239
+ import { join as join15 } from "node:path";
23184
23240
  import { promisify as promisify4 } from "node:util";
23185
23241
 
23186
23242
  // packages/adapters/src/providers/codex/hooks.ts
23187
- import { homedir as homedir9 } from "node:os";
23188
- import { join as join12 } from "node:path";
23243
+ import { homedir as homedir10 } from "node:os";
23244
+ import { join as join13 } from "node:path";
23189
23245
 
23190
23246
  // packages/adapters/src/providers/shared/transcript-reader.ts
23191
23247
  import { readdir as readdir2, readFile as readFile3 } from "node:fs/promises";
23192
- import { join as join11 } from "node:path";
23248
+ import { join as join12 } from "node:path";
23193
23249
  function parseTranscriptLines(raw) {
23194
23250
  const turns = [];
23195
23251
  const lines = raw.split("\n").filter((l3) => l3.trim());
@@ -23214,7 +23270,7 @@ async function readLatestTranscript(providerDir) {
23214
23270
  if (!entry.isFile()) continue;
23215
23271
  const name = entry.name;
23216
23272
  if (name.endsWith(".json") || name.endsWith(".jsonl")) {
23217
- allFiles.push(join11(providerDir, name));
23273
+ allFiles.push(join12(providerDir, name));
23218
23274
  }
23219
23275
  }
23220
23276
  } catch {
@@ -23304,14 +23360,18 @@ var CodexHookProvider = class {
23304
23360
  * @task T162 @epic T134
23305
23361
  */
23306
23362
  async getTranscript(_sessionId, _projectDir) {
23307
- return readLatestTranscript(join12(homedir9(), ".codex"));
23363
+ return readLatestTranscript(join13(homedir10(), ".codex"));
23308
23364
  }
23309
23365
  };
23310
23366
 
23311
23367
  // packages/adapters/src/providers/codex/install.ts
23368
+ init_paths2();
23312
23369
  import { existsSync as existsSync10, readFileSync as readFileSync8, writeFileSync as writeFileSync4 } from "node:fs";
23313
- import { join as join13 } from "node:path";
23314
- var INSTRUCTION_REFERENCES2 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
23370
+ import { join as join14 } from "node:path";
23371
+ var INSTRUCTION_REFERENCES2 = [
23372
+ `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
23373
+ "@.cleo/memory-bridge.md"
23374
+ ];
23315
23375
  var CodexInstallProvider = class {
23316
23376
  /**
23317
23377
  * Install CLEO into a Codex CLI environment.
@@ -23327,7 +23387,7 @@ var CodexInstallProvider = class {
23327
23387
  const details = {};
23328
23388
  instructionFileUpdated = this.updateInstructionFile(projectDir);
23329
23389
  if (instructionFileUpdated) {
23330
- details.instructionFile = join13(projectDir, "AGENTS.md");
23390
+ details.instructionFile = join14(projectDir, "AGENTS.md");
23331
23391
  }
23332
23392
  return {
23333
23393
  success: true,
@@ -23351,7 +23411,7 @@ var CodexInstallProvider = class {
23351
23411
  * @task T162
23352
23412
  */
23353
23413
  async isInstalled() {
23354
- const agentsMdPath = join13(process.cwd(), "AGENTS.md");
23414
+ const agentsMdPath = join14(process.cwd(), "AGENTS.md");
23355
23415
  if (existsSync10(agentsMdPath)) {
23356
23416
  try {
23357
23417
  const content = readFileSync8(agentsMdPath, "utf-8");
@@ -23381,7 +23441,7 @@ var CodexInstallProvider = class {
23381
23441
  * @returns true if the file was created or modified
23382
23442
  */
23383
23443
  updateInstructionFile(projectDir) {
23384
- const agentsMdPath = join13(projectDir, "AGENTS.md");
23444
+ const agentsMdPath = join14(projectDir, "AGENTS.md");
23385
23445
  let content = "";
23386
23446
  let existed = false;
23387
23447
  if (existsSync10(agentsMdPath)) {
@@ -23489,7 +23549,7 @@ var CodexAdapter = class {
23489
23549
  } catch {
23490
23550
  details.cliAvailable = false;
23491
23551
  }
23492
- const codexConfigDir = join14(homedir10(), ".codex");
23552
+ const codexConfigDir = join15(homedir11(), ".codex");
23493
23553
  const configExists = existsSync11(codexConfigDir);
23494
23554
  details.configDirExists = configExists;
23495
23555
  const healthy = cliAvailable;
@@ -23533,13 +23593,13 @@ init_cursor();
23533
23593
  // packages/adapters/src/providers/gemini-cli/adapter.ts
23534
23594
  import { exec as exec5 } from "node:child_process";
23535
23595
  import { existsSync as existsSync15 } from "node:fs";
23536
- import { homedir as homedir12 } from "node:os";
23537
- import { join as join19 } from "node:path";
23596
+ import { homedir as homedir13 } from "node:os";
23597
+ import { join as join20 } from "node:path";
23538
23598
  import { promisify as promisify6 } from "node:util";
23539
23599
 
23540
23600
  // packages/adapters/src/providers/gemini-cli/hooks.ts
23541
- import { homedir as homedir11 } from "node:os";
23542
- import { join as join17 } from "node:path";
23601
+ import { homedir as homedir12 } from "node:os";
23602
+ import { join as join18 } from "node:path";
23543
23603
  var GEMINI_CLI_EVENT_MAP = {
23544
23604
  SessionStart: "SessionStart",
23545
23605
  SessionEnd: "SessionEnd",
@@ -23617,13 +23677,13 @@ var GeminiCliHookProvider = class {
23617
23677
  * @task T161 @epic T134
23618
23678
  */
23619
23679
  async getTranscript(_sessionId, _projectDir) {
23620
- return readLatestTranscript(join17(homedir11(), ".gemini"));
23680
+ return readLatestTranscript(join18(homedir12(), ".gemini"));
23621
23681
  }
23622
23682
  };
23623
23683
 
23624
23684
  // packages/adapters/src/providers/gemini-cli/install.ts
23625
23685
  import { existsSync as existsSync14, readFileSync as readFileSync10, writeFileSync as writeFileSync6 } from "node:fs";
23626
- import { join as join18 } from "node:path";
23686
+ import { join as join19 } from "node:path";
23627
23687
  var INSTRUCTION_REFERENCES4 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
23628
23688
  var GeminiCliInstallProvider = class {
23629
23689
  /**
@@ -23640,7 +23700,7 @@ var GeminiCliInstallProvider = class {
23640
23700
  const details = {};
23641
23701
  instructionFileUpdated = this.updateInstructionFile(projectDir);
23642
23702
  if (instructionFileUpdated) {
23643
- details.instructionFile = join18(projectDir, "AGENTS.md");
23703
+ details.instructionFile = join19(projectDir, "AGENTS.md");
23644
23704
  }
23645
23705
  return {
23646
23706
  success: true,
@@ -23664,7 +23724,7 @@ var GeminiCliInstallProvider = class {
23664
23724
  * @task T161
23665
23725
  */
23666
23726
  async isInstalled() {
23667
- const agentsMdPath = join18(process.cwd(), "AGENTS.md");
23727
+ const agentsMdPath = join19(process.cwd(), "AGENTS.md");
23668
23728
  if (existsSync14(agentsMdPath)) {
23669
23729
  try {
23670
23730
  const content = readFileSync10(agentsMdPath, "utf-8");
@@ -23694,7 +23754,7 @@ var GeminiCliInstallProvider = class {
23694
23754
  * @returns true if the file was created or modified
23695
23755
  */
23696
23756
  updateInstructionFile(projectDir) {
23697
- const agentsMdPath = join18(projectDir, "AGENTS.md");
23757
+ const agentsMdPath = join19(projectDir, "AGENTS.md");
23698
23758
  let content = "";
23699
23759
  let existed = false;
23700
23760
  if (existsSync14(agentsMdPath)) {
@@ -23813,7 +23873,7 @@ var GeminiCliAdapter = class {
23813
23873
  } catch {
23814
23874
  details.cliAvailable = false;
23815
23875
  }
23816
- const geminiConfigDir = join19(homedir12(), ".gemini");
23876
+ const geminiConfigDir = join20(homedir13(), ".gemini");
23817
23877
  const configExists = existsSync15(geminiConfigDir);
23818
23878
  details.configDirExists = configExists;
23819
23879
  const healthy = cliAvailable;
@@ -23854,8 +23914,8 @@ function createAdapter4() {
23854
23914
  // packages/adapters/src/providers/kimi/adapter.ts
23855
23915
  import { exec as exec7 } from "node:child_process";
23856
23916
  import { existsSync as existsSync17 } from "node:fs";
23857
- import { homedir as homedir13 } from "node:os";
23858
- import { join as join21 } from "node:path";
23917
+ import { homedir as homedir14 } from "node:os";
23918
+ import { join as join22 } from "node:path";
23859
23919
  import { promisify as promisify8 } from "node:util";
23860
23920
 
23861
23921
  // packages/adapters/src/providers/kimi/hooks.ts
@@ -23915,7 +23975,7 @@ var KimiHookProvider = class {
23915
23975
 
23916
23976
  // packages/adapters/src/providers/kimi/install.ts
23917
23977
  import { existsSync as existsSync16, readFileSync as readFileSync11, writeFileSync as writeFileSync7 } from "node:fs";
23918
- import { join as join20 } from "node:path";
23978
+ import { join as join21 } from "node:path";
23919
23979
  var INSTRUCTION_REFERENCES5 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
23920
23980
  var KimiInstallProvider = class {
23921
23981
  /**
@@ -23932,7 +23992,7 @@ var KimiInstallProvider = class {
23932
23992
  const details = {};
23933
23993
  instructionFileUpdated = this.updateInstructionFile(projectDir);
23934
23994
  if (instructionFileUpdated) {
23935
- details.instructionFile = join20(projectDir, "AGENTS.md");
23995
+ details.instructionFile = join21(projectDir, "AGENTS.md");
23936
23996
  }
23937
23997
  return {
23938
23998
  success: true,
@@ -23956,7 +24016,7 @@ var KimiInstallProvider = class {
23956
24016
  * @task T163
23957
24017
  */
23958
24018
  async isInstalled() {
23959
- const agentsMdPath = join20(process.cwd(), "AGENTS.md");
24019
+ const agentsMdPath = join21(process.cwd(), "AGENTS.md");
23960
24020
  if (existsSync16(agentsMdPath)) {
23961
24021
  try {
23962
24022
  const content = readFileSync11(agentsMdPath, "utf-8");
@@ -23986,7 +24046,7 @@ var KimiInstallProvider = class {
23986
24046
  * @returns true if the file was created or modified
23987
24047
  */
23988
24048
  updateInstructionFile(projectDir) {
23989
- const agentsMdPath = join20(projectDir, "AGENTS.md");
24049
+ const agentsMdPath = join21(projectDir, "AGENTS.md");
23990
24050
  let content = "";
23991
24051
  let existed = false;
23992
24052
  if (existsSync16(agentsMdPath)) {
@@ -24092,7 +24152,7 @@ var KimiAdapter = class {
24092
24152
  } catch {
24093
24153
  details.cliAvailable = false;
24094
24154
  }
24095
- const kimiConfigDir = join21(homedir13(), ".kimi");
24155
+ const kimiConfigDir = join22(homedir14(), ".kimi");
24096
24156
  const configExists = existsSync17(kimiConfigDir);
24097
24157
  details.configDirExists = configExists;
24098
24158
  const healthy = cliAvailable;
@@ -24135,7 +24195,7 @@ init_opencode();
24135
24195
 
24136
24196
  // packages/adapters/src/registry.ts
24137
24197
  import { readFileSync as readFileSync14 } from "node:fs";
24138
- import { dirname as dirname3, join as join27, resolve } from "node:path";
24198
+ import { dirname as dirname3, join as join28, resolve } from "node:path";
24139
24199
  import { fileURLToPath as fileURLToPath2 } from "node:url";
24140
24200
  var PROVIDER_IDS = ["claude-code", "opencode", "cursor", "pi"];
24141
24201
  function getProviderManifests() {
@@ -24143,7 +24203,7 @@ function getProviderManifests() {
24143
24203
  const baseDir = resolve(dirname3(fileURLToPath2(import.meta.url)), "providers");
24144
24204
  for (const providerId of PROVIDER_IDS) {
24145
24205
  try {
24146
- const manifestPath = join27(baseDir, providerId, "manifest.json");
24206
+ const manifestPath = join28(baseDir, providerId, "manifest.json");
24147
24207
  const raw = readFileSync14(manifestPath, "utf-8");
24148
24208
  manifests.push(JSON.parse(raw));
24149
24209
  } catch {