@deimoscloud/coreai 0.1.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 (216) hide show
  1. package/.prettierrc +9 -0
  2. package/AGENT_SPEC.md +347 -0
  3. package/ARCHITECTURE.md +547 -0
  4. package/DRAFT_PRD.md +1440 -0
  5. package/IMPLEMENTATION_PLAN.md +256 -0
  6. package/PRODUCT.md +473 -0
  7. package/README.md +303 -0
  8. package/WORKFLOWS.md +295 -0
  9. package/agents/_templates/ic-engineer.md +185 -0
  10. package/agents/_templates/reviewer.md +182 -0
  11. package/agents/backend-engineer.yaml +72 -0
  12. package/agents/devops-engineer.yaml +72 -0
  13. package/agents/engineering-manager.yaml +70 -0
  14. package/agents/examples/android-engineer.md +302 -0
  15. package/agents/examples/backend-engineer.md +320 -0
  16. package/agents/examples/devops-engineer.md +742 -0
  17. package/agents/examples/engineering-manager.md +469 -0
  18. package/agents/examples/frontend-engineer.md +58 -0
  19. package/agents/examples/product-manager.md +315 -0
  20. package/agents/examples/qa-engineer.md +371 -0
  21. package/agents/examples/security-engineer.md +525 -0
  22. package/agents/examples/solutions-architect.md +351 -0
  23. package/agents/examples/wearos-engineer.md +359 -0
  24. package/agents/frontend-engineer.yaml +72 -0
  25. package/commands/core/check-inbox.md +34 -0
  26. package/commands/core/delegate.md +30 -0
  27. package/commands/core/git-commit.md +144 -0
  28. package/commands/core/pr-create.md +193 -0
  29. package/commands/core/review.md +56 -0
  30. package/commands/core/sprint-status.md +65 -0
  31. package/commands/optional/docs-update.md +200 -0
  32. package/commands/optional/jira-create.md +200 -0
  33. package/commands/optional/jira-transition.md +184 -0
  34. package/commands/optional/worktree-cleanup.md +167 -0
  35. package/commands/optional/worktree-setup.md +110 -0
  36. package/dist/cli/index.js +4037 -0
  37. package/dist/cli/index.js.map +1 -0
  38. package/dist/index.d.ts +2978 -0
  39. package/dist/index.js +3867 -0
  40. package/dist/index.js.map +1 -0
  41. package/eslint.config.js +29 -0
  42. package/jest.config.js +22 -0
  43. package/knowledge-library/README.md +118 -0
  44. package/knowledge-library/android-engineer/context/current.txt +42 -0
  45. package/knowledge-library/android-engineer/control/decisions.txt +9 -0
  46. package/knowledge-library/android-engineer/control/dependencies.txt +19 -0
  47. package/knowledge-library/android-engineer/control/objectives.txt +26 -0
  48. package/knowledge-library/android-engineer/history/.gitkeep +0 -0
  49. package/knowledge-library/android-engineer/inbox/processed/.gitkeep +0 -0
  50. package/knowledge-library/android-engineer/outbox/.gitkeep +0 -0
  51. package/knowledge-library/android-engineer/tech/.gitkeep +0 -0
  52. package/knowledge-library/architecture.txt +61 -0
  53. package/knowledge-library/backend-engineer/context/current.txt +42 -0
  54. package/knowledge-library/backend-engineer/control/decisions.txt +9 -0
  55. package/knowledge-library/backend-engineer/control/dependencies.txt +19 -0
  56. package/knowledge-library/backend-engineer/control/objectives.txt +26 -0
  57. package/knowledge-library/backend-engineer/history/.gitkeep +0 -0
  58. package/knowledge-library/backend-engineer/inbox/processed/.gitkeep +0 -0
  59. package/knowledge-library/backend-engineer/outbox/.gitkeep +0 -0
  60. package/knowledge-library/backend-engineer/tech/.gitkeep +0 -0
  61. package/knowledge-library/context.txt +52 -0
  62. package/knowledge-library/devops-engineer/context/current.txt +42 -0
  63. package/knowledge-library/devops-engineer/control/decisions.txt +9 -0
  64. package/knowledge-library/devops-engineer/control/dependencies.txt +19 -0
  65. package/knowledge-library/devops-engineer/control/objectives.txt +26 -0
  66. package/knowledge-library/devops-engineer/history/.gitkeep +0 -0
  67. package/knowledge-library/devops-engineer/inbox/processed/.gitkeep +0 -0
  68. package/knowledge-library/devops-engineer/outbox/.gitkeep +0 -0
  69. package/knowledge-library/devops-engineer/tech/.gitkeep +0 -0
  70. package/knowledge-library/engineering-manager/context/current.txt +40 -0
  71. package/knowledge-library/engineering-manager/control/decisions.txt +9 -0
  72. package/knowledge-library/engineering-manager/control/objectives.txt +27 -0
  73. package/knowledge-library/engineering-manager/history/.gitkeep +0 -0
  74. package/knowledge-library/engineering-manager/inbox/processed/.gitkeep +0 -0
  75. package/knowledge-library/engineering-manager/outbox/.gitkeep +0 -0
  76. package/knowledge-library/engineering-manager/tech/.gitkeep +0 -0
  77. package/knowledge-library/prd.txt +81 -0
  78. package/knowledge-library/product-manager/context/current.txt +42 -0
  79. package/knowledge-library/product-manager/control/decisions.txt +9 -0
  80. package/knowledge-library/product-manager/control/dependencies.txt +19 -0
  81. package/knowledge-library/product-manager/control/objectives.txt +26 -0
  82. package/knowledge-library/product-manager/history/.gitkeep +0 -0
  83. package/knowledge-library/product-manager/inbox/processed/.gitkeep +0 -0
  84. package/knowledge-library/product-manager/outbox/.gitkeep +0 -0
  85. package/knowledge-library/product-manager/tech/.gitkeep +0 -0
  86. package/knowledge-library/qa-engineer/context/current.txt +42 -0
  87. package/knowledge-library/qa-engineer/control/decisions.txt +9 -0
  88. package/knowledge-library/qa-engineer/control/dependencies.txt +19 -0
  89. package/knowledge-library/qa-engineer/control/objectives.txt +26 -0
  90. package/knowledge-library/qa-engineer/history/.gitkeep +0 -0
  91. package/knowledge-library/qa-engineer/inbox/processed/.gitkeep +0 -0
  92. package/knowledge-library/qa-engineer/outbox/.gitkeep +0 -0
  93. package/knowledge-library/qa-engineer/tech/.gitkeep +0 -0
  94. package/knowledge-library/security-engineer/context/current.txt +42 -0
  95. package/knowledge-library/security-engineer/control/decisions.txt +9 -0
  96. package/knowledge-library/security-engineer/control/dependencies.txt +19 -0
  97. package/knowledge-library/security-engineer/control/objectives.txt +26 -0
  98. package/knowledge-library/security-engineer/history/.gitkeep +0 -0
  99. package/knowledge-library/security-engineer/inbox/processed/.gitkeep +0 -0
  100. package/knowledge-library/security-engineer/outbox/.gitkeep +0 -0
  101. package/knowledge-library/security-engineer/tech/.gitkeep +0 -0
  102. package/knowledge-library/solutions-architect/context/current.txt +42 -0
  103. package/knowledge-library/solutions-architect/control/decisions.txt +9 -0
  104. package/knowledge-library/solutions-architect/control/dependencies.txt +19 -0
  105. package/knowledge-library/solutions-architect/control/objectives.txt +26 -0
  106. package/knowledge-library/solutions-architect/history/.gitkeep +0 -0
  107. package/knowledge-library/solutions-architect/inbox/processed/.gitkeep +0 -0
  108. package/knowledge-library/solutions-architect/outbox/.gitkeep +0 -0
  109. package/knowledge-library/solutions-architect/tech/.gitkeep +0 -0
  110. package/knowledge-library/wearos-engineer/context/current.txt +42 -0
  111. package/knowledge-library/wearos-engineer/control/decisions.txt +9 -0
  112. package/knowledge-library/wearos-engineer/control/dependencies.txt +19 -0
  113. package/knowledge-library/wearos-engineer/control/objectives.txt +26 -0
  114. package/knowledge-library/wearos-engineer/history/.gitkeep +0 -0
  115. package/knowledge-library/wearos-engineer/inbox/processed/.gitkeep +0 -0
  116. package/knowledge-library/wearos-engineer/outbox/.gitkeep +0 -0
  117. package/knowledge-library/wearos-engineer/tech/.gitkeep +0 -0
  118. package/package.json +66 -0
  119. package/schemas/agent.schema.json +171 -0
  120. package/schemas/coreai.config.schema.json +257 -0
  121. package/scripts/add-agent.sh +323 -0
  122. package/scripts/install.sh +354 -0
  123. package/src/adapters/factory.test.ts +386 -0
  124. package/src/adapters/factory.ts +305 -0
  125. package/src/adapters/index.ts +113 -0
  126. package/src/adapters/interfaces.ts +268 -0
  127. package/src/adapters/mcp/client.test.ts +130 -0
  128. package/src/adapters/mcp/client.ts +451 -0
  129. package/src/adapters/mcp/discovery.test.ts +315 -0
  130. package/src/adapters/mcp/discovery.ts +340 -0
  131. package/src/adapters/mcp/index.ts +66 -0
  132. package/src/adapters/mcp/mapper.test.ts +218 -0
  133. package/src/adapters/mcp/mapper.ts +536 -0
  134. package/src/adapters/mcp/registry.test.ts +433 -0
  135. package/src/adapters/mcp/registry.ts +550 -0
  136. package/src/adapters/mcp/types.ts +258 -0
  137. package/src/adapters/native/filesystem.test.ts +350 -0
  138. package/src/adapters/native/filesystem.ts +393 -0
  139. package/src/adapters/native/github.test.ts +173 -0
  140. package/src/adapters/native/github.ts +627 -0
  141. package/src/adapters/native/index.ts +22 -0
  142. package/src/adapters/native/selector.test.ts +224 -0
  143. package/src/adapters/native/selector.ts +150 -0
  144. package/src/adapters/types.ts +270 -0
  145. package/src/agents/compiler.test.ts +399 -0
  146. package/src/agents/compiler.ts +359 -0
  147. package/src/agents/index.ts +36 -0
  148. package/src/agents/loader.test.ts +319 -0
  149. package/src/agents/loader.ts +143 -0
  150. package/src/agents/resolver.test.ts +282 -0
  151. package/src/agents/resolver.ts +262 -0
  152. package/src/agents/types.ts +87 -0
  153. package/src/cache/index.ts +38 -0
  154. package/src/cache/interfaces.ts +283 -0
  155. package/src/cache/manager.test.ts +266 -0
  156. package/src/cache/manager.ts +388 -0
  157. package/src/cache/provider.test.ts +485 -0
  158. package/src/cache/provider.ts +745 -0
  159. package/src/cache/types.test.ts +192 -0
  160. package/src/cache/types.ts +313 -0
  161. package/src/cli/commands/build.test.ts +248 -0
  162. package/src/cli/commands/build.ts +244 -0
  163. package/src/cli/commands/cache.test.ts +221 -0
  164. package/src/cli/commands/cache.ts +229 -0
  165. package/src/cli/commands/index.ts +63 -0
  166. package/src/cli/commands/init.test.ts +173 -0
  167. package/src/cli/commands/init.ts +296 -0
  168. package/src/cli/commands/skills.test.ts +272 -0
  169. package/src/cli/commands/skills.ts +348 -0
  170. package/src/cli/commands/status.test.ts +392 -0
  171. package/src/cli/commands/status.ts +332 -0
  172. package/src/cli/commands/sync.test.ts +213 -0
  173. package/src/cli/commands/sync.ts +251 -0
  174. package/src/cli/commands/validate.test.ts +216 -0
  175. package/src/cli/commands/validate.ts +340 -0
  176. package/src/cli/index.test.ts +190 -0
  177. package/src/cli/index.ts +493 -0
  178. package/src/commands/context.test.ts +163 -0
  179. package/src/commands/context.ts +111 -0
  180. package/src/commands/index.ts +56 -0
  181. package/src/commands/loader.test.ts +273 -0
  182. package/src/commands/loader.ts +355 -0
  183. package/src/commands/registry.test.ts +384 -0
  184. package/src/commands/registry.ts +248 -0
  185. package/src/commands/runner.test.ts +297 -0
  186. package/src/commands/runner.ts +222 -0
  187. package/src/commands/types.ts +361 -0
  188. package/src/config/index.ts +19 -0
  189. package/src/config/loader.test.ts +262 -0
  190. package/src/config/loader.ts +188 -0
  191. package/src/config/types.ts +154 -0
  192. package/src/context/index.ts +14 -0
  193. package/src/context/loader.test.ts +334 -0
  194. package/src/context/loader.ts +357 -0
  195. package/src/index.test.ts +13 -0
  196. package/src/index.ts +244 -0
  197. package/src/knowledge-library/index.ts +44 -0
  198. package/src/knowledge-library/manager.test.ts +536 -0
  199. package/src/knowledge-library/manager.ts +804 -0
  200. package/src/knowledge-library/types.ts +432 -0
  201. package/src/skills/generator.test.ts +602 -0
  202. package/src/skills/generator.ts +491 -0
  203. package/src/skills/index.ts +27 -0
  204. package/src/skills/templates.ts +520 -0
  205. package/src/skills/types.ts +251 -0
  206. package/templates/completion-report.md +72 -0
  207. package/templates/feedback.md +56 -0
  208. package/templates/project-files/CLAUDE.md.template +109 -0
  209. package/templates/project-files/coreai.json.example +47 -0
  210. package/templates/project-files/mcp.json.template +20 -0
  211. package/templates/review-complete.md +64 -0
  212. package/templates/review-request.md +67 -0
  213. package/templates/task-assignment.md +51 -0
  214. package/tsconfig.build.json +4 -0
  215. package/tsconfig.json +26 -0
  216. package/tsup.config.ts +23 -0
