moai-adk 0.8.2__py3-none-any.whl → 0.8.3__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/core/config/migration.py +1 -1
- moai_adk/core/issue_creator.py +7 -3
- moai_adk/core/tags/__init__.py +23 -24
- moai_adk/core/tags/ci_validator.py +3 -5
- moai_adk/core/tags/cli.py +2 -2
- moai_adk/core/tags/pre_commit_validator.py +5 -5
- moai_adk/core/tags/reporter.py +3 -5
- moai_adk/core/tags/validator.py +3 -3
- moai_adk/templates/.claude/commands/alfred/1-plan.md +65 -15
- moai_adk/templates/.claude/commands/alfred/2-run.md +65 -15
- moai_adk/templates/.claude/commands/alfred/3-sync.md +68 -14
- moai_adk/templates/.claude/hooks/alfred/core/version_cache.py +1 -1
- moai_adk/templates/.claude/hooks/alfred/shared/core/project.py +34 -23
- moai_adk/templates/.claude/hooks/alfred/shared/core/version_cache.py +3 -3
- moai_adk/templates/.moai/memory/gitflow-protection-policy.md +220 -0
- moai_adk/templates/.moai/memory/spec-metadata.md +356 -0
- moai_adk/templates/src/moai_adk/core/tags/__init__.py +23 -24
- moai_adk/templates/src/moai_adk/core/tags/ci_validator.py +3 -5
- moai_adk/templates/src/moai_adk/core/tags/cli.py +2 -2
- moai_adk/templates/src/moai_adk/core/tags/pre_commit_validator.py +5 -5
- moai_adk/templates/src/moai_adk/core/tags/reporter.py +3 -5
- moai_adk/templates/src/moai_adk/core/tags/validator.py +3 -3
- {moai_adk-0.8.2.dist-info → moai_adk-0.8.3.dist-info}/METADATA +15 -14
- {moai_adk-0.8.2.dist-info → moai_adk-0.8.3.dist-info}/RECORD +27 -25
- {moai_adk-0.8.2.dist-info → moai_adk-0.8.3.dist-info}/WHEEL +0 -0
- {moai_adk-0.8.2.dist-info → moai_adk-0.8.3.dist-info}/entry_points.txt +0 -0
- {moai_adk-0.8.2.dist-info → moai_adk-0.8.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -458,7 +458,7 @@ def is_network_available(timeout_seconds: float = 0.1) -> bool:
|
|
|
458
458
|
return False
|
|
459
459
|
|
|
460
460
|
|
|
461
|
-
# @CODE:
|
|
461
|
+
# @CODE:VERSION-DETECT-MAJOR-001
|
|
462
462
|
def is_major_version_change(current: str, latest: str) -> bool:
|
|
463
463
|
"""Detect if version change is a major version bump.
|
|
464
464
|
|
|
@@ -538,7 +538,7 @@ def get_package_version_info(cwd: str = ".") -> dict[str, Any]:
|
|
|
538
538
|
- RED: 5 test scenarios (network detection, cache integration, offline mode)
|
|
539
539
|
- GREEN: Integrate VersionCache with network detection
|
|
540
540
|
- REFACTOR: Extract cache directory constant, improve error handling
|
|
541
|
-
- Phase 3: Add release_notes_url and is_major_update fields (@CODE:
|
|
541
|
+
- Phase 3: Add release_notes_url and is_major_update fields (@CODE:VERSION-INTEGRATE-FIELDS-001)
|
|
542
542
|
"""
|
|
543
543
|
import importlib.util
|
|
544
544
|
import urllib.error
|
|
@@ -556,7 +556,7 @@ def get_package_version_info(cwd: str = ".") -> dict[str, Any]:
|
|
|
556
556
|
else:
|
|
557
557
|
# Skip caching if module can't be loaded
|
|
558
558
|
VersionCache = None
|
|
559
|
-
except (ImportError, OSError)
|
|
559
|
+
except (ImportError, OSError):
|
|
560
560
|
# Graceful degradation: skip caching on import errors
|
|
561
561
|
VersionCache = None
|
|
562
562
|
|
|
@@ -564,44 +564,55 @@ def get_package_version_info(cwd: str = ".") -> dict[str, Any]:
|
|
|
564
564
|
cache_dir = Path(cwd) / CACHE_DIR_NAME
|
|
565
565
|
version_cache = VersionCache(cache_dir) if VersionCache else None
|
|
566
566
|
|
|
567
|
-
# 2.
|
|
567
|
+
# 2. Get current installed version first (needed for cache validation)
|
|
568
|
+
current_version = "unknown"
|
|
569
|
+
try:
|
|
570
|
+
current_version = version("moai-adk")
|
|
571
|
+
except PackageNotFoundError:
|
|
572
|
+
current_version = "dev"
|
|
573
|
+
# Dev mode - skip cache and return immediately
|
|
574
|
+
return {
|
|
575
|
+
"current": "dev",
|
|
576
|
+
"latest": "unknown",
|
|
577
|
+
"update_available": False,
|
|
578
|
+
"upgrade_command": ""
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
# 3. Try to load from cache (fast path with version validation)
|
|
568
582
|
if version_cache and version_cache.is_valid():
|
|
569
583
|
cached_info = version_cache.load()
|
|
570
584
|
if cached_info:
|
|
571
|
-
#
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
585
|
+
# Only use cache if the cached version matches current installed version
|
|
586
|
+
# This prevents stale cache when package is upgraded locally
|
|
587
|
+
if cached_info.get("current") == current_version:
|
|
588
|
+
# Ensure new fields exist for backward compatibility
|
|
589
|
+
if "release_notes_url" not in cached_info:
|
|
590
|
+
# Add missing fields to old cached data
|
|
591
|
+
cached_info.setdefault("release_notes_url", None)
|
|
592
|
+
cached_info.setdefault("is_major_update", False)
|
|
593
|
+
return cached_info
|
|
594
|
+
# else: cache is stale (version changed), fall through to re-check
|
|
595
|
+
|
|
596
|
+
# 4. Cache miss or stale - need to query PyPI
|
|
579
597
|
result = {
|
|
580
|
-
"current":
|
|
598
|
+
"current": current_version,
|
|
581
599
|
"latest": "unknown",
|
|
582
600
|
"update_available": False,
|
|
583
601
|
"upgrade_command": ""
|
|
584
602
|
}
|
|
585
603
|
|
|
586
|
-
#
|
|
587
|
-
try:
|
|
588
|
-
result["current"] = version("moai-adk")
|
|
589
|
-
except PackageNotFoundError:
|
|
590
|
-
result["current"] = "dev"
|
|
591
|
-
return result
|
|
592
|
-
|
|
593
|
-
# 4. Check if version check is enabled in config (Phase 4)
|
|
604
|
+
# 5. Check if version check is enabled in config
|
|
594
605
|
config = get_version_check_config(cwd)
|
|
595
606
|
if not config["enabled"]:
|
|
596
607
|
# Version check disabled - return only current version
|
|
597
608
|
return result
|
|
598
609
|
|
|
599
|
-
#
|
|
610
|
+
# 6. Check network before PyPI query
|
|
600
611
|
if not is_network_available():
|
|
601
612
|
# Offline mode - return current version only
|
|
602
613
|
return result
|
|
603
614
|
|
|
604
|
-
#
|
|
615
|
+
# 7. Network available - query PyPI
|
|
605
616
|
pypi_data = None
|
|
606
617
|
try:
|
|
607
618
|
with timeout_handler(1):
|
|
@@ -37,12 +37,12 @@ class VersionCache:
|
|
|
37
37
|
'0.8.1'
|
|
38
38
|
"""
|
|
39
39
|
|
|
40
|
-
def __init__(self, cache_dir: Path, ttl_hours: int =
|
|
40
|
+
def __init__(self, cache_dir: Path, ttl_hours: int = 4):
|
|
41
41
|
"""Initialize cache with TTL in hours
|
|
42
42
|
|
|
43
43
|
Args:
|
|
44
44
|
cache_dir: Directory where cache file will be stored
|
|
45
|
-
ttl_hours: Time-to-live in hours (default
|
|
45
|
+
ttl_hours: Time-to-live in hours (default 4)
|
|
46
46
|
"""
|
|
47
47
|
self.cache_dir = Path(cache_dir)
|
|
48
48
|
self.ttl_hours = ttl_hours
|
|
@@ -149,7 +149,7 @@ class VersionCache:
|
|
|
149
149
|
|
|
150
150
|
return True
|
|
151
151
|
|
|
152
|
-
except (OSError, TypeError)
|
|
152
|
+
except (OSError, TypeError):
|
|
153
153
|
# Graceful degradation on write errors
|
|
154
154
|
return False
|
|
155
155
|
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# GitFlow Advisory Policy
|
|
2
|
+
|
|
3
|
+
**Document ID**: @DOC:GITFLOW-POLICY-001
|
|
4
|
+
**Published**: 2025-10-17
|
|
5
|
+
**Status**: Advisory (recommended, not enforced)
|
|
6
|
+
**Scope**: Personal and Team modes
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
MoAI-ADK **recommends** a GitFlow-inspired workflow. This policy shares best practices while letting teams adapt them as needed.
|
|
13
|
+
|
|
14
|
+
## Key Recommendations
|
|
15
|
+
|
|
16
|
+
### 1. Main Branch Access (Recommended)
|
|
17
|
+
|
|
18
|
+
| Recommendation | Summary | Enforcement |
|
|
19
|
+
|----------------|---------|-------------|
|
|
20
|
+
| **Merge via develop** | Prefer merging `develop` into `main` | Advisory ⚠️ |
|
|
21
|
+
| **Feature branches off develop** | Branch from `develop` and raise PRs back to `develop` | Advisory ⚠️ |
|
|
22
|
+
| **Release process** | Release flow: `develop` → `main` (release engineer encouraged) | Advisory ⚠️ |
|
|
23
|
+
| **Force push** | Warn when force-pushing, but allow it | Warning ⚠️ |
|
|
24
|
+
| **Direct push** | Warn on direct pushes to `main`, but allow them | Warning ⚠️ |
|
|
25
|
+
|
|
26
|
+
### 2. Git Workflow (Recommended)
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
┌─────────────────────────────────────────────────────────┐
|
|
30
|
+
│ RECOMMENDED GITFLOW │
|
|
31
|
+
└─────────────────────────────────────────────────────────┘
|
|
32
|
+
|
|
33
|
+
develop (recommended base branch)
|
|
34
|
+
↑ ↓
|
|
35
|
+
┌─────────────────┐
|
|
36
|
+
│ │
|
|
37
|
+
│ developer work │
|
|
38
|
+
│ │
|
|
39
|
+
↓ ↑
|
|
40
|
+
feature/SPEC-{ID} [PR: feature -> develop]
|
|
41
|
+
[code review + approval]
|
|
42
|
+
[Merge to develop]
|
|
43
|
+
|
|
44
|
+
develop (stable)
|
|
45
|
+
↓
|
|
46
|
+
│ (release manager prepares)
|
|
47
|
+
↓
|
|
48
|
+
[PR: develop -> main]
|
|
49
|
+
[CI/CD validation]
|
|
50
|
+
[tag creation]
|
|
51
|
+
↓
|
|
52
|
+
main (release)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Flexibility**: Direct pushes to `main` are still possible, but the workflow above is preferred.
|
|
56
|
+
|
|
57
|
+
## Technical Implementation
|
|
58
|
+
|
|
59
|
+
### Pre-push Hook (Advisory Mode)
|
|
60
|
+
|
|
61
|
+
**Location**: `.git/hooks/pre-push`
|
|
62
|
+
**Purpose**: Warn on `main` branch pushes without blocking them
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# When attempting to push to main:
|
|
66
|
+
⚠️ ADVISORY: Non-standard GitFlow detected
|
|
67
|
+
|
|
68
|
+
Current branch: feature/SPEC-123
|
|
69
|
+
Target branch: main
|
|
70
|
+
|
|
71
|
+
Recommended GitFlow workflow:
|
|
72
|
+
1. Work on feature/SPEC-{ID} branch (created from develop)
|
|
73
|
+
2. Push to feature/SPEC-{ID} and create PR to develop
|
|
74
|
+
3. Merge into develop after code review
|
|
75
|
+
4. When develop is stable, create PR from develop to main
|
|
76
|
+
5. Release manager merges develop -> main with tag
|
|
77
|
+
|
|
78
|
+
✓ Push will proceed (flexibility mode enabled)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Force Push Advisory
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
⚠️ ADVISORY: Force-push to main branch detected
|
|
85
|
+
|
|
86
|
+
Recommended approach:
|
|
87
|
+
- Use GitHub PR with proper code review
|
|
88
|
+
- Ensure changes are merged via fast-forward
|
|
89
|
+
|
|
90
|
+
✓ Push will proceed (flexibility mode enabled)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Workflow Examples
|
|
96
|
+
|
|
97
|
+
### Scenario 1: Standard Feature Development (Recommended)
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# 1. Sync latest code from develop
|
|
101
|
+
git checkout develop
|
|
102
|
+
git pull origin develop
|
|
103
|
+
|
|
104
|
+
# 2. Create a feature branch (from develop)
|
|
105
|
+
git checkout -b feature/SPEC-001-new-feature
|
|
106
|
+
|
|
107
|
+
# 3. Implement the change
|
|
108
|
+
# ... write code and tests ...
|
|
109
|
+
|
|
110
|
+
# 4. Commit
|
|
111
|
+
git add .
|
|
112
|
+
git commit -m "..."
|
|
113
|
+
|
|
114
|
+
# 5. Push
|
|
115
|
+
git push origin feature/SPEC-001-new-feature
|
|
116
|
+
|
|
117
|
+
# 6. Open a PR: feature/SPEC-001-new-feature -> develop
|
|
118
|
+
|
|
119
|
+
# 7. Merge into develop after review and approval
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Scenario 2: Fast Hotfix (Flexible)
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# When an urgent fix is required:
|
|
126
|
+
|
|
127
|
+
# Option 1: Recommended (via develop)
|
|
128
|
+
git checkout develop
|
|
129
|
+
git checkout -b hotfix/critical-bug
|
|
130
|
+
# ... apply fix ...
|
|
131
|
+
git push origin hotfix/critical-bug
|
|
132
|
+
# Open PRs: hotfix -> develop -> main
|
|
133
|
+
|
|
134
|
+
# Option 2: Direct fix on main (allowed, not recommended)
|
|
135
|
+
git checkout main
|
|
136
|
+
# ... apply fix ...
|
|
137
|
+
git commit -m "Fix critical bug"
|
|
138
|
+
git push origin main # ⚠️ Advisory warning appears but push continues
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Scenario 3: Release (Standard or Flexible)
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Standard approach (recommended):
|
|
145
|
+
git checkout develop
|
|
146
|
+
gh pr create --base main --head develop --title "Release v1.0.0"
|
|
147
|
+
|
|
148
|
+
# Direct push (allowed):
|
|
149
|
+
git checkout develop
|
|
150
|
+
git push origin main # ⚠️ Advisory warning appears but push continues
|
|
151
|
+
git tag -a v1.0.0 -m "Release v1.0.0"
|
|
152
|
+
git push origin v1.0.0
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Policy Modes
|
|
158
|
+
|
|
159
|
+
### Strict Mode (Legacy, Currently Disabled)
|
|
160
|
+
|
|
161
|
+
- ❌ Block direct pushes to `main`
|
|
162
|
+
- ❌ Block force pushes
|
|
163
|
+
- ❌ Block merges into `main` from any branch other than `develop`
|
|
164
|
+
|
|
165
|
+
### Advisory Mode (Active, v0.3.5+)
|
|
166
|
+
|
|
167
|
+
- ⚠️ Warn but allow direct pushes to `main`
|
|
168
|
+
- ⚠️ Warn but allow force pushes
|
|
169
|
+
- ⚠️ Recommend best practices while preserving flexibility
|
|
170
|
+
- ✅ Respect user judgment
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Recommended Checklist
|
|
175
|
+
|
|
176
|
+
Every contributor should ensure:
|
|
177
|
+
|
|
178
|
+
- [ ] `.git/hooks/pre-push` exists and is executable (755)
|
|
179
|
+
- [ ] Feature branches fork from `develop`
|
|
180
|
+
- [ ] Pull requests target `develop`
|
|
181
|
+
- [ ] Releases merge `develop` → `main`
|
|
182
|
+
|
|
183
|
+
**Verification Commands**:
|
|
184
|
+
```bash
|
|
185
|
+
ls -la .git/hooks/pre-push
|
|
186
|
+
git branch -vv
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## FAQ
|
|
192
|
+
|
|
193
|
+
**Q: Can we merge into `main` from branches other than `develop`?**
|
|
194
|
+
A: Yes. You will see an advisory warning, but the merge proceeds. The recommended path remains `develop` → `main`.
|
|
195
|
+
|
|
196
|
+
**Q: Are force pushes allowed?**
|
|
197
|
+
A: Yes. You receive a warning, but the push succeeds. Use with caution.
|
|
198
|
+
|
|
199
|
+
**Q: Can we commit/push directly to `main`?**
|
|
200
|
+
A: Yes. Expect an advisory warning, yet the push continues.
|
|
201
|
+
|
|
202
|
+
**Q: Can I disable the hook entirely?**
|
|
203
|
+
A: Yes. Remove `.git/hooks/pre-push` or strip its execute permission.
|
|
204
|
+
|
|
205
|
+
**Q: Why switch to Advisory Mode?**
|
|
206
|
+
A: To promote best practices while respecting contributor flexibility and judgment.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Policy Change Log
|
|
211
|
+
|
|
212
|
+
| Date | Change | Owner |
|
|
213
|
+
|------|------|--------|
|
|
214
|
+
| 2025-10-17 | Initial policy drafted (Strict Mode) | git-manager |
|
|
215
|
+
| 2025-10-17 | Switched to Advisory Mode (warnings only) | git-manager |
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
**This policy is advisory—adapt it to fit your project needs.**
|
|
220
|
+
**Reach out to the team lead or release engineer for questions or suggestions.**
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
# SPEC Metadata Structure Guide
|
|
2
|
+
|
|
3
|
+
> **MoAI-ADK SPEC Metadata Standard**
|
|
4
|
+
>
|
|
5
|
+
> Every SPEC document must follow this structure.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 📋 Metadata Overview
|
|
10
|
+
|
|
11
|
+
SPEC metadata contains **7 required fields** and **9 optional fields**.
|
|
12
|
+
|
|
13
|
+
### Full Example
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
---
|
|
17
|
+
# Required Fields (7)
|
|
18
|
+
id: AUTH-001 # Unique SPEC ID
|
|
19
|
+
version: 0.0.1 # Semantic version (v0.0.1 = INITIAL, draft start)
|
|
20
|
+
status: draft # draft|active|completed|deprecated
|
|
21
|
+
created: 2025-09-15 # Creation date (YYYY-MM-DD)
|
|
22
|
+
updated: 2025-09-15 # Last updated (YYYY-MM-DD; initially same as created)
|
|
23
|
+
author: @Goos # Author (single GitHub handle)
|
|
24
|
+
priority: high # low|medium|high|critical
|
|
25
|
+
|
|
26
|
+
# Optional Fields – Classification/Meta
|
|
27
|
+
category: security # feature|bugfix|refactor|security|docs|perf
|
|
28
|
+
labels: # Tags for search and grouping
|
|
29
|
+
- authentication
|
|
30
|
+
- jwt
|
|
31
|
+
|
|
32
|
+
# Optional Fields – Relationships (Dependency Graph)
|
|
33
|
+
depends_on: # SPECs this one depends on (optional)
|
|
34
|
+
- USER-001
|
|
35
|
+
blocks: # SPECs blocked by this one (optional)
|
|
36
|
+
- AUTH-002
|
|
37
|
+
related_specs: # Related SPECs (optional)
|
|
38
|
+
- TOKEN-002
|
|
39
|
+
related_issue: "https://github.com/modu-ai/moai-adk/issues/123"
|
|
40
|
+
|
|
41
|
+
# Optional Fields – Scope/Impact
|
|
42
|
+
scope:
|
|
43
|
+
packages: # Impacted packages
|
|
44
|
+
- src/core/auth
|
|
45
|
+
files: # Key files (optional)
|
|
46
|
+
- auth-service.ts
|
|
47
|
+
- jwt-manager.ts
|
|
48
|
+
---
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Required Fields
|
|
54
|
+
|
|
55
|
+
### 1. `id` – Unique SPEC Identifier
|
|
56
|
+
- **Type**: string
|
|
57
|
+
- **Format**: `<DOMAIN>-<NUMBER>`
|
|
58
|
+
- **Examples**: `AUTH-001`, `INSTALLER-SEC-001`
|
|
59
|
+
- **Rules**:
|
|
60
|
+
- Immutable once assigned
|
|
61
|
+
- Use three digits (001–999)
|
|
62
|
+
- Domain in uppercase; hyphens allowed
|
|
63
|
+
- Directory name: `.moai/specs/SPEC-{ID}/` (e.g., `.moai/specs/SPEC-AUTH-001/`)
|
|
64
|
+
|
|
65
|
+
### 2. `version` – Semantic Version
|
|
66
|
+
- **Type**: string (`MAJOR.MINOR.PATCH`)
|
|
67
|
+
- **Default**: `0.0.1` (all SPECs start here, status: draft)
|
|
68
|
+
- **Version Lifecycle**:
|
|
69
|
+
- **v0.0.1**: INITIAL – SPEC first draft (status: draft)
|
|
70
|
+
- **v0.0.x**: Draft refinements (increment PATCH when editing the SPEC)
|
|
71
|
+
- **v0.1.0**: TDD implementation complete (status: completed, updated via `/alfred:3-sync`)
|
|
72
|
+
- **v0.1.x**: Bug fixes or doc improvements (PATCH increment)
|
|
73
|
+
- **v0.x.0**: Feature additions or major enhancements (MINOR increment)
|
|
74
|
+
- **v1.0.0**: Stable release (production ready, explicit stakeholder approval required)
|
|
75
|
+
|
|
76
|
+
### 3. `status` – Progress State
|
|
77
|
+
- **Type**: enum
|
|
78
|
+
- **Values**:
|
|
79
|
+
- `draft`: Authoring in progress
|
|
80
|
+
- `active`: Implementation underway
|
|
81
|
+
- `completed`: Implementation finished
|
|
82
|
+
- `deprecated`: Planned for retirement
|
|
83
|
+
|
|
84
|
+
### 4. `created` – Creation Date
|
|
85
|
+
- **Type**: date string
|
|
86
|
+
- **Format**: `YYYY-MM-DD`
|
|
87
|
+
- **Example**: `2025-10-06`
|
|
88
|
+
|
|
89
|
+
### 5. `updated` – Last Modified Date
|
|
90
|
+
- **Type**: date string
|
|
91
|
+
- **Format**: `YYYY-MM-DD`
|
|
92
|
+
- **Rule**: Update whenever the SPEC content changes.
|
|
93
|
+
|
|
94
|
+
### 6. `author` – Primary Author
|
|
95
|
+
- **Type**: string
|
|
96
|
+
- **Format**: `@{GitHub ID}`
|
|
97
|
+
- **Example**: `@Goos`
|
|
98
|
+
- **Rules**:
|
|
99
|
+
- Single value only (no `authors` array)
|
|
100
|
+
- Prefix the GitHub handle with `@`
|
|
101
|
+
- Additional contributors belong in the HISTORY section
|
|
102
|
+
|
|
103
|
+
### 7. `priority` – Work Priority
|
|
104
|
+
- **Type**: enum
|
|
105
|
+
- **Values**:
|
|
106
|
+
- `critical`: Immediate attention (security, severe defects)
|
|
107
|
+
- `high`: Major feature work
|
|
108
|
+
- `medium`: Enhancements
|
|
109
|
+
- `low`: Optimizations or documentation
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Optional Fields
|
|
114
|
+
|
|
115
|
+
### Classification / Meta
|
|
116
|
+
|
|
117
|
+
#### 8. `category` – Change Type
|
|
118
|
+
- **Type**: enum
|
|
119
|
+
- **Values**:
|
|
120
|
+
- `feature`: New functionality
|
|
121
|
+
- `bugfix`: Defect resolution
|
|
122
|
+
- `refactor`: Structural improvements
|
|
123
|
+
- `security`: Security enhancements
|
|
124
|
+
- `docs`: Documentation updates
|
|
125
|
+
- `perf`: Performance optimizations
|
|
126
|
+
|
|
127
|
+
#### 9. `labels` – Classification Tags
|
|
128
|
+
- **Type**: array of strings
|
|
129
|
+
- **Purpose**: Search, filtering, grouping
|
|
130
|
+
- **Example**:
|
|
131
|
+
```yaml
|
|
132
|
+
labels:
|
|
133
|
+
- installer
|
|
134
|
+
- template
|
|
135
|
+
- security
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Relationship Fields (Dependency Graph)
|
|
139
|
+
|
|
140
|
+
#### 10. `depends_on` – Required SPECs
|
|
141
|
+
- **Type**: array of strings
|
|
142
|
+
- **Meaning**: SPECs that must be completed first
|
|
143
|
+
- **Example**:
|
|
144
|
+
```yaml
|
|
145
|
+
depends_on:
|
|
146
|
+
- USER-001
|
|
147
|
+
- AUTH-001
|
|
148
|
+
```
|
|
149
|
+
- **Use Case**: Determines execution order and parallelization.
|
|
150
|
+
|
|
151
|
+
#### 11. `blocks` – Blocked SPECs
|
|
152
|
+
- **Type**: array of strings
|
|
153
|
+
- **Meaning**: SPECs that cannot proceed until this one is resolved
|
|
154
|
+
- **Example**:
|
|
155
|
+
```yaml
|
|
156
|
+
blocks:
|
|
157
|
+
- PAYMENT-003
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### 12. `related_specs` – Associated SPECs
|
|
161
|
+
- **Type**: array of strings
|
|
162
|
+
- **Meaning**: Related items without direct dependencies
|
|
163
|
+
- **Example**:
|
|
164
|
+
```yaml
|
|
165
|
+
related_specs:
|
|
166
|
+
- TOKEN-002
|
|
167
|
+
- SESSION-001
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### 13. `related_issue` – Linked GitHub Issue
|
|
171
|
+
- **Type**: string (URL)
|
|
172
|
+
- **Format**: Full GitHub issue URL
|
|
173
|
+
- **Example**:
|
|
174
|
+
```yaml
|
|
175
|
+
related_issue: "https://github.com/modu-ai/moai-adk/issues/123"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Scope Fields (Impact Analysis)
|
|
179
|
+
|
|
180
|
+
#### 14. `scope.packages` – Impacted Packages
|
|
181
|
+
- **Type**: array of strings
|
|
182
|
+
- **Meaning**: Packages or modules touched by the SPEC
|
|
183
|
+
- **Example**:
|
|
184
|
+
```yaml
|
|
185
|
+
scope:
|
|
186
|
+
packages:
|
|
187
|
+
- moai-adk-ts/src/core/installer
|
|
188
|
+
- moai-adk-ts/src/core/git
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### 15. `scope.files` – Key Files
|
|
192
|
+
- **Type**: array of strings
|
|
193
|
+
- **Meaning**: Primary files involved (for reference)
|
|
194
|
+
- **Example**:
|
|
195
|
+
```yaml
|
|
196
|
+
scope:
|
|
197
|
+
files:
|
|
198
|
+
- template-processor.ts
|
|
199
|
+
- template-security.ts
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Metadata Validation
|
|
205
|
+
|
|
206
|
+
### Required Field Checks
|
|
207
|
+
```bash
|
|
208
|
+
# Verify that every SPEC includes the required fields
|
|
209
|
+
rg "^(id|version|status|created|updated|author|priority):" .moai/specs/SPEC-*/spec.md
|
|
210
|
+
|
|
211
|
+
# Identify SPECs missing the priority field
|
|
212
|
+
rg -L "^priority:" .moai/specs/SPEC-*/spec.md
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Format Checks
|
|
216
|
+
```bash
|
|
217
|
+
# Ensure the author field uses @Handle format
|
|
218
|
+
rg "^author: @[A-Z]" .moai/specs/SPEC-*/spec.md
|
|
219
|
+
|
|
220
|
+
# Ensure the version field follows 0.x.y
|
|
221
|
+
rg "^version: 0\.\d+\.\d+" .moai/specs/SPEC-*/spec.md
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Migration Guide
|
|
227
|
+
|
|
228
|
+
### Updating Existing SPECs
|
|
229
|
+
|
|
230
|
+
#### 1. Add the `priority` Field
|
|
231
|
+
Add it if missing:
|
|
232
|
+
```yaml
|
|
233
|
+
priority: medium # or low|high|critical
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### 2. Normalize the `author` Field
|
|
237
|
+
- `authors: ["@goos"]` → `author: @Goos`
|
|
238
|
+
- Convert lowercase handles to the canonical casing.
|
|
239
|
+
|
|
240
|
+
#### 3. Add Optional Fields (Recommended)
|
|
241
|
+
```yaml
|
|
242
|
+
category: refactor
|
|
243
|
+
labels:
|
|
244
|
+
- code-quality
|
|
245
|
+
- maintenance
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Updating config.json for Language Support (v0.4.2+)
|
|
249
|
+
|
|
250
|
+
**Background**: MoAI-ADK v0.4.2 introduces conversation language selection in `/alfred:0-project`. Existing projects need to add language metadata to `.moai/config.json`.
|
|
251
|
+
|
|
252
|
+
#### Migration Steps
|
|
253
|
+
|
|
254
|
+
**For Existing Projects** (before v0.4.2):
|
|
255
|
+
|
|
256
|
+
Current config.json structure:
|
|
257
|
+
```json
|
|
258
|
+
{
|
|
259
|
+
"project": {
|
|
260
|
+
"locale": "en",
|
|
261
|
+
"mode": "personal",
|
|
262
|
+
"language": "python"
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Updated Structure** (v0.4.2+):
|
|
268
|
+
```json
|
|
269
|
+
{
|
|
270
|
+
"project": {
|
|
271
|
+
"locale": "en",
|
|
272
|
+
"mode": "personal",
|
|
273
|
+
"language": "python",
|
|
274
|
+
"conversation_language": "en",
|
|
275
|
+
"conversation_language_name": "English",
|
|
276
|
+
"codebase_languages": ["python"]
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
#### New Fields
|
|
282
|
+
|
|
283
|
+
| Field | Type | Required | Description | Example |
|
|
284
|
+
|-------|------|----------|-------------|---------|
|
|
285
|
+
| `conversation_language` | string (ISO 639-1 code) | ✅ Yes | Two-letter language code for Alfred dialogs | `"ko"`, `"en"`, `"ja"`, `"zh"` |
|
|
286
|
+
| `conversation_language_name` | string | ✅ Yes | Display name of conversation language | `"Korean"`, `"English"` |
|
|
287
|
+
| `codebase_languages` | array of strings | ✅ Yes | List of programming languages detected | `["python"]`, `["typescript", "python"]` |
|
|
288
|
+
|
|
289
|
+
#### Manual Update Process
|
|
290
|
+
|
|
291
|
+
1. Open `.moai/config.json`
|
|
292
|
+
2. Add the three new fields under `project`:
|
|
293
|
+
```json
|
|
294
|
+
"conversation_language": "en",
|
|
295
|
+
"conversation_language_name": "English",
|
|
296
|
+
"codebase_languages": ["python"]
|
|
297
|
+
```
|
|
298
|
+
3. Save and commit:
|
|
299
|
+
```bash
|
|
300
|
+
git add .moai/config.json
|
|
301
|
+
git commit -m "chore: add language metadata to config.json for v0.4.2+"
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
#### Automated Update (via `/alfred:0-project`)
|
|
305
|
+
|
|
306
|
+
Running `/alfred:0-project` on an existing project will:
|
|
307
|
+
1. Detect current language settings
|
|
308
|
+
2. Add new fields automatically
|
|
309
|
+
3. Preserve existing values
|
|
310
|
+
|
|
311
|
+
**No manual action required if running `/alfred:0-project` after upgrade.**
|
|
312
|
+
|
|
313
|
+
#### Field Mapping (Legacy → New)
|
|
314
|
+
|
|
315
|
+
| Old Field | New Field | Migration Rule |
|
|
316
|
+
|-----------|-----------|-----------------|
|
|
317
|
+
| `locale` | `conversation_language` | Keep as-is (or run `/alfred:0-project` to re-select) |
|
|
318
|
+
| (none) | `conversation_language_name` | Auto-populate from locale mapping |
|
|
319
|
+
| `language` | `codebase_languages` | Wrap in array: `"python"` → `["python"]` |
|
|
320
|
+
|
|
321
|
+
#### Backward Compatibility
|
|
322
|
+
|
|
323
|
+
- ✅ Projects without new fields will continue working
|
|
324
|
+
- ⚠️ New language features (multilingual documentation) unavailable without migration
|
|
325
|
+
- ✅ `/alfred:0-project` automatically migrates on next run
|
|
326
|
+
- ✅ Auto-detection will prefer new fields if present
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## Design Principles
|
|
331
|
+
|
|
332
|
+
### 1. DRY (Don't Repeat Yourself)
|
|
333
|
+
- ❌ **Remove**: the `reference` field (every SPEC referenced the same master plan)
|
|
334
|
+
- ✅ **Instead**: document project-level resources in README.md
|
|
335
|
+
|
|
336
|
+
### 2. Context-Aware
|
|
337
|
+
- Include only the necessary context.
|
|
338
|
+
- Use optional fields only when they add value.
|
|
339
|
+
|
|
340
|
+
### 3. Traceable
|
|
341
|
+
- Use `depends_on`, `blocks`, and `related_specs` to map dependencies.
|
|
342
|
+
- Automated tooling can detect cyclic references.
|
|
343
|
+
|
|
344
|
+
### 4. Maintainable
|
|
345
|
+
- Every field must be machine-verifiable.
|
|
346
|
+
- Maintain consistent formatting for easy parsing.
|
|
347
|
+
|
|
348
|
+
### 5. Simple First
|
|
349
|
+
- Keep complexity low.
|
|
350
|
+
- Limit to 7 required + 9 optional fields.
|
|
351
|
+
- Expand gradually when justified.
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
**Last Updated**: 2025-10-06
|
|
356
|
+
**Author**: @Alfred
|