@stackmemoryai/stackmemory 0.3.22 → 0.3.24
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/commands/ralph.js +294 -0
- package/dist/cli/commands/ralph.js.map +7 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +2 -2
- package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js +586 -0
- package/dist/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +7 -0
- package/dist/integrations/ralph/context/context-budget-manager.js +297 -0
- package/dist/integrations/ralph/context/context-budget-manager.js.map +7 -0
- package/dist/integrations/ralph/context/stackmemory-context-loader.js +356 -0
- package/dist/integrations/ralph/context/stackmemory-context-loader.js.map +7 -0
- package/dist/integrations/ralph/index.js +14 -0
- package/dist/integrations/ralph/index.js.map +7 -0
- package/dist/integrations/ralph/learning/pattern-learner.js +397 -0
- package/dist/integrations/ralph/learning/pattern-learner.js.map +7 -0
- package/dist/integrations/ralph/lifecycle/iteration-lifecycle.js +444 -0
- package/dist/integrations/ralph/lifecycle/iteration-lifecycle.js.map +7 -0
- package/dist/integrations/ralph/orchestration/multi-loop-orchestrator.js +459 -0
- package/dist/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +7 -0
- package/dist/integrations/ralph/performance/performance-optimizer.js +354 -0
- package/dist/integrations/ralph/performance/performance-optimizer.js.map +7 -0
- package/dist/integrations/ralph/ralph-integration-demo.js +178 -0
- package/dist/integrations/ralph/ralph-integration-demo.js.map +7 -0
- package/dist/integrations/ralph/state/state-reconciler.js +400 -0
- package/dist/integrations/ralph/state/state-reconciler.js.map +7 -0
- package/dist/integrations/ralph/swarm/swarm-coordinator.js +487 -0
- package/dist/integrations/ralph/swarm/swarm-coordinator.js.map +7 -0
- package/dist/integrations/ralph/types.js +1 -0
- package/dist/integrations/ralph/types.js.map +7 -0
- package/dist/integrations/ralph/visualization/ralph-debugger.js +581 -0
- package/dist/integrations/ralph/visualization/ralph-debugger.js.map +7 -0
- package/package.json +1 -1
- package/scripts/deploy-ralph-swarm.sh +365 -0
- package/scripts/ralph-integration-test.js +274 -0
- package/scripts/ralph-loop-implementation.js +404 -0
- package/scripts/swarm-monitor.js +509 -0
- package/scripts/test-parallel-swarms.js +443 -0
- package/scripts/testing/ralph-cli-test.js +88 -0
- package/scripts/testing/ralph-integration-validation.js +727 -0
- package/scripts/testing/ralph-swarm-test-scenarios.js +613 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { logger } from "../../core/monitoring/logger.js";
|
|
3
|
+
import { RalphLoop } from "../../../scripts/ralph-loop-implementation.js";
|
|
4
|
+
import { stackMemoryContextLoader } from "../../integrations/ralph/context/stackmemory-context-loader.js";
|
|
5
|
+
import { patternLearner } from "../../integrations/ralph/learning/pattern-learner.js";
|
|
6
|
+
import { multiLoopOrchestrator } from "../../integrations/ralph/orchestration/multi-loop-orchestrator.js";
|
|
7
|
+
import { swarmCoordinator } from "../../integrations/ralph/swarm/swarm-coordinator.js";
|
|
8
|
+
import { ralphDebugger } from "../../integrations/ralph/visualization/ralph-debugger.js";
|
|
9
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
10
|
+
import { trace } from "../../core/trace/index.js";
|
|
11
|
+
function createRalphCommand() {
|
|
12
|
+
const ralph = new Command("ralph").description("Ralph Wiggum Loop integration with StackMemory");
|
|
13
|
+
ralph.command("init").description("Initialize a new Ralph Wiggum loop").argument("<task>", "Task description").option("-c, --criteria <criteria>", "Completion criteria (comma separated)").option("--max-iterations <n>", "Maximum iterations", "50").option("--use-context", "Load relevant context from StackMemory").option("--learn-from-similar", "Apply patterns from similar completed tasks").action(async (task, options) => {
|
|
14
|
+
return trace.command("ralph-init", { task, ...options }, async () => {
|
|
15
|
+
try {
|
|
16
|
+
console.log("\u{1F3AD} Initializing Ralph Wiggum loop...");
|
|
17
|
+
const loop = new RalphLoop({
|
|
18
|
+
baseDir: ".ralph",
|
|
19
|
+
maxIterations: parseInt(options.maxIterations),
|
|
20
|
+
verbose: true
|
|
21
|
+
});
|
|
22
|
+
const criteria = options.criteria ? options.criteria.split(",").map((c) => `- ${c.trim()}`).join("\n") : "- All tests pass\n- Code works correctly\n- No lint errors";
|
|
23
|
+
let enhancedTask = task;
|
|
24
|
+
if (options.useContext || options.learnFromSimilar) {
|
|
25
|
+
try {
|
|
26
|
+
await stackMemoryContextLoader.initialize();
|
|
27
|
+
const contextResponse = await stackMemoryContextLoader.loadInitialContext({
|
|
28
|
+
task,
|
|
29
|
+
usePatterns: true,
|
|
30
|
+
useSimilarTasks: options.learnFromSimilar,
|
|
31
|
+
maxTokens: 3e3
|
|
32
|
+
});
|
|
33
|
+
if (contextResponse.context) {
|
|
34
|
+
enhancedTask = `${task}
|
|
35
|
+
|
|
36
|
+
${contextResponse.context}`;
|
|
37
|
+
console.log(`\u{1F4DA} Loaded context from ${contextResponse.sources.length} sources`);
|
|
38
|
+
console.log(`\u{1F3AF} Context tokens: ${contextResponse.metadata.totalTokens}`);
|
|
39
|
+
}
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.log(`\u26A0\uFE0F Context loading failed: ${error.message}`);
|
|
42
|
+
console.log("Proceeding without context...");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
await loop.initialize(enhancedTask, criteria);
|
|
46
|
+
console.log("\u2705 Ralph loop initialized!");
|
|
47
|
+
console.log(`\u{1F4CB} Task: ${task}`);
|
|
48
|
+
console.log(`\u{1F3AF} Max iterations: ${options.maxIterations}`);
|
|
49
|
+
console.log(`\u{1F4C1} Loop directory: .ralph/`);
|
|
50
|
+
console.log("\nNext steps:");
|
|
51
|
+
console.log(" stackmemory ralph run # Start the loop");
|
|
52
|
+
console.log(" stackmemory ralph status # Check status");
|
|
53
|
+
} catch (error) {
|
|
54
|
+
logger.error("Failed to initialize Ralph loop", error);
|
|
55
|
+
console.error("\u274C Initialization failed:", error.message);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
ralph.command("run").description("Run the Ralph Wiggum loop").option("--verbose", "Verbose output").option("--pause-on-error", "Pause on validation errors").action(async (options) => {
|
|
61
|
+
return trace.command("ralph-run", options, async () => {
|
|
62
|
+
try {
|
|
63
|
+
if (!existsSync(".ralph")) {
|
|
64
|
+
console.error('\u274C No Ralph loop found. Run "stackmemory ralph init" first.');
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
console.log("\u{1F3AD} Starting Ralph Wiggum loop...");
|
|
68
|
+
const loop = new RalphLoop({
|
|
69
|
+
baseDir: ".ralph",
|
|
70
|
+
verbose: options.verbose
|
|
71
|
+
});
|
|
72
|
+
await loop.run();
|
|
73
|
+
} catch (error) {
|
|
74
|
+
logger.error("Failed to run Ralph loop", error);
|
|
75
|
+
console.error("\u274C Loop execution failed:", error.message);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
ralph.command("status").description("Show current Ralph loop status").option("--detailed", "Show detailed iteration history").action(async (options) => {
|
|
81
|
+
return trace.command("ralph-status", options, async () => {
|
|
82
|
+
try {
|
|
83
|
+
if (!existsSync(".ralph")) {
|
|
84
|
+
console.log("\u274C No Ralph loop found in current directory");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const task = readFileSync(".ralph/task.md", "utf8");
|
|
88
|
+
const iteration = parseInt(readFileSync(".ralph/iteration.txt", "utf8") || "0");
|
|
89
|
+
const isComplete = existsSync(".ralph/work-complete.txt");
|
|
90
|
+
const feedback = existsSync(".ralph/feedback.txt") ? readFileSync(".ralph/feedback.txt", "utf8") : "";
|
|
91
|
+
console.log("\u{1F3AD} Ralph Loop Status:");
|
|
92
|
+
console.log(` Task: ${task.substring(0, 80)}...`);
|
|
93
|
+
console.log(` Iteration: ${iteration}`);
|
|
94
|
+
console.log(` Status: ${isComplete ? "\u2705 COMPLETE" : "\u{1F504} IN PROGRESS"}`);
|
|
95
|
+
if (feedback) {
|
|
96
|
+
console.log(` Last feedback: ${feedback.substring(0, 100)}...`);
|
|
97
|
+
}
|
|
98
|
+
if (options.detailed && existsSync(".ralph/progress.jsonl")) {
|
|
99
|
+
console.log("\n\u{1F4CA} Iteration History:");
|
|
100
|
+
const progressLines = readFileSync(".ralph/progress.jsonl", "utf8").split("\n").filter(Boolean).map((line) => JSON.parse(line));
|
|
101
|
+
progressLines.forEach((p) => {
|
|
102
|
+
const progress = p;
|
|
103
|
+
const status = progress.validation?.testsPass ? "\u2705" : "\u274C";
|
|
104
|
+
console.log(` ${progress.iteration}: ${status} ${progress.changes} changes, ${progress.errors} errors`);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
} catch (error) {
|
|
108
|
+
logger.error("Failed to get Ralph status", error);
|
|
109
|
+
console.error("\u274C Status check failed:", error.message);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
ralph.command("resume").description("Resume a crashed or paused Ralph loop").option("--from-stackmemory", "Restore from StackMemory backup").action(async (options) => {
|
|
114
|
+
return trace.command("ralph-resume", options, async () => {
|
|
115
|
+
try {
|
|
116
|
+
console.log("\u{1F504} Resuming Ralph loop...");
|
|
117
|
+
const loop = new RalphLoop({ baseDir: ".ralph", verbose: true });
|
|
118
|
+
if (options.fromStackmemory) {
|
|
119
|
+
console.log("\u{1F4DA} StackMemory restore feature coming soon...");
|
|
120
|
+
}
|
|
121
|
+
await loop.run();
|
|
122
|
+
} catch (error) {
|
|
123
|
+
logger.error("Failed to resume Ralph loop", error);
|
|
124
|
+
console.error("\u274C Resume failed:", error.message);
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
ralph.command("stop").description("Stop the current Ralph loop").option("--save-progress", "Save current progress to StackMemory").action(async (options) => {
|
|
130
|
+
return trace.command("ralph-stop", options, async () => {
|
|
131
|
+
try {
|
|
132
|
+
if (!existsSync(".ralph")) {
|
|
133
|
+
console.log("\u274C No active Ralph loop found");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
console.log("\u{1F6D1} Stopping Ralph loop...");
|
|
137
|
+
if (options.saveProgress) {
|
|
138
|
+
console.log("\u{1F4BE} StackMemory progress save feature coming soon...");
|
|
139
|
+
}
|
|
140
|
+
writeFileSync(".ralph/stop-signal.txt", (/* @__PURE__ */ new Date()).toISOString());
|
|
141
|
+
console.log("\u2705 Stop signal sent");
|
|
142
|
+
} catch (error) {
|
|
143
|
+
logger.error("Failed to stop Ralph loop", error);
|
|
144
|
+
console.error("\u274C Stop failed:", error.message);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
ralph.command("clean").description("Clean up Ralph loop artifacts").option("--keep-history", "Keep iteration history").action(async (options) => {
|
|
149
|
+
return trace.command("ralph-clean", options, async () => {
|
|
150
|
+
try {
|
|
151
|
+
if (!options.keepHistory && existsSync(".ralph/history")) {
|
|
152
|
+
const { execSync } = await import("child_process");
|
|
153
|
+
execSync("rm -rf .ralph/history");
|
|
154
|
+
}
|
|
155
|
+
if (existsSync(".ralph/work-complete.txt")) {
|
|
156
|
+
const fs = await import("fs");
|
|
157
|
+
fs.unlinkSync(".ralph/work-complete.txt");
|
|
158
|
+
}
|
|
159
|
+
console.log("\u{1F9F9} Ralph loop artifacts cleaned");
|
|
160
|
+
} catch (error) {
|
|
161
|
+
logger.error("Failed to clean Ralph artifacts", error);
|
|
162
|
+
console.error("\u274C Cleanup failed:", error.message);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
ralph.command("debug").description("Debug Ralph loop state and diagnostics").option("--reconcile", "Force state reconciliation").option("--validate-context", "Validate context budget").action(async (options) => {
|
|
167
|
+
return trace.command("ralph-debug", options, async () => {
|
|
168
|
+
try {
|
|
169
|
+
console.log("\u{1F50D} Ralph Loop Debug Information:");
|
|
170
|
+
if (options.reconcile) {
|
|
171
|
+
console.log("\u{1F527} State reconciliation feature coming soon...");
|
|
172
|
+
}
|
|
173
|
+
if (options.validateContext) {
|
|
174
|
+
console.log("\u{1F4CA} Context validation feature coming soon...");
|
|
175
|
+
}
|
|
176
|
+
if (existsSync(".ralph")) {
|
|
177
|
+
console.log("\n\u{1F4C1} Ralph directory structure:");
|
|
178
|
+
const { execSync } = await import("child_process");
|
|
179
|
+
try {
|
|
180
|
+
const tree = execSync("find .ralph -type f | head -20", { encoding: "utf8" });
|
|
181
|
+
console.log(tree);
|
|
182
|
+
} catch {
|
|
183
|
+
console.log(" (Unable to show directory tree)");
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
} catch (error) {
|
|
187
|
+
logger.error("Ralph debug failed", error);
|
|
188
|
+
console.error("\u274C Debug failed:", error.message);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
ralph.command("swarm").description("Launch a swarm of specialized agents").argument("<project>", "Project description").option("--agents <agents>", "Comma-separated list of agent roles (architect,developer,tester,etc)", "developer,tester").option("--max-agents <n>", "Maximum number of agents", "5").action(async (project, options) => {
|
|
193
|
+
return trace.command("ralph-swarm", { project, ...options }, async () => {
|
|
194
|
+
try {
|
|
195
|
+
console.log("\u{1F9BE} Launching Ralph swarm...");
|
|
196
|
+
await swarmCoordinator.initialize();
|
|
197
|
+
const agentRoles = options.agents.split(",").map((r) => r.trim());
|
|
198
|
+
const agentSpecs = agentRoles.map((role) => ({
|
|
199
|
+
role,
|
|
200
|
+
conflictResolution: "defer_to_expertise",
|
|
201
|
+
collaborationPreferences: []
|
|
202
|
+
}));
|
|
203
|
+
const swarmId = await swarmCoordinator.launchSwarm(project, agentSpecs);
|
|
204
|
+
console.log(`\u2705 Swarm launched with ID: ${swarmId}`);
|
|
205
|
+
console.log(`\u{1F465} ${agentSpecs.length} agents working on: ${project}`);
|
|
206
|
+
console.log("\nNext steps:");
|
|
207
|
+
console.log(" stackmemory ralph swarm-status <swarmId> # Check progress");
|
|
208
|
+
console.log(" stackmemory ralph swarm-stop <swarmId> # Stop swarm");
|
|
209
|
+
} catch (error) {
|
|
210
|
+
logger.error("Swarm launch failed", error);
|
|
211
|
+
console.error("\u274C Swarm launch failed:", error.message);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
ralph.command("orchestrate").description("Orchestrate multiple Ralph loops for complex tasks").argument("<description>", "Complex task description").option("--criteria <criteria>", "Success criteria (comma separated)").option("--max-loops <n>", "Maximum parallel loops", "3").option("--sequential", "Force sequential execution").action(async (description, options) => {
|
|
216
|
+
return trace.command("ralph-orchestrate", { description, ...options }, async () => {
|
|
217
|
+
try {
|
|
218
|
+
console.log("\u{1F3AD} Orchestrating complex task...");
|
|
219
|
+
await multiLoopOrchestrator.initialize();
|
|
220
|
+
const criteria = options.criteria ? options.criteria.split(",").map((c) => c.trim()) : ["Task completed successfully", "All components working", "Tests pass"];
|
|
221
|
+
const result = await multiLoopOrchestrator.orchestrateComplexTask(
|
|
222
|
+
description,
|
|
223
|
+
criteria,
|
|
224
|
+
{
|
|
225
|
+
maxLoops: parseInt(options.maxLoops),
|
|
226
|
+
forceSequential: options.sequential
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
console.log("\u2705 Orchestration completed!");
|
|
230
|
+
console.log(`\u{1F4CA} Results: ${result.completedLoops.length} successful, ${result.failedLoops.length} failed`);
|
|
231
|
+
console.log(`\u23F1\uFE0F Total duration: ${Math.round(result.totalDuration / 1e3)}s`);
|
|
232
|
+
if (result.insights.length > 0) {
|
|
233
|
+
console.log("\n\u{1F4A1} Insights:");
|
|
234
|
+
result.insights.forEach((insight) => console.log(` \u2022 ${insight}`));
|
|
235
|
+
}
|
|
236
|
+
} catch (error) {
|
|
237
|
+
logger.error("Orchestration failed", error);
|
|
238
|
+
console.error("\u274C Orchestration failed:", error.message);
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
ralph.command("learn").description("Learn patterns from completed loops").option("--task-type <type>", "Learn patterns for specific task type").action(async (options) => {
|
|
243
|
+
return trace.command("ralph-learn", options, async () => {
|
|
244
|
+
try {
|
|
245
|
+
console.log("\u{1F9E0} Learning patterns from completed loops...");
|
|
246
|
+
await patternLearner.initialize();
|
|
247
|
+
const patterns = options.taskType ? await patternLearner.learnForTaskType(options.taskType) : await patternLearner.learnFromCompletedLoops();
|
|
248
|
+
console.log(`\u2705 Learned ${patterns.length} patterns`);
|
|
249
|
+
if (patterns.length > 0) {
|
|
250
|
+
console.log("\n\u{1F4CA} Top patterns:");
|
|
251
|
+
patterns.slice(0, 5).forEach((pattern) => {
|
|
252
|
+
console.log(` \u2022 ${pattern.pattern} (${Math.round(pattern.confidence * 100)}% confidence)`);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
} catch (error) {
|
|
256
|
+
logger.error("Pattern learning failed", error);
|
|
257
|
+
console.error("\u274C Pattern learning failed:", error.message);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
ralph.command("debug-enhanced").description("Advanced debugging with visualization").option("--loop-id <id>", "Specific loop to debug").option("--generate-report", "Generate comprehensive debug report").option("--timeline", "Generate timeline visualization").action(async (options) => {
|
|
262
|
+
return trace.command("ralph-debug-enhanced", options, async () => {
|
|
263
|
+
try {
|
|
264
|
+
if (!existsSync(".ralph") && !options.loopId) {
|
|
265
|
+
console.log("\u274C No Ralph loop found. Run a loop first or specify --loop-id");
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
console.log("\u{1F50D} Starting enhanced debugging...");
|
|
269
|
+
await ralphDebugger.initialize();
|
|
270
|
+
const loopId = options.loopId || "current";
|
|
271
|
+
const debugSession = await ralphDebugger.startDebugSession(loopId, ".ralph");
|
|
272
|
+
if (options.generateReport) {
|
|
273
|
+
const report = await ralphDebugger.generateDebugReport(loopId);
|
|
274
|
+
console.log(`\u{1F4CB} Debug report generated: ${report.exportPath}`);
|
|
275
|
+
}
|
|
276
|
+
if (options.timeline) {
|
|
277
|
+
const timelinePath = await ralphDebugger.generateLoopTimeline(loopId);
|
|
278
|
+
console.log(`\u{1F4CA} Timeline visualization: ${timelinePath}`);
|
|
279
|
+
}
|
|
280
|
+
console.log("\u{1F50D} Debug analysis complete");
|
|
281
|
+
} catch (error) {
|
|
282
|
+
logger.error("Enhanced debugging failed", error);
|
|
283
|
+
console.error("\u274C Debug failed:", error.message);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
return ralph;
|
|
288
|
+
}
|
|
289
|
+
var ralph_default = createRalphCommand;
|
|
290
|
+
export {
|
|
291
|
+
createRalphCommand,
|
|
292
|
+
ralph_default as default
|
|
293
|
+
};
|
|
294
|
+
//# sourceMappingURL=ralph.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/cli/commands/ralph.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Ralph Wiggum Loop Commands\n * CLI interface for Ralph-StackMemory integration\n */\n\nimport { Command } from 'commander';\nimport { logger } from '../../core/monitoring/logger.js';\nimport { RalphLoop } from '../../../scripts/ralph-loop-implementation.js';\nimport { stackMemoryContextLoader } from '../../integrations/ralph/context/stackmemory-context-loader.js';\nimport { patternLearner } from '../../integrations/ralph/learning/pattern-learner.js';\nimport { multiLoopOrchestrator } from '../../integrations/ralph/orchestration/multi-loop-orchestrator.js';\nimport { swarmCoordinator } from '../../integrations/ralph/swarm/swarm-coordinator.js';\nimport { ralphDebugger } from '../../integrations/ralph/visualization/ralph-debugger.js';\nimport { existsSync, readFileSync, writeFileSync } from 'fs';\nimport { trace } from '../../core/trace/index.js';\n\nexport function createRalphCommand(): Command {\n const ralph = new Command('ralph')\n .description('Ralph Wiggum Loop integration with StackMemory');\n\n // Initialize a new Ralph loop\n ralph\n .command('init')\n .description('Initialize a new Ralph Wiggum loop')\n .argument('<task>', 'Task description')\n .option('-c, --criteria <criteria>', 'Completion criteria (comma separated)')\n .option('--max-iterations <n>', 'Maximum iterations', '50')\n .option('--use-context', 'Load relevant context from StackMemory')\n .option('--learn-from-similar', 'Apply patterns from similar completed tasks')\n .action(async (task, options) => {\n return trace.command('ralph-init', { task, ...options }, async () => {\n try {\n console.log('\uD83C\uDFAD Initializing Ralph Wiggum loop...');\n \n // Use basic Ralph loop for now (StackMemory integration requires DB setup)\n const loop = new RalphLoop({\n baseDir: '.ralph',\n maxIterations: parseInt(options.maxIterations),\n verbose: true\n });\n\n // Parse criteria\n const criteria = options.criteria \n ? options.criteria.split(',').map((c: string) => `- ${c.trim()}`).join('\\n')\n : '- All tests pass\\n- Code works correctly\\n- No lint errors';\n\n // Load StackMemory context if requested\n let enhancedTask = task;\n \n if (options.useContext || options.learnFromSimilar) {\n try {\n await stackMemoryContextLoader.initialize();\n \n const contextResponse = await stackMemoryContextLoader.loadInitialContext({\n task,\n usePatterns: true,\n useSimilarTasks: options.learnFromSimilar,\n maxTokens: 3000\n });\n \n if (contextResponse.context) {\n enhancedTask = `${task}\\n\\n${contextResponse.context}`;\n console.log(`\uD83D\uDCDA Loaded context from ${contextResponse.sources.length} sources`);\n console.log(`\uD83C\uDFAF Context tokens: ${contextResponse.metadata.totalTokens}`);\n }\n } catch (error: unknown) {\n console.log(`\u26A0\uFE0F Context loading failed: ${(error as Error).message}`);\n console.log('Proceeding without context...');\n }\n }\n\n await loop.initialize(enhancedTask, criteria);\n \n console.log('\u2705 Ralph loop initialized!');\n console.log(`\uD83D\uDCCB Task: ${task}`);\n console.log(`\uD83C\uDFAF Max iterations: ${options.maxIterations}`);\n console.log(`\uD83D\uDCC1 Loop directory: .ralph/`);\n console.log('\\nNext steps:');\n console.log(' stackmemory ralph run # Start the loop');\n console.log(' stackmemory ralph status # Check status');\n\n } catch (error: unknown) {\n logger.error('Failed to initialize Ralph loop', error as Error);\n console.error('\u274C Initialization failed:', (error as Error).message);\n process.exit(1);\n }\n });\n });\n\n // Run the Ralph loop\n ralph\n .command('run')\n .description('Run the Ralph Wiggum loop')\n .option('--verbose', 'Verbose output')\n .option('--pause-on-error', 'Pause on validation errors')\n .action(async (options) => {\n return trace.command('ralph-run', options, async () => {\n try {\n if (!existsSync('.ralph')) {\n console.error('\u274C No Ralph loop found. Run \"stackmemory ralph init\" first.');\n return;\n }\n\n console.log('\uD83C\uDFAD Starting Ralph Wiggum loop...');\n \n const loop = new RalphLoop({\n baseDir: '.ralph',\n verbose: options.verbose\n });\n\n await loop.run();\n \n } catch (error: unknown) {\n logger.error('Failed to run Ralph loop', error as Error);\n console.error('\u274C Loop execution failed:', (error as Error).message);\n process.exit(1);\n }\n });\n });\n\n // Show loop status\n ralph\n .command('status')\n .description('Show current Ralph loop status')\n .option('--detailed', 'Show detailed iteration history')\n .action(async (options) => {\n return trace.command('ralph-status', options, async () => {\n try {\n if (!existsSync('.ralph')) {\n console.log('\u274C No Ralph loop found in current directory');\n return;\n }\n\n // Get basic status from files\n \n // Read status from files\n const task = readFileSync('.ralph/task.md', 'utf8');\n const iteration = parseInt(readFileSync('.ralph/iteration.txt', 'utf8') || '0');\n const isComplete = existsSync('.ralph/work-complete.txt');\n const feedback = existsSync('.ralph/feedback.txt') ? readFileSync('.ralph/feedback.txt', 'utf8') : '';\n \n console.log('\uD83C\uDFAD Ralph Loop Status:');\n console.log(` Task: ${task.substring(0, 80)}...`);\n console.log(` Iteration: ${iteration}`);\n console.log(` Status: ${isComplete ? '\u2705 COMPLETE' : '\uD83D\uDD04 IN PROGRESS'}`);\n \n if (feedback) {\n console.log(` Last feedback: ${feedback.substring(0, 100)}...`);\n }\n\n if (options.detailed && existsSync('.ralph/progress.jsonl')) {\n console.log('\\n\uD83D\uDCCA Iteration History:');\n const progressLines = readFileSync('.ralph/progress.jsonl', 'utf8')\n .split('\\n')\n .filter(Boolean)\n .map(line => JSON.parse(line));\n \n progressLines.forEach((p: any) => {\n const progress = p as { iteration: number; validation?: { testsPass: boolean }; changes: number; errors: number };\n const status = progress.validation?.testsPass ? '\u2705' : '\u274C';\n console.log(` ${progress.iteration}: ${status} ${progress.changes} changes, ${progress.errors} errors`);\n });\n }\n\n // TODO: Show StackMemory integration status when available\n\n } catch (error: unknown) {\n logger.error('Failed to get Ralph status', error as Error);\n console.error('\u274C Status check failed:', (error as Error).message);\n }\n });\n });\n\n // Resume a crashed or paused loop\n ralph\n .command('resume')\n .description('Resume a crashed or paused Ralph loop')\n .option('--from-stackmemory', 'Restore from StackMemory backup')\n .action(async (options) => {\n return trace.command('ralph-resume', options, async () => {\n try {\n console.log('\uD83D\uDD04 Resuming Ralph loop...');\n \n const loop = new RalphLoop({ baseDir: '.ralph', verbose: true });\n \n if (options.fromStackmemory) {\n console.log('\uD83D\uDCDA StackMemory restore feature coming soon...');\n }\n\n await loop.run(); // Resume by continuing the loop\n \n } catch (error: unknown) {\n logger.error('Failed to resume Ralph loop', error as Error);\n console.error('\u274C Resume failed:', (error as Error).message);\n process.exit(1);\n }\n });\n });\n\n // Stop the current loop\n ralph\n .command('stop')\n .description('Stop the current Ralph loop')\n .option('--save-progress', 'Save current progress to StackMemory')\n .action(async (options) => {\n return trace.command('ralph-stop', options, async () => {\n try {\n if (!existsSync('.ralph')) {\n console.log('\u274C No active Ralph loop found');\n return;\n }\n\n console.log('\uD83D\uDED1 Stopping Ralph loop...');\n \n if (options.saveProgress) {\n console.log('\uD83D\uDCBE StackMemory progress save feature coming soon...');\n }\n\n // Create stop signal file\n writeFileSync('.ralph/stop-signal.txt', new Date().toISOString());\n console.log('\u2705 Stop signal sent');\n \n } catch (error: unknown) {\n logger.error('Failed to stop Ralph loop', error as Error);\n console.error('\u274C Stop failed:', (error as Error).message);\n }\n });\n });\n\n // Clean up loop artifacts\n ralph\n .command('clean')\n .description('Clean up Ralph loop artifacts')\n .option('--keep-history', 'Keep iteration history')\n .action(async (options) => {\n return trace.command('ralph-clean', options, async () => {\n try {\n // Clean up Ralph directory\n if (!options.keepHistory && existsSync('.ralph/history')) {\n const { execSync } = await import('child_process');\n execSync('rm -rf .ralph/history');\n }\n \n // Remove working files but keep task definition\n if (existsSync('.ralph/work-complete.txt')) {\n const fs = await import('fs');\n fs.unlinkSync('.ralph/work-complete.txt');\n }\n \n console.log('\uD83E\uDDF9 Ralph loop artifacts cleaned');\n \n } catch (error: unknown) {\n logger.error('Failed to clean Ralph artifacts', error as Error);\n console.error('\u274C Cleanup failed:', (error as Error).message);\n }\n });\n });\n\n // Debug and diagnostics\n ralph\n .command('debug')\n .description('Debug Ralph loop state and diagnostics')\n .option('--reconcile', 'Force state reconciliation')\n .option('--validate-context', 'Validate context budget')\n .action(async (options) => {\n return trace.command('ralph-debug', options, async () => {\n try {\n console.log('\uD83D\uDD0D Ralph Loop Debug Information:');\n \n if (options.reconcile) {\n console.log('\uD83D\uDD27 State reconciliation feature coming soon...');\n }\n\n if (options.validateContext) {\n console.log('\uD83D\uDCCA Context validation feature coming soon...');\n }\n\n // Show file structure\n if (existsSync('.ralph')) {\n console.log('\\n\uD83D\uDCC1 Ralph directory structure:');\n const { execSync } = await import('child_process');\n try {\n const tree = execSync('find .ralph -type f | head -20', { encoding: 'utf8' });\n console.log(tree);\n } catch {\n console.log(' (Unable to show directory tree)');\n }\n }\n \n } catch (error: unknown) {\n logger.error('Ralph debug failed', error as Error);\n console.error('\u274C Debug failed:', (error as Error).message);\n }\n });\n });\n\n // Swarm coordination commands\n ralph\n .command('swarm')\n .description('Launch a swarm of specialized agents')\n .argument('<project>', 'Project description')\n .option('--agents <agents>', 'Comma-separated list of agent roles (architect,developer,tester,etc)', 'developer,tester')\n .option('--max-agents <n>', 'Maximum number of agents', '5')\n .action(async (project, options) => {\n return trace.command('ralph-swarm', { project, ...options }, async () => {\n try {\n console.log('\uD83E\uDDBE Launching Ralph swarm...');\n \n await swarmCoordinator.initialize();\n \n const agentRoles = options.agents.split(',').map((r: string) => r.trim());\n const agentSpecs = agentRoles.map((role: string) => ({\n role: role as any,\n conflictResolution: 'defer_to_expertise',\n collaborationPreferences: []\n }));\n \n const swarmId = await swarmCoordinator.launchSwarm(project, agentSpecs);\n \n console.log(`\u2705 Swarm launched with ID: ${swarmId}`);\n console.log(`\uD83D\uDC65 ${agentSpecs.length} agents working on: ${project}`);\n console.log('\\nNext steps:');\n console.log(' stackmemory ralph swarm-status <swarmId> # Check progress');\n console.log(' stackmemory ralph swarm-stop <swarmId> # Stop swarm');\n \n } catch (error: unknown) {\n logger.error('Swarm launch failed', error as Error);\n console.error('\u274C Swarm launch failed:', (error as Error).message);\n }\n });\n });\n\n // Multi-loop orchestration for complex tasks\n ralph\n .command('orchestrate')\n .description('Orchestrate multiple Ralph loops for complex tasks')\n .argument('<description>', 'Complex task description')\n .option('--criteria <criteria>', 'Success criteria (comma separated)')\n .option('--max-loops <n>', 'Maximum parallel loops', '3')\n .option('--sequential', 'Force sequential execution')\n .action(async (description, options) => {\n return trace.command('ralph-orchestrate', { description, ...options }, async () => {\n try {\n console.log('\uD83C\uDFAD Orchestrating complex task...');\n \n await multiLoopOrchestrator.initialize();\n \n const criteria = options.criteria ? \n options.criteria.split(',').map((c: string) => c.trim()) :\n ['Task completed successfully', 'All components working', 'Tests pass'];\n \n const result = await multiLoopOrchestrator.orchestrateComplexTask(\n description,\n criteria,\n {\n maxLoops: parseInt(options.maxLoops),\n forceSequential: options.sequential\n }\n );\n \n console.log('\u2705 Orchestration completed!');\n console.log(`\uD83D\uDCCA Results: ${result.completedLoops.length} successful, ${result.failedLoops.length} failed`);\n console.log(`\u23F1\uFE0F Total duration: ${Math.round(result.totalDuration / 1000)}s`);\n \n if (result.insights.length > 0) {\n console.log('\\n\uD83D\uDCA1 Insights:');\n result.insights.forEach(insight => console.log(` \u2022 ${insight}`));\n }\n \n } catch (error: unknown) {\n logger.error('Orchestration failed', error as Error);\n console.error('\u274C Orchestration failed:', (error as Error).message);\n }\n });\n });\n\n // Pattern learning command\n ralph\n .command('learn')\n .description('Learn patterns from completed loops')\n .option('--task-type <type>', 'Learn patterns for specific task type')\n .action(async (options) => {\n return trace.command('ralph-learn', options, async () => {\n try {\n console.log('\uD83E\uDDE0 Learning patterns from completed loops...');\n \n await patternLearner.initialize();\n \n const patterns = options.taskType ?\n await patternLearner.learnForTaskType(options.taskType) :\n await patternLearner.learnFromCompletedLoops();\n \n console.log(`\u2705 Learned ${patterns.length} patterns`);\n \n if (patterns.length > 0) {\n console.log('\\n\uD83D\uDCCA Top patterns:');\n patterns.slice(0, 5).forEach(pattern => {\n console.log(` \u2022 ${pattern.pattern} (${Math.round(pattern.confidence * 100)}% confidence)`);\n });\n }\n \n } catch (error: unknown) {\n logger.error('Pattern learning failed', error as Error);\n console.error('\u274C Pattern learning failed:', (error as Error).message);\n }\n });\n });\n\n // Enhanced debug command with visualization\n ralph\n .command('debug-enhanced')\n .description('Advanced debugging with visualization')\n .option('--loop-id <id>', 'Specific loop to debug')\n .option('--generate-report', 'Generate comprehensive debug report')\n .option('--timeline', 'Generate timeline visualization')\n .action(async (options) => {\n return trace.command('ralph-debug-enhanced', options, async () => {\n try {\n if (!existsSync('.ralph') && !options.loopId) {\n console.log('\u274C No Ralph loop found. Run a loop first or specify --loop-id');\n return;\n }\n \n console.log('\uD83D\uDD0D Starting enhanced debugging...');\n \n await ralphDebugger.initialize();\n \n const loopId = options.loopId || 'current';\n const debugSession = await ralphDebugger.startDebugSession(loopId, '.ralph');\n \n if (options.generateReport) {\n const report = await ralphDebugger.generateDebugReport(loopId);\n console.log(`\uD83D\uDCCB Debug report generated: ${report.exportPath}`);\n }\n \n if (options.timeline) {\n const timelinePath = await ralphDebugger.generateLoopTimeline(loopId);\n console.log(`\uD83D\uDCCA Timeline visualization: ${timelinePath}`);\n }\n \n console.log('\uD83D\uDD0D Debug analysis complete');\n \n } catch (error: unknown) {\n logger.error('Enhanced debugging failed', error as Error);\n console.error('\u274C Debug failed:', (error as Error).message);\n }\n });\n });\n\n return ralph;\n}\n\nexport default createRalphCommand;"],
|
|
5
|
+
"mappings": "AAKA,SAAS,eAAe;AACxB,SAAS,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ist/cli/index.js
CHANGED
|
@@ -28,6 +28,7 @@ import clearCommand from "./commands/clear.js";
|
|
|
28
28
|
import createWorkflowCommand from "./commands/workflow.js";
|
|
29
29
|
import monitorCommand from "./commands/monitor.js";
|
|
30
30
|
import qualityCommand from "./commands/quality.js";
|
|
31
|
+
import createRalphCommand from "./commands/ralph.js";
|
|
31
32
|
import { registerLoginCommand } from "./commands/login.js";
|
|
32
33
|
import { registerSignupCommand } from "./commands/signup.js";
|
|
33
34
|
import { registerLogoutCommand, registerDbCommands } from "./commands/db.js";
|
|
@@ -329,6 +330,7 @@ program.addCommand(clearCommand);
|
|
|
329
330
|
program.addCommand(createWorkflowCommand());
|
|
330
331
|
program.addCommand(monitorCommand);
|
|
331
332
|
program.addCommand(qualityCommand);
|
|
333
|
+
program.addCommand(createRalphCommand());
|
|
332
334
|
program.command("dashboard").description("Display monitoring dashboard in terminal").option("-w, --watch", "Auto-refresh dashboard").option("-i, --interval <seconds>", "Refresh interval in seconds", "5").action(async (options) => {
|
|
333
335
|
const { dashboardCommand } = await import("./commands/dashboard.js");
|
|
334
336
|
await dashboardCommand.handler(options);
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/cli/index.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env node\n/**\n * StackMemory CLI\n * Command-line interface for StackMemory operations\n */\n\n// Set environment flag for CLI usage to skip async context bridge\nprocess.env['STACKMEMORY_CLI'] = 'true';\n\n// Load environment variables\nimport 'dotenv/config';\n\n// Initialize tracing system early\nimport { initializeTracing, trace } from '../core/trace/index.js';\ninitializeTracing();\n\nimport { program } from 'commander';\nimport { logger } from '../core/monitoring/logger.js';\nimport { FrameManager } from '../core/context/frame-manager.js';\nimport { sessionManager, FrameQueryMode } from '../core/session/index.js';\nimport { sharedContextLayer } from '../core/context/shared-context-layer.js';\nimport { UpdateChecker } from '../core/utils/update-checker.js';\nimport { ProgressTracker } from '../core/monitoring/progress-tracker.js';\nimport { registerProjectCommands } from './commands/projects.js';\nimport { registerLinearCommands } from './commands/linear.js';\nimport { createSessionCommands } from './commands/session.js';\nimport { registerWorktreeCommands } from './commands/worktree.js';\nimport { registerOnboardingCommand } from './commands/onboard.js';\nimport { createTaskCommands } from './commands/tasks.js';\nimport { createSearchCommand } from './commands/search.js';\nimport { createLogCommand } from './commands/log.js';\nimport { createContextCommands } from './commands/context.js';\nimport { createConfigCommand } from './commands/config.js';\nimport { createHandoffCommand } from './commands/handoff.js';\nimport { createStorageCommand } from './commands/storage.js';\nimport { createSkillsCommand } from './commands/skills.js';\nimport { createTestCommand } from './commands/test.js';\nimport clearCommand from './commands/clear.js';\nimport createWorkflowCommand from './commands/workflow.js';\nimport monitorCommand from './commands/monitor.js';\nimport qualityCommand from './commands/quality.js';\nimport { registerLoginCommand } from './commands/login.js';\nimport { registerSignupCommand } from './commands/signup.js';\nimport { registerLogoutCommand, registerDbCommands } from './commands/db.js';\nimport { ProjectManager } from '../core/projects/project-manager.js';\nimport Database from 'better-sqlite3';\nimport { join } from 'path';\nimport { existsSync, mkdirSync } from 'fs';\n\nconst VERSION = '0.3.21';\n\n// Check for updates on CLI startup\nUpdateChecker.checkForUpdates(VERSION, true).catch(() => {\n // Silently ignore errors\n});\n\nprogram\n .name('stackmemory')\n .description(\n 'Lossless memory runtime for AI coding tools - organizes context as a call stack instead of linear chat logs, with team collaboration and infinite retention'\n )\n .version(VERSION);\n\nprogram\n .command('init')\n .description('Initialize StackMemory in current project')\n .action(async () => {\n try {\n const projectRoot = process.cwd();\n const dbDir = join(projectRoot, '.stackmemory');\n\n if (!existsSync(dbDir)) {\n mkdirSync(dbDir, { recursive: true });\n }\n\n const dbPath = join(dbDir, 'context.db');\n const db = new Database(dbPath);\n new FrameManager(db, 'cli-project');\n\n logger.info('StackMemory initialized successfully', { projectRoot });\n console.log('\u2705 StackMemory initialized in', projectRoot);\n\n db.close();\n } catch (error: unknown) {\n logger.error('Failed to initialize StackMemory', error as Error);\n console.error('\u274C Initialization failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\nprogram\n .command('status')\n .description('Show current StackMemory status')\n .option('--all', 'Show all active frames across sessions')\n .option('--project', 'Show all active frames in current project')\n .option('--session <id>', 'Show frames for specific session')\n .action(async (options) => {\n return trace.command('stackmemory-status', options, async () => {\n try {\n const projectRoot = process.cwd();\n const dbPath = join(projectRoot, '.stackmemory', 'context.db');\n\n if (!existsSync(dbPath)) {\n console.log(\n '\u274C StackMemory not initialized. Run \"stackmemory init\" first.'\n );\n return;\n }\n\n // Check for updates and display if available\n await UpdateChecker.checkForUpdates(VERSION);\n\n // Initialize session manager and shared context\n await sessionManager.initialize();\n await sharedContextLayer.initialize();\n\n const session = await sessionManager.getOrCreateSession({\n projectPath: projectRoot,\n sessionId: options.session,\n });\n\n // Auto-discover shared context on startup\n const contextDiscovery = await sharedContextLayer.autoDiscoverContext();\n\n // Show context hints if available\n if (\n contextDiscovery.hasSharedContext &&\n contextDiscovery.sessionCount > 1\n ) {\n console.log(`\\n\uD83D\uDCA1 Shared Context Available:`);\n console.log(\n ` ${contextDiscovery.sessionCount} sessions with shared context`\n );\n\n if (contextDiscovery.recentPatterns.length > 0) {\n console.log(` Recent patterns:`);\n contextDiscovery.recentPatterns.slice(0, 3).forEach((p) => {\n console.log(\n ` \u2022 ${p.type}: ${p.pattern.slice(0, 50)} (${p.frequency}x)`\n );\n });\n }\n\n if (contextDiscovery.lastDecisions.length > 0) {\n console.log(\n ` Last decision: ${contextDiscovery.lastDecisions[0].decision.slice(0, 60)}`\n );\n }\n }\n\n const db = new Database(dbPath);\n const frameManager = new FrameManager(db, session.projectId);\n\n // Set query mode based on options\n if (options.all) {\n frameManager.setQueryMode(FrameQueryMode.ALL_ACTIVE);\n } else if (options.project) {\n frameManager.setQueryMode(FrameQueryMode.PROJECT_ACTIVE);\n }\n\n const activeFrames = frameManager.getActiveFramePath();\n const stackDepth = frameManager.getStackDepth();\n\n // Always get total counts across all sessions\n const totalStats = db\n .prepare(\n `\n SELECT \n COUNT(*) as total_frames,\n SUM(CASE WHEN state = 'active' THEN 1 ELSE 0 END) as active_frames,\n SUM(CASE WHEN state = 'closed' THEN 1 ELSE 0 END) as closed_frames,\n COUNT(DISTINCT run_id) as total_sessions\n FROM frames\n WHERE project_id = ?\n `\n )\n .get(session.projectId) as {\n total_frames: number;\n active_frames: number;\n closed_frames: number;\n total_sessions: number;\n };\n\n const contextCount = db\n .prepare(\n `\n SELECT COUNT(*) as count FROM contexts\n `\n )\n .get() as { count: number };\n\n const eventCount = db\n .prepare(\n `\n SELECT COUNT(*) as count FROM events e\n JOIN frames f ON e.frame_id = f.frame_id\n WHERE f.project_id = ?\n `\n )\n .get(session.projectId) as { count: number };\n\n console.log('\uD83D\uDCCA StackMemory Status:');\n console.log(\n ` Session: ${session.sessionId.slice(0, 8)} (${session.state}, ${Math.round((Date.now() - session.startedAt) / 1000 / 60)}min old)`\n );\n console.log(` Project: ${session.projectId}`);\n if (session.branch) {\n console.log(` Branch: ${session.branch}`);\n }\n\n // Show total database statistics\n console.log(`\\n Database Statistics (this project):`);\n console.log(\n ` Frames: ${totalStats.total_frames || 0} (${totalStats.active_frames || 0} active, ${totalStats.closed_frames || 0} closed)`\n );\n console.log(` Events: ${eventCount.count || 0}`);\n console.log(` Sessions: ${totalStats.total_sessions || 0}`);\n console.log(\n ` Cached contexts: ${contextCount.count || 0} (global)`\n );\n\n // Show recent activity\n const recentFrames = db\n .prepare(\n `\n SELECT name, type, state, datetime(created_at, 'unixepoch') as created\n FROM frames\n WHERE project_id = ?\n ORDER BY created_at DESC\n LIMIT 3\n `\n )\n .all(session.projectId) as Array<{\n name: string;\n type: string;\n state: string;\n created: string;\n }>;\n\n if (recentFrames.length > 0) {\n console.log(`\\n Recent Activity:`);\n recentFrames.forEach((f) => {\n const stateIcon = f.state === 'active' ? '\uD83D\uDFE2' : '\u26AB';\n console.log(\n ` ${stateIcon} ${f.name} [${f.type}] - ${f.created}`\n );\n });\n }\n\n console.log(`\\n Current Session:`);\n console.log(` Stack depth: ${stackDepth}`);\n console.log(` Active frames: ${activeFrames.length}`);\n\n if (activeFrames.length > 0) {\n activeFrames.forEach((frame, i) => {\n const indent = ' ' + ' '.repeat(frame.depth || i);\n const prefix = i === 0 ? '\u2514\u2500' : ' \u2514\u2500';\n console.log(`${indent}${prefix} ${frame.name} [${frame.type}]`);\n });\n }\n\n // Show other sessions if in default mode\n if (!options.all && !options.project) {\n const otherSessions = await sessionManager.listSessions({\n projectId: session.projectId,\n state: 'active',\n });\n\n const otherActive = otherSessions.filter(\n (s) => s.sessionId !== session.sessionId\n );\n if (otherActive.length > 0) {\n console.log(`\\n Other Active Sessions (same project):`);\n otherActive.forEach((s) => {\n const age = Math.round(\n (Date.now() - s.lastActiveAt) / 1000 / 60 / 60\n );\n console.log(\n ` - ${s.sessionId.slice(0, 8)}: ${s.branch || 'main'}, ${age}h old`\n );\n });\n console.log(`\\n Tip: Use --all to see frames across sessions`);\n }\n }\n\n db.close();\n } catch (error: unknown) {\n logger.error('Failed to get status', error as Error);\n console.error('\u274C Status check failed:', (error as Error).message);\n process.exit(1);\n }\n });\n });\n\nprogram\n .command('update-check')\n .description('Check for StackMemory updates')\n .action(async () => {\n try {\n console.log('\uD83D\uDD0D Checking for updates...');\n await UpdateChecker.forceCheck(VERSION);\n } catch (error: unknown) {\n logger.error('Update check failed', error as Error);\n console.error('\u274C Update check failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\nprogram\n .command('progress')\n .description('Show current progress and recent changes')\n .action(async () => {\n try {\n const projectRoot = process.cwd();\n const dbPath = join(projectRoot, '.stackmemory', 'context.db');\n\n if (!existsSync(dbPath)) {\n console.log(\n '\u274C StackMemory not initialized. Run \"stackmemory init\" first.'\n );\n return;\n }\n\n const progress = new ProgressTracker(projectRoot);\n console.log(progress.getSummary());\n } catch (error: unknown) {\n logger.error('Failed to show progress', error as Error);\n console.error('\u274C Failed to show progress:', (error as Error).message);\n process.exit(1);\n }\n });\n\nprogram\n .command('mcp-server')\n .description('Start StackMemory MCP server for Claude Desktop')\n .option('-p, --project <path>', 'Project root directory', process.cwd())\n .action(async (options) => {\n try {\n const { runMCPServer } = await import('../integrations/mcp/server.js');\n\n // Set project root\n process.env['PROJECT_ROOT'] = options.project;\n\n console.log('\uD83D\uDE80 Starting StackMemory MCP Server...');\n console.log(` Project: ${options.project}`);\n console.log(` Version: ${VERSION}`);\n\n // Check for updates silently\n UpdateChecker.checkForUpdates(VERSION, true).catch(() => {});\n\n // Start the MCP server\n await runMCPServer();\n } catch (error: unknown) {\n logger.error('Failed to start MCP server', error as Error);\n console.error('\u274C MCP server failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\n// Add test context command\nprogram\n .command('context:test')\n .description('Test context persistence by creating sample frames')\n .action(async () => {\n try {\n const projectRoot = process.cwd();\n const dbPath = join(projectRoot, '.stackmemory', 'context.db');\n\n if (!existsSync(dbPath)) {\n console.log(\n '\u274C StackMemory not initialized. Run \"stackmemory init\" first.'\n );\n return;\n }\n\n const db = new Database(dbPath);\n const frameManager = new FrameManager(db, 'cli-project');\n\n // Create test frames\n console.log('\uD83D\uDCDD Creating test context frames...');\n\n const rootFrame = frameManager.createFrame({\n type: 'task',\n name: 'Test Session',\n inputs: { test: true, timestamp: new Date().toISOString() },\n });\n\n const taskFrame = frameManager.createFrame({\n type: 'subtask',\n name: 'Sample Task',\n inputs: { description: 'Testing context persistence' },\n parentFrameId: rootFrame,\n });\n\n const commandFrame = frameManager.createFrame({\n type: 'tool_scope',\n name: 'test-command',\n inputs: { args: ['--test'] },\n parentFrameId: taskFrame,\n });\n\n // Add some events\n frameManager.addEvent(\n 'observation',\n {\n message: 'Test event recorded',\n },\n commandFrame\n );\n\n console.log('\u2705 Test frames created!');\n console.log(`\uD83D\uDCCA Stack depth: ${frameManager.getStackDepth()}`);\n console.log(\n `\uD83D\uDD04 Active frames: ${frameManager.getActiveFramePath().length}`\n );\n\n // Close one frame to test state changes\n frameManager.closeFrame(commandFrame);\n console.log(\n `\uD83D\uDCCA After closing command frame: depth = ${frameManager.getStackDepth()}`\n );\n\n db.close();\n } catch (error: unknown) {\n logger.error('Test context failed', error as Error);\n console.error('\u274C Test failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\n// Register project management commands\n// Register command modules\nregisterOnboardingCommand(program);\nregisterSignupCommand(program);\nregisterLoginCommand(program);\nregisterLogoutCommand(program);\nregisterDbCommands(program);\nregisterProjectCommands(program);\nregisterWorktreeCommands(program);\n\n// Register Linear integration commands\nregisterLinearCommands(program);\n\n// Register session management commands\nprogram.addCommand(createSessionCommands());\n\n// Register enhanced CLI commands\nprogram.addCommand(createTaskCommands());\nprogram.addCommand(createSearchCommand());\nprogram.addCommand(createLogCommand());\nprogram.addCommand(createContextCommands());\nprogram.addCommand(createConfigCommand());\nprogram.addCommand(createHandoffCommand());\nprogram.addCommand(createStorageCommand());\nprogram.addCommand(createSkillsCommand());\nprogram.addCommand(createTestCommand());\nprogram.addCommand(clearCommand);\nprogram.addCommand(createWorkflowCommand());\nprogram.addCommand(monitorCommand);\nprogram.addCommand(qualityCommand);\n\n// Register dashboard command\nprogram\n .command('dashboard')\n .description('Display monitoring dashboard in terminal')\n .option('-w, --watch', 'Auto-refresh dashboard')\n .option('-i, --interval <seconds>', 'Refresh interval in seconds', '5')\n .action(async (options) => {\n const { dashboardCommand } = await import('./commands/dashboard.js');\n await dashboardCommand.handler(options);\n });\n\n// Auto-detect current project on startup\nif (process.argv.length > 2) {\n const manager = ProjectManager.getInstance();\n manager.detectProject().catch(() => {\n // Silently fail if not in a project directory\n });\n}\n\n// Only parse when running as main module (not when imported for testing)\nconst isMainModule =\n import.meta.url === `file://${process.argv[1]}` ||\n process.argv[1]?.endsWith('/stackmemory') ||\n process.argv[1]?.endsWith('index.ts') ||\n process.argv[1]?.includes('tsx');\n\nif (isMainModule) {\n program.parse();\n}\n\nexport { program };\n"],
|
|
5
|
-
"mappings": ";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AAC1C,QAAQ,WAAW,cAAc;AACjC,QAAQ,WAAW,cAAc;
|
|
4
|
+
"sourcesContent": ["#!/usr/bin/env node\n/**\n * StackMemory CLI\n * Command-line interface for StackMemory operations\n */\n\n// Set environment flag for CLI usage to skip async context bridge\nprocess.env['STACKMEMORY_CLI'] = 'true';\n\n// Load environment variables\nimport 'dotenv/config';\n\n// Initialize tracing system early\nimport { initializeTracing, trace } from '../core/trace/index.js';\ninitializeTracing();\n\nimport { program } from 'commander';\nimport { logger } from '../core/monitoring/logger.js';\nimport { FrameManager } from '../core/context/frame-manager.js';\nimport { sessionManager, FrameQueryMode } from '../core/session/index.js';\nimport { sharedContextLayer } from '../core/context/shared-context-layer.js';\nimport { UpdateChecker } from '../core/utils/update-checker.js';\nimport { ProgressTracker } from '../core/monitoring/progress-tracker.js';\nimport { registerProjectCommands } from './commands/projects.js';\nimport { registerLinearCommands } from './commands/linear.js';\nimport { createSessionCommands } from './commands/session.js';\nimport { registerWorktreeCommands } from './commands/worktree.js';\nimport { registerOnboardingCommand } from './commands/onboard.js';\nimport { createTaskCommands } from './commands/tasks.js';\nimport { createSearchCommand } from './commands/search.js';\nimport { createLogCommand } from './commands/log.js';\nimport { createContextCommands } from './commands/context.js';\nimport { createConfigCommand } from './commands/config.js';\nimport { createHandoffCommand } from './commands/handoff.js';\nimport { createStorageCommand } from './commands/storage.js';\nimport { createSkillsCommand } from './commands/skills.js';\nimport { createTestCommand } from './commands/test.js';\nimport clearCommand from './commands/clear.js';\nimport createWorkflowCommand from './commands/workflow.js';\nimport monitorCommand from './commands/monitor.js';\nimport qualityCommand from './commands/quality.js';\nimport createRalphCommand from './commands/ralph.js';\nimport { registerLoginCommand } from './commands/login.js';\nimport { registerSignupCommand } from './commands/signup.js';\nimport { registerLogoutCommand, registerDbCommands } from './commands/db.js';\nimport { ProjectManager } from '../core/projects/project-manager.js';\nimport Database from 'better-sqlite3';\nimport { join } from 'path';\nimport { existsSync, mkdirSync } from 'fs';\n\nconst VERSION = '0.3.21';\n\n// Check for updates on CLI startup\nUpdateChecker.checkForUpdates(VERSION, true).catch(() => {\n // Silently ignore errors\n});\n\nprogram\n .name('stackmemory')\n .description(\n 'Lossless memory runtime for AI coding tools - organizes context as a call stack instead of linear chat logs, with team collaboration and infinite retention'\n )\n .version(VERSION);\n\nprogram\n .command('init')\n .description('Initialize StackMemory in current project')\n .action(async () => {\n try {\n const projectRoot = process.cwd();\n const dbDir = join(projectRoot, '.stackmemory');\n\n if (!existsSync(dbDir)) {\n mkdirSync(dbDir, { recursive: true });\n }\n\n const dbPath = join(dbDir, 'context.db');\n const db = new Database(dbPath);\n new FrameManager(db, 'cli-project');\n\n logger.info('StackMemory initialized successfully', { projectRoot });\n console.log('\u2705 StackMemory initialized in', projectRoot);\n\n db.close();\n } catch (error: unknown) {\n logger.error('Failed to initialize StackMemory', error as Error);\n console.error('\u274C Initialization failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\nprogram\n .command('status')\n .description('Show current StackMemory status')\n .option('--all', 'Show all active frames across sessions')\n .option('--project', 'Show all active frames in current project')\n .option('--session <id>', 'Show frames for specific session')\n .action(async (options) => {\n return trace.command('stackmemory-status', options, async () => {\n try {\n const projectRoot = process.cwd();\n const dbPath = join(projectRoot, '.stackmemory', 'context.db');\n\n if (!existsSync(dbPath)) {\n console.log(\n '\u274C StackMemory not initialized. Run \"stackmemory init\" first.'\n );\n return;\n }\n\n // Check for updates and display if available\n await UpdateChecker.checkForUpdates(VERSION);\n\n // Initialize session manager and shared context\n await sessionManager.initialize();\n await sharedContextLayer.initialize();\n\n const session = await sessionManager.getOrCreateSession({\n projectPath: projectRoot,\n sessionId: options.session,\n });\n\n // Auto-discover shared context on startup\n const contextDiscovery = await sharedContextLayer.autoDiscoverContext();\n\n // Show context hints if available\n if (\n contextDiscovery.hasSharedContext &&\n contextDiscovery.sessionCount > 1\n ) {\n console.log(`\\n\uD83D\uDCA1 Shared Context Available:`);\n console.log(\n ` ${contextDiscovery.sessionCount} sessions with shared context`\n );\n\n if (contextDiscovery.recentPatterns.length > 0) {\n console.log(` Recent patterns:`);\n contextDiscovery.recentPatterns.slice(0, 3).forEach((p) => {\n console.log(\n ` \u2022 ${p.type}: ${p.pattern.slice(0, 50)} (${p.frequency}x)`\n );\n });\n }\n\n if (contextDiscovery.lastDecisions.length > 0) {\n console.log(\n ` Last decision: ${contextDiscovery.lastDecisions[0].decision.slice(0, 60)}`\n );\n }\n }\n\n const db = new Database(dbPath);\n const frameManager = new FrameManager(db, session.projectId);\n\n // Set query mode based on options\n if (options.all) {\n frameManager.setQueryMode(FrameQueryMode.ALL_ACTIVE);\n } else if (options.project) {\n frameManager.setQueryMode(FrameQueryMode.PROJECT_ACTIVE);\n }\n\n const activeFrames = frameManager.getActiveFramePath();\n const stackDepth = frameManager.getStackDepth();\n\n // Always get total counts across all sessions\n const totalStats = db\n .prepare(\n `\n SELECT \n COUNT(*) as total_frames,\n SUM(CASE WHEN state = 'active' THEN 1 ELSE 0 END) as active_frames,\n SUM(CASE WHEN state = 'closed' THEN 1 ELSE 0 END) as closed_frames,\n COUNT(DISTINCT run_id) as total_sessions\n FROM frames\n WHERE project_id = ?\n `\n )\n .get(session.projectId) as {\n total_frames: number;\n active_frames: number;\n closed_frames: number;\n total_sessions: number;\n };\n\n const contextCount = db\n .prepare(\n `\n SELECT COUNT(*) as count FROM contexts\n `\n )\n .get() as { count: number };\n\n const eventCount = db\n .prepare(\n `\n SELECT COUNT(*) as count FROM events e\n JOIN frames f ON e.frame_id = f.frame_id\n WHERE f.project_id = ?\n `\n )\n .get(session.projectId) as { count: number };\n\n console.log('\uD83D\uDCCA StackMemory Status:');\n console.log(\n ` Session: ${session.sessionId.slice(0, 8)} (${session.state}, ${Math.round((Date.now() - session.startedAt) / 1000 / 60)}min old)`\n );\n console.log(` Project: ${session.projectId}`);\n if (session.branch) {\n console.log(` Branch: ${session.branch}`);\n }\n\n // Show total database statistics\n console.log(`\\n Database Statistics (this project):`);\n console.log(\n ` Frames: ${totalStats.total_frames || 0} (${totalStats.active_frames || 0} active, ${totalStats.closed_frames || 0} closed)`\n );\n console.log(` Events: ${eventCount.count || 0}`);\n console.log(` Sessions: ${totalStats.total_sessions || 0}`);\n console.log(\n ` Cached contexts: ${contextCount.count || 0} (global)`\n );\n\n // Show recent activity\n const recentFrames = db\n .prepare(\n `\n SELECT name, type, state, datetime(created_at, 'unixepoch') as created\n FROM frames\n WHERE project_id = ?\n ORDER BY created_at DESC\n LIMIT 3\n `\n )\n .all(session.projectId) as Array<{\n name: string;\n type: string;\n state: string;\n created: string;\n }>;\n\n if (recentFrames.length > 0) {\n console.log(`\\n Recent Activity:`);\n recentFrames.forEach((f) => {\n const stateIcon = f.state === 'active' ? '\uD83D\uDFE2' : '\u26AB';\n console.log(\n ` ${stateIcon} ${f.name} [${f.type}] - ${f.created}`\n );\n });\n }\n\n console.log(`\\n Current Session:`);\n console.log(` Stack depth: ${stackDepth}`);\n console.log(` Active frames: ${activeFrames.length}`);\n\n if (activeFrames.length > 0) {\n activeFrames.forEach((frame, i) => {\n const indent = ' ' + ' '.repeat(frame.depth || i);\n const prefix = i === 0 ? '\u2514\u2500' : ' \u2514\u2500';\n console.log(`${indent}${prefix} ${frame.name} [${frame.type}]`);\n });\n }\n\n // Show other sessions if in default mode\n if (!options.all && !options.project) {\n const otherSessions = await sessionManager.listSessions({\n projectId: session.projectId,\n state: 'active',\n });\n\n const otherActive = otherSessions.filter(\n (s) => s.sessionId !== session.sessionId\n );\n if (otherActive.length > 0) {\n console.log(`\\n Other Active Sessions (same project):`);\n otherActive.forEach((s) => {\n const age = Math.round(\n (Date.now() - s.lastActiveAt) / 1000 / 60 / 60\n );\n console.log(\n ` - ${s.sessionId.slice(0, 8)}: ${s.branch || 'main'}, ${age}h old`\n );\n });\n console.log(`\\n Tip: Use --all to see frames across sessions`);\n }\n }\n\n db.close();\n } catch (error: unknown) {\n logger.error('Failed to get status', error as Error);\n console.error('\u274C Status check failed:', (error as Error).message);\n process.exit(1);\n }\n });\n });\n\nprogram\n .command('update-check')\n .description('Check for StackMemory updates')\n .action(async () => {\n try {\n console.log('\uD83D\uDD0D Checking for updates...');\n await UpdateChecker.forceCheck(VERSION);\n } catch (error: unknown) {\n logger.error('Update check failed', error as Error);\n console.error('\u274C Update check failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\nprogram\n .command('progress')\n .description('Show current progress and recent changes')\n .action(async () => {\n try {\n const projectRoot = process.cwd();\n const dbPath = join(projectRoot, '.stackmemory', 'context.db');\n\n if (!existsSync(dbPath)) {\n console.log(\n '\u274C StackMemory not initialized. Run \"stackmemory init\" first.'\n );\n return;\n }\n\n const progress = new ProgressTracker(projectRoot);\n console.log(progress.getSummary());\n } catch (error: unknown) {\n logger.error('Failed to show progress', error as Error);\n console.error('\u274C Failed to show progress:', (error as Error).message);\n process.exit(1);\n }\n });\n\nprogram\n .command('mcp-server')\n .description('Start StackMemory MCP server for Claude Desktop')\n .option('-p, --project <path>', 'Project root directory', process.cwd())\n .action(async (options) => {\n try {\n const { runMCPServer } = await import('../integrations/mcp/server.js');\n\n // Set project root\n process.env['PROJECT_ROOT'] = options.project;\n\n console.log('\uD83D\uDE80 Starting StackMemory MCP Server...');\n console.log(` Project: ${options.project}`);\n console.log(` Version: ${VERSION}`);\n\n // Check for updates silently\n UpdateChecker.checkForUpdates(VERSION, true).catch(() => {});\n\n // Start the MCP server\n await runMCPServer();\n } catch (error: unknown) {\n logger.error('Failed to start MCP server', error as Error);\n console.error('\u274C MCP server failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\n// Add test context command\nprogram\n .command('context:test')\n .description('Test context persistence by creating sample frames')\n .action(async () => {\n try {\n const projectRoot = process.cwd();\n const dbPath = join(projectRoot, '.stackmemory', 'context.db');\n\n if (!existsSync(dbPath)) {\n console.log(\n '\u274C StackMemory not initialized. Run \"stackmemory init\" first.'\n );\n return;\n }\n\n const db = new Database(dbPath);\n const frameManager = new FrameManager(db, 'cli-project');\n\n // Create test frames\n console.log('\uD83D\uDCDD Creating test context frames...');\n\n const rootFrame = frameManager.createFrame({\n type: 'task',\n name: 'Test Session',\n inputs: { test: true, timestamp: new Date().toISOString() },\n });\n\n const taskFrame = frameManager.createFrame({\n type: 'subtask',\n name: 'Sample Task',\n inputs: { description: 'Testing context persistence' },\n parentFrameId: rootFrame,\n });\n\n const commandFrame = frameManager.createFrame({\n type: 'tool_scope',\n name: 'test-command',\n inputs: { args: ['--test'] },\n parentFrameId: taskFrame,\n });\n\n // Add some events\n frameManager.addEvent(\n 'observation',\n {\n message: 'Test event recorded',\n },\n commandFrame\n );\n\n console.log('\u2705 Test frames created!');\n console.log(`\uD83D\uDCCA Stack depth: ${frameManager.getStackDepth()}`);\n console.log(\n `\uD83D\uDD04 Active frames: ${frameManager.getActiveFramePath().length}`\n );\n\n // Close one frame to test state changes\n frameManager.closeFrame(commandFrame);\n console.log(\n `\uD83D\uDCCA After closing command frame: depth = ${frameManager.getStackDepth()}`\n );\n\n db.close();\n } catch (error: unknown) {\n logger.error('Test context failed', error as Error);\n console.error('\u274C Test failed:', (error as Error).message);\n process.exit(1);\n }\n });\n\n// Register project management commands\n// Register command modules\nregisterOnboardingCommand(program);\nregisterSignupCommand(program);\nregisterLoginCommand(program);\nregisterLogoutCommand(program);\nregisterDbCommands(program);\nregisterProjectCommands(program);\nregisterWorktreeCommands(program);\n\n// Register Linear integration commands\nregisterLinearCommands(program);\n\n// Register session management commands\nprogram.addCommand(createSessionCommands());\n\n// Register enhanced CLI commands\nprogram.addCommand(createTaskCommands());\nprogram.addCommand(createSearchCommand());\nprogram.addCommand(createLogCommand());\nprogram.addCommand(createContextCommands());\nprogram.addCommand(createConfigCommand());\nprogram.addCommand(createHandoffCommand());\nprogram.addCommand(createStorageCommand());\nprogram.addCommand(createSkillsCommand());\nprogram.addCommand(createTestCommand());\nprogram.addCommand(clearCommand);\nprogram.addCommand(createWorkflowCommand());\nprogram.addCommand(monitorCommand);\nprogram.addCommand(qualityCommand);\nprogram.addCommand(createRalphCommand());\n\n// Register dashboard command\nprogram\n .command('dashboard')\n .description('Display monitoring dashboard in terminal')\n .option('-w, --watch', 'Auto-refresh dashboard')\n .option('-i, --interval <seconds>', 'Refresh interval in seconds', '5')\n .action(async (options) => {\n const { dashboardCommand } = await import('./commands/dashboard.js');\n await dashboardCommand.handler(options);\n });\n\n// Auto-detect current project on startup\nif (process.argv.length > 2) {\n const manager = ProjectManager.getInstance();\n manager.detectProject().catch(() => {\n // Silently fail if not in a project directory\n });\n}\n\n// Only parse when running as main module (not when imported for testing)\nconst isMainModule =\n import.meta.url === `file://${process.argv[1]}` ||\n process.argv[1]?.endsWith('/stackmemory') ||\n process.argv[1]?.endsWith('index.ts') ||\n process.argv[1]?.includes('tsx');\n\nif (isMainModule) {\n program.parse();\n}\n\nexport { program };\n"],
|
|
5
|
+
"mappings": ";AAOA,QAAQ,IAAI,iBAAiB,IAAI;AAGjC,OAAO;AAGP,SAAS,mBAAmB,aAAa;AACzC,kBAAkB;AAElB,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB,sBAAsB;AAC/C,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AACvC,SAAS,6BAA6B;AACtC,SAAS,gCAAgC;AACzC,SAAS,iCAAiC;AAC1C,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AACpC,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AACrC,SAAS,4BAA4B;AACrC,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,OAAO,kBAAkB;AACzB,OAAO,2BAA2B;AAClC,OAAO,oBAAoB;AAC3B,OAAO,oBAAoB;AAC3B,OAAO,wBAAwB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,6BAA6B;AACtC,SAAS,uBAAuB,0BAA0B;AAC1D,SAAS,s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