@cleocode/adapters 2026.10.3 → 2026.10.5-rc.ci.672

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.
Files changed (48) hide show
  1. package/dist/heavy-command-hook.d.ts +12 -0
  2. package/dist/heavy-command-hook.d.ts.map +1 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +2095 -1269
  6. package/dist/index.js.map +3 -3
  7. package/dist/providers/claude-code/adapter.d.ts.map +1 -1
  8. package/dist/providers/claude-code/hooks.d.ts +43 -17
  9. package/dist/providers/claude-code/hooks.d.ts.map +1 -1
  10. package/dist/providers/claude-code/install.d.ts +42 -14
  11. package/dist/providers/claude-code/install.d.ts.map +1 -1
  12. package/dist/providers/claude-code/paths.d.ts +77 -0
  13. package/dist/providers/claude-code/paths.d.ts.map +1 -1
  14. package/dist/providers/codex/install.d.ts.map +1 -1
  15. package/dist/providers/cursor/install.d.ts.map +1 -1
  16. package/dist/providers/gemini-cli/install.d.ts.map +1 -1
  17. package/dist/providers/kimi/install.d.ts.map +1 -1
  18. package/dist/providers/openai-sdk/install.d.ts.map +1 -1
  19. package/dist/providers/opencode/install.d.ts.map +1 -1
  20. package/dist/providers/pi/install.d.ts.map +1 -1
  21. package/dist/providers/shared/heavy-command-hook-delivery.d.ts +97 -0
  22. package/dist/providers/shared/heavy-command-hook-delivery.d.ts.map +1 -0
  23. package/dist/providers/shared/heavy-command-hook-install.d.ts +153 -7
  24. package/dist/providers/shared/heavy-command-hook-install.d.ts.map +1 -1
  25. package/dist/providers/shared/project-instruction-file.d.ts +30 -0
  26. package/dist/providers/shared/project-instruction-file.d.ts.map +1 -0
  27. package/package.json +9 -5
  28. package/src/__tests__/claude-code-adapter.test.ts +11 -6
  29. package/src/heavy-command-hook.ts +21 -0
  30. package/src/index.ts +12 -0
  31. package/src/providers/claude-code/__tests__/hooks-install.test.ts +20 -17
  32. package/src/providers/claude-code/__tests__/no-user-global-write.test.ts +293 -0
  33. package/src/providers/claude-code/adapter.ts +3 -1
  34. package/src/providers/claude-code/hooks.ts +138 -51
  35. package/src/providers/claude-code/install.ts +123 -52
  36. package/src/providers/claude-code/paths.ts +159 -1
  37. package/src/providers/codex/install.ts +7 -6
  38. package/src/providers/cursor/install.ts +26 -12
  39. package/src/providers/gemini-cli/install.ts +4 -2
  40. package/src/providers/kimi/install.ts +4 -2
  41. package/src/providers/openai-sdk/install.ts +5 -2
  42. package/src/providers/opencode/install.ts +4 -2
  43. package/src/providers/pi/install.ts +4 -2
  44. package/src/providers/shared/__tests__/heavy-command-hook-delivery.test.ts +580 -0
  45. package/src/providers/shared/__tests__/heavy-command-hook-install.test.ts +20 -0
  46. package/src/providers/shared/heavy-command-hook-delivery.ts +620 -0
  47. package/src/providers/shared/heavy-command-hook-install.ts +401 -32
  48. package/src/providers/shared/project-instruction-file.ts +47 -0
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAE7D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAkB,YAAW,mBAAmB;IAC3D,kCAAkC;IAClC,QAAQ,CAAC,EAAE,iBAAiB;IAC5B,oCAAoC;IACpC,Q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';
19
+ /** The `Stop` hook command: end the CLEO session when Claude Code stops. */
20
+ export declare const NATIVE_STOP_HOOK_COMMAND = "cleo session end --quiet # cleo-hook";
21
+ /** The `PostToolUse` (`Write|Edit`) hook command: a brain observation per file write. */
22
+ export declare const NATIVE_OBSERVE_HOOK_COMMAND = "cleo observe \"File modified via $TOOL_NAME\" --title \"tool-use\" --quiet # cleo-hook";
23
+ /**
24
+ * The `PostToolUse` (`Write|Edit`) NEXUS post-check: re-index changed files and
25
+ * flag regressions. `$TOOL_INPUT_file_path` is populated by Claude Code for
26
+ * Write/Edit events.
27
+ */
28
+ export declare const NATIVE_NEXUS_HOOK_COMMAND = "cleo nexus analyze --incremental --json > /dev/null 2>&1 && cleo observe \"NEXUS re-indexed after $TOOL_NAME on $TOOL_INPUT_file_path\" --title \"nexus-post-check\" --quiet # cleo-hook";
19
29
  /**
20
30
  * Hook provider for Claude Code.
21
31
  *
22
- * Claude Code registers hooks via its global config at `~/.claude/settings.json`.
23
- * Supported handler types: command, http, prompt, agent.
32
+ * CLEO registers its Claude Code hooks in the project's per-machine
33
+ * `<project>/.claude/settings.local.json`, never in the user-global
34
+ * `~/.claude/settings.json` (T13227). Supported handler types: command, http,
35
+ * prompt, agent.
24
36
  *
25
37
  * Event mapping is based on `getProviderHookProfile('claude-code')` from
26
38
  * CAAMP 1.9.1. Async accessors (`getSupportedCanonicalEvents`,
@@ -60,45 +72,59 @@ export declare class ClaudeCodeHookProvider implements AdapterHookProvider {
60
72
  /**
61
73
  * Register native hooks for a project.
62
74
  *
63
- * Writes CLEO hook entries to `~/.claude/settings.json` so that Claude Code's
64
- * native event system calls cleo CLI commands when events fire. This bridges
65
- * Claude Code's event loop to CLEO's internal hook dispatch.
75
+ * Writes CLEO hook entries to the project's per-machine
76
+ * `<project>/.claude/settings.local.json` so that Claude Code's native event
77
+ * system calls cleo CLI commands when events fire in this project. This
78
+ * bridges Claude Code's event loop to CLEO's internal hook dispatch.
79
+ * CLEO never writes the user-global `~/.claude/settings.json` (T13227): a
80
+ * project that is the home directory, or whose settings file resolves into
81
+ * the user-global Claude config, is refused and nothing is written. When
82
+ * git does not ignore `settings.local.json` yet, a marked `info/exclude`
83
+ * block keeps it out of git (the T12983 heavy-command rule).
66
84
  *
67
- * Idempotent: skips writing if CLEO hooks already exist in settings.json.
85
+ * Idempotent: skips writing if the native hooks are already present.
68
86
  *
69
87
  * Hook entries registered:
70
88
  * - `Stop` → `cleo session end --quiet` (triggers LLM extraction, reflector, consolidation)
71
89
  * - `PostToolUse` (Write|Edit) → brain observation for file modifications
72
- * - `SubagentStop` → brain observation for agent completion
90
+ * and the NEXUS post-check
73
91
  *
74
- * @param projectDir - Project directory for context-scoped hook commands
75
- * @task T164 @task T555
92
+ * @param projectDir - Project whose Claude Code settings receive the hooks
93
+ * @task T164 @task T555 @task T13227
76
94
  */
