@noorm/marie-cli 0.1.0

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 (193) hide show
  1. package/JOY_ZONING.md +200 -0
  2. package/LICENSE.md +190 -0
  3. package/README.md +94 -0
  4. package/dist/cli-new/components/App.js +138 -0
  5. package/dist/cli-new/components/App.js.map +1 -0
  6. package/dist/cli-new/components/ApprovalDialog.js +31 -0
  7. package/dist/cli-new/components/ApprovalDialog.js.map +1 -0
  8. package/dist/cli-new/components/Banner.js +23 -0
  9. package/dist/cli-new/components/Banner.js.map +1 -0
  10. package/dist/cli-new/components/ChatArea.js +49 -0
  11. package/dist/cli-new/components/ChatArea.js.map +1 -0
  12. package/dist/cli-new/components/Header.js +20 -0
  13. package/dist/cli-new/components/Header.js.map +1 -0
  14. package/dist/cli-new/components/InputArea.js +97 -0
  15. package/dist/cli-new/components/InputArea.js.map +1 -0
  16. package/dist/cli-new/components/MessageBubble.js +114 -0
  17. package/dist/cli-new/components/MessageBubble.js.map +1 -0
  18. package/dist/cli-new/components/SessionSwitcher.js +46 -0
  19. package/dist/cli-new/components/SessionSwitcher.js.map +1 -0
  20. package/dist/cli-new/components/SetupWizard.js +283 -0
  21. package/dist/cli-new/components/SetupWizard.js.map +1 -0
  22. package/dist/cli-new/components/ToolCallDisplay.js +45 -0
  23. package/dist/cli-new/components/ToolCallDisplay.js.map +1 -0
  24. package/dist/cli-new/hooks/useGit.js +99 -0
  25. package/dist/cli-new/hooks/useGit.js.map +1 -0
  26. package/dist/cli-new/hooks/useMarie.js +249 -0
  27. package/dist/cli-new/hooks/useMarie.js.map +1 -0
  28. package/dist/cli-new/hooks/useSessions.js +75 -0
  29. package/dist/cli-new/hooks/useSessions.js.map +1 -0
  30. package/dist/cli-new/index.js +52 -0
  31. package/dist/cli-new/index.js.map +1 -0
  32. package/dist/cli-new/styles/theme.js +68 -0
  33. package/dist/cli-new/styles/theme.js.map +1 -0
  34. package/dist/cli-new/types/cli.js +2 -0
  35. package/dist/cli-new/types/cli.js.map +1 -0
  36. package/dist/extension.cjs +655 -0
  37. package/dist/monolith/adapters/CliMarieAdapter.js +72 -0
  38. package/dist/monolith/adapters/CliMarieAdapter.js.map +1 -0
  39. package/dist/monolith/adapters/VscodeMarieAdapter.js +81 -0
  40. package/dist/monolith/adapters/VscodeMarieAdapter.js.map +1 -0
  41. package/dist/monolith/cli/CliFileSystemPort.js +83 -0
  42. package/dist/monolith/cli/CliFileSystemPort.js.map +1 -0
  43. package/dist/monolith/cli/MarieToolDefinitionsCLI.js +438 -0
  44. package/dist/monolith/cli/MarieToolDefinitionsCLI.js.map +1 -0
  45. package/dist/monolith/cli/index.js +272 -0
  46. package/dist/monolith/cli/index.js.map +1 -0
  47. package/dist/monolith/cli/services/JoyAutomationServiceCLI.js +80 -0
  48. package/dist/monolith/cli/services/JoyAutomationServiceCLI.js.map +1 -0
  49. package/dist/monolith/cli/services/JoyServiceCLI.js +63 -0
  50. package/dist/monolith/cli/services/JoyServiceCLI.js.map +1 -0
  51. package/dist/monolith/cli/storage.js +119 -0
  52. package/dist/monolith/cli/storage.js.map +1 -0
  53. package/dist/monolith/domain/joy/JoyTools.js +513 -0
  54. package/dist/monolith/domain/joy/JoyTools.js.map +1 -0
  55. package/dist/monolith/domain/joy/RitualService.js +51 -0
  56. package/dist/monolith/domain/joy/RitualService.js.map +1 -0
  57. package/dist/monolith/domain/marie/MarieTypes.js +2 -0
  58. package/dist/monolith/domain/marie/MarieTypes.js.map +1 -0
  59. package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js +230 -0
  60. package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js.map +1 -0
  61. package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js +207 -0
  62. package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js.map +1 -0
  63. package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js +129 -0
  64. package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js.map +1 -0
  65. package/dist/monolith/infrastructure/ai/context/ContextManager.js +118 -0
  66. package/dist/monolith/infrastructure/ai/context/ContextManager.js.map +1 -0
  67. package/dist/monolith/infrastructure/ai/core/FileSystemPort.js +2 -0
  68. package/dist/monolith/infrastructure/ai/core/FileSystemPort.js.map +1 -0
  69. package/dist/monolith/infrastructure/ai/core/GhostPort.js +2 -0
  70. package/dist/monolith/infrastructure/ai/core/GhostPort.js.map +1 -0
  71. package/dist/monolith/infrastructure/ai/core/MarieAscensionTypes.js +2 -0
  72. package/dist/monolith/infrastructure/ai/core/MarieAscensionTypes.js.map +1 -0
  73. package/dist/monolith/infrastructure/ai/core/MarieEngine.js +590 -0
  74. package/dist/monolith/infrastructure/ai/core/MarieEngine.js.map +1 -0
  75. package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js +161 -0
  76. package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js.map +1 -0
  77. package/dist/monolith/infrastructure/ai/core/MarieLockManager.js +121 -0
  78. package/dist/monolith/infrastructure/ai/core/MarieLockManager.js.map +1 -0
  79. package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js +256 -0
  80. package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js.map +1 -0
  81. package/dist/monolith/infrastructure/ai/core/MariePulseService.js +67 -0
  82. package/dist/monolith/infrastructure/ai/core/MariePulseService.js.map +1 -0
  83. package/dist/monolith/infrastructure/ai/core/MarieResponse.js +101 -0
  84. package/dist/monolith/infrastructure/ai/core/MarieResponse.js.map +1 -0
  85. package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js +86 -0
  86. package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js.map +1 -0
  87. package/dist/monolith/infrastructure/ai/core/MarieSession.js +202 -0
  88. package/dist/monolith/infrastructure/ai/core/MarieSession.js.map +1 -0
  89. package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js +58 -0
  90. package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js.map +1 -0
  91. package/dist/monolith/infrastructure/ai/core/MarieToolMender.js +127 -0
  92. package/dist/monolith/infrastructure/ai/core/MarieToolMender.js.map +1 -0
  93. package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js +548 -0
  94. package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js.map +1 -0
  95. package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js +2 -0
  96. package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js.map +1 -0
  97. package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js +125 -0
  98. package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js.map +1 -0
  99. package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js +30 -0
  100. package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js.map +1 -0
  101. package/dist/monolith/infrastructure/ai/providers/AIProvider.js +2 -0
  102. package/dist/monolith/infrastructure/ai/providers/AIProvider.js.map +1 -0
  103. package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js +148 -0
  104. package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js.map +1 -0
  105. package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js +208 -0
  106. package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js.map +1 -0
  107. package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js +404 -0
  108. package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js.map +1 -0
  109. package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js +283 -0
  110. package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js.map +1 -0
  111. package/dist/monolith/infrastructure/config/ConfigService.js +398 -0
  112. package/dist/monolith/infrastructure/config/ConfigService.js.map +1 -0
  113. package/dist/monolith/infrastructure/services/MarieMemoryStore.js +140 -0
  114. package/dist/monolith/infrastructure/services/MarieMemoryStore.js.map +1 -0
  115. package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js +1568 -0
  116. package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js.map +1 -0
  117. package/dist/monolith/infrastructure/tools/PureStreamParser.js +147 -0
  118. package/dist/monolith/infrastructure/tools/PureStreamParser.js.map +1 -0
  119. package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js +223 -0
  120. package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js.map +1 -0
  121. package/dist/monolith/infrastructure/tools/ToolRegistry.js +29 -0
  122. package/dist/monolith/infrastructure/tools/ToolRegistry.js.map +1 -0
  123. package/dist/monolith/infrastructure/tools/ToolUtils.js +59 -0
  124. package/dist/monolith/infrastructure/tools/ToolUtils.js.map +1 -0
  125. package/dist/monolith/plumbing/analysis/CodeHealthService.js +146 -0
  126. package/dist/monolith/plumbing/analysis/CodeHealthService.js.map +1 -0
  127. package/dist/monolith/plumbing/analysis/ComplexityService.js +43 -0
  128. package/dist/monolith/plumbing/analysis/ComplexityService.js.map +1 -0
  129. package/dist/monolith/plumbing/analysis/DependencyService.js +51 -0
  130. package/dist/monolith/plumbing/analysis/DependencyService.js.map +1 -0
  131. package/dist/monolith/plumbing/analysis/DiscoveryService.js +49 -0
  132. package/dist/monolith/plumbing/analysis/DiscoveryService.js.map +1 -0
  133. package/dist/monolith/plumbing/analysis/JoyMapService.js +66 -0
  134. package/dist/monolith/plumbing/analysis/JoyMapService.js.map +1 -0
  135. package/dist/monolith/plumbing/analysis/LintService.js +132 -0
  136. package/dist/monolith/plumbing/analysis/LintService.js.map +1 -0
  137. package/dist/monolith/plumbing/analysis/MarieSentinelService.js +276 -0
  138. package/dist/monolith/plumbing/analysis/MarieSentinelService.js.map +1 -0
  139. package/dist/monolith/plumbing/analysis/QualityGuardrailService.js +119 -0
  140. package/dist/monolith/plumbing/analysis/QualityGuardrailService.js.map +1 -0
  141. package/dist/monolith/plumbing/analysis/SurgicalMender.js +70 -0
  142. package/dist/monolith/plumbing/analysis/SurgicalMender.js.map +1 -0
  143. package/dist/monolith/plumbing/analysis/TestService.js +104 -0
  144. package/dist/monolith/plumbing/analysis/TestService.js.map +1 -0
  145. package/dist/monolith/plumbing/filesystem/FileService.js +406 -0
  146. package/dist/monolith/plumbing/filesystem/FileService.js.map +1 -0
  147. package/dist/monolith/plumbing/filesystem/PathResolver.js +26 -0
  148. package/dist/monolith/plumbing/filesystem/PathResolver.js.map +1 -0
  149. package/dist/monolith/plumbing/git/GitService.js +71 -0
  150. package/dist/monolith/plumbing/git/GitService.js.map +1 -0
  151. package/dist/monolith/plumbing/lsp/SymbolService.js +36 -0
  152. package/dist/monolith/plumbing/lsp/SymbolService.js.map +1 -0
  153. package/dist/monolith/plumbing/terminal/ProcessRegistry.js +31 -0
  154. package/dist/monolith/plumbing/terminal/ProcessRegistry.js.map +1 -0
  155. package/dist/monolith/plumbing/terminal/TerminalService.js +180 -0
  156. package/dist/monolith/plumbing/terminal/TerminalService.js.map +1 -0
  157. package/dist/monolith/plumbing/ui/DecorationService.js +54 -0
  158. package/dist/monolith/plumbing/ui/DecorationService.js.map +1 -0
  159. package/dist/monolith/plumbing/utils/ErrorUtils.js +11 -0
  160. package/dist/monolith/plumbing/utils/ErrorUtils.js.map +1 -0
  161. package/dist/monolith/plumbing/utils/JsonUtils.js +360 -0
  162. package/dist/monolith/plumbing/utils/JsonUtils.js.map +1 -0
  163. package/dist/monolith/plumbing/utils/PrefixTree.js +153 -0
  164. package/dist/monolith/plumbing/utils/PrefixTree.js.map +1 -0
  165. package/dist/monolith/plumbing/utils/RetryUtils.js +141 -0
  166. package/dist/monolith/plumbing/utils/RetryUtils.js.map +1 -0
  167. package/dist/monolith/plumbing/utils/StreamTagDetector.js +128 -0
  168. package/dist/monolith/plumbing/utils/StreamTagDetector.js.map +1 -0
  169. package/dist/monolith/plumbing/utils/StringUtils.js +97 -0
  170. package/dist/monolith/plumbing/utils/StringUtils.js.map +1 -0
  171. package/dist/monolith/plumbing/utils/TimeoutUtils.js +21 -0
  172. package/dist/monolith/plumbing/utils/TimeoutUtils.js.map +1 -0
  173. package/dist/monolith/runtime/MarieRuntime.js +354 -0
  174. package/dist/monolith/runtime/MarieRuntime.js.map +1 -0
  175. package/dist/monolith/runtime/RuntimeAdapterBase.js +59 -0
  176. package/dist/monolith/runtime/RuntimeAdapterBase.js.map +1 -0
  177. package/dist/monolith/runtime/providerFactory.js +11 -0
  178. package/dist/monolith/runtime/providerFactory.js.map +1 -0
  179. package/dist/monolith/runtime/types.js +2 -0
  180. package/dist/monolith/runtime/types.js.map +1 -0
  181. package/dist/monolith/services/HealthService.js +38 -0
  182. package/dist/monolith/services/HealthService.js.map +1 -0
  183. package/dist/monolith/services/JoyAutomationService.js +131 -0
  184. package/dist/monolith/services/JoyAutomationService.js.map +1 -0
  185. package/dist/monolith/services/JoyLogService.js +48 -0
  186. package/dist/monolith/services/JoyLogService.js.map +1 -0
  187. package/dist/monolith/services/JoyService.js +190 -0
  188. package/dist/monolith/services/JoyService.js.map +1 -0
  189. package/dist/monolith/services/MarieGhostService.js +168 -0
  190. package/dist/monolith/services/MarieGhostService.js.map +1 -0
  191. package/dist/monolith/services/MarieSCMProvider.js +41 -0
  192. package/dist/monolith/services/MarieSCMProvider.js.map +1 -0
  193. package/package.json +168 -0
