@musashishao/agent-kit 1.1.4 → 1.1.6
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 @musashishao/agent-kit might be problematic. Click here for more details.
- package/.agent/plans/codex-cli-integration.md +128 -277
- package/.agent/rules/CODEX.md +250 -0
- package/.agent/skills/app-builder/project-detection.md +1 -1
- package/.agent/skills/context-engineering/scripts/quality_validator.py +294 -0
- package/.agent/skills/context-engineering/scripts/skill_checker.py +194 -0
- package/.agent/templates/AGENTS.backend.md +230 -0
- package/.agent/templates/AGENTS.md +121 -0
- package/.agent/templates/AGENTS.mobile.md +183 -0
- package/.agent/templates/AGENTS.web.md +192 -0
- package/.agent/workflows/create.md +1 -1
- package/.agent/workflows/quality.md +89 -0
- package/.agent/workflows/ui-ux-pro-max.md +19 -0
- package/README.md +172 -44
- package/bin/cli.js +287 -7
- package/package.json +1 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
---
|
|
2
|
+
trigger: always_on
|
|
3
|
+
platform: codex-cli
|
|
4
|
+
priority: P0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# CODEX.md - Codex CLI Optimization Rules
|
|
8
|
+
|
|
9
|
+
> **Agent Kit** - Codex CLI specific rules for maximum output quality.
|
|
10
|
+
> This file extends the universal rules with Codex-specific optimizations.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 🎯 CODEX CLI OPTIMIZATION PROTOCOL
|
|
15
|
+
|
|
16
|
+
### 1. Context Window Management
|
|
17
|
+
|
|
18
|
+
Codex CLI has specific context handling. Optimize by:
|
|
19
|
+
|
|
20
|
+
| Strategy | Implementation |
|
|
21
|
+
|----------|----------------|
|
|
22
|
+
| **Selective Loading** | Only read skills referenced in user request |
|
|
23
|
+
| **Skill Caching** | Once a skill is read, don't re-read in same session |
|
|
24
|
+
| **Minimal Agents** | Load max 3 agents per task |
|
|
25
|
+
| **Token Budget** | Reserve 40% for reasoning, 30% for code output |
|
|
26
|
+
|
|
27
|
+
### 2. Skill Loading Order
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
STEP 1: Check AGENTS.md → Understand kit structure
|
|
31
|
+
STEP 2: Identify task type → Map to skills/agents
|
|
32
|
+
STEP 3: Read skill SKILL.md → Get instructions
|
|
33
|
+
STEP 4: Read only sections needed → Not entire folder
|
|
34
|
+
STEP 5: Execute → Apply skill principles
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 3. Output Quality Standards
|
|
38
|
+
|
|
39
|
+
| Aspect | Requirement |
|
|
40
|
+
|--------|-------------|
|
|
41
|
+
| **Code** | Production-ready, no TODOs, no placeholders |
|
|
42
|
+
| **Comments** | Minimal, only for non-obvious logic |
|
|
43
|
+
| **Types** | Full TypeScript strict types |
|
|
44
|
+
| **Error Handling** | Comprehensive try-catch, proper error messages |
|
|
45
|
+
| **Security** | No hardcoded secrets, proper input validation |
|
|
46
|
+
| **Performance** | Optimized queries, no N+1, lazy loading |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 🧠 TASK CLASSIFICATION
|
|
51
|
+
|
|
52
|
+
Before action, classify the request:
|
|
53
|
+
|
|
54
|
+
| Type | Keywords | Action |
|
|
55
|
+
|------|----------|--------|
|
|
56
|
+
| **QUESTION** | "what is", "how does", "explain" | Text response only |
|
|
57
|
+
| **SIMPLE FIX** | "fix", "update", "change" (single file) | Direct edit |
|
|
58
|
+
| **FEATURE** | "add", "implement", "create" | Use `/create` or `/enhance` workflow |
|
|
59
|
+
| **DEBUG** | "why", "not working", "error" | Use `/debug` workflow |
|
|
60
|
+
| **REVIEW** | "review", "audit", "check" | Use appropriate agent |
|
|
61
|
+
| **DESIGN** | "design", "UI", "page" | Use `/ui-ux-pro-max` workflow |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 🔴 CRITICAL RULES
|
|
66
|
+
|
|
67
|
+
### Rule 1: Read Before Write
|
|
68
|
+
```
|
|
69
|
+
❌ WRONG: Immediately start coding
|
|
70
|
+
✅ CORRECT: Read → Understand → Plan → Code
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Rule 2: Skill-Based Coding
|
|
74
|
+
```
|
|
75
|
+
For each domain, apply corresponding skill:
|
|
76
|
+
- Frontend → Read react-patterns, nextjs-best-practices
|
|
77
|
+
- Backend → Read api-patterns, nodejs-best-practices
|
|
78
|
+
- Database → Read database-design, prisma-expert
|
|
79
|
+
- Security → Read vulnerability-scanner
|
|
80
|
+
- UI/UX → Read ui-ux-pro-max, frontend-design
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Rule 3: Quality Over Speed
|
|
84
|
+
```
|
|
85
|
+
- No placeholder code (e.g., "// TODO: implement")
|
|
86
|
+
- No generic variable names (e.g., "data", "temp")
|
|
87
|
+
- No console.log in production code
|
|
88
|
+
- Always handle edge cases
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Rule 4: Socratic Gate
|
|
92
|
+
For complex/unclear requests, ASK before implementing:
|
|
93
|
+
```
|
|
94
|
+
Before I implement, let me clarify:
|
|
95
|
+
1. [Specific question about scope]
|
|
96
|
+
2. [Specific question about requirements]
|
|
97
|
+
3. [Specific question about constraints]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 📂 SKILL QUICK REFERENCE
|
|
103
|
+
|
|
104
|
+
### Frontend Development
|
|
105
|
+
```
|
|
106
|
+
/read .agent/skills/react-patterns/SKILL.md
|
|
107
|
+
/read .agent/skills/nextjs-best-practices/SKILL.md
|
|
108
|
+
/read .agent/skills/tailwind-patterns/SKILL.md
|
|
109
|
+
/read .agent/skills/frontend-design/SKILL.md
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Backend Development
|
|
113
|
+
```
|
|
114
|
+
/read .agent/skills/api-patterns/SKILL.md
|
|
115
|
+
/read .agent/skills/nodejs-best-practices/SKILL.md
|
|
116
|
+
/read .agent/skills/database-design/SKILL.md
|
|
117
|
+
/read .agent/skills/prisma-expert/SKILL.md
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Security
|
|
121
|
+
```
|
|
122
|
+
/read .agent/skills/vulnerability-scanner/SKILL.md
|
|
123
|
+
/read .agent/skills/red-team-tactics/SKILL.md
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### UI/UX Design
|
|
127
|
+
```
|
|
128
|
+
/read .agent/skills/ui-ux-pro-max/SKILL.md
|
|
129
|
+
/read .agent/skills/mobile-design/SKILL.md
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Debugging
|
|
133
|
+
```
|
|
134
|
+
/read .agent/skills/systematic-debugging/SKILL.md
|
|
135
|
+
/read .agent/skills/problem-solving/SKILL.md
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 🛠️ WORKFLOW TRIGGERS
|
|
141
|
+
|
|
142
|
+
| User Says | Trigger Workflow |
|
|
143
|
+
|-----------|-----------------|
|
|
144
|
+
| "create", "build", "make new" | `/create` |
|
|
145
|
+
| "fix", "debug", "not working" | `/debug` |
|
|
146
|
+
| "plan", "break down", "roadmap" | `/plan` |
|
|
147
|
+
| "design", "UI", "beautiful" | `/ui-ux-pro-max` |
|
|
148
|
+
| "test", "coverage", "unit test" | `/test` |
|
|
149
|
+
| "deploy", "production", "ship" | `/deploy` |
|
|
150
|
+
| "review", "audit", "check" | Use agent directly |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 🎨 OUTPUT FORMATTING
|
|
155
|
+
|
|
156
|
+
### For Code
|
|
157
|
+
```typescript
|
|
158
|
+
// Use proper structure
|
|
159
|
+
interface Example {
|
|
160
|
+
id: string;
|
|
161
|
+
name: string;
|
|
162
|
+
createdAt: Date;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function exampleFunction(param: Example): Result {
|
|
166
|
+
// Implementation with proper error handling
|
|
167
|
+
try {
|
|
168
|
+
// Logic here
|
|
169
|
+
} catch (error) {
|
|
170
|
+
throw new CustomError('Descriptive message', { cause: error });
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### For Explanations
|
|
176
|
+
1. **Be concise** - No unnecessary verbosity
|
|
177
|
+
2. **Use tables** - For comparisons and options
|
|
178
|
+
3. **Use code blocks** - For any code reference
|
|
179
|
+
4. **Use headers** - For organization
|
|
180
|
+
|
|
181
|
+
### For Plans
|
|
182
|
+
```markdown
|
|
183
|
+
## Task: [Name]
|
|
184
|
+
|
|
185
|
+
### Phase 1: [Name]
|
|
186
|
+
- [ ] Task 1.1: Description
|
|
187
|
+
- [ ] Task 1.2: Description
|
|
188
|
+
|
|
189
|
+
### Phase 2: [Name]
|
|
190
|
+
...
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 📊 QUALITY CHECKLIST
|
|
196
|
+
|
|
197
|
+
Before completing any task:
|
|
198
|
+
|
|
199
|
+
| Check | Criteria |
|
|
200
|
+
|-------|----------|
|
|
201
|
+
| ✅ Code compiles | No TypeScript errors |
|
|
202
|
+
| ✅ Clean code | Following skill guidelines |
|
|
203
|
+
| ✅ Security | No vulnerabilities |
|
|
204
|
+
| ✅ Performance | No obvious bottlenecks |
|
|
205
|
+
| ✅ Documentation | Inline comments where needed |
|
|
206
|
+
| ✅ Tests | Unit tests for logic (if applicable) |
|
|
207
|
+
| ✅ Edge cases | Handled null, undefined, errors |
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 🔗 INTEGRATION WITH AGENTS
|
|
212
|
+
|
|
213
|
+
When user mentions an agent (e.g., `@security-auditor`):
|
|
214
|
+
|
|
215
|
+
1. **Read** `.agent/agents/{agent-name}.md`
|
|
216
|
+
2. **Apply** the agent's personality and rules
|
|
217
|
+
3. **Use** the agent's skills (listed in frontmatter)
|
|
218
|
+
4. **Output** in the agent's expected format
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 📝 EXAMPLE USAGE
|
|
223
|
+
|
|
224
|
+
### User Request
|
|
225
|
+
```
|
|
226
|
+
Create a login page with email/password authentication
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Codex Response (Following CODEX.md)
|
|
230
|
+
```
|
|
231
|
+
I'll create a production-ready login page.
|
|
232
|
+
|
|
233
|
+
**Skills Applied:**
|
|
234
|
+
- react-patterns → Component structure
|
|
235
|
+
- nextjs-best-practices → App Router patterns
|
|
236
|
+
- tailwind-patterns → Styling
|
|
237
|
+
- vulnerability-scanner → Auth security
|
|
238
|
+
|
|
239
|
+
**Implementation:**
|
|
240
|
+
[Full code with proper types, error handling, security]
|
|
241
|
+
|
|
242
|
+
**Next Steps:**
|
|
243
|
+
- [ ] Add forgot password flow
|
|
244
|
+
- [ ] Configure email provider
|
|
245
|
+
- [ ] Add rate limiting
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
*Agent Kit - CODEX.md rules for highest quality AI output*
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Agent Kit Quality Validator
|
|
4
|
+
Validates AGENTS.md and .agent folder structure for Codex CLI compatibility.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
python quality_validator.py [path]
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
python quality_validator.py .
|
|
11
|
+
python quality_validator.py /path/to/project
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import sys
|
|
16
|
+
import re
|
|
17
|
+
import json
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
from typing import Dict, List, Tuple
|
|
20
|
+
|
|
21
|
+
# ANSI colors
|
|
22
|
+
class Colors:
|
|
23
|
+
RED = '\033[91m'
|
|
24
|
+
GREEN = '\033[92m'
|
|
25
|
+
YELLOW = '\033[93m'
|
|
26
|
+
BLUE = '\033[94m'
|
|
27
|
+
MAGENTA = '\033[95m'
|
|
28
|
+
CYAN = '\033[96m'
|
|
29
|
+
RESET = '\033[0m'
|
|
30
|
+
BOLD = '\033[1m'
|
|
31
|
+
|
|
32
|
+
def print_header(msg: str):
|
|
33
|
+
print(f"\n{Colors.BOLD}{Colors.MAGENTA}{msg}{Colors.RESET}\n")
|
|
34
|
+
|
|
35
|
+
def print_check(name: str, passed: bool, message: str = ""):
|
|
36
|
+
status = f"{Colors.GREEN}✓{Colors.RESET}" if passed else f"{Colors.RED}✗{Colors.RESET}"
|
|
37
|
+
msg_color = Colors.GREEN if passed else Colors.RED
|
|
38
|
+
print(f" {status} {Colors.CYAN}{name}{Colors.RESET}: {msg_color}{message}{Colors.RESET}")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class AgentKitValidator:
|
|
42
|
+
def __init__(self, project_path: str):
|
|
43
|
+
self.project_path = Path(project_path).resolve()
|
|
44
|
+
self.agent_dir = self.project_path / ".agent"
|
|
45
|
+
self.agents_md = self.project_path / "AGENTS.md"
|
|
46
|
+
self.results: List[Tuple[str, bool, str]] = []
|
|
47
|
+
|
|
48
|
+
def validate_all(self) -> Dict:
|
|
49
|
+
"""Run all validations and return summary"""
|
|
50
|
+
print_header("🔍 Agent Kit Quality Validator")
|
|
51
|
+
print(f"Project: {self.project_path}\n")
|
|
52
|
+
|
|
53
|
+
checks = [
|
|
54
|
+
self.check_agents_md_exists,
|
|
55
|
+
self.check_agent_folder_structure,
|
|
56
|
+
self.check_agents_format,
|
|
57
|
+
self.check_skills_format,
|
|
58
|
+
self.check_workflows_format,
|
|
59
|
+
self.check_codex_compatibility,
|
|
60
|
+
self.check_skill_loading_protocol,
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
for check in checks:
|
|
64
|
+
check()
|
|
65
|
+
|
|
66
|
+
return self.summarize()
|
|
67
|
+
|
|
68
|
+
def check_agents_md_exists(self):
|
|
69
|
+
"""Check if AGENTS.md exists at project root"""
|
|
70
|
+
print_header("📄 AGENTS.md Validation")
|
|
71
|
+
|
|
72
|
+
if self.agents_md.exists():
|
|
73
|
+
content = self.agents_md.read_text()
|
|
74
|
+
|
|
75
|
+
# Check required sections
|
|
76
|
+
required_sections = [
|
|
77
|
+
("Project Overview", r"##.*Overview"),
|
|
78
|
+
("Setup Commands", r"##.*Setup"),
|
|
79
|
+
("Code Style", r"##.*Code Style|##.*Standards"),
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
for name, pattern in required_sections:
|
|
83
|
+
found = bool(re.search(pattern, content, re.IGNORECASE))
|
|
84
|
+
self.results.append((f"AGENTS.md: {name}", found, "Found" if found else "Missing"))
|
|
85
|
+
print_check(f"Section: {name}", found, "Found" if found else "Missing")
|
|
86
|
+
|
|
87
|
+
# Check for loading protocol
|
|
88
|
+
has_protocol = "workflow" in content.lower() and "skill" in content.lower()
|
|
89
|
+
self.results.append(("Loading Protocol", has_protocol, "Found" if has_protocol else "Missing"))
|
|
90
|
+
print_check("Loading Protocol", has_protocol, "Found" if has_protocol else "Should document how to use skills/workflows")
|
|
91
|
+
|
|
92
|
+
else:
|
|
93
|
+
self.results.append(("AGENTS.md exists", False, "Not found"))
|
|
94
|
+
print_check("AGENTS.md", False, f"Not found at {self.agents_md}")
|
|
95
|
+
|
|
96
|
+
def check_agent_folder_structure(self):
|
|
97
|
+
"""Check .agent folder structure"""
|
|
98
|
+
print_header("📁 Folder Structure Validation")
|
|
99
|
+
|
|
100
|
+
required_dirs = ["agents", "skills", "workflows"]
|
|
101
|
+
optional_dirs = ["rules", "templates", "plans"]
|
|
102
|
+
|
|
103
|
+
for dir_name in required_dirs:
|
|
104
|
+
dir_path = self.agent_dir / dir_name
|
|
105
|
+
exists = dir_path.exists()
|
|
106
|
+
count = len(list(dir_path.iterdir())) if exists else 0
|
|
107
|
+
self.results.append((f".agent/{dir_name}", exists, f"{count} items" if exists else "Missing"))
|
|
108
|
+
print_check(f".agent/{dir_name}/", exists, f"{count} items" if exists else "Missing (required)")
|
|
109
|
+
|
|
110
|
+
for dir_name in optional_dirs:
|
|
111
|
+
dir_path = self.agent_dir / dir_name
|
|
112
|
+
exists = dir_path.exists()
|
|
113
|
+
count = len(list(dir_path.iterdir())) if exists else 0
|
|
114
|
+
if exists:
|
|
115
|
+
print_check(f".agent/{dir_name}/", True, f"{count} items (optional)")
|
|
116
|
+
|
|
117
|
+
def check_agents_format(self):
|
|
118
|
+
"""Check agent file format"""
|
|
119
|
+
print_header("🤖 Agent Files Validation")
|
|
120
|
+
|
|
121
|
+
agents_dir = self.agent_dir / "agents"
|
|
122
|
+
if not agents_dir.exists():
|
|
123
|
+
return
|
|
124
|
+
|
|
125
|
+
for agent_file in agents_dir.glob("*.md"):
|
|
126
|
+
content = agent_file.read_text()
|
|
127
|
+
|
|
128
|
+
# Check frontmatter
|
|
129
|
+
has_frontmatter = content.startswith("---")
|
|
130
|
+
has_name = bool(re.search(r"^name:\s*.+", content, re.MULTILINE))
|
|
131
|
+
has_description = bool(re.search(r"^description:\s*.+", content, re.MULTILINE))
|
|
132
|
+
|
|
133
|
+
is_valid = has_frontmatter and has_name and has_description
|
|
134
|
+
issues = []
|
|
135
|
+
if not has_frontmatter:
|
|
136
|
+
issues.append("missing frontmatter")
|
|
137
|
+
if not has_name:
|
|
138
|
+
issues.append("missing name")
|
|
139
|
+
if not has_description:
|
|
140
|
+
issues.append("missing description")
|
|
141
|
+
|
|
142
|
+
message = "Valid" if is_valid else f"Issues: {', '.join(issues)}"
|
|
143
|
+
self.results.append((f"Agent: {agent_file.name}", is_valid, message))
|
|
144
|
+
print_check(agent_file.name, is_valid, message)
|
|
145
|
+
|
|
146
|
+
def check_skills_format(self):
|
|
147
|
+
"""Check skill file format"""
|
|
148
|
+
print_header("🧠 Skills Validation")
|
|
149
|
+
|
|
150
|
+
skills_dir = self.agent_dir / "skills"
|
|
151
|
+
if not skills_dir.exists():
|
|
152
|
+
return
|
|
153
|
+
|
|
154
|
+
valid_count = 0
|
|
155
|
+
total_count = 0
|
|
156
|
+
|
|
157
|
+
for skill_dir in skills_dir.iterdir():
|
|
158
|
+
if not skill_dir.is_dir():
|
|
159
|
+
continue
|
|
160
|
+
|
|
161
|
+
total_count += 1
|
|
162
|
+
skill_md = skill_dir / "SKILL.md"
|
|
163
|
+
|
|
164
|
+
if skill_md.exists():
|
|
165
|
+
content = skill_md.read_text()
|
|
166
|
+
has_frontmatter = content.startswith("---")
|
|
167
|
+
has_description = bool(re.search(r"^description:\s*.+", content, re.MULTILINE))
|
|
168
|
+
|
|
169
|
+
if has_frontmatter and has_description:
|
|
170
|
+
valid_count += 1
|
|
171
|
+
|
|
172
|
+
is_valid = valid_count == total_count
|
|
173
|
+
message = f"{valid_count}/{total_count} skills have valid SKILL.md"
|
|
174
|
+
self.results.append(("Skills Format", is_valid, message))
|
|
175
|
+
print_check("Skills Format", is_valid, message)
|
|
176
|
+
|
|
177
|
+
def check_workflows_format(self):
|
|
178
|
+
"""Check workflow file format"""
|
|
179
|
+
print_header("⚡ Workflows Validation")
|
|
180
|
+
|
|
181
|
+
workflows_dir = self.agent_dir / "workflows"
|
|
182
|
+
if not workflows_dir.exists():
|
|
183
|
+
return
|
|
184
|
+
|
|
185
|
+
valid_count = 0
|
|
186
|
+
total_count = 0
|
|
187
|
+
|
|
188
|
+
for wf_file in workflows_dir.glob("*.md"):
|
|
189
|
+
total_count += 1
|
|
190
|
+
content = wf_file.read_text()
|
|
191
|
+
|
|
192
|
+
has_frontmatter = content.startswith("---")
|
|
193
|
+
has_description = bool(re.search(r"^description:\s*.+", content, re.MULTILINE))
|
|
194
|
+
|
|
195
|
+
if has_frontmatter and has_description:
|
|
196
|
+
valid_count += 1
|
|
197
|
+
else:
|
|
198
|
+
print_check(wf_file.name, False, "Missing frontmatter or description")
|
|
199
|
+
|
|
200
|
+
is_valid = valid_count == total_count
|
|
201
|
+
message = f"{valid_count}/{total_count} workflows are valid"
|
|
202
|
+
self.results.append(("Workflows Format", is_valid, message))
|
|
203
|
+
print_check("Overall", is_valid, message)
|
|
204
|
+
|
|
205
|
+
def check_codex_compatibility(self):
|
|
206
|
+
"""Check Codex CLI specific requirements"""
|
|
207
|
+
print_header("🔗 Codex CLI Compatibility")
|
|
208
|
+
|
|
209
|
+
checks = []
|
|
210
|
+
|
|
211
|
+
# Check 1: AGENTS.md in root
|
|
212
|
+
checks.append(("AGENTS.md in root", self.agents_md.exists()))
|
|
213
|
+
|
|
214
|
+
# Check 2: .codex folder (optional)
|
|
215
|
+
codex_dir = self.project_path / ".codex"
|
|
216
|
+
checks.append((".codex config (optional)", codex_dir.exists()))
|
|
217
|
+
|
|
218
|
+
# Check 3: CODEX.md rules
|
|
219
|
+
codex_rules = self.agent_dir / "rules" / "CODEX.md"
|
|
220
|
+
checks.append(("CODEX.md rules", codex_rules.exists()))
|
|
221
|
+
|
|
222
|
+
for name, passed in checks:
|
|
223
|
+
message = "Found" if passed else "Missing"
|
|
224
|
+
self.results.append((name, passed, message))
|
|
225
|
+
print_check(name, passed, message)
|
|
226
|
+
|
|
227
|
+
def check_skill_loading_protocol(self):
|
|
228
|
+
"""Check if AGENTS.md has proper skill loading protocol"""
|
|
229
|
+
print_header("📖 Skill Loading Protocol")
|
|
230
|
+
|
|
231
|
+
if not self.agents_md.exists():
|
|
232
|
+
print_check("Protocol Check", False, "AGENTS.md not found")
|
|
233
|
+
return
|
|
234
|
+
|
|
235
|
+
content = self.agents_md.read_text().lower()
|
|
236
|
+
|
|
237
|
+
protocols = [
|
|
238
|
+
("Skill reference", ".agent/skills" in content),
|
|
239
|
+
("Workflow reference", ".agent/workflows" in content),
|
|
240
|
+
("Agent reference", ".agent/agents" in content),
|
|
241
|
+
("Loading order", "loading" in content or "protocol" in content),
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
for name, passed in protocols:
|
|
245
|
+
message = "Documented" if passed else "Should be documented"
|
|
246
|
+
self.results.append((name, passed, message))
|
|
247
|
+
print_check(name, passed, message)
|
|
248
|
+
|
|
249
|
+
def summarize(self) -> Dict:
|
|
250
|
+
"""Print summary and return results"""
|
|
251
|
+
print_header("📊 Summary")
|
|
252
|
+
|
|
253
|
+
passed = sum(1 for _, p, _ in self.results if p)
|
|
254
|
+
total = len(self.results)
|
|
255
|
+
percentage = (passed / total * 100) if total > 0 else 0
|
|
256
|
+
|
|
257
|
+
color = Colors.GREEN if percentage >= 80 else Colors.YELLOW if percentage >= 60 else Colors.RED
|
|
258
|
+
|
|
259
|
+
print(f" {color}Passed: {passed}/{total} ({percentage:.0f}%){Colors.RESET}")
|
|
260
|
+
|
|
261
|
+
if percentage >= 90:
|
|
262
|
+
print(f"\n {Colors.GREEN}✓ Excellent! Agent Kit is fully configured for Codex CLI.{Colors.RESET}")
|
|
263
|
+
elif percentage >= 70:
|
|
264
|
+
print(f"\n {Colors.YELLOW}⚠ Good, but some improvements recommended.{Colors.RESET}")
|
|
265
|
+
else:
|
|
266
|
+
print(f"\n {Colors.RED}✗ Several issues found. Please review the checks above.{Colors.RESET}")
|
|
267
|
+
|
|
268
|
+
# Show failed checks
|
|
269
|
+
failed = [(n, m) for n, p, m in self.results if not p]
|
|
270
|
+
if failed:
|
|
271
|
+
print(f"\n {Colors.BOLD}Issues to fix:{Colors.RESET}")
|
|
272
|
+
for name, message in failed[:5]: # Show top 5
|
|
273
|
+
print(f" - {name}: {message}")
|
|
274
|
+
|
|
275
|
+
return {
|
|
276
|
+
"passed": passed,
|
|
277
|
+
"total": total,
|
|
278
|
+
"percentage": percentage,
|
|
279
|
+
"results": self.results
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def main():
|
|
284
|
+
project_path = sys.argv[1] if len(sys.argv) > 1 else "."
|
|
285
|
+
|
|
286
|
+
validator = AgentKitValidator(project_path)
|
|
287
|
+
results = validator.validate_all()
|
|
288
|
+
|
|
289
|
+
# Exit with error code if less than 70% passed
|
|
290
|
+
sys.exit(0 if results["percentage"] >= 70 else 1)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
if __name__ == "__main__":
|
|
294
|
+
main()
|