@prmichaelsen/task-mcp 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/.env.example +19 -0
  2. package/AGENT.md +1165 -0
  3. package/CHANGELOG.md +72 -0
  4. package/agent/commands/acp.commit.md +511 -0
  5. package/agent/commands/acp.init.md +376 -0
  6. package/agent/commands/acp.package-install.md +347 -0
  7. package/agent/commands/acp.proceed.md +311 -0
  8. package/agent/commands/acp.report.md +392 -0
  9. package/agent/commands/acp.status.md +280 -0
  10. package/agent/commands/acp.sync.md +323 -0
  11. package/agent/commands/acp.update.md +301 -0
  12. package/agent/commands/acp.validate.md +385 -0
  13. package/agent/commands/acp.version-check-for-updates.md +275 -0
  14. package/agent/commands/acp.version-check.md +190 -0
  15. package/agent/commands/acp.version-update.md +288 -0
  16. package/agent/commands/command.template.md +273 -0
  17. package/agent/commands/git.commit.md +511 -0
  18. package/agent/commands/git.init.md +513 -0
  19. package/agent/design/.gitkeep +0 -0
  20. package/agent/design/acp-task-execution-requirements.md +555 -0
  21. package/agent/design/api-dto-design.md +394 -0
  22. package/agent/design/code-extraction-guide.md +827 -0
  23. package/agent/design/design.template.md +136 -0
  24. package/agent/design/requirements.template.md +387 -0
  25. package/agent/design/rest-api-integration.md +489 -0
  26. package/agent/design/sdk-export-requirements.md +549 -0
  27. package/agent/milestones/.gitkeep +0 -0
  28. package/agent/milestones/milestone-1-{title}.template.md +206 -0
  29. package/agent/milestones/milestone-2-task-infrastructure.md +232 -0
  30. package/agent/milestones/milestone-4-autonomous-execution.md +235 -0
  31. package/agent/patterns/.gitkeep +0 -0
  32. package/agent/patterns/bootstrap.md +1271 -0
  33. package/agent/patterns/bootstrap.template.md +1237 -0
  34. package/agent/patterns/pattern.template.md +364 -0
  35. package/agent/progress.template.yaml +158 -0
  36. package/agent/progress.yaml +375 -0
  37. package/agent/scripts/check-for-updates.sh +88 -0
  38. package/agent/scripts/install.sh +157 -0
  39. package/agent/scripts/uninstall.sh +75 -0
  40. package/agent/scripts/update.sh +139 -0
  41. package/agent/scripts/version.sh +35 -0
  42. package/agent/tasks/.gitkeep +0 -0
  43. package/agent/tasks/task-1-{title}.template.md +225 -0
  44. package/agent/tasks/task-86-task-data-model-schemas.md +143 -0
  45. package/agent/tasks/task-87-task-database-service.md +220 -0
  46. package/agent/tasks/task-88-firebase-client-wrapper.md +139 -0
  47. package/agent/tasks/task-88-task-execution-engine.md +277 -0
  48. package/agent/tasks/task-89-mcp-server-implementation.md +197 -0
  49. package/agent/tasks/task-90-build-configuration.md +146 -0
  50. package/agent/tasks/task-91-deployment-configuration.md +128 -0
  51. package/coverage/base.css +224 -0
  52. package/coverage/block-navigation.js +87 -0
  53. package/coverage/favicon.png +0 -0
  54. package/coverage/index.html +191 -0
  55. package/coverage/lcov-report/base.css +224 -0
  56. package/coverage/lcov-report/block-navigation.js +87 -0
  57. package/coverage/lcov-report/favicon.png +0 -0
  58. package/coverage/lcov-report/index.html +191 -0
  59. package/coverage/lcov-report/prettify.css +1 -0
  60. package/coverage/lcov-report/prettify.js +2 -0
  61. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  62. package/coverage/lcov-report/sorter.js +210 -0
  63. package/coverage/lcov-report/src/client.ts.html +1030 -0
  64. package/coverage/lcov-report/src/constant/collections.ts.html +469 -0
  65. package/coverage/lcov-report/src/constant/index.html +116 -0
  66. package/coverage/lcov-report/src/dto/index.html +116 -0
  67. package/coverage/lcov-report/src/dto/transformers.ts.html +568 -0
  68. package/coverage/lcov-report/src/index.html +146 -0
  69. package/coverage/lcov-report/src/schemas/index.html +116 -0
  70. package/coverage/lcov-report/src/schemas/task.ts.html +547 -0
  71. package/coverage/lcov-report/src/server-factory.ts.html +418 -0
  72. package/coverage/lcov-report/src/server.ts.html +289 -0
  73. package/coverage/lcov-report/src/services/index.html +116 -0
  74. package/coverage/lcov-report/src/services/task-database.service.ts.html +1495 -0
  75. package/coverage/lcov-report/src/tools/index.html +236 -0
  76. package/coverage/lcov-report/src/tools/index.ts.html +292 -0
  77. package/coverage/lcov-report/src/tools/task-add-message.ts.html +277 -0
  78. package/coverage/lcov-report/src/tools/task-complete-task-item.ts.html +343 -0
  79. package/coverage/lcov-report/src/tools/task-create-milestone.ts.html +286 -0
  80. package/coverage/lcov-report/src/tools/task-create-task-item.ts.html +358 -0
  81. package/coverage/lcov-report/src/tools/task-get-next-step.ts.html +460 -0
  82. package/coverage/lcov-report/src/tools/task-get-status.ts.html +316 -0
  83. package/coverage/lcov-report/src/tools/task-report-completion.ts.html +343 -0
  84. package/coverage/lcov-report/src/tools/task-update-progress.ts.html +232 -0
  85. package/coverage/lcov.info +974 -0
  86. package/coverage/prettify.css +1 -0
  87. package/coverage/prettify.js +2 -0
  88. package/coverage/sort-arrow-sprite.png +0 -0
  89. package/coverage/sorter.js +210 -0
  90. package/coverage/src/client.ts.html +1030 -0
  91. package/coverage/src/constant/collections.ts.html +469 -0
  92. package/coverage/src/constant/index.html +116 -0
  93. package/coverage/src/dto/index.html +116 -0
  94. package/coverage/src/dto/transformers.ts.html +568 -0
  95. package/coverage/src/index.html +146 -0
  96. package/coverage/src/schemas/index.html +116 -0
  97. package/coverage/src/schemas/task.ts.html +547 -0
  98. package/coverage/src/server-factory.ts.html +418 -0
  99. package/coverage/src/server.ts.html +289 -0
  100. package/coverage/src/services/index.html +116 -0
  101. package/coverage/src/services/task-database.service.ts.html +1495 -0
  102. package/coverage/src/tools/index.html +236 -0
  103. package/coverage/src/tools/index.ts.html +292 -0
  104. package/coverage/src/tools/task-add-message.ts.html +277 -0
  105. package/coverage/src/tools/task-complete-task-item.ts.html +343 -0
  106. package/coverage/src/tools/task-create-milestone.ts.html +286 -0
  107. package/coverage/src/tools/task-create-task-item.ts.html +358 -0
  108. package/coverage/src/tools/task-get-next-step.ts.html +460 -0
  109. package/coverage/src/tools/task-get-status.ts.html +316 -0
  110. package/coverage/src/tools/task-report-completion.ts.html +343 -0
  111. package/coverage/src/tools/task-update-progress.ts.html +232 -0
  112. package/firestore.rules +95 -0
  113. package/jest.config.js +31 -0
  114. package/package.json +67 -0
  115. package/src/client.spec.ts +199 -0
  116. package/src/client.ts +315 -0
  117. package/src/constant/collections.ts +128 -0
  118. package/src/dto/index.ts +47 -0
  119. package/src/dto/task-api.dto.ts +219 -0
  120. package/src/dto/transformers.spec.ts +462 -0
  121. package/src/dto/transformers.ts +161 -0
  122. package/src/schemas/task.ts +154 -0
  123. package/src/server-factory.spec.ts +70 -0
  124. package/src/server-factory.ts +111 -0
  125. package/src/server.ts +68 -0
  126. package/src/services/task-database.service.e2e.ts +116 -0
  127. package/src/services/task-database.service.spec.ts +479 -0
  128. package/src/services/task-database.service.ts +470 -0
  129. package/src/test-schemas.ts +161 -0
  130. package/src/tools/index.ts +69 -0
  131. package/src/tools/task-add-message.ts +64 -0
  132. package/src/tools/task-complete-task-item.ts +86 -0
  133. package/src/tools/task-create-milestone.ts +67 -0
  134. package/src/tools/task-create-task-item.ts +91 -0
  135. package/src/tools/task-get-next-step.spec.ts +136 -0
  136. package/src/tools/task-get-next-step.ts +125 -0
  137. package/src/tools/task-get-status.spec.ts +213 -0
  138. package/src/tools/task-get-status.ts +77 -0
  139. package/src/tools/task-report-completion.ts +86 -0
  140. package/src/tools/task-update-progress.ts +49 -0
  141. package/src/tools/tools.spec.ts +194 -0
  142. package/tsconfig.json +31 -0
