@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.
@@ -2,9 +2,10 @@
2
2
  * Codex CLI Install Provider
3
3
  *
4
4
  * Handles CLEO installation into Codex CLI environments:
5
- * - Ensures AGENTS.md has CLEO @-references
5
+ * - Ensures AGENTS.md has CLEO @-references via CAAMP
6
6
  *
7
7
  * @task T162
8
+ * @task T9019
8
9
  * @epic T134
9
10
  */
10
11
  import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
@@ -13,9 +14,10 @@ import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cle
13
14
  *
14
15
  * Manages CLEO's integration with Codex CLI by:
15
16
  * 1. Ensuring AGENTS.md contains @-references to CLEO instruction files
17
+ * (delegated to CAAMP's canonical {@link ensureProviderInstructionFile}).
16
18
  *
17
19
  * @remarks
18
- * Installation is idempotent -- running install multiple times on the same
20
+ * Installation is idempotent running install multiple times on the same
19
21
  * project produces the same result. Only AGENTS.md is managed; Codex CLI
20
22
  * does not have an MCP or plugin registration mechanism.
21
23
  *
@@ -41,25 +43,18 @@ export declare class CodexInstallProvider implements AdapterInstallProvider {
41
43
  /**
42
44
  * Check whether CLEO is installed in the Codex CLI environment.
43
45
  *
44
- * Checks for CLEO references in AGENTS.md.
46
+ * Delegates to CAAMP's instruction-file check.
45
47
  * @task T162
46
48
  */
47
49
  isInstalled(): Promise<boolean>;
48
50
  /**
49
51
  * Ensure AGENTS.md contains @-references to CLEO instruction files.
50
52
  *
51
- * Creates AGENTS.md if it does not exist. Appends any missing references.
53
+ * Delegates to CAAMP's canonical {@link ensureProviderInstructionFile}.
52
54
  *
53
55
  * @param projectDir - Project root directory
54
56
  * @task T162
55
57
  */
56
58
  ensureInstructionReferences(projectDir: string): Promise<void>;
57
- /**
58
- * Update AGENTS.md with CLEO @-references.
59
- *
60
- * @param projectDir - Project root directory
61
- * @returns true if the file was created or modified
62
- */
63
- private updateInstructionFile;
64
59
  }
65
60
  //# sourceMappingURL=install.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/codex/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAajG;;;;;;;;;;;;;GAaG;AACH,qBAAa,oBAAqB,YAAW,sBAAsB;IACjE;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAoB9D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;CA4B9B"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/codex/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjG;;;;;;;;;;;;;;GAcG;AACH,qBAAa,oBAAqB,YAAW,sBAAsB;IACjE;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAwB9D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAerC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMrE"}
@@ -2,21 +2,23 @@
2
2
  * Gemini CLI Install Provider
3
3
  *
4
4
  * Handles CLEO installation into Gemini CLI environments:
5
- * - Ensures AGENTS.md has CLEO @-references
5
+ * - Ensures GEMINI.md has CLEO @-references (via CAAMP registry)
6
6
  *
7
7
  * @task T161
8
8
  * @epic T134
9
+ * @task T9018
9
10
  */
10
11
  import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
11
12
  /**
12
13
  * Install provider for Gemini CLI.
13
14
  *
14
15
  * Manages CLEO's integration with Gemini CLI by:
15
- * 1. Ensuring AGENTS.md contains @-references to CLEO instruction files
16
+ * 1. Ensuring GEMINI.md contains @-references to CLEO instruction files
17
+ * (via CAAMP registry — single source of truth for instruction file name)
16
18
  *
17
19
  * @remarks
18
20
  * Installation is idempotent -- running install multiple times on the same
19
- * project produces the same result. Only AGENTS.md is managed; Gemini CLI
21
+ * project produces the same result. Only GEMINI.md is managed; Gemini CLI
20
22
  * does not have an MCP or plugin registration mechanism.
21
23
  *
22
24
  * @task T161
@@ -34,32 +36,25 @@ export declare class GeminiCliInstallProvider implements AdapterInstallProvider
34
36
  /**
35
37
  * Uninstall CLEO from the Gemini CLI environment.
36
38
  *
37
- * Does not remove AGENTS.md references (they are harmless if CLEO is not present).
39
+ * Does not remove GEMINI.md references (they are harmless if CLEO is not present).
38
40
  * @task T161
39
41
  */
40
42
  uninstall(): Promise<void>;
41
43
  /**
42
44
  * Check whether CLEO is installed in the Gemini CLI environment.
43
45
  *
44
- * Checks for CLEO references in AGENTS.md.
46
+ * Checks for CLEO references in GEMINI.md.
45
47
  * @task T161
46
48
  */
47
49
  isInstalled(): Promise<boolean>;
48
50
  /**
49
- * Ensure AGENTS.md contains @-references to CLEO instruction files.
51
+ * Ensure GEMINI.md contains @-references to CLEO instruction files.
50
52
  *
51
- * Creates AGENTS.md if it does not exist. Appends any missing references.
53
+ * Creates GEMINI.md if it does not exist. Appends any missing references.
52
54
  *
53
55
  * @param projectDir - Project root directory
54
56
  * @task T161
55
57
  */
56
58
  ensureInstructionReferences(projectDir: string): Promise<void>;
57
- /**
58
- * Update AGENTS.md with CLEO @-references.
59
- *
60
- * @param projectDir - Project root directory
61
- * @returns true if the file was created or modified
62
- */
63
- private updateInstructionFile;
64
59
  }
