moai-adk 0.4.0__py3-none-any.whl → 0.4.4__py3-none-any.whl
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.
Potentially problematic release.
This version of moai-adk might be problematic. Click here for more details.
- moai_adk/__init__.py +2 -3
- moai_adk/cli/commands/init.py +10 -5
- moai_adk/cli/commands/update.py +274 -118
- moai_adk/cli/prompts/init_prompts.py +14 -18
- moai_adk/core/diagnostics/slash_commands.py +1 -1
- moai_adk/core/project/backup_utils.py +2 -11
- moai_adk/core/project/checker.py +2 -2
- moai_adk/core/project/phase_executor.py +11 -14
- moai_adk/core/project/validator.py +3 -2
- moai_adk/core/quality/__init__.py +1 -1
- moai_adk/core/quality/trust_checker.py +63 -63
- moai_adk/core/quality/validators/__init__.py +1 -1
- moai_adk/core/quality/validators/base_validator.py +1 -1
- moai_adk/core/template/backup.py +21 -8
- moai_adk/core/template/merger.py +14 -4
- moai_adk/core/template/processor.py +24 -5
- moai_adk/templates/.claude/agents/alfred/cc-manager.md +446 -424
- moai_adk/templates/.claude/agents/alfred/debug-helper.md +116 -103
- moai_adk/templates/.claude/agents/alfred/doc-syncer.md +130 -116
- moai_adk/templates/.claude/agents/alfred/git-manager.md +186 -174
- moai_adk/templates/.claude/agents/alfred/implementation-planner.md +227 -213
- moai_adk/templates/.claude/agents/alfred/project-manager.md +216 -128
- moai_adk/templates/.claude/agents/alfred/quality-gate.md +224 -209
- moai_adk/templates/.claude/agents/alfred/spec-builder.md +174 -160
- moai_adk/templates/.claude/agents/alfred/tag-agent.md +151 -139
- moai_adk/templates/.claude/agents/alfred/tdd-implementer.md +209 -196
- moai_adk/templates/.claude/agents/alfred/trust-checker.md +247 -233
- moai_adk/templates/.claude/commands/alfred/0-project.md +756 -640
- moai_adk/templates/.claude/commands/alfred/1-plan.md +343 -333
- moai_adk/templates/.claude/commands/alfred/2-run.md +297 -285
- moai_adk/templates/.claude/commands/alfred/3-sync.md +387 -356
- moai_adk/templates/.claude/hooks/alfred/README.md +52 -52
- moai_adk/templates/.claude/hooks/alfred/alfred_hooks.py +44 -48
- moai_adk/templates/.claude/hooks/alfred/core/__init__.py +17 -17
- moai_adk/templates/.claude/hooks/alfred/core/checkpoint.py +59 -59
- moai_adk/templates/.claude/hooks/alfred/core/context.py +19 -19
- moai_adk/templates/.claude/hooks/alfred/core/project.py +52 -52
- moai_adk/templates/.claude/hooks/alfred/handlers/__init__.py +1 -1
- moai_adk/templates/.claude/hooks/alfred/handlers/notification.py +4 -4
- moai_adk/templates/.claude/hooks/alfred/handlers/session.py +27 -27
- moai_adk/templates/.claude/hooks/alfred/handlers/tool.py +16 -17
- moai_adk/templates/.claude/hooks/alfred/handlers/user.py +11 -11
- moai_adk/templates/.claude/output-styles/alfred/agentic-coding.md +308 -307
- moai_adk/templates/.claude/output-styles/alfred/moai-adk-learning.md +297 -296
- moai_adk/templates/.claude/output-styles/alfred/study-with-alfred.md +191 -190
- moai_adk/templates/.claude/skills/moai-alfred-code-reviewer/SKILL.md +112 -0
- moai_adk/templates/.claude/skills/moai-alfred-debugger-pro/SKILL.md +103 -0
- moai_adk/templates/.claude/skills/moai-alfred-ears-authoring/SKILL.md +103 -0
- moai_adk/templates/.claude/skills/moai-alfred-git-workflow/SKILL.md +95 -0
- moai_adk/templates/.claude/skills/moai-alfred-language-detection/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-alfred-performance-optimizer/SKILL.md +105 -0
- moai_adk/templates/.claude/skills/moai-alfred-refactoring-coach/SKILL.md +97 -0
- moai_adk/templates/.claude/skills/moai-alfred-spec-metadata-validation/SKILL.md +97 -0
- moai_adk/templates/.claude/skills/moai-alfred-tag-scanning/SKILL.md +90 -0
- moai_adk/templates/.claude/skills/moai-alfred-trust-validation/SKILL.md +99 -0
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/SKILL.md +87 -0
- moai_adk/templates/.claude/skills/moai-alfred-tui-survey/examples.md +62 -0
- moai_adk/templates/.claude/skills/moai-claude-code/SKILL.md +70 -43
- moai_adk/templates/.claude/skills/moai-claude-code/examples.md +141 -141
- moai_adk/templates/.claude/skills/moai-claude-code/reference.md +179 -165
- moai_adk/templates/.claude/skills/moai-claude-code/templates/agent-full.md +78 -78
- moai_adk/templates/.claude/skills/moai-claude-code/templates/command-full.md +90 -90
- moai_adk/templates/.claude/skills/moai-claude-code/templates/plugin-full.json +39 -25
- moai_adk/templates/.claude/skills/moai-claude-code/templates/settings-full.json +117 -74
- moai_adk/templates/.claude/skills/moai-claude-code/templates/skill-full.md +131 -134
- moai_adk/templates/.claude/skills/moai-domain-backend/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-cli-tool/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-data-science/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-database/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-devops/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-frontend/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-ml/SKILL.md +43 -11
- moai_adk/templates/.claude/skills/moai-domain-mobile-app/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-security/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-domain-web-api/SKILL.md +43 -12
- moai_adk/templates/.claude/skills/moai-essentials-debug/SKILL.md +47 -11
- moai_adk/templates/.claude/skills/moai-essentials-perf/SKILL.md +47 -11
- moai_adk/templates/.claude/skills/moai-essentials-refactor/SKILL.md +51 -14
- moai_adk/templates/.claude/skills/moai-essentials-review/SKILL.md +46 -10
- moai_adk/templates/.claude/skills/moai-foundation-ears/SKILL.md +62 -25
- moai_adk/templates/.claude/skills/moai-foundation-git/SKILL.md +44 -17
- moai_adk/templates/.claude/skills/moai-foundation-langs/SKILL.md +44 -14
- moai_adk/templates/.claude/skills/moai-foundation-specs/SKILL.md +45 -13
- moai_adk/templates/.claude/skills/moai-foundation-tags/SKILL.md +46 -14
- moai_adk/templates/.claude/skills/moai-foundation-trust/SKILL.md +48 -8
- moai_adk/templates/.claude/skills/moai-lang-c/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-clojure/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-cpp/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-csharp/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-dart/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-elixir/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-go/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-haskell/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-java/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-javascript/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-julia/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-kotlin/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-lua/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-php/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-python/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-r/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-ruby/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-rust/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-scala/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-shell/SKILL.md +44 -11
- moai_adk/templates/.claude/skills/moai-lang-sql/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-swift/SKILL.md +44 -12
- moai_adk/templates/.claude/skills/moai-lang-typescript/SKILL.md +44 -12
- moai_adk/templates/.github/PULL_REQUEST_TEMPLATE.md +44 -43
- moai_adk/templates/.github/workflows/moai-gitflow.yml +36 -35
- moai_adk/templates/.moai/config.json +9 -6
- moai_adk/templates/.moai/memory/development-guide.md +220 -221
- moai_adk/templates/.moai/memory/gitflow-protection-policy.md +85 -85
- moai_adk/templates/.moai/memory/spec-metadata.md +229 -150
- moai_adk/templates/.moai/project/product.md +90 -90
- moai_adk/templates/.moai/project/structure.md +85 -85
- moai_adk/templates/.moai/project/tech.md +117 -117
- moai_adk/templates/CLAUDE.md +564 -709
- moai_adk-0.4.4.dist-info/METADATA +369 -0
- moai_adk-0.4.4.dist-info/RECORD +152 -0
- moai_adk/templates/.claude/commands/alfred/1-spec.md +0 -31
- moai_adk/templates/.claude/commands/alfred/2-build.md +0 -30
- moai_adk/templates/.claude/skills/scripts/standardize_skills.py +0 -166
- moai_adk/templates/.claude/skills/scripts/verify_standardization.sh +0 -43
- moai_adk/templates/.moai/hooks/pre-push.sample +0 -88
- moai_adk-0.4.0.dist-info/METADATA +0 -1816
- moai_adk-0.4.0.dist-info/RECORD +0 -145
- {moai_adk-0.4.0.dist-info → moai_adk-0.4.4.dist-info}/WHEEL +0 -0
- {moai_adk-0.4.0.dist-info → moai_adk-0.4.4.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.4.0.dist-info → moai_adk-0.4.4.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,157 +1,158 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: MoAI ADK Learning
|
|
3
|
-
description: MoAI-ADK
|
|
3
|
+
description: Learning mode to easily learn MoAI-ADK concepts and workflow
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# MoAI ADK Learning
|
|
7
|
+
> Interactive prompts rely on `Skill("moai-alfred-tui-survey")` so AskUserQuestion renders TUI selection menus for user surveys and approvals.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
**Audience**: Developers new to MoAI-ADK
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
This is a learning mode that helps you learn quickly by carefully explaining the core concepts and three-step workflow of MoAI-ADK.
|
|
11
12
|
|
|
12
|
-
## MoAI-ADK
|
|
13
|
+
## MoAI-ADK?
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
**Core philosophy**: “No code without specification, no implementation without testing.”
|
|
15
16
|
|
|
16
|
-
MoAI-ADK
|
|
17
|
-
1. **SPEC-First**:
|
|
18
|
-
2. **@TAG
|
|
19
|
-
3. **TRUST
|
|
17
|
+
MoAI-ADK consists of three core concepts:
|
|
18
|
+
1. **SPEC-First**: Write specifications first before writing code
|
|
19
|
+
2. **@TAG Traceability**: Link all code to SPEC
|
|
20
|
+
3. **TRUST Quality**: 5 principles to ensure code quality
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
Let’s learn how these three concepts work one by one!
|
|
22
23
|
|
|
23
24
|
---
|
|
24
25
|
|
|
25
|
-
##
|
|
26
|
+
## Core Concept 1: SPEC-First
|
|
26
27
|
|
|
27
|
-
### SPEC
|
|
28
|
+
### What is SPEC?
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
30
|
+
**To put it simply**:
|
|
31
|
+
- A blueprint that writes down in advance what to make
|
|
32
|
+
- Steps and ingredients are clearly defined, like a cooking recipe.
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
34
|
+
**Why do you need it?**
|
|
35
|
+
- Clarify requirements before development
|
|
36
|
+
- Provide a baseline for communicating with team members
|
|
37
|
+
- Allows you to track changes later
|
|
38
|
+
- Answers the question, “Why was this code written?”
|
|
38
39
|
|
|
39
|
-
### EARS
|
|
40
|
+
### EARS syntax: How to write requirements
|
|
40
41
|
|
|
41
|
-
EARS
|
|
42
|
+
EARS is a method of writing requirements using five patterns:
|
|
42
43
|
|
|
43
|
-
#### 1. Ubiquitous (
|
|
44
|
+
#### 1. Ubiquitous (basic function)
|
|
44
45
|
```markdown
|
|
45
|
-
|
|
46
|
+
The system must provide [function]
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
-
|
|
48
|
+
Example:
|
|
49
|
+
- The system must provide JWT based authentication
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
#### 2. Event-driven (
|
|
52
|
+
#### 2. Event-driven (conditional operation)
|
|
52
53
|
```markdown
|
|
53
|
-
WHEN [
|
|
54
|
+
WHEN [condition], the system must [operate]
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
- WHEN
|
|
57
|
-
- WHEN
|
|
56
|
+
Example:
|
|
57
|
+
- WHEN If valid credentials are provided, the system SHOULD issue a JWT token
|
|
58
|
+
- If the WHEN token expires, the system should return a 401 error
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
#### 3. State-driven
|
|
61
|
+
#### 3. State-driven
|
|
61
62
|
```markdown
|
|
62
|
-
WHILE [
|
|
63
|
+
WHILE When in [state], the system must [run]
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
- WHILE
|
|
65
|
+
Example:
|
|
66
|
+
- WHILE When the user is authenticated, the system SHOULD allow access to the protected resource
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
#### 4. Optional (
|
|
69
|
+
#### 4. Optional (Optional function)
|
|
69
70
|
```markdown
|
|
70
|
-
WHERE [
|
|
71
|
+
WHERE [condition], the system can [operate]
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
- WHERE
|
|
73
|
+
Example:
|
|
74
|
+
- WHERE If a refresh token is provided, the system can issue a new access token
|
|
74
75
|
```
|
|
75
76
|
|
|
76
|
-
#### 5. Constraints
|
|
77
|
+
#### 5. Constraints
|
|
77
78
|
```markdown
|
|
78
|
-
IF [
|
|
79
|
+
IF [condition], then the system SHOULD be [constrained]
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
81
|
+
Example:
|
|
82
|
+
- Token expiration time must not exceed 15 minutes
|
|
83
|
+
- Password must be at least 8 characters long
|
|
83
84
|
```
|
|
84
85
|
|
|
85
|
-
###
|
|
86
|
+
### Real-world example: Login function SPEC
|
|
86
87
|
|
|
87
88
|
```markdown
|
|
88
|
-
# @SPEC:AUTH-001: JWT
|
|
89
|
+
# @SPEC:AUTH-001: JWT authentication system
|
|
89
90
|
|
|
90
|
-
## Ubiquitous Requirements (
|
|
91
|
-
-
|
|
91
|
+
## Ubiquitous Requirements (Basic Features)
|
|
92
|
+
- The system must provide JWT-based authentication
|
|
92
93
|
|
|
93
|
-
## Event-driven Requirements (
|
|
94
|
-
- WHEN
|
|
95
|
-
- WHEN
|
|
96
|
-
- WHEN
|
|
94
|
+
## Event-driven Requirements (Conditional Actions)
|
|
95
|
+
- WHEN When valid credentials are provided, the system MUST issue a JWT token
|
|
96
|
+
- WHEN When the token expires, the system MUST return a 401 error
|
|
97
|
+
- WHEN If an invalid token is provided, the system MUST deny access
|
|
97
98
|
|
|
98
|
-
## State-driven Requirements
|
|
99
|
-
- WHILE
|
|
99
|
+
## State-driven Requirements
|
|
100
|
+
- WHILE When the user is authenticated, the system must allow access to protected resources.
|
|
100
101
|
|
|
101
|
-
## Optional Features
|
|
102
|
-
- WHERE
|
|
102
|
+
## Optional Features
|
|
103
|
+
- WHERE If a refresh token is provided, the system can issue a new access token
|
|
103
104
|
|
|
104
|
-
## Constraints
|
|
105
|
-
-
|
|
106
|
-
-
|
|
105
|
+
## Constraints
|
|
106
|
+
- Access token expiration time must not exceed 15 minutes
|
|
107
|
+
- Refresh token expiration time must not exceed 7 days
|
|
107
108
|
```
|
|
108
109
|
|
|
109
110
|
---
|
|
110
111
|
|
|
111
|
-
##
|
|
112
|
+
## Key Concept 2: @TAG Traceability
|
|
112
113
|
|
|
113
|
-
### TAG
|
|
114
|
+
### What is TAG?
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
-
|
|
117
|
-
- SPEC → TEST → CODE → DOC
|
|
118
|
-
-
|
|
116
|
+
**To put it simply**:
|
|
117
|
+
- Name tag attached to each piece of code
|
|
118
|
+
- String connecting SPEC → TEST → CODE → DOC
|
|
119
|
+
- When looking for code later, you can search by SPEC number
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
-
|
|
122
|
-
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
121
|
+
**Why do you need TAGs?**
|
|
122
|
+
- Can search by SPEC number when looking for code later
|
|
123
|
+
- Clear which code to modify if SPEC changes
|
|
124
|
+
- When reviewing code, ask yourself, “What requirements is this code?” Instant identification
|
|
125
|
+
- When a bug occurs, you can quickly find all related files
|
|
125
126
|
|
|
126
|
-
### TAG
|
|
127
|
+
### TAG system
|
|
127
128
|
|
|
128
|
-
MoAI-ADK
|
|
129
|
+
MoAI-ADK uses four TAGs:
|
|
129
130
|
|
|
130
131
|
```
|
|
131
132
|
@SPEC:ID → @TEST:ID → @CODE:ID → @DOC:ID
|
|
132
133
|
```
|
|
133
134
|
|
|
134
|
-
| TAG
|
|
135
|
-
|
|
136
|
-
| `@SPEC:ID` |
|
|
137
|
-
| `@TEST:ID` |
|
|
138
|
-
| `@CODE:ID` |
|
|
139
|
-
| `@DOC:ID`
|
|
135
|
+
| TAG | Meaning | Location | Example |
|
|
136
|
+
| ---------- | -------------------------- | -------------- | -------------- |
|
|
137
|
+
| `@SPEC:ID` | Requirements Specification | `.moai/specs/` | @SPEC:AUTH-001 |
|
|
138
|
+
| `@TEST:ID` | test code | `tests/` | @TEST:AUTH-001 |
|
|
139
|
+
| `@CODE:ID` | Implementation code | `src/` | @CODE:AUTH-001 |
|
|
140
|
+
| `@DOC:ID` | document | `docs/` | @DOC:AUTH-001 |
|
|
140
141
|
|
|
141
|
-
### TAG ID
|
|
142
|
+
### TAG ID Rule
|
|
142
143
|
|
|
143
|
-
|
|
144
|
+
**Format**: `<domain>-<3-digit number>`
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
- `AUTH-001`:
|
|
147
|
-
- `USER-002`:
|
|
148
|
-
- `PAYMENT-015`:
|
|
146
|
+
**Example**:
|
|
147
|
+
- `AUTH-001`: First function related to authentication
|
|
148
|
+
- `USER-002`: Second function related to user
|
|
149
|
+
- `PAYMENT-015`: 15th function related to payment
|
|
149
150
|
|
|
150
|
-
|
|
151
|
+
**Important**: Once assigned, the TAG ID should never be changed!
|
|
151
152
|
|
|
152
|
-
###
|
|
153
|
+
### Real-world example: How to use TAG
|
|
153
154
|
|
|
154
|
-
#### SPEC
|
|
155
|
+
#### SPEC File (`.moai/specs/SPEC-AUTH-001/spec.md`)
|
|
155
156
|
```yaml
|
|
156
157
|
---
|
|
157
158
|
id: AUTH-001
|
|
@@ -163,257 +164,257 @@ author: @YourName
|
|
|
163
164
|
priority: high
|
|
164
165
|
---
|
|
165
166
|
|
|
166
|
-
# @SPEC:AUTH-001: JWT
|
|
167
|
+
# @SPEC:AUTH-001: JWT authentication system
|
|
167
168
|
|
|
168
|
-
[
|
|
169
|
+
[Requirement details...]
|
|
169
170
|
```
|
|
170
171
|
|
|
171
|
-
####
|
|
172
|
+
#### Test file (`tests/auth/service.test.ts`)
|
|
172
173
|
```typescript
|
|
173
174
|
// @TEST:AUTH-001 | SPEC: SPEC-AUTH-001.md
|
|
174
175
|
|
|
175
|
-
test('@TEST:AUTH-001: JWT
|
|
176
|
+
test('@TEST:AUTH-001: JWT issuance on valid credentials', async () => {
|
|
176
177
|
const service = new AuthService();
|
|
177
178
|
const result = await service.authenticate('user', 'pass');
|
|
178
179
|
expect(result.token).toBeDefined();
|
|
179
180
|
});
|
|
180
181
|
```
|
|
181
182
|
|
|
182
|
-
####
|
|
183
|
+
#### Implementation file (`src/auth/service.ts`)
|
|
183
184
|
```typescript
|
|
184
185
|
// @CODE:AUTH-001 | SPEC: SPEC-AUTH-001.md | TEST: tests/auth/service.test.ts
|
|
185
186
|
|
|
186
187
|
export class AuthService {
|
|
187
188
|
async authenticate(username: string, password: string): Promise<AuthResult> {
|
|
188
|
-
|
|
189
|
+
//implementation
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
192
|
```
|
|
192
193
|
|
|
193
|
-
####
|
|
194
|
+
#### Documentation file (`docs/api/auth.md`)
|
|
194
195
|
```markdown
|
|
195
|
-
# @DOC:AUTH-001:
|
|
196
|
+
# @DOC:AUTH-001: Authentication API documentation
|
|
196
197
|
|
|
197
198
|
## POST /auth/login
|
|
198
|
-
[API
|
|
199
|
+
[API description...]
|
|
199
200
|
```
|
|
200
201
|
|
|
201
|
-
### TAG
|
|
202
|
+
### Search TAG
|
|
202
203
|
|
|
203
|
-
|
|
204
|
+
**Find a specific TAG**:
|
|
204
205
|
```bash
|
|
205
|
-
#
|
|
206
|
+
# Find all files related to AUTH-001
|
|
206
207
|
rg "AUTH-001" -n
|
|
207
208
|
```
|
|
208
209
|
|
|
209
|
-
**TAG
|
|
210
|
+
**TAG Chain Verification**:
|
|
210
211
|
```bash
|
|
211
|
-
#
|
|
212
|
+
# Check all TAGs
|
|
212
213
|
rg '@(SPEC|TEST|CODE|DOC):' -n .moai/specs/ tests/ src/ docs/
|
|
213
214
|
```
|
|
214
215
|
|
|
215
216
|
---
|
|
216
217
|
|
|
217
|
-
##
|
|
218
|
+
## Key Concept 3: TRUST 5 Principles
|
|
218
219
|
|
|
219
|
-
|
|
220
|
+
The five principles of writing good code are explained with an analogy:
|
|
220
221
|
|
|
221
|
-
### 1. 🧪 Test
|
|
222
|
+
### 1. 🧪 Test
|
|
222
223
|
|
|
223
|
-
|
|
224
|
+
**Metaphor**: Imagining the taste before cooking.
|
|
224
225
|
|
|
225
|
-
|
|
226
|
-
-
|
|
227
|
-
-
|
|
226
|
+
**Meaning**:
|
|
227
|
+
- Write tests first before writing code
|
|
228
|
+
- If the tests pass, the code works properly.
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
-
|
|
231
|
-
- SPEC → Test → Code
|
|
230
|
+
**Standard**:
|
|
231
|
+
- Test coverage ≥85%
|
|
232
|
+
- SPEC → Test → Code Strict order
|
|
232
233
|
|
|
233
|
-
|
|
234
|
+
**example**:
|
|
234
235
|
```typescript
|
|
235
|
-
//
|
|
236
|
+
// Write a test first (RED)
|
|
236
237
|
test('should add two numbers', () => {
|
|
237
|
-
|
|
238
|
+
expect(add(2, 3)).toBe(5); // Failed because there is no add function yet
|
|
238
239
|
});
|
|
239
240
|
|
|
240
|
-
//
|
|
241
|
+
// Write the next code (GREEN)
|
|
241
242
|
function add(a: number, b: number): number {
|
|
242
|
-
|
|
243
|
+
return a + b; // Test passed!
|
|
243
244
|
}
|
|
244
245
|
```
|
|
245
246
|
|
|
246
|
-
### 2. 📖 Readable
|
|
247
|
+
### 2. 📖 Readable
|
|
247
248
|
|
|
248
|
-
|
|
249
|
+
**Similar**: Writing with neat handwriting
|
|
249
250
|
|
|
250
|
-
|
|
251
|
-
-
|
|
252
|
-
-
|
|
251
|
+
**Meaning**:
|
|
252
|
+
- Code that others can understand even if they read it
|
|
253
|
+
- Code that is easy to understand even if they look at it again later
|
|
253
254
|
|
|
254
|
-
|
|
255
|
-
-
|
|
256
|
-
-
|
|
257
|
-
-
|
|
258
|
-
-
|
|
259
|
-
-
|
|
255
|
+
**Criteria**:
|
|
256
|
+
- Function ≤50 lines
|
|
257
|
+
- File ≤300 lines
|
|
258
|
+
- Complexity ≤10
|
|
259
|
+
- Parameters ≤5
|
|
260
|
+
- Use meaningful names
|
|
260
261
|
|
|
261
|
-
|
|
262
|
+
**example**:
|
|
262
263
|
```typescript
|
|
263
|
-
// ❌
|
|
264
|
+
// ❌ Bad example: difficult to understand
|
|
264
265
|
function f(x, y) {
|
|
265
266
|
return x + y;
|
|
266
267
|
}
|
|
267
268
|
|
|
268
|
-
// ✅
|
|
269
|
+
// ✅ Good example: clear name
|
|
269
270
|
function calculateTotal(price: number, tax: number): number {
|
|
270
271
|
return price + tax;
|
|
271
272
|
}
|
|
272
273
|
```
|
|
273
274
|
|
|
274
|
-
### 3. 🎯 Unified
|
|
275
|
+
### 3. 🎯 Unified
|
|
275
276
|
|
|
276
|
-
|
|
277
|
+
**analogy**: using the same method
|
|
277
278
|
|
|
278
|
-
|
|
279
|
-
-
|
|
280
|
-
-
|
|
279
|
+
**Meaning**:
|
|
280
|
+
- Apply the same pattern consistently
|
|
281
|
+
- Once you learn one method, you can apply it everywhere.
|
|
281
282
|
|
|
282
|
-
|
|
283
|
-
- SPEC
|
|
284
|
-
-
|
|
285
|
-
-
|
|
283
|
+
**Criteria**:
|
|
284
|
+
- SPEC-based architecture
|
|
285
|
+
- Type safety or runtime verification
|
|
286
|
+
- Consistent coding style
|
|
286
287
|
|
|
287
|
-
|
|
288
|
+
**example**:
|
|
288
289
|
```typescript
|
|
289
|
-
// ✅
|
|
290
|
+
// ✅ Uniformity: All APIs have the same pattern
|
|
290
291
|
async function getUser(id: string): Promise<User> { ... }
|
|
291
292
|
async function getPost(id: string): Promise<Post> { ... }
|
|
292
293
|
async function getComment(id: string): Promise<Comment> { ... }
|
|
293
294
|
```
|
|
294
295
|
|
|
295
|
-
### 4. 🔒 Secured
|
|
296
|
+
### 4. 🔒 Secured
|
|
296
297
|
|
|
297
|
-
|
|
298
|
+
**Similar**: Locking the door when you leave the house
|
|
298
299
|
|
|
299
|
-
|
|
300
|
-
-
|
|
301
|
-
-
|
|
300
|
+
**Meaning**:
|
|
301
|
+
- Protect your code from being exploited by hackers or bad actors
|
|
302
|
+
- Keep user data safe
|
|
302
303
|
|
|
303
|
-
|
|
304
|
-
-
|
|
305
|
-
- SQL Injection
|
|
306
|
-
- XSS/CSRF
|
|
307
|
-
-
|
|
308
|
-
-
|
|
304
|
+
**Criteria**:
|
|
305
|
+
- Input validation
|
|
306
|
+
- SQL Injection protection
|
|
307
|
+
- XSS/CSRF protection
|
|
308
|
+
- Password hashing
|
|
309
|
+
- Sensitive data protection
|
|
309
310
|
|
|
310
|
-
|
|
311
|
+
**example**:
|
|
311
312
|
```typescript
|
|
312
|
-
// ❌
|
|
313
|
+
// ❌ Bad example: SQL Injection risk
|
|
313
314
|
const query = `SELECT * FROM users WHERE id = '${userId}'`;
|
|
314
315
|
|
|
315
|
-
// ✅
|
|
316
|
+
// ✅ Good example: Using Prepared Statement
|
|
316
317
|
const query = 'SELECT * FROM users WHERE id = ?';
|
|
317
318
|
const user = await db.execute(query, [userId]);
|
|
318
319
|
|
|
319
|
-
// ❌
|
|
320
|
+
// ❌ Bad example: storing password plaintext
|
|
320
321
|
user.password = password;
|
|
321
322
|
|
|
322
|
-
// ✅
|
|
323
|
+
// ✅ Good example: password hashing
|
|
323
324
|
user.password = await bcrypt.hash(password, 10);
|
|
324
325
|
```
|
|
325
326
|
|
|
326
|
-
### 5. 🔗 Trackable
|
|
327
|
+
### 5. 🔗 Trackable
|
|
327
328
|
|
|
328
|
-
|
|
329
|
+
**Similar**: When organizing your closet, put a label on each box.
|
|
329
330
|
|
|
330
|
-
|
|
331
|
-
-
|
|
332
|
-
-
|
|
331
|
+
**Means**:
|
|
332
|
+
- You can quickly find the code you need later
|
|
333
|
+
- You can track the history of code changes
|
|
333
334
|
|
|
334
|
-
|
|
335
|
-
- @TAG
|
|
336
|
-
-
|
|
337
|
-
-
|
|
335
|
+
**Criteria**:
|
|
336
|
+
- Use the @TAG system
|
|
337
|
+
- Link code with SPEC
|
|
338
|
+
- Include TAG in Git commit messages
|
|
338
339
|
|
|
339
|
-
|
|
340
|
+
**example**:
|
|
340
341
|
```typescript
|
|
341
342
|
// @CODE:AUTH-001 | SPEC: SPEC-AUTH-001.md | TEST: tests/auth/service.test.ts
|
|
342
343
|
export class AuthService {
|
|
343
|
-
|
|
344
|
+
//implementation
|
|
344
345
|
}
|
|
345
346
|
|
|
346
|
-
// Git
|
|
347
|
+
// Git commit message
|
|
347
348
|
// 🟢 feat(AUTH-001): implement JWT authentication
|
|
348
349
|
```
|
|
349
350
|
|
|
350
351
|
---
|
|
351
352
|
|
|
352
|
-
##
|
|
353
|
+
## Key Concept 4: Alfred and the 9 Agents
|
|
353
354
|
|
|
354
|
-
### Alfred
|
|
355
|
+
### What is Alfred?
|
|
355
356
|
|
|
356
|
-
|
|
357
|
-
-
|
|
358
|
-
- 9
|
|
359
|
-
-
|
|
357
|
+
**In a nutshell**:
|
|
358
|
+
- Central orchestrator (conductor) of MoAI-ADK
|
|
359
|
+
- Coordinates 9 specialized agents to provide optimal help
|
|
360
|
+
- Analyzes user requests and delegates tasks to appropriate agents
|
|
360
361
|
|
|
361
|
-
|
|
362
|
+
**Metaphor**: Coordinating multiple experts like an orchestra conductor
|
|
362
363
|
|
|
363
|
-
###
|
|
364
|
+
### Main Agents (Brief Introduction)
|
|
364
365
|
|
|
365
|
-
|
|
|
366
|
-
|
|
367
|
-
| 🏗️ spec-builder
|
|
368
|
-
| 💎 code-builder
|
|
369
|
-
| 📖 doc-syncer
|
|
370
|
-
| 🔬
|
|
371
|
-
| ✅ trust-checker |
|
|
372
|
-
| 🏷️ tag-agent
|
|
366
|
+
| agent | Role | When to use |
|
|
367
|
+
| --------------- | ------------------------------- | ----------------------------------------- |
|
|
368
|
+
| 🏗️ spec-builder | SPEC Writing Expert | `/alfred:1-plan` command |
|
|
369
|
+
| 💎 code-builder | TDD Implementation Expert | `/alfred:2-run` command |
|
|
370
|
+
| 📖 doc-syncer | Document Synchronization Expert | `/alfred:3-sync` command |
|
|
371
|
+
| 🔬debug-helper | Debugging expert | Automatically called when an error occurs |
|
|
372
|
+
| ✅ trust-checker | Quality verification expert | When checking code quality |
|
|
373
|
+
| 🏷️ tag-agent | TAG Management Expert | When verifying TAG |
|
|
373
374
|
|
|
374
|
-
|
|
375
|
+
**Full list of agents**: see `AGENTS.md` file
|
|
375
376
|
|
|
376
|
-
### Alfred
|
|
377
|
+
### How Alfred Works
|
|
377
378
|
|
|
378
379
|
```
|
|
379
|
-
|
|
380
|
+
user request
|
|
380
381
|
↓
|
|
381
|
-
Alfred
|
|
382
|
+
Alfred analyzes the request
|
|
382
383
|
↓
|
|
383
|
-
|
|
384
|
+
Delegate to appropriate professional agent
|
|
384
385
|
↓
|
|
385
|
-
|
|
386
|
+
Agent performs task
|
|
386
387
|
↓
|
|
387
|
-
Alfred
|
|
388
|
+
Alfred consolidates and reports results
|
|
388
389
|
```
|
|
389
390
|
|
|
390
391
|
---
|
|
391
392
|
|
|
392
|
-
## 3
|
|
393
|
+
## Learn the 3-step workflow
|
|
393
394
|
|
|
394
|
-
MoAI-ADK
|
|
395
|
+
The core of MoAI-ADK is this three-step workflow:
|
|
395
396
|
|
|
396
397
|
```
|
|
397
|
-
/alfred:1-
|
|
398
|
+
/alfred:1-plan → /alfred:2-run → /alfred:3-sync
|
|
398
399
|
```
|
|
399
400
|
|
|
400
|
-
### 1
|
|
401
|
+
### Step 1: Write a SPEC (`/alfred:1-plan`)
|
|
401
402
|
|
|
402
|
-
|
|
403
|
-
-
|
|
404
|
-
- `.moai/specs/SPEC-{ID}/spec.md`
|
|
405
|
-
- @SPEC:ID TAG
|
|
406
|
-
- Git
|
|
403
|
+
**What do you do?**
|
|
404
|
+
- Write requirements in EARS syntax
|
|
405
|
+
- Create `.moai/specs/SPEC-{ID}/spec.md` file
|
|
406
|
+
- Automatically assign @SPEC:ID TAG
|
|
407
|
+
- Create Git branch (optional)
|
|
407
408
|
|
|
408
|
-
|
|
409
|
+
**Use example**:
|
|
409
410
|
```bash
|
|
410
|
-
/alfred:1-
|
|
411
|
+
/alfred:1-plan "JWT authentication system"
|
|
411
412
|
```
|
|
412
413
|
|
|
413
|
-
**Alfred
|
|
414
|
-
1.
|
|
415
|
-
2. SPEC
|
|
416
|
-
3. YAML
|
|
414
|
+
**Alfred does this automatically**:
|
|
415
|
+
1. Duplicate check: “Does AUTH-001 already exist?”
|
|
416
|
+
2. Create SPEC file: `.moai/specs/SPEC-AUTH-001/spec.md`
|
|
417
|
+
3. Add YAML metadata:
|
|
417
418
|
```yaml
|
|
418
419
|
---
|
|
419
420
|
id: AUTH-001
|
|
@@ -425,10 +426,10 @@ MoAI-ADK의 핵심은 이 3단계 워크플로우입니다:
|
|
|
425
426
|
priority: high
|
|
426
427
|
---
|
|
427
428
|
```
|
|
428
|
-
4. EARS
|
|
429
|
-
5. @SPEC:AUTH-001 TAG
|
|
429
|
+
4. EARS syntax template provided
|
|
430
|
+
5. @SPEC:AUTH-001 TAG allocation
|
|
430
431
|
|
|
431
|
-
|
|
432
|
+
**Example of deliverable**:
|
|
432
433
|
```yaml
|
|
433
434
|
---
|
|
434
435
|
id: AUTH-001
|
|
@@ -440,49 +441,49 @@ author: @YourName
|
|
|
440
441
|
priority: high
|
|
441
442
|
---
|
|
442
443
|
|
|
443
|
-
# @SPEC:AUTH-001: JWT
|
|
444
|
+
# @SPEC:AUTH-001: JWT authentication system
|
|
444
445
|
|
|
445
446
|
## Ubiquitous Requirements
|
|
446
|
-
-
|
|
447
|
+
- The system must provide JWT-based authentication
|
|
447
448
|
|
|
448
449
|
## Event-driven Requirements
|
|
449
|
-
- WHEN
|
|
450
|
-
- WHEN
|
|
450
|
+
- WHEN Upon providing valid credentials, the system SHOULD issue a JWT token
|
|
451
|
+
- If the WHEN token expires, the system SHOULD return a 401 error
|
|
451
452
|
|
|
452
453
|
## Constraints
|
|
453
|
-
-
|
|
454
|
+
- Token expiration time must not exceed 15 minutes.
|
|
454
455
|
```
|
|
455
456
|
|
|
456
|
-
### 2
|
|
457
|
+
### Step 2: Implement TDD (`/alfred:2-run`)
|
|
457
458
|
|
|
458
|
-
|
|
459
|
-
- **RED**:
|
|
460
|
-
- **GREEN**:
|
|
461
|
-
- **REFACTOR**:
|
|
459
|
+
**What do you do?**
|
|
460
|
+
- **RED**: Write tests that fail (`@TEST:ID`)
|
|
461
|
+
- **GREEN**: Pass tests with minimal implementation (`@CODE:ID`)
|
|
462
|
+
- **REFACTOR**: Improve code quality (apply TRUST 5 principles)
|
|
462
463
|
|
|
463
|
-
|
|
464
|
+
**Use example**:
|
|
464
465
|
```bash
|
|
465
|
-
/alfred:2-
|
|
466
|
+
/alfred:2-run AUTH-001
|
|
466
467
|
```
|
|
467
468
|
|
|
468
|
-
**Alfred
|
|
469
|
+
**Alfred does this automatically**:
|
|
469
470
|
|
|
470
|
-
#### 🔴 RED:
|
|
471
|
+
#### 🔴 RED: Writing tests that fail
|
|
471
472
|
```typescript
|
|
472
473
|
// tests/auth/service.test.ts
|
|
473
474
|
// @TEST:AUTH-001 | SPEC: SPEC-AUTH-001.md
|
|
474
475
|
|
|
475
|
-
test('@TEST:AUTH-001: JWT
|
|
476
|
+
test('@TEST:AUTH-001: JWT issuance on valid credentials', async () => {
|
|
476
477
|
const service = new AuthService();
|
|
477
478
|
const result = await service.authenticate('user', 'pass');
|
|
478
479
|
expect(result.token).toBeDefined();
|
|
479
|
-
|
|
480
|
+
expect(result.expiresIn).toBeLessThanOrEqual(900); // 15 minutes
|
|
480
481
|
});
|
|
481
482
|
```
|
|
482
483
|
|
|
483
|
-
|
|
484
|
+
**Test Run**: ❌ FAIL (AuthService does not exist yet)
|
|
484
485
|
|
|
485
|
-
#### 🟢 GREEN:
|
|
486
|
+
#### 🟢 GREEN: Minimal implementation
|
|
486
487
|
```typescript
|
|
487
488
|
// src/auth/service.ts
|
|
488
489
|
// @CODE:AUTH-001 | SPEC: SPEC-AUTH-001.md | TEST: tests/auth/service.test.ts
|
|
@@ -497,105 +498,105 @@ export class AuthService {
|
|
|
497
498
|
}
|
|
498
499
|
```
|
|
499
500
|
|
|
500
|
-
|
|
501
|
+
**Test Run**: ✅ PASS
|
|
501
502
|
|
|
502
|
-
#### ♻️ REFACTOR:
|
|
503
|
+
#### ♻️ REFACTOR: Quality Improvement
|
|
503
504
|
```typescript
|
|
504
|
-
//
|
|
505
|
+
// Add input validation (Secured)
|
|
505
506
|
if (!username || !password) {
|
|
506
507
|
throw new ValidationError('Username and password required');
|
|
507
508
|
}
|
|
508
509
|
|
|
509
|
-
//
|
|
510
|
+
// Function Separation (Readable)
|
|
510
511
|
private generateToken(username: string): string {
|
|
511
512
|
return jwt.sign({ username }, SECRET, { expiresIn: '15m' });
|
|
512
513
|
}
|
|
513
514
|
|
|
514
|
-
//
|
|
515
|
+
// Reduce complexity (Unified)
|
|
515
516
|
```
|
|
516
517
|
|
|
517
|
-
|
|
518
|
-
**TRUST
|
|
518
|
+
**Run Test**: ✅ PASS
|
|
519
|
+
**TRUST Verify**: ✅ All pass
|
|
519
520
|
|
|
520
|
-
**Git
|
|
521
|
+
**Git commit**:
|
|
521
522
|
```bash
|
|
522
523
|
1. 🔴 RED: test(AUTH-001): add failing auth service test
|
|
523
524
|
2. 🟢 GREEN: feat(AUTH-001): implement minimal auth service
|
|
524
525
|
3. ♻️ REFACTOR: refactor(AUTH-001): improve code quality per TRUST
|
|
525
526
|
```
|
|
526
527
|
|
|
527
|
-
### 3
|
|
528
|
+
### Step 3: Synchronize documents (`/alfred:3-sync`)
|
|
528
529
|
|
|
529
|
-
|
|
530
|
-
- TAG
|
|
531
|
-
-
|
|
532
|
-
- Living Document
|
|
533
|
-
- PR
|
|
530
|
+
**What does it do?**
|
|
531
|
+
- TAG chain verification (@SPEC → @TEST → @CODE → @DOC)
|
|
532
|
+
- Orphan TAG detection (CODE without SPEC, etc.)
|
|
533
|
+
- Automatic creation of Living Document
|
|
534
|
+
- PR status update (Draft → Ready)
|
|
534
535
|
|
|
535
|
-
|
|
536
|
+
**Use example**:
|
|
536
537
|
```bash
|
|
537
538
|
/alfred:3-sync
|
|
538
539
|
```
|
|
539
540
|
|
|
540
|
-
**Alfred
|
|
541
|
+
**Alfred does this automatically**:
|
|
541
542
|
|
|
542
|
-
1. **TAG
|
|
543
|
+
1. **TAG Chain Verification**:
|
|
543
544
|
```bash
|
|
544
545
|
rg '@(SPEC|TEST|CODE|DOC):' -n .moai/specs/ tests/ src/ docs/
|
|
545
546
|
```
|
|
546
547
|
|
|
547
|
-
2.
|
|
548
|
+
2. **Verification results**:
|
|
548
549
|
```
|
|
549
550
|
✓ @SPEC:AUTH-001 → .moai/specs/SPEC-AUTH-001.md
|
|
550
551
|
✓ @TEST:AUTH-001 → tests/auth/service.test.ts
|
|
551
552
|
✓ @CODE:AUTH-001 → src/auth/service.ts
|
|
552
553
|
✓ @DOC:AUTH-001 → docs/api/auth.md
|
|
553
554
|
|
|
554
|
-
TAG
|
|
555
|
-
|
|
556
|
-
SPEC
|
|
555
|
+
TAG Chain Integrity: 100%
|
|
556
|
+
Orphan TAG: None
|
|
557
|
+
SPEC Version Match: v0.0.1
|
|
557
558
|
```
|
|
558
559
|
|
|
559
|
-
3. **Living Document
|
|
560
|
+
3. **Create Living Document**:
|
|
560
561
|
```markdown
|
|
561
|
-
# @DOC:AUTH-001:
|
|
562
|
+
# @DOC:AUTH-001: Authentication API documentation
|
|
562
563
|
|
|
563
564
|
## POST /auth/login
|
|
564
565
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
566
|
+
**Requirements**: @SPEC:AUTH-001
|
|
567
|
+
**Implementation**: @CODE:AUTH-001
|
|
568
|
+
**Test**: @TEST:AUTH-001
|
|
568
569
|
|
|
569
|
-
[
|
|
570
|
+
[Automatically generated API documentation...]
|
|
570
571
|
```
|
|
571
572
|
|
|
572
|
-
4. **PR
|
|
573
|
+
4. **PR Status Transition Proposal**:
|
|
573
574
|
```
|
|
574
575
|
PR #123: feature/spec-auth-001
|
|
575
|
-
|
|
576
|
-
|
|
576
|
+
Current Status: Draft
|
|
577
|
+
Proposal: Ready for Review
|
|
577
578
|
|
|
578
|
-
SPEC
|
|
579
|
-
TDD
|
|
580
|
-
TRUST
|
|
579
|
+
SPEC requirements: ✅ All met
|
|
580
|
+
TDD history: ✅ RED → GREEN → REFACTOR
|
|
581
|
+
TRUST Verification: ✅ All passed
|
|
581
582
|
|
|
582
|
-
PR Ready
|
|
583
|
+
PR Ready conversion? (y/n)
|
|
583
584
|
```
|
|
584
585
|
|
|
585
586
|
---
|
|
586
587
|
|
|
587
|
-
##
|
|
588
|
+
## Practical example: Creating a simple calculator
|
|
588
589
|
|
|
589
|
-
3
|
|
590
|
+
Let’s put the 3-step workflow into practice!
|
|
590
591
|
|
|
591
|
-
### 1️⃣ SPEC
|
|
592
|
+
### 1️⃣ Write SPEC
|
|
592
593
|
```bash
|
|
593
|
-
/alfred:1-
|
|
594
|
+
/alfred:1-plan "Calculator for adding two numbers"
|
|
594
595
|
|
|
595
|
-
# Alfred
|
|
596
|
+
# Created by Alfred: .moai/specs/SPEC-CALC-001/spec.md
|
|
596
597
|
```
|
|
597
598
|
|
|
598
|
-
|
|
599
|
+
**Generated SPEC**:
|
|
599
600
|
```yaml
|
|
600
601
|
---
|
|
601
602
|
id: CALC-001
|
|
@@ -607,27 +608,27 @@ author: @YourName
|
|
|
607
608
|
priority: medium
|
|
608
609
|
---
|
|
609
610
|
|
|
610
|
-
# @SPEC:CALC-001:
|
|
611
|
+
# @SPEC:CALC-001: Calculator - addition function
|
|
611
612
|
|
|
612
613
|
## Ubiquitous Requirements
|
|
613
|
-
-
|
|
614
|
+
- The system must provide addition of two numbers
|
|
614
615
|
|
|
615
616
|
## Event-driven Requirements
|
|
616
|
-
- WHEN
|
|
617
|
+
- WHEN two numbers are entered, the system should return the sum
|
|
617
618
|
|
|
618
619
|
## Constraints
|
|
619
|
-
-
|
|
620
|
-
-
|
|
620
|
+
- Input must be numeric
|
|
621
|
+
- Results must be accurate
|
|
621
622
|
```
|
|
622
623
|
|
|
623
|
-
### 2️⃣ TDD
|
|
624
|
+
### 2️⃣ TDD implementation
|
|
624
625
|
```bash
|
|
625
|
-
/alfred:2-
|
|
626
|
+
/alfred:2-run CALC-001
|
|
626
627
|
|
|
627
|
-
# Alfred
|
|
628
|
+
# Alfred performs Red-Green-Refactor automatically
|
|
628
629
|
```
|
|
629
630
|
|
|
630
|
-
|
|
631
|
+
**Generated Code**:
|
|
631
632
|
```typescript
|
|
632
633
|
// tests/calc.test.ts
|
|
633
634
|
// @TEST:CALC-001 | SPEC: SPEC-CALC-001.md
|
|
@@ -646,46 +647,46 @@ export function add(a: number, b: number): number {
|
|
|
646
647
|
}
|
|
647
648
|
```
|
|
648
649
|
|
|
649
|
-
### 3️⃣
|
|
650
|
+
### 3️⃣ Document synchronization
|
|
650
651
|
```bash
|
|
651
652
|
/alfred:3-sync
|
|
652
653
|
|
|
653
|
-
# TAG
|
|
654
|
+
# TAG verification and document generation
|
|
654
655
|
```
|
|
655
656
|
|
|
656
|
-
|
|
657
|
+
**result**:
|
|
657
658
|
```
|
|
658
659
|
✓ @SPEC:CALC-001
|
|
659
660
|
✓ @TEST:CALC-001
|
|
660
661
|
✓ @CODE:CALC-001
|
|
661
662
|
✓ @DOC:CALC-001
|
|
662
663
|
|
|
663
|
-
|
|
664
|
+
completion! SPEC → TEST → CODE → DOC completed with 3 commands!
|
|
664
665
|
```
|
|
665
666
|
|
|
666
667
|
---
|
|
667
668
|
|
|
668
|
-
##
|
|
669
|
+
## Next steps
|
|
669
670
|
|
|
670
|
-
### MoAI-ADK
|
|
671
|
+
### If you have learned MoAI-ADK
|
|
671
672
|
|
|
672
|
-
|
|
673
|
+
Now let's switch to a different style and put it into practice:
|
|
673
674
|
|
|
674
|
-
|
|
|
675
|
-
|
|
676
|
-
|
|
|
677
|
-
|
|
|
675
|
+
| Next goal | Recommended Style | Conversion command |
|
|
676
|
+
| --------------------------------- | --------------------- | --------------------------------- |
|
|
677
|
+
| Practical project development | **agentic-coding** | `/output-style agentic-coding` |
|
|
678
|
+
| Learning a new language/framework | **study-with-alfred** | `/output-style study-with-alfred` |
|
|
678
679
|
|
|
679
|
-
###
|
|
680
|
+
### Learn more
|
|
680
681
|
|
|
681
|
-
|
|
682
|
-
- `.moai/memory/development-guide.md` -
|
|
683
|
-
- `.moai/project/structure.md` -
|
|
684
|
-
- `.moai/memory/spec-metadata.md` - SPEC
|
|
682
|
+
**Detailed guide**:
|
|
683
|
+
- `.moai/memory/development-guide.md` - Detailed development guide
|
|
684
|
+
- `.moai/project/structure.md` - Project structure
|
|
685
|
+
- `.moai/memory/spec-metadata.md` - SPEC metadata standard
|
|
685
686
|
|
|
686
|
-
|
|
687
|
-
- `AGENTS.md` -
|
|
687
|
+
**Agent Documentation**:
|
|
688
|
+
- `AGENTS.md` - Detailed description of 9 specialized agents
|
|
688
689
|
|
|
689
690
|
---
|
|
690
691
|
|
|
691
|
-
**MoAI ADK Learning**:
|
|
692
|
+
**MoAI ADK Learning**: A friendly learning mode that helps you quickly learn the core concepts and workflow of MoAI-ADK.
|