@stackmemoryai/stackmemory 0.5.23 → 0.5.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.
Files changed (69) hide show
  1. package/dist/cli/claude-sm.js +2 -0
  2. package/dist/cli/claude-sm.js.map +2 -2
  3. package/dist/cli/commands/discovery.js +279 -0
  4. package/dist/cli/commands/discovery.js.map +7 -0
  5. package/dist/cli/index.js +2 -0
  6. package/dist/cli/index.js.map +2 -2
  7. package/dist/core/retrieval/llm-context-retrieval.js +1 -3
  8. package/dist/core/retrieval/llm-context-retrieval.js.map +3 -3
  9. package/dist/integrations/mcp/handlers/discovery-handlers.js +497 -0
  10. package/dist/integrations/mcp/handlers/discovery-handlers.js.map +7 -0
  11. package/dist/integrations/mcp/handlers/index.js +40 -12
  12. package/dist/integrations/mcp/handlers/index.js.map +2 -2
  13. package/dist/integrations/mcp/server.js +270 -0
  14. package/dist/integrations/mcp/server.js.map +2 -2
  15. package/dist/integrations/mcp/tool-definitions.js +141 -5
  16. package/dist/integrations/mcp/tool-definitions.js.map +2 -2
  17. package/package.json +1 -1
  18. package/dist/cli/commands/agent.js +0 -286
  19. package/dist/cli/commands/agent.js.map +0 -7
  20. package/dist/cli/commands/chromadb.js +0 -482
  21. package/dist/cli/commands/chromadb.js.map +0 -7
  22. package/dist/cli/commands/gc.js +0 -251
  23. package/dist/cli/commands/gc.js.map +0 -7
  24. package/dist/cli/commands/infinite-storage.js +0 -292
  25. package/dist/cli/commands/infinite-storage.js.map +0 -7
  26. package/dist/cli/commands/linear-create.js +0 -171
  27. package/dist/cli/commands/linear-create.js.map +0 -7
  28. package/dist/cli/commands/linear-list.js +0 -103
  29. package/dist/cli/commands/linear-list.js.map +0 -7
  30. package/dist/cli/commands/linear-migrate.js +0 -64
  31. package/dist/cli/commands/linear-migrate.js.map +0 -7
  32. package/dist/cli/commands/linear-test.js +0 -134
  33. package/dist/cli/commands/linear-test.js.map +0 -7
  34. package/dist/cli/commands/tui.js +0 -77
  35. package/dist/cli/commands/tui.js.map +0 -7
  36. package/dist/cli/commands/webhook.js +0 -181
  37. package/dist/cli/commands/webhook.js.map +0 -7
  38. package/dist/cli/streamlined-cli.js +0 -144
  39. package/dist/cli/streamlined-cli.js.map +0 -7
  40. package/dist/core/events/event-bus.js +0 -110
  41. package/dist/core/events/event-bus.js.map +0 -7
  42. package/dist/core/frame/workflow-templates-stub.js +0 -42
  43. package/dist/core/frame/workflow-templates-stub.js.map +0 -7
  44. package/dist/core/plugins/plugin-interface.js +0 -87
  45. package/dist/core/plugins/plugin-interface.js.map +0 -7
  46. package/dist/core/session/clear-survival-stub.js +0 -53
  47. package/dist/core/session/clear-survival-stub.js.map +0 -7
  48. package/dist/core/storage/chromadb-simple.js +0 -172
  49. package/dist/core/storage/chromadb-simple.js.map +0 -7
  50. package/dist/core/storage/simplified-storage.js +0 -328
  51. package/dist/core/storage/simplified-storage.js.map +0 -7
  52. package/dist/features/tasks/pebbles-task-store.js +0 -647
  53. package/dist/features/tasks/pebbles-task-store.js.map +0 -7
  54. package/dist/integrations/linear/sync-enhanced.js +0 -202
  55. package/dist/integrations/linear/sync-enhanced.js.map +0 -7
  56. package/dist/plugins/linear/index.js +0 -166
  57. package/dist/plugins/linear/index.js.map +0 -7
  58. package/dist/plugins/loader.js +0 -57
  59. package/dist/plugins/loader.js.map +0 -7
  60. package/dist/plugins/plugin-interface.js +0 -67
  61. package/dist/plugins/plugin-interface.js.map +0 -7
  62. package/dist/plugins/ralph/simple-ralph-plugin.js +0 -305
  63. package/dist/plugins/ralph/simple-ralph-plugin.js.map +0 -7
  64. package/dist/plugins/ralph/use-cases/code-generator.js +0 -151
  65. package/dist/plugins/ralph/use-cases/code-generator.js.map +0 -7
  66. package/dist/plugins/ralph/use-cases/test-generator.js +0 -201
  67. package/dist/plugins/ralph/use-cases/test-generator.js.map +0 -7
  68. package/dist/utils/logger.js +0 -52
  69. package/dist/utils/logger.js.map +0 -7
