@fifine/aim-studio 0.0.9 → 0.0.11
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.
- package/README.md +12 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/index.d.ts +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +22 -1
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/opencode.d.ts +11 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +64 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +3 -1
- package/dist/migrations/index.js.map +1 -1
- package/dist/templates/aim/scripts/common/cli_adapter.py +267 -267
- package/dist/templates/aim/scripts/create_bootstrap.py +290 -290
- package/dist/templates/claude/commands/aim/onboard.md +360 -360
- package/dist/templates/extract.d.ts +6 -0
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +12 -0
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/opencode/agents/director.md +71 -0
- package/dist/templates/opencode/agents/prompt-engineer.md +99 -0
- package/dist/templates/opencode/agents/start.md +91 -0
- package/dist/templates/opencode/agents/story.md +92 -0
- package/dist/templates/opencode/agents/storyboard-artist.md +65 -0
- package/dist/templates/opencode/agents/writer.md +71 -0
- package/dist/templates/opencode/commands/aim/check-story.md +54 -0
- package/dist/templates/opencode/commands/aim/export.md +332 -0
- package/dist/templates/opencode/commands/aim/finish-work.md +122 -0
- package/dist/templates/opencode/commands/aim/legitimize.md +263 -0
- package/dist/templates/opencode/commands/aim/onboard.md +360 -0
- package/dist/templates/opencode/commands/aim/portrait.md +165 -0
- package/dist/templates/opencode/commands/aim/record-session.md +87 -0
- package/dist/templates/opencode/commands/aim/start.md +79 -0
- package/dist/templates/opencode/commands/aim/story.md +393 -0
- package/dist/templates/opencode/commands/aim/visualize.md +177 -0
- package/dist/templates/opencode/index.d.ts +48 -0
- package/dist/templates/opencode/index.d.ts.map +1 -0
- package/dist/templates/opencode/index.js +84 -0
- package/dist/templates/opencode/index.js.map +1 -0
- package/dist/templates/opencode/lib/aim-context.js +148 -0
- package/dist/templates/opencode/plugin/session-start.js +170 -0
- package/dist/types/ai-tools.d.ts +4 -4
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +8 -0
- package/dist/types/ai-tools.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,290 +1,290 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Create Bootstrap Task for First-Time Setup.
|
|
4
|
-
|
|
5
|
-
Creates a guided task to help users fill in project guidelines
|
|
6
|
-
after initializing AIM Studio for the first time.
|
|
7
|
-
|
|
8
|
-
Usage:
|
|
9
|
-
python3 create_bootstrap.py [project-type]
|
|
10
|
-
|
|
11
|
-
Arguments:
|
|
12
|
-
project-type: frontend | backend | fullstack (default: fullstack)
|
|
13
|
-
|
|
14
|
-
Prerequisites:
|
|
15
|
-
- .aim-studio/.developer must exist (run init_developer.py first)
|
|
16
|
-
|
|
17
|
-
Creates:
|
|
18
|
-
.aim-studio/tasks/00-bootstrap-guidelines/
|
|
19
|
-
- task.json # Task metadata
|
|
20
|
-
- prd.md # Task description and guidance
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
from __future__ import annotations
|
|
24
|
-
|
|
25
|
-
import json
|
|
26
|
-
import sys
|
|
27
|
-
from datetime import datetime
|
|
28
|
-
from pathlib import Path
|
|
29
|
-
|
|
30
|
-
from common.paths import (
|
|
31
|
-
DIR_WORKFLOW,
|
|
32
|
-
DIR_SCRIPTS,
|
|
33
|
-
DIR_TASKS,
|
|
34
|
-
get_repo_root,
|
|
35
|
-
get_developer,
|
|
36
|
-
get_tasks_dir,
|
|
37
|
-
set_current_task,
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
# =============================================================================
|
|
42
|
-
# Constants
|
|
43
|
-
# =============================================================================
|
|
44
|
-
|
|
45
|
-
TASK_NAME = "00-bootstrap-guidelines"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
# =============================================================================
|
|
49
|
-
# PRD Content
|
|
50
|
-
# =============================================================================
|
|
51
|
-
|
|
52
|
-
def write_prd_header() -> str:
|
|
53
|
-
"""Write PRD header section."""
|
|
54
|
-
return """# Bootstrap: Fill Project Development Guidelines
|
|
55
|
-
|
|
56
|
-
## Purpose
|
|
57
|
-
|
|
58
|
-
Welcome to AIM Studio! This is your first task.
|
|
59
|
-
|
|
60
|
-
AI agents use `.aim-studio/spec/` to understand YOUR project's coding conventions.
|
|
61
|
-
**Empty templates = AI writes generic code that doesn't match your project style.**
|
|
62
|
-
|
|
63
|
-
Filling these guidelines is a one-time setup that pays off for every future AI session.
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## Your Task
|
|
68
|
-
|
|
69
|
-
Fill in the guideline files based on your **existing codebase**.
|
|
70
|
-
"""
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def write_prd_backend_section() -> str:
|
|
74
|
-
"""Write PRD backend section."""
|
|
75
|
-
return """
|
|
76
|
-
|
|
77
|
-
### Backend Guidelines
|
|
78
|
-
|
|
79
|
-
| File | What to Document |
|
|
80
|
-
|------|------------------|
|
|
81
|
-
| `.aim-studio/spec/backend/directory-structure.md` | Where different file types go (routes, services, utils) |
|
|
82
|
-
| `.aim-studio/spec/backend/database-guidelines.md` | ORM, migrations, query patterns, naming conventions |
|
|
83
|
-
| `.aim-studio/spec/backend/error-handling.md` | How errors are caught, logged, and returned |
|
|
84
|
-
| `.aim-studio/spec/backend/logging-guidelines.md` | Log levels, format, what to log |
|
|
85
|
-
| `.aim-studio/spec/backend/quality-guidelines.md` | Code review standards, testing requirements |
|
|
86
|
-
"""
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
def write_prd_frontend_section() -> str:
|
|
90
|
-
"""Write PRD frontend section."""
|
|
91
|
-
return """
|
|
92
|
-
|
|
93
|
-
### Frontend Guidelines
|
|
94
|
-
|
|
95
|
-
| File | What to Document |
|
|
96
|
-
|------|------------------|
|
|
97
|
-
| `.aim-studio/spec/frontend/directory-structure.md` | Component/page/hook organization |
|
|
98
|
-
| `.aim-studio/spec/frontend/component-guidelines.md` | Component patterns, props conventions |
|
|
99
|
-
| `.aim-studio/spec/frontend/hook-guidelines.md` | Custom hook naming, patterns |
|
|
100
|
-
| `.aim-studio/spec/frontend/state-management.md` | State library, patterns, what goes where |
|
|
101
|
-
| `.aim-studio/spec/frontend/type-safety.md` | TypeScript conventions, type organization |
|
|
102
|
-
| `.aim-studio/spec/frontend/quality-guidelines.md` | Linting, testing, accessibility |
|
|
103
|
-
"""
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def write_prd_footer() -> str:
|
|
107
|
-
"""Write PRD footer section."""
|
|
108
|
-
return """
|
|
109
|
-
|
|
110
|
-
### Thinking Guides (Optional)
|
|
111
|
-
|
|
112
|
-
The `.aim-studio/spec/guides/` directory contains thinking guides that are already
|
|
113
|
-
filled with general best practices. You can customize them for your project if needed.
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## How to Fill Guidelines
|
|
118
|
-
|
|
119
|
-
### Principle: Document Reality, Not Ideals
|
|
120
|
-
|
|
121
|
-
Write what your codebase **actually does**, not what you wish it did.
|
|
122
|
-
AI needs to match existing patterns, not introduce new ones.
|
|
123
|
-
|
|
124
|
-
### Steps
|
|
125
|
-
|
|
126
|
-
1. **Look at existing code** - Find 2-3 examples of each pattern
|
|
127
|
-
2. **Document the pattern** - Describe what you see
|
|
128
|
-
3. **Include file paths** - Reference real files as examples
|
|
129
|
-
4. **List anti-patterns** - What does your team avoid?
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Tips for Using AI
|
|
134
|
-
|
|
135
|
-
Ask AI to help analyze your codebase:
|
|
136
|
-
|
|
137
|
-
- "Look at my codebase and document the patterns you see"
|
|
138
|
-
- "Analyze my code structure and summarize the conventions"
|
|
139
|
-
- "Find error handling patterns and document them"
|
|
140
|
-
|
|
141
|
-
The AI will read your code and help you document it.
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Completion Checklist
|
|
146
|
-
|
|
147
|
-
- [ ] Guidelines filled for your project type
|
|
148
|
-
- [ ] At least 2-3 real code examples in each guideline
|
|
149
|
-
- [ ] Anti-patterns documented
|
|
150
|
-
|
|
151
|
-
When done:
|
|
152
|
-
|
|
153
|
-
```bash
|
|
154
|
-
python3 ./.aim-studio/scripts/task.py finish
|
|
155
|
-
python3 ./.aim-studio/scripts/task.py archive 00-bootstrap-guidelines
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Why This Matters
|
|
161
|
-
|
|
162
|
-
After completing this task:
|
|
163
|
-
|
|
164
|
-
1. AI will write code that matches your project style
|
|
165
|
-
2. Relevant `/aim:before-*-dev` commands will inject real context
|
|
166
|
-
3. `/aim:check-*` commands will validate against your actual standards
|
|
167
|
-
4. Future developers (human or AI) will onboard faster
|
|
168
|
-
"""
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
def write_prd(task_dir: Path, project_type: str) -> None:
|
|
172
|
-
"""Write prd.md file."""
|
|
173
|
-
content = write_prd_header()
|
|
174
|
-
|
|
175
|
-
if project_type == "frontend":
|
|
176
|
-
content += write_prd_frontend_section()
|
|
177
|
-
elif project_type == "backend":
|
|
178
|
-
content += write_prd_backend_section()
|
|
179
|
-
else: # fullstack
|
|
180
|
-
content += write_prd_backend_section()
|
|
181
|
-
content += write_prd_frontend_section()
|
|
182
|
-
|
|
183
|
-
content += write_prd_footer()
|
|
184
|
-
|
|
185
|
-
prd_file = task_dir / "prd.md"
|
|
186
|
-
prd_file.write_text(content, encoding="utf-8")
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
# =============================================================================
|
|
190
|
-
# Task JSON
|
|
191
|
-
# =============================================================================
|
|
192
|
-
|
|
193
|
-
def write_task_json(task_dir: Path, developer: str, project_type: str) -> None:
|
|
194
|
-
"""Write task.json file."""
|
|
195
|
-
today = datetime.now().strftime("%Y-%m-%d")
|
|
196
|
-
|
|
197
|
-
# Generate subtasks and related files based on project type
|
|
198
|
-
if project_type == "frontend":
|
|
199
|
-
subtasks = [
|
|
200
|
-
{"name": "Fill frontend guidelines", "status": "pending"},
|
|
201
|
-
{"name": "Add code examples", "status": "pending"},
|
|
202
|
-
]
|
|
203
|
-
related_files = [".aim-studio/spec/frontend/"]
|
|
204
|
-
elif project_type == "backend":
|
|
205
|
-
subtasks = [
|
|
206
|
-
{"name": "Fill backend guidelines", "status": "pending"},
|
|
207
|
-
{"name": "Add code examples", "status": "pending"},
|
|
208
|
-
]
|
|
209
|
-
related_files = [".aim-studio/spec/backend/"]
|
|
210
|
-
else: # fullstack
|
|
211
|
-
subtasks = [
|
|
212
|
-
{"name": "Fill backend guidelines", "status": "pending"},
|
|
213
|
-
{"name": "Fill frontend guidelines", "status": "pending"},
|
|
214
|
-
{"name": "Add code examples", "status": "pending"},
|
|
215
|
-
]
|
|
216
|
-
related_files = [".aim-studio/spec/backend/", ".aim-studio/spec/frontend/"]
|
|
217
|
-
|
|
218
|
-
task_data = {
|
|
219
|
-
"id": TASK_NAME,
|
|
220
|
-
"name": "Bootstrap Guidelines",
|
|
221
|
-
"description": "Fill in project development guidelines for AI agents",
|
|
222
|
-
"status": "in_progress",
|
|
223
|
-
"dev_type": "docs",
|
|
224
|
-
"priority": "P1",
|
|
225
|
-
"creator": developer,
|
|
226
|
-
"assignee": developer,
|
|
227
|
-
"createdAt": today,
|
|
228
|
-
"completedAt": None,
|
|
229
|
-
"commit": None,
|
|
230
|
-
"subtasks": subtasks,
|
|
231
|
-
"relatedFiles": related_files,
|
|
232
|
-
"notes": f"First-time setup task created by aim init ({project_type} project)",
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
task_json = task_dir / "task.json"
|
|
236
|
-
task_json.write_text(json.dumps(task_data, indent=2, ensure_ascii=False), encoding="utf-8")
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
# =============================================================================
|
|
240
|
-
# Main
|
|
241
|
-
# =============================================================================
|
|
242
|
-
|
|
243
|
-
def main() -> int:
|
|
244
|
-
"""Main entry point."""
|
|
245
|
-
# Parse project type argument
|
|
246
|
-
project_type = "fullstack"
|
|
247
|
-
if len(sys.argv) > 1:
|
|
248
|
-
project_type = sys.argv[1]
|
|
249
|
-
|
|
250
|
-
# Validate project type
|
|
251
|
-
if project_type not in ("frontend", "backend", "fullstack"):
|
|
252
|
-
print(f"Unknown project type: {project_type}, defaulting to fullstack")
|
|
253
|
-
project_type = "fullstack"
|
|
254
|
-
|
|
255
|
-
repo_root = get_repo_root()
|
|
256
|
-
developer = get_developer(repo_root)
|
|
257
|
-
|
|
258
|
-
# Check developer initialized
|
|
259
|
-
if not developer:
|
|
260
|
-
print("Error: Developer not initialized")
|
|
261
|
-
print(f"Run: python3 ./{DIR_WORKFLOW}/{DIR_SCRIPTS}/init_developer.py <your-name>")
|
|
262
|
-
return 1
|
|
263
|
-
|
|
264
|
-
tasks_dir = get_tasks_dir(repo_root)
|
|
265
|
-
task_dir = tasks_dir / TASK_NAME
|
|
266
|
-
relative_path = f"{DIR_WORKFLOW}/{DIR_TASKS}/{TASK_NAME}"
|
|
267
|
-
|
|
268
|
-
# Check if already exists
|
|
269
|
-
if task_dir.exists():
|
|
270
|
-
print(f"Bootstrap task already exists: {relative_path}")
|
|
271
|
-
return 0
|
|
272
|
-
|
|
273
|
-
# Create task directory
|
|
274
|
-
task_dir.mkdir(parents=True, exist_ok=True)
|
|
275
|
-
|
|
276
|
-
# Write files
|
|
277
|
-
write_task_json(task_dir, developer, project_type)
|
|
278
|
-
write_prd(task_dir, project_type)
|
|
279
|
-
|
|
280
|
-
# Set as current task
|
|
281
|
-
set_current_task(relative_path, repo_root)
|
|
282
|
-
|
|
283
|
-
# Silent output - init command handles user-facing messages
|
|
284
|
-
# Only output the task path for programmatic use
|
|
285
|
-
print(relative_path)
|
|
286
|
-
return 0
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if __name__ == "__main__":
|
|
290
|
-
sys.exit(main())
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Create Bootstrap Task for First-Time Setup.
|
|
4
|
+
|
|
5
|
+
Creates a guided task to help users fill in project guidelines
|
|
6
|
+
after initializing AIM Studio for the first time.
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
python3 create_bootstrap.py [project-type]
|
|
10
|
+
|
|
11
|
+
Arguments:
|
|
12
|
+
project-type: frontend | backend | fullstack (default: fullstack)
|
|
13
|
+
|
|
14
|
+
Prerequisites:
|
|
15
|
+
- .aim-studio/.developer must exist (run init_developer.py first)
|
|
16
|
+
|
|
17
|
+
Creates:
|
|
18
|
+
.aim-studio/tasks/00-bootstrap-guidelines/
|
|
19
|
+
- task.json # Task metadata
|
|
20
|
+
- prd.md # Task description and guidance
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
import json
|
|
26
|
+
import sys
|
|
27
|
+
from datetime import datetime
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
from common.paths import (
|
|
31
|
+
DIR_WORKFLOW,
|
|
32
|
+
DIR_SCRIPTS,
|
|
33
|
+
DIR_TASKS,
|
|
34
|
+
get_repo_root,
|
|
35
|
+
get_developer,
|
|
36
|
+
get_tasks_dir,
|
|
37
|
+
set_current_task,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
# =============================================================================
|
|
42
|
+
# Constants
|
|
43
|
+
# =============================================================================
|
|
44
|
+
|
|
45
|
+
TASK_NAME = "00-bootstrap-guidelines"
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# =============================================================================
|
|
49
|
+
# PRD Content
|
|
50
|
+
# =============================================================================
|
|
51
|
+
|
|
52
|
+
def write_prd_header() -> str:
|
|
53
|
+
"""Write PRD header section."""
|
|
54
|
+
return """# Bootstrap: Fill Project Development Guidelines
|
|
55
|
+
|
|
56
|
+
## Purpose
|
|
57
|
+
|
|
58
|
+
Welcome to AIM Studio! This is your first task.
|
|
59
|
+
|
|
60
|
+
AI agents use `.aim-studio/spec/` to understand YOUR project's coding conventions.
|
|
61
|
+
**Empty templates = AI writes generic code that doesn't match your project style.**
|
|
62
|
+
|
|
63
|
+
Filling these guidelines is a one-time setup that pays off for every future AI session.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Your Task
|
|
68
|
+
|
|
69
|
+
Fill in the guideline files based on your **existing codebase**.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def write_prd_backend_section() -> str:
|
|
74
|
+
"""Write PRD backend section."""
|
|
75
|
+
return """
|
|
76
|
+
|
|
77
|
+
### Backend Guidelines
|
|
78
|
+
|
|
79
|
+
| File | What to Document |
|
|
80
|
+
|------|------------------|
|
|
81
|
+
| `.aim-studio/spec/backend/directory-structure.md` | Where different file types go (routes, services, utils) |
|
|
82
|
+
| `.aim-studio/spec/backend/database-guidelines.md` | ORM, migrations, query patterns, naming conventions |
|
|
83
|
+
| `.aim-studio/spec/backend/error-handling.md` | How errors are caught, logged, and returned |
|
|
84
|
+
| `.aim-studio/spec/backend/logging-guidelines.md` | Log levels, format, what to log |
|
|
85
|
+
| `.aim-studio/spec/backend/quality-guidelines.md` | Code review standards, testing requirements |
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def write_prd_frontend_section() -> str:
|
|
90
|
+
"""Write PRD frontend section."""
|
|
91
|
+
return """
|
|
92
|
+
|
|
93
|
+
### Frontend Guidelines
|
|
94
|
+
|
|
95
|
+
| File | What to Document |
|
|
96
|
+
|------|------------------|
|
|
97
|
+
| `.aim-studio/spec/frontend/directory-structure.md` | Component/page/hook organization |
|
|
98
|
+
| `.aim-studio/spec/frontend/component-guidelines.md` | Component patterns, props conventions |
|
|
99
|
+
| `.aim-studio/spec/frontend/hook-guidelines.md` | Custom hook naming, patterns |
|
|
100
|
+
| `.aim-studio/spec/frontend/state-management.md` | State library, patterns, what goes where |
|
|
101
|
+
| `.aim-studio/spec/frontend/type-safety.md` | TypeScript conventions, type organization |
|
|
102
|
+
| `.aim-studio/spec/frontend/quality-guidelines.md` | Linting, testing, accessibility |
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def write_prd_footer() -> str:
|
|
107
|
+
"""Write PRD footer section."""
|
|
108
|
+
return """
|
|
109
|
+
|
|
110
|
+
### Thinking Guides (Optional)
|
|
111
|
+
|
|
112
|
+
The `.aim-studio/spec/guides/` directory contains thinking guides that are already
|
|
113
|
+
filled with general best practices. You can customize them for your project if needed.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## How to Fill Guidelines
|
|
118
|
+
|
|
119
|
+
### Principle: Document Reality, Not Ideals
|
|
120
|
+
|
|
121
|
+
Write what your codebase **actually does**, not what you wish it did.
|
|
122
|
+
AI needs to match existing patterns, not introduce new ones.
|
|
123
|
+
|
|
124
|
+
### Steps
|
|
125
|
+
|
|
126
|
+
1. **Look at existing code** - Find 2-3 examples of each pattern
|
|
127
|
+
2. **Document the pattern** - Describe what you see
|
|
128
|
+
3. **Include file paths** - Reference real files as examples
|
|
129
|
+
4. **List anti-patterns** - What does your team avoid?
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Tips for Using AI
|
|
134
|
+
|
|
135
|
+
Ask AI to help analyze your codebase:
|
|
136
|
+
|
|
137
|
+
- "Look at my codebase and document the patterns you see"
|
|
138
|
+
- "Analyze my code structure and summarize the conventions"
|
|
139
|
+
- "Find error handling patterns and document them"
|
|
140
|
+
|
|
141
|
+
The AI will read your code and help you document it.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Completion Checklist
|
|
146
|
+
|
|
147
|
+
- [ ] Guidelines filled for your project type
|
|
148
|
+
- [ ] At least 2-3 real code examples in each guideline
|
|
149
|
+
- [ ] Anti-patterns documented
|
|
150
|
+
|
|
151
|
+
When done:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
python3 ./.aim-studio/scripts/task.py finish
|
|
155
|
+
python3 ./.aim-studio/scripts/task.py archive 00-bootstrap-guidelines
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Why This Matters
|
|
161
|
+
|
|
162
|
+
After completing this task:
|
|
163
|
+
|
|
164
|
+
1. AI will write code that matches your project style
|
|
165
|
+
2. Relevant `/aim:before-*-dev` commands will inject real context
|
|
166
|
+
3. `/aim:check-*` commands will validate against your actual standards
|
|
167
|
+
4. Future developers (human or AI) will onboard faster
|
|
168
|
+
"""
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def write_prd(task_dir: Path, project_type: str) -> None:
|
|
172
|
+
"""Write prd.md file."""
|
|
173
|
+
content = write_prd_header()
|
|
174
|
+
|
|
175
|
+
if project_type == "frontend":
|
|
176
|
+
content += write_prd_frontend_section()
|
|
177
|
+
elif project_type == "backend":
|
|
178
|
+
content += write_prd_backend_section()
|
|
179
|
+
else: # fullstack
|
|
180
|
+
content += write_prd_backend_section()
|
|
181
|
+
content += write_prd_frontend_section()
|
|
182
|
+
|
|
183
|
+
content += write_prd_footer()
|
|
184
|
+
|
|
185
|
+
prd_file = task_dir / "prd.md"
|
|
186
|
+
prd_file.write_text(content, encoding="utf-8")
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
# =============================================================================
|
|
190
|
+
# Task JSON
|
|
191
|
+
# =============================================================================
|
|
192
|
+
|
|
193
|
+
def write_task_json(task_dir: Path, developer: str, project_type: str) -> None:
|
|
194
|
+
"""Write task.json file."""
|
|
195
|
+
today = datetime.now().strftime("%Y-%m-%d")
|
|
196
|
+
|
|
197
|
+
# Generate subtasks and related files based on project type
|
|
198
|
+
if project_type == "frontend":
|
|
199
|
+
subtasks = [
|
|
200
|
+
{"name": "Fill frontend guidelines", "status": "pending"},
|
|
201
|
+
{"name": "Add code examples", "status": "pending"},
|
|
202
|
+
]
|
|
203
|
+
related_files = [".aim-studio/spec/frontend/"]
|
|
204
|
+
elif project_type == "backend":
|
|
205
|
+
subtasks = [
|
|
206
|
+
{"name": "Fill backend guidelines", "status": "pending"},
|
|
207
|
+
{"name": "Add code examples", "status": "pending"},
|
|
208
|
+
]
|
|
209
|
+
related_files = [".aim-studio/spec/backend/"]
|
|
210
|
+
else: # fullstack
|
|
211
|
+
subtasks = [
|
|
212
|
+
{"name": "Fill backend guidelines", "status": "pending"},
|
|
213
|
+
{"name": "Fill frontend guidelines", "status": "pending"},
|
|
214
|
+
{"name": "Add code examples", "status": "pending"},
|
|
215
|
+
]
|
|
216
|
+
related_files = [".aim-studio/spec/backend/", ".aim-studio/spec/frontend/"]
|
|
217
|
+
|
|
218
|
+
task_data = {
|
|
219
|
+
"id": TASK_NAME,
|
|
220
|
+
"name": "Bootstrap Guidelines",
|
|
221
|
+
"description": "Fill in project development guidelines for AI agents",
|
|
222
|
+
"status": "in_progress",
|
|
223
|
+
"dev_type": "docs",
|
|
224
|
+
"priority": "P1",
|
|
225
|
+
"creator": developer,
|
|
226
|
+
"assignee": developer,
|
|
227
|
+
"createdAt": today,
|
|
228
|
+
"completedAt": None,
|
|
229
|
+
"commit": None,
|
|
230
|
+
"subtasks": subtasks,
|
|
231
|
+
"relatedFiles": related_files,
|
|
232
|
+
"notes": f"First-time setup task created by aim init ({project_type} project)",
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
task_json = task_dir / "task.json"
|
|
236
|
+
task_json.write_text(json.dumps(task_data, indent=2, ensure_ascii=False), encoding="utf-8")
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
# =============================================================================
|
|
240
|
+
# Main
|
|
241
|
+
# =============================================================================
|
|
242
|
+
|
|
243
|
+
def main() -> int:
|
|
244
|
+
"""Main entry point."""
|
|
245
|
+
# Parse project type argument
|
|
246
|
+
project_type = "fullstack"
|
|
247
|
+
if len(sys.argv) > 1:
|
|
248
|
+
project_type = sys.argv[1]
|
|
249
|
+
|
|
250
|
+
# Validate project type
|
|
251
|
+
if project_type not in ("frontend", "backend", "fullstack"):
|
|
252
|
+
print(f"Unknown project type: {project_type}, defaulting to fullstack")
|
|
253
|
+
project_type = "fullstack"
|
|
254
|
+
|
|
255
|
+
repo_root = get_repo_root()
|
|
256
|
+
developer = get_developer(repo_root)
|
|
257
|
+
|
|
258
|
+
# Check developer initialized
|
|
259
|
+
if not developer:
|
|
260
|
+
print("Error: Developer not initialized")
|
|
261
|
+
print(f"Run: python3 ./{DIR_WORKFLOW}/{DIR_SCRIPTS}/init_developer.py <your-name>")
|
|
262
|
+
return 1
|
|
263
|
+
|
|
264
|
+
tasks_dir = get_tasks_dir(repo_root)
|
|
265
|
+
task_dir = tasks_dir / TASK_NAME
|
|
266
|
+
relative_path = f"{DIR_WORKFLOW}/{DIR_TASKS}/{TASK_NAME}"
|
|
267
|
+
|
|
268
|
+
# Check if already exists
|
|
269
|
+
if task_dir.exists():
|
|
270
|
+
print(f"Bootstrap task already exists: {relative_path}")
|
|
271
|
+
return 0
|
|
272
|
+
|
|
273
|
+
# Create task directory
|
|
274
|
+
task_dir.mkdir(parents=True, exist_ok=True)
|
|
275
|
+
|
|
276
|
+
# Write files
|
|
277
|
+
write_task_json(task_dir, developer, project_type)
|
|
278
|
+
write_prd(task_dir, project_type)
|
|
279
|
+
|
|
280
|
+
# Set as current task
|
|
281
|
+
set_current_task(relative_path, repo_root)
|
|
282
|
+
|
|
283
|
+
# Silent output - init command handles user-facing messages
|
|
284
|
+
# Only output the task path for programmatic use
|
|
285
|
+
print(relative_path)
|
|
286
|
+
return 0
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
if __name__ == "__main__":
|
|
290
|
+
sys.exit(main())
|