@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.
- package/JOY_ZONING.md +200 -0
- package/LICENSE.md +190 -0
- package/README.md +94 -0
- package/dist/cli-new/components/App.js +138 -0
- package/dist/cli-new/components/App.js.map +1 -0
- package/dist/cli-new/components/ApprovalDialog.js +31 -0
- package/dist/cli-new/components/ApprovalDialog.js.map +1 -0
- package/dist/cli-new/components/Banner.js +23 -0
- package/dist/cli-new/components/Banner.js.map +1 -0
- package/dist/cli-new/components/ChatArea.js +49 -0
- package/dist/cli-new/components/ChatArea.js.map +1 -0
- package/dist/cli-new/components/Header.js +20 -0
- package/dist/cli-new/components/Header.js.map +1 -0
- package/dist/cli-new/components/InputArea.js +97 -0
- package/dist/cli-new/components/InputArea.js.map +1 -0
- package/dist/cli-new/components/MessageBubble.js +114 -0
- package/dist/cli-new/components/MessageBubble.js.map +1 -0
- package/dist/cli-new/components/SessionSwitcher.js +46 -0
- package/dist/cli-new/components/SessionSwitcher.js.map +1 -0
- package/dist/cli-new/components/SetupWizard.js +283 -0
- package/dist/cli-new/components/SetupWizard.js.map +1 -0
- package/dist/cli-new/components/ToolCallDisplay.js +45 -0
- package/dist/cli-new/components/ToolCallDisplay.js.map +1 -0
- package/dist/cli-new/hooks/useGit.js +99 -0
- package/dist/cli-new/hooks/useGit.js.map +1 -0
- package/dist/cli-new/hooks/useMarie.js +249 -0
- package/dist/cli-new/hooks/useMarie.js.map +1 -0
- package/dist/cli-new/hooks/useSessions.js +75 -0
- package/dist/cli-new/hooks/useSessions.js.map +1 -0
- package/dist/cli-new/index.js +52 -0
- package/dist/cli-new/index.js.map +1 -0
- package/dist/cli-new/styles/theme.js +68 -0
- package/dist/cli-new/styles/theme.js.map +1 -0
- package/dist/cli-new/types/cli.js +2 -0
- package/dist/cli-new/types/cli.js.map +1 -0
- package/dist/extension.cjs +655 -0
- package/dist/monolith/adapters/CliMarieAdapter.js +72 -0
- package/dist/monolith/adapters/CliMarieAdapter.js.map +1 -0
- package/dist/monolith/adapters/VscodeMarieAdapter.js +81 -0
- package/dist/monolith/adapters/VscodeMarieAdapter.js.map +1 -0
- package/dist/monolith/cli/CliFileSystemPort.js +83 -0
- package/dist/monolith/cli/CliFileSystemPort.js.map +1 -0
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js +438 -0
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js.map +1 -0
- package/dist/monolith/cli/index.js +272 -0
- package/dist/monolith/cli/index.js.map +1 -0
- package/dist/monolith/cli/services/JoyAutomationServiceCLI.js +80 -0
- package/dist/monolith/cli/services/JoyAutomationServiceCLI.js.map +1 -0
- package/dist/monolith/cli/services/JoyServiceCLI.js +63 -0
- package/dist/monolith/cli/services/JoyServiceCLI.js.map +1 -0
- package/dist/monolith/cli/storage.js +119 -0
- package/dist/monolith/cli/storage.js.map +1 -0
- package/dist/monolith/domain/joy/JoyTools.js +513 -0
- package/dist/monolith/domain/joy/JoyTools.js.map +1 -0
- package/dist/monolith/domain/joy/RitualService.js +51 -0
- package/dist/monolith/domain/joy/RitualService.js.map +1 -0
- package/dist/monolith/domain/marie/MarieTypes.js +2 -0
- package/dist/monolith/domain/marie/MarieTypes.js.map +1 -0
- package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js +230 -0
- package/dist/monolith/infrastructure/ai/agents/MarieAscendant.js.map +1 -0
- package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js +207 -0
- package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js.map +1 -0
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js +129 -0
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js.map +1 -0
- package/dist/monolith/infrastructure/ai/context/ContextManager.js +118 -0
- package/dist/monolith/infrastructure/ai/context/ContextManager.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/FileSystemPort.js +2 -0
- package/dist/monolith/infrastructure/ai/core/FileSystemPort.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/GhostPort.js +2 -0
- package/dist/monolith/infrastructure/ai/core/GhostPort.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieAscensionTypes.js +2 -0
- package/dist/monolith/infrastructure/ai/core/MarieAscensionTypes.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js +590 -0
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js +161 -0
- package/dist/monolith/infrastructure/ai/core/MarieEventDispatcher.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js +121 -0
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js +256 -0
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MariePulseService.js +67 -0
- package/dist/monolith/infrastructure/ai/core/MariePulseService.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieResponse.js +101 -0
- package/dist/monolith/infrastructure/ai/core/MarieResponse.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js +86 -0
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieSession.js +202 -0
- package/dist/monolith/infrastructure/ai/core/MarieSession.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js +58 -0
- package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolMender.js +127 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolMender.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js +548 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js +2 -0
- package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js +125 -0
- package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js.map +1 -0
- package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js +30 -0
- package/dist/monolith/infrastructure/ai/core/VscodeFileSystemPort.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/AIProvider.js +2 -0
- package/dist/monolith/infrastructure/ai/providers/AIProvider.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js +148 -0
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js +208 -0
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js +404 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js.map +1 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js +283 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterStreamParser.js.map +1 -0
- package/dist/monolith/infrastructure/config/ConfigService.js +398 -0
- package/dist/monolith/infrastructure/config/ConfigService.js.map +1 -0
- package/dist/monolith/infrastructure/services/MarieMemoryStore.js +140 -0
- package/dist/monolith/infrastructure/services/MarieMemoryStore.js.map +1 -0
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js +1568 -0
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js.map +1 -0
- package/dist/monolith/infrastructure/tools/PureStreamParser.js +147 -0
- package/dist/monolith/infrastructure/tools/PureStreamParser.js.map +1 -0
- package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js +223 -0
- package/dist/monolith/infrastructure/tools/SharedToolDefinitions.js.map +1 -0
- package/dist/monolith/infrastructure/tools/ToolRegistry.js +29 -0
- package/dist/monolith/infrastructure/tools/ToolRegistry.js.map +1 -0
- package/dist/monolith/infrastructure/tools/ToolUtils.js +59 -0
- package/dist/monolith/infrastructure/tools/ToolUtils.js.map +1 -0
- package/dist/monolith/plumbing/analysis/CodeHealthService.js +146 -0
- package/dist/monolith/plumbing/analysis/CodeHealthService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/ComplexityService.js +43 -0
- package/dist/monolith/plumbing/analysis/ComplexityService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/DependencyService.js +51 -0
- package/dist/monolith/plumbing/analysis/DependencyService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/DiscoveryService.js +49 -0
- package/dist/monolith/plumbing/analysis/DiscoveryService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/JoyMapService.js +66 -0
- package/dist/monolith/plumbing/analysis/JoyMapService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/LintService.js +132 -0
- package/dist/monolith/plumbing/analysis/LintService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js +276 -0
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/QualityGuardrailService.js +119 -0
- package/dist/monolith/plumbing/analysis/QualityGuardrailService.js.map +1 -0
- package/dist/monolith/plumbing/analysis/SurgicalMender.js +70 -0
- package/dist/monolith/plumbing/analysis/SurgicalMender.js.map +1 -0
- package/dist/monolith/plumbing/analysis/TestService.js +104 -0
- package/dist/monolith/plumbing/analysis/TestService.js.map +1 -0
- package/dist/monolith/plumbing/filesystem/FileService.js +406 -0
- package/dist/monolith/plumbing/filesystem/FileService.js.map +1 -0
- package/dist/monolith/plumbing/filesystem/PathResolver.js +26 -0
- package/dist/monolith/plumbing/filesystem/PathResolver.js.map +1 -0
- package/dist/monolith/plumbing/git/GitService.js +71 -0
- package/dist/monolith/plumbing/git/GitService.js.map +1 -0
- package/dist/monolith/plumbing/lsp/SymbolService.js +36 -0
- package/dist/monolith/plumbing/lsp/SymbolService.js.map +1 -0
- package/dist/monolith/plumbing/terminal/ProcessRegistry.js +31 -0
- package/dist/monolith/plumbing/terminal/ProcessRegistry.js.map +1 -0
- package/dist/monolith/plumbing/terminal/TerminalService.js +180 -0
- package/dist/monolith/plumbing/terminal/TerminalService.js.map +1 -0
- package/dist/monolith/plumbing/ui/DecorationService.js +54 -0
- package/dist/monolith/plumbing/ui/DecorationService.js.map +1 -0
- package/dist/monolith/plumbing/utils/ErrorUtils.js +11 -0
- package/dist/monolith/plumbing/utils/ErrorUtils.js.map +1 -0
- package/dist/monolith/plumbing/utils/JsonUtils.js +360 -0
- package/dist/monolith/plumbing/utils/JsonUtils.js.map +1 -0
- package/dist/monolith/plumbing/utils/PrefixTree.js +153 -0
- package/dist/monolith/plumbing/utils/PrefixTree.js.map +1 -0
- package/dist/monolith/plumbing/utils/RetryUtils.js +141 -0
- package/dist/monolith/plumbing/utils/RetryUtils.js.map +1 -0
- package/dist/monolith/plumbing/utils/StreamTagDetector.js +128 -0
- package/dist/monolith/plumbing/utils/StreamTagDetector.js.map +1 -0
- package/dist/monolith/plumbing/utils/StringUtils.js +97 -0
- package/dist/monolith/plumbing/utils/StringUtils.js.map +1 -0
- package/dist/monolith/plumbing/utils/TimeoutUtils.js +21 -0
- package/dist/monolith/plumbing/utils/TimeoutUtils.js.map +1 -0
- package/dist/monolith/runtime/MarieRuntime.js +354 -0
- package/dist/monolith/runtime/MarieRuntime.js.map +1 -0
- package/dist/monolith/runtime/RuntimeAdapterBase.js +59 -0
- package/dist/monolith/runtime/RuntimeAdapterBase.js.map +1 -0
- package/dist/monolith/runtime/providerFactory.js +11 -0
- package/dist/monolith/runtime/providerFactory.js.map +1 -0
- package/dist/monolith/runtime/types.js +2 -0
- package/dist/monolith/runtime/types.js.map +1 -0
- package/dist/monolith/services/HealthService.js +38 -0
- package/dist/monolith/services/HealthService.js.map +1 -0
- package/dist/monolith/services/JoyAutomationService.js +131 -0
- package/dist/monolith/services/JoyAutomationService.js.map +1 -0
- package/dist/monolith/services/JoyLogService.js +48 -0
- package/dist/monolith/services/JoyLogService.js.map +1 -0
- package/dist/monolith/services/JoyService.js +190 -0
- package/dist/monolith/services/JoyService.js.map +1 -0
- package/dist/monolith/services/MarieGhostService.js +168 -0
- package/dist/monolith/services/MarieGhostService.js.map +1 -0
- package/dist/monolith/services/MarieSCMProvider.js +41 -0
- package/dist/monolith/services/MarieSCMProvider.js.map +1 -0
- package/package.json +168 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
export class JoyLogService {
|
|
3
|
+
context;
|
|
4
|
+
static STORAGE_KEY = "marie.joyLog";
|
|
5
|
+
_log = [];
|
|
6
|
+
_onAchievementAdded = new vscode.EventEmitter();
|
|
7
|
+
onAchievementAdded = this._onAchievementAdded.event;
|
|
8
|
+
constructor(context) {
|
|
9
|
+
this.context = context;
|
|
10
|
+
this._loadLog();
|
|
11
|
+
}
|
|
12
|
+
_loadLog() {
|
|
13
|
+
const saved = this.context.globalState.get(JoyLogService.STORAGE_KEY);
|
|
14
|
+
this._log = saved || [];
|
|
15
|
+
}
|
|
16
|
+
async addAchievement(description, points = 10) {
|
|
17
|
+
const achievement = {
|
|
18
|
+
id: Math.random().toString(36).substring(7),
|
|
19
|
+
description,
|
|
20
|
+
timestamp: Date.now(),
|
|
21
|
+
points,
|
|
22
|
+
};
|
|
23
|
+
this._log.unshift(achievement);
|
|
24
|
+
// Keep last 100 achievements
|
|
25
|
+
if (this._log.length > 100) {
|
|
26
|
+
this._log = this._log.slice(0, 100);
|
|
27
|
+
}
|
|
28
|
+
await this.context.globalState.update(JoyLogService.STORAGE_KEY, this._log);
|
|
29
|
+
this._onAchievementAdded.fire(achievement);
|
|
30
|
+
return achievement;
|
|
31
|
+
}
|
|
32
|
+
getLog() {
|
|
33
|
+
return this._log;
|
|
34
|
+
}
|
|
35
|
+
getStats() {
|
|
36
|
+
const totalPoints = this._log.reduce((acc, curr) => acc + curr.points, 0);
|
|
37
|
+
return {
|
|
38
|
+
totalPoints,
|
|
39
|
+
count: this._log.length,
|
|
40
|
+
recent: this._log.slice(0, 5),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async clearLog() {
|
|
44
|
+
this._log = [];
|
|
45
|
+
await this.context.globalState.update(JoyLogService.STORAGE_KEY, []);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=JoyLogService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JoyLogService.js","sourceRoot":"","sources":["../../../src/monolith/services/JoyLogService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AASjC,MAAM,OAAO,aAAa;IAQK;IAPrB,MAAM,CAAU,WAAW,GAAG,cAAc,CAAC;IAC7C,IAAI,GAAsB,EAAE,CAAC;IAEpB,mBAAmB,GAClC,IAAI,MAAM,CAAC,YAAY,EAAmB,CAAC;IAC7B,kBAAkB,GAAG,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC;IAEpE,YAA6B,OAAgC;QAAhC,YAAO,GAAP,OAAO,CAAyB;QAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;IAClB,CAAC;IAEO,QAAQ;QACd,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CACxC,aAAa,CAAC,WAAW,CAC1B,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,WAAmB,EAAE,SAAiB,EAAE;QAClE,MAAM,WAAW,GAAoB;YACnC,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;YAC3C,WAAW;YACX,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,MAAM;SACP,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC/B,6BAA6B;QAC7B,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACtC,CAAC;QAED,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5E,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC3C,OAAO,WAAW,CAAC;IACrB,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAEM,QAAQ;QACb,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC1E,OAAO;YACL,WAAW;YACX,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM;YACvB,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SAC9B,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,QAAQ;QACnB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACvE,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import { checkCodeHealth, } from "../plumbing/analysis/CodeHealthService.js";
|
|
3
|
+
import { proposeClustering, isProjectJoyful } from "../domain/joy/JoyTools.js";
|
|
4
|
+
export class JoyService {
|
|
5
|
+
context;
|
|
6
|
+
joyLog;
|
|
7
|
+
statusBarItem;
|
|
8
|
+
_onJoyScoreChange = new vscode.EventEmitter();
|
|
9
|
+
onJoyScoreChange = this._onJoyScoreChange.event;
|
|
10
|
+
_onRunProgress = new vscode.EventEmitter();
|
|
11
|
+
onRunProgress = this._onRunProgress.event;
|
|
12
|
+
intention = null;
|
|
13
|
+
_lastProjectScore = null;
|
|
14
|
+
constructor(context, joyLog) {
|
|
15
|
+
this.context = context;
|
|
16
|
+
this.joyLog = joyLog;
|
|
17
|
+
this.statusBarItem = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100);
|
|
18
|
+
context.subscriptions.push(this.statusBarItem);
|
|
19
|
+
this.intention =
|
|
20
|
+
context.workspaceState.get("marie.intention") || null;
|
|
21
|
+
if (!process.env.MARIE_EXTENSION_TESTS) {
|
|
22
|
+
// Update when active editor changes
|
|
23
|
+
context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(() => this.updateJoyStatus()));
|
|
24
|
+
// Update when document is saved
|
|
25
|
+
context.subscriptions.push(vscode.workspace.onDidSaveTextDocument(async (doc) => {
|
|
26
|
+
await this.updateJoyStatus();
|
|
27
|
+
const config = vscode.workspace.getConfiguration("marie");
|
|
28
|
+
if (config.get("strictMode")) {
|
|
29
|
+
const health = await checkCodeHealth(doc.fileName);
|
|
30
|
+
if (health.zoningHealth?.isBackflowPresent) {
|
|
31
|
+
vscode.window.showWarningMessage(`⚠️ Strict Mode: Zoning Violation detected in ${vscode.workspace.asRelativePath(doc.fileName)}. Please respect the Downward Flow Law.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
this.updateJoyStatus();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async addAchievement(description, points = 10) {
|
|
39
|
+
return await this.joyLog.addAchievement(description, points);
|
|
40
|
+
}
|
|
41
|
+
async setIntention(intention) {
|
|
42
|
+
this.intention = intention;
|
|
43
|
+
await this.context.workspaceState.update("marie.intention", intention);
|
|
44
|
+
this.updateJoyStatus();
|
|
45
|
+
}
|
|
46
|
+
async getProjectHealth() {
|
|
47
|
+
const rootPath = vscode.workspace.workspaceFolders?.[0].uri.fsPath;
|
|
48
|
+
if (!rootPath)
|
|
49
|
+
return null;
|
|
50
|
+
const files = await vscode.workspace.findFiles("**/*.{ts,js,tsx,jsx}", "**/node_modules/**", 100);
|
|
51
|
+
let totalScore = 0;
|
|
52
|
+
let fileCount = 0;
|
|
53
|
+
let zoningViolations = 0;
|
|
54
|
+
let joyfulFiles = 0;
|
|
55
|
+
let plumbingFiles = 0;
|
|
56
|
+
const migrationAlerts = [];
|
|
57
|
+
for (const file of files.slice(0, 30)) {
|
|
58
|
+
try {
|
|
59
|
+
const health = await checkCodeHealth(file.fsPath);
|
|
60
|
+
totalScore += health.joyScore;
|
|
61
|
+
fileCount++;
|
|
62
|
+
if (health.zoningHealth?.isBackflowPresent) {
|
|
63
|
+
zoningViolations++;
|
|
64
|
+
}
|
|
65
|
+
if (health.zoningHealth?.migrationNeed?.shouldMigrate) {
|
|
66
|
+
migrationAlerts.push({
|
|
67
|
+
file: vscode.workspace.asRelativePath(file),
|
|
68
|
+
reason: health.zoningHealth.migrationNeed.reason ||
|
|
69
|
+
"Conceptual drift detected.",
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (file.fsPath.includes("/domain/"))
|
|
73
|
+
joyfulFiles++;
|
|
74
|
+
else if (file.fsPath.includes("/plumbing/"))
|
|
75
|
+
plumbingFiles++;
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
/* Ignore individual file health check failures */
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const average = fileCount > 0 ? Math.round(totalScore / fileCount) : 100;
|
|
82
|
+
// Scale check: Clustering suggestions
|
|
83
|
+
const clusteringAlerts = await proposeClustering(rootPath);
|
|
84
|
+
const isJoyful = await isProjectJoyful(rootPath);
|
|
85
|
+
// Detect project-wide improvement
|
|
86
|
+
if (this._lastProjectScore !== null && average > this._lastProjectScore) {
|
|
87
|
+
await this.joyLog.addAchievement(`Project health improved to ${average}! ✨`, 50);
|
|
88
|
+
}
|
|
89
|
+
this._lastProjectScore = average;
|
|
90
|
+
return {
|
|
91
|
+
average,
|
|
92
|
+
fileCount,
|
|
93
|
+
log: this.joyLog.getLog(),
|
|
94
|
+
zoningViolations,
|
|
95
|
+
joyfulFiles,
|
|
96
|
+
plumbingFiles,
|
|
97
|
+
migrationAlerts,
|
|
98
|
+
clusteringAlerts,
|
|
99
|
+
isJoyful,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
_onLettingGoRequest = new vscode.EventEmitter();
|
|
103
|
+
onLettingGoRequest = this._onLettingGoRequest.event;
|
|
104
|
+
async requestLettingGo(path) {
|
|
105
|
+
// Calculate lines for the modal
|
|
106
|
+
let lines = 0;
|
|
107
|
+
try {
|
|
108
|
+
const content = await vscode.workspace.fs.readFile(vscode.Uri.file(path));
|
|
109
|
+
lines = content.toString().split("\n").length;
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
/* File may not exist or be unreadable, default to 0 lines */
|
|
113
|
+
}
|
|
114
|
+
this._onLettingGoRequest.fire({ path, lines });
|
|
115
|
+
}
|
|
116
|
+
async updateJoyStatus() {
|
|
117
|
+
const editor = vscode.window.activeTextEditor;
|
|
118
|
+
// Base text
|
|
119
|
+
let text = "";
|
|
120
|
+
let tooltip = "";
|
|
121
|
+
// If we have an intention, it takes precedence or shares space
|
|
122
|
+
if (this.intention) {
|
|
123
|
+
text = `$(heart) Intention: ${this.intention} `;
|
|
124
|
+
tooltip += `Current Intention: ${this.intention}\n\n`;
|
|
125
|
+
}
|
|
126
|
+
if (!editor) {
|
|
127
|
+
if (this.intention) {
|
|
128
|
+
this.statusBarItem.text = text;
|
|
129
|
+
this.statusBarItem.tooltip = tooltip;
|
|
130
|
+
this.statusBarItem.show();
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.statusBarItem.hide();
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const doc = editor.document;
|
|
138
|
+
// Only check supported files for Joy Score
|
|
139
|
+
if (doc.uri.scheme === "file" && this.isSupportedFile(doc.fileName)) {
|
|
140
|
+
try {
|
|
141
|
+
const health = await checkCodeHealth(doc.fileName);
|
|
142
|
+
const score = health.joyScore;
|
|
143
|
+
// Track small improvements as achievements
|
|
144
|
+
if (score === 100) {
|
|
145
|
+
await this.joyLog.addAchievement(`Reached 100% Joy in ${vscode.workspace.asRelativePath(doc.fileName)}! ❤️`, 20);
|
|
146
|
+
}
|
|
147
|
+
let icon = "$(sparkle)";
|
|
148
|
+
if (score === 100)
|
|
149
|
+
icon = "$(heart)";
|
|
150
|
+
else if (score >= 80)
|
|
151
|
+
icon = "$(sparkle)";
|
|
152
|
+
else if (score >= 50)
|
|
153
|
+
icon = "$(warning)";
|
|
154
|
+
else
|
|
155
|
+
icon = "$(trash)";
|
|
156
|
+
text += `${icon} Joy: ${score}`;
|
|
157
|
+
tooltip += `Joy Status: ${health.joyStatus}\n\n${health.tips.join("\n")}`;
|
|
158
|
+
this._onJoyScoreChange.fire({
|
|
159
|
+
score,
|
|
160
|
+
status: health.joyStatus,
|
|
161
|
+
tips: health.tips,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
// Ignore health check errors for UI purposes
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (text) {
|
|
169
|
+
this.statusBarItem.text = text;
|
|
170
|
+
this.statusBarItem.tooltip = tooltip;
|
|
171
|
+
this.statusBarItem.show();
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
this.statusBarItem.hide();
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
isSupportedFile(fileName) {
|
|
178
|
+
return (fileName.endsWith(".ts") ||
|
|
179
|
+
fileName.endsWith(".js") ||
|
|
180
|
+
fileName.endsWith(".tsx") ||
|
|
181
|
+
fileName.endsWith(".jsx"));
|
|
182
|
+
}
|
|
183
|
+
dispose() {
|
|
184
|
+
this.statusBarItem.dispose();
|
|
185
|
+
this._onJoyScoreChange.dispose();
|
|
186
|
+
this._onLettingGoRequest.dispose();
|
|
187
|
+
this._onRunProgress.dispose();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=JoyService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JoyService.js","sourceRoot":"","sources":["../../../src/monolith/services/JoyService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EACL,eAAe,GAEhB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE/E,MAAM,OAAO,UAAU;IAoBF;IACA;IApBX,aAAa,CAAuB;IAC3B,iBAAiB,GAAG,IAAI,MAAM,CAAC,YAAY,EAIxD,CAAC;IACW,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;IAC/C,cAAc,GAAG,IAAI,MAAM,CAAC,YAAY,EAMrD,CAAC;IACW,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC;IAClD,SAAS,GAAkB,IAAI,CAAC;IAChC,iBAAiB,GAAkB,IAAI,CAAC;IAEhD,YACmB,OAAgC,EAChC,MAAqB;QADrB,YAAO,GAAP,OAAO,CAAyB;QAChC,WAAM,GAAN,MAAM,CAAe;QAEtC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CACpD,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAC/B,GAAG,CACJ,CAAC;QACF,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAE/C,IAAI,CAAC,SAAS;YACZ,OAAO,CAAC,cAAc,CAAC,GAAG,CAAS,iBAAiB,CAAC,IAAI,IAAI,CAAC;QAEhE,IAAI,CAAC,OAAO,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,CAAC,IAAI,EAAE,CAAC;QAC5B,CAAC;IACH,CAAC;IAEO,eAAe,CAAC,QAAgB;QACtC,OAAO,CACL,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YACxB,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;YACxB,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;YACzB,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAC1B,CAAC;IACJ,CAAC;IACM,OAAO;QACZ,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import { PureStreamParser, } from "../infrastructure/tools/PureStreamParser.js";
|
|
3
|
+
import { MarieSCMProvider } from "./MarieSCMProvider.js";
|
|
4
|
+
import { StringUtils } from "../plumbing/utils/StringUtils.js";
|
|
5
|
+
/**
|
|
6
|
+
* Provides inline 'Ghost Text' previews of AI edits and coordinates with SCM for gutter markers.
|
|
7
|
+
*/
|
|
8
|
+
export class MarieGhostService {
|
|
9
|
+
static parser = new PureStreamParser();
|
|
10
|
+
static lastUpdate = 0;
|
|
11
|
+
static activeGhosts = new Map();
|
|
12
|
+
static ghostDecoration = vscode.window.createTextEditorDecorationType({
|
|
13
|
+
before: {
|
|
14
|
+
color: new vscode.ThemeColor("editorGhostText.foreground"),
|
|
15
|
+
fontStyle: "italic",
|
|
16
|
+
margin: "0 0.5em 0 0",
|
|
17
|
+
},
|
|
18
|
+
opacity: "0.4",
|
|
19
|
+
backgroundColor: new vscode.ThemeColor("editorGhostText.background"),
|
|
20
|
+
isWholeLine: true,
|
|
21
|
+
});
|
|
22
|
+
static init(context) {
|
|
23
|
+
// Ensure ghosts persist across tab switches
|
|
24
|
+
context.subscriptions.push(vscode.window.onDidChangeVisibleTextEditors(() => {
|
|
25
|
+
const uris = new Set(Array.from(this.activeGhosts.values()).map((g) => g.uri));
|
|
26
|
+
uris.forEach((u) => this.refreshDecorations(vscode.Uri.parse(u)));
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
static thoughtDecoration = vscode.window.createTextEditorDecorationType({
|
|
30
|
+
after: {
|
|
31
|
+
color: new vscode.ThemeColor("editorCodeLens.foreground"),
|
|
32
|
+
fontStyle: "italic",
|
|
33
|
+
margin: "0 0 0 2em",
|
|
34
|
+
},
|
|
35
|
+
isWholeLine: true,
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* projects a "Thought" from the swarm into the editor as a ghost comment.
|
|
39
|
+
* These are ephemeral and clear on next run.
|
|
40
|
+
*/
|
|
41
|
+
static showThought(agent, text) {
|
|
42
|
+
const activeEditor = vscode.window.activeTextEditor;
|
|
43
|
+
if (!activeEditor)
|
|
44
|
+
return;
|
|
45
|
+
const line = activeEditor.selection.active.line;
|
|
46
|
+
const decoration = {
|
|
47
|
+
range: new vscode.Range(line, 0, line, 0),
|
|
48
|
+
renderOptions: {
|
|
49
|
+
after: { contentText: ` // 🧠 ${agent}: ${text}` },
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
activeEditor.setDecorations(this.thoughtDecoration, [decoration]);
|
|
53
|
+
const timeoutKey = `${activeEditor.document.uri.toString()}:${line}`;
|
|
54
|
+
if (this.thoughtTimeouts.has(timeoutKey))
|
|
55
|
+
clearTimeout(this.thoughtTimeouts.get(timeoutKey));
|
|
56
|
+
const timeout = setTimeout(() => {
|
|
57
|
+
activeEditor.setDecorations(this.thoughtDecoration, []);
|
|
58
|
+
this.thoughtTimeouts.delete(timeoutKey);
|
|
59
|
+
}, 4000);
|
|
60
|
+
this.thoughtTimeouts.set(timeoutKey, timeout);
|
|
61
|
+
}
|
|
62
|
+
static pendingDeltas = new Map();
|
|
63
|
+
static updateTimer = null;
|
|
64
|
+
static handleDelta(toolCallId, name, delta) {
|
|
65
|
+
if (![
|
|
66
|
+
"write_file",
|
|
67
|
+
"replace_in_file",
|
|
68
|
+
"write_to_file",
|
|
69
|
+
"replace_file_content",
|
|
70
|
+
"multi_replace_file_content",
|
|
71
|
+
].includes(name))
|
|
72
|
+
return;
|
|
73
|
+
// Buffer the delta
|
|
74
|
+
const current = this.pendingDeltas.get(toolCallId) || "";
|
|
75
|
+
this.pendingDeltas.set(toolCallId, current + delta);
|
|
76
|
+
// Schedule flush if not already pending
|
|
77
|
+
if (!this.updateTimer) {
|
|
78
|
+
this.updateTimer = setTimeout(() => this.flushUpdates(), 50);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
static flushUpdates() {
|
|
82
|
+
this.updateTimer = null;
|
|
83
|
+
for (const [toolCallId, delta] of Array.from(this.pendingDeltas.entries())) {
|
|
84
|
+
const input = this.parser.append(toolCallId, delta);
|
|
85
|
+
const hasContent = input.content !== undefined || input.replace !== undefined;
|
|
86
|
+
if (input.path && hasContent) {
|
|
87
|
+
const uri = vscode.Uri.file(input.path);
|
|
88
|
+
this.updateGhost(toolCallId, uri, input);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
this.pendingDeltas.clear();
|
|
92
|
+
}
|
|
93
|
+
static updateGhost(toolCallId, uri, input) {
|
|
94
|
+
const editors = vscode.window.visibleTextEditors.filter((e) => e.document.uri.toString() === uri.toString());
|
|
95
|
+
if (editors.length === 0)
|
|
96
|
+
return;
|
|
97
|
+
const editor = editors[0];
|
|
98
|
+
let targetLine = 0;
|
|
99
|
+
if (input.line_start !== undefined) {
|
|
100
|
+
targetLine = Math.max(0, input.line_start - 1);
|
|
101
|
+
}
|
|
102
|
+
else if (input.old_content || input.search) {
|
|
103
|
+
const searchString = input.search || input.old_content || "";
|
|
104
|
+
const snapshot = searchString.substring(0, 30);
|
|
105
|
+
if (snapshot) {
|
|
106
|
+
for (let i = 0; i < editor.document.lineCount; i++) {
|
|
107
|
+
if (editor.document.lineAt(i).text.includes(snapshot)) {
|
|
108
|
+
targetLine = i;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const range = new vscode.Range(targetLine, 0, targetLine, 0);
|
|
115
|
+
const previewText = input.replace || StringUtils.extractText(input.content) || "";
|
|
116
|
+
const textPreview = ` $(sync~spin) Proposed: ${previewText.substring(0, 80).replace(/\n/g, " ")}...`;
|
|
117
|
+
this.activeGhosts.set(toolCallId, {
|
|
118
|
+
uri: uri.toString(),
|
|
119
|
+
range,
|
|
120
|
+
text: textPreview,
|
|
121
|
+
});
|
|
122
|
+
this.refreshDecorations(uri);
|
|
123
|
+
MarieSCMProvider.getInstance()?.registerDiff(uri, uri);
|
|
124
|
+
}
|
|
125
|
+
static refreshDecorations(uri) {
|
|
126
|
+
const uriStr = uri.toString();
|
|
127
|
+
const relevantGhosts = Array.from(this.activeGhosts.values()).filter((g) => g.uri === uriStr);
|
|
128
|
+
const decorations = relevantGhosts.map((g) => ({
|
|
129
|
+
range: g.range,
|
|
130
|
+
renderOptions: {
|
|
131
|
+
before: { contentText: g.text },
|
|
132
|
+
},
|
|
133
|
+
}));
|
|
134
|
+
vscode.window.visibleTextEditors
|
|
135
|
+
.filter((e) => e.document.uri.toString() === uriStr)
|
|
136
|
+
.forEach((e) => e.setDecorations(this.ghostDecoration, decorations));
|
|
137
|
+
}
|
|
138
|
+
static clear(toolCallId) {
|
|
139
|
+
const ghost = this.activeGhosts.get(toolCallId);
|
|
140
|
+
if (ghost) {
|
|
141
|
+
this.activeGhosts.delete(toolCallId);
|
|
142
|
+
this.refreshDecorations(vscode.Uri.parse(ghost.uri));
|
|
143
|
+
// Only clear SCM if no more ghosts for this URI
|
|
144
|
+
const remaining = Array.from(this.activeGhosts.values()).some((g) => g.uri === ghost.uri);
|
|
145
|
+
if (!remaining) {
|
|
146
|
+
MarieSCMProvider.getInstance()?.clear(vscode.Uri.parse(ghost.uri));
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
this.parser.clear(toolCallId);
|
|
150
|
+
}
|
|
151
|
+
static clearAll() {
|
|
152
|
+
const uris = new Set(Array.from(this.activeGhosts.values()).map((g) => g.uri));
|
|
153
|
+
this.activeGhosts.clear();
|
|
154
|
+
this.parser.clearAll();
|
|
155
|
+
uris.forEach((u) => this.refreshDecorations(vscode.Uri.parse(u)));
|
|
156
|
+
MarieSCMProvider.getInstance()?.clearAll();
|
|
157
|
+
}
|
|
158
|
+
static thoughtTimeouts = new Map();
|
|
159
|
+
static dispose() {
|
|
160
|
+
this.ghostDecoration.dispose();
|
|
161
|
+
this.thoughtDecoration.dispose();
|
|
162
|
+
this.thoughtTimeouts.forEach((t) => clearTimeout(t));
|
|
163
|
+
this.thoughtTimeouts.clear();
|
|
164
|
+
if (this.updateTimer)
|
|
165
|
+
clearTimeout(this.updateTimer);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=MarieGhostService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarieGhostService.js","sourceRoot":"","sources":["../../../src/monolith/services/MarieGhostService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EACL,gBAAgB,GAEjB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAE/D;;GAEG;AACH,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAC,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;IACvC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC;IACtB,MAAM,CAAC,YAAY,GAAG,IAAI,GAAG,EAGlC,CAAC;IAEI,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,MAAM,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EAAE,EAAE,QAAQ,EAAE,CAAC;IAC7C,CAAC;IAEO,MAAM,CAAC,eAAe,GAAG,IAAI,GAAG,EAA0B,CAAC;IAE5D,MAAM,CAAC,OAAO;QACnB,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,WAAW;YAAE,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
/**
|
|
3
|
+
* A minimal SCM-based provider to enable native gutter diff markers and scrollbar highlights.
|
|
4
|
+
* This is the "Deep Native" way to show changes without a dedicated diff editor.
|
|
5
|
+
*/
|
|
6
|
+
export class MarieSCMProvider {
|
|
7
|
+
static instance;
|
|
8
|
+
scm;
|
|
9
|
+
static MAX_DIFF_URIS = 200;
|
|
10
|
+
diffUris = new Map();
|
|
11
|
+
constructor(context) {
|
|
12
|
+
this.scm = vscode.scm.createSourceControl("marie", "Marie Proposed Edits");
|
|
13
|
+
// Define the QuickDiffProvider implementation
|
|
14
|
+
this.scm.quickDiffProvider = {
|
|
15
|
+
provideOriginalResource: (uri) => {
|
|
16
|
+
return this.diffUris.get(uri.toString());
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
context.subscriptions.push(this.scm);
|
|
20
|
+
MarieSCMProvider.instance = this;
|
|
21
|
+
}
|
|
22
|
+
static getInstance() {
|
|
23
|
+
return this.instance;
|
|
24
|
+
}
|
|
25
|
+
registerDiff(activeUri, originalBaseUri) {
|
|
26
|
+
// Prevent unbounded memory growth
|
|
27
|
+
if (this.diffUris.size >= MarieSCMProvider.MAX_DIFF_URIS) {
|
|
28
|
+
const firstKey = this.diffUris.keys().next().value;
|
|
29
|
+
if (firstKey)
|
|
30
|
+
this.diffUris.delete(firstKey);
|
|
31
|
+
}
|
|
32
|
+
this.diffUris.set(activeUri.toString(), originalBaseUri);
|
|
33
|
+
}
|
|
34
|
+
clear(activeUri) {
|
|
35
|
+
this.diffUris.delete(activeUri.toString());
|
|
36
|
+
}
|
|
37
|
+
clearAll() {
|
|
38
|
+
this.diffUris.clear();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=MarieSCMProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarieSCMProvider.js","sourceRoot":"","sources":["../../../src/monolith/services/MarieSCMProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAC,QAAQ,CAAmB;IAClC,GAAG,CAAuB;IAC1B,MAAM,CAAU,aAAa,GAAG,GAAG,CAAC;IACpC,QAAQ,GAAG,IAAI,GAAG,EAAsB,CAAC;IAEjD,YAAY,OAAgC;QAC1C,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,OAAO,EAAE,sBAAsB,CAAC,CAAC;QAE3E,8CAA8C;QAC9C,IAAI,CAAC,GAAG,CAAC,iBAAiB,GAAG;YAC3B,uBAAuB,EAAE,CAAC,GAAe,EAAE,EAAE;gBAC3C,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC3C,CAAC;SACF,CAAC;QAEF,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrC,gBAAgB,CAAC,QAAQ,GAAG,IAAI,CAAC;IACnC,CAAC;IAEM,MAAM,CAAC,WAAW;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAEM,YAAY,CAAC,SAAqB,EAAE,eAA2B;QACpE,kCAAkC;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,gBAAgB,CAAC,aAAa,EAAE,CAAC;YACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;YACnD,IAAI,QAAQ;gBAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,eAAe,CAAC,CAAC;IAC3D,CAAC;IAEM,KAAK,CAAC,SAAqB;QAChC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7C,CAAC;IAEM,QAAQ;QACb,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@noorm/marie-cli",
|
|
3
|
+
"displayName": "Marie",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Marie: A high-fidelity, autonomous AI coding architecture designed for Technical Sovereignty.",
|
|
6
|
+
"publisher": "cardsorting",
|
|
7
|
+
"author": "CardSorting <https://github.com/CardSorting>",
|
|
8
|
+
"homepage": "https://github.com/CardSorting/Marie-Coder-New-the-vatican",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/CardSorting/Marie-Coder-New-the-vatican/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/CardSorting/Marie-Coder-New-the-vatican.git"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/cli-new",
|
|
18
|
+
"dist/monolith",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE.md",
|
|
21
|
+
"JOY_ZONING.md"
|
|
22
|
+
],
|
|
23
|
+
"main": "dist/extension.cjs",
|
|
24
|
+
"engines": {
|
|
25
|
+
"vscode": "^1.105.0",
|
|
26
|
+
"node": ">=18.0.0"
|
|
27
|
+
},
|
|
28
|
+
"categories": [
|
|
29
|
+
"Other"
|
|
30
|
+
],
|
|
31
|
+
"activationEvents": [],
|
|
32
|
+
"contributes": {
|
|
33
|
+
"configuration": {
|
|
34
|
+
"title": "Marie",
|
|
35
|
+
"properties": {
|
|
36
|
+
"marie.apiKey": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"default": "",
|
|
39
|
+
"description": "Anthropic API key used by Marie."
|
|
40
|
+
},
|
|
41
|
+
"marie.aiProvider": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"default": "anthropic",
|
|
44
|
+
"enum": [
|
|
45
|
+
"anthropic",
|
|
46
|
+
"openrouter",
|
|
47
|
+
"cerebras"
|
|
48
|
+
],
|
|
49
|
+
"description": "AI provider used by Marie."
|
|
50
|
+
},
|
|
51
|
+
"marie.model": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"default": "claude-3-5-sonnet-20241022",
|
|
54
|
+
"description": "Default model ID for the selected provider."
|
|
55
|
+
},
|
|
56
|
+
"marie.openrouterApiKey": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"default": "",
|
|
59
|
+
"description": "OpenRouter API key used by Marie."
|
|
60
|
+
},
|
|
61
|
+
"marie.cerebrasApiKey": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"default": "",
|
|
64
|
+
"description": "Cerebras API key used by Marie."
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"commands": [
|
|
69
|
+
{
|
|
70
|
+
"command": "marie.start",
|
|
71
|
+
"title": "Marie: Start"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"viewsContainers": {
|
|
75
|
+
"activitybar": [
|
|
76
|
+
{
|
|
77
|
+
"id": "marieSidebar",
|
|
78
|
+
"title": "Marie",
|
|
79
|
+
"icon": "assets/icon.svg"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"views": {
|
|
84
|
+
"marieSidebar": [
|
|
85
|
+
{
|
|
86
|
+
"id": "marieView",
|
|
87
|
+
"name": "Marie",
|
|
88
|
+
"type": "webview",
|
|
89
|
+
"icon": "assets/icon.svg"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"bin": {
|
|
95
|
+
"marie": "./dist/cli-new/index.js"
|
|
96
|
+
},
|
|
97
|
+
"scripts": {
|
|
98
|
+
"build": "npm run build:extension && npm run build:cli",
|
|
99
|
+
"build:extension": "node esbuild.mjs --production",
|
|
100
|
+
"build:cli": "tsc && chmod +x dist/cli-new/index.js",
|
|
101
|
+
"package:extension": "npx @vscode/vsce package",
|
|
102
|
+
"dev": "node --loader ts-node/esm src/cli-new/index.ts",
|
|
103
|
+
"start": "node dist/cli-new/index.js",
|
|
104
|
+
"test": "npm run test:cli",
|
|
105
|
+
"test:cli": "node --loader ts-node/esm tests/cli/run_all_tests.ts",
|
|
106
|
+
"test:cli:storage": "node --loader ts-node/esm tests/cli/test_storage.ts",
|
|
107
|
+
"test:cli:marie": "node --loader ts-node/esm tests/cli/test_marie_cli.ts",
|
|
108
|
+
"test:cli:tools": "node --loader ts-node/esm tests/cli/test_tool_definitions.ts",
|
|
109
|
+
"test:cli:joy": "node --loader ts-node/esm tests/cli/test_joy_services.ts",
|
|
110
|
+
"test:extension": "node tests/extension/runTests.js",
|
|
111
|
+
"test:extension:mock": "node --loader ts-node/esm node_modules/mocha/bin/mocha --ui tdd tests/extension/suite/*.test.ts tests/extension/suite/*.test.js",
|
|
112
|
+
"lint": "eslint src tests",
|
|
113
|
+
"lint:fix": "eslint src tests --fix"
|
|
114
|
+
},
|
|
115
|
+
"keywords": [
|
|
116
|
+
"ai",
|
|
117
|
+
"cli",
|
|
118
|
+
"coding",
|
|
119
|
+
"agent"
|
|
120
|
+
],
|
|
121
|
+
"license": "Apache-2.0",
|
|
122
|
+
"type": "module",
|
|
123
|
+
"dependencies": {
|
|
124
|
+
"@anthropic-ai/sdk": "^0.73.0",
|
|
125
|
+
"@cerebras/cerebras_cloud_sdk": "^1.64.1",
|
|
126
|
+
"chalk": "^5.3.0",
|
|
127
|
+
"ink": "^5.0.0",
|
|
128
|
+
"ink-select-input": "^6.0.0",
|
|
129
|
+
"ink-spinner": "^5.0.0",
|
|
130
|
+
"ink-text-input": "^6.0.0",
|
|
131
|
+
"marked": "^12.0.0",
|
|
132
|
+
"marked-terminal": "^7.0.0",
|
|
133
|
+
"react": "^18.3.0",
|
|
134
|
+
"react-dom": "^18.3.0",
|
|
135
|
+
"shiki": "^1.0.0",
|
|
136
|
+
"simple-git": "^3.22.0",
|
|
137
|
+
"strip-ansi": "^7.1.0",
|
|
138
|
+
"wrap-ansi": "^9.0.0",
|
|
139
|
+
"zod": "^3.22.0"
|
|
140
|
+
},
|
|
141
|
+
"devDependencies": {
|
|
142
|
+
"@eslint/js": "^9.39.2",
|
|
143
|
+
"@types/node": "^20.0.0",
|
|
144
|
+
"@types/react": "^18.3.0",
|
|
145
|
+
"@types/react-dom": "^18.3.0",
|
|
146
|
+
"@types/vscode": "^1.105.0",
|
|
147
|
+
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
|
148
|
+
"@typescript-eslint/parser": "^8.55.0",
|
|
149
|
+
"@vscode/test-electron": "^2.5.1",
|
|
150
|
+
"esbuild": "^0.25.0",
|
|
151
|
+
"eslint": "^9.39.2",
|
|
152
|
+
"eslint-config-prettier": "^10.1.8",
|
|
153
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
154
|
+
"eslint-plugin-react": "^7.37.5",
|
|
155
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
156
|
+
"glob": "^10.3.10",
|
|
157
|
+
"globals": "^17.3.0",
|
|
158
|
+
"mocha": "^10.4.0",
|
|
159
|
+
"prettier": "^3.8.1",
|
|
160
|
+
"ts-node": "^10.9.0",
|
|
161
|
+
"typescript": "^5.3.0",
|
|
162
|
+
"typescript-eslint": "^8.55.0",
|
|
163
|
+
"vscode": "file:vscode-shim"
|
|
164
|
+
},
|
|
165
|
+
"publishConfig": {
|
|
166
|
+
"access": "public"
|
|
167
|
+
}
|
|
168
|
+
}
|