@@ -1,181 +0,0 @@
1
- import { Command } from "commander";
2
- import chalk from "chalk";
3
- import { LinearWebhookServer } from "../../integrations/linear/webhook-server.js";
4
- import { logger } from "../../core/monitoring/logger.js";
5
- import ngrok from "ngrok";
6
- function getEnv(key, defaultValue) {
7
- const value = process.env[key];
8
- if (value === void 0) {
9
- if (defaultValue !== void 0) return defaultValue;
10
- throw new Error(`Environment variable ${key} is required`);
11
- }
12
- return value;
13
- }
14
- function getOptionalEnv(key) {
15
- return process.env[key];
16
- }
17
- function webhookCommand() {
18
- const command = new Command("webhook");
19
- command.description("Manage webhook servers for real-time sync").option("-p, --port <port>", "Port to run webhook server on", "3456").option("-h, --host <host>", "Host to bind to", "localhost").option("--ngrok", "Create ngrok tunnel for public webhook URL").option("--secret <secret>", "Webhook secret for signature validation");
20
- command.command("start").description("Start the Linear webhook server").option("-p, --port <port>", "Port to run webhook server on", "3456").option("-h, --host <host>", "Host to bind to", "localhost").option("--ngrok", "Create ngrok tunnel for public webhook URL").option("--background", "Run in background (daemon mode)").action(async (options) => {
21
- try {
22
- console.log(
23
- chalk.cyan.bold("\n\u{1F4E1} Starting Linear Webhook Server...\n")
24
- );
25
- const server = new LinearWebhookServer({
26
- port: parseInt(options.port),
27
- host: options.host,
28
- webhookSecret: process.env["LINEAR_WEBHOOK_SECRET"]
29
- });
30
- await server.start();
31
- if (options.ngrok) {
32
- try {
33
- const url = await ngrok.connect({
34
- addr: options.port,
35
- subdomain: process.env["NGROK_SUBDOMAIN"],
36
- authtoken: process.env["NGROK_AUTH_TOKEN"]
37
- });
38
- console.log(chalk.green("\u2713") + chalk.bold(" Ngrok Tunnel Created"));
39
- console.log(chalk.cyan(" Public URL: ") + url);
40
- console.log(
41
- chalk.cyan(" Webhook URL: ") + url + "/webhook/linear"
42
- );
43
- console.log(
44
- chalk.yellow(
45
- "\n\u26A0 Add this webhook URL to your Linear settings:\n"
46
- )
47
- );
48
- console.log(
49
- chalk.white(` 1. Go to Linear Settings \u2192 API \u2192 Webhooks`)
50
- );
51
- console.log(chalk.white(` 2. Click "New webhook"`));
52
- console.log(chalk.white(` 3. Set URL to: ${url}/webhook/linear`));
53
- console.log(
54
- chalk.white(
55
- ` 4. Select events: Issues (all), Comments (optional)`
56
- )
57
- );
58
- console.log(
59
- chalk.white(
60
- ` 5. Copy the webhook secret to LINEAR_WEBHOOK_SECRET env var
61
- `
62
- )
63
- );
64
- } catch (error) {
65
- logger.warn("Failed to create ngrok tunnel:", error.message);
66
- console.log(
67
- chalk.yellow(" \u26A0 Ngrok tunnel failed, running locally only")
68
- );
69
- }
70
- } else {
71
- console.log(
72
- chalk.yellow(
73
- "\n\u{1F4A1} Tip: Use --ngrok flag to create a public webhook URL"
74
- )
75
- );
76
- }
77
- if (options.background) {
78
- console.log(chalk.dim("\nRunning in background mode..."));
79
- process.exit(0);
80
- } else {
81
- console.log(chalk.dim("\nPress Ctrl+C to stop the server\n"));
82
- }
83
- } catch (error) {
84
- logger.error("Failed to start webhook server:", error);
85
- console.error(
86
- chalk.red("\u2717 Failed to start webhook server:"),
87
- error.message
88
- );
89
- process.exit(1);
90
- }
91
- });
92
- command.command("stop").description("Stop the webhook server").action(async () => {
93
- console.log(chalk.yellow("Stopping webhook server..."));
94
- console.log(
95
- chalk.dim(
96
- "(This would stop a background webhook server if implemented)"
97
- )
98
- );
99
- });
100
- command.command("status").description("Check webhook server status").action(async () => {
101
- try {
102
- const response = await fetch("http://localhost:3456/health");
103
- if (response.ok) {
104
- const health = await response.json();
105
- console.log(chalk.green("\u2713") + chalk.bold(" Webhook Server Status"));
106
- console.log(chalk.cyan(" Status: ") + health.status);
107
- console.log(chalk.cyan(" Queue: ") + health.queue + " events");
108
- console.log(
109
- chalk.cyan(" Processing: ") + (health.processing ? "Yes" : "No")
110
- );
111
- console.log(chalk.cyan(" Timestamp: ") + health.timestamp);
112
- } else {
113
- console.log(chalk.red("\u2717 Webhook server not responding"));
114
- }
115
- } catch (error) {
116
- console.log(chalk.red("\u2717 Webhook server not running"));
117
- console.log(
118
- chalk.dim(' Run "stackmemory webhook start" to start the server')
119
- );
120
- }
121
- });
122
- command.command("test").description("Send a test webhook to verify configuration").option(
123
- "--url <url>",
124
- "Webhook URL to test",
125
- "http://localhost:3456/webhook/linear"
126
- ).action(async (options) => {
127
- try {
128
- console.log(chalk.cyan("\u{1F9EA} Testing webhook endpoint..."));
129
- const testPayload = {
130
- action: "create",
131
- type: "Issue",
132
- data: {
133
- id: "test-" + Date.now(),
134
- identifier: "TEST-1",
135
- title: "Test webhook issue",
136
- description: "This is a test webhook event",
137
- state: {
138
- id: "state-1",
139
- name: "Todo",
140
- type: "unstarted"
141
- },
142
- team: {
143
- id: "team-1",
144
- key: "TEST",
145
- name: "Test Team"
146
- },
147
- createdAt: (/* @__PURE__ */ new Date()).toISOString(),
148
- updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
149
- url: "https://linear.app/test/issue/TEST-1"
150
- },
151
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
152
- };
153
- const response = await fetch(options.url, {
154
- method: "POST",
155
- headers: {
156
- "Content-Type": "application/json"
157
- },
158
- body: JSON.stringify(testPayload)
159
- });
160
- if (response.ok) {
161
- const result = await response.json();
162
- console.log(chalk.green("\u2713") + " Webhook test successful");
163
- console.log(
164
- chalk.cyan(" Response: ") + JSON.stringify(result, null, 2)
165
- );
166
- } else {
167
- console.log(chalk.red("\u2717 Webhook test failed"));
168
- console.log(chalk.red(" Status: ") + response.status);
169
- console.log(chalk.red(" Response: ") + await response.text());
170
- }
171
- } catch (error) {
172
- logger.error("Webhook test failed:", error);
173
- console.error(chalk.red("\u2717 Webhook test failed:"), error.message);
174
- }
175
- });
176
- return command;
177
- }
178
- export {
179
- webhookCommand
180
- };
181
- //# sourceMappingURL=webhook.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/cli/commands/webhook.ts"],
4
- "sourcesContent": ["import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { LinearWebhookServer } from '../../integrations/linear/webhook-server.js';\nimport { ConfigService } from '../../services/config-service.js';\nimport { logger } from '../../core/monitoring/logger.js';\nimport ngrok from 'ngrok';\n// Type-safe environment variable access\nfunction getEnv(key: string, defaultValue?: string): string {\n const value = process.env[key];\n if (value === undefined) {\n if (defaultValue !== undefined) return defaultValue;\n throw new Error(`Environment variable ${key} is required`);\n }\n return value;\n}\n\nfunction getOptionalEnv(key: string): string | undefined {\n return process.env[key];\n}\n\nexport function webhookCommand(): Command {\n const command = new Command('webhook');\n\n command\n .description('Manage webhook servers for real-time sync')\n .option('-p, --port <port>', 'Port to run webhook server on', '3456')\n .option('-h, --host <host>', 'Host to bind to', 'localhost')\n .option('--ngrok', 'Create ngrok tunnel for public webhook URL')\n .option('--secret <secret>', 'Webhook secret for signature validation');\n\n command\n .command('start')\n .description('Start the Linear webhook server')\n .option('-p, --port <port>', 'Port to run webhook server on', '3456')\n .option('-h, --host <host>', 'Host to bind to', 'localhost')\n .option('--ngrok', 'Create ngrok tunnel for public webhook URL')\n .option('--background', 'Run in background (daemon mode)')\n .action(async (options) => {\n \n\n try {\n console.log(\n chalk.cyan.bold('\\n\uD83D\uDCE1 Starting Linear Webhook Server...\\n')\n );\n\n const server = new LinearWebhookServer({\n port: parseInt(options.port),\n host: options.host,\n webhookSecret: process.env['LINEAR_WEBHOOK_SECRET'],\n });\n\n await server.start();\n\n if (options.ngrok) {\n try {\n const url = await ngrok.connect({\n addr: options.port,\n subdomain: process.env['NGROK_SUBDOMAIN'],\n authtoken: process.env['NGROK_AUTH_TOKEN'],\n });\n\n console.log(chalk.green('\u2713') + chalk.bold(' Ngrok Tunnel Created'));\n console.log(chalk.cyan(' Public URL: ') + url);\n console.log(\n chalk.cyan(' Webhook URL: ') + url + '/webhook/linear'\n );\n console.log(\n chalk.yellow(\n '\\n\u26A0 Add this webhook URL to your Linear settings:\\n'\n )\n );\n console.log(\n chalk.white(` 1. Go to Linear Settings \u2192 API \u2192 Webhooks`)\n );\n console.log(chalk.white(` 2. Click \"New webhook\"`));\n console.log(chalk.white(` 3. Set URL to: ${url}/webhook/linear`));\n console.log(\n chalk.white(\n ` 4. Select events: Issues (all), Comments (optional)`\n )\n );\n console.log(\n chalk.white(\n ` 5. Copy the webhook secret to LINEAR_WEBHOOK_SECRET env var\\n`\n )\n );\n } catch (error: any) {\n logger.warn('Failed to create ngrok tunnel:', error.message);\n console.log(\n chalk.yellow(' \u26A0 Ngrok tunnel failed, running locally only')\n );\n }\n } else {\n console.log(\n chalk.yellow(\n '\\n\uD83D\uDCA1 Tip: Use --ngrok flag to create a public webhook URL'\n )\n );\n }\n\n if (options.background) {\n console.log(chalk.dim('\\nRunning in background mode...'));\n process.exit(0);\n } else {\n console.log(chalk.dim('\\nPress Ctrl+C to stop the server\\n'));\n }\n } catch (error: any) {\n logger.error('Failed to start webhook server:', error);\n console.error(\n chalk.red('\u2717 Failed to start webhook server:'),\n error.message\n );\n process.exit(1);\n }\n });\n\n command\n .command('stop')\n .description('Stop the webhook server')\n .action(async () => {\n console.log(chalk.yellow('Stopping webhook server...'));\n console.log(\n chalk.dim(\n '(This would stop a background webhook server if implemented)'\n )\n );\n });\n\n command\n .command('status')\n .description('Check webhook server status')\n .action(async () => {\n try {\n const response = await fetch('http://localhost:3456/health');\n if (response.ok) {\n const health = (await response.json()) as any;\n console.log(chalk.green('\u2713') + chalk.bold(' Webhook Server Status'));\n console.log(chalk.cyan(' Status: ') + health.status);\n console.log(chalk.cyan(' Queue: ') + health.queue + ' events');\n console.log(\n chalk.cyan(' Processing: ') + (health.processing ? 'Yes' : 'No')\n );\n console.log(chalk.cyan(' Timestamp: ') + health.timestamp);\n } else {\n console.log(chalk.red('\u2717 Webhook server not responding'));\n }\n } catch (error: unknown) {\n console.log(chalk.red('\u2717 Webhook server not running'));\n console.log(\n chalk.dim(' Run \"stackmemory webhook start\" to start the server')\n );\n }\n });\n\n command\n .command('test')\n .description('Send a test webhook to verify configuration')\n .option(\n '--url <url>',\n 'Webhook URL to test',\n 'http://localhost:3456/webhook/linear'\n )\n .action(async (options) => {\n \n\n try {\n console.log(chalk.cyan('\uD83E\uDDEA Testing webhook endpoint...'));\n\n const testPayload = {\n action: 'create',\n type: 'Issue',\n data: {\n id: 'test-' + Date.now(),\n identifier: 'TEST-1',\n title: 'Test webhook issue',\n description: 'This is a test webhook event',\n state: {\n id: 'state-1',\n name: 'Todo',\n type: 'unstarted',\n },\n team: {\n id: 'team-1',\n key: 'TEST',\n name: 'Test Team',\n },\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n url: 'https://linear.app/test/issue/TEST-1',\n },\n createdAt: new Date().toISOString(),\n };\n\n const response = await fetch(options.url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(testPayload),\n });\n\n if (response.ok) {\n const result = await response.json();\n console.log(chalk.green('\u2713') + ' Webhook test successful');\n console.log(\n chalk.cyan(' Response: ') + JSON.stringify(result, null, 2)\n );\n } else {\n console.log(chalk.red('\u2717 Webhook test failed'));\n console.log(chalk.red(' Status: ') + response.status);\n console.log(chalk.red(' Response: ') + (await response.text()));\n }\n } catch (error: any) {\n logger.error('Webhook test failed:', error);\n console.error(chalk.red('\u2717 Webhook test failed:'), error.message);\n }\n });\n\n return command;\n}\n"],
5
- "mappings": "AAAA,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,SAAS,2BAA2B;AAEpC,SAAS,cAAc;AACvB,OAAO,WAAW;AAElB,SAAS,OAAO,KAAa,cAA+B;AAC1D,QAAM,QAAQ,QAAQ,IAAI,GAAG;AAC7B,MAAI,UAAU,QAAW;AACvB,QAAI,iBAAiB,OAAW,QAAO;AACvC,UAAM,IAAI,MAAM,wBAAwB,GAAG,cAAc;AAAA,EAC3D;AACA,SAAO;AACT;AAEA,SAAS,eAAe,KAAiC;AACvD,SAAO,QAAQ,IAAI,GAAG;AACxB;AAEO,SAAS,iBAA0B;AACxC,QAAM,UAAU,IAAI,QAAQ,SAAS;AAErC,UACG,YAAY,2CAA2C,EACvD,OA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,MAAM,SAAS,KAAK;AACnC,gBAAQ,IAAI,MAAM,MAAM,QAAG,IAAI,0BAA0B;AACzD,gBAAQ;AAAA,UACN,MAAM,KAAK,cAAc,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC;AAAA,QAC7D;AAAA,MACF,OAAO;AACL,gBAAQ,IAAI,MAAM,IAAI,4BAAuB,CAAC;AAC9C,gBAAQ,IAAI,MAAM,IAAI,YAAY,IAAI,SAAS,MAAM;AACrD,gBAAQ,IAAI,MAAM,IAAI,cAAc,IAAK,MAAM,SAAS,KAAK,CAAE;AAAA,MACjE;AAAA,IACF,SAAS,OAAY;AACnB,aAAO,MAAM,wBAAwB,KAAK;AAC1C,cAAQ,MAAM,MAAM,IAAI,6BAAwB,GAAG,MAAM,OAAO;AAAA,IAClE;AAAA,EACF,CAAC;AAEH,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,144 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Command } from "commander";
3
- import { readFileSync } from "fs";
4
- import { join, dirname } from "path";
5
- import { fileURLToPath } from "url";
6
- import Database from "better-sqlite3";
7
- import { FrameManager } from "../core/context/frame-manager.js";
8
- import { SessionManager } from "../core/session/session-manager.js";
9
- import { pluginManager, loadPlugins } from "../plugins/loader.js";
10
- import { logger } from "../core/monitoring/logger.js";
11
- const __dirname = dirname(fileURLToPath(import.meta.url));
12
- const packageJson = JSON.parse(
13
- readFileSync(join(__dirname, "../../package.json"), "utf-8")
14
- );
15
- const program = new Command();
16
- program.name("stackmemory").description("Git for AI context - persistent memory across sessions").version(packageJson.version);
17
- program.command("init").description("Initialize StackMemory in current directory").action(async () => {
18
- const sessionManager = SessionManager.getInstance();
19
- await sessionManager.initialize();
20
- const session = await sessionManager.getOrCreateSession();
21
- console.log("\u2705 StackMemory initialized");
22
- console.log(` Project: ${session.projectId}`);
23
- console.log(` Session: ${session.sessionId.slice(0, 8)}`);
24
- });
25
- program.command("status").description("Show current context status").action(async () => {
26
- const sessionManager = SessionManager.getInstance();
27
- await sessionManager.initialize();
28
- const session = await sessionManager.getOrCreateSession();
29
- const dbPath = join(process.cwd(), ".stackmemory", "context.db");
30
- const db = new Database(dbPath);
31
- const frameManager = new FrameManager(db, session.projectId);
32
- const activeFrames = frameManager.getActiveFramePath();
33
- const depth = frameManager.getStackDepth();
34
- console.log("\u{1F4CA} StackMemory Status:");
35
- console.log(` Session: ${session.sessionId.slice(0, 8)}`);
36
- console.log(` Stack depth: ${depth}`);
37
- console.log(` Active frames: ${activeFrames.length}`);
38
- if (activeFrames.length > 0) {
39
- console.log("\n Current stack:");
40
- activeFrames.slice(0, 5).forEach((frame, i) => {
41
- console.log(` ${i + 1}. ${frame.name} [${frame.type}]`);
42
- });
43
- }
44
- });
45
- program.command("save [message]").description("Save current context with optional message").action(async (message) => {
46
- const sessionManager = SessionManager.getInstance();
47
- await sessionManager.initialize();
48
- const session = await sessionManager.getOrCreateSession();
49
- const dbPath = join(process.cwd(), ".stackmemory", "context.db");
50
- const db = new Database(dbPath);
51
- const frameManager = new FrameManager(db, session.projectId);
52
- const frame = await frameManager.createFrame({
53
- type: "context",
54
- name: message || "Manual save",
55
- content: message || "",
56
- metadata: {
57
- savedAt: (/* @__PURE__ */ new Date()).toISOString(),
58
- manual: true
59
- }
60
- });
61
- console.log("\u2705 Context saved");
62
- console.log(` Frame ID: ${frame.frame_id.slice(0, 8)}`);
63
- });
64
- program.command("load [query]").description("Load context by search query").argument("[query]", "Search query for context").action(async (query) => {
65
- const sessionManager = SessionManager.getInstance();
66
- await sessionManager.initialize();
67
- const dbPath = join(process.cwd(), ".stackmemory", "context.db");
68
- const db = new Database(dbPath);
69
- let whereClause = "";
70
- const params = [];
71
- if (query) {
72
- whereClause = "WHERE name LIKE ? OR content LIKE ?";
73
- params.push(`%${query}%`, `%${query}%`);
74
- }
75
- const frames = db.prepare(
76
- `
77
- SELECT frame_id, name, type, datetime(created_at, 'unixepoch') as created
78
- FROM frames
79
- ${whereClause}
80
- ORDER BY created_at DESC
81
- LIMIT 10
82
- `
83
- ).all(...params);
84
- if (frames.length === 0) {
85
- console.log("No matching context found");
86
- return;
87
- }
88
- console.log("\u{1F4DA} Found contexts:");
89
- frames.forEach((f, i) => {
90
- console.log(` ${i + 1}. ${f.name} [${f.type}] - ${f.created}`);
91
- });
92
- });
93
- program.command("sync").description("Sync context with remote storage").option("--push", "Push local changes to remote").option("--pull", "Pull remote changes to local").action(async (options) => {
94
- console.log("\u{1F504} Sync functionality:");
95
- if (options.push) {
96
- console.log(" Pushing to remote storage...");
97
- } else if (options.pull) {
98
- console.log(" Pulling from remote storage...");
99
- } else {
100
- console.log(" Use --push or --pull to specify direction");
101
- }
102
- });
103
- program.command("plugin <action> [name]").description("Manage plugins (list/enable/disable)").action(async (action, name) => {
104
- if (action === "list") {
105
- await loadPlugins();
106
- const plugins = pluginManager.getAllPlugins();
107
- console.log("\u{1F4E6} Available plugins:");
108
- if (plugins.length === 0) {
109
- console.log(" No plugins loaded");
110
- console.log(
111
- " Set ENABLE_LINEAR_PLUGIN=true to enable Linear integration"
112
- );
113
- } else {
114
- plugins.forEach((p) => {
115
- console.log(` - ${p.name} v${p.version}: ${p.description}`);
116
- });
117
- }
118
- } else if (action === "enable" && name) {
119
- console.log(`Enabling plugin: ${name}`);
120
- } else if (action === "disable" && name) {
121
- console.log(`Disabling plugin: ${name}`);
122
- } else {
123
- console.log("Usage: stackmemory plugin <list|enable|disable> [name]");
124
- }
125
- });
126
- loadPlugins().then(() => {
127
- const pluginCommands = pluginManager.getAllCommands();
128
- for (const cmd of pluginCommands) {
129
- const command = program.command(cmd.name).description(cmd.description).action(cmd.action);
130
- if (cmd.options) {
131
- for (const opt of cmd.options) {
132
- command.option(opt.flag, opt.description, opt.defaultValue);
133
- }
134
- }
135
- }
136
- program.parse(process.argv);
137
- }).catch((error) => {
138
- logger.error("Failed to load plugins", error);
139
- program.parse(process.argv);
140
- });
141
- if (!process.argv.slice(2).length) {
142
- program.outputHelp();
143
- }
144
- //# sourceMappingURL=streamlined-cli.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/cli/streamlined-cli.ts"],
4
- "sourcesContent": ["#!/usr/bin/env node\n/**\n * Streamlined StackMemory CLI\n * Essential commands only - focused on core functionality\n */\n\nimport { Command } from 'commander';\nimport { readFileSync } from 'fs';\nimport { join, dirname } from 'path';\nimport { fileURLToPath } from 'url';\nimport Database from 'better-sqlite3';\nimport { FrameManager } from '../core/context/frame-manager.js';\nimport { SessionManager } from '../core/session/session-manager.js';\nimport { pluginManager, loadPlugins } from '../plugins/loader.js';\nimport { logger } from '../core/monitoring/logger.js';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst packageJson = JSON.parse(\n readFileSync(join(__dirname, '../../package.json'), 'utf-8')\n);\n\nconst program = new Command();\n\nprogram\n .name('stackmemory')\n .description('Git for AI context - persistent memory across sessions')\n .version(packageJson.version);\n\n// 1. INIT - Setup StackMemory in a project\nprogram\n .command('init')\n .description('Initialize StackMemory in current directory')\n .action(async () => {\n const sessionManager = SessionManager.getInstance();\n await sessionManager.initialize();\n const session = await sessionManager.getOrCreateSession();\n console.log('\u2705 StackMemory initialized');\n console.log(` Project: ${session.projectId}`);\n console.log(` Session: ${session.sessionId.slice(0, 8)}`);\n });\n\n// 2. STATUS - Check current status\nprogram\n .command('status')\n .description('Show current context status')\n .action(async () => {\n const sessionManager = SessionManager.getInstance();\n await sessionManager.initialize();\n const session = await sessionManager.getOrCreateSession();\n\n const dbPath = join(process.cwd(), '.stackmemory', 'context.db');\n const db = new Database(dbPath);\n const frameManager = new FrameManager(db, session.projectId);\n\n const activeFrames = frameManager.getActiveFramePath();\n const depth = frameManager.getStackDepth();\n\n console.log('\uD83D\uDCCA StackMemory Status:');\n console.log(` Session: ${session.sessionId.slice(0, 8)}`);\n console.log(` Stack depth: ${depth}`);\n console.log(` Active frames: ${activeFrames.length}`);\n\n if (activeFrames.length > 0) {\n console.log('\\n Current stack:');\n activeFrames.slice(0, 5).forEach((frame, i) => {\n console.log(` ${i + 1}. ${frame.name} [${frame.type}]`);\n });\n }\n });\n\n// 3. SAVE - Save current context\nprogram\n .command('save [message]')\n .description('Save current context with optional message')\n .action(async (message) => {\n const sessionManager = SessionManager.getInstance();\n await sessionManager.initialize();\n const session = await sessionManager.getOrCreateSession();\n\n const dbPath = join(process.cwd(), '.stackmemory', 'context.db');\n const db = new Database(dbPath);\n const frameManager = new FrameManager(db, session.projectId);\n\n const frame = await frameManager.createFrame({\n type: 'context',\n name: message || 'Manual save',\n content: message || '',\n metadata: {\n savedAt: new Date().toISOString(),\n manual: true,\n },\n });\n\n console.log('\u2705 Context saved');\n console.log(` Frame ID: ${frame.frame_id.slice(0, 8)}`);\n });\n\n// 4. LOAD - Load context by query\nprogram\n .command('load [query]')\n .description('Load context by search query')\n .argument('[query]', 'Search query for context')\n .action(async (query) => {\n const sessionManager = SessionManager.getInstance();\n await sessionManager.initialize();\n\n const dbPath = join(process.cwd(), '.stackmemory', 'context.db');\n const db = new Database(dbPath);\n\n let whereClause = '';\n const params: any[] = [];\n\n if (query) {\n whereClause = 'WHERE name LIKE ? OR content LIKE ?';\n params.push(`%${query}%`, `%${query}%`);\n }\n\n const frames = db\n .prepare(\n `\n SELECT frame_id, name, type, datetime(created_at, 'unixepoch') as created\n FROM frames\n ${whereClause}\n ORDER BY created_at DESC\n LIMIT 10\n `\n )\n .all(...params);\n\n if (frames.length === 0) {\n console.log('No matching context found');\n return;\n }\n\n console.log('\uD83D\uDCDA Found contexts:');\n frames.forEach((f: any, i: number) => {\n console.log(` ${i + 1}. ${f.name} [${f.type}] - ${f.created}`);\n });\n });\n\n// 5. SYNC - Sync with remote storage (if configured)\nprogram\n .command('sync')\n .description('Sync context with remote storage')\n .option('--push', 'Push local changes to remote')\n .option('--pull', 'Pull remote changes to local')\n .action(async (options) => {\n // This would integrate with the simplified storage\n console.log('\uD83D\uDD04 Sync functionality:');\n if (options.push) {\n console.log(' Pushing to remote storage...');\n // Implement push to S3/compatible storage\n } else if (options.pull) {\n console.log(' Pulling from remote storage...');\n // Implement pull from S3/compatible storage\n } else {\n console.log(' Use --push or --pull to specify direction');\n }\n });\n\n// 6. PLUGIN - Manage plugins\nprogram\n .command('plugin <action> [name]')\n .description('Manage plugins (list/enable/disable)')\n .action(async (action, name) => {\n if (action === 'list') {\n await loadPlugins();\n const plugins = pluginManager.getAllPlugins();\n\n console.log('\uD83D\uDCE6 Available plugins:');\n if (plugins.length === 0) {\n console.log(' No plugins loaded');\n console.log(\n ' Set ENABLE_LINEAR_PLUGIN=true to enable Linear integration'\n );\n } else {\n plugins.forEach((p) => {\n console.log(` - ${p.name} v${p.version}: ${p.description}`);\n });\n }\n } else if (action === 'enable' && name) {\n console.log(`Enabling plugin: ${name}`);\n // Would update plugins.json\n } else if (action === 'disable' && name) {\n console.log(`Disabling plugin: ${name}`);\n // Would update plugins.json\n } else {\n console.log('Usage: stackmemory plugin <list|enable|disable> [name]');\n }\n });\n\n// Load plugin commands dynamically\nloadPlugins()\n .then(() => {\n const pluginCommands = pluginManager.getAllCommands();\n\n // Register each plugin command\n for (const cmd of pluginCommands) {\n const command = program\n .command(cmd.name)\n .description(cmd.description)\n .action(cmd.action);\n\n // Add options if specified\n if (cmd.options) {\n for (const opt of cmd.options) {\n command.option(opt.flag, opt.description, opt.defaultValue);\n }\n }\n }\n\n // Parse arguments after plugins are loaded\n program.parse(process.argv);\n })\n .catch((error) => {\n logger.error('Failed to load plugins', error);\n program.parse(process.argv);\n });\n\n// Show help if no command provided\nif (!process.argv.slice(2).length) {\n program.outputHelp();\n}\n"],
5
- "mappings": ";AAMA,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAC7B,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAC9B,OAAO,cAAc;AACrB,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,eAAe,mBAAmB;AAC3C,SAAS,cAAc;AAEvB,MAAM,YAAY,QAAQ,cAAc,YAAY,GAAG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,CAAC;AAGH,YAAY,EACT,KAAK,MAAM;AACV,QAAM,iBAAiB,cAAc,eAAe;AAGpD,aAAW,OAAO,gBAAgB;AAChC,UAAM,UAAU,QACb,QAAQ,IAAI,IAAI,EAChB,YAAY,IAAI,WAAW,EAC3B,OAAO,IAAI,MAAM;AAGpB,QAAI,IAAI,SAAS;AACf,iBAAW,OAAO,IAAI,SAAS;AAC7B,gBAAQ,OAAO,IAAI,MAAM,IAAI,aAAa,IAAI,YAAY;AAAA,MAC5D;AAAA,IACF;AAAA,EACF;AAGA,UAAQ,MAAM,QAAQ,IAAI;AAC5B,CAAC,EACA,MAAM,CAAC,UAAU;AAChB,SAAO,MAAM,0BAA0B,KAAK;AAC5C,UAAQ,MAAM,QAAQ,IAAI;AAC5B,CAAC;AAGH,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;",
6
- "names": []
7
- }
@@ -1,110 +0,0 @@
1
- class SimpleEventBus {
2
- handlers = /* @__PURE__ */ new Map();
3
- eventHistory = [];
4
- maxHistorySize = 1e3;
5
- subscriptionCounter = 0;
6
- emit(event) {
7
- const fullEvent = {
8
- ...event,
9
- id: this.generateEventId(),
10
- timestamp: Date.now()
11
- };
12
- this.eventHistory.push(fullEvent);
13
- if (this.eventHistory.length > this.maxHistorySize) {
14
- this.eventHistory.shift();
15
- }
16
- const handlers = this.handlers.get(event.type);
17
- if (handlers) {
18
- const handlersCopy = Array.from(handlers);
19
- for (const handler of handlersCopy) {
20
- try {
21
- const result = handler(fullEvent);
22
- if (result instanceof Promise) {
23
- result.catch((error) => {
24
- console.error(`Event handler error for ${event.type}:`, error);
25
- });
26
- }
27
- } catch (error) {
28
- console.error(`Event handler error for ${event.type}:`, error);
29
- }
30
- }
31
- }
32
- }
33
- on(eventType, handler) {
34
- if (!this.handlers.has(eventType)) {
35
- this.handlers.set(eventType, /* @__PURE__ */ new Set());
36
- }
37
- this.handlers.get(eventType).add(handler);
38
- const subscriptionId = `sub-${++this.subscriptionCounter}`;
39
- return {
40
- id: subscriptionId,
41
- unsubscribe: () => this.off(eventType, handler)
42
- };
43
- }
44
- once(eventType, handler) {
45
- const wrapper = (event) => {
46
- handler(event);
47
- this.off(eventType, wrapper);
48
- };
49
- return this.on(eventType, wrapper);
50
- }
51
- off(eventType, handler) {
52
- this.handlers.get(eventType)?.delete(handler);
53
- }
54
- offAll(eventType) {
55
- if (eventType) {
56
- this.handlers.delete(eventType);
57
- } else {
58
- this.handlers.clear();
59
- }
60
- }
61
- async waitFor(eventType, timeout = 3e4) {
62
- return new Promise((resolve, reject) => {
63
- const timer = setTimeout(() => {
64
- reject(new Error(`Timeout waiting for event: ${eventType}`));
65
- }, timeout);
66
- const subscription = this.once(eventType, (event) => {
67
- clearTimeout(timer);
68
- resolve(event);
69
- });
70
- });
71
- }
72
- generateEventId() {
73
- return `evt-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
74
- }
75
- getHistory(eventType, limit = 100) {
76
- let events = this.eventHistory;
77
- if (eventType) {
78
- events = events.filter((e) => e.type === eventType);
79
- }
80
- return events.slice(-limit);
81
- }
82
- }
83
- const globalEventBus = new SimpleEventBus();
84
- const EventTypes = {
85
- // Ralph Loop events
86
- RALPH_ITERATION_START: "ralph.iteration.start",
87
- RALPH_ITERATION_COMPLETE: "ralph.iteration.complete",
88
- RALPH_ITERATION_FAILED: "ralph.iteration.failed",
89
- RALPH_LOOP_COMPLETE: "ralph.loop.complete",
90
- // Swarm events
91
- SWARM_AGENT_STARTED: "swarm.agent.started",
92
- SWARM_AGENT_STOPPED: "swarm.agent.stopped",
93
- SWARM_TASK_ASSIGNED: "swarm.task.assigned",
94
- SWARM_TASK_COMPLETE: "swarm.task.complete",
95
- SWARM_CONFLICT_DETECTED: "swarm.conflict.detected",
96
- // Context events
97
- CONTEXT_SAVED: "context.saved",
98
- CONTEXT_LOADED: "context.loaded",
99
- CONTEXT_SYNCED: "context.synced",
100
- // Git events
101
- GIT_COMMIT_CREATED: "git.commit.created",
102
- GIT_BRANCH_CREATED: "git.branch.created",
103
- GIT_MERGE_COMPLETE: "git.merge.complete"
104
- };
105
- export {
106
- EventTypes,
107
- SimpleEventBus,
108
- globalEventBus
109
- };
110
- //# sourceMappingURL=event-bus.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/core/events/event-bus.ts"],
4
- "sourcesContent": ["/**\n * Event Bus - Core event-driven communication system\n * Decouples components through publish/subscribe pattern\n */\n\nexport interface Event {\n id: string;\n type: string;\n timestamp: number;\n source: string;\n data: Record<string, any>;\n metadata?: Record<string, any>;\n}\n\nexport type EventHandler = (event: Event) => void | Promise<void>;\n\nexport interface EventSubscription {\n id: string;\n unsubscribe(): void;\n}\n\nexport interface EventBus {\n emit(event: Omit<Event, 'id' | 'timestamp'>): void;\n on(eventType: string, handler: EventHandler): EventSubscription;\n once(eventType: string, handler: EventHandler): EventSubscription;\n off(eventType: string, handler: EventHandler): void;\n offAll(eventType?: string): void;\n waitFor(eventType: string, timeout?: number): Promise<Event>;\n}\n\nexport class SimpleEventBus implements EventBus {\n private handlers = new Map<string, Set<EventHandler>>();\n private eventHistory: Event[] = [];\n private maxHistorySize = 1000;\n private subscriptionCounter = 0;\n\n emit(event: Omit<Event, 'id' | 'timestamp'>): void {\n const fullEvent: Event = {\n ...event,\n id: this.generateEventId(),\n timestamp: Date.now()\n };\n\n // Store in history\n this.eventHistory.push(fullEvent);\n if (this.eventHistory.length > this.maxHistorySize) {\n this.eventHistory.shift();\n }\n\n // Notify handlers\n const handlers = this.handlers.get(event.type);\n if (handlers) {\n // Clone to avoid modification during iteration\n const handlersCopy = Array.from(handlers);\n for (const handler of handlersCopy) {\n try {\n const result = handler(fullEvent);\n if (result instanceof Promise) {\n result.catch(error => {\n console.error(`Event handler error for ${event.type}:`, error);\n });\n }\n } catch (error) {\n console.error(`Event handler error for ${event.type}:`, error);\n }\n }\n }\n }\n\n on(eventType: string, handler: EventHandler): EventSubscription {\n if (!this.handlers.has(eventType)) {\n this.handlers.set(eventType, new Set());\n }\n this.handlers.get(eventType)!.add(handler);\n\n const subscriptionId = `sub-${++this.subscriptionCounter}`;\n return {\n id: subscriptionId,\n unsubscribe: () => this.off(eventType, handler)\n };\n }\n\n once(eventType: string, handler: EventHandler): EventSubscription {\n const wrapper: EventHandler = (event) => {\n handler(event);\n this.off(eventType, wrapper);\n };\n return this.on(eventType, wrapper);\n }\n\n off(eventType: string, handler: EventHandler): void {\n this.handlers.get(eventType)?.delete(handler);\n }\n\n offAll(eventType?: string): void {\n if (eventType) {\n this.handlers.delete(eventType);\n } else {\n this.handlers.clear();\n }\n }\n\n async waitFor(eventType: string, timeout = 30000): Promise<Event> {\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new Error(`Timeout waiting for event: ${eventType}`));\n }, timeout);\n\n const subscription = this.once(eventType, (event) => {\n clearTimeout(timer);\n resolve(event);\n });\n });\n }\n\n private generateEventId(): string {\n return `evt-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;\n }\n\n getHistory(eventType?: string, limit = 100): Event[] {\n let events = this.eventHistory;\n if (eventType) {\n events = events.filter(e => e.type === eventType);\n }\n return events.slice(-limit);\n }\n}\n\n// Global event bus instance\nexport const globalEventBus = new SimpleEventBus();\n\n// Event types\nexport const EventTypes = {\n // Ralph Loop events\n RALPH_ITERATION_START: 'ralph.iteration.start',\n RALPH_ITERATION_COMPLETE: 'ralph.iteration.complete',\n RALPH_ITERATION_FAILED: 'ralph.iteration.failed',\n RALPH_LOOP_COMPLETE: 'ralph.loop.complete',\n\n // Swarm events\n SWARM_AGENT_STARTED: 'swarm.agent.started',\n SWARM_AGENT_STOPPED: 'swarm.agent.stopped',\n SWARM_TASK_ASSIGNED: 'swarm.task.assigned',\n SWARM_TASK_COMPLETE: 'swarm.task.complete',\n SWARM_CONFLICT_DETECTED: 'swarm.conflict.detected',\n\n // Context events\n CONTEXT_SAVED: 'context.saved',\n CONTEXT_LOADED: 'context.loaded',\n CONTEXT_SYNCED: 'context.synced',\n\n // Git events\n GIT_COMMIT_CREATED: 'git.commit.created',\n GIT_BRANCH_CREATED: 'git.branch.created',\n GIT_MERGE_COMPLETE: 'git.merge.complete'\n} as const;"],
5
- "mappings": "AA8BO,MAAM,eAAmC;AAAA,EACtC,WAAW,oBAAI,IAA+B;AAAA,EAC9C,eAAwB,CAAC;AAAA,EACzB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EAE9B,KAAK,OAA8C;AACjD,UAAM,YAAmB;AAAA,MACvB,GAAG;AAAA,MACH,IAAI,KAAK,gBAAgB;AAAA,MACzB,WAAW,KAAK,IAAI;AAAA,IACtB;AAGA,SAAK,aAAa,KAAK,SAAS;AAChC,QAAI,KAAK,aAAa,SAAS,KAAK,gBAAgB;AAClD,WAAK,aAAa,MAAM;AAAA,IAC1B;AAGA,UAAM,WAAW,KAAK,SAAS,IAAI,MAAM,IAAI;AAC7C,QAAI,UAAU;AAEZ,YAAM,eAAe,MAAM,KAAK,QAAQ;AACxC,iBAAW,WAAW,cAAc;AAClC,YAAI;AACF,gBAAM,SAAS,QAAQ,SAAS;AAChC,cAAI,kBAAkB,SAAS;AAC7B,mBAAO,MAAM,WAAS;AACpB,sBAAQ,MAAM,2BAA2B,MAAM,IAAI,KAAK,KAAK;AAAA,YAC/D,CAAC;AAAA,UACH;AAAA,QACF,SAAS,OAAO;AACd,kBAAQ,MAAM,2BAA2B,MAAM,IAAI,KAAK,KAAK;AAAA,QAC/D;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,GAAG,WAAmB,SAA0C;AAC9D,QAAI,CAAC,KAAK,SAAS,IAAI,SAAS,GAAG;AACjC,WAAK,SAAS,IAAI,WAAW,oBAAI,IAAI,CAAC;AAAA,IACxC;AACA,SAAK,SAAS,IAAI,SAAS,EAAG,IAAI,OAAO;AAEzC,UAAM,iBAAiB,OAAO,EAAE,KAAK,mBAAmB;AACxD,WAAO;AAAA,MACL,IAA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;AAAA,EAC1B,wBAAwB;AAAA,EACxB,qBAAqB;AAAA;AAAA,EAGrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,yBAAyB;AAAA;AAAA,EAGzB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,gBAAgB;AAAA;AAAA,EAGhB,oBAAoB;AAAA,EACpB,oBAAoB;AAAA,EACpB,oBAAoB;AACtB;",
6
- "names": []
7
- }
@@ -1,42 +0,0 @@
1
- const workflowTemplates = {
2
- tdd: {
3
- name: "Test-Driven Development",
4
- description: "Write tests first, then implement",
5
- phases: [
6
- { name: "write-failing-tests", description: "Write tests that fail" },
7
- { name: "implement-code", description: "Make tests pass" },
8
- { name: "refactor", description: "Clean up code" }
9
- ]
10
- },
11
- feature: {
12
- name: "Feature Development",
13
- description: "Develop a new feature",
14
- phases: [
15
- { name: "design", description: "Design the feature" },
16
- { name: "implement", description: "Build the feature" },
17
- { name: "test", description: "Test the feature" }
18
- ]
19
- },
20
- bugfix: {
21
- name: "Bug Fix",
22
- description: "Fix a reported bug",
23
- phases: [
24
- { name: "reproduce", description: "Reproduce the bug" },
25
- { name: "fix", description: "Fix the bug" },
26
- { name: "verify", description: "Verify the fix" }
27
- ]
28
- },
29
- refactor: {
30
- name: "Refactoring",
31
- description: "Improve code structure",
32
- phases: [
33
- { name: "analyze", description: "Analyze current code" },
34
- { name: "refactor", description: "Refactor code" },
35
- { name: "test", description: "Ensure no regressions" }
36
- ]
37
- }
38
- };
39
- export {
40
- workflowTemplates
41
- };
42
- //# sourceMappingURL=workflow-templates-stub.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/core/frame/workflow-templates-stub.ts"],
4
- "sourcesContent": ["/**\n * Stub workflow templates for testing\n */\n\nexport const workflowTemplates = {\n tdd: {\n name: 'Test-Driven Development',\n description: 'Write tests first, then implement',\n phases: [\n { name: 'write-failing-tests', description: 'Write tests that fail' },\n { name: 'implement-code', description: 'Make tests pass' },\n { name: 'refactor', description: 'Clean up code' },\n ],\n },\n feature: {\n name: 'Feature Development',\n description: 'Develop a new feature',\n phases: [\n { name: 'design', description: 'Design the feature' },\n { name: 'implement', description: 'Build the feature' },\n { name: 'test', description: 'Test the feature' },\n ],\n },\n bugfix: {\n name: 'Bug Fix',\n description: 'Fix a reported bug',\n phases: [\n { name: 'reproduce', description: 'Reproduce the bug' },\n { name: 'fix', description: 'Fix the bug' },\n { name: 'verify', description: 'Verify the fix' },\n ],\n },\n refactor: {\n name: 'Refactoring',\n description: 'Improve code structure',\n phases: [\n { name: 'analyze', description: 'Analyze current code' },\n { name: 'refactor', description: 'Refactor code' },\n { name: 'test', description: 'Ensure no regressions' },\n ],\n },\n};\n"],
5
- "mappings": "AAIO,MAAM,oBAAoB;AAAA,EAC/B,KAAK;AAAA,IACH,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,EAAE,MAAM,uBAAuB,aAAa,wBAAwB;AAAA,MACpE,EAAE,MAAM,kBAAkB,aAAa,kBAAkB;AAAA,MACzD,EAAE,MAAM,YAAY,aAAa,gBAAgB;AAAA,IACnD;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,EAAE,MAAM,UAAU,aAAa,qBAAqB;AAAA,MACpD,EAAE,MAAM,aAAa,aAAa,oBAAoB;AAAA,MACtD,EAAE,MAAM,QAAQ,aAAa,mBAAmB;AAAA,IAClD;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,EAAE,MAAM,aAAa,aAAa,oBAAoB;AAAA,MACtD,EAAE,MAAM,OAAO,aAAa,cAAc;AAAA,MAC1C,EAAE,MAAM,UAAU,aAAa,iBAAiB;AAAA,IAClD;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,MACN,EAAE,MAAM,WAAW,aAAa,uBAAuB;AAAA,MACvD,EAAE,MAAM,YAAY,aAAa,gBAAgB;AAAA,MACjD,EAAE,MAAM,QAAQ,aAAa,wBAAwB;AAAA,IACvD;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,87 +0,0 @@
1
- class BasePlugin {
2
- dependencies;
3
- context;
4
- status = { state: "uninitialized" };
5
- metrics = {
6
- eventsEmitted: 0,
7
- eventsReceived: 0,
8
- errors: 0
9
- };
10
- startTime;
11
- async initialize(context) {
12
- this.context = context;
13
- this.status = { state: "initialized" };
14
- await this.onInitialize();
15
- }
16
- async start() {
17
- this.status = { state: "starting" };
18
- this.startTime = Date.now();
19
- await this.onStart();
20
- this.status = { state: "running", lastActivity: Date.now() };
21
- }
22
- async stop() {
23
- this.status = { state: "stopping" };
24
- await this.onStop();
25
- this.status = { state: "stopped" };
26
- }
27
- async shutdown() {
28
- if (this.status.state === "running") {
29
- await this.stop();
30
- }
31
- await this.onShutdown();
32
- this.status = { state: "uninitialized" };
33
- }
34
- getStatus() {
35
- return { ...this.status };
36
- }
37
- getMetrics() {
38
- return {
39
- ...this.metrics,
40
- startTime: this.startTime,
41
- uptime: this.startTime ? Date.now() - this.startTime : 0
42
- };
43
- }
44
- validateConfig(config) {
45
- const errors = [];
46
- const warnings = [];
47
- if (config.name !== this.name) {
48
- errors.push(`Config name '${config.name}' doesn't match plugin name '${this.name}'`);
49
- }
50
- const customValidation = this.onValidateConfig(config);
51
- if (customValidation.errors) errors.push(...customValidation.errors);
52
- if (customValidation.warnings) warnings.push(...customValidation.warnings);
53
- return {
54
- valid: errors.length === 0,
55
- errors: errors.length > 0 ? errors : void 0,
56
- warnings: warnings.length > 0 ? warnings : void 0
57
- };
58
- }
59
- emit(eventType, data) {
60
- if (!this.context) throw new Error("Plugin not initialized");
61
- this.context.eventBus.emit({
62
- type: eventType,
63
- source: this.name,
64
- data
65
- });
66
- this.metrics.eventsEmitted++;
67
- this.status.lastActivity = Date.now();
68
- }
69
- on(eventType, handler) {
70
- if (!this.context) throw new Error("Plugin not initialized");
71
- this.context.eventBus.on(eventType, async (event) => {
72
- this.metrics.eventsReceived++;
73
- this.status.lastActivity = Date.now();
74
- try {
75
- await handler(event);
76
- } catch (error) {
77
- this.metrics.errors++;
78
- this.status.error = error;
79
- console.error(`Plugin ${this.name} error handling ${eventType}:`, error);
80
- }
81
- });
82
- }
83
- }
84
- export {
85
- BasePlugin
86
- };
87
- //# sourceMappingURL=plugin-interface.js.map