65
60
  //# sourceMappingURL=install.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/gemini-cli/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKjG;;;;;;;;;;;;;GAaG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACrE;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAoB9D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;CA4B9B"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/gemini-cli/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjG;;;;;;;;;;;;;;GAcG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACrE;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAuB9D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAiBrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMrE"}
@@ -2,10 +2,11 @@
2
2
  * Kimi Install Provider
3
3
  *
4
4
  * Handles CLEO installation into Kimi environments:
5
- * - Ensures AGENTS.md has CLEO @-references
5
+ * - Ensures AGENTS.md has CLEO @-references (via CAAMP registry)
6
6
  *
7
7
  * @task T163
8
8
  * @epic T134
9
+ * @task T9018
9
10
  */
10
11
  import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
11
12
  /**
@@ -13,6 +14,7 @@ import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cle
13
14
  *
14
15
  * Manages CLEO's integration with Kimi by:
15
16
  * 1. Ensuring AGENTS.md contains @-references to CLEO instruction files
17
+ * (via CAAMP registry — single source of truth for instruction file name)
16
18
  *
17
19
  * @remarks
18
20
  * Installation is idempotent -- running install multiple times on the same
@@ -54,12 +56,5 @@ export declare class KimiInstallProvider implements AdapterInstallProvider {
54
56
  * @task T163
55
57
  */
56
58
  ensureInstructionReferences(projectDir: string): Promise<void>;
57
- /**
58
- * Update AGENTS.md with CLEO @-references.
59
- *
60
- * @param projectDir - Project root directory
61
- * @returns true if the file was created or modified
62
- */
63
- private updateInstructionFile;
64
59
  }
65
60
  //# sourceMappingURL=install.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/kimi/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKjG;;;;;;;;;;;;;GAaG;AACH,qBAAa,mBAAoB,YAAW,sBAAsB;IAChE;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAoB9D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;CA4B9B"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/kimi/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjG;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAoB,YAAW,sBAAsB;IAChE;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAuB9D;;;;;OAKG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;;;;OAKG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAiBrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMrE"}
@@ -2,10 +2,11 @@
2
2
  * OpenAI SDK Install Provider.
3
3
  *
4
4
  * Handles CLEO installation into OpenAI SDK environments:
5
- * - Writes an AGENTS.md file with CLEO @-references
5
+ * - Writes an AGENTS.md file with CLEO @-references (via CAAMP registry)
6
6
  * - Creates a `.openai/` config stub if it does not exist
7
7
  *
8
8
  * @task T582
9
+ * @task T9018
9
10
  */
10
11
  import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