@@ -0,0 +1,323 @@
1
+ #!/bin/bash
2
+
3
+ # CoreAI Add Agent Script
4
+ # Creates a new agent with KnowledgeLibrary directory structure
5
+
6
+ set -e
7
+
8
+ # Colors for output
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # Script directory (where coreai is located)
16
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
+ COREAI_DIR="$(dirname "$SCRIPT_DIR")"
18
+
19
+ # Default values
20
+ AGENT_NAME=""
21
+ AGENT_TYPE="ic" # ic or reviewer
22
+ TARGET_DIR=""
23
+ DESCRIPTION=""
24
+ DISPLAY_NAME=""
25
+
26
+ # Function to print usage
27
+ print_usage() {
28
+ echo "Usage: $0 <agent-name> [OPTIONS]"
29
+ echo ""
30
+ echo "Arguments:"
31
+ echo " agent-name Agent name (lowercase, hyphenated, e.g., backend-engineer)"
32
+ echo ""
33
+ echo "Options:"
34
+ echo " --type TYPE Agent type: 'ic' (default) or 'reviewer'"
35
+ echo " --target DIR Target project directory (default: current directory)"
36
+ echo " --description DESC Agent description"
37
+ echo " --display-name NAME Display name (default: Title Case of agent-name)"
38
+ echo " -h, --help Show this help message"
39
+ echo ""
40
+ echo "Examples:"
41
+ echo " $0 backend-engineer --type ic"
42
+ echo " $0 security-engineer --type reviewer --description 'Security reviews and audits'"
43
+ }
44
+
45
+ # Parse arguments
46
+ if [[ $# -lt 1 ]]; then
47
+ print_usage
48
+ exit 1
49
+ fi
50
+
51
+ AGENT_NAME="$1"
52
+ shift
53
+
54
+ while [[ $# -gt 0 ]]; do
55
+ case $1 in
56
+ --type)
57
+ AGENT_TYPE="$2"
58
+ shift 2
59
+ ;;
60
+ --target)
61
+ TARGET_DIR="$2"
62
+ shift 2
63
+ ;;
64
+ --description)
65
+ DESCRIPTION="$2"
66
+ shift 2
67
+ ;;
68
+ --display-name)
69
+ DISPLAY_NAME="$2"
70
+ shift 2
71
+ ;;
72
+ -h|--help)
73
+ print_usage
74
+ exit 0
75
+ ;;
76
+ *)
77
+ echo -e "${RED}Unknown option: $1${NC}"
78
+ print_usage
79
+ exit 1
80
+ ;;
81
+ esac
82
+ done
83
+
84
+ # Validate agent name (lowercase, hyphenated)
85
+ if [[ ! "$AGENT_NAME" =~ ^[a-z][a-z0-9-]*$ ]]; then
86
+ echo -e "${RED}Error: Agent name must be lowercase, start with a letter, and use hyphens (e.g., backend-engineer)${NC}"
87
+ exit 1
88
+ fi
89
+
90
+ # Validate agent type
91
+ if [[ "$AGENT_TYPE" != "ic" && "$AGENT_TYPE" != "reviewer" ]]; then
92
+ echo -e "${RED}Error: Agent type must be 'ic' or 'reviewer'${NC}"
93
+ exit 1
94
+ fi
95
+
96
+ # Set defaults
97
+ TARGET_DIR="${TARGET_DIR:-.}"
98
+ TARGET_DIR="$(cd "$TARGET_DIR" && pwd)"
99
+
100
+ # Generate display name from agent name (e.g., backend-engineer -> Backend Engineer)
101
+ if [[ -z "$DISPLAY_NAME" ]]; then
102
+ DISPLAY_NAME=$(echo "$AGENT_NAME" | sed 's/-/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1')
103
+ fi
104
+
105
+ # Set default description
106
+ if [[ -z "$DESCRIPTION" ]]; then
107
+ if [[ "$AGENT_TYPE" == "ic" ]]; then
108
+ DESCRIPTION="$DISPLAY_NAME implementing features and fixing bugs."
109
+ else
110
+ DESCRIPTION="$DISPLAY_NAME reviewing code and providing guidance."
111
+ fi
112
+ fi
113
+
114
+ echo -e "${BLUE}Adding Agent: $AGENT_NAME${NC}"
115
+ echo "=============================="
116
+ echo "Type: $AGENT_TYPE"
117
+ echo "Display Name: $DISPLAY_NAME"
118
+ echo "Description: $DESCRIPTION"
119
+ echo "Target: $TARGET_DIR"
120
+ echo ""
121
+
122
+ # Check if agent already exists
123
+ if [[ -f "$TARGET_DIR/.claude/agents/${AGENT_NAME}.md" ]]; then
124
+ echo -e "${RED}Error: Agent ${AGENT_NAME} already exists at .claude/agents/${AGENT_NAME}.md${NC}"
125
+ exit 1
126
+ fi
127
+
128
+ # Check if coreai.json exists
129
+ if [[ ! -f "$TARGET_DIR/coreai.json" ]]; then
130
+ echo -e "${YELLOW}Warning: coreai.json not found. Run install.sh first or create manually.${NC}"
131
+ fi
132
+
133
+ # Read config values from coreai.json if it exists
134
+ if [[ -f "$TARGET_DIR/coreai.json" ]]; then
135
+ PROJECT_NAME=$(jq -r '.project.name // "My Project"' "$TARGET_DIR/coreai.json")
136
+ JIRA_PROJECT=$(jq -r '.project.jiraProject // "PROJ"' "$TARGET_DIR/coreai.json")
137
+ GITHUB_REPO=$(jq -r '.project.githubRepo // ""' "$TARGET_DIR/coreai.json")
138
+ CONFLUENCE_SPACE=$(jq -r '.project.confluenceSpace // ""' "$TARGET_DIR/coreai.json")
139
+ CONFLUENCE_URL=$(jq -r '.project.confluenceUrl // "https://yourcompany.atlassian.net/wiki"' "$TARGET_DIR/coreai.json")
140
+ LINT_CMD=$(jq -r '.qualityChecks.lint // "npm run lint"' "$TARGET_DIR/coreai.json")
141
+ TEST_CMD=$(jq -r '.qualityChecks.test // "npm test"' "$TARGET_DIR/coreai.json")
142
+ else
143
+ PROJECT_NAME="My Project"
144
+ JIRA_PROJECT="PROJ"
145
+ GITHUB_REPO=""
146
+ CONFLUENCE_SPACE=""
147
+ CONFLUENCE_URL="https://yourcompany.atlassian.net/wiki"
148
+ LINT_CMD="npm run lint"
149
+ TEST_CMD="npm test"
150
+ fi
151
+
152
+ # Select template based on type
153
+ if [[ "$AGENT_TYPE" == "ic" ]]; then
154
+ TEMPLATE_FILE="$COREAI_DIR/agents/_templates/ic-engineer.md"
155
+ else
156
+ TEMPLATE_FILE="$COREAI_DIR/agents/_templates/reviewer.md"
157
+ fi
158
+
159
+ # Fallback: check if an example agent exists for this name
160
+ if [[ ! -f "$TEMPLATE_FILE" ]] && [[ -f "$COREAI_DIR/agents/examples/${AGENT_NAME}.md" ]]; then
161
+ echo -e "${BLUE}Found existing example agent, copying instead of using template...${NC}"
162
+ TEMPLATE_FILE="$COREAI_DIR/agents/examples/${AGENT_NAME}.md"
163
+ fi
164
+
165
+ if [[ ! -f "$TEMPLATE_FILE" ]]; then
166
+ echo -e "${RED}Error: Template file not found: $TEMPLATE_FILE${NC}"
167
+ exit 1
168
+ fi
169
+
170
+ # Create agent file from template
171
+ echo -e "${YELLOW}Creating agent file...${NC}"
172
+ mkdir -p "$TARGET_DIR/.claude/agents"
173
+
174
+ cp "$TEMPLATE_FILE" "$TARGET_DIR/.claude/agents/${AGENT_NAME}.md"
175
+
176
+ # Replace placeholders
177
+ sed -i.bak \
178
+ -e "s|{{AGENT_NAME}}|$AGENT_NAME|g" \
179
+ -e "s|{{AGENT_DISPLAY_NAME}}|$DISPLAY_NAME|g" \
180
+ -e "s|{{AGENT_DESCRIPTION}}|$DESCRIPTION|g" \
181
+ -e "s|{{AGENT_ROLE_DESCRIPTION}}|$DESCRIPTION|g" \
182
+ -e "s|{{PROJECT_NAME}}|$PROJECT_NAME|g" \
183
+ -e "s|{{JIRA_PROJECT}}|$JIRA_PROJECT|g" \
184
+ -e "s|{{GITHUB_REPO}}|$GITHUB_REPO|g" \
185
+ -e "s|{{CONFLUENCE_SPACE}}|$CONFLUENCE_SPACE|g" \
186
+ -e "s|{{CONFLUENCE_URL}}|$CONFLUENCE_URL|g" \
187
+ -e "s|{{LINT_CMD}}|$LINT_CMD|g" \
188
+ -e "s|{{TEST_CMD}}|$TEST_CMD|g" \
189
+ "$TARGET_DIR/.claude/agents/${AGENT_NAME}.md"
190
+
191
+ rm -f "$TARGET_DIR/.claude/agents/${AGENT_NAME}.md.bak"
192
+
193
+ echo " - .claude/agents/${AGENT_NAME}.md"
194
+
195
+ # Create KnowledgeLibrary directory structure
196
+ echo -e "${YELLOW}Creating KnowledgeLibrary directories...${NC}"
197
+ AGENT_DIR="$TARGET_DIR/KnowledgeLibrary/$AGENT_NAME"
198
+
199
+ mkdir -p "$AGENT_DIR/context"
200
+ mkdir -p "$AGENT_DIR/history"
201
+ mkdir -p "$AGENT_DIR/inbox/processed"
202
+ mkdir -p "$AGENT_DIR/outbox"
203
+ mkdir -p "$AGENT_DIR/tech"
204
+ mkdir -p "$AGENT_DIR/control"
205
+
206
+ # Create placeholder files
207
+ cat > "$AGENT_DIR/context/current.txt" << EOF
208
+ # $DISPLAY_NAME Context
209
+ # Last Updated: $(date +%Y-%m-%d)
210
+
211
+ ## Current Status
212
+ Not Started
213
+
214
+ ## Active Tasks
215
+ - [ ] None
216
+
217
+ ## Current Priorities
218
+ ### P0 (Critical)
219
+ - None
220
+
221
+ ### P1 (High)
222
+ - None
223
+
224
+ ## In Progress Work
225
+ | Task | Started | ETA | Blockers |
226
+ |------|---------|-----|----------|
227
+ | | | | |
228
+
229
+ ## Blockers
230
+ - None
231
+
232
+ ## Notes
233
+ [Working notes and context]
234
+ EOF
235
+
236
+ cat > "$AGENT_DIR/control/objectives.txt" << EOF
237
+ # $DISPLAY_NAME Objectives
238
+ # Last Updated: $(date +%Y-%m-%d)
239
+
240
+ ## Primary Objectives
241
+ 1. [Define primary objective]
242
+ 2. [Define secondary objective]
243
+
244
+ ## Current Sprint Goals
245
+ - [ ] TBD
246
+
247
+ ## Success Criteria
248
+ - [Define success criteria]
249
+ EOF
250
+
251
+ cat > "$AGENT_DIR/control/decisions.txt" << EOF
252
+ # $DISPLAY_NAME Decision Log
253
+ # Format: [YYYY-MM-DD] Decision: [summary] | Rationale: [why]
254
+
255
+ ## Decisions
256
+
257
+ [No decisions logged yet]
258
+ EOF
259
+
260
+ cat > "$AGENT_DIR/control/dependencies.txt" << EOF
261
+ # $DISPLAY_NAME Dependencies
262
+ # Last Updated: $(date +%Y-%m-%d)
263
+
264
+ ## Blocking Dependencies (Waiting On)
265
+ | Dependency | Owner | Status | Impact |
266
+ |------------|-------|--------|--------|
267
+ | | | | |
268
+
269
+ ## Providing To (Others Waiting On Me)
270
+ | Deliverable | Consumer | Status | ETA |
271
+ |-------------|----------|--------|-----|
272
+ | | | | |
273
+
274
+ ## External Dependencies
275
+ - None
276
+ EOF
277
+
278
+ # Create .gitkeep files
279
+ touch "$AGENT_DIR/history/.gitkeep"
280
+ touch "$AGENT_DIR/inbox/processed/.gitkeep"
281
+ touch "$AGENT_DIR/outbox/.gitkeep"
282
+ touch "$AGENT_DIR/tech/.gitkeep"
283
+
284
+ echo " - KnowledgeLibrary/$AGENT_NAME/"
285
+
286
+ # Update coreai.json if it exists
287
+ if [[ -f "$TARGET_DIR/coreai.json" ]]; then
288
+ echo -e "${YELLOW}Updating coreai.json...${NC}"
289
+
290
+ # Add agent to installed list using jq
291
+ jq --arg agent "$AGENT_NAME" \
292
+ '.agents.installed += [$agent] | .agents.installed |= unique' \
293
+ "$TARGET_DIR/coreai.json" > "$TARGET_DIR/coreai.json.tmp"
294
+
295
+ mv "$TARGET_DIR/coreai.json.tmp" "$TARGET_DIR/coreai.json"
296
+ echo " - Added $AGENT_NAME to agents.installed"
297
+ fi
298
+
299
+ echo ""
300
+ echo -e "${GREEN}=============================="
301
+ echo "Agent $AGENT_NAME created!"
302
+ echo "==============================${NC}"
303
+ echo ""
304
+ echo "Created:"
305
+ echo " .claude/agents/${AGENT_NAME}.md"
306
+ echo " KnowledgeLibrary/$AGENT_NAME/"
307
+ echo " ├── context/current.txt"
308
+ echo " ├── control/objectives.txt"
309
+ echo " ├── control/decisions.txt"
310
+ echo " ├── control/dependencies.txt"
311
+ echo " ├── inbox/"
312
+ echo " ├── outbox/"
313
+ echo " ├── history/"
314
+ echo " └── tech/"
315
+ echo ""
316
+ echo "Next steps:"
317
+ echo " 1. Review and customize .claude/agents/${AGENT_NAME}.md"
318
+ echo " 2. Update the technical stack and responsibilities"
319
+ echo " 3. Add to engineering-manager's team list"
320
+ echo ""
321
+ echo -e "${BLUE}To invoke:${NC}"
322
+ echo " @${AGENT_NAME} check your inbox"
323
+ echo ""
@@ -0,0 +1,354 @@
1
+ #!/bin/bash
2
+
3
+ # CoreAI Framework Installation Script
4
+ # Installs the multi-agent development framework into a project
5
+
6
+ set -e
7
+
8
+ # Colors for output
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # Script directory (where coreai is located)
16
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17
+ COREAI_DIR="$(dirname "$SCRIPT_DIR")"
18
+
19
+ # Default values
20
+ TARGET_DIR=""
21
+ PROJECT_NAME=""
22
+ JIRA_PROJECT=""
23
+ GITHUB_REPO=""
24
+ CONFLUENCE_SPACE=""
25
+ CONFLUENCE_URL="https://yourcompany.atlassian.net/wiki"
26
+ JIRA_URL="https://yourcompany.atlassian.net"
27
+ LINT_CMD="npm run lint"
28
+ STATIC_ANALYSIS_CMD="npm run lint"
29
+ TEST_CMD="npm test"
30
+ BUILD_CMD="npm run build"
31
+ AGENTS=("engineering-manager")
32
+ OPTIONAL_COMMANDS=()
33
+ INSTALL_ALL_COMMANDS=false
34
+
35
+ # Function to print usage
36
+ print_usage() {
37
+ echo "Usage: $0 [OPTIONS]"
38
+ echo ""
39
+ echo "Options:"
40
+ echo " --target DIR Target project directory (default: current directory)"
41
+ echo " --name NAME Project name"
42
+ echo " --jira KEY Jira project key (e.g., PROJ)"
43
+ echo " --github REPO GitHub repo (e.g., owner/repo)"
44
+ echo " --confluence-space KEY Confluence space key"
45
+ echo " --confluence-url URL Confluence base URL"
46
+ echo " --jira-url URL Jira base URL"
47
+ echo " --lint CMD Lint command (default: npm run lint)"
48
+ echo " --test CMD Test command (default: npm test)"
49
+ echo " --build CMD Build command (default: npm run build)"
50
+ echo " --agents LIST Comma-separated list of agents to install"
51
+ echo " --all-commands Install all optional commands"
52
+ echo " --commands LIST Comma-separated list of optional commands"
53
+ echo " -h, --help Show this help message"
54
+ echo ""
55
+ echo "Example:"
56
+ echo " $0 --name \"My Project\" --jira PROJ --github owner/repo"
57
+ }
58
+
59
+ # Parse arguments
60
+ while [[ $# -gt 0 ]]; do
61
+ case $1 in
62
+ --target)
63
+ TARGET_DIR="$2"
64
+ shift 2
65
+ ;;
66
+ --name)
67
+ PROJECT_NAME="$2"
68
+ shift 2
69
+ ;;
70
+ --jira)
71
+ JIRA_PROJECT="$2"
72
+ shift 2
73
+ ;;
74
+ --github)
75
+ GITHUB_REPO="$2"
76
+ shift 2
77
+ ;;
78
+ --confluence-space)
79
+ CONFLUENCE_SPACE="$2"
80
+ shift 2
81
+ ;;
82
+ --confluence-url)
83
+ CONFLUENCE_URL="$2"
84
+ shift 2
85
+ ;;
86
+ --jira-url)
87
+ JIRA_URL="$2"
88
+ shift 2
89
+ ;;
90
+ --lint)
91
+ LINT_CMD="$2"
92
+ shift 2
93
+ ;;
94
+ --test)
95
+ TEST_CMD="$2"
96
+ shift 2
97
+ ;;
98
+ --build)
99
+ BUILD_CMD="$2"
100
+ shift 2
101
+ ;;
102
+ --agents)
103
+ IFS=',' read -ra AGENTS <<< "$2"
104
+ shift 2
105
+ ;;
106
+ --all-commands)
107
+ INSTALL_ALL_COMMANDS=true
108
+ shift
109
+ ;;
110
+ --commands)
111
+ IFS=',' read -ra OPTIONAL_COMMANDS <<< "$2"
112
+ shift 2
113
+ ;;
114
+ -h|--help)
115
+ print_usage
116
+ exit 0
117
+ ;;
118
+ *)
119
+ echo -e "${RED}Unknown option: $1${NC}"
120
+ print_usage
121
+ exit 1
122
+ ;;
123
+ esac
124
+ done
125
+
126
+ # Set defaults
127
+ TARGET_DIR="${TARGET_DIR:-.}"
128
+ PROJECT_NAME="${PROJECT_NAME:-My Project}"
129
+ CONFLUENCE_SPACE="${CONFLUENCE_SPACE:-$JIRA_PROJECT}"
130
+
131
+ # Resolve target directory to absolute path
132
+ TARGET_DIR="$(cd "$TARGET_DIR" && pwd)"
133
+
134
+ echo -e "${BLUE}CoreAI Framework Installation${NC}"
135
+ echo "=============================="
136
+ echo ""
137
+ echo "Target directory: $TARGET_DIR"
138
+ echo "Project name: $PROJECT_NAME"
139
+ echo "Jira project: ${JIRA_PROJECT:-<not set>}"
140
+ echo "GitHub repo: ${GITHUB_REPO:-<not set>}"
141
+ echo ""
142
+
143
+ # Function to replace placeholders in a file
144
+ replace_placeholders() {
145
+ local file="$1"
146
+
147
+ sed -i.bak \
148
+ -e "s|{{PROJECT_NAME}}|$PROJECT_NAME|g" \
149
+ -e "s|{{JIRA_PROJECT}}|$JIRA_PROJECT|g" \
150
+ -e "s|{{GITHUB_REPO}}|$GITHUB_REPO|g" \
151
+ -e "s|{{CONFLUENCE_SPACE}}|$CONFLUENCE_SPACE|g" \
152
+ -e "s|{{CONFLUENCE_URL}}|$CONFLUENCE_URL|g" \
153
+ -e "s|{{JIRA_URL}}|$JIRA_URL|g" \
154
+ -e "s|{{LINT_CMD}}|$LINT_CMD|g" \
155
+ -e "s|{{STATIC_ANALYSIS_CMD}}|$STATIC_ANALYSIS_CMD|g" \
156
+ -e "s|{{TEST_CMD}}|$TEST_CMD|g" \
157
+ -e "s|{{BUILD_CMD}}|$BUILD_CMD|g" \
158
+ -e "s|{{PROJECT_ROOT}}|$TARGET_DIR|g" \
159
+ "$file"
160
+
161
+ rm -f "${file}.bak"
162
+ }
163
+
164
+ # Create .claude directories
165
+ echo -e "${YELLOW}Creating .claude directories...${NC}"
166
+ mkdir -p "$TARGET_DIR/.claude/agents"
167
+ mkdir -p "$TARGET_DIR/.claude/commands"
168
+
169
+ # Copy core commands
170
+ echo -e "${YELLOW}Installing core commands...${NC}"
171
+ for cmd in "$COREAI_DIR/commands/core/"*.md; do
172
+ if [[ -f "$cmd" ]]; then
173
+ filename=$(basename "$cmd")
174
+ cp "$cmd" "$TARGET_DIR/.claude/commands/$filename"
175
+ replace_placeholders "$TARGET_DIR/.claude/commands/$filename"
176
+ echo " - $filename"
177
+ fi
178
+ done
179
+
180
+ # Copy optional commands
181
+ if [[ "$INSTALL_ALL_COMMANDS" == true ]]; then
182
+ echo -e "${YELLOW}Installing all optional commands...${NC}"
183
+ for cmd in "$COREAI_DIR/commands/optional/"*.md; do
184
+ if [[ -f "$cmd" ]]; then
185
+ filename=$(basename "$cmd")
186
+ cp "$cmd" "$TARGET_DIR/.claude/commands/$filename"
187
+ replace_placeholders "$TARGET_DIR/.claude/commands/$filename"
188
+ echo " - $filename"
189
+ fi
190
+ done
191
+ elif [[ ${#OPTIONAL_COMMANDS[@]} -gt 0 ]]; then
192
+ echo -e "${YELLOW}Installing selected optional commands...${NC}"
193
+ for cmd_name in "${OPTIONAL_COMMANDS[@]}"; do
194
+ cmd_file="$COREAI_DIR/commands/optional/${cmd_name}.md"
195
+ if [[ -f "$cmd_file" ]]; then
196
+ cp "$cmd_file" "$TARGET_DIR/.claude/commands/${cmd_name}.md"
197
+ replace_placeholders "$TARGET_DIR/.claude/commands/${cmd_name}.md"
198
+ echo " - ${cmd_name}.md"
199
+ else
200
+ echo -e "${RED} - Warning: ${cmd_name}.md not found${NC}"
201
+ fi
202
+ done
203
+ fi
204
+
205
+ # Copy engineering-manager (required)
206
+ echo -e "${YELLOW}Installing engineering-manager agent (required)...${NC}"
207
+ cp "$COREAI_DIR/agents/examples/engineering-manager.md" "$TARGET_DIR/.claude/agents/engineering-manager.md"
208
+ replace_placeholders "$TARGET_DIR/.claude/agents/engineering-manager.md"
209
+ echo " - engineering-manager.md"
210
+
211
+ # Copy additional agents
212
+ if [[ ${#AGENTS[@]} -gt 1 ]] || [[ "${AGENTS[0]}" != "engineering-manager" ]]; then
213
+ echo -e "${YELLOW}Installing additional agents...${NC}"
214
+ for agent in "${AGENTS[@]}"; do
215
+ if [[ "$agent" == "engineering-manager" ]]; then
216
+ continue # Already installed
217
+ fi
218
+
219
+ # Check examples first, then templates
220
+ if [[ -f "$COREAI_DIR/agents/examples/${agent}.md" ]]; then
221
+ cp "$COREAI_DIR/agents/examples/${agent}.md" "$TARGET_DIR/.claude/agents/${agent}.md"
222
+ replace_placeholders "$TARGET_DIR/.claude/agents/${agent}.md"
223
+ echo " - ${agent}.md (from examples)"
224
+ else
225
+ echo -e "${YELLOW} - ${agent}.md: Not found in examples. Use add-agent.sh to create.${NC}"
226
+ fi
227
+ done
228
+ fi
229
+
230
+ # Create KnowledgeLibrary structure
231
+ echo -e "${YELLOW}Creating KnowledgeLibrary...${NC}"
232
+ mkdir -p "$TARGET_DIR/KnowledgeLibrary"
233
+
234
+ # Copy root context files from templates
235
+ for template in context.txt architecture.txt prd.txt; do
236
+ if [[ -f "$COREAI_DIR/knowledge-library/${template}" ]]; then
237
+ cp "$COREAI_DIR/knowledge-library/${template}" "$TARGET_DIR/KnowledgeLibrary/${template}"
238
+ replace_placeholders "$TARGET_DIR/KnowledgeLibrary/${template}"
239
+ fi
240
+ done
241
+
242
+ # Create agent directories in KnowledgeLibrary
243
+ echo -e "${YELLOW}Creating agent directories in KnowledgeLibrary...${NC}"
244
+ ALL_AGENTS=("engineering-manager" "${AGENTS[@]}")
245
+ # Remove duplicates
246
+ ALL_AGENTS=($(echo "${ALL_AGENTS[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' '))
247
+
248
+ for agent in "${ALL_AGENTS[@]}"; do
249
+ agent_dir="$TARGET_DIR/KnowledgeLibrary/$agent"
250
+ mkdir -p "$agent_dir/context"
251
+ mkdir -p "$agent_dir/history"
252
+ mkdir -p "$agent_dir/inbox/processed"
253
+ mkdir -p "$agent_dir/outbox"
254
+ mkdir -p "$agent_dir/tech"
255
+ mkdir -p "$agent_dir/control"
256
+
257
+ # Create placeholder files
258
+ echo "# $agent Context
259
+ # Last Updated: $(date +%Y-%m-%d)
260
+
261
+ ## Current Status
262
+ Not Started
263
+
264
+ ## Active Tasks
265
+ - [ ] None
266
+
267
+ ## Notes
268
+ [Working notes]" > "$agent_dir/context/current.txt"
269
+
270
+ echo "# $agent Objectives
271
+
272
+ ## Primary Objectives
273
+ 1. TBD
274
+
275
+ ## Current Sprint Goals
276
+ - [ ] TBD" > "$agent_dir/control/objectives.txt"
277
+
278
+ echo "# $agent Decisions
279
+ # Format: [YYYY-MM-DD] Decision: [summary] | Rationale: [why]
280
+
281
+ [No decisions logged yet]" > "$agent_dir/control/decisions.txt"
282
+
283
+ echo "# $agent Dependencies
284
+
285
+ ## Blocking (Waiting On)
286
+ None
287
+
288
+ ## Providing To
289
+ None" > "$agent_dir/control/dependencies.txt"
290
+
291
+ # Create .gitkeep files
292
+ touch "$agent_dir/history/.gitkeep"
293
+ touch "$agent_dir/inbox/processed/.gitkeep"
294
+ touch "$agent_dir/outbox/.gitkeep"
295
+ touch "$agent_dir/tech/.gitkeep"
296
+
297
+ echo " - $agent/"
298
+ done
299
+
300
+ # Copy core documentation
301
+ echo -e "${YELLOW}Copying core documentation...${NC}"
302
+ cp "$COREAI_DIR/AGENT_SPEC.md" "$TARGET_DIR/KnowledgeLibrary/" 2>/dev/null || true
303
+ cp "$COREAI_DIR/WORKFLOWS.md" "$TARGET_DIR/KnowledgeLibrary/" 2>/dev/null || true
304
+
305
+ # Create coreai.json config file
306
+ echo -e "${YELLOW}Creating coreai.json config...${NC}"
307
+ cat > "$TARGET_DIR/coreai.json" << EOF
308
+ {
309
+ "project": {
310
+ "name": "$PROJECT_NAME",
311
+ "jiraProject": "$JIRA_PROJECT",
312
+ "githubRepo": "$GITHUB_REPO",
313
+ "confluenceSpace": "$CONFLUENCE_SPACE",
314
+ "confluenceUrl": "$CONFLUENCE_URL",
315
+ "jiraUrl": "$JIRA_URL"
316
+ },
317
+ "agents": {
318
+ "installed": $(printf '%s\n' "${ALL_AGENTS[@]}" | jq -R . | jq -s .),
319
+ "custom": []
320
+ },
321
+ "commands": {
322
+ "core": ["delegate", "check-inbox", "review", "sprint-status", "git-commit", "pr-create"],
323
+ "optional": $(printf '%s\n' "${OPTIONAL_COMMANDS[@]}" | jq -R . | jq -s .)
324
+ },
325
+ "qualityChecks": {
326
+ "lint": "$LINT_CMD",
327
+ "staticAnalysis": "$STATIC_ANALYSIS_CMD",
328
+ "test": "$TEST_CMD",
329
+ "build": "$BUILD_CMD"
330
+ }
331
+ }
332
+ EOF
333
+
334
+ echo ""
335
+ echo -e "${GREEN}=============================="
336
+ echo "Installation complete!"
337
+ echo "==============================${NC}"
338
+ echo ""
339
+ echo "Created:"
340
+ echo " .claude/agents/ - Agent definitions"
341
+ echo " .claude/commands/ - Slash commands"
342
+ echo " KnowledgeLibrary/ - Agent context and communication"
343
+ echo " coreai.json - Project configuration"
344
+ echo ""
345
+ echo "Next steps:"
346
+ echo " 1. Review and customize agent files in .claude/agents/"
347
+ echo " 2. Update KnowledgeLibrary/context.txt with initial project state"
348
+ echo " 3. Add team members to engineering-manager.md"
349
+ echo " 4. Configure MCP servers in .claude/mcp.json (optional)"
350
+ echo " 5. Run './coreai/scripts/add-agent.sh <name>' to add more agents"
351
+ echo ""
352
+ echo -e "${BLUE}To add a new agent:${NC}"
353
+ echo " $COREAI_DIR/scripts/add-agent.sh <agent-name> --type ic"
354
+ echo ""