amazingteam 3.0.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 (164) hide show
  1. package/.ai-team/agents/architect.md +144 -0
  2. package/.ai-team/agents/ci-analyst.md +188 -0
  3. package/.ai-team/agents/developer.md +176 -0
  4. package/.ai-team/agents/planner.md +355 -0
  5. package/.ai-team/agents/qa.md +189 -0
  6. package/.ai-team/agents/reviewer.md +211 -0
  7. package/.ai-team/agents/triage.md +146 -0
  8. package/.ai-team/commands/ci-analyze.md +116 -0
  9. package/.ai-team/commands/design.md +100 -0
  10. package/.ai-team/commands/implement.md +108 -0
  11. package/.ai-team/commands/release-check.md +142 -0
  12. package/.ai-team/commands/review.md +142 -0
  13. package/.ai-team/commands/test.md +115 -0
  14. package/.ai-team/commands/triage.md +138 -0
  15. package/.ai-team/memory/architect/architecture_notes.md +67 -0
  16. package/.ai-team/memory/architect/design_rationale.md +113 -0
  17. package/.ai-team/memory/architect/module_map.md +84 -0
  18. package/.ai-team/memory/ci-analyst/failure_patterns.md +102 -0
  19. package/.ai-team/memory/ci-analyst/runbook_references.md +87 -0
  20. package/.ai-team/memory/developer/bug_investigation.md +102 -0
  21. package/.ai-team/memory/developer/build_issues.md +115 -0
  22. package/.ai-team/memory/developer/implementation_notes.md +83 -0
  23. package/.ai-team/memory/failures/failure_library.md +103 -0
  24. package/.ai-team/memory/planner/decomposition_notes.md +82 -0
  25. package/.ai-team/memory/planner/flow_rules.md +86 -0
  26. package/.ai-team/memory/planner/github_issue_patterns.md +229 -0
  27. package/.ai-team/memory/qa/regression_cases.md +101 -0
  28. package/.ai-team/memory/qa/test_strategy.md +138 -0
  29. package/.ai-team/memory/qa/validation_notes.md +110 -0
  30. package/.ai-team/memory/reviewer/quality_rules.md +105 -0
  31. package/.ai-team/memory/reviewer/recurring_risks.md +109 -0
  32. package/.ai-team/memory/reviewer/review_notes.md +124 -0
  33. package/.ai-team/memory/triage/classification_heuristics.md +82 -0
  34. package/.ai-team/memory/triage/debug_notes.md +87 -0
  35. package/.ai-team/opencode.template.jsonc +216 -0
  36. package/.ai-team/skills/bugfix-playbook/skill.md +174 -0
  37. package/.ai-team/skills/ci-failure-analysis/skill.md +176 -0
  38. package/.ai-team/skills/issue-triage/skill.md +163 -0
  39. package/.ai-team/skills/regression-checklist/skill.md +176 -0
  40. package/.ai-team/skills/release-readiness-check/skill.md +216 -0
  41. package/.ai-team/skills/repo-architecture-reader/skill.md +139 -0
  42. package/.ai-team/skills/safe-refactor-checklist/skill.md +215 -0
  43. package/.ai-team/skills/task-breakdown-and-dispatch/skill.md +151 -0
  44. package/.ai-team/skills/test-first-feature-dev/skill.md +205 -0
  45. package/.ai-team/workflows/ci.yml +81 -0
  46. package/.ai-team/workflows/nightly-ai-maintenance.yml +129 -0
  47. package/.ai-team/workflows/opencode.yml +33 -0
  48. package/.ai-team/workflows/pr-check.yml +41 -0
  49. package/.foundation/foundation.lock +38 -0
  50. package/.foundation/local-overrides.md +97 -0
  51. package/.foundation/upgrade-history.md +38 -0
  52. package/.opencode/agents/architect.md +38 -0
  53. package/.opencode/agents/ci-analyst.md +38 -0
  54. package/.opencode/agents/developer.md +43 -0
  55. package/.opencode/agents/planner.md +47 -0
  56. package/.opencode/agents/qa.md +34 -0
  57. package/.opencode/agents/reviewer.md +38 -0
  58. package/.opencode/agents/triage.md +37 -0
  59. package/.opencode/commands/auto.md +264 -0
  60. package/.opencode/commands/breakdown-issue.md +94 -0
  61. package/.opencode/commands/ci-analyze.md +15 -0
  62. package/.opencode/commands/close-parent-task.md +122 -0
  63. package/.opencode/commands/design.md +15 -0
  64. package/.opencode/commands/dispatch-next.md +102 -0
  65. package/.opencode/commands/implement.md +16 -0
  66. package/.opencode/commands/release-check.md +16 -0
  67. package/.opencode/commands/resume.md +88 -0
  68. package/.opencode/commands/review.md +15 -0
  69. package/.opencode/commands/show-blockers.md +97 -0
  70. package/.opencode/commands/summarize-parent.md +121 -0
  71. package/.opencode/commands/test.md +15 -0
  72. package/.opencode/commands/triage.md +109 -0
  73. package/.opencode/skills/bugfix-playbook/SKILL.md +81 -0
  74. package/.opencode/skills/ci-failure-analysis/SKILL.md +94 -0
  75. package/.opencode/skills/issue-triage/SKILL.md +80 -0
  76. package/.opencode/skills/regression-checklist/SKILL.md +81 -0
  77. package/.opencode/skills/release-readiness-check/SKILL.md +81 -0
  78. package/.opencode/skills/repo-architecture-reader/SKILL.md +65 -0
  79. package/.opencode/skills/safe-refactor-checklist/SKILL.md +76 -0
  80. package/.opencode/skills/task-breakdown-and-dispatch/SKILL.md +255 -0
  81. package/.opencode/skills/test-first-feature-dev/SKILL.md +78 -0
  82. package/AGENTS.md +879 -0
  83. package/CHANGELOG.md +261 -0
  84. package/LICENSE +21 -0
  85. package/README.md +1215 -0
  86. package/VERSION +1 -0
  87. package/action/__tests__/downloader.test.js +251 -0
  88. package/action/__tests__/merger.test.js +156 -0
  89. package/action/__tests__/path-resolver.test.js +199 -0
  90. package/action/__tests__/validator.test.js +310 -0
  91. package/action/action.yml +61 -0
  92. package/action/index.js +223 -0
  93. package/action/lib/downloader.js +344 -0
  94. package/action/lib/merger.js +170 -0
  95. package/action/lib/path-resolver.js +176 -0
  96. package/action/lib/setup.js +286 -0
  97. package/action/lib/validator.js +324 -0
  98. package/cli/__tests__/cli.test.js +270 -0
  99. package/cli/amazingteam.cjs +225 -0
  100. package/cli/commands/check-update.cjs +159 -0
  101. package/cli/commands/init.cjs +412 -0
  102. package/cli/commands/local.cjs +264 -0
  103. package/cli/commands/migrate.cjs +316 -0
  104. package/cli/commands/status.cjs +241 -0
  105. package/cli/commands/upgrade.cjs +213 -0
  106. package/cli/commands/validate.cjs +259 -0
  107. package/cli/commands/version.cjs +59 -0
  108. package/cli/sync.cjs +237 -0
  109. package/dist/index.js +35 -0
  110. package/docs/architecture/overview.md +138 -0
  111. package/docs/blocker_resolution_design.md +372 -0
  112. package/docs/bootstrap-model.md +356 -0
  113. package/docs/config-reference.md +458 -0
  114. package/docs/how-to-use.md +178 -0
  115. package/docs/migration-to-v3.md +355 -0
  116. package/docs/overlay-guide.md +156 -0
  117. package/docs/patterns/README.md +67 -0
  118. package/docs/quick-start-v3.md +330 -0
  119. package/docs/releases/README.md +64 -0
  120. package/docs/runbooks/ci/README.md +62 -0
  121. package/docs/runbooks/ci/build-debug.md +120 -0
  122. package/docs/runbooks/ci/flaky-tests.md +127 -0
  123. package/docs/runbooks/getting-started.md +81 -0
  124. package/docs/upgrade-policy.md +188 -0
  125. package/docs/versioning.md +199 -0
  126. package/overlays/README.md +30 -0
  127. package/overlays/ai-agent-product/.ai-team/skills/llm-integration/skill.md +99 -0
  128. package/overlays/ai-agent-product/docs/ai-agent-architecture.md +68 -0
  129. package/overlays/ai-agent-product/overlay.yaml +26 -0
  130. package/overlays/cpp-qt-desktop/.ai-team/skills/qt-signals-slots/skill.md +60 -0
  131. package/overlays/cpp-qt-desktop/docs/qt-conventions.md +64 -0
  132. package/overlays/cpp-qt-desktop/overlay.yaml +22 -0
  133. package/overlays/python-backend/.ai-team/skills/python-testing/skill.md +90 -0
  134. package/overlays/python-backend/docs/python-style.md +78 -0
  135. package/overlays/python-backend/overlay.yaml +22 -0
  136. package/overlays/web-fullstack/.ai-team/skills/frontend-testing/skill.md +70 -0
  137. package/overlays/web-fullstack/docs/frontend-conventions.md +68 -0
  138. package/overlays/web-fullstack/overlay.yaml +26 -0
  139. package/package.json +84 -0
  140. package/presets/default.yaml +161 -0
  141. package/presets/go.yaml +43 -0
  142. package/presets/python.yaml +43 -0
  143. package/presets/typescript.yaml +40 -0
  144. package/schemas/config.schema.json +239 -0
  145. package/scripts/diff_foundation_vs_project.sh +134 -0
  146. package/scripts/generate_docs.sh +200 -0
  147. package/scripts/init_project.sh +455 -0
  148. package/scripts/plan_upgrade.sh +268 -0
  149. package/scripts/upgrade_foundation.sh +365 -0
  150. package/scripts/validate-foundation.cjs +278 -0
  151. package/scripts/validate_foundation.sh +192 -0
  152. package/scripts/validate_project_setup.sh +171 -0
  153. package/tasks/README.md +94 -0
  154. package/tasks/_template/analysis.md +76 -0
  155. package/tasks/_template/design.md +121 -0
  156. package/tasks/_template/implementation.md +121 -0
  157. package/tasks/_template/release.md +119 -0
  158. package/tasks/_template/review.md +131 -0
  159. package/tasks/_template/subtasks/task.yaml +24 -0
  160. package/tasks/_template/task.yaml +75 -0
  161. package/tasks/_template/validation.md +128 -0
  162. package/templates/amazingteam.yml +81 -0
  163. package/templates/gitignore +14 -0
  164. package/templates/opencode.jsonc +216 -0