11
12
  /**
@@ -13,6 +14,7 @@ import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cle
13
14
  *
14
15
  * Manages CLEO's integration with OpenAI SDK projects by:
15
16
  * 1. Ensuring AGENTS.md contains @-references to CLEO instruction files
17
+ * (via CAAMP registry — single source of truth for instruction file name)
16
18
  * 2. Creating the `.openai/` config directory stub if absent
17
19
  *
18
20
  * @remarks
@@ -36,7 +38,7 @@ export declare class OpenAiSdkInstallProvider implements AdapterInstallProvider
36
38
  /**
37
39
  * Check whether CLEO is installed in the current OpenAI SDK environment.
38
40
  *
39
- * Checks for `@~/.cleo/templates/CLEO-INJECTION.md` in AGENTS.md.
41
+ * Checks for `@~/.local/share/cleo/templates/CLEO-INJECTION.md` in AGENTS.md.
40
42
  */
41
43
  isInstalled(): Promise<boolean>;
42
44
  /**
@@ -45,12 +47,6 @@ export declare class OpenAiSdkInstallProvider implements AdapterInstallProvider
45
47
  * @param projectDir - Project root directory.
46
48
  */
47
49
  ensureInstructionReferences(projectDir: string): Promise<void>;
48
- /**
49
- * Update AGENTS.md with CLEO @-references.
50
- *
51
- * @returns `true` if the file was created or modified.
52
- */
53
- private updateInstructionFile;
54
50
  /**
55
51
  * Create the `.openai/` config directory if it does not exist.
56
52
  *
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKjG;;;;;;;;;;GAUG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACrE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAyB9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAMrC;;;;OAIG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpE;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA0B7B;;;;OAIG;IACH,OAAO,CAAC,eAAe;CAOxB"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/openai-sdk/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGjG;;;;;;;;;;;GAWG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACrE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IA8B9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAMrC;;;;OAIG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpE;;;;OAIG;IACH,OAAO,CAAC,eAAe;CAOxB"}
@@ -2,11 +2,12 @@
2
2
  * OpenCode Install Provider
3
3
  *
4
4
  * Handles CLEO installation into OpenCode environments:
5
- * - Ensures AGENTS.md has CLEO @-references
5
+ * - Ensures AGENTS.md has CLEO @-references via CAAMP
6
6
  * - Installs PreCompact hook shell shims + a JS plugin wrapper (T1013)
7
7
  *
8
8
  * @task T5240
9
9
  * @task T1013
10
+ * @task T9019
10
11
  */
11
12
  import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
12
13
  /**
@@ -14,11 +15,12 @@ import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cle
14
15
  *
15
16
  * Manages CLEO's integration with OpenCode by:
16
17
  * 1. Ensuring AGENTS.md contains @-references to CLEO instruction files
18
+ * (delegated to CAAMP's canonical {@link ensureProviderInstructionFile}).
17
19
  * 2. Installing PreCompact hook shell templates + generating the JS plugin
18
20
  * wrapper that spawns the shim on `experimental.session.compacting` (T1013).
19
21
  *
20
22
  * @remarks
21
- * Installation is idempotent -- running install multiple times on the same
23
+ * Installation is idempotent running install multiple times on the same
22
24
  * project produces the same result. OpenCode's plugin system is the native
23
25
  * hook surface (OpenCode has no config-file hook registry like Claude Code or
24
26
  * Cursor), so the installer writes a JS plugin that subscribes to the native
@@ -43,23 +45,17 @@ export declare class OpenCodeInstallProvider implements AdapterInstallProvider {
43
45
  /**
44
46
  * Check whether CLEO is installed in the current environment.
45
47
  *
46
- * Checks for CLEO references in AGENTS.md.
48
+ * Delegates to CAAMP's instruction-file check.
47
49
  */
48
50
  isInstalled(): Promise<boolean>;
49
51
  /**
50
52
  * Ensure AGENTS.md contains @-references to CLEO instruction files.
51
53
  *
52
- * Creates AGENTS.md if it does not exist. Appends any missing references.
54
+ * Delegates to CAAMP's canonical {@link ensureProviderInstructionFile}.
53
55
  *
54
56
  * @param projectDir - Project root directory
55
57
  */
56
58
  ensureInstructionReferences(projectDir: string): Promise<void>;
