expandai 0.0.2 → 0.0.3

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 (271) hide show
  1. package/README.md +42 -5
  2. package/build/dts/ApiClient.d.ts +128 -194
  3. package/build/dts/ApiClient.d.ts.map +1 -1
  4. package/build/dts/Auth/Domain.d.ts +95 -0
  5. package/build/dts/Auth/Domain.d.ts.map +1 -0
  6. package/build/dts/Auth/ManualAuthorization.d.ts +107 -0
  7. package/build/dts/Auth/ManualAuthorization.d.ts.map +1 -0
  8. package/build/dts/Auth/PendingInit.d.ts +35 -0
  9. package/build/dts/Auth/PendingInit.d.ts.map +1 -0
  10. package/build/dts/Auth/Pkce.d.ts +10 -0
  11. package/build/dts/Auth/Pkce.d.ts.map +1 -0
  12. package/build/dts/Auth/SetupGrantAuthorization.d.ts +34 -0
  13. package/build/dts/Auth/SetupGrantAuthorization.d.ts.map +1 -0
  14. package/build/dts/Authentication.d.ts +10 -9
  15. package/build/dts/Authentication.d.ts.map +1 -1
  16. package/build/dts/BrowserOAuth.d.ts +7 -7
  17. package/build/dts/BrowserOAuth.d.ts.map +1 -1
  18. package/build/dts/CommandPath.d.ts +2 -0
  19. package/build/dts/CommandPath.d.ts.map +1 -0
  20. package/build/dts/Commands/Fetch.d.ts.map +1 -1
  21. package/build/dts/Commands/Hook.d.ts +5 -5
  22. package/build/dts/Commands/Init.d.ts +55 -0
  23. package/build/dts/Commands/Init.d.ts.map +1 -0
  24. package/build/dts/Commands/Mcp.d.ts +6 -6
  25. package/build/dts/Commands/Search.d.ts.map +1 -1
  26. package/build/dts/Commands/Skill.d.ts +4 -4
  27. package/build/dts/Commands/Status.d.ts +27 -0
  28. package/build/dts/Commands/Status.d.ts.map +1 -0
  29. package/build/dts/Commands/Telemetry.d.ts +7 -0
  30. package/build/dts/Commands/Telemetry.d.ts.map +1 -0
  31. package/build/dts/Commands/Uninstall.d.ts +4 -4
  32. package/build/dts/Config.d.ts +108 -17
  33. package/build/dts/Config.d.ts.map +1 -1
  34. package/build/dts/Hook/SnapshotNote.d.ts +8 -4
  35. package/build/dts/Hook/SnapshotNote.d.ts.map +1 -1
  36. package/build/dts/Init/ClaudeAdapter.d.ts +61 -0
  37. package/build/dts/Init/ClaudeAdapter.d.ts.map +1 -0
  38. package/build/dts/Init/ClaudeProfile.d.ts +78 -0
  39. package/build/dts/Init/ClaudeProfile.d.ts.map +1 -0
  40. package/build/dts/Init/Domain.d.ts +139 -0
  41. package/build/dts/Init/Domain.d.ts.map +1 -0
  42. package/build/dts/Init/HarnessAdapter.d.ts +33 -0
  43. package/build/dts/Init/HarnessAdapter.d.ts.map +1 -0
  44. package/build/dts/Init/HarnessDetector.d.ts +19 -0
  45. package/build/dts/Init/HarnessDetector.d.ts.map +1 -0
  46. package/build/dts/Init/HarnessRegistry.d.ts +50 -0
  47. package/build/dts/Init/HarnessRegistry.d.ts.map +1 -0
  48. package/build/dts/Init/MutationTransaction.d.ts +96 -0
  49. package/build/dts/Init/MutationTransaction.d.ts.map +1 -0
  50. package/build/dts/Init/Service.d.ts +72 -0
  51. package/build/dts/Init/Service.d.ts.map +1 -0
  52. package/build/dts/Init/StandardAdapters.d.ts +42 -0
  53. package/build/dts/Init/StandardAdapters.d.ts.map +1 -0
  54. package/build/dts/Init/Status.d.ts +149 -0
  55. package/build/dts/Init/Status.d.ts.map +1 -0
  56. package/build/dts/Install/Claude/Hook.d.ts +85 -25
  57. package/build/dts/Install/Claude/Hook.d.ts.map +1 -1
  58. package/build/dts/Install/Claude/Mcp.d.ts +21 -18
  59. package/build/dts/Install/Claude/Mcp.d.ts.map +1 -1
  60. package/build/dts/Install/Claude/Skill.d.ts +14 -15
  61. package/build/dts/Install/Claude/Skill.d.ts.map +1 -1
  62. package/build/dts/Install/Codex/Mcp.d.ts +14 -8
  63. package/build/dts/Install/Codex/Mcp.d.ts.map +1 -1
  64. package/build/dts/Install/Codex/Skill.d.ts +4 -2
  65. package/build/dts/Install/Codex/Skill.d.ts.map +1 -1
  66. package/build/dts/Install/Cursor/Mcp.d.ts +13 -13
  67. package/build/dts/Install/Cursor/Mcp.d.ts.map +1 -1
  68. package/build/dts/Install/Cursor/Skill.d.ts +4 -2
  69. package/build/dts/Install/Cursor/Skill.d.ts.map +1 -1
  70. package/build/dts/Install/Domain.d.ts +35 -5
  71. package/build/dts/Install/Domain.d.ts.map +1 -1
  72. package/build/dts/Install/Hook.d.ts +4 -4
  73. package/build/dts/Install/Hook.d.ts.map +1 -1
  74. package/build/dts/Install/Mcp.d.ts +5 -5
  75. package/build/dts/Install/Mcp.d.ts.map +1 -1
  76. package/build/dts/Install/Opencode/Hook.d.ts +4 -3
  77. package/build/dts/Install/Opencode/Hook.d.ts.map +1 -1
  78. package/build/dts/Install/Opencode/Mcp.d.ts +11 -11
  79. package/build/dts/Install/Opencode/Mcp.d.ts.map +1 -1
  80. package/build/dts/Install/Opencode/Skill.d.ts +4 -2
  81. package/build/dts/Install/Opencode/Skill.d.ts.map +1 -1
  82. package/build/dts/Install/Skill.d.ts +3 -3
  83. package/build/dts/Install/Uninstall.d.ts +6 -6
  84. package/build/dts/Install/Uninstall.d.ts.map +1 -1
  85. package/build/dts/MarkdownAnsi.d.ts +29 -0
  86. package/build/dts/MarkdownAnsi.d.ts.map +1 -0
  87. package/build/dts/Mcp/ExpandDocs.d.ts +17 -5
  88. package/build/dts/Mcp/ExpandDocs.d.ts.map +1 -1
  89. package/build/dts/Mcp/Server.d.ts +1 -1
  90. package/build/dts/Mcp/Server.d.ts.map +1 -1
  91. package/build/dts/Mcp/tools/Citations.d.ts +100 -71
  92. package/build/dts/Mcp/tools/Citations.d.ts.map +1 -1
  93. package/build/dts/Mcp/tools/Fetch.d.ts +16 -15
  94. package/build/dts/Mcp/tools/Fetch.d.ts.map +1 -1
  95. package/build/dts/SecureFile.d.ts +23 -0
  96. package/build/dts/SecureFile.d.ts.map +1 -0
  97. package/build/dts/Snippets.d.ts +11 -12
  98. package/build/dts/Snippets.d.ts.map +1 -1
  99. package/build/dts/Telemetry.d.ts +30 -0
  100. package/build/dts/Telemetry.d.ts.map +1 -0
  101. package/build/dts/Version.d.ts +2 -0
  102. package/build/dts/Version.d.ts.map +1 -0
  103. package/build/dts/Xdg.d.ts +11 -0
  104. package/build/dts/Xdg.d.ts.map +1 -0
  105. package/build/esm/ApiClient.js +133 -10
  106. package/build/esm/ApiClient.js.map +1 -1
  107. package/build/esm/Auth/Domain.js +56 -0
  108. package/build/esm/Auth/Domain.js.map +1 -0
  109. package/build/esm/Auth/ManualAuthorization.js +253 -0
  110. package/build/esm/Auth/ManualAuthorization.js.map +1 -0
  111. package/build/esm/Auth/PendingInit.js +267 -0
  112. package/build/esm/Auth/PendingInit.js.map +1 -0
  113. package/build/esm/Auth/Pkce.js +23 -0
  114. package/build/esm/Auth/Pkce.js.map +1 -0
  115. package/build/esm/Auth/SetupGrantAuthorization.js +91 -0
  116. package/build/esm/Auth/SetupGrantAuthorization.js.map +1 -0
  117. package/build/esm/Authentication.js +38 -7
  118. package/build/esm/Authentication.js.map +1 -1
  119. package/build/esm/BrowserOAuth.js +7 -10
  120. package/build/esm/BrowserOAuth.js.map +1 -1
  121. package/build/esm/CommandPath.js +31 -0
  122. package/build/esm/CommandPath.js.map +1 -0
  123. package/build/esm/Commands/Fetch.js +30 -6
  124. package/build/esm/Commands/Fetch.js.map +1 -1
  125. package/build/esm/Commands/Init.js +371 -0
  126. package/build/esm/Commands/Init.js.map +1 -0
  127. package/build/esm/Commands/Search.js +6 -3
  128. package/build/esm/Commands/Search.js.map +1 -1
  129. package/build/esm/Commands/Status.js +186 -0
  130. package/build/esm/Commands/Status.js.map +1 -0
  131. package/build/esm/Commands/Telemetry.js +23 -0
  132. package/build/esm/Commands/Telemetry.js.map +1 -0
  133. package/build/esm/Config.js +502 -28
  134. package/build/esm/Config.js.map +1 -1
  135. package/build/esm/Hook/Claude.js +1 -1
  136. package/build/esm/Hook/Claude.js.map +1 -1
  137. package/build/esm/Hook/SnapshotNote.js +54 -7
  138. package/build/esm/Hook/SnapshotNote.js.map +1 -1
  139. package/build/esm/Init/ClaudeAdapter.js +137 -0
  140. package/build/esm/Init/ClaudeAdapter.js.map +1 -0
  141. package/build/esm/Init/ClaudeProfile.js +380 -0
  142. package/build/esm/Init/ClaudeProfile.js.map +1 -0
  143. package/build/esm/Init/Domain.js +118 -0
  144. package/build/esm/Init/Domain.js.map +1 -0
  145. package/build/esm/Init/HarnessAdapter.js +21 -0
  146. package/build/esm/Init/HarnessAdapter.js.map +1 -0
  147. package/build/esm/Init/HarnessDetector.js +65 -0
  148. package/build/esm/Init/HarnessDetector.js.map +1 -0
  149. package/build/esm/Init/HarnessRegistry.js +58 -0
  150. package/build/esm/Init/HarnessRegistry.js.map +1 -0
  151. package/build/esm/Init/MutationTransaction.js +494 -0
  152. package/build/esm/Init/MutationTransaction.js.map +1 -0
  153. package/build/esm/Init/Service.js +319 -0
  154. package/build/esm/Init/Service.js.map +1 -0
  155. package/build/esm/Init/StandardAdapters.js +116 -0
  156. package/build/esm/Init/StandardAdapters.js.map +1 -0
  157. package/build/esm/Init/Status.js +215 -0
  158. package/build/esm/Init/Status.js.map +1 -0
  159. package/build/esm/Install/Claude/Hook.js +182 -50
  160. package/build/esm/Install/Claude/Hook.js.map +1 -1
  161. package/build/esm/Install/Claude/Mcp.js +56 -26
  162. package/build/esm/Install/Claude/Mcp.js.map +1 -1
  163. package/build/esm/Install/Claude/Skill.js +49 -27
  164. package/build/esm/Install/Claude/Skill.js.map +1 -1
  165. package/build/esm/Install/Codex/Mcp.js +9 -4
  166. package/build/esm/Install/Codex/Mcp.js.map +1 -1
  167. package/build/esm/Install/Codex/Skill.js +4 -1
  168. package/build/esm/Install/Codex/Skill.js.map +1 -1
  169. package/build/esm/Install/Cursor/Mcp.js +7 -4
  170. package/build/esm/Install/Cursor/Mcp.js.map +1 -1
  171. package/build/esm/Install/Cursor/Skill.js +4 -1
  172. package/build/esm/Install/Cursor/Skill.js.map +1 -1
  173. package/build/esm/Install/Domain.js +60 -3
  174. package/build/esm/Install/Domain.js.map +1 -1
  175. package/build/esm/Install/Hook.js.map +1 -1
  176. package/build/esm/Install/Mcp.js +1 -1
  177. package/build/esm/Install/Mcp.js.map +1 -1
  178. package/build/esm/Install/Opencode/Hook.js +1 -1
  179. package/build/esm/Install/Opencode/Hook.js.map +1 -1
  180. package/build/esm/Install/Opencode/Mcp.js +6 -3
  181. package/build/esm/Install/Opencode/Mcp.js.map +1 -1
  182. package/build/esm/Install/Opencode/Skill.js +4 -1
  183. package/build/esm/Install/Opencode/Skill.js.map +1 -1
  184. package/build/esm/Install/Opencode/expandai-webfetch.js +27 -9
  185. package/build/esm/Install/Skill.js.map +1 -1
  186. package/build/esm/Install/Uninstall.js +2 -2
  187. package/build/esm/Install/Uninstall.js.map +1 -1
  188. package/build/esm/MarkdownAnsi.js +142 -0
  189. package/build/esm/MarkdownAnsi.js.map +1 -0
  190. package/build/esm/Mcp/ExpandDocs.js +44 -52
  191. package/build/esm/Mcp/ExpandDocs.js.map +1 -1
  192. package/build/esm/Mcp/RequestHeaders.js.map +1 -1
  193. package/build/esm/Mcp/Server.js +2 -1
  194. package/build/esm/Mcp/Server.js.map +1 -1
  195. package/build/esm/Mcp/tools/Citations.js +109 -8
  196. package/build/esm/Mcp/tools/Citations.js.map +1 -1
  197. package/build/esm/Mcp/tools/Fetch.js +36 -12
  198. package/build/esm/Mcp/tools/Fetch.js.map +1 -1
  199. package/build/esm/SecureFile.js +36 -0
  200. package/build/esm/SecureFile.js.map +1 -0
  201. package/build/esm/Snippets.js +12 -1
  202. package/build/esm/Snippets.js.map +1 -1
  203. package/build/esm/Telemetry.js +157 -0
  204. package/build/esm/Telemetry.js.map +1 -0
  205. package/build/esm/Version.js +4 -0
  206. package/build/esm/Version.js.map +1 -0
  207. package/build/esm/Xdg.js +15 -0
  208. package/build/esm/Xdg.js.map +1 -0
  209. package/build/esm/main.js +122 -14
  210. package/build/esm/main.js.map +1 -1
  211. package/build/skills/expandai/SKILL.md +26 -3
  212. package/package.json +4 -4
  213. package/src/ApiClient.ts +206 -13
  214. package/src/Auth/Domain.ts +63 -0
  215. package/src/Auth/ManualAuthorization.ts +296 -0
  216. package/src/Auth/PendingInit.ts +338 -0
  217. package/src/Auth/Pkce.ts +26 -0
  218. package/src/Auth/SetupGrantAuthorization.ts +116 -0
  219. package/src/Authentication.ts +49 -11
  220. package/src/BrowserOAuth.ts +10 -12
  221. package/src/CommandPath.ts +30 -0
  222. package/src/Commands/Fetch.ts +42 -11
  223. package/src/Commands/Init.ts +489 -0
  224. package/src/Commands/Search.ts +8 -3
  225. package/src/Commands/Status.ts +228 -0
  226. package/src/Commands/Telemetry.ts +42 -0
  227. package/src/Config.ts +695 -50
  228. package/src/Hook/Claude.ts +1 -1
  229. package/src/Hook/SnapshotNote.ts +55 -7
  230. package/src/Init/ClaudeAdapter.ts +191 -0
  231. package/src/Init/ClaudeProfile.ts +496 -0
  232. package/src/Init/Domain.ts +153 -0
  233. package/src/Init/HarnessAdapter.ts +35 -0
  234. package/src/Init/HarnessDetector.ts +77 -0
  235. package/src/Init/HarnessRegistry.ts +87 -0
  236. package/src/Init/MutationTransaction.ts +747 -0
  237. package/src/Init/Service.ts +385 -0
  238. package/src/Init/StandardAdapters.ts +141 -0
  239. package/src/Init/Status.ts +253 -0
  240. package/src/Install/Claude/Hook.ts +234 -81
  241. package/src/Install/Claude/Mcp.ts +80 -33
  242. package/src/Install/Claude/Skill.ts +70 -37
  243. package/src/Install/Codex/Mcp.ts +14 -9
  244. package/src/Install/Codex/Skill.ts +9 -5
  245. package/src/Install/Cursor/Mcp.ts +12 -9
  246. package/src/Install/Cursor/Skill.ts +9 -5
  247. package/src/Install/Domain.ts +77 -4
  248. package/src/Install/Hook.ts +3 -3
  249. package/src/Install/Mcp.ts +6 -6
  250. package/src/Install/Opencode/Hook.ts +5 -5
  251. package/src/Install/Opencode/Mcp.ts +11 -8
  252. package/src/Install/Opencode/Skill.ts +9 -5
  253. package/src/Install/Opencode/expandai-webfetch.js +27 -9
  254. package/src/Install/Skill.ts +3 -3
  255. package/src/Install/Uninstall.ts +3 -3
  256. package/src/MarkdownAnsi.ts +162 -0
  257. package/src/Mcp/ExpandDocs.ts +46 -55
  258. package/src/Mcp/Server.ts +2 -1
  259. package/src/Mcp/tools/Citations.ts +117 -8
  260. package/src/Mcp/tools/Fetch.ts +40 -14
  261. package/src/SecureFile.ts +70 -0
  262. package/src/Snippets.ts +19 -12
  263. package/src/Telemetry.ts +186 -0
  264. package/src/Version.ts +3 -0
  265. package/src/Xdg.ts +18 -0
  266. package/src/main.ts +171 -12
  267. package/build/dts/DeviceAuth.d.ts +0 -87
  268. package/build/dts/DeviceAuth.d.ts.map +0 -1
  269. package/build/esm/DeviceAuth.js +0 -127
  270. package/build/esm/DeviceAuth.js.map +0 -1
  271. package/src/DeviceAuth.ts +0 -193