@@ -0,0 +1,200 @@
1
+ #!/bin/bash
2
+ # generate_docs.sh
3
+ # Generate documentation for the foundation
4
+
5
+ set -e
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ FOUNDATION_ROOT="$(dirname "$SCRIPT_DIR")"
9
+
10
+ # Colors
11
+ CYAN='\033[0;36m'
12
+ GREEN='\033[0;32m'
13
+ NC='\033[0m'
14
+
15
+ VERSION=$(cat "$FOUNDATION_ROOT/VERSION" 2>/dev/null || echo "unknown")
16
+ OUTPUT_DIR="$FOUNDATION_ROOT/docs/generated"
17
+
18
+ echo -e "${CYAN}══════════════════════════════════════════════════${NC}"
19
+ echo -e "${CYAN} AI Team Foundation Documentation Generator${NC}"
20
+ echo -e "${CYAN}══════════════════════════════════════════════════${NC}"
21
+ echo ""
22
+
23
+ mkdir -p "$OUTPUT_DIR"
24
+
25
+ # Generate role inventory
26
+ echo -e "${CYAN}Generating role inventory...${NC}"
27
+ cat > "$OUTPUT_DIR/role-inventory.md" << EOF
28
+ # Role Inventory
29
+
30
+ Generated: $(date -I)
31
+ Foundation Version: $VERSION
32
+
33
+ ## Core Roles
34
+
35
+ | Role | File | Description |
36
+ |------|------|-------------|
37
+ | Planner | .ai-team/agents/planner.md | Task decomposition and workflow orchestration |
38
+ | Architect | .ai-team/agents/architect.md | Design technical approach and impact boundaries |
39
+ | Developer | .ai-team/agents/developer.md | Implement approved changes |
40
+ | QA | .ai-team/agents/qa.md | Validate functionality and regression safety |
41
+ | Reviewer | .ai-team/agents/reviewer.md | Assess correctness and maintainability |
42
+ | Triage | .ai-team/agents/triage.md | Classify work and perform first-pass debug |
43
+ | CI Analyst | .ai-team/agents/ci-analyst.md | Investigate CI failure patterns |
44
+
45
+ ## Memory Areas
46
+
47
+ | Role | Memory Directory | Purpose |
48
+ |------|------------------|---------|
49
+ | Planner | .ai-team/memory/planner/ | Task decomposition patterns |
50
+ | Architect | .ai-team/memory/architect/ | Architecture decisions |
51
+ | Developer | .ai-team/memory/developer/ | Implementation patterns |
52
+ | QA | .ai-team/memory/qa/ | Test strategy and cases |
53
+ | Reviewer | .ai-team/memory/reviewer/ | Quality rules and risks |
54
+ | Triage | .ai-team/memory/triage/ | Classification heuristics |
55
+ | CI Analyst | .ai-team/memory/ci-analyst/ | Failure patterns |
56
+ | Failures | .ai-team/memory/failures/ | Shared failure library |
57
+ EOF
58
+ echo -e "${GREEN} Created: role-inventory.md${NC}"
59
+
60
+ # Generate skill inventory
61
+ echo -e "${CYAN}Generating skill inventory...${NC}"
62
+ cat > "$OUTPUT_DIR/skill-inventory.md" << EOF
63
+ # Skill Inventory
64
+
65
+ Generated: $(date -I)
66
+ Foundation Version: $VERSION
67
+
68
+ ## Understanding Skills
69
+
70
+ | Skill | Directory | Purpose |
71
+ |-------|-----------|---------|
72
+ | repo-architecture-reader | .ai-team/skills/repo-architecture-reader/ | Quickly understand repository structure |
73
+
74
+ ## Execution Skills
75
+
76
+ | Skill | Directory | Purpose |
77
+ |-------|-----------|---------|
78
+ | task-breakdown-and-dispatch | .ai-team/skills/task-breakdown-and-dispatch/ | Decompose tasks into subtasks |
79
+ | bugfix-playbook | .ai-team/skills/bugfix-playbook/ | Systematic bug fixing |
80
+ | test-first-feature-dev | .ai-team/skills/test-first-feature-dev/ | TDD approach for features |
81
+ | safe-refactor-checklist | .ai-team/skills/safe-refactor-checklist/ | Safe refactoring checklist |
82
+
83
+ ## Validation Skills
84
+
85
+ | Skill | Directory | Purpose |
86
+ |-------|-----------|---------|
87
+ | issue-triage | .ai-team/skills/issue-triage/ | Issue classification |
88
+ | ci-failure-analysis | .ai-team/skills/ci-failure-analysis/ | CI failure investigation |
89
+ | regression-checklist | .ai-team/skills/regression-checklist/ | Regression testing |
90
+ | release-readiness-check | .ai-team/skills/release-readiness-check/ | Pre-release validation |
91
+ EOF
92
+ echo -e "${GREEN} Created: skill-inventory.md${NC}"
93
+
94
+ # Generate command inventory
95
+ echo -e "${CYAN}Generating command inventory...${NC}"
96
+ cat > "$OUTPUT_DIR/command-inventory.md" << EOF
97
+ # Command Inventory
98
+
99
+ Generated: $(date -I)
100
+ Foundation Version: $VERSION
101
+
102
+ ## Available Commands
103
+
104
+ | Command | Agent | Purpose |
105
+ |---------|-------|---------|
106
+ | /triage | Triage | Classify and investigate issue |
107
+ | /design | Architect | Analyze requirements and design |
108
+ | /implement | Developer | Implement changes |
109
+ | /test | QA | Run tests and validate |
110
+ | /review | Reviewer | Review code |
111
+ | /ci-analyze | CI Analyst | Analyze CI failures |
112
+ | /release-check | Reviewer | Validate release readiness |
113
+
114
+ ## Usage
115
+
116
+ In a GitHub Issue or PR comment:
117
+
118
+ \`\`\`
119
+ /opencode use <agent> to <action>
120
+ \`\`\`
121
+
122
+ Examples:
123
+ \`\`\`
124
+ /opencode use architect to design this feature
125
+ /opencode use developer to implement the solution
126
+ /opencode use qa to validate the changes
127
+ \`\`\`
128
+ EOF
129
+ echo -e "${GREEN} Created: command-inventory.md${NC}"
130
+
131
+ # Generate structure overview
132
+ echo -e "${CYAN}Generating structure overview...${NC}"
133
+ cat > "$OUTPUT_DIR/structure-overview.md" << EOF
134
+ # Foundation Structure Overview
135
+
136
+ Generated: $(date -I)
137
+ Foundation Version: $VERSION
138
+
139
+ ## Directory Structure
140
+
141
+ \`\`\`
142
+ ai-team-foundation/
143
+ ├── .ai-team/ # AI Team core configuration
144
+ │ ├── agents/ # Agent definitions (7 roles)
145
+ │ ├── skills/ # Skill definitions (9 skills)
146
+ │ ├── commands/ # Command definitions (7 commands)
147
+ │ ├── memory/ # Memory templates (8 areas)
148
+ │ └── opencode.template.jsonc
149
+
150
+ ├── .github/ # GitHub configuration
151
+ │ ├── workflows/ # GitHub Actions workflows
152
+ │ └── ISSUE_TEMPLATE/ # Issue templates
153
+
154
+ ├── docs/ # Documentation
155
+ │ ├── architecture/ # Architecture documents
156
+ │ ├── decisions/ # Decision records (ADRs)
157
+ │ ├── patterns/ # Implementation patterns
158
+ │ ├── releases/ # Release documentation
159
+ │ └── runbooks/ci/ # CI operational runbooks
160
+
161
+ ├── scripts/ # Bootstrap scripts
162
+ │ ├── init_project.sh
163
+ │ ├── validate_foundation.sh
164
+ │ ├── validate_project_setup.sh
165
+ │ ├── plan_upgrade.sh
166
+ │ ├── upgrade_foundation.sh
167
+ │ ├── diff_foundation_vs_project.sh
168
+ │ └── generate_docs.sh
169
+
170
+ ├── overlays/ # Technology overlays
171
+
172
+ ├── tasks/ # Task templates
173
+ │ └── _template/
174
+
175
+ ├── VERSION # Current version
176
+ ├── CHANGELOG.md # Version history
177
+ ├── AGENTS.md # Global rules
178
+ └── README.md # Project overview
179
+ \`\`\`
180
+
181
+ ## File Classification
182
+
183
+ | Class | Description | Upgrade Behavior |
184
+ |-------|-------------|------------------|
185
+ | A | Auto-generatable | Safe to create/replace automatically |
186
+ | B | Review required | Generate diff, human reviews before applying |
187
+ | C | Protected | Human approval mandatory, never auto-modified |
188
+
189
+ ## Key Files
190
+
191
+ - **VERSION**: Current foundation version
192
+ - **CHANGELOG.md**: Version history and migration notes
193
+ - **AGENTS.md**: Global rules for all AI agents
194
+ - **opencode.template.jsonc**: Template for project configuration
195
+ EOF
196
+ echo -e "${GREEN} Created: structure-overview.md${NC}"
197
+
198
+ echo ""
199
+ echo -e "${GREEN}Documentation generated in: $OUTPUT_DIR/${NC}"
200
+ echo ""
@@ -0,0 +1,455 @@
1
+ #!/bin/bash
2
+ # init_project.sh
3
+ # Initialize a new downstream project from the foundation base
4
+
5
+ set -e
6
+
7
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
8
+ FOUNDATION_ROOT="$(dirname "$SCRIPT_DIR")"
9
+
10
+ # Default values
11
+ PROJECT_NAME=""
12
+ PROJECT_PATH=""
13
+ OVERLAY=""
14
+ LANGUAGE="typescript"
15
+ FRAMEWORK="node"
16
+ DESCRIPTION=""
17
+ FORCE=false
18
+
19
+ # Colors
20
+ RED='\033[0;31m'
21
+ GREEN='\033[0;32m'
22
+ YELLOW='\033[1;33m'
23
+ BLUE='\033[0;34m'
24
+ CYAN='\033[0;36m'
25
+ NC='\033[0m' # No Color
26
+
27
+ usage() {
28
+ echo "Usage: $0 [OPTIONS] <project-name>"
29
+ echo ""
30
+ echo "Initialize a new downstream project from AI Team Foundation."
31
+ echo ""
32
+ echo "Options:"
33
+ echo " -p, --path <path> Target directory path (default: ./<project-name>)"
34
+ echo " -o, --overlay <name> Apply overlay (cpp-qt-desktop, python-backend, web-fullstack)"
35
+ echo " -l, --language <lang> Programming language (default: typescript)"
36
+ echo " -f, --framework <name> Framework name (default: node)"
37
+ echo " -d, --description <d> Project description"
38
+ echo " --force Overwrite existing directory"
39
+ echo " -h, --help Show this help message"
40
+ echo ""
41
+ echo "Examples:"
42
+ echo " $0 my-awesome-project"
43
+ echo " $0 -o python-backend -l python my-api"
44
+ echo " $0 -o cpp-qt-desktop -l cpp my-desktop-app"
45
+ }
46
+
47
+ parse_args() {
48
+ while [[ $# -gt 0 ]]; do
49
+ case $1 in
50
+ -p|--path)
51
+ PROJECT_PATH="$2"
52
+ shift 2
53
+ ;;
54
+ -o|--overlay)
55
+ OVERLAY="$2"
56
+ shift 2
57
+ ;;
58
+ -l|--language)
59
+ LANGUAGE="$2"
60
+ shift 2
61
+ ;;
62
+ -f|--framework)
63
+ FRAMEWORK="$2"
64
+ shift 2
65
+ ;;
66
+ -d|--description)
67
+ DESCRIPTION="$2"
68
+ shift 2
69
+ ;;
70
+ --force)
71
+ FORCE=true
72
+ shift
73
+ ;;
74
+ -h|--help)
75
+ usage
76
+ exit 0
77
+ ;;
78
+ *)
79
+ if [[ -z "$PROJECT_NAME" ]]; then
80
+ PROJECT_NAME="$1"
81
+ fi
82
+ shift
83
+ ;;
84
+ esac
85
+ done
86
+ }
87
+
88
+ log_info() {
89
+ echo -e "${CYAN}[INFO]${NC} $1"
90
+ }
91
+
92
+ log_success() {
93
+ echo -e "${GREEN}[SUCCESS]${NC} $1"
94
+ }
95
+
96
+ log_warning() {
97
+ echo -e "${YELLOW}[WARNING]${NC} $1"
98
+ }
99
+
100
+ log_error() {
101
+ echo -e "${RED}[ERROR]${NC} $1"
102
+ }
103
+
104
+ check_prerequisites() {
105
+ if [[ -z "$PROJECT_NAME" ]]; then
106
+ log_error "Project name is required"
107
+ usage
108
+ exit 1
109
+ fi
110
+
111
+ if [[ -z "$PROJECT_PATH" ]]; then
112
+ PROJECT_PATH="./$PROJECT_NAME"
113
+ fi
114
+
115
+ if [[ -d "$PROJECT_PATH" ]] && [[ "$FORCE" != true ]]; then
116
+ log_error "Directory $PROJECT_PATH already exists. Use --force to overwrite."
117
+ exit 1
118
+ fi
119
+
120
+ if [[ -n "$OVERLAY" ]] && [[ ! -d "$FOUNDATION_ROOT/overlays/$OVERLAY" ]]; then
121
+ log_error "Overlay '$OVERLAY' not found"
122
+ log_info "Available overlays:"
123
+ ls -1 "$FOUNDATION_ROOT/overlays" 2>/dev/null || echo " (none)"
124
+ exit 1
125
+ fi
126
+ }
127
+
128
+ read_version() {
129
+ VERSION=$(cat "$FOUNDATION_ROOT/VERSION" 2>/dev/null || echo "unknown")
130
+ }
131
+
132
+ create_directory_structure() {
133
+ log_info "Creating directory structure..."
134
+
135
+ # Core directories
136
+ mkdir -p "$PROJECT_PATH/.ai-team/agents"
137
+ mkdir -p "$PROJECT_PATH/.ai-team/skills"
138
+ mkdir -p "$PROJECT_PATH/.ai-team/commands"
139
+ mkdir -p "$PROJECT_PATH/.ai-team/memory"
140
+
141
+ # Memory directories for all roles
142
+ mkdir -p "$PROJECT_PATH/.ai-team/memory/planner"
143
+ mkdir -p "$PROJECT_PATH/.ai-team/memory/architect"
144
+ mkdir -p "$PROJECT_PATH/.ai-team/memory/developer"
145
+ mkdir -p "$PROJECT_PATH/.ai-team/memory/qa"
146
+ mkdir -p "$PROJECT_PATH/.ai-team/memory/reviewer"
147
+ mkdir -p "$PROJECT_PATH/.ai-team/memory/triage"
148
+ mkdir -p "$PROJECT_PATH/.ai-team/memory/ci-analyst"
149
+ mkdir -p "$PROJECT_PATH/.ai-team/memory/failures"
150
+
151
+ # GitHub directories
152
+ mkdir -p "$PROJECT_PATH/.github/workflows"
153
+ mkdir -p "$PROJECT_PATH/.github/ISSUE_TEMPLATE"
154
+
155
+ # Documentation directories
156
+ mkdir -p "$PROJECT_PATH/docs/architecture"
157
+ mkdir -p "$PROJECT_PATH/docs/decisions"
158
+ mkdir -p "$PROJECT_PATH/docs/patterns"
159
+ mkdir -p "$PROJECT_PATH/docs/releases"
160
+ mkdir -p "$PROJECT_PATH/docs/runbooks/ci"
161
+
162
+ # Task directories
163
+ mkdir -p "$PROJECT_PATH/tasks/_template"
164
+
165
+ # Foundation metadata
166
+ mkdir -p "$PROJECT_PATH/.foundation"
167
+
168
+ # Source directories
169
+ mkdir -p "$PROJECT_PATH/src"
170
+ mkdir -p "$PROJECT_PATH/tests"
171
+ }
172
+
173
+ copy_base_templates() {
174
+ log_info "Copying base templates..."
175
+
176
+ # Copy .ai-team structure
177
+ if [[ -d "$FOUNDATION_ROOT/.ai-team" ]]; then
178
+ cp -r "$FOUNDATION_ROOT/.ai-team/agents"/* "$PROJECT_PATH/.ai-team/agents/" 2>/dev/null || true
179
+ cp -r "$FOUNDATION_ROOT/.ai-team/skills"/* "$PROJECT_PATH/.ai-team/skills/" 2>/dev/null || true
180
+ cp -r "$FOUNDATION_ROOT/.ai-team/commands"/* "$PROJECT_PATH/.ai-team/commands/" 2>/dev/null || true
181
+ cp -r "$FOUNDATION_ROOT/.ai-team/memory"/* "$PROJECT_PATH/.ai-team/memory/" 2>/dev/null || true
182
+ cp "$FOUNDATION_ROOT/.ai-team/opencode.template.jsonc" "$PROJECT_PATH/.ai-team/" 2>/dev/null || true
183
+ fi
184
+
185
+ # Copy GitHub workflows
186
+ if [[ -d "$FOUNDATION_ROOT/.github/workflows" ]]; then
187
+ cp -r "$FOUNDATION_ROOT/.github/workflows"/* "$PROJECT_PATH/.github/workflows/" 2>/dev/null || true
188
+ fi
189
+
190
+ # Copy Issue templates
191
+ if [[ -d "$FOUNDATION_ROOT/.github/ISSUE_TEMPLATE" ]]; then
192
+ cp -r "$FOUNDATION_ROOT/.github/ISSUE_TEMPLATE"/* "$PROJECT_PATH/.github/ISSUE_TEMPLATE/" 2>/dev/null || true
193
+ fi
194
+
195
+ # Copy PR template
196
+ cp "$FOUNDATION_ROOT/.github/pull_request_template.md" "$PROJECT_PATH/.github/" 2>/dev/null || true
197
+
198
+ # Copy task templates
199
+ if [[ -d "$FOUNDATION_ROOT/tasks/_template" ]]; then
200
+ cp -r "$FOUNDATION_ROOT/tasks/_template"/* "$PROJECT_PATH/tasks/_template/" 2>/dev/null || true
201
+ fi
202
+
203
+ # Copy AGENTS.md
204
+ cp "$FOUNDATION_ROOT/AGENTS.md" "$PROJECT_PATH/" 2>/dev/null || true
205
+ }
206
+
207
+ apply_overlay() {
208
+ if [[ -z "$OVERLAY" ]]; then
209
+ return
210
+ fi
211
+
212
+ log_info "Applying overlay: $OVERLAY"
213
+
214
+ OVERLAY_PATH="$FOUNDATION_ROOT/overlays/$OVERLAY"
215
+
216
+ if [[ ! -d "$OVERLAY_PATH" ]]; then
217
+ log_warning "Overlay directory not found, skipping..."
218
+ return
219
+ fi
220
+
221
+ # Copy overlay files (these may override base files)
222
+ if [[ -d "$OVERLAY_PATH/.ai-team" ]]; then
223
+ cp -r "$OVERLAY_PATH/.ai-team"/* "$PROJECT_PATH/.ai-team/" 2>/dev/null || true
224
+ fi
225
+
226
+ if [[ -d "$OVERLAY_PATH/.github" ]]; then
227
+ cp -r "$OVERLAY_PATH/.github"/* "$PROJECT_PATH/.github/" 2>/dev/null || true
228
+ fi
229
+
230
+ if [[ -d "$OVERLAY_PATH/docs" ]]; then
231
+ cp -r "$OVERLAY_PATH/docs"/* "$PROJECT_PATH/docs/" 2>/dev/null || true
232
+ fi
233
+ }
234
+
235
+ create_foundation_lock() {
236
+ log_info "Creating foundation lock file..."
237
+
238
+ cat > "$PROJECT_PATH/.foundation/foundation.lock" << EOF
239
+ foundation_repo: ai-team-foundation
240
+ foundation_version: $VERSION
241
+ overlay: ${OVERLAY:-none}
242
+ initialized_at: $(date -I)
243
+ last_upgrade_at: $(date -I)
244
+ upgrade_policy: controlled
245
+ language: $LANGUAGE
246
+ framework: $FRAMEWORK
247
+ EOF
248
+ }
249
+
250
+ create_upgrade_history() {
251
+ cat > "$PROJECT_PATH/.foundation/upgrade-history.md" << EOF
252
+ # Upgrade History
253
+
254
+ This file records all foundation upgrades applied to this project.
255
+
256
+ ## Initial Setup
257
+
258
+ - **Date**: $(date -I)
259
+ - **Foundation Version**: $VERSION
260
+ - **Overlay**: ${OVERLAY:-none}
261
+ - **Action**: Initial project creation
262
+
263
+ EOF
264
+ }
265
+
266
+ create_local_overrides() {
267
+ cat > "$PROJECT_PATH/.foundation/local-overrides.md" << EOF
268
+ # Local Overrides
269
+
270
+ This file documents project-specific customizations that should be preserved during upgrades.
271
+
272
+ ## Customizations
273
+
274
+ <!-- Document any local changes to templates, workflows, or configuration -->
275
+
276
+ - [ ] Custom AGENTS.md additions
277
+ - [ ] Custom workflows
278
+ - [ ] Custom skills or commands
279
+ - [ ] Project-specific memory rules
280
+
281
+ EOF
282
+ }
283
+
284
+ create_project_config() {
285
+ log_info "Creating project configuration..."
286
+
287
+ cat > "$PROJECT_PATH/ai-team.config.yaml" << EOF
288
+ # AI Team Project Configuration
289
+ # This file is project-specific and will not be overwritten during upgrades
290
+
291
+ project:
292
+ name: "$PROJECT_NAME"
293
+ description: "${DESCRIPTION:-My awesome project}"
294
+ language: "$LANGUAGE"
295
+ framework: "$FRAMEWORK"
296
+
297
+ ai_team:
298
+ version: "$VERSION"
299
+
300
+ agents:
301
+ planner: true
302
+ architect: true
303
+ developer: true
304
+ qa: true
305
+ reviewer: true
306
+ triage: true
307
+ ci_analyst: true
308
+
309
+ memory:
310
+ enabled: true
311
+ isolation: true
312
+ failures_library: true
313
+
314
+ task_system:
315
+ enabled: true
316
+ state_machine: true
317
+
318
+ rules:
319
+ coding:
320
+ max_function_lines: 30
321
+ test_coverage_threshold: 80
322
+
323
+ git:
324
+ commit_convention: "conventional"
325
+
326
+ governance:
327
+ protected_paths:
328
+ - "docs/architecture/"
329
+ - "docs/decisions/"
330
+
331
+ # Add project-specific configuration below
332
+ EOF
333
+ }
334
+
335
+ generate_opencode_config() {
336
+ log_info "Generating opencode.jsonc..."
337
+
338
+ if [[ -f "$FOUNDATION_ROOT/.ai-team/opencode.template.jsonc" ]]; then
339
+ # Replace template variables
340
+ sed -e "s/{{AI_TEAM_VERSION}}/$VERSION/g" \
341
+ -e "s/{{PROJECT_NAME}}/$PROJECT_NAME/g" \
342
+ -e "s/{{PROJECT_DESCRIPTION}}/${DESCRIPTION:-My awesome project}/g" \
343
+ -e "s/{{LANGUAGE}}/$LANGUAGE/g" \
344
+ -e "s/{{FRAMEWORK}}/$FRAMEWORK/g" \
345
+ "$FOUNDATION_ROOT/.ai-team/opencode.template.jsonc" \
346
+ > "$PROJECT_PATH/opencode.jsonc"
347
+ fi
348
+ }
349
+
350
+ create_readme() {
351
+ log_info "Creating README.md..."
352
+
353
+ cat > "$PROJECT_PATH/README.md" << EOF
354
+ # $PROJECT_NAME
355
+
356
+ ${DESCRIPTION:-}
357
+
358
+ ## AI Team
359
+
360
+ This project uses [AI Team Foundation](https://github.com/your-org/ai-team-foundation) v$VERSION.
361
+
362
+ ### Quick Start
363
+
364
+ 1. Configure GitHub Secrets:
365
+ - \`ALIBABA_CODING_PLAN_API_KEY\` or \`OPENCODE_API_KEY\`
366
+
367
+ 2. Create an Issue using a template
368
+
369
+ 3. Trigger AI:
370
+ \`\`\`
371
+ /opencode use architect to analyze this issue
372
+ \`\`\`
373
+
374
+ ### Available Commands
375
+
376
+ | Command | Agent | Purpose |
377
+ |---------|-------|---------|
378
+ | \`/triage\` | Triage | Issue classification |
379
+ | \`/design\` | Architect | Design solution |
380
+ | \`/implement\` | Developer | Implement changes |
381
+ | \`/test\` | QA | Validate implementation |
382
+ | \`/review\` | Reviewer | Code review |
383
+ | \`/ci-analyze\` | CI Analyst | CI failure analysis |
384
+ | \`/release-check\` | Reviewer | Release readiness |
385
+
386
+ ## Development
387
+
388
+ \`\`\`bash
389
+ # Install dependencies
390
+ npm install
391
+
392
+ # Run tests
393
+ npm test
394
+
395
+ # Run linting
396
+ npm run lint
397
+
398
+ # Validate AI Team setup
399
+ node scripts/validate_project_setup.cjs
400
+ \`\`\`
401
+
402
+ ## License
403
+
404
+ MIT
405
+ EOF
406
+ }
407
+
408
+ print_next_steps() {
409
+ echo ""
410
+ log_success "Project initialized successfully!"
411
+ echo ""
412
+ echo -e "${CYAN}Project created at:${NC} $PROJECT_PATH"
413
+ echo ""
414
+ echo -e "${CYAN}Next steps:${NC}"
415
+ echo " 1. cd $PROJECT_PATH"
416
+ echo " 2. Review and customize ai-team.config.yaml"
417
+ echo " 3. Add your GitHub secrets (ALIBABA_CODING_PLAN_API_KEY)"
418
+ echo " 4. Create your first issue!"
419
+ echo ""
420
+ echo -e "${CYAN}Foundation version:${NC} $VERSION"
421
+ if [[ -n "$OVERLAY" ]]; then
422
+ echo -e "${CYAN}Overlay:${NC} $OVERLAY"
423
+ fi
424
+ echo ""
425
+ }
426
+
427
+ # Main execution
428
+ main() {
429
+ parse_args "$@"
430
+ check_prerequisites
431
+ read_version
432
+
433
+ log_info "Initializing project: $PROJECT_NAME"
434
+ log_info "Foundation version: $VERSION"
435
+
436
+ # Remove existing if force
437
+ if [[ "$FORCE" == true ]] && [[ -d "$PROJECT_PATH" ]]; then
438
+ log_warning "Removing existing directory..."
439
+ rm -rf "$PROJECT_PATH"
440
+ fi
441
+
442
+ create_directory_structure
443
+ copy_base_templates
444
+ apply_overlay
445
+ create_foundation_lock
446
+ create_upgrade_history
447
+ create_local_overrides
448
+ create_project_config
449
+ generate_opencode_config
450
+ create_readme
451
+
452
+ print_next_steps
453
+ }
454
+
455
+ main "$@"