@tonycasey/lisa 2.2.0 → 2.5.5

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 (262) hide show
  1. package/dist/lib/application/handlers/PromptSubmitHandler.d.ts +22 -12
  2. package/dist/lib/application/handlers/PromptSubmitHandler.d.ts.map +1 -1
  3. package/dist/lib/application/handlers/PromptSubmitHandler.js +36 -13
  4. package/dist/lib/application/handlers/PromptSubmitHandler.js.map +1 -1
  5. package/dist/lib/application/handlers/SessionStartHandler.d.ts +47 -5
  6. package/dist/lib/application/handlers/SessionStartHandler.d.ts.map +1 -1
  7. package/dist/lib/application/handlers/SessionStartHandler.js +164 -37
  8. package/dist/lib/application/handlers/SessionStartHandler.js.map +1 -1
  9. package/dist/lib/application/handlers/SessionStopHandler.d.ts +29 -5
  10. package/dist/lib/application/handlers/SessionStopHandler.d.ts.map +1 -1
  11. package/dist/lib/application/handlers/SessionStopHandler.js +83 -11
  12. package/dist/lib/application/handlers/SessionStopHandler.js.map +1 -1
  13. package/dist/lib/application/interfaces/index.d.ts +1 -0
  14. package/dist/lib/application/interfaces/index.d.ts.map +1 -1
  15. package/dist/lib/application/mediator/IMediator.d.ts +73 -0
  16. package/dist/lib/application/mediator/IMediator.d.ts.map +1 -0
  17. package/dist/lib/application/mediator/IMediator.js +12 -0
  18. package/dist/lib/application/mediator/IMediator.js.map +1 -0
  19. package/dist/lib/application/mediator/Mediator.d.ts +29 -0
  20. package/dist/lib/application/mediator/Mediator.d.ts.map +1 -0
  21. package/dist/lib/application/mediator/Mediator.js +53 -0
  22. package/dist/lib/application/mediator/Mediator.js.map +1 -0
  23. package/dist/lib/application/mediator/index.d.ts +10 -0
  24. package/dist/lib/application/mediator/index.d.ts.map +1 -0
  25. package/dist/lib/application/mediator/index.js +18 -0
  26. package/dist/lib/application/mediator/index.js.map +1 -0
  27. package/dist/lib/application/mediator/requests/PromptSubmitRequest.d.ts +60 -0
  28. package/dist/lib/application/mediator/requests/PromptSubmitRequest.d.ts.map +1 -0
  29. package/dist/lib/application/mediator/requests/PromptSubmitRequest.js +35 -0
  30. package/dist/lib/application/mediator/requests/PromptSubmitRequest.js.map +1 -0
  31. package/dist/lib/application/mediator/requests/SessionStartRequest.d.ts +36 -0
  32. package/dist/lib/application/mediator/requests/SessionStartRequest.d.ts.map +1 -0
  33. package/dist/lib/application/mediator/requests/SessionStartRequest.js +32 -0
  34. package/dist/lib/application/mediator/requests/SessionStartRequest.js.map +1 -0
  35. package/dist/lib/application/mediator/requests/SessionStopRequest.d.ts +67 -0
  36. package/dist/lib/application/mediator/requests/SessionStopRequest.d.ts.map +1 -0
  37. package/dist/lib/application/mediator/requests/SessionStopRequest.js +35 -0
  38. package/dist/lib/application/mediator/requests/SessionStopRequest.js.map +1 -0
  39. package/dist/lib/application/mediator/requests/index.d.ts +9 -0
  40. package/dist/lib/application/mediator/requests/index.d.ts.map +1 -0
  41. package/dist/lib/application/mediator/requests/index.js +13 -0
  42. package/dist/lib/application/mediator/requests/index.js.map +1 -0
  43. package/dist/lib/cli.d.ts +2 -44
  44. package/dist/lib/cli.d.ts.map +1 -1
  45. package/dist/lib/cli.js +351 -606
  46. package/dist/lib/cli.js.map +1 -1
  47. package/dist/lib/commands/docker.d.ts +20 -0
  48. package/dist/lib/commands/docker.d.ts.map +1 -0
  49. package/dist/lib/commands/docker.js +27 -0
  50. package/dist/lib/commands/docker.js.map +1 -0
  51. package/dist/lib/commands/doctor.d.ts +94 -0
  52. package/dist/lib/commands/doctor.d.ts.map +1 -0
  53. package/dist/lib/commands/doctor.js +716 -0
  54. package/dist/lib/commands/doctor.js.map +1 -0
  55. package/dist/lib/commands/index.d.ts +10 -0
  56. package/dist/lib/commands/index.d.ts.map +1 -0
  57. package/dist/lib/commands/index.js +31 -0
  58. package/dist/lib/commands/index.js.map +1 -0
  59. package/dist/lib/commands/init.d.ts +31 -0
  60. package/dist/lib/commands/init.d.ts.map +1 -0
  61. package/dist/lib/commands/init.js +497 -0
  62. package/dist/lib/commands/init.js.map +1 -0
  63. package/dist/lib/commands/shared/constants.d.ts +27 -0
  64. package/dist/lib/commands/shared/constants.d.ts.map +1 -0
  65. package/dist/lib/commands/shared/constants.js +46 -0
  66. package/dist/lib/commands/shared/constants.js.map +1 -0
  67. package/dist/lib/commands/shared/index.d.ts +5 -0
  68. package/dist/lib/commands/shared/index.d.ts.map +1 -0
  69. package/dist/lib/commands/shared/index.js +15 -0
  70. package/dist/lib/commands/shared/index.js.map +1 -0
  71. package/dist/lib/domain/index.d.ts +4 -2
  72. package/dist/lib/domain/index.d.ts.map +1 -1
  73. package/dist/lib/domain/index.js +5 -2
  74. package/dist/lib/domain/index.js.map +1 -1
  75. package/dist/lib/domain/interfaces/ILabelInference.d.ts +62 -0
  76. package/dist/lib/domain/interfaces/ILabelInference.d.ts.map +1 -0
  77. package/dist/lib/domain/interfaces/ILabelInference.js +11 -0
  78. package/dist/lib/domain/interfaces/ILabelInference.js.map +1 -0
  79. package/dist/lib/domain/interfaces/ILisaServices.d.ts +6 -0
  80. package/dist/lib/domain/interfaces/ILisaServices.d.ts.map +1 -1
  81. package/dist/lib/domain/interfaces/IMcpClient.d.ts +15 -2
  82. package/dist/lib/domain/interfaces/IMcpClient.d.ts.map +1 -1
  83. package/dist/lib/domain/interfaces/ISessionCaptureService.d.ts +2 -1
  84. package/dist/lib/domain/interfaces/ISessionCaptureService.d.ts.map +1 -1
  85. package/dist/lib/domain/interfaces/IStructuredLog.d.ts +162 -0
  86. package/dist/lib/domain/interfaces/IStructuredLog.d.ts.map +1 -0
  87. package/dist/lib/domain/interfaces/IStructuredLog.js +85 -0
  88. package/dist/lib/domain/interfaces/IStructuredLog.js.map +1 -0
  89. package/dist/lib/domain/interfaces/index.d.ts +2 -0
  90. package/dist/lib/domain/interfaces/index.d.ts.map +1 -1
  91. package/dist/lib/domain/interfaces/index.js +6 -0
  92. package/dist/lib/domain/interfaces/index.js.map +1 -1
  93. package/dist/lib/domain/interfaces/types/ITask.d.ts +16 -0
  94. package/dist/lib/domain/interfaces/types/ITask.d.ts.map +1 -1
  95. package/dist/lib/domain/interfaces/types/ITask.js.map +1 -1
  96. package/dist/lib/domain/utils/cancellation.d.ts +111 -0
  97. package/dist/lib/domain/utils/cancellation.d.ts.map +1 -0
  98. package/dist/lib/domain/utils/cancellation.js +168 -0
  99. package/dist/lib/domain/utils/cancellation.js.map +1 -0
  100. package/dist/lib/domain/utils/index.d.ts +8 -0
  101. package/dist/lib/domain/utils/index.d.ts.map +1 -0
  102. package/dist/lib/domain/utils/index.js +16 -0
  103. package/dist/lib/domain/utils/index.js.map +1 -0
  104. package/dist/lib/infrastructure/adapters/claude/session-start.d.ts +1 -1
  105. package/dist/lib/infrastructure/adapters/claude/session-start.js +9 -11
  106. package/dist/lib/infrastructure/adapters/claude/session-start.js.map +1 -1
  107. package/dist/lib/infrastructure/adapters/claude/session-stop.d.ts +1 -5
  108. package/dist/lib/infrastructure/adapters/claude/session-stop.d.ts.map +1 -1
  109. package/dist/lib/infrastructure/adapters/claude/session-stop.js +12 -15
  110. package/dist/lib/infrastructure/adapters/claude/session-stop.js.map +1 -1
  111. package/dist/lib/infrastructure/adapters/claude/user-prompt-submit.d.ts +1 -1
  112. package/dist/lib/infrastructure/adapters/claude/user-prompt-submit.js +9 -11
  113. package/dist/lib/infrastructure/adapters/claude/user-prompt-submit.js.map +1 -1
  114. package/dist/lib/infrastructure/adapters/opencode/plugin.d.ts +2 -2
  115. package/dist/lib/infrastructure/adapters/opencode/plugin.d.ts.map +1 -1
  116. package/dist/lib/infrastructure/adapters/opencode/plugin.js +16 -21
  117. package/dist/lib/infrastructure/adapters/opencode/plugin.js.map +1 -1
  118. package/dist/lib/infrastructure/cli/index.d.ts +8 -0
  119. package/dist/lib/infrastructure/cli/index.d.ts.map +1 -0
  120. package/dist/lib/infrastructure/cli/index.js +15 -0
  121. package/dist/lib/infrastructure/cli/index.js.map +1 -0
  122. package/dist/lib/infrastructure/cli/io.d.ts +91 -0
  123. package/dist/lib/infrastructure/cli/io.d.ts.map +1 -0
  124. package/dist/lib/infrastructure/cli/io.js +128 -0
  125. package/dist/lib/infrastructure/cli/io.js.map +1 -0
  126. package/dist/lib/infrastructure/dal/connections/McpConnectionManager.js +1 -1
  127. package/dist/lib/infrastructure/dal/connections/McpConnectionManager.js.map +1 -1
  128. package/dist/lib/infrastructure/dal/repositories/mcp/McpTaskRepository.d.ts.map +1 -1
  129. package/dist/lib/infrastructure/dal/repositories/mcp/McpTaskRepository.js +6 -2
  130. package/dist/lib/infrastructure/dal/repositories/mcp/McpTaskRepository.js.map +1 -1
  131. package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jTaskRepository.d.ts +5 -2
  132. package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jTaskRepository.d.ts.map +1 -1
  133. package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jTaskRepository.js +78 -45
  134. package/dist/lib/infrastructure/dal/repositories/neo4j/Neo4jTaskRepository.js.map +1 -1
  135. package/dist/lib/infrastructure/dal/repositories/zep/ZepTaskRepository.d.ts.map +1 -1
  136. package/dist/lib/infrastructure/dal/repositories/zep/ZepTaskRepository.js +6 -2
  137. package/dist/lib/infrastructure/dal/repositories/zep/ZepTaskRepository.js.map +1 -1
  138. package/dist/lib/infrastructure/di/Container.d.ts +72 -0
  139. package/dist/lib/infrastructure/di/Container.d.ts.map +1 -0
  140. package/dist/lib/infrastructure/di/Container.js +182 -0
  141. package/dist/lib/infrastructure/di/Container.js.map +1 -0
  142. package/dist/lib/infrastructure/di/IContainer.d.ts +87 -0
  143. package/dist/lib/infrastructure/di/IContainer.d.ts.map +1 -0
  144. package/dist/lib/infrastructure/di/IContainer.js +11 -0
  145. package/dist/lib/infrastructure/di/IContainer.js.map +1 -0
  146. package/dist/lib/infrastructure/di/ServiceFactory.d.ts +6 -0
  147. package/dist/lib/infrastructure/di/ServiceFactory.d.ts.map +1 -1
  148. package/dist/lib/infrastructure/di/ServiceFactory.js +66 -0
  149. package/dist/lib/infrastructure/di/ServiceFactory.js.map +1 -1
  150. package/dist/lib/infrastructure/di/bootstrap.d.ts +43 -0
  151. package/dist/lib/infrastructure/di/bootstrap.d.ts.map +1 -0
  152. package/dist/lib/infrastructure/di/bootstrap.js +272 -0
  153. package/dist/lib/infrastructure/di/bootstrap.js.map +1 -0
  154. package/dist/lib/infrastructure/di/index.d.ts +6 -0
  155. package/dist/lib/infrastructure/di/index.d.ts.map +1 -1
  156. package/dist/lib/infrastructure/di/index.js +15 -1
  157. package/dist/lib/infrastructure/di/index.js.map +1 -1
  158. package/dist/lib/infrastructure/di/tokens.d.ts +70 -0
  159. package/dist/lib/infrastructure/di/tokens.d.ts.map +1 -0
  160. package/dist/lib/infrastructure/di/tokens.js +58 -0
  161. package/dist/lib/infrastructure/di/tokens.js.map +1 -0
  162. package/dist/lib/infrastructure/index.d.ts +1 -0
  163. package/dist/lib/infrastructure/index.d.ts.map +1 -1
  164. package/dist/lib/infrastructure/index.js +2 -0
  165. package/dist/lib/infrastructure/index.js.map +1 -1
  166. package/dist/lib/infrastructure/logging/Logger.d.ts +51 -4
  167. package/dist/lib/infrastructure/logging/Logger.d.ts.map +1 -1
  168. package/dist/lib/infrastructure/logging/Logger.js +127 -2
  169. package/dist/lib/infrastructure/logging/Logger.js.map +1 -1
  170. package/dist/lib/infrastructure/mcp/McpClient.d.ts +36 -1
  171. package/dist/lib/infrastructure/mcp/McpClient.d.ts.map +1 -1
  172. package/dist/lib/infrastructure/mcp/McpClient.js +68 -2
  173. package/dist/lib/infrastructure/mcp/McpClient.js.map +1 -1
  174. package/dist/lib/infrastructure/services/LabelInferenceService.d.ts +33 -0
  175. package/dist/lib/infrastructure/services/LabelInferenceService.d.ts.map +1 -0
  176. package/dist/lib/infrastructure/services/LabelInferenceService.js +225 -0
  177. package/dist/lib/infrastructure/services/LabelInferenceService.js.map +1 -0
  178. package/dist/lib/infrastructure/services/MemoryService.d.ts +18 -1
  179. package/dist/lib/infrastructure/services/MemoryService.d.ts.map +1 -1
  180. package/dist/lib/infrastructure/services/MemoryService.js +117 -52
  181. package/dist/lib/infrastructure/services/MemoryService.js.map +1 -1
  182. package/dist/lib/infrastructure/services/SessionCaptureService.d.ts +74 -20
  183. package/dist/lib/infrastructure/services/SessionCaptureService.d.ts.map +1 -1
  184. package/dist/lib/infrastructure/services/SessionCaptureService.js +331 -22
  185. package/dist/lib/infrastructure/services/SessionCaptureService.js.map +1 -1
  186. package/dist/lib/infrastructure/services/index.d.ts +1 -0
  187. package/dist/lib/infrastructure/services/index.d.ts.map +1 -1
  188. package/dist/lib/infrastructure/services/index.js +4 -1
  189. package/dist/lib/infrastructure/services/index.js.map +1 -1
  190. package/dist/lib/infrastructure/utils/index.d.ts +10 -0
  191. package/dist/lib/infrastructure/utils/index.d.ts.map +1 -0
  192. package/dist/lib/infrastructure/utils/index.js +26 -0
  193. package/dist/lib/infrastructure/utils/index.js.map +1 -0
  194. package/dist/lib/skills/github/github.d.ts +27 -0
  195. package/dist/lib/skills/github/github.d.ts.map +1 -0
  196. package/dist/lib/skills/github/github.js +408 -0
  197. package/dist/lib/skills/github/github.js.map +1 -0
  198. package/dist/lib/skills/shared/clients/GhCliClient.d.ts +17 -0
  199. package/dist/lib/skills/shared/clients/GhCliClient.d.ts.map +1 -0
  200. package/dist/lib/skills/shared/clients/GhCliClient.js +244 -0
  201. package/dist/lib/skills/shared/clients/GhCliClient.js.map +1 -0
  202. package/dist/lib/skills/shared/clients/McpClient.d.ts +12 -0
  203. package/dist/lib/skills/shared/clients/McpClient.d.ts.map +1 -1
  204. package/dist/lib/skills/shared/clients/McpClient.js +121 -76
  205. package/dist/lib/skills/shared/clients/McpClient.js.map +1 -1
  206. package/dist/lib/skills/shared/clients/index.d.ts +1 -0
  207. package/dist/lib/skills/shared/clients/index.d.ts.map +1 -1
  208. package/dist/lib/skills/shared/clients/index.js +4 -1
  209. package/dist/lib/skills/shared/clients/index.js.map +1 -1
  210. package/dist/lib/skills/shared/clients/interfaces/IGhCliClient.d.ts +56 -0
  211. package/dist/lib/skills/shared/clients/interfaces/IGhCliClient.d.ts.map +1 -0
  212. package/dist/lib/skills/shared/clients/interfaces/IGhCliClient.js +7 -0
  213. package/dist/lib/skills/shared/clients/interfaces/IGhCliClient.js.map +1 -0
  214. package/dist/lib/skills/shared/clients/interfaces/IZepClient.d.ts +7 -1
  215. package/dist/lib/skills/shared/clients/interfaces/IZepClient.d.ts.map +1 -1
  216. package/dist/lib/skills/shared/clients/interfaces/index.d.ts +1 -0
  217. package/dist/lib/skills/shared/clients/interfaces/index.d.ts.map +1 -1
  218. package/dist/lib/skills/shared/clients/interfaces/index.js +1 -0
  219. package/dist/lib/skills/shared/clients/interfaces/index.js.map +1 -1
  220. package/dist/lib/skills/shared/services/GitHubService.d.ts +169 -0
  221. package/dist/lib/skills/shared/services/GitHubService.d.ts.map +1 -0
  222. package/dist/lib/skills/shared/services/GitHubService.js +493 -0
  223. package/dist/lib/skills/shared/services/GitHubService.js.map +1 -0
  224. package/dist/lib/skills/shared/services/GitHubSyncService.d.ts +124 -0
  225. package/dist/lib/skills/shared/services/GitHubSyncService.d.ts.map +1 -0
  226. package/dist/lib/skills/shared/services/GitHubSyncService.js +412 -0
  227. package/dist/lib/skills/shared/services/GitHubSyncService.js.map +1 -0
  228. package/dist/lib/skills/shared/services/TaskCliService.d.ts +4 -2
  229. package/dist/lib/skills/shared/services/TaskCliService.d.ts.map +1 -1
  230. package/dist/lib/skills/shared/services/TaskCliService.js +90 -6
  231. package/dist/lib/skills/shared/services/TaskCliService.js.map +1 -1
  232. package/dist/lib/skills/shared/services/TaskService.d.ts.map +1 -1
  233. package/dist/lib/skills/shared/services/TaskService.js +199 -21
  234. package/dist/lib/skills/shared/services/TaskService.js.map +1 -1
  235. package/dist/lib/skills/shared/services/index.d.ts +2 -0
  236. package/dist/lib/skills/shared/services/index.d.ts.map +1 -1
  237. package/dist/lib/skills/shared/services/index.js +7 -1
  238. package/dist/lib/skills/shared/services/index.js.map +1 -1
  239. package/dist/lib/skills/shared/services/interfaces/ITaskService.d.ts +56 -1
  240. package/dist/lib/skills/shared/services/interfaces/ITaskService.d.ts.map +1 -1
  241. package/dist/lib/skills/shared/utils/index.d.ts +1 -0
  242. package/dist/lib/skills/shared/utils/index.d.ts.map +1 -1
  243. package/dist/lib/skills/shared/utils/index.js +9 -1
  244. package/dist/lib/skills/shared/utils/index.js.map +1 -1
  245. package/dist/lib/skills/shared/utils/issue-refs.d.ts +127 -0
  246. package/dist/lib/skills/shared/utils/issue-refs.d.ts.map +1 -0
  247. package/dist/lib/skills/shared/utils/issue-refs.js +179 -0
  248. package/dist/lib/skills/shared/utils/issue-refs.js.map +1 -0
  249. package/dist/lib/skills/tasks/tasks.d.ts +5 -2
  250. package/dist/lib/skills/tasks/tasks.d.ts.map +1 -1
  251. package/dist/lib/skills/tasks/tasks.js +8 -3
  252. package/dist/lib/skills/tasks/tasks.js.map +1 -1
  253. package/dist/opencode/lisa.js +5886 -1310
  254. package/dist/package.json +1 -1
  255. package/dist/project/.lisa/skills/github/SKILL.md +415 -0
  256. package/dist/project/.lisa/skills/lisa/SKILL.md +22 -0
  257. package/dist/project/.lisa/skills/memory/SKILL.md +3 -2
  258. package/package.json +6 -5
  259. package/dist/hooks/session-start.js +0 -5763
  260. package/dist/hooks/session-stop.js +0 -5348
  261. package/dist/hooks/user-prompt-submit.js +0 -5406
  262. package/dist/project/.claude/config.js +0 -40