@@ -0,0 +1,253 @@
1
+ import { DateTime, Effect, Option, Schema } from 'effect'
2
+ import {
3
+ CLI_AUTHORIZATION_CLIENT_ID,
4
+ PendingInitCorrupt,
5
+ type PendingInitKey,
6
+ PendingInitRecord,
7
+ } from '../Auth/Domain.js'
8
+ import { PendingInitStore } from '../Auth/PendingInit.js'
9
+ import { authMethodState } from '../Authentication.js'
10
+ import { ConfigManager, ConfigParseError, CredentialStoreInsecure, NotAuthenticated } from '../Config.js'
11
+ import { CLI_VERSION } from '../Version.js'
12
+ import { CLAUDE_POLICY_READ_ONLY } from './ClaudeProfile.js'
13
+ import { InitHarness, InitScope } from './Domain.js'
14
+ import type { HarnessInspection } from './HarnessAdapter.js'
15
+ import { HarnessRegistry } from './HarnessRegistry.js'
16
+
17
+ const VERSION_PATTERN = /^[0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u
18
+ const BoundedVersion = Schema.String.pipe(Schema.minLength(1), Schema.maxLength(64), Schema.pattern(VERSION_PATTERN))
19
+
20
+ export class StatusRequest extends Schema.Class<StatusRequest>('StatusRequest')({
21
+ harness: InitHarness,
22
+ scope: InitScope,
23
+ }) {}
24
+
25
+ const StatusAuth = Schema.Struct({
26
+ // `healthy` means a call would authenticate right now. An expired access
27
+ // token with a refresh token on disk reports `refresh_required`, because the
28
+ // renewal has not happened and can fail.
29
+ state: Schema.Literal('absent', 'unusable', 'refresh_required', 'healthy'),
30
+ healthy: Schema.Boolean,
31
+ })
32
+
33
+ const PendingAuthorization = Schema.Union(
34
+ Schema.Struct({ state: Schema.Literal('none'), count: Schema.Literal(0) }),
35
+ Schema.Struct({
36
+ state: Schema.Literal('approval_pending'),
37
+ count: Schema.Literal(1),
38
+ approvalExpiresAt: Schema.DateTimeUtc,
39
+ }),
40
+ )
41
+
42
+ const StatusInstallation = Schema.Struct({
43
+ configured: Schema.Boolean,
44
+ integrationVersion: Schema.optional(BoundedVersion),
45
+ components: Schema.Struct({
46
+ webfetchHook: Schema.Boolean,
47
+ runtimeSkill: Schema.Boolean,
48
+ mcp: Schema.Boolean,
49
+ }),
50
+ runtimeState: Schema.Literal('unverified', 'reload_required', 'blocked'),
51
+ reloadState: Schema.Literal('not_required', 'required'),
52
+ consentState: Schema.Literal('not_required', 'may_be_required'),
53
+ policyState: Schema.Literal('unverified', 'blocked'),
54
+ policyCodes: Schema.Array(Schema.Literal('managed_policy_blocked', 'target_read_only')).pipe(Schema.maxItems(1)),
55
+ })
56
+
57
+ export class StatusResult extends Schema.Class<StatusResult>('StatusResult')({
58
+ schemaVersion: Schema.Literal(1),
59
+ status: Schema.Literal('ok'),
60
+ harness: InitHarness,
61
+ scope: InitScope,
62
+ cli: Schema.Struct({ version: BoundedVersion }),
63
+ auth: StatusAuth,
64
+ pendingAuthorization: PendingAuthorization,
65
+ installation: StatusInstallation,
66
+ }) {}
67
+
68
+ export const StatusServiceErrorCode = Schema.Literal(
69
+ 'credential_config_malformed',
70
+ 'credential_storage_insecure',
71
+ 'credential_health_failed',
72
+ 'pending_state_malformed',
73
+ 'pending_state_unavailable',
74
+ 'harness_inspection_failed',
75
+ 'invalid_status_result',
76
+ )
77
+
78
+ export class StatusServiceError extends Schema.TaggedError<StatusServiceError>()('StatusServiceError', {
79
+ code: StatusServiceErrorCode,
80
+ recoverable: Schema.Boolean,
81
+ }) {
82
+ get message() {
83
+ switch (this.code) {
84
+ case 'credential_config_malformed':
85
+ return 'Stored credential configuration is malformed.'
86
+ case 'credential_storage_insecure':
87
+ return 'Credential storage is not secure enough to inspect.'
88
+ case 'credential_health_failed':
89
+ return 'Stored credentials could not be inspected safely.'
90
+ case 'pending_state_malformed':
91
+ return 'Pending authorization state is malformed.'
92
+ case 'pending_state_unavailable':
93
+ return 'Pending authorization state could not be inspected safely.'
94
+ case 'harness_inspection_failed':
95
+ return 'The harness configuration could not be inspected safely.'
96
+ case 'invalid_status_result':
97
+ return 'Local diagnostics returned an invalid result.'
98
+ }
99
+ }
100
+ }
101
+
102
+ function statusError(code: typeof StatusServiceErrorCode.Type, recoverable: boolean): StatusServiceError {
103
+ return new StatusServiceError({ code, recoverable })
104
+ }
105
+
106
+ function mapCredentialError(error: unknown): StatusServiceError {
107
+ if (error instanceof ConfigParseError) return statusError('credential_config_malformed', false)
108
+ if (error instanceof CredentialStoreInsecure) return statusError('credential_storage_insecure', false)
109
+ return statusError('credential_health_failed', false)
110
+ }
111
+
112
+ function mapPendingError(error: unknown): StatusServiceError {
113
+ if (error instanceof CredentialStoreInsecure) return statusError('credential_storage_insecure', false)
114
+ return error instanceof PendingInitCorrupt
115
+ ? statusError('pending_state_malformed', true)
116
+ : statusError('pending_state_unavailable', true)
117
+ }
118
+
119
+ function authStatus(configManager: ConfigManager) {
120
+ return Effect.gen(function* () {
121
+ const loaded = yield* Effect.either(configManager.loadConfig())
122
+ if (loaded._tag === 'Left') {
123
+ if (loaded.left instanceof NotAuthenticated) return { state: 'absent' as const, healthy: false }
124
+ return yield* mapCredentialError(loaded.left)
125
+ }
126
+ const now = yield* DateTime.now
127
+ const state = authMethodState(loaded.right.authMethod, now)
128
+ return { state, healthy: state === 'healthy' }
129
+ })
130
+ }
131
+
132
+ function pendingStatus(record: Option.Option<PendingInitRecord>) {
133
+ return Effect.gen(function* () {
134
+ if (Option.isNone(record)) return { state: 'none' as const, count: 0 as const }
135
+ const now = DateTime.toEpochMillis(yield* DateTime.now)
136
+ if (DateTime.toEpochMillis(record.value.approvalExpiresAt) <= now) {
137
+ return { state: 'none' as const, count: 0 as const }
138
+ }
139
+ return {
140
+ state: 'approval_pending' as const,
141
+ count: 1 as const,
142
+ approvalExpiresAt: DateTime.formatIso(record.value.approvalExpiresAt),
143
+ }
144
+ })
145
+ }
146
+
147
+ function validateInspection(
148
+ harness: typeof InitHarness.Type,
149
+ inspection: HarnessInspection,
150
+ ): Effect.Effect<HarnessInspection, StatusServiceError> {
151
+ const componentSet = new Set(inspection.components)
152
+ // Only the harnesses with a web-fetch hook install three components; cursor
153
+ // and codex are complete with two. Demanding three of them reported a
154
+ // correctly configured machine as an invalid result.
155
+ const expectsHook = harness === 'claude-code' || harness === 'opencode'
156
+ const allComponents =
157
+ componentSet.has('runtime-skill') &&
158
+ componentSet.has('mcp') &&
159
+ (expectsHook ? componentSet.has('webfetch-hook') && componentSet.size === 3 : componentSet.size === 2)
160
+ const versionValid =
161
+ inspection.integrationVersion === undefined ||
162
+ (inspection.integrationVersion.length <= 64 && VERSION_PATTERN.test(inspection.integrationVersion))
163
+ const configuredValid = inspection.configured === allComponents
164
+ const runtimeValid = inspection.runtimeState !== 'observed'
165
+ return componentSet.size === inspection.components.length && versionValid && configuredValid && runtimeValid
166
+ ? Effect.succeed(inspection)
167
+ : statusError('invalid_status_result', false)
168
+ }
169
+
170
+ function installationStatus(inspection: HarnessInspection, scope: typeof InitScope.Type) {
171
+ const components = new Set(inspection.components)
172
+ const policyBlocked = inspection.policyBlock !== undefined || inspection.runtimeState === 'blocked'
173
+ const policyCodes =
174
+ inspection.policyBlock === CLAUDE_POLICY_READ_ONLY
175
+ ? (['target_read_only'] as const)
176
+ : policyBlocked
177
+ ? (['managed_policy_blocked'] as const)
178
+ : []
179
+ const reloadRequired = !policyBlocked && inspection.runtimeState === 'reload_required'
180
+ return {
181
+ configured: inspection.configured,
182
+ ...(inspection.integrationVersion === undefined ? {} : { integrationVersion: inspection.integrationVersion }),
183
+ components: {
184
+ webfetchHook: components.has('webfetch-hook'),
185
+ runtimeSkill: components.has('runtime-skill'),
186
+ mcp: components.has('mcp'),
187
+ },
188
+ runtimeState: policyBlocked
189
+ ? ('blocked' as const)
190
+ : reloadRequired
191
+ ? ('reload_required' as const)
192
+ : ('unverified' as const),
193
+ reloadState: reloadRequired ? ('required' as const) : ('not_required' as const),
194
+ consentState: scope === 'project' ? ('may_be_required' as const) : ('not_required' as const),
195
+ policyState: policyBlocked ? ('blocked' as const) : ('unverified' as const),
196
+ policyCodes,
197
+ }
198
+ }
199
+
200
+ export class StatusService extends Effect.Service<StatusService>()('@expandai/cli/Init/StatusService', {
201
+ dependencies: [ConfigManager.Default, PendingInitStore.Default, HarnessRegistry.Default],
202
+ effect: Effect.gen(function* () {
203
+ const configManager = yield* ConfigManager
204
+ const pendingStore = yield* PendingInitStore
205
+ const registry = yield* HarnessRegistry
206
+
207
+ const run = Effect.fn('StatusService.run')(function* (request: StatusRequest) {
208
+ yield* Effect.annotateCurrentSpan({ harness: request.harness, scope: request.scope })
209
+ return yield* Effect.gen(function* () {
210
+ yield* configManager
211
+ .inspectSecureStorage()
212
+ .pipe(Effect.withTracerEnabled(false), Effect.mapError(mapCredentialError))
213
+ const auth = yield* authStatus(configManager).pipe(Effect.withTracerEnabled(false))
214
+ const apiUrl = yield* configManager
215
+ .getApiUrl()
216
+ .pipe(Effect.withTracerEnabled(false), Effect.mapError(mapCredentialError))
217
+ const canonicalScopeRoot = yield* pendingStore
218
+ .canonicalScopeRoot(request.scope)
219
+ .pipe(Effect.withTracerEnabled(false), Effect.mapError(mapPendingError))
220
+ const key: PendingInitKey = {
221
+ apiOrigin: apiUrl.origin,
222
+ clientId: CLI_AUTHORIZATION_CLIENT_ID,
223
+ harness: 'agent-harnesses',
224
+ scope: request.scope,
225
+ canonicalScopeRoot,
226
+ }
227
+ const pending = yield* pendingStore
228
+ .peek(key)
229
+ .pipe(Effect.withTracerEnabled(false), Effect.mapError(mapPendingError))
230
+ const inspection = yield* registry.inspect(request.harness, request.scope).pipe(
231
+ Effect.withTracerEnabled(false),
232
+ Effect.mapError(() => statusError('harness_inspection_failed', true)),
233
+ Effect.flatMap((inspection) => validateInspection(request.harness, inspection)),
234
+ )
235
+ const candidate = {
236
+ schemaVersion: 1 as const,
237
+ status: 'ok' as const,
238
+ harness: request.harness,
239
+ scope: request.scope,
240
+ cli: { version: CLI_VERSION },
241
+ auth,
242
+ pendingAuthorization: yield* pendingStatus(pending),
243
+ installation: installationStatus(inspection, request.scope),
244
+ }
245
+ return yield* Schema.decodeUnknown(StatusResult)(candidate).pipe(
246
+ Effect.mapError(() => statusError('invalid_status_result', false)),
247
+ )
248
+ })
249
+ })
250
+
251
+ return { run } as const
252
+ }),
253
+ }) {}
@@ -1,43 +1,213 @@
1
1
  import { homedir } from 'node:os'
2
2
  import { Array, Config, Console, Effect, Match, Schema } from 'effect'
3
- import { ConfigIo } from '../Domain.js'
4
- import type { Scope } from '../Mcp.js'
3
+ import { CLI_VERSION } from '../../Version.js'
4
+ import { type CliCommand, ConfigIo, cliShellCommand, DIRECT_CLI } from '../Domain.js'
5
+ import type { InstallScope } from '../Mcp.js'
6
+
7
+ /** Claude Code WebFetch hook invocation persisted in harness settings. */
8
+ export const HOOK_INVOCATION = 'expandai hook claude-code'
9
+ export const HOOK_COMMAND = HOOK_INVOCATION
10
+ const HOOK_ARGS = ['hook', 'claude-code'] as const
5
11
 
6
12
  /**
7
- * Claude Code hook config — `~/.claude/settings.json` (global) or
8
- * `<cwd>/.claude/settings.json` (project). PreToolUse hooks fire on built-in
9
- * tools; we register the WebFetch matcher to route to `expandai hook claude-code`.
13
+ * The hook line for a resolved CLI. Defaults to the bare `expandai` command;
14
+ * when the CLI is not on PATH — an `npx expandai init` with no global install —
15
+ * `CliInvocation` resolves to the npx form and the written hook stays runnable.
10
16
  */
11
-
12
- export const HOOK_COMMAND = 'expandai hook claude-code'
17
+ export function hookCommandFor(cli: CliCommand = DIRECT_CLI): string {
18
+ return cliShellCommand(cli, HOOK_ARGS)
19
+ }
13
20
  export const WEBFETCH_MATCHER = 'WebFetch'
14
21
 
15
- export const HookCommandEntry = Schema.Struct({
16
- type: Schema.Literal('command'),
17
- command: Schema.String,
18
- })
22
+ export const HookCommandEntry = Schema.Struct(
23
+ {
24
+ type: Schema.Literal('command'),
25
+ command: Schema.String,
26
+ expandaiProfileVersion: Schema.optional(Schema.String),
27
+ /** Whether this install added the `WebFetch` deny rule — see `makeExpandaiMatcher`. */
28
+ expandaiManagedDeny: Schema.optional(Schema.Boolean),
29
+ },
30
+ Schema.Record({ key: Schema.String, value: Schema.Unknown }),
31
+ )
19
32
 
20
- export const HookMatcher = Schema.Struct({
21
- matcher: Schema.optional(Schema.String),
22
- hooks: Schema.Array(HookCommandEntry),
23
- })
33
+ export const HookMatcher = Schema.Struct(
34
+ {
35
+ matcher: Schema.optional(Schema.String),
36
+ hooks: Schema.Array(HookCommandEntry),
37
+ },
38
+ Schema.Record({ key: Schema.String, value: Schema.Unknown }),
39
+ )
24
40
 
25
41
  const HooksSection = Schema.Struct(
26
42
  { PreToolUse: Schema.optional(Schema.Array(HookMatcher)) },
27
43
  Schema.Record({ key: Schema.String, value: Schema.Unknown }),
28
44
  )
29
45
 
46
+ const PermissionsSection = Schema.Struct(
47
+ { deny: Schema.optional(Schema.Array(Schema.String)) },
48
+ Schema.Record({ key: Schema.String, value: Schema.Unknown }),
49
+ )
50
+
30
51
  export const SettingsSchema = Schema.parseJson(
31
52
  Schema.Struct(
32
- { hooks: Schema.optionalWith(HooksSection, { default: () => ({}) as typeof HooksSection.Type }) },
53
+ {
54
+ hooks: Schema.optionalWith(HooksSection, { default: () => ({}) as typeof HooksSection.Type }),
55
+ permissions: Schema.optional(PermissionsSection),
56
+ },
33
57
  Schema.Record({ key: Schema.String, value: Schema.Unknown }),
34
58
  ),
35
59
  { space: 2 },
36
60
  )
37
61
 
38
- export const expandaiMatcher = {
39
- matcher: WEBFETCH_MATCHER,
40
- hooks: [{ type: 'command' as const, command: HOOK_COMMAND }],
62
+ export interface ClaudeHookPlan {
63
+ readonly changed: boolean
64
+ readonly settings: typeof SettingsSchema.Type
65
+ }
66
+
67
+ export function isExpandaiHookCommand(command: string): boolean {
68
+ const value = command.trim()
69
+ const invocation = String.raw`expandai(?:\.exe)?\s+hook\s+(?:claude-code|claude)`
70
+ const direct = new RegExp(String.raw`^(?:npx\s+-y\s+)?${invocation}$`, 'u')
71
+ const absolute = new RegExp(
72
+ String.raw`^(?:"(?:[A-Za-z]:\\|/)[^"]*[\\/]expandai(?:\.exe)?"|'(?:[A-Za-z]:\\|/)[^']*[\\/]expandai(?:\.exe)?'|(?:[A-Za-z]:\\|/)[^\s]*[\\/]expandai(?:\.exe)?)\s+hook\s+(?:claude-code|claude)$`,
73
+ 'u',
74
+ )
75
+ const shellFallback =
76
+ /^if\s+command\s+-v\s+expandai\s+>\/dev\/null\s+2>&1;\s*then\s+expandai\s+hook\s+(?:claude-code|claude);\s*else\s+npx\s+-y\s+expandai\s+hook\s+(?:claude-code|claude);\s*fi$/u
77
+ return direct.test(value) || absolute.test(value) || shellFallback.test(value)
78
+ }
79
+
80
+ /**
81
+ * `expandaiManagedDeny` records whether *we* added `WebFetch` to
82
+ * `permissions.deny`, so uninstall can tell our entry from an identical one the
83
+ * user set first. A deny entry is a bare string with nowhere to carry that, and
84
+ * "our hook is present" is not the same claim: installing over a settings file
85
+ * that already denied `WebFetch` leaves the hook without us having written the
86
+ * rule, and removing it then revokes a control its owner chose.
87
+ */
88
+ export function makeExpandaiMatcher(
89
+ profileVersion: string,
90
+ cli: CliCommand = DIRECT_CLI,
91
+ managedDeny = true,
92
+ ): typeof HookMatcher.Type {
93
+ return {
94
+ matcher: WEBFETCH_MATCHER,
95
+ hooks: [
96
+ {
97
+ type: 'command',
98
+ command: hookCommandFor(cli),
99
+ expandaiProfileVersion: profileVersion,
100
+ expandaiManagedDeny: managedDeny,
101
+ },
102
+ ],
103
+ }
104
+ }
105
+
106
+ /** True only when our own hook entry says we wrote the deny rule. */
107
+ export function expandaiOwnsWebFetchDeny(settings: typeof SettingsSchema.Type): boolean {
108
+ return (settings.hooks.PreToolUse ?? []).some((entry) =>
109
+ entry.hooks.some((hook) => isExpandaiHookCommand(hook.command) && hook.expandaiManagedDeny === true),
110
+ )
111
+ }
112
+
113
+ function webFetchAlreadyDenied(settings: typeof SettingsSchema.Type): boolean {
114
+ return (settings.permissions?.deny ?? []).includes(WEBFETCH_MATCHER)
115
+ }
116
+
117
+ export const expandaiMatcher = makeExpandaiMatcher(CLI_VERSION)
118
+
119
+ function stripExpandaiHooks(entries: ReadonlyArray<typeof HookMatcher.Type>): Array<typeof HookMatcher.Type> {
120
+ return Array.flatMap(entries, (entry) => {
121
+ const hooks = Array.filter(entry.hooks, (hook) => !isExpandaiHookCommand(hook.command))
122
+ return hooks.length === 0 && hooks.length !== entry.hooks.length ? [] : [{ ...entry, hooks }]
123
+ })
124
+ }
125
+
126
+ /**
127
+ * Denying `WebFetch` removes it from the toolset rather than blocking it per call,
128
+ * so the agent reaches for Expand's tool instead of being refused. That difference
129
+ * is the whole point: a hook can only answer a WebFetch call with `deny`, which
130
+ * Claude Code renders to the user as `Error:` on every single fetch.
131
+ *
132
+ * The hook stays installed as the fallback. With the deny rule in force WebFetch is
133
+ * never called, so the hook never fires; if the rule is ever absent or overridden,
134
+ * the hook still intercepts — with the red line, but correctly.
135
+ */
136
+ export function planClaudeWebFetchDeny(settings: typeof SettingsSchema.Type): ClaudeHookPlan {
137
+ const deny = settings.permissions?.deny ?? []
138
+ if (deny.includes(WEBFETCH_MATCHER)) return { changed: false, settings }
139
+ return {
140
+ changed: true,
141
+ settings: {
142
+ ...settings,
143
+ permissions: { ...(settings.permissions ?? {}), deny: [...deny, WEBFETCH_MATCHER] },
144
+ },
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Drops the `WebFetch` entry; anything else the user denied is left alone.
150
+ *
151
+ * A deny entry is a bare string with nowhere to record who wrote it, so this
152
+ * cannot tell our rule from an identical one the user added themselves. The
153
+ * caller supplies that evidence — see `uninstall`.
154
+ */
155
+ export function planClaudeWebFetchDenyRemoval(settings: typeof SettingsSchema.Type): ClaudeHookPlan {
156
+ const deny = settings.permissions?.deny
157
+ if (deny === undefined || !deny.includes(WEBFETCH_MATCHER)) return { changed: false, settings }
158
+ const remaining = deny.filter((entry) => entry !== WEBFETCH_MATCHER)
159
+ const permissions = { ...settings.permissions, deny: remaining }
160
+ return { changed: true, settings: { ...settings, permissions } }
161
+ }
162
+
163
+ export function planClaudeHook(
164
+ settings: typeof SettingsSchema.Type,
165
+ profileVersion: string = CLI_VERSION,
166
+ cli: CliCommand = DIRECT_CLI,
167
+ ): ClaudeHookPlan {
168
+ const preToolUse = settings.hooks.PreToolUse ?? []
169
+ const owned = preToolUse.flatMap((entry) =>
170
+ entry.hooks.filter((hook) => isExpandaiHookCommand(hook.command)).map((hook) => ({ entry, hook })),
171
+ )
172
+ // The marker records history — did *this* install add the rule — so once it is
173
+ // written it must be preserved, not recomputed. Recomputing it from present
174
+ // state makes the plan disagree with what it just wrote: after we add the deny
175
+ // rule, `webFetchAlreadyDenied` is true, so a second plan would decide the rule
176
+ // was never ours and rewrite the hook forever.
177
+ const existingMarker = owned[0]?.hook.expandaiManagedDeny
178
+ const managedDeny = existingMarker ?? !webFetchAlreadyDenied(settings)
179
+ const current =
180
+ owned.length === 1 &&
181
+ owned[0]?.entry.matcher === WEBFETCH_MATCHER &&
182
+ owned[0]?.hook.command === hookCommandFor(cli) &&
183
+ owned[0]?.hook.expandaiProfileVersion === profileVersion &&
184
+ owned[0]?.hook.expandaiManagedDeny === managedDeny
185
+ if (current) return { changed: false, settings }
186
+
187
+ return {
188
+ changed: true,
189
+ settings: {
190
+ ...settings,
191
+ hooks: {
192
+ ...settings.hooks,
193
+ PreToolUse: [...stripExpandaiHooks(preToolUse), makeExpandaiMatcher(profileVersion, cli, managedDeny)],
194
+ },
195
+ },
196
+ }
197
+ }
198
+
199
+ export function planClaudeHookRemoval(settings: typeof SettingsSchema.Type): ClaudeHookPlan {
200
+ const preToolUse = settings.hooks.PreToolUse ?? []
201
+ const changed = preToolUse.some((entry) => entry.hooks.some((hook) => isExpandaiHookCommand(hook.command)))
202
+ return changed
203
+ ? {
204
+ changed,
205
+ settings: {
206
+ ...settings,
207
+ hooks: { ...settings.hooks, PreToolUse: stripExpandaiHooks(preToolUse) },
208
+ },
209
+ }
210
+ : { changed, settings }
41
211
  }
42
212
 
43
213
  export class ClaudeHook extends Effect.Service<ClaudeHook>()('@expandai/cli/Install/Claude/Hook', {
@@ -47,7 +217,7 @@ export class ClaudeHook extends Effect.Service<ClaudeHook>()('@expandai/cli/Inst
47
217
  const home = yield* Config.string('HOME').pipe(Config.withDefault(homedir()))
48
218
  const cwd = yield* Config.string('PWD').pipe(Config.withDefault(process.cwd()))
49
219
 
50
- const pathFor = Effect.fn(function* (scope: Scope) {
220
+ const pathFor = Effect.fn(function* (scope: InstallScope) {
51
221
  return yield* Match.value(scope).pipe(
52
222
  Match.when('global', () => Effect.succeed(`${home}/.claude/settings.json`)),
53
223
  Match.when('project', () => Effect.succeed(`${cwd}/.claude/settings.json`)),
@@ -55,79 +225,62 @@ export class ClaudeHook extends Effect.Service<ClaudeHook>()('@expandai/cli/Inst
55
225
  )
56
226
  })
57
227
 
58
- const install = Effect.fn('ClaudeHook.install')(function* (scope: Scope) {
228
+ const install = Effect.fn('ClaudeHook.install')(function* (scope: InstallScope) {
59
229
  const target = yield* pathFor(scope)
60
230
  const settings = yield* io.read(target, SettingsSchema)
61
-
62
- const preToolUse = settings.hooks.PreToolUse ?? []
63
- const alreadyInstalled = preToolUse.some(
64
- (entry) => entry.matcher === WEBFETCH_MATCHER && entry.hooks.some((hook) => hook.command === HOOK_COMMAND),
65
- )
66
-
67
- if (alreadyInstalled) {
231
+ // Both halves, exactly as `init` writes them. This used to install the hook
232
+ // alone, which left the deny rule to `init` only — and made `uninstall`'s
233
+ // ownership rule false: it treats our hook as evidence that we wrote the
234
+ // deny entry, so a rule the user added after a bare `hook install` was
235
+ // deleted as if it were ours.
236
+ const hookPlan = planClaudeHook(settings)
237
+ const plan = planClaudeWebFetchDeny(hookPlan.settings)
238
+ if (!hookPlan.changed && !plan.changed) {
68
239
  yield* Console.log(`expandai WebFetch hook already installed at ${target}`)
69
240
  return
70
241
  }
71
-
72
- yield* io.write(
73
- target,
74
- {
75
- ...settings,
76
- hooks: {
77
- ...settings.hooks,
78
- PreToolUse: [...preToolUse, expandaiMatcher],
79
- },
80
- },
81
- SettingsSchema,
82
- )
83
- yield* Console.log(`Installed expandai WebFetch hook at ${target}`)
242
+ yield* io.write(target, plan.settings, SettingsSchema)
243
+ yield* Console.log(`Installed expandai WebFetch hook and deny rule at ${target}`)
84
244
  })
85
245
 
86
- const uninstall = Effect.fn('ClaudeHook.uninstall')(function* (scope: Scope) {
246
+ const uninstall = Effect.fn('ClaudeHook.uninstall')(function* (scope: InstallScope) {
87
247
  const target = yield* pathFor(scope)
88
- const exists = yield* io.exists(target)
89
- if (!exists) {
90
- return
91
- }
92
-
248
+ if (!(yield* io.exists(target))) return
93
249
  const settings = yield* io.read(target, SettingsSchema)
94
- const preToolUse = settings.hooks.PreToolUse ?? []
95
- const updatedPreToolUse = Array.filter(
96
- Array.map(preToolUse, (entry) => ({
97
- ...entry,
98
- hooks: Array.filter(entry.hooks, (hook) => hook.command !== HOOK_COMMAND),
99
- })),
100
- (entry) => entry.matcher !== WEBFETCH_MATCHER || entry.hooks.length > 0,
250
+ // Uninstall has to undo both halves, or `WebFetch` stays denied with nothing
251
+ // left to serve the fetch — worse than never having installed us.
252
+ //
253
+ // But only the halves we wrote. `expandaiManagedDeny` on our hook records
254
+ // whether this install added the deny rule; without it, the rule is either
255
+ // the user's own or from an install predating the marker, and those are
256
+ // indistinguishable. Guessing "ours" revokes a control its owner chose;
257
+ // guessing "theirs" leaves `WebFetch` denied with nothing serving fetches.
258
+ // So leave it and say so — `uninstall` also fans out over both scopes, and
259
+ // would otherwise reach into a global settings file a project-scoped
260
+ // install never touched.
261
+ const hookPlan = planClaudeHookRemoval(settings)
262
+ if (!hookPlan.changed) return
263
+ // Read the marker off the hook before it is stripped.
264
+ const owned = expandaiOwnsWebFetchDeny(settings)
265
+ const denyPlan = owned ? planClaudeWebFetchDenyRemoval(hookPlan.settings) : hookPlan
266
+ const strandedDeny = !owned && (settings.permissions?.deny ?? []).includes(WEBFETCH_MATCHER)
267
+ yield* io.write(target, denyPlan.settings, SettingsSchema)
268
+ // `denyPlan` is the hook plan itself when we do not own the rule, so its
269
+ // `changed` flag reports the hook removal — not a deny removal that never
270
+ // happened.
271
+ const removedDeny = owned && denyPlan.changed
272
+ yield* Console.log(
273
+ removedDeny
274
+ ? `Removed expandai WebFetch hook and deny rule from ${target}`
275
+ : `Removed expandai WebFetch hook from ${target}`,
101
276
  )
102
-
103
- // Compare total hook-command count rather than outer-array length:
104
- // our HOOK_COMMAND can sit alongside other hooks in a shared matcher
105
- // entry (e.g. a user merged it in by hand), in which case the entry
106
- // stays after filtering but the inner hook count drops.
107
- const countCommands = Effect.fn(function* (entries: typeof preToolUse) {
108
- return Array.reduce(entries, 0, (n, entry) => n + entry.hooks.length)
109
- })
110
-
111
- const before = yield* countCommands(preToolUse)
112
- const after = yield* countCommands(updatedPreToolUse)
113
- if (before === after) {
114
- return
277
+ if (strandedDeny) {
278
+ yield* Console.log(
279
+ `Left "WebFetch" in permissions.deny at ${target} — expandai could not confirm it added that rule. Remove it by hand if you want Claude Code's built-in WebFetch back.`,
280
+ )
115
281
  }
116
-
117
- yield* io.write(
118
- target,
119
- {
120
- ...settings,
121
- hooks: {
122
- ...settings.hooks,
123
- PreToolUse: updatedPreToolUse,
124
- },
125
- },
126
- SettingsSchema,
127
- )
128
- yield* Console.log(`Removed expandai WebFetch hook from ${target}`)
129
282
  })
130
283
 
131
- return { install, uninstall } as const
284
+ return { install, uninstall, pathFor } as const
132
285
  }),
133
286
  }) {}