bobs-workshop 0.1.4

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 (94) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +252 -0
  3. package/bin/bobs-mcp.js +130 -0
  4. package/dist/api/taskLogger.js +106 -0
  5. package/dist/api/taskLogger.js.map +1 -0
  6. package/dist/cli/checker.js +401 -0
  7. package/dist/cli/checker.js.map +1 -0
  8. package/dist/cli/cleanup.js +131 -0
  9. package/dist/cli/cleanup.js.map +1 -0
  10. package/dist/cli/debug.js +157 -0
  11. package/dist/cli/debug.js.map +1 -0
  12. package/dist/cli/health.js +97 -0
  13. package/dist/cli/health.js.map +1 -0
  14. package/dist/cli/setup.js +81 -0
  15. package/dist/cli/setup.js.map +1 -0
  16. package/dist/cli/workshop.js +42 -0
  17. package/dist/cli/workshop.js.map +1 -0
  18. package/dist/dashboard/server.js +1206 -0
  19. package/dist/dashboard/server.js.map +1 -0
  20. package/dist/index.js +757 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/prompts/architect.js +157 -0
  23. package/dist/prompts/architect.js.map +1 -0
  24. package/dist/prompts/debugger.js +201 -0
  25. package/dist/prompts/debugger.js.map +1 -0
  26. package/dist/prompts/engineer.js +171 -0
  27. package/dist/prompts/engineer.js.map +1 -0
  28. package/dist/prompts/orchestrator.js +225 -0
  29. package/dist/prompts/orchestrator.js.map +1 -0
  30. package/dist/prompts/reviewer.js +199 -0
  31. package/dist/prompts/reviewer.js.map +1 -0
  32. package/dist/services/activitySummarizer.js +353 -0
  33. package/dist/services/activitySummarizer.js.map +1 -0
  34. package/dist/services/changeValidator.js +396 -0
  35. package/dist/services/changeValidator.js.map +1 -0
  36. package/dist/services/claudeOrchestrator.js +343 -0
  37. package/dist/services/claudeOrchestrator.js.map +1 -0
  38. package/dist/services/fileMonitor.js +250 -0
  39. package/dist/services/fileMonitor.js.map +1 -0
  40. package/dist/services/implementationSummarizer.js +306 -0
  41. package/dist/services/implementationSummarizer.js.map +1 -0
  42. package/dist/services/liveMonitor.js +315 -0
  43. package/dist/services/liveMonitor.js.map +1 -0
  44. package/dist/services/mcpAuditLogger.js +104 -0
  45. package/dist/services/mcpAuditLogger.js.map +1 -0
  46. package/dist/services/mcpLogger.js +223 -0
  47. package/dist/services/mcpLogger.js.map +1 -0
  48. package/dist/services/tmuxManager.js +541 -0
  49. package/dist/services/tmuxManager.js.map +1 -0
  50. package/dist/tools/approvalTools.js +244 -0
  51. package/dist/tools/approvalTools.js.map +1 -0
  52. package/dist/tools/autoDebugger.js +147 -0
  53. package/dist/tools/autoDebugger.js.map +1 -0
  54. package/dist/tools/cleanupService.js +221 -0
  55. package/dist/tools/cleanupService.js.map +1 -0
  56. package/dist/tools/dashboardTools.js +359 -0
  57. package/dist/tools/dashboardTools.js.map +1 -0
  58. package/dist/tools/developmentNudges.js +336 -0
  59. package/dist/tools/developmentNudges.js.map +1 -0
  60. package/dist/tools/gitTools.js +741 -0
  61. package/dist/tools/gitTools.js.map +1 -0
  62. package/dist/tools/orchestratorTools.js +765 -0
  63. package/dist/tools/orchestratorTools.js.map +1 -0
  64. package/dist/tools/searchTools.js +788 -0
  65. package/dist/tools/searchTools.js.map +1 -0
  66. package/dist/tools/specTools.js +350 -0
  67. package/dist/tools/specTools.js.map +1 -0
  68. package/dist/tools/tmuxTools.js +100 -0
  69. package/dist/tools/tmuxTools.js.map +1 -0
  70. package/dist/tools/workRecorder.js +215 -0
  71. package/dist/tools/workRecorder.js.map +1 -0
  72. package/dist/tools/worktreeTools.js +705 -0
  73. package/dist/tools/worktreeTools.js.map +1 -0
  74. package/dist/utils/__tests__/integration.test.js +57 -0
  75. package/dist/utils/__tests__/integration.test.js.map +1 -0
  76. package/dist/utils/__tests__/serverDetection.test.js +151 -0
  77. package/dist/utils/__tests__/serverDetection.test.js.map +1 -0
  78. package/dist/utils/errorHandling.js +336 -0
  79. package/dist/utils/errorHandling.js.map +1 -0
  80. package/dist/utils/processManager.js +172 -0
  81. package/dist/utils/processManager.js.map +1 -0
  82. package/dist/utils/reliability.js +263 -0
  83. package/dist/utils/reliability.js.map +1 -0
  84. package/dist/utils/responseFormatter.js +250 -0
  85. package/dist/utils/responseFormatter.js.map +1 -0
  86. package/dist/utils/serverDetection.js +133 -0
  87. package/dist/utils/serverDetection.js.map +1 -0
  88. package/dist/utils/specMigration.js +105 -0
  89. package/dist/utils/specMigration.js.map +1 -0
  90. package/dist/validation/schemas.js +299 -0
  91. package/dist/validation/schemas.js.map +1 -0
  92. package/package.json +79 -0
  93. package/scripts/init-workspace.js +63 -0
  94. package/scripts/install-search-tools.js +116 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Bob's Workshop - Pawan Raviee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,252 @@