57
- /**
58
- * Update AGENTS.md with CLEO @-references.
59
- *
60
- * @returns true if the file was created or modified
61
- */
62
- private updateInstructionFile;
63
59
  /**
64
60
  * Install the CLEO PreCompact hook templates for OpenCode (T1013).
65
61
  *
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/opencode/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAiBjG;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,uBAAwB,YAAW,sBAAsB;IACpE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IA4B9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBrC;;;;;;OAMG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA+B7B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,oBAAoB;IAiC5B;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,qBAAqB;CA0C9B"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/opencode/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAOjG;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,uBAAwB,YAAW,sBAAsB;IACpE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAgC9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAerC;;;;;;OAMG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOpE;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,oBAAoB;IAiC5B;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,qBAAqB;CA0C9B"}
@@ -2,8 +2,7 @@
2
2
  * Pi Install Provider
3
3
  *
4
4
  * Handles CLEO installation into Pi coding agent environments:
5
- * - Ensures AGENTS.md has CLEO @-references (project and global scope)
6
- * - Manages Pi settings.json to register CLEO extension path
5
+ * - Ensures AGENTS.md has CLEO @-references via CAAMP (project and global scope)
7
6
  *
8
7
  * Pi uses AGENTS.md (not CLAUDE.md) as its instruction file. The global
9
8
  * instruction file lives at `~/.pi/agent/AGENTS.md`; the project-level
@@ -13,6 +12,7 @@
13
12
  * environment variables, or by presence of `~/.pi/agent/` directory.
14
13
  *
15
14
  * @task T553
15
+ * @task T9019
16
16
  */
17
17
  import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
18
18
  /**
@@ -20,7 +20,8 @@ import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cle
20
20
  *
21
21
  * Manages CLEO's integration with Pi by:
22
22
  * 1. Ensuring project AGENTS.md contains @-references to CLEO instruction files
23
- * 2. Ensuring global AGENTS.md (~/.pi/agent/AGENTS.md) contains @-references
23
+ * (delegated to CAAMP's canonical {@link ensureProviderInstructionFile}).
24
+ * 2. Ensuring global AGENTS.md (~/.pi/agent/AGENTS.md) contains @-references.
24
25
  *
25
26
  * @remarks
26
27
  * Installation is idempotent — running install multiple times on the same
@@ -45,24 +46,16 @@ export declare class PiInstallProvider implements AdapterInstallProvider {
45
46
  /**
46
47
  * Check whether CLEO is installed in the current environment.
47
48
  *
48
- * Checks for CLEO references in the project AGENTS.md.
49
+ * Delegates to CAAMP's instruction-file check for project and global scopes.
49
50
  */
50
51
  isInstalled(): Promise<boolean>;
51
52
  /**
52
53
  * Ensure AGENTS.md contains @-references to CLEO instruction files.
53
54
  *
54
- * Creates AGENTS.md if it does not exist. Appends any missing references.
55
+ * Delegates to CAAMP's canonical {@link ensureProviderInstructionFile}.
55
56
  *
56
57
  * @param projectDir - Project root directory
57
58
  */
58
59
  ensureInstructionReferences(projectDir: string): Promise<void>;
59
- /**
60
- * Update an instruction file with CLEO @-references.
61
- *
62
- * @param dir - Directory containing the instruction file
63
- * @param filename - Name of the instruction file (e.g. "AGENTS.md")
64
- * @returns true if the file was created or modified
65
- */
66
- private updateInstructionFile;
67
60
  }
68
61
  //# sourceMappingURL=install.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/pi/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAiCjG;;;;;;;;;;;;GAYG;AACH,qBAAa,iBAAkB,YAAW,sBAAsB;IAC9D;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAiC9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IA6BrC;;;;;;OAMG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;CA+B9B"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/pi/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAWjG;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAkB,YAAW,sBAAsB;IAC9D;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IA0C9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IA0BrC;;;;;;OAMG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/adapters",
3
- "version": "2026.5.37",
3
+ "version": "2026.5.40",
4
4
  "description": "Unified provider adapters for CLEO (Claude Code, OpenCode, Cursor)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,9 +15,9 @@
15
15
  "@ai-sdk/anthropic": "^3.0.69",
16
16
  "@ai-sdk/openai": "^2.0.53",
17
17
  "ai": "^6.0.168",
18
- "@cleocode/caamp": "2026.5.37",
19
- "@cleocode/contracts": "2026.5.37",
20
- "@cleocode/paths": "2026.5.37"
18
+ "@cleocode/caamp": "2026.5.40",
19
+ "@cleocode/contracts": "2026.5.40",
20
+ "@cleocode/paths": "2026.5.40"
21
21
  },