77
95
  registerNativeHooks(projectDir: string): Promise<void>;
78
96
  /**
79
97
  * Unregister native hooks.
80
98
  *
81
- * Removes CLEO hook entries from Claude Code's `settings.json` by filtering
82
- * out entries containing the `# cleo-hook` marker. Same locking, atomicity
83
- * and parse-error rules as {@link registerNativeHooks}.
99
+ * Removes the hook objects {@link registerNativeHooks} wrote from the
100
+ * project's `settings.local.json`, and nothing else: the heavy-command hook
101
+ * and the user's own hooks stay, and an entry or event is dropped only when
102
+ * left empty. Same locking, atomicity, parse-error and project-scope rules
103
+ * as {@link registerNativeHooks}.
84
104
  *
85
- * @task T164 @task T555
105
+ * @task T164 @task T555 @task T13227
86
106
  */
87
107
  unregisterNativeHooks(): Promise<void>;
88
108
  /** The last settings.json failure, or `null` when the last update succeeded. */
89
109
  private settingsError;
90
110
  /**
91
- * Why the last settings.json update did not happen, or `null`.
111
+ * Why the last settings update did not happen, or `null`.
92
112
  *
93
113
  * @remarks
94
114
  * Hook registration stays non-fatal for adapter initialisation, so a
95
- * refused write (malformed settings.json, lock timeout) is surfaced here and
96
- * on stderr instead of being swallowed (T12385).
115
+ * refused write (malformed settings file, lock timeout, a user-global
116
+ * target) is surfaced here and on stderr instead of being swallowed
117
+ * (T12385, T13227).
97
118
  *
98
119
  * @returns The failure message, or `null`
99
120
  */