1
+ # 🧭 Bob's Workshop MCP — AI-Orchestrated Development that Builds with You
2
+
3
+ *Manual-driven AI development. Intelligent orchestration. Real-time insight.*
4
+
5
+ *From "hey bob, build this" to production-ready code — all in one seamless flow.*
6
+
7
+ ![Banner](assets/bobs-mcp-banner.png)
8
+
9
+ **Finally, AI development that feels like teamwork.**
10
+ Bob's Workshop MCP turns complex coding workflows into clear, auditable phases — from **architecture planning**, to **implementation**, **debugging**, and **review** — all captured inside a living manual that evolves as you build.
11
+
12
+ ---
13
+
14
+ ## The problem
15
+
16
+ Modern AI coding assistants are fast, but not reliable. You've seen it before:
17
+
18
+ * The model forgets what it planned five minutes ago
19
+ * Code gets out of sync with documentation
20
+ * You have to re-explain context every time
21
+ * Debugs and reviews happen… somewhere, off-record
22
+
23
+ **What if your AI actually worked like a disciplined engineer — asking questions, documenting decisions, and never skipping review?**
24
+
25
+ That's what Bob's Workshop does.
26
+
27
+ ---
28
+
29
+ ## Table of contents
30
+
31
+ - [🧭 Bob's Workshop MCP — AI-Orchestrated Development that Builds with You](#-bobs-workshop-mcp--ai-orchestrated-development-that-builds-with-you)
32
+ - [The problem](#the-problem)
33
+ - [Table of contents](#table-of-contents)
34
+ - [What makes this different](#what-makes-this-different)
35
+ - [🧠 How Bob Works](#-how-bob-works)
36
+ - [📊 Dashboard](#-dashboard)
37
+ - [🚀 Get started in 2 minutes](#-get-started-in-2-minutes)
38
+ - [The easiest way](#the-easiest-way)
39
+ - [Manual installation](#manual-installation)
40
+ - [🧩 Core Workflows](#-core-workflows)
41
+ - [⚙️ Tools Overview](#️-tools-overview)
42
+ - [🏗️ Architecture](#️-architecture)
43
+ - [🎯 Use cases](#-use-cases)
44
+ - [📦 Repository structure](#-repository-structure)
45
+ - [🤝 Contributing](#-contributing)
46
+ - [📄 License](#-license)
47
+
48
+ ---
49
+
50
+ ## What makes this different
51
+
52
+ 🧭 **Manual-first Development** — every task begins with a living manual, so plans and code stay in sync
53
+ 🧱 **Role-based Execution** — Architect, Engineer, Debugger, and Reviewer each have clear responsibilities
54
+ 🧠 **Human-in-the-loop Questions** — Bob never assumes; he clarifies until 95% confident
55
+ 🔍 **Search-backed Intelligence** — Research grounded in actual code via hybrid search (ripgrep + semgrep)
56
+ 📝 **Traceable Workflows** — Every action logged, every decision documented with integrated logging
57
+ 📊 **Visual Dashboard** — Real-time progress, manual state, logs, and diffs — all in one place
58
+ 🔧 **Reliable Git Operations** — Industry-standard practices for handling complex filenames and repository states
59
+
60
+ ---
61
+
62
+ ## 🧠 How Bob Works
63
+
64
+ > "Hey Bob, build me a new onboarding flow."
65
+
66
+ Bob's Orchestrator listens and builds a full lifecycle around that ask:
67
+
68
+ 1. **Architect** — drafts the plan, identifies edge cases, asks clarifying questions
69
+ 2. **Engineer** — implements step-by-step, runs tests, and records progress
70
+ 3. **Debugger** — investigates any errors using hybrid search before proposing fixes
71
+ 4. **Reviewer** — audits security, quality, and architecture before final approval
72
+
73
+ All changes are tracked in a **Manual**, a JSON-backed spec that doubles as documentation and audit trail.
74
+
75
+ ---
76
+
77
+ ## 📊 Dashboard
78
+
79
+ ![Bob's MCP Dashboard](assets/bobs-dashboard.jpg)
80
+ *A real-time view of your manuals, worktrees, and logs.*
81
+
82
+ * 🧾 **Manual List** — track every task from draft to deployed
83
+ * 🔄 **Live Sync** — see updates appear as Bob works
84
+ * 🧠 **Role Insights** — understand what each agent is doing
85
+ * 🧩 **Diff Viewer** — inspect file changes and LOC stats
86
+ * 🧪 **Test Status** — know when your work passes validation
87
+
88
+ ---
89
+
90
+ ## 🚀 Get started in 2 minutes
91
+
92
+ ### The easiest way
93
+
94
+ Ask Claude Code:
95
+
96
+ > **"Install Bob's Workshop MCP for me from npm"**
97
+
98
+ Claude will:
99
+
100
+ * Install and configure Bob's Workshop MCP
101
+ * Register tools & prompts
102
+ * Launch the dashboard
103
+
104
+ Then just type:
105
+
106
+ ```bash
107
+ hey bob, create an API for project management
108
+ ```
109
+
110
+ And watch the magic unfold:
111
+
112
+ * Architect asks clarifying questions
113
+ * Engineer implements with logs
114
+ * Reviewer checks quality
115
+ * Dashboard tracks everything in real-time
116
+
117
+ ---
118
+
119
+ ### Manual installation
120
+
121
+ ```bash
122
+ # Install globally
123
+ npm install -g bobs-workshop
124
+
125
+ # Register with Claude Code (project scope)
126
+ claude mcp add bobs-workshop node dist/index.js --scope project
127
+
128
+ # Or register globally
129
+ claude mcp add bobs-workshop node dist/index.js --scope global
130
+
131
+ # Launch dashboard
132
+ bobs workshop
133
+ ```
134
+
135
+ See the documentation for advanced setup and configuration options.
136
+
137
+ ---
138
+
139
+ ## 🧩 Core Workflows
140
+
141
+ | Workflow | Description |
142
+ | ----------------------------- | ---------------------------------------------------- |
143
+ | **bob.workshop** | Orchestrates end-to-end flow; routes to correct role |
144
+ | **bob.workflow.start** | Creates new manual + worktree + dashboard session |
145
+ | **bob.workflow.deploy** | Validates, merges, cleans up |
146
+ | **bob.code.search** | Hybrid search (ripgrep + semgrep) |
147
+ | **bob.validate.changes** | Diff validation and spec compliance |
148
+ | **bob.summarize.implementation** | Generate implementation summaries |
149
+ | **bob.dashboard.launch** | Launch web dashboard (port 4577) |
150
+ | **bob.dashboard.update** | Real-time dashboard sync |
151
+
152
+ ---
153
+
154
+ ## ⚙️ Tools Overview
155
+
156
+ | Tool | Description |
157
+ | --------------------------------- | ----------------------------------------------- |
158
+ | 🧭 `bob.workshop` | Orchestrator — main entry point |
159
+ | 🧱 `bob.manual.create` / `update` | Manage manual files |
160
+ | 🔍 `bob.code.search` | Hybrid lexical + semantic code search |
161
+ | ✅ `bob.validate.changes` | Verify changes match manual expectations |
162
+ | 📊 `bob.dashboard.launch` | Web dashboard on port 4577 |
163
+ | 🌳 `bob.worktree.list` | List all git worktrees |
164
+ | 🚀 `bob.workflow.start` | Start new feature development workflow |
165
+ | 🎯 `bob.workflow.deploy` | Complete implementation and deploy to main |
166
+ | 📝 `bob.summarize.implementation` | Generate comprehensive implementation summaries |
167
+ | 🐛 `bob.debug` | Debug server state and troubleshoot issues |
168
+
169
+ ---
170
+
171
+ ## 🏗️ Architecture
172
+
173
+ ![Bob's MCP Architecture](assets/bobs-architecture.jpg)
174
+ *A simple, composable structure built on MCP principles.*
175
+
176
+ * **MCP Server** — exposes tools & prompts via Model Context Protocol
177
+ * **CLI Interface** — `bobs` command for workflows, health checks, and maintenance
178
+ * **Worktrees** — isolated git branches per manual for parallel development
179
+ * **Dashboard** — visual orchestration view with real-time updates
180
+ * **Prompts** — role-based instructions for Architect, Engineer, Debugger, and Reviewer
181
+ * **Manuals** — JSON specs capturing full context, decisions, and implementation logs
182
+
183
+ ---
184
+
185
+ ## 🎯 Use cases
186
+
187
+ * 🧠 **Feature planning** — plan & clarify complex features before coding
188
+ * 🧱 **Implementation** — build with discipline & step-by-step logs
189
+ * 🔍 **Debugging** — research & resolve issues transparently
190
+ * 🔒 **Code review** — security, performance, and quality audits
191
+ * 🧾 **Documentation** — living specs that evolve as you code
192
+ * 🧰 **Tool orchestration** — unify AI, search, and validation tools under one flow
193
+
194
+ ---
195
+
196
+ ## 📦 Repository structure
197
+
198
+ ```
199
+ bobs-workshop/
200
+ ├── README.md # You're here
201
+ ├── src/
202
+ │ ├── index.ts # MCP server bootstrap
203
+ │ ├── tools/ # MCP tool implementations
204
+ │ ├── cli/ # CLI command modules
205
+ │ ├── dashboard/ # Web dashboard server
206
+ │ ├── services/ # Core services (logging, validation, etc.)
207
+ │ ├── utils/ # Utility functions and helpers
208
+ │ └── prompts/ # Role prompts (Architect, Engineer, Reviewer, Debugger)
209
+ ├── bin/
210
+ │ └── bobs-mcp.js # CLI entry point
211
+ ├── scripts/ # Installation and setup scripts
212
+ ├── dist/ # Compiled JavaScript output
213
+ ├── public/ # Dashboard frontend assets
214
+ ├── tests/ # Test suites
215
+ └── .bob/ # Workshop data storage
216
+ ├── specs/ # Manual JSON files
217
+ └── worktrees/ # Worktree metadata
218
+ ```
219
+
220
+ ---
221
+
222
+ ## 🤝 Contributing
223
+
224
+ 1. Fork the repository
225
+ 2. Create a feature branch (`git checkout -b feat/improvement`)
226
+ 3. Add / enhance tools, prompts, or workflows
227
+ 4. Test via Claude Code or MCP CLI
228
+ 5. Submit a pull request with a clear changelog
229
+
230
+ ---
231
+
232
+ ## 📄 License
233
+
234
+ MIT License — see [LICENSE](./LICENSE)
235
+
236
+ ---
237
+
238
+ **Tired of re-explaining your project every session?**
239
+ Just say: **"Hey Bob, build this feature for me."**
240
+
241
+ Bob will architect it, engineer it, test it, review it —
242
+ and keep your documentation up to date. ✨
243
+
244
+ ---
245
+
246
+ *Built with ♥️ for developers who value clarity, traceability, and craftsmanship.*
247
+ *Powered by [Model Context Protocol](https://modelcontextprotocol.io/) and [Claude Code](https://claude.ai/code)*
248
+
249
+ ---
250
+
251
+ [![npm version](https://badge.fury.io/js/bobs-workshop.svg)](https://badge.fury.io/js/bobs-workshop)
252
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { fileURLToPath } from 'url';
4
+ import { dirname, join } from 'path';
5
+ import { readFile } from 'fs/promises';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+
10
+ // Import CLI modules
11
+ async function loadCliModule(modulePath) {
12
+ try {
13
+ const module = await import(modulePath);
14
+ return module;
15
+ } catch (error) {
16
+ console.error(`Failed to load CLI module: ${error.message}`);
17
+ process.exit(1);
18
+ }
19
+ }
20
+
21
+ async function showHelp() {
22
+ console.log(`
23
+ 🔧 Bob's Workshop - Agentic Development Helper
24
+
25
+ Usage:
26
+ bobs [command] [options]
27
+
28
+ Commands:
29
+ workshop Launch Bob's Workshop dashboard
30
+ health Check system health and component status
31
+ cleanup Perform system cleanup and maintenance
32
+ debug Show debug information and system state
33
+ --check, -c Check installation and system requirements
34
+ --setup, -s Generate MCP configuration for Claude Code
35
+ --help, -h Show this help message
36
+ --version, -v Show version information
37
+
38
+ Examples:
39
+ bobs workshop # Launch Bob's Workshop dashboard
40
+ bobs health # Check system health
41
+ bobs cleanup # Clean up stale resources
42
+ bobs cleanup --stats # Show cleanup statistics
43
+ bobs debug # Show debug information
44
+ bobs --check # Check if everything is working
45
+ bobs --setup # Generate Claude Code MCP configuration
46
+ bobs # Run installation check (default)
47
+
48
+ For more information, visit: https://github.com/your-org/bobs-workshop
49
+ `);
50
+ }
51
+
52
+ async function showVersion() {
53
+ try {
54
+ const packagePath = join(__dirname, '../package.json');
55
+ const packageData = JSON.parse(await readFile(packagePath, 'utf8'));
56
+ console.log(`Bob's MCP v${packageData.version}`);
57
+ } catch (error) {
58
+ console.log('Bob\'s MCP (version unavailable)');
59
+ }
60
+ }
61
+
62
+ async function main() {
63
+ const args = process.argv.slice(2);
64
+
65
+ // Parse command line arguments
66
+ const command = args[0];
67
+
68
+ switch (command) {
69
+ case 'workshop':
70
+ console.log('🔧 Launching Bob\'s Workshop dashboard...\n');
71
+ const workshopModule = await loadCliModule('../dist/cli/workshop.js');
72
+ await workshopModule.runWorkshop();
73
+ break;
74
+
75
+ case 'health':
76
+ console.log('🔧 Running Bob\'s Workshop health check...\n');
77
+ const healthModule = await loadCliModule('../dist/cli/health.js');
78
+ await healthModule.runHealthCheck();
79
+ break;
80
+
81
+ case 'cleanup':
82
+ console.log('🔧 Running Bob\'s Workshop cleanup...\n');
83
+ const cleanupModule = await loadCliModule('../dist/cli/cleanup.js');
84
+ const cleanupOptions = cleanupModule.parseCleanupArgs(args.slice(1));
85
+ await cleanupModule.runCleanup(cleanupOptions);
86
+ break;
87
+
88
+ case 'debug':
89
+ console.log('🔧 Collecting Bob\'s Workshop debug information...\n');
90
+ const debugModule = await loadCliModule('../dist/cli/debug.js');
91
+ await debugModule.runDebug();
92
+ break;
93
+
94
+ case '--help':
95
+ case '-h':
96
+ await showHelp();
97
+ break;
98
+
99
+ case '--version':
100
+ case '-v':
101
+ await showVersion();
102
+ break;
103
+
104
+ case '--setup':
105
+ case '-s':
106
+ console.log('🔧 Starting Bob\'s MCP setup wizard...\n');
107
+ const setupModule = await loadCliModule('../dist/cli/setup.js');
108
+ await setupModule.runSetup();
109
+ break;
110
+
111
+ case '--check':
112
+ case '-c':
113
+ case undefined:
114
+ // Default action is to run installation check
115
+ console.log('🔧 Checking Bob\'s MCP installation...\n');
116
+ const checkerModule = await loadCliModule('../dist/cli/checker.js');
117
+ await checkerModule.runInstallationCheck();
118
+ break;
119
+
120
+ default:
121
+ console.error(`Unknown command: ${command}`);
122
+ console.error('Run "bobs --help" for usage information.');
123
+ process.exit(1);
124
+ }
125
+ }
126
+
127
+ main().catch(error => {
128
+ console.error('❌ Error:', error.message);
129
+ process.exit(1);
130
+ });
@@ -0,0 +1,106 @@
1
+ // src/api/taskLogger.ts
2
+ import { z } from "zod";
3
+ import { v4 as uuidv4 } from "uuid";
4
+ export const TaskCreateSchema = z.object({
5
+ name: z.string().min(1, "Task name is required").max(100, "Task name too long"),
6
+ priority: z.enum(['low', 'medium', 'high', 'critical']),
7
+ timestamp: z.string().datetime().optional(),
8
+ status: z.enum(['pending', 'in_progress', 'completed']).default('pending')
9
+ });
10
+ export const TaskUpdateSchema = z.object({
11
+ name: z.string().min(1).max(100).optional(),
12
+ priority: z.enum(['low', 'medium', 'high', 'critical']).optional(),
13
+ timestamp: z.string().datetime().optional(),
14
+ status: z.enum(['pending', 'in_progress', 'completed']).optional()
15
+ });
16
+ class TaskService {
17
+ constructor() {
18
+ this.tasks = new Map();
19
+ }
20
+ createTask(input) {
21
+ const validated = TaskCreateSchema.parse(input);
22
+ const now = new Date().toISOString();
23
+ const task = {
24
+ id: uuidv4(),
25
+ name: validated.name,
26
+ priority: validated.priority,
27
+ timestamp: validated.timestamp || now,
28
+ status: validated.status,
29
+ created_at: now,
30
+ updated_at: now
31
+ };
32
+ this.tasks.set(task.id, task);
33
+ console.log(`[TaskLogger] Created task ${task.id}: ${task.name}`);
34
+ return task;
35
+ }
36
+ getAllTasks() {
37
+ return Array.from(this.tasks.values()).sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime());
38
+ }
39
+ getTaskById(id) {
40
+ return this.tasks.get(id) || null;
41
+ }
42
+ updateTask(id, input) {
43
+ const existingTask = this.tasks.get(id);
44
+ if (!existingTask) {
45
+ return null;
46
+ }
47
+ const validated = TaskUpdateSchema.parse(input);
48
+ const updatedTask = {
49
+ ...existingTask,
50
+ ...validated,
51
+ updated_at: new Date().toISOString()
52
+ };
53
+ this.tasks.set(id, updatedTask);
54
+ console.log(`[TaskLogger] Updated task ${id}: ${updatedTask.name}`);
55
+ return updatedTask;
56
+ }
57
+ deleteTask(id) {
58
+ const existed = this.tasks.has(id);
59
+ this.tasks.delete(id);
60
+ if (existed) {
61
+ console.log(`[TaskLogger] Deleted task ${id}`);
62
+ }
63
+ return existed;
64
+ }
65
+ getTaskCount() {
66
+ return this.tasks.size;
67
+ }
68
+ clearAllTasks() {
69
+ const count = this.tasks.size;
70
+ this.tasks.clear();
71
+ console.log(`[TaskLogger] Cleared ${count} tasks`);
72
+ return count;
73
+ }
74
+ // Filter and search methods
75
+ getTasksByPriority(priority) {
76
+ return this.getAllTasks().filter(task => task.priority === priority);
77
+ }
78
+ getTasksByStatus(status) {
79
+ return this.getAllTasks().filter(task => task.status === status);
80
+ }
81
+ searchTasks(query) {
82
+ const lowerQuery = query.toLowerCase();
83
+ return this.getAllTasks().filter(task => task.name.toLowerCase().includes(lowerQuery));
84
+ }
85
+ }
86
+ // Singleton instance for in-memory storage
87
+ export const taskService = new TaskService();
88
+ // Helper function for API error responses
89
+ export function createErrorResponse(message, statusCode = 400) {
90
+ return {
91
+ error: true,
92
+ message,
93
+ statusCode,
94
+ timestamp: new Date().toISOString()
95
+ };
96
+ }
97
+ // Helper function for API success responses
98
+ export function createSuccessResponse(data, message) {
99
+ return {
100
+ success: true,
101
+ data,
102
+ message,
103
+ timestamp: new Date().toISOString()
104
+ };
105
+ }
106
+ //# sourceMappingURL=taskLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taskLogger.js","sourceRoot":"","sources":["../../src/api/task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