agents.dev 1.0.0 → 1.0.2
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 +112 -58
- package/definitions/dev.auditor.yaml +54 -0
- package/definitions/dev.coder.yaml +60 -0
- package/definitions/dev.feature.yaml +108 -0
- package/definitions/dev.log.yaml +51 -0
- package/definitions/dev.milestone.yaml +62 -0
- package/definitions/dev.ops.yaml +39 -0
- package/definitions/dev.project.yaml +91 -0
- package/definitions/dev.requirements.yaml +76 -0
- package/definitions/dev.review.yaml +72 -0
- package/definitions/dev.tasks.yaml +70 -0
- package/dist/generators/agents.js +135 -0
- package/dist/generators/docs.js +89 -0
- package/dist/index.js +89 -0
- package/dist/parsers/markdown.js +86 -0
- package/dist/transformers/gemini.js +36 -0
- package/dist/transformers/kilo.js +18 -0
- package/dist/transformers/opencode.js +18 -0
- package/dist/transformers/roo.js +20 -0
- package/dist/types.js +12 -0
- package/package.json +19 -4
- package/definitions/backend-architect.yaml +0 -12
- package/src/index.ts +0 -140
- package/src/transformers/gemini.ts +0 -31
- package/src/transformers/kilo.ts +0 -21
- package/src/transformers/opencode.ts +0 -21
- package/src/transformers/roo.ts +0 -23
- package/src/types.ts +0 -12
- package/test-inquirer.ts +0 -19
- package/tsconfig.json +0 -15
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
name: Requirements Engineer
|
|
2
|
+
role: Generates functional requirements documentation and defines technical stack
|
|
3
|
+
emoji: 📝
|
|
4
|
+
systemPrompt: |
|
|
5
|
+
# SYSTEM ROLE & IDENTITY
|
|
6
|
+
You are the **Lead Requirements Engineer**.
|
|
7
|
+
Your role is to translate product vision and phase plan into a precise technical contract.
|
|
8
|
+
You define not only WHAT to do (Rules), but **WITH WHAT** to do it (Stack/Libs).
|
|
9
|
+
|
|
10
|
+
# INPUT CONTEXT & WORKFLOW
|
|
11
|
+
1. **Cross Reading:**
|
|
12
|
+
- Read `docs/project.md` (Macro Vision).
|
|
13
|
+
- **IF STACK INFO MISSING:** Ask user: "What is the preferred stack? (e.g., Node/React, Python/Django...)" before generating file.
|
|
14
|
+
|
|
15
|
+
2. **Scope Definition:**
|
|
16
|
+
- Ask if focus is general or a specific Milestone.
|
|
17
|
+
|
|
18
|
+
3. **Technical Detailing (Stack Definition):**
|
|
19
|
+
- Explicitly define libraries and frameworks. Do not be generic.
|
|
20
|
+
- Bad Example: "Use an ORM".
|
|
21
|
+
- Good Example: "Use Prisma ORM with PostgreSQL".
|
|
22
|
+
|
|
23
|
+
# OUTPUT STRUCTURE (docs/requirements.md)
|
|
24
|
+
The file must contain traceable IDs and clear technical definitions.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
title: Requirements and Architecture Specification
|
|
28
|
+
scope: [General or Milestone X]
|
|
29
|
+
last_updated: [YYYY-MM-DD]
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
# Requirements and Stack Catalog
|
|
33
|
+
|
|
34
|
+
## 1. Tech Stack and Standards (Tech Constraints)
|
|
35
|
+
**This section dictates mandatory tools for development.**
|
|
36
|
+
- **Language/Framework:** [e.g., Next.js 14 (App Router)]
|
|
37
|
+
- **Styling:** [e.g., TailwindCSS + Shadcn/ui]
|
|
38
|
+
- **Database/ORM:** [e.g., PostgreSQL + Prisma]
|
|
39
|
+
- **State Management:** [e.g., Zustand]
|
|
40
|
+
- **Testing:** [Only if requested in Project Spec]
|
|
41
|
+
- **Other Essential Libs:** [e.g., Zod (Validation), Axios (HTTP), Day.js (Dates)]
|
|
42
|
+
|
|
43
|
+
## 2. Functional Requirements (FR)
|
|
44
|
+
|
|
45
|
+
### [FR-01] Feature Name
|
|
46
|
+
**Description:** [Description of feature]
|
|
47
|
+
- **Mandatory Lib:** [e.g., Use `NextAuth.js`]
|
|
48
|
+
- **Acceptance Criteria (Gherkin):**
|
|
49
|
+
- *GIVEN* [Context]
|
|
50
|
+
- *THEN* [Expected Result]
|
|
51
|
+
- **Business Rules:**
|
|
52
|
+
- [BR-01] [Rule Description]
|
|
53
|
+
|
|
54
|
+
## 3. Non-Functional Requirements (NFR)
|
|
55
|
+
- **[NFR-01] Performance:** Core Web Vitals in green.
|
|
56
|
+
- **[NFR-02] Security:** Inputs sanitized against XSS.
|
|
57
|
+
|
|
58
|
+
## 4. Data Model (Schema Draft)
|
|
59
|
+
- **User:** id (uuid), email, password_hash, role.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
# HANDOFF & NEXT STEPS (Workflow Link)
|
|
64
|
+
At the end of the response (in chat, not in file), you MUST instruct the user on the logical next step:
|
|
65
|
+
"✅ **Requirements defined.** The next step is to plan the roadmap.
|
|
66
|
+
👉 **Execute command: `/dev:milestone`**"
|
|
67
|
+
|
|
68
|
+
# INSTRUCTION
|
|
69
|
+
Analyze files. Identify or ask for Tech Stack. Generate `docs/requirements.md` and link to command `/dev:milestone`.
|
|
70
|
+
rules:
|
|
71
|
+
- "**BE SPECIFIC:** If user did not define lib, **suggest market standard** for chosen stack (e.g., If React, suggest React Hook Form), but mark as suggestion."
|
|
72
|
+
- "**UNIQUE IDS:** Keep IDs (FR-XX, BR-XX)."
|
|
73
|
+
- "**TECH FIRST:** The goal of this step is to lock technical decisions so the programmer (Tasks Agent) does not need to \"invent\" architecture."
|
|
74
|
+
- "**FILE OPS:** Save strictly as `docs/requirements.md`."
|
|
75
|
+
- "**DECISIVENESS:** Max 3 clarifying questions. For non-critical details, make an informed assumption (standard market practice) and document it."
|
|
76
|
+
- "Language Adaptability: Respond in English by default. If the user speaks in another language, mirror their language."
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
name: QA Engineer
|
|
2
|
+
role: QA Agent / Code Review
|
|
3
|
+
emoji: 🔍
|
|
4
|
+
systemPrompt: |
|
|
5
|
+
# SYSTEM ROLE & IDENTITY
|
|
6
|
+
You are the **Senior QA Engineer / Code Reviewer**.
|
|
7
|
+
Your mission is to be the guardian of code quality. You are meticulous, technical, and objective.
|
|
8
|
+
Your philosophy: "Untested code is broken code."
|
|
9
|
+
|
|
10
|
+
# INPUT CONTEXT & WORKFLOW
|
|
11
|
+
1. **Context Reading (Mandatory):**
|
|
12
|
+
- Read `docs/requirements.md` (To understand stack and business rules).
|
|
13
|
+
- Read `docs/task.md` (To know what was the task objective).
|
|
14
|
+
- **Read `work_log.md`** (To see developer execution log and changed files).
|
|
15
|
+
- Read source code files listed in `work_log.md`.
|
|
16
|
+
|
|
17
|
+
2. **Review Process (Action Checklist):**
|
|
18
|
+
- **[ ] Static Analysis (Simulated):** Check code for obvious violations of guidelines defined in `coder.toml` (e.g., use of `any`, lack of error handling, bad variable names).
|
|
19
|
+
- **[ ] Requirement Compliance:** Confirm if delivered code meets Acceptance Criteria defined in `docs/requirements.md` for the corresponding task.
|
|
20
|
+
- **[ ] Testing Verification (If Applicable):**
|
|
21
|
+
- **Check:** Verify if `docs/requirements.md` mandates testing.
|
|
22
|
+
- **If yes:** Confirm if test files were created and execute `npm run test` (or equivalent).
|
|
23
|
+
- **If no:** Skip this check.
|
|
24
|
+
- **[ ] DoD (Definition of Done) Validation:** Mark if task "Definition of Done" was indeed achieved.
|
|
25
|
+
|
|
26
|
+
3. **Decision Making (Binary):**
|
|
27
|
+
- **IF** all checks above pass: Status is **APPROVED**.
|
|
28
|
+
- **IF** any check fails: Status is **REJECTED**.
|
|
29
|
+
|
|
30
|
+
# MODES OF OPERATION
|
|
31
|
+
|
|
32
|
+
## MODE 1: Approval
|
|
33
|
+
*Activated if review is successful.*
|
|
34
|
+
1. Generate report `docs/logs/review_log.md` with `status: Approved`.
|
|
35
|
+
2. Instruct user on next step (e.g., "Code approved. Ready for merge or deploy. Execute /deploy if available.").
|
|
36
|
+
|
|
37
|
+
## MODE 2: Rejection with Feedback
|
|
38
|
+
*Activated if review fails.*
|
|
39
|
+
1. Generate report `docs/logs/review_log.md` with `status: Rejected`.
|
|
40
|
+
2. **CRITICAL:** Fill "Items for Correction" section with clear and actionable feedback. Be specific about file, line, and violated rule.
|
|
41
|
+
3. Instruct user to trigger development agent again (e.g., "Review failed. Execute /dev:coder <Task_ID> for developer to fix listed points.").
|
|
42
|
+
|
|
43
|
+
# OUTPUT STRUCTURE (docs/logs/review_log.md)
|
|
44
|
+
Use this template to register result (Append).
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
### 🔬 REVIEW RECORD
|
|
48
|
+
**Task_ID:** [Task ID from work_log]
|
|
49
|
+
**Reviewer:** Senior QA Engineer
|
|
50
|
+
**Timestamp:** [YYYY-MM-DD HH:MM]
|
|
51
|
+
**Status:** [Approved/Rejected]
|
|
52
|
+
|
|
53
|
+
**Analysis Summary:**
|
|
54
|
+
- [x] Static Analysis: [Pass/Fail]
|
|
55
|
+
- [x] Requirement Compliance: [Pass/Fail]
|
|
56
|
+
- [x] Testing Verification: [Pass/Fail]
|
|
57
|
+
|
|
58
|
+
**Items for Correction (if Rejected):**
|
|
59
|
+
| File | Line(s) | Problem | Correction Suggestion |
|
|
60
|
+
| :--- | :--- | :--- | :--- |
|
|
61
|
+
| `example/file.ts` | 10-15 | `any` used in function return. | Type return with `IUserResponse` interface. |
|
|
62
|
+
| `other/file.js`| 25 | Lack of error handling in API call. | Wrap `axios.get` call in `try/catch` block. |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
# INSTRUCTION
|
|
67
|
+
Analyze latest `work_log.md` entry, read associated files, execute your review checklist and generate `docs/review_log.md` with your decision.
|
|
68
|
+
rules:
|
|
69
|
+
- "**OBJECTIVITY:** Base all rejection on an explicit rule from requirements files or agent prompts."
|
|
70
|
+
- "**DO NOT REWRITE CODE:** Your function is to point out error and suggest correction, not implement solution."
|
|
71
|
+
- "**ASSERTIVENESS:** Do not approve code that violates a critical rule, even if it looks functional."
|
|
72
|
+
- "Language Adaptability: Respond in English by default. If the user speaks in another language, mirror their language."
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
name: Task Planner
|
|
2
|
+
role: Generates technical tasks
|
|
3
|
+
emoji: 📋
|
|
4
|
+
systemPrompt: |
|
|
5
|
+
# SYSTEM ROLE & IDENTITY
|
|
6
|
+
You are the **Engineering Planning Lead**.
|
|
7
|
+
Your function is to transform Milestones (What) and Requirements (How/Rules) into an execution checklist for developers.
|
|
8
|
+
You strictly follow Tech Stack defined in `docs/requirements.md`.
|
|
9
|
+
|
|
10
|
+
# INPUT CONTEXT & WORKFLOW
|
|
11
|
+
1. **Context Reading (Mandatory):**
|
|
12
|
+
- Read `docs/milestones.md` (To know which phase to attack).
|
|
13
|
+
- Read `docs/requirements.md` (To know LIBS, DATABASE, and RULES).
|
|
14
|
+
- *If `docs/requirements.md` not found:* Warn user and ask for stack manually.
|
|
15
|
+
|
|
16
|
+
2. **Selection:**
|
|
17
|
+
- List Milestones.
|
|
18
|
+
- Ask: "Which Milestone shall we detail?"
|
|
19
|
+
|
|
20
|
+
3. **Task Generation (Tech-Aware):**
|
|
21
|
+
- When creating a task, consult "Tech Stack" section of `docs/requirements.md`.
|
|
22
|
+
- **Example:** If requirement asks for validation and stack says "Zod", task MUST be "Implement Zod schema", not just "Validate data".
|
|
23
|
+
- **Linking:** If possible, cite requirement ID in task (e.g., "Verify rule [BR-01]").
|
|
24
|
+
|
|
25
|
+
# OUTPUT STRUCTURE (docs/task.md)
|
|
26
|
+
The file must be formatted as Markdown Checklist.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
title: Tasks Sprint - [Milestone Name]
|
|
30
|
+
milestone_ref: [Name]
|
|
31
|
+
tech_stack: [Stack Summary read in docs/requirements.md]
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
# Execution Backlog: [Milestone Name]
|
|
35
|
+
|
|
36
|
+
## Technical Summary
|
|
37
|
+
(Target Stack: [e.g., Next.js + Prisma + Zod])
|
|
38
|
+
|
|
39
|
+
## Tasks Checklist
|
|
40
|
+
|
|
41
|
+
- [ ] **[M1-T01] Initial Environment Setup**
|
|
42
|
+
- [ ] Install dependencies ([List libs from docs/requirements.md])
|
|
43
|
+
- [ ] Configure Database connection ([Cite database from docs/requirements.md])
|
|
44
|
+
- **DoD:** Environment running and connected.
|
|
45
|
+
|
|
46
|
+
- [ ] **[M1-T02] Implement [Feature Name]**
|
|
47
|
+
- [ ] Create Data Model (According to Schema in docs/requirements.md)
|
|
48
|
+
- [ ] Implement Business Logic (Meeting BR-XX)
|
|
49
|
+
- [ ] **Create Tests (Using [Defined Test Lib])**
|
|
50
|
+
- **Acceptance Criteria:**
|
|
51
|
+
- [ ] Must pass success flow [FR-XX]
|
|
52
|
+
- [ ] Must handle error [Cite error scenario from docs/requirements.md]
|
|
53
|
+
|
|
54
|
+
...
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
# HANDOFF & NEXT STEPS (Workflow Link)
|
|
59
|
+
At the end of the response (in chat, not in file), you MUST instruct the user on the logical next step:
|
|
60
|
+
"✅ **Task backlog created.** The next step is to start development.
|
|
61
|
+
👉 **Execute command: `/dev:coder <Task_ID>`** to start coding the first task."
|
|
62
|
+
|
|
63
|
+
# INSTRUCTION
|
|
64
|
+
Analyze `docs/milestones.md` and `docs/requirements.md`. Ask target milestone, generate technical tasks and link to command `/dev:coder`.
|
|
65
|
+
rules:
|
|
66
|
+
- "**CONSISTENCY:** If `docs/requirements.md` says \"PostgreSQL\", NEVER create a task to \"Configure MongoDB\"."
|
|
67
|
+
- "**TRACEABILITY:** Try to link tasks to Requirement IDs (FR-01, BR-02) whenever context allows."
|
|
68
|
+
- "**TESTING:** Always include test subtasks using library specified in requirements."
|
|
69
|
+
- "**FILE OPS:** Save strictly as `docs/task.md`."
|
|
70
|
+
- "Language Adaptability: Respond in English by default. If the user speaks in another language, mirror their language."
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateAgents = generateAgents;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const yaml_1 = __importDefault(require("yaml"));
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const types_1 = require("../types");
|
|
12
|
+
const gemini_1 = require("../transformers/gemini");
|
|
13
|
+
const roo_1 = require("../transformers/roo");
|
|
14
|
+
const kilo_1 = require("../transformers/kilo");
|
|
15
|
+
const opencode_1 = require("../transformers/opencode");
|
|
16
|
+
const markdown_1 = require("../parsers/markdown");
|
|
17
|
+
async function generateAgents(definitionsDir, outDir, selectedTargets) {
|
|
18
|
+
console.log(chalk_1.default.blue(`\n📦 Building agents from ${definitionsDir}...`));
|
|
19
|
+
try {
|
|
20
|
+
if (outDir !== process.cwd()) {
|
|
21
|
+
await fs_extra_1.default.ensureDir(outDir);
|
|
22
|
+
}
|
|
23
|
+
// Check if input exists
|
|
24
|
+
if (!await fs_extra_1.default.pathExists(definitionsDir)) {
|
|
25
|
+
console.error(chalk_1.default.red(`Input not found: ${definitionsDir}`));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let files = [];
|
|
29
|
+
let baseDir = definitionsDir;
|
|
30
|
+
const stats = await fs_extra_1.default.stat(definitionsDir);
|
|
31
|
+
if (stats.isFile()) {
|
|
32
|
+
baseDir = path_1.default.dirname(definitionsDir);
|
|
33
|
+
files = [path_1.default.basename(definitionsDir)];
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
files = await fs_extra_1.default.readdir(definitionsDir);
|
|
37
|
+
}
|
|
38
|
+
for (const file of files) {
|
|
39
|
+
const filePath = path_1.default.join(baseDir, file);
|
|
40
|
+
// 1. Handle YAML
|
|
41
|
+
if (file.endsWith('.yaml') || file.endsWith('.yml')) {
|
|
42
|
+
const content = await fs_extra_1.default.readFile(filePath, 'utf-8');
|
|
43
|
+
try {
|
|
44
|
+
const rawAgent = yaml_1.default.parse(content);
|
|
45
|
+
const parseResult = types_1.AgentSchema.safeParse(rawAgent);
|
|
46
|
+
if (!parseResult.success) {
|
|
47
|
+
logValidationErrors(file, parseResult.error);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
// Use filename as slug for YAML (backward compatibility)
|
|
51
|
+
const slug = file.replace(/\.(yaml|yml)$/, '');
|
|
52
|
+
await buildAgentArtifacts(parseResult.data, slug, outDir, selectedTargets);
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
console.error(chalk_1.default.red(`Error parsing YAML ${file}: ${e.message}`));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// 2. Handle Markdown
|
|
59
|
+
else if (file.endsWith('.md')) {
|
|
60
|
+
const content = await fs_extra_1.default.readFile(filePath, 'utf-8');
|
|
61
|
+
const agents = (0, markdown_1.parseMarkdownAgents)(content);
|
|
62
|
+
if (agents.length === 0) {
|
|
63
|
+
console.warn(chalk_1.default.yellow(`⚠️ No agents found in ${file}`));
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
for (const agent of agents) {
|
|
67
|
+
const parseResult = types_1.AgentSchema.safeParse(agent);
|
|
68
|
+
if (!parseResult.success) {
|
|
69
|
+
logValidationErrors(`${file} -> ${agent.name}`, parseResult.error);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
// Use agent name as slug for Markdown
|
|
73
|
+
const slug = toSlug(agent.name);
|
|
74
|
+
await buildAgentArtifacts(agent, slug, outDir, selectedTargets);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
console.log(chalk_1.default.bold.green('\n🎉 Build complete! Agents are ready to use.'));
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
console.error(chalk_1.default.red('Build failed:'), err);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function buildAgentArtifacts(agent, slug, outDir, selectedTargets) {
|
|
86
|
+
const allTargets = [
|
|
87
|
+
{
|
|
88
|
+
id: 'gemini',
|
|
89
|
+
subDir: '.gemini/commands',
|
|
90
|
+
ext: 'toml',
|
|
91
|
+
content: (0, gemini_1.toGeminiSystemPrompt)(agent),
|
|
92
|
+
name: `${slug}.toml`
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'roo',
|
|
96
|
+
subDir: '.roo/commands',
|
|
97
|
+
ext: 'md',
|
|
98
|
+
content: (0, roo_1.toRooRules)(agent),
|
|
99
|
+
name: `${slug}.md`
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 'kilo',
|
|
103
|
+
subDir: '.kilocode/workflows',
|
|
104
|
+
ext: 'md',
|
|
105
|
+
content: (0, kilo_1.toKiloConfig)(agent),
|
|
106
|
+
name: `${slug}.md`
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'opencode',
|
|
110
|
+
subDir: '.opencode/command',
|
|
111
|
+
ext: 'md',
|
|
112
|
+
content: (0, opencode_1.toOpenCodeCommand)(agent),
|
|
113
|
+
name: `${slug}.md`
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
const targetsToBuild = allTargets.filter(t => selectedTargets.includes(t.id));
|
|
117
|
+
for (const target of targetsToBuild) {
|
|
118
|
+
const targetDir = path_1.default.join(outDir, target.subDir);
|
|
119
|
+
await fs_extra_1.default.ensureDir(targetDir);
|
|
120
|
+
await fs_extra_1.default.writeFile(path_1.default.join(targetDir, target.name), target.content);
|
|
121
|
+
console.log(chalk_1.default.gray(` -> ${target.subDir}/${target.name}`));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function logValidationErrors(source, error) {
|
|
125
|
+
console.error(chalk_1.default.red(`❌ Validation failed for ${source}:`));
|
|
126
|
+
error.issues.forEach((err) => {
|
|
127
|
+
console.error(chalk_1.default.red(` - ${err.path.join('.')}: ${err.message}`));
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
function toSlug(name) {
|
|
131
|
+
return name.toLowerCase()
|
|
132
|
+
.replace(/[^\w\s-]/g, '') // remove non-word chars
|
|
133
|
+
.replace(/[\s_-]+/g, '-') // collapse whitespace/underscores to hyphens
|
|
134
|
+
.replace(/^-+|-+$/g, ''); // trim hyphens
|
|
135
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateWorkflowGuide = generateWorkflowGuide;
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
async function generateWorkflowGuide(docsDir, shell) {
|
|
11
|
+
const readmeContent = `# 🤖 Agent Workflow Guide
|
|
12
|
+
|
|
13
|
+
This document outlines the standard development flow using the installed Agents.
|
|
14
|
+
The system follows a **Waterfall-like** process relative to planning (to ensure precision) and an **Iterative** process for execution.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 1. 🏗️ Project Spec (@Project Architect)
|
|
19
|
+
**Role:** The Visionary.
|
|
20
|
+
**Goal:** Translate your vague idea into a concrete Specification with defined "Project Principles" (Constitution).
|
|
21
|
+
- **Why?** To ensure the machine understands the "Soul" of the project (e.g., "Mobile First", "Minimalist").
|
|
22
|
+
- **Command:** \`/dev:project "I want a Todo App that..."\`
|
|
23
|
+
- **Output:** \`docs/project.md\`
|
|
24
|
+
|
|
25
|
+
## 2. 🧱 Requirements Engineering (@Requirements Engineer)
|
|
26
|
+
**Role:** The Tech Lead.
|
|
27
|
+
**Goal:** Lock down technical decisions (Stack, Database, Libraries) based on the Spec.
|
|
28
|
+
- **Why?** To prevent the Coder from "inventing" architecture on the fly. It creates a "Contract" of what to build.
|
|
29
|
+
- **Command:** \`/dev:requirements\`
|
|
30
|
+
- **Output:** \`docs/requirements.md\` (The Technical Contract)
|
|
31
|
+
|
|
32
|
+
## 3. 🗺️ Roadmap Strategy (@Milestone Manager)
|
|
33
|
+
**Role:** The Strategist.
|
|
34
|
+
**Goal:** Slice the project into logical delivery phases (MVPs).
|
|
35
|
+
- **Why?** To avoid "Big Bang" development. It organizes work into sequential milestones (e.g., "M1: Auth", "M2: Dashboard").
|
|
36
|
+
- **Command:** \`/dev:milestone\`
|
|
37
|
+
- **Output:** \`docs/milestones.md\`
|
|
38
|
+
|
|
39
|
+
## 4. 📋 Task Planning (@Task Planner)
|
|
40
|
+
**Role:** The Manager.
|
|
41
|
+
**Goal:** Break down a specific Milestone into atomic, developer-ready tasks.
|
|
42
|
+
- **Why?** AI coders fail with large contexts. Small, clear tasks = Perfect code.
|
|
43
|
+
- **Command:** \`/dev:tasks <Milestone_ID>\`
|
|
44
|
+
- **Output:** \`docs/task.md\`
|
|
45
|
+
|
|
46
|
+
## 5. 🕵️ Blueprint Audit (@Auditor)
|
|
47
|
+
**Role:** The Gatekeeper.
|
|
48
|
+
**Goal:** Validate consistency between **Requirements** (The Contract) and **Tasks** (The Plan).
|
|
49
|
+
- **Why?** To catch missing requirements or dangerous hallucinations *before* a single line of code is written.
|
|
50
|
+
- **Command:** \`/dev:auditor\`
|
|
51
|
+
- **Output:** \`audit_report.md\`
|
|
52
|
+
|
|
53
|
+
## 6. 💻 Implementation (@Coder)
|
|
54
|
+
**Role:** The Builder.
|
|
55
|
+
**Goal:** Execute *one task at a time* from the \`task.md\` file.
|
|
56
|
+
- **Why?** Focus. It reads the docs, writes the code (and tests), and logs progress.
|
|
57
|
+
- **Safeguards:** Checks for \`.gitignore\` and strictly follows \`requirements.md\`.
|
|
58
|
+
- **Command:** \`/dev:coder <Task_ID>\`
|
|
59
|
+
- **Buffer:** \`work_log.md\`
|
|
60
|
+
|
|
61
|
+
## 7. ⚖️ Quality Assurance (@QA Engineer)
|
|
62
|
+
**Role:** The Inspector.
|
|
63
|
+
**Goal:** Verify if the implementation matches the Requirement Artifacts.
|
|
64
|
+
- **Why?** Trust but verify. It reads the \`work_log.md\` and checks against expectations.
|
|
65
|
+
- **Command:** \`/dev:review <Task_ID>\`
|
|
66
|
+
- **Output:** \`docs/logs/review_log.md\`
|
|
67
|
+
|
|
68
|
+
## 8. 📦 Release Management (@Release Manager)
|
|
69
|
+
**Role:** The Historian.
|
|
70
|
+
**Goal:** Consolidate the temporary \`work_log.md\` into a permanent \`changelog.md\`.
|
|
71
|
+
- **Why?** To clean up the workspace and keep a professional history of the project.
|
|
72
|
+
- **Command:** \`/dev:log\`
|
|
73
|
+
- **Output:** \`changelog.md\`
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 🛠️ On-Demand Utilities
|
|
78
|
+
|
|
79
|
+
### Infrastructure (@DevOps Engineer)
|
|
80
|
+
**Role:** The Mechanic.
|
|
81
|
+
**Goal:** Handle "Config Hell" (Docker, CI/CD, Linters).
|
|
82
|
+
- **Why?** Keeps the Coder focused on business logic.
|
|
83
|
+
- **Command:** \`/dev:ops\`
|
|
84
|
+
`;
|
|
85
|
+
await fs_extra_1.default.ensureDir(docsDir);
|
|
86
|
+
await fs_extra_1.default.writeFile(path_1.default.join(docsDir, 'README.md'), readmeContent);
|
|
87
|
+
console.log(chalk_1.default.green(`✅ Created "docs/" directory (Optimized for ${shell}).\n`));
|
|
88
|
+
console.log(chalk_1.default.green(` -> Generated "docs/README.md" with workflow instructions.\n`));
|
|
89
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const commander_1 = require("commander");
|
|
8
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
11
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
12
|
+
const docs_1 = require("./generators/docs");
|
|
13
|
+
const agents_1 = require("./generators/agents");
|
|
14
|
+
const program = new commander_1.Command();
|
|
15
|
+
program
|
|
16
|
+
.name('agents')
|
|
17
|
+
.description('Agent Installer CLI')
|
|
18
|
+
.version('1.0.0')
|
|
19
|
+
.option('-o, --out <dir>', 'Output directory', '.')
|
|
20
|
+
.option('-i, --input <path>', 'Input file or directory (default: definitions/ or agents.md)')
|
|
21
|
+
.option('-t, --target <targets>', 'Comma-separated target formats (gemini, roo, kilo, opencode)')
|
|
22
|
+
.action(async (options) => {
|
|
23
|
+
console.log(chalk_1.default.bold.blue('\n🚀 Agents.dev Installer Wizard\n'));
|
|
24
|
+
// --- STEP 1: INITIALIZATION (Docs & Shell) ---
|
|
25
|
+
const docsDir = path_1.default.join(process.cwd(), 'docs');
|
|
26
|
+
// Check if docs directory exists
|
|
27
|
+
if (!await fs_extra_1.default.pathExists(docsDir)) {
|
|
28
|
+
console.log(chalk_1.default.yellow('ℹ️ Project documentation structure not found.'));
|
|
29
|
+
const initAnswers = await inquirer_1.default.prompt([
|
|
30
|
+
{
|
|
31
|
+
type: 'list',
|
|
32
|
+
name: 'shell',
|
|
33
|
+
message: 'Initialize validation: Which shell do you use?',
|
|
34
|
+
choices: [
|
|
35
|
+
{ name: 'Windows (CMD/PowerShell)', value: 'win32' },
|
|
36
|
+
{ name: 'Unix-like (Bash/Zsh/Ubuntu)', value: 'unix' }
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
]);
|
|
40
|
+
await (0, docs_1.generateWorkflowGuide)(docsDir, initAnswers.shell);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
console.log(chalk_1.default.gray('✅ "docs/" directory already exists.\n'));
|
|
44
|
+
}
|
|
45
|
+
// --- STEP 2: BUILD AGENTS ---
|
|
46
|
+
let inputPath = options.input ? path_1.default.resolve(options.input) : path_1.default.join(process.cwd(), 'definitions');
|
|
47
|
+
// If default definitions dir doesn't exist and no input specified, try agents.md
|
|
48
|
+
if (!options.input && !await fs_extra_1.default.pathExists(inputPath)) {
|
|
49
|
+
const localAgentsMd = path_1.default.join(process.cwd(), 'agents.md');
|
|
50
|
+
if (await fs_extra_1.default.pathExists(localAgentsMd)) {
|
|
51
|
+
inputPath = localAgentsMd;
|
|
52
|
+
console.log(chalk_1.default.gray(`ℹ️ Using 'agents.md' found in root.`));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const outDir = path_1.default.resolve(options.out);
|
|
56
|
+
// Determine targets
|
|
57
|
+
let selectedTargets = [];
|
|
58
|
+
if (options.target) {
|
|
59
|
+
selectedTargets = options.target.split(',').map((t) => t.trim().toLowerCase());
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
const buildAnswers = await inquirer_1.default.prompt([
|
|
63
|
+
{
|
|
64
|
+
type: 'checkbox',
|
|
65
|
+
name: 'targets',
|
|
66
|
+
message: 'Select target formats to build:',
|
|
67
|
+
choices: [
|
|
68
|
+
{ name: 'Gemini CLI', value: 'gemini', checked: true },
|
|
69
|
+
{ name: 'Roo Code', value: 'roo', checked: false },
|
|
70
|
+
{ name: 'Kilo Code', value: 'kilo', checked: false },
|
|
71
|
+
{ name: 'OpenCode', value: 'opencode', checked: false }
|
|
72
|
+
],
|
|
73
|
+
validate: (answer) => {
|
|
74
|
+
if (answer.length < 1) {
|
|
75
|
+
return 'You must choose at least one target.';
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
]);
|
|
81
|
+
selectedTargets = buildAnswers.targets;
|
|
82
|
+
}
|
|
83
|
+
if (selectedTargets.length === 0) {
|
|
84
|
+
console.log(chalk_1.default.yellow('No targets selected. Exiting.'));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
await (0, agents_1.generateAgents)(inputPath, outDir, selectedTargets);
|
|
88
|
+
});
|
|
89
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseMarkdownAgents = parseMarkdownAgents;
|
|
4
|
+
function parseMarkdownAgents(content) {
|
|
5
|
+
const agents = [];
|
|
6
|
+
// Normalize line endings
|
|
7
|
+
const normalized = content.replace(/\r\n/g, '\n');
|
|
8
|
+
// Split by H1 headers (# Name)
|
|
9
|
+
// We use a lookahead to keep the delimiter or just split and ignore the first empty part if it starts with #
|
|
10
|
+
const parts = normalized.split(/^# /gm);
|
|
11
|
+
for (const part of parts) {
|
|
12
|
+
if (!part.trim())
|
|
13
|
+
continue;
|
|
14
|
+
const lines = part.split('\n');
|
|
15
|
+
const headerLine = lines[0].trim();
|
|
16
|
+
// Extract emoji if present at the end
|
|
17
|
+
// E.g. "Project Manager 👩💼" -> name: "Project Manager", emoji: "👩💼"
|
|
18
|
+
// Simple emoji regex or just take the last char if it looks like an emoji?
|
|
19
|
+
// Let's generic split by space and check if last part is emoji-like or just treat whole as name
|
|
20
|
+
// A simplified approach: regex for emoji is complex, let's just grab the whole string as name for now,
|
|
21
|
+
// or try to extract the last non-word character if it looks like a symbol.
|
|
22
|
+
// Spec said: "# Agent Name [Emoji]"
|
|
23
|
+
const emojiMatch = headerLine.match(/^(.*?)\s+([^\w\s\d]+)$/);
|
|
24
|
+
let name = headerLine;
|
|
25
|
+
let emoji = '';
|
|
26
|
+
if (emojiMatch) {
|
|
27
|
+
name = emojiMatch[1].trim();
|
|
28
|
+
emoji = emojiMatch[2].trim();
|
|
29
|
+
}
|
|
30
|
+
const remainingLines = lines.slice(1);
|
|
31
|
+
const sectionContent = remainingLines.join('\n');
|
|
32
|
+
// Parse sections
|
|
33
|
+
// > Role
|
|
34
|
+
// ## System Prompt
|
|
35
|
+
// ## Rules
|
|
36
|
+
// ## Tools
|
|
37
|
+
let role = '';
|
|
38
|
+
let systemPrompt = '';
|
|
39
|
+
const rules = [];
|
|
40
|
+
const tools = [];
|
|
41
|
+
// Extract Role (Blockquote)
|
|
42
|
+
const roleMatch = sectionContent.match(/^\s*>\s*(.+)$/m);
|
|
43
|
+
if (roleMatch) {
|
|
44
|
+
role = roleMatch[1].trim();
|
|
45
|
+
}
|
|
46
|
+
// specific sections
|
|
47
|
+
const sections = sectionContent.split(/^## /gm);
|
|
48
|
+
for (const section of sections) {
|
|
49
|
+
const trimmed = section.trim();
|
|
50
|
+
if (!trimmed)
|
|
51
|
+
continue;
|
|
52
|
+
const sectionLines = trimmed.split('\n');
|
|
53
|
+
const sectionTitle = sectionLines[0].trim().toLowerCase();
|
|
54
|
+
const sectionBody = sectionLines.slice(1).join('\n').trim();
|
|
55
|
+
if (sectionTitle.includes('system prompt') || sectionTitle.includes('instructions')) {
|
|
56
|
+
systemPrompt = sectionBody;
|
|
57
|
+
}
|
|
58
|
+
else if (sectionTitle.includes('rules')) {
|
|
59
|
+
// Extract bullets
|
|
60
|
+
const bullets = sectionBody.split('\n')
|
|
61
|
+
.map(l => l.trim())
|
|
62
|
+
.filter(l => l.startsWith('- ') || l.startsWith('* '))
|
|
63
|
+
.map(l => l.substring(2).trim());
|
|
64
|
+
rules.push(...bullets);
|
|
65
|
+
}
|
|
66
|
+
else if (sectionTitle.includes('tools')) {
|
|
67
|
+
const bullets = sectionBody.split('\n')
|
|
68
|
+
.map(l => l.trim())
|
|
69
|
+
.filter(l => l.startsWith('- ') || l.startsWith('* '))
|
|
70
|
+
.map(l => l.substring(2).trim());
|
|
71
|
+
tools.push(...bullets);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (name) {
|
|
75
|
+
agents.push({
|
|
76
|
+
name,
|
|
77
|
+
role,
|
|
78
|
+
emoji,
|
|
79
|
+
systemPrompt,
|
|
80
|
+
rules,
|
|
81
|
+
tools
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return agents;
|
|
86
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toGeminiSystemPrompt = toGeminiSystemPrompt;
|
|
4
|
+
function toGeminiSystemPrompt(agent) {
|
|
5
|
+
// Construct the prompt content (System Prompt + Rules + Tools)
|
|
6
|
+
const promptParts = [];
|
|
7
|
+
// Identity logic is usually part of the prompt in this TOML structure
|
|
8
|
+
promptParts.push(`# Identity`);
|
|
9
|
+
promptParts.push(`You are **${agent.name}** ${agent.emoji || ''}`);
|
|
10
|
+
promptParts.push(`Role: ${agent.role}\n`);
|
|
11
|
+
promptParts.push(`# Core Instructions`);
|
|
12
|
+
promptParts.push(agent.systemPrompt.trim());
|
|
13
|
+
promptParts.push('\n');
|
|
14
|
+
if (agent.rules && agent.rules.length > 0) {
|
|
15
|
+
promptParts.push(`# Rules & Guidelines`);
|
|
16
|
+
agent.rules.forEach(rule => promptParts.push(`- ${rule}`));
|
|
17
|
+
promptParts.push('\n');
|
|
18
|
+
}
|
|
19
|
+
if (agent.tools && agent.tools.length > 0) {
|
|
20
|
+
promptParts.push(`# Preferred Tools`);
|
|
21
|
+
agent.tools.forEach(tool => promptParts.push(`- ${tool}`));
|
|
22
|
+
promptParts.push('\n');
|
|
23
|
+
}
|
|
24
|
+
const fullPrompt = promptParts.join('\n');
|
|
25
|
+
// Manual TOML construction
|
|
26
|
+
// 1. description = "..."
|
|
27
|
+
// Basic escaping for double quotes
|
|
28
|
+
const escapedDescription = agent.role.replace(/"/g, '\\"');
|
|
29
|
+
// 2. prompt = """..."""
|
|
30
|
+
// Escape triple quotes if they exist in the content (rare but possible)
|
|
31
|
+
const escapedPrompt = fullPrompt.replace(/"""/g, '\\"\\"\\"');
|
|
32
|
+
return `description = "${escapedDescription}"
|
|
33
|
+
prompt = """
|
|
34
|
+
${escapedPrompt}
|
|
35
|
+
"""`;
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toKiloConfig = toKiloConfig;
|
|
4
|
+
function toKiloConfig(agent) {
|
|
5
|
+
// Kilo Code generic config/prompt
|
|
6
|
+
const parts = [];
|
|
7
|
+
parts.push(`<!--- Kilo Code Agent Config --->`);
|
|
8
|
+
parts.push(`# ${agent.name} ${agent.emoji || ''}`);
|
|
9
|
+
parts.push(`**Role**: ${agent.role}\n`);
|
|
10
|
+
parts.push(`## Instructions`);
|
|
11
|
+
parts.push(agent.systemPrompt.trim());
|
|
12
|
+
parts.push('\n');
|
|
13
|
+
if (agent.rules && agent.rules.length > 0) {
|
|
14
|
+
parts.push(`## Constraints`);
|
|
15
|
+
agent.rules.forEach(rule => parts.push(`- ${rule}`));
|
|
16
|
+
}
|
|
17
|
+
return parts.join('\n');
|
|
18
|
+
}
|