100
121
  getSettingsError(): string | null;
101
- /** Apply `mutate` to settings.json via CAAMP's locked, atomic JSON writer. */
122
+ /**
123
+ * Apply `mutate` to the project's `settings.local.json` via CAAMP's locked,
124
+ * atomic JSON writer.
125
+ *
126
+ * @returns whether the file was written.
127
+ */
102
128
  private updateSettings;
103
129
  /**
104
130
  * Check whether hooks have been registered via `registerNativeHooks`.
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAqD/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,sBAAuB,YAAW,mBAAmB;IAChE,kEAAkE;IAClE,OAAO,CAAC,UAAU,CAAS;IAE3B;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAItD,+DAA+D;IAC/D,OAAO,CAAC,UAAU,CAAuB;IAEzC;;;;;;;;;;;;;;;;OAgBG;IACG,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuC5D;;;;;;;;OAQG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAW5C,gFAAgF;IAChF,OAAO,CAAC,aAAa,CAAuB;IAE5C;;;;;;;;;OASG;IACH,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAIjC,8EAA8E;YAChE,cAAc;IAe5B;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;;;OAIG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAI9B;;;;;;;;OAQG;IACH,WAAW,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MA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B;IAE5C;;;;;;;;;;OAUG;IACH,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAIjC;;;;;OAKG;YACW,cAAc;IAmB5B;;OAEG;IACH,YAAY,IAAI,OAAO;IAIvB;;;;OAIG;IACH,aAAa,IAAI,MAAM,GAAG,IAAI;IAI9B;;;;;;;;OAQG;IACH,WAAW,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAI/C;;;;;;;;;;OAUG;IACG,2BAA2B,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAStD;;;;;;;;;;OAUG;IACG,kBAAkB,IAAI,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IASnD;;;;;;;;;;OAUG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAW9D;;;;;;;;;;;;;;;;OAgBG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CA4FpF"}
@@ -3,14 +3,22 @@
3
3
  *
4
4
  * Handles CLEO installation into Claude Code environments:
5
5
  * - Ensures CLAUDE.md has CLEO @-references
6
- * - Manages plugin registration in ~/.claude/settings.json
6
+ * - Manages plugin registration in the PROJECT's `.claude/settings.local.json`
7
+ * - Installs the PreCompact hook templates in the PROJECT's `.claude/hooks/`
7
8
  * - Installs the heavy-command `PreToolUse` hook in the PROJECT's
8
9
  * `.claude/settings.local.json` (T12983)
9
10
  *
11
+ * Project-level only (T13227): CLEO never writes the user-global
12
+ * `~/.claude/settings.json` or `~/.claude/hooks/` (`CLAUDE_HOME`,
13
+ * `CLAUDE_SETTINGS`). A project that is the home directory, or whose
14
+ * `.claude/` resolves into the user-global Claude config, gets those steps
15
+ * reported as `skipped` and nothing is written there.
16
+ *
10
17
  * Migrated from src/core/install/claude-plugin.ts
11
18
  *
12
19
  * @task T5240
13
20
  * @task T12983
21
+ * @task T13227
14
22
  */
15
23
  import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
