@noorm/marie-cli 0.1.17 → 0.1.18
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/dist/cli-new/components/AgenticSpinner.js +28 -0
- package/dist/cli-new/components/AgenticSpinner.js.map +1 -0
- package/dist/cli-new/components/App.js +1 -1
- package/dist/cli-new/components/App.js.map +1 -1
- package/dist/cli-new/components/ApprovalDialog.js +1 -1
- package/dist/cli-new/components/ApprovalDialog.js.map +1 -1
- package/dist/cli-new/components/Banner.js +15 -5
- package/dist/cli-new/components/Banner.js.map +1 -1
- package/dist/cli-new/components/Header.js +2 -2
- package/dist/cli-new/components/Header.js.map +1 -1
- package/dist/cli-new/components/InputArea.js +29 -23
- package/dist/cli-new/components/InputArea.js.map +1 -1
- package/dist/cli-new/components/MessageBubble.js +5 -4
- package/dist/cli-new/components/MessageBubble.js.map +1 -1
- package/dist/cli-new/components/SessionSwitcher.js +3 -3
- package/dist/cli-new/components/SessionSwitcher.js.map +1 -1
- package/dist/cli-new/components/SetupWizard.js +11 -11
- package/dist/cli-new/components/SetupWizard.js.map +1 -1
- package/dist/cli-new/components/ToolCallDisplay.js +1 -1
- package/dist/cli-new/components/ToolCallDisplay.js.map +1 -1
- package/dist/cli-new/hooks/useUpdateCheck.js +1 -1
- package/dist/cli-new/hooks/useUpdateCheck.js.map +1 -1
- package/dist/cli-new/styles/theme.js +17 -17
- package/dist/cli-new/styles/theme.js.map +1 -1
- package/dist/extension.cjs +861 -341
- package/dist/extension.js +2 -1
- package/dist/extension.js.map +1 -1
- package/dist/monolith/adapters/CliMarieAdapter.js +7 -7
- package/dist/monolith/adapters/CliMarieAdapter.js.map +1 -1
- package/dist/monolith/adapters/VscodeMarieAdapter.js +9 -9
- package/dist/monolith/adapters/VscodeMarieAdapter.js.map +1 -1
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js +5 -2
- package/dist/monolith/cli/MarieToolDefinitionsCLI.js.map +1 -1
- package/dist/monolith/cli/index.js +6 -0
- package/dist/monolith/cli/index.js.map +1 -1
- package/dist/monolith/cli/storage.js +79 -60
- package/dist/monolith/cli/storage.js.map +1 -1
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js +52 -37
- package/dist/monolith/infrastructure/ai/context/ContextArchiveService.js.map +1 -1
- package/dist/monolith/infrastructure/ai/context/ContextManager.js +35 -2
- package/dist/monolith/infrastructure/ai/context/ContextManager.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js +513 -3
- package/dist/monolith/infrastructure/ai/core/MarieEngine.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js +25 -5
- package/dist/monolith/infrastructure/ai/core/MarieLockManager.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js +29 -0
- package/dist/monolith/infrastructure/ai/core/MarieProgressTracker.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MariePulseService.js +41 -7
- package/dist/monolith/infrastructure/ai/core/MariePulseService.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js +97 -8
- package/dist/monolith/infrastructure/ai/core/MarieSanitizer.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieSemaphore.js +47 -4
- package/dist/monolith/infrastructure/ai/core/MarieSemaphore.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieSession.js +95 -15
- package/dist/monolith/infrastructure/ai/core/MarieSession.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js +21 -0
- package/dist/monolith/infrastructure/ai/core/MarieStabilityMonitor.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieToolMender.js +12 -0
- package/dist/monolith/infrastructure/ai/core/MarieToolMender.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js +155 -14
- package/dist/monolith/infrastructure/ai/core/MarieToolProcessor.js.map +1 -1
- package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js +23 -12
- package/dist/monolith/infrastructure/ai/core/ReasoningBudget.js.map +1 -1
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js +6 -0
- package/dist/monolith/infrastructure/ai/providers/AnthropicProvider.js.map +1 -1
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js +6 -0
- package/dist/monolith/infrastructure/ai/providers/CerebrasProvider.js.map +1 -1
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js +22 -0
- package/dist/monolith/infrastructure/ai/providers/OpenRouterProvider.js.map +1 -1
- package/dist/monolith/infrastructure/config/ConfigService.js +145 -1
- package/dist/monolith/infrastructure/config/ConfigService.js.map +1 -1
- package/dist/monolith/infrastructure/joy/CognitiveRituals.js +169 -0
- package/dist/monolith/infrastructure/joy/CognitiveRituals.js.map +1 -0
- package/dist/monolith/infrastructure/joy/JoyTools.js +15 -2
- package/dist/monolith/infrastructure/joy/JoyTools.js.map +1 -1
- package/dist/monolith/infrastructure/persistence/NoormmeAutonomics.js +118 -0
- package/dist/monolith/infrastructure/persistence/NoormmeAutonomics.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeEngine.js +78 -0
- package/dist/monolith/infrastructure/persistence/NoormmeEngine.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSchema.js +150 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSchema.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js +81 -0
- package/dist/monolith/infrastructure/persistence/NoormmeSeeder.js.map +1 -0
- package/dist/monolith/infrastructure/persistence/NoormmeTools.js +324 -0
- package/dist/monolith/infrastructure/persistence/NoormmeTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js +29 -1577
- package/dist/monolith/infrastructure/tools/MarieToolDefinitions.js.map +1 -1
- package/dist/monolith/infrastructure/tools/definitions/AnalysisTools.js +346 -0
- package/dist/monolith/infrastructure/tools/definitions/AnalysisTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js +289 -0
- package/dist/monolith/infrastructure/tools/definitions/AutomationTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/ContextTools.js +43 -0
- package/dist/monolith/infrastructure/tools/definitions/ContextTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/CoreTools.js +41 -0
- package/dist/monolith/infrastructure/tools/definitions/CoreTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js +185 -0
- package/dist/monolith/infrastructure/tools/definitions/DiagnosticTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js +348 -0
- package/dist/monolith/infrastructure/tools/definitions/NavigationTools.js.map +1 -0
- package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js +297 -0
- package/dist/monolith/infrastructure/tools/definitions/PlanningTools.js.map +1 -0
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js +1 -2
- package/dist/monolith/plumbing/analysis/MarieSentinelService.js.map +1 -1
- package/dist/monolith/plumbing/terminal/TerminalService.js +5 -0
- package/dist/monolith/plumbing/terminal/TerminalService.js.map +1 -1
- package/dist/monolith/plumbing/utils/EnvironmentUtils.js +1 -1
- package/dist/monolith/plumbing/utils/EnvironmentUtils.js.map +1 -1
- package/dist/monolith/plumbing/utils/MutexUtils.js.map +1 -1
- package/dist/monolith/runtime/MarieRuntime.js +86 -4
- package/dist/monolith/runtime/MarieRuntime.js.map +1 -1
- package/dist/monolith/runtime/RuntimeAdapterBase.js.map +1 -1
- package/dist/monolith/services/JoyService.js +1 -1
- package/dist/monolith/services/JoyService.js.map +1 -1
- package/dist/monolith/services/MarieGhostService.js +12 -0
- package/dist/monolith/services/MarieGhostService.js.map +1 -1
- package/dist/monolith/services/UpdateService.js +6 -6
- package/dist/monolith/services/UpdateService.js.map +1 -1
- package/dist/webview-ui/main.js +23 -23
- package/package.json +2 -1
- package/test-mind-p6.sqlite +0 -0
- package/test-mind-p6.sqlite-shm +0 -0
- package/test-mind-p6.sqlite-wal +0 -0
- package/dist/monolith/domain/joy/JoyTools.js +0 -535
- package/dist/monolith/domain/joy/JoyTools.js.map +0 -1
- package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js +0 -207
- package/dist/monolith/infrastructure/ai/agents/MarieYOLO.js.map +0 -1
- package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js +0 -2
- package/dist/monolith/infrastructure/ai/core/MarieYOLOTypes.js.map +0 -1
- package/dist/test_agent_stream_control_plane.js +0 -170
- package/dist/test_agent_stream_control_plane.js.map +0 -1
- package/dist/test_strategy_integration.js +0 -114
- package/dist/test_strategy_integration.js.map +0 -1
- package/dist/test_streaming_fragility.js +0 -191
- package/dist/test_streaming_fragility.js.map +0 -1
- package/dist/webview-ui/App.js +0 -16
- package/dist/webview-ui/App.js.map +0 -1
- package/dist/webview-ui/Providers.js +0 -6
- package/dist/webview-ui/Providers.js.map +0 -1
- package/dist/webview-ui/components/ApprovalPanel.js +0 -8
- package/dist/webview-ui/components/ApprovalPanel.js.map +0 -1
- package/dist/webview-ui/components/ChatPanel.js +0 -19
- package/dist/webview-ui/components/ChatPanel.js.map +0 -1
- package/dist/webview-ui/components/Composer.js +0 -19
- package/dist/webview-ui/components/Composer.js.map +0 -1
- package/dist/webview-ui/components/HeaderBar.js +0 -5
- package/dist/webview-ui/components/HeaderBar.js.map +0 -1
- package/dist/webview-ui/components/SessionList.js +0 -14
- package/dist/webview-ui/components/SessionList.js.map +0 -1
- package/dist/webview-ui/context/WebviewStateContext.js +0 -146
- package/dist/webview-ui/context/WebviewStateContext.js.map +0 -1
- package/dist/webview-ui/main.js.map +0 -1
- package/dist/webview-ui/types.js +0 -2
- package/dist/webview-ui/types.js.map +0 -1
- package/dist/webview-ui/vscode.js +0 -4
- package/dist/webview-ui/vscode.js.map +0 -1
- package/marie-coder-0.1.16.vsix +0 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
import { getStringArg } from "../ToolUtils.js";
|
|
3
|
+
import { SymbolService } from "../../../plumbing/lsp/SymbolService.js";
|
|
4
|
+
import { DependencyService } from "../../../plumbing/analysis/DependencyService.js";
|
|
5
|
+
import { withTimeout } from "../../../plumbing/utils/TimeoutUtils.js";
|
|
6
|
+
import { writeFile } from "../../../plumbing/filesystem/FileService.js";
|
|
7
|
+
import { foldCode } from "../../joy/JoyTools.js";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
import * as fs from "fs/promises";
|
|
10
|
+
/**
|
|
11
|
+
* NavigationTools - Tools for navigating the codebase and performing semantic transformations.
|
|
12
|
+
*/
|
|
13
|
+
export function registerNavigationTools(registry) {
|
|
14
|
+
registry.register({
|
|
15
|
+
name: "get_symbol_definition",
|
|
16
|
+
description: "Find the definition of a symbol at the specified position. Helps navigate complex codebases.",
|
|
17
|
+
input_schema: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {
|
|
20
|
+
path: { type: "string", description: "The absolute path to the file" },
|
|
21
|
+
line: { type: "number", description: "The line number (1-indexed)" },
|
|
22
|
+
character: {
|
|
23
|
+
type: "number",
|
|
24
|
+
description: "The character position (1-indexed)",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
required: ["path", "line", "character"],
|
|
28
|
+
},
|
|
29
|
+
execute: async (args) => {
|
|
30
|
+
const p = getStringArg(args, "path");
|
|
31
|
+
const line = args.line - 1;
|
|
32
|
+
const char = args.character - 1;
|
|
33
|
+
const uri = vscode.Uri.file(p);
|
|
34
|
+
const pos = new vscode.Position(line, char);
|
|
35
|
+
return await SymbolService.getDefinitions(uri, pos);
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
registry.register({
|
|
39
|
+
name: "get_file_dependencies",
|
|
40
|
+
description: "Map the structural network of a file (imports/exports) to understand its dependencies and role.",
|
|
41
|
+
input_schema: {
|
|
42
|
+
type: "object",
|
|
43
|
+
properties: {
|
|
44
|
+
path: { type: "string", description: "The absolute path to the file" },
|
|
45
|
+
},
|
|
46
|
+
required: ["path"],
|
|
47
|
+
},
|
|
48
|
+
execute: async (args) => {
|
|
49
|
+
const p = getStringArg(args, "path");
|
|
50
|
+
return await DependencyService.getFileNetwork(p);
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
registry.register({
|
|
54
|
+
name: "find_symbol_references",
|
|
55
|
+
description: "Find all references/usages of a symbol across the workspace.",
|
|
56
|
+
input_schema: {
|
|
57
|
+
type: "object",
|
|
58
|
+
properties: {
|
|
59
|
+
path: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "The absolute path to the file containing the symbol",
|
|
62
|
+
},
|
|
63
|
+
line: { type: "number", description: "The line number (1-indexed)" },
|
|
64
|
+
character: {
|
|
65
|
+
type: "number",
|
|
66
|
+
description: "The character position (1-indexed)",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
required: ["path", "line", "character"],
|
|
70
|
+
},
|
|
71
|
+
execute: async (args) => {
|
|
72
|
+
const p = getStringArg(args, "path");
|
|
73
|
+
const line = args.line - 1;
|
|
74
|
+
const char = args.character - 1;
|
|
75
|
+
const uri = vscode.Uri.file(p);
|
|
76
|
+
const pos = new vscode.Position(line, char);
|
|
77
|
+
const refs = await vscode.commands.executeCommand("vscode.executeReferenceProvider", uri, pos);
|
|
78
|
+
if (!refs || refs.length === 0)
|
|
79
|
+
return "No references found.";
|
|
80
|
+
let result = `Found ${refs.length} reference(s):\n`;
|
|
81
|
+
refs.slice(0, 50).forEach((r) => {
|
|
82
|
+
result += `- ${r.uri.fsPath} [L${r.range.start.line + 1}:C${r.range.start.character + 1}]\n`;
|
|
83
|
+
});
|
|
84
|
+
if (refs.length > 50)
|
|
85
|
+
result += `\n... AND ${refs.length - 50} MORE.`;
|
|
86
|
+
return result;
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
registry.register({
|
|
90
|
+
name: "list_workspace_symbols",
|
|
91
|
+
description: "Search for symbols (classes, functions, etc.) across the entire workspace.",
|
|
92
|
+
input_schema: {
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: {
|
|
95
|
+
query: {
|
|
96
|
+
type: "string",
|
|
97
|
+
description: "The symbol name or partial name to search for",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
required: ["query"],
|
|
101
|
+
},
|
|
102
|
+
execute: async (args) => {
|
|
103
|
+
const query = getStringArg(args, "query");
|
|
104
|
+
const symbols = await vscode.commands.executeCommand("vscode.executeWorkspaceSymbolProvider", query);
|
|
105
|
+
if (!symbols || symbols.length === 0)
|
|
106
|
+
return "No symbols found matching the query.";
|
|
107
|
+
let result = `Found ${symbols.length} symbol(s) matching \`${query}\`:\n`;
|
|
108
|
+
symbols.slice(0, 50).forEach((s) => {
|
|
109
|
+
const kind = vscode.SymbolKind[s.kind];
|
|
110
|
+
result += `- [${kind}] \`${s.name}\` in \`${s.location.uri.fsPath}\`\n`;
|
|
111
|
+
});
|
|
112
|
+
if (symbols.length > 50)
|
|
113
|
+
result += `\n... AND ${symbols.length - 50} MORE.`;
|
|
114
|
+
return result;
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
registry.register({
|
|
118
|
+
name: "execute_semantic_rename",
|
|
119
|
+
description: "Perform a workspace-wide, compiler-safe rename of a symbol using the LSP.",
|
|
120
|
+
isDestructive: true,
|
|
121
|
+
input_schema: {
|
|
122
|
+
type: "object",
|
|
123
|
+
properties: {
|
|
124
|
+
path: {
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "The absolute path to the file containing the symbol",
|
|
127
|
+
},
|
|
128
|
+
line: {
|
|
129
|
+
type: "integer",
|
|
130
|
+
description: "The line number of the symbol (1-indexed)",
|
|
131
|
+
},
|
|
132
|
+
column: {
|
|
133
|
+
type: "integer",
|
|
134
|
+
description: "The column number of the symbol (1-indexed)",
|
|
135
|
+
},
|
|
136
|
+
newName: { type: "string", description: "The new name for the symbol" },
|
|
137
|
+
},
|
|
138
|
+
required: ["path", "line", "column", "newName"],
|
|
139
|
+
},
|
|
140
|
+
execute: async (args) => {
|
|
141
|
+
const p = getStringArg(args, "path");
|
|
142
|
+
const line = args.line;
|
|
143
|
+
const col = args.column;
|
|
144
|
+
const newName = getStringArg(args, "newName");
|
|
145
|
+
const uri = vscode.Uri.file(p);
|
|
146
|
+
const pos = new vscode.Position(line - 1, col - 1);
|
|
147
|
+
try {
|
|
148
|
+
const edit = await vscode.commands.executeCommand("vscode.executeRenameProvider", uri, pos, newName);
|
|
149
|
+
if (!edit)
|
|
150
|
+
return `LSP could not find a renameable symbol at ${p}:${line}:${col}.`;
|
|
151
|
+
const success = await vscode.workspace.applyEdit(edit);
|
|
152
|
+
if (!success)
|
|
153
|
+
return "Failed to apply workspace-wide semantic rename.";
|
|
154
|
+
return `Successfully renamed symbol to \`${newName}\` across the entire workspace. ✨`;
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
return `Semantic rename failed: ${error}`;
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
registry.register({
|
|
162
|
+
name: "execute_semantic_move",
|
|
163
|
+
description: "Move a symbol (function/class) to a new file and attempt to update imports throughout the workspace.",
|
|
164
|
+
isDestructive: true,
|
|
165
|
+
input_schema: {
|
|
166
|
+
type: "object",
|
|
167
|
+
properties: {
|
|
168
|
+
sourcePath: {
|
|
169
|
+
type: "string",
|
|
170
|
+
description: "Absolute path to source file",
|
|
171
|
+
},
|
|
172
|
+
targetPath: {
|
|
173
|
+
type: "string",
|
|
174
|
+
description: "Absolute path to target file",
|
|
175
|
+
},
|
|
176
|
+
symbolName: {
|
|
177
|
+
type: "string",
|
|
178
|
+
description: "Name of the symbol to move",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
required: ["sourcePath", "targetPath", "symbolName"],
|
|
182
|
+
},
|
|
183
|
+
execute: async (args, onProgress, signal) => {
|
|
184
|
+
const src = getStringArg(args, "sourcePath");
|
|
185
|
+
const dest = getStringArg(args, "targetPath");
|
|
186
|
+
const sym = getStringArg(args, "symbolName");
|
|
187
|
+
try {
|
|
188
|
+
const symbols = await withTimeout(vscode.commands.executeCommand("vscode.executeDocumentSymbolProvider", vscode.Uri.file(src)), 5000, "LSP Document Symbol Provider");
|
|
189
|
+
const targetSym = symbols?.find((s) => s.name === sym);
|
|
190
|
+
if (!targetSym)
|
|
191
|
+
return `Could not find symbol \`${sym}\` in source file.`;
|
|
192
|
+
const content = await fs.readFile(src, "utf-8");
|
|
193
|
+
const lines = content.split("\n");
|
|
194
|
+
const symContent = lines
|
|
195
|
+
.slice(targetSym.location.range.start.line, targetSym.location.range.end.line + 1)
|
|
196
|
+
.join("\n");
|
|
197
|
+
const importLines = lines.filter((l) => l.trim().startsWith("import "));
|
|
198
|
+
const neededImports = importLines.filter((l) => {
|
|
199
|
+
const match = l.match(/\{([^}]+)\}/);
|
|
200
|
+
if (match) {
|
|
201
|
+
const idents = match[1].split(",").map((i) => i.trim());
|
|
202
|
+
return idents.some((i) => symContent.includes(i));
|
|
203
|
+
}
|
|
204
|
+
return false;
|
|
205
|
+
});
|
|
206
|
+
const newSrcContent = [
|
|
207
|
+
...lines.slice(0, targetSym.location.range.start.line),
|
|
208
|
+
...lines.slice(targetSym.location.range.end.line + 1),
|
|
209
|
+
].join("\n");
|
|
210
|
+
await writeFile(src, newSrcContent, signal);
|
|
211
|
+
let destContent = "";
|
|
212
|
+
try {
|
|
213
|
+
destContent = await fs.readFile(dest, "utf-8");
|
|
214
|
+
}
|
|
215
|
+
catch (e) {
|
|
216
|
+
destContent = `// Created for moved symbol ${sym}\n`;
|
|
217
|
+
}
|
|
218
|
+
const finalDestContent = neededImports.join("\n") + "\n\n" + destContent + "\n\n" + symContent;
|
|
219
|
+
await writeFile(dest, finalDestContent, signal);
|
|
220
|
+
const refs = await withTimeout(vscode.commands.executeCommand("vscode.executeReferenceProvider", vscode.Uri.file(src), targetSym.location.range.start), 5000, "LSP Reference Provider");
|
|
221
|
+
const externalRefs = refs.filter((r) => r.uri.fsPath !== src && r.uri.fsPath !== dest);
|
|
222
|
+
const updatedFiles = [];
|
|
223
|
+
if (externalRefs.length > 0) {
|
|
224
|
+
const refFiles = Array.from(new Set(externalRefs.map((r) => r.uri.fsPath)));
|
|
225
|
+
for (const refFile of refFiles) {
|
|
226
|
+
const refContent = await fs.readFile(refFile, "utf-8");
|
|
227
|
+
const srcRel = path
|
|
228
|
+
.relative(path.dirname(refFile), src)
|
|
229
|
+
.replace(/\.[^.]+$/, "")
|
|
230
|
+
.replace(/\\/g, "/");
|
|
231
|
+
const destRel = path
|
|
232
|
+
.relative(path.dirname(refFile), dest)
|
|
233
|
+
.replace(/\.[^.]+$/, "")
|
|
234
|
+
.replace(/\\/g, "/");
|
|
235
|
+
const oldImportPath = srcRel.startsWith(".")
|
|
236
|
+
? srcRel
|
|
237
|
+
: `./${srcRel}`;
|
|
238
|
+
const newImportPath = destRel.startsWith(".")
|
|
239
|
+
? destRel
|
|
240
|
+
: `./${destRel}`;
|
|
241
|
+
if (refContent.includes(oldImportPath)) {
|
|
242
|
+
const newRefContent = refContent.replace(new RegExp(`from\\s+['"]${oldImportPath}['"]`, "g"), `from '${newImportPath}'`);
|
|
243
|
+
if (newRefContent !== refContent) {
|
|
244
|
+
await fs.writeFile(refFile, newRefContent);
|
|
245
|
+
updatedFiles.push(path.basename(refFile));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
await foldCode(src);
|
|
251
|
+
await foldCode(dest);
|
|
252
|
+
return (`Successfully moved \`${sym}\` to \`${dest.split("/").pop()}\`. 🗡️\n\n` +
|
|
253
|
+
`**Methodology Complete**: Required imports were identified and copied to the destination.\n` +
|
|
254
|
+
(updatedFiles.length > 0
|
|
255
|
+
? `**Downstream Migration**: Automatically updated imports in ${updatedFiles.length} file(s): ${updatedFiles.join(", ")}. ✨`
|
|
256
|
+
: `**Mirror Polishing**: No external downstream imports required migration.`) +
|
|
257
|
+
`\n\n**Autonomy Note**: Post-execution tidying completed for both source and destination. 🌸`);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
return `Semantic move failed: ${error.message}`;
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
registry.register({
|
|
265
|
+
name: "trace_data_flow",
|
|
266
|
+
description: "Analyze how a specific type or interface is used across multiple layers.",
|
|
267
|
+
input_schema: {
|
|
268
|
+
type: "object",
|
|
269
|
+
properties: {
|
|
270
|
+
typeName: {
|
|
271
|
+
type: "string",
|
|
272
|
+
description: "The name of the type/interface to trace",
|
|
273
|
+
},
|
|
274
|
+
filePath: {
|
|
275
|
+
type: "string",
|
|
276
|
+
description: "Path to the file where the type is defined",
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
required: ["typeName", "filePath"],
|
|
280
|
+
},
|
|
281
|
+
execute: async (args) => {
|
|
282
|
+
const type = getStringArg(args, "typeName");
|
|
283
|
+
const p = getStringArg(args, "filePath");
|
|
284
|
+
const uri = vscode.Uri.file(p);
|
|
285
|
+
const symbols = await vscode.commands.executeCommand("vscode.executeDocumentSymbolProvider", uri);
|
|
286
|
+
const target = symbols?.find((s) => s.name === type);
|
|
287
|
+
const pos = target?.location.range.start || new vscode.Position(0, 0);
|
|
288
|
+
const refs = await vscode.commands.executeCommand("vscode.executeReferenceProvider", uri, pos);
|
|
289
|
+
if (!refs || refs.length === 0)
|
|
290
|
+
return `Type \`${type}\` appears to be isolated. ✨`;
|
|
291
|
+
const uniqueFiles = Array.from(new Set(refs.map((r) => r.uri.fsPath)));
|
|
292
|
+
let result = `# 🔮 Data Flow Trace: \`${type}\`\n\n`;
|
|
293
|
+
result += `Found usages in **${uniqueFiles.length}** files.\n\n`;
|
|
294
|
+
const layers = uniqueFiles.map((f) => {
|
|
295
|
+
if (f.includes("/infrastructure/"))
|
|
296
|
+
return "Infrastructure 🏛️";
|
|
297
|
+
if (f.includes("/domain/"))
|
|
298
|
+
return "Domain 🧠";
|
|
299
|
+
if (f.includes("/plumbing/"))
|
|
300
|
+
return "Plumbing 🔧";
|
|
301
|
+
return "UI/External 🎨";
|
|
302
|
+
});
|
|
303
|
+
const layerCounts = layers.reduce((acc, l) => {
|
|
304
|
+
acc[l] = (acc[l] || 0) + 1;
|
|
305
|
+
return acc;
|
|
306
|
+
}, {});
|
|
307
|
+
result += `## Layer Distribution\n`;
|
|
308
|
+
Object.entries(layerCounts).forEach(([layer, count]) => {
|
|
309
|
+
result += `- **${layer}**: ${count} files\n`;
|
|
310
|
+
});
|
|
311
|
+
if (layerCounts["Domain 🧠"] && layerCounts["Infrastructure 🏛️"]) {
|
|
312
|
+
result += `\n> [!NOTE]\n> This type crosses the Domain/Infrastructure boundary. Ensure strict mapping is in place to maintain Joyful purity. ✨`;
|
|
313
|
+
}
|
|
314
|
+
return result;
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
registry.register({
|
|
318
|
+
name: "find_files",
|
|
319
|
+
description: "Search for files across the workspace using a glob pattern (e.g., '**/*.test.ts').",
|
|
320
|
+
input_schema: {
|
|
321
|
+
type: "object",
|
|
322
|
+
properties: {
|
|
323
|
+
pattern: {
|
|
324
|
+
type: "string",
|
|
325
|
+
description: "The glob pattern to search for",
|
|
326
|
+
},
|
|
327
|
+
exclude: {
|
|
328
|
+
type: "string",
|
|
329
|
+
description: "Optional glob pattern for files to exclude",
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
required: ["pattern"],
|
|
333
|
+
},
|
|
334
|
+
execute: async (args) => {
|
|
335
|
+
const pattern = getStringArg(args, "pattern");
|
|
336
|
+
const exclude = args.exclude;
|
|
337
|
+
const files = await vscode.workspace.findFiles(pattern, exclude);
|
|
338
|
+
if (files.length === 0)
|
|
339
|
+
return "No files found matching the pattern.";
|
|
340
|
+
let result = `Found ${files.length} file(s) matching \`${pattern}\`:\n`;
|
|
341
|
+
files.slice(0, 50).forEach((f) => (result += `- \`${f.fsPath}\`\n`));
|
|
342
|
+
if (files.length > 50)
|
|
343
|
+
result += `\n... AND ${files.length - 50} MORE.`;
|
|
344
|
+
return result;
|
|
345
|
+
},
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=NavigationTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationTools.js","sourceRoot":"","sources":["../../../../../src/monolith/infrastructure/tools/definitions/NavigationTools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,QAAsB;IAC5D,QAAQ,CAAC,QAAQ,CAAC;QAChB,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,8FAA8F;QAChG,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+BAA+B,EAAE;gBACtE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;gBACpE,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,oCAAoC;iBAClD;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC;SACxC;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,CAAC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CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,OAA6B,CAAC;YACnD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEjE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,sCAAsC,CAAC;YAEtE,IAAI,MAAM,GAAG,SAAS,KAAK,CAAC,MAAM,uBAAuB,OAAO,OAAO,CAAC;YACxE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC;YACrE,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE;gBAAE,MAAM,IAAI,aAAa,KAAK,CAAC,MAAM,GAAG,EAAE,QAAQ,CAAC;YACxE,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { getStringArg, getArrayArg } from "../ToolUtils.js";
|
|
2
|
+
import * as path from "path";
|
|
3
|
+
import * as fs from "fs/promises";
|
|
4
|
+
import { getWorkspaceRoot } from "../../../plumbing/utils/EnvironmentUtils.js";
|
|
5
|
+
/**
|
|
6
|
+
* PlanningTools - Tools for strategic planning, roadmapping, and pass management.
|
|
7
|
+
*/
|
|
8
|
+
export function registerPlanningTools(registry) {
|
|
9
|
+
registry.register({
|
|
10
|
+
name: "perform_strategic_planning",
|
|
11
|
+
description: "A mandatory planning ritual. Call this at the start of any complex task.",
|
|
12
|
+
input_schema: {
|
|
13
|
+
type: "object",
|
|
14
|
+
properties: {
|
|
15
|
+
intent: { type: "string" },
|
|
16
|
+
joyZone: {
|
|
17
|
+
type: "string",
|
|
18
|
+
enum: ["joyful", "infrastructure", "plumbing"],
|
|
19
|
+
},
|
|
20
|
+
projectName: { type: "string" },
|
|
21
|
+
lifecycleStage: {
|
|
22
|
+
type: "string",
|
|
23
|
+
enum: ["sprout", "bloom", "compost"],
|
|
24
|
+
},
|
|
25
|
+
objectives: {
|
|
26
|
+
type: "array",
|
|
27
|
+
items: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {
|
|
30
|
+
id: { type: "string" },
|
|
31
|
+
label: { type: "string" },
|
|
32
|
+
status: {
|
|
33
|
+
type: "string",
|
|
34
|
+
enum: ["pending", "in_progress", "completed", "blocked"],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
required: ["id", "label", "status"],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
ritualChecked: { type: "boolean" },
|
|
41
|
+
gratitudeMoment: { type: "string" },
|
|
42
|
+
dependencyRisk: { type: "string" },
|
|
43
|
+
totalPasses: {
|
|
44
|
+
type: "number",
|
|
45
|
+
description: "Total number of passes (1-4)",
|
|
46
|
+
},
|
|
47
|
+
passFocus: { type: "string", description: "Initial focus of Pass 1" },
|
|
48
|
+
},
|
|
49
|
+
required: [
|
|
50
|
+
"intent",
|
|
51
|
+
"joyZone",
|
|
52
|
+
"projectName",
|
|
53
|
+
"lifecycleStage",
|
|
54
|
+
"ritualChecked",
|
|
55
|
+
"gratitudeMoment",
|
|
56
|
+
"totalPasses",
|
|
57
|
+
"passFocus",
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
execute: async (args, onProgress) => {
|
|
61
|
+
const intent = getStringArg(args, "intent");
|
|
62
|
+
const joyZone = getStringArg(args, "joyZone");
|
|
63
|
+
const projectName = getStringArg(args, "projectName");
|
|
64
|
+
const lifecycleStage = getStringArg(args, "lifecycleStage");
|
|
65
|
+
const objectives = getArrayArg(args, "objectives");
|
|
66
|
+
const gratitude = getStringArg(args, "gratitudeMoment");
|
|
67
|
+
onProgress?.({
|
|
68
|
+
context: `Mindfulness: ${intent} [Zone: ${joyZone}]`,
|
|
69
|
+
completedObjectiveIds: [],
|
|
70
|
+
activeObjectiveId: objectives[0]?.id,
|
|
71
|
+
achieved: [
|
|
72
|
+
`Aligned with ${joyZone} zone protocols`,
|
|
73
|
+
`Planning for ${projectName} (${lifecycleStage})`,
|
|
74
|
+
`Ritual: ${gratitude}`,
|
|
75
|
+
],
|
|
76
|
+
lifecycleStage,
|
|
77
|
+
ritualComplete: true,
|
|
78
|
+
currentPass: 1,
|
|
79
|
+
totalPasses: args.totalPasses || 1,
|
|
80
|
+
passFocus: getStringArg(args, "passFocus"),
|
|
81
|
+
});
|
|
82
|
+
return `Strategic Plan for '${projectName}' accepted. The KonMari Waterfall (Domain -> Infrastructure -> Plumbing) has been aligned. ✨`;
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
registry.register({
|
|
86
|
+
name: "checkpoint_pass",
|
|
87
|
+
description: "Explicitly end a pass, summarize achievements, and orient for the next pass.",
|
|
88
|
+
input_schema: {
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: {
|
|
91
|
+
summary: {
|
|
92
|
+
type: "string",
|
|
93
|
+
description: "What was achieved in this pass",
|
|
94
|
+
},
|
|
95
|
+
reflection: {
|
|
96
|
+
type: "string",
|
|
97
|
+
description: "What sparked joy or was learned in this pass? (KonMari Reflection)",
|
|
98
|
+
},
|
|
99
|
+
nextPassFocus: {
|
|
100
|
+
type: "string",
|
|
101
|
+
description: "The focus for the upcoming pass",
|
|
102
|
+
},
|
|
103
|
+
zoneSolidification: {
|
|
104
|
+
type: "boolean",
|
|
105
|
+
description: "Confirm that all new code follows JOY zoning protocols.",
|
|
106
|
+
},
|
|
107
|
+
tidyChecked: {
|
|
108
|
+
type: "boolean",
|
|
109
|
+
description: "Confirm that Joyful Tidying (fold_file) has been performed.",
|
|
110
|
+
},
|
|
111
|
+
isFinalPass: { type: "boolean" },
|
|
112
|
+
},
|
|
113
|
+
required: [
|
|
114
|
+
"summary",
|
|
115
|
+
"reflection",
|
|
116
|
+
"nextPassFocus",
|
|
117
|
+
"zoneSolidification",
|
|
118
|
+
"tidyChecked",
|
|
119
|
+
"isFinalPass",
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
execute: async (args, onProgress) => {
|
|
123
|
+
const summary = getStringArg(args, "summary");
|
|
124
|
+
const reflection = getStringArg(args, "reflection");
|
|
125
|
+
const nextFocus = getStringArg(args, "nextPassFocus");
|
|
126
|
+
const solidified = args.zoneSolidification;
|
|
127
|
+
const isFinal = args.isFinalPass;
|
|
128
|
+
if (!solidified) {
|
|
129
|
+
return "Error: Zone Solidification check failed. Please ensure all new code is correctly zoned before ending the pass.";
|
|
130
|
+
}
|
|
131
|
+
if (!args.tidyChecked) {
|
|
132
|
+
return "Error: Joyful Tidying check failed. Please perform 'fold_file' on modified files to ensure code health.";
|
|
133
|
+
}
|
|
134
|
+
onProgress?.({
|
|
135
|
+
context: `Checkpoint: ${summary} (Reflection: ${reflection})`,
|
|
136
|
+
achieved: [`Completed Pass: ${summary}`],
|
|
137
|
+
passHistory: [{ pass: args.currentPass || 1, summary, reflection }],
|
|
138
|
+
currentPass: isFinal ? null : undefined,
|
|
139
|
+
passFocus: isFinal ? undefined : nextFocus,
|
|
140
|
+
});
|
|
141
|
+
return `Pass internal checkpoint reached. Focus shifting to: ${nextFocus}. Reflection: ${reflection}`;
|
|
142
|
+
},
|
|
143
|
+
});
|
|
144
|
+
registry.register({
|
|
145
|
+
name: "update_run_objectives",
|
|
146
|
+
description: "Update the current run's objectives and progress context.",
|
|
147
|
+
input_schema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
context: { type: "string" },
|
|
151
|
+
completedObjectiveIds: { type: "array", items: { type: "string" } },
|
|
152
|
+
activeObjectiveId: { type: "string" },
|
|
153
|
+
achieved: { type: "array", items: { type: "string" } },
|
|
154
|
+
totalPasses: { type: "number" },
|
|
155
|
+
},
|
|
156
|
+
required: ["context"],
|
|
157
|
+
},
|
|
158
|
+
execute: async (args, onProgress) => {
|
|
159
|
+
const context = getStringArg(args, "context");
|
|
160
|
+
const completedObjectiveIds = getArrayArg(args, "completedObjectiveIds");
|
|
161
|
+
const activeObjectiveId = getStringArg(args, "activeObjectiveId");
|
|
162
|
+
const achieved = getArrayArg(args, "achieved");
|
|
163
|
+
const totalPasses = args.totalPasses;
|
|
164
|
+
onProgress?.({
|
|
165
|
+
context,
|
|
166
|
+
completedObjectiveIds,
|
|
167
|
+
activeObjectiveId,
|
|
168
|
+
achieved,
|
|
169
|
+
totalPasses,
|
|
170
|
+
});
|
|
171
|
+
return `Progress updated: ${context}${totalPasses ? ` (Total Passes: ${totalPasses})` : ""}`;
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
registry.register({
|
|
175
|
+
name: "augment_roadmap",
|
|
176
|
+
description: "Insert a new pass into the current roadmap. Use this when significant unexpected complexity is discovered.",
|
|
177
|
+
input_schema: {
|
|
178
|
+
type: "object",
|
|
179
|
+
properties: {
|
|
180
|
+
addedPassCount: {
|
|
181
|
+
type: "number",
|
|
182
|
+
description: "How many passes to add (usually 1)",
|
|
183
|
+
},
|
|
184
|
+
newPassFocus: {
|
|
185
|
+
type: "string",
|
|
186
|
+
description: "The focus for the upcoming augmented pass",
|
|
187
|
+
},
|
|
188
|
+
reason: {
|
|
189
|
+
type: "string",
|
|
190
|
+
description: "Why is the roadmap being augmented? (Mindfulness discovery)",
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
required: ["addedPassCount", "newPassFocus", "reason"],
|
|
194
|
+
},
|
|
195
|
+
execute: async (args, onProgress) => {
|
|
196
|
+
const count = args.addedPassCount;
|
|
197
|
+
const focus = getStringArg(args, "newPassFocus");
|
|
198
|
+
const reason = getStringArg(args, "reason");
|
|
199
|
+
onProgress?.({
|
|
200
|
+
context: `Roadmap Augmented: ${reason}`,
|
|
201
|
+
achieved: [`Calibrated roadmap: +${count} pass(es)`],
|
|
202
|
+
totalPasses: count,
|
|
203
|
+
passFocus: focus,
|
|
204
|
+
});
|
|
205
|
+
return `Roadmap augmented with ${count} additional pass(es). Reason: ${reason}`;
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
registry.register({
|
|
209
|
+
name: "generate_migration_plan",
|
|
210
|
+
description: "Generate a step-by-step 'Blueprint' for migrating code from an old pattern to a new one.",
|
|
211
|
+
input_schema: {
|
|
212
|
+
type: "object",
|
|
213
|
+
properties: {
|
|
214
|
+
fromPattern: {
|
|
215
|
+
type: "string",
|
|
216
|
+
description: "The pattern being replaced",
|
|
217
|
+
},
|
|
218
|
+
toPattern: { type: "string", description: "The new target pattern" },
|
|
219
|
+
files: {
|
|
220
|
+
type: "array",
|
|
221
|
+
items: { type: "string" },
|
|
222
|
+
description: "List of files to migrate",
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
required: ["fromPattern", "toPattern", "files"],
|
|
226
|
+
},
|
|
227
|
+
execute: async (args) => {
|
|
228
|
+
const files = args.files;
|
|
229
|
+
let result = `# 📐 Migration Blueprint\n\n`;
|
|
230
|
+
result += `**Trajectory**: From \`${args.fromPattern}\` to \`${args.toPattern}\`\n\n`;
|
|
231
|
+
result += `## 🗺️ Execution Steps\n`;
|
|
232
|
+
result += `1. **Analysis**: Map all instances of old pattern in ${files.length} files.\n`;
|
|
233
|
+
result += `2. **Transformation**: Apply structural replacements using \`replace_in_file\`.\n`;
|
|
234
|
+
result += `3. **Verification**: Run \`check_ripple_health\` and \`run_test_suite\`.\n\n`;
|
|
235
|
+
result += `## 🗂️ Target Garden\n`;
|
|
236
|
+
files
|
|
237
|
+
.slice(0, 10)
|
|
238
|
+
.forEach((f) => (result += `- \`${f.split("/").pop()}\`\n`));
|
|
239
|
+
if (files.length > 10)
|
|
240
|
+
result += `- ... and ${files.length - 10} more.\n`;
|
|
241
|
+
return result;
|
|
242
|
+
},
|
|
243
|
+
});
|
|
244
|
+
registry.register({
|
|
245
|
+
name: "generate_architectural_decision",
|
|
246
|
+
description: "Generate a structured ADR (Architectural Decision Record) to document a major shift in the project.",
|
|
247
|
+
isDestructive: true,
|
|
248
|
+
input_schema: {
|
|
249
|
+
type: "object",
|
|
250
|
+
properties: {
|
|
251
|
+
title: { type: "string", description: "Concise title of the decision" },
|
|
252
|
+
context: {
|
|
253
|
+
type: "string",
|
|
254
|
+
description: "The problem or context driving this change",
|
|
255
|
+
},
|
|
256
|
+
decision: {
|
|
257
|
+
type: "string",
|
|
258
|
+
description: "The chosen solution and rationale",
|
|
259
|
+
},
|
|
260
|
+
consequences: {
|
|
261
|
+
type: "string",
|
|
262
|
+
description: "Impact on the system moving forward",
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
required: ["title", "context", "decision", "consequences"],
|
|
266
|
+
},
|
|
267
|
+
execute: async (args) => {
|
|
268
|
+
const root = getWorkspaceRoot();
|
|
269
|
+
if (!root)
|
|
270
|
+
return "No workspace detected.";
|
|
271
|
+
const id = `ADR-${Math.round(Date.now() / 1000)}`;
|
|
272
|
+
const adrDir = path.join(root, ".marie", "decisions");
|
|
273
|
+
const adrPath = path.join(adrDir, `${id}.md`);
|
|
274
|
+
const title = getStringArg(args, "title");
|
|
275
|
+
const historyContext = title.includes("Refactor")
|
|
276
|
+
? `\n## Historical Context\n> This decision aligns with the trajectory identified in the Evolution Chronicle. ✨\n`
|
|
277
|
+
: "";
|
|
278
|
+
const adrContent = `# 🛡️ ${id}: ${title}\n\n` +
|
|
279
|
+
`**Date**: ${new Date().toLocaleDateString()}\n` +
|
|
280
|
+
`**Status**: Accepted\n\n` +
|
|
281
|
+
historyContext +
|
|
282
|
+
`## Context\n${getStringArg(args, "context")}\n\n` +
|
|
283
|
+
`## Decision\n${getStringArg(args, "decision")}\n\n` +
|
|
284
|
+
`## Consequences\n${getStringArg(args, "consequences")}\n\n` +
|
|
285
|
+
`--- \nGenerated by Marie Autonomous Agent ✨`;
|
|
286
|
+
try {
|
|
287
|
+
await fs.mkdir(adrDir, { recursive: true });
|
|
288
|
+
await fs.writeFile(adrPath, adrContent);
|
|
289
|
+
return `Architectural Decision Record saved to \`.marie/decisions/${id}.md\`. History preserved. 🛡️`;
|
|
290
|
+
}
|
|
291
|
+
catch (e) {
|
|
292
|
+
return `Failed to save ADR: ${e}`;
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=PlanningTools.js.map
|