@@ -0,0 +1,716 @@
1
+ "use strict";
2
+ /**
3
+ * Doctor Command Module
4
+ *
5
+ * Comprehensive diagnostic tool for Lisa configuration and connectivity.
6
+ * Supports basic, verbose, and JSON output modes.
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __importDefault = (this && this.__importDefault) || function (mod) {
42
+ return (mod && mod.__esModule) ? mod : { "default": mod };
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.runDoctor = runDoctor;
46
+ exports.formatBasicOutput = formatBasicOutput;
47
+ exports.formatVerboseOutput = formatVerboseOutput;
48
+ exports.formatJsonOutput = formatJsonOutput;
49
+ exports.getExitCode = getExitCode;
50
+ exports.doctorCommand = doctorCommand;
51
+ const fs_extra_1 = __importDefault(require("fs-extra"));
52
+ const path_1 = __importDefault(require("path"));
53
+ const chalk_1 = __importDefault(require("chalk"));
54
+ // ============================================================================
55
+ // Constants
56
+ // ============================================================================
57
+ const DEFAULT_ENDPOINT = 'http://localhost:8010/mcp/';
58
+ const ZEP_CLOUD_ENDPOINT = 'https://api.getzep.com/mcp/';
59
+ /**
60
+ * Load Lisa configuration from .lisa/.env file.
61
+ */
62
+ async function loadConfig(cwd) {
63
+ const lisaEnv = path_1.default.join(cwd, '.lisa', '.env');
64
+ const map = {};
65
+ if (await fs_extra_1.default.pathExists(lisaEnv)) {
66
+ const raw = await fs_extra_1.default.readFile(lisaEnv, 'utf8');
67
+ raw.split(/\r?\n/).forEach((line) => {
68
+ if (!line || line.startsWith('#'))
69
+ return;
70
+ const idx = line.indexOf('=');
71
+ if (idx === -1)
72
+ return;
73
+ const key = line.slice(0, idx).trim();
74
+ map[key] = line.slice(idx + 1).trim();
75
+ });
76
+ }
77
+ if (Object.keys(map).length === 0) {
78
+ return null;
79
+ }
80
+ return {
81
+ endpoint: map.GRAPHITI_ENDPOINT,
82
+ group: map.GRAPHITI_GROUP_ID,
83
+ mode: map.STORAGE_MODE,
84
+ zepApiKey: map.ZEP_API_KEY,
85
+ zepProjectId: map.ZEP_PROJECT_ID,
86
+ };
87
+ }
88
+ /**
89
+ * Get project name from package.json or directory name.
90
+ */
91
+ function getProjectName(cwd) {
92
+ try {
93
+ const pkgPath = path_1.default.join(cwd, 'package.json');
94
+ if (fs_extra_1.default.existsSync(pkgPath)) {
95
+ const pkg = fs_extra_1.default.readJsonSync(pkgPath);
96
+ if (pkg.name) {
97
+ return pkg.name.replace(/^@[^/]+\//, '');
98
+ }
99
+ }
100
+ }
101
+ catch {
102
+ // Ignore
103
+ }
104
+ return path_1.default.basename(cwd);
105
+ }
106
+ /**
107
+ * Get Lisa package version.
108
+ */
109
+ function getLisaVersion() {
110
+ try {
111
+ // Try multiple locations for package.json
112
+ const possiblePaths = [
113
+ path_1.default.join(__dirname, '..', '..', '..', 'package.json'),
114
+ path_1.default.join(__dirname, '..', '..', 'package.json'),
115
+ ];
116
+ for (const pkgPath of possiblePaths) {
117
+ if (fs_extra_1.default.existsSync(pkgPath)) {
118
+ const pkg = fs_extra_1.default.readJsonSync(pkgPath);
119
+ return pkg.version || '0.0.0';
120
+ }
121
+ }
122
+ }
123
+ catch {
124
+ // Ignore
125
+ }
126
+ return '0.0.0';
127
+ }
128
+ // ============================================================================
129
+ // Health Checks
130
+ // ============================================================================
131
+ /**
132
+ * Check Docker availability.
133
+ */
134
+ async function checkDocker(services) {
135
+ const start = Date.now();
136
+ try {
137
+ const version = await services.docker.version();
138
+ return {
139
+ name: 'Docker',
140
+ status: 'ok',
141
+ message: `Docker ${version.trim()}`,
142
+ durationMs: Date.now() - start,
143
+ };
144
+ }
145
+ catch (err) {
146
+ const message = err instanceof Error ? err.message : String(err);
147
+ return {
148
+ name: 'Docker',
149
+ status: 'error',
150
+ message: 'Docker not available',
151
+ details: message,
152
+ durationMs: Date.now() - start,
153
+ };
154
+ }
155
+ }
156
+ /**
157
+ * Check Docker Compose availability.
158
+ */
159
+ async function checkDockerCompose(services) {
160
+ const start = Date.now();
161
+ try {
162
+ const version = await services.docker.composeVersion();
163
+ return {
164
+ name: 'Docker Compose',
165
+ status: 'ok',
166
+ message: `Compose ${version.trim()}`,
167
+ durationMs: Date.now() - start,
168
+ };
169
+ }
170
+ catch (err) {
171
+ const message = err instanceof Error ? err.message : String(err);
172
+ return {
173
+ name: 'Docker Compose',
174
+ status: 'error',
175
+ message: 'Docker Compose not available',
176
+ details: message,
177
+ durationMs: Date.now() - start,
178
+ };
179
+ }
180
+ }
181
+ /**
182
+ * Check compose file existence.
183
+ */
184
+ async function checkComposeFile(composeFile) {
185
+ const start = Date.now();
186
+ const exists = await fs_extra_1.default.pathExists(composeFile);
187
+ return {
188
+ name: 'Compose File',
189
+ status: exists ? 'ok' : 'warning',
190
+ message: exists ? `Found: ${path_1.default.basename(composeFile)}` : 'Not found',
191
+ details: composeFile,
192
+ durationMs: Date.now() - start,
193
+ };
194
+ }
195
+ /**
196
+ * Check MCP/Graphiti connectivity.
197
+ */
198
+ async function checkMcp(services, endpoint, apiKey) {
199
+ const start = Date.now();
200
+ try {
201
+ await services.mcp.ping(endpoint, { apiKey });
202
+ return {
203
+ name: 'MCP Server',
204
+ status: 'ok',
205
+ message: `Reachable at ${endpoint}`,
206
+ durationMs: Date.now() - start,
207
+ };
208
+ }
209
+ catch (err) {
210
+ const message = err instanceof Error ? err.message : String(err);
211
+ return {
212
+ name: 'MCP Server',
213
+ status: 'error',
214
+ message: `Not reachable at ${endpoint}`,
215
+ details: message,
216
+ durationMs: Date.now() - start,
217
+ };
218
+ }
219
+ }
220
+ /**
221
+ * Check Neo4j connectivity (local mode only).
222
+ */
223
+ async function checkNeo4j() {
224
+ const start = Date.now();
225
+ const uri = process.env.NEO4J_URI || 'bolt://localhost:7687';
226
+ try {
227
+ // Dynamic import to avoid requiring neo4j-driver if not needed
228
+ const neo4j = await Promise.resolve().then(() => __importStar(require('neo4j-driver')));
229
+ const driver = neo4j.default.driver(uri, neo4j.default.auth.basic(process.env.NEO4J_USER || 'neo4j', process.env.NEO4J_PASSWORD || 'demodemo'), { connectionTimeout: 5000 });
230
+ await driver.verifyConnectivity();
231
+ await driver.close();
232
+ return {
233
+ name: 'Neo4j',
234
+ status: 'ok',
235
+ message: `Connected to ${uri}`,
236
+ durationMs: Date.now() - start,
237
+ };
238
+ }
239
+ catch (err) {
240
+ const message = err instanceof Error ? err.message : String(err);
241
+ return {
242
+ name: 'Neo4j',
243
+ status: 'error',
244
+ message: `Cannot connect to ${uri}`,
245
+ details: message,
246
+ durationMs: Date.now() - start,
247
+ };
248
+ }
249
+ }
250
+ /**
251
+ * Check Zep Cloud connectivity.
252
+ */
253
+ async function checkZepCloud(apiKey) {
254
+ const start = Date.now();
255
+ const endpoint = 'https://api.getzep.com/api/v2/users';
256
+ try {
257
+ const resp = await fetch(endpoint, {
258
+ method: 'GET',
259
+ headers: {
260
+ Authorization: `Api-Key ${apiKey}`,
261
+ 'Content-Type': 'application/json',
262
+ },
263
+ signal: AbortSignal.timeout(10000),
264
+ });
265
+ // 200 or 404 means API is reachable
266
+ if (resp.ok || resp.status === 404) {
267
+ return {
268
+ name: 'Zep Cloud',
269
+ status: 'ok',
270
+ message: 'API reachable',
271
+ durationMs: Date.now() - start,
272
+ };
273
+ }
274
+ return {
275
+ name: 'Zep Cloud',
276
+ status: 'error',
277
+ message: `API returned ${resp.status}`,
278
+ details: await resp.text().catch(() => ''),
279
+ durationMs: Date.now() - start,
280
+ };
281
+ }
282
+ catch (err) {
283
+ const message = err instanceof Error ? err.message : String(err);
284
+ return {
285
+ name: 'Zep Cloud',
286
+ status: 'error',
287
+ message: 'Cannot reach Zep Cloud API',
288
+ details: message,
289
+ durationMs: Date.now() - start,
290
+ };
291
+ }
292
+ }
293
+ /**
294
+ * Check .lisa directory structure.
295
+ */
296
+ async function checkLisaStructure(cwd) {
297
+ const start = Date.now();
298
+ const lisaDir = path_1.default.join(cwd, '.lisa');
299
+ if (!(await fs_extra_1.default.pathExists(lisaDir))) {
300
+ return {
301
+ name: 'Lisa Structure',
302
+ status: 'error',
303
+ message: '.lisa directory not found',
304
+ details: 'Run "lisa init" to set up Lisa',
305
+ durationMs: Date.now() - start,
306
+ };
307
+ }
308
+ const expectedDirs = ['skills', 'rules'];
309
+ const missing = [];
310
+ for (const dir of expectedDirs) {
311
+ if (!(await fs_extra_1.default.pathExists(path_1.default.join(lisaDir, dir)))) {
312
+ missing.push(dir);
313
+ }
314
+ }
315
+ if (missing.length > 0) {
316
+ return {
317
+ name: 'Lisa Structure',
318
+ status: 'warning',
319
+ message: `Missing directories: ${missing.join(', ')}`,
320
+ details: `Expected in ${lisaDir}`,
321
+ durationMs: Date.now() - start,
322
+ };
323
+ }
324
+ return {
325
+ name: 'Lisa Structure',
326
+ status: 'ok',
327
+ message: '.lisa directory configured',
328
+ durationMs: Date.now() - start,
329
+ };
330
+ }
331
+ /**
332
+ * Check Claude Code hooks setup.
333
+ */
334
+ async function checkClaudeHooks(cwd) {
335
+ const start = Date.now();
336
+ const claudeDir = path_1.default.join(cwd, '.claude');
337
+ const settingsPath = path_1.default.join(claudeDir, 'settings.json');
338
+ if (!(await fs_extra_1.default.pathExists(claudeDir))) {
339
+ return {
340
+ name: 'Claude Code Hooks',
341
+ status: 'warning',
342
+ message: '.claude directory not found',
343
+ details: 'Claude Code integration not configured',
344
+ durationMs: Date.now() - start,
345
+ };
346
+ }
347
+ if (!(await fs_extra_1.default.pathExists(settingsPath))) {
348
+ return {
349
+ name: 'Claude Code Hooks',
350
+ status: 'warning',
351
+ message: 'settings.json not found',
352
+ details: 'Hooks may not be registered',
353
+ durationMs: Date.now() - start,
354
+ };
355
+ }
356
+ try {
357
+ const settings = await fs_extra_1.default.readJson(settingsPath);
358
+ const hooks = settings.hooks || {};
359
+ const configuredHooks = Object.keys(hooks).length;
360
+ if (configuredHooks === 0) {
361
+ return {
362
+ name: 'Claude Code Hooks',
363
+ status: 'warning',
364
+ message: 'No hooks configured',
365
+ details: 'Memory loading may not work',
366
+ durationMs: Date.now() - start,
367
+ };
368
+ }
369
+ return {
370
+ name: 'Claude Code Hooks',
371
+ status: 'ok',
372
+ message: `${configuredHooks} hook(s) configured`,
373
+ durationMs: Date.now() - start,
374
+ };
375
+ }
376
+ catch (err) {
377
+ const message = err instanceof Error ? err.message : String(err);
378
+ return {
379
+ name: 'Claude Code Hooks',
380
+ status: 'warning',
381
+ message: 'Cannot parse settings.json',
382
+ details: message,
383
+ durationMs: Date.now() - start,
384
+ };
385
+ }
386
+ }
387
+ // ============================================================================
388
+ // Transcript Discovery
389
+ // ============================================================================
390
+ /**
391
+ * Find all transcript files from standard Claude Code locations.
392
+ */
393
+ function findTranscripts() {
394
+ const homeDir = process.env.HOME || process.env.USERPROFILE || '';
395
+ const searchPaths = [
396
+ path_1.default.join(homeDir, '.claude', 'projects'),
397
+ path_1.default.join(homeDir, '.claude'),
398
+ ];
399
+ const candidates = [];
400
+ for (const dir of searchPaths) {
401
+ if (!fs_extra_1.default.existsSync(dir))
402
+ continue;
403
+ // Check direct transcript
404
+ const directPath = path_1.default.join(dir, 'transcript.jsonl');
405
+ if (fs_extra_1.default.existsSync(directPath)) {
406
+ try {
407
+ const stats = fs_extra_1.default.statSync(directPath);
408
+ candidates.push({
409
+ path: directPath,
410
+ mtime: stats.mtime,
411
+ sizeBytes: stats.size,
412
+ });
413
+ }
414
+ catch {
415
+ // Skip
416
+ }
417
+ }
418
+ // Check subdirectories
419
+ try {
420
+ const entries = fs_extra_1.default.readdirSync(dir, { withFileTypes: true });
421
+ for (const entry of entries) {
422
+ if (entry.isDirectory()) {
423
+ const subPath = path_1.default.join(dir, entry.name, 'transcript.jsonl');
424
+ if (fs_extra_1.default.existsSync(subPath)) {
425
+ try {
426
+ const stats = fs_extra_1.default.statSync(subPath);
427
+ candidates.push({
428
+ path: subPath,
429
+ mtime: stats.mtime,
430
+ sizeBytes: stats.size,
431
+ });
432
+ }
433
+ catch {
434
+ // Skip
435
+ }
436
+ }
437
+ }
438
+ }
439
+ }
440
+ catch {
441
+ // Ignore permission errors
442
+ }
443
+ }
444
+ // Sort by modification time (newest first)
445
+ candidates.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
446
+ return {
447
+ searchPaths,
448
+ candidates,
449
+ selected: candidates.length > 0 ? candidates[0].path : undefined,
450
+ };
451
+ }
452
+ // ============================================================================
453
+ // Main Doctor Function
454
+ // ============================================================================
455
+ /**
456
+ * Run comprehensive health checks and return diagnostic results.
457
+ */
458
+ async function runDoctor(opts, services) {
459
+ const startTime = Date.now();
460
+ const cwd = opts.cwd;
461
+ const projectName = getProjectName(cwd);
462
+ // Load configuration
463
+ const config = await loadConfig(cwd);
464
+ const mode = config?.mode || 'local';
465
+ const endpoint = opts.endpoint ||
466
+ config?.endpoint ||
467
+ (mode === 'zep-cloud' ? ZEP_CLOUD_ENDPOINT : DEFAULT_ENDPOINT);
468
+ const group = config?.group || projectName;
469
+ const zepApiKey = config?.zepApiKey || process.env.ZEP_API_KEY;
470
+ // Build config info
471
+ const envFilePath = path_1.default.join(cwd, '.lisa', '.env');
472
+ const configInfo = {
473
+ mode,
474
+ group,
475
+ endpoint,
476
+ envFilePath,
477
+ envFileExists: await fs_extra_1.default.pathExists(envFilePath),
478
+ zepApiKeyConfigured: !!zepApiKey,
479
+ zepProjectId: config?.zepProjectId,
480
+ };
481
+ // Run health checks based on mode
482
+ const checks = [];
483
+ // Always check Lisa structure and Claude hooks
484
+ checks.push(await checkLisaStructure(cwd));
485
+ checks.push(await checkClaudeHooks(cwd));
486
+ if (mode === 'local') {
487
+ // Local mode checks
488
+ checks.push(await checkDocker(services));
489
+ checks.push(await checkDockerCompose(services));
490
+ const composeFile = opts.compose || path_1.default.join(cwd, 'docker-compose.graphiti.yml');
491
+ checks.push(await checkComposeFile(composeFile));
492
+ checks.push(await checkNeo4j());
493
+ checks.push(await checkMcp(services, endpoint));
494
+ }
495
+ else if (mode === 'zep-cloud') {
496
+ // Zep Cloud mode checks
497
+ if (zepApiKey) {
498
+ checks.push(await checkZepCloud(zepApiKey));
499
+ checks.push(await checkMcp(services, endpoint, zepApiKey));
500
+ }
501
+ else {
502
+ checks.push({
503
+ name: 'Zep Cloud',
504
+ status: 'error',
505
+ message: 'ZEP_API_KEY not configured',
506
+ details: 'Set ZEP_API_KEY in .lisa/.env or environment',
507
+ });
508
+ }
509
+ }
510
+ else if (mode === 'skip') {
511
+ checks.push({
512
+ name: 'Storage Backend',
513
+ status: 'warning',
514
+ message: 'Storage not configured (skip mode)',
515
+ details: 'Run "lisa init" to configure storage',
516
+ });
517
+ }
518
+ // Find transcripts
519
+ const transcripts = findTranscripts();
520
+ // Determine overall status
521
+ const hasError = checks.some((c) => c.status === 'error');
522
+ const hasWarning = checks.some((c) => c.status === 'warning');
523
+ const overallStatus = hasError
524
+ ? 'error'
525
+ : hasWarning
526
+ ? 'warning'
527
+ : 'ok';
528
+ return {
529
+ timestamp: new Date().toISOString(),
530
+ projectRoot: cwd,
531
+ version: getLisaVersion(),
532
+ overallStatus,
533
+ config: configInfo,
534
+ checks,
535
+ transcripts,
536
+ totalDurationMs: Date.now() - startTime,
537
+ };
538
+ }
539
+ // ============================================================================
540
+ // Output Formatting
541
+ // ============================================================================
542
+ /**
543
+ * Get status icon for check result.
544
+ */
545
+ function getStatusIcon(status) {
546
+ switch (status) {
547
+ case 'ok':
548
+ return chalk_1.default.green('✓');
549
+ case 'warning':
550
+ return chalk_1.default.yellow('⚠');
551
+ case 'error':
552
+ return chalk_1.default.red('✗');
553
+ }
554
+ }
555
+ /**
556
+ * Get colored status text.
557
+ */
558
+ function getStatusText(status) {
559
+ switch (status) {
560
+ case 'ok':
561
+ return chalk_1.default.green('OK');
562
+ case 'warning':
563
+ return chalk_1.default.yellow('WARNING');
564
+ case 'error':
565
+ return chalk_1.default.red('ERROR');
566
+ }
567
+ }
568
+ /**
569
+ * Format file size in human-readable format.
570
+ */
571
+ function formatSize(bytes) {
572
+ if (bytes < 1024)
573
+ return `${bytes} B`;
574
+ if (bytes < 1024 * 1024)
575
+ return `${(bytes / 1024).toFixed(1)} KB`;
576
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
577
+ }
578
+ /**
579
+ * Format duration in human-readable format.
580
+ */
581
+ function formatDuration(ms) {
582
+ if (ms < 1000)
583
+ return `${ms}ms`;
584
+ return `${(ms / 1000).toFixed(2)}s`;
585
+ }
586
+ /**
587
+ * Format basic output (checkmarks only).
588
+ */
589
+ function formatBasicOutput(result) {
590
+ const lines = [];
591
+ // Header
592
+ lines.push(chalk_1.default.cyan(`Mode: ${result.config.mode}`));
593
+ lines.push(chalk_1.default.cyan(`Group: ${result.config.group}`));
594
+ lines.push('');
595
+ // Health checks
596
+ for (const check of result.checks) {
597
+ lines.push(`${getStatusIcon(check.status)} ${check.name}: ${check.message}`);
598
+ }
599
+ // Overall status
600
+ lines.push('');
601
+ lines.push(`Overall: ${getStatusText(result.overallStatus)} (${formatDuration(result.totalDurationMs)})`);
602
+ return lines.join('\n');
603
+ }
604
+ /**
605
+ * Format verbose output (detailed diagnostics).
606
+ */
607
+ function formatVerboseOutput(result) {
608
+ const lines = [];
609
+ // Header
610
+ lines.push(chalk_1.default.bold.cyan('=== Lisa Doctor ==='));
611
+ lines.push('');
612
+ // System info
613
+ lines.push(chalk_1.default.bold('System Information'));
614
+ lines.push(` Lisa Version: ${result.version}`);
615
+ lines.push(` Project Root: ${result.projectRoot}`);
616
+ lines.push(` Timestamp: ${result.timestamp}`);
617
+ lines.push('');
618
+ // Configuration
619
+ lines.push(chalk_1.default.bold('Configuration'));
620
+ lines.push(` Mode: ${result.config.mode}`);
621
+ lines.push(` Group: ${result.config.group}`);
622
+ lines.push(` Endpoint: ${result.config.endpoint}`);
623
+ lines.push(` Env File: ${result.config.envFilePath}`);
624
+ lines.push(` Env File Exists: ${result.config.envFileExists ? 'Yes' : 'No'}`);
625
+ lines.push(` Zep API Key: ${result.config.zepApiKeyConfigured ? 'Configured' : 'Not configured'}`);
626
+ if (result.config.zepProjectId) {
627
+ lines.push(` Zep Project ID: ${result.config.zepProjectId}`);
628
+ }
629
+ lines.push('');
630
+ // Health checks with timing
631
+ lines.push(chalk_1.default.bold('Health Checks'));
632
+ for (const check of result.checks) {
633
+ const timing = check.durationMs ? ` (${formatDuration(check.durationMs)})` : '';
634
+ lines.push(` ${getStatusIcon(check.status)} ${check.name}: ${check.message}${timing}`);
635
+ if (check.details) {
636
+ lines.push(` ${chalk_1.default.dim(check.details)}`);
637
+ }
638
+ }
639
+ lines.push('');
640
+ // Transcript discovery
641
+ lines.push(chalk_1.default.bold('Transcript Discovery'));
642
+ lines.push(` Search Paths:`);
643
+ for (const searchPath of result.transcripts.searchPaths) {
644
+ const exists = fs_extra_1.default.existsSync(searchPath);
645
+ lines.push(` ${exists ? chalk_1.default.green('✓') : chalk_1.default.dim('-')} ${searchPath}`);
646
+ }
647
+ lines.push('');
648
+ if (result.transcripts.candidates.length > 0) {
649
+ lines.push(` Found ${result.transcripts.candidates.length} transcript(s):`);
650
+ for (const candidate of result.transcripts.candidates) {
651
+ const isSelected = candidate.path === result.transcripts.selected;
652
+ const prefix = isSelected ? chalk_1.default.green('→') : ' ';
653
+ const date = candidate.mtime.toISOString().replace('T', ' ').slice(0, 19);
654
+ lines.push(` ${prefix} ${candidate.path}`);
655
+ lines.push(` ${chalk_1.default.dim(`Modified: ${date}, Size: ${formatSize(candidate.sizeBytes)}`)}`);
656
+ }
657
+ }
658
+ else {
659
+ lines.push(` ${chalk_1.default.yellow('No transcripts found')}`);
660
+ }
661
+ lines.push('');
662
+ // Summary
663
+ lines.push(chalk_1.default.bold('Summary'));
664
+ const checkCounts = {
665
+ ok: result.checks.filter((c) => c.status === 'ok').length,
666
+ warning: result.checks.filter((c) => c.status === 'warning').length,
667
+ error: result.checks.filter((c) => c.status === 'error').length,
668
+ };
669
+ lines.push(` Checks: ${chalk_1.default.green(checkCounts.ok + ' passed')}, ${chalk_1.default.yellow(checkCounts.warning + ' warnings')}, ${chalk_1.default.red(checkCounts.error + ' errors')}`);
670
+ lines.push(` Total Duration: ${formatDuration(result.totalDurationMs)}`);
671
+ lines.push('');
672
+ lines.push(`Overall Status: ${getStatusText(result.overallStatus)}`);
673
+ return lines.join('\n');
674
+ }
675
+ /**
676
+ * Format JSON output.
677
+ */
678
+ function formatJsonOutput(result) {
679
+ return JSON.stringify(result, null, 2);
680
+ }
681
+ /**
682
+ * Get exit code based on overall status.
683
+ * 0 = ok, 1 = warning, 2 = error
684
+ */
685
+ function getExitCode(status) {
686
+ switch (status) {
687
+ case 'ok':
688
+ return 0;
689
+ case 'warning':
690
+ return 1;
691
+ case 'error':
692
+ return 2;
693
+ }
694
+ }
695
+ // ============================================================================
696
+ // Exported Command Handler
697
+ // ============================================================================
698
+ /**
699
+ * Execute the doctor command with specified options.
700
+ */
701
+ async function doctorCommand(opts, services) {
702
+ const result = await runDoctor(opts, services);
703
+ // Format and output
704
+ if (opts.json) {
705
+ console.log(formatJsonOutput(result));
706
+ }
707
+ else if (opts.verbose) {
708
+ console.log(formatVerboseOutput(result));
709
+ }
710
+ else {
711
+ console.log(formatBasicOutput(result));
712
+ }
713
+ // Set exit code
714
+ process.exitCode = getExitCode(result.overallStatus);
715
+ }
716
+ //# sourceMappingURL=doctor.js.map