16
24
  /**
@@ -18,19 +26,24 @@ import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cle
18
26
  *
19
27
  * Manages CLEO's integration with Claude Code by:
20
28
  * 1. Ensuring CLAUDE.md contains @-references to CLEO instruction files
21
- * 2. Installing adapter-provided commands to .claude/commands/
22
- * 3. Registering the brain observation plugin in ~/.claude/settings.json
23
- * 4. Installing PreCompact hook templates
29
+ * 2. Installing adapter-provided commands to the project's .claude/commands/
30
+ * 3. Registering the brain observation plugin in the project's
31
+ * `.claude/settings.local.json`
32
+ * 4. Installing PreCompact hook templates in the project's `.claude/hooks/`
33
+ * and wiring them into the project's `.claude/settings.local.json`
24
34
  * 5. Installing the heavy-command `PreToolUse` hook in the project's
25
35
  * `.claude/settings.local.json`, when `options.heavyCommandHook` is set
26
36
  *
27
37
  * @remarks
28
38
  * Installation is idempotent -- running install multiple times on the same
29
39
  * project produces the same result. The provider disables the legacy
30
- * `claude-mem\@thedotmack` plugin if present and enables the unified
31
- * `cleo\@cleocode` plugin instead.
40
+ * `claude-mem\@thedotmack` plugin for the project if present and enables the
41
+ * unified `cleo\@cleocode` plugin instead. Nothing is written to the
42
+ * user-global Claude config (T13227).
32
43
  */
