@cleocode/adapters 2026.5.28 → 2026.5.33

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
@@ -873,6 +873,13 @@ var init_facade = __esm({
873
873
  }
874
874
  });
875
875
 
876
+ // packages/contracts/src/graph.ts
877
+ var init_graph = __esm({
878
+ "packages/contracts/src/graph.ts"() {
879
+ "use strict";
880
+ }
881
+ });
882
+
876
883
  // packages/contracts/src/lafs.ts
877
884
  var init_lafs = __esm({
878
885
  "packages/contracts/src/lafs.ts"() {
@@ -1268,6 +1275,7 @@ var init_src = __esm({
1268
1275
  init_evidence_record_schema();
1269
1276
  init_exit_codes();
1270
1277
  init_facade();
1278
+ init_graph();
1271
1279
  init_lafs();
1272
1280
  init_operations();
1273
1281
  init_params();
@@ -27879,14 +27887,6 @@ var init_hook_template_installer = __esm({
27879
27887
  }
27880
27888
  });
27881
27889
 
27882
- // packages/adapters/src/providers/shared/paths.ts
27883
- import { getCleoTemplatesTildePath } from "@cleocode/paths";
27884
- var init_paths2 = __esm({
27885
- "packages/adapters/src/providers/shared/paths.ts"() {
27886
- "use strict";
27887
- }
27888
- });
27889
-
27890
27890
  // packages/adapters/src/providers/claude-code/install.ts
27891
27891
  import {
27892
27892
  copyFileSync as copyFileSync2,
@@ -27899,20 +27899,16 @@ import {
27899
27899
  import { homedir as homedir6 } from "node:os";
27900
27900
  import { dirname as dirname3, join as join7 } from "node:path";
27901
27901
  import { fileURLToPath as fileURLToPath2 } from "node:url";
27902
+ import { ensureProviderInstructionFile } from "@cleocode/caamp";
27902
27903
  function getAdapterCommandsDir() {
27903
27904
  const thisDir = dirname3(fileURLToPath2(import.meta.url));
27904
27905
  return join7(thisDir, "commands");
27905
27906
  }
27906
- var INSTRUCTION_REFERENCES, ClaudeCodeInstallProvider;
27907
+ var ClaudeCodeInstallProvider;
27907
27908
  var init_install = __esm({
27908
27909
  "packages/adapters/src/providers/claude-code/install.ts"() {
27909
27910
  "use strict";
27910
27911
  init_hook_template_installer();
27911
- init_paths2();
27912
- INSTRUCTION_REFERENCES = [
27913
- `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
27914
- "@.cleo/memory-bridge.md"
27915
- ];
27916
27912
  ClaudeCodeInstallProvider = class {
27917
27913
  /**
27918
27914
  * Install CLEO into a Claude Code project.
@@ -27925,9 +27921,10 @@ var init_install = __esm({
27925
27921
  const installedAt = (/* @__PURE__ */ new Date()).toISOString();
27926
27922
  let instructionFileUpdated = false;
27927
27923
  const details = {};
27928
- instructionFileUpdated = this.updateInstructionFile(projectDir);
27924
+ const instructionResult = await ensureProviderInstructionFile("claude-code", projectDir, {});
27925
+ instructionFileUpdated = instructionResult.action !== "intact";
27929
27926
  if (instructionFileUpdated) {
27930
- details.instructionFile = join7(projectDir, "CLAUDE.md");
27927
+ details.instructionFile = instructionResult.filePath;
27931
27928
  }
27932
27929
  const commandsInstalled = this.installCommands(projectDir);
27933
27930
  if (commandsInstalled.length > 0) {
@@ -27977,39 +27974,13 @@ var init_install = __esm({
27977
27974
  /**
27978
27975
  * Ensure CLAUDE.md contains @-references to CLEO instruction files.
27979
27976
  *
27980
- * Creates CLAUDE.md if it does not exist. Appends any missing references.
27977
+ * Delegates to CAAMP's canonical API which reads the instruction file name
27978
+ * and default references from the provider registry (T1919).
27981
27979
  *
27982
27980
  * @param projectDir - Project root directory
27983
27981
  */
27984
27982
  async ensureInstructionReferences(projectDir) {
27985
- this.updateInstructionFile(projectDir);
27986
- }
27987
- /**
27988
- * Update CLAUDE.md with CLEO @-references.
27989
- *
27990
- * @returns true if the file was created or modified
27991
- */
27992
- updateInstructionFile(projectDir) {
27993
- const claudeMdPath = join7(projectDir, "CLAUDE.md");
27994
- let content = "";
27995
- let existed = false;
27996
- if (existsSync6(claudeMdPath)) {
27997
- content = readFileSync5(claudeMdPath, "utf-8");
27998
- existed = true;
27999
- }
28000
- const missingRefs = INSTRUCTION_REFERENCES.filter((ref) => !content.includes(ref));
28001
- if (missingRefs.length === 0) {
28002
- return false;
28003
- }
28004
- const refsBlock = missingRefs.join("\n");
28005
- if (existed) {
28006
- const separator = content.endsWith("\n") ? "" : "\n";
28007
- content = content + separator + refsBlock + "\n";
28008
- } else {
28009
- content = refsBlock + "\n";
28010
- }
28011
- writeFileSync3(claudeMdPath, content, "utf-8");
28012
- return true;
27983
+ await ensureProviderInstructionFile("claude-code", projectDir, {});
28013
27984
  }
28014
27985
  /**
28015
27986
  * Install Claude Code-specific commands to .claude/commands/ in the project.
@@ -28700,6 +28671,14 @@ var init_claude_code = __esm({
28700
28671
  }
28701
28672
  });
28702
28673
 
28674
+ // packages/adapters/src/providers/shared/paths.ts
28675
+ import { getCleoTemplatesTildePath } from "@cleocode/paths";
28676
+ var init_paths2 = __esm({
28677
+ "packages/adapters/src/providers/shared/paths.ts"() {
28678
+ "use strict";
28679
+ }
28680
+ });
28681
+
28703
28682
  // packages/adapters/src/providers/cursor/hooks.ts
28704
28683
  var PROVIDER_ID2, CURSOR_EVENT_MAP, CursorHookProvider;
28705
28684
  var init_hooks2 = __esm({
@@ -28856,16 +28835,13 @@ var init_hooks2 = __esm({
28856
28835
  // packages/adapters/src/providers/cursor/install.ts
28857
28836
  import { existsSync as existsSync12, mkdirSync as mkdirSync4, readFileSync as readFileSync8, writeFileSync as writeFileSync5 } from "node:fs";
28858
28837
  import { join as join16 } from "node:path";
28859
- var INSTRUCTION_REFERENCES3, CursorInstallProvider;
28838
+ import { ensureProviderInstructionFile as ensureProviderInstructionFile2 } from "@cleocode/caamp";
28839
+ var CursorInstallProvider;
28860
28840
  var init_install2 = __esm({
28861
28841
  "packages/adapters/src/providers/cursor/install.ts"() {
28862
28842
  "use strict";
28863
28843
  init_hook_template_installer();
28864
28844
  init_paths2();
28865
- INSTRUCTION_REFERENCES3 = [
28866
- `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
28867
- "@.cleo/memory-bridge.md"
28868
- ];
28869
28845
  CursorInstallProvider = class {
28870
28846
  /**
28871
28847
  * Install CLEO into a Cursor project.
@@ -28878,7 +28854,9 @@ var init_install2 = __esm({
28878
28854
  const installedAt = (/* @__PURE__ */ new Date()).toISOString();
28879
28855
  let instructionFileUpdated = false;
28880
28856
  const details = {};
28881
- instructionFileUpdated = this.updateInstructionFiles(projectDir);
28857
+ const instructionResult = await ensureProviderInstructionFile2("cursor", projectDir, {});
28858
+ const cursorFilesUpdated = this.updateInstructionFiles(projectDir);
28859
+ instructionFileUpdated = instructionResult.action !== "intact" || cursorFilesUpdated;
28882
28860
  if (instructionFileUpdated) {
28883
28861
  details.instructionFiles = this.getUpdatedFileList(projectDir);
28884
28862
  }
@@ -28914,7 +28892,8 @@ var init_install2 = __esm({
28914
28892
  if (existsSync12(rulesPath)) {
28915
28893
  try {
28916
28894
  const content = readFileSync8(rulesPath, "utf-8");
28917
- if (INSTRUCTION_REFERENCES3.some((ref) => content.includes(ref))) {
28895
+ const injectionRef = `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`;
28896
+ if (content.includes(injectionRef) || content.includes("@.cleo/memory-bridge.md")) {
28918
28897
  return true;
28919
28898
  }
28920
28899
  } catch {
@@ -28925,11 +28904,13 @@ var init_install2 = __esm({
28925
28904
  /**
28926
28905
  * Ensure instruction files contain @-references to CLEO.
28927
28906
  *
28928
- * Updates .cursorrules (legacy) and creates .cursor/rules/cleo.mdc (modern).
28907
+ * Delegates the primary AGENTS.md write to CAAMP's canonical API (T1919) and
28908
+ * also updates cursor-specific MDC + legacy .cursorrules formats.
28929
28909
  *
28930
28910
  * @param projectDir - Project root directory
28931
28911
  */
28932
28912
  async ensureInstructionReferences(projectDir) {
28913
+ await ensureProviderInstructionFile2("cursor", projectDir, {});
28933
28914
  this.updateInstructionFiles(projectDir);
28934
28915
  }
28935
28916
  /**
@@ -28951,6 +28932,9 @@ var init_install2 = __esm({
28951
28932
  }
28952
28933
  /**
28953
28934
  * Update legacy .cursorrules file with @-references.
28935
+ *
28936
+ * References are sourced from the CAAMP provider registry (T1919) rather than
28937
+ * a local constant, keeping this adapter in sync with the single source of truth.
28954
28938
  * Only modifies the file if it already exists (does not create it).
28955
28939
  *
28956
28940
  * @returns true if the file was modified
@@ -28961,7 +28945,11 @@ var init_install2 = __esm({
28961
28945
  return false;
28962
28946
  }
28963
28947
  let content = readFileSync8(rulesPath, "utf-8");
28964
- const missingRefs = INSTRUCTION_REFERENCES3.filter((ref) => !content.includes(ref));
28948
+ const cursorRefs = [
28949
+ `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
28950
+ "@.cleo/memory-bridge.md"
28951
+ ];
28952
+ const missingRefs = cursorRefs.filter((ref) => !content.includes(ref));
28965
28953
  if (missingRefs.length === 0) {
28966
28954
  return false;
28967
28955
  }
@@ -28975,12 +28963,17 @@ var init_install2 = __esm({
28975
28963
  *
28976
28964
  * MDC (Markdown Component) format is Cursor's modern rule file format.
28977
28965
  * Each .mdc file in .cursor/rules/ is loaded as a rule set.
28966
+ * References are sourced from the CAAMP provider registry (T1919).
28978
28967
  *
28979
28968
  * @returns true if the file was created or modified
28980
28969
  */
28981
28970
  updateModernRules(projectDir) {
28982
28971
  const rulesDir = join16(projectDir, ".cursor", "rules");
28983
28972
  const mdcPath = join16(rulesDir, "cleo.mdc");
28973
+ const cursorRefs = [
28974
+ `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
28975
+ "@.cleo/memory-bridge.md"
28976
+ ];
28984
28977
  const expectedContent = [
28985
28978
  "---",
28986
28979
  "description: CLEO task management protocol references",
@@ -28988,7 +28981,7 @@ var init_install2 = __esm({
28988
28981
  "alwaysApply: true",
28989
28982
  "---",
28990
28983
  "",
28991
- ...INSTRUCTION_REFERENCES3,
28984
+ ...cursorRefs,
28992
28985
  ""
28993
28986
  ].join("\n");
28994
28987
  if (existsSync12(mdcPath)) {
@@ -29404,13 +29397,13 @@ var init_hooks3 = __esm({
29404
29397
  // packages/adapters/src/providers/opencode/install.ts
29405
29398
  import { existsSync as existsSync18, mkdirSync as mkdirSync5, readFileSync as readFileSync11, writeFileSync as writeFileSync8 } from "node:fs";
29406
29399
  import { join as join23 } from "node:path";
29407
- var INSTRUCTION_REFERENCES6, OpenCodeInstallProvider;
29400
+ var INSTRUCTION_REFERENCES4, OpenCodeInstallProvider;
29408
29401
  var init_install3 = __esm({
29409
29402
  "packages/adapters/src/providers/opencode/install.ts"() {
29410
29403
  "use strict";
29411
29404
  init_hook_template_installer();
29412
29405
  init_paths2();
29413
- INSTRUCTION_REFERENCES6 = [
29406
+ INSTRUCTION_REFERENCES4 = [
29414
29407
  `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
29415
29408
  "@.cleo/memory-bridge.md"
29416
29409
  ];
@@ -29458,7 +29451,7 @@ var init_install3 = __esm({
29458
29451
  if (existsSync18(agentsMdPath)) {
29459
29452
  try {
29460
29453
  const content = readFileSync11(agentsMdPath, "utf-8");
29461
- if (INSTRUCTION_REFERENCES6.some((ref) => content.includes(ref))) {
29454
+ if (INSTRUCTION_REFERENCES4.some((ref) => content.includes(ref))) {
29462
29455
  return true;
29463
29456
  }
29464
29457
  } catch {
@@ -29489,7 +29482,7 @@ var init_install3 = __esm({
29489
29482
  content = readFileSync11(agentsMdPath, "utf-8");
29490
29483
  existed = true;
29491
29484
  }
29492
- const missingRefs = INSTRUCTION_REFERENCES6.filter((ref) => !content.includes(ref));
29485
+ const missingRefs = INSTRUCTION_REFERENCES4.filter((ref) => !content.includes(ref));
29493
29486
  if (missingRefs.length === 0) {
29494
29487
  return false;
29495
29488
  }
@@ -30136,12 +30129,12 @@ function getPiAgentDir() {
30136
30129
  }
30137
30130
  return join26(homedir14(), ".pi", "agent");
30138
30131
  }
30139
- var INSTRUCTION_REFERENCES7, PiInstallProvider;
30132
+ var INSTRUCTION_REFERENCES5, PiInstallProvider;
30140
30133
  var init_install4 = __esm({
30141
30134
  "packages/adapters/src/providers/pi/install.ts"() {
30142
30135
  "use strict";
30143
30136
  init_paths2();
30144
- INSTRUCTION_REFERENCES7 = [
30137
+ INSTRUCTION_REFERENCES5 = [
30145
30138
  `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
30146
30139
  "@.cleo/memory-bridge.md"
30147
30140
  ];
@@ -30194,7 +30187,7 @@ var init_install4 = __esm({
30194
30187
  if (existsSync20(agentsMdPath)) {
30195
30188
  try {
30196
30189
  const content = readFileSync12(agentsMdPath, "utf-8");
30197
- if (INSTRUCTION_REFERENCES7.some((ref) => content.includes(ref))) {
30190
+ if (INSTRUCTION_REFERENCES5.some((ref) => content.includes(ref))) {
30198
30191
  return true;
30199
30192
  }
30200
30193
  } catch {
@@ -30204,7 +30197,7 @@ var init_install4 = __esm({
30204
30197
  const globalPath = join26(getPiAgentDir(), "AGENTS.md");
30205
30198
  if (existsSync20(globalPath)) {
30206
30199
  const content = readFileSync12(globalPath, "utf-8");
30207
- if (INSTRUCTION_REFERENCES7.some((ref) => content.includes(ref))) {
30200
+ if (INSTRUCTION_REFERENCES5.some((ref) => content.includes(ref))) {
30208
30201
  return true;
30209
30202
  }
30210
30203
  }
@@ -30237,7 +30230,7 @@ var init_install4 = __esm({
30237
30230
  content = readFileSync12(filePath, "utf-8");
30238
30231
  existed = true;
30239
30232
  }
30240
- const missingRefs = INSTRUCTION_REFERENCES7.filter((ref) => !content.includes(ref));
30233
+ const missingRefs = INSTRUCTION_REFERENCES5.filter((ref) => !content.includes(ref));
30241
30234
  if (missingRefs.length === 0) {
30242
30235
  return false;
30243
30236
  }
@@ -30893,7 +30886,7 @@ var CodexHookProvider = class {
30893
30886
  init_paths2();
30894
30887
  import { existsSync as existsSync10, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "node:fs";
30895
30888
  import { join as join14 } from "node:path";
30896
- var INSTRUCTION_REFERENCES2 = [
30889
+ var INSTRUCTION_REFERENCES = [
30897
30890
  `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
30898
30891
  "@.cleo/memory-bridge.md"
30899
30892
  ];
@@ -30940,7 +30933,7 @@ var CodexInstallProvider = class {
30940
30933
  if (existsSync10(agentsMdPath)) {
30941
30934
  try {
30942
30935
  const content = readFileSync7(agentsMdPath, "utf-8");
30943
- if (INSTRUCTION_REFERENCES2.some((ref) => content.includes(ref))) {
30936
+ if (INSTRUCTION_REFERENCES.some((ref) => content.includes(ref))) {
30944
30937
  return true;
30945
30938
  }
30946
30939
  } catch {
@@ -30973,7 +30966,7 @@ var CodexInstallProvider = class {
30973
30966
  content = readFileSync7(agentsMdPath, "utf-8");
30974
30967
  existed = true;
30975
30968
  }
30976
- const missingRefs = INSTRUCTION_REFERENCES2.filter((ref) => !content.includes(ref));
30969
+ const missingRefs = INSTRUCTION_REFERENCES.filter((ref) => !content.includes(ref));
30977
30970
  if (missingRefs.length === 0) {
30978
30971
  return false;
30979
30972
  }
@@ -31209,7 +31202,7 @@ var GeminiCliHookProvider = class {
31209
31202
  // packages/adapters/src/providers/gemini-cli/install.ts
31210
31203
  import { existsSync as existsSync14, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "node:fs";
31211
31204
  import { join as join19 } from "node:path";
31212
- var INSTRUCTION_REFERENCES4 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
31205
+ var INSTRUCTION_REFERENCES2 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
31213
31206
  var GeminiCliInstallProvider = class {
31214
31207
  /**
31215
31208
  * Install CLEO into a Gemini CLI environment.
@@ -31253,7 +31246,7 @@ var GeminiCliInstallProvider = class {
31253
31246
  if (existsSync14(agentsMdPath)) {
31254
31247
  try {
31255
31248
  const content = readFileSync9(agentsMdPath, "utf-8");
31256
- if (INSTRUCTION_REFERENCES4.some((ref) => content.includes(ref))) {
31249
+ if (INSTRUCTION_REFERENCES2.some((ref) => content.includes(ref))) {
31257
31250
  return true;
31258
31251
  }
31259
31252
  } catch {
@@ -31286,7 +31279,7 @@ var GeminiCliInstallProvider = class {
31286
31279
  content = readFileSync9(agentsMdPath, "utf-8");
31287
31280
  existed = true;
31288
31281
  }
31289
- const missingRefs = INSTRUCTION_REFERENCES4.filter((ref) => !content.includes(ref));
31282
+ const missingRefs = INSTRUCTION_REFERENCES2.filter((ref) => !content.includes(ref));
31290
31283
  if (missingRefs.length === 0) {
31291
31284
  return false;
31292
31285
  }
@@ -31501,7 +31494,7 @@ var KimiHookProvider = class {
31501
31494
  // packages/adapters/src/providers/kimi/install.ts
31502
31495
  import { existsSync as existsSync16, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "node:fs";
31503
31496
  import { join as join21 } from "node:path";
31504
- var INSTRUCTION_REFERENCES5 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
31497
+ var INSTRUCTION_REFERENCES3 = ["@~/.cleo/templates/CLEO-INJECTION.md", "@.cleo/memory-bridge.md"];
31505
31498
  var KimiInstallProvider = class {
31506
31499
  /**
31507
31500
  * Install CLEO into a Kimi environment.
@@ -31545,7 +31538,7 @@ var KimiInstallProvider = class {
31545
31538
  if (existsSync16(agentsMdPath)) {
31546
31539
  try {
31547
31540
  const content = readFileSync10(agentsMdPath, "utf-8");
31548
- if (INSTRUCTION_REFERENCES5.some((ref) => content.includes(ref))) {
31541
+ if (INSTRUCTION_REFERENCES3.some((ref) => content.includes(ref))) {
31549
31542
  return true;
31550
31543
  }
31551
31544
  } catch {
@@ -31578,7 +31571,7 @@ var KimiInstallProvider = class {
31578
31571
  content = readFileSync10(agentsMdPath, "utf-8");
31579
31572
  existed = true;
31580
31573
  }
31581
- const missingRefs = INSTRUCTION_REFERENCES5.filter((ref) => !content.includes(ref));
31574
+ const missingRefs = INSTRUCTION_REFERENCES3.filter((ref) => !content.includes(ref));
31582
31575
  if (missingRefs.length === 0) {
31583
31576
  return false;
31584
31577
  }