@@ -0,0 +1,72 @@
1
+ import { registerMarieToolsCLI } from "../cli/MarieToolDefinitionsCLI.js";
2
+ import { Storage } from "../cli/storage.js";
3
+ import { JoyServiceCLI } from "../cli/services/JoyServiceCLI.js";
4
+ import { MarieRuntime } from "../runtime/MarieRuntime.js";
5
+ import { JoyAutomationServiceCLI } from "../cli/services/JoyAutomationServiceCLI.js";
6
+ import { createDefaultProvider } from "../runtime/providerFactory.js";
7
+ import { RuntimeAdapterBase } from "../runtime/RuntimeAdapterBase.js";
8
+ import { CliFileSystemPort } from "../cli/CliFileSystemPort.js";
9
+ class CliConfigPort {
10
+ getAiProvider() {
11
+ const config = Storage.getConfig();
12
+ return config.aiProvider;
13
+ }
14
+ getApiKey(provider) {
15
+ const config = Storage.getConfig();
16
+ if (provider === "openrouter")
17
+ return config.openrouterApiKey || "";
18
+ if (provider === "cerebras")
19
+ return config.cerebrasApiKey || "";
20
+ return config.apiKey || "";
21
+ }
22
+ }
23
+ class CliSessionStorePort {
24
+ async getSessions() {
25
+ return Storage.getSessions();
26
+ }
27
+ async saveSessions(sessions) {
28
+ Storage.saveSessions(sessions);
29
+ }
30
+ async getSessionMetadata() {
31
+ return Storage.getSessionMetadata();
32
+ }
33
+ async saveSessionMetadata(metadata) {
34
+ Storage.saveSessionMetadata(metadata);
35
+ }
36
+ async getCurrentSessionId() {
37
+ return Storage.getCurrentSessionId();
38
+ }
39
+ async setCurrentSessionId(id) {
40
+ Storage.setCurrentSessionId(id);
41
+ }
42
+ async getLastTelemetry() {
43
+ return Storage.getLastTelemetry();
44
+ }
45
+ async setLastTelemetry(telemetry) {
46
+ Storage.setLastTelemetry(telemetry);
47
+ }
48
+ }
49
+ export class MarieCLI extends RuntimeAdapterBase {
50
+ joyService;
51
+ constructor(workingDir = process.cwd()) {
52
+ const joyService = new JoyServiceCLI();
53
+ const automationService = new JoyAutomationServiceCLI(workingDir, joyService);
54
+ const runtime = new MarieRuntime({
55
+ config: new CliConfigPort(),
56
+ sessionStore: new CliSessionStorePort(),
57
+ toolRegistrar: (registry, automation) => registerMarieToolsCLI(registry, automation, workingDir),
58
+ providerFactory: createDefaultProvider,
59
+ automationService,
60
+ onProgressEvent: (event) => joyService.emitRunProgress(event),
61
+ shouldBypassApprovals: () => true,
62
+ fs: new CliFileSystemPort(workingDir),
63
+ });
64
+ super(runtime);
65
+ this.joyService = joyService;
66
+ }
67
+ dispose() {
68
+ super.dispose();
69
+ this.joyService.dispose();
70
+ }
71
+ }
72
+ //# sourceMappingURL=CliMarieAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CliMarieAdapter.js","sourceRoot":"","sources":["../../../src/monolith/adapters/CliMarieAdapter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,OAAO,EAA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Tools } from "../infrastructure/tools/MarieToolDefinitions.js";
2
+ import { JoyAutomationService } from "../services/JoyAutomationService.js";
3
+ import { ConfigService } from "../infrastructure/config/ConfigService.js";
4
+ import { MarieRuntime } from "../runtime/MarieRuntime.js";
5
+ import { createDefaultProvider } from "../runtime/providerFactory.js";
6
+ import { RuntimeAdapterBase } from "../runtime/RuntimeAdapterBase.js";
7
+ import { VscodeFileSystemPort } from "../infrastructure/ai/core/VscodeFileSystemPort.js";
8
+ import { MarieGhostService } from "../services/MarieGhostService.js";
9
+ class VscodeConfigPort {
10
+ getAiProvider() {
11
+ return ConfigService.getAiProvider();
12
+ }
13
+ getApiKey(provider) {
14
+ if (provider === "openrouter")
15
+ return ConfigService.getOpenRouterApiKey() || "";
16
+ if (provider === "cerebras")
17
+ return ConfigService.getCerebrasApiKey() || "";
18
+ return ConfigService.getApiKey() || "";
19
+ }
20
+ }
21
+ class VscodeSessionStorePort {
22
+ context;
23
+ constructor(context) {
24
+ this.context = context;
25
+ }
26
+ async getSessions() {
27
+ return (this.context.workspaceState.get("marie.sessions") || {});
28
+ }
29
+ async saveSessions(sessions) {
30
+ await this.context.workspaceState.update("marie.sessions", sessions);
31
+ }
32
+ async getSessionMetadata() {
33
+ return (this.context.workspaceState.get("marie.sessionMetadata") || []);
34
+ }
35
+ async saveSessionMetadata(metadata) {
36
+ await this.context.workspaceState.update("marie.sessionMetadata", metadata);
37
+ }
38
+ async getCurrentSessionId() {
39
+ return (this.context.workspaceState.get("marie.currentSessionId") ||
40
+ "default");
41
+ }
42
+ async setCurrentSessionId(id) {
43
+ await this.context.workspaceState.update("marie.currentSessionId", id);
44
+ }
45
+ async getLastTelemetry() {
46
+ return this.context.workspaceState.get("marie.lastTelemetry");
47
+ }
48
+ async setLastTelemetry(telemetry) {
49
+ await this.context.workspaceState.update("marie.lastTelemetry", telemetry);
50
+ }
51
+ }
52
+ export class Marie extends RuntimeAdapterBase {
53
+ context;
54
+ joyService;
55
+ constructor(context, joyService) {
56
+ const automationService = new JoyAutomationService(context, joyService);
57
+ if (!process.env.MARIE_EXTENSION_TESTS) {
58
+ automationService.startAutonomousHeartbeat();
59
+ }
60
+ const runtime = new MarieRuntime({
61
+ config: new VscodeConfigPort(),
62
+ sessionStore: new VscodeSessionStorePort(context),
63
+ toolRegistrar: registerMarieTools,
64
+ providerFactory: createDefaultProvider,
65
+ automationService,
66
+ onProgressEvent: (event) => this.joyService.onRunProgress(event),
67
+ shouldBypassApprovals: () => ConfigService.getAutonomyMode() !== "balanced",
68
+ fs: new VscodeFileSystemPort(),
69
+ ghostPort: {
70
+ handleDelta: (id, name, delta) => MarieGhostService.handleDelta(id, name, delta),
71
+ },
72
+ });
73
+ super(runtime);
74
+ this.context = context;
75
+ this.joyService = joyService;
76
+ }
77
+ dispose() {
78
+ super.dispose();
79
+ }
80
+ }
81
+ //# sourceMappingURL=VscodeMarieAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VscodeMarieAdapter.js","sourceRoot":"","sources":["../../../src/monolith/adapters/VscodeMarieAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAO1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,gBAAgB;IACpB,aAAa;QACX,OAAO,aAAa,CAAC,aAAa,EAAE,CAAC;IACvC,CAAC;IAED,SAAS,CAAC,QAA2B;QACnC,IAAI,QAAQ,KAAK,YAAY;YA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"}
@@ -0,0 +1,83 @@
1
+ import * as fs from "fs/promises";
2
+ import * as path from "path";
3
+ /**
4
+ * CliFileSystemPort - Implementation of FileSystemPort for the CLI environment.
5
+ * Uses standard Node.js fs/promises for file operations.
6
+ */
7
+ export class CliFileSystemPort {
8
+ workingDir;
9
+ type = "cli";
10
+ backups = new Map();
11
+ constructor(workingDir) {
12
+ this.workingDir = workingDir;
13
+ }
14
+ resolve(filePath) {
15
+ return path.isAbsolute(filePath)
16
+ ? filePath
17
+ : path.resolve(this.workingDir, filePath);
18
+ }
19
+ async readFile(filePath, _signal) {
20
+ try {
21
+ return await fs.readFile(this.resolve(filePath), "utf-8");
22
+ }
23
+ catch (error) {
24
+ throw new Error(`Failed to read file ${filePath}: ${error.message}`);
25
+ }
26
+ }
27
+ async writeFile(filePath, content, _signal) {
28
+ const fullPath = this.resolve(filePath);
29
+ try {
30
+ await fs.mkdir(path.dirname(fullPath), { recursive: true });
31
+ await fs.writeFile(fullPath, content, "utf-8");
32
+ }
33
+ catch (error) {
34
+ throw new Error(`Failed to write file ${filePath}: ${error.message}`);
35
+ }
36
+ }
37
+ async deleteFile(filePath) {
38
+ try {
39
+ await fs.rm(this.resolve(filePath), { force: true });
40
+ }
41
+ catch (error) {
42
+ throw new Error(`Failed to delete file ${filePath}: ${error.message}`);
43
+ }
44
+ }
45
+ async backupFile(filePath) {
46
+ try {
47
+ const content = await this.readFile(filePath);
48
+ this.backups.set(filePath, content);
49
+ }
50
+ catch {
51
+ // If file doesn't exist, we'll store null/empty to represent "delete on rollback"
52
+ this.backups.set(filePath, "__NON_EXISTENT__");
53
+ }
54
+ }
55
+ async restoreFile(filePath) {
56
+ const content = this.backups.get(filePath);
57
+ if (content === undefined)
58
+ return;
59
+ if (content === "__NON_EXISTENT__") {
60
+ try {
61
+ await this.deleteFile(filePath);
62
+ }
63
+ catch {
64
+ // Ignore errors during restore-delete
65
+ }
66
+ }
67
+ else {
68
+ await this.writeFile(filePath, content);
69
+ }
70
+ this.backups.delete(filePath);
71
+ }
72
+ async rollbackAll() {
73
+ const paths = Array.from(this.backups.keys());
74
+ for (const p of paths) {
75
+ await this.restoreFile(p);
76
+ }
77
+ this.backups.clear();
78
+ }
79
+ clearBackups() {
80
+ this.backups.clear();
81
+ }
82
+ }
83
+ //# sourceMappingURL=CliFileSystemPort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CliFileSystemPort.js","sourceRoot":"","sources":["../../../src/monolith/cli/CliFileSystemPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAIR;IAHJ,IAAI,GAAG,KAAK,CAAC;IACrB,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE5C,YAAoB,UAAkB;QAAlB,eAAU,GAAV,UAAU,CAAQ;IAAG,CAAC;IAElC,OAAO,CAAC,QAAgB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YAC9B,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAgB,EAAE,OAAqB;QACpD,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,uBAAuB,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,KAAK,CAAC,SAAS,CACb,QAAgB,EAChB,OAAe,EACf,OAAqB;QAErB,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAA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