22
22
  "license": "MIT",
23
23
  "engines": {
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@types/node": "^22.19.15",
32
32
  "vitest": "^4.1.4",
33
- "@cleocode/playbooks": "2026.5.37"
33
+ "@cleocode/playbooks": "2026.5.40"
34
34
  },
35
35
  "repository": {
36
36
  "type": "git",
@@ -219,17 +219,18 @@ describe('OpenCodeInstallProvider — integration', () => {
219
219
  expect(content).toContain('@.cleo/memory-bridge.md');
220
220
  });
221
221
 
222
- it('does not duplicate existing references', async () => {
223
- // Pre-seed with the dynamically-resolved reference so dedup logic fires
224
- const { getCleoTemplatesTildePath } = await import('../providers/shared/paths.js');
225
- const injectionRef = `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`;
226
- const existing = `${injectionRef}\n@.cleo/memory-bridge.md\n`;
227
- writeFileSync(join(testDir, 'AGENTS.md'), existing, 'utf-8');
222
+ it('does not duplicate CAAMP block on repeated calls', async () => {
223
+ // First call: creates AGENTS.md with a CAAMP block containing the references.
224
+ await install.ensureInstructionReferences(testDir);
225
+ const afterFirst = readFileSync(join(testDir, 'AGENTS.md'), 'utf-8');
226
+ const blockCountFirst = (afterFirst.match(/<!-- CAAMP:START -->/g) ?? []).length;
227
+ expect(blockCountFirst).toBe(1);
228
228
 
229
+ // Second call: CAAMP detects the block is intact and does not duplicate it.
229
230
  await install.ensureInstructionReferences(testDir);
230
- const content = readFileSync(join(testDir, 'AGENTS.md'), 'utf-8');
231
- const injectionCount = (content.match(/@~\/.+\/CLEO-INJECTION\.md/g) ?? []).length;
232
- expect(injectionCount).toBe(1);
231
+ const afterSecond = readFileSync(join(testDir, 'AGENTS.md'), 'utf-8');
232
+ const blockCountSecond = (afterSecond.match(/<!-- CAAMP:START -->/g) ?? []).length;
233
+ expect(blockCountSecond).toBe(1);
233
234
  });
234
235
 
235
236
  it('install returns expected shape', async () => {
@@ -2,35 +2,27 @@
2
2
  * Codex CLI Install Provider
3
3
  *
4
4
  * Handles CLEO installation into Codex CLI environments:
5
- * - Ensures AGENTS.md has CLEO @-references
5
+ * - Ensures AGENTS.md has CLEO @-references via CAAMP
6
6
  *
7
7
  * @task T162
8
+ * @task T9019
8
9
  * @epic T134
9
10
  */
10
11
 
11
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
12
12
  import { join } from 'node:path';
13
+ import { ensureProviderInstructionFile } from '@cleocode/caamp';
13
14
  import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
14
15
  import { getCleoTemplatesTildePath } from '../shared/paths.js';
15
16
 
16
- /**
17
- * Lines that should appear in AGENTS.md to reference CLEO.
18
- * The CLEO-INJECTION.md path is resolved dynamically to support non-default
19
- * XDG / OS installation locations (T916).
20
- */
21
- const INSTRUCTION_REFERENCES = [
22
- `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
23
- '@.cleo/memory-bridge.md',
24
- ];
25
-
26
17
  /**
27
18
  * Install provider for Codex CLI.
28
19
  *
29
20
  * Manages CLEO's integration with Codex CLI by:
30
21
  * 1. Ensuring AGENTS.md contains @-references to CLEO instruction files
22
+ * (delegated to CAAMP's canonical {@link ensureProviderInstructionFile}).
31
23
  *
32
24
  * @remarks
33
- * Installation is idempotent -- running install multiple times on the same
25
+ * Installation is idempotent running install multiple times on the same
34
26
  * project produces the same result. Only AGENTS.md is managed; Codex CLI
35
27
  * does not have an MCP or plugin registration mechanism.
36
28
  *
@@ -48,13 +40,17 @@ export class CodexInstallProvider implements AdapterInstallProvider {
48
40
  async install(options: InstallOptions): Promise<InstallResult> {
49
41
  const { projectDir } = options;
50
42
  const installedAt = new Date().toISOString();
51
- let instructionFileUpdated = false;
52
43
  const details: Record<string, unknown> = {};
53
44
 
54
- // Step 1: Ensure AGENTS.md has @-references
55
- instructionFileUpdated = this.updateInstructionFile(projectDir);
45
+ // Ensure AGENTS.md has CLEO @-references via CAAMP canonical API.
46
+ const result = await ensureProviderInstructionFile('codex', projectDir, {
47
+ scope: 'project',
48
+ references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, '@.cleo/memory-bridge.md'],
49
+ });
50
+
51
+ const instructionFileUpdated = result.action !== 'intact';
56
52
  if (instructionFileUpdated) {
57
- details.instructionFile = join(projectDir, 'AGENTS.md');
53
+ details.instructionFile = join(projectDir, result.instructFile);
58
54
  }
59
55
 
60
56
  return {
@@ -78,69 +74,36 @@ export class CodexInstallProvider implements AdapterInstallProvider {
78
74
  /**
79
75
  * Check whether CLEO is installed in the Codex CLI environment.
80
76
  *
81
- * Checks for CLEO references in AGENTS.md.
77
+ * Delegates to CAAMP's instruction-file check.
82
78
  * @task T162
83
79
  */
84
80
  async isInstalled(): Promise<boolean> {
85
- const agentsMdPath = join(process.cwd(), 'AGENTS.md');
86
- if (existsSync(agentsMdPath)) {
87
- try {
88
- const content = readFileSync(agentsMdPath, 'utf-8');
89
- if (INSTRUCTION_REFERENCES.some((ref) => content.includes(ref))) {
90
- return true;
91
- }
92
- } catch {
93
- // Fall through
94
- }
81
+ try {
82
+ const result = await ensureProviderInstructionFile('codex', process.cwd(), {
83
+ scope: 'project',
84
+ references: [
85
+ `@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`,
86
+ '@.cleo/memory-bridge.md',
87
+ ],
88
+ });
89
+ return result.action === 'intact';
90
+ } catch {
91
+ return false;
95
92
  }
96
-
97
- return false;
98
93
  }
99
94
 
100
95
  /**
101
96
  * Ensure AGENTS.md contains @-references to CLEO instruction files.
102
97
  *
103
- * Creates AGENTS.md if it does not exist. Appends any missing references.
98
+ * Delegates to CAAMP's canonical {@link ensureProviderInstructionFile}.
104
99
  *
105
100
  * @param projectDir - Project root directory
106
101
  * @task T162
107
102
  */
108
103
  async ensureInstructionReferences(projectDir: string): Promise<void> {
109
- this.updateInstructionFile(projectDir);
110
- }
111
-
112
- /**
113
- * Update AGENTS.md with CLEO @-references.
114
- *
115
- * @param projectDir - Project root directory
116
- * @returns true if the file was created or modified
117
- */
118
- private updateInstructionFile(projectDir: string): boolean {
119
- const agentsMdPath = join(projectDir, 'AGENTS.md');
120
- let content = '';
121
- let existed = false;
122
-
123
- if (existsSync(agentsMdPath)) {
124
- content = readFileSync(agentsMdPath, 'utf-8');
125
- existed = true;
126
- }
127
-
128
- const missingRefs = INSTRUCTION_REFERENCES.filter((ref) => !content.includes(ref));
129
-
130
- if (missingRefs.length === 0) {
131
- return false;
132
- }
133
-
134
- const refsBlock = missingRefs.join('\n');
135
-
136
- if (existed) {
137
- const separator = content.endsWith('\n') ? '' : '\n';
138
- content = content + separator + refsBlock + '\n';
139
- } else {
140
- content = refsBlock + '\n';
141
- }
142
-
143
- writeFileSync(agentsMdPath, content, 'utf-8');
144
- return true;
104
+ await ensureProviderInstructionFile('codex', projectDir, {
105
+ scope: 'project',
106
+ references: [`@${getCleoTemplatesTildePath()}/CLEO-INJECTION.md`, '@.cleo/memory-bridge.md'],
107
+ });
145
108
  }
146
109
  }