@oz1307/forcefully-agent 1.0.0
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/.agents/AGENTS.md +15 -0
- package/.agents/skills/documentation/SKILL.md +16 -0
- package/.agents/skills/implementation/SKILL.md +12 -0
- package/.agents/skills/orchestrator/SKILL.md +14 -0
- package/.agents/skills/validator/SKILL.md +12 -0
- package/.claude/rules/documentation.md +9 -0
- package/.claude/rules/implementation.md +9 -0
- package/.claude/rules/orchestrator.md +10 -0
- package/.claude/rules/validator.md +8 -0
- package/.cursor/rules/documentation.mdc +11 -0
- package/.cursor/rules/implementation.mdc +12 -0
- package/.cursor/rules/orchestrator.mdc +12 -0
- package/.cursor/rules/validator.mdc +11 -0
- package/.cursorrules +5 -0
- package/.github/copilot-instructions.md +7 -0
- package/CLAUDE.md +24 -0
- package/README.md +122 -0
- package/bin/cli.js +672 -0
- package/docs/01-product/business-rules.md +6 -0
- package/docs/01-product/terminology.md +6 -0
- package/docs/01-product/vision.md +10 -0
- package/docs/03-features/overview.md +6 -0
- package/docs/04-api/contracts.md +6 -0
- package/docs/05-database/schema.md +6 -0
- package/docs/08-development/architecture.md +6 -0
- package/docs/08-development/standards.md +9 -0
- package/docs/09-ai/agents/documentation.md +8 -0
- package/docs/09-ai/agents/implementation.md +9 -0
- package/docs/09-ai/agents/orchestrator.md +10 -0
- package/docs/09-ai/agents/validator.md +8 -0
- package/docs/09-ai/coding-rules.md +7 -0
- package/docs/11-knowledge-base/definitions.md +6 -0
- package/docs/11-knowledge-base/logs/implementation-logs.md +9 -0
- package/docs/README.md +23 -0
- package/lib/ai.js +273 -0
- package/lib/templates.js +427 -0
- package/package.json +33 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Coding Standards
|
|
2
|
+
|
|
3
|
+
This document establishes coding guidelines, standards, and quality benchmarks.
|
|
4
|
+
|
|
5
|
+
## Guidelines
|
|
6
|
+
- Write minimal, self-documenting code.
|
|
7
|
+
- Avoid duplicate logic.
|
|
8
|
+
- Prefer functional paradigms where clear.
|
|
9
|
+
- Do not write TS/JS 'any' types without a strong comment reason.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Documentation Agent (Knowledge Base & Logs)
|
|
2
|
+
|
|
3
|
+
The Documentation Agent is responsible for maintaining the system's "source of truth".
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
1. **Knowledge Maintenance**: Ensure the business logic and definitions folder remains updated as new features are added.
|
|
7
|
+
2. **Change Log**: Record every code implementation task in `docs/11-knowledge-base/logs/implementation-logs.md`.
|
|
8
|
+
3. **Repository Onboarding**: Ensure folder structures remain clean so that new agents or human developers can easily understand the codebase.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Implementation Agent (Coding & Testing)
|
|
2
|
+
|
|
3
|
+
The Implementation Agent is responsible for writing minimal, clean, and testable code.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
1. **Brainstorming**: Propose 2-3 implementation ideas with pros/cons before touching the codebase.
|
|
7
|
+
2. **Coding**: Implement the chosen approach using the simplest possible code (least lines of code, standard patterns).
|
|
8
|
+
3. **Testing**: Write unit/integration tests for any new or modified logic.
|
|
9
|
+
4. **Execution**: Verify that all tests pass.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Orchestrator Agent (Orchestration & Validation)
|
|
2
|
+
|
|
3
|
+
The Orchestrator Agent is responsible for ensuring implementation excellence, architectural consistency, and documentation accuracy.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
1. **Initial Review**: When a request is received, ensure the Implementation Agent proposes multiple options first.
|
|
7
|
+
2. **Quality Gate**: Review the selected approach. Ensure it is simple, solid, and does not contain bloated or redundant code.
|
|
8
|
+
3. **Verification**: Verify that tests have been implemented and run successfully.
|
|
9
|
+
4. **Documentation Audit**: Confirm that the Documentation Agent updated all required files, including implementation logs and business logic documents.
|
|
10
|
+
5. **Approval**: Approve the task or request iterations if standards are not met.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Documentation Validator Agent (Product Owner Audit Helper)
|
|
2
|
+
|
|
3
|
+
The Documentation Validator Agent acts as a bridge between technical documentation and the Product Owner's business vision.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
1. **Document Audit**: Scans and parses the existing markdown documents to identify logical inconsistencies or gaps.
|
|
7
|
+
2. **Interactivity**: Prompts the Product Owner with clarifying questions regarding requirements, business rules, and terminology.
|
|
8
|
+
3. **Refinement**: Automatically applies the Product Owner's answers to refine and update the specifications files.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# AI Coding Rules
|
|
2
|
+
|
|
3
|
+
This repository enforces strict AI coding practices. All AI engines MUST adhere to:
|
|
4
|
+
1. Propose 2-3 design options with pros/cons before making changes.
|
|
5
|
+
2. Always write unit tests for new behavior.
|
|
6
|
+
3. Update `docs/11-knowledge-base/logs/implementation-logs.md` with details of every task run.
|
|
7
|
+
4. Maintain documentation consistency and consult the Documentation Validator Agent if ambiguities arise.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Implementation Logs
|
|
2
|
+
|
|
3
|
+
This logbook records all codebase modifications, key architectural decisions, and agent executions.
|
|
4
|
+
|
|
5
|
+
## [2026-07-08] Initial ForcefullyAgent Setup
|
|
6
|
+
- **Agent**: Documentation Agent
|
|
7
|
+
- **Description**: Configured 4-agent orchestration templates and initialized modular documentation structures.
|
|
8
|
+
- **AI Engine used**: Initial onboarding scanner.
|
|
9
|
+
- **Decisions**: Setup rules for Antigravity, Claude Code, Cursor, and Copilot.
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
Title: Project Documentation Index
|
|
3
|
+
Owner: Product & Engineering
|
|
4
|
+
Status: Active
|
|
5
|
+
Version: 1.0
|
|
6
|
+
Priority: High
|
|
7
|
+
Tags: index, agent-system
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Project Documentation
|
|
11
|
+
|
|
12
|
+
This documentation workspace is a machine-readable product specification system. It is organized by product domain to keep documents small and focused.
|
|
13
|
+
|
|
14
|
+
## Domain Index
|
|
15
|
+
|
|
16
|
+
- `/01-product/`: Product vision, core business rules, and terminology glossary.
|
|
17
|
+
- `/02-design-system/`: UI styling patterns, guidelines, or frontend conventions.
|
|
18
|
+
- `/03-features/`: Descriptions and specifications for individual workflows/features.
|
|
19
|
+
- `/04-api/`: API endpoint contracts, service endpoints, or edge functions description.
|
|
20
|
+
- `/05-database/`: Database schema tables, models, or persistence models.
|
|
21
|
+
- `/08-development/`: Codebase system architecture, directories layout, and standards.
|
|
22
|
+
- `/09-ai/`: Specification of the 4 virtual agents and repository AI rules.
|
|
23
|
+
- `/11-knowledge-base/`: Supporting definitions, glossary records, and historical change logs.
|
package/lib/ai.js
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { GoogleGenAI } from '@google/genai';
|
|
2
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
3
|
+
import OpenAI from 'openai';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Helper to execute calls across Gemini, Anthropic, or OpenAI.
|
|
7
|
+
*/
|
|
8
|
+
async function callAI({ provider, apiKey, prompt, maxTokens = 4000, jsonMode = false }) {
|
|
9
|
+
if (provider === 'gemini') {
|
|
10
|
+
const ai = new GoogleGenAI({ apiKey });
|
|
11
|
+
const response = await ai.models.generateContent({
|
|
12
|
+
model: 'gemini-2.5-flash',
|
|
13
|
+
contents: prompt,
|
|
14
|
+
});
|
|
15
|
+
return response.text;
|
|
16
|
+
} else if (provider === 'claude') {
|
|
17
|
+
const anthropic = new Anthropic({ apiKey });
|
|
18
|
+
const response = await anthropic.messages.create({
|
|
19
|
+
model: 'claude-3-5-sonnet-latest',
|
|
20
|
+
max_tokens: maxTokens,
|
|
21
|
+
messages: [{ role: 'user', content: prompt }],
|
|
22
|
+
});
|
|
23
|
+
return response.content[0].text;
|
|
24
|
+
} else if (provider === 'openai') {
|
|
25
|
+
const openai = new OpenAI({ apiKey });
|
|
26
|
+
const response = await openai.chat.completions.create({
|
|
27
|
+
model: 'gpt-4o-mini',
|
|
28
|
+
messages: [{ role: 'user', content: prompt }],
|
|
29
|
+
response_format: jsonMode ? { type: 'json_object' } : undefined
|
|
30
|
+
});
|
|
31
|
+
return response.choices[0].message.content;
|
|
32
|
+
} else {
|
|
33
|
+
throw new Error(`Unsupported AI provider: ${provider}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Deep-dive Product Vision Generator.
|
|
39
|
+
*/
|
|
40
|
+
export async function generateVisionDoc({ provider, apiKey, fileTree, packageJson, readme }) {
|
|
41
|
+
const prompt = `
|
|
42
|
+
You are the Documentation Agent. Perform a deep-dive analysis of the codebase files, folder structure, and metadata, then write a detailed "Product Vision" document.
|
|
43
|
+
Explain what this application is, its core purpose, target audience, business context, and engineering goals. Do not use generic placeholders.
|
|
44
|
+
|
|
45
|
+
=== FILE TREE ===
|
|
46
|
+
${fileTree}
|
|
47
|
+
|
|
48
|
+
=== PACKAGE METADATA ===
|
|
49
|
+
${packageJson}
|
|
50
|
+
|
|
51
|
+
=== EXISTING README ===
|
|
52
|
+
${readme}
|
|
53
|
+
|
|
54
|
+
Respond ONLY with the final markdown document. Do not wrap in markdown code blocks like \`\`\`markdown.
|
|
55
|
+
`;
|
|
56
|
+
return callAI({ provider, apiKey, prompt });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Deep-dive Business Rules Extractor.
|
|
61
|
+
*/
|
|
62
|
+
export async function generateBusinessRulesDoc({ provider, apiKey, fileTree, logicFilesCode }) {
|
|
63
|
+
const prompt = `
|
|
64
|
+
You are the Documentation Agent. Perform a deep-dive analysis of the following logic files, modules, validation rules, and calculations to extract the system's "Business Rules".
|
|
65
|
+
List and explain every single validation check, constraint, calculation, permission check, or state transition rules you find. Document them neatly one-by-one.
|
|
66
|
+
|
|
67
|
+
=== FILE TREE ===
|
|
68
|
+
${fileTree}
|
|
69
|
+
|
|
70
|
+
=== BUSINESS LOGIC CODE SNIPPETS ===
|
|
71
|
+
${logicFilesCode}
|
|
72
|
+
|
|
73
|
+
Respond ONLY with the final markdown document. Do not wrap in markdown code blocks.
|
|
74
|
+
`;
|
|
75
|
+
return callAI({ provider, apiKey, prompt });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Deep-dive Terminology Glossary Generator.
|
|
80
|
+
*/
|
|
81
|
+
export async function generateTerminologyDoc({ provider, apiKey, fileTree, modelFilesCode }) {
|
|
82
|
+
const prompt = `
|
|
83
|
+
You are the Documentation Agent. Review the codebase folder structure and these model/class/logic definitions to extract "Domain Terminology".
|
|
84
|
+
Provide definitions and explanations for all technical terms, class names, database models, abbreviations, and domain vocabulary. Document them neatly one-by-one.
|
|
85
|
+
|
|
86
|
+
=== FILE TREE ===
|
|
87
|
+
${fileTree}
|
|
88
|
+
|
|
89
|
+
=== MODEL CODE SNIPPETS ===
|
|
90
|
+
${modelFilesCode}
|
|
91
|
+
|
|
92
|
+
Respond ONLY with the final markdown document. Do not wrap in markdown code blocks.
|
|
93
|
+
`;
|
|
94
|
+
return callAI({ provider, apiKey, prompt });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Deep-dive Features Catalog Generator.
|
|
99
|
+
*/
|
|
100
|
+
export async function generateFeaturesDoc({ provider, apiKey, fileTree, mainFilesCode }) {
|
|
101
|
+
const prompt = `
|
|
102
|
+
You are the Documentation Agent. Analyze the folder structure and codebase files to list and explain all the "Features and User Flows".
|
|
103
|
+
For each feature you discover, describe its entrypoint, backend triggers, logic flow, and result. Document them neatly one-by-one.
|
|
104
|
+
|
|
105
|
+
=== FILE TREE ===
|
|
106
|
+
${fileTree}
|
|
107
|
+
|
|
108
|
+
=== CORE CODE SNIPPETS ===
|
|
109
|
+
${mainFilesCode}
|
|
110
|
+
|
|
111
|
+
Respond ONLY with the final markdown document. Do not wrap in markdown code blocks.
|
|
112
|
+
`;
|
|
113
|
+
return callAI({ provider, apiKey, prompt });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Deep-dive API Contracts Documenter.
|
|
118
|
+
*/
|
|
119
|
+
export async function generateApiContractsDoc({ provider, apiKey, routerFilesCode }) {
|
|
120
|
+
const prompt = `
|
|
121
|
+
You are the Documentation Agent. Analyze the following router, API, or controller files and document the "API Contracts" in detail.
|
|
122
|
+
For every route or API interface found, document:
|
|
123
|
+
1. HTTP Method and Route Path
|
|
124
|
+
2. Expected parameters (Query, Path, Body) and validation constraints
|
|
125
|
+
3. Success response formats and data types
|
|
126
|
+
4. Error conditions and codes
|
|
127
|
+
Document them neatly one-by-one.
|
|
128
|
+
|
|
129
|
+
=== API CODE SNIPPETS ===
|
|
130
|
+
${routerFilesCode}
|
|
131
|
+
|
|
132
|
+
Respond ONLY with the final markdown document. Do not wrap in markdown code blocks.
|
|
133
|
+
`;
|
|
134
|
+
return callAI({ provider, apiKey, prompt });
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Deep-dive Database Schema Documenter.
|
|
139
|
+
*/
|
|
140
|
+
export async function generateDatabaseSchemaDoc({ provider, apiKey, dbFilesCode }) {
|
|
141
|
+
const prompt = `
|
|
142
|
+
You are the Documentation Agent. Perform a deep-dive analysis of the following database models, ORM classes, schemas, or migrations.
|
|
143
|
+
For every table or database model found, document:
|
|
144
|
+
1. Table Name
|
|
145
|
+
2. Column names, data types, constraints (Nullability, Primary Key, Foreign Keys)
|
|
146
|
+
3. Table indexes, relationships, and associations
|
|
147
|
+
Document them neatly one-by-one. If no database setup is found, write a detailed explanation.
|
|
148
|
+
|
|
149
|
+
=== DATABASE MODELS AND SCHEMAS ===
|
|
150
|
+
${dbFilesCode}
|
|
151
|
+
|
|
152
|
+
Respond ONLY with the final markdown document. Do not wrap in markdown code blocks.
|
|
153
|
+
`;
|
|
154
|
+
return callAI({ provider, apiKey, prompt });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Deep-dive Architecture Diagram and Layout Documenter.
|
|
159
|
+
*/
|
|
160
|
+
export async function generateArchitectureDoc({ provider, apiKey, fileTree, packageJson, configFilesCode }) {
|
|
161
|
+
const prompt = `
|
|
162
|
+
You are the Documentation Agent. Analyze the folder layout, metadata, and config files to write the "System Architecture" overview.
|
|
163
|
+
Provide:
|
|
164
|
+
1. Directory Structure mapping (detailing what each major folder does).
|
|
165
|
+
2. Data Flow description showing how components interact.
|
|
166
|
+
3. System components map.
|
|
167
|
+
4. A Mermaid diagram illustrating the system architecture layout!
|
|
168
|
+
Document them neatly.
|
|
169
|
+
|
|
170
|
+
=== FILE TREE ===
|
|
171
|
+
${fileTree}
|
|
172
|
+
|
|
173
|
+
=== PACKAGE METADATA ===
|
|
174
|
+
${packageJson}
|
|
175
|
+
|
|
176
|
+
=== SYSTEM CONFIGS ===
|
|
177
|
+
${configFilesCode}
|
|
178
|
+
|
|
179
|
+
Respond ONLY with the final markdown document. Do not wrap in markdown code blocks.
|
|
180
|
+
`;
|
|
181
|
+
return callAI({ provider, apiKey, prompt });
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Deep-dive Definitions & Glossary Generator.
|
|
186
|
+
*/
|
|
187
|
+
export async function generateDefinitionsDoc({ provider, apiKey, fileTree, terminologyContent }) {
|
|
188
|
+
const prompt = `
|
|
189
|
+
You are the Documentation Agent. Formulate the "Definitions & Knowledge Base Glossary" by expanding on these terminology glossary terms and folder paths.
|
|
190
|
+
Provide detailed definitions, system explanations, and technical summaries for new developers. Document them neatly one-by-one.
|
|
191
|
+
|
|
192
|
+
=== FILE TREE ===
|
|
193
|
+
${fileTree}
|
|
194
|
+
|
|
195
|
+
=== TERMINOLOGY REFERENCE ===
|
|
196
|
+
${terminologyContent}
|
|
197
|
+
|
|
198
|
+
Respond ONLY with the final markdown document. Do not wrap in markdown code blocks.
|
|
199
|
+
`;
|
|
200
|
+
return callAI({ provider, apiKey, prompt });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Formulates a targeted validating question about a single part of the document.
|
|
205
|
+
* @returns {Promise<{ snippet: string, question: string }>}
|
|
206
|
+
*/
|
|
207
|
+
export async function generateValidationQuestion({ provider, apiKey, docName, docContent }) {
|
|
208
|
+
const prompt = `
|
|
209
|
+
You are the Documentation Validator Agent. Your role is to help Product Owners audit project specifications.
|
|
210
|
+
Review the following project specification document: "${docName}".
|
|
211
|
+
Identify exactly ONE key rule, feature, definition, or paragraph from the content.
|
|
212
|
+
Formulate a short clarifying question for the Product Owner to confirm if this specific part is correct, active, and accurate.
|
|
213
|
+
|
|
214
|
+
=== DOCUMENT CONTENT ===
|
|
215
|
+
${docContent}
|
|
216
|
+
|
|
217
|
+
Please respond with a valid JSON object containing exactly two fields:
|
|
218
|
+
1. "snippet": The exact short excerpt/rule/sentence from the document that you are validating. Keep it short (1-3 sentences max).
|
|
219
|
+
2. "question": A clarifying question asking if this specific part is still correct/active or needs changes.
|
|
220
|
+
|
|
221
|
+
IMPORTANT: Respond ONLY with the JSON object. Do not wrap the JSON in markdown code blocks.
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
const responseText = await callAI({ provider, apiKey, prompt, jsonMode: true });
|
|
225
|
+
const cleaned = responseText.trim().replace(/^```json\s*/i, '').replace(/```\s*$/, '').trim();
|
|
226
|
+
try {
|
|
227
|
+
const parsed = JSON.parse(cleaned);
|
|
228
|
+
return {
|
|
229
|
+
snippet: parsed.snippet || 'General specification entry.',
|
|
230
|
+
question: parsed.question || 'Is this specification section still correct and up-to-date?'
|
|
231
|
+
};
|
|
232
|
+
} catch (e) {
|
|
233
|
+
console.error('Failed to parse question JSON:', responseText);
|
|
234
|
+
return {
|
|
235
|
+
snippet: 'General specification entry.',
|
|
236
|
+
question: 'Is this specification section still correct and up-to-date?'
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Refines a single spec document based on the Product Owner's correction instructions.
|
|
243
|
+
*/
|
|
244
|
+
export async function refineSingleDoc({ provider, apiKey, docName, docContent, correction }) {
|
|
245
|
+
const prompt = `
|
|
246
|
+
You are the Documentation Validator Agent. The Product Owner has requested updates to the specification document "${docName}".
|
|
247
|
+
Here is the correction/update instruction from the Product Owner:
|
|
248
|
+
"${correction}"
|
|
249
|
+
|
|
250
|
+
=== EXISTING SPECIFICATION CONTENT ===
|
|
251
|
+
${docContent}
|
|
252
|
+
|
|
253
|
+
Refine the specification document markdown content to incorporate their instructions. Do not write any conversational intro or outro.
|
|
254
|
+
Respond with a JSON object containing exactly one field:
|
|
255
|
+
"refinedContent": The updated markdown content for the document.
|
|
256
|
+
|
|
257
|
+
IMPORTANT: Respond ONLY with the JSON object. Do not wrap the JSON in markdown code blocks.
|
|
258
|
+
`;
|
|
259
|
+
|
|
260
|
+
const responseText = await callAI({ provider, apiKey, prompt, jsonMode: true });
|
|
261
|
+
const cleaned = responseText.trim().replace(/^```json\s*/i, '').replace(/```\s*$/, '').trim();
|
|
262
|
+
try {
|
|
263
|
+
const parsed = JSON.parse(cleaned);
|
|
264
|
+
return {
|
|
265
|
+
refinedContent: parsed.refinedContent || docContent
|
|
266
|
+
};
|
|
267
|
+
} catch (e) {
|
|
268
|
+
console.error('Failed to parse refined spec JSON:', responseText);
|
|
269
|
+
return {
|
|
270
|
+
refinedContent: docContent
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|