33
44
  export declare class ClaudeCodeInstallProvider implements AdapterInstallProvider {
45
+ /** The project the last {@link install} ran for; {@link isInstalled} reads its settings. */
46
+ private projectDir;
34
47
  /**
35
48
  * Install CLEO into a Claude Code project.
36
49
  *
@@ -47,7 +60,9 @@ export declare class ClaudeCodeInstallProvider implements AdapterInstallProvider
47
60
  /**
48
61
  * Check whether CLEO is installed in the current environment.
49
62
  *
50
- * Checks for plugin enabled in ~/.claude/settings.json.
63
+ * Checks for the plugin enabled in the project's
64
+ * `.claude/settings.local.json` — the project of the last {@link install},
65
+ * else the working directory (T13227).
51
66
  */
52
67
  isInstalled(): Promise<boolean>;
53
68
  /**
@@ -57,6 +72,8 @@ export declare class ClaudeCodeInstallProvider implements AdapterInstallProvider
57
72
  * and default references from the provider registry (T1919).
58
73
  *
59
74
  * @param projectDir - Project root directory
75
+ * @throws {@link UserGlobalClaudeConfigError} when the project root is inside
76
+ * the user-global Claude config dir (T13227); nothing is written.
60
77
  */
61
78
  ensureInstructionReferences(projectDir: string): Promise<void>;
62
79
  /**
@@ -67,43 +84,54 @@ export declare class ClaudeCodeInstallProvider implements AdapterInstallProvider
67
84
  *
68
85
  * @param projectDir - Project root directory
69
86
  * @returns Array of installed command filenames
87
+ * @throws {@link UserGlobalClaudeConfigError} when the target is user-global
70
88
  */
71
89
  private installCommands;
72
90
  /**
73
- * Register the CLEO brain plugin in ~/.claude/settings.json.
91
+ * Register the CLEO brain plugin in the project's
92
+ * `.claude/settings.local.json` (T13227: never the user-global settings).
74
93
  *
94
+ * @param projectDir - Project root directory
75
95
  * @returns Description of what was registered, or null if no change needed
96
+ * @throws {@link UserGlobalClaudeConfigError} when the target is user-global
76
97
  */
77
98
  private registerPlugin;
78
99
  /**
79
100
  * Install the CLEO PreCompact hook templates for Claude Code (T1013).
80
101
  *
81
- * Writes two files to `~/.claude/hooks/`:
102
+ * Writes two files to the project's `.claude/hooks/`:
82
103
  * 1. `cleo-precompact-core.sh` — universal CLEO safestop helper (shared
83
104
  * across all providers; sourced by the provider-specific shim).
84
105
  * 2. `precompact-safestop.sh` — Claude-Code-flavoured wrapper that invokes
85
106
  * `cleo memory precompact-flush` and `cleo safestop`.
86
107
  *
87
- * Also registers a `PreCompact` entry in `~/.claude/settings.json` so Claude
88
- * Code runs the hook when auto-compact fires (at 95% context).
108
+ * Also registers a `PreCompact` entry in the project's
109
+ * `.claude/settings.local.json` so Claude Code runs the hook when
110
+ * auto-compact fires (at 95% context). Files git does not ignore yet are
111
+ * kept out of it with a marked `info/exclude` block. Nothing is written to
112
+ * the user-global Claude config (T13227).
89
113
  *
90
114
  * Idempotent: subsequent installs skip unchanged files and do not duplicate
91
- * the settings.json hook entry.
115
+ * the settings hook entry.
92
116
  *
117
+ * @param projectDir - Project root directory
93
118
  * @returns Install summary (paths written + config change description), or
94
119
  * `null` when no change was required.
120
+ * @throws {@link UserGlobalClaudeConfigError} when the target is user-global
95
121
  *
96
- * @task T1013
122
+ * @task T1013 @task T13227
97
123
  */
98
124
  private installHookTemplates;
99
125
  /**
100
- * Register the PreCompact hook command in `~/.claude/settings.json`.
126
+ * Register the PreCompact hook command in the project's
127
+ * `.claude/settings.local.json`.
101
128
  *
102
129
  * The Claude Code native event name for the canonical `PreCompact` event is
103
130
  * `PreCompact` (identity mapping — see `hook-mappings.json`). The entry is
104
131
  * tagged with `# cleo-hook` so the uninstall flow can identify and remove
105
132
  * our additions without touching user-authored hooks.
106
133
  *
134
+ * @param settingsPath - The project settings file (already scope-checked).
107
135
  * @param shimPath - Absolute path to the installed `precompact-safestop.sh`.
108
136
  * @returns `true` when a new hook entry was written, `false` when an
109
137
  * equivalent entry was already present.
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA6BjG;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,yBAA0B,YAAW,sBAAsB;IACtE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IA0E9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAkBrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;;;;;OAQG;IACH,OAAO,CAAC,eAAe;IAsBvB;;;;OAIG;YACW,cAAc;IAwB5B;;;;;;;;;;;;;;;;;;;OAmBG;YACW,oBAAoB;IAgClC;;;;;;;;;;;;;OAaG;YACW,sBAAsB;CAmBrC"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAwCjG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,yBAA0B,YAAW,sBAAsB;IACtE,4FAA4F;IAC5F,OAAO,CAAC,UAAU,CAAuB;IAEzC;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IA4F9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;;;OAMG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAwBrC;;;;;;;;;OASG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpE;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;IAsBvB;;;;;;;OAOG;YACW,cAAc;IA2B5B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;YACW,oBAAoB;IAoClC;;;;;;;;;;;;;;;OAeG;YACW,sBAAsB;CAmBrC"}
@@ -47,5 +47,82 @@ export declare class ClaudeCodePathProvider implements AdapterPathProvider {
47
47
  * ```
48
48
  */
49
49
  export declare function claudeSettingsPath(): string;
50
+ /**
51
+ * The adapter was asked to write somewhere that is, or lies inside, the
52
+ * user-global Claude Code config (T13227). CLEO never writes there — adding
53
+ * and removing entries alike — so nothing is written and the caller reports
54
+ * the step as skipped.
55
+ */
56
+ export declare class UserGlobalClaudeConfigError extends Error {
57
+ /** The path that was refused. */
58
+ readonly path: string;
59
+ /**
60
+ * @param path - the refused target.
61
+ * @param why - which user-global location it hits.
62
+ */
63
+ constructor(path: string, why: string);
64
+ }
65
+ /**
66
+ * The project's per-machine Claude Code settings file,
67
+ * `<project>/.claude/settings.local.json` — the only settings file the
68
+ * adapter's hook and plugin writers touch (T13227, the T12983/T13124 rule:
69
+ * project-level only, never the user-global `~/.claude/settings.json`).
70
+ *
71
+ * @param projectDir - the project root.
72
+ * @returns the absolute settings path.
73
+ * @throws {@link UserGlobalClaudeConfigError} when it would be user-global.
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * const target = projectClaudeSettingsPath('/repo'); // /repo/.claude/settings.local.json
78
+ * ```
79
+ */
80
+ export declare function projectClaudeSettingsPath(projectDir: string): string;
81
+ /**
82
+ * The project's Claude Code hook-script dir, `<project>/.claude/hooks`, where
83
+ * the PreCompact templates are copied (T13227).
84
+ *
85
+ * @param projectDir - the project root.
86
+ * @returns the absolute hooks dir.
87
+ * @throws {@link UserGlobalClaudeConfigError} when it would be user-global.
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const dir = projectClaudeHooksDir('/repo'); // /repo/.claude/hooks
92
+ * ```
93
+ */
94
+ export declare function projectClaudeHooksDir(projectDir: string): string;
95
+ /**
96
+ * Refuse a project whose `CLAUDE.md` would be user-global in effect (T13227
97
+ * review): a root inside the user-global Claude config dir (in any spelling),
98
+ * where it is Claude Code's user-global memory file `~/.claude/CLAUDE.md`, or
99
+ * the home directory itself — Claude Code loads `CLAUDE.md` from the working
100
+ * directory up through every ancestor, so `~/CLAUDE.md` reaches every session
101
+ * under `$HOME`.
102
+ *
103
+ * @param projectDir - the project root.
104
+ * @throws {@link UserGlobalClaudeConfigError} when the project root is the
105
+ * home directory or inside the user-global Claude config dir.
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * assertProjectInstructionScope('/repo'); // ok
110
+ * ```
111
+ */
112
+ export declare function assertProjectInstructionScope(projectDir: string): void;
113
+ /**
114
+ * The project's Claude Code commands dir, `<project>/.claude/commands`, where
115
+ * the adapter's slash commands are copied (T13227).
116
+ *
117
+ * @param projectDir - the project root.
118
+ * @returns the absolute commands dir.
119
+ * @throws {@link UserGlobalClaudeConfigError} when it would be user-global.
120
+ *
121
+ * @example
122
+ * ```typescript
123
+ * const dir = projectClaudeCommandsDir('/repo'); // /repo/.claude/commands
124
+ * ```
125
+ */
126
+ export declare function projectClaudeCommandsDir(projectDir: string): string;
50
127
  export { appendHookEntry, CLEO_HOOK_MARKER, hasCleoHook, hookMap, isCleoHookEntry, isPlainObject, removeCleoHookEntries, } from '../shared/hook-config.js';
51
128
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/paths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;;;;;;;;;GAYG;AACH,qBAAa,sBAAuB,YAAW,mBAAmB;IAChE,uDAAuD;IACvD,cAAc,IAAI,MAAM;IAIxB,4EAA4E;IAC5E,eAAe,IAAI,MAAM,GAAG,IAAI;IAIhC,4EAA4E;IAC5E,kBAAkB,IAAI,MAAM,GAAG,IAAI;IAInC,8EAA8E;IAC9E,eAAe,IAAI,MAAM,GAAG,IAAI;CAGjC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAI3C;AAED,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,eAAe,EACf,aAAa,EACb,qBAAqB,GACtB,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/paths.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D;;;;;;;;;;;;GAYG;AACH,qBAAa,sBAAuB,YAAW,mBAAmB;IAChE,uDAAuD;IACvD,cA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E,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAyC9D;;;;;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"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/codex/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAKjG;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,oBAAqB,YAAW,sBAAsB;IACjE;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAyC9D;;;;;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"}
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/cursor/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAsBjG;;;;;;;;;;;;;GAaG;AACH,qBAAa,qBAAsB,YAAW,sBAAsB;IAClE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAuC9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IA2BrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpE;;;;;;;;;;;;;;;OAeG;YACW,sBAAsB;IAcpC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAS1B;;;;;;;;;;;;;;;;;OAiBG;YACW,oBAAoB;IA8BlC;;;;;;;;;;;;OAYG;YACW,sBAAsB;CA+BrC"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/cursor/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAUH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAwBjG;;;;;;;;;;;;;GAaG;AACH,qBAAa,qBAAsB,YAAW,sBAAsB;IAClE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAmD9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IA2BrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpE;;;;;;;;;;;;;;;OAeG;YACW,sBAAsB;IAcpC;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAS1B;;;;;;;;;;;;;;;;;OAiBG;YACW,oBAAoB;IA8BlC;;;;;;;;;;;;OAYG;YACW,sBAAsB;CA+BrC"}
@@ -1 +1 @@
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"}
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;AAIjG;;;;;;;;;;;;;;GAcG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACrE;;;;;;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;IAiBrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMrE"}
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;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"}
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;AAIjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBAAa,mBAAoB,YAAW,sBAAsB;IAChE;;;;;;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;IAiBrC;;;;;;;OAOG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMrE"}
@@ -1 +1 @@
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"}
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;AAIjG;;;;;;;;;;;GAWG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACrE;;;;;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;IAMrC;;;;OAIG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAWpE;;;;OAIG;IACH,OAAO,CAAC,eAAe;CAOxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/opencode/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAWjG;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,uBAAwB,YAAW,sBAAsB;IACpE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAiD9D;;;;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"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/opencode/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAYjG;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,uBAAwB,YAAW,sBAAsB;IACpE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAkD9D;;;;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"}
@@ -1 +1 @@
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"}
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;AAYjG;;;;;;;;;;;;;GAaG;AACH,qBAAa,iBAAkB,YAAW,sBAAsB;IAC9D;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IA2C9D;;;;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"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Deliver CLEO's heavy-command hook to every provider a project uses (T13124).
3
+ *
4
+ * `cleo init`, `cleo upgrade`, `cleo doctor` and the session briefing reach the
5
+ * per-provider installers in {@link ./heavy-command-hook-install.js} through
6
+ * this module. It used to go through `AdapterManager.discover()`, which looks for
7
+ * manifests at `<project>/packages/adapters/<dir>/manifest.json`, a path that
8
+ * exists in no project, cleocode included. So the hook was never installed
9
+ * anywhere, and the per-adapter try/catch hid every failure.
10
+ *
11
+ * Each provider is handled on its own: a provider that cannot take the hook
12
+ * (a stray `.codex` file, a malformed settings file) gets a `blocked` or
13
+ * `failed` outcome with the reason and the exact remedy, and the other
14
+ * providers still install. Nothing here throws.
15
+ *
16
+ * A provider counts as in use when the project has its config directory, its
17
+ * CLI is on `PATH`, its user config directory exists, or the hook config
18
+ * already exists. The home directory is only READ for that check. CLEO writes
19
+ * project-level configs only, never a user-global one.
20
+ *
21
+ * @task T13124
22
+ * @epic T13121
23
+ */
24
+ import type { HeavyCommandHookMode, HeavyCommandHookProvider, HeavyHookCliProbe, HeavyHookDeliveryApi, HeavyHookDeliveryOptions, HeavyHookDeliveryOutcome, HeavyHookInspection } from '@cleocode/contracts';
25
+ /** Every provider the delivery considers, in report order. */
26
+ export declare const HEAVY_HOOK_DELIVERY_PROVIDERS: readonly HeavyCommandHookProvider[];
27
+ /** The focused remedy: installs or refreshes only this hook. */
28
+ export declare const HEAVY_HOOK_FIX_COMMAND = "cleo doctor heavy-command-hook --fix";
29
+ type Env = Readonly<Record<string, string | undefined>>;
30
+ /**
31
+ * The file a provider's project-level hook lives in (Kimi: its global config,
32
+ * named for the report only; CLEO never writes it).
33
+ *
34
+ * @param provider - the harness.
35
+ * @param projectDir - the project root.
36
+ * @param env - environment (for Kimi's home directory).
37
+ * @returns the absolute path.
38
+ */
39
+ export declare function heavyHookTarget(provider: HeavyCommandHookProvider, projectDir: string, env?: Env): string;
40
+ /** Whether a provider is in use, and the first signal that says so. */
41
+ export interface HeavyHookDetection {
42
+ /** The provider is in use on this machine or in this project. */
43
+ readonly detected: boolean;
44
+ /** The signal found, or what was checked when nothing was. */
45
+ readonly why: string;
46
+ }
47
+ /**
48
+ * Whether `provider` is in use here, from cheap read-only signals: its
49
+ * project config directory, its CLI on `PATH`, its user config directory, or
50
+ * an existing hook config.
51
+ *
52
+ * @param provider - the harness.
53
+ * @param projectDir - the project root.
54
+ * @param env - environment (`PATH`, `HOME`, `CODEX_HOME`, `XDG_CONFIG_HOME`, …).
55
+ * @returns whether it is in use, and why.
56
+ */
57
+ export declare function detectHeavyHookProvider(provider: HeavyCommandHookProvider, projectDir: string, env?: Env): HeavyHookDetection;
58
+ /**
59
+ * Install, refresh or (mode `off`) remove CLEO's heavy-command hook for every
60
+ * provider in use in `projectDir`, each independently: one provider's failure
61
+ * never stops another. Mode `off` cleans every provider, in use or not. The
62
+ * home directory is skipped (its provider configs are the user-global ones).
63
+ *
64
+ * @param projectDir - the project root.
65
+ * @param mode - the resolved hook mode (`resources.heavyCommandHook`).
66
+ * @param options - environment and provider list (tests).
67
+ * @returns one outcome per provider, in {@link HEAVY_HOOK_DELIVERY_PROVIDERS} order.
68
+ */
69
+ export declare function syncProjectHeavyCommandHooks(projectDir: string, mode: HeavyCommandHookMode, options?: HeavyHookDeliveryOptions): Promise<readonly HeavyHookDeliveryOutcome[]>;
70
+ /**
71
+ * Read-only: the hook's state for every provider in `projectDir`. Never
72
+ * writes and never throws.
73
+ *
74
+ * @param projectDir - the project root.
75
+ * @param mode - the resolved hook mode (`resources.heavyCommandHook`).
76
+ * @param options - environment and provider list (tests).
77
+ * @returns one inspection per provider, in {@link HEAVY_HOOK_DELIVERY_PROVIDERS} order.
78
+ */
79
+ export declare function inspectProjectHeavyCommandHooks(projectDir: string, mode: HeavyCommandHookMode, options?: HeavyHookDeliveryOptions): readonly HeavyHookInspection[];
80
+ /**
81
+ * Whether the `cleo` on PATH, as the hook resolves it from `projectDir`, can
82
+ * answer the hook. A hook installed in front of an older CLEO (no `cleo hook`,
83
+ * so no `cleo run`) lets every command run ungoverned, so `cleo doctor` must
84
+ * say so. The check is the hook's own: its marker for this binary and
85
+ * directory, else one call to `cleo hook heavy-command` with an empty payload,
86
+ * where an older CLEO exits 127 with "Unknown command".
87
+ *
88
+ * @param projectDir - the project root (a version-manager shim may resolve a
89
+ * different `cleo` per directory).
90
+ * @param options - environment (tests).
91
+ * @returns the CLI's state.
92
+ */
93
+ export declare function probeHeavyHookCli(projectDir: string, options?: HeavyHookDeliveryOptions): HeavyHookCliProbe;
94
+ /** The delivery surface `@cleocode/core` loads at run time. */
95
+ export declare const heavyHookDeliveryApi: HeavyHookDeliveryApi;
96
+ export {};
97
+ //# sourceMappingURL=heavy-command-hook-delivery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"heavy-command-hook-delivery.d.ts","sourceRoot":"","sources":["../../../src/providers/shared/heavy-command-hook-delivery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AA0B7B,8DAA8D;AAC9D,eAAO,MAAM,6BAA6B,EAAE,SAAS,wBAAwB,EAK3E,CAAC;AAEH,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,yCAAyC,CAAC;AAE7E,KAAK,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAgBxD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,MAAM,EAClB,GAAG,GAAE,GAAiB,GACrB,MAAM,CAWR;AAED,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,8DAA8D;IAC9D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,wBAAwB,EAClC,UAAU,EAAE,MAAM,EAClB,GAAG,GAAE,GAAiB,GACrB,kBAAkB,CAgDpB;AAgED;;;;;;;;;;GAUG;AACH,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,SAAS,wBAAwB,EAAE,CAAC,CAwB9C;AA2MD;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAC7C,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,oBAAoB,EAC1B,OAAO,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