fraim-framework 2.0.4 → 2.0.7
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/.ai-agents/workflows/test.md +89 -89
- package/.github/workflows/ci.yml +51 -0
- package/.github/workflows/phase-change.yml +251 -0
- package/.github/workflows/status-change.yml +68 -0
- package/.github/workflows/sync-on-pr-review.yml +66 -0
- package/package.json +2 -1
- package/setup.js +112 -932
- package/DISTRIBUTION.md +0 -187
- package/PUBLISH_INSTRUCTIONS.md +0 -93
- package/getting-started.md +0 -143
- package/linkedin-post.md +0 -23
package/setup.js
CHANGED
|
@@ -1,990 +1,169 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* FRAIM Framework Setup Script
|
|
5
|
-
*
|
|
6
|
-
* This script sets up the FRAIM framework in a repository.
|
|
7
|
-
* It creates the necessary directory structure, configuration files,
|
|
8
|
-
* and templates for AI agent management.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
1
|
const fs = require('fs');
|
|
12
2
|
const path = require('path');
|
|
13
|
-
const { execSync } = require('child_process');
|
|
14
|
-
const readline = require('readline');
|
|
15
3
|
|
|
16
|
-
//
|
|
4
|
+
// Colors for console output
|
|
17
5
|
const colors = {
|
|
18
|
-
reset: '\x1b[0m',
|
|
19
|
-
bright: '\x1b[1m',
|
|
20
|
-
dim: '\x1b[2m',
|
|
21
|
-
underscore: '\x1b[4m',
|
|
22
|
-
blink: '\x1b[5m',
|
|
23
|
-
reverse: '\x1b[7m',
|
|
24
|
-
hidden: '\x1b[8m',
|
|
25
|
-
|
|
26
|
-
black: '\x1b[30m',
|
|
27
|
-
red: '\x1b[31m',
|
|
28
6
|
green: '\x1b[32m',
|
|
7
|
+
red: '\x1b[31m',
|
|
29
8
|
yellow: '\x1b[33m',
|
|
30
|
-
|
|
31
|
-
magenta: '\x1b[35m',
|
|
32
|
-
cyan: '\x1b[36m',
|
|
33
|
-
white: '\x1b[37m',
|
|
34
|
-
|
|
35
|
-
bgBlack: '\x1b[40m',
|
|
36
|
-
bgRed: '\x1b[41m',
|
|
37
|
-
bgGreen: '\x1b[42m',
|
|
38
|
-
bgYellow: '\x1b[43m',
|
|
39
|
-
bgBlue: '\x1b[44m',
|
|
40
|
-
bgMagenta: '\x1b[45m',
|
|
41
|
-
bgCyan: '\x1b[46m',
|
|
42
|
-
bgWhite: '\x1b[47m'
|
|
9
|
+
reset: '\x1b[0m'
|
|
43
10
|
};
|
|
44
11
|
|
|
45
|
-
//
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function logHeader(message) {
|
|
51
|
-
console.log('\n' + colors.bright + colors.cyan + '='.repeat(60) + colors.reset);
|
|
52
|
-
console.log(colors.bright + colors.cyan + ' ' + message + colors.reset);
|
|
53
|
-
console.log(colors.bright + colors.cyan + '='.repeat(60) + colors.reset + '\n');
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function logStep(message) {
|
|
57
|
-
console.log('\n' + colors.bright + colors.blue + '➤ ' + message + colors.reset);
|
|
12
|
+
// Utility functions
|
|
13
|
+
function ensureDirectory(dirPath) {
|
|
14
|
+
if (!fs.existsSync(dirPath)) {
|
|
15
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
16
|
+
}
|
|
58
17
|
}
|
|
59
18
|
|
|
60
19
|
function logSuccess(message) {
|
|
61
|
-
console.log(colors.green
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function logInfo(message) {
|
|
65
|
-
console.log(colors.cyan + 'ℹ ' + message + colors.reset);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function logWarning(message) {
|
|
69
|
-
console.log(colors.yellow + '⚠ ' + message + colors.reset);
|
|
20
|
+
console.log(`${colors.green}✓ ${message}${colors.reset}`);
|
|
70
21
|
}
|
|
71
22
|
|
|
72
23
|
function logError(message) {
|
|
73
|
-
console.
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// Helper functions
|
|
77
|
-
function ensureDirectory(dir) {
|
|
78
|
-
const fullPath = path.resolve(process.cwd(), dir);
|
|
79
|
-
if (!fs.existsSync(fullPath)) {
|
|
80
|
-
fs.mkdirSync(fullPath, { recursive: true });
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function writeFile(filePath, content) {
|
|
87
|
-
const fullPath = path.resolve(process.cwd(), filePath);
|
|
88
|
-
const dir = path.dirname(fullPath);
|
|
89
|
-
|
|
90
|
-
if (!fs.existsSync(dir)) {
|
|
91
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
fs.writeFileSync(fullPath, content);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function copyFile(src, dest) {
|
|
98
|
-
const srcPath = path.resolve(process.cwd(), src);
|
|
99
|
-
const destPath = path.resolve(process.cwd(), dest);
|
|
100
|
-
|
|
101
|
-
if (fs.existsSync(srcPath)) {
|
|
102
|
-
const destDir = path.dirname(destPath);
|
|
103
|
-
if (!fs.existsSync(destDir)) {
|
|
104
|
-
fs.mkdirSync(destDir, { recursive: true });
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
fs.copyFileSync(srcPath, destPath);
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return false;
|
|
24
|
+
console.log(`${colors.red}✗ ${message}${colors.reset}`);
|
|
112
25
|
}
|
|
113
26
|
|
|
27
|
+
// Copy directory recursively
|
|
114
28
|
function copyDirectory(src, dest) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (!fs.existsSync(srcPath)) {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!fs.existsSync(destPath)) {
|
|
123
|
-
fs.mkdirSync(destPath, { recursive: true });
|
|
29
|
+
if (!fs.existsSync(src)) {
|
|
30
|
+
console.log(`⚠️ Warning: ${src} not found in package`);
|
|
31
|
+
return;
|
|
124
32
|
}
|
|
125
33
|
|
|
126
|
-
|
|
34
|
+
ensureDirectory(dest);
|
|
35
|
+
const items = fs.readdirSync(src);
|
|
127
36
|
|
|
128
|
-
for (const
|
|
129
|
-
const
|
|
130
|
-
const
|
|
37
|
+
for (const item of items) {
|
|
38
|
+
const srcPath = path.join(src, item);
|
|
39
|
+
const destPath = path.join(dest, item);
|
|
131
40
|
|
|
132
|
-
if (fs.statSync(
|
|
133
|
-
copyDirectory(
|
|
41
|
+
if (fs.statSync(srcPath).isDirectory()) {
|
|
42
|
+
copyDirectory(srcPath, destPath);
|
|
134
43
|
} else {
|
|
135
|
-
fs.copyFileSync(
|
|
44
|
+
fs.copyFileSync(srcPath, destPath);
|
|
136
45
|
}
|
|
137
46
|
}
|
|
138
|
-
|
|
139
|
-
return true;
|
|
140
47
|
}
|
|
141
48
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return false;
|
|
49
|
+
// Copy single file
|
|
50
|
+
function copyFile(src, dest) {
|
|
51
|
+
if (!fs.existsSync(src)) {
|
|
52
|
+
console.log(`⚠️ Warning: ${src} not found in package`);
|
|
53
|
+
return;
|
|
148
54
|
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Interactive prompt
|
|
152
|
-
function createReadlineInterface() {
|
|
153
|
-
return readline.createInterface({
|
|
154
|
-
input: process.stdin,
|
|
155
|
-
output: process.stdout
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
async function askQuestion(question) {
|
|
160
|
-
const rl = createReadlineInterface();
|
|
161
55
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
resolve(answer.toLowerCase());
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
async function askInput(question, defaultValue = '') {
|
|
171
|
-
const rl = createReadlineInterface();
|
|
56
|
+
// Ensure destination directory exists
|
|
57
|
+
const destDir = path.dirname(dest);
|
|
58
|
+
ensureDirectory(destDir);
|
|
172
59
|
|
|
173
|
-
|
|
174
|
-
rl.question(colors.yellow + '? ' + question + (defaultValue ? ` (${defaultValue})` : '') + ': ' + colors.reset, answer => {
|
|
175
|
-
rl.close();
|
|
176
|
-
resolve(answer || defaultValue);
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// Create rule files
|
|
182
|
-
function createRuleFiles() {
|
|
183
|
-
// Create integrity-and-test-ethics.md
|
|
184
|
-
const integrityContent = `# Integrity and Test Ethics
|
|
185
|
-
|
|
186
|
-
THIS IS THE MOST CRITICAL RULE. Be ethical, truthful, honest above all.
|
|
187
|
-
|
|
188
|
-
## Core Principles
|
|
189
|
-
|
|
190
|
-
1. **Honesty in Testing**: Never fake test results or evidence. If a test fails, report it accurately.
|
|
191
|
-
2. **Transparency**: Always disclose limitations, edge cases, and potential issues.
|
|
192
|
-
3. **Ethical Code Generation**: Generate code that respects privacy, security, and user consent.
|
|
193
|
-
4. **Accurate Representation**: Never claim functionality that doesn't exist or isn't implemented.
|
|
194
|
-
5. **Intellectual Property Respect**: Properly attribute sources and respect licensing terms.
|
|
195
|
-
|
|
196
|
-
## Test Ethics Guidelines
|
|
197
|
-
|
|
198
|
-
- **No Fabrication**: Never fabricate test results or evidence
|
|
199
|
-
- **Complete Reporting**: Report all test failures, not just successes
|
|
200
|
-
- **Reproducible Tests**: Ensure tests are reproducible and deterministic
|
|
201
|
-
- **Edge Case Honesty**: Explicitly document edge cases that aren't handled
|
|
202
|
-
- **Performance Transparency**: Be honest about performance limitations
|
|
203
|
-
|
|
204
|
-
## Implementation Ethics
|
|
205
|
-
|
|
206
|
-
- **Security First**: Never suggest insecure implementations for convenience
|
|
207
|
-
- **Privacy Respect**: Handle user data with appropriate protections
|
|
208
|
-
- **Accessibility**: Consider accessibility implications in all designs
|
|
209
|
-
- **Documentation**: Document known limitations and issues
|
|
210
|
-
- **Attribution**: Properly attribute external code sources and inspirations`;
|
|
211
|
-
writeFile('.ai-agents/rules/integrity-and-test-ethics.md', integrityContent);
|
|
212
|
-
logSuccess('Created integrity-and-test-ethics.md');
|
|
213
|
-
|
|
214
|
-
// Create simplicity.md
|
|
215
|
-
const simplicityContent = `# Simplicity
|
|
216
|
-
|
|
217
|
-
Keep solutions simple and focused, avoid over-engineering.
|
|
218
|
-
|
|
219
|
-
## Core Principles
|
|
220
|
-
|
|
221
|
-
1. **Focus on the Current Issue**: When fixing an issue, focus only on that issue.
|
|
222
|
-
2. **Avoid Premature Optimization**: Don't optimize code until there's a demonstrated need.
|
|
223
|
-
3. **Minimize Dependencies**: Add new dependencies only when absolutely necessary.
|
|
224
|
-
4. **Readable Over Clever**: Prefer readable code over clever solutions.
|
|
225
|
-
5. **Incremental Changes**: Make small, focused changes rather than large rewrites.
|
|
226
|
-
|
|
227
|
-
## Guidelines
|
|
228
|
-
|
|
229
|
-
- **Single Responsibility**: Each function, class, or module should have a single responsibility
|
|
230
|
-
- **Explicit Over Implicit**: Favor explicit code over implicit behavior
|
|
231
|
-
- **Standard Patterns**: Use standard patterns and idioms when possible
|
|
232
|
-
- **Minimal API Surface**: Keep public APIs minimal and focused
|
|
233
|
-
- **Avoid Premature Abstraction**: Don't abstract until you see repeated patterns
|
|
234
|
-
|
|
235
|
-
## When Fixing Issues
|
|
236
|
-
|
|
237
|
-
- Focus only on the specific issue at hand
|
|
238
|
-
- Avoid making unrelated changes
|
|
239
|
-
- File separate issues for other problems you discover
|
|
240
|
-
- Keep the scope narrow and well-defined`;
|
|
241
|
-
writeFile('.ai-agents/rules/simplicity.md', simplicityContent);
|
|
242
|
-
logSuccess('Created simplicity.md');
|
|
243
|
-
|
|
244
|
-
// Create architecture.md
|
|
245
|
-
const architectureContent = `# Architecture
|
|
246
|
-
|
|
247
|
-
Maintain clean architectural boundaries by using appropriate technologies for each task.
|
|
248
|
-
|
|
249
|
-
## Core Principles
|
|
250
|
-
|
|
251
|
-
1. **Separation of Concerns**: Keep different parts of the system focused on their specific responsibilities.
|
|
252
|
-
2. **Clean Interfaces**: Define clear interfaces between components.
|
|
253
|
-
3. **Appropriate Technologies**: Use the right tool for each job.
|
|
254
|
-
4. **Testability**: Design components to be easily testable.
|
|
255
|
-
5. **Scalability**: Consider how the architecture will scale with increased load or complexity.
|
|
256
|
-
|
|
257
|
-
## Guidelines
|
|
258
|
-
|
|
259
|
-
- **Domain-Driven Design**: Model the system around the business domain
|
|
260
|
-
- **Layered Architecture**: Maintain clear separation between layers
|
|
261
|
-
- **Dependency Injection**: Use dependency injection for flexible component composition
|
|
262
|
-
- **Interface-First Design**: Define interfaces before implementations
|
|
263
|
-
- **Consistent Patterns**: Apply consistent patterns throughout the codebase
|
|
264
|
-
|
|
265
|
-
## Technology Selection
|
|
266
|
-
|
|
267
|
-
- Use natural language processing technologies for language understanding tasks
|
|
268
|
-
- Use deterministic code for business logic and data processing
|
|
269
|
-
- Select appropriate data storage technologies based on access patterns
|
|
270
|
-
- Choose UI frameworks based on application requirements and team expertise`;
|
|
271
|
-
writeFile('.ai-agents/rules/architecture.md', architectureContent);
|
|
272
|
-
logSuccess('Created architecture.md');
|
|
273
|
-
|
|
274
|
-
// Create continuous-learning.md
|
|
275
|
-
const continuousLearningContent = `# Continuous Learning
|
|
276
|
-
|
|
277
|
-
Prevent repeating past mistakes by systematically learning from retrospectives, RFCs, and historical issue patterns.
|
|
278
|
-
|
|
279
|
-
## Core Principles
|
|
280
|
-
|
|
281
|
-
1. **Learn from History**: Review past issues and solutions before starting similar work.
|
|
282
|
-
2. **Document Learnings**: Capture insights in retrospectives and knowledge bases.
|
|
283
|
-
3. **Share Knowledge**: Ensure learnings are accessible to all team members.
|
|
284
|
-
4. **Evolve Practices**: Continuously refine processes based on experience.
|
|
285
|
-
5. **Anticipate Issues**: Use historical patterns to predict and prevent problems.
|
|
286
|
-
|
|
287
|
-
## Guidelines
|
|
288
|
-
|
|
289
|
-
- **Review Retrospectives**: Always review relevant retrospectives before starting work
|
|
290
|
-
- **RFC Analysis**: Study RFCs for design decisions and rationales
|
|
291
|
-
- **Pattern Recognition**: Identify recurring issues and their root causes
|
|
292
|
-
- **Knowledge Base**: Contribute to and utilize the team's knowledge base
|
|
293
|
-
- **Feedback Loops**: Create tight feedback loops for rapid learning
|
|
294
|
-
|
|
295
|
-
## Implementation
|
|
296
|
-
|
|
297
|
-
- Before starting work on an issue, search for similar past issues
|
|
298
|
-
- Review retrospectives from related features or components
|
|
299
|
-
- Check knowledge base for relevant patterns and anti-patterns
|
|
300
|
-
- Document new learnings after completing work
|
|
301
|
-
- Share insights with the team through appropriate channels`;
|
|
302
|
-
writeFile('.ai-agents/rules/continuous-learning.md', continuousLearningContent);
|
|
303
|
-
logSuccess('Created continuous-learning.md');
|
|
304
|
-
|
|
305
|
-
// Create successful-debugging-patterns.md
|
|
306
|
-
const debuggingContent = `# Successful Debugging Patterns
|
|
307
|
-
|
|
308
|
-
Debug issues systematically and convert learnings into test cases.
|
|
309
|
-
|
|
310
|
-
## Core Principles
|
|
311
|
-
|
|
312
|
-
1. **Systematic Approach**: Follow a structured debugging methodology.
|
|
313
|
-
2. **Evidence-Based**: Base conclusions on evidence, not assumptions.
|
|
314
|
-
3. **Root Cause Analysis**: Identify the root cause, not just symptoms.
|
|
315
|
-
4. **Test Case Creation**: Create tests that verify the fix and prevent regression.
|
|
316
|
-
5. **Knowledge Sharing**: Document findings for future reference.
|
|
317
|
-
|
|
318
|
-
## Debugging Methodology
|
|
319
|
-
|
|
320
|
-
1. **Reproduce**: Create a reliable reproduction of the issue
|
|
321
|
-
2. **Isolate**: Narrow down the scope to the smallest possible area
|
|
322
|
-
3. **Hypothesize**: Form testable hypotheses about the cause
|
|
323
|
-
4. **Test**: Verify or disprove each hypothesis systematically
|
|
324
|
-
5. **Fix**: Address the root cause, not just symptoms
|
|
325
|
-
6. **Verify**: Confirm the fix resolves the issue
|
|
326
|
-
7. **Prevent**: Add tests to prevent regression
|
|
327
|
-
|
|
328
|
-
## Best Practices
|
|
329
|
-
|
|
330
|
-
- Use logging strategically to gather information
|
|
331
|
-
- Leverage debugging tools appropriate for the technology
|
|
332
|
-
- Break complex issues into smaller, testable components
|
|
333
|
-
- Document the debugging process and findings
|
|
334
|
-
- Create regression tests that would have caught the issue`;
|
|
335
|
-
writeFile('.ai-agents/rules/successful-debugging-patterns.md', debuggingContent);
|
|
336
|
-
logSuccess('Created successful-debugging-patterns.md');
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Create workflow templates
|
|
340
|
-
function createWorkflowTemplates() {
|
|
341
|
-
// Create design.md
|
|
342
|
-
const designContent = `# Design Phase Workflow
|
|
343
|
-
|
|
344
|
-
## Overview
|
|
345
|
-
This workflow guides the design phase for new features or significant changes.
|
|
346
|
-
|
|
347
|
-
## Steps
|
|
348
|
-
|
|
349
|
-
### 1. Understand Requirements
|
|
350
|
-
- Review the issue description thoroughly
|
|
351
|
-
- Clarify any ambiguities with stakeholders
|
|
352
|
-
- Identify acceptance criteria and constraints
|
|
353
|
-
|
|
354
|
-
### 2. Research
|
|
355
|
-
- Review similar features in the codebase
|
|
356
|
-
- Check retrospectives for related work
|
|
357
|
-
- Research industry best practices
|
|
358
|
-
- Identify potential technical approaches
|
|
359
|
-
|
|
360
|
-
### 3. Create RFC Document
|
|
361
|
-
- Create a new RFC document in docs/rfcs/
|
|
362
|
-
- Follow the RFC template structure
|
|
363
|
-
- Include:
|
|
364
|
-
- Problem statement
|
|
365
|
-
- Proposed solution
|
|
366
|
-
- Alternative approaches considered
|
|
367
|
-
- Implementation plan
|
|
368
|
-
- Testing strategy
|
|
369
|
-
- Rollout plan
|
|
370
|
-
|
|
371
|
-
### 4. Design Review
|
|
372
|
-
- Submit RFC for review
|
|
373
|
-
- Address feedback and iterate
|
|
374
|
-
- Get final approval from stakeholders
|
|
375
|
-
|
|
376
|
-
### 5. Transition to Implementation
|
|
377
|
-
- Update issue with design decisions
|
|
378
|
-
- Add implementation tasks
|
|
379
|
-
- Apply "status:ready-for-implementation" label
|
|
380
|
-
|
|
381
|
-
## Deliverables
|
|
382
|
-
- Comprehensive RFC document
|
|
383
|
-
- Updated issue with implementation tasks
|
|
384
|
-
- Design approval from stakeholders`;
|
|
385
|
-
writeFile('.ai-agents/workflows/design.md', designContent);
|
|
386
|
-
logSuccess('Created design.md workflow');
|
|
387
|
-
|
|
388
|
-
// Create implement.md
|
|
389
|
-
const implementContent = `# Implementation Phase Workflow
|
|
390
|
-
|
|
391
|
-
## Overview
|
|
392
|
-
This workflow guides the implementation phase after design approval.
|
|
393
|
-
|
|
394
|
-
## Steps
|
|
395
|
-
|
|
396
|
-
### 1. Prepare Development Environment
|
|
397
|
-
- Create a feature branch from master
|
|
398
|
-
- Set up local development environment
|
|
399
|
-
- Verify test environment is working
|
|
400
|
-
|
|
401
|
-
### 2. Implementation Planning
|
|
402
|
-
- Break down work into manageable tasks
|
|
403
|
-
- Prioritize tasks in logical order
|
|
404
|
-
- Create a test plan for the implementation
|
|
405
|
-
|
|
406
|
-
### 3. Iterative Development
|
|
407
|
-
- Implement features in small, testable increments
|
|
408
|
-
- Write tests alongside code
|
|
409
|
-
- Commit frequently with descriptive messages
|
|
410
|
-
- Keep changes focused on the current issue
|
|
411
|
-
|
|
412
|
-
### 4. Testing
|
|
413
|
-
- Run existing tests to ensure no regressions
|
|
414
|
-
- Add new tests for added functionality
|
|
415
|
-
- Test edge cases and error conditions
|
|
416
|
-
- Document test evidence
|
|
417
|
-
|
|
418
|
-
### 5. Code Review Preparation
|
|
419
|
-
- Self-review code for quality and standards
|
|
420
|
-
- Ensure all tests are passing
|
|
421
|
-
- Update documentation as needed
|
|
422
|
-
- Prepare PR description with implementation details
|
|
423
|
-
|
|
424
|
-
### 6. Submit Pull Request
|
|
425
|
-
- Create PR with comprehensive description
|
|
426
|
-
- Link to the original issue
|
|
427
|
-
- Include test evidence
|
|
428
|
-
- Request review from appropriate reviewers
|
|
429
|
-
|
|
430
|
-
## Deliverables
|
|
431
|
-
- Working implementation of the feature
|
|
432
|
-
- Comprehensive test coverage
|
|
433
|
-
- Updated documentation
|
|
434
|
-
- Pull request ready for review`;
|
|
435
|
-
writeFile('.ai-agents/workflows/implement.md', implementContent);
|
|
436
|
-
logSuccess('Created implement.md workflow');
|
|
437
|
-
|
|
438
|
-
// Create test.md
|
|
439
|
-
const testContent = `# Testing Phase Workflow
|
|
440
|
-
|
|
441
|
-
## Overview
|
|
442
|
-
This workflow guides the testing phase to ensure quality and reliability.
|
|
443
|
-
|
|
444
|
-
## Steps
|
|
445
|
-
|
|
446
|
-
### 1. Test Planning
|
|
447
|
-
- Review requirements and acceptance criteria
|
|
448
|
-
- Identify test scenarios and edge cases
|
|
449
|
-
- Create a test plan document
|
|
450
|
-
- Define test data requirements
|
|
451
|
-
|
|
452
|
-
### 2. Test Implementation
|
|
453
|
-
- Implement unit tests for individual components
|
|
454
|
-
- Create integration tests for component interactions
|
|
455
|
-
- Develop end-to-end tests for user flows
|
|
456
|
-
- Write performance tests if applicable
|
|
457
|
-
|
|
458
|
-
### 3. Test Execution
|
|
459
|
-
- Run all tests in development environment
|
|
460
|
-
- Document test results and evidence
|
|
461
|
-
- Investigate and fix any test failures
|
|
462
|
-
- Verify fixes with additional test runs
|
|
463
|
-
|
|
464
|
-
### 4. Edge Case and Error Testing
|
|
465
|
-
- Test boundary conditions
|
|
466
|
-
- Verify error handling and recovery
|
|
467
|
-
- Test with invalid or unexpected inputs
|
|
468
|
-
- Verify security constraints
|
|
469
|
-
|
|
470
|
-
### 5. Documentation
|
|
471
|
-
- Document test coverage
|
|
472
|
-
- Record test evidence (screenshots, logs)
|
|
473
|
-
- Update test documentation
|
|
474
|
-
- Document any known limitations
|
|
475
|
-
|
|
476
|
-
### 6. Test Review
|
|
477
|
-
- Review test results with stakeholders
|
|
478
|
-
- Address any feedback or concerns
|
|
479
|
-
- Get approval for test completion
|
|
480
|
-
- Apply "status:approved" label when tests pass
|
|
481
|
-
|
|
482
|
-
## Deliverables
|
|
483
|
-
- Comprehensive test suite
|
|
484
|
-
- Test evidence documentation
|
|
485
|
-
- Test coverage report
|
|
486
|
-
- Stakeholder approval of test results`;
|
|
487
|
-
writeFile('.ai-agents/workflows/test.md', testContent);
|
|
488
|
-
logSuccess('Created test.md workflow');
|
|
489
|
-
|
|
490
|
-
// Create resolve.md
|
|
491
|
-
const resolveContent = `# Issue Resolution Workflow
|
|
492
|
-
|
|
493
|
-
## Overview
|
|
494
|
-
This workflow guides the process of resolving issues and bugs.
|
|
495
|
-
|
|
496
|
-
## Steps
|
|
497
|
-
|
|
498
|
-
### 1. Issue Triage
|
|
499
|
-
- Verify the issue can be reproduced
|
|
500
|
-
- Assess severity and priority
|
|
501
|
-
- Identify affected components
|
|
502
|
-
- Determine if it's a regression
|
|
503
|
-
|
|
504
|
-
### 2. Investigation
|
|
505
|
-
- Reproduce the issue consistently
|
|
506
|
-
- Identify the root cause through debugging
|
|
507
|
-
- Document findings and affected code paths
|
|
508
|
-
- Create a minimal reproduction if possible
|
|
509
|
-
|
|
510
|
-
### 3. Solution Design
|
|
511
|
-
- Design a fix that addresses the root cause
|
|
512
|
-
- Consider potential side effects
|
|
513
|
-
- Ensure backward compatibility if needed
|
|
514
|
-
- Document the proposed solution
|
|
515
|
-
|
|
516
|
-
### 4. Implementation
|
|
517
|
-
- Create a fix branch from master
|
|
518
|
-
- Implement the solution
|
|
519
|
-
- Add tests that would have caught the issue
|
|
520
|
-
- Verify the fix resolves the issue
|
|
521
|
-
|
|
522
|
-
### 5. Testing
|
|
523
|
-
- Run existing tests to ensure no regressions
|
|
524
|
-
- Test the specific fix thoroughly
|
|
525
|
-
- Document test evidence
|
|
526
|
-
- Verify edge cases are handled
|
|
527
|
-
|
|
528
|
-
### 6. Code Review and Merge
|
|
529
|
-
- Submit PR with detailed description
|
|
530
|
-
- Include reproduction steps and fix explanation
|
|
531
|
-
- Request review from appropriate reviewers
|
|
532
|
-
- Address feedback and iterate as needed
|
|
533
|
-
|
|
534
|
-
### 7. Verification
|
|
535
|
-
- Verify fix in production or staging
|
|
536
|
-
- Document verification evidence
|
|
537
|
-
- Close the issue with reference to the fix
|
|
538
|
-
|
|
539
|
-
## Deliverables
|
|
540
|
-
- Root cause analysis
|
|
541
|
-
- Fixed implementation
|
|
542
|
-
- Tests that prevent regression
|
|
543
|
-
- Documentation of the resolution`;
|
|
544
|
-
writeFile('.ai-agents/workflows/resolve.md', resolveContent);
|
|
545
|
-
logSuccess('Created resolve.md workflow');
|
|
546
|
-
|
|
547
|
-
// Create retrospect.md
|
|
548
|
-
const retrospectContent = `# Retrospective Workflow
|
|
549
|
-
|
|
550
|
-
## Overview
|
|
551
|
-
This workflow guides the process of conducting retrospectives after completing significant work.
|
|
552
|
-
|
|
553
|
-
## Steps
|
|
554
|
-
|
|
555
|
-
### 1. Preparation
|
|
556
|
-
- Schedule retrospective meeting
|
|
557
|
-
- Gather metrics and data about the work
|
|
558
|
-
- Review issue history and PRs
|
|
559
|
-
- Identify key events and milestones
|
|
560
|
-
|
|
561
|
-
### 2. Retrospective Meeting
|
|
562
|
-
- Review what went well
|
|
563
|
-
- Identify what could be improved
|
|
564
|
-
- Discuss unexpected challenges
|
|
565
|
-
- Recognize team and individual contributions
|
|
566
|
-
|
|
567
|
-
### 3. Root Cause Analysis
|
|
568
|
-
- Analyze issues and challenges
|
|
569
|
-
- Identify root causes, not just symptoms
|
|
570
|
-
- Look for patterns across multiple issues
|
|
571
|
-
- Consider process and technical factors
|
|
572
|
-
|
|
573
|
-
### 4. Action Items
|
|
574
|
-
- Create specific, actionable improvements
|
|
575
|
-
- Assign owners to action items
|
|
576
|
-
- Set deadlines for implementation
|
|
577
|
-
- Create issues for tracking action items
|
|
578
|
-
|
|
579
|
-
### 5. Documentation
|
|
580
|
-
- Document retrospective findings
|
|
581
|
-
- Create retrospective document in /retrospectives/
|
|
582
|
-
- Include metrics, learnings, and action items
|
|
583
|
-
- Share with the team and stakeholders
|
|
584
|
-
|
|
585
|
-
### 6. Follow-up
|
|
586
|
-
- Track progress on action items
|
|
587
|
-
- Implement process improvements
|
|
588
|
-
- Update documentation and guidelines
|
|
589
|
-
- Reference learnings in future work
|
|
590
|
-
|
|
591
|
-
## Deliverables
|
|
592
|
-
- Retrospective document with findings
|
|
593
|
-
- Action items with owners and deadlines
|
|
594
|
-
- Updated processes and guidelines
|
|
595
|
-
- Knowledge sharing with the team`;
|
|
596
|
-
writeFile('.ai-agents/workflows/retrospect.md', retrospectContent);
|
|
597
|
-
logSuccess('Created retrospect.md workflow');
|
|
60
|
+
fs.copyFileSync(src, dest);
|
|
598
61
|
}
|
|
599
62
|
|
|
600
|
-
// Create
|
|
601
|
-
function
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
ensureDirectory('.ai-agents/templates/specs');
|
|
608
|
-
ensureDirectory('.ai-agents/templates/help');
|
|
609
|
-
ensureDirectory('.ai-agents/scripts');
|
|
610
|
-
ensureDirectory('examples/simple-webapp');
|
|
611
|
-
ensureDirectory('.github/workflows');
|
|
612
|
-
ensureDirectory('docs');
|
|
63
|
+
// Create GitHub labels from labels.json
|
|
64
|
+
function createGitHubLabels() {
|
|
65
|
+
const labelsPath = path.join(__dirname, 'labels.json');
|
|
66
|
+
if (!fs.existsSync(labelsPath)) {
|
|
67
|
+
console.log('⚠️ Warning: labels.json not found in package');
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
613
70
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
// Create BUGFIX template
|
|
617
|
-
const bugfixTemplate = `Issue: #<issue>
|
|
618
|
-
|
|
619
|
-
## Tests
|
|
620
|
-
- Could be existing tests that are failing and need to be fixed
|
|
621
|
-
- Could be new tests that need to be added into an existing test suite
|
|
622
|
-
- Could be a new test suite
|
|
623
|
-
`;
|
|
624
|
-
writeFile('.ai-agents/templates/specs/BUGSPEC-TEMPLATE.md', bugfixTemplate);
|
|
625
|
-
logSuccess('Created BUGSPEC-TEMPLATE.md');
|
|
626
|
-
|
|
627
|
-
// Create RFC template
|
|
628
|
-
const rfcTemplate = `# RFC: <Title>
|
|
629
|
-
|
|
630
|
-
Issue: #<issue>
|
|
631
|
-
Owner: <agent>
|
|
632
|
-
|
|
633
|
-
## Design Details
|
|
634
|
-
- User Experience changes (incl. all modalities currently supported: see codebase to know which ones)
|
|
635
|
-
- API surface (OpenAPI) changes
|
|
636
|
-
- Data model / schema changes
|
|
637
|
-
- Failure modes & timeouts
|
|
638
|
-
- Telemetry & analytics
|
|
639
|
-
|
|
640
|
-
## Test Matrix
|
|
641
|
-
- Unit: modules & edge cases
|
|
642
|
-
- Integration: API <-> DB <-> external
|
|
643
|
-
- E2E: user flows (happy/sad)`;
|
|
644
|
-
writeFile('.ai-agents/templates/specs/FEATURESPEC-TEMPLATE.md', rfcTemplate);
|
|
645
|
-
logSuccess('Created FEATURESPEC-TEMPLATE.md');
|
|
646
|
-
|
|
647
|
-
// Copy all rule files from the package
|
|
648
|
-
copyRuleFiles();
|
|
649
|
-
logSuccess('Created rule files');
|
|
650
|
-
|
|
651
|
-
// Create workflow templates
|
|
652
|
-
createWorkflowTemplates();
|
|
653
|
-
logSuccess('Created workflow templates');
|
|
71
|
+
const labelsContent = fs.readFileSync(labelsPath, 'utf8');
|
|
72
|
+
const labels = JSON.parse(labelsContent);
|
|
654
73
|
|
|
655
|
-
//
|
|
656
|
-
|
|
657
|
-
logSuccess('
|
|
74
|
+
// Create labels.json in the target directory
|
|
75
|
+
fs.writeFileSync('labels.json', labelsContent);
|
|
76
|
+
logSuccess('Created labels.json');
|
|
77
|
+
}
|
|
658
78
|
|
|
659
|
-
|
|
79
|
+
// Create CODEOWNERS file
|
|
80
|
+
function createCodeOwners() {
|
|
660
81
|
const codeownersContent = `# This file defines the code owners for the repository
|
|
661
82
|
# Code owners are automatically requested for review when someone opens a PR that modifies code they own
|
|
662
83
|
# See: https://docs.github.com/en/repositories/managing-your-codebase-in-github/about-code-owners
|
|
663
84
|
|
|
664
|
-
#
|
|
665
|
-
*
|
|
85
|
+
# Global ownership - all files
|
|
86
|
+
* @${process.env.USER || 'repo-owner'}
|
|
666
87
|
|
|
667
|
-
#
|
|
668
|
-
/
|
|
669
|
-
/workflows/ @${process.env.USER || 'repo-owner'}
|
|
670
|
-
/templates/ @${process.env.USER || 'repo-owner'}
|
|
671
|
-
/scripts/ @${process.env.USER || 'repo-owner'}
|
|
672
|
-
/.github/ @${process.env.USER || 'repo-owner'}
|
|
88
|
+
# AI agents rules and workflows
|
|
89
|
+
/.ai-agents/ @${process.env.USER || 'repo-owner'}
|
|
673
90
|
|
|
674
|
-
#
|
|
675
|
-
/
|
|
676
|
-
|
|
677
|
-
|
|
91
|
+
# GitHub workflows
|
|
92
|
+
/.github/ @${process.env.USER || 'repo-owner'}
|
|
93
|
+
`;
|
|
94
|
+
|
|
95
|
+
fs.writeFileSync('CODEOWNERS', codeownersContent);
|
|
678
96
|
logSuccess('Created CODEOWNERS file');
|
|
97
|
+
}
|
|
679
98
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
<!-- Provide a brief description of the changes in this PR -->
|
|
685
|
-
|
|
686
|
-
## Related Issue
|
|
687
|
-
<!-- Link to the issue this PR addresses (use format: Closes #123, Fixes #123) -->
|
|
688
|
-
|
|
689
|
-
## Type of Change
|
|
690
|
-
<!-- Mark the appropriate option with an [x] -->
|
|
691
|
-
- [ ] Bug fix
|
|
692
|
-
- [ ] New feature
|
|
693
|
-
- [ ] Documentation update
|
|
694
|
-
- [ ] Code refactoring
|
|
695
|
-
- [ ] Performance improvement
|
|
696
|
-
- [ ] Tests
|
|
697
|
-
- [ ] Build/CI changes
|
|
698
|
-
- [ ] Other (please describe):
|
|
99
|
+
// Create PR template
|
|
100
|
+
function createPRTemplate() {
|
|
101
|
+
const prTemplateContent = `## Summary
|
|
102
|
+
Brief description of changes
|
|
699
103
|
|
|
700
|
-
##
|
|
701
|
-
|
|
104
|
+
## Changes Made
|
|
105
|
+
- [ ] Change 1
|
|
106
|
+
- [ ] Change 2
|
|
702
107
|
|
|
703
108
|
## Testing
|
|
704
|
-
|
|
705
|
-
- [ ]
|
|
706
|
-
- [ ] Added integration tests
|
|
707
|
-
- [ ] Manually tested
|
|
708
|
-
- [ ] Test exempt (explain why)
|
|
109
|
+
- [ ] Test 1
|
|
110
|
+
- [ ] Test 2
|
|
709
111
|
|
|
710
|
-
##
|
|
711
|
-
|
|
112
|
+
## Related Issues
|
|
113
|
+
Closes #
|
|
114
|
+
|
|
115
|
+
## Screenshots (if applicable)
|
|
116
|
+
<!-- Add screenshots here -->
|
|
712
117
|
|
|
713
118
|
## Checklist
|
|
714
|
-
<!-- Mark items with [x] once completed -->
|
|
715
119
|
- [ ] Code follows project style guidelines
|
|
716
|
-
- [ ]
|
|
717
|
-
- [ ]
|
|
718
|
-
- [ ]
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
## Additional Notes
|
|
722
|
-
<!-- Any additional information that might be helpful for reviewers -->`;
|
|
723
|
-
writeFile('.github/pull_request_template.md', prTemplateContent);
|
|
724
|
-
logSuccess('Created PR template');
|
|
725
|
-
|
|
726
|
-
// Create labels.json
|
|
727
|
-
const labelsContent = `[
|
|
728
|
-
{
|
|
729
|
-
"name": "aiagents",
|
|
730
|
-
"color": "0e8a16",
|
|
731
|
-
"description": "Issue prepared for AI agent collaboration"
|
|
732
|
-
},
|
|
733
|
-
{
|
|
734
|
-
"name": "status:ready-for-design",
|
|
735
|
-
"color": "0075ca",
|
|
736
|
-
"description": "Issue is ready for design phase"
|
|
737
|
-
},
|
|
738
|
-
{
|
|
739
|
-
"name": "status:in-design",
|
|
740
|
-
"color": "0075ca",
|
|
741
|
-
"description": "Issue is currently in design phase"
|
|
742
|
-
},
|
|
743
|
-
{
|
|
744
|
-
"name": "status:ready-for-implementation",
|
|
745
|
-
"color": "7057ff",
|
|
746
|
-
"description": "Issue is ready for implementation phase"
|
|
747
|
-
},
|
|
748
|
-
{
|
|
749
|
-
"name": "status:in-implementation",
|
|
750
|
-
"color": "7057ff",
|
|
751
|
-
"description": "Issue is currently in implementation phase"
|
|
752
|
-
},
|
|
753
|
-
{
|
|
754
|
-
"name": "status:ready-for-testing",
|
|
755
|
-
"color": "008672",
|
|
756
|
-
"description": "Issue is ready for testing phase"
|
|
757
|
-
},
|
|
758
|
-
{
|
|
759
|
-
"name": "status:in-testing",
|
|
760
|
-
"color": "008672",
|
|
761
|
-
"description": "Issue is currently in testing phase"
|
|
762
|
-
},
|
|
763
|
-
{
|
|
764
|
-
"name": "status:test-exempt",
|
|
765
|
-
"color": "c5def5",
|
|
766
|
-
"description": "Implementation is exempt from test requirements"
|
|
767
|
-
},
|
|
768
|
-
{
|
|
769
|
-
"name": "status:blocked",
|
|
770
|
-
"color": "d73a4a",
|
|
771
|
-
"description": "Issue is blocked by another issue or external factor"
|
|
772
|
-
},
|
|
773
|
-
{
|
|
774
|
-
"name": "status:needs-review",
|
|
775
|
-
"color": "fbca04",
|
|
776
|
-
"description": "Issue or PR needs review"
|
|
777
|
-
},
|
|
778
|
-
{
|
|
779
|
-
"name": "status:approved",
|
|
780
|
-
"color": "0e8a16",
|
|
781
|
-
"description": "Issue or PR has been approved"
|
|
782
|
-
},
|
|
783
|
-
{
|
|
784
|
-
"name": "status:needs-revision",
|
|
785
|
-
"color": "d93f0b",
|
|
786
|
-
"description": "Issue or PR needs revision based on feedback"
|
|
787
|
-
},
|
|
788
|
-
{
|
|
789
|
-
"name": "priority:high",
|
|
790
|
-
"color": "d93f0b",
|
|
791
|
-
"description": "High priority issue"
|
|
792
|
-
},
|
|
793
|
-
{
|
|
794
|
-
"name": "priority:medium",
|
|
795
|
-
"color": "fbca04",
|
|
796
|
-
"description": "Medium priority issue"
|
|
797
|
-
},
|
|
798
|
-
{
|
|
799
|
-
"name": "priority:low",
|
|
800
|
-
"color": "c5def5",
|
|
801
|
-
"description": "Low priority issue"
|
|
802
|
-
}
|
|
803
|
-
]`;
|
|
804
|
-
writeFile('labels.json', labelsContent);
|
|
805
|
-
logSuccess('Created labels.json');
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
// Copy rule files from the package
|
|
809
|
-
function copyRuleFiles() {
|
|
810
|
-
const fs = require('fs');
|
|
811
|
-
const path = require('path');
|
|
812
|
-
|
|
813
|
-
// List of rule files to copy
|
|
814
|
-
const ruleFiles = [
|
|
815
|
-
'agent-testing-guidelines.md',
|
|
816
|
-
'architecture.md',
|
|
817
|
-
'communication.md',
|
|
818
|
-
'continuous-learning.md',
|
|
819
|
-
'git-safe-commands.md',
|
|
820
|
-
'integrity-and-test-ethics.md',
|
|
821
|
-
'local-development.md',
|
|
822
|
-
'merge-requirements.md',
|
|
823
|
-
'pr-workflow-completeness.md',
|
|
824
|
-
'simplicity.md',
|
|
825
|
-
'software-development-lifecycle.md',
|
|
826
|
-
'spike-first-development.md',
|
|
827
|
-
'successful-debugging-patterns.md'
|
|
828
|
-
];
|
|
829
|
-
|
|
830
|
-
// Copy each rule file
|
|
831
|
-
ruleFiles.forEach(file => {
|
|
832
|
-
try {
|
|
833
|
-
const sourcePath = path.join(__dirname, '.ai-agents', 'rules', file);
|
|
834
|
-
const destPath = path.join('.ai-agents', 'rules', file);
|
|
835
|
-
|
|
836
|
-
if (fs.existsSync(sourcePath)) {
|
|
837
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
838
|
-
logSuccess(`Copied ${file}`);
|
|
839
|
-
} else {
|
|
840
|
-
console.log(`⚠️ Warning: ${file} not found in package`);
|
|
841
|
-
}
|
|
842
|
-
} catch (error) {
|
|
843
|
-
console.log(`⚠️ Warning: Could not copy ${file}: ${error.message}`);
|
|
844
|
-
}
|
|
845
|
-
});
|
|
846
|
-
|
|
847
|
-
// Copy workflow files
|
|
848
|
-
const workflowFiles = [
|
|
849
|
-
'design.md',
|
|
850
|
-
'implement.md',
|
|
851
|
-
'resolve.md',
|
|
852
|
-
'retrospect.md',
|
|
853
|
-
'spec.md',
|
|
854
|
-
'test.md'
|
|
855
|
-
];
|
|
856
|
-
|
|
857
|
-
workflowFiles.forEach(file => {
|
|
858
|
-
try {
|
|
859
|
-
const sourcePath = path.join(__dirname, '.ai-agents', 'workflows', file);
|
|
860
|
-
const destPath = path.join('.ai-agents', 'workflows', file);
|
|
861
|
-
|
|
862
|
-
if (fs.existsSync(sourcePath)) {
|
|
863
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
864
|
-
logSuccess(`Copied ${file}`);
|
|
865
|
-
} else {
|
|
866
|
-
console.log(`⚠️ Warning: ${file} not found in package`);
|
|
867
|
-
}
|
|
868
|
-
} catch (error) {
|
|
869
|
-
console.log(`⚠️ Warning: Could not copy ${file}: ${error.message}`);
|
|
870
|
-
}
|
|
871
|
-
});
|
|
872
|
-
|
|
873
|
-
// Copy template files
|
|
874
|
-
const templateFiles = [
|
|
875
|
-
'templates/evidence/Design-Evidence.md',
|
|
876
|
-
'templates/evidence/Implementation-BugEvidence.md',
|
|
877
|
-
'templates/evidence/Implementation-FeatureEvidence.md',
|
|
878
|
-
'templates/evidence/Spec-Evidence.md',
|
|
879
|
-
'templates/help/HelpNeeded.md',
|
|
880
|
-
'templates/retrospective/RETROSPECTIVE-TEMPLATE.md',
|
|
881
|
-
'templates/specs/BUGSPEC-TEMPLATE.md',
|
|
882
|
-
'templates/specs/FEATURESPEC-TEMPLATE.md',
|
|
883
|
-
'templates/specs/TECHSPEC-TEMPLATE.md'
|
|
884
|
-
];
|
|
885
|
-
|
|
886
|
-
templateFiles.forEach(file => {
|
|
887
|
-
try {
|
|
888
|
-
const sourcePath = path.join(__dirname, '.ai-agents', file);
|
|
889
|
-
const destPath = path.join('.ai-agents', file);
|
|
890
|
-
|
|
891
|
-
if (fs.existsSync(sourcePath)) {
|
|
892
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
893
|
-
logSuccess(`Copied ${file}`);
|
|
894
|
-
} else {
|
|
895
|
-
console.log(`⚠️ Warning: ${file} not found in package`);
|
|
896
|
-
}
|
|
897
|
-
} catch (error) {
|
|
898
|
-
console.log(`⚠️ Warning: Could not copy ${file}: ${error.message}`);
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
|
|
902
|
-
// Copy script files
|
|
903
|
-
const scriptFiles = [
|
|
904
|
-
'scripts/cleanup-branch.ts',
|
|
905
|
-
'scripts/exec-with-timeout.ts',
|
|
906
|
-
'scripts/prep-issue.sh'
|
|
907
|
-
];
|
|
908
|
-
|
|
909
|
-
scriptFiles.forEach(file => {
|
|
910
|
-
try {
|
|
911
|
-
const sourcePath = path.join(__dirname, '.ai-agents', file);
|
|
912
|
-
const destPath = path.join('.ai-agents', file);
|
|
913
|
-
|
|
914
|
-
if (fs.existsSync(sourcePath)) {
|
|
915
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
916
|
-
logSuccess(`Copied ${file}`);
|
|
917
|
-
} else {
|
|
918
|
-
console.log(`⚠️ Warning: ${file} not found in package`);
|
|
919
|
-
}
|
|
920
|
-
} catch (error) {
|
|
921
|
-
console.log(`⚠️ Warning: Could not copy ${file}: ${error.message}`);
|
|
922
|
-
}
|
|
923
|
-
});
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
// Copy additional files
|
|
927
|
-
function copyAdditionalFiles() {
|
|
928
|
-
const fs = require('fs');
|
|
929
|
-
const path = require('path');
|
|
930
|
-
|
|
931
|
-
// Copy sample files
|
|
932
|
-
const additionalFiles = [
|
|
933
|
-
'sample_package.json',
|
|
934
|
-
'test-utils.ts',
|
|
935
|
-
'tsconfig.json'
|
|
936
|
-
];
|
|
937
|
-
|
|
938
|
-
additionalFiles.forEach(file => {
|
|
939
|
-
try {
|
|
940
|
-
const sourcePath = path.join(__dirname, file);
|
|
941
|
-
const destPath = file;
|
|
942
|
-
|
|
943
|
-
if (fs.existsSync(sourcePath)) {
|
|
944
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
945
|
-
logSuccess(`Copied ${file}`);
|
|
946
|
-
} else {
|
|
947
|
-
console.log(`⚠️ Warning: ${file} not found in package`);
|
|
948
|
-
}
|
|
949
|
-
} catch (error) {
|
|
950
|
-
console.log(`⚠️ Warning: Could not copy ${file}: ${error.message}`);
|
|
951
|
-
}
|
|
952
|
-
});
|
|
120
|
+
- [ ] Self-review completed
|
|
121
|
+
- [ ] Tests added/updated
|
|
122
|
+
- [ ] Documentation updated
|
|
123
|
+
`;
|
|
953
124
|
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
const examplesDest = 'examples/simple-webapp';
|
|
958
|
-
|
|
959
|
-
if (fs.existsSync(examplesSource)) {
|
|
960
|
-
ensureDirectory(examplesDest);
|
|
961
|
-
|
|
962
|
-
const exampleFiles = [
|
|
963
|
-
'example-test.ts',
|
|
964
|
-
'TESTING.md'
|
|
965
|
-
];
|
|
966
|
-
|
|
967
|
-
exampleFiles.forEach(file => {
|
|
968
|
-
const sourcePath = path.join(examplesSource, file);
|
|
969
|
-
const destPath = path.join(examplesDest, file);
|
|
970
|
-
|
|
971
|
-
if (fs.existsSync(sourcePath)) {
|
|
972
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
973
|
-
logSuccess(`Copied examples/simple-webapp/${file}`);
|
|
974
|
-
}
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
|
-
} catch (error) {
|
|
978
|
-
console.log(`⚠️ Warning: Could not copy examples: ${error.message}`);
|
|
979
|
-
}
|
|
125
|
+
ensureDirectory('.github');
|
|
126
|
+
fs.writeFileSync('.github/pull_request_template.md', prTemplateContent);
|
|
127
|
+
logSuccess('Created PR template');
|
|
980
128
|
}
|
|
981
129
|
|
|
982
|
-
//
|
|
130
|
+
// Main setup function
|
|
983
131
|
function runSetup() {
|
|
984
132
|
console.log('🚀 Setting up FRAIM in current repository...\n');
|
|
985
133
|
|
|
986
134
|
try {
|
|
987
|
-
|
|
135
|
+
// Copy full directories
|
|
136
|
+
const directoriesToCopy = [
|
|
137
|
+
'.ai-agents',
|
|
138
|
+
'.github/workflows',
|
|
139
|
+
'examples'
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
directoriesToCopy.forEach(dir => {
|
|
143
|
+
const srcPath = path.join(__dirname, dir);
|
|
144
|
+
const destPath = dir;
|
|
145
|
+
copyDirectory(srcPath, destPath);
|
|
146
|
+
logSuccess(`Copied ${dir}/`);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// Copy individual files
|
|
150
|
+
const filesToCopy = [
|
|
151
|
+
'sample_package.json',
|
|
152
|
+
'test-utils.ts',
|
|
153
|
+
'tsconfig.json'
|
|
154
|
+
];
|
|
155
|
+
|
|
156
|
+
filesToCopy.forEach(file => {
|
|
157
|
+
const srcPath = path.join(__dirname, file);
|
|
158
|
+
copyFile(srcPath, file);
|
|
159
|
+
logSuccess(`Copied ${file}`);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// Create special files
|
|
163
|
+
createGitHubLabels();
|
|
164
|
+
createCodeOwners();
|
|
165
|
+
createPRTemplate();
|
|
166
|
+
|
|
988
167
|
console.log('\n✅ FRAIM setup complete!');
|
|
989
168
|
console.log('🎯 Your repository is now ready for AI agent management.');
|
|
990
169
|
console.log('📚 Next steps:');
|
|
@@ -992,8 +171,9 @@ function runSetup() {
|
|
|
992
171
|
console.log(' 2. Update .ai-agents/scripts/cleanup-branch.ts with your cleanup logic');
|
|
993
172
|
console.log(' 3. Copy scripts from sample_package.json to your package.json');
|
|
994
173
|
console.log(' 4. Start creating issues with phase labels!');
|
|
174
|
+
|
|
995
175
|
} catch (error) {
|
|
996
|
-
|
|
176
|
+
logError(`Setup failed: ${error.message}`);
|
|
997
177
|
throw error;
|
|
998
178
|
}
|
|
999
179
|
}
|