@@ -0,0 +1,139 @@
1
+ #!/bin/bash
2
+
3
+ # Agent Context Protocol (ACP) Update Script
4
+ # This script updates AGENT.md, template files, and utility scripts from the repository
5
+
6
+ set -e
7
+
8
+ # Colors for output using tput (more reliable than ANSI codes)
9
+ if command -v tput >/dev/null 2>&1 && [ -t 1 ]; then
10
+ RED=$(tput setaf 1)
11
+ GREEN=$(tput setaf 2)
12
+ YELLOW=$(tput setaf 3)
13
+ BLUE=$(tput setaf 4)
14
+ BOLD=$(tput bold)
15
+ NC=$(tput sgr0)
16
+ else
17
+ RED=''
18
+ GREEN=''
19
+ YELLOW=''
20
+ BLUE=''
21
+ BOLD=''
22
+ NC=''
23
+ fi
24
+
25
+ # Repository details
26
+ REPO_URL="https://github.com/prmichaelsen/agent-context-protocol.git"
27
+ BRANCH="mainline"
28
+
29
+ echo "${BLUE}Agent Context Protocol (ACP) Updater${NC}"
30
+ echo "======================================"
31
+ echo ""
32
+
33
+ # Check if AGENT.md exists
34
+ if [ ! -f "AGENT.md" ]; then
35
+ echo "${RED}Error: AGENT.md not found in current directory${NC}"
36
+ echo "This script should be run from your project root where AGENT.md is located."
37
+ exit 1
38
+ fi
39
+
40
+ # Create temporary directory
41
+ TEMP_DIR=$(mktemp -d)
42
+ trap "rm -rf $TEMP_DIR" EXIT
43
+
44
+ echo "Fetching latest ACP files..."
45
+ if ! git clone --depth 1 --branch "$BRANCH" "$REPO_URL" "$TEMP_DIR" &>/dev/null; then
46
+ echo "${RED}Error: Failed to fetch repository${NC}"
47
+ echo "Please check your internet connection and try again."
48
+ exit 1
49
+ fi
50
+
51
+ echo "${GREEN}✓${NC} Latest files fetched"
52
+ echo ""
53
+
54
+ # Ensure reports directory exists and is ignored
55
+ mkdir -p "agent/reports"
56
+ if [ ! -f "agent/.gitignore" ]; then
57
+ echo "Creating agent/.gitignore..."
58
+ cat > "agent/.gitignore" << 'EOF'
59
+ # Agent Context Protocol - Local Files
60
+ # These files are generated locally and should not be committed
61
+
62
+ # Reports directory - generated by @acp.report command
63
+ reports/
64
+ EOF
65
+ echo "${GREEN}✓${NC} Created agent/.gitignore"
66
+ fi
67
+
68
+ echo "Updating ACP files..."
69
+
70
+ # Update template files (only .template.md files from these directories)
71
+ find "$TEMP_DIR/agent/design" -maxdepth 1 -name "*.template.md" -exec cp {} "agent/design/" \;
72
+ find "$TEMP_DIR/agent/milestones" -maxdepth 1 -name "*.template.md" -exec cp {} "agent/milestones/" \;
73
+ find "$TEMP_DIR/agent/patterns" -maxdepth 1 -name "*.template.md" -exec cp {} "agent/patterns/" \;
74
+ find "$TEMP_DIR/agent/tasks" -maxdepth 1 -name "*.template.md" -exec cp {} "agent/tasks/" \;
75
+
76
+ # Update command template
77
+ mkdir -p "agent/commands"
78
+ cp "$TEMP_DIR/agent/commands/command.template.md" "agent/commands/"
79
+
80
+ # Update all command files (flat structure with dot notation)
81
+ # Copies files like acp.init.md, acp.status.md, deploy.production.md, etc.
82
+ if [ -d "$TEMP_DIR/agent/commands" ]; then
83
+ find "$TEMP_DIR/agent/commands" -maxdepth 1 -name "*.*.md" -exec cp {} "agent/commands/" \;
84
+ fi
85
+
86
+ # Update progress template
87
+ cp "$TEMP_DIR/agent/progress.template.yaml" "agent/"
88
+
89
+ # Update AGENT.md
90
+ cp "$TEMP_DIR/AGENT.md" "."
91
+
92
+ # Update scripts
93
+ cp "$TEMP_DIR/agent/scripts/update.sh" "agent/scripts/"
94
+ cp "$TEMP_DIR/agent/scripts/check-for-updates.sh" "agent/scripts/"
95
+ cp "$TEMP_DIR/agent/scripts/uninstall.sh" "agent/scripts/"
96
+ cp "$TEMP_DIR/agent/scripts/version.sh" "agent/scripts/"
97
+ cp "$TEMP_DIR/agent/scripts/install.sh" "agent/scripts/"
98
+ chmod +x agent/scripts/*.sh
99
+
100
+ echo "${GREEN}✓${NC} All files updated"
101
+ echo ""
102
+ echo "${GREEN}Update complete!${NC}"
103
+ echo ""
104
+ echo "${BLUE}What was updated:${NC}"
105
+ echo " ✓ AGENT.md (methodology documentation)"
106
+ echo " ✓ Template files (design, milestone, task, pattern)"
107
+ echo " ✓ Command files (all ACP commands)"
108
+ echo " ✓ Utility scripts (update, check-for-updates, version, etc.)"
109
+ echo ""
110
+ echo "${BLUE}Next steps:${NC}"
111
+ echo "1. Review changes: git diff"
112
+ echo "2. See what changed: git status"
113
+ echo "3. Revert if needed: git checkout <file>"
114
+ echo ""
115
+ echo "For detailed changelog:"
116
+ echo " https://github.com/prmichaelsen/agent-context-protocol/blob/mainline/CHANGELOG.md"
117
+ echo ""
118
+ echo "${BLUE}ACP Commands Available:${NC}"
119
+ echo ""
120
+ echo " ${GREEN}@acp.init${NC} - Initialize agent context (run after update!)"
121
+ echo " ${GREEN}@acp.proceed${NC} - Continue with next task"
122
+ echo " ${GREEN}@acp.status${NC} - Display project status"
123
+ echo " ${GREEN}@acp.update${NC} - Update progress tracking"
124
+ echo " ${GREEN}@acp.sync${NC} - Sync documentation with code"
125
+ echo " ${GREEN}@acp.validate${NC} - Validate ACP documents"
126
+ echo " ${GREEN}@acp.report${NC} - Generate project report"
127
+ echo " ${GREEN}@acp.version-check${NC} - Show current ACP version"
128
+ echo " ${GREEN}@acp.version-check-for-updates${NC} - Check for ACP updates"
129
+ echo " ${GREEN}@acp.version-update${NC} - Update ACP to latest version"
130
+ echo " ${GREEN}@acp.package-install${NC} - Install third-party command packages"
131
+ echo ""
132
+ echo "${BLUE}Git Commands Available:${NC}"
133
+ echo ""
134
+ echo " ${GREEN}@git.init${NC} - Initialize git repository with smart .gitignore"
135
+ echo " ${GREEN}@git.commit${NC} - Intelligent version-aware git commit"
136
+ echo ""
137
+ echo "${BLUE}For AI agents:${NC}"
138
+ echo "Type '${GREEN}@acp.init${NC}' to reload context with updated files."
139
+ echo ""
@@ -0,0 +1,35 @@
1
+ #!/bin/bash
2
+
3
+ # ACP Version Check Script
4
+ # Extracts and displays the current ACP version from AGENT.md
5
+
6
+ set -e
7
+
8
+ # Colors for output
9
+ GREEN='\033[0;32m'
10
+ BLUE='\033[0;34m'
11
+ NC='\033[0m' # No Color
12
+
13
+ # Check if AGENT.md exists
14
+ if [ ! -f "AGENT.md" ]; then
15
+ echo "Error: AGENT.md not found in current directory"
16
+ echo "This script should be run from your project root where AGENT.md is located."
17
+ exit 1
18
+ fi
19
+
20
+ # Extract version from AGENT.md
21
+ VERSION=$(grep -m 1 "^\*\*Version\*\*:" AGENT.md | sed 's/.*: //')
22
+ CREATED=$(grep -m 1 "^\*\*Created\*\*:" AGENT.md | sed 's/.*: //')
23
+ STATUS=$(grep -m 1 "^\*\*Status\*\*:" AGENT.md | sed 's/.*: //')
24
+
25
+ # Display version information
26
+ echo -e "${BLUE}📦 ACP Version Information${NC}"
27
+ echo ""
28
+ echo "Version: $VERSION"
29
+ echo "Created: $CREATED"
30
+ echo "Status: $STATUS"
31
+ echo ""
32
+ echo -e "${GREEN}✓${NC} ACP is installed"
33
+ echo ""
34
+ echo "To check for updates: ./agent/scripts/check-for-updates.sh"
35
+ echo "To update ACP: ./agent/scripts/update.sh"
File without changes
@@ -0,0 +1,225 @@
1
+ # Task {N}: {Descriptive Task Name}
2
+
3
+ **Milestone**: [M{N} - Milestone Name](../milestones/milestone-{N}-{name}.md)
4
+ **Estimated Time**: [e.g., "2 hours", "4 hours", "1 day"]
5
+ **Dependencies**: [List prerequisite tasks, or "None"]
6
+ **Status**: Not Started | In Progress | Completed
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ [Clearly state what this task accomplishes. Be specific and focused on a single, achievable goal.]
13
+
14
+ **Example**: "Create the basic project structure with all necessary configuration files and directory organization for a TypeScript-based MCP server."
15
+
16
+ ---
17
+
18
+ ## Context
19
+
20
+ [Provide background information that helps understand why this task is necessary and how it fits into the larger milestone.]
21
+
22
+ **Example**: "This task establishes the foundation for the project. Without proper structure and configuration, subsequent development tasks cannot proceed. The structure follows industry best practices for TypeScript projects and MCP server organization."
23
+
24
+ ---
25
+
26
+ ## Steps
27
+
28
+ [Provide a detailed, sequential list of actions to complete this task. Each step should be concrete and actionable.]
29
+
30
+ ### 1. [Step Category or Action]
31
+ [Detailed description of what to do]
32
+
33
+ ```bash
34
+ # Command examples if applicable
35
+ command --with-flags
36
+ ```
37
+
38
+ ```typescript
39
+ // Code examples if applicable
40
+ const example = "code";
41
+ ```
42
+
43
+ ### 2. [Next Step]
44
+ [Detailed description]
45
+
46
+ ### 3. [Next Step]
47
+ [Detailed description]
48
+
49
+ **Example**:
50
+
51
+ ### 1. Create Project Directory
52
+ Create the root directory for the project and navigate into it:
53
+
54
+ ```bash
55
+ mkdir -p my-project
56
+ cd my-project
57
+ ```
58
+
59
+ ### 2. Initialize npm Project
60
+ Initialize a new npm project with default settings:
61
+
62
+ ```bash
63
+ npm init -y
64
+ ```
65
+
66
+ ### 3. Update package.json
67
+ Edit the generated package.json to include proper metadata and scripts:
68
+
69
+ ```json
70
+ {
71
+ "name": "my-project",
72
+ "version": "0.1.0",
73
+ "description": "Description of what this project does",
74
+ "main": "dist/index.js",
75
+ "type": "module",
76
+ "scripts": {
77
+ "build": "node esbuild.build.js",
78
+ "dev": "tsx watch src/index.ts",
79
+ "start": "node dist/index.js",
80
+ "test": "vitest",
81
+ "typecheck": "tsc --noEmit"
82
+ },
83
+ "keywords": ["mcp", "relevant", "keywords"],
84
+ "author": "Your Name",
85
+ "license": "MIT"
86
+ }
87
+ ```
88
+
89
+ ### 4. Create Directory Structure
90
+ Create all necessary directories:
91
+
92
+ ```bash
93
+ mkdir -p src/{types,utils,tools}
94
+ mkdir -p tests/{unit,integration}
95
+ mkdir -p agent/{design,milestones,patterns,tasks}
96
+ ```
97
+
98
+ ### 5. Create Configuration Files
99
+ Create TypeScript configuration, build scripts, and other config files.
100
+
101
+ **tsconfig.json**:
102
+ ```json
103
+ {
104
+ "compilerOptions": {
105
+ "target": "ES2022",
106
+ "module": "Node16",
107
+ "moduleResolution": "Node16",
108
+ "lib": ["ES2022"],
109
+ "outDir": "./dist",
110
+ "rootDir": "./src",
111
+ "strict": true,
112
+ "esModuleInterop": true,
113
+ "skipLibCheck": true,
114
+ "forceConsistentCasingInFileNames": true,
115
+ "resolveJsonModule": true,
116
+ "declaration": true,
117
+ "declarationMap": true,
118
+ "sourceMap": true
119
+ },
120
+ "include": ["src/**/*"],
121
+ "exclude": ["node_modules", "dist", "tests"]
122
+ }
123
+ ```
124
+
125
+ [Continue with other config files...]
126
+
127
+ ---
128
+
129
+ ## Verification
130
+
131
+ [Provide a checklist of items to verify the task is complete. Each item should be objectively verifiable.]
132
+
133
+ - [ ] Verification item 1: [Specific condition to check]
134
+ - [ ] Verification item 2: [Specific condition to check]
135
+ - [ ] Verification item 3: [Specific condition to check]
136
+ - [ ] Verification item 4: [Specific condition to check]
137
+ - [ ] Verification item 5: [Specific condition to check]
138
+
139
+ **Example**:
140
+ - [ ] Project directory created and contains expected subdirectories
141
+ - [ ] package.json exists and contains correct metadata
142
+ - [ ] tsconfig.json exists and is valid JSON
143
+ - [ ] All configuration files created (.gitignore, .env.example, etc.)
144
+ - [ ] Directory structure matches specification
145
+ - [ ] No syntax errors in configuration files
146
+
147
+ ---
148
+
149
+ ## Expected Output
150
+
151
+ [Describe what the project should look like after this task is complete.]
152
+
153
+ **File Structure**:
154
+ ```
155
+ project-root/
156
+ ├── file1
157
+ ├── file2
158
+ └── directory/
159
+ └── file3
160
+ ```
161
+
162
+ **Key Files Created**:
163
+ - `file1`: [Purpose]
164
+ - `file2`: [Purpose]
165
+ - `directory/file3`: [Purpose]
166
+
167
+ ---
168
+
169
+ ## Common Issues and Solutions
170
+
171
+ [Document potential problems and how to resolve them:]
172
+
173
+ ### Issue 1: [Problem description]
174
+ **Symptom**: [What the user will see]
175
+ **Solution**: [How to fix it]
176
+
177
+ ### Issue 2: [Problem description]
178
+ **Symptom**: [What the user will see]
179
+ **Solution**: [How to fix it]
180
+
181
+ **Example**:
182
+
183
+ ### Issue 1: npm init fails
184
+ **Symptom**: Error message about permissions or missing npm
185
+ **Solution**: Ensure Node.js and npm are installed correctly. Run `node --version` and `npm --version` to verify.
186
+
187
+ ### Issue 2: TypeScript configuration errors
188
+ **Symptom**: tsc complains about invalid configuration
189
+ **Solution**: Validate JSON syntax in tsconfig.json. Ensure all required fields are present.
190
+
191
+ ---
192
+
193
+ ## Resources
194
+
195
+ [Link to relevant documentation, examples, or references:]
196
+
197
+ - [Resource 1 Name](URL): Description
198
+ - [Resource 2 Name](URL): Description
199
+ - [Resource 3 Name](URL): Description
200
+
201
+ **Example**:
202
+ - [TypeScript Handbook](https://www.typescriptlang.org/docs/): Official TypeScript documentation
203
+ - [esbuild Documentation](https://esbuild.github.io/): Build tool documentation
204
+ - [MCP SDK Documentation](https://github.com/modelcontextprotocol/sdk): MCP protocol reference
205
+
206
+ ---
207
+
208
+ ## Notes
209
+
210
+ [Any additional context, warnings, or considerations:]
211
+
212
+ - Note 1: [Important information]
213
+ - Note 2: [Important information]
214
+ - Note 3: [Important information]
215
+
216
+ **Example**:
217
+ - This task creates the foundation for all subsequent work
218
+ - Configuration files may need adjustment based on specific project requirements
219
+ - Keep .env files out of version control (ensure .gitignore is correct)
220
+
221
+ ---
222
+
223
+ **Next Task**: [Link to next task: task-{N+1}-{name}.md]
224
+ **Related Design Docs**: [Links to relevant design documents]
225
+ **Estimated Completion Date**: [YYYY-MM-DD or "TBD"]
@@ -0,0 +1,143 @@
1
+ # Task 86: Task Data Model and Schemas
2
+
3
+ **Milestone**: Milestone 1 - Task Infrastructure
4
+ **Estimated Time**: 8 hours
5
+ **Dependencies**: None
6
+ **Status**: Not Started
7
+
8
+ ---
9
+
10
+ ## Objective
11
+
12
+ Create Firestore data model, TypeScript interfaces, and Zod schemas for the task execution system. This includes Task documents, TaskMessage subcollections, and Firestore security rules.
13
+
14
+ ## Steps
15
+
16
+ ### 1. Create Task Schema
17
+
18
+ Create `src/schemas/task.ts` with Zod schemas for:
19
+ - Task document
20
+ - Milestone
21
+ - TaskItem
22
+ - TaskMessage
23
+ - Progress tracking structures
24
+
25
+ ### 2. Create TypeScript Interfaces
26
+
27
+ Export TypeScript types from Zod schemas:
28
+ - `Task`
29
+ - `Milestone`
30
+ - `TaskItem`
31
+ - `TaskMessage`
32
+ - `TaskProgress`
33
+ - `TaskExecution`
34
+ - `TaskConfig`
35
+
36
+ ### 3. Update Firestore Security Rules
37
+
38
+ Add security rules to `firestore.rules`:
39
+ - Users can only access their own tasks
40
+ - Tasks are scoped to `users/{userId}/tasks/{taskId}`
41
+ - Messages are scoped to `users/{userId}/tasks/{taskId}/messages/{messageId}`
42
+ - Validate task structure on write
43
+
44
+ ### 4. Create Collection Constants
45
+
46
+ Update `src/constant/collections.ts`:
47
+ - Add `getUserTasks(userId)` helper
48
+ - Add `getUserTaskMessages(userId, taskId)` helper
49
+
50
+ ## Verification
51
+
52
+ - [ ] Schemas compile without errors
53
+ - [ ] All required fields are present
54
+ - [ ] Optional fields are properly typed
55
+ - [ ] Firestore rules pass security tests
56
+ - [ ] Collection helpers return correct paths
57
+ - [ ] Zod validation works for valid data
58
+ - [ ] Zod validation rejects invalid data
59
+
60
+ ## Example Schema Structure
61
+
62
+ ```typescript
63
+ // src/schemas/task.ts
64
+ import { z } from 'zod'
65
+
66
+ export const MilestoneSchema = z.object({
67
+ id: z.string(),
68
+ name: z.string(),
69
+ description: z.string(),
70
+ status: z.enum(['not_started', 'in_progress', 'completed']),
71
+ progress: z.number().min(0).max(100),
72
+ tasks_completed: z.number(),
73
+ tasks_total: z.number(),
74
+ started: z.string().optional(),
75
+ completed: z.string().optional()
76
+ })
77
+
78
+ export const TaskItemSchema = z.object({
79
+ id: z.string(),
80
+ name: z.string(),
81
+ description: z.string(),
82
+ status: z.enum(['not_started', 'in_progress', 'completed']),
83
+ estimated_hours: z.number().optional(),
84
+ completed_date: z.string().optional(),
85
+ notes: z.string().optional()
86
+ })
87
+
88
+ export const TaskSchema = z.object({
89
+ id: z.string(),
90
+ user_id: z.string(),
91
+ title: z.string(),
92
+ description: z.string(),
93
+ status: z.enum(['not_started', 'in_progress', 'paused', 'completed', 'failed']),
94
+ created_at: z.string(),
95
+ updated_at: z.string(),
96
+ started_at: z.string().optional(),
97
+ completed_at: z.string().optional(),
98
+
99
+ progress: z.object({
100
+ current_milestone: z.string(),
101
+ current_task: z.string(),
102
+ overall_percentage: z.number().min(0).max(100),
103
+ milestones: z.array(MilestoneSchema),
104
+ tasks: z.record(z.array(TaskItemSchema))
105
+ }),
106
+
107
+ execution: z.object({
108
+ api_messages: z.array(z.any()),
109
+ task_messages: z.array(z.any()),
110
+ tool_results: z.array(z.any()),
111
+ error: z.string().optional(),
112
+ abort_reason: z.string().optional()
113
+ }),
114
+
115
+ config: z.object({
116
+ model: z.string(),
117
+ system_prompt: z.string(),
118
+ auto_approve: z.boolean(),
119
+ max_iterations: z.number().optional(),
120
+ timeout_minutes: z.number().optional()
121
+ }),
122
+
123
+ metadata: z.object({
124
+ conversation_id: z.string().optional(),
125
+ parent_task_id: z.string().optional(),
126
+ tags: z.array(z.string()).optional()
127
+ }).optional()
128
+ })
129
+
130
+ export type Task = z.infer<typeof TaskSchema>
131
+ export type Milestone = z.infer<typeof MilestoneSchema>
132
+ export type TaskItem = z.infer<typeof TaskItemSchema>
133
+ ```
134
+
135
+ ## Files to Create
136
+
137
+ - `src/schemas/task.ts`
138
+ - Update `firestore.rules`
139
+ - Update `src/constant/collections.ts`
140
+
141
+ ---
142
+
143
+ **Next Task**: [Task 87: Task Database Service](task-87